Files
intotheeast-com-content/themes/intotheeast/js/map.js
T

590 lines
861 KiB
JavaScript

(()=>{var jm=Object.create;var Jp=Object.defineProperty;var $m=Object.getOwnPropertyDescriptor;var Zm=Object.getOwnPropertyNames;var Gm=Object.getPrototypeOf,Hm=Object.prototype.hasOwnProperty;var xa=(w,S)=>()=>(S||w((S={exports:{}}).exports,S),S.exports);var Xm=(w,S,F,Y)=>{if(S&&typeof S=="object"||typeof S=="function")for(let E of Zm(S))!Hm.call(w,E)&&E!==F&&Jp(w,E,{get:()=>S[E],enumerable:!(Y=$m(S,E))||Y.enumerable});return w};var Kp=(w,S,F)=>(F=w!=null?jm(Gm(w)):{},Xm(S||!w||!w.__esModule?Jp(F,"default",{value:w,enumerable:!0}):F,w));var Qp=xa((Xc,Wc)=>{(function(w,S){typeof Xc=="object"&&typeof Wc<"u"?Wc.exports=S():typeof define=="function"&&define.amd?define(S):(w=typeof globalThis<"u"?globalThis:w||self,w.maplibregl=S())})(Xc,function(){"use strict";var w={},S={};function F(E,p,ue){if(S[E]=ue,E==="index"){var pe="var sharedModule = {}; ("+S.shared+")(sharedModule); ("+S.worker+")(sharedModule);",Ce={};return S.shared(Ce),S.index(w,Ce),typeof window<"u"&&w.setWorkerUrl(window.URL.createObjectURL(new Blob([pe],{type:"text/javascript"}))),w}}F("shared",["exports"],function(E){"use strict";function p(i,t,r,a){return new(r||(r=Promise))(function(l,h){function d(v){try{g(a.next(v))}catch(x){h(x)}}function f(v){try{g(a.throw(v))}catch(x){h(x)}}function g(v){var x;v.done?l(v.value):(x=v.value,x instanceof r?x:new r(function(A){A(x)})).then(d,f)}g((a=a.apply(i,t||[])).next())})}function ue(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}typeof SuppressedError=="function"&&SuppressedError;var pe=Ce;function Ce(i,t){this.x=i,this.y=t}Ce.prototype={clone:function(){return new Ce(this.x,this.y)},add:function(i){return this.clone()._add(i)},sub:function(i){return this.clone()._sub(i)},multByPoint:function(i){return this.clone()._multByPoint(i)},divByPoint:function(i){return this.clone()._divByPoint(i)},mult:function(i){return this.clone()._mult(i)},div:function(i){return this.clone()._div(i)},rotate:function(i){return this.clone()._rotate(i)},rotateAround:function(i,t){return this.clone()._rotateAround(i,t)},matMult:function(i){return this.clone()._matMult(i)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(i){return this.x===i.x&&this.y===i.y},dist:function(i){return Math.sqrt(this.distSqr(i))},distSqr:function(i){var t=i.x-this.x,r=i.y-this.y;return t*t+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(i){return Math.atan2(this.y-i.y,this.x-i.x)},angleWith:function(i){return this.angleWithSep(i.x,i.y)},angleWithSep:function(i,t){return Math.atan2(this.x*t-this.y*i,this.x*i+this.y*t)},_matMult:function(i){var t=i[2]*this.x+i[3]*this.y;return this.x=i[0]*this.x+i[1]*this.y,this.y=t,this},_add:function(i){return this.x+=i.x,this.y+=i.y,this},_sub:function(i){return this.x-=i.x,this.y-=i.y,this},_mult:function(i){return this.x*=i,this.y*=i,this},_div:function(i){return this.x/=i,this.y/=i,this},_multByPoint:function(i){return this.x*=i.x,this.y*=i.y,this},_divByPoint:function(i){return this.x/=i.x,this.y/=i.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var i=this.y;return this.y=this.x,this.x=-i,this},_rotate:function(i){var t=Math.cos(i),r=Math.sin(i),a=r*this.x+t*this.y;return this.x=t*this.x-r*this.y,this.y=a,this},_rotateAround:function(i,t){var r=Math.cos(i),a=Math.sin(i),l=t.y+a*(this.x-t.x)+r*(this.y-t.y);return this.x=t.x+r*(this.x-t.x)-a*(this.y-t.y),this.y=l,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},Ce.convert=function(i){return i instanceof Ce?i:Array.isArray(i)?new Ce(i[0],i[1]):i};var se=ue(pe),X=It;function It(i,t,r,a){this.cx=3*i,this.bx=3*(r-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(a-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=t,this.p2x=r,this.p2y=a}It.prototype={sampleCurveX:function(i){return((this.ax*i+this.bx)*i+this.cx)*i},sampleCurveY:function(i){return((this.ay*i+this.by)*i+this.cy)*i},sampleCurveDerivativeX:function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},solveCurveX:function(i,t){if(t===void 0&&(t=1e-6),i<0)return 0;if(i>1)return 1;for(var r=i,a=0;a<8;a++){var l=this.sampleCurveX(r)-i;if(Math.abs(l)<t)return r;var h=this.sampleCurveDerivativeX(r);if(Math.abs(h)<1e-6)break;r-=l/h}var d=0,f=1;for(r=i,a=0;a<20&&(l=this.sampleCurveX(r),!(Math.abs(l-i)<t));a++)i>l?d=r:f=r,r=.5*(f-d)+d;return r},solve:function(i,t){return this.sampleCurveY(this.solveCurveX(i,t))}};var mt=ue(X);let Et,li;function Lt(){return Et==null&&(Et=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Et}function Mt(){if(li==null&&(li=!1,Lt())){let t=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(t){for(let a=0;a<5*5;a++){let l=4*a;t.fillStyle=`rgb(${l},${l+1},${l+2})`,t.fillRect(a%5,Math.floor(a/5),1,1)}let r=t.getImageData(0,0,5,5).data;for(let a=0;a<5*5*4;a++)if(a%4!=3&&r[a]!==a){li=!0;break}}}return li||!1}function De(i,t,r,a){let l=new mt(i,t,r,a);return h=>l.solve(h)}let We=De(.25,.1,.25,1);function Re(i,t,r){return Math.min(r,Math.max(t,i))}function Fe(i,t,r){let a=r-t,l=((i-t)%a+a)%a+t;return l===t?r:l}function Ye(i,...t){for(let r of t)for(let a in r)i[a]=r[a];return i}let _e=1;function xe(i,t,r){let a={};for(let l in i)a[l]=t.call(this,i[l],l,i);return a}function Le(i,t,r){let a={};for(let l in i)t.call(this,i[l],l,i)&&(a[l]=i[l]);return a}function ye(i){return Array.isArray(i)?i.map(ye):typeof i=="object"&&i?xe(i,ye):i}let Je={};function Pe(i){Je[i]||(typeof console<"u"&&console.warn(i),Je[i]=!0)}function tt(i,t,r){return(r.y-i.y)*(t.x-i.x)>(t.y-i.y)*(r.x-i.x)}function Ge(i){return typeof WorkerGlobalScope<"u"&&i!==void 0&&i instanceof WorkerGlobalScope}let at=null;function ht(i){return typeof ImageBitmap<"u"&&i instanceof ImageBitmap}let _t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function Ne(i,t,r,a,l){return p(this,void 0,void 0,function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");let h=new VideoFrame(i,{timestamp:0});try{let d=h?.format;if(!d||!d.startsWith("BGR")&&!d.startsWith("RGB"))throw new Error(`Unrecognized format ${d}`);let f=d.startsWith("BGR"),g=new Uint8ClampedArray(a*l*4);if(yield h.copyTo(g,function(v,x,A,D,M){let z=4*Math.max(-x,0),B=(Math.max(0,A)-A)*D*4+z,q=4*D,$=Math.max(0,x),ne=Math.max(0,A);return{rect:{x:$,y:ne,width:Math.min(v.width,x+D)-$,height:Math.min(v.height,A+M)-ne},layout:[{offset:B,stride:q}]}}(i,t,r,a,l)),f)for(let v=0;v<g.length;v+=4){let x=g[v];g[v]=g[v+2],g[v+2]=x}return g}finally{h.close()}})}let kt,Wt,dt="AbortError";function Pt(){return new Error(dt)}let xt={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function Nt(i){return xt.REGISTERED_PROTOCOLS[i.substring(0,i.indexOf("://"))]}let $t="global-dispatcher";class vt extends Error{constructor(t,r,a,l){super(`AJAXError: ${r} (${t}): ${a}`),this.status=t,this.statusText=r,this.url=a,this.body=l}}let ui=()=>Ge(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,Qe=function(i,t){if(/:\/\//.test(i.url)&&!/^https?:|^file:/.test(i.url)){let a=Nt(i.url);if(a)return a(i,t);if(Ge(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:i,targetMapId:$t},t)}if(!(/^file:/.test(r=i.url)||/^file:/.test(ui())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(a,l){return p(this,void 0,void 0,function*(){let h=new Request(a.url,{method:a.method||"GET",body:a.body,credentials:a.credentials,headers:a.headers,cache:a.cache,referrer:ui(),signal:l.signal});a.type!=="json"||h.headers.has("Accept")||h.headers.set("Accept","application/json");let d=yield fetch(h);if(!d.ok){let v=yield d.blob();throw new vt(d.status,d.statusText,a.url,v)}let f;f=a.type==="arrayBuffer"||a.type==="image"?d.arrayBuffer():a.type==="json"?d.json():d.text();let g=yield f;if(l.signal.aborted)throw Pt();return{data:g,cacheControl:d.headers.get("Cache-Control"),expires:d.headers.get("Expires")}})}(i,t);if(Ge(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:i,mustQueue:!0,targetMapId:$t},t)}var r;return function(a,l){return new Promise((h,d)=>{var f;let g=new XMLHttpRequest;g.open(a.method||"GET",a.url,!0),a.type!=="arrayBuffer"&&a.type!=="image"||(g.responseType="arraybuffer");for(let v in a.headers)g.setRequestHeader(v,a.headers[v]);a.type==="json"&&(g.responseType="text",!((f=a.headers)===null||f===void 0)&&f.Accept||g.setRequestHeader("Accept","application/json")),g.withCredentials=a.credentials==="include",g.onerror=()=>{d(new Error(g.statusText))},g.onload=()=>{if(!l.signal.aborted)if((g.status>=200&&g.status<300||g.status===0)&&g.response!==null){let v=g.response;if(a.type==="json")try{v=JSON.parse(g.response)}catch(x){return void d(x)}h({data:v,cacheControl:g.getResponseHeader("Cache-Control"),expires:g.getResponseHeader("Expires")})}else{let v=new Blob([g.response],{type:g.getResponseHeader("Content-Type")});d(new vt(g.status,g.statusText,a.url,v))}},l.signal.addEventListener("abort",()=>{g.abort(),d(Pt())}),g.send(a.body)})}(i,t)};function gt(i){if(!i||i.indexOf("://")<=0||i.indexOf("data:image/")===0||i.indexOf("blob:")===0)return!0;let t=new URL(i),r=window.location;return t.protocol===r.protocol&&t.host===r.host}function Vt(i,t,r){r[i]&&r[i].indexOf(t)!==-1||(r[i]=r[i]||[],r[i].push(t))}function ut(i,t,r){if(r&&r[i]){let a=r[i].indexOf(t);a!==-1&&r[i].splice(a,1)}}class ci{constructor(t,r={}){Ye(this,r),this.type=t}}class bi extends ci{constructor(t,r={}){super("error",Ye({error:t},r))}}class Kt{on(t,r){return this._listeners=this._listeners||{},Vt(t,r,this._listeners),this}off(t,r){return ut(t,r,this._listeners),ut(t,r,this._oneTimeListeners),this}once(t,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},Vt(t,r,this._oneTimeListeners),this):new Promise(a=>this.once(t,a))}fire(t,r){typeof t=="string"&&(t=new ci(t,r||{}));let a=t.type;if(this.listens(a)){t.target=this;let l=this._listeners&&this._listeners[a]?this._listeners[a].slice():[];for(let f of l)f.call(this,t);let h=this._oneTimeListeners&&this._oneTimeListeners[a]?this._oneTimeListeners[a].slice():[];for(let f of h)ut(a,f,this._oneTimeListeners),f.call(this,t);let d=this._eventedParent;d&&(Ye(t,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),d.fire(t))}else t instanceof bi&&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,r){return this._eventedParent=t,this._eventedParentData=r,this}}var oe={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"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","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"enum",default:"mercator",values:{mercator:{},globe:{}}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};let Xi=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function kr(i,t){let r={};for(let a in i)a!=="ref"&&(r[a]=i[a]);return Xi.forEach(a=>{a in t&&(r[a]=t[a])}),r}function wt(i,t){if(Array.isArray(i)){if(!Array.isArray(t)||i.length!==t.length)return!1;for(let r=0;r<i.length;r++)if(!wt(i[r],t[r]))return!1;return!0}if(typeof i=="object"&&i!==null&&t!==null){if(typeof t!="object"||Object.keys(i).length!==Object.keys(t).length)return!1;for(let r in i)if(!wt(i[r],t[r]))return!1;return!0}return i===t}function Zt(i,t){i.push(t)}function _r(i,t,r){Zt(r,{command:"addSource",args:[i,t[i]]})}function Mr(i,t,r){Zt(t,{command:"removeSource",args:[i]}),r[i]=!0}function Wi(i,t,r,a){Mr(i,r,a),_r(i,t,r)}function Qr(i,t,r){let a;for(a in i[r])if(Object.prototype.hasOwnProperty.call(i[r],a)&&a!=="data"&&!wt(i[r][a],t[r][a]))return!1;for(a in t[r])if(Object.prototype.hasOwnProperty.call(t[r],a)&&a!=="data"&&!wt(i[r][a],t[r][a]))return!1;return!0}function Ui(i,t,r,a,l,h){i=i||{},t=t||{};for(let d in i)Object.prototype.hasOwnProperty.call(i,d)&&(wt(i[d],t[d])||r.push({command:h,args:[a,d,t[d],l]}));for(let d in t)Object.prototype.hasOwnProperty.call(t,d)&&!Object.prototype.hasOwnProperty.call(i,d)&&(wt(i[d],t[d])||r.push({command:h,args:[a,d,t[d],l]}))}function sn(i){return i.id}function yn(i,t){return i[t.id]=t,i}class be{constructor(t,r,a,l){this.message=(t?`${t}: `:"")+a,l&&(this.identifier=l),r!=null&&r.__line__&&(this.line=r.__line__)}}function or(i,...t){for(let r of t)for(let a in r)i[a]=r[a];return i}class Ai extends Error{constructor(t,r){super(r),this.message=r,this.key=t}}class lr{constructor(t,r=[]){this.parent=t,this.bindings={};for(let[a,l]of r)this.bindings[a]=l}concat(t){return new lr(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)}}let Pr={kind:"null"},we={kind:"number"},ft={kind:"string"},nt={kind:"boolean"},Si={kind:"color"},Ji={kind:"object"},st={kind:"value"},Ki={kind:"collator"},yr={kind:"formatted"},on={kind:"padding"},Zr={kind:"resolvedImage"},j={kind:"variableAnchorOffsetCollection"};function k(i,t){return{kind:"array",itemType:i,N:t}}function I(i){if(i.kind==="array"){let t=I(i.itemType);return typeof i.N=="number"?`array<${t}, ${i.N}>`:i.itemType.kind==="value"?"array":`array<${t}>`}return i.kind}let R=[Pr,we,ft,nt,Si,yr,Ji,k(st),on,Zr,j];function V(i,t){if(t.kind==="error")return null;if(i.kind==="array"){if(t.kind==="array"&&(t.N===0&&t.itemType.kind==="value"||!V(i.itemType,t.itemType))&&(typeof i.N!="number"||i.N===t.N))return null}else{if(i.kind===t.kind)return null;if(i.kind==="value"){for(let r of R)if(!V(r,t))return null}}return`Expected ${I(i)} but found ${I(t)} instead.`}function K(i,t){return t.some(r=>r.kind===i.kind)}function ee(i,t){return t.some(r=>r==="null"?i===null:r==="array"?Array.isArray(i):r==="object"?i&&!Array.isArray(i)&&typeof i=="object":r===typeof i)}function re(i,t){return i.kind==="array"&&t.kind==="array"?i.itemType.kind===t.itemType.kind&&typeof i.N=="number":i.kind===t.kind}let H=.96422,he=.82521,me=4/29,le=6/29,Ae=3*le*le,Ke=le*le*le,et=Math.PI/180,zt=180/Math.PI;function pt(i){return(i%=360)<0&&(i+=360),i}function Bt([i,t,r,a]){let l,h,d=yi((.2225045*(i=Tt(i))+.7168786*(t=Tt(t))+.0606169*(r=Tt(r)))/1);i===t&&t===r?l=h=d:(l=yi((.4360747*i+.3850649*t+.1430804*r)/H),h=yi((.0139322*i+.0971045*t+.7141733*r)/he));let f=116*d-16;return[f<0?0:f,500*(l-d),200*(d-h),a]}function Tt(i){return i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function yi(i){return i>Ke?Math.pow(i,1/3):i/Ae+me}function hi([i,t,r,a]){let l=(i+16)/116,h=isNaN(t)?l:l+t/500,d=isNaN(r)?l:l-r/200;return l=1*Ut(l),h=H*Ut(h),d=he*Ut(d),[bt(3.1338561*h-1.6168667*l-.4906146*d),bt(-.9787684*h+1.9161415*l+.033454*d),bt(.0719453*h-.2289914*l+1.4052427*d),a]}function bt(i){return(i=i<=.00304?12.92*i:1.055*Math.pow(i,1/2.4)-.055)<0?0:i>1?1:i}function Ut(i){return i>le?i*i*i:Ae*(i-me)}function oi(i){return parseInt(i.padEnd(2,i),16)/255}function Ei(i,t){return Ii(t?i/100:i,0,1)}function Ii(i,t,r){return Math.min(Math.max(t,i),r)}function ji(i){return!i.some(Number.isNaN)}let qn={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};class jt{constructor(t,r,a,l=1,h=!0){this.r=t,this.g=r,this.b=a,this.a=l,h||(this.r*=l,this.g*=l,this.b*=l,l||this.overwriteGetter("rgb",[t,r,a,l]))}static parse(t){if(t instanceof jt)return t;if(typeof t!="string")return;let r=function(a){if((a=a.toLowerCase().trim())==="transparent")return[0,0,0,0];let l=qn[a];if(l){let[d,f,g]=l;return[d/255,f/255,g/255,1]}if(a.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(a)){let d=a.length<6?1:2,f=1;return[oi(a.slice(f,f+=d)),oi(a.slice(f,f+=d)),oi(a.slice(f,f+=d)),oi(a.slice(f,f+d)||"ff")]}if(a.startsWith("rgb")){let d=a.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(d){let[f,g,v,x,A,D,M,z,B,q,$,ne]=d,J=[x||" ",M||" ",q].join("");if(J===" "||J===" /"||J===",,"||J===",,,"){let ie=[v,D,B].join(""),ce=ie==="%%%"?100:ie===""?255:0;if(ce){let ge=[Ii(+g/ce,0,1),Ii(+A/ce,0,1),Ii(+z/ce,0,1),$?Ei(+$,ne):1];if(ji(ge))return ge}}return}}let h=a.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(h){let[d,f,g,v,x,A,D,M,z]=h,B=[g||" ",x||" ",D].join("");if(B===" "||B===" /"||B===",,"||B===",,,"){let q=[+f,Ii(+v,0,100),Ii(+A,0,100),M?Ei(+M,z):1];if(ji(q))return function([$,ne,J,ie]){function ce(ge){let Be=(ge+$/30)%12,it=ne*Math.min(J,1-J);return J-it*Math.max(-1,Math.min(Be-3,9-Be,1))}return $=pt($),ne/=100,J/=100,[ce(0),ce(8),ce(4),ie]}(q)}}}(t);return r?new jt(...r,!1):void 0}get rgb(){let{r:t,g:r,b:a,a:l}=this,h=l||1/0;return this.overwriteGetter("rgb",[t/h,r/h,a/h,l])}get hcl(){return this.overwriteGetter("hcl",function(t){let[r,a,l,h]=Bt(t),d=Math.sqrt(a*a+l*l);return[Math.round(1e4*d)?pt(Math.atan2(l,a)*zt):NaN,d,r,h]}(this.rgb))}get lab(){return this.overwriteGetter("lab",Bt(this.rgb))}overwriteGetter(t,r){return Object.defineProperty(this,t,{value:r}),r}toString(){let[t,r,a,l]=this.rgb;return`rgba(${[t,r,a].map(h=>Math.round(255*h)).join(",")},${l})`}}jt.black=new jt(0,0,0,1),jt.white=new jt(1,1,1,1),jt.transparent=new jt(0,0,0,0),jt.red=new jt(1,0,0,1);class Ys{constructor(t,r,a){this.sensitivity=t?r?"variant":"case":r?"accent":"base",this.locale=a,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,r){return this.collator.compare(t,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Qs{constructor(t,r,a,l,h){this.text=t,this.image=r,this.scale=a,this.fontStack=l,this.textColor=h}}class ur{constructor(t){this.sections=t}static fromString(t){return new ur([new Qs(t,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(t=>t.text.length!==0||t.image&&t.image.name.length!==0)}static factory(t){return t instanceof ur?t:ur.fromString(t)}toString(){return this.sections.length===0?"":this.sections.map(t=>t.text).join("")}}class cr{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof cr)return t;if(typeof t=="number")return new cr([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(let r of t)if(typeof r!="number")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 cr(t)}}toString(){return JSON.stringify(this.values)}}let zu=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class vr{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof vr)return t;if(Array.isArray(t)&&!(t.length<1)&&t.length%2==0){for(let r=0;r<t.length;r+=2){let a=t[r],l=t[r+1];if(typeof a!="string"||!zu.has(a)||!Array.isArray(l)||l.length!==2||typeof l[0]!="number"||typeof l[1]!="number")return}return new vr(t)}}toString(){return JSON.stringify(this.values)}}class hr{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new hr({name:t,available:!1}):null}}function Vn(i,t,r,a){return typeof i=="number"&&i>=0&&i<=255&&typeof t=="number"&&t>=0&&t<=255&&typeof r=="number"&&r>=0&&r<=255?a===void 0||typeof a=="number"&&a>=0&&a<=1?null:`Invalid rgba value [${[i,t,r,a].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof a=="number"?[i,t,r,a]:[i,t,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function vn(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof jt||i instanceof Ys||i instanceof ur||i instanceof cr||i instanceof vr||i instanceof hr)return!0;if(Array.isArray(i)){for(let t of i)if(!vn(t))return!1;return!0}if(typeof i=="object"){for(let t in i)if(!vn(i[t]))return!1;return!0}return!1}function vi(i){if(i===null)return Pr;if(typeof i=="string")return ft;if(typeof i=="boolean")return nt;if(typeof i=="number")return we;if(i instanceof jt)return Si;if(i instanceof Ys)return Ki;if(i instanceof ur)return yr;if(i instanceof cr)return on;if(i instanceof vr)return j;if(i instanceof hr)return Zr;if(Array.isArray(i)){let t=i.length,r;for(let a of i){let l=vi(a);if(r){if(r===l)continue;r=st;break}r=l}return k(r||st,t)}return Ji}function wa(i){let t=typeof i;return i===null?"":t==="string"||t==="number"||t==="boolean"?String(i):i instanceof jt||i instanceof ur||i instanceof cr||i instanceof vr||i instanceof hr?i.toString():JSON.stringify(i)}class zr{constructor(t,r){this.type=t,this.value=r}static parse(t,r){if(t.length!==2)return r.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!vn(t[1]))return r.error("invalid value");let a=t[1],l=vi(a),h=r.expectedType;return l.kind!=="array"||l.N!==0||!h||h.kind!=="array"||typeof h.N=="number"&&h.N!==0||(l=h),new zr(l,a)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class gi{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}}let Wa={string:ft,number:we,boolean:nt,object:Ji};class Br{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let a,l=1,h=t[0];if(h==="array"){let f,g;if(t.length>2){let v=t[1];if(typeof v!="string"||!(v in Wa)||v==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);f=Wa[v],l++}else f=st;if(t.length>3){if(t[2]!==null&&(typeof t[2]!="number"||t[2]<0||t[2]!==Math.floor(t[2])))return r.error('The length argument to "array" must be a positive integer literal',2);g=t[2],l++}a=k(f,g)}else{if(!Wa[h])throw new Error(`Types doesn't contain name = ${h}`);a=Wa[h]}let d=[];for(;l<t.length;l++){let f=r.parse(t[l],l,st);if(!f)return null;d.push(f)}return new Br(a,d)}evaluate(t){for(let r=0;r<this.args.length;r++){let a=this.args[r].evaluate(t);if(!V(this.type,vi(a)))return a;if(r===this.args.length-1)throw new gi(`Expected value to be of type ${I(this.type)}, but found ${I(vi(a))} instead.`)}throw new Error}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}let eo={"to-boolean":nt,"to-color":Si,"to-number":we,"to-string":ft};class Lr{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let a=t[0];if(!eo[a])throw new Error(`Can't parse ${a} as it is not part of the known types`);if((a==="to-boolean"||a==="to-string")&&t.length!==2)return r.error("Expected one argument.");let l=eo[a],h=[];for(let d=1;d<t.length;d++){let f=r.parse(t[d],d,st);if(!f)return null;h.push(f)}return new Lr(l,h)}evaluate(t){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(t);case"color":{let r,a;for(let l of this.args){if(r=l.evaluate(t),a=null,r instanceof jt)return r;if(typeof r=="string"){let h=t.parseColor(r);if(h)return h}else if(Array.isArray(r)&&(a=r.length<3||r.length>4?`Invalid rbga value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:Vn(r[0],r[1],r[2],r[3]),!a))return new jt(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new gi(a||`Could not parse color from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"padding":{let r;for(let a of this.args){r=a.evaluate(t);let l=cr.parse(r);if(l)return l}throw new gi(`Could not parse padding from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"variableAnchorOffsetCollection":{let r;for(let a of this.args){r=a.evaluate(t);let l=vr.parse(r);if(l)return l}throw new gi(`Could not parse variableAnchorOffsetCollection from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"number":{let r=null;for(let a of this.args){if(r=a.evaluate(t),r===null)return 0;let l=Number(r);if(!isNaN(l))return l}throw new gi(`Could not convert ${JSON.stringify(r)} to number.`)}case"formatted":return ur.fromString(wa(this.args[0].evaluate(t)));case"resolvedImage":return hr.fromString(wa(this.args[0].evaluate(t)));default:return wa(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}let Bu=["Unknown","Point","LineString","Polygon"];class Ja{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?Bu[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 r=this._parseColorCache[t];return r||(r=this._parseColorCache[t]=jt.parse(t)),r}}class xn{constructor(t,r,a=[],l,h=new lr,d=[]){this.registry=t,this.path=a,this.key=a.map(f=>`[${f}]`).join(""),this.scope=h,this.errors=d,this.expectedType=l,this._isConstant=r}parse(t,r,a,l,h={}){return r?this.concat(r,a,l)._parse(t,h):this._parse(t,h)}_parse(t,r){function a(l,h,d){return d==="assert"?new Br(h,[l]):d==="coerce"?new Lr(h,[l]):l}if(t!==null&&typeof t!="string"&&typeof t!="boolean"&&typeof t!="number"||(t=["literal",t]),Array.isArray(t)){if(t.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');let l=t[0];if(typeof l!="string")return this.error(`Expression name must be a string, but found ${typeof l} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;let h=this.registry[l];if(h){let d=h.parse(t,this);if(!d)return null;if(this.expectedType){let f=this.expectedType,g=d.type;if(f.kind!=="string"&&f.kind!=="number"&&f.kind!=="boolean"&&f.kind!=="object"&&f.kind!=="array"||g.kind!=="value")if(f.kind!=="color"&&f.kind!=="formatted"&&f.kind!=="resolvedImage"||g.kind!=="value"&&g.kind!=="string")if(f.kind!=="padding"||g.kind!=="value"&&g.kind!=="number"&&g.kind!=="array")if(f.kind!=="variableAnchorOffsetCollection"||g.kind!=="value"&&g.kind!=="array"){if(this.checkSubtype(f,g))return null}else d=a(d,f,r.typeAnnotation||"coerce");else d=a(d,f,r.typeAnnotation||"coerce");else d=a(d,f,r.typeAnnotation||"coerce");else d=a(d,f,r.typeAnnotation||"assert")}if(!(d instanceof zr)&&d.type.kind!=="resolvedImage"&&this._isConstant(d)){let f=new Ja;try{d=new zr(d.type,d.evaluate(f))}catch(g){return this.error(g.message),null}}return d}return this.error(`Unknown expression "${l}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(t===void 0?"'undefined' value invalid. Use null instead.":typeof t=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof t} instead.`)}concat(t,r,a){let l=typeof t=="number"?this.path.concat(t):this.path,h=a?this.scope.concat(a):this.scope;return new xn(this.registry,this._isConstant,l,r||null,h,this.errors)}error(t,...r){let a=`${this.key}${r.map(l=>`[${l}]`).join("")}`;this.errors.push(new Ai(a,t))}checkSubtype(t,r){let a=V(t,r);return a&&this.error(a),a}}class ln{constructor(t,r){this.type=r.type,this.bindings=[].concat(t),this.result=r}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(let r of this.bindings)t(r[1]);t(this.result)}static parse(t,r){if(t.length<4)return r.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);let a=[];for(let h=1;h<t.length-1;h+=2){let d=t[h];if(typeof d!="string")return r.error(`Expected string, but found ${typeof d} instead.`,h);if(/[^a-zA-Z0-9_]/.test(d))return r.error("Variable names must contain only alphanumeric characters or '_'.",h);let f=r.parse(t[h+1],h+1);if(!f)return null;a.push([d,f])}let l=r.parse(t[t.length-1],t.length-1,r.expectedType,a);return l?new ln(a,l):null}outputDefined(){return this.result.outputDefined()}}class Ot{constructor(t,r){this.type=r.type,this.name=t,this.boundExpression=r}static parse(t,r){if(t.length!==2||typeof t[1]!="string")return r.error("'var' expression requires exactly one string literal argument.");let a=t[1];return r.scope.has(a)?new Ot(a,r.scope.get(a)):r.error(`Unknown variable "${a}". Make sure "${a}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}}class to{constructor(t,r,a){this.type=t,this.index=r,this.input=a}static parse(t,r){if(t.length!==3)return r.error(`Expected 2 arguments, but found ${t.length-1} instead.`);let a=r.parse(t[1],1,we),l=r.parse(t[2],2,k(r.expectedType||st));return a&&l?new to(l.type.itemType,a,l):null}evaluate(t){let r=this.index.evaluate(t),a=this.input.evaluate(t);if(r<0)throw new gi(`Array index out of bounds: ${r} < 0.`);if(r>=a.length)throw new gi(`Array index out of bounds: ${r} > ${a.length-1}.`);if(r!==Math.floor(r))throw new gi(`Array index must be an integer, but found ${r} instead.`);return a[r]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}}class io{constructor(t,r){this.type=nt,this.needle=t,this.haystack=r}static parse(t,r){if(t.length!==3)return r.error(`Expected 2 arguments, but found ${t.length-1} instead.`);let a=r.parse(t[1],1,st),l=r.parse(t[2],2,st);return a&&l?K(a.type,[nt,ft,we,Pr,st])?new io(a,l):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${I(a.type)} instead`):null}evaluate(t){let r=this.needle.evaluate(t),a=this.haystack.evaluate(t);if(!a)return!1;if(!ee(r,["boolean","string","number","null"]))throw new gi(`Expected first argument to be of type boolean, string, number or null, but found ${I(vi(r))} instead.`);if(!ee(a,["string","array"]))throw new gi(`Expected second argument to be of type array or string, but found ${I(vi(a))} instead.`);return a.indexOf(r)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}}class Un{constructor(t,r,a){this.type=we,this.needle=t,this.haystack=r,this.fromIndex=a}static parse(t,r){if(t.length<=2||t.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);let a=r.parse(t[1],1,st),l=r.parse(t[2],2,st);if(!a||!l)return null;if(!K(a.type,[nt,ft,we,Pr,st]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${I(a.type)} instead`);if(t.length===4){let h=r.parse(t[3],3,we);return h?new Un(a,l,h):null}return new Un(a,l)}evaluate(t){let r=this.needle.evaluate(t),a=this.haystack.evaluate(t);if(!ee(r,["boolean","string","number","null"]))throw new gi(`Expected first argument to be of type boolean, string, number or null, but found ${I(vi(r))} instead.`);let l;if(this.fromIndex&&(l=this.fromIndex.evaluate(t)),ee(a,["string"])){let h=a.indexOf(r,l);return h===-1?-1:[...a.slice(0,h)].length}if(ee(a,["array"]))return a.indexOf(r,l);throw new gi(`Expected second argument to be of type array or string, but found ${I(vi(a))} instead.`)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}}class ro{constructor(t,r,a,l,h,d){this.inputType=t,this.type=r,this.input=a,this.cases=l,this.outputs=h,this.otherwise=d}static parse(t,r){if(t.length<5)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return r.error("Expected an even number of arguments.");let a,l;r.expectedType&&r.expectedType.kind!=="value"&&(l=r.expectedType);let h={},d=[];for(let v=2;v<t.length-1;v+=2){let x=t[v],A=t[v+1];Array.isArray(x)||(x=[x]);let D=r.concat(v);if(x.length===0)return D.error("Expected at least one branch label.");for(let z of x){if(typeof z!="number"&&typeof z!="string")return D.error("Branch labels must be numbers or strings.");if(typeof z=="number"&&Math.abs(z)>Number.MAX_SAFE_INTEGER)return D.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof z=="number"&&Math.floor(z)!==z)return D.error("Numeric branch labels must be integer values.");if(a){if(D.checkSubtype(a,vi(z)))return null}else a=vi(z);if(h[String(z)]!==void 0)return D.error("Branch labels must be unique.");h[String(z)]=d.length}let M=r.parse(A,v,l);if(!M)return null;l=l||M.type,d.push(M)}let f=r.parse(t[1],1,st);if(!f)return null;let g=r.parse(t[t.length-1],t.length-1,l);return g?f.type.kind!=="value"&&r.concat(1).checkSubtype(a,f.type)?null:new ro(a,l,f,h,d,g):null}evaluate(t){let r=this.input.evaluate(t);return(vi(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every(t=>t.outputDefined())&&this.otherwise.outputDefined()}}class Ka{constructor(t,r,a){this.type=t,this.branches=r,this.otherwise=a}static parse(t,r){if(t.length<4)return r.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return r.error("Expected an odd number of arguments.");let a;r.expectedType&&r.expectedType.kind!=="value"&&(a=r.expectedType);let l=[];for(let d=1;d<t.length-1;d+=2){let f=r.parse(t[d],d,nt);if(!f)return null;let g=r.parse(t[d+1],d+1,a);if(!g)return null;l.push([f,g]),a=a||g.type}let h=r.parse(t[t.length-1],t.length-1,a);if(!h)return null;if(!a)throw new Error("Can't infer output type");return new Ka(a,l,h)}evaluate(t){for(let[r,a]of this.branches)if(r.evaluate(t))return a.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(let[r,a]of this.branches)t(r),t(a);t(this.otherwise)}outputDefined(){return this.branches.every(([t,r])=>r.outputDefined())&&this.otherwise.outputDefined()}}class Aa{constructor(t,r,a,l){this.type=t,this.input=r,this.beginIndex=a,this.endIndex=l}static parse(t,r){if(t.length<=2||t.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);let a=r.parse(t[1],1,st),l=r.parse(t[2],2,we);if(!a||!l)return null;if(!K(a.type,[k(st),ft,st]))return r.error(`Expected first argument to be of type array or string, but found ${I(a.type)} instead`);if(t.length===4){let h=r.parse(t[3],3,we);return h?new Aa(a.type,a,l,h):null}return new Aa(a.type,a,l)}evaluate(t){let r=this.input.evaluate(t),a=this.beginIndex.evaluate(t),l;if(this.endIndex&&(l=this.endIndex.evaluate(t)),ee(r,["string"]))return[...r].slice(a,l).join("");if(ee(r,["array"]))return r.slice(a,l);throw new gi(`Expected first argument to be of type array or string, but found ${I(vi(r))} instead.`)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}}function Ya(i,t){let r=i.length-1,a,l,h=0,d=r,f=0;for(;h<=d;)if(f=Math.floor((h+d)/2),a=i[f],l=i[f+1],a<=t){if(f===r||t<l)return f;h=f+1}else{if(!(a>t))throw new gi("Input is not a number.");d=f-1}return 0}class jn{constructor(t,r,a){this.type=t,this.input=r,this.labels=[],this.outputs=[];for(let[l,h]of a)this.labels.push(l),this.outputs.push(h)}static parse(t,r){if(t.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return r.error("Expected an even number of arguments.");let a=r.parse(t[1],1,we);if(!a)return null;let l=[],h=null;r.expectedType&&r.expectedType.kind!=="value"&&(h=r.expectedType);for(let d=1;d<t.length;d+=2){let f=d===1?-1/0:t[d],g=t[d+1],v=d,x=d+1;if(typeof f!="number")return r.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',v);if(l.length&&l[l.length-1][0]>=f)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',v);let A=r.parse(g,x,h);if(!A)return null;h=h||A.type,l.push([f,A])}return new jn(h,a,l)}evaluate(t){let r=this.labels,a=this.outputs;if(r.length===1)return a[0].evaluate(t);let l=this.input.evaluate(t);if(l<=r[0])return a[0].evaluate(t);let h=r.length;return l>=r[h-1]?a[h-1].evaluate(t):a[Ya(r,l)].evaluate(t)}eachChild(t){t(this.input);for(let r of this.outputs)t(r)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function vl(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var Lu=xl;function xl(i,t,r,a){this.cx=3*i,this.bx=3*(r-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(a-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=t,this.p2x=r,this.p2y=a}xl.prototype={sampleCurveX:function(i){return((this.ax*i+this.bx)*i+this.cx)*i},sampleCurveY:function(i){return((this.ay*i+this.by)*i+this.cy)*i},sampleCurveDerivativeX:function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},solveCurveX:function(i,t){if(t===void 0&&(t=1e-6),i<0)return 0;if(i>1)return 1;for(var r=i,a=0;a<8;a++){var l=this.sampleCurveX(r)-i;if(Math.abs(l)<t)return r;var h=this.sampleCurveDerivativeX(r);if(Math.abs(h)<1e-6)break;r-=l/h}var d=0,f=1;for(r=i,a=0;a<20&&(l=this.sampleCurveX(r),!(Math.abs(l-i)<t));a++)i>l?d=r:f=r,r=.5*(f-d)+d;return r},solve:function(i,t){return this.sampleCurveY(this.solveCurveX(i,t))}};var Ru=vl(Lu);function bn(i,t,r){return i+r*(t-i)}function Ea(i,t,r){return i.map((a,l)=>bn(a,t[l],r))}let Yi={number:bn,color:function(i,t,r,a="rgb"){switch(a){case"rgb":{let[l,h,d,f]=Ea(i.rgb,t.rgb,r);return new jt(l,h,d,f,!1)}case"hcl":{let[l,h,d,f]=i.hcl,[g,v,x,A]=t.hcl,D,M;if(isNaN(l)||isNaN(g))isNaN(l)?isNaN(g)?D=NaN:(D=g,d!==1&&d!==0||(M=v)):(D=l,x!==1&&x!==0||(M=h));else{let ne=g-l;g>l&&ne>180?ne-=360:g<l&&l-g>180&&(ne+=360),D=l+r*ne}let[z,B,q,$]=function([ne,J,ie,ce]){return ne=isNaN(ne)?0:ne*et,hi([ie,Math.cos(ne)*J,Math.sin(ne)*J,ce])}([D,M??bn(h,v,r),bn(d,x,r),bn(f,A,r)]);return new jt(z,B,q,$,!1)}case"lab":{let[l,h,d,f]=hi(Ea(i.lab,t.lab,r));return new jt(l,h,d,f,!1)}}},array:Ea,padding:function(i,t,r){return new cr(Ea(i.values,t.values,r))},variableAnchorOffsetCollection:function(i,t,r){let a=i.values,l=t.values;if(a.length!==l.length)throw new gi(`Cannot interpolate values of different length. from: ${i.toString()}, to: ${t.toString()}`);let h=[];for(let d=0;d<a.length;d+=2){if(a[d]!==l[d])throw new gi(`Cannot interpolate values containing mismatched anchors. from[${d}]: ${a[d]}, to[${d}]: ${l[d]}`);h.push(a[d]);let[f,g]=a[d+1],[v,x]=l[d+1];h.push([bn(f,v,r),bn(g,x,r)])}return new vr(h)}};class Qi{constructor(t,r,a,l,h){this.type=t,this.operator=r,this.interpolation=a,this.input=l,this.labels=[],this.outputs=[];for(let[d,f]of h)this.labels.push(d),this.outputs.push(f)}static interpolationFactor(t,r,a,l){let h=0;if(t.name==="exponential")h=Qa(r,t.base,a,l);else if(t.name==="linear")h=Qa(r,1,a,l);else if(t.name==="cubic-bezier"){let d=t.controlPoints;h=new Ru(d[0],d[1],d[2],d[3]).solve(Qa(r,1,a,l))}return h}static parse(t,r){let[a,l,h,...d]=t;if(!Array.isArray(l)||l.length===0)return r.error("Expected an interpolation type expression.",1);if(l[0]==="linear")l={name:"linear"};else if(l[0]==="exponential"){let v=l[1];if(typeof v!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);l={name:"exponential",base:v}}else{if(l[0]!=="cubic-bezier")return r.error(`Unknown interpolation type ${String(l[0])}`,1,0);{let v=l.slice(1);if(v.length!==4||v.some(x=>typeof x!="number"||x<0||x>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);l={name:"cubic-bezier",controlPoints:v}}}if(t.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(h=r.parse(h,2,we),!h)return null;let f=[],g=null;a==="interpolate-hcl"||a==="interpolate-lab"?g=Si:r.expectedType&&r.expectedType.kind!=="value"&&(g=r.expectedType);for(let v=0;v<d.length;v+=2){let x=d[v],A=d[v+1],D=v+3,M=v+4;if(typeof x!="number")return r.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',D);if(f.length&&f[f.length-1][0]>=x)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',D);let z=r.parse(A,M,g);if(!z)return null;g=g||z.type,f.push([x,z])}return re(g,we)||re(g,Si)||re(g,on)||re(g,j)||re(g,k(we))?new Qi(g,a,l,h,f):r.error(`Type ${I(g)} is not interpolatable.`)}evaluate(t){let r=this.labels,a=this.outputs;if(r.length===1)return a[0].evaluate(t);let l=this.input.evaluate(t);if(l<=r[0])return a[0].evaluate(t);let h=r.length;if(l>=r[h-1])return a[h-1].evaluate(t);let d=Ya(r,l),f=Qi.interpolationFactor(this.interpolation,l,r[d],r[d+1]),g=a[d].evaluate(t),v=a[d+1].evaluate(t);switch(this.operator){case"interpolate":return Yi[this.type.kind](g,v,f);case"interpolate-hcl":return Yi.color(g,v,f,"hcl");case"interpolate-lab":return Yi.color(g,v,f,"lab")}}eachChild(t){t(this.input);for(let r of this.outputs)t(r)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function Qa(i,t,r,a){let l=a-r,h=i-r;return l===0?0:t===1?h/l:(Math.pow(t,h)-1)/(Math.pow(t,l)-1)}class es{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expectected at least one argument.");let a=null,l=r.expectedType;l&&l.kind!=="value"&&(a=l);let h=[];for(let f of t.slice(1)){let g=r.parse(f,1+h.length,a,void 0,{typeAnnotation:"omit"});if(!g)return null;a=a||g.type,h.push(g)}if(!a)throw new Error("No output type");let d=l&&h.some(f=>V(l,f.type));return new es(d?st:a,h)}evaluate(t){let r,a=null,l=0;for(let h of this.args)if(l++,a=h.evaluate(t),a&&a instanceof hr&&!a.available&&(r||(r=a.name),a=null,l===this.args.length&&(a=r)),a!==null)break;return a}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}function ts(i,t){return i==="=="||i==="!="?t.kind==="boolean"||t.kind==="string"||t.kind==="number"||t.kind==="null"||t.kind==="value":t.kind==="string"||t.kind==="number"||t.kind==="value"}function bl(i,t,r,a){return a.compare(t,r)===0}function $n(i,t,r){let a=i!=="=="&&i!=="!=";return class Yp{constructor(h,d,f){this.type=nt,this.lhs=h,this.rhs=d,this.collator=f,this.hasUntypedArgument=h.type.kind==="value"||d.type.kind==="value"}static parse(h,d){if(h.length!==3&&h.length!==4)return d.error("Expected two or three arguments.");let f=h[0],g=d.parse(h[1],1,st);if(!g)return null;if(!ts(f,g.type))return d.concat(1).error(`"${f}" comparisons are not supported for type '${I(g.type)}'.`);let v=d.parse(h[2],2,st);if(!v)return null;if(!ts(f,v.type))return d.concat(2).error(`"${f}" comparisons are not supported for type '${I(v.type)}'.`);if(g.type.kind!==v.type.kind&&g.type.kind!=="value"&&v.type.kind!=="value")return d.error(`Cannot compare types '${I(g.type)}' and '${I(v.type)}'.`);a&&(g.type.kind==="value"&&v.type.kind!=="value"?g=new Br(v.type,[g]):g.type.kind!=="value"&&v.type.kind==="value"&&(v=new Br(g.type,[v])));let x=null;if(h.length===4){if(g.type.kind!=="string"&&v.type.kind!=="string"&&g.type.kind!=="value"&&v.type.kind!=="value")return d.error("Cannot use collator to compare non-string types.");if(x=d.parse(h[3],3,Ki),!x)return null}return new Yp(g,v,x)}evaluate(h){let d=this.lhs.evaluate(h),f=this.rhs.evaluate(h);if(a&&this.hasUntypedArgument){let g=vi(d),v=vi(f);if(g.kind!==v.kind||g.kind!=="string"&&g.kind!=="number")throw new gi(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${g.kind}, ${v.kind}) instead.`)}if(this.collator&&!a&&this.hasUntypedArgument){let g=vi(d),v=vi(f);if(g.kind!=="string"||v.kind!=="string")return t(h,d,f)}return this.collator?r(h,d,f,this.collator.evaluate(h)):t(h,d,f)}eachChild(h){h(this.lhs),h(this.rhs),this.collator&&h(this.collator)}outputDefined(){return!0}}}let Fu=$n("==",function(i,t,r){return t===r},bl),wl=$n("!=",function(i,t,r){return t!==r},function(i,t,r,a){return!bl(0,t,r,a)}),Al=$n("<",function(i,t,r){return t<r},function(i,t,r,a){return a.compare(t,r)<0}),Ou=$n(">",function(i,t,r){return t>r},function(i,t,r,a){return a.compare(t,r)>0}),Nu=$n("<=",function(i,t,r){return t<=r},function(i,t,r,a){return a.compare(t,r)<=0}),El=$n(">=",function(i,t,r){return t>=r},function(i,t,r,a){return a.compare(t,r)>=0});class Ta{constructor(t,r,a){this.type=Ki,this.locale=a,this.caseSensitive=t,this.diacriticSensitive=r}static parse(t,r){if(t.length!==2)return r.error("Expected one argument.");let a=t[1];if(typeof a!="object"||Array.isArray(a))return r.error("Collator options argument must be an object.");let l=r.parse(a["case-sensitive"]!==void 0&&a["case-sensitive"],1,nt);if(!l)return null;let h=r.parse(a["diacritic-sensitive"]!==void 0&&a["diacritic-sensitive"],1,nt);if(!h)return null;let d=null;return a.locale&&(d=r.parse(a.locale,1,ft),!d)?null:new Ta(l,h,d)}evaluate(t){return new Ys(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 no{constructor(t,r,a,l,h){this.type=ft,this.number=t,this.locale=r,this.currency=a,this.minFractionDigits=l,this.maxFractionDigits=h}static parse(t,r){if(t.length!==3)return r.error("Expected two arguments.");let a=r.parse(t[1],1,we);if(!a)return null;let l=t[2];if(typeof l!="object"||Array.isArray(l))return r.error("NumberFormat options argument must be an object.");let h=null;if(l.locale&&(h=r.parse(l.locale,1,ft),!h))return null;let d=null;if(l.currency&&(d=r.parse(l.currency,1,ft),!d))return null;let f=null;if(l["min-fraction-digits"]&&(f=r.parse(l["min-fraction-digits"],1,we),!f))return null;let g=null;return l["max-fraction-digits"]&&(g=r.parse(l["max-fraction-digits"],1,we),!g)?null:new no(a,h,d,f,g)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}}class is{constructor(t){this.type=yr,this.sections=t}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let a=t[1];if(!Array.isArray(a)&&typeof a=="object")return r.error("First argument must be an image or text section.");let l=[],h=!1;for(let d=1;d<=t.length-1;++d){let f=t[d];if(h&&typeof f=="object"&&!Array.isArray(f)){h=!1;let g=null;if(f["font-scale"]&&(g=r.parse(f["font-scale"],1,we),!g))return null;let v=null;if(f["text-font"]&&(v=r.parse(f["text-font"],1,k(ft)),!v))return null;let x=null;if(f["text-color"]&&(x=r.parse(f["text-color"],1,Si),!x))return null;let A=l[l.length-1];A.scale=g,A.font=v,A.textColor=x}else{let g=r.parse(t[d],1,st);if(!g)return null;let v=g.type.kind;if(v!=="string"&&v!=="value"&&v!=="null"&&v!=="resolvedImage")return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");h=!0,l.push({content:g,scale:null,font:null,textColor:null})}}return new is(l)}evaluate(t){return new ur(this.sections.map(r=>{let a=r.content.evaluate(t);return vi(a)===Zr?new Qs("",a,null,null,null):new Qs(wa(a),null,r.scale?r.scale.evaluate(t):null,r.font?r.font.evaluate(t).join(","):null,r.textColor?r.textColor.evaluate(t):null)}))}eachChild(t){for(let r of this.sections)t(r.content),r.scale&&t(r.scale),r.font&&t(r.font),r.textColor&&t(r.textColor)}outputDefined(){return!1}}class ao{constructor(t){this.type=Zr,this.input=t}static parse(t,r){if(t.length!==2)return r.error("Expected two arguments.");let a=r.parse(t[1],1,ft);return a?new ao(a):r.error("No image name provided.")}evaluate(t){let r=this.input.evaluate(t),a=hr.fromString(r);return a&&t.availableImages&&(a.available=t.availableImages.indexOf(r)>-1),a}eachChild(t){t(this.input)}outputDefined(){return!1}}class so{constructor(t){this.type=we,this.input=t}static parse(t,r){if(t.length!==2)return r.error(`Expected 1 argument, but found ${t.length-1} instead.`);let a=r.parse(t[1],1);return a?a.type.kind!=="array"&&a.type.kind!=="string"&&a.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${I(a.type)} instead.`):new so(a):null}evaluate(t){let r=this.input.evaluate(t);if(typeof r=="string")return[...r].length;if(Array.isArray(r))return r.length;throw new gi(`Expected value to be of type string or array, but found ${I(vi(r))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}}let Gr=8192;function qu(i,t){let r=(180+i[0])/360,a=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i[1]*Math.PI/360)))/360,l=Math.pow(2,t.z);return[Math.round(r*l*Gr),Math.round(a*l*Gr)]}function oo(i,t){let r=Math.pow(2,t.z);return[(l=(i[0]/Gr+t.x)/r,360*l-180),(a=(i[1]/Gr+t.y)/r,360/Math.PI*Math.atan(Math.exp((180-360*a)*Math.PI/180))-90)];var a,l}function wn(i,t){i[0]=Math.min(i[0],t[0]),i[1]=Math.min(i[1],t[1]),i[2]=Math.max(i[2],t[0]),i[3]=Math.max(i[3],t[1])}function un(i,t){return!(i[0]<=t[0]||i[2]>=t[2]||i[1]<=t[1]||i[3]>=t[3])}function qt(i,t,r){let a=i[0]-t[0],l=i[1]-t[1],h=i[0]-r[0],d=i[1]-r[1];return a*d-h*l==0&&a*h<=0&&l*d<=0}function rs(i,t,r,a){return(l=[a[0]-r[0],a[1]-r[1]])[0]*(h=[t[0]-i[0],t[1]-i[1]])[1]-l[1]*h[0]!=0&&!(!Cl(i,t,r,a)||!Cl(r,a,i,t));var l,h}function Vu(i,t,r){for(let a of r)for(let l=0;l<a.length-1;++l)if(rs(i,t,a[l],a[l+1]))return!0;return!1}function Zn(i,t,r=!1){let a=!1;for(let f of t)for(let g=0;g<f.length-1;g++){if(qt(i,f[g],f[g+1]))return r;(h=f[g])[1]>(l=i)[1]!=(d=f[g+1])[1]>l[1]&&l[0]<(d[0]-h[0])*(l[1]-h[1])/(d[1]-h[1])+h[0]&&(a=!a)}var l,h,d;return a}function Uu(i,t){for(let r of t)if(Zn(i,r))return!0;return!1}function Tl(i,t){for(let r of i)if(!Zn(r,t))return!1;for(let r=0;r<i.length-1;++r)if(Vu(i[r],i[r+1],t))return!1;return!0}function ju(i,t){for(let r of t)if(Tl(i,r))return!0;return!1}function Cl(i,t,r,a){let l=a[0]-r[0],h=a[1]-r[1],d=(i[0]-r[0])*h-l*(i[1]-r[1]),f=(t[0]-r[0])*h-l*(t[1]-r[1]);return d>0&&f<0||d<0&&f>0}function lo(i,t,r){let a=[];for(let l=0;l<i.length;l++){let h=[];for(let d=0;d<i[l].length;d++){let f=qu(i[l][d],r);wn(t,f),h.push(f)}a.push(h)}return a}function Dl(i,t,r){let a=[];for(let l=0;l<i.length;l++){let h=lo(i[l],t,r);a.push(h)}return a}function Sl(i,t,r,a){if(i[0]<r[0]||i[0]>r[2]){let l=.5*a,h=i[0]-r[0]>l?-a:r[0]-i[0]>l?a:0;h===0&&(h=i[0]-r[2]>l?-a:r[2]-i[0]>l?a:0),i[0]+=h}wn(t,i)}function Il(i,t,r,a){let l=Math.pow(2,a.z)*Gr,h=[a.x*Gr,a.y*Gr],d=[];for(let f of i)for(let g of f){let v=[g.x+h[0],g.y+h[1]];Sl(v,t,r,l),d.push(v)}return d}function kl(i,t,r,a){let l=Math.pow(2,a.z)*Gr,h=[a.x*Gr,a.y*Gr],d=[];for(let g of i){let v=[];for(let x of g){let A=[x.x+h[0],x.y+h[1]];wn(t,A),v.push(A)}d.push(v)}if(t[2]-t[0]<=l/2){(f=t)[0]=f[1]=1/0,f[2]=f[3]=-1/0;for(let g of d)for(let v of g)Sl(v,t,r,l)}var f;return d}class An{constructor(t,r){this.type=nt,this.geojson=t,this.geometries=r}static parse(t,r){if(t.length!==2)return r.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(vn(t[1])){let a=t[1];if(a.type==="FeatureCollection"){let l=[];for(let h of a.features){let{type:d,coordinates:f}=h.geometry;d==="Polygon"&&l.push(f),d==="MultiPolygon"&&l.push(...f)}if(l.length)return new An(a,{type:"MultiPolygon",coordinates:l})}else if(a.type==="Feature"){let l=a.geometry.type;if(l==="Polygon"||l==="MultiPolygon")return new An(a,a.geometry)}else if(a.type==="Polygon"||a.type==="MultiPolygon")return new An(a,a)}return r.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return function(r,a){let l=[1/0,1/0,-1/0,-1/0],h=[1/0,1/0,-1/0,-1/0],d=r.canonicalID();if(a.type==="Polygon"){let f=lo(a.coordinates,h,d),g=Il(r.geometry(),l,h,d);if(!un(l,h))return!1;for(let v of g)if(!Zn(v,f))return!1}if(a.type==="MultiPolygon"){let f=Dl(a.coordinates,h,d),g=Il(r.geometry(),l,h,d);if(!un(l,h))return!1;for(let v of g)if(!Uu(v,f))return!1}return!0}(t,this.geometries);if(t.geometryType()==="LineString")return function(r,a){let l=[1/0,1/0,-1/0,-1/0],h=[1/0,1/0,-1/0,-1/0],d=r.canonicalID();if(a.type==="Polygon"){let f=lo(a.coordinates,h,d),g=kl(r.geometry(),l,h,d);if(!un(l,h))return!1;for(let v of g)if(!Tl(v,f))return!1}if(a.type==="MultiPolygon"){let f=Dl(a.coordinates,h,d),g=kl(r.geometry(),l,h,d);if(!un(l,h))return!1;for(let v of g)if(!ju(v,f))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let Ml=class{constructor(i=[],t=(r,a)=>r<a?-1:r>a?1:0){if(this.data=i,this.length=this.data.length,this.compare=t,this.length>0)for(let r=(this.length>>1)-1;r>=0;r--)this._down(r)}push(i){this.data.push(i),this._up(this.length++)}pop(){if(this.length===0)return;let i=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),i}peek(){return this.data[0]}_up(i){let{data:t,compare:r}=this,a=t[i];for(;i>0;){let l=i-1>>1,h=t[l];if(r(a,h)>=0)break;t[i]=h,i=l}t[i]=a}_down(i){let{data:t,compare:r}=this,a=this.length>>1,l=t[i];for(;i<a;){let h=1+(i<<1),d=h+1;if(d<this.length&&r(t[d],t[h])<0&&(h=d),r(t[h],l)>=0)break;t[i]=t[h],i=h}t[i]=l}};function $u(i,t,r,a,l){Pl(i,t,r,a||i.length-1,l||Zu)}function Pl(i,t,r,a,l){for(;a>r;){if(a-r>600){var h=a-r+1,d=t-r+1,f=Math.log(h),g=.5*Math.exp(2*f/3),v=.5*Math.sqrt(f*g*(h-g)/h)*(d-h/2<0?-1:1);Pl(i,t,Math.max(r,Math.floor(t-d*g/h+v)),Math.min(a,Math.floor(t+(h-d)*g/h+v)),l)}var x=i[t],A=r,D=a;for(Ca(i,r,t),l(i[a],x)>0&&Ca(i,r,a);A<D;){for(Ca(i,A,D),A++,D--;l(i[A],x)<0;)A++;for(;l(i[D],x)>0;)D--}l(i[r],x)===0?Ca(i,r,D):Ca(i,++D,a),D<=t&&(r=D+1),t<=D&&(a=D-1)}}function Ca(i,t,r){var a=i[t];i[t]=i[r],i[r]=a}function Zu(i,t){return i<t?-1:i>t?1:0}function ns(i,t){if(i.length<=1)return[i];let r=[],a,l;for(let h of i){let d=Hu(h);d!==0&&(h.area=Math.abs(d),l===void 0&&(l=d<0),l===d<0?(a&&r.push(a),a=[h]):a.push(h))}if(a&&r.push(a),t>1)for(let h=0;h<r.length;h++)r[h].length<=t||($u(r[h],t,1,r[h].length-1,Gu),r[h]=r[h].slice(0,t));return r}function Gu(i,t){return t.area-i.area}function Hu(i){let t=0;for(let r,a,l=0,h=i.length,d=h-1;l<h;d=l++)r=i[l],a=i[d],t+=(a.x-r.x)*(r.y+a.y);return t}let zl=1/298.257223563,Bl=zl*(2-zl),Ll=Math.PI/180;class uo{constructor(t){let r=6378.137*Ll*1e3,a=Math.cos(t*Ll),l=1/(1-Bl*(1-a*a)),h=Math.sqrt(l);this.kx=r*h*a,this.ky=r*h*l*(1-Bl)}distance(t,r){let a=this.wrap(t[0]-r[0])*this.kx,l=(t[1]-r[1])*this.ky;return Math.sqrt(a*a+l*l)}pointOnLine(t,r){let a,l,h,d,f=1/0;for(let g=0;g<t.length-1;g++){let v=t[g][0],x=t[g][1],A=this.wrap(t[g+1][0]-v)*this.kx,D=(t[g+1][1]-x)*this.ky,M=0;A===0&&D===0||(M=(this.wrap(r[0]-v)*this.kx*A+(r[1]-x)*this.ky*D)/(A*A+D*D),M>1?(v=t[g+1][0],x=t[g+1][1]):M>0&&(v+=A/this.kx*M,x+=D/this.ky*M)),A=this.wrap(r[0]-v)*this.kx,D=(r[1]-x)*this.ky;let z=A*A+D*D;z<f&&(f=z,a=v,l=x,h=g,d=M)}return{point:[a,l],index:h,t:Math.max(0,Math.min(1,d))}}wrap(t){for(;t<-180;)t+=360;for(;t>180;)t-=360;return t}}function Rl(i,t){return t[0]-i[0]}function as(i){return i[1]-i[0]+1}function en(i,t){return i[1]>=i[0]&&i[1]<t}function co(i,t){if(i[0]>i[1])return[null,null];let r=as(i);if(t){if(r===2)return[i,null];let l=Math.floor(r/2);return[[i[0],i[0]+l],[i[0]+l,i[1]]]}if(r===1)return[i,null];let a=Math.floor(r/2)-1;return[[i[0],i[0]+a],[i[0]+a+1,i[1]]]}function ho(i,t){if(!en(t,i.length))return[1/0,1/0,-1/0,-1/0];let r=[1/0,1/0,-1/0,-1/0];for(let a=t[0];a<=t[1];++a)wn(r,i[a]);return r}function po(i){let t=[1/0,1/0,-1/0,-1/0];for(let r of i)for(let a of r)wn(t,a);return t}function ss(i){return i[0]!==-1/0&&i[1]!==-1/0&&i[2]!==1/0&&i[3]!==1/0}function fo(i,t,r){if(!ss(i)||!ss(t))return NaN;let a=0,l=0;return i[2]<t[0]&&(a=t[0]-i[2]),i[0]>t[2]&&(a=i[0]-t[2]),i[1]>t[3]&&(l=i[1]-t[3]),i[3]<t[1]&&(l=t[1]-i[3]),r.distance([0,0],[a,l])}function En(i,t,r){let a=r.pointOnLine(t,i);return r.distance(i,a.point)}function mo(i,t,r,a,l){let h=Math.min(En(i,[r,a],l),En(t,[r,a],l)),d=Math.min(En(r,[i,t],l),En(a,[i,t],l));return Math.min(h,d)}function Xu(i,t,r,a,l){if(!en(t,i.length)||!en(a,r.length))return 1/0;let h=1/0;for(let d=t[0];d<t[1];++d){let f=i[d],g=i[d+1];for(let v=a[0];v<a[1];++v){let x=r[v],A=r[v+1];if(rs(f,g,x,A))return 0;h=Math.min(h,mo(f,g,x,A,l))}}return h}function di(i,t,r,a,l){if(!en(t,i.length)||!en(a,r.length))return NaN;let h=1/0;for(let d=t[0];d<=t[1];++d)for(let f=a[0];f<=a[1];++f)if(h=Math.min(h,l.distance(i[d],r[f])),h===0)return h;return h}function Wu(i,t,r){if(Zn(i,t,!0))return 0;let a=1/0;for(let l of t){let h=l[0],d=l[l.length-1];if(h!==d&&(a=Math.min(a,En(i,[d,h],r)),a===0))return a;let f=r.pointOnLine(l,i);if(a=Math.min(a,r.distance(i,f.point)),a===0)return a}return a}function At(i,t,r,a){if(!en(t,i.length))return NaN;for(let h=t[0];h<=t[1];++h)if(Zn(i[h],r,!0))return 0;let l=1/0;for(let h=t[0];h<t[1];++h){let d=i[h],f=i[h+1];for(let g of r)for(let v=0,x=g.length,A=x-1;v<x;A=v++){let D=g[A],M=g[v];if(rs(d,f,D,M))return 0;l=Math.min(l,mo(d,f,D,M,a))}}return l}function os(i,t){for(let r of i)for(let a of r)if(Zn(a,t,!0))return!0;return!1}function Yt(i,t,r,a=1/0){let l=po(i),h=po(t);if(a!==1/0&&fo(l,h,r)>=a)return a;if(un(l,h)){if(os(i,t))return 0}else if(os(t,i))return 0;let d=1/0;for(let f of i)for(let g=0,v=f.length,x=v-1;g<v;x=g++){let A=f[x],D=f[g];for(let M of t)for(let z=0,B=M.length,q=B-1;z<B;q=z++){let $=M[q],ne=M[z];if(rs(A,D,$,ne))return 0;d=Math.min(d,mo(A,D,$,ne,r))}}return d}function Gt(i,t,r,a,l,h){if(!h)return;let d=fo(ho(a,h),l,r);d<t&&i.push([d,h,[0,0]])}function Tn(i,t,r,a,l,h,d){if(!h||!d)return;let f=fo(ho(a,h),ho(l,d),r);f<t&&i.push([f,h,d])}function Da(i,t,r,a,l=1/0){let h=Math.min(a.distance(i[0],r[0][0]),l);if(h===0)return h;let d=new Ml([[0,[0,i.length-1],[0,0]]],Rl),f=po(r);for(;d.length>0;){let g=d.pop();if(g[0]>=h)continue;let v=g[1],x=t?50:100;if(as(v)<=x){if(!en(v,i.length))return NaN;if(t){let A=At(i,v,r,a);if(isNaN(A)||A===0)return A;h=Math.min(h,A)}else for(let A=v[0];A<=v[1];++A){let D=Wu(i[A],r,a);if(h=Math.min(h,D),h===0)return 0}}else{let A=co(v,t);Gt(d,h,a,i,f,A[0]),Gt(d,h,a,i,f,A[1])}}return h}function Sa(i,t,r,a,l,h=1/0){let d=Math.min(h,l.distance(i[0],r[0]));if(d===0)return d;let f=new Ml([[0,[0,i.length-1],[0,r.length-1]]],Rl);for(;f.length>0;){let g=f.pop();if(g[0]>=d)continue;let v=g[1],x=g[2],A=t?50:100,D=a?50:100;if(as(v)<=A&&as(x)<=D){if(!en(v,i.length)&&en(x,r.length))return NaN;let M;if(t&&a)M=Xu(i,v,r,x,l),d=Math.min(d,M);else if(t&&!a){let z=i.slice(v[0],v[1]+1);for(let B=x[0];B<=x[1];++B)if(M=En(r[B],z,l),d=Math.min(d,M),d===0)return d}else if(!t&&a){let z=r.slice(x[0],x[1]+1);for(let B=v[0];B<=v[1];++B)if(M=En(i[B],z,l),d=Math.min(d,M),d===0)return d}else M=di(i,v,r,x,l),d=Math.min(d,M)}else{let M=co(v,t),z=co(x,a);Tn(f,d,l,i,r,M[0],z[0]),Tn(f,d,l,i,r,M[0],z[1]),Tn(f,d,l,i,r,M[1],z[0]),Tn(f,d,l,i,r,M[1],z[1])}}return d}function go(i){return i.type==="MultiPolygon"?i.coordinates.map(t=>({type:"Polygon",coordinates:t})):i.type==="MultiLineString"?i.coordinates.map(t=>({type:"LineString",coordinates:t})):i.type==="MultiPoint"?i.coordinates.map(t=>({type:"Point",coordinates:t})):[i]}class Cn{constructor(t,r){this.type=we,this.geojson=t,this.geometries=r}static parse(t,r){if(t.length!==2)return r.error(`'distance' expression requires exactly one argument, but found ${t.length-1} instead.`);if(vn(t[1])){let a=t[1];if(a.type==="FeatureCollection")return new Cn(a,a.features.map(l=>go(l.geometry)).flat());if(a.type==="Feature")return new Cn(a,go(a.geometry));if("type"in a&&"coordinates"in a)return new Cn(a,go(a))}return r.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return function(r,a){let l=r.geometry(),h=l.flat().map(g=>oo([g.x,g.y],r.canonical));if(l.length===0)return NaN;let d=new uo(h[0][1]),f=1/0;for(let g of a){switch(g.type){case"Point":f=Math.min(f,Sa(h,!1,[g.coordinates],!1,d,f));break;case"LineString":f=Math.min(f,Sa(h,!1,g.coordinates,!0,d,f));break;case"Polygon":f=Math.min(f,Da(h,!1,g.coordinates,d,f))}if(f===0)return f}return f}(t,this.geometries);if(t.geometryType()==="LineString")return function(r,a){let l=r.geometry(),h=l.flat().map(g=>oo([g.x,g.y],r.canonical));if(l.length===0)return NaN;let d=new uo(h[0][1]),f=1/0;for(let g of a){switch(g.type){case"Point":f=Math.min(f,Sa(h,!0,[g.coordinates],!1,d,f));break;case"LineString":f=Math.min(f,Sa(h,!0,g.coordinates,!0,d,f));break;case"Polygon":f=Math.min(f,Da(h,!0,g.coordinates,d,f))}if(f===0)return f}return f}(t,this.geometries);if(t.geometryType()==="Polygon")return function(r,a){let l=r.geometry();if(l.length===0||l[0].length===0)return NaN;let h=ns(l,0).map(g=>g.map(v=>v.map(x=>oo([x.x,x.y],r.canonical)))),d=new uo(h[0][0][0][1]),f=1/0;for(let g of a)for(let v of h){switch(g.type){case"Point":f=Math.min(f,Da([g.coordinates],!1,v,d,f));break;case"LineString":f=Math.min(f,Da(g.coordinates,!0,v,d,f));break;case"Polygon":f=Math.min(f,Yt(v,g.coordinates,d,f))}if(f===0)return f}return f}(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}let Gn={"==":Fu,"!=":wl,">":Ou,"<":Al,">=":El,"<=":Nu,array:Br,at:to,boolean:Br,case:Ka,coalesce:es,collator:Ta,format:is,image:ao,in:io,"index-of":Un,interpolate:Qi,"interpolate-hcl":Qi,"interpolate-lab":Qi,length:so,let:ln,literal:zr,match:ro,number:Br,"number-format":no,object:Br,slice:Aa,step:jn,string:Br,"to-boolean":Lr,"to-color":Lr,"to-number":Lr,"to-string":Lr,var:Ot,within:An,distance:Cn};class xr{constructor(t,r,a,l){this.name=t,this.type=r,this._evaluate=a,this.args=l}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(t,r){let a=t[0],l=xr.definitions[a];if(!l)return r.error(`Unknown expression "${a}". If you wanted a literal array, use ["literal", [...]].`,0);let h=Array.isArray(l)?l[0]:l.type,d=Array.isArray(l)?[[l[1],l[2]]]:l.overloads,f=d.filter(([v])=>!Array.isArray(v)||v.length===t.length-1),g=null;for(let[v,x]of f){g=new xn(r.registry,Ia,r.path,null,r.scope);let A=[],D=!1;for(let M=1;M<t.length;M++){let z=t[M],B=Array.isArray(v)?v[M-1]:v.type,q=g.parse(z,1+A.length,B);if(!q){D=!0;break}A.push(q)}if(!D)if(Array.isArray(v)&&v.length!==A.length)g.error(`Expected ${v.length} arguments, but found ${A.length} instead.`);else{for(let M=0;M<A.length;M++){let z=Array.isArray(v)?v[M]:v.type,B=A[M];g.concat(M+1).checkSubtype(z,B.type)}if(g.errors.length===0)return new xr(a,h,x,A)}}if(f.length===1)r.errors.push(...g.errors);else{let v=(f.length?f:d).map(([A])=>{return D=A,Array.isArray(D)?`(${D.map(I).join(", ")})`:`(${I(D.type)}...)`;var D}).join(" | "),x=[];for(let A=1;A<t.length;A++){let D=r.parse(t[A],1+x.length);if(!D)return null;x.push(I(D.type))}r.error(`Expected arguments of type ${v}, but found (${x.join(", ")}) instead.`)}return null}static register(t,r){xr.definitions=r;for(let a in r)t[a]=xr}}function _o(i,[t,r,a,l]){t=t.evaluate(i),r=r.evaluate(i),a=a.evaluate(i);let h=l?l.evaluate(i):1,d=Vn(t,r,a,h);if(d)throw new gi(d);return new jt(t/255,r/255,a/255,h,!1)}function yo(i,t){return i in t}function vo(i,t){let r=t[i];return r===void 0?null:r}function Dn(i){return{type:i}}function Ia(i){if(i instanceof Ot)return Ia(i.boundExpression);if(i instanceof xr&&i.name==="error"||i instanceof Ta||i instanceof An||i instanceof Cn)return!1;let t=i instanceof Lr||i instanceof Br,r=!0;return i.eachChild(a=>{r=t?r&&Ia(a):r&&a instanceof zr}),!!r&&ka(i)&&Ma(i,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function ka(i){if(i instanceof xr&&(i.name==="get"&&i.args.length===1||i.name==="feature-state"||i.name==="has"&&i.args.length===1||i.name==="properties"||i.name==="geometry-type"||i.name==="id"||/^filter-/.test(i.name))||i instanceof An||i instanceof Cn)return!1;let t=!0;return i.eachChild(r=>{t&&!ka(r)&&(t=!1)}),t}function Hn(i){if(i instanceof xr&&i.name==="feature-state")return!1;let t=!0;return i.eachChild(r=>{t&&!Hn(r)&&(t=!1)}),t}function Ma(i,t){if(i instanceof xr&&t.indexOf(i.name)>=0)return!1;let r=!0;return i.eachChild(a=>{r&&!Ma(a,t)&&(r=!1)}),r}function ls(i){return{result:"success",value:i}}function Xn(i){return{result:"error",value:i}}function Wn(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function Fl(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function xo(i){return!!i.expression&&i.expression.interpolated}function Rt(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":i===null?"null":typeof i}function us(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function Ju(i){return i}function Ol(i,t){let r=t.type==="color",a=i.stops&&typeof i.stops[0][0]=="object",l=a||!(a||i.property!==void 0),h=i.type||(xo(t)?"exponential":"interval");if(r||t.type==="padding"){let x=r?jt.parse:cr.parse;(i=or({},i)).stops&&(i.stops=i.stops.map(A=>[A[0],x(A[1])])),i.default=x(i.default?i.default:t.default)}if(i.colorSpace&&(d=i.colorSpace)!=="rgb"&&d!=="hcl"&&d!=="lab")throw new Error(`Unknown color space: "${i.colorSpace}"`);var d;let f,g,v;if(h==="exponential")f=ql;else if(h==="interval")f=cs;else if(h==="categorical"){f=Nl,g=Object.create(null);for(let x of i.stops)g[x[0]]=x[1];v=typeof i.stops[0][0]}else{if(h!=="identity")throw new Error(`Unknown function type "${h}"`);f=Vl}if(a){let x={},A=[];for(let z=0;z<i.stops.length;z++){let B=i.stops[z],q=B[0].zoom;x[q]===void 0&&(x[q]={zoom:q,type:i.type,property:i.property,default:i.default,stops:[]},A.push(q)),x[q].stops.push([B[0].value,B[1]])}let D=[];for(let z of A)D.push([x[z].zoom,Ol(x[z],t)]);let M={name:"linear"};return{kind:"composite",interpolationType:M,interpolationFactor:Qi.interpolationFactor.bind(void 0,M),zoomStops:D.map(z=>z[0]),evaluate:({zoom:z},B)=>ql({stops:D,base:i.base},t,z).evaluate(z,B)}}if(l){let x=h==="exponential"?{name:"exponential",base:i.base!==void 0?i.base:1}:null;return{kind:"camera",interpolationType:x,interpolationFactor:Qi.interpolationFactor.bind(void 0,x),zoomStops:i.stops.map(A=>A[0]),evaluate:({zoom:A})=>f(i,t,A,g,v)}}return{kind:"source",evaluate(x,A){let D=A&&A.properties?A.properties[i.property]:void 0;return D===void 0?Jn(i.default,t.default):f(i,t,D,g,v)}}}function Jn(i,t,r){return i!==void 0?i:t!==void 0?t:r!==void 0?r:void 0}function Nl(i,t,r,a,l){return Jn(typeof r===l?a[r]:void 0,i.default,t.default)}function cs(i,t,r){if(Rt(r)!=="number")return Jn(i.default,t.default);let a=i.stops.length;if(a===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[a-1][0])return i.stops[a-1][1];let l=Ya(i.stops.map(h=>h[0]),r);return i.stops[l][1]}function ql(i,t,r){let a=i.base!==void 0?i.base:1;if(Rt(r)!=="number")return Jn(i.default,t.default);let l=i.stops.length;if(l===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[l-1][0])return i.stops[l-1][1];let h=Ya(i.stops.map(x=>x[0]),r),d=function(x,A,D,M){let z=M-D,B=x-D;return z===0?0:A===1?B/z:(Math.pow(A,B)-1)/(Math.pow(A,z)-1)}(r,a,i.stops[h][0],i.stops[h+1][0]),f=i.stops[h][1],g=i.stops[h+1][1],v=Yi[t.type]||Ju;return typeof f.evaluate=="function"?{evaluate(...x){let A=f.evaluate.apply(void 0,x),D=g.evaluate.apply(void 0,x);if(A!==void 0&&D!==void 0)return v(A,D,d,i.colorSpace)}}:v(f,g,d,i.colorSpace)}function Vl(i,t,r){switch(t.type){case"color":r=jt.parse(r);break;case"formatted":r=ur.fromString(r.toString());break;case"resolvedImage":r=hr.fromString(r.toString());break;case"padding":r=cr.parse(r);break;default:Rt(r)===t.type||t.type==="enum"&&t.values[r]||(r=void 0)}return Jn(r,i.default,t.default)}xr.register(Gn,{error:[{kind:"error"},[ft],(i,[t])=>{throw new gi(t.evaluate(i))}],typeof:[ft,[st],(i,[t])=>I(vi(t.evaluate(i)))],"to-rgba":[k(we,4),[Si],(i,[t])=>{let[r,a,l,h]=t.evaluate(i).rgb;return[255*r,255*a,255*l,h]}],rgb:[Si,[we,we,we],_o],rgba:[Si,[we,we,we,we],_o],has:{type:nt,overloads:[[[ft],(i,[t])=>yo(t.evaluate(i),i.properties())],[[ft,Ji],(i,[t,r])=>yo(t.evaluate(i),r.evaluate(i))]]},get:{type:st,overloads:[[[ft],(i,[t])=>vo(t.evaluate(i),i.properties())],[[ft,Ji],(i,[t,r])=>vo(t.evaluate(i),r.evaluate(i))]]},"feature-state":[st,[ft],(i,[t])=>vo(t.evaluate(i),i.featureState||{})],properties:[Ji,[],i=>i.properties()],"geometry-type":[ft,[],i=>i.geometryType()],id:[st,[],i=>i.id()],zoom:[we,[],i=>i.globals.zoom],"heatmap-density":[we,[],i=>i.globals.heatmapDensity||0],"line-progress":[we,[],i=>i.globals.lineProgress||0],accumulated:[st,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[we,Dn(we),(i,t)=>{let r=0;for(let a of t)r+=a.evaluate(i);return r}],"*":[we,Dn(we),(i,t)=>{let r=1;for(let a of t)r*=a.evaluate(i);return r}],"-":{type:we,overloads:[[[we,we],(i,[t,r])=>t.evaluate(i)-r.evaluate(i)],[[we],(i,[t])=>-t.evaluate(i)]]},"/":[we,[we,we],(i,[t,r])=>t.evaluate(i)/r.evaluate(i)],"%":[we,[we,we],(i,[t,r])=>t.evaluate(i)%r.evaluate(i)],ln2:[we,[],()=>Math.LN2],pi:[we,[],()=>Math.PI],e:[we,[],()=>Math.E],"^":[we,[we,we],(i,[t,r])=>Math.pow(t.evaluate(i),r.evaluate(i))],sqrt:[we,[we],(i,[t])=>Math.sqrt(t.evaluate(i))],log10:[we,[we],(i,[t])=>Math.log(t.evaluate(i))/Math.LN10],ln:[we,[we],(i,[t])=>Math.log(t.evaluate(i))],log2:[we,[we],(i,[t])=>Math.log(t.evaluate(i))/Math.LN2],sin:[we,[we],(i,[t])=>Math.sin(t.evaluate(i))],cos:[we,[we],(i,[t])=>Math.cos(t.evaluate(i))],tan:[we,[we],(i,[t])=>Math.tan(t.evaluate(i))],asin:[we,[we],(i,[t])=>Math.asin(t.evaluate(i))],acos:[we,[we],(i,[t])=>Math.acos(t.evaluate(i))],atan:[we,[we],(i,[t])=>Math.atan(t.evaluate(i))],min:[we,Dn(we),(i,t)=>Math.min(...t.map(r=>r.evaluate(i)))],max:[we,Dn(we),(i,t)=>Math.max(...t.map(r=>r.evaluate(i)))],abs:[we,[we],(i,[t])=>Math.abs(t.evaluate(i))],round:[we,[we],(i,[t])=>{let r=t.evaluate(i);return r<0?-Math.round(-r):Math.round(r)}],floor:[we,[we],(i,[t])=>Math.floor(t.evaluate(i))],ceil:[we,[we],(i,[t])=>Math.ceil(t.evaluate(i))],"filter-==":[nt,[ft,st],(i,[t,r])=>i.properties()[t.value]===r.value],"filter-id-==":[nt,[st],(i,[t])=>i.id()===t.value],"filter-type-==":[nt,[ft],(i,[t])=>i.geometryType()===t.value],"filter-<":[nt,[ft,st],(i,[t,r])=>{let a=i.properties()[t.value],l=r.value;return typeof a==typeof l&&a<l}],"filter-id-<":[nt,[st],(i,[t])=>{let r=i.id(),a=t.value;return typeof r==typeof a&&r<a}],"filter->":[nt,[ft,st],(i,[t,r])=>{let a=i.properties()[t.value],l=r.value;return typeof a==typeof l&&a>l}],"filter-id->":[nt,[st],(i,[t])=>{let r=i.id(),a=t.value;return typeof r==typeof a&&r>a}],"filter-<=":[nt,[ft,st],(i,[t,r])=>{let a=i.properties()[t.value],l=r.value;return typeof a==typeof l&&a<=l}],"filter-id-<=":[nt,[st],(i,[t])=>{let r=i.id(),a=t.value;return typeof r==typeof a&&r<=a}],"filter->=":[nt,[ft,st],(i,[t,r])=>{let a=i.properties()[t.value],l=r.value;return typeof a==typeof l&&a>=l}],"filter-id->=":[nt,[st],(i,[t])=>{let r=i.id(),a=t.value;return typeof r==typeof a&&r>=a}],"filter-has":[nt,[st],(i,[t])=>t.value in i.properties()],"filter-has-id":[nt,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[nt,[k(ft)],(i,[t])=>t.value.indexOf(i.geometryType())>=0],"filter-id-in":[nt,[k(st)],(i,[t])=>t.value.indexOf(i.id())>=0],"filter-in-small":[nt,[ft,k(st)],(i,[t,r])=>r.value.indexOf(i.properties()[t.value])>=0],"filter-in-large":[nt,[ft,k(st)],(i,[t,r])=>function(a,l,h,d){for(;h<=d;){let f=h+d>>1;if(l[f]===a)return!0;l[f]>a?d=f-1:h=f+1}return!1}(i.properties()[t.value],r.value,0,r.value.length-1)],all:{type:nt,overloads:[[[nt,nt],(i,[t,r])=>t.evaluate(i)&&r.evaluate(i)],[Dn(nt),(i,t)=>{for(let r of t)if(!r.evaluate(i))return!1;return!0}]]},any:{type:nt,overloads:[[[nt,nt],(i,[t,r])=>t.evaluate(i)||r.evaluate(i)],[Dn(nt),(i,t)=>{for(let r of t)if(r.evaluate(i))return!0;return!1}]]},"!":[nt,[nt],(i,[t])=>!t.evaluate(i)],"is-supported-script":[nt,[ft],(i,[t])=>{let r=i.globals&&i.globals.isSupportedScript;return!r||r(t.evaluate(i))}],upcase:[ft,[ft],(i,[t])=>t.evaluate(i).toUpperCase()],downcase:[ft,[ft],(i,[t])=>t.evaluate(i).toLowerCase()],concat:[ft,Dn(st),(i,t)=>t.map(r=>wa(r.evaluate(i))).join("")],"resolved-locale":[ft,[Ki],(i,[t])=>t.evaluate(i).resolvedLocale()]});class hs{constructor(t,r){var a;this.expression=t,this._warningHistory={},this._evaluator=new Ja,this._defaultValue=r?(a=r).type==="color"&&us(a.default)?new jt(0,0,0,0):a.type==="color"?jt.parse(a.default)||null:a.type==="padding"?cr.parse(a.default)||null:a.type==="variableAnchorOffsetCollection"?vr.parse(a.default)||null:a.default===void 0?null:a.default:null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(t,r,a,l,h,d){return this._evaluator.globals=t,this._evaluator.feature=r,this._evaluator.featureState=a,this._evaluator.canonical=l,this._evaluator.availableImages=h||null,this._evaluator.formattedSection=d,this.expression.evaluate(this._evaluator)}evaluate(t,r,a,l,h,d){this._evaluator.globals=t,this._evaluator.feature=r||null,this._evaluator.featureState=a||null,this._evaluator.canonical=l,this._evaluator.availableImages=h||null,this._evaluator.formattedSection=d||null;try{let f=this.expression.evaluate(this._evaluator);if(f==null||typeof f=="number"&&f!=f)return this._defaultValue;if(this._enumValues&&!(f in this._enumValues))throw new gi(`Expected value to be one of ${Object.keys(this._enumValues).map(g=>JSON.stringify(g)).join(", ")}, but found ${JSON.stringify(f)} instead.`);return f}catch(f){return this._warningHistory[f.message]||(this._warningHistory[f.message]=!0,typeof console<"u"&&console.warn(f.message)),this._defaultValue}}}function ps(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in Gn}function Kn(i,t){let r=new xn(Gn,Ia,[],t?function(l){let h={color:Si,string:ft,number:we,enum:ft,boolean:nt,formatted:yr,padding:on,resolvedImage:Zr,variableAnchorOffsetCollection:j};return l.type==="array"?k(h[l.value]||st,l.length):h[l.type]}(t):void 0),a=r.parse(i,void 0,void 0,void 0,t&&t.type==="string"?{typeAnnotation:"coerce"}:void 0);return a?ls(new hs(a,t)):Xn(r.errors)}class Yn{constructor(t,r){this.kind=t,this._styleExpression=r,this.isStateDependent=t!=="constant"&&!Hn(r.expression)}evaluateWithoutErrorHandling(t,r,a,l,h,d){return this._styleExpression.evaluateWithoutErrorHandling(t,r,a,l,h,d)}evaluate(t,r,a,l,h,d){return this._styleExpression.evaluate(t,r,a,l,h,d)}}class Qn{constructor(t,r,a,l){this.kind=t,this.zoomStops=a,this._styleExpression=r,this.isStateDependent=t!=="camera"&&!Hn(r.expression),this.interpolationType=l}evaluateWithoutErrorHandling(t,r,a,l,h,d){return this._styleExpression.evaluateWithoutErrorHandling(t,r,a,l,h,d)}evaluate(t,r,a,l,h,d){return this._styleExpression.evaluate(t,r,a,l,h,d)}interpolationFactor(t,r,a){return this.interpolationType?Qi.interpolationFactor(this.interpolationType,t,r,a):0}}function bo(i,t){let r=Kn(i,t);if(r.result==="error")return r;let a=r.value.expression,l=ka(a);if(!l&&!Wn(t))return Xn([new Ai("","data expressions not supported")]);let h=Ma(a,["zoom"]);if(!h&&!Fl(t))return Xn([new Ai("","zoom expressions not supported")]);let d=Pa(a);return d||h?d instanceof Ai?Xn([d]):d instanceof Qi&&!xo(t)?Xn([new Ai("",'"interpolate" expressions cannot be used with this property')]):ls(d?new Qn(l?"camera":"composite",r.value,d.labels,d instanceof Qi?d.interpolation:void 0):new Yn(l?"constant":"source",r.value)):Xn([new Ai("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class ea{constructor(t,r){this._parameters=t,this._specification=r,or(this,Ol(this._parameters,this._specification))}static deserialize(t){return new ea(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function Pa(i){let t=null;if(i instanceof ln)t=Pa(i.result);else if(i instanceof es){for(let r of i.args)if(t=Pa(r),t)break}else(i instanceof jn||i instanceof Qi)&&i.input instanceof xr&&i.input.name==="zoom"&&(t=i);return t instanceof Ai||i.eachChild(r=>{let a=Pa(r);a instanceof Ai?t=a:!t&&a?t=new Ai("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&a&&t!==a&&(t=new Ai("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),t}function ds(i){if(i===!0||i===!1)return!0;if(!Array.isArray(i)||i.length===0)return!1;switch(i[0]){case"has":return i.length>=2&&i[1]!=="$id"&&i[1]!=="$type";case"in":return i.length>=3&&(typeof i[1]!="string"||Array.isArray(i[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return i.length!==3||Array.isArray(i[1])||Array.isArray(i[2]);case"any":case"all":for(let t of i.slice(1))if(!ds(t)&&typeof t!="boolean")return!1;return!0;default:return!0}}let fs={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function wo(i){if(i==null)return{filter:()=>!0,needGeometry:!1};ds(i)||(i=ms(i));let t=Kn(i,fs);if(t.result==="error")throw new Error(t.value.map(r=>`${r.key}: ${r.message}`).join(", "));return{filter:(r,a,l)=>t.value.evaluate(r,a,{},l),needGeometry:Ul(i)}}function Ku(i,t){return i<t?-1:i>t?1:0}function Ul(i){if(!Array.isArray(i))return!1;if(i[0]==="within"||i[0]==="distance")return!0;for(let t=1;t<i.length;t++)if(Ul(i[t]))return!0;return!1}function ms(i){if(!i)return!0;let t=i[0];return i.length<=1?t!=="any":t==="=="?Ao(i[1],i[2],"=="):t==="!="?Pi(Ao(i[1],i[2],"==")):t==="<"||t===">"||t==="<="||t===">="?Ao(i[1],i[2],t):t==="any"?(r=i.slice(1),["any"].concat(r.map(ms))):t==="all"?["all"].concat(i.slice(1).map(ms)):t==="none"?["all"].concat(i.slice(1).map(ms).map(Pi)):t==="in"?za(i[1],i.slice(2)):t==="!in"?Pi(za(i[1],i.slice(2))):t==="has"?Ba(i[1]):t!=="!has"||Pi(Ba(i[1]));var r}function Ao(i,t,r){switch(i){case"$type":return[`filter-type-${r}`,t];case"$id":return[`filter-id-${r}`,t];default:return[`filter-${r}`,i,t]}}function za(i,t){if(t.length===0)return!1;switch(i){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some(r=>typeof r!=typeof t[0])?["filter-in-large",i,["literal",t.sort(Ku)]]:["filter-in-small",i,["literal",t]]}}function Ba(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function Pi(i){return["!",i]}function Sn(i){let t=typeof i;if(t==="number"||t==="boolean"||t==="string"||i==null)return JSON.stringify(i);if(Array.isArray(i)){let l="[";for(let h of i)l+=`${Sn(h)},`;return`${l}]`}let r=Object.keys(i).sort(),a="{";for(let l=0;l<r.length;l++)a+=`${JSON.stringify(r[l])}:${Sn(i[r[l]])},`;return`${a}}`}function jl(i){let t="";for(let r of Xi)t+=`/${Sn(i[r])}`;return t}function $l(i){let t=i.value;return t?[new be(i.key,t,"constants have been deprecated as of v8")]:[]}function fi(i){return i instanceof Number||i instanceof String||i instanceof Boolean?i.valueOf():i}function Rr(i){if(Array.isArray(i))return i.map(Rr);if(i instanceof Object&&!(i instanceof Number||i instanceof String||i instanceof Boolean)){let t={};for(let r in i)t[r]=Rr(i[r]);return t}return fi(i)}function pr(i){let t=i.key,r=i.value,a=i.valueSpec||{},l=i.objectElementValidators||{},h=i.style,d=i.styleSpec,f=i.validateSpec,g=[],v=Rt(r);if(v!=="object")return[new be(t,r,`object expected, ${v} found`)];for(let x in r){let A=x.split(".")[0],D=a[A]||a["*"],M;if(l[A])M=l[A];else if(a[A])M=f;else if(l["*"])M=l["*"];else{if(!a["*"]){g.push(new be(t,r[x],`unknown property "${x}"`));continue}M=f}g=g.concat(M({key:(t&&`${t}.`)+x,value:r[x],valueSpec:D,style:h,styleSpec:d,object:r,objectKey:x,validateSpec:f},r))}for(let x in a)l[x]||a[x].required&&a[x].default===void 0&&r[x]===void 0&&g.push(new be(t,r,`missing required property "${x}"`));return g}function La(i){let t=i.value,r=i.valueSpec,a=i.style,l=i.styleSpec,h=i.key,d=i.arrayElementValidator||i.validateSpec;if(Rt(t)!=="array")return[new be(h,t,`array expected, ${Rt(t)} found`)];if(r.length&&t.length!==r.length)return[new be(h,t,`array length ${r.length} expected, length ${t.length} found`)];if(r["min-length"]&&t.length<r["min-length"])return[new be(h,t,`array length at least ${r["min-length"]} expected, length ${t.length} found`)];let f={type:r.value,values:r.values};l.$version<7&&(f.function=r.function),Rt(r.value)==="object"&&(f=r.value);let g=[];for(let v=0;v<t.length;v++)g=g.concat(d({array:t,arrayIndex:v,value:t[v],valueSpec:f,validateSpec:i.validateSpec,style:a,styleSpec:l,key:`${h}[${v}]`}));return g}function Eo(i){let t=i.key,r=i.value,a=i.valueSpec,l=Rt(r);return l==="number"&&r!=r&&(l="NaN"),l!=="number"?[new be(t,r,`number expected, ${l} found`)]:"minimum"in a&&r<a.minimum?[new be(t,r,`${r} is less than the minimum value ${a.minimum}`)]:"maximum"in a&&r>a.maximum?[new be(t,r,`${r} is greater than the maximum value ${a.maximum}`)]:[]}function gs(i){let t=i.valueSpec,r=fi(i.value.type),a,l,h,d={},f=r!=="categorical"&&i.value.property===void 0,g=!f,v=Rt(i.value.stops)==="array"&&Rt(i.value.stops[0])==="array"&&Rt(i.value.stops[0][0])==="object",x=pr({key:i.key,value:i.value,valueSpec:i.styleSpec.function,validateSpec:i.validateSpec,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{stops:function(M){if(r==="identity")return[new be(M.key,M.value,'identity function may not have a "stops" property')];let z=[],B=M.value;return z=z.concat(La({key:M.key,value:B,valueSpec:M.valueSpec,validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec,arrayElementValidator:A})),Rt(B)==="array"&&B.length===0&&z.push(new be(M.key,B,"array must have at least one stop")),z},default:function(M){return M.validateSpec({key:M.key,value:M.value,valueSpec:t,validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec})}}});return r==="identity"&&f&&x.push(new be(i.key,i.value,'missing required property "property"')),r==="identity"||i.value.stops||x.push(new be(i.key,i.value,'missing required property "stops"')),r==="exponential"&&i.valueSpec.expression&&!xo(i.valueSpec)&&x.push(new be(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(g&&!Wn(i.valueSpec)?x.push(new be(i.key,i.value,"property functions not supported")):f&&!Fl(i.valueSpec)&&x.push(new be(i.key,i.value,"zoom functions not supported"))),r!=="categorical"&&!v||i.value.property!==void 0||x.push(new be(i.key,i.value,'"property" property is required')),x;function A(M){let z=[],B=M.value,q=M.key;if(Rt(B)!=="array")return[new be(q,B,`array expected, ${Rt(B)} found`)];if(B.length!==2)return[new be(q,B,`array length 2 expected, length ${B.length} found`)];if(v){if(Rt(B[0])!=="object")return[new be(q,B,`object expected, ${Rt(B[0])} found`)];if(B[0].zoom===void 0)return[new be(q,B,"object stop key must have zoom")];if(B[0].value===void 0)return[new be(q,B,"object stop key must have value")];if(h&&h>fi(B[0].zoom))return[new be(q,B[0].zoom,"stop zoom values must appear in ascending order")];fi(B[0].zoom)!==h&&(h=fi(B[0].zoom),l=void 0,d={}),z=z.concat(pr({key:`${q}[0]`,value:B[0],valueSpec:{zoom:{}},validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec,objectElementValidators:{zoom:Eo,value:D}}))}else z=z.concat(D({key:`${q}[0]`,value:B[0],valueSpec:{},validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec},B));return ps(Rr(B[1]))?z.concat([new be(`${q}[1]`,B[1],"expressions are not allowed in function stops.")]):z.concat(M.validateSpec({key:`${q}[1]`,value:B[1],valueSpec:t,validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec}))}function D(M,z){let B=Rt(M.value),q=fi(M.value),$=M.value!==null?M.value:z;if(a){if(B!==a)return[new be(M.key,$,`${B} stop domain type must match previous stop domain type ${a}`)]}else a=B;if(B!=="number"&&B!=="string"&&B!=="boolean")return[new be(M.key,$,"stop domain value must be a number, string, or boolean")];if(B!=="number"&&r!=="categorical"){let ne=`number expected, ${B} found`;return Wn(t)&&r===void 0&&(ne+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new be(M.key,$,ne)]}return r!=="categorical"||B!=="number"||isFinite(q)&&Math.floor(q)===q?r!=="categorical"&&B==="number"&&l!==void 0&&q<l?[new be(M.key,$,"stop domain values must appear in ascending order")]:(l=q,r==="categorical"&&q in d?[new be(M.key,$,"stop domain values must be unique")]:(d[q]=!0,[])):[new be(M.key,$,`integer expected, found ${q}`)]}}function ta(i){let t=(i.expressionContext==="property"?bo:Kn)(Rr(i.value),i.valueSpec);if(t.result==="error")return t.value.map(a=>new be(`${i.key}${a.key}`,i.value,a.message));let r=t.value.expression||t.value._styleExpression.expression;if(i.expressionContext==="property"&&i.propertyKey==="text-font"&&!r.outputDefined())return[new be(i.key,i.value,`Invalid data expression for "${i.propertyKey}". Output values must be contained as literals within the expression.`)];if(i.expressionContext==="property"&&i.propertyType==="layout"&&!Hn(r))return[new be(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if(i.expressionContext==="filter"&&!Hn(r))return[new be(i.key,i.value,'"feature-state" data expressions are not supported with filters.')];if(i.expressionContext&&i.expressionContext.indexOf("cluster")===0){if(!Ma(r,["zoom","feature-state"]))return[new be(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(i.expressionContext==="cluster-initial"&&!ka(r))return[new be(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function tn(i){let t=i.key,r=i.value,a=i.valueSpec,l=[];return Array.isArray(a.values)?a.values.indexOf(fi(r))===-1&&l.push(new be(t,r,`expected one of [${a.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(a.values).indexOf(fi(r))===-1&&l.push(new be(t,r,`expected one of [${Object.keys(a.values).join(", ")}], ${JSON.stringify(r)} found`)),l}function To(i){return ds(Rr(i.value))?ta(or({},i,{expressionContext:"filter",valueSpec:{value:"boolean"}})):_s(i)}function _s(i){let t=i.value,r=i.key;if(Rt(t)!=="array")return[new be(r,t,`array expected, ${Rt(t)} found`)];let a=i.styleSpec,l,h=[];if(t.length<1)return[new be(r,t,"filter array must have at least 1 element")];switch(h=h.concat(tn({key:`${r}[0]`,value:t[0],valueSpec:a.filter_operator,style:i.style,styleSpec:i.styleSpec})),fi(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&fi(t[1])==="$type"&&h.push(new be(r,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":t.length!==3&&h.push(new be(r,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(l=Rt(t[1]),l!=="string"&&h.push(new be(`${r}[1]`,t[1],`string expected, ${l} found`)));for(let d=2;d<t.length;d++)l=Rt(t[d]),fi(t[1])==="$type"?h=h.concat(tn({key:`${r}[${d}]`,value:t[d],valueSpec:a.geometry_type,style:i.style,styleSpec:i.styleSpec})):l!=="string"&&l!=="number"&&l!=="boolean"&&h.push(new be(`${r}[${d}]`,t[d],`string, number, or boolean expected, ${l} found`));break;case"any":case"all":case"none":for(let d=1;d<t.length;d++)h=h.concat(_s({key:`${r}[${d}]`,value:t[d],style:i.style,styleSpec:i.styleSpec}));break;case"has":case"!has":l=Rt(t[1]),t.length!==2?h.push(new be(r,t,`filter array for "${t[0]}" operator must have 2 elements`)):l!=="string"&&h.push(new be(`${r}[1]`,t[1],`string expected, ${l} found`))}return h}function Co(i,t){let r=i.key,a=i.validateSpec,l=i.style,h=i.styleSpec,d=i.value,f=i.objectKey,g=h[`${t}_${i.layerType}`];if(!g)return[];let v=f.match(/^(.*)-transition$/);if(t==="paint"&&v&&g[v[1]]&&g[v[1]].transition)return a({key:r,value:d,valueSpec:h.transition,style:l,styleSpec:h});let x=i.valueSpec||g[f];if(!x)return[new be(r,d,`unknown property "${f}"`)];let A;if(Rt(d)==="string"&&Wn(x)&&!x.tokens&&(A=/^{([^}]+)}$/.exec(d)))return[new be(r,d,`"${f}" does not support interpolation syntax
Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(A[1])} }\`.`)];let D=[];return i.layerType==="symbol"&&(f==="text-field"&&l&&!l.glyphs&&D.push(new be(r,d,'use of "text-field" requires a style "glyphs" property')),f==="text-font"&&us(Rr(d))&&fi(d.type)==="identity"&&D.push(new be(r,d,'"text-font" does not support identity functions'))),D.concat(a({key:i.key,value:d,valueSpec:x,style:l,styleSpec:h,expressionContext:"property",propertyType:t,propertyKey:f}))}function ys(i){return Co(i,"paint")}function Do(i){return Co(i,"layout")}function So(i){let t=[],r=i.value,a=i.key,l=i.style,h=i.styleSpec;r.type||r.ref||t.push(new be(a,r,'either "type" or "ref" is required'));let d=fi(r.type),f=fi(r.ref);if(r.id){let g=fi(r.id);for(let v=0;v<i.arrayIndex;v++){let x=l.layers[v];fi(x.id)===g&&t.push(new be(a,r.id,`duplicate layer id "${r.id}", previously used at line ${x.id.__line__}`))}}if("ref"in r){let g;["type","source","source-layer","filter","layout"].forEach(v=>{v in r&&t.push(new be(a,r[v],`"${v}" is prohibited for ref layers`))}),l.layers.forEach(v=>{fi(v.id)===f&&(g=v)}),g?g.ref?t.push(new be(a,r.ref,"ref cannot reference another ref layer")):d=fi(g.type):t.push(new be(a,r.ref,`ref layer "${f}" not found`))}else if(d!=="background")if(r.source){let g=l.sources&&l.sources[r.source],v=g&&fi(g.type);g?v==="vector"&&d==="raster"?t.push(new be(a,r.source,`layer "${r.id}" requires a raster source`)):v!=="raster-dem"&&d==="hillshade"?t.push(new be(a,r.source,`layer "${r.id}" requires a raster-dem source`)):v==="raster"&&d!=="raster"?t.push(new be(a,r.source,`layer "${r.id}" requires a vector source`)):v!=="vector"||r["source-layer"]?v==="raster-dem"&&d!=="hillshade"?t.push(new be(a,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):d!=="line"||!r.paint||!r.paint["line-gradient"]||v==="geojson"&&g.lineMetrics||t.push(new be(a,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new be(a,r,`layer "${r.id}" must specify a "source-layer"`)):t.push(new be(a,r.source,`source "${r.source}" not found`))}else t.push(new be(a,r,'missing required property "source"'));return t=t.concat(pr({key:a,value:r,valueSpec:h.layer,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,objectElementValidators:{"*":()=>[],type:()=>i.validateSpec({key:`${a}.type`,value:r.type,valueSpec:h.layer.type,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,object:r,objectKey:"type"}),filter:To,layout:g=>pr({layer:r,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,validateSpec:g.validateSpec,objectElementValidators:{"*":v=>Do(or({layerType:d},v))}}),paint:g=>pr({layer:r,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,validateSpec:g.validateSpec,objectElementValidators:{"*":v=>ys(or({layerType:d},v))}})}})),t}function In(i){let t=i.value,r=i.key,a=Rt(t);return a!=="string"?[new be(r,t,`string expected, ${a} found`)]:[]}let vs={promoteId:function({key:i,value:t}){if(Rt(t)==="string")return In({key:i,value:t});{let r=[];for(let a in t)r.push(...In({key:`${i}.${a}`,value:t[a]}));return r}}};function Ra(i){let t=i.value,r=i.key,a=i.styleSpec,l=i.style,h=i.validateSpec;if(!t.type)return[new be(r,t,'"type" is required')];let d=fi(t.type),f;switch(d){case"vector":case"raster":return f=pr({key:r,value:t,valueSpec:a[`source_${d.replace("-","_")}`],style:i.style,styleSpec:a,objectElementValidators:vs,validateSpec:h}),f;case"raster-dem":return f=function(g){var v;let x=(v=g.sourceName)!==null&&v!==void 0?v:"",A=g.value,D=g.styleSpec,M=D.source_raster_dem,z=g.style,B=[],q=Rt(A);if(A===void 0)return B;if(q!=="object")return B.push(new be("source_raster_dem",A,`object expected, ${q} found`)),B;let $=fi(A.encoding)==="custom",ne=["redFactor","greenFactor","blueFactor","baseShift"],J=g.value.encoding?`"${g.value.encoding}"`:"Default";for(let ie in A)!$&&ne.includes(ie)?B.push(new be(ie,A[ie],`In "${x}": "${ie}" is only valid when "encoding" is set to "custom". ${J} encoding found`)):M[ie]?B=B.concat(g.validateSpec({key:ie,value:A[ie],valueSpec:M[ie],validateSpec:g.validateSpec,style:z,styleSpec:D})):B.push(new be(ie,A[ie],`unknown property "${ie}"`));return B}({sourceName:r,value:t,style:i.style,styleSpec:a,validateSpec:h}),f;case"geojson":if(f=pr({key:r,value:t,valueSpec:a.source_geojson,style:l,styleSpec:a,validateSpec:h,objectElementValidators:vs}),t.cluster)for(let g in t.clusterProperties){let[v,x]=t.clusterProperties[g],A=typeof v=="string"?[v,["accumulated"],["get",g]]:v;f.push(...ta({key:`${r}.${g}.map`,value:x,validateSpec:h,expressionContext:"cluster-map"})),f.push(...ta({key:`${r}.${g}.reduce`,value:A,validateSpec:h,expressionContext:"cluster-reduce"}))}return f;case"video":return pr({key:r,value:t,valueSpec:a.source_video,style:l,validateSpec:h,styleSpec:a});case"image":return pr({key:r,value:t,valueSpec:a.source_image,style:l,validateSpec:h,styleSpec:a});case"canvas":return[new be(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return tn({key:`${r}.type`,value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:l,validateSpec:h,styleSpec:a})}}function Io(i){let t=i.value,r=i.styleSpec,a=r.light,l=i.style,h=[],d=Rt(t);if(t===void 0)return h;if(d!=="object")return h=h.concat([new be("light",t,`object expected, ${d} found`)]),h;for(let f in t){let g=f.match(/^(.*)-transition$/);h=h.concat(g&&a[g[1]]&&a[g[1]].transition?i.validateSpec({key:f,value:t[f],valueSpec:r.transition,validateSpec:i.validateSpec,style:l,styleSpec:r}):a[f]?i.validateSpec({key:f,value:t[f],valueSpec:a[f],validateSpec:i.validateSpec,style:l,styleSpec:r}):[new be(f,t[f],`unknown property "${f}"`)])}return h}function ko(i){let t=i.value,r=i.styleSpec,a=r.sky,l=i.style,h=Rt(t);if(t===void 0)return[];if(h!=="object")return[new be("sky",t,`object expected, ${h} found`)];let d=[];for(let f in t)d=d.concat(a[f]?i.validateSpec({key:f,value:t[f],valueSpec:a[f],style:l,styleSpec:r}):[new be(f,t[f],`unknown property "${f}"`)]);return d}function Mo(i){let t=i.value,r=i.styleSpec,a=r.terrain,l=i.style,h=[],d=Rt(t);if(t===void 0)return h;if(d!=="object")return h=h.concat([new be("terrain",t,`object expected, ${d} found`)]),h;for(let f in t)h=h.concat(a[f]?i.validateSpec({key:f,value:t[f],valueSpec:a[f],validateSpec:i.validateSpec,style:l,styleSpec:r}):[new be(f,t[f],`unknown property "${f}"`)]);return h}function Po(i){let t=[],r=i.value,a=i.key;if(Array.isArray(r)){let l=[],h=[];for(let d in r)r[d].id&&l.includes(r[d].id)&&t.push(new be(a,r,`all the sprites' ids must be unique, but ${r[d].id} is duplicated`)),l.push(r[d].id),r[d].url&&h.includes(r[d].url)&&t.push(new be(a,r,`all the sprites' URLs must be unique, but ${r[d].url} is duplicated`)),h.push(r[d].url),t=t.concat(pr({key:`${a}[${d}]`,value:r[d],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:i.validateSpec}));return t}return In({key:a,value:r})}let xs={"*":()=>[],array:La,boolean:function(i){let t=i.value,r=i.key,a=Rt(t);return a!=="boolean"?[new be(r,t,`boolean expected, ${a} found`)]:[]},number:Eo,color:function(i){let t=i.key,r=i.value,a=Rt(r);return a!=="string"?[new be(t,r,`color expected, ${a} found`)]:jt.parse(String(r))?[]:[new be(t,r,`color expected, "${r}" found`)]},constants:$l,enum:tn,filter:To,function:gs,layer:So,object:pr,source:Ra,light:Io,sky:ko,terrain:Mo,projection:function(i){let t=i.value,r=i.styleSpec,a=r.projection,l=i.style,h=Rt(t);if(t===void 0)return[];if(h!=="object")return[new be("projection",t,`object expected, ${h} found`)];let d=[];for(let f in t)d=d.concat(a[f]?i.validateSpec({key:f,value:t[f],valueSpec:a[f],style:l,styleSpec:r}):[new be(f,t[f],`unknown property "${f}"`)]);return d},string:In,formatted:function(i){return In(i).length===0?[]:ta(i)},resolvedImage:function(i){return In(i).length===0?[]:ta(i)},padding:function(i){let t=i.key,r=i.value;if(Rt(r)==="array"){if(r.length<1||r.length>4)return[new be(t,r,`padding requires 1 to 4 values; ${r.length} values found`)];let a={type:"number"},l=[];for(let h=0;h<r.length;h++)l=l.concat(i.validateSpec({key:`${t}[${h}]`,value:r[h],validateSpec:i.validateSpec,valueSpec:a}));return l}return Eo({key:t,value:r,valueSpec:{}})},variableAnchorOffsetCollection:function(i){let t=i.key,r=i.value,a=Rt(r),l=i.styleSpec;if(a!=="array"||r.length<1||r.length%2!=0)return[new be(t,r,"variableAnchorOffsetCollection requires a non-empty array of even length")];let h=[];for(let d=0;d<r.length;d+=2)h=h.concat(tn({key:`${t}[${d}]`,value:r[d],valueSpec:l.layout_symbol["text-anchor"]})),h=h.concat(La({key:`${t}[${d+1}]`,value:r[d+1],valueSpec:{length:2,value:"number"},validateSpec:i.validateSpec,style:i.style,styleSpec:l}));return h},sprite:Po};function ia(i){let t=i.value,r=i.valueSpec,a=i.styleSpec;return i.validateSpec=ia,r.expression&&us(fi(t))?gs(i):r.expression&&ps(Rr(t))?ta(i):r.type&&xs[r.type]?xs[r.type](i):pr(or({},i,{valueSpec:r.type?a[r.type]:r}))}function Zl(i){let t=i.value,r=i.key,a=In(i);return a.length||(t.indexOf("{fontstack}")===-1&&a.push(new be(r,t,'"glyphs" url must include a "{fontstack}" token')),t.indexOf("{range}")===-1&&a.push(new be(r,t,'"glyphs" url must include a "{range}" token'))),a}function br(i,t=oe){let r=[];return r=r.concat(ia({key:"",value:i,valueSpec:t.$root,styleSpec:t,style:i,validateSpec:ia,objectElementValidators:{glyphs:Zl,"*":()=>[]}})),i.constants&&(r=r.concat($l({key:"constants",value:i.constants,style:i,styleSpec:t,validateSpec:ia}))),zo(r)}function Hr(i){return function(t){return i({...t,validateSpec:ia})}}function zo(i){return[].concat(i).sort((t,r)=>t.line-r.line)}function Fr(i){return function(...t){return zo(i.apply(this,t))}}br.source=Fr(Hr(Ra)),br.sprite=Fr(Hr(Po)),br.glyphs=Fr(Hr(Zl)),br.light=Fr(Hr(Io)),br.sky=Fr(Hr(ko)),br.terrain=Fr(Hr(Mo)),br.layer=Fr(Hr(So)),br.filter=Fr(Hr(To)),br.paintProperty=Fr(Hr(ys)),br.layoutProperty=Fr(Hr(Do));let kn=br,Yu=kn.light,Qu=kn.sky,Gl=kn.paintProperty,Hl=kn.layoutProperty;function Bo(i,t){let r=!1;if(t&&t.length)for(let a of t)i.fire(new bi(new Error(a.message))),r=!0;return r}class ra{constructor(t,r,a){let l=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;let d=new Int32Array(this.arrayBuffer);t=d[0],this.d=(r=d[1])+2*(a=d[2]);for(let g=0;g<this.d*this.d;g++){let v=d[3+g],x=d[3+g+1];l.push(v===x?null:d.subarray(v,x))}let f=d[3+l.length+1];this.keys=d.subarray(d[3+l.length],f),this.bboxes=d.subarray(f),this.insert=this._insertReadonly}else{this.d=r+2*a;for(let d=0;d<this.d*this.d;d++)l.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=t,this.padding=a,this.scale=r/t,this.uid=0;let h=a/r*t;this.min=-h,this.max=t+h}insert(t,r,a,l,h){this._forEachCell(r,a,l,h,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(r),this.bboxes.push(a),this.bboxes.push(l),this.bboxes.push(h)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(t,r,a,l,h,d){this.cells[h].push(d)}query(t,r,a,l,h){let d=this.min,f=this.max;if(t<=d&&r<=d&&f<=a&&f<=l&&!h)return Array.prototype.slice.call(this.keys);{let g=[];return this._forEachCell(t,r,a,l,this._queryCell,g,{},h),g}}_queryCell(t,r,a,l,h,d,f,g){let v=this.cells[h];if(v!==null){let x=this.keys,A=this.bboxes;for(let D=0;D<v.length;D++){let M=v[D];if(f[M]===void 0){let z=4*M;(g?g(A[z+0],A[z+1],A[z+2],A[z+3]):t<=A[z+2]&&r<=A[z+3]&&a>=A[z+0]&&l>=A[z+1])?(f[M]=!0,d.push(x[M])):f[M]=!1}}}}_forEachCell(t,r,a,l,h,d,f,g){let v=this._convertToCellCoord(t),x=this._convertToCellCoord(r),A=this._convertToCellCoord(a),D=this._convertToCellCoord(l);for(let M=v;M<=A;M++)for(let z=x;z<=D;z++){let B=this.d*z+M;if((!g||g(this._convertFromCellCoord(M),this._convertFromCellCoord(z),this._convertFromCellCoord(M+1),this._convertFromCellCoord(z+1)))&&h.call(this,t,r,a,l,B,d,f,g))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;let t=this.cells,r=3+this.cells.length+1+1,a=0;for(let d=0;d<this.cells.length;d++)a+=this.cells[d].length;let l=new Int32Array(r+a+this.keys.length+this.bboxes.length);l[0]=this.extent,l[1]=this.n,l[2]=this.padding;let h=r;for(let d=0;d<t.length;d++){let f=t[d];l[3+d]=h,l.set(f,h),h+=f.length}return l[3+t.length]=h,l.set(this.keys,h),h+=this.keys.length,l[3+t.length+1]=h,l.set(this.bboxes,h),h+=this.bboxes.length,l.buffer}static serialize(t,r){let a=t.toArrayBuffer();return r&&r.push(a),{buffer:a}}static deserialize(t){return new ra(t.buffer)}}let wr={};function Ve(i,t,r={}){if(wr[i])throw new Error(`${i} is already registered.`);Object.defineProperty(t,"_classRegistryKey",{value:i,writeable:!1}),wr[i]={klass:t,omit:r.omit||[],shallow:r.shallow||[]}}Ve("Object",Object),Ve("TransferableGridIndex",ra),Ve("Color",jt),Ve("Error",Error),Ve("AJAXError",vt),Ve("ResolvedImage",hr),Ve("StylePropertyFunction",ea),Ve("StyleExpression",hs,{omit:["_evaluator"]}),Ve("ZoomDependentExpression",Qn),Ve("ZoomConstantExpression",Yn),Ve("CompoundExpression",xr,{omit:["_evaluate"]});for(let i in Gn)Gn[i]._classRegistryKey||Ve(`Expression_${i}`,Gn[i]);function bs(i){return i&&typeof ArrayBuffer<"u"&&(i instanceof ArrayBuffer||i.constructor&&i.constructor.name==="ArrayBuffer")}function Lo(i){return i.$name||i.constructor._classRegistryKey}function Xl(i){return!function(t){if(t===null||typeof t!="object")return!1;let r=Lo(t);return!(!r||r==="Object")}(i)&&(i==null||typeof i=="boolean"||typeof i=="number"||typeof i=="string"||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp||i instanceof Blob||i instanceof Error||bs(i)||ht(i)||ArrayBuffer.isView(i)||i instanceof ImageData)}function na(i,t){if(Xl(i))return(bs(i)||ht(i))&&t&&t.push(i),ArrayBuffer.isView(i)&&t&&t.push(i.buffer),i instanceof ImageData&&t&&t.push(i.data.buffer),i;if(Array.isArray(i)){let h=[];for(let d of i)h.push(na(d,t));return h}if(typeof i!="object")throw new Error("can't serialize object of type "+typeof i);let r=Lo(i);if(!r)throw new Error(`can't serialize object of unregistered class ${i.constructor.name}`);if(!wr[r])throw new Error(`${r} is not registered.`);let{klass:a}=wr[r],l=a.serialize?a.serialize(i,t):{};if(a.serialize){if(t&&l===t[t.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(let h in i){if(!i.hasOwnProperty(h)||wr[r].omit.indexOf(h)>=0)continue;let d=i[h];l[h]=wr[r].shallow.indexOf(h)>=0?d:na(d,t)}i instanceof Error&&(l.message=i.message)}if(l.$name)throw new Error("$name property is reserved for worker serialization logic.");return r!=="Object"&&(l.$name=r),l}function aa(i){if(Xl(i))return i;if(Array.isArray(i))return i.map(aa);if(typeof i!="object")throw new Error("can't deserialize object of type "+typeof i);let t=Lo(i)||"Object";if(!wr[t])throw new Error(`can't deserialize unregistered class ${t}`);let{klass:r}=wr[t];if(!r)throw new Error(`can't deserialize unregistered class ${t}`);if(r.deserialize)return r.deserialize(i);let a=Object.create(r.prototype);for(let l of Object.keys(i)){if(l==="$name")continue;let h=i[l];a[l]=wr[t].shallow.indexOf(l)>=0?h:aa(h)}return a}class Ro{constructor(){this.first=!0}update(t,r){let a=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=a,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=a,!0):(this.lastFloorZoom>a?(this.lastIntegerZoom=a+1,this.lastIntegerZoomTime=r):this.lastFloorZoom<a&&(this.lastIntegerZoom=a,this.lastIntegerZoomTime=r),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=a,!0))}}let Dt={"Latin-1 Supplement":i=>i>=128&&i<=255,"Hangul Jamo":i=>i>=4352&&i<=4607,Khmer:i=>i>=6016&&i<=6143,"General Punctuation":i=>i>=8192&&i<=8303,"Letterlike Symbols":i=>i>=8448&&i<=8527,"Number Forms":i=>i>=8528&&i<=8591,"Miscellaneous Technical":i=>i>=8960&&i<=9215,"Control Pictures":i=>i>=9216&&i<=9279,"Optical Character Recognition":i=>i>=9280&&i<=9311,"Enclosed Alphanumerics":i=>i>=9312&&i<=9471,"Geometric Shapes":i=>i>=9632&&i<=9727,"Miscellaneous Symbols":i=>i>=9728&&i<=9983,"Miscellaneous Symbols and Arrows":i=>i>=11008&&i<=11263,"Ideographic Description Characters":i=>i>=12272&&i<=12287,"CJK Symbols and Punctuation":i=>i>=12288&&i<=12351,Katakana:i=>i>=12448&&i<=12543,Kanbun:i=>i>=12688&&i<=12703,"CJK Strokes":i=>i>=12736&&i<=12783,"Enclosed CJK Letters and Months":i=>i>=12800&&i<=13055,"CJK Compatibility":i=>i>=13056&&i<=13311,"Yijing Hexagram Symbols":i=>i>=19904&&i<=19967,"Private Use Area":i=>i>=57344&&i<=63743,"Vertical Forms":i=>i>=65040&&i<=65055,"CJK Compatibility Forms":i=>i>=65072&&i<=65103,"Small Form Variants":i=>i>=65104&&i<=65135,"Halfwidth and Fullwidth Forms":i=>i>=65280&&i<=65519};function Fo(i){for(let t of i)if(No(t.charCodeAt(0)))return!0;return!1}function ec(i){for(let t of i)if(!sa(t.charCodeAt(0)))return!1;return!0}function Oo(i){let t=i.map(r=>{try{return new RegExp(`\\p{sc=${r}}`,"u").source}catch{return null}}).filter(r=>r);return new RegExp(t.join("|"),"u")}let tc=Oo(["Arab","Dupl","Mong","Ougr","Syrc"]);function sa(i){return!tc.test(String.fromCodePoint(i))}let Wl=Oo(["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"]);function No(i){return!(i!==746&&i!==747&&(i<4352||!(Dt["CJK Compatibility Forms"](i)&&!(i>=65097&&i<=65103)||Dt["CJK Compatibility"](i)||Dt["CJK Strokes"](i)||!(!Dt["CJK Symbols and Punctuation"](i)||i>=12296&&i<=12305||i>=12308&&i<=12319||i===12336)||Dt["Enclosed CJK Letters and Months"](i)||Dt["Ideographic Description Characters"](i)||Dt.Kanbun(i)||Dt.Katakana(i)&&i!==12540||!(!Dt["Halfwidth and Fullwidth Forms"](i)||i===65288||i===65289||i===65293||i>=65306&&i<=65310||i===65339||i===65341||i===65343||i>=65371&&i<=65503||i===65507||i>=65512&&i<=65519)||!(!Dt["Small Form Variants"](i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||Dt["Vertical Forms"](i)||Dt["Yijing Hexagram Symbols"](i)||/\p{sc=Cans}/u.test(String.fromCodePoint(i))||/\p{sc=Hang}/u.test(String.fromCodePoint(i))||Wl.test(String.fromCodePoint(i)))))}function Jl(i){return!(No(i)||function(t){return!!(Dt["Latin-1 Supplement"](t)&&(t===167||t===169||t===174||t===177||t===188||t===189||t===190||t===215||t===247)||Dt["General Punctuation"](t)&&(t===8214||t===8224||t===8225||t===8240||t===8241||t===8251||t===8252||t===8258||t===8263||t===8264||t===8265||t===8273)||Dt["Letterlike Symbols"](t)||Dt["Number Forms"](t)||Dt["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||t===9003||t>=9085&&t<=9114||t>=9150&&t<=9165||t===9167||t>=9169&&t<=9179||t>=9186&&t<=9215)||Dt["Control Pictures"](t)&&t!==9251||Dt["Optical Character Recognition"](t)||Dt["Enclosed Alphanumerics"](t)||Dt["Geometric Shapes"](t)||Dt["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||Dt["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||Dt["CJK Symbols and Punctuation"](t)||Dt.Katakana(t)||Dt["Private Use Area"](t)||Dt["CJK Compatibility Forms"](t)||Dt["Small Form Variants"](t)||Dt["Halfwidth and Fullwidth Forms"](t)||t===8734||t===8756||t===8757||t>=9984&&t<=10087||t>=10102&&t<=10131||t===65532||t===65533)}(i))}let ic=Oo(["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 qo(i){return ic.test(String.fromCodePoint(i))}function rc(i,t){return!(!t&&qo(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||Dt.Khmer(i))}function nc(i){for(let t of i)if(qo(t.charCodeAt(0)))return!0;return!1}let dr=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null}setState(i){this.pluginStatus=i.pluginStatus,this.pluginURL=i.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(i){this.applyArabicShaping=i.applyArabicShaping,this.processBidirectionalText=i.processBidirectionalText,this.processStyledBidirectionalText=i.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class ti{constructor(t,r){this.zoom=t,r?(this.now=r.now,this.fadeDuration=r.fadeDuration,this.zoomHistory=r.zoomHistory,this.transition=r.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Ro,this.transition={})}isSupportedScript(t){return function(r,a){for(let l of r)if(!rc(l.charCodeAt(0),a))return!1;return!0}(t,dr.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let t=this.zoom,r=t-Math.floor(t),a=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*a}:{fromScale:.5,toScale:1,t:1-(1-a)*r}}}class oa{constructor(t,r){this.property=t,this.value=r,this.expression=function(a,l){if(us(a))return new ea(a,l);if(ps(a)){let h=bo(a,l);if(h.result==="error")throw new Error(h.value.map(d=>`${d.key}: ${d.message}`).join(", "));return h.value}{let h=a;return l.type==="color"&&typeof a=="string"?h=jt.parse(a):l.type!=="padding"||typeof a!="number"&&!Array.isArray(a)?l.type==="variableAnchorOffsetCollection"&&Array.isArray(a)&&(h=vr.parse(a)):h=cr.parse(a),{kind:"constant",evaluate:()=>h}}}(r===void 0?t.specification.default:r,t.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(t,r,a){return this.property.possiblyEvaluate(this,t,r,a)}}class ws{constructor(t){this.property=t,this.value=new oa(t,void 0)}transitioned(t,r){return new Kl(this.property,this.value,r,Ye({},t.transition,this.transition),t.now)}untransitioned(){return new Kl(this.property,this.value,null,{},0)}}class As{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return ye(this._values[t].value.value)}setValue(t,r){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new ws(this._values[t].property)),this._values[t].value=new oa(this._values[t].property,r===null?void 0:ye(r))}getTransition(t){return ye(this._values[t].transition)}setTransition(t,r){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new ws(this._values[t].property)),this._values[t].transition=ye(r)||void 0}serialize(){let t={};for(let r of Object.keys(this._values)){let a=this.getValue(r);a!==void 0&&(t[r]=a);let l=this.getTransition(r);l!==void 0&&(t[`${r}-transition`]=l)}return t}transitioned(t,r){let a=new Fa(this._properties);for(let l of Object.keys(this._values))a._values[l]=this._values[l].transitioned(t,r._values[l]);return a}untransitioned(){let t=new Fa(this._properties);for(let r of Object.keys(this._values))t._values[r]=this._values[r].untransitioned();return t}}class Kl{constructor(t,r,a,l,h){this.property=t,this.value=r,this.begin=h+l.delay||0,this.end=this.begin+l.duration||0,t.specification.transition&&(l.delay||l.duration)&&(this.prior=a)}possiblyEvaluate(t,r,a){let l=t.now||0,h=this.value.possiblyEvaluate(t,r,a),d=this.prior;if(d){if(l>this.end)return this.prior=null,h;if(this.value.isDataDriven())return this.prior=null,h;if(l<this.begin)return d.possiblyEvaluate(t,r,a);{let f=(l-this.begin)/(this.end-this.begin);return this.property.interpolate(d.possiblyEvaluate(t,r,a),h,function(g){if(g<=0)return 0;if(g>=1)return 1;let v=g*g,x=v*g;return 4*(g<.5?x:3*(g-v)+x-.75)}(f))}}return h}}class Fa{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,r,a){let l=new Na(this._properties);for(let h of Object.keys(this._values))l._values[h]=this._values[h].possiblyEvaluate(t,r,a);return l}hasTransition(){for(let t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}}class Oa{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)}hasValue(t){return this._values[t].value!==void 0}getValue(t){return ye(this._values[t].value)}setValue(t,r){this._values[t]=new oa(this._values[t].property,r===null?void 0:ye(r))}serialize(){let t={};for(let r of Object.keys(this._values)){let a=this.getValue(r);a!==void 0&&(t[r]=a)}return t}possiblyEvaluate(t,r,a){let l=new Na(this._properties);for(let h of Object.keys(this._values))l._values[h]=this._values[h].possiblyEvaluate(t,r,a);return l}}class Xr{constructor(t,r,a){this.property=t,this.value=r,this.parameters=a}isConstant(){return this.value.kind==="constant"}constantOr(t){return this.value.kind==="constant"?this.value.value:t}evaluate(t,r,a,l){return this.property.evaluate(this.value,this.parameters,t,r,a,l)}}class Na{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class je{constructor(t){this.specification=t}possiblyEvaluate(t,r){if(t.isDataDriven())throw new Error("Value should not be data driven");return t.expression.evaluate(r)}interpolate(t,r,a){let l=Yi[this.specification.type];return l?l(t,r,a):t}}class rt{constructor(t,r){this.specification=t,this.overrides=r}possiblyEvaluate(t,r,a,l){return new Xr(this,t.expression.kind==="constant"||t.expression.kind==="camera"?{kind:"constant",value:t.expression.evaluate(r,null,{},a,l)}:t.expression,r)}interpolate(t,r,a){if(t.value.kind!=="constant"||r.value.kind!=="constant")return t;if(t.value.value===void 0||r.value.value===void 0)return new Xr(this,{kind:"constant",value:void 0},t.parameters);let l=Yi[this.specification.type];if(l){let h=l(t.value.value,r.value.value,a);return new Xr(this,{kind:"constant",value:h},t.parameters)}return t}evaluate(t,r,a,l,h,d){return t.kind==="constant"?t.value:t.evaluate(r,a,l,h,d)}}class Es extends rt{possiblyEvaluate(t,r,a,l){if(t.value===void 0)return new Xr(this,{kind:"constant",value:void 0},r);if(t.expression.kind==="constant"){let h=t.expression.evaluate(r,null,{},a,l),d=t.property.specification.type==="resolvedImage"&&typeof h!="string"?h.name:h,f=this._calculate(d,d,d,r);return new Xr(this,{kind:"constant",value:f},r)}if(t.expression.kind==="camera"){let h=this._calculate(t.expression.evaluate({zoom:r.zoom-1}),t.expression.evaluate({zoom:r.zoom}),t.expression.evaluate({zoom:r.zoom+1}),r);return new Xr(this,{kind:"constant",value:h},r)}return new Xr(this,t.expression,r)}evaluate(t,r,a,l,h,d){if(t.kind==="source"){let f=t.evaluate(r,a,l,h,d);return this._calculate(f,f,f,r)}return t.kind==="composite"?this._calculate(t.evaluate({zoom:Math.floor(r.zoom)-1},a,l),t.evaluate({zoom:Math.floor(r.zoom)},a,l),t.evaluate({zoom:Math.floor(r.zoom)+1},a,l),r):t.value}_calculate(t,r,a,l){return l.zoom>l.zoomHistory.lastIntegerZoom?{from:t,to:r}:{from:a,to:r}}interpolate(t){return t}}class Ts{constructor(t){this.specification=t}possiblyEvaluate(t,r,a,l){if(t.value!==void 0){if(t.expression.kind==="constant"){let h=t.expression.evaluate(r,null,{},a,l);return this._calculate(h,h,h,r)}return this._calculate(t.expression.evaluate(new ti(Math.floor(r.zoom-1),r)),t.expression.evaluate(new ti(Math.floor(r.zoom),r)),t.expression.evaluate(new ti(Math.floor(r.zoom+1),r)),r)}}_calculate(t,r,a,l){return l.zoom>l.zoomHistory.lastIntegerZoom?{from:t,to:r}:{from:a,to:r}}interpolate(t){return t}}class Vo{constructor(t){this.specification=t}possiblyEvaluate(t,r,a,l){return!!t.expression.evaluate(r,null,{},a,l)}interpolate(){return!1}}class c{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let r in t){let a=t[r];a.specification.overridable&&this.overridableProperties.push(r);let l=this.defaultPropertyValues[r]=new oa(a,void 0),h=this.defaultTransitionablePropertyValues[r]=new ws(a);this.defaultTransitioningPropertyValues[r]=h.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=l.possiblyEvaluate({})}}}Ve("DataDrivenProperty",rt),Ve("DataConstantProperty",je),Ve("CrossFadedDataDrivenProperty",Es),Ve("CrossFadedProperty",Ts),Ve("ColorRampProperty",Vo);let e="-transition";class n extends Kt{constructor(t,r){if(super(),this.id=t.id,this.type=t.type,this._featureFilter={filter:()=>!0,needGeometry:!1},t.type!=="custom"&&(this.metadata=t.metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,t.type!=="background"&&(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter),r.layout&&(this._unevaluatedLayout=new Oa(r.layout)),r.paint)){this._transitionablePaint=new As(r.paint);for(let a in t.paint)this.setPaintProperty(a,t.paint[a],{validate:!1});for(let a in t.layout)this.setLayoutProperty(a,t.layout[a],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Na(r.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return t==="visibility"?this.visibility:this._unevaluatedLayout.getValue(t)}setLayoutProperty(t,r,a={}){r!=null&&this._validate(Hl,`layers.${this.id}.layout.${t}`,t,r,a)||(t!=="visibility"?this._unevaluatedLayout.setValue(t,r):this.visibility=r)}getPaintProperty(t){return t.endsWith(e)?this._transitionablePaint.getTransition(t.slice(0,-11)):this._transitionablePaint.getValue(t)}setPaintProperty(t,r,a={}){if(r!=null&&this._validate(Gl,`layers.${this.id}.paint.${t}`,t,r,a))return!1;if(t.endsWith(e))return this._transitionablePaint.setTransition(t.slice(0,-11),r||void 0),!1;{let l=this._transitionablePaint._values[t],h=l.property.specification["property-type"]==="cross-faded-data-driven",d=l.value.isDataDriven(),f=l.value;this._transitionablePaint.setValue(t,r),this._handleSpecialPaintPropertyUpdate(t);let g=this._transitionablePaint._values[t].value;return g.isDataDriven()||d||h||this._handleOverridablePaintPropertyUpdate(t,f,g)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,r,a){return!1}isHidden(t){return!!(this.minzoom&&t<this.minzoom)||!!(this.maxzoom&&t>=this.maxzoom)||this.visibility==="none"}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(t,r){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,r)}serialize(){let 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),Le(t,(r,a)=>!(r===void 0||a==="layout"&&!Object.keys(r).length||a==="paint"&&!Object.keys(r).length))}_validate(t,r,a,l,h={}){return(!h||h.validate!==!1)&&Bo(this,t.call(kn,{key:r,layerType:this.type,objectKey:a,value:l,styleSpec:oe,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let t in this.paint._values){let r=this.paint.get(t);if(r instanceof Xr&&Wn(r.property.specification)&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}}let s={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class o{constructor(t,r){this._structArray=t,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class u{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,r){return t._trim(),r&&(t.isTransferred=!0,r.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){let r=Object.create(this.prototype);return r.arrayBuffer=t.arrayBuffer,r.length=t.length,r.capacity=t.arrayBuffer.byteLength/r.bytesPerElement,r._refreshViews(),r}_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);let r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function m(i,t=1){let r=0,a=0;return{members:i.map(l=>{let h=s[l.type].BYTES_PER_ELEMENT,d=r=_(r,Math.max(t,h)),f=l.components||1;return a=Math.max(a,h),r+=h*f,{name:l.name,type:l.type,components:f,offset:d}}),size:_(r,Math.max(a,t)),alignment:t}}function _(i,t){return Math.ceil(i/t)*t}class y extends u{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r){let a=this.length;return this.resize(a+1),this.emplace(a,t,r)}emplace(t,r,a){let l=2*t;return this.int16[l+0]=r,this.int16[l+1]=a,t}}y.prototype.bytesPerElement=4,Ve("StructArrayLayout2i4",y);class b extends u{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,a){let l=this.length;return this.resize(l+1),this.emplace(l,t,r,a)}emplace(t,r,a,l){let h=3*t;return this.int16[h+0]=r,this.int16[h+1]=a,this.int16[h+2]=l,t}}b.prototype.bytesPerElement=6,Ve("StructArrayLayout3i6",b);class T extends u{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,a,l){let h=this.length;return this.resize(h+1),this.emplace(h,t,r,a,l)}emplace(t,r,a,l,h){let d=4*t;return this.int16[d+0]=r,this.int16[d+1]=a,this.int16[d+2]=l,this.int16[d+3]=h,t}}T.prototype.bytesPerElement=8,Ve("StructArrayLayout4i8",T);class C extends u{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,a,l,h,d){let f=this.length;return this.resize(f+1),this.emplace(f,t,r,a,l,h,d)}emplace(t,r,a,l,h,d,f){let g=6*t;return this.int16[g+0]=r,this.int16[g+1]=a,this.int16[g+2]=l,this.int16[g+3]=h,this.int16[g+4]=d,this.int16[g+5]=f,t}}C.prototype.bytesPerElement=12,Ve("StructArrayLayout2i4i12",C);class P extends u{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,a,l,h,d){let f=this.length;return this.resize(f+1),this.emplace(f,t,r,a,l,h,d)}emplace(t,r,a,l,h,d,f){let g=4*t,v=8*t;return this.int16[g+0]=r,this.int16[g+1]=a,this.uint8[v+4]=l,this.uint8[v+5]=h,this.uint8[v+6]=d,this.uint8[v+7]=f,t}}P.prototype.bytesPerElement=8,Ve("StructArrayLayout2i4ub8",P);class L extends u{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r){let a=this.length;return this.resize(a+1),this.emplace(a,t,r)}emplace(t,r,a){let l=2*t;return this.float32[l+0]=r,this.float32[l+1]=a,t}}L.prototype.bytesPerElement=8,Ve("StructArrayLayout2f8",L);class O extends u{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,a,l,h,d,f,g,v,x){let A=this.length;return this.resize(A+1),this.emplace(A,t,r,a,l,h,d,f,g,v,x)}emplace(t,r,a,l,h,d,f,g,v,x,A){let D=10*t;return this.uint16[D+0]=r,this.uint16[D+1]=a,this.uint16[D+2]=l,this.uint16[D+3]=h,this.uint16[D+4]=d,this.uint16[D+5]=f,this.uint16[D+6]=g,this.uint16[D+7]=v,this.uint16[D+8]=x,this.uint16[D+9]=A,t}}O.prototype.bytesPerElement=20,Ve("StructArrayLayout10ui20",O);class U extends u{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,a,l,h,d,f,g,v,x,A,D){let M=this.length;return this.resize(M+1),this.emplace(M,t,r,a,l,h,d,f,g,v,x,A,D)}emplace(t,r,a,l,h,d,f,g,v,x,A,D,M){let z=12*t;return this.int16[z+0]=r,this.int16[z+1]=a,this.int16[z+2]=l,this.int16[z+3]=h,this.uint16[z+4]=d,this.uint16[z+5]=f,this.uint16[z+6]=g,this.uint16[z+7]=v,this.int16[z+8]=x,this.int16[z+9]=A,this.int16[z+10]=D,this.int16[z+11]=M,t}}U.prototype.bytesPerElement=24,Ve("StructArrayLayout4i4ui4i24",U);class Z extends u{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,a){let l=this.length;return this.resize(l+1),this.emplace(l,t,r,a)}emplace(t,r,a,l){let h=3*t;return this.float32[h+0]=r,this.float32[h+1]=a,this.float32[h+2]=l,t}}Z.prototype.bytesPerElement=12,Ve("StructArrayLayout3f12",Z);class G extends u{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){let r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){return this.uint32[1*t+0]=r,t}}G.prototype.bytesPerElement=4,Ve("StructArrayLayout1ul4",G);class W extends u{_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,r,a,l,h,d,f,g,v){let x=this.length;return this.resize(x+1),this.emplace(x,t,r,a,l,h,d,f,g,v)}emplace(t,r,a,l,h,d,f,g,v,x){let A=10*t,D=5*t;return this.int16[A+0]=r,this.int16[A+1]=a,this.int16[A+2]=l,this.int16[A+3]=h,this.int16[A+4]=d,this.int16[A+5]=f,this.uint32[D+3]=g,this.uint16[A+8]=v,this.uint16[A+9]=x,t}}W.prototype.bytesPerElement=20,Ve("StructArrayLayout6i1ul2ui20",W);class N extends u{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,a,l,h,d){let f=this.length;return this.resize(f+1),this.emplace(f,t,r,a,l,h,d)}emplace(t,r,a,l,h,d,f){let g=6*t;return this.int16[g+0]=r,this.int16[g+1]=a,this.int16[g+2]=l,this.int16[g+3]=h,this.int16[g+4]=d,this.int16[g+5]=f,t}}N.prototype.bytesPerElement=12,Ve("StructArrayLayout2i2i2i12",N);class Q extends u{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,a,l,h){let d=this.length;return this.resize(d+1),this.emplace(d,t,r,a,l,h)}emplace(t,r,a,l,h,d){let f=4*t,g=8*t;return this.float32[f+0]=r,this.float32[f+1]=a,this.float32[f+2]=l,this.int16[g+6]=h,this.int16[g+7]=d,t}}Q.prototype.bytesPerElement=16,Ve("StructArrayLayout2f1f2i16",Q);class te extends u{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,a,l,h,d){let f=this.length;return this.resize(f+1),this.emplace(f,t,r,a,l,h,d)}emplace(t,r,a,l,h,d,f){let g=16*t,v=4*t,x=8*t;return this.uint8[g+0]=r,this.uint8[g+1]=a,this.float32[v+1]=l,this.float32[v+2]=h,this.int16[x+6]=d,this.int16[x+7]=f,t}}te.prototype.bytesPerElement=16,Ve("StructArrayLayout2ub2f2i16",te);class ae extends u{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,a){let l=this.length;return this.resize(l+1),this.emplace(l,t,r,a)}emplace(t,r,a,l){let h=3*t;return this.uint16[h+0]=r,this.uint16[h+1]=a,this.uint16[h+2]=l,t}}ae.prototype.bytesPerElement=6,Ve("StructArrayLayout3ui6",ae);class fe extends u{_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,r,a,l,h,d,f,g,v,x,A,D,M,z,B,q,$){let ne=this.length;return this.resize(ne+1),this.emplace(ne,t,r,a,l,h,d,f,g,v,x,A,D,M,z,B,q,$)}emplace(t,r,a,l,h,d,f,g,v,x,A,D,M,z,B,q,$,ne){let J=24*t,ie=12*t,ce=48*t;return this.int16[J+0]=r,this.int16[J+1]=a,this.uint16[J+2]=l,this.uint16[J+3]=h,this.uint32[ie+2]=d,this.uint32[ie+3]=f,this.uint32[ie+4]=g,this.uint16[J+10]=v,this.uint16[J+11]=x,this.uint16[J+12]=A,this.float32[ie+7]=D,this.float32[ie+8]=M,this.uint8[ce+36]=z,this.uint8[ce+37]=B,this.uint8[ce+38]=q,this.uint32[ie+10]=$,this.int16[J+22]=ne,t}}fe.prototype.bytesPerElement=48,Ve("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",fe);class ve extends u{_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,r,a,l,h,d,f,g,v,x,A,D,M,z,B,q,$,ne,J,ie,ce,ge,Be,it,Me,Ie,He,Ue){let qe=this.length;return this.resize(qe+1),this.emplace(qe,t,r,a,l,h,d,f,g,v,x,A,D,M,z,B,q,$,ne,J,ie,ce,ge,Be,it,Me,Ie,He,Ue)}emplace(t,r,a,l,h,d,f,g,v,x,A,D,M,z,B,q,$,ne,J,ie,ce,ge,Be,it,Me,Ie,He,Ue,qe){let de=32*t,Xe=16*t;return this.int16[de+0]=r,this.int16[de+1]=a,this.int16[de+2]=l,this.int16[de+3]=h,this.int16[de+4]=d,this.int16[de+5]=f,this.int16[de+6]=g,this.int16[de+7]=v,this.uint16[de+8]=x,this.uint16[de+9]=A,this.uint16[de+10]=D,this.uint16[de+11]=M,this.uint16[de+12]=z,this.uint16[de+13]=B,this.uint16[de+14]=q,this.uint16[de+15]=$,this.uint16[de+16]=ne,this.uint16[de+17]=J,this.uint16[de+18]=ie,this.uint16[de+19]=ce,this.uint16[de+20]=ge,this.uint16[de+21]=Be,this.uint16[de+22]=it,this.uint32[Xe+12]=Me,this.float32[Xe+13]=Ie,this.float32[Xe+14]=He,this.uint16[de+30]=Ue,this.uint16[de+31]=qe,t}}ve.prototype.bytesPerElement=64,Ve("StructArrayLayout8i15ui1ul2f2ui64",ve);class ke extends u{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){let r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){return this.float32[1*t+0]=r,t}}ke.prototype.bytesPerElement=4,Ve("StructArrayLayout1f4",ke);class Oe extends u{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,a){let l=this.length;return this.resize(l+1),this.emplace(l,t,r,a)}emplace(t,r,a,l){let h=3*t;return this.uint16[6*t+0]=r,this.float32[h+1]=a,this.float32[h+2]=l,t}}Oe.prototype.bytesPerElement=12,Ve("StructArrayLayout1ui2f12",Oe);class Te extends u{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,a){let l=this.length;return this.resize(l+1),this.emplace(l,t,r,a)}emplace(t,r,a,l){let h=4*t;return this.uint32[2*t+0]=r,this.uint16[h+2]=a,this.uint16[h+3]=l,t}}Te.prototype.bytesPerElement=8,Ve("StructArrayLayout1ul2ui8",Te);class Ee extends u{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r){let a=this.length;return this.resize(a+1),this.emplace(a,t,r)}emplace(t,r,a){let l=2*t;return this.uint16[l+0]=r,this.uint16[l+1]=a,t}}Ee.prototype.bytesPerElement=4,Ve("StructArrayLayout2ui4",Ee);class $e extends u{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){let r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){return this.uint16[1*t+0]=r,t}}$e.prototype.bytesPerElement=2,Ve("StructArrayLayout1ui2",$e);class ct extends u{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,a,l){let h=this.length;return this.resize(h+1),this.emplace(h,t,r,a,l)}emplace(t,r,a,l,h){let d=4*t;return this.float32[d+0]=r,this.float32[d+1]=a,this.float32[d+2]=l,this.float32[d+3]=h,t}}ct.prototype.bytesPerElement=16,Ve("StructArrayLayout4f16",ct);class Se extends o{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new se(this.anchorPointX,this.anchorPointY)}}Se.prototype.size=20;class ze extends W{get(t){return new Se(this,t)}}Ve("CollisionBoxArray",ze);class ot extends o{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]}}ot.prototype.size=48;class ii extends fe{get(t){return new ot(this,t)}}Ve("PlacedSymbolArray",ii);class yt extends o{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]}}yt.prototype.size=64;class Ct extends ve{get(t){return new yt(this,t)}}Ve("SymbolInstanceArray",Ct);class ri extends ke{getoffsetX(t){return this.float32[1*t+0]}}Ve("GlyphOffsetArray",ri);class zi extends b{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}Ve("SymbolLineVertexArray",zi);class Or extends o{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]}}Or.prototype.size=12;class ni extends Oe{get(t){return new Or(this,t)}}Ve("TextAnchorOffsetArray",ni);class er extends o{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]}}er.prototype.size=8;class $i extends Te{get(t){return new er(this,t)}}Ve("FeatureIndexArray",$i);class Bi extends y{}class Zi extends y{}class Wr extends y{}class la extends C{}class Cs extends P{}class ua extends L{}class Ar extends O{}class Ds extends U{}class Uo extends Z{}class Er extends G{}class Tr extends N{}class cn extends te{}class Nr extends ae{}class ki extends Ee{}let Li=m([{name:"a_pos",components:2,type:"Int16"}],4),{members:fr}=Li;class St{constructor(t=[]){this.segments=t}prepareSegment(t,r,a,l){let h=this.segments[this.segments.length-1];return t>St.MAX_VERTEX_ARRAY_LENGTH&&Pe(`Max vertices per segment is ${St.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}`),(!h||h.vertexLength+t>St.MAX_VERTEX_ARRAY_LENGTH||h.sortKey!==l)&&(h={vertexOffset:r.length,primitiveOffset:a.length,vertexLength:0,primitiveLength:0},l!==void 0&&(h.sortKey=l),this.segments.push(h)),h}get(){return this.segments}destroy(){for(let t of this.segments)for(let r in t.vaos)t.vaos[r].destroy()}static simpleSegment(t,r,a,l){return new St([{vertexOffset:t,primitiveOffset:r,vertexLength:a,primitiveLength:l,vaos:{},sortKey:0}])}}function Mn(i,t){return 256*(i=Re(Math.floor(i),0,255))+Re(Math.floor(t),0,255)}St.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Ve("SegmentVector",St);let ca=m([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var ha={exports:{}},Yl={exports:{}};Yl.exports=function(i,t){var r,a,l,h,d,f,g,v;for(a=i.length-(r=3&i.length),l=t,d=3432918353,f=461845907,v=0;v<a;)g=255&i.charCodeAt(v)|(255&i.charCodeAt(++v))<<8|(255&i.charCodeAt(++v))<<16|(255&i.charCodeAt(++v))<<24,++v,l=27492+(65535&(h=5*(65535&(l=(l^=g=(65535&(g=(g=(65535&g)*d+(((g>>>16)*d&65535)<<16)&4294967295)<<15|g>>>17))*f+(((g>>>16)*f&65535)<<16)&4294967295)<<13|l>>>19))+((5*(l>>>16)&65535)<<16)&4294967295))+((58964+(h>>>16)&65535)<<16);switch(g=0,r){case 3:g^=(255&i.charCodeAt(v+2))<<16;case 2:g^=(255&i.charCodeAt(v+1))<<8;case 1:l^=g=(65535&(g=(g=(65535&(g^=255&i.charCodeAt(v)))*d+(((g>>>16)*d&65535)<<16)&4294967295)<<15|g>>>17))*f+(((g>>>16)*f&65535)<<16)&4294967295}return l^=i.length,l=2246822507*(65535&(l^=l>>>16))+((2246822507*(l>>>16)&65535)<<16)&4294967295,l=3266489909*(65535&(l^=l>>>13))+((3266489909*(l>>>16)&65535)<<16)&4294967295,(l^=l>>>16)>>>0};var ac=Yl.exports,Ql={exports:{}};Ql.exports=function(i,t){for(var r,a=i.length,l=t^a,h=0;a>=4;)r=1540483477*(65535&(r=255&i.charCodeAt(h)|(255&i.charCodeAt(++h))<<8|(255&i.charCodeAt(++h))<<16|(255&i.charCodeAt(++h))<<24))+((1540483477*(r>>>16)&65535)<<16),l=1540483477*(65535&l)+((1540483477*(l>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),a-=4,++h;switch(a){case 3:l^=(255&i.charCodeAt(h+2))<<16;case 2:l^=(255&i.charCodeAt(h+1))<<8;case 1:l=1540483477*(65535&(l^=255&i.charCodeAt(h)))+((1540483477*(l>>>16)&65535)<<16)}return l=1540483477*(65535&(l^=l>>>13))+((1540483477*(l>>>16)&65535)<<16),(l^=l>>>15)>>>0};var hn=ac,eu=Ql.exports;ha.exports=hn,ha.exports.murmur3=hn,ha.exports.murmur2=eu;var Ss=ue(ha.exports);class qa{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,r,a,l){this.ids.push(Is(t)),this.positions.push(r,a,l)}getPositions(t){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");let r=Is(t),a=0,l=this.ids.length-1;for(;a<l;){let d=a+l>>1;this.ids[d]>=r?l=d:a=d+1}let h=[];for(;this.ids[a]===r;)h.push({index:this.positions[3*a],start:this.positions[3*a+1],end:this.positions[3*a+2]}),a++;return h}static serialize(t,r){let a=new Float64Array(t.ids),l=new Uint32Array(t.positions);return ks(a,l,0,a.length-1),r&&r.push(a.buffer,l.buffer),{ids:a,positions:l}}static deserialize(t){let r=new qa;return r.ids=t.ids,r.positions=t.positions,r.indexed=!0,r}}function Is(i){let t=+i;return!isNaN(t)&&t<=Number.MAX_SAFE_INTEGER?t:Ss(String(i))}function ks(i,t,r,a){for(;r<a;){let l=i[r+a>>1],h=r-1,d=a+1;for(;;){do h++;while(i[h]<l);do d--;while(i[d]>l);if(h>=d)break;pa(i,h,d),pa(t,3*h,3*d),pa(t,3*h+1,3*d+1),pa(t,3*h+2,3*d+2)}d-r<a-d?(ks(i,t,r,d),r=d+1):(ks(i,t,d+1,a),a=d)}}function pa(i,t,r){let a=i[t];i[t]=i[r],i[r]=a}Ve("FeaturePositionMap",qa);class Va{constructor(t,r){this.gl=t.gl,this.location=r}}class tu extends Va{constructor(t,r){super(t,r),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}}class dh extends Va{constructor(t,r){super(t,r),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 fh extends Va{constructor(t,r){super(t,r),this.current=jt.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))}}let Jd=new Float32Array(16);function sc(i){return[Mn(255*i.r,255*i.g),Mn(255*i.b,255*i.a)]}class jo{constructor(t,r,a){this.value=t,this.uniformNames=r.map(l=>`u_${l}`),this.type=a}setUniform(t,r,a){t.set(a.constantOr(this.value))}getBinding(t,r,a){return this.type==="color"?new fh(t,r):new tu(t,r)}}class Ms{constructor(t,r){this.uniformNames=r.map(a=>`u_${a}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,r){this.pixelRatioFrom=r.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=r.tlbr,this.patternTo=t.tlbr}setUniform(t,r,a,l){let h=l==="u_pattern_to"?this.patternTo:l==="u_pattern_from"?this.patternFrom:l==="u_pixel_ratio_to"?this.pixelRatioTo:l==="u_pixel_ratio_from"?this.pixelRatioFrom:null;h&&t.set(h)}getBinding(t,r,a){return a.substr(0,9)==="u_pattern"?new dh(t,r):new tu(t,r)}}class Pn{constructor(t,r,a,l){this.expression=t,this.type=a,this.maxValue=0,this.paintVertexAttributes=r.map(h=>({name:`a_${h}`,type:"Float32",components:a==="color"?2:1,offset:0})),this.paintVertexArray=new l}populatePaintArray(t,r,a,l,h){let d=this.paintVertexArray.length,f=this.expression.evaluate(new ti(0),r,{},l,[],h);this.paintVertexArray.resize(t),this._setPaintValue(d,t,f)}updatePaintArray(t,r,a,l){let h=this.expression.evaluate({zoom:0},a,l);this._setPaintValue(t,r,h)}_setPaintValue(t,r,a){if(this.type==="color"){let l=sc(a);for(let h=t;h<r;h++)this.paintVertexArray.emplace(h,l[0],l[1])}else{for(let l=t;l<r;l++)this.paintVertexArray.emplace(l,a);this.maxValue=Math.max(this.maxValue,Math.abs(a))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class rn{constructor(t,r,a,l,h,d){this.expression=t,this.uniformNames=r.map(f=>`u_${f}_t`),this.type=a,this.useIntegerZoom=l,this.zoom=h,this.maxValue=0,this.paintVertexAttributes=r.map(f=>({name:`a_${f}`,type:"Float32",components:a==="color"?4:2,offset:0})),this.paintVertexArray=new d}populatePaintArray(t,r,a,l,h){let d=this.expression.evaluate(new ti(this.zoom),r,{},l,[],h),f=this.expression.evaluate(new ti(this.zoom+1),r,{},l,[],h),g=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(g,t,d,f)}updatePaintArray(t,r,a,l){let h=this.expression.evaluate({zoom:this.zoom},a,l),d=this.expression.evaluate({zoom:this.zoom+1},a,l);this._setPaintValue(t,r,h,d)}_setPaintValue(t,r,a,l){if(this.type==="color"){let h=sc(a),d=sc(l);for(let f=t;f<r;f++)this.paintVertexArray.emplace(f,h[0],h[1],d[0],d[1])}else{for(let h=t;h<r;h++)this.paintVertexArray.emplace(h,a,l);this.maxValue=Math.max(this.maxValue,Math.abs(a),Math.abs(l))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(t,r){let a=this.useIntegerZoom?Math.floor(r.zoom):r.zoom,l=Re(this.expression.interpolationFactor(a,this.zoom,this.zoom+1),0,1);t.set(l)}getBinding(t,r,a){return new tu(t,r)}}class da{constructor(t,r,a,l,h,d){this.expression=t,this.type=r,this.useIntegerZoom=a,this.zoom=l,this.layerId=d,this.zoomInPaintVertexArray=new h,this.zoomOutPaintVertexArray=new h}populatePaintArray(t,r,a){let l=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(l,t,r.patterns&&r.patterns[this.layerId],a)}updatePaintArray(t,r,a,l,h){this._setPaintValues(t,r,a.patterns&&a.patterns[this.layerId],h)}_setPaintValues(t,r,a,l){if(!l||!a)return;let{min:h,mid:d,max:f}=a,g=l[h],v=l[d],x=l[f];if(g&&v&&x)for(let A=t;A<r;A++)this.zoomInPaintVertexArray.emplace(A,v.tl[0],v.tl[1],v.br[0],v.br[1],g.tl[0],g.tl[1],g.br[0],g.br[1],v.pixelRatio,g.pixelRatio),this.zoomOutPaintVertexArray.emplace(A,v.tl[0],v.tl[1],v.br[0],v.br[1],x.tl[0],x.tl[1],x.br[0],x.br[1],v.pixelRatio,x.pixelRatio)}upload(t){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,ca.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,ca.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class mh{constructor(t,r,a){this.binders={},this._buffers=[];let l=[];for(let h in t.paint._values){if(!a(h))continue;let d=t.paint.get(h);if(!(d instanceof Xr&&Wn(d.property.specification)))continue;let f=Kd(h,t.type),g=d.value,v=d.property.specification.type,x=d.property.useIntegerZoom,A=d.property.specification["property-type"],D=A==="cross-faded"||A==="cross-faded-data-driven";if(g.kind==="constant")this.binders[h]=D?new Ms(g.value,f):new jo(g.value,f,v),l.push(`/u_${h}`);else if(g.kind==="source"||D){let M=gh(h,v,"source");this.binders[h]=D?new da(g,v,x,r,M,t.id):new Pn(g,f,v,M),l.push(`/a_${h}`)}else{let M=gh(h,v,"composite");this.binders[h]=new rn(g,f,v,x,r,M),l.push(`/z_${h}`)}}this.cacheKey=l.sort().join("")}getMaxValue(t){let r=this.binders[t];return r instanceof Pn||r instanceof rn?r.maxValue:0}populatePaintArrays(t,r,a,l,h){for(let d in this.binders){let f=this.binders[d];(f instanceof Pn||f instanceof rn||f instanceof da)&&f.populatePaintArray(t,r,a,l,h)}}setConstantPatternPositions(t,r){for(let a in this.binders){let l=this.binders[a];l instanceof Ms&&l.setConstantPatternPositions(t,r)}}updatePaintArrays(t,r,a,l,h){let d=!1;for(let f in t){let g=r.getPositions(f);for(let v of g){let x=a.feature(v.index);for(let A in this.binders){let D=this.binders[A];if((D instanceof Pn||D instanceof rn||D instanceof da)&&D.expression.isStateDependent===!0){let M=l.paint.get(A);D.expression=M.value,D.updatePaintArray(v.start,v.end,x,t[f],h),d=!0}}}}return d}defines(){let t=[];for(let r in this.binders){let a=this.binders[r];(a instanceof jo||a instanceof Ms)&&t.push(...a.uniformNames.map(l=>`#define HAS_UNIFORM_${l}`))}return t}getBinderAttributes(){let t=[];for(let r in this.binders){let a=this.binders[r];if(a instanceof Pn||a instanceof rn)for(let l=0;l<a.paintVertexAttributes.length;l++)t.push(a.paintVertexAttributes[l].name);else if(a instanceof da)for(let l=0;l<ca.members.length;l++)t.push(ca.members[l].name)}return t}getBinderUniforms(){let t=[];for(let r in this.binders){let a=this.binders[r];if(a instanceof jo||a instanceof Ms||a instanceof rn)for(let l of a.uniformNames)t.push(l)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,r){let a=[];for(let l in this.binders){let h=this.binders[l];if(h instanceof jo||h instanceof Ms||h instanceof rn){for(let d of h.uniformNames)if(r[d]){let f=h.getBinding(t,r[d],d);a.push({name:d,property:l,binding:f})}}}return a}setUniforms(t,r,a,l){for(let{name:h,property:d,binding:f}of r)this.binders[d].setUniform(f,l,a.get(d),h)}updatePaintBuffers(t){this._buffers=[];for(let r in this.binders){let a=this.binders[r];if(t&&a instanceof da){let l=t.fromScale===2?a.zoomInPaintVertexBuffer:a.zoomOutPaintVertexBuffer;l&&this._buffers.push(l)}else(a instanceof Pn||a instanceof rn)&&a.paintVertexBuffer&&this._buffers.push(a.paintVertexBuffer)}}upload(t){for(let r in this.binders){let a=this.binders[r];(a instanceof Pn||a instanceof rn||a instanceof da)&&a.upload(t)}this.updatePaintBuffers()}destroy(){for(let t in this.binders){let r=this.binders[t];(r instanceof Pn||r instanceof rn||r instanceof da)&&r.destroy()}}}class Ua{constructor(t,r,a=()=>!0){this.programConfigurations={};for(let l of t)this.programConfigurations[l.id]=new mh(l,r,a);this.needsUpload=!1,this._featureMap=new qa,this._bufferOffset=0}populatePaintArrays(t,r,a,l,h,d){for(let f in this.programConfigurations)this.programConfigurations[f].populatePaintArrays(t,r,l,h,d);r.id!==void 0&&this._featureMap.add(r.id,a,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,r,a,l){for(let h of a)this.needsUpload=this.programConfigurations[h.id].updatePaintArrays(t,this._featureMap,r,h,l)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(let r in this.programConfigurations)this.programConfigurations[r].upload(t);this.needsUpload=!1}}destroy(){for(let t in this.programConfigurations)this.programConfigurations[t].destroy()}}function Kd(i,t){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[i]||[i.replace(`${t}-`,"").replace(/-/g,"_")]}function gh(i,t,r){let a={color:{source:L,composite:ct},number:{source:ke,composite:L}},l=function(h){return{"line-pattern":{source:Ar,composite:Ar},"fill-pattern":{source:Ar,composite:Ar},"fill-extrusion-pattern":{source:Ar,composite:Ar}}[h]}(i);return l&&l[r]||a[t][r]}Ve("ConstantBinder",jo),Ve("CrossFadedConstantBinder",Ms),Ve("SourceExpressionBinder",Pn),Ve("CrossFadedCompositeBinder",da),Ve("CompositeExpressionBinder",rn),Ve("ProgramConfiguration",mh,{omit:["_buffers"]}),Ve("ProgramConfigurationSet",Ua);let xi=8192,oc=Math.pow(2,14)-1,_h=-oc-1;function ja(i){let t=xi/i.extent,r=i.loadGeometry();for(let a=0;a<r.length;a++){let l=r[a];for(let h=0;h<l.length;h++){let d=l[h],f=Math.round(d.x*t),g=Math.round(d.y*t);d.x=Re(f,_h,oc),d.y=Re(g,_h,oc),(f<d.x||f>d.x+1||g<d.y||g>d.y+1)&&Pe("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function $a(i,t){return{type:i.type,id:i.id,properties:i.properties,geometry:t?ja(i):[]}}function iu(i,t,r,a,l){i.emplaceBack(2*t+(a+1)/2,2*r+(l+1)/2)}class lc{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Zi,this.indexArray=new Nr,this.segments=new St,this.programConfigurations=new Ua(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,a){let l=this.layers[0],h=[],d=null,f=!1;l.type==="circle"&&(d=l.layout.get("circle-sort-key"),f=!d.isConstant());for(let{feature:g,id:v,index:x,sourceLayerIndex:A}of t){let D=this.layers[0]._featureFilter.needGeometry,M=$a(g,D);if(!this.layers[0]._featureFilter.filter(new ti(this.zoom),M,a))continue;let z=f?d.evaluate(M,{},a):void 0,B={id:v,properties:g.properties,type:g.type,sourceLayerIndex:A,index:x,geometry:D?M.geometry:ja(g),patterns:{},sortKey:z};h.push(B)}f&&h.sort((g,v)=>g.sortKey-v.sortKey);for(let g of h){let{geometry:v,index:x,sourceLayerIndex:A}=g,D=t[x].feature;this.addFeature(g,v,x,a),r.featureIndex.insert(D,v,x,A,this.index)}}update(t,r,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,a)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,fr),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,r,a,l){for(let h of r)for(let d of h){let f=d.x,g=d.y;if(f<0||f>=xi||g<0||g>=xi)continue;let v=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),x=v.vertexLength;iu(this.layoutVertexArray,f,g,-1,-1),iu(this.layoutVertexArray,f,g,1,-1),iu(this.layoutVertexArray,f,g,1,1),iu(this.layoutVertexArray,f,g,-1,1),this.indexArray.emplaceBack(x,x+1,x+2),this.indexArray.emplaceBack(x,x+3,x+2),v.vertexLength+=4,v.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,a,{},l)}}function yh(i,t){for(let r=0;r<i.length;r++)if(Ps(t,i[r]))return!0;for(let r=0;r<t.length;r++)if(Ps(i,t[r]))return!0;return!!uc(i,t)}function Yd(i,t,r){return!!Ps(i,t)||!!cc(t,i,r)}function vh(i,t){if(i.length===1)return bh(t,i[0]);for(let r=0;r<t.length;r++){let a=t[r];for(let l=0;l<a.length;l++)if(Ps(i,a[l]))return!0}for(let r=0;r<i.length;r++)if(bh(t,i[r]))return!0;for(let r=0;r<t.length;r++)if(uc(i,t[r]))return!0;return!1}function Qd(i,t,r){if(i.length>1){if(uc(i,t))return!0;for(let a=0;a<t.length;a++)if(cc(t[a],i,r))return!0}for(let a=0;a<i.length;a++)if(cc(i[a],t,r))return!0;return!1}function uc(i,t){if(i.length===0||t.length===0)return!1;for(let r=0;r<i.length-1;r++){let a=i[r],l=i[r+1];for(let h=0;h<t.length-1;h++)if(ef(a,l,t[h],t[h+1]))return!0}return!1}function ef(i,t,r,a){return tt(i,r,a)!==tt(t,r,a)&&tt(i,t,r)!==tt(i,t,a)}function cc(i,t,r){let a=r*r;if(t.length===1)return i.distSqr(t[0])<a;for(let l=1;l<t.length;l++)if(xh(i,t[l-1],t[l])<a)return!0;return!1}function xh(i,t,r){let a=t.distSqr(r);if(a===0)return i.distSqr(t);let l=((i.x-t.x)*(r.x-t.x)+(i.y-t.y)*(r.y-t.y))/a;return i.distSqr(l<0?t:l>1?r:r.sub(t)._mult(l)._add(t))}function bh(i,t){let r,a,l,h=!1;for(let d=0;d<i.length;d++){r=i[d];for(let f=0,g=r.length-1;f<r.length;g=f++)a=r[f],l=r[g],a.y>t.y!=l.y>t.y&&t.x<(l.x-a.x)*(t.y-a.y)/(l.y-a.y)+a.x&&(h=!h)}return h}function Ps(i,t){let r=!1;for(let a=0,l=i.length-1;a<i.length;l=a++){let h=i[a],d=i[l];h.y>t.y!=d.y>t.y&&t.x<(d.x-h.x)*(t.y-h.y)/(d.y-h.y)+h.x&&(r=!r)}return r}function tf(i,t,r){let a=r[0],l=r[2];if(i.x<a.x&&t.x<a.x||i.x>l.x&&t.x>l.x||i.y<a.y&&t.y<a.y||i.y>l.y&&t.y>l.y)return!1;let h=tt(i,t,r[0]);return h!==tt(i,t,r[1])||h!==tt(i,t,r[2])||h!==tt(i,t,r[3])}function $o(i,t,r){let a=t.paint.get(i).value;return a.kind==="constant"?a.value:r.programConfigurations.get(t.id).getMaxValue(i)}function ru(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function nu(i,t,r,a,l){if(!t[0]&&!t[1])return i;let h=se.convert(t)._mult(l);r==="viewport"&&h._rotate(-a);let d=[];for(let f=0;f<i.length;f++)d.push(i[f].sub(h));return d}let wh,Ah;Ve("CircleBucket",lc,{omit:["layers"]});var rf={get paint(){return Ah=Ah||new c({"circle-radius":new rt(oe.paint_circle["circle-radius"]),"circle-color":new rt(oe.paint_circle["circle-color"]),"circle-blur":new rt(oe.paint_circle["circle-blur"]),"circle-opacity":new rt(oe.paint_circle["circle-opacity"]),"circle-translate":new je(oe.paint_circle["circle-translate"]),"circle-translate-anchor":new je(oe.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new je(oe.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new je(oe.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new rt(oe.paint_circle["circle-stroke-width"]),"circle-stroke-color":new rt(oe.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new rt(oe.paint_circle["circle-stroke-opacity"])})},get layout(){return wh=wh||new c({"circle-sort-key":new rt(oe.layout_circle["circle-sort-key"])})}},tr=1e-6,zs=typeof Float32Array<"u"?Float32Array:Array;function hc(i){return i[0]=1,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=1,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=1,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i}function Eh(i,t,r){var a=t[0],l=t[1],h=t[2],d=t[3],f=t[4],g=t[5],v=t[6],x=t[7],A=t[8],D=t[9],M=t[10],z=t[11],B=t[12],q=t[13],$=t[14],ne=t[15],J=r[0],ie=r[1],ce=r[2],ge=r[3];return i[0]=J*a+ie*f+ce*A+ge*B,i[1]=J*l+ie*g+ce*D+ge*q,i[2]=J*h+ie*v+ce*M+ge*$,i[3]=J*d+ie*x+ce*z+ge*ne,i[4]=(J=r[4])*a+(ie=r[5])*f+(ce=r[6])*A+(ge=r[7])*B,i[5]=J*l+ie*g+ce*D+ge*q,i[6]=J*h+ie*v+ce*M+ge*$,i[7]=J*d+ie*x+ce*z+ge*ne,i[8]=(J=r[8])*a+(ie=r[9])*f+(ce=r[10])*A+(ge=r[11])*B,i[9]=J*l+ie*g+ce*D+ge*q,i[10]=J*h+ie*v+ce*M+ge*$,i[11]=J*d+ie*x+ce*z+ge*ne,i[12]=(J=r[12])*a+(ie=r[13])*f+(ce=r[14])*A+(ge=r[15])*B,i[13]=J*l+ie*g+ce*D+ge*q,i[14]=J*h+ie*v+ce*M+ge*$,i[15]=J*d+ie*x+ce*z+ge*ne,i}Math.hypot||(Math.hypot=function(){for(var i=0,t=arguments.length;t--;)i+=arguments[t]*arguments[t];return Math.sqrt(i)});var Zo,nf=Eh;function au(i,t,r){var a=t[0],l=t[1],h=t[2],d=t[3];return i[0]=r[0]*a+r[4]*l+r[8]*h+r[12]*d,i[1]=r[1]*a+r[5]*l+r[9]*h+r[13]*d,i[2]=r[2]*a+r[6]*l+r[10]*h+r[14]*d,i[3]=r[3]*a+r[7]*l+r[11]*h+r[15]*d,i}Zo=new zs(4),zs!=Float32Array&&(Zo[0]=0,Zo[1]=0,Zo[2]=0,Zo[3]=0);class af extends n{constructor(t){super(t,rf)}createBucket(t){return new lc(t)}queryRadius(t){let r=t;return $o("circle-radius",this,r)+$o("circle-stroke-width",this,r)+ru(this.paint.get("circle-translate"))}queryIntersectsFeature(t,r,a,l,h,d,f,g){let v=nu(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),d.angle,f),x=this.paint.get("circle-radius").evaluate(r,a)+this.paint.get("circle-stroke-width").evaluate(r,a),A=this.paint.get("circle-pitch-alignment")==="map",D=A?v:function(z,B){return z.map(q=>Th(q,B))}(v,g),M=A?x*f:x;for(let z of l)for(let B of z){let q=A?B:Th(B,g),$=M,ne=au([],[B.x,B.y,0,1],g);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?$*=ne[3]/d.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&($*=d.cameraToCenterDistance/ne[3]),Yd(D,q,$))return!0}return!1}}function Th(i,t){let r=au([],[i.x,i.y,0,1],t);return new se(r[0]/r[3],r[1]/r[3])}class Ch extends lc{}let Dh;Ve("HeatmapBucket",Ch,{omit:["layers"]});var sf={get paint(){return Dh=Dh||new c({"heatmap-radius":new rt(oe.paint_heatmap["heatmap-radius"]),"heatmap-weight":new rt(oe.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new je(oe.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Vo(oe.paint_heatmap["heatmap-color"]),"heatmap-opacity":new je(oe.paint_heatmap["heatmap-opacity"])})}};function pc(i,{width:t,height:r},a,l){if(l){if(l instanceof Uint8ClampedArray)l=new Uint8Array(l.buffer);else if(l.length!==t*r*a)throw new RangeError(`mismatched image size. expected: ${l.length} but got: ${t*r*a}`)}else l=new Uint8Array(t*r*a);return i.width=t,i.height=r,i.data=l,i}function Sh(i,{width:t,height:r},a){if(t===i.width&&r===i.height)return;let l=pc({},{width:t,height:r},a);dc(i,l,{x:0,y:0},{x:0,y:0},{width:Math.min(i.width,t),height:Math.min(i.height,r)},a),i.width=t,i.height=r,i.data=l.data}function dc(i,t,r,a,l,h){if(l.width===0||l.height===0)return t;if(l.width>i.width||l.height>i.height||r.x>i.width-l.width||r.y>i.height-l.height)throw new RangeError("out of range source coordinates for image copy");if(l.width>t.width||l.height>t.height||a.x>t.width-l.width||a.y>t.height-l.height)throw new RangeError("out of range destination coordinates for image copy");let d=i.data,f=t.data;if(d===f)throw new Error("srcData equals dstData, so image is already copied");for(let g=0;g<l.height;g++){let v=((r.y+g)*i.width+r.x)*h,x=((a.y+g)*t.width+a.x)*h;for(let A=0;A<l.width*h;A++)f[x+A]=d[v+A]}return t}class Go{constructor(t,r){pc(this,t,1,r)}resize(t){Sh(this,t,1)}clone(){return new Go({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,r,a,l,h){dc(t,r,a,l,h,1)}}class qr{constructor(t,r){pc(this,t,4,r)}resize(t){Sh(this,t,4)}replace(t,r){r?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new qr({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,r,a,l,h){dc(t,r,a,l,h,4)}}function Ih(i){let t={},r=i.resolution||256,a=i.clips?i.clips.length:1,l=i.image||new qr({width:r,height:a});if(Math.log(r)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${r}`);let h=(d,f,g)=>{t[i.evaluationKey]=g;let v=i.expression.evaluate(t);l.data[d+f+0]=Math.floor(255*v.r/v.a),l.data[d+f+1]=Math.floor(255*v.g/v.a),l.data[d+f+2]=Math.floor(255*v.b/v.a),l.data[d+f+3]=Math.floor(255*v.a)};if(i.clips)for(let d=0,f=0;d<a;++d,f+=4*r)for(let g=0,v=0;g<r;g++,v+=4){let x=g/(r-1),{start:A,end:D}=i.clips[d];h(f,v,A*(1-x)+D*x)}else for(let d=0,f=0;d<r;d++,f+=4)h(0,f,d/(r-1));return l}Ve("AlphaImage",Go),Ve("RGBAImage",qr);let fc="big-fb";class of extends n{createBucket(t){return new Ch(t)}constructor(t){super(t,sf),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){t==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Ih({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(fc)&&this.heatmapFbos.delete(fc)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}}let kh;var lf={get paint(){return kh=kh||new c({"hillshade-illumination-direction":new je(oe.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new je(oe.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new je(oe.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new je(oe.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new je(oe.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new je(oe.paint_hillshade["hillshade-accent-color"])})}};class uf extends n{constructor(t){super(t,lf)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}}let cf=m([{name:"a_pos",components:2,type:"Int16"}],4),{members:hf}=cf;function Mh(i,t,r=2){let a=t&&t.length,l=a?t[0]*r:i.length,h=Ph(i,0,l,r,!0),d=[];if(!h||h.next===h.prev)return d;let f,g,v;if(a&&(h=function(x,A,D,M){let z=[];for(let B=0,q=A.length;B<q;B++){let $=Ph(x,A[B]*M,B<q-1?A[B+1]*M:x.length,M,!1);$===$.next&&($.steiner=!0),z.push(vf($))}z.sort(gf);for(let B=0;B<z.length;B++)D=_f(z[B],D);return D}(i,t,h,r)),i.length>80*r){f=1/0,g=1/0;let x=-1/0,A=-1/0;for(let D=r;D<l;D+=r){let M=i[D],z=i[D+1];M<f&&(f=M),z<g&&(g=z),M>x&&(x=M),z>A&&(A=z)}v=Math.max(x-f,A-g),v=v!==0?32767/v:0}return Ho(h,d,r,f,g,v,0),d}function Ph(i,t,r,a,l){let h;if(l===function(d,f,g,v){let x=0;for(let A=f,D=g-v;A<g;A+=v)x+=(d[D]-d[A])*(d[A+1]+d[D+1]),D=A;return x}(i,t,r,a)>0)for(let d=t;d<r;d+=a)h=Lh(d/a|0,i[d],i[d+1],h);else for(let d=r-a;d>=t;d-=a)h=Lh(d/a|0,i[d],i[d+1],h);return h&&su(h,h.next)&&(Wo(h),h=h.next),h}function Za(i,t){if(!i)return i;t||(t=i);let r,a=i;do if(r=!1,a.steiner||!su(a,a.next)&&_i(a.prev,a,a.next)!==0)a=a.next;else{if(Wo(a),a=t=a.prev,a===a.next)break;r=!0}while(r||a!==t);return t}function Ho(i,t,r,a,l,h,d){if(!i)return;!d&&h&&function(g,v,x,A){let D=g;do D.z===0&&(D.z=mc(D.x,D.y,v,x,A)),D.prevZ=D.prev,D.nextZ=D.next,D=D.next;while(D!==g);D.prevZ.nextZ=null,D.prevZ=null,function(M){let z,B=1;do{let q,$=M;M=null;let ne=null;for(z=0;$;){z++;let J=$,ie=0;for(let ge=0;ge<B&&(ie++,J=J.nextZ,J);ge++);let ce=B;for(;ie>0||ce>0&&J;)ie!==0&&(ce===0||!J||$.z<=J.z)?(q=$,$=$.nextZ,ie--):(q=J,J=J.nextZ,ce--),ne?ne.nextZ=q:M=q,q.prevZ=ne,ne=q;$=J}ne.nextZ=null,B*=2}while(z>1)}(D)}(i,a,l,h);let f=i;for(;i.prev!==i.next;){let g=i.prev,v=i.next;if(h?df(i,a,l,h):pf(i))t.push(g.i,i.i,v.i),Wo(i),i=v.next,f=v.next;else if((i=v)===f){d?d===1?Ho(i=ff(Za(i),t),t,r,a,l,h,2):d===2&&mf(i,t,r,a,l,h):Ho(Za(i),t,r,a,l,h,1);break}}}function pf(i){let t=i.prev,r=i,a=i.next;if(_i(t,r,a)>=0)return!1;let l=t.x,h=r.x,d=a.x,f=t.y,g=r.y,v=a.y,x=l<h?l<d?l:d:h<d?h:d,A=f<g?f<v?f:v:g<v?g:v,D=l>h?l>d?l:d:h>d?h:d,M=f>g?f>v?f:v:g>v?g:v,z=a.next;for(;z!==t;){if(z.x>=x&&z.x<=D&&z.y>=A&&z.y<=M&&Bs(l,f,h,g,d,v,z.x,z.y)&&_i(z.prev,z,z.next)>=0)return!1;z=z.next}return!0}function df(i,t,r,a){let l=i.prev,h=i,d=i.next;if(_i(l,h,d)>=0)return!1;let f=l.x,g=h.x,v=d.x,x=l.y,A=h.y,D=d.y,M=f<g?f<v?f:v:g<v?g:v,z=x<A?x<D?x:D:A<D?A:D,B=f>g?f>v?f:v:g>v?g:v,q=x>A?x>D?x:D:A>D?A:D,$=mc(M,z,t,r,a),ne=mc(B,q,t,r,a),J=i.prevZ,ie=i.nextZ;for(;J&&J.z>=$&&ie&&ie.z<=ne;){if(J.x>=M&&J.x<=B&&J.y>=z&&J.y<=q&&J!==l&&J!==d&&Bs(f,x,g,A,v,D,J.x,J.y)&&_i(J.prev,J,J.next)>=0||(J=J.prevZ,ie.x>=M&&ie.x<=B&&ie.y>=z&&ie.y<=q&&ie!==l&&ie!==d&&Bs(f,x,g,A,v,D,ie.x,ie.y)&&_i(ie.prev,ie,ie.next)>=0))return!1;ie=ie.nextZ}for(;J&&J.z>=$;){if(J.x>=M&&J.x<=B&&J.y>=z&&J.y<=q&&J!==l&&J!==d&&Bs(f,x,g,A,v,D,J.x,J.y)&&_i(J.prev,J,J.next)>=0)return!1;J=J.prevZ}for(;ie&&ie.z<=ne;){if(ie.x>=M&&ie.x<=B&&ie.y>=z&&ie.y<=q&&ie!==l&&ie!==d&&Bs(f,x,g,A,v,D,ie.x,ie.y)&&_i(ie.prev,ie,ie.next)>=0)return!1;ie=ie.nextZ}return!0}function ff(i,t){let r=i;do{let a=r.prev,l=r.next.next;!su(a,l)&&zh(a,r,r.next,l)&&Xo(a,l)&&Xo(l,a)&&(t.push(a.i,r.i,l.i),Wo(r),Wo(r.next),r=i=l),r=r.next}while(r!==i);return Za(r)}function mf(i,t,r,a,l,h){let d=i;do{let f=d.next.next;for(;f!==d.prev;){if(d.i!==f.i&&xf(d,f)){let g=Bh(d,f);return d=Za(d,d.next),g=Za(g,g.next),Ho(d,t,r,a,l,h,0),void Ho(g,t,r,a,l,h,0)}f=f.next}d=d.next}while(d!==i)}function gf(i,t){return i.x-t.x}function _f(i,t){let r=function(l,h){let d=h,f=l.x,g=l.y,v,x=-1/0;do{if(g<=d.y&&g>=d.next.y&&d.next.y!==d.y){let B=d.x+(g-d.y)*(d.next.x-d.x)/(d.next.y-d.y);if(B<=f&&B>x&&(x=B,v=d.x<d.next.x?d:d.next,B===f))return v}d=d.next}while(d!==h);if(!v)return null;let A=v,D=v.x,M=v.y,z=1/0;d=v;do{if(f>=d.x&&d.x>=D&&f!==d.x&&Bs(g<M?f:x,g,D,M,g<M?x:f,g,d.x,d.y)){let B=Math.abs(g-d.y)/(f-d.x);Xo(d,l)&&(B<z||B===z&&(d.x>v.x||d.x===v.x&&yf(v,d)))&&(v=d,z=B)}d=d.next}while(d!==A);return v}(i,t);if(!r)return t;let a=Bh(r,i);return Za(a,a.next),Za(r,r.next)}function yf(i,t){return _i(i.prev,i,t.prev)<0&&_i(t.next,i,i.next)<0}function mc(i,t,r,a,l){return(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=(i-r)*l|0)|i<<8))|i<<4))|i<<2))|i<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-a)*l|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function vf(i){let t=i,r=i;do(t.x<r.x||t.x===r.x&&t.y<r.y)&&(r=t),t=t.next;while(t!==i);return r}function Bs(i,t,r,a,l,h,d,f){return(l-d)*(t-f)>=(i-d)*(h-f)&&(i-d)*(a-f)>=(r-d)*(t-f)&&(r-d)*(h-f)>=(l-d)*(a-f)}function xf(i,t){return i.next.i!==t.i&&i.prev.i!==t.i&&!function(r,a){let l=r;do{if(l.i!==r.i&&l.next.i!==r.i&&l.i!==a.i&&l.next.i!==a.i&&zh(l,l.next,r,a))return!0;l=l.next}while(l!==r);return!1}(i,t)&&(Xo(i,t)&&Xo(t,i)&&function(r,a){let l=r,h=!1,d=(r.x+a.x)/2,f=(r.y+a.y)/2;do l.y>f!=l.next.y>f&&l.next.y!==l.y&&d<(l.next.x-l.x)*(f-l.y)/(l.next.y-l.y)+l.x&&(h=!h),l=l.next;while(l!==r);return h}(i,t)&&(_i(i.prev,i,t.prev)||_i(i,t.prev,t))||su(i,t)&&_i(i.prev,i,i.next)>0&&_i(t.prev,t,t.next)>0)}function _i(i,t,r){return(t.y-i.y)*(r.x-t.x)-(t.x-i.x)*(r.y-t.y)}function su(i,t){return i.x===t.x&&i.y===t.y}function zh(i,t,r,a){let l=lu(_i(i,t,r)),h=lu(_i(i,t,a)),d=lu(_i(r,a,i)),f=lu(_i(r,a,t));return l!==h&&d!==f||!(l!==0||!ou(i,r,t))||!(h!==0||!ou(i,a,t))||!(d!==0||!ou(r,i,a))||!(f!==0||!ou(r,t,a))}function ou(i,t,r){return t.x<=Math.max(i.x,r.x)&&t.x>=Math.min(i.x,r.x)&&t.y<=Math.max(i.y,r.y)&&t.y>=Math.min(i.y,r.y)}function lu(i){return i>0?1:i<0?-1:0}function Xo(i,t){return _i(i.prev,i,i.next)<0?_i(i,t,i.next)>=0&&_i(i,i.prev,t)>=0:_i(i,t,i.prev)<0||_i(i,i.next,t)<0}function Bh(i,t){let r=gc(i.i,i.x,i.y),a=gc(t.i,t.x,t.y),l=i.next,h=t.prev;return i.next=t,t.prev=i,r.next=l,l.prev=r,a.next=r,r.prev=a,h.next=a,a.prev=h,a}function Lh(i,t,r,a){let l=gc(i,t,r);return a?(l.next=a.next,l.prev=a,a.next.prev=l,a.next=l):(l.prev=l,l.next=l),l}function Wo(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function gc(i,t,r){return{i,x:t,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function _c(i,t,r){let a=r.patternDependencies,l=!1;for(let h of t){let d=h.paint.get(`${i}-pattern`);d.isConstant()||(l=!0);let f=d.constantOr(null);f&&(l=!0,a[f.to]=!0,a[f.from]=!0)}return l}function yc(i,t,r,a,l){let h=l.patternDependencies;for(let d of t){let f=d.paint.get(`${i}-pattern`).value;if(f.kind!=="constant"){let g=f.evaluate({zoom:a-1},r,{},l.availableImages),v=f.evaluate({zoom:a},r,{},l.availableImages),x=f.evaluate({zoom:a+1},r,{},l.availableImages);g=g&&g.name?g.name:g,v=v&&v.name?v.name:v,x=x&&x.name?x.name:x,h[g]=!0,h[v]=!0,h[x]=!0,r.patterns[d.id]={min:g,mid:v,max:x}}}return r}class vc{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Wr,this.indexArray=new Nr,this.indexArray2=new ki,this.programConfigurations=new Ua(t.layers,t.zoom),this.segments=new St,this.segments2=new St,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,a){this.hasPattern=_c("fill",this.layers,r);let l=this.layers[0].layout.get("fill-sort-key"),h=!l.isConstant(),d=[];for(let{feature:f,id:g,index:v,sourceLayerIndex:x}of t){let A=this.layers[0]._featureFilter.needGeometry,D=$a(f,A);if(!this.layers[0]._featureFilter.filter(new ti(this.zoom),D,a))continue;let M=h?l.evaluate(D,{},a,r.availableImages):void 0,z={id:g,properties:f.properties,type:f.type,sourceLayerIndex:x,index:v,geometry:A?D.geometry:ja(f),patterns:{},sortKey:M};d.push(z)}h&&d.sort((f,g)=>f.sortKey-g.sortKey);for(let f of d){let{geometry:g,index:v,sourceLayerIndex:x}=f;if(this.hasPattern){let A=yc("fill",this.layers,f,this.zoom,r);this.patternFeatures.push(A)}else this.addFeature(f,g,v,a,{});r.featureIndex.insert(t[v].feature,g,v,x,this.index)}}update(t,r,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,a)}addFeatures(t,r,a){for(let l of this.patternFeatures)this.addFeature(l,l.geometry,l.index,r,a)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,hf),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,r,a,l,h){for(let d of ns(r,500)){let f=0;for(let M of d)f+=M.length;let g=this.segments.prepareSegment(f,this.layoutVertexArray,this.indexArray),v=g.vertexLength,x=[],A=[];for(let M of d){if(M.length===0)continue;M!==d[0]&&A.push(x.length/2);let z=this.segments2.prepareSegment(M.length,this.layoutVertexArray,this.indexArray2),B=z.vertexLength;this.layoutVertexArray.emplaceBack(M[0].x,M[0].y),this.indexArray2.emplaceBack(B+M.length-1,B),x.push(M[0].x),x.push(M[0].y);for(let q=1;q<M.length;q++)this.layoutVertexArray.emplaceBack(M[q].x,M[q].y),this.indexArray2.emplaceBack(B+q-1,B+q),x.push(M[q].x),x.push(M[q].y);z.vertexLength+=M.length,z.primitiveLength+=M.length}let D=Mh(x,A);for(let M=0;M<D.length;M+=3)this.indexArray.emplaceBack(v+D[M],v+D[M+1],v+D[M+2]);g.vertexLength+=f,g.primitiveLength+=D.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,a,h,l)}}let Rh,Fh;Ve("FillBucket",vc,{omit:["layers","patternFeatures"]});var bf={get paint(){return Fh=Fh||new c({"fill-antialias":new je(oe.paint_fill["fill-antialias"]),"fill-opacity":new rt(oe.paint_fill["fill-opacity"]),"fill-color":new rt(oe.paint_fill["fill-color"]),"fill-outline-color":new rt(oe.paint_fill["fill-outline-color"]),"fill-translate":new je(oe.paint_fill["fill-translate"]),"fill-translate-anchor":new je(oe.paint_fill["fill-translate-anchor"]),"fill-pattern":new Es(oe.paint_fill["fill-pattern"])})},get layout(){return Rh=Rh||new c({"fill-sort-key":new rt(oe.layout_fill["fill-sort-key"])})}};class wf extends n{constructor(t){super(t,bf)}recalculate(t,r){super.recalculate(t,r);let a=this.paint._values["fill-outline-color"];a.value.kind==="constant"&&a.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(t){return new vc(t)}queryRadius(){return ru(this.paint.get("fill-translate"))}queryIntersectsFeature(t,r,a,l,h,d,f){return vh(nu(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),d.angle,f),l)}isTileClipped(){return!0}}let Af=m([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Ef=m([{name:"a_centroid",components:2,type:"Int16"}],4),{members:Tf}=Af;var fa={},Cf=pe,Oh=Ls;function Ls(i,t,r,a,l){this.properties={},this.extent=r,this.type=0,this._pbf=i,this._geometry=-1,this._keys=a,this._values=l,i.readFields(Df,this,t)}function Df(i,t,r){i==1?t.id=r.readVarint():i==2?function(a,l){for(var h=a.readVarint()+a.pos;a.pos<h;){var d=l._keys[a.readVarint()],f=l._values[a.readVarint()];l.properties[d]=f}}(r,t):i==3?t.type=r.readVarint():i==4&&(t._geometry=r.pos)}function Sf(i){for(var t,r,a=0,l=0,h=i.length,d=h-1;l<h;d=l++)a+=((r=i[d]).x-(t=i[l]).x)*(t.y+r.y);return a}Ls.types=["Unknown","Point","LineString","Polygon"],Ls.prototype.loadGeometry=function(){var i=this._pbf;i.pos=this._geometry;for(var t,r=i.readVarint()+i.pos,a=1,l=0,h=0,d=0,f=[];i.pos<r;){if(l<=0){var g=i.readVarint();a=7&g,l=g>>3}if(l--,a===1||a===2)h+=i.readSVarint(),d+=i.readSVarint(),a===1&&(t&&f.push(t),t=[]),t.push(new Cf(h,d));else{if(a!==7)throw new Error("unknown command "+a);t&&t.push(t[0].clone())}}return t&&f.push(t),f},Ls.prototype.bbox=function(){var i=this._pbf;i.pos=this._geometry;for(var t=i.readVarint()+i.pos,r=1,a=0,l=0,h=0,d=1/0,f=-1/0,g=1/0,v=-1/0;i.pos<t;){if(a<=0){var x=i.readVarint();r=7&x,a=x>>3}if(a--,r===1||r===2)(l+=i.readSVarint())<d&&(d=l),l>f&&(f=l),(h+=i.readSVarint())<g&&(g=h),h>v&&(v=h);else if(r!==7)throw new Error("unknown command "+r)}return[d,g,f,v]},Ls.prototype.toGeoJSON=function(i,t,r){var a,l,h=this.extent*Math.pow(2,r),d=this.extent*i,f=this.extent*t,g=this.loadGeometry(),v=Ls.types[this.type];function x(M){for(var z=0;z<M.length;z++){var B=M[z];M[z]=[360*(B.x+d)/h-180,360/Math.PI*Math.atan(Math.exp((180-360*(B.y+f)/h)*Math.PI/180))-90]}}switch(this.type){case 1:var A=[];for(a=0;a<g.length;a++)A[a]=g[a][0];x(g=A);break;case 2:for(a=0;a<g.length;a++)x(g[a]);break;case 3:for(g=function(M){var z=M.length;if(z<=1)return[M];for(var B,q,$=[],ne=0;ne<z;ne++){var J=Sf(M[ne]);J!==0&&(q===void 0&&(q=J<0),q===J<0?(B&&$.push(B),B=[M[ne]]):B.push(M[ne]))}return B&&$.push(B),$}(g),a=0;a<g.length;a++)for(l=0;l<g[a].length;l++)x(g[a][l])}g.length===1?g=g[0]:v="Multi"+v;var D={type:"Feature",geometry:{type:v,coordinates:g},properties:this.properties};return"id"in this&&(D.id=this.id),D};var If=Oh,Nh=qh;function qh(i,t){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=i,this._keys=[],this._values=[],this._features=[],i.readFields(kf,this,t),this.length=this._features.length}function kf(i,t,r){i===15?t.version=r.readVarint():i===1?t.name=r.readString():i===5?t.extent=r.readVarint():i===2?t._features.push(r.pos):i===3?t._keys.push(r.readString()):i===4&&t._values.push(function(a){for(var l=null,h=a.readVarint()+a.pos;a.pos<h;){var d=a.readVarint()>>3;l=d===1?a.readString():d===2?a.readFloat():d===3?a.readDouble():d===4?a.readVarint64():d===5?a.readVarint():d===6?a.readSVarint():d===7?a.readBoolean():null}return l}(r))}qh.prototype.feature=function(i){if(i<0||i>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[i];var t=this._pbf.readVarint()+this._pbf.pos;return new If(this._pbf,t,this.extent,this._keys,this._values)};var Mf=Nh;function Pf(i,t,r){if(i===3){var a=new Mf(r,r.readVarint()+r.pos);a.length&&(t[a.name]=a)}}fa.VectorTile=function(i,t){this.layers=i.readFields(Pf,{},t)},fa.VectorTileFeature=Oh,fa.VectorTileLayer=Nh;let zf=fa.VectorTileFeature.types,xc=Math.pow(2,13);function Jo(i,t,r,a,l,h,d,f){i.emplaceBack(t,r,2*Math.floor(a*xc)+d,l*xc*2,h*xc*2,Math.round(f))}class bc{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new la,this.centroidVertexArray=new Bi,this.indexArray=new Nr,this.programConfigurations=new Ua(t.layers,t.zoom),this.segments=new St,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,a){this.features=[],this.hasPattern=_c("fill-extrusion",this.layers,r);for(let{feature:l,id:h,index:d,sourceLayerIndex:f}of t){let g=this.layers[0]._featureFilter.needGeometry,v=$a(l,g);if(!this.layers[0]._featureFilter.filter(new ti(this.zoom),v,a))continue;let x={id:h,sourceLayerIndex:f,index:d,geometry:g?v.geometry:ja(l),properties:l.properties,type:l.type,patterns:{}};this.hasPattern?this.features.push(yc("fill-extrusion",this.layers,x,this.zoom,r)):this.addFeature(x,x.geometry,d,a,{}),r.featureIndex.insert(l,x.geometry,d,f,this.index,!0)}}addFeatures(t,r,a){for(let l of this.features){let{geometry:h}=l;this.addFeature(l,h,l.index,r,a)}}update(t,r,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,a)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Tf),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,Ef.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,r,a,l,h){for(let d of ns(r,500)){let f={x:0,y:0,vertexCount:0},g=0;for(let z of d)g+=z.length;let v=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(let z of d){if(z.length===0||Lf(z))continue;let B=0;for(let q=0;q<z.length;q++){let $=z[q];if(q>=1){let ne=z[q-1];if(!Bf($,ne)){v.vertexLength+4>St.MAX_VERTEX_ARRAY_LENGTH&&(v=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let J=$.sub(ne)._perp()._unit(),ie=ne.dist($);B+ie>32768&&(B=0),Jo(this.layoutVertexArray,$.x,$.y,J.x,J.y,0,0,B),Jo(this.layoutVertexArray,$.x,$.y,J.x,J.y,0,1,B),f.x+=2*$.x,f.y+=2*$.y,f.vertexCount+=2,B+=ie,Jo(this.layoutVertexArray,ne.x,ne.y,J.x,J.y,0,0,B),Jo(this.layoutVertexArray,ne.x,ne.y,J.x,J.y,0,1,B),f.x+=2*ne.x,f.y+=2*ne.y,f.vertexCount+=2;let ce=v.vertexLength;this.indexArray.emplaceBack(ce,ce+2,ce+1),this.indexArray.emplaceBack(ce+1,ce+2,ce+3),v.vertexLength+=4,v.primitiveLength+=2}}}}if(v.vertexLength+g>St.MAX_VERTEX_ARRAY_LENGTH&&(v=this.segments.prepareSegment(g,this.layoutVertexArray,this.indexArray)),zf[t.type]!=="Polygon")continue;let x=[],A=[],D=v.vertexLength;for(let z of d)if(z.length!==0){z!==d[0]&&A.push(x.length/2);for(let B=0;B<z.length;B++){let q=z[B];Jo(this.layoutVertexArray,q.x,q.y,0,0,1,1,0),f.x+=q.x,f.y+=q.y,f.vertexCount+=1,x.push(q.x),x.push(q.y)}}let M=Mh(x,A);for(let z=0;z<M.length;z+=3)this.indexArray.emplaceBack(D+M[z],D+M[z+2],D+M[z+1]);v.primitiveLength+=M.length/3,v.vertexLength+=g;for(let z=0;z<f.vertexCount;z++){let B=Math.floor(f.x/f.vertexCount),q=Math.floor(f.y/f.vertexCount);this.centroidVertexArray.emplaceBack(B,q)}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,a,h,l)}}function Bf(i,t){return i.x===t.x&&(i.x<0||i.x>xi)||i.y===t.y&&(i.y<0||i.y>xi)}function Lf(i){return i.every(t=>t.x<0)||i.every(t=>t.x>xi)||i.every(t=>t.y<0)||i.every(t=>t.y>xi)}let Vh;Ve("FillExtrusionBucket",bc,{omit:["layers","features"]});var Rf={get paint(){return Vh=Vh||new c({"fill-extrusion-opacity":new je(oe["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new rt(oe["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new je(oe["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new je(oe["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Es(oe["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new rt(oe["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new rt(oe["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new je(oe["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class Ff extends n{constructor(t){super(t,Rf)}createBucket(t){return new bc(t)}queryRadius(){return ru(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(t,r,a,l,h,d,f,g){let v=nu(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),d.angle,f),x=this.paint.get("fill-extrusion-height").evaluate(r,a),A=this.paint.get("fill-extrusion-base").evaluate(r,a),D=function(z,B,q,$){let ne=[];for(let J of z){let ie=[J.x,J.y,0,1];au(ie,ie,B),ne.push(new se(ie[0]/ie[3],ie[1]/ie[3]))}return ne}(v,g),M=function(z,B,q,$){let ne=[],J=[],ie=$[8]*B,ce=$[9]*B,ge=$[10]*B,Be=$[11]*B,it=$[8]*q,Me=$[9]*q,Ie=$[10]*q,He=$[11]*q;for(let Ue of z){let qe=[],de=[];for(let Xe of Ue){let Ze=Xe.x,lt=Xe.y,Jt=$[0]*Ze+$[4]*lt+$[12],Xt=$[1]*Ze+$[5]*lt+$[13],Ti=$[2]*Ze+$[6]*lt+$[14],Jr=$[3]*Ze+$[7]*lt+$[15],Fi=Ti+ge,Ci=Jr+Be,ir=Jt+it,rr=Xt+Me,nr=Ti+Ie,mi=Jr+He,Di=new se((Jt+ie)/Ci,(Xt+ce)/Ci);Di.z=Fi/Ci,qe.push(Di);let Gi=new se(ir/mi,rr/mi);Gi.z=nr/mi,de.push(Gi)}ne.push(qe),J.push(de)}return[ne,J]}(l,A,x,g);return function(z,B,q){let $=1/0;vh(q,B)&&($=Uh(q,B[0]));for(let ne=0;ne<B.length;ne++){let J=B[ne],ie=z[ne];for(let ce=0;ce<J.length-1;ce++){let ge=J[ce],Be=[ge,J[ce+1],ie[ce+1],ie[ce],ge];yh(q,Be)&&($=Math.min($,Uh(q,Be)))}}return $!==1/0&&$}(M[0],M[1],D)}}function Ko(i,t){return i.x*t.x+i.y*t.y}function Uh(i,t){if(i.length===1){let r=0,a=t[r++],l;for(;!l||a.equals(l);)if(l=t[r++],!l)return 1/0;for(;r<t.length;r++){let h=t[r],d=i[0],f=l.sub(a),g=h.sub(a),v=d.sub(a),x=Ko(f,f),A=Ko(f,g),D=Ko(g,g),M=Ko(v,f),z=Ko(v,g),B=x*D-A*A,q=(D*M-A*z)/B,$=(x*z-A*M)/B,ne=a.z*(1-q-$)+l.z*q+h.z*$;if(isFinite(ne))return ne}return 1/0}{let r=1/0;for(let a of t)r=Math.min(r,a.z);return r}}let Of=m([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:Nf}=Of,qf=m([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:Vf}=qf,Uf=fa.VectorTileFeature.types,jf=Math.cos(Math.PI/180*37.5),jh=Math.pow(2,14)/.5;class wc{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(r=>{this.gradients[r.id]={}}),this.layoutVertexArray=new Cs,this.layoutVertexArray2=new ua,this.indexArray=new Nr,this.programConfigurations=new Ua(t.layers,t.zoom),this.segments=new St,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,a){this.hasPattern=_c("line",this.layers,r);let l=this.layers[0].layout.get("line-sort-key"),h=!l.isConstant(),d=[];for(let{feature:f,id:g,index:v,sourceLayerIndex:x}of t){let A=this.layers[0]._featureFilter.needGeometry,D=$a(f,A);if(!this.layers[0]._featureFilter.filter(new ti(this.zoom),D,a))continue;let M=h?l.evaluate(D,{},a):void 0,z={id:g,properties:f.properties,type:f.type,sourceLayerIndex:x,index:v,geometry:A?D.geometry:ja(f),patterns:{},sortKey:M};d.push(z)}h&&d.sort((f,g)=>f.sortKey-g.sortKey);for(let f of d){let{geometry:g,index:v,sourceLayerIndex:x}=f;if(this.hasPattern){let A=yc("line",this.layers,f,this.zoom,r);this.patternFeatures.push(A)}else this.addFeature(f,g,v,a,{});r.featureIndex.insert(t[v].feature,g,v,x,this.index)}}update(t,r,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,a)}addFeatures(t,r,a){for(let l of this.patternFeatures)this.addFeature(l,l.geometry,l.index,r,a)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,Vf)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Nf),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_end"))return{start:+t.properties.mapbox_clip_start,end:+t.properties.mapbox_clip_end}}addFeature(t,r,a,l,h){let d=this.layers[0].layout,f=d.get("line-join").evaluate(t,{}),g=d.get("line-cap"),v=d.get("line-miter-limit"),x=d.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(let A of r)this.addLine(A,t,f,g,v,x);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,a,h,l)}addLine(t,r,a,l,h,d){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let $=0;$<t.length-1;$++)this.totalDistance+=t[$].dist(t[$+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let f=Uf[r.type]==="Polygon",g=t.length;for(;g>=2&&t[g-1].equals(t[g-2]);)g--;let v=0;for(;v<g-1&&t[v].equals(t[v+1]);)v++;if(g<(f?3:2))return;a==="bevel"&&(h=1.05);let x=this.overscaling<=16?15*xi/(512*this.overscaling):0,A=this.segments.prepareSegment(10*g,this.layoutVertexArray,this.indexArray),D,M,z,B,q;this.e1=this.e2=-1,f&&(D=t[g-2],q=t[v].sub(D)._unit()._perp());for(let $=v;$<g;$++){if(z=$===g-1?f?t[v+1]:void 0:t[$+1],z&&t[$].equals(z))continue;q&&(B=q),D&&(M=D),D=t[$],q=z?z.sub(D)._unit()._perp():B,B=B||q;let ne=B.add(q);ne.x===0&&ne.y===0||ne._unit();let J=B.x*q.x+B.y*q.y,ie=ne.x*q.x+ne.y*q.y,ce=ie!==0?1/ie:1/0,ge=2*Math.sqrt(2-2*ie),Be=ie<jf&&M&&z,it=B.x*q.y-B.y*q.x>0;if(Be&&$>v){let He=D.dist(M);if(He>2*x){let Ue=D.sub(D.sub(M)._mult(x/He)._round());this.updateDistance(M,Ue),this.addCurrentVertex(Ue,B,0,0,A),M=Ue}}let Me=M&&z,Ie=Me?a:f?"butt":l;if(Me&&Ie==="round"&&(ce<d?Ie="miter":ce<=2&&(Ie="fakeround")),Ie==="miter"&&ce>h&&(Ie="bevel"),Ie==="bevel"&&(ce>2&&(Ie="flipbevel"),ce<h&&(Ie="miter")),M&&this.updateDistance(M,D),Ie==="miter")ne._mult(ce),this.addCurrentVertex(D,ne,0,0,A);else if(Ie==="flipbevel"){if(ce>100)ne=q.mult(-1);else{let He=ce*B.add(q).mag()/B.sub(q).mag();ne._perp()._mult(He*(it?-1:1))}this.addCurrentVertex(D,ne,0,0,A),this.addCurrentVertex(D,ne.mult(-1),0,0,A)}else if(Ie==="bevel"||Ie==="fakeround"){let He=-Math.sqrt(ce*ce-1),Ue=it?He:0,qe=it?0:He;if(M&&this.addCurrentVertex(D,B,Ue,qe,A),Ie==="fakeround"){let de=Math.round(180*ge/Math.PI/20);for(let Xe=1;Xe<de;Xe++){let Ze=Xe/de;if(Ze!==.5){let Jt=Ze-.5;Ze+=Ze*Jt*(Ze-1)*((1.0904+J*(J*(3.55645-1.43519*J)-3.2452))*Jt*Jt+(.848013+J*(.215638*J-1.06021)))}let lt=q.sub(B)._mult(Ze)._add(B)._unit()._mult(it?-1:1);this.addHalfVertex(D,lt.x,lt.y,!1,it,0,A)}}z&&this.addCurrentVertex(D,q,-Ue,-qe,A)}else if(Ie==="butt")this.addCurrentVertex(D,ne,0,0,A);else if(Ie==="square"){let He=M?1:-1;this.addCurrentVertex(D,ne,He,He,A)}else Ie==="round"&&(M&&(this.addCurrentVertex(D,B,0,0,A),this.addCurrentVertex(D,B,1,1,A,!0)),z&&(this.addCurrentVertex(D,q,-1,-1,A,!0),this.addCurrentVertex(D,q,0,0,A)));if(Be&&$<g-1){let He=D.dist(z);if(He>2*x){let Ue=D.add(z.sub(D)._mult(x/He)._round());this.updateDistance(D,Ue),this.addCurrentVertex(Ue,q,0,0,A),D=Ue}}}}addCurrentVertex(t,r,a,l,h,d=!1){let f=r.y*l-r.x,g=-r.y-r.x*l;this.addHalfVertex(t,r.x+r.y*a,r.y-r.x*a,d,!1,a,h),this.addHalfVertex(t,f,g,d,!0,-l,h),this.distance>jh/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,r,a,l,h,d))}addHalfVertex({x:t,y:r},a,l,h,d,f,g){let v=.5*(this.lineClips?this.scaledDistance*(jh-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<1)+(h?1:0),(r<<1)+(d?1:0),Math.round(63*a)+128,Math.round(63*l)+128,1+(f===0?0:f<0?-1:1)|(63&v)<<2,v>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);let x=g.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,x),g.primitiveLength++),d?this.e2=x:this.e1=x}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,r){this.distance+=t.dist(r),this.updateScaledDistance()}}let $h,Zh;Ve("LineBucket",wc,{omit:["layers","patternFeatures"]});var Gh={get paint(){return Zh=Zh||new c({"line-opacity":new rt(oe.paint_line["line-opacity"]),"line-color":new rt(oe.paint_line["line-color"]),"line-translate":new je(oe.paint_line["line-translate"]),"line-translate-anchor":new je(oe.paint_line["line-translate-anchor"]),"line-width":new rt(oe.paint_line["line-width"]),"line-gap-width":new rt(oe.paint_line["line-gap-width"]),"line-offset":new rt(oe.paint_line["line-offset"]),"line-blur":new rt(oe.paint_line["line-blur"]),"line-dasharray":new Ts(oe.paint_line["line-dasharray"]),"line-pattern":new Es(oe.paint_line["line-pattern"]),"line-gradient":new Vo(oe.paint_line["line-gradient"])})},get layout(){return $h=$h||new c({"line-cap":new je(oe.layout_line["line-cap"]),"line-join":new rt(oe.layout_line["line-join"]),"line-miter-limit":new je(oe.layout_line["line-miter-limit"]),"line-round-limit":new je(oe.layout_line["line-round-limit"]),"line-sort-key":new rt(oe.layout_line["line-sort-key"])})}};class $f extends rt{possiblyEvaluate(t,r){return r=new ti(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),super.possiblyEvaluate(t,r)}evaluate(t,r,a,l){return r=Ye({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(t,r,a,l)}}let uu;class Zf extends n{constructor(t){super(t,Gh),this.gradientVersion=0,uu||(uu=new $f(Gh.paint.properties["line-width"].specification),uu.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(t){if(t==="line-gradient"){let r=this.gradientExpression();this.stepInterpolant=!!function(a){return a._styleExpression!==void 0}(r)&&r._styleExpression.expression instanceof jn,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(t,r){super.recalculate(t,r),this.paint._values["line-floorwidth"]=uu.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new wc(t)}queryRadius(t){let r=t,a=Hh($o("line-width",this,r),$o("line-gap-width",this,r)),l=$o("line-offset",this,r);return a/2+Math.abs(l)+ru(this.paint.get("line-translate"))}queryIntersectsFeature(t,r,a,l,h,d,f){let g=nu(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),d.angle,f),v=f/2*Hh(this.paint.get("line-width").evaluate(r,a),this.paint.get("line-gap-width").evaluate(r,a)),x=this.paint.get("line-offset").evaluate(r,a);return x&&(l=function(A,D){let M=[];for(let z=0;z<A.length;z++){let B=A[z],q=[];for(let $=0;$<B.length;$++){let ne=B[$-1],J=B[$],ie=B[$+1],ce=$===0?new se(0,0):J.sub(ne)._unit()._perp(),ge=$===B.length-1?new se(0,0):ie.sub(J)._unit()._perp(),Be=ce._add(ge)._unit(),it=Be.x*ge.x+Be.y*ge.y;it!==0&&Be._mult(1/it),q.push(Be._mult(D)._add(J))}M.push(q)}return M}(l,x*f)),function(A,D,M){for(let z=0;z<D.length;z++){let B=D[z];if(A.length>=3){for(let q=0;q<B.length;q++)if(Ps(A,B[q]))return!0}if(Qd(A,B,M))return!0}return!1}(g,l,v)}isTileClipped(){return!0}}function Hh(i,t){return t>0?t+2*i:i}let Gf=m([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Hf=m([{name:"a_projected_pos",components:3,type:"Float32"}],4);m([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);let Xf=m([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);m([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);let Xh=m([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Wf=m([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function Jf(i,t,r){return i.sections.forEach(a=>{a.text=function(l,h,d){let f=h.layout.get("text-transform").evaluate(d,{});return f==="uppercase"?l=l.toLocaleUpperCase():f==="lowercase"&&(l=l.toLocaleLowerCase()),dr.applyArabicShaping&&(l=dr.applyArabicShaping(l)),l}(a.text,t,r)}),i}m([{name:"triangle",components:3,type:"Uint16"}]),m([{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"}]),m([{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"}]),m([{type:"Float32",name:"offsetX"}]),m([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),m([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);let Yo={"!":"\uFE15","#":"\uFF03",$:"\uFF04","%":"\uFF05","&":"\uFF06","(":"\uFE35",")":"\uFE36","*":"\uFF0A","+":"\uFF0B",",":"\uFE10","-":"\uFE32",".":"\u30FB","/":"\uFF0F",":":"\uFE13",";":"\uFE14","<":"\uFE3F","=":"\uFF1D",">":"\uFE40","?":"\uFE16","@":"\uFF20","[":"\uFE47","\\":"\uFF3C","]":"\uFE48","^":"\uFF3E",_:"\uFE33","`":"\uFF40","{":"\uFE37","|":"\u2015","}":"\uFE38","~":"\uFF5E","\xA2":"\uFFE0","\xA3":"\uFFE1","\xA5":"\uFFE5","\xA6":"\uFFE4","\xAC":"\uFFE2","\xAF":"\uFFE3","\u2013":"\uFE32","\u2014":"\uFE31","\u2018":"\uFE43","\u2019":"\uFE44","\u201C":"\uFE41","\u201D":"\uFE42","\u2026":"\uFE19","\u2027":"\u30FB","\u20A9":"\uFFE6","\u3001":"\uFE11","\u3002":"\uFE12","\u3008":"\uFE3F","\u3009":"\uFE40","\u300A":"\uFE3D","\u300B":"\uFE3E","\u300C":"\uFE41","\u300D":"\uFE42","\u300E":"\uFE43","\u300F":"\uFE44","\u3010":"\uFE3B","\u3011":"\uFE3C","\u3014":"\uFE39","\u3015":"\uFE3A","\u3016":"\uFE17","\u3017":"\uFE18","\uFF01":"\uFE15","\uFF08":"\uFE35","\uFF09":"\uFE36","\uFF0C":"\uFE10","\uFF0D":"\uFE32","\uFF0E":"\u30FB","\uFF1A":"\uFE13","\uFF1B":"\uFE14","\uFF1C":"\uFE3F","\uFF1E":"\uFE40","\uFF1F":"\uFE16","\uFF3B":"\uFE47","\uFF3D":"\uFE48","\uFF3F":"\uFE33","\uFF5B":"\uFE37","\uFF5C":"\u2015","\uFF5D":"\uFE38","\uFF5F":"\uFE35","\uFF60":"\uFE36","\uFF61":"\uFE12","\uFF62":"\uFE41","\uFF63":"\uFE42"};var wi=24,Wh=Ht,Jh=function(i,t,r,a,l){var h,d,f=8*l-a-1,g=(1<<f)-1,v=g>>1,x=-7,A=r?l-1:0,D=r?-1:1,M=i[t+A];for(A+=D,h=M&(1<<-x)-1,M>>=-x,x+=f;x>0;h=256*h+i[t+A],A+=D,x-=8);for(d=h&(1<<-x)-1,h>>=-x,x+=a;x>0;d=256*d+i[t+A],A+=D,x-=8);if(h===0)h=1-v;else{if(h===g)return d?NaN:1/0*(M?-1:1);d+=Math.pow(2,a),h-=v}return(M?-1:1)*d*Math.pow(2,h-a)},Kh=function(i,t,r,a,l,h){var d,f,g,v=8*h-l-1,x=(1<<v)-1,A=x>>1,D=l===23?Math.pow(2,-24)-Math.pow(2,-77):0,M=a?0:h-1,z=a?1:-1,B=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(f=isNaN(t)?1:0,d=x):(d=Math.floor(Math.log(t)/Math.LN2),t*(g=Math.pow(2,-d))<1&&(d--,g*=2),(t+=d+A>=1?D/g:D*Math.pow(2,1-A))*g>=2&&(d++,g/=2),d+A>=x?(f=0,d=x):d+A>=1?(f=(t*g-1)*Math.pow(2,l),d+=A):(f=t*Math.pow(2,A-1)*Math.pow(2,l),d=0));l>=8;i[r+M]=255&f,M+=z,f/=256,l-=8);for(d=d<<l|f,v+=l;v>0;i[r+M]=255&d,M+=z,d/=256,v-=8);i[r+M-z]|=128*B};function Ht(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}Ht.Varint=0,Ht.Fixed64=1,Ht.Bytes=2,Ht.Fixed32=5;var Ac=4294967296,Yh=1/Ac,Qh=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function zn(i){return i.type===Ht.Bytes?i.readVarint()+i.pos:i.pos+1}function Rs(i,t,r){return r?4294967296*t+(i>>>0):4294967296*(t>>>0)+(i>>>0)}function ep(i,t,r){var a=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));r.realloc(a);for(var l=r.pos-1;l>=i;l--)r.buf[l+a]=r.buf[l]}function Kf(i,t){for(var r=0;r<i.length;r++)t.writeVarint(i[r])}function Yf(i,t){for(var r=0;r<i.length;r++)t.writeSVarint(i[r])}function Qf(i,t){for(var r=0;r<i.length;r++)t.writeFloat(i[r])}function em(i,t){for(var r=0;r<i.length;r++)t.writeDouble(i[r])}function tm(i,t){for(var r=0;r<i.length;r++)t.writeBoolean(i[r])}function im(i,t){for(var r=0;r<i.length;r++)t.writeFixed32(i[r])}function rm(i,t){for(var r=0;r<i.length;r++)t.writeSFixed32(i[r])}function nm(i,t){for(var r=0;r<i.length;r++)t.writeFixed64(i[r])}function am(i,t){for(var r=0;r<i.length;r++)t.writeSFixed64(i[r])}function cu(i,t){return(i[t]|i[t+1]<<8|i[t+2]<<16)+16777216*i[t+3]}function Fs(i,t,r){i[r]=t,i[r+1]=t>>>8,i[r+2]=t>>>16,i[r+3]=t>>>24}function tp(i,t){return(i[t]|i[t+1]<<8|i[t+2]<<16)+(i[t+3]<<24)}Ht.prototype={destroy:function(){this.buf=null},readFields:function(i,t,r){for(r=r||this.length;this.pos<r;){var a=this.readVarint(),l=a>>3,h=this.pos;this.type=7&a,i(l,t,this),this.pos===h&&this.skip(a)}return t},readMessage:function(i,t){return this.readFields(i,t,this.readVarint()+this.pos)},readFixed32:function(){var i=cu(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=tp(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=cu(this.buf,this.pos)+cu(this.buf,this.pos+4)*Ac;return this.pos+=8,i},readSFixed64:function(){var i=cu(this.buf,this.pos)+tp(this.buf,this.pos+4)*Ac;return this.pos+=8,i},readFloat:function(){var i=Jh(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=Jh(this.buf,this.pos,!0,52,8);return this.pos+=8,i},readVarint:function(i){var t,r,a=this.buf;return t=127&(r=a[this.pos++]),r<128?t:(t|=(127&(r=a[this.pos++]))<<7,r<128?t:(t|=(127&(r=a[this.pos++]))<<14,r<128?t:(t|=(127&(r=a[this.pos++]))<<21,r<128?t:function(l,h,d){var f,g,v=d.buf;if(f=(112&(g=v[d.pos++]))>>4,g<128||(f|=(127&(g=v[d.pos++]))<<3,g<128)||(f|=(127&(g=v[d.pos++]))<<10,g<128)||(f|=(127&(g=v[d.pos++]))<<17,g<128)||(f|=(127&(g=v[d.pos++]))<<24,g<128)||(f|=(1&(g=v[d.pos++]))<<31,g<128))return Rs(l,f,h);throw new Error("Expected varint not more than 10 bytes")}(t|=(15&(r=a[this.pos]))<<28,i,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var i=this.readVarint();return i%2==1?(i+1)/-2:i/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var i=this.readVarint()+this.pos,t=this.pos;return this.pos=i,i-t>=12&&Qh?function(r,a,l){return Qh.decode(r.subarray(a,l))}(this.buf,t,i):function(r,a,l){for(var h="",d=a;d<l;){var f,g,v,x=r[d],A=null,D=x>239?4:x>223?3:x>191?2:1;if(d+D>l)break;D===1?x<128&&(A=x):D===2?(192&(f=r[d+1]))==128&&(A=(31&x)<<6|63&f)<=127&&(A=null):D===3?(g=r[d+2],(192&(f=r[d+1]))==128&&(192&g)==128&&((A=(15&x)<<12|(63&f)<<6|63&g)<=2047||A>=55296&&A<=57343)&&(A=null)):D===4&&(g=r[d+2],v=r[d+3],(192&(f=r[d+1]))==128&&(192&g)==128&&(192&v)==128&&((A=(15&x)<<18|(63&f)<<12|(63&g)<<6|63&v)<=65535||A>=1114112)&&(A=null)),A===null?(A=65533,D=1):A>65535&&(A-=65536,h+=String.fromCharCode(A>>>10&1023|55296),A=56320|1023&A),h+=String.fromCharCode(A),d+=D}return h}(this.buf,t,i)},readBytes:function(){var i=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,i);return this.pos=i,t},readPackedVarint:function(i,t){if(this.type!==Ht.Bytes)return i.push(this.readVarint(t));var r=zn(this);for(i=i||[];this.pos<r;)i.push(this.readVarint(t));return i},readPackedSVarint:function(i){if(this.type!==Ht.Bytes)return i.push(this.readSVarint());var t=zn(this);for(i=i||[];this.pos<t;)i.push(this.readSVarint());return i},readPackedBoolean:function(i){if(this.type!==Ht.Bytes)return i.push(this.readBoolean());var t=zn(this);for(i=i||[];this.pos<t;)i.push(this.readBoolean());return i},readPackedFloat:function(i){if(this.type!==Ht.Bytes)return i.push(this.readFloat());var t=zn(this);for(i=i||[];this.pos<t;)i.push(this.readFloat());return i},readPackedDouble:function(i){if(this.type!==Ht.Bytes)return i.push(this.readDouble());var t=zn(this);for(i=i||[];this.pos<t;)i.push(this.readDouble());return i},readPackedFixed32:function(i){if(this.type!==Ht.Bytes)return i.push(this.readFixed32());var t=zn(this);for(i=i||[];this.pos<t;)i.push(this.readFixed32());return i},readPackedSFixed32:function(i){if(this.type!==Ht.Bytes)return i.push(this.readSFixed32());var t=zn(this);for(i=i||[];this.pos<t;)i.push(this.readSFixed32());return i},readPackedFixed64:function(i){if(this.type!==Ht.Bytes)return i.push(this.readFixed64());var t=zn(this);for(i=i||[];this.pos<t;)i.push(this.readFixed64());return i},readPackedSFixed64:function(i){if(this.type!==Ht.Bytes)return i.push(this.readSFixed64());var t=zn(this);for(i=i||[];this.pos<t;)i.push(this.readSFixed64());return i},skip:function(i){var t=7&i;if(t===Ht.Varint)for(;this.buf[this.pos++]>127;);else if(t===Ht.Bytes)this.pos=this.readVarint()+this.pos;else if(t===Ht.Fixed32)this.pos+=4;else{if(t!==Ht.Fixed64)throw new Error("Unimplemented type: "+t);this.pos+=8}},writeTag:function(i,t){this.writeVarint(i<<3|t)},realloc:function(i){for(var t=this.length||16;t<this.pos+i;)t*=2;if(t!==this.length){var r=new Uint8Array(t);r.set(this.buf),this.buf=r,this.length=t}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(i){this.realloc(4),Fs(this.buf,i,this.pos),this.pos+=4},writeSFixed32:function(i){this.realloc(4),Fs(this.buf,i,this.pos),this.pos+=4},writeFixed64:function(i){this.realloc(8),Fs(this.buf,-1&i,this.pos),Fs(this.buf,Math.floor(i*Yh),this.pos+4),this.pos+=8},writeSFixed64:function(i){this.realloc(8),Fs(this.buf,-1&i,this.pos),Fs(this.buf,Math.floor(i*Yh),this.pos+4),this.pos+=8},writeVarint:function(i){(i=+i||0)>268435455||i<0?function(t,r){var a,l;if(t>=0?(a=t%4294967296|0,l=t/4294967296|0):(l=~(-t/4294967296),4294967295^(a=~(-t%4294967296))?a=a+1|0:(a=0,l=l+1|0)),t>=18446744073709552e3||t<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");r.realloc(10),function(h,d,f){f.buf[f.pos++]=127&h|128,h>>>=7,f.buf[f.pos++]=127&h|128,h>>>=7,f.buf[f.pos++]=127&h|128,h>>>=7,f.buf[f.pos++]=127&h|128,f.buf[f.pos]=127&(h>>>=7)}(a,0,r),function(h,d){var f=(7&h)<<4;d.buf[d.pos++]|=f|((h>>>=3)?128:0),h&&(d.buf[d.pos++]=127&h|((h>>>=7)?128:0),h&&(d.buf[d.pos++]=127&h|((h>>>=7)?128:0),h&&(d.buf[d.pos++]=127&h|((h>>>=7)?128:0),h&&(d.buf[d.pos++]=127&h|((h>>>=7)?128:0),h&&(d.buf[d.pos++]=127&h)))))}(l,r)}(i,this):(this.realloc(4),this.buf[this.pos++]=127&i|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=i>>>7&127))))},writeSVarint:function(i){this.writeVarint(i<0?2*-i-1:2*i)},writeBoolean:function(i){this.writeVarint(!!i)},writeString:function(i){i=String(i),this.realloc(4*i.length),this.pos++;var t=this.pos;this.pos=function(a,l,h){for(var d,f,g=0;g<l.length;g++){if((d=l.charCodeAt(g))>55295&&d<57344){if(!f){d>56319||g+1===l.length?(a[h++]=239,a[h++]=191,a[h++]=189):f=d;continue}if(d<56320){a[h++]=239,a[h++]=191,a[h++]=189,f=d;continue}d=f-55296<<10|d-56320|65536,f=null}else f&&(a[h++]=239,a[h++]=191,a[h++]=189,f=null);d<128?a[h++]=d:(d<2048?a[h++]=d>>6|192:(d<65536?a[h++]=d>>12|224:(a[h++]=d>>18|240,a[h++]=d>>12&63|128),a[h++]=d>>6&63|128),a[h++]=63&d|128)}return h}(this.buf,i,this.pos);var r=this.pos-t;r>=128&&ep(t,r,this),this.pos=t-1,this.writeVarint(r),this.pos+=r},writeFloat:function(i){this.realloc(4),Kh(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),Kh(this.buf,i,this.pos,!0,52,8),this.pos+=8},writeBytes:function(i){var t=i.length;this.writeVarint(t),this.realloc(t);for(var r=0;r<t;r++)this.buf[this.pos++]=i[r]},writeRawMessage:function(i,t){this.pos++;var r=this.pos;i(t,this);var a=this.pos-r;a>=128&&ep(r,a,this),this.pos=r-1,this.writeVarint(a),this.pos+=a},writeMessage:function(i,t,r){this.writeTag(i,Ht.Bytes),this.writeRawMessage(t,r)},writePackedVarint:function(i,t){t.length&&this.writeMessage(i,Kf,t)},writePackedSVarint:function(i,t){t.length&&this.writeMessage(i,Yf,t)},writePackedBoolean:function(i,t){t.length&&this.writeMessage(i,tm,t)},writePackedFloat:function(i,t){t.length&&this.writeMessage(i,Qf,t)},writePackedDouble:function(i,t){t.length&&this.writeMessage(i,em,t)},writePackedFixed32:function(i,t){t.length&&this.writeMessage(i,im,t)},writePackedSFixed32:function(i,t){t.length&&this.writeMessage(i,rm,t)},writePackedFixed64:function(i,t){t.length&&this.writeMessage(i,nm,t)},writePackedSFixed64:function(i,t){t.length&&this.writeMessage(i,am,t)},writeBytesField:function(i,t){this.writeTag(i,Ht.Bytes),this.writeBytes(t)},writeFixed32Field:function(i,t){this.writeTag(i,Ht.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(i,t){this.writeTag(i,Ht.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(i,t){this.writeTag(i,Ht.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(i,t){this.writeTag(i,Ht.Fixed64),this.writeSFixed64(t)},writeVarintField:function(i,t){this.writeTag(i,Ht.Varint),this.writeVarint(t)},writeSVarintField:function(i,t){this.writeTag(i,Ht.Varint),this.writeSVarint(t)},writeStringField:function(i,t){this.writeTag(i,Ht.Bytes),this.writeString(t)},writeFloatField:function(i,t){this.writeTag(i,Ht.Fixed32),this.writeFloat(t)},writeDoubleField:function(i,t){this.writeTag(i,Ht.Fixed64),this.writeDouble(t)},writeBooleanField:function(i,t){this.writeVarintField(i,!!t)}};var Ec=ue(Wh);let Tc=3;function sm(i,t,r){i===1&&r.readMessage(om,t)}function om(i,t,r){if(i===3){let{id:a,bitmap:l,width:h,height:d,left:f,top:g,advance:v}=r.readMessage(lm,{});t.push({id:a,bitmap:new Go({width:h+2*Tc,height:d+2*Tc},l),metrics:{width:h,height:d,left:f,top:g,advance:v}})}}function lm(i,t,r){i===1?t.id=r.readVarint():i===2?t.bitmap=r.readBytes():i===3?t.width=r.readVarint():i===4?t.height=r.readVarint():i===5?t.left=r.readSVarint():i===6?t.top=r.readSVarint():i===7&&(t.advance=r.readVarint())}let ip=Tc;function rp(i){let t=0,r=0;for(let d of i)t+=d.w*d.h,r=Math.max(r,d.w);i.sort((d,f)=>f.h-d.h);let a=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),r),h:1/0}],l=0,h=0;for(let d of i)for(let f=a.length-1;f>=0;f--){let g=a[f];if(!(d.w>g.w||d.h>g.h)){if(d.x=g.x,d.y=g.y,h=Math.max(h,d.y+d.h),l=Math.max(l,d.x+d.w),d.w===g.w&&d.h===g.h){let v=a.pop();f<a.length&&(a[f]=v)}else d.h===g.h?(g.x+=d.w,g.w-=d.w):d.w===g.w?(g.y+=d.h,g.h-=d.h):(a.push({x:g.x+d.w,y:g.y,w:g.w-d.w,h:d.h}),g.y+=d.h,g.h-=d.h);break}}return{w:l,h,fill:t/(l*h)||0}}let mr=1;class Cc{constructor(t,{pixelRatio:r,version:a,stretchX:l,stretchY:h,content:d,textFitWidth:f,textFitHeight:g}){this.paddedRect=t,this.pixelRatio=r,this.stretchX=l,this.stretchY=h,this.content=d,this.version=a,this.textFitWidth=f,this.textFitHeight=g}get tl(){return[this.paddedRect.x+mr,this.paddedRect.y+mr]}get br(){return[this.paddedRect.x+this.paddedRect.w-mr,this.paddedRect.y+this.paddedRect.h-mr]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2*mr)/this.pixelRatio,(this.paddedRect.h-2*mr)/this.pixelRatio]}}class np{constructor(t,r){let a={},l={};this.haveRenderCallbacks=[];let h=[];this.addImages(t,a,h),this.addImages(r,l,h);let{w:d,h:f}=rp(h),g=new qr({width:d||1,height:f||1});for(let v in t){let x=t[v],A=a[v].paddedRect;qr.copy(x.data,g,{x:0,y:0},{x:A.x+mr,y:A.y+mr},x.data)}for(let v in r){let x=r[v],A=l[v].paddedRect,D=A.x+mr,M=A.y+mr,z=x.data.width,B=x.data.height;qr.copy(x.data,g,{x:0,y:0},{x:D,y:M},x.data),qr.copy(x.data,g,{x:0,y:B-1},{x:D,y:M-1},{width:z,height:1}),qr.copy(x.data,g,{x:0,y:0},{x:D,y:M+B},{width:z,height:1}),qr.copy(x.data,g,{x:z-1,y:0},{x:D-1,y:M},{width:1,height:B}),qr.copy(x.data,g,{x:0,y:0},{x:D+z,y:M},{width:1,height:B})}this.image=g,this.iconPositions=a,this.patternPositions=l}addImages(t,r,a){for(let l in t){let h=t[l],d={x:0,y:0,w:h.data.width+2*mr,h:h.data.height+2*mr};a.push(d),r[l]=new Cc(d,h),h.hasRenderCallback&&this.haveRenderCallbacks.push(l)}}patchUpdatedImages(t,r){t.dispatchRenderCallbacks(this.haveRenderCallbacks);for(let a in t.updatedImages)this.patchUpdatedImage(this.iconPositions[a],t.getImage(a),r),this.patchUpdatedImage(this.patternPositions[a],t.getImage(a),r)}patchUpdatedImage(t,r,a){if(!t||!r||t.version===r.version)return;t.version=r.version;let[l,h]=t.tl;a.update(r.data,void 0,{x:l,y:h})}}var ma;Ve("ImagePosition",Cc),Ve("ImageAtlas",np),E.ah=void 0,(ma=E.ah||(E.ah={}))[ma.none=0]="none",ma[ma.horizontal=1]="horizontal",ma[ma.vertical=2]="vertical",ma[ma.horizontalOnly=3]="horizontalOnly";let Qo=-17;class el{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(t,r){let a=new el;return a.scale=t||1,a.fontStack=r,a}static forImage(t){let r=new el;return r.imageName=t,r}}class Os{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(t,r){let a=new Os;for(let l=0;l<t.sections.length;l++){let h=t.sections[l];h.image?a.addImageSection(h):a.addTextSection(h,r)}return a}length(){return this.text.length}getSection(t){return this.sections[this.sectionIndex[t]]}getSectionIndex(t){return this.sectionIndex[t]}getCharCode(t){return this.text.charCodeAt(t)}verticalizePunctuation(){this.text=function(t){let r="";for(let a=0;a<t.length;a++){let l=t.charCodeAt(a+1)||null,h=t.charCodeAt(a-1)||null;r+=l&&Jl(l)&&!Yo[t[a+1]]||h&&Jl(h)&&!Yo[t[a-1]]||!Yo[t[a]]?t[a]:Yo[t[a]]}return r}(this.text)}trim(){let t=0;for(let a=0;a<this.text.length&&pu[this.text.charCodeAt(a)];a++)t++;let r=this.text.length;for(let a=this.text.length-1;a>=0&&a>=t&&pu[this.text.charCodeAt(a)];a--)r--;this.text=this.text.substring(t,r),this.sectionIndex=this.sectionIndex.slice(t,r)}substring(t,r){let a=new Os;return a.text=this.text.substring(t,r),a.sectionIndex=this.sectionIndex.slice(t,r),a.sections=this.sections,a}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((t,r)=>Math.max(t,this.sections[r].scale),0)}addTextSection(t,r){this.text+=t.text,this.sections.push(el.forText(t.scale,t.fontStack||r));let a=this.sections.length-1;for(let l=0;l<t.text.length;++l)this.sectionIndex.push(a)}addImageSection(t){let r=t.image?t.image.name:"";if(r.length===0)return void Pe("Can't add FormattedSection with an empty image.");let a=this.getNextImageSectionCharCode();a?(this.text+=String.fromCharCode(a),this.sections.push(el.forImage(r)),this.sectionIndex.push(this.sections.length-1)):Pe("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function hu(i,t,r,a,l,h,d,f,g,v,x,A,D,M,z){let B=Os.fromFeature(i,l),q;A===E.ah.vertical&&B.verticalizePunctuation();let{processBidirectionalText:$,processStyledBidirectionalText:ne}=dr;if($&&B.sections.length===1){q=[];let ce=$(B.toString(),Dc(B,v,h,t,a,M));for(let ge of ce){let Be=new Os;Be.text=ge,Be.sections=B.sections;for(let it=0;it<ge.length;it++)Be.sectionIndex.push(0);q.push(Be)}}else if(ne){q=[];let ce=ne(B.text,B.sectionIndex,Dc(B,v,h,t,a,M));for(let ge of ce){let Be=new Os;Be.text=ge[0],Be.sectionIndex=ge[1],Be.sections=B.sections,q.push(Be)}}else q=function(ce,ge){let Be=[],it=ce.text,Me=0;for(let Ie of ge)Be.push(ce.substring(Me,Ie)),Me=Ie;return Me<it.length&&Be.push(ce.substring(Me,it.length)),Be}(B,Dc(B,v,h,t,a,M));let J=[],ie={positionedLines:J,text:B.toString(),top:x[1],bottom:x[1],left:x[0],right:x[0],writingMode:A,iconsInText:!1,verticalizable:!1};return function(ce,ge,Be,it,Me,Ie,He,Ue,qe,de,Xe,Ze){let lt=0,Jt=Qo,Xt=0,Ti=0,Jr=Ue==="right"?1:Ue==="left"?0:.5,Fi=0;for(let mi of Me){mi.trim();let Di=mi.getMaxScale(),Gi=(Di-1)*wi,Oi={positionedGlyphs:[],lineOffset:0};ce.positionedLines[Fi]=Oi;let ar=Oi.positionedGlyphs,Ni=0;if(!mi.length()){Jt+=Ie,++Fi;continue}for(let gr=0;gr<mi.length();gr++){let Ft=mi.getSection(gr),Qt=mi.getSectionIndex(gr),ai=mi.getCharCode(gr),Cr=0,pi=null,Us=null,dn=null,fn=wi,Kr=!(qe===E.ah.horizontal||!Xe&&!No(ai)||Xe&&(pu[ai]||(Ci=ai,/\p{sc=Arab}/u.test(String.fromCodePoint(Ci)))));if(Ft.imageName){let jr=it[Ft.imageName];if(!jr)continue;dn=Ft.imageName,ce.iconsInText=ce.iconsInText||!0,Us=jr.paddedRect;let Mi=jr.displaySize;Ft.scale=Ft.scale*wi/Ze,pi={width:Mi[0],height:Mi[1],left:mr,top:-ip,advance:Kr?Mi[1]:Mi[0]},Cr=Gi+(wi-Mi[1]*Ft.scale),fn=pi.advance;let Bn=Kr?Mi[0]*Ft.scale-wi*Di:Mi[1]*Ft.scale-wi*Di;Bn>0&&Bn>Ni&&(Ni=Bn)}else{let jr=Be[Ft.fontStack],Mi=jr&&jr[ai];if(Mi&&Mi.rect)Us=Mi.rect,pi=Mi.metrics;else{let Bn=ge[Ft.fontStack],sl=Bn&&Bn[ai];if(!sl)continue;pi=sl.metrics}Cr=(Di-Ft.scale)*wi}Kr?(ce.verticalizable=!0,ar.push({glyph:ai,imageName:dn,x:lt,y:Jt+Cr,vertical:Kr,scale:Ft.scale,fontStack:Ft.fontStack,sectionIndex:Qt,metrics:pi,rect:Us}),lt+=fn*Ft.scale+de):(ar.push({glyph:ai,imageName:dn,x:lt,y:Jt+Cr,vertical:Kr,scale:Ft.scale,fontStack:Ft.fontStack,sectionIndex:Qt,metrics:pi,rect:Us}),lt+=pi.advance*Ft.scale+de)}ar.length!==0&&(Xt=Math.max(lt-de,Xt),pm(ar,0,ar.length-1,Jr,Ni)),lt=0;let Ur=Ie*Di+Ni;Oi.lineOffset=Math.max(Ni,Gi),Jt+=Ur,Ti=Math.max(Ur,Ti),++Fi}var Ci;let ir=Jt-Qo,{horizontalAlign:rr,verticalAlign:nr}=Sc(He);(function(mi,Di,Gi,Oi,ar,Ni,Ur,gr,Ft){let Qt=(Di-Gi)*ar,ai=0;ai=Ni!==Ur?-gr*Oi-Qo:(-Oi*Ft+.5)*Ur;for(let Cr of mi)for(let pi of Cr.positionedGlyphs)pi.x+=Qt,pi.y+=ai})(ce.positionedLines,Jr,rr,nr,Xt,Ti,Ie,ir,Me.length),ce.top+=-nr*ir,ce.bottom=ce.top+ir,ce.left+=-rr*Xt,ce.right=ce.left+Xt}(ie,t,r,a,q,d,f,g,A,v,D,z),!function(ce){for(let ge of ce)if(ge.positionedGlyphs.length!==0)return!1;return!0}(J)&&ie}let pu={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},um={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},cm={40:!0};function ap(i,t,r,a,l,h){if(t.imageName){let d=a[t.imageName];return d?d.displaySize[0]*t.scale*wi/h+l:0}{let d=r[t.fontStack],f=d&&d[i];return f?f.metrics.advance*t.scale+l:0}}function sp(i,t,r,a){let l=Math.pow(i-t,2);return a?i<t?l/2:2*l:l+Math.abs(r)*r}function hm(i,t,r){let a=0;return i===10&&(a-=1e4),r&&(a+=150),i!==40&&i!==65288||(a+=50),t!==41&&t!==65289||(a+=50),a}function op(i,t,r,a,l,h){let d=null,f=sp(t,r,l,h);for(let g of a){let v=sp(t-g.x,r,l,h)+g.badness;v<=f&&(d=g,f=v)}return{index:i,x:t,priorBreak:d,badness:f}}function lp(i){return i?lp(i.priorBreak).concat(i.index):[]}function Dc(i,t,r,a,l,h){if(!i)return[];let d=[],f=function(A,D,M,z,B,q){let $=0;for(let ne=0;ne<A.length();ne++){let J=A.getSection(ne);$+=ap(A.getCharCode(ne),J,z,B,D,q)}return $/Math.max(1,Math.ceil($/M))}(i,t,r,a,l,h),g=i.text.indexOf("\u200B")>=0,v=0;for(let A=0;A<i.length();A++){let D=i.getSection(A),M=i.getCharCode(A);if(pu[M]||(v+=ap(M,D,a,l,t,h)),A<i.length()-1){let z=!((x=M)<11904)&&(!!Dt["CJK Compatibility Forms"](x)||!!Dt["CJK Compatibility"](x)||!!Dt["CJK Strokes"](x)||!!Dt["CJK Symbols and Punctuation"](x)||!!Dt["Enclosed CJK Letters and Months"](x)||!!Dt["Halfwidth and Fullwidth Forms"](x)||!!Dt["Ideographic Description Characters"](x)||!!Dt["Vertical Forms"](x)||Wl.test(String.fromCodePoint(x)));(um[M]||z||D.imageName||A!==i.length()-2&&cm[i.getCharCode(A+1)])&&d.push(op(A+1,v,f,d,hm(M,i.getCharCode(A+1),z&&g),!1))}}var x;return lp(op(i.length(),v,f,d,0,!0))}function Sc(i){let t=.5,r=.5;switch(i){case"right":case"top-right":case"bottom-right":t=1;break;case"left":case"top-left":case"bottom-left":t=0}switch(i){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:t,verticalAlign:r}}function pm(i,t,r,a,l){if(!a&&!l)return;let h=i[r],d=(i[r].x+h.metrics.advance*h.scale)*a;for(let f=t;f<=r;f++)i[f].x-=d,i[f].y+=l}function dm(i,t,r){let{horizontalAlign:a,verticalAlign:l}=Sc(r),h=t[0]-i.displaySize[0]*a,d=t[1]-i.displaySize[1]*l;return{image:i,top:d,bottom:d+i.displaySize[1],left:h,right:h+i.displaySize[0]}}function up(i){var t,r;let a=i.left,l=i.top,h=i.right-a,d=i.bottom-l,f=(t=i.image.textFitWidth)!==null&&t!==void 0?t:"stretchOrShrink",g=(r=i.image.textFitHeight)!==null&&r!==void 0?r:"stretchOrShrink",v=(i.image.content[2]-i.image.content[0])/(i.image.content[3]-i.image.content[1]);if(g==="proportional"){if(f==="stretchOnly"&&h/d<v||f==="proportional"){let x=Math.ceil(d*v);a*=x/h,h=x}}else if(f==="proportional"&&g==="stretchOnly"&&v!==0&&h/d>v){let x=Math.ceil(h/v);l*=x/d,d=x}return{x1:a,y1:l,x2:a+h,y2:l+d}}function cp(i,t,r,a,l,h){let d=i.image,f;if(d.content){let q=d.content,$=d.pixelRatio||1;f=[q[0]/$,q[1]/$,d.displaySize[0]-q[2]/$,d.displaySize[1]-q[3]/$]}let g=t.left*h,v=t.right*h,x,A,D,M;r==="width"||r==="both"?(M=l[0]+g-a[3],A=l[0]+v+a[1]):(M=l[0]+(g+v-d.displaySize[0])/2,A=M+d.displaySize[0]);let z=t.top*h,B=t.bottom*h;return r==="height"||r==="both"?(x=l[1]+z-a[0],D=l[1]+B+a[2]):(x=l[1]+(z+B-d.displaySize[1])/2,D=x+d.displaySize[1]),{image:d,top:x,right:A,bottom:D,left:M,collisionPadding:f}}let tl=255,pn=128,ga=tl*pn;function hp(i,t){let{expression:r}=t;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new ti(i+1))};if(r.kind==="source")return{kind:"source"};{let{zoomStops:a,interpolationType:l}=r,h=0;for(;h<a.length&&a[h]<=i;)h++;h=Math.max(0,h-1);let d=h;for(;d<a.length&&a[d]<i+1;)d++;d=Math.min(a.length-1,d);let f=a[h],g=a[d];return r.kind==="composite"?{kind:"composite",minZoom:f,maxZoom:g,interpolationType:l}:{kind:"camera",minZoom:f,maxZoom:g,minSize:r.evaluate(new ti(f)),maxSize:r.evaluate(new ti(g)),interpolationType:l}}}function Ic(i,t,r){let a="never",l=i.get(t);return l?a=l:i.get(r)&&(a="always"),a}let fm=fa.VectorTileFeature.types,mm=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function du(i,t,r,a,l,h,d,f,g,v,x,A,D){let M=f?Math.min(ga,Math.round(f[0])):0,z=f?Math.min(ga,Math.round(f[1])):0;i.emplaceBack(t,r,Math.round(32*a),Math.round(32*l),h,d,(M<<1)+(g?1:0),z,16*v,16*x,256*A,256*D)}function kc(i,t,r){i.emplaceBack(t.x,t.y,r),i.emplaceBack(t.x,t.y,r),i.emplaceBack(t.x,t.y,r),i.emplaceBack(t.x,t.y,r)}function gm(i){for(let t of i.sections)if(nc(t.text))return!0;return!1}class Mc{constructor(t){this.layoutVertexArray=new Ds,this.indexArray=new Nr,this.programConfigurations=t,this.segments=new St,this.dynamicLayoutVertexArray=new Uo,this.opacityVertexArray=new Er,this.hasVisibleVertices=!1,this.placedSymbolArray=new ii}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(t,r,a,l){this.isEmpty()||(a&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Gf.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,Hf.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,mm,!0),this.opacityVertexBuffer.itemSize=1),(a||l)&&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())}}Ve("SymbolBuffers",Mc);class Pc{constructor(t,r,a){this.layoutVertexArray=new t,this.layoutAttributes=r,this.indexArray=new a,this.segments=new St,this.collisionVertexArray=new cn}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,Xf.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}Ve("CollisionBuffers",Pc);class Ns{constructor(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(d=>d.id),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=hc([]),this.placementViewportMatrix=hc([]);let r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=hp(this.zoom,r["text-size"]),this.iconSizeData=hp(this.zoom,r["icon-size"]);let a=this.layers[0].layout,l=a.get("symbol-sort-key"),h=a.get("symbol-z-order");this.canOverlap=Ic(a,"text-overlap","text-allow-overlap")!=="never"||Ic(a,"icon-overlap","icon-allow-overlap")!=="never"||a.get("text-ignore-placement")||a.get("icon-ignore-placement"),this.sortFeaturesByKey=h!=="viewport-y"&&!l.isConstant(),this.sortFeaturesByY=(h==="viewport-y"||h==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,a.get("symbol-placement")==="point"&&(this.writingModes=a.get("text-writing-mode").map(d=>E.ah[d])),this.stateDependentLayerIds=this.layers.filter(d=>d.isStateDependent()).map(d=>d.id),this.sourceID=t.sourceID}createArrays(){this.text=new Mc(new Ua(this.layers,this.zoom,t=>/^text/.test(t))),this.icon=new Mc(new Ua(this.layers,this.zoom,t=>/^icon/.test(t))),this.glyphOffsetArray=new ri,this.lineVertexArray=new zi,this.symbolInstances=new Ct,this.textAnchorOffsets=new ni}calculateGlyphDependencies(t,r,a,l,h){for(let d=0;d<t.length;d++)if(r[t.charCodeAt(d)]=!0,(a||l)&&h){let f=Yo[t.charAt(d)];f&&(r[f.charCodeAt(0)]=!0)}}populate(t,r,a){let l=this.layers[0],h=l.layout,d=h.get("text-font"),f=h.get("text-field"),g=h.get("icon-image"),v=(f.value.kind!=="constant"||f.value.value instanceof ur&&!f.value.value.isEmpty()||f.value.value.toString().length>0)&&(d.value.kind!=="constant"||d.value.value.length>0),x=g.value.kind!=="constant"||!!g.value.value||Object.keys(g.parameters).length>0,A=h.get("symbol-sort-key");if(this.features=[],!v&&!x)return;let D=r.iconDependencies,M=r.glyphDependencies,z=r.availableImages,B=new ti(this.zoom);for(let{feature:q,id:$,index:ne,sourceLayerIndex:J}of t){let ie=l._featureFilter.needGeometry,ce=$a(q,ie);if(!l._featureFilter.filter(B,ce,a))continue;let ge,Be;if(ie||(ce.geometry=ja(q)),v){let Me=l.getValueAndResolveTokens("text-field",ce,a,z),Ie=ur.factory(Me),He=this.hasRTLText=this.hasRTLText||gm(Ie);(!He||dr.getRTLTextPluginStatus()==="unavailable"||He&&dr.isParsed())&&(ge=Jf(Ie,l,ce))}if(x){let Me=l.getValueAndResolveTokens("icon-image",ce,a,z);Be=Me instanceof hr?Me:hr.fromString(Me)}if(!ge&&!Be)continue;let it=this.sortFeaturesByKey?A.evaluate(ce,{},a):void 0;if(this.features.push({id:$,text:ge,icon:Be,index:ne,sourceLayerIndex:J,geometry:ce.geometry,properties:q.properties,type:fm[q.type],sortKey:it}),Be&&(D[Be.name]=!0),ge){let Me=d.evaluate(ce,{},a).join(","),Ie=h.get("text-rotation-alignment")!=="viewport"&&h.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(E.ah.vertical)>=0;for(let He of ge.sections)if(He.image)D[He.image.name]=!0;else{let Ue=Fo(ge.toString()),qe=He.fontStack||Me,de=M[qe]=M[qe]||{};this.calculateGlyphDependencies(He.text,de,Ie,this.allowVerticalPlacement,Ue)}}}h.get("symbol-placement")==="line"&&(this.features=function(q){let $={},ne={},J=[],ie=0;function ce(Me){J.push(q[Me]),ie++}function ge(Me,Ie,He){let Ue=ne[Me];return delete ne[Me],ne[Ie]=Ue,J[Ue].geometry[0].pop(),J[Ue].geometry[0]=J[Ue].geometry[0].concat(He[0]),Ue}function Be(Me,Ie,He){let Ue=$[Ie];return delete $[Ie],$[Me]=Ue,J[Ue].geometry[0].shift(),J[Ue].geometry[0]=He[0].concat(J[Ue].geometry[0]),Ue}function it(Me,Ie,He){let Ue=He?Ie[0][Ie[0].length-1]:Ie[0][0];return`${Me}:${Ue.x}:${Ue.y}`}for(let Me=0;Me<q.length;Me++){let Ie=q[Me],He=Ie.geometry,Ue=Ie.text?Ie.text.toString():null;if(!Ue){ce(Me);continue}let qe=it(Ue,He),de=it(Ue,He,!0);if(qe in ne&&de in $&&ne[qe]!==$[de]){let Xe=Be(qe,de,He),Ze=ge(qe,de,J[Xe].geometry);delete $[qe],delete ne[de],ne[it(Ue,J[Ze].geometry,!0)]=Ze,J[Xe].geometry=null}else qe in ne?ge(qe,de,He):de in $?Be(qe,de,He):(ce(Me),$[qe]=ie-1,ne[de]=ie-1)}return J.filter(Me=>Me.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((q,$)=>q.sortKey-$.sortKey)}update(t,r,a){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,r,this.layers,a),this.icon.programConfigurations.updatePaintArrays(t,r,this.layers,a))}isEmpty(){return this.symbolInstances.length===0&&!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,r){let a=this.lineVertexArray.length;if(t.segment!==void 0){let l=t.dist(r[t.segment+1]),h=t.dist(r[t.segment]),d={};for(let f=t.segment+1;f<r.length;f++)d[f]={x:r[f].x,y:r[f].y,tileUnitDistanceFromAnchor:l},f<r.length-1&&(l+=r[f+1].dist(r[f]));for(let f=t.segment||0;f>=0;f--)d[f]={x:r[f].x,y:r[f].y,tileUnitDistanceFromAnchor:h},f>0&&(h+=r[f-1].dist(r[f]));for(let f=0;f<r.length;f++){let g=d[f];this.lineVertexArray.emplaceBack(g.x,g.y,g.tileUnitDistanceFromAnchor)}}return{lineStartIndex:a,lineLength:this.lineVertexArray.length-a}}addSymbols(t,r,a,l,h,d,f,g,v,x,A,D){let M=t.indexArray,z=t.layoutVertexArray,B=t.segments.prepareSegment(4*r.length,z,M,this.canOverlap?d.sortKey:void 0),q=this.glyphOffsetArray.length,$=B.vertexLength,ne=this.allowVerticalPlacement&&f===E.ah.vertical?Math.PI/2:0,J=d.text&&d.text.sections;for(let ie=0;ie<r.length;ie++){let{tl:ce,tr:ge,bl:Be,br:it,tex:Me,pixelOffsetTL:Ie,pixelOffsetBR:He,minFontScaleX:Ue,minFontScaleY:qe,glyphOffset:de,isSDF:Xe,sectionIndex:Ze}=r[ie],lt=B.vertexLength,Jt=de[1];du(z,g.x,g.y,ce.x,Jt+ce.y,Me.x,Me.y,a,Xe,Ie.x,Ie.y,Ue,qe),du(z,g.x,g.y,ge.x,Jt+ge.y,Me.x+Me.w,Me.y,a,Xe,He.x,Ie.y,Ue,qe),du(z,g.x,g.y,Be.x,Jt+Be.y,Me.x,Me.y+Me.h,a,Xe,Ie.x,He.y,Ue,qe),du(z,g.x,g.y,it.x,Jt+it.y,Me.x+Me.w,Me.y+Me.h,a,Xe,He.x,He.y,Ue,qe),kc(t.dynamicLayoutVertexArray,g,ne),M.emplaceBack(lt,lt+1,lt+2),M.emplaceBack(lt+1,lt+2,lt+3),B.vertexLength+=4,B.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(de[0]),ie!==r.length-1&&Ze===r[ie+1].sectionIndex||t.programConfigurations.populatePaintArrays(z.length,d,d.index,{},D,J&&J[Ze])}t.placedSymbolArray.emplaceBack(g.x,g.y,q,this.glyphOffsetArray.length-q,$,v,x,g.segment,a?a[0]:0,a?a[1]:0,l[0],l[1],f,0,!1,0,A)}_addCollisionDebugVertex(t,r,a,l,h,d){return r.emplaceBack(0,0),t.emplaceBack(a.x,a.y,l,h,Math.round(d.x),Math.round(d.y))}addCollisionDebugVertices(t,r,a,l,h,d,f){let g=h.segments.prepareSegment(4,h.layoutVertexArray,h.indexArray),v=g.vertexLength,x=h.layoutVertexArray,A=h.collisionVertexArray,D=f.anchorX,M=f.anchorY;this._addCollisionDebugVertex(x,A,d,D,M,new se(t,r)),this._addCollisionDebugVertex(x,A,d,D,M,new se(a,r)),this._addCollisionDebugVertex(x,A,d,D,M,new se(a,l)),this._addCollisionDebugVertex(x,A,d,D,M,new se(t,l)),g.vertexLength+=4;let z=h.indexArray;z.emplaceBack(v,v+1),z.emplaceBack(v+1,v+2),z.emplaceBack(v+2,v+3),z.emplaceBack(v+3,v),g.primitiveLength+=4}addDebugCollisionBoxes(t,r,a,l){for(let h=t;h<r;h++){let d=this.collisionBoxArray.get(h);this.addCollisionDebugVertices(d.x1,d.y1,d.x2,d.y2,l?this.textCollisionBox:this.iconCollisionBox,d.anchorPoint,a)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Pc(Tr,Xh.members,ki),this.iconCollisionBox=new Pc(Tr,Xh.members,ki);for(let t=0;t<this.symbolInstances.length;t++){let r=this.symbolInstances.get(t);this.addDebugCollisionBoxes(r.textBoxStartIndex,r.textBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.iconBoxStartIndex,r.iconBoxEndIndex,r,!1),this.addDebugCollisionBoxes(r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex,r,!1)}}_deserializeCollisionBoxesForSymbol(t,r,a,l,h,d,f,g,v){let x={};for(let A=r;A<a;A++){let D=t.get(A);x.textBox={x1:D.x1,y1:D.y1,x2:D.x2,y2:D.y2,anchorPointX:D.anchorPointX,anchorPointY:D.anchorPointY},x.textFeatureIndex=D.featureIndex;break}for(let A=l;A<h;A++){let D=t.get(A);x.verticalTextBox={x1:D.x1,y1:D.y1,x2:D.x2,y2:D.y2,anchorPointX:D.anchorPointX,anchorPointY:D.anchorPointY},x.verticalTextFeatureIndex=D.featureIndex;break}for(let A=d;A<f;A++){let D=t.get(A);x.iconBox={x1:D.x1,y1:D.y1,x2:D.x2,y2:D.y2,anchorPointX:D.anchorPointX,anchorPointY:D.anchorPointY},x.iconFeatureIndex=D.featureIndex;break}for(let A=g;A<v;A++){let D=t.get(A);x.verticalIconBox={x1:D.x1,y1:D.y1,x2:D.x2,y2:D.y2,anchorPointX:D.anchorPointX,anchorPointY:D.anchorPointY},x.verticalIconFeatureIndex=D.featureIndex;break}return x}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let r=0;r<this.symbolInstances.length;r++){let a=this.symbolInstances.get(r);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,a.textBoxStartIndex,a.textBoxEndIndex,a.verticalTextBoxStartIndex,a.verticalTextBoxEndIndex,a.iconBoxStartIndex,a.iconBoxEndIndex,a.verticalIconBoxStartIndex,a.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(t,r){let a=t.placedSymbolArray.get(r),l=a.vertexStartIndex+4*a.numGlyphs;for(let h=a.vertexStartIndex;h<l;h+=4)t.indexArray.emplaceBack(h,h+1,h+2),t.indexArray.emplaceBack(h+1,h+2,h+3)}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;let r=Math.sin(t),a=Math.cos(t),l=[],h=[],d=[];for(let f=0;f<this.symbolInstances.length;++f){d.push(f);let g=this.symbolInstances.get(f);l.push(0|Math.round(r*g.anchorX+a*g.anchorY)),h.push(g.featureIndex)}return d.sort((f,g)=>l[f]-l[g]||h[g]-h[f]),d}addToSortKeyRanges(t,r){let a=this.sortKeyRanges[this.sortKeyRanges.length-1];a&&a.sortKey===r?a.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:r,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(let r of this.symbolInstanceIndexes){let a=this.symbolInstances.get(r);this.featureSortOrder.push(a.featureIndex),[a.rightJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.leftJustifiedTextSymbolIndex].forEach((l,h,d)=>{l>=0&&d.indexOf(l)===h&&this.addIndicesForPlacedSymbol(this.text,l)}),a.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,a.verticalPlacedTextSymbolIndex),a.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,a.placedIconSymbolIndex),a.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,a.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let pp,dp;Ve("SymbolBucket",Ns,{omit:["layers","collisionBoxArray","features","compareText"]}),Ns.MAX_GLYPHS=65535,Ns.addDynamicAttributes=kc;var zc={get paint(){return dp=dp||new c({"icon-opacity":new rt(oe.paint_symbol["icon-opacity"]),"icon-color":new rt(oe.paint_symbol["icon-color"]),"icon-halo-color":new rt(oe.paint_symbol["icon-halo-color"]),"icon-halo-width":new rt(oe.paint_symbol["icon-halo-width"]),"icon-halo-blur":new rt(oe.paint_symbol["icon-halo-blur"]),"icon-translate":new je(oe.paint_symbol["icon-translate"]),"icon-translate-anchor":new je(oe.paint_symbol["icon-translate-anchor"]),"text-opacity":new rt(oe.paint_symbol["text-opacity"]),"text-color":new rt(oe.paint_symbol["text-color"],{runtimeType:Si,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new rt(oe.paint_symbol["text-halo-color"]),"text-halo-width":new rt(oe.paint_symbol["text-halo-width"]),"text-halo-blur":new rt(oe.paint_symbol["text-halo-blur"]),"text-translate":new je(oe.paint_symbol["text-translate"]),"text-translate-anchor":new je(oe.paint_symbol["text-translate-anchor"])})},get layout(){return pp=pp||new c({"symbol-placement":new je(oe.layout_symbol["symbol-placement"]),"symbol-spacing":new je(oe.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new je(oe.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new rt(oe.layout_symbol["symbol-sort-key"]),"symbol-z-order":new je(oe.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new je(oe.layout_symbol["icon-allow-overlap"]),"icon-overlap":new je(oe.layout_symbol["icon-overlap"]),"icon-ignore-placement":new je(oe.layout_symbol["icon-ignore-placement"]),"icon-optional":new je(oe.layout_symbol["icon-optional"]),"icon-rotation-alignment":new je(oe.layout_symbol["icon-rotation-alignment"]),"icon-size":new rt(oe.layout_symbol["icon-size"]),"icon-text-fit":new je(oe.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new je(oe.layout_symbol["icon-text-fit-padding"]),"icon-image":new rt(oe.layout_symbol["icon-image"]),"icon-rotate":new rt(oe.layout_symbol["icon-rotate"]),"icon-padding":new rt(oe.layout_symbol["icon-padding"]),"icon-keep-upright":new je(oe.layout_symbol["icon-keep-upright"]),"icon-offset":new rt(oe.layout_symbol["icon-offset"]),"icon-anchor":new rt(oe.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new je(oe.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new je(oe.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new je(oe.layout_symbol["text-rotation-alignment"]),"text-field":new rt(oe.layout_symbol["text-field"]),"text-font":new rt(oe.layout_symbol["text-font"]),"text-size":new rt(oe.layout_symbol["text-size"]),"text-max-width":new rt(oe.layout_symbol["text-max-width"]),"text-line-height":new je(oe.layout_symbol["text-line-height"]),"text-letter-spacing":new rt(oe.layout_symbol["text-letter-spacing"]),"text-justify":new rt(oe.layout_symbol["text-justify"]),"text-radial-offset":new rt(oe.layout_symbol["text-radial-offset"]),"text-variable-anchor":new je(oe.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new rt(oe.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new rt(oe.layout_symbol["text-anchor"]),"text-max-angle":new je(oe.layout_symbol["text-max-angle"]),"text-writing-mode":new je(oe.layout_symbol["text-writing-mode"]),"text-rotate":new rt(oe.layout_symbol["text-rotate"]),"text-padding":new je(oe.layout_symbol["text-padding"]),"text-keep-upright":new je(oe.layout_symbol["text-keep-upright"]),"text-transform":new rt(oe.layout_symbol["text-transform"]),"text-offset":new rt(oe.layout_symbol["text-offset"]),"text-allow-overlap":new je(oe.layout_symbol["text-allow-overlap"]),"text-overlap":new je(oe.layout_symbol["text-overlap"]),"text-ignore-placement":new je(oe.layout_symbol["text-ignore-placement"]),"text-optional":new je(oe.layout_symbol["text-optional"])})}};class fp{constructor(t){if(t.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=t.property.overrides?t.property.overrides.runtimeType:Pr,this.defaultValue=t}evaluate(t){if(t.formattedSection){let r=this.defaultValue.property.overrides;if(r&&r.hasOverride(t.formattedSection))return r.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}}Ve("FormatSectionOverride",fp,{omit:["defaultValue"]});class fu extends n{constructor(t){super(t,zc)}recalculate(t,r){if(super.recalculate(t,r),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){let a=this.layout.get("text-writing-mode");if(a){let l=[];for(let h of a)l.indexOf(h)<0&&l.push(h);this.layout._values["text-writing-mode"]=l}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(t,r,a,l){let h=this.layout.get(t).evaluate(r,{},a,l),d=this._unevaluatedLayout._values[t];return d.isDataDriven()||ps(d.value)||!h?h:function(f,g){return g.replace(/{([^{}]+)}/g,(v,x)=>f&&x in f?String(f[x]):"")}(r.properties,h)}createBucket(t){return new Ns(t)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let t of zc.paint.overridableProperties){if(!fu.hasPaintOverride(this.layout,t))continue;let r=this.paint.get(t),a=new fp(r),l=new hs(a,r.property.specification),h=null;h=r.value.kind==="constant"||r.value.kind==="source"?new Yn("source",l):new Qn("composite",l,r.value.zoomStops),this.paint._values[t]=new Xr(r.property,h,r.parameters)}}_handleOverridablePaintPropertyUpdate(t,r,a){return!(!this.layout||r.isDataDriven()||a.isDataDriven())&&fu.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,r){let a=t.get("text-field"),l=zc.paint.properties[r],h=!1,d=f=>{for(let g of f)if(l.overrides&&l.overrides.hasOverride(g))return void(h=!0)};if(a.value.kind==="constant"&&a.value.value instanceof ur)d(a.value.value.sections);else if(a.value.kind==="source"){let f=v=>{h||(v instanceof zr&&vi(v.value)===yr?d(v.value.sections):v instanceof is?d(v.sections):v.eachChild(f))},g=a.value;g._styleExpression&&f(g._styleExpression.expression)}return h}}let mp;var _m={get paint(){return mp=mp||new c({"background-color":new je(oe.paint_background["background-color"]),"background-pattern":new Ts(oe.paint_background["background-pattern"]),"background-opacity":new je(oe.paint_background["background-opacity"])})}};class ym extends n{constructor(t){super(t,_m)}}let gp;var vm={get paint(){return gp=gp||new c({"raster-opacity":new je(oe.paint_raster["raster-opacity"]),"raster-hue-rotate":new je(oe.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new je(oe.paint_raster["raster-brightness-min"]),"raster-brightness-max":new je(oe.paint_raster["raster-brightness-max"]),"raster-saturation":new je(oe.paint_raster["raster-saturation"]),"raster-contrast":new je(oe.paint_raster["raster-contrast"]),"raster-resampling":new je(oe.paint_raster["raster-resampling"]),"raster-fade-duration":new je(oe.paint_raster["raster-fade-duration"])})}};class xm extends n{constructor(t){super(t,vm)}}class bm extends n{constructor(t){super(t,{}),this.onAdd=r=>{this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)},this.onRemove=r=>{this.implementation.onRemove&&this.implementation.onRemove(r,r.painter.context.gl)},this.implementation=t}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class wm{constructor(t){this._methodToThrottle=t,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}let Bc=63710088e-1;class _a{constructor(t,r){if(isNaN(t)||isNaN(r))throw new Error(`Invalid LngLat object: (${t}, ${r})`);if(this.lng=+t,this.lat=+r,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new _a(Fe(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){let r=Math.PI/180,a=this.lat*r,l=t.lat*r,h=Math.sin(a)*Math.sin(l)+Math.cos(a)*Math.cos(l)*Math.cos((t.lng-this.lng)*r);return Bc*Math.acos(Math.min(h,1))}static convert(t){if(t instanceof _a)return t;if(Array.isArray(t)&&(t.length===2||t.length===3))return new _a(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&typeof t=="object"&&t!==null)return new _a(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>]")}}let _p=2*Math.PI*Bc;function yp(i){return _p*Math.cos(i*Math.PI/180)}function vp(i){return(180+i)/360}function xp(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function bp(i,t){return i/yp(t)}function Lc(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}class il{constructor(t,r,a=0){this.x=+t,this.y=+r,this.z=+a}static fromLngLat(t,r=0){let a=_a.convert(t);return new il(vp(a.lng),xp(a.lat),bp(r,a.lat))}toLngLat(){return new _a(360*this.x-180,Lc(this.y))}toAltitude(){return this.z*yp(Lc(this.y))}meterInMercatorCoordinateUnits(){return 1/_p*(t=Lc(this.y),1/Math.cos(t*Math.PI/180));var t}}function wp(i,t,r){var a=2*Math.PI*6378137/256/Math.pow(2,r);return[i*a-2*Math.PI*6378137/2,t*a-2*Math.PI*6378137/2]}class Rc{constructor(t,r,a){if(!function(l,h,d){return!(l<0||l>25||d<0||d>=Math.pow(2,l)||h<0||h>=Math.pow(2,l))}(t,r,a))throw new Error(`x=${r}, y=${a}, 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=r,this.y=a,this.key=rl(0,t,t,r,a)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,r,a){let l=(d=this.y,f=this.z,g=wp(256*(h=this.x),256*(d=Math.pow(2,f)-d-1),f),v=wp(256*(h+1),256*(d+1),f),g[0]+","+g[1]+","+v[0]+","+v[1]);var h,d,f,g,v;let x=function(A,D,M){let z,B="";for(let q=A;q>0;q--)z=1<<q-1,B+=(D&z?1:0)+(M&z?2:0);return B}(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(a==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,r>1?"@2x":"").replace(/{quadkey}/g,x).replace(/{bbox-epsg-3857}/g,l)}isChildOf(t){let r=this.z-t.z;return r>0&&t.x===this.x>>r&&t.y===this.y>>r}getTilePoint(t){let r=Math.pow(2,this.z);return new se((t.x*r-this.x)*xi,(t.y*r-this.y)*xi)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Ap{constructor(t,r){this.wrap=t,this.canonical=r,this.key=rl(t,r.z,r.z,r.x,r.y)}}class Vr{constructor(t,r,a,l,h){if(t<a)throw new Error(`overscaledZ should be >= z; overscaledZ = ${t}; z = ${a}`);this.overscaledZ=t,this.wrap=r,this.canonical=new Rc(a,+l,+h),this.key=rl(r,t,a,l,h)}clone(){return new Vr(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}`);let r=this.canonical.z-t;return t>this.canonical.z?new Vr(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Vr(t,this.wrap,t,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(t,r){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);let a=this.canonical.z-t;return t>this.canonical.z?rl(this.wrap*+r,t,this.canonical.z,this.canonical.x,this.canonical.y):rl(this.wrap*+r,t,t,this.canonical.x>>a,this.canonical.y>>a)}isChildOf(t){if(t.wrap!==this.wrap)return!1;let r=this.canonical.z-t.canonical.z;return t.overscaledZ===0||t.overscaledZ<this.overscaledZ&&t.canonical.x===this.canonical.x>>r&&t.canonical.y===this.canonical.y>>r}children(t){if(this.overscaledZ>=t)return[new Vr(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let r=this.canonical.z+1,a=2*this.canonical.x,l=2*this.canonical.y;return[new Vr(r,this.wrap,r,a,l),new Vr(r,this.wrap,r,a+1,l),new Vr(r,this.wrap,r,a,l+1),new Vr(r,this.wrap,r,a+1,l+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 Vr(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new Vr(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 Ap(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(t){return this.canonical.getTilePoint(new il(t.x-this.wrap,t.y))}}function rl(i,t,r,a,l){(i*=2)<0&&(i=-1*i-1);let h=1<<r;return(h*h*i+h*l+a).toString(36)+r.toString(36)+t.toString(36)}Ve("CanonicalTileID",Rc),Ve("OverscaledTileID",Vr,{omit:["posMatrix"]});class Ep{constructor(t,r,a,l=1,h=1,d=1,f=0){if(this.uid=t,r.height!==r.width)throw new RangeError("DEM tiles must be square");if(a&&!["mapbox","terrarium","custom"].includes(a))return void Pe(`"${a}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=r.height;let g=this.dim=r.height-2;switch(this.data=new Uint32Array(r.data.buffer),a){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=l,this.greenFactor=h,this.blueFactor=d,this.baseShift=f;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let v=0;v<g;v++)this.data[this._idx(-1,v)]=this.data[this._idx(0,v)],this.data[this._idx(g,v)]=this.data[this._idx(g-1,v)],this.data[this._idx(v,-1)]=this.data[this._idx(v,0)],this.data[this._idx(v,g)]=this.data[this._idx(v,g-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(g,-1)]=this.data[this._idx(g-1,0)],this.data[this._idx(-1,g)]=this.data[this._idx(0,g-1)],this.data[this._idx(g,g)]=this.data[this._idx(g-1,g-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let v=0;v<g;v++)for(let x=0;x<g;x++){let A=this.get(v,x);A>this.max&&(this.max=A),A<this.min&&(this.min=A)}}get(t,r){let a=new Uint8Array(this.data.buffer),l=4*this._idx(t,r);return this.unpack(a[l],a[l+1],a[l+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(t,r){if(t<-1||t>=this.dim+1||r<-1||r>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(r+1)*this.stride+(t+1)}unpack(t,r,a){return t*this.redFactor+r*this.greenFactor+a*this.blueFactor-this.baseShift}getPixels(){return new qr({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,r,a){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let l=r*this.dim,h=r*this.dim+this.dim,d=a*this.dim,f=a*this.dim+this.dim;switch(r){case-1:l=h-1;break;case 1:h=l+1}switch(a){case-1:d=f-1;break;case 1:f=d+1}let g=-r*this.dim,v=-a*this.dim;for(let x=d;x<f;x++)for(let A=l;A<h;A++)this.data[this._idx(A,x)]=t.data[this._idx(A+g,x+v)]}}Ve("DEMData",Ep);class Tp{constructor(t){this._stringToNumber={},this._numberToString=[];for(let r=0;r<t.length;r++){let a=t[r];this._stringToNumber[a]=r,this._numberToString[r]=a}}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 Cp{constructor(t,r,a,l,h){this.type="Feature",this._vectorTileFeature=t,t._z=r,t._x=a,t._y=l,this.properties=t.properties,this.id=h}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(t){this._geometry=t}toJSON(){let t={geometry:this.geometry};for(let r in this)r!=="_geometry"&&r!=="_vectorTileFeature"&&(t[r]=this[r]);return t}}class Dp{constructor(t,r){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new ra(xi,16,0),this.grid3D=new ra(xi,16,0),this.featureIndexArray=new $i,this.promoteId=r}insert(t,r,a,l,h,d){let f=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(a,l,h);let g=d?this.grid3D:this.grid;for(let v=0;v<r.length;v++){let x=r[v],A=[1/0,1/0,-1/0,-1/0];for(let D=0;D<x.length;D++){let M=x[D];A[0]=Math.min(A[0],M.x),A[1]=Math.min(A[1],M.y),A[2]=Math.max(A[2],M.x),A[3]=Math.max(A[3],M.y)}A[0]<xi&&A[1]<xi&&A[2]>=0&&A[3]>=0&&g.insert(f,A[0],A[1],A[2],A[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new fa.VectorTile(new Ec(this.rawTileData)).layers,this.sourceLayerCoder=new Tp(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(t,r,a,l){this.loadVTLayers();let h=t.params||{},d=xi/t.tileSize/t.scale,f=wo(h.filter),g=t.queryGeometry,v=t.queryPadding*d,x=Ip(g),A=this.grid.query(x.minX-v,x.minY-v,x.maxX+v,x.maxY+v),D=Ip(t.cameraQueryGeometry),M=this.grid3D.query(D.minX-v,D.minY-v,D.maxX+v,D.maxY+v,(q,$,ne,J)=>function(ie,ce,ge,Be,it){for(let Ie of ie)if(ce<=Ie.x&&ge<=Ie.y&&Be>=Ie.x&&it>=Ie.y)return!0;let Me=[new se(ce,ge),new se(ce,it),new se(Be,it),new se(Be,ge)];if(ie.length>2){for(let Ie of Me)if(Ps(ie,Ie))return!0}for(let Ie=0;Ie<ie.length-1;Ie++)if(tf(ie[Ie],ie[Ie+1],Me))return!0;return!1}(t.cameraQueryGeometry,q-v,$-v,ne+v,J+v));for(let q of M)A.push(q);A.sort(Am);let z={},B;for(let q=0;q<A.length;q++){let $=A[q];if($===B)continue;B=$;let ne=this.featureIndexArray.get($),J=null;this.loadMatchingFeature(z,ne.bucketIndex,ne.sourceLayerIndex,ne.featureIndex,f,h.layers,h.availableImages,r,a,l,(ie,ce,ge)=>(J||(J=ja(ie)),ce.queryIntersectsFeature(g,ie,ge,J,this.z,t.transform,d,t.pixelPosMatrix)))}return z}loadMatchingFeature(t,r,a,l,h,d,f,g,v,x,A){let D=this.bucketLayerIDs[r];if(d&&!function(q,$){for(let ne=0;ne<q.length;ne++)if($.indexOf(q[ne])>=0)return!0;return!1}(d,D))return;let M=this.sourceLayerCoder.decode(a),z=this.vtLayers[M].feature(l);if(h.needGeometry){let q=$a(z,!0);if(!h.filter(new ti(this.tileID.overscaledZ),q,this.tileID.canonical))return}else if(!h.filter(new ti(this.tileID.overscaledZ),z))return;let B=this.getId(z,M);for(let q=0;q<D.length;q++){let $=D[q];if(d&&d.indexOf($)<0)continue;let ne=g[$];if(!ne)continue;let J={};B&&x&&(J=x.getState(ne.sourceLayer||"_geojsonTileLayer",B));let ie=Ye({},v[$]);ie.paint=Sp(ie.paint,ne.paint,z,J,f),ie.layout=Sp(ie.layout,ne.layout,z,J,f);let ce=!A||A(z,ne,J);if(!ce)continue;let ge=new Cp(z,this.z,this.x,this.y,B);ge.layer=ie;let Be=t[$];Be===void 0&&(Be=t[$]=[]),Be.push({featureIndex:l,feature:ge,intersectionZ:ce})}}lookupSymbolFeatures(t,r,a,l,h,d,f,g){let v={};this.loadVTLayers();let x=wo(h);for(let A of t)this.loadMatchingFeature(v,a,l,A,x,d,f,g,r);return v}hasLayer(t){for(let r of this.bucketLayerIDs)for(let a of r)if(t===a)return!0;return!1}getId(t,r){let a=t.id;return this.promoteId&&(a=t.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[r]],typeof a=="boolean"&&(a=Number(a))),a}}function Sp(i,t,r,a,l){return xe(i,(h,d)=>{let f=t instanceof Na?t.get(d):null;return f&&f.evaluate?f.evaluate(r,a,l):f})}function Ip(i){let t=1/0,r=1/0,a=-1/0,l=-1/0;for(let h of i)t=Math.min(t,h.x),r=Math.min(r,h.y),a=Math.max(a,h.x),l=Math.max(l,h.y);return{minX:t,minY:r,maxX:a,maxY:l}}function Am(i,t){return t-i}function kp(i,t,r,a,l){let h=[];for(let d=0;d<i.length;d++){let f=i[d],g;for(let v=0;v<f.length-1;v++){let x=f[v],A=f[v+1];x.x<t&&A.x<t||(x.x<t?x=new se(t,x.y+(t-x.x)/(A.x-x.x)*(A.y-x.y))._round():A.x<t&&(A=new se(t,x.y+(t-x.x)/(A.x-x.x)*(A.y-x.y))._round()),x.y<r&&A.y<r||(x.y<r?x=new se(x.x+(r-x.y)/(A.y-x.y)*(A.x-x.x),r)._round():A.y<r&&(A=new se(x.x+(r-x.y)/(A.y-x.y)*(A.x-x.x),r)._round()),x.x>=a&&A.x>=a||(x.x>=a?x=new se(a,x.y+(a-x.x)/(A.x-x.x)*(A.y-x.y))._round():A.x>=a&&(A=new se(a,x.y+(a-x.x)/(A.x-x.x)*(A.y-x.y))._round()),x.y>=l&&A.y>=l||(x.y>=l?x=new se(x.x+(l-x.y)/(A.y-x.y)*(A.x-x.x),l)._round():A.y>=l&&(A=new se(x.x+(l-x.y)/(A.y-x.y)*(A.x-x.x),l)._round()),g&&x.equals(g[g.length-1])||(g=[x],h.push(g)),g.push(A)))))}}return h}Ve("FeatureIndex",Dp,{omit:["rawTileData","sourceLayerCoder"]});class ya extends se{constructor(t,r,a,l){super(t,r),this.angle=a,l!==void 0&&(this.segment=l)}clone(){return new ya(this.x,this.y,this.angle,this.segment)}}function Mp(i,t,r,a,l){if(t.segment===void 0||r===0)return!0;let h=t,d=t.segment+1,f=0;for(;f>-r/2;){if(d--,d<0)return!1;f-=i[d].dist(h),h=i[d]}f+=i[d].dist(i[d+1]),d++;let g=[],v=0;for(;f<r/2;){let x=i[d],A=i[d+1];if(!A)return!1;let D=i[d-1].angleTo(x)-x.angleTo(A);for(D=Math.abs((D+3*Math.PI)%(2*Math.PI)-Math.PI),g.push({distance:f,angleDelta:D}),v+=D;f-g[0].distance>a;)v-=g.shift().angleDelta;if(v>l)return!1;d++,f+=x.dist(A)}return!0}function Pp(i){let t=0;for(let r=0;r<i.length-1;r++)t+=i[r].dist(i[r+1]);return t}function zp(i,t,r){return i?.6*t*r:0}function Bp(i,t){return Math.max(i?i.right-i.left:0,t?t.right-t.left:0)}function Em(i,t,r,a,l,h){let d=zp(r,l,h),f=Bp(r,a)*h,g=0,v=Pp(i)/2;for(let x=0;x<i.length-1;x++){let A=i[x],D=i[x+1],M=A.dist(D);if(g+M>v){let z=(v-g)/M,B=Yi.number(A.x,D.x,z),q=Yi.number(A.y,D.y,z),$=new ya(B,q,D.angleTo(A),x);return $._round(),!d||Mp(i,$,f,d,t)?$:void 0}g+=M}}function Tm(i,t,r,a,l,h,d,f,g){let v=zp(a,h,d),x=Bp(a,l),A=x*d,D=i[0].x===0||i[0].x===g||i[0].y===0||i[0].y===g;return t-A<t/4&&(t=A+t/4),Lp(i,D?t/2*f%t:(x/2+2*h)*d*f%t,t,v,r,A,D,!1,g)}function Lp(i,t,r,a,l,h,d,f,g){let v=h/2,x=Pp(i),A=0,D=t-r,M=[];for(let z=0;z<i.length-1;z++){let B=i[z],q=i[z+1],$=B.dist(q),ne=q.angleTo(B);for(;D+r<A+$;){D+=r;let J=(D-A)/$,ie=Yi.number(B.x,q.x,J),ce=Yi.number(B.y,q.y,J);if(ie>=0&&ie<g&&ce>=0&&ce<g&&D-v>=0&&D+v<=x){let ge=new ya(ie,ce,ne,z);ge._round(),a&&!Mp(i,ge,h,a,l)||M.push(ge)}}A+=$}return f||M.length||d||(M=Lp(i,A/2,r,a,l,h,d,!0,g)),M}Ve("Anchor",ya);let qs=mr;function Rp(i,t,r,a){let l=[],h=i.image,d=h.pixelRatio,f=h.paddedRect.w-2*qs,g=h.paddedRect.h-2*qs,v={x1:i.left,y1:i.top,x2:i.right,y2:i.bottom},x=h.stretchX||[[0,f]],A=h.stretchY||[[0,g]],D=(de,Xe)=>de+Xe[1]-Xe[0],M=x.reduce(D,0),z=A.reduce(D,0),B=f-M,q=g-z,$=0,ne=M,J=0,ie=z,ce=0,ge=B,Be=0,it=q;if(h.content&&a){let de=h.content,Xe=de[2]-de[0],Ze=de[3]-de[1];(h.textFitWidth||h.textFitHeight)&&(v=up(i)),$=mu(x,0,de[0]),J=mu(A,0,de[1]),ne=mu(x,de[0],de[2]),ie=mu(A,de[1],de[3]),ce=de[0]-$,Be=de[1]-J,ge=Xe-ne,it=Ze-ie}let Me=v.x1,Ie=v.y1,He=v.x2-Me,Ue=v.y2-Ie,qe=(de,Xe,Ze,lt)=>{let Jt=gu(de.stretch-$,ne,He,Me),Xt=_u(de.fixed-ce,ge,de.stretch,M),Ti=gu(Xe.stretch-J,ie,Ue,Ie),Jr=_u(Xe.fixed-Be,it,Xe.stretch,z),Fi=gu(Ze.stretch-$,ne,He,Me),Ci=_u(Ze.fixed-ce,ge,Ze.stretch,M),ir=gu(lt.stretch-J,ie,Ue,Ie),rr=_u(lt.fixed-Be,it,lt.stretch,z),nr=new se(Jt,Ti),mi=new se(Fi,Ti),Di=new se(Fi,ir),Gi=new se(Jt,ir),Oi=new se(Xt/d,Jr/d),ar=new se(Ci/d,rr/d),Ni=t*Math.PI/180;if(Ni){let Ft=Math.sin(Ni),Qt=Math.cos(Ni),ai=[Qt,-Ft,Ft,Qt];nr._matMult(ai),mi._matMult(ai),Gi._matMult(ai),Di._matMult(ai)}let Ur=de.stretch+de.fixed,gr=Xe.stretch+Xe.fixed;return{tl:nr,tr:mi,bl:Gi,br:Di,tex:{x:h.paddedRect.x+qs+Ur,y:h.paddedRect.y+qs+gr,w:Ze.stretch+Ze.fixed-Ur,h:lt.stretch+lt.fixed-gr},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Oi,pixelOffsetBR:ar,minFontScaleX:ge/d/He,minFontScaleY:it/d/Ue,isSDF:r}};if(a&&(h.stretchX||h.stretchY)){let de=Fp(x,B,M),Xe=Fp(A,q,z);for(let Ze=0;Ze<de.length-1;Ze++){let lt=de[Ze],Jt=de[Ze+1];for(let Xt=0;Xt<Xe.length-1;Xt++)l.push(qe(lt,Xe[Xt],Jt,Xe[Xt+1]))}}else l.push(qe({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:f+1},{fixed:0,stretch:g+1}));return l}function mu(i,t,r){let a=0;for(let l of i)a+=Math.max(t,Math.min(r,l[1]))-Math.max(t,Math.min(r,l[0]));return a}function Fp(i,t,r){let a=[{fixed:-qs,stretch:0}];for(let[l,h]of i){let d=a[a.length-1];a.push({fixed:l-d.stretch,stretch:d.stretch}),a.push({fixed:l-d.stretch,stretch:d.stretch+(h-l)})}return a.push({fixed:t+qs,stretch:r}),a}function gu(i,t,r,a){return i/t*r+a}function _u(i,t,r,a){return i-t*r/a}class yu{constructor(t,r,a,l,h,d,f,g,v,x){var A;if(this.boxStartIndex=t.length,v){let D=d.top,M=d.bottom,z=d.collisionPadding;z&&(D-=z[1],M+=z[3]);let B=M-D;B>0&&(B=Math.max(10,B),this.circleDiameter=B)}else{let D=!((A=d.image)===null||A===void 0)&&A.content&&(d.image.textFitWidth||d.image.textFitHeight)?up(d):{x1:d.left,y1:d.top,x2:d.right,y2:d.bottom};D.y1=D.y1*f-g[0],D.y2=D.y2*f+g[2],D.x1=D.x1*f-g[3],D.x2=D.x2*f+g[1];let M=d.collisionPadding;if(M&&(D.x1-=M[0]*f,D.y1-=M[1]*f,D.x2+=M[2]*f,D.y2+=M[3]*f),x){let z=new se(D.x1,D.y1),B=new se(D.x2,D.y1),q=new se(D.x1,D.y2),$=new se(D.x2,D.y2),ne=x*Math.PI/180;z._rotate(ne),B._rotate(ne),q._rotate(ne),$._rotate(ne),D.x1=Math.min(z.x,B.x,q.x,$.x),D.x2=Math.max(z.x,B.x,q.x,$.x),D.y1=Math.min(z.y,B.y,q.y,$.y),D.y2=Math.max(z.y,B.y,q.y,$.y)}t.emplaceBack(r.x,r.y,D.x1,D.y1,D.x2,D.y2,a,l,h)}this.boxEndIndex=t.length}}class Cm{constructor(t=[],r=(a,l)=>a<l?-1:a>l?1:0){if(this.data=t,this.length=this.data.length,this.compare=r,this.length>0)for(let a=(this.length>>1)-1;a>=0;a--)this._down(a)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(this.length===0)return;let t=this.data[0],r=this.data.pop();return--this.length>0&&(this.data[0]=r,this._down(0)),t}peek(){return this.data[0]}_up(t){let{data:r,compare:a}=this,l=r[t];for(;t>0;){let h=t-1>>1,d=r[h];if(a(l,d)>=0)break;r[t]=d,t=h}r[t]=l}_down(t){let{data:r,compare:a}=this,l=this.length>>1,h=r[t];for(;t<l;){let d=1+(t<<1),f=d+1;if(f<this.length&&a(r[f],r[d])<0&&(d=f),a(r[d],h)>=0)break;r[t]=r[d],t=d}r[t]=h}}function Dm(i,t=1,r=!1){let a=1/0,l=1/0,h=-1/0,d=-1/0,f=i[0];for(let M=0;M<f.length;M++){let z=f[M];(!M||z.x<a)&&(a=z.x),(!M||z.y<l)&&(l=z.y),(!M||z.x>h)&&(h=z.x),(!M||z.y>d)&&(d=z.y)}let g=Math.min(h-a,d-l),v=g/2,x=new Cm([],Sm);if(g===0)return new se(a,l);for(let M=a;M<h;M+=g)for(let z=l;z<d;z+=g)x.push(new Vs(M+v,z+v,v,i));let A=function(M){let z=0,B=0,q=0,$=M[0];for(let ne=0,J=$.length,ie=J-1;ne<J;ie=ne++){let ce=$[ne],ge=$[ie],Be=ce.x*ge.y-ge.x*ce.y;B+=(ce.x+ge.x)*Be,q+=(ce.y+ge.y)*Be,z+=3*Be}return new Vs(B/z,q/z,0,M)}(i),D=x.length;for(;x.length;){let M=x.pop();(M.d>A.d||!A.d)&&(A=M,r&&console.log("found best %d after %d probes",Math.round(1e4*M.d)/1e4,D)),M.max-A.d<=t||(v=M.h/2,x.push(new Vs(M.p.x-v,M.p.y-v,v,i)),x.push(new Vs(M.p.x+v,M.p.y-v,v,i)),x.push(new Vs(M.p.x-v,M.p.y+v,v,i)),x.push(new Vs(M.p.x+v,M.p.y+v,v,i)),D+=4)}return r&&(console.log(`num probes: ${D}`),console.log(`best distance: ${A.d}`)),A.p}function Sm(i,t){return t.max-i.max}function Vs(i,t,r,a){this.p=new se(i,t),this.h=r,this.d=function(l,h){let d=!1,f=1/0;for(let g=0;g<h.length;g++){let v=h[g];for(let x=0,A=v.length,D=A-1;x<A;D=x++){let M=v[x],z=v[D];M.y>l.y!=z.y>l.y&&l.x<(z.x-M.x)*(l.y-M.y)/(z.y-M.y)+M.x&&(d=!d),f=Math.min(f,xh(l,M,z))}}return(d?1:-1)*Math.sqrt(f)}(this.p,a),this.max=this.d+this.h*Math.SQRT2}var Ri;E.aq=void 0,(Ri=E.aq||(E.aq={}))[Ri.center=1]="center",Ri[Ri.left=2]="left",Ri[Ri.right=3]="right",Ri[Ri.top=4]="top",Ri[Ri.bottom=5]="bottom",Ri[Ri["top-left"]=6]="top-left",Ri[Ri["top-right"]=7]="top-right",Ri[Ri["bottom-left"]=8]="bottom-left",Ri[Ri["bottom-right"]=9]="bottom-right";let va=7,Fc=Number.POSITIVE_INFINITY;function Op(i,t){return t[1]!==Fc?function(r,a,l){let h=0,d=0;switch(a=Math.abs(a),l=Math.abs(l),r){case"top-right":case"top-left":case"top":d=l-va;break;case"bottom-right":case"bottom-left":case"bottom":d=-l+va}switch(r){case"top-right":case"bottom-right":case"right":h=-a;break;case"top-left":case"bottom-left":case"left":h=a}return[h,d]}(i,t[0],t[1]):function(r,a){let l=0,h=0;a<0&&(a=0);let d=a/Math.SQRT2;switch(r){case"top-right":case"top-left":h=d-va;break;case"bottom-right":case"bottom-left":h=-d+va;break;case"bottom":h=-a+va;break;case"top":h=a-va}switch(r){case"top-right":case"bottom-right":l=-d;break;case"top-left":case"bottom-left":l=d;break;case"left":l=a;break;case"right":l=-a}return[l,h]}(i,t[0])}function Np(i,t,r){var a;let l=i.layout,h=(a=l.get("text-variable-anchor-offset"))===null||a===void 0?void 0:a.evaluate(t,{},r);if(h){let f=h.values,g=[];for(let v=0;v<f.length;v+=2){let x=g[v]=f[v],A=f[v+1].map(D=>D*wi);x.startsWith("top")?A[1]-=va:x.startsWith("bottom")&&(A[1]+=va),g[v+1]=A}return new vr(g)}let d=l.get("text-variable-anchor");if(d){let f;f=i._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[l.get("text-radial-offset").evaluate(t,{},r)*wi,Fc]:l.get("text-offset").evaluate(t,{},r).map(v=>v*wi);let g=[];for(let v of d)g.push(v,Op(v,f));return new vr(g)}return null}function Oc(i){switch(i){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function Im(i,t,r,a,l,h,d,f,g,v,x){let A=h.textMaxSize.evaluate(t,{});A===void 0&&(A=d);let D=i.layers[0].layout,M=D.get("icon-offset").evaluate(t,{},x),z=Vp(r.horizontal),B=d/24,q=i.tilePixelRatio*B,$=i.tilePixelRatio*A/24,ne=i.tilePixelRatio*f,J=i.tilePixelRatio*D.get("symbol-spacing"),ie=D.get("text-padding")*i.tilePixelRatio,ce=function(de,Xe,Ze,lt=1){let Jt=de.get("icon-padding").evaluate(Xe,{},Ze),Xt=Jt&&Jt.values;return[Xt[0]*lt,Xt[1]*lt,Xt[2]*lt,Xt[3]*lt]}(D,t,x,i.tilePixelRatio),ge=D.get("text-max-angle")/180*Math.PI,Be=D.get("text-rotation-alignment")!=="viewport"&&D.get("symbol-placement")!=="point",it=D.get("icon-rotation-alignment")==="map"&&D.get("symbol-placement")!=="point",Me=D.get("symbol-placement"),Ie=J/2,He=D.get("icon-text-fit"),Ue;a&&He!=="none"&&(i.allowVerticalPlacement&&r.vertical&&(Ue=cp(a,r.vertical,He,D.get("icon-text-fit-padding"),M,B)),z&&(a=cp(a,z,He,D.get("icon-text-fit-padding"),M,B)));let qe=(de,Xe)=>{Xe.x<0||Xe.x>=xi||Xe.y<0||Xe.y>=xi||function(Ze,lt,Jt,Xt,Ti,Jr,Fi,Ci,ir,rr,nr,mi,Di,Gi,Oi,ar,Ni,Ur,gr,Ft,Qt,ai,Cr,pi,Us){let dn=Ze.addToLineVertexArray(lt,Jt),fn,Kr,jr,Mi,Bn=0,sl=0,Zp=0,Gp=0,Gc=-1,Hc=-1,Ln={},Hp=Ss("");if(Ze.allowVerticalPlacement&&Xt.vertical){let Hi=Ci.layout.get("text-rotate").evaluate(Qt,{},pi)+90;jr=new yu(ir,lt,rr,nr,mi,Xt.vertical,Di,Gi,Oi,Hi),Fi&&(Mi=new yu(ir,lt,rr,nr,mi,Fi,Ni,Ur,Oi,Hi))}if(Ti){let Hi=Ci.layout.get("icon-rotate").evaluate(Qt,{}),$r=Ci.layout.get("icon-text-fit")!=="none",Ga=Rp(Ti,Hi,Cr,$r),an=Fi?Rp(Fi,Hi,Cr,$r):void 0;Kr=new yu(ir,lt,rr,nr,mi,Ti,Ni,Ur,!1,Hi),Bn=4*Ga.length;let Ha=Ze.iconSizeData,mn=null;Ha.kind==="source"?(mn=[pn*Ci.layout.get("icon-size").evaluate(Qt,{})],mn[0]>ga&&Pe(`${Ze.layerIds[0]}: Value for "icon-size" is >= ${tl}. Reduce your "icon-size".`)):Ha.kind==="composite"&&(mn=[pn*ai.compositeIconSizes[0].evaluate(Qt,{},pi),pn*ai.compositeIconSizes[1].evaluate(Qt,{},pi)],(mn[0]>ga||mn[1]>ga)&&Pe(`${Ze.layerIds[0]}: Value for "icon-size" is >= ${tl}. Reduce your "icon-size".`)),Ze.addSymbols(Ze.icon,Ga,mn,Ft,gr,Qt,E.ah.none,lt,dn.lineStartIndex,dn.lineLength,-1,pi),Gc=Ze.icon.placedSymbolArray.length-1,an&&(sl=4*an.length,Ze.addSymbols(Ze.icon,an,mn,Ft,gr,Qt,E.ah.vertical,lt,dn.lineStartIndex,dn.lineLength,-1,pi),Hc=Ze.icon.placedSymbolArray.length-1)}let Xp=Object.keys(Xt.horizontal);for(let Hi of Xp){let $r=Xt.horizontal[Hi];if(!fn){Hp=Ss($r.text);let an=Ci.layout.get("text-rotate").evaluate(Qt,{},pi);fn=new yu(ir,lt,rr,nr,mi,$r,Di,Gi,Oi,an)}let Ga=$r.positionedLines.length===1;if(Zp+=qp(Ze,lt,$r,Jr,Ci,Oi,Qt,ar,dn,Xt.vertical?E.ah.horizontal:E.ah.horizontalOnly,Ga?Xp:[Hi],Ln,Gc,ai,pi),Ga)break}Xt.vertical&&(Gp+=qp(Ze,lt,Xt.vertical,Jr,Ci,Oi,Qt,ar,dn,E.ah.vertical,["vertical"],Ln,Hc,ai,pi));let Pm=fn?fn.boxStartIndex:Ze.collisionBoxArray.length,zm=fn?fn.boxEndIndex:Ze.collisionBoxArray.length,Bm=jr?jr.boxStartIndex:Ze.collisionBoxArray.length,Lm=jr?jr.boxEndIndex:Ze.collisionBoxArray.length,Rm=Kr?Kr.boxStartIndex:Ze.collisionBoxArray.length,Fm=Kr?Kr.boxEndIndex:Ze.collisionBoxArray.length,Om=Mi?Mi.boxStartIndex:Ze.collisionBoxArray.length,Nm=Mi?Mi.boxEndIndex:Ze.collisionBoxArray.length,nn=-1,xu=(Hi,$r)=>Hi&&Hi.circleDiameter?Math.max(Hi.circleDiameter,$r):$r;nn=xu(fn,nn),nn=xu(jr,nn),nn=xu(Kr,nn),nn=xu(Mi,nn);let Wp=nn>-1?1:0;Wp&&(nn*=Us/wi),Ze.glyphOffsetArray.length>=Ns.MAX_GLYPHS&&Pe("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Qt.sortKey!==void 0&&Ze.addToSortKeyRanges(Ze.symbolInstances.length,Qt.sortKey);let qm=Np(Ci,Qt,pi),[Vm,Um]=function(Hi,$r){let Ga=Hi.length,an=$r?.values;if(an?.length>0)for(let Ha=0;Ha<an.length;Ha+=2){let mn=an[Ha+1];Hi.emplaceBack(E.aq[an[Ha]],mn[0],mn[1])}return[Ga,Hi.length]}(Ze.textAnchorOffsets,qm);Ze.symbolInstances.emplaceBack(lt.x,lt.y,Ln.right>=0?Ln.right:-1,Ln.center>=0?Ln.center:-1,Ln.left>=0?Ln.left:-1,Ln.vertical||-1,Gc,Hc,Hp,Pm,zm,Bm,Lm,Rm,Fm,Om,Nm,rr,Zp,Gp,Bn,sl,Wp,0,Di,nn,Vm,Um)}(i,Xe,de,r,a,l,Ue,i.layers[0],i.collisionBoxArray,t.index,t.sourceLayerIndex,i.index,q,[ie,ie,ie,ie],Be,g,ne,ce,it,M,t,h,v,x,d)};if(Me==="line")for(let de of kp(t.geometry,0,0,xi,xi)){let Xe=Tm(de,J,ge,r.vertical||z,a,24,$,i.overscaling,xi);for(let Ze of Xe)z&&km(i,z.text,Ie,Ze)||qe(de,Ze)}else if(Me==="line-center"){for(let de of t.geometry)if(de.length>1){let Xe=Em(de,ge,r.vertical||z,a,24,$);Xe&&qe(de,Xe)}}else if(t.type==="Polygon")for(let de of ns(t.geometry,0)){let Xe=Dm(de,16);qe(de[0],new ya(Xe.x,Xe.y,0))}else if(t.type==="LineString")for(let de of t.geometry)qe(de,new ya(de[0].x,de[0].y,0));else if(t.type==="Point")for(let de of t.geometry)for(let Xe of de)qe([Xe],new ya(Xe.x,Xe.y,0))}function qp(i,t,r,a,l,h,d,f,g,v,x,A,D,M,z){let B=function(ne,J,ie,ce,ge,Be,it,Me){let Ie=ce.layout.get("text-rotate").evaluate(Be,{})*Math.PI/180,He=[];for(let Ue of J.positionedLines)for(let qe of Ue.positionedGlyphs){if(!qe.rect)continue;let de=qe.rect||{},Xe=ip+1,Ze=!0,lt=1,Jt=0,Xt=(ge||Me)&&qe.vertical,Ti=qe.metrics.advance*qe.scale/2;if(Me&&J.verticalizable&&(Jt=Ue.lineOffset/2-(qe.imageName?-(wi-qe.metrics.width*qe.scale)/2:(qe.scale-1)*wi)),qe.imageName){let Ft=it[qe.imageName];Ze=Ft.sdf,lt=Ft.pixelRatio,Xe=mr/lt}let Jr=ge?[qe.x+Ti,qe.y]:[0,0],Fi=ge?[0,0]:[qe.x+Ti+ie[0],qe.y+ie[1]-Jt],Ci=[0,0];Xt&&(Ci=Fi,Fi=[0,0]);let ir=qe.metrics.isDoubleResolution?2:1,rr=(qe.metrics.left-Xe)*qe.scale-Ti+Fi[0],nr=(-qe.metrics.top-Xe)*qe.scale+Fi[1],mi=rr+de.w/ir*qe.scale/lt,Di=nr+de.h/ir*qe.scale/lt,Gi=new se(rr,nr),Oi=new se(mi,nr),ar=new se(rr,Di),Ni=new se(mi,Di);if(Xt){let Ft=new se(-Ti,Ti-Qo),Qt=-Math.PI/2,ai=wi/2-Ti,Cr=new se(5-Qo-ai,-(qe.imageName?ai:0)),pi=new se(...Ci);Gi._rotateAround(Qt,Ft)._add(Cr)._add(pi),Oi._rotateAround(Qt,Ft)._add(Cr)._add(pi),ar._rotateAround(Qt,Ft)._add(Cr)._add(pi),Ni._rotateAround(Qt,Ft)._add(Cr)._add(pi)}if(Ie){let Ft=Math.sin(Ie),Qt=Math.cos(Ie),ai=[Qt,-Ft,Ft,Qt];Gi._matMult(ai),Oi._matMult(ai),ar._matMult(ai),Ni._matMult(ai)}let Ur=new se(0,0),gr=new se(0,0);He.push({tl:Gi,tr:Oi,bl:ar,br:Ni,tex:de,writingMode:J.writingMode,glyphOffset:Jr,sectionIndex:qe.sectionIndex,isSDF:Ze,pixelOffsetTL:Ur,pixelOffsetBR:gr,minFontScaleX:0,minFontScaleY:0})}return He}(0,r,f,l,h,d,a,i.allowVerticalPlacement),q=i.textSizeData,$=null;q.kind==="source"?($=[pn*l.layout.get("text-size").evaluate(d,{})],$[0]>ga&&Pe(`${i.layerIds[0]}: Value for "text-size" is >= ${tl}. Reduce your "text-size".`)):q.kind==="composite"&&($=[pn*M.compositeTextSizes[0].evaluate(d,{},z),pn*M.compositeTextSizes[1].evaluate(d,{},z)],($[0]>ga||$[1]>ga)&&Pe(`${i.layerIds[0]}: Value for "text-size" is >= ${tl}. Reduce your "text-size".`)),i.addSymbols(i.text,B,$,f,h,d,v,t,g.lineStartIndex,g.lineLength,D,z);for(let ne of x)A[ne]=i.text.placedSymbolArray.length-1;return 4*B.length}function Vp(i){for(let t in i)return i[t];return null}function km(i,t,r,a){let l=i.compareText;if(t in l){let h=l[t];for(let d=h.length-1;d>=0;d--)if(a.dist(h[d])<r)return!0}else l[t]=[];return l[t].push(a),!1}let Up=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Nc{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");let[r,a]=new Uint8Array(t,0,2);if(r!==219)throw new Error("Data does not appear to be in a KDBush format.");let l=a>>4;if(l!==1)throw new Error(`Got v${l} data when expected v1.`);let h=Up[15&a];if(!h)throw new Error("Unrecognized array type.");let[d]=new Uint16Array(t,2,1),[f]=new Uint32Array(t,4,1);return new Nc(f,d,h,t)}constructor(t,r=64,a=Float64Array,l){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=a,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;let h=Up.indexOf(this.ArrayType),d=2*t*this.ArrayType.BYTES_PER_ELEMENT,f=t*this.IndexArrayType.BYTES_PER_ELEMENT,g=(8-f%8)%8;if(h<0)throw new Error(`Unexpected typed array class: ${a}.`);l&&l instanceof ArrayBuffer?(this.data=l,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+f+g,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+d+f+g),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+f+g,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+h]),new Uint16Array(this.data,2,1)[0]=r,new Uint32Array(this.data,4,1)[0]=t)}add(t,r){let a=this._pos>>1;return this.ids[a]=a,this.coords[this._pos++]=t,this.coords[this._pos++]=r,a}finish(){let t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return qc(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,r,a,l){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:h,coords:d,nodeSize:f}=this,g=[0,h.length-1,0],v=[];for(;g.length;){let x=g.pop()||0,A=g.pop()||0,D=g.pop()||0;if(A-D<=f){for(let q=D;q<=A;q++){let $=d[2*q],ne=d[2*q+1];$>=t&&$<=a&&ne>=r&&ne<=l&&v.push(h[q])}continue}let M=D+A>>1,z=d[2*M],B=d[2*M+1];z>=t&&z<=a&&B>=r&&B<=l&&v.push(h[M]),(x===0?t<=z:r<=B)&&(g.push(D),g.push(M-1),g.push(1-x)),(x===0?a>=z:l>=B)&&(g.push(M+1),g.push(A),g.push(1-x))}return v}within(t,r,a){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:l,coords:h,nodeSize:d}=this,f=[0,l.length-1,0],g=[],v=a*a;for(;f.length;){let x=f.pop()||0,A=f.pop()||0,D=f.pop()||0;if(A-D<=d){for(let q=D;q<=A;q++)$p(h[2*q],h[2*q+1],t,r)<=v&&g.push(l[q]);continue}let M=D+A>>1,z=h[2*M],B=h[2*M+1];$p(z,B,t,r)<=v&&g.push(l[M]),(x===0?t-a<=z:r-a<=B)&&(f.push(D),f.push(M-1),f.push(1-x)),(x===0?t+a>=z:r+a>=B)&&(f.push(M+1),f.push(A),f.push(1-x))}return g}}function qc(i,t,r,a,l,h){if(l-a<=r)return;let d=a+l>>1;jp(i,t,d,a,l,h),qc(i,t,r,a,d-1,1-h),qc(i,t,r,d+1,l,1-h)}function jp(i,t,r,a,l,h){for(;l>a;){if(l-a>600){let v=l-a+1,x=r-a+1,A=Math.log(v),D=.5*Math.exp(2*A/3),M=.5*Math.sqrt(A*D*(v-D)/v)*(x-v/2<0?-1:1);jp(i,t,r,Math.max(a,Math.floor(r-x*D/v+M)),Math.min(l,Math.floor(r+(v-x)*D/v+M)),h)}let d=t[2*r+h],f=a,g=l;for(nl(i,t,a,r),t[2*l+h]>d&&nl(i,t,a,l);f<g;){for(nl(i,t,f,g),f++,g--;t[2*f+h]<d;)f++;for(;t[2*g+h]>d;)g--}t[2*a+h]===d?nl(i,t,a,g):(g++,nl(i,t,g,l)),g<=r&&(a=g+1),r<=g&&(l=g-1)}}function nl(i,t,r,a){Vc(i,r,a),Vc(t,2*r,2*a),Vc(t,2*r+1,2*a+1)}function Vc(i,t,r){let a=i[t];i[t]=i[r],i[r]=a}function $p(i,t,r,a){let l=i-r,h=t-a;return l*l+h*h}var Uc;E.bg=void 0,(Uc=E.bg||(E.bg={})).create="create",Uc.load="load",Uc.fullLoad="fullLoad";let vu=null,al=[],jc=1e3/60,$c="loadTime",Zc="fullLoadTime",Mm={mark(i){performance.mark(i)},frame(i){let t=i;vu!=null&&al.push(t-vu),vu=t},clearMetrics(){vu=null,al=[],performance.clearMeasures($c),performance.clearMeasures(Zc);for(let i in E.bg)performance.clearMarks(E.bg[i])},getPerformanceMetrics(){performance.measure($c,E.bg.create,E.bg.load),performance.measure(Zc,E.bg.create,E.bg.fullLoad);let i=performance.getEntriesByName($c)[0].duration,t=performance.getEntriesByName(Zc)[0].duration,r=al.length,a=1/(al.reduce((h,d)=>h+d,0)/r/1e3),l=al.filter(h=>h>jc).reduce((h,d)=>h+(d-jc)/jc,0);return{loadTime:i,fullLoadTime:t,fps:a,percentDroppedFrames:l/(r+l)*100,totalFrames:r}}};E.$=class extends T{},E.A=zs,E.B=Qu,E.C=function(i){if(at==null){let t=i.navigator?i.navigator.userAgent:null;at=!!i.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return at},E.D=je,E.E=Kt,E.F=class{constructor(i,t){this.target=i,this.mapId=t,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new wm(()=>this.process()),this.subscription=function(r,a,l,h){return r.addEventListener(a,l,!1),{unsubscribe:()=>{r.removeEventListener(a,l,!1)}}}(this.target,"message",r=>this.receive(r)),this.globalScope=Ge(self)?i:window}registerMessageHandler(i,t){this.messageHandlers[i]=t}sendAsync(i,t){return new Promise((r,a)=>{let l=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[l]={resolve:r,reject:a},t&&t.signal.addEventListener("abort",()=>{delete this.resolveRejects[l];let f={id:l,type:"<cancel>",origin:location.origin,targetMapId:i.targetMapId,sourceMapId:this.mapId};this.target.postMessage(f)},{once:!0});let h=[],d=Object.assign(Object.assign({},i),{id:l,sourceMapId:this.mapId,origin:location.origin,data:na(i.data,h)});this.target.postMessage(d,{transfer:h})})}receive(i){let t=i.data,r=t.id;if(!(t.origin!=="file://"&&location.origin!=="file://"&&t.origin!=="resource://android"&&location.origin!=="resource://android"&&t.origin!==location.origin||t.targetMapId&&this.mapId!==t.targetMapId)){if(t.type==="<cancel>"){delete this.tasks[r];let a=this.abortControllers[r];return delete this.abortControllers[r],void(a&&a.abort())}if(Ge(self)||t.mustQueue)return this.tasks[r]=t,this.taskQueue.push(r),void this.invoker.trigger();this.processTask(r,t)}}process(){if(this.taskQueue.length===0)return;let i=this.taskQueue.shift(),t=this.tasks[i];delete this.tasks[i],this.taskQueue.length>0&&this.invoker.trigger(),t&&this.processTask(i,t)}processTask(i,t){return p(this,void 0,void 0,function*(){if(t.type==="<response>"){let l=this.resolveRejects[i];return delete this.resolveRejects[i],l?void(t.error?l.reject(aa(t.error)):l.resolve(aa(t.data))):void 0}if(!this.messageHandlers[t.type])return void this.completeTask(i,new Error(`Could not find a registered handler for ${t.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));let r=aa(t.data),a=new AbortController;this.abortControllers[i]=a;try{let l=yield this.messageHandlers[t.type](t.sourceMapId,r,a);this.completeTask(i,null,l)}catch(l){this.completeTask(i,l)}})}completeTask(i,t,r){let a=[];delete this.abortControllers[i];let l={id:i,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:t?na(t):null,data:na(r,a)};this.target.postMessage(l,{transfer:a})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},E.G=$t,E.H=function(){var i=new zs(16);return zs!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=0,i[12]=0,i[13]=0,i[14]=0),i[0]=1,i[5]=1,i[10]=1,i[15]=1,i},E.I=Cc,E.J=function(i,t,r){var a,l,h,d,f,g,v,x,A,D,M,z,B=r[0],q=r[1],$=r[2];return t===i?(i[12]=t[0]*B+t[4]*q+t[8]*$+t[12],i[13]=t[1]*B+t[5]*q+t[9]*$+t[13],i[14]=t[2]*B+t[6]*q+t[10]*$+t[14],i[15]=t[3]*B+t[7]*q+t[11]*$+t[15]):(l=t[1],h=t[2],d=t[3],f=t[4],g=t[5],v=t[6],x=t[7],A=t[8],D=t[9],M=t[10],z=t[11],i[0]=a=t[0],i[1]=l,i[2]=h,i[3]=d,i[4]=f,i[5]=g,i[6]=v,i[7]=x,i[8]=A,i[9]=D,i[10]=M,i[11]=z,i[12]=a*B+f*q+A*$+t[12],i[13]=l*B+g*q+D*$+t[13],i[14]=h*B+v*q+M*$+t[14],i[15]=d*B+x*q+z*$+t[15]),i},E.K=function(i,t,r){var a=r[0],l=r[1],h=r[2];return i[0]=t[0]*a,i[1]=t[1]*a,i[2]=t[2]*a,i[3]=t[3]*a,i[4]=t[4]*l,i[5]=t[5]*l,i[6]=t[6]*l,i[7]=t[7]*l,i[8]=t[8]*h,i[9]=t[9]*h,i[10]=t[10]*h,i[11]=t[11]*h,i[12]=t[12],i[13]=t[13],i[14]=t[14],i[15]=t[15],i},E.L=Eh,E.M=function(i,t){let r={};for(let a=0;a<t.length;a++){let l=t[a];l in i&&(r[l]=i[l])}return r},E.N=_a,E.O=vp,E.P=se,E.Q=xp,E.R=qr,E.S=Vr,E.T=As,E.U=Lt,E.V=Mt,E.W=Ne,E.X=xi,E.Y=m,E.Z=il,E._=p,E.a=xt,E.a$=function(i,t){var r=i[0],a=i[1],l=i[2],h=i[3],d=i[4],f=i[5],g=i[6],v=i[7],x=i[8],A=i[9],D=i[10],M=i[11],z=i[12],B=i[13],q=i[14],$=i[15],ne=t[0],J=t[1],ie=t[2],ce=t[3],ge=t[4],Be=t[5],it=t[6],Me=t[7],Ie=t[8],He=t[9],Ue=t[10],qe=t[11],de=t[12],Xe=t[13],Ze=t[14],lt=t[15];return Math.abs(r-ne)<=tr*Math.max(1,Math.abs(r),Math.abs(ne))&&Math.abs(a-J)<=tr*Math.max(1,Math.abs(a),Math.abs(J))&&Math.abs(l-ie)<=tr*Math.max(1,Math.abs(l),Math.abs(ie))&&Math.abs(h-ce)<=tr*Math.max(1,Math.abs(h),Math.abs(ce))&&Math.abs(d-ge)<=tr*Math.max(1,Math.abs(d),Math.abs(ge))&&Math.abs(f-Be)<=tr*Math.max(1,Math.abs(f),Math.abs(Be))&&Math.abs(g-it)<=tr*Math.max(1,Math.abs(g),Math.abs(it))&&Math.abs(v-Me)<=tr*Math.max(1,Math.abs(v),Math.abs(Me))&&Math.abs(x-Ie)<=tr*Math.max(1,Math.abs(x),Math.abs(Ie))&&Math.abs(A-He)<=tr*Math.max(1,Math.abs(A),Math.abs(He))&&Math.abs(D-Ue)<=tr*Math.max(1,Math.abs(D),Math.abs(Ue))&&Math.abs(M-qe)<=tr*Math.max(1,Math.abs(M),Math.abs(qe))&&Math.abs(z-de)<=tr*Math.max(1,Math.abs(z),Math.abs(de))&&Math.abs(B-Xe)<=tr*Math.max(1,Math.abs(B),Math.abs(Xe))&&Math.abs(q-Ze)<=tr*Math.max(1,Math.abs(q),Math.abs(Ze))&&Math.abs($-lt)<=tr*Math.max(1,Math.abs($),Math.abs(lt))},E.a0=St,E.a1=Rc,E.a2=be,E.a3=i=>{let t=window.document.createElement("video");return t.muted=!0,new Promise(r=>{t.onloadstart=()=>{r(t)};for(let a of i){let l=window.document.createElement("source");gt(a)||(t.crossOrigin="Anonymous"),l.src=a,t.appendChild(l)}})},E.a4=function(){return _e++},E.a5=ze,E.a6=Ns,E.a7=wo,E.a8=$a,E.a9=Cp,E.aA=function(i){if(i.type==="custom")return new bm(i);switch(i.type){case"background":return new ym(i);case"circle":return new af(i);case"fill":return new wf(i);case"fill-extrusion":return new Ff(i);case"heatmap":return new of(i);case"hillshade":return new uf(i);case"line":return new Zf(i);case"raster":return new xm(i);case"symbol":return new fu(i)}},E.aB=ye,E.aC=function(i,t){if(!i)return[{command:"setStyle",args:[t]}];let r=[];try{if(!wt(i.version,t.version))return[{command:"setStyle",args:[t]}];wt(i.center,t.center)||r.push({command:"setCenter",args:[t.center]}),wt(i.zoom,t.zoom)||r.push({command:"setZoom",args:[t.zoom]}),wt(i.bearing,t.bearing)||r.push({command:"setBearing",args:[t.bearing]}),wt(i.pitch,t.pitch)||r.push({command:"setPitch",args:[t.pitch]}),wt(i.sprite,t.sprite)||r.push({command:"setSprite",args:[t.sprite]}),wt(i.glyphs,t.glyphs)||r.push({command:"setGlyphs",args:[t.glyphs]}),wt(i.transition,t.transition)||r.push({command:"setTransition",args:[t.transition]}),wt(i.light,t.light)||r.push({command:"setLight",args:[t.light]}),wt(i.terrain,t.terrain)||r.push({command:"setTerrain",args:[t.terrain]}),wt(i.sky,t.sky)||r.push({command:"setSky",args:[t.sky]}),wt(i.projection,t.projection)||r.push({command:"setProjection",args:[t.projection]});let a={},l=[];(function(d,f,g,v){let x;for(x in f=f||{},d=d||{})Object.prototype.hasOwnProperty.call(d,x)&&(Object.prototype.hasOwnProperty.call(f,x)||Mr(x,g,v));for(x in f)Object.prototype.hasOwnProperty.call(f,x)&&(Object.prototype.hasOwnProperty.call(d,x)?wt(d[x],f[x])||(d[x].type==="geojson"&&f[x].type==="geojson"&&Qr(d,f,x)?Zt(g,{command:"setGeoJSONSourceData",args:[x,f[x].data]}):Wi(x,f,g,v)):_r(x,f,g))})(i.sources,t.sources,l,a);let h=[];i.layers&&i.layers.forEach(d=>{"source"in d&&a[d.source]?r.push({command:"removeLayer",args:[d.id]}):h.push(d)}),r=r.concat(l),function(d,f,g){f=f||[];let v=(d=d||[]).map(sn),x=f.map(sn),A=d.reduce(yn,{}),D=f.reduce(yn,{}),M=v.slice(),z=Object.create(null),B,q,$,ne,J;for(let ie=0,ce=0;ie<v.length;ie++)B=v[ie],Object.prototype.hasOwnProperty.call(D,B)?ce++:(Zt(g,{command:"removeLayer",args:[B]}),M.splice(M.indexOf(B,ce),1));for(let ie=0,ce=0;ie<x.length;ie++)B=x[x.length-1-ie],M[M.length-1-ie]!==B&&(Object.prototype.hasOwnProperty.call(A,B)?(Zt(g,{command:"removeLayer",args:[B]}),M.splice(M.lastIndexOf(B,M.length-ce),1)):ce++,ne=M[M.length-ie],Zt(g,{command:"addLayer",args:[D[B],ne]}),M.splice(M.length-ie,0,B),z[B]=!0);for(let ie=0;ie<x.length;ie++)if(B=x[ie],q=A[B],$=D[B],!z[B]&&!wt(q,$))if(wt(q.source,$.source)&&wt(q["source-layer"],$["source-layer"])&&wt(q.type,$.type)){for(J in Ui(q.layout,$.layout,g,B,null,"setLayoutProperty"),Ui(q.paint,$.paint,g,B,null,"setPaintProperty"),wt(q.filter,$.filter)||Zt(g,{command:"setFilter",args:[B,$.filter]}),wt(q.minzoom,$.minzoom)&&wt(q.maxzoom,$.maxzoom)||Zt(g,{command:"setLayerZoomRange",args:[B,$.minzoom,$.maxzoom]}),q)Object.prototype.hasOwnProperty.call(q,J)&&J!=="layout"&&J!=="paint"&&J!=="filter"&&J!=="metadata"&&J!=="minzoom"&&J!=="maxzoom"&&(J.indexOf("paint.")===0?Ui(q[J],$[J],g,B,J.slice(6),"setPaintProperty"):wt(q[J],$[J])||Zt(g,{command:"setLayerProperty",args:[B,J,$[J]]}));for(J in $)Object.prototype.hasOwnProperty.call($,J)&&!Object.prototype.hasOwnProperty.call(q,J)&&J!=="layout"&&J!=="paint"&&J!=="filter"&&J!=="metadata"&&J!=="minzoom"&&J!=="maxzoom"&&(J.indexOf("paint.")===0?Ui(q[J],$[J],g,B,J.slice(6),"setPaintProperty"):wt(q[J],$[J])||Zt(g,{command:"setLayerProperty",args:[B,J,$[J]]}))}else Zt(g,{command:"removeLayer",args:[B]}),ne=M[M.lastIndexOf(B)+1],Zt(g,{command:"addLayer",args:[$,ne]})}(h,t.layers,r)}catch(a){console.warn("Unable to compute style diff:",a),r=[{command:"setStyle",args:[t]}]}return r},E.aD=function(i){let t=[],r=i.id;return r===void 0&&t.push({message:`layers.${r}: missing required property "id"`}),i.render===void 0&&t.push({message:`layers.${r}: missing required method "render"`}),i.renderingMode&&i.renderingMode!=="2d"&&i.renderingMode!=="3d"&&t.push({message:`layers.${r}: property "renderingMode" must be either "2d" or "3d"`}),t},E.aE=function i(t,r){if(Array.isArray(t)){if(!Array.isArray(r)||t.length!==r.length)return!1;for(let a=0;a<t.length;a++)if(!i(t[a],r[a]))return!1;return!0}if(typeof t=="object"&&t!==null&&r!==null){if(typeof r!="object"||Object.keys(t).length!==Object.keys(r).length)return!1;for(let a in t)if(!i(t[a],r[a]))return!1;return!0}return t===r},E.aF=xe,E.aG=Le,E.aH=class extends Va{constructor(i,t){super(i,t),this.current=0}set(i){this.current!==i&&(this.current=i,this.gl.uniform1i(this.location,i))}},E.aI=tu,E.aJ=class extends Va{constructor(i,t){super(i,t),this.current=Jd}set(i){if(i[12]!==this.current[12]||i[0]!==this.current[0])return this.current=i,void this.gl.uniformMatrix4fv(this.location,!1,i);for(let t=1;t<16;t++)if(i[t]!==this.current[t]){this.current=i,this.gl.uniformMatrix4fv(this.location,!1,i);break}}},E.aK=dh,E.aL=fh,E.aM=jt,E.aN=class extends Va{constructor(i,t){super(i,t),this.current=[0,0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]&&i[2]===this.current[2]||(this.current=i,this.gl.uniform3f(this.location,i[0],i[1],i[2]))}},E.aO=class extends Va{constructor(i,t){super(i,t),this.current=[0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]||(this.current=i,this.gl.uniform2f(this.location,i[0],i[1]))}},E.aP=function(i,t,r,a,l,h,d){var f=1/(t-r),g=1/(a-l),v=1/(h-d);return i[0]=-2*f,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=-2*g,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=2*v,i[11]=0,i[12]=(t+r)*f,i[13]=(l+a)*g,i[14]=(d+h)*v,i[15]=1,i},E.aQ=nf,E.aR=class extends Q{},E.aS=Wf,E.aT=class extends ae{},E.aU=fc,E.aV=function(i){return i<=1?1:Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))},E.aW=Ih,E.aX=Bi,E.aY=Nr,E.aZ=class extends $e{},E.a_=function(i,t){return i[0]===t[0]&&i[1]===t[1]&&i[2]===t[2]&&i[3]===t[3]&&i[4]===t[4]&&i[5]===t[5]&&i[6]===t[6]&&i[7]===t[7]&&i[8]===t[8]&&i[9]===t[9]&&i[10]===t[10]&&i[11]===t[11]&&i[12]===t[12]&&i[13]===t[13]&&i[14]===t[14]&&i[15]===t[15]},E.aa=function(i){let t={};if(i.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(r,a,l,h)=>{let d=l||h;return t[a]=!d||d.toLowerCase(),""}),t["max-age"]){let r=parseInt(t["max-age"],10);isNaN(r)?delete t["max-age"]:t["max-age"]=r}return t},E.ab=function(i,t){let r=[];for(let a in i)a in t||r.push(a);return r},E.ac=Re,E.ad=function(i,t,r){var a=Math.sin(r),l=Math.cos(r),h=t[0],d=t[1],f=t[2],g=t[3],v=t[4],x=t[5],A=t[6],D=t[7];return t!==i&&(i[8]=t[8],i[9]=t[9],i[10]=t[10],i[11]=t[11],i[12]=t[12],i[13]=t[13],i[14]=t[14],i[15]=t[15]),i[0]=h*l+v*a,i[1]=d*l+x*a,i[2]=f*l+A*a,i[3]=g*l+D*a,i[4]=v*l-h*a,i[5]=x*l-d*a,i[6]=A*l-f*a,i[7]=D*l-g*a,i},E.ae=function(i){var t=new zs(16);return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],t},E.af=au,E.ag=function(i,t){let r=0,a=0;if(i.kind==="constant")a=i.layoutSize;else if(i.kind!=="source"){let{interpolationType:l,minZoom:h,maxZoom:d}=i,f=l?Re(Qi.interpolationFactor(l,t,h,d),0,1):0;i.kind==="camera"?a=Yi.number(i.minSize,i.maxSize,f):r=f}return{uSizeT:r,uSize:a}},E.ai=function(i,{uSize:t,uSizeT:r},{lowerSize:a,upperSize:l}){return i.kind==="source"?a/pn:i.kind==="composite"?Yi.number(a/pn,l/pn,r):t},E.aj=kc,E.ak=function(i,t,r,a){let l=t.y-i.y,h=t.x-i.x,d=a.y-r.y,f=a.x-r.x,g=d*h-f*l;if(g===0)return null;let v=(f*(i.y-r.y)-d*(i.x-r.x))/g;return new se(i.x+v*h,i.y+v*l)},E.al=kp,E.am=yh,E.an=hc,E.ao=function(i){let t=1/0,r=1/0,a=-1/0,l=-1/0;for(let h of i)t=Math.min(t,h.x),r=Math.min(r,h.y),a=Math.max(a,h.x),l=Math.max(l,h.y);return[t,r,a,l]},E.ap=wi,E.ar=Ic,E.as=function(i,t){var r=t[0],a=t[1],l=t[2],h=t[3],d=t[4],f=t[5],g=t[6],v=t[7],x=t[8],A=t[9],D=t[10],M=t[11],z=t[12],B=t[13],q=t[14],$=t[15],ne=r*f-a*d,J=r*g-l*d,ie=r*v-h*d,ce=a*g-l*f,ge=a*v-h*f,Be=l*v-h*g,it=x*B-A*z,Me=x*q-D*z,Ie=x*$-M*z,He=A*q-D*B,Ue=A*$-M*B,qe=D*$-M*q,de=ne*qe-J*Ue+ie*He+ce*Ie-ge*Me+Be*it;return de?(i[0]=(f*qe-g*Ue+v*He)*(de=1/de),i[1]=(l*Ue-a*qe-h*He)*de,i[2]=(B*Be-q*ge+$*ce)*de,i[3]=(D*ge-A*Be-M*ce)*de,i[4]=(g*Ie-d*qe-v*Me)*de,i[5]=(r*qe-l*Ie+h*Me)*de,i[6]=(q*ie-z*Be-$*J)*de,i[7]=(x*Be-D*ie+M*J)*de,i[8]=(d*Ue-f*Ie+v*it)*de,i[9]=(a*Ie-r*Ue-h*it)*de,i[10]=(z*ge-B*ie+$*ne)*de,i[11]=(A*ie-x*ge-M*ne)*de,i[12]=(f*Me-d*He-g*it)*de,i[13]=(r*He-a*Me+l*it)*de,i[14]=(B*J-z*ce-q*ne)*de,i[15]=(x*ce-A*J+D*ne)*de,i):null},E.at=Oc,E.au=Sc,E.av=Nc,E.aw=function(){let i={},t=oe.$version;for(let r in oe.$root){let a=oe.$root[r];if(a.required){let l=null;l=r==="version"?t:a.type==="array"?[]:{},l!=null&&(i[r]=l)}}return i},E.ax=Ro,E.ay=ui,E.az=function(i){i=i.slice();let t=Object.create(null);for(let r=0;r<i.length;r++)t[i[r].id]=i[r];for(let r=0;r<i.length;r++)"ref"in i[r]&&(i[r]=kr(i[r],t[i[r].ref]));return i},E.b=ht,E.b0=function(i,t){return i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=t[3],i[4]=t[4],i[5]=t[5],i[6]=t[6],i[7]=t[7],i[8]=t[8],i[9]=t[9],i[10]=t[10],i[11]=t[11],i[12]=t[12],i[13]=t[13],i[14]=t[14],i[15]=t[15],i},E.b1=function(i,t,r){return i[0]=t[0]*r[0],i[1]=t[1]*r[1],i[2]=t[2]*r[2],i[3]=t[3]*r[3],i},E.b2=function(i,t){return i[0]*t[0]+i[1]*t[1]+i[2]*t[2]+i[3]*t[3]},E.b3=Fe,E.b4=Ap,E.b5=bp,E.b6=function(i,t,r,a,l){var h,d=1/Math.tan(t/2);return i[0]=d/r,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=d,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=-1,i[12]=0,i[13]=0,i[15]=0,l!=null&&l!==1/0?(i[10]=(l+a)*(h=1/(a-l)),i[14]=2*l*a*h):(i[10]=-1,i[14]=-2*a),i},E.b7=function(i,t,r){var a=Math.sin(r),l=Math.cos(r),h=t[4],d=t[5],f=t[6],g=t[7],v=t[8],x=t[9],A=t[10],D=t[11];return t!==i&&(i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=t[3],i[12]=t[12],i[13]=t[13],i[14]=t[14],i[15]=t[15]),i[4]=h*l+v*a,i[5]=d*l+x*a,i[6]=f*l+A*a,i[7]=g*l+D*a,i[8]=v*l-h*a,i[9]=x*l-d*a,i[10]=A*l-f*a,i[11]=D*l-g*a,i},E.b8=De,E.b9=We,E.bA=Wh,E.bB=function(i){return i.message===dt},E.bC=Kn,E.bD=dr,E.ba=function(i){return i*Math.PI/180},E.bb=function(i,t){let{x:r,y:a}=il.fromLngLat(t);return!(i<0||i>25||a<0||a>=1||r<0||r>=1)},E.bc=function(i,t){return i[0]=t[0],i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=t[1],i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=t[2],i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i},E.bd=class extends b{},E.be=Bc,E.bf=Mm,E.bh=vt,E.bi=function(i,t){xt.REGISTERED_PROTOCOLS[i]=t},E.bj=function(i){delete xt.REGISTERED_PROTOCOLS[i]},E.bk=function(i,t){let r={};for(let l=0;l<i.length;l++){let h=t&&t[i[l].id]||jl(i[l]);t&&(t[i[l].id]=h);let d=r[h];d||(d=r[h]=[]),d.push(i[l])}let a=[];for(let l in r)a.push(r[l]);return a},E.bl=Ve,E.bm=Tp,E.bn=Dp,E.bo=np,E.bp=function(i){i.bucket.createArrays(),i.bucket.tilePixelRatio=xi/(512*i.bucket.overscaling),i.bucket.compareText={},i.bucket.iconsNeedLinear=!1;let t=i.bucket.layers[0],r=t.layout,a=t._unevaluatedLayout._values,l={layoutIconSize:a["icon-size"].possiblyEvaluate(new ti(i.bucket.zoom+1),i.canonical),layoutTextSize:a["text-size"].possiblyEvaluate(new ti(i.bucket.zoom+1),i.canonical),textMaxSize:a["text-size"].possiblyEvaluate(new ti(18))};if(i.bucket.textSizeData.kind==="composite"){let{minZoom:v,maxZoom:x}=i.bucket.textSizeData;l.compositeTextSizes=[a["text-size"].possiblyEvaluate(new ti(v),i.canonical),a["text-size"].possiblyEvaluate(new ti(x),i.canonical)]}if(i.bucket.iconSizeData.kind==="composite"){let{minZoom:v,maxZoom:x}=i.bucket.iconSizeData;l.compositeIconSizes=[a["icon-size"].possiblyEvaluate(new ti(v),i.canonical),a["icon-size"].possiblyEvaluate(new ti(x),i.canonical)]}let h=r.get("text-line-height")*wi,d=r.get("text-rotation-alignment")!=="viewport"&&r.get("symbol-placement")!=="point",f=r.get("text-keep-upright"),g=r.get("text-size");for(let v of i.bucket.features){let x=r.get("text-font").evaluate(v,{},i.canonical).join(","),A=g.evaluate(v,{},i.canonical),D=l.layoutTextSize.evaluate(v,{},i.canonical),M=l.layoutIconSize.evaluate(v,{},i.canonical),z={horizontal:{},vertical:void 0},B=v.text,q,$=[0,0];if(B){let ie=B.toString(),ce=r.get("text-letter-spacing").evaluate(v,{},i.canonical)*wi,ge=ec(ie)?ce:0,Be=r.get("text-anchor").evaluate(v,{},i.canonical),it=Np(t,v,i.canonical);if(!it){let Ue=r.get("text-radial-offset").evaluate(v,{},i.canonical);$=Ue?Op(Be,[Ue*wi,Fc]):r.get("text-offset").evaluate(v,{},i.canonical).map(qe=>qe*wi)}let Me=d?"center":r.get("text-justify").evaluate(v,{},i.canonical),Ie=r.get("symbol-placement")==="point"?r.get("text-max-width").evaluate(v,{},i.canonical)*wi:1/0,He=()=>{i.bucket.allowVerticalPlacement&&Fo(ie)&&(z.vertical=hu(B,i.glyphMap,i.glyphPositions,i.imagePositions,x,Ie,h,Be,"left",ge,$,E.ah.vertical,!0,D,A))};if(!d&&it){let Ue=new Set;if(Me==="auto")for(let de=0;de<it.values.length;de+=2)Ue.add(Oc(it.values[de]));else Ue.add(Me);let qe=!1;for(let de of Ue)if(!z.horizontal[de])if(qe)z.horizontal[de]=z.horizontal[0];else{let Xe=hu(B,i.glyphMap,i.glyphPositions,i.imagePositions,x,Ie,h,"center",de,ge,$,E.ah.horizontal,!1,D,A);Xe&&(z.horizontal[de]=Xe,qe=Xe.positionedLines.length===1)}He()}else{Me==="auto"&&(Me=Oc(Be));let Ue=hu(B,i.glyphMap,i.glyphPositions,i.imagePositions,x,Ie,h,Be,Me,ge,$,E.ah.horizontal,!1,D,A);Ue&&(z.horizontal[Me]=Ue),He(),Fo(ie)&&d&&f&&(z.vertical=hu(B,i.glyphMap,i.glyphPositions,i.imagePositions,x,Ie,h,Be,Me,ge,$,E.ah.vertical,!1,D,A))}}let ne=!1;if(v.icon&&v.icon.name){let ie=i.imageMap[v.icon.name];ie&&(q=dm(i.imagePositions[v.icon.name],r.get("icon-offset").evaluate(v,{},i.canonical),r.get("icon-anchor").evaluate(v,{},i.canonical)),ne=!!ie.sdf,i.bucket.sdfIcons===void 0?i.bucket.sdfIcons=ne:i.bucket.sdfIcons!==ne&&Pe("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(ie.pixelRatio!==i.bucket.pixelRatio||r.get("icon-rotate").constantOr(1)!==0)&&(i.bucket.iconsNeedLinear=!0))}let J=Vp(z.horizontal)||z.vertical;i.bucket.iconsInText=!!J&&J.iconsInText,(J||q)&&Im(i.bucket,v,z,q,i.imageMap,l,D,M,$,ne,i.canonical)}i.showCollisionBoxes&&i.bucket.generateCollisionDebugBuffers()},E.bq=wc,E.br=vc,E.bs=bc,E.bt=fa,E.bu=Ec,E.bv=class{constructor(i){this._marks={start:[i.url,"start"].join("#"),end:[i.url,"end"].join("#"),measure:i.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let i=performance.getEntriesByName(this._marks.measure);return i.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),i=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),i}},E.bw=function(i,t,r,a,l){return p(this,void 0,void 0,function*(){if(Mt())try{return yield Ne(i,t,r,a,l)}catch{}return function(h,d,f,g,v){let x=h.width,A=h.height;kt&&Wt||(kt=new OffscreenCanvas(x,A),Wt=kt.getContext("2d",{willReadFrequently:!0})),kt.width=x,kt.height=A,Wt.drawImage(h,0,0,x,A);let D=Wt.getImageData(d,f,g,v);return Wt.clearRect(0,0,x,A),D.data}(i,t,r,a,l)})},E.bx=Ep,E.by=ue,E.bz=pe,E.c=Pt,E.d=i=>p(void 0,void 0,void 0,function*(){if(i.byteLength===0)return createImageBitmap(new ImageData(1,1));let t=new Blob([new Uint8Array(i)],{type:"image/png"});try{return createImageBitmap(t)}catch(r){throw new Error(`Could not load image because of ${r.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),E.e=Ye,E.f=i=>new Promise((t,r)=>{let a=new Image;a.onload=()=>{t(a),URL.revokeObjectURL(a.src),a.onload=null,window.requestAnimationFrame(()=>{a.src=_t})},a.onerror=()=>r(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."));let l=new Blob([new Uint8Array(i)],{type:"image/png"});a.src=i.byteLength?URL.createObjectURL(l):_t}),E.g=Nt,E.h=(i,t)=>Qe(Ye(i,{type:"json"}),t),E.i=Ge,E.j=bi,E.k=ci,E.l=(i,t)=>Qe(Ye(i,{type:"arrayBuffer"}),t),E.m=Qe,E.n=function(i){return new Ec(i).readFields(sm,[])},E.o=Go,E.p=rp,E.q=c,E.r=Yu,E.s=gt,E.t=Bo,E.u=kn,E.v=oe,E.w=Pe,E.x=function([i,t,r]){return t+=90,t*=Math.PI/180,r*=Math.PI/180,{x:i*Math.cos(t)*Math.sin(r),y:i*Math.sin(t)*Math.sin(r),z:i*Math.cos(r)}},E.y=Yi,E.z=ti}),F("worker",["./shared"],function(E){"use strict";class p{constructor(k){this.keyCache={},k&&this.replace(k)}replace(k){this._layerConfigs={},this._layers={},this.update(k,[])}update(k,I){for(let V of k){this._layerConfigs[V.id]=V;let K=this._layers[V.id]=E.aA(V);K._featureFilter=E.a7(K.filter),this.keyCache[V.id]&&delete this.keyCache[V.id]}for(let V of I)delete this.keyCache[V],delete this._layerConfigs[V],delete this._layers[V];this.familiesBySource={};let R=E.bk(Object.values(this._layerConfigs),this.keyCache);for(let V of R){let K=V.map(le=>this._layers[le.id]),ee=K[0];if(ee.visibility==="none")continue;let re=ee.source||"",H=this.familiesBySource[re];H||(H=this.familiesBySource[re]={});let he=ee.sourceLayer||"_geojsonTileLayer",me=H[he];me||(me=H[he]=[]),me.push(K)}}}class ue{constructor(k){let I={},R=[];for(let re in k){let H=k[re],he=I[re]={};for(let me in H){let le=H[+me];if(!le||le.bitmap.width===0||le.bitmap.height===0)continue;let Ae={x:0,y:0,w:le.bitmap.width+2,h:le.bitmap.height+2};R.push(Ae),he[me]={rect:Ae,metrics:le.metrics}}}let{w:V,h:K}=E.p(R),ee=new E.o({width:V||1,height:K||1});for(let re in k){let H=k[re];for(let he in H){let me=H[+he];if(!me||me.bitmap.width===0||me.bitmap.height===0)continue;let le=I[re][he].rect;E.o.copy(me.bitmap,ee,{x:0,y:0},{x:le.x+1,y:le.y+1},me.bitmap)}}this.image=ee,this.positions=I}}E.bl("GlyphAtlas",ue);class pe{constructor(k){this.tileID=new E.S(k.tileID.overscaledZ,k.tileID.wrap,k.tileID.canonical.z,k.tileID.canonical.x,k.tileID.canonical.y),this.uid=k.uid,this.zoom=k.zoom,this.pixelRatio=k.pixelRatio,this.tileSize=k.tileSize,this.source=k.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=k.showCollisionBoxes,this.collectResourceTiming=!!k.collectResourceTiming,this.returnDependencies=!!k.returnDependencies,this.promoteId=k.promoteId,this.inFlightDependencies=[]}parse(k,I,R,V){return E._(this,void 0,void 0,function*(){this.status="parsing",this.data=k,this.collisionBoxArray=new E.a5;let K=new E.bm(Object.keys(k.layers).sort()),ee=new E.bn(this.tileID,this.promoteId);ee.bucketLayerIDs=[];let re={},H={featureIndex:ee,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:R},he=I.familiesBySource[this.source];for(let bt in he){let Ut=k.layers[bt];if(!Ut)continue;Ut.version===1&&E.w(`Vector tile source "${this.source}" layer "${bt}" does not use vector tile spec v2 and therefore may have some rendering errors.`);let oi=K.encode(bt),Ei=[];for(let Ii=0;Ii<Ut.length;Ii++){let ji=Ut.feature(Ii),qn=ee.getId(ji,bt);Ei.push({feature:ji,id:qn,index:Ii,sourceLayerIndex:oi})}for(let Ii of he[bt]){let ji=Ii[0];ji.source!==this.source&&E.w(`layer.source = ${ji.source} does not equal this.source = ${this.source}`),ji.minzoom&&this.zoom<Math.floor(ji.minzoom)||ji.maxzoom&&this.zoom>=ji.maxzoom||ji.visibility!=="none"&&(Ce(Ii,this.zoom,R),(re[ji.id]=ji.createBucket({index:ee.bucketLayerIDs.length,layers:Ii,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:oi,sourceID:this.source})).populate(Ei,H,this.tileID.canonical),ee.bucketLayerIDs.push(Ii.map(qn=>qn.id)))}}let me=E.aF(H.glyphDependencies,bt=>Object.keys(bt).map(Number));this.inFlightDependencies.forEach(bt=>bt?.abort()),this.inFlightDependencies=[];let le=Promise.resolve({});if(Object.keys(me).length){let bt=new AbortController;this.inFlightDependencies.push(bt),le=V.sendAsync({type:"GG",data:{stacks:me,source:this.source,tileID:this.tileID,type:"glyphs"}},bt)}let Ae=Object.keys(H.iconDependencies),Ke=Promise.resolve({});if(Ae.length){let bt=new AbortController;this.inFlightDependencies.push(bt),Ke=V.sendAsync({type:"GI",data:{icons:Ae,source:this.source,tileID:this.tileID,type:"icons"}},bt)}let et=Object.keys(H.patternDependencies),zt=Promise.resolve({});if(et.length){let bt=new AbortController;this.inFlightDependencies.push(bt),zt=V.sendAsync({type:"GI",data:{icons:et,source:this.source,tileID:this.tileID,type:"patterns"}},bt)}let[pt,Bt,Tt]=yield Promise.all([le,Ke,zt]),yi=new ue(pt),hi=new E.bo(Bt,Tt);for(let bt in re){let Ut=re[bt];Ut instanceof E.a6?(Ce(Ut.layers,this.zoom,R),E.bp({bucket:Ut,glyphMap:pt,glyphPositions:yi.positions,imageMap:Bt,imagePositions:hi.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):Ut.hasPattern&&(Ut instanceof E.bq||Ut instanceof E.br||Ut instanceof E.bs)&&(Ce(Ut.layers,this.zoom,R),Ut.addFeatures(H,this.tileID.canonical,hi.patternPositions))}return this.status="done",{buckets:Object.values(re).filter(bt=>!bt.isEmpty()),featureIndex:ee,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:yi.image,imageAtlas:hi,glyphMap:this.returnDependencies?pt:null,iconMap:this.returnDependencies?Bt:null,glyphPositions:this.returnDependencies?yi.positions:null}})}}function Ce(j,k,I){let R=new E.z(k);for(let V of j)V.recalculate(R,I)}class se{constructor(k,I,R){this.actor=k,this.layerIndex=I,this.availableImages=R,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(k,I){return E._(this,void 0,void 0,function*(){let R=yield E.l(k.request,I);try{return{vectorTile:new E.bt.VectorTile(new E.bu(R.data)),rawData:R.data,cacheControl:R.cacheControl,expires:R.expires}}catch(V){let K=new Uint8Array(R.data),ee=`Unable to parse the tile at ${k.request.url}, `;throw ee+=K[0]===31&&K[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${V.message}`,new Error(ee)}})}loadTile(k){return E._(this,void 0,void 0,function*(){let I=k.uid,R=!!(k&&k.request&&k.request.collectResourceTiming)&&new E.bv(k.request),V=new pe(k);this.loading[I]=V;let K=new AbortController;V.abort=K;try{let ee=yield this.loadVectorTile(k,K);if(delete this.loading[I],!ee)return null;let re=ee.rawData,H={};ee.expires&&(H.expires=ee.expires),ee.cacheControl&&(H.cacheControl=ee.cacheControl);let he={};if(R){let le=R.finish();le&&(he.resourceTiming=JSON.parse(JSON.stringify(le)))}V.vectorTile=ee.vectorTile;let me=V.parse(ee.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[I]=V,this.fetching[I]={rawTileData:re,cacheControl:H,resourceTiming:he};try{let le=yield me;return E.e({rawTileData:re.slice(0)},le,H,he)}finally{delete this.fetching[I]}}catch(ee){throw delete this.loading[I],V.status="done",this.loaded[I]=V,ee}})}reloadTile(k){return E._(this,void 0,void 0,function*(){let I=k.uid;if(!this.loaded||!this.loaded[I])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");let R=this.loaded[I];if(R.showCollisionBoxes=k.showCollisionBoxes,R.status==="parsing"){let V=yield R.parse(R.vectorTile,this.layerIndex,this.availableImages,this.actor),K;if(this.fetching[I]){let{rawTileData:ee,cacheControl:re,resourceTiming:H}=this.fetching[I];delete this.fetching[I],K=E.e({rawTileData:ee.slice(0)},V,re,H)}else K=V;return K}if(R.status==="done"&&R.vectorTile)return R.parse(R.vectorTile,this.layerIndex,this.availableImages,this.actor)})}abortTile(k){return E._(this,void 0,void 0,function*(){let I=this.loading,R=k.uid;I&&I[R]&&I[R].abort&&(I[R].abort.abort(),delete I[R])})}removeTile(k){return E._(this,void 0,void 0,function*(){this.loaded&&this.loaded[k.uid]&&delete this.loaded[k.uid]})}}class X{constructor(){this.loaded={}}loadTile(k){return E._(this,void 0,void 0,function*(){let{uid:I,encoding:R,rawImageData:V,redFactor:K,greenFactor:ee,blueFactor:re,baseShift:H}=k,he=V.width+2,me=V.height+2,le=E.b(V)?new E.R({width:he,height:me},yield E.bw(V,-1,-1,he,me)):V,Ae=new E.bx(I,le,R,K,ee,re,H);return this.loaded=this.loaded||{},this.loaded[I]=Ae,Ae})}removeTile(k){let I=this.loaded,R=k.uid;I&&I[R]&&delete I[R]}}function It(j,k){if(j.length!==0){mt(j[0],k);for(var I=1;I<j.length;I++)mt(j[I],!k)}}function mt(j,k){for(var I=0,R=0,V=0,K=j.length,ee=K-1;V<K;ee=V++){var re=(j[V][0]-j[ee][0])*(j[ee][1]+j[V][1]),H=I+re;R+=Math.abs(I)>=Math.abs(re)?I-H+re:re-H+I,I=H}I+R>=0!=!!k&&j.reverse()}var Et=E.by(function j(k,I){var R,V=k&&k.type;if(V==="FeatureCollection")for(R=0;R<k.features.length;R++)j(k.features[R],I);else if(V==="GeometryCollection")for(R=0;R<k.geometries.length;R++)j(k.geometries[R],I);else if(V==="Feature")j(k.geometry,I);else if(V==="Polygon")It(k.coordinates,I);else if(V==="MultiPolygon")for(R=0;R<k.coordinates.length;R++)It(k.coordinates[R],I);return k});let li=E.bt.VectorTileFeature.prototype.toGeoJSON;var Lt={exports:{}},Mt=E.bz,De=E.bt.VectorTileFeature,We=Re;function Re(j,k){this.options=k||{},this.features=j,this.length=j.length}function Fe(j,k){this.id=typeof j.id=="number"?j.id:void 0,this.type=j.type,this.rawGeometry=j.type===1?[j.geometry]:j.geometry,this.properties=j.tags,this.extent=k||4096}Re.prototype.feature=function(j){return new Fe(this.features[j],this.options.extent)},Fe.prototype.loadGeometry=function(){var j=this.rawGeometry;this.geometry=[];for(var k=0;k<j.length;k++){for(var I=j[k],R=[],V=0;V<I.length;V++)R.push(new Mt(I[V][0],I[V][1]));this.geometry.push(R)}return this.geometry},Fe.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var j=this.geometry,k=1/0,I=-1/0,R=1/0,V=-1/0,K=0;K<j.length;K++)for(var ee=j[K],re=0;re<ee.length;re++){var H=ee[re];k=Math.min(k,H.x),I=Math.max(I,H.x),R=Math.min(R,H.y),V=Math.max(V,H.y)}return[k,R,I,V]},Fe.prototype.toGeoJSON=De.prototype.toGeoJSON;var Ye=E.bA,_e=We;function xe(j){var k=new Ye;return function(I,R){for(var V in I.layers)R.writeMessage(3,Le,I.layers[V])}(j,k),k.finish()}function Le(j,k){var I;k.writeVarintField(15,j.version||1),k.writeStringField(1,j.name||""),k.writeVarintField(5,j.extent||4096);var R={keys:[],values:[],keycache:{},valuecache:{}};for(I=0;I<j.length;I++)R.feature=j.feature(I),k.writeMessage(2,ye,R);var V=R.keys;for(I=0;I<V.length;I++)k.writeStringField(3,V[I]);var K=R.values;for(I=0;I<K.length;I++)k.writeMessage(4,at,K[I])}function ye(j,k){var I=j.feature;I.id!==void 0&&k.writeVarintField(1,I.id),k.writeMessage(2,Je,j),k.writeVarintField(3,I.type),k.writeMessage(4,Ge,I)}function Je(j,k){var I=j.feature,R=j.keys,V=j.values,K=j.keycache,ee=j.valuecache;for(var re in I.properties){var H=I.properties[re],he=K[re];if(H!==null){he===void 0&&(R.push(re),K[re]=he=R.length-1),k.writeVarint(he);var me=typeof H;me!=="string"&&me!=="boolean"&&me!=="number"&&(H=JSON.stringify(H));var le=me+":"+H,Ae=ee[le];Ae===void 0&&(V.push(H),ee[le]=Ae=V.length-1),k.writeVarint(Ae)}}}function Pe(j,k){return(k<<3)+(7&j)}function tt(j){return j<<1^j>>31}function Ge(j,k){for(var I=j.loadGeometry(),R=j.type,V=0,K=0,ee=I.length,re=0;re<ee;re++){var H=I[re],he=1;R===1&&(he=H.length),k.writeVarint(Pe(1,he));for(var me=R===3?H.length-1:H.length,le=0;le<me;le++){le===1&&R!==1&&k.writeVarint(Pe(2,me-1));var Ae=H[le].x-V,Ke=H[le].y-K;k.writeVarint(tt(Ae)),k.writeVarint(tt(Ke)),V+=Ae,K+=Ke}R===3&&k.writeVarint(Pe(7,1))}}function at(j,k){var I=typeof j;I==="string"?k.writeStringField(1,j):I==="boolean"?k.writeBooleanField(7,j):I==="number"&&(j%1!=0?k.writeDoubleField(3,j):j<0?k.writeSVarintField(6,j):k.writeVarintField(5,j))}Lt.exports=xe,Lt.exports.fromVectorTileJs=xe,Lt.exports.fromGeojsonVt=function(j,k){k=k||{};var I={};for(var R in j)I[R]=new _e(j[R].features,k),I[R].name=R,I[R].version=k.version,I[R].extent=k.extent;return xe({layers:I})},Lt.exports.GeoJSONWrapper=_e;var ht=E.by(Lt.exports);let _t={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:j=>j},Ne=Math.fround||(kt=new Float32Array(1),j=>(kt[0]=+j,kt[0]));var kt;let Wt=3,dt=5,Pt=6;class xt{constructor(k){this.options=Object.assign(Object.create(_t),k),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(k){let{log:I,minZoom:R,maxZoom:V}=this.options;I&&console.time("total time");let K=`prepare ${k.length} points`;I&&console.time(K),this.points=k;let ee=[];for(let H=0;H<k.length;H++){let he=k[H];if(!he.geometry)continue;let[me,le]=he.geometry.coordinates,Ae=Ne(vt(me)),Ke=Ne(ui(le));ee.push(Ae,Ke,1/0,H,-1,1),this.options.reduce&&ee.push(0)}let re=this.trees[V+1]=this._createTree(ee);I&&console.timeEnd(K);for(let H=V;H>=R;H--){let he=+Date.now();re=this.trees[H]=this._createTree(this._cluster(re,H)),I&&console.log("z%d: %d clusters in %dms",H,re.numItems,+Date.now()-he)}return I&&console.timeEnd("total time"),this}getClusters(k,I){let R=((k[0]+180)%360+360)%360-180,V=Math.max(-90,Math.min(90,k[1])),K=k[2]===180?180:((k[2]+180)%360+360)%360-180,ee=Math.max(-90,Math.min(90,k[3]));if(k[2]-k[0]>=360)R=-180,K=180;else if(R>K){let le=this.getClusters([R,V,180,ee],I),Ae=this.getClusters([-180,V,K,ee],I);return le.concat(Ae)}let re=this.trees[this._limitZoom(I)],H=re.range(vt(R),ui(ee),vt(K),ui(V)),he=re.data,me=[];for(let le of H){let Ae=this.stride*le;me.push(he[Ae+dt]>1?Nt(he,Ae,this.clusterProps):this.points[he[Ae+Wt]])}return me}getChildren(k){let I=this._getOriginId(k),R=this._getOriginZoom(k),V="No cluster with the specified id.",K=this.trees[R];if(!K)throw new Error(V);let ee=K.data;if(I*this.stride>=ee.length)throw new Error(V);let re=this.options.radius/(this.options.extent*Math.pow(2,R-1)),H=K.within(ee[I*this.stride],ee[I*this.stride+1],re),he=[];for(let me of H){let le=me*this.stride;ee[le+4]===k&&he.push(ee[le+dt]>1?Nt(ee,le,this.clusterProps):this.points[ee[le+Wt]])}if(he.length===0)throw new Error(V);return he}getLeaves(k,I,R){let V=[];return this._appendLeaves(V,k,I=I||10,R=R||0,0),V}getTile(k,I,R){let V=this.trees[this._limitZoom(k)],K=Math.pow(2,k),{extent:ee,radius:re}=this.options,H=re/ee,he=(R-H)/K,me=(R+1+H)/K,le={features:[]};return this._addTileFeatures(V.range((I-H)/K,he,(I+1+H)/K,me),V.data,I,R,K,le),I===0&&this._addTileFeatures(V.range(1-H/K,he,1,me),V.data,K,R,K,le),I===K-1&&this._addTileFeatures(V.range(0,he,H/K,me),V.data,-1,R,K,le),le.features.length?le:null}getClusterExpansionZoom(k){let I=this._getOriginZoom(k)-1;for(;I<=this.options.maxZoom;){let R=this.getChildren(k);if(I++,R.length!==1)break;k=R[0].properties.cluster_id}return I}_appendLeaves(k,I,R,V,K){let ee=this.getChildren(I);for(let re of ee){let H=re.properties;if(H&&H.cluster?K+H.point_count<=V?K+=H.point_count:K=this._appendLeaves(k,H.cluster_id,R,V,K):K<V?K++:k.push(re),k.length===R)break}return K}_createTree(k){let I=new E.av(k.length/this.stride|0,this.options.nodeSize,Float32Array);for(let R=0;R<k.length;R+=this.stride)I.add(k[R],k[R+1]);return I.finish(),I.data=k,I}_addTileFeatures(k,I,R,V,K,ee){for(let re of k){let H=re*this.stride,he=I[H+dt]>1,me,le,Ae;if(he)me=$t(I,H,this.clusterProps),le=I[H],Ae=I[H+1];else{let zt=this.points[I[H+Wt]];me=zt.properties;let[pt,Bt]=zt.geometry.coordinates;le=vt(pt),Ae=ui(Bt)}let Ke={type:1,geometry:[[Math.round(this.options.extent*(le*K-R)),Math.round(this.options.extent*(Ae*K-V))]],tags:me},et;et=he||this.options.generateId?I[H+Wt]:this.points[I[H+Wt]].id,et!==void 0&&(Ke.id=et),ee.features.push(Ke)}}_limitZoom(k){return Math.max(this.options.minZoom,Math.min(Math.floor(+k),this.options.maxZoom+1))}_cluster(k,I){let{radius:R,extent:V,reduce:K,minPoints:ee}=this.options,re=R/(V*Math.pow(2,I)),H=k.data,he=[],me=this.stride;for(let le=0;le<H.length;le+=me){if(H[le+2]<=I)continue;H[le+2]=I;let Ae=H[le],Ke=H[le+1],et=k.within(H[le],H[le+1],re),zt=H[le+dt],pt=zt;for(let Bt of et){let Tt=Bt*me;H[Tt+2]>I&&(pt+=H[Tt+dt])}if(pt>zt&&pt>=ee){let Bt,Tt=Ae*zt,yi=Ke*zt,hi=-1,bt=((le/me|0)<<5)+(I+1)+this.points.length;for(let Ut of et){let oi=Ut*me;if(H[oi+2]<=I)continue;H[oi+2]=I;let Ei=H[oi+dt];Tt+=H[oi]*Ei,yi+=H[oi+1]*Ei,H[oi+4]=bt,K&&(Bt||(Bt=this._map(H,le,!0),hi=this.clusterProps.length,this.clusterProps.push(Bt)),K(Bt,this._map(H,oi)))}H[le+4]=bt,he.push(Tt/pt,yi/pt,1/0,bt,-1,pt),K&&he.push(hi)}else{for(let Bt=0;Bt<me;Bt++)he.push(H[le+Bt]);if(pt>1)for(let Bt of et){let Tt=Bt*me;if(!(H[Tt+2]<=I)){H[Tt+2]=I;for(let yi=0;yi<me;yi++)he.push(H[Tt+yi])}}}}return he}_getOriginId(k){return k-this.points.length>>5}_getOriginZoom(k){return(k-this.points.length)%32}_map(k,I,R){if(k[I+dt]>1){let ee=this.clusterProps[k[I+Pt]];return R?Object.assign({},ee):ee}let V=this.points[k[I+Wt]].properties,K=this.options.map(V);return R&&K===V?Object.assign({},K):K}}function Nt(j,k,I){return{type:"Feature",id:j[k+Wt],properties:$t(j,k,I),geometry:{type:"Point",coordinates:[(R=j[k],360*(R-.5)),Qe(j[k+1])]}};var R}function $t(j,k,I){let R=j[k+dt],V=R>=1e4?`${Math.round(R/1e3)}k`:R>=1e3?Math.round(R/100)/10+"k":R,K=j[k+Pt],ee=K===-1?{}:Object.assign({},I[K]);return Object.assign(ee,{cluster:!0,cluster_id:j[k+Wt],point_count:R,point_count_abbreviated:V})}function vt(j){return j/360+.5}function ui(j){let k=Math.sin(j*Math.PI/180),I=.5-.25*Math.log((1+k)/(1-k))/Math.PI;return I<0?0:I>1?1:I}function Qe(j){let k=(180-360*j)*Math.PI/180;return 360*Math.atan(Math.exp(k))/Math.PI-90}function gt(j,k,I,R){let V=R,K=k+(I-k>>1),ee,re=I-k,H=j[k],he=j[k+1],me=j[I],le=j[I+1];for(let Ae=k+3;Ae<I;Ae+=3){let Ke=Vt(j[Ae],j[Ae+1],H,he,me,le);if(Ke>V)ee=Ae,V=Ke;else if(Ke===V){let et=Math.abs(Ae-K);et<re&&(ee=Ae,re=et)}}V>R&&(ee-k>3&&gt(j,k,ee,R),j[ee+2]=V,I-ee>3&&gt(j,ee,I,R))}function Vt(j,k,I,R,V,K){let ee=V-I,re=K-R;if(ee!==0||re!==0){let H=((j-I)*ee+(k-R)*re)/(ee*ee+re*re);H>1?(I=V,R=K):H>0&&(I+=ee*H,R+=re*H)}return ee=j-I,re=k-R,ee*ee+re*re}function ut(j,k,I,R){let V={id:j??null,type:k,geometry:I,tags:R,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(k==="Point"||k==="MultiPoint"||k==="LineString")ci(V,I);else if(k==="Polygon")ci(V,I[0]);else if(k==="MultiLineString")for(let K of I)ci(V,K);else if(k==="MultiPolygon")for(let K of I)ci(V,K[0]);return V}function ci(j,k){for(let I=0;I<k.length;I+=3)j.minX=Math.min(j.minX,k[I]),j.minY=Math.min(j.minY,k[I+1]),j.maxX=Math.max(j.maxX,k[I]),j.maxY=Math.max(j.maxY,k[I+1])}function bi(j,k,I,R){if(!k.geometry)return;let V=k.geometry.coordinates;if(V&&V.length===0)return;let K=k.geometry.type,ee=Math.pow(I.tolerance/((1<<I.maxZoom)*I.extent),2),re=[],H=k.id;if(I.promoteId?H=k.properties[I.promoteId]:I.generateId&&(H=R||0),K==="Point")Kt(V,re);else if(K==="MultiPoint")for(let he of V)Kt(he,re);else if(K==="LineString")oe(V,re,ee,!1);else if(K==="MultiLineString"){if(I.lineMetrics){for(let he of V)re=[],oe(he,re,ee,!1),j.push(ut(H,"LineString",re,k.properties));return}Xi(V,re,ee,!1)}else if(K==="Polygon")Xi(V,re,ee,!0);else{if(K!=="MultiPolygon"){if(K==="GeometryCollection"){for(let he of k.geometry.geometries)bi(j,{id:H,geometry:he,properties:k.properties},I,R);return}throw new Error("Input data is not a valid GeoJSON object.")}for(let he of V){let me=[];Xi(he,me,ee,!0),re.push(me)}}j.push(ut(H,K,re,k.properties))}function Kt(j,k){k.push(kr(j[0]),wt(j[1]),0)}function oe(j,k,I,R){let V,K,ee=0;for(let H=0;H<j.length;H++){let he=kr(j[H][0]),me=wt(j[H][1]);k.push(he,me,0),H>0&&(ee+=R?(V*me-he*K)/2:Math.sqrt(Math.pow(he-V,2)+Math.pow(me-K,2))),V=he,K=me}let re=k.length-3;k[2]=1,gt(k,0,re,I),k[re+2]=1,k.size=Math.abs(ee),k.start=0,k.end=k.size}function Xi(j,k,I,R){for(let V=0;V<j.length;V++){let K=[];oe(j[V],K,I,R),k.push(K)}}function kr(j){return j/360+.5}function wt(j){let k=Math.sin(j*Math.PI/180),I=.5-.25*Math.log((1+k)/(1-k))/Math.PI;return I<0?0:I>1?1:I}function Zt(j,k,I,R,V,K,ee,re){if(R/=k,K>=(I/=k)&&ee<R)return j;if(ee<I||K>=R)return null;let H=[];for(let he of j){let me=he.geometry,le=he.type,Ae=V===0?he.minX:he.minY,Ke=V===0?he.maxX:he.maxY;if(Ae>=I&&Ke<R){H.push(he);continue}if(Ke<I||Ae>=R)continue;let et=[];if(le==="Point"||le==="MultiPoint")_r(me,et,I,R,V);else if(le==="LineString")Mr(me,et,I,R,V,!1,re.lineMetrics);else if(le==="MultiLineString")Qr(me,et,I,R,V,!1);else if(le==="Polygon")Qr(me,et,I,R,V,!0);else if(le==="MultiPolygon")for(let zt of me){let pt=[];Qr(zt,pt,I,R,V,!0),pt.length&&et.push(pt)}if(et.length){if(re.lineMetrics&&le==="LineString"){for(let zt of et)H.push(ut(he.id,le,zt,he.tags));continue}le!=="LineString"&&le!=="MultiLineString"||(et.length===1?(le="LineString",et=et[0]):le="MultiLineString"),le!=="Point"&&le!=="MultiPoint"||(le=et.length===3?"Point":"MultiPoint"),H.push(ut(he.id,le,et,he.tags))}}return H.length?H:null}function _r(j,k,I,R,V){for(let K=0;K<j.length;K+=3){let ee=j[K+V];ee>=I&&ee<=R&&Ui(k,j[K],j[K+1],j[K+2])}}function Mr(j,k,I,R,V,K,ee){let re=Wi(j),H=V===0?sn:yn,he,me,le=j.start;for(let pt=0;pt<j.length-3;pt+=3){let Bt=j[pt],Tt=j[pt+1],yi=j[pt+2],hi=j[pt+3],bt=j[pt+4],Ut=V===0?Bt:Tt,oi=V===0?hi:bt,Ei=!1;ee&&(he=Math.sqrt(Math.pow(Bt-hi,2)+Math.pow(Tt-bt,2))),Ut<I?oi>I&&(me=H(re,Bt,Tt,hi,bt,I),ee&&(re.start=le+he*me)):Ut>R?oi<R&&(me=H(re,Bt,Tt,hi,bt,R),ee&&(re.start=le+he*me)):Ui(re,Bt,Tt,yi),oi<I&&Ut>=I&&(me=H(re,Bt,Tt,hi,bt,I),Ei=!0),oi>R&&Ut<=R&&(me=H(re,Bt,Tt,hi,bt,R),Ei=!0),!K&&Ei&&(ee&&(re.end=le+he*me),k.push(re),re=Wi(j)),ee&&(le+=he)}let Ae=j.length-3,Ke=j[Ae],et=j[Ae+1],zt=V===0?Ke:et;zt>=I&&zt<=R&&Ui(re,Ke,et,j[Ae+2]),Ae=re.length-3,K&&Ae>=3&&(re[Ae]!==re[0]||re[Ae+1]!==re[1])&&Ui(re,re[0],re[1],re[2]),re.length&&k.push(re)}function Wi(j){let k=[];return k.size=j.size,k.start=j.start,k.end=j.end,k}function Qr(j,k,I,R,V,K){for(let ee of j)Mr(ee,k,I,R,V,K,!1)}function Ui(j,k,I,R){j.push(k,I,R)}function sn(j,k,I,R,V,K){let ee=(K-k)/(R-k);return Ui(j,K,I+(V-I)*ee,1),ee}function yn(j,k,I,R,V,K){let ee=(K-I)/(V-I);return Ui(j,k+(R-k)*ee,K,1),ee}function be(j,k){let I=[];for(let R=0;R<j.length;R++){let V=j[R],K=V.type,ee;if(K==="Point"||K==="MultiPoint"||K==="LineString")ee=or(V.geometry,k);else if(K==="MultiLineString"||K==="Polygon"){ee=[];for(let re of V.geometry)ee.push(or(re,k))}else if(K==="MultiPolygon"){ee=[];for(let re of V.geometry){let H=[];for(let he of re)H.push(or(he,k));ee.push(H)}}I.push(ut(V.id,K,ee,V.tags))}return I}function or(j,k){let I=[];I.size=j.size,j.start!==void 0&&(I.start=j.start,I.end=j.end);for(let R=0;R<j.length;R+=3)I.push(j[R]+k,j[R+1],j[R+2]);return I}function Ai(j,k){if(j.transformed)return j;let I=1<<j.z,R=j.x,V=j.y;for(let K of j.features){let ee=K.geometry,re=K.type;if(K.geometry=[],re===1)for(let H=0;H<ee.length;H+=2)K.geometry.push(lr(ee[H],ee[H+1],k,I,R,V));else for(let H=0;H<ee.length;H++){let he=[];for(let me=0;me<ee[H].length;me+=2)he.push(lr(ee[H][me],ee[H][me+1],k,I,R,V));K.geometry.push(he)}}return j.transformed=!0,j}function lr(j,k,I,R,V,K){return[Math.round(I*(j*R-V)),Math.round(I*(k*R-K))]}function Pr(j,k,I,R,V){let K=k===V.maxZoom?0:V.tolerance/((1<<k)*V.extent),ee={features:[],numPoints:0,numSimplified:0,numFeatures:j.length,source:null,x:I,y:R,z:k,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(let re of j)we(ee,re,K,V);return ee}function we(j,k,I,R){let V=k.geometry,K=k.type,ee=[];if(j.minX=Math.min(j.minX,k.minX),j.minY=Math.min(j.minY,k.minY),j.maxX=Math.max(j.maxX,k.maxX),j.maxY=Math.max(j.maxY,k.maxY),K==="Point"||K==="MultiPoint")for(let re=0;re<V.length;re+=3)ee.push(V[re],V[re+1]),j.numPoints++,j.numSimplified++;else if(K==="LineString")ft(ee,V,j,I,!1,!1);else if(K==="MultiLineString"||K==="Polygon")for(let re=0;re<V.length;re++)ft(ee,V[re],j,I,K==="Polygon",re===0);else if(K==="MultiPolygon")for(let re=0;re<V.length;re++){let H=V[re];for(let he=0;he<H.length;he++)ft(ee,H[he],j,I,!0,he===0)}if(ee.length){let re=k.tags||null;if(K==="LineString"&&R.lineMetrics){re={};for(let he in k.tags)re[he]=k.tags[he];re.mapbox_clip_start=V.start/V.size,re.mapbox_clip_end=V.end/V.size}let H={geometry:ee,type:K==="Polygon"||K==="MultiPolygon"?3:K==="LineString"||K==="MultiLineString"?2:1,tags:re};k.id!==null&&(H.id=k.id),j.features.push(H)}}function ft(j,k,I,R,V,K){let ee=R*R;if(R>0&&k.size<(V?ee:R))return void(I.numPoints+=k.length/3);let re=[];for(let H=0;H<k.length;H+=3)(R===0||k[H+2]>ee)&&(I.numSimplified++,re.push(k[H],k[H+1])),I.numPoints++;V&&function(H,he){let me=0;for(let le=0,Ae=H.length,Ke=Ae-2;le<Ae;Ke=le,le+=2)me+=(H[le]-H[Ke])*(H[le+1]+H[Ke+1]);if(me>0===he)for(let le=0,Ae=H.length;le<Ae/2;le+=2){let Ke=H[le],et=H[le+1];H[le]=H[Ae-2-le],H[le+1]=H[Ae-1-le],H[Ae-2-le]=Ke,H[Ae-1-le]=et}}(re,K),j.push(re)}let nt={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class Si{constructor(k,I){let R=(I=this.options=function(K,ee){for(let re in ee)K[re]=ee[re];return K}(Object.create(nt),I)).debug;if(R&&console.time("preprocess data"),I.maxZoom<0||I.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(I.promoteId&&I.generateId)throw new Error("promoteId and generateId cannot be used together.");let V=function(K,ee){let re=[];if(K.type==="FeatureCollection")for(let H=0;H<K.features.length;H++)bi(re,K.features[H],ee,H);else bi(re,K.type==="Feature"?K:{geometry:K},ee);return re}(k,I);this.tiles={},this.tileCoords=[],R&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",I.indexMaxZoom,I.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),V=function(K,ee){let re=ee.buffer/ee.extent,H=K,he=Zt(K,1,-1-re,re,0,-1,2,ee),me=Zt(K,1,1-re,2+re,0,-1,2,ee);return(he||me)&&(H=Zt(K,1,-re,1+re,0,-1,2,ee)||[],he&&(H=be(he,1).concat(H)),me&&(H=H.concat(be(me,-1)))),H}(V,I),V.length&&this.splitTile(V,0,0,0),R&&(V.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}splitTile(k,I,R,V,K,ee,re){let H=[k,I,R,V],he=this.options,me=he.debug;for(;H.length;){V=H.pop(),R=H.pop(),I=H.pop(),k=H.pop();let le=1<<I,Ae=Ji(I,R,V),Ke=this.tiles[Ae];if(!Ke&&(me>1&&console.time("creation"),Ke=this.tiles[Ae]=Pr(k,I,R,V,he),this.tileCoords.push({z:I,x:R,y:V}),me)){me>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",I,R,V,Ke.numFeatures,Ke.numPoints,Ke.numSimplified),console.timeEnd("creation"));let Ei=`z${I}`;this.stats[Ei]=(this.stats[Ei]||0)+1,this.total++}if(Ke.source=k,K==null){if(I===he.indexMaxZoom||Ke.numPoints<=he.indexMaxPoints)continue}else{if(I===he.maxZoom||I===K)continue;if(K!=null){let Ei=K-I;if(R!==ee>>Ei||V!==re>>Ei)continue}}if(Ke.source=null,k.length===0)continue;me>1&&console.time("clipping");let et=.5*he.buffer/he.extent,zt=.5-et,pt=.5+et,Bt=1+et,Tt=null,yi=null,hi=null,bt=null,Ut=Zt(k,le,R-et,R+pt,0,Ke.minX,Ke.maxX,he),oi=Zt(k,le,R+zt,R+Bt,0,Ke.minX,Ke.maxX,he);k=null,Ut&&(Tt=Zt(Ut,le,V-et,V+pt,1,Ke.minY,Ke.maxY,he),yi=Zt(Ut,le,V+zt,V+Bt,1,Ke.minY,Ke.maxY,he),Ut=null),oi&&(hi=Zt(oi,le,V-et,V+pt,1,Ke.minY,Ke.maxY,he),bt=Zt(oi,le,V+zt,V+Bt,1,Ke.minY,Ke.maxY,he),oi=null),me>1&&console.timeEnd("clipping"),H.push(Tt||[],I+1,2*R,2*V),H.push(yi||[],I+1,2*R,2*V+1),H.push(hi||[],I+1,2*R+1,2*V),H.push(bt||[],I+1,2*R+1,2*V+1)}}getTile(k,I,R){k=+k,I=+I,R=+R;let V=this.options,{extent:K,debug:ee}=V;if(k<0||k>24)return null;let re=1<<k,H=Ji(k,I=I+re&re-1,R);if(this.tiles[H])return Ai(this.tiles[H],K);ee>1&&console.log("drilling down to z%d-%d-%d",k,I,R);let he,me=k,le=I,Ae=R;for(;!he&&me>0;)me--,le>>=1,Ae>>=1,he=this.tiles[Ji(me,le,Ae)];return he&&he.source?(ee>1&&(console.log("found parent tile z%d-%d-%d",me,le,Ae),console.time("drilling down")),this.splitTile(he.source,me,le,Ae,k,I,R),ee>1&&console.timeEnd("drilling down"),this.tiles[H]?Ai(this.tiles[H],K):null):null}}function Ji(j,k,I){return 32*((1<<j)*I+k)+j}function st(j,k){return k?j.properties[k]:j.id}function Ki(j,k){if(j==null)return!0;if(j.type==="Feature")return st(j,k)!=null;if(j.type==="FeatureCollection"){let I=new Set;for(let R of j.features){let V=st(R,k);if(V==null||I.has(V))return!1;I.add(V)}return!0}return!1}function yr(j,k){let I=new Map;if(j!=null)if(j.type==="Feature")I.set(st(j,k),j);else for(let R of j.features)I.set(st(R,k),R);return I}class on extends se{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(k,I){return E._(this,void 0,void 0,function*(){let R=k.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");let V=this._geoJSONIndex.getTile(R.z,R.x,R.y);if(!V)return null;let K=new class{constructor(re){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=E.X,this.length=re.length,this._features=re}feature(re){return new class{constructor(H){this._feature=H,this.extent=E.X,this.type=H.type,this.properties=H.tags,"id"in H&&!isNaN(H.id)&&(this.id=parseInt(H.id,10))}loadGeometry(){if(this._feature.type===1){let H=[];for(let he of this._feature.geometry)H.push([new E.P(he[0],he[1])]);return H}{let H=[];for(let he of this._feature.geometry){let me=[];for(let le of he)me.push(new E.P(le[0],le[1]));H.push(me)}return H}}toGeoJSON(H,he,me){return li.call(this,H,he,me)}}(this._features[re])}}(V.features),ee=ht(K);return ee.byteOffset===0&&ee.byteLength===ee.buffer.byteLength||(ee=new Uint8Array(ee)),{vectorTile:K,rawData:ee.buffer}})}loadData(k){return E._(this,void 0,void 0,function*(){var I;(I=this._pendingRequest)===null||I===void 0||I.abort();let R=!!(k&&k.request&&k.request.collectResourceTiming)&&new E.bv(k.request);this._pendingRequest=new AbortController;try{this._pendingData=this.loadAndProcessGeoJSON(k,this._pendingRequest),this._geoJSONIndex=k.cluster?new xt(function({superclusterOptions:ee,clusterProperties:re}){if(!re||!ee)return ee;let H={},he={},me={accumulated:null,zoom:0},le={properties:null},Ae=Object.keys(re);for(let Ke of Ae){let[et,zt]=re[Ke],pt=E.bC(zt),Bt=E.bC(typeof et=="string"?[et,["accumulated"],["get",Ke]]:et);H[Ke]=pt.value,he[Ke]=Bt.value}return ee.map=Ke=>{le.properties=Ke;let et={};for(let zt of Ae)et[zt]=H[zt].evaluate(me,le);return et},ee.reduce=(Ke,et)=>{le.properties=et;for(let zt of Ae)me.accumulated=Ke[zt],Ke[zt]=he[zt].evaluate(me,le)},ee}(k)).load((yield this._pendingData).features):(V=yield this._pendingData,new Si(V,k.geojsonVtOptions)),this.loaded={};let K={};if(R){let ee=R.finish();ee&&(K.resourceTiming={},K.resourceTiming[k.source]=JSON.parse(JSON.stringify(ee)))}return K}catch(K){if(delete this._pendingRequest,E.bB(K))return{abandoned:!0};throw K}var V})}getData(){return E._(this,void 0,void 0,function*(){return this._pendingData})}reloadTile(k){let I=this.loaded;return I&&I[k.uid]?super.reloadTile(k):this.loadTile(k)}loadAndProcessGeoJSON(k,I){return E._(this,void 0,void 0,function*(){let R=yield this.loadGeoJSON(k,I);if(delete this._pendingRequest,typeof R!="object")throw new Error(`Input data given to '${k.source}' is not a valid GeoJSON object.`);if(Et(R,!0),k.filter){let V=E.bC(k.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(V.result==="error")throw new Error(V.value.map(ee=>`${ee.key}: ${ee.message}`).join(", "));R={type:"FeatureCollection",features:R.features.filter(ee=>V.value.evaluate({zoom:0},ee))}}return R})}loadGeoJSON(k,I){return E._(this,void 0,void 0,function*(){let{promoteId:R}=k;if(k.request){let V=yield E.h(k.request,I);return this._dataUpdateable=Ki(V.data,R)?yr(V.data,R):void 0,V.data}if(typeof k.data=="string")try{let V=JSON.parse(k.data);return this._dataUpdateable=Ki(V,R)?yr(V,R):void 0,V}catch{throw new Error(`Input data given to '${k.source}' is not a valid GeoJSON object.`)}if(!k.dataDiff)throw new Error(`Input data given to '${k.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${k.source}`);return function(V,K,ee){var re,H,he,me;if(K.removeAll&&V.clear(),K.remove)for(let le of K.remove)V.delete(le);if(K.add)for(let le of K.add){let Ae=st(le,ee);Ae!=null&&V.set(Ae,le)}if(K.update)for(let le of K.update){let Ae=V.get(le.id);if(Ae==null)continue;let Ke=!le.removeAllProperties&&(((re=le.removeProperties)===null||re===void 0?void 0:re.length)>0||((H=le.addOrUpdateProperties)===null||H===void 0?void 0:H.length)>0);if((le.newGeometry||le.removeAllProperties||Ke)&&(Ae=Object.assign({},Ae),V.set(le.id,Ae),Ke&&(Ae.properties=Object.assign({},Ae.properties))),le.newGeometry&&(Ae.geometry=le.newGeometry),le.removeAllProperties)Ae.properties={};else if(((he=le.removeProperties)===null||he===void 0?void 0:he.length)>0)for(let et of le.removeProperties)Object.prototype.hasOwnProperty.call(Ae.properties,et)&&delete Ae.properties[et];if(((me=le.addOrUpdateProperties)===null||me===void 0?void 0:me.length)>0)for(let{key:et,value:zt}of le.addOrUpdateProperties)Ae.properties[et]=zt}}(this._dataUpdateable,k.dataDiff,R),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(k){return E._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(k){return this._geoJSONIndex.getClusterExpansionZoom(k.clusterId)}getClusterChildren(k){return this._geoJSONIndex.getChildren(k.clusterId)}getClusterLeaves(k){return this._geoJSONIndex.getLeaves(k.clusterId,k.limit,k.offset)}}class Zr{constructor(k){this.self=k,this.actor=new E.F(k),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(I,R)=>{if(this.externalWorkerSourceTypes[I])throw new Error(`Worker source with name "${I}" already registered.`);this.externalWorkerSourceTypes[I]=R},this.self.addProtocol=E.bi,this.self.removeProtocol=E.bj,this.self.registerRTLTextPlugin=I=>{if(E.bD.isParsed())throw new Error("RTL text plugin already registered.");E.bD.setMethods(I)},this.actor.registerMessageHandler("LDT",(I,R)=>this._getDEMWorkerSource(I,R.source).loadTile(R)),this.actor.registerMessageHandler("RDT",(I,R)=>E._(this,void 0,void 0,function*(){this._getDEMWorkerSource(I,R.source).removeTile(R)})),this.actor.registerMessageHandler("GCEZ",(I,R)=>E._(this,void 0,void 0,function*(){return this._getWorkerSource(I,R.type,R.source).getClusterExpansionZoom(R)})),this.actor.registerMessageHandler("GCC",(I,R)=>E._(this,void 0,void 0,function*(){return this._getWorkerSource(I,R.type,R.source).getClusterChildren(R)})),this.actor.registerMessageHandler("GCL",(I,R)=>E._(this,void 0,void 0,function*(){return this._getWorkerSource(I,R.type,R.source).getClusterLeaves(R)})),this.actor.registerMessageHandler("LD",(I,R)=>this._getWorkerSource(I,R.type,R.source).loadData(R)),this.actor.registerMessageHandler("GD",(I,R)=>this._getWorkerSource(I,R.type,R.source).getData()),this.actor.registerMessageHandler("LT",(I,R)=>this._getWorkerSource(I,R.type,R.source).loadTile(R)),this.actor.registerMessageHandler("RT",(I,R)=>this._getWorkerSource(I,R.type,R.source).reloadTile(R)),this.actor.registerMessageHandler("AT",(I,R)=>this._getWorkerSource(I,R.type,R.source).abortTile(R)),this.actor.registerMessageHandler("RMT",(I,R)=>this._getWorkerSource(I,R.type,R.source).removeTile(R)),this.actor.registerMessageHandler("RS",(I,R)=>E._(this,void 0,void 0,function*(){if(!this.workerSources[I]||!this.workerSources[I][R.type]||!this.workerSources[I][R.type][R.source])return;let V=this.workerSources[I][R.type][R.source];delete this.workerSources[I][R.type][R.source],V.removeSource!==void 0&&V.removeSource(R)})),this.actor.registerMessageHandler("RM",I=>E._(this,void 0,void 0,function*(){delete this.layerIndexes[I],delete this.availableImages[I],delete this.workerSources[I],delete this.demWorkerSources[I]})),this.actor.registerMessageHandler("SR",(I,R)=>E._(this,void 0,void 0,function*(){this.referrer=R})),this.actor.registerMessageHandler("SRPS",(I,R)=>this._syncRTLPluginState(I,R)),this.actor.registerMessageHandler("IS",(I,R)=>E._(this,void 0,void 0,function*(){this.self.importScripts(R)})),this.actor.registerMessageHandler("SI",(I,R)=>this._setImages(I,R)),this.actor.registerMessageHandler("UL",(I,R)=>E._(this,void 0,void 0,function*(){this._getLayerIndex(I).update(R.layers,R.removedIds)})),this.actor.registerMessageHandler("SL",(I,R)=>E._(this,void 0,void 0,function*(){this._getLayerIndex(I).replace(R)}))}_setImages(k,I){return E._(this,void 0,void 0,function*(){this.availableImages[k]=I;for(let R in this.workerSources[k]){let V=this.workerSources[k][R];for(let K in V)V[K].availableImages=I}})}_syncRTLPluginState(k,I){return E._(this,void 0,void 0,function*(){if(E.bD.isParsed())return E.bD.getState();if(I.pluginStatus!=="loading")return E.bD.setState(I),I;let R=I.pluginURL;if(this.self.importScripts(R),E.bD.isParsed()){let V={pluginStatus:"loaded",pluginURL:R};return E.bD.setState(V),V}throw E.bD.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${R}`)})}_getAvailableImages(k){let I=this.availableImages[k];return I||(I=[]),I}_getLayerIndex(k){let I=this.layerIndexes[k];return I||(I=this.layerIndexes[k]=new p),I}_getWorkerSource(k,I,R){if(this.workerSources[k]||(this.workerSources[k]={}),this.workerSources[k][I]||(this.workerSources[k][I]={}),!this.workerSources[k][I][R]){let V={sendAsync:(K,ee)=>(K.targetMapId=k,this.actor.sendAsync(K,ee))};switch(I){case"vector":this.workerSources[k][I][R]=new se(V,this._getLayerIndex(k),this._getAvailableImages(k));break;case"geojson":this.workerSources[k][I][R]=new on(V,this._getLayerIndex(k),this._getAvailableImages(k));break;default:this.workerSources[k][I][R]=new this.externalWorkerSourceTypes[I](V,this._getLayerIndex(k),this._getAvailableImages(k))}}return this.workerSources[k][I][R]}_getDEMWorkerSource(k,I){return this.demWorkerSources[k]||(this.demWorkerSources[k]={}),this.demWorkerSources[k][I]||(this.demWorkerSources[k][I]=new X),this.demWorkerSources[k][I]}}return E.i(self)&&(self.worker=new Zr(self)),Zr}),F("index",["exports","./shared"],function(E,p){"use strict";var ue="4.7.1";let pe,Ce,se={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:c=>new Promise((e,n)=>{let s=requestAnimationFrame(e);c.signal.addEventListener("abort",()=>{cancelAnimationFrame(s),n(p.c())})}),getImageData(c,e=0){return this.getImageCanvasContext(c).getImageData(-e,-e,c.width+2*e,c.height+2*e)},getImageCanvasContext(c){let e=window.document.createElement("canvas"),n=e.getContext("2d",{willReadFrequently:!0});if(!n)throw new Error("failed to create canvas 2d context");return e.width=c.width,e.height=c.height,n.drawImage(c,0,0,c.width,c.height),n},resolveURL:c=>(pe||(pe=document.createElement("a")),pe.href=c,pe.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(Ce==null&&(Ce=matchMedia("(prefers-reduced-motion: reduce)")),Ce.matches)}};class X{static testProp(e){if(!X.docStyle)return e[0];for(let n=0;n<e.length;n++)if(e[n]in X.docStyle)return e[n];return e[0]}static create(e,n,s){let o=window.document.createElement(e);return n!==void 0&&(o.className=n),s&&s.appendChild(o),o}static createNS(e,n){return window.document.createElementNS(e,n)}static disableDrag(){X.docStyle&&X.selectProp&&(X.userSelect=X.docStyle[X.selectProp],X.docStyle[X.selectProp]="none")}static enableDrag(){X.docStyle&&X.selectProp&&(X.docStyle[X.selectProp]=X.userSelect)}static setTransform(e,n){e.style[X.transformProp]=n}static addEventListener(e,n,s,o={}){e.addEventListener(n,s,"passive"in o?o:o.capture)}static removeEventListener(e,n,s,o={}){e.removeEventListener(n,s,"passive"in o?o:o.capture)}static suppressClickInternal(e){e.preventDefault(),e.stopPropagation(),window.removeEventListener("click",X.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",X.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",X.suppressClickInternal,!0)},0)}static getScale(e){let n=e.getBoundingClientRect();return{x:n.width/e.offsetWidth||1,y:n.height/e.offsetHeight||1,boundingClientRect:n}}static getPoint(e,n,s){let o=n.boundingClientRect;return new p.P((s.clientX-o.left)/n.x-e.clientLeft,(s.clientY-o.top)/n.y-e.clientTop)}static mousePos(e,n){let s=X.getScale(e);return X.getPoint(e,s,n)}static touchPos(e,n){let s=[],o=X.getScale(e);for(let u=0;u<n.length;u++)s.push(X.getPoint(e,o,n[u]));return s}static mouseButton(e){return e.button}static remove(e){e.parentNode&&e.parentNode.removeChild(e)}}X.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,X.selectProp=X.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),X.transformProp=X.testProp(["transform","WebkitTransform"]);let It={supported:!1,testSupport:function(c){!li&&Et&&(Lt?Mt(c):mt=c)}},mt,Et,li=!1,Lt=!1;function Mt(c){let e=c.createTexture();c.bindTexture(c.TEXTURE_2D,e);try{if(c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,Et),c.isContextLost())return;It.supported=!0}catch{}c.deleteTexture(e),li=!0}var De;typeof document<"u"&&(Et=document.createElement("img"),Et.onload=()=>{mt&&Mt(mt),mt=null,Lt=!0},Et.onerror=()=>{li=!0,mt=null},Et.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(c){let e,n,s,o;c.resetRequestQueue=()=>{e=[],n=0,s=0,o={}},c.addThrottleControl=y=>{let b=s++;return o[b]=y,b},c.removeThrottleControl=y=>{delete o[y],m()},c.getImage=(y,b,T=!0)=>new Promise((C,P)=>{It.supported&&(y.headers||(y.headers={}),y.headers.accept="image/webp,*/*"),p.e(y,{type:"image"}),e.push({abortController:b,requestParameters:y,supportImageRefresh:T,state:"queued",onError:L=>{P(L)},onSuccess:L=>{C(L)}}),m()});let u=y=>p._(this,void 0,void 0,function*(){y.state="running";let{requestParameters:b,supportImageRefresh:T,onError:C,onSuccess:P,abortController:L}=y,O=T===!1&&!p.i(self)&&!p.g(b.url)&&(!b.headers||Object.keys(b.headers).reduce((G,W)=>G&&W==="accept",!0));n++;let U=O?_(b,L):p.m(b,L);try{let G=yield U;delete y.abortController,y.state="completed",G.data instanceof HTMLImageElement||p.b(G.data)?P(G):G.data&&P({data:yield(Z=G.data,typeof createImageBitmap=="function"?p.d(Z):p.f(Z)),cacheControl:G.cacheControl,expires:G.expires})}catch(G){delete y.abortController,C(G)}finally{n--,m()}var Z}),m=()=>{let y=(()=>{for(let b of Object.keys(o))if(o[b]())return!0;return!1})()?p.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:p.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let b=n;b<y&&e.length>0;b++){let T=e.shift();T.abortController.signal.aborted?b--:u(T)}},_=(y,b)=>new Promise((T,C)=>{let P=new Image,L=y.url,O=y.credentials;O&&O==="include"?P.crossOrigin="use-credentials":(O&&O==="same-origin"||!p.s(L))&&(P.crossOrigin="anonymous"),b.signal.addEventListener("abort",()=>{P.src="",C(p.c())}),P.fetchPriority="high",P.onload=()=>{P.onerror=P.onload=null,T({data:P})},P.onerror=()=>{P.onerror=P.onload=null,b.signal.aborted||C(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."))},P.src=L})}(De||(De={})),De.resetRequestQueue();class We{constructor(e){this._transformRequestFn=e}transformRequest(e,n){return this._transformRequestFn&&this._transformRequestFn(e,n)||{url:e}}setTransformRequest(e){this._transformRequestFn=e}}function Re(c){var e=new p.A(3);return e[0]=c[0],e[1]=c[1],e[2]=c[2],e}var Fe,Ye=function(c,e,n){return c[0]=e[0]-n[0],c[1]=e[1]-n[1],c[2]=e[2]-n[2],c};Fe=new p.A(3),p.A!=Float32Array&&(Fe[0]=0,Fe[1]=0,Fe[2]=0);var _e=function(c){var e=c[0],n=c[1];return e*e+n*n};function xe(c){let e=[];if(typeof c=="string")e.push({id:"default",url:c});else if(c&&c.length>0){let n=[];for(let{id:s,url:o}of c){let u=`${s}${o}`;n.indexOf(u)===-1&&(n.push(u),e.push({id:s,url:o}))}}return e}function Le(c,e,n){let s=c.split("?");return s[0]+=`${e}${n}`,s.join("?")}(function(){var c=new p.A(2);p.A!=Float32Array&&(c[0]=0,c[1]=0)})();class ye{constructor(e,n,s,o){this.context=e,this.format=s,this.texture=e.gl.createTexture(),this.update(n,o)}update(e,n,s){let{width:o,height:u}=e,m=!(this.size&&this.size[0]===o&&this.size[1]===u||s),{context:_}=this,{gl:y}=_;if(this.useMipmap=!!(n&&n.useMipmap),y.bindTexture(y.TEXTURE_2D,this.texture),_.pixelStoreUnpackFlipY.set(!1),_.pixelStoreUnpack.set(1),_.pixelStoreUnpackPremultiplyAlpha.set(this.format===y.RGBA&&(!n||n.premultiply!==!1)),m)this.size=[o,u],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||p.b(e)?y.texImage2D(y.TEXTURE_2D,0,this.format,this.format,y.UNSIGNED_BYTE,e):y.texImage2D(y.TEXTURE_2D,0,this.format,o,u,0,this.format,y.UNSIGNED_BYTE,e.data);else{let{x:b,y:T}=s||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||p.b(e)?y.texSubImage2D(y.TEXTURE_2D,0,b,T,y.RGBA,y.UNSIGNED_BYTE,e):y.texSubImage2D(y.TEXTURE_2D,0,b,T,o,u,y.RGBA,y.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&y.generateMipmap(y.TEXTURE_2D)}bind(e,n,s){let{context:o}=this,{gl:u}=o;u.bindTexture(u.TEXTURE_2D,this.texture),s!==u.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(s=u.LINEAR),e!==this.filter&&(u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MAG_FILTER,e),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MIN_FILTER,s||e),this.filter=e),n!==this.wrap&&(u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_S,n),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_T,n),this.wrap=n)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){let{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}function Je(c){let{userImage:e}=c;return!!(e&&e.render&&e.render())&&(c.data.replace(new Uint8Array(e.data.buffer)),!0)}class Pe extends p.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new p.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(let{ids:n,promiseResolve:s}of this.requestors)s(this._getImagesForIds(n));this.requestors=[]}}getImage(e){let n=this.images[e];if(n&&!n.data&&n.spriteData){let s=n.spriteData;n.data=new p.R({width:s.width,height:s.height},s.context.getImageData(s.x,s.y,s.width,s.height).data),n.spriteData=null}return n}addImage(e,n){if(this.images[e])throw new Error(`Image id ${e} already exist, use updateImage instead`);this._validate(e,n)&&(this.images[e]=n)}_validate(e,n){let s=!0,o=n.data||n.spriteData;return this._validateStretch(n.stretchX,o&&o.width)||(this.fire(new p.j(new Error(`Image "${e}" has invalid "stretchX" value`))),s=!1),this._validateStretch(n.stretchY,o&&o.height)||(this.fire(new p.j(new Error(`Image "${e}" has invalid "stretchY" value`))),s=!1),this._validateContent(n.content,n)||(this.fire(new p.j(new Error(`Image "${e}" has invalid "content" value`))),s=!1),s}_validateStretch(e,n){if(!e)return!0;let s=0;for(let o of e){if(o[0]<s||o[1]<o[0]||n<o[1])return!1;s=o[1]}return!0}_validateContent(e,n){if(!e)return!0;if(e.length!==4)return!1;let s=n.spriteData,o=s&&s.width||n.data.width,u=s&&s.height||n.data.height;return!(e[0]<0||o<e[0]||e[1]<0||u<e[1]||e[2]<0||o<e[2]||e[3]<0||u<e[3]||e[2]<e[0]||e[3]<e[1])}updateImage(e,n,s=!0){let o=this.getImage(e);if(s&&(o.data.width!==n.data.width||o.data.height!==n.data.height))throw new Error(`size mismatch between old image (${o.data.width}x${o.data.height}) and new image (${n.data.width}x${n.data.height}).`);n.version=o.version+1,this.images[e]=n,this.updatedImages[e]=!0}removeImage(e){let n=this.images[e];delete this.images[e],delete this.patterns[e],n.userImage&&n.userImage.onRemove&&n.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(e){return new Promise((n,s)=>{let o=!0;if(!this.isLoaded())for(let u of e)this.images[u]||(o=!1);this.isLoaded()||o?n(this._getImagesForIds(e)):this.requestors.push({ids:e,promiseResolve:n})})}_getImagesForIds(e){let n={};for(let s of e){let o=this.getImage(s);o||(this.fire(new p.k("styleimagemissing",{id:s})),o=this.getImage(s)),o?n[s]={data:o.data.clone(),pixelRatio:o.pixelRatio,sdf:o.sdf,version:o.version,stretchX:o.stretchX,stretchY:o.stretchY,content:o.content,textFitWidth:o.textFitWidth,textFitHeight:o.textFitHeight,hasRenderCallback:!!(o.userImage&&o.userImage.render)}:p.w(`Image "${s}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}return n}getPixelSize(){let{width:e,height:n}=this.atlasImage;return{width:e,height:n}}getPattern(e){let n=this.patterns[e],s=this.getImage(e);if(!s)return null;if(n&&n.position.version===s.version)return n.position;if(n)n.position.version=s.version;else{let o={w:s.data.width+2,h:s.data.height+2,x:0,y:0},u=new p.I(o,s);this.patterns[e]={bin:o,position:u}}return this._updatePatternAtlas(),this.patterns[e].position}bind(e){let n=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new ye(e,this.atlasImage,n.RGBA),this.atlasTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}_updatePatternAtlas(){let e=[];for(let u in this.patterns)e.push(this.patterns[u].bin);let{w:n,h:s}=p.p(e),o=this.atlasImage;o.resize({width:n||1,height:s||1});for(let u in this.patterns){let{bin:m}=this.patterns[u],_=m.x+1,y=m.y+1,b=this.getImage(u).data,T=b.width,C=b.height;p.R.copy(b,o,{x:0,y:0},{x:_,y},{width:T,height:C}),p.R.copy(b,o,{x:0,y:C-1},{x:_,y:y-1},{width:T,height:1}),p.R.copy(b,o,{x:0,y:0},{x:_,y:y+C},{width:T,height:1}),p.R.copy(b,o,{x:T-1,y:0},{x:_-1,y},{width:1,height:C}),p.R.copy(b,o,{x:0,y:0},{x:_+T,y},{width:1,height:C})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(let n of e){if(this.callbackDispatchedThisFrame[n])continue;this.callbackDispatchedThisFrame[n]=!0;let s=this.getImage(n);s||p.w(`Image with ID: "${n}" was not found`),Je(s)&&this.updateImage(n,s)}}}let tt=1e20;function Ge(c,e,n,s,o,u,m,_,y){for(let b=e;b<e+s;b++)at(c,n*u+b,u,o,m,_,y);for(let b=n;b<n+o;b++)at(c,b*u+e,1,s,m,_,y)}function at(c,e,n,s,o,u,m){u[0]=0,m[0]=-tt,m[1]=tt,o[0]=c[e];for(let _=1,y=0,b=0;_<s;_++){o[_]=c[e+_*n];let T=_*_;do{let C=u[y];b=(o[_]-o[C]+T-C*C)/(_-C)/2}while(b<=m[y]&&--y>-1);y++,u[y]=_,m[y]=b,m[y+1]=tt}for(let _=0,y=0;_<s;_++){for(;m[y+1]<_;)y++;let b=u[y],T=_-b;c[e+_*n]=o[b]+T*T}}class ht{constructor(e,n){this.requestManager=e,this.localIdeographFontFamily=n,this.entries={}}setURL(e){this.url=e}getGlyphs(e){return p._(this,void 0,void 0,function*(){let n=[];for(let u in e)for(let m of e[u])n.push(this._getAndCacheGlyphsPromise(u,m));let s=yield Promise.all(n),o={};for(let{stack:u,id:m,glyph:_}of s)o[u]||(o[u]={}),o[u][m]=_&&{id:_.id,bitmap:_.bitmap.clone(),metrics:_.metrics};return o})}_getAndCacheGlyphsPromise(e,n){return p._(this,void 0,void 0,function*(){let s=this.entries[e];s||(s=this.entries[e]={glyphs:{},requests:{},ranges:{}});let o=s.glyphs[n];if(o!==void 0)return{stack:e,id:n,glyph:o};if(o=this._tinySDF(s,e,n),o)return s.glyphs[n]=o,{stack:e,id:n,glyph:o};let u=Math.floor(n/256);if(256*u>65535)throw new Error("glyphs > 65535 not supported");if(s.ranges[u])return{stack:e,id:n,glyph:o};if(!this.url)throw new Error("glyphsUrl is not set");if(!s.requests[u]){let _=ht.loadGlyphRange(e,u,this.url,this.requestManager);s.requests[u]=_}let m=yield s.requests[u];for(let _ in m)this._doesCharSupportLocalGlyph(+_)||(s.glyphs[+_]=m[+_]);return s.ranges[u]=!0,{stack:e,id:n,glyph:m[n]||null}})}_doesCharSupportLocalGlyph(e){return!!this.localIdeographFontFamily&&/\p{Ideo}|\p{sc=Hang}|\p{sc=Hira}|\p{sc=Kana}/u.test(String.fromCodePoint(e))}_tinySDF(e,n,s){let o=this.localIdeographFontFamily;if(!o||!this._doesCharSupportLocalGlyph(s))return;let u=e.tinySDF;if(!u){let _="400";/bold/i.test(n)?_="900":/medium/i.test(n)?_="500":/light/i.test(n)&&(_="200"),u=e.tinySDF=new ht.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:o,fontWeight:_})}let m=u.draw(String.fromCharCode(s));return{id:s,bitmap:new p.o({width:m.width||60,height:m.height||60},m.data),metrics:{width:m.glyphWidth/2||24,height:m.glyphHeight/2||24,left:m.glyphLeft/2+.5||0,top:m.glyphTop/2-27.5||-8,advance:m.glyphAdvance/2||24,isDoubleResolution:!0}}}}ht.loadGlyphRange=function(c,e,n,s){return p._(this,void 0,void 0,function*(){let o=256*e,u=o+255,m=s.transformRequest(n.replace("{fontstack}",c).replace("{range}",`${o}-${u}`),"Glyphs"),_=yield p.l(m,new AbortController);if(!_||!_.data)throw new Error(`Could not load glyph range. range: ${e}, ${o}-${u}`);let y={};for(let b of p.n(_.data))y[b.id]=b;return y})},ht.TinySDF=class{constructor({fontSize:c=24,buffer:e=3,radius:n=8,cutoff:s=.25,fontFamily:o="sans-serif",fontWeight:u="normal",fontStyle:m="normal"}={}){this.buffer=e,this.cutoff=s,this.radius=n;let _=this.size=c+4*e,y=this._createCanvas(_),b=this.ctx=y.getContext("2d",{willReadFrequently:!0});b.font=`${m} ${u} ${c}px ${o}`,b.textBaseline="alphabetic",b.textAlign="left",b.fillStyle="black",this.gridOuter=new Float64Array(_*_),this.gridInner=new Float64Array(_*_),this.f=new Float64Array(_),this.z=new Float64Array(_+1),this.v=new Uint16Array(_)}_createCanvas(c){let e=document.createElement("canvas");return e.width=e.height=c,e}draw(c){let{width:e,actualBoundingBoxAscent:n,actualBoundingBoxDescent:s,actualBoundingBoxLeft:o,actualBoundingBoxRight:u}=this.ctx.measureText(c),m=Math.ceil(n),_=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(u-o))),y=Math.min(this.size-this.buffer,m+Math.ceil(s)),b=_+2*this.buffer,T=y+2*this.buffer,C=Math.max(b*T,0),P=new Uint8ClampedArray(C),L={data:P,width:b,height:T,glyphWidth:_,glyphHeight:y,glyphTop:m,glyphLeft:0,glyphAdvance:e};if(_===0||y===0)return L;let{ctx:O,buffer:U,gridInner:Z,gridOuter:G}=this;O.clearRect(U,U,_,y),O.fillText(c,U,U+m);let W=O.getImageData(U,U,_,y);G.fill(tt,0,C),Z.fill(0,0,C);for(let N=0;N<y;N++)for(let Q=0;Q<_;Q++){let te=W.data[4*(N*_+Q)+3]/255;if(te===0)continue;let ae=(N+U)*b+Q+U;if(te===1)G[ae]=0,Z[ae]=tt;else{let fe=.5-te;G[ae]=fe>0?fe*fe:0,Z[ae]=fe<0?fe*fe:0}}Ge(G,0,0,b,T,b,this.f,this.v,this.z),Ge(Z,U,U,_,y,b,this.f,this.v,this.z);for(let N=0;N<C;N++){let Q=Math.sqrt(G[N])-Math.sqrt(Z[N]);P[N]=Math.round(255-255*(Q/this.radius+this.cutoff))}return L}};class _t{constructor(){this.specification=p.v.light.position}possiblyEvaluate(e,n){return p.x(e.expression.evaluate(n))}interpolate(e,n,s){return{x:p.y.number(e.x,n.x,s),y:p.y.number(e.y,n.y,s),z:p.y.number(e.z,n.z,s)}}}let Ne;class kt extends p.E{constructor(e){super(),Ne=Ne||new p.q({anchor:new p.D(p.v.light.anchor),position:new _t,color:new p.D(p.v.light.color),intensity:new p.D(p.v.light.intensity)}),this._transitionable=new p.T(Ne),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,n={}){if(!this._validate(p.r,e,n))for(let s in e){let o=e[s];s.endsWith("-transition")?this._transitionable.setTransition(s.slice(0,-11),o):this._transitionable.setValue(s,o)}}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,n,s){return(!s||s.validate!==!1)&&p.t(this,e.call(p.u,{value:n,style:{glyphs:!0,sprite:!0},styleSpec:p.v}))}}let Wt=new p.q({"sky-color":new p.D(p.v.sky["sky-color"]),"horizon-color":new p.D(p.v.sky["horizon-color"]),"fog-color":new p.D(p.v.sky["fog-color"]),"fog-ground-blend":new p.D(p.v.sky["fog-ground-blend"]),"horizon-fog-blend":new p.D(p.v.sky["horizon-fog-blend"]),"sky-horizon-blend":new p.D(p.v.sky["sky-horizon-blend"]),"atmosphere-blend":new p.D(p.v.sky["atmosphere-blend"])});class dt extends p.E{constructor(e){super(),this._transitionable=new p.T(Wt),this.setSky(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new p.z(0))}setSky(e,n={}){if(!this._validate(p.B,e,n)){e||(e={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(let s in e){let o=e[s];s.endsWith("-transition")?this._transitionable.setTransition(s.slice(0,-11),o):this._transitionable.setValue(s,o)}}}getSky(){return this._transitionable.serialize()}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,n,s={}){return s?.validate!==!1&&p.t(this,e.call(p.u,p.e({value:n,style:{glyphs:!0,sprite:!0},styleSpec:p.v})))}calculateFogBlendOpacity(e){return e<60?0:e<70?(e-60)/10:1}}class Pt{constructor(e,n){this.width=e,this.height=n,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(e,n){let s=e.join(",")+String(n);return this.dashEntry[s]||(this.dashEntry[s]=this.addDash(e,n)),this.dashEntry[s]}getDashRanges(e,n,s){let o=[],u=e.length%2==1?-e[e.length-1]*s:0,m=e[0]*s,_=!0;o.push({left:u,right:m,isDash:_,zeroLength:e[0]===0});let y=e[0];for(let b=1;b<e.length;b++){_=!_;let T=e[b];u=y*s,y+=T,m=y*s,o.push({left:u,right:m,isDash:_,zeroLength:T===0})}return o}addRoundDash(e,n,s){let o=n/2;for(let u=-s;u<=s;u++){let m=this.width*(this.nextRow+s+u),_=0,y=e[_];for(let b=0;b<this.width;b++){b/y.right>1&&(y=e[++_]);let T=Math.abs(b-y.left),C=Math.abs(b-y.right),P=Math.min(T,C),L,O=u/s*(o+1);if(y.isDash){let U=o-Math.abs(O);L=Math.sqrt(P*P+U*U)}else L=o-Math.sqrt(P*P+O*O);this.data[m+b]=Math.max(0,Math.min(255,L+128))}}}addRegularDash(e){for(let _=e.length-1;_>=0;--_){let y=e[_],b=e[_+1];y.zeroLength?e.splice(_,1):b&&b.isDash===y.isDash&&(b.left=y.left,e.splice(_,1))}let n=e[0],s=e[e.length-1];n.isDash===s.isDash&&(n.left=s.left-this.width,s.right=n.right+this.width);let o=this.width*this.nextRow,u=0,m=e[u];for(let _=0;_<this.width;_++){_/m.right>1&&(m=e[++u]);let y=Math.abs(_-m.left),b=Math.abs(_-m.right),T=Math.min(y,b);this.data[o+_]=Math.max(0,Math.min(255,(m.isDash?T:-T)+128))}}addDash(e,n){let s=n?7:0,o=2*s+1;if(this.nextRow+o>this.height)return p.w("LineAtlas out of space"),null;let u=0;for(let _=0;_<e.length;_++)u+=e[_];if(u!==0){let _=this.width/u,y=this.getDashRanges(e,this.width,_);n?this.addRoundDash(y,_,s):this.addRegularDash(y)}let m={y:(this.nextRow+s+.5)/this.height,height:2*s/this.height,width:u};return this.nextRow+=o,this.dirty=!0,m}bind(e){let n=e.gl;this.texture?(n.bindTexture(n.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,n.texSubImage2D(n.TEXTURE_2D,0,0,0,this.width,this.height,n.ALPHA,n.UNSIGNED_BYTE,this.data))):(this.texture=n.createTexture(),n.bindTexture(n.TEXTURE_2D,this.texture),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.REPEAT),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.REPEAT),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),n.texImage2D(n.TEXTURE_2D,0,n.ALPHA,this.width,this.height,0,n.ALPHA,n.UNSIGNED_BYTE,this.data))}}let xt="maplibre_preloaded_worker_pool";class Nt{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<Nt.workerCount;)this.workers.push(new Worker(p.a.WORKER_URL));return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],this.numActive()===0&&(this.workers.forEach(n=>{n.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[xt]}numActive(){return Object.keys(this.active).length}}let $t=Math.floor(se.hardwareConcurrency/2),vt,ui;function Qe(){return vt||(vt=new Nt),vt}Nt.workerCount=p.C(globalThis)?Math.max(Math.min($t,3),1):1;class gt{constructor(e,n){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=n;let s=this.workerPool.acquire(n);for(let o=0;o<s.length;o++){let u=new p.F(s[o],n);u.name=`Worker ${o}`,this.actors.push(u)}if(!this.actors.length)throw new Error("No actors found")}broadcast(e,n){let s=[];for(let o of this.actors)s.push(o.sendAsync({type:e,data:n}));return Promise.all(s)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(e=!0){this.actors.forEach(n=>{n.remove()}),this.actors=[],e&&this.workerPool.release(this.id)}registerMessageHandler(e,n){for(let s of this.actors)s.registerMessageHandler(e,n)}}function Vt(){return ui||(ui=new gt(Qe(),p.G),ui.registerMessageHandler("GR",(c,e,n)=>p.m(e,n))),ui}function ut(c,e){let n=p.H();return p.J(n,n,[1,1,0]),p.K(n,n,[.5*c.width,.5*c.height,1]),p.L(n,n,c.calculatePosMatrix(e.toUnwrapped()))}function ci(c,e,n,s,o,u){let m=function(C,P,L){if(C)for(let O of C){let U=P[O];if(U&&U.source===L&&U.type==="fill-extrusion")return!0}else for(let O in P){let U=P[O];if(U.source===L&&U.type==="fill-extrusion")return!0}return!1}(o&&o.layers,e,c.id),_=u.maxPitchScaleFactor(),y=c.tilesIn(s,_,m);y.sort(bi);let b=[];for(let C of y)b.push({wrappedTileID:C.tileID.wrapped().key,queryResults:C.tile.queryRenderedFeatures(e,n,c._state,C.queryGeometry,C.cameraQueryGeometry,C.scale,o,u,_,ut(c.transform,C.tileID))});let T=function(C){let P={},L={};for(let O of C){let U=O.queryResults,Z=O.wrappedTileID,G=L[Z]=L[Z]||{};for(let W in U){let N=U[W],Q=G[W]=G[W]||{},te=P[W]=P[W]||[];for(let ae of N)Q[ae.featureIndex]||(Q[ae.featureIndex]=!0,te.push(ae))}}return P}(b);for(let C in T)T[C].forEach(P=>{let L=P.feature,O=c.getFeatureState(L.layer["source-layer"],L.id);L.source=L.layer.source,L.layer["source-layer"]&&(L.sourceLayer=L.layer["source-layer"]),L.state=O});return T}function bi(c,e){let n=c.tileID,s=e.tileID;return n.overscaledZ-s.overscaledZ||n.canonical.y-s.canonical.y||n.wrap-s.wrap||n.canonical.x-s.canonical.x}function Kt(c,e,n){return p._(this,void 0,void 0,function*(){let s=c;if(c.url?s=(yield p.h(e.transformRequest(c.url,"Source"),n)).data:yield se.frameAsync(n),!s)return null;let o=p.M(p.e(s,c),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in s&&s.vector_layers&&(o.vectorLayerIds=s.vector_layers.map(u=>u.id)),o})}class oe{constructor(e,n){e&&(n?this.setSouthWest(e).setNorthEast(n):Array.isArray(e)&&(e.length===4?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1])))}setNorthEast(e){return this._ne=e instanceof p.N?new p.N(e.lng,e.lat):p.N.convert(e),this}setSouthWest(e){return this._sw=e instanceof p.N?new p.N(e.lng,e.lat):p.N.convert(e),this}extend(e){let n=this._sw,s=this._ne,o,u;if(e instanceof p.N)o=e,u=e;else{if(!(e instanceof oe))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(oe.convert(e)):this.extend(p.N.convert(e)):e&&("lng"in e||"lon"in e)&&"lat"in e?this.extend(p.N.convert(e)):this;if(o=e._sw,u=e._ne,!o||!u)return this}return n||s?(n.lng=Math.min(o.lng,n.lng),n.lat=Math.min(o.lat,n.lat),s.lng=Math.max(u.lng,s.lng),s.lat=Math.max(u.lat,s.lat)):(this._sw=new p.N(o.lng,o.lat),this._ne=new p.N(u.lng,u.lat)),this}getCenter(){return new p.N((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new p.N(this.getWest(),this.getNorth())}getSouthEast(){return new p.N(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){let{lng:n,lat:s}=p.N.convert(e),o=this._sw.lng<=n&&n<=this._ne.lng;return this._sw.lng>this._ne.lng&&(o=this._sw.lng>=n&&n>=this._ne.lng),this._sw.lat<=s&&s<=this._ne.lat&&o}static convert(e){return e instanceof oe?e:e&&new oe(e)}static fromLngLat(e,n=0){let s=360*n/40075017,o=s/Math.cos(Math.PI/180*e.lat);return new oe(new p.N(e.lng-o,e.lat-s),new p.N(e.lng+o,e.lat+s))}adjustAntiMeridian(){let e=new p.N(this._sw.lng,this._sw.lat),n=new p.N(this._ne.lng,this._ne.lat);return new oe(e,e.lng>n.lng?new p.N(n.lng+360,n.lat):n)}}class Xi{constructor(e,n,s){this.bounds=oe.convert(this.validateBounds(e)),this.minzoom=n||0,this.maxzoom=s||24}validateBounds(e){return Array.isArray(e)&&e.length===4?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}contains(e){let n=Math.pow(2,e.z),s=Math.floor(p.O(this.bounds.getWest())*n),o=Math.floor(p.Q(this.bounds.getNorth())*n),u=Math.ceil(p.O(this.bounds.getEast())*n),m=Math.ceil(p.Q(this.bounds.getSouth())*n);return e.x>=s&&e.x<u&&e.y>=o&&e.y<m}}class kr extends p.E{constructor(e,n,s,o){if(super(),this.id=e,this.dispatcher=s,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,p.e(this,p.M(n,["url","scheme","tileSize","promoteId"])),this._options=p.e({type:"vector"},n),this._collectResourceTiming=n.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(o)}load(){return p._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new p.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{let e=yield Kt(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),e&&(p.e(this,e),e.bounds&&(this.tileBounds=new Xi(e.bounds,this.minzoom,this.maxzoom)),this.fire(new p.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new p.k("data",{dataType:"source",sourceDataType:"content"})))}catch(e){this._tileJSONRequest=null,this.fire(new p.j(e))}})}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}setSourceProperty(e){this._tileJSONRequest&&this._tileJSONRequest.abort(),e(),this.load()}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return p.e({},this._options)}loadTile(e){return p._(this,void 0,void 0,function*(){let n=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),s={request:this.map._requestManager.transformRequest(n,"Tile"),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};s.request.collectResourceTiming=this._collectResourceTiming;let o="RT";if(e.actor&&e.state!=="expired"){if(e.state==="loading")return new Promise((u,m)=>{e.reloadPromise={resolve:u,reject:m}})}else e.actor=this.dispatcher.getActor(),o="LT";e.abortController=new AbortController;try{let u=yield e.actor.sendAsync({type:o,data:s},e.abortController);if(delete e.abortController,e.aborted)return;this._afterTileLoadWorkerResponse(e,u)}catch(u){if(delete e.abortController,e.aborted)return;if(u&&u.status!==404)throw u;this._afterTileLoadWorkerResponse(e,null)}})}_afterTileLoadWorkerResponse(e,n){if(n&&n.resourceTiming&&(e.resourceTiming=n.resourceTiming),n&&this.map._refreshExpiredTiles&&e.setExpiryData(n),e.loadVectorData(n,this.map.painter),e.reloadPromise){let s=e.reloadPromise;e.reloadPromise=null,this.loadTile(e).then(s.resolve).catch(s.reject)}}abortTile(e){return p._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.actor&&(yield e.actor.sendAsync({type:"AT",data:{uid:e.uid,type:this.type,source:this.id}}))})}unloadTile(e){return p._(this,void 0,void 0,function*(){e.unloadVectorData(),e.actor&&(yield e.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class wt extends p.E{constructor(e,n,s,o){super(),this.id=e,this.dispatcher=s,this.setEventedParent(o),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=p.e({type:"raster"},n),p.e(this,p.M(n,["url","scheme","tileSize"]))}load(){return p._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new p.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{let e=yield Kt(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,e&&(p.e(this,e),e.bounds&&(this.tileBounds=new Xi(e.bounds,this.minzoom,this.maxzoom)),this.fire(new p.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new p.k("data",{dataType:"source",sourceDataType:"content"})))}catch(e){this._tileJSONRequest=null,this.fire(new p.j(e))}})}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(e){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),e(),this.load()}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}serialize(){return p.e({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(e){return p._(this,void 0,void 0,function*(){let n=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.abortController=new AbortController;try{let s=yield De.getImage(this.map._requestManager.transformRequest(n,"Tile"),e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(s&&s.data){this.map._refreshExpiredTiles&&s.cacheControl&&s.expires&&e.setExpiryData({cacheControl:s.cacheControl,expires:s.expires});let o=this.map.painter.context,u=o.gl,m=s.data;e.texture=this.map.painter.getTileTexture(m.width),e.texture?e.texture.update(m,{useMipmap:!0}):(e.texture=new ye(o,m,u.RGBA,{useMipmap:!0}),e.texture.bind(u.LINEAR,u.CLAMP_TO_EDGE,u.LINEAR_MIPMAP_NEAREST)),e.state="loaded"}}catch(s){if(delete e.abortController,e.aborted)e.state="unloaded";else if(s)throw e.state="errored",s}})}abortTile(e){return p._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController)})}unloadTile(e){return p._(this,void 0,void 0,function*(){e.texture&&this.map.painter.saveTileTexture(e.texture)})}hasTransition(){return!1}}class Zt extends wt{constructor(e,n,s,o){super(e,n,s,o),this.type="raster-dem",this.maxzoom=22,this._options=p.e({type:"raster-dem"},n),this.encoding=n.encoding||"mapbox",this.redFactor=n.redFactor,this.greenFactor=n.greenFactor,this.blueFactor=n.blueFactor,this.baseShift=n.baseShift}loadTile(e){return p._(this,void 0,void 0,function*(){let n=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),s=this.map._requestManager.transformRequest(n,"Tile");e.neighboringTiles=this._getNeighboringTiles(e.tileID),e.abortController=new AbortController;try{let o=yield De.getImage(s,e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(o&&o.data){let u=o.data;this.map._refreshExpiredTiles&&o.cacheControl&&o.expires&&e.setExpiryData({cacheControl:o.cacheControl,expires:o.expires});let m=p.b(u)&&p.U()?u:yield this.readImageNow(u),_={type:this.type,uid:e.uid,source:this.id,rawImageData:m,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!e.actor||e.state==="expired"){e.actor=this.dispatcher.getActor();let y=yield e.actor.sendAsync({type:"LDT",data:_});e.dem=y,e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state="loaded"}}}catch(o){if(delete e.abortController,e.aborted)e.state="unloaded";else if(o)throw e.state="errored",o}})}readImageNow(e){return p._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&p.V()){let n=e.width+2,s=e.height+2;try{return new p.R({width:n,height:s},yield p.W(e,-1,-1,n,s))}catch{}}return se.getImageData(e,1)})}_getNeighboringTiles(e){let n=e.canonical,s=Math.pow(2,n.z),o=(n.x-1+s)%s,u=n.x===0?e.wrap-1:e.wrap,m=(n.x+1+s)%s,_=n.x+1===s?e.wrap+1:e.wrap,y={};return y[new p.S(e.overscaledZ,u,n.z,o,n.y).key]={backfilled:!1},y[new p.S(e.overscaledZ,_,n.z,m,n.y).key]={backfilled:!1},n.y>0&&(y[new p.S(e.overscaledZ,u,n.z,o,n.y-1).key]={backfilled:!1},y[new p.S(e.overscaledZ,e.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},y[new p.S(e.overscaledZ,_,n.z,m,n.y-1).key]={backfilled:!1}),n.y+1<s&&(y[new p.S(e.overscaledZ,u,n.z,o,n.y+1).key]={backfilled:!1},y[new p.S(e.overscaledZ,e.wrap,n.z,n.x,n.y+1).key]={backfilled:!1},y[new p.S(e.overscaledZ,_,n.z,m,n.y+1).key]={backfilled:!1}),y}unloadTile(e){return p._(this,void 0,void 0,function*(){e.demTexture&&this.map.painter.saveTileTexture(e.demTexture),e.fbo&&(e.fbo.destroy(),delete e.fbo),e.dem&&delete e.dem,delete e.neighboringTiles,e.state="unloaded",e.actor&&(yield e.actor.sendAsync({type:"RDT",data:{type:this.type,uid:e.uid,source:this.id}}))})}}class _r extends p.E{constructor(e,n,s,o){super(),this.id=e,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=s.getActor(),this.setEventedParent(o),this._data=n.data,this._options=p.e({},n),this._collectResourceTiming=n.collectResourceTiming,n.maxzoom!==void 0&&(this.maxzoom=n.maxzoom),n.type&&(this.type=n.type),n.attribution&&(this.attribution=n.attribution),this.promoteId=n.promoteId;let u=p.X/this.tileSize;n.clusterMaxZoom!==void 0&&this.maxzoom<=n.clusterMaxZoom&&p.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${n.clusterMaxZoom}".`),this.workerOptions=p.e({source:this.id,cluster:n.cluster||!1,geojsonVtOptions:{buffer:(n.buffer!==void 0?n.buffer:128)*u,tolerance:(n.tolerance!==void 0?n.tolerance:.375)*u,extent:p.X,maxZoom:this.maxzoom,lineMetrics:n.lineMetrics||!1,generateId:n.generateId||!1},superclusterOptions:{maxZoom:n.clusterMaxZoom!==void 0?n.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,n.clusterMinPoints||2),extent:p.X,radius:(n.clusterRadius||50)*u,log:!1,generateId:n.generateId||!1},clusterProperties:n.clusterProperties,filter:n.filter},n.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}load(){return p._(this,void 0,void 0,function*(){yield this._updateWorkerData()})}onAdd(e){this.map=e,this.load()}setData(e){return this._data=e,this._updateWorkerData(),this}updateData(e){return this._updateWorkerData(e),this}getData(){return p._(this,void 0,void 0,function*(){let e=p.e({type:this.type},this.workerOptions);return this.actor.sendAsync({type:"GD",data:e})})}setClusterOptions(e){return this.workerOptions.cluster=e.cluster,e&&(e.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=e.clusterRadius),e.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=e.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(e){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:e,source:this.id}})}getClusterChildren(e){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:e,source:this.id}})}getClusterLeaves(e,n,s){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:e,limit:n,offset:s}})}_updateWorkerData(e){return p._(this,void 0,void 0,function*(){let n=p.e({type:this.type},this.workerOptions);e?n.dataDiff=e:typeof this._data=="string"?(n.request=this.map._requestManager.transformRequest(se.resolveURL(this._data),"Source"),n.request.collectResourceTiming=this._collectResourceTiming):n.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new p.k("dataloading",{dataType:"source"}));try{let s=yield this.actor.sendAsync({type:"LD",data:n});if(this._pendingLoads--,this._removed||s.abandoned)return void this.fire(new p.k("dataabort",{dataType:"source"}));let o=null;s.resourceTiming&&s.resourceTiming[this.id]&&(o=s.resourceTiming[this.id].slice(0));let u={dataType:"source"};this._collectResourceTiming&&o&&o.length>0&&p.e(u,{resourceTiming:o}),this.fire(new p.k("data",Object.assign(Object.assign({},u),{sourceDataType:"metadata"}))),this.fire(new p.k("data",Object.assign(Object.assign({},u),{sourceDataType:"content"})))}catch(s){if(this._pendingLoads--,this._removed)return void this.fire(new p.k("dataabort",{dataType:"source"}));this.fire(new p.j(s))}})}loaded(){return this._pendingLoads===0}loadTile(e){return p._(this,void 0,void 0,function*(){let n=e.actor?"RT":"LT";e.actor=this.actor;let s={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};e.abortController=new AbortController;let o=yield this.actor.sendAsync({type:n,data:s},e.abortController);delete e.abortController,e.unloadVectorData(),e.aborted||e.loadVectorData(o,this.map.painter,n==="RT")})}abortTile(e){return p._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.aborted=!0})}unloadTile(e){return p._(this,void 0,void 0,function*(){e.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}})})}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return p.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var Mr=p.Y([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Wi extends p.E{constructor(e,n,s,o){super(),this.id=e,this.dispatcher=s,this.coordinates=n.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(o),this.options=n}load(e){return p._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new p.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{let n=yield De.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,n&&n.data&&(this.image=n.data,e&&(this.coordinates=e),this._finishLoading())}catch(n){this._request=null,this._loaded=!0,this.fire(new p.j(n))}})}loaded(){return this._loaded}updateImage(e){return e.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=e.url,this.load(e.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new p.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(e){this.coordinates=e;let n=e.map(p.Z.fromLngLat);this.tileID=function(o){let u=1/0,m=1/0,_=-1/0,y=-1/0;for(let P of o)u=Math.min(u,P.x),m=Math.min(m,P.y),_=Math.max(_,P.x),y=Math.max(y,P.y);let b=Math.max(_-u,y-m),T=Math.max(0,Math.floor(-Math.log(b)/Math.LN2)),C=Math.pow(2,T);return new p.a1(T,Math.floor((u+_)/2*C),Math.floor((m+y)/2*C))}(n),this.minzoom=this.maxzoom=this.tileID.z;let s=n.map(o=>this.tileID.getTilePoint(o)._round());return this._boundsArray=new p.$,this._boundsArray.emplaceBack(s[0].x,s[0].y,0,0),this._boundsArray.emplaceBack(s[1].x,s[1].y,p.X,0),this._boundsArray.emplaceBack(s[3].x,s[3].y,0,p.X),this._boundsArray.emplaceBack(s[2].x,s[2].y,p.X,p.X),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new p.k("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;let e=this.map.painter.context,n=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,Mr.members)),this.boundsSegments||(this.boundsSegments=p.a0.simpleSegment(0,0,4,2)),this.texture||(this.texture=new ye(e,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let s=!1;for(let o in this.tiles){let u=this.tiles[o];u.state!=="loaded"&&(u.state="loaded",u.texture=this.texture,s=!0)}s&&this.fire(new p.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(e){return p._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={}):e.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class Qr extends Wi{constructor(e,n,s,o){super(e,n,s,o),this.roundZoom=!0,this.type="video",this.options=n}load(){return p._(this,void 0,void 0,function*(){this._loaded=!1;let e=this.options;this.urls=[];for(let n of e.urls)this.urls.push(this.map._requestManager.transformRequest(n,"Source").url);try{let n=yield p.a3(this.urls);if(this._loaded=!0,!n)return;this.video=n,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(n){this.fire(new p.j(n))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){let n=this.video.seekable;e<n.start(0)||e>n.end(0)?this.fire(new p.j(new p.a2(`sources.${this.id}`,null,`Playback for this video can be set only between the ${n.start(0)} and ${n.end(0)}-second mark.`))):this.video.currentTime=e}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;let e=this.map.painter.context,n=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,Mr.members)),this.boundsSegments||(this.boundsSegments=p.a0.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),n.texSubImage2D(n.TEXTURE_2D,0,0,0,n.RGBA,n.UNSIGNED_BYTE,this.video)):(this.texture=new ye(e,this.video,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let s=!1;for(let o in this.tiles){let u=this.tiles[o];u.state!=="loaded"&&(u.state="loaded",u.texture=this.texture,s=!0)}s&&this.fire(new p.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class Ui extends Wi{constructor(e,n,s,o){super(e,n,s,o),n.coordinates?Array.isArray(n.coordinates)&&n.coordinates.length===4&&!n.coordinates.some(u=>!Array.isArray(u)||u.length!==2||u.some(m=>typeof m!="number"))||this.fire(new p.j(new p.a2(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new p.j(new p.a2(`sources.${e}`,null,'missing required property "coordinates"'))),n.animate&&typeof n.animate!="boolean"&&this.fire(new p.j(new p.a2(`sources.${e}`,null,'optional "animate" property must be a boolean value'))),n.canvas?typeof n.canvas=="string"||n.canvas instanceof HTMLCanvasElement||this.fire(new p.j(new p.a2(`sources.${e}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new p.j(new p.a2(`sources.${e}`,null,'missing required property "canvas"'))),this.options=n,this.animate=n.animate===void 0||n.animate}load(){return p._(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 p.j(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())})}getCanvas(){return this.canvas}onAdd(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;let n=this.map.painter.context,s=n.gl;this.boundsBuffer||(this.boundsBuffer=n.createVertexBuffer(this._boundsArray,Mr.members)),this.boundsSegments||(this.boundsSegments=p.a0.simpleSegment(0,0,4,2)),this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new ye(n,this.canvas,s.RGBA,{premultiply:!0});let o=!1;for(let u in this.tiles){let m=this.tiles[u];m.state!=="loaded"&&(m.state="loaded",m.texture=this.texture,o=!0)}o&&this.fire(new p.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(let e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}}let sn={},yn=c=>{switch(c){case"geojson":return _r;case"image":return Wi;case"raster":return wt;case"raster-dem":return Zt;case"vector":return kr;case"video":return Qr;case"canvas":return Ui}return sn[c]},be="RTLPluginLoaded";class or extends p.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=Vt()}_syncState(e){return this.status=e,this.dispatcher.broadcast("SRPS",{pluginStatus:e,pluginURL:this.url}).catch(n=>{throw this.status="error",n})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(e){return p._(this,arguments,void 0,function*(n,s=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=se.resolveURL(n),!this.url)throw new Error(`requested url ${n} is invalid`);if(this.status==="unavailable"){if(!s)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return p._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new p.k(be))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let Ai=null;function lr(){return Ai||(Ai=new or),Ai}class Pr{constructor(e,n){this.timeAdded=0,this.fadeEndTime=0,this.tileID=e,this.uid=p.a4(),this.uses=0,this.tileSize=n,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(e){let n=e+this.timeAdded;n<this.fadeEndTime||(this.fadeEndTime=n)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(e){this.demTexture&&e.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(e,n,s){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",e){e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestFeatureIndex.rawTileData=e.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=function(o,u){let m={};if(!u)return m;for(let _ of o){let y=_.layerIds.map(b=>u.getLayer(b)).filter(Boolean);if(y.length!==0){_.layers=y,_.stateDependentLayerIds&&(_.stateDependentLayers=_.stateDependentLayerIds.map(b=>y.filter(T=>T.id===b)[0]));for(let b of y)m[b.id]=_}}return m}(e.buckets,n.style),this.hasSymbolBuckets=!1;for(let o in this.buckets){let u=this.buckets[o];if(u instanceof p.a6){if(this.hasSymbolBuckets=!0,!s)break;u.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let o in this.buckets){let u=this.buckets[o];if(u instanceof p.a6&&u.hasRTLText){this.hasRTLText=!0,lr().lazyLoad();break}}this.queryPadding=0;for(let o in this.buckets){let u=this.buckets[o];this.queryPadding=Math.max(this.queryPadding,n.style.getLayer(o).queryRadius(u))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage)}else this.collisionBoxArray=new p.a5}unloadVectorData(){for(let e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(e){return this.buckets[e.id]}upload(e){for(let s in this.buckets){let o=this.buckets[s];o.uploadPending()&&o.upload(e)}let n=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new ye(e,this.imageAtlas.image,n.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new ye(e,this.glyphAtlasImage,n.ALPHA),this.glyphAtlasImage=null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,n,s,o,u,m,_,y,b,T){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:o,cameraQueryGeometry:u,scale:m,tileSize:this.tileSize,pixelPosMatrix:T,transform:y,params:_,queryPadding:this.queryPadding*b},e,n,s):{}}querySourceFeatures(e,n){let s=this.latestFeatureIndex;if(!s||!s.rawTileData)return;let o=s.loadVTLayers(),u=n&&n.sourceLayer?n.sourceLayer:"",m=o._geojsonTileLayer||o[u];if(!m)return;let _=p.a7(n&&n.filter),{z:y,x:b,y:T}=this.tileID.canonical,C={z:y,x:b,y:T};for(let P=0;P<m.length;P++){let L=m.feature(P);if(_.needGeometry){let Z=p.a8(L,!0);if(!_.filter(new p.z(this.tileID.overscaledZ),Z,this.tileID.canonical))continue}else if(!_.filter(new p.z(this.tileID.overscaledZ),L))continue;let O=s.getId(L,u),U=new p.a9(L,y,b,T,O);U.tile=C,e.push(U)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(e){let n=this.expirationTime;if(e.cacheControl){let s=p.aa(e.cacheControl);s["max-age"]&&(this.expirationTime=Date.now()+1e3*s["max-age"])}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){let s=Date.now(),o=!1;if(this.expirationTime>s)o=!1;else if(n)if(this.expirationTime<n)o=!0;else{let u=this.expirationTime-n;u?this.expirationTime=s+Math.max(u,3e4):o=!0}else o=!0;o?(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(e,n){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(e).length===0)return;let s=this.latestFeatureIndex.loadVTLayers();for(let o in this.buckets){if(!n.style.hasLayer(o))continue;let u=this.buckets[o],m=u.layers[0].sourceLayer||"_geojsonTileLayer",_=s[m],y=e[m];if(!_||!y||Object.keys(y).length===0)continue;u.update(y,_,this.imageAtlas&&this.imageAtlas.patternPositions||{});let b=n&&n.style&&n.style.getLayer(o);b&&(this.queryPadding=Math.max(this.queryPadding,b.queryRadius(u)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<se.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(e){this.symbolFadeHoldUntil=se.now()+e}setDependencies(e,n){let s={};for(let o of n)s[o]=!0;this.dependencies[e]=s}hasDependency(e,n){for(let s of e){let o=this.dependencies[s];if(o){for(let u of n)if(o[u])return!0}}return!1}}class we{constructor(e,n){this.max=e,this.onRemove=n,this.reset()}reset(){for(let e in this.data)for(let n of this.data[e])n.timeout&&clearTimeout(n.timeout),this.onRemove(n.value);return this.data={},this.order=[],this}add(e,n,s){let o=e.wrapped().key;this.data[o]===void 0&&(this.data[o]=[]);let u={value:n,timeout:void 0};if(s!==void 0&&(u.timeout=setTimeout(()=>{this.remove(e,u)},s)),this.data[o].push(u),this.order.push(o),this.order.length>this.max){let m=this._getAndRemoveByKey(this.order[0]);m&&this.onRemove(m)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){let n=this.data[e].shift();return n.timeout&&clearTimeout(n.timeout),this.data[e].length===0&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),n.value}getByKey(e){let n=this.data[e];return n?n[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,n){if(!this.has(e))return this;let s=e.wrapped().key,o=n===void 0?0:this.data[s].indexOf(n),u=this.data[s][o];return this.data[s].splice(o,1),u.timeout&&clearTimeout(u.timeout),this.data[s].length===0&&delete this.data[s],this.onRemove(u.value),this.order.splice(this.order.indexOf(s),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){let n=this._getAndRemoveByKey(this.order[0]);n&&this.onRemove(n)}return this}filter(e){let n=[];for(let s in this.data)for(let o of this.data[s])e(o.value)||n.push(o);for(let s of n)this.remove(s.value.tileID,s)}}class ft{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,n,s){let o=String(n);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][o]=this.stateChanges[e][o]||{},p.e(this.stateChanges[e][o],s),this.deletedStates[e]===null){this.deletedStates[e]={};for(let u in this.state[e])u!==o&&(this.deletedStates[e][u]=null)}else if(this.deletedStates[e]&&this.deletedStates[e][o]===null){this.deletedStates[e][o]={};for(let u in this.state[e][o])s[u]||(this.deletedStates[e][o][u]=null)}else for(let u in s)this.deletedStates[e]&&this.deletedStates[e][o]&&this.deletedStates[e][o][u]===null&&delete this.deletedStates[e][o][u]}removeFeatureState(e,n,s){if(this.deletedStates[e]===null)return;let o=String(n);if(this.deletedStates[e]=this.deletedStates[e]||{},s&&n!==void 0)this.deletedStates[e][o]!==null&&(this.deletedStates[e][o]=this.deletedStates[e][o]||{},this.deletedStates[e][o][s]=null);else if(n!==void 0)if(this.stateChanges[e]&&this.stateChanges[e][o])for(s in this.deletedStates[e][o]={},this.stateChanges[e][o])this.deletedStates[e][o][s]=null;else this.deletedStates[e][o]=null;else this.deletedStates[e]=null}getState(e,n){let s=String(n),o=p.e({},(this.state[e]||{})[s],(this.stateChanges[e]||{})[s]);if(this.deletedStates[e]===null)return{};if(this.deletedStates[e]){let u=this.deletedStates[e][n];if(u===null)return{};for(let m in u)delete o[m]}return o}initializeTileState(e,n){e.setFeatureState(this.state,n)}coalesceChanges(e,n){let s={};for(let o in this.stateChanges){this.state[o]=this.state[o]||{};let u={};for(let m in this.stateChanges[o])this.state[o][m]||(this.state[o][m]={}),p.e(this.state[o][m],this.stateChanges[o][m]),u[m]=this.state[o][m];s[o]=u}for(let o in this.deletedStates){this.state[o]=this.state[o]||{};let u={};if(this.deletedStates[o]===null)for(let m in this.state[o])u[m]={},this.state[o][m]={};else for(let m in this.deletedStates[o]){if(this.deletedStates[o][m]===null)this.state[o][m]={};else for(let _ of Object.keys(this.deletedStates[o][m]))delete this.state[o][m][_];u[m]=this.state[o][m]}s[o]=s[o]||{},p.e(s[o],u)}if(this.stateChanges={},this.deletedStates={},Object.keys(s).length!==0)for(let o in e)e[o].setFeatureState(s,n)}}class nt extends p.E{constructor(e,n,s){super(),this.id=e,this.dispatcher=s,this.on("data",o=>this._dataHandler(o)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((o,u,m,_)=>{let y=new(yn(u.type))(o,u,m,_);if(y.id!==o)throw new Error(`Expected Source id to be ${o} instead of ${y.id}`);return y})(e,n,s,this),this._tiles={},this._cache=new we(0,o=>this._unloadTile(o)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new ft,this._didEmitContent=!1,this._updated=!1}onAdd(e){this.map=e,this._maxTileCacheSize=e?e._maxTileCacheSize:null,this._maxTileCacheZoomLevels=e?e._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(e)}onRemove(e){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(e)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(this.used===void 0&&this.usedForTerrain===void 0||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(let e in this._tiles){let n=this._tiles[e];if(n.state!=="loaded"&&n.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;let e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(e,n,s){return p._(this,void 0,void 0,function*(){try{yield this._source.loadTile(e),this._tileLoaded(e,n,s)}catch(o){e.state="errored",o.status!==404?this._source.fire(new p.j(o,{tile:e})):this.update(this.transform,this.terrain)}})}_unloadTile(e){this._source.unloadTile&&this._source.unloadTile(e)}_abortTile(e){this._source.abortTile&&this._source.abortTile(e),this._source.fire(new p.k("dataabort",{tile:e,coord:e.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(let n in this._tiles){let s=this._tiles[n];s.upload(e),s.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(e=>e.tileID).sort(Si).map(e=>e.key)}getRenderableIds(e){let n=[];for(let s in this._tiles)this._isIdRenderable(s,e)&&n.push(this._tiles[s]);return e?n.sort((s,o)=>{let u=s.tileID,m=o.tileID,_=new p.P(u.canonical.x,u.canonical.y)._rotate(this.transform.angle),y=new p.P(m.canonical.x,m.canonical.y)._rotate(this.transform.angle);return u.overscaledZ-m.overscaledZ||y.y-_.y||y.x-_.x}).map(s=>s.tileID.key):n.map(s=>s.tileID).sort(Si).map(s=>s.key)}hasRenderableParent(e){let n=this.findLoadedParent(e,0);return!!n&&this._isIdRenderable(n.tileID.key)}_isIdRenderable(e,n){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(n||!this._tiles[e].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(let e in this._tiles)this._tiles[e].state!=="errored"&&this._reloadTile(e,"reloading")}}_reloadTile(e,n){return p._(this,void 0,void 0,function*(){let s=this._tiles[e];s&&(s.state!=="loading"&&(s.state=n),yield this._loadTile(s,e,n))})}_tileLoaded(e,n,s){e.timeAdded=se.now(),s==="expired"&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(n,e),this.getSource().type==="raster-dem"&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new p.k("data",{dataType:"source",tile:e,coord:e.tileID}))}_backfillDEM(e){let n=this.getRenderableIds();for(let o=0;o<n.length;o++){let u=n[o];if(e.neighboringTiles&&e.neighboringTiles[u]){let m=this.getTileByID(u);s(e,m),s(m,e)}}function s(o,u){o.needsHillshadePrepare=!0,o.needsTerrainPrepare=!0;let m=u.tileID.canonical.x-o.tileID.canonical.x,_=u.tileID.canonical.y-o.tileID.canonical.y,y=Math.pow(2,o.tileID.canonical.z),b=u.tileID.key;m===0&&_===0||Math.abs(_)>1||(Math.abs(m)>1&&(Math.abs(m+y)===1?m+=y:Math.abs(m-y)===1&&(m-=y)),u.dem&&o.dem&&(o.dem.backfillBorder(u.dem,m,_),o.neighboringTiles&&o.neighboringTiles[b]&&(o.neighboringTiles[b].backfilled=!0)))}}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,n,s,o){for(let u in this._tiles){let m=this._tiles[u];if(o[u]||!m.hasData()||m.tileID.overscaledZ<=n||m.tileID.overscaledZ>s)continue;let _=m.tileID;for(;m&&m.tileID.overscaledZ>n+1;){let b=m.tileID.scaledTo(m.tileID.overscaledZ-1);m=this._tiles[b.key],m&&m.hasData()&&(_=b)}let y=_;for(;y.overscaledZ>n;)if(y=y.scaledTo(y.overscaledZ-1),e[y.key]){o[_.key]=_;break}}}findLoadedParent(e,n){if(e.key in this._loadedParentTiles){let s=this._loadedParentTiles[e.key];return s&&s.tileID.overscaledZ>=n?s:null}for(let s=e.overscaledZ-1;s>=n;s--){let o=e.scaledTo(s),u=this._getLoadedTile(o);if(u)return u}}findLoadedSibling(e){return this._getLoadedTile(e)}_getLoadedTile(e){let n=this._tiles[e.key];return n&&n.hasData()?n:this._cache.getByKey(e.wrapped().key)}updateCacheSize(e){let n=Math.ceil(e.width/this._source.tileSize)+1,s=Math.ceil(e.height/this._source.tileSize)+1,o=Math.floor(n*s*(this._maxTileCacheZoomLevels===null?p.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),u=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,o):o;this._cache.setMaxSize(u)}handleWrapJump(e){let n=Math.round((e-(this._prevLng===void 0?e:this._prevLng))/360);if(this._prevLng=e,n){let s={};for(let o in this._tiles){let u=this._tiles[o];u.tileID=u.tileID.unwrapTo(u.tileID.wrap+n),s[u.tileID.key]=u}this._tiles=s;for(let o in this._timers)clearTimeout(this._timers[o]),delete this._timers[o];for(let o in this._tiles)this._setTileReloadTimer(o,this._tiles[o])}}_updateCoveredAndRetainedTiles(e,n,s,o,u,m){let _={},y={},b=Object.keys(e),T=se.now();for(let C of b){let P=e[C],L=this._tiles[C];if(!L||L.fadeEndTime!==0&&L.fadeEndTime<=T)continue;let O=this.findLoadedParent(P,n),U=this.findLoadedSibling(P),Z=O||U||null;Z&&(this._addTile(Z.tileID),_[Z.tileID.key]=Z.tileID),y[C]=P}this._retainLoadedChildren(y,o,s,e);for(let C in _)e[C]||(this._coveredTiles[C]=!0,e[C]=_[C]);if(m){let C={},P={};for(let L of u)this._tiles[L.key].hasData()?C[L.key]=L:P[L.key]=L;for(let L in P){let O=P[L].children(this._source.maxzoom);this._tiles[O[0].key]&&this._tiles[O[1].key]&&this._tiles[O[2].key]&&this._tiles[O[3].key]&&(C[O[0].key]=e[O[0].key]=O[0],C[O[1].key]=e[O[1].key]=O[1],C[O[2].key]=e[O[2].key]=O[2],C[O[3].key]=e[O[3].key]=O[3],delete P[L])}for(let L in P){let O=P[L],U=this.findLoadedParent(O,this._source.minzoom),Z=this.findLoadedSibling(O),G=U||Z||null;if(G){C[G.tileID.key]=e[G.tileID.key]=G.tileID;for(let W in C)C[W].isChildOf(G.tileID)&&delete C[W]}}for(let L in this._tiles)C[L]||(this._coveredTiles[L]=!0)}}update(e,n){if(!this._sourceLoaded||this._paused)return;let s;this.transform=e,this.terrain=n,this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?s=e.getVisibleUnwrappedCoordinates(this._source.tileID).map(T=>new p.S(T.canonical.z,T.wrap,T.canonical.z,T.canonical.x,T.canonical.y)):(s=e.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:n}),this._source.hasTile&&(s=s.filter(T=>this._source.hasTile(T)))):s=[];let o=e.coveringZoomLevel(this._source),u=Math.max(o-nt.maxOverzooming,this._source.minzoom),m=Math.max(o+nt.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){let T={};for(let C of s)if(C.canonical.z>this._source.minzoom){let P=C.scaledTo(C.canonical.z-1);T[P.key]=P;let L=C.scaledTo(Math.max(this._source.minzoom,Math.min(C.canonical.z,5)));T[L.key]=L}s=s.concat(Object.values(T))}let _=s.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,_&&this.fire(new p.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));let y=this._updateRetainedTiles(s,o);Ji(this._source.type)&&this._updateCoveredAndRetainedTiles(y,u,m,o,s,n);for(let T in y)this._tiles[T].clearFadeHold();let b=p.ab(this._tiles,y);for(let T of b){let C=this._tiles[T];C.hasSymbolBuckets&&!C.holdingForFade()?C.setHoldDuration(this.map._fadeDuration):C.hasSymbolBuckets&&!C.symbolFadeFinished()||this._removeTile(T)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(let e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(e)}_updateRetainedTiles(e,n){var s;let o={},u={},m=Math.max(n-nt.maxOverzooming,this._source.minzoom),_=Math.max(n+nt.maxUnderzooming,this._source.minzoom),y={};for(let b of e){let T=this._addTile(b);o[b.key]=b,T.hasData()||n<this._source.maxzoom&&(y[b.key]=b)}this._retainLoadedChildren(y,n,_,o);for(let b of e){let T=this._tiles[b.key];if(T.hasData())continue;if(n+1>this._source.maxzoom){let P=b.children(this._source.maxzoom)[0],L=this.getTile(P);if(L&&L.hasData()){o[P.key]=P;continue}}else{let P=b.children(this._source.maxzoom);if(o[P[0].key]&&o[P[1].key]&&o[P[2].key]&&o[P[3].key])continue}let C=T.wasRequested();for(let P=b.overscaledZ-1;P>=m;--P){let L=b.scaledTo(P);if(u[L.key])break;if(u[L.key]=!0,T=this.getTile(L),!T&&C&&(T=this._addTile(L)),T){let O=T.hasData();if((O||!(!((s=this.map)===null||s===void 0)&&s.cancelPendingTileRequestsWhileZooming)||C)&&(o[L.key]=L),C=T.wasRequested(),O)break}}}return o}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(let e in this._tiles){let n=[],s,o=this._tiles[e].tileID;for(;o.overscaledZ>0;){if(o.key in this._loadedParentTiles){s=this._loadedParentTiles[o.key];break}n.push(o.key);let u=o.scaledTo(o.overscaledZ-1);if(s=this._getLoadedTile(u),s)break;o=u}for(let u of n)this._loadedParentTiles[u]=s}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(let e in this._tiles){let n=this._tiles[e].tileID,s=this._getLoadedTile(n);this._loadedSiblingTiles[n.key]=s}}_addTile(e){let n=this._tiles[e.key];if(n)return n;n=this._cache.getAndRemove(e),n&&(this._setTileReloadTimer(e.key,n),n.tileID=e,this._state.initializeTileState(n,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,n)));let s=n;return n||(n=new Pr(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(n,e.key,n.state)),n.uses++,this._tiles[e.key]=n,s||this._source.fire(new p.k("dataloading",{tile:n,coord:n.tileID,dataType:"source"})),n}_setTileReloadTimer(e,n){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);let s=n.getExpiryTimeout();s&&(this._timers[e]=setTimeout(()=>{this._reloadTile(e,"expired"),delete this._timers[e]},s))}_removeTile(e){let n=this._tiles[e];n&&(n.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),n.uses>0||(n.hasData()&&n.state!=="reloading"?this._cache.add(n.tileID,n,n.getExpiryTimeout()):(n.aborted=!0,this._abortTile(n),this._unloadTile(n))))}_dataHandler(e){let n=e.sourceDataType;e.dataType==="source"&&n==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&e.dataType==="source"&&n==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(let e in this._tiles)this._removeTile(e);this._cache.reset()}tilesIn(e,n,s){let o=[],u=this.transform;if(!u)return o;let m=s?u.getCameraQueryGeometry(e):e,_=e.map(O=>u.pointCoordinate(O,this.terrain)),y=m.map(O=>u.pointCoordinate(O,this.terrain)),b=this.getIds(),T=1/0,C=1/0,P=-1/0,L=-1/0;for(let O of y)T=Math.min(T,O.x),C=Math.min(C,O.y),P=Math.max(P,O.x),L=Math.max(L,O.y);for(let O=0;O<b.length;O++){let U=this._tiles[b[O]];if(U.holdingForFade())continue;let Z=U.tileID,G=Math.pow(2,u.zoom-U.tileID.overscaledZ),W=n*U.queryPadding*p.X/U.tileSize/G,N=[Z.getTilePoint(new p.Z(T,C)),Z.getTilePoint(new p.Z(P,L))];if(N[0].x-W<p.X&&N[0].y-W<p.X&&N[1].x+W>=0&&N[1].y+W>=0){let Q=_.map(ae=>Z.getTilePoint(ae)),te=y.map(ae=>Z.getTilePoint(ae));o.push({tile:U,tileID:Z,queryGeometry:Q,cameraQueryGeometry:te,scale:G})}}return o}getVisibleCoordinates(e){let n=this.getRenderableIds(e).map(s=>this._tiles[s].tileID);for(let s of n)s.posMatrix=this.transform.calculatePosMatrix(s.toUnwrapped());return n}hasTransition(){if(this._source.hasTransition())return!0;if(Ji(this._source.type)){let e=se.now();for(let n in this._tiles)if(this._tiles[n].fadeEndTime>=e)return!0}return!1}setFeatureState(e,n,s){this._state.updateState(e=e||"_geojsonTileLayer",n,s)}removeFeatureState(e,n,s){this._state.removeFeatureState(e=e||"_geojsonTileLayer",n,s)}getFeatureState(e,n){return this._state.getState(e=e||"_geojsonTileLayer",n)}setDependencies(e,n,s){let o=this._tiles[e];o&&o.setDependencies(n,s)}reloadTilesForDependencies(e,n){for(let s in this._tiles)this._tiles[s].hasDependency(e,n)&&this._reloadTile(s,"reloading");this._cache.filter(s=>!s.hasDependency(e,n))}}function Si(c,e){let n=Math.abs(2*c.wrap)-+(c.wrap<0),s=Math.abs(2*e.wrap)-+(e.wrap<0);return c.overscaledZ-e.overscaledZ||s-n||e.canonical.y-c.canonical.y||e.canonical.x-c.canonical.x}function Ji(c){return c==="raster"||c==="image"||c==="video"}nt.maxOverzooming=10,nt.maxUnderzooming=3;class st{constructor(e,n){this.reset(e,n)}reset(e,n){this.points=e||[],this._distances=[0];for(let s=1;s<this.points.length;s++)this._distances[s]=this._distances[s-1]+this.points[s].dist(this.points[s-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(n||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(e){if(this.points.length===1)return this.points[0];e=p.ac(e,0,1);let n=1,s=this._distances[n],o=e*this.paddedLength+this.padding;for(;s<o&&n<this._distances.length;)s=this._distances[++n];let u=n-1,m=this._distances[u],_=s-m,y=_>0?(o-m)/_:0;return this.points[u].mult(1-y).add(this.points[n].mult(y))}}function Ki(c,e){let n=!0;return c==="always"||c!=="never"&&e!=="never"||(n=!1),n}class yr{constructor(e,n,s){let o=this.boxCells=[],u=this.circleCells=[];this.xCellCount=Math.ceil(e/s),this.yCellCount=Math.ceil(n/s);for(let m=0;m<this.xCellCount*this.yCellCount;m++)o.push([]),u.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=n,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/n,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,n,s,o,u){this._forEachCell(n,s,o,u,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(n),this.bboxes.push(s),this.bboxes.push(o),this.bboxes.push(u)}insertCircle(e,n,s,o){this._forEachCell(n-o,s-o,n+o,s+o,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(n),this.circles.push(s),this.circles.push(o)}_insertBoxCell(e,n,s,o,u,m){this.boxCells[u].push(m)}_insertCircleCell(e,n,s,o,u,m){this.circleCells[u].push(m)}_query(e,n,s,o,u,m,_){if(s<0||e>this.width||o<0||n>this.height)return[];let y=[];if(e<=0&&n<=0&&this.width<=s&&this.height<=o){if(u)return[{key:null,x1:e,y1:n,x2:s,y2:o}];for(let b=0;b<this.boxKeys.length;b++)y.push({key:this.boxKeys[b],x1:this.bboxes[4*b],y1:this.bboxes[4*b+1],x2:this.bboxes[4*b+2],y2:this.bboxes[4*b+3]});for(let b=0;b<this.circleKeys.length;b++){let T=this.circles[3*b],C=this.circles[3*b+1],P=this.circles[3*b+2];y.push({key:this.circleKeys[b],x1:T-P,y1:C-P,x2:T+P,y2:C+P})}}else this._forEachCell(e,n,s,o,this._queryCell,y,{hitTest:u,overlapMode:m,seenUids:{box:{},circle:{}}},_);return y}query(e,n,s,o){return this._query(e,n,s,o,!1,null)}hitTest(e,n,s,o,u,m){return this._query(e,n,s,o,!0,u,m).length>0}hitTestCircle(e,n,s,o,u){let m=e-s,_=e+s,y=n-s,b=n+s;if(_<0||m>this.width||b<0||y>this.height)return!1;let T=[];return this._forEachCell(m,y,_,b,this._queryCellCircle,T,{hitTest:!0,overlapMode:o,circle:{x:e,y:n,radius:s},seenUids:{box:{},circle:{}}},u),T.length>0}_queryCell(e,n,s,o,u,m,_,y){let{seenUids:b,hitTest:T,overlapMode:C}=_,P=this.boxCells[u];if(P!==null){let O=this.bboxes;for(let U of P)if(!b.box[U]){b.box[U]=!0;let Z=4*U,G=this.boxKeys[U];if(e<=O[Z+2]&&n<=O[Z+3]&&s>=O[Z+0]&&o>=O[Z+1]&&(!y||y(G))&&(!T||!Ki(C,G.overlapMode))&&(m.push({key:G,x1:O[Z],y1:O[Z+1],x2:O[Z+2],y2:O[Z+3]}),T))return!0}}let L=this.circleCells[u];if(L!==null){let O=this.circles;for(let U of L)if(!b.circle[U]){b.circle[U]=!0;let Z=3*U,G=this.circleKeys[U];if(this._circleAndRectCollide(O[Z],O[Z+1],O[Z+2],e,n,s,o)&&(!y||y(G))&&(!T||!Ki(C,G.overlapMode))){let W=O[Z],N=O[Z+1],Q=O[Z+2];if(m.push({key:G,x1:W-Q,y1:N-Q,x2:W+Q,y2:N+Q}),T)return!0}}}return!1}_queryCellCircle(e,n,s,o,u,m,_,y){let{circle:b,seenUids:T,overlapMode:C}=_,P=this.boxCells[u];if(P!==null){let O=this.bboxes;for(let U of P)if(!T.box[U]){T.box[U]=!0;let Z=4*U,G=this.boxKeys[U];if(this._circleAndRectCollide(b.x,b.y,b.radius,O[Z+0],O[Z+1],O[Z+2],O[Z+3])&&(!y||y(G))&&!Ki(C,G.overlapMode))return m.push(!0),!0}}let L=this.circleCells[u];if(L!==null){let O=this.circles;for(let U of L)if(!T.circle[U]){T.circle[U]=!0;let Z=3*U,G=this.circleKeys[U];if(this._circlesCollide(O[Z],O[Z+1],O[Z+2],b.x,b.y,b.radius)&&(!y||y(G))&&!Ki(C,G.overlapMode))return m.push(!0),!0}}}_forEachCell(e,n,s,o,u,m,_,y){let b=this._convertToXCellCoord(e),T=this._convertToYCellCoord(n),C=this._convertToXCellCoord(s),P=this._convertToYCellCoord(o);for(let L=b;L<=C;L++)for(let O=T;O<=P;O++)if(u.call(this,e,n,s,o,this.xCellCount*O+L,m,_,y))return}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,n,s,o,u,m){let _=o-e,y=u-n,b=s+m;return b*b>_*_+y*y}_circleAndRectCollide(e,n,s,o,u,m,_){let y=(m-o)/2,b=Math.abs(e-(o+y));if(b>y+s)return!1;let T=(_-u)/2,C=Math.abs(n-(u+T));if(C>T+s)return!1;if(b<=y||C<=T)return!0;let P=b-y,L=C-T;return P*P+L*L<=s*s}}function on(c,e,n,s,o){let u=p.H();return e?(p.K(u,u,[1/o,1/o,1]),n||p.ad(u,u,s.angle)):p.L(u,s.labelPlaneMatrix,c),u}function Zr(c,e,n,s,o){if(e){let u=p.ae(c);return p.K(u,u,[o,o,1]),n||p.ad(u,u,-s.angle),u}return s.glCoordMatrix}function j(c,e,n,s){let o;s?(o=[c,e,s(c,e),1],p.af(o,o,n)):(o=[c,e,0,1],zt(o,o,n));let u=o[3];return{point:new p.P(o[0]/u,o[1]/u),signedDistanceFromCamera:u,isOccluded:!1}}function k(c,e){return .5+c/e*.5}function I(c,e){return c.x>=-e[0]&&c.x<=e[0]&&c.y>=-e[1]&&c.y<=e[1]}function R(c,e,n,s,o,u,m,_,y,b,T,C,P,L,O){let U=s?c.textSizeData:c.iconSizeData,Z=p.ag(U,n.transform.zoom),G=[256/n.width*2+1,256/n.height*2+1],W=s?c.text.dynamicLayoutVertexArray:c.icon.dynamicLayoutVertexArray;W.clear();let N=c.lineVertexArray,Q=s?c.text.placedSymbolArray:c.icon.placedSymbolArray,te=n.transform.width/n.transform.height,ae=!1;for(let fe=0;fe<Q.length;fe++){let ve=Q.get(fe);if(ve.hidden||ve.writingMode===p.ah.vertical&&!ae){et(ve.numGlyphs,W);continue}ae=!1;let ke=j(ve.anchorX,ve.anchorY,e,O);if(!I(ke.point,G)){et(ve.numGlyphs,W);continue}let Oe=k(n.transform.cameraToCenterDistance,ke.signedDistanceFromCamera),Te=p.ai(U,Z,ve),Ee=m?Te/Oe:Te*Oe,$e={getElevation:O,labelPlaneMatrix:o,lineVertexArray:N,pitchWithMap:m,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},projection:b,tileAnchorPoint:new p.P(ve.anchorX,ve.anchorY),unwrappedTileID:T,width:C,height:P,translation:L},ct=ee($e,ve,Ee,!1,_,e,u,c.glyphOffsetArray,W,te,y);ae=ct.useVertical,(ct.notEnoughRoom||ae||ct.needsFlipping&&ee($e,ve,Ee,!0,_,e,u,c.glyphOffsetArray,W,te,y).notEnoughRoom)&&et(ve.numGlyphs,W)}s?c.text.dynamicLayoutVertexBuffer.updateData(W):c.icon.dynamicLayoutVertexBuffer.updateData(W)}function V(c,e,n,s,o,u,m,_){let y=u.glyphStartIndex+u.numGlyphs,b=u.lineStartIndex,T=u.lineStartIndex+u.lineLength,C=e.getoffsetX(u.glyphStartIndex),P=e.getoffsetX(y-1),L=Ae(c*C,n,s,o,u.segment,b,T,_,m);if(!L)return null;let O=Ae(c*P,n,s,o,u.segment,b,T,_,m);return O?_.projectionCache.anyProjectionOccluded?null:{first:L,last:O}:null}function K(c,e,n,s){return c===p.ah.horizontal&&Math.abs(n.y-e.y)>Math.abs(n.x-e.x)*s?{useVertical:!0}:(c===p.ah.vertical?e.y<n.y:e.x>n.x)?{needsFlipping:!0}:null}function ee(c,e,n,s,o,u,m,_,y,b,T){let C=n/24,P=e.lineOffsetX*C,L=e.lineOffsetY*C,O;if(e.numGlyphs>1){let U=e.glyphStartIndex+e.numGlyphs,Z=e.lineStartIndex,G=e.lineStartIndex+e.lineLength,W=V(C,_,P,L,s,e,T,c);if(!W)return{notEnoughRoom:!0};let N=j(W.first.point.x,W.first.point.y,m,c.getElevation).point,Q=j(W.last.point.x,W.last.point.y,m,c.getElevation).point;if(o&&!s){let te=K(e.writingMode,N,Q,b);if(te)return te}O=[W.first];for(let te=e.glyphStartIndex+1;te<U-1;te++)O.push(Ae(C*_.getoffsetX(te),P,L,s,e.segment,Z,G,c,T));O.push(W.last)}else{if(o&&!s){let Z=j(c.tileAnchorPoint.x,c.tileAnchorPoint.y,u,c.getElevation).point,G=e.lineStartIndex+e.segment+1,W=new p.P(c.lineVertexArray.getx(G),c.lineVertexArray.gety(G)),N=j(W.x,W.y,u,c.getElevation),Q=N.signedDistanceFromCamera>0?N.point:function(ae,fe,ve,ke,Oe,Te){return re(ae,fe,ve,1,Oe,Te)}(c.tileAnchorPoint,W,Z,0,u,c),te=K(e.writingMode,Z,Q,b);if(te)return te}let U=Ae(C*_.getoffsetX(e.glyphStartIndex),P,L,s,e.segment,e.lineStartIndex,e.lineStartIndex+e.lineLength,c,T);if(!U||c.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};O=[U]}for(let U of O)p.aj(y,U.point,U.angle);return{}}function re(c,e,n,s,o,u){let m=c.add(c.sub(e)._unit()),_=o!==void 0?j(m.x,m.y,o,u.getElevation).point:he(m.x,m.y,u).point,y=n.sub(_);return n.add(y._mult(s/y.mag()))}function H(c,e,n){let s=e.projectionCache;if(s.projections[c])return s.projections[c];let o=new p.P(e.lineVertexArray.getx(c),e.lineVertexArray.gety(c)),u=he(o.x,o.y,e);if(u.signedDistanceFromCamera>0)return s.projections[c]=u.point,s.anyProjectionOccluded=s.anyProjectionOccluded||u.isOccluded,u.point;let m=c-n.direction;return function(_,y,b,T,C){return re(_,y,b,T,void 0,C)}(n.distanceFromAnchor===0?e.tileAnchorPoint:new p.P(e.lineVertexArray.getx(m),e.lineVertexArray.gety(m)),o,n.previousVertex,n.absOffsetX-n.distanceFromAnchor+1,e)}function he(c,e,n){let s=c+n.translation[0],o=e+n.translation[1],u;return!n.pitchWithMap&&n.projection.useSpecialProjectionForSymbols?(u=n.projection.projectTileCoordinates(s,o,n.unwrappedTileID,n.getElevation),u.point.x=(.5*u.point.x+.5)*n.width,u.point.y=(.5*-u.point.y+.5)*n.height):(u=j(s,o,n.labelPlaneMatrix,n.getElevation),u.isOccluded=!1),u}function me(c,e,n){return c._unit()._perp()._mult(e*n)}function le(c,e,n,s,o,u,m,_,y){if(_.projectionCache.offsets[c])return _.projectionCache.offsets[c];let b=n.add(e);if(c+y.direction<s||c+y.direction>=o)return _.projectionCache.offsets[c]=b,b;let T=H(c+y.direction,_,y),C=me(T.sub(n),m,y.direction),P=n.add(C),L=T.add(C);return _.projectionCache.offsets[c]=p.ak(u,b,P,L)||b,_.projectionCache.offsets[c]}function Ae(c,e,n,s,o,u,m,_,y){let b=s?c-e:c+e,T=b>0?1:-1,C=0;s&&(T*=-1,C=Math.PI),T<0&&(C+=Math.PI);let P,L=T>0?u+o:u+o+1;_.projectionCache.cachedAnchorPoint?P=_.projectionCache.cachedAnchorPoint:(P=he(_.tileAnchorPoint.x,_.tileAnchorPoint.y,_).point,_.projectionCache.cachedAnchorPoint=P);let O,U,Z=P,G=P,W=0,N=0,Q=Math.abs(b),te=[],ae;for(;W+N<=Q;){if(L+=T,L<u||L>=m)return null;W+=N,G=Z,U=O;let ke={absOffsetX:Q,direction:T,distanceFromAnchor:W,previousVertex:G};if(Z=H(L,_,ke),n===0)te.push(G),ae=Z.sub(G);else{let Oe,Te=Z.sub(G);Oe=Te.mag()===0?me(H(L+T,_,ke).sub(Z),n,T):me(Te,n,T),U||(U=G.add(Oe)),O=le(L,Oe,Z,u,m,U,n,_,ke),te.push(U),ae=O.sub(U)}N=ae.mag()}let fe=ae._mult((Q-W)/N)._add(U||G),ve=C+Math.atan2(Z.y-G.y,Z.x-G.x);return te.push(fe),{point:fe,angle:y?ve:0,path:te}}let Ke=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function et(c,e){for(let n=0;n<c;n++){let s=e.length;e.resize(s+4),e.float32.set(Ke,3*s)}}function zt(c,e,n){let s=e[0],o=e[1];return c[0]=n[0]*s+n[4]*o+n[12],c[1]=n[1]*s+n[5]*o+n[13],c[3]=n[3]*s+n[7]*o+n[15],c}let pt=100;class Bt{constructor(e,n,s=new yr(e.width+200,e.height+200,25),o=new yr(e.width+200,e.height+200,25)){this.transform=e,this.mapProjection=n,this.grid=s,this.ignoredGrid=o,this.pitchFactor=Math.cos(e._pitch)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+pt,this.screenBottomBoundary=e.height+pt,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(e,n,s,o,u,m,_,y,b,T,C){let P=e.anchorPointX+y[0],L=e.anchorPointY+y[1],O=this.projectAndGetPerspectiveRatio(o,P,L,u,T),U=s*O.perspectiveRatio,Z;if(m||_)Z=this._projectCollisionBox(e,U,o,u,m,_,y,O,T,C);else{let te=O.point.x+(C?C.x*U:0),ae=O.point.y+(C?C.y*U:0);Z={allPointsOccluded:!1,box:[te+e.x1*U,ae+e.y1*U,te+e.x2*U,ae+e.y2*U]}}let[G,W,N,Q]=Z.box;return this.mapProjection.useSpecialProjectionForSymbols&&(m?Z.allPointsOccluded:this.mapProjection.isOccluded(P,L,u))||O.perspectiveRatio<this.perspectiveRatioCutoff||!this.isInsideGrid(G,W,N,Q)||n!=="always"&&this.grid.hitTest(G,W,N,Q,n,b)?{box:[G,W,N,Q],placeable:!1,offscreen:!1}:{box:[G,W,N,Q],placeable:!0,offscreen:this.isOffscreen(G,W,N,Q)}}placeCollisionCircles(e,n,s,o,u,m,_,y,b,T,C,P,L,O,U,Z){let G=[],W=new p.P(n.anchorX,n.anchorY),N=this.getPerspectiveRatio(m,W.x,W.y,_,Z),Q=(C?u/N:u*N)/p.ap,te={getElevation:Z,labelPlaneMatrix:y,lineVertexArray:s,pitchWithMap:C,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},projection:this.mapProjection,tileAnchorPoint:W,unwrappedTileID:_,width:this.transform.width,height:this.transform.height,translation:U},ae=V(Q,o,n.lineOffsetX*Q,n.lineOffsetY*Q,!1,n,!1,te),fe=!1,ve=!1,ke=!0;if(ae){let Oe=.5*L*N+O,Te=new p.P(-100,-100),Ee=new p.P(this.screenRightBoundary,this.screenBottomBoundary),$e=new st,ct=ae.first,Se=ae.last,ze=[];for(let yt=ct.path.length-1;yt>=1;yt--)ze.push(ct.path[yt]);for(let yt=1;yt<Se.path.length;yt++)ze.push(Se.path[yt]);let ot=2.5*Oe;if(b){let yt=this.projectPathToScreenSpace(ze,te,b);ze=yt.some(Ct=>Ct.signedDistanceFromCamera<=0)?[]:yt.map(Ct=>Ct.point)}let ii=[];if(ze.length>0){let yt=ze[0].clone(),Ct=ze[0].clone();for(let ri=1;ri<ze.length;ri++)yt.x=Math.min(yt.x,ze[ri].x),yt.y=Math.min(yt.y,ze[ri].y),Ct.x=Math.max(Ct.x,ze[ri].x),Ct.y=Math.max(Ct.y,ze[ri].y);ii=yt.x>=Te.x&&Ct.x<=Ee.x&&yt.y>=Te.y&&Ct.y<=Ee.y?[ze]:Ct.x<Te.x||yt.x>Ee.x||Ct.y<Te.y||yt.y>Ee.y?[]:p.al([ze],Te.x,Te.y,Ee.x,Ee.y)}for(let yt of ii){$e.reset(yt,.25*Oe);let Ct=0;Ct=$e.length<=.5*Oe?1:Math.ceil($e.paddedLength/ot)+1;for(let ri=0;ri<Ct;ri++){let zi=ri/Math.max(Ct-1,1),Or=$e.lerp(zi),ni=Or.x+pt,er=Or.y+pt;G.push(ni,er,Oe,0);let $i=ni-Oe,Bi=er-Oe,Zi=ni+Oe,Wr=er+Oe;if(ke=ke&&this.isOffscreen($i,Bi,Zi,Wr),ve=ve||this.isInsideGrid($i,Bi,Zi,Wr),e!=="always"&&this.grid.hitTestCircle(ni,er,Oe,e,P)&&(fe=!0,!T))return{circles:[],offscreen:!1,collisionDetected:fe}}}}return{circles:!T&&fe||!ve||N<this.perspectiveRatioCutoff?[]:G,offscreen:ke,collisionDetected:fe}}projectPathToScreenSpace(e,n,s){return e.map(o=>j(o.x,o.y,s,n.getElevation))}queryRenderedSymbols(e){if(e.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};let n=[],s=1/0,o=1/0,u=-1/0,m=-1/0;for(let T of e){let C=new p.P(T.x+pt,T.y+pt);s=Math.min(s,C.x),o=Math.min(o,C.y),u=Math.max(u,C.x),m=Math.max(m,C.y),n.push(C)}let _=this.grid.query(s,o,u,m).concat(this.ignoredGrid.query(s,o,u,m)),y={},b={};for(let T of _){let C=T.key;if(y[C.bucketInstanceId]===void 0&&(y[C.bucketInstanceId]={}),y[C.bucketInstanceId][C.featureIndex])continue;let P=[new p.P(T.x1,T.y1),new p.P(T.x2,T.y1),new p.P(T.x2,T.y2),new p.P(T.x1,T.y2)];p.am(n,P)&&(y[C.bucketInstanceId][C.featureIndex]=!0,b[C.bucketInstanceId]===void 0&&(b[C.bucketInstanceId]=[]),b[C.bucketInstanceId].push(C.featureIndex))}return b}insertCollisionBox(e,n,s,o,u,m){(s?this.ignoredGrid:this.grid).insert({bucketInstanceId:o,featureIndex:u,collisionGroupID:m,overlapMode:n},e[0],e[1],e[2],e[3])}insertCollisionCircles(e,n,s,o,u,m){let _=s?this.ignoredGrid:this.grid,y={bucketInstanceId:o,featureIndex:u,collisionGroupID:m,overlapMode:n};for(let b=0;b<e.length;b+=4)_.insertCircle(y,e[b],e[b+1],e[b+2])}projectAndGetPerspectiveRatio(e,n,s,o,u){let m;u?(m=[n,s,u(n,s),1],p.af(m,m,e)):(m=[n,s,0,1],zt(m,m,e));let _=m[3];return{point:new p.P((m[0]/_+1)/2*this.transform.width+pt,(-m[1]/_+1)/2*this.transform.height+pt),perspectiveRatio:.5+this.transform.cameraToCenterDistance/_*.5,isOccluded:!1,signedDistanceFromCamera:_}}getPerspectiveRatio(e,n,s,o,u){let m=this.mapProjection.useSpecialProjectionForSymbols?this.mapProjection.projectTileCoordinates(n,s,o,u):j(n,s,e,u);return .5+this.transform.cameraToCenterDistance/m.signedDistanceFromCamera*.5}isOffscreen(e,n,s,o){return s<pt||e>=this.screenRightBoundary||o<pt||n>this.screenBottomBoundary}isInsideGrid(e,n,s,o){return s>=0&&e<this.gridRightBoundary&&o>=0&&n<this.gridBottomBoundary}getViewportMatrix(){let e=p.an([]);return p.J(e,e,[-100,-100,0]),e}_projectCollisionBox(e,n,s,o,u,m,_,y,b,T){let C=new p.P(1,0),P=new p.P(0,1),L=new p.P(e.anchorPointX+_[0],e.anchorPointY+_[1]);if(m&&!u){let ke=this.projectAndGetPerspectiveRatio(s,L.x+1,L.y,o,b).point.sub(y.point).unit(),Oe=Math.atan(ke.y/ke.x)+(ke.x<0?Math.PI:0),Te=Math.sin(Oe),Ee=Math.cos(Oe);C=new p.P(Ee,Te),P=new p.P(-Te,Ee)}else if(!m&&u){let ke=-this.transform.angle,Oe=Math.sin(ke),Te=Math.cos(ke);C=new p.P(Te,Oe),P=new p.P(-Oe,Te)}let O=y.point,U=n;if(u){O=L;let ke=this.transform.zoom-Math.floor(this.transform.zoom);U=Math.pow(2,-ke),U*=this.mapProjection.getPitchedTextCorrection(this.transform,L,o),T||(U*=p.ac(.5+y.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))}T&&(O=O.add(C.mult(T.x*U)).add(P.mult(T.y*U)));let Z=e.x1*U,G=e.x2*U,W=(Z+G)/2,N=e.y1*U,Q=e.y2*U,te=(N+Q)/2,ae=[{offsetX:Z,offsetY:N},{offsetX:W,offsetY:N},{offsetX:G,offsetY:N},{offsetX:G,offsetY:te},{offsetX:G,offsetY:Q},{offsetX:W,offsetY:Q},{offsetX:Z,offsetY:Q},{offsetX:Z,offsetY:te}],fe=[];for(let{offsetX:ke,offsetY:Oe}of ae)fe.push(new p.P(O.x+C.x*ke+P.x*Oe,O.y+C.y*ke+P.y*Oe));let ve=!1;if(u){let ke=fe.map(Oe=>this.projectAndGetPerspectiveRatio(s,Oe.x,Oe.y,o,b));ve=ke.some(Oe=>!Oe.isOccluded),fe=ke.map(Oe=>Oe.point)}else ve=!0;return{box:p.ao(fe),allPointsOccluded:!ve}}}function Tt(c,e,n){return e*(p.X/(c.tileSize*Math.pow(2,n-c.tileID.overscaledZ)))}class yi{constructor(e,n,s,o){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?n:-n))):o&&s?1:0,this.placed=s}isHidden(){return this.opacity===0&&!this.placed}}class hi{constructor(e,n,s,o,u){this.text=new yi(e?e.text:null,n,s,u),this.icon=new yi(e?e.icon:null,n,o,u)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class bt{constructor(e,n,s){this.text=e,this.icon=n,this.skipFade=s}}class Ut{constructor(){this.invProjMatrix=p.H(),this.viewportMatrix=p.H(),this.circles=[]}}class oi{constructor(e,n,s,o,u){this.bucketInstanceId=e,this.featureIndex=n,this.sourceLayerIndex=s,this.bucketIndex=o,this.tileID=u}}class Ei{constructor(e){this.crossSourceCollisions=e,this.maxGroupID=0,this.collisionGroups={}}get(e){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[e]){let n=++this.maxGroupID;this.collisionGroups[e]={ID:n,predicate:s=>s.collisionGroupID===n}}return this.collisionGroups[e]}}function Ii(c,e,n,s,o){let{horizontalAlign:u,verticalAlign:m}=p.au(c);return new p.P(-(u-.5)*e+s[0]*o,-(m-.5)*n+s[1]*o)}class ji{constructor(e,n,s,o,u,m){this.transform=e.clone(),this.terrain=s,this.collisionIndex=new Bt(this.transform,n),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=o,this.retainedQueryData={},this.collisionGroups=new Ei(u),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=m,m&&(m.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(e){let n=this.terrain;return n?(s,o)=>n.getElevation(e,s,o):null}getBucketParts(e,n,s,o){let u=s.getBucket(n),m=s.latestFeatureIndex;if(!u||!m||n.id!==u.layerIds[0])return;let _=s.collisionBoxArray,y=u.layers[0].layout,b=u.layers[0].paint,T=Math.pow(2,this.transform.zoom-s.tileID.overscaledZ),C=s.tileSize/p.X,P=s.tileID.toUnwrapped(),L=this.transform.calculatePosMatrix(P),O=y.get("text-pitch-alignment")==="map",U=y.get("text-rotation-alignment")==="map",Z=Tt(s,1,this.transform.zoom),G=this.collisionIndex.mapProjection.translatePosition(this.transform,s,b.get("text-translate"),b.get("text-translate-anchor")),W=this.collisionIndex.mapProjection.translatePosition(this.transform,s,b.get("icon-translate"),b.get("icon-translate-anchor")),N=on(L,O,U,this.transform,Z),Q=null;if(O){let ae=Zr(L,O,U,this.transform,Z);Q=p.L([],this.transform.labelPlaneMatrix,ae)}this.retainedQueryData[u.bucketInstanceId]=new oi(u.bucketInstanceId,m,u.sourceLayerIndex,u.index,s.tileID);let te={bucket:u,layout:y,translationText:G,translationIcon:W,posMatrix:L,unwrappedTileID:P,textLabelPlaneMatrix:N,labelToScreenMatrix:Q,scale:T,textPixelRatio:C,holdingForFade:s.holdingForFade(),collisionBoxArray:_,partiallyEvaluatedTextSize:p.ag(u.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(u.sourceID)};if(o)for(let ae of u.sortKeyRanges){let{sortKey:fe,symbolInstanceStart:ve,symbolInstanceEnd:ke}=ae;e.push({sortKey:fe,symbolInstanceStart:ve,symbolInstanceEnd:ke,parameters:te})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:u.symbolInstances.length,parameters:te})}attemptAnchorPlacement(e,n,s,o,u,m,_,y,b,T,C,P,L,O,U,Z,G,W,N){let Q=p.aq[e.textAnchor],te=[e.textOffset0,e.textOffset1],ae=Ii(Q,s,o,te,u),fe=this.collisionIndex.placeCollisionBox(n,P,y,b,T,_,m,Z,C.predicate,N,ae);if((!W||this.collisionIndex.placeCollisionBox(W,P,y,b,T,_,m,G,C.predicate,N,ae).placeable)&&fe.placeable){let ve;if(this.prevPlacement&&this.prevPlacement.variableOffsets[L.crossTileID]&&this.prevPlacement.placements[L.crossTileID]&&this.prevPlacement.placements[L.crossTileID].text&&(ve=this.prevPlacement.variableOffsets[L.crossTileID].anchor),L.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[L.crossTileID]={textOffset:te,width:s,height:o,anchor:Q,textBoxScale:u,prevAnchor:ve},this.markUsedJustification(O,Q,L,U),O.allowVerticalPlacement&&(this.markUsedOrientation(O,U,L),this.placedOrientations[L.crossTileID]=U),{shift:ae,placedGlyphBoxes:fe}}}placeLayerBucketPart(e,n,s){let{bucket:o,layout:u,translationText:m,translationIcon:_,posMatrix:y,unwrappedTileID:b,textLabelPlaneMatrix:T,labelToScreenMatrix:C,textPixelRatio:P,holdingForFade:L,collisionBoxArray:O,partiallyEvaluatedTextSize:U,collisionGroup:Z}=e.parameters,G=u.get("text-optional"),W=u.get("icon-optional"),N=p.ar(u,"text-overlap","text-allow-overlap"),Q=N==="always",te=p.ar(u,"icon-overlap","icon-allow-overlap"),ae=te==="always",fe=u.get("text-rotation-alignment")==="map",ve=u.get("text-pitch-alignment")==="map",ke=u.get("icon-text-fit")!=="none",Oe=u.get("symbol-z-order")==="viewport-y",Te=Q&&(ae||!o.hasIconData()||W),Ee=ae&&(Q||!o.hasTextData()||G);!o.collisionArrays&&O&&o.deserializeCollisionBoxes(O);let $e=this._getTerrainElevationFunc(this.retainedQueryData[o.bucketInstanceId].tileID),ct=(Se,ze,ot)=>{var ii,yt;if(n[Se.crossTileID])return;if(L)return void(this.placements[Se.crossTileID]=new bt(!1,!1,!1));let Ct=!1,ri=!1,zi=!0,Or=null,ni={box:null,placeable:!1,offscreen:null},er={box:null,placeable:!1,offscreen:null},$i=null,Bi=null,Zi=null,Wr=0,la=0,Cs=0;ze.textFeatureIndex?Wr=ze.textFeatureIndex:Se.useRuntimeCollisionCircles&&(Wr=Se.featureIndex),ze.verticalTextFeatureIndex&&(la=ze.verticalTextFeatureIndex);let ua=ze.textBox;if(ua){let Er=ki=>{let Li=p.ah.horizontal;if(o.allowVerticalPlacement&&!ki&&this.prevPlacement){let fr=this.prevPlacement.placedOrientations[Se.crossTileID];fr&&(this.placedOrientations[Se.crossTileID]=fr,Li=fr,this.markUsedOrientation(o,Li,Se))}return Li},Tr=(ki,Li)=>{if(o.allowVerticalPlacement&&Se.numVerticalGlyphVertices>0&&ze.verticalTextBox){for(let fr of o.writingModes)if(fr===p.ah.vertical?(ni=Li(),er=ni):ni=ki(),ni&&ni.placeable)break}else ni=ki()},cn=Se.textAnchorOffsetStartIndex,Nr=Se.textAnchorOffsetEndIndex;if(Nr===cn){let ki=(Li,fr)=>{let St=this.collisionIndex.placeCollisionBox(Li,N,P,y,b,ve,fe,m,Z.predicate,$e);return St&&St.placeable&&(this.markUsedOrientation(o,fr,Se),this.placedOrientations[Se.crossTileID]=fr),St};Tr(()=>ki(ua,p.ah.horizontal),()=>{let Li=ze.verticalTextBox;return o.allowVerticalPlacement&&Se.numVerticalGlyphVertices>0&&Li?ki(Li,p.ah.vertical):{box:null,offscreen:null}}),Er(ni&&ni.placeable)}else{let ki=p.aq[(yt=(ii=this.prevPlacement)===null||ii===void 0?void 0:ii.variableOffsets[Se.crossTileID])===null||yt===void 0?void 0:yt.anchor],Li=(St,Mn,ca)=>{let ha=St.x2-St.x1,Yl=St.y2-St.y1,ac=Se.textBoxScale,Ql=ke&&te==="never"?Mn:null,hn=null,eu=N==="never"?1:2,Ss="never";ki&&eu++;for(let qa=0;qa<eu;qa++){for(let Is=cn;Is<Nr;Is++){let ks=o.textAnchorOffsets.get(Is);if(ki&&ks.textAnchor!==ki)continue;let pa=this.attemptAnchorPlacement(ks,St,ha,Yl,ac,fe,ve,P,y,b,Z,Ss,Se,o,ca,m,_,Ql,$e);if(pa&&(hn=pa.placedGlyphBoxes,hn&&hn.placeable))return Ct=!0,Or=pa.shift,hn}ki?ki=null:Ss=N}return s&&!hn&&(hn={box:this.collisionIndex.placeCollisionBox(ua,"always",P,y,b,ve,fe,m,Z.predicate,$e,new p.P(0,0)).box,offscreen:!1,placeable:!1}),hn};Tr(()=>Li(ua,ze.iconBox,p.ah.horizontal),()=>{let St=ze.verticalTextBox;return o.allowVerticalPlacement&&(!ni||!ni.placeable)&&Se.numVerticalGlyphVertices>0&&St?Li(St,ze.verticalIconBox,p.ah.vertical):{box:null,occluded:!0,offscreen:null}}),ni&&(Ct=ni.placeable,zi=ni.offscreen);let fr=Er(ni&&ni.placeable);if(!Ct&&this.prevPlacement){let St=this.prevPlacement.variableOffsets[Se.crossTileID];St&&(this.variableOffsets[Se.crossTileID]=St,this.markUsedJustification(o,St.anchor,Se,fr))}}}if($i=ni,Ct=$i&&$i.placeable,zi=$i&&$i.offscreen,Se.useRuntimeCollisionCircles){let Er=o.text.placedSymbolArray.get(Se.centerJustifiedTextSymbolIndex),Tr=p.ai(o.textSizeData,U,Er),cn=u.get("text-padding");Bi=this.collisionIndex.placeCollisionCircles(N,Er,o.lineVertexArray,o.glyphOffsetArray,Tr,y,b,T,C,s,ve,Z.predicate,Se.collisionCircleDiameter,cn,m,$e),Bi.circles.length&&Bi.collisionDetected&&!s&&p.w("Collisions detected, but collision boxes are not shown"),Ct=Q||Bi.circles.length>0&&!Bi.collisionDetected,zi=zi&&Bi.offscreen}if(ze.iconFeatureIndex&&(Cs=ze.iconFeatureIndex),ze.iconBox){let Er=Tr=>this.collisionIndex.placeCollisionBox(Tr,te,P,y,b,ve,fe,_,Z.predicate,$e,ke&&Or?Or:void 0);er&&er.placeable&&ze.verticalIconBox?(Zi=Er(ze.verticalIconBox),ri=Zi.placeable):(Zi=Er(ze.iconBox),ri=Zi.placeable),zi=zi&&Zi.offscreen}let Ar=G||Se.numHorizontalGlyphVertices===0&&Se.numVerticalGlyphVertices===0,Ds=W||Se.numIconVertices===0;Ar||Ds?Ds?Ar||(ri=ri&&Ct):Ct=ri&&Ct:ri=Ct=ri&&Ct;let Uo=ri&&Zi.placeable;if(Ct&&$i.placeable&&this.collisionIndex.insertCollisionBox($i.box,N,u.get("text-ignore-placement"),o.bucketInstanceId,er&&er.placeable&&la?la:Wr,Z.ID),Uo&&this.collisionIndex.insertCollisionBox(Zi.box,te,u.get("icon-ignore-placement"),o.bucketInstanceId,Cs,Z.ID),Bi&&Ct&&this.collisionIndex.insertCollisionCircles(Bi.circles,N,u.get("text-ignore-placement"),o.bucketInstanceId,Wr,Z.ID),s&&this.storeCollisionData(o.bucketInstanceId,ot,ze,$i,Zi,Bi),Se.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(o.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[Se.crossTileID]=new bt(Ct||Te,ri||Ee,zi||o.justReloaded),n[Se.crossTileID]=!0};if(Oe){if(e.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");let Se=o.getSortedSymbolIndexes(this.transform.angle);for(let ze=Se.length-1;ze>=0;--ze){let ot=Se[ze];ct(o.symbolInstances.get(ot),o.collisionArrays[ot],ot)}}else for(let Se=e.symbolInstanceStart;Se<e.symbolInstanceEnd;Se++)ct(o.symbolInstances.get(Se),o.collisionArrays[Se],Se);if(s&&o.bucketInstanceId in this.collisionCircleArrays){let Se=this.collisionCircleArrays[o.bucketInstanceId];p.as(Se.invProjMatrix,y),Se.viewportMatrix=this.collisionIndex.getViewportMatrix()}o.justReloaded=!1}storeCollisionData(e,n,s,o,u,m){if(s.textBox||s.iconBox){let _,y;this.collisionBoxArrays.has(e)?_=this.collisionBoxArrays.get(e):(_=new Map,this.collisionBoxArrays.set(e,_)),_.has(n)?y=_.get(n):(y={text:null,icon:null},_.set(n,y)),s.textBox&&(y.text=o.box),s.iconBox&&(y.icon=u.box)}if(m){let _=this.collisionCircleArrays[e];_===void 0&&(_=this.collisionCircleArrays[e]=new Ut);for(let y=0;y<m.circles.length;y+=4)_.circles.push(m.circles[y+0]),_.circles.push(m.circles[y+1]),_.circles.push(m.circles[y+2]),_.circles.push(m.collisionDetected?1:0)}}markUsedJustification(e,n,s,o){let u;u=o===p.ah.vertical?s.verticalPlacedTextSymbolIndex:{left:s.leftJustifiedTextSymbolIndex,center:s.centerJustifiedTextSymbolIndex,right:s.rightJustifiedTextSymbolIndex}[p.at(n)];let m=[s.leftJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.rightJustifiedTextSymbolIndex,s.verticalPlacedTextSymbolIndex];for(let _ of m)_>=0&&(e.text.placedSymbolArray.get(_).crossTileID=u>=0&&_!==u?0:s.crossTileID)}markUsedOrientation(e,n,s){let o=n===p.ah.horizontal||n===p.ah.horizontalOnly?n:0,u=n===p.ah.vertical?n:0,m=[s.leftJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.rightJustifiedTextSymbolIndex];for(let _ of m)e.text.placedSymbolArray.get(_).placedOrientation=o;s.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(s.verticalPlacedTextSymbolIndex).placedOrientation=u)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;let n=this.prevPlacement,s=!1;this.prevZoomAdjustment=n?n.zoomAdjustment(this.transform.zoom):0;let o=n?n.symbolFadeChange(e):1,u=n?n.opacities:{},m=n?n.variableOffsets:{},_=n?n.placedOrientations:{};for(let y in this.placements){let b=this.placements[y],T=u[y];T?(this.opacities[y]=new hi(T,o,b.text,b.icon),s=s||b.text!==T.text.placed||b.icon!==T.icon.placed):(this.opacities[y]=new hi(null,o,b.text,b.icon,b.skipFade),s=s||b.text||b.icon)}for(let y in u){let b=u[y];if(!this.opacities[y]){let T=new hi(b,o,!1,!1);T.isHidden()||(this.opacities[y]=T,s=s||b.text.placed||b.icon.placed)}}for(let y in m)this.variableOffsets[y]||!this.opacities[y]||this.opacities[y].isHidden()||(this.variableOffsets[y]=m[y]);for(let y in _)this.placedOrientations[y]||!this.opacities[y]||this.opacities[y].isHidden()||(this.placedOrientations[y]=_[y]);if(n&&n.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");s?this.lastPlacementChangeTime=e:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=n?n.lastPlacementChangeTime:e)}updateLayerOpacities(e,n){let s={};for(let o of n){let u=o.getBucket(e);u&&o.latestFeatureIndex&&e.id===u.layerIds[0]&&this.updateBucketOpacities(u,o.tileID,s,o.collisionBoxArray)}}updateBucketOpacities(e,n,s,o){e.hasTextData()&&(e.text.opacityVertexArray.clear(),e.text.hasVisibleVertices=!1),e.hasIconData()&&(e.icon.opacityVertexArray.clear(),e.icon.hasVisibleVertices=!1),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();let u=e.layers[0],m=u.layout,_=new hi(null,0,!1,!1,!0),y=m.get("text-allow-overlap"),b=m.get("icon-allow-overlap"),T=u._unevaluatedLayout.hasValue("text-variable-anchor")||u._unevaluatedLayout.hasValue("text-variable-anchor-offset"),C=m.get("text-rotation-alignment")==="map",P=m.get("text-pitch-alignment")==="map",L=m.get("icon-text-fit")!=="none",O=new hi(null,0,y&&(b||!e.hasIconData()||m.get("icon-optional")),b&&(y||!e.hasTextData()||m.get("text-optional")),!0);!e.collisionArrays&&o&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(o);let U=(G,W,N)=>{for(let Q=0;Q<W/4;Q++)G.opacityVertexArray.emplaceBack(N);G.hasVisibleVertices=G.hasVisibleVertices||N!==Vn},Z=this.collisionBoxArrays.get(e.bucketInstanceId);for(let G=0;G<e.symbolInstances.length;G++){let W=e.symbolInstances.get(G),{numHorizontalGlyphVertices:N,numVerticalGlyphVertices:Q,crossTileID:te}=W,ae=this.opacities[te];s[te]?ae=_:ae||(ae=O,this.opacities[te]=ae),s[te]=!0;let fe=W.numIconVertices>0,ve=this.placedOrientations[W.crossTileID],ke=ve===p.ah.vertical,Oe=ve===p.ah.horizontal||ve===p.ah.horizontalOnly;if(N>0||Q>0){let Ee=hr(ae.text);U(e.text,N,ke?Vn:Ee),U(e.text,Q,Oe?Vn:Ee);let $e=ae.text.isHidden();[W.rightJustifiedTextSymbolIndex,W.centerJustifiedTextSymbolIndex,W.leftJustifiedTextSymbolIndex].forEach(ze=>{ze>=0&&(e.text.placedSymbolArray.get(ze).hidden=$e||ke?1:0)}),W.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(W.verticalPlacedTextSymbolIndex).hidden=$e||Oe?1:0);let ct=this.variableOffsets[W.crossTileID];ct&&this.markUsedJustification(e,ct.anchor,W,ve);let Se=this.placedOrientations[W.crossTileID];Se&&(this.markUsedJustification(e,"left",W,Se),this.markUsedOrientation(e,Se,W))}if(fe){let Ee=hr(ae.icon),$e=!(L&&W.verticalPlacedIconSymbolIndex&&ke);W.placedIconSymbolIndex>=0&&(U(e.icon,W.numIconVertices,$e?Ee:Vn),e.icon.placedSymbolArray.get(W.placedIconSymbolIndex).hidden=ae.icon.isHidden()),W.verticalPlacedIconSymbolIndex>=0&&(U(e.icon,W.numVerticalIconVertices,$e?Vn:Ee),e.icon.placedSymbolArray.get(W.verticalPlacedIconSymbolIndex).hidden=ae.icon.isHidden())}let Te=Z&&Z.has(G)?Z.get(G):{text:null,icon:null};if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){let Ee=e.collisionArrays[G];if(Ee){let $e=new p.P(0,0);if(Ee.textBox||Ee.verticalTextBox){let ct=!0;if(T){let Se=this.variableOffsets[te];Se?($e=Ii(Se.anchor,Se.width,Se.height,Se.textOffset,Se.textBoxScale),C&&$e._rotate(P?this.transform.angle:-this.transform.angle)):ct=!1}if(Ee.textBox||Ee.verticalTextBox){let Se;Ee.textBox&&(Se=ke),Ee.verticalTextBox&&(Se=Oe),qn(e.textCollisionBox.collisionVertexArray,ae.text.placed,!ct||Se,Te.text,$e.x,$e.y)}}if(Ee.iconBox||Ee.verticalIconBox){let ct=!!(!Oe&&Ee.verticalIconBox),Se;Ee.iconBox&&(Se=ct),Ee.verticalIconBox&&(Se=!ct),qn(e.iconCollisionBox.collisionVertexArray,ae.icon.placed,Se,Te.icon,L?$e.x:0,L?$e.y:0)}}}}if(e.sortFeatures(this.transform.angle),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.text.opacityVertexArray.length!==e.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${e.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${e.text.layoutVertexArray.length}) / 4`);if(e.icon.opacityVertexArray.length!==e.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${e.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${e.icon.layoutVertexArray.length}) / 4`);if(e.bucketInstanceId in this.collisionCircleArrays){let G=this.collisionCircleArrays[e.bucketInstanceId];e.placementInvProjMatrix=G.invProjMatrix,e.placementViewportMatrix=G.viewportMatrix,e.collisionCircleArray=G.circles,delete this.collisionCircleArrays[e.bucketInstanceId]}}symbolFadeChange(e){return this.fadeDuration===0?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(e,n){let s=this.zoomAtLastRecencyCheck===n?1-this.zoomAdjustment(n):1;return this.zoomAtLastRecencyCheck=n,this.commitTime+this.fadeDuration*s>e}setStale(){this.stale=!0}}function qn(c,e,n,s,o,u){s&&s.length!==0||(s=[0,0,0,0]);let m=s[0]-pt,_=s[1]-pt,y=s[2]-pt,b=s[3]-pt;c.emplaceBack(e?1:0,n?1:0,o||0,u||0,m,_),c.emplaceBack(e?1:0,n?1:0,o||0,u||0,y,_),c.emplaceBack(e?1:0,n?1:0,o||0,u||0,y,b),c.emplaceBack(e?1:0,n?1:0,o||0,u||0,m,b)}let jt=Math.pow(2,25),Ys=Math.pow(2,24),Qs=Math.pow(2,17),ur=Math.pow(2,16),cr=Math.pow(2,9),zu=Math.pow(2,8),vr=Math.pow(2,1);function hr(c){if(c.opacity===0&&!c.placed)return 0;if(c.opacity===1&&c.placed)return 4294967295;let e=c.placed?1:0,n=Math.floor(127*c.opacity);return n*jt+e*Ys+n*Qs+e*ur+n*cr+e*zu+n*vr+e}let Vn=0;function vn(){return{isOccluded:(c,e,n)=>!1,getPitchedTextCorrection:(c,e,n)=>1,get useSpecialProjectionForSymbols(){return!1},projectTileCoordinates(c,e,n,s){throw new Error("Not implemented.")},translatePosition:(c,e,n,s)=>function(o,u,m,_,y=!1){if(!m[0]&&!m[1])return[0,0];let b=y?_==="map"?o.angle:0:_==="viewport"?-o.angle:0;if(b){let T=Math.sin(b),C=Math.cos(b);m=[m[0]*C-m[1]*T,m[0]*T+m[1]*C]}return[y?m[0]:Tt(u,m[0],o.zoom),y?m[1]:Tt(u,m[1],o.zoom)]}(c,e,n,s),getCircleRadiusCorrection:c=>1}}class vi{constructor(e){this._sortAcrossTiles=e.layout.get("symbol-z-order")!=="viewport-y"&&!e.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(e,n,s,o,u){let m=this._bucketParts;for(;this._currentTileIndex<e.length;)if(n.getBucketParts(m,o,e[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,u())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,m.sort((_,y)=>_.sortKey-y.sortKey));this._currentPartIndex<m.length;)if(n.placeLayerBucketPart(m[this._currentPartIndex],this._seenCrossTileIDs,s),this._currentPartIndex++,u())return!0;return!1}}class wa{constructor(e,n,s,o,u,m,_,y){this.placement=new ji(e,vn(),n,m,_,y),this._currentPlacementIndex=s.length-1,this._forceFullPlacement=o,this._showCollisionBoxes=u,this._done=!1}isDone(){return this._done}continuePlacement(e,n,s){let o=se.now(),u=()=>!this._forceFullPlacement&&se.now()-o>2;for(;this._currentPlacementIndex>=0;){let m=n[e[this._currentPlacementIndex]],_=this.placement.collisionIndex.transform.zoom;if(m.type==="symbol"&&(!m.minzoom||m.minzoom<=_)&&(!m.maxzoom||m.maxzoom>_)){if(this._inProgressLayer||(this._inProgressLayer=new vi(m)),this._inProgressLayer.continuePlacement(s[m.source],this.placement,this._showCollisionBoxes,m,u))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}}let zr=512/p.X/2;class gi{constructor(e,n,s){this.tileID=e,this.bucketInstanceId=s,this._symbolsByKey={};let o=new Map;for(let u=0;u<n.length;u++){let m=n.get(u),_=m.key,y=o.get(_);y?y.push(m):o.set(_,[m])}for(let[u,m]of o){let _={positions:m.map(y=>({x:Math.floor(y.anchorX*zr),y:Math.floor(y.anchorY*zr)})),crossTileIDs:m.map(y=>y.crossTileID)};if(_.positions.length>128){let y=new p.av(_.positions.length,16,Uint16Array);for(let{x:b,y:T}of _.positions)y.add(b,T);y.finish(),delete _.positions,_.index=y}this._symbolsByKey[u]=_}}getScaledCoordinates(e,n){let{x:s,y:o,z:u}=this.tileID.canonical,{x:m,y:_,z:y}=n.canonical,b=zr/Math.pow(2,y-u),T=(_*p.X+e.anchorY)*b,C=o*p.X*zr;return{x:Math.floor((m*p.X+e.anchorX)*b-s*p.X*zr),y:Math.floor(T-C)}}findMatches(e,n,s){let o=this.tileID.canonical.z<n.canonical.z?1:Math.pow(2,this.tileID.canonical.z-n.canonical.z);for(let u=0;u<e.length;u++){let m=e.get(u);if(m.crossTileID)continue;let _=this._symbolsByKey[m.key];if(!_)continue;let y=this.getScaledCoordinates(m,n);if(_.index){let b=_.index.range(y.x-o,y.y-o,y.x+o,y.y+o).sort();for(let T of b){let C=_.crossTileIDs[T];if(!s[C]){s[C]=!0,m.crossTileID=C;break}}}else if(_.positions)for(let b=0;b<_.positions.length;b++){let T=_.positions[b],C=_.crossTileIDs[b];if(Math.abs(T.x-y.x)<=o&&Math.abs(T.y-y.y)<=o&&!s[C]){s[C]=!0,m.crossTileID=C;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:e})=>e)}}class Wa{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Br{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){let n=Math.round((e-this.lng)/360);if(n!==0)for(let s in this.indexes){let o=this.indexes[s],u={};for(let m in o){let _=o[m];_.tileID=_.tileID.unwrapTo(_.tileID.wrap+n),u[_.tileID.key]=_}this.indexes[s]=u}this.lng=e}addBucket(e,n,s){if(this.indexes[e.overscaledZ]&&this.indexes[e.overscaledZ][e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===n.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let u=0;u<n.symbolInstances.length;u++)n.symbolInstances.get(u).crossTileID=0;this.usedCrossTileIDs[e.overscaledZ]||(this.usedCrossTileIDs[e.overscaledZ]={});let o=this.usedCrossTileIDs[e.overscaledZ];for(let u in this.indexes){let m=this.indexes[u];if(Number(u)>e.overscaledZ)for(let _ in m){let y=m[_];y.tileID.isChildOf(e)&&y.findMatches(n.symbolInstances,e,o)}else{let _=m[e.scaledTo(Number(u)).key];_&&_.findMatches(n.symbolInstances,e,o)}}for(let u=0;u<n.symbolInstances.length;u++){let m=n.symbolInstances.get(u);m.crossTileID||(m.crossTileID=s.generate(),o[m.crossTileID]=!0)}return this.indexes[e.overscaledZ]===void 0&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new gi(e,n.symbolInstances,n.bucketInstanceId),!0}removeBucketCrossTileIDs(e,n){for(let s of n.getCrossTileIDsLists())for(let o of s)delete this.usedCrossTileIDs[e][o]}removeStaleBuckets(e){let n=!1;for(let s in this.indexes){let o=this.indexes[s];for(let u in o)e[o[u].bucketInstanceId]||(this.removeBucketCrossTileIDs(s,o[u]),delete o[u],n=!0)}return n}}class eo{constructor(){this.layerIndexes={},this.crossTileIDs=new Wa,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,n,s){let o=this.layerIndexes[e.id];o===void 0&&(o=this.layerIndexes[e.id]=new Br);let u=!1,m={};o.handleWrapJump(s);for(let _ of n){let y=_.getBucket(e);y&&e.id===y.layerIds[0]&&(y.bucketInstanceId||(y.bucketInstanceId=++this.maxBucketInstanceId),o.addBucket(_.tileID,y,this.crossTileIDs)&&(u=!0),m[y.bucketInstanceId]=!0)}return o.removeStaleBuckets(m)&&(u=!0),u}pruneUnusedLayers(e){let n={};e.forEach(s=>{n[s]=!0});for(let s in this.layerIndexes)n[s]||delete this.layerIndexes[s]}}let Lr=(c,e)=>p.t(c,e&&e.filter(n=>n.identifier!=="source.canvas")),Bu=p.aw();class Ja extends p.E{constructor(e,n={}){super(),this._rtlPluginLoaded=()=>{for(let s in this.sourceCaches){let o=this.sourceCaches[s].getSource().type;o!=="vector"&&o!=="geojson"||this.sourceCaches[s].reload()}},this.map=e,this.dispatcher=new gt(Qe(),e._getMapId()),this.dispatcher.registerMessageHandler("GG",(s,o)=>this.getGlyphs(s,o)),this.dispatcher.registerMessageHandler("GI",(s,o)=>this.getImages(s,o)),this.imageManager=new Pe,this.imageManager.setEventedParent(this),this.glyphManager=new ht(e._requestManager,n.localIdeographFontFamily),this.lineAtlas=new Pt(256,512),this.crossTileSymbolIndex=new eo,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new p.ax,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",p.ay()),lr().on(be,this._rtlPluginLoaded),this.on("data",s=>{if(s.dataType!=="source"||s.sourceDataType!=="metadata")return;let o=this.sourceCaches[s.sourceId];if(!o)return;let u=o.getSource();if(u&&u.vectorLayerIds)for(let m in this._layers){let _=this._layers[m];_.source===u.id&&this._validateLayer(_)}})}loadURL(e,n={},s){this.fire(new p.k("dataloading",{dataType:"style"})),n.validate=typeof n.validate!="boolean"||n.validate;let o=this.map._requestManager.transformRequest(e,"Style");this._loadStyleRequest=new AbortController;let u=this._loadStyleRequest;p.h(o,this._loadStyleRequest).then(m=>{this._loadStyleRequest=null,this._load(m.data,n,s)}).catch(m=>{this._loadStyleRequest=null,m&&!u.signal.aborted&&this.fire(new p.j(m))})}loadJSON(e,n={},s){this.fire(new p.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,se.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,n.validate=n.validate!==!1,this._load(e,n,s)}).catch(()=>{})}loadEmpty(){this.fire(new p.k("dataloading",{dataType:"style"})),this._load(Bu,{validate:!1})}_load(e,n,s){var o;let u=n.transformStyle?n.transformStyle(s,e):e;if(!n.validate||!Lr(this,p.u(u))){this._loaded=!0,this.stylesheet=u;for(let m in u.sources)this.addSource(m,u.sources[m],{validate:!1});u.sprite?this._loadSprite(u.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(u.glyphs),this._createLayers(),this.light=new kt(this.stylesheet.light),this.sky=new dt(this.stylesheet.sky),this.map.setTerrain((o=this.stylesheet.terrain)!==null&&o!==void 0?o:null),this.fire(new p.k("data",{dataType:"style"})),this.fire(new p.k("style.load"))}}_createLayers(){let e=p.az(this.stylesheet.layers);this.dispatcher.broadcast("SL",e),this._order=e.map(n=>n.id),this._layers={},this._serializedLayers=null;for(let n of e){let s=p.aA(n);s.setEventedParent(this,{layer:{id:n.id}}),this._layers[n.id]=s}}_loadSprite(e,n=!1,s=void 0){let o;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(u,m,_,y){return p._(this,void 0,void 0,function*(){let b=xe(u),T=_>1?"@2x":"",C={},P={};for(let{id:L,url:O}of b){let U=m.transformRequest(Le(O,T,".json"),"SpriteJSON");C[L]=p.h(U,y);let Z=m.transformRequest(Le(O,T,".png"),"SpriteImage");P[L]=De.getImage(Z,y)}return yield Promise.all([...Object.values(C),...Object.values(P)]),function(L,O){return p._(this,void 0,void 0,function*(){let U={};for(let Z in L){U[Z]={};let G=se.getImageCanvasContext((yield O[Z]).data),W=(yield L[Z]).data;for(let N in W){let{width:Q,height:te,x:ae,y:fe,sdf:ve,pixelRatio:ke,stretchX:Oe,stretchY:Te,content:Ee,textFitWidth:$e,textFitHeight:ct}=W[N];U[Z][N]={data:null,pixelRatio:ke,sdf:ve,stretchX:Oe,stretchY:Te,content:Ee,textFitWidth:$e,textFitHeight:ct,spriteData:{width:Q,height:te,x:ae,y:fe,context:G}}}}return U})}(C,P)})}(e,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(u=>{if(this._spriteRequest=null,u)for(let m in u){this._spritesImagesIds[m]=[];let _=this._spritesImagesIds[m]?this._spritesImagesIds[m].filter(y=>!(y in u)):[];for(let y of _)this.imageManager.removeImage(y),this._changedImages[y]=!0;for(let y in u[m]){let b=m==="default"?y:`${m}:${y}`;this._spritesImagesIds[m].push(b),b in this.imageManager.images?this.imageManager.updateImage(b,u[m][y],!1):this.imageManager.addImage(b,u[m][y]),n&&(this._changedImages[b]=!0)}}}).catch(u=>{this._spriteRequest=null,o=u,this.fire(new p.j(o))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),n&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new p.k("data",{dataType:"style"})),s&&s(o)})}_unloadSprite(){for(let e of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(e),this._changedImages[e]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new p.k("data",{dataType:"style"}))}_validateLayer(e){let n=this.sourceCaches[e.source];if(!n)return;let s=e.sourceLayer;if(!s)return;let o=n.getSource();(o.type==="geojson"||o.vectorLayerIds&&o.vectorLayerIds.indexOf(s)===-1)&&this.fire(new p.j(new Error(`Source layer "${s}" does not exist on source "${o.id}" as specified by style layer "${e.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(let e in this.sourceCaches)if(!this.sourceCaches[e].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(e,n=!1){let s=this._serializedAllLayers();if(!e||e.length===0)return Object.values(n?p.aB(s):s);let o=[];for(let u of e)if(s[u]){let m=n?p.aB(s[u]):s[u];o.push(m)}return o}_serializedAllLayers(){let e=this._serializedLayers;if(e)return e;e=this._serializedLayers={};let n=Object.keys(this._layers);for(let s of n){let o=this._layers[s];o.type!=="custom"&&(e[s]=o.serialize())}return e}hasTransitions(){if(this.light&&this.light.hasTransition()||this.sky&&this.sky.hasTransition())return!0;for(let e in this.sourceCaches)if(this.sourceCaches[e].hasTransition())return!0;for(let e in this._layers)if(this._layers[e].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(e){if(!this._loaded)return;let n=this._changed;if(n){let o=Object.keys(this._updatedLayers),u=Object.keys(this._removedLayers);(o.length||u.length)&&this._updateWorkerLayers(o,u);for(let m in this._updatedSources){let _=this._updatedSources[m];if(_==="reload")this._reloadSource(m);else{if(_!=="clear")throw new Error(`Invalid action ${_}`);this._clearSource(m)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(let m in this._updatedPaintProps)this._layers[m].updateTransitions(e);this.light.updateTransitions(e),this.sky.updateTransitions(e),this._resetUpdates()}let s={};for(let o in this.sourceCaches){let u=this.sourceCaches[o];s[o]=u.used,u.used=!1}for(let o of this._order){let u=this._layers[o];u.recalculate(e,this._availableImages),!u.isHidden(e.zoom)&&u.source&&(this.sourceCaches[u.source].used=!0)}for(let o in s){let u=this.sourceCaches[o];!!s[o]!=!!u.used&&u.fire(new p.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:o}))}this.light.recalculate(e),this.sky.recalculate(e),this.z=e.zoom,n&&this.fire(new p.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){let e=Object.keys(this._changedImages);if(e.length){for(let n in this.sourceCaches)this.sourceCaches[n].reloadTilesForDependencies(["icons","patterns"],e);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(let e in this.sourceCaches)this.sourceCaches[e].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(e,n){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(e,!1),removedIds:n})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(e,n={}){var s;this._checkLoaded();let o=this.serialize();if(e=n.transformStyle?n.transformStyle(o,e):e,((s=n.validate)===null||s===void 0||s)&&Lr(this,p.u(e)))return!1;(e=p.aB(e)).layers=p.az(e.layers);let u=p.aC(o,e),m=this._getOperationsToPerform(u);if(m.unimplemented.length>0)throw new Error(`Unimplemented: ${m.unimplemented.join(", ")}.`);if(m.operations.length===0)return!1;for(let _ of m.operations)_();return this.stylesheet=e,this._serializedLayers=null,!0}_getOperationsToPerform(e){let n=[],s=[];for(let o of e)switch(o.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":n.push(()=>this.addLayer.apply(this,o.args));break;case"removeLayer":n.push(()=>this.removeLayer.apply(this,o.args));break;case"setPaintProperty":n.push(()=>this.setPaintProperty.apply(this,o.args));break;case"setLayoutProperty":n.push(()=>this.setLayoutProperty.apply(this,o.args));break;case"setFilter":n.push(()=>this.setFilter.apply(this,o.args));break;case"addSource":n.push(()=>this.addSource.apply(this,o.args));break;case"removeSource":n.push(()=>this.removeSource.apply(this,o.args));break;case"setLayerZoomRange":n.push(()=>this.setLayerZoomRange.apply(this,o.args));break;case"setLight":n.push(()=>this.setLight.apply(this,o.args));break;case"setGeoJSONSourceData":n.push(()=>this.setGeoJSONSourceData.apply(this,o.args));break;case"setGlyphs":n.push(()=>this.setGlyphs.apply(this,o.args));break;case"setSprite":n.push(()=>this.setSprite.apply(this,o.args));break;case"setSky":n.push(()=>this.setSky.apply(this,o.args));break;case"setTerrain":n.push(()=>this.map.setTerrain.apply(this,o.args));break;case"setTransition":n.push(()=>{});break;default:s.push(o.command)}return{operations:n,unimplemented:s}}addImage(e,n){if(this.getImage(e))return this.fire(new p.j(new Error(`An image named "${e}" already exists.`)));this.imageManager.addImage(e,n),this._afterImageUpdated(e)}updateImage(e,n){this.imageManager.updateImage(e,n)}getImage(e){return this.imageManager.getImage(e)}removeImage(e){if(!this.getImage(e))return this.fire(new p.j(new Error(`An image named "${e}" does not exist.`)));this.imageManager.removeImage(e),this._afterImageUpdated(e)}_afterImageUpdated(e){this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new p.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,n,s={}){if(this._checkLoaded(),this.sourceCaches[e]!==void 0)throw new Error(`Source "${e}" already exists.`);if(!n.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(n).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(n.type)>=0&&this._validate(p.u.source,`sources.${e}`,n,null,s))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);let o=this.sourceCaches[e]=new nt(e,n,this.dispatcher);o.style=this,o.setEventedParent(this,()=>({isSourceLoaded:o.loaded(),source:o.serialize(),sourceId:e})),o.onAdd(this.map),this._changed=!0}removeSource(e){if(this._checkLoaded(),this.sourceCaches[e]===void 0)throw new Error("There is no source with this ID");for(let s in this._layers)if(this._layers[s].source===e)return this.fire(new p.j(new Error(`Source "${e}" cannot be removed while layer "${s}" is using it.`)));let n=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],n.fire(new p.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),n.setEventedParent(null),n.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(e,n){if(this._checkLoaded(),this.sourceCaches[e]===void 0)throw new Error(`There is no source with this ID=${e}`);let s=this.sourceCaches[e].getSource();if(s.type!=="geojson")throw new Error(`geojsonSource.type is ${s.type}, which is !== 'geojson`);s.setData(n),this._changed=!0}getSource(e){return this.sourceCaches[e]&&this.sourceCaches[e].getSource()}addLayer(e,n,s={}){this._checkLoaded();let o=e.id;if(this.getLayer(o))return void this.fire(new p.j(new Error(`Layer "${o}" already exists on this map.`)));let u;if(e.type==="custom"){if(Lr(this,p.aD(e)))return;u=p.aA(e)}else{if("source"in e&&typeof e.source=="object"&&(this.addSource(o,e.source),e=p.aB(e),e=p.e(e,{source:o})),this._validate(p.u.layer,`layers.${o}`,e,{arrayIndex:-1},s))return;u=p.aA(e),this._validateLayer(u),u.setEventedParent(this,{layer:{id:o}})}let m=n?this._order.indexOf(n):this._order.length;if(n&&m===-1)this.fire(new p.j(new Error(`Cannot add layer "${o}" before non-existing layer "${n}".`)));else{if(this._order.splice(m,0,o),this._layerOrderChanged=!0,this._layers[o]=u,this._removedLayers[o]&&u.source&&u.type!=="custom"){let _=this._removedLayers[o];delete this._removedLayers[o],_.type!==u.type?this._updatedSources[u.source]="clear":(this._updatedSources[u.source]="reload",this.sourceCaches[u.source].pause())}this._updateLayer(u),u.onAdd&&u.onAdd(this.map)}}moveLayer(e,n){if(this._checkLoaded(),this._changed=!0,!this._layers[e])return void this.fire(new p.j(new Error(`The layer '${e}' does not exist in the map's style and cannot be moved.`)));if(e===n)return;let s=this._order.indexOf(e);this._order.splice(s,1);let o=n?this._order.indexOf(n):this._order.length;n&&o===-1?this.fire(new p.j(new Error(`Cannot move layer "${e}" before non-existing layer "${n}".`))):(this._order.splice(o,0,e),this._layerOrderChanged=!0)}removeLayer(e){this._checkLoaded();let n=this._layers[e];if(!n)return void this.fire(new p.j(new Error(`Cannot remove non-existing layer "${e}".`)));n.setEventedParent(null);let s=this._order.indexOf(e);this._order.splice(s,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=n,delete this._layers[e],this._serializedLayers&&delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],n.onRemove&&n.onRemove(this.map)}getLayer(e){return this._layers[e]}getLayersOrder(){return[...this._order]}hasLayer(e){return e in this._layers}setLayerZoomRange(e,n,s){this._checkLoaded();let o=this.getLayer(e);o?o.minzoom===n&&o.maxzoom===s||(n!=null&&(o.minzoom=n),s!=null&&(o.maxzoom=s),this._updateLayer(o)):this.fire(new p.j(new Error(`Cannot set the zoom range of non-existing layer "${e}".`)))}setFilter(e,n,s={}){this._checkLoaded();let o=this.getLayer(e);if(o){if(!p.aE(o.filter,n))return n==null?(o.filter=void 0,void this._updateLayer(o)):void(this._validate(p.u.filter,`layers.${o.id}.filter`,n,null,s)||(o.filter=p.aB(n),this._updateLayer(o)))}else this.fire(new p.j(new Error(`Cannot filter non-existing layer "${e}".`)))}getFilter(e){return p.aB(this.getLayer(e).filter)}setLayoutProperty(e,n,s,o={}){this._checkLoaded();let u=this.getLayer(e);u?p.aE(u.getLayoutProperty(n),s)||(u.setLayoutProperty(n,s,o),this._updateLayer(u)):this.fire(new p.j(new Error(`Cannot style non-existing layer "${e}".`)))}getLayoutProperty(e,n){let s=this.getLayer(e);if(s)return s.getLayoutProperty(n);this.fire(new p.j(new Error(`Cannot get style of non-existing layer "${e}".`)))}setPaintProperty(e,n,s,o={}){this._checkLoaded();let u=this.getLayer(e);u?p.aE(u.getPaintProperty(n),s)||(u.setPaintProperty(n,s,o)&&this._updateLayer(u),this._changed=!0,this._updatedPaintProps[e]=!0,this._serializedLayers=null):this.fire(new p.j(new Error(`Cannot style non-existing layer "${e}".`)))}getPaintProperty(e,n){return this.getLayer(e).getPaintProperty(n)}setFeatureState(e,n){this._checkLoaded();let s=e.source,o=e.sourceLayer,u=this.sourceCaches[s];if(u===void 0)return void this.fire(new p.j(new Error(`The source '${s}' does not exist in the map's style.`)));let m=u.getSource().type;m==="geojson"&&o?this.fire(new p.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):m!=="vector"||o?(e.id===void 0&&this.fire(new p.j(new Error("The feature id parameter must be provided."))),u.setFeatureState(o,e.id,n)):this.fire(new p.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(e,n){this._checkLoaded();let s=e.source,o=this.sourceCaches[s];if(o===void 0)return void this.fire(new p.j(new Error(`The source '${s}' does not exist in the map's style.`)));let u=o.getSource().type,m=u==="vector"?e.sourceLayer:void 0;u!=="vector"||m?n&&typeof e.id!="string"&&typeof e.id!="number"?this.fire(new p.j(new Error("A feature id is required to remove its specific state property."))):o.removeFeatureState(m,e.id,n):this.fire(new p.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(e){this._checkLoaded();let n=e.source,s=e.sourceLayer,o=this.sourceCaches[n];if(o!==void 0)return o.getSource().type!=="vector"||s?(e.id===void 0&&this.fire(new p.j(new Error("The feature id parameter must be provided."))),o.getFeatureState(s,e.id)):void this.fire(new p.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new p.j(new Error(`The source '${n}' does not exist in the map's style.`)))}getTransition(){return p.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;let e=p.aF(this.sourceCaches,u=>u.serialize()),n=this._serializeByIds(this._order,!0),s=this.map.getTerrain()||void 0,o=this.stylesheet;return p.aG({version:o.version,name:o.name,metadata:o.metadata,light:o.light,sky:o.sky,center:o.center,zoom:o.zoom,bearing:o.bearing,pitch:o.pitch,sprite:o.sprite,glyphs:o.glyphs,transition:o.transition,sources:e,layers:n,terrain:s},u=>u!==void 0)}_updateLayer(e){this._updatedLayers[e.id]=!0,e.source&&!this._updatedSources[e.source]&&this.sourceCaches[e.source].getSource().type!=="raster"&&(this._updatedSources[e.source]="reload",this.sourceCaches[e.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(e){let n=m=>this._layers[m].type==="fill-extrusion",s={},o=[];for(let m=this._order.length-1;m>=0;m--){let _=this._order[m];if(n(_)){s[_]=m;for(let y of e){let b=y[_];if(b)for(let T of b)o.push(T)}}}o.sort((m,_)=>_.intersectionZ-m.intersectionZ);let u=[];for(let m=this._order.length-1;m>=0;m--){let _=this._order[m];if(n(_))for(let y=o.length-1;y>=0;y--){let b=o[y].feature;if(s[b.layer.id]<m)break;u.push(b),o.pop()}else for(let y of e){let b=y[_];if(b)for(let T of b)u.push(T.feature)}}return u}queryRenderedFeatures(e,n,s){n&&n.filter&&this._validate(p.u.filter,"queryRenderedFeatures.filter",n.filter,null,n);let o={};if(n&&n.layers){if(!Array.isArray(n.layers))return this.fire(new p.j(new Error("parameters.layers must be an Array."))),[];for(let _ of n.layers){let y=this._layers[_];if(!y)return this.fire(new p.j(new Error(`The layer '${_}' does not exist in the map's style and cannot be queried for features.`))),[];o[y.source]=!0}}let u=[];n.availableImages=this._availableImages;let m=this._serializedAllLayers();for(let _ in this.sourceCaches)n.layers&&!o[_]||u.push(ci(this.sourceCaches[_],this._layers,m,e,n,s));return this.placement&&u.push(function(_,y,b,T,C,P,L){let O={},U=P.queryRenderedSymbols(T),Z=[];for(let G of Object.keys(U).map(Number))Z.push(L[G]);Z.sort(bi);for(let G of Z){let W=G.featureIndex.lookupSymbolFeatures(U[G.bucketInstanceId],y,G.bucketIndex,G.sourceLayerIndex,C.filter,C.layers,C.availableImages,_);for(let N in W){let Q=O[N]=O[N]||[],te=W[N];te.sort((ae,fe)=>{let ve=G.featureSortOrder;if(ve){let ke=ve.indexOf(ae.featureIndex);return ve.indexOf(fe.featureIndex)-ke}return fe.featureIndex-ae.featureIndex});for(let ae of te)Q.push(ae)}}for(let G in O)O[G].forEach(W=>{let N=W.feature,Q=b[_[G].source].getFeatureState(N.layer["source-layer"],N.id);N.source=N.layer.source,N.layer["source-layer"]&&(N.sourceLayer=N.layer["source-layer"]),N.state=Q});return O}(this._layers,m,this.sourceCaches,e,n,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(u)}querySourceFeatures(e,n){n&&n.filter&&this._validate(p.u.filter,"querySourceFeatures.filter",n.filter,null,n);let s=this.sourceCaches[e];return s?function(o,u){let m=o.getRenderableIds().map(b=>o.getTileByID(b)),_=[],y={};for(let b=0;b<m.length;b++){let T=m[b],C=T.tileID.canonical.key;y[C]||(y[C]=!0,T.querySourceFeatures(_,u))}return _}(s,n):[]}getLight(){return this.light.getLight()}setLight(e,n={}){this._checkLoaded();let s=this.light.getLight(),o=!1;for(let m in e)if(!p.aE(e[m],s[m])){o=!0;break}if(!o)return;let u={now:se.now(),transition:p.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,n),this.light.updateTransitions(u)}getSky(){var e;return(e=this.stylesheet)===null||e===void 0?void 0:e.sky}setSky(e,n={}){let s=this.getSky(),o=!1;if(!e&&!s)return;if(e&&!s)o=!0;else if(!e&&s)o=!0;else for(let m in e)if(!p.aE(e[m],s[m])){o=!0;break}if(!o)return;let u={now:se.now(),transition:p.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=e,this.sky.setSky(e,n),this.sky.updateTransitions(u)}_validate(e,n,s,o,u={}){return(!u||u.validate!==!1)&&Lr(this,e.call(p.u,p.e({key:n,style:this.serialize(),value:s,styleSpec:p.v},o)))}_remove(e=!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),lr().off(be,this._rtlPluginLoaded);for(let n in this._layers)this._layers[n].setEventedParent(null);for(let n in this.sourceCaches){let s=this.sourceCaches[n];s.setEventedParent(null),s.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),e&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(e)}_clearSource(e){this.sourceCaches[e].clearTiles()}_reloadSource(e){this.sourceCaches[e].resume(),this.sourceCaches[e].reload()}_updateSources(e){for(let n in this.sourceCaches)this.sourceCaches[n].update(e,this.map.terrain)}_generateCollisionBoxes(){for(let e in this.sourceCaches)this._reloadSource(e)}_updatePlacement(e,n,s,o,u=!1){let m=!1,_=!1,y={};for(let b of this._order){let T=this._layers[b];if(T.type!=="symbol")continue;if(!y[T.source]){let P=this.sourceCaches[T.source];y[T.source]=P.getRenderableIds(!0).map(L=>P.getTileByID(L)).sort((L,O)=>O.tileID.overscaledZ-L.tileID.overscaledZ||(L.tileID.isLessThan(O.tileID)?-1:1))}let C=this.crossTileSymbolIndex.addLayer(T,y[T.source],e.center.lng);m=m||C}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((u=u||this._layerOrderChanged||s===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(se.now(),e.zoom))&&(this.pauseablePlacement=new wa(e,this.map.terrain,this._order,u,n,s,o,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,y),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(se.now()),_=!0),m&&this.pauseablePlacement.placement.setStale()),_||m)for(let b of this._order){let T=this._layers[b];T.type==="symbol"&&this.placement.updateLayerOpacities(T,y[T.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(se.now())}_releaseSymbolFadeTiles(){for(let e in this.sourceCaches)this.sourceCaches[e].releaseSymbolFadeTiles()}getImages(e,n){return p._(this,void 0,void 0,function*(){let s=yield this.imageManager.getImages(n.icons);this._updateTilesForChangedImages();let o=this.sourceCaches[n.source];return o&&o.setDependencies(n.tileID.key,n.type,n.icons),s})}getGlyphs(e,n){return p._(this,void 0,void 0,function*(){let s=yield this.glyphManager.getGlyphs(n.stacks),o=this.sourceCaches[n.source];return o&&o.setDependencies(n.tileID.key,n.type,[""]),s})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(e,n={}){this._checkLoaded(),e&&this._validate(p.u.glyphs,"glyphs",e,null,n)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=e,this.glyphManager.entries={},this.glyphManager.setURL(e))}addSprite(e,n,s={},o){this._checkLoaded();let u=[{id:e,url:n}],m=[...xe(this.stylesheet.sprite),...u];this._validate(p.u.sprite,"sprite",m,null,s)||(this.stylesheet.sprite=m,this._loadSprite(u,!0,o))}removeSprite(e){this._checkLoaded();let n=xe(this.stylesheet.sprite);if(n.find(s=>s.id===e)){if(this._spritesImagesIds[e])for(let s of this._spritesImagesIds[e])this.imageManager.removeImage(s),this._changedImages[s]=!0;n.splice(n.findIndex(s=>s.id===e),1),this.stylesheet.sprite=n.length>0?n:void 0,delete this._spritesImagesIds[e],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new p.k("data",{dataType:"style"}))}else this.fire(new p.j(new Error(`Sprite "${e}" doesn't exists on this map.`)))}getSprite(){return xe(this.stylesheet.sprite)}setSprite(e,n={},s){this._checkLoaded(),e&&this._validate(p.u.sprite,"sprite",e,null,n)||(this.stylesheet.sprite=e,e?this._loadSprite(e,!0,s):(this._unloadSprite(),s&&s(null)))}}var xn=p.Y([{name:"a_pos",type:"Int16",components:2}]);let ln={prelude:Ot(`#ifdef GL_ES
precision mediump float;
#else
#if !defined(lowp)
#define lowp
#endif
#if !defined(mediump)
#define mediump
#endif
#if !defined(highp)
#define highp
#endif
#endif
`,`#ifdef GL_ES
precision highp float;
#else
#if !defined(lowp)
#define lowp
#endif
#if !defined(mediump)
#define mediump
#endif
#if !defined(highp)
#define highp
#endif
#endif
vec2 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
);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}
#ifdef TERRAIN3D
uniform 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;
#endif
const 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) {
#ifdef TERRAIN3D
highp float d=unpack(texture2D(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));
#else
return 1.0;
#endif
}float calculate_visibility(vec4 pos) {
#ifdef TERRAIN3D
vec3 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;
#else
return 1.0;
#endif
}float ele(vec2 pos) {
#ifdef TERRAIN3D
vec4 rgb=(texture2D(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;
#else
return 0.0;
#endif
}float get_elevation(vec2 pos) {
#ifdef TERRAIN3D
vec2 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;
#else
return 0.0;
#endif
}`),background:Ot(`uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,"attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),backgroundPattern:Ot(`uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,"uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:Ot(`varying vec3 v_data;varying float v_visibility;
#pragma mapbox: define highp vec4 color
#pragma mapbox: define mediump float radius
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
#pragma mapbox: define highp vec4 stroke_color
#pragma mapbox: define mediump float stroke_width
#pragma mapbox: define lowp float stroke_opacity
void main() {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize mediump float radius
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize highp vec4 stroke_color
#pragma mapbox: initialize mediump float stroke_width
#pragma mapbox: initialize lowp float stroke_opacity
vec2 extrude=v_data.xy;float extrude_length=length(extrude);float antialiased_blur=v_data.z;float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,`uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;varying float v_visibility;
#pragma mapbox: define highp vec4 color
#pragma mapbox: define mediump float radius
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
#pragma mapbox: define highp vec4 stroke_color
#pragma mapbox: define mediump float stroke_width
#pragma mapbox: define lowp float stroke_opacity
void main(void) {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize mediump float radius
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize highp vec4 stroke_color
#pragma mapbox: initialize mediump float stroke_width
#pragma mapbox: initialize lowp float stroke_opacity
vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}float antialiasblur=-max(1.0/u_device_pixel_ratio/(radius+stroke_width),blur);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`),clippingMask:Ot("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:Ot(`uniform highp float u_intensity;varying vec2 v_extrude;
#pragma mapbox: define highp float weight
#define GAUSS_COEF 0.3989422804014327
void main() {
#pragma mapbox: initialize highp float weight
float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,`uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude;
#pragma mapbox: define highp float weight
#pragma mapbox: define mediump float radius
const highp float ZERO=1.0/255.0/16.0;
#define GAUSS_COEF 0.3989422804014327
void main(void) {
#pragma mapbox: initialize highp float weight
#pragma mapbox: initialize mediump float radius
vec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,get_elevation(floor(a_pos*0.5)),1);gl_Position=u_matrix*pos;}`),heatmapTexture:Ot(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(0.0);
#endif
}`,"uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:Ot("varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}","attribute vec2 a_anchor_pos;attribute vec2 a_placed;attribute vec2 a_box_real;uniform mat4 u_matrix;uniform vec2 u_pixel_extrude_scale;varying float v_placed;varying float v_notUsed;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:Ot("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:Ot("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,get_elevation(a_pos),1);}"),fill:Ot(`#pragma mapbox: define highp vec4 color
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize lowp float opacity
gl_FragColor=color*opacity;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,`attribute vec2 a_pos;uniform mat4 u_matrix;
#pragma mapbox: define highp vec4 color
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize lowp float opacity
gl_Position=u_matrix*vec4(a_pos,0,1);}`),fillOutline:Ot(`varying vec2 v_pos;
#pragma mapbox: define highp vec4 outline_color
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize highp vec4 outline_color
#pragma mapbox: initialize lowp float opacity
float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,`attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;
#pragma mapbox: define highp vec4 outline_color
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize highp vec4 outline_color
#pragma mapbox: initialize lowp float opacity
gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillOutlinePattern:Ot(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp vec4 pattern_from
#pragma mapbox: define lowp vec4 pattern_to
void main() {
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump vec4 pattern_from
#pragma mapbox: initialize mediump vec4 pattern_to
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,`uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp vec4 pattern_from
#pragma mapbox: define lowp vec4 pattern_to
#pragma mapbox: define lowp float pixel_ratio_from
#pragma mapbox: define lowp float pixel_ratio_to
void main() {
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump vec4 pattern_from
#pragma mapbox: initialize mediump vec4 pattern_to
#pragma mapbox: initialize lowp float pixel_ratio_from
#pragma mapbox: initialize lowp float pixel_ratio_to
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillPattern:Ot(`#ifdef GL_ES
precision highp float;
#endif
uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp vec4 pattern_from
#pragma mapbox: define lowp vec4 pattern_to
void main() {
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump vec4 pattern_from
#pragma mapbox: initialize mediump vec4 pattern_to
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp vec4 pattern_from
#pragma mapbox: define lowp vec4 pattern_to
#pragma mapbox: define lowp float pixel_ratio_from
#pragma mapbox: define lowp float pixel_ratio_to
void main() {
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump vec4 pattern_from
#pragma mapbox: initialize mediump vec4 pattern_to
#pragma mapbox: initialize lowp float pixel_ratio_from
#pragma mapbox: initialize lowp float pixel_ratio_to
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}`),fillExtrusion:Ot(`varying vec4 v_color;void main() {gl_FragColor=v_color;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,`uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed;
#ifdef TERRAIN3D
attribute vec2 a_centroid;
#endif
varying vec4 v_color;
#pragma mapbox: define highp float base
#pragma mapbox: define highp float height
#pragma mapbox: define highp vec4 color
void main() {
#pragma mapbox: initialize highp float base
#pragma mapbox: initialize highp float height
#pragma mapbox: initialize highp vec4 color
vec3 normal=a_normal_ed.xyz;
#ifdef TERRAIN3D
float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
#else
float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
#endif
base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}`),fillExtrusionPattern:Ot(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;
#pragma mapbox: define lowp float base
#pragma mapbox: define lowp float height
#pragma mapbox: define lowp vec4 pattern_from
#pragma mapbox: define lowp vec4 pattern_to
#pragma mapbox: define lowp float pixel_ratio_from
#pragma mapbox: define lowp float pixel_ratio_to
void main() {
#pragma mapbox: initialize lowp float base
#pragma mapbox: initialize lowp float height
#pragma mapbox: initialize mediump vec4 pattern_from
#pragma mapbox: initialize mediump vec4 pattern_to
#pragma mapbox: initialize lowp float pixel_ratio_from
#pragma mapbox: initialize lowp float pixel_ratio_to
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;
#ifdef TERRAIN3D
attribute vec2 a_centroid;
#endif
varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;
#pragma mapbox: define lowp float base
#pragma mapbox: define lowp float height
#pragma mapbox: define lowp vec4 pattern_from
#pragma mapbox: define lowp vec4 pattern_to
#pragma mapbox: define lowp float pixel_ratio_from
#pragma mapbox: define lowp float pixel_ratio_to
void main() {
#pragma mapbox: initialize lowp float base
#pragma mapbox: initialize lowp float height
#pragma mapbox: initialize mediump vec4 pattern_from
#pragma mapbox: initialize mediump vec4 pattern_to
#pragma mapbox: initialize lowp float pixel_ratio_from
#pragma mapbox: initialize lowp float pixel_ratio_to
vec2 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;
#ifdef TERRAIN3D
float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
#else
float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
#endif
base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0
? a_pos
: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}`),hillshadePrepare:Ot(`#ifdef GL_ES
precision highp float;
#endif
uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,"uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:Ot(`uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;
#define PI 3.141592653589793
void main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,"uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"),line:Ot(`uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;
#pragma mapbox: define highp vec4 color
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
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);gl_FragColor=color*(alpha*opacity);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,`
#define scale 0.015873016
attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;
#pragma mapbox: define highp vec4 color
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
#pragma mapbox: define mediump float gapwidth
#pragma mapbox: define lowp float offset
#pragma mapbox: define mediump float width
void main() {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump float gapwidth
#pragma mapbox: initialize lowp float offset
#pragma mapbox: initialize mediump float width
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;
#ifdef TERRAIN3D
v_gamma_scale=1.0;
#else
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
#endif
v_width2=vec2(outset,inset);}`),lineGradient:Ot(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
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);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,`
#define scale 0.015873016
attribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv;
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
#pragma mapbox: define mediump float gapwidth
#pragma mapbox: define lowp float offset
#pragma mapbox: define mediump float width
void main() {
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump float gapwidth
#pragma mapbox: initialize lowp float offset
#pragma mapbox: initialize mediump float width
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;
#ifdef TERRAIN3D
v_gamma_scale=1.0;
#else
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
#endif
v_width2=vec2(outset,inset);}`),linePattern:Ot(`#ifdef GL_ES
precision highp float;
#endif
uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;
#pragma mapbox: define lowp vec4 pattern_from
#pragma mapbox: define lowp vec4 pattern_to
#pragma mapbox: define lowp float pixel_ratio_from
#pragma mapbox: define lowp float pixel_ratio_to
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize mediump vec4 pattern_from
#pragma mapbox: initialize mediump vec4 pattern_to
#pragma mapbox: initialize lowp float pixel_ratio_from
#pragma mapbox: initialize lowp float pixel_ratio_to
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,`
#define scale 0.015873016
#define LINE_DISTANCE_SCALE 2.0
attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp float offset
#pragma mapbox: define mediump float gapwidth
#pragma mapbox: define mediump float width
#pragma mapbox: define lowp float floorwidth
#pragma mapbox: define lowp vec4 pattern_from
#pragma mapbox: define lowp vec4 pattern_to
#pragma mapbox: define lowp float pixel_ratio_from
#pragma mapbox: define lowp float pixel_ratio_to
void main() {
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize lowp float offset
#pragma mapbox: initialize mediump float gapwidth
#pragma mapbox: initialize mediump float width
#pragma mapbox: initialize lowp float floorwidth
#pragma mapbox: initialize mediump vec4 pattern_from
#pragma mapbox: initialize mediump vec4 pattern_to
#pragma mapbox: initialize lowp float pixel_ratio_from
#pragma mapbox: initialize lowp float pixel_ratio_to
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;
#ifdef TERRAIN3D
v_gamma_scale=1.0;
#else
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
#endif
v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:Ot(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;
#pragma mapbox: define highp vec4 color
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
#pragma mapbox: define mediump float width
#pragma mapbox: define lowp float floorwidth
void main() {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump float width
#pragma mapbox: initialize lowp float floorwidth
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 sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,`
#define scale 0.015873016
#define LINE_DISTANCE_SCALE 2.0
attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;
#pragma mapbox: define highp vec4 color
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
#pragma mapbox: define mediump float gapwidth
#pragma mapbox: define lowp float offset
#pragma mapbox: define mediump float width
#pragma mapbox: define lowp float floorwidth
void main() {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump float gapwidth
#pragma mapbox: initialize lowp float offset
#pragma mapbox: initialize mediump float width
#pragma mapbox: initialize lowp float floorwidth
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;
#ifdef TERRAIN3D
v_gamma_scale=1.0;
#else
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
#endif
v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}`),raster:Ot(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,"uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),symbolIcon:Ot(`uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize lowp float opacity
lowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,`attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;varying vec2 v_tex;varying float v_fade_opacity;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize lowp float opacity
vec2 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 ?
camera_to_anchor_distance/u_camera_to_center_distance :
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}`),symbolSDF:Ot(`#define SDF_PX 8.0
uniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;
#pragma mapbox: define highp vec4 fill_color
#pragma mapbox: define highp vec4 halo_color
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp float halo_width
#pragma mapbox: define lowp float halo_blur
void main() {
#pragma mapbox: initialize highp vec4 fill_color
#pragma mapbox: initialize highp vec4 halo_color
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize lowp float halo_width
#pragma mapbox: initialize lowp float halo_blur
float EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);if (u_is_halo) {lowp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha=min(smoothstep(halo_edge-gamma_scaled,halo_edge+gamma_scaled,dist),1.0-alpha);}gl_FragColor=color*(alpha*opacity*fade_opacity);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,`attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_translation;uniform float u_pitched_scale;varying vec2 v_data0;varying vec3 v_data1;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}
#pragma mapbox: define highp vec4 fill_color
#pragma mapbox: define highp vec4 halo_color
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp float halo_width
#pragma mapbox: define lowp float halo_blur
void main() {
#pragma mapbox: initialize highp vec4 fill_color
#pragma mapbox: initialize highp vec4 halo_color
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize lowp float halo_width
#pragma mapbox: initialize lowp float halo_blur
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
camera_to_anchor_distance/u_camera_to_center_distance :
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}`),symbolTextAndIcon:Ot(`#define SDF_PX 8.0
#define SDF 1.0
#define ICON 0.0
uniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;
#pragma mapbox: define highp vec4 fill_color
#pragma mapbox: define highp vec4 halo_color
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp float halo_width
#pragma mapbox: define lowp float halo_blur
void main() {
#pragma mapbox: initialize highp vec4 fill_color
#pragma mapbox: initialize highp vec4 halo_color
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize lowp float halo_width
#pragma mapbox: initialize lowp float halo_blur
float fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
return;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,`attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;varying vec4 v_data0;varying vec4 v_data1;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}
#pragma mapbox: define highp vec4 fill_color
#pragma mapbox: define highp vec4 halo_color
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp float halo_width
#pragma mapbox: define lowp float halo_blur
void main() {
#pragma mapbox: initialize highp vec4 fill_color
#pragma mapbox: initialize highp vec4 halo_color
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize lowp float halo_width
#pragma mapbox: initialize lowp float halo_blur
vec2 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 ?
camera_to_anchor_distance/u_camera_to_center_distance :
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`),terrain:Ot("uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;varying vec2 v_texture_pos;varying float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture2D(u_texture,v_texture_pos);if (v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);gl_FragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {gl_FragColor=surface_color;}}","attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform mat4 u_fog_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}"),terrainDepth:Ot("varying float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {gl_FragColor=pack(v_depth);}","attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}"),terrainCoords:Ot("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}","attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);}"),sky:Ot("uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform float u_horizon;uniform float u_sky_horizon_blend;void main() {float y=gl_FragCoord.y;if (y > u_horizon) {float blend=y-u_horizon;if (blend < u_sky_horizon_blend) {gl_FragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {gl_FragColor=u_sky_color;}}}","attribute vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}")};function Ot(c,e){let n=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,s=e.match(/attribute ([\w]+) ([\w]+)/g),o=c.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),u=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),m=u?u.concat(o):o,_={};return{fragmentSource:c=c.replace(n,(y,b,T,C,P)=>(_[P]=!0,b==="define"?`
#ifndef HAS_UNIFORM_u_${P}
varying ${T} ${C} ${P};
#else
uniform ${T} ${C} u_${P};
#endif
`:`
#ifdef HAS_UNIFORM_u_${P}
${T} ${C} ${P} = u_${P};
#endif
`)),vertexSource:e=e.replace(n,(y,b,T,C,P)=>{let L=C==="float"?"vec2":"vec4",O=P.match(/color/)?"color":L;return _[P]?b==="define"?`
#ifndef HAS_UNIFORM_u_${P}
uniform lowp float u_${P}_t;
attribute ${T} ${L} a_${P};
varying ${T} ${C} ${P};
#else
uniform ${T} ${C} u_${P};
#endif
`:O==="vec4"?`
#ifndef HAS_UNIFORM_u_${P}
${P} = a_${P};
#else
${T} ${C} ${P} = u_${P};
#endif
`:`
#ifndef HAS_UNIFORM_u_${P}
${P} = unpack_mix_${O}(a_${P}, u_${P}_t);
#else
${T} ${C} ${P} = u_${P};
#endif
`:b==="define"?`
#ifndef HAS_UNIFORM_u_${P}
uniform lowp float u_${P}_t;
attribute ${T} ${L} a_${P};
#else
uniform ${T} ${C} u_${P};
#endif
`:O==="vec4"?`
#ifndef HAS_UNIFORM_u_${P}
${T} ${C} ${P} = a_${P};
#else
${T} ${C} ${P} = u_${P};
#endif
`:`
#ifndef HAS_UNIFORM_u_${P}
${T} ${C} ${P} = unpack_mix_${O}(a_${P}, u_${P}_t);
#else
${T} ${C} ${P} = u_${P};
#endif
`}),staticAttributes:s,staticUniforms:m}}class to{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(e,n,s,o,u,m,_,y,b){this.context=e;let T=this.boundPaintVertexBuffers.length!==o.length;for(let C=0;!T&&C<o.length;C++)this.boundPaintVertexBuffers[C]!==o[C]&&(T=!0);!this.vao||this.boundProgram!==n||this.boundLayoutVertexBuffer!==s||T||this.boundIndexBuffer!==u||this.boundVertexOffset!==m||this.boundDynamicVertexBuffer!==_||this.boundDynamicVertexBuffer2!==y||this.boundDynamicVertexBuffer3!==b?this.freshBind(n,s,o,u,m,_,y,b):(e.bindVertexArray.set(this.vao),_&&_.bind(),u&&u.dynamicDraw&&u.bind(),y&&y.bind(),b&&b.bind())}freshBind(e,n,s,o,u,m,_,y){let b=e.numAttributes,T=this.context,C=T.gl;this.vao&&this.destroy(),this.vao=T.createVertexArray(),T.bindVertexArray.set(this.vao),this.boundProgram=e,this.boundLayoutVertexBuffer=n,this.boundPaintVertexBuffers=s,this.boundIndexBuffer=o,this.boundVertexOffset=u,this.boundDynamicVertexBuffer=m,this.boundDynamicVertexBuffer2=_,this.boundDynamicVertexBuffer3=y,n.enableAttributes(C,e);for(let P of s)P.enableAttributes(C,e);m&&m.enableAttributes(C,e),_&&_.enableAttributes(C,e),y&&y.enableAttributes(C,e),n.bind(),n.setVertexAttribPointers(C,e,u);for(let P of s)P.bind(),P.setVertexAttribPointers(C,e,u);m&&(m.bind(),m.setVertexAttribPointers(C,e,u)),o&&o.bind(),_&&(_.bind(),_.setVertexAttribPointers(C,e,u)),y&&(y.bind(),y.setVertexAttribPointers(C,e,u)),T.currentNumAttributes=b}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}let io=(c,e,n,s,o)=>({u_matrix:c,u_texture:0,u_ele_delta:e,u_fog_matrix:n,u_fog_color:s?s.properties.get("fog-color"):p.aM.white,u_fog_ground_blend:s?s.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:s?s.calculateFogBlendOpacity(o):0,u_horizon_color:s?s.properties.get("horizon-color"):p.aM.white,u_horizon_fog_blend:s?s.properties.get("horizon-fog-blend"):1});function Un(c){let e=[];for(let n=0;n<c.length;n++){if(c[n]===null)continue;let s=c[n].split(" ");e.push(s.pop())}return e}class ro{constructor(e,n,s,o,u,m){let _=e.gl;this.program=_.createProgram();let y=Un(n.staticAttributes),b=s?s.getBinderAttributes():[],T=y.concat(b),C=ln.prelude.staticUniforms?Un(ln.prelude.staticUniforms):[],P=n.staticUniforms?Un(n.staticUniforms):[],L=s?s.getBinderUniforms():[],O=C.concat(P).concat(L),U=[];for(let ae of O)U.indexOf(ae)<0&&U.push(ae);let Z=s?s.defines():[];u&&Z.push("#define OVERDRAW_INSPECTOR;"),m&&Z.push("#define TERRAIN3D;");let G=Z.concat(ln.prelude.fragmentSource,n.fragmentSource).join(`
`),W=Z.concat(ln.prelude.vertexSource,n.vertexSource).join(`
`),N=_.createShader(_.FRAGMENT_SHADER);if(_.isContextLost())return void(this.failedToCreate=!0);if(_.shaderSource(N,G),_.compileShader(N),!_.getShaderParameter(N,_.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${_.getShaderInfoLog(N)}`);_.attachShader(this.program,N);let Q=_.createShader(_.VERTEX_SHADER);if(_.isContextLost())return void(this.failedToCreate=!0);if(_.shaderSource(Q,W),_.compileShader(Q),!_.getShaderParameter(Q,_.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${_.getShaderInfoLog(Q)}`);_.attachShader(this.program,Q),this.attributes={};let te={};this.numAttributes=T.length;for(let ae=0;ae<this.numAttributes;ae++)T[ae]&&(_.bindAttribLocation(this.program,ae,T[ae]),this.attributes[T[ae]]=ae);if(_.linkProgram(this.program),!_.getProgramParameter(this.program,_.LINK_STATUS))throw new Error(`Program failed to link: ${_.getProgramInfoLog(this.program)}`);_.deleteShader(Q),_.deleteShader(N);for(let ae=0;ae<U.length;ae++){let fe=U[ae];if(fe&&!te[fe]){let ve=_.getUniformLocation(this.program,fe);ve&&(te[fe]=ve)}}this.fixedUniforms=o(e,te),this.terrainUniforms=((ae,fe)=>({u_depth:new p.aH(ae,fe.u_depth),u_terrain:new p.aH(ae,fe.u_terrain),u_terrain_dim:new p.aI(ae,fe.u_terrain_dim),u_terrain_matrix:new p.aJ(ae,fe.u_terrain_matrix),u_terrain_unpack:new p.aK(ae,fe.u_terrain_unpack),u_terrain_exaggeration:new p.aI(ae,fe.u_terrain_exaggeration)}))(e,te),this.binderUniforms=s?s.getUniforms(e,te):[]}draw(e,n,s,o,u,m,_,y,b,T,C,P,L,O,U,Z,G,W){let N=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.setDepthMode(s),e.setStencilMode(o),e.setColorMode(u),e.setCullFace(m),y){e.activeTexture.set(N.TEXTURE2),N.bindTexture(N.TEXTURE_2D,y.depthTexture),e.activeTexture.set(N.TEXTURE3),N.bindTexture(N.TEXTURE_2D,y.texture);for(let te in this.terrainUniforms)this.terrainUniforms[te].set(y[te])}for(let te in this.fixedUniforms)this.fixedUniforms[te].set(_[te]);U&&U.setUniforms(e,this.binderUniforms,L,{zoom:O});let Q=0;switch(n){case N.LINES:Q=2;break;case N.TRIANGLES:Q=3;break;case N.LINE_STRIP:Q=1}for(let te of P.get()){let ae=te.vaos||(te.vaos={});(ae[b]||(ae[b]=new to)).bind(e,this,T,U?U.getPaintVertexBuffers():[],C,te.vertexOffset,Z,G,W),N.drawElements(n,te.primitiveLength*Q,N.UNSIGNED_SHORT,te.primitiveOffset*Q*2)}}}function Ka(c,e,n){let s=1/Tt(n,1,e.transform.tileZoom),o=Math.pow(2,n.tileID.overscaledZ),u=n.tileSize*Math.pow(2,e.transform.tileZoom)/o,m=u*(n.tileID.canonical.x+n.tileID.wrap*o),_=u*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture.size,u_scale:[s,c.fromScale,c.toScale],u_fade:c.t,u_pixel_coord_upper:[m>>16,_>>16],u_pixel_coord_lower:[65535&m,65535&_]}}let Aa=(c,e,n,s)=>{let o=e.style.light,u=o.properties.get("position"),m=[u.x,u.y,u.z],_=function(){var b=new p.A(9);return p.A!=Float32Array&&(b[1]=0,b[2]=0,b[3]=0,b[5]=0,b[6]=0,b[7]=0),b[0]=1,b[4]=1,b[8]=1,b}();o.properties.get("anchor")==="viewport"&&function(b,T){var C=Math.sin(T),P=Math.cos(T);b[0]=P,b[1]=C,b[2]=0,b[3]=-C,b[4]=P,b[5]=0,b[6]=0,b[7]=0,b[8]=1}(_,-e.transform.angle),function(b,T,C){var P=T[0],L=T[1],O=T[2];b[0]=P*C[0]+L*C[3]+O*C[6],b[1]=P*C[1]+L*C[4]+O*C[7],b[2]=P*C[2]+L*C[5]+O*C[8]}(m,m,_);let y=o.properties.get("color");return{u_matrix:c,u_lightpos:m,u_lightintensity:o.properties.get("intensity"),u_lightcolor:[y.r,y.g,y.b],u_vertical_gradient:+n,u_opacity:s}},Ya=(c,e,n,s,o,u,m)=>p.e(Aa(c,e,n,s),Ka(u,e,m),{u_height_factor:-Math.pow(2,o.overscaledZ)/m.tileSize/8}),jn=c=>({u_matrix:c}),vl=(c,e,n,s)=>p.e(jn(c),Ka(n,e,s)),Lu=(c,e)=>({u_matrix:c,u_world:e}),xl=(c,e,n,s,o)=>p.e(vl(c,e,n,s),{u_world:o}),Ru=(c,e,n,s)=>{let o=c.transform,u,m;if(s.paint.get("circle-pitch-alignment")==="map"){let _=Tt(n,1,o.zoom);u=!0,m=[_,_]}else u=!1,m=o.pixelsToGLUnits;return{u_camera_to_center_distance:o.cameraToCenterDistance,u_scale_with_map:+(s.paint.get("circle-pitch-scale")==="map"),u_matrix:c.translatePosMatrix(e.posMatrix,n,s.paint.get("circle-translate"),s.paint.get("circle-translate-anchor")),u_pitch_with_map:+u,u_device_pixel_ratio:c.pixelRatio,u_extrude_scale:m}},bn=(c,e,n)=>({u_matrix:c,u_inv_matrix:e,u_camera_to_center_distance:n.cameraToCenterDistance,u_viewport_size:[n.width,n.height]}),Ea=(c,e,n=1)=>({u_matrix:c,u_color:e,u_overlay:0,u_overlay_scale:n}),Yi=c=>({u_matrix:c}),Qi=(c,e,n,s)=>({u_matrix:c,u_extrude_scale:Tt(e,1,n),u_intensity:s}),Qa=(c,e,n,s)=>{let o=p.H();p.aP(o,0,c.width,c.height,0,0,1);let u=c.context.gl;return{u_matrix:o,u_world:[u.drawingBufferWidth,u.drawingBufferHeight],u_image:n,u_color_ramp:s,u_opacity:e.paint.get("heatmap-opacity")}};function es(c,e){let n=Math.pow(2,e.canonical.z),s=e.canonical.y;return[new p.Z(0,s/n).toLngLat().lat,new p.Z(0,(s+1)/n).toLngLat().lat]}let ts=(c,e,n,s)=>{let o=c.transform;return{u_matrix:Al(c,e,n,s),u_ratio:1/Tt(e,1,o.zoom),u_device_pixel_ratio:c.pixelRatio,u_units_to_pixels:[1/o.pixelsToGLUnits[0],1/o.pixelsToGLUnits[1]]}},bl=(c,e,n,s,o)=>p.e(ts(c,e,n,o),{u_image:0,u_image_height:s}),$n=(c,e,n,s,o)=>{let u=c.transform,m=wl(e,u);return{u_matrix:Al(c,e,n,o),u_texsize:e.imageAtlasTexture.size,u_ratio:1/Tt(e,1,u.zoom),u_device_pixel_ratio:c.pixelRatio,u_image:0,u_scale:[m,s.fromScale,s.toScale],u_fade:s.t,u_units_to_pixels:[1/u.pixelsToGLUnits[0],1/u.pixelsToGLUnits[1]]}},Fu=(c,e,n,s,o,u)=>{let m=c.lineAtlas,_=wl(e,c.transform),y=n.layout.get("line-cap")==="round",b=m.getDash(s.from,y),T=m.getDash(s.to,y),C=b.width*o.fromScale,P=T.width*o.toScale;return p.e(ts(c,e,n,u),{u_patternscale_a:[_/C,-b.height/2],u_patternscale_b:[_/P,-T.height/2],u_sdfgamma:m.width/(256*Math.min(C,P)*c.pixelRatio)/2,u_image:0,u_tex_y_a:b.y,u_tex_y_b:T.y,u_mix:o.t})};function wl(c,e){return 1/Tt(c,1,e.tileZoom)}function Al(c,e,n,s){return c.translatePosMatrix(s?s.posMatrix:e.tileID.posMatrix,e,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}let Ou=(c,e,n,s,o)=>{return{u_matrix:c,u_tl_parent:e,u_scale_parent:n,u_buffer_scale:1,u_fade_t:s.mix,u_opacity:s.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:(m=o.paint.get("raster-saturation"),m>0?1-1/(1.001-m):-m),u_contrast_factor:(u=o.paint.get("raster-contrast"),u>0?1/(1-u):1+u),u_spin_weights:Nu(o.paint.get("raster-hue-rotate"))};var u,m};function Nu(c){c*=Math.PI/180;let e=Math.sin(c),n=Math.cos(c);return[(2*n+1)/3,(-Math.sqrt(3)*e-n+1)/3,(Math.sqrt(3)*e-n+1)/3]}let El=(c,e,n,s,o,u,m,_,y,b,T,C,P,L)=>{let O=m.transform;return{u_is_size_zoom_constant:+(c==="constant"||c==="source"),u_is_size_feature_constant:+(c==="constant"||c==="camera"),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:O.cameraToCenterDistance,u_pitch:O.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:O.width/O.height,u_fade_change:m.options.fadeDuration?m.symbolFadeChange:1,u_matrix:_,u_label_plane_matrix:y,u_coord_matrix:b,u_is_text:+C,u_pitch_with_map:+s,u_is_along_line:o,u_is_variable_anchor:u,u_texsize:P,u_texture:0,u_translation:T,u_pitched_scale:L}},Ta=(c,e,n,s,o,u,m,_,y,b,T,C,P,L,O)=>{let U=m.transform;return p.e(El(c,e,n,s,o,u,m,_,y,b,T,C,P,O),{u_gamma_scale:s?Math.cos(U._pitch)*U.cameraToCenterDistance:1,u_device_pixel_ratio:m.pixelRatio,u_is_halo:+L})},no=(c,e,n,s,o,u,m,_,y,b,T,C,P,L)=>p.e(Ta(c,e,n,s,o,u,m,_,y,b,T,!0,C,!0,L),{u_texsize_icon:P,u_texture_icon:1}),is=(c,e,n)=>({u_matrix:c,u_opacity:e,u_color:n}),ao=(c,e,n,s,o,u)=>p.e(function(m,_,y,b){let T=y.imageManager.getPattern(m.from.toString()),C=y.imageManager.getPattern(m.to.toString()),{width:P,height:L}=y.imageManager.getPixelSize(),O=Math.pow(2,b.tileID.overscaledZ),U=b.tileSize*Math.pow(2,y.transform.tileZoom)/O,Z=U*(b.tileID.canonical.x+b.tileID.wrap*O),G=U*b.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:T.tl,u_pattern_br_a:T.br,u_pattern_tl_b:C.tl,u_pattern_br_b:C.br,u_texsize:[P,L],u_mix:_.t,u_pattern_size_a:T.displaySize,u_pattern_size_b:C.displaySize,u_scale_a:_.fromScale,u_scale_b:_.toScale,u_tile_units_to_pixels:1/Tt(b,1,y.transform.tileZoom),u_pixel_coord_upper:[Z>>16,G>>16],u_pixel_coord_lower:[65535&Z,65535&G]}}(s,u,n,o),{u_matrix:c,u_opacity:e}),so={fillExtrusion:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix),u_lightpos:new p.aN(c,e.u_lightpos),u_lightintensity:new p.aI(c,e.u_lightintensity),u_lightcolor:new p.aN(c,e.u_lightcolor),u_vertical_gradient:new p.aI(c,e.u_vertical_gradient),u_opacity:new p.aI(c,e.u_opacity)}),fillExtrusionPattern:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix),u_lightpos:new p.aN(c,e.u_lightpos),u_lightintensity:new p.aI(c,e.u_lightintensity),u_lightcolor:new p.aN(c,e.u_lightcolor),u_vertical_gradient:new p.aI(c,e.u_vertical_gradient),u_height_factor:new p.aI(c,e.u_height_factor),u_image:new p.aH(c,e.u_image),u_texsize:new p.aO(c,e.u_texsize),u_pixel_coord_upper:new p.aO(c,e.u_pixel_coord_upper),u_pixel_coord_lower:new p.aO(c,e.u_pixel_coord_lower),u_scale:new p.aN(c,e.u_scale),u_fade:new p.aI(c,e.u_fade),u_opacity:new p.aI(c,e.u_opacity)}),fill:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix)}),fillPattern:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix),u_image:new p.aH(c,e.u_image),u_texsize:new p.aO(c,e.u_texsize),u_pixel_coord_upper:new p.aO(c,e.u_pixel_coord_upper),u_pixel_coord_lower:new p.aO(c,e.u_pixel_coord_lower),u_scale:new p.aN(c,e.u_scale),u_fade:new p.aI(c,e.u_fade)}),fillOutline:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix),u_world:new p.aO(c,e.u_world)}),fillOutlinePattern:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix),u_world:new p.aO(c,e.u_world),u_image:new p.aH(c,e.u_image),u_texsize:new p.aO(c,e.u_texsize),u_pixel_coord_upper:new p.aO(c,e.u_pixel_coord_upper),u_pixel_coord_lower:new p.aO(c,e.u_pixel_coord_lower),u_scale:new p.aN(c,e.u_scale),u_fade:new p.aI(c,e.u_fade)}),circle:(c,e)=>({u_camera_to_center_distance:new p.aI(c,e.u_camera_to_center_distance),u_scale_with_map:new p.aH(c,e.u_scale_with_map),u_pitch_with_map:new p.aH(c,e.u_pitch_with_map),u_extrude_scale:new p.aO(c,e.u_extrude_scale),u_device_pixel_ratio:new p.aI(c,e.u_device_pixel_ratio),u_matrix:new p.aJ(c,e.u_matrix)}),collisionBox:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix),u_pixel_extrude_scale:new p.aO(c,e.u_pixel_extrude_scale)}),collisionCircle:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix),u_inv_matrix:new p.aJ(c,e.u_inv_matrix),u_camera_to_center_distance:new p.aI(c,e.u_camera_to_center_distance),u_viewport_size:new p.aO(c,e.u_viewport_size)}),debug:(c,e)=>({u_color:new p.aL(c,e.u_color),u_matrix:new p.aJ(c,e.u_matrix),u_overlay:new p.aH(c,e.u_overlay),u_overlay_scale:new p.aI(c,e.u_overlay_scale)}),clippingMask:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix)}),heatmap:(c,e)=>({u_extrude_scale:new p.aI(c,e.u_extrude_scale),u_intensity:new p.aI(c,e.u_intensity),u_matrix:new p.aJ(c,e.u_matrix)}),heatmapTexture:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix),u_world:new p.aO(c,e.u_world),u_image:new p.aH(c,e.u_image),u_color_ramp:new p.aH(c,e.u_color_ramp),u_opacity:new p.aI(c,e.u_opacity)}),hillshade:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix),u_image:new p.aH(c,e.u_image),u_latrange:new p.aO(c,e.u_latrange),u_light:new p.aO(c,e.u_light),u_shadow:new p.aL(c,e.u_shadow),u_highlight:new p.aL(c,e.u_highlight),u_accent:new p.aL(c,e.u_accent)}),hillshadePrepare:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix),u_image:new p.aH(c,e.u_image),u_dimension:new p.aO(c,e.u_dimension),u_zoom:new p.aI(c,e.u_zoom),u_unpack:new p.aK(c,e.u_unpack)}),line:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix),u_ratio:new p.aI(c,e.u_ratio),u_device_pixel_ratio:new p.aI(c,e.u_device_pixel_ratio),u_units_to_pixels:new p.aO(c,e.u_units_to_pixels)}),lineGradient:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix),u_ratio:new p.aI(c,e.u_ratio),u_device_pixel_ratio:new p.aI(c,e.u_device_pixel_ratio),u_units_to_pixels:new p.aO(c,e.u_units_to_pixels),u_image:new p.aH(c,e.u_image),u_image_height:new p.aI(c,e.u_image_height)}),linePattern:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix),u_texsize:new p.aO(c,e.u_texsize),u_ratio:new p.aI(c,e.u_ratio),u_device_pixel_ratio:new p.aI(c,e.u_device_pixel_ratio),u_image:new p.aH(c,e.u_image),u_units_to_pixels:new p.aO(c,e.u_units_to_pixels),u_scale:new p.aN(c,e.u_scale),u_fade:new p.aI(c,e.u_fade)}),lineSDF:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix),u_ratio:new p.aI(c,e.u_ratio),u_device_pixel_ratio:new p.aI(c,e.u_device_pixel_ratio),u_units_to_pixels:new p.aO(c,e.u_units_to_pixels),u_patternscale_a:new p.aO(c,e.u_patternscale_a),u_patternscale_b:new p.aO(c,e.u_patternscale_b),u_sdfgamma:new p.aI(c,e.u_sdfgamma),u_image:new p.aH(c,e.u_image),u_tex_y_a:new p.aI(c,e.u_tex_y_a),u_tex_y_b:new p.aI(c,e.u_tex_y_b),u_mix:new p.aI(c,e.u_mix)}),raster:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix),u_tl_parent:new p.aO(c,e.u_tl_parent),u_scale_parent:new p.aI(c,e.u_scale_parent),u_buffer_scale:new p.aI(c,e.u_buffer_scale),u_fade_t:new p.aI(c,e.u_fade_t),u_opacity:new p.aI(c,e.u_opacity),u_image0:new p.aH(c,e.u_image0),u_image1:new p.aH(c,e.u_image1),u_brightness_low:new p.aI(c,e.u_brightness_low),u_brightness_high:new p.aI(c,e.u_brightness_high),u_saturation_factor:new p.aI(c,e.u_saturation_factor),u_contrast_factor:new p.aI(c,e.u_contrast_factor),u_spin_weights:new p.aN(c,e.u_spin_weights)}),symbolIcon:(c,e)=>({u_is_size_zoom_constant:new p.aH(c,e.u_is_size_zoom_constant),u_is_size_feature_constant:new p.aH(c,e.u_is_size_feature_constant),u_size_t:new p.aI(c,e.u_size_t),u_size:new p.aI(c,e.u_size),u_camera_to_center_distance:new p.aI(c,e.u_camera_to_center_distance),u_pitch:new p.aI(c,e.u_pitch),u_rotate_symbol:new p.aH(c,e.u_rotate_symbol),u_aspect_ratio:new p.aI(c,e.u_aspect_ratio),u_fade_change:new p.aI(c,e.u_fade_change),u_matrix:new p.aJ(c,e.u_matrix),u_label_plane_matrix:new p.aJ(c,e.u_label_plane_matrix),u_coord_matrix:new p.aJ(c,e.u_coord_matrix),u_is_text:new p.aH(c,e.u_is_text),u_pitch_with_map:new p.aH(c,e.u_pitch_with_map),u_is_along_line:new p.aH(c,e.u_is_along_line),u_is_variable_anchor:new p.aH(c,e.u_is_variable_anchor),u_texsize:new p.aO(c,e.u_texsize),u_texture:new p.aH(c,e.u_texture),u_translation:new p.aO(c,e.u_translation),u_pitched_scale:new p.aI(c,e.u_pitched_scale)}),symbolSDF:(c,e)=>({u_is_size_zoom_constant:new p.aH(c,e.u_is_size_zoom_constant),u_is_size_feature_constant:new p.aH(c,e.u_is_size_feature_constant),u_size_t:new p.aI(c,e.u_size_t),u_size:new p.aI(c,e.u_size),u_camera_to_center_distance:new p.aI(c,e.u_camera_to_center_distance),u_pitch:new p.aI(c,e.u_pitch),u_rotate_symbol:new p.aH(c,e.u_rotate_symbol),u_aspect_ratio:new p.aI(c,e.u_aspect_ratio),u_fade_change:new p.aI(c,e.u_fade_change),u_matrix:new p.aJ(c,e.u_matrix),u_label_plane_matrix:new p.aJ(c,e.u_label_plane_matrix),u_coord_matrix:new p.aJ(c,e.u_coord_matrix),u_is_text:new p.aH(c,e.u_is_text),u_pitch_with_map:new p.aH(c,e.u_pitch_with_map),u_is_along_line:new p.aH(c,e.u_is_along_line),u_is_variable_anchor:new p.aH(c,e.u_is_variable_anchor),u_texsize:new p.aO(c,e.u_texsize),u_texture:new p.aH(c,e.u_texture),u_gamma_scale:new p.aI(c,e.u_gamma_scale),u_device_pixel_ratio:new p.aI(c,e.u_device_pixel_ratio),u_is_halo:new p.aH(c,e.u_is_halo),u_translation:new p.aO(c,e.u_translation),u_pitched_scale:new p.aI(c,e.u_pitched_scale)}),symbolTextAndIcon:(c,e)=>({u_is_size_zoom_constant:new p.aH(c,e.u_is_size_zoom_constant),u_is_size_feature_constant:new p.aH(c,e.u_is_size_feature_constant),u_size_t:new p.aI(c,e.u_size_t),u_size:new p.aI(c,e.u_size),u_camera_to_center_distance:new p.aI(c,e.u_camera_to_center_distance),u_pitch:new p.aI(c,e.u_pitch),u_rotate_symbol:new p.aH(c,e.u_rotate_symbol),u_aspect_ratio:new p.aI(c,e.u_aspect_ratio),u_fade_change:new p.aI(c,e.u_fade_change),u_matrix:new p.aJ(c,e.u_matrix),u_label_plane_matrix:new p.aJ(c,e.u_label_plane_matrix),u_coord_matrix:new p.aJ(c,e.u_coord_matrix),u_is_text:new p.aH(c,e.u_is_text),u_pitch_with_map:new p.aH(c,e.u_pitch_with_map),u_is_along_line:new p.aH(c,e.u_is_along_line),u_is_variable_anchor:new p.aH(c,e.u_is_variable_anchor),u_texsize:new p.aO(c,e.u_texsize),u_texsize_icon:new p.aO(c,e.u_texsize_icon),u_texture:new p.aH(c,e.u_texture),u_texture_icon:new p.aH(c,e.u_texture_icon),u_gamma_scale:new p.aI(c,e.u_gamma_scale),u_device_pixel_ratio:new p.aI(c,e.u_device_pixel_ratio),u_is_halo:new p.aH(c,e.u_is_halo),u_translation:new p.aO(c,e.u_translation),u_pitched_scale:new p.aI(c,e.u_pitched_scale)}),background:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix),u_opacity:new p.aI(c,e.u_opacity),u_color:new p.aL(c,e.u_color)}),backgroundPattern:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix),u_opacity:new p.aI(c,e.u_opacity),u_image:new p.aH(c,e.u_image),u_pattern_tl_a:new p.aO(c,e.u_pattern_tl_a),u_pattern_br_a:new p.aO(c,e.u_pattern_br_a),u_pattern_tl_b:new p.aO(c,e.u_pattern_tl_b),u_pattern_br_b:new p.aO(c,e.u_pattern_br_b),u_texsize:new p.aO(c,e.u_texsize),u_mix:new p.aI(c,e.u_mix),u_pattern_size_a:new p.aO(c,e.u_pattern_size_a),u_pattern_size_b:new p.aO(c,e.u_pattern_size_b),u_scale_a:new p.aI(c,e.u_scale_a),u_scale_b:new p.aI(c,e.u_scale_b),u_pixel_coord_upper:new p.aO(c,e.u_pixel_coord_upper),u_pixel_coord_lower:new p.aO(c,e.u_pixel_coord_lower),u_tile_units_to_pixels:new p.aI(c,e.u_tile_units_to_pixels)}),terrain:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix),u_texture:new p.aH(c,e.u_texture),u_ele_delta:new p.aI(c,e.u_ele_delta),u_fog_matrix:new p.aJ(c,e.u_fog_matrix),u_fog_color:new p.aL(c,e.u_fog_color),u_fog_ground_blend:new p.aI(c,e.u_fog_ground_blend),u_fog_ground_blend_opacity:new p.aI(c,e.u_fog_ground_blend_opacity),u_horizon_color:new p.aL(c,e.u_horizon_color),u_horizon_fog_blend:new p.aI(c,e.u_horizon_fog_blend)}),terrainDepth:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix),u_ele_delta:new p.aI(c,e.u_ele_delta)}),terrainCoords:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix),u_texture:new p.aH(c,e.u_texture),u_terrain_coords_id:new p.aI(c,e.u_terrain_coords_id),u_ele_delta:new p.aI(c,e.u_ele_delta)}),sky:(c,e)=>({u_sky_color:new p.aL(c,e.u_sky_color),u_horizon_color:new p.aL(c,e.u_horizon_color),u_horizon:new p.aI(c,e.u_horizon),u_sky_horizon_blend:new p.aI(c,e.u_sky_horizon_blend)})};class Gr{constructor(e,n,s){this.context=e;let o=e.gl;this.buffer=o.createBuffer(),this.dynamicDraw=!!s,this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?o.DYNAMIC_DRAW:o.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){let n=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),n.bufferSubData(n.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}let qu={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class oo{constructor(e,n,s,o){this.length=n.length,this.attributes=s,this.itemSize=n.bytesPerElement,this.dynamicDraw=o,this.context=e;let u=e.gl;this.buffer=u.createBuffer(),e.bindVertexBuffer.set(this.buffer),u.bufferData(u.ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?u.DYNAMIC_DRAW:u.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){if(e.length!==this.length)throw new Error(`Length of new data is ${e.length}, which doesn't match current length of ${this.length}`);let n=this.context.gl;this.bind(),n.bufferSubData(n.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,n){for(let s=0;s<this.attributes.length;s++){let o=n.attributes[this.attributes[s].name];o!==void 0&&e.enableVertexAttribArray(o)}}setVertexAttribPointers(e,n,s){for(let o=0;o<this.attributes.length;o++){let u=this.attributes[o],m=n.attributes[u.name];m!==void 0&&e.vertexAttribPointer(m,u.components,e[qu[u.type]],!1,this.itemSize,u.offset+this.itemSize*(s||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}let wn=new WeakMap;function un(c){var e;if(wn.has(c))return wn.get(c);{let n=(e=c.getParameter(c.VERSION))===null||e===void 0?void 0:e.startsWith("WebGL 2.0");return wn.set(c,n),n}}class qt{constructor(e){this.gl=e.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(e){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class rs extends qt{getDefault(){return p.aM.transparent}set(e){let n=this.current;(e.r!==n.r||e.g!==n.g||e.b!==n.b||e.a!==n.a||this.dirty)&&(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class Vu extends qt{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}}class Zn extends qt{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}}class Uu extends qt{getDefault(){return[!0,!0,!0,!0]}set(e){let n=this.current;(e[0]!==n[0]||e[1]!==n[1]||e[2]!==n[2]||e[3]!==n[3]||this.dirty)&&(this.gl.colorMask(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class Tl extends qt{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}}class ju extends qt{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}}class Cl extends qt{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(e){let n=this.current;(e.func!==n.func||e.ref!==n.ref||e.mask!==n.mask||this.dirty)&&(this.gl.stencilFunc(e.func,e.ref,e.mask),this.current=e,this.dirty=!1)}}class lo extends qt{getDefault(){let e=this.gl;return[e.KEEP,e.KEEP,e.KEEP]}set(e){let n=this.current;(e[0]!==n[0]||e[1]!==n[1]||e[2]!==n[2]||this.dirty)&&(this.gl.stencilOp(e[0],e[1],e[2]),this.current=e,this.dirty=!1)}}class Dl extends qt{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let n=this.gl;e?n.enable(n.STENCIL_TEST):n.disable(n.STENCIL_TEST),this.current=e,this.dirty=!1}}class Sl extends qt{getDefault(){return[0,1]}set(e){let n=this.current;(e[0]!==n[0]||e[1]!==n[1]||this.dirty)&&(this.gl.depthRange(e[0],e[1]),this.current=e,this.dirty=!1)}}class Il extends qt{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let n=this.gl;e?n.enable(n.DEPTH_TEST):n.disable(n.DEPTH_TEST),this.current=e,this.dirty=!1}}class kl extends qt{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}}class An extends qt{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let n=this.gl;e?n.enable(n.BLEND):n.disable(n.BLEND),this.current=e,this.dirty=!1}}class Ml extends qt{getDefault(){let e=this.gl;return[e.ONE,e.ZERO]}set(e){let n=this.current;(e[0]!==n[0]||e[1]!==n[1]||this.dirty)&&(this.gl.blendFunc(e[0],e[1]),this.current=e,this.dirty=!1)}}class $u extends qt{getDefault(){return p.aM.transparent}set(e){let n=this.current;(e.r!==n.r||e.g!==n.g||e.b!==n.b||e.a!==n.a||this.dirty)&&(this.gl.blendColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class Pl extends qt{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}}class Ca extends qt{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let n=this.gl;e?n.enable(n.CULL_FACE):n.disable(n.CULL_FACE),this.current=e,this.dirty=!1}}class Zu extends qt{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}}class ns extends qt{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}}class Gu extends qt{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}}class Hu extends qt{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}}class zl extends qt{getDefault(){let e=this.gl;return[0,0,e.drawingBufferWidth,e.drawingBufferHeight]}set(e){let n=this.current;(e[0]!==n[0]||e[1]!==n[1]||e[2]!==n[2]||e[3]!==n[3]||this.dirty)&&(this.gl.viewport(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class Bl extends qt{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let n=this.gl;n.bindFramebuffer(n.FRAMEBUFFER,e),this.current=e,this.dirty=!1}}class Ll extends qt{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let n=this.gl;n.bindRenderbuffer(n.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class uo extends qt{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let n=this.gl;n.bindTexture(n.TEXTURE_2D,e),this.current=e,this.dirty=!1}}class Rl extends qt{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let n=this.gl;n.bindBuffer(n.ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class as extends qt{getDefault(){return null}set(e){let n=this.gl;n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class en extends qt{getDefault(){return null}set(e){var n;if(e===this.current&&!this.dirty)return;let s=this.gl;un(s)?s.bindVertexArray(e):(n=s.getExtension("OES_vertex_array_object"))===null||n===void 0||n.bindVertexArrayOES(e),this.current=e,this.dirty=!1}}class co extends qt{getDefault(){return 4}set(e){if(e===this.current&&!this.dirty)return;let n=this.gl;n.pixelStorei(n.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=!1}}class ho extends qt{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let n=this.gl;n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=!1}}class po extends qt{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let n=this.gl;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=!1}}class ss extends qt{constructor(e,n){super(e),this.context=e,this.parent=n}getDefault(){return null}}class fo extends ss{setDirty(){this.dirty=!0}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let n=this.gl;n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}}class En extends ss{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let n=this.gl;n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class mo extends ss{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let n=this.gl;n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class Xu{constructor(e,n,s,o,u){this.context=e,this.width=n,this.height=s;let m=e.gl,_=this.framebuffer=m.createFramebuffer();if(this.colorAttachment=new fo(e,_),o)this.depthAttachment=u?new mo(e,_):new En(e,_);else if(u)throw new Error("Stencil cannot be set without depth");if(m.checkFramebufferStatus(m.FRAMEBUFFER)!==m.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer is not complete")}destroy(){let e=this.context.gl,n=this.colorAttachment.get();if(n&&e.deleteTexture(n),this.depthAttachment){let s=this.depthAttachment.get();s&&e.deleteRenderbuffer(s)}e.deleteFramebuffer(this.framebuffer)}}class di{constructor(e,n,s){this.blendFunction=e,this.blendColor=n,this.mask=s}}di.Replace=[1,0],di.disabled=new di(di.Replace,p.aM.transparent,[!1,!1,!1,!1]),di.unblended=new di(di.Replace,p.aM.transparent,[!0,!0,!0,!0]),di.alphaBlended=new di([1,771],p.aM.transparent,[!0,!0,!0,!0]);class Wu{constructor(e){var n,s;if(this.gl=e,this.clearColor=new rs(this),this.clearDepth=new Vu(this),this.clearStencil=new Zn(this),this.colorMask=new Uu(this),this.depthMask=new Tl(this),this.stencilMask=new ju(this),this.stencilFunc=new Cl(this),this.stencilOp=new lo(this),this.stencilTest=new Dl(this),this.depthRange=new Sl(this),this.depthTest=new Il(this),this.depthFunc=new kl(this),this.blend=new An(this),this.blendFunc=new Ml(this),this.blendColor=new $u(this),this.blendEquation=new Pl(this),this.cullFace=new Ca(this),this.cullFaceSide=new Zu(this),this.frontFace=new ns(this),this.program=new Gu(this),this.activeTexture=new Hu(this),this.viewport=new zl(this),this.bindFramebuffer=new Bl(this),this.bindRenderbuffer=new Ll(this),this.bindTexture=new uo(this),this.bindVertexBuffer=new Rl(this),this.bindElementBuffer=new as(this),this.bindVertexArray=new en(this),this.pixelStoreUnpack=new co(this),this.pixelStoreUnpackPremultiplyAlpha=new ho(this),this.pixelStoreUnpackFlipY=new po(this),this.extTextureFilterAnisotropic=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=e.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE),un(e)){this.HALF_FLOAT=e.HALF_FLOAT;let o=e.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(n=e.RGBA16F)!==null&&n!==void 0?n:o?.RGBA16F_EXT,this.RGB16F=(s=e.RGB16F)!==null&&s!==void 0?s:o?.RGB16F_EXT,e.getExtension("EXT_color_buffer_float")}else{e.getExtension("EXT_color_buffer_half_float"),e.getExtension("OES_texture_half_float_linear");let o=e.getExtension("OES_texture_half_float");this.HALF_FLOAT=o?.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(e,n){return new Gr(this,e,n)}createVertexBuffer(e,n,s){return new oo(this,e,n,s)}createRenderbuffer(e,n,s){let o=this.gl,u=o.createRenderbuffer();return this.bindRenderbuffer.set(u),o.renderbufferStorage(o.RENDERBUFFER,e,n,s),this.bindRenderbuffer.set(null),u}createFramebuffer(e,n,s,o){return new Xu(this,e,n,s,o)}clear({color:e,depth:n,stencil:s}){let o=this.gl,u=0;e&&(u|=o.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),n!==void 0&&(u|=o.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(n),this.depthMask.set(!0)),s!==void 0&&(u|=o.STENCIL_BUFFER_BIT,this.clearStencil.set(s),this.stencilMask.set(255)),o.clear(u)}setCullFace(e){e.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(e.mode),this.frontFace.set(e.frontFace))}setDepthMode(e){e.func!==this.gl.ALWAYS||e.mask?(this.depthTest.set(!0),this.depthFunc.set(e.func),this.depthMask.set(e.mask),this.depthRange.set(e.range)):this.depthTest.set(!1)}setStencilMode(e){e.test.func!==this.gl.ALWAYS||e.mask?(this.stencilTest.set(!0),this.stencilMask.set(e.mask),this.stencilOp.set([e.fail,e.depthFail,e.pass]),this.stencilFunc.set({func:e.test.func,ref:e.ref,mask:e.test.mask})):this.stencilTest.set(!1)}setColorMode(e){p.aE(e.blendFunction,di.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor)),this.colorMask.set(e.mask)}createVertexArray(){var e;return un(this.gl)?this.gl.createVertexArray():(e=this.gl.getExtension("OES_vertex_array_object"))===null||e===void 0?void 0:e.createVertexArrayOES()}deleteVertexArray(e){var n;return un(this.gl)?this.gl.deleteVertexArray(e):(n=this.gl.getExtension("OES_vertex_array_object"))===null||n===void 0?void 0:n.deleteVertexArrayOES(e)}unbindVAO(){this.bindVertexArray.set(null)}}class At{constructor(e,n,s){this.func=e,this.mask=n,this.range=s}}At.ReadOnly=!1,At.ReadWrite=!0,At.disabled=new At(519,At.ReadOnly,[0,1]);let os=7680;class Yt{constructor(e,n,s,o,u,m){this.test=e,this.ref=n,this.mask=s,this.fail=o,this.depthFail=u,this.pass=m}}Yt.disabled=new Yt({func:519,mask:0},0,0,os,os,os);class Gt{constructor(e,n,s){this.enable=e,this.mode=n,this.frontFace=s}}let Tn;function Da(c,e,n,s,o){let u=c.context,m=u.gl,_=c.useProgram("collisionBox"),y=[],b=0,T=0;for(let G=0;G<s.length;G++){let W=s[G],N=e.getTile(W).getBucket(n);if(!N)continue;let Q=o?N.textCollisionBox:N.iconCollisionBox,te=N.collisionCircleArray;if(te.length>0){let ae=p.H();p.aQ(ae,N.placementInvProjMatrix,c.transform.glCoordMatrix),p.aQ(ae,ae,N.placementViewportMatrix),y.push({circleArray:te,circleOffset:T,transform:W.posMatrix,invTransform:ae,coord:W}),b+=te.length/4,T=b}Q&&_.draw(u,m.LINES,At.disabled,Yt.disabled,c.colorModeForRenderPass(),Gt.disabled,{u_matrix:W.posMatrix,u_pixel_extrude_scale:[1/(C=c.transform).width,1/C.height]},c.style.map.terrain&&c.style.map.terrain.getTerrainData(W),n.id,Q.layoutVertexBuffer,Q.indexBuffer,Q.segments,null,c.transform.zoom,null,null,Q.collisionVertexBuffer)}var C;if(!o||!y.length)return;let P=c.useProgram("collisionCircle"),L=new p.aR;L.resize(4*b),L._trim();let O=0;for(let G of y)for(let W=0;W<G.circleArray.length/4;W++){let N=4*W,Q=G.circleArray[N+0],te=G.circleArray[N+1],ae=G.circleArray[N+2],fe=G.circleArray[N+3];L.emplace(O++,Q,te,ae,fe,0),L.emplace(O++,Q,te,ae,fe,1),L.emplace(O++,Q,te,ae,fe,2),L.emplace(O++,Q,te,ae,fe,3)}(!Tn||Tn.length<2*b)&&(Tn=function(G){let W=2*G,N=new p.aT;N.resize(W),N._trim();for(let Q=0;Q<W;Q++){let te=6*Q;N.uint16[te+0]=4*Q+0,N.uint16[te+1]=4*Q+1,N.uint16[te+2]=4*Q+2,N.uint16[te+3]=4*Q+2,N.uint16[te+4]=4*Q+3,N.uint16[te+5]=4*Q+0}return N}(b));let U=u.createIndexBuffer(Tn,!0),Z=u.createVertexBuffer(L,p.aS.members,!0);for(let G of y){let W=bn(G.transform,G.invTransform,c.transform);P.draw(u,m.TRIANGLES,At.disabled,Yt.disabled,c.colorModeForRenderPass(),Gt.disabled,W,c.style.map.terrain&&c.style.map.terrain.getTerrainData(G.coord),n.id,Z,U,p.a0.simpleSegment(0,2*G.circleOffset,G.circleArray.length,G.circleArray.length/2),null,c.transform.zoom,null,null,null)}Z.destroy(),U.destroy()}Gt.disabled=new Gt(!1,1029,2305),Gt.backCCW=new Gt(!0,1029,2305);let Sa=p.an(new Float32Array(16));function go(c,e,n,s,o,u){let{horizontalAlign:m,verticalAlign:_}=p.au(c);return new p.P((-(m-.5)*e/o+s[0])*u,(-(_-.5)*n/o+s[1])*u)}function Cn(c,e,n,s,o,u){let m=e.tileAnchorPoint.add(new p.P(e.translation[0],e.translation[1]));if(e.pitchWithMap){let _=s.mult(u);n||(_=_.rotate(-o));let y=m.add(_);return j(y.x,y.y,e.labelPlaneMatrix,e.getElevation).point}if(n){let _=he(e.tileAnchorPoint.x+1,e.tileAnchorPoint.y,e).point.sub(c),y=Math.atan(_.y/_.x)+(_.x<0?Math.PI:0);return c.add(s.rotate(y))}return c.add(s)}function Gn(c,e,n,s,o,u,m,_,y,b,T,C,P,L){let O=c.text.placedSymbolArray,U=c.text.dynamicLayoutVertexArray,Z=c.icon.dynamicLayoutVertexArray,G={};U.clear();for(let W=0;W<O.length;W++){let N=O.get(W),Q=N.hidden||!N.crossTileID||c.allowVerticalPlacement&&!N.placedOrientation?null:s[N.crossTileID];if(Q){let te=new p.P(N.anchorX,N.anchorY),ae={getElevation:L,width:o.width,height:o.height,labelPlaneMatrix:u,lineVertexArray:null,pitchWithMap:n,projection:T,projectionCache:null,tileAnchorPoint:te,translation:C,unwrappedTileID:P},fe=n?j(te.x,te.y,m,L):he(te.x,te.y,ae),ve=k(o.cameraToCenterDistance,fe.signedDistanceFromCamera),ke=p.ai(c.textSizeData,y,N)*ve/p.ap;n&&(ke*=c.tilePixelRatio/_);let{width:Oe,height:Te,anchor:Ee,textOffset:$e,textBoxScale:ct}=Q,Se=go(Ee,Oe,Te,$e,ct,ke),ze=T.getPitchedTextCorrection(o,te.add(new p.P(C[0],C[1])),P),ot=Cn(fe.point,ae,e,Se,o.angle,ze),ii=c.allowVerticalPlacement&&N.placedOrientation===p.ah.vertical?Math.PI/2:0;for(let yt=0;yt<N.numGlyphs;yt++)p.aj(U,ot,ii);b&&N.associatedIconIndex>=0&&(G[N.associatedIconIndex]={shiftedAnchor:ot,angle:ii})}else et(N.numGlyphs,U)}if(b){Z.clear();let W=c.icon.placedSymbolArray;for(let N=0;N<W.length;N++){let Q=W.get(N);if(Q.hidden)et(Q.numGlyphs,Z);else{let te=G[N];if(te)for(let ae=0;ae<Q.numGlyphs;ae++)p.aj(Z,te.shiftedAnchor,te.angle);else et(Q.numGlyphs,Z)}}c.icon.dynamicLayoutVertexBuffer.updateData(Z)}c.text.dynamicLayoutVertexBuffer.updateData(U)}function xr(c,e,n){return n.iconsInText&&e?"symbolTextAndIcon":c?"symbolSDF":"symbolIcon"}function _o(c,e,n,s,o,u,m,_,y,b,T,C){let P=c.context,L=P.gl,O=c.transform,U=vn(),Z=_==="map",G=y==="map",W=_!=="viewport"&&n.layout.get("symbol-placement")!=="point",N=Z&&!G&&!W,Q=!G&&W,te=!n.layout.get("symbol-sort-key").isConstant(),ae=!1,fe=c.depthModeForSublayer(0,At.ReadOnly),ve=n._unevaluatedLayout.hasValue("text-variable-anchor")||n._unevaluatedLayout.hasValue("text-variable-anchor-offset"),ke=[],Oe=U.getCircleRadiusCorrection(O);for(let Te of s){let Ee=e.getTile(Te),$e=Ee.getBucket(n);if(!$e)continue;let ct=o?$e.text:$e.icon;if(!ct||!ct.segments.get().length||!ct.hasVisibleVertices)continue;let Se=ct.programConfigurations.get(n.id),ze=o||$e.sdfIcons,ot=o?$e.textSizeData:$e.iconSizeData,ii=G||O.pitch!==0,yt=c.useProgram(xr(ze,o,$e),Se),Ct=p.ag(ot,O.zoom),ri=c.style.map.terrain&&c.style.map.terrain.getTerrainData(Te),zi,Or,ni,er,$i=[0,0],Bi=null;if(o)Or=Ee.glyphAtlasTexture,ni=L.LINEAR,zi=Ee.glyphAtlasTexture.size,$e.iconsInText&&($i=Ee.imageAtlasTexture.size,Bi=Ee.imageAtlasTexture,er=ii||c.options.rotating||c.options.zooming||ot.kind==="composite"||ot.kind==="camera"?L.LINEAR:L.NEAREST);else{let St=n.layout.get("icon-size").constantOr(0)!==1||$e.iconsNeedLinear;Or=Ee.imageAtlasTexture,ni=ze||c.options.rotating||c.options.zooming||St||ii?L.LINEAR:L.NEAREST,zi=Ee.imageAtlasTexture.size}let Zi=Tt(Ee,1,c.transform.zoom),Wr=Q?Te.posMatrix:Sa,la=on(Wr,G,Z,c.transform,Zi),Cs=Zr(Wr,G,Z,c.transform,Zi),ua=Zr(Te.posMatrix,G,Z,c.transform,Zi),Ar=U.translatePosition(c.transform,Ee,u,m),Ds=ve&&$e.hasTextData(),Uo=n.layout.get("icon-text-fit")!=="none"&&Ds&&$e.hasIconData();if(W){let St=c.style.map.terrain?(ca,ha)=>c.style.map.terrain.getElevation(Te,ca,ha):null,Mn=n.layout.get("text-rotation-alignment")==="map";R($e,Te.posMatrix,c,o,la,ua,G,b,Mn,U,Te.toUnwrapped(),O.width,O.height,Ar,St)}let Er=Te.posMatrix,Tr=o&&ve||Uo,cn=W||Tr?Sa:la,Nr=Cs,ki=ze&&n.paint.get(o?"text-halo-width":"icon-halo-width").constantOr(1)!==0,Li;Li=ze?$e.iconsInText?no(ot.kind,Ct,N,G,W,Tr,c,Er,cn,Nr,Ar,zi,$i,Oe):Ta(ot.kind,Ct,N,G,W,Tr,c,Er,cn,Nr,Ar,o,zi,!0,Oe):El(ot.kind,Ct,N,G,W,Tr,c,Er,cn,Nr,Ar,o,zi,Oe);let fr={program:yt,buffers:ct,uniformValues:Li,atlasTexture:Or,atlasTextureIcon:Bi,atlasInterpolation:ni,atlasInterpolationIcon:er,isSDF:ze,hasHalo:ki};if(te&&$e.canOverlap){ae=!0;let St=ct.segments.get();for(let Mn of St)ke.push({segments:new p.a0([Mn]),sortKey:Mn.sortKey,state:fr,terrainData:ri})}else ke.push({segments:ct.segments,sortKey:0,state:fr,terrainData:ri})}ae&&ke.sort((Te,Ee)=>Te.sortKey-Ee.sortKey);for(let Te of ke){let Ee=Te.state;if(P.activeTexture.set(L.TEXTURE0),Ee.atlasTexture.bind(Ee.atlasInterpolation,L.CLAMP_TO_EDGE),Ee.atlasTextureIcon&&(P.activeTexture.set(L.TEXTURE1),Ee.atlasTextureIcon&&Ee.atlasTextureIcon.bind(Ee.atlasInterpolationIcon,L.CLAMP_TO_EDGE)),Ee.isSDF){let $e=Ee.uniformValues;Ee.hasHalo&&($e.u_is_halo=1,yo(Ee.buffers,Te.segments,n,c,Ee.program,fe,T,C,$e,Te.terrainData)),$e.u_is_halo=0}yo(Ee.buffers,Te.segments,n,c,Ee.program,fe,T,C,Ee.uniformValues,Te.terrainData)}}function yo(c,e,n,s,o,u,m,_,y,b){let T=s.context;o.draw(T,T.gl.TRIANGLES,u,m,_,Gt.disabled,y,b,n.id,c.layoutVertexBuffer,c.indexBuffer,e,n.paint,s.transform.zoom,c.programConfigurations.get(n.id),c.dynamicLayoutVertexBuffer,c.opacityVertexBuffer)}function vo(c,e,n,s){let o=c.context,u=o.gl,m=Yt.disabled,_=new di([u.ONE,u.ONE],p.aM.transparent,[!0,!0,!0,!0]),y=e.getBucket(n);if(!y)return;let b=s.key,T=n.heatmapFbos.get(b);T||(T=Ia(o,e.tileSize,e.tileSize),n.heatmapFbos.set(b,T)),o.bindFramebuffer.set(T.framebuffer),o.viewport.set([0,0,e.tileSize,e.tileSize]),o.clear({color:p.aM.transparent});let C=y.programConfigurations.get(n.id),P=c.useProgram("heatmap",C),L=c.style.map.terrain.getTerrainData(s);P.draw(o,u.TRIANGLES,At.disabled,m,_,Gt.disabled,Qi(s.posMatrix,e,c.transform.zoom,n.paint.get("heatmap-intensity")),L,n.id,y.layoutVertexBuffer,y.indexBuffer,y.segments,n.paint,c.transform.zoom,C)}function Dn(c,e,n){let s=c.context,o=s.gl;s.setColorMode(c.colorModeForRenderPass());let u=ka(s,e),m=n.key,_=e.heatmapFbos.get(m);_&&(s.activeTexture.set(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,_.colorAttachment.get()),s.activeTexture.set(o.TEXTURE1),u.bind(o.LINEAR,o.CLAMP_TO_EDGE),c.useProgram("heatmapTexture").draw(s,o.TRIANGLES,At.disabled,Yt.disabled,c.colorModeForRenderPass(),Gt.disabled,Qa(c,e,0,1),null,e.id,c.rasterBoundsBuffer,c.quadTriangleIndexBuffer,c.rasterBoundsSegments,e.paint,c.transform.zoom),_.destroy(),e.heatmapFbos.delete(m))}function Ia(c,e,n){var s,o;let u=c.gl,m=u.createTexture();u.bindTexture(u.TEXTURE_2D,m),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_S,u.CLAMP_TO_EDGE),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_T,u.CLAMP_TO_EDGE),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MIN_FILTER,u.LINEAR),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MAG_FILTER,u.LINEAR);let _=(s=c.HALF_FLOAT)!==null&&s!==void 0?s:u.UNSIGNED_BYTE,y=(o=c.RGBA16F)!==null&&o!==void 0?o:u.RGBA;u.texImage2D(u.TEXTURE_2D,0,y,e,n,0,u.RGBA,_,null);let b=c.createFramebuffer(e,n,!1,!1);return b.colorAttachment.set(m),b}function ka(c,e){return e.colorRampTexture||(e.colorRampTexture=new ye(c,e.colorRamp,c.gl.RGBA)),e.colorRampTexture}function Hn(c,e,n,s,o){if(!n||!s||!s.imageAtlas)return;let u=s.imageAtlas.patternPositions,m=u[n.to.toString()],_=u[n.from.toString()];if(!m&&_&&(m=_),!_&&m&&(_=m),!m||!_){let y=o.getPaintProperty(e);m=u[y],_=u[y]}m&&_&&c.setConstantPatternPositions(m,_)}function Ma(c,e,n,s,o,u,m){let _=c.context.gl,y="fill-pattern",b=n.paint.get(y),T=b&&b.constantOr(1),C=n.getCrossfadeParameters(),P,L,O,U,Z;m?(L=T&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",P=_.LINES):(L=T?"fillPattern":"fill",P=_.TRIANGLES);let G=b.constantOr(null);for(let W of s){let N=e.getTile(W);if(T&&!N.patternsLoaded())continue;let Q=N.getBucket(n);if(!Q)continue;let te=Q.programConfigurations.get(n.id),ae=c.useProgram(L,te),fe=c.style.map.terrain&&c.style.map.terrain.getTerrainData(W);T&&(c.context.activeTexture.set(_.TEXTURE0),N.imageAtlasTexture.bind(_.LINEAR,_.CLAMP_TO_EDGE),te.updatePaintBuffers(C)),Hn(te,y,G,N,n);let ve=fe?W:null,ke=c.translatePosMatrix(ve?ve.posMatrix:W.posMatrix,N,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));if(m){U=Q.indexBuffer2,Z=Q.segments2;let Oe=[_.drawingBufferWidth,_.drawingBufferHeight];O=L==="fillOutlinePattern"&&T?xl(ke,c,C,N,Oe):Lu(ke,Oe)}else U=Q.indexBuffer,Z=Q.segments,O=T?vl(ke,c,C,N):jn(ke);ae.draw(c.context,P,o,c.stencilModeForClipping(W),u,Gt.disabled,O,fe,n.id,Q.layoutVertexBuffer,U,Z,n.paint,c.transform.zoom,te)}}function ls(c,e,n,s,o,u,m){let _=c.context,y=_.gl,b="fill-extrusion-pattern",T=n.paint.get(b),C=T.constantOr(1),P=n.getCrossfadeParameters(),L=n.paint.get("fill-extrusion-opacity"),O=T.constantOr(null);for(let U of s){let Z=e.getTile(U),G=Z.getBucket(n);if(!G)continue;let W=c.style.map.terrain&&c.style.map.terrain.getTerrainData(U),N=G.programConfigurations.get(n.id),Q=c.useProgram(C?"fillExtrusionPattern":"fillExtrusion",N);C&&(c.context.activeTexture.set(y.TEXTURE0),Z.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),N.updatePaintBuffers(P)),Hn(N,b,O,Z,n);let te=c.translatePosMatrix(U.posMatrix,Z,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),ae=n.paint.get("fill-extrusion-vertical-gradient"),fe=C?Ya(te,c,ae,L,U,P,Z):Aa(te,c,ae,L);Q.draw(_,_.gl.TRIANGLES,o,u,m,Gt.backCCW,fe,W,n.id,G.layoutVertexBuffer,G.indexBuffer,G.segments,n.paint,c.transform.zoom,N,c.style.map.terrain&&G.centroidVertexBuffer)}}function Xn(c,e,n,s,o,u,m){let _=c.context,y=_.gl,b=n.fbo;if(!b)return;let T=c.useProgram("hillshade"),C=c.style.map.terrain&&c.style.map.terrain.getTerrainData(e);_.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,b.colorAttachment.get()),T.draw(_,y.TRIANGLES,o,u,m,Gt.disabled,((P,L,O,U)=>{let Z=O.paint.get("hillshade-shadow-color"),G=O.paint.get("hillshade-highlight-color"),W=O.paint.get("hillshade-accent-color"),N=O.paint.get("hillshade-illumination-direction")*(Math.PI/180);O.paint.get("hillshade-illumination-anchor")==="viewport"&&(N-=P.transform.angle);let Q=!P.options.moving;return{u_matrix:U?U.posMatrix:P.transform.calculatePosMatrix(L.tileID.toUnwrapped(),Q),u_image:0,u_latrange:es(0,L.tileID),u_light:[O.paint.get("hillshade-exaggeration"),N],u_shadow:Z,u_highlight:G,u_accent:W}})(c,n,s,C?e:null),C,s.id,c.rasterBoundsBuffer,c.quadTriangleIndexBuffer,c.rasterBoundsSegments)}function Wn(c,e,n,s,o,u){let m=c.context,_=m.gl,y=e.dem;if(y&&y.data){let b=y.dim,T=y.stride,C=y.getPixels();if(m.activeTexture.set(_.TEXTURE1),m.pixelStoreUnpackPremultiplyAlpha.set(!1),e.demTexture=e.demTexture||c.getTileTexture(T),e.demTexture){let L=e.demTexture;L.update(C,{premultiply:!1}),L.bind(_.NEAREST,_.CLAMP_TO_EDGE)}else e.demTexture=new ye(m,C,_.RGBA,{premultiply:!1}),e.demTexture.bind(_.NEAREST,_.CLAMP_TO_EDGE);m.activeTexture.set(_.TEXTURE0);let P=e.fbo;if(!P){let L=new ye(m,{width:b,height:b,data:null},_.RGBA);L.bind(_.LINEAR,_.CLAMP_TO_EDGE),P=e.fbo=m.createFramebuffer(b,b,!0,!1),P.colorAttachment.set(L.texture)}m.bindFramebuffer.set(P.framebuffer),m.viewport.set([0,0,b,b]),c.useProgram("hillshadePrepare").draw(m,_.TRIANGLES,s,o,u,Gt.disabled,((L,O)=>{let U=O.stride,Z=p.H();return p.aP(Z,0,p.X,-p.X,0,0,1),p.J(Z,Z,[0,-p.X,0]),{u_matrix:Z,u_image:1,u_dimension:[U,U],u_zoom:L.overscaledZ,u_unpack:O.getUnpackVector()}})(e.tileID,y),null,n.id,c.rasterBoundsBuffer,c.quadTriangleIndexBuffer,c.rasterBoundsSegments),e.needsHillshadePrepare=!1}}function Fl(c,e,n,s,o,u){let m=s.paint.get("raster-fade-duration");if(!u&&m>0){let _=se.now(),y=(_-c.timeAdded)/m,b=e?(_-e.timeAdded)/m:-1,T=n.getSource(),C=o.coveringZoomLevel({tileSize:T.tileSize,roundZoom:T.roundZoom}),P=!e||Math.abs(e.tileID.overscaledZ-C)>Math.abs(c.tileID.overscaledZ-C),L=P&&c.refreshedUponExpiration?1:p.ac(P?y:1-b,0,1);return c.refreshedUponExpiration&&y>=1&&(c.refreshedUponExpiration=!1),e?{opacity:1,mix:1-L}:{opacity:L,mix:0}}return{opacity:1,mix:0}}let xo=new p.aM(1,0,0,1),Rt=new p.aM(0,1,0,1),us=new p.aM(0,0,1,1),Ju=new p.aM(1,0,1,1),Ol=new p.aM(0,1,1,1);function Jn(c,e,n,s){cs(c,0,e+n/2,c.transform.width,n,s)}function Nl(c,e,n,s){cs(c,e-n/2,0,n,c.transform.height,s)}function cs(c,e,n,s,o,u){let m=c.context,_=m.gl;_.enable(_.SCISSOR_TEST),_.scissor(e*c.pixelRatio,n*c.pixelRatio,s*c.pixelRatio,o*c.pixelRatio),m.clear({color:u}),_.disable(_.SCISSOR_TEST)}function ql(c,e,n){let s=c.context,o=s.gl,u=n.posMatrix,m=c.useProgram("debug"),_=At.disabled,y=Yt.disabled,b=c.colorModeForRenderPass(),T="$debug",C=c.style.map.terrain&&c.style.map.terrain.getTerrainData(n);s.activeTexture.set(o.TEXTURE0);let P=e.getTileByID(n.key).latestRawTileData,L=Math.floor((P&&P.byteLength||0)/1024),O=e.getTile(n).tileSize,U=512/Math.min(O,512)*(n.overscaledZ/c.transform.zoom)*.5,Z=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(Z+=` => ${n.overscaledZ}`),function(G,W){G.initDebugOverlayCanvas();let N=G.debugOverlayCanvas,Q=G.context.gl,te=G.debugOverlayCanvas.getContext("2d");te.clearRect(0,0,N.width,N.height),te.shadowColor="white",te.shadowBlur=2,te.lineWidth=1.5,te.strokeStyle="white",te.textBaseline="top",te.font="bold 36px Open Sans, sans-serif",te.fillText(W,5,5),te.strokeText(W,5,5),G.debugOverlayTexture.update(N),G.debugOverlayTexture.bind(Q.LINEAR,Q.CLAMP_TO_EDGE)}(c,`${Z} ${L}kB`),m.draw(s,o.TRIANGLES,_,y,di.alphaBlended,Gt.disabled,Ea(u,p.aM.transparent,U),null,T,c.debugBuffer,c.quadTriangleIndexBuffer,c.debugSegments),m.draw(s,o.LINE_STRIP,_,y,b,Gt.disabled,Ea(u,p.aM.red),C,T,c.debugBuffer,c.tileBorderIndexBuffer,c.debugSegments)}function Vl(c,e,n){let s=c.context,o=s.gl,u=c.colorModeForRenderPass(),m=new At(o.LEQUAL,At.ReadWrite,c.depthRangeFor3D),_=c.useProgram("terrain"),y=e.getTerrainMesh();s.bindFramebuffer.set(null),s.viewport.set([0,0,c.width,c.height]);for(let b of n){let T=c.renderToTexture.getTexture(b),C=e.getTerrainData(b.tileID);s.activeTexture.set(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,T.texture);let P=c.transform.calculatePosMatrix(b.tileID.toUnwrapped()),L=e.getMeshFrameDelta(c.transform.zoom),O=c.transform.calculateFogMatrix(b.tileID.toUnwrapped()),U=io(P,L,O,c.style.sky,c.transform.pitch);_.draw(s,o.TRIANGLES,m,Yt.disabled,u,Gt.backCCW,U,C,"terrain",y.vertexBuffer,y.indexBuffer,y.segments)}}class hs{constructor(e,n,s){this.vertexBuffer=e,this.indexBuffer=n,this.segments=s}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}class ps{constructor(e,n){this.context=new Wu(e),this.transform=n,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:p.an(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=nt.maxUnderzooming+nt.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new eo}resize(e,n,s){if(this.width=Math.floor(e*s),this.height=Math.floor(n*s),this.pixelRatio=s,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let o of this.style._order)this.style._layers[o].resize()}setup(){let e=this.context,n=new p.aX;n.emplaceBack(0,0),n.emplaceBack(p.X,0),n.emplaceBack(0,p.X),n.emplaceBack(p.X,p.X),this.tileExtentBuffer=e.createVertexBuffer(n,xn.members),this.tileExtentSegments=p.a0.simpleSegment(0,0,4,2);let s=new p.aX;s.emplaceBack(0,0),s.emplaceBack(p.X,0),s.emplaceBack(0,p.X),s.emplaceBack(p.X,p.X),this.debugBuffer=e.createVertexBuffer(s,xn.members),this.debugSegments=p.a0.simpleSegment(0,0,4,5);let o=new p.$;o.emplaceBack(0,0,0,0),o.emplaceBack(p.X,0,p.X,0),o.emplaceBack(0,p.X,0,p.X),o.emplaceBack(p.X,p.X,p.X,p.X),this.rasterBoundsBuffer=e.createVertexBuffer(o,Mr.members),this.rasterBoundsSegments=p.a0.simpleSegment(0,0,4,2);let u=new p.aX;u.emplaceBack(0,0),u.emplaceBack(1,0),u.emplaceBack(0,1),u.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(u,xn.members),this.viewportSegments=p.a0.simpleSegment(0,0,4,2);let m=new p.aZ;m.emplaceBack(0),m.emplaceBack(1),m.emplaceBack(3),m.emplaceBack(2),m.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(m);let _=new p.aY;_.emplaceBack(0,1,2),_.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(_);let y=this.context.gl;this.stencilClearMode=new Yt({func:y.ALWAYS,mask:0},0,255,y.ZERO,y.ZERO,y.ZERO)}clearStencil(){let e=this.context,n=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let s=p.H();p.aP(s,0,this.width,this.height,0,0,1),p.K(s,s,[n.drawingBufferWidth,n.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(e,n.TRIANGLES,At.disabled,this.stencilClearMode,di.disabled,Gt.disabled,Yi(s),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(e,n){if(this.currentStencilSource===e.source||!e.isTileClipped()||!n||!n.length)return;this.currentStencilSource=e.source;let s=this.context,o=s.gl;this.nextStencilID+n.length>256&&this.clearStencil(),s.setColorMode(di.disabled),s.setDepthMode(At.disabled);let u=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(let m of n){let _=this._tileClippingMaskIDs[m.key]=this.nextStencilID++,y=this.style.map.terrain&&this.style.map.terrain.getTerrainData(m);u.draw(s,o.TRIANGLES,At.disabled,new Yt({func:o.ALWAYS,mask:0},_,255,o.KEEP,o.KEEP,o.REPLACE),di.disabled,Gt.disabled,Yi(m.posMatrix),y,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let e=this.nextStencilID++,n=this.context.gl;return new Yt({func:n.NOTEQUAL,mask:255},e,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(e){let n=this.context.gl;return new Yt({func:n.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,n.KEEP,n.KEEP,n.REPLACE)}stencilConfigForOverlap(e){let n=this.context.gl,s=e.sort((m,_)=>_.overscaledZ-m.overscaledZ),o=s[s.length-1].overscaledZ,u=s[0].overscaledZ-o+1;if(u>1){this.currentStencilSource=void 0,this.nextStencilID+u>256&&this.clearStencil();let m={};for(let _=0;_<u;_++)m[_+o]=new Yt({func:n.GEQUAL,mask:255},_+this.nextStencilID,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID+=u,[m,s]}return[{[o]:Yt.disabled},s]}colorModeForRenderPass(){let e=this.context.gl;return this._showOverdrawInspector?new di([e.CONSTANT_COLOR,e.ONE],new p.aM(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?di.unblended:di.alphaBlended}depthModeForSublayer(e,n,s){if(!this.opaquePassEnabledForLayer())return At.disabled;let o=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new At(s||this.context.gl.LEQUAL,n,[o,o])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(e,n){this.style=e,this.options=n,this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(se.now()),this.imageManager.beginFrame();let s=this.style._order,o=this.style.sourceCaches,u={},m={},_={};for(let y in o){let b=o[y];b.used&&b.prepare(this.context),u[y]=b.getVisibleCoordinates(),m[y]=u[y].slice().reverse(),_[y]=b.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let y=0;y<s.length;y++)if(this.style._layers[s[y]].is3D()){this.opaquePassCutoff=y;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(let y of s){let b=this.style._layers[y];if(!b.hasOffscreenPass()||b.isHidden(this.transform.zoom))continue;let T=m[b.source];(b.type==="custom"||T.length)&&this.renderLayer(this,o[b.source],b,T)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:n.showOverdrawInspector?p.aM.black:p.aM.transparent,depth:1}),this.clearStencil(),this.style.sky&&function(y,b){let T=y.context,C=T.gl,P=((G,W,N)=>({u_sky_color:G.properties.get("sky-color"),u_horizon_color:G.properties.get("horizon-color"),u_horizon:(W.height/2+W.getHorizon())*N,u_sky_horizon_blend:G.properties.get("sky-horizon-blend")*W.height/2*N}))(b,y.style.map.transform,y.pixelRatio),L=new At(C.LEQUAL,At.ReadWrite,[0,1]),O=Yt.disabled,U=y.colorModeForRenderPass(),Z=y.useProgram("sky");if(!b.mesh){let G=new p.aX;G.emplaceBack(-1,-1),G.emplaceBack(1,-1),G.emplaceBack(1,1),G.emplaceBack(-1,1);let W=new p.aY;W.emplaceBack(0,1,2),W.emplaceBack(0,2,3),b.mesh=new hs(T.createVertexBuffer(G,xn.members),T.createIndexBuffer(W),p.a0.simpleSegment(0,0,G.length,W.length))}Z.draw(T,C.TRIANGLES,L,O,U,Gt.disabled,P,void 0,"sky",b.mesh.vertexBuffer,b.mesh.indexBuffer,b.mesh.segments)}(this,this.style.sky),this._showOverdrawInspector=n.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=s.length-1;this.currentLayer>=0;this.currentLayer--){let y=this.style._layers[s[this.currentLayer]],b=o[y.source],T=u[y.source];this._renderTileClippingMasks(y,T),this.renderLayer(this,b,y,T)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<s.length;this.currentLayer++){let y=this.style._layers[s[this.currentLayer]],b=o[y.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(y))continue;let T=(y.type==="symbol"?_:m)[y.source];this._renderTileClippingMasks(y,u[y.source]),this.renderLayer(this,b,y,T)}if(this.options.showTileBoundaries){let y=function(b,T){let C=null,P=Object.values(b._layers).flatMap(Z=>Z.source&&!Z.isHidden(T)?[b.sourceCaches[Z.source]]:[]),L=P.filter(Z=>Z.getSource().type==="vector"),O=P.filter(Z=>Z.getSource().type!=="vector"),U=Z=>{(!C||C.getSource().maxzoom<Z.getSource().maxzoom)&&(C=Z)};return L.forEach(Z=>U(Z)),C||O.forEach(Z=>U(Z)),C}(this.style,this.transform.zoom);y&&function(b,T,C){for(let P=0;P<C.length;P++)ql(b,T,C[P])}(this,y,y.getVisibleCoordinates())}this.options.showPadding&&function(y){let b=y.transform.padding;Jn(y,y.transform.height-(b.top||0),3,xo),Jn(y,b.bottom||0,3,Rt),Nl(y,b.left||0,3,us),Nl(y,y.transform.width-(b.right||0),3,Ju);let T=y.transform.centerPoint;(function(C,P,L,O){cs(C,P-1,L-10,2,20,O),cs(C,P-10,L-1,20,2,O)})(y,T.x,y.transform.height-T.y,Ol)}(this),this.context.setDefault()}maybeDrawDepthAndCoords(e){if(!this.style||!this.style.map||!this.style.map.terrain)return;let n=this.terrainFacilitator.matrix,s=this.transform.modelViewProjectionMatrix,o=this.terrainFacilitator.dirty;o||(o=e?!p.a_(n,s):!p.a$(n,s)),o||(o=this.style.map.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime).length>0),o&&(p.b0(n,s),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(u,m){let _=u.context,y=_.gl,b=di.unblended,T=new At(y.LEQUAL,At.ReadWrite,[0,1]),C=m.getTerrainMesh(),P=m.sourceCache.getRenderableTiles(),L=u.useProgram("terrainDepth");_.bindFramebuffer.set(m.getFramebuffer("depth").framebuffer),_.viewport.set([0,0,u.width/devicePixelRatio,u.height/devicePixelRatio]),_.clear({color:p.aM.transparent,depth:1});for(let O of P){let U=m.getTerrainData(O.tileID),Z={u_matrix:u.transform.calculatePosMatrix(O.tileID.toUnwrapped()),u_ele_delta:m.getMeshFrameDelta(u.transform.zoom)};L.draw(_,y.TRIANGLES,T,Yt.disabled,b,Gt.backCCW,Z,U,"terrain",C.vertexBuffer,C.indexBuffer,C.segments)}_.bindFramebuffer.set(null),_.viewport.set([0,0,u.width,u.height])}(this,this.style.map.terrain),function(u,m){let _=u.context,y=_.gl,b=di.unblended,T=new At(y.LEQUAL,At.ReadWrite,[0,1]),C=m.getTerrainMesh(),P=m.getCoordsTexture(),L=m.sourceCache.getRenderableTiles(),O=u.useProgram("terrainCoords");_.bindFramebuffer.set(m.getFramebuffer("coords").framebuffer),_.viewport.set([0,0,u.width/devicePixelRatio,u.height/devicePixelRatio]),_.clear({color:p.aM.transparent,depth:1}),m.coordsIndex=[];for(let U of L){let Z=m.getTerrainData(U.tileID);_.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,P.texture);let G={u_matrix:u.transform.calculatePosMatrix(U.tileID.toUnwrapped()),u_terrain_coords_id:(255-m.coordsIndex.length)/255,u_texture:0,u_ele_delta:m.getMeshFrameDelta(u.transform.zoom)};O.draw(_,y.TRIANGLES,T,Yt.disabled,b,Gt.backCCW,G,Z,"terrain",C.vertexBuffer,C.indexBuffer,C.segments),m.coordsIndex.push(U.tileID.key)}_.bindFramebuffer.set(null),_.viewport.set([0,0,u.width,u.height])}(this,this.style.map.terrain))}renderLayer(e,n,s,o){if(!s.isHidden(this.transform.zoom)&&(s.type==="background"||s.type==="custom"||(o||[]).length))switch(this.id=s.id,s.type){case"symbol":(function(u,m,_,y,b){if(u.renderPass!=="translucent")return;let T=Yt.disabled,C=u.colorModeForRenderPass();(_._unevaluatedLayout.hasValue("text-variable-anchor")||_._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(P,L,O,U,Z,G,W,N,Q){let te=L.transform,ae=vn(),fe=Z==="map",ve=G==="map";for(let ke of P){let Oe=U.getTile(ke),Te=Oe.getBucket(O);if(!Te||!Te.text||!Te.text.segments.get().length)continue;let Ee=p.ag(Te.textSizeData,te.zoom),$e=Tt(Oe,1,L.transform.zoom),ct=on(ke.posMatrix,ve,fe,L.transform,$e),Se=O.layout.get("icon-text-fit")!=="none"&&Te.hasIconData();if(Ee){let ze=Math.pow(2,te.zoom-Oe.tileID.overscaledZ),ot=L.style.map.terrain?(yt,Ct)=>L.style.map.terrain.getElevation(ke,yt,Ct):null,ii=ae.translatePosition(te,Oe,W,N);Gn(Te,fe,ve,Q,te,ct,ke.posMatrix,ze,Ee,Se,ae,ii,ke.toUnwrapped(),ot)}}}(y,u,_,m,_.layout.get("text-rotation-alignment"),_.layout.get("text-pitch-alignment"),_.paint.get("text-translate"),_.paint.get("text-translate-anchor"),b),_.paint.get("icon-opacity").constantOr(1)!==0&&_o(u,m,_,y,!1,_.paint.get("icon-translate"),_.paint.get("icon-translate-anchor"),_.layout.get("icon-rotation-alignment"),_.layout.get("icon-pitch-alignment"),_.layout.get("icon-keep-upright"),T,C),_.paint.get("text-opacity").constantOr(1)!==0&&_o(u,m,_,y,!0,_.paint.get("text-translate"),_.paint.get("text-translate-anchor"),_.layout.get("text-rotation-alignment"),_.layout.get("text-pitch-alignment"),_.layout.get("text-keep-upright"),T,C),m.map.showCollisionBoxes&&(Da(u,m,_,y,!0),Da(u,m,_,y,!1))})(e,n,s,o,this.style.placement.variableOffsets);break;case"circle":(function(u,m,_,y){if(u.renderPass!=="translucent")return;let b=_.paint.get("circle-opacity"),T=_.paint.get("circle-stroke-width"),C=_.paint.get("circle-stroke-opacity"),P=!_.layout.get("circle-sort-key").isConstant();if(b.constantOr(1)===0&&(T.constantOr(1)===0||C.constantOr(1)===0))return;let L=u.context,O=L.gl,U=u.depthModeForSublayer(0,At.ReadOnly),Z=Yt.disabled,G=u.colorModeForRenderPass(),W=[];for(let N=0;N<y.length;N++){let Q=y[N],te=m.getTile(Q),ae=te.getBucket(_);if(!ae)continue;let fe=ae.programConfigurations.get(_.id),ve=u.useProgram("circle",fe),ke=ae.layoutVertexBuffer,Oe=ae.indexBuffer,Te=u.style.map.terrain&&u.style.map.terrain.getTerrainData(Q),Ee={programConfiguration:fe,program:ve,layoutVertexBuffer:ke,indexBuffer:Oe,uniformValues:Ru(u,Q,te,_),terrainData:Te};if(P){let $e=ae.segments.get();for(let ct of $e)W.push({segments:new p.a0([ct]),sortKey:ct.sortKey,state:Ee})}else W.push({segments:ae.segments,sortKey:0,state:Ee})}P&&W.sort((N,Q)=>N.sortKey-Q.sortKey);for(let N of W){let{programConfiguration:Q,program:te,layoutVertexBuffer:ae,indexBuffer:fe,uniformValues:ve,terrainData:ke}=N.state;te.draw(L,O.TRIANGLES,U,Z,G,Gt.disabled,ve,ke,_.id,ae,fe,N.segments,_.paint,u.transform.zoom,Q)}})(e,n,s,o);break;case"heatmap":(function(u,m,_,y){if(_.paint.get("heatmap-opacity")===0)return;let b=u.context;if(u.style.map.terrain){for(let T of y){let C=m.getTile(T);m.hasRenderableParent(T)||(u.renderPass==="offscreen"?vo(u,C,_,T):u.renderPass==="translucent"&&Dn(u,_,T))}b.viewport.set([0,0,u.width,u.height])}else u.renderPass==="offscreen"?function(T,C,P,L){let O=T.context,U=O.gl,Z=Yt.disabled,G=new di([U.ONE,U.ONE],p.aM.transparent,[!0,!0,!0,!0]);(function(W,N,Q){let te=W.gl;W.activeTexture.set(te.TEXTURE1),W.viewport.set([0,0,N.width/4,N.height/4]);let ae=Q.heatmapFbos.get(p.aU);ae?(te.bindTexture(te.TEXTURE_2D,ae.colorAttachment.get()),W.bindFramebuffer.set(ae.framebuffer)):(ae=Ia(W,N.width/4,N.height/4),Q.heatmapFbos.set(p.aU,ae))})(O,T,P),O.clear({color:p.aM.transparent});for(let W=0;W<L.length;W++){let N=L[W];if(C.hasRenderableParent(N))continue;let Q=C.getTile(N),te=Q.getBucket(P);if(!te)continue;let ae=te.programConfigurations.get(P.id),fe=T.useProgram("heatmap",ae),{zoom:ve}=T.transform;fe.draw(O,U.TRIANGLES,At.disabled,Z,G,Gt.disabled,Qi(N.posMatrix,Q,ve,P.paint.get("heatmap-intensity")),null,P.id,te.layoutVertexBuffer,te.indexBuffer,te.segments,P.paint,T.transform.zoom,ae)}O.viewport.set([0,0,T.width,T.height])}(u,m,_,y):u.renderPass==="translucent"&&function(T,C){let P=T.context,L=P.gl;P.setColorMode(T.colorModeForRenderPass());let O=C.heatmapFbos.get(p.aU);O&&(P.activeTexture.set(L.TEXTURE0),L.bindTexture(L.TEXTURE_2D,O.colorAttachment.get()),P.activeTexture.set(L.TEXTURE1),ka(P,C).bind(L.LINEAR,L.CLAMP_TO_EDGE),T.useProgram("heatmapTexture").draw(P,L.TRIANGLES,At.disabled,Yt.disabled,T.colorModeForRenderPass(),Gt.disabled,Qa(T,C,0,1),null,C.id,T.viewportBuffer,T.quadTriangleIndexBuffer,T.viewportSegments,C.paint,T.transform.zoom))}(u,_)})(e,n,s,o);break;case"line":(function(u,m,_,y){if(u.renderPass!=="translucent")return;let b=_.paint.get("line-opacity"),T=_.paint.get("line-width");if(b.constantOr(1)===0||T.constantOr(1)===0)return;let C=u.depthModeForSublayer(0,At.ReadOnly),P=u.colorModeForRenderPass(),L=_.paint.get("line-dasharray"),O=_.paint.get("line-pattern"),U=O.constantOr(1),Z=_.paint.get("line-gradient"),G=_.getCrossfadeParameters(),W=U?"linePattern":L?"lineSDF":Z?"lineGradient":"line",N=u.context,Q=N.gl,te=!0;for(let ae of y){let fe=m.getTile(ae);if(U&&!fe.patternsLoaded())continue;let ve=fe.getBucket(_);if(!ve)continue;let ke=ve.programConfigurations.get(_.id),Oe=u.context.program.get(),Te=u.useProgram(W,ke),Ee=te||Te.program!==Oe,$e=u.style.map.terrain&&u.style.map.terrain.getTerrainData(ae),ct=O.constantOr(null);if(ct&&fe.imageAtlas){let ot=fe.imageAtlas,ii=ot.patternPositions[ct.to.toString()],yt=ot.patternPositions[ct.from.toString()];ii&&yt&&ke.setConstantPatternPositions(ii,yt)}let Se=$e?ae:null,ze=U?$n(u,fe,_,G,Se):L?Fu(u,fe,_,L,G,Se):Z?bl(u,fe,_,ve.lineClipsArray.length,Se):ts(u,fe,_,Se);if(U)N.activeTexture.set(Q.TEXTURE0),fe.imageAtlasTexture.bind(Q.LINEAR,Q.CLAMP_TO_EDGE),ke.updatePaintBuffers(G);else if(L&&(Ee||u.lineAtlas.dirty))N.activeTexture.set(Q.TEXTURE0),u.lineAtlas.bind(N);else if(Z){let ot=ve.gradients[_.id],ii=ot.texture;if(_.gradientVersion!==ot.version){let yt=256;if(_.stepInterpolant){let Ct=m.getSource().maxzoom,ri=ae.canonical.z===Ct?Math.ceil(1<<u.transform.maxZoom-ae.canonical.z):1;yt=p.ac(p.aV(ve.maxLineLength/p.X*1024*ri),256,N.maxTextureSize)}ot.gradient=p.aW({expression:_.gradientExpression(),evaluationKey:"lineProgress",resolution:yt,image:ot.gradient||void 0,clips:ve.lineClipsArray}),ot.texture?ot.texture.update(ot.gradient):ot.texture=new ye(N,ot.gradient,Q.RGBA),ot.version=_.gradientVersion,ii=ot.texture}N.activeTexture.set(Q.TEXTURE0),ii.bind(_.stepInterpolant?Q.NEAREST:Q.LINEAR,Q.CLAMP_TO_EDGE)}Te.draw(N,Q.TRIANGLES,C,u.stencilModeForClipping(ae),P,Gt.disabled,ze,$e,_.id,ve.layoutVertexBuffer,ve.indexBuffer,ve.segments,_.paint,u.transform.zoom,ke,ve.layoutVertexBuffer2),te=!1}})(e,n,s,o);break;case"fill":(function(u,m,_,y){let b=_.paint.get("fill-color"),T=_.paint.get("fill-opacity");if(T.constantOr(1)===0)return;let C=u.colorModeForRenderPass(),P=_.paint.get("fill-pattern"),L=u.opaquePassEnabledForLayer()&&!P.constantOr(1)&&b.constantOr(p.aM.transparent).a===1&&T.constantOr(0)===1?"opaque":"translucent";if(u.renderPass===L){let O=u.depthModeForSublayer(1,u.renderPass==="opaque"?At.ReadWrite:At.ReadOnly);Ma(u,m,_,y,O,C,!1)}if(u.renderPass==="translucent"&&_.paint.get("fill-antialias")){let O=u.depthModeForSublayer(_.getPaintProperty("fill-outline-color")?2:0,At.ReadOnly);Ma(u,m,_,y,O,C,!0)}})(e,n,s,o);break;case"fill-extrusion":(function(u,m,_,y){let b=_.paint.get("fill-extrusion-opacity");if(b!==0&&u.renderPass==="translucent"){let T=new At(u.context.gl.LEQUAL,At.ReadWrite,u.depthRangeFor3D);if(b!==1||_.paint.get("fill-extrusion-pattern").constantOr(1))ls(u,m,_,y,T,Yt.disabled,di.disabled),ls(u,m,_,y,T,u.stencilModeFor3D(),u.colorModeForRenderPass());else{let C=u.colorModeForRenderPass();ls(u,m,_,y,T,Yt.disabled,C)}}})(e,n,s,o);break;case"hillshade":(function(u,m,_,y){if(u.renderPass!=="offscreen"&&u.renderPass!=="translucent")return;let b=u.context,T=u.depthModeForSublayer(0,At.ReadOnly),C=u.colorModeForRenderPass(),[P,L]=u.renderPass==="translucent"?u.stencilConfigForOverlap(y):[{},y];for(let O of L){let U=m.getTile(O);U.needsHillshadePrepare!==void 0&&U.needsHillshadePrepare&&u.renderPass==="offscreen"?Wn(u,U,_,T,Yt.disabled,C):u.renderPass==="translucent"&&Xn(u,O,U,_,T,P[O.overscaledZ],C)}b.viewport.set([0,0,u.width,u.height])})(e,n,s,o);break;case"raster":(function(u,m,_,y){if(u.renderPass!=="translucent"||_.paint.get("raster-opacity")===0||!y.length)return;let b=u.context,T=b.gl,C=m.getSource(),P=u.useProgram("raster"),L=u.colorModeForRenderPass(),[O,U]=C instanceof Wi?[{},y]:u.stencilConfigForOverlap(y),Z=U[U.length-1].overscaledZ,G=!u.options.moving;for(let W of U){let N=u.depthModeForSublayer(W.overscaledZ-Z,_.paint.get("raster-opacity")===1?At.ReadWrite:At.ReadOnly,T.LESS),Q=m.getTile(W);Q.registerFadeDuration(_.paint.get("raster-fade-duration"));let te=m.findLoadedParent(W,0),ae=m.findLoadedSibling(W),fe=Fl(Q,te||ae||null,m,_,u.transform,u.style.map.terrain),ve,ke,Oe=_.paint.get("raster-resampling")==="nearest"?T.NEAREST:T.LINEAR;b.activeTexture.set(T.TEXTURE0),Q.texture.bind(Oe,T.CLAMP_TO_EDGE,T.LINEAR_MIPMAP_NEAREST),b.activeTexture.set(T.TEXTURE1),te?(te.texture.bind(Oe,T.CLAMP_TO_EDGE,T.LINEAR_MIPMAP_NEAREST),ve=Math.pow(2,te.tileID.overscaledZ-Q.tileID.overscaledZ),ke=[Q.tileID.canonical.x*ve%1,Q.tileID.canonical.y*ve%1]):Q.texture.bind(Oe,T.CLAMP_TO_EDGE,T.LINEAR_MIPMAP_NEAREST),Q.texture.useMipmap&&b.extTextureFilterAnisotropic&&u.transform.pitch>20&&T.texParameterf(T.TEXTURE_2D,b.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,b.extTextureFilterAnisotropicMax);let Te=u.style.map.terrain&&u.style.map.terrain.getTerrainData(W),Ee=Te?W:null,$e=Ee?Ee.posMatrix:u.transform.calculatePosMatrix(W.toUnwrapped(),G),ct=Ou($e,ke||[0,0],ve||1,fe,_);C instanceof Wi?P.draw(b,T.TRIANGLES,N,Yt.disabled,L,Gt.disabled,ct,Te,_.id,C.boundsBuffer,u.quadTriangleIndexBuffer,C.boundsSegments):P.draw(b,T.TRIANGLES,N,O[W.overscaledZ],L,Gt.disabled,ct,Te,_.id,u.rasterBoundsBuffer,u.quadTriangleIndexBuffer,u.rasterBoundsSegments)}})(e,n,s,o);break;case"background":(function(u,m,_,y){let b=_.paint.get("background-color"),T=_.paint.get("background-opacity");if(T===0)return;let C=u.context,P=C.gl,L=u.transform,O=L.tileSize,U=_.paint.get("background-pattern");if(u.isPatternMissing(U))return;let Z=!U&&b.a===1&&T===1&&u.opaquePassEnabledForLayer()?"opaque":"translucent";if(u.renderPass!==Z)return;let G=Yt.disabled,W=u.depthModeForSublayer(0,Z==="opaque"?At.ReadWrite:At.ReadOnly),N=u.colorModeForRenderPass(),Q=u.useProgram(U?"backgroundPattern":"background"),te=y||L.coveringTiles({tileSize:O,terrain:u.style.map.terrain});U&&(C.activeTexture.set(P.TEXTURE0),u.imageManager.bind(u.context));let ae=_.getCrossfadeParameters();for(let fe of te){let ve=y?fe.posMatrix:u.transform.calculatePosMatrix(fe.toUnwrapped()),ke=U?ao(ve,T,u,U,{tileID:fe,tileSize:O},ae):is(ve,T,b),Oe=u.style.map.terrain&&u.style.map.terrain.getTerrainData(fe);Q.draw(C,P.TRIANGLES,W,G,N,Gt.disabled,ke,Oe,_.id,u.tileExtentBuffer,u.quadTriangleIndexBuffer,u.tileExtentSegments)}})(e,0,s,o);break;case"custom":(function(u,m,_){let y=u.context,b=_.implementation;if(u.renderPass==="offscreen"){let T=b.prerender;T&&(u.setCustomLayerDefaults(),y.setColorMode(u.colorModeForRenderPass()),T.call(b,y.gl,u.transform.customLayerMatrix()),y.setDirty(),u.setBaseState())}else if(u.renderPass==="translucent"){u.setCustomLayerDefaults(),y.setColorMode(u.colorModeForRenderPass()),y.setStencilMode(Yt.disabled);let T=b.renderingMode==="3d"?new At(u.context.gl.LEQUAL,At.ReadWrite,u.depthRangeFor3D):u.depthModeForSublayer(0,At.ReadOnly);y.setDepthMode(T),b.render(y.gl,u.transform.customLayerMatrix(),{farZ:u.transform.farZ,nearZ:u.transform.nearZ,fov:u.transform._fov,modelViewProjectionMatrix:u.transform.modelViewProjectionMatrix,projectionMatrix:u.transform.projectionMatrix}),y.setDirty(),u.setBaseState(),y.bindFramebuffer.set(null)}})(e,0,s)}}translatePosMatrix(e,n,s,o,u){if(!s[0]&&!s[1])return e;let m=u?o==="map"?this.transform.angle:0:o==="viewport"?-this.transform.angle:0;if(m){let b=Math.sin(m),T=Math.cos(m);s=[s[0]*T-s[1]*b,s[0]*b+s[1]*T]}let _=[u?s[0]:Tt(n,s[0],this.transform.zoom),u?s[1]:Tt(n,s[1],this.transform.zoom),0],y=new Float32Array(16);return p.J(y,e,_),y}saveTileTexture(e){let n=this._tileTextures[e.size[0]];n?n.push(e):this._tileTextures[e.size[0]]=[e]}getTileTexture(e){let n=this._tileTextures[e];return n&&n.length>0?n.pop():null}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;let n=this.imageManager.getPattern(e.from.toString()),s=this.imageManager.getPattern(e.to.toString());return!n||!s}useProgram(e,n){this.cache=this.cache||{};let s=e+(n?n.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[s]||(this.cache[s]=new ro(this.context,ln[e],n,so[e],this._showOverdrawInspector,this.style.map.terrain)),this.cache[s]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){let e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new ye(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){let{drawingBufferWidth:e,drawingBufferHeight:n}=this.context.gl;return this.width!==e||this.height!==n}}class Kn{constructor(e,n){this.points=e,this.planes=n}static fromInvProjectionMatrix(e,n,s){let o=Math.pow(2,s),u=[[-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(_=>{let y=1/(_=p.af([],_,e))[3]/n*o;return p.b1(_,_,[y,y,1/_[3],y])}),m=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(_=>{let y=function(P,L){var O=L[0],U=L[1],Z=L[2],G=O*O+U*U+Z*Z;return G>0&&(G=1/Math.sqrt(G)),P[0]=L[0]*G,P[1]=L[1]*G,P[2]=L[2]*G,P}([],function(P,L,O){var U=L[0],Z=L[1],G=L[2],W=O[0],N=O[1],Q=O[2];return P[0]=Z*Q-G*N,P[1]=G*W-U*Q,P[2]=U*N-Z*W,P}([],Ye([],u[_[0]],u[_[1]]),Ye([],u[_[2]],u[_[1]]))),b=-((T=y)[0]*(C=u[_[1]])[0]+T[1]*C[1]+T[2]*C[2]);var T,C;return y.concat(b)});return new Kn(u,m)}}class Yn{constructor(e,n){this.min=e,this.max=n,this.center=function(s,o,u){return s[0]=.5*o[0],s[1]=.5*o[1],s[2]=.5*o[2],s}([],function(s,o,u){return s[0]=o[0]+u[0],s[1]=o[1]+u[1],s[2]=o[2]+u[2],s}([],this.min,this.max))}quadrant(e){let n=[e%2==0,e<2],s=Re(this.min),o=Re(this.max);for(let u=0;u<n.length;u++)s[u]=n[u]?this.min[u]:this.center[u],o[u]=n[u]?this.center[u]:this.max[u];return o[2]=this.max[2],new Yn(s,o)}distanceX(e){return Math.max(Math.min(this.max[0],e[0]),this.min[0])-e[0]}distanceY(e){return Math.max(Math.min(this.max[1],e[1]),this.min[1])-e[1]}intersects(e){let n=[[this.min[0],this.min[1],this.min[2],1],[this.max[0],this.min[1],this.min[2],1],[this.max[0],this.max[1],this.min[2],1],[this.min[0],this.max[1],this.min[2],1],[this.min[0],this.min[1],this.max[2],1],[this.max[0],this.min[1],this.max[2],1],[this.max[0],this.max[1],this.max[2],1],[this.min[0],this.max[1],this.max[2],1]],s=!0;for(let o=0;o<e.planes.length;o++){let u=e.planes[o],m=0;for(let _=0;_<n.length;_++)p.b2(u,n[_])>=0&&m++;if(m===0)return 0;m!==n.length&&(s=!1)}if(s)return 2;for(let o=0;o<3;o++){let u=Number.MAX_VALUE,m=-Number.MAX_VALUE;for(let _=0;_<e.points.length;_++){let y=e.points[_][o]-this.min[o];u=Math.min(u,y),m=Math.max(m,y)}if(m<0||u>this.max[o]-this.min[o])return 0}return 1}}class Qn{constructor(e=0,n=0,s=0,o=0){if(isNaN(e)||e<0||isNaN(n)||n<0||isNaN(s)||s<0||isNaN(o)||o<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=e,this.bottom=n,this.left=s,this.right=o}interpolate(e,n,s){return n.top!=null&&e.top!=null&&(this.top=p.y.number(e.top,n.top,s)),n.bottom!=null&&e.bottom!=null&&(this.bottom=p.y.number(e.bottom,n.bottom,s)),n.left!=null&&e.left!=null&&(this.left=p.y.number(e.left,n.left,s)),n.right!=null&&e.right!=null&&(this.right=p.y.number(e.right,n.right,s)),this}getCenter(e,n){let s=p.ac((this.left+e-this.right)/2,0,e),o=p.ac((this.top+n-this.bottom)/2,0,n);return new p.P(s,o)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new Qn(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}let bo=85.051129;class ea{constructor(e,n,s,o,u){this.tileSize=512,this._renderWorldCopies=u===void 0||!!u,this._minZoom=e||0,this._maxZoom=n||22,this._minPitch=s??0,this._maxPitch=o??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new p.N(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new Qn,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={},this.minElevationForCurrentTile=0}clone(){let e=new ea(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return e.apply(this),e}apply(e){this.tileSize=e.tileSize,this.latRange=e.latRange,this.lngRange=e.lngRange,this.width=e.width,this.height=e.height,this._center=e._center,this._elevation=e._elevation,this.minElevationForCurrentTile=e.minElevationForCurrentTile,this.zoom=e.zoom,this.angle=e.angle,this._fov=e._fov,this._pitch=e._pitch,this._unmodified=e._unmodified,this._edgeInsets=e._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(e){this._minZoom!==e&&(this._minZoom=e,this.zoom=Math.max(this.zoom,e))}get maxZoom(){return this._maxZoom}set maxZoom(e){this._maxZoom!==e&&(this._maxZoom=e,this.zoom=Math.min(this.zoom,e))}get minPitch(){return this._minPitch}set minPitch(e){this._minPitch!==e&&(this._minPitch=e,this.pitch=Math.max(this.pitch,e))}get maxPitch(){return this._maxPitch}set maxPitch(e){this._maxPitch!==e&&(this._maxPitch=e,this.pitch=Math.min(this.pitch,e))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(e){e===void 0?e=!0:e===null&&(e=!1),this._renderWorldCopies=e}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new p.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(e){let n=-p.b3(e,-180,180)*Math.PI/180;this.angle!==n&&(this._unmodified=!1,this.angle=n,this._calcMatrices(),this.rotationMatrix=function(){var s=new p.A(4);return p.A!=Float32Array&&(s[1]=0,s[2]=0),s[0]=1,s[3]=1,s}(),function(s,o,u){var m=o[0],_=o[1],y=o[2],b=o[3],T=Math.sin(u),C=Math.cos(u);s[0]=m*C+y*T,s[1]=_*C+b*T,s[2]=m*-T+y*C,s[3]=_*-T+b*C}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(e){let n=p.ac(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==n&&(this._unmodified=!1,this._pitch=n,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(e){e=Math.max(.01,Math.min(60,e)),this._fov!==e&&(this._unmodified=!1,this._fov=e/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(e){let n=Math.min(Math.max(e,this.minZoom),this.maxZoom);this._zoom!==n&&(this._unmodified=!1,this._zoom=n,this.tileZoom=Math.max(0,Math.floor(n)),this.scale=this.zoomScale(n),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(e){e.lat===this._center.lat&&e.lng===this._center.lng||(this._unmodified=!1,this._center=e,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(e){e!==this._elevation&&(this._elevation=e,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(e){this._edgeInsets.equals(e)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,e,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,n,s){this._unmodified=!1,this._edgeInsets.interpolate(e,n,s),this._constrain(),this._calcMatrices()}coveringZoomLevel(e){let n=(e.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/e.tileSize));return Math.max(0,n)}getVisibleUnwrappedCoordinates(e){let n=[new p.b4(0,e)];if(this._renderWorldCopies){let s=this.pointCoordinate(new p.P(0,0)),o=this.pointCoordinate(new p.P(this.width,0)),u=this.pointCoordinate(new p.P(this.width,this.height)),m=this.pointCoordinate(new p.P(0,this.height)),_=Math.floor(Math.min(s.x,o.x,u.x,m.x)),y=Math.floor(Math.max(s.x,o.x,u.x,m.x)),b=1;for(let T=_-b;T<=y+b;T++)T!==0&&n.push(new p.b4(T,e))}return n}coveringTiles(e){var n,s;let o=this.coveringZoomLevel(e),u=o;if(e.minzoom!==void 0&&o<e.minzoom)return[];e.maxzoom!==void 0&&o>e.maxzoom&&(o=e.maxzoom);let m=this.pointCoordinate(this.getCameraPoint()),_=p.Z.fromLngLat(this.center),y=Math.pow(2,o),b=[y*m.x,y*m.y,0],T=[y*_.x,y*_.y,0],C=Kn.fromInvProjectionMatrix(this.invModelViewProjectionMatrix,this.worldSize,o),P=e.minzoom||0;!e.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(P=o);let L=e.terrain?2/Math.min(this.tileSize,e.tileSize)*this.tileSize:3,O=N=>({aabb:new Yn([N*y,0,0],[(N+1)*y,y,0]),zoom:0,x:0,y:0,wrap:N,fullyVisible:!1}),U=[],Z=[],G=o,W=e.reparseOverscaled?u:o;if(this._renderWorldCopies)for(let N=1;N<=3;N++)U.push(O(-N)),U.push(O(N));for(U.push(O(0));U.length>0;){let N=U.pop(),Q=N.x,te=N.y,ae=N.fullyVisible;if(!ae){let Te=N.aabb.intersects(C);if(Te===0)continue;ae=Te===2}let fe=e.terrain?b:T,ve=N.aabb.distanceX(fe),ke=N.aabb.distanceY(fe),Oe=Math.max(Math.abs(ve),Math.abs(ke));if(N.zoom===G||Oe>L+(1<<G-N.zoom)-2&&N.zoom>=P){let Te=G-N.zoom,Ee=b[0]-.5-(Q<<Te),$e=b[1]-.5-(te<<Te);Z.push({tileID:new p.S(N.zoom===G?W:N.zoom,N.wrap,N.zoom,Q,te),distanceSq:_e([T[0]-.5-Q,T[1]-.5-te]),tileDistanceToCamera:Math.sqrt(Ee*Ee+$e*$e)})}else for(let Te=0;Te<4;Te++){let Ee=(Q<<1)+Te%2,$e=(te<<1)+(Te>>1),ct=N.zoom+1,Se=N.aabb.quadrant(Te);if(e.terrain){let ze=new p.S(ct,N.wrap,ct,Ee,$e),ot=e.terrain.getMinMaxElevation(ze),ii=(n=ot.minElevation)!==null&&n!==void 0?n:this.elevation,yt=(s=ot.maxElevation)!==null&&s!==void 0?s:this.elevation;Se=new Yn([Se.min[0],Se.min[1],ii],[Se.max[0],Se.max[1],yt])}U.push({aabb:Se,zoom:ct,x:Ee,y:$e,wrap:N.wrap,fullyVisible:ae})}}return Z.sort((N,Q)=>N.distanceSq-Q.distanceSq).map(N=>N.tileID)}resize(e,n){this.width=e,this.height=n,this.pixelsToGLUnits=[2/e,-2/n],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(e){return Math.pow(2,e)}scaleZoom(e){return Math.log(e)/Math.LN2}project(e){let n=p.ac(e.lat,-85.051129,bo);return new p.P(p.O(e.lng)*this.worldSize,p.Q(n)*this.worldSize)}unproject(e){return new p.Z(e.x/this.worldSize,e.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(e){let n=this.elevation,s=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,o=this.pointLocation(this.centerPoint,e),u=e.getElevationForLngLatZoom(o,this.tileZoom);if(!(this.elevation-u))return;let m=s+n-u,_=Math.cos(this._pitch)*this.cameraToCenterDistance/m/p.b5(1,o.lat),y=this.scaleZoom(_/this.tileSize);this._elevation=u,this._center=o,this.zoom=y}setLocationAtPoint(e,n){let s=this.pointCoordinate(n),o=this.pointCoordinate(this.centerPoint),u=this.locationCoordinate(e),m=new p.Z(u.x-(s.x-o.x),u.y-(s.y-o.y));this.center=this.coordinateLocation(m),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(e,n){return n?this.coordinatePoint(this.locationCoordinate(e),n.getElevationForLngLatZoom(e,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(e))}pointLocation(e,n){return this.coordinateLocation(this.pointCoordinate(e,n))}locationCoordinate(e){return p.Z.fromLngLat(e)}coordinateLocation(e){return e&&e.toLngLat()}pointCoordinate(e,n){if(n){let P=n.pointCoordinate(e);if(P!=null)return P}let s=[e.x,e.y,0,1],o=[e.x,e.y,1,1];p.af(s,s,this.pixelMatrixInverse),p.af(o,o,this.pixelMatrixInverse);let u=s[3],m=o[3],_=s[1]/u,y=o[1]/m,b=s[2]/u,T=o[2]/m,C=b===T?0:(0-b)/(T-b);return new p.Z(p.y.number(s[0]/u,o[0]/m,C)/this.worldSize,p.y.number(_,y,C)/this.worldSize)}coordinatePoint(e,n=0,s=this.pixelMatrix){let o=[e.x*this.worldSize,e.y*this.worldSize,n,1];return p.af(o,o,s),new p.P(o[0]/o[3],o[1]/o[3])}getBounds(){let e=Math.max(0,this.height/2-this.getHorizon());return new oe().extend(this.pointLocation(new p.P(0,e))).extend(this.pointLocation(new p.P(this.width,e))).extend(this.pointLocation(new p.P(this.width,this.height))).extend(this.pointLocation(new p.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new oe([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(e){e?(this.lngRange=[e.getWest(),e.getEast()],this.latRange=[e.getSouth(),e.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,bo])}calculateTileMatrix(e){let n=e.canonical,s=this.worldSize/this.zoomScale(n.z),o=n.x+Math.pow(2,n.z)*e.wrap,u=p.an(new Float64Array(16));return p.J(u,u,[o*s,n.y*s,0]),p.K(u,u,[s/p.X,s/p.X,1]),u}calculatePosMatrix(e,n=!1){let s=e.key,o=n?this._alignedPosMatrixCache:this._posMatrixCache;if(o[s])return o[s];let u=this.calculateTileMatrix(e);return p.L(u,n?this.alignedModelViewProjectionMatrix:this.modelViewProjectionMatrix,u),o[s]=new Float32Array(u),o[s]}calculateFogMatrix(e){let n=e.key,s=this._fogMatrixCache;if(s[n])return s[n];let o=this.calculateTileMatrix(e);return p.L(o,this.fogMatrix,o),s[n]=new Float32Array(o),s[n]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(e,n){n=p.ac(+n,this.minZoom,this.maxZoom);let s={center:new p.N(e.lng,e.lat),zoom:n},o=this.lngRange;if(!this._renderWorldCopies&&o===null){let N=179.9999999999;o=[-N,N]}let u=this.tileSize*this.zoomScale(s.zoom),m=0,_=u,y=0,b=u,T=0,C=0,{x:P,y:L}=this.size;if(this.latRange){let N=this.latRange;m=p.Q(N[1])*u,_=p.Q(N[0])*u,_-m<L&&(T=L/(_-m))}o&&(y=p.b3(p.O(o[0])*u,0,u),b=p.b3(p.O(o[1])*u,0,u),b<y&&(b+=u),b-y<P&&(C=P/(b-y)));let{x:O,y:U}=this.project.call({worldSize:u},e),Z,G,W=Math.max(C||0,T||0);if(W){let N=new p.P(C?(b+y)/2:O,T?(_+m)/2:U);return s.center=this.unproject.call({worldSize:u},N).wrap(),s.zoom+=this.scaleZoom(W),s}if(this.latRange){let N=L/2;U-N<m&&(G=m+N),U+N>_&&(G=_-N)}if(o){let N=(y+b)/2,Q=O;this._renderWorldCopies&&(Q=p.b3(O,N-u/2,N+u/2));let te=P/2;Q-te<y&&(Z=y+te),Q+te>b&&(Z=b-te)}if(Z!==void 0||G!==void 0){let N=new p.P(Z??O,G??U);s.center=this.unproject.call({worldSize:u},N).wrap()}return s}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let e=this._unmodified,{center:n,zoom:s}=this.getConstrained(this.center,this.zoom);this.center=n,this.zoom=s,this._unmodified=e,this._constraining=!1}_calcMatrices(){if(!this.height)return;let e=this.centerOffset,n=this.point.x,s=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=p.b5(1,this.center.lat)*this.worldSize;let o=p.an(new Float64Array(16));p.K(o,o,[this.width/2,-this.height/2,1]),p.J(o,o,[1,-1,0]),this.labelPlaneMatrix=o,o=p.an(new Float64Array(16)),p.K(o,o,[1,-1,1]),p.J(o,o,[-1,-1,0]),p.K(o,o,[2/this.width,2/this.height,1]),this.glCoordMatrix=o;let u=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),m=Math.min(this.elevation,this.minElevationForCurrentTile),_=u-m*this._pixelPerMeter/Math.cos(this._pitch),y=m<0?_:u,b=Math.PI/2+this._pitch,T=this._fov*(.5+e.y/this.height),C=Math.sin(T)*y/Math.sin(p.ac(Math.PI-b-T,.01,Math.PI-.01)),P=this.getHorizon(),L=2*Math.atan(P/this.cameraToCenterDistance)*(.5+e.y/(2*P)),O=Math.sin(L)*y/Math.sin(p.ac(Math.PI-b-L,.01,Math.PI-.01)),U=Math.min(C,O);this.farZ=1.01*(Math.cos(Math.PI/2-this._pitch)*U+y),this.nearZ=this.height/50,o=new Float64Array(16),p.b6(o,this._fov,this.width/this.height,this.nearZ,this.farZ),o[8]=2*-e.x/this.width,o[9]=2*e.y/this.height,this.projectionMatrix=p.ae(o),p.K(o,o,[1,-1,1]),p.J(o,o,[0,0,-this.cameraToCenterDistance]),p.b7(o,o,this._pitch),p.ad(o,o,this.angle),p.J(o,o,[-n,-s,0]),this.mercatorMatrix=p.K([],o,[this.worldSize,this.worldSize,this.worldSize]),p.K(o,o,[1,1,this._pixelPerMeter]),this.pixelMatrix=p.L(new Float64Array(16),this.labelPlaneMatrix,o),p.J(o,o,[0,0,-this.elevation]),this.modelViewProjectionMatrix=o,this.invModelViewProjectionMatrix=p.as([],o),this.fogMatrix=new Float64Array(16),p.b6(this.fogMatrix,this._fov,this.width/this.height,u,this.farZ),this.fogMatrix[8]=2*-e.x/this.width,this.fogMatrix[9]=2*e.y/this.height,p.K(this.fogMatrix,this.fogMatrix,[1,-1,1]),p.J(this.fogMatrix,this.fogMatrix,[0,0,-this.cameraToCenterDistance]),p.b7(this.fogMatrix,this.fogMatrix,this._pitch),p.ad(this.fogMatrix,this.fogMatrix,this.angle),p.J(this.fogMatrix,this.fogMatrix,[-n,-s,0]),p.K(this.fogMatrix,this.fogMatrix,[1,1,this._pixelPerMeter]),p.J(this.fogMatrix,this.fogMatrix,[0,0,-this.elevation]),this.pixelMatrix3D=p.L(new Float64Array(16),this.labelPlaneMatrix,o);let Z=this.width%2/2,G=this.height%2/2,W=Math.cos(this.angle),N=Math.sin(this.angle),Q=n-Math.round(n)+W*Z+N*G,te=s-Math.round(s)+W*G+N*Z,ae=new Float64Array(o);if(p.J(ae,ae,[Q>.5?Q-1:Q,te>.5?te-1:te,0]),this.alignedModelViewProjectionMatrix=ae,o=p.as(new Float64Array(16),this.pixelMatrix),!o)throw new Error("failed to invert matrix");this.pixelMatrixInverse=o,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;let e=this.pointCoordinate(new p.P(0,0)),n=[e.x*this.worldSize,e.y*this.worldSize,0,1];return p.af(n,n,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){let e=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new p.P(0,e))}getCameraQueryGeometry(e){let n=this.getCameraPoint();if(e.length===1)return[e[0],n];{let s=n.x,o=n.y,u=n.x,m=n.y;for(let _ of e)s=Math.min(s,_.x),o=Math.min(o,_.y),u=Math.max(u,_.x),m=Math.max(m,_.y);return[new p.P(s,o),new p.P(u,o),new p.P(u,m),new p.P(s,m),new p.P(s,o)]}}lngLatToCameraDepth(e,n){let s=this.locationCoordinate(e),o=[s.x*this.worldSize,s.y*this.worldSize,n,1];return p.af(o,o,this.modelViewProjectionMatrix),o[2]/o[3]}}function Pa(c,e){let n,s=!1,o=null,u=null,m=()=>{o=null,s&&(c.apply(u,n),o=setTimeout(m,e),s=!1)};return(..._)=>(s=!0,u=this,n=_,o||m(),o)}class ds{constructor(e){this._getCurrentHash=()=>{let n=window.location.hash.replace("#","");if(this._hashName){let s;return n.split("&").map(o=>o.split("=")).forEach(o=>{o[0]===this._hashName&&(s=o)}),(s&&s[1]||"").split("/")}return n.split("/")},this._onHashChange=()=>{let n=this._getCurrentHash();if(n.length>=3&&!n.some(s=>isNaN(s))){let s=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(n[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+n[2],+n[1]],zoom:+n[0],bearing:s,pitch:+(n[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{let n=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,n)},this._removeHash=()=>{let n=this._getCurrentHash();if(n.length===0)return;let s=n.join("/"),o=s;o.split("&").length>0&&(o=o.split("&")[0]),this._hashName&&(o=`${this._hashName}=${s}`);let u=window.location.hash.replace(o,"");u.startsWith("#&")?u=u.slice(0,1)+u.slice(2):u==="#"&&(u="");let m=window.location.href.replace(/(#.+)?$/,u);m=m.replace("&&","&"),window.history.replaceState(window.history.state,null,m)},this._updateHash=Pa(this._updateHashUnthrottled,300),this._hashName=e&&encodeURIComponent(e)}addTo(e){return this._map=e,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(e){let n=this._map.getCenter(),s=Math.round(100*this._map.getZoom())/100,o=Math.ceil((s*Math.LN2+Math.log(512/360/.5))/Math.LN10),u=Math.pow(10,o),m=Math.round(n.lng*u)/u,_=Math.round(n.lat*u)/u,y=this._map.getBearing(),b=this._map.getPitch(),T="";if(T+=e?`/${m}/${_}/${s}`:`${s}/${_}/${m}`,(y||b)&&(T+="/"+Math.round(10*y)/10),b&&(T+=`/${Math.round(b)}`),this._hashName){let C=this._hashName,P=!1,L=window.location.hash.slice(1).split("&").map(O=>{let U=O.split("=")[0];return U===C?(P=!0,`${U}=${T}`):O}).filter(O=>O);return P||L.push(`${C}=${T}`),`#${L.join("&")}`}return`#${T}`}}let fs={linearity:.3,easing:p.b8(0,0,.3,1)},wo=p.e({deceleration:2500,maxSpeed:1400},fs),Ku=p.e({deceleration:20,maxSpeed:1400},fs),Ul=p.e({deceleration:1e3,maxSpeed:360},fs),ms=p.e({deceleration:1e3,maxSpeed:90},fs);class Ao{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:se.now(),settings:e})}_drainInertiaBuffer(){let e=this._inertiaBuffer,n=se.now();for(;e.length>0&&n-e[0].time>160;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;let n={zoom:0,bearing:0,pitch:0,pan:new p.P(0,0),pinchAround:void 0,around:void 0};for(let{settings:u}of this._inertiaBuffer)n.zoom+=u.zoomDelta||0,n.bearing+=u.bearingDelta||0,n.pitch+=u.pitchDelta||0,u.panDelta&&n.pan._add(u.panDelta),u.around&&(n.around=u.around),u.pinchAround&&(n.pinchAround=u.pinchAround);let s=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,o={};if(n.pan.mag()){let u=Ba(n.pan.mag(),s,p.e({},wo,e||{}));o.offset=n.pan.mult(u.amount/n.pan.mag()),o.center=this._map.transform.center,za(o,u)}if(n.zoom){let u=Ba(n.zoom,s,Ku);o.zoom=this._map.transform.zoom+u.amount,za(o,u)}if(n.bearing){let u=Ba(n.bearing,s,Ul);o.bearing=this._map.transform.bearing+p.ac(u.amount,-179,179),za(o,u)}if(n.pitch){let u=Ba(n.pitch,s,ms);o.pitch=this._map.transform.pitch+u.amount,za(o,u)}if(o.zoom||o.bearing){let u=n.pinchAround===void 0?n.around:n.pinchAround;o.around=u?this._map.unproject(u):this._map.getCenter()}return this.clear(),p.e(o,{noMoveStart:!0})}}function za(c,e){(!c.duration||c.duration<e.duration)&&(c.duration=e.duration,c.easing=e.easing)}function Ba(c,e,n){let{maxSpeed:s,linearity:o,deceleration:u}=n,m=p.ac(c*o/(e/1e3),-s,s),_=Math.abs(m)/(u*o);return{easing:n.easing,duration:1e3*_,amount:m*(_/2)}}class Pi extends p.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,n,s,o={}){let u=X.mousePos(n.getCanvas(),s),m=n.unproject(u);super(e,p.e({point:u,lngLat:m,originalEvent:s},o)),this._defaultPrevented=!1,this.target=n}}class Sn extends p.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,n,s){let o=e==="touchend"?s.changedTouches:s.touches,u=X.touchPos(n.getCanvasContainer(),o),m=u.map(y=>n.unproject(y)),_=u.reduce((y,b,T,C)=>y.add(b.div(C.length)),new p.P(0,0));super(e,{points:u,point:_,lngLats:m,lngLat:n.unproject(_),originalEvent:s}),this._defaultPrevented=!1}}class jl extends p.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,n,s){super(e,{originalEvent:s}),this._defaultPrevented=!1}}class $l{constructor(e,n){this._map=e,this._clickTolerance=n.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new jl(e.type,this._map,e))}mousedown(e,n){return this._mousedownPos=n,this._firePreventable(new Pi(e.type,this._map,e))}mouseup(e){this._map.fire(new Pi(e.type,this._map,e))}click(e,n){this._mousedownPos&&this._mousedownPos.dist(n)>=this._clickTolerance||this._map.fire(new Pi(e.type,this._map,e))}dblclick(e){return this._firePreventable(new Pi(e.type,this._map,e))}mouseover(e){this._map.fire(new Pi(e.type,this._map,e))}mouseout(e){this._map.fire(new Pi(e.type,this._map,e))}touchstart(e){return this._firePreventable(new Sn(e.type,this._map,e))}touchmove(e){this._map.fire(new Sn(e.type,this._map,e))}touchend(e){this._map.fire(new Sn(e.type,this._map,e))}touchcancel(e){this._map.fire(new Sn(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class fi{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new Pi(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Pi("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new Pi(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Rr{constructor(e){this._map=e}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(e){return this.transform.pointLocation(p.P.convert(e),this._map.terrain)}}class pr{constructor(e,n){this._map=e,this._tr=new Rr(e),this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=n.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,n){this.isEnabled()&&e.shiftKey&&e.button===0&&(X.disableDrag(),this._startPos=this._lastPos=n,this._active=!0)}mousemoveWindow(e,n){if(!this._active)return;let s=n;if(this._lastPos.equals(s)||!this._box&&s.dist(this._startPos)<this._clickTolerance)return;let o=this._startPos;this._lastPos=s,this._box||(this._box=X.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",e));let u=Math.min(o.x,s.x),m=Math.max(o.x,s.x),_=Math.min(o.y,s.y),y=Math.max(o.y,s.y);X.setTransform(this._box,`translate(${u}px,${_}px)`),this._box.style.width=m-u+"px",this._box.style.height=y-_+"px"}mouseupWindow(e,n){if(!this._active||e.button!==0)return;let s=this._startPos,o=n;if(this.reset(),X.suppressClick(),s.x!==o.x||s.y!==o.y)return this._map.fire(new p.k("boxzoomend",{originalEvent:e})),{cameraAnimation:u=>u.fitScreenCoordinates(s,o,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",e)}keydown(e){this._active&&e.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",e))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(X.remove(this._box),this._box=null),X.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,n){return this._map.fire(new p.k(e,{originalEvent:n}))}}function La(c,e){if(c.length!==e.length)throw new Error(`The number of touches and points are not equal - touches ${c.length}, points ${e.length}`);let n={};for(let s=0;s<c.length;s++)n[c[s].identifier]=e[s];return n}class Eo{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,n,s){(this.centroid||s.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=e.timeStamp),s.length===this.numTouches&&(this.centroid=function(o){let u=new p.P(0,0);for(let m of o)u._add(m);return u.div(o.length)}(n),this.touches=La(s,n)))}touchmove(e,n,s){if(this.aborted||!this.centroid)return;let o=La(s,n);for(let u in this.touches){let m=o[u];(!m||m.dist(this.touches[u])>30)&&(this.aborted=!0)}}touchend(e,n,s){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),s.length===0){let o=!this.aborted&&this.centroid;if(this.reset(),o)return o}}}class gs{constructor(e){this.singleTap=new Eo(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,n,s){this.singleTap.touchstart(e,n,s)}touchmove(e,n,s){this.singleTap.touchmove(e,n,s)}touchend(e,n,s){let o=this.singleTap.touchend(e,n,s);if(o){let u=e.timeStamp-this.lastTime<500,m=!this.lastTap||this.lastTap.dist(o)<30;if(u&&m||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=o,this.count===this.numTaps)return this.reset(),o}}}class ta{constructor(e){this._tr=new Rr(e),this._zoomIn=new gs({numTouches:1,numTaps:2}),this._zoomOut=new gs({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,n,s){this._zoomIn.touchstart(e,n,s),this._zoomOut.touchstart(e,n,s)}touchmove(e,n,s){this._zoomIn.touchmove(e,n,s),this._zoomOut.touchmove(e,n,s)}touchend(e,n,s){let o=this._zoomIn.touchend(e,n,s),u=this._zoomOut.touchend(e,n,s),m=this._tr;return o?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:m.zoom+1,around:m.unproject(o)},{originalEvent:e})}):u?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:m.zoom-1,around:m.unproject(u)},{originalEvent:e})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class tn{constructor(e){this._enabled=!!e.enable,this._moveStateManager=e.moveStateManager,this._clickTolerance=e.clickTolerance||1,this._moveFunction=e.move,this._activateOnStart=!!e.activateOnStart,e.assignEvents(this),this.reset()}reset(e){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(e)}_move(...e){let n=this._moveFunction(...e);if(n.bearingDelta||n.pitchDelta||n.around||n.panDelta)return this._active=!0,n}dragStart(e,n){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(e)&&(this._moveStateManager.startMove(e),this._lastPoint=n.length?n[0]:n,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(e,n){if(!this.isEnabled())return;let s=this._lastPoint;if(!s)return;if(e.preventDefault(),!this._moveStateManager.isValidMoveEvent(e))return void this.reset(e);let o=n.length?n[0]:n;return!this._moved&&o.dist(s)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=o,this._move(s,o))}dragEnd(e){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(e)&&(this._moved&&X.suppressClick(),this.reset(e))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}let To={0:1,2:2};class _s{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){let n=X.mouseButton(e);this._eventButton=n}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!function(n,s){let o=To[s];return n.buttons===void 0||(n.buttons&o)!==o}(e,this._eventButton)}isValidEndEvent(e){return X.mouseButton(e)===this._eventButton}}class Co{constructor(){this._firstTouch=void 0}_isOneFingerTouch(e){return e.targetTouches.length===1}_isSameTouchEvent(e){return e.targetTouches[0].identifier===this._firstTouch}startMove(e){this._firstTouch=e.targetTouches[0].identifier}endMove(e){delete this._firstTouch}isValidStartEvent(e){return this._isOneFingerTouch(e)}isValidMoveEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}isValidEndEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}}let ys=c=>{c.mousedown=c.dragStart,c.mousemoveWindow=c.dragMove,c.mouseup=c.dragEnd,c.contextmenu=e=>{e.preventDefault()}},Do=({enable:c,clickTolerance:e,bearingDegreesPerPixelMoved:n=.8})=>{let s=new _s({checkCorrectEvent:o=>X.mouseButton(o)===0&&o.ctrlKey||X.mouseButton(o)===2});return new tn({clickTolerance:e,move:(o,u)=>({bearingDelta:(u.x-o.x)*n}),moveStateManager:s,enable:c,assignEvents:ys})},So=({enable:c,clickTolerance:e,pitchDegreesPerPixelMoved:n=-.5})=>{let s=new _s({checkCorrectEvent:o=>X.mouseButton(o)===0&&o.ctrlKey||X.mouseButton(o)===2});return new tn({clickTolerance:e,move:(o,u)=>({pitchDelta:(u.y-o.y)*n}),moveStateManager:s,enable:c,assignEvents:ys})};class In{constructor(e,n){this._clickTolerance=e.clickTolerance||1,this._map=n,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new p.P(0,0)}_shouldBePrevented(e){return e<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(e,n,s){return this._calculateTransform(e,n,s)}touchmove(e,n,s){if(this._active){if(!this._shouldBePrevented(s.length))return e.preventDefault(),this._calculateTransform(e,n,s);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",e)}}touchend(e,n,s){this._calculateTransform(e,n,s),this._active&&this._shouldBePrevented(s.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,n,s){s.length>0&&(this._active=!0);let o=La(s,n),u=new p.P(0,0),m=new p.P(0,0),_=0;for(let b in o){let T=o[b],C=this._touches[b];C&&(u._add(T),m._add(T.sub(C)),_++,o[b]=T)}if(this._touches=o,this._shouldBePrevented(_)||!m.mag())return;let y=m.div(_);return this._sum._add(y),this._sum.mag()<this._clickTolerance?void 0:{around:u.div(_),panDelta:y}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class vs{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(e,n,s){this._firstTwoTouches||s.length<2||(this._firstTwoTouches=[s[0].identifier,s[1].identifier],this._start([n[0],n[1]]))}touchmove(e,n,s){if(!this._firstTwoTouches)return;e.preventDefault();let[o,u]=this._firstTwoTouches,m=Ra(s,n,o),_=Ra(s,n,u);if(!m||!_)return;let y=this._aroundCenter?null:m.add(_).div(2);return this._move([m,_],y,e)}touchend(e,n,s){if(!this._firstTwoTouches)return;let[o,u]=this._firstTwoTouches,m=Ra(s,n,o),_=Ra(s,n,u);m&&_||(this._active&&X.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&e.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function Ra(c,e,n){for(let s=0;s<c.length;s++)if(c[s].identifier===n)return e[s]}function Io(c,e){return Math.log(c/e)/Math.LN2}class ko extends vs{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,n){let s=this._distance;if(this._distance=e[0].dist(e[1]),this._active||!(Math.abs(Io(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Io(this._distance,s),pinchAround:n}}}function Mo(c,e){return 180*c.angleWith(e)/Math.PI}class Po extends vs{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(e){this._startVector=this._vector=e[0].sub(e[1]),this._minDiameter=e[0].dist(e[1])}_move(e,n,s){let o=this._vector;if(this._vector=e[0].sub(e[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:Mo(this._vector,o),pinchAround:n}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());let n=25/(Math.PI*this._minDiameter)*360,s=Mo(e,this._startVector);return Math.abs(s)<n}}function xs(c){return Math.abs(c.y)>Math.abs(c.x)}class ia extends vs{constructor(e){super(),this._currentTouchCount=0,this._map=e}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(e,n,s){super.touchstart(e,n,s),this._currentTouchCount=s.length}_start(e){this._lastPoints=e,xs(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,n,s){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;let o=e[0].sub(this._lastPoints[0]),u=e[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(o,u,s.timeStamp),this._valid?(this._lastPoints=e,this._active=!0,{pitchDelta:(o.y+u.y)/2*-.5}):void 0}gestureBeginsVertically(e,n,s){if(this._valid!==void 0)return this._valid;let o=e.mag()>=2,u=n.mag()>=2;if(!o&&!u)return;if(!o||!u)return this._firstMove===void 0&&(this._firstMove=s),s-this._firstMove<100&&void 0;let m=e.y>0==n.y>0;return xs(e)&&xs(n)&&m}}let Zl={panStep:100,bearingStep:15,pitchStep:10};class br{constructor(e){this._tr=new Rr(e);let n=Zl;this._panStep=n.panStep,this._bearingStep=n.bearingStep,this._pitchStep=n.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let n=0,s=0,o=0,u=0,m=0;switch(e.keyCode){case 61:case 107:case 171:case 187:n=1;break;case 189:case 109:case 173:n=-1;break;case 37:e.shiftKey?s=-1:(e.preventDefault(),u=-1);break;case 39:e.shiftKey?s=1:(e.preventDefault(),u=1);break;case 38:e.shiftKey?o=1:(e.preventDefault(),m=-1);break;case 40:e.shiftKey?o=-1:(e.preventDefault(),m=1);break;default:return}return this._rotationDisabled&&(s=0,o=0),{cameraAnimation:_=>{let y=this._tr;_.easeTo({duration:300,easeId:"keyboardHandler",easing:Hr,zoom:n?Math.round(y.zoom)+n*(e.shiftKey?2:1):y.zoom,bearing:y.bearing+s*this._bearingStep,pitch:y.pitch+o*this._pitchStep,offset:[-u*this._panStep,-m*this._panStep],center:y.center},{originalEvent:e})}}}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 Hr(c){return c*(2-c)}let zo=4.000244140625;class Fr{constructor(e,n){this._onTimeout=s=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(s)},this._map=e,this._tr=new Rr(e),this._triggerRenderFrame=n,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&e.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(e){return!!this._map.cooperativeGestures.isEnabled()&&!(e.ctrlKey||this._map.cooperativeGestures.isBypassed(e))}wheel(e){if(!this.isEnabled())return;if(this._shouldBePrevented(e))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",e);let n=e.deltaMode===WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY,s=se.now(),o=s-(this._lastWheelEventTime||0);this._lastWheelEventTime=s,n!==0&&n%zo==0?this._type="wheel":n!==0&&Math.abs(n)<4?this._type="trackpad":o>400?(this._type=null,this._lastValue=n,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(o*n)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,n+=this._lastValue)),e.shiftKey&&n&&(n/=4),this._type&&(this._lastWheelEvent=e,this._delta-=n,this._active||this._start(e)),e.preventDefault()}_start(e){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);let n=X.mousePos(this._map.getCanvas(),e),s=this._tr;this._around=n.y>s.transform.height/2-s.transform.getHorizon()?p.N.convert(this._aroundCenter?s.center:s.unproject(n)):p.N.convert(s.center),this._aroundPoint=s.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;let e=this._tr.transform;if(this._delta!==0){let y=this._type==="wheel"&&Math.abs(this._delta)>zo?this._wheelZoomRate:this._defaultZoomRate,b=2/(1+Math.exp(-Math.abs(this._delta*y)));this._delta<0&&b!==0&&(b=1/b);let T=typeof this._targetZoom=="number"?e.zoomScale(this._targetZoom):e.scale;this._targetZoom=Math.min(e.maxZoom,Math.max(e.minZoom,e.scaleZoom(T*b))),this._type==="wheel"&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}let n=typeof this._targetZoom=="number"?this._targetZoom:e.zoom,s=this._startZoom,o=this._easing,u,m=!1,_=se.now()-this._lastWheelEventTime;if(this._type==="wheel"&&s&&o&&_){let y=Math.min(_/200,1),b=o(y);u=p.y.number(s,n,b),y<1?this._frameId||(this._frameId=!0):m=!0}else u=n,m=!0;return this._active=!0,m&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!m,zoomDelta:u-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let n=p.b9;if(this._prevEase){let s=this._prevEase,o=(se.now()-s.start)/s.duration,u=s.easing(o+.01)-s.easing(o),m=.27/Math.sqrt(u*u+1e-4)*.01,_=Math.sqrt(.0729-m*m);n=p.b8(m,_,.25,1)}return this._prevEase={start:se.now(),duration:e,easing:n},n}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class kn{constructor(e,n){this._clickZoom=e,this._tapZoom=n}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class Yu{constructor(e){this._tr=new Rr(e),this.reset()}reset(){this._active=!1}dblclick(e,n){return e.preventDefault(),{cameraAnimation:s=>{s.easeTo({duration:300,zoom:this._tr.zoom+(e.shiftKey?-1:1),around:this._tr.unproject(n)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Qu{constructor(){this._tap=new gs({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(e,n,s){if(!this._swipePoint)if(this._tapTime){let o=n[0],u=e.timeStamp-this._tapTime<500,m=this._tapPoint.dist(o)<30;u&&m?s.length>0&&(this._swipePoint=o,this._swipeTouch=s[0].identifier):this.reset()}else this._tap.touchstart(e,n,s)}touchmove(e,n,s){if(this._tapTime){if(this._swipePoint){if(s[0].identifier!==this._swipeTouch)return;let o=n[0],u=o.y-this._swipePoint.y;return this._swipePoint=o,e.preventDefault(),this._active=!0,{zoomDelta:u/128}}}else this._tap.touchmove(e,n,s)}touchend(e,n,s){if(this._tapTime)this._swipePoint&&s.length===0&&this.reset();else{let o=this._tap.touchend(e,n,s);o&&(this._tapTime=e.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}}class Gl{constructor(e,n,s){this._el=e,this._mousePan=n,this._touchPan=s}enable(e){this._inertiaOptions=e||{},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 Hl{constructor(e,n,s){this._pitchWithRotate=e.pitchWithRotate,this._mouseRotate=n,this._mousePitch=s}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class Bo{constructor(e,n,s,o){this._el=e,this._touchZoom=n,this._touchRotate=s,this._tapDragZoom=o,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),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 ra{constructor(e,n){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=e,this._options=n,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;let e=this._map.getCanvasContainer();e.classList.add("maplibregl-cooperative-gestures"),this._container=X.create("div","maplibregl-cooperative-gesture-screen",e);let n=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(n=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));let s=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),o=document.createElement("div");o.className="maplibregl-desktop-message",o.textContent=n,this._container.appendChild(o);let u=document.createElement("div");u.className="maplibregl-mobile-message",u.textContent=s,this._container.appendChild(u),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(X.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(e){return e[this._bypassKey]}notifyGestureBlocked(e,n){this._enabled&&(this._map.fire(new p.k("cooperativegestureprevented",{gestureType:e,originalEvent:n})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}let wr=c=>c.zoom||c.drag||c.pitch||c.rotate;class Ve extends p.k{}function bs(c){return c.panDelta&&c.panDelta.mag()||c.zoomDelta||c.bearingDelta||c.pitchDelta}class Lo{constructor(e,n){this.handleWindowEvent=o=>{this.handleEvent(o,`${o.type}Window`)},this.handleEvent=(o,u)=>{if(o.type==="blur")return void this.stop(!0);this._updatingCamera=!0;let m=o.type==="renderFrame"?void 0:o,_={needsRenderFrame:!1},y={},b={},T=o.touches,C=T?this._getMapTouches(T):void 0,P=C?X.touchPos(this._map.getCanvas(),C):X.mousePos(this._map.getCanvas(),o);for(let{handlerName:U,handler:Z,allowed:G}of this._handlers){if(!Z.isEnabled())continue;let W;this._blockedByActive(b,G,U)?Z.reset():Z[u||o.type]&&(W=Z[u||o.type](o,P,C),this.mergeHandlerResult(_,y,W,U,m),W&&W.needsRenderFrame&&this._triggerRenderFrame()),(W||Z.isActive())&&(b[U]=Z)}let L={};for(let U in this._previousActiveHandlers)b[U]||(L[U]=m);this._previousActiveHandlers=b,(Object.keys(L).length||bs(_))&&(this._changes.push([_,y,L]),this._triggerRenderFrame()),(Object.keys(b).length||bs(_))&&this._map._stop(!0),this._updatingCamera=!1;let{cameraAnimation:O}=_;O&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],O(this._map))},this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Ao(e),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n);let s=this._el;this._listeners=[[s,"touchstart",{passive:!0}],[s,"touchmove",{passive:!1}],[s,"touchend",void 0],[s,"touchcancel",void 0],[s,"mousedown",void 0],[s,"mousemove",void 0],[s,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[s,"mouseover",void 0],[s,"mouseout",void 0],[s,"dblclick",void 0],[s,"click",void 0],[s,"keydown",{capture:!1}],[s,"keyup",void 0],[s,"wheel",{passive:!1}],[s,"contextmenu",void 0],[window,"blur",void 0]];for(let[o,u,m]of this._listeners)X.addEventListener(o,u,o===document?this.handleWindowEvent:this.handleEvent,m)}destroy(){for(let[e,n,s]of this._listeners)X.removeEventListener(e,n,e===document?this.handleWindowEvent:this.handleEvent,s)}_addDefaultHandlers(e){let n=this._map,s=n.getCanvasContainer();this._add("mapEvent",new $l(n,e));let o=n.boxZoom=new pr(n,e);this._add("boxZoom",o),e.interactive&&e.boxZoom&&o.enable();let u=n.cooperativeGestures=new ra(n,e.cooperativeGestures);this._add("cooperativeGestures",u),e.cooperativeGestures&&u.enable();let m=new ta(n),_=new Yu(n);n.doubleClickZoom=new kn(_,m),this._add("tapZoom",m),this._add("clickZoom",_),e.interactive&&e.doubleClickZoom&&n.doubleClickZoom.enable();let y=new Qu;this._add("tapDragZoom",y);let b=n.touchPitch=new ia(n);this._add("touchPitch",b),e.interactive&&e.touchPitch&&n.touchPitch.enable(e.touchPitch);let T=Do(e),C=So(e);n.dragRotate=new Hl(e,T,C),this._add("mouseRotate",T,["mousePitch"]),this._add("mousePitch",C,["mouseRotate"]),e.interactive&&e.dragRotate&&n.dragRotate.enable();let P=(({enable:W,clickTolerance:N})=>{let Q=new _s({checkCorrectEvent:te=>X.mouseButton(te)===0&&!te.ctrlKey});return new tn({clickTolerance:N,move:(te,ae)=>({around:ae,panDelta:ae.sub(te)}),activateOnStart:!0,moveStateManager:Q,enable:W,assignEvents:ys})})(e),L=new In(e,n);n.dragPan=new Gl(s,P,L),this._add("mousePan",P),this._add("touchPan",L,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&n.dragPan.enable(e.dragPan);let O=new Po,U=new ko;n.touchZoomRotate=new Bo(s,U,O,y),this._add("touchRotate",O,["touchPan","touchZoom"]),this._add("touchZoom",U,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&n.touchZoomRotate.enable(e.touchZoomRotate);let Z=n.scrollZoom=new Fr(n,()=>this._triggerRenderFrame());this._add("scrollZoom",Z,["mousePan"]),e.interactive&&e.scrollZoom&&n.scrollZoom.enable(e.scrollZoom);let G=n.keyboard=new br(n);this._add("keyboard",G),e.interactive&&e.keyboard&&n.keyboard.enable(),this._add("blockableMapEvent",new fi(n))}_add(e,n,s){this._handlers.push({handlerName:e,handler:n,allowed:s}),this._handlersById[e]=n}stop(e){if(!this._updatingCamera){for(let{handler:n}of this._handlers)n.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}isActive(){for(let{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!wr(this._eventsInProgress)||this.isZooming()}_blockedByActive(e,n,s){for(let o in e)if(o!==s&&(!n||n.indexOf(o)<0))return!0;return!1}_getMapTouches(e){let n=[];for(let s of e)this._el.contains(s.target)&&n.push(s);return n}mergeHandlerResult(e,n,s,o,u){if(!s)return;p.e(e,s);let m={handlerName:o,originalEvent:s.originalEvent||u};s.zoomDelta!==void 0&&(n.zoom=m),s.panDelta!==void 0&&(n.drag=m),s.pitchDelta!==void 0&&(n.pitch=m),s.bearingDelta!==void 0&&(n.rotate=m)}_applyChanges(){let e={},n={},s={};for(let[o,u,m]of this._changes)o.panDelta&&(e.panDelta=(e.panDelta||new p.P(0,0))._add(o.panDelta)),o.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+o.zoomDelta),o.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+o.bearingDelta),o.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+o.pitchDelta),o.around!==void 0&&(e.around=o.around),o.pinchAround!==void 0&&(e.pinchAround=o.pinchAround),o.noInertia&&(e.noInertia=o.noInertia),p.e(n,u),p.e(s,m);this._updateMapTransform(e,n,s),this._changes=[]}_updateMapTransform(e,n,s){let o=this._map,u=o._getTransformForUpdate(),m=o.terrain;if(!(bs(e)||m&&this._terrainMovement))return this._fireEvents(n,s,!0);let{panDelta:_,zoomDelta:y,bearingDelta:b,pitchDelta:T,around:C,pinchAround:P}=e;P!==void 0&&(C=P),o._stop(!0),C=C||o.transform.centerPoint;let L=u.pointLocation(_?C.sub(_):C);b&&(u.bearing+=b),T&&(u.pitch+=T),y&&(u.zoom+=y),m?this._terrainMovement||!n.drag&&!n.zoom?n.drag&&this._terrainMovement?u.center=u.pointLocation(u.centerPoint.sub(_)):u.setLocationAtPoint(L,C):(this._terrainMovement=!0,this._map._elevationFreeze=!0,u.setLocationAtPoint(L,C)):u.setLocationAtPoint(L,C),o._applyUpdatedTransform(u),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(n,s,!0)}_fireEvents(e,n,s){let o=wr(this._eventsInProgress),u=wr(e),m={};for(let C in e){let{originalEvent:P}=e[C];this._eventsInProgress[C]||(m[`${C}start`]=P),this._eventsInProgress[C]=e[C]}!o&&u&&this._fireEvent("movestart",u.originalEvent);for(let C in m)this._fireEvent(C,m[C]);u&&this._fireEvent("move",u.originalEvent);for(let C in e){let{originalEvent:P}=e[C];this._fireEvent(C,P)}let _={},y;for(let C in this._eventsInProgress){let{handlerName:P,originalEvent:L}=this._eventsInProgress[C];this._handlersById[P].isActive()||(delete this._eventsInProgress[C],y=n[P]||L,_[`${C}end`]=y)}for(let C in _)this._fireEvent(C,_[C]);let b=wr(this._eventsInProgress),T=(o||u)&&!b;if(T&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;let C=this._map._getTransformForUpdate();C.recalculateZoom(this._map.terrain),this._map._applyUpdatedTransform(C)}if(s&&T){this._updatingCamera=!0;let C=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),P=L=>L!==0&&-this._bearingSnap<L&&L<this._bearingSnap;!C||!C.essential&&se.prefersReducedMotion?(this._map.fire(new p.k("moveend",{originalEvent:y})),P(this._map.getBearing())&&this._map.resetNorth()):(P(C.bearing||this._map.getBearing())&&(C.bearing=0),C.freezeElevation=!0,this._map.easeTo(C,{originalEvent:y})),this._updatingCamera=!1}}_fireEvent(e,n){this._map.fire(new p.k(e,n?{originalEvent:n}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(e=>{delete this._frameId,this.handleEvent(new Ve("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Xl extends p.E{constructor(e,n){super(),this._renderFrameCallback=()=>{let s=Math.min((se.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(s)),s<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=n.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new p.N(this.transform.center.lng,this.transform.center.lat)}setCenter(e,n){return this.jumpTo({center:e},n)}panBy(e,n,s){return e=p.P.convert(e).mult(-1),this.panTo(this.transform.center,p.e({offset:e},n),s)}panTo(e,n,s){return this.easeTo(p.e({center:e},n),s)}getZoom(){return this.transform.zoom}setZoom(e,n){return this.jumpTo({zoom:e},n),this}zoomTo(e,n,s){return this.easeTo(p.e({zoom:e},n),s)}zoomIn(e,n){return this.zoomTo(this.getZoom()+1,e,n),this}zoomOut(e,n){return this.zoomTo(this.getZoom()-1,e,n),this}getBearing(){return this.transform.bearing}setBearing(e,n){return this.jumpTo({bearing:e},n),this}getPadding(){return this.transform.padding}setPadding(e,n){return this.jumpTo({padding:e},n),this}rotateTo(e,n,s){return this.easeTo(p.e({bearing:e},n),s)}resetNorth(e,n){return this.rotateTo(0,p.e({duration:1e3},e),n),this}resetNorthPitch(e,n){return this.easeTo(p.e({bearing:0,pitch:0,duration:1e3},e),n),this}snapToNorth(e,n){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,n):this}getPitch(){return this.transform.pitch}setPitch(e,n){return this.jumpTo({pitch:e},n),this}cameraForBounds(e,n){e=oe.convert(e).adjustAntiMeridian();let s=n&&n.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),s,n)}_cameraForBoxAndBearing(e,n,s,o){let u={top:0,bottom:0,right:0,left:0};if(typeof(o=p.e({padding:u,offset:[0,0],maxZoom:this.transform.maxZoom},o)).padding=="number"){let Te=o.padding;o.padding={top:Te,bottom:Te,right:Te,left:Te}}o.padding=p.e(u,o.padding);let m=this.transform,_=m.padding,y=new oe(e,n),b=m.project(y.getNorthWest()),T=m.project(y.getNorthEast()),C=m.project(y.getSouthEast()),P=m.project(y.getSouthWest()),L=p.ba(-s),O=b.rotate(L),U=T.rotate(L),Z=C.rotate(L),G=P.rotate(L),W=new p.P(Math.max(O.x,U.x,G.x,Z.x),Math.max(O.y,U.y,G.y,Z.y)),N=new p.P(Math.min(O.x,U.x,G.x,Z.x),Math.min(O.y,U.y,G.y,Z.y)),Q=W.sub(N),te=(m.width-(_.left+_.right+o.padding.left+o.padding.right))/Q.x,ae=(m.height-(_.top+_.bottom+o.padding.top+o.padding.bottom))/Q.y;if(ae<0||te<0)return void p.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");let fe=Math.min(m.scaleZoom(m.scale*Math.min(te,ae)),o.maxZoom),ve=p.P.convert(o.offset),ke=new p.P((o.padding.left-o.padding.right)/2,(o.padding.top-o.padding.bottom)/2).rotate(p.ba(s)),Oe=ve.add(ke).mult(m.scale/m.zoomScale(fe));return{center:m.unproject(b.add(C).div(2).sub(Oe)),zoom:fe,bearing:s}}fitBounds(e,n,s){return this._fitInternal(this.cameraForBounds(e,n),n,s)}fitScreenCoordinates(e,n,s,o,u){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(p.P.convert(e)),this.transform.pointLocation(p.P.convert(n)),s,o),o,u)}_fitInternal(e,n,s){return e?(delete(n=p.e(e,n)).padding,n.linear?this.easeTo(n,s):this.flyTo(n,s)):this}jumpTo(e,n){this.stop();let s=this._getTransformForUpdate(),o=!1,u=!1,m=!1;return"zoom"in e&&s.zoom!==+e.zoom&&(o=!0,s.zoom=+e.zoom),e.center!==void 0&&(s.center=p.N.convert(e.center)),"bearing"in e&&s.bearing!==+e.bearing&&(u=!0,s.bearing=+e.bearing),"pitch"in e&&s.pitch!==+e.pitch&&(m=!0,s.pitch=+e.pitch),e.padding==null||s.isPaddingEqual(e.padding)||(s.padding=e.padding),this._applyUpdatedTransform(s),this.fire(new p.k("movestart",n)).fire(new p.k("move",n)),o&&this.fire(new p.k("zoomstart",n)).fire(new p.k("zoom",n)).fire(new p.k("zoomend",n)),u&&this.fire(new p.k("rotatestart",n)).fire(new p.k("rotate",n)).fire(new p.k("rotateend",n)),m&&this.fire(new p.k("pitchstart",n)).fire(new p.k("pitch",n)).fire(new p.k("pitchend",n)),this.fire(new p.k("moveend",n))}calculateCameraOptionsFromTo(e,n,s,o=0){let u=p.Z.fromLngLat(e,n),m=p.Z.fromLngLat(s,o),_=m.x-u.x,y=m.y-u.y,b=m.z-u.z,T=Math.hypot(_,y,b);if(T===0)throw new Error("Can't calculate camera options with same From and To");let C=Math.hypot(_,y),P=this.transform.scaleZoom(this.transform.cameraToCenterDistance/T/this.transform.tileSize),L=180*Math.atan2(_,-y)/Math.PI,O=180*Math.acos(C/T)/Math.PI;return O=b<0?90-O:90+O,{center:m.toLngLat(),zoom:P,pitch:O,bearing:L}}easeTo(e,n){var s;this._stop(!1,e.easeId),((e=p.e({offset:[0,0],duration:500,easing:p.b9},e)).animate===!1||!e.essential&&se.prefersReducedMotion)&&(e.duration=0);let o=this._getTransformForUpdate(),u=o.zoom,m=o.bearing,_=o.pitch,y=o.padding,b="bearing"in e?this._normalizeBearing(e.bearing,m):m,T="pitch"in e?+e.pitch:_,C="padding"in e?e.padding:o.padding,P=p.P.convert(e.offset),L=o.centerPoint.add(P),O=o.pointLocation(L),{center:U,zoom:Z}=o.getConstrained(p.N.convert(e.center||O),(s=e.zoom)!==null&&s!==void 0?s:u);this._normalizeCenter(U,o);let G=o.project(O),W=o.project(U).sub(G),N=o.zoomScale(Z-u),Q,te;e.around&&(Q=p.N.convert(e.around),te=o.locationPoint(Q));let ae={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||Z!==u,this._rotating=this._rotating||m!==b,this._pitching=this._pitching||T!==_,this._padding=!o.isPaddingEqual(C),this._easeId=e.easeId,this._prepareEase(n,e.noMoveStart,ae),this.terrain&&this._prepareElevation(U),this._ease(fe=>{if(this._zooming&&(o.zoom=p.y.number(u,Z,fe)),this._rotating&&(o.bearing=p.y.number(m,b,fe)),this._pitching&&(o.pitch=p.y.number(_,T,fe)),this._padding&&(o.interpolatePadding(y,C,fe),L=o.centerPoint.add(P)),this.terrain&&!e.freezeElevation&&this._updateElevation(fe),Q)o.setLocationAtPoint(Q,te);else{let ve=o.zoomScale(o.zoom-u),ke=Z>u?Math.min(2,N):Math.max(.5,N),Oe=Math.pow(ke,1-fe),Te=o.unproject(G.add(W.mult(fe*Oe)).mult(ve));o.setLocationAtPoint(o.renderWorldCopies?Te.wrap():Te,L)}this._applyUpdatedTransform(o),this._fireMoveEvents(n)},fe=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(n,fe)},e),this}_prepareEase(e,n,s={}){this._moving=!0,n||s.moving||this.fire(new p.k("movestart",e)),this._zooming&&!s.zooming&&this.fire(new p.k("zoomstart",e)),this._rotating&&!s.rotating&&this.fire(new p.k("rotatestart",e)),this._pitching&&!s.pitching&&this.fire(new p.k("pitchstart",e))}_prepareElevation(e){this._elevationCenter=e,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(e,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(e){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);let n=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(e<1&&n!==this._elevationTarget){let s=this._elevationTarget-this._elevationStart;this._elevationStart+=e*(s-(n-(s*e+this._elevationStart))/(1-e)),this._elevationTarget=n}this.transform.elevation=p.y.number(this._elevationStart,this._elevationTarget,e)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(e){let n=e.getCameraPosition(),s=this.terrain.getElevationForLngLatZoom(n.lngLat,e.zoom);if(n.altitude<s){let o=this.calculateCameraOptionsFromTo(n.lngLat,s,e.center,e.elevation);return{pitch:o.pitch,zoom:o.zoom}}return{}}_applyUpdatedTransform(e){let n=[];if(this.terrain&&n.push(o=>this._elevateCameraIfInsideTerrain(o)),this.transformCameraUpdate&&n.push(o=>this.transformCameraUpdate(o)),!n.length)return;let s=e.clone();for(let o of n){let u=s.clone(),{center:m,zoom:_,pitch:y,bearing:b,elevation:T}=o(u);m&&(u.center=m),_!==void 0&&(u.zoom=_),y!==void 0&&(u.pitch=y),b!==void 0&&(u.bearing=b),T!==void 0&&(u.elevation=T),s.apply(u)}this.transform.apply(s)}_fireMoveEvents(e){this.fire(new p.k("move",e)),this._zooming&&this.fire(new p.k("zoom",e)),this._rotating&&this.fire(new p.k("rotate",e)),this._pitching&&this.fire(new p.k("pitch",e))}_afterEase(e,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId;let s=this._zooming,o=this._rotating,u=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,s&&this.fire(new p.k("zoomend",e)),o&&this.fire(new p.k("rotateend",e)),u&&this.fire(new p.k("pitchend",e)),this.fire(new p.k("moveend",e))}flyTo(e,n){var s;if(!e.essential&&se.prefersReducedMotion){let ze=p.M(e,["center","zoom","bearing","pitch","around"]);return this.jumpTo(ze,n)}this.stop(),e=p.e({offset:[0,0],speed:1.2,curve:1.42,easing:p.b9},e);let o=this._getTransformForUpdate(),u=o.zoom,m=o.bearing,_=o.pitch,y=o.padding,b="bearing"in e?this._normalizeBearing(e.bearing,m):m,T="pitch"in e?+e.pitch:_,C="padding"in e?e.padding:o.padding,P=p.P.convert(e.offset),L=o.centerPoint.add(P),O=o.pointLocation(L),{center:U,zoom:Z}=o.getConstrained(p.N.convert(e.center||O),(s=e.zoom)!==null&&s!==void 0?s:u);this._normalizeCenter(U,o);let G=o.zoomScale(Z-u),W=o.project(O),N=o.project(U).sub(W),Q=e.curve,te=Math.max(o.width,o.height),ae=te/G,fe=N.mag();if("minZoom"in e){let ze=p.ac(Math.min(e.minZoom,u,Z),o.minZoom,o.maxZoom),ot=te/o.zoomScale(ze-u);Q=Math.sqrt(ot/fe*2)}let ve=Q*Q;function ke(ze){let ot=(ae*ae-te*te+(ze?-1:1)*ve*ve*fe*fe)/(2*(ze?ae:te)*ve*fe);return Math.log(Math.sqrt(ot*ot+1)-ot)}function Oe(ze){return(Math.exp(ze)-Math.exp(-ze))/2}function Te(ze){return(Math.exp(ze)+Math.exp(-ze))/2}let Ee=ke(!1),$e=function(ze){return Te(Ee)/Te(Ee+Q*ze)},ct=function(ze){return te*((Te(Ee)*(Oe(ot=Ee+Q*ze)/Te(ot))-Oe(Ee))/ve)/fe;var ot},Se=(ke(!0)-Ee)/Q;if(Math.abs(fe)<1e-6||!isFinite(Se)){if(Math.abs(te-ae)<1e-6)return this.easeTo(e,n);let ze=ae<te?-1:1;Se=Math.abs(Math.log(ae/te))/Q,ct=()=>0,$e=ot=>Math.exp(ze*Q*ot)}return e.duration="duration"in e?+e.duration:1e3*Se/("screenSpeed"in e?+e.screenSpeed/Q:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=m!==b,this._pitching=T!==_,this._padding=!o.isPaddingEqual(C),this._prepareEase(n,!1),this.terrain&&this._prepareElevation(U),this._ease(ze=>{let ot=ze*Se,ii=1/$e(ot);o.zoom=ze===1?Z:u+o.scaleZoom(ii),this._rotating&&(o.bearing=p.y.number(m,b,ze)),this._pitching&&(o.pitch=p.y.number(_,T,ze)),this._padding&&(o.interpolatePadding(y,C,ze),L=o.centerPoint.add(P)),this.terrain&&!e.freezeElevation&&this._updateElevation(ze);let yt=ze===1?U:o.unproject(W.add(N.mult(ct(ot))).mult(ii));o.setLocationAtPoint(o.renderWorldCopies?yt.wrap():yt,L),this._applyUpdatedTransform(o),this._fireMoveEvents(n)},()=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(n)},e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,n){var s;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){let o=this._onEaseEnd;delete this._onEaseEnd,o.call(this,n)}return e||(s=this.handlers)===null||s===void 0||s.stop(!1),this}_ease(e,n,s){s.animate===!1||s.duration===0?(e(1),n()):(this._easeStart=se.now(),this._easeOptions=s,this._onEaseFrame=e,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,n){e=p.b3(e,-180,180);let s=Math.abs(e-n);return Math.abs(e-360-n)<s&&(e-=360),Math.abs(e+360-n)<s&&(e+=360),e}_normalizeCenter(e,n){if(!n.renderWorldCopies||n.lngRange)return;let s=e.lng-n.center.lng;e.lng+=s>180?-360:s<-180?360:0}queryTerrainElevation(e){return this.terrain?this.terrain.getElevationForLngLatZoom(p.N.convert(e),this.transform.tileZoom)-this.transform.elevation:null}}let na={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class aa{constructor(e=na){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=n=>{!n||n.sourceDataType!=="metadata"&&n.sourceDataType!=="visibility"&&n.dataType!=="style"&&n.type!=="terrain"||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=e}getDefaultPosition(){return"bottom-right"}onAdd(e){return this._map=e,this._compact=this.options.compact,this._container=X.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=X.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=X.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(){X.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(e,n){let s=this._map._getUIString(`AttributionControl.${n}`);e.title=s,e.setAttribute("aria-label",s)}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map(o=>typeof o!="string"?"":o)):typeof this.options.customAttribution=="string"&&e.push(this.options.customAttribution)),this._map.style.stylesheet){let o=this._map.style.stylesheet;this.styleOwner=o.owner,this.styleId=o.id}let n=this._map.style.sourceCaches;for(let o in n){let u=n[o];if(u.used||u.usedForTerrain){let m=u.getSource();m.attribution&&e.indexOf(m.attribution)<0&&e.push(m.attribution)}}e=e.filter(o=>String(o).trim()),e.sort((o,u)=>o.length-u.length),e=e.filter((o,u)=>{for(let m=u+1;m<e.length;m++)if(e[m].indexOf(o)>=0)return!1;return!0});let s=e.join(" | ");s!==this._attribHTML&&(this._attribHTML=s,e.length?(this._innerContainer.innerHTML=s,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Ro{constructor(e={}){this._updateCompact=()=>{let n=this._container.children;if(n.length){let s=n[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&s.classList.add("maplibregl-compact"):s.classList.remove("maplibregl-compact")}},this.options=e}getDefaultPosition(){return"bottom-left"}onAdd(e){this._map=e,this._compact=this.options&&this.options.compact,this._container=X.create("div","maplibregl-ctrl");let n=X.create("a","maplibregl-ctrl-logo");return n.target="_blank",n.rel="noopener nofollow",n.href="https://maplibre.org/",n.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),n.setAttribute("rel","noopener nofollow"),this._container.appendChild(n),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){X.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class Dt{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){let n=++this._id;return this._queue.push({callback:e,id:n,cancelled:!1}),n}remove(e){let n=this._currentlyRunning,s=n?this._queue.concat(n):this._queue;for(let o of s)if(o.id===e)return void(o.cancelled=!0)}run(e=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");let n=this._currentlyRunning=this._queue;this._queue=[];for(let s of n)if(!s.cancelled&&(s.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Fo=p.Y([{name:"a_pos3d",type:"Int16",components:3}]);class ec extends p.E{constructor(e){super(),this.sourceCache=e,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,e.usedForTerrain=!0,e.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(e,n){this.sourceCache.update(e,n),this._renderableTilesKeys=[];let s={};for(let o of e.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:n}))s[o.key]=!0,this._renderableTilesKeys.push(o.key),this._tiles[o.key]||(o.posMatrix=new Float64Array(16),p.aP(o.posMatrix,0,p.X,0,p.X,0,1),this._tiles[o.key]=new Pr(o,this.tileSize));for(let o in this._tiles)s[o]||delete this._tiles[o]}freeRtt(e){for(let n in this._tiles){let s=this._tiles[n];(!e||s.tileID.equals(e)||s.tileID.isChildOf(e)||e.isChildOf(s.tileID))&&(s.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(e=>this.getTileByID(e))}getTileByID(e){return this._tiles[e]}getTerrainCoords(e){let n={};for(let s of this._renderableTilesKeys){let o=this._tiles[s].tileID;if(o.canonical.equals(e.canonical)){let u=e.clone();u.posMatrix=new Float64Array(16),p.aP(u.posMatrix,0,p.X,0,p.X,0,1),n[s]=u}else if(o.canonical.isChildOf(e.canonical)){let u=e.clone();u.posMatrix=new Float64Array(16);let m=o.canonical.z-e.canonical.z,_=o.canonical.x-(o.canonical.x>>m<<m),y=o.canonical.y-(o.canonical.y>>m<<m),b=p.X>>m;p.aP(u.posMatrix,0,b,0,b,0,1),p.J(u.posMatrix,u.posMatrix,[-_*b,-y*b,0]),n[s]=u}else if(e.canonical.isChildOf(o.canonical)){let u=e.clone();u.posMatrix=new Float64Array(16);let m=e.canonical.z-o.canonical.z,_=e.canonical.x-(e.canonical.x>>m<<m),y=e.canonical.y-(e.canonical.y>>m<<m),b=p.X>>m;p.aP(u.posMatrix,0,p.X,0,p.X,0,1),p.J(u.posMatrix,u.posMatrix,[_*b,y*b,0]),p.K(u.posMatrix,u.posMatrix,[1/2**m,1/2**m,0]),n[s]=u}}return n}getSourceTile(e,n){let s=this.sourceCache._source,o=e.overscaledZ-this.deltaZoom;if(o>s.maxzoom&&(o=s.maxzoom),o<s.minzoom)return null;this._sourceTileCache[e.key]||(this._sourceTileCache[e.key]=e.scaledTo(o).key);let u=this.sourceCache.getTileByID(this._sourceTileCache[e.key]);if((!u||!u.dem)&&n)for(;o>=s.minzoom&&(!u||!u.dem);)u=this.sourceCache.getTileByID(e.scaledTo(o--).key);return u}tilesAfterTime(e=Date.now()){return Object.values(this._tiles).filter(n=>n.timeAdded>=e)}}class Oo{constructor(e,n,s){this.painter=e,this.sourceCache=new ec(n),this.options=s,this.exaggeration=typeof s.exaggeration=="number"?s.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(e,n,s,o=p.X){var u;if(!(n>=0&&n<o&&s>=0&&s<o))return 0;let m=this.getTerrainData(e),_=(u=m.tile)===null||u===void 0?void 0:u.dem;if(!_)return 0;let y=function(O,U,Z){var G=U[0],W=U[1];return O[0]=Z[0]*G+Z[4]*W+Z[12],O[1]=Z[1]*G+Z[5]*W+Z[13],O}([],[n/o*p.X,s/o*p.X],m.u_terrain_matrix),b=[y[0]*_.dim,y[1]*_.dim],T=Math.floor(b[0]),C=Math.floor(b[1]),P=b[0]-T,L=b[1]-C;return _.get(T,C)*(1-P)*(1-L)+_.get(T+1,C)*P*(1-L)+_.get(T,C+1)*(1-P)*L+_.get(T+1,C+1)*P*L}getElevationForLngLatZoom(e,n){if(!p.bb(n,e.wrap()))return 0;let{tileID:s,mercatorX:o,mercatorY:u}=this._getOverscaledTileIDFromLngLatZoom(e,n);return this.getElevation(s,o%p.X,u%p.X,p.X)}getElevation(e,n,s,o=p.X){return this.getDEMElevation(e,n,s,o)*this.exaggeration}getTerrainData(e){if(!this._emptyDemTexture){let o=this.painter.context,u=new p.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new ye(o,u,o.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new ye(o,new p.R({width:1,height:1}),o.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(o.gl.NEAREST,o.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=p.an([])}let n=this.sourceCache.getSourceTile(e,!0);if(n&&n.dem&&(!n.demTexture||n.needsTerrainPrepare)){let o=this.painter.context;n.demTexture=this.painter.getTileTexture(n.dem.stride),n.demTexture?n.demTexture.update(n.dem.getPixels(),{premultiply:!1}):n.demTexture=new ye(o,n.dem.getPixels(),o.gl.RGBA,{premultiply:!1}),n.demTexture.bind(o.gl.NEAREST,o.gl.CLAMP_TO_EDGE),n.needsTerrainPrepare=!1}let s=n&&n+n.tileID.key+e.key;if(s&&!this._demMatrixCache[s]){let o=this.sourceCache.sourceCache._source.maxzoom,u=e.canonical.z-n.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=o?u=e.canonical.z-o:p.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));let m=e.canonical.x-(e.canonical.x>>u<<u),_=e.canonical.y-(e.canonical.y>>u<<u),y=p.bc(new Float64Array(16),[1/(p.X<<u),1/(p.X<<u),0]);p.J(y,y,[m*p.X,_*p.X,0]),this._demMatrixCache[e.key]={matrix:y,coord:e}}return{u_depth:2,u_terrain:3,u_terrain_dim:n&&n.dem&&n.dem.dim||1,u_terrain_matrix:s?this._demMatrixCache[e.key].matrix:this._emptyDemMatrix,u_terrain_unpack:n&&n.dem&&n.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(n&&n.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:n}}getFramebuffer(e){let n=this.painter,s=n.width/devicePixelRatio,o=n.height/devicePixelRatio;return!this._fbo||this._fbo.width===s&&this._fbo.height===o||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new ye(n.context,{width:s,height:o,data:null},n.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(n.context.gl.NEAREST,n.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new ye(n.context,{width:s,height:o,data:null},n.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(n.context.gl.NEAREST,n.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=n.context.createFramebuffer(s,o,!0,!1),this._fbo.depthAttachment.set(n.context.createRenderbuffer(n.context.gl.DEPTH_COMPONENT16,s,o))),this._fbo.colorAttachment.set(e==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){let e=this.painter.context;if(this._coordsTexture)return this._coordsTexture;let n=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let u=0,m=0;u<this._coordsTextureSize;u++)for(let _=0;_<this._coordsTextureSize;_++,m+=4)n[m+0]=255&_,n[m+1]=255&u,n[m+2]=_>>8<<4|u>>8,n[m+3]=0;let s=new p.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(n.buffer)),o=new ye(e,s,e.gl.RGBA,{premultiply:!1});return o.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=o,o}pointCoordinate(e){this.painter.maybeDrawDepthAndCoords(!0);let n=new Uint8Array(4),s=this.painter.context,o=s.gl,u=Math.round(e.x*this.painter.pixelRatio/devicePixelRatio),m=Math.round(e.y*this.painter.pixelRatio/devicePixelRatio),_=Math.round(this.painter.height/devicePixelRatio);s.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),o.readPixels(u,_-m-1,1,1,o.RGBA,o.UNSIGNED_BYTE,n),s.bindFramebuffer.set(null);let y=n[0]+(n[2]>>4<<8),b=n[1]+((15&n[2])<<8),T=this.coordsIndex[255-n[3]],C=T&&this.sourceCache.getTileByID(T);if(!C)return null;let P=this._coordsTextureSize,L=(1<<C.tileID.canonical.z)*P;return new p.Z((C.tileID.canonical.x*P+y)/L+C.tileID.wrap,(C.tileID.canonical.y*P+b)/L,this.getElevation(C.tileID,y,b,P))}depthAtPoint(e){let n=new Uint8Array(4),s=this.painter.context,o=s.gl;return s.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),o.readPixels(e.x,this.painter.height/devicePixelRatio-e.y-1,1,1,o.RGBA,o.UNSIGNED_BYTE,n),s.bindFramebuffer.set(null),(n[0]/16777216+n[1]/65536+n[2]/256+n[3])/256}getTerrainMesh(){if(this._mesh)return this._mesh;let e=this.painter.context,n=new p.bd,s=new p.aY,o=this.meshSize,u=p.X/o,m=o*o;for(let C=0;C<=o;C++)for(let P=0;P<=o;P++)n.emplaceBack(P*u,C*u,0);for(let C=0;C<m;C+=o+1)for(let P=0;P<o;P++)s.emplaceBack(P+C,o+P+C+1,o+P+C+2),s.emplaceBack(P+C,o+P+C+2,P+C+1);let _=n.length,y=_+2*(o+1);for(let C of[0,1])for(let P=0;P<=o;P++)for(let L of[0,1])n.emplaceBack(P*u,C*p.X,L);for(let C=0;C<2*o;C+=2)s.emplaceBack(y+C,y+C+1,y+C+3),s.emplaceBack(y+C,y+C+3,y+C+2),s.emplaceBack(_+C,_+C+3,_+C+1),s.emplaceBack(_+C,_+C+2,_+C+3);let b=n.length,T=b+2*(o+1);for(let C of[0,1])for(let P=0;P<=o;P++)for(let L of[0,1])n.emplaceBack(C*p.X,P*u,L);for(let C=0;C<2*o;C+=2)s.emplaceBack(b+C,b+C+1,b+C+3),s.emplaceBack(b+C,b+C+3,b+C+2),s.emplaceBack(T+C,T+C+3,T+C+1),s.emplaceBack(T+C,T+C+2,T+C+3);return this._mesh=new hs(e.createVertexBuffer(n,Fo.members),e.createIndexBuffer(s),p.a0.simpleSegment(0,0,n.length,s.length)),this._mesh}getMeshFrameDelta(e){return 2*Math.PI*p.be/Math.pow(2,e)/5}getMinTileElevationForLngLatZoom(e,n){var s;let{tileID:o}=this._getOverscaledTileIDFromLngLatZoom(e,n);return(s=this.getMinMaxElevation(o).minElevation)!==null&&s!==void 0?s:0}getMinMaxElevation(e){let n=this.getTerrainData(e).tile,s={minElevation:null,maxElevation:null};return n&&n.dem&&(s.minElevation=n.dem.min*this.exaggeration,s.maxElevation=n.dem.max*this.exaggeration),s}_getOverscaledTileIDFromLngLatZoom(e,n){let s=p.Z.fromLngLat(e.wrap()),o=(1<<n)*p.X,u=s.x*o,m=s.y*o,_=Math.floor(u/p.X),y=Math.floor(m/p.X);return{tileID:new p.S(n,0,n,_,y),mercatorX:u,mercatorY:m}}}class tc{constructor(e,n,s){this._context=e,this._size=n,this._tileSize=s,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(let e of this._objects)e.texture.destroy(),e.fbo.destroy()}_createObject(e){let n=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),s=new ye(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return s.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),n.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),n.colorAttachment.set(s.texture),{id:e,fbo:n,texture:s,stamp:-1,inUse:!1}}getObjectForId(e){return this._objects[e]}useObject(e){e.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(n=>e.id!==n),this._recentlyUsed.push(e.id)}stampObject(e){e.stamp=++this._stamp}getOrCreateFreeObject(){for(let n of this._recentlyUsed)if(!this._objects[n].inUse)return this._objects[n];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");let e=this._createObject(this._objects.length);return this._objects.push(e),e}freeObject(e){e.inUse=!1}freeAllObjects(){for(let e of this._objects)this.freeObject(e)}isFull(){return!(this._objects.length<this._size)&&this._objects.some(e=>!e.inUse)===!1}}let sa={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Wl{constructor(e,n){this.painter=e,this.terrain=n,this.pool=new tc(e.context,30,n.sourceCache.tileSize*n.qualityFactor)}destruct(){this.pool.destruct()}getTexture(e){return this.pool.getObjectForId(e.rtt[this._stacks.length-1].id).texture}prepareForRender(e,n){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=e._order.filter(s=>!e._layers[s].isHidden(n)),this._coordsDescendingInv={};for(let s in e.sourceCaches){this._coordsDescendingInv[s]={};let o=e.sourceCaches[s].getVisibleCoordinates();for(let u of o){let m=this.terrain.sourceCache.getTerrainCoords(u);for(let _ in m)this._coordsDescendingInv[s][_]||(this._coordsDescendingInv[s][_]=[]),this._coordsDescendingInv[s][_].push(m[_])}}this._coordsDescendingInvStr={};for(let s of e._order){let o=e._layers[s],u=o.source;if(sa[o.type]&&!this._coordsDescendingInvStr[u]){this._coordsDescendingInvStr[u]={};for(let m in this._coordsDescendingInv[u])this._coordsDescendingInvStr[u][m]=this._coordsDescendingInv[u][m].map(_=>_.key).sort().join()}}for(let s of this._renderableTiles)for(let o in this._coordsDescendingInvStr){let u=this._coordsDescendingInvStr[o][s.tileID.key];u&&u!==s.rttCoords[o]&&(s.rtt=[])}}renderLayer(e){if(e.isHidden(this.painter.transform.zoom))return!1;let n=e.type,s=this.painter,o=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(sa[n]&&(this._prevType&&sa[this._prevType]||this._stacks.push([]),this._prevType=n,this._stacks[this._stacks.length-1].push(e.id),!o))return!0;if(sa[this._prevType]||sa[n]&&o){this._prevType=n;let u=this._stacks.length-1,m=this._stacks[u]||[];for(let _ of this._renderableTiles){if(this.pool.isFull()&&(Vl(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(_),_.rtt[u]){let b=this.pool.getObjectForId(_.rtt[u].id);if(b.stamp===_.rtt[u].stamp){this.pool.useObject(b);continue}}let y=this.pool.getOrCreateFreeObject();this.pool.useObject(y),this.pool.stampObject(y),_.rtt[u]={id:y.id,stamp:y.stamp},s.context.bindFramebuffer.set(y.fbo.framebuffer),s.context.clear({color:p.aM.transparent,stencil:0}),s.currentStencilSource=void 0;for(let b=0;b<m.length;b++){let T=s.style._layers[m[b]],C=T.source?this._coordsDescendingInv[T.source][_.tileID.key]:[_.tileID];s.context.viewport.set([0,0,y.fbo.width,y.fbo.height]),s._renderTileClippingMasks(T,C),s.renderLayer(s,s.style.sourceCaches[T.source],T,C),T.source&&(_.rttCoords[T.source]=this._coordsDescendingInvStr[T.source][_.tileID.key])}}return Vl(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects(),sa[n]}return!1}}let No={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use \u2318 + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},Jl=ue,ic={hash:!1,interactive:!0,bearingSnap:7,attributionControl:na,maplibreLogo:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,refreshExpiredTiles:!0,scrollZoom:!0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],zoom:0,bearing:0,pitch:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:p.a.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0},qo=c=>{c.touchstart=c.dragStart,c.touchmoveWindow=c.dragMove,c.touchend=c.dragEnd},rc={showCompass:!0,showZoom:!0,visualizePitch:!1};class nc{constructor(e,n,s=!1){this.mousedown=m=>{this.startMouse(p.e({},m,{ctrlKey:!0,preventDefault:()=>m.preventDefault()}),X.mousePos(this.element,m)),X.addEventListener(window,"mousemove",this.mousemove),X.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=m=>{this.moveMouse(m,X.mousePos(this.element,m))},this.mouseup=m=>{this.mouseRotate.dragEnd(m),this.mousePitch&&this.mousePitch.dragEnd(m),this.offTemp()},this.touchstart=m=>{m.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=X.touchPos(this.element,m.targetTouches)[0],this.startTouch(m,this._startPos),X.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),X.addEventListener(window,"touchend",this.touchend))},this.touchmove=m=>{m.targetTouches.length!==1?this.reset():(this._lastPos=X.touchPos(this.element,m.targetTouches)[0],this.moveTouch(m,this._lastPos))},this.touchend=m=>{m.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()},this.reset=()=>{this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;let o=e.dragRotate._mouseRotate.getClickTolerance(),u=e.dragRotate._mousePitch.getClickTolerance();this.element=n,this.mouseRotate=Do({clickTolerance:o,enable:!0}),this.touchRotate=(({enable:m,clickTolerance:_,bearingDegreesPerPixelMoved:y=.8})=>{let b=new Co;return new tn({clickTolerance:_,move:(T,C)=>({bearingDelta:(C.x-T.x)*y}),moveStateManager:b,enable:m,assignEvents:qo})})({clickTolerance:o,enable:!0}),this.map=e,s&&(this.mousePitch=So({clickTolerance:u,enable:!0}),this.touchPitch=(({enable:m,clickTolerance:_,pitchDegreesPerPixelMoved:y=-.5})=>{let b=new Co;return new tn({clickTolerance:_,move:(T,C)=>({pitchDelta:(C.y-T.y)*y}),moveStateManager:b,enable:m,assignEvents:qo})})({clickTolerance:u,enable:!0})),X.addEventListener(n,"mousedown",this.mousedown),X.addEventListener(n,"touchstart",this.touchstart,{passive:!1}),X.addEventListener(n,"touchcancel",this.reset)}startMouse(e,n){this.mouseRotate.dragStart(e,n),this.mousePitch&&this.mousePitch.dragStart(e,n),X.disableDrag()}startTouch(e,n){this.touchRotate.dragStart(e,n),this.touchPitch&&this.touchPitch.dragStart(e,n),X.disableDrag()}moveMouse(e,n){let s=this.map,{bearingDelta:o}=this.mouseRotate.dragMove(e,n)||{};if(o&&s.setBearing(s.getBearing()+o),this.mousePitch){let{pitchDelta:u}=this.mousePitch.dragMove(e,n)||{};u&&s.setPitch(s.getPitch()+u)}}moveTouch(e,n){let s=this.map,{bearingDelta:o}=this.touchRotate.dragMove(e,n)||{};if(o&&s.setBearing(s.getBearing()+o),this.touchPitch){let{pitchDelta:u}=this.touchPitch.dragMove(e,n)||{};u&&s.setPitch(s.getPitch()+u)}}off(){let e=this.element;X.removeEventListener(e,"mousedown",this.mousedown),X.removeEventListener(e,"touchstart",this.touchstart,{passive:!1}),X.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),X.removeEventListener(window,"touchend",this.touchend),X.removeEventListener(e,"touchcancel",this.reset),this.offTemp()}offTemp(){X.enableDrag(),X.removeEventListener(window,"mousemove",this.mousemove),X.removeEventListener(window,"mouseup",this.mouseup),X.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),X.removeEventListener(window,"touchend",this.touchend)}}let dr;function ti(c,e,n){let s=new p.N(c.lng,c.lat);if(c=new p.N(c.lng,c.lat),e){let o=new p.N(c.lng-360,c.lat),u=new p.N(c.lng+360,c.lat),m=n.locationPoint(c).distSqr(e);n.locationPoint(o).distSqr(e)<m?c=o:n.locationPoint(u).distSqr(e)<m&&(c=u)}for(;Math.abs(c.lng-n.center.lng)>180;){let o=n.locationPoint(c);if(o.x>=0&&o.y>=0&&o.x<=n.width&&o.y<=n.height)break;c.lng>n.center.lng?c.lng-=360:c.lng+=360}return c.lng!==s.lng&&n.locationPoint(c).y>n.height/2-n.getHorizon()?c:s}let oa={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 ws(c,e,n){let s=c.classList;for(let o in oa)s.remove(`maplibregl-${n}-anchor-${o}`);s.add(`maplibregl-${n}-anchor-${e}`)}class As extends p.E{constructor(e){if(super(),this._onKeyPress=n=>{let s=n.code,o=n.charCode||n.keyCode;s!=="Space"&&s!=="Enter"&&o!==32&&o!==13||this.togglePopup()},this._onMapClick=n=>{let s=n.originalEvent.target,o=this._element;this._popup&&(s===o||o.contains(s))&&this.togglePopup()},this._update=n=>{var s;if(!this._map)return;let o=this._map.loaded()&&!this._map.isMoving();(n?.type==="terrain"||n?.type==="render"&&!o)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?ti(this._lngLat,this._flatPos,this._map.transform):(s=this._lngLat)===null||s===void 0?void 0:s.wrap(),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationPoint(this._lngLat)._add(this._offset));let u="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?u=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(u=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let m="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?m="rotateX(0deg)":this._pitchAlignment==="map"&&(m=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||n&&n.type!=="moveend"||(this._pos=this._pos.round()),X.setTransform(this._element,`${oa[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${m} ${u}`),se.frameAsync(new AbortController).then(()=>{this._updateOpacity(n&&n.type==="moveend")}).catch(()=>{})},this._onMove=n=>{if(!this._isDragging){let s=this._clickTolerance||this._map._clickTolerance;this._isDragging=n.point.dist(this._pointerdownPos)>=s}this._isDragging&&(this._pos=n.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new p.k("dragstart"))),this.fire(new p.k("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new p.k("dragend")),this._state="inactive"},this._addDragHandler=n=>{this._element.contains(n.originalEvent.target)&&(n.preventDefault(),this._positionDelta=n.point.sub(this._pos).add(this._offset),this._pointerdownPos=n.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=e&&e.anchor||"center",this._color=e&&e.color||"#3FB1CE",this._scale=e&&e.scale||1,this._draggable=e&&e.draggable||!1,this._clickTolerance=e&&e.clickTolerance||0,this._subpixelPositioning=e&&e.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=e&&e.rotation||0,this._rotationAlignment=e&&e.rotationAlignment||"auto",this._pitchAlignment=e&&e.pitchAlignment&&e.pitchAlignment!=="auto"?e.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(e?.opacity,e?.opacityWhenCovered),e&&e.element)this._element=e.element,this._offset=p.P.convert(e&&e.offset||[0,0]);else{this._defaultMarker=!0,this._element=X.create("div");let n=X.createNS("http://www.w3.org/2000/svg","svg"),s=41,o=27;n.setAttributeNS(null,"display","block"),n.setAttributeNS(null,"height",`${s}px`),n.setAttributeNS(null,"width",`${o}px`),n.setAttributeNS(null,"viewBox",`0 0 ${o} ${s}`);let u=X.createNS("http://www.w3.org/2000/svg","g");u.setAttributeNS(null,"stroke","none"),u.setAttributeNS(null,"stroke-width","1"),u.setAttributeNS(null,"fill","none"),u.setAttributeNS(null,"fill-rule","evenodd");let m=X.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"fill-rule","nonzero");let _=X.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"transform","translate(3.0, 29.0)"),_.setAttributeNS(null,"fill","#000000");let y=[{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(let G of y){let W=X.createNS("http://www.w3.org/2000/svg","ellipse");W.setAttributeNS(null,"opacity","0.04"),W.setAttributeNS(null,"cx","10.5"),W.setAttributeNS(null,"cy","5.80029008"),W.setAttributeNS(null,"rx",G.rx),W.setAttributeNS(null,"ry",G.ry),_.appendChild(W)}let b=X.createNS("http://www.w3.org/2000/svg","g");b.setAttributeNS(null,"fill",this._color);let T=X.createNS("http://www.w3.org/2000/svg","path");T.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),b.appendChild(T);let C=X.createNS("http://www.w3.org/2000/svg","g");C.setAttributeNS(null,"opacity","0.25"),C.setAttributeNS(null,"fill","#000000");let P=X.createNS("http://www.w3.org/2000/svg","path");P.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),C.appendChild(P);let L=X.createNS("http://www.w3.org/2000/svg","g");L.setAttributeNS(null,"transform","translate(6.0, 7.0)"),L.setAttributeNS(null,"fill","#FFFFFF");let O=X.createNS("http://www.w3.org/2000/svg","g");O.setAttributeNS(null,"transform","translate(8.0, 8.0)");let U=X.createNS("http://www.w3.org/2000/svg","circle");U.setAttributeNS(null,"fill","#000000"),U.setAttributeNS(null,"opacity","0.25"),U.setAttributeNS(null,"cx","5.5"),U.setAttributeNS(null,"cy","5.5"),U.setAttributeNS(null,"r","5.4999962");let Z=X.createNS("http://www.w3.org/2000/svg","circle");Z.setAttributeNS(null,"fill","#FFFFFF"),Z.setAttributeNS(null,"cx","5.5"),Z.setAttributeNS(null,"cy","5.5"),Z.setAttributeNS(null,"r","5.4999962"),O.appendChild(U),O.appendChild(Z),m.appendChild(_),m.appendChild(b),m.appendChild(C),m.appendChild(L),m.appendChild(O),n.appendChild(m),n.setAttributeNS(null,"height",s*this._scale+"px"),n.setAttributeNS(null,"width",o*this._scale+"px"),this._element.appendChild(n),this._offset=p.P.convert(e&&e.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",n=>{n.preventDefault()}),this._element.addEventListener("mousedown",n=>{n.preventDefault()}),ws(this._element,this._anchor,"marker"),e&&e.className)for(let n of e.className.split(" "))this._element.classList.add(n);this._popup=null}addTo(e){return this.remove(),this._map=e,this._element.setAttribute("aria-label",e._getUIString("Marker.Title")),e.getCanvasContainer().appendChild(this._element),e.on("move",this._update),e.on("moveend",this._update),e.on("terrain",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),X.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=p.N.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),e){if(!("offset"in e.options)){let o=Math.abs(13.5)/Math.SQRT2;e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[o,-1*(38.1-13.5+o)],"bottom-right":[-o,-1*(38.1-13.5+o)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=e,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(e){return this._subpixelPositioning=e,this}getPopup(){return this._popup}togglePopup(){let e=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:e?(e.isOpen()?e.remove():(e.setLngLat(this._lngLat),e.addTo(this._map)),this):this}_updateOpacity(e=!1){var n,s;if(!(!((n=this._map)===null||n===void 0)&&n.terrain))return void(this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity));if(e)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}let o=this._map,u=o.terrain.depthAtPoint(this._pos),m=o.terrain.getElevationForLngLatZoom(this._lngLat,o.transform.tileZoom);if(o.transform.lngLatToCameraDepth(this._lngLat,m)-u<.006)return void(this._element.style.opacity=this._opacity);let _=-this._offset.y/o.transform._pixelPerMeter,y=Math.sin(o.getPitch()*Math.PI/180)*_,b=o.terrain.depthAtPoint(new p.P(this._pos.x,this._pos.y-this._offset.y)),T=o.transform.lngLatToCameraDepth(this._lngLat,m+y)-b>.006;!((s=this._popup)===null||s===void 0)&&s.isOpen()&&T&&this._popup.remove(),this._element.style.opacity=T?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(e){return this._offset=p.P.convert(e),this._update(),this}addClassName(e){this._element.classList.add(e)}removeClassName(e){this._element.classList.remove(e)}toggleClassName(e){return this._element.classList.toggle(e)}setDraggable(e){return this._draggable=!!e,this._map&&(e?(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(e){return this._rotation=e||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e&&e!=="auto"?e:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(e,n){return e===void 0&&n===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),e!==void 0&&(this._opacity=e),n!==void 0&&(this._opacityWhenCovered=n),this._map&&this._updateOpacity(!0),this}}let Kl={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0},Fa=0,Oa=!1,Xr={maxWidth:100,unit:"metric"};function Na(c,e,n){let s=n&&n.maxWidth||100,o=c._container.clientHeight/2,u=c.unproject([0,o]),m=c.unproject([s,o]),_=u.distanceTo(m);if(n&&n.unit==="imperial"){let y=3.2808*_;y>5280?je(e,s,y/5280,c._getUIString("ScaleControl.Miles")):je(e,s,y,c._getUIString("ScaleControl.Feet"))}else n&&n.unit==="nautical"?je(e,s,_/1852,c._getUIString("ScaleControl.NauticalMiles")):_>=1e3?je(e,s,_/1e3,c._getUIString("ScaleControl.Kilometers")):je(e,s,_,c._getUIString("ScaleControl.Meters"))}function je(c,e,n,s){let o=function(u){let m=Math.pow(10,`${Math.floor(u)}`.length-1),_=u/m;return _=_>=10?10:_>=5?5:_>=3?3:_>=2?2:_>=1?1:function(y){let b=Math.pow(10,Math.ceil(-Math.log(y)/Math.LN10));return Math.round(y*b)/b}(_),m*_}(n);c.style.width=e*(o/n)+"px",c.innerHTML=`${o}&nbsp;${s}`}let rt={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},Es=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Ts(c){if(c){if(typeof c=="number"){let e=Math.round(Math.abs(c)/Math.SQRT2);return{center:new p.P(0,0),top:new p.P(0,c),"top-left":new p.P(e,e),"top-right":new p.P(-e,e),bottom:new p.P(0,-c),"bottom-left":new p.P(e,-e),"bottom-right":new p.P(-e,-e),left:new p.P(c,0),right:new p.P(-c,0)}}if(c instanceof p.P||Array.isArray(c)){let e=p.P.convert(c);return{center:e,top:e,"top-left":e,"top-right":e,bottom:e,"bottom-left":e,"bottom-right":e,left:e,right:e}}return{center:p.P.convert(c.center||[0,0]),top:p.P.convert(c.top||[0,0]),"top-left":p.P.convert(c["top-left"]||[0,0]),"top-right":p.P.convert(c["top-right"]||[0,0]),bottom:p.P.convert(c.bottom||[0,0]),"bottom-left":p.P.convert(c["bottom-left"]||[0,0]),"bottom-right":p.P.convert(c["bottom-right"]||[0,0]),left:p.P.convert(c.left||[0,0]),right:p.P.convert(c.right||[0,0])}}return Ts(new p.P(0,0))}let Vo=ue;E.AJAXError=p.bh,E.Evented=p.E,E.LngLat=p.N,E.MercatorCoordinate=p.Z,E.Point=p.P,E.addProtocol=p.bi,E.config=p.a,E.removeProtocol=p.bj,E.AttributionControl=aa,E.BoxZoomHandler=pr,E.CanvasSource=Ui,E.CooperativeGesturesHandler=ra,E.DoubleClickZoomHandler=kn,E.DragPanHandler=Gl,E.DragRotateHandler=Hl,E.EdgeInsets=Qn,E.FullscreenControl=class extends p.E{constructor(c={}){super(),this._onFullscreenChange=()=>{var e;let n=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((e=n?.shadowRoot)===null||e===void 0)&&e.fullscreenElement;)n=n.shadowRoot.fullscreenElement;n===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,c&&c.container&&(c.container instanceof HTMLElement?this._container=c.container:p.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(c){return this._map=c,this._container||(this._container=this._map.getContainer()),this._controlContainer=X.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){X.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){let c=this._fullscreenButton=X.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);X.create("span","maplibregl-ctrl-icon",c).setAttribute("aria-hidden","true"),c.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){let c=this._getTitle();this._fullscreenButton.setAttribute("aria-label",c),this._fullscreenButton.title=c}_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 p.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new p.k("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},E.GeoJSONSource=_r,E.GeolocateControl=class extends p.E{constructor(c){super(),this._onSuccess=e=>{if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new p.k("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(e),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new p.k("geolocate",e)),this._finish()}},this._updateCamera=e=>{let n=new p.N(e.coords.longitude,e.coords.latitude),s=e.coords.accuracy,o=this._map.getBearing(),u=p.e({bearing:o},this.options.fitBoundsOptions),m=oe.fromLngLat(n,s);this._map.fitBounds(m,u,{geolocateSource:!0})},this._updateMarker=e=>{if(e){let n=new p.N(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(n).addTo(this._map),this._userLocationDotMarker.setLngLat(n).addTo(this._map),this._accuracy=e.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=e=>{if(this._map){if(this.options.trackUserLocation)if(e.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;let n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(e.code===3&&Oa)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new p.k("error",e)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",e=>e.preventDefault()),this._geolocateButton=X.create("button","maplibregl-ctrl-geolocate",this._container),X.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=e=>{if(this._map){if(e===!1){p.w("Geolocation support is not available so the GeolocateControl will be disabled.");let n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n)}else{let n=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=X.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new As({element:this._dotElement}),this._circleElement=X.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new As({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",n=>{n.geolocateSource||this._watchState!=="ACTIVE_LOCK"||n.originalEvent&&n.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new p.k("trackuserlocationend")),this.fire(new p.k("userlocationlostfocus")))})}},this.options=p.e({},Kl,c)}onAdd(c){return this._map=c,this._container=X.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return p._(this,arguments,void 0,function*(e=!1){if(dr!==void 0&&!e)return dr;if(window.navigator.permissions===void 0)return dr=!!window.navigator.geolocation,dr;try{dr=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{dr=!!window.navigator.geolocation}return dr})}().then(e=>this._finishSetupUI(e)),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),X.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Fa=0,Oa=!1}_isOutOfMapMaxBounds(c){let e=this._map.getMaxBounds(),n=c.coords;return e&&(n.longitude<e.getWest()||n.longitude>e.getEast()||n.latitude<e.getSouth()||n.latitude>e.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){let c=this._map.getBounds(),e=c.getSouthEast(),n=c.getNorthEast(),s=e.distanceTo(n),o=Math.ceil(this._accuracy/(s/this._map._container.clientHeight)*2);this._circleElement.style.width=`${o}px`,this._circleElement.style.height=`${o}px`}trigger(){if(!this._setup)return p.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 p.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Fa--,Oa=!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 p.k("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new p.k("trackuserlocationstart")),this.fire(new p.k("userlocationfocus"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let c;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Fa++,Fa>1?(c={maximumAge:6e5,timeout:0},Oa=!0):(c=this.options.positionOptions,Oa=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,c)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},E.Hash=ds,E.ImageSource=Wi,E.KeyboardHandler=br,E.LngLatBounds=oe,E.LogoControl=Ro,E.Map=class extends Xl{constructor(c){p.bf.mark(p.bg.create);let e=Object.assign(Object.assign({},ic),c);if(e.minZoom!=null&&e.maxZoom!=null&&e.minZoom>e.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(e.minPitch!=null&&e.maxPitch!=null&&e.minPitch>e.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(e.minPitch!=null&&e.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(e.maxPitch!=null&&e.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new ea(e.minZoom,e.maxZoom,e.minPitch,e.maxPitch,e.renderWorldCopies),{bearingSnap:e.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new Dt,this._controls=[],this._mapId=p.a4(),this._contextLost=n=>{n.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new p.k("webglcontextlost",{originalEvent:n}))},this._contextRestored=n=>{this._setupPainter(),this.resize(),this._update(),this.fire(new p.k("webglcontextrestored",{originalEvent:n}))},this._onMapScroll=n=>{if(n.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=e.interactive,this._maxTileCacheSize=e.maxTileCacheSize,this._maxTileCacheZoomLevels=e.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=e.failIfMajorPerformanceCaveat===!0,this._preserveDrawingBuffer=e.preserveDrawingBuffer===!0,this._antialias=e.antialias===!0,this._trackResize=e.trackResize===!0,this._bearingSnap=e.bearingSnap,this._refreshExpiredTiles=e.refreshExpiredTiles===!0,this._fadeDuration=e.fadeDuration,this._crossSourceCollisions=e.crossSourceCollisions===!0,this._collectResourceTiming=e.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},No),e.locale),this._clickTolerance=e.clickTolerance,this._overridePixelRatio=e.pixelRatio,this._maxCanvasSize=e.maxCanvasSize,this.transformCameraUpdate=e.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=e.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=De.addThrottleControl(()=>this.isMoving()),this._requestManager=new We(e.transformRequest),typeof e.container=="string"){if(this._container=document.getElementById(e.container),!this._container)throw new Error(`Container '${e.container}' not found.`)}else{if(!(e.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=e.container}if(e.maxBounds&&this.setMaxBounds(e.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)).on("moveend",()=>this._update(!1)).on("zoom",()=>this._update(!0)).on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}).once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let n=!1,s=Pa(o=>{this._trackResize&&!this._removed&&(this.resize(o),this.redraw())},50);this._resizeObserver=new ResizeObserver(o=>{n?s(o):n=!0}),this._resizeObserver.observe(this._container)}this.handlers=new Lo(this,e),this._hash=e.hash&&new ds(typeof e.hash=="string"&&e.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:e.center,zoom:e.zoom,bearing:e.bearing,pitch:e.pitch}),e.bounds&&(this.resize(),this.fitBounds(e.bounds,p.e({},e.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=e.localIdeographFontFamily,this._validateStyle=e.validateStyle,e.style&&this.setStyle(e.style,{localIdeographFontFamily:e.localIdeographFontFamily}),e.attributionControl&&this.addControl(new aa(typeof e.attributionControl=="boolean"?void 0:e.attributionControl)),e.maplibreLogo&&this.addControl(new Ro,e.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",n=>{this._update(n.dataType==="style"),this.fire(new p.k(`${n.dataType}data`,n))}),this.on("dataloading",n=>{this.fire(new p.k(`${n.dataType}dataloading`,n))}),this.on("dataabort",n=>{this.fire(new p.k("sourcedataabort",n))})}_getMapId(){return this._mapId}addControl(c,e){if(e===void 0&&(e=c.getDefaultPosition?c.getDefaultPosition():"top-right"),!c||!c.onAdd)return this.fire(new p.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));let n=c.onAdd(this);this._controls.push(c);let s=this._controlPositions[e];return e.indexOf("bottom")!==-1?s.insertBefore(n,s.firstChild):s.appendChild(n),this}removeControl(c){if(!c||!c.onRemove)return this.fire(new p.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let e=this._controls.indexOf(c);return e>-1&&this._controls.splice(e,1),c.onRemove(this),this}hasControl(c){return this._controls.indexOf(c)>-1}calculateCameraOptionsFromTo(c,e,n,s){return s==null&&this.terrain&&(s=this.terrain.getElevationForLngLatZoom(n,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(c,e,n,s)}resize(c){var e;let n=this._containerDimensions(),s=n[0],o=n[1],u=this._getClampedPixelRatio(s,o);if(this._resizeCanvas(s,o,u),this.painter.resize(s,o,u),this.painter.overLimit()){let _=this.painter.context.gl;this._maxCanvasSize=[_.drawingBufferWidth,_.drawingBufferHeight];let y=this._getClampedPixelRatio(s,o);this._resizeCanvas(s,o,y),this.painter.resize(s,o,y)}this.transform.resize(s,o),(e=this._requestedCameraState)===null||e===void 0||e.resize(s,o);let m=!this._moving;return m&&(this.stop(),this.fire(new p.k("movestart",c)).fire(new p.k("move",c))),this.fire(new p.k("resize",c)),m&&this.fire(new p.k("moveend",c)),this}_getClampedPixelRatio(c,e){let{0:n,1:s}=this._maxCanvasSize,o=this.getPixelRatio(),u=c*o,m=e*o;return Math.min(u>n?n/u:1,m>s?s/m:1)*o}getPixelRatio(){var c;return(c=this._overridePixelRatio)!==null&&c!==void 0?c:devicePixelRatio}setPixelRatio(c){this._overridePixelRatio=c,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(c){return this.transform.setMaxBounds(oe.convert(c)),this._update()}setMinZoom(c){if((c=c??-2)>=-2&&c<=this.transform.maxZoom)return this.transform.minZoom=c,this._update(),this.getZoom()<c&&this.setZoom(c),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(c){if((c=c??22)>=this.transform.minZoom)return this.transform.maxZoom=c,this._update(),this.getZoom()>c&&this.setZoom(c),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(c){if((c=c??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(c>=0&&c<=this.transform.maxPitch)return this.transform.minPitch=c,this._update(),this.getPitch()<c&&this.setPitch(c),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(c){if((c=c??60)>85)throw new Error("maxPitch must be less than or equal to 85");if(c>=this.transform.minPitch)return this.transform.maxPitch=c,this._update(),this.getPitch()>c&&this.setPitch(c),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(c){return this.transform.renderWorldCopies=c,this._update()}project(c){return this.transform.locationPoint(p.N.convert(c),this.style&&this.terrain)}unproject(c){return this.transform.pointLocation(p.P.convert(c),this.terrain)}isMoving(){var c;return this._moving||((c=this.handlers)===null||c===void 0?void 0:c.isMoving())}isZooming(){var c;return this._zooming||((c=this.handlers)===null||c===void 0?void 0:c.isZooming())}isRotating(){var c;return this._rotating||((c=this.handlers)===null||c===void 0?void 0:c.isRotating())}_createDelegatedListener(c,e,n){if(c==="mouseenter"||c==="mouseover"){let s=!1;return{layers:e,listener:n,delegates:{mousemove:u=>{let m=e.filter(y=>this.getLayer(y)),_=m.length!==0?this.queryRenderedFeatures(u.point,{layers:m}):[];_.length?s||(s=!0,n.call(this,new Pi(c,this,u.originalEvent,{features:_}))):s=!1},mouseout:()=>{s=!1}}}}if(c==="mouseleave"||c==="mouseout"){let s=!1;return{layers:e,listener:n,delegates:{mousemove:m=>{let _=e.filter(y=>this.getLayer(y));(_.length!==0?this.queryRenderedFeatures(m.point,{layers:_}):[]).length?s=!0:s&&(s=!1,n.call(this,new Pi(c,this,m.originalEvent)))},mouseout:m=>{s&&(s=!1,n.call(this,new Pi(c,this,m.originalEvent)))}}}}{let s=o=>{let u=e.filter(_=>this.getLayer(_)),m=u.length!==0?this.queryRenderedFeatures(o.point,{layers:u}):[];m.length&&(o.features=m,n.call(this,o),delete o.features)};return{layers:e,listener:n,delegates:{[c]:s}}}}_saveDelegatedListener(c,e){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[c]=this._delegatedListeners[c]||[],this._delegatedListeners[c].push(e)}_removeDelegatedListener(c,e,n){if(!this._delegatedListeners||!this._delegatedListeners[c])return;let s=this._delegatedListeners[c];for(let o=0;o<s.length;o++){let u=s[o];if(u.listener===n&&u.layers.length===e.length&&u.layers.every(m=>e.includes(m))){for(let m in u.delegates)this.off(m,u.delegates[m]);return void s.splice(o,1)}}}on(c,e,n){if(n===void 0)return super.on(c,e);let s=this._createDelegatedListener(c,typeof e=="string"?[e]:e,n);this._saveDelegatedListener(c,s);for(let o in s.delegates)this.on(o,s.delegates[o]);return this}once(c,e,n){if(n===void 0)return super.once(c,e);let s=typeof e=="string"?[e]:e,o=this._createDelegatedListener(c,s,n);for(let u in o.delegates){let m=o.delegates[u];o.delegates[u]=(..._)=>{this._removeDelegatedListener(c,s,n),m(..._)}}this._saveDelegatedListener(c,o);for(let u in o.delegates)this.once(u,o.delegates[u]);return this}off(c,e,n){return n===void 0?super.off(c,e):(this._removeDelegatedListener(c,typeof e=="string"?[e]:e,n),this)}queryRenderedFeatures(c,e){if(!this.style)return[];let n,s=c instanceof p.P||Array.isArray(c),o=s?c:[[0,0],[this.transform.width,this.transform.height]];if(e=e||(s?{}:c)||{},o instanceof p.P||typeof o[0]=="number")n=[p.P.convert(o)];else{let u=p.P.convert(o[0]),m=p.P.convert(o[1]);n=[u,new p.P(m.x,u.y),m,new p.P(u.x,m.y),u]}return this.style.queryRenderedFeatures(n,e,this.transform)}querySourceFeatures(c,e){return this.style.querySourceFeatures(c,e)}setStyle(c,e){return(e=p.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},e)).diff!==!1&&e.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&c?(this._diffStyle(c,e),this):(this._localIdeographFontFamily=e.localIdeographFontFamily,this._updateStyle(c,e))}setTransformRequest(c){return this._requestManager.setTransformRequest(c),this}_getUIString(c){let e=this._locale[c];if(e==null)throw new Error(`Missing UI string '${c}'`);return e}_updateStyle(c,e){if(e.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(c,e));let n=this.style&&e.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!c)),c?(this.style=new Ja(this,e||{}),this.style.setEventedParent(this,{style:this.style}),typeof c=="string"?this.style.loadURL(c,e,n):this.style.loadJSON(c,e,n),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Ja(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(c,e){if(typeof c=="string"){let n=this._requestManager.transformRequest(c,"Style");p.h(n,new AbortController).then(s=>{this._updateDiff(s.data,e)}).catch(s=>{s&&this.fire(new p.j(s))})}else typeof c=="object"&&this._updateDiff(c,e)}_updateDiff(c,e){try{this.style.setState(c,e)&&this._update(!0)}catch(n){p.w(`Unable to perform style diff: ${n.message||n.error||n}. Rebuilding the style from scratch.`),this._updateStyle(c,e)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():p.w("There is no style added to the map.")}addSource(c,e){return this._lazyInitEmptyStyle(),this.style.addSource(c,e),this._update(!0)}isSourceLoaded(c){let e=this.style&&this.style.sourceCaches[c];if(e!==void 0)return e.loaded();this.fire(new p.j(new Error(`There is no source with ID '${c}'`)))}setTerrain(c){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),c){let e=this.style.sourceCaches[c.source];if(!e)throw new Error(`cannot load terrain, because there exists no source with ID: ${c.source}`);this.terrain===null&&e.reload();for(let n in this.style._layers){let s=this.style._layers[n];s.type==="hillshade"&&s.source===c.source&&p.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new Oo(this.painter,e,c),this.painter.renderToTexture=new Wl(this.painter,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=n=>{n.dataType==="style"?this.terrain.sourceCache.freeRtt():n.dataType==="source"&&n.tile&&(n.sourceId!==c.source||this._elevationFreeze||(this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(n.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.minElevationForCurrentTile=0,this.transform.elevation=0;return this.fire(new p.k("terrain",{terrain:c})),this}getTerrain(){var c,e;return(e=(c=this.terrain)===null||c===void 0?void 0:c.options)!==null&&e!==void 0?e:null}areTilesLoaded(){let c=this.style&&this.style.sourceCaches;for(let e in c){let n=c[e]._tiles;for(let s in n){let o=n[s];if(o.state!=="loaded"&&o.state!=="errored")return!1}}return!0}removeSource(c){return this.style.removeSource(c),this._update(!0)}getSource(c){return this.style.getSource(c)}addImage(c,e,n={}){let{pixelRatio:s=1,sdf:o=!1,stretchX:u,stretchY:m,content:_,textFitWidth:y,textFitHeight:b}=n;if(this._lazyInitEmptyStyle(),!(e instanceof HTMLImageElement||p.b(e))){if(e.width===void 0||e.height===void 0)return this.fire(new p.j(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{let{width:T,height:C,data:P}=e,L=e;return this.style.addImage(c,{data:new p.R({width:T,height:C},new Uint8Array(P)),pixelRatio:s,stretchX:u,stretchY:m,content:_,textFitWidth:y,textFitHeight:b,sdf:o,version:0,userImage:L}),L.onAdd&&L.onAdd(this,c),this}}{let{width:T,height:C,data:P}=se.getImageData(e);this.style.addImage(c,{data:new p.R({width:T,height:C},P),pixelRatio:s,stretchX:u,stretchY:m,content:_,textFitWidth:y,textFitHeight:b,sdf:o,version:0})}}updateImage(c,e){let n=this.style.getImage(c);if(!n)return this.fire(new p.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let s=e instanceof HTMLImageElement||p.b(e)?se.getImageData(e):e,{width:o,height:u,data:m}=s;if(o===void 0||u===void 0)return this.fire(new p.j(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(o!==n.data.width||u!==n.data.height)return this.fire(new p.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));let _=!(e instanceof HTMLImageElement||p.b(e));return n.data.replace(m,_),this.style.updateImage(c,n),this}getImage(c){return this.style.getImage(c)}hasImage(c){return c?!!this.style.getImage(c):(this.fire(new p.j(new Error("Missing required image id"))),!1)}removeImage(c){this.style.removeImage(c)}loadImage(c){return De.getImage(this._requestManager.transformRequest(c,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(c,e){return this._lazyInitEmptyStyle(),this.style.addLayer(c,e),this._update(!0)}moveLayer(c,e){return this.style.moveLayer(c,e),this._update(!0)}removeLayer(c){return this.style.removeLayer(c),this._update(!0)}getLayer(c){return this.style.getLayer(c)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(c,e,n){return this.style.setLayerZoomRange(c,e,n),this._update(!0)}setFilter(c,e,n={}){return this.style.setFilter(c,e,n),this._update(!0)}getFilter(c){return this.style.getFilter(c)}setPaintProperty(c,e,n,s={}){return this.style.setPaintProperty(c,e,n,s),this._update(!0)}getPaintProperty(c,e){return this.style.getPaintProperty(c,e)}setLayoutProperty(c,e,n,s={}){return this.style.setLayoutProperty(c,e,n,s),this._update(!0)}getLayoutProperty(c,e){return this.style.getLayoutProperty(c,e)}setGlyphs(c,e={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(c,e),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(c,e,n={}){return this._lazyInitEmptyStyle(),this.style.addSprite(c,e,n,s=>{s||this._update(!0)}),this}removeSprite(c){return this._lazyInitEmptyStyle(),this.style.removeSprite(c),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(c,e={}){return this._lazyInitEmptyStyle(),this.style.setSprite(c,e,n=>{n||this._update(!0)}),this}setLight(c,e={}){return this._lazyInitEmptyStyle(),this.style.setLight(c,e),this._update(!0)}getLight(){return this.style.getLight()}setSky(c){return this._lazyInitEmptyStyle(),this.style.setSky(c),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(c,e){return this.style.setFeatureState(c,e),this._update()}removeFeatureState(c,e){return this.style.removeFeatureState(c,e),this._update()}getFeatureState(c){return this.style.getFeatureState(c)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let c=0,e=0;return this._container&&(c=this._container.clientWidth||400,e=this._container.clientHeight||300),[c,e]}_setupContainer(){let c=this._container;c.classList.add("maplibregl-map");let e=this._canvasContainer=X.create("div","maplibregl-canvas-container",c);this._interactive&&e.classList.add("maplibregl-interactive"),this._canvas=X.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");let n=this._containerDimensions(),s=this._getClampedPixelRatio(n[0],n[1]);this._resizeCanvas(n[0],n[1],s);let o=this._controlContainer=X.create("div","maplibregl-control-container",c),u=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(m=>{u[m]=X.create("div",`maplibregl-ctrl-${m} `,o)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(c,e,n){this._canvas.width=Math.floor(n*c),this._canvas.height=Math.floor(n*e),this._canvas.style.width=`${c}px`,this._canvas.style.height=`${e}px`}_setupPainter(){let c={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1},e=null;this._canvas.addEventListener("webglcontextcreationerror",s=>{e={requestedAttributes:c},s&&(e.statusMessage=s.statusMessage,e.type=s.type)},{once:!0});let n=this._canvas.getContext("webgl2",c)||this._canvas.getContext("webgl",c);if(!n){let s="Failed to initialize WebGL";throw e?(e.message=s,new Error(JSON.stringify(e))):new Error(s)}this.painter=new ps(n,this.transform),It.testSupport(n)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(c){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||c,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(c){return this._update(),this._renderTaskQueue.add(c)}_cancelRenderFrame(c){this._renderTaskQueue.remove(c)}_render(c){let e=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(c),this._removed)return;let n=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let o=this.transform.zoom,u=se.now();this.style.zoomHistory.update(o,u);let m=new p.z(o,{now:u,fadeDuration:e,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),_=m.crossFadingFactor();_===1&&_===this._crossFadingFactor||(n=!0,this._crossFadingFactor=_),this.style.update(m)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.minElevationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,e,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:e,showPadding:this.showPadding}),this.fire(new p.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,p.bf.mark(p.bg.load),this.fire(new p.k("load"))),this.style&&(this.style.hasTransitions()||n)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();let s=this._sourcesDirty||this._styleDirty||this._placementDirty;return s||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new p.k("idle")),!this._loaded||this._fullyLoaded||s||(this._fullyLoaded=!0,p.bf.mark(p.bg.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var c;this._hash&&this._hash.remove();for(let n of this._controls)n.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),De.removeThrottleControl(this._imageQueueHandle),(c=this._resizeObserver)===null||c===void 0||c.disconnect();let e=this.painter.context.gl.getExtension("WEBGL_lose_context");e?.loseContext&&e.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),X.remove(this._canvasContainer),X.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),p.bf.clearMetrics(),this._removed=!0,this.fire(new p.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,se.frameAsync(this._frameRequest).then(c=>{p.bf.frame(c),this._frameRequest=null,this._render(c)}).catch(()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(c){this._showTileBoundaries!==c&&(this._showTileBoundaries=c,this._update())}get showPadding(){return!!this._showPadding}set showPadding(c){this._showPadding!==c&&(this._showPadding=c,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(c){this._showCollisionBoxes!==c&&(this._showCollisionBoxes=c,c?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(c){this._showOverdrawInspector!==c&&(this._showOverdrawInspector=c,this._update())}get repaint(){return!!this._repaint}set repaint(c){this._repaint!==c&&(this._repaint=c,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(c){this._vertices=c,this._update()}get version(){return Jl}getCameraTargetElevation(){return this.transform.elevation}},E.MapMouseEvent=Pi,E.MapTouchEvent=Sn,E.MapWheelEvent=jl,E.Marker=As,E.NavigationControl=class{constructor(c){this._updateZoomButtons=()=>{let e=this._map.getZoom(),n=e===this._map.getMaxZoom(),s=e===this._map.getMinZoom();this._zoomInButton.disabled=n,this._zoomOutButton.disabled=s,this._zoomInButton.setAttribute("aria-disabled",n.toString()),this._zoomOutButton.setAttribute("aria-disabled",s.toString())},this._rotateCompassArrow=()=>{let e=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=e},this._setButtonTitle=(e,n)=>{let s=this._map._getUIString(`NavigationControl.${n}`);e.title=s,e.setAttribute("aria-label",s)},this.options=p.e({},rc,c),this._container=X.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",e=>e.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",e=>this._map.zoomIn({},{originalEvent:e})),X.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",e=>this._map.zoomOut({},{originalEvent:e})),X.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",e=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:e}):this._map.resetNorth({},{originalEvent:e})}),this._compassIcon=X.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(c){return this._map=c,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new nc(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){X.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(c,e){let n=X.create("button",c,this._container);return n.type="button",n.addEventListener("click",e),n}},E.Popup=class extends p.E{constructor(c){super(),this.remove=()=>(this._content&&X.remove(this._content),this._container&&(X.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new p.k("close"))),this),this._onMouseUp=e=>{this._update(e.point)},this._onMouseMove=e=>{this._update(e.point)},this._onDrag=e=>{this._update(e.point)},this._update=e=>{var n;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=X.create("div","maplibregl-popup",this._map.getContainer()),this._tip=X.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(let _ of this.options.className.split(" "))this._container.classList.add(_);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=this._map.transform.renderWorldCopies&&!this._trackPointer?ti(this._lngLat,this._flatPos,this._map.transform):(n=this._lngLat)===null||n===void 0?void 0:n.wrap(),this._trackPointer&&!e)return;let s=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.locationPoint(this._lngLat));let o=this.options.anchor,u=Ts(this.options.offset);if(!o){let _=this._container.offsetWidth,y=this._container.offsetHeight,b;b=s.y+u.bottom.y<y?["top"]:s.y>this._map.transform.height-y?["bottom"]:[],s.x<_/2?b.push("left"):s.x>this._map.transform.width-_/2&&b.push("right"),o=b.length===0?"bottom":b.join("-")}let m=s.add(u[o]);this.options.subpixelPositioning||(m=m.round()),X.setTransform(this._container,`${oa[o]} translate(${m.x}px,${m.y}px)`),ws(this._container,o,"popup")},this._onClose=()=>{this.remove()},this.options=p.e(Object.create(rt),c)}addTo(c){return this._map&&this.remove(),this._map=c,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new p.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(c){return this._lngLat=p.N.convert(c),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(c){return this.setDOMContent(document.createTextNode(c))}setHTML(c){let e=document.createDocumentFragment(),n=document.createElement("body"),s;for(n.innerHTML=c;s=n.firstChild,s;)e.appendChild(s);return this.setDOMContent(e)}getMaxWidth(){var c;return(c=this._container)===null||c===void 0?void 0:c.style.maxWidth}setMaxWidth(c){return this.options.maxWidth=c,this._update(),this}setDOMContent(c){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=X.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(c),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(c){return this._container&&this._container.classList.add(c),this}removeClassName(c){return this._container&&this._container.classList.remove(c),this}setOffset(c){return this.options.offset=c,this._update(),this}toggleClassName(c){if(this._container)return this._container.classList.toggle(c)}setSubpixelPositioning(c){this.options.subpixelPositioning=c}_createCloseButton(){this.options.closeButton&&(this._closeButton=X.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;let c=this._container.querySelector(Es);c&&c.focus()}},E.RasterDEMTileSource=Zt,E.RasterTileSource=wt,E.ScaleControl=class{constructor(c){this._onMove=()=>{Na(this._map,this._container,this.options)},this.setUnit=e=>{this.options.unit=e,Na(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Xr),c)}getDefaultPosition(){return"bottom-left"}onAdd(c){return this._map=c,this._container=X.create("div","maplibregl-ctrl maplibregl-ctrl-scale",c.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){X.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},E.ScrollZoomHandler=Fr,E.Style=Ja,E.TerrainControl=class{constructor(c){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=c}onAdd(c){return this._map=c,this._container=X.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=X.create("button","maplibregl-ctrl-terrain",this._container),X.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){X.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},E.TwoFingersTouchPitchHandler=ia,E.TwoFingersTouchRotateHandler=Po,E.TwoFingersTouchZoomHandler=ko,E.TwoFingersTouchZoomRotateHandler=Bo,E.VectorTileSource=kr,E.VideoSource=Qr,E.addSourceType=(c,e)=>p._(void 0,void 0,void 0,function*(){if(yn(c))throw new Error(`A source type called "${c}" already exists.`);((n,s)=>{sn[n]=s})(c,e)}),E.clearPrewarmedResources=function(){let c=vt;c&&(c.isPreloaded()&&c.numActive()===1?(c.release(xt),vt=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()"))},E.getMaxParallelImageRequests=function(){return p.a.MAX_PARALLEL_IMAGE_REQUESTS},E.getRTLTextPluginStatus=function(){return lr().getRTLTextPluginStatus()},E.getVersion=function(){return Vo},E.getWorkerCount=function(){return Nt.workerCount},E.getWorkerUrl=function(){return p.a.WORKER_URL},E.importScriptInWorkers=function(c){return Vt().broadcast("IS",c)},E.prewarm=function(){Qe().acquire(xt)},E.setMaxParallelImageRequests=function(c){p.a.MAX_PARALLEL_IMAGE_REQUESTS=c},E.setRTLTextPlugin=function(c,e){return lr().setRTLTextPlugin(c,e)},E.setWorkerCount=function(c){Nt.workerCount=c},E.setWorkerUrl=function(c){p.a.WORKER_URL=c}});var Y=w;return Y})});var ol=xa(js=>{"use strict";function Wm(w,S,F){if(F===void 0&&(F=Array.prototype),w&&typeof F.find=="function")return F.find.call(w,S);for(var Y=0;Y<w.length;Y++)if(Object.prototype.hasOwnProperty.call(w,Y)){var E=w[Y];if(S.call(void 0,E,Y,w))return E}}function Jc(w,S){return S===void 0&&(S=Object),S&&typeof S.freeze=="function"?S.freeze(w):w}function Jm(w,S){if(w===null||typeof w!="object")throw new TypeError("target is not an object");for(var F in S)Object.prototype.hasOwnProperty.call(S,F)&&(w[F]=S[F]);return w}var ed=Jc({HTML:"text/html",isHTML:function(w){return w===ed.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),td=Jc({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(w){return w===td.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});js.assign=Jm;js.find=Wm;js.freeze=Jc;js.MIME_TYPE=ed;js.NAMESPACE=td});var lh=xa(Nn=>{var ud=ol(),gn=ud.find,ll=ud.NAMESPACE;function Km(w){return w!==""}function Ym(w){return w?w.split(/[\t\n\f\r ]+/).filter(Km):[]}function Qm(w,S){return w.hasOwnProperty(S)||(w[S]=!0),w}function id(w){if(!w)return[];var S=Ym(w);return Object.keys(S.reduce(Qm,{}))}function e0(w){return function(S){return w&&w.indexOf(S)!==-1}}function cl(w,S){for(var F in w)Object.prototype.hasOwnProperty.call(w,F)&&(S[F]=w[F])}function Sr(w,S){var F=w.prototype;if(!(F instanceof S)){let E=function(){};var Y=E;E.prototype=S.prototype,E=new E,cl(F,E),w.prototype=F=E}F.constructor!=w&&(typeof w!="function"&&console.error("unknown Class:"+w),F.constructor=w)}var Ir={},Yr=Ir.ELEMENT_NODE=1,Zs=Ir.ATTRIBUTE_NODE=2,wu=Ir.TEXT_NODE=3,cd=Ir.CDATA_SECTION_NODE=4,hd=Ir.ENTITY_REFERENCE_NODE=5,t0=Ir.ENTITY_NODE=6,Kc=Ir.PROCESSING_INSTRUCTION_NODE=7,Yc=Ir.COMMENT_NODE=8,pd=Ir.DOCUMENT_NODE=9,dd=Ir.DOCUMENT_TYPE_NODE=10,Rn=Ir.DOCUMENT_FRAGMENT_NODE=11,i0=Ir.NOTATION_NODE=12,sr={},Vi={},Y0=sr.INDEX_SIZE_ERR=(Vi[1]="Index size error",1),Q0=sr.DOMSTRING_SIZE_ERR=(Vi[2]="DOMString size error",2),Dr=sr.HIERARCHY_REQUEST_ERR=(Vi[3]="Hierarchy request error",3),eg=sr.WRONG_DOCUMENT_ERR=(Vi[4]="Wrong document",4),r0=sr.INVALID_CHARACTER_ERR=(Vi[5]="Invalid character",5),tg=sr.NO_DATA_ALLOWED_ERR=(Vi[6]="No data allowed",6),ig=sr.NO_MODIFICATION_ALLOWED_ERR=(Vi[7]="No modification allowed",7),fd=sr.NOT_FOUND_ERR=(Vi[8]="Not found",8),rg=sr.NOT_SUPPORTED_ERR=(Vi[9]="Not supported",9),rd=sr.INUSE_ATTRIBUTE_ERR=(Vi[10]="Attribute in use",10),$s=sr.INVALID_STATE_ERR=(Vi[11]="Invalid state",11),ng=sr.SYNTAX_ERR=(Vi[12]="Syntax error",12),ag=sr.INVALID_MODIFICATION_ERR=(Vi[13]="Invalid modification",13),sg=sr.NAMESPACE_ERR=(Vi[14]="Invalid namespace",14),og=sr.INVALID_ACCESS_ERR=(Vi[15]="Invalid access",15);function si(w,S){if(S instanceof Error)var F=S;else F=this,Error.call(this,Vi[w]),this.message=Vi[w],Error.captureStackTrace&&Error.captureStackTrace(this,si);return F.code=w,S&&(this.message=this.message+": "+S),F}si.prototype=Error.prototype;cl(sr,si);function Fn(){}Fn.prototype={length:0,item:function(w){return w>=0&&w<this.length?this[w]:null},toString:function(w,S,F){for(var Y=!!F&&!!F.requireWellFormed,E=[],p=0;p<this.length;p++)oh(this[p],E,w,S,null,Y);return E.join("")},filter:function(w){return Array.prototype.filter.call(this,w)},indexOf:function(w){return Array.prototype.indexOf.call(this,w)}};function Gs(w,S){this._node=w,this._refresh=S,Qc(this)}function Qc(w){var S=w._node._inc||w._node.ownerDocument._inc;if(w._inc!==S){var F=w._refresh(w._node);if(Cd(w,"length",F.length),!w.$$length||F.length<w.$$length)for(var Y=F.length;Y in w;Y++)Object.prototype.hasOwnProperty.call(w,Y)&&delete w[Y];cl(F,w),w._inc=S}}Gs.prototype.item=function(w){return Qc(this),this[w]||null};Sr(Gs,Fn);function Au(){}function md(w,S){for(var F=w.length;F--;)if(w[F]===S)return F}function nd(w,S,F,Y){if(Y?S[md(S,Y)]=F:S[S.length++]=F,w){F.ownerElement=w;var E=w.ownerDocument;E&&(Y&&yd(E,w,Y),n0(E,w,F))}}function ad(w,S,F){var Y=md(S,F);if(Y>=0){for(var E=S.length-1;Y<E;)S[Y]=S[++Y];if(S.length=E,w){var p=w.ownerDocument;p&&(yd(p,w,F),F.ownerElement=null)}}else throw new si(fd,new Error(w.tagName+"@"+F))}Au.prototype={length:0,item:Fn.prototype.item,getNamedItem:function(w){for(var S=this.length;S--;){var F=this[S];if(F.nodeName==w)return F}},setNamedItem:function(w){var S=w.ownerElement;if(S&&S!=this._ownerElement)throw new si(rd);var F=this.getNamedItem(w.nodeName);return nd(this._ownerElement,this,w,F),F},setNamedItemNS:function(w){var S=w.ownerElement,F;if(S&&S!=this._ownerElement)throw new si(rd);return F=this.getNamedItemNS(w.namespaceURI,w.localName),nd(this._ownerElement,this,w,F),F},removeNamedItem:function(w){var S=this.getNamedItem(w);return ad(this._ownerElement,this,S),S},removeNamedItemNS:function(w,S){var F=this.getNamedItemNS(w,S);return ad(this._ownerElement,this,F),F},getNamedItemNS:function(w,S){for(var F=this.length;F--;){var Y=this[F];if(Y.localName==S&&Y.namespaceURI==w)return Y}return null}};function gd(){}gd.prototype={hasFeature:function(w,S){return!0},createDocument:function(w,S,F){var Y=new hl;if(Y.implementation=this,Y.childNodes=new Fn,Y.doctype=F||null,F&&Y.appendChild(F),S){var E=Y.createElementNS(w,S);Y.appendChild(E)}return Y},createDocumentType:function(w,S,F){var Y=new Du;return Y.name=w,Y.nodeName=w,Y.publicId=S||"",Y.systemId=F||"",Y}};function ei(){}ei.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(w,S){return Tu(this,w,S)},replaceChild:function(w,S){Tu(this,w,S,xd),S&&this.removeChild(S)},removeChild:function(w){return vd(this,w)},appendChild:function(w){return this.insertBefore(w,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(w){return Td(this.ownerDocument||this,this,w)},normalize:function(){qi(this,null,{enter:function(w){for(var S=w.firstChild;S;){var F=S.nextSibling;F!==null&&F.nodeType===wu&&S.nodeType===wu?(w.removeChild(F),S.appendData(F.data)):S=F}return!0}})},isSupported:function(w,S){return this.ownerDocument.implementation.hasFeature(w,S)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(w){for(var S=this;S;){var F=S._nsMap;if(F){for(var Y in F)if(Object.prototype.hasOwnProperty.call(F,Y)&&F[Y]===w)return Y}S=S.nodeType==Zs?S.ownerDocument:S.parentNode}return null},lookupNamespaceURI:function(w){for(var S=this;S;){var F=S._nsMap;if(F&&Object.prototype.hasOwnProperty.call(F,w))return F[w];S=S.nodeType==Zs?S.ownerDocument:S.parentNode}return null},isDefaultNamespace:function(w){var S=this.lookupPrefix(w);return S==null}};function _d(w){return w=="<"&&"&lt;"||w==">"&&"&gt;"||w=="&"&&"&amp;"||w=='"'&&"&quot;"||"&#"+w.charCodeAt()+";"}cl(Ir,ei);cl(Ir,ei.prototype);function Eu(w,S){return qi(w,null,{enter:function(F){return S(F)?qi.STOP:!0}})===qi.STOP}function qi(w,S,F){for(var Y=[{node:w,context:S,phase:qi.ENTER}];Y.length>0;){var E=Y.pop();if(E.phase===qi.ENTER){var p=F.enter(E.node,E.context);if(p===qi.STOP)return qi.STOP;if(Y.push({node:E.node,context:p,phase:qi.EXIT}),p==null)continue;for(var ue=E.node.lastChild;ue;)Y.push({node:ue,context:p,phase:qi.ENTER}),ue=ue.previousSibling}else F.exit&&F.exit(E.node,E.context)}}qi.STOP=Symbol("walkDOM.STOP");qi.ENTER=0;qi.EXIT=1;function hl(){this.ownerDocument=this}function n0(w,S,F){w&&w._inc++;var Y=F.namespaceURI;Y===ll.XMLNS&&(S._nsMap[F.prefix?F.localName:""]=F.value)}function yd(w,S,F,Y){w&&w._inc++;var E=F.namespaceURI;E===ll.XMLNS&&delete S._nsMap[F.prefix?F.localName:""]}function eh(w,S,F){if(w&&w._inc){w._inc++;var Y=S.childNodes;if(F)Y[Y.length++]=F;else{for(var E=S.firstChild,p=0;E;)Y[p++]=E,E=E.nextSibling;Y.length=p,delete Y[Y.length]}}}function vd(w,S){var F=S.previousSibling,Y=S.nextSibling;return F?F.nextSibling=Y:w.firstChild=Y,Y?Y.previousSibling=F:w.lastChild=F,S.parentNode=null,S.previousSibling=null,S.nextSibling=null,eh(w.ownerDocument,w),S}function a0(w){return w&&(w.nodeType===ei.DOCUMENT_NODE||w.nodeType===ei.DOCUMENT_FRAGMENT_NODE||w.nodeType===ei.ELEMENT_NODE)}function s0(w){return w&&(_n(w)||th(w)||On(w)||w.nodeType===ei.DOCUMENT_FRAGMENT_NODE||w.nodeType===ei.COMMENT_NODE||w.nodeType===ei.PROCESSING_INSTRUCTION_NODE)}function On(w){return w&&w.nodeType===ei.DOCUMENT_TYPE_NODE}function _n(w){return w&&w.nodeType===ei.ELEMENT_NODE}function th(w){return w&&w.nodeType===ei.TEXT_NODE}function sd(w,S){var F=w.childNodes||[];if(gn(F,_n)||On(S))return!1;var Y=gn(F,On);return!(S&&Y&&F.indexOf(Y)>F.indexOf(S))}function od(w,S){var F=w.childNodes||[];function Y(p){return _n(p)&&p!==S}if(gn(F,Y))return!1;var E=gn(F,On);return!(S&&E&&F.indexOf(E)>F.indexOf(S))}function o0(w,S,F){if(!a0(w))throw new si(Dr,"Unexpected parent node type "+w.nodeType);if(F&&F.parentNode!==w)throw new si(fd,"child not in parent");if(!s0(S)||On(S)&&w.nodeType!==ei.DOCUMENT_NODE)throw new si(Dr,"Unexpected node type "+S.nodeType+" for parent node type "+w.nodeType)}function l0(w,S,F){var Y=w.childNodes||[],E=S.childNodes||[];if(S.nodeType===ei.DOCUMENT_FRAGMENT_NODE){var p=E.filter(_n);if(p.length>1||gn(E,th))throw new si(Dr,"More than one element or text in fragment");if(p.length===1&&!sd(w,F))throw new si(Dr,"Element in fragment can not be inserted before doctype")}if(_n(S)&&!sd(w,F))throw new si(Dr,"Only one element can be added and only after doctype");if(On(S)){if(gn(Y,On))throw new si(Dr,"Only one doctype is allowed");var ue=gn(Y,_n);if(F&&Y.indexOf(ue)<Y.indexOf(F))throw new si(Dr,"Doctype can only be inserted before an element");if(!F&&ue)throw new si(Dr,"Doctype can not be appended since element is present")}}function xd(w,S,F){var Y=w.childNodes||[],E=S.childNodes||[];if(S.nodeType===ei.DOCUMENT_FRAGMENT_NODE){var p=E.filter(_n);if(p.length>1||gn(E,th))throw new si(Dr,"More than one element or text in fragment");if(p.length===1&&!od(w,F))throw new si(Dr,"Element in fragment can not be inserted before doctype")}if(_n(S)&&!od(w,F))throw new si(Dr,"Only one element can be added and only after doctype");if(On(S)){let Ce=function(se){return On(se)&&se!==F};var pe=Ce;if(gn(Y,Ce))throw new si(Dr,"Only one doctype is allowed");var ue=gn(Y,_n);if(F&&Y.indexOf(ue)<Y.indexOf(F))throw new si(Dr,"Doctype can only be inserted before an element")}}function Tu(w,S,F,Y){o0(w,S,F),w.nodeType===ei.DOCUMENT_NODE&&(Y||l0)(w,S,F);var E=S.parentNode;if(E&&E.removeChild(S),S.nodeType===Rn){var p=S.firstChild;if(p==null)return S;var ue=S.lastChild}else p=ue=S;var pe=F?F.previousSibling:w.lastChild;p.previousSibling=pe,ue.nextSibling=F,pe?pe.nextSibling=p:w.firstChild=p,F==null?w.lastChild=ue:F.previousSibling=ue;do{p.parentNode=w;var Ce=w.ownerDocument||w;ul(p,Ce)}while(p!==ue&&(p=p.nextSibling));return eh(w.ownerDocument||w,w),S.nodeType==Rn&&(S.firstChild=S.lastChild=null),S}function ul(w,S){if(w.ownerDocument!==S){if(w.ownerDocument=S,w.nodeType===Yr&&w.attributes)for(var F=0;F<w.attributes.length;F++){var Y=w.attributes.item(F);Y&&(Y.ownerDocument=S)}for(var E=w.firstChild;E;)ul(E,S),E=E.nextSibling}}function u0(w,S){S.parentNode&&S.parentNode.removeChild(S),S.parentNode=w,S.previousSibling=w.lastChild,S.nextSibling=null,S.previousSibling?S.previousSibling.nextSibling=S:w.firstChild=S,w.lastChild=S,eh(w.ownerDocument,w,S);var F=w.ownerDocument||w;return ul(S,F),S}hl.prototype={nodeName:"#document",nodeType:pd,doctype:null,documentElement:null,_inc:1,insertBefore:function(w,S){if(w.nodeType==Rn){for(var F=w.firstChild;F;){var Y=F.nextSibling;this.insertBefore(F,S),F=Y}return w}return Tu(this,w,S),ul(w,this),this.documentElement===null&&w.nodeType===Yr&&(this.documentElement=w),w},removeChild:function(w){return this.documentElement==w&&(this.documentElement=null),vd(this,w)},replaceChild:function(w,S){Tu(this,w,S,xd),ul(w,this),S&&this.removeChild(S),_n(w)&&(this.documentElement=w)},importNode:function(w,S){return c0(this,w,S)},getElementById:function(w){var S=null;return Eu(this.documentElement,function(F){if(F.nodeType==Yr&&F.getAttribute("id")==w)return S=F,!0}),S},getElementsByClassName:function(w){var S=id(w);return new Gs(this,function(F){var Y=[];return S.length>0&&Eu(F.documentElement,function(E){if(E!==F&&E.nodeType===Yr){var p=E.getAttribute("class");if(p){var ue=w===p;if(!ue){var pe=id(p);ue=S.every(e0(pe))}ue&&Y.push(E)}}}),Y})},createElement:function(w){var S=new Xa;S.ownerDocument=this,S.nodeName=w,S.tagName=w,S.localName=w,S.childNodes=new Fn;var F=S.attributes=new Au;return F._ownerElement=S,S},createDocumentFragment:function(){var w=new Su;return w.ownerDocument=this,w.childNodes=new Fn,w},createTextNode:function(w){var S=new ih;return S.ownerDocument=this,S.appendData(w),S},createComment:function(w){var S=new rh;return S.ownerDocument=this,S.appendData(w),S},createCDATASection:function(w){if(w.indexOf("]]>")!==-1)throw new si(r0,'data contains "]]>"');var S=new nh;return S.ownerDocument=this,S.appendData(w),S},createProcessingInstruction:function(w,S){var F=new sh;return F.ownerDocument=this,F.tagName=F.nodeName=F.target=w,F.nodeValue=F.data=S,F},createAttribute:function(w){var S=new Cu;return S.ownerDocument=this,S.name=w,S.nodeName=w,S.localName=w,S.specified=!0,S},createEntityReference:function(w){var S=new ah;return S.ownerDocument=this,S.nodeName=w,S},createElementNS:function(w,S){var F=new Xa,Y=S.split(":"),E=F.attributes=new Au;return F.childNodes=new Fn,F.ownerDocument=this,F.nodeName=S,F.tagName=S,F.namespaceURI=w,Y.length==2?(F.prefix=Y[0],F.localName=Y[1]):F.localName=S,E._ownerElement=F,F},createAttributeNS:function(w,S){var F=new Cu,Y=S.split(":");return F.ownerDocument=this,F.nodeName=S,F.name=S,F.namespaceURI=w,F.specified=!0,Y.length==2?(F.prefix=Y[0],F.localName=Y[1]):F.localName=S,F}};Sr(hl,ei);function Xa(){this._nsMap={}}Xa.prototype={nodeType:Yr,hasAttribute:function(w){return this.getAttributeNode(w)!=null},getAttribute:function(w){var S=this.getAttributeNode(w);return S&&S.value||""},getAttributeNode:function(w){return this.attributes.getNamedItem(w)},setAttribute:function(w,S){var F=this.ownerDocument.createAttribute(w);F.value=F.nodeValue=""+S,this.setAttributeNode(F)},removeAttribute:function(w){var S=this.getAttributeNode(w);S&&this.removeAttributeNode(S)},appendChild:function(w){return w.nodeType===Rn?this.insertBefore(w,null):u0(this,w)},setAttributeNode:function(w){return this.attributes.setNamedItem(w)},setAttributeNodeNS:function(w){return this.attributes.setNamedItemNS(w)},removeAttributeNode:function(w){return this.attributes.removeNamedItem(w.nodeName)},removeAttributeNS:function(w,S){var F=this.getAttributeNodeNS(w,S);F&&this.removeAttributeNode(F)},hasAttributeNS:function(w,S){return this.getAttributeNodeNS(w,S)!=null},getAttributeNS:function(w,S){var F=this.getAttributeNodeNS(w,S);return F&&F.value||""},setAttributeNS:function(w,S,F){var Y=this.ownerDocument.createAttributeNS(w,S);Y.value=Y.nodeValue=""+F,this.setAttributeNode(Y)},getAttributeNodeNS:function(w,S){return this.attributes.getNamedItemNS(w,S)},getElementsByTagName:function(w){return new Gs(this,function(S){var F=[];return Eu(S,function(Y){Y!==S&&Y.nodeType==Yr&&(w==="*"||Y.tagName==w)&&F.push(Y)}),F})},getElementsByTagNameNS:function(w,S){return new Gs(this,function(F){var Y=[];return Eu(F,function(E){E!==F&&E.nodeType===Yr&&(w==="*"||E.namespaceURI===w)&&(S==="*"||E.localName==S)&&Y.push(E)}),Y})}};hl.prototype.getElementsByTagName=Xa.prototype.getElementsByTagName;hl.prototype.getElementsByTagNameNS=Xa.prototype.getElementsByTagNameNS;Sr(Xa,ei);function Cu(){}Cu.prototype.nodeType=Zs;Sr(Cu,ei);function pl(){}pl.prototype={data:"",substringData:function(w,S){return this.data.substring(w,w+S)},appendData:function(w){w=this.data+w,this.nodeValue=this.data=w,this.length=w.length},insertData:function(w,S){this.replaceData(w,0,S)},appendChild:function(w){throw new Error(Vi[Dr])},deleteData:function(w,S){this.replaceData(w,S,"")},replaceData:function(w,S,F){var Y=this.data.substring(0,w),E=this.data.substring(w+S);F=Y+F+E,this.nodeValue=this.data=F,this.length=F.length}};Sr(pl,ei);function ih(){}ih.prototype={nodeName:"#text",nodeType:wu,splitText:function(w){var S=this.data,F=S.substring(w);S=S.substring(0,w),this.data=this.nodeValue=S,this.length=S.length;var Y=this.ownerDocument.createTextNode(F);return this.parentNode&&this.parentNode.insertBefore(Y,this.nextSibling),Y}};Sr(ih,pl);function rh(){}rh.prototype={nodeName:"#comment",nodeType:Yc};Sr(rh,pl);function nh(){}nh.prototype={nodeName:"#cdata-section",nodeType:cd};Sr(nh,pl);function Du(){}Du.prototype.nodeType=dd;Sr(Du,ei);function bd(){}bd.prototype.nodeType=i0;Sr(bd,ei);function wd(){}wd.prototype.nodeType=t0;Sr(wd,ei);function ah(){}ah.prototype.nodeType=hd;Sr(ah,ei);function Su(){}Su.prototype.nodeName="#document-fragment";Su.prototype.nodeType=Rn;Sr(Su,ei);function sh(){}sh.prototype.nodeType=Kc;Sr(sh,ei);function Ad(){}Ad.prototype.serializeToString=function(w,S,F,Y){return Ed.call(w,S,F,Y)};ei.prototype.toString=Ed;function Ed(w,S,F){var Y=!!F&&!!F.requireWellFormed,E=[],p=this.nodeType==9&&this.documentElement||this,ue=p.prefix,pe=p.namespaceURI;if(pe&&ue==null){var ue=p.lookupPrefix(pe);if(ue==null)var Ce=[{namespace:pe,prefix:null}]}return oh(this,E,w,S,Ce,Y),E.join("")}function ld(w,S,F){var Y=w.prefix||"",E=w.namespaceURI;if(!E||Y==="xml"&&E===ll.XML||E===ll.XMLNS)return!1;for(var p=F.length;p--;){var ue=F[p];if(ue.prefix===Y)return ue.namespace!==E}return!0}function bu(w,S,F){w.push(" ",S,'="',F.replace(/[<>&"\t\n\r]/g,_d),'"')}function oh(w,S,F,Y,E,p){E||(E=[]),qi(w,{ns:E,isHTML:F},{enter:function(ue,pe){var Ce=pe.ns,se=pe.isHTML;if(Y)if(ue=Y(ue),ue){if(typeof ue=="string")return S.push(ue),null}else return null;switch(ue.nodeType){case Yr:var X=ue.attributes,It=X.length,mt=ue.tagName;se=ll.isHTML(ue.namespaceURI)||se;var Et=mt;if(!se&&!ue.prefix&&ue.namespaceURI){for(var li,Lt=0;Lt<X.length;Lt++)if(X.item(Lt).name==="xmlns"){li=X.item(Lt).value;break}if(!li)for(var Mt=Ce.length-1;Mt>=0;Mt--){var De=Ce[Mt];if(De.prefix===""&&De.namespace===ue.namespaceURI){li=De.namespace;break}}if(li!==ue.namespaceURI)for(var Mt=Ce.length-1;Mt>=0;Mt--){var De=Ce[Mt];if(De.namespace===ue.namespaceURI){De.prefix&&(Et=De.prefix+":"+mt);break}}}S.push("<",Et);for(var We=Ce.slice(),Re=0;Re<It;Re++){var Fe=X.item(Re);Fe.prefix=="xmlns"?We.push({prefix:Fe.localName,namespace:Fe.value}):Fe.nodeName=="xmlns"&&We.push({prefix:"",namespace:Fe.value})}for(var Re=0;Re<It;Re++){var Fe=X.item(Re);if(ld(Fe,se,We)){var Ye=Fe.prefix||"",_e=Fe.namespaceURI;bu(S,Ye?"xmlns:"+Ye:"xmlns",_e),We.push({prefix:Ye,namespace:_e})}var xe=Y?Y(Fe):Fe;xe&&(typeof xe=="string"?S.push(xe):bu(S,xe.name,xe.value))}if(mt===Et&&ld(ue,se,We)){var Le=ue.prefix||"",_e=ue.namespaceURI;bu(S,Le?"xmlns:"+Le:"xmlns",_e),We.push({prefix:Le,namespace:_e})}var ye=ue.firstChild;if(ye||se&&!/^(?:meta|link|img|br|hr|input)$/i.test(mt)){if(S.push(">"),se&&/^script$/i.test(mt)){for(;ye;)ye.data?S.push(ye.data):oh(ye,S,se,Y,We.slice(),p),ye=ye.nextSibling;return S.push("</",mt,">"),null}return{ns:We,isHTML:se,tag:Et}}else return S.push("/>"),null;case pd:case Rn:return{ns:Ce.slice(),isHTML:se,tag:null};case Zs:return bu(S,ue.name,ue.value),null;case wu:return S.push(ue.data.replace(/[<&>]/g,_d)),null;case cd:if(p&&ue.data.indexOf("]]>")!==-1)throw new si($s,'The CDATASection data contains "]]>"');return S.push("<![CDATA[",ue.data.replace(/]]>/g,"]]]]><![CDATA[>"),"]]>"),null;case Yc:if(p&&ue.data.indexOf("-->")!==-1)throw new si($s,'The comment node data contains "-->"');return S.push("<!--",ue.data,"-->"),null;case dd:if(p){if(ue.publicId&&!/^("[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%']*"|'[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%'"]*')$/.test(ue.publicId))throw new si($s,"DocumentType publicId is not a valid PubidLiteral");if(ue.systemId&&!/^("[^"]*"|'[^']*')$/.test(ue.systemId))throw new si($s,"DocumentType systemId is not a valid SystemLiteral");if(ue.internalSubset&&ue.internalSubset.indexOf("]>")!==-1)throw new si($s,'DocumentType internalSubset contains "]>"')}var Je=ue.publicId,Pe=ue.systemId;if(S.push("<!DOCTYPE ",ue.name),Je)S.push(" PUBLIC ",Je),Pe&&Pe!="."&&S.push(" ",Pe),S.push(">");else if(Pe&&Pe!=".")S.push(" SYSTEM ",Pe,">");else{var tt=ue.internalSubset;tt&&S.push(" [",tt,"]"),S.push(">")}return null;case Kc:if(p&&ue.data.indexOf("?>")!==-1)throw new si($s,'The ProcessingInstruction data contains "?>"');return S.push("<?",ue.target," ",ue.data,"?>"),null;case hd:return S.push("&",ue.nodeName,";"),null;default:return S.push("??",ue.nodeName),null}},exit:function(ue,pe){pe&&pe.tag&&S.push("</",pe.tag,">")}})}function c0(w,S,F){var Y;return qi(S,null,{enter:function(E,p){var ue=E.cloneNode(!1);ue.ownerDocument=w,ue.parentNode=null,p===null?Y=ue:p.appendChild(ue);var pe=E.nodeType===Zs||F;return pe?ue:null}}),Y}function Td(w,S,F){var Y;return qi(S,null,{enter:function(E,p){var ue=new E.constructor;for(var pe in E)if(Object.prototype.hasOwnProperty.call(E,pe)){var Ce=E[pe];typeof Ce!="object"&&Ce!=ue[pe]&&(ue[pe]=Ce)}E.childNodes&&(ue.childNodes=new Fn),ue.ownerDocument=w;var se=F;switch(ue.nodeType){case Yr:var X=E.attributes,It=ue.attributes=new Au,mt=X.length;It._ownerElement=ue;for(var Et=0;Et<mt;Et++)ue.setAttributeNode(Td(w,X.item(Et),!0));break;case Zs:se=!0}return p!==null?p.appendChild(ue):Y=ue,se?ue:null}}),Y}function Cd(w,S,F){w[S]=F}try{Object.defineProperty&&(Object.defineProperty(Gs.prototype,"length",{get:function(){return Qc(this),this.$$length}}),Object.defineProperty(ei.prototype,"textContent",{get:function(){if(this.nodeType===Yr||this.nodeType===Rn){var w=[];return qi(this,null,{enter:function(S){if(S.nodeType===Yr||S.nodeType===Rn)return!0;if(S.nodeType===Kc||S.nodeType===Yc)return null;w.push(S.nodeValue)}}),w.join("")}return this.nodeValue},set:function(w){switch(this.nodeType){case Yr:case Rn:for(;this.firstChild;)this.removeChild(this.firstChild);(w||String(w))&&this.appendChild(this.ownerDocument.createTextNode(w));break;default:this.data=w,this.value=w,this.nodeValue=w}}}),Cd=function(w,S,F){w["$$"+S]=F})}catch{}Nn.DocumentType=Du;Nn.DOMException=si;Nn.DOMImplementation=gd;Nn.Element=Xa;Nn.Node=ei;Nn.NodeList=Fn;Nn.walkDOM=qi;Nn.XMLSerializer=Ad});var Sd=xa(dl=>{"use strict";var Dd=ol().freeze;dl.XML_ENTITIES=Dd({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'});dl.HTML_ENTITIES=Dd({Aacute:"\xC1",aacute:"\xE1",Abreve:"\u0102",abreve:"\u0103",ac:"\u223E",acd:"\u223F",acE:"\u223E\u0333",Acirc:"\xC2",acirc:"\xE2",acute:"\xB4",Acy:"\u0410",acy:"\u0430",AElig:"\xC6",aelig:"\xE6",af:"\u2061",Afr:"\u{1D504}",afr:"\u{1D51E}",Agrave:"\xC0",agrave:"\xE0",alefsym:"\u2135",aleph:"\u2135",Alpha:"\u0391",alpha:"\u03B1",Amacr:"\u0100",amacr:"\u0101",amalg:"\u2A3F",AMP:"&",amp:"&",And:"\u2A53",and:"\u2227",andand:"\u2A55",andd:"\u2A5C",andslope:"\u2A58",andv:"\u2A5A",ang:"\u2220",ange:"\u29A4",angle:"\u2220",angmsd:"\u2221",angmsdaa:"\u29A8",angmsdab:"\u29A9",angmsdac:"\u29AA",angmsdad:"\u29AB",angmsdae:"\u29AC",angmsdaf:"\u29AD",angmsdag:"\u29AE",angmsdah:"\u29AF",angrt:"\u221F",angrtvb:"\u22BE",angrtvbd:"\u299D",angsph:"\u2222",angst:"\xC5",angzarr:"\u237C",Aogon:"\u0104",aogon:"\u0105",Aopf:"\u{1D538}",aopf:"\u{1D552}",ap:"\u2248",apacir:"\u2A6F",apE:"\u2A70",ape:"\u224A",apid:"\u224B",apos:"'",ApplyFunction:"\u2061",approx:"\u2248",approxeq:"\u224A",Aring:"\xC5",aring:"\xE5",Ascr:"\u{1D49C}",ascr:"\u{1D4B6}",Assign:"\u2254",ast:"*",asymp:"\u2248",asympeq:"\u224D",Atilde:"\xC3",atilde:"\xE3",Auml:"\xC4",auml:"\xE4",awconint:"\u2233",awint:"\u2A11",backcong:"\u224C",backepsilon:"\u03F6",backprime:"\u2035",backsim:"\u223D",backsimeq:"\u22CD",Backslash:"\u2216",Barv:"\u2AE7",barvee:"\u22BD",Barwed:"\u2306",barwed:"\u2305",barwedge:"\u2305",bbrk:"\u23B5",bbrktbrk:"\u23B6",bcong:"\u224C",Bcy:"\u0411",bcy:"\u0431",bdquo:"\u201E",becaus:"\u2235",Because:"\u2235",because:"\u2235",bemptyv:"\u29B0",bepsi:"\u03F6",bernou:"\u212C",Bernoullis:"\u212C",Beta:"\u0392",beta:"\u03B2",beth:"\u2136",between:"\u226C",Bfr:"\u{1D505}",bfr:"\u{1D51F}",bigcap:"\u22C2",bigcirc:"\u25EF",bigcup:"\u22C3",bigodot:"\u2A00",bigoplus:"\u2A01",bigotimes:"\u2A02",bigsqcup:"\u2A06",bigstar:"\u2605",bigtriangledown:"\u25BD",bigtriangleup:"\u25B3",biguplus:"\u2A04",bigvee:"\u22C1",bigwedge:"\u22C0",bkarow:"\u290D",blacklozenge:"\u29EB",blacksquare:"\u25AA",blacktriangle:"\u25B4",blacktriangledown:"\u25BE",blacktriangleleft:"\u25C2",blacktriangleright:"\u25B8",blank:"\u2423",blk12:"\u2592",blk14:"\u2591",blk34:"\u2593",block:"\u2588",bne:"=\u20E5",bnequiv:"\u2261\u20E5",bNot:"\u2AED",bnot:"\u2310",Bopf:"\u{1D539}",bopf:"\u{1D553}",bot:"\u22A5",bottom:"\u22A5",bowtie:"\u22C8",boxbox:"\u29C9",boxDL:"\u2557",boxDl:"\u2556",boxdL:"\u2555",boxdl:"\u2510",boxDR:"\u2554",boxDr:"\u2553",boxdR:"\u2552",boxdr:"\u250C",boxH:"\u2550",boxh:"\u2500",boxHD:"\u2566",boxHd:"\u2564",boxhD:"\u2565",boxhd:"\u252C",boxHU:"\u2569",boxHu:"\u2567",boxhU:"\u2568",boxhu:"\u2534",boxminus:"\u229F",boxplus:"\u229E",boxtimes:"\u22A0",boxUL:"\u255D",boxUl:"\u255C",boxuL:"\u255B",boxul:"\u2518",boxUR:"\u255A",boxUr:"\u2559",boxuR:"\u2558",boxur:"\u2514",boxV:"\u2551",boxv:"\u2502",boxVH:"\u256C",boxVh:"\u256B",boxvH:"\u256A",boxvh:"\u253C",boxVL:"\u2563",boxVl:"\u2562",boxvL:"\u2561",boxvl:"\u2524",boxVR:"\u2560",boxVr:"\u255F",boxvR:"\u255E",boxvr:"\u251C",bprime:"\u2035",Breve:"\u02D8",breve:"\u02D8",brvbar:"\xA6",Bscr:"\u212C",bscr:"\u{1D4B7}",bsemi:"\u204F",bsim:"\u223D",bsime:"\u22CD",bsol:"\\",bsolb:"\u29C5",bsolhsub:"\u27C8",bull:"\u2022",bullet:"\u2022",bump:"\u224E",bumpE:"\u2AAE",bumpe:"\u224F",Bumpeq:"\u224E",bumpeq:"\u224F",Cacute:"\u0106",cacute:"\u0107",Cap:"\u22D2",cap:"\u2229",capand:"\u2A44",capbrcup:"\u2A49",capcap:"\u2A4B",capcup:"\u2A47",capdot:"\u2A40",CapitalDifferentialD:"\u2145",caps:"\u2229\uFE00",caret:"\u2041",caron:"\u02C7",Cayleys:"\u212D",ccaps:"\u2A4D",Ccaron:"\u010C",ccaron:"\u010D",Ccedil:"\xC7",ccedil:"\xE7",Ccirc:"\u0108",ccirc:"\u0109",Cconint:"\u2230",ccups:"\u2A4C",ccupssm:"\u2A50",Cdot:"\u010A",cdot:"\u010B",cedil:"\xB8",Cedilla:"\xB8",cemptyv:"\u29B2",cent:"\xA2",CenterDot:"\xB7",centerdot:"\xB7",Cfr:"\u212D",cfr:"\u{1D520}",CHcy:"\u0427",chcy:"\u0447",check:"\u2713",checkmark:"\u2713",Chi:"\u03A7",chi:"\u03C7",cir:"\u25CB",circ:"\u02C6",circeq:"\u2257",circlearrowleft:"\u21BA",circlearrowright:"\u21BB",circledast:"\u229B",circledcirc:"\u229A",circleddash:"\u229D",CircleDot:"\u2299",circledR:"\xAE",circledS:"\u24C8",CircleMinus:"\u2296",CirclePlus:"\u2295",CircleTimes:"\u2297",cirE:"\u29C3",cire:"\u2257",cirfnint:"\u2A10",cirmid:"\u2AEF",cirscir:"\u29C2",ClockwiseContourIntegral:"\u2232",CloseCurlyDoubleQuote:"\u201D",CloseCurlyQuote:"\u2019",clubs:"\u2663",clubsuit:"\u2663",Colon:"\u2237",colon:":",Colone:"\u2A74",colone:"\u2254",coloneq:"\u2254",comma:",",commat:"@",comp:"\u2201",compfn:"\u2218",complement:"\u2201",complexes:"\u2102",cong:"\u2245",congdot:"\u2A6D",Congruent:"\u2261",Conint:"\u222F",conint:"\u222E",ContourIntegral:"\u222E",Copf:"\u2102",copf:"\u{1D554}",coprod:"\u2210",Coproduct:"\u2210",COPY:"\xA9",copy:"\xA9",copysr:"\u2117",CounterClockwiseContourIntegral:"\u2233",crarr:"\u21B5",Cross:"\u2A2F",cross:"\u2717",Cscr:"\u{1D49E}",cscr:"\u{1D4B8}",csub:"\u2ACF",csube:"\u2AD1",csup:"\u2AD0",csupe:"\u2AD2",ctdot:"\u22EF",cudarrl:"\u2938",cudarrr:"\u2935",cuepr:"\u22DE",cuesc:"\u22DF",cularr:"\u21B6",cularrp:"\u293D",Cup:"\u22D3",cup:"\u222A",cupbrcap:"\u2A48",CupCap:"\u224D",cupcap:"\u2A46",cupcup:"\u2A4A",cupdot:"\u228D",cupor:"\u2A45",cups:"\u222A\uFE00",curarr:"\u21B7",curarrm:"\u293C",curlyeqprec:"\u22DE",curlyeqsucc:"\u22DF",curlyvee:"\u22CE",curlywedge:"\u22CF",curren:"\xA4",curvearrowleft:"\u21B6",curvearrowright:"\u21B7",cuvee:"\u22CE",cuwed:"\u22CF",cwconint:"\u2232",cwint:"\u2231",cylcty:"\u232D",Dagger:"\u2021",dagger:"\u2020",daleth:"\u2138",Darr:"\u21A1",dArr:"\u21D3",darr:"\u2193",dash:"\u2010",Dashv:"\u2AE4",dashv:"\u22A3",dbkarow:"\u290F",dblac:"\u02DD",Dcaron:"\u010E",dcaron:"\u010F",Dcy:"\u0414",dcy:"\u0434",DD:"\u2145",dd:"\u2146",ddagger:"\u2021",ddarr:"\u21CA",DDotrahd:"\u2911",ddotseq:"\u2A77",deg:"\xB0",Del:"\u2207",Delta:"\u0394",delta:"\u03B4",demptyv:"\u29B1",dfisht:"\u297F",Dfr:"\u{1D507}",dfr:"\u{1D521}",dHar:"\u2965",dharl:"\u21C3",dharr:"\u21C2",DiacriticalAcute:"\xB4",DiacriticalDot:"\u02D9",DiacriticalDoubleAcute:"\u02DD",DiacriticalGrave:"`",DiacriticalTilde:"\u02DC",diam:"\u22C4",Diamond:"\u22C4",diamond:"\u22C4",diamondsuit:"\u2666",diams:"\u2666",die:"\xA8",DifferentialD:"\u2146",digamma:"\u03DD",disin:"\u22F2",div:"\xF7",divide:"\xF7",divideontimes:"\u22C7",divonx:"\u22C7",DJcy:"\u0402",djcy:"\u0452",dlcorn:"\u231E",dlcrop:"\u230D",dollar:"$",Dopf:"\u{1D53B}",dopf:"\u{1D555}",Dot:"\xA8",dot:"\u02D9",DotDot:"\u20DC",doteq:"\u2250",doteqdot:"\u2251",DotEqual:"\u2250",dotminus:"\u2238",dotplus:"\u2214",dotsquare:"\u22A1",doublebarwedge:"\u2306",DoubleContourIntegral:"\u222F",DoubleDot:"\xA8",DoubleDownArrow:"\u21D3",DoubleLeftArrow:"\u21D0",DoubleLeftRightArrow:"\u21D4",DoubleLeftTee:"\u2AE4",DoubleLongLeftArrow:"\u27F8",DoubleLongLeftRightArrow:"\u27FA",DoubleLongRightArrow:"\u27F9",DoubleRightArrow:"\u21D2",DoubleRightTee:"\u22A8",DoubleUpArrow:"\u21D1",DoubleUpDownArrow:"\u21D5",DoubleVerticalBar:"\u2225",DownArrow:"\u2193",Downarrow:"\u21D3",downarrow:"\u2193",DownArrowBar:"\u2913",DownArrowUpArrow:"\u21F5",DownBreve:"\u0311",downdownarrows:"\u21CA",downharpoonleft:"\u21C3",downharpoonright:"\u21C2",DownLeftRightVector:"\u2950",DownLeftTeeVector:"\u295E",DownLeftVector:"\u21BD",DownLeftVectorBar:"\u2956",DownRightTeeVector:"\u295F",DownRightVector:"\u21C1",DownRightVectorBar:"\u2957",DownTee:"\u22A4",DownTeeArrow:"\u21A7",drbkarow:"\u2910",drcorn:"\u231F",drcrop:"\u230C",Dscr:"\u{1D49F}",dscr:"\u{1D4B9}",DScy:"\u0405",dscy:"\u0455",dsol:"\u29F6",Dstrok:"\u0110",dstrok:"\u0111",dtdot:"\u22F1",dtri:"\u25BF",dtrif:"\u25BE",duarr:"\u21F5",duhar:"\u296F",dwangle:"\u29A6",DZcy:"\u040F",dzcy:"\u045F",dzigrarr:"\u27FF",Eacute:"\xC9",eacute:"\xE9",easter:"\u2A6E",Ecaron:"\u011A",ecaron:"\u011B",ecir:"\u2256",Ecirc:"\xCA",ecirc:"\xEA",ecolon:"\u2255",Ecy:"\u042D",ecy:"\u044D",eDDot:"\u2A77",Edot:"\u0116",eDot:"\u2251",edot:"\u0117",ee:"\u2147",efDot:"\u2252",Efr:"\u{1D508}",efr:"\u{1D522}",eg:"\u2A9A",Egrave:"\xC8",egrave:"\xE8",egs:"\u2A96",egsdot:"\u2A98",el:"\u2A99",Element:"\u2208",elinters:"\u23E7",ell:"\u2113",els:"\u2A95",elsdot:"\u2A97",Emacr:"\u0112",emacr:"\u0113",empty:"\u2205",emptyset:"\u2205",EmptySmallSquare:"\u25FB",emptyv:"\u2205",EmptyVerySmallSquare:"\u25AB",emsp:"\u2003",emsp13:"\u2004",emsp14:"\u2005",ENG:"\u014A",eng:"\u014B",ensp:"\u2002",Eogon:"\u0118",eogon:"\u0119",Eopf:"\u{1D53C}",eopf:"\u{1D556}",epar:"\u22D5",eparsl:"\u29E3",eplus:"\u2A71",epsi:"\u03B5",Epsilon:"\u0395",epsilon:"\u03B5",epsiv:"\u03F5",eqcirc:"\u2256",eqcolon:"\u2255",eqsim:"\u2242",eqslantgtr:"\u2A96",eqslantless:"\u2A95",Equal:"\u2A75",equals:"=",EqualTilde:"\u2242",equest:"\u225F",Equilibrium:"\u21CC",equiv:"\u2261",equivDD:"\u2A78",eqvparsl:"\u29E5",erarr:"\u2971",erDot:"\u2253",Escr:"\u2130",escr:"\u212F",esdot:"\u2250",Esim:"\u2A73",esim:"\u2242",Eta:"\u0397",eta:"\u03B7",ETH:"\xD0",eth:"\xF0",Euml:"\xCB",euml:"\xEB",euro:"\u20AC",excl:"!",exist:"\u2203",Exists:"\u2203",expectation:"\u2130",ExponentialE:"\u2147",exponentiale:"\u2147",fallingdotseq:"\u2252",Fcy:"\u0424",fcy:"\u0444",female:"\u2640",ffilig:"\uFB03",fflig:"\uFB00",ffllig:"\uFB04",Ffr:"\u{1D509}",ffr:"\u{1D523}",filig:"\uFB01",FilledSmallSquare:"\u25FC",FilledVerySmallSquare:"\u25AA",fjlig:"fj",flat:"\u266D",fllig:"\uFB02",fltns:"\u25B1",fnof:"\u0192",Fopf:"\u{1D53D}",fopf:"\u{1D557}",ForAll:"\u2200",forall:"\u2200",fork:"\u22D4",forkv:"\u2AD9",Fouriertrf:"\u2131",fpartint:"\u2A0D",frac12:"\xBD",frac13:"\u2153",frac14:"\xBC",frac15:"\u2155",frac16:"\u2159",frac18:"\u215B",frac23:"\u2154",frac25:"\u2156",frac34:"\xBE",frac35:"\u2157",frac38:"\u215C",frac45:"\u2158",frac56:"\u215A",frac58:"\u215D",frac78:"\u215E",frasl:"\u2044",frown:"\u2322",Fscr:"\u2131",fscr:"\u{1D4BB}",gacute:"\u01F5",Gamma:"\u0393",gamma:"\u03B3",Gammad:"\u03DC",gammad:"\u03DD",gap:"\u2A86",Gbreve:"\u011E",gbreve:"\u011F",Gcedil:"\u0122",Gcirc:"\u011C",gcirc:"\u011D",Gcy:"\u0413",gcy:"\u0433",Gdot:"\u0120",gdot:"\u0121",gE:"\u2267",ge:"\u2265",gEl:"\u2A8C",gel:"\u22DB",geq:"\u2265",geqq:"\u2267",geqslant:"\u2A7E",ges:"\u2A7E",gescc:"\u2AA9",gesdot:"\u2A80",gesdoto:"\u2A82",gesdotol:"\u2A84",gesl:"\u22DB\uFE00",gesles:"\u2A94",Gfr:"\u{1D50A}",gfr:"\u{1D524}",Gg:"\u22D9",gg:"\u226B",ggg:"\u22D9",gimel:"\u2137",GJcy:"\u0403",gjcy:"\u0453",gl:"\u2277",gla:"\u2AA5",glE:"\u2A92",glj:"\u2AA4",gnap:"\u2A8A",gnapprox:"\u2A8A",gnE:"\u2269",gne:"\u2A88",gneq:"\u2A88",gneqq:"\u2269",gnsim:"\u22E7",Gopf:"\u{1D53E}",gopf:"\u{1D558}",grave:"`",GreaterEqual:"\u2265",GreaterEqualLess:"\u22DB",GreaterFullEqual:"\u2267",GreaterGreater:"\u2AA2",GreaterLess:"\u2277",GreaterSlantEqual:"\u2A7E",GreaterTilde:"\u2273",Gscr:"\u{1D4A2}",gscr:"\u210A",gsim:"\u2273",gsime:"\u2A8E",gsiml:"\u2A90",Gt:"\u226B",GT:">",gt:">",gtcc:"\u2AA7",gtcir:"\u2A7A",gtdot:"\u22D7",gtlPar:"\u2995",gtquest:"\u2A7C",gtrapprox:"\u2A86",gtrarr:"\u2978",gtrdot:"\u22D7",gtreqless:"\u22DB",gtreqqless:"\u2A8C",gtrless:"\u2277",gtrsim:"\u2273",gvertneqq:"\u2269\uFE00",gvnE:"\u2269\uFE00",Hacek:"\u02C7",hairsp:"\u200A",half:"\xBD",hamilt:"\u210B",HARDcy:"\u042A",hardcy:"\u044A",hArr:"\u21D4",harr:"\u2194",harrcir:"\u2948",harrw:"\u21AD",Hat:"^",hbar:"\u210F",Hcirc:"\u0124",hcirc:"\u0125",hearts:"\u2665",heartsuit:"\u2665",hellip:"\u2026",hercon:"\u22B9",Hfr:"\u210C",hfr:"\u{1D525}",HilbertSpace:"\u210B",hksearow:"\u2925",hkswarow:"\u2926",hoarr:"\u21FF",homtht:"\u223B",hookleftarrow:"\u21A9",hookrightarrow:"\u21AA",Hopf:"\u210D",hopf:"\u{1D559}",horbar:"\u2015",HorizontalLine:"\u2500",Hscr:"\u210B",hscr:"\u{1D4BD}",hslash:"\u210F",Hstrok:"\u0126",hstrok:"\u0127",HumpDownHump:"\u224E",HumpEqual:"\u224F",hybull:"\u2043",hyphen:"\u2010",Iacute:"\xCD",iacute:"\xED",ic:"\u2063",Icirc:"\xCE",icirc:"\xEE",Icy:"\u0418",icy:"\u0438",Idot:"\u0130",IEcy:"\u0415",iecy:"\u0435",iexcl:"\xA1",iff:"\u21D4",Ifr:"\u2111",ifr:"\u{1D526}",Igrave:"\xCC",igrave:"\xEC",ii:"\u2148",iiiint:"\u2A0C",iiint:"\u222D",iinfin:"\u29DC",iiota:"\u2129",IJlig:"\u0132",ijlig:"\u0133",Im:"\u2111",Imacr:"\u012A",imacr:"\u012B",image:"\u2111",ImaginaryI:"\u2148",imagline:"\u2110",imagpart:"\u2111",imath:"\u0131",imof:"\u22B7",imped:"\u01B5",Implies:"\u21D2",in:"\u2208",incare:"\u2105",infin:"\u221E",infintie:"\u29DD",inodot:"\u0131",Int:"\u222C",int:"\u222B",intcal:"\u22BA",integers:"\u2124",Integral:"\u222B",intercal:"\u22BA",Intersection:"\u22C2",intlarhk:"\u2A17",intprod:"\u2A3C",InvisibleComma:"\u2063",InvisibleTimes:"\u2062",IOcy:"\u0401",iocy:"\u0451",Iogon:"\u012E",iogon:"\u012F",Iopf:"\u{1D540}",iopf:"\u{1D55A}",Iota:"\u0399",iota:"\u03B9",iprod:"\u2A3C",iquest:"\xBF",Iscr:"\u2110",iscr:"\u{1D4BE}",isin:"\u2208",isindot:"\u22F5",isinE:"\u22F9",isins:"\u22F4",isinsv:"\u22F3",isinv:"\u2208",it:"\u2062",Itilde:"\u0128",itilde:"\u0129",Iukcy:"\u0406",iukcy:"\u0456",Iuml:"\xCF",iuml:"\xEF",Jcirc:"\u0134",jcirc:"\u0135",Jcy:"\u0419",jcy:"\u0439",Jfr:"\u{1D50D}",jfr:"\u{1D527}",jmath:"\u0237",Jopf:"\u{1D541}",jopf:"\u{1D55B}",Jscr:"\u{1D4A5}",jscr:"\u{1D4BF}",Jsercy:"\u0408",jsercy:"\u0458",Jukcy:"\u0404",jukcy:"\u0454",Kappa:"\u039A",kappa:"\u03BA",kappav:"\u03F0",Kcedil:"\u0136",kcedil:"\u0137",Kcy:"\u041A",kcy:"\u043A",Kfr:"\u{1D50E}",kfr:"\u{1D528}",kgreen:"\u0138",KHcy:"\u0425",khcy:"\u0445",KJcy:"\u040C",kjcy:"\u045C",Kopf:"\u{1D542}",kopf:"\u{1D55C}",Kscr:"\u{1D4A6}",kscr:"\u{1D4C0}",lAarr:"\u21DA",Lacute:"\u0139",lacute:"\u013A",laemptyv:"\u29B4",lagran:"\u2112",Lambda:"\u039B",lambda:"\u03BB",Lang:"\u27EA",lang:"\u27E8",langd:"\u2991",langle:"\u27E8",lap:"\u2A85",Laplacetrf:"\u2112",laquo:"\xAB",Larr:"\u219E",lArr:"\u21D0",larr:"\u2190",larrb:"\u21E4",larrbfs:"\u291F",larrfs:"\u291D",larrhk:"\u21A9",larrlp:"\u21AB",larrpl:"\u2939",larrsim:"\u2973",larrtl:"\u21A2",lat:"\u2AAB",lAtail:"\u291B",latail:"\u2919",late:"\u2AAD",lates:"\u2AAD\uFE00",lBarr:"\u290E",lbarr:"\u290C",lbbrk:"\u2772",lbrace:"{",lbrack:"[",lbrke:"\u298B",lbrksld:"\u298F",lbrkslu:"\u298D",Lcaron:"\u013D",lcaron:"\u013E",Lcedil:"\u013B",lcedil:"\u013C",lceil:"\u2308",lcub:"{",Lcy:"\u041B",lcy:"\u043B",ldca:"\u2936",ldquo:"\u201C",ldquor:"\u201E",ldrdhar:"\u2967",ldrushar:"\u294B",ldsh:"\u21B2",lE:"\u2266",le:"\u2264",LeftAngleBracket:"\u27E8",LeftArrow:"\u2190",Leftarrow:"\u21D0",leftarrow:"\u2190",LeftArrowBar:"\u21E4",LeftArrowRightArrow:"\u21C6",leftarrowtail:"\u21A2",LeftCeiling:"\u2308",LeftDoubleBracket:"\u27E6",LeftDownTeeVector:"\u2961",LeftDownVector:"\u21C3",LeftDownVectorBar:"\u2959",LeftFloor:"\u230A",leftharpoondown:"\u21BD",leftharpoonup:"\u21BC",leftleftarrows:"\u21C7",LeftRightArrow:"\u2194",Leftrightarrow:"\u21D4",leftrightarrow:"\u2194",leftrightarrows:"\u21C6",leftrightharpoons:"\u21CB",leftrightsquigarrow:"\u21AD",LeftRightVector:"\u294E",LeftTee:"\u22A3",LeftTeeArrow:"\u21A4",LeftTeeVector:"\u295A",leftthreetimes:"\u22CB",LeftTriangle:"\u22B2",LeftTriangleBar:"\u29CF",LeftTriangleEqual:"\u22B4",LeftUpDownVector:"\u2951",LeftUpTeeVector:"\u2960",LeftUpVector:"\u21BF",LeftUpVectorBar:"\u2958",LeftVector:"\u21BC",LeftVectorBar:"\u2952",lEg:"\u2A8B",leg:"\u22DA",leq:"\u2264",leqq:"\u2266",leqslant:"\u2A7D",les:"\u2A7D",lescc:"\u2AA8",lesdot:"\u2A7F",lesdoto:"\u2A81",lesdotor:"\u2A83",lesg:"\u22DA\uFE00",lesges:"\u2A93",lessapprox:"\u2A85",lessdot:"\u22D6",lesseqgtr:"\u22DA",lesseqqgtr:"\u2A8B",LessEqualGreater:"\u22DA",LessFullEqual:"\u2266",LessGreater:"\u2276",lessgtr:"\u2276",LessLess:"\u2AA1",lesssim:"\u2272",LessSlantEqual:"\u2A7D",LessTilde:"\u2272",lfisht:"\u297C",lfloor:"\u230A",Lfr:"\u{1D50F}",lfr:"\u{1D529}",lg:"\u2276",lgE:"\u2A91",lHar:"\u2962",lhard:"\u21BD",lharu:"\u21BC",lharul:"\u296A",lhblk:"\u2584",LJcy:"\u0409",ljcy:"\u0459",Ll:"\u22D8",ll:"\u226A",llarr:"\u21C7",llcorner:"\u231E",Lleftarrow:"\u21DA",llhard:"\u296B",lltri:"\u25FA",Lmidot:"\u013F",lmidot:"\u0140",lmoust:"\u23B0",lmoustache:"\u23B0",lnap:"\u2A89",lnapprox:"\u2A89",lnE:"\u2268",lne:"\u2A87",lneq:"\u2A87",lneqq:"\u2268",lnsim:"\u22E6",loang:"\u27EC",loarr:"\u21FD",lobrk:"\u27E6",LongLeftArrow:"\u27F5",Longleftarrow:"\u27F8",longleftarrow:"\u27F5",LongLeftRightArrow:"\u27F7",Longleftrightarrow:"\u27FA",longleftrightarrow:"\u27F7",longmapsto:"\u27FC",LongRightArrow:"\u27F6",Longrightarrow:"\u27F9",longrightarrow:"\u27F6",looparrowleft:"\u21AB",looparrowright:"\u21AC",lopar:"\u2985",Lopf:"\u{1D543}",lopf:"\u{1D55D}",loplus:"\u2A2D",lotimes:"\u2A34",lowast:"\u2217",lowbar:"_",LowerLeftArrow:"\u2199",LowerRightArrow:"\u2198",loz:"\u25CA",lozenge:"\u25CA",lozf:"\u29EB",lpar:"(",lparlt:"\u2993",lrarr:"\u21C6",lrcorner:"\u231F",lrhar:"\u21CB",lrhard:"\u296D",lrm:"\u200E",lrtri:"\u22BF",lsaquo:"\u2039",Lscr:"\u2112",lscr:"\u{1D4C1}",Lsh:"\u21B0",lsh:"\u21B0",lsim:"\u2272",lsime:"\u2A8D",lsimg:"\u2A8F",lsqb:"[",lsquo:"\u2018",lsquor:"\u201A",Lstrok:"\u0141",lstrok:"\u0142",Lt:"\u226A",LT:"<",lt:"<",ltcc:"\u2AA6",ltcir:"\u2A79",ltdot:"\u22D6",lthree:"\u22CB",ltimes:"\u22C9",ltlarr:"\u2976",ltquest:"\u2A7B",ltri:"\u25C3",ltrie:"\u22B4",ltrif:"\u25C2",ltrPar:"\u2996",lurdshar:"\u294A",luruhar:"\u2966",lvertneqq:"\u2268\uFE00",lvnE:"\u2268\uFE00",macr:"\xAF",male:"\u2642",malt:"\u2720",maltese:"\u2720",Map:"\u2905",map:"\u21A6",mapsto:"\u21A6",mapstodown:"\u21A7",mapstoleft:"\u21A4",mapstoup:"\u21A5",marker:"\u25AE",mcomma:"\u2A29",Mcy:"\u041C",mcy:"\u043C",mdash:"\u2014",mDDot:"\u223A",measuredangle:"\u2221",MediumSpace:"\u205F",Mellintrf:"\u2133",Mfr:"\u{1D510}",mfr:"\u{1D52A}",mho:"\u2127",micro:"\xB5",mid:"\u2223",midast:"*",midcir:"\u2AF0",middot:"\xB7",minus:"\u2212",minusb:"\u229F",minusd:"\u2238",minusdu:"\u2A2A",MinusPlus:"\u2213",mlcp:"\u2ADB",mldr:"\u2026",mnplus:"\u2213",models:"\u22A7",Mopf:"\u{1D544}",mopf:"\u{1D55E}",mp:"\u2213",Mscr:"\u2133",mscr:"\u{1D4C2}",mstpos:"\u223E",Mu:"\u039C",mu:"\u03BC",multimap:"\u22B8",mumap:"\u22B8",nabla:"\u2207",Nacute:"\u0143",nacute:"\u0144",nang:"\u2220\u20D2",nap:"\u2249",napE:"\u2A70\u0338",napid:"\u224B\u0338",napos:"\u0149",napprox:"\u2249",natur:"\u266E",natural:"\u266E",naturals:"\u2115",nbsp:"\xA0",nbump:"\u224E\u0338",nbumpe:"\u224F\u0338",ncap:"\u2A43",Ncaron:"\u0147",ncaron:"\u0148",Ncedil:"\u0145",ncedil:"\u0146",ncong:"\u2247",ncongdot:"\u2A6D\u0338",ncup:"\u2A42",Ncy:"\u041D",ncy:"\u043D",ndash:"\u2013",ne:"\u2260",nearhk:"\u2924",neArr:"\u21D7",nearr:"\u2197",nearrow:"\u2197",nedot:"\u2250\u0338",NegativeMediumSpace:"\u200B",NegativeThickSpace:"\u200B",NegativeThinSpace:"\u200B",NegativeVeryThinSpace:"\u200B",nequiv:"\u2262",nesear:"\u2928",nesim:"\u2242\u0338",NestedGreaterGreater:"\u226B",NestedLessLess:"\u226A",NewLine:`
`,nexist:"\u2204",nexists:"\u2204",Nfr:"\u{1D511}",nfr:"\u{1D52B}",ngE:"\u2267\u0338",nge:"\u2271",ngeq:"\u2271",ngeqq:"\u2267\u0338",ngeqslant:"\u2A7E\u0338",nges:"\u2A7E\u0338",nGg:"\u22D9\u0338",ngsim:"\u2275",nGt:"\u226B\u20D2",ngt:"\u226F",ngtr:"\u226F",nGtv:"\u226B\u0338",nhArr:"\u21CE",nharr:"\u21AE",nhpar:"\u2AF2",ni:"\u220B",nis:"\u22FC",nisd:"\u22FA",niv:"\u220B",NJcy:"\u040A",njcy:"\u045A",nlArr:"\u21CD",nlarr:"\u219A",nldr:"\u2025",nlE:"\u2266\u0338",nle:"\u2270",nLeftarrow:"\u21CD",nleftarrow:"\u219A",nLeftrightarrow:"\u21CE",nleftrightarrow:"\u21AE",nleq:"\u2270",nleqq:"\u2266\u0338",nleqslant:"\u2A7D\u0338",nles:"\u2A7D\u0338",nless:"\u226E",nLl:"\u22D8\u0338",nlsim:"\u2274",nLt:"\u226A\u20D2",nlt:"\u226E",nltri:"\u22EA",nltrie:"\u22EC",nLtv:"\u226A\u0338",nmid:"\u2224",NoBreak:"\u2060",NonBreakingSpace:"\xA0",Nopf:"\u2115",nopf:"\u{1D55F}",Not:"\u2AEC",not:"\xAC",NotCongruent:"\u2262",NotCupCap:"\u226D",NotDoubleVerticalBar:"\u2226",NotElement:"\u2209",NotEqual:"\u2260",NotEqualTilde:"\u2242\u0338",NotExists:"\u2204",NotGreater:"\u226F",NotGreaterEqual:"\u2271",NotGreaterFullEqual:"\u2267\u0338",NotGreaterGreater:"\u226B\u0338",NotGreaterLess:"\u2279",NotGreaterSlantEqual:"\u2A7E\u0338",NotGreaterTilde:"\u2275",NotHumpDownHump:"\u224E\u0338",NotHumpEqual:"\u224F\u0338",notin:"\u2209",notindot:"\u22F5\u0338",notinE:"\u22F9\u0338",notinva:"\u2209",notinvb:"\u22F7",notinvc:"\u22F6",NotLeftTriangle:"\u22EA",NotLeftTriangleBar:"\u29CF\u0338",NotLeftTriangleEqual:"\u22EC",NotLess:"\u226E",NotLessEqual:"\u2270",NotLessGreater:"\u2278",NotLessLess:"\u226A\u0338",NotLessSlantEqual:"\u2A7D\u0338",NotLessTilde:"\u2274",NotNestedGreaterGreater:"\u2AA2\u0338",NotNestedLessLess:"\u2AA1\u0338",notni:"\u220C",notniva:"\u220C",notnivb:"\u22FE",notnivc:"\u22FD",NotPrecedes:"\u2280",NotPrecedesEqual:"\u2AAF\u0338",NotPrecedesSlantEqual:"\u22E0",NotReverseElement:"\u220C",NotRightTriangle:"\u22EB",NotRightTriangleBar:"\u29D0\u0338",NotRightTriangleEqual:"\u22ED",NotSquareSubset:"\u228F\u0338",NotSquareSubsetEqual:"\u22E2",NotSquareSuperset:"\u2290\u0338",NotSquareSupersetEqual:"\u22E3",NotSubset:"\u2282\u20D2",NotSubsetEqual:"\u2288",NotSucceeds:"\u2281",NotSucceedsEqual:"\u2AB0\u0338",NotSucceedsSlantEqual:"\u22E1",NotSucceedsTilde:"\u227F\u0338",NotSuperset:"\u2283\u20D2",NotSupersetEqual:"\u2289",NotTilde:"\u2241",NotTildeEqual:"\u2244",NotTildeFullEqual:"\u2247",NotTildeTilde:"\u2249",NotVerticalBar:"\u2224",npar:"\u2226",nparallel:"\u2226",nparsl:"\u2AFD\u20E5",npart:"\u2202\u0338",npolint:"\u2A14",npr:"\u2280",nprcue:"\u22E0",npre:"\u2AAF\u0338",nprec:"\u2280",npreceq:"\u2AAF\u0338",nrArr:"\u21CF",nrarr:"\u219B",nrarrc:"\u2933\u0338",nrarrw:"\u219D\u0338",nRightarrow:"\u21CF",nrightarrow:"\u219B",nrtri:"\u22EB",nrtrie:"\u22ED",nsc:"\u2281",nsccue:"\u22E1",nsce:"\u2AB0\u0338",Nscr:"\u{1D4A9}",nscr:"\u{1D4C3}",nshortmid:"\u2224",nshortparallel:"\u2226",nsim:"\u2241",nsime:"\u2244",nsimeq:"\u2244",nsmid:"\u2224",nspar:"\u2226",nsqsube:"\u22E2",nsqsupe:"\u22E3",nsub:"\u2284",nsubE:"\u2AC5\u0338",nsube:"\u2288",nsubset:"\u2282\u20D2",nsubseteq:"\u2288",nsubseteqq:"\u2AC5\u0338",nsucc:"\u2281",nsucceq:"\u2AB0\u0338",nsup:"\u2285",nsupE:"\u2AC6\u0338",nsupe:"\u2289",nsupset:"\u2283\u20D2",nsupseteq:"\u2289",nsupseteqq:"\u2AC6\u0338",ntgl:"\u2279",Ntilde:"\xD1",ntilde:"\xF1",ntlg:"\u2278",ntriangleleft:"\u22EA",ntrianglelefteq:"\u22EC",ntriangleright:"\u22EB",ntrianglerighteq:"\u22ED",Nu:"\u039D",nu:"\u03BD",num:"#",numero:"\u2116",numsp:"\u2007",nvap:"\u224D\u20D2",nVDash:"\u22AF",nVdash:"\u22AE",nvDash:"\u22AD",nvdash:"\u22AC",nvge:"\u2265\u20D2",nvgt:">\u20D2",nvHarr:"\u2904",nvinfin:"\u29DE",nvlArr:"\u2902",nvle:"\u2264\u20D2",nvlt:"<\u20D2",nvltrie:"\u22B4\u20D2",nvrArr:"\u2903",nvrtrie:"\u22B5\u20D2",nvsim:"\u223C\u20D2",nwarhk:"\u2923",nwArr:"\u21D6",nwarr:"\u2196",nwarrow:"\u2196",nwnear:"\u2927",Oacute:"\xD3",oacute:"\xF3",oast:"\u229B",ocir:"\u229A",Ocirc:"\xD4",ocirc:"\xF4",Ocy:"\u041E",ocy:"\u043E",odash:"\u229D",Odblac:"\u0150",odblac:"\u0151",odiv:"\u2A38",odot:"\u2299",odsold:"\u29BC",OElig:"\u0152",oelig:"\u0153",ofcir:"\u29BF",Ofr:"\u{1D512}",ofr:"\u{1D52C}",ogon:"\u02DB",Ograve:"\xD2",ograve:"\xF2",ogt:"\u29C1",ohbar:"\u29B5",ohm:"\u03A9",oint:"\u222E",olarr:"\u21BA",olcir:"\u29BE",olcross:"\u29BB",oline:"\u203E",olt:"\u29C0",Omacr:"\u014C",omacr:"\u014D",Omega:"\u03A9",omega:"\u03C9",Omicron:"\u039F",omicron:"\u03BF",omid:"\u29B6",ominus:"\u2296",Oopf:"\u{1D546}",oopf:"\u{1D560}",opar:"\u29B7",OpenCurlyDoubleQuote:"\u201C",OpenCurlyQuote:"\u2018",operp:"\u29B9",oplus:"\u2295",Or:"\u2A54",or:"\u2228",orarr:"\u21BB",ord:"\u2A5D",order:"\u2134",orderof:"\u2134",ordf:"\xAA",ordm:"\xBA",origof:"\u22B6",oror:"\u2A56",orslope:"\u2A57",orv:"\u2A5B",oS:"\u24C8",Oscr:"\u{1D4AA}",oscr:"\u2134",Oslash:"\xD8",oslash:"\xF8",osol:"\u2298",Otilde:"\xD5",otilde:"\xF5",Otimes:"\u2A37",otimes:"\u2297",otimesas:"\u2A36",Ouml:"\xD6",ouml:"\xF6",ovbar:"\u233D",OverBar:"\u203E",OverBrace:"\u23DE",OverBracket:"\u23B4",OverParenthesis:"\u23DC",par:"\u2225",para:"\xB6",parallel:"\u2225",parsim:"\u2AF3",parsl:"\u2AFD",part:"\u2202",PartialD:"\u2202",Pcy:"\u041F",pcy:"\u043F",percnt:"%",period:".",permil:"\u2030",perp:"\u22A5",pertenk:"\u2031",Pfr:"\u{1D513}",pfr:"\u{1D52D}",Phi:"\u03A6",phi:"\u03C6",phiv:"\u03D5",phmmat:"\u2133",phone:"\u260E",Pi:"\u03A0",pi:"\u03C0",pitchfork:"\u22D4",piv:"\u03D6",planck:"\u210F",planckh:"\u210E",plankv:"\u210F",plus:"+",plusacir:"\u2A23",plusb:"\u229E",pluscir:"\u2A22",plusdo:"\u2214",plusdu:"\u2A25",pluse:"\u2A72",PlusMinus:"\xB1",plusmn:"\xB1",plussim:"\u2A26",plustwo:"\u2A27",pm:"\xB1",Poincareplane:"\u210C",pointint:"\u2A15",Popf:"\u2119",popf:"\u{1D561}",pound:"\xA3",Pr:"\u2ABB",pr:"\u227A",prap:"\u2AB7",prcue:"\u227C",prE:"\u2AB3",pre:"\u2AAF",prec:"\u227A",precapprox:"\u2AB7",preccurlyeq:"\u227C",Precedes:"\u227A",PrecedesEqual:"\u2AAF",PrecedesSlantEqual:"\u227C",PrecedesTilde:"\u227E",preceq:"\u2AAF",precnapprox:"\u2AB9",precneqq:"\u2AB5",precnsim:"\u22E8",precsim:"\u227E",Prime:"\u2033",prime:"\u2032",primes:"\u2119",prnap:"\u2AB9",prnE:"\u2AB5",prnsim:"\u22E8",prod:"\u220F",Product:"\u220F",profalar:"\u232E",profline:"\u2312",profsurf:"\u2313",prop:"\u221D",Proportion:"\u2237",Proportional:"\u221D",propto:"\u221D",prsim:"\u227E",prurel:"\u22B0",Pscr:"\u{1D4AB}",pscr:"\u{1D4C5}",Psi:"\u03A8",psi:"\u03C8",puncsp:"\u2008",Qfr:"\u{1D514}",qfr:"\u{1D52E}",qint:"\u2A0C",Qopf:"\u211A",qopf:"\u{1D562}",qprime:"\u2057",Qscr:"\u{1D4AC}",qscr:"\u{1D4C6}",quaternions:"\u210D",quatint:"\u2A16",quest:"?",questeq:"\u225F",QUOT:'"',quot:'"',rAarr:"\u21DB",race:"\u223D\u0331",Racute:"\u0154",racute:"\u0155",radic:"\u221A",raemptyv:"\u29B3",Rang:"\u27EB",rang:"\u27E9",rangd:"\u2992",range:"\u29A5",rangle:"\u27E9",raquo:"\xBB",Rarr:"\u21A0",rArr:"\u21D2",rarr:"\u2192",rarrap:"\u2975",rarrb:"\u21E5",rarrbfs:"\u2920",rarrc:"\u2933",rarrfs:"\u291E",rarrhk:"\u21AA",rarrlp:"\u21AC",rarrpl:"\u2945",rarrsim:"\u2974",Rarrtl:"\u2916",rarrtl:"\u21A3",rarrw:"\u219D",rAtail:"\u291C",ratail:"\u291A",ratio:"\u2236",rationals:"\u211A",RBarr:"\u2910",rBarr:"\u290F",rbarr:"\u290D",rbbrk:"\u2773",rbrace:"}",rbrack:"]",rbrke:"\u298C",rbrksld:"\u298E",rbrkslu:"\u2990",Rcaron:"\u0158",rcaron:"\u0159",Rcedil:"\u0156",rcedil:"\u0157",rceil:"\u2309",rcub:"}",Rcy:"\u0420",rcy:"\u0440",rdca:"\u2937",rdldhar:"\u2969",rdquo:"\u201D",rdquor:"\u201D",rdsh:"\u21B3",Re:"\u211C",real:"\u211C",realine:"\u211B",realpart:"\u211C",reals:"\u211D",rect:"\u25AD",REG:"\xAE",reg:"\xAE",ReverseElement:"\u220B",ReverseEquilibrium:"\u21CB",ReverseUpEquilibrium:"\u296F",rfisht:"\u297D",rfloor:"\u230B",Rfr:"\u211C",rfr:"\u{1D52F}",rHar:"\u2964",rhard:"\u21C1",rharu:"\u21C0",rharul:"\u296C",Rho:"\u03A1",rho:"\u03C1",rhov:"\u03F1",RightAngleBracket:"\u27E9",RightArrow:"\u2192",Rightarrow:"\u21D2",rightarrow:"\u2192",RightArrowBar:"\u21E5",RightArrowLeftArrow:"\u21C4",rightarrowtail:"\u21A3",RightCeiling:"\u2309",RightDoubleBracket:"\u27E7",RightDownTeeVector:"\u295D",RightDownVector:"\u21C2",RightDownVectorBar:"\u2955",RightFloor:"\u230B",rightharpoondown:"\u21C1",rightharpoonup:"\u21C0",rightleftarrows:"\u21C4",rightleftharpoons:"\u21CC",rightrightarrows:"\u21C9",rightsquigarrow:"\u219D",RightTee:"\u22A2",RightTeeArrow:"\u21A6",RightTeeVector:"\u295B",rightthreetimes:"\u22CC",RightTriangle:"\u22B3",RightTriangleBar:"\u29D0",RightTriangleEqual:"\u22B5",RightUpDownVector:"\u294F",RightUpTeeVector:"\u295C",RightUpVector:"\u21BE",RightUpVectorBar:"\u2954",RightVector:"\u21C0",RightVectorBar:"\u2953",ring:"\u02DA",risingdotseq:"\u2253",rlarr:"\u21C4",rlhar:"\u21CC",rlm:"\u200F",rmoust:"\u23B1",rmoustache:"\u23B1",rnmid:"\u2AEE",roang:"\u27ED",roarr:"\u21FE",robrk:"\u27E7",ropar:"\u2986",Ropf:"\u211D",ropf:"\u{1D563}",roplus:"\u2A2E",rotimes:"\u2A35",RoundImplies:"\u2970",rpar:")",rpargt:"\u2994",rppolint:"\u2A12",rrarr:"\u21C9",Rrightarrow:"\u21DB",rsaquo:"\u203A",Rscr:"\u211B",rscr:"\u{1D4C7}",Rsh:"\u21B1",rsh:"\u21B1",rsqb:"]",rsquo:"\u2019",rsquor:"\u2019",rthree:"\u22CC",rtimes:"\u22CA",rtri:"\u25B9",rtrie:"\u22B5",rtrif:"\u25B8",rtriltri:"\u29CE",RuleDelayed:"\u29F4",ruluhar:"\u2968",rx:"\u211E",Sacute:"\u015A",sacute:"\u015B",sbquo:"\u201A",Sc:"\u2ABC",sc:"\u227B",scap:"\u2AB8",Scaron:"\u0160",scaron:"\u0161",sccue:"\u227D",scE:"\u2AB4",sce:"\u2AB0",Scedil:"\u015E",scedil:"\u015F",Scirc:"\u015C",scirc:"\u015D",scnap:"\u2ABA",scnE:"\u2AB6",scnsim:"\u22E9",scpolint:"\u2A13",scsim:"\u227F",Scy:"\u0421",scy:"\u0441",sdot:"\u22C5",sdotb:"\u22A1",sdote:"\u2A66",searhk:"\u2925",seArr:"\u21D8",searr:"\u2198",searrow:"\u2198",sect:"\xA7",semi:";",seswar:"\u2929",setminus:"\u2216",setmn:"\u2216",sext:"\u2736",Sfr:"\u{1D516}",sfr:"\u{1D530}",sfrown:"\u2322",sharp:"\u266F",SHCHcy:"\u0429",shchcy:"\u0449",SHcy:"\u0428",shcy:"\u0448",ShortDownArrow:"\u2193",ShortLeftArrow:"\u2190",shortmid:"\u2223",shortparallel:"\u2225",ShortRightArrow:"\u2192",ShortUpArrow:"\u2191",shy:"\xAD",Sigma:"\u03A3",sigma:"\u03C3",sigmaf:"\u03C2",sigmav:"\u03C2",sim:"\u223C",simdot:"\u2A6A",sime:"\u2243",simeq:"\u2243",simg:"\u2A9E",simgE:"\u2AA0",siml:"\u2A9D",simlE:"\u2A9F",simne:"\u2246",simplus:"\u2A24",simrarr:"\u2972",slarr:"\u2190",SmallCircle:"\u2218",smallsetminus:"\u2216",smashp:"\u2A33",smeparsl:"\u29E4",smid:"\u2223",smile:"\u2323",smt:"\u2AAA",smte:"\u2AAC",smtes:"\u2AAC\uFE00",SOFTcy:"\u042C",softcy:"\u044C",sol:"/",solb:"\u29C4",solbar:"\u233F",Sopf:"\u{1D54A}",sopf:"\u{1D564}",spades:"\u2660",spadesuit:"\u2660",spar:"\u2225",sqcap:"\u2293",sqcaps:"\u2293\uFE00",sqcup:"\u2294",sqcups:"\u2294\uFE00",Sqrt:"\u221A",sqsub:"\u228F",sqsube:"\u2291",sqsubset:"\u228F",sqsubseteq:"\u2291",sqsup:"\u2290",sqsupe:"\u2292",sqsupset:"\u2290",sqsupseteq:"\u2292",squ:"\u25A1",Square:"\u25A1",square:"\u25A1",SquareIntersection:"\u2293",SquareSubset:"\u228F",SquareSubsetEqual:"\u2291",SquareSuperset:"\u2290",SquareSupersetEqual:"\u2292",SquareUnion:"\u2294",squarf:"\u25AA",squf:"\u25AA",srarr:"\u2192",Sscr:"\u{1D4AE}",sscr:"\u{1D4C8}",ssetmn:"\u2216",ssmile:"\u2323",sstarf:"\u22C6",Star:"\u22C6",star:"\u2606",starf:"\u2605",straightepsilon:"\u03F5",straightphi:"\u03D5",strns:"\xAF",Sub:"\u22D0",sub:"\u2282",subdot:"\u2ABD",subE:"\u2AC5",sube:"\u2286",subedot:"\u2AC3",submult:"\u2AC1",subnE:"\u2ACB",subne:"\u228A",subplus:"\u2ABF",subrarr:"\u2979",Subset:"\u22D0",subset:"\u2282",subseteq:"\u2286",subseteqq:"\u2AC5",SubsetEqual:"\u2286",subsetneq:"\u228A",subsetneqq:"\u2ACB",subsim:"\u2AC7",subsub:"\u2AD5",subsup:"\u2AD3",succ:"\u227B",succapprox:"\u2AB8",succcurlyeq:"\u227D",Succeeds:"\u227B",SucceedsEqual:"\u2AB0",SucceedsSlantEqual:"\u227D",SucceedsTilde:"\u227F",succeq:"\u2AB0",succnapprox:"\u2ABA",succneqq:"\u2AB6",succnsim:"\u22E9",succsim:"\u227F",SuchThat:"\u220B",Sum:"\u2211",sum:"\u2211",sung:"\u266A",Sup:"\u22D1",sup:"\u2283",sup1:"\xB9",sup2:"\xB2",sup3:"\xB3",supdot:"\u2ABE",supdsub:"\u2AD8",supE:"\u2AC6",supe:"\u2287",supedot:"\u2AC4",Superset:"\u2283",SupersetEqual:"\u2287",suphsol:"\u27C9",suphsub:"\u2AD7",suplarr:"\u297B",supmult:"\u2AC2",supnE:"\u2ACC",supne:"\u228B",supplus:"\u2AC0",Supset:"\u22D1",supset:"\u2283",supseteq:"\u2287",supseteqq:"\u2AC6",supsetneq:"\u228B",supsetneqq:"\u2ACC",supsim:"\u2AC8",supsub:"\u2AD4",supsup:"\u2AD6",swarhk:"\u2926",swArr:"\u21D9",swarr:"\u2199",swarrow:"\u2199",swnwar:"\u292A",szlig:"\xDF",Tab:" ",target:"\u2316",Tau:"\u03A4",tau:"\u03C4",tbrk:"\u23B4",Tcaron:"\u0164",tcaron:"\u0165",Tcedil:"\u0162",tcedil:"\u0163",Tcy:"\u0422",tcy:"\u0442",tdot:"\u20DB",telrec:"\u2315",Tfr:"\u{1D517}",tfr:"\u{1D531}",there4:"\u2234",Therefore:"\u2234",therefore:"\u2234",Theta:"\u0398",theta:"\u03B8",thetasym:"\u03D1",thetav:"\u03D1",thickapprox:"\u2248",thicksim:"\u223C",ThickSpace:"\u205F\u200A",thinsp:"\u2009",ThinSpace:"\u2009",thkap:"\u2248",thksim:"\u223C",THORN:"\xDE",thorn:"\xFE",Tilde:"\u223C",tilde:"\u02DC",TildeEqual:"\u2243",TildeFullEqual:"\u2245",TildeTilde:"\u2248",times:"\xD7",timesb:"\u22A0",timesbar:"\u2A31",timesd:"\u2A30",tint:"\u222D",toea:"\u2928",top:"\u22A4",topbot:"\u2336",topcir:"\u2AF1",Topf:"\u{1D54B}",topf:"\u{1D565}",topfork:"\u2ADA",tosa:"\u2929",tprime:"\u2034",TRADE:"\u2122",trade:"\u2122",triangle:"\u25B5",triangledown:"\u25BF",triangleleft:"\u25C3",trianglelefteq:"\u22B4",triangleq:"\u225C",triangleright:"\u25B9",trianglerighteq:"\u22B5",tridot:"\u25EC",trie:"\u225C",triminus:"\u2A3A",TripleDot:"\u20DB",triplus:"\u2A39",trisb:"\u29CD",tritime:"\u2A3B",trpezium:"\u23E2",Tscr:"\u{1D4AF}",tscr:"\u{1D4C9}",TScy:"\u0426",tscy:"\u0446",TSHcy:"\u040B",tshcy:"\u045B",Tstrok:"\u0166",tstrok:"\u0167",twixt:"\u226C",twoheadleftarrow:"\u219E",twoheadrightarrow:"\u21A0",Uacute:"\xDA",uacute:"\xFA",Uarr:"\u219F",uArr:"\u21D1",uarr:"\u2191",Uarrocir:"\u2949",Ubrcy:"\u040E",ubrcy:"\u045E",Ubreve:"\u016C",ubreve:"\u016D",Ucirc:"\xDB",ucirc:"\xFB",Ucy:"\u0423",ucy:"\u0443",udarr:"\u21C5",Udblac:"\u0170",udblac:"\u0171",udhar:"\u296E",ufisht:"\u297E",Ufr:"\u{1D518}",ufr:"\u{1D532}",Ugrave:"\xD9",ugrave:"\xF9",uHar:"\u2963",uharl:"\u21BF",uharr:"\u21BE",uhblk:"\u2580",ulcorn:"\u231C",ulcorner:"\u231C",ulcrop:"\u230F",ultri:"\u25F8",Umacr:"\u016A",umacr:"\u016B",uml:"\xA8",UnderBar:"_",UnderBrace:"\u23DF",UnderBracket:"\u23B5",UnderParenthesis:"\u23DD",Union:"\u22C3",UnionPlus:"\u228E",Uogon:"\u0172",uogon:"\u0173",Uopf:"\u{1D54C}",uopf:"\u{1D566}",UpArrow:"\u2191",Uparrow:"\u21D1",uparrow:"\u2191",UpArrowBar:"\u2912",UpArrowDownArrow:"\u21C5",UpDownArrow:"\u2195",Updownarrow:"\u21D5",updownarrow:"\u2195",UpEquilibrium:"\u296E",upharpoonleft:"\u21BF",upharpoonright:"\u21BE",uplus:"\u228E",UpperLeftArrow:"\u2196",UpperRightArrow:"\u2197",Upsi:"\u03D2",upsi:"\u03C5",upsih:"\u03D2",Upsilon:"\u03A5",upsilon:"\u03C5",UpTee:"\u22A5",UpTeeArrow:"\u21A5",upuparrows:"\u21C8",urcorn:"\u231D",urcorner:"\u231D",urcrop:"\u230E",Uring:"\u016E",uring:"\u016F",urtri:"\u25F9",Uscr:"\u{1D4B0}",uscr:"\u{1D4CA}",utdot:"\u22F0",Utilde:"\u0168",utilde:"\u0169",utri:"\u25B5",utrif:"\u25B4",uuarr:"\u21C8",Uuml:"\xDC",uuml:"\xFC",uwangle:"\u29A7",vangrt:"\u299C",varepsilon:"\u03F5",varkappa:"\u03F0",varnothing:"\u2205",varphi:"\u03D5",varpi:"\u03D6",varpropto:"\u221D",vArr:"\u21D5",varr:"\u2195",varrho:"\u03F1",varsigma:"\u03C2",varsubsetneq:"\u228A\uFE00",varsubsetneqq:"\u2ACB\uFE00",varsupsetneq:"\u228B\uFE00",varsupsetneqq:"\u2ACC\uFE00",vartheta:"\u03D1",vartriangleleft:"\u22B2",vartriangleright:"\u22B3",Vbar:"\u2AEB",vBar:"\u2AE8",vBarv:"\u2AE9",Vcy:"\u0412",vcy:"\u0432",VDash:"\u22AB",Vdash:"\u22A9",vDash:"\u22A8",vdash:"\u22A2",Vdashl:"\u2AE6",Vee:"\u22C1",vee:"\u2228",veebar:"\u22BB",veeeq:"\u225A",vellip:"\u22EE",Verbar:"\u2016",verbar:"|",Vert:"\u2016",vert:"|",VerticalBar:"\u2223",VerticalLine:"|",VerticalSeparator:"\u2758",VerticalTilde:"\u2240",VeryThinSpace:"\u200A",Vfr:"\u{1D519}",vfr:"\u{1D533}",vltri:"\u22B2",vnsub:"\u2282\u20D2",vnsup:"\u2283\u20D2",Vopf:"\u{1D54D}",vopf:"\u{1D567}",vprop:"\u221D",vrtri:"\u22B3",Vscr:"\u{1D4B1}",vscr:"\u{1D4CB}",vsubnE:"\u2ACB\uFE00",vsubne:"\u228A\uFE00",vsupnE:"\u2ACC\uFE00",vsupne:"\u228B\uFE00",Vvdash:"\u22AA",vzigzag:"\u299A",Wcirc:"\u0174",wcirc:"\u0175",wedbar:"\u2A5F",Wedge:"\u22C0",wedge:"\u2227",wedgeq:"\u2259",weierp:"\u2118",Wfr:"\u{1D51A}",wfr:"\u{1D534}",Wopf:"\u{1D54E}",wopf:"\u{1D568}",wp:"\u2118",wr:"\u2240",wreath:"\u2240",Wscr:"\u{1D4B2}",wscr:"\u{1D4CC}",xcap:"\u22C2",xcirc:"\u25EF",xcup:"\u22C3",xdtri:"\u25BD",Xfr:"\u{1D51B}",xfr:"\u{1D535}",xhArr:"\u27FA",xharr:"\u27F7",Xi:"\u039E",xi:"\u03BE",xlArr:"\u27F8",xlarr:"\u27F5",xmap:"\u27FC",xnis:"\u22FB",xodot:"\u2A00",Xopf:"\u{1D54F}",xopf:"\u{1D569}",xoplus:"\u2A01",xotime:"\u2A02",xrArr:"\u27F9",xrarr:"\u27F6",Xscr:"\u{1D4B3}",xscr:"\u{1D4CD}",xsqcup:"\u2A06",xuplus:"\u2A04",xutri:"\u25B3",xvee:"\u22C1",xwedge:"\u22C0",Yacute:"\xDD",yacute:"\xFD",YAcy:"\u042F",yacy:"\u044F",Ycirc:"\u0176",ycirc:"\u0177",Ycy:"\u042B",ycy:"\u044B",yen:"\xA5",Yfr:"\u{1D51C}",yfr:"\u{1D536}",YIcy:"\u0407",yicy:"\u0457",Yopf:"\u{1D550}",yopf:"\u{1D56A}",Yscr:"\u{1D4B4}",yscr:"\u{1D4CE}",YUcy:"\u042E",yucy:"\u044E",Yuml:"\u0178",yuml:"\xFF",Zacute:"\u0179",zacute:"\u017A",Zcaron:"\u017D",zcaron:"\u017E",Zcy:"\u0417",zcy:"\u0437",Zdot:"\u017B",zdot:"\u017C",zeetrf:"\u2128",ZeroWidthSpace:"\u200B",Zeta:"\u0396",zeta:"\u03B6",Zfr:"\u2128",zfr:"\u{1D537}",ZHcy:"\u0416",zhcy:"\u0436",zigrarr:"\u21DD",Zopf:"\u2124",zopf:"\u{1D56B}",Zscr:"\u{1D4B5}",zscr:"\u{1D4CF}",zwj:"\u200D",zwnj:"\u200C"});dl.entityMap=dl.HTML_ENTITIES});var Rd=xa(ch=>{var _l=ol().NAMESPACE,uh=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,Id=new RegExp("[\\-\\.0-9"+uh.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),kd=new RegExp("^"+uh.source+Id.source+"*(?::"+uh.source+Id.source+"*)?$"),fl=0,ba=1,Hs=2,ml=3,Xs=4,Ws=5,gl=6,Iu=7;function Js(w,S){this.message=w,this.locator=S,Error.captureStackTrace&&Error.captureStackTrace(this,Js)}Js.prototype=new Error;Js.prototype.name=Js.name;function zd(){}zd.prototype={parse:function(w,S,F){var Y=this.domBuilder;Y.startDocument(),Bd(S,S={}),h0(w,S,F,Y,this.errorHandler),Y.endDocument()}};function h0(w,S,F,Y,E){function p(_t){if(_t>65535){_t-=65536;var Ne=55296+(_t>>10),kt=56320+(_t&1023);return String.fromCharCode(Ne,kt)}else return String.fromCharCode(_t)}function ue(_t){var Ne=_t.slice(1,-1);return Object.hasOwnProperty.call(F,Ne)?F[Ne]:Ne.charAt(0)==="#"?p(parseInt(Ne.substr(1).replace("x","0x"))):(E.error("entity not found:"+_t),_t)}function pe(_t){if(_t>Lt){var Ne=w.substring(Lt,_t).replace(/&#?\w+;/g,ue);mt&&Ce(Lt),Y.characters(Ne,0,_t-Lt),Lt=_t}}function Ce(_t,Ne){for(;_t>=X&&(Ne=It.exec(w));)se=Ne.index,X=se+Ne[0].length,mt.lineNumber++;mt.columnNumber=_t-se+1}for(var se=0,X=0,It=/.*(?:\r\n?|\n)|.*$/g,mt=Y.locator,Et=[{currentNSMap:S}],li={},Lt=0;;){try{var Mt=w.indexOf("<",Lt);if(Mt<0){if(!w.substr(Lt).match(/^\s*$/)){var De=Y.doc,We=De.createTextNode(w.substr(Lt));De.appendChild(We),Y.currentElement=We}return}switch(Mt>Lt&&pe(Mt),w.charAt(Mt+1)){case"/":var Pe=w.indexOf(">",Mt+3),Re=w.substring(Mt+2,Pe).replace(/[ \t\n\r]+$/g,""),Fe=Et.pop();Pe<0?(Re=w.substring(Mt+2).replace(/[\s<].*/,""),E.error("end tag name: "+Re+" is not complete:"+Fe.tagName),Pe=Mt+1+Re.length):Re.match(/\s</)&&(Re=Re.replace(/[\s<].*/,""),E.error("end tag name: "+Re+" maybe not complete"),Pe=Mt+1+Re.length);var Ye=Fe.localNSMap,_e=Fe.tagName==Re,xe=_e||Fe.tagName&&Fe.tagName.toLowerCase()==Re.toLowerCase();if(xe){if(Y.endElement(Fe.uri,Fe.localName,Re),Ye)for(var Le in Ye)Object.prototype.hasOwnProperty.call(Ye,Le)&&Y.endPrefixMapping(Le);_e||E.fatalError("end tag name: "+Re+" is not match the current start tagName:"+Fe.tagName)}else Et.push(Fe);Pe++;break;case"?":mt&&Ce(Mt),Pe=g0(w,Mt,Y);break;case"!":mt&&Ce(Mt),Pe=m0(w,Mt,Y,E);break;default:mt&&Ce(Mt);var ye=new Ld,Je=Et[Et.length-1].currentNSMap,Pe=p0(w,Mt,ye,Je,ue,E),tt=ye.length;if(!ye.closed&&f0(w,Pe,ye.tagName,li)&&(ye.closed=!0,F.nbsp||E.warning("unclosed xml attribute")),mt&&tt){for(var Ge=Md(mt,{}),at=0;at<tt;at++){var ht=ye[at];Ce(ht.offset),ht.locator=Md(mt,{})}Y.locator=Ge,Pd(ye,Y,Je)&&Et.push(ye),Y.locator=mt}else Pd(ye,Y,Je)&&Et.push(ye);_l.isHTML(ye.uri)&&!ye.closed?Pe=d0(w,Pe,ye.tagName,ue,Y):Pe++}}catch(_t){if(_t instanceof Js)throw _t;E.error("element parse error: "+_t),Pe=-1}Pe>Lt?Lt=Pe:pe(Math.max(Mt,Lt)+1)}}function Md(w,S){return S.lineNumber=w.lineNumber,S.columnNumber=w.columnNumber,S}function p0(w,S,F,Y,E,p){function ue(Et,li,Lt){F.attributeNames.hasOwnProperty(Et)&&p.fatalError("Attribute "+Et+" redefined"),F.addValue(Et,li.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,E),Lt)}for(var pe,Ce,se=++S,X=fl;;){var It=w.charAt(se);switch(It){case"=":if(X===ba)pe=w.slice(S,se),X=ml;else if(X===Hs)X=ml;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(X===ml||X===ba)if(X===ba&&(p.warning('attribute value must after "="'),pe=w.slice(S,se)),S=se+1,se=w.indexOf(It,S),se>0)Ce=w.slice(S,se),ue(pe,Ce,S-1),X=Ws;else throw new Error("attribute value no end '"+It+"' match");else if(X==Xs)Ce=w.slice(S,se),ue(pe,Ce,S),p.warning('attribute "'+pe+'" missed start quot('+It+")!!"),S=se+1,X=Ws;else throw new Error('attribute value must after "="');break;case"/":switch(X){case fl:F.setTagName(w.slice(S,se));case Ws:case gl:case Iu:X=Iu,F.closed=!0;case Xs:case ba:break;case Hs:F.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return p.error("unexpected end of input"),X==fl&&F.setTagName(w.slice(S,se)),se;case">":switch(X){case fl:F.setTagName(w.slice(S,se));case Ws:case gl:case Iu:break;case Xs:case ba:Ce=w.slice(S,se),Ce.slice(-1)==="/"&&(F.closed=!0,Ce=Ce.slice(0,-1));case Hs:X===Hs&&(Ce=pe),X==Xs?(p.warning('attribute "'+Ce+'" missed quot(")!'),ue(pe,Ce,S)):((!_l.isHTML(Y[""])||!Ce.match(/^(?:disabled|checked|selected)$/i))&&p.warning('attribute "'+Ce+'" missed value!! "'+Ce+'" instead!!'),ue(Ce,Ce,S));break;case ml:throw new Error("attribute value missed!!")}return se;case"\x80":It=" ";default:if(It<=" ")switch(X){case fl:F.setTagName(w.slice(S,se)),X=gl;break;case ba:pe=w.slice(S,se),X=Hs;break;case Xs:var Ce=w.slice(S,se);p.warning('attribute "'+Ce+'" missed quot(")!!'),ue(pe,Ce,S);case Ws:X=gl;break}else switch(X){case Hs:var mt=F.tagName;(!_l.isHTML(Y[""])||!pe.match(/^(?:disabled|checked|selected)$/i))&&p.warning('attribute "'+pe+'" missed value!! "'+pe+'" instead2!!'),ue(pe,pe,S),S=se,X=ba;break;case Ws:p.warning('attribute space is required"'+pe+'"!!');case gl:X=ba,S=se;break;case ml:X=Xs,S=se;break;case Iu:throw new Error("elements closed character '/' and '>' must be connected to")}}se++}}function Pd(w,S,F){for(var Y=w.tagName,E=null,It=w.length;It--;){var p=w[It],ue=p.qName,pe=p.value,mt=ue.indexOf(":");if(mt>0)var Ce=p.prefix=ue.slice(0,mt),se=ue.slice(mt+1),X=Ce==="xmlns"&&se;else se=ue,Ce=null,X=ue==="xmlns"&&"";p.localName=se,X!==!1&&(E==null&&(E={},Bd(F,F={})),F[X]=E[X]=pe,p.uri=_l.XMLNS,S.startPrefixMapping(X,pe))}for(var It=w.length;It--;){p=w[It];var Ce=p.prefix;Ce&&(Ce==="xml"&&(p.uri=_l.XML),Ce!=="xmlns"&&(p.uri=F[Ce||""]))}var mt=Y.indexOf(":");mt>0?(Ce=w.prefix=Y.slice(0,mt),se=w.localName=Y.slice(mt+1)):(Ce=null,se=w.localName=Y);var Et=w.uri=F[Ce||""];if(S.startElement(Et,se,Y,w),w.closed){if(S.endElement(Et,se,Y),E)for(Ce in E)Object.prototype.hasOwnProperty.call(E,Ce)&&S.endPrefixMapping(Ce)}else return w.currentNSMap=F,w.localNSMap=E,!0}function d0(w,S,F,Y,E){if(/^(?:script|textarea)$/i.test(F)){var p=w.indexOf("</"+F+">",S),ue=w.substring(S+1,p);if(/[&<]/.test(ue))return/^script$/i.test(F)?(E.characters(ue,0,ue.length),p):(ue=ue.replace(/&#?\w+;/g,Y),E.characters(ue,0,ue.length),p)}return S+1}function f0(w,S,F,Y){var E=Y[F];return E==null&&(E=w.lastIndexOf("</"+F+">"),E<S&&(E=w.lastIndexOf("</"+F)),Y[F]=E),E<S}function Bd(w,S){for(var F in w)Object.prototype.hasOwnProperty.call(w,F)&&(S[F]=w[F])}function m0(w,S,F,Y){var E=w.charAt(S+2);switch(E){case"-":if(w.charAt(S+3)==="-"){var p=w.indexOf("-->",S+4);return p>S?(F.comment(w,S+4,p-S-4),p+3):(Y.error("Unclosed comment"),-1)}else return-1;default:if(w.substr(S+3,6)=="CDATA["){var p=w.indexOf("]]>",S+9);return F.startCDATA(),F.characters(w,S+9,p-S-9),F.endCDATA(),p+3}var ue=_0(w,S),pe=ue.length;if(pe>1&&/!doctype/i.test(ue[0][0])){var Ce=ue[1][0],se=!1,X=!1;pe>3&&(/^public$/i.test(ue[2][0])?(se=ue[3][0],X=pe>4&&ue[4][0]):/^system$/i.test(ue[2][0])&&(X=ue[3][0]));var It=ue[pe-1];return F.startDTD(Ce,se,X),F.endDTD(),It.index+It[0].length}}return-1}function g0(w,S,F){var Y=w.indexOf("?>",S);if(Y){var E=w.substring(S,Y).match(/^<\?(\S*)\s*([\s\S]*?)$/);if(E){var p=E[0].length;return F.processingInstruction(E[1],E[2]),Y+2}else return-1}return-1}function Ld(){this.attributeNames={}}Ld.prototype={setTagName:function(w){if(!kd.test(w))throw new Error("invalid tagName:"+w);this.tagName=w},addValue:function(w,S,F){if(!kd.test(w))throw new Error("invalid attribute:"+w);this.attributeNames[w]=this.length,this[this.length++]={qName:w,value:S,offset:F}},length:0,getLocalName:function(w){return this[w].localName},getLocator:function(w){return this[w].locator},getQName:function(w){return this[w].qName},getURI:function(w){return this[w].uri},getValue:function(w){return this[w].value}};function _0(w,S){var F,Y=[],E=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(E.lastIndex=S,E.exec(w);F=E.exec(w);)if(Y.push(F),F[1])return Y}ch.XMLReader=zd;ch.ParseError=Js});var jd=xa(Mu=>{var y0=ol(),v0=lh(),Fd=Sd(),qd=Rd(),x0=v0.DOMImplementation,Od=y0.NAMESPACE,b0=qd.ParseError,w0=qd.XMLReader;function Vd(w){return w.replace(/\r[\n\u0085]/g,`
`).replace(/[\r\u0085\u2028]/g,`
`)}function Ud(w){this.options=w||{locator:{}}}Ud.prototype.parseFromString=function(w,S){var F=this.options,Y=new w0,E=F.domBuilder||new yl,p=F.errorHandler,ue=F.locator,pe=F.xmlns||{},Ce=/\/x?html?$/.test(S),se=Ce?Fd.HTML_ENTITIES:Fd.XML_ENTITIES;ue&&E.setDocumentLocator(ue),Y.errorHandler=A0(p,E,ue),Y.domBuilder=F.domBuilder||E,Ce&&(pe[""]=Od.HTML),pe.xml=pe.xml||Od.XML;var X=F.normalizeLineEndings||Vd;return w&&typeof w=="string"?Y.parse(X(w),pe,se):Y.errorHandler.error("invalid doc source"),E.doc};function A0(w,S,F){if(!w){if(S instanceof yl)return S;w=S}var Y={},E=w instanceof Function;F=F||{};function p(ue){var pe=w[ue];!pe&&E&&(pe=w.length==2?function(Ce){w(ue,Ce)}:w),Y[ue]=pe&&function(Ce){pe("[xmldom "+ue+"] "+Ce+hh(F))}||function(){}}return p("warning"),p("error"),p("fatalError"),Y}function yl(){this.cdata=!1}function Ks(w,S){S.lineNumber=w.lineNumber,S.columnNumber=w.columnNumber}yl.prototype={startDocument:function(){this.doc=new x0().createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(w,S,F,Y){var E=this.doc,p=E.createElementNS(w,F||S),ue=Y.length;ku(this,p),this.currentElement=p,this.locator&&Ks(this.locator,p);for(var pe=0;pe<ue;pe++){var w=Y.getURI(pe),Ce=Y.getValue(pe),F=Y.getQName(pe),se=E.createAttributeNS(w,F);this.locator&&Ks(Y.getLocator(pe),se),se.value=se.nodeValue=Ce,p.setAttributeNode(se)}},endElement:function(w,S,F){var Y=this.currentElement,E=Y.tagName;this.currentElement=Y.parentNode},startPrefixMapping:function(w,S){},endPrefixMapping:function(w){},processingInstruction:function(w,S){var F=this.doc.createProcessingInstruction(w,S);this.locator&&Ks(this.locator,F),ku(this,F)},ignorableWhitespace:function(w,S,F){},characters:function(w,S,F){if(w=Nd.apply(this,arguments),w){if(this.cdata)var Y=this.doc.createCDATASection(w);else var Y=this.doc.createTextNode(w);this.currentElement?this.currentElement.appendChild(Y):/^\s*$/.test(w)&&this.doc.appendChild(Y),this.locator&&Ks(this.locator,Y)}},skippedEntity:function(w){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(w){(this.locator=w)&&(w.lineNumber=0)},comment:function(w,S,F){w=Nd.apply(this,arguments);var Y=this.doc.createComment(w);this.locator&&Ks(this.locator,Y),ku(this,Y)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(w,S,F){var Y=this.doc.implementation;if(Y&&Y.createDocumentType){var E=Y.createDocumentType(w,S,F);this.locator&&Ks(this.locator,E),ku(this,E),this.doc.doctype=E}},warning:function(w){console.warn("[xmldom warning] "+w,hh(this.locator))},error:function(w){console.error("[xmldom error] "+w,hh(this.locator))},fatalError:function(w){throw new b0(w,this.locator)}};function hh(w){if(w)return`
@`+(w.systemId||"")+"#[line:"+w.lineNumber+",col:"+w.columnNumber+"]"}function Nd(w,S,F){return typeof w=="string"?w.substr(S,F):w.length>=S+F||S?new java.lang.String(w,S,F)+"":w}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(w){yl.prototype[w]=function(){return null}});function ku(w,S){w.currentElement?w.currentElement.appendChild(S):w.doc.appendChild(S)}Mu.__DOMHandler=yl;Mu.normalizeLineEndings=Vd;Mu.DOMParser=Ud});var Zd=xa(Pu=>{var $d=lh();Pu.DOMImplementation=$d.DOMImplementation;Pu.XMLSerializer=$d.XMLSerializer;Pu.DOMParser=jd().DOMParser});var Hd=xa((Gd,ph)=>{var E0=function(){"use strict";var w=/\s*/g,S=/^\s*|\s*$/g,F=/\s+/;function Y(_e){if(!_e||!_e.length)return 0;for(var xe=0,Le=0;xe<_e.length;xe++)Le=(Le<<5)-Le+_e.charCodeAt(xe)|0;return Le}function E(_e,xe){return _e.getElementsByTagName(xe)}function p(_e,xe){return _e.getAttribute(xe)}function ue(_e,xe){return parseFloat(p(_e,xe))}function pe(_e,xe){var Le=E(_e,xe);return Le.length?Le[0]:null}function Ce(_e){return _e.normalize&&_e.normalize(),_e}function se(_e){for(var xe=0,Le=[];xe<_e.length;xe++)Le[xe]=parseFloat(_e[xe]);return Le}function X(_e){return _e&&Ce(_e),_e&&_e.textContent||""}function It(_e,xe){var Le={},ye,Je;for(Je=0;Je<xe.length;Je++)ye=pe(_e,xe[Je]),ye&&(Le[xe[Je]]=X(ye));return Le}function mt(_e,xe){for(var Le in xe)_e[Le]=xe[Le]}function Et(_e){return se(_e.replace(w,"").split(","))}function li(_e){for(var xe=_e.replace(S,"").split(F),Le=[],ye=0;ye<xe.length;ye++)Le.push(Et(xe[ye]));return Le}function Lt(_e){var xe=[ue(_e,"lon"),ue(_e,"lat")],Le=pe(_e,"ele"),ye=pe(_e,"gpxtpx:hr")||pe(_e,"hr"),Je=pe(_e,"time"),Pe;return Le&&(Pe=parseFloat(X(Le)),isNaN(Pe)||xe.push(Pe)),{coordinates:xe,time:Je?X(Je):null,heartRate:ye?parseFloat(X(ye)):null}}function Mt(){return{type:"FeatureCollection",features:[]}}var De;if(typeof XMLSerializer<"u")De=new XMLSerializer;else{var We=typeof process=="object"&&!process.browser,Re=typeof Titanium=="object";if(typeof Gd=="object"&&(We||Re))De=new(Zd()).XMLSerializer;else throw new Error("Unable to initialize serializer")}function Fe(_e){return _e.xml!==void 0?_e.xml:De.serializeToString(_e)}var Ye={kml:function(_e){for(var xe=Mt(),Le={},ye={},Je={},Pe=["Polygon","LineString","Point","Track","gx:Track"],tt=E(_e,"Placemark"),Ge=E(_e,"Style"),at=E(_e,"StyleMap"),ht=0;ht<Ge.length;ht++){var _t=Y(Fe(Ge[ht])).toString(16);Le["#"+p(Ge[ht],"id")]=_t,ye[_t]=Ge[ht]}for(var Ne=0;Ne<at.length;Ne++){Le["#"+p(at[Ne],"id")]=Y(Fe(at[Ne])).toString(16);for(var kt=E(at[Ne],"Pair"),Wt={},dt=0;dt<kt.length;dt++)Wt[X(pe(kt[dt],"key"))]=X(pe(kt[dt],"styleUrl"));Je["#"+p(at[Ne],"id")]=Wt}for(var Pt=0;Pt<tt.length;Pt++)xe.features=xe.features.concat(ui(tt[Pt]));function xt(Qe){var gt,Vt;return Qe=Qe||"",Qe.substr(0,1)==="#"&&(Qe=Qe.substr(1)),(Qe.length===6||Qe.length===3)&&(gt=Qe),Qe.length===8&&(Vt=parseInt(Qe.substr(0,2),16)/255,gt="#"+Qe.substr(6,2)+Qe.substr(4,2)+Qe.substr(2,2)),[gt,isNaN(Vt)?void 0:Vt]}function Nt(Qe){return se(Qe.split(" "))}function $t(Qe){var gt=E(Qe,"coord","gx"),Vt=[],ut=[];gt.length===0&&(gt=E(Qe,"gx:coord"));for(var ci=0;ci<gt.length;ci++)Vt.push(Nt(X(gt[ci])));for(var bi=E(Qe,"when"),Kt=0;Kt<bi.length;Kt++)ut.push(X(bi[Kt]));return{coords:Vt,times:ut}}function vt(Qe){var gt,Vt,ut,ci,bi,Kt=[],oe=[];if(pe(Qe,"MultiGeometry"))return vt(pe(Qe,"MultiGeometry"));if(pe(Qe,"MultiTrack"))return vt(pe(Qe,"MultiTrack"));if(pe(Qe,"gx:MultiTrack"))return vt(pe(Qe,"gx:MultiTrack"));for(ut=0;ut<Pe.length;ut++)if(Vt=E(Qe,Pe[ut]),Vt){for(ci=0;ci<Vt.length;ci++)if(gt=Vt[ci],Pe[ut]==="Point")Kt.push({type:"Point",coordinates:Et(X(pe(gt,"coordinates")))});else if(Pe[ut]==="LineString")Kt.push({type:"LineString",coordinates:li(X(pe(gt,"coordinates")))});else if(Pe[ut]==="Polygon"){var Xi=E(gt,"LinearRing"),kr=[];for(bi=0;bi<Xi.length;bi++)kr.push(li(X(pe(Xi[bi],"coordinates"))));Kt.push({type:"Polygon",coordinates:kr})}else if(Pe[ut]==="Track"||Pe[ut]==="gx:Track"){var wt=$t(gt);Kt.push({type:"LineString",coordinates:wt.coords}),wt.times.length&&oe.push(wt.times)}}return{geoms:Kt,coordTimes:oe}}function ui(Qe){var gt=vt(Qe),Vt,ut={},ci=X(pe(Qe,"name")),bi=X(pe(Qe,"address")),Kt=X(pe(Qe,"styleUrl")),oe=X(pe(Qe,"description")),Xi=pe(Qe,"TimeSpan"),kr=pe(Qe,"TimeStamp"),wt=pe(Qe,"ExtendedData"),Zt=pe(Qe,"LineStyle"),_r=pe(Qe,"PolyStyle"),Mr=pe(Qe,"visibility");if(!gt.geoms.length)return[];if(ci&&(ut.name=ci),bi&&(ut.address=bi),Kt){Kt[0]!=="#"&&(Kt="#"+Kt),ut.styleUrl=Kt,Le[Kt]&&(ut.styleHash=Le[Kt]),Je[Kt]&&(ut.styleMapHash=Je[Kt],ut.styleHash=Le[Je[Kt].normal]);var Wi=ye[ut.styleHash];if(Wi){Zt||(Zt=pe(Wi,"LineStyle")),_r||(_r=pe(Wi,"PolyStyle"));var Qr=pe(Wi,"IconStyle");if(Qr){var Ui=pe(Qr,"Icon");if(Ui){var sn=X(pe(Ui,"href"));sn&&(ut.icon=sn)}}}}if(oe&&(ut.description=oe),Xi){var yn=X(pe(Xi,"begin")),be=X(pe(Xi,"end"));ut.timespan={begin:yn,end:be}}if(kr&&(ut.timestamp=X(pe(kr,"when"))),Zt){var or=xt(X(pe(Zt,"color"))),Ai=or[0],lr=or[1],Pr=parseFloat(X(pe(Zt,"width")));Ai&&(ut.stroke=Ai),isNaN(lr)||(ut["stroke-opacity"]=lr),isNaN(Pr)||(ut["stroke-width"]=Pr)}if(_r){var we=xt(X(pe(_r,"color"))),ft=we[0],nt=we[1],Si=X(pe(_r,"fill")),Ji=X(pe(_r,"outline"));ft&&(ut.fill=ft),isNaN(nt)||(ut["fill-opacity"]=nt),Si&&(ut["fill-opacity"]=Si==="1"?ut["fill-opacity"]||1:0),Ji&&(ut["stroke-opacity"]=Ji==="1"?ut["stroke-opacity"]||1:0)}if(wt){var st=E(wt,"Data"),Ki=E(wt,"SimpleData");for(Vt=0;Vt<st.length;Vt++)ut[st[Vt].getAttribute("name")]=X(pe(st[Vt],"value"));for(Vt=0;Vt<Ki.length;Vt++)ut[Ki[Vt].getAttribute("name")]=X(Ki[Vt])}Mr&&(ut.visibility=X(Mr)),gt.coordTimes.length&&(ut.coordTimes=gt.coordTimes.length===1?gt.coordTimes[0]:gt.coordTimes);var yr={type:"Feature",geometry:gt.geoms.length===1?gt.geoms[0]:{type:"GeometryCollection",geometries:gt.geoms},properties:ut};return p(Qe,"id")&&(yr.id=p(Qe,"id")),[yr]}return xe},gpx:function(_e){var xe,Le=E(_e,"trk"),ye=E(_e,"rte"),Je=E(_e,"wpt"),Pe=Mt(),tt;for(xe=0;xe<Le.length;xe++)tt=ht(Le[xe]),tt&&Pe.features.push(tt);for(xe=0;xe<ye.length;xe++)tt=_t(ye[xe]),tt&&Pe.features.push(tt);for(xe=0;xe<Je.length;xe++)Pe.features.push(Ne(Je[xe]));function Ge(dt,Pt){for(var xt=0;xt<Pt;xt++)dt.push(null);return dt}function at(dt,Pt){var xt=E(dt,Pt),Nt=[],$t=[],vt=[],ui=xt.length;if(ui<2)return{};for(var Qe=0;Qe<ui;Qe++){var gt=Lt(xt[Qe]);Nt.push(gt.coordinates),gt.time&&$t.push(gt.time),(gt.heartRate||vt.length)&&(vt.length||Ge(vt,Qe),vt.push(gt.heartRate||null))}return{line:Nt,times:$t,heartRates:vt}}function ht(dt){for(var Pt=E(dt,"trkseg"),xt=[],Nt=[],$t=[],vt,ui=0;ui<Pt.length;ui++)if(vt=at(Pt[ui],"trkpt"),vt&&(vt.line&&xt.push(vt.line),vt.times&&vt.times.length&&Nt.push(vt.times),$t.length||vt.heartRates&&vt.heartRates.length)){if(!$t.length)for(var Qe=0;Qe<ui;Qe++)$t.push(Ge([],xt[Qe].length));vt.heartRates&&vt.heartRates.length?$t.push(vt.heartRates):$t.push(Ge([],vt.line.length||0))}if(xt.length!==0){var gt=Wt(dt);return mt(gt,kt(pe(dt,"extensions"))),Nt.length&&(gt.coordTimes=xt.length===1?Nt[0]:Nt),$t.length&&(gt.heartRates=xt.length===1?$t[0]:$t),{type:"Feature",properties:gt,geometry:{type:xt.length===1?"LineString":"MultiLineString",coordinates:xt.length===1?xt[0]:xt}}}}function _t(dt){var Pt=at(dt,"rtept");if(Pt.line){var xt=Wt(dt);mt(xt,kt(pe(dt,"extensions")));var Nt={type:"Feature",properties:xt,geometry:{type:"LineString",coordinates:Pt.line}};return Nt}}function Ne(dt){var Pt=Wt(dt);return mt(Pt,It(dt,["sym"])),{type:"Feature",properties:Pt,geometry:{type:"Point",coordinates:Lt(dt).coordinates}}}function kt(dt){var Pt={};if(dt){var xt=pe(dt,"line");if(xt){var Nt=X(pe(xt,"color")),$t=parseFloat(X(pe(xt,"opacity"))),vt=parseFloat(X(pe(xt,"width")));Nt&&(Pt.stroke=Nt),isNaN($t)||(Pt["stroke-opacity"]=$t),isNaN(vt)||(Pt["stroke-width"]=vt*96/25.4)}}return Pt}function Wt(dt){var Pt=It(dt,["name","cmt","desc","type","time","keywords"]),xt=E(dt,"link");xt.length&&(Pt.links=[]);for(var Nt=0,$t;Nt<xt.length;Nt++)$t={href:p(xt[Nt],"href")},mt($t,It(xt[Nt],["text","type"])),Pt.links.push($t);return Pt}return Pe}};return Ye}();typeof ph<"u"&&(ph.exports=E0)});var Xd=Kp(Qp());var Wd=Kp(Hd());(function(w){var S="#2A8C73",F="#155244",Y="https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json";function E(De){return{type:"Feature",properties:{},geometry:{type:"LineString",coordinates:De}}}function p(De,We){if(De.length<2)return De;We=We||16;var Re=.5,Fe=[],Ye=[[2*De[0][0]-De[1][0],2*De[0][1]-De[1][1]]].concat(De).concat([[2*De[De.length-1][0]-De[De.length-2][0],2*De[De.length-1][1]-De[De.length-2][1]]]);function _e(gt,Vt){var ut=Vt[0]-gt[0],ci=Vt[1]-gt[1];return Math.pow(Math.max(Math.sqrt(ut*ut+ci*ci),1e-10),Re)}for(var xe=1;xe<Ye.length-2;xe++)for(var Le=Ye[xe-1],ye=Ye[xe],Je=Ye[xe+1],Pe=Ye[xe+2],tt=0,Ge=tt+_e(Le,ye),at=Ge+_e(ye,Je),ht=at+_e(Je,Pe),_t=0;_t<We;_t++){var Ne=Ge+(at-Ge)*_t/We,kt=(Ge-Ne)/(Ge-tt)*Le[0]+(Ne-tt)/(Ge-tt)*ye[0],Wt=(Ge-Ne)/(Ge-tt)*Le[1]+(Ne-tt)/(Ge-tt)*ye[1],dt=(at-Ne)/(at-Ge)*ye[0]+(Ne-Ge)/(at-Ge)*Je[0],Pt=(at-Ne)/(at-Ge)*ye[1]+(Ne-Ge)/(at-Ge)*Je[1],xt=(ht-Ne)/(ht-at)*Je[0]+(Ne-at)/(ht-at)*Pe[0],Nt=(ht-Ne)/(ht-at)*Je[1]+(Ne-at)/(ht-at)*Pe[1],$t=(at-Ne)/(at-tt)*kt+(Ne-tt)/(at-tt)*dt,vt=(at-Ne)/(at-tt)*Wt+(Ne-tt)/(at-tt)*Pt,ui=(ht-Ne)/(ht-Ge)*dt+(Ne-Ge)/(ht-Ge)*xt,Qe=(ht-Ne)/(ht-Ge)*Pt+(Ne-Ge)/(ht-Ge)*Nt;Fe.push([(at-Ne)/(at-Ge)*$t+(Ne-Ge)/(at-Ge)*ui,(at-Ne)/(at-Ge)*vt+(Ne-Ge)/(at-Ge)*Qe])}return Fe.push(De[De.length-1]),Fe}function ue(De,We,Re){if(We.length<2)return;for(var Fe=[0],Ye=1;Ye<We.length;Ye++){var _e=We[Ye][0]-We[Ye-1][0],xe=We[Ye][1]-We[Ye-1][1];Fe.push(Fe[Ye-1]+Math.sqrt(_e*_e+xe*xe))}var Le=Fe[Fe.length-1],ye=5e3,Je=performance.now();function Pe(tt){if(De.getSource(Re)){for(var Ge=Math.min((tt-Je)/ye,1),at=1-Math.pow(1-Ge,3),ht=at*Le,_t=[We[0]],Ne=1;Ne<We.length;Ne++)if(Fe[Ne]<=ht)_t.push(We[Ne]);else{var kt=(ht-Fe[Ne-1])/(Fe[Ne]-Fe[Ne-1]);_t.push([We[Ne-1][0]+(We[Ne][0]-We[Ne-1][0])*kt,We[Ne-1][1]+(We[Ne][1]-We[Ne-1][1])*kt]);break}De.getSource(Re).setData(E(_t)),Ge<1&&requestAnimationFrame(Pe)}}requestAnimationFrame(Pe)}function pe(De,We,Re){if(!(We.length<2)){var Fe=p(We,16);De.addSource(Re,{type:"geojson",data:E([Fe[0]])}),De.addLayer({id:Re+"-line",type:"line",source:Re,layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":S,"line-width":2,"line-opacity":.45,"line-dasharray":[0,2.5]}});var Ye=window.matchMedia("(prefers-reduced-motion: reduce)").matches;Ye?De.getSource(Re).setData(E(Fe)):ue(De,Fe,Re)}}function Ce(De){var We=document.createElement("div"),Re=De?18:12,Fe=De?F:S,Ye=De?",0 0 0 4px rgba(42,140,115,0.25)":"";return We.style.cssText=["width:"+Re+"px","height:"+Re+"px","background:"+Fe,"border:2px solid #fff","border-radius:50%","box-shadow:0 1px 4px rgba(0,0,0,0.4)"+Ye,"cursor:pointer"].join(";"),We}function se(){var De=document.createElement("div");return De.style.cssText=["width:10px","height:10px","background:#fff","border:2px solid "+S,"transform:rotate(45deg)","box-shadow:0 1px 4px rgba(0,0,0,0.4)","cursor:pointer"].join(";"),De}function X(De,We,Re,Fe){var Ye=6371,_e=(Re-De)*Math.PI/180,xe=(Fe-We)*Math.PI/180,Le=Math.sin(_e/2)*Math.sin(_e/2)+Math.cos(De*Math.PI/180)*Math.cos(Re*Math.PI/180)*Math.sin(xe/2)*Math.sin(xe/2);return Ye*2*Math.atan2(Math.sqrt(Le),Math.sqrt(1-Le))}function It(De){var We=[];return(De.features||[]).forEach(function(Re){var Fe=[];Re.geometry.type==="LineString"?Fe=Re.geometry.coordinates:Re.geometry.type==="MultiLineString"&&Re.geometry.coordinates.forEach(function(Ye){Fe=Fe.concat(Ye)}),Fe.forEach(function(Ye){We.push([Ye[1],Ye[0]])})}),We}function mt(De,We,Re,Fe){if(!Re||Re.length===0)return!1;for(var Ye=Fe/111,_e=Fe/(111*Math.cos(De*Math.PI/180)),xe=0;xe<Re.length;xe+=10){var Le=Re[xe];if(!(Math.abs(Le[0]-De)>Ye||Math.abs(Le[1]-We)>_e)&&X(De,We,Le[0],Le[1])<=Fe)return!0}var ye=Re[Re.length-1];return X(De,We,ye[0],ye[1])<=Fe}function Et(De,We,Re){for(var Fe=We&&We.connectMode||"on",Ye=[],_e=[],xe=0;xe<De.length;xe++){var Le=De[xe],ye=[parseFloat(Le.lng),parseFloat(Le.lat)];if(xe===0){_e.push(ye);continue}var Je;if(Fe==="off")Je=!1;else if(Fe==="on")Je=!0;else if(Fe==="manual")Je=!!Le.force_connect;else if(Le.force_connect)Je=!0;else if(!Re||Re.length===0)Je=!0;else{for(var Pe=De[xe-1],tt=!1,Ge=0;Ge<Re.length;Ge++)if(mt(parseFloat(Pe.lat),parseFloat(Pe.lng),Re[Ge],10)&&mt(parseFloat(Le.lat),parseFloat(Le.lng),Re[Ge],10)){tt=!0;break}Je=!tt}Je?_e.push(ye):(_e.length>=2&&Ye.push(_e),_e=[ye])}return _e.length>=2&&Ye.push(_e),Ye}function li(De,We,Re){We.forEach(function(Fe,Ye){var _e=We.length===1?Re:Re+"-"+Ye;pe(De,Fe,_e)})}function Lt(De,We,Re,Fe,Ye,_e){var xe=_e&&_e.connectMode==="intelligent_gpx";Promise.all(We.map(function(Le,ye){return fetch(Le).then(function(Je){return Je.text()}).then(function(Je){var Pe=new DOMParser().parseFromString(Je,"text/xml"),tt=toGeoJSON.gpx(Pe),Ge=Fe+"-"+ye;return De.addSource(Ge,{type:"geojson",data:tt}),De.addLayer({id:Ge+"-line",type:"line",source:Ge,layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":S,"line-width":2,"line-opacity":.7}}),xe?It(tt):[]}).catch(function(Je){return console.warn("GPX load failed:",Le,Je),[]})})).then(function(Le){var ye=xe?Le.filter(function(Pe){return Pe.length>0}):[],Je=Et(Re,_e,ye);li(De,Je,Ye)})}function Mt(De,We){var Re=De.length,Fe=new Array(De.length);if(Re===0){We({error:"no files"});return}De.forEach(function(_e,xe){fetch(_e).then(function(Le){return Le.text()}).then(function(Le){var ye=new DOMParser().parseFromString(Le,"text/xml"),Je=[];ye.querySelectorAll("trkpt").forEach(function(Pe){var tt=Pe.querySelector("ele"),Ge=Pe.querySelector("time");Je.push({lat:parseFloat(Pe.getAttribute("lat")),lon:parseFloat(Pe.getAttribute("lon")),ele:tt?parseFloat(tt.textContent):NaN,time:Ge?Ge.textContent:null})}),Fe[xe]=Je,--Re===0&&Ye()}).catch(function(Le){console.warn("GPX load failed:",_e,Le),Fe[xe]=[],--Re===0&&Ye()})});function Ye(){var _e=0,xe=0,Le=0,ye=NaN,Je=NaN,Pe=0;Fe.forEach(function(ht){if(!(!ht||ht.length<2)){isNaN(ht[0].ele)||((isNaN(ye)||ht[0].ele>ye)&&(ye=ht[0].ele),(isNaN(Je)||ht[0].ele<Je)&&(Je=ht[0].ele));for(var _t=1;_t<ht.length;_t++){var Ne=ht[_t-1],kt=ht[_t];if(_e+=X(Ne.lat,Ne.lon,kt.lat,kt.lon),!isNaN(Ne.ele)&&!isNaN(kt.ele)){var Wt=kt.ele-Ne.ele;Wt>0&&(xe+=Wt),Wt<0&&(Le+=-Wt),(isNaN(ye)||kt.ele>ye)&&(ye=kt.ele),(isNaN(Je)||kt.ele<Je)&&(Je=kt.ele)}if(Ne.time&&kt.time){var dt=(Date.parse(kt.time)-Date.parse(Ne.time))/36e5;dt>0&&X(Ne.lat,Ne.lon,kt.lat,kt.lon)/dt>=1&&(Pe+=dt)}}}});var tt=Pe>0?_e/Pe:0,Ge=Math.floor(Pe),at=Math.round((Pe-Ge)*60);at===60&&(Ge++,at=0),We({distance:_e,eleGain:xe,eleLoss:Le,highest:ye,lowest:Je,movingTime:Ge+":"+(at<10?"0":"")+at,avgSpeed:tt})}}w.MapUtils={MAP_STYLE:Y,ACCENT:S,haversineKm:X,parseGpxFiles:Mt,addJourneyLine:pe,addJourneySegments:li,buildJourneySegments:Et,renderGpxJourney:Lt,createDotMarker:Ce,createStoryMarker:se}})(window);window.maplibregl=Xd.default;window.toGeoJSON=Wd.default;})();
/*! Bundled license information:
maplibre-gl/dist/maplibre-gl.js:
(**
* MapLibre GL JS
* @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v4.7.1/LICENSE.txt
*)
*/