@maptiler/sdk 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
- (function(Oe,fa){typeof exports=="object"&&typeof module<"u"?fa(exports):typeof define=="function"&&define.amd?define(["exports"],fa):(Oe=typeof globalThis<"u"?globalThis:Oe||self,fa(Oe.maptilersdk={}))})(this,function(Oe){"use strict";var fa=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function sh(A){return A&&A.__esModule&&Object.prototype.hasOwnProperty.call(A,"default")?A.default:A}var ah={exports:{}};(function(A,x){(function(k,K){A.exports=K()})(fa,function(){var k,K,te;function ue(h,me){if(!k)k=me;else if(!K)K=me;else{var Q="var sharedChunk = {}; ("+k+")(sharedChunk); ("+K+")(sharedChunk);",He={};k(He),te=me(He),typeof window<"u"&&(te.workerUrl=window.URL.createObjectURL(new Blob([Q],{type:"text/javascript"})))}}ue(["exports"],function(h){function me(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var Q=He;function He(i,e){this.x=i,this.y=e}He.prototype={clone:function(){return new He(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,e){return this.clone()._rotateAround(i,e)},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 e=i.x-this.x,r=i.y-this.y;return e*e+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,e){return Math.atan2(this.x*e-this.y*i,this.x*i+this.y*e)},_matMult:function(i){var e=i[2]*this.x+i[3]*this.y;return this.x=i[0]*this.x+i[1]*this.y,this.y=e,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 e=Math.cos(i),r=Math.sin(i),s=r*this.x+e*this.y;return this.x=e*this.x-r*this.y,this.y=s,this},_rotateAround:function(i,e){var r=Math.cos(i),s=Math.sin(i),l=e.y+s*(this.x-e.x)+r*(this.y-e.y);return this.x=e.x+r*(this.x-e.x)-s*(this.y-e.y),this.y=l,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},He.convert=function(i){return i instanceof He?i:Array.isArray(i)?new He(i[0],i[1]):i};var ve=me(Q),Te=We;function We(i,e,r,s){this.cx=3*i,this.bx=3*(r-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(s-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=e,this.p2x=r,this.p2y=s}We.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,e){if(e===void 0&&(e=1e-6),i<0)return 0;if(i>1)return 1;for(var r=i,s=0;s<8;s++){var l=this.sampleCurveX(r)-i;if(Math.abs(l)<e)return r;var u=this.sampleCurveDerivativeX(r);if(Math.abs(u)<1e-6)break;r-=l/u}var d=0,f=1;for(r=i,s=0;s<20&&(l=this.sampleCurveX(r),!(Math.abs(l-i)<e));s++)i>l?d=r:f=r,r=.5*(f-d)+d;return r},solve:function(i,e){return this.sampleCurveY(this.solveCurveX(i,e))}};var Ge=me(Te);function kt(i,e,r,s){const l=new Ge(i,e,r,s);return function(u){return l.solve(u)}}const Rt=kt(.25,.1,.25,1);function It(i,e,r){return Math.min(r,Math.max(e,i))}function hr(i,e,r){const s=r-e,l=((i-e)%s+s)%s+e;return l===e?r:l}function _i(i,...e){for(const r of e)for(const s in r)i[s]=r[s];return i}let ya=1;function Un(i,e){i.forEach(r=>{e[r]&&(e[r]=e[r].bind(e))})}function Dr(i,e,r){const s={};for(const l in i)s[l]=e.call(r||this,i[l],l,i);return s}function mn(i,e,r){const s={};for(const l in i)e.call(r||this,i[l],l,i)&&(s[l]=i[l]);return s}function Ti(i){return Array.isArray(i)?i.map(Ti):typeof i=="object"&&i?Dr(i,Ti):i}const Xr={};function oi(i){Xr[i]||(typeof console<"u"&&console.warn(i),Xr[i]=!0)}function xt(i,e,r){return(r.y-i.y)*(e.x-i.x)>(e.y-i.y)*(r.x-i.x)}function xa(i){let e=0;for(let r,s,l=0,u=i.length,d=u-1;l<u;d=l++)r=i[l],s=i[d],e+=(s.x-r.x)*(r.y+s.y);return e}function qi(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}let Tr=null;function Rr(i){if(Tr==null){const e=i.navigator?i.navigator.userAgent:null;Tr=!!i.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return Tr}function Wr(i){return typeof ImageBitmap<"u"&&i instanceof ImageBitmap}const Sr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let gn,_n;const yn={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frame(i){const e=requestAnimationFrame(i);return{cancel:()=>cancelAnimationFrame(e)}},getImageData(i,e=0){return this.getImageCanvasContext(i).getImageData(-e,-e,i.width+2*e,i.height+2*e)},getImageCanvasContext(i){const e=window.document.createElement("canvas"),r=e.getContext("2d",{willReadFrequently:!0});if(!r)throw new Error("failed to create canvas 2d context");return e.width=i.width,e.height=i.height,r.drawImage(i,0,0,i.width,i.height),r},resolveURL:i=>(gn||(gn=document.createElement("a")),gn.href=i,gn.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(_n==null&&(_n=matchMedia("(prefers-reduced-motion: reduce)")),_n.matches)}},Hr={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,REGISTERED_PROTOCOLS:{},WORKER_URL:""};class Br extends Error{constructor(e,r,s,l){super(`AJAXError: ${r} (${e}): ${s}`),this.status=e,this.statusText=r,this.url=s,this.body=l}}const Nn=qi()?()=>self.worker&&self.worker.referrer:()=>(window.location.protocol==="blob:"?window.parent:window).location.href,Fr=i=>Hr.REGISTERED_PROTOCOLS[i.substring(0,i.indexOf("://"))];function xn(i,e){const r=new AbortController,s=new Request(i.url,{method:i.method||"GET",body:i.body,credentials:i.credentials,headers:i.headers,referrer:Nn(),signal:r.signal});let l=!1,u=!1;return i.type==="json"&&s.headers.set("Accept","application/json"),u||fetch(s).then(d=>d.ok?(f=>{(i.type==="arrayBuffer"||i.type==="image"?f.arrayBuffer():i.type==="json"?f.json():f.text()).then(g=>{u||(l=!0,e(null,g,f.headers.get("Cache-Control"),f.headers.get("Expires")))}).catch(g=>{u||e(new Error(g.message))})})(d):d.blob().then(f=>e(new Br(d.status,d.statusText,i.url,f)))).catch(d=>{d.code!==20&&e(new Error(d.message))}),{cancel:()=>{u=!0,l||r.abort()}}}const Gt=function(i,e){if(/:\/\//.test(i.url)&&!/^https?:|^file:/.test(i.url)){if(qi()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,e);if(!qi())return(Fr(i.url)||xn)(i,e)}if(!(/^file:/.test(r=i.url)||/^file:/.test(Nn())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return xn(i,e);if(qi()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,e,void 0,!0)}var r;return function(s,l){const u=new XMLHttpRequest;u.open(s.method||"GET",s.url,!0),s.type!=="arrayBuffer"&&s.type!=="image"||(u.responseType="arraybuffer");for(const d in s.headers)u.setRequestHeader(d,s.headers[d]);return s.type==="json"&&(u.responseType="text",u.setRequestHeader("Accept","application/json")),u.withCredentials=s.credentials==="include",u.onerror=()=>{l(new Error(u.statusText))},u.onload=()=>{if((u.status>=200&&u.status<300||u.status===0)&&u.response!==null){let d=u.response;if(s.type==="json")try{d=JSON.parse(u.response)}catch(f){return l(f)}l(null,d,u.getResponseHeader("Cache-Control"),u.getResponseHeader("Expires"))}else{const d=new Blob([u.response],{type:u.getResponseHeader("Content-Type")});l(new Br(u.status,u.statusText,s.url,d))}},u.send(s.body),{cancel:()=>u.abort()}}(i,e)},Or=function(i,e){return Gt(_i(i,{type:"arrayBuffer"}),e)};function Vn(i){if(!i||i.indexOf("://")<=0||i.indexOf("data:image/")===0||i.indexOf("blob:")===0)return!0;const e=new URL(i),r=window.location;return e.protocol===r.protocol&&e.host===r.host}function Ur(i,e,r){r[i]&&r[i].indexOf(e)!==-1||(r[i]=r[i]||[],r[i].push(e))}function vn(i,e,r){if(r&&r[i]){const s=r[i].indexOf(e);s!==-1&&r[i].splice(s,1)}}class Qi{constructor(e,r={}){_i(this,r),this.type=e}}class ur extends Qi{constructor(e,r={}){super("error",_i({error:e},r))}}class Zi{on(e,r){return this._listeners=this._listeners||{},Ur(e,r,this._listeners),this}off(e,r){return vn(e,r,this._listeners),vn(e,r,this._oneTimeListeners),this}once(e,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},Ur(e,r,this._oneTimeListeners),this):new Promise(s=>this.once(e,s))}fire(e,r){typeof e=="string"&&(e=new Qi(e,r||{}));const s=e.type;if(this.listens(s)){e.target=this;const l=this._listeners&&this._listeners[s]?this._listeners[s].slice():[];for(const f of l)f.call(this,e);const u=this._oneTimeListeners&&this._oneTimeListeners[s]?this._oneTimeListeners[s].slice():[];for(const f of u)vn(s,f,this._oneTimeListeners),f.call(this,e);const d=this._eventedParent;d&&(_i(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),d.fire(e))}else e instanceof ur&&console.error(e.error);return this}listens(e){return this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)}setEventedParent(e,r){return this._eventedParent=e,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"},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:{}},default:"mapbox"},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-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},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"}}};const Kr=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Yr(i,e){const r={};for(const s in i)s!=="ref"&&(r[s]=i[s]);return Kr.forEach(s=>{s in e&&(r[s]=e[s])}),r}function bt(i,e){if(Array.isArray(i)){if(!Array.isArray(e)||i.length!==e.length)return!1;for(let r=0;r<i.length;r++)if(!bt(i[r],e[r]))return!1;return!0}if(typeof i=="object"&&i!==null&&e!==null){if(typeof e!="object"||Object.keys(i).length!==Object.keys(e).length)return!1;for(const r in i)if(!bt(i[r],e[r]))return!1;return!0}return i===e}const pt={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight"};function Di(i,e,r){r.push({command:pt.addSource,args:[i,e[i]]})}function $n(i,e,r){e.push({command:pt.removeSource,args:[i]}),r[i]=!0}function xs(i,e,r,s){$n(i,r,s),Di(i,e,r)}function vs(i,e,r){let s;for(s in i[r])if(Object.prototype.hasOwnProperty.call(i[r],s)&&s!=="data"&&!bt(i[r][s],e[r][s]))return!1;for(s in e[r])if(Object.prototype.hasOwnProperty.call(e[r],s)&&s!=="data"&&!bt(i[r][s],e[r][s]))return!1;return!0}function ni(i,e,r,s,l,u){let d;for(d in e=e||{},i=i||{})Object.prototype.hasOwnProperty.call(i,d)&&(bt(i[d],e[d])||r.push({command:u,args:[s,d,e[d],l]}));for(d in e)Object.prototype.hasOwnProperty.call(e,d)&&!Object.prototype.hasOwnProperty.call(i,d)&&(bt(i[d],e[d])||r.push({command:u,args:[s,d,e[d],l]}))}function Jr(i){return i.id}function jn(i,e){return i[e.id]=e,i}class Ie{constructor(e,r,s,l){this.message=(e?`${e}: `:"")+s,l&&(this.identifier=l),r!=null&&r.__line__&&(this.line=r.__line__)}}function Si(i,...e){for(const r of e)for(const s in r)i[s]=r[s];return i}class Ei extends Error{constructor(e,r){super(r),this.message=r,this.key=e}}class dr{constructor(e,r=[]){this.parent=e,this.bindings={};for(const[s,l]of r)this.bindings[s]=l}concat(e){return new dr(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}const Er={kind:"null"},Se={kind:"number"},it={kind:"string"},Je={kind:"boolean"},Jt={kind:"color"},er={kind:"object"},qe={kind:"value"},Ir={kind:"collator"},Nr={kind:"formatted"},bn={kind:"padding"},Vr={kind:"resolvedImage"};function si(i,e){return{kind:"array",itemType:i,N:e}}function B(i){if(i.kind==="array"){const e=B(i.itemType);return typeof i.N=="number"?`array<${e}, ${i.N}>`:i.itemType.kind==="value"?"array":`array<${e}>`}return i.kind}const I=[Er,Se,it,Je,Jt,Nr,er,si(qe),bn,Vr];function P(i,e){if(e.kind==="error")return null;if(i.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!P(i.itemType,e.itemType))&&(typeof i.N!="number"||i.N===e.N))return null}else{if(i.kind===e.kind)return null;if(i.kind==="value"){for(const r of I)if(!P(r,e))return null}}return`Expected ${B(i)} but found ${B(e)} instead.`}function D(i,e){return e.some(r=>r.kind===i.kind)}function $(i,e){return e.some(r=>r==="null"?i===null:r==="array"?Array.isArray(i):r==="object"?i&&!Array.isArray(i)&&typeof i=="object":r===typeof i)}function q(i,e){return i.kind==="array"&&e.kind==="array"?i.itemType.kind===e.itemType.kind&&typeof i.N=="number":i.kind===e.kind}const Y=.96422,H=.82521,G=4/29,J=6/29,de=3*J*J,ce=Math.PI/180,pe=180/Math.PI;function Ne(i){return(i%=360)<0&&(i+=360),i}function Ke([i,e,r,s]){let l,u;const d=Ve((.2225045*(i=Be(i))+.7168786*(e=Be(e))+.0606169*(r=Be(r)))/1);i===e&&e===r?l=u=d:(l=Ve((.4360747*i+.3850649*e+.1430804*r)/Y),u=Ve((.0139322*i+.0971045*e+.7141733*r)/H));const f=116*d-16;return[f<0?0:f,500*(l-d),200*(d-u),s]}function Be(i){return i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function Ve(i){return i>.008856451679035631?Math.pow(i,1/3):i/de+G}function Qe([i,e,r,s]){let l=(i+16)/116,u=isNaN(e)?l:l+e/500,d=isNaN(r)?l:l-r/200;return l=1*tt(l),u=Y*tt(u),d=H*tt(d),[ot(3.1338561*u-1.6168667*l-.4906146*d),ot(-.9787684*u+1.9161415*l+.033454*d),ot(.0719453*u-.2289914*l+1.4052427*d),s]}function ot(i){return(i=i<=.00304?12.92*i:1.055*Math.pow(i,1/2.4)-.055)<0?0:i>1?1:i}function tt(i){return i>J?i*i*i:de*(i-G)}function ft(i){return parseInt(i.padEnd(2,i),16)/255}function gt(i,e){return At(e?i/100:i,0,1)}function At(i,e,r){return Math.min(Math.max(e,i),r)}function zt(i){return!i.some(Number.isNaN)}const Ut={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 lt{constructor(e,r,s,l=1,u=!0){this.r=e,this.g=r,this.b=s,this.a=l,u||(this.r*=l,this.g*=l,this.b*=l,l||this.overwriteGetter("rgb",[e,r,s,l]))}static parse(e){if(e instanceof lt)return e;if(typeof e!="string")return;const r=function(s){if((s=s.toLowerCase())==="transparent")return[0,0,0,0];const l=Ut[s];if(l){const[d,f,g]=l;return[d/255,f/255,g/255,1]}if(s.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(s)){const d=s.length<6?1:2;let f=1;return[ft(s.slice(f,f+=d)),ft(s.slice(f,f+=d)),ft(s.slice(f,f+=d)),ft(s.slice(f,f+d)||"ff")]}if(s.startsWith("rgb")){const d=s.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(d){const[f,g,b,w,E,C,M,L,N,O,W,ee]=d,Z=[w||" ",M||" ",O].join("");if(Z===" "||Z===" /"||Z===",,"||Z===",,,"){const re=[b,C,N].join(""),se=re==="%%%"?100:re===""?255:0;if(se){const he=[At(+g/se,0,1),At(+E/se,0,1),At(+L/se,0,1),W?gt(+W,ee):1];if(zt(he))return he}}return}}const u=s.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(u){const[d,f,g,b,w,E,C,M,L]=u,N=[g||" ",w||" ",C].join("");if(N===" "||N===" /"||N===",,"||N===",,,"){const O=[+f,At(+b,0,100),At(+E,0,100),M?gt(+M,L):1];if(zt(O))return function([W,ee,Z,re]){function se(he){const Le=(he+W/30)%12,Re=ee*Math.min(Z,1-Z);return Z-Re*Math.max(-1,Math.min(Le-3,9-Le,1))}return W=Ne(W),ee/=100,Z/=100,[se(0),se(8),se(4),re]}(O)}}}(e);return r?new lt(...r,!1):void 0}get rgb(){const{r:e,g:r,b:s,a:l}=this,u=l||1/0;return this.overwriteGetter("rgb",[e/u,r/u,s/u,l])}get hcl(){return this.overwriteGetter("hcl",function(e){const[r,s,l,u]=Ke(e),d=Math.sqrt(s*s+l*l);return[Math.round(1e4*d)?Ne(Math.atan2(l,s)*pe):NaN,d,r,u]}(this.rgb))}get lab(){return this.overwriteGetter("lab",Ke(this.rgb))}overwriteGetter(e,r){return Object.defineProperty(this,e,{value:r}),r}toString(){const[e,r,s,l]=this.rgb;return`rgba(${[e,r,s].map(u=>Math.round(255*u)).join(",")},${l})`}}lt.black=new lt(0,0,0,1),lt.white=new lt(1,1,1,1),lt.transparent=new lt(0,0,0,0),lt.red=new lt(1,0,0,1);class va{constructor(e,r,s){this.sensitivity=e?r?"variant":"case":r?"accent":"base",this.locale=s,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,r){return this.collator.compare(e,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class ba{constructor(e,r,s,l,u){this.text=e,this.image=r,this.scale=s,this.fontStack=l,this.textColor=u}}class Ri{constructor(e){this.sections=e}static fromString(e){return new Ri([new ba(e,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(e=>e.text.length!==0||e.image&&e.image.name.length!==0)}static factory(e){return e instanceof Ri?e:Ri.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}}class Ii{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Ii)return e;if(typeof e=="number")return new Ii([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const r of e)if(typeof r!="number")return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new Ii(e)}}toString(){return JSON.stringify(this.values)}}class li{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new li({name:e,available:!1}):null}}function Do(i,e,r,s){return typeof i=="number"&&i>=0&&i<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof r=="number"&&r>=0&&r<=255?s===void 0||typeof s=="number"&&s>=0&&s<=1?null:`Invalid rgba value [${[i,e,r,s].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof s=="number"?[i,e,r,s]:[i,e,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function bs(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof lt||i instanceof va||i instanceof Ri||i instanceof Ii||i instanceof li)return!0;if(Array.isArray(i)){for(const e of i)if(!bs(e))return!1;return!0}if(typeof i=="object"){for(const e in i)if(!bs(i[e]))return!1;return!0}return!1}function Lt(i){if(i===null)return Er;if(typeof i=="string")return it;if(typeof i=="boolean")return Je;if(typeof i=="number")return Se;if(i instanceof lt)return Jt;if(i instanceof va)return Ir;if(i instanceof Ri)return Nr;if(i instanceof Ii)return bn;if(i instanceof li)return Vr;if(Array.isArray(i)){const e=i.length;let r;for(const s of i){const l=Lt(s);if(r){if(r===l)continue;r=qe;break}r=l}return si(r||qe,e)}return er}function Gn(i){const e=typeof i;return i===null?"":e==="string"||e==="number"||e==="boolean"?String(i):i instanceof lt||i instanceof Ri||i instanceof Ii||i instanceof li?i.toString():JSON.stringify(i)}class Qr{constructor(e,r){this.type=e,this.value=r}static parse(e,r){if(e.length!==2)return r.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!bs(e[1]))return r.error("invalid value");const s=e[1];let l=Lt(s);const u=r.expectedType;return l.kind!=="array"||l.N!==0||!u||u.kind!=="array"||typeof u.N=="number"&&u.N!==0||(l=u),new Qr(l,s)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class Qt{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const qn={string:it,number:Se,boolean:Je,object:er};class Ai{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let s,l=1;const u=e[0];if(u==="array"){let f,g;if(e.length>2){const b=e[1];if(typeof b!="string"||!(b in qn)||b==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);f=qn[b],l++}else f=qe;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return r.error('The length argument to "array" must be a positive integer literal',2);g=e[2],l++}s=si(f,g)}else{if(!qn[u])throw new Error(`Types doesn't contain name = ${u}`);s=qn[u]}const d=[];for(;l<e.length;l++){const f=r.parse(e[l],l,qe);if(!f)return null;d.push(f)}return new Ai(s,d)}evaluate(e){for(let r=0;r<this.args.length;r++){const s=this.args[r].evaluate(e);if(!P(this.type,Lt(s)))return s;if(r===this.args.length-1)throw new Qt(`Expected value to be of type ${B(this.type)}, but found ${B(Lt(s))} instead.`)}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const Ro={"to-boolean":Je,"to-color":Jt,"to-number":Se,"to-string":it};class $r{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");const s=e[0];if(!Ro[s])throw new Error(`Can't parse ${s} as it is not part of the known types`);if((s==="to-boolean"||s==="to-string")&&e.length!==2)return r.error("Expected one argument.");const l=Ro[s],u=[];for(let d=1;d<e.length;d++){const f=r.parse(e[d],d,qe);if(!f)return null;u.push(f)}return new $r(l,u)}evaluate(e){if(this.type.kind==="boolean")return!!this.args[0].evaluate(e);if(this.type.kind==="color"){let r,s;for(const l of this.args){if(r=l.evaluate(e),s=null,r instanceof lt)return r;if(typeof r=="string"){const u=e.parseColor(r);if(u)return u}else if(Array.isArray(r)&&(s=r.length<3||r.length>4?`Invalid rbga value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:Do(r[0],r[1],r[2],r[3]),!s))return new lt(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new Qt(s||`Could not parse color from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}if(this.type.kind==="padding"){let r;for(const s of this.args){r=s.evaluate(e);const l=Ii.parse(r);if(l)return l}throw new Qt(`Could not parse padding from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}if(this.type.kind==="number"){let r=null;for(const s of this.args){if(r=s.evaluate(e),r===null)return 0;const l=Number(r);if(!isNaN(l))return l}throw new Qt(`Could not convert ${JSON.stringify(r)} to number.`)}return this.type.kind==="formatted"?Ri.fromString(Gn(this.args[0].evaluate(e))):this.type.kind==="resolvedImage"?li.fromString(Gn(this.args[0].evaluate(e))):Gn(this.args[0].evaluate(e))}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const Yl=["Unknown","Point","LineString","Polygon"];class tr{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"?Yl[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(e){let r=this._parseColorCache[e];return r||(r=this._parseColorCache[e]=lt.parse(e)),r}}class wn{constructor(e,r,s=[],l,u=new dr,d=[]){this.registry=e,this.path=s,this.key=s.map(f=>`[${f}]`).join(""),this.scope=u,this.errors=d,this.expectedType=l,this._isConstant=r}parse(e,r,s,l,u={}){return r?this.concat(r,s,l)._parse(e,u):this._parse(e,u)}_parse(e,r){function s(l,u,d){return d==="assert"?new Ai(u,[l]):d==="coerce"?new $r(u,[l]):l}if(e!==null&&typeof e!="string"&&typeof e!="boolean"&&typeof e!="number"||(e=["literal",e]),Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const l=e[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;const u=this.registry[l];if(u){let d=u.parse(e,this);if(!d)return null;if(this.expectedType){const 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(this.checkSubtype(f,g))return null}else d=s(d,f,r.typeAnnotation||"coerce");else d=s(d,f,r.typeAnnotation||"coerce");else d=s(d,f,r.typeAnnotation||"assert")}if(!(d instanceof Qr)&&d.type.kind!=="resolvedImage"&&this._isConstant(d)){const f=new tr;try{d=new Qr(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(e===void 0?"'undefined' value invalid. Use null instead.":typeof e=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,r,s){const l=typeof e=="number"?this.path.concat(e):this.path,u=s?this.scope.concat(s):this.scope;return new wn(this.registry,this._isConstant,l,r||null,u,this.errors)}error(e,...r){const s=`${this.key}${r.map(l=>`[${l}]`).join("")}`;this.errors.push(new Ei(s,e))}checkSubtype(e,r){const s=P(e,r);return s&&this.error(s),s}}class Tn{constructor(e,r,s){this.type=Ir,this.locale=s,this.caseSensitive=e,this.diacriticSensitive=r}static parse(e,r){if(e.length!==2)return r.error("Expected one argument.");const s=e[1];if(typeof s!="object"||Array.isArray(s))return r.error("Collator options argument must be an object.");const l=r.parse(s["case-sensitive"]!==void 0&&s["case-sensitive"],1,Je);if(!l)return null;const u=r.parse(s["diacritic-sensitive"]!==void 0&&s["diacritic-sensitive"],1,Je);if(!u)return null;let d=null;return s.locale&&(d=r.parse(s.locale,1,it),!d)?null:new Tn(l,u,d)}evaluate(e){return new va(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}}const Xi=8192;function _t(i,e){i[0]=Math.min(i[0],e[0]),i[1]=Math.min(i[1],e[1]),i[2]=Math.max(i[2],e[0]),i[3]=Math.max(i[3],e[1])}function ws(i,e){return!(i[0]<=e[0]||i[2]>=e[2]||i[1]<=e[1]||i[3]>=e[3])}function wa(i,e){const r=(180+i[0])/360,s=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i[1]*Math.PI/360)))/360,l=Math.pow(2,e.z);return[Math.round(r*l*Xi),Math.round(s*l*Xi)]}function Jl(i,e,r){const s=i[0]-e[0],l=i[1]-e[1],u=i[0]-r[0],d=i[1]-r[1];return s*d-u*l==0&&s*u<=0&&l*d<=0}function Ts(i,e){let r=!1;for(let d=0,f=e.length;d<f;d++){const g=e[d];for(let b=0,w=g.length;b<w-1;b++){if(Jl(i,g[b],g[b+1]))return!1;(l=g[b])[1]>(s=i)[1]!=(u=g[b+1])[1]>s[1]&&s[0]<(u[0]-l[0])*(s[1]-l[1])/(u[1]-l[1])+l[0]&&(r=!r)}}var s,l,u;return r}function Bo(i,e){for(let r=0;r<e.length;r++)if(Ts(i,e[r]))return!0;return!1}function Fo(i,e,r,s){const l=s[0]-r[0],u=s[1]-r[1],d=(i[0]-r[0])*u-l*(i[1]-r[1]),f=(e[0]-r[0])*u-l*(e[1]-r[1]);return d>0&&f<0||d<0&&f>0}function Oo(i,e,r){for(const b of r)for(let w=0;w<b.length-1;++w)if((f=[(d=b[w+1])[0]-(u=b[w])[0],d[1]-u[1]])[0]*(g=[(l=e)[0]-(s=i)[0],l[1]-s[1]])[1]-f[1]*g[0]!=0&&Fo(s,l,u,d)&&Fo(u,d,s,l))return!0;var s,l,u,d,f,g;return!1}function Ta(i,e){for(let r=0;r<i.length;++r)if(!Ts(i[r],e))return!1;for(let r=0;r<i.length-1;++r)if(Oo(i[r],i[r+1],e))return!1;return!0}function Ql(i,e){for(let r=0;r<e.length;r++)if(Ta(i,e[r]))return!0;return!1}function Sa(i,e,r){const s=[];for(let l=0;l<i.length;l++){const u=[];for(let d=0;d<i[l].length;d++){const f=wa(i[l][d],r);_t(e,f),u.push(f)}s.push(u)}return s}function Uo(i,e,r){const s=[];for(let l=0;l<i.length;l++){const u=Sa(i[l],e,r);s.push(u)}return s}function No(i,e,r,s){if(i[0]<r[0]||i[0]>r[2]){const l=.5*s;let u=i[0]-r[0]>l?-s:r[0]-i[0]>l?s:0;u===0&&(u=i[0]-r[2]>l?-s:r[2]-i[0]>l?s:0),i[0]+=u}_t(e,i)}function Ea(i,e,r,s){const l=Math.pow(2,s.z)*Xi,u=[s.x*Xi,s.y*Xi],d=[];for(const f of i)for(const g of f){const b=[g.x+u[0],g.y+u[1]];No(b,e,r,l),d.push(b)}return d}function Ia(i,e,r,s){const l=Math.pow(2,s.z)*Xi,u=[s.x*Xi,s.y*Xi],d=[];for(const g of i){const b=[];for(const w of g){const E=[w.x+u[0],w.y+u[1]];_t(e,E),b.push(E)}d.push(b)}if(e[2]-e[0]<=l/2){(f=e)[0]=f[1]=1/0,f[2]=f[3]=-1/0;for(const g of d)for(const b of g)No(b,e,r,l)}var f;return d}class en{constructor(e,r){this.type=Je,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(bs(e[1])){const s=e[1];if(s.type==="FeatureCollection")for(let l=0;l<s.features.length;++l){const u=s.features[l].geometry.type;if(u==="Polygon"||u==="MultiPolygon")return new en(s,s.features[l].geometry)}else if(s.type==="Feature"){const l=s.geometry.type;if(l==="Polygon"||l==="MultiPolygon")return new en(s,s.geometry)}else if(s.type==="Polygon"||s.type==="MultiPolygon")return new en(s,s)}return r.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return function(r,s){const l=[1/0,1/0,-1/0,-1/0],u=[1/0,1/0,-1/0,-1/0],d=r.canonicalID();if(s.type==="Polygon"){const f=Sa(s.coordinates,u,d),g=Ea(r.geometry(),l,u,d);if(!ws(l,u))return!1;for(const b of g)if(!Ts(b,f))return!1}if(s.type==="MultiPolygon"){const f=Uo(s.coordinates,u,d),g=Ea(r.geometry(),l,u,d);if(!ws(l,u))return!1;for(const b of g)if(!Bo(b,f))return!1}return!0}(e,this.geometries);if(e.geometryType()==="LineString")return function(r,s){const l=[1/0,1/0,-1/0,-1/0],u=[1/0,1/0,-1/0,-1/0],d=r.canonicalID();if(s.type==="Polygon"){const f=Sa(s.coordinates,u,d),g=Ia(r.geometry(),l,u,d);if(!ws(l,u))return!1;for(const b of g)if(!Ta(b,f))return!1}if(s.type==="MultiPolygon"){const f=Uo(s.coordinates,u,d),g=Ia(r.geometry(),l,u,d);if(!ws(l,u))return!1;for(const b of g)if(!Ql(b,f))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class Ss{constructor(e,r){this.type=r.type,this.name=e,this.boundExpression=r}static parse(e,r){if(e.length!==2||typeof e[1]!="string")return r.error("'var' expression requires exactly one string literal argument.");const s=e[1];return r.scope.has(s)?new Ss(s,r.scope.get(s)):r.error(`Unknown variable "${s}". Make sure "${s}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}}class Ci{constructor(e,r,s,l){this.name=e,this.type=r,this._evaluate=s,this.args=l}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,r){const s=e[0],l=Ci.definitions[s];if(!l)return r.error(`Unknown expression "${s}". If you wanted a literal array, use ["literal", [...]].`,0);const u=Array.isArray(l)?l[0]:l.type,d=Array.isArray(l)?[[l[1],l[2]]]:l.overloads,f=d.filter(([b])=>!Array.isArray(b)||b.length===e.length-1);let g=null;for(const[b,w]of f){g=new wn(r.registry,Es,r.path,null,r.scope);const E=[];let C=!1;for(let M=1;M<e.length;M++){const L=e[M],N=Array.isArray(b)?b[M-1]:b.type,O=g.parse(L,1+E.length,N);if(!O){C=!0;break}E.push(O)}if(!C)if(Array.isArray(b)&&b.length!==E.length)g.error(`Expected ${b.length} arguments, but found ${E.length} instead.`);else{for(let M=0;M<E.length;M++){const L=Array.isArray(b)?b[M]:b.type,N=E[M];g.concat(M+1).checkSubtype(L,N.type)}if(g.errors.length===0)return new Ci(s,u,w,E)}}if(f.length===1)r.errors.push(...g.errors);else{const b=(f.length?f:d).map(([E])=>{return C=E,Array.isArray(C)?`(${C.map(B).join(", ")})`:`(${B(C.type)}...)`;var C}).join(" | "),w=[];for(let E=1;E<e.length;E++){const C=r.parse(e[E],1+w.length);if(!C)return null;w.push(B(C.type))}r.error(`Expected arguments of type ${b}, but found (${w.join(", ")}) instead.`)}return null}static register(e,r){Ci.definitions=r;for(const s in r)e[s]=Ci}}function Es(i){if(i instanceof Ss)return Es(i.boundExpression);if(i instanceof Ci&&i.name==="error"||i instanceof Tn||i instanceof en)return!1;const e=i instanceof $r||i instanceof Ai;let r=!0;return i.eachChild(s=>{r=e?r&&Es(s):r&&s instanceof Qr}),!!r&&Is(i)&&Xn(i,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Is(i){if(i instanceof Ci&&(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 en)return!1;let e=!0;return i.eachChild(r=>{e&&!Is(r)&&(e=!1)}),e}function Zn(i){if(i instanceof Ci&&i.name==="feature-state")return!1;let e=!0;return i.eachChild(r=>{e&&!Zn(r)&&(e=!1)}),e}function Xn(i,e){if(i instanceof Ci&&e.indexOf(i.name)>=0)return!1;let r=!0;return i.eachChild(s=>{r&&!Xn(s,e)&&(r=!1)}),r}function Wn(i,e){const r=i.length-1;let s,l,u=0,d=r,f=0;for(;u<=d;)if(f=Math.floor((u+d)/2),s=i[f],l=i[f+1],s<=e){if(f===r||e<l)return f;u=f+1}else{if(!(s>e))throw new Qt("Input is not a number.");d=f-1}return 0}class Hn{constructor(e,r,s){this.type=e,this.input=r,this.labels=[],this.outputs=[];for(const[l,u]of s)this.labels.push(l),this.outputs.push(u)}static parse(e,r){if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");const s=r.parse(e[1],1,Se);if(!s)return null;const l=[];let u=null;r.expectedType&&r.expectedType.kind!=="value"&&(u=r.expectedType);for(let d=1;d<e.length;d+=2){const f=d===1?-1/0:e[d],g=e[d+1],b=d,w=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.',b);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.',b);const E=r.parse(g,w,u);if(!E)return null;u=u||E.type,l.push([f,E])}return new Hn(u,s,l)}evaluate(e){const r=this.labels,s=this.outputs;if(r.length===1)return s[0].evaluate(e);const l=this.input.evaluate(e);if(l<=r[0])return s[0].evaluate(e);const u=r.length;return l>=r[u-1]?s[u-1].evaluate(e):s[Wn(r,l)].evaluate(e)}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function Kn(i,e,r){return i+r*(e-i)}function Yn(i,e,r){return i.map((s,l)=>Kn(s,e[l],r))}const Pi={number:Kn,color:function(i,e,r,s="rgb"){switch(s){case"rgb":{const[l,u,d,f]=Yn(i.rgb,e.rgb,r);return new lt(l,u,d,f,!1)}case"hcl":{const[l,u,d,f]=i.hcl,[g,b,w,E]=e.hcl;let C,M;if(isNaN(l)||isNaN(g))isNaN(l)?isNaN(g)?C=NaN:(C=g,d!==1&&d!==0||(M=b)):(C=l,w!==1&&w!==0||(M=u));else{let ee=g-l;g>l&&ee>180?ee-=360:g<l&&l-g>180&&(ee+=360),C=l+r*ee}const[L,N,O,W]=function([ee,Z,re,se]){return ee=isNaN(ee)?0:ee*ce,Qe([re,Math.cos(ee)*Z,Math.sin(ee)*Z,se])}([C,M??Kn(u,b,r),Kn(d,w,r),Kn(f,E,r)]);return new lt(L,N,O,W,!1)}case"lab":{const[l,u,d,f]=Qe(Yn(i.lab,e.lab,r));return new lt(l,u,d,f,!1)}}},array:Yn,padding:function(i,e,r){return new Ii(Yn(i.values,e.values,r))}};class Bi{constructor(e,r,s,l,u){this.type=e,this.operator=r,this.interpolation=s,this.input=l,this.labels=[],this.outputs=[];for(const[d,f]of u)this.labels.push(d),this.outputs.push(f)}static interpolationFactor(e,r,s,l){let u=0;if(e.name==="exponential")u=Aa(r,e.base,s,l);else if(e.name==="linear")u=Aa(r,1,s,l);else if(e.name==="cubic-bezier"){const d=e.controlPoints;u=new Ge(d[0],d[1],d[2],d[3]).solve(Aa(r,1,s,l))}return u}static parse(e,r){let[s,l,u,...d]=e;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"){const b=l[1];if(typeof b!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);l={name:"exponential",base:b}}else{if(l[0]!=="cubic-bezier")return r.error(`Unknown interpolation type ${String(l[0])}`,1,0);{const b=l.slice(1);if(b.length!==4||b.some(w=>typeof w!="number"||w<0||w>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);l={name:"cubic-bezier",controlPoints:b}}}if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(u=r.parse(u,2,Se),!u)return null;const f=[];let g=null;s==="interpolate-hcl"||s==="interpolate-lab"?g=Jt:r.expectedType&&r.expectedType.kind!=="value"&&(g=r.expectedType);for(let b=0;b<d.length;b+=2){const w=d[b],E=d[b+1],C=b+3,M=b+4;if(typeof w!="number")return r.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',C);if(f.length&&f[f.length-1][0]>=w)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',C);const L=r.parse(E,M,g);if(!L)return null;g=g||L.type,f.push([w,L])}return q(g,Se)||q(g,Jt)||q(g,bn)||q(g,si(Se))?new Bi(g,s,l,u,f):r.error(`Type ${B(g)} is not interpolatable.`)}evaluate(e){const r=this.labels,s=this.outputs;if(r.length===1)return s[0].evaluate(e);const l=this.input.evaluate(e);if(l<=r[0])return s[0].evaluate(e);const u=r.length;if(l>=r[u-1])return s[u-1].evaluate(e);const d=Wn(r,l),f=Bi.interpolationFactor(this.interpolation,l,r[d],r[d+1]),g=s[d].evaluate(e),b=s[d+1].evaluate(e);switch(this.operator){case"interpolate":return Pi[this.type.kind](g,b,f);case"interpolate-hcl":return Pi.color(g,b,f,"hcl");case"interpolate-lab":return Pi.color(g,b,f,"lab")}}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function Aa(i,e,r,s){const l=s-r,u=i-r;return l===0?0:e===1?u/l:(Math.pow(e,u)-1)/(Math.pow(e,l)-1)}class As{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expectected at least one argument.");let s=null;const l=r.expectedType;l&&l.kind!=="value"&&(s=l);const u=[];for(const f of e.slice(1)){const g=r.parse(f,1+u.length,s,void 0,{typeAnnotation:"omit"});if(!g)return null;s=s||g.type,u.push(g)}if(!s)throw new Error("No output type");const d=l&&u.some(f=>P(l,f.type));return new As(d?qe:s,u)}evaluate(e){let r,s=null,l=0;for(const u of this.args)if(l++,s=u.evaluate(e),s&&s instanceof li&&!s.available&&(r||(r=s.name),s=null,l===this.args.length&&(s=r)),s!==null)break;return s}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}class Cs{constructor(e,r){this.type=r.type,this.bindings=[].concat(e),this.result=r}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const r of this.bindings)e(r[1]);e(this.result)}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const s=[];for(let u=1;u<e.length-1;u+=2){const d=e[u];if(typeof d!="string")return r.error(`Expected string, but found ${typeof d} instead.`,u);if(/[^a-zA-Z0-9_]/.test(d))return r.error("Variable names must contain only alphanumeric characters or '_'.",u);const f=r.parse(e[u+1],u+1);if(!f)return null;s.push([d,f])}const l=r.parse(e[e.length-1],e.length-1,r.expectedType,s);return l?new Cs(s,l):null}outputDefined(){return this.result.outputDefined()}}class Ca{constructor(e,r,s){this.type=e,this.index=r,this.input=s}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const s=r.parse(e[1],1,Se),l=r.parse(e[2],2,si(r.expectedType||qe));return s&&l?new Ca(l.type.itemType,s,l):null}evaluate(e){const r=this.index.evaluate(e),s=this.input.evaluate(e);if(r<0)throw new Qt(`Array index out of bounds: ${r} < 0.`);if(r>=s.length)throw new Qt(`Array index out of bounds: ${r} > ${s.length-1}.`);if(r!==Math.floor(r))throw new Qt(`Array index must be an integer, but found ${r} instead.`);return s[r]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class Pa{constructor(e,r){this.type=Je,this.needle=e,this.haystack=r}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const s=r.parse(e[1],1,qe),l=r.parse(e[2],2,qe);return s&&l?D(s.type,[Je,it,Se,Er,qe])?new Pa(s,l):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${B(s.type)} instead`):null}evaluate(e){const r=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(!s)return!1;if(!$(r,["boolean","string","number","null"]))throw new Qt(`Expected first argument to be of type boolean, string, number or null, but found ${B(Lt(r))} instead.`);if(!$(s,["string","array"]))throw new Qt(`Expected second argument to be of type array or string, but found ${B(Lt(s))} instead.`);return s.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class Ps{constructor(e,r,s){this.type=Se,this.needle=e,this.haystack=r,this.fromIndex=s}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const s=r.parse(e[1],1,qe),l=r.parse(e[2],2,qe);if(!s||!l)return null;if(!D(s.type,[Je,it,Se,Er,qe]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${B(s.type)} instead`);if(e.length===4){const u=r.parse(e[3],3,Se);return u?new Ps(s,l,u):null}return new Ps(s,l)}evaluate(e){const r=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(!$(r,["boolean","string","number","null"]))throw new Qt(`Expected first argument to be of type boolean, string, number or null, but found ${B(Lt(r))} instead.`);if(!$(s,["string","array"]))throw new Qt(`Expected second argument to be of type array or string, but found ${B(Lt(s))} instead.`);if(this.fromIndex){const l=this.fromIndex.evaluate(e);return s.indexOf(r,l)}return s.indexOf(r)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class ct{constructor(e,r,s,l,u,d){this.inputType=e,this.type=r,this.input=s,this.cases=l,this.outputs=u,this.otherwise=d}static parse(e,r){if(e.length<5)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return r.error("Expected an even number of arguments.");let s,l;r.expectedType&&r.expectedType.kind!=="value"&&(l=r.expectedType);const u={},d=[];for(let b=2;b<e.length-1;b+=2){let w=e[b];const E=e[b+1];Array.isArray(w)||(w=[w]);const C=r.concat(b);if(w.length===0)return C.error("Expected at least one branch label.");for(const L of w){if(typeof L!="number"&&typeof L!="string")return C.error("Branch labels must be numbers or strings.");if(typeof L=="number"&&Math.abs(L)>Number.MAX_SAFE_INTEGER)return C.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof L=="number"&&Math.floor(L)!==L)return C.error("Numeric branch labels must be integer values.");if(s){if(C.checkSubtype(s,Lt(L)))return null}else s=Lt(L);if(u[String(L)]!==void 0)return C.error("Branch labels must be unique.");u[String(L)]=d.length}const M=r.parse(E,b,l);if(!M)return null;l=l||M.type,d.push(M)}const f=r.parse(e[1],1,qe);if(!f)return null;const g=r.parse(e[e.length-1],e.length-1,l);return g?f.type.kind!=="value"&&r.concat(1).checkSubtype(s,f.type)?null:new ct(s,l,f,u,d,g):null}evaluate(e){const r=this.input.evaluate(e);return(Lt(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}}class Ma{constructor(e,r,s){this.type=e,this.branches=r,this.otherwise=s}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return r.error("Expected an odd number of arguments.");let s;r.expectedType&&r.expectedType.kind!=="value"&&(s=r.expectedType);const l=[];for(let d=1;d<e.length-1;d+=2){const f=r.parse(e[d],d,Je);if(!f)return null;const g=r.parse(e[d+1],d+1,s);if(!g)return null;l.push([f,g]),s=s||g.type}const u=r.parse(e[e.length-1],e.length-1,s);if(!u)return null;if(!s)throw new Error("Can't infer output type");return new Ma(s,l,u)}evaluate(e){for(const[r,s]of this.branches)if(r.evaluate(e))return s.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[r,s]of this.branches)e(r),e(s);e(this.otherwise)}outputDefined(){return this.branches.every(([e,r])=>r.outputDefined())&&this.otherwise.outputDefined()}}class Ms{constructor(e,r,s,l){this.type=e,this.input=r,this.beginIndex=s,this.endIndex=l}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const s=r.parse(e[1],1,qe),l=r.parse(e[2],2,Se);if(!s||!l)return null;if(!D(s.type,[si(qe),it,qe]))return r.error(`Expected first argument to be of type array or string, but found ${B(s.type)} instead`);if(e.length===4){const u=r.parse(e[3],3,Se);return u?new Ms(s.type,s,l,u):null}return new Ms(s.type,s,l)}evaluate(e){const r=this.input.evaluate(e),s=this.beginIndex.evaluate(e);if(!$(r,["string","array"]))throw new Qt(`Expected first argument to be of type array or string, but found ${B(Lt(r))} instead.`);if(this.endIndex){const l=this.endIndex.evaluate(e);return r.slice(s,l)}return r.slice(s)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function Vo(i,e){return i==="=="||i==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function $o(i,e,r,s){return s.compare(e,r)===0}function Sn(i,e,r){const s=i!=="=="&&i!=="!=";return class Gd{constructor(u,d,f){this.type=Je,this.lhs=u,this.rhs=d,this.collator=f,this.hasUntypedArgument=u.type.kind==="value"||d.type.kind==="value"}static parse(u,d){if(u.length!==3&&u.length!==4)return d.error("Expected two or three arguments.");const f=u[0];let g=d.parse(u[1],1,qe);if(!g)return null;if(!Vo(f,g.type))return d.concat(1).error(`"${f}" comparisons are not supported for type '${B(g.type)}'.`);let b=d.parse(u[2],2,qe);if(!b)return null;if(!Vo(f,b.type))return d.concat(2).error(`"${f}" comparisons are not supported for type '${B(b.type)}'.`);if(g.type.kind!==b.type.kind&&g.type.kind!=="value"&&b.type.kind!=="value")return d.error(`Cannot compare types '${B(g.type)}' and '${B(b.type)}'.`);s&&(g.type.kind==="value"&&b.type.kind!=="value"?g=new Ai(b.type,[g]):g.type.kind!=="value"&&b.type.kind==="value"&&(b=new Ai(g.type,[b])));let w=null;if(u.length===4){if(g.type.kind!=="string"&&b.type.kind!=="string"&&g.type.kind!=="value"&&b.type.kind!=="value")return d.error("Cannot use collator to compare non-string types.");if(w=d.parse(u[3],3,Ir),!w)return null}return new Gd(g,b,w)}evaluate(u){const d=this.lhs.evaluate(u),f=this.rhs.evaluate(u);if(s&&this.hasUntypedArgument){const g=Lt(d),b=Lt(f);if(g.kind!==b.kind||g.kind!=="string"&&g.kind!=="number")throw new Qt(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${g.kind}, ${b.kind}) instead.`)}if(this.collator&&!s&&this.hasUntypedArgument){const g=Lt(d),b=Lt(f);if(g.kind!=="string"||b.kind!=="string")return e(u,d,f)}return this.collator?r(u,d,f,this.collator.evaluate(u)):e(u,d,f)}eachChild(u){u(this.lhs),u(this.rhs),this.collator&&u(this.collator)}outputDefined(){return!0}}}const ec=Sn("==",function(i,e,r){return e===r},$o),tc=Sn("!=",function(i,e,r){return e!==r},function(i,e,r,s){return!$o(0,e,r,s)}),ic=Sn("<",function(i,e,r){return e<r},function(i,e,r,s){return s.compare(e,r)<0}),rc=Sn(">",function(i,e,r){return e>r},function(i,e,r,s){return s.compare(e,r)>0}),nc=Sn("<=",function(i,e,r){return e<=r},function(i,e,r,s){return s.compare(e,r)<=0}),sc=Sn(">=",function(i,e,r){return e>=r},function(i,e,r,s){return s.compare(e,r)>=0});class ka{constructor(e,r,s,l,u){this.type=it,this.number=e,this.locale=r,this.currency=s,this.minFractionDigits=l,this.maxFractionDigits=u}static parse(e,r){if(e.length!==3)return r.error("Expected two arguments.");const s=r.parse(e[1],1,Se);if(!s)return null;const l=e[2];if(typeof l!="object"||Array.isArray(l))return r.error("NumberFormat options argument must be an object.");let u=null;if(l.locale&&(u=r.parse(l.locale,1,it),!u))return null;let d=null;if(l.currency&&(d=r.parse(l.currency,1,it),!d))return null;let f=null;if(l["min-fraction-digits"]&&(f=r.parse(l["min-fraction-digits"],1,Se),!f))return null;let g=null;return l["max-fraction-digits"]&&(g=r.parse(l["max-fraction-digits"],1,Se),!g)?null:new ka(s,u,d,f,g)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class ks{constructor(e){this.type=Nr,this.sections=e}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");const s=e[1];if(!Array.isArray(s)&&typeof s=="object")return r.error("First argument must be an image or text section.");const l=[];let u=!1;for(let d=1;d<=e.length-1;++d){const f=e[d];if(u&&typeof f=="object"&&!Array.isArray(f)){u=!1;let g=null;if(f["font-scale"]&&(g=r.parse(f["font-scale"],1,Se),!g))return null;let b=null;if(f["text-font"]&&(b=r.parse(f["text-font"],1,si(it)),!b))return null;let w=null;if(f["text-color"]&&(w=r.parse(f["text-color"],1,Jt),!w))return null;const E=l[l.length-1];E.scale=g,E.font=b,E.textColor=w}else{const g=r.parse(e[d],1,qe);if(!g)return null;const b=g.type.kind;if(b!=="string"&&b!=="value"&&b!=="null"&&b!=="resolvedImage")return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");u=!0,l.push({content:g,scale:null,font:null,textColor:null})}}return new ks(l)}evaluate(e){return new Ri(this.sections.map(r=>{const s=r.content.evaluate(e);return Lt(s)===Vr?new ba("",s,null,null,null):new ba(Gn(s),null,r.scale?r.scale.evaluate(e):null,r.font?r.font.evaluate(e).join(","):null,r.textColor?r.textColor.evaluate(e):null)}))}eachChild(e){for(const r of this.sections)e(r.content),r.scale&&e(r.scale),r.font&&e(r.font),r.textColor&&e(r.textColor)}outputDefined(){return!1}}class za{constructor(e){this.type=Vr,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected two arguments.");const s=r.parse(e[1],1,it);return s?new za(s):r.error("No image name provided.")}evaluate(e){const r=this.input.evaluate(e),s=li.fromString(r);return s&&e.availableImages&&(s.available=e.availableImages.indexOf(r)>-1),s}eachChild(e){e(this.input)}outputDefined(){return!1}}class La{constructor(e){this.type=Se,this.input=e}static parse(e,r){if(e.length!==2)return r.error(`Expected 1 argument, but found ${e.length-1} instead.`);const s=r.parse(e[1],1);return s?s.type.kind!=="array"&&s.type.kind!=="string"&&s.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${B(s.type)} instead.`):new La(s):null}evaluate(e){const r=this.input.evaluate(e);if(typeof r=="string"||Array.isArray(r))return r.length;throw new Qt(`Expected value to be of type string or array, but found ${B(Lt(r))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const En={"==":ec,"!=":tc,">":rc,"<":ic,">=":sc,"<=":nc,array:Ai,at:Ca,boolean:Ai,case:Ma,coalesce:As,collator:Tn,format:ks,image:za,in:Pa,"index-of":Ps,interpolate:Bi,"interpolate-hcl":Bi,"interpolate-lab":Bi,length:La,let:Cs,literal:Qr,match:ct,number:Ai,"number-format":ka,object:Ai,slice:Ms,step:Hn,string:Ai,"to-boolean":$r,"to-color":$r,"to-number":$r,"to-string":$r,var:Ss,within:en};function jo(i,[e,r,s,l]){e=e.evaluate(i),r=r.evaluate(i),s=s.evaluate(i);const u=l?l.evaluate(i):1,d=Do(e,r,s,u);if(d)throw new Qt(d);return new lt(e/255,r/255,s/255,u,!1)}function Go(i,e){return i in e}function Da(i,e){const r=e[i];return r===void 0?null:r}function tn(i){return{type:i}}function qo(i){return{result:"success",value:i}}function In(i){return{result:"error",value:i}}function An(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function Zo(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function Ra(i){return!!i.expression&&i.expression.interpolated}function yt(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":i===null?"null":typeof i}function zs(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function ac(i){return i}function Xo(i,e){const r=e.type==="color",s=i.stops&&typeof i.stops[0][0]=="object",l=s||!(s||i.property!==void 0),u=i.type||(Ra(e)?"exponential":"interval");if(r||e.type==="padding"){const w=r?lt.parse:Ii.parse;(i=Si({},i)).stops&&(i.stops=i.stops.map(E=>[E[0],w(E[1])])),i.default=w(i.default?i.default:e.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,b;if(u==="exponential")f=Wo;else if(u==="interval")f=Ba;else if(u==="categorical"){f=oc,g=Object.create(null);for(const w of i.stops)g[w[0]]=w[1];b=typeof i.stops[0][0]}else{if(u!=="identity")throw new Error(`Unknown function type "${u}"`);f=lc}if(s){const w={},E=[];for(let L=0;L<i.stops.length;L++){const N=i.stops[L],O=N[0].zoom;w[O]===void 0&&(w[O]={zoom:O,type:i.type,property:i.property,default:i.default,stops:[]},E.push(O)),w[O].stops.push([N[0].value,N[1]])}const C=[];for(const L of E)C.push([w[L].zoom,Xo(w[L],e)]);const M={name:"linear"};return{kind:"composite",interpolationType:M,interpolationFactor:Bi.interpolationFactor.bind(void 0,M),zoomStops:C.map(L=>L[0]),evaluate:({zoom:L},N)=>Wo({stops:C,base:i.base},e,L).evaluate(L,N)}}if(l){const w=u==="exponential"?{name:"exponential",base:i.base!==void 0?i.base:1}:null;return{kind:"camera",interpolationType:w,interpolationFactor:Bi.interpolationFactor.bind(void 0,w),zoomStops:i.stops.map(E=>E[0]),evaluate:({zoom:E})=>f(i,e,E,g,b)}}return{kind:"source",evaluate(w,E){const C=E&&E.properties?E.properties[i.property]:void 0;return C===void 0?Jn(i.default,e.default):f(i,e,C,g,b)}}}function Jn(i,e,r){return i!==void 0?i:e!==void 0?e:r!==void 0?r:void 0}function oc(i,e,r,s,l){return Jn(typeof r===l?s[r]:void 0,i.default,e.default)}function Ba(i,e,r){if(yt(r)!=="number")return Jn(i.default,e.default);const s=i.stops.length;if(s===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[s-1][0])return i.stops[s-1][1];const l=Wn(i.stops.map(u=>u[0]),r);return i.stops[l][1]}function Wo(i,e,r){const s=i.base!==void 0?i.base:1;if(yt(r)!=="number")return Jn(i.default,e.default);const 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];const u=Wn(i.stops.map(w=>w[0]),r),d=function(w,E,C,M){const L=M-C,N=w-C;return L===0?0:E===1?N/L:(Math.pow(E,N)-1)/(Math.pow(E,L)-1)}(r,s,i.stops[u][0],i.stops[u+1][0]),f=i.stops[u][1],g=i.stops[u+1][1],b=Pi[e.type]||ac;return typeof f.evaluate=="function"?{evaluate(...w){const E=f.evaluate.apply(void 0,w),C=g.evaluate.apply(void 0,w);if(E!==void 0&&C!==void 0)return b(E,C,d,i.colorSpace)}}:b(f,g,d,i.colorSpace)}function lc(i,e,r){switch(e.type){case"color":r=lt.parse(r);break;case"formatted":r=Ri.fromString(r.toString());break;case"resolvedImage":r=li.fromString(r.toString());break;case"padding":r=Ii.parse(r);break;default:yt(r)===e.type||e.type==="enum"&&e.values[r]||(r=void 0)}return Jn(r,i.default,e.default)}Ci.register(En,{error:[{kind:"error"},[it],(i,[e])=>{throw new Qt(e.evaluate(i))}],typeof:[it,[qe],(i,[e])=>B(Lt(e.evaluate(i)))],"to-rgba":[si(Se,4),[Jt],(i,[e])=>{const[r,s,l,u]=e.evaluate(i).rgb;return[255*r,255*s,255*l,u]}],rgb:[Jt,[Se,Se,Se],jo],rgba:[Jt,[Se,Se,Se,Se],jo],has:{type:Je,overloads:[[[it],(i,[e])=>Go(e.evaluate(i),i.properties())],[[it,er],(i,[e,r])=>Go(e.evaluate(i),r.evaluate(i))]]},get:{type:qe,overloads:[[[it],(i,[e])=>Da(e.evaluate(i),i.properties())],[[it,er],(i,[e,r])=>Da(e.evaluate(i),r.evaluate(i))]]},"feature-state":[qe,[it],(i,[e])=>Da(e.evaluate(i),i.featureState||{})],properties:[er,[],i=>i.properties()],"geometry-type":[it,[],i=>i.geometryType()],id:[qe,[],i=>i.id()],zoom:[Se,[],i=>i.globals.zoom],"heatmap-density":[Se,[],i=>i.globals.heatmapDensity||0],"line-progress":[Se,[],i=>i.globals.lineProgress||0],accumulated:[qe,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[Se,tn(Se),(i,e)=>{let r=0;for(const s of e)r+=s.evaluate(i);return r}],"*":[Se,tn(Se),(i,e)=>{let r=1;for(const s of e)r*=s.evaluate(i);return r}],"-":{type:Se,overloads:[[[Se,Se],(i,[e,r])=>e.evaluate(i)-r.evaluate(i)],[[Se],(i,[e])=>-e.evaluate(i)]]},"/":[Se,[Se,Se],(i,[e,r])=>e.evaluate(i)/r.evaluate(i)],"%":[Se,[Se,Se],(i,[e,r])=>e.evaluate(i)%r.evaluate(i)],ln2:[Se,[],()=>Math.LN2],pi:[Se,[],()=>Math.PI],e:[Se,[],()=>Math.E],"^":[Se,[Se,Se],(i,[e,r])=>Math.pow(e.evaluate(i),r.evaluate(i))],sqrt:[Se,[Se],(i,[e])=>Math.sqrt(e.evaluate(i))],log10:[Se,[Se],(i,[e])=>Math.log(e.evaluate(i))/Math.LN10],ln:[Se,[Se],(i,[e])=>Math.log(e.evaluate(i))],log2:[Se,[Se],(i,[e])=>Math.log(e.evaluate(i))/Math.LN2],sin:[Se,[Se],(i,[e])=>Math.sin(e.evaluate(i))],cos:[Se,[Se],(i,[e])=>Math.cos(e.evaluate(i))],tan:[Se,[Se],(i,[e])=>Math.tan(e.evaluate(i))],asin:[Se,[Se],(i,[e])=>Math.asin(e.evaluate(i))],acos:[Se,[Se],(i,[e])=>Math.acos(e.evaluate(i))],atan:[Se,[Se],(i,[e])=>Math.atan(e.evaluate(i))],min:[Se,tn(Se),(i,e)=>Math.min(...e.map(r=>r.evaluate(i)))],max:[Se,tn(Se),(i,e)=>Math.max(...e.map(r=>r.evaluate(i)))],abs:[Se,[Se],(i,[e])=>Math.abs(e.evaluate(i))],round:[Se,[Se],(i,[e])=>{const r=e.evaluate(i);return r<0?-Math.round(-r):Math.round(r)}],floor:[Se,[Se],(i,[e])=>Math.floor(e.evaluate(i))],ceil:[Se,[Se],(i,[e])=>Math.ceil(e.evaluate(i))],"filter-==":[Je,[it,qe],(i,[e,r])=>i.properties()[e.value]===r.value],"filter-id-==":[Je,[qe],(i,[e])=>i.id()===e.value],"filter-type-==":[Je,[it],(i,[e])=>i.geometryType()===e.value],"filter-<":[Je,[it,qe],(i,[e,r])=>{const s=i.properties()[e.value],l=r.value;return typeof s==typeof l&&s<l}],"filter-id-<":[Je,[qe],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r<s}],"filter->":[Je,[it,qe],(i,[e,r])=>{const s=i.properties()[e.value],l=r.value;return typeof s==typeof l&&s>l}],"filter-id->":[Je,[qe],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r>s}],"filter-<=":[Je,[it,qe],(i,[e,r])=>{const s=i.properties()[e.value],l=r.value;return typeof s==typeof l&&s<=l}],"filter-id-<=":[Je,[qe],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r<=s}],"filter->=":[Je,[it,qe],(i,[e,r])=>{const s=i.properties()[e.value],l=r.value;return typeof s==typeof l&&s>=l}],"filter-id->=":[Je,[qe],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r>=s}],"filter-has":[Je,[qe],(i,[e])=>e.value in i.properties()],"filter-has-id":[Je,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[Je,[si(it)],(i,[e])=>e.value.indexOf(i.geometryType())>=0],"filter-id-in":[Je,[si(qe)],(i,[e])=>e.value.indexOf(i.id())>=0],"filter-in-small":[Je,[it,si(qe)],(i,[e,r])=>r.value.indexOf(i.properties()[e.value])>=0],"filter-in-large":[Je,[it,si(qe)],(i,[e,r])=>function(s,l,u,d){for(;u<=d;){const f=u+d>>1;if(l[f]===s)return!0;l[f]>s?d=f-1:u=f+1}return!1}(i.properties()[e.value],r.value,0,r.value.length-1)],all:{type:Je,overloads:[[[Je,Je],(i,[e,r])=>e.evaluate(i)&&r.evaluate(i)],[tn(Je),(i,e)=>{for(const r of e)if(!r.evaluate(i))return!1;return!0}]]},any:{type:Je,overloads:[[[Je,Je],(i,[e,r])=>e.evaluate(i)||r.evaluate(i)],[tn(Je),(i,e)=>{for(const r of e)if(r.evaluate(i))return!0;return!1}]]},"!":[Je,[Je],(i,[e])=>!e.evaluate(i)],"is-supported-script":[Je,[it],(i,[e])=>{const r=i.globals&&i.globals.isSupportedScript;return!r||r(e.evaluate(i))}],upcase:[it,[it],(i,[e])=>e.evaluate(i).toUpperCase()],downcase:[it,[it],(i,[e])=>e.evaluate(i).toLowerCase()],concat:[it,tn(qe),(i,e)=>e.map(r=>Gn(r.evaluate(i))).join("")],"resolved-locale":[it,[Ir],(i,[e])=>e.evaluate(i).resolvedLocale()]});class Fa{constructor(e,r){var s;this.expression=e,this._warningHistory={},this._evaluator=new tr,this._defaultValue=r?(s=r).type==="color"&&zs(s.default)?new lt(0,0,0,0):s.type==="color"?lt.parse(s.default)||null:s.type==="padding"?Ii.parse(s.default)||null:s.default===void 0?null:s.default:null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(e,r,s,l,u,d){return this._evaluator.globals=e,this._evaluator.feature=r,this._evaluator.featureState=s,this._evaluator.canonical=l,this._evaluator.availableImages=u||null,this._evaluator.formattedSection=d,this.expression.evaluate(this._evaluator)}evaluate(e,r,s,l,u,d){this._evaluator.globals=e,this._evaluator.feature=r||null,this._evaluator.featureState=s||null,this._evaluator.canonical=l,this._evaluator.availableImages=u||null,this._evaluator.formattedSection=d||null;try{const 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 Qt(`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 Ls(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in En}function Dt(i,e){const r=new wn(En,Es,[],e?function(l){const u={color:Jt,string:it,number:Se,enum:it,boolean:Je,formatted:Nr,padding:bn,resolvedImage:Vr};return l.type==="array"?si(u[l.value]||qe,l.length):u[l.type]}(e):void 0),s=r.parse(i,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return s?qo(new Fa(s,e)):In(r.errors)}class Oa{constructor(e,r){this.kind=e,this._styleExpression=r,this.isStateDependent=e!=="constant"&&!Zn(r.expression)}evaluateWithoutErrorHandling(e,r,s,l,u,d){return this._styleExpression.evaluateWithoutErrorHandling(e,r,s,l,u,d)}evaluate(e,r,s,l,u,d){return this._styleExpression.evaluate(e,r,s,l,u,d)}}class at{constructor(e,r,s,l){this.kind=e,this.zoomStops=s,this._styleExpression=r,this.isStateDependent=e!=="camera"&&!Zn(r.expression),this.interpolationType=l}evaluateWithoutErrorHandling(e,r,s,l,u,d){return this._styleExpression.evaluateWithoutErrorHandling(e,r,s,l,u,d)}evaluate(e,r,s,l,u,d){return this._styleExpression.evaluate(e,r,s,l,u,d)}interpolationFactor(e,r,s){return this.interpolationType?Bi.interpolationFactor(this.interpolationType,e,r,s):0}}function Ds(i,e){const r=Dt(i,e);if(r.result==="error")return r;const s=r.value.expression,l=Is(s);if(!l&&!An(e))return In([new Ei("","data expressions not supported")]);const u=Xn(s,["zoom"]);if(!u&&!Zo(e))return In([new Ei("","zoom expressions not supported")]);const d=wt(s);return d||u?d instanceof Ei?In([d]):d instanceof Bi&&!Ra(e)?In([new Ei("",'"interpolate" expressions cannot be used with this property')]):qo(d?new at(l?"camera":"composite",r.value,d.labels,d instanceof Bi?d.interpolation:void 0):new Oa(l?"constant":"source",r.value)):In([new Ei("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Tt{constructor(e,r){this._parameters=e,this._specification=r,Si(this,Xo(this._parameters,this._specification))}static deserialize(e){return new Tt(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function wt(i){let e=null;if(i instanceof Cs)e=wt(i.result);else if(i instanceof As){for(const r of i.args)if(e=wt(r),e)break}else(i instanceof Hn||i instanceof Bi)&&i.input instanceof Ci&&i.input.name==="zoom"&&(e=i);return e instanceof Ei||i.eachChild(r=>{const s=wt(r);s instanceof Ei?e=s:!e&&s?e=new Ei("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&s&&e!==s&&(e=new Ei("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function Cn(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(const e of i.slice(1))if(!Cn(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const Ho={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Ua(i){if(i==null)return{filter:()=>!0,needGeometry:!1};Cn(i)||(i=Rs(i));const e=Dt(i,Ho);if(e.result==="error")throw new Error(e.value.map(r=>`${r.key}: ${r.message}`).join(", "));return{filter:(r,s,l)=>e.value.evaluate(r,s,{},l),needGeometry:Ko(i)}}function cc(i,e){return i<e?-1:i>e?1:0}function Ko(i){if(!Array.isArray(i))return!1;if(i[0]==="within")return!0;for(let e=1;e<i.length;e++)if(Ko(i[e]))return!0;return!1}function Rs(i){if(!i)return!0;const e=i[0];return i.length<=1?e!=="any":e==="=="?Bs(i[1],i[2],"=="):e==="!="?Qn(Bs(i[1],i[2],"==")):e==="<"||e===">"||e==="<="||e===">="?Bs(i[1],i[2],e):e==="any"?(r=i.slice(1),["any"].concat(r.map(Rs))):e==="all"?["all"].concat(i.slice(1).map(Rs)):e==="none"?["all"].concat(i.slice(1).map(Rs).map(Qn)):e==="in"?Na(i[1],i.slice(2)):e==="!in"?Qn(Na(i[1],i.slice(2))):e==="has"?Va(i[1]):e==="!has"?Qn(Va(i[1])):e!=="within"||i;var r}function Bs(i,e,r){switch(i){case"$type":return[`filter-type-${r}`,e];case"$id":return[`filter-id-${r}`,e];default:return[`filter-${r}`,i,e]}}function Na(i,e){if(e.length===0)return!1;switch(i){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(r=>typeof r!=typeof e[0])?["filter-in-large",i,["literal",e.sort(cc)]]:["filter-in-small",i,["literal",e]]}}function Va(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function Qn(i){return["!",i]}function es(i){const e=typeof i;if(e==="number"||e==="boolean"||e==="string"||i==null)return JSON.stringify(i);if(Array.isArray(i)){let l="[";for(const u of i)l+=`${es(u)},`;return`${l}]`}const r=Object.keys(i).sort();let s="{";for(let l=0;l<r.length;l++)s+=`${JSON.stringify(r[l])}:${es(i[r[l]])},`;return`${s}}`}function hc(i){let e="";for(const r of Kr)e+=`/${es(i[r])}`;return e}function Yo(i){const e=i.value;return e?[new Ie(i.key,e,"constants have been deprecated as of v8")]:[]}function Nt(i){return i instanceof Number||i instanceof String||i instanceof Boolean?i.valueOf():i}function rn(i){if(Array.isArray(i))return i.map(rn);if(i instanceof Object&&!(i instanceof Number||i instanceof String||i instanceof Boolean)){const e={};for(const r in i)e[r]=rn(i[r]);return e}return Nt(i)}function Wi(i){const e=i.key,r=i.value,s=i.valueSpec||{},l=i.objectElementValidators||{},u=i.style,d=i.styleSpec,f=i.validateSpec;let g=[];const b=yt(r);if(b!=="object")return[new Ie(e,r,`object expected, ${b} found`)];for(const w in r){const E=w.split(".")[0],C=s[E]||s["*"];let M;if(l[E])M=l[E];else if(s[E])M=f;else if(l["*"])M=l["*"];else{if(!s["*"]){g.push(new Ie(e,r[w],`unknown property "${w}"`));continue}M=f}g=g.concat(M({key:(e&&`${e}.`)+w,value:r[w],valueSpec:C,style:u,styleSpec:d,object:r,objectKey:w,validateSpec:f},r))}for(const w in s)l[w]||s[w].required&&s[w].default===void 0&&r[w]===void 0&&g.push(new Ie(e,r,`missing required property "${w}"`));return g}function Jo(i){const e=i.value,r=i.valueSpec,s=i.style,l=i.styleSpec,u=i.key,d=i.arrayElementValidator||i.validateSpec;if(yt(e)!=="array")return[new Ie(u,e,`array expected, ${yt(e)} found`)];if(r.length&&e.length!==r.length)return[new Ie(u,e,`array length ${r.length} expected, length ${e.length} found`)];if(r["min-length"]&&e.length<r["min-length"])return[new Ie(u,e,`array length at least ${r["min-length"]} expected, length ${e.length} found`)];let f={type:r.value,values:r.values};l.$version<7&&(f.function=r.function),yt(r.value)==="object"&&(f=r.value);let g=[];for(let b=0;b<e.length;b++)g=g.concat(d({array:e,arrayIndex:b,value:e[b],valueSpec:f,validateSpec:i.validateSpec,style:s,styleSpec:l,key:`${u}[${b}]`}));return g}function $a(i){const e=i.key,r=i.value,s=i.valueSpec;let l=yt(r);return l==="number"&&r!=r&&(l="NaN"),l!=="number"?[new Ie(e,r,`number expected, ${l} found`)]:"minimum"in s&&r<s.minimum?[new Ie(e,r,`${r} is less than the minimum value ${s.minimum}`)]:"maximum"in s&&r>s.maximum?[new Ie(e,r,`${r} is greater than the maximum value ${s.maximum}`)]:[]}function Qo(i){const e=i.valueSpec,r=Nt(i.value.type);let s,l,u,d={};const f=r!=="categorical"&&i.value.property===void 0,g=!f,b=yt(i.value.stops)==="array"&&yt(i.value.stops[0])==="array"&&yt(i.value.stops[0][0])==="object",w=Wi({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 Ie(M.key,M.value,'identity function may not have a "stops" property')];let L=[];const N=M.value;return L=L.concat(Jo({key:M.key,value:N,valueSpec:M.valueSpec,validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec,arrayElementValidator:E})),yt(N)==="array"&&N.length===0&&L.push(new Ie(M.key,N,"array must have at least one stop")),L},default:function(M){return M.validateSpec({key:M.key,value:M.value,valueSpec:e,validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec})}}});return r==="identity"&&f&&w.push(new Ie(i.key,i.value,'missing required property "property"')),r==="identity"||i.value.stops||w.push(new Ie(i.key,i.value,'missing required property "stops"')),r==="exponential"&&i.valueSpec.expression&&!Ra(i.valueSpec)&&w.push(new Ie(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(g&&!An(i.valueSpec)?w.push(new Ie(i.key,i.value,"property functions not supported")):f&&!Zo(i.valueSpec)&&w.push(new Ie(i.key,i.value,"zoom functions not supported"))),r!=="categorical"&&!b||i.value.property!==void 0||w.push(new Ie(i.key,i.value,'"property" property is required')),w;function E(M){let L=[];const N=M.value,O=M.key;if(yt(N)!=="array")return[new Ie(O,N,`array expected, ${yt(N)} found`)];if(N.length!==2)return[new Ie(O,N,`array length 2 expected, length ${N.length} found`)];if(b){if(yt(N[0])!=="object")return[new Ie(O,N,`object expected, ${yt(N[0])} found`)];if(N[0].zoom===void 0)return[new Ie(O,N,"object stop key must have zoom")];if(N[0].value===void 0)return[new Ie(O,N,"object stop key must have value")];if(u&&u>Nt(N[0].zoom))return[new Ie(O,N[0].zoom,"stop zoom values must appear in ascending order")];Nt(N[0].zoom)!==u&&(u=Nt(N[0].zoom),l=void 0,d={}),L=L.concat(Wi({key:`${O}[0]`,value:N[0],valueSpec:{zoom:{}},validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec,objectElementValidators:{zoom:$a,value:C}}))}else L=L.concat(C({key:`${O}[0]`,value:N[0],valueSpec:{},validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec},N));return Ls(rn(N[1]))?L.concat([new Ie(`${O}[1]`,N[1],"expressions are not allowed in function stops.")]):L.concat(M.validateSpec({key:`${O}[1]`,value:N[1],valueSpec:e,validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec}))}function C(M,L){const N=yt(M.value),O=Nt(M.value),W=M.value!==null?M.value:L;if(s){if(N!==s)return[new Ie(M.key,W,`${N} stop domain type must match previous stop domain type ${s}`)]}else s=N;if(N!=="number"&&N!=="string"&&N!=="boolean")return[new Ie(M.key,W,"stop domain value must be a number, string, or boolean")];if(N!=="number"&&r!=="categorical"){let ee=`number expected, ${N} found`;return An(e)&&r===void 0&&(ee+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Ie(M.key,W,ee)]}return r!=="categorical"||N!=="number"||isFinite(O)&&Math.floor(O)===O?r!=="categorical"&&N==="number"&&l!==void 0&&O<l?[new Ie(M.key,W,"stop domain values must appear in ascending order")]:(l=O,r==="categorical"&&O in d?[new Ie(M.key,W,"stop domain values must be unique")]:(d[O]=!0,[])):[new Ie(M.key,W,`integer expected, found ${O}`)]}}function nn(i){const e=(i.expressionContext==="property"?Ds:Dt)(rn(i.value),i.valueSpec);if(e.result==="error")return e.value.map(s=>new Ie(`${i.key}${s.key}`,i.value,s.message));const r=e.value.expression||e.value._styleExpression.expression;if(i.expressionContext==="property"&&i.propertyKey==="text-font"&&!r.outputDefined())return[new Ie(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"&&!Zn(r))return[new Ie(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if(i.expressionContext==="filter"&&!Zn(r))return[new Ie(i.key,i.value,'"feature-state" data expressions are not supported with filters.')];if(i.expressionContext&&i.expressionContext.indexOf("cluster")===0){if(!Xn(r,["zoom","feature-state"]))return[new Ie(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(i.expressionContext==="cluster-initial"&&!Is(r))return[new Ie(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function ts(i){const e=i.key,r=i.value,s=i.valueSpec,l=[];return Array.isArray(s.values)?s.values.indexOf(Nt(r))===-1&&l.push(new Ie(e,r,`expected one of [${s.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(s.values).indexOf(Nt(r))===-1&&l.push(new Ie(e,r,`expected one of [${Object.keys(s.values).join(", ")}], ${JSON.stringify(r)} found`)),l}function Pn(i){return Cn(rn(i.value))?nn(Si({},i,{expressionContext:"filter",valueSpec:{value:"boolean"}})):el(i)}function el(i){const e=i.value,r=i.key;if(yt(e)!=="array")return[new Ie(r,e,`array expected, ${yt(e)} found`)];const s=i.styleSpec;let l,u=[];if(e.length<1)return[new Ie(r,e,"filter array must have at least 1 element")];switch(u=u.concat(ts({key:`${r}[0]`,value:e[0],valueSpec:s.filter_operator,style:i.style,styleSpec:i.styleSpec})),Nt(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&Nt(e[1])==="$type"&&u.push(new Ie(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&u.push(new Ie(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(l=yt(e[1]),l!=="string"&&u.push(new Ie(`${r}[1]`,e[1],`string expected, ${l} found`)));for(let d=2;d<e.length;d++)l=yt(e[d]),Nt(e[1])==="$type"?u=u.concat(ts({key:`${r}[${d}]`,value:e[d],valueSpec:s.geometry_type,style:i.style,styleSpec:i.styleSpec})):l!=="string"&&l!=="number"&&l!=="boolean"&&u.push(new Ie(`${r}[${d}]`,e[d],`string, number, or boolean expected, ${l} found`));break;case"any":case"all":case"none":for(let d=1;d<e.length;d++)u=u.concat(el({key:`${r}[${d}]`,value:e[d],style:i.style,styleSpec:i.styleSpec}));break;case"has":case"!has":l=yt(e[1]),e.length!==2?u.push(new Ie(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):l!=="string"&&u.push(new Ie(`${r}[1]`,e[1],`string expected, ${l} found`));break;case"within":l=yt(e[1]),e.length!==2?u.push(new Ie(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):l!=="object"&&u.push(new Ie(`${r}[1]`,e[1],`object expected, ${l} found`))}return u}function ja(i,e){const r=i.key,s=i.validateSpec,l=i.style,u=i.styleSpec,d=i.value,f=i.objectKey,g=u[`${e}_${i.layerType}`];if(!g)return[];const b=f.match(/^(.*)-transition$/);if(e==="paint"&&b&&g[b[1]]&&g[b[1]].transition)return s({key:r,value:d,valueSpec:u.transition,style:l,styleSpec:u});const w=i.valueSpec||g[f];if(!w)return[new Ie(r,d,`unknown property "${f}"`)];let E;if(yt(d)==="string"&&An(w)&&!w.tokens&&(E=/^{([^}]+)}$/.exec(d)))return[new Ie(r,d,`"${f}" does not support interpolation syntax
2
- Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(E[1])} }\`.`)];const C=[];return i.layerType==="symbol"&&(f==="text-field"&&l&&!l.glyphs&&C.push(new Ie(r,d,'use of "text-field" requires a style "glyphs" property')),f==="text-font"&&zs(rn(d))&&Nt(d.type)==="identity"&&C.push(new Ie(r,d,'"text-font" does not support identity functions'))),C.concat(s({key:i.key,value:d,valueSpec:w,style:l,styleSpec:u,expressionContext:"property",propertyType:e,propertyKey:f}))}function Ga(i){return ja(i,"paint")}function tl(i){return ja(i,"layout")}function Fs(i){let e=[];const r=i.value,s=i.key,l=i.style,u=i.styleSpec;r.type||r.ref||e.push(new Ie(s,r,'either "type" or "ref" is required'));let d=Nt(r.type);const f=Nt(r.ref);if(r.id){const g=Nt(r.id);for(let b=0;b<i.arrayIndex;b++){const w=l.layers[b];Nt(w.id)===g&&e.push(new Ie(s,r.id,`duplicate layer id "${r.id}", previously used at line ${w.id.__line__}`))}}if("ref"in r){let g;["type","source","source-layer","filter","layout"].forEach(b=>{b in r&&e.push(new Ie(s,r[b],`"${b}" is prohibited for ref layers`))}),l.layers.forEach(b=>{Nt(b.id)===f&&(g=b)}),g?g.ref?e.push(new Ie(s,r.ref,"ref cannot reference another ref layer")):d=Nt(g.type):e.push(new Ie(s,r.ref,`ref layer "${f}" not found`))}else if(d!=="background")if(r.source){const g=l.sources&&l.sources[r.source],b=g&&Nt(g.type);g?b==="vector"&&d==="raster"?e.push(new Ie(s,r.source,`layer "${r.id}" requires a raster source`)):b==="raster"&&d!=="raster"?e.push(new Ie(s,r.source,`layer "${r.id}" requires a vector source`)):b!=="vector"||r["source-layer"]?b==="raster-dem"&&d!=="hillshade"?e.push(new Ie(s,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):d!=="line"||!r.paint||!r.paint["line-gradient"]||b==="geojson"&&g.lineMetrics||e.push(new Ie(s,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new Ie(s,r,`layer "${r.id}" must specify a "source-layer"`)):e.push(new Ie(s,r.source,`source "${r.source}" not found`))}else e.push(new Ie(s,r,'missing required property "source"'));return e=e.concat(Wi({key:s,value:r,valueSpec:u.layer,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,objectElementValidators:{"*":()=>[],type:()=>i.validateSpec({key:`${s}.type`,value:r.type,valueSpec:u.layer.type,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,object:r,objectKey:"type"}),filter:Pn,layout:g=>Wi({layer:r,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,validateSpec:g.validateSpec,objectElementValidators:{"*":b=>tl(Si({layerType:d},b))}}),paint:g=>Wi({layer:r,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,validateSpec:g.validateSpec,objectElementValidators:{"*":b=>Ga(Si({layerType:d},b))}})}})),e}function pr(i){const e=i.value,r=i.key,s=yt(e);return s!=="string"?[new Ie(r,e,`string expected, ${s} found`)]:[]}const Os={promoteId:function({key:i,value:e}){if(yt(e)==="string")return pr({key:i,value:e});{const r=[];for(const s in e)r.push(...pr({key:`${i}.${s}`,value:e[s]}));return r}}};function Us(i){const e=i.value,r=i.key,s=i.styleSpec,l=i.style,u=i.validateSpec;if(!e.type)return[new Ie(r,e,'"type" is required')];const d=Nt(e.type);let f;switch(d){case"vector":case"raster":case"raster-dem":return f=Wi({key:r,value:e,valueSpec:s[`source_${d.replace("-","_")}`],style:i.style,styleSpec:s,objectElementValidators:Os,validateSpec:u}),f;case"geojson":if(f=Wi({key:r,value:e,valueSpec:s.source_geojson,style:l,styleSpec:s,validateSpec:u,objectElementValidators:Os}),e.cluster)for(const g in e.clusterProperties){const[b,w]=e.clusterProperties[g],E=typeof b=="string"?[b,["accumulated"],["get",g]]:b;f.push(...nn({key:`${r}.${g}.map`,value:w,validateSpec:u,expressionContext:"cluster-map"})),f.push(...nn({key:`${r}.${g}.reduce`,value:E,validateSpec:u,expressionContext:"cluster-reduce"}))}return f;case"video":return Wi({key:r,value:e,valueSpec:s.source_video,style:l,validateSpec:u,styleSpec:s});case"image":return Wi({key:r,value:e,valueSpec:s.source_image,style:l,validateSpec:u,styleSpec:s});case"canvas":return[new Ie(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return ts({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:l,validateSpec:u,styleSpec:s})}}function il(i){const e=i.value,r=i.styleSpec,s=r.light,l=i.style;let u=[];const d=yt(e);if(e===void 0)return u;if(d!=="object")return u=u.concat([new Ie("light",e,`object expected, ${d} found`)]),u;for(const f in e){const g=f.match(/^(.*)-transition$/);u=u.concat(g&&s[g[1]]&&s[g[1]].transition?i.validateSpec({key:f,value:e[f],valueSpec:r.transition,validateSpec:i.validateSpec,style:l,styleSpec:r}):s[f]?i.validateSpec({key:f,value:e[f],valueSpec:s[f],validateSpec:i.validateSpec,style:l,styleSpec:r}):[new Ie(f,e[f],`unknown property "${f}"`)])}return u}function is(i){const e=i.value,r=i.styleSpec,s=r.terrain,l=i.style;let u=[];const d=yt(e);if(e===void 0)return u;if(d!=="object")return u=u.concat([new Ie("terrain",e,`object expected, ${d} found`)]),u;for(const f in e)u=u.concat(s[f]?i.validateSpec({key:f,value:e[f],valueSpec:s[f],validateSpec:i.validateSpec,style:l,styleSpec:r}):[new Ie(f,e[f],`unknown property "${f}"`)]);return u}function rl(i){let e=[];const r=i.value,s=i.key;if(Array.isArray(r)){const l=[],u=[];for(const d in r)r[d].id&&l.includes(r[d].id)&&e.push(new Ie(s,r,`all the sprites' ids must be unique, but ${r[d].id} is duplicated`)),l.push(r[d].id),r[d].url&&u.includes(r[d].url)&&e.push(new Ie(s,r,`all the sprites' URLs must be unique, but ${r[d].url} is duplicated`)),u.push(r[d].url),e=e.concat(Wi({key:`${s}[${d}]`,value:r[d],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:i.validateSpec}));return e}return pr({key:s,value:r})}const nl={"*":()=>[],array:Jo,boolean:function(i){const e=i.value,r=i.key,s=yt(e);return s!=="boolean"?[new Ie(r,e,`boolean expected, ${s} found`)]:[]},number:$a,color:function(i){const e=i.key,r=i.value,s=yt(r);return s!=="string"?[new Ie(e,r,`color expected, ${s} found`)]:lt.parse(String(r))?[]:[new Ie(e,r,`color expected, "${r}" found`)]},constants:Yo,enum:ts,filter:Pn,function:Qo,layer:Fs,object:Wi,source:Us,light:il,terrain:is,string:pr,formatted:function(i){return pr(i).length===0?[]:nn(i)},resolvedImage:function(i){return pr(i).length===0?[]:nn(i)},padding:function(i){const e=i.key,r=i.value;if(yt(r)==="array"){if(r.length<1||r.length>4)return[new Ie(e,r,`padding requires 1 to 4 values; ${r.length} values found`)];const s={type:"number"};let l=[];for(let u=0;u<r.length;u++)l=l.concat(i.validateSpec({key:`${e}[${u}]`,value:r[u],validateSpec:i.validateSpec,valueSpec:s}));return l}return $a({key:e,value:r,valueSpec:{}})},sprite:rl};function rs(i){const e=i.value,r=i.valueSpec,s=i.styleSpec;return i.validateSpec=rs,r.expression&&zs(Nt(e))?Qo(i):r.expression&&Ls(rn(e))?nn(i):r.type&&nl[r.type]?nl[r.type](i):Wi(Si({},i,{valueSpec:r.type?s[r.type]:r}))}function sl(i){const e=i.value,r=i.key,s=pr(i);return s.length||(e.indexOf("{fontstack}")===-1&&s.push(new Ie(r,e,'"glyphs" url must include a "{fontstack}" token')),e.indexOf("{range}")===-1&&s.push(new Ie(r,e,'"glyphs" url must include a "{range}" token'))),s}function fr(i,e=oe){let r=[];return r=r.concat(rs({key:"",value:i,valueSpec:e.$root,styleSpec:e,style:i,validateSpec:rs,objectElementValidators:{glyphs:sl,"*":()=>[]}})),i.constants&&(r=r.concat(Yo({key:"constants",value:i.constants,style:i,styleSpec:e,validateSpec:rs}))),ns(r)}function Hi(i){return function(e){return i({...e,validateSpec:rs})}}function ns(i){return[].concat(i).sort((e,r)=>e.line-r.line)}function qt(i){return function(...e){return ns(i.apply(this,e))}}fr.source=qt(Hi(Us)),fr.sprite=qt(Hi(rl)),fr.glyphs=qt(Hi(sl)),fr.light=qt(Hi(il)),fr.terrain=qt(Hi(is)),fr.layer=qt(Hi(Fs)),fr.filter=qt(Hi(Pn)),fr.paintProperty=qt(Hi(Ga)),fr.layoutProperty=qt(Hi(tl));const jr=fr,uc=jr.light,dc=jr.paintProperty,pc=jr.layoutProperty;function Mn(i,e){let r=!1;if(e&&e.length)for(const s of e)i.fire(new ur(new Error(s.message))),r=!0;return r}class ss{constructor(e,r,s){const l=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const d=new Int32Array(this.arrayBuffer);e=d[0],this.d=(r=d[1])+2*(s=d[2]);for(let g=0;g<this.d*this.d;g++){const b=d[3+g],w=d[3+g+1];l.push(b===w?null:d.subarray(b,w))}const 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*s;for(let d=0;d<this.d*this.d;d++)l.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=e,this.padding=s,this.scale=r/e,this.uid=0;const u=s/r*e;this.min=-u,this.max=e+u}insert(e,r,s,l,u){this._forEachCell(r,s,l,u,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(r),this.bboxes.push(s),this.bboxes.push(l),this.bboxes.push(u)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,r,s,l,u,d){this.cells[u].push(d)}query(e,r,s,l,u){const d=this.min,f=this.max;if(e<=d&&r<=d&&f<=s&&f<=l&&!u)return Array.prototype.slice.call(this.keys);{const g=[];return this._forEachCell(e,r,s,l,this._queryCell,g,{},u),g}}_queryCell(e,r,s,l,u,d,f,g){const b=this.cells[u];if(b!==null){const w=this.keys,E=this.bboxes;for(let C=0;C<b.length;C++){const M=b[C];if(f[M]===void 0){const L=4*M;(g?g(E[L+0],E[L+1],E[L+2],E[L+3]):e<=E[L+2]&&r<=E[L+3]&&s>=E[L+0]&&l>=E[L+1])?(f[M]=!0,d.push(w[M])):f[M]=!1}}}}_forEachCell(e,r,s,l,u,d,f,g){const b=this._convertToCellCoord(e),w=this._convertToCellCoord(r),E=this._convertToCellCoord(s),C=this._convertToCellCoord(l);for(let M=b;M<=E;M++)for(let L=w;L<=C;L++){const N=this.d*L+M;if((!g||g(this._convertFromCellCoord(M),this._convertFromCellCoord(L),this._convertFromCellCoord(M+1),this._convertFromCellCoord(L+1)))&&u.call(this,e,r,s,l,N,d,f,g))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const e=this.cells,r=3+this.cells.length+1+1;let s=0;for(let d=0;d<this.cells.length;d++)s+=this.cells[d].length;const l=new Int32Array(r+s+this.keys.length+this.bboxes.length);l[0]=this.extent,l[1]=this.n,l[2]=this.padding;let u=r;for(let d=0;d<e.length;d++){const f=e[d];l[3+d]=u,l.set(f,u),u+=f.length}return l[3+e.length]=u,l.set(this.keys,u),u+=this.keys.length,l[3+e.length+1]=u,l.set(this.bboxes,u),u+=this.bboxes.length,l.buffer}static serialize(e,r){const s=e.toArrayBuffer();return r&&r.push(s),{buffer:s}}static deserialize(e){return new ss(e.buffer)}}const mr={};function De(i,e,r={}){if(mr[i])throw new Error(`${i} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:i,writeable:!1}),mr[i]={klass:e,omit:r.omit||[],shallow:r.shallow||[]}}De("Object",Object),De("TransferableGridIndex",ss),De("Color",lt),De("Error",Error),De("AJAXError",Br),De("ResolvedImage",li),De("StylePropertyFunction",Tt),De("StyleExpression",Fa,{omit:["_evaluator"]}),De("ZoomDependentExpression",at),De("ZoomConstantExpression",Oa),De("CompoundExpression",Ci,{omit:["_evaluate"]});for(const i in En)En[i]._classRegistryKey||De(`Expression_${i}`,En[i]);function Ns(i){return i&&typeof ArrayBuffer<"u"&&(i instanceof ArrayBuffer||i.constructor&&i.constructor.name==="ArrayBuffer")}function as(i,e){if(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)return i;if(Ns(i)||Wr(i))return e&&e.push(i),i;if(ArrayBuffer.isView(i)){const r=i;return e&&e.push(r.buffer),r}if(i instanceof ImageData)return e&&e.push(i.data.buffer),i;if(Array.isArray(i)){const r=[];for(const s of i)r.push(as(s,e));return r}if(typeof i=="object"){const r=i.constructor,s=r._classRegistryKey;if(!s)throw new Error("can't serialize object of unregistered class");if(!mr[s])throw new Error(`${s} is not registered.`);const l=r.serialize?r.serialize(i,e):{};if(r.serialize){if(e&&l===e[e.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const u in i){if(!i.hasOwnProperty(u)||mr[s].omit.indexOf(u)>=0)continue;const d=i[u];l[u]=mr[s].shallow.indexOf(u)>=0?d:as(d,e)}i instanceof Error&&(l.message=i.message)}if(l.$name)throw new Error("$name property is reserved for worker serialization logic.");return s!=="Object"&&(l.$name=s),l}throw new Error("can't serialize object of type "+typeof i)}function Ar(i){if(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||Ns(i)||Wr(i)||ArrayBuffer.isView(i)||i instanceof ImageData)return i;if(Array.isArray(i))return i.map(Ar);if(typeof i=="object"){const e=i.$name||"Object";if(!mr[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:r}=mr[e];if(!r)throw new Error(`can't deserialize unregistered class ${e}`);if(r.deserialize)return r.deserialize(i);const s=Object.create(r.prototype);for(const l of Object.keys(i)){if(l==="$name")continue;const u=i[l];s[l]=mr[e].shallow.indexOf(l)>=0?u:Ar(u)}return s}throw new Error("can't deserialize object of type "+typeof i)}class al{constructor(){this.first=!0}update(e,r){const s=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=s,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=s,!0):(this.lastFloorZoom>s?(this.lastIntegerZoom=s+1,this.lastIntegerZoomTime=r):this.lastFloorZoom<s&&(this.lastIntegerZoom=s,this.lastIntegerZoomTime=r),e!==this.lastZoom&&(this.lastZoom=e,this.lastFloorZoom=s,!0))}}const Ce={"Latin-1 Supplement":i=>i>=128&&i<=255,Arabic:i=>i>=1536&&i<=1791,"Arabic Supplement":i=>i>=1872&&i<=1919,"Arabic Extended-A":i=>i>=2208&&i<=2303,"Hangul Jamo":i=>i>=4352&&i<=4607,"Unified Canadian Aboriginal Syllabics":i=>i>=5120&&i<=5759,Khmer:i=>i>=6016&&i<=6143,"Unified Canadian Aboriginal Syllabics Extended":i=>i>=6320&&i<=6399,"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,"CJK Radicals Supplement":i=>i>=11904&&i<=12031,"Kangxi Radicals":i=>i>=12032&&i<=12255,"Ideographic Description Characters":i=>i>=12272&&i<=12287,"CJK Symbols and Punctuation":i=>i>=12288&&i<=12351,Hiragana:i=>i>=12352&&i<=12447,Katakana:i=>i>=12448&&i<=12543,Bopomofo:i=>i>=12544&&i<=12591,"Hangul Compatibility Jamo":i=>i>=12592&&i<=12687,Kanbun:i=>i>=12688&&i<=12703,"Bopomofo Extended":i=>i>=12704&&i<=12735,"CJK Strokes":i=>i>=12736&&i<=12783,"Katakana Phonetic Extensions":i=>i>=12784&&i<=12799,"Enclosed CJK Letters and Months":i=>i>=12800&&i<=13055,"CJK Compatibility":i=>i>=13056&&i<=13311,"CJK Unified Ideographs Extension A":i=>i>=13312&&i<=19903,"Yijing Hexagram Symbols":i=>i>=19904&&i<=19967,"CJK Unified Ideographs":i=>i>=19968&&i<=40959,"Yi Syllables":i=>i>=40960&&i<=42127,"Yi Radicals":i=>i>=42128&&i<=42191,"Hangul Jamo Extended-A":i=>i>=43360&&i<=43391,"Hangul Syllables":i=>i>=44032&&i<=55215,"Hangul Jamo Extended-B":i=>i>=55216&&i<=55295,"Private Use Area":i=>i>=57344&&i<=63743,"CJK Compatibility Ideographs":i=>i>=63744&&i<=64255,"Arabic Presentation Forms-A":i=>i>=64336&&i<=65023,"Vertical Forms":i=>i>=65040&&i<=65055,"CJK Compatibility Forms":i=>i>=65072&&i<=65103,"Small Form Variants":i=>i>=65104&&i<=65135,"Arabic Presentation Forms-B":i=>i>=65136&&i<=65279,"Halfwidth and Fullwidth Forms":i=>i>=65280&&i<=65519};function Vs(i){for(const e of i)if($s(e.charCodeAt(0)))return!0;return!1}function qa(i){for(const e of i)if(!ol(e.charCodeAt(0)))return!1;return!0}function ol(i){return!(Ce.Arabic(i)||Ce["Arabic Supplement"](i)||Ce["Arabic Extended-A"](i)||Ce["Arabic Presentation Forms-A"](i)||Ce["Arabic Presentation Forms-B"](i))}function $s(i){return!(i!==746&&i!==747&&(i<4352||!(Ce["Bopomofo Extended"](i)||Ce.Bopomofo(i)||Ce["CJK Compatibility Forms"](i)&&!(i>=65097&&i<=65103)||Ce["CJK Compatibility Ideographs"](i)||Ce["CJK Compatibility"](i)||Ce["CJK Radicals Supplement"](i)||Ce["CJK Strokes"](i)||!(!Ce["CJK Symbols and Punctuation"](i)||i>=12296&&i<=12305||i>=12308&&i<=12319||i===12336)||Ce["CJK Unified Ideographs Extension A"](i)||Ce["CJK Unified Ideographs"](i)||Ce["Enclosed CJK Letters and Months"](i)||Ce["Hangul Compatibility Jamo"](i)||Ce["Hangul Jamo Extended-A"](i)||Ce["Hangul Jamo Extended-B"](i)||Ce["Hangul Jamo"](i)||Ce["Hangul Syllables"](i)||Ce.Hiragana(i)||Ce["Ideographic Description Characters"](i)||Ce.Kanbun(i)||Ce["Kangxi Radicals"](i)||Ce["Katakana Phonetic Extensions"](i)||Ce.Katakana(i)&&i!==12540||!(!Ce["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)||!(!Ce["Small Form Variants"](i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||Ce["Unified Canadian Aboriginal Syllabics"](i)||Ce["Unified Canadian Aboriginal Syllabics Extended"](i)||Ce["Vertical Forms"](i)||Ce["Yijing Hexagram Symbols"](i)||Ce["Yi Syllables"](i)||Ce["Yi Radicals"](i))))}function ll(i){return!($s(i)||function(e){return!!(Ce["Latin-1 Supplement"](e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||Ce["General Punctuation"](e)&&(e===8214||e===8224||e===8225||e===8240||e===8241||e===8251||e===8252||e===8258||e===8263||e===8264||e===8265||e===8273)||Ce["Letterlike Symbols"](e)||Ce["Number Forms"](e)||Ce["Miscellaneous Technical"](e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||e===9003||e>=9085&&e<=9114||e>=9150&&e<=9165||e===9167||e>=9169&&e<=9179||e>=9186&&e<=9215)||Ce["Control Pictures"](e)&&e!==9251||Ce["Optical Character Recognition"](e)||Ce["Enclosed Alphanumerics"](e)||Ce["Geometric Shapes"](e)||Ce["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||Ce["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||Ce["CJK Symbols and Punctuation"](e)||Ce.Katakana(e)||Ce["Private Use Area"](e)||Ce["CJK Compatibility Forms"](e)||Ce["Small Form Variants"](e)||Ce["Halfwidth and Fullwidth Forms"](e)||e===8734||e===8756||e===8757||e>=9984&&e<=10087||e>=10102&&e<=10131||e===65532||e===65533)}(i))}function js(i){return i>=1424&&i<=2303||Ce["Arabic Presentation Forms-A"](i)||Ce["Arabic Presentation Forms-B"](i)}function Gs(i,e){return!(!e&&js(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||Ce.Khmer(i))}function cl(i){for(const e of i)if(js(e.charCodeAt(0)))return!0;return!1}const Za="deferred",qs="loading",Xa="loaded";let os=null,Mi="unavailable",Gr=null;const hl=function(i){i&&typeof i=="string"&&i.indexOf("NetworkError")>-1&&(Mi="error"),os&&os(i)};function Wa(){Zs.fire(new Qi("pluginStateChange",{pluginStatus:Mi,pluginURL:Gr}))}const Zs=new Zi,Ha=function(){return Mi},ul=function(){if(Mi!==Za||!Gr)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Mi=qs,Wa(),Gr&&Or({url:Gr},i=>{i?hl(i):(Mi=Xa,Wa())})},Ki={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Mi===Xa||Ki.applyArabicShaping!=null,isLoading:()=>Mi===qs,setState(i){if(!qi())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");Mi=i.pluginStatus,Gr=i.pluginURL},isParsed(){if(!qi())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return Ki.applyArabicShaping!=null&&Ki.processBidirectionalText!=null&&Ki.processStyledBidirectionalText!=null},getPluginURL(){if(!qi())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return Gr}};class Ct{constructor(e,r){this.zoom=e,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 al,this.transition={})}isSupportedScript(e){return function(r,s){for(const l of r)if(!Gs(l.charCodeAt(0),s))return!1;return!0}(e,Ki.isLoaded())}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const e=this.zoom,r=e-Math.floor(e),s=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*s}:{fromScale:.5,toScale:1,t:1-(1-s)*r}}}class Xs{constructor(e,r){this.property=e,this.value=r,this.expression=function(s,l){if(zs(s))return new Tt(s,l);if(Ls(s)){const u=Ds(s,l);if(u.result==="error")throw new Error(u.value.map(d=>`${d.key}: ${d.message}`).join(", "));return u.value}{let u=s;return l.type==="color"&&typeof s=="string"?u=lt.parse(s):l.type!=="padding"||typeof s!="number"&&!Array.isArray(s)||(u=Ii.parse(s)),{kind:"constant",evaluate:()=>u}}}(r===void 0?e.specification.default:r,e.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,r,s){return this.property.possiblyEvaluate(this,e,r,s)}}class Ka{constructor(e){this.property=e,this.value=new Xs(e,void 0)}transitioned(e,r){return new ls(this.property,this.value,r,_i({},e.transition,this.transition),e.now)}untransitioned(){return new ls(this.property,this.value,null,{},0)}}class dl{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return Ti(this._values[e].value.value)}setValue(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Ka(this._values[e].property)),this._values[e].value=new Xs(this._values[e].property,r===null?void 0:Ti(r))}getTransition(e){return Ti(this._values[e].transition)}setTransition(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Ka(this._values[e].property)),this._values[e].transition=Ti(r)||void 0}serialize(){const e={};for(const r of Object.keys(this._values)){const s=this.getValue(r);s!==void 0&&(e[r]=s);const l=this.getTransition(r);l!==void 0&&(e[`${r}-transition`]=l)}return e}transitioned(e,r){const s=new pl(this._properties);for(const l of Object.keys(this._values))s._values[l]=this._values[l].transitioned(e,r._values[l]);return s}untransitioned(){const e=new pl(this._properties);for(const r of Object.keys(this._values))e._values[r]=this._values[r].untransitioned();return e}}class ls{constructor(e,r,s,l,u){this.property=e,this.value=r,this.begin=u+l.delay||0,this.end=this.begin+l.duration||0,e.specification.transition&&(l.delay||l.duration)&&(this.prior=s)}possiblyEvaluate(e,r,s){const l=e.now||0,u=this.value.possiblyEvaluate(e,r,s),d=this.prior;if(d){if(l>this.end)return this.prior=null,u;if(this.value.isDataDriven())return this.prior=null,u;if(l<this.begin)return d.possiblyEvaluate(e,r,s);{const f=(l-this.begin)/(this.end-this.begin);return this.property.interpolate(d.possiblyEvaluate(e,r,s),u,function(g){if(g<=0)return 0;if(g>=1)return 1;const b=g*g,w=b*g;return 4*(g<.5?w:3*(g-b)+w-.75)}(f))}}return u}}class pl{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,r,s){const l=new Ws(this._properties);for(const u of Object.keys(this._values))l._values[u]=this._values[u].possiblyEvaluate(e,r,s);return l}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class Ya{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}getValue(e){return Ti(this._values[e].value)}setValue(e,r){this._values[e]=new Xs(this._values[e].property,r===null?void 0:Ti(r))}serialize(){const e={};for(const r of Object.keys(this._values)){const s=this.getValue(r);s!==void 0&&(e[r]=s)}return e}possiblyEvaluate(e,r,s){const l=new Ws(this._properties);for(const u of Object.keys(this._values))l._values[u]=this._values[u].possiblyEvaluate(e,r,s);return l}}class gr{constructor(e,r,s){this.property=e,this.value=r,this.parameters=s}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,r,s,l){return this.property.evaluate(this.value,this.parameters,e,r,s,l)}}class Ws{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class Ue{constructor(e){this.specification=e}possiblyEvaluate(e,r){if(e.isDataDriven())throw new Error("Value should not be data driven");return e.expression.evaluate(r)}interpolate(e,r,s){const l=Pi[this.specification.type];return l?l(e,r,s):e}}class Ze{constructor(e,r){this.specification=e,this.overrides=r}possiblyEvaluate(e,r,s,l){return new gr(this,e.expression.kind==="constant"||e.expression.kind==="camera"?{kind:"constant",value:e.expression.evaluate(r,null,{},s,l)}:e.expression,r)}interpolate(e,r,s){if(e.value.kind!=="constant"||r.value.kind!=="constant")return e;if(e.value.value===void 0||r.value.value===void 0)return new gr(this,{kind:"constant",value:void 0},e.parameters);const l=Pi[this.specification.type];if(l){const u=l(e.value.value,r.value.value,s);return new gr(this,{kind:"constant",value:u},e.parameters)}return e}evaluate(e,r,s,l,u,d){return e.kind==="constant"?e.value:e.evaluate(r,s,l,u,d)}}class cs extends Ze{possiblyEvaluate(e,r,s,l){if(e.value===void 0)return new gr(this,{kind:"constant",value:void 0},r);if(e.expression.kind==="constant"){const u=e.expression.evaluate(r,null,{},s,l),d=e.property.specification.type==="resolvedImage"&&typeof u!="string"?u.name:u,f=this._calculate(d,d,d,r);return new gr(this,{kind:"constant",value:f},r)}if(e.expression.kind==="camera"){const u=this._calculate(e.expression.evaluate({zoom:r.zoom-1}),e.expression.evaluate({zoom:r.zoom}),e.expression.evaluate({zoom:r.zoom+1}),r);return new gr(this,{kind:"constant",value:u},r)}return new gr(this,e.expression,r)}evaluate(e,r,s,l,u,d){if(e.kind==="source"){const f=e.evaluate(r,s,l,u,d);return this._calculate(f,f,f,r)}return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(r.zoom)-1},s,l),e.evaluate({zoom:Math.floor(r.zoom)},s,l),e.evaluate({zoom:Math.floor(r.zoom)+1},s,l),r):e.value}_calculate(e,r,s,l){return l.zoom>l.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:s,to:r}}interpolate(e){return e}}class Ja{constructor(e){this.specification=e}possiblyEvaluate(e,r,s,l){if(e.value!==void 0){if(e.expression.kind==="constant"){const u=e.expression.evaluate(r,null,{},s,l);return this._calculate(u,u,u,r)}return this._calculate(e.expression.evaluate(new Ct(Math.floor(r.zoom-1),r)),e.expression.evaluate(new Ct(Math.floor(r.zoom),r)),e.expression.evaluate(new Ct(Math.floor(r.zoom+1),r)),r)}}_calculate(e,r,s,l){return l.zoom>l.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:s,to:r}}interpolate(e){return e}}class Qa{constructor(e){this.specification=e}possiblyEvaluate(e,r,s,l){return!!e.expression.evaluate(r,null,{},s,l)}interpolate(){return!1}}class ki{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const r in e){const s=e[r];s.specification.overridable&&this.overridableProperties.push(r);const l=this.defaultPropertyValues[r]=new Xs(s,void 0),u=this.defaultTransitionablePropertyValues[r]=new Ka(s);this.defaultTransitioningPropertyValues[r]=u.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=l.possiblyEvaluate({})}}}De("DataDrivenProperty",Ze),De("DataConstantProperty",Ue),De("CrossFadedDataDrivenProperty",cs),De("CrossFadedProperty",Ja),De("ColorRampProperty",Qa);const Hs="-transition";class _r extends Zi{constructor(e,r){if(super(),this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1},e.type!=="custom"&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type!=="background"&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),r.layout&&(this._unevaluatedLayout=new Ya(r.layout)),r.paint)){this._transitionablePaint=new dl(r.paint);for(const s in e.paint)this.setPaintProperty(s,e.paint[s],{validate:!1});for(const s in e.layout)this.setLayoutProperty(s,e.layout[s],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Ws(r.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,r,s={}){r!=null&&this._validate(pc,`layers.${this.id}.layout.${e}`,e,r,s)||(e!=="visibility"?this._unevaluatedLayout.setValue(e,r):this.visibility=r)}getPaintProperty(e){return e.endsWith(Hs)?this._transitionablePaint.getTransition(e.slice(0,-Hs.length)):this._transitionablePaint.getValue(e)}setPaintProperty(e,r,s={}){if(r!=null&&this._validate(dc,`layers.${this.id}.paint.${e}`,e,r,s))return!1;if(e.endsWith(Hs))return this._transitionablePaint.setTransition(e.slice(0,-Hs.length),r||void 0),!1;{const l=this._transitionablePaint._values[e],u=l.property.specification["property-type"]==="cross-faded-data-driven",d=l.value.isDataDriven(),f=l.value;this._transitionablePaint.setValue(e,r),this._handleSpecialPaintPropertyUpdate(e);const g=this._transitionablePaint._values[e].value;return g.isDataDriven()||d||u||this._handleOverridablePaintPropertyUpdate(e,f,g)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,r,s){return!1}isHidden(e){return!!(this.minzoom&&e<this.minzoom)||!!(this.maxzoom&&e>=this.maxzoom)||this.visibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,r){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,r)}serialize(){const e={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&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),mn(e,(r,s)=>!(r===void 0||s==="layout"&&!Object.keys(r).length||s==="paint"&&!Object.keys(r).length))}_validate(e,r,s,l,u={}){return(!u||u.validate!==!1)&&Mn(this,e.call(jr,{key:r,layerType:this.type,objectKey:s,value:l,styleSpec:oe,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const e in this.paint._values){const r=this.paint.get(e);if(r instanceof gr&&An(r.property.specification)&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}}const fc={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Cr{constructor(e,r){this._structArray=e,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Bt{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,r){return e._trim(),r&&(e.isTransferred=!0,r.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const r=Object.create(this.prototype);return r.arrayBuffer=e.arrayBuffer,r.length=e.length,r.capacity=e.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(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function Zt(i,e=1){let r=0,s=0;return{members:i.map(l=>{const u=fc[l.type].BYTES_PER_ELEMENT,d=r=fl(r,Math.max(e,u)),f=l.components||1;return s=Math.max(s,u),r+=u*f,{name:l.name,type:l.type,components:f,offset:d}}),size:fl(r,Math.max(s,e)),alignment:e}}function fl(i,e){return Math.ceil(i/e)*e}class kn extends Bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r){const s=this.length;return this.resize(s+1),this.emplace(s,e,r)}emplace(e,r,s){const l=2*e;return this.int16[l+0]=r,this.int16[l+1]=s,e}}kn.prototype.bytesPerElement=4,De("StructArrayLayout2i4",kn);class Ks extends Bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,s)}emplace(e,r,s,l){const u=3*e;return this.int16[u+0]=r,this.int16[u+1]=s,this.int16[u+2]=l,e}}Ks.prototype.bytesPerElement=6,De("StructArrayLayout3i6",Ks);class eo extends Bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l){const u=this.length;return this.resize(u+1),this.emplace(u,e,r,s,l)}emplace(e,r,s,l,u){const d=4*e;return this.int16[d+0]=r,this.int16[d+1]=s,this.int16[d+2]=l,this.int16[d+3]=u,e}}eo.prototype.bytesPerElement=8,De("StructArrayLayout4i8",eo);class yr extends Bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,u,d){const f=this.length;return this.resize(f+1),this.emplace(f,e,r,s,l,u,d)}emplace(e,r,s,l,u,d,f){const g=6*e;return this.int16[g+0]=r,this.int16[g+1]=s,this.int16[g+2]=l,this.int16[g+3]=u,this.int16[g+4]=d,this.int16[g+5]=f,e}}yr.prototype.bytesPerElement=12,De("StructArrayLayout2i4i12",yr);class Ys extends Bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,u,d){const f=this.length;return this.resize(f+1),this.emplace(f,e,r,s,l,u,d)}emplace(e,r,s,l,u,d,f){const g=4*e,b=8*e;return this.int16[g+0]=r,this.int16[g+1]=s,this.uint8[b+4]=l,this.uint8[b+5]=u,this.uint8[b+6]=d,this.uint8[b+7]=f,e}}Ys.prototype.bytesPerElement=8,De("StructArrayLayout2i4ub8",Ys);class sn extends Bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r){const s=this.length;return this.resize(s+1),this.emplace(s,e,r)}emplace(e,r,s){const l=2*e;return this.float32[l+0]=r,this.float32[l+1]=s,e}}sn.prototype.bytesPerElement=8,De("StructArrayLayout2f8",sn);class Js extends Bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,u,d,f,g,b,w){const E=this.length;return this.resize(E+1),this.emplace(E,e,r,s,l,u,d,f,g,b,w)}emplace(e,r,s,l,u,d,f,g,b,w,E){const C=10*e;return this.uint16[C+0]=r,this.uint16[C+1]=s,this.uint16[C+2]=l,this.uint16[C+3]=u,this.uint16[C+4]=d,this.uint16[C+5]=f,this.uint16[C+6]=g,this.uint16[C+7]=b,this.uint16[C+8]=w,this.uint16[C+9]=E,e}}Js.prototype.bytesPerElement=20,De("StructArrayLayout10ui20",Js);class hs extends Bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,u,d,f,g,b,w,E,C){const M=this.length;return this.resize(M+1),this.emplace(M,e,r,s,l,u,d,f,g,b,w,E,C)}emplace(e,r,s,l,u,d,f,g,b,w,E,C,M){const L=12*e;return this.int16[L+0]=r,this.int16[L+1]=s,this.int16[L+2]=l,this.int16[L+3]=u,this.uint16[L+4]=d,this.uint16[L+5]=f,this.uint16[L+6]=g,this.uint16[L+7]=b,this.int16[L+8]=w,this.int16[L+9]=E,this.int16[L+10]=C,this.int16[L+11]=M,e}}hs.prototype.bytesPerElement=24,De("StructArrayLayout4i4ui4i24",hs);class to extends Bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,s)}emplace(e,r,s,l){const u=3*e;return this.float32[u+0]=r,this.float32[u+1]=s,this.float32[u+2]=l,e}}to.prototype.bytesPerElement=12,De("StructArrayLayout3f12",to);class zn extends Bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.uint32[1*e+0]=r,e}}zn.prototype.bytesPerElement=4,De("StructArrayLayout1ul4",zn);class an extends Bt{_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(e,r,s,l,u,d,f,g,b){const w=this.length;return this.resize(w+1),this.emplace(w,e,r,s,l,u,d,f,g,b)}emplace(e,r,s,l,u,d,f,g,b,w){const E=10*e,C=5*e;return this.int16[E+0]=r,this.int16[E+1]=s,this.int16[E+2]=l,this.int16[E+3]=u,this.int16[E+4]=d,this.int16[E+5]=f,this.uint32[C+3]=g,this.uint16[E+8]=b,this.uint16[E+9]=w,e}}an.prototype.bytesPerElement=20,De("StructArrayLayout6i1ul2ui20",an);class io extends Bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,u,d){const f=this.length;return this.resize(f+1),this.emplace(f,e,r,s,l,u,d)}emplace(e,r,s,l,u,d,f){const g=6*e;return this.int16[g+0]=r,this.int16[g+1]=s,this.int16[g+2]=l,this.int16[g+3]=u,this.int16[g+4]=d,this.int16[g+5]=f,e}}io.prototype.bytesPerElement=12,De("StructArrayLayout2i2i2i12",io);class Qs extends Bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,u){const d=this.length;return this.resize(d+1),this.emplace(d,e,r,s,l,u)}emplace(e,r,s,l,u,d){const f=4*e,g=8*e;return this.float32[f+0]=r,this.float32[f+1]=s,this.float32[f+2]=l,this.int16[g+6]=u,this.int16[g+7]=d,e}}Qs.prototype.bytesPerElement=16,De("StructArrayLayout2f1f2i16",Qs);class on extends Bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,s,l){const u=this.length;return this.resize(u+1),this.emplace(u,e,r,s,l)}emplace(e,r,s,l,u){const d=12*e,f=3*e;return this.uint8[d+0]=r,this.uint8[d+1]=s,this.float32[f+1]=l,this.float32[f+2]=u,e}}on.prototype.bytesPerElement=12,De("StructArrayLayout2ub2f12",on);class ea extends Bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,s)}emplace(e,r,s,l){const u=3*e;return this.uint16[u+0]=r,this.uint16[u+1]=s,this.uint16[u+2]=l,e}}ea.prototype.bytesPerElement=6,De("StructArrayLayout3ui6",ea);class ro extends Bt{_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(e,r,s,l,u,d,f,g,b,w,E,C,M,L,N,O,W){const ee=this.length;return this.resize(ee+1),this.emplace(ee,e,r,s,l,u,d,f,g,b,w,E,C,M,L,N,O,W)}emplace(e,r,s,l,u,d,f,g,b,w,E,C,M,L,N,O,W,ee){const Z=24*e,re=12*e,se=48*e;return this.int16[Z+0]=r,this.int16[Z+1]=s,this.uint16[Z+2]=l,this.uint16[Z+3]=u,this.uint32[re+2]=d,this.uint32[re+3]=f,this.uint32[re+4]=g,this.uint16[Z+10]=b,this.uint16[Z+11]=w,this.uint16[Z+12]=E,this.float32[re+7]=C,this.float32[re+8]=M,this.uint8[se+36]=L,this.uint8[se+37]=N,this.uint8[se+38]=O,this.uint32[re+10]=W,this.int16[Z+22]=ee,e}}ro.prototype.bytesPerElement=48,De("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",ro);class ta extends Bt{_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(e,r,s,l,u,d,f,g,b,w,E,C,M,L,N,O,W,ee,Z,re,se,he,Le,Re,Pe,Ee,be,Me){const Ae=this.length;return this.resize(Ae+1),this.emplace(Ae,e,r,s,l,u,d,f,g,b,w,E,C,M,L,N,O,W,ee,Z,re,se,he,Le,Re,Pe,Ee,be,Me)}emplace(e,r,s,l,u,d,f,g,b,w,E,C,M,L,N,O,W,ee,Z,re,se,he,Le,Re,Pe,Ee,be,Me,Ae){const ye=34*e,je=17*e;return this.int16[ye+0]=r,this.int16[ye+1]=s,this.int16[ye+2]=l,this.int16[ye+3]=u,this.int16[ye+4]=d,this.int16[ye+5]=f,this.int16[ye+6]=g,this.int16[ye+7]=b,this.uint16[ye+8]=w,this.uint16[ye+9]=E,this.uint16[ye+10]=C,this.uint16[ye+11]=M,this.uint16[ye+12]=L,this.uint16[ye+13]=N,this.uint16[ye+14]=O,this.uint16[ye+15]=W,this.uint16[ye+16]=ee,this.uint16[ye+17]=Z,this.uint16[ye+18]=re,this.uint16[ye+19]=se,this.uint16[ye+20]=he,this.uint16[ye+21]=Le,this.uint16[ye+22]=Re,this.uint32[je+12]=Pe,this.float32[je+13]=Ee,this.float32[je+14]=be,this.float32[je+15]=Me,this.float32[je+16]=Ae,e}}ta.prototype.bytesPerElement=68,De("StructArrayLayout8i15ui1ul4f68",ta);class ia extends Bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.float32[1*e+0]=r,e}}ia.prototype.bytesPerElement=4,De("StructArrayLayout1f4",ia);class ra extends Bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,s)}emplace(e,r,s,l){const u=4*e;return this.uint32[2*e+0]=r,this.uint16[u+2]=s,this.uint16[u+3]=l,e}}ra.prototype.bytesPerElement=8,De("StructArrayLayout1ul2ui8",ra);class o extends Bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r){const s=this.length;return this.resize(s+1),this.emplace(s,e,r)}emplace(e,r,s){const l=2*e;return this.uint16[l+0]=r,this.uint16[l+1]=s,e}}o.prototype.bytesPerElement=4,De("StructArrayLayout2ui4",o);class t extends Bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.uint16[1*e+0]=r,e}}t.prototype.bytesPerElement=2,De("StructArrayLayout1ui2",t);class n extends Bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,s,l){const u=this.length;return this.resize(u+1),this.emplace(u,e,r,s,l)}emplace(e,r,s,l,u){const d=4*e;return this.float32[d+0]=r,this.float32[d+1]=s,this.float32[d+2]=l,this.float32[d+3]=u,e}}n.prototype.bytesPerElement=16,De("StructArrayLayout4f16",n);class a extends Cr{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 ve(this.anchorPointX,this.anchorPointY)}}a.prototype.size=20;class c extends an{get(e){return new a(this,e)}}De("CollisionBoxArray",c);class p extends Cr{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(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}p.prototype.size=48;class m extends ro{get(e){return new p(this,e)}}De("PlacedSymbolArray",m);class y extends Cr{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(e){this._structArray.uint32[this._pos4+12]=e}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get textOffset0(){return this._structArray.float32[this._pos4+14]}get textOffset1(){return this._structArray.float32[this._pos4+15]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+16]}}y.prototype.size=68;class _ extends ta{get(e){return new y(this,e)}}De("SymbolInstanceArray",_);class v extends ia{getoffsetX(e){return this.float32[1*e+0]}}De("GlyphOffsetArray",v);class S extends Ks{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}De("SymbolLineVertexArray",S);class T extends Cr{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]}}T.prototype.size=8;class z extends ra{get(e){return new T(this,e)}}De("FeatureIndexArray",z);class U extends kn{}class R extends kn{}class F extends kn{}class j extends yr{}class X extends Ys{}class ne extends sn{}class V extends Js{}class ie extends hs{}class ae extends to{}class fe extends zn{}class _e extends io{}class xe extends on{}class ge extends ea{}class ke extends o{}const $e=Zt([{name:"a_pos",components:2,type:"Int16"}],4),{members:Ye}=$e;class we{constructor(e=[]){this.segments=e}prepareSegment(e,r,s,l){let u=this.segments[this.segments.length-1];return e>we.MAX_VERTEX_ARRAY_LENGTH&&oi(`Max vertices per segment is ${we.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!u||u.vertexLength+e>we.MAX_VERTEX_ARRAY_LENGTH||u.sortKey!==l)&&(u={vertexOffset:r.length,primitiveOffset:s.length,vertexLength:0,primitiveLength:0},l!==void 0&&(u.sortKey=l),this.segments.push(u)),u}get(){return this.segments}destroy(){for(const e of this.segments)for(const r in e.vaos)e.vaos[r].destroy()}static simpleSegment(e,r,s,l){return new we([{vertexOffset:e,primitiveOffset:r,vertexLength:s,primitiveLength:l,vaos:{},sortKey:0}])}}function Xe(i,e){return 256*(i=It(Math.floor(i),0,255))+It(Math.floor(e),0,255)}we.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,De("SegmentVector",we);const ze=Zt([{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 ht={exports:{}},Vt={exports:{}};Vt.exports=function(i,e){var r,s,l,u,d,f,g,b;for(s=i.length-(r=3&i.length),l=e,d=3432918353,f=461845907,b=0;b<s;)g=255&i.charCodeAt(b)|(255&i.charCodeAt(++b))<<8|(255&i.charCodeAt(++b))<<16|(255&i.charCodeAt(++b))<<24,++b,l=27492+(65535&(u=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+(u>>>16)&65535)<<16);switch(g=0,r){case 3:g^=(255&i.charCodeAt(b+2))<<16;case 2:g^=(255&i.charCodeAt(b+1))<<8;case 1:l^=g=(65535&(g=(g=(65535&(g^=255&i.charCodeAt(b)))*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 ut=Vt.exports,et={exports:{}};et.exports=function(i,e){for(var r,s=i.length,l=e^s,u=0;s>=4;)r=1540483477*(65535&(r=255&i.charCodeAt(u)|(255&i.charCodeAt(++u))<<8|(255&i.charCodeAt(++u))<<16|(255&i.charCodeAt(++u))<<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)),s-=4,++u;switch(s){case 3:l^=(255&i.charCodeAt(u+2))<<16;case 2:l^=(255&i.charCodeAt(u+1))<<8;case 1:l=1540483477*(65535&(l^=255&i.charCodeAt(u)))+((1540483477*(l>>>16)&65535)<<16)}return l=1540483477*(65535&(l^=l>>>13))+((1540483477*(l>>>16)&65535)<<16),(l^=l>>>15)>>>0};var Ft=ut,yi=et.exports;ht.exports=Ft,ht.exports.murmur3=Ft,ht.exports.murmur2=yi;var $t=me(ht.exports);class ei{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,s,l){this.ids.push(Fi(e)),this.positions.push(r,s,l)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const r=Fi(e);let s=0,l=this.ids.length-1;for(;s<l;){const d=s+l>>1;this.ids[d]>=r?l=d:s=d+1}const u=[];for(;this.ids[s]===r;)u.push({index:this.positions[3*s],start:this.positions[3*s+1],end:this.positions[3*s+2]}),s++;return u}static serialize(e,r){const s=new Float64Array(e.ids),l=new Uint32Array(e.positions);return ir(s,l,0,s.length-1),r&&r.push(s.buffer,l.buffer),{ids:s,positions:l}}static deserialize(e){const r=new ei;return r.ids=e.ids,r.positions=e.positions,r.indexed=!0,r}}function Fi(i){const e=+i;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:$t(String(i))}function ir(i,e,r,s){for(;r<s;){const l=i[r+s>>1];let u=r-1,d=s+1;for(;;){do u++;while(i[u]<l);do d--;while(i[d]>l);if(u>=d)break;rr(i,u,d),rr(e,3*u,3*d),rr(e,3*u+1,3*d+1),rr(e,3*u+2,3*d+2)}d-r<s-d?(ir(i,e,r,d),r=d+1):(ir(i,e,d+1,s),s=d)}}function rr(i,e,r){const s=i[e];i[e]=i[r],i[r]=s}De("FeaturePositionMap",ei);class xi{constructor(e,r){this.gl=e.gl,this.location=r}}class xr extends xi{constructor(e,r){super(e,r),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}}class us extends xi{constructor(e,r){super(e,r),this.current=[0,0,0,0]}set(e){e[0]===this.current[0]&&e[1]===this.current[1]&&e[2]===this.current[2]&&e[3]===this.current[3]||(this.current=e,this.gl.uniform4f(this.location,e[0],e[1],e[2],e[3]))}}class ci extends xi{constructor(e,r){super(e,r),this.current=lt.transparent}set(e){e.r===this.current.r&&e.g===this.current.g&&e.b===this.current.b&&e.a===this.current.a||(this.current=e,this.gl.uniform4f(this.location,e.r,e.g,e.b,e.a))}}const ti=new Float32Array(16);function dt(i){return[Xe(255*i.r,255*i.g),Xe(255*i.b,255*i.a)]}class Ht{constructor(e,r,s){this.value=e,this.uniformNames=r.map(l=>`u_${l}`),this.type=s}setUniform(e,r,s){e.set(s.constantOr(this.value))}getBinding(e,r,s){return this.type==="color"?new ci(e,r):new xr(e,r)}}class ii{constructor(e,r){this.uniformNames=r.map(s=>`u_${s}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,r){this.pixelRatioFrom=r.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=r.tlbr,this.patternTo=e.tlbr}setUniform(e,r,s,l){const u=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;u&&e.set(u)}getBinding(e,r,s){return s.substr(0,9)==="u_pattern"?new us(e,r):new xr(e,r)}}class mt{constructor(e,r,s,l){this.expression=e,this.type=s,this.maxValue=0,this.paintVertexAttributes=r.map(u=>({name:`a_${u}`,type:"Float32",components:s==="color"?2:1,offset:0})),this.paintVertexArray=new l}populatePaintArray(e,r,s,l,u){const d=this.paintVertexArray.length,f=this.expression.evaluate(new Ct(0),r,{},l,[],u);this.paintVertexArray.resize(e),this._setPaintValue(d,e,f)}updatePaintArray(e,r,s,l){const u=this.expression.evaluate({zoom:0},s,l);this._setPaintValue(e,r,u)}_setPaintValue(e,r,s){if(this.type==="color"){const l=dt(s);for(let u=e;u<r;u++)this.paintVertexArray.emplace(u,l[0],l[1])}else{for(let l=e;l<r;l++)this.paintVertexArray.emplace(l,s);this.maxValue=Math.max(this.maxValue,Math.abs(s))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Kt{constructor(e,r,s,l,u,d){this.expression=e,this.uniformNames=r.map(f=>`u_${f}_t`),this.type=s,this.useIntegerZoom=l,this.zoom=u,this.maxValue=0,this.paintVertexAttributes=r.map(f=>({name:`a_${f}`,type:"Float32",components:s==="color"?4:2,offset:0})),this.paintVertexArray=new d}populatePaintArray(e,r,s,l,u){const d=this.expression.evaluate(new Ct(this.zoom),r,{},l,[],u),f=this.expression.evaluate(new Ct(this.zoom+1),r,{},l,[],u),g=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(g,e,d,f)}updatePaintArray(e,r,s,l){const u=this.expression.evaluate({zoom:this.zoom},s,l),d=this.expression.evaluate({zoom:this.zoom+1},s,l);this._setPaintValue(e,r,u,d)}_setPaintValue(e,r,s,l){if(this.type==="color"){const u=dt(s),d=dt(l);for(let f=e;f<r;f++)this.paintVertexArray.emplace(f,u[0],u[1],d[0],d[1])}else{for(let u=e;u<r;u++)this.paintVertexArray.emplace(u,s,l);this.maxValue=Math.max(this.maxValue,Math.abs(s),Math.abs(l))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,r){const s=this.useIntegerZoom?Math.floor(r.zoom):r.zoom,l=It(this.expression.interpolationFactor(s,this.zoom,this.zoom+1),0,1);e.set(l)}getBinding(e,r,s){return new xr(e,r)}}class Oi{constructor(e,r,s,l,u,d){this.expression=e,this.type=r,this.useIntegerZoom=s,this.zoom=l,this.layerId=d,this.zoomInPaintVertexArray=new u,this.zoomOutPaintVertexArray=new u}populatePaintArray(e,r,s){const l=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(l,e,r.patterns&&r.patterns[this.layerId],s)}updatePaintArray(e,r,s,l,u){this._setPaintValues(e,r,s.patterns&&s.patterns[this.layerId],u)}_setPaintValues(e,r,s,l){if(!l||!s)return;const{min:u,mid:d,max:f}=s,g=l[u],b=l[d],w=l[f];if(g&&b&&w)for(let E=e;E<r;E++)this.zoomInPaintVertexArray.emplace(E,b.tl[0],b.tl[1],b.br[0],b.br[1],g.tl[0],g.tl[1],g.br[0],g.br[1],b.pixelRatio,g.pixelRatio),this.zoomOutPaintVertexArray.emplace(E,b.tl[0],b.tl[1],b.br[0],b.br[1],w.tl[0],w.tl[1],w.br[0],w.br[1],b.pixelRatio,w.pixelRatio)}upload(e){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,ze.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,ze.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class na{constructor(e,r,s){this.binders={},this._buffers=[];const l=[];for(const u in e.paint._values){if(!s(u))continue;const d=e.paint.get(u);if(!(d instanceof gr&&An(d.property.specification)))continue;const f=mc(u,e.type),g=d.value,b=d.property.specification.type,w=d.property.useIntegerZoom,E=d.property.specification["property-type"],C=E==="cross-faded"||E==="cross-faded-data-driven";if(g.kind==="constant")this.binders[u]=C?new ii(g.value,f):new Ht(g.value,f,b),l.push(`/u_${u}`);else if(g.kind==="source"||C){const M=ml(u,b,"source");this.binders[u]=C?new Oi(g,b,w,r,M,e.id):new mt(g,f,b,M),l.push(`/a_${u}`)}else{const M=ml(u,b,"composite");this.binders[u]=new Kt(g,f,b,w,r,M),l.push(`/z_${u}`)}}this.cacheKey=l.sort().join("")}getMaxValue(e){const r=this.binders[e];return r instanceof mt||r instanceof Kt?r.maxValue:0}populatePaintArrays(e,r,s,l,u){for(const d in this.binders){const f=this.binders[d];(f instanceof mt||f instanceof Kt||f instanceof Oi)&&f.populatePaintArray(e,r,s,l,u)}}setConstantPatternPositions(e,r){for(const s in this.binders){const l=this.binders[s];l instanceof ii&&l.setConstantPatternPositions(e,r)}}updatePaintArrays(e,r,s,l,u){let d=!1;for(const f in e){const g=r.getPositions(f);for(const b of g){const w=s.feature(b.index);for(const E in this.binders){const C=this.binders[E];if((C instanceof mt||C instanceof Kt||C instanceof Oi)&&C.expression.isStateDependent===!0){const M=l.paint.get(E);C.expression=M.value,C.updatePaintArray(b.start,b.end,w,e[f],u),d=!0}}}}return d}defines(){const e=[];for(const r in this.binders){const s=this.binders[r];(s instanceof Ht||s instanceof ii)&&e.push(...s.uniformNames.map(l=>`#define HAS_UNIFORM_${l}`))}return e}getBinderAttributes(){const e=[];for(const r in this.binders){const s=this.binders[r];if(s instanceof mt||s instanceof Kt)for(let l=0;l<s.paintVertexAttributes.length;l++)e.push(s.paintVertexAttributes[l].name);else if(s instanceof Oi)for(let l=0;l<ze.members.length;l++)e.push(ze.members[l].name)}return e}getBinderUniforms(){const e=[];for(const r in this.binders){const s=this.binders[r];if(s instanceof Ht||s instanceof ii||s instanceof Kt)for(const l of s.uniformNames)e.push(l)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,r){const s=[];for(const l in this.binders){const u=this.binders[l];if(u instanceof Ht||u instanceof ii||u instanceof Kt){for(const d of u.uniformNames)if(r[d]){const f=u.getBinding(e,r[d],d);s.push({name:d,property:l,binding:f})}}}return s}setUniforms(e,r,s,l){for(const{name:u,property:d,binding:f}of r)this.binders[d].setUniform(f,l,s.get(d),u)}updatePaintBuffers(e){this._buffers=[];for(const r in this.binders){const s=this.binders[r];if(e&&s instanceof Oi){const l=e.fromScale===2?s.zoomInPaintVertexBuffer:s.zoomOutPaintVertexBuffer;l&&this._buffers.push(l)}else(s instanceof mt||s instanceof Kt)&&s.paintVertexBuffer&&this._buffers.push(s.paintVertexBuffer)}}upload(e){for(const r in this.binders){const s=this.binders[r];(s instanceof mt||s instanceof Kt||s instanceof Oi)&&s.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const r=this.binders[e];(r instanceof mt||r instanceof Kt||r instanceof Oi)&&r.destroy()}}}class Pr{constructor(e,r,s=()=>!0){this.programConfigurations={};for(const l of e)this.programConfigurations[l.id]=new na(l,r,s);this.needsUpload=!1,this._featureMap=new ei,this._bufferOffset=0}populatePaintArrays(e,r,s,l,u,d){for(const f in this.programConfigurations)this.programConfigurations[f].populatePaintArrays(e,r,l,u,d);r.id!==void 0&&this._featureMap.add(r.id,s,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,r,s,l){for(const u of s)this.needsUpload=this.programConfigurations[u.id].updatePaintArrays(e,this._featureMap,r,u,l)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const r in this.programConfigurations)this.programConfigurations[r].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}function mc(i,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[i]||[i.replace(`${e}-`,"").replace(/-/g,"_")]}function ml(i,e,r){const s={color:{source:sn,composite:n},number:{source:ia,composite:sn}},l=function(u){return{"line-pattern":{source:V,composite:V},"fill-pattern":{source:V,composite:V},"fill-extrusion-pattern":{source:V,composite:V}}[u]}(i);return l&&l[r]||s[e][r]}De("ConstantBinder",Ht),De("CrossFadedConstantBinder",ii),De("SourceExpressionBinder",mt),De("CrossFadedCompositeBinder",Oi),De("CompositeExpressionBinder",Kt),De("ProgramConfiguration",na,{omit:["_buffers"]}),De("ProgramConfigurationSet",Pr);var Pt=8192;const no=Math.pow(2,14)-1,ds=-no-1;function Mr(i){const e=Pt/i.extent,r=i.loadGeometry();for(let s=0;s<r.length;s++){const l=r[s];for(let u=0;u<l.length;u++){const d=l[u],f=Math.round(d.x*e),g=Math.round(d.y*e);d.x=It(f,ds,no),d.y=It(g,ds,no),(f<d.x||f>d.x+1||g<d.y||g>d.y+1)&&oi("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function ps(i,e){return{type:i.type,id:i.id,properties:i.properties,geometry:e?Mr(i):[]}}function gl(i,e,r,s,l){i.emplaceBack(2*e+(s+1)/2,2*r+(l+1)/2)}class gc{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new R,this.indexArray=new ge,this.segments=new we,this.programConfigurations=new Pr(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,s){const l=this.layers[0],u=[];let d=null,f=!1;l.type==="circle"&&(d=l.layout.get("circle-sort-key"),f=!d.isConstant());for(const{feature:g,id:b,index:w,sourceLayerIndex:E}of e){const C=this.layers[0]._featureFilter.needGeometry,M=ps(g,C);if(!this.layers[0]._featureFilter.filter(new Ct(this.zoom),M,s))continue;const L=f?d.evaluate(M,{},s):void 0,N={id:b,properties:g.properties,type:g.type,sourceLayerIndex:E,index:w,geometry:C?M.geometry:Mr(g),patterns:{},sortKey:L};u.push(N)}f&&u.sort((g,b)=>g.sortKey-b.sortKey);for(const g of u){const{geometry:b,index:w,sourceLayerIndex:E}=g,C=e[w].feature;this.addFeature(g,b,w,s),r.featureIndex.insert(C,b,w,E,this.index)}}update(e,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,s)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Ye),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,r,s,l){for(const u of r)for(const d of u){const f=d.x,g=d.y;if(f<0||f>=Pt||g<0||g>=Pt)continue;const b=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),w=b.vertexLength;gl(this.layoutVertexArray,f,g,-1,-1),gl(this.layoutVertexArray,f,g,1,-1),gl(this.layoutVertexArray,f,g,1,1),gl(this.layoutVertexArray,f,g,-1,1),this.indexArray.emplaceBack(w,w+1,w+2),this.indexArray.emplaceBack(w,w+3,w+2),b.vertexLength+=4,b.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,{},l)}}function fu(i,e){for(let r=0;r<i.length;r++)if(sa(e,i[r]))return!0;for(let r=0;r<e.length;r++)if(sa(i,e[r]))return!0;return!!_c(i,e)}function Yf(i,e,r){return!!sa(i,e)||!!yc(e,i,r)}function mu(i,e){if(i.length===1)return _u(e,i[0]);for(let r=0;r<e.length;r++){const s=e[r];for(let l=0;l<s.length;l++)if(sa(i,s[l]))return!0}for(let r=0;r<i.length;r++)if(_u(e,i[r]))return!0;for(let r=0;r<e.length;r++)if(_c(i,e[r]))return!0;return!1}function Jf(i,e,r){if(i.length>1){if(_c(i,e))return!0;for(let s=0;s<e.length;s++)if(yc(e[s],i,r))return!0}for(let s=0;s<i.length;s++)if(yc(i[s],e,r))return!0;return!1}function _c(i,e){if(i.length===0||e.length===0)return!1;for(let r=0;r<i.length-1;r++){const s=i[r],l=i[r+1];for(let u=0;u<e.length-1;u++)if(Qf(s,l,e[u],e[u+1]))return!0}return!1}function Qf(i,e,r,s){return xt(i,r,s)!==xt(e,r,s)&&xt(i,e,r)!==xt(i,e,s)}function yc(i,e,r){const s=r*r;if(e.length===1)return i.distSqr(e[0])<s;for(let l=1;l<e.length;l++)if(gu(i,e[l-1],e[l])<s)return!0;return!1}function gu(i,e,r){const s=e.distSqr(r);if(s===0)return i.distSqr(e);const l=((i.x-e.x)*(r.x-e.x)+(i.y-e.y)*(r.y-e.y))/s;return i.distSqr(l<0?e:l>1?r:r.sub(e)._mult(l)._add(e))}function _u(i,e){let r,s,l,u=!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++)s=r[f],l=r[g],s.y>e.y!=l.y>e.y&&e.x<(l.x-s.x)*(e.y-s.y)/(l.y-s.y)+s.x&&(u=!u)}return u}function sa(i,e){let r=!1;for(let s=0,l=i.length-1;s<i.length;l=s++){const u=i[s],d=i[l];u.y>e.y!=d.y>e.y&&e.x<(d.x-u.x)*(e.y-u.y)/(d.y-u.y)+u.x&&(r=!r)}return r}function em(i,e,r){const s=r[0],l=r[2];if(i.x<s.x&&e.x<s.x||i.x>l.x&&e.x>l.x||i.y<s.y&&e.y<s.y||i.y>l.y&&e.y>l.y)return!1;const u=xt(i,e,r[0]);return u!==xt(i,e,r[1])||u!==xt(i,e,r[2])||u!==xt(i,e,r[3])}function so(i,e,r){const s=e.paint.get(i).value;return s.kind==="constant"?s.value:r.programConfigurations.get(e.id).getMaxValue(i)}function _l(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function yl(i,e,r,s,l){if(!e[0]&&!e[1])return i;const u=ve.convert(e)._mult(l);r==="viewport"&&u._rotate(-s);const d=[];for(let f=0;f<i.length;f++)d.push(i[f].sub(u));return d}let yu,xu;De("CircleBucket",gc,{omit:["layers"]});var tm={get paint(){return xu=xu||new ki({"circle-radius":new Ze(oe.paint_circle["circle-radius"]),"circle-color":new Ze(oe.paint_circle["circle-color"]),"circle-blur":new Ze(oe.paint_circle["circle-blur"]),"circle-opacity":new Ze(oe.paint_circle["circle-opacity"]),"circle-translate":new Ue(oe.paint_circle["circle-translate"]),"circle-translate-anchor":new Ue(oe.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Ue(oe.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Ue(oe.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Ze(oe.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Ze(oe.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Ze(oe.paint_circle["circle-stroke-opacity"])})},get layout(){return yu=yu||new ki({"circle-sort-key":new Ze(oe.layout_circle["circle-sort-key"])})}},zi=1e-6,aa=typeof Float32Array<"u"?Float32Array:Array;function xc(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 vu(i,e,r){var s=e[0],l=e[1],u=e[2],d=e[3],f=e[4],g=e[5],b=e[6],w=e[7],E=e[8],C=e[9],M=e[10],L=e[11],N=e[12],O=e[13],W=e[14],ee=e[15],Z=r[0],re=r[1],se=r[2],he=r[3];return i[0]=Z*s+re*f+se*E+he*N,i[1]=Z*l+re*g+se*C+he*O,i[2]=Z*u+re*b+se*M+he*W,i[3]=Z*d+re*w+se*L+he*ee,i[4]=(Z=r[4])*s+(re=r[5])*f+(se=r[6])*E+(he=r[7])*N,i[5]=Z*l+re*g+se*C+he*O,i[6]=Z*u+re*b+se*M+he*W,i[7]=Z*d+re*w+se*L+he*ee,i[8]=(Z=r[8])*s+(re=r[9])*f+(se=r[10])*E+(he=r[11])*N,i[9]=Z*l+re*g+se*C+he*O,i[10]=Z*u+re*b+se*M+he*W,i[11]=Z*d+re*w+se*L+he*ee,i[12]=(Z=r[12])*s+(re=r[13])*f+(se=r[14])*E+(he=r[15])*N,i[13]=Z*l+re*g+se*C+he*O,i[14]=Z*u+re*b+se*M+he*W,i[15]=Z*d+re*w+se*L+he*ee,i}Math.hypot||(Math.hypot=function(){for(var i=0,e=arguments.length;e--;)i+=arguments[e]*arguments[e];return Math.sqrt(i)});var ao,im=vu;function xl(i,e,r){var s=e[0],l=e[1],u=e[2],d=e[3];return i[0]=r[0]*s+r[4]*l+r[8]*u+r[12]*d,i[1]=r[1]*s+r[5]*l+r[9]*u+r[13]*d,i[2]=r[2]*s+r[6]*l+r[10]*u+r[14]*d,i[3]=r[3]*s+r[7]*l+r[11]*u+r[15]*d,i}function bu(i,e){const r=xl([],[i.x,i.y,0,1],e);return new ve(r[0]/r[3],r[1]/r[3])}ao=new aa(4),aa!=Float32Array&&(ao[0]=0,ao[1]=0,ao[2]=0,ao[3]=0);class wu extends gc{}let Tu;De("HeatmapBucket",wu,{omit:["layers"]});var rm={get paint(){return Tu=Tu||new ki({"heatmap-radius":new Ze(oe.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Ze(oe.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Ue(oe.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Qa(oe.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Ue(oe.paint_heatmap["heatmap-opacity"])})}};function vc(i,{width:e,height:r},s,l){if(l){if(l instanceof Uint8ClampedArray)l=new Uint8Array(l.buffer);else if(l.length!==e*r*s)throw new RangeError(`mismatched image size. expected: ${l.length} but got: ${e*r*s}`)}else l=new Uint8Array(e*r*s);return i.width=e,i.height=r,i.data=l,i}function Su(i,{width:e,height:r},s){if(e===i.width&&r===i.height)return;const l=vc({},{width:e,height:r},s);bc(i,l,{x:0,y:0},{x:0,y:0},{width:Math.min(i.width,e),height:Math.min(i.height,r)},s),i.width=e,i.height=r,i.data=l.data}function bc(i,e,r,s,l,u){if(l.width===0||l.height===0)return e;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>e.width||l.height>e.height||s.x>e.width-l.width||s.y>e.height-l.height)throw new RangeError("out of range destination coordinates for image copy");const d=i.data,f=e.data;if(d===f)throw new Error("srcData equals dstData, so image is already copied");for(let g=0;g<l.height;g++){const b=((r.y+g)*i.width+r.x)*u,w=((s.y+g)*e.width+s.x)*u;for(let E=0;E<l.width*u;E++)f[w+E]=d[b+E]}return e}class oo{constructor(e,r){vc(this,e,1,r)}resize(e){Su(this,e,1)}clone(){return new oo({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,s,l,u){bc(e,r,s,l,u,1)}}class nr{constructor(e,r){vc(this,e,4,r)}resize(e){Su(this,e,4)}replace(e,r){r?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new nr({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,s,l,u){bc(e,r,s,l,u,4)}}function Eu(i){const e={},r=i.resolution||256,s=i.clips?i.clips.length:1,l=i.image||new nr({width:r,height:s});if(Math.log(r)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${r}`);const u=(d,f,g)=>{e[i.evaluationKey]=g;const b=i.expression.evaluate(e);l.data[d+f+0]=Math.floor(255*b.r/b.a),l.data[d+f+1]=Math.floor(255*b.g/b.a),l.data[d+f+2]=Math.floor(255*b.b/b.a),l.data[d+f+3]=Math.floor(255*b.a)};if(i.clips)for(let d=0,f=0;d<s;++d,f+=4*r)for(let g=0,b=0;g<r;g++,b+=4){const w=g/(r-1),{start:E,end:C}=i.clips[d];u(f,b,E*(1-w)+C*w)}else for(let d=0,f=0;d<r;d++,f+=4)u(0,f,d/(r-1));return l}let Iu;De("AlphaImage",oo),De("RGBAImage",nr);var nm={get paint(){return Iu=Iu||new ki({"hillshade-illumination-direction":new Ue(oe.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Ue(oe.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Ue(oe.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Ue(oe.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Ue(oe.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Ue(oe.paint_hillshade["hillshade-accent-color"])})}};const sm=Zt([{name:"a_pos",components:2,type:"Int16"}],4),{members:am}=sm;var wc={exports:{}};function vl(i,e,r){r=r||2;var s,l,u,d,f,g,b,w=e&&e.length,E=w?e[0]*r:i.length,C=Au(i,0,E,r,!0),M=[];if(!C||C.next===C.prev)return M;if(w&&(C=function(N,O,W,ee){var Z,re,se,he=[];for(Z=0,re=O.length;Z<re;Z++)(se=Au(N,O[Z]*ee,Z<re-1?O[Z+1]*ee:N.length,ee,!1))===se.next&&(se.steiner=!0),he.push(fm(se));for(he.sort(um),Z=0;Z<he.length;Z++)W=dm(he[Z],W);return W}(i,e,C,r)),i.length>80*r){s=u=i[0],l=d=i[1];for(var L=r;L<E;L+=r)(f=i[L])<s&&(s=f),(g=i[L+1])<l&&(l=g),f>u&&(u=f),g>d&&(d=g);b=(b=Math.max(u-s,d-l))!==0?32767/b:0}return lo(C,M,r,s,l,b,0),M}function Au(i,e,r,s,l){var u,d;if(l===Ec(i,e,r,s)>0)for(u=e;u<r;u+=s)d=Mu(u,i[u],i[u+1],d);else for(u=r-s;u>=e;u-=s)d=Mu(u,i[u],i[u+1],d);return d&&bl(d,d.next)&&(ho(d),d=d.next),d}function fs(i,e){if(!i)return i;e||(e=i);var r,s=i;do if(r=!1,s.steiner||!bl(s,s.next)&&jt(s.prev,s,s.next)!==0)s=s.next;else{if(ho(s),(s=e=s.prev)===s.next)break;r=!0}while(r||s!==e);return e}function lo(i,e,r,s,l,u,d){if(i){!d&&u&&function(w,E,C,M){var L=w;do L.z===0&&(L.z=Tc(L.x,L.y,E,C,M)),L.prevZ=L.prev,L.nextZ=L.next,L=L.next;while(L!==w);L.prevZ.nextZ=null,L.prevZ=null,function(N){var O,W,ee,Z,re,se,he,Le,Re=1;do{for(W=N,N=null,re=null,se=0;W;){for(se++,ee=W,he=0,O=0;O<Re&&(he++,ee=ee.nextZ);O++);for(Le=Re;he>0||Le>0&&ee;)he!==0&&(Le===0||!ee||W.z<=ee.z)?(Z=W,W=W.nextZ,he--):(Z=ee,ee=ee.nextZ,Le--),re?re.nextZ=Z:N=Z,Z.prevZ=re,re=Z;W=ee}re.nextZ=null,Re*=2}while(se>1)}(L)}(i,s,l,u);for(var f,g,b=i;i.prev!==i.next;)if(f=i.prev,g=i.next,u?lm(i,s,l,u):om(i))e.push(f.i/r|0),e.push(i.i/r|0),e.push(g.i/r|0),ho(i),i=g.next,b=g.next;else if((i=g)===b){d?d===1?lo(i=cm(fs(i),e,r),e,r,s,l,u,2):d===2&&hm(i,e,r,s,l,u):lo(fs(i),e,r,s,l,u,1);break}}}function om(i){var e=i.prev,r=i,s=i.next;if(jt(e,r,s)>=0)return!1;for(var l=e.x,u=r.x,d=s.x,f=e.y,g=r.y,b=s.y,w=l<u?l<d?l:d:u<d?u:d,E=f<g?f<b?f:b:g<b?g:b,C=l>u?l>d?l:d:u>d?u:d,M=f>g?f>b?f:b:g>b?g:b,L=s.next;L!==e;){if(L.x>=w&&L.x<=C&&L.y>=E&&L.y<=M&&oa(l,f,u,g,d,b,L.x,L.y)&&jt(L.prev,L,L.next)>=0)return!1;L=L.next}return!0}function lm(i,e,r,s){var l=i.prev,u=i,d=i.next;if(jt(l,u,d)>=0)return!1;for(var f=l.x,g=u.x,b=d.x,w=l.y,E=u.y,C=d.y,M=f<g?f<b?f:b:g<b?g:b,L=w<E?w<C?w:C:E<C?E:C,N=f>g?f>b?f:b:g>b?g:b,O=w>E?w>C?w:C:E>C?E:C,W=Tc(M,L,e,r,s),ee=Tc(N,O,e,r,s),Z=i.prevZ,re=i.nextZ;Z&&Z.z>=W&&re&&re.z<=ee;){if(Z.x>=M&&Z.x<=N&&Z.y>=L&&Z.y<=O&&Z!==l&&Z!==d&&oa(f,w,g,E,b,C,Z.x,Z.y)&&jt(Z.prev,Z,Z.next)>=0||(Z=Z.prevZ,re.x>=M&&re.x<=N&&re.y>=L&&re.y<=O&&re!==l&&re!==d&&oa(f,w,g,E,b,C,re.x,re.y)&&jt(re.prev,re,re.next)>=0))return!1;re=re.nextZ}for(;Z&&Z.z>=W;){if(Z.x>=M&&Z.x<=N&&Z.y>=L&&Z.y<=O&&Z!==l&&Z!==d&&oa(f,w,g,E,b,C,Z.x,Z.y)&&jt(Z.prev,Z,Z.next)>=0)return!1;Z=Z.prevZ}for(;re&&re.z<=ee;){if(re.x>=M&&re.x<=N&&re.y>=L&&re.y<=O&&re!==l&&re!==d&&oa(f,w,g,E,b,C,re.x,re.y)&&jt(re.prev,re,re.next)>=0)return!1;re=re.nextZ}return!0}function cm(i,e,r){var s=i;do{var l=s.prev,u=s.next.next;!bl(l,u)&&Cu(l,s,s.next,u)&&co(l,u)&&co(u,l)&&(e.push(l.i/r|0),e.push(s.i/r|0),e.push(u.i/r|0),ho(s),ho(s.next),s=i=u),s=s.next}while(s!==i);return fs(s)}function hm(i,e,r,s,l,u){var d=i;do{for(var f=d.next.next;f!==d.prev;){if(d.i!==f.i&&mm(d,f)){var g=Pu(d,f);return d=fs(d,d.next),g=fs(g,g.next),lo(d,e,r,s,l,u,0),void lo(g,e,r,s,l,u,0)}f=f.next}d=d.next}while(d!==i)}function um(i,e){return i.x-e.x}function dm(i,e){var r=function(l,u){var d,f=u,g=l.x,b=l.y,w=-1/0;do{if(b<=f.y&&b>=f.next.y&&f.next.y!==f.y){var E=f.x+(b-f.y)*(f.next.x-f.x)/(f.next.y-f.y);if(E<=g&&E>w&&(w=E,d=f.x<f.next.x?f:f.next,E===g))return d}f=f.next}while(f!==u);if(!d)return null;var C,M=d,L=d.x,N=d.y,O=1/0;f=d;do g>=f.x&&f.x>=L&&g!==f.x&&oa(b<N?g:w,b,L,N,b<N?w:g,b,f.x,f.y)&&(C=Math.abs(b-f.y)/(g-f.x),co(f,l)&&(C<O||C===O&&(f.x>d.x||f.x===d.x&&pm(d,f)))&&(d=f,O=C)),f=f.next;while(f!==M);return d}(i,e);if(!r)return e;var s=Pu(r,i);return fs(s,s.next),fs(r,r.next)}function pm(i,e){return jt(i.prev,i,e.prev)<0&&jt(e.next,i,i.next)<0}function Tc(i,e,r,s,l){return(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=(i-r)*l|0)|i<<8))|i<<4))|i<<2))|i<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-s)*l|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function fm(i){var e=i,r=i;do(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next;while(e!==i);return r}function oa(i,e,r,s,l,u,d,f){return(l-d)*(e-f)>=(i-d)*(u-f)&&(i-d)*(s-f)>=(r-d)*(e-f)&&(r-d)*(u-f)>=(l-d)*(s-f)}function mm(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!function(r,s){var l=r;do{if(l.i!==r.i&&l.next.i!==r.i&&l.i!==s.i&&l.next.i!==s.i&&Cu(l,l.next,r,s))return!0;l=l.next}while(l!==r);return!1}(i,e)&&(co(i,e)&&co(e,i)&&function(r,s){var l=r,u=!1,d=(r.x+s.x)/2,f=(r.y+s.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&&(u=!u),l=l.next;while(l!==r);return u}(i,e)&&(jt(i.prev,i,e.prev)||jt(i,e.prev,e))||bl(i,e)&&jt(i.prev,i,i.next)>0&&jt(e.prev,e,e.next)>0)}function jt(i,e,r){return(e.y-i.y)*(r.x-e.x)-(e.x-i.x)*(r.y-e.y)}function bl(i,e){return i.x===e.x&&i.y===e.y}function Cu(i,e,r,s){var l=Tl(jt(i,e,r)),u=Tl(jt(i,e,s)),d=Tl(jt(r,s,i)),f=Tl(jt(r,s,e));return l!==u&&d!==f||!(l!==0||!wl(i,r,e))||!(u!==0||!wl(i,s,e))||!(d!==0||!wl(r,i,s))||!(f!==0||!wl(r,e,s))}function wl(i,e,r){return e.x<=Math.max(i.x,r.x)&&e.x>=Math.min(i.x,r.x)&&e.y<=Math.max(i.y,r.y)&&e.y>=Math.min(i.y,r.y)}function Tl(i){return i>0?1:i<0?-1:0}function co(i,e){return jt(i.prev,i,i.next)<0?jt(i,e,i.next)>=0&&jt(i,i.prev,e)>=0:jt(i,e,i.prev)<0||jt(i,i.next,e)<0}function Pu(i,e){var r=new Sc(i.i,i.x,i.y),s=new Sc(e.i,e.x,e.y),l=i.next,u=e.prev;return i.next=e,e.prev=i,r.next=l,l.prev=r,s.next=r,r.prev=s,u.next=s,s.prev=u,s}function Mu(i,e,r,s){var l=new Sc(i,e,r);return s?(l.next=s.next,l.prev=s,s.next.prev=l,s.next=l):(l.prev=l,l.next=l),l}function ho(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 Sc(i,e,r){this.i=i,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Ec(i,e,r,s){for(var l=0,u=e,d=r-s;u<r;u+=s)l+=(i[d]-i[u])*(i[u+1]+i[d+1]),d=u;return l}wc.exports=vl,wc.exports.default=vl,vl.deviation=function(i,e,r,s){var l=e&&e.length,u=Math.abs(Ec(i,0,l?e[0]*r:i.length,r));if(l)for(var d=0,f=e.length;d<f;d++)u-=Math.abs(Ec(i,e[d]*r,d<f-1?e[d+1]*r:i.length,r));var g=0;for(d=0;d<s.length;d+=3){var b=s[d]*r,w=s[d+1]*r,E=s[d+2]*r;g+=Math.abs((i[b]-i[E])*(i[w+1]-i[b+1])-(i[b]-i[w])*(i[E+1]-i[b+1]))}return u===0&&g===0?0:Math.abs((g-u)/u)},vl.flatten=function(i){for(var e=i[0][0].length,r={vertices:[],holes:[],dimensions:e},s=0,l=0;l<i.length;l++){for(var u=0;u<i[l].length;u++)for(var d=0;d<e;d++)r.vertices.push(i[l][u][d]);l>0&&r.holes.push(s+=i[l-1].length)}return r};var ku=me(wc.exports);function gm(i,e,r,s,l){zu(i,e,r||0,s||i.length-1,l||_m)}function zu(i,e,r,s,l){for(;s>r;){if(s-r>600){var u=s-r+1,d=e-r+1,f=Math.log(u),g=.5*Math.exp(2*f/3),b=.5*Math.sqrt(f*g*(u-g)/u)*(d-u/2<0?-1:1);zu(i,e,Math.max(r,Math.floor(e-d*g/u+b)),Math.min(s,Math.floor(e+(u-d)*g/u+b)),l)}var w=i[e],E=r,C=s;for(uo(i,r,e),l(i[s],w)>0&&uo(i,r,s);E<C;){for(uo(i,E,C),E++,C--;l(i[E],w)<0;)E++;for(;l(i[C],w)>0;)C--}l(i[r],w)===0?uo(i,r,C):uo(i,++C,s),C<=e&&(r=C+1),e<=C&&(s=C-1)}}function uo(i,e,r){var s=i[e];i[e]=i[r],i[r]=s}function _m(i,e){return i<e?-1:i>e?1:0}function Ic(i,e){const r=i.length;if(r<=1)return[i];const s=[];let l,u;for(let d=0;d<r;d++){const f=xa(i[d]);f!==0&&(i[d].area=Math.abs(f),u===void 0&&(u=f<0),u===f<0?(l&&s.push(l),l=[i[d]]):l.push(i[d]))}if(l&&s.push(l),e>1)for(let d=0;d<s.length;d++)s[d].length<=e||(gm(s[d],e,1,s[d].length-1,ym),s[d]=s[d].slice(0,e));return s}function ym(i,e){return e.area-i.area}function Ac(i,e,r){const s=r.patternDependencies;let l=!1;for(const u of e){const d=u.paint.get(`${i}-pattern`);d.isConstant()||(l=!0);const f=d.constantOr(null);f&&(l=!0,s[f.to]=!0,s[f.from]=!0)}return l}function Cc(i,e,r,s,l){const u=l.patternDependencies;for(const d of e){const f=d.paint.get(`${i}-pattern`).value;if(f.kind!=="constant"){let g=f.evaluate({zoom:s-1},r,{},l.availableImages),b=f.evaluate({zoom:s},r,{},l.availableImages),w=f.evaluate({zoom:s+1},r,{},l.availableImages);g=g&&g.name?g.name:g,b=b&&b.name?b.name:b,w=w&&w.name?w.name:w,u[g]=!0,u[b]=!0,u[w]=!0,r.patterns[d.id]={min:g,mid:b,max:w}}}return r}class Pc{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new F,this.indexArray=new ge,this.indexArray2=new ke,this.programConfigurations=new Pr(e.layers,e.zoom),this.segments=new we,this.segments2=new we,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,s){this.hasPattern=Ac("fill",this.layers,r);const l=this.layers[0].layout.get("fill-sort-key"),u=!l.isConstant(),d=[];for(const{feature:f,id:g,index:b,sourceLayerIndex:w}of e){const E=this.layers[0]._featureFilter.needGeometry,C=ps(f,E);if(!this.layers[0]._featureFilter.filter(new Ct(this.zoom),C,s))continue;const M=u?l.evaluate(C,{},s,r.availableImages):void 0,L={id:g,properties:f.properties,type:f.type,sourceLayerIndex:w,index:b,geometry:E?C.geometry:Mr(f),patterns:{},sortKey:M};d.push(L)}u&&d.sort((f,g)=>f.sortKey-g.sortKey);for(const f of d){const{geometry:g,index:b,sourceLayerIndex:w}=f;if(this.hasPattern){const E=Cc("fill",this.layers,f,this.zoom,r);this.patternFeatures.push(E)}else this.addFeature(f,g,b,s,{});r.featureIndex.insert(e[b].feature,g,b,w,this.index)}}update(e,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,s)}addFeatures(e,r,s){for(const l of this.patternFeatures)this.addFeature(l,l.geometry,l.index,r,s)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,am),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),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(e,r,s,l,u){for(const d of Ic(r,500)){let f=0;for(const M of d)f+=M.length;const g=this.segments.prepareSegment(f,this.layoutVertexArray,this.indexArray),b=g.vertexLength,w=[],E=[];for(const M of d){if(M.length===0)continue;M!==d[0]&&E.push(w.length/2);const L=this.segments2.prepareSegment(M.length,this.layoutVertexArray,this.indexArray2),N=L.vertexLength;this.layoutVertexArray.emplaceBack(M[0].x,M[0].y),this.indexArray2.emplaceBack(N+M.length-1,N),w.push(M[0].x),w.push(M[0].y);for(let O=1;O<M.length;O++)this.layoutVertexArray.emplaceBack(M[O].x,M[O].y),this.indexArray2.emplaceBack(N+O-1,N+O),w.push(M[O].x),w.push(M[O].y);L.vertexLength+=M.length,L.primitiveLength+=M.length}const C=ku(w,E);for(let M=0;M<C.length;M+=3)this.indexArray.emplaceBack(b+C[M],b+C[M+1],b+C[M+2]);g.vertexLength+=f,g.primitiveLength+=C.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,u,l)}}let Lu,Du;De("FillBucket",Pc,{omit:["layers","patternFeatures"]});var xm={get paint(){return Du=Du||new ki({"fill-antialias":new Ue(oe.paint_fill["fill-antialias"]),"fill-opacity":new Ze(oe.paint_fill["fill-opacity"]),"fill-color":new Ze(oe.paint_fill["fill-color"]),"fill-outline-color":new Ze(oe.paint_fill["fill-outline-color"]),"fill-translate":new Ue(oe.paint_fill["fill-translate"]),"fill-translate-anchor":new Ue(oe.paint_fill["fill-translate-anchor"]),"fill-pattern":new cs(oe.paint_fill["fill-pattern"])})},get layout(){return Lu=Lu||new ki({"fill-sort-key":new Ze(oe.layout_fill["fill-sort-key"])})}};const vm=Zt([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),bm=Zt([{name:"a_centroid",components:2,type:"Int16"}],4),{members:wm}=vm;var Ln={},Tm=Q,Ru=la;function la(i,e,r,s,l){this.properties={},this.extent=r,this.type=0,this._pbf=i,this._geometry=-1,this._keys=s,this._values=l,i.readFields(Sm,this,e)}function Sm(i,e,r){i==1?e.id=r.readVarint():i==2?function(s,l){for(var u=s.readVarint()+s.pos;s.pos<u;){var d=l._keys[s.readVarint()],f=l._values[s.readVarint()];l.properties[d]=f}}(r,e):i==3?e.type=r.readVarint():i==4&&(e._geometry=r.pos)}function Em(i){for(var e,r,s=0,l=0,u=i.length,d=u-1;l<u;d=l++)s+=((r=i[d]).x-(e=i[l]).x)*(e.y+r.y);return s}la.types=["Unknown","Point","LineString","Polygon"],la.prototype.loadGeometry=function(){var i=this._pbf;i.pos=this._geometry;for(var e,r=i.readVarint()+i.pos,s=1,l=0,u=0,d=0,f=[];i.pos<r;){if(l<=0){var g=i.readVarint();s=7&g,l=g>>3}if(l--,s===1||s===2)u+=i.readSVarint(),d+=i.readSVarint(),s===1&&(e&&f.push(e),e=[]),e.push(new Tm(u,d));else{if(s!==7)throw new Error("unknown command "+s);e&&e.push(e[0].clone())}}return e&&f.push(e),f},la.prototype.bbox=function(){var i=this._pbf;i.pos=this._geometry;for(var e=i.readVarint()+i.pos,r=1,s=0,l=0,u=0,d=1/0,f=-1/0,g=1/0,b=-1/0;i.pos<e;){if(s<=0){var w=i.readVarint();r=7&w,s=w>>3}if(s--,r===1||r===2)(l+=i.readSVarint())<d&&(d=l),l>f&&(f=l),(u+=i.readSVarint())<g&&(g=u),u>b&&(b=u);else if(r!==7)throw new Error("unknown command "+r)}return[d,g,f,b]},la.prototype.toGeoJSON=function(i,e,r){var s,l,u=this.extent*Math.pow(2,r),d=this.extent*i,f=this.extent*e,g=this.loadGeometry(),b=la.types[this.type];function w(M){for(var L=0;L<M.length;L++){var N=M[L];M[L]=[360*(N.x+d)/u-180,360/Math.PI*Math.atan(Math.exp((180-360*(N.y+f)/u)*Math.PI/180))-90]}}switch(this.type){case 1:var E=[];for(s=0;s<g.length;s++)E[s]=g[s][0];w(g=E);break;case 2:for(s=0;s<g.length;s++)w(g[s]);break;case 3:for(g=function(M){var L=M.length;if(L<=1)return[M];for(var N,O,W=[],ee=0;ee<L;ee++){var Z=Em(M[ee]);Z!==0&&(O===void 0&&(O=Z<0),O===Z<0?(N&&W.push(N),N=[M[ee]]):N.push(M[ee]))}return N&&W.push(N),W}(g),s=0;s<g.length;s++)for(l=0;l<g[s].length;l++)w(g[s][l])}g.length===1?g=g[0]:b="Multi"+b;var C={type:"Feature",geometry:{type:b,coordinates:g},properties:this.properties};return"id"in this&&(C.id=this.id),C};var Im=Ru,Bu=Fu;function Fu(i,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=i,this._keys=[],this._values=[],this._features=[],i.readFields(Am,this,e),this.length=this._features.length}function Am(i,e,r){i===15?e.version=r.readVarint():i===1?e.name=r.readString():i===5?e.extent=r.readVarint():i===2?e._features.push(r.pos):i===3?e._keys.push(r.readString()):i===4&&e._values.push(function(s){for(var l=null,u=s.readVarint()+s.pos;s.pos<u;){var d=s.readVarint()>>3;l=d===1?s.readString():d===2?s.readFloat():d===3?s.readDouble():d===4?s.readVarint64():d===5?s.readVarint():d===6?s.readSVarint():d===7?s.readBoolean():null}return l}(r))}Fu.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 e=this._pbf.readVarint()+this._pbf.pos;return new Im(this._pbf,e,this.extent,this._keys,this._values)};var Cm=Bu;function Pm(i,e,r){if(i===3){var s=new Cm(r,r.readVarint()+r.pos);s.length&&(e[s.name]=s)}}Ln.VectorTile=function(i,e){this.layers=i.readFields(Pm,{},e)},Ln.VectorTileFeature=Ru,Ln.VectorTileLayer=Bu;const Mm=Ln.VectorTileFeature.types,Mc=Math.pow(2,13);function po(i,e,r,s,l,u,d,f){i.emplaceBack(e,r,2*Math.floor(s*Mc)+d,l*Mc*2,u*Mc*2,Math.round(f))}class kc{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new j,this.centroidVertexArray=new U,this.indexArray=new ge,this.programConfigurations=new Pr(e.layers,e.zoom),this.segments=new we,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,s){this.features=[],this.hasPattern=Ac("fill-extrusion",this.layers,r);for(const{feature:l,id:u,index:d,sourceLayerIndex:f}of e){const g=this.layers[0]._featureFilter.needGeometry,b=ps(l,g);if(!this.layers[0]._featureFilter.filter(new Ct(this.zoom),b,s))continue;const w={id:u,sourceLayerIndex:f,index:d,geometry:g?b.geometry:Mr(l),properties:l.properties,type:l.type,patterns:{}};this.hasPattern?this.features.push(Cc("fill-extrusion",this.layers,w,this.zoom,r)):this.addFeature(w,w.geometry,d,s,{}),r.featureIndex.insert(l,w.geometry,d,f,this.index,!0)}}addFeatures(e,r,s){for(const l of this.features){const{geometry:u}=l;this.addFeature(l,u,l.index,r,s)}}update(e,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,s)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,wm),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,bm.members,!0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(e,r,s,l,u){const d={x:0,y:0,vertexCount:0};for(const f of Ic(r,500)){let g=0;for(const L of f)g+=L.length;let b=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const L of f){if(L.length===0||zm(L))continue;let N=0;for(let O=0;O<L.length;O++){const W=L[O];if(O>=1){const ee=L[O-1];if(!km(W,ee)){b.vertexLength+4>we.MAX_VERTEX_ARRAY_LENGTH&&(b=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const Z=W.sub(ee)._perp()._unit(),re=ee.dist(W);N+re>32768&&(N=0),po(this.layoutVertexArray,W.x,W.y,Z.x,Z.y,0,0,N),po(this.layoutVertexArray,W.x,W.y,Z.x,Z.y,0,1,N),d.x+=2*W.x,d.y+=2*W.y,d.vertexCount+=2,N+=re,po(this.layoutVertexArray,ee.x,ee.y,Z.x,Z.y,0,0,N),po(this.layoutVertexArray,ee.x,ee.y,Z.x,Z.y,0,1,N),d.x+=2*ee.x,d.y+=2*ee.y,d.vertexCount+=2;const se=b.vertexLength;this.indexArray.emplaceBack(se,se+2,se+1),this.indexArray.emplaceBack(se+1,se+2,se+3),b.vertexLength+=4,b.primitiveLength+=2}}}}if(b.vertexLength+g>we.MAX_VERTEX_ARRAY_LENGTH&&(b=this.segments.prepareSegment(g,this.layoutVertexArray,this.indexArray)),Mm[e.type]!=="Polygon")continue;const w=[],E=[],C=b.vertexLength;for(const L of f)if(L.length!==0){L!==f[0]&&E.push(w.length/2);for(let N=0;N<L.length;N++){const O=L[N];po(this.layoutVertexArray,O.x,O.y,0,0,1,1,0),d.x+=O.x,d.y+=O.y,d.vertexCount+=1,w.push(O.x),w.push(O.y)}}const M=ku(w,E);for(let L=0;L<M.length;L+=3)this.indexArray.emplaceBack(C+M[L],C+M[L+2],C+M[L+1]);b.primitiveLength+=M.length/3,b.vertexLength+=g}for(let f=0;f<d.vertexCount;f++)this.centroidVertexArray.emplaceBack(Math.floor(d.x/d.vertexCount),Math.floor(d.y/d.vertexCount));this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,u,l)}}function km(i,e){return i.x===e.x&&(i.x<0||i.x>Pt)||i.y===e.y&&(i.y<0||i.y>Pt)}function zm(i){return i.every(e=>e.x<0)||i.every(e=>e.x>Pt)||i.every(e=>e.y<0)||i.every(e=>e.y>Pt)}let Ou;De("FillExtrusionBucket",kc,{omit:["layers","features"]});var Lm={get paint(){return Ou=Ou||new ki({"fill-extrusion-opacity":new Ue(oe["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Ze(oe["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Ue(oe["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Ue(oe["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new cs(oe["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Ze(oe["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Ze(oe["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Ue(oe["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};function fo(i,e){return i.x*e.x+i.y*e.y}function Uu(i,e){if(i.length===1){let r=0;const s=e[r++];let l;for(;!l||s.equals(l);)if(l=e[r++],!l)return 1/0;for(;r<e.length;r++){const u=e[r],d=i[0],f=l.sub(s),g=u.sub(s),b=d.sub(s),w=fo(f,f),E=fo(f,g),C=fo(g,g),M=fo(b,f),L=fo(b,g),N=w*C-E*E,O=(C*M-E*L)/N,W=(w*L-E*M)/N,ee=s.z*(1-O-W)+l.z*O+u.z*W;if(isFinite(ee))return ee}return 1/0}{let r=1/0;for(const s of e)r=Math.min(r,s.z);return r}}const Dm=Zt([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:Rm}=Dm,Bm=Zt([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:Fm}=Bm,Om=Ln.VectorTileFeature.types,Um=Math.cos(Math.PI/180*37.5),Nu=Math.pow(2,14)/.5;class zc{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(r=>{this.gradients[r.id]={}}),this.layoutVertexArray=new X,this.layoutVertexArray2=new ne,this.indexArray=new ge,this.programConfigurations=new Pr(e.layers,e.zoom),this.segments=new we,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,s){this.hasPattern=Ac("line",this.layers,r);const l=this.layers[0].layout.get("line-sort-key"),u=!l.isConstant(),d=[];for(const{feature:f,id:g,index:b,sourceLayerIndex:w}of e){const E=this.layers[0]._featureFilter.needGeometry,C=ps(f,E);if(!this.layers[0]._featureFilter.filter(new Ct(this.zoom),C,s))continue;const M=u?l.evaluate(C,{},s):void 0,L={id:g,properties:f.properties,type:f.type,sourceLayerIndex:w,index:b,geometry:E?C.geometry:Mr(f),patterns:{},sortKey:M};d.push(L)}u&&d.sort((f,g)=>f.sortKey-g.sortKey);for(const f of d){const{geometry:g,index:b,sourceLayerIndex:w}=f;if(this.hasPattern){const E=Cc("line",this.layers,f,this.zoom,r);this.patternFeatures.push(E)}else this.addFeature(f,g,b,s,{});r.featureIndex.insert(e[b].feature,g,b,w,this.index)}}update(e,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,s)}addFeatures(e,r,s){for(const l of this.patternFeatures)this.addFeature(l,l.geometry,l.index,r,s)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,Fm)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Rm),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,r,s,l,u){const d=this.layers[0].layout,f=d.get("line-join").evaluate(e,{}),g=d.get("line-cap"),b=d.get("line-miter-limit"),w=d.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const E of r)this.addLine(E,e,f,g,b,w);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,u,l)}addLine(e,r,s,l,u,d){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let W=0;W<e.length-1;W++)this.totalDistance+=e[W].dist(e[W+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const f=Om[r.type]==="Polygon";let g=e.length;for(;g>=2&&e[g-1].equals(e[g-2]);)g--;let b=0;for(;b<g-1&&e[b].equals(e[b+1]);)b++;if(g<(f?3:2))return;s==="bevel"&&(u=1.05);const w=this.overscaling<=16?122880/(512*this.overscaling):0,E=this.segments.prepareSegment(10*g,this.layoutVertexArray,this.indexArray);let C,M,L,N,O;this.e1=this.e2=-1,f&&(C=e[g-2],O=e[b].sub(C)._unit()._perp());for(let W=b;W<g;W++){if(L=W===g-1?f?e[b+1]:void 0:e[W+1],L&&e[W].equals(L))continue;O&&(N=O),C&&(M=C),C=e[W],O=L?L.sub(C)._unit()._perp():N,N=N||O;let ee=N.add(O);ee.x===0&&ee.y===0||ee._unit();const Z=N.x*O.x+N.y*O.y,re=ee.x*O.x+ee.y*O.y,se=re!==0?1/re:1/0,he=2*Math.sqrt(2-2*re),Le=re<Um&&M&&L,Re=N.x*O.y-N.y*O.x>0;if(Le&&W>b){const be=C.dist(M);if(be>2*w){const Me=C.sub(C.sub(M)._mult(w/be)._round());this.updateDistance(M,Me),this.addCurrentVertex(Me,N,0,0,E),M=Me}}const Pe=M&&L;let Ee=Pe?s:f?"butt":l;if(Pe&&Ee==="round"&&(se<d?Ee="miter":se<=2&&(Ee="fakeround")),Ee==="miter"&&se>u&&(Ee="bevel"),Ee==="bevel"&&(se>2&&(Ee="flipbevel"),se<u&&(Ee="miter")),M&&this.updateDistance(M,C),Ee==="miter")ee._mult(se),this.addCurrentVertex(C,ee,0,0,E);else if(Ee==="flipbevel"){if(se>100)ee=O.mult(-1);else{const be=se*N.add(O).mag()/N.sub(O).mag();ee._perp()._mult(be*(Re?-1:1))}this.addCurrentVertex(C,ee,0,0,E),this.addCurrentVertex(C,ee.mult(-1),0,0,E)}else if(Ee==="bevel"||Ee==="fakeround"){const be=-Math.sqrt(se*se-1),Me=Re?be:0,Ae=Re?0:be;if(M&&this.addCurrentVertex(C,N,Me,Ae,E),Ee==="fakeround"){const ye=Math.round(180*he/Math.PI/20);for(let je=1;je<ye;je++){let Fe=je/ye;if(Fe!==.5){const Et=Fe-.5;Fe+=Fe*Et*(Fe-1)*((1.0904+Z*(Z*(3.55645-1.43519*Z)-3.2452))*Et*Et+(.848013+Z*(.215638*Z-1.06021)))}const nt=O.sub(N)._mult(Fe)._add(N)._unit()._mult(Re?-1:1);this.addHalfVertex(C,nt.x,nt.y,!1,Re,0,E)}}L&&this.addCurrentVertex(C,O,-Me,-Ae,E)}else if(Ee==="butt")this.addCurrentVertex(C,ee,0,0,E);else if(Ee==="square"){const be=M?1:-1;this.addCurrentVertex(C,ee,be,be,E)}else Ee==="round"&&(M&&(this.addCurrentVertex(C,N,0,0,E),this.addCurrentVertex(C,N,1,1,E,!0)),L&&(this.addCurrentVertex(C,O,-1,-1,E,!0),this.addCurrentVertex(C,O,0,0,E)));if(Le&&W<g-1){const be=C.dist(L);if(be>2*w){const Me=C.add(L.sub(C)._mult(w/be)._round());this.updateDistance(C,Me),this.addCurrentVertex(Me,O,0,0,E),C=Me}}}}addCurrentVertex(e,r,s,l,u,d=!1){const f=r.y*l-r.x,g=-r.y-r.x*l;this.addHalfVertex(e,r.x+r.y*s,r.y-r.x*s,d,!1,s,u),this.addHalfVertex(e,f,g,d,!0,-l,u),this.distance>Nu/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,r,s,l,u,d))}addHalfVertex({x:e,y:r},s,l,u,d,f,g){const b=.5*(this.lineClips?this.scaledDistance*(Nu-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(u?1:0),(r<<1)+(d?1:0),Math.round(63*s)+128,Math.round(63*l)+128,1+(f===0?0:f<0?-1:1)|(63&b)<<2,b>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const w=g.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,w),g.primitiveLength++),d?this.e2=w:this.e1=w}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,r){this.distance+=e.dist(r),this.updateScaledDistance()}}let Vu,$u;De("LineBucket",zc,{omit:["layers","patternFeatures"]});var ju={get paint(){return $u=$u||new ki({"line-opacity":new Ze(oe.paint_line["line-opacity"]),"line-color":new Ze(oe.paint_line["line-color"]),"line-translate":new Ue(oe.paint_line["line-translate"]),"line-translate-anchor":new Ue(oe.paint_line["line-translate-anchor"]),"line-width":new Ze(oe.paint_line["line-width"]),"line-gap-width":new Ze(oe.paint_line["line-gap-width"]),"line-offset":new Ze(oe.paint_line["line-offset"]),"line-blur":new Ze(oe.paint_line["line-blur"]),"line-dasharray":new Ja(oe.paint_line["line-dasharray"]),"line-pattern":new cs(oe.paint_line["line-pattern"]),"line-gradient":new Qa(oe.paint_line["line-gradient"])})},get layout(){return Vu=Vu||new ki({"line-cap":new Ue(oe.layout_line["line-cap"]),"line-join":new Ze(oe.layout_line["line-join"]),"line-miter-limit":new Ue(oe.layout_line["line-miter-limit"]),"line-round-limit":new Ue(oe.layout_line["line-round-limit"]),"line-sort-key":new Ze(oe.layout_line["line-sort-key"])})}};class Nm extends Ze{possiblyEvaluate(e,r){return r=new Ct(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),super.possiblyEvaluate(e,r)}evaluate(e,r,s,l){return r=_i({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(e,r,s,l)}}let Sl;function Gu(i,e){return e>0?e+2*i:i}const Vm=Zt([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),$m=Zt([{name:"a_projected_pos",components:3,type:"Float32"}],4);Zt([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const jm=Zt([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);Zt([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const qu=Zt([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Gm=Zt([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function qm(i,e,r){return i.sections.forEach(s=>{s.text=function(l,u,d){const f=u.layout.get("text-transform").evaluate(d,{});return f==="uppercase"?l=l.toLocaleUpperCase():f==="lowercase"&&(l=l.toLocaleLowerCase()),Ki.applyArabicShaping&&(l=Ki.applyArabicShaping(l)),l}(s.text,e,r)}),i}Zt([{name:"triangle",components:3,type:"Uint16"}]),Zt([{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"}]),Zt([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),Zt([{type:"Float32",name:"offsetX"}]),Zt([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);const mo={"!":"\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 ai=24,Zu=vt,Xu=function(i,e,r,s,l){var u,d,f=8*l-s-1,g=(1<<f)-1,b=g>>1,w=-7,E=r?l-1:0,C=r?-1:1,M=i[e+E];for(E+=C,u=M&(1<<-w)-1,M>>=-w,w+=f;w>0;u=256*u+i[e+E],E+=C,w-=8);for(d=u&(1<<-w)-1,u>>=-w,w+=s;w>0;d=256*d+i[e+E],E+=C,w-=8);if(u===0)u=1-b;else{if(u===g)return d?NaN:1/0*(M?-1:1);d+=Math.pow(2,s),u-=b}return(M?-1:1)*d*Math.pow(2,u-s)},Wu=function(i,e,r,s,l,u){var d,f,g,b=8*u-l-1,w=(1<<b)-1,E=w>>1,C=l===23?Math.pow(2,-24)-Math.pow(2,-77):0,M=s?0:u-1,L=s?1:-1,N=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(f=isNaN(e)?1:0,d=w):(d=Math.floor(Math.log(e)/Math.LN2),e*(g=Math.pow(2,-d))<1&&(d--,g*=2),(e+=d+E>=1?C/g:C*Math.pow(2,1-E))*g>=2&&(d++,g/=2),d+E>=w?(f=0,d=w):d+E>=1?(f=(e*g-1)*Math.pow(2,l),d+=E):(f=e*Math.pow(2,E-1)*Math.pow(2,l),d=0));l>=8;i[r+M]=255&f,M+=L,f/=256,l-=8);for(d=d<<l|f,b+=l;b>0;i[r+M]=255&d,M+=L,d/=256,b-=8);i[r+M-L]|=128*N};function vt(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}vt.Varint=0,vt.Fixed64=1,vt.Bytes=2,vt.Fixed32=5;var Lc=4294967296,Hu=1/Lc,Ku=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function ln(i){return i.type===vt.Bytes?i.readVarint()+i.pos:i.pos+1}function ca(i,e,r){return r?4294967296*e+(i>>>0):4294967296*(e>>>0)+(i>>>0)}function Yu(i,e,r){var s=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(s);for(var l=r.pos-1;l>=i;l--)r.buf[l+s]=r.buf[l]}function Zm(i,e){for(var r=0;r<i.length;r++)e.writeVarint(i[r])}function Xm(i,e){for(var r=0;r<i.length;r++)e.writeSVarint(i[r])}function Wm(i,e){for(var r=0;r<i.length;r++)e.writeFloat(i[r])}function Hm(i,e){for(var r=0;r<i.length;r++)e.writeDouble(i[r])}function Km(i,e){for(var r=0;r<i.length;r++)e.writeBoolean(i[r])}function Ym(i,e){for(var r=0;r<i.length;r++)e.writeFixed32(i[r])}function Jm(i,e){for(var r=0;r<i.length;r++)e.writeSFixed32(i[r])}function Qm(i,e){for(var r=0;r<i.length;r++)e.writeFixed64(i[r])}function eg(i,e){for(var r=0;r<i.length;r++)e.writeSFixed64(i[r])}function El(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+16777216*i[e+3]}function ha(i,e,r){i[r]=e,i[r+1]=e>>>8,i[r+2]=e>>>16,i[r+3]=e>>>24}function Ju(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+(i[e+3]<<24)}vt.prototype={destroy:function(){this.buf=null},readFields:function(i,e,r){for(r=r||this.length;this.pos<r;){var s=this.readVarint(),l=s>>3,u=this.pos;this.type=7&s,i(l,e,this),this.pos===u&&this.skip(s)}return e},readMessage:function(i,e){return this.readFields(i,e,this.readVarint()+this.pos)},readFixed32:function(){var i=El(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=Ju(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=El(this.buf,this.pos)+El(this.buf,this.pos+4)*Lc;return this.pos+=8,i},readSFixed64:function(){var i=El(this.buf,this.pos)+Ju(this.buf,this.pos+4)*Lc;return this.pos+=8,i},readFloat:function(){var i=Xu(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=Xu(this.buf,this.pos,!0,52,8);return this.pos+=8,i},readVarint:function(i){var e,r,s=this.buf;return e=127&(r=s[this.pos++]),r<128?e:(e|=(127&(r=s[this.pos++]))<<7,r<128?e:(e|=(127&(r=s[this.pos++]))<<14,r<128?e:(e|=(127&(r=s[this.pos++]))<<21,r<128?e:function(l,u,d){var f,g,b=d.buf;if(f=(112&(g=b[d.pos++]))>>4,g<128||(f|=(127&(g=b[d.pos++]))<<3,g<128)||(f|=(127&(g=b[d.pos++]))<<10,g<128)||(f|=(127&(g=b[d.pos++]))<<17,g<128)||(f|=(127&(g=b[d.pos++]))<<24,g<128)||(f|=(1&(g=b[d.pos++]))<<31,g<128))return ca(l,f,u);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=s[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,e=this.pos;return this.pos=i,i-e>=12&&Ku?function(r,s,l){return Ku.decode(r.subarray(s,l))}(this.buf,e,i):function(r,s,l){for(var u="",d=s;d<l;){var f,g,b,w=r[d],E=null,C=w>239?4:w>223?3:w>191?2:1;if(d+C>l)break;C===1?w<128&&(E=w):C===2?(192&(f=r[d+1]))==128&&(E=(31&w)<<6|63&f)<=127&&(E=null):C===3?(g=r[d+2],(192&(f=r[d+1]))==128&&(192&g)==128&&((E=(15&w)<<12|(63&f)<<6|63&g)<=2047||E>=55296&&E<=57343)&&(E=null)):C===4&&(g=r[d+2],b=r[d+3],(192&(f=r[d+1]))==128&&(192&g)==128&&(192&b)==128&&((E=(15&w)<<18|(63&f)<<12|(63&g)<<6|63&b)<=65535||E>=1114112)&&(E=null)),E===null?(E=65533,C=1):E>65535&&(E-=65536,u+=String.fromCharCode(E>>>10&1023|55296),E=56320|1023&E),u+=String.fromCharCode(E),d+=C}return u}(this.buf,e,i)},readBytes:function(){var i=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,i);return this.pos=i,e},readPackedVarint:function(i,e){if(this.type!==vt.Bytes)return i.push(this.readVarint(e));var r=ln(this);for(i=i||[];this.pos<r;)i.push(this.readVarint(e));return i},readPackedSVarint:function(i){if(this.type!==vt.Bytes)return i.push(this.readSVarint());var e=ln(this);for(i=i||[];this.pos<e;)i.push(this.readSVarint());return i},readPackedBoolean:function(i){if(this.type!==vt.Bytes)return i.push(this.readBoolean());var e=ln(this);for(i=i||[];this.pos<e;)i.push(this.readBoolean());return i},readPackedFloat:function(i){if(this.type!==vt.Bytes)return i.push(this.readFloat());var e=ln(this);for(i=i||[];this.pos<e;)i.push(this.readFloat());return i},readPackedDouble:function(i){if(this.type!==vt.Bytes)return i.push(this.readDouble());var e=ln(this);for(i=i||[];this.pos<e;)i.push(this.readDouble());return i},readPackedFixed32:function(i){if(this.type!==vt.Bytes)return i.push(this.readFixed32());var e=ln(this);for(i=i||[];this.pos<e;)i.push(this.readFixed32());return i},readPackedSFixed32:function(i){if(this.type!==vt.Bytes)return i.push(this.readSFixed32());var e=ln(this);for(i=i||[];this.pos<e;)i.push(this.readSFixed32());return i},readPackedFixed64:function(i){if(this.type!==vt.Bytes)return i.push(this.readFixed64());var e=ln(this);for(i=i||[];this.pos<e;)i.push(this.readFixed64());return i},readPackedSFixed64:function(i){if(this.type!==vt.Bytes)return i.push(this.readSFixed64());var e=ln(this);for(i=i||[];this.pos<e;)i.push(this.readSFixed64());return i},skip:function(i){var e=7&i;if(e===vt.Varint)for(;this.buf[this.pos++]>127;);else if(e===vt.Bytes)this.pos=this.readVarint()+this.pos;else if(e===vt.Fixed32)this.pos+=4;else{if(e!==vt.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(i,e){this.writeVarint(i<<3|e)},realloc:function(i){for(var e=this.length||16;e<this.pos+i;)e*=2;if(e!==this.length){var r=new Uint8Array(e);r.set(this.buf),this.buf=r,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(i){this.realloc(4),ha(this.buf,i,this.pos),this.pos+=4},writeSFixed32:function(i){this.realloc(4),ha(this.buf,i,this.pos),this.pos+=4},writeFixed64:function(i){this.realloc(8),ha(this.buf,-1&i,this.pos),ha(this.buf,Math.floor(i*Hu),this.pos+4),this.pos+=8},writeSFixed64:function(i){this.realloc(8),ha(this.buf,-1&i,this.pos),ha(this.buf,Math.floor(i*Hu),this.pos+4),this.pos+=8},writeVarint:function(i){(i=+i||0)>268435455||i<0?function(e,r){var s,l;if(e>=0?(s=e%4294967296|0,l=e/4294967296|0):(l=~(-e/4294967296),4294967295^(s=~(-e%4294967296))?s=s+1|0:(s=0,l=l+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");r.realloc(10),function(u,d,f){f.buf[f.pos++]=127&u|128,u>>>=7,f.buf[f.pos++]=127&u|128,u>>>=7,f.buf[f.pos++]=127&u|128,u>>>=7,f.buf[f.pos++]=127&u|128,f.buf[f.pos]=127&(u>>>=7)}(s,0,r),function(u,d){var f=(7&u)<<4;d.buf[d.pos++]|=f|((u>>>=3)?128:0),u&&(d.buf[d.pos++]=127&u|((u>>>=7)?128:0),u&&(d.buf[d.pos++]=127&u|((u>>>=7)?128:0),u&&(d.buf[d.pos++]=127&u|((u>>>=7)?128:0),u&&(d.buf[d.pos++]=127&u|((u>>>=7)?128:0),u&&(d.buf[d.pos++]=127&u)))))}(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 e=this.pos;this.pos=function(s,l,u){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?(s[u++]=239,s[u++]=191,s[u++]=189):f=d;continue}if(d<56320){s[u++]=239,s[u++]=191,s[u++]=189,f=d;continue}d=f-55296<<10|d-56320|65536,f=null}else f&&(s[u++]=239,s[u++]=191,s[u++]=189,f=null);d<128?s[u++]=d:(d<2048?s[u++]=d>>6|192:(d<65536?s[u++]=d>>12|224:(s[u++]=d>>18|240,s[u++]=d>>12&63|128),s[u++]=d>>6&63|128),s[u++]=63&d|128)}return u}(this.buf,i,this.pos);var r=this.pos-e;r>=128&&Yu(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(i){this.realloc(4),Wu(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),Wu(this.buf,i,this.pos,!0,52,8),this.pos+=8},writeBytes:function(i){var e=i.length;this.writeVarint(e),this.realloc(e);for(var r=0;r<e;r++)this.buf[this.pos++]=i[r]},writeRawMessage:function(i,e){this.pos++;var r=this.pos;i(e,this);var s=this.pos-r;s>=128&&Yu(r,s,this),this.pos=r-1,this.writeVarint(s),this.pos+=s},writeMessage:function(i,e,r){this.writeTag(i,vt.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(i,e){e.length&&this.writeMessage(i,Zm,e)},writePackedSVarint:function(i,e){e.length&&this.writeMessage(i,Xm,e)},writePackedBoolean:function(i,e){e.length&&this.writeMessage(i,Km,e)},writePackedFloat:function(i,e){e.length&&this.writeMessage(i,Wm,e)},writePackedDouble:function(i,e){e.length&&this.writeMessage(i,Hm,e)},writePackedFixed32:function(i,e){e.length&&this.writeMessage(i,Ym,e)},writePackedSFixed32:function(i,e){e.length&&this.writeMessage(i,Jm,e)},writePackedFixed64:function(i,e){e.length&&this.writeMessage(i,Qm,e)},writePackedSFixed64:function(i,e){e.length&&this.writeMessage(i,eg,e)},writeBytesField:function(i,e){this.writeTag(i,vt.Bytes),this.writeBytes(e)},writeFixed32Field:function(i,e){this.writeTag(i,vt.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(i,e){this.writeTag(i,vt.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(i,e){this.writeTag(i,vt.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(i,e){this.writeTag(i,vt.Fixed64),this.writeSFixed64(e)},writeVarintField:function(i,e){this.writeTag(i,vt.Varint),this.writeVarint(e)},writeSVarintField:function(i,e){this.writeTag(i,vt.Varint),this.writeSVarint(e)},writeStringField:function(i,e){this.writeTag(i,vt.Bytes),this.writeString(e)},writeFloatField:function(i,e){this.writeTag(i,vt.Fixed32),this.writeFloat(e)},writeDoubleField:function(i,e){this.writeTag(i,vt.Fixed64),this.writeDouble(e)},writeBooleanField:function(i,e){this.writeVarintField(i,!!e)}};var Dn,Dc=me(Zu);function tg(i,e,r){i===1&&r.readMessage(ig,e)}function ig(i,e,r){if(i===3){const{id:s,bitmap:l,width:u,height:d,left:f,top:g,advance:b}=r.readMessage(rg,{});e.push({id:s,bitmap:new oo({width:u+6,height:d+6},l),metrics:{width:u,height:d,left:f,top:g,advance:b}})}}function rg(i,e,r){i===1?e.id=r.readVarint():i===2?e.bitmap=r.readBytes():i===3?e.width=r.readVarint():i===4?e.height=r.readVarint():i===5?e.left=r.readSVarint():i===6?e.top=r.readSVarint():i===7&&(e.advance=r.readVarint())}function Qu(i){let e=0,r=0;for(const d of i)e+=d.w*d.h,r=Math.max(r,d.w);i.sort((d,f)=>f.h-d.h);const s=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}];let l=0,u=0;for(const d of i)for(let f=s.length-1;f>=0;f--){const g=s[f];if(!(d.w>g.w||d.h>g.h)){if(d.x=g.x,d.y=g.y,u=Math.max(u,d.y+d.h),l=Math.max(l,d.x+d.w),d.w===g.w&&d.h===g.h){const b=s.pop();f<s.length&&(s[f]=b)}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):(s.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:u,fill:e/(l*u)||0}}class Rc{constructor(e,{pixelRatio:r,version:s,stretchX:l,stretchY:u,content:d}){this.paddedRect=e,this.pixelRatio=r,this.stretchX=l,this.stretchY=u,this.content=d,this.version=s}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}class ed{constructor(e,r){const s={},l={};this.haveRenderCallbacks=[];const u=[];this.addImages(e,s,u),this.addImages(r,l,u);const{w:d,h:f}=Qu(u),g=new nr({width:d||1,height:f||1});for(const b in e){const w=e[b],E=s[b].paddedRect;nr.copy(w.data,g,{x:0,y:0},{x:E.x+1,y:E.y+1},w.data)}for(const b in r){const w=r[b],E=l[b].paddedRect,C=E.x+1,M=E.y+1,L=w.data.width,N=w.data.height;nr.copy(w.data,g,{x:0,y:0},{x:C,y:M},w.data),nr.copy(w.data,g,{x:0,y:N-1},{x:C,y:M-1},{width:L,height:1}),nr.copy(w.data,g,{x:0,y:0},{x:C,y:M+N},{width:L,height:1}),nr.copy(w.data,g,{x:L-1,y:0},{x:C-1,y:M},{width:1,height:N}),nr.copy(w.data,g,{x:0,y:0},{x:C+L,y:M},{width:1,height:N})}this.image=g,this.iconPositions=s,this.patternPositions=l}addImages(e,r,s){for(const l in e){const u=e[l],d={x:0,y:0,w:u.data.width+2,h:u.data.height+2};s.push(d),r[l]=new Rc(d,u),u.hasRenderCallback&&this.haveRenderCallbacks.push(l)}}patchUpdatedImages(e,r){e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const s in e.updatedImages)this.patchUpdatedImage(this.iconPositions[s],e.getImage(s),r),this.patchUpdatedImage(this.patternPositions[s],e.getImage(s),r)}patchUpdatedImage(e,r,s){if(!e||!r||e.version===r.version)return;e.version=r.version;const[l,u]=e.tl;s.update(r.data,void 0,{x:l,y:u})}}De("ImagePosition",Rc),De("ImageAtlas",ed),h.WritingMode=void 0,(Dn=h.WritingMode||(h.WritingMode={}))[Dn.none=0]="none",Dn[Dn.horizontal=1]="horizontal",Dn[Dn.vertical=2]="vertical",Dn[Dn.horizontalOnly=3]="horizontalOnly";const Il=-17;class go{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(e,r){const s=new go;return s.scale=e||1,s.fontStack=r,s}static forImage(e){const r=new go;return r.imageName=e,r}}class ua{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,r){const s=new ua;for(let l=0;l<e.sections.length;l++){const u=e.sections[l];u.image?s.addImageSection(u):s.addTextSection(u,r)}return s}length(){return this.text.length}getSection(e){return this.sections[this.sectionIndex[e]]}getSectionIndex(e){return this.sectionIndex[e]}getCharCode(e){return this.text.charCodeAt(e)}verticalizePunctuation(){this.text=function(e){let r="";for(let s=0;s<e.length;s++){const l=e.charCodeAt(s+1)||null,u=e.charCodeAt(s-1)||null;r+=l&&ll(l)&&!mo[e[s+1]]||u&&ll(u)&&!mo[e[s-1]]||!mo[e[s]]?e[s]:mo[e[s]]}return r}(this.text)}trim(){let e=0;for(let s=0;s<this.text.length&&Cl[this.text.charCodeAt(s)];s++)e++;let r=this.text.length;for(let s=this.text.length-1;s>=0&&s>=e&&Cl[this.text.charCodeAt(s)];s--)r--;this.text=this.text.substring(e,r),this.sectionIndex=this.sectionIndex.slice(e,r)}substring(e,r){const s=new ua;return s.text=this.text.substring(e,r),s.sectionIndex=this.sectionIndex.slice(e,r),s.sections=this.sections,s}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,r)=>Math.max(e,this.sections[r].scale),0)}addTextSection(e,r){this.text+=e.text,this.sections.push(go.forText(e.scale,e.fontStack||r));const s=this.sections.length-1;for(let l=0;l<e.text.length;++l)this.sectionIndex.push(s)}addImageSection(e){const r=e.image?e.image.name:"";if(r.length===0)return void oi("Can't add FormattedSection with an empty image.");const s=this.getNextImageSectionCharCode();s?(this.text+=String.fromCharCode(s),this.sections.push(go.forImage(r)),this.sectionIndex.push(this.sections.length-1)):oi("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Al(i,e,r,s,l,u,d,f,g,b,w,E,C,M,L,N){const O=ua.fromFeature(i,l);let W;E===h.WritingMode.vertical&&O.verticalizePunctuation();const{processBidirectionalText:ee,processStyledBidirectionalText:Z}=Ki;if(ee&&O.sections.length===1){W=[];const he=ee(O.toString(),Bc(O,b,u,e,s,M,L));for(const Le of he){const Re=new ua;Re.text=Le,Re.sections=O.sections;for(let Pe=0;Pe<Le.length;Pe++)Re.sectionIndex.push(0);W.push(Re)}}else if(Z){W=[];const he=Z(O.text,O.sectionIndex,Bc(O,b,u,e,s,M,L));for(const Le of he){const Re=new ua;Re.text=Le[0],Re.sectionIndex=Le[1],Re.sections=O.sections,W.push(Re)}}else W=function(he,Le){const Re=[],Pe=he.text;let Ee=0;for(const be of Le)Re.push(he.substring(Ee,be)),Ee=be;return Ee<Pe.length&&Re.push(he.substring(Ee,Pe.length)),Re}(O,Bc(O,b,u,e,s,M,L));const re=[],se={positionedLines:re,text:O.toString(),top:w[1],bottom:w[1],left:w[0],right:w[0],writingMode:E,iconsInText:!1,verticalizable:!1};return function(he,Le,Re,Pe,Ee,be,Me,Ae,ye,je,Fe,nt){let Et=0,Mt=Il,Yt=0,ar=0;const hi=Ae==="right"?1:Ae==="left"?0:.5;let Xt=0;for(const Wt of Ee){Wt.trim();const di=Wt.getMaxScale(),bi=(di-1)*ai,Li={positionedGlyphs:[],lineOffset:0};he.positionedLines[Xt]=Li;const Ni=Li.positionedGlyphs;let Vi=0;if(!Wt.length()){Mt+=be,++Xt;continue}for(let pi=0;pi<Wt.length();pi++){const st=Wt.getSection(pi),Yi=Wt.getSectionIndex(pi),fi=Wt.getCharCode(pi);let wi=0,vr=null,kr=null,zr=null,hn=ai;const br=!(ye===h.WritingMode.horizontal||!Fe&&!$s(fi)||Fe&&(Cl[fi]||(ri=fi,Ce.Arabic(ri)||Ce["Arabic Supplement"](ri)||Ce["Arabic Extended-A"](ri)||Ce["Arabic Presentation Forms-A"](ri)||Ce["Arabic Presentation Forms-B"](ri))));if(st.imageName){const or=Pe[st.imageName];if(!or)continue;zr=st.imageName,he.iconsInText=he.iconsInText||!0,kr=or.paddedRect;const $i=or.displaySize;st.scale=st.scale*ai/nt,vr={width:$i[0],height:$i[1],left:1,top:-3,advance:br?$i[1]:$i[0]},wi=bi+(ai-$i[1]*st.scale),hn=vr.advance;const un=br?$i[0]*st.scale-ai*di:$i[1]*st.scale-ai*di;un>0&&un>Vi&&(Vi=un)}else{const or=Re[st.fontStack],$i=or&&or[fi];if($i&&$i.rect)kr=$i.rect,vr=$i.metrics;else{const un=Le[st.fontStack],vo=un&&un[fi];if(!vo)continue;vr=vo.metrics}wi=(di-st.scale)*ai}br?(he.verticalizable=!0,Ni.push({glyph:fi,imageName:zr,x:Et,y:Mt+wi,vertical:br,scale:st.scale,fontStack:st.fontStack,sectionIndex:Yi,metrics:vr,rect:kr}),Et+=hn*st.scale+je):(Ni.push({glyph:fi,imageName:zr,x:Et,y:Mt+wi,vertical:br,scale:st.scale,fontStack:st.fontStack,sectionIndex:Yi,metrics:vr,rect:kr}),Et+=vr.advance*st.scale+je)}Ni.length!==0&&(Yt=Math.max(Et-je,Yt),ag(Ni,0,Ni.length-1,hi,Vi)),Et=0;const Ot=be*di+Vi;Li.lineOffset=Math.max(Vi,bi),Mt+=Ot,ar=Math.max(Ot,ar),++Xt}var ri;const ui=Mt-Il,{horizontalAlign:vi,verticalAlign:Ui}=Fc(Me);(function(Wt,di,bi,Li,Ni,Vi,Ot,pi,st){const Yi=(di-bi)*Ni;let fi=0;fi=Vi!==Ot?-pi*Li-Il:(-Li*st+.5)*Ot;for(const wi of Wt)for(const vr of wi.positionedGlyphs)vr.x+=Yi,vr.y+=fi})(he.positionedLines,hi,vi,Ui,Yt,ar,be,ui,Ee.length),he.top+=-Ui*ui,he.bottom=he.top+ui,he.left+=-vi*Yt,he.right=he.left+Yt}(se,e,r,s,W,d,f,g,E,b,C,N),!function(he){for(const Le of he)if(Le.positionedGlyphs.length!==0)return!1;return!0}(re)&&se}const Cl={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},ng={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function td(i,e,r,s,l,u){if(e.imageName){const d=s[e.imageName];return d?d.displaySize[0]*e.scale*ai/u+l:0}{const d=r[e.fontStack],f=d&&d[i];return f?f.metrics.advance*e.scale+l:0}}function id(i,e,r,s){const l=Math.pow(i-e,2);return s?i<e?l/2:2*l:l+Math.abs(r)*r}function sg(i,e,r){let s=0;return i===10&&(s-=1e4),r&&(s+=150),i!==40&&i!==65288||(s+=50),e!==41&&e!==65289||(s+=50),s}function rd(i,e,r,s,l,u){let d=null,f=id(e,r,l,u);for(const g of s){const b=id(e-g.x,r,l,u)+g.badness;b<=f&&(d=g,f=b)}return{index:i,x:e,priorBreak:d,badness:f}}function nd(i){return i?nd(i.priorBreak).concat(i.index):[]}function Bc(i,e,r,s,l,u,d){if(u!=="point")return[];if(!i)return[];const f=[],g=function(C,M,L,N,O,W){let ee=0;for(let Z=0;Z<C.length();Z++){const re=C.getSection(Z);ee+=td(C.getCharCode(Z),re,N,O,M,W)}return ee/Math.max(1,Math.ceil(ee/L))}(i,e,r,s,l,d),b=i.text.indexOf("\u200B")>=0;let w=0;for(let C=0;C<i.length();C++){const M=i.getSection(C),L=i.getCharCode(C);if(Cl[L]||(w+=td(L,M,s,l,e,d)),C<i.length()-1){const N=!((E=L)<11904||!(Ce["Bopomofo Extended"](E)||Ce.Bopomofo(E)||Ce["CJK Compatibility Forms"](E)||Ce["CJK Compatibility Ideographs"](E)||Ce["CJK Compatibility"](E)||Ce["CJK Radicals Supplement"](E)||Ce["CJK Strokes"](E)||Ce["CJK Symbols and Punctuation"](E)||Ce["CJK Unified Ideographs Extension A"](E)||Ce["CJK Unified Ideographs"](E)||Ce["Enclosed CJK Letters and Months"](E)||Ce["Halfwidth and Fullwidth Forms"](E)||Ce.Hiragana(E)||Ce["Ideographic Description Characters"](E)||Ce["Kangxi Radicals"](E)||Ce["Katakana Phonetic Extensions"](E)||Ce.Katakana(E)||Ce["Vertical Forms"](E)||Ce["Yi Radicals"](E)||Ce["Yi Syllables"](E)));(ng[L]||N||M.imageName)&&f.push(rd(C+1,w,g,f,sg(L,i.getCharCode(C+1),N&&b),!1))}}var E;return nd(rd(i.length(),w,g,f,0,!0))}function Fc(i){let e=.5,r=.5;switch(i){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=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:e,verticalAlign:r}}function ag(i,e,r,s,l){if(!s&&!l)return;const u=i[r],d=(i[r].x+u.metrics.advance*u.scale)*s;for(let f=e;f<=r;f++)i[f].x-=d,i[f].y+=l}function og(i,e,r){const{horizontalAlign:s,verticalAlign:l}=Fc(r),u=e[0]-i.displaySize[0]*s,d=e[1]-i.displaySize[1]*l;return{image:i,top:d,bottom:d+i.displaySize[1],left:u,right:u+i.displaySize[0]}}function sd(i,e,r,s,l,u){const d=i.image;let f;if(d.content){const O=d.content,W=d.pixelRatio||1;f=[O[0]/W,O[1]/W,d.displaySize[0]-O[2]/W,d.displaySize[1]-O[3]/W]}const g=e.left*u,b=e.right*u;let w,E,C,M;r==="width"||r==="both"?(M=l[0]+g-s[3],E=l[0]+b+s[1]):(M=l[0]+(g+b-d.displaySize[0])/2,E=M+d.displaySize[0]);const L=e.top*u,N=e.bottom*u;return r==="height"||r==="both"?(w=l[1]+L-s[0],C=l[1]+N+s[2]):(w=l[1]+(L+N-d.displaySize[1])/2,C=w+d.displaySize[1]),{image:d,top:w,right:E,bottom:C,left:M,collisionPadding:f}}const cn=128,Rn=32640;function ad(i,e){const{expression:r}=e;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new Ct(i+1))};if(r.kind==="source")return{kind:"source"};{const{zoomStops:s,interpolationType:l}=r;let u=0;for(;u<s.length&&s[u]<=i;)u++;u=Math.max(0,u-1);let d=u;for(;d<s.length&&s[d]<i+1;)d++;d=Math.min(s.length-1,d);const f=s[u],g=s[d];return r.kind==="composite"?{kind:"composite",minZoom:f,maxZoom:g,interpolationType:l}:{kind:"camera",minZoom:f,maxZoom:g,minSize:r.evaluate(new Ct(f)),maxSize:r.evaluate(new Ct(g)),interpolationType:l}}}function Oc(i,e,r){let s="never";const l=i.get(e);return l?s=l:i.get(r)&&(s="always"),s}const lg=Ln.VectorTileFeature.types,cg=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Pl(i,e,r,s,l,u,d,f,g,b,w,E,C){const M=f?Math.min(Rn,Math.round(f[0])):0,L=f?Math.min(Rn,Math.round(f[1])):0;i.emplaceBack(e,r,Math.round(32*s),Math.round(32*l),u,d,(M<<1)+(g?1:0),L,16*b,16*w,256*E,256*C)}function Uc(i,e,r){i.emplaceBack(e.x,e.y,r),i.emplaceBack(e.x,e.y,r),i.emplaceBack(e.x,e.y,r),i.emplaceBack(e.x,e.y,r)}function hg(i){for(const e of i.sections)if(cl(e.text))return!0;return!1}class Nc{constructor(e){this.layoutVertexArray=new ie,this.indexArray=new ge,this.programConfigurations=e,this.segments=new we,this.dynamicLayoutVertexArray=new ae,this.opacityVertexArray=new fe,this.hasVisibleVertices=!1,this.placedSymbolArray=new m}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(e,r,s,l){this.isEmpty()||(s&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Vm.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,$m.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,cg,!0),this.opacityVertexBuffer.itemSize=1),(s||l)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}De("SymbolBuffers",Nc);class Vc{constructor(e,r,s){this.layoutVertexArray=new e,this.layoutAttributes=r,this.indexArray=new s,this.segments=new we,this.collisionVertexArray=new xe}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,jm.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}De("CollisionBuffers",Vc);class da{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(d=>d.id),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=xc([]),this.placementViewportMatrix=xc([]);const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=ad(this.zoom,r["text-size"]),this.iconSizeData=ad(this.zoom,r["icon-size"]);const s=this.layers[0].layout,l=s.get("symbol-sort-key"),u=s.get("symbol-z-order");this.canOverlap=Oc(s,"text-overlap","text-allow-overlap")!=="never"||Oc(s,"icon-overlap","icon-allow-overlap")!=="never"||s.get("text-ignore-placement")||s.get("icon-ignore-placement"),this.sortFeaturesByKey=u!=="viewport-y"&&!l.isConstant(),this.sortFeaturesByY=(u==="viewport-y"||u==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,s.get("symbol-placement")==="point"&&(this.writingModes=s.get("text-writing-mode").map(d=>h.WritingMode[d])),this.stateDependentLayerIds=this.layers.filter(d=>d.isStateDependent()).map(d=>d.id),this.sourceID=e.sourceID}createArrays(){this.text=new Nc(new Pr(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new Nc(new Pr(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new v,this.lineVertexArray=new S,this.symbolInstances=new _}calculateGlyphDependencies(e,r,s,l,u){for(let d=0;d<e.length;d++)if(r[e.charCodeAt(d)]=!0,(s||l)&&u){const f=mo[e.charAt(d)];f&&(r[f.charCodeAt(0)]=!0)}}populate(e,r,s){const l=this.layers[0],u=l.layout,d=u.get("text-font"),f=u.get("text-field"),g=u.get("icon-image"),b=(f.value.kind!=="constant"||f.value.value instanceof Ri&&!f.value.value.isEmpty()||f.value.value.toString().length>0)&&(d.value.kind!=="constant"||d.value.value.length>0),w=g.value.kind!=="constant"||!!g.value.value||Object.keys(g.parameters).length>0,E=u.get("symbol-sort-key");if(this.features=[],!b&&!w)return;const C=r.iconDependencies,M=r.glyphDependencies,L=r.availableImages,N=new Ct(this.zoom);for(const{feature:O,id:W,index:ee,sourceLayerIndex:Z}of e){const re=l._featureFilter.needGeometry,se=ps(O,re);if(!l._featureFilter.filter(N,se,s))continue;let he,Le;if(re||(se.geometry=Mr(O)),b){const Pe=l.getValueAndResolveTokens("text-field",se,s,L),Ee=Ri.factory(Pe);hg(Ee)&&(this.hasRTLText=!0),(!this.hasRTLText||Ha()==="unavailable"||this.hasRTLText&&Ki.isParsed())&&(he=qm(Ee,l,se))}if(w){const Pe=l.getValueAndResolveTokens("icon-image",se,s,L);Le=Pe instanceof li?Pe:li.fromString(Pe)}if(!he&&!Le)continue;const Re=this.sortFeaturesByKey?E.evaluate(se,{},s):void 0;if(this.features.push({id:W,text:he,icon:Le,index:ee,sourceLayerIndex:Z,geometry:se.geometry,properties:O.properties,type:lg[O.type],sortKey:Re}),Le&&(C[Le.name]=!0),he){const Pe=d.evaluate(se,{},s).join(","),Ee=u.get("text-rotation-alignment")!=="viewport"&&u.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(h.WritingMode.vertical)>=0;for(const be of he.sections)if(be.image)C[be.image.name]=!0;else{const Me=Vs(he.toString()),Ae=be.fontStack||Pe,ye=M[Ae]=M[Ae]||{};this.calculateGlyphDependencies(be.text,ye,Ee,this.allowVerticalPlacement,Me)}}}u.get("symbol-placement")==="line"&&(this.features=function(O){const W={},ee={},Z=[];let re=0;function se(Pe){Z.push(O[Pe]),re++}function he(Pe,Ee,be){const Me=ee[Pe];return delete ee[Pe],ee[Ee]=Me,Z[Me].geometry[0].pop(),Z[Me].geometry[0]=Z[Me].geometry[0].concat(be[0]),Me}function Le(Pe,Ee,be){const Me=W[Ee];return delete W[Ee],W[Pe]=Me,Z[Me].geometry[0].shift(),Z[Me].geometry[0]=be[0].concat(Z[Me].geometry[0]),Me}function Re(Pe,Ee,be){const Me=be?Ee[0][Ee[0].length-1]:Ee[0][0];return`${Pe}:${Me.x}:${Me.y}`}for(let Pe=0;Pe<O.length;Pe++){const Ee=O[Pe],be=Ee.geometry,Me=Ee.text?Ee.text.toString():null;if(!Me){se(Pe);continue}const Ae=Re(Me,be),ye=Re(Me,be,!0);if(Ae in ee&&ye in W&&ee[Ae]!==W[ye]){const je=Le(Ae,ye,be),Fe=he(Ae,ye,Z[je].geometry);delete W[Ae],delete ee[ye],ee[Re(Me,Z[Fe].geometry,!0)]=Fe,Z[je].geometry=null}else Ae in ee?he(Ae,ye,be):ye in W?Le(Ae,ye,be):(se(Pe),W[Ae]=re-1,ee[ye]=re-1)}return Z.filter(Pe=>Pe.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((O,W)=>O.sortKey-W.sortKey)}update(e,r,s){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,r,this.layers,s),this.icon.programConfigurations.updatePaintArrays(e,r,this.layers,s))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,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(e,r){const s=this.lineVertexArray.length;if(e.segment!==void 0){let l=e.dist(r[e.segment+1]),u=e.dist(r[e.segment]);const d={};for(let f=e.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=e.segment||0;f>=0;f--)d[f]={x:r[f].x,y:r[f].y,tileUnitDistanceFromAnchor:u},f>0&&(u+=r[f-1].dist(r[f]));for(let f=0;f<r.length;f++){const g=d[f];this.lineVertexArray.emplaceBack(g.x,g.y,g.tileUnitDistanceFromAnchor)}}return{lineStartIndex:s,lineLength:this.lineVertexArray.length-s}}addSymbols(e,r,s,l,u,d,f,g,b,w,E,C){const M=e.indexArray,L=e.layoutVertexArray,N=e.segments.prepareSegment(4*r.length,L,M,this.canOverlap?d.sortKey:void 0),O=this.glyphOffsetArray.length,W=N.vertexLength,ee=this.allowVerticalPlacement&&f===h.WritingMode.vertical?Math.PI/2:0,Z=d.text&&d.text.sections;for(let re=0;re<r.length;re++){const{tl:se,tr:he,bl:Le,br:Re,tex:Pe,pixelOffsetTL:Ee,pixelOffsetBR:be,minFontScaleX:Me,minFontScaleY:Ae,glyphOffset:ye,isSDF:je,sectionIndex:Fe}=r[re],nt=N.vertexLength,Et=ye[1];Pl(L,g.x,g.y,se.x,Et+se.y,Pe.x,Pe.y,s,je,Ee.x,Ee.y,Me,Ae),Pl(L,g.x,g.y,he.x,Et+he.y,Pe.x+Pe.w,Pe.y,s,je,be.x,Ee.y,Me,Ae),Pl(L,g.x,g.y,Le.x,Et+Le.y,Pe.x,Pe.y+Pe.h,s,je,Ee.x,be.y,Me,Ae),Pl(L,g.x,g.y,Re.x,Et+Re.y,Pe.x+Pe.w,Pe.y+Pe.h,s,je,be.x,be.y,Me,Ae),Uc(e.dynamicLayoutVertexArray,g,ee),M.emplaceBack(nt,nt+1,nt+2),M.emplaceBack(nt+1,nt+2,nt+3),N.vertexLength+=4,N.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(ye[0]),re!==r.length-1&&Fe===r[re+1].sectionIndex||e.programConfigurations.populatePaintArrays(L.length,d,d.index,{},C,Z&&Z[Fe])}e.placedSymbolArray.emplaceBack(g.x,g.y,O,this.glyphOffsetArray.length-O,W,b,w,g.segment,s?s[0]:0,s?s[1]:0,l[0],l[1],f,0,!1,0,E)}_addCollisionDebugVertex(e,r,s,l,u,d){return r.emplaceBack(0,0),e.emplaceBack(s.x,s.y,l,u,Math.round(d.x),Math.round(d.y))}addCollisionDebugVertices(e,r,s,l,u,d,f){const g=u.segments.prepareSegment(4,u.layoutVertexArray,u.indexArray),b=g.vertexLength,w=u.layoutVertexArray,E=u.collisionVertexArray,C=f.anchorX,M=f.anchorY;this._addCollisionDebugVertex(w,E,d,C,M,new ve(e,r)),this._addCollisionDebugVertex(w,E,d,C,M,new ve(s,r)),this._addCollisionDebugVertex(w,E,d,C,M,new ve(s,l)),this._addCollisionDebugVertex(w,E,d,C,M,new ve(e,l)),g.vertexLength+=4;const L=u.indexArray;L.emplaceBack(b,b+1),L.emplaceBack(b+1,b+2),L.emplaceBack(b+2,b+3),L.emplaceBack(b+3,b),g.primitiveLength+=4}addDebugCollisionBoxes(e,r,s,l){for(let u=e;u<r;u++){const d=this.collisionBoxArray.get(u);this.addCollisionDebugVertices(d.x1,d.y1,d.x2,d.y2,l?this.textCollisionBox:this.iconCollisionBox,d.anchorPoint,s)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Vc(_e,qu.members,ke),this.iconCollisionBox=new Vc(_e,qu.members,ke);for(let e=0;e<this.symbolInstances.length;e++){const r=this.symbolInstances.get(e);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(e,r,s,l,u,d,f,g,b){const w={};for(let E=r;E<s;E++){const C=e.get(E);w.textBox={x1:C.x1,y1:C.y1,x2:C.x2,y2:C.y2,anchorPointX:C.anchorPointX,anchorPointY:C.anchorPointY},w.textFeatureIndex=C.featureIndex;break}for(let E=l;E<u;E++){const C=e.get(E);w.verticalTextBox={x1:C.x1,y1:C.y1,x2:C.x2,y2:C.y2,anchorPointX:C.anchorPointX,anchorPointY:C.anchorPointY},w.verticalTextFeatureIndex=C.featureIndex;break}for(let E=d;E<f;E++){const C=e.get(E);w.iconBox={x1:C.x1,y1:C.y1,x2:C.x2,y2:C.y2,anchorPointX:C.anchorPointX,anchorPointY:C.anchorPointY},w.iconFeatureIndex=C.featureIndex;break}for(let E=g;E<b;E++){const C=e.get(E);w.verticalIconBox={x1:C.x1,y1:C.y1,x2:C.x2,y2:C.y2,anchorPointX:C.anchorPointX,anchorPointY:C.anchorPointY},w.verticalIconFeatureIndex=C.featureIndex;break}return w}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let r=0;r<this.symbolInstances.length;r++){const s=this.symbolInstances.get(r);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,s.textBoxStartIndex,s.textBoxEndIndex,s.verticalTextBoxStartIndex,s.verticalTextBoxEndIndex,s.iconBoxStartIndex,s.iconBoxEndIndex,s.verticalIconBoxStartIndex,s.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(e,r){const s=e.placedSymbolArray.get(r),l=s.vertexStartIndex+4*s.numGlyphs;for(let u=s.vertexStartIndex;u<l;u+=4)e.indexArray.emplaceBack(u,u+1,u+2),e.indexArray.emplaceBack(u+1,u+2,u+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const r=Math.sin(e),s=Math.cos(e),l=[],u=[],d=[];for(let f=0;f<this.symbolInstances.length;++f){d.push(f);const g=this.symbolInstances.get(f);l.push(0|Math.round(r*g.anchorX+s*g.anchorY)),u.push(g.featureIndex)}return d.sort((f,g)=>l[f]-l[g]||u[g]-u[f]),d}addToSortKeyRanges(e,r){const s=this.sortKeyRanges[this.sortKeyRanges.length-1];s&&s.sortKey===r?s.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:r,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const r of this.symbolInstanceIndexes){const s=this.symbolInstances.get(r);this.featureSortOrder.push(s.featureIndex),[s.rightJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.leftJustifiedTextSymbolIndex].forEach((l,u,d)=>{l>=0&&d.indexOf(l)===u&&this.addIndicesForPlacedSymbol(this.text,l)}),s.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,s.verticalPlacedTextSymbolIndex),s.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,s.placedIconSymbolIndex),s.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,s.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let od,ld;De("SymbolBucket",da,{omit:["layers","collisionBoxArray","features","compareText"]}),da.MAX_GLYPHS=65535,da.addDynamicAttributes=Uc;var $c={get paint(){return ld=ld||new ki({"icon-opacity":new Ze(oe.paint_symbol["icon-opacity"]),"icon-color":new Ze(oe.paint_symbol["icon-color"]),"icon-halo-color":new Ze(oe.paint_symbol["icon-halo-color"]),"icon-halo-width":new Ze(oe.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Ze(oe.paint_symbol["icon-halo-blur"]),"icon-translate":new Ue(oe.paint_symbol["icon-translate"]),"icon-translate-anchor":new Ue(oe.paint_symbol["icon-translate-anchor"]),"text-opacity":new Ze(oe.paint_symbol["text-opacity"]),"text-color":new Ze(oe.paint_symbol["text-color"],{runtimeType:Jt,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new Ze(oe.paint_symbol["text-halo-color"]),"text-halo-width":new Ze(oe.paint_symbol["text-halo-width"]),"text-halo-blur":new Ze(oe.paint_symbol["text-halo-blur"]),"text-translate":new Ue(oe.paint_symbol["text-translate"]),"text-translate-anchor":new Ue(oe.paint_symbol["text-translate-anchor"])})},get layout(){return od=od||new ki({"symbol-placement":new Ue(oe.layout_symbol["symbol-placement"]),"symbol-spacing":new Ue(oe.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Ue(oe.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Ze(oe.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Ue(oe.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Ue(oe.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Ue(oe.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Ue(oe.layout_symbol["icon-ignore-placement"]),"icon-optional":new Ue(oe.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Ue(oe.layout_symbol["icon-rotation-alignment"]),"icon-size":new Ze(oe.layout_symbol["icon-size"]),"icon-text-fit":new Ue(oe.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Ue(oe.layout_symbol["icon-text-fit-padding"]),"icon-image":new Ze(oe.layout_symbol["icon-image"]),"icon-rotate":new Ze(oe.layout_symbol["icon-rotate"]),"icon-padding":new Ze(oe.layout_symbol["icon-padding"]),"icon-keep-upright":new Ue(oe.layout_symbol["icon-keep-upright"]),"icon-offset":new Ze(oe.layout_symbol["icon-offset"]),"icon-anchor":new Ze(oe.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Ue(oe.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Ue(oe.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Ue(oe.layout_symbol["text-rotation-alignment"]),"text-field":new Ze(oe.layout_symbol["text-field"]),"text-font":new Ze(oe.layout_symbol["text-font"]),"text-size":new Ze(oe.layout_symbol["text-size"]),"text-max-width":new Ze(oe.layout_symbol["text-max-width"]),"text-line-height":new Ue(oe.layout_symbol["text-line-height"]),"text-letter-spacing":new Ze(oe.layout_symbol["text-letter-spacing"]),"text-justify":new Ze(oe.layout_symbol["text-justify"]),"text-radial-offset":new Ze(oe.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Ue(oe.layout_symbol["text-variable-anchor"]),"text-anchor":new Ze(oe.layout_symbol["text-anchor"]),"text-max-angle":new Ue(oe.layout_symbol["text-max-angle"]),"text-writing-mode":new Ue(oe.layout_symbol["text-writing-mode"]),"text-rotate":new Ze(oe.layout_symbol["text-rotate"]),"text-padding":new Ue(oe.layout_symbol["text-padding"]),"text-keep-upright":new Ue(oe.layout_symbol["text-keep-upright"]),"text-transform":new Ze(oe.layout_symbol["text-transform"]),"text-offset":new Ze(oe.layout_symbol["text-offset"]),"text-allow-overlap":new Ue(oe.layout_symbol["text-allow-overlap"]),"text-overlap":new Ue(oe.layout_symbol["text-overlap"]),"text-ignore-placement":new Ue(oe.layout_symbol["text-ignore-placement"]),"text-optional":new Ue(oe.layout_symbol["text-optional"])})}};class cd{constructor(e){if(e.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:Er,this.defaultValue=e}evaluate(e){if(e.formattedSection){const r=this.defaultValue.property.overrides;if(r&&r.hasOverride(e.formattedSection))return r.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}De("FormatSectionOverride",cd,{omit:["defaultValue"]});class Ml extends _r{constructor(e){super(e,$c)}recalculate(e,r){if(super.recalculate(e,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"){const s=this.layout.get("text-writing-mode");if(s){const l=[];for(const u of s)l.indexOf(u)<0&&l.push(u);this.layout._values["text-writing-mode"]=l}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,r,s,l){const u=this.layout.get(e).evaluate(r,{},s,l),d=this._unevaluatedLayout._values[e];return d.isDataDriven()||Ls(d.value)||!u?u:function(f,g){return g.replace(/{([^{}]+)}/g,(b,w)=>w in f?String(f[w]):"")}(r.properties,u)}createBucket(e){return new da(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const e of $c.paint.overridableProperties){if(!Ml.hasPaintOverride(this.layout,e))continue;const r=this.paint.get(e),s=new cd(r),l=new Fa(s,r.property.specification);let u=null;u=r.value.kind==="constant"||r.value.kind==="source"?new Oa("source",l):new at("composite",l,r.value.zoomStops),this.paint._values[e]=new gr(r.property,u,r.parameters)}}_handleOverridablePaintPropertyUpdate(e,r,s){return!(!this.layout||r.isDataDriven()||s.isDataDriven())&&Ml.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,r){const s=e.get("text-field"),l=$c.paint.properties[r];let u=!1;const d=f=>{for(const g of f)if(l.overrides&&l.overrides.hasOverride(g))return void(u=!0)};if(s.value.kind==="constant"&&s.value.value instanceof Ri)d(s.value.value.sections);else if(s.value.kind==="source"){const f=b=>{u||(b instanceof Qr&&Lt(b.value)===Nr?d(b.value.sections):b instanceof ks?d(b.sections):b.eachChild(f))},g=s.value;g._styleExpression&&f(g._styleExpression.expression)}return u}}let hd;var ug={get paint(){return hd=hd||new ki({"background-color":new Ue(oe.paint_background["background-color"]),"background-pattern":new Ja(oe.paint_background["background-pattern"]),"background-opacity":new Ue(oe.paint_background["background-opacity"])})}};let ud;var dg={get paint(){return ud=ud||new ki({"raster-opacity":new Ue(oe.paint_raster["raster-opacity"]),"raster-hue-rotate":new Ue(oe.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Ue(oe.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Ue(oe.paint_raster["raster-brightness-max"]),"raster-saturation":new Ue(oe.paint_raster["raster-saturation"]),"raster-contrast":new Ue(oe.paint_raster["raster-contrast"]),"raster-resampling":new Ue(oe.paint_raster["raster-resampling"]),"raster-fade-duration":new Ue(oe.paint_raster["raster-fade-duration"])})}};class pg extends _r{constructor(e){super(e,{}),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=e}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")}}const fg={circle:class extends _r{constructor(i){super(i,tm)}createBucket(i){return new gc(i)}queryRadius(i){const e=i;return so("circle-radius",this,e)+so("circle-stroke-width",this,e)+_l(this.paint.get("circle-translate"))}queryIntersectsFeature(i,e,r,s,l,u,d,f){const g=yl(i,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),u.angle,d),b=this.paint.get("circle-radius").evaluate(e,r)+this.paint.get("circle-stroke-width").evaluate(e,r),w=this.paint.get("circle-pitch-alignment")==="map",E=w?g:function(M,L){return M.map(N=>bu(N,L))}(g,f),C=w?b*d:b;for(const M of s)for(const L of M){const N=w?L:bu(L,f);let O=C;const W=xl([],[L.x,L.y,0,1],f);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?O*=W[3]/u.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(O*=u.cameraToCenterDistance/W[3]),Yf(E,N,O))return!0}return!1}},heatmap:class extends _r{createBucket(i){return new wu(i)}constructor(i){super(i,rm),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(i){i==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Eu({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}},hillshade:class extends _r{constructor(i){super(i,nm)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}},fill:class extends _r{constructor(i){super(i,xm)}recalculate(i,e){super.recalculate(i,e);const r=this.paint._values["fill-outline-color"];r.value.kind==="constant"&&r.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(i){return new Pc(i)}queryRadius(){return _l(this.paint.get("fill-translate"))}queryIntersectsFeature(i,e,r,s,l,u,d){return mu(yl(i,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),u.angle,d),s)}isTileClipped(){return!0}},"fill-extrusion":class extends _r{constructor(i){super(i,Lm)}createBucket(i){return new kc(i)}queryRadius(){return _l(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(i,e,r,s,l,u,d,f){const g=yl(i,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),u.angle,d),b=this.paint.get("fill-extrusion-height").evaluate(e,r),w=this.paint.get("fill-extrusion-base").evaluate(e,r),E=function(M,L,N,O){const W=[];for(const ee of M){const Z=[ee.x,ee.y,0,1];xl(Z,Z,L),W.push(new ve(Z[0]/Z[3],Z[1]/Z[3]))}return W}(g,f),C=function(M,L,N,O){const W=[],ee=[],Z=O[8]*L,re=O[9]*L,se=O[10]*L,he=O[11]*L,Le=O[8]*N,Re=O[9]*N,Pe=O[10]*N,Ee=O[11]*N;for(const be of M){const Me=[],Ae=[];for(const ye of be){const je=ye.x,Fe=ye.y,nt=O[0]*je+O[4]*Fe+O[12],Et=O[1]*je+O[5]*Fe+O[13],Mt=O[2]*je+O[6]*Fe+O[14],Yt=O[3]*je+O[7]*Fe+O[15],ar=Mt+se,hi=Yt+he,Xt=nt+Le,ri=Et+Re,ui=Mt+Pe,vi=Yt+Ee,Ui=new ve((nt+Z)/hi,(Et+re)/hi);Ui.z=ar/hi,Me.push(Ui);const Wt=new ve(Xt/vi,ri/vi);Wt.z=ui/vi,Ae.push(Wt)}W.push(Me),ee.push(Ae)}return[W,ee]}(s,w,b,f);return function(M,L,N){let O=1/0;mu(N,L)&&(O=Uu(N,L[0]));for(let W=0;W<L.length;W++){const ee=L[W],Z=M[W];for(let re=0;re<ee.length-1;re++){const se=ee[re],he=[se,ee[re+1],Z[re+1],Z[re],se];fu(N,he)&&(O=Math.min(O,Uu(N,he)))}}return O!==1/0&&O}(C[0],C[1],E)}},line:class extends _r{constructor(i){super(i,ju),this.gradientVersion=0,Sl||(Sl=new Nm(ju.paint.properties["line-width"].specification),Sl.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(i){i==="line-gradient"&&(this.stepInterpolant=this._transitionablePaint._values["line-gradient"].value.expression._styleExpression.expression instanceof Hn,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER)}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(i,e){super.recalculate(i,e),this.paint._values["line-floorwidth"]=Sl.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,i)}createBucket(i){return new zc(i)}queryRadius(i){const e=i,r=Gu(so("line-width",this,e),so("line-gap-width",this,e)),s=so("line-offset",this,e);return r/2+Math.abs(s)+_l(this.paint.get("line-translate"))}queryIntersectsFeature(i,e,r,s,l,u,d){const f=yl(i,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),u.angle,d),g=d/2*Gu(this.paint.get("line-width").evaluate(e,r),this.paint.get("line-gap-width").evaluate(e,r)),b=this.paint.get("line-offset").evaluate(e,r);return b&&(s=function(w,E){const C=[];for(let M=0;M<w.length;M++){const L=w[M],N=[];for(let O=0;O<L.length;O++){const W=L[O-1],ee=L[O],Z=L[O+1],re=O===0?new ve(0,0):ee.sub(W)._unit()._perp(),se=O===L.length-1?new ve(0,0):Z.sub(ee)._unit()._perp(),he=re._add(se)._unit(),Le=he.x*se.x+he.y*se.y;Le!==0&&he._mult(1/Le),N.push(he._mult(E)._add(ee))}C.push(N)}return C}(s,b*d)),function(w,E,C){for(let M=0;M<E.length;M++){const L=E[M];if(w.length>=3){for(let N=0;N<L.length;N++)if(sa(w,L[N]))return!0}if(Jf(w,L,C))return!0}return!1}(f,s,g)}isTileClipped(){return!0}},symbol:Ml,background:class extends _r{constructor(i){super(i,ug)}},raster:class extends _r{constructor(i){super(i,dg)}}};class mg{constructor(e){this._callback=e,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){delete this._channel,this._callback=()=>{}}}const jc=63710088e-1;class Bn{constructor(e,r){if(isNaN(e)||isNaN(r))throw new Error(`Invalid LngLat object: (${e}, ${r})`);if(this.lng=+e,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 Bn(hr(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const r=Math.PI/180,s=this.lat*r,l=e.lat*r,u=Math.sin(s)*Math.sin(l)+Math.cos(s)*Math.cos(l)*Math.cos((e.lng-this.lng)*r);return jc*Math.acos(Math.min(u,1))}static convert(e){if(e instanceof Bn)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new Bn(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new Bn(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}const dd=2*Math.PI*jc;function pd(i){return dd*Math.cos(i*Math.PI/180)}function fd(i){return(180+i)/360}function md(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function gd(i,e){return i/pd(e)}function Gc(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}class kl{constructor(e,r,s=0){this.x=+e,this.y=+r,this.z=+s}static fromLngLat(e,r=0){const s=Bn.convert(e);return new kl(fd(s.lng),md(s.lat),gd(r,s.lat))}toLngLat(){return new Bn(360*this.x-180,Gc(this.y))}toAltitude(){return this.z*pd(Gc(this.y))}meterInMercatorCoordinateUnits(){return 1/dd*(e=Gc(this.y),1/Math.cos(e*Math.PI/180));var e}}function _d(i,e,r){var s=2*Math.PI*6378137/256/Math.pow(2,r);return[i*s-2*Math.PI*6378137/2,e*s-2*Math.PI*6378137/2]}class qc{constructor(e,r,s){if(e<0||e>25||s<0||s>=Math.pow(2,e)||r<0||r>=Math.pow(2,e))throw new Error(`x=${r}, y=${s}, z=${e} outside of bounds. 0<=x<${Math.pow(2,e)}, 0<=y<${Math.pow(2,e)} 0<=z<=25 `);this.z=e,this.x=r,this.y=s,this.key=_o(0,e,e,r,s)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,r,s){const l=(d=this.y,f=this.z,g=_d(256*(u=this.x),256*(d=Math.pow(2,f)-d-1),f),b=_d(256*(u+1),256*(d+1),f),g[0]+","+g[1]+","+b[0]+","+b[1]);var u,d,f,g,b;const w=function(E,C,M){let L,N="";for(let O=E;O>0;O--)L=1<<O-1,N+=(C&L?1:0)+(M&L?2:0);return N}(this.z,this.x,this.y);return e[(this.x+this.y)%e.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(s==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,r>1?"@2x":"").replace(/{quadkey}/g,w).replace(/{bbox-epsg-3857}/g,l)}isChildOf(e){const r=this.z-e.z;return r>0&&e.x===this.x>>r&&e.y===this.y>>r}getTilePoint(e){const r=Math.pow(2,this.z);return new ve((e.x*r-this.x)*Pt,(e.y*r-this.y)*Pt)}toString(){return`${this.z}/${this.x}/${this.y}`}}class yd{constructor(e,r){this.wrap=e,this.canonical=r,this.key=_o(e,r.z,r.z,r.x,r.y)}}class sr{constructor(e,r,s,l,u){if(e<s)throw new Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${s}`);this.overscaledZ=e,this.wrap=r,this.canonical=new qc(s,+l,+u),this.key=_o(r,e,s,l,u)}clone(){return new sr(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const r=this.canonical.z-e;return e>this.canonical.z?new sr(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new sr(e,this.wrap,e,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(e,r){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const s=this.canonical.z-e;return e>this.canonical.z?_o(this.wrap*+r,e,this.canonical.z,this.canonical.x,this.canonical.y):_o(this.wrap*+r,e,e,this.canonical.x>>s,this.canonical.y>>s)}isChildOf(e){if(e.wrap!==this.wrap)return!1;const r=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ<this.overscaledZ&&e.canonical.x===this.canonical.x>>r&&e.canonical.y===this.canonical.y>>r}children(e){if(this.overscaledZ>=e)return[new sr(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const r=this.canonical.z+1,s=2*this.canonical.x,l=2*this.canonical.y;return[new sr(r,this.wrap,r,s,l),new sr(r,this.wrap,r,s+1,l),new sr(r,this.wrap,r,s,l+1),new sr(r,this.wrap,r,s+1,l+1)]}isLessThan(e){return this.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}wrapped(){return new sr(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new sr(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new yd(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new kl(e.x-this.wrap,e.y))}}function _o(i,e,r,s,l){(i*=2)<0&&(i=-1*i-1);const u=1<<r;return(u*u*i+u*l+s).toString(36)+r.toString(36)+e.toString(36)}De("CanonicalTileID",qc),De("OverscaledTileID",sr,{omit:["posMatrix"]});class xd{constructor(e,r,s){if(this.uid=e,r.height!==r.width)throw new RangeError("DEM tiles must be square");if(s&&s!=="mapbox"&&s!=="terrarium")return void oi(`"${s}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=r.height;const l=this.dim=r.height-2;this.data=new Uint32Array(r.data.buffer),this.encoding=s||"mapbox";for(let u=0;u<l;u++)this.data[this._idx(-1,u)]=this.data[this._idx(0,u)],this.data[this._idx(l,u)]=this.data[this._idx(l-1,u)],this.data[this._idx(u,-1)]=this.data[this._idx(u,0)],this.data[this._idx(u,l)]=this.data[this._idx(u,l-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(l,-1)]=this.data[this._idx(l-1,0)],this.data[this._idx(-1,l)]=this.data[this._idx(0,l-1)],this.data[this._idx(l,l)]=this.data[this._idx(l-1,l-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let u=0;u<l;u++)for(let d=0;d<l;d++){const f=this.get(u,d);f>this.max&&(this.max=f),f<this.min&&(this.min=f)}}get(e,r){const s=new Uint8Array(this.data.buffer),l=4*this._idx(e,r);return(this.encoding==="terrarium"?this._unpackTerrarium:this._unpackMapbox)(s[l],s[l+1],s[l+2])}getUnpackVector(){return this.encoding==="terrarium"?[256,1,1/256,32768]:[6553.6,25.6,.1,1e4]}_idx(e,r){if(e<-1||e>=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+(e+1)}_unpackMapbox(e,r,s){return(256*e*256+256*r+s)/10-1e4}_unpackTerrarium(e,r,s){return 256*e+r+s/256-32768}getPixels(){return new nr({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,r,s){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let l=r*this.dim,u=r*this.dim+this.dim,d=s*this.dim,f=s*this.dim+this.dim;switch(r){case-1:l=u-1;break;case 1:u=l+1}switch(s){case-1:d=f-1;break;case 1:f=d+1}const g=-r*this.dim,b=-s*this.dim;for(let w=d;w<f;w++)for(let E=l;E<u;E++)this.data[this._idx(E,w)]=e.data[this._idx(E+g,w+b)]}}De("DEMData",xd);class vd{constructor(e){this._stringToNumber={},this._numberToString=[];for(let r=0;r<e.length;r++){const s=e[r];this._stringToNumber[s]=r,this._numberToString[r]=s}}encode(e){return this._stringToNumber[e]}decode(e){if(e>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${e} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}}class bd{constructor(e,r,s,l,u){this.type="Feature",this._vectorTileFeature=e,e._z=r,e._x=s,e._y=l,this.properties=e.properties,this.id=u}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(e){this._geometry=e}toJSON(){const e={geometry:this.geometry};for(const r in this)r!=="_geometry"&&r!=="_vectorTileFeature"&&(e[r]=this[r]);return e}}class wd{constructor(e,r){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new ss(Pt,16,0),this.grid3D=new ss(Pt,16,0),this.featureIndexArray=new z,this.promoteId=r}insert(e,r,s,l,u,d){const f=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(s,l,u);const g=d?this.grid3D:this.grid;for(let b=0;b<r.length;b++){const w=r[b],E=[1/0,1/0,-1/0,-1/0];for(let C=0;C<w.length;C++){const M=w[C];E[0]=Math.min(E[0],M.x),E[1]=Math.min(E[1],M.y),E[2]=Math.max(E[2],M.x),E[3]=Math.max(E[3],M.y)}E[0]<Pt&&E[1]<Pt&&E[2]>=0&&E[3]>=0&&g.insert(f,E[0],E[1],E[2],E[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Ln.VectorTile(new Dc(this.rawTileData)).layers,this.sourceLayerCoder=new vd(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,r,s,l){this.loadVTLayers();const u=e.params||{},d=Pt/e.tileSize/e.scale,f=Ua(u.filter),g=e.queryGeometry,b=e.queryPadding*d,w=Sd(g),E=this.grid.query(w.minX-b,w.minY-b,w.maxX+b,w.maxY+b),C=Sd(e.cameraQueryGeometry),M=this.grid3D.query(C.minX-b,C.minY-b,C.maxX+b,C.maxY+b,(O,W,ee,Z)=>function(re,se,he,Le,Re){for(const Ee of re)if(se<=Ee.x&&he<=Ee.y&&Le>=Ee.x&&Re>=Ee.y)return!0;const Pe=[new ve(se,he),new ve(se,Re),new ve(Le,Re),new ve(Le,he)];if(re.length>2){for(const Ee of Pe)if(sa(re,Ee))return!0}for(let Ee=0;Ee<re.length-1;Ee++)if(em(re[Ee],re[Ee+1],Pe))return!0;return!1}(e.cameraQueryGeometry,O-b,W-b,ee+b,Z+b));for(const O of M)E.push(O);E.sort(gg);const L={};let N;for(let O=0;O<E.length;O++){const W=E[O];if(W===N)continue;N=W;const ee=this.featureIndexArray.get(W);let Z=null;this.loadMatchingFeature(L,ee.bucketIndex,ee.sourceLayerIndex,ee.featureIndex,f,u.layers,u.availableImages,r,s,l,(re,se,he)=>(Z||(Z=Mr(re)),se.queryIntersectsFeature(g,re,he,Z,this.z,e.transform,d,e.pixelPosMatrix)))}return L}loadMatchingFeature(e,r,s,l,u,d,f,g,b,w,E){const C=this.bucketLayerIDs[r];if(d&&!function(O,W){for(let ee=0;ee<O.length;ee++)if(W.indexOf(O[ee])>=0)return!0;return!1}(d,C))return;const M=this.sourceLayerCoder.decode(s),L=this.vtLayers[M].feature(l);if(u.needGeometry){const O=ps(L,!0);if(!u.filter(new Ct(this.tileID.overscaledZ),O,this.tileID.canonical))return}else if(!u.filter(new Ct(this.tileID.overscaledZ),L))return;const N=this.getId(L,M);for(let O=0;O<C.length;O++){const W=C[O];if(d&&d.indexOf(W)<0)continue;const ee=g[W];if(!ee)continue;let Z={};N&&w&&(Z=w.getState(ee.sourceLayer||"_geojsonTileLayer",N));const re=_i({},b[W]);re.paint=Td(re.paint,ee.paint,L,Z,f),re.layout=Td(re.layout,ee.layout,L,Z,f);const se=!E||E(L,ee,Z);if(!se)continue;const he=new bd(L,this.z,this.x,this.y,N);he.layer=re;let Le=e[W];Le===void 0&&(Le=e[W]=[]),Le.push({featureIndex:l,feature:he,intersectionZ:se})}}lookupSymbolFeatures(e,r,s,l,u,d,f,g){const b={};this.loadVTLayers();const w=Ua(u);for(const E of e)this.loadMatchingFeature(b,s,l,E,w,d,f,g,r);return b}hasLayer(e){for(const r of this.bucketLayerIDs)for(const s of r)if(e===s)return!0;return!1}getId(e,r){let s=e.id;return this.promoteId&&(s=e.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[r]],typeof s=="boolean"&&(s=Number(s))),s}}function Td(i,e,r,s,l){return Dr(i,(u,d)=>{const f=e instanceof Ws?e.get(d):null;return f&&f.evaluate?f.evaluate(r,s,l):f})}function Sd(i){let e=1/0,r=1/0,s=-1/0,l=-1/0;for(const u of i)e=Math.min(e,u.x),r=Math.min(r,u.y),s=Math.max(s,u.x),l=Math.max(l,u.y);return{minX:e,minY:r,maxX:s,maxY:l}}function gg(i,e){return e-i}function Ed(i,e,r,s,l){const u=[];for(let d=0;d<i.length;d++){const f=i[d];let g;for(let b=0;b<f.length-1;b++){let w=f[b],E=f[b+1];w.x<e&&E.x<e||(w.x<e?w=new ve(e,w.y+(e-w.x)/(E.x-w.x)*(E.y-w.y))._round():E.x<e&&(E=new ve(e,w.y+(e-w.x)/(E.x-w.x)*(E.y-w.y))._round()),w.y<r&&E.y<r||(w.y<r?w=new ve(w.x+(r-w.y)/(E.y-w.y)*(E.x-w.x),r)._round():E.y<r&&(E=new ve(w.x+(r-w.y)/(E.y-w.y)*(E.x-w.x),r)._round()),w.x>=s&&E.x>=s||(w.x>=s?w=new ve(s,w.y+(s-w.x)/(E.x-w.x)*(E.y-w.y))._round():E.x>=s&&(E=new ve(s,w.y+(s-w.x)/(E.x-w.x)*(E.y-w.y))._round()),w.y>=l&&E.y>=l||(w.y>=l?w=new ve(w.x+(l-w.y)/(E.y-w.y)*(E.x-w.x),l)._round():E.y>=l&&(E=new ve(w.x+(l-w.y)/(E.y-w.y)*(E.x-w.x),l)._round()),g&&w.equals(g[g.length-1])||(g=[w],u.push(g)),g.push(E)))))}}return u}De("FeatureIndex",wd,{omit:["rawTileData","sourceLayerCoder"]});class Fn extends ve{constructor(e,r,s,l){super(e,r),this.angle=s,l!==void 0&&(this.segment=l)}clone(){return new Fn(this.x,this.y,this.angle,this.segment)}}function Id(i,e,r,s,l){if(e.segment===void 0)return!0;let u=e,d=e.segment+1,f=0;for(;f>-r/2;){if(d--,d<0)return!1;f-=i[d].dist(u),u=i[d]}f+=i[d].dist(i[d+1]),d++;const g=[];let b=0;for(;f<r/2;){const w=i[d],E=i[d+1];if(!E)return!1;let C=i[d-1].angleTo(w)-w.angleTo(E);for(C=Math.abs((C+3*Math.PI)%(2*Math.PI)-Math.PI),g.push({distance:f,angleDelta:C}),b+=C;f-g[0].distance>s;)b-=g.shift().angleDelta;if(b>l)return!1;d++,f+=w.dist(E)}return!0}function Ad(i){let e=0;for(let r=0;r<i.length-1;r++)e+=i[r].dist(i[r+1]);return e}function Cd(i,e,r){return i?.6*e*r:0}function Pd(i,e){return Math.max(i?i.right-i.left:0,e?e.right-e.left:0)}function _g(i,e,r,s,l,u){const d=Cd(r,l,u),f=Pd(r,s)*u;let g=0;const b=Ad(i)/2;for(let w=0;w<i.length-1;w++){const E=i[w],C=i[w+1],M=E.dist(C);if(g+M>b){const L=(b-g)/M,N=Pi.number(E.x,C.x,L),O=Pi.number(E.y,C.y,L),W=new Fn(N,O,C.angleTo(E),w);return W._round(),!d||Id(i,W,f,d,e)?W:void 0}g+=M}}function yg(i,e,r,s,l,u,d,f,g){const b=Cd(s,u,d),w=Pd(s,l),E=w*d,C=i[0].x===0||i[0].x===g||i[0].y===0||i[0].y===g;return e-E<e/4&&(e=E+e/4),Md(i,C?e/2*f%e:(w/2+2*u)*d*f%e,e,b,r,E,C,!1,g)}function Md(i,e,r,s,l,u,d,f,g){const b=u/2,w=Ad(i);let E=0,C=e-r,M=[];for(let L=0;L<i.length-1;L++){const N=i[L],O=i[L+1],W=N.dist(O),ee=O.angleTo(N);for(;C+r<E+W;){C+=r;const Z=(C-E)/W,re=Pi.number(N.x,O.x,Z),se=Pi.number(N.y,O.y,Z);if(re>=0&&re<g&&se>=0&&se<g&&C-b>=0&&C+b<=w){const he=new Fn(re,se,ee,L);he._round(),s&&!Id(i,he,u,s,l)||M.push(he)}}E+=W}return f||M.length||d||(M=Md(i,E/2,r,s,l,u,d,!0,g)),M}function kd(i,e,r,s){const l=[],u=i.image,d=u.pixelRatio,f=u.paddedRect.w-2,g=u.paddedRect.h-2,b=i.right-i.left,w=i.bottom-i.top,E=u.stretchX||[[0,f]],C=u.stretchY||[[0,g]],M=(be,Me)=>be+Me[1]-Me[0],L=E.reduce(M,0),N=C.reduce(M,0),O=f-L,W=g-N;let ee=0,Z=L,re=0,se=N,he=0,Le=O,Re=0,Pe=W;if(u.content&&s){const be=u.content;ee=zl(E,0,be[0]),re=zl(C,0,be[1]),Z=zl(E,be[0],be[2]),se=zl(C,be[1],be[3]),he=be[0]-ee,Re=be[1]-re,Le=be[2]-be[0]-Z,Pe=be[3]-be[1]-se}const Ee=(be,Me,Ae,ye)=>{const je=Ll(be.stretch-ee,Z,b,i.left),Fe=Dl(be.fixed-he,Le,be.stretch,L),nt=Ll(Me.stretch-re,se,w,i.top),Et=Dl(Me.fixed-Re,Pe,Me.stretch,N),Mt=Ll(Ae.stretch-ee,Z,b,i.left),Yt=Dl(Ae.fixed-he,Le,Ae.stretch,L),ar=Ll(ye.stretch-re,se,w,i.top),hi=Dl(ye.fixed-Re,Pe,ye.stretch,N),Xt=new ve(je,nt),ri=new ve(Mt,nt),ui=new ve(Mt,ar),vi=new ve(je,ar),Ui=new ve(Fe/d,Et/d),Wt=new ve(Yt/d,hi/d),di=e*Math.PI/180;if(di){const Ni=Math.sin(di),Vi=Math.cos(di),Ot=[Vi,-Ni,Ni,Vi];Xt._matMult(Ot),ri._matMult(Ot),vi._matMult(Ot),ui._matMult(Ot)}const bi=be.stretch+be.fixed,Li=Me.stretch+Me.fixed;return{tl:Xt,tr:ri,bl:vi,br:ui,tex:{x:u.paddedRect.x+1+bi,y:u.paddedRect.y+1+Li,w:Ae.stretch+Ae.fixed-bi,h:ye.stretch+ye.fixed-Li},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Ui,pixelOffsetBR:Wt,minFontScaleX:Le/d/b,minFontScaleY:Pe/d/w,isSDF:r}};if(s&&(u.stretchX||u.stretchY)){const be=zd(E,O,L),Me=zd(C,W,N);for(let Ae=0;Ae<be.length-1;Ae++){const ye=be[Ae],je=be[Ae+1];for(let Fe=0;Fe<Me.length-1;Fe++)l.push(Ee(ye,Me[Fe],je,Me[Fe+1]))}}else l.push(Ee({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:f+1},{fixed:0,stretch:g+1}));return l}function zl(i,e,r){let s=0;for(const l of i)s+=Math.max(e,Math.min(r,l[1]))-Math.max(e,Math.min(r,l[0]));return s}function zd(i,e,r){const s=[{fixed:-1,stretch:0}];for(const[l,u]of i){const d=s[s.length-1];s.push({fixed:l-d.stretch,stretch:d.stretch}),s.push({fixed:l-d.stretch,stretch:d.stretch+(u-l)})}return s.push({fixed:e+1,stretch:r}),s}function Ll(i,e,r,s){return i/e*r+s}function Dl(i,e,r,s){return i-e*r/s}De("Anchor",Fn);class Rl{constructor(e,r,s,l,u,d,f,g,b,w){if(this.boxStartIndex=e.length,b){let E=d.top,C=d.bottom;const M=d.collisionPadding;M&&(E-=M[1],C+=M[3]);let L=C-E;L>0&&(L=Math.max(10,L),this.circleDiameter=L)}else{let E=d.top*f-g[0],C=d.bottom*f+g[2],M=d.left*f-g[3],L=d.right*f+g[1];const N=d.collisionPadding;if(N&&(M-=N[0]*f,E-=N[1]*f,L+=N[2]*f,C+=N[3]*f),w){const O=new ve(M,E),W=new ve(L,E),ee=new ve(M,C),Z=new ve(L,C),re=w*Math.PI/180;O._rotate(re),W._rotate(re),ee._rotate(re),Z._rotate(re),M=Math.min(O.x,W.x,ee.x,Z.x),L=Math.max(O.x,W.x,ee.x,Z.x),E=Math.min(O.y,W.y,ee.y,Z.y),C=Math.max(O.y,W.y,ee.y,Z.y)}e.emplaceBack(r.x,r.y,M,E,L,C,s,l,u)}this.boxEndIndex=e.length}}class xg{constructor(e=[],r=vg){if(this.data=e,this.length=this.data.length,this.compare=r,this.length>0)for(let s=(this.length>>1)-1;s>=0;s--)this._down(s)}push(e){this.data.push(e),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const e=this.data[0],r=this.data.pop();return this.length--,this.length>0&&(this.data[0]=r,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:r,compare:s}=this,l=r[e];for(;e>0;){const u=e-1>>1,d=r[u];if(s(l,d)>=0)break;r[e]=d,e=u}r[e]=l}_down(e){const{data:r,compare:s}=this,l=this.length>>1,u=r[e];for(;e<l;){let d=1+(e<<1),f=r[d];const g=d+1;if(g<this.length&&s(r[g],f)<0&&(d=g,f=r[g]),s(f,u)>=0)break;r[e]=f,e=d}r[e]=u}}function vg(i,e){return i<e?-1:i>e?1:0}function bg(i,e=1,r=!1){let s=1/0,l=1/0,u=-1/0,d=-1/0;const f=i[0];for(let M=0;M<f.length;M++){const L=f[M];(!M||L.x<s)&&(s=L.x),(!M||L.y<l)&&(l=L.y),(!M||L.x>u)&&(u=L.x),(!M||L.y>d)&&(d=L.y)}const g=Math.min(u-s,d-l);let b=g/2;const w=new xg([],wg);if(g===0)return new ve(s,l);for(let M=s;M<u;M+=g)for(let L=l;L<d;L+=g)w.push(new pa(M+b,L+b,b,i));let E=function(M){let L=0,N=0,O=0;const W=M[0];for(let ee=0,Z=W.length,re=Z-1;ee<Z;re=ee++){const se=W[ee],he=W[re],Le=se.x*he.y-he.x*se.y;N+=(se.x+he.x)*Le,O+=(se.y+he.y)*Le,L+=3*Le}return new pa(N/L,O/L,0,M)}(i),C=w.length;for(;w.length;){const M=w.pop();(M.d>E.d||!E.d)&&(E=M,r&&console.log("found best %d after %d probes",Math.round(1e4*M.d)/1e4,C)),M.max-E.d<=e||(b=M.h/2,w.push(new pa(M.p.x-b,M.p.y-b,b,i)),w.push(new pa(M.p.x+b,M.p.y-b,b,i)),w.push(new pa(M.p.x-b,M.p.y+b,b,i)),w.push(new pa(M.p.x+b,M.p.y+b,b,i)),C+=4)}return r&&(console.log(`num probes: ${C}`),console.log(`best distance: ${E.d}`)),E.p}function wg(i,e){return e.max-i.max}function pa(i,e,r,s){this.p=new ve(i,e),this.h=r,this.d=function(l,u){let d=!1,f=1/0;for(let g=0;g<u.length;g++){const b=u[g];for(let w=0,E=b.length,C=E-1;w<E;C=w++){const M=b[w],L=b[C];M.y>l.y!=L.y>l.y&&l.x<(L.x-M.x)*(l.y-M.y)/(L.y-M.y)+M.x&&(d=!d),f=Math.min(f,gu(l,M,L))}}return(d?1:-1)*Math.sqrt(f)}(this.p,s),this.max=this.d+this.h*Math.SQRT2}const Zc=Number.POSITIVE_INFINITY;function Ld(i,e){return e[1]!==Zc?function(r,s,l){let u=0,d=0;switch(s=Math.abs(s),l=Math.abs(l),r){case"top-right":case"top-left":case"top":d=l-7;break;case"bottom-right":case"bottom-left":case"bottom":d=7-l}switch(r){case"top-right":case"bottom-right":case"right":u=-s;break;case"top-left":case"bottom-left":case"left":u=s}return[u,d]}(i,e[0],e[1]):function(r,s){let l=0,u=0;s<0&&(s=0);const d=s/Math.sqrt(2);switch(r){case"top-right":case"top-left":u=d-7;break;case"bottom-right":case"bottom-left":u=7-d;break;case"bottom":u=7-s;break;case"top":u=s-7}switch(r){case"top-right":case"bottom-right":l=-d;break;case"top-left":case"bottom-left":l=d;break;case"left":l=s;break;case"right":l=-s}return[l,u]}(i,e[0])}function Xc(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 Tg(i,e,r,s,l,u,d,f,g,b,w){let E=u.textMaxSize.evaluate(e,{});E===void 0&&(E=d);const C=i.layers[0].layout,M=C.get("icon-offset").evaluate(e,{},w),L=Rd(r.horizontal),N=d/24,O=i.tilePixelRatio*N,W=i.tilePixelRatio*E/24,ee=i.tilePixelRatio*f,Z=i.tilePixelRatio*C.get("symbol-spacing"),re=C.get("text-padding")*i.tilePixelRatio,se=function(ye,je,Fe,nt=1){const Et=ye.get("icon-padding").evaluate(je,{},Fe),Mt=Et&&Et.values;return[Mt[0]*nt,Mt[1]*nt,Mt[2]*nt,Mt[3]*nt]}(C,e,w,i.tilePixelRatio),he=C.get("text-max-angle")/180*Math.PI,Le=C.get("text-rotation-alignment")!=="viewport"&&C.get("symbol-placement")!=="point",Re=C.get("icon-rotation-alignment")==="map"&&C.get("symbol-placement")!=="point",Pe=C.get("symbol-placement"),Ee=Z/2,be=C.get("icon-text-fit");let Me;s&&be!=="none"&&(i.allowVerticalPlacement&&r.vertical&&(Me=sd(s,r.vertical,be,C.get("icon-text-fit-padding"),M,N)),L&&(s=sd(s,L,be,C.get("icon-text-fit-padding"),M,N)));const Ae=(ye,je)=>{je.x<0||je.x>=Pt||je.y<0||je.y>=Pt||function(Fe,nt,Et,Mt,Yt,ar,hi,Xt,ri,ui,vi,Ui,Wt,di,bi,Li,Ni,Vi,Ot,pi,st,Yi,fi,wi,vr){const kr=Fe.addToLineVertexArray(nt,Et);let zr,hn,br,or,$i=0,un=0,vo=0,Ud=0,th=-1,ih=-1;const dn={};let Nd=$t(""),rh=0,nh=0;if(Xt._unevaluatedLayout.getValue("text-radial-offset")===void 0?[rh,nh]=Xt.layout.get("text-offset").evaluate(st,{},wi).map(ji=>ji*ai):(rh=Xt.layout.get("text-radial-offset").evaluate(st,{},wi)*ai,nh=Zc),Fe.allowVerticalPlacement&&Mt.vertical){const ji=Xt.layout.get("text-rotate").evaluate(st,{},wi)+90;br=new Rl(ri,nt,ui,vi,Ui,Mt.vertical,Wt,di,bi,ji),hi&&(or=new Rl(ri,nt,ui,vi,Ui,hi,Ni,Vi,bi,ji))}if(Yt){const ji=Xt.layout.get("icon-rotate").evaluate(st,{}),qr=Xt.layout.get("icon-text-fit")!=="none",bo=kd(Yt,ji,fi,qr),wo=hi?kd(hi,ji,fi,qr):void 0;hn=new Rl(ri,nt,ui,vi,Ui,Yt,Ni,Vi,!1,ji),$i=4*bo.length;const jd=Fe.iconSizeData;let ms=null;jd.kind==="source"?(ms=[cn*Xt.layout.get("icon-size").evaluate(st,{})],ms[0]>Rn&&oi(`${Fe.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):jd.kind==="composite"&&(ms=[cn*Yi.compositeIconSizes[0].evaluate(st,{},wi),cn*Yi.compositeIconSizes[1].evaluate(st,{},wi)],(ms[0]>Rn||ms[1]>Rn)&&oi(`${Fe.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),Fe.addSymbols(Fe.icon,bo,ms,pi,Ot,st,h.WritingMode.none,nt,kr.lineStartIndex,kr.lineLength,-1,wi),th=Fe.icon.placedSymbolArray.length-1,wo&&(un=4*wo.length,Fe.addSymbols(Fe.icon,wo,ms,pi,Ot,st,h.WritingMode.vertical,nt,kr.lineStartIndex,kr.lineLength,-1,wi),ih=Fe.icon.placedSymbolArray.length-1)}const Vd=Object.keys(Mt.horizontal);for(const ji of Vd){const qr=Mt.horizontal[ji];if(!zr){Nd=$t(qr.text);const wo=Xt.layout.get("text-rotate").evaluate(st,{},wi);zr=new Rl(ri,nt,ui,vi,Ui,qr,Wt,di,bi,wo)}const bo=qr.positionedLines.length===1;if(vo+=Dd(Fe,nt,qr,ar,Xt,bi,st,Li,kr,Mt.vertical?h.WritingMode.horizontal:h.WritingMode.horizontalOnly,bo?Vd:[ji],dn,th,Yi,wi),bo)break}Mt.vertical&&(Ud+=Dd(Fe,nt,Mt.vertical,ar,Xt,bi,st,Li,kr,h.WritingMode.vertical,["vertical"],dn,ih,Yi,wi));const Ig=zr?zr.boxStartIndex:Fe.collisionBoxArray.length,Ag=zr?zr.boxEndIndex:Fe.collisionBoxArray.length,Cg=br?br.boxStartIndex:Fe.collisionBoxArray.length,Pg=br?br.boxEndIndex:Fe.collisionBoxArray.length,Mg=hn?hn.boxStartIndex:Fe.collisionBoxArray.length,kg=hn?hn.boxEndIndex:Fe.collisionBoxArray.length,zg=or?or.boxStartIndex:Fe.collisionBoxArray.length,Lg=or?or.boxEndIndex:Fe.collisionBoxArray.length;let Lr=-1;const Fl=(ji,qr)=>ji&&ji.circleDiameter?Math.max(ji.circleDiameter,qr):qr;Lr=Fl(zr,Lr),Lr=Fl(br,Lr),Lr=Fl(hn,Lr),Lr=Fl(or,Lr);const $d=Lr>-1?1:0;$d&&(Lr*=vr/ai),Fe.glyphOffsetArray.length>=da.MAX_GLYPHS&&oi("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),st.sortKey!==void 0&&Fe.addToSortKeyRanges(Fe.symbolInstances.length,st.sortKey),Fe.symbolInstances.emplaceBack(nt.x,nt.y,dn.right>=0?dn.right:-1,dn.center>=0?dn.center:-1,dn.left>=0?dn.left:-1,dn.vertical||-1,th,ih,Nd,Ig,Ag,Cg,Pg,Mg,kg,zg,Lg,ui,vo,Ud,$i,un,$d,0,Wt,rh,nh,Lr)}(i,je,ye,r,s,l,Me,i.layers[0],i.collisionBoxArray,e.index,e.sourceLayerIndex,i.index,O,[re,re,re,re],Le,g,ee,se,Re,M,e,u,b,w,d)};if(Pe==="line")for(const ye of Ed(e.geometry,0,0,Pt,Pt)){const je=yg(ye,Z,he,r.vertical||L,s,24,W,i.overscaling,Pt);for(const Fe of je)L&&Sg(i,L.text,Ee,Fe)||Ae(ye,Fe)}else if(Pe==="line-center"){for(const ye of e.geometry)if(ye.length>1){const je=_g(ye,he,r.vertical||L,s,24,W);je&&Ae(ye,je)}}else if(e.type==="Polygon")for(const ye of Ic(e.geometry,0)){const je=bg(ye,16);Ae(ye[0],new Fn(je.x,je.y,0))}else if(e.type==="LineString")for(const ye of e.geometry)Ae(ye,new Fn(ye[0].x,ye[0].y,0));else if(e.type==="Point")for(const ye of e.geometry)for(const je of ye)Ae([je],new Fn(je.x,je.y,0))}function Dd(i,e,r,s,l,u,d,f,g,b,w,E,C,M,L){const N=function(ee,Z,re,se,he,Le,Re,Pe){const Ee=se.layout.get("text-rotate").evaluate(Le,{})*Math.PI/180,be=[];for(const Me of Z.positionedLines)for(const Ae of Me.positionedGlyphs){if(!Ae.rect)continue;const ye=Ae.rect||{};let je=4,Fe=!0,nt=1,Et=0;const Mt=(he||Pe)&&Ae.vertical,Yt=Ae.metrics.advance*Ae.scale/2;if(Pe&&Z.verticalizable&&(Et=Me.lineOffset/2-(Ae.imageName?-(ai-Ae.metrics.width*Ae.scale)/2:(Ae.scale-1)*ai)),Ae.imageName){const Ot=Re[Ae.imageName];Fe=Ot.sdf,nt=Ot.pixelRatio,je=1/nt}const ar=he?[Ae.x+Yt,Ae.y]:[0,0];let hi=he?[0,0]:[Ae.x+Yt+re[0],Ae.y+re[1]-Et],Xt=[0,0];Mt&&(Xt=hi,hi=[0,0]);const ri=(Ae.metrics.left-je)*Ae.scale-Yt+hi[0],ui=(-Ae.metrics.top-je)*Ae.scale+hi[1],vi=ri+ye.w*Ae.scale/nt,Ui=ui+ye.h*Ae.scale/nt,Wt=new ve(ri,ui),di=new ve(vi,ui),bi=new ve(ri,Ui),Li=new ve(vi,Ui);if(Mt){const Ot=new ve(-Yt,Yt-Il),pi=-Math.PI/2,st=12-Yt,Yi=new ve(22-st,-(Ae.imageName?st:0)),fi=new ve(...Xt);Wt._rotateAround(pi,Ot)._add(Yi)._add(fi),di._rotateAround(pi,Ot)._add(Yi)._add(fi),bi._rotateAround(pi,Ot)._add(Yi)._add(fi),Li._rotateAround(pi,Ot)._add(Yi)._add(fi)}if(Ee){const Ot=Math.sin(Ee),pi=Math.cos(Ee),st=[pi,-Ot,Ot,pi];Wt._matMult(st),di._matMult(st),bi._matMult(st),Li._matMult(st)}const Ni=new ve(0,0),Vi=new ve(0,0);be.push({tl:Wt,tr:di,bl:bi,br:Li,tex:ye,writingMode:Z.writingMode,glyphOffset:ar,sectionIndex:Ae.sectionIndex,isSDF:Fe,pixelOffsetTL:Ni,pixelOffsetBR:Vi,minFontScaleX:0,minFontScaleY:0})}return be}(0,r,f,l,u,d,s,i.allowVerticalPlacement),O=i.textSizeData;let W=null;O.kind==="source"?(W=[cn*l.layout.get("text-size").evaluate(d,{})],W[0]>Rn&&oi(`${i.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):O.kind==="composite"&&(W=[cn*M.compositeTextSizes[0].evaluate(d,{},L),cn*M.compositeTextSizes[1].evaluate(d,{},L)],(W[0]>Rn||W[1]>Rn)&&oi(`${i.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),i.addSymbols(i.text,N,W,f,u,d,b,e,g.lineStartIndex,g.lineLength,C,L);for(const ee of w)E[ee]=i.text.placedSymbolArray.length-1;return 4*N.length}function Rd(i){for(const e in i)return i[e];return null}function Sg(i,e,r,s){const l=i.compareText;if(e in l){const u=l[e];for(let d=u.length-1;d>=0;d--)if(s.dist(u[d])<r)return!0}else l[e]=[];return l[e].push(s),!1}const Bd=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Wc{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[r,s]=new Uint8Array(e,0,2);if(r!==219)throw new Error("Data does not appear to be in a KDBush format.");const l=s>>4;if(l!==1)throw new Error(`Got v${l} data when expected v1.`);const u=Bd[15&s];if(!u)throw new Error("Unrecognized array type.");const[d]=new Uint16Array(e,2,1),[f]=new Uint32Array(e,4,1);return new Wc(f,d,u,e)}constructor(e,r=64,s=Float64Array,l){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=s,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const u=Bd.indexOf(this.ArrayType),d=2*e*this.ArrayType.BYTES_PER_ELEMENT,f=e*this.IndexArrayType.BYTES_PER_ELEMENT,g=(8-f%8)%8;if(u<0)throw new Error(`Unexpected typed array class: ${s}.`);l&&l instanceof ArrayBuffer?(this.data=l,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+f+g,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+d+f+g),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+f+g,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+u]),new Uint16Array(this.data,2,1)[0]=r,new Uint32Array(this.data,4,1)[0]=e)}add(e,r){const s=this._pos>>1;return this.ids[s]=s,this.coords[this._pos++]=e,this.coords[this._pos++]=r,s}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return Hc(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,r,s,l){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:u,coords:d,nodeSize:f}=this,g=[0,u.length-1,0],b=[];for(;g.length;){const w=g.pop()||0,E=g.pop()||0,C=g.pop()||0;if(E-C<=f){for(let O=C;O<=E;O++){const W=d[2*O],ee=d[2*O+1];W>=e&&W<=s&&ee>=r&&ee<=l&&b.push(u[O])}continue}const M=C+E>>1,L=d[2*M],N=d[2*M+1];L>=e&&L<=s&&N>=r&&N<=l&&b.push(u[M]),(w===0?e<=L:r<=N)&&(g.push(C),g.push(M-1),g.push(1-w)),(w===0?s>=L:l>=N)&&(g.push(M+1),g.push(E),g.push(1-w))}return b}within(e,r,s){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:l,coords:u,nodeSize:d}=this,f=[0,l.length-1,0],g=[],b=s*s;for(;f.length;){const w=f.pop()||0,E=f.pop()||0,C=f.pop()||0;if(E-C<=d){for(let O=C;O<=E;O++)Od(u[2*O],u[2*O+1],e,r)<=b&&g.push(l[O]);continue}const M=C+E>>1,L=u[2*M],N=u[2*M+1];Od(L,N,e,r)<=b&&g.push(l[M]),(w===0?e-s<=L:r-s<=N)&&(f.push(C),f.push(M-1),f.push(1-w)),(w===0?e+s>=L:r+s>=N)&&(f.push(M+1),f.push(E),f.push(1-w))}return g}}function Hc(i,e,r,s,l,u){if(l-s<=r)return;const d=s+l>>1;Fd(i,e,d,s,l,u),Hc(i,e,r,s,d-1,1-u),Hc(i,e,r,d+1,l,1-u)}function Fd(i,e,r,s,l,u){for(;l>s;){if(l-s>600){const b=l-s+1,w=r-s+1,E=Math.log(b),C=.5*Math.exp(2*E/3),M=.5*Math.sqrt(E*C*(b-C)/b)*(w-b/2<0?-1:1);Fd(i,e,r,Math.max(s,Math.floor(r-w*C/b+M)),Math.min(l,Math.floor(r+(b-w)*C/b+M)),u)}const d=e[2*r+u];let f=s,g=l;for(yo(i,e,s,r),e[2*l+u]>d&&yo(i,e,s,l);f<g;){for(yo(i,e,f,g),f++,g--;e[2*f+u]<d;)f++;for(;e[2*g+u]>d;)g--}e[2*s+u]===d?yo(i,e,s,g):(g++,yo(i,e,g,l)),g<=r&&(s=g+1),r<=g&&(l=g-1)}}function yo(i,e,r,s){Kc(i,r,s),Kc(e,2*r,2*s),Kc(e,2*r+1,2*s+1)}function Kc(i,e,r){const s=i[e];i[e]=i[r],i[r]=s}function Od(i,e,r,s){const l=i-r,u=e-s;return l*l+u*u}var Yc;h.PerformanceMarkers=void 0,(Yc=h.PerformanceMarkers||(h.PerformanceMarkers={})).create="create",Yc.load="load",Yc.fullLoad="fullLoad";let Bl=null,xo=[];const Jc=1e3/60,Qc="loadTime",eh="fullLoadTime",Eg={mark(i){performance.mark(i)},frame(i){const e=i;Bl!=null&&xo.push(e-Bl),Bl=e},clearMetrics(){Bl=null,xo=[],performance.clearMeasures(Qc),performance.clearMeasures(eh);for(const i in h.PerformanceMarkers)performance.clearMarks(h.PerformanceMarkers[i])},getPerformanceMetrics(){performance.measure(Qc,h.PerformanceMarkers.create,h.PerformanceMarkers.load),performance.measure(eh,h.PerformanceMarkers.create,h.PerformanceMarkers.fullLoad);const i=performance.getEntriesByName(Qc)[0].duration,e=performance.getEntriesByName(eh)[0].duration,r=xo.length,s=1/(xo.reduce((u,d)=>u+d,0)/r/1e3),l=xo.filter(u=>u>Jc).reduce((u,d)=>u+(d-Jc)/Jc,0);return{loadTime:i,fullLoadTime:e,fps:s,percentDroppedFrames:l/(r+l)*100,totalFrames:r}}};h.AJAXError=Br,h.ARRAY_TYPE=aa,h.Actor=class{constructor(i,e,r){this.target=i,this.parent=e,this.mapId=r,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},Un(["receive","process"],this),this.invoker=new mg(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=qi()?i:window}send(i,e,r,s,l=!1){const u=Math.round(1e18*Math.random()).toString(36).substring(0,10);r&&(this.callbacks[u]=r);const d=Rr(this.globalScope)?void 0:[];return this.target.postMessage({id:u,type:i,hasCallback:!!r,targetMapId:s,mustQueue:l,sourceMapId:this.mapId,data:as(e,d)},d),{cancel:()=>{r&&delete this.callbacks[u],this.target.postMessage({id:u,type:"<cancel>",targetMapId:s,sourceMapId:this.mapId})}}}receive(i){const e=i.data,r=e.id;if(r&&(!e.targetMapId||this.mapId===e.targetMapId))if(e.type==="<cancel>"){delete this.tasks[r];const s=this.cancelCallbacks[r];delete this.cancelCallbacks[r],s&&s()}else qi()||e.mustQueue?(this.tasks[r]=e,this.taskQueue.push(r),this.invoker.trigger()):this.processTask(r,e)}process(){if(!this.taskQueue.length)return;const i=this.taskQueue.shift(),e=this.tasks[i];delete this.tasks[i],this.taskQueue.length&&this.invoker.trigger(),e&&this.processTask(i,e)}processTask(i,e){if(e.type==="<response>"){const r=this.callbacks[i];delete this.callbacks[i],r&&(e.error?r(Ar(e.error)):r(null,Ar(e.data)))}else{let r=!1;const s=Rr(this.globalScope)?void 0:[],l=e.hasCallback?(f,g)=>{r=!0,delete this.cancelCallbacks[i],this.target.postMessage({id:i,type:"<response>",sourceMapId:this.mapId,error:f?as(f):null,data:as(g,s)},s)}:f=>{r=!0};let u=null;const d=Ar(e.data);if(this.parent[e.type])u=this.parent[e.type](e.sourceMapId,d,l);else if(this.parent.getWorkerSource){const f=e.type.split(".");u=this.parent.getWorkerSource(e.sourceMapId,f[0],d.source)[f[1]](d,l)}else l(new Error(`Could not find function ${e.type}`));!r&&u&&u.cancel&&(this.cancelCallbacks[i]=u.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}},h.AlphaImage=oo,h.CanonicalTileID=qc,h.CollisionBoxArray=c,h.CollisionCircleLayoutArray=class extends Qs{},h.Color=lt,h.DEMData=xd,h.DataConstantProperty=Ue,h.DictionaryCoder=vd,h.EXTENT=Pt,h.ErrorEvent=ur,h.EvaluationParameters=Ct,h.Event=Qi,h.Evented=Zi,h.FeatureIndex=wd,h.FillBucket=Pc,h.FillExtrusionBucket=kc,h.GeoJSONFeature=bd,h.ImageAtlas=ed,h.ImagePosition=Rc,h.KDBush=Wc,h.LineBucket=zc,h.LineStripIndexArray=class extends t{},h.LngLat=Bn,h.MercatorCoordinate=kl,h.ONE_EM=ai,h.OverscaledTileID=sr,h.PerformanceUtils=Eg,h.Point=ve,h.Pos3dArray=class extends Ks{},h.PosArray=U,h.Properties=ki,h.Protobuf=Dc,h.QuadTriangleArray=class extends ea{},h.RGBAImage=nr,h.RasterBoundsArray=class extends eo{},h.RequestPerformance=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}},h.SegmentVector=we,h.SymbolBucket=da,h.Transitionable=dl,h.TriangleIndexArray=ge,h.Uniform1f=xr,h.Uniform1i=class extends xi{constructor(i,e){super(i,e),this.current=0}set(i){this.current!==i&&(this.current=i,this.gl.uniform1i(this.location,i))}},h.Uniform2f=class extends xi{constructor(i,e){super(i,e),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]))}},h.Uniform3f=class extends xi{constructor(i,e){super(i,e),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]))}},h.Uniform4f=us,h.UniformColor=ci,h.UniformMatrix4f=class extends xi{constructor(i,e){super(i,e),this.current=ti}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 e=1;e<16;e++)if(i[e]!==this.current[e]){this.current=i,this.gl.uniformMatrix4fv(this.location,!1,i);break}}},h.UnwrappedTileID=yd,h.ValidationError=Ie,h.ZoomHistory=al,h.addDynamicAttributes=Uc,h.arrayBufferToImage=function(i,e){const r=new Image;r.onload=()=>{e(null,r),URL.revokeObjectURL(r.src),r.onload=null,window.requestAnimationFrame(()=>{r.src=Sr})},r.onerror=()=>e(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const s=new Blob([new Uint8Array(i)],{type:"image/png"});r.src=i.byteLength?URL.createObjectURL(s):Sr},h.arrayBufferToImageBitmap=function(i,e){const r=new Blob([new Uint8Array(i)],{type:"image/png"});createImageBitmap(r).then(s=>{e(null,s)}).catch(s=>{e(new Error(`Could not load image because of ${s.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})},h.asyncAll=function(i,e,r){if(!i.length)return r(null,[]);let s=i.length;const l=new Array(i.length);let u=null;i.forEach((d,f)=>{e(d,(g,b)=>{g&&(u=g),l[f]=b,--s==0&&r(u,l)})})},h.bezier=kt,h.bindAll=Un,h.clamp=It,h.clipLine=Ed,h.clone=function(i){var e=new aa(16);return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],e},h.clone$1=Ti,h.collisionCircleLayout=Gm,h.config=Hr,h.copy=function(i,e){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i},h.create=function(){var i=new aa(16);return aa!=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},h.createExpression=Dt,h.createFilter=Ua,h.createLayout=Zt,h.createStyleLayer=function(i){return i.type==="custom"?new pg(i):new fg[i.type](i)},h.deepEqual=function i(e,r){if(Array.isArray(e)){if(!Array.isArray(r)||e.length!==r.length)return!1;for(let s=0;s<e.length;s++)if(!i(e[s],r[s]))return!1;return!0}if(typeof e=="object"&&e!==null&&r!==null){if(typeof r!="object"||Object.keys(e).length!==Object.keys(r).length)return!1;for(const s in e)if(!i(e[s],r[s]))return!1;return!0}return e===r},h.derefLayers=function(i){i=i.slice();const e=Object.create(null);for(let r=0;r<i.length;r++)e[i[r].id]=i[r];for(let r=0;r<i.length;r++)"ref"in i[r]&&(i[r]=Yr(i[r],e[i[r].ref]));return i},h.diffStyles=function(i,e){if(!i)return[{command:pt.setStyle,args:[e]}];let r=[];try{if(!bt(i.version,e.version))return[{command:pt.setStyle,args:[e]}];bt(i.center,e.center)||r.push({command:pt.setCenter,args:[e.center]}),bt(i.zoom,e.zoom)||r.push({command:pt.setZoom,args:[e.zoom]}),bt(i.bearing,e.bearing)||r.push({command:pt.setBearing,args:[e.bearing]}),bt(i.pitch,e.pitch)||r.push({command:pt.setPitch,args:[e.pitch]}),bt(i.sprite,e.sprite)||r.push({command:pt.setSprite,args:[e.sprite]}),bt(i.glyphs,e.glyphs)||r.push({command:pt.setGlyphs,args:[e.glyphs]}),bt(i.transition,e.transition)||r.push({command:pt.setTransition,args:[e.transition]}),bt(i.light,e.light)||r.push({command:pt.setLight,args:[e.light]});const s={},l=[];(function(d,f,g,b){let w;for(w in f=f||{},d=d||{})Object.prototype.hasOwnProperty.call(d,w)&&(Object.prototype.hasOwnProperty.call(f,w)||$n(w,g,b));for(w in f)Object.prototype.hasOwnProperty.call(f,w)&&(Object.prototype.hasOwnProperty.call(d,w)?bt(d[w],f[w])||(d[w].type==="geojson"&&f[w].type==="geojson"&&vs(d,f,w)?g.push({command:pt.setGeoJSONSourceData,args:[w,f[w].data]}):xs(w,f,g,b)):Di(w,f,g))})(i.sources,e.sources,l,s);const u=[];i.layers&&i.layers.forEach(d=>{s[d.source]?r.push({command:pt.removeLayer,args:[d.id]}):u.push(d)}),r=r.concat(l),function(d,f,g){f=f||[];const b=(d=d||[]).map(Jr),w=f.map(Jr),E=d.reduce(jn,{}),C=f.reduce(jn,{}),M=b.slice(),L=Object.create(null);let N,O,W,ee,Z,re,se;for(N=0,O=0;N<b.length;N++)W=b[N],Object.prototype.hasOwnProperty.call(C,W)?O++:(g.push({command:pt.removeLayer,args:[W]}),M.splice(M.indexOf(W,O),1));for(N=0,O=0;N<w.length;N++)W=w[w.length-1-N],M[M.length-1-N]!==W&&(Object.prototype.hasOwnProperty.call(E,W)?(g.push({command:pt.removeLayer,args:[W]}),M.splice(M.lastIndexOf(W,M.length-O),1)):O++,re=M[M.length-N],g.push({command:pt.addLayer,args:[C[W],re]}),M.splice(M.length-N,0,W),L[W]=!0);for(N=0;N<w.length;N++)if(W=w[N],ee=E[W],Z=C[W],!L[W]&&!bt(ee,Z))if(bt(ee.source,Z.source)&&bt(ee["source-layer"],Z["source-layer"])&&bt(ee.type,Z.type)){for(se in ni(ee.layout,Z.layout,g,W,null,pt.setLayoutProperty),ni(ee.paint,Z.paint,g,W,null,pt.setPaintProperty),bt(ee.filter,Z.filter)||g.push({command:pt.setFilter,args:[W,Z.filter]}),bt(ee.minzoom,Z.minzoom)&&bt(ee.maxzoom,Z.maxzoom)||g.push({command:pt.setLayerZoomRange,args:[W,Z.minzoom,Z.maxzoom]}),ee)Object.prototype.hasOwnProperty.call(ee,se)&&se!=="layout"&&se!=="paint"&&se!=="filter"&&se!=="metadata"&&se!=="minzoom"&&se!=="maxzoom"&&(se.indexOf("paint.")===0?ni(ee[se],Z[se],g,W,se.slice(6),pt.setPaintProperty):bt(ee[se],Z[se])||g.push({command:pt.setLayerProperty,args:[W,se,Z[se]]}));for(se in Z)Object.prototype.hasOwnProperty.call(Z,se)&&!Object.prototype.hasOwnProperty.call(ee,se)&&se!=="layout"&&se!=="paint"&&se!=="filter"&&se!=="metadata"&&se!=="minzoom"&&se!=="maxzoom"&&(se.indexOf("paint.")===0?ni(ee[se],Z[se],g,W,se.slice(6),pt.setPaintProperty):bt(ee[se],Z[se])||g.push({command:pt.setLayerProperty,args:[W,se,Z[se]]}))}else g.push({command:pt.removeLayer,args:[W]}),re=M[M.lastIndexOf(W)+1],g.push({command:pt.addLayer,args:[Z,re]})}(u,e.layers,r)}catch(s){console.warn("Unable to compute style diff:",s),r=[{command:pt.setStyle,args:[e]}]}return r},h.dot=function(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]+i[3]*e[3]},h.earthRadius=jc,h.ease=Rt,h.emitValidationErrors=Mn,h.emptyStyle=function(){const i={},e=oe.$version;for(const r in oe.$root){const s=oe.$root[r];if(s.required){let l=null;l=r==="version"?e:s.type==="array"?[]:{},l!=null&&(i[r]=l)}}return i},h.equals=function(i,e){var r=i[0],s=i[1],l=i[2],u=i[3],d=i[4],f=i[5],g=i[6],b=i[7],w=i[8],E=i[9],C=i[10],M=i[11],L=i[12],N=i[13],O=i[14],W=i[15],ee=e[0],Z=e[1],re=e[2],se=e[3],he=e[4],Le=e[5],Re=e[6],Pe=e[7],Ee=e[8],be=e[9],Me=e[10],Ae=e[11],ye=e[12],je=e[13],Fe=e[14],nt=e[15];return Math.abs(r-ee)<=zi*Math.max(1,Math.abs(r),Math.abs(ee))&&Math.abs(s-Z)<=zi*Math.max(1,Math.abs(s),Math.abs(Z))&&Math.abs(l-re)<=zi*Math.max(1,Math.abs(l),Math.abs(re))&&Math.abs(u-se)<=zi*Math.max(1,Math.abs(u),Math.abs(se))&&Math.abs(d-he)<=zi*Math.max(1,Math.abs(d),Math.abs(he))&&Math.abs(f-Le)<=zi*Math.max(1,Math.abs(f),Math.abs(Le))&&Math.abs(g-Re)<=zi*Math.max(1,Math.abs(g),Math.abs(Re))&&Math.abs(b-Pe)<=zi*Math.max(1,Math.abs(b),Math.abs(Pe))&&Math.abs(w-Ee)<=zi*Math.max(1,Math.abs(w),Math.abs(Ee))&&Math.abs(E-be)<=zi*Math.max(1,Math.abs(E),Math.abs(be))&&Math.abs(C-Me)<=zi*Math.max(1,Math.abs(C),Math.abs(Me))&&Math.abs(M-Ae)<=zi*Math.max(1,Math.abs(M),Math.abs(Ae))&&Math.abs(L-ye)<=zi*Math.max(1,Math.abs(L),Math.abs(ye))&&Math.abs(N-je)<=zi*Math.max(1,Math.abs(N),Math.abs(je))&&Math.abs(O-Fe)<=zi*Math.max(1,Math.abs(O),Math.abs(Fe))&&Math.abs(W-nt)<=zi*Math.max(1,Math.abs(W),Math.abs(nt))},h.evaluateSizeForFeature=function(i,{uSize:e,uSizeT:r},{lowerSize:s,upperSize:l}){return i.kind==="source"?s/cn:i.kind==="composite"?Pi.number(s/cn,l/cn,r):e},h.evaluateSizeForZoom=function(i,e){let r=0,s=0;if(i.kind==="constant")s=i.layoutSize;else if(i.kind!=="source"){const{interpolationType:l,minZoom:u,maxZoom:d}=i,f=l?It(Bi.interpolationFactor(l,e,u,d),0,1):0;i.kind==="camera"?s=Pi.number(i.minSize,i.maxSize,f):r=f}return{uSizeT:r,uSize:s}},h.evaluateVariableOffset=Ld,h.evented=Zs,h.exported=yn,h.extend=_i,h.filterObject=mn,h.findLineIntersection=function(i,e,r,s){const l=e.y-i.y,u=e.x-i.x,d=s.y-r.y,f=s.x-r.x,g=d*u-f*l;if(g===0)return null;const b=(f*(i.y-r.y)-d*(i.x-r.x))/g;return new ve(i.x+b*u,i.y+b*l)},h.fromScaling=function(i,e){return i[0]=e[0],i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=e[1],i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=e[2],i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i},h.getAnchorAlignment=Fc,h.getAnchorJustification=Xc,h.getArrayBuffer=Or,h.getDefaultExportFromCjs=me,h.getJSON=function(i,e){return Gt(_i(i,{type:"json"}),e)},h.getOverlapMode=Oc,h.getProtocolAction=Fr,h.getRTLTextPluginStatus=Ha,h.getReferrer=Nn,h.getVideo=function(i,e){const r=window.document.createElement("video");r.muted=!0,r.onloadstart=function(){e(null,r)};for(let s=0;s<i.length;s++){const l=window.document.createElement("source");Vn(i[s])||(r.crossOrigin="Anonymous"),l.src=i[s],r.appendChild(l)}return{cancel:()=>{}}},h.groupByLayout=function(i,e){const r={};for(let l=0;l<i.length;l++){const u=e&&e[i[l].id]||hc(i[l]);e&&(e[i[l].id]=u);let d=r[u];d||(d=r[u]=[]),d.push(i[l])}const s=[];for(const l in r)s.push(r[l]);return s},h.identity=xc,h.interpolate=Pi,h.invert=function(i,e){var r=e[0],s=e[1],l=e[2],u=e[3],d=e[4],f=e[5],g=e[6],b=e[7],w=e[8],E=e[9],C=e[10],M=e[11],L=e[12],N=e[13],O=e[14],W=e[15],ee=r*f-s*d,Z=r*g-l*d,re=r*b-u*d,se=s*g-l*f,he=s*b-u*f,Le=l*b-u*g,Re=w*N-E*L,Pe=w*O-C*L,Ee=w*W-M*L,be=E*O-C*N,Me=E*W-M*N,Ae=C*W-M*O,ye=ee*Ae-Z*Me+re*be+se*Ee-he*Pe+Le*Re;return ye?(i[0]=(f*Ae-g*Me+b*be)*(ye=1/ye),i[1]=(l*Me-s*Ae-u*be)*ye,i[2]=(N*Le-O*he+W*se)*ye,i[3]=(C*he-E*Le-M*se)*ye,i[4]=(g*Ee-d*Ae-b*Pe)*ye,i[5]=(r*Ae-l*Ee+u*Pe)*ye,i[6]=(O*re-L*Le-W*Z)*ye,i[7]=(w*Le-C*re+M*Z)*ye,i[8]=(d*Me-f*Ee+b*Re)*ye,i[9]=(s*Ee-r*Me-u*Re)*ye,i[10]=(L*he-N*re+W*ee)*ye,i[11]=(E*re-w*he-M*ee)*ye,i[12]=(f*Pe-d*be-g*Re)*ye,i[13]=(r*be-s*Pe+l*Re)*ye,i[14]=(N*Z-L*se-O*ee)*ye,i[15]=(w*se-E*Z+C*ee)*ye,i):null},h.isImageBitmap=Wr,h.isSafari=Rr,h.isWorker=qi,h.keysDifference=function(i,e){const r=[];for(const s in i)s in e||r.push(s);return r},h.lazyLoadRTLTextPlugin=function(){Ki.isLoading()||Ki.isLoaded()||Ha()!=="deferred"||ul()},h.makeRequest=Gt,h.mapObject=Dr,h.mercatorXfromLng=fd,h.mercatorYfromLat=md,h.mercatorZfromAltitude=gd,h.mul=im,h.mul$1=function(i,e,r){return i[0]=e[0]*r[0],i[1]=e[1]*r[1],i[2]=e[2]*r[2],i[3]=e[3]*r[3],i},h.multiply=vu,h.nextPowerOfTwo=function(i){return i<=1?1:Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))},h.operations=pt,h.ortho=function(i,e,r,s,l,u,d){var f=1/(e-r),g=1/(s-l),b=1/(u-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*b,i[11]=0,i[12]=(e+r)*f,i[13]=(l+s)*g,i[14]=(d+u)*b,i[15]=1,i},h.parseCacheControl=function(i){const e={};if(i.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(r,s,l,u)=>{const d=l||u;return e[s]=!d||d.toLowerCase(),""}),e["max-age"]){const r=parseInt(e["max-age"],10);isNaN(r)?delete e["max-age"]:e["max-age"]=r}return e},h.parseGlyphPbf=function(i){return new Dc(i).readFields(tg,[])},h.pbf=Zu,h.performSymbolLayout=function(i){i.bucket.createArrays(),i.bucket.tilePixelRatio=Pt/(512*i.bucket.overscaling),i.bucket.compareText={},i.bucket.iconsNeedLinear=!1;const e=i.bucket.layers[0].layout,r=i.bucket.layers[0]._unevaluatedLayout._values,s={layoutIconSize:r["icon-size"].possiblyEvaluate(new Ct(i.bucket.zoom+1),i.canonical),layoutTextSize:r["text-size"].possiblyEvaluate(new Ct(i.bucket.zoom+1),i.canonical),textMaxSize:r["text-size"].possiblyEvaluate(new Ct(18))};if(i.bucket.textSizeData.kind==="composite"){const{minZoom:g,maxZoom:b}=i.bucket.textSizeData;s.compositeTextSizes=[r["text-size"].possiblyEvaluate(new Ct(g),i.canonical),r["text-size"].possiblyEvaluate(new Ct(b),i.canonical)]}if(i.bucket.iconSizeData.kind==="composite"){const{minZoom:g,maxZoom:b}=i.bucket.iconSizeData;s.compositeIconSizes=[r["icon-size"].possiblyEvaluate(new Ct(g),i.canonical),r["icon-size"].possiblyEvaluate(new Ct(b),i.canonical)]}const l=e.get("text-line-height")*ai,u=e.get("text-rotation-alignment")!=="viewport"&&e.get("symbol-placement")!=="point",d=e.get("text-keep-upright"),f=e.get("text-size");for(const g of i.bucket.features){const b=e.get("text-font").evaluate(g,{},i.canonical).join(","),w=f.evaluate(g,{},i.canonical),E=s.layoutTextSize.evaluate(g,{},i.canonical),C=s.layoutIconSize.evaluate(g,{},i.canonical),M={horizontal:{},vertical:void 0},L=g.text;let N,O=[0,0];if(L){const Z=L.toString(),re=e.get("text-letter-spacing").evaluate(g,{},i.canonical)*ai,se=qa(Z)?re:0,he=e.get("text-anchor").evaluate(g,{},i.canonical),Le=e.get("text-variable-anchor");if(!Le){const Me=e.get("text-radial-offset").evaluate(g,{},i.canonical);O=Me?Ld(he,[Me*ai,Zc]):e.get("text-offset").evaluate(g,{},i.canonical).map(Ae=>Ae*ai)}let Re=u?"center":e.get("text-justify").evaluate(g,{},i.canonical);const Pe=e.get("symbol-placement"),Ee=Pe==="point"?e.get("text-max-width").evaluate(g,{},i.canonical)*ai:0,be=()=>{i.bucket.allowVerticalPlacement&&Vs(Z)&&(M.vertical=Al(L,i.glyphMap,i.glyphPositions,i.imagePositions,b,Ee,l,he,"left",se,O,h.WritingMode.vertical,!0,Pe,E,w))};if(!u&&Le){const Me=Re==="auto"?Le.map(ye=>Xc(ye)):[Re];let Ae=!1;for(let ye=0;ye<Me.length;ye++){const je=Me[ye];if(!M.horizontal[je])if(Ae)M.horizontal[je]=M.horizontal[0];else{const Fe=Al(L,i.glyphMap,i.glyphPositions,i.imagePositions,b,Ee,l,"center",je,se,O,h.WritingMode.horizontal,!1,Pe,E,w);Fe&&(M.horizontal[je]=Fe,Ae=Fe.positionedLines.length===1)}}be()}else{Re==="auto"&&(Re=Xc(he));const Me=Al(L,i.glyphMap,i.glyphPositions,i.imagePositions,b,Ee,l,he,Re,se,O,h.WritingMode.horizontal,!1,Pe,E,w);Me&&(M.horizontal[Re]=Me),be(),Vs(Z)&&u&&d&&(M.vertical=Al(L,i.glyphMap,i.glyphPositions,i.imagePositions,b,Ee,l,he,Re,se,O,h.WritingMode.vertical,!1,Pe,E,w))}}let W=!1;if(g.icon&&g.icon.name){const Z=i.imageMap[g.icon.name];Z&&(N=og(i.imagePositions[g.icon.name],e.get("icon-offset").evaluate(g,{},i.canonical),e.get("icon-anchor").evaluate(g,{},i.canonical)),W=!!Z.sdf,i.bucket.sdfIcons===void 0?i.bucket.sdfIcons=W:i.bucket.sdfIcons!==W&&oi("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(Z.pixelRatio!==i.bucket.pixelRatio||e.get("icon-rotate").constantOr(1)!==0)&&(i.bucket.iconsNeedLinear=!0))}const ee=Rd(M.horizontal)||M.vertical;i.bucket.iconsInText=!!ee&&ee.iconsInText,(ee||N)&&Tg(i.bucket,g,M,N,i.imageMap,s,E,C,O,W,i.canonical)}i.showCollisionBoxes&&i.bucket.generateCollisionDebugBuffers()},h.perspective=function(i,e,r,s,l){var u,d=1/Math.tan(e/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+s)*(u=1/(s-l)),i[14]=2*l*s*u):(i[10]=-1,i[14]=-2*s),i},h.pick=function(i,e){const r={};for(let s=0;s<e.length;s++){const l=e[s];l in i&&(r[l]=i[l])}return r},h.plugin=Ki,h.pointGeometry=Q,h.polygonIntersectsPolygon=fu,h.potpack=Qu,h.register=De,h.registerForPluginStateChange=function(i){return i({pluginStatus:Mi,pluginURL:Gr}),Zs.on("pluginStateChange",i),i},h.renderColorRamp=Eu,h.rotateX=function(i,e,r){var s=Math.sin(r),l=Math.cos(r),u=e[4],d=e[5],f=e[6],g=e[7],b=e[8],w=e[9],E=e[10],C=e[11];return e!==i&&(i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15]),i[4]=u*l+b*s,i[5]=d*l+w*s,i[6]=f*l+E*s,i[7]=g*l+C*s,i[8]=b*l-u*s,i[9]=w*l-d*s,i[10]=E*l-f*s,i[11]=C*l-g*s,i},h.rotateZ=function(i,e,r){var s=Math.sin(r),l=Math.cos(r),u=e[0],d=e[1],f=e[2],g=e[3],b=e[4],w=e[5],E=e[6],C=e[7];return e!==i&&(i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15]),i[0]=u*l+b*s,i[1]=d*l+w*s,i[2]=f*l+E*s,i[3]=g*l+C*s,i[4]=b*l-u*s,i[5]=w*l-d*s,i[6]=E*l-f*s,i[7]=C*l-g*s,i},h.sameOrigin=Vn,h.scale=function(i,e,r){var s=r[0],l=r[1],u=r[2];return i[0]=e[0]*s,i[1]=e[1]*s,i[2]=e[2]*s,i[3]=e[3]*s,i[4]=e[4]*l,i[5]=e[5]*l,i[6]=e[6]*l,i[7]=e[7]*l,i[8]=e[8]*u,i[9]=e[9]*u,i[10]=e[10]*u,i[11]=e[11]*u,i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i},h.setRTLTextPlugin=function(i,e,r=!1){if(Mi===Za||Mi===qs||Mi===Xa)throw new Error("setRTLTextPlugin cannot be called multiple times.");Gr=yn.resolveURL(i),Mi=Za,os=e,Wa(),r||ul()},h.sphericalToCartesian=function([i,e,r]){return e+=90,e*=Math.PI/180,r*=Math.PI/180,{x:i*Math.cos(e)*Math.sin(r),y:i*Math.sin(e)*Math.sin(r),z:i*Math.cos(r)}},h.toEvaluationFeature=ps,h.transformMat4=xl,h.translate=function(i,e,r){var s,l,u,d,f,g,b,w,E,C,M,L,N=r[0],O=r[1],W=r[2];return e===i?(i[12]=e[0]*N+e[4]*O+e[8]*W+e[12],i[13]=e[1]*N+e[5]*O+e[9]*W+e[13],i[14]=e[2]*N+e[6]*O+e[10]*W+e[14],i[15]=e[3]*N+e[7]*O+e[11]*W+e[15]):(l=e[1],u=e[2],d=e[3],f=e[4],g=e[5],b=e[6],w=e[7],E=e[8],C=e[9],M=e[10],L=e[11],i[0]=s=e[0],i[1]=l,i[2]=u,i[3]=d,i[4]=f,i[5]=g,i[6]=b,i[7]=w,i[8]=E,i[9]=C,i[10]=M,i[11]=L,i[12]=s*N+f*O+E*W+e[12],i[13]=l*N+g*O+C*W+e[13],i[14]=u*N+b*O+M*W+e[14],i[15]=d*N+w*O+L*W+e[15]),i},h.triggerPluginCompletionEvent=hl,h.unicodeBlockLookup=Ce,h.uniqueId=function(){return ya++},h.v8Spec=oe,h.validateCustomStyleLayer=function(i){const e=[],r=i.id;return r===void 0&&e.push({message:`layers.${r}: missing required property "id"`}),i.render===void 0&&e.push({message:`layers.${r}: missing required method "render"`}),i.renderingMode&&i.renderingMode!=="2d"&&i.renderingMode!=="3d"&&e.push({message:`layers.${r}: property "renderingMode" must be either "2d" or "3d"`}),e},h.validateLight=uc,h.validateStyle=jr,h.vectorTile=Ln,h.warnOnce=oi,h.wrap=hr}),ue(["./shared"],function(h){class me{constructor(I){this.keyCache={},I&&this.replace(I)}replace(I){this._layerConfigs={},this._layers={},this.update(I,[])}update(I,P){for(const $ of I){this._layerConfigs[$.id]=$;const q=this._layers[$.id]=h.createStyleLayer($);q._featureFilter=h.createFilter(q.filter),this.keyCache[$.id]&&delete this.keyCache[$.id]}for(const $ of P)delete this.keyCache[$],delete this._layerConfigs[$],delete this._layers[$];this.familiesBySource={};const D=h.groupByLayout(Object.values(this._layerConfigs),this.keyCache);for(const $ of D){const q=$.map(ce=>this._layers[ce.id]),Y=q[0];if(Y.visibility==="none")continue;const H=Y.source||"";let G=this.familiesBySource[H];G||(G=this.familiesBySource[H]={});const J=Y.sourceLayer||"_geojsonTileLayer";let de=G[J];de||(de=G[J]=[]),de.push(q)}}}class Q{constructor(I){const P={},D=[];for(const H in I){const G=I[H],J=P[H]={};for(const de in G){const ce=G[+de];if(!ce||ce.bitmap.width===0||ce.bitmap.height===0)continue;const pe={x:0,y:0,w:ce.bitmap.width+2,h:ce.bitmap.height+2};D.push(pe),J[de]={rect:pe,metrics:ce.metrics}}}const{w:$,h:q}=h.potpack(D),Y=new h.AlphaImage({width:$||1,height:q||1});for(const H in I){const G=I[H];for(const J in G){const de=G[+J];if(!de||de.bitmap.width===0||de.bitmap.height===0)continue;const ce=P[H][J].rect;h.AlphaImage.copy(de.bitmap,Y,{x:0,y:0},{x:ce.x+1,y:ce.y+1},de.bitmap)}}this.image=Y,this.positions=P}}h.register("GlyphAtlas",Q);class He{constructor(I){this.tileID=new h.OverscaledTileID(I.tileID.overscaledZ,I.tileID.wrap,I.tileID.canonical.z,I.tileID.canonical.x,I.tileID.canonical.y),this.uid=I.uid,this.zoom=I.zoom,this.pixelRatio=I.pixelRatio,this.tileSize=I.tileSize,this.source=I.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=I.showCollisionBoxes,this.collectResourceTiming=!!I.collectResourceTiming,this.returnDependencies=!!I.returnDependencies,this.promoteId=I.promoteId}parse(I,P,D,$,q){this.status="parsing",this.data=I,this.collisionBoxArray=new h.CollisionBoxArray;const Y=new h.DictionaryCoder(Object.keys(I.layers).sort()),H=new h.FeatureIndex(this.tileID,this.promoteId);H.bucketLayerIDs=[];const G={},J={featureIndex:H,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:D},de=P.familiesBySource[this.source];for(const tt in de){const ft=I.layers[tt];if(!ft)continue;ft.version===1&&h.warnOnce(`Vector tile source "${this.source}" layer "${tt}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const gt=Y.encode(tt),At=[];for(let zt=0;zt<ft.length;zt++){const Ut=ft.feature(zt),lt=H.getId(Ut,tt);At.push({feature:Ut,id:lt,index:zt,sourceLayerIndex:gt})}for(const zt of de[tt]){const Ut=zt[0];Ut.source!==this.source&&h.warnOnce(`layer.source = ${Ut.source} does not equal this.source = ${this.source}`),Ut.minzoom&&this.zoom<Math.floor(Ut.minzoom)||Ut.maxzoom&&this.zoom>=Ut.maxzoom||Ut.visibility!=="none"&&(ve(zt,this.zoom,D),(G[Ut.id]=Ut.createBucket({index:H.bucketLayerIDs.length,layers:zt,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:gt,sourceID:this.source})).populate(At,J,this.tileID.canonical),H.bucketLayerIDs.push(zt.map(lt=>lt.id)))}}let ce,pe,Ne,Ke;const Be=h.mapObject(J.glyphDependencies,tt=>Object.keys(tt).map(Number));Object.keys(Be).length?$.send("getGlyphs",{uid:this.uid,stacks:Be,source:this.source,tileID:this.tileID,type:"glyphs"},(tt,ft)=>{ce||(ce=tt,pe=ft,ot.call(this))}):pe={};const Ve=Object.keys(J.iconDependencies);Ve.length?$.send("getImages",{icons:Ve,source:this.source,tileID:this.tileID,type:"icons"},(tt,ft)=>{ce||(ce=tt,Ne=ft,ot.call(this))}):Ne={};const Qe=Object.keys(J.patternDependencies);function ot(){if(ce)return q(ce);if(pe&&Ne&&Ke){const tt=new Q(pe),ft=new h.ImageAtlas(Ne,Ke);for(const gt in G){const At=G[gt];At instanceof h.SymbolBucket?(ve(At.layers,this.zoom,D),h.performSymbolLayout({bucket:At,glyphMap:pe,glyphPositions:tt.positions,imageMap:Ne,imagePositions:ft.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):At.hasPattern&&(At instanceof h.LineBucket||At instanceof h.FillBucket||At instanceof h.FillExtrusionBucket)&&(ve(At.layers,this.zoom,D),At.addFeatures(J,this.tileID.canonical,ft.patternPositions))}this.status="done",q(null,{buckets:Object.values(G).filter(gt=>!gt.isEmpty()),featureIndex:H,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:tt.image,imageAtlas:ft,glyphMap:this.returnDependencies?pe:null,iconMap:this.returnDependencies?Ne:null,glyphPositions:this.returnDependencies?tt.positions:null})}}Qe.length?$.send("getImages",{icons:Qe,source:this.source,tileID:this.tileID,type:"patterns"},(tt,ft)=>{ce||(ce=tt,Ke=ft,ot.call(this))}):Ke={},ot.call(this)}}function ve(B,I,P){const D=new h.EvaluationParameters(I);for(const $ of B)$.recalculate(D,P)}function Te(B,I){const P=h.getArrayBuffer(B.request,(D,$,q,Y)=>{D?I(D):$&&I(null,{vectorTile:new h.vectorTile.VectorTile(new h.Protobuf($)),rawData:$,cacheControl:q,expires:Y})});return()=>{P.cancel(),I()}}class We{constructor(I,P,D,$){this.actor=I,this.layerIndex=P,this.availableImages=D,this.loadVectorData=$||Te,this.loading={},this.loaded={}}loadTile(I,P){const D=I.uid;this.loading||(this.loading={});const $=!!(I&&I.request&&I.request.collectResourceTiming)&&new h.RequestPerformance(I.request),q=this.loading[D]=new He(I);q.abort=this.loadVectorData(I,(Y,H)=>{if(delete this.loading[D],Y||!H)return q.status="done",this.loaded[D]=q,P(Y);const G=H.rawData,J={};H.expires&&(J.expires=H.expires),H.cacheControl&&(J.cacheControl=H.cacheControl);const de={};if($){const ce=$.finish();ce&&(de.resourceTiming=JSON.parse(JSON.stringify(ce)))}q.vectorTile=H.vectorTile,q.parse(H.vectorTile,this.layerIndex,this.availableImages,this.actor,(ce,pe)=>{if(ce||!pe)return P(ce);P(null,h.extend({rawTileData:G.slice(0)},pe,J,de))}),this.loaded=this.loaded||{},this.loaded[D]=q})}reloadTile(I,P){const D=this.loaded,$=I.uid,q=this;if(D&&D[$]){const Y=D[$];Y.showCollisionBoxes=I.showCollisionBoxes;const H=(G,J)=>{const de=Y.reloadCallback;de&&(delete Y.reloadCallback,Y.parse(Y.vectorTile,q.layerIndex,this.availableImages,q.actor,de)),P(G,J)};Y.status==="parsing"?Y.reloadCallback=H:Y.status==="done"&&(Y.vectorTile?Y.parse(Y.vectorTile,this.layerIndex,this.availableImages,this.actor,H):H())}}abortTile(I,P){const D=this.loading,$=I.uid;D&&D[$]&&D[$].abort&&(D[$].abort(),delete D[$]),P()}removeTile(I,P){const D=this.loaded,$=I.uid;D&&D[$]&&delete D[$],P()}}class Ge{constructor(){this.loaded={}}loadTile(I,P){const{uid:D,encoding:$,rawImageData:q}=I,Y=h.isImageBitmap(q)?this.getImageData(q):q,H=new h.DEMData(D,Y,$);this.loaded=this.loaded||{},this.loaded[D]=H,P(null,H)}getImageData(I){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(I.width,I.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=I.width,this.offscreenCanvas.height=I.height,this.offscreenCanvasContext.drawImage(I,0,0,I.width,I.height);const P=this.offscreenCanvasContext.getImageData(-1,-1,I.width+2,I.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new h.RGBAImage({width:P.width,height:P.height},P.data)}removeTile(I){const P=this.loaded,D=I.uid;P&&P[D]&&delete P[D]}}function kt(B,I){if(B.length!==0){Rt(B[0],I);for(var P=1;P<B.length;P++)Rt(B[P],!I)}}function Rt(B,I){for(var P=0,D=0,$=0,q=B.length,Y=q-1;$<q;Y=$++){var H=(B[$][0]-B[Y][0])*(B[Y][1]+B[$][1]),G=P+H;D+=Math.abs(P)>=Math.abs(H)?P-G+H:H-G+P,P=G}P+D>=0!=!!I&&B.reverse()}var It=h.getDefaultExportFromCjs(function B(I,P){var D,$=I&&I.type;if($==="FeatureCollection")for(D=0;D<I.features.length;D++)B(I.features[D],P);else if($==="GeometryCollection")for(D=0;D<I.geometries.length;D++)B(I.geometries[D],P);else if($==="Feature")B(I.geometry,P);else if($==="Polygon")kt(I.coordinates,P);else if($==="MultiPolygon")for(D=0;D<I.coordinates.length;D++)kt(I.coordinates[D],P);return I});const hr=h.vectorTile.VectorTileFeature.prototype.toGeoJSON;var _i={exports:{}},ya=h.pointGeometry,Un=h.vectorTile.VectorTileFeature,Dr=mn;function mn(B,I){this.options=I||{},this.features=B,this.length=B.length}function Ti(B,I){this.id=typeof B.id=="number"?B.id:void 0,this.type=B.type,this.rawGeometry=B.type===1?[B.geometry]:B.geometry,this.properties=B.tags,this.extent=I||4096}mn.prototype.feature=function(B){return new Ti(this.features[B],this.options.extent)},Ti.prototype.loadGeometry=function(){var B=this.rawGeometry;this.geometry=[];for(var I=0;I<B.length;I++){for(var P=B[I],D=[],$=0;$<P.length;$++)D.push(new ya(P[$][0],P[$][1]));this.geometry.push(D)}return this.geometry},Ti.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var B=this.geometry,I=1/0,P=-1/0,D=1/0,$=-1/0,q=0;q<B.length;q++)for(var Y=B[q],H=0;H<Y.length;H++){var G=Y[H];I=Math.min(I,G.x),P=Math.max(P,G.x),D=Math.min(D,G.y),$=Math.max($,G.y)}return[I,D,P,$]},Ti.prototype.toGeoJSON=Un.prototype.toGeoJSON;var Xr=h.pbf,oi=Dr;function xt(B){var I=new Xr;return function(P,D){for(var $ in P.layers)D.writeMessage(3,xa,P.layers[$])}(B,I),I.finish()}function xa(B,I){var P;I.writeVarintField(15,B.version||1),I.writeStringField(1,B.name||""),I.writeVarintField(5,B.extent||4096);var D={keys:[],values:[],keycache:{},valuecache:{}};for(P=0;P<B.length;P++)D.feature=B.feature(P),I.writeMessage(2,qi,D);var $=D.keys;for(P=0;P<$.length;P++)I.writeStringField(3,$[P]);var q=D.values;for(P=0;P<q.length;P++)I.writeMessage(4,gn,q[P])}function qi(B,I){var P=B.feature;P.id!==void 0&&I.writeVarintField(1,P.id),I.writeMessage(2,Tr,B),I.writeVarintField(3,P.type),I.writeMessage(4,Sr,P)}function Tr(B,I){var P=B.feature,D=B.keys,$=B.values,q=B.keycache,Y=B.valuecache;for(var H in P.properties){var G=P.properties[H],J=q[H];if(G!==null){J===void 0&&(D.push(H),q[H]=J=D.length-1),I.writeVarint(J);var de=typeof G;de!=="string"&&de!=="boolean"&&de!=="number"&&(G=JSON.stringify(G));var ce=de+":"+G,pe=Y[ce];pe===void 0&&($.push(G),Y[ce]=pe=$.length-1),I.writeVarint(pe)}}}function Rr(B,I){return(I<<3)+(7&B)}function Wr(B){return B<<1^B>>31}function Sr(B,I){for(var P=B.loadGeometry(),D=B.type,$=0,q=0,Y=P.length,H=0;H<Y;H++){var G=P[H],J=1;D===1&&(J=G.length),I.writeVarint(Rr(1,J));for(var de=D===3?G.length-1:G.length,ce=0;ce<de;ce++){ce===1&&D!==1&&I.writeVarint(Rr(2,de-1));var pe=G[ce].x-$,Ne=G[ce].y-q;I.writeVarint(Wr(pe)),I.writeVarint(Wr(Ne)),$+=pe,q+=Ne}D===3&&I.writeVarint(Rr(7,1))}}function gn(B,I){var P=typeof B;P==="string"?I.writeStringField(1,B):P==="boolean"?I.writeBooleanField(7,B):P==="number"&&(B%1!=0?I.writeDoubleField(3,B):B<0?I.writeSVarintField(6,B):I.writeVarintField(5,B))}_i.exports=xt,_i.exports.fromVectorTileJs=xt,_i.exports.fromGeojsonVt=function(B,I){I=I||{};var P={};for(var D in B)P[D]=new oi(B[D].features,I),P[D].name=D,P[D].version=I.version,P[D].extent=I.extent;return xt({layers:P})},_i.exports.GeoJSONWrapper=oi;var _n=h.getDefaultExportFromCjs(_i.exports);const yn={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:B=>B},Hr=Math.fround||(Br=new Float32Array(1),B=>(Br[0]=+B,Br[0]));var Br;class Nn{constructor(I){this.options=Object.assign(Object.create(yn),I),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(I){const{log:P,minZoom:D,maxZoom:$}=this.options;P&&console.time("total time");const q=`prepare ${I.length} points`;P&&console.time(q),this.points=I;const Y=[];for(let G=0;G<I.length;G++){const J=I[G];if(!J.geometry)continue;const[de,ce]=J.geometry.coordinates,pe=Hr(Gt(de)),Ne=Hr(Or(ce));Y.push(pe,Ne,1/0,G,-1,1),this.options.reduce&&Y.push(0)}let H=this.trees[$+1]=this._createTree(Y);P&&console.timeEnd(q);for(let G=$;G>=D;G--){const J=+Date.now();H=this.trees[G]=this._createTree(this._cluster(H,G)),P&&console.log("z%d: %d clusters in %dms",G,H.numItems,+Date.now()-J)}return P&&console.timeEnd("total time"),this}getClusters(I,P){let D=((I[0]+180)%360+360)%360-180;const $=Math.max(-90,Math.min(90,I[1]));let q=I[2]===180?180:((I[2]+180)%360+360)%360-180;const Y=Math.max(-90,Math.min(90,I[3]));if(I[2]-I[0]>=360)D=-180,q=180;else if(D>q){const ce=this.getClusters([D,$,180,Y],P),pe=this.getClusters([-180,$,q,Y],P);return ce.concat(pe)}const H=this.trees[this._limitZoom(P)],G=H.range(Gt(D),Or(Y),Gt(q),Or($)),J=H.data,de=[];for(const ce of G){const pe=this.stride*ce;de.push(J[pe+5]>1?Fr(J,pe,this.clusterProps):this.points[J[pe+3]])}return de}getChildren(I){const P=this._getOriginId(I),D=this._getOriginZoom(I),$="No cluster with the specified id.",q=this.trees[D];if(!q)throw new Error($);const Y=q.data;if(P*this.stride>=Y.length)throw new Error($);const H=this.options.radius/(this.options.extent*Math.pow(2,D-1)),G=q.within(Y[P*this.stride],Y[P*this.stride+1],H),J=[];for(const de of G){const ce=de*this.stride;Y[ce+4]===I&&J.push(Y[ce+5]>1?Fr(Y,ce,this.clusterProps):this.points[Y[ce+3]])}if(J.length===0)throw new Error($);return J}getLeaves(I,P,D){const $=[];return this._appendLeaves($,I,P=P||10,D=D||0,0),$}getTile(I,P,D){const $=this.trees[this._limitZoom(I)],q=Math.pow(2,I),{extent:Y,radius:H}=this.options,G=H/Y,J=(D-G)/q,de=(D+1+G)/q,ce={features:[]};return this._addTileFeatures($.range((P-G)/q,J,(P+1+G)/q,de),$.data,P,D,q,ce),P===0&&this._addTileFeatures($.range(1-G/q,J,1,de),$.data,q,D,q,ce),P===q-1&&this._addTileFeatures($.range(0,J,G/q,de),$.data,-1,D,q,ce),ce.features.length?ce:null}getClusterExpansionZoom(I){let P=this._getOriginZoom(I)-1;for(;P<=this.options.maxZoom;){const D=this.getChildren(I);if(P++,D.length!==1)break;I=D[0].properties.cluster_id}return P}_appendLeaves(I,P,D,$,q){const Y=this.getChildren(P);for(const H of Y){const G=H.properties;if(G&&G.cluster?q+G.point_count<=$?q+=G.point_count:q=this._appendLeaves(I,G.cluster_id,D,$,q):q<$?q++:I.push(H),I.length===D)break}return q}_createTree(I){const P=new h.KDBush(I.length/this.stride|0,this.options.nodeSize,Float32Array);for(let D=0;D<I.length;D+=this.stride)P.add(I[D],I[D+1]);return P.finish(),P.data=I,P}_addTileFeatures(I,P,D,$,q,Y){for(const H of I){const G=H*this.stride,J=P[G+5]>1;let de,ce,pe;if(J)de=xn(P,G,this.clusterProps),ce=P[G],pe=P[G+1];else{const Be=this.points[P[G+3]];de=Be.properties;const[Ve,Qe]=Be.geometry.coordinates;ce=Gt(Ve),pe=Or(Qe)}const Ne={type:1,geometry:[[Math.round(this.options.extent*(ce*q-D)),Math.round(this.options.extent*(pe*q-$))]],tags:de};let Ke;Ke=J||this.options.generateId?P[G+3]:this.points[P[G+3]].id,Ke!==void 0&&(Ne.id=Ke),Y.features.push(Ne)}}_limitZoom(I){return Math.max(this.options.minZoom,Math.min(Math.floor(+I),this.options.maxZoom+1))}_cluster(I,P){const{radius:D,extent:$,reduce:q,minPoints:Y}=this.options,H=D/($*Math.pow(2,P)),G=I.data,J=[],de=this.stride;for(let ce=0;ce<G.length;ce+=de){if(G[ce+2]<=P)continue;G[ce+2]=P;const pe=G[ce],Ne=G[ce+1],Ke=I.within(G[ce],G[ce+1],H),Be=G[ce+5];let Ve=Be;for(const Qe of Ke){const ot=Qe*de;G[ot+2]>P&&(Ve+=G[ot+5])}if(Ve>Be&&Ve>=Y){let Qe,ot=pe*Be,tt=Ne*Be,ft=-1;const gt=((ce/de|0)<<5)+(P+1)+this.points.length;for(const At of Ke){const zt=At*de;if(G[zt+2]<=P)continue;G[zt+2]=P;const Ut=G[zt+5];ot+=G[zt]*Ut,tt+=G[zt+1]*Ut,G[zt+4]=gt,q&&(Qe||(Qe=this._map(G,ce,!0),ft=this.clusterProps.length,this.clusterProps.push(Qe)),q(Qe,this._map(G,zt)))}G[ce+4]=gt,J.push(ot/Ve,tt/Ve,1/0,gt,-1,Ve),q&&J.push(ft)}else{for(let Qe=0;Qe<de;Qe++)J.push(G[ce+Qe]);if(Ve>1)for(const Qe of Ke){const ot=Qe*de;if(!(G[ot+2]<=P)){G[ot+2]=P;for(let tt=0;tt<de;tt++)J.push(G[ot+tt])}}}}return J}_getOriginId(I){return I-this.points.length>>5}_getOriginZoom(I){return(I-this.points.length)%32}_map(I,P,D){if(I[P+5]>1){const Y=this.clusterProps[I[P+6]];return D?Object.assign({},Y):Y}const $=this.points[I[P+3]].properties,q=this.options.map($);return D&&q===$?Object.assign({},q):q}}function Fr(B,I,P){return{type:"Feature",id:B[I+3],properties:xn(B,I,P),geometry:{type:"Point",coordinates:[(D=B[I],360*(D-.5)),Vn(B[I+1])]}};var D}function xn(B,I,P){const D=B[I+5],$=D>=1e4?`${Math.round(D/1e3)}k`:D>=1e3?Math.round(D/100)/10+"k":D,q=B[I+6],Y=q===-1?{}:Object.assign({},P[q]);return Object.assign(Y,{cluster:!0,cluster_id:B[I+3],point_count:D,point_count_abbreviated:$})}function Gt(B){return B/360+.5}function Or(B){const I=Math.sin(B*Math.PI/180),P=.5-.25*Math.log((1+I)/(1-I))/Math.PI;return P<0?0:P>1?1:P}function Vn(B){const I=(180-360*B)*Math.PI/180;return 360*Math.atan(Math.exp(I))/Math.PI-90}function Ur(B,I,P,D){for(var $,q=D,Y=P-I>>1,H=P-I,G=B[I],J=B[I+1],de=B[P],ce=B[P+1],pe=I+3;pe<P;pe+=3){var Ne=vn(B[pe],B[pe+1],G,J,de,ce);if(Ne>q)$=pe,q=Ne;else if(Ne===q){var Ke=Math.abs(pe-Y);Ke<H&&($=pe,H=Ke)}}q>D&&($-I>3&&Ur(B,I,$,D),B[$+2]=q,P-$>3&&Ur(B,$,P,D))}function vn(B,I,P,D,$,q){var Y=$-P,H=q-D;if(Y!==0||H!==0){var G=((B-P)*Y+(I-D)*H)/(Y*Y+H*H);G>1?(P=$,D=q):G>0&&(P+=Y*G,D+=H*G)}return(Y=B-P)*Y+(H=I-D)*H}function Qi(B,I,P,D){var $={id:B===void 0?null:B,type:I,geometry:P,tags:D,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(q){var Y=q.geometry,H=q.type;if(H==="Point"||H==="MultiPoint"||H==="LineString")ur(q,Y);else if(H==="Polygon"||H==="MultiLineString")for(var G=0;G<Y.length;G++)ur(q,Y[G]);else if(H==="MultiPolygon")for(G=0;G<Y.length;G++)for(var J=0;J<Y[G].length;J++)ur(q,Y[G][J])}($),$}function ur(B,I){for(var P=0;P<I.length;P+=3)B.minX=Math.min(B.minX,I[P]),B.minY=Math.min(B.minY,I[P+1]),B.maxX=Math.max(B.maxX,I[P]),B.maxY=Math.max(B.maxY,I[P+1])}function Zi(B,I,P,D){if(I.geometry){var $=I.geometry.coordinates,q=I.geometry.type,Y=Math.pow(P.tolerance/((1<<P.maxZoom)*P.extent),2),H=[],G=I.id;if(P.promoteId?G=I.properties[P.promoteId]:P.generateId&&(G=D||0),q==="Point")oe($,H);else if(q==="MultiPoint")for(var J=0;J<$.length;J++)oe($[J],H);else if(q==="LineString")Kr($,H,Y,!1);else if(q==="MultiLineString"){if(P.lineMetrics){for(J=0;J<$.length;J++)Kr($[J],H=[],Y,!1),B.push(Qi(G,"LineString",H,I.properties));return}Yr($,H,Y,!1)}else if(q==="Polygon")Yr($,H,Y,!0);else{if(q!=="MultiPolygon"){if(q==="GeometryCollection"){for(J=0;J<I.geometry.geometries.length;J++)Zi(B,{id:G,geometry:I.geometry.geometries[J],properties:I.properties},P,D);return}throw new Error("Input data is not a valid GeoJSON object.")}for(J=0;J<$.length;J++){var de=[];Yr($[J],de,Y,!0),H.push(de)}}B.push(Qi(G,q,H,I.properties))}}function oe(B,I){I.push(bt(B[0])),I.push(pt(B[1])),I.push(0)}function Kr(B,I,P,D){for(var $,q,Y=0,H=0;H<B.length;H++){var G=bt(B[H][0]),J=pt(B[H][1]);I.push(G),I.push(J),I.push(0),H>0&&(Y+=D?($*J-G*q)/2:Math.sqrt(Math.pow(G-$,2)+Math.pow(J-q,2))),$=G,q=J}var de=I.length-3;I[2]=1,Ur(I,0,de,P),I[de+2]=1,I.size=Math.abs(Y),I.start=0,I.end=I.size}function Yr(B,I,P,D){for(var $=0;$<B.length;$++){var q=[];Kr(B[$],q,P,D),I.push(q)}}function bt(B){return B/360+.5}function pt(B){var I=Math.sin(B*Math.PI/180),P=.5-.25*Math.log((1+I)/(1-I))/Math.PI;return P<0?0:P>1?1:P}function Di(B,I,P,D,$,q,Y,H){if(D/=I,q>=(P/=I)&&Y<D)return B;if(Y<P||q>=D)return null;for(var G=[],J=0;J<B.length;J++){var de=B[J],ce=de.geometry,pe=de.type,Ne=$===0?de.minX:de.minY,Ke=$===0?de.maxX:de.maxY;if(Ne>=P&&Ke<D)G.push(de);else if(!(Ke<P||Ne>=D)){var Be=[];if(pe==="Point"||pe==="MultiPoint")$n(ce,Be,P,D,$);else if(pe==="LineString")xs(ce,Be,P,D,$,!1,H.lineMetrics);else if(pe==="MultiLineString")ni(ce,Be,P,D,$,!1);else if(pe==="Polygon")ni(ce,Be,P,D,$,!0);else if(pe==="MultiPolygon")for(var Ve=0;Ve<ce.length;Ve++){var Qe=[];ni(ce[Ve],Qe,P,D,$,!0),Qe.length&&Be.push(Qe)}if(Be.length){if(H.lineMetrics&&pe==="LineString"){for(Ve=0;Ve<Be.length;Ve++)G.push(Qi(de.id,pe,Be[Ve],de.tags));continue}pe!=="LineString"&&pe!=="MultiLineString"||(Be.length===1?(pe="LineString",Be=Be[0]):pe="MultiLineString"),pe!=="Point"&&pe!=="MultiPoint"||(pe=Be.length===3?"Point":"MultiPoint"),G.push(Qi(de.id,pe,Be,de.tags))}}}return G.length?G:null}function $n(B,I,P,D,$){for(var q=0;q<B.length;q+=3){var Y=B[q+$];Y>=P&&Y<=D&&(I.push(B[q]),I.push(B[q+1]),I.push(B[q+2]))}}function xs(B,I,P,D,$,q,Y){for(var H,G,J=vs(B),de=$===0?jn:Ie,ce=B.start,pe=0;pe<B.length-3;pe+=3){var Ne=B[pe],Ke=B[pe+1],Be=B[pe+2],Ve=B[pe+3],Qe=B[pe+4],ot=$===0?Ne:Ke,tt=$===0?Ve:Qe,ft=!1;Y&&(H=Math.sqrt(Math.pow(Ne-Ve,2)+Math.pow(Ke-Qe,2))),ot<P?tt>P&&(G=de(J,Ne,Ke,Ve,Qe,P),Y&&(J.start=ce+H*G)):ot>D?tt<D&&(G=de(J,Ne,Ke,Ve,Qe,D),Y&&(J.start=ce+H*G)):Jr(J,Ne,Ke,Be),tt<P&&ot>=P&&(G=de(J,Ne,Ke,Ve,Qe,P),ft=!0),tt>D&&ot<=D&&(G=de(J,Ne,Ke,Ve,Qe,D),ft=!0),!q&&ft&&(Y&&(J.end=ce+H*G),I.push(J),J=vs(B)),Y&&(ce+=H)}var gt=B.length-3;Ne=B[gt],Ke=B[gt+1],Be=B[gt+2],(ot=$===0?Ne:Ke)>=P&&ot<=D&&Jr(J,Ne,Ke,Be),gt=J.length-3,q&&gt>=3&&(J[gt]!==J[0]||J[gt+1]!==J[1])&&Jr(J,J[0],J[1],J[2]),J.length&&I.push(J)}function vs(B){var I=[];return I.size=B.size,I.start=B.start,I.end=B.end,I}function ni(B,I,P,D,$,q){for(var Y=0;Y<B.length;Y++)xs(B[Y],I,P,D,$,q,!1)}function Jr(B,I,P,D){B.push(I),B.push(P),B.push(D)}function jn(B,I,P,D,$,q){var Y=(q-I)/(D-I);return B.push(q),B.push(P+($-P)*Y),B.push(1),Y}function Ie(B,I,P,D,$,q){var Y=(q-P)/($-P);return B.push(I+(D-I)*Y),B.push(q),B.push(1),Y}function Si(B,I){for(var P=[],D=0;D<B.length;D++){var $,q=B[D],Y=q.type;if(Y==="Point"||Y==="MultiPoint"||Y==="LineString")$=Ei(q.geometry,I);else if(Y==="MultiLineString"||Y==="Polygon"){$=[];for(var H=0;H<q.geometry.length;H++)$.push(Ei(q.geometry[H],I))}else if(Y==="MultiPolygon")for($=[],H=0;H<q.geometry.length;H++){for(var G=[],J=0;J<q.geometry[H].length;J++)G.push(Ei(q.geometry[H][J],I));$.push(G)}P.push(Qi(q.id,Y,$,q.tags))}return P}function Ei(B,I){var P=[];P.size=B.size,B.start!==void 0&&(P.start=B.start,P.end=B.end);for(var D=0;D<B.length;D+=3)P.push(B[D]+I,B[D+1],B[D+2]);return P}function dr(B,I){if(B.transformed)return B;var P,D,$,q=1<<B.z,Y=B.x,H=B.y;for(P=0;P<B.features.length;P++){var G=B.features[P],J=G.geometry,de=G.type;if(G.geometry=[],de===1)for(D=0;D<J.length;D+=2)G.geometry.push(Er(J[D],J[D+1],I,q,Y,H));else for(D=0;D<J.length;D++){var ce=[];for($=0;$<J[D].length;$+=2)ce.push(Er(J[D][$],J[D][$+1],I,q,Y,H));G.geometry.push(ce)}}return B.transformed=!0,B}function Er(B,I,P,D,$,q){return[Math.round(P*(B*D-$)),Math.round(P*(I*D-q))]}function Se(B,I,P,D,$){for(var q=I===$.maxZoom?0:$.tolerance/((1<<I)*$.extent),Y={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:P,y:D,z:I,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},H=0;H<B.length;H++){Y.numFeatures++,it(Y,B[H],q,$);var G=B[H].minX,J=B[H].minY,de=B[H].maxX,ce=B[H].maxY;G<Y.minX&&(Y.minX=G),J<Y.minY&&(Y.minY=J),de>Y.maxX&&(Y.maxX=de),ce>Y.maxY&&(Y.maxY=ce)}return Y}function it(B,I,P,D){var $=I.geometry,q=I.type,Y=[];if(q==="Point"||q==="MultiPoint")for(var H=0;H<$.length;H+=3)Y.push($[H]),Y.push($[H+1]),B.numPoints++,B.numSimplified++;else if(q==="LineString")Je(Y,$,B,P,!1,!1);else if(q==="MultiLineString"||q==="Polygon")for(H=0;H<$.length;H++)Je(Y,$[H],B,P,q==="Polygon",H===0);else if(q==="MultiPolygon")for(var G=0;G<$.length;G++){var J=$[G];for(H=0;H<J.length;H++)Je(Y,J[H],B,P,!0,H===0)}if(Y.length){var de=I.tags||null;if(q==="LineString"&&D.lineMetrics){for(var ce in de={},I.tags)de[ce]=I.tags[ce];de.mapbox_clip_start=$.start/$.size,de.mapbox_clip_end=$.end/$.size}var pe={geometry:Y,type:q==="Polygon"||q==="MultiPolygon"?3:q==="LineString"||q==="MultiLineString"?2:1,tags:de};I.id!==null&&(pe.id=I.id),B.features.push(pe)}}function Je(B,I,P,D,$,q){var Y=D*D;if(D>0&&I.size<($?Y:D))P.numPoints+=I.length/3;else{for(var H=[],G=0;G<I.length;G+=3)(D===0||I[G+2]>Y)&&(P.numSimplified++,H.push(I[G]),H.push(I[G+1])),P.numPoints++;$&&function(J,de){for(var ce=0,pe=0,Ne=J.length,Ke=Ne-2;pe<Ne;Ke=pe,pe+=2)ce+=(J[pe]-J[Ke])*(J[pe+1]+J[Ke+1]);if(ce>0===de)for(pe=0,Ne=J.length;pe<Ne/2;pe+=2){var Be=J[pe],Ve=J[pe+1];J[pe]=J[Ne-2-pe],J[pe+1]=J[Ne-1-pe],J[Ne-2-pe]=Be,J[Ne-1-pe]=Ve}}(H,q),B.push(H)}}function Jt(B,I){var P=(I=this.options=function($,q){for(var Y in q)$[Y]=q[Y];return $}(Object.create(this.options),I)).debug;if(P&&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.");var D=function($,q){var Y=[];if($.type==="FeatureCollection")for(var H=0;H<$.features.length;H++)Zi(Y,$.features[H],q,H);else Zi(Y,$.type==="Feature"?$:{geometry:$},q);return Y}(B,I);this.tiles={},this.tileCoords=[],P&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",I.indexMaxZoom,I.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),D=function($,q){var Y=q.buffer/q.extent,H=$,G=Di($,1,-1-Y,Y,0,-1,2,q),J=Di($,1,1-Y,2+Y,0,-1,2,q);return(G||J)&&(H=Di($,1,-Y,1+Y,0,-1,2,q)||[],G&&(H=Si(G,1).concat(H)),J&&(H=H.concat(Si(J,-1)))),H}(D,I),D.length&&this.splitTile(D,0,0,0),P&&(D.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}function er(B,I,P){return 32*((1<<B)*P+I)+B}function qe(B,I){return I?B.properties[I]:B.id}function Ir(B,I){if(B==null)return!0;if(B.type==="Feature")return qe(B,I)!=null;if(B.type==="FeatureCollection"){const P=new Set;for(const D of B.features){const $=qe(D,I);if($==null||P.has($))return!1;P.add($)}return!0}return!1}function Nr(B,I){const P=new Map;if(B!=null)if(B.type==="Feature")P.set(qe(B,I),B);else for(const D of B.features)P.set(qe(D,I),D);return P}function bn(B,I){const P=B.tileID.canonical;if(!this._geoJSONIndex)return I(null,null);const D=this._geoJSONIndex.getTile(P.z,P.x,P.y);if(!D)return I(null,null);const $=new class{constructor(Y){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=h.EXTENT,this.length=Y.length,this._features=Y}feature(Y){return new class{constructor(H){this._feature=H,this.extent=h.EXTENT,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){const H=[];for(const G of this._feature.geometry)H.push([new h.Point(G[0],G[1])]);return H}{const H=[];for(const G of this._feature.geometry){const J=[];for(const de of G)J.push(new h.Point(de[0],de[1]));H.push(J)}return H}}toGeoJSON(H,G,J){return hr.call(this,H,G,J)}}(this._features[Y])}}(D.features);let q=_n($);q.byteOffset===0&&q.byteLength===q.buffer.byteLength||(q=new Uint8Array(q)),I(null,{vectorTile:$,rawData:q.buffer})}Jt.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},Jt.prototype.splitTile=function(B,I,P,D,$,q,Y){for(var H=[B,I,P,D],G=this.options,J=G.debug;H.length;){D=H.pop(),P=H.pop(),I=H.pop(),B=H.pop();var de=1<<I,ce=er(I,P,D),pe=this.tiles[ce];if(!pe&&(J>1&&console.time("creation"),pe=this.tiles[ce]=Se(B,I,P,D,G),this.tileCoords.push({z:I,x:P,y:D}),J)){J>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",I,P,D,pe.numFeatures,pe.numPoints,pe.numSimplified),console.timeEnd("creation"));var Ne="z"+I;this.stats[Ne]=(this.stats[Ne]||0)+1,this.total++}if(pe.source=B,$){if(I===G.maxZoom||I===$)continue;var Ke=1<<$-I;if(P!==Math.floor(q/Ke)||D!==Math.floor(Y/Ke))continue}else if(I===G.indexMaxZoom||pe.numPoints<=G.indexMaxPoints)continue;if(pe.source=null,B.length!==0){J>1&&console.time("clipping");var Be,Ve,Qe,ot,tt,ft,gt=.5*G.buffer/G.extent,At=.5-gt,zt=.5+gt,Ut=1+gt;Be=Ve=Qe=ot=null,tt=Di(B,de,P-gt,P+zt,0,pe.minX,pe.maxX,G),ft=Di(B,de,P+At,P+Ut,0,pe.minX,pe.maxX,G),B=null,tt&&(Be=Di(tt,de,D-gt,D+zt,1,pe.minY,pe.maxY,G),Ve=Di(tt,de,D+At,D+Ut,1,pe.minY,pe.maxY,G),tt=null),ft&&(Qe=Di(ft,de,D-gt,D+zt,1,pe.minY,pe.maxY,G),ot=Di(ft,de,D+At,D+Ut,1,pe.minY,pe.maxY,G),ft=null),J>1&&console.timeEnd("clipping"),H.push(Be||[],I+1,2*P,2*D),H.push(Ve||[],I+1,2*P,2*D+1),H.push(Qe||[],I+1,2*P+1,2*D),H.push(ot||[],I+1,2*P+1,2*D+1)}}},Jt.prototype.getTile=function(B,I,P){var D=this.options,$=D.extent,q=D.debug;if(B<0||B>24)return null;var Y=1<<B,H=er(B,I=(I%Y+Y)%Y,P);if(this.tiles[H])return dr(this.tiles[H],$);q>1&&console.log("drilling down to z%d-%d-%d",B,I,P);for(var G,J=B,de=I,ce=P;!G&&J>0;)J--,de=Math.floor(de/2),ce=Math.floor(ce/2),G=this.tiles[er(J,de,ce)];return G&&G.source?(q>1&&console.log("found parent tile z%d-%d-%d",J,de,ce),q>1&&console.time("drilling down"),this.splitTile(G.source,J,de,ce,B,I,P),q>1&&console.timeEnd("drilling down"),this.tiles[H]?dr(this.tiles[H],$):null):null};class Vr extends We{constructor(I,P,D,$){super(I,P,D,bn),this._dataUpdateable=new Map,this.loadGeoJSON=(q,Y)=>{const{promoteId:H}=q;if(q.request)return h.getJSON(q.request,(G,J,de,ce)=>{this._dataUpdateable=Ir(J,H)?Nr(J,H):void 0,Y(G,J,de,ce)});if(typeof q.data=="string")try{const G=JSON.parse(q.data);this._dataUpdateable=Ir(G,H)?Nr(G,H):void 0,Y(null,G)}catch{Y(new Error(`Input data given to '${q.source}' is not a valid GeoJSON object.`))}else q.dataDiff?this._dataUpdateable?(function(G,J,de){var ce,pe,Ne,Ke;if(J.removeAll&&G.clear(),J.remove)for(const Be of J.remove)G.delete(Be);if(J.add)for(const Be of J.add){const Ve=qe(Be,de);Ve!=null&&G.set(Ve,Be)}if(J.update)for(const Be of J.update){let Ve=G.get(Be.id);if(Ve==null)continue;const Qe=!Be.removeAllProperties&&(((ce=Be.removeProperties)===null||ce===void 0?void 0:ce.length)>0||((pe=Be.addOrUpdateProperties)===null||pe===void 0?void 0:pe.length)>0);if((Be.newGeometry||Be.removeAllProperties||Qe)&&(Ve={...Ve},G.set(Be.id,Ve),Qe&&(Ve.properties={...Ve.properties})),Be.newGeometry&&(Ve.geometry=Be.newGeometry),Be.removeAllProperties)Ve.properties={};else if(((Ne=Be.removeProperties)===null||Ne===void 0?void 0:Ne.length)>0)for(const ot of Be.removeProperties)Object.prototype.hasOwnProperty.call(Ve.properties,ot)&&delete Ve.properties[ot];if(((Ke=Be.addOrUpdateProperties)===null||Ke===void 0?void 0:Ke.length)>0)for(const{key:ot,value:tt}of Be.addOrUpdateProperties)Ve.properties[ot]=tt}}(this._dataUpdateable,q.dataDiff,H),Y(null,{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())})):Y(new Error(`Cannot update existing geojson data in ${q.source}`)):Y(new Error(`Input data given to '${q.source}' is not a valid GeoJSON object.`));return{cancel:()=>{}}},$&&(this.loadGeoJSON=$)}loadData(I,P){var D;(D=this._pendingRequest)===null||D===void 0||D.cancel(),this._pendingCallback&&this._pendingCallback(null,{abandoned:!0});const $=!!(I&&I.request&&I.request.collectResourceTiming)&&new h.RequestPerformance(I.request);this._pendingCallback=P,this._pendingRequest=this.loadGeoJSON(I,(q,Y)=>{if(delete this._pendingCallback,delete this._pendingRequest,q||!Y)return P(q);if(typeof Y!="object")return P(new Error(`Input data given to '${I.source}' is not a valid GeoJSON object.`));{It(Y,!0);try{if(I.filter){const G=h.createExpression(I.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(G.result==="error")throw new Error(G.value.map(de=>`${de.key}: ${de.message}`).join(", "));Y={type:"FeatureCollection",features:Y.features.filter(de=>G.value.evaluate({zoom:0},de))}}this._geoJSONIndex=I.cluster?new Nn(function({superclusterOptions:G,clusterProperties:J}){if(!J||!G)return G;const de={},ce={},pe={accumulated:null,zoom:0},Ne={properties:null},Ke=Object.keys(J);for(const Be of Ke){const[Ve,Qe]=J[Be],ot=h.createExpression(Qe),tt=h.createExpression(typeof Ve=="string"?[Ve,["accumulated"],["get",Be]]:Ve);de[Be]=ot.value,ce[Be]=tt.value}return G.map=Be=>{Ne.properties=Be;const Ve={};for(const Qe of Ke)Ve[Qe]=de[Qe].evaluate(pe,Ne);return Ve},G.reduce=(Be,Ve)=>{Ne.properties=Ve;for(const Qe of Ke)pe.accumulated=Be[Qe],Be[Qe]=ce[Qe].evaluate(pe,Ne)},G}(I)).load(Y.features):function(G,J){return new Jt(G,J)}(Y,I.geojsonVtOptions)}catch(G){return P(G)}this.loaded={};const H={};if($){const G=$.finish();G&&(H.resourceTiming={},H.resourceTiming[I.source]=JSON.parse(JSON.stringify(G)))}P(null,H)}})}reloadTile(I,P){const D=this.loaded;return D&&D[I.uid]?super.reloadTile(I,P):this.loadTile(I,P)}removeSource(I,P){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),P()}getClusterExpansionZoom(I,P){try{P(null,this._geoJSONIndex.getClusterExpansionZoom(I.clusterId))}catch(D){P(D)}}getClusterChildren(I,P){try{P(null,this._geoJSONIndex.getChildren(I.clusterId))}catch(D){P(D)}}getClusterLeaves(I,P){try{P(null,this._geoJSONIndex.getLeaves(I.clusterId,I.limit,I.offset))}catch(D){P(D)}}}class si{constructor(I){this.self=I,this.actor=new h.Actor(I,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:We,geojson:Vr},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(P,D)=>{if(this.workerSourceTypes[P])throw new Error(`Worker source with name "${P}" already registered.`);this.workerSourceTypes[P]=D},this.self.registerRTLTextPlugin=P=>{if(h.plugin.isParsed())throw new Error("RTL text plugin already registered.");h.plugin.applyArabicShaping=P.applyArabicShaping,h.plugin.processBidirectionalText=P.processBidirectionalText,h.plugin.processStyledBidirectionalText=P.processStyledBidirectionalText}}setReferrer(I,P){this.referrer=P}setImages(I,P,D){this.availableImages[I]=P;for(const $ in this.workerSources[I]){const q=this.workerSources[I][$];for(const Y in q)q[Y].availableImages=P}D()}setLayers(I,P,D){this.getLayerIndex(I).replace(P),D()}updateLayers(I,P,D){this.getLayerIndex(I).update(P.layers,P.removedIds),D()}loadTile(I,P,D){this.getWorkerSource(I,P.type,P.source).loadTile(P,D)}loadDEMTile(I,P,D){this.getDEMWorkerSource(I,P.source).loadTile(P,D)}reloadTile(I,P,D){this.getWorkerSource(I,P.type,P.source).reloadTile(P,D)}abortTile(I,P,D){this.getWorkerSource(I,P.type,P.source).abortTile(P,D)}removeTile(I,P,D){this.getWorkerSource(I,P.type,P.source).removeTile(P,D)}removeDEMTile(I,P){this.getDEMWorkerSource(I,P.source).removeTile(P)}removeSource(I,P,D){if(!this.workerSources[I]||!this.workerSources[I][P.type]||!this.workerSources[I][P.type][P.source])return;const $=this.workerSources[I][P.type][P.source];delete this.workerSources[I][P.type][P.source],$.removeSource!==void 0?$.removeSource(P,D):D()}loadWorkerSource(I,P,D){try{this.self.importScripts(P.url),D()}catch($){D($.toString())}}syncRTLPluginState(I,P,D){try{h.plugin.setState(P);const $=h.plugin.getPluginURL();if(h.plugin.isLoaded()&&!h.plugin.isParsed()&&$!=null){this.self.importScripts($);const q=h.plugin.isParsed();D(q?void 0:new Error(`RTL Text Plugin failed to import scripts from ${$}`),q)}}catch($){D($.toString())}}getAvailableImages(I){let P=this.availableImages[I];return P||(P=[]),P}getLayerIndex(I){let P=this.layerIndexes[I];return P||(P=this.layerIndexes[I]=new me),P}getWorkerSource(I,P,D){if(this.workerSources[I]||(this.workerSources[I]={}),this.workerSources[I][P]||(this.workerSources[I][P]={}),!this.workerSources[I][P][D]){const $={send:(q,Y,H)=>{this.actor.send(q,Y,H,I)}};this.workerSources[I][P][D]=new this.workerSourceTypes[P]($,this.getLayerIndex(I),this.getAvailableImages(I))}return this.workerSources[I][P][D]}getDEMWorkerSource(I,P){return this.demWorkerSources[I]||(this.demWorkerSources[I]={}),this.demWorkerSources[I][P]||(this.demWorkerSources[I][P]=new Ge),this.demWorkerSources[I][P]}}return h.isWorker()&&(self.worker=new si(self)),si}),ue(["./shared"],function(h){var me="3.0.1";class Q{static testProp(t){if(!Q.docStyle)return t[0];for(let n=0;n<t.length;n++)if(t[n]in Q.docStyle)return t[n];return t[0]}static create(t,n,a){const c=window.document.createElement(t);return n!==void 0&&(c.className=n),a&&a.appendChild(c),c}static createNS(t,n){return window.document.createElementNS(t,n)}static disableDrag(){Q.docStyle&&Q.selectProp&&(Q.userSelect=Q.docStyle[Q.selectProp],Q.docStyle[Q.selectProp]="none")}static enableDrag(){Q.docStyle&&Q.selectProp&&(Q.docStyle[Q.selectProp]=Q.userSelect)}static setTransform(t,n){t.style[Q.transformProp]=n}static addEventListener(t,n,a,c={}){t.addEventListener(n,a,"passive"in c?c:c.capture)}static removeEventListener(t,n,a,c={}){t.removeEventListener(n,a,"passive"in c?c:c.capture)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",Q.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",Q.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",Q.suppressClickInternal,!0)},0)}static mousePos(t,n){const a=t.getBoundingClientRect();return new h.Point(n.clientX-a.left-t.clientLeft,n.clientY-a.top-t.clientTop)}static touchPos(t,n){const a=t.getBoundingClientRect(),c=[];for(let p=0;p<n.length;p++)c.push(new h.Point(n[p].clientX-a.left-t.clientLeft,n[p].clientY-a.top-t.clientTop));return c}static mouseButton(t){return t.button}static remove(t){t.parentNode&&t.parentNode.removeChild(t)}}Q.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,Q.selectProp=Q.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),Q.transformProp=Q.testProp(["transform","WebkitTransform"]);const He={supported:!1,testSupport:function(o){!We&&Te&&(Ge?kt(o):ve=o)}};let ve,Te,We=!1,Ge=!1;function kt(o){const t=o.createTexture();o.bindTexture(o.TEXTURE_2D,t);try{if(o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,Te),o.isContextLost())return;He.supported=!0}catch{}o.deleteTexture(t),We=!0}var Rt;typeof document<"u"&&(Te=document.createElement("img"),Te.onload=function(){ve&&kt(ve),ve=null,Ge=!0},Te.onerror=function(){We=!0,ve=null},Te.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(o){let t,n,a,c;o.resetRequestQueue=()=>{t=[],n=0,a=0,c={}},o.addThrottleControl=v=>{const S=a++;return c[S]=v,S},o.removeThrottleControl=v=>{delete c[v],y()},o.getImage=(v,S,T=!0)=>{He.supported&&(v.headers||(v.headers={}),v.headers.accept="image/webp,*/*");const z={requestParameters:v,supportImageRefresh:T,callback:S,cancelled:!1,completed:!1,cancel:()=>{z.completed||z.cancelled||(z.cancelled=!0,z.innerRequest&&(z.innerRequest.cancel(),n--),y())}};return t.push(z),y(),z};const p=v=>{const{requestParameters:S,supportImageRefresh:T,callback:z}=v;return h.extend(S,{type:"image"}),(T!==!1||h.isWorker()||h.getProtocolAction(S.url)||S.headers&&!Object.keys(S.headers).reduce((U,R)=>U&&R==="accept",!0)?h.makeRequest:_)(S,(U,R,F,j)=>{m(v,z,U,R,F,j)})},m=(v,S,T,z,U,R)=>{T?S(T):z instanceof HTMLImageElement||z instanceof ImageBitmap?S(null,z):z&&((F,j)=>{typeof createImageBitmap=="function"?h.arrayBufferToImageBitmap(F,j):h.arrayBufferToImage(F,j)})(z,(F,j)=>{F!=null?S(F):j!=null&&S(null,j,{cacheControl:U,expires:R})}),v.cancelled||(v.completed=!0,n--,y())},y=()=>{const v=(()=>{const S=Object.keys(c);let T=!1;if(S.length>0){for(const z of S)if(T=c[z](),T)break}return T})()?h.config.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:h.config.MAX_PARALLEL_IMAGE_REQUESTS;for(let S=n;S<v&&t.length>0;S++){const T=t.shift();if(T.cancelled){S--;continue}const z=p(T);n++,T.innerRequest=z}},_=(v,S)=>{const T=new Image,z=v.url;let U=!1;const R=v.credentials;return R&&R==="include"?T.crossOrigin="use-credentials":(R&&R==="same-origin"||!h.sameOrigin(z))&&(T.crossOrigin="anonymous"),T.fetchPriority="high",T.onload=()=>{S(null,T),T.onerror=T.onload=null},T.onerror=()=>{U||S(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.")),T.onerror=T.onload=null},T.src=z,{cancel:()=>{U=!0,T.src=""}}}}(Rt||(Rt={})),Rt.resetRequestQueue();var It,hr=Rt;(function(o){o.Glyphs="Glyphs",o.Image="Image",o.Source="Source",o.SpriteImage="SpriteImage",o.SpriteJSON="SpriteJSON",o.Style="Style",o.Tile="Tile",o.Unknown="Unknown"})(It||(It={}));class _i{constructor(t){this._transformRequestFn=t}transformRequest(t,n){return this._transformRequestFn&&this._transformRequestFn(t,n)||{url:t}}normalizeSpriteURL(t,n,a){const c=function(p){const m=p.match(ya);if(!m)throw new Error(`Unable to parse URL "${p}"`);return{protocol:m[1],authority:m[2],path:m[3]||"/",params:m[4]?m[4].split("&"):[]}}(t);return c.path+=`${n}${a}`,function(p){const m=p.params.length?`?${p.params.join("&")}`:"";return`${p.protocol}://${p.authority}${p.path}${m}`}(c)}setTransformRequest(t){this._transformRequestFn=t}}const ya=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function Un(o){var t=new h.ARRAY_TYPE(3);return t[0]=o[0],t[1]=o[1],t[2]=o[2],t}var Dr,mn=function(o,t,n){return o[0]=t[0]-n[0],o[1]=t[1]-n[1],o[2]=t[2]-n[2],o};Dr=new h.ARRAY_TYPE(3),h.ARRAY_TYPE!=Float32Array&&(Dr[0]=0,Dr[1]=0,Dr[2]=0);var Ti=function(o){var t=o[0],n=o[1];return t*t+n*n};function Xr(o){const t=[];if(typeof o=="string")t.push({id:"default",url:o});else if(o&&o.length>0){const n=[];for(const{id:a,url:c}of o){const p=`${a}${c}`;n.indexOf(p)===-1&&(n.push(p),t.push({id:a,url:c}))}}return t}function oi(o,t,n,a,c){if(a)return void o(a);if(c!==Object.values(t).length||c!==Object.values(n).length)return;const p={};for(const m in t){p[m]={};const y=h.exported.getImageCanvasContext(n[m]),_=t[m];for(const v in _){const{width:S,height:T,x:z,y:U,sdf:R,pixelRatio:F,stretchX:j,stretchY:X,content:ne}=_[v];p[m][v]={data:null,pixelRatio:F,sdf:R,stretchX:j,stretchY:X,content:ne,spriteData:{width:S,height:T,x:z,y:U,context:y}}}}o(null,p)}(function(){var o=new h.ARRAY_TYPE(2);h.ARRAY_TYPE!=Float32Array&&(o[0]=0,o[1]=0)})();class xt{constructor(t,n,a,c){this.context=t,this.format=a,this.texture=t.gl.createTexture(),this.update(n,c)}update(t,n,a){const{width:c,height:p}=t,m=!(this.size&&this.size[0]===c&&this.size[1]===p||a),{context:y}=this,{gl:_}=y;if(this.useMipmap=!!(n&&n.useMipmap),_.bindTexture(_.TEXTURE_2D,this.texture),y.pixelStoreUnpackFlipY.set(!1),y.pixelStoreUnpack.set(1),y.pixelStoreUnpackPremultiplyAlpha.set(this.format===_.RGBA&&(!n||n.premultiply!==!1)),m)this.size=[c,p],t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||h.isImageBitmap(t)?_.texImage2D(_.TEXTURE_2D,0,this.format,this.format,_.UNSIGNED_BYTE,t):_.texImage2D(_.TEXTURE_2D,0,this.format,c,p,0,this.format,_.UNSIGNED_BYTE,t.data);else{const{x:v,y:S}=a||{x:0,y:0};t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||h.isImageBitmap(t)?_.texSubImage2D(_.TEXTURE_2D,0,v,S,_.RGBA,_.UNSIGNED_BYTE,t):_.texSubImage2D(_.TEXTURE_2D,0,v,S,c,p,_.RGBA,_.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&_.generateMipmap(_.TEXTURE_2D)}bind(t,n,a){const{context:c}=this,{gl:p}=c;p.bindTexture(p.TEXTURE_2D,this.texture),a!==p.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(a=p.LINEAR),t!==this.filter&&(p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MAG_FILTER,t),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MIN_FILTER,a||t),this.filter=t),n!==this.wrap&&(p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_S,n),p.texParameteri(p.TEXTURE_2D,p.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(){const{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null}}function xa(o){const{userImage:t}=o;return!!(t&&t.render&&t.render())&&(o.data.replace(new Uint8Array(t.data.buffer)),!0)}class qi extends h.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new h.RGBAImage({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(const{ids:n,callback:a}of this.requestors)this._notify(n,a);this.requestors=[]}}getImage(t){const n=this.images[t];if(n&&!n.data&&n.spriteData){const a=n.spriteData;n.data=new h.RGBAImage({width:a.width,height:a.height},a.context.getImageData(a.x,a.y,a.width,a.height).data),n.spriteData=null}return n}addImage(t,n){if(this.images[t])throw new Error(`Image id ${t} already exist, use updateImage instead`);this._validate(t,n)&&(this.images[t]=n)}_validate(t,n){let a=!0;const c=n.data||n.spriteData;return this._validateStretch(n.stretchX,c&&c.width)||(this.fire(new h.ErrorEvent(new Error(`Image "${t}" has invalid "stretchX" value`))),a=!1),this._validateStretch(n.stretchY,c&&c.height)||(this.fire(new h.ErrorEvent(new Error(`Image "${t}" has invalid "stretchY" value`))),a=!1),this._validateContent(n.content,n)||(this.fire(new h.ErrorEvent(new Error(`Image "${t}" has invalid "content" value`))),a=!1),a}_validateStretch(t,n){if(!t)return!0;let a=0;for(const c of t){if(c[0]<a||c[1]<c[0]||n<c[1])return!1;a=c[1]}return!0}_validateContent(t,n){if(!t)return!0;if(t.length!==4)return!1;const a=n.spriteData,c=a&&a.width||n.data.width,p=a&&a.height||n.data.height;return!(t[0]<0||c<t[0]||t[1]<0||p<t[1]||t[2]<0||c<t[2]||t[3]<0||p<t[3]||t[2]<t[0]||t[3]<t[1])}updateImage(t,n,a=!0){const c=this.getImage(t);if(a&&(c.data.width!==n.data.width||c.data.height!==n.data.height))throw new Error(`size mismatch between old image (${c.data.width}x${c.data.height}) and new image (${n.data.width}x${n.data.height}).`);n.version=c.version+1,this.images[t]=n,this.updatedImages[t]=!0}removeImage(t){const n=this.images[t];delete this.images[t],delete this.patterns[t],n.userImage&&n.userImage.onRemove&&n.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(t,n){let a=!0;if(!this.isLoaded())for(const c of t)this.images[c]||(a=!1);this.isLoaded()||a?this._notify(t,n):this.requestors.push({ids:t,callback:n})}_notify(t,n){const a={};for(const c of t){let p=this.getImage(c);p||(this.fire(new h.Event("styleimagemissing",{id:c})),p=this.getImage(c)),p?a[c]={data:p.data.clone(),pixelRatio:p.pixelRatio,sdf:p.sdf,version:p.version,stretchX:p.stretchX,stretchY:p.stretchY,content:p.content,hasRenderCallback:!!(p.userImage&&p.userImage.render)}:h.warnOnce(`Image "${c}" 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.`)}n(null,a)}getPixelSize(){const{width:t,height:n}=this.atlasImage;return{width:t,height:n}}getPattern(t){const n=this.patterns[t],a=this.getImage(t);if(!a)return null;if(n&&n.position.version===a.version)return n.position;if(n)n.position.version=a.version;else{const c={w:a.data.width+2,h:a.data.height+2,x:0,y:0},p=new h.ImagePosition(c,a);this.patterns[t]={bin:c,position:p}}return this._updatePatternAtlas(),this.patterns[t].position}bind(t){const n=t.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new xt(t,this.atlasImage,n.RGBA),this.atlasTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}_updatePatternAtlas(){const t=[];for(const p in this.patterns)t.push(this.patterns[p].bin);const{w:n,h:a}=h.potpack(t),c=this.atlasImage;c.resize({width:n||1,height:a||1});for(const p in this.patterns){const{bin:m}=this.patterns[p],y=m.x+1,_=m.y+1,v=this.getImage(p).data,S=v.width,T=v.height;h.RGBAImage.copy(v,c,{x:0,y:0},{x:y,y:_},{width:S,height:T}),h.RGBAImage.copy(v,c,{x:0,y:T-1},{x:y,y:_-1},{width:S,height:1}),h.RGBAImage.copy(v,c,{x:0,y:0},{x:y,y:_+T},{width:S,height:1}),h.RGBAImage.copy(v,c,{x:S-1,y:0},{x:y-1,y:_},{width:1,height:T}),h.RGBAImage.copy(v,c,{x:0,y:0},{x:y+S,y:_},{width:1,height:T})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(t){for(const n of t){if(this.callbackDispatchedThisFrame[n])continue;this.callbackDispatchedThisFrame[n]=!0;const a=this.getImage(n);a||h.warnOnce(`Image with ID: "${n}" was not found`),xa(a)&&this.updateImage(n,a)}}}const Tr=1e20;function Rr(o,t,n,a,c,p,m,y,_){for(let v=t;v<t+a;v++)Wr(o,n*p+v,p,c,m,y,_);for(let v=n;v<n+c;v++)Wr(o,v*p+t,1,a,m,y,_)}function Wr(o,t,n,a,c,p,m){p[0]=0,m[0]=-Tr,m[1]=Tr,c[0]=o[t];for(let y=1,_=0,v=0;y<a;y++){c[y]=o[t+y*n];const S=y*y;do{const T=p[_];v=(c[y]-c[T]+S-T*T)/(y-T)/2}while(v<=m[_]&&--_>-1);_++,p[_]=y,m[_]=v,m[_+1]=Tr}for(let y=0,_=0;y<a;y++){for(;m[_+1]<y;)_++;const v=p[_],S=y-v;o[t+y*n]=c[v]+S*S}}class Sr{constructor(t,n){this.requestManager=t,this.localIdeographFontFamily=n,this.entries={}}setURL(t){this.url=t}getGlyphs(t,n){const a=[];for(const c in t)for(const p of t[c])a.push({stack:c,id:p});h.asyncAll(a,({stack:c,id:p},m)=>{let y=this.entries[c];y||(y=this.entries[c]={glyphs:{},requests:{},ranges:{}});let _=y.glyphs[p];if(_!==void 0)return void m(null,{stack:c,id:p,glyph:_});if(_=this._tinySDF(y,c,p),_)return y.glyphs[p]=_,void m(null,{stack:c,id:p,glyph:_});const v=Math.floor(p/256);if(256*v>65535)return void m(new Error("glyphs > 65535 not supported"));if(y.ranges[v])return void m(null,{stack:c,id:p,glyph:_});if(!this.url)return void m(new Error("glyphsUrl is not set"));let S=y.requests[v];S||(S=y.requests[v]=[],Sr.loadGlyphRange(c,v,this.url,this.requestManager,(T,z)=>{if(z){for(const U in z)this._doesCharSupportLocalGlyph(+U)||(y.glyphs[+U]=z[+U]);y.ranges[v]=!0}for(const U of S)U(T,z);delete y.requests[v]})),S.push((T,z)=>{T?m(T):z&&m(null,{stack:c,id:p,glyph:z[p]||null})})},(c,p)=>{if(c)n(c);else if(p){const m={};for(const{stack:y,id:_,glyph:v}of p)(m[y]||(m[y]={}))[_]=v&&{id:v.id,bitmap:v.bitmap.clone(),metrics:v.metrics};n(null,m)}})}_doesCharSupportLocalGlyph(t){return!!this.localIdeographFontFamily&&(h.unicodeBlockLookup["CJK Unified Ideographs"](t)||h.unicodeBlockLookup["Hangul Syllables"](t)||h.unicodeBlockLookup.Hiragana(t)||h.unicodeBlockLookup.Katakana(t))}_tinySDF(t,n,a){const c=this.localIdeographFontFamily;if(!c||!this._doesCharSupportLocalGlyph(a))return;let p=t.tinySDF;if(!p){let y="400";/bold/i.test(n)?y="900":/medium/i.test(n)?y="500":/light/i.test(n)&&(y="200"),p=t.tinySDF=new Sr.TinySDF({fontSize:24,buffer:3,radius:8,cutoff:.25,fontFamily:c,fontWeight:y})}const m=p.draw(String.fromCharCode(a));return{id:a,bitmap:new h.AlphaImage({width:m.width||30,height:m.height||30},m.data),metrics:{width:m.glyphWidth||24,height:m.glyphHeight||24,left:m.glyphLeft||0,top:m.glyphTop-27||-8,advance:m.glyphAdvance||24}}}}Sr.loadGlyphRange=function(o,t,n,a,c){const p=256*t,m=p+255,y=a.transformRequest(n.replace("{fontstack}",o).replace("{range}",`${p}-${m}`),It.Glyphs);h.getArrayBuffer(y,(_,v)=>{if(_)c(_);else if(v){const S={};for(const T of h.parseGlyphPbf(v))S[T.id]=T;c(null,S)}})},Sr.TinySDF=class{constructor({fontSize:o=24,buffer:t=3,radius:n=8,cutoff:a=.25,fontFamily:c="sans-serif",fontWeight:p="normal",fontStyle:m="normal"}={}){this.buffer=t,this.cutoff=a,this.radius=n;const y=this.size=o+4*t,_=this._createCanvas(y),v=this.ctx=_.getContext("2d",{willReadFrequently:!0});v.font=`${m} ${p} ${o}px ${c}`,v.textBaseline="alphabetic",v.textAlign="left",v.fillStyle="black",this.gridOuter=new Float64Array(y*y),this.gridInner=new Float64Array(y*y),this.f=new Float64Array(y),this.z=new Float64Array(y+1),this.v=new Uint16Array(y)}_createCanvas(o){const t=document.createElement("canvas");return t.width=t.height=o,t}draw(o){const{width:t,actualBoundingBoxAscent:n,actualBoundingBoxDescent:a,actualBoundingBoxLeft:c,actualBoundingBoxRight:p}=this.ctx.measureText(o),m=Math.ceil(n),y=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(p-c))),_=Math.min(this.size-this.buffer,m+Math.ceil(a)),v=y+2*this.buffer,S=_+2*this.buffer,T=Math.max(v*S,0),z=new Uint8ClampedArray(T),U={data:z,width:v,height:S,glyphWidth:y,glyphHeight:_,glyphTop:m,glyphLeft:0,glyphAdvance:t};if(y===0||_===0)return U;const{ctx:R,buffer:F,gridInner:j,gridOuter:X}=this;R.clearRect(F,F,y,_),R.fillText(o,F,F+m);const ne=R.getImageData(F,F,y,_);X.fill(Tr,0,T),j.fill(0,0,T);for(let V=0;V<_;V++)for(let ie=0;ie<y;ie++){const ae=ne.data[4*(V*y+ie)+3]/255;if(ae===0)continue;const fe=(V+F)*v+ie+F;if(ae===1)X[fe]=0,j[fe]=Tr;else{const _e=.5-ae;X[fe]=_e>0?_e*_e:0,j[fe]=_e<0?_e*_e:0}}Rr(X,0,0,v,S,v,this.f,this.v,this.z),Rr(j,F,F,y,_,v,this.f,this.v,this.z);for(let V=0;V<T;V++){const ie=Math.sqrt(X[V])-Math.sqrt(j[V]);z[V]=Math.round(255-255*(ie/this.radius+this.cutoff))}return U}};class gn{constructor(){this.specification=h.v8Spec.light.position}possiblyEvaluate(t,n){return h.sphericalToCartesian(t.expression.evaluate(n))}interpolate(t,n,a){return{x:h.interpolate.number(t.x,n.x,a),y:h.interpolate.number(t.y,n.y,a),z:h.interpolate.number(t.z,n.z,a)}}}const _n="-transition";let yn,Hr;class Br extends h.Evented{constructor(t){super(),yn=yn||new h.Properties({anchor:new h.DataConstantProperty(h.v8Spec.light.anchor),position:new gn,color:new h.DataConstantProperty(h.v8Spec.light.color),intensity:new h.DataConstantProperty(h.v8Spec.light.intensity)}),this._transitionable=new h.Transitionable(yn),this.setLight(t),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,n={}){if(!this._validate(h.validateLight,t,n))for(const a in t){const c=t[a];a.endsWith(_n)?this._transitionable.setTransition(a.slice(0,-_n.length),c):this._transitionable.setValue(a,c)}}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,n,a){return(!a||a.validate!==!1)&&h.emitValidationErrors(this,t.call(h.validateStyle,h.extend({value:n,style:{glyphs:!0,sprite:!0},styleSpec:h.v8Spec})))}}class Nn{constructor(t,n){this.width=t,this.height=n,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(t,n){const a=t.join(",")+String(n);return this.dashEntry[a]||(this.dashEntry[a]=this.addDash(t,n)),this.dashEntry[a]}getDashRanges(t,n,a){const c=[];let p=t.length%2==1?-t[t.length-1]*a:0,m=t[0]*a,y=!0;c.push({left:p,right:m,isDash:y,zeroLength:t[0]===0});let _=t[0];for(let v=1;v<t.length;v++){y=!y;const S=t[v];p=_*a,_+=S,m=_*a,c.push({left:p,right:m,isDash:y,zeroLength:S===0})}return c}addRoundDash(t,n,a){const c=n/2;for(let p=-a;p<=a;p++){const m=this.width*(this.nextRow+a+p);let y=0,_=t[y];for(let v=0;v<this.width;v++){v/_.right>1&&(_=t[++y]);const S=Math.abs(v-_.left),T=Math.abs(v-_.right),z=Math.min(S,T);let U;const R=p/a*(c+1);if(_.isDash){const F=c-Math.abs(R);U=Math.sqrt(z*z+F*F)}else U=c-Math.sqrt(z*z+R*R);this.data[m+v]=Math.max(0,Math.min(255,U+128))}}}addRegularDash(t){for(let y=t.length-1;y>=0;--y){const _=t[y],v=t[y+1];_.zeroLength?t.splice(y,1):v&&v.isDash===_.isDash&&(v.left=_.left,t.splice(y,1))}const n=t[0],a=t[t.length-1];n.isDash===a.isDash&&(n.left=a.left-this.width,a.right=n.right+this.width);const c=this.width*this.nextRow;let p=0,m=t[p];for(let y=0;y<this.width;y++){y/m.right>1&&(m=t[++p]);const _=Math.abs(y-m.left),v=Math.abs(y-m.right),S=Math.min(_,v);this.data[c+y]=Math.max(0,Math.min(255,(m.isDash?S:-S)+128))}}addDash(t,n){const a=n?7:0,c=2*a+1;if(this.nextRow+c>this.height)return h.warnOnce("LineAtlas out of space"),null;let p=0;for(let y=0;y<t.length;y++)p+=t[y];if(p!==0){const y=this.width/p,_=this.getDashRanges(t,this.width,y);n?this.addRoundDash(_,y,a):this.addRegularDash(_)}const m={y:(this.nextRow+a+.5)/this.height,height:2*a/this.height,width:p};return this.nextRow+=c,this.dirty=!0,m}bind(t){const n=t.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))}}class Fr{constructor(t,n,a){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=a;const c=this.workerPool.acquire(a);for(let p=0;p<c.length;p++){const m=new Fr.Actor(c[p],n,a);m.name=`Worker ${p}`,this.actors.push(m)}if(!this.actors.length)throw new Error("No actors found")}broadcast(t,n,a){h.asyncAll(this.actors,(c,p)=>{c.send(t,n,p)},a=a||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(t=!0){this.actors.forEach(n=>{n.remove()}),this.actors=[],t&&this.workerPool.release(this.id)}}function xn(o,t,n){const a=function(c,p){if(c)return n(c);if(p){const m=h.pick(h.extend(p,o),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);p.vector_layers&&(m.vectorLayers=p.vector_layers,m.vectorLayerIds=m.vectorLayers.map(y=>y.id)),n(null,m)}};return o.url?h.getJSON(t.transformRequest(o.url,It.Source),a):h.exported.frame(()=>a(null,o))}Fr.Actor=h.Actor;class Gt{constructor(t,n){t&&(n?this.setSouthWest(t).setNorthEast(n):Array.isArray(t)&&(t.length===4?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1])))}setNorthEast(t){return this._ne=t instanceof h.LngLat?new h.LngLat(t.lng,t.lat):h.LngLat.convert(t),this}setSouthWest(t){return this._sw=t instanceof h.LngLat?new h.LngLat(t.lng,t.lat):h.LngLat.convert(t),this}extend(t){const n=this._sw,a=this._ne;let c,p;if(t instanceof h.LngLat)c=t,p=t;else{if(!(t instanceof Gt))return Array.isArray(t)?t.length===4||t.every(Array.isArray)?this.extend(Gt.convert(t)):this.extend(h.LngLat.convert(t)):t&&("lng"in t||"lon"in t)&&"lat"in t?this.extend(h.LngLat.convert(t)):this;if(c=t._sw,p=t._ne,!c||!p)return this}return n||a?(n.lng=Math.min(c.lng,n.lng),n.lat=Math.min(c.lat,n.lat),a.lng=Math.max(p.lng,a.lng),a.lat=Math.max(p.lat,a.lat)):(this._sw=new h.LngLat(c.lng,c.lat),this._ne=new h.LngLat(p.lng,p.lat)),this}getCenter(){return new h.LngLat((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 h.LngLat(this.getWest(),this.getNorth())}getSouthEast(){return new h.LngLat(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(t){const{lng:n,lat:a}=h.LngLat.convert(t);let c=this._sw.lng<=n&&n<=this._ne.lng;return this._sw.lng>this._ne.lng&&(c=this._sw.lng>=n&&n>=this._ne.lng),this._sw.lat<=a&&a<=this._ne.lat&&c}static convert(t){return t instanceof Gt?t:t&&new Gt(t)}static fromLngLat(t,n=0){const a=360*n/40075017,c=a/Math.cos(Math.PI/180*t.lat);return new Gt(new h.LngLat(t.lng-c,t.lat-a),new h.LngLat(t.lng+c,t.lat+a))}}class Or{constructor(t,n,a){this.bounds=Gt.convert(this.validateBounds(t)),this.minzoom=n||0,this.maxzoom=a||24}validateBounds(t){return Array.isArray(t)&&t.length===4?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}contains(t){const n=Math.pow(2,t.z),a=Math.floor(h.mercatorXfromLng(this.bounds.getWest())*n),c=Math.floor(h.mercatorYfromLat(this.bounds.getNorth())*n),p=Math.ceil(h.mercatorXfromLng(this.bounds.getEast())*n),m=Math.ceil(h.mercatorYfromLat(this.bounds.getSouth())*n);return t.x>=a&&t.x<p&&t.y>=c&&t.y<m}}class Vn extends h.Evented{constructor(t,n,a,c){if(super(),this.id=t,this.dispatcher=a,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,h.extend(this,h.pick(n,["url","scheme","tileSize","promoteId"])),this._options=h.extend({type:"vector"},n),this._collectResourceTiming=n.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(c)}load(){this._loaded=!1,this.fire(new h.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=xn(this._options,this.map._requestManager,(t,n)=>{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),t?this.fire(new h.ErrorEvent(t)):n&&(h.extend(this,n),n.bounds&&(this.tileBounds=new Or(n.bounds,this.minzoom,this.maxzoom)),this.fire(new h.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new h.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.cancel(),t(),this.load()}setTiles(t){return this.setSourceProperty(()=>{this._options.tiles=t}),this}setUrl(t){return this.setSourceProperty(()=>{this.url=t,this._options.url=t}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return h.extend({},this._options)}loadTile(t,n){const a=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),c={request:this.map._requestManager.transformRequest(a,It.Tile),uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};function p(m,y){return delete t.request,t.aborted?n(null):m&&m.status!==404?n(m):(y&&y.resourceTiming&&(t.resourceTiming=y.resourceTiming),this.map._refreshExpiredTiles&&y&&t.setExpiryData(y),t.loadVectorData(y,this.map.painter),n(null),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}c.request.collectResourceTiming=this._collectResourceTiming,t.actor&&t.state!=="expired"?t.state==="loading"?t.reloadCallback=n:t.request=t.actor.send("reloadTile",c,p.bind(this)):(t.actor=this.dispatcher.getActor(),t.request=t.actor.send("loadTile",c,p.bind(this)))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.type,source:this.id},void 0)}unloadTile(t){t.unloadVectorData(),t.actor&&t.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id},void 0)}hasTransition(){return!1}}class Ur extends h.Evented{constructor(t,n,a,c){super(),this.id=t,this.dispatcher=a,this.setEventedParent(c),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=h.extend({type:"raster"},n),h.extend(this,h.pick(n,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new h.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=xn(this._options,this.map._requestManager,(t,n)=>{this._tileJSONRequest=null,this._loaded=!0,t?this.fire(new h.ErrorEvent(t)):n&&(h.extend(this,n),n.bounds&&(this.tileBounds=new Or(n.bounds,this.minzoom,this.maxzoom)),this.fire(new h.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new h.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return h.extend({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t,n){const a=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.request=hr.getImage(this.map._requestManager.transformRequest(a,It.Tile),(c,p,m)=>{if(delete t.request,t.aborted)t.state="unloaded",n(null);else if(c)t.state="errored",n(c);else if(p){this.map._refreshExpiredTiles&&m&&t.setExpiryData(m);const y=this.map.painter.context,_=y.gl;t.texture=this.map.painter.getTileTexture(p.width),t.texture?t.texture.update(p,{useMipmap:!0}):(t.texture=new xt(y,p,_.RGBA,{useMipmap:!0}),t.texture.bind(_.LINEAR,_.CLAMP_TO_EDGE,_.LINEAR_MIPMAP_NEAREST),y.extTextureFilterAnisotropic&&_.texParameterf(_.TEXTURE_2D,y.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,y.extTextureFilterAnisotropicMax)),t.state="loaded",n(null)}},this.map._refreshExpiredTiles)}abortTile(t,n){t.request&&(t.request.cancel(),delete t.request),n()}unloadTile(t,n){t.texture&&this.map.painter.saveTileTexture(t.texture),n()}hasTransition(){return!1}}class vn extends Ur{constructor(t,n,a,c){super(t,n,a,c),this.type="raster-dem",this.maxzoom=22,this._options=h.extend({type:"raster-dem"},n),this.encoding=n.encoding||"mapbox"}serialize(){return{type:"raster-dem",url:this.url,tileSize:this.tileSize,tiles:this.tiles,bounds:this.bounds,encoding:this.encoding}}loadTile(t,n){const a=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);function c(p,m){p&&(t.state="errored",n(p)),m&&(t.dem=m,t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded",n(null))}t.request=hr.getImage(this.map._requestManager.transformRequest(a,It.Tile),function(p,m){if(delete t.request,t.aborted)t.state="unloaded",n(null);else if(p)t.state="errored",n(p);else if(m){this.map._refreshExpiredTiles&&t.setExpiryData(m),delete m.cacheControl,delete m.expires;const y=h.isImageBitmap(m)&&(Hr==null&&(Hr=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Hr)?m:h.exported.getImageData(m,1),_={uid:t.uid,coord:t.tileID,source:this.id,rawImageData:y,encoding:this.encoding};t.actor&&t.state!=="expired"||(t.actor=this.dispatcher.getActor(),t.actor.send("loadDEMTile",_,c.bind(this)))}}.bind(this),this.map._refreshExpiredTiles),t.neighboringTiles=this._getNeighboringTiles(t.tileID)}_getNeighboringTiles(t){const n=t.canonical,a=Math.pow(2,n.z),c=(n.x-1+a)%a,p=n.x===0?t.wrap-1:t.wrap,m=(n.x+1+a)%a,y=n.x+1===a?t.wrap+1:t.wrap,_={};return _[new h.OverscaledTileID(t.overscaledZ,p,n.z,c,n.y).key]={backfilled:!1},_[new h.OverscaledTileID(t.overscaledZ,y,n.z,m,n.y).key]={backfilled:!1},n.y>0&&(_[new h.OverscaledTileID(t.overscaledZ,p,n.z,c,n.y-1).key]={backfilled:!1},_[new h.OverscaledTileID(t.overscaledZ,t.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},_[new h.OverscaledTileID(t.overscaledZ,y,n.z,m,n.y-1).key]={backfilled:!1}),n.y+1<a&&(_[new h.OverscaledTileID(t.overscaledZ,p,n.z,c,n.y+1).key]={backfilled:!1},_[new h.OverscaledTileID(t.overscaledZ,t.wrap,n.z,n.x,n.y+1).key]={backfilled:!1},_[new h.OverscaledTileID(t.overscaledZ,y,n.z,m,n.y+1).key]={backfilled:!1}),_}unloadTile(t){t.demTexture&&this.map.painter.saveTileTexture(t.demTexture),t.fbo&&(t.fbo.destroy(),delete t.fbo),t.dem&&delete t.dem,delete t.neighboringTiles,t.state="unloaded",t.actor&&t.actor.send("removeDEMTile",{uid:t.uid,source:this.id})}}class Qi extends h.Evented{constructor(t,n,a,c){super(),this.id=t,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=a.getActor(),this.setEventedParent(c),this._data=n.data,this._options=h.extend({},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;const p=h.EXTENT/this.tileSize;this.workerOptions=h.extend({source:this.id,cluster:n.cluster||!1,geojsonVtOptions:{buffer:(n.buffer!==void 0?n.buffer:128)*p,tolerance:(n.tolerance!==void 0?n.tolerance:.375)*p,extent:h.EXTENT,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:h.EXTENT,radius:(n.clusterRadius||50)*p,log:!1,generateId:n.generateId||!1},clusterProperties:n.clusterProperties,filter:n.filter},n.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}load(){this._updateWorkerData()}onAdd(t){this.map=t,this.load()}setData(t){return this._data=t,this._updateWorkerData(),this}updateData(t){return this._updateWorkerData(t),this}setClusterOptions(t){return this.workerOptions.cluster=t.cluster,t&&(t.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=t.clusterRadius),t.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=t.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(t,n){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:t,source:this.id},n),this}getClusterChildren(t,n){return this.actor.send("geojson.getClusterChildren",{clusterId:t,source:this.id},n),this}getClusterLeaves(t,n,a,c){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:t,limit:n,offset:a},c),this}_updateWorkerData(t){const n=h.extend({},this.workerOptions);t?n.dataDiff=t:typeof this._data=="string"?(n.request=this.map._requestManager.transformRequest(h.exported.resolveURL(this._data),It.Source),n.request.collectResourceTiming=this._collectResourceTiming):n.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new h.Event("dataloading",{dataType:"source"})),this.actor.send(`${this.type}.loadData`,n,(a,c)=>{if(this._pendingLoads--,this._removed||c&&c.abandoned)return void this.fire(new h.Event("dataabort",{dataType:"source"}));let p=null;if(c&&c.resourceTiming&&c.resourceTiming[this.id]&&(p=c.resourceTiming[this.id].slice(0)),a)return void this.fire(new h.ErrorEvent(a));const m={dataType:"source"};this._collectResourceTiming&&p&&p.length>0&&h.extend(m,{resourceTiming:p}),this.fire(new h.Event("data",{...m,sourceDataType:"metadata"})),this.fire(new h.Event("data",{...m,sourceDataType:"content"}))})}loaded(){return this._pendingLoads===0}loadTile(t,n){const a=t.actor?"reloadTile":"loadTile";t.actor=this.actor;const c={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};t.request=this.actor.send(a,c,(p,m)=>(delete t.request,t.unloadVectorData(),t.aborted?n(null):p?n(p):(t.loadVectorData(m,this.map.painter,a==="reloadTile"),n(null))))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.aborted=!0}unloadTile(t){t.unloadVectorData(),this.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id})}onRemove(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})}serialize(){return h.extend({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var ur=h.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Zi extends h.Evented{constructor(t,n,a,c){super(),this.id=t,this.dispatcher=a,this.coordinates=n.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(c),this.options=n}load(t,n){this._loaded=!1,this.fire(new h.Event("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=hr.getImage(this.map._requestManager.transformRequest(this.url,It.Image),(a,c)=>{this._request=null,this._loaded=!0,a?this.fire(new h.ErrorEvent(a)):c&&(this.image=c,t&&(this.coordinates=t),n&&n(),this._finishLoading())})}loaded(){return this._loaded}updateImage(t){return t.url?(this._request&&(this._request.cancel(),this._request=null),this.options.url=t.url,this.load(t.coordinates,()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new h.Event("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}onRemove(){this._request&&(this._request.cancel(),this._request=null)}setCoordinates(t){this.coordinates=t;const n=t.map(h.MercatorCoordinate.fromLngLat);this.tileID=function(c){let p=1/0,m=1/0,y=-1/0,_=-1/0;for(const z of c)p=Math.min(p,z.x),m=Math.min(m,z.y),y=Math.max(y,z.x),_=Math.max(_,z.y);const v=Math.max(y-p,_-m),S=Math.max(0,Math.floor(-Math.log(v)/Math.LN2)),T=Math.pow(2,S);return new h.CanonicalTileID(S,Math.floor((p+y)/2*T),Math.floor((m+_)/2*T))}(n),this.minzoom=this.maxzoom=this.tileID.z;const a=n.map(c=>this.tileID.getTilePoint(c)._round());return this._boundsArray=new h.RasterBoundsArray,this._boundsArray.emplaceBack(a[0].x,a[0].y,0,0),this._boundsArray.emplaceBack(a[1].x,a[1].y,h.EXTENT,0),this._boundsArray.emplaceBack(a[3].x,a[3].y,0,h.EXTENT),this._boundsArray.emplaceBack(a[2].x,a[2].y,h.EXTENT,h.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new h.Event("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const t=this.map.painter.context,n=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,ur.members)),this.boundsSegments||(this.boundsSegments=h.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new xt(t,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let a=!1;for(const c in this.tiles){const p=this.tiles[c];p.state!=="loaded"&&(p.state="loaded",p.texture=this.texture,a=!0)}a&&this.fire(new h.Event("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(t,n){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={},n(null)):(t.state="errored",n(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class oe extends Zi{constructor(t,n,a,c){super(t,n,a,c),this.roundZoom=!0,this.type="video",this.options=n}load(){this._loaded=!1;const t=this.options;this.urls=[];for(const n of t.urls)this.urls.push(this.map._requestManager.transformRequest(n,It.Source).url);h.getVideo(this.urls,(n,a)=>{this._loaded=!0,n?this.fire(new h.ErrorEvent(n)):a&&(this.video=a,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){const n=this.video.seekable;t<n.start(0)||t>n.end(0)?this.fire(new h.ErrorEvent(new h.ValidationError(`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=t}}getVideo(){return this.video}onAdd(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const t=this.map.painter.context,n=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,ur.members)),this.boundsSegments||(this.boundsSegments=h.SegmentVector.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 xt(t,this.video,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let a=!1;for(const c in this.tiles){const p=this.tiles[c];p.state!=="loaded"&&(p.state="loaded",p.texture=this.texture,a=!0)}a&&this.fire(new h.Event("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 Kr extends Zi{constructor(t,n,a,c){super(t,n,a,c),n.coordinates?Array.isArray(n.coordinates)&&n.coordinates.length===4&&!n.coordinates.some(p=>!Array.isArray(p)||p.length!==2||p.some(m=>typeof m!="number"))||this.fire(new h.ErrorEvent(new h.ValidationError(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new h.ErrorEvent(new h.ValidationError(`sources.${t}`,null,'missing required property "coordinates"'))),n.animate&&typeof n.animate!="boolean"&&this.fire(new h.ErrorEvent(new h.ValidationError(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),n.canvas?typeof n.canvas=="string"||n.canvas instanceof HTMLCanvasElement||this.fire(new h.ErrorEvent(new h.ValidationError(`sources.${t}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new h.ErrorEvent(new h.ValidationError(`sources.${t}`,null,'missing required property "canvas"'))),this.options=n,this.animate=n.animate===void 0||n.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new h.ErrorEvent(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let t=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const n=this.map.painter.context,a=n.gl;this.boundsBuffer||(this.boundsBuffer=n.createVertexBuffer(this._boundsArray,ur.members)),this.boundsSegments||(this.boundsSegments=h.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new xt(n,this.canvas,a.RGBA,{premultiply:!0});let c=!1;for(const p in this.tiles){const m=this.tiles[p];m.state!=="loaded"&&(m.state="loaded",m.texture=this.texture,c=!0)}c&&this.fire(new h.Event("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}}const Yr={vector:Vn,raster:Ur,"raster-dem":vn,geojson:Qi,video:oe,image:Zi,canvas:Kr};function bt(o,t){const n=h.create();return h.translate(n,n,[1,1,0]),h.scale(n,n,[.5*o.width,.5*o.height,1]),h.multiply(n,n,o.calculatePosMatrix(t.toUnwrapped()))}function pt(o,t,n,a,c,p){const m=function(T,z,U){if(T)for(const R of T){const F=z[R];if(F&&F.source===U&&F.type==="fill-extrusion")return!0}else for(const R in z){const F=z[R];if(F.source===U&&F.type==="fill-extrusion")return!0}return!1}(c&&c.layers,t,o.id),y=p.maxPitchScaleFactor(),_=o.tilesIn(a,y,m);_.sort(Di);const v=[];for(const T of _)v.push({wrappedTileID:T.tileID.wrapped().key,queryResults:T.tile.queryRenderedFeatures(t,n,o._state,T.queryGeometry,T.cameraQueryGeometry,T.scale,c,p,y,bt(o.transform,T.tileID))});const S=function(T){const z={},U={};for(const R of T){const F=R.queryResults,j=R.wrappedTileID,X=U[j]=U[j]||{};for(const ne in F){const V=F[ne],ie=X[ne]=X[ne]||{},ae=z[ne]=z[ne]||[];for(const fe of V)ie[fe.featureIndex]||(ie[fe.featureIndex]=!0,ae.push(fe))}}return z}(v);for(const T in S)S[T].forEach(z=>{const U=z.feature,R=o.getFeatureState(U.layer["source-layer"],U.id);U.source=U.layer.source,U.layer["source-layer"]&&(U.sourceLayer=U.layer["source-layer"]),U.state=R});return S}function Di(o,t){const n=o.tileID,a=t.tileID;return n.overscaledZ-a.overscaledZ||n.canonical.y-a.canonical.y||n.wrap-a.wrap||n.canonical.x-a.canonical.x}class $n{constructor(t,n){this.timeAdded=0,this.fadeEndTime=0,this.tileID=t,this.uid=h.uniqueId(),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(t){const n=t+this.timeAdded;n<this.fadeEndTime||(this.fadeEndTime=n)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(t){this.demTexture&&t.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(t,n,a){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",t){t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestFeatureIndex.rawTileData=t.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=function(c,p){const m={};if(!p)return m;for(const y of c){const _=y.layerIds.map(v=>p.getLayer(v)).filter(Boolean);if(_.length!==0){y.layers=_,y.stateDependentLayerIds&&(y.stateDependentLayers=y.stateDependentLayerIds.map(v=>_.filter(S=>S.id===v)[0]));for(const v of _)m[v.id]=y}}return m}(t.buckets,n.style),this.hasSymbolBuckets=!1;for(const c in this.buckets){const p=this.buckets[c];if(p instanceof h.SymbolBucket){if(this.hasSymbolBuckets=!0,!a)break;p.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const c in this.buckets){const p=this.buckets[c];if(p instanceof h.SymbolBucket&&p.hasRTLText){this.hasRTLText=!0,h.lazyLoadRTLTextPlugin();break}}this.queryPadding=0;for(const c in this.buckets){const p=this.buckets[c];this.queryPadding=Math.max(this.queryPadding,n.style.getLayer(c).queryRadius(p))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage)}else this.collisionBoxArray=new h.CollisionBoxArray}unloadVectorData(){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(t){return this.buckets[t.id]}upload(t){for(const a in this.buckets){const c=this.buckets[a];c.uploadPending()&&c.upload(t)}const n=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new xt(t,this.imageAtlas.image,n.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new xt(t,this.glyphAtlasImage,n.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,n,a,c,p,m,y,_,v,S){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:c,cameraQueryGeometry:p,scale:m,tileSize:this.tileSize,pixelPosMatrix:S,transform:_,params:y,queryPadding:this.queryPadding*v},t,n,a):{}}querySourceFeatures(t,n){const a=this.latestFeatureIndex;if(!a||!a.rawTileData)return;const c=a.loadVTLayers(),p=n&&n.sourceLayer?n.sourceLayer:"",m=c._geojsonTileLayer||c[p];if(!m)return;const y=h.createFilter(n&&n.filter),{z:_,x:v,y:S}=this.tileID.canonical,T={z:_,x:v,y:S};for(let z=0;z<m.length;z++){const U=m.feature(z);if(y.needGeometry){const j=h.toEvaluationFeature(U,!0);if(!y.filter(new h.EvaluationParameters(this.tileID.overscaledZ),j,this.tileID.canonical))continue}else if(!y.filter(new h.EvaluationParameters(this.tileID.overscaledZ),U))continue;const R=a.getId(U,p),F=new h.GeoJSONFeature(U,_,v,S,R);F.tile=T,t.push(F)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(t){const n=this.expirationTime;if(t.cacheControl){const a=h.parseCacheControl(t.cacheControl);a["max-age"]&&(this.expirationTime=Date.now()+1e3*a["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){const a=Date.now();let c=!1;if(this.expirationTime>a)c=!1;else if(n)if(this.expirationTime<n)c=!0;else{const p=this.expirationTime-n;p?this.expirationTime=a+Math.max(p,3e4):c=!0}else c=!0;c?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}setFeatureState(t,n){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(t).length===0)return;const a=this.latestFeatureIndex.loadVTLayers();for(const c in this.buckets){if(!n.style.hasLayer(c))continue;const p=this.buckets[c],m=p.layers[0].sourceLayer||"_geojsonTileLayer",y=a[m],_=t[m];if(!y||!_||Object.keys(_).length===0)continue;p.update(_,y,this.imageAtlas&&this.imageAtlas.patternPositions||{});const v=n&&n.style&&n.style.getLayer(c);v&&(this.queryPadding=Math.max(this.queryPadding,v.queryRadius(p)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<h.exported.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(t){this.symbolFadeHoldUntil=h.exported.now()+t}setDependencies(t,n){const a={};for(const c of n)a[c]=!0;this.dependencies[t]=a}hasDependency(t,n){for(const a of t){const c=this.dependencies[a];if(c){for(const p of n)if(c[p])return!0}}return!1}}class xs{constructor(t,n){this.max=t,this.onRemove=n,this.reset()}reset(){for(const t in this.data)for(const n of this.data[t])n.timeout&&clearTimeout(n.timeout),this.onRemove(n.value);return this.data={},this.order=[],this}add(t,n,a){const c=t.wrapped().key;this.data[c]===void 0&&(this.data[c]=[]);const p={value:n,timeout:void 0};if(a!==void 0&&(p.timeout=setTimeout(()=>{this.remove(t,p)},a)),this.data[c].push(p),this.order.push(c),this.order.length>this.max){const m=this._getAndRemoveByKey(this.order[0]);m&&this.onRemove(m)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){const n=this.data[t].shift();return n.timeout&&clearTimeout(n.timeout),this.data[t].length===0&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),n.value}getByKey(t){const n=this.data[t];return n?n[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,n){if(!this.has(t))return this;const a=t.wrapped().key,c=n===void 0?0:this.data[a].indexOf(n),p=this.data[a][c];return this.data[a].splice(c,1),p.timeout&&clearTimeout(p.timeout),this.data[a].length===0&&delete this.data[a],this.onRemove(p.value),this.order.splice(this.order.indexOf(a),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const n=this._getAndRemoveByKey(this.order[0]);n&&this.onRemove(n)}return this}filter(t){const n=[];for(const a in this.data)for(const c of this.data[a])t(c.value)||n.push(c);for(const a of n)this.remove(a.value.tileID,a)}}class vs{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,n,a){const c=String(n);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][c]=this.stateChanges[t][c]||{},h.extend(this.stateChanges[t][c],a),this.deletedStates[t]===null){this.deletedStates[t]={};for(const p in this.state[t])p!==c&&(this.deletedStates[t][p]=null)}else if(this.deletedStates[t]&&this.deletedStates[t][c]===null){this.deletedStates[t][c]={};for(const p in this.state[t][c])a[p]||(this.deletedStates[t][c][p]=null)}else for(const p in a)this.deletedStates[t]&&this.deletedStates[t][c]&&this.deletedStates[t][c][p]===null&&delete this.deletedStates[t][c][p]}removeFeatureState(t,n,a){if(this.deletedStates[t]===null)return;const c=String(n);if(this.deletedStates[t]=this.deletedStates[t]||{},a&&n!==void 0)this.deletedStates[t][c]!==null&&(this.deletedStates[t][c]=this.deletedStates[t][c]||{},this.deletedStates[t][c][a]=null);else if(n!==void 0)if(this.stateChanges[t]&&this.stateChanges[t][c])for(a in this.deletedStates[t][c]={},this.stateChanges[t][c])this.deletedStates[t][c][a]=null;else this.deletedStates[t][c]=null;else this.deletedStates[t]=null}getState(t,n){const a=String(n),c=h.extend({},(this.state[t]||{})[a],(this.stateChanges[t]||{})[a]);if(this.deletedStates[t]===null)return{};if(this.deletedStates[t]){const p=this.deletedStates[t][n];if(p===null)return{};for(const m in p)delete c[m]}return c}initializeTileState(t,n){t.setFeatureState(this.state,n)}coalesceChanges(t,n){const a={};for(const c in this.stateChanges){this.state[c]=this.state[c]||{};const p={};for(const m in this.stateChanges[c])this.state[c][m]||(this.state[c][m]={}),h.extend(this.state[c][m],this.stateChanges[c][m]),p[m]=this.state[c][m];a[c]=p}for(const c in this.deletedStates){this.state[c]=this.state[c]||{};const p={};if(this.deletedStates[c]===null)for(const m in this.state[c])p[m]={},this.state[c][m]={};else for(const m in this.deletedStates[c]){if(this.deletedStates[c][m]===null)this.state[c][m]={};else for(const y of Object.keys(this.deletedStates[c][m]))delete this.state[c][m][y];p[m]=this.state[c][m]}a[c]=a[c]||{},h.extend(a[c],p)}if(this.stateChanges={},this.deletedStates={},Object.keys(a).length!==0)for(const c in t)t[c].setFeatureState(a,n)}}class ni extends h.Evented{constructor(t,n,a){super(),this.id=t,this.dispatcher=a,this.on("data",c=>{c.dataType==="source"&&c.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&c.dataType==="source"&&c.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=function(c,p,m,y){const _=new Yr[p.type](c,p,m,y);if(_.id!==c)throw new Error(`Expected Source id to be ${c} instead of ${_.id}`);return h.bindAll(["load","abort","unload","serialize","prepare"],_),_}(t,n,a,this),this._tiles={},this._cache=new xs(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new vs,this._didEmitContent=!1,this._updated=!1}onAdd(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._source&&this._source.onAdd&&this._source.onAdd(t)}onRemove(t){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(t)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!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(const t in this._tiles){const n=this._tiles[t];if(n.state!=="loaded"&&n.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(t,n){return this._source.loadTile(t,n)}_unloadTile(t){if(this._source.unloadTile)return this._source.unloadTile(t,()=>{})}_abortTile(t){this._source.abortTile&&this._source.abortTile(t,()=>{}),this._source.fire(new h.Event("dataabort",{tile:t,coord:t.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const n in this._tiles){const a=this._tiles[n];a.upload(t),a.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(t=>t.tileID).sort(Jr).map(t=>t.key)}getRenderableIds(t){const n=[];for(const a in this._tiles)this._isIdRenderable(a,t)&&n.push(this._tiles[a]);return t?n.sort((a,c)=>{const p=a.tileID,m=c.tileID,y=new h.Point(p.canonical.x,p.canonical.y)._rotate(this.transform.angle),_=new h.Point(m.canonical.x,m.canonical.y)._rotate(this.transform.angle);return p.overscaledZ-m.overscaledZ||_.y-y.y||_.x-y.x}).map(a=>a.tileID.key):n.map(a=>a.tileID).sort(Jr).map(a=>a.key)}hasRenderableParent(t){const n=this.findLoadedParent(t,0);return!!n&&this._isIdRenderable(n.tileID.key)}_isIdRenderable(t,n){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(n||!this._tiles[t].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const t in this._tiles)this._tiles[t].state!=="errored"&&this._reloadTile(t,"reloading")}}_reloadTile(t,n){const a=this._tiles[t];a&&(a.state!=="loading"&&(a.state=n),this._loadTile(a,this._tileLoaded.bind(this,a,t,n)))}_tileLoaded(t,n,a,c){if(c)return t.state="errored",void(c.status!==404?this._source.fire(new h.ErrorEvent(c,{tile:t})):this.update(this.transform,this.terrain));t.timeAdded=h.exported.now(),a==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(n,t),this.getSource().type==="raster-dem"&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new h.Event("data",{dataType:"source",tile:t,coord:t.tileID}))}_backfillDEM(t){const n=this.getRenderableIds();for(let c=0;c<n.length;c++){const p=n[c];if(t.neighboringTiles&&t.neighboringTiles[p]){const m=this.getTileByID(p);a(t,m),a(m,t)}}function a(c,p){c.needsHillshadePrepare=!0,c.needsTerrainPrepare=!0;let m=p.tileID.canonical.x-c.tileID.canonical.x;const y=p.tileID.canonical.y-c.tileID.canonical.y,_=Math.pow(2,c.tileID.canonical.z),v=p.tileID.key;m===0&&y===0||Math.abs(y)>1||(Math.abs(m)>1&&(Math.abs(m+_)===1?m+=_:Math.abs(m-_)===1&&(m-=_)),p.dem&&c.dem&&(c.dem.backfillBorder(p.dem,m,y),c.neighboringTiles&&c.neighboringTiles[v]&&(c.neighboringTiles[v].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,n,a,c){for(const p in this._tiles){let m=this._tiles[p];if(c[p]||!m.hasData()||m.tileID.overscaledZ<=n||m.tileID.overscaledZ>a)continue;let y=m.tileID;for(;m&&m.tileID.overscaledZ>n+1;){const v=m.tileID.scaledTo(m.tileID.overscaledZ-1);m=this._tiles[v.key],m&&m.hasData()&&(y=v)}let _=y;for(;_.overscaledZ>n;)if(_=_.scaledTo(_.overscaledZ-1),t[_.key]){c[y.key]=y;break}}}findLoadedParent(t,n){if(t.key in this._loadedParentTiles){const a=this._loadedParentTiles[t.key];return a&&a.tileID.overscaledZ>=n?a:null}for(let a=t.overscaledZ-1;a>=n;a--){const c=t.scaledTo(a),p=this._getLoadedTile(c);if(p)return p}}_getLoadedTile(t){const n=this._tiles[t.key];return n&&n.hasData()?n:this._cache.getByKey(t.wrapped().key)}updateCacheSize(t){const n=Math.ceil(t.width/this._source.tileSize)+1,a=Math.ceil(t.height/this._source.tileSize)+1,c=Math.floor(n*a*5),p=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,c):c;this._cache.setMaxSize(p)}handleWrapJump(t){const n=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);if(this._prevLng=t,n){const a={};for(const c in this._tiles){const p=this._tiles[c];p.tileID=p.tileID.unwrapTo(p.tileID.wrap+n),a[p.tileID.key]=p}this._tiles=a;for(const c in this._timers)clearTimeout(this._timers[c]),delete this._timers[c];for(const c in this._tiles)this._setTileReloadTimer(c,this._tiles[c])}}update(t,n){if(this.transform=t,this.terrain=n,!this._sourceLoaded||this._paused)return;let a;this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?a=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(S=>new h.OverscaledTileID(S.canonical.z,S.wrap,S.canonical.z,S.canonical.x,S.canonical.y)):(a=t.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:n}),this._source.hasTile&&(a=a.filter(S=>this._source.hasTile(S)))):a=[];const c=t.coveringZoomLevel(this._source),p=Math.max(c-ni.maxOverzooming,this._source.minzoom),m=Math.max(c+ni.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const S={};for(const T of a)if(T.canonical.z>this._source.minzoom){const z=T.scaledTo(T.canonical.z-1);S[z.key]=z;const U=T.scaledTo(Math.max(this._source.minzoom,Math.min(T.canonical.z,5)));S[U.key]=U}a=a.concat(Object.values(S))}const y=a.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,y&&this.fire(new h.Event("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const _=this._updateRetainedTiles(a,c);if(jn(this._source.type)){const S={},T={},z=Object.keys(_),U=h.exported.now();for(const R of z){const F=_[R],j=this._tiles[R];if(!j||j.fadeEndTime!==0&&j.fadeEndTime<=U)continue;const X=this.findLoadedParent(F,p);X&&(this._addTile(X.tileID),S[X.tileID.key]=X.tileID),T[R]=F}this._retainLoadedChildren(T,c,m,_);for(const R in S)_[R]||(this._coveredTiles[R]=!0,_[R]=S[R]);if(n){const R={},F={};for(const j of a)this._tiles[j.key].hasData()?R[j.key]=j:F[j.key]=j;for(const j in F){const X=F[j].children(this._source.maxzoom);this._tiles[X[0].key]&&this._tiles[X[1].key]&&this._tiles[X[2].key]&&this._tiles[X[3].key]&&(R[X[0].key]=_[X[0].key]=X[0],R[X[1].key]=_[X[1].key]=X[1],R[X[2].key]=_[X[2].key]=X[2],R[X[3].key]=_[X[3].key]=X[3],delete F[j])}for(const j in F){const X=this.findLoadedParent(F[j],this._source.minzoom);if(X){R[X.tileID.key]=_[X.tileID.key]=X.tileID;for(const ne in R)R[ne].isChildOf(X.tileID)&&delete R[ne]}}for(const j in this._tiles)R[j]||(this._coveredTiles[j]=!0)}}for(const S in _)this._tiles[S].clearFadeHold();const v=h.keysDifference(this._tiles,_);for(const S of v){const T=this._tiles[S];T.hasSymbolBuckets&&!T.holdingForFade()?T.setHoldDuration(this.map._fadeDuration):T.hasSymbolBuckets&&!T.symbolFadeFinished()||this._removeTile(S)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)}_updateRetainedTiles(t,n){const a={},c={},p=Math.max(n-ni.maxOverzooming,this._source.minzoom),m=Math.max(n+ni.maxUnderzooming,this._source.minzoom),y={};for(const _ of t){const v=this._addTile(_);a[_.key]=_,v.hasData()||n<this._source.maxzoom&&(y[_.key]=_)}this._retainLoadedChildren(y,n,m,a);for(const _ of t){let v=this._tiles[_.key];if(v.hasData())continue;if(n+1>this._source.maxzoom){const T=_.children(this._source.maxzoom)[0],z=this.getTile(T);if(z&&z.hasData()){a[T.key]=T;continue}}else{const T=_.children(this._source.maxzoom);if(a[T[0].key]&&a[T[1].key]&&a[T[2].key]&&a[T[3].key])continue}let S=v.wasRequested();for(let T=_.overscaledZ-1;T>=p;--T){const z=_.scaledTo(T);if(c[z.key])break;if(c[z.key]=!0,v=this.getTile(z),!v&&S&&(v=this._addTile(z)),v){const U=v.hasData();if((S||U)&&(a[z.key]=z),S=v.wasRequested(),U)break}}}return a}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const n=[];let a,c=this._tiles[t].tileID;for(;c.overscaledZ>0;){if(c.key in this._loadedParentTiles){a=this._loadedParentTiles[c.key];break}n.push(c.key);const p=c.scaledTo(c.overscaledZ-1);if(a=this._getLoadedTile(p),a)break;c=p}for(const p of n)this._loadedParentTiles[p]=a}}_addTile(t){let n=this._tiles[t.key];if(n)return n;n=this._cache.getAndRemove(t),n&&(this._setTileReloadTimer(t.key,n),n.tileID=t,this._state.initializeTileState(n,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,n)));const a=n;return n||(n=new $n(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(n,this._tileLoaded.bind(this,n,t.key,n.state))),n.uses++,this._tiles[t.key]=n,a||this._source.fire(new h.Event("dataloading",{tile:n,coord:n.tileID,dataType:"source"})),n}_setTileReloadTimer(t,n){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const a=n.getExpiryTimeout();a&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},a))}_removeTile(t){const n=this._tiles[t];n&&(n.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),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))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(t);this._cache.reset()}tilesIn(t,n,a){const c=[],p=this.transform;if(!p)return c;const m=a?p.getCameraQueryGeometry(t):t,y=t.map(R=>p.pointCoordinate(R,this.terrain)),_=m.map(R=>p.pointCoordinate(R,this.terrain)),v=this.getIds();let S=1/0,T=1/0,z=-1/0,U=-1/0;for(const R of _)S=Math.min(S,R.x),T=Math.min(T,R.y),z=Math.max(z,R.x),U=Math.max(U,R.y);for(let R=0;R<v.length;R++){const F=this._tiles[v[R]];if(F.holdingForFade())continue;const j=F.tileID,X=Math.pow(2,p.zoom-F.tileID.overscaledZ),ne=n*F.queryPadding*h.EXTENT/F.tileSize/X,V=[j.getTilePoint(new h.MercatorCoordinate(S,T)),j.getTilePoint(new h.MercatorCoordinate(z,U))];if(V[0].x-ne<h.EXTENT&&V[0].y-ne<h.EXTENT&&V[1].x+ne>=0&&V[1].y+ne>=0){const ie=y.map(fe=>j.getTilePoint(fe)),ae=_.map(fe=>j.getTilePoint(fe));c.push({tile:F,tileID:j,queryGeometry:ie,cameraQueryGeometry:ae,scale:X})}}return c}getVisibleCoordinates(t){const n=this.getRenderableIds(t).map(a=>this._tiles[a].tileID);for(const a of n)a.posMatrix=this.transform.calculatePosMatrix(a.toUnwrapped());return n}hasTransition(){if(this._source.hasTransition())return!0;if(jn(this._source.type)){const t=h.exported.now();for(const n in this._tiles)if(this._tiles[n].fadeEndTime>=t)return!0}return!1}setFeatureState(t,n,a){this._state.updateState(t=t||"_geojsonTileLayer",n,a)}removeFeatureState(t,n,a){this._state.removeFeatureState(t=t||"_geojsonTileLayer",n,a)}getFeatureState(t,n){return this._state.getState(t=t||"_geojsonTileLayer",n)}setDependencies(t,n,a){const c=this._tiles[t];c&&c.setDependencies(n,a)}reloadTilesForDependencies(t,n){for(const a in this._tiles)this._tiles[a].hasDependency(t,n)&&this._reloadTile(a,"reloading");this._cache.filter(a=>!a.hasDependency(t,n))}}function Jr(o,t){const n=Math.abs(2*o.wrap)-+(o.wrap<0),a=Math.abs(2*t.wrap)-+(t.wrap<0);return o.overscaledZ-t.overscaledZ||a-n||t.canonical.y-o.canonical.y||t.canonical.x-o.canonical.x}function jn(o){return o==="raster"||o==="image"||o==="video"}ni.maxOverzooming=10,ni.maxUnderzooming=3;const Ie="mapboxgl_preloaded_worker_pool";class Si{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<Si.workerCount;)this.workers.push(new Worker(h.config.WORKER_URL));return this.active[t]=!0,this.workers.slice()}release(t){delete this.active[t],this.numActive()===0&&(this.workers.forEach(n=>{n.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Ie]}numActive(){return Object.keys(this.active).length}}const Ei=Math.floor(h.exported.hardwareConcurrency/2);let dr;function Er(){return dr||(dr=new Si),dr}Si.workerCount=h.isSafari(globalThis)?Math.max(Math.min(Ei,3),1):1;class Se{constructor(t,n){this.reset(t,n)}reset(t,n){this.points=t||[],this._distances=[0];for(let a=1;a<this.points.length;a++)this._distances[a]=this._distances[a-1]+this.points[a].dist(this.points[a-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(t){if(this.points.length===1)return this.points[0];t=h.clamp(t,0,1);let n=1,a=this._distances[n];const c=t*this.paddedLength+this.padding;for(;a<c&&n<this._distances.length;)a=this._distances[++n];const p=n-1,m=this._distances[p],y=a-m,_=y>0?(c-m)/y:0;return this.points[p].mult(1-_).add(this.points[n].mult(_))}}function it(o,t){let n=!0;return o==="always"||o!=="never"&&t!=="never"||(n=!1),n}class Je{constructor(t,n,a){const c=this.boxCells=[],p=this.circleCells=[];this.xCellCount=Math.ceil(t/a),this.yCellCount=Math.ceil(n/a);for(let m=0;m<this.xCellCount*this.yCellCount;m++)c.push([]),p.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=n,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/n,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(t,n,a,c,p){this._forEachCell(n,a,c,p,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(n),this.bboxes.push(a),this.bboxes.push(c),this.bboxes.push(p)}insertCircle(t,n,a,c){this._forEachCell(n-c,a-c,n+c,a+c,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(n),this.circles.push(a),this.circles.push(c)}_insertBoxCell(t,n,a,c,p,m){this.boxCells[p].push(m)}_insertCircleCell(t,n,a,c,p,m){this.circleCells[p].push(m)}_query(t,n,a,c,p,m,y){if(a<0||t>this.width||c<0||n>this.height)return[];const _=[];if(t<=0&&n<=0&&this.width<=a&&this.height<=c){if(p)return[{key:null,x1:t,y1:n,x2:a,y2:c}];for(let v=0;v<this.boxKeys.length;v++)_.push({key:this.boxKeys[v],x1:this.bboxes[4*v],y1:this.bboxes[4*v+1],x2:this.bboxes[4*v+2],y2:this.bboxes[4*v+3]});for(let v=0;v<this.circleKeys.length;v++){const S=this.circles[3*v],T=this.circles[3*v+1],z=this.circles[3*v+2];_.push({key:this.circleKeys[v],x1:S-z,y1:T-z,x2:S+z,y2:T+z})}}else this._forEachCell(t,n,a,c,this._queryCell,_,{hitTest:p,overlapMode:m,seenUids:{box:{},circle:{}}},y);return _}query(t,n,a,c){return this._query(t,n,a,c,!1,null)}hitTest(t,n,a,c,p,m){return this._query(t,n,a,c,!0,p,m).length>0}hitTestCircle(t,n,a,c,p){const m=t-a,y=t+a,_=n-a,v=n+a;if(y<0||m>this.width||v<0||_>this.height)return!1;const S=[];return this._forEachCell(m,_,y,v,this._queryCellCircle,S,{hitTest:!0,overlapMode:c,circle:{x:t,y:n,radius:a},seenUids:{box:{},circle:{}}},p),S.length>0}_queryCell(t,n,a,c,p,m,y,_){const{seenUids:v,hitTest:S,overlapMode:T}=y,z=this.boxCells[p];if(z!==null){const R=this.bboxes;for(const F of z)if(!v.box[F]){v.box[F]=!0;const j=4*F,X=this.boxKeys[F];if(t<=R[j+2]&&n<=R[j+3]&&a>=R[j+0]&&c>=R[j+1]&&(!_||_(X))&&(!S||!it(T,X.overlapMode))&&(m.push({key:X,x1:R[j],y1:R[j+1],x2:R[j+2],y2:R[j+3]}),S))return!0}}const U=this.circleCells[p];if(U!==null){const R=this.circles;for(const F of U)if(!v.circle[F]){v.circle[F]=!0;const j=3*F,X=this.circleKeys[F];if(this._circleAndRectCollide(R[j],R[j+1],R[j+2],t,n,a,c)&&(!_||_(X))&&(!S||!it(T,X.overlapMode))){const ne=R[j],V=R[j+1],ie=R[j+2];if(m.push({key:X,x1:ne-ie,y1:V-ie,x2:ne+ie,y2:V+ie}),S)return!0}}}return!1}_queryCellCircle(t,n,a,c,p,m,y,_){const{circle:v,seenUids:S,overlapMode:T}=y,z=this.boxCells[p];if(z!==null){const R=this.bboxes;for(const F of z)if(!S.box[F]){S.box[F]=!0;const j=4*F,X=this.boxKeys[F];if(this._circleAndRectCollide(v.x,v.y,v.radius,R[j+0],R[j+1],R[j+2],R[j+3])&&(!_||_(X))&&!it(T,X.overlapMode))return m.push(!0),!0}}const U=this.circleCells[p];if(U!==null){const R=this.circles;for(const F of U)if(!S.circle[F]){S.circle[F]=!0;const j=3*F,X=this.circleKeys[F];if(this._circlesCollide(R[j],R[j+1],R[j+2],v.x,v.y,v.radius)&&(!_||_(X))&&!it(T,X.overlapMode))return m.push(!0),!0}}}_forEachCell(t,n,a,c,p,m,y,_){const v=this._convertToXCellCoord(t),S=this._convertToYCellCoord(n),T=this._convertToXCellCoord(a),z=this._convertToYCellCoord(c);for(let U=v;U<=T;U++)for(let R=S;R<=z;R++)if(p.call(this,t,n,a,c,this.xCellCount*R+U,m,y,_))return}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,n,a,c,p,m){const y=c-t,_=p-n,v=a+m;return v*v>y*y+_*_}_circleAndRectCollide(t,n,a,c,p,m,y){const _=(m-c)/2,v=Math.abs(t-(c+_));if(v>_+a)return!1;const S=(y-p)/2,T=Math.abs(n-(p+S));if(T>S+a)return!1;if(v<=_||T<=S)return!0;const z=v-_,U=T-S;return z*z+U*U<=a*a}}function Jt(o,t,n,a,c){const p=h.create();return t?(h.scale(p,p,[1/c,1/c,1]),n||h.rotateZ(p,p,a.angle)):h.multiply(p,a.labelPlaneMatrix,o),p}function er(o,t,n,a,c){if(t){const p=h.clone(o);return h.scale(p,p,[c,c,1]),n||h.rotateZ(p,p,-a.angle),p}return a.glCoordMatrix}function qe(o,t,n){let a;n?(a=[o.x,o.y,n(o.x,o.y),1],h.transformMat4(a,a,t)):(a=[o.x,o.y,0,1],G(a,a,t));const c=a[3];return{point:new h.Point(a[0]/c,a[1]/c),signedDistanceFromCamera:c}}function Ir(o,t){return .5+o/t*.5}function Nr(o,t){const n=o[0]/o[3],a=o[1]/o[3];return n>=-t[0]&&n<=t[0]&&a>=-t[1]&&a<=t[1]}function bn(o,t,n,a,c,p,m,y,_,v){const S=a?o.textSizeData:o.iconSizeData,T=h.evaluateSizeForZoom(S,n.transform.zoom),z=[256/n.width*2+1,256/n.height*2+1],U=a?o.text.dynamicLayoutVertexArray:o.icon.dynamicLayoutVertexArray;U.clear();const R=o.lineVertexArray,F=a?o.text.placedSymbolArray:o.icon.placedSymbolArray,j=n.transform.width/n.transform.height;let X=!1;for(let ne=0;ne<F.length;ne++){const V=F.get(ne);if(V.hidden||V.writingMode===h.WritingMode.vertical&&!X){H(V.numGlyphs,U);continue}let ie;if(X=!1,v?(ie=[V.anchorX,V.anchorY,v(V.anchorX,V.anchorY),1],h.transformMat4(ie,ie,t)):(ie=[V.anchorX,V.anchorY,0,1],G(ie,ie,t)),!Nr(ie,z)){H(V.numGlyphs,U);continue}const ae=Ir(n.transform.cameraToCenterDistance,ie[3]),fe=h.evaluateSizeForFeature(S,T,V),_e=m?fe/ae:fe*ae,xe=new h.Point(V.anchorX,V.anchorY),ge=qe(xe,c,v).point,ke={projections:{},offsets:{}},$e=B(V,_e,!1,y,t,c,p,o.glyphOffsetArray,R,U,ge,xe,ke,j,_,v);X=$e.useVertical,($e.notEnoughRoom||X||$e.needsFlipping&&B(V,_e,!0,y,t,c,p,o.glyphOffsetArray,R,U,ge,xe,ke,j,_,v).notEnoughRoom)&&H(V.numGlyphs,U)}a?o.text.dynamicLayoutVertexBuffer.updateData(U):o.icon.dynamicLayoutVertexBuffer.updateData(U)}function Vr(o,t,n,a,c,p,m,y,_,v,S,T,z){const U=y.glyphStartIndex+y.numGlyphs,R=y.lineStartIndex,F=y.lineStartIndex+y.lineLength,j=t.getoffsetX(y.glyphStartIndex),X=t.getoffsetX(U-1),ne=q(o*j,n,a,c,p,m,y.segment,R,F,_,v,S,T,z);if(!ne)return null;const V=q(o*X,n,a,c,p,m,y.segment,R,F,_,v,S,T,z);return V?{first:ne,last:V}:null}function si(o,t,n,a){return o===h.WritingMode.horizontal&&Math.abs(n.y-t.y)>Math.abs(n.x-t.x)*a?{useVertical:!0}:(o===h.WritingMode.vertical?t.y<n.y:t.x>n.x)?{needsFlipping:!0}:null}function B(o,t,n,a,c,p,m,y,_,v,S,T,z,U,R,F){const j=t/24,X=o.lineOffsetX*j,ne=o.lineOffsetY*j;let V;if(o.numGlyphs>1){const ie=o.glyphStartIndex+o.numGlyphs,ae=o.lineStartIndex,fe=o.lineStartIndex+o.lineLength,_e=Vr(j,y,X,ne,n,S,T,o,_,p,z,R,F);if(!_e)return{notEnoughRoom:!0};const xe=qe(_e.first.point,m,F).point,ge=qe(_e.last.point,m,F).point;if(a&&!n){const ke=si(o.writingMode,xe,ge,U);if(ke)return ke}V=[_e.first];for(let ke=o.glyphStartIndex+1;ke<ie-1;ke++)V.push(q(j*y.getoffsetX(ke),X,ne,n,S,T,o.segment,ae,fe,_,p,z,R,F));V.push(_e.last)}else{if(a&&!n){const ae=qe(T,c,F).point,fe=o.lineStartIndex+o.segment+1,_e=new h.Point(_.getx(fe),_.gety(fe)),xe=qe(_e,c,F),ge=xe.signedDistanceFromCamera>0?xe.point:I(T,_e,ae,1,c,F),ke=si(o.writingMode,ae,ge,U);if(ke)return ke}const ie=q(j*y.getoffsetX(o.glyphStartIndex),X,ne,n,S,T,o.segment,o.lineStartIndex,o.lineStartIndex+o.lineLength,_,p,z,R,F);if(!ie)return{notEnoughRoom:!0};V=[ie]}for(const ie of V)h.addDynamicAttributes(v,ie.point,ie.angle);return{}}function I(o,t,n,a,c,p){const m=qe(o.add(o.sub(t)._unit()),c,p).point,y=n.sub(m);return n.add(y._mult(a/y.mag()))}function P(o,t){const{projectionCache:n,lineVertexArray:a,labelPlaneMatrix:c,tileAnchorPoint:p,distanceFromAnchor:m,getElevation:y,previousVertex:_,direction:v,absOffsetX:S}=t;if(n.projections[o])return n.projections[o];const T=new h.Point(a.getx(o),a.gety(o)),z=qe(T,c,y);if(z.signedDistanceFromCamera>0)return n.projections[o]=z.point,z.point;const U=o-v;return I(m===0?p:new h.Point(a.getx(U),a.gety(U)),T,_,S-m+1,c,y)}function D(o,t,n){return o._unit()._perp()._mult(t*n)}function $(o,t,n,a,c,p,m,y){const{projectionCache:_,direction:v}=y;if(_.offsets[o])return _.offsets[o];const S=n.add(t);if(o+v<a||o+v>=c)return _.offsets[o]=S,S;const T=P(o+v,y),z=D(T.sub(n),m,v),U=n.add(z),R=T.add(z);return _.offsets[o]=h.findLineIntersection(p,S,U,R)||S,_.offsets[o]}function q(o,t,n,a,c,p,m,y,_,v,S,T,z,U){const R=a?o-t:o+t;let F=R>0?1:-1,j=0;a&&(F*=-1,j=Math.PI),F<0&&(j+=Math.PI);let X,ne,V=F>0?y+m:y+m+1,ie=c,ae=c,fe=0,_e=0;const xe=Math.abs(R),ge=[];let ke;for(;fe+_e<=xe;){if(V+=F,V<y||V>=_)return null;fe+=_e,ae=ie,ne=X;const we={projectionCache:T,lineVertexArray:v,labelPlaneMatrix:S,tileAnchorPoint:p,distanceFromAnchor:fe,getElevation:U,previousVertex:ae,direction:F,absOffsetX:xe};if(ie=P(V,we),n===0)ge.push(ae),ke=ie.sub(ae);else{let Xe;const ze=ie.sub(ae);Xe=ze.mag()===0?D(P(V+F,we).sub(ie),n,F):D(ze,n,F),ne||(ne=ae.add(Xe)),X=$(V,Xe,ie,y,_,ne,n,we),ge.push(ne),ke=X.sub(ne)}_e=ke.mag()}const $e=ke._mult((xe-fe)/_e)._add(ne||ae),Ye=j+Math.atan2(ie.y-ae.y,ie.x-ae.x);return ge.push($e),{point:$e,angle:z?Ye:0,path:ge}}const Y=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function H(o,t){for(let n=0;n<o;n++){const a=t.length;t.resize(a+4),t.float32.set(Y,3*a)}}function G(o,t,n){const a=t[0],c=t[1];return o[0]=n[0]*a+n[4]*c+n[12],o[1]=n[1]*a+n[5]*c+n[13],o[3]=n[3]*a+n[7]*c+n[15],o}const J=100;class de{constructor(t,n=new Je(t.width+200,t.height+200,25),a=new Je(t.width+200,t.height+200,25)){this.transform=t,this.grid=n,this.ignoredGrid=a,this.pitchfactor=Math.cos(t._pitch)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+J,this.screenBottomBoundary=t.height+J,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(t,n,a,c,p,m){const y=this.projectAndGetPerspectiveRatio(c,t.anchorPointX,t.anchorPointY,m),_=a*y.perspectiveRatio,v=t.x1*_+y.point.x,S=t.y1*_+y.point.y,T=t.x2*_+y.point.x,z=t.y2*_+y.point.y;return!this.isInsideGrid(v,S,T,z)||n!=="always"&&this.grid.hitTest(v,S,T,z,n,p)||y.perspectiveRatio<this.perspectiveRatioCutoff?{box:[],offscreen:!1}:{box:[v,S,T,z],offscreen:this.isOffscreen(v,S,T,z)}}placeCollisionCircles(t,n,a,c,p,m,y,_,v,S,T,z,U,R){const F=[],j=new h.Point(n.anchorX,n.anchorY),X=qe(j,m,R),ne=Ir(this.transform.cameraToCenterDistance,X.signedDistanceFromCamera),V=(S?p/ne:p*ne)/h.ONE_EM,ie=qe(j,y,R).point,ae=Vr(V,c,n.lineOffsetX*V,n.lineOffsetY*V,!1,ie,j,n,a,y,{projections:{},offsets:{}},!1,R);let fe=!1,_e=!1,xe=!0;if(ae){const ge=.5*z*ne+U,ke=new h.Point(-100,-100),$e=new h.Point(this.screenRightBoundary,this.screenBottomBoundary),Ye=new Se,we=ae.first,Xe=ae.last;let ze=[];for(let ut=we.path.length-1;ut>=1;ut--)ze.push(we.path[ut]);for(let ut=1;ut<Xe.path.length;ut++)ze.push(Xe.path[ut]);const ht=2.5*ge;if(_){const ut=ze.map(et=>qe(et,_,R));ze=ut.some(et=>et.signedDistanceFromCamera<=0)?[]:ut.map(et=>et.point)}let Vt=[];if(ze.length>0){const ut=ze[0].clone(),et=ze[0].clone();for(let Ft=1;Ft<ze.length;Ft++)ut.x=Math.min(ut.x,ze[Ft].x),ut.y=Math.min(ut.y,ze[Ft].y),et.x=Math.max(et.x,ze[Ft].x),et.y=Math.max(et.y,ze[Ft].y);Vt=ut.x>=ke.x&&et.x<=$e.x&&ut.y>=ke.y&&et.y<=$e.y?[ze]:et.x<ke.x||ut.x>$e.x||et.y<ke.y||ut.y>$e.y?[]:h.clipLine([ze],ke.x,ke.y,$e.x,$e.y)}for(const ut of Vt){Ye.reset(ut,.25*ge);let et=0;et=Ye.length<=.5*ge?1:Math.ceil(Ye.paddedLength/ht)+1;for(let Ft=0;Ft<et;Ft++){const yi=Ft/Math.max(et-1,1),$t=Ye.lerp(yi),ei=$t.x+J,Fi=$t.y+J;F.push(ei,Fi,ge,0);const ir=ei-ge,rr=Fi-ge,xi=ei+ge,xr=Fi+ge;if(xe=xe&&this.isOffscreen(ir,rr,xi,xr),_e=_e||this.isInsideGrid(ir,rr,xi,xr),t!=="always"&&this.grid.hitTestCircle(ei,Fi,ge,t,T)&&(fe=!0,!v))return{circles:[],offscreen:!1,collisionDetected:fe}}}}return{circles:!v&&fe||!_e||ne<this.perspectiveRatioCutoff?[]:F,offscreen:xe,collisionDetected:fe}}queryRenderedSymbols(t){if(t.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const n=[];let a=1/0,c=1/0,p=-1/0,m=-1/0;for(const S of t){const T=new h.Point(S.x+J,S.y+J);a=Math.min(a,T.x),c=Math.min(c,T.y),p=Math.max(p,T.x),m=Math.max(m,T.y),n.push(T)}const y=this.grid.query(a,c,p,m).concat(this.ignoredGrid.query(a,c,p,m)),_={},v={};for(const S of y){const T=S.key;if(_[T.bucketInstanceId]===void 0&&(_[T.bucketInstanceId]={}),_[T.bucketInstanceId][T.featureIndex])continue;const z=[new h.Point(S.x1,S.y1),new h.Point(S.x2,S.y1),new h.Point(S.x2,S.y2),new h.Point(S.x1,S.y2)];h.polygonIntersectsPolygon(n,z)&&(_[T.bucketInstanceId][T.featureIndex]=!0,v[T.bucketInstanceId]===void 0&&(v[T.bucketInstanceId]=[]),v[T.bucketInstanceId].push(T.featureIndex))}return v}insertCollisionBox(t,n,a,c,p,m){(a?this.ignoredGrid:this.grid).insert({bucketInstanceId:c,featureIndex:p,collisionGroupID:m,overlapMode:n},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,n,a,c,p,m){const y=a?this.ignoredGrid:this.grid,_={bucketInstanceId:c,featureIndex:p,collisionGroupID:m,overlapMode:n};for(let v=0;v<t.length;v+=4)y.insertCircle(_,t[v],t[v+1],t[v+2])}projectAndGetPerspectiveRatio(t,n,a,c){let p;return c?(p=[n,a,c(n,a),1],h.transformMat4(p,p,t)):(p=[n,a,0,1],G(p,p,t)),{point:new h.Point((p[0]/p[3]+1)/2*this.transform.width+J,(-p[1]/p[3]+1)/2*this.transform.height+J),perspectiveRatio:.5+this.transform.cameraToCenterDistance/p[3]*.5}}isOffscreen(t,n,a,c){return a<J||t>=this.screenRightBoundary||c<J||n>this.screenBottomBoundary}isInsideGrid(t,n,a,c){return a>=0&&t<this.gridRightBoundary&&c>=0&&n<this.gridBottomBoundary}getViewportMatrix(){const t=h.identity([]);return h.translate(t,t,[-100,-100,0]),t}}function ce(o,t,n){return t*(h.EXTENT/(o.tileSize*Math.pow(2,n-o.tileID.overscaledZ)))}class pe{constructor(t,n,a,c){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?n:-n))):c&&a?1:0,this.placed=a}isHidden(){return this.opacity===0&&!this.placed}}class Ne{constructor(t,n,a,c,p){this.text=new pe(t?t.text:null,n,a,p),this.icon=new pe(t?t.icon:null,n,c,p)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Ke{constructor(t,n,a){this.text=t,this.icon=n,this.skipFade=a}}class Be{constructor(){this.invProjMatrix=h.create(),this.viewportMatrix=h.create(),this.circles=[]}}class Ve{constructor(t,n,a,c,p){this.bucketInstanceId=t,this.featureIndex=n,this.sourceLayerIndex=a,this.bucketIndex=c,this.tileID=p}}class Qe{constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}get(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){const n=++this.maxGroupID;this.collisionGroups[t]={ID:n,predicate:a=>a.collisionGroupID===n}}return this.collisionGroups[t]}}function ot(o,t,n,a,c){const{horizontalAlign:p,verticalAlign:m}=h.getAnchorAlignment(o),y=-(p-.5)*t,_=-(m-.5)*n,v=h.evaluateVariableOffset(o,a);return new h.Point(y+v[0]*c,_+v[1]*c)}function tt(o,t,n,a,c,p){const{x1:m,x2:y,y1:_,y2:v,anchorPointX:S,anchorPointY:T}=o,z=new h.Point(t,n);return a&&z._rotate(c?p:-p),{x1:m+z.x,y1:_+z.y,x2:y+z.x,y2:v+z.y,anchorPointX:S,anchorPointY:T}}class ft{constructor(t,n,a,c,p){this.transform=t.clone(),this.terrain=n,this.collisionIndex=new de(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=a,this.retainedQueryData={},this.collisionGroups=new Qe(c),this.collisionCircleArrays={},this.prevPlacement=p,p&&(p.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(t,n,a,c){const p=a.getBucket(n),m=a.latestFeatureIndex;if(!p||!m||n.id!==p.layerIds[0])return;const y=a.collisionBoxArray,_=p.layers[0].layout,v=Math.pow(2,this.transform.zoom-a.tileID.overscaledZ),S=a.tileSize/h.EXTENT,T=this.transform.calculatePosMatrix(a.tileID.toUnwrapped()),z=_.get("text-pitch-alignment")==="map",U=_.get("text-rotation-alignment")==="map",R=ce(a,1,this.transform.zoom),F=Jt(T,z,U,this.transform,R);let j=null;if(z){const ne=er(T,z,U,this.transform,R);j=h.multiply([],this.transform.labelPlaneMatrix,ne)}this.retainedQueryData[p.bucketInstanceId]=new Ve(p.bucketInstanceId,m,p.sourceLayerIndex,p.index,a.tileID);const X={bucket:p,layout:_,posMatrix:T,textLabelPlaneMatrix:F,labelToScreenMatrix:j,scale:v,textPixelRatio:S,holdingForFade:a.holdingForFade(),collisionBoxArray:y,partiallyEvaluatedTextSize:h.evaluateSizeForZoom(p.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(p.sourceID)};if(c)for(const ne of p.sortKeyRanges){const{sortKey:V,symbolInstanceStart:ie,symbolInstanceEnd:ae}=ne;t.push({sortKey:V,symbolInstanceStart:ie,symbolInstanceEnd:ae,parameters:X})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:p.symbolInstances.length,parameters:X})}attemptAnchorPlacement(t,n,a,c,p,m,y,_,v,S,T,z,U,R,F,j){const X=[z.textOffset0,z.textOffset1],ne=ot(t,a,c,X,p),V=this.collisionIndex.placeCollisionBox(tt(n,ne.x,ne.y,m,y,this.transform.angle),T,_,v,S.predicate,j);if((!F||this.collisionIndex.placeCollisionBox(tt(F,ne.x,ne.y,m,y,this.transform.angle),T,_,v,S.predicate,j).box.length!==0)&&V.box.length>0){let ie;if(this.prevPlacement&&this.prevPlacement.variableOffsets[z.crossTileID]&&this.prevPlacement.placements[z.crossTileID]&&this.prevPlacement.placements[z.crossTileID].text&&(ie=this.prevPlacement.variableOffsets[z.crossTileID].anchor),z.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[z.crossTileID]={textOffset:X,width:a,height:c,anchor:t,textBoxScale:p,prevAnchor:ie},this.markUsedJustification(U,t,z,R),U.allowVerticalPlacement&&(this.markUsedOrientation(U,R,z),this.placedOrientations[z.crossTileID]=R),{shift:ne,placedGlyphBoxes:V}}}placeLayerBucketPart(t,n,a){const{bucket:c,layout:p,posMatrix:m,textLabelPlaneMatrix:y,labelToScreenMatrix:_,textPixelRatio:v,holdingForFade:S,collisionBoxArray:T,partiallyEvaluatedTextSize:z,collisionGroup:U}=t.parameters,R=p.get("text-optional"),F=p.get("icon-optional"),j=h.getOverlapMode(p,"text-overlap","text-allow-overlap"),X=j==="always",ne=h.getOverlapMode(p,"icon-overlap","icon-allow-overlap"),V=ne==="always",ie=p.get("text-rotation-alignment")==="map",ae=p.get("text-pitch-alignment")==="map",fe=p.get("icon-text-fit")!=="none",_e=p.get("symbol-z-order")==="viewport-y",xe=X&&(V||!c.hasIconData()||F),ge=V&&(X||!c.hasTextData()||R);!c.collisionArrays&&T&&c.deserializeCollisionBoxes(T);const ke=this.retainedQueryData[c.bucketInstanceId].tileID,$e=this.terrain?(we,Xe)=>this.terrain.getElevation(ke,we,Xe):null,Ye=(we,Xe)=>{if(n[we.crossTileID])return;if(S)return void(this.placements[we.crossTileID]=new Ke(!1,!1,!1));let ze=!1,ht=!1,Vt=!0,ut=null,et={box:null,offscreen:null},Ft={box:null,offscreen:null},yi=null,$t=null,ei=null,Fi=0,ir=0,rr=0;Xe.textFeatureIndex?Fi=Xe.textFeatureIndex:we.useRuntimeCollisionCircles&&(Fi=we.featureIndex),Xe.verticalTextFeatureIndex&&(ir=Xe.verticalTextFeatureIndex);const xi=Xe.textBox;if(xi){const ci=dt=>{let Ht=h.WritingMode.horizontal;if(c.allowVerticalPlacement&&!dt&&this.prevPlacement){const ii=this.prevPlacement.placedOrientations[we.crossTileID];ii&&(this.placedOrientations[we.crossTileID]=ii,Ht=ii,this.markUsedOrientation(c,Ht,we))}return Ht},ti=(dt,Ht)=>{if(c.allowVerticalPlacement&&we.numVerticalGlyphVertices>0&&Xe.verticalTextBox){for(const ii of c.writingModes)if(ii===h.WritingMode.vertical?(et=Ht(),Ft=et):et=dt(),et&&et.box&&et.box.length)break}else et=dt()};if(p.get("text-variable-anchor")){let dt=p.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[we.crossTileID]){const mt=this.prevPlacement.variableOffsets[we.crossTileID];dt.indexOf(mt.anchor)>0&&(dt=dt.filter(Kt=>Kt!==mt.anchor),dt.unshift(mt.anchor))}const Ht=(mt,Kt,Oi)=>{const na=mt.x2-mt.x1,Pr=mt.y2-mt.y1,mc=we.textBoxScale,ml=fe&&ne==="never"?Kt:null;let Pt={box:[],offscreen:!1};const no=j!=="never"?2*dt.length:dt.length;for(let ds=0;ds<no;++ds){const Mr=this.attemptAnchorPlacement(dt[ds%dt.length],mt,na,Pr,mc,ie,ae,v,m,U,ds>=dt.length?j:"never",we,c,Oi,ml,$e);if(Mr&&(Pt=Mr.placedGlyphBoxes,Pt&&Pt.box&&Pt.box.length)){ze=!0,ut=Mr.shift;break}}return Pt};ti(()=>Ht(xi,Xe.iconBox,h.WritingMode.horizontal),()=>{const mt=Xe.verticalTextBox;return c.allowVerticalPlacement&&!(et&&et.box&&et.box.length)&&we.numVerticalGlyphVertices>0&&mt?Ht(mt,Xe.verticalIconBox,h.WritingMode.vertical):{box:null,offscreen:null}}),et&&(ze=et.box,Vt=et.offscreen);const ii=ci(et&&et.box);if(!ze&&this.prevPlacement){const mt=this.prevPlacement.variableOffsets[we.crossTileID];mt&&(this.variableOffsets[we.crossTileID]=mt,this.markUsedJustification(c,mt.anchor,we,ii))}}else{const dt=(Ht,ii)=>{const mt=this.collisionIndex.placeCollisionBox(Ht,j,v,m,U.predicate,$e);return mt&&mt.box&&mt.box.length&&(this.markUsedOrientation(c,ii,we),this.placedOrientations[we.crossTileID]=ii),mt};ti(()=>dt(xi,h.WritingMode.horizontal),()=>{const Ht=Xe.verticalTextBox;return c.allowVerticalPlacement&&we.numVerticalGlyphVertices>0&&Ht?dt(Ht,h.WritingMode.vertical):{box:null,offscreen:null}}),ci(et&&et.box&&et.box.length)}}if(yi=et,ze=yi&&yi.box&&yi.box.length>0,Vt=yi&&yi.offscreen,we.useRuntimeCollisionCircles){const ci=c.text.placedSymbolArray.get(we.centerJustifiedTextSymbolIndex),ti=h.evaluateSizeForFeature(c.textSizeData,z,ci),dt=p.get("text-padding");$t=this.collisionIndex.placeCollisionCircles(j,ci,c.lineVertexArray,c.glyphOffsetArray,ti,m,y,_,a,ae,U.predicate,we.collisionCircleDiameter,dt,$e),$t.circles.length&&$t.collisionDetected&&!a&&h.warnOnce("Collisions detected, but collision boxes are not shown"),ze=X||$t.circles.length>0&&!$t.collisionDetected,Vt=Vt&&$t.offscreen}if(Xe.iconFeatureIndex&&(rr=Xe.iconFeatureIndex),Xe.iconBox){const ci=ti=>{const dt=fe&&ut?tt(ti,ut.x,ut.y,ie,ae,this.transform.angle):ti;return this.collisionIndex.placeCollisionBox(dt,ne,v,m,U.predicate,$e)};Ft&&Ft.box&&Ft.box.length&&Xe.verticalIconBox?(ei=ci(Xe.verticalIconBox),ht=ei.box.length>0):(ei=ci(Xe.iconBox),ht=ei.box.length>0),Vt=Vt&&ei.offscreen}const xr=R||we.numHorizontalGlyphVertices===0&&we.numVerticalGlyphVertices===0,us=F||we.numIconVertices===0;if(xr||us?us?xr||(ht=ht&&ze):ze=ht&&ze:ht=ze=ht&&ze,ze&&yi&&yi.box&&this.collisionIndex.insertCollisionBox(yi.box,j,p.get("text-ignore-placement"),c.bucketInstanceId,Ft&&Ft.box&&ir?ir:Fi,U.ID),ht&&ei&&this.collisionIndex.insertCollisionBox(ei.box,ne,p.get("icon-ignore-placement"),c.bucketInstanceId,rr,U.ID),$t&&(ze&&this.collisionIndex.insertCollisionCircles($t.circles,j,p.get("text-ignore-placement"),c.bucketInstanceId,Fi,U.ID),a)){const ci=c.bucketInstanceId;let ti=this.collisionCircleArrays[ci];ti===void 0&&(ti=this.collisionCircleArrays[ci]=new Be);for(let dt=0;dt<$t.circles.length;dt+=4)ti.circles.push($t.circles[dt+0]),ti.circles.push($t.circles[dt+1]),ti.circles.push($t.circles[dt+2]),ti.circles.push($t.collisionDetected?1:0)}if(we.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(c.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[we.crossTileID]=new Ke(ze||xe,ht||ge,Vt||c.justReloaded),n[we.crossTileID]=!0};if(_e){if(t.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const we=c.getSortedSymbolIndexes(this.transform.angle);for(let Xe=we.length-1;Xe>=0;--Xe){const ze=we[Xe];Ye(c.symbolInstances.get(ze),c.collisionArrays[ze])}}else for(let we=t.symbolInstanceStart;we<t.symbolInstanceEnd;we++)Ye(c.symbolInstances.get(we),c.collisionArrays[we]);if(a&&c.bucketInstanceId in this.collisionCircleArrays){const we=this.collisionCircleArrays[c.bucketInstanceId];h.invert(we.invProjMatrix,m),we.viewportMatrix=this.collisionIndex.getViewportMatrix()}c.justReloaded=!1}markUsedJustification(t,n,a,c){let p;p=c===h.WritingMode.vertical?a.verticalPlacedTextSymbolIndex:{left:a.leftJustifiedTextSymbolIndex,center:a.centerJustifiedTextSymbolIndex,right:a.rightJustifiedTextSymbolIndex}[h.getAnchorJustification(n)];const m=[a.leftJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.rightJustifiedTextSymbolIndex,a.verticalPlacedTextSymbolIndex];for(const y of m)y>=0&&(t.text.placedSymbolArray.get(y).crossTileID=p>=0&&y!==p?0:a.crossTileID)}markUsedOrientation(t,n,a){const c=n===h.WritingMode.horizontal||n===h.WritingMode.horizontalOnly?n:0,p=n===h.WritingMode.vertical?n:0,m=[a.leftJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.rightJustifiedTextSymbolIndex];for(const y of m)t.text.placedSymbolArray.get(y).placedOrientation=c;a.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(a.verticalPlacedTextSymbolIndex).placedOrientation=p)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const n=this.prevPlacement;let a=!1;this.prevZoomAdjustment=n?n.zoomAdjustment(this.transform.zoom):0;const c=n?n.symbolFadeChange(t):1,p=n?n.opacities:{},m=n?n.variableOffsets:{},y=n?n.placedOrientations:{};for(const _ in this.placements){const v=this.placements[_],S=p[_];S?(this.opacities[_]=new Ne(S,c,v.text,v.icon),a=a||v.text!==S.text.placed||v.icon!==S.icon.placed):(this.opacities[_]=new Ne(null,c,v.text,v.icon,v.skipFade),a=a||v.text||v.icon)}for(const _ in p){const v=p[_];if(!this.opacities[_]){const S=new Ne(v,c,!1,!1);S.isHidden()||(this.opacities[_]=S,a=a||v.text.placed||v.icon.placed)}}for(const _ in m)this.variableOffsets[_]||!this.opacities[_]||this.opacities[_].isHidden()||(this.variableOffsets[_]=m[_]);for(const _ in y)this.placedOrientations[_]||!this.opacities[_]||this.opacities[_].isHidden()||(this.placedOrientations[_]=y[_]);if(n&&n.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");a?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=n?n.lastPlacementChangeTime:t)}updateLayerOpacities(t,n){const a={};for(const c of n){const p=c.getBucket(t);p&&c.latestFeatureIndex&&t.id===p.layerIds[0]&&this.updateBucketOpacities(p,a,c.collisionBoxArray)}}updateBucketOpacities(t,n,a){t.hasTextData()&&(t.text.opacityVertexArray.clear(),t.text.hasVisibleVertices=!1),t.hasIconData()&&(t.icon.opacityVertexArray.clear(),t.icon.hasVisibleVertices=!1),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();const c=t.layers[0].layout,p=new Ne(null,0,!1,!1,!0),m=c.get("text-allow-overlap"),y=c.get("icon-allow-overlap"),_=c.get("text-variable-anchor"),v=c.get("text-rotation-alignment")==="map",S=c.get("text-pitch-alignment")==="map",T=c.get("icon-text-fit")!=="none",z=new Ne(null,0,m&&(y||!t.hasIconData()||c.get("icon-optional")),y&&(m||!t.hasTextData()||c.get("text-optional")),!0);!t.collisionArrays&&a&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(a);const U=(R,F,j)=>{for(let X=0;X<F/4;X++)R.opacityVertexArray.emplaceBack(j);R.hasVisibleVertices=R.hasVisibleVertices||j!==li};for(let R=0;R<t.symbolInstances.length;R++){const F=t.symbolInstances.get(R),{numHorizontalGlyphVertices:j,numVerticalGlyphVertices:X,crossTileID:ne}=F;let V=this.opacities[ne];n[ne]?V=p:V||(V=z,this.opacities[ne]=V),n[ne]=!0;const ie=F.numIconVertices>0,ae=this.placedOrientations[F.crossTileID],fe=ae===h.WritingMode.vertical,_e=ae===h.WritingMode.horizontal||ae===h.WritingMode.horizontalOnly;if(j>0||X>0){const xe=Ii(V.text);U(t.text,j,fe?li:xe),U(t.text,X,_e?li:xe);const ge=V.text.isHidden();[F.rightJustifiedTextSymbolIndex,F.centerJustifiedTextSymbolIndex,F.leftJustifiedTextSymbolIndex].forEach(Ye=>{Ye>=0&&(t.text.placedSymbolArray.get(Ye).hidden=ge||fe?1:0)}),F.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(F.verticalPlacedTextSymbolIndex).hidden=ge||_e?1:0);const ke=this.variableOffsets[F.crossTileID];ke&&this.markUsedJustification(t,ke.anchor,F,ae);const $e=this.placedOrientations[F.crossTileID];$e&&(this.markUsedJustification(t,"left",F,$e),this.markUsedOrientation(t,$e,F))}if(ie){const xe=Ii(V.icon),ge=!(T&&F.verticalPlacedIconSymbolIndex&&fe);F.placedIconSymbolIndex>=0&&(U(t.icon,F.numIconVertices,ge?xe:li),t.icon.placedSymbolArray.get(F.placedIconSymbolIndex).hidden=V.icon.isHidden()),F.verticalPlacedIconSymbolIndex>=0&&(U(t.icon,F.numVerticalIconVertices,ge?li:xe),t.icon.placedSymbolArray.get(F.verticalPlacedIconSymbolIndex).hidden=V.icon.isHidden())}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const xe=t.collisionArrays[R];if(xe){let ge=new h.Point(0,0);if(xe.textBox||xe.verticalTextBox){let $e=!0;if(_){const Ye=this.variableOffsets[ne];Ye?(ge=ot(Ye.anchor,Ye.width,Ye.height,Ye.textOffset,Ye.textBoxScale),v&&ge._rotate(S?this.transform.angle:-this.transform.angle)):$e=!1}xe.textBox&&gt(t.textCollisionBox.collisionVertexArray,V.text.placed,!$e||fe,ge.x,ge.y),xe.verticalTextBox&&gt(t.textCollisionBox.collisionVertexArray,V.text.placed,!$e||_e,ge.x,ge.y)}const ke=!!(!_e&&xe.verticalIconBox);xe.iconBox&&gt(t.iconCollisionBox.collisionVertexArray,V.icon.placed,ke,T?ge.x:0,T?ge.y:0),xe.verticalIconBox&&gt(t.iconCollisionBox.collisionVertexArray,V.icon.placed,!ke,T?ge.x:0,T?ge.y:0)}}}if(t.sortFeatures(this.transform.angle),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.text.opacityVertexArray.length!==t.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${t.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${t.text.layoutVertexArray.length}) / 4`);if(t.icon.opacityVertexArray.length!==t.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${t.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${t.icon.layoutVertexArray.length}) / 4`);if(t.bucketInstanceId in this.collisionCircleArrays){const R=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=R.invProjMatrix,t.placementViewportMatrix=R.viewportMatrix,t.collisionCircleArray=R.circles,delete this.collisionCircleArrays[t.bucketInstanceId]}}symbolFadeChange(t){return this.fadeDuration===0?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(t,n){const a=this.zoomAtLastRecencyCheck===n?1-this.zoomAdjustment(n):1;return this.zoomAtLastRecencyCheck=n,this.commitTime+this.fadeDuration*a>t}setStale(){this.stale=!0}}function gt(o,t,n,a,c){o.emplaceBack(t?1:0,n?1:0,a||0,c||0),o.emplaceBack(t?1:0,n?1:0,a||0,c||0),o.emplaceBack(t?1:0,n?1:0,a||0,c||0),o.emplaceBack(t?1:0,n?1:0,a||0,c||0)}const At=Math.pow(2,25),zt=Math.pow(2,24),Ut=Math.pow(2,17),lt=Math.pow(2,16),va=Math.pow(2,9),ba=Math.pow(2,8),Ri=Math.pow(2,1);function Ii(o){if(o.opacity===0&&!o.placed)return 0;if(o.opacity===1&&o.placed)return 4294967295;const t=o.placed?1:0,n=Math.floor(127*o.opacity);return n*At+t*zt+n*Ut+t*lt+n*va+t*ba+n*Ri+t}const li=0;class Do{constructor(t){this._sortAcrossTiles=t.layout.get("symbol-z-order")!=="viewport-y"&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,n,a,c,p){const m=this._bucketParts;for(;this._currentTileIndex<t.length;)if(n.getBucketParts(m,c,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,p())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,m.sort((y,_)=>y.sortKey-_.sortKey));this._currentPartIndex<m.length;)if(n.placeLayerBucketPart(m[this._currentPartIndex],this._seenCrossTileIDs,a),this._currentPartIndex++,p())return!0;return!1}}class bs{constructor(t,n,a,c,p,m,y,_){this.placement=new ft(t,n,m,y,_),this._currentPlacementIndex=a.length-1,this._forceFullPlacement=c,this._showCollisionBoxes=p,this._done=!1}isDone(){return this._done}continuePlacement(t,n,a){const c=h.exported.now(),p=()=>!this._forceFullPlacement&&h.exported.now()-c>2;for(;this._currentPlacementIndex>=0;){const m=n[t[this._currentPlacementIndex]],y=this.placement.collisionIndex.transform.zoom;if(m.type==="symbol"&&(!m.minzoom||m.minzoom<=y)&&(!m.maxzoom||m.maxzoom>y)){if(this._inProgressLayer||(this._inProgressLayer=new Do(m)),this._inProgressLayer.continuePlacement(a[m.source],this.placement,this._showCollisionBoxes,m,p))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const Lt=512/h.EXTENT/2;class Gn{constructor(t,n,a){this.tileID=t,this.bucketInstanceId=a,this._symbolsByKey={};const c=new Map;for(let p=0;p<n.length;p++){const m=n.get(p),y=m.key,_=c.get(y);_?_.push(m):c.set(y,[m])}for(const[p,m]of c){const y={positions:m.map(_=>({x:Math.floor(_.anchorX*Lt),y:Math.floor(_.anchorY*Lt)})),crossTileIDs:m.map(_=>_.crossTileID)};if(y.positions.length>128){const _=new h.KDBush(y.positions.length,16,Uint16Array);for(const{x:v,y:S}of y.positions)_.add(v,S);_.finish(),delete y.positions,y.index=_}this._symbolsByKey[p]=y}}getScaledCoordinates(t,n){const{x:a,y:c,z:p}=this.tileID.canonical,{x:m,y,z:_}=n.canonical,v=Lt/Math.pow(2,_-p),S=(y*h.EXTENT+t.anchorY)*v,T=c*h.EXTENT*Lt;return{x:Math.floor((m*h.EXTENT+t.anchorX)*v-a*h.EXTENT*Lt),y:Math.floor(S-T)}}findMatches(t,n,a){const c=this.tileID.canonical.z<n.canonical.z?1:Math.pow(2,this.tileID.canonical.z-n.canonical.z);for(let p=0;p<t.length;p++){const m=t.get(p);if(m.crossTileID)continue;const y=this._symbolsByKey[m.key];if(!y)continue;const _=this.getScaledCoordinates(m,n);if(y.index){const v=y.index.range(_.x-c,_.y-c,_.x+c,_.y+c).sort();for(const S of v){const T=y.crossTileIDs[S];if(!a[T]){a[T]=!0,m.crossTileID=T;break}}}else if(y.positions)for(let v=0;v<y.positions.length;v++){const S=y.positions[v],T=y.crossTileIDs[v];if(Math.abs(S.x-_.x)<=c&&Math.abs(S.y-_.y)<=c&&!a[T]){a[T]=!0,m.crossTileID=T;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:t})=>t)}}class Qr{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Qt{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const n=Math.round((t-this.lng)/360);if(n!==0)for(const a in this.indexes){const c=this.indexes[a],p={};for(const m in c){const y=c[m];y.tileID=y.tileID.unwrapTo(y.tileID.wrap+n),p[y.tileID.key]=y}this.indexes[a]=p}this.lng=t}addBucket(t,n,a){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===n.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let p=0;p<n.symbolInstances.length;p++)n.symbolInstances.get(p).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]={});const c=this.usedCrossTileIDs[t.overscaledZ];for(const p in this.indexes){const m=this.indexes[p];if(Number(p)>t.overscaledZ)for(const y in m){const _=m[y];_.tileID.isChildOf(t)&&_.findMatches(n.symbolInstances,t,c)}else{const y=m[t.scaledTo(Number(p)).key];y&&y.findMatches(n.symbolInstances,t,c)}}for(let p=0;p<n.symbolInstances.length;p++){const m=n.symbolInstances.get(p);m.crossTileID||(m.crossTileID=a.generate(),c[m.crossTileID]=!0)}return this.indexes[t.overscaledZ]===void 0&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new Gn(t,n.symbolInstances,n.bucketInstanceId),!0}removeBucketCrossTileIDs(t,n){for(const a of n.getCrossTileIDsLists())for(const c of a)delete this.usedCrossTileIDs[t][c]}removeStaleBuckets(t){let n=!1;for(const a in this.indexes){const c=this.indexes[a];for(const p in c)t[c[p].bucketInstanceId]||(this.removeBucketCrossTileIDs(a,c[p]),delete c[p],n=!0)}return n}}class qn{constructor(){this.layerIndexes={},this.crossTileIDs=new Qr,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,n,a){let c=this.layerIndexes[t.id];c===void 0&&(c=this.layerIndexes[t.id]=new Qt);let p=!1;const m={};c.handleWrapJump(a);for(const y of n){const _=y.getBucket(t);_&&t.id===_.layerIds[0]&&(_.bucketInstanceId||(_.bucketInstanceId=++this.maxBucketInstanceId),c.addBucket(y.tileID,_,this.crossTileIDs)&&(p=!0),m[_.bucketInstanceId]=!0)}return c.removeStaleBuckets(m)&&(p=!0),p}pruneUnusedLayers(t){const n={};t.forEach(a=>{n[a]=!0});for(const a in this.layerIndexes)n[a]||delete this.layerIndexes[a]}}const Ai=(o,t)=>h.emitValidationErrors(o,t&&t.filter(n=>n.identifier!=="source.canvas")),Ro=h.pick(h.operations,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setGlyphs","setSprite"]),$r=h.pick(h.operations,["setCenter","setZoom","setBearing","setPitch"]),Yl=h.emptyStyle();class tr extends h.Evented{constructor(t,n={}){super(),this.map=t,this.dispatcher=new Fr(Er(),this,t._getMapId()),this.imageManager=new qi,this.imageManager.setEventedParent(this),this.glyphManager=new Sr(t._requestManager,n.localIdeographFontFamily),this.lineAtlas=new Nn(256,512),this.crossTileSymbolIndex=new qn,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new h.ZoomHistory,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",h.getReferrer());const a=this;this._rtlTextPluginCallback=tr.registerForPluginStateChange(c=>{a.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:c.pluginStatus,pluginURL:c.pluginURL},(p,m)=>{if(h.triggerPluginCompletionEvent(p),m&&m.every(y=>y))for(const y in a.sourceCaches){const _=a.sourceCaches[y].getSource().type;_!=="vector"&&_!=="geojson"||a.sourceCaches[y].reload()}})}),this.on("data",c=>{if(c.dataType!=="source"||c.sourceDataType!=="metadata")return;const p=this.sourceCaches[c.sourceId];if(!p)return;const m=p.getSource();if(m&&m.vectorLayerIds)for(const y in this._layers){const _=this._layers[y];_.source===m.id&&this._validateLayer(_)}})}loadURL(t,n={},a){this.fire(new h.Event("dataloading",{dataType:"style"})),n.validate=typeof n.validate!="boolean"||n.validate;const c=this.map._requestManager.transformRequest(t,It.Style);this._request=h.getJSON(c,(p,m)=>{this._request=null,p?this.fire(new h.ErrorEvent(p)):m&&this._load(m,n,a)})}loadJSON(t,n={},a){this.fire(new h.Event("dataloading",{dataType:"style"})),this._request=h.exported.frame(()=>{this._request=null,n.validate=n.validate!==!1,this._load(t,n,a)})}loadEmpty(){this.fire(new h.Event("dataloading",{dataType:"style"})),this._load(Yl,{validate:!1})}_load(t,n,a){const c=n.transformStyle?n.transformStyle(a,t):t;if(!n.validate||!Ai(this,h.validateStyle(c))){this._loaded=!0,this.stylesheet=c;for(const p in c.sources)this.addSource(p,c.sources[p],{validate:!1});c.sprite?this._loadSprite(c.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(c.glyphs),this._createLayers(),this.light=new Br(this.stylesheet.light),this.map.setTerrain(this.stylesheet.terrain),this.fire(new h.Event("data",{dataType:"style"})),this.fire(new h.Event("style.load"))}}_createLayers(){const t=h.derefLayers(this.stylesheet.layers);this.dispatcher.broadcast("setLayers",t),this._order=t.map(n=>n.id),this._layers={},this._serializedLayers=null;for(const n of t){const a=h.createStyleLayer(n);a.setEventedParent(this,{layer:{id:n.id}}),this._layers[n.id]=a}}_loadSprite(t,n=!1,a){this.imageManager.setLoaded(!1),this._spriteRequest=function(c,p,m,y){const _=Xr(c),v=_.length,S=m>1?"@2x":"",T={},z={},U={};for(const{id:R,url:F}of _){const j=p.transformRequest(p.normalizeSpriteURL(F,S,".json"),It.SpriteJSON),X=`${R}_${j.url}`;T[X]=h.getJSON(j,(ie,ae)=>{delete T[X],z[R]=ae,oi(y,z,U,ie,v)});const ne=p.transformRequest(p.normalizeSpriteURL(F,S,".png"),It.SpriteImage),V=`${R}_${ne.url}`;T[V]=hr.getImage(ne,(ie,ae)=>{delete T[V],U[R]=ae,oi(y,z,U,ie,v)})}return{cancel(){for(const R of Object.values(T))R.cancel()}}}(t,this.map._requestManager,this.map.getPixelRatio(),(c,p)=>{if(this._spriteRequest=null,c)this.fire(new h.ErrorEvent(c));else if(p)for(const m in p){this._spritesImagesIds[m]=[];const y=this._spritesImagesIds[m]?this._spritesImagesIds[m].filter(_=>!(_ in p)):[];for(const _ of y)this.imageManager.removeImage(_),this._changedImages[_]=!0;for(const _ in p[m]){const v=m==="default"?_:`${m}:${_}`;this._spritesImagesIds[m].push(v),v in this.imageManager.images?this.imageManager.updateImage(v,p[m][_],!1):this.imageManager.addImage(v,p[m][_]),n&&(this._changedImages[v]=!0)}}this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),n&&(this._changed=!0),this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new h.Event("data",{dataType:"style"})),a&&a(c)})}_unloadSprite(){for(const t of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(t),this._changedImages[t]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new h.Event("data",{dataType:"style"}))}_validateLayer(t){const n=this.sourceCaches[t.source];if(!n)return;const a=t.sourceLayer;if(!a)return;const c=n.getSource();(c.type==="geojson"||c.vectorLayerIds&&c.vectorLayerIds.indexOf(a)===-1)&&this.fire(new h.ErrorEvent(new Error(`Source layer "${a}" does not exist on source "${c.id}" as specified by style layer "${t.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(t){const n=this._serializedAllLayers();if(!t||t.length===0)return Object.values(n);const a=[];for(const c of t)n[c]&&a.push(n[c]);return a}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;t=this._serializedLayers={};const n=Object.keys(this._layers);for(const a of n){const c=this._layers[a];c.type!=="custom"&&(t[a]=c.serialize())}return t}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(const t in this.sourceCaches)if(this.sourceCaches[t].hasTransition())return!0;for(const t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(t){if(!this._loaded)return;const n=this._changed;if(this._changed){const c=Object.keys(this._updatedLayers),p=Object.keys(this._removedLayers);(c.length||p.length)&&this._updateWorkerLayers(c,p);for(const m in this._updatedSources){const y=this._updatedSources[m];if(y==="reload")this._reloadSource(m);else{if(y!=="clear")throw new Error(`Invalid action ${y}`);this._clearSource(m)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const m in this._updatedPaintProps)this._layers[m].updateTransitions(t);this.light.updateTransitions(t),this._resetUpdates()}const a={};for(const c in this.sourceCaches){const p=this.sourceCaches[c];a[c]=p.used,p.used=!1}for(const c of this._order){const p=this._layers[c];p.recalculate(t,this._availableImages),!p.isHidden(t.zoom)&&p.source&&(this.sourceCaches[p.source].used=!0)}for(const c in a){const p=this.sourceCaches[c];a[c]!==p.used&&p.fire(new h.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:c}))}this.light.recalculate(t),this.z=t.zoom,n&&this.fire(new h.Event("data",{dataType:"style"}))}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const n in this.sourceCaches)this.sourceCaches[n].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const t in this.sourceCaches)this.sourceCaches[t].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(t,n){this.dispatcher.broadcast("updateLayers",{layers:this._serializeByIds(t),removedIds:n})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(t,n={}){this._checkLoaded();const a=this.serialize();if(t=n.transformStyle?n.transformStyle(a,t):t,Ai(this,h.validateStyle(t)))return!1;(t=h.clone$1(t)).layers=h.derefLayers(t.layers);const c=h.diffStyles(a,t).filter(m=>!(m.command in $r));if(c.length===0)return!1;const p=c.filter(m=>!(m.command in Ro));if(p.length>0)throw new Error(`Unimplemented: ${p.map(m=>m.command).join(", ")}.`);for(const m of c)m.command!=="setTransition"&&this[m.command].apply(this,m.args);return this.stylesheet=t,!0}addImage(t,n){if(this.getImage(t))return this.fire(new h.ErrorEvent(new Error(`An image named "${t}" already exists.`)));this.imageManager.addImage(t,n),this._afterImageUpdated(t)}updateImage(t,n){this.imageManager.updateImage(t,n)}getImage(t){return this.imageManager.getImage(t)}removeImage(t){if(!this.getImage(t))return this.fire(new h.ErrorEvent(new Error(`An image named "${t}" does not exist.`)));this.imageManager.removeImage(t),this._afterImageUpdated(t)}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new h.Event("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,n,a={}){if(this._checkLoaded(),this.sourceCaches[t]!==void 0)throw new Error(`Source "${t}" 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(h.validateStyle.source,`sources.${t}`,n,null,a))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);const c=this.sourceCaches[t]=new ni(t,n,this.dispatcher);c.style=this,c.setEventedParent(this,()=>({isSourceLoaded:c.loaded(),source:c.serialize(),sourceId:t})),c.onAdd(this.map),this._changed=!0}removeSource(t){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error("There is no source with this ID");for(const a in this._layers)if(this._layers[a].source===t)return this.fire(new h.ErrorEvent(new Error(`Source "${t}" cannot be removed while layer "${a}" is using it.`)));const n=this.sourceCaches[t];delete this.sourceCaches[t],delete this._updatedSources[t],n.fire(new h.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:t})),n.setEventedParent(null),n.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,n){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error(`There is no source with this ID=${t}`);const a=this.sourceCaches[t].getSource();if(a.type!=="geojson")throw new Error(`geojsonSource.type is ${a.type}, which is !== 'geojson`);a.setData(n),this._changed=!0}getSource(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()}addLayer(t,n,a={}){this._checkLoaded();const c=t.id;if(this.getLayer(c))return void this.fire(new h.ErrorEvent(new Error(`Layer "${c}" already exists on this map.`)));let p;if(t.type==="custom"){if(Ai(this,h.validateCustomStyleLayer(t)))return;p=h.createStyleLayer(t)}else{if(typeof t.source=="object"&&(this.addSource(c,t.source),t=h.clone$1(t),t=h.extend(t,{source:c})),this._validate(h.validateStyle.layer,`layers.${c}`,t,{arrayIndex:-1},a))return;p=h.createStyleLayer(t),this._validateLayer(p),p.setEventedParent(this,{layer:{id:c}})}const m=n?this._order.indexOf(n):this._order.length;if(n&&m===-1)this.fire(new h.ErrorEvent(new Error(`Cannot add layer "${c}" before non-existing layer "${n}".`)));else{if(this._order.splice(m,0,c),this._layerOrderChanged=!0,this._layers[c]=p,this._removedLayers[c]&&p.source&&p.type!=="custom"){const y=this._removedLayers[c];delete this._removedLayers[c],y.type!==p.type?this._updatedSources[p.source]="clear":(this._updatedSources[p.source]="reload",this.sourceCaches[p.source].pause())}this._updateLayer(p),p.onAdd&&p.onAdd(this.map)}}moveLayer(t,n){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new h.ErrorEvent(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===n)return;const a=this._order.indexOf(t);this._order.splice(a,1);const c=n?this._order.indexOf(n):this._order.length;n&&c===-1?this.fire(new h.ErrorEvent(new Error(`Cannot move layer "${t}" before non-existing layer "${n}".`))):(this._order.splice(c,0,t),this._layerOrderChanged=!0)}removeLayer(t){this._checkLoaded();const n=this._layers[t];if(!n)return void this.fire(new h.ErrorEvent(new Error(`Cannot remove non-existing layer "${t}".`)));n.setEventedParent(null);const a=this._order.indexOf(t);this._order.splice(a,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=n,delete this._layers[t],this._serializedLayers&&delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],n.onRemove&&n.onRemove(this.map)}getLayer(t){return this._layers[t]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,n,a){this._checkLoaded();const c=this.getLayer(t);c?c.minzoom===n&&c.maxzoom===a||(n!=null&&(c.minzoom=n),a!=null&&(c.maxzoom=a),this._updateLayer(c)):this.fire(new h.ErrorEvent(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,n,a={}){this._checkLoaded();const c=this.getLayer(t);if(c){if(!h.deepEqual(c.filter,n))return n==null?(c.filter=void 0,void this._updateLayer(c)):void(this._validate(h.validateStyle.filter,`layers.${c.id}.filter`,n,null,a)||(c.filter=h.clone$1(n),this._updateLayer(c)))}else this.fire(new h.ErrorEvent(new Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return h.clone$1(this.getLayer(t).filter)}setLayoutProperty(t,n,a,c={}){this._checkLoaded();const p=this.getLayer(t);p?h.deepEqual(p.getLayoutProperty(n),a)||(p.setLayoutProperty(n,a,c),this._updateLayer(p)):this.fire(new h.ErrorEvent(new Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,n){const a=this.getLayer(t);if(a)return a.getLayoutProperty(n);this.fire(new h.ErrorEvent(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,n,a,c={}){this._checkLoaded();const p=this.getLayer(t);p?h.deepEqual(p.getPaintProperty(n),a)||(p.setPaintProperty(n,a,c)&&this._updateLayer(p),this._changed=!0,this._updatedPaintProps[t]=!0):this.fire(new h.ErrorEvent(new Error(`Cannot style non-existing layer "${t}".`)))}getPaintProperty(t,n){return this.getLayer(t).getPaintProperty(n)}setFeatureState(t,n){this._checkLoaded();const a=t.source,c=t.sourceLayer,p=this.sourceCaches[a];if(p===void 0)return void this.fire(new h.ErrorEvent(new Error(`The source '${a}' does not exist in the map's style.`)));const m=p.getSource().type;m==="geojson"&&c?this.fire(new h.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):m!=="vector"||c?(t.id===void 0&&this.fire(new h.ErrorEvent(new Error("The feature id parameter must be provided."))),p.setFeatureState(c,t.id,n)):this.fire(new h.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(t,n){this._checkLoaded();const a=t.source,c=this.sourceCaches[a];if(c===void 0)return void this.fire(new h.ErrorEvent(new Error(`The source '${a}' does not exist in the map's style.`)));const p=c.getSource().type,m=p==="vector"?t.sourceLayer:void 0;p!=="vector"||m?n&&typeof t.id!="string"&&typeof t.id!="number"?this.fire(new h.ErrorEvent(new Error("A feature id is required to remove its specific state property."))):c.removeFeatureState(m,t.id,n):this.fire(new h.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();const n=t.source,a=t.sourceLayer,c=this.sourceCaches[n];if(c!==void 0)return c.getSource().type!=="vector"||a?(t.id===void 0&&this.fire(new h.ErrorEvent(new Error("The feature id parameter must be provided."))),c.getFeatureState(a,t.id)):void this.fire(new h.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new h.ErrorEvent(new Error(`The source '${n}' does not exist in the map's style.`)))}getTransition(){return h.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){const t=h.mapObject(this.sourceCaches,c=>c.serialize()),n=this._serializeByIds(this._order),a=this.stylesheet;return h.filterObject({version:a.version,name:a.name,metadata:a.metadata,light:a.light,center:a.center,zoom:a.zoom,bearing:a.bearing,pitch:a.pitch,sprite:a.sprite,glyphs:a.glyphs,transition:a.transition,sources:t,layers:n},c=>c!==void 0)}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&this.sourceCaches[t.source].getSource().type!=="raster"&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(t){const n=m=>this._layers[m].type==="fill-extrusion",a={},c=[];for(let m=this._order.length-1;m>=0;m--){const y=this._order[m];if(n(y)){a[y]=m;for(const _ of t){const v=_[y];if(v)for(const S of v)c.push(S)}}}c.sort((m,y)=>y.intersectionZ-m.intersectionZ);const p=[];for(let m=this._order.length-1;m>=0;m--){const y=this._order[m];if(n(y))for(let _=c.length-1;_>=0;_--){const v=c[_].feature;if(a[v.layer.id]<m)break;p.push(v),c.pop()}else for(const _ of t){const v=_[y];if(v)for(const S of v)p.push(S.feature)}}return p}queryRenderedFeatures(t,n,a){n&&n.filter&&this._validate(h.validateStyle.filter,"queryRenderedFeatures.filter",n.filter,null,n);const c={};if(n&&n.layers){if(!Array.isArray(n.layers))return this.fire(new h.ErrorEvent(new Error("parameters.layers must be an Array."))),[];for(const y of n.layers){const _=this._layers[y];if(!_)return this.fire(new h.ErrorEvent(new Error(`The layer '${y}' does not exist in the map's style and cannot be queried for features.`))),[];c[_.source]=!0}}const p=[];n.availableImages=this._availableImages;const m=this._serializedAllLayers();for(const y in this.sourceCaches)n.layers&&!c[y]||p.push(pt(this.sourceCaches[y],this._layers,m,t,n,a));return this.placement&&p.push(function(y,_,v,S,T,z,U){const R={},F=z.queryRenderedSymbols(S),j=[];for(const X of Object.keys(F).map(Number))j.push(U[X]);j.sort(Di);for(const X of j){const ne=X.featureIndex.lookupSymbolFeatures(F[X.bucketInstanceId],_,X.bucketIndex,X.sourceLayerIndex,T.filter,T.layers,T.availableImages,y);for(const V in ne){const ie=R[V]=R[V]||[],ae=ne[V];ae.sort((fe,_e)=>{const xe=X.featureSortOrder;if(xe){const ge=xe.indexOf(fe.featureIndex);return xe.indexOf(_e.featureIndex)-ge}return _e.featureIndex-fe.featureIndex});for(const fe of ae)ie.push(fe)}}for(const X in R)R[X].forEach(ne=>{const V=ne.feature,ie=v[y[X].source].getFeatureState(V.layer["source-layer"],V.id);V.source=V.layer.source,V.layer["source-layer"]&&(V.sourceLayer=V.layer["source-layer"]),V.state=ie});return R}(this._layers,m,this.sourceCaches,t,n,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(p)}querySourceFeatures(t,n){n&&n.filter&&this._validate(h.validateStyle.filter,"querySourceFeatures.filter",n.filter,null,n);const a=this.sourceCaches[t];return a?function(c,p){const m=c.getRenderableIds().map(v=>c.getTileByID(v)),y=[],_={};for(let v=0;v<m.length;v++){const S=m[v],T=S.tileID.canonical.key;_[T]||(_[T]=!0,S.querySourceFeatures(y,p))}return y}(a,n):[]}addSourceType(t,n,a){return tr.getSourceType(t)?a(new Error(`A source type called "${t}" already exists.`)):(tr.setSourceType(t,n),n.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:t,url:n.workerSourceURL},a):a(null,null))}getLight(){return this.light.getLight()}setLight(t,n={}){this._checkLoaded();const a=this.light.getLight();let c=!1;for(const m in t)if(!h.deepEqual(t[m],a[m])){c=!0;break}if(!c)return;const p={now:h.exported.now(),transition:h.extend({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(t,n),this.light.updateTransitions(p)}_validate(t,n,a,c,p={}){return(!p||p.validate!==!1)&&Ai(this,t.call(h.validateStyle,h.extend({key:n,style:this.serialize(),value:a,styleSpec:h.v8Spec},c)))}_remove(t=!0){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),h.evented.off("pluginStateChange",this._rtlTextPluginCallback);for(const n in this._layers)this._layers[n].setEventedParent(null);for(const n in this.sourceCaches){const a=this.sourceCaches[n];a.setEventedParent(null),a.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove(t)}_clearSource(t){this.sourceCaches[t].clearTiles()}_reloadSource(t){this.sourceCaches[t].resume(),this.sourceCaches[t].reload()}_updateSources(t){for(const n in this.sourceCaches)this.sourceCaches[n].update(t,this.map.terrain)}_generateCollisionBoxes(){for(const t in this.sourceCaches)this._reloadSource(t)}_updatePlacement(t,n,a,c,p=!1){let m=!1,y=!1;const _={};for(const v of this._order){const S=this._layers[v];if(S.type!=="symbol")continue;if(!_[S.source]){const z=this.sourceCaches[S.source];_[S.source]=z.getRenderableIds(!0).map(U=>z.getTileByID(U)).sort((U,R)=>R.tileID.overscaledZ-U.tileID.overscaledZ||(U.tileID.isLessThan(R.tileID)?-1:1))}const T=this.crossTileSymbolIndex.addLayer(S,_[S.source],t.center.lng);m=m||T}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((p=p||this._layerOrderChanged||a===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(h.exported.now(),t.zoom))&&(this.pauseablePlacement=new bs(t,this.map.terrain,this._order,p,n,a,c,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,_),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(h.exported.now()),y=!0),m&&this.pauseablePlacement.placement.setStale()),y||m)for(const v of this._order){const S=this._layers[v];S.type==="symbol"&&this.placement.updateLayerOpacities(S,_[S.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(h.exported.now())}_releaseSymbolFadeTiles(){for(const t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()}getImages(t,n,a){this.imageManager.getImages(n.icons,a),this._updateTilesForChangedImages();const c=this.sourceCaches[n.source];c&&c.setDependencies(n.tileID.key,n.type,n.icons)}getGlyphs(t,n,a){this.glyphManager.getGlyphs(n.stacks,a);const c=this.sourceCaches[n.source];c&&c.setDependencies(n.tileID.key,n.type,[""])}getResource(t,n,a){return h.makeRequest(n,a)}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(t,n={}){this._checkLoaded(),t&&this._validate(h.validateStyle.glyphs,"glyphs",t,null,n)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=t,this.glyphManager.entries={},this.glyphManager.setURL(t))}addSprite(t,n,a={},c){this._checkLoaded();const p=[{id:t,url:n}],m=[...Xr(this.stylesheet.sprite),...p];this._validate(h.validateStyle.sprite,"sprite",m,null,a)||(this.stylesheet.sprite=m,this._loadSprite(p,!0,c))}removeSprite(t){this._checkLoaded();const n=Xr(this.stylesheet.sprite);if(n.find(a=>a.id===t)){if(this._spritesImagesIds[t])for(const a of this._spritesImagesIds[t])this.imageManager.removeImage(a),this._changedImages[a]=!0;n.splice(n.findIndex(a=>a.id===t),1),this.stylesheet.sprite=n.length>0?n:void 0,delete this._spritesImagesIds[t],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new h.Event("data",{dataType:"style"}))}else this.fire(new h.ErrorEvent(new Error(`Sprite "${t}" doesn't exists on this map.`)))}getSprite(){return Xr(this.stylesheet.sprite)}setSprite(t,n={},a){this._checkLoaded(),t&&this._validate(h.validateStyle.sprite,"sprite",t,null,n)||(this.stylesheet.sprite=t,t?this._loadSprite(t,!0,a):(this._unloadSprite(),a&&a(null)))}}tr.getSourceType=function(o){return Yr[o]},tr.setSourceType=function(o,t){Yr[o]=t},tr.registerForPluginStateChange=h.registerForPluginStateChange;var wn=h.createLayout([{name:"a_pos",type:"Int16",components:2}]),Tn="in vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;out vec2 v_texture_pos;out float v_depth;void main() {float extent=8192.0;float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/extent;gl_Position=u_matrix*vec4(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}";const Xi={prelude:_t(`#ifdef GL_ES
1
+ (function(Oe,xa){typeof exports=="object"&&typeof module<"u"?xa(exports):typeof define=="function"&&define.amd?define(["exports"],xa):(Oe=typeof globalThis<"u"?globalThis:Oe||self,xa(Oe.maptilersdk={}))})(this,function(Oe){"use strict";var xa=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function hh(A){return A&&A.__esModule&&Object.prototype.hasOwnProperty.call(A,"default")?A.default:A}var uh={exports:{}};(function(A,x){(function(k,K){A.exports=K()})(xa,function(){var k,K,te;function he(h,me){if(!k)k=me;else if(!K)K=me;else{var J="var sharedChunk = {}; ("+k+")(sharedChunk); ("+K+")(sharedChunk);",Ke={};k(Ke),te=me(Ke),typeof window<"u"&&(te.workerUrl=window.URL.createObjectURL(new Blob([J],{type:"text/javascript"})))}}he(["exports"],function(h){function me(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var J=Ke;function Ke(i,e){this.x=i,this.y=e}Ke.prototype={clone:function(){return new Ke(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,e){return this.clone()._rotateAround(i,e)},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 e=i.x-this.x,r=i.y-this.y;return e*e+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,e){return Math.atan2(this.x*e-this.y*i,this.x*i+this.y*e)},_matMult:function(i){var e=i[2]*this.x+i[3]*this.y;return this.x=i[0]*this.x+i[1]*this.y,this.y=e,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 e=Math.cos(i),r=Math.sin(i),s=r*this.x+e*this.y;return this.x=e*this.x-r*this.y,this.y=s,this},_rotateAround:function(i,e){var r=Math.cos(i),s=Math.sin(i),l=e.y+s*(this.x-e.x)+r*(this.y-e.y);return this.x=e.x+r*(this.x-e.x)-s*(this.y-e.y),this.y=l,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},Ke.convert=function(i){return i instanceof Ke?i:Array.isArray(i)?new Ke(i[0],i[1]):i};var ve=me(J),Ee=Xe;function Xe(i,e,r,s){this.cx=3*i,this.bx=3*(r-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(s-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=e,this.p2x=r,this.p2y=s}Xe.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,e){if(e===void 0&&(e=1e-6),i<0)return 0;if(i>1)return 1;for(var r=i,s=0;s<8;s++){var l=this.sampleCurveX(r)-i;if(Math.abs(l)<e)return r;var u=this.sampleCurveDerivativeX(r);if(Math.abs(u)<1e-6)break;r-=l/u}var d=0,f=1;for(r=i,s=0;s<20&&(l=this.sampleCurveX(r),!(Math.abs(l-i)<e));s++)i>l?d=r:f=r,r=.5*(f-d)+d;return r},solve:function(i,e){return this.sampleCurveY(this.solveCurveX(i,e))}};var je=me(Ee);function kt(i,e,r,s){const l=new je(i,e,r,s);return function(u){return l.solve(u)}}const Dt=kt(.25,.1,.25,1);function Ct(i,e,r){return Math.min(r,Math.max(e,i))}function hr(i,e,r){const s=r-e,l=((i-e)%s+s)%s+e;return l===e?r:l}function xi(i,...e){for(const r of e)for(const s in r)i[s]=r[s];return i}let Ta=1;function Xn(i,e){i.forEach(r=>{e[r]&&(e[r]=e[r].bind(e))})}function Or(i,e,r){const s={};for(const l in i)s[l]=e.call(r||this,i[l],l,i);return s}function vn(i,e,r){const s={};for(const l in i)e.call(r||this,i[l],l,i)&&(s[l]=i[l]);return s}function Ii(i){return Array.isArray(i)?i.map(Ii):typeof i=="object"&&i?Or(i,Ii):i}const Qr={};function ci(i){Qr[i]||(typeof console<"u"&&console.warn(i),Qr[i]=!0)}function yt(i,e,r){return(r.y-i.y)*(e.x-i.x)>(e.y-i.y)*(r.x-i.x)}function Sa(i){let e=0;for(let r,s,l=0,u=i.length,d=u-1;l<u;d=l++)r=i[l],s=i[d],e+=(s.x-r.x)*(r.y+s.y);return e}function qi(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}let Tr=null;function Ur(i){if(Tr==null){const e=i.navigator?i.navigator.userAgent:null;Tr=!!i.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return Tr}function en(i){return typeof ImageBitmap<"u"&&i instanceof ImageBitmap}const Sr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let bn,tn;const wn={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frame(i){const e=requestAnimationFrame(i);return{cancel:()=>cancelAnimationFrame(e)}},getImageData(i,e=0){return this.getImageCanvasContext(i).getImageData(-e,-e,i.width+2*e,i.height+2*e)},getImageCanvasContext(i){const e=window.document.createElement("canvas"),r=e.getContext("2d",{willReadFrequently:!0});if(!r)throw new Error("failed to create canvas 2d context");return e.width=i.width,e.height=i.height,r.drawImage(i,0,0,i.width,i.height),r},resolveURL:i=>(bn||(bn=document.createElement("a")),bn.href=i,bn.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(tn==null&&(tn=matchMedia("(prefers-reduced-motion: reduce)")),tn.matches)}},Wn={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};class Nr extends Error{constructor(e,r,s,l){super(`AJAXError: ${r} (${e}): ${s}`),this.status=e,this.statusText=r,this.url=s,this.body=l}}const vi=qi()?()=>self.worker&&self.worker.referrer:()=>(window.location.protocol==="blob:"?window.parent:window).location.href,Gi=i=>Wn.REGISTERED_PROTOCOLS[i.substring(0,i.indexOf("://"))];function si(i,e){const r=new AbortController,s=new Request(i.url,{method:i.method||"GET",body:i.body,credentials:i.credentials,headers:i.headers,referrer:vi(),signal:r.signal});let l=!1,u=!1;return i.type==="json"&&s.headers.set("Accept","application/json"),u||fetch(s).then(d=>d.ok?(f=>{(i.type==="arrayBuffer"||i.type==="image"?f.arrayBuffer():i.type==="json"?f.json():f.text()).then(g=>{u||(l=!0,e(null,g,f.headers.get("Cache-Control"),f.headers.get("Expires")))}).catch(g=>{u||e(new Error(g.message))})})(d):d.blob().then(f=>e(new Nr(d.status,d.statusText,i.url,f)))).catch(d=>{d.code!==20&&e(new Error(d.message))}),{cancel:()=>{u=!0,l||r.abort()}}}const Tn=function(i,e){if(/:\/\//.test(i.url)&&!/^https?:|^file:/.test(i.url)){if(qi()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,e);if(!qi())return(Gi(i.url)||si)(i,e)}if(!(/^file:/.test(r=i.url)||/^file:/.test(vi())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return si(i,e);if(qi()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,e,void 0,!0)}var r;return function(s,l){const u=new XMLHttpRequest;u.open(s.method||"GET",s.url,!0),s.type!=="arrayBuffer"&&s.type!=="image"||(u.responseType="arraybuffer");for(const d in s.headers)u.setRequestHeader(d,s.headers[d]);return s.type==="json"&&(u.responseType="text",u.setRequestHeader("Accept","application/json")),u.withCredentials=s.credentials==="include",u.onerror=()=>{l(new Error(u.statusText))},u.onload=()=>{if((u.status>=200&&u.status<300||u.status===0)&&u.response!==null){let d=u.response;if(s.type==="json")try{d=JSON.parse(u.response)}catch(f){return l(f)}l(null,d,u.getResponseHeader("Cache-Control"),u.getResponseHeader("Expires"))}else{const d=new Blob([u.response],{type:u.getResponseHeader("Content-Type")});l(new Nr(u.status,u.statusText,s.url,d))}},u.send(s.body),{cancel:()=>u.abort()}}(i,e)},Sn=function(i,e){return Tn(xi(i,{type:"arrayBuffer"}),e)};function rn(i){if(!i||i.indexOf("://")<=0||i.indexOf("data:image/")===0||i.indexOf("blob:")===0)return!0;const e=new URL(i),r=window.location;return e.protocol===r.protocol&&e.host===r.host}function Vr(i,e,r){r[i]&&r[i].indexOf(e)!==-1||(r[i]=r[i]||[],r[i].push(e))}function Er(i,e,r){if(r&&r[i]){const s=r[i].indexOf(e);s!==-1&&r[i].splice(s,1)}}class Ir{constructor(e,r={}){xi(this,r),this.type=e}}class Zi extends Ir{constructor(e,r={}){super("error",xi({error:e},r))}}class En{on(e,r){return this._listeners=this._listeners||{},Vr(e,r,this._listeners),this}off(e,r){return Er(e,r,this._listeners),Er(e,r,this._oneTimeListeners),this}once(e,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},Vr(e,r,this._oneTimeListeners),this):new Promise(s=>this.once(e,s))}fire(e,r){typeof e=="string"&&(e=new Ir(e,r||{}));const s=e.type;if(this.listens(s)){e.target=this;const l=this._listeners&&this._listeners[s]?this._listeners[s].slice():[];for(const f of l)f.call(this,e);const u=this._oneTimeListeners&&this._oneTimeListeners[s]?this._oneTimeListeners[s].slice():[];for(const f of u)Er(s,f,this._oneTimeListeners),f.call(this,e);const d=this._eventedParent;d&&(xi(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),d.fire(e))}else e instanceof Zi&&console.error(e.error);return this}listens(e){return this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)}setEventedParent(e,r){return this._eventedParent=e,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"},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:{}},default:"mapbox"},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-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},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"}}};const $r=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Hn(i,e){const r={};for(const s in i)s!=="ref"&&(r[s]=i[s]);return $r.forEach(s=>{s in e&&(r[s]=e[s])}),r}function vt(i,e){if(Array.isArray(i)){if(!Array.isArray(e)||i.length!==e.length)return!1;for(let r=0;r<i.length;r++)if(!vt(i[r],e[r]))return!1;return!0}if(typeof i=="object"&&i!==null&&e!==null){if(typeof e!="object"||Object.keys(i).length!==Object.keys(e).length)return!1;for(const r in i)if(!vt(i[r],e[r]))return!1;return!0}return i===e}const ct={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight"};function nn(i,e,r){r.push({command:ct.addSource,args:[i,e[i]]})}function Kn(i,e,r){e.push({command:ct.removeSource,args:[i]}),r[i]=!0}function Ts(i,e,r,s){Kn(i,r,s),nn(i,e,r)}function jt(i,e,r){let s;for(s in i[r])if(Object.prototype.hasOwnProperty.call(i[r],s)&&s!=="data"&&!vt(i[r][s],e[r][s]))return!1;for(s in e[r])if(Object.prototype.hasOwnProperty.call(e[r],s)&&s!=="data"&&!vt(i[r][s],e[r][s]))return!1;return!0}function sn(i,e,r,s,l,u){let d;for(d in e=e||{},i=i||{})Object.prototype.hasOwnProperty.call(i,d)&&(vt(i[d],e[d])||r.push({command:u,args:[s,d,e[d],l]}));for(d in e)Object.prototype.hasOwnProperty.call(e,d)&&!Object.prototype.hasOwnProperty.call(i,d)&&(vt(i[d],e[d])||r.push({command:u,args:[s,d,e[d],l]}))}function In(i){return i.id}function an(i,e){return i[e.id]=e,i}class we{constructor(e,r,s,l){this.message=(e?`${e}: `:"")+s,l&&(this.identifier=l),r!=null&&r.__line__&&(this.line=r.__line__)}}function ur(i,...e){for(const r of e)for(const s in r)i[s]=r[s];return i}class hi extends Error{constructor(e,r){super(r),this.message=r,this.key=e}}class An{constructor(e,r=[]){this.parent=e,this.bindings={};for(const[s,l]of r)this.bindings[s]=l}concat(e){return new An(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}const jr={kind:"null"},be={kind:"number"},it={kind:"string"},et={kind:"boolean"},Ai={kind:"color"},Kt={kind:"object"},Je={kind:"value"},Ar={kind:"collator"},Cr={kind:"formatted"},er={kind:"padding"},Pr={kind:"resolvedImage"};function ai(i,e){return{kind:"array",itemType:i,N:e}}function Tt(i){if(i.kind==="array"){const e=Tt(i.itemType);return typeof i.N=="number"?`array<${e}, ${i.N}>`:i.itemType.kind==="value"?"array":`array<${e}>`}return i.kind}const Yn=[jr,be,it,et,Ai,Cr,Kt,ai(Je),er,Pr];function dr(i,e){if(e.kind==="error")return null;if(i.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!dr(i.itemType,e.itemType))&&(typeof i.N!="number"||i.N===e.N))return null}else{if(i.kind===e.kind)return null;if(i.kind==="value"){for(const r of Yn)if(!dr(r,e))return null}}return`Expected ${Tt(i)} but found ${Tt(e)} instead.`}function N(i,e){return e.some(r=>r.kind===i.kind)}function I(i,e){return e.some(r=>r==="null"?i===null:r==="array"?Array.isArray(i):r==="object"?i&&!Array.isArray(i)&&typeof i=="object":r===typeof i)}function P(i,e){return i.kind==="array"&&e.kind==="array"?i.itemType.kind===e.itemType.kind&&typeof i.N=="number":i.kind===e.kind}const D=.96422,j=.82521,q=4/29,Y=6/29,X=3*Y*Y,G=Y*Y*Y,ee=Math.PI/180,ue=180/Math.PI;function pe(i){return(i%=360)<0&&(i+=360),i}function de([i,e,r,s]){let l,u;const d=Ye((.2225045*(i=qe(i))+.7168786*(e=qe(e))+.0606169*(r=qe(r)))/1);i===e&&e===r?l=u=d:(l=Ye((.4360747*i+.3850649*e+.1430804*r)/D),u=Ye((.0139322*i+.0971045*e+.7141733*r)/j));const f=116*d-16;return[f<0?0:f,500*(l-d),200*(d-u),s]}function qe(i){return i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function Ye(i){return i>G?Math.pow(i,1/3):i/X+q}function Re([i,e,r,s]){let l=(i+16)/116,u=isNaN(e)?l:l+e/500,d=isNaN(r)?l:l-r/200;return l=1*He(l),u=D*He(u),d=j*He(d),[Ne(3.1338561*u-1.6168667*l-.4906146*d),Ne(-.9787684*u+1.9161415*l+.033454*d),Ne(.0719453*u-.2289914*l+1.4052427*d),s]}function Ne(i){return(i=i<=.00304?12.92*i:1.055*Math.pow(i,1/2.4)-.055)<0?0:i>1?1:i}function He(i){return i>Y?i*i*i:X*(i-q)}function lt(i){return parseInt(i.padEnd(2,i),16)/255}function rt(i,e){return ht(e?i/100:i,0,1)}function ht(i,e,r){return Math.min(Math.max(e,i),r)}function bt(i){return!i.some(Number.isNaN)}const qt={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 We{constructor(e,r,s,l=1,u=!0){this.r=e,this.g=r,this.b=s,this.a=l,u||(this.r*=l,this.g*=l,this.b*=l,l||this.overwriteGetter("rgb",[e,r,s,l]))}static parse(e){if(e instanceof We)return e;if(typeof e!="string")return;const r=function(s){if((s=s.toLowerCase())==="transparent")return[0,0,0,0];const l=qt[s];if(l){const[d,f,g]=l;return[d/255,f/255,g/255,1]}if(s.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(s)){const d=s.length<6?1:2;let f=1;return[lt(s.slice(f,f+=d)),lt(s.slice(f,f+=d)),lt(s.slice(f,f+=d)),lt(s.slice(f,f+d)||"ff")]}if(s.startsWith("rgb")){const d=s.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(d){const[f,g,b,w,E,C,M,z,U,F,H,Q]=d,Z=[w||" ",M||" ",F].join("");if(Z===" "||Z===" /"||Z===",,"||Z===",,,"){const re=[b,C,U].join(""),se=re==="%%%"?100:re===""?255:0;if(se){const ce=[ht(+g/se,0,1),ht(+E/se,0,1),ht(+z/se,0,1),H?rt(+H,Q):1];if(bt(ce))return ce}}return}}const u=s.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(u){const[d,f,g,b,w,E,C,M,z]=u,U=[g||" ",w||" ",C].join("");if(U===" "||U===" /"||U===",,"||U===",,,"){const F=[+f,ht(+b,0,100),ht(+E,0,100),M?rt(+M,z):1];if(bt(F))return function([H,Q,Z,re]){function se(ce){const ze=(ce+H/30)%12,Be=Q*Math.min(Z,1-Z);return Z-Be*Math.max(-1,Math.min(ze-3,9-ze,1))}return H=pe(H),Q/=100,Z/=100,[se(0),se(8),se(4),re]}(F)}}}(e);return r?new We(...r,!1):void 0}get rgb(){const{r:e,g:r,b:s,a:l}=this,u=l||1/0;return this.overwriteGetter("rgb",[e/u,r/u,s/u,l])}get hcl(){return this.overwriteGetter("hcl",function(e){const[r,s,l,u]=de(e),d=Math.sqrt(s*s+l*l);return[Math.round(1e4*d)?pe(Math.atan2(l,s)*ue):NaN,d,r,u]}(this.rgb))}get lab(){return this.overwriteGetter("lab",de(this.rgb))}overwriteGetter(e,r){return Object.defineProperty(this,e,{value:r}),r}toString(){const[e,r,s,l]=this.rgb;return`rgba(${[e,r,s].map(u=>Math.round(255*u)).join(",")},${l})`}}We.black=new We(0,0,0,1),We.white=new We(1,1,1,1),We.transparent=new We(0,0,0,0),We.red=new We(1,0,0,1);class zt{constructor(e,r,s){this.sensitivity=e?r?"variant":"case":r?"accent":"base",this.locale=s,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,r){return this.collator.compare(e,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class qr{constructor(e,r,s,l,u){this.text=e,this.image=r,this.scale=s,this.fontStack=l,this.textColor=u}}class oi{constructor(e){this.sections=e}static fromString(e){return new oi([new qr(e,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(e=>e.text.length!==0||e.image&&e.image.name.length!==0)}static factory(e){return e instanceof oi?e:oi.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}}class Li{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Li)return e;if(typeof e=="number")return new Li([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const r of e)if(typeof r!="number")return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new Li(e)}}toString(){return JSON.stringify(this.values)}}class Xi{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new Xi({name:e,available:!1}):null}}function Cn(i,e,r,s){return typeof i=="number"&&i>=0&&i<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof r=="number"&&r>=0&&r<=255?s===void 0||typeof s=="number"&&s>=0&&s<=1?null:`Invalid rgba value [${[i,e,r,s].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof s=="number"?[i,e,r,s]:[i,e,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Ss(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof We||i instanceof zt||i instanceof oi||i instanceof Li||i instanceof Xi)return!0;if(Array.isArray(i)){for(const e of i)if(!Ss(e))return!1;return!0}if(typeof i=="object"){for(const e in i)if(!Ss(i[e]))return!1;return!0}return!1}function Gt(i){if(i===null)return jr;if(typeof i=="string")return it;if(typeof i=="boolean")return et;if(typeof i=="number")return be;if(i instanceof We)return Ai;if(i instanceof zt)return Ar;if(i instanceof oi)return Cr;if(i instanceof Li)return er;if(i instanceof Xi)return Pr;if(Array.isArray(i)){const e=i.length;let r;for(const s of i){const l=Gt(s);if(r){if(r===l)continue;r=Je;break}r=l}return ai(r||Je,e)}return Kt}function Jn(i){const e=typeof i;return i===null?"":e==="string"||e==="number"||e==="boolean"?String(i):i instanceof We||i instanceof oi||i instanceof Li||i instanceof Xi?i.toString():JSON.stringify(i)}class Gr{constructor(e,r){this.type=e,this.value=r}static parse(e,r){if(e.length!==2)return r.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!Ss(e[1]))return r.error("invalid value");const s=e[1];let l=Gt(s);const u=r.expectedType;return l.kind!=="array"||l.N!==0||!u||u.kind!=="array"||typeof u.N=="number"&&u.N!==0||(l=u),new Gr(l,s)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class Ot{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const Es={string:it,number:be,boolean:et,object:Kt};class tr{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let s,l=1;const u=e[0];if(u==="array"){let f,g;if(e.length>2){const b=e[1];if(typeof b!="string"||!(b in Es)||b==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);f=Es[b],l++}else f=Je;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return r.error('The length argument to "array" must be a positive integer literal',2);g=e[2],l++}s=ai(f,g)}else{if(!Es[u])throw new Error(`Types doesn't contain name = ${u}`);s=Es[u]}const d=[];for(;l<e.length;l++){const f=r.parse(e[l],l,Je);if(!f)return null;d.push(f)}return new tr(s,d)}evaluate(e){for(let r=0;r<this.args.length;r++){const s=this.args[r].evaluate(e);if(!dr(this.type,Gt(s)))return s;if(r===this.args.length-1)throw new Ot(`Expected value to be of type ${Tt(this.type)}, but found ${Tt(Gt(s))} instead.`)}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const Uo={"to-boolean":et,"to-color":Ai,"to-number":be,"to-string":it};class li{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");const s=e[0];if(!Uo[s])throw new Error(`Can't parse ${s} as it is not part of the known types`);if((s==="to-boolean"||s==="to-string")&&e.length!==2)return r.error("Expected one argument.");const l=Uo[s],u=[];for(let d=1;d<e.length;d++){const f=r.parse(e[d],d,Je);if(!f)return null;u.push(f)}return new li(l,u)}evaluate(e){if(this.type.kind==="boolean")return!!this.args[0].evaluate(e);if(this.type.kind==="color"){let r,s;for(const l of this.args){if(r=l.evaluate(e),s=null,r instanceof We)return r;if(typeof r=="string"){const u=e.parseColor(r);if(u)return u}else if(Array.isArray(r)&&(s=r.length<3||r.length>4?`Invalid rbga value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:Cn(r[0],r[1],r[2],r[3]),!s))return new We(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new Ot(s||`Could not parse color from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}if(this.type.kind==="padding"){let r;for(const s of this.args){r=s.evaluate(e);const l=Li.parse(r);if(l)return l}throw new Ot(`Could not parse padding from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}if(this.type.kind==="number"){let r=null;for(const s of this.args){if(r=s.evaluate(e),r===null)return 0;const l=Number(r);if(!isNaN(l))return l}throw new Ot(`Could not convert ${JSON.stringify(r)} to number.`)}return this.type.kind==="formatted"?oi.fromString(Jn(this.args[0].evaluate(e))):this.type.kind==="resolvedImage"?Xi.fromString(Jn(this.args[0].evaluate(e))):Jn(this.args[0].evaluate(e))}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const Ea=["Unknown","Point","LineString","Polygon"];class Is{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"?Ea[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(e){let r=this._parseColorCache[e];return r||(r=this._parseColorCache[e]=We.parse(e)),r}}class Zr{constructor(e,r,s=[],l,u=new An,d=[]){this.registry=e,this.path=s,this.key=s.map(f=>`[${f}]`).join(""),this.scope=u,this.errors=d,this.expectedType=l,this._isConstant=r}parse(e,r,s,l,u={}){return r?this.concat(r,s,l)._parse(e,u):this._parse(e,u)}_parse(e,r){function s(l,u,d){return d==="assert"?new tr(u,[l]):d==="coerce"?new li(u,[l]):l}if(e!==null&&typeof e!="string"&&typeof e!="boolean"&&typeof e!="number"||(e=["literal",e]),Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const l=e[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;const u=this.registry[l];if(u){let d=u.parse(e,this);if(!d)return null;if(this.expectedType){const 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(this.checkSubtype(f,g))return null}else d=s(d,f,r.typeAnnotation||"coerce");else d=s(d,f,r.typeAnnotation||"coerce");else d=s(d,f,r.typeAnnotation||"assert")}if(!(d instanceof Gr)&&d.type.kind!=="resolvedImage"&&this._isConstant(d)){const f=new Is;try{d=new Gr(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(e===void 0?"'undefined' value invalid. Use null instead.":typeof e=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,r,s){const l=typeof e=="number"?this.path.concat(e):this.path,u=s?this.scope.concat(s):this.scope;return new Zr(this.registry,this._isConstant,l,r||null,u,this.errors)}error(e,...r){const s=`${this.key}${r.map(l=>`[${l}]`).join("")}`;this.errors.push(new hi(s,e))}checkSubtype(e,r){const s=dr(e,r);return s&&this.error(s),s}}class mt{constructor(e,r,s){this.type=Ar,this.locale=s,this.caseSensitive=e,this.diacriticSensitive=r}static parse(e,r){if(e.length!==2)return r.error("Expected one argument.");const s=e[1];if(typeof s!="object"||Array.isArray(s))return r.error("Collator options argument must be an object.");const l=r.parse(s["case-sensitive"]!==void 0&&s["case-sensitive"],1,et);if(!l)return null;const u=r.parse(s["diacritic-sensitive"]!==void 0&&s["diacritic-sensitive"],1,et);if(!u)return null;let d=null;return s.locale&&(d=r.parse(s.locale,1,it),!d)?null:new mt(l,u,d)}evaluate(e){return new zt(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}}const Xr=8192;function Qn(i,e){i[0]=Math.min(i[0],e[0]),i[1]=Math.min(i[1],e[1]),i[2]=Math.max(i[2],e[0]),i[3]=Math.max(i[3],e[1])}function As(i,e){return!(i[0]<=e[0]||i[2]>=e[2]||i[1]<=e[1]||i[3]>=e[3])}function No(i,e){const r=(180+i[0])/360,s=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i[1]*Math.PI/360)))/360,l=Math.pow(2,e.z);return[Math.round(r*l*Xr),Math.round(s*l*Xr)]}function Vo(i,e,r){const s=i[0]-e[0],l=i[1]-e[1],u=i[0]-r[0],d=i[1]-r[1];return s*d-u*l==0&&s*u<=0&&l*d<=0}function Ia(i,e){let r=!1;for(let d=0,f=e.length;d<f;d++){const g=e[d];for(let b=0,w=g.length;b<w-1;b++){if(Vo(i,g[b],g[b+1]))return!1;(l=g[b])[1]>(s=i)[1]!=(u=g[b+1])[1]>s[1]&&s[0]<(u[0]-l[0])*(s[1]-l[1])/(u[1]-l[1])+l[0]&&(r=!r)}}var s,l,u;return r}function $o(i,e){for(let r=0;r<e.length;r++)if(Ia(i,e[r]))return!0;return!1}function Aa(i,e,r,s){const l=s[0]-r[0],u=s[1]-r[1],d=(i[0]-r[0])*u-l*(i[1]-r[1]),f=(e[0]-r[0])*u-l*(e[1]-r[1]);return d>0&&f<0||d<0&&f>0}function ic(i,e,r){for(const b of r)for(let w=0;w<b.length-1;++w)if((f=[(d=b[w+1])[0]-(u=b[w])[0],d[1]-u[1]])[0]*(g=[(l=e)[0]-(s=i)[0],l[1]-s[1]])[1]-f[1]*g[0]!=0&&Aa(s,l,u,d)&&Aa(u,d,s,l))return!0;var s,l,u,d,f,g;return!1}function jo(i,e){for(let r=0;r<i.length;++r)if(!Ia(i[r],e))return!1;for(let r=0;r<i.length-1;++r)if(ic(i[r],i[r+1],e))return!1;return!0}function rc(i,e){for(let r=0;r<e.length;r++)if(jo(i,e[r]))return!0;return!1}function Ca(i,e,r){const s=[];for(let l=0;l<i.length;l++){const u=[];for(let d=0;d<i[l].length;d++){const f=No(i[l][d],r);Qn(e,f),u.push(f)}s.push(u)}return s}function Pa(i,e,r){const s=[];for(let l=0;l<i.length;l++){const u=Ca(i[l],e,r);s.push(u)}return s}function Ma(i,e,r,s){if(i[0]<r[0]||i[0]>r[2]){const l=.5*s;let u=i[0]-r[0]>l?-s:r[0]-i[0]>l?s:0;u===0&&(u=i[0]-r[2]>l?-s:r[2]-i[0]>l?s:0),i[0]+=u}Qn(e,i)}function qo(i,e,r,s){const l=Math.pow(2,s.z)*Xr,u=[s.x*Xr,s.y*Xr],d=[];for(const f of i)for(const g of f){const b=[g.x+u[0],g.y+u[1]];Ma(b,e,r,l),d.push(b)}return d}function Go(i,e,r,s){const l=Math.pow(2,s.z)*Xr,u=[s.x*Xr,s.y*Xr],d=[];for(const g of i){const b=[];for(const w of g){const E=[w.x+u[0],w.y+u[1]];Qn(e,E),b.push(E)}d.push(b)}if(e[2]-e[0]<=l/2){(f=e)[0]=f[1]=1/0,f[2]=f[3]=-1/0;for(const g of d)for(const b of g)Ma(b,e,r,l)}var f;return d}class Mr{constructor(e,r){this.type=et,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Ss(e[1])){const s=e[1];if(s.type==="FeatureCollection")for(let l=0;l<s.features.length;++l){const u=s.features[l].geometry.type;if(u==="Polygon"||u==="MultiPolygon")return new Mr(s,s.features[l].geometry)}else if(s.type==="Feature"){const l=s.geometry.type;if(l==="Polygon"||l==="MultiPolygon")return new Mr(s,s.geometry)}else if(s.type==="Polygon"||s.type==="MultiPolygon")return new Mr(s,s)}return r.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return function(r,s){const l=[1/0,1/0,-1/0,-1/0],u=[1/0,1/0,-1/0,-1/0],d=r.canonicalID();if(s.type==="Polygon"){const f=Ca(s.coordinates,u,d),g=qo(r.geometry(),l,u,d);if(!As(l,u))return!1;for(const b of g)if(!Ia(b,f))return!1}if(s.type==="MultiPolygon"){const f=Pa(s.coordinates,u,d),g=qo(r.geometry(),l,u,d);if(!As(l,u))return!1;for(const b of g)if(!$o(b,f))return!1}return!0}(e,this.geometries);if(e.geometryType()==="LineString")return function(r,s){const l=[1/0,1/0,-1/0,-1/0],u=[1/0,1/0,-1/0,-1/0],d=r.canonicalID();if(s.type==="Polygon"){const f=Ca(s.coordinates,u,d),g=Go(r.geometry(),l,u,d);if(!As(l,u))return!1;for(const b of g)if(!jo(b,f))return!1}if(s.type==="MultiPolygon"){const f=Pa(s.coordinates,u,d),g=Go(r.geometry(),l,u,d);if(!As(l,u))return!1;for(const b of g)if(!rc(b,f))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class Cs{constructor(e,r){this.type=r.type,this.name=e,this.boundExpression=r}static parse(e,r){if(e.length!==2||typeof e[1]!="string")return r.error("'var' expression requires exactly one string literal argument.");const s=e[1];return r.scope.has(s)?new Cs(s,r.scope.get(s)):r.error(`Unknown variable "${s}". Make sure "${s}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}}class Wi{constructor(e,r,s,l){this.name=e,this.type=r,this._evaluate=s,this.args=l}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,r){const s=e[0],l=Wi.definitions[s];if(!l)return r.error(`Unknown expression "${s}". If you wanted a literal array, use ["literal", [...]].`,0);const u=Array.isArray(l)?l[0]:l.type,d=Array.isArray(l)?[[l[1],l[2]]]:l.overloads,f=d.filter(([b])=>!Array.isArray(b)||b.length===e.length-1);let g=null;for(const[b,w]of f){g=new Zr(r.registry,Ps,r.path,null,r.scope);const E=[];let C=!1;for(let M=1;M<e.length;M++){const z=e[M],U=Array.isArray(b)?b[M-1]:b.type,F=g.parse(z,1+E.length,U);if(!F){C=!0;break}E.push(F)}if(!C)if(Array.isArray(b)&&b.length!==E.length)g.error(`Expected ${b.length} arguments, but found ${E.length} instead.`);else{for(let M=0;M<E.length;M++){const z=Array.isArray(b)?b[M]:b.type,U=E[M];g.concat(M+1).checkSubtype(z,U.type)}if(g.errors.length===0)return new Wi(s,u,w,E)}}if(f.length===1)r.errors.push(...g.errors);else{const b=(f.length?f:d).map(([E])=>{return C=E,Array.isArray(C)?`(${C.map(Tt).join(", ")})`:`(${Tt(C.type)}...)`;var C}).join(" | "),w=[];for(let E=1;E<e.length;E++){const C=r.parse(e[E],1+w.length);if(!C)return null;w.push(Tt(C.type))}r.error(`Expected arguments of type ${b}, but found (${w.join(", ")}) instead.`)}return null}static register(e,r){Wi.definitions=r;for(const s in r)e[s]=Wi}}function Ps(i){if(i instanceof Cs)return Ps(i.boundExpression);if(i instanceof Wi&&i.name==="error"||i instanceof mt||i instanceof Mr)return!1;const e=i instanceof li||i instanceof tr;let r=!0;return i.eachChild(s=>{r=e?r&&Ps(s):r&&s instanceof Gr}),!!r&&es(i)&&Ms(i,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function es(i){if(i instanceof Wi&&(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 Mr)return!1;let e=!0;return i.eachChild(r=>{e&&!es(r)&&(e=!1)}),e}function Pn(i){if(i instanceof Wi&&i.name==="feature-state")return!1;let e=!0;return i.eachChild(r=>{e&&!Pn(r)&&(e=!1)}),e}function Ms(i,e){if(i instanceof Wi&&e.indexOf(i.name)>=0)return!1;let r=!0;return i.eachChild(s=>{r&&!Ms(s,e)&&(r=!1)}),r}function ks(i,e){const r=i.length-1;let s,l,u=0,d=r,f=0;for(;u<=d;)if(f=Math.floor((u+d)/2),s=i[f],l=i[f+1],s<=e){if(f===r||e<l)return f;u=f+1}else{if(!(s>e))throw new Ot("Input is not a number.");d=f-1}return 0}class Mn{constructor(e,r,s){this.type=e,this.input=r,this.labels=[],this.outputs=[];for(const[l,u]of s)this.labels.push(l),this.outputs.push(u)}static parse(e,r){if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");const s=r.parse(e[1],1,be);if(!s)return null;const l=[];let u=null;r.expectedType&&r.expectedType.kind!=="value"&&(u=r.expectedType);for(let d=1;d<e.length;d+=2){const f=d===1?-1/0:e[d],g=e[d+1],b=d,w=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.',b);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.',b);const E=r.parse(g,w,u);if(!E)return null;u=u||E.type,l.push([f,E])}return new Mn(u,s,l)}evaluate(e){const r=this.labels,s=this.outputs;if(r.length===1)return s[0].evaluate(e);const l=this.input.evaluate(e);if(l<=r[0])return s[0].evaluate(e);const u=r.length;return l>=r[u-1]?s[u-1].evaluate(e):s[ks(r,l)].evaluate(e)}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function kn(i,e,r){return i+r*(e-i)}function Ls(i,e,r){return i.map((s,l)=>kn(s,e[l],r))}const zi={number:kn,color:function(i,e,r,s="rgb"){switch(s){case"rgb":{const[l,u,d,f]=Ls(i.rgb,e.rgb,r);return new We(l,u,d,f,!1)}case"hcl":{const[l,u,d,f]=i.hcl,[g,b,w,E]=e.hcl;let C,M;if(isNaN(l)||isNaN(g))isNaN(l)?isNaN(g)?C=NaN:(C=g,d!==1&&d!==0||(M=b)):(C=l,w!==1&&w!==0||(M=u));else{let Q=g-l;g>l&&Q>180?Q-=360:g<l&&l-g>180&&(Q+=360),C=l+r*Q}const[z,U,F,H]=function([Q,Z,re,se]){return Q=isNaN(Q)?0:Q*ee,Re([re,Math.cos(Q)*Z,Math.sin(Q)*Z,se])}([C,M??kn(u,b,r),kn(d,w,r),kn(f,E,r)]);return new We(z,U,F,H,!1)}case"lab":{const[l,u,d,f]=Re(Ls(i.lab,e.lab,r));return new We(l,u,d,f,!1)}}},array:Ls,padding:function(i,e,r){return new Li(Ls(i.values,e.values,r))}};class Di{constructor(e,r,s,l,u){this.type=e,this.operator=r,this.interpolation=s,this.input=l,this.labels=[],this.outputs=[];for(const[d,f]of u)this.labels.push(d),this.outputs.push(f)}static interpolationFactor(e,r,s,l){let u=0;if(e.name==="exponential")u=ka(r,e.base,s,l);else if(e.name==="linear")u=ka(r,1,s,l);else if(e.name==="cubic-bezier"){const d=e.controlPoints;u=new je(d[0],d[1],d[2],d[3]).solve(ka(r,1,s,l))}return u}static parse(e,r){let[s,l,u,...d]=e;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"){const b=l[1];if(typeof b!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);l={name:"exponential",base:b}}else{if(l[0]!=="cubic-bezier")return r.error(`Unknown interpolation type ${String(l[0])}`,1,0);{const b=l.slice(1);if(b.length!==4||b.some(w=>typeof w!="number"||w<0||w>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);l={name:"cubic-bezier",controlPoints:b}}}if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(u=r.parse(u,2,be),!u)return null;const f=[];let g=null;s==="interpolate-hcl"||s==="interpolate-lab"?g=Ai:r.expectedType&&r.expectedType.kind!=="value"&&(g=r.expectedType);for(let b=0;b<d.length;b+=2){const w=d[b],E=d[b+1],C=b+3,M=b+4;if(typeof w!="number")return r.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',C);if(f.length&&f[f.length-1][0]>=w)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',C);const z=r.parse(E,M,g);if(!z)return null;g=g||z.type,f.push([w,z])}return P(g,be)||P(g,Ai)||P(g,er)||P(g,ai(be))?new Di(g,s,l,u,f):r.error(`Type ${Tt(g)} is not interpolatable.`)}evaluate(e){const r=this.labels,s=this.outputs;if(r.length===1)return s[0].evaluate(e);const l=this.input.evaluate(e);if(l<=r[0])return s[0].evaluate(e);const u=r.length;if(l>=r[u-1])return s[u-1].evaluate(e);const d=ks(r,l),f=Di.interpolationFactor(this.interpolation,l,r[d],r[d+1]),g=s[d].evaluate(e),b=s[d+1].evaluate(e);switch(this.operator){case"interpolate":return zi[this.type.kind](g,b,f);case"interpolate-hcl":return zi.color(g,b,f,"hcl");case"interpolate-lab":return zi.color(g,b,f,"lab")}}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function ka(i,e,r,s){const l=s-r,u=i-r;return l===0?0:e===1?u/l:(Math.pow(e,u)-1)/(Math.pow(e,l)-1)}class zs{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expectected at least one argument.");let s=null;const l=r.expectedType;l&&l.kind!=="value"&&(s=l);const u=[];for(const f of e.slice(1)){const g=r.parse(f,1+u.length,s,void 0,{typeAnnotation:"omit"});if(!g)return null;s=s||g.type,u.push(g)}if(!s)throw new Error("No output type");const d=l&&u.some(f=>dr(l,f.type));return new zs(d?Je:s,u)}evaluate(e){let r,s=null,l=0;for(const u of this.args)if(l++,s=u.evaluate(e),s&&s instanceof Xi&&!s.available&&(r||(r=s.name),s=null,l===this.args.length&&(s=r)),s!==null)break;return s}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}class Ds{constructor(e,r){this.type=r.type,this.bindings=[].concat(e),this.result=r}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const r of this.bindings)e(r[1]);e(this.result)}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const s=[];for(let u=1;u<e.length-1;u+=2){const d=e[u];if(typeof d!="string")return r.error(`Expected string, but found ${typeof d} instead.`,u);if(/[^a-zA-Z0-9_]/.test(d))return r.error("Variable names must contain only alphanumeric characters or '_'.",u);const f=r.parse(e[u+1],u+1);if(!f)return null;s.push([d,f])}const l=r.parse(e[e.length-1],e.length-1,r.expectedType,s);return l?new Ds(s,l):null}outputDefined(){return this.result.outputDefined()}}class La{constructor(e,r,s){this.type=e,this.index=r,this.input=s}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const s=r.parse(e[1],1,be),l=r.parse(e[2],2,ai(r.expectedType||Je));return s&&l?new La(l.type.itemType,s,l):null}evaluate(e){const r=this.index.evaluate(e),s=this.input.evaluate(e);if(r<0)throw new Ot(`Array index out of bounds: ${r} < 0.`);if(r>=s.length)throw new Ot(`Array index out of bounds: ${r} > ${s.length-1}.`);if(r!==Math.floor(r))throw new Ot(`Array index must be an integer, but found ${r} instead.`);return s[r]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class ts{constructor(e,r){this.type=et,this.needle=e,this.haystack=r}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const s=r.parse(e[1],1,Je),l=r.parse(e[2],2,Je);return s&&l?N(s.type,[et,it,be,jr,Je])?new ts(s,l):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${Tt(s.type)} instead`):null}evaluate(e){const r=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(!s)return!1;if(!I(r,["boolean","string","number","null"]))throw new Ot(`Expected first argument to be of type boolean, string, number or null, but found ${Tt(Gt(r))} instead.`);if(!I(s,["string","array"]))throw new Ot(`Expected second argument to be of type array or string, but found ${Tt(Gt(s))} instead.`);return s.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class on{constructor(e,r,s){this.type=be,this.needle=e,this.haystack=r,this.fromIndex=s}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const s=r.parse(e[1],1,Je),l=r.parse(e[2],2,Je);if(!s||!l)return null;if(!N(s.type,[et,it,be,jr,Je]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${Tt(s.type)} instead`);if(e.length===4){const u=r.parse(e[3],3,be);return u?new on(s,l,u):null}return new on(s,l)}evaluate(e){const r=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(!I(r,["boolean","string","number","null"]))throw new Ot(`Expected first argument to be of type boolean, string, number or null, but found ${Tt(Gt(r))} instead.`);if(!I(s,["string","array"]))throw new Ot(`Expected second argument to be of type array or string, but found ${Tt(Gt(s))} instead.`);if(this.fromIndex){const l=this.fromIndex.evaluate(e);return s.indexOf(r,l)}return s.indexOf(r)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class ut{constructor(e,r,s,l,u,d){this.inputType=e,this.type=r,this.input=s,this.cases=l,this.outputs=u,this.otherwise=d}static parse(e,r){if(e.length<5)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return r.error("Expected an even number of arguments.");let s,l;r.expectedType&&r.expectedType.kind!=="value"&&(l=r.expectedType);const u={},d=[];for(let b=2;b<e.length-1;b+=2){let w=e[b];const E=e[b+1];Array.isArray(w)||(w=[w]);const C=r.concat(b);if(w.length===0)return C.error("Expected at least one branch label.");for(const z of w){if(typeof z!="number"&&typeof z!="string")return C.error("Branch labels must be numbers or strings.");if(typeof z=="number"&&Math.abs(z)>Number.MAX_SAFE_INTEGER)return C.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof z=="number"&&Math.floor(z)!==z)return C.error("Numeric branch labels must be integer values.");if(s){if(C.checkSubtype(s,Gt(z)))return null}else s=Gt(z);if(u[String(z)]!==void 0)return C.error("Branch labels must be unique.");u[String(z)]=d.length}const M=r.parse(E,b,l);if(!M)return null;l=l||M.type,d.push(M)}const f=r.parse(e[1],1,Je);if(!f)return null;const g=r.parse(e[e.length-1],e.length-1,l);return g?f.type.kind!=="value"&&r.concat(1).checkSubtype(s,f.type)?null:new ut(s,l,f,u,d,g):null}evaluate(e){const r=this.input.evaluate(e);return(Gt(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}}class za{constructor(e,r,s){this.type=e,this.branches=r,this.otherwise=s}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return r.error("Expected an odd number of arguments.");let s;r.expectedType&&r.expectedType.kind!=="value"&&(s=r.expectedType);const l=[];for(let d=1;d<e.length-1;d+=2){const f=r.parse(e[d],d,et);if(!f)return null;const g=r.parse(e[d+1],d+1,s);if(!g)return null;l.push([f,g]),s=s||g.type}const u=r.parse(e[e.length-1],e.length-1,s);if(!u)return null;if(!s)throw new Error("Can't infer output type");return new za(s,l,u)}evaluate(e){for(const[r,s]of this.branches)if(r.evaluate(e))return s.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[r,s]of this.branches)e(r),e(s);e(this.otherwise)}outputDefined(){return this.branches.every(([e,r])=>r.outputDefined())&&this.otherwise.outputDefined()}}class Rs{constructor(e,r,s,l){this.type=e,this.input=r,this.beginIndex=s,this.endIndex=l}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const s=r.parse(e[1],1,Je),l=r.parse(e[2],2,be);if(!s||!l)return null;if(!N(s.type,[ai(Je),it,Je]))return r.error(`Expected first argument to be of type array or string, but found ${Tt(s.type)} instead`);if(e.length===4){const u=r.parse(e[3],3,be);return u?new Rs(s.type,s,l,u):null}return new Rs(s.type,s,l)}evaluate(e){const r=this.input.evaluate(e),s=this.beginIndex.evaluate(e);if(!I(r,["string","array"]))throw new Ot(`Expected first argument to be of type array or string, but found ${Tt(Gt(r))} instead.`);if(this.endIndex){const l=this.endIndex.evaluate(e);return r.slice(s,l)}return r.slice(s)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function Zo(i,e){return i==="=="||i==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function Xo(i,e,r,s){return s.compare(e,r)===0}function Ln(i,e,r){const s=i!=="=="&&i!=="!=";return class Kd{constructor(u,d,f){this.type=et,this.lhs=u,this.rhs=d,this.collator=f,this.hasUntypedArgument=u.type.kind==="value"||d.type.kind==="value"}static parse(u,d){if(u.length!==3&&u.length!==4)return d.error("Expected two or three arguments.");const f=u[0];let g=d.parse(u[1],1,Je);if(!g)return null;if(!Zo(f,g.type))return d.concat(1).error(`"${f}" comparisons are not supported for type '${Tt(g.type)}'.`);let b=d.parse(u[2],2,Je);if(!b)return null;if(!Zo(f,b.type))return d.concat(2).error(`"${f}" comparisons are not supported for type '${Tt(b.type)}'.`);if(g.type.kind!==b.type.kind&&g.type.kind!=="value"&&b.type.kind!=="value")return d.error(`Cannot compare types '${Tt(g.type)}' and '${Tt(b.type)}'.`);s&&(g.type.kind==="value"&&b.type.kind!=="value"?g=new tr(b.type,[g]):g.type.kind!=="value"&&b.type.kind==="value"&&(b=new tr(g.type,[b])));let w=null;if(u.length===4){if(g.type.kind!=="string"&&b.type.kind!=="string"&&g.type.kind!=="value"&&b.type.kind!=="value")return d.error("Cannot use collator to compare non-string types.");if(w=d.parse(u[3],3,Ar),!w)return null}return new Kd(g,b,w)}evaluate(u){const d=this.lhs.evaluate(u),f=this.rhs.evaluate(u);if(s&&this.hasUntypedArgument){const g=Gt(d),b=Gt(f);if(g.kind!==b.kind||g.kind!=="string"&&g.kind!=="number")throw new Ot(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${g.kind}, ${b.kind}) instead.`)}if(this.collator&&!s&&this.hasUntypedArgument){const g=Gt(d),b=Gt(f);if(g.kind!=="string"||b.kind!=="string")return e(u,d,f)}return this.collator?r(u,d,f,this.collator.evaluate(u)):e(u,d,f)}eachChild(u){u(this.lhs),u(this.rhs),this.collator&&u(this.collator)}outputDefined(){return!0}}}const nc=Ln("==",function(i,e,r){return e===r},Xo),sc=Ln("!=",function(i,e,r){return e!==r},function(i,e,r,s){return!Xo(0,e,r,s)}),ac=Ln("<",function(i,e,r){return e<r},function(i,e,r,s){return s.compare(e,r)<0}),oc=Ln(">",function(i,e,r){return e>r},function(i,e,r,s){return s.compare(e,r)>0}),lc=Ln("<=",function(i,e,r){return e<=r},function(i,e,r,s){return s.compare(e,r)<=0}),cc=Ln(">=",function(i,e,r){return e>=r},function(i,e,r,s){return s.compare(e,r)>=0});class Da{constructor(e,r,s,l,u){this.type=it,this.number=e,this.locale=r,this.currency=s,this.minFractionDigits=l,this.maxFractionDigits=u}static parse(e,r){if(e.length!==3)return r.error("Expected two arguments.");const s=r.parse(e[1],1,be);if(!s)return null;const l=e[2];if(typeof l!="object"||Array.isArray(l))return r.error("NumberFormat options argument must be an object.");let u=null;if(l.locale&&(u=r.parse(l.locale,1,it),!u))return null;let d=null;if(l.currency&&(d=r.parse(l.currency,1,it),!d))return null;let f=null;if(l["min-fraction-digits"]&&(f=r.parse(l["min-fraction-digits"],1,be),!f))return null;let g=null;return l["max-fraction-digits"]&&(g=r.parse(l["max-fraction-digits"],1,be),!g)?null:new Da(s,u,d,f,g)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class Bs{constructor(e){this.type=Cr,this.sections=e}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");const s=e[1];if(!Array.isArray(s)&&typeof s=="object")return r.error("First argument must be an image or text section.");const l=[];let u=!1;for(let d=1;d<=e.length-1;++d){const f=e[d];if(u&&typeof f=="object"&&!Array.isArray(f)){u=!1;let g=null;if(f["font-scale"]&&(g=r.parse(f["font-scale"],1,be),!g))return null;let b=null;if(f["text-font"]&&(b=r.parse(f["text-font"],1,ai(it)),!b))return null;let w=null;if(f["text-color"]&&(w=r.parse(f["text-color"],1,Ai),!w))return null;const E=l[l.length-1];E.scale=g,E.font=b,E.textColor=w}else{const g=r.parse(e[d],1,Je);if(!g)return null;const b=g.type.kind;if(b!=="string"&&b!=="value"&&b!=="null"&&b!=="resolvedImage")return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");u=!0,l.push({content:g,scale:null,font:null,textColor:null})}}return new Bs(l)}evaluate(e){return new oi(this.sections.map(r=>{const s=r.content.evaluate(e);return Gt(s)===Pr?new qr("",s,null,null,null):new qr(Jn(s),null,r.scale?r.scale.evaluate(e):null,r.font?r.font.evaluate(e).join(","):null,r.textColor?r.textColor.evaluate(e):null)}))}eachChild(e){for(const r of this.sections)e(r.content),r.scale&&e(r.scale),r.font&&e(r.font),r.textColor&&e(r.textColor)}outputDefined(){return!1}}class Ra{constructor(e){this.type=Pr,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected two arguments.");const s=r.parse(e[1],1,it);return s?new Ra(s):r.error("No image name provided.")}evaluate(e){const r=this.input.evaluate(e),s=Xi.fromString(r);return s&&e.availableImages&&(s.available=e.availableImages.indexOf(r)>-1),s}eachChild(e){e(this.input)}outputDefined(){return!1}}class Ba{constructor(e){this.type=be,this.input=e}static parse(e,r){if(e.length!==2)return r.error(`Expected 1 argument, but found ${e.length-1} instead.`);const s=r.parse(e[1],1);return s?s.type.kind!=="array"&&s.type.kind!=="string"&&s.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${Tt(s.type)} instead.`):new Ba(s):null}evaluate(e){const r=this.input.evaluate(e);if(typeof r=="string"||Array.isArray(r))return r.length;throw new Ot(`Expected value to be of type string or array, but found ${Tt(Gt(r))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const zn={"==":nc,"!=":sc,">":oc,"<":ac,">=":cc,"<=":lc,array:tr,at:La,boolean:tr,case:za,coalesce:zs,collator:mt,format:Bs,image:Ra,in:ts,"index-of":on,interpolate:Di,"interpolate-hcl":Di,"interpolate-lab":Di,length:Ba,let:Ds,literal:Gr,match:ut,number:tr,"number-format":Da,object:tr,slice:Rs,step:Mn,string:tr,"to-boolean":li,"to-color":li,"to-number":li,"to-string":li,var:Cs,within:Mr};function Wo(i,[e,r,s,l]){e=e.evaluate(i),r=r.evaluate(i),s=s.evaluate(i);const u=l?l.evaluate(i):1,d=Cn(e,r,s,u);if(d)throw new Ot(d);return new We(e/255,r/255,s/255,u,!1)}function Ho(i,e){return i in e}function Fa(i,e){const r=e[i];return r===void 0?null:r}function ln(i){return{type:i}}function Ko(i){return{result:"success",value:i}}function Dn(i){return{result:"error",value:i}}function Rn(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function Yo(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function Oa(i){return!!i.expression&&i.expression.interpolated}function _t(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":i===null?"null":typeof i}function Fs(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function hc(i){return i}function Jo(i,e){const r=e.type==="color",s=i.stops&&typeof i.stops[0][0]=="object",l=s||!(s||i.property!==void 0),u=i.type||(Oa(e)?"exponential":"interval");if(r||e.type==="padding"){const w=r?We.parse:Li.parse;(i=ur({},i)).stops&&(i.stops=i.stops.map(E=>[E[0],w(E[1])])),i.default=w(i.default?i.default:e.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,b;if(u==="exponential")f=Qo;else if(u==="interval")f=Ua;else if(u==="categorical"){f=uc,g=Object.create(null);for(const w of i.stops)g[w[0]]=w[1];b=typeof i.stops[0][0]}else{if(u!=="identity")throw new Error(`Unknown function type "${u}"`);f=dc}if(s){const w={},E=[];for(let z=0;z<i.stops.length;z++){const U=i.stops[z],F=U[0].zoom;w[F]===void 0&&(w[F]={zoom:F,type:i.type,property:i.property,default:i.default,stops:[]},E.push(F)),w[F].stops.push([U[0].value,U[1]])}const C=[];for(const z of E)C.push([w[z].zoom,Jo(w[z],e)]);const M={name:"linear"};return{kind:"composite",interpolationType:M,interpolationFactor:Di.interpolationFactor.bind(void 0,M),zoomStops:C.map(z=>z[0]),evaluate:({zoom:z},U)=>Qo({stops:C,base:i.base},e,z).evaluate(z,U)}}if(l){const w=u==="exponential"?{name:"exponential",base:i.base!==void 0?i.base:1}:null;return{kind:"camera",interpolationType:w,interpolationFactor:Di.interpolationFactor.bind(void 0,w),zoomStops:i.stops.map(E=>E[0]),evaluate:({zoom:E})=>f(i,e,E,g,b)}}return{kind:"source",evaluate(w,E){const C=E&&E.properties?E.properties[i.property]:void 0;return C===void 0?is(i.default,e.default):f(i,e,C,g,b)}}}function is(i,e,r){return i!==void 0?i:e!==void 0?e:r!==void 0?r:void 0}function uc(i,e,r,s,l){return is(typeof r===l?s[r]:void 0,i.default,e.default)}function Ua(i,e,r){if(_t(r)!=="number")return is(i.default,e.default);const s=i.stops.length;if(s===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[s-1][0])return i.stops[s-1][1];const l=ks(i.stops.map(u=>u[0]),r);return i.stops[l][1]}function Qo(i,e,r){const s=i.base!==void 0?i.base:1;if(_t(r)!=="number")return is(i.default,e.default);const 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];const u=ks(i.stops.map(w=>w[0]),r),d=function(w,E,C,M){const z=M-C,U=w-C;return z===0?0:E===1?U/z:(Math.pow(E,U)-1)/(Math.pow(E,z)-1)}(r,s,i.stops[u][0],i.stops[u+1][0]),f=i.stops[u][1],g=i.stops[u+1][1],b=zi[e.type]||hc;return typeof f.evaluate=="function"?{evaluate(...w){const E=f.evaluate.apply(void 0,w),C=g.evaluate.apply(void 0,w);if(E!==void 0&&C!==void 0)return b(E,C,d,i.colorSpace)}}:b(f,g,d,i.colorSpace)}function dc(i,e,r){switch(e.type){case"color":r=We.parse(r);break;case"formatted":r=oi.fromString(r.toString());break;case"resolvedImage":r=Xi.fromString(r.toString());break;case"padding":r=Li.parse(r);break;default:_t(r)===e.type||e.type==="enum"&&e.values[r]||(r=void 0)}return is(r,i.default,e.default)}Wi.register(zn,{error:[{kind:"error"},[it],(i,[e])=>{throw new Ot(e.evaluate(i))}],typeof:[it,[Je],(i,[e])=>Tt(Gt(e.evaluate(i)))],"to-rgba":[ai(be,4),[Ai],(i,[e])=>{const[r,s,l,u]=e.evaluate(i).rgb;return[255*r,255*s,255*l,u]}],rgb:[Ai,[be,be,be],Wo],rgba:[Ai,[be,be,be,be],Wo],has:{type:et,overloads:[[[it],(i,[e])=>Ho(e.evaluate(i),i.properties())],[[it,Kt],(i,[e,r])=>Ho(e.evaluate(i),r.evaluate(i))]]},get:{type:Je,overloads:[[[it],(i,[e])=>Fa(e.evaluate(i),i.properties())],[[it,Kt],(i,[e,r])=>Fa(e.evaluate(i),r.evaluate(i))]]},"feature-state":[Je,[it],(i,[e])=>Fa(e.evaluate(i),i.featureState||{})],properties:[Kt,[],i=>i.properties()],"geometry-type":[it,[],i=>i.geometryType()],id:[Je,[],i=>i.id()],zoom:[be,[],i=>i.globals.zoom],"heatmap-density":[be,[],i=>i.globals.heatmapDensity||0],"line-progress":[be,[],i=>i.globals.lineProgress||0],accumulated:[Je,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[be,ln(be),(i,e)=>{let r=0;for(const s of e)r+=s.evaluate(i);return r}],"*":[be,ln(be),(i,e)=>{let r=1;for(const s of e)r*=s.evaluate(i);return r}],"-":{type:be,overloads:[[[be,be],(i,[e,r])=>e.evaluate(i)-r.evaluate(i)],[[be],(i,[e])=>-e.evaluate(i)]]},"/":[be,[be,be],(i,[e,r])=>e.evaluate(i)/r.evaluate(i)],"%":[be,[be,be],(i,[e,r])=>e.evaluate(i)%r.evaluate(i)],ln2:[be,[],()=>Math.LN2],pi:[be,[],()=>Math.PI],e:[be,[],()=>Math.E],"^":[be,[be,be],(i,[e,r])=>Math.pow(e.evaluate(i),r.evaluate(i))],sqrt:[be,[be],(i,[e])=>Math.sqrt(e.evaluate(i))],log10:[be,[be],(i,[e])=>Math.log(e.evaluate(i))/Math.LN10],ln:[be,[be],(i,[e])=>Math.log(e.evaluate(i))],log2:[be,[be],(i,[e])=>Math.log(e.evaluate(i))/Math.LN2],sin:[be,[be],(i,[e])=>Math.sin(e.evaluate(i))],cos:[be,[be],(i,[e])=>Math.cos(e.evaluate(i))],tan:[be,[be],(i,[e])=>Math.tan(e.evaluate(i))],asin:[be,[be],(i,[e])=>Math.asin(e.evaluate(i))],acos:[be,[be],(i,[e])=>Math.acos(e.evaluate(i))],atan:[be,[be],(i,[e])=>Math.atan(e.evaluate(i))],min:[be,ln(be),(i,e)=>Math.min(...e.map(r=>r.evaluate(i)))],max:[be,ln(be),(i,e)=>Math.max(...e.map(r=>r.evaluate(i)))],abs:[be,[be],(i,[e])=>Math.abs(e.evaluate(i))],round:[be,[be],(i,[e])=>{const r=e.evaluate(i);return r<0?-Math.round(-r):Math.round(r)}],floor:[be,[be],(i,[e])=>Math.floor(e.evaluate(i))],ceil:[be,[be],(i,[e])=>Math.ceil(e.evaluate(i))],"filter-==":[et,[it,Je],(i,[e,r])=>i.properties()[e.value]===r.value],"filter-id-==":[et,[Je],(i,[e])=>i.id()===e.value],"filter-type-==":[et,[it],(i,[e])=>i.geometryType()===e.value],"filter-<":[et,[it,Je],(i,[e,r])=>{const s=i.properties()[e.value],l=r.value;return typeof s==typeof l&&s<l}],"filter-id-<":[et,[Je],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r<s}],"filter->":[et,[it,Je],(i,[e,r])=>{const s=i.properties()[e.value],l=r.value;return typeof s==typeof l&&s>l}],"filter-id->":[et,[Je],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r>s}],"filter-<=":[et,[it,Je],(i,[e,r])=>{const s=i.properties()[e.value],l=r.value;return typeof s==typeof l&&s<=l}],"filter-id-<=":[et,[Je],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r<=s}],"filter->=":[et,[it,Je],(i,[e,r])=>{const s=i.properties()[e.value],l=r.value;return typeof s==typeof l&&s>=l}],"filter-id->=":[et,[Je],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r>=s}],"filter-has":[et,[Je],(i,[e])=>e.value in i.properties()],"filter-has-id":[et,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[et,[ai(it)],(i,[e])=>e.value.indexOf(i.geometryType())>=0],"filter-id-in":[et,[ai(Je)],(i,[e])=>e.value.indexOf(i.id())>=0],"filter-in-small":[et,[it,ai(Je)],(i,[e,r])=>r.value.indexOf(i.properties()[e.value])>=0],"filter-in-large":[et,[it,ai(Je)],(i,[e,r])=>function(s,l,u,d){for(;u<=d;){const f=u+d>>1;if(l[f]===s)return!0;l[f]>s?d=f-1:u=f+1}return!1}(i.properties()[e.value],r.value,0,r.value.length-1)],all:{type:et,overloads:[[[et,et],(i,[e,r])=>e.evaluate(i)&&r.evaluate(i)],[ln(et),(i,e)=>{for(const r of e)if(!r.evaluate(i))return!1;return!0}]]},any:{type:et,overloads:[[[et,et],(i,[e,r])=>e.evaluate(i)||r.evaluate(i)],[ln(et),(i,e)=>{for(const r of e)if(r.evaluate(i))return!0;return!1}]]},"!":[et,[et],(i,[e])=>!e.evaluate(i)],"is-supported-script":[et,[it],(i,[e])=>{const r=i.globals&&i.globals.isSupportedScript;return!r||r(e.evaluate(i))}],upcase:[it,[it],(i,[e])=>e.evaluate(i).toUpperCase()],downcase:[it,[it],(i,[e])=>e.evaluate(i).toLowerCase()],concat:[it,ln(Je),(i,e)=>e.map(r=>Jn(r.evaluate(i))).join("")],"resolved-locale":[it,[Ar],(i,[e])=>e.evaluate(i).resolvedLocale()]});class Na{constructor(e,r){var s;this.expression=e,this._warningHistory={},this._evaluator=new Is,this._defaultValue=r?(s=r).type==="color"&&Fs(s.default)?new We(0,0,0,0):s.type==="color"?We.parse(s.default)||null:s.type==="padding"?Li.parse(s.default)||null:s.default===void 0?null:s.default:null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(e,r,s,l,u,d){return this._evaluator.globals=e,this._evaluator.feature=r,this._evaluator.featureState=s,this._evaluator.canonical=l,this._evaluator.availableImages=u||null,this._evaluator.formattedSection=d,this.expression.evaluate(this._evaluator)}evaluate(e,r,s,l,u,d){this._evaluator.globals=e,this._evaluator.feature=r||null,this._evaluator.featureState=s||null,this._evaluator.canonical=l,this._evaluator.availableImages=u||null,this._evaluator.formattedSection=d||null;try{const 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 Ot(`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 Os(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in zn}function Lt(i,e){const r=new Zr(zn,Ps,[],e?function(l){const u={color:Ai,string:it,number:be,enum:it,boolean:et,formatted:Cr,padding:er,resolvedImage:Pr};return l.type==="array"?ai(u[l.value]||Je,l.length):u[l.type]}(e):void 0),s=r.parse(i,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return s?Ko(new Na(s,e)):Dn(r.errors)}class Va{constructor(e,r){this.kind=e,this._styleExpression=r,this.isStateDependent=e!=="constant"&&!Pn(r.expression)}evaluateWithoutErrorHandling(e,r,s,l,u,d){return this._styleExpression.evaluateWithoutErrorHandling(e,r,s,l,u,d)}evaluate(e,r,s,l,u,d){return this._styleExpression.evaluate(e,r,s,l,u,d)}}class ot{constructor(e,r,s,l){this.kind=e,this.zoomStops=s,this._styleExpression=r,this.isStateDependent=e!=="camera"&&!Pn(r.expression),this.interpolationType=l}evaluateWithoutErrorHandling(e,r,s,l,u,d){return this._styleExpression.evaluateWithoutErrorHandling(e,r,s,l,u,d)}evaluate(e,r,s,l,u,d){return this._styleExpression.evaluate(e,r,s,l,u,d)}interpolationFactor(e,r,s){return this.interpolationType?Di.interpolationFactor(this.interpolationType,e,r,s):0}}function Us(i,e){const r=Lt(i,e);if(r.result==="error")return r;const s=r.value.expression,l=es(s);if(!l&&!Rn(e))return Dn([new hi("","data expressions not supported")]);const u=Ms(s,["zoom"]);if(!u&&!Yo(e))return Dn([new hi("","zoom expressions not supported")]);const d=wt(s);return d||u?d instanceof hi?Dn([d]):d instanceof Di&&!Oa(e)?Dn([new hi("",'"interpolate" expressions cannot be used with this property')]):Ko(d?new ot(l?"camera":"composite",r.value,d.labels,d instanceof Di?d.interpolation:void 0):new Va(l?"constant":"source",r.value)):Dn([new hi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class St{constructor(e,r){this._parameters=e,this._specification=r,ur(this,Jo(this._parameters,this._specification))}static deserialize(e){return new St(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function wt(i){let e=null;if(i instanceof Ds)e=wt(i.result);else if(i instanceof zs){for(const r of i.args)if(e=wt(r),e)break}else(i instanceof Mn||i instanceof Di)&&i.input instanceof Wi&&i.input.name==="zoom"&&(e=i);return e instanceof hi||i.eachChild(r=>{const s=wt(r);s instanceof hi?e=s:!e&&s?e=new hi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&s&&e!==s&&(e=new hi("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function Bn(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(const e of i.slice(1))if(!Bn(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const el={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function $a(i){if(i==null)return{filter:()=>!0,needGeometry:!1};Bn(i)||(i=Ns(i));const e=Lt(i,el);if(e.result==="error")throw new Error(e.value.map(r=>`${r.key}: ${r.message}`).join(", "));return{filter:(r,s,l)=>e.value.evaluate(r,s,{},l),needGeometry:tl(i)}}function pc(i,e){return i<e?-1:i>e?1:0}function tl(i){if(!Array.isArray(i))return!1;if(i[0]==="within")return!0;for(let e=1;e<i.length;e++)if(tl(i[e]))return!0;return!1}function Ns(i){if(!i)return!0;const e=i[0];return i.length<=1?e!=="any":e==="=="?Vs(i[1],i[2],"=="):e==="!="?rs(Vs(i[1],i[2],"==")):e==="<"||e===">"||e==="<="||e===">="?Vs(i[1],i[2],e):e==="any"?(r=i.slice(1),["any"].concat(r.map(Ns))):e==="all"?["all"].concat(i.slice(1).map(Ns)):e==="none"?["all"].concat(i.slice(1).map(Ns).map(rs)):e==="in"?ja(i[1],i.slice(2)):e==="!in"?rs(ja(i[1],i.slice(2))):e==="has"?qa(i[1]):e==="!has"?rs(qa(i[1])):e!=="within"||i;var r}function Vs(i,e,r){switch(i){case"$type":return[`filter-type-${r}`,e];case"$id":return[`filter-id-${r}`,e];default:return[`filter-${r}`,i,e]}}function ja(i,e){if(e.length===0)return!1;switch(i){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(r=>typeof r!=typeof e[0])?["filter-in-large",i,["literal",e.sort(pc)]]:["filter-in-small",i,["literal",e]]}}function qa(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function rs(i){return["!",i]}function ns(i){const e=typeof i;if(e==="number"||e==="boolean"||e==="string"||i==null)return JSON.stringify(i);if(Array.isArray(i)){let l="[";for(const u of i)l+=`${ns(u)},`;return`${l}]`}const r=Object.keys(i).sort();let s="{";for(let l=0;l<r.length;l++)s+=`${JSON.stringify(r[l])}:${ns(i[r[l]])},`;return`${s}}`}function fc(i){let e="";for(const r of $r)e+=`/${ns(i[r])}`;return e}function il(i){const e=i.value;return e?[new we(i.key,e,"constants have been deprecated as of v8")]:[]}function Ut(i){return i instanceof Number||i instanceof String||i instanceof Boolean?i.valueOf():i}function cn(i){if(Array.isArray(i))return i.map(cn);if(i instanceof Object&&!(i instanceof Number||i instanceof String||i instanceof Boolean)){const e={};for(const r in i)e[r]=cn(i[r]);return e}return Ut(i)}function Hi(i){const e=i.key,r=i.value,s=i.valueSpec||{},l=i.objectElementValidators||{},u=i.style,d=i.styleSpec,f=i.validateSpec;let g=[];const b=_t(r);if(b!=="object")return[new we(e,r,`object expected, ${b} found`)];for(const w in r){const E=w.split(".")[0],C=s[E]||s["*"];let M;if(l[E])M=l[E];else if(s[E])M=f;else if(l["*"])M=l["*"];else{if(!s["*"]){g.push(new we(e,r[w],`unknown property "${w}"`));continue}M=f}g=g.concat(M({key:(e&&`${e}.`)+w,value:r[w],valueSpec:C,style:u,styleSpec:d,object:r,objectKey:w,validateSpec:f},r))}for(const w in s)l[w]||s[w].required&&s[w].default===void 0&&r[w]===void 0&&g.push(new we(e,r,`missing required property "${w}"`));return g}function rl(i){const e=i.value,r=i.valueSpec,s=i.style,l=i.styleSpec,u=i.key,d=i.arrayElementValidator||i.validateSpec;if(_t(e)!=="array")return[new we(u,e,`array expected, ${_t(e)} found`)];if(r.length&&e.length!==r.length)return[new we(u,e,`array length ${r.length} expected, length ${e.length} found`)];if(r["min-length"]&&e.length<r["min-length"])return[new we(u,e,`array length at least ${r["min-length"]} expected, length ${e.length} found`)];let f={type:r.value,values:r.values};l.$version<7&&(f.function=r.function),_t(r.value)==="object"&&(f=r.value);let g=[];for(let b=0;b<e.length;b++)g=g.concat(d({array:e,arrayIndex:b,value:e[b],valueSpec:f,validateSpec:i.validateSpec,style:s,styleSpec:l,key:`${u}[${b}]`}));return g}function Ga(i){const e=i.key,r=i.value,s=i.valueSpec;let l=_t(r);return l==="number"&&r!=r&&(l="NaN"),l!=="number"?[new we(e,r,`number expected, ${l} found`)]:"minimum"in s&&r<s.minimum?[new we(e,r,`${r} is less than the minimum value ${s.minimum}`)]:"maximum"in s&&r>s.maximum?[new we(e,r,`${r} is greater than the maximum value ${s.maximum}`)]:[]}function nl(i){const e=i.valueSpec,r=Ut(i.value.type);let s,l,u,d={};const f=r!=="categorical"&&i.value.property===void 0,g=!f,b=_t(i.value.stops)==="array"&&_t(i.value.stops[0])==="array"&&_t(i.value.stops[0][0])==="object",w=Hi({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 we(M.key,M.value,'identity function may not have a "stops" property')];let z=[];const U=M.value;return z=z.concat(rl({key:M.key,value:U,valueSpec:M.valueSpec,validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec,arrayElementValidator:E})),_t(U)==="array"&&U.length===0&&z.push(new we(M.key,U,"array must have at least one stop")),z},default:function(M){return M.validateSpec({key:M.key,value:M.value,valueSpec:e,validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec})}}});return r==="identity"&&f&&w.push(new we(i.key,i.value,'missing required property "property"')),r==="identity"||i.value.stops||w.push(new we(i.key,i.value,'missing required property "stops"')),r==="exponential"&&i.valueSpec.expression&&!Oa(i.valueSpec)&&w.push(new we(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(g&&!Rn(i.valueSpec)?w.push(new we(i.key,i.value,"property functions not supported")):f&&!Yo(i.valueSpec)&&w.push(new we(i.key,i.value,"zoom functions not supported"))),r!=="categorical"&&!b||i.value.property!==void 0||w.push(new we(i.key,i.value,'"property" property is required')),w;function E(M){let z=[];const U=M.value,F=M.key;if(_t(U)!=="array")return[new we(F,U,`array expected, ${_t(U)} found`)];if(U.length!==2)return[new we(F,U,`array length 2 expected, length ${U.length} found`)];if(b){if(_t(U[0])!=="object")return[new we(F,U,`object expected, ${_t(U[0])} found`)];if(U[0].zoom===void 0)return[new we(F,U,"object stop key must have zoom")];if(U[0].value===void 0)return[new we(F,U,"object stop key must have value")];if(u&&u>Ut(U[0].zoom))return[new we(F,U[0].zoom,"stop zoom values must appear in ascending order")];Ut(U[0].zoom)!==u&&(u=Ut(U[0].zoom),l=void 0,d={}),z=z.concat(Hi({key:`${F}[0]`,value:U[0],valueSpec:{zoom:{}},validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec,objectElementValidators:{zoom:Ga,value:C}}))}else z=z.concat(C({key:`${F}[0]`,value:U[0],valueSpec:{},validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec},U));return Os(cn(U[1]))?z.concat([new we(`${F}[1]`,U[1],"expressions are not allowed in function stops.")]):z.concat(M.validateSpec({key:`${F}[1]`,value:U[1],valueSpec:e,validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec}))}function C(M,z){const U=_t(M.value),F=Ut(M.value),H=M.value!==null?M.value:z;if(s){if(U!==s)return[new we(M.key,H,`${U} stop domain type must match previous stop domain type ${s}`)]}else s=U;if(U!=="number"&&U!=="string"&&U!=="boolean")return[new we(M.key,H,"stop domain value must be a number, string, or boolean")];if(U!=="number"&&r!=="categorical"){let Q=`number expected, ${U} found`;return Rn(e)&&r===void 0&&(Q+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new we(M.key,H,Q)]}return r!=="categorical"||U!=="number"||isFinite(F)&&Math.floor(F)===F?r!=="categorical"&&U==="number"&&l!==void 0&&F<l?[new we(M.key,H,"stop domain values must appear in ascending order")]:(l=F,r==="categorical"&&F in d?[new we(M.key,H,"stop domain values must be unique")]:(d[F]=!0,[])):[new we(M.key,H,`integer expected, found ${F}`)]}}function hn(i){const e=(i.expressionContext==="property"?Us:Lt)(cn(i.value),i.valueSpec);if(e.result==="error")return e.value.map(s=>new we(`${i.key}${s.key}`,i.value,s.message));const r=e.value.expression||e.value._styleExpression.expression;if(i.expressionContext==="property"&&i.propertyKey==="text-font"&&!r.outputDefined())return[new we(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"&&!Pn(r))return[new we(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if(i.expressionContext==="filter"&&!Pn(r))return[new we(i.key,i.value,'"feature-state" data expressions are not supported with filters.')];if(i.expressionContext&&i.expressionContext.indexOf("cluster")===0){if(!Ms(r,["zoom","feature-state"]))return[new we(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(i.expressionContext==="cluster-initial"&&!es(r))return[new we(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function ss(i){const e=i.key,r=i.value,s=i.valueSpec,l=[];return Array.isArray(s.values)?s.values.indexOf(Ut(r))===-1&&l.push(new we(e,r,`expected one of [${s.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(s.values).indexOf(Ut(r))===-1&&l.push(new we(e,r,`expected one of [${Object.keys(s.values).join(", ")}], ${JSON.stringify(r)} found`)),l}function Fn(i){return Bn(cn(i.value))?hn(ur({},i,{expressionContext:"filter",valueSpec:{value:"boolean"}})):sl(i)}function sl(i){const e=i.value,r=i.key;if(_t(e)!=="array")return[new we(r,e,`array expected, ${_t(e)} found`)];const s=i.styleSpec;let l,u=[];if(e.length<1)return[new we(r,e,"filter array must have at least 1 element")];switch(u=u.concat(ss({key:`${r}[0]`,value:e[0],valueSpec:s.filter_operator,style:i.style,styleSpec:i.styleSpec})),Ut(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&Ut(e[1])==="$type"&&u.push(new we(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&u.push(new we(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(l=_t(e[1]),l!=="string"&&u.push(new we(`${r}[1]`,e[1],`string expected, ${l} found`)));for(let d=2;d<e.length;d++)l=_t(e[d]),Ut(e[1])==="$type"?u=u.concat(ss({key:`${r}[${d}]`,value:e[d],valueSpec:s.geometry_type,style:i.style,styleSpec:i.styleSpec})):l!=="string"&&l!=="number"&&l!=="boolean"&&u.push(new we(`${r}[${d}]`,e[d],`string, number, or boolean expected, ${l} found`));break;case"any":case"all":case"none":for(let d=1;d<e.length;d++)u=u.concat(sl({key:`${r}[${d}]`,value:e[d],style:i.style,styleSpec:i.styleSpec}));break;case"has":case"!has":l=_t(e[1]),e.length!==2?u.push(new we(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):l!=="string"&&u.push(new we(`${r}[1]`,e[1],`string expected, ${l} found`));break;case"within":l=_t(e[1]),e.length!==2?u.push(new we(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):l!=="object"&&u.push(new we(`${r}[1]`,e[1],`object expected, ${l} found`))}return u}function Za(i,e){const r=i.key,s=i.validateSpec,l=i.style,u=i.styleSpec,d=i.value,f=i.objectKey,g=u[`${e}_${i.layerType}`];if(!g)return[];const b=f.match(/^(.*)-transition$/);if(e==="paint"&&b&&g[b[1]]&&g[b[1]].transition)return s({key:r,value:d,valueSpec:u.transition,style:l,styleSpec:u});const w=i.valueSpec||g[f];if(!w)return[new we(r,d,`unknown property "${f}"`)];let E;if(_t(d)==="string"&&Rn(w)&&!w.tokens&&(E=/^{([^}]+)}$/.exec(d)))return[new we(r,d,`"${f}" does not support interpolation syntax
2
+ Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(E[1])} }\`.`)];const C=[];return i.layerType==="symbol"&&(f==="text-field"&&l&&!l.glyphs&&C.push(new we(r,d,'use of "text-field" requires a style "glyphs" property')),f==="text-font"&&Fs(cn(d))&&Ut(d.type)==="identity"&&C.push(new we(r,d,'"text-font" does not support identity functions'))),C.concat(s({key:i.key,value:d,valueSpec:w,style:l,styleSpec:u,expressionContext:"property",propertyType:e,propertyKey:f}))}function Xa(i){return Za(i,"paint")}function al(i){return Za(i,"layout")}function $s(i){let e=[];const r=i.value,s=i.key,l=i.style,u=i.styleSpec;r.type||r.ref||e.push(new we(s,r,'either "type" or "ref" is required'));let d=Ut(r.type);const f=Ut(r.ref);if(r.id){const g=Ut(r.id);for(let b=0;b<i.arrayIndex;b++){const w=l.layers[b];Ut(w.id)===g&&e.push(new we(s,r.id,`duplicate layer id "${r.id}", previously used at line ${w.id.__line__}`))}}if("ref"in r){let g;["type","source","source-layer","filter","layout"].forEach(b=>{b in r&&e.push(new we(s,r[b],`"${b}" is prohibited for ref layers`))}),l.layers.forEach(b=>{Ut(b.id)===f&&(g=b)}),g?g.ref?e.push(new we(s,r.ref,"ref cannot reference another ref layer")):d=Ut(g.type):e.push(new we(s,r.ref,`ref layer "${f}" not found`))}else if(d!=="background")if(r.source){const g=l.sources&&l.sources[r.source],b=g&&Ut(g.type);g?b==="vector"&&d==="raster"?e.push(new we(s,r.source,`layer "${r.id}" requires a raster source`)):b==="raster"&&d!=="raster"?e.push(new we(s,r.source,`layer "${r.id}" requires a vector source`)):b!=="vector"||r["source-layer"]?b==="raster-dem"&&d!=="hillshade"?e.push(new we(s,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):d!=="line"||!r.paint||!r.paint["line-gradient"]||b==="geojson"&&g.lineMetrics||e.push(new we(s,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new we(s,r,`layer "${r.id}" must specify a "source-layer"`)):e.push(new we(s,r.source,`source "${r.source}" not found`))}else e.push(new we(s,r,'missing required property "source"'));return e=e.concat(Hi({key:s,value:r,valueSpec:u.layer,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,objectElementValidators:{"*":()=>[],type:()=>i.validateSpec({key:`${s}.type`,value:r.type,valueSpec:u.layer.type,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,object:r,objectKey:"type"}),filter:Fn,layout:g=>Hi({layer:r,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,validateSpec:g.validateSpec,objectElementValidators:{"*":b=>al(ur({layerType:d},b))}}),paint:g=>Hi({layer:r,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,validateSpec:g.validateSpec,objectElementValidators:{"*":b=>Xa(ur({layerType:d},b))}})}})),e}function pr(i){const e=i.value,r=i.key,s=_t(e);return s!=="string"?[new we(r,e,`string expected, ${s} found`)]:[]}const js={promoteId:function({key:i,value:e}){if(_t(e)==="string")return pr({key:i,value:e});{const r=[];for(const s in e)r.push(...pr({key:`${i}.${s}`,value:e[s]}));return r}}};function qs(i){const e=i.value,r=i.key,s=i.styleSpec,l=i.style,u=i.validateSpec;if(!e.type)return[new we(r,e,'"type" is required')];const d=Ut(e.type);let f;switch(d){case"vector":case"raster":case"raster-dem":return f=Hi({key:r,value:e,valueSpec:s[`source_${d.replace("-","_")}`],style:i.style,styleSpec:s,objectElementValidators:js,validateSpec:u}),f;case"geojson":if(f=Hi({key:r,value:e,valueSpec:s.source_geojson,style:l,styleSpec:s,validateSpec:u,objectElementValidators:js}),e.cluster)for(const g in e.clusterProperties){const[b,w]=e.clusterProperties[g],E=typeof b=="string"?[b,["accumulated"],["get",g]]:b;f.push(...hn({key:`${r}.${g}.map`,value:w,validateSpec:u,expressionContext:"cluster-map"})),f.push(...hn({key:`${r}.${g}.reduce`,value:E,validateSpec:u,expressionContext:"cluster-reduce"}))}return f;case"video":return Hi({key:r,value:e,valueSpec:s.source_video,style:l,validateSpec:u,styleSpec:s});case"image":return Hi({key:r,value:e,valueSpec:s.source_image,style:l,validateSpec:u,styleSpec:s});case"canvas":return[new we(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return ss({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:l,validateSpec:u,styleSpec:s})}}function ol(i){const e=i.value,r=i.styleSpec,s=r.light,l=i.style;let u=[];const d=_t(e);if(e===void 0)return u;if(d!=="object")return u=u.concat([new we("light",e,`object expected, ${d} found`)]),u;for(const f in e){const g=f.match(/^(.*)-transition$/);u=u.concat(g&&s[g[1]]&&s[g[1]].transition?i.validateSpec({key:f,value:e[f],valueSpec:r.transition,validateSpec:i.validateSpec,style:l,styleSpec:r}):s[f]?i.validateSpec({key:f,value:e[f],valueSpec:s[f],validateSpec:i.validateSpec,style:l,styleSpec:r}):[new we(f,e[f],`unknown property "${f}"`)])}return u}function as(i){const e=i.value,r=i.styleSpec,s=r.terrain,l=i.style;let u=[];const d=_t(e);if(e===void 0)return u;if(d!=="object")return u=u.concat([new we("terrain",e,`object expected, ${d} found`)]),u;for(const f in e)u=u.concat(s[f]?i.validateSpec({key:f,value:e[f],valueSpec:s[f],validateSpec:i.validateSpec,style:l,styleSpec:r}):[new we(f,e[f],`unknown property "${f}"`)]);return u}function ll(i){let e=[];const r=i.value,s=i.key;if(Array.isArray(r)){const l=[],u=[];for(const d in r)r[d].id&&l.includes(r[d].id)&&e.push(new we(s,r,`all the sprites' ids must be unique, but ${r[d].id} is duplicated`)),l.push(r[d].id),r[d].url&&u.includes(r[d].url)&&e.push(new we(s,r,`all the sprites' URLs must be unique, but ${r[d].url} is duplicated`)),u.push(r[d].url),e=e.concat(Hi({key:`${s}[${d}]`,value:r[d],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:i.validateSpec}));return e}return pr({key:s,value:r})}const cl={"*":()=>[],array:rl,boolean:function(i){const e=i.value,r=i.key,s=_t(e);return s!=="boolean"?[new we(r,e,`boolean expected, ${s} found`)]:[]},number:Ga,color:function(i){const e=i.key,r=i.value,s=_t(r);return s!=="string"?[new we(e,r,`color expected, ${s} found`)]:We.parse(String(r))?[]:[new we(e,r,`color expected, "${r}" found`)]},constants:il,enum:ss,filter:Fn,function:nl,layer:$s,object:Hi,source:qs,light:ol,terrain:as,string:pr,formatted:function(i){return pr(i).length===0?[]:hn(i)},resolvedImage:function(i){return pr(i).length===0?[]:hn(i)},padding:function(i){const e=i.key,r=i.value;if(_t(r)==="array"){if(r.length<1||r.length>4)return[new we(e,r,`padding requires 1 to 4 values; ${r.length} values found`)];const s={type:"number"};let l=[];for(let u=0;u<r.length;u++)l=l.concat(i.validateSpec({key:`${e}[${u}]`,value:r[u],validateSpec:i.validateSpec,valueSpec:s}));return l}return Ga({key:e,value:r,valueSpec:{}})},sprite:ll};function os(i){const e=i.value,r=i.valueSpec,s=i.styleSpec;return i.validateSpec=os,r.expression&&Fs(Ut(e))?nl(i):r.expression&&Os(cn(e))?hn(i):r.type&&cl[r.type]?cl[r.type](i):Hi(ur({},i,{valueSpec:r.type?s[r.type]:r}))}function hl(i){const e=i.value,r=i.key,s=pr(i);return s.length||(e.indexOf("{fontstack}")===-1&&s.push(new we(r,e,'"glyphs" url must include a "{fontstack}" token')),e.indexOf("{range}")===-1&&s.push(new we(r,e,'"glyphs" url must include a "{range}" token'))),s}function fr(i,e=oe){let r=[];return r=r.concat(os({key:"",value:i,valueSpec:e.$root,styleSpec:e,style:i,validateSpec:os,objectElementValidators:{glyphs:hl,"*":()=>[]}})),i.constants&&(r=r.concat(il({key:"constants",value:i.constants,style:i,styleSpec:e,validateSpec:os}))),ls(r)}function Ki(i){return function(e){return i({...e,validateSpec:os})}}function ls(i){return[].concat(i).sort((e,r)=>e.line-r.line)}function Zt(i){return function(...e){return ls(i.apply(this,e))}}fr.source=Zt(Ki(qs)),fr.sprite=Zt(Ki(ll)),fr.glyphs=Zt(Ki(hl)),fr.light=Zt(Ki(ol)),fr.terrain=Zt(Ki(as)),fr.layer=Zt(Ki($s)),fr.filter=Zt(Ki(Fn)),fr.paintProperty=Zt(Ki(Xa)),fr.layoutProperty=Zt(Ki(al));const Wr=fr,mc=Wr.light,gc=Wr.paintProperty,_c=Wr.layoutProperty;function On(i,e){let r=!1;if(e&&e.length)for(const s of e)i.fire(new Zi(new Error(s.message))),r=!0;return r}class cs{constructor(e,r,s){const l=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const d=new Int32Array(this.arrayBuffer);e=d[0],this.d=(r=d[1])+2*(s=d[2]);for(let g=0;g<this.d*this.d;g++){const b=d[3+g],w=d[3+g+1];l.push(b===w?null:d.subarray(b,w))}const 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*s;for(let d=0;d<this.d*this.d;d++)l.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=e,this.padding=s,this.scale=r/e,this.uid=0;const u=s/r*e;this.min=-u,this.max=e+u}insert(e,r,s,l,u){this._forEachCell(r,s,l,u,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(r),this.bboxes.push(s),this.bboxes.push(l),this.bboxes.push(u)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,r,s,l,u,d){this.cells[u].push(d)}query(e,r,s,l,u){const d=this.min,f=this.max;if(e<=d&&r<=d&&f<=s&&f<=l&&!u)return Array.prototype.slice.call(this.keys);{const g=[];return this._forEachCell(e,r,s,l,this._queryCell,g,{},u),g}}_queryCell(e,r,s,l,u,d,f,g){const b=this.cells[u];if(b!==null){const w=this.keys,E=this.bboxes;for(let C=0;C<b.length;C++){const M=b[C];if(f[M]===void 0){const z=4*M;(g?g(E[z+0],E[z+1],E[z+2],E[z+3]):e<=E[z+2]&&r<=E[z+3]&&s>=E[z+0]&&l>=E[z+1])?(f[M]=!0,d.push(w[M])):f[M]=!1}}}}_forEachCell(e,r,s,l,u,d,f,g){const b=this._convertToCellCoord(e),w=this._convertToCellCoord(r),E=this._convertToCellCoord(s),C=this._convertToCellCoord(l);for(let M=b;M<=E;M++)for(let z=w;z<=C;z++){const U=this.d*z+M;if((!g||g(this._convertFromCellCoord(M),this._convertFromCellCoord(z),this._convertFromCellCoord(M+1),this._convertFromCellCoord(z+1)))&&u.call(this,e,r,s,l,U,d,f,g))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const e=this.cells,r=3+this.cells.length+1+1;let s=0;for(let d=0;d<this.cells.length;d++)s+=this.cells[d].length;const l=new Int32Array(r+s+this.keys.length+this.bboxes.length);l[0]=this.extent,l[1]=this.n,l[2]=this.padding;let u=r;for(let d=0;d<e.length;d++){const f=e[d];l[3+d]=u,l.set(f,u),u+=f.length}return l[3+e.length]=u,l.set(this.keys,u),u+=this.keys.length,l[3+e.length+1]=u,l.set(this.bboxes,u),u+=this.bboxes.length,l.buffer}static serialize(e,r){const s=e.toArrayBuffer();return r&&r.push(s),{buffer:s}}static deserialize(e){return new cs(e.buffer)}}const mr={};function De(i,e,r={}){if(mr[i])throw new Error(`${i} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:i,writeable:!1}),mr[i]={klass:e,omit:r.omit||[],shallow:r.shallow||[]}}De("Object",Object),De("TransferableGridIndex",cs),De("Color",We),De("Error",Error),De("AJAXError",Nr),De("ResolvedImage",Xi),De("StylePropertyFunction",St),De("StyleExpression",Na,{omit:["_evaluator"]}),De("ZoomDependentExpression",ot),De("ZoomConstantExpression",Va),De("CompoundExpression",Wi,{omit:["_evaluate"]});for(const i in zn)zn[i]._classRegistryKey||De(`Expression_${i}`,zn[i]);function Gs(i){return i&&typeof ArrayBuffer<"u"&&(i instanceof ArrayBuffer||i.constructor&&i.constructor.name==="ArrayBuffer")}function hs(i,e){if(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)return i;if(Gs(i)||en(i))return e&&e.push(i),i;if(ArrayBuffer.isView(i)){const r=i;return e&&e.push(r.buffer),r}if(i instanceof ImageData)return e&&e.push(i.data.buffer),i;if(Array.isArray(i)){const r=[];for(const s of i)r.push(hs(s,e));return r}if(typeof i=="object"){const r=i.constructor,s=r._classRegistryKey;if(!s)throw new Error("can't serialize object of unregistered class");if(!mr[s])throw new Error(`${s} is not registered.`);const l=r.serialize?r.serialize(i,e):{};if(r.serialize){if(e&&l===e[e.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const u in i){if(!i.hasOwnProperty(u)||mr[s].omit.indexOf(u)>=0)continue;const d=i[u];l[u]=mr[s].shallow.indexOf(u)>=0?d:hs(d,e)}i instanceof Error&&(l.message=i.message)}if(l.$name)throw new Error("$name property is reserved for worker serialization logic.");return s!=="Object"&&(l.$name=s),l}throw new Error("can't serialize object of type "+typeof i)}function kr(i){if(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||Gs(i)||en(i)||ArrayBuffer.isView(i)||i instanceof ImageData)return i;if(Array.isArray(i))return i.map(kr);if(typeof i=="object"){const e=i.$name||"Object";if(!mr[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:r}=mr[e];if(!r)throw new Error(`can't deserialize unregistered class ${e}`);if(r.deserialize)return r.deserialize(i);const s=Object.create(r.prototype);for(const l of Object.keys(i)){if(l==="$name")continue;const u=i[l];s[l]=mr[e].shallow.indexOf(l)>=0?u:kr(u)}return s}throw new Error("can't deserialize object of type "+typeof i)}class ul{constructor(){this.first=!0}update(e,r){const s=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=s,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=s,!0):(this.lastFloorZoom>s?(this.lastIntegerZoom=s+1,this.lastIntegerZoomTime=r):this.lastFloorZoom<s&&(this.lastIntegerZoom=s,this.lastIntegerZoomTime=r),e!==this.lastZoom&&(this.lastZoom=e,this.lastFloorZoom=s,!0))}}const Ce={"Latin-1 Supplement":i=>i>=128&&i<=255,Arabic:i=>i>=1536&&i<=1791,"Arabic Supplement":i=>i>=1872&&i<=1919,"Arabic Extended-A":i=>i>=2208&&i<=2303,"Hangul Jamo":i=>i>=4352&&i<=4607,"Unified Canadian Aboriginal Syllabics":i=>i>=5120&&i<=5759,Khmer:i=>i>=6016&&i<=6143,"Unified Canadian Aboriginal Syllabics Extended":i=>i>=6320&&i<=6399,"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,"CJK Radicals Supplement":i=>i>=11904&&i<=12031,"Kangxi Radicals":i=>i>=12032&&i<=12255,"Ideographic Description Characters":i=>i>=12272&&i<=12287,"CJK Symbols and Punctuation":i=>i>=12288&&i<=12351,Hiragana:i=>i>=12352&&i<=12447,Katakana:i=>i>=12448&&i<=12543,Bopomofo:i=>i>=12544&&i<=12591,"Hangul Compatibility Jamo":i=>i>=12592&&i<=12687,Kanbun:i=>i>=12688&&i<=12703,"Bopomofo Extended":i=>i>=12704&&i<=12735,"CJK Strokes":i=>i>=12736&&i<=12783,"Katakana Phonetic Extensions":i=>i>=12784&&i<=12799,"Enclosed CJK Letters and Months":i=>i>=12800&&i<=13055,"CJK Compatibility":i=>i>=13056&&i<=13311,"CJK Unified Ideographs Extension A":i=>i>=13312&&i<=19903,"Yijing Hexagram Symbols":i=>i>=19904&&i<=19967,"CJK Unified Ideographs":i=>i>=19968&&i<=40959,"Yi Syllables":i=>i>=40960&&i<=42127,"Yi Radicals":i=>i>=42128&&i<=42191,"Hangul Jamo Extended-A":i=>i>=43360&&i<=43391,"Hangul Syllables":i=>i>=44032&&i<=55215,"Hangul Jamo Extended-B":i=>i>=55216&&i<=55295,"Private Use Area":i=>i>=57344&&i<=63743,"CJK Compatibility Ideographs":i=>i>=63744&&i<=64255,"Arabic Presentation Forms-A":i=>i>=64336&&i<=65023,"Vertical Forms":i=>i>=65040&&i<=65055,"CJK Compatibility Forms":i=>i>=65072&&i<=65103,"Small Form Variants":i=>i>=65104&&i<=65135,"Arabic Presentation Forms-B":i=>i>=65136&&i<=65279,"Halfwidth and Fullwidth Forms":i=>i>=65280&&i<=65519};function Zs(i){for(const e of i)if(Xs(e.charCodeAt(0)))return!0;return!1}function Wa(i){for(const e of i)if(!dl(e.charCodeAt(0)))return!1;return!0}function dl(i){return!(Ce.Arabic(i)||Ce["Arabic Supplement"](i)||Ce["Arabic Extended-A"](i)||Ce["Arabic Presentation Forms-A"](i)||Ce["Arabic Presentation Forms-B"](i))}function Xs(i){return!(i!==746&&i!==747&&(i<4352||!(Ce["Bopomofo Extended"](i)||Ce.Bopomofo(i)||Ce["CJK Compatibility Forms"](i)&&!(i>=65097&&i<=65103)||Ce["CJK Compatibility Ideographs"](i)||Ce["CJK Compatibility"](i)||Ce["CJK Radicals Supplement"](i)||Ce["CJK Strokes"](i)||!(!Ce["CJK Symbols and Punctuation"](i)||i>=12296&&i<=12305||i>=12308&&i<=12319||i===12336)||Ce["CJK Unified Ideographs Extension A"](i)||Ce["CJK Unified Ideographs"](i)||Ce["Enclosed CJK Letters and Months"](i)||Ce["Hangul Compatibility Jamo"](i)||Ce["Hangul Jamo Extended-A"](i)||Ce["Hangul Jamo Extended-B"](i)||Ce["Hangul Jamo"](i)||Ce["Hangul Syllables"](i)||Ce.Hiragana(i)||Ce["Ideographic Description Characters"](i)||Ce.Kanbun(i)||Ce["Kangxi Radicals"](i)||Ce["Katakana Phonetic Extensions"](i)||Ce.Katakana(i)&&i!==12540||!(!Ce["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)||!(!Ce["Small Form Variants"](i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||Ce["Unified Canadian Aboriginal Syllabics"](i)||Ce["Unified Canadian Aboriginal Syllabics Extended"](i)||Ce["Vertical Forms"](i)||Ce["Yijing Hexagram Symbols"](i)||Ce["Yi Syllables"](i)||Ce["Yi Radicals"](i))))}function pl(i){return!(Xs(i)||function(e){return!!(Ce["Latin-1 Supplement"](e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||Ce["General Punctuation"](e)&&(e===8214||e===8224||e===8225||e===8240||e===8241||e===8251||e===8252||e===8258||e===8263||e===8264||e===8265||e===8273)||Ce["Letterlike Symbols"](e)||Ce["Number Forms"](e)||Ce["Miscellaneous Technical"](e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||e===9003||e>=9085&&e<=9114||e>=9150&&e<=9165||e===9167||e>=9169&&e<=9179||e>=9186&&e<=9215)||Ce["Control Pictures"](e)&&e!==9251||Ce["Optical Character Recognition"](e)||Ce["Enclosed Alphanumerics"](e)||Ce["Geometric Shapes"](e)||Ce["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||Ce["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||Ce["CJK Symbols and Punctuation"](e)||Ce.Katakana(e)||Ce["Private Use Area"](e)||Ce["CJK Compatibility Forms"](e)||Ce["Small Form Variants"](e)||Ce["Halfwidth and Fullwidth Forms"](e)||e===8734||e===8756||e===8757||e>=9984&&e<=10087||e>=10102&&e<=10131||e===65532||e===65533)}(i))}function Ws(i){return i>=1424&&i<=2303||Ce["Arabic Presentation Forms-A"](i)||Ce["Arabic Presentation Forms-B"](i)}function Hs(i,e){return!(!e&&Ws(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||Ce.Khmer(i))}function fl(i){for(const e of i)if(Ws(e.charCodeAt(0)))return!0;return!1}const Ha="deferred",Ks="loading",Ka="loaded";let us=null,Ci="unavailable",Hr=null;const ml=function(i){i&&typeof i=="string"&&i.indexOf("NetworkError")>-1&&(Ci="error"),us&&us(i)};function Ya(){Ys.fire(new Ir("pluginStateChange",{pluginStatus:Ci,pluginURL:Hr}))}const Ys=new En,Ja=function(){return Ci},gl=function(){if(Ci!==Ha||!Hr)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Ci=Ks,Ya(),Hr&&Sn({url:Hr},i=>{i?ml(i):(Ci=Ka,Ya())})},Yi={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Ci===Ka||Yi.applyArabicShaping!=null,isLoading:()=>Ci===Ks,setState(i){if(!qi())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");Ci=i.pluginStatus,Hr=i.pluginURL},isParsed(){if(!qi())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return Yi.applyArabicShaping!=null&&Yi.processBidirectionalText!=null&&Yi.processStyledBidirectionalText!=null},getPluginURL(){if(!qi())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return Hr}};class Pt{constructor(e,r){this.zoom=e,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 ul,this.transition={})}isSupportedScript(e){return function(r,s){for(const l of r)if(!Hs(l.charCodeAt(0),s))return!1;return!0}(e,Yi.isLoaded())}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const e=this.zoom,r=e-Math.floor(e),s=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*s}:{fromScale:.5,toScale:1,t:1-(1-s)*r}}}class Js{constructor(e,r){this.property=e,this.value=r,this.expression=function(s,l){if(Fs(s))return new St(s,l);if(Os(s)){const u=Us(s,l);if(u.result==="error")throw new Error(u.value.map(d=>`${d.key}: ${d.message}`).join(", "));return u.value}{let u=s;return l.type==="color"&&typeof s=="string"?u=We.parse(s):l.type!=="padding"||typeof s!="number"&&!Array.isArray(s)||(u=Li.parse(s)),{kind:"constant",evaluate:()=>u}}}(r===void 0?e.specification.default:r,e.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,r,s){return this.property.possiblyEvaluate(this,e,r,s)}}class Qa{constructor(e){this.property=e,this.value=new Js(e,void 0)}transitioned(e,r){return new ds(this.property,this.value,r,xi({},e.transition,this.transition),e.now)}untransitioned(){return new ds(this.property,this.value,null,{},0)}}class _l{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return Ii(this._values[e].value.value)}setValue(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Qa(this._values[e].property)),this._values[e].value=new Js(this._values[e].property,r===null?void 0:Ii(r))}getTransition(e){return Ii(this._values[e].transition)}setTransition(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Qa(this._values[e].property)),this._values[e].transition=Ii(r)||void 0}serialize(){const e={};for(const r of Object.keys(this._values)){const s=this.getValue(r);s!==void 0&&(e[r]=s);const l=this.getTransition(r);l!==void 0&&(e[`${r}-transition`]=l)}return e}transitioned(e,r){const s=new yl(this._properties);for(const l of Object.keys(this._values))s._values[l]=this._values[l].transitioned(e,r._values[l]);return s}untransitioned(){const e=new yl(this._properties);for(const r of Object.keys(this._values))e._values[r]=this._values[r].untransitioned();return e}}class ds{constructor(e,r,s,l,u){this.property=e,this.value=r,this.begin=u+l.delay||0,this.end=this.begin+l.duration||0,e.specification.transition&&(l.delay||l.duration)&&(this.prior=s)}possiblyEvaluate(e,r,s){const l=e.now||0,u=this.value.possiblyEvaluate(e,r,s),d=this.prior;if(d){if(l>this.end)return this.prior=null,u;if(this.value.isDataDriven())return this.prior=null,u;if(l<this.begin)return d.possiblyEvaluate(e,r,s);{const f=(l-this.begin)/(this.end-this.begin);return this.property.interpolate(d.possiblyEvaluate(e,r,s),u,function(g){if(g<=0)return 0;if(g>=1)return 1;const b=g*g,w=b*g;return 4*(g<.5?w:3*(g-b)+w-.75)}(f))}}return u}}class yl{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,r,s){const l=new Qs(this._properties);for(const u of Object.keys(this._values))l._values[u]=this._values[u].possiblyEvaluate(e,r,s);return l}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class eo{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}getValue(e){return Ii(this._values[e].value)}setValue(e,r){this._values[e]=new Js(this._values[e].property,r===null?void 0:Ii(r))}serialize(){const e={};for(const r of Object.keys(this._values)){const s=this.getValue(r);s!==void 0&&(e[r]=s)}return e}possiblyEvaluate(e,r,s){const l=new Qs(this._properties);for(const u of Object.keys(this._values))l._values[u]=this._values[u].possiblyEvaluate(e,r,s);return l}}class gr{constructor(e,r,s){this.property=e,this.value=r,this.parameters=s}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,r,s,l){return this.property.evaluate(this.value,this.parameters,e,r,s,l)}}class Qs{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class Ue{constructor(e){this.specification=e}possiblyEvaluate(e,r){if(e.isDataDriven())throw new Error("Value should not be data driven");return e.expression.evaluate(r)}interpolate(e,r,s){const l=zi[this.specification.type];return l?l(e,r,s):e}}class Ge{constructor(e,r){this.specification=e,this.overrides=r}possiblyEvaluate(e,r,s,l){return new gr(this,e.expression.kind==="constant"||e.expression.kind==="camera"?{kind:"constant",value:e.expression.evaluate(r,null,{},s,l)}:e.expression,r)}interpolate(e,r,s){if(e.value.kind!=="constant"||r.value.kind!=="constant")return e;if(e.value.value===void 0||r.value.value===void 0)return new gr(this,{kind:"constant",value:void 0},e.parameters);const l=zi[this.specification.type];if(l){const u=l(e.value.value,r.value.value,s);return new gr(this,{kind:"constant",value:u},e.parameters)}return e}evaluate(e,r,s,l,u,d){return e.kind==="constant"?e.value:e.evaluate(r,s,l,u,d)}}class ps extends Ge{possiblyEvaluate(e,r,s,l){if(e.value===void 0)return new gr(this,{kind:"constant",value:void 0},r);if(e.expression.kind==="constant"){const u=e.expression.evaluate(r,null,{},s,l),d=e.property.specification.type==="resolvedImage"&&typeof u!="string"?u.name:u,f=this._calculate(d,d,d,r);return new gr(this,{kind:"constant",value:f},r)}if(e.expression.kind==="camera"){const u=this._calculate(e.expression.evaluate({zoom:r.zoom-1}),e.expression.evaluate({zoom:r.zoom}),e.expression.evaluate({zoom:r.zoom+1}),r);return new gr(this,{kind:"constant",value:u},r)}return new gr(this,e.expression,r)}evaluate(e,r,s,l,u,d){if(e.kind==="source"){const f=e.evaluate(r,s,l,u,d);return this._calculate(f,f,f,r)}return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(r.zoom)-1},s,l),e.evaluate({zoom:Math.floor(r.zoom)},s,l),e.evaluate({zoom:Math.floor(r.zoom)+1},s,l),r):e.value}_calculate(e,r,s,l){return l.zoom>l.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:s,to:r}}interpolate(e){return e}}class to{constructor(e){this.specification=e}possiblyEvaluate(e,r,s,l){if(e.value!==void 0){if(e.expression.kind==="constant"){const u=e.expression.evaluate(r,null,{},s,l);return this._calculate(u,u,u,r)}return this._calculate(e.expression.evaluate(new Pt(Math.floor(r.zoom-1),r)),e.expression.evaluate(new Pt(Math.floor(r.zoom),r)),e.expression.evaluate(new Pt(Math.floor(r.zoom+1),r)),r)}}_calculate(e,r,s,l){return l.zoom>l.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:s,to:r}}interpolate(e){return e}}class io{constructor(e){this.specification=e}possiblyEvaluate(e,r,s,l){return!!e.expression.evaluate(r,null,{},s,l)}interpolate(){return!1}}class Pi{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const r in e){const s=e[r];s.specification.overridable&&this.overridableProperties.push(r);const l=this.defaultPropertyValues[r]=new Js(s,void 0),u=this.defaultTransitionablePropertyValues[r]=new Qa(s);this.defaultTransitioningPropertyValues[r]=u.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=l.possiblyEvaluate({})}}}De("DataDrivenProperty",Ge),De("DataConstantProperty",Ue),De("CrossFadedDataDrivenProperty",ps),De("CrossFadedProperty",to),De("ColorRampProperty",io);const xl="-transition";class _r extends En{constructor(e,r){if(super(),this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1},e.type!=="custom"&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type!=="background"&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),r.layout&&(this._unevaluatedLayout=new eo(r.layout)),r.paint)){this._transitionablePaint=new _l(r.paint);for(const s in e.paint)this.setPaintProperty(s,e.paint[s],{validate:!1});for(const s in e.layout)this.setLayoutProperty(s,e.layout[s],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Qs(r.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,r,s={}){r!=null&&this._validate(_c,`layers.${this.id}.layout.${e}`,e,r,s)||(e!=="visibility"?this._unevaluatedLayout.setValue(e,r):this.visibility=r)}getPaintProperty(e){return e.endsWith(xl)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,r,s={}){if(r!=null&&this._validate(gc,`layers.${this.id}.paint.${e}`,e,r,s))return!1;if(e.endsWith(xl))return this._transitionablePaint.setTransition(e.slice(0,-11),r||void 0),!1;{const l=this._transitionablePaint._values[e],u=l.property.specification["property-type"]==="cross-faded-data-driven",d=l.value.isDataDriven(),f=l.value;this._transitionablePaint.setValue(e,r),this._handleSpecialPaintPropertyUpdate(e);const g=this._transitionablePaint._values[e].value;return g.isDataDriven()||d||u||this._handleOverridablePaintPropertyUpdate(e,f,g)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,r,s){return!1}isHidden(e){return!!(this.minzoom&&e<this.minzoom)||!!(this.maxzoom&&e>=this.maxzoom)||this.visibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,r){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,r)}serialize(){const e={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&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),vn(e,(r,s)=>!(r===void 0||s==="layout"&&!Object.keys(r).length||s==="paint"&&!Object.keys(r).length))}_validate(e,r,s,l,u={}){return(!u||u.validate!==!1)&&On(this,e.call(Wr,{key:r,layerType:this.type,objectKey:s,value:l,styleSpec:oe,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const e in this.paint._values){const r=this.paint.get(e);if(r instanceof gr&&Rn(r.property.specification)&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}}const yc={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Lr{constructor(e,r){this._structArray=e,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Rt{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,r){return e._trim(),r&&(e.isTransferred=!0,r.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const r=Object.create(this.prototype);return r.arrayBuffer=e.arrayBuffer,r.length=e.length,r.capacity=e.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(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function Xt(i,e=1){let r=0,s=0;return{members:i.map(l=>{const u=yc[l.type].BYTES_PER_ELEMENT,d=r=vl(r,Math.max(e,u)),f=l.components||1;return s=Math.max(s,u),r+=u*f,{name:l.name,type:l.type,components:f,offset:d}}),size:vl(r,Math.max(s,e)),alignment:e}}function vl(i,e){return Math.ceil(i/e)*e}class Un extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r){const s=this.length;return this.resize(s+1),this.emplace(s,e,r)}emplace(e,r,s){const l=2*e;return this.int16[l+0]=r,this.int16[l+1]=s,e}}Un.prototype.bytesPerElement=4,De("StructArrayLayout2i4",Un);class ea extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,s)}emplace(e,r,s,l){const u=3*e;return this.int16[u+0]=r,this.int16[u+1]=s,this.int16[u+2]=l,e}}ea.prototype.bytesPerElement=6,De("StructArrayLayout3i6",ea);class ro extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l){const u=this.length;return this.resize(u+1),this.emplace(u,e,r,s,l)}emplace(e,r,s,l,u){const d=4*e;return this.int16[d+0]=r,this.int16[d+1]=s,this.int16[d+2]=l,this.int16[d+3]=u,e}}ro.prototype.bytesPerElement=8,De("StructArrayLayout4i8",ro);class yr extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,u,d){const f=this.length;return this.resize(f+1),this.emplace(f,e,r,s,l,u,d)}emplace(e,r,s,l,u,d,f){const g=6*e;return this.int16[g+0]=r,this.int16[g+1]=s,this.int16[g+2]=l,this.int16[g+3]=u,this.int16[g+4]=d,this.int16[g+5]=f,e}}yr.prototype.bytesPerElement=12,De("StructArrayLayout2i4i12",yr);class ta extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,u,d){const f=this.length;return this.resize(f+1),this.emplace(f,e,r,s,l,u,d)}emplace(e,r,s,l,u,d,f){const g=4*e,b=8*e;return this.int16[g+0]=r,this.int16[g+1]=s,this.uint8[b+4]=l,this.uint8[b+5]=u,this.uint8[b+6]=d,this.uint8[b+7]=f,e}}ta.prototype.bytesPerElement=8,De("StructArrayLayout2i4ub8",ta);class un extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r){const s=this.length;return this.resize(s+1),this.emplace(s,e,r)}emplace(e,r,s){const l=2*e;return this.float32[l+0]=r,this.float32[l+1]=s,e}}un.prototype.bytesPerElement=8,De("StructArrayLayout2f8",un);class ia extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,u,d,f,g,b,w){const E=this.length;return this.resize(E+1),this.emplace(E,e,r,s,l,u,d,f,g,b,w)}emplace(e,r,s,l,u,d,f,g,b,w,E){const C=10*e;return this.uint16[C+0]=r,this.uint16[C+1]=s,this.uint16[C+2]=l,this.uint16[C+3]=u,this.uint16[C+4]=d,this.uint16[C+5]=f,this.uint16[C+6]=g,this.uint16[C+7]=b,this.uint16[C+8]=w,this.uint16[C+9]=E,e}}ia.prototype.bytesPerElement=20,De("StructArrayLayout10ui20",ia);class fs extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,u,d,f,g,b,w,E,C){const M=this.length;return this.resize(M+1),this.emplace(M,e,r,s,l,u,d,f,g,b,w,E,C)}emplace(e,r,s,l,u,d,f,g,b,w,E,C,M){const z=12*e;return this.int16[z+0]=r,this.int16[z+1]=s,this.int16[z+2]=l,this.int16[z+3]=u,this.uint16[z+4]=d,this.uint16[z+5]=f,this.uint16[z+6]=g,this.uint16[z+7]=b,this.int16[z+8]=w,this.int16[z+9]=E,this.int16[z+10]=C,this.int16[z+11]=M,e}}fs.prototype.bytesPerElement=24,De("StructArrayLayout4i4ui4i24",fs);class no extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,s)}emplace(e,r,s,l){const u=3*e;return this.float32[u+0]=r,this.float32[u+1]=s,this.float32[u+2]=l,e}}no.prototype.bytesPerElement=12,De("StructArrayLayout3f12",no);class Nn extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.uint32[1*e+0]=r,e}}Nn.prototype.bytesPerElement=4,De("StructArrayLayout1ul4",Nn);class dn extends Rt{_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(e,r,s,l,u,d,f,g,b){const w=this.length;return this.resize(w+1),this.emplace(w,e,r,s,l,u,d,f,g,b)}emplace(e,r,s,l,u,d,f,g,b,w){const E=10*e,C=5*e;return this.int16[E+0]=r,this.int16[E+1]=s,this.int16[E+2]=l,this.int16[E+3]=u,this.int16[E+4]=d,this.int16[E+5]=f,this.uint32[C+3]=g,this.uint16[E+8]=b,this.uint16[E+9]=w,e}}dn.prototype.bytesPerElement=20,De("StructArrayLayout6i1ul2ui20",dn);class so extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,u,d){const f=this.length;return this.resize(f+1),this.emplace(f,e,r,s,l,u,d)}emplace(e,r,s,l,u,d,f){const g=6*e;return this.int16[g+0]=r,this.int16[g+1]=s,this.int16[g+2]=l,this.int16[g+3]=u,this.int16[g+4]=d,this.int16[g+5]=f,e}}so.prototype.bytesPerElement=12,De("StructArrayLayout2i2i2i12",so);class ra extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,u){const d=this.length;return this.resize(d+1),this.emplace(d,e,r,s,l,u)}emplace(e,r,s,l,u,d){const f=4*e,g=8*e;return this.float32[f+0]=r,this.float32[f+1]=s,this.float32[f+2]=l,this.int16[g+6]=u,this.int16[g+7]=d,e}}ra.prototype.bytesPerElement=16,De("StructArrayLayout2f1f2i16",ra);class pn extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,s,l){const u=this.length;return this.resize(u+1),this.emplace(u,e,r,s,l)}emplace(e,r,s,l,u){const d=12*e,f=3*e;return this.uint8[d+0]=r,this.uint8[d+1]=s,this.float32[f+1]=l,this.float32[f+2]=u,e}}pn.prototype.bytesPerElement=12,De("StructArrayLayout2ub2f12",pn);class na extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,s)}emplace(e,r,s,l){const u=3*e;return this.uint16[u+0]=r,this.uint16[u+1]=s,this.uint16[u+2]=l,e}}na.prototype.bytesPerElement=6,De("StructArrayLayout3ui6",na);class ao extends Rt{_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(e,r,s,l,u,d,f,g,b,w,E,C,M,z,U,F,H){const Q=this.length;return this.resize(Q+1),this.emplace(Q,e,r,s,l,u,d,f,g,b,w,E,C,M,z,U,F,H)}emplace(e,r,s,l,u,d,f,g,b,w,E,C,M,z,U,F,H,Q){const Z=24*e,re=12*e,se=48*e;return this.int16[Z+0]=r,this.int16[Z+1]=s,this.uint16[Z+2]=l,this.uint16[Z+3]=u,this.uint32[re+2]=d,this.uint32[re+3]=f,this.uint32[re+4]=g,this.uint16[Z+10]=b,this.uint16[Z+11]=w,this.uint16[Z+12]=E,this.float32[re+7]=C,this.float32[re+8]=M,this.uint8[se+36]=z,this.uint8[se+37]=U,this.uint8[se+38]=F,this.uint32[re+10]=H,this.int16[Z+22]=Q,e}}ao.prototype.bytesPerElement=48,De("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",ao);class sa extends Rt{_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(e,r,s,l,u,d,f,g,b,w,E,C,M,z,U,F,H,Q,Z,re,se,ce,ze,Be,Pe,Ie,Te,Me){const Ae=this.length;return this.resize(Ae+1),this.emplace(Ae,e,r,s,l,u,d,f,g,b,w,E,C,M,z,U,F,H,Q,Z,re,se,ce,ze,Be,Pe,Ie,Te,Me)}emplace(e,r,s,l,u,d,f,g,b,w,E,C,M,z,U,F,H,Q,Z,re,se,ce,ze,Be,Pe,Ie,Te,Me,Ae){const ye=34*e,$e=17*e;return this.int16[ye+0]=r,this.int16[ye+1]=s,this.int16[ye+2]=l,this.int16[ye+3]=u,this.int16[ye+4]=d,this.int16[ye+5]=f,this.int16[ye+6]=g,this.int16[ye+7]=b,this.uint16[ye+8]=w,this.uint16[ye+9]=E,this.uint16[ye+10]=C,this.uint16[ye+11]=M,this.uint16[ye+12]=z,this.uint16[ye+13]=U,this.uint16[ye+14]=F,this.uint16[ye+15]=H,this.uint16[ye+16]=Q,this.uint16[ye+17]=Z,this.uint16[ye+18]=re,this.uint16[ye+19]=se,this.uint16[ye+20]=ce,this.uint16[ye+21]=ze,this.uint16[ye+22]=Be,this.uint32[$e+12]=Pe,this.float32[$e+13]=Ie,this.float32[$e+14]=Te,this.float32[$e+15]=Me,this.float32[$e+16]=Ae,e}}sa.prototype.bytesPerElement=68,De("StructArrayLayout8i15ui1ul4f68",sa);class aa extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.float32[1*e+0]=r,e}}aa.prototype.bytesPerElement=4,De("StructArrayLayout1f4",aa);class oa extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,s)}emplace(e,r,s,l){const u=4*e;return this.uint32[2*e+0]=r,this.uint16[u+2]=s,this.uint16[u+3]=l,e}}oa.prototype.bytesPerElement=8,De("StructArrayLayout1ul2ui8",oa);class o extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r){const s=this.length;return this.resize(s+1),this.emplace(s,e,r)}emplace(e,r,s){const l=2*e;return this.uint16[l+0]=r,this.uint16[l+1]=s,e}}o.prototype.bytesPerElement=4,De("StructArrayLayout2ui4",o);class t extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.uint16[1*e+0]=r,e}}t.prototype.bytesPerElement=2,De("StructArrayLayout1ui2",t);class n extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,s,l){const u=this.length;return this.resize(u+1),this.emplace(u,e,r,s,l)}emplace(e,r,s,l,u){const d=4*e;return this.float32[d+0]=r,this.float32[d+1]=s,this.float32[d+2]=l,this.float32[d+3]=u,e}}n.prototype.bytesPerElement=16,De("StructArrayLayout4f16",n);class a extends Lr{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 ve(this.anchorPointX,this.anchorPointY)}}a.prototype.size=20;class c extends dn{get(e){return new a(this,e)}}De("CollisionBoxArray",c);class p extends Lr{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(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}p.prototype.size=48;class m extends ao{get(e){return new p(this,e)}}De("PlacedSymbolArray",m);class y extends Lr{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(e){this._structArray.uint32[this._pos4+12]=e}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get textOffset0(){return this._structArray.float32[this._pos4+14]}get textOffset1(){return this._structArray.float32[this._pos4+15]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+16]}}y.prototype.size=68;class _ extends sa{get(e){return new y(this,e)}}De("SymbolInstanceArray",_);class v extends aa{getoffsetX(e){return this.float32[1*e+0]}}De("GlyphOffsetArray",v);class S extends ea{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}De("SymbolLineVertexArray",S);class T extends Lr{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]}}T.prototype.size=8;class L extends oa{get(e){return new T(this,e)}}De("FeatureIndexArray",L);class O extends Un{}class R extends Un{}class B extends Un{}class $ extends yr{}class W extends ta{}class ne extends un{}class V extends ia{}class ie extends fs{}class ae extends no{}class fe extends Nn{}class _e extends so{}class xe extends pn{}class ge extends na{}class ke extends o{}const Ve=Xt([{name:"a_pos",components:2,type:"Int16"}],4),{members:Qe}=Ve;class Se{constructor(e=[]){this.segments=e}prepareSegment(e,r,s,l){let u=this.segments[this.segments.length-1];return e>Se.MAX_VERTEX_ARRAY_LENGTH&&ci(`Max vertices per segment is ${Se.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!u||u.vertexLength+e>Se.MAX_VERTEX_ARRAY_LENGTH||u.sortKey!==l)&&(u={vertexOffset:r.length,primitiveOffset:s.length,vertexLength:0,primitiveLength:0},l!==void 0&&(u.sortKey=l),this.segments.push(u)),u}get(){return this.segments}destroy(){for(const e of this.segments)for(const r in e.vaos)e.vaos[r].destroy()}static simpleSegment(e,r,s,l){return new Se([{vertexOffset:e,primitiveOffset:r,vertexLength:s,primitiveLength:l,vaos:{},sortKey:0}])}}function Ze(i,e){return 256*(i=Ct(Math.floor(i),0,255))+Ct(Math.floor(e),0,255)}Se.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,De("SegmentVector",Se);const Le=Xt([{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 dt={exports:{}},Nt={exports:{}};Nt.exports=function(i,e){var r,s,l,u,d,f,g,b;for(s=i.length-(r=3&i.length),l=e,d=3432918353,f=461845907,b=0;b<s;)g=255&i.charCodeAt(b)|(255&i.charCodeAt(++b))<<8|(255&i.charCodeAt(++b))<<16|(255&i.charCodeAt(++b))<<24,++b,l=27492+(65535&(u=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+(u>>>16)&65535)<<16);switch(g=0,r){case 3:g^=(255&i.charCodeAt(b+2))<<16;case 2:g^=(255&i.charCodeAt(b+1))<<8;case 1:l^=g=(65535&(g=(g=(65535&(g^=255&i.charCodeAt(b)))*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 pt=Nt.exports,tt={exports:{}};tt.exports=function(i,e){for(var r,s=i.length,l=e^s,u=0;s>=4;)r=1540483477*(65535&(r=255&i.charCodeAt(u)|(255&i.charCodeAt(++u))<<8|(255&i.charCodeAt(++u))<<16|(255&i.charCodeAt(++u))<<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)),s-=4,++u;switch(s){case 3:l^=(255&i.charCodeAt(u+2))<<16;case 2:l^=(255&i.charCodeAt(u+1))<<8;case 1:l=1540483477*(65535&(l^=255&i.charCodeAt(u)))+((1540483477*(l>>>16)&65535)<<16)}return l=1540483477*(65535&(l^=l>>>13))+((1540483477*(l>>>16)&65535)<<16),(l^=l>>>15)>>>0};var Bt=pt,bi=tt.exports;dt.exports=Bt,dt.exports.murmur3=Bt,dt.exports.murmur2=bi;var Vt=me(dt.exports);class ei{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,s,l){this.ids.push(Ri(e)),this.positions.push(r,s,l)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const r=Ri(e);let s=0,l=this.ids.length-1;for(;s<l;){const d=s+l>>1;this.ids[d]>=r?l=d:s=d+1}const u=[];for(;this.ids[s]===r;)u.push({index:this.positions[3*s],start:this.positions[3*s+1],end:this.positions[3*s+2]}),s++;return u}static serialize(e,r){const s=new Float64Array(e.ids),l=new Uint32Array(e.positions);return ir(s,l,0,s.length-1),r&&r.push(s.buffer,l.buffer),{ids:s,positions:l}}static deserialize(e){const r=new ei;return r.ids=e.ids,r.positions=e.positions,r.indexed=!0,r}}function Ri(i){const e=+i;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:Vt(String(i))}function ir(i,e,r,s){for(;r<s;){const l=i[r+s>>1];let u=r-1,d=s+1;for(;;){do u++;while(i[u]<l);do d--;while(i[d]>l);if(u>=d)break;rr(i,u,d),rr(e,3*u,3*d),rr(e,3*u+1,3*d+1),rr(e,3*u+2,3*d+2)}d-r<s-d?(ir(i,e,r,d),r=d+1):(ir(i,e,d+1,s),s=d)}}function rr(i,e,r){const s=i[e];i[e]=i[r],i[r]=s}De("FeaturePositionMap",ei);class wi{constructor(e,r){this.gl=e.gl,this.location=r}}class xr extends wi{constructor(e,r){super(e,r),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}}class ms extends wi{constructor(e,r){super(e,r),this.current=[0,0,0,0]}set(e){e[0]===this.current[0]&&e[1]===this.current[1]&&e[2]===this.current[2]&&e[3]===this.current[3]||(this.current=e,this.gl.uniform4f(this.location,e[0],e[1],e[2],e[3]))}}class ui extends wi{constructor(e,r){super(e,r),this.current=We.transparent}set(e){e.r===this.current.r&&e.g===this.current.g&&e.b===this.current.b&&e.a===this.current.a||(this.current=e,this.gl.uniform4f(this.location,e.r,e.g,e.b,e.a))}}const ti=new Float32Array(16);function ft(i){return[Ze(255*i.r,255*i.g),Ze(255*i.b,255*i.a)]}class Yt{constructor(e,r,s){this.value=e,this.uniformNames=r.map(l=>`u_${l}`),this.type=s}setUniform(e,r,s){e.set(s.constantOr(this.value))}getBinding(e,r,s){return this.type==="color"?new ui(e,r):new xr(e,r)}}class ii{constructor(e,r){this.uniformNames=r.map(s=>`u_${s}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,r){this.pixelRatioFrom=r.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=r.tlbr,this.patternTo=e.tlbr}setUniform(e,r,s,l){const u=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;u&&e.set(u)}getBinding(e,r,s){return s.substr(0,9)==="u_pattern"?new ms(e,r):new xr(e,r)}}class gt{constructor(e,r,s,l){this.expression=e,this.type=s,this.maxValue=0,this.paintVertexAttributes=r.map(u=>({name:`a_${u}`,type:"Float32",components:s==="color"?2:1,offset:0})),this.paintVertexArray=new l}populatePaintArray(e,r,s,l,u){const d=this.paintVertexArray.length,f=this.expression.evaluate(new Pt(0),r,{},l,[],u);this.paintVertexArray.resize(e),this._setPaintValue(d,e,f)}updatePaintArray(e,r,s,l){const u=this.expression.evaluate({zoom:0},s,l);this._setPaintValue(e,r,u)}_setPaintValue(e,r,s){if(this.type==="color"){const l=ft(s);for(let u=e;u<r;u++)this.paintVertexArray.emplace(u,l[0],l[1])}else{for(let l=e;l<r;l++)this.paintVertexArray.emplace(l,s);this.maxValue=Math.max(this.maxValue,Math.abs(s))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Jt{constructor(e,r,s,l,u,d){this.expression=e,this.uniformNames=r.map(f=>`u_${f}_t`),this.type=s,this.useIntegerZoom=l,this.zoom=u,this.maxValue=0,this.paintVertexAttributes=r.map(f=>({name:`a_${f}`,type:"Float32",components:s==="color"?4:2,offset:0})),this.paintVertexArray=new d}populatePaintArray(e,r,s,l,u){const d=this.expression.evaluate(new Pt(this.zoom),r,{},l,[],u),f=this.expression.evaluate(new Pt(this.zoom+1),r,{},l,[],u),g=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(g,e,d,f)}updatePaintArray(e,r,s,l){const u=this.expression.evaluate({zoom:this.zoom},s,l),d=this.expression.evaluate({zoom:this.zoom+1},s,l);this._setPaintValue(e,r,u,d)}_setPaintValue(e,r,s,l){if(this.type==="color"){const u=ft(s),d=ft(l);for(let f=e;f<r;f++)this.paintVertexArray.emplace(f,u[0],u[1],d[0],d[1])}else{for(let u=e;u<r;u++)this.paintVertexArray.emplace(u,s,l);this.maxValue=Math.max(this.maxValue,Math.abs(s),Math.abs(l))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,r){const s=this.useIntegerZoom?Math.floor(r.zoom):r.zoom,l=Ct(this.expression.interpolationFactor(s,this.zoom,this.zoom+1),0,1);e.set(l)}getBinding(e,r,s){return new xr(e,r)}}class Bi{constructor(e,r,s,l,u,d){this.expression=e,this.type=r,this.useIntegerZoom=s,this.zoom=l,this.layerId=d,this.zoomInPaintVertexArray=new u,this.zoomOutPaintVertexArray=new u}populatePaintArray(e,r,s){const l=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(l,e,r.patterns&&r.patterns[this.layerId],s)}updatePaintArray(e,r,s,l,u){this._setPaintValues(e,r,s.patterns&&s.patterns[this.layerId],u)}_setPaintValues(e,r,s,l){if(!l||!s)return;const{min:u,mid:d,max:f}=s,g=l[u],b=l[d],w=l[f];if(g&&b&&w)for(let E=e;E<r;E++)this.zoomInPaintVertexArray.emplace(E,b.tl[0],b.tl[1],b.br[0],b.br[1],g.tl[0],g.tl[1],g.br[0],g.br[1],b.pixelRatio,g.pixelRatio),this.zoomOutPaintVertexArray.emplace(E,b.tl[0],b.tl[1],b.br[0],b.br[1],w.tl[0],w.tl[1],w.br[0],w.br[1],b.pixelRatio,w.pixelRatio)}upload(e){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,Le.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,Le.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class la{constructor(e,r,s){this.binders={},this._buffers=[];const l=[];for(const u in e.paint._values){if(!s(u))continue;const d=e.paint.get(u);if(!(d instanceof gr&&Rn(d.property.specification)))continue;const f=xc(u,e.type),g=d.value,b=d.property.specification.type,w=d.property.useIntegerZoom,E=d.property.specification["property-type"],C=E==="cross-faded"||E==="cross-faded-data-driven";if(g.kind==="constant")this.binders[u]=C?new ii(g.value,f):new Yt(g.value,f,b),l.push(`/u_${u}`);else if(g.kind==="source"||C){const M=bl(u,b,"source");this.binders[u]=C?new Bi(g,b,w,r,M,e.id):new gt(g,f,b,M),l.push(`/a_${u}`)}else{const M=bl(u,b,"composite");this.binders[u]=new Jt(g,f,b,w,r,M),l.push(`/z_${u}`)}}this.cacheKey=l.sort().join("")}getMaxValue(e){const r=this.binders[e];return r instanceof gt||r instanceof Jt?r.maxValue:0}populatePaintArrays(e,r,s,l,u){for(const d in this.binders){const f=this.binders[d];(f instanceof gt||f instanceof Jt||f instanceof Bi)&&f.populatePaintArray(e,r,s,l,u)}}setConstantPatternPositions(e,r){for(const s in this.binders){const l=this.binders[s];l instanceof ii&&l.setConstantPatternPositions(e,r)}}updatePaintArrays(e,r,s,l,u){let d=!1;for(const f in e){const g=r.getPositions(f);for(const b of g){const w=s.feature(b.index);for(const E in this.binders){const C=this.binders[E];if((C instanceof gt||C instanceof Jt||C instanceof Bi)&&C.expression.isStateDependent===!0){const M=l.paint.get(E);C.expression=M.value,C.updatePaintArray(b.start,b.end,w,e[f],u),d=!0}}}}return d}defines(){const e=[];for(const r in this.binders){const s=this.binders[r];(s instanceof Yt||s instanceof ii)&&e.push(...s.uniformNames.map(l=>`#define HAS_UNIFORM_${l}`))}return e}getBinderAttributes(){const e=[];for(const r in this.binders){const s=this.binders[r];if(s instanceof gt||s instanceof Jt)for(let l=0;l<s.paintVertexAttributes.length;l++)e.push(s.paintVertexAttributes[l].name);else if(s instanceof Bi)for(let l=0;l<Le.members.length;l++)e.push(Le.members[l].name)}return e}getBinderUniforms(){const e=[];for(const r in this.binders){const s=this.binders[r];if(s instanceof Yt||s instanceof ii||s instanceof Jt)for(const l of s.uniformNames)e.push(l)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,r){const s=[];for(const l in this.binders){const u=this.binders[l];if(u instanceof Yt||u instanceof ii||u instanceof Jt){for(const d of u.uniformNames)if(r[d]){const f=u.getBinding(e,r[d],d);s.push({name:d,property:l,binding:f})}}}return s}setUniforms(e,r,s,l){for(const{name:u,property:d,binding:f}of r)this.binders[d].setUniform(f,l,s.get(d),u)}updatePaintBuffers(e){this._buffers=[];for(const r in this.binders){const s=this.binders[r];if(e&&s instanceof Bi){const l=e.fromScale===2?s.zoomInPaintVertexBuffer:s.zoomOutPaintVertexBuffer;l&&this._buffers.push(l)}else(s instanceof gt||s instanceof Jt)&&s.paintVertexBuffer&&this._buffers.push(s.paintVertexBuffer)}}upload(e){for(const r in this.binders){const s=this.binders[r];(s instanceof gt||s instanceof Jt||s instanceof Bi)&&s.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const r=this.binders[e];(r instanceof gt||r instanceof Jt||r instanceof Bi)&&r.destroy()}}}class zr{constructor(e,r,s=()=>!0){this.programConfigurations={};for(const l of e)this.programConfigurations[l.id]=new la(l,r,s);this.needsUpload=!1,this._featureMap=new ei,this._bufferOffset=0}populatePaintArrays(e,r,s,l,u,d){for(const f in this.programConfigurations)this.programConfigurations[f].populatePaintArrays(e,r,l,u,d);r.id!==void 0&&this._featureMap.add(r.id,s,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,r,s,l){for(const u of s)this.needsUpload=this.programConfigurations[u.id].updatePaintArrays(e,this._featureMap,r,u,l)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const r in this.programConfigurations)this.programConfigurations[r].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}function xc(i,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[i]||[i.replace(`${e}-`,"").replace(/-/g,"_")]}function bl(i,e,r){const s={color:{source:un,composite:n},number:{source:aa,composite:un}},l=function(u){return{"line-pattern":{source:V,composite:V},"fill-pattern":{source:V,composite:V},"fill-extrusion-pattern":{source:V,composite:V}}[u]}(i);return l&&l[r]||s[e][r]}De("ConstantBinder",Yt),De("CrossFadedConstantBinder",ii),De("SourceExpressionBinder",gt),De("CrossFadedCompositeBinder",Bi),De("CompositeExpressionBinder",Jt),De("ProgramConfiguration",la,{omit:["_buffers"]}),De("ProgramConfigurationSet",zr);var It=8192;const oo=Math.pow(2,14)-1,gs=-oo-1;function Dr(i){const e=It/i.extent,r=i.loadGeometry();for(let s=0;s<r.length;s++){const l=r[s];for(let u=0;u<l.length;u++){const d=l[u],f=Math.round(d.x*e),g=Math.round(d.y*e);d.x=Ct(f,gs,oo),d.y=Ct(g,gs,oo),(f<d.x||f>d.x+1||g<d.y||g>d.y+1)&&ci("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function _s(i,e){return{type:i.type,id:i.id,properties:i.properties,geometry:e?Dr(i):[]}}function wl(i,e,r,s,l){i.emplaceBack(2*e+(s+1)/2,2*r+(l+1)/2)}class vc{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new R,this.indexArray=new ge,this.segments=new Se,this.programConfigurations=new zr(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,s){const l=this.layers[0],u=[];let d=null,f=!1;l.type==="circle"&&(d=l.layout.get("circle-sort-key"),f=!d.isConstant());for(const{feature:g,id:b,index:w,sourceLayerIndex:E}of e){const C=this.layers[0]._featureFilter.needGeometry,M=_s(g,C);if(!this.layers[0]._featureFilter.filter(new Pt(this.zoom),M,s))continue;const z=f?d.evaluate(M,{},s):void 0,U={id:b,properties:g.properties,type:g.type,sourceLayerIndex:E,index:w,geometry:C?M.geometry:Dr(g),patterns:{},sortKey:z};u.push(U)}f&&u.sort((g,b)=>g.sortKey-b.sortKey);for(const g of u){const{geometry:b,index:w,sourceLayerIndex:E}=g,C=e[w].feature;this.addFeature(g,b,w,s),r.featureIndex.insert(C,b,w,E,this.index)}}update(e,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,s)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Qe),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,r,s,l){for(const u of r)for(const d of u){const f=d.x,g=d.y;if(f<0||f>=It||g<0||g>=It)continue;const b=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),w=b.vertexLength;wl(this.layoutVertexArray,f,g,-1,-1),wl(this.layoutVertexArray,f,g,1,-1),wl(this.layoutVertexArray,f,g,1,1),wl(this.layoutVertexArray,f,g,-1,1),this.indexArray.emplaceBack(w,w+1,w+2),this.indexArray.emplaceBack(w,w+3,w+2),b.vertexLength+=4,b.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,{},l)}}function xu(i,e){for(let r=0;r<i.length;r++)if(ca(e,i[r]))return!0;for(let r=0;r<e.length;r++)if(ca(i,e[r]))return!0;return!!bc(i,e)}function rm(i,e,r){return!!ca(i,e)||!!wc(e,i,r)}function vu(i,e){if(i.length===1)return wu(e,i[0]);for(let r=0;r<e.length;r++){const s=e[r];for(let l=0;l<s.length;l++)if(ca(i,s[l]))return!0}for(let r=0;r<i.length;r++)if(wu(e,i[r]))return!0;for(let r=0;r<e.length;r++)if(bc(i,e[r]))return!0;return!1}function nm(i,e,r){if(i.length>1){if(bc(i,e))return!0;for(let s=0;s<e.length;s++)if(wc(e[s],i,r))return!0}for(let s=0;s<i.length;s++)if(wc(i[s],e,r))return!0;return!1}function bc(i,e){if(i.length===0||e.length===0)return!1;for(let r=0;r<i.length-1;r++){const s=i[r],l=i[r+1];for(let u=0;u<e.length-1;u++)if(sm(s,l,e[u],e[u+1]))return!0}return!1}function sm(i,e,r,s){return yt(i,r,s)!==yt(e,r,s)&&yt(i,e,r)!==yt(i,e,s)}function wc(i,e,r){const s=r*r;if(e.length===1)return i.distSqr(e[0])<s;for(let l=1;l<e.length;l++)if(bu(i,e[l-1],e[l])<s)return!0;return!1}function bu(i,e,r){const s=e.distSqr(r);if(s===0)return i.distSqr(e);const l=((i.x-e.x)*(r.x-e.x)+(i.y-e.y)*(r.y-e.y))/s;return i.distSqr(l<0?e:l>1?r:r.sub(e)._mult(l)._add(e))}function wu(i,e){let r,s,l,u=!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++)s=r[f],l=r[g],s.y>e.y!=l.y>e.y&&e.x<(l.x-s.x)*(e.y-s.y)/(l.y-s.y)+s.x&&(u=!u)}return u}function ca(i,e){let r=!1;for(let s=0,l=i.length-1;s<i.length;l=s++){const u=i[s],d=i[l];u.y>e.y!=d.y>e.y&&e.x<(d.x-u.x)*(e.y-u.y)/(d.y-u.y)+u.x&&(r=!r)}return r}function am(i,e,r){const s=r[0],l=r[2];if(i.x<s.x&&e.x<s.x||i.x>l.x&&e.x>l.x||i.y<s.y&&e.y<s.y||i.y>l.y&&e.y>l.y)return!1;const u=yt(i,e,r[0]);return u!==yt(i,e,r[1])||u!==yt(i,e,r[2])||u!==yt(i,e,r[3])}function lo(i,e,r){const s=e.paint.get(i).value;return s.kind==="constant"?s.value:r.programConfigurations.get(e.id).getMaxValue(i)}function Tl(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function Sl(i,e,r,s,l){if(!e[0]&&!e[1])return i;const u=ve.convert(e)._mult(l);r==="viewport"&&u._rotate(-s);const d=[];for(let f=0;f<i.length;f++)d.push(i[f].sub(u));return d}let Tu,Su;De("CircleBucket",vc,{omit:["layers"]});var om={get paint(){return Su=Su||new Pi({"circle-radius":new Ge(oe.paint_circle["circle-radius"]),"circle-color":new Ge(oe.paint_circle["circle-color"]),"circle-blur":new Ge(oe.paint_circle["circle-blur"]),"circle-opacity":new Ge(oe.paint_circle["circle-opacity"]),"circle-translate":new Ue(oe.paint_circle["circle-translate"]),"circle-translate-anchor":new Ue(oe.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Ue(oe.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Ue(oe.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Ge(oe.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Ge(oe.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Ge(oe.paint_circle["circle-stroke-opacity"])})},get layout(){return Tu=Tu||new Pi({"circle-sort-key":new Ge(oe.layout_circle["circle-sort-key"])})}},Mi=1e-6,ha=typeof Float32Array<"u"?Float32Array:Array;function Tc(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 Eu(i,e,r){var s=e[0],l=e[1],u=e[2],d=e[3],f=e[4],g=e[5],b=e[6],w=e[7],E=e[8],C=e[9],M=e[10],z=e[11],U=e[12],F=e[13],H=e[14],Q=e[15],Z=r[0],re=r[1],se=r[2],ce=r[3];return i[0]=Z*s+re*f+se*E+ce*U,i[1]=Z*l+re*g+se*C+ce*F,i[2]=Z*u+re*b+se*M+ce*H,i[3]=Z*d+re*w+se*z+ce*Q,i[4]=(Z=r[4])*s+(re=r[5])*f+(se=r[6])*E+(ce=r[7])*U,i[5]=Z*l+re*g+se*C+ce*F,i[6]=Z*u+re*b+se*M+ce*H,i[7]=Z*d+re*w+se*z+ce*Q,i[8]=(Z=r[8])*s+(re=r[9])*f+(se=r[10])*E+(ce=r[11])*U,i[9]=Z*l+re*g+se*C+ce*F,i[10]=Z*u+re*b+se*M+ce*H,i[11]=Z*d+re*w+se*z+ce*Q,i[12]=(Z=r[12])*s+(re=r[13])*f+(se=r[14])*E+(ce=r[15])*U,i[13]=Z*l+re*g+se*C+ce*F,i[14]=Z*u+re*b+se*M+ce*H,i[15]=Z*d+re*w+se*z+ce*Q,i}Math.hypot||(Math.hypot=function(){for(var i=0,e=arguments.length;e--;)i+=arguments[e]*arguments[e];return Math.sqrt(i)});var co,lm=Eu;function El(i,e,r){var s=e[0],l=e[1],u=e[2],d=e[3];return i[0]=r[0]*s+r[4]*l+r[8]*u+r[12]*d,i[1]=r[1]*s+r[5]*l+r[9]*u+r[13]*d,i[2]=r[2]*s+r[6]*l+r[10]*u+r[14]*d,i[3]=r[3]*s+r[7]*l+r[11]*u+r[15]*d,i}function Iu(i,e){const r=El([],[i.x,i.y,0,1],e);return new ve(r[0]/r[3],r[1]/r[3])}co=new ha(4),ha!=Float32Array&&(co[0]=0,co[1]=0,co[2]=0,co[3]=0);class Au extends vc{}let Cu;De("HeatmapBucket",Au,{omit:["layers"]});var cm={get paint(){return Cu=Cu||new Pi({"heatmap-radius":new Ge(oe.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Ge(oe.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Ue(oe.paint_heatmap["heatmap-intensity"]),"heatmap-color":new io(oe.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Ue(oe.paint_heatmap["heatmap-opacity"])})}};function Sc(i,{width:e,height:r},s,l){if(l){if(l instanceof Uint8ClampedArray)l=new Uint8Array(l.buffer);else if(l.length!==e*r*s)throw new RangeError(`mismatched image size. expected: ${l.length} but got: ${e*r*s}`)}else l=new Uint8Array(e*r*s);return i.width=e,i.height=r,i.data=l,i}function Pu(i,{width:e,height:r},s){if(e===i.width&&r===i.height)return;const l=Sc({},{width:e,height:r},s);Ec(i,l,{x:0,y:0},{x:0,y:0},{width:Math.min(i.width,e),height:Math.min(i.height,r)},s),i.width=e,i.height=r,i.data=l.data}function Ec(i,e,r,s,l,u){if(l.width===0||l.height===0)return e;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>e.width||l.height>e.height||s.x>e.width-l.width||s.y>e.height-l.height)throw new RangeError("out of range destination coordinates for image copy");const d=i.data,f=e.data;if(d===f)throw new Error("srcData equals dstData, so image is already copied");for(let g=0;g<l.height;g++){const b=((r.y+g)*i.width+r.x)*u,w=((s.y+g)*e.width+s.x)*u;for(let E=0;E<l.width*u;E++)f[w+E]=d[b+E]}return e}class ho{constructor(e,r){Sc(this,e,1,r)}resize(e){Pu(this,e,1)}clone(){return new ho({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,s,l,u){Ec(e,r,s,l,u,1)}}class nr{constructor(e,r){Sc(this,e,4,r)}resize(e){Pu(this,e,4)}replace(e,r){r?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new nr({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,s,l,u){Ec(e,r,s,l,u,4)}}function Mu(i){const e={},r=i.resolution||256,s=i.clips?i.clips.length:1,l=i.image||new nr({width:r,height:s});if(Math.log(r)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${r}`);const u=(d,f,g)=>{e[i.evaluationKey]=g;const b=i.expression.evaluate(e);l.data[d+f+0]=Math.floor(255*b.r/b.a),l.data[d+f+1]=Math.floor(255*b.g/b.a),l.data[d+f+2]=Math.floor(255*b.b/b.a),l.data[d+f+3]=Math.floor(255*b.a)};if(i.clips)for(let d=0,f=0;d<s;++d,f+=4*r)for(let g=0,b=0;g<r;g++,b+=4){const w=g/(r-1),{start:E,end:C}=i.clips[d];u(f,b,E*(1-w)+C*w)}else for(let d=0,f=0;d<r;d++,f+=4)u(0,f,d/(r-1));return l}let ku;De("AlphaImage",ho),De("RGBAImage",nr);var hm={get paint(){return ku=ku||new Pi({"hillshade-illumination-direction":new Ue(oe.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Ue(oe.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Ue(oe.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Ue(oe.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Ue(oe.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Ue(oe.paint_hillshade["hillshade-accent-color"])})}};const um=Xt([{name:"a_pos",components:2,type:"Int16"}],4),{members:dm}=um;var Ic={exports:{}};function Il(i,e,r){r=r||2;var s,l,u,d,f,g,b,w=e&&e.length,E=w?e[0]*r:i.length,C=Lu(i,0,E,r,!0),M=[];if(!C||C.next===C.prev)return M;if(w&&(C=function(U,F,H,Q){var Z,re,se,ce=[];for(Z=0,re=F.length;Z<re;Z++)(se=Lu(U,F[Z]*Q,Z<re-1?F[Z+1]*Q:U.length,Q,!1))===se.next&&(se.steiner=!0),ce.push(vm(se));for(ce.sort(_m),Z=0;Z<ce.length;Z++)H=ym(ce[Z],H);return H}(i,e,C,r)),i.length>80*r){s=u=i[0],l=d=i[1];for(var z=r;z<E;z+=r)(f=i[z])<s&&(s=f),(g=i[z+1])<l&&(l=g),f>u&&(u=f),g>d&&(d=g);b=(b=Math.max(u-s,d-l))!==0?32767/b:0}return uo(C,M,r,s,l,b,0),M}function Lu(i,e,r,s,l){var u,d;if(l===Pc(i,e,r,s)>0)for(u=e;u<r;u+=s)d=Ru(u,i[u],i[u+1],d);else for(u=r-s;u>=e;u-=s)d=Ru(u,i[u],i[u+1],d);return d&&Al(d,d.next)&&(fo(d),d=d.next),d}function ys(i,e){if(!i)return i;e||(e=i);var r,s=i;do if(r=!1,s.steiner||!Al(s,s.next)&&$t(s.prev,s,s.next)!==0)s=s.next;else{if(fo(s),(s=e=s.prev)===s.next)break;r=!0}while(r||s!==e);return e}function uo(i,e,r,s,l,u,d){if(i){!d&&u&&function(w,E,C,M){var z=w;do z.z===0&&(z.z=Ac(z.x,z.y,E,C,M)),z.prevZ=z.prev,z.nextZ=z.next,z=z.next;while(z!==w);z.prevZ.nextZ=null,z.prevZ=null,function(U){var F,H,Q,Z,re,se,ce,ze,Be=1;do{for(H=U,U=null,re=null,se=0;H;){for(se++,Q=H,ce=0,F=0;F<Be&&(ce++,Q=Q.nextZ);F++);for(ze=Be;ce>0||ze>0&&Q;)ce!==0&&(ze===0||!Q||H.z<=Q.z)?(Z=H,H=H.nextZ,ce--):(Z=Q,Q=Q.nextZ,ze--),re?re.nextZ=Z:U=Z,Z.prevZ=re,re=Z;H=Q}re.nextZ=null,Be*=2}while(se>1)}(z)}(i,s,l,u);for(var f,g,b=i;i.prev!==i.next;)if(f=i.prev,g=i.next,u?fm(i,s,l,u):pm(i))e.push(f.i/r|0),e.push(i.i/r|0),e.push(g.i/r|0),fo(i),i=g.next,b=g.next;else if((i=g)===b){d?d===1?uo(i=mm(ys(i),e,r),e,r,s,l,u,2):d===2&&gm(i,e,r,s,l,u):uo(ys(i),e,r,s,l,u,1);break}}}function pm(i){var e=i.prev,r=i,s=i.next;if($t(e,r,s)>=0)return!1;for(var l=e.x,u=r.x,d=s.x,f=e.y,g=r.y,b=s.y,w=l<u?l<d?l:d:u<d?u:d,E=f<g?f<b?f:b:g<b?g:b,C=l>u?l>d?l:d:u>d?u:d,M=f>g?f>b?f:b:g>b?g:b,z=s.next;z!==e;){if(z.x>=w&&z.x<=C&&z.y>=E&&z.y<=M&&ua(l,f,u,g,d,b,z.x,z.y)&&$t(z.prev,z,z.next)>=0)return!1;z=z.next}return!0}function fm(i,e,r,s){var l=i.prev,u=i,d=i.next;if($t(l,u,d)>=0)return!1;for(var f=l.x,g=u.x,b=d.x,w=l.y,E=u.y,C=d.y,M=f<g?f<b?f:b:g<b?g:b,z=w<E?w<C?w:C:E<C?E:C,U=f>g?f>b?f:b:g>b?g:b,F=w>E?w>C?w:C:E>C?E:C,H=Ac(M,z,e,r,s),Q=Ac(U,F,e,r,s),Z=i.prevZ,re=i.nextZ;Z&&Z.z>=H&&re&&re.z<=Q;){if(Z.x>=M&&Z.x<=U&&Z.y>=z&&Z.y<=F&&Z!==l&&Z!==d&&ua(f,w,g,E,b,C,Z.x,Z.y)&&$t(Z.prev,Z,Z.next)>=0||(Z=Z.prevZ,re.x>=M&&re.x<=U&&re.y>=z&&re.y<=F&&re!==l&&re!==d&&ua(f,w,g,E,b,C,re.x,re.y)&&$t(re.prev,re,re.next)>=0))return!1;re=re.nextZ}for(;Z&&Z.z>=H;){if(Z.x>=M&&Z.x<=U&&Z.y>=z&&Z.y<=F&&Z!==l&&Z!==d&&ua(f,w,g,E,b,C,Z.x,Z.y)&&$t(Z.prev,Z,Z.next)>=0)return!1;Z=Z.prevZ}for(;re&&re.z<=Q;){if(re.x>=M&&re.x<=U&&re.y>=z&&re.y<=F&&re!==l&&re!==d&&ua(f,w,g,E,b,C,re.x,re.y)&&$t(re.prev,re,re.next)>=0)return!1;re=re.nextZ}return!0}function mm(i,e,r){var s=i;do{var l=s.prev,u=s.next.next;!Al(l,u)&&zu(l,s,s.next,u)&&po(l,u)&&po(u,l)&&(e.push(l.i/r|0),e.push(s.i/r|0),e.push(u.i/r|0),fo(s),fo(s.next),s=i=u),s=s.next}while(s!==i);return ys(s)}function gm(i,e,r,s,l,u){var d=i;do{for(var f=d.next.next;f!==d.prev;){if(d.i!==f.i&&bm(d,f)){var g=Du(d,f);return d=ys(d,d.next),g=ys(g,g.next),uo(d,e,r,s,l,u,0),void uo(g,e,r,s,l,u,0)}f=f.next}d=d.next}while(d!==i)}function _m(i,e){return i.x-e.x}function ym(i,e){var r=function(l,u){var d,f=u,g=l.x,b=l.y,w=-1/0;do{if(b<=f.y&&b>=f.next.y&&f.next.y!==f.y){var E=f.x+(b-f.y)*(f.next.x-f.x)/(f.next.y-f.y);if(E<=g&&E>w&&(w=E,d=f.x<f.next.x?f:f.next,E===g))return d}f=f.next}while(f!==u);if(!d)return null;var C,M=d,z=d.x,U=d.y,F=1/0;f=d;do g>=f.x&&f.x>=z&&g!==f.x&&ua(b<U?g:w,b,z,U,b<U?w:g,b,f.x,f.y)&&(C=Math.abs(b-f.y)/(g-f.x),po(f,l)&&(C<F||C===F&&(f.x>d.x||f.x===d.x&&xm(d,f)))&&(d=f,F=C)),f=f.next;while(f!==M);return d}(i,e);if(!r)return e;var s=Du(r,i);return ys(s,s.next),ys(r,r.next)}function xm(i,e){return $t(i.prev,i,e.prev)<0&&$t(e.next,i,i.next)<0}function Ac(i,e,r,s,l){return(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=(i-r)*l|0)|i<<8))|i<<4))|i<<2))|i<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-s)*l|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function vm(i){var e=i,r=i;do(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next;while(e!==i);return r}function ua(i,e,r,s,l,u,d,f){return(l-d)*(e-f)>=(i-d)*(u-f)&&(i-d)*(s-f)>=(r-d)*(e-f)&&(r-d)*(u-f)>=(l-d)*(s-f)}function bm(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!function(r,s){var l=r;do{if(l.i!==r.i&&l.next.i!==r.i&&l.i!==s.i&&l.next.i!==s.i&&zu(l,l.next,r,s))return!0;l=l.next}while(l!==r);return!1}(i,e)&&(po(i,e)&&po(e,i)&&function(r,s){var l=r,u=!1,d=(r.x+s.x)/2,f=(r.y+s.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&&(u=!u),l=l.next;while(l!==r);return u}(i,e)&&($t(i.prev,i,e.prev)||$t(i,e.prev,e))||Al(i,e)&&$t(i.prev,i,i.next)>0&&$t(e.prev,e,e.next)>0)}function $t(i,e,r){return(e.y-i.y)*(r.x-e.x)-(e.x-i.x)*(r.y-e.y)}function Al(i,e){return i.x===e.x&&i.y===e.y}function zu(i,e,r,s){var l=Pl($t(i,e,r)),u=Pl($t(i,e,s)),d=Pl($t(r,s,i)),f=Pl($t(r,s,e));return l!==u&&d!==f||!(l!==0||!Cl(i,r,e))||!(u!==0||!Cl(i,s,e))||!(d!==0||!Cl(r,i,s))||!(f!==0||!Cl(r,e,s))}function Cl(i,e,r){return e.x<=Math.max(i.x,r.x)&&e.x>=Math.min(i.x,r.x)&&e.y<=Math.max(i.y,r.y)&&e.y>=Math.min(i.y,r.y)}function Pl(i){return i>0?1:i<0?-1:0}function po(i,e){return $t(i.prev,i,i.next)<0?$t(i,e,i.next)>=0&&$t(i,i.prev,e)>=0:$t(i,e,i.prev)<0||$t(i,i.next,e)<0}function Du(i,e){var r=new Cc(i.i,i.x,i.y),s=new Cc(e.i,e.x,e.y),l=i.next,u=e.prev;return i.next=e,e.prev=i,r.next=l,l.prev=r,s.next=r,r.prev=s,u.next=s,s.prev=u,s}function Ru(i,e,r,s){var l=new Cc(i,e,r);return s?(l.next=s.next,l.prev=s,s.next.prev=l,s.next=l):(l.prev=l,l.next=l),l}function fo(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 Cc(i,e,r){this.i=i,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Pc(i,e,r,s){for(var l=0,u=e,d=r-s;u<r;u+=s)l+=(i[d]-i[u])*(i[u+1]+i[d+1]),d=u;return l}Ic.exports=Il,Ic.exports.default=Il,Il.deviation=function(i,e,r,s){var l=e&&e.length,u=Math.abs(Pc(i,0,l?e[0]*r:i.length,r));if(l)for(var d=0,f=e.length;d<f;d++)u-=Math.abs(Pc(i,e[d]*r,d<f-1?e[d+1]*r:i.length,r));var g=0;for(d=0;d<s.length;d+=3){var b=s[d]*r,w=s[d+1]*r,E=s[d+2]*r;g+=Math.abs((i[b]-i[E])*(i[w+1]-i[b+1])-(i[b]-i[w])*(i[E+1]-i[b+1]))}return u===0&&g===0?0:Math.abs((g-u)/u)},Il.flatten=function(i){for(var e=i[0][0].length,r={vertices:[],holes:[],dimensions:e},s=0,l=0;l<i.length;l++){for(var u=0;u<i[l].length;u++)for(var d=0;d<e;d++)r.vertices.push(i[l][u][d]);l>0&&r.holes.push(s+=i[l-1].length)}return r};var Bu=me(Ic.exports);function wm(i,e,r,s,l){Fu(i,e,r||0,s||i.length-1,l||Tm)}function Fu(i,e,r,s,l){for(;s>r;){if(s-r>600){var u=s-r+1,d=e-r+1,f=Math.log(u),g=.5*Math.exp(2*f/3),b=.5*Math.sqrt(f*g*(u-g)/u)*(d-u/2<0?-1:1);Fu(i,e,Math.max(r,Math.floor(e-d*g/u+b)),Math.min(s,Math.floor(e+(u-d)*g/u+b)),l)}var w=i[e],E=r,C=s;for(mo(i,r,e),l(i[s],w)>0&&mo(i,r,s);E<C;){for(mo(i,E,C),E++,C--;l(i[E],w)<0;)E++;for(;l(i[C],w)>0;)C--}l(i[r],w)===0?mo(i,r,C):mo(i,++C,s),C<=e&&(r=C+1),e<=C&&(s=C-1)}}function mo(i,e,r){var s=i[e];i[e]=i[r],i[r]=s}function Tm(i,e){return i<e?-1:i>e?1:0}function Mc(i,e){const r=i.length;if(r<=1)return[i];const s=[];let l,u;for(let d=0;d<r;d++){const f=Sa(i[d]);f!==0&&(i[d].area=Math.abs(f),u===void 0&&(u=f<0),u===f<0?(l&&s.push(l),l=[i[d]]):l.push(i[d]))}if(l&&s.push(l),e>1)for(let d=0;d<s.length;d++)s[d].length<=e||(wm(s[d],e,1,s[d].length-1,Sm),s[d]=s[d].slice(0,e));return s}function Sm(i,e){return e.area-i.area}function kc(i,e,r){const s=r.patternDependencies;let l=!1;for(const u of e){const d=u.paint.get(`${i}-pattern`);d.isConstant()||(l=!0);const f=d.constantOr(null);f&&(l=!0,s[f.to]=!0,s[f.from]=!0)}return l}function Lc(i,e,r,s,l){const u=l.patternDependencies;for(const d of e){const f=d.paint.get(`${i}-pattern`).value;if(f.kind!=="constant"){let g=f.evaluate({zoom:s-1},r,{},l.availableImages),b=f.evaluate({zoom:s},r,{},l.availableImages),w=f.evaluate({zoom:s+1},r,{},l.availableImages);g=g&&g.name?g.name:g,b=b&&b.name?b.name:b,w=w&&w.name?w.name:w,u[g]=!0,u[b]=!0,u[w]=!0,r.patterns[d.id]={min:g,mid:b,max:w}}}return r}class zc{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new B,this.indexArray=new ge,this.indexArray2=new ke,this.programConfigurations=new zr(e.layers,e.zoom),this.segments=new Se,this.segments2=new Se,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,s){this.hasPattern=kc("fill",this.layers,r);const l=this.layers[0].layout.get("fill-sort-key"),u=!l.isConstant(),d=[];for(const{feature:f,id:g,index:b,sourceLayerIndex:w}of e){const E=this.layers[0]._featureFilter.needGeometry,C=_s(f,E);if(!this.layers[0]._featureFilter.filter(new Pt(this.zoom),C,s))continue;const M=u?l.evaluate(C,{},s,r.availableImages):void 0,z={id:g,properties:f.properties,type:f.type,sourceLayerIndex:w,index:b,geometry:E?C.geometry:Dr(f),patterns:{},sortKey:M};d.push(z)}u&&d.sort((f,g)=>f.sortKey-g.sortKey);for(const f of d){const{geometry:g,index:b,sourceLayerIndex:w}=f;if(this.hasPattern){const E=Lc("fill",this.layers,f,this.zoom,r);this.patternFeatures.push(E)}else this.addFeature(f,g,b,s,{});r.featureIndex.insert(e[b].feature,g,b,w,this.index)}}update(e,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,s)}addFeatures(e,r,s){for(const l of this.patternFeatures)this.addFeature(l,l.geometry,l.index,r,s)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,dm),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),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(e,r,s,l,u){for(const d of Mc(r,500)){let f=0;for(const M of d)f+=M.length;const g=this.segments.prepareSegment(f,this.layoutVertexArray,this.indexArray),b=g.vertexLength,w=[],E=[];for(const M of d){if(M.length===0)continue;M!==d[0]&&E.push(w.length/2);const z=this.segments2.prepareSegment(M.length,this.layoutVertexArray,this.indexArray2),U=z.vertexLength;this.layoutVertexArray.emplaceBack(M[0].x,M[0].y),this.indexArray2.emplaceBack(U+M.length-1,U),w.push(M[0].x),w.push(M[0].y);for(let F=1;F<M.length;F++)this.layoutVertexArray.emplaceBack(M[F].x,M[F].y),this.indexArray2.emplaceBack(U+F-1,U+F),w.push(M[F].x),w.push(M[F].y);z.vertexLength+=M.length,z.primitiveLength+=M.length}const C=Bu(w,E);for(let M=0;M<C.length;M+=3)this.indexArray.emplaceBack(b+C[M],b+C[M+1],b+C[M+2]);g.vertexLength+=f,g.primitiveLength+=C.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,u,l)}}let Ou,Uu;De("FillBucket",zc,{omit:["layers","patternFeatures"]});var Em={get paint(){return Uu=Uu||new Pi({"fill-antialias":new Ue(oe.paint_fill["fill-antialias"]),"fill-opacity":new Ge(oe.paint_fill["fill-opacity"]),"fill-color":new Ge(oe.paint_fill["fill-color"]),"fill-outline-color":new Ge(oe.paint_fill["fill-outline-color"]),"fill-translate":new Ue(oe.paint_fill["fill-translate"]),"fill-translate-anchor":new Ue(oe.paint_fill["fill-translate-anchor"]),"fill-pattern":new ps(oe.paint_fill["fill-pattern"])})},get layout(){return Ou=Ou||new Pi({"fill-sort-key":new Ge(oe.layout_fill["fill-sort-key"])})}};const Im=Xt([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Am=Xt([{name:"a_centroid",components:2,type:"Int16"}],4),{members:Cm}=Im;var Vn={},Pm=J,Nu=da;function da(i,e,r,s,l){this.properties={},this.extent=r,this.type=0,this._pbf=i,this._geometry=-1,this._keys=s,this._values=l,i.readFields(Mm,this,e)}function Mm(i,e,r){i==1?e.id=r.readVarint():i==2?function(s,l){for(var u=s.readVarint()+s.pos;s.pos<u;){var d=l._keys[s.readVarint()],f=l._values[s.readVarint()];l.properties[d]=f}}(r,e):i==3?e.type=r.readVarint():i==4&&(e._geometry=r.pos)}function km(i){for(var e,r,s=0,l=0,u=i.length,d=u-1;l<u;d=l++)s+=((r=i[d]).x-(e=i[l]).x)*(e.y+r.y);return s}da.types=["Unknown","Point","LineString","Polygon"],da.prototype.loadGeometry=function(){var i=this._pbf;i.pos=this._geometry;for(var e,r=i.readVarint()+i.pos,s=1,l=0,u=0,d=0,f=[];i.pos<r;){if(l<=0){var g=i.readVarint();s=7&g,l=g>>3}if(l--,s===1||s===2)u+=i.readSVarint(),d+=i.readSVarint(),s===1&&(e&&f.push(e),e=[]),e.push(new Pm(u,d));else{if(s!==7)throw new Error("unknown command "+s);e&&e.push(e[0].clone())}}return e&&f.push(e),f},da.prototype.bbox=function(){var i=this._pbf;i.pos=this._geometry;for(var e=i.readVarint()+i.pos,r=1,s=0,l=0,u=0,d=1/0,f=-1/0,g=1/0,b=-1/0;i.pos<e;){if(s<=0){var w=i.readVarint();r=7&w,s=w>>3}if(s--,r===1||r===2)(l+=i.readSVarint())<d&&(d=l),l>f&&(f=l),(u+=i.readSVarint())<g&&(g=u),u>b&&(b=u);else if(r!==7)throw new Error("unknown command "+r)}return[d,g,f,b]},da.prototype.toGeoJSON=function(i,e,r){var s,l,u=this.extent*Math.pow(2,r),d=this.extent*i,f=this.extent*e,g=this.loadGeometry(),b=da.types[this.type];function w(M){for(var z=0;z<M.length;z++){var U=M[z];M[z]=[360*(U.x+d)/u-180,360/Math.PI*Math.atan(Math.exp((180-360*(U.y+f)/u)*Math.PI/180))-90]}}switch(this.type){case 1:var E=[];for(s=0;s<g.length;s++)E[s]=g[s][0];w(g=E);break;case 2:for(s=0;s<g.length;s++)w(g[s]);break;case 3:for(g=function(M){var z=M.length;if(z<=1)return[M];for(var U,F,H=[],Q=0;Q<z;Q++){var Z=km(M[Q]);Z!==0&&(F===void 0&&(F=Z<0),F===Z<0?(U&&H.push(U),U=[M[Q]]):U.push(M[Q]))}return U&&H.push(U),H}(g),s=0;s<g.length;s++)for(l=0;l<g[s].length;l++)w(g[s][l])}g.length===1?g=g[0]:b="Multi"+b;var C={type:"Feature",geometry:{type:b,coordinates:g},properties:this.properties};return"id"in this&&(C.id=this.id),C};var Lm=Nu,Vu=$u;function $u(i,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=i,this._keys=[],this._values=[],this._features=[],i.readFields(zm,this,e),this.length=this._features.length}function zm(i,e,r){i===15?e.version=r.readVarint():i===1?e.name=r.readString():i===5?e.extent=r.readVarint():i===2?e._features.push(r.pos):i===3?e._keys.push(r.readString()):i===4&&e._values.push(function(s){for(var l=null,u=s.readVarint()+s.pos;s.pos<u;){var d=s.readVarint()>>3;l=d===1?s.readString():d===2?s.readFloat():d===3?s.readDouble():d===4?s.readVarint64():d===5?s.readVarint():d===6?s.readSVarint():d===7?s.readBoolean():null}return l}(r))}$u.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 e=this._pbf.readVarint()+this._pbf.pos;return new Lm(this._pbf,e,this.extent,this._keys,this._values)};var Dm=Vu;function Rm(i,e,r){if(i===3){var s=new Dm(r,r.readVarint()+r.pos);s.length&&(e[s.name]=s)}}Vn.VectorTile=function(i,e){this.layers=i.readFields(Rm,{},e)},Vn.VectorTileFeature=Nu,Vn.VectorTileLayer=Vu;const Bm=Vn.VectorTileFeature.types,Dc=Math.pow(2,13);function go(i,e,r,s,l,u,d,f){i.emplaceBack(e,r,2*Math.floor(s*Dc)+d,l*Dc*2,u*Dc*2,Math.round(f))}class Rc{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new $,this.centroidVertexArray=new O,this.indexArray=new ge,this.programConfigurations=new zr(e.layers,e.zoom),this.segments=new Se,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,s){this.features=[],this.hasPattern=kc("fill-extrusion",this.layers,r);for(const{feature:l,id:u,index:d,sourceLayerIndex:f}of e){const g=this.layers[0]._featureFilter.needGeometry,b=_s(l,g);if(!this.layers[0]._featureFilter.filter(new Pt(this.zoom),b,s))continue;const w={id:u,sourceLayerIndex:f,index:d,geometry:g?b.geometry:Dr(l),properties:l.properties,type:l.type,patterns:{}};this.hasPattern?this.features.push(Lc("fill-extrusion",this.layers,w,this.zoom,r)):this.addFeature(w,w.geometry,d,s,{}),r.featureIndex.insert(l,w.geometry,d,f,this.index,!0)}}addFeatures(e,r,s){for(const l of this.features){const{geometry:u}=l;this.addFeature(l,u,l.index,r,s)}}update(e,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,s)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Cm),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,Am.members,!0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(e,r,s,l,u){const d={x:0,y:0,vertexCount:0};for(const f of Mc(r,500)){let g=0;for(const z of f)g+=z.length;let b=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const z of f){if(z.length===0||Om(z))continue;let U=0;for(let F=0;F<z.length;F++){const H=z[F];if(F>=1){const Q=z[F-1];if(!Fm(H,Q)){b.vertexLength+4>Se.MAX_VERTEX_ARRAY_LENGTH&&(b=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const Z=H.sub(Q)._perp()._unit(),re=Q.dist(H);U+re>32768&&(U=0),go(this.layoutVertexArray,H.x,H.y,Z.x,Z.y,0,0,U),go(this.layoutVertexArray,H.x,H.y,Z.x,Z.y,0,1,U),d.x+=2*H.x,d.y+=2*H.y,d.vertexCount+=2,U+=re,go(this.layoutVertexArray,Q.x,Q.y,Z.x,Z.y,0,0,U),go(this.layoutVertexArray,Q.x,Q.y,Z.x,Z.y,0,1,U),d.x+=2*Q.x,d.y+=2*Q.y,d.vertexCount+=2;const se=b.vertexLength;this.indexArray.emplaceBack(se,se+2,se+1),this.indexArray.emplaceBack(se+1,se+2,se+3),b.vertexLength+=4,b.primitiveLength+=2}}}}if(b.vertexLength+g>Se.MAX_VERTEX_ARRAY_LENGTH&&(b=this.segments.prepareSegment(g,this.layoutVertexArray,this.indexArray)),Bm[e.type]!=="Polygon")continue;const w=[],E=[],C=b.vertexLength;for(const z of f)if(z.length!==0){z!==f[0]&&E.push(w.length/2);for(let U=0;U<z.length;U++){const F=z[U];go(this.layoutVertexArray,F.x,F.y,0,0,1,1,0),d.x+=F.x,d.y+=F.y,d.vertexCount+=1,w.push(F.x),w.push(F.y)}}const M=Bu(w,E);for(let z=0;z<M.length;z+=3)this.indexArray.emplaceBack(C+M[z],C+M[z+2],C+M[z+1]);b.primitiveLength+=M.length/3,b.vertexLength+=g}for(let f=0;f<d.vertexCount;f++)this.centroidVertexArray.emplaceBack(Math.floor(d.x/d.vertexCount),Math.floor(d.y/d.vertexCount));this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,u,l)}}function Fm(i,e){return i.x===e.x&&(i.x<0||i.x>It)||i.y===e.y&&(i.y<0||i.y>It)}function Om(i){return i.every(e=>e.x<0)||i.every(e=>e.x>It)||i.every(e=>e.y<0)||i.every(e=>e.y>It)}let ju;De("FillExtrusionBucket",Rc,{omit:["layers","features"]});var Um={get paint(){return ju=ju||new Pi({"fill-extrusion-opacity":new Ue(oe["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Ge(oe["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Ue(oe["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Ue(oe["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new ps(oe["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Ge(oe["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Ge(oe["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Ue(oe["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};function _o(i,e){return i.x*e.x+i.y*e.y}function qu(i,e){if(i.length===1){let r=0;const s=e[r++];let l;for(;!l||s.equals(l);)if(l=e[r++],!l)return 1/0;for(;r<e.length;r++){const u=e[r],d=i[0],f=l.sub(s),g=u.sub(s),b=d.sub(s),w=_o(f,f),E=_o(f,g),C=_o(g,g),M=_o(b,f),z=_o(b,g),U=w*C-E*E,F=(C*M-E*z)/U,H=(w*z-E*M)/U,Q=s.z*(1-F-H)+l.z*F+u.z*H;if(isFinite(Q))return Q}return 1/0}{let r=1/0;for(const s of e)r=Math.min(r,s.z);return r}}const Nm=Xt([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:Vm}=Nm,$m=Xt([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:jm}=$m,qm=Vn.VectorTileFeature.types,Gm=Math.cos(Math.PI/180*37.5),Gu=Math.pow(2,14)/.5;class Bc{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(r=>{this.gradients[r.id]={}}),this.layoutVertexArray=new W,this.layoutVertexArray2=new ne,this.indexArray=new ge,this.programConfigurations=new zr(e.layers,e.zoom),this.segments=new Se,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,s){this.hasPattern=kc("line",this.layers,r);const l=this.layers[0].layout.get("line-sort-key"),u=!l.isConstant(),d=[];for(const{feature:f,id:g,index:b,sourceLayerIndex:w}of e){const E=this.layers[0]._featureFilter.needGeometry,C=_s(f,E);if(!this.layers[0]._featureFilter.filter(new Pt(this.zoom),C,s))continue;const M=u?l.evaluate(C,{},s):void 0,z={id:g,properties:f.properties,type:f.type,sourceLayerIndex:w,index:b,geometry:E?C.geometry:Dr(f),patterns:{},sortKey:M};d.push(z)}u&&d.sort((f,g)=>f.sortKey-g.sortKey);for(const f of d){const{geometry:g,index:b,sourceLayerIndex:w}=f;if(this.hasPattern){const E=Lc("line",this.layers,f,this.zoom,r);this.patternFeatures.push(E)}else this.addFeature(f,g,b,s,{});r.featureIndex.insert(e[b].feature,g,b,w,this.index)}}update(e,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,s)}addFeatures(e,r,s){for(const l of this.patternFeatures)this.addFeature(l,l.geometry,l.index,r,s)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,jm)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Vm),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,r,s,l,u){const d=this.layers[0].layout,f=d.get("line-join").evaluate(e,{}),g=d.get("line-cap"),b=d.get("line-miter-limit"),w=d.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const E of r)this.addLine(E,e,f,g,b,w);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,u,l)}addLine(e,r,s,l,u,d){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let H=0;H<e.length-1;H++)this.totalDistance+=e[H].dist(e[H+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const f=qm[r.type]==="Polygon";let g=e.length;for(;g>=2&&e[g-1].equals(e[g-2]);)g--;let b=0;for(;b<g-1&&e[b].equals(e[b+1]);)b++;if(g<(f?3:2))return;s==="bevel"&&(u=1.05);const w=this.overscaling<=16?15*It/(512*this.overscaling):0,E=this.segments.prepareSegment(10*g,this.layoutVertexArray,this.indexArray);let C,M,z,U,F;this.e1=this.e2=-1,f&&(C=e[g-2],F=e[b].sub(C)._unit()._perp());for(let H=b;H<g;H++){if(z=H===g-1?f?e[b+1]:void 0:e[H+1],z&&e[H].equals(z))continue;F&&(U=F),C&&(M=C),C=e[H],F=z?z.sub(C)._unit()._perp():U,U=U||F;let Q=U.add(F);Q.x===0&&Q.y===0||Q._unit();const Z=U.x*F.x+U.y*F.y,re=Q.x*F.x+Q.y*F.y,se=re!==0?1/re:1/0,ce=2*Math.sqrt(2-2*re),ze=re<Gm&&M&&z,Be=U.x*F.y-U.y*F.x>0;if(ze&&H>b){const Te=C.dist(M);if(Te>2*w){const Me=C.sub(C.sub(M)._mult(w/Te)._round());this.updateDistance(M,Me),this.addCurrentVertex(Me,U,0,0,E),M=Me}}const Pe=M&&z;let Ie=Pe?s:f?"butt":l;if(Pe&&Ie==="round"&&(se<d?Ie="miter":se<=2&&(Ie="fakeround")),Ie==="miter"&&se>u&&(Ie="bevel"),Ie==="bevel"&&(se>2&&(Ie="flipbevel"),se<u&&(Ie="miter")),M&&this.updateDistance(M,C),Ie==="miter")Q._mult(se),this.addCurrentVertex(C,Q,0,0,E);else if(Ie==="flipbevel"){if(se>100)Q=F.mult(-1);else{const Te=se*U.add(F).mag()/U.sub(F).mag();Q._perp()._mult(Te*(Be?-1:1))}this.addCurrentVertex(C,Q,0,0,E),this.addCurrentVertex(C,Q.mult(-1),0,0,E)}else if(Ie==="bevel"||Ie==="fakeround"){const Te=-Math.sqrt(se*se-1),Me=Be?Te:0,Ae=Be?0:Te;if(M&&this.addCurrentVertex(C,U,Me,Ae,E),Ie==="fakeround"){const ye=Math.round(180*ce/Math.PI/20);for(let $e=1;$e<ye;$e++){let Fe=$e/ye;if(Fe!==.5){const At=Fe-.5;Fe+=Fe*At*(Fe-1)*((1.0904+Z*(Z*(3.55645-1.43519*Z)-3.2452))*At*At+(.848013+Z*(.215638*Z-1.06021)))}const st=F.sub(U)._mult(Fe)._add(U)._unit()._mult(Be?-1:1);this.addHalfVertex(C,st.x,st.y,!1,Be,0,E)}}z&&this.addCurrentVertex(C,F,-Me,-Ae,E)}else if(Ie==="butt")this.addCurrentVertex(C,Q,0,0,E);else if(Ie==="square"){const Te=M?1:-1;this.addCurrentVertex(C,Q,Te,Te,E)}else Ie==="round"&&(M&&(this.addCurrentVertex(C,U,0,0,E),this.addCurrentVertex(C,U,1,1,E,!0)),z&&(this.addCurrentVertex(C,F,-1,-1,E,!0),this.addCurrentVertex(C,F,0,0,E)));if(ze&&H<g-1){const Te=C.dist(z);if(Te>2*w){const Me=C.add(z.sub(C)._mult(w/Te)._round());this.updateDistance(C,Me),this.addCurrentVertex(Me,F,0,0,E),C=Me}}}}addCurrentVertex(e,r,s,l,u,d=!1){const f=r.y*l-r.x,g=-r.y-r.x*l;this.addHalfVertex(e,r.x+r.y*s,r.y-r.x*s,d,!1,s,u),this.addHalfVertex(e,f,g,d,!0,-l,u),this.distance>Gu/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,r,s,l,u,d))}addHalfVertex({x:e,y:r},s,l,u,d,f,g){const b=.5*(this.lineClips?this.scaledDistance*(Gu-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(u?1:0),(r<<1)+(d?1:0),Math.round(63*s)+128,Math.round(63*l)+128,1+(f===0?0:f<0?-1:1)|(63&b)<<2,b>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const w=g.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,w),g.primitiveLength++),d?this.e2=w:this.e1=w}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,r){this.distance+=e.dist(r),this.updateScaledDistance()}}let Zu,Xu;De("LineBucket",Bc,{omit:["layers","patternFeatures"]});var Wu={get paint(){return Xu=Xu||new Pi({"line-opacity":new Ge(oe.paint_line["line-opacity"]),"line-color":new Ge(oe.paint_line["line-color"]),"line-translate":new Ue(oe.paint_line["line-translate"]),"line-translate-anchor":new Ue(oe.paint_line["line-translate-anchor"]),"line-width":new Ge(oe.paint_line["line-width"]),"line-gap-width":new Ge(oe.paint_line["line-gap-width"]),"line-offset":new Ge(oe.paint_line["line-offset"]),"line-blur":new Ge(oe.paint_line["line-blur"]),"line-dasharray":new to(oe.paint_line["line-dasharray"]),"line-pattern":new ps(oe.paint_line["line-pattern"]),"line-gradient":new io(oe.paint_line["line-gradient"])})},get layout(){return Zu=Zu||new Pi({"line-cap":new Ue(oe.layout_line["line-cap"]),"line-join":new Ge(oe.layout_line["line-join"]),"line-miter-limit":new Ue(oe.layout_line["line-miter-limit"]),"line-round-limit":new Ue(oe.layout_line["line-round-limit"]),"line-sort-key":new Ge(oe.layout_line["line-sort-key"])})}};class Zm extends Ge{possiblyEvaluate(e,r){return r=new Pt(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),super.possiblyEvaluate(e,r)}evaluate(e,r,s,l){return r=xi({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(e,r,s,l)}}let Ml;function Hu(i,e){return e>0?e+2*i:i}const Xm=Xt([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Wm=Xt([{name:"a_projected_pos",components:3,type:"Float32"}],4);Xt([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Hm=Xt([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);Xt([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const Ku=Xt([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Km=Xt([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function Ym(i,e,r){return i.sections.forEach(s=>{s.text=function(l,u,d){const f=u.layout.get("text-transform").evaluate(d,{});return f==="uppercase"?l=l.toLocaleUpperCase():f==="lowercase"&&(l=l.toLocaleLowerCase()),Yi.applyArabicShaping&&(l=Yi.applyArabicShaping(l)),l}(s.text,e,r)}),i}Xt([{name:"triangle",components:3,type:"Uint16"}]),Xt([{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"}]),Xt([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),Xt([{type:"Float32",name:"offsetX"}]),Xt([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);const 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 ri=24,Yu=xt,Ju=function(i,e,r,s,l){var u,d,f=8*l-s-1,g=(1<<f)-1,b=g>>1,w=-7,E=r?l-1:0,C=r?-1:1,M=i[e+E];for(E+=C,u=M&(1<<-w)-1,M>>=-w,w+=f;w>0;u=256*u+i[e+E],E+=C,w-=8);for(d=u&(1<<-w)-1,u>>=-w,w+=s;w>0;d=256*d+i[e+E],E+=C,w-=8);if(u===0)u=1-b;else{if(u===g)return d?NaN:1/0*(M?-1:1);d+=Math.pow(2,s),u-=b}return(M?-1:1)*d*Math.pow(2,u-s)},Qu=function(i,e,r,s,l,u){var d,f,g,b=8*u-l-1,w=(1<<b)-1,E=w>>1,C=l===23?Math.pow(2,-24)-Math.pow(2,-77):0,M=s?0:u-1,z=s?1:-1,U=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(f=isNaN(e)?1:0,d=w):(d=Math.floor(Math.log(e)/Math.LN2),e*(g=Math.pow(2,-d))<1&&(d--,g*=2),(e+=d+E>=1?C/g:C*Math.pow(2,1-E))*g>=2&&(d++,g/=2),d+E>=w?(f=0,d=w):d+E>=1?(f=(e*g-1)*Math.pow(2,l),d+=E):(f=e*Math.pow(2,E-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,b+=l;b>0;i[r+M]=255&d,M+=z,d/=256,b-=8);i[r+M-z]|=128*U};function xt(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}xt.Varint=0,xt.Fixed64=1,xt.Bytes=2,xt.Fixed32=5;var Fc=4294967296,ed=1/Fc,td=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function fn(i){return i.type===xt.Bytes?i.readVarint()+i.pos:i.pos+1}function pa(i,e,r){return r?4294967296*e+(i>>>0):4294967296*(e>>>0)+(i>>>0)}function id(i,e,r){var s=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(s);for(var l=r.pos-1;l>=i;l--)r.buf[l+s]=r.buf[l]}function Jm(i,e){for(var r=0;r<i.length;r++)e.writeVarint(i[r])}function Qm(i,e){for(var r=0;r<i.length;r++)e.writeSVarint(i[r])}function eg(i,e){for(var r=0;r<i.length;r++)e.writeFloat(i[r])}function tg(i,e){for(var r=0;r<i.length;r++)e.writeDouble(i[r])}function ig(i,e){for(var r=0;r<i.length;r++)e.writeBoolean(i[r])}function rg(i,e){for(var r=0;r<i.length;r++)e.writeFixed32(i[r])}function ng(i,e){for(var r=0;r<i.length;r++)e.writeSFixed32(i[r])}function sg(i,e){for(var r=0;r<i.length;r++)e.writeFixed64(i[r])}function ag(i,e){for(var r=0;r<i.length;r++)e.writeSFixed64(i[r])}function kl(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+16777216*i[e+3]}function fa(i,e,r){i[r]=e,i[r+1]=e>>>8,i[r+2]=e>>>16,i[r+3]=e>>>24}function rd(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+(i[e+3]<<24)}xt.prototype={destroy:function(){this.buf=null},readFields:function(i,e,r){for(r=r||this.length;this.pos<r;){var s=this.readVarint(),l=s>>3,u=this.pos;this.type=7&s,i(l,e,this),this.pos===u&&this.skip(s)}return e},readMessage:function(i,e){return this.readFields(i,e,this.readVarint()+this.pos)},readFixed32:function(){var i=kl(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=rd(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=kl(this.buf,this.pos)+kl(this.buf,this.pos+4)*Fc;return this.pos+=8,i},readSFixed64:function(){var i=kl(this.buf,this.pos)+rd(this.buf,this.pos+4)*Fc;return this.pos+=8,i},readFloat:function(){var i=Ju(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=Ju(this.buf,this.pos,!0,52,8);return this.pos+=8,i},readVarint:function(i){var e,r,s=this.buf;return e=127&(r=s[this.pos++]),r<128?e:(e|=(127&(r=s[this.pos++]))<<7,r<128?e:(e|=(127&(r=s[this.pos++]))<<14,r<128?e:(e|=(127&(r=s[this.pos++]))<<21,r<128?e:function(l,u,d){var f,g,b=d.buf;if(f=(112&(g=b[d.pos++]))>>4,g<128||(f|=(127&(g=b[d.pos++]))<<3,g<128)||(f|=(127&(g=b[d.pos++]))<<10,g<128)||(f|=(127&(g=b[d.pos++]))<<17,g<128)||(f|=(127&(g=b[d.pos++]))<<24,g<128)||(f|=(1&(g=b[d.pos++]))<<31,g<128))return pa(l,f,u);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=s[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,e=this.pos;return this.pos=i,i-e>=12&&td?function(r,s,l){return td.decode(r.subarray(s,l))}(this.buf,e,i):function(r,s,l){for(var u="",d=s;d<l;){var f,g,b,w=r[d],E=null,C=w>239?4:w>223?3:w>191?2:1;if(d+C>l)break;C===1?w<128&&(E=w):C===2?(192&(f=r[d+1]))==128&&(E=(31&w)<<6|63&f)<=127&&(E=null):C===3?(g=r[d+2],(192&(f=r[d+1]))==128&&(192&g)==128&&((E=(15&w)<<12|(63&f)<<6|63&g)<=2047||E>=55296&&E<=57343)&&(E=null)):C===4&&(g=r[d+2],b=r[d+3],(192&(f=r[d+1]))==128&&(192&g)==128&&(192&b)==128&&((E=(15&w)<<18|(63&f)<<12|(63&g)<<6|63&b)<=65535||E>=1114112)&&(E=null)),E===null?(E=65533,C=1):E>65535&&(E-=65536,u+=String.fromCharCode(E>>>10&1023|55296),E=56320|1023&E),u+=String.fromCharCode(E),d+=C}return u}(this.buf,e,i)},readBytes:function(){var i=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,i);return this.pos=i,e},readPackedVarint:function(i,e){if(this.type!==xt.Bytes)return i.push(this.readVarint(e));var r=fn(this);for(i=i||[];this.pos<r;)i.push(this.readVarint(e));return i},readPackedSVarint:function(i){if(this.type!==xt.Bytes)return i.push(this.readSVarint());var e=fn(this);for(i=i||[];this.pos<e;)i.push(this.readSVarint());return i},readPackedBoolean:function(i){if(this.type!==xt.Bytes)return i.push(this.readBoolean());var e=fn(this);for(i=i||[];this.pos<e;)i.push(this.readBoolean());return i},readPackedFloat:function(i){if(this.type!==xt.Bytes)return i.push(this.readFloat());var e=fn(this);for(i=i||[];this.pos<e;)i.push(this.readFloat());return i},readPackedDouble:function(i){if(this.type!==xt.Bytes)return i.push(this.readDouble());var e=fn(this);for(i=i||[];this.pos<e;)i.push(this.readDouble());return i},readPackedFixed32:function(i){if(this.type!==xt.Bytes)return i.push(this.readFixed32());var e=fn(this);for(i=i||[];this.pos<e;)i.push(this.readFixed32());return i},readPackedSFixed32:function(i){if(this.type!==xt.Bytes)return i.push(this.readSFixed32());var e=fn(this);for(i=i||[];this.pos<e;)i.push(this.readSFixed32());return i},readPackedFixed64:function(i){if(this.type!==xt.Bytes)return i.push(this.readFixed64());var e=fn(this);for(i=i||[];this.pos<e;)i.push(this.readFixed64());return i},readPackedSFixed64:function(i){if(this.type!==xt.Bytes)return i.push(this.readSFixed64());var e=fn(this);for(i=i||[];this.pos<e;)i.push(this.readSFixed64());return i},skip:function(i){var e=7&i;if(e===xt.Varint)for(;this.buf[this.pos++]>127;);else if(e===xt.Bytes)this.pos=this.readVarint()+this.pos;else if(e===xt.Fixed32)this.pos+=4;else{if(e!==xt.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(i,e){this.writeVarint(i<<3|e)},realloc:function(i){for(var e=this.length||16;e<this.pos+i;)e*=2;if(e!==this.length){var r=new Uint8Array(e);r.set(this.buf),this.buf=r,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(i){this.realloc(4),fa(this.buf,i,this.pos),this.pos+=4},writeSFixed32:function(i){this.realloc(4),fa(this.buf,i,this.pos),this.pos+=4},writeFixed64:function(i){this.realloc(8),fa(this.buf,-1&i,this.pos),fa(this.buf,Math.floor(i*ed),this.pos+4),this.pos+=8},writeSFixed64:function(i){this.realloc(8),fa(this.buf,-1&i,this.pos),fa(this.buf,Math.floor(i*ed),this.pos+4),this.pos+=8},writeVarint:function(i){(i=+i||0)>268435455||i<0?function(e,r){var s,l;if(e>=0?(s=e%4294967296|0,l=e/4294967296|0):(l=~(-e/4294967296),4294967295^(s=~(-e%4294967296))?s=s+1|0:(s=0,l=l+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");r.realloc(10),function(u,d,f){f.buf[f.pos++]=127&u|128,u>>>=7,f.buf[f.pos++]=127&u|128,u>>>=7,f.buf[f.pos++]=127&u|128,u>>>=7,f.buf[f.pos++]=127&u|128,f.buf[f.pos]=127&(u>>>=7)}(s,0,r),function(u,d){var f=(7&u)<<4;d.buf[d.pos++]|=f|((u>>>=3)?128:0),u&&(d.buf[d.pos++]=127&u|((u>>>=7)?128:0),u&&(d.buf[d.pos++]=127&u|((u>>>=7)?128:0),u&&(d.buf[d.pos++]=127&u|((u>>>=7)?128:0),u&&(d.buf[d.pos++]=127&u|((u>>>=7)?128:0),u&&(d.buf[d.pos++]=127&u)))))}(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 e=this.pos;this.pos=function(s,l,u){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?(s[u++]=239,s[u++]=191,s[u++]=189):f=d;continue}if(d<56320){s[u++]=239,s[u++]=191,s[u++]=189,f=d;continue}d=f-55296<<10|d-56320|65536,f=null}else f&&(s[u++]=239,s[u++]=191,s[u++]=189,f=null);d<128?s[u++]=d:(d<2048?s[u++]=d>>6|192:(d<65536?s[u++]=d>>12|224:(s[u++]=d>>18|240,s[u++]=d>>12&63|128),s[u++]=d>>6&63|128),s[u++]=63&d|128)}return u}(this.buf,i,this.pos);var r=this.pos-e;r>=128&&id(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(i){this.realloc(4),Qu(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),Qu(this.buf,i,this.pos,!0,52,8),this.pos+=8},writeBytes:function(i){var e=i.length;this.writeVarint(e),this.realloc(e);for(var r=0;r<e;r++)this.buf[this.pos++]=i[r]},writeRawMessage:function(i,e){this.pos++;var r=this.pos;i(e,this);var s=this.pos-r;s>=128&&id(r,s,this),this.pos=r-1,this.writeVarint(s),this.pos+=s},writeMessage:function(i,e,r){this.writeTag(i,xt.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(i,e){e.length&&this.writeMessage(i,Jm,e)},writePackedSVarint:function(i,e){e.length&&this.writeMessage(i,Qm,e)},writePackedBoolean:function(i,e){e.length&&this.writeMessage(i,ig,e)},writePackedFloat:function(i,e){e.length&&this.writeMessage(i,eg,e)},writePackedDouble:function(i,e){e.length&&this.writeMessage(i,tg,e)},writePackedFixed32:function(i,e){e.length&&this.writeMessage(i,rg,e)},writePackedSFixed32:function(i,e){e.length&&this.writeMessage(i,ng,e)},writePackedFixed64:function(i,e){e.length&&this.writeMessage(i,sg,e)},writePackedSFixed64:function(i,e){e.length&&this.writeMessage(i,ag,e)},writeBytesField:function(i,e){this.writeTag(i,xt.Bytes),this.writeBytes(e)},writeFixed32Field:function(i,e){this.writeTag(i,xt.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(i,e){this.writeTag(i,xt.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(i,e){this.writeTag(i,xt.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(i,e){this.writeTag(i,xt.Fixed64),this.writeSFixed64(e)},writeVarintField:function(i,e){this.writeTag(i,xt.Varint),this.writeVarint(e)},writeSVarintField:function(i,e){this.writeTag(i,xt.Varint),this.writeSVarint(e)},writeStringField:function(i,e){this.writeTag(i,xt.Bytes),this.writeString(e)},writeFloatField:function(i,e){this.writeTag(i,xt.Fixed32),this.writeFloat(e)},writeDoubleField:function(i,e){this.writeTag(i,xt.Fixed64),this.writeDouble(e)},writeBooleanField:function(i,e){this.writeVarintField(i,!!e)}};var Oc=me(Yu);const Uc=3;function og(i,e,r){i===1&&r.readMessage(lg,e)}function lg(i,e,r){if(i===3){const{id:s,bitmap:l,width:u,height:d,left:f,top:g,advance:b}=r.readMessage(cg,{});e.push({id:s,bitmap:new ho({width:u+2*Uc,height:d+2*Uc},l),metrics:{width:u,height:d,left:f,top:g,advance:b}})}}function cg(i,e,r){i===1?e.id=r.readVarint():i===2?e.bitmap=r.readBytes():i===3?e.width=r.readVarint():i===4?e.height=r.readVarint():i===5?e.left=r.readSVarint():i===6?e.top=r.readSVarint():i===7&&(e.advance=r.readVarint())}const nd=Uc;function sd(i){let e=0,r=0;for(const d of i)e+=d.w*d.h,r=Math.max(r,d.w);i.sort((d,f)=>f.h-d.h);const s=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}];let l=0,u=0;for(const d of i)for(let f=s.length-1;f>=0;f--){const g=s[f];if(!(d.w>g.w||d.h>g.h)){if(d.x=g.x,d.y=g.y,u=Math.max(u,d.y+d.h),l=Math.max(l,d.x+d.w),d.w===g.w&&d.h===g.h){const b=s.pop();f<s.length&&(s[f]=b)}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):(s.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:u,fill:e/(l*u)||0}}const Fi=1;class Nc{constructor(e,{pixelRatio:r,version:s,stretchX:l,stretchY:u,content:d}){this.paddedRect=e,this.pixelRatio=r,this.stretchX=l,this.stretchY=u,this.content=d,this.version=s}get tl(){return[this.paddedRect.x+Fi,this.paddedRect.y+Fi]}get br(){return[this.paddedRect.x+this.paddedRect.w-Fi,this.paddedRect.y+this.paddedRect.h-Fi]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2*Fi)/this.pixelRatio,(this.paddedRect.h-2*Fi)/this.pixelRatio]}}class ad{constructor(e,r){const s={},l={};this.haveRenderCallbacks=[];const u=[];this.addImages(e,s,u),this.addImages(r,l,u);const{w:d,h:f}=sd(u),g=new nr({width:d||1,height:f||1});for(const b in e){const w=e[b],E=s[b].paddedRect;nr.copy(w.data,g,{x:0,y:0},{x:E.x+Fi,y:E.y+Fi},w.data)}for(const b in r){const w=r[b],E=l[b].paddedRect,C=E.x+Fi,M=E.y+Fi,z=w.data.width,U=w.data.height;nr.copy(w.data,g,{x:0,y:0},{x:C,y:M},w.data),nr.copy(w.data,g,{x:0,y:U-1},{x:C,y:M-1},{width:z,height:1}),nr.copy(w.data,g,{x:0,y:0},{x:C,y:M+U},{width:z,height:1}),nr.copy(w.data,g,{x:z-1,y:0},{x:C-1,y:M},{width:1,height:U}),nr.copy(w.data,g,{x:0,y:0},{x:C+z,y:M},{width:1,height:U})}this.image=g,this.iconPositions=s,this.patternPositions=l}addImages(e,r,s){for(const l in e){const u=e[l],d={x:0,y:0,w:u.data.width+2*Fi,h:u.data.height+2*Fi};s.push(d),r[l]=new Nc(d,u),u.hasRenderCallback&&this.haveRenderCallbacks.push(l)}}patchUpdatedImages(e,r){e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const s in e.updatedImages)this.patchUpdatedImage(this.iconPositions[s],e.getImage(s),r),this.patchUpdatedImage(this.patternPositions[s],e.getImage(s),r)}patchUpdatedImage(e,r,s){if(!e||!r||e.version===r.version)return;e.version=r.version;const[l,u]=e.tl;s.update(r.data,void 0,{x:l,y:u})}}var $n;De("ImagePosition",Nc),De("ImageAtlas",ad),h.WritingMode=void 0,($n=h.WritingMode||(h.WritingMode={}))[$n.none=0]="none",$n[$n.horizontal=1]="horizontal",$n[$n.vertical=2]="vertical",$n[$n.horizontalOnly=3]="horizontalOnly";const xo=-17;class vo{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(e,r){const s=new vo;return s.scale=e||1,s.fontStack=r,s}static forImage(e){const r=new vo;return r.imageName=e,r}}class ma{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,r){const s=new ma;for(let l=0;l<e.sections.length;l++){const u=e.sections[l];u.image?s.addImageSection(u):s.addTextSection(u,r)}return s}length(){return this.text.length}getSection(e){return this.sections[this.sectionIndex[e]]}getSectionIndex(e){return this.sectionIndex[e]}getCharCode(e){return this.text.charCodeAt(e)}verticalizePunctuation(){this.text=function(e){let r="";for(let s=0;s<e.length;s++){const l=e.charCodeAt(s+1)||null,u=e.charCodeAt(s-1)||null;r+=l&&pl(l)&&!yo[e[s+1]]||u&&pl(u)&&!yo[e[s-1]]||!yo[e[s]]?e[s]:yo[e[s]]}return r}(this.text)}trim(){let e=0;for(let s=0;s<this.text.length&&zl[this.text.charCodeAt(s)];s++)e++;let r=this.text.length;for(let s=this.text.length-1;s>=0&&s>=e&&zl[this.text.charCodeAt(s)];s--)r--;this.text=this.text.substring(e,r),this.sectionIndex=this.sectionIndex.slice(e,r)}substring(e,r){const s=new ma;return s.text=this.text.substring(e,r),s.sectionIndex=this.sectionIndex.slice(e,r),s.sections=this.sections,s}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,r)=>Math.max(e,this.sections[r].scale),0)}addTextSection(e,r){this.text+=e.text,this.sections.push(vo.forText(e.scale,e.fontStack||r));const s=this.sections.length-1;for(let l=0;l<e.text.length;++l)this.sectionIndex.push(s)}addImageSection(e){const r=e.image?e.image.name:"";if(r.length===0)return void ci("Can't add FormattedSection with an empty image.");const s=this.getNextImageSectionCharCode();s?(this.text+=String.fromCharCode(s),this.sections.push(vo.forImage(r)),this.sectionIndex.push(this.sections.length-1)):ci("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Ll(i,e,r,s,l,u,d,f,g,b,w,E,C,M,z,U){const F=ma.fromFeature(i,l);let H;E===h.WritingMode.vertical&&F.verticalizePunctuation();const{processBidirectionalText:Q,processStyledBidirectionalText:Z}=Yi;if(Q&&F.sections.length===1){H=[];const ce=Q(F.toString(),Vc(F,b,u,e,s,M,z));for(const ze of ce){const Be=new ma;Be.text=ze,Be.sections=F.sections;for(let Pe=0;Pe<ze.length;Pe++)Be.sectionIndex.push(0);H.push(Be)}}else if(Z){H=[];const ce=Z(F.text,F.sectionIndex,Vc(F,b,u,e,s,M,z));for(const ze of ce){const Be=new ma;Be.text=ze[0],Be.sectionIndex=ze[1],Be.sections=F.sections,H.push(Be)}}else H=function(ce,ze){const Be=[],Pe=ce.text;let Ie=0;for(const Te of ze)Be.push(ce.substring(Ie,Te)),Ie=Te;return Ie<Pe.length&&Be.push(ce.substring(Ie,Pe.length)),Be}(F,Vc(F,b,u,e,s,M,z));const re=[],se={positionedLines:re,text:F.toString(),top:w[1],bottom:w[1],left:w[0],right:w[0],writingMode:E,iconsInText:!1,verticalizable:!1};return function(ce,ze,Be,Pe,Ie,Te,Me,Ae,ye,$e,Fe,st){let At=0,Mt=xo,Qt=0,ar=0;const di=Ae==="right"?1:Ae==="left"?0:.5;let Wt=0;for(const Ht of Ie){Ht.trim();const fi=Ht.getMaxScale(),Si=(fi-1)*ri,ki={positionedGlyphs:[],lineOffset:0};ce.positionedLines[Wt]=ki;const Ui=ki.positionedGlyphs;let Ni=0;if(!Ht.length()){Mt+=Te,++Wt;continue}for(let mi=0;mi<Ht.length();mi++){const at=Ht.getSection(mi),Ji=Ht.getSectionIndex(mi),gi=Ht.getCharCode(mi);let Ei=0,vr=null,Rr=null,Br=null,mn=ri;const br=!(ye===h.WritingMode.horizontal||!Fe&&!Xs(gi)||Fe&&(zl[gi]||(ni=gi,Ce.Arabic(ni)||Ce["Arabic Supplement"](ni)||Ce["Arabic Extended-A"](ni)||Ce["Arabic Presentation Forms-A"](ni)||Ce["Arabic Presentation Forms-B"](ni))));if(at.imageName){const or=Pe[at.imageName];if(!or)continue;Br=at.imageName,ce.iconsInText=ce.iconsInText||!0,Rr=or.paddedRect;const Vi=or.displaySize;at.scale=at.scale*ri/st,vr={width:Vi[0],height:Vi[1],left:Fi,top:-nd,advance:br?Vi[1]:Vi[0]},Ei=Si+(ri-Vi[1]*at.scale),mn=vr.advance;const gn=br?Vi[0]*at.scale-ri*fi:Vi[1]*at.scale-ri*fi;gn>0&&gn>Ni&&(Ni=gn)}else{const or=Be[at.fontStack],Vi=or&&or[gi];if(Vi&&Vi.rect)Rr=Vi.rect,vr=Vi.metrics;else{const gn=ze[at.fontStack],Eo=gn&&gn[gi];if(!Eo)continue;vr=Eo.metrics}Ei=(fi-at.scale)*ri}br?(ce.verticalizable=!0,Ui.push({glyph:gi,imageName:Br,x:At,y:Mt+Ei,vertical:br,scale:at.scale,fontStack:at.fontStack,sectionIndex:Ji,metrics:vr,rect:Rr}),At+=mn*at.scale+$e):(Ui.push({glyph:gi,imageName:Br,x:At,y:Mt+Ei,vertical:br,scale:at.scale,fontStack:at.fontStack,sectionIndex:Ji,metrics:vr,rect:Rr}),At+=vr.advance*at.scale+$e)}Ui.length!==0&&(Qt=Math.max(At-$e,Qt),dg(Ui,0,Ui.length-1,di,Ni)),At=0;const Ft=Te*fi+Ni;ki.lineOffset=Math.max(Ni,Si),Mt+=Ft,ar=Math.max(Ft,ar),++Wt}var ni;const pi=Mt-xo,{horizontalAlign:Ti,verticalAlign:Oi}=$c(Me);(function(Ht,fi,Si,ki,Ui,Ni,Ft,mi,at){const Ji=(fi-Si)*Ui;let gi=0;gi=Ni!==Ft?-mi*ki-xo:(-ki*at+.5)*Ft;for(const Ei of Ht)for(const vr of Ei.positionedGlyphs)vr.x+=Ji,vr.y+=gi})(ce.positionedLines,di,Ti,Oi,Qt,ar,Te,pi,Ie.length),ce.top+=-Oi*pi,ce.bottom=ce.top+pi,ce.left+=-Ti*Qt,ce.right=ce.left+Qt}(se,e,r,s,H,d,f,g,E,b,C,U),!function(ce){for(const ze of ce)if(ze.positionedGlyphs.length!==0)return!1;return!0}(re)&&se}const zl={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},hg={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function od(i,e,r,s,l,u){if(e.imageName){const d=s[e.imageName];return d?d.displaySize[0]*e.scale*ri/u+l:0}{const d=r[e.fontStack],f=d&&d[i];return f?f.metrics.advance*e.scale+l:0}}function ld(i,e,r,s){const l=Math.pow(i-e,2);return s?i<e?l/2:2*l:l+Math.abs(r)*r}function ug(i,e,r){let s=0;return i===10&&(s-=1e4),r&&(s+=150),i!==40&&i!==65288||(s+=50),e!==41&&e!==65289||(s+=50),s}function cd(i,e,r,s,l,u){let d=null,f=ld(e,r,l,u);for(const g of s){const b=ld(e-g.x,r,l,u)+g.badness;b<=f&&(d=g,f=b)}return{index:i,x:e,priorBreak:d,badness:f}}function hd(i){return i?hd(i.priorBreak).concat(i.index):[]}function Vc(i,e,r,s,l,u,d){if(u!=="point")return[];if(!i)return[];const f=[],g=function(C,M,z,U,F,H){let Q=0;for(let Z=0;Z<C.length();Z++){const re=C.getSection(Z);Q+=od(C.getCharCode(Z),re,U,F,M,H)}return Q/Math.max(1,Math.ceil(Q/z))}(i,e,r,s,l,d),b=i.text.indexOf("\u200B")>=0;let w=0;for(let C=0;C<i.length();C++){const M=i.getSection(C),z=i.getCharCode(C);if(zl[z]||(w+=od(z,M,s,l,e,d)),C<i.length()-1){const U=!((E=z)<11904||!(Ce["Bopomofo Extended"](E)||Ce.Bopomofo(E)||Ce["CJK Compatibility Forms"](E)||Ce["CJK Compatibility Ideographs"](E)||Ce["CJK Compatibility"](E)||Ce["CJK Radicals Supplement"](E)||Ce["CJK Strokes"](E)||Ce["CJK Symbols and Punctuation"](E)||Ce["CJK Unified Ideographs Extension A"](E)||Ce["CJK Unified Ideographs"](E)||Ce["Enclosed CJK Letters and Months"](E)||Ce["Halfwidth and Fullwidth Forms"](E)||Ce.Hiragana(E)||Ce["Ideographic Description Characters"](E)||Ce["Kangxi Radicals"](E)||Ce["Katakana Phonetic Extensions"](E)||Ce.Katakana(E)||Ce["Vertical Forms"](E)||Ce["Yi Radicals"](E)||Ce["Yi Syllables"](E)));(hg[z]||U||M.imageName)&&f.push(cd(C+1,w,g,f,ug(z,i.getCharCode(C+1),U&&b),!1))}}var E;return hd(cd(i.length(),w,g,f,0,!0))}function $c(i){let e=.5,r=.5;switch(i){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=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:e,verticalAlign:r}}function dg(i,e,r,s,l){if(!s&&!l)return;const u=i[r],d=(i[r].x+u.metrics.advance*u.scale)*s;for(let f=e;f<=r;f++)i[f].x-=d,i[f].y+=l}function pg(i,e,r){const{horizontalAlign:s,verticalAlign:l}=$c(r),u=e[0]-i.displaySize[0]*s,d=e[1]-i.displaySize[1]*l;return{image:i,top:d,bottom:d+i.displaySize[1],left:u,right:u+i.displaySize[0]}}function ud(i,e,r,s,l,u){const d=i.image;let f;if(d.content){const F=d.content,H=d.pixelRatio||1;f=[F[0]/H,F[1]/H,d.displaySize[0]-F[2]/H,d.displaySize[1]-F[3]/H]}const g=e.left*u,b=e.right*u;let w,E,C,M;r==="width"||r==="both"?(M=l[0]+g-s[3],E=l[0]+b+s[1]):(M=l[0]+(g+b-d.displaySize[0])/2,E=M+d.displaySize[0]);const z=e.top*u,U=e.bottom*u;return r==="height"||r==="both"?(w=l[1]+z-s[0],C=l[1]+U+s[2]):(w=l[1]+(z+U-d.displaySize[1])/2,C=w+d.displaySize[1]),{image:d,top:w,right:E,bottom:C,left:M,collisionPadding:f}}const bo=255,Kr=128,jn=bo*Kr;function dd(i,e){const{expression:r}=e;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new Pt(i+1))};if(r.kind==="source")return{kind:"source"};{const{zoomStops:s,interpolationType:l}=r;let u=0;for(;u<s.length&&s[u]<=i;)u++;u=Math.max(0,u-1);let d=u;for(;d<s.length&&s[d]<i+1;)d++;d=Math.min(s.length-1,d);const f=s[u],g=s[d];return r.kind==="composite"?{kind:"composite",minZoom:f,maxZoom:g,interpolationType:l}:{kind:"camera",minZoom:f,maxZoom:g,minSize:r.evaluate(new Pt(f)),maxSize:r.evaluate(new Pt(g)),interpolationType:l}}}function jc(i,e,r){let s="never";const l=i.get(e);return l?s=l:i.get(r)&&(s="always"),s}const fg=Vn.VectorTileFeature.types,mg=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Dl(i,e,r,s,l,u,d,f,g,b,w,E,C){const M=f?Math.min(jn,Math.round(f[0])):0,z=f?Math.min(jn,Math.round(f[1])):0;i.emplaceBack(e,r,Math.round(32*s),Math.round(32*l),u,d,(M<<1)+(g?1:0),z,16*b,16*w,256*E,256*C)}function qc(i,e,r){i.emplaceBack(e.x,e.y,r),i.emplaceBack(e.x,e.y,r),i.emplaceBack(e.x,e.y,r),i.emplaceBack(e.x,e.y,r)}function gg(i){for(const e of i.sections)if(fl(e.text))return!0;return!1}class Gc{constructor(e){this.layoutVertexArray=new ie,this.indexArray=new ge,this.programConfigurations=e,this.segments=new Se,this.dynamicLayoutVertexArray=new ae,this.opacityVertexArray=new fe,this.hasVisibleVertices=!1,this.placedSymbolArray=new m}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(e,r,s,l){this.isEmpty()||(s&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Xm.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,Wm.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,mg,!0),this.opacityVertexBuffer.itemSize=1),(s||l)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}De("SymbolBuffers",Gc);class Zc{constructor(e,r,s){this.layoutVertexArray=new e,this.layoutAttributes=r,this.indexArray=new s,this.segments=new Se,this.collisionVertexArray=new xe}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,Hm.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}De("CollisionBuffers",Zc);class ga{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(d=>d.id),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=Tc([]),this.placementViewportMatrix=Tc([]);const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=dd(this.zoom,r["text-size"]),this.iconSizeData=dd(this.zoom,r["icon-size"]);const s=this.layers[0].layout,l=s.get("symbol-sort-key"),u=s.get("symbol-z-order");this.canOverlap=jc(s,"text-overlap","text-allow-overlap")!=="never"||jc(s,"icon-overlap","icon-allow-overlap")!=="never"||s.get("text-ignore-placement")||s.get("icon-ignore-placement"),this.sortFeaturesByKey=u!=="viewport-y"&&!l.isConstant(),this.sortFeaturesByY=(u==="viewport-y"||u==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,s.get("symbol-placement")==="point"&&(this.writingModes=s.get("text-writing-mode").map(d=>h.WritingMode[d])),this.stateDependentLayerIds=this.layers.filter(d=>d.isStateDependent()).map(d=>d.id),this.sourceID=e.sourceID}createArrays(){this.text=new Gc(new zr(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new Gc(new zr(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new v,this.lineVertexArray=new S,this.symbolInstances=new _}calculateGlyphDependencies(e,r,s,l,u){for(let d=0;d<e.length;d++)if(r[e.charCodeAt(d)]=!0,(s||l)&&u){const f=yo[e.charAt(d)];f&&(r[f.charCodeAt(0)]=!0)}}populate(e,r,s){const l=this.layers[0],u=l.layout,d=u.get("text-font"),f=u.get("text-field"),g=u.get("icon-image"),b=(f.value.kind!=="constant"||f.value.value instanceof oi&&!f.value.value.isEmpty()||f.value.value.toString().length>0)&&(d.value.kind!=="constant"||d.value.value.length>0),w=g.value.kind!=="constant"||!!g.value.value||Object.keys(g.parameters).length>0,E=u.get("symbol-sort-key");if(this.features=[],!b&&!w)return;const C=r.iconDependencies,M=r.glyphDependencies,z=r.availableImages,U=new Pt(this.zoom);for(const{feature:F,id:H,index:Q,sourceLayerIndex:Z}of e){const re=l._featureFilter.needGeometry,se=_s(F,re);if(!l._featureFilter.filter(U,se,s))continue;let ce,ze;if(re||(se.geometry=Dr(F)),b){const Pe=l.getValueAndResolveTokens("text-field",se,s,z),Ie=oi.factory(Pe);gg(Ie)&&(this.hasRTLText=!0),(!this.hasRTLText||Ja()==="unavailable"||this.hasRTLText&&Yi.isParsed())&&(ce=Ym(Ie,l,se))}if(w){const Pe=l.getValueAndResolveTokens("icon-image",se,s,z);ze=Pe instanceof Xi?Pe:Xi.fromString(Pe)}if(!ce&&!ze)continue;const Be=this.sortFeaturesByKey?E.evaluate(se,{},s):void 0;if(this.features.push({id:H,text:ce,icon:ze,index:Q,sourceLayerIndex:Z,geometry:se.geometry,properties:F.properties,type:fg[F.type],sortKey:Be}),ze&&(C[ze.name]=!0),ce){const Pe=d.evaluate(se,{},s).join(","),Ie=u.get("text-rotation-alignment")!=="viewport"&&u.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(h.WritingMode.vertical)>=0;for(const Te of ce.sections)if(Te.image)C[Te.image.name]=!0;else{const Me=Zs(ce.toString()),Ae=Te.fontStack||Pe,ye=M[Ae]=M[Ae]||{};this.calculateGlyphDependencies(Te.text,ye,Ie,this.allowVerticalPlacement,Me)}}}u.get("symbol-placement")==="line"&&(this.features=function(F){const H={},Q={},Z=[];let re=0;function se(Pe){Z.push(F[Pe]),re++}function ce(Pe,Ie,Te){const Me=Q[Pe];return delete Q[Pe],Q[Ie]=Me,Z[Me].geometry[0].pop(),Z[Me].geometry[0]=Z[Me].geometry[0].concat(Te[0]),Me}function ze(Pe,Ie,Te){const Me=H[Ie];return delete H[Ie],H[Pe]=Me,Z[Me].geometry[0].shift(),Z[Me].geometry[0]=Te[0].concat(Z[Me].geometry[0]),Me}function Be(Pe,Ie,Te){const Me=Te?Ie[0][Ie[0].length-1]:Ie[0][0];return`${Pe}:${Me.x}:${Me.y}`}for(let Pe=0;Pe<F.length;Pe++){const Ie=F[Pe],Te=Ie.geometry,Me=Ie.text?Ie.text.toString():null;if(!Me){se(Pe);continue}const Ae=Be(Me,Te),ye=Be(Me,Te,!0);if(Ae in Q&&ye in H&&Q[Ae]!==H[ye]){const $e=ze(Ae,ye,Te),Fe=ce(Ae,ye,Z[$e].geometry);delete H[Ae],delete Q[ye],Q[Be(Me,Z[Fe].geometry,!0)]=Fe,Z[$e].geometry=null}else Ae in Q?ce(Ae,ye,Te):ye in H?ze(Ae,ye,Te):(se(Pe),H[Ae]=re-1,Q[ye]=re-1)}return Z.filter(Pe=>Pe.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((F,H)=>F.sortKey-H.sortKey)}update(e,r,s){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,r,this.layers,s),this.icon.programConfigurations.updatePaintArrays(e,r,this.layers,s))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,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(e,r){const s=this.lineVertexArray.length;if(e.segment!==void 0){let l=e.dist(r[e.segment+1]),u=e.dist(r[e.segment]);const d={};for(let f=e.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=e.segment||0;f>=0;f--)d[f]={x:r[f].x,y:r[f].y,tileUnitDistanceFromAnchor:u},f>0&&(u+=r[f-1].dist(r[f]));for(let f=0;f<r.length;f++){const g=d[f];this.lineVertexArray.emplaceBack(g.x,g.y,g.tileUnitDistanceFromAnchor)}}return{lineStartIndex:s,lineLength:this.lineVertexArray.length-s}}addSymbols(e,r,s,l,u,d,f,g,b,w,E,C){const M=e.indexArray,z=e.layoutVertexArray,U=e.segments.prepareSegment(4*r.length,z,M,this.canOverlap?d.sortKey:void 0),F=this.glyphOffsetArray.length,H=U.vertexLength,Q=this.allowVerticalPlacement&&f===h.WritingMode.vertical?Math.PI/2:0,Z=d.text&&d.text.sections;for(let re=0;re<r.length;re++){const{tl:se,tr:ce,bl:ze,br:Be,tex:Pe,pixelOffsetTL:Ie,pixelOffsetBR:Te,minFontScaleX:Me,minFontScaleY:Ae,glyphOffset:ye,isSDF:$e,sectionIndex:Fe}=r[re],st=U.vertexLength,At=ye[1];Dl(z,g.x,g.y,se.x,At+se.y,Pe.x,Pe.y,s,$e,Ie.x,Ie.y,Me,Ae),Dl(z,g.x,g.y,ce.x,At+ce.y,Pe.x+Pe.w,Pe.y,s,$e,Te.x,Ie.y,Me,Ae),Dl(z,g.x,g.y,ze.x,At+ze.y,Pe.x,Pe.y+Pe.h,s,$e,Ie.x,Te.y,Me,Ae),Dl(z,g.x,g.y,Be.x,At+Be.y,Pe.x+Pe.w,Pe.y+Pe.h,s,$e,Te.x,Te.y,Me,Ae),qc(e.dynamicLayoutVertexArray,g,Q),M.emplaceBack(st,st+1,st+2),M.emplaceBack(st+1,st+2,st+3),U.vertexLength+=4,U.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(ye[0]),re!==r.length-1&&Fe===r[re+1].sectionIndex||e.programConfigurations.populatePaintArrays(z.length,d,d.index,{},C,Z&&Z[Fe])}e.placedSymbolArray.emplaceBack(g.x,g.y,F,this.glyphOffsetArray.length-F,H,b,w,g.segment,s?s[0]:0,s?s[1]:0,l[0],l[1],f,0,!1,0,E)}_addCollisionDebugVertex(e,r,s,l,u,d){return r.emplaceBack(0,0),e.emplaceBack(s.x,s.y,l,u,Math.round(d.x),Math.round(d.y))}addCollisionDebugVertices(e,r,s,l,u,d,f){const g=u.segments.prepareSegment(4,u.layoutVertexArray,u.indexArray),b=g.vertexLength,w=u.layoutVertexArray,E=u.collisionVertexArray,C=f.anchorX,M=f.anchorY;this._addCollisionDebugVertex(w,E,d,C,M,new ve(e,r)),this._addCollisionDebugVertex(w,E,d,C,M,new ve(s,r)),this._addCollisionDebugVertex(w,E,d,C,M,new ve(s,l)),this._addCollisionDebugVertex(w,E,d,C,M,new ve(e,l)),g.vertexLength+=4;const z=u.indexArray;z.emplaceBack(b,b+1),z.emplaceBack(b+1,b+2),z.emplaceBack(b+2,b+3),z.emplaceBack(b+3,b),g.primitiveLength+=4}addDebugCollisionBoxes(e,r,s,l){for(let u=e;u<r;u++){const d=this.collisionBoxArray.get(u);this.addCollisionDebugVertices(d.x1,d.y1,d.x2,d.y2,l?this.textCollisionBox:this.iconCollisionBox,d.anchorPoint,s)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Zc(_e,Ku.members,ke),this.iconCollisionBox=new Zc(_e,Ku.members,ke);for(let e=0;e<this.symbolInstances.length;e++){const r=this.symbolInstances.get(e);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(e,r,s,l,u,d,f,g,b){const w={};for(let E=r;E<s;E++){const C=e.get(E);w.textBox={x1:C.x1,y1:C.y1,x2:C.x2,y2:C.y2,anchorPointX:C.anchorPointX,anchorPointY:C.anchorPointY},w.textFeatureIndex=C.featureIndex;break}for(let E=l;E<u;E++){const C=e.get(E);w.verticalTextBox={x1:C.x1,y1:C.y1,x2:C.x2,y2:C.y2,anchorPointX:C.anchorPointX,anchorPointY:C.anchorPointY},w.verticalTextFeatureIndex=C.featureIndex;break}for(let E=d;E<f;E++){const C=e.get(E);w.iconBox={x1:C.x1,y1:C.y1,x2:C.x2,y2:C.y2,anchorPointX:C.anchorPointX,anchorPointY:C.anchorPointY},w.iconFeatureIndex=C.featureIndex;break}for(let E=g;E<b;E++){const C=e.get(E);w.verticalIconBox={x1:C.x1,y1:C.y1,x2:C.x2,y2:C.y2,anchorPointX:C.anchorPointX,anchorPointY:C.anchorPointY},w.verticalIconFeatureIndex=C.featureIndex;break}return w}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let r=0;r<this.symbolInstances.length;r++){const s=this.symbolInstances.get(r);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,s.textBoxStartIndex,s.textBoxEndIndex,s.verticalTextBoxStartIndex,s.verticalTextBoxEndIndex,s.iconBoxStartIndex,s.iconBoxEndIndex,s.verticalIconBoxStartIndex,s.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(e,r){const s=e.placedSymbolArray.get(r),l=s.vertexStartIndex+4*s.numGlyphs;for(let u=s.vertexStartIndex;u<l;u+=4)e.indexArray.emplaceBack(u,u+1,u+2),e.indexArray.emplaceBack(u+1,u+2,u+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const r=Math.sin(e),s=Math.cos(e),l=[],u=[],d=[];for(let f=0;f<this.symbolInstances.length;++f){d.push(f);const g=this.symbolInstances.get(f);l.push(0|Math.round(r*g.anchorX+s*g.anchorY)),u.push(g.featureIndex)}return d.sort((f,g)=>l[f]-l[g]||u[g]-u[f]),d}addToSortKeyRanges(e,r){const s=this.sortKeyRanges[this.sortKeyRanges.length-1];s&&s.sortKey===r?s.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:r,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const r of this.symbolInstanceIndexes){const s=this.symbolInstances.get(r);this.featureSortOrder.push(s.featureIndex),[s.rightJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.leftJustifiedTextSymbolIndex].forEach((l,u,d)=>{l>=0&&d.indexOf(l)===u&&this.addIndicesForPlacedSymbol(this.text,l)}),s.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,s.verticalPlacedTextSymbolIndex),s.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,s.placedIconSymbolIndex),s.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,s.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let pd,fd;De("SymbolBucket",ga,{omit:["layers","collisionBoxArray","features","compareText"]}),ga.MAX_GLYPHS=65535,ga.addDynamicAttributes=qc;var Xc={get paint(){return fd=fd||new Pi({"icon-opacity":new Ge(oe.paint_symbol["icon-opacity"]),"icon-color":new Ge(oe.paint_symbol["icon-color"]),"icon-halo-color":new Ge(oe.paint_symbol["icon-halo-color"]),"icon-halo-width":new Ge(oe.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Ge(oe.paint_symbol["icon-halo-blur"]),"icon-translate":new Ue(oe.paint_symbol["icon-translate"]),"icon-translate-anchor":new Ue(oe.paint_symbol["icon-translate-anchor"]),"text-opacity":new Ge(oe.paint_symbol["text-opacity"]),"text-color":new Ge(oe.paint_symbol["text-color"],{runtimeType:Ai,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new Ge(oe.paint_symbol["text-halo-color"]),"text-halo-width":new Ge(oe.paint_symbol["text-halo-width"]),"text-halo-blur":new Ge(oe.paint_symbol["text-halo-blur"]),"text-translate":new Ue(oe.paint_symbol["text-translate"]),"text-translate-anchor":new Ue(oe.paint_symbol["text-translate-anchor"])})},get layout(){return pd=pd||new Pi({"symbol-placement":new Ue(oe.layout_symbol["symbol-placement"]),"symbol-spacing":new Ue(oe.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Ue(oe.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Ge(oe.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Ue(oe.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Ue(oe.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Ue(oe.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Ue(oe.layout_symbol["icon-ignore-placement"]),"icon-optional":new Ue(oe.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Ue(oe.layout_symbol["icon-rotation-alignment"]),"icon-size":new Ge(oe.layout_symbol["icon-size"]),"icon-text-fit":new Ue(oe.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Ue(oe.layout_symbol["icon-text-fit-padding"]),"icon-image":new Ge(oe.layout_symbol["icon-image"]),"icon-rotate":new Ge(oe.layout_symbol["icon-rotate"]),"icon-padding":new Ge(oe.layout_symbol["icon-padding"]),"icon-keep-upright":new Ue(oe.layout_symbol["icon-keep-upright"]),"icon-offset":new Ge(oe.layout_symbol["icon-offset"]),"icon-anchor":new Ge(oe.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Ue(oe.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Ue(oe.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Ue(oe.layout_symbol["text-rotation-alignment"]),"text-field":new Ge(oe.layout_symbol["text-field"]),"text-font":new Ge(oe.layout_symbol["text-font"]),"text-size":new Ge(oe.layout_symbol["text-size"]),"text-max-width":new Ge(oe.layout_symbol["text-max-width"]),"text-line-height":new Ue(oe.layout_symbol["text-line-height"]),"text-letter-spacing":new Ge(oe.layout_symbol["text-letter-spacing"]),"text-justify":new Ge(oe.layout_symbol["text-justify"]),"text-radial-offset":new Ge(oe.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Ue(oe.layout_symbol["text-variable-anchor"]),"text-anchor":new Ge(oe.layout_symbol["text-anchor"]),"text-max-angle":new Ue(oe.layout_symbol["text-max-angle"]),"text-writing-mode":new Ue(oe.layout_symbol["text-writing-mode"]),"text-rotate":new Ge(oe.layout_symbol["text-rotate"]),"text-padding":new Ue(oe.layout_symbol["text-padding"]),"text-keep-upright":new Ue(oe.layout_symbol["text-keep-upright"]),"text-transform":new Ge(oe.layout_symbol["text-transform"]),"text-offset":new Ge(oe.layout_symbol["text-offset"]),"text-allow-overlap":new Ue(oe.layout_symbol["text-allow-overlap"]),"text-overlap":new Ue(oe.layout_symbol["text-overlap"]),"text-ignore-placement":new Ue(oe.layout_symbol["text-ignore-placement"]),"text-optional":new Ue(oe.layout_symbol["text-optional"])})}};class md{constructor(e){if(e.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:jr,this.defaultValue=e}evaluate(e){if(e.formattedSection){const r=this.defaultValue.property.overrides;if(r&&r.hasOverride(e.formattedSection))return r.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}De("FormatSectionOverride",md,{omit:["defaultValue"]});class Rl extends _r{constructor(e){super(e,Xc)}recalculate(e,r){if(super.recalculate(e,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"){const s=this.layout.get("text-writing-mode");if(s){const l=[];for(const u of s)l.indexOf(u)<0&&l.push(u);this.layout._values["text-writing-mode"]=l}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,r,s,l){const u=this.layout.get(e).evaluate(r,{},s,l),d=this._unevaluatedLayout._values[e];return d.isDataDriven()||Os(d.value)||!u?u:function(f,g){return g.replace(/{([^{}]+)}/g,(b,w)=>w in f?String(f[w]):"")}(r.properties,u)}createBucket(e){return new ga(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const e of Xc.paint.overridableProperties){if(!Rl.hasPaintOverride(this.layout,e))continue;const r=this.paint.get(e),s=new md(r),l=new Na(s,r.property.specification);let u=null;u=r.value.kind==="constant"||r.value.kind==="source"?new Va("source",l):new ot("composite",l,r.value.zoomStops),this.paint._values[e]=new gr(r.property,u,r.parameters)}}_handleOverridablePaintPropertyUpdate(e,r,s){return!(!this.layout||r.isDataDriven()||s.isDataDriven())&&Rl.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,r){const s=e.get("text-field"),l=Xc.paint.properties[r];let u=!1;const d=f=>{for(const g of f)if(l.overrides&&l.overrides.hasOverride(g))return void(u=!0)};if(s.value.kind==="constant"&&s.value.value instanceof oi)d(s.value.value.sections);else if(s.value.kind==="source"){const f=b=>{u||(b instanceof Gr&&Gt(b.value)===Cr?d(b.value.sections):b instanceof Bs?d(b.sections):b.eachChild(f))},g=s.value;g._styleExpression&&f(g._styleExpression.expression)}return u}}let gd;var _g={get paint(){return gd=gd||new Pi({"background-color":new Ue(oe.paint_background["background-color"]),"background-pattern":new to(oe.paint_background["background-pattern"]),"background-opacity":new Ue(oe.paint_background["background-opacity"])})}};let _d;var yg={get paint(){return _d=_d||new Pi({"raster-opacity":new Ue(oe.paint_raster["raster-opacity"]),"raster-hue-rotate":new Ue(oe.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Ue(oe.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Ue(oe.paint_raster["raster-brightness-max"]),"raster-saturation":new Ue(oe.paint_raster["raster-saturation"]),"raster-contrast":new Ue(oe.paint_raster["raster-contrast"]),"raster-resampling":new Ue(oe.paint_raster["raster-resampling"]),"raster-fade-duration":new Ue(oe.paint_raster["raster-fade-duration"])})}};class xg extends _r{constructor(e){super(e,{}),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=e}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")}}const vg={circle:class extends _r{constructor(i){super(i,om)}createBucket(i){return new vc(i)}queryRadius(i){const e=i;return lo("circle-radius",this,e)+lo("circle-stroke-width",this,e)+Tl(this.paint.get("circle-translate"))}queryIntersectsFeature(i,e,r,s,l,u,d,f){const g=Sl(i,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),u.angle,d),b=this.paint.get("circle-radius").evaluate(e,r)+this.paint.get("circle-stroke-width").evaluate(e,r),w=this.paint.get("circle-pitch-alignment")==="map",E=w?g:function(M,z){return M.map(U=>Iu(U,z))}(g,f),C=w?b*d:b;for(const M of s)for(const z of M){const U=w?z:Iu(z,f);let F=C;const H=El([],[z.x,z.y,0,1],f);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?F*=H[3]/u.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(F*=u.cameraToCenterDistance/H[3]),rm(E,U,F))return!0}return!1}},heatmap:class extends _r{createBucket(i){return new Au(i)}constructor(i){super(i,cm),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(i){i==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Mu({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}},hillshade:class extends _r{constructor(i){super(i,hm)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}},fill:class extends _r{constructor(i){super(i,Em)}recalculate(i,e){super.recalculate(i,e);const r=this.paint._values["fill-outline-color"];r.value.kind==="constant"&&r.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(i){return new zc(i)}queryRadius(){return Tl(this.paint.get("fill-translate"))}queryIntersectsFeature(i,e,r,s,l,u,d){return vu(Sl(i,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),u.angle,d),s)}isTileClipped(){return!0}},"fill-extrusion":class extends _r{constructor(i){super(i,Um)}createBucket(i){return new Rc(i)}queryRadius(){return Tl(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(i,e,r,s,l,u,d,f){const g=Sl(i,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),u.angle,d),b=this.paint.get("fill-extrusion-height").evaluate(e,r),w=this.paint.get("fill-extrusion-base").evaluate(e,r),E=function(M,z,U,F){const H=[];for(const Q of M){const Z=[Q.x,Q.y,0,1];El(Z,Z,z),H.push(new ve(Z[0]/Z[3],Z[1]/Z[3]))}return H}(g,f),C=function(M,z,U,F){const H=[],Q=[],Z=F[8]*z,re=F[9]*z,se=F[10]*z,ce=F[11]*z,ze=F[8]*U,Be=F[9]*U,Pe=F[10]*U,Ie=F[11]*U;for(const Te of M){const Me=[],Ae=[];for(const ye of Te){const $e=ye.x,Fe=ye.y,st=F[0]*$e+F[4]*Fe+F[12],At=F[1]*$e+F[5]*Fe+F[13],Mt=F[2]*$e+F[6]*Fe+F[14],Qt=F[3]*$e+F[7]*Fe+F[15],ar=Mt+se,di=Qt+ce,Wt=st+ze,ni=At+Be,pi=Mt+Pe,Ti=Qt+Ie,Oi=new ve((st+Z)/di,(At+re)/di);Oi.z=ar/di,Me.push(Oi);const Ht=new ve(Wt/Ti,ni/Ti);Ht.z=pi/Ti,Ae.push(Ht)}H.push(Me),Q.push(Ae)}return[H,Q]}(s,w,b,f);return function(M,z,U){let F=1/0;vu(U,z)&&(F=qu(U,z[0]));for(let H=0;H<z.length;H++){const Q=z[H],Z=M[H];for(let re=0;re<Q.length-1;re++){const se=Q[re],ce=[se,Q[re+1],Z[re+1],Z[re],se];xu(U,ce)&&(F=Math.min(F,qu(U,ce)))}}return F!==1/0&&F}(C[0],C[1],E)}},line:class extends _r{constructor(i){super(i,Wu),this.gradientVersion=0,Ml||(Ml=new Zm(Wu.paint.properties["line-width"].specification),Ml.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(i){i==="line-gradient"&&(this.stepInterpolant=this._transitionablePaint._values["line-gradient"].value.expression._styleExpression.expression instanceof Mn,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER)}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(i,e){super.recalculate(i,e),this.paint._values["line-floorwidth"]=Ml.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,i)}createBucket(i){return new Bc(i)}queryRadius(i){const e=i,r=Hu(lo("line-width",this,e),lo("line-gap-width",this,e)),s=lo("line-offset",this,e);return r/2+Math.abs(s)+Tl(this.paint.get("line-translate"))}queryIntersectsFeature(i,e,r,s,l,u,d){const f=Sl(i,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),u.angle,d),g=d/2*Hu(this.paint.get("line-width").evaluate(e,r),this.paint.get("line-gap-width").evaluate(e,r)),b=this.paint.get("line-offset").evaluate(e,r);return b&&(s=function(w,E){const C=[];for(let M=0;M<w.length;M++){const z=w[M],U=[];for(let F=0;F<z.length;F++){const H=z[F-1],Q=z[F],Z=z[F+1],re=F===0?new ve(0,0):Q.sub(H)._unit()._perp(),se=F===z.length-1?new ve(0,0):Z.sub(Q)._unit()._perp(),ce=re._add(se)._unit(),ze=ce.x*se.x+ce.y*se.y;ze!==0&&ce._mult(1/ze),U.push(ce._mult(E)._add(Q))}C.push(U)}return C}(s,b*d)),function(w,E,C){for(let M=0;M<E.length;M++){const z=E[M];if(w.length>=3){for(let U=0;U<z.length;U++)if(ca(w,z[U]))return!0}if(nm(w,z,C))return!0}return!1}(f,s,g)}isTileClipped(){return!0}},symbol:Rl,background:class extends _r{constructor(i){super(i,_g)}},raster:class extends _r{constructor(i){super(i,yg)}}};class bg{constructor(e){this._callback=e,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){delete this._channel,this._callback=()=>{}}}const Wc=63710088e-1;class qn{constructor(e,r){if(isNaN(e)||isNaN(r))throw new Error(`Invalid LngLat object: (${e}, ${r})`);if(this.lng=+e,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 qn(hr(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const r=Math.PI/180,s=this.lat*r,l=e.lat*r,u=Math.sin(s)*Math.sin(l)+Math.cos(s)*Math.cos(l)*Math.cos((e.lng-this.lng)*r);return Wc*Math.acos(Math.min(u,1))}static convert(e){if(e instanceof qn)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new qn(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new qn(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}const yd=2*Math.PI*Wc;function xd(i){return yd*Math.cos(i*Math.PI/180)}function vd(i){return(180+i)/360}function bd(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function wd(i,e){return i/xd(e)}function Hc(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}class Bl{constructor(e,r,s=0){this.x=+e,this.y=+r,this.z=+s}static fromLngLat(e,r=0){const s=qn.convert(e);return new Bl(vd(s.lng),bd(s.lat),wd(r,s.lat))}toLngLat(){return new qn(360*this.x-180,Hc(this.y))}toAltitude(){return this.z*xd(Hc(this.y))}meterInMercatorCoordinateUnits(){return 1/yd*(e=Hc(this.y),1/Math.cos(e*Math.PI/180));var e}}function Td(i,e,r){var s=2*Math.PI*6378137/256/Math.pow(2,r);return[i*s-2*Math.PI*6378137/2,e*s-2*Math.PI*6378137/2]}class Kc{constructor(e,r,s){if(e<0||e>25||s<0||s>=Math.pow(2,e)||r<0||r>=Math.pow(2,e))throw new Error(`x=${r}, y=${s}, z=${e} outside of bounds. 0<=x<${Math.pow(2,e)}, 0<=y<${Math.pow(2,e)} 0<=z<=25 `);this.z=e,this.x=r,this.y=s,this.key=wo(0,e,e,r,s)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,r,s){const l=(d=this.y,f=this.z,g=Td(256*(u=this.x),256*(d=Math.pow(2,f)-d-1),f),b=Td(256*(u+1),256*(d+1),f),g[0]+","+g[1]+","+b[0]+","+b[1]);var u,d,f,g,b;const w=function(E,C,M){let z,U="";for(let F=E;F>0;F--)z=1<<F-1,U+=(C&z?1:0)+(M&z?2:0);return U}(this.z,this.x,this.y);return e[(this.x+this.y)%e.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(s==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,r>1?"@2x":"").replace(/{quadkey}/g,w).replace(/{bbox-epsg-3857}/g,l)}isChildOf(e){const r=this.z-e.z;return r>0&&e.x===this.x>>r&&e.y===this.y>>r}getTilePoint(e){const r=Math.pow(2,this.z);return new ve((e.x*r-this.x)*It,(e.y*r-this.y)*It)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Sd{constructor(e,r){this.wrap=e,this.canonical=r,this.key=wo(e,r.z,r.z,r.x,r.y)}}class sr{constructor(e,r,s,l,u){if(e<s)throw new Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${s}`);this.overscaledZ=e,this.wrap=r,this.canonical=new Kc(s,+l,+u),this.key=wo(r,e,s,l,u)}clone(){return new sr(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const r=this.canonical.z-e;return e>this.canonical.z?new sr(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new sr(e,this.wrap,e,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(e,r){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const s=this.canonical.z-e;return e>this.canonical.z?wo(this.wrap*+r,e,this.canonical.z,this.canonical.x,this.canonical.y):wo(this.wrap*+r,e,e,this.canonical.x>>s,this.canonical.y>>s)}isChildOf(e){if(e.wrap!==this.wrap)return!1;const r=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ<this.overscaledZ&&e.canonical.x===this.canonical.x>>r&&e.canonical.y===this.canonical.y>>r}children(e){if(this.overscaledZ>=e)return[new sr(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const r=this.canonical.z+1,s=2*this.canonical.x,l=2*this.canonical.y;return[new sr(r,this.wrap,r,s,l),new sr(r,this.wrap,r,s+1,l),new sr(r,this.wrap,r,s,l+1),new sr(r,this.wrap,r,s+1,l+1)]}isLessThan(e){return this.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}wrapped(){return new sr(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new sr(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Sd(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new Bl(e.x-this.wrap,e.y))}}function wo(i,e,r,s,l){(i*=2)<0&&(i=-1*i-1);const u=1<<r;return(u*u*i+u*l+s).toString(36)+r.toString(36)+e.toString(36)}De("CanonicalTileID",Kc),De("OverscaledTileID",sr,{omit:["posMatrix"]});class Ed{constructor(e,r,s){if(this.uid=e,r.height!==r.width)throw new RangeError("DEM tiles must be square");if(s&&s!=="mapbox"&&s!=="terrarium")return void ci(`"${s}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=r.height;const l=this.dim=r.height-2;this.data=new Uint32Array(r.data.buffer),this.encoding=s||"mapbox";for(let u=0;u<l;u++)this.data[this._idx(-1,u)]=this.data[this._idx(0,u)],this.data[this._idx(l,u)]=this.data[this._idx(l-1,u)],this.data[this._idx(u,-1)]=this.data[this._idx(u,0)],this.data[this._idx(u,l)]=this.data[this._idx(u,l-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(l,-1)]=this.data[this._idx(l-1,0)],this.data[this._idx(-1,l)]=this.data[this._idx(0,l-1)],this.data[this._idx(l,l)]=this.data[this._idx(l-1,l-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let u=0;u<l;u++)for(let d=0;d<l;d++){const f=this.get(u,d);f>this.max&&(this.max=f),f<this.min&&(this.min=f)}}get(e,r){const s=new Uint8Array(this.data.buffer),l=4*this._idx(e,r);return(this.encoding==="terrarium"?this._unpackTerrarium:this._unpackMapbox)(s[l],s[l+1],s[l+2])}getUnpackVector(){return this.encoding==="terrarium"?[256,1,1/256,32768]:[6553.6,25.6,.1,1e4]}_idx(e,r){if(e<-1||e>=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+(e+1)}_unpackMapbox(e,r,s){return(256*e*256+256*r+s)/10-1e4}_unpackTerrarium(e,r,s){return 256*e+r+s/256-32768}getPixels(){return new nr({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,r,s){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let l=r*this.dim,u=r*this.dim+this.dim,d=s*this.dim,f=s*this.dim+this.dim;switch(r){case-1:l=u-1;break;case 1:u=l+1}switch(s){case-1:d=f-1;break;case 1:f=d+1}const g=-r*this.dim,b=-s*this.dim;for(let w=d;w<f;w++)for(let E=l;E<u;E++)this.data[this._idx(E,w)]=e.data[this._idx(E+g,w+b)]}}De("DEMData",Ed);class Id{constructor(e){this._stringToNumber={},this._numberToString=[];for(let r=0;r<e.length;r++){const s=e[r];this._stringToNumber[s]=r,this._numberToString[r]=s}}encode(e){return this._stringToNumber[e]}decode(e){if(e>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${e} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}}class Ad{constructor(e,r,s,l,u){this.type="Feature",this._vectorTileFeature=e,e._z=r,e._x=s,e._y=l,this.properties=e.properties,this.id=u}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(e){this._geometry=e}toJSON(){const e={geometry:this.geometry};for(const r in this)r!=="_geometry"&&r!=="_vectorTileFeature"&&(e[r]=this[r]);return e}}class Cd{constructor(e,r){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new cs(It,16,0),this.grid3D=new cs(It,16,0),this.featureIndexArray=new L,this.promoteId=r}insert(e,r,s,l,u,d){const f=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(s,l,u);const g=d?this.grid3D:this.grid;for(let b=0;b<r.length;b++){const w=r[b],E=[1/0,1/0,-1/0,-1/0];for(let C=0;C<w.length;C++){const M=w[C];E[0]=Math.min(E[0],M.x),E[1]=Math.min(E[1],M.y),E[2]=Math.max(E[2],M.x),E[3]=Math.max(E[3],M.y)}E[0]<It&&E[1]<It&&E[2]>=0&&E[3]>=0&&g.insert(f,E[0],E[1],E[2],E[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Vn.VectorTile(new Oc(this.rawTileData)).layers,this.sourceLayerCoder=new Id(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,r,s,l){this.loadVTLayers();const u=e.params||{},d=It/e.tileSize/e.scale,f=$a(u.filter),g=e.queryGeometry,b=e.queryPadding*d,w=Md(g),E=this.grid.query(w.minX-b,w.minY-b,w.maxX+b,w.maxY+b),C=Md(e.cameraQueryGeometry),M=this.grid3D.query(C.minX-b,C.minY-b,C.maxX+b,C.maxY+b,(F,H,Q,Z)=>function(re,se,ce,ze,Be){for(const Ie of re)if(se<=Ie.x&&ce<=Ie.y&&ze>=Ie.x&&Be>=Ie.y)return!0;const Pe=[new ve(se,ce),new ve(se,Be),new ve(ze,Be),new ve(ze,ce)];if(re.length>2){for(const Ie of Pe)if(ca(re,Ie))return!0}for(let Ie=0;Ie<re.length-1;Ie++)if(am(re[Ie],re[Ie+1],Pe))return!0;return!1}(e.cameraQueryGeometry,F-b,H-b,Q+b,Z+b));for(const F of M)E.push(F);E.sort(wg);const z={};let U;for(let F=0;F<E.length;F++){const H=E[F];if(H===U)continue;U=H;const Q=this.featureIndexArray.get(H);let Z=null;this.loadMatchingFeature(z,Q.bucketIndex,Q.sourceLayerIndex,Q.featureIndex,f,u.layers,u.availableImages,r,s,l,(re,se,ce)=>(Z||(Z=Dr(re)),se.queryIntersectsFeature(g,re,ce,Z,this.z,e.transform,d,e.pixelPosMatrix)))}return z}loadMatchingFeature(e,r,s,l,u,d,f,g,b,w,E){const C=this.bucketLayerIDs[r];if(d&&!function(F,H){for(let Q=0;Q<F.length;Q++)if(H.indexOf(F[Q])>=0)return!0;return!1}(d,C))return;const M=this.sourceLayerCoder.decode(s),z=this.vtLayers[M].feature(l);if(u.needGeometry){const F=_s(z,!0);if(!u.filter(new Pt(this.tileID.overscaledZ),F,this.tileID.canonical))return}else if(!u.filter(new Pt(this.tileID.overscaledZ),z))return;const U=this.getId(z,M);for(let F=0;F<C.length;F++){const H=C[F];if(d&&d.indexOf(H)<0)continue;const Q=g[H];if(!Q)continue;let Z={};U&&w&&(Z=w.getState(Q.sourceLayer||"_geojsonTileLayer",U));const re=xi({},b[H]);re.paint=Pd(re.paint,Q.paint,z,Z,f),re.layout=Pd(re.layout,Q.layout,z,Z,f);const se=!E||E(z,Q,Z);if(!se)continue;const ce=new Ad(z,this.z,this.x,this.y,U);ce.layer=re;let ze=e[H];ze===void 0&&(ze=e[H]=[]),ze.push({featureIndex:l,feature:ce,intersectionZ:se})}}lookupSymbolFeatures(e,r,s,l,u,d,f,g){const b={};this.loadVTLayers();const w=$a(u);for(const E of e)this.loadMatchingFeature(b,s,l,E,w,d,f,g,r);return b}hasLayer(e){for(const r of this.bucketLayerIDs)for(const s of r)if(e===s)return!0;return!1}getId(e,r){let s=e.id;return this.promoteId&&(s=e.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[r]],typeof s=="boolean"&&(s=Number(s))),s}}function Pd(i,e,r,s,l){return Or(i,(u,d)=>{const f=e instanceof Qs?e.get(d):null;return f&&f.evaluate?f.evaluate(r,s,l):f})}function Md(i){let e=1/0,r=1/0,s=-1/0,l=-1/0;for(const u of i)e=Math.min(e,u.x),r=Math.min(r,u.y),s=Math.max(s,u.x),l=Math.max(l,u.y);return{minX:e,minY:r,maxX:s,maxY:l}}function wg(i,e){return e-i}function kd(i,e,r,s,l){const u=[];for(let d=0;d<i.length;d++){const f=i[d];let g;for(let b=0;b<f.length-1;b++){let w=f[b],E=f[b+1];w.x<e&&E.x<e||(w.x<e?w=new ve(e,w.y+(e-w.x)/(E.x-w.x)*(E.y-w.y))._round():E.x<e&&(E=new ve(e,w.y+(e-w.x)/(E.x-w.x)*(E.y-w.y))._round()),w.y<r&&E.y<r||(w.y<r?w=new ve(w.x+(r-w.y)/(E.y-w.y)*(E.x-w.x),r)._round():E.y<r&&(E=new ve(w.x+(r-w.y)/(E.y-w.y)*(E.x-w.x),r)._round()),w.x>=s&&E.x>=s||(w.x>=s?w=new ve(s,w.y+(s-w.x)/(E.x-w.x)*(E.y-w.y))._round():E.x>=s&&(E=new ve(s,w.y+(s-w.x)/(E.x-w.x)*(E.y-w.y))._round()),w.y>=l&&E.y>=l||(w.y>=l?w=new ve(w.x+(l-w.y)/(E.y-w.y)*(E.x-w.x),l)._round():E.y>=l&&(E=new ve(w.x+(l-w.y)/(E.y-w.y)*(E.x-w.x),l)._round()),g&&w.equals(g[g.length-1])||(g=[w],u.push(g)),g.push(E)))))}}return u}De("FeatureIndex",Cd,{omit:["rawTileData","sourceLayerCoder"]});class Gn extends ve{constructor(e,r,s,l){super(e,r),this.angle=s,l!==void 0&&(this.segment=l)}clone(){return new Gn(this.x,this.y,this.angle,this.segment)}}function Ld(i,e,r,s,l){if(e.segment===void 0)return!0;let u=e,d=e.segment+1,f=0;for(;f>-r/2;){if(d--,d<0)return!1;f-=i[d].dist(u),u=i[d]}f+=i[d].dist(i[d+1]),d++;const g=[];let b=0;for(;f<r/2;){const w=i[d],E=i[d+1];if(!E)return!1;let C=i[d-1].angleTo(w)-w.angleTo(E);for(C=Math.abs((C+3*Math.PI)%(2*Math.PI)-Math.PI),g.push({distance:f,angleDelta:C}),b+=C;f-g[0].distance>s;)b-=g.shift().angleDelta;if(b>l)return!1;d++,f+=w.dist(E)}return!0}function zd(i){let e=0;for(let r=0;r<i.length-1;r++)e+=i[r].dist(i[r+1]);return e}function Dd(i,e,r){return i?.6*e*r:0}function Rd(i,e){return Math.max(i?i.right-i.left:0,e?e.right-e.left:0)}function Tg(i,e,r,s,l,u){const d=Dd(r,l,u),f=Rd(r,s)*u;let g=0;const b=zd(i)/2;for(let w=0;w<i.length-1;w++){const E=i[w],C=i[w+1],M=E.dist(C);if(g+M>b){const z=(b-g)/M,U=zi.number(E.x,C.x,z),F=zi.number(E.y,C.y,z),H=new Gn(U,F,C.angleTo(E),w);return H._round(),!d||Ld(i,H,f,d,e)?H:void 0}g+=M}}function Sg(i,e,r,s,l,u,d,f,g){const b=Dd(s,u,d),w=Rd(s,l),E=w*d,C=i[0].x===0||i[0].x===g||i[0].y===0||i[0].y===g;return e-E<e/4&&(e=E+e/4),Bd(i,C?e/2*f%e:(w/2+2*u)*d*f%e,e,b,r,E,C,!1,g)}function Bd(i,e,r,s,l,u,d,f,g){const b=u/2,w=zd(i);let E=0,C=e-r,M=[];for(let z=0;z<i.length-1;z++){const U=i[z],F=i[z+1],H=U.dist(F),Q=F.angleTo(U);for(;C+r<E+H;){C+=r;const Z=(C-E)/H,re=zi.number(U.x,F.x,Z),se=zi.number(U.y,F.y,Z);if(re>=0&&re<g&&se>=0&&se<g&&C-b>=0&&C+b<=w){const ce=new Gn(re,se,Q,z);ce._round(),s&&!Ld(i,ce,u,s,l)||M.push(ce)}}E+=H}return f||M.length||d||(M=Bd(i,E/2,r,s,l,u,d,!0,g)),M}De("Anchor",Gn);const _a=Fi;function Fd(i,e,r,s){const l=[],u=i.image,d=u.pixelRatio,f=u.paddedRect.w-2*_a,g=u.paddedRect.h-2*_a,b=i.right-i.left,w=i.bottom-i.top,E=u.stretchX||[[0,f]],C=u.stretchY||[[0,g]],M=(Te,Me)=>Te+Me[1]-Me[0],z=E.reduce(M,0),U=C.reduce(M,0),F=f-z,H=g-U;let Q=0,Z=z,re=0,se=U,ce=0,ze=F,Be=0,Pe=H;if(u.content&&s){const Te=u.content;Q=Fl(E,0,Te[0]),re=Fl(C,0,Te[1]),Z=Fl(E,Te[0],Te[2]),se=Fl(C,Te[1],Te[3]),ce=Te[0]-Q,Be=Te[1]-re,ze=Te[2]-Te[0]-Z,Pe=Te[3]-Te[1]-se}const Ie=(Te,Me,Ae,ye)=>{const $e=Ol(Te.stretch-Q,Z,b,i.left),Fe=Ul(Te.fixed-ce,ze,Te.stretch,z),st=Ol(Me.stretch-re,se,w,i.top),At=Ul(Me.fixed-Be,Pe,Me.stretch,U),Mt=Ol(Ae.stretch-Q,Z,b,i.left),Qt=Ul(Ae.fixed-ce,ze,Ae.stretch,z),ar=Ol(ye.stretch-re,se,w,i.top),di=Ul(ye.fixed-Be,Pe,ye.stretch,U),Wt=new ve($e,st),ni=new ve(Mt,st),pi=new ve(Mt,ar),Ti=new ve($e,ar),Oi=new ve(Fe/d,At/d),Ht=new ve(Qt/d,di/d),fi=e*Math.PI/180;if(fi){const Ui=Math.sin(fi),Ni=Math.cos(fi),Ft=[Ni,-Ui,Ui,Ni];Wt._matMult(Ft),ni._matMult(Ft),Ti._matMult(Ft),pi._matMult(Ft)}const Si=Te.stretch+Te.fixed,ki=Me.stretch+Me.fixed;return{tl:Wt,tr:ni,bl:Ti,br:pi,tex:{x:u.paddedRect.x+_a+Si,y:u.paddedRect.y+_a+ki,w:Ae.stretch+Ae.fixed-Si,h:ye.stretch+ye.fixed-ki},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Oi,pixelOffsetBR:Ht,minFontScaleX:ze/d/b,minFontScaleY:Pe/d/w,isSDF:r}};if(s&&(u.stretchX||u.stretchY)){const Te=Od(E,F,z),Me=Od(C,H,U);for(let Ae=0;Ae<Te.length-1;Ae++){const ye=Te[Ae],$e=Te[Ae+1];for(let Fe=0;Fe<Me.length-1;Fe++)l.push(Ie(ye,Me[Fe],$e,Me[Fe+1]))}}else l.push(Ie({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:f+1},{fixed:0,stretch:g+1}));return l}function Fl(i,e,r){let s=0;for(const l of i)s+=Math.max(e,Math.min(r,l[1]))-Math.max(e,Math.min(r,l[0]));return s}function Od(i,e,r){const s=[{fixed:-_a,stretch:0}];for(const[l,u]of i){const d=s[s.length-1];s.push({fixed:l-d.stretch,stretch:d.stretch}),s.push({fixed:l-d.stretch,stretch:d.stretch+(u-l)})}return s.push({fixed:e+_a,stretch:r}),s}function Ol(i,e,r,s){return i/e*r+s}function Ul(i,e,r,s){return i-e*r/s}class Nl{constructor(e,r,s,l,u,d,f,g,b,w){if(this.boxStartIndex=e.length,b){let E=d.top,C=d.bottom;const M=d.collisionPadding;M&&(E-=M[1],C+=M[3]);let z=C-E;z>0&&(z=Math.max(10,z),this.circleDiameter=z)}else{let E=d.top*f-g[0],C=d.bottom*f+g[2],M=d.left*f-g[3],z=d.right*f+g[1];const U=d.collisionPadding;if(U&&(M-=U[0]*f,E-=U[1]*f,z+=U[2]*f,C+=U[3]*f),w){const F=new ve(M,E),H=new ve(z,E),Q=new ve(M,C),Z=new ve(z,C),re=w*Math.PI/180;F._rotate(re),H._rotate(re),Q._rotate(re),Z._rotate(re),M=Math.min(F.x,H.x,Q.x,Z.x),z=Math.max(F.x,H.x,Q.x,Z.x),E=Math.min(F.y,H.y,Q.y,Z.y),C=Math.max(F.y,H.y,Q.y,Z.y)}e.emplaceBack(r.x,r.y,M,E,z,C,s,l,u)}this.boxEndIndex=e.length}}class Eg{constructor(e=[],r=Ig){if(this.data=e,this.length=this.data.length,this.compare=r,this.length>0)for(let s=(this.length>>1)-1;s>=0;s--)this._down(s)}push(e){this.data.push(e),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const e=this.data[0],r=this.data.pop();return this.length--,this.length>0&&(this.data[0]=r,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:r,compare:s}=this,l=r[e];for(;e>0;){const u=e-1>>1,d=r[u];if(s(l,d)>=0)break;r[e]=d,e=u}r[e]=l}_down(e){const{data:r,compare:s}=this,l=this.length>>1,u=r[e];for(;e<l;){let d=1+(e<<1),f=r[d];const g=d+1;if(g<this.length&&s(r[g],f)<0&&(d=g,f=r[g]),s(f,u)>=0)break;r[e]=f,e=d}r[e]=u}}function Ig(i,e){return i<e?-1:i>e?1:0}function Ag(i,e=1,r=!1){let s=1/0,l=1/0,u=-1/0,d=-1/0;const f=i[0];for(let M=0;M<f.length;M++){const z=f[M];(!M||z.x<s)&&(s=z.x),(!M||z.y<l)&&(l=z.y),(!M||z.x>u)&&(u=z.x),(!M||z.y>d)&&(d=z.y)}const g=Math.min(u-s,d-l);let b=g/2;const w=new Eg([],Cg);if(g===0)return new ve(s,l);for(let M=s;M<u;M+=g)for(let z=l;z<d;z+=g)w.push(new ya(M+b,z+b,b,i));let E=function(M){let z=0,U=0,F=0;const H=M[0];for(let Q=0,Z=H.length,re=Z-1;Q<Z;re=Q++){const se=H[Q],ce=H[re],ze=se.x*ce.y-ce.x*se.y;U+=(se.x+ce.x)*ze,F+=(se.y+ce.y)*ze,z+=3*ze}return new ya(U/z,F/z,0,M)}(i),C=w.length;for(;w.length;){const M=w.pop();(M.d>E.d||!E.d)&&(E=M,r&&console.log("found best %d after %d probes",Math.round(1e4*M.d)/1e4,C)),M.max-E.d<=e||(b=M.h/2,w.push(new ya(M.p.x-b,M.p.y-b,b,i)),w.push(new ya(M.p.x+b,M.p.y-b,b,i)),w.push(new ya(M.p.x-b,M.p.y+b,b,i)),w.push(new ya(M.p.x+b,M.p.y+b,b,i)),C+=4)}return r&&(console.log(`num probes: ${C}`),console.log(`best distance: ${E.d}`)),E.p}function Cg(i,e){return e.max-i.max}function ya(i,e,r,s){this.p=new ve(i,e),this.h=r,this.d=function(l,u){let d=!1,f=1/0;for(let g=0;g<u.length;g++){const b=u[g];for(let w=0,E=b.length,C=E-1;w<E;C=w++){const M=b[w],z=b[C];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,bu(l,M,z))}}return(d?1:-1)*Math.sqrt(f)}(this.p,s),this.max=this.d+this.h*Math.SQRT2}const Yc=Number.POSITIVE_INFINITY;function Ud(i,e){return e[1]!==Yc?function(r,s,l){let u=0,d=0;switch(s=Math.abs(s),l=Math.abs(l),r){case"top-right":case"top-left":case"top":d=l-7;break;case"bottom-right":case"bottom-left":case"bottom":d=7-l}switch(r){case"top-right":case"bottom-right":case"right":u=-s;break;case"top-left":case"bottom-left":case"left":u=s}return[u,d]}(i,e[0],e[1]):function(r,s){let l=0,u=0;s<0&&(s=0);const d=s/Math.sqrt(2);switch(r){case"top-right":case"top-left":u=d-7;break;case"bottom-right":case"bottom-left":u=7-d;break;case"bottom":u=7-s;break;case"top":u=s-7}switch(r){case"top-right":case"bottom-right":l=-d;break;case"top-left":case"bottom-left":l=d;break;case"left":l=s;break;case"right":l=-s}return[l,u]}(i,e[0])}function Jc(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 Pg(i,e,r,s,l,u,d,f,g,b,w){let E=u.textMaxSize.evaluate(e,{});E===void 0&&(E=d);const C=i.layers[0].layout,M=C.get("icon-offset").evaluate(e,{},w),z=Vd(r.horizontal),U=d/24,F=i.tilePixelRatio*U,H=i.tilePixelRatio*E/24,Q=i.tilePixelRatio*f,Z=i.tilePixelRatio*C.get("symbol-spacing"),re=C.get("text-padding")*i.tilePixelRatio,se=function(ye,$e,Fe,st=1){const At=ye.get("icon-padding").evaluate($e,{},Fe),Mt=At&&At.values;return[Mt[0]*st,Mt[1]*st,Mt[2]*st,Mt[3]*st]}(C,e,w,i.tilePixelRatio),ce=C.get("text-max-angle")/180*Math.PI,ze=C.get("text-rotation-alignment")!=="viewport"&&C.get("symbol-placement")!=="point",Be=C.get("icon-rotation-alignment")==="map"&&C.get("symbol-placement")!=="point",Pe=C.get("symbol-placement"),Ie=Z/2,Te=C.get("icon-text-fit");let Me;s&&Te!=="none"&&(i.allowVerticalPlacement&&r.vertical&&(Me=ud(s,r.vertical,Te,C.get("icon-text-fit-padding"),M,U)),z&&(s=ud(s,z,Te,C.get("icon-text-fit-padding"),M,U)));const Ae=(ye,$e)=>{$e.x<0||$e.x>=It||$e.y<0||$e.y>=It||function(Fe,st,At,Mt,Qt,ar,di,Wt,ni,pi,Ti,Oi,Ht,fi,Si,ki,Ui,Ni,Ft,mi,at,Ji,gi,Ei,vr){const Rr=Fe.addToLineVertexArray(st,At);let Br,mn,br,or,Vi=0,gn=0,Eo=0,Gd=0,ah=-1,oh=-1;const _n={};let Zd=Vt(""),lh=0,ch=0;if(Wt._unevaluatedLayout.getValue("text-radial-offset")===void 0?[lh,ch]=Wt.layout.get("text-offset").evaluate(at,{},Ei).map($i=>$i*ri):(lh=Wt.layout.get("text-radial-offset").evaluate(at,{},Ei)*ri,ch=Yc),Fe.allowVerticalPlacement&&Mt.vertical){const $i=Wt.layout.get("text-rotate").evaluate(at,{},Ei)+90;br=new Nl(ni,st,pi,Ti,Oi,Mt.vertical,Ht,fi,Si,$i),di&&(or=new Nl(ni,st,pi,Ti,Oi,di,Ui,Ni,Si,$i))}if(Qt){const $i=Wt.layout.get("icon-rotate").evaluate(at,{}),Yr=Wt.layout.get("icon-text-fit")!=="none",Io=Fd(Qt,$i,gi,Yr),Ao=di?Fd(di,$i,gi,Yr):void 0;mn=new Nl(ni,st,pi,Ti,Oi,Qt,Ui,Ni,!1,$i),Vi=4*Io.length;const Hd=Fe.iconSizeData;let xs=null;Hd.kind==="source"?(xs=[Kr*Wt.layout.get("icon-size").evaluate(at,{})],xs[0]>jn&&ci(`${Fe.layerIds[0]}: Value for "icon-size" is >= ${bo}. Reduce your "icon-size".`)):Hd.kind==="composite"&&(xs=[Kr*Ji.compositeIconSizes[0].evaluate(at,{},Ei),Kr*Ji.compositeIconSizes[1].evaluate(at,{},Ei)],(xs[0]>jn||xs[1]>jn)&&ci(`${Fe.layerIds[0]}: Value for "icon-size" is >= ${bo}. Reduce your "icon-size".`)),Fe.addSymbols(Fe.icon,Io,xs,mi,Ft,at,h.WritingMode.none,st,Rr.lineStartIndex,Rr.lineLength,-1,Ei),ah=Fe.icon.placedSymbolArray.length-1,Ao&&(gn=4*Ao.length,Fe.addSymbols(Fe.icon,Ao,xs,mi,Ft,at,h.WritingMode.vertical,st,Rr.lineStartIndex,Rr.lineLength,-1,Ei),oh=Fe.icon.placedSymbolArray.length-1)}const Xd=Object.keys(Mt.horizontal);for(const $i of Xd){const Yr=Mt.horizontal[$i];if(!Br){Zd=Vt(Yr.text);const Ao=Wt.layout.get("text-rotate").evaluate(at,{},Ei);Br=new Nl(ni,st,pi,Ti,Oi,Yr,Ht,fi,Si,Ao)}const Io=Yr.positionedLines.length===1;if(Eo+=Nd(Fe,st,Yr,ar,Wt,Si,at,ki,Rr,Mt.vertical?h.WritingMode.horizontal:h.WritingMode.horizontalOnly,Io?Xd:[$i],_n,ah,Ji,Ei),Io)break}Mt.vertical&&(Gd+=Nd(Fe,st,Mt.vertical,ar,Wt,Si,at,ki,Rr,h.WritingMode.vertical,["vertical"],_n,oh,Ji,Ei));const Lg=Br?Br.boxStartIndex:Fe.collisionBoxArray.length,zg=Br?Br.boxEndIndex:Fe.collisionBoxArray.length,Dg=br?br.boxStartIndex:Fe.collisionBoxArray.length,Rg=br?br.boxEndIndex:Fe.collisionBoxArray.length,Bg=mn?mn.boxStartIndex:Fe.collisionBoxArray.length,Fg=mn?mn.boxEndIndex:Fe.collisionBoxArray.length,Og=or?or.boxStartIndex:Fe.collisionBoxArray.length,Ug=or?or.boxEndIndex:Fe.collisionBoxArray.length;let Fr=-1;const $l=($i,Yr)=>$i&&$i.circleDiameter?Math.max($i.circleDiameter,Yr):Yr;Fr=$l(Br,Fr),Fr=$l(br,Fr),Fr=$l(mn,Fr),Fr=$l(or,Fr);const Wd=Fr>-1?1:0;Wd&&(Fr*=vr/ri),Fe.glyphOffsetArray.length>=ga.MAX_GLYPHS&&ci("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),at.sortKey!==void 0&&Fe.addToSortKeyRanges(Fe.symbolInstances.length,at.sortKey),Fe.symbolInstances.emplaceBack(st.x,st.y,_n.right>=0?_n.right:-1,_n.center>=0?_n.center:-1,_n.left>=0?_n.left:-1,_n.vertical||-1,ah,oh,Zd,Lg,zg,Dg,Rg,Bg,Fg,Og,Ug,pi,Eo,Gd,Vi,gn,Wd,0,Ht,lh,ch,Fr)}(i,$e,ye,r,s,l,Me,i.layers[0],i.collisionBoxArray,e.index,e.sourceLayerIndex,i.index,F,[re,re,re,re],ze,g,Q,se,Be,M,e,u,b,w,d)};if(Pe==="line")for(const ye of kd(e.geometry,0,0,It,It)){const $e=Sg(ye,Z,ce,r.vertical||z,s,24,H,i.overscaling,It);for(const Fe of $e)z&&Mg(i,z.text,Ie,Fe)||Ae(ye,Fe)}else if(Pe==="line-center"){for(const ye of e.geometry)if(ye.length>1){const $e=Tg(ye,ce,r.vertical||z,s,24,H);$e&&Ae(ye,$e)}}else if(e.type==="Polygon")for(const ye of Mc(e.geometry,0)){const $e=Ag(ye,16);Ae(ye[0],new Gn($e.x,$e.y,0))}else if(e.type==="LineString")for(const ye of e.geometry)Ae(ye,new Gn(ye[0].x,ye[0].y,0));else if(e.type==="Point")for(const ye of e.geometry)for(const $e of ye)Ae([$e],new Gn($e.x,$e.y,0))}function Nd(i,e,r,s,l,u,d,f,g,b,w,E,C,M,z){const U=function(Q,Z,re,se,ce,ze,Be,Pe){const Ie=se.layout.get("text-rotate").evaluate(ze,{})*Math.PI/180,Te=[];for(const Me of Z.positionedLines)for(const Ae of Me.positionedGlyphs){if(!Ae.rect)continue;const ye=Ae.rect||{};let $e=nd+1,Fe=!0,st=1,At=0;const Mt=(ce||Pe)&&Ae.vertical,Qt=Ae.metrics.advance*Ae.scale/2;if(Pe&&Z.verticalizable&&(At=Me.lineOffset/2-(Ae.imageName?-(ri-Ae.metrics.width*Ae.scale)/2:(Ae.scale-1)*ri)),Ae.imageName){const Ft=Be[Ae.imageName];Fe=Ft.sdf,st=Ft.pixelRatio,$e=Fi/st}const ar=ce?[Ae.x+Qt,Ae.y]:[0,0];let di=ce?[0,0]:[Ae.x+Qt+re[0],Ae.y+re[1]-At],Wt=[0,0];Mt&&(Wt=di,di=[0,0]);const ni=(Ae.metrics.left-$e)*Ae.scale-Qt+di[0],pi=(-Ae.metrics.top-$e)*Ae.scale+di[1],Ti=ni+ye.w*Ae.scale/st,Oi=pi+ye.h*Ae.scale/st,Ht=new ve(ni,pi),fi=new ve(Ti,pi),Si=new ve(ni,Oi),ki=new ve(Ti,Oi);if(Mt){const Ft=new ve(-Qt,Qt-xo),mi=-Math.PI/2,at=ri/2-Qt,Ji=new ve(5-xo-at,-(Ae.imageName?at:0)),gi=new ve(...Wt);Ht._rotateAround(mi,Ft)._add(Ji)._add(gi),fi._rotateAround(mi,Ft)._add(Ji)._add(gi),Si._rotateAround(mi,Ft)._add(Ji)._add(gi),ki._rotateAround(mi,Ft)._add(Ji)._add(gi)}if(Ie){const Ft=Math.sin(Ie),mi=Math.cos(Ie),at=[mi,-Ft,Ft,mi];Ht._matMult(at),fi._matMult(at),Si._matMult(at),ki._matMult(at)}const Ui=new ve(0,0),Ni=new ve(0,0);Te.push({tl:Ht,tr:fi,bl:Si,br:ki,tex:ye,writingMode:Z.writingMode,glyphOffset:ar,sectionIndex:Ae.sectionIndex,isSDF:Fe,pixelOffsetTL:Ui,pixelOffsetBR:Ni,minFontScaleX:0,minFontScaleY:0})}return Te}(0,r,f,l,u,d,s,i.allowVerticalPlacement),F=i.textSizeData;let H=null;F.kind==="source"?(H=[Kr*l.layout.get("text-size").evaluate(d,{})],H[0]>jn&&ci(`${i.layerIds[0]}: Value for "text-size" is >= ${bo}. Reduce your "text-size".`)):F.kind==="composite"&&(H=[Kr*M.compositeTextSizes[0].evaluate(d,{},z),Kr*M.compositeTextSizes[1].evaluate(d,{},z)],(H[0]>jn||H[1]>jn)&&ci(`${i.layerIds[0]}: Value for "text-size" is >= ${bo}. Reduce your "text-size".`)),i.addSymbols(i.text,U,H,f,u,d,b,e,g.lineStartIndex,g.lineLength,C,z);for(const Q of w)E[Q]=i.text.placedSymbolArray.length-1;return 4*U.length}function Vd(i){for(const e in i)return i[e];return null}function Mg(i,e,r,s){const l=i.compareText;if(e in l){const u=l[e];for(let d=u.length-1;d>=0;d--)if(s.dist(u[d])<r)return!0}else l[e]=[];return l[e].push(s),!1}const $d=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Qc{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[r,s]=new Uint8Array(e,0,2);if(r!==219)throw new Error("Data does not appear to be in a KDBush format.");const l=s>>4;if(l!==1)throw new Error(`Got v${l} data when expected v1.`);const u=$d[15&s];if(!u)throw new Error("Unrecognized array type.");const[d]=new Uint16Array(e,2,1),[f]=new Uint32Array(e,4,1);return new Qc(f,d,u,e)}constructor(e,r=64,s=Float64Array,l){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=s,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const u=$d.indexOf(this.ArrayType),d=2*e*this.ArrayType.BYTES_PER_ELEMENT,f=e*this.IndexArrayType.BYTES_PER_ELEMENT,g=(8-f%8)%8;if(u<0)throw new Error(`Unexpected typed array class: ${s}.`);l&&l instanceof ArrayBuffer?(this.data=l,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+f+g,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+d+f+g),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+f+g,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+u]),new Uint16Array(this.data,2,1)[0]=r,new Uint32Array(this.data,4,1)[0]=e)}add(e,r){const s=this._pos>>1;return this.ids[s]=s,this.coords[this._pos++]=e,this.coords[this._pos++]=r,s}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return eh(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,r,s,l){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:u,coords:d,nodeSize:f}=this,g=[0,u.length-1,0],b=[];for(;g.length;){const w=g.pop()||0,E=g.pop()||0,C=g.pop()||0;if(E-C<=f){for(let F=C;F<=E;F++){const H=d[2*F],Q=d[2*F+1];H>=e&&H<=s&&Q>=r&&Q<=l&&b.push(u[F])}continue}const M=C+E>>1,z=d[2*M],U=d[2*M+1];z>=e&&z<=s&&U>=r&&U<=l&&b.push(u[M]),(w===0?e<=z:r<=U)&&(g.push(C),g.push(M-1),g.push(1-w)),(w===0?s>=z:l>=U)&&(g.push(M+1),g.push(E),g.push(1-w))}return b}within(e,r,s){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:l,coords:u,nodeSize:d}=this,f=[0,l.length-1,0],g=[],b=s*s;for(;f.length;){const w=f.pop()||0,E=f.pop()||0,C=f.pop()||0;if(E-C<=d){for(let F=C;F<=E;F++)qd(u[2*F],u[2*F+1],e,r)<=b&&g.push(l[F]);continue}const M=C+E>>1,z=u[2*M],U=u[2*M+1];qd(z,U,e,r)<=b&&g.push(l[M]),(w===0?e-s<=z:r-s<=U)&&(f.push(C),f.push(M-1),f.push(1-w)),(w===0?e+s>=z:r+s>=U)&&(f.push(M+1),f.push(E),f.push(1-w))}return g}}function eh(i,e,r,s,l,u){if(l-s<=r)return;const d=s+l>>1;jd(i,e,d,s,l,u),eh(i,e,r,s,d-1,1-u),eh(i,e,r,d+1,l,1-u)}function jd(i,e,r,s,l,u){for(;l>s;){if(l-s>600){const b=l-s+1,w=r-s+1,E=Math.log(b),C=.5*Math.exp(2*E/3),M=.5*Math.sqrt(E*C*(b-C)/b)*(w-b/2<0?-1:1);jd(i,e,r,Math.max(s,Math.floor(r-w*C/b+M)),Math.min(l,Math.floor(r+(b-w)*C/b+M)),u)}const d=e[2*r+u];let f=s,g=l;for(To(i,e,s,r),e[2*l+u]>d&&To(i,e,s,l);f<g;){for(To(i,e,f,g),f++,g--;e[2*f+u]<d;)f++;for(;e[2*g+u]>d;)g--}e[2*s+u]===d?To(i,e,s,g):(g++,To(i,e,g,l)),g<=r&&(s=g+1),r<=g&&(l=g-1)}}function To(i,e,r,s){th(i,r,s),th(e,2*r,2*s),th(e,2*r+1,2*s+1)}function th(i,e,r){const s=i[e];i[e]=i[r],i[r]=s}function qd(i,e,r,s){const l=i-r,u=e-s;return l*l+u*u}var ih;h.PerformanceMarkers=void 0,(ih=h.PerformanceMarkers||(h.PerformanceMarkers={})).create="create",ih.load="load",ih.fullLoad="fullLoad";let Vl=null,So=[];const rh=1e3/60,nh="loadTime",sh="fullLoadTime",kg={mark(i){performance.mark(i)},frame(i){const e=i;Vl!=null&&So.push(e-Vl),Vl=e},clearMetrics(){Vl=null,So=[],performance.clearMeasures(nh),performance.clearMeasures(sh);for(const i in h.PerformanceMarkers)performance.clearMarks(h.PerformanceMarkers[i])},getPerformanceMetrics(){performance.measure(nh,h.PerformanceMarkers.create,h.PerformanceMarkers.load),performance.measure(sh,h.PerformanceMarkers.create,h.PerformanceMarkers.fullLoad);const i=performance.getEntriesByName(nh)[0].duration,e=performance.getEntriesByName(sh)[0].duration,r=So.length,s=1/(So.reduce((u,d)=>u+d,0)/r/1e3),l=So.filter(u=>u>rh).reduce((u,d)=>u+(d-rh)/rh,0);return{loadTime:i,fullLoadTime:e,fps:s,percentDroppedFrames:l/(r+l)*100,totalFrames:r}}};h.AJAXError=Nr,h.ARRAY_TYPE=ha,h.Actor=class{constructor(i,e,r){this.target=i,this.parent=e,this.mapId=r,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},Xn(["receive","process"],this),this.invoker=new bg(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=qi()?i:window}send(i,e,r,s,l=!1){const u=Math.round(1e18*Math.random()).toString(36).substring(0,10);r&&(this.callbacks[u]=r);const d=Ur(this.globalScope)?void 0:[];return this.target.postMessage({id:u,type:i,hasCallback:!!r,targetMapId:s,mustQueue:l,sourceMapId:this.mapId,data:hs(e,d)},d),{cancel:()=>{r&&delete this.callbacks[u],this.target.postMessage({id:u,type:"<cancel>",targetMapId:s,sourceMapId:this.mapId})}}}receive(i){const e=i.data,r=e.id;if(r&&(!e.targetMapId||this.mapId===e.targetMapId))if(e.type==="<cancel>"){delete this.tasks[r];const s=this.cancelCallbacks[r];delete this.cancelCallbacks[r],s&&s()}else qi()||e.mustQueue?(this.tasks[r]=e,this.taskQueue.push(r),this.invoker.trigger()):this.processTask(r,e)}process(){if(!this.taskQueue.length)return;const i=this.taskQueue.shift(),e=this.tasks[i];delete this.tasks[i],this.taskQueue.length&&this.invoker.trigger(),e&&this.processTask(i,e)}processTask(i,e){if(e.type==="<response>"){const r=this.callbacks[i];delete this.callbacks[i],r&&(e.error?r(kr(e.error)):r(null,kr(e.data)))}else{let r=!1;const s=Ur(this.globalScope)?void 0:[],l=e.hasCallback?(f,g)=>{r=!0,delete this.cancelCallbacks[i],this.target.postMessage({id:i,type:"<response>",sourceMapId:this.mapId,error:f?hs(f):null,data:hs(g,s)},s)}:f=>{r=!0};let u=null;const d=kr(e.data);if(this.parent[e.type])u=this.parent[e.type](e.sourceMapId,d,l);else if(this.parent.getWorkerSource){const f=e.type.split(".");u=this.parent.getWorkerSource(e.sourceMapId,f[0],d.source)[f[1]](d,l)}else l(new Error(`Could not find function ${e.type}`));!r&&u&&u.cancel&&(this.cancelCallbacks[i]=u.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}},h.AlphaImage=ho,h.CanonicalTileID=Kc,h.CollisionBoxArray=c,h.CollisionCircleLayoutArray=class extends ra{},h.Color=We,h.DEMData=Ed,h.DataConstantProperty=Ue,h.DictionaryCoder=Id,h.EXTENT=It,h.ErrorEvent=Zi,h.EvaluationParameters=Pt,h.Event=Ir,h.Evented=En,h.FeatureIndex=Cd,h.FillBucket=zc,h.FillExtrusionBucket=Rc,h.GeoJSONFeature=Ad,h.ImageAtlas=ad,h.ImagePosition=Nc,h.KDBush=Qc,h.LineBucket=Bc,h.LineStripIndexArray=class extends t{},h.LngLat=qn,h.MercatorCoordinate=Bl,h.ONE_EM=ri,h.OverscaledTileID=sr,h.PerformanceUtils=kg,h.Point=ve,h.Pos3dArray=class extends ea{},h.PosArray=O,h.Properties=Pi,h.Protobuf=Oc,h.QuadTriangleArray=class extends na{},h.RGBAImage=nr,h.RasterBoundsArray=class extends ro{},h.RequestPerformance=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}},h.SegmentVector=Se,h.SymbolBucket=ga,h.Transitionable=_l,h.TriangleIndexArray=ge,h.Uniform1f=xr,h.Uniform1i=class extends wi{constructor(i,e){super(i,e),this.current=0}set(i){this.current!==i&&(this.current=i,this.gl.uniform1i(this.location,i))}},h.Uniform2f=class extends wi{constructor(i,e){super(i,e),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]))}},h.Uniform3f=class extends wi{constructor(i,e){super(i,e),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]))}},h.Uniform4f=ms,h.UniformColor=ui,h.UniformMatrix4f=class extends wi{constructor(i,e){super(i,e),this.current=ti}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 e=1;e<16;e++)if(i[e]!==this.current[e]){this.current=i,this.gl.uniformMatrix4fv(this.location,!1,i);break}}},h.UnwrappedTileID=Sd,h.ValidationError=we,h.ZoomHistory=ul,h.addDynamicAttributes=qc,h.arrayBufferToImage=function(i,e){const r=new Image;r.onload=()=>{e(null,r),URL.revokeObjectURL(r.src),r.onload=null,window.requestAnimationFrame(()=>{r.src=Sr})},r.onerror=()=>e(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const s=new Blob([new Uint8Array(i)],{type:"image/png"});r.src=i.byteLength?URL.createObjectURL(s):Sr},h.arrayBufferToImageBitmap=function(i,e){const r=new Blob([new Uint8Array(i)],{type:"image/png"});createImageBitmap(r).then(s=>{e(null,s)}).catch(s=>{e(new Error(`Could not load image because of ${s.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})},h.asyncAll=function(i,e,r){if(!i.length)return r(null,[]);let s=i.length;const l=new Array(i.length);let u=null;i.forEach((d,f)=>{e(d,(g,b)=>{g&&(u=g),l[f]=b,--s==0&&r(u,l)})})},h.bezier=kt,h.bindAll=Xn,h.clamp=Ct,h.clipLine=kd,h.clone=function(i){var e=new ha(16);return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],e},h.clone$1=Ii,h.collisionCircleLayout=Km,h.config=Wn,h.copy=function(i,e){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i},h.create=function(){var i=new ha(16);return ha!=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},h.createExpression=Lt,h.createFilter=$a,h.createLayout=Xt,h.createStyleLayer=function(i){return i.type==="custom"?new xg(i):new vg[i.type](i)},h.deepEqual=function i(e,r){if(Array.isArray(e)){if(!Array.isArray(r)||e.length!==r.length)return!1;for(let s=0;s<e.length;s++)if(!i(e[s],r[s]))return!1;return!0}if(typeof e=="object"&&e!==null&&r!==null){if(typeof r!="object"||Object.keys(e).length!==Object.keys(r).length)return!1;for(const s in e)if(!i(e[s],r[s]))return!1;return!0}return e===r},h.derefLayers=function(i){i=i.slice();const e=Object.create(null);for(let r=0;r<i.length;r++)e[i[r].id]=i[r];for(let r=0;r<i.length;r++)"ref"in i[r]&&(i[r]=Hn(i[r],e[i[r].ref]));return i},h.diffStyles=function(i,e){if(!i)return[{command:ct.setStyle,args:[e]}];let r=[];try{if(!vt(i.version,e.version))return[{command:ct.setStyle,args:[e]}];vt(i.center,e.center)||r.push({command:ct.setCenter,args:[e.center]}),vt(i.zoom,e.zoom)||r.push({command:ct.setZoom,args:[e.zoom]}),vt(i.bearing,e.bearing)||r.push({command:ct.setBearing,args:[e.bearing]}),vt(i.pitch,e.pitch)||r.push({command:ct.setPitch,args:[e.pitch]}),vt(i.sprite,e.sprite)||r.push({command:ct.setSprite,args:[e.sprite]}),vt(i.glyphs,e.glyphs)||r.push({command:ct.setGlyphs,args:[e.glyphs]}),vt(i.transition,e.transition)||r.push({command:ct.setTransition,args:[e.transition]}),vt(i.light,e.light)||r.push({command:ct.setLight,args:[e.light]});const s={},l=[];(function(d,f,g,b){let w;for(w in f=f||{},d=d||{})Object.prototype.hasOwnProperty.call(d,w)&&(Object.prototype.hasOwnProperty.call(f,w)||Kn(w,g,b));for(w in f)Object.prototype.hasOwnProperty.call(f,w)&&(Object.prototype.hasOwnProperty.call(d,w)?vt(d[w],f[w])||(d[w].type==="geojson"&&f[w].type==="geojson"&&jt(d,f,w)?g.push({command:ct.setGeoJSONSourceData,args:[w,f[w].data]}):Ts(w,f,g,b)):nn(w,f,g))})(i.sources,e.sources,l,s);const u=[];i.layers&&i.layers.forEach(d=>{s[d.source]?r.push({command:ct.removeLayer,args:[d.id]}):u.push(d)}),r=r.concat(l),function(d,f,g){f=f||[];const b=(d=d||[]).map(In),w=f.map(In),E=d.reduce(an,{}),C=f.reduce(an,{}),M=b.slice(),z=Object.create(null);let U,F,H,Q,Z,re,se;for(U=0,F=0;U<b.length;U++)H=b[U],Object.prototype.hasOwnProperty.call(C,H)?F++:(g.push({command:ct.removeLayer,args:[H]}),M.splice(M.indexOf(H,F),1));for(U=0,F=0;U<w.length;U++)H=w[w.length-1-U],M[M.length-1-U]!==H&&(Object.prototype.hasOwnProperty.call(E,H)?(g.push({command:ct.removeLayer,args:[H]}),M.splice(M.lastIndexOf(H,M.length-F),1)):F++,re=M[M.length-U],g.push({command:ct.addLayer,args:[C[H],re]}),M.splice(M.length-U,0,H),z[H]=!0);for(U=0;U<w.length;U++)if(H=w[U],Q=E[H],Z=C[H],!z[H]&&!vt(Q,Z))if(vt(Q.source,Z.source)&&vt(Q["source-layer"],Z["source-layer"])&&vt(Q.type,Z.type)){for(se in sn(Q.layout,Z.layout,g,H,null,ct.setLayoutProperty),sn(Q.paint,Z.paint,g,H,null,ct.setPaintProperty),vt(Q.filter,Z.filter)||g.push({command:ct.setFilter,args:[H,Z.filter]}),vt(Q.minzoom,Z.minzoom)&&vt(Q.maxzoom,Z.maxzoom)||g.push({command:ct.setLayerZoomRange,args:[H,Z.minzoom,Z.maxzoom]}),Q)Object.prototype.hasOwnProperty.call(Q,se)&&se!=="layout"&&se!=="paint"&&se!=="filter"&&se!=="metadata"&&se!=="minzoom"&&se!=="maxzoom"&&(se.indexOf("paint.")===0?sn(Q[se],Z[se],g,H,se.slice(6),ct.setPaintProperty):vt(Q[se],Z[se])||g.push({command:ct.setLayerProperty,args:[H,se,Z[se]]}));for(se in Z)Object.prototype.hasOwnProperty.call(Z,se)&&!Object.prototype.hasOwnProperty.call(Q,se)&&se!=="layout"&&se!=="paint"&&se!=="filter"&&se!=="metadata"&&se!=="minzoom"&&se!=="maxzoom"&&(se.indexOf("paint.")===0?sn(Q[se],Z[se],g,H,se.slice(6),ct.setPaintProperty):vt(Q[se],Z[se])||g.push({command:ct.setLayerProperty,args:[H,se,Z[se]]}))}else g.push({command:ct.removeLayer,args:[H]}),re=M[M.lastIndexOf(H)+1],g.push({command:ct.addLayer,args:[Z,re]})}(u,e.layers,r)}catch(s){console.warn("Unable to compute style diff:",s),r=[{command:ct.setStyle,args:[e]}]}return r},h.dot=function(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]+i[3]*e[3]},h.earthRadius=Wc,h.ease=Dt,h.emitValidationErrors=On,h.emptyStyle=function(){const i={},e=oe.$version;for(const r in oe.$root){const s=oe.$root[r];if(s.required){let l=null;l=r==="version"?e:s.type==="array"?[]:{},l!=null&&(i[r]=l)}}return i},h.equals=function(i,e){var r=i[0],s=i[1],l=i[2],u=i[3],d=i[4],f=i[5],g=i[6],b=i[7],w=i[8],E=i[9],C=i[10],M=i[11],z=i[12],U=i[13],F=i[14],H=i[15],Q=e[0],Z=e[1],re=e[2],se=e[3],ce=e[4],ze=e[5],Be=e[6],Pe=e[7],Ie=e[8],Te=e[9],Me=e[10],Ae=e[11],ye=e[12],$e=e[13],Fe=e[14],st=e[15];return Math.abs(r-Q)<=Mi*Math.max(1,Math.abs(r),Math.abs(Q))&&Math.abs(s-Z)<=Mi*Math.max(1,Math.abs(s),Math.abs(Z))&&Math.abs(l-re)<=Mi*Math.max(1,Math.abs(l),Math.abs(re))&&Math.abs(u-se)<=Mi*Math.max(1,Math.abs(u),Math.abs(se))&&Math.abs(d-ce)<=Mi*Math.max(1,Math.abs(d),Math.abs(ce))&&Math.abs(f-ze)<=Mi*Math.max(1,Math.abs(f),Math.abs(ze))&&Math.abs(g-Be)<=Mi*Math.max(1,Math.abs(g),Math.abs(Be))&&Math.abs(b-Pe)<=Mi*Math.max(1,Math.abs(b),Math.abs(Pe))&&Math.abs(w-Ie)<=Mi*Math.max(1,Math.abs(w),Math.abs(Ie))&&Math.abs(E-Te)<=Mi*Math.max(1,Math.abs(E),Math.abs(Te))&&Math.abs(C-Me)<=Mi*Math.max(1,Math.abs(C),Math.abs(Me))&&Math.abs(M-Ae)<=Mi*Math.max(1,Math.abs(M),Math.abs(Ae))&&Math.abs(z-ye)<=Mi*Math.max(1,Math.abs(z),Math.abs(ye))&&Math.abs(U-$e)<=Mi*Math.max(1,Math.abs(U),Math.abs($e))&&Math.abs(F-Fe)<=Mi*Math.max(1,Math.abs(F),Math.abs(Fe))&&Math.abs(H-st)<=Mi*Math.max(1,Math.abs(H),Math.abs(st))},h.evaluateSizeForFeature=function(i,{uSize:e,uSizeT:r},{lowerSize:s,upperSize:l}){return i.kind==="source"?s/Kr:i.kind==="composite"?zi.number(s/Kr,l/Kr,r):e},h.evaluateSizeForZoom=function(i,e){let r=0,s=0;if(i.kind==="constant")s=i.layoutSize;else if(i.kind!=="source"){const{interpolationType:l,minZoom:u,maxZoom:d}=i,f=l?Ct(Di.interpolationFactor(l,e,u,d),0,1):0;i.kind==="camera"?s=zi.number(i.minSize,i.maxSize,f):r=f}return{uSizeT:r,uSize:s}},h.evaluateVariableOffset=Ud,h.evented=Ys,h.exported=wn,h.extend=xi,h.filterObject=vn,h.findLineIntersection=function(i,e,r,s){const l=e.y-i.y,u=e.x-i.x,d=s.y-r.y,f=s.x-r.x,g=d*u-f*l;if(g===0)return null;const b=(f*(i.y-r.y)-d*(i.x-r.x))/g;return new ve(i.x+b*u,i.y+b*l)},h.fromScaling=function(i,e){return i[0]=e[0],i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=e[1],i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=e[2],i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i},h.getAnchorAlignment=$c,h.getAnchorJustification=Jc,h.getArrayBuffer=Sn,h.getDefaultExportFromCjs=me,h.getJSON=function(i,e){return Tn(xi(i,{type:"json"}),e)},h.getOverlapMode=jc,h.getProtocolAction=Gi,h.getRTLTextPluginStatus=Ja,h.getReferrer=vi,h.getVideo=function(i,e){const r=window.document.createElement("video");r.muted=!0,r.onloadstart=function(){e(null,r)};for(let s=0;s<i.length;s++){const l=window.document.createElement("source");rn(i[s])||(r.crossOrigin="Anonymous"),l.src=i[s],r.appendChild(l)}return{cancel:()=>{}}},h.groupByLayout=function(i,e){const r={};for(let l=0;l<i.length;l++){const u=e&&e[i[l].id]||fc(i[l]);e&&(e[i[l].id]=u);let d=r[u];d||(d=r[u]=[]),d.push(i[l])}const s=[];for(const l in r)s.push(r[l]);return s},h.identity=Tc,h.interpolate=zi,h.invert=function(i,e){var r=e[0],s=e[1],l=e[2],u=e[3],d=e[4],f=e[5],g=e[6],b=e[7],w=e[8],E=e[9],C=e[10],M=e[11],z=e[12],U=e[13],F=e[14],H=e[15],Q=r*f-s*d,Z=r*g-l*d,re=r*b-u*d,se=s*g-l*f,ce=s*b-u*f,ze=l*b-u*g,Be=w*U-E*z,Pe=w*F-C*z,Ie=w*H-M*z,Te=E*F-C*U,Me=E*H-M*U,Ae=C*H-M*F,ye=Q*Ae-Z*Me+re*Te+se*Ie-ce*Pe+ze*Be;return ye?(i[0]=(f*Ae-g*Me+b*Te)*(ye=1/ye),i[1]=(l*Me-s*Ae-u*Te)*ye,i[2]=(U*ze-F*ce+H*se)*ye,i[3]=(C*ce-E*ze-M*se)*ye,i[4]=(g*Ie-d*Ae-b*Pe)*ye,i[5]=(r*Ae-l*Ie+u*Pe)*ye,i[6]=(F*re-z*ze-H*Z)*ye,i[7]=(w*ze-C*re+M*Z)*ye,i[8]=(d*Me-f*Ie+b*Be)*ye,i[9]=(s*Ie-r*Me-u*Be)*ye,i[10]=(z*ce-U*re+H*Q)*ye,i[11]=(E*re-w*ce-M*Q)*ye,i[12]=(f*Pe-d*Te-g*Be)*ye,i[13]=(r*Te-s*Pe+l*Be)*ye,i[14]=(U*Z-z*se-F*Q)*ye,i[15]=(w*se-E*Z+C*Q)*ye,i):null},h.isImageBitmap=en,h.isSafari=Ur,h.isWorker=qi,h.keysDifference=function(i,e){const r=[];for(const s in i)s in e||r.push(s);return r},h.lazyLoadRTLTextPlugin=function(){Yi.isLoading()||Yi.isLoaded()||Ja()!=="deferred"||gl()},h.makeRequest=Tn,h.mapObject=Or,h.mercatorXfromLng=vd,h.mercatorYfromLat=bd,h.mercatorZfromAltitude=wd,h.mul=lm,h.mul$1=function(i,e,r){return i[0]=e[0]*r[0],i[1]=e[1]*r[1],i[2]=e[2]*r[2],i[3]=e[3]*r[3],i},h.multiply=Eu,h.nextPowerOfTwo=function(i){return i<=1?1:Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))},h.operations=ct,h.ortho=function(i,e,r,s,l,u,d){var f=1/(e-r),g=1/(s-l),b=1/(u-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*b,i[11]=0,i[12]=(e+r)*f,i[13]=(l+s)*g,i[14]=(d+u)*b,i[15]=1,i},h.parseCacheControl=function(i){const e={};if(i.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(r,s,l,u)=>{const d=l||u;return e[s]=!d||d.toLowerCase(),""}),e["max-age"]){const r=parseInt(e["max-age"],10);isNaN(r)?delete e["max-age"]:e["max-age"]=r}return e},h.parseGlyphPbf=function(i){return new Oc(i).readFields(og,[])},h.pbf=Yu,h.performSymbolLayout=function(i){i.bucket.createArrays(),i.bucket.tilePixelRatio=It/(512*i.bucket.overscaling),i.bucket.compareText={},i.bucket.iconsNeedLinear=!1;const e=i.bucket.layers[0].layout,r=i.bucket.layers[0]._unevaluatedLayout._values,s={layoutIconSize:r["icon-size"].possiblyEvaluate(new Pt(i.bucket.zoom+1),i.canonical),layoutTextSize:r["text-size"].possiblyEvaluate(new Pt(i.bucket.zoom+1),i.canonical),textMaxSize:r["text-size"].possiblyEvaluate(new Pt(18))};if(i.bucket.textSizeData.kind==="composite"){const{minZoom:g,maxZoom:b}=i.bucket.textSizeData;s.compositeTextSizes=[r["text-size"].possiblyEvaluate(new Pt(g),i.canonical),r["text-size"].possiblyEvaluate(new Pt(b),i.canonical)]}if(i.bucket.iconSizeData.kind==="composite"){const{minZoom:g,maxZoom:b}=i.bucket.iconSizeData;s.compositeIconSizes=[r["icon-size"].possiblyEvaluate(new Pt(g),i.canonical),r["icon-size"].possiblyEvaluate(new Pt(b),i.canonical)]}const l=e.get("text-line-height")*ri,u=e.get("text-rotation-alignment")!=="viewport"&&e.get("symbol-placement")!=="point",d=e.get("text-keep-upright"),f=e.get("text-size");for(const g of i.bucket.features){const b=e.get("text-font").evaluate(g,{},i.canonical).join(","),w=f.evaluate(g,{},i.canonical),E=s.layoutTextSize.evaluate(g,{},i.canonical),C=s.layoutIconSize.evaluate(g,{},i.canonical),M={horizontal:{},vertical:void 0},z=g.text;let U,F=[0,0];if(z){const Z=z.toString(),re=e.get("text-letter-spacing").evaluate(g,{},i.canonical)*ri,se=Wa(Z)?re:0,ce=e.get("text-anchor").evaluate(g,{},i.canonical),ze=e.get("text-variable-anchor");if(!ze){const Me=e.get("text-radial-offset").evaluate(g,{},i.canonical);F=Me?Ud(ce,[Me*ri,Yc]):e.get("text-offset").evaluate(g,{},i.canonical).map(Ae=>Ae*ri)}let Be=u?"center":e.get("text-justify").evaluate(g,{},i.canonical);const Pe=e.get("symbol-placement"),Ie=Pe==="point"?e.get("text-max-width").evaluate(g,{},i.canonical)*ri:0,Te=()=>{i.bucket.allowVerticalPlacement&&Zs(Z)&&(M.vertical=Ll(z,i.glyphMap,i.glyphPositions,i.imagePositions,b,Ie,l,ce,"left",se,F,h.WritingMode.vertical,!0,Pe,E,w))};if(!u&&ze){const Me=Be==="auto"?ze.map(ye=>Jc(ye)):[Be];let Ae=!1;for(let ye=0;ye<Me.length;ye++){const $e=Me[ye];if(!M.horizontal[$e])if(Ae)M.horizontal[$e]=M.horizontal[0];else{const Fe=Ll(z,i.glyphMap,i.glyphPositions,i.imagePositions,b,Ie,l,"center",$e,se,F,h.WritingMode.horizontal,!1,Pe,E,w);Fe&&(M.horizontal[$e]=Fe,Ae=Fe.positionedLines.length===1)}}Te()}else{Be==="auto"&&(Be=Jc(ce));const Me=Ll(z,i.glyphMap,i.glyphPositions,i.imagePositions,b,Ie,l,ce,Be,se,F,h.WritingMode.horizontal,!1,Pe,E,w);Me&&(M.horizontal[Be]=Me),Te(),Zs(Z)&&u&&d&&(M.vertical=Ll(z,i.glyphMap,i.glyphPositions,i.imagePositions,b,Ie,l,ce,Be,se,F,h.WritingMode.vertical,!1,Pe,E,w))}}let H=!1;if(g.icon&&g.icon.name){const Z=i.imageMap[g.icon.name];Z&&(U=pg(i.imagePositions[g.icon.name],e.get("icon-offset").evaluate(g,{},i.canonical),e.get("icon-anchor").evaluate(g,{},i.canonical)),H=!!Z.sdf,i.bucket.sdfIcons===void 0?i.bucket.sdfIcons=H:i.bucket.sdfIcons!==H&&ci("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(Z.pixelRatio!==i.bucket.pixelRatio||e.get("icon-rotate").constantOr(1)!==0)&&(i.bucket.iconsNeedLinear=!0))}const Q=Vd(M.horizontal)||M.vertical;i.bucket.iconsInText=!!Q&&Q.iconsInText,(Q||U)&&Pg(i.bucket,g,M,U,i.imageMap,s,E,C,F,H,i.canonical)}i.showCollisionBoxes&&i.bucket.generateCollisionDebugBuffers()},h.perspective=function(i,e,r,s,l){var u,d=1/Math.tan(e/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+s)*(u=1/(s-l)),i[14]=2*l*s*u):(i[10]=-1,i[14]=-2*s),i},h.pick=function(i,e){const r={};for(let s=0;s<e.length;s++){const l=e[s];l in i&&(r[l]=i[l])}return r},h.plugin=Yi,h.pointGeometry=J,h.polygonIntersectsPolygon=xu,h.potpack=sd,h.register=De,h.registerForPluginStateChange=function(i){return i({pluginStatus:Ci,pluginURL:Hr}),Ys.on("pluginStateChange",i),i},h.renderColorRamp=Mu,h.rotateX=function(i,e,r){var s=Math.sin(r),l=Math.cos(r),u=e[4],d=e[5],f=e[6],g=e[7],b=e[8],w=e[9],E=e[10],C=e[11];return e!==i&&(i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15]),i[4]=u*l+b*s,i[5]=d*l+w*s,i[6]=f*l+E*s,i[7]=g*l+C*s,i[8]=b*l-u*s,i[9]=w*l-d*s,i[10]=E*l-f*s,i[11]=C*l-g*s,i},h.rotateZ=function(i,e,r){var s=Math.sin(r),l=Math.cos(r),u=e[0],d=e[1],f=e[2],g=e[3],b=e[4],w=e[5],E=e[6],C=e[7];return e!==i&&(i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15]),i[0]=u*l+b*s,i[1]=d*l+w*s,i[2]=f*l+E*s,i[3]=g*l+C*s,i[4]=b*l-u*s,i[5]=w*l-d*s,i[6]=E*l-f*s,i[7]=C*l-g*s,i},h.sameOrigin=rn,h.scale=function(i,e,r){var s=r[0],l=r[1],u=r[2];return i[0]=e[0]*s,i[1]=e[1]*s,i[2]=e[2]*s,i[3]=e[3]*s,i[4]=e[4]*l,i[5]=e[5]*l,i[6]=e[6]*l,i[7]=e[7]*l,i[8]=e[8]*u,i[9]=e[9]*u,i[10]=e[10]*u,i[11]=e[11]*u,i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i},h.setRTLTextPlugin=function(i,e,r=!1){if(Ci===Ha||Ci===Ks||Ci===Ka)throw new Error("setRTLTextPlugin cannot be called multiple times.");Hr=wn.resolveURL(i),Ci=Ha,us=e,Ya(),r||gl()},h.sphericalToCartesian=function([i,e,r]){return e+=90,e*=Math.PI/180,r*=Math.PI/180,{x:i*Math.cos(e)*Math.sin(r),y:i*Math.sin(e)*Math.sin(r),z:i*Math.cos(r)}},h.toEvaluationFeature=_s,h.transformMat4=El,h.translate=function(i,e,r){var s,l,u,d,f,g,b,w,E,C,M,z,U=r[0],F=r[1],H=r[2];return e===i?(i[12]=e[0]*U+e[4]*F+e[8]*H+e[12],i[13]=e[1]*U+e[5]*F+e[9]*H+e[13],i[14]=e[2]*U+e[6]*F+e[10]*H+e[14],i[15]=e[3]*U+e[7]*F+e[11]*H+e[15]):(l=e[1],u=e[2],d=e[3],f=e[4],g=e[5],b=e[6],w=e[7],E=e[8],C=e[9],M=e[10],z=e[11],i[0]=s=e[0],i[1]=l,i[2]=u,i[3]=d,i[4]=f,i[5]=g,i[6]=b,i[7]=w,i[8]=E,i[9]=C,i[10]=M,i[11]=z,i[12]=s*U+f*F+E*H+e[12],i[13]=l*U+g*F+C*H+e[13],i[14]=u*U+b*F+M*H+e[14],i[15]=d*U+w*F+z*H+e[15]),i},h.triggerPluginCompletionEvent=ml,h.unicodeBlockLookup=Ce,h.uniqueId=function(){return Ta++},h.v8Spec=oe,h.validateCustomStyleLayer=function(i){const e=[],r=i.id;return r===void 0&&e.push({message:`layers.${r}: missing required property "id"`}),i.render===void 0&&e.push({message:`layers.${r}: missing required method "render"`}),i.renderingMode&&i.renderingMode!=="2d"&&i.renderingMode!=="3d"&&e.push({message:`layers.${r}: property "renderingMode" must be either "2d" or "3d"`}),e},h.validateLight=mc,h.validateStyle=Wr,h.vectorTile=Vn,h.warnOnce=ci,h.wrap=hr}),he(["./shared"],function(h){class me{constructor(I){this.keyCache={},I&&this.replace(I)}replace(I){this._layerConfigs={},this._layers={},this.update(I,[])}update(I,P){for(const j of I){this._layerConfigs[j.id]=j;const q=this._layers[j.id]=h.createStyleLayer(j);q._featureFilter=h.createFilter(q.filter),this.keyCache[j.id]&&delete this.keyCache[j.id]}for(const j of P)delete this.keyCache[j],delete this._layerConfigs[j],delete this._layers[j];this.familiesBySource={};const D=h.groupByLayout(Object.values(this._layerConfigs),this.keyCache);for(const j of D){const q=j.map(pe=>this._layers[pe.id]),Y=q[0];if(Y.visibility==="none")continue;const X=Y.source||"";let G=this.familiesBySource[X];G||(G=this.familiesBySource[X]={});const ee=Y.sourceLayer||"_geojsonTileLayer";let ue=G[ee];ue||(ue=G[ee]=[]),ue.push(q)}}}class J{constructor(I){const P={},D=[];for(const X in I){const G=I[X],ee=P[X]={};for(const ue in G){const pe=G[+ue];if(!pe||pe.bitmap.width===0||pe.bitmap.height===0)continue;const de={x:0,y:0,w:pe.bitmap.width+2,h:pe.bitmap.height+2};D.push(de),ee[ue]={rect:de,metrics:pe.metrics}}}const{w:j,h:q}=h.potpack(D),Y=new h.AlphaImage({width:j||1,height:q||1});for(const X in I){const G=I[X];for(const ee in G){const ue=G[+ee];if(!ue||ue.bitmap.width===0||ue.bitmap.height===0)continue;const pe=P[X][ee].rect;h.AlphaImage.copy(ue.bitmap,Y,{x:0,y:0},{x:pe.x+1,y:pe.y+1},ue.bitmap)}}this.image=Y,this.positions=P}}h.register("GlyphAtlas",J);class Ke{constructor(I){this.tileID=new h.OverscaledTileID(I.tileID.overscaledZ,I.tileID.wrap,I.tileID.canonical.z,I.tileID.canonical.x,I.tileID.canonical.y),this.uid=I.uid,this.zoom=I.zoom,this.pixelRatio=I.pixelRatio,this.tileSize=I.tileSize,this.source=I.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=I.showCollisionBoxes,this.collectResourceTiming=!!I.collectResourceTiming,this.returnDependencies=!!I.returnDependencies,this.promoteId=I.promoteId}parse(I,P,D,j,q){this.status="parsing",this.data=I,this.collisionBoxArray=new h.CollisionBoxArray;const Y=new h.DictionaryCoder(Object.keys(I.layers).sort()),X=new h.FeatureIndex(this.tileID,this.promoteId);X.bucketLayerIDs=[];const G={},ee={featureIndex:X,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:D},ue=P.familiesBySource[this.source];for(const rt in ue){const ht=I.layers[rt];if(!ht)continue;ht.version===1&&h.warnOnce(`Vector tile source "${this.source}" layer "${rt}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const bt=Y.encode(rt),qt=[];for(let We=0;We<ht.length;We++){const zt=ht.feature(We),qr=X.getId(zt,rt);qt.push({feature:zt,id:qr,index:We,sourceLayerIndex:bt})}for(const We of ue[rt]){const zt=We[0];zt.source!==this.source&&h.warnOnce(`layer.source = ${zt.source} does not equal this.source = ${this.source}`),zt.minzoom&&this.zoom<Math.floor(zt.minzoom)||zt.maxzoom&&this.zoom>=zt.maxzoom||zt.visibility!=="none"&&(ve(We,this.zoom,D),(G[zt.id]=zt.createBucket({index:X.bucketLayerIDs.length,layers:We,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:bt,sourceID:this.source})).populate(qt,ee,this.tileID.canonical),X.bucketLayerIDs.push(We.map(qr=>qr.id)))}}let pe,de,qe,Ye;const Re=h.mapObject(ee.glyphDependencies,rt=>Object.keys(rt).map(Number));Object.keys(Re).length?j.send("getGlyphs",{uid:this.uid,stacks:Re,source:this.source,tileID:this.tileID,type:"glyphs"},(rt,ht)=>{pe||(pe=rt,de=ht,lt.call(this))}):de={};const Ne=Object.keys(ee.iconDependencies);Ne.length?j.send("getImages",{icons:Ne,source:this.source,tileID:this.tileID,type:"icons"},(rt,ht)=>{pe||(pe=rt,qe=ht,lt.call(this))}):qe={};const He=Object.keys(ee.patternDependencies);function lt(){if(pe)return q(pe);if(de&&qe&&Ye){const rt=new J(de),ht=new h.ImageAtlas(qe,Ye);for(const bt in G){const qt=G[bt];qt instanceof h.SymbolBucket?(ve(qt.layers,this.zoom,D),h.performSymbolLayout({bucket:qt,glyphMap:de,glyphPositions:rt.positions,imageMap:qe,imagePositions:ht.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):qt.hasPattern&&(qt instanceof h.LineBucket||qt instanceof h.FillBucket||qt instanceof h.FillExtrusionBucket)&&(ve(qt.layers,this.zoom,D),qt.addFeatures(ee,this.tileID.canonical,ht.patternPositions))}this.status="done",q(null,{buckets:Object.values(G).filter(bt=>!bt.isEmpty()),featureIndex:X,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:rt.image,imageAtlas:ht,glyphMap:this.returnDependencies?de:null,iconMap:this.returnDependencies?qe:null,glyphPositions:this.returnDependencies?rt.positions:null})}}He.length?j.send("getImages",{icons:He,source:this.source,tileID:this.tileID,type:"patterns"},(rt,ht)=>{pe||(pe=rt,Ye=ht,lt.call(this))}):Ye={},lt.call(this)}}function ve(N,I,P){const D=new h.EvaluationParameters(I);for(const j of N)j.recalculate(D,P)}function Ee(N,I){const P=h.getArrayBuffer(N.request,(D,j,q,Y)=>{D?I(D):j&&I(null,{vectorTile:new h.vectorTile.VectorTile(new h.Protobuf(j)),rawData:j,cacheControl:q,expires:Y})});return()=>{P.cancel(),I()}}class Xe{constructor(I,P,D,j){this.actor=I,this.layerIndex=P,this.availableImages=D,this.loadVectorData=j||Ee,this.loading={},this.loaded={}}loadTile(I,P){const D=I.uid;this.loading||(this.loading={});const j=!!(I&&I.request&&I.request.collectResourceTiming)&&new h.RequestPerformance(I.request),q=this.loading[D]=new Ke(I);q.abort=this.loadVectorData(I,(Y,X)=>{if(delete this.loading[D],Y||!X)return q.status="done",this.loaded[D]=q,P(Y);const G=X.rawData,ee={};X.expires&&(ee.expires=X.expires),X.cacheControl&&(ee.cacheControl=X.cacheControl);const ue={};if(j){const pe=j.finish();pe&&(ue.resourceTiming=JSON.parse(JSON.stringify(pe)))}q.vectorTile=X.vectorTile,q.parse(X.vectorTile,this.layerIndex,this.availableImages,this.actor,(pe,de)=>{if(pe||!de)return P(pe);P(null,h.extend({rawTileData:G.slice(0)},de,ee,ue))}),this.loaded=this.loaded||{},this.loaded[D]=q})}reloadTile(I,P){const D=this.loaded,j=I.uid,q=this;if(D&&D[j]){const Y=D[j];Y.showCollisionBoxes=I.showCollisionBoxes;const X=(G,ee)=>{const ue=Y.reloadCallback;ue&&(delete Y.reloadCallback,Y.parse(Y.vectorTile,q.layerIndex,this.availableImages,q.actor,ue)),P(G,ee)};Y.status==="parsing"?Y.reloadCallback=X:Y.status==="done"&&(Y.vectorTile?Y.parse(Y.vectorTile,this.layerIndex,this.availableImages,this.actor,X):X())}}abortTile(I,P){const D=this.loading,j=I.uid;D&&D[j]&&D[j].abort&&(D[j].abort(),delete D[j]),P()}removeTile(I,P){const D=this.loaded,j=I.uid;D&&D[j]&&delete D[j],P()}}class je{constructor(){this.loaded={}}loadTile(I,P){const{uid:D,encoding:j,rawImageData:q}=I,Y=h.isImageBitmap(q)?this.getImageData(q):q,X=new h.DEMData(D,Y,j);this.loaded=this.loaded||{},this.loaded[D]=X,P(null,X)}getImageData(I){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(I.width,I.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=I.width,this.offscreenCanvas.height=I.height,this.offscreenCanvasContext.drawImage(I,0,0,I.width,I.height);const P=this.offscreenCanvasContext.getImageData(-1,-1,I.width+2,I.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new h.RGBAImage({width:P.width,height:P.height},P.data)}removeTile(I){const P=this.loaded,D=I.uid;P&&P[D]&&delete P[D]}}function kt(N,I){if(N.length!==0){Dt(N[0],I);for(var P=1;P<N.length;P++)Dt(N[P],!I)}}function Dt(N,I){for(var P=0,D=0,j=0,q=N.length,Y=q-1;j<q;Y=j++){var X=(N[j][0]-N[Y][0])*(N[Y][1]+N[j][1]),G=P+X;D+=Math.abs(P)>=Math.abs(X)?P-G+X:X-G+P,P=G}P+D>=0!=!!I&&N.reverse()}var Ct=h.getDefaultExportFromCjs(function N(I,P){var D,j=I&&I.type;if(j==="FeatureCollection")for(D=0;D<I.features.length;D++)N(I.features[D],P);else if(j==="GeometryCollection")for(D=0;D<I.geometries.length;D++)N(I.geometries[D],P);else if(j==="Feature")N(I.geometry,P);else if(j==="Polygon")kt(I.coordinates,P);else if(j==="MultiPolygon")for(D=0;D<I.coordinates.length;D++)kt(I.coordinates[D],P);return I});const hr=h.vectorTile.VectorTileFeature.prototype.toGeoJSON;var xi={exports:{}},Ta=h.pointGeometry,Xn=h.vectorTile.VectorTileFeature,Or=vn;function vn(N,I){this.options=I||{},this.features=N,this.length=N.length}function Ii(N,I){this.id=typeof N.id=="number"?N.id:void 0,this.type=N.type,this.rawGeometry=N.type===1?[N.geometry]:N.geometry,this.properties=N.tags,this.extent=I||4096}vn.prototype.feature=function(N){return new Ii(this.features[N],this.options.extent)},Ii.prototype.loadGeometry=function(){var N=this.rawGeometry;this.geometry=[];for(var I=0;I<N.length;I++){for(var P=N[I],D=[],j=0;j<P.length;j++)D.push(new Ta(P[j][0],P[j][1]));this.geometry.push(D)}return this.geometry},Ii.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var N=this.geometry,I=1/0,P=-1/0,D=1/0,j=-1/0,q=0;q<N.length;q++)for(var Y=N[q],X=0;X<Y.length;X++){var G=Y[X];I=Math.min(I,G.x),P=Math.max(P,G.x),D=Math.min(D,G.y),j=Math.max(j,G.y)}return[I,D,P,j]},Ii.prototype.toGeoJSON=Xn.prototype.toGeoJSON;var Qr=h.pbf,ci=Or;function yt(N){var I=new Qr;return function(P,D){for(var j in P.layers)D.writeMessage(3,Sa,P.layers[j])}(N,I),I.finish()}function Sa(N,I){var P;I.writeVarintField(15,N.version||1),I.writeStringField(1,N.name||""),I.writeVarintField(5,N.extent||4096);var D={keys:[],values:[],keycache:{},valuecache:{}};for(P=0;P<N.length;P++)D.feature=N.feature(P),I.writeMessage(2,qi,D);var j=D.keys;for(P=0;P<j.length;P++)I.writeStringField(3,j[P]);var q=D.values;for(P=0;P<q.length;P++)I.writeMessage(4,bn,q[P])}function qi(N,I){var P=N.feature;P.id!==void 0&&I.writeVarintField(1,P.id),I.writeMessage(2,Tr,N),I.writeVarintField(3,P.type),I.writeMessage(4,Sr,P)}function Tr(N,I){var P=N.feature,D=N.keys,j=N.values,q=N.keycache,Y=N.valuecache;for(var X in P.properties){var G=P.properties[X],ee=q[X];if(G!==null){ee===void 0&&(D.push(X),q[X]=ee=D.length-1),I.writeVarint(ee);var ue=typeof G;ue!=="string"&&ue!=="boolean"&&ue!=="number"&&(G=JSON.stringify(G));var pe=ue+":"+G,de=Y[pe];de===void 0&&(j.push(G),Y[pe]=de=j.length-1),I.writeVarint(de)}}}function Ur(N,I){return(I<<3)+(7&N)}function en(N){return N<<1^N>>31}function Sr(N,I){for(var P=N.loadGeometry(),D=N.type,j=0,q=0,Y=P.length,X=0;X<Y;X++){var G=P[X],ee=1;D===1&&(ee=G.length),I.writeVarint(Ur(1,ee));for(var ue=D===3?G.length-1:G.length,pe=0;pe<ue;pe++){pe===1&&D!==1&&I.writeVarint(Ur(2,ue-1));var de=G[pe].x-j,qe=G[pe].y-q;I.writeVarint(en(de)),I.writeVarint(en(qe)),j+=de,q+=qe}D===3&&I.writeVarint(Ur(7,1))}}function bn(N,I){var P=typeof N;P==="string"?I.writeStringField(1,N):P==="boolean"?I.writeBooleanField(7,N):P==="number"&&(N%1!=0?I.writeDoubleField(3,N):N<0?I.writeSVarintField(6,N):I.writeVarintField(5,N))}xi.exports=yt,xi.exports.fromVectorTileJs=yt,xi.exports.fromGeojsonVt=function(N,I){I=I||{};var P={};for(var D in N)P[D]=new ci(N[D].features,I),P[D].name=D,P[D].version=I.version,P[D].extent=I.extent;return yt({layers:P})},xi.exports.GeoJSONWrapper=ci;var tn=h.getDefaultExportFromCjs(xi.exports);const wn={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:N=>N},Wn=Math.fround||(Nr=new Float32Array(1),N=>(Nr[0]=+N,Nr[0]));var Nr;const vi=3,Gi=5,si=6;class Tn{constructor(I){this.options=Object.assign(Object.create(wn),I),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(I){const{log:P,minZoom:D,maxZoom:j}=this.options;P&&console.time("total time");const q=`prepare ${I.length} points`;P&&console.time(q),this.points=I;const Y=[];for(let G=0;G<I.length;G++){const ee=I[G];if(!ee.geometry)continue;const[ue,pe]=ee.geometry.coordinates,de=Wn(Vr(ue)),qe=Wn(Er(pe));Y.push(de,qe,1/0,G,-1,1),this.options.reduce&&Y.push(0)}let X=this.trees[j+1]=this._createTree(Y);P&&console.timeEnd(q);for(let G=j;G>=D;G--){const ee=+Date.now();X=this.trees[G]=this._createTree(this._cluster(X,G)),P&&console.log("z%d: %d clusters in %dms",G,X.numItems,+Date.now()-ee)}return P&&console.timeEnd("total time"),this}getClusters(I,P){let D=((I[0]+180)%360+360)%360-180;const j=Math.max(-90,Math.min(90,I[1]));let q=I[2]===180?180:((I[2]+180)%360+360)%360-180;const Y=Math.max(-90,Math.min(90,I[3]));if(I[2]-I[0]>=360)D=-180,q=180;else if(D>q){const pe=this.getClusters([D,j,180,Y],P),de=this.getClusters([-180,j,q,Y],P);return pe.concat(de)}const X=this.trees[this._limitZoom(P)],G=X.range(Vr(D),Er(Y),Vr(q),Er(j)),ee=X.data,ue=[];for(const pe of G){const de=this.stride*pe;ue.push(ee[de+Gi]>1?Sn(ee,de,this.clusterProps):this.points[ee[de+vi]])}return ue}getChildren(I){const P=this._getOriginId(I),D=this._getOriginZoom(I),j="No cluster with the specified id.",q=this.trees[D];if(!q)throw new Error(j);const Y=q.data;if(P*this.stride>=Y.length)throw new Error(j);const X=this.options.radius/(this.options.extent*Math.pow(2,D-1)),G=q.within(Y[P*this.stride],Y[P*this.stride+1],X),ee=[];for(const ue of G){const pe=ue*this.stride;Y[pe+4]===I&&ee.push(Y[pe+Gi]>1?Sn(Y,pe,this.clusterProps):this.points[Y[pe+vi]])}if(ee.length===0)throw new Error(j);return ee}getLeaves(I,P,D){const j=[];return this._appendLeaves(j,I,P=P||10,D=D||0,0),j}getTile(I,P,D){const j=this.trees[this._limitZoom(I)],q=Math.pow(2,I),{extent:Y,radius:X}=this.options,G=X/Y,ee=(D-G)/q,ue=(D+1+G)/q,pe={features:[]};return this._addTileFeatures(j.range((P-G)/q,ee,(P+1+G)/q,ue),j.data,P,D,q,pe),P===0&&this._addTileFeatures(j.range(1-G/q,ee,1,ue),j.data,q,D,q,pe),P===q-1&&this._addTileFeatures(j.range(0,ee,G/q,ue),j.data,-1,D,q,pe),pe.features.length?pe:null}getClusterExpansionZoom(I){let P=this._getOriginZoom(I)-1;for(;P<=this.options.maxZoom;){const D=this.getChildren(I);if(P++,D.length!==1)break;I=D[0].properties.cluster_id}return P}_appendLeaves(I,P,D,j,q){const Y=this.getChildren(P);for(const X of Y){const G=X.properties;if(G&&G.cluster?q+G.point_count<=j?q+=G.point_count:q=this._appendLeaves(I,G.cluster_id,D,j,q):q<j?q++:I.push(X),I.length===D)break}return q}_createTree(I){const P=new h.KDBush(I.length/this.stride|0,this.options.nodeSize,Float32Array);for(let D=0;D<I.length;D+=this.stride)P.add(I[D],I[D+1]);return P.finish(),P.data=I,P}_addTileFeatures(I,P,D,j,q,Y){for(const X of I){const G=X*this.stride,ee=P[G+Gi]>1;let ue,pe,de;if(ee)ue=rn(P,G,this.clusterProps),pe=P[G],de=P[G+1];else{const Re=this.points[P[G+vi]];ue=Re.properties;const[Ne,He]=Re.geometry.coordinates;pe=Vr(Ne),de=Er(He)}const qe={type:1,geometry:[[Math.round(this.options.extent*(pe*q-D)),Math.round(this.options.extent*(de*q-j))]],tags:ue};let Ye;Ye=ee||this.options.generateId?P[G+vi]:this.points[P[G+vi]].id,Ye!==void 0&&(qe.id=Ye),Y.features.push(qe)}}_limitZoom(I){return Math.max(this.options.minZoom,Math.min(Math.floor(+I),this.options.maxZoom+1))}_cluster(I,P){const{radius:D,extent:j,reduce:q,minPoints:Y}=this.options,X=D/(j*Math.pow(2,P)),G=I.data,ee=[],ue=this.stride;for(let pe=0;pe<G.length;pe+=ue){if(G[pe+2]<=P)continue;G[pe+2]=P;const de=G[pe],qe=G[pe+1],Ye=I.within(G[pe],G[pe+1],X),Re=G[pe+Gi];let Ne=Re;for(const He of Ye){const lt=He*ue;G[lt+2]>P&&(Ne+=G[lt+Gi])}if(Ne>Re&&Ne>=Y){let He,lt=de*Re,rt=qe*Re,ht=-1;const bt=((pe/ue|0)<<5)+(P+1)+this.points.length;for(const qt of Ye){const We=qt*ue;if(G[We+2]<=P)continue;G[We+2]=P;const zt=G[We+Gi];lt+=G[We]*zt,rt+=G[We+1]*zt,G[We+4]=bt,q&&(He||(He=this._map(G,pe,!0),ht=this.clusterProps.length,this.clusterProps.push(He)),q(He,this._map(G,We)))}G[pe+4]=bt,ee.push(lt/Ne,rt/Ne,1/0,bt,-1,Ne),q&&ee.push(ht)}else{for(let He=0;He<ue;He++)ee.push(G[pe+He]);if(Ne>1)for(const He of Ye){const lt=He*ue;if(!(G[lt+2]<=P)){G[lt+2]=P;for(let rt=0;rt<ue;rt++)ee.push(G[lt+rt])}}}}return ee}_getOriginId(I){return I-this.points.length>>5}_getOriginZoom(I){return(I-this.points.length)%32}_map(I,P,D){if(I[P+Gi]>1){const Y=this.clusterProps[I[P+si]];return D?Object.assign({},Y):Y}const j=this.points[I[P+vi]].properties,q=this.options.map(j);return D&&q===j?Object.assign({},q):q}}function Sn(N,I,P){return{type:"Feature",id:N[I+vi],properties:rn(N,I,P),geometry:{type:"Point",coordinates:[(D=N[I],360*(D-.5)),Ir(N[I+1])]}};var D}function rn(N,I,P){const D=N[I+Gi],j=D>=1e4?`${Math.round(D/1e3)}k`:D>=1e3?Math.round(D/100)/10+"k":D,q=N[I+si],Y=q===-1?{}:Object.assign({},P[q]);return Object.assign(Y,{cluster:!0,cluster_id:N[I+vi],point_count:D,point_count_abbreviated:j})}function Vr(N){return N/360+.5}function Er(N){const I=Math.sin(N*Math.PI/180),P=.5-.25*Math.log((1+I)/(1-I))/Math.PI;return P<0?0:P>1?1:P}function Ir(N){const I=(180-360*N)*Math.PI/180;return 360*Math.atan(Math.exp(I))/Math.PI-90}function Zi(N,I,P,D){for(var j,q=D,Y=P-I>>1,X=P-I,G=N[I],ee=N[I+1],ue=N[P],pe=N[P+1],de=I+3;de<P;de+=3){var qe=En(N[de],N[de+1],G,ee,ue,pe);if(qe>q)j=de,q=qe;else if(qe===q){var Ye=Math.abs(de-Y);Ye<X&&(j=de,X=Ye)}}q>D&&(j-I>3&&Zi(N,I,j,D),N[j+2]=q,P-j>3&&Zi(N,j,P,D))}function En(N,I,P,D,j,q){var Y=j-P,X=q-D;if(Y!==0||X!==0){var G=((N-P)*Y+(I-D)*X)/(Y*Y+X*X);G>1?(P=j,D=q):G>0&&(P+=Y*G,D+=X*G)}return(Y=N-P)*Y+(X=I-D)*X}function oe(N,I,P,D){var j={id:N===void 0?null:N,type:I,geometry:P,tags:D,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(q){var Y=q.geometry,X=q.type;if(X==="Point"||X==="MultiPoint"||X==="LineString")$r(q,Y);else if(X==="Polygon"||X==="MultiLineString")for(var G=0;G<Y.length;G++)$r(q,Y[G]);else if(X==="MultiPolygon")for(G=0;G<Y.length;G++)for(var ee=0;ee<Y[G].length;ee++)$r(q,Y[G][ee])}(j),j}function $r(N,I){for(var P=0;P<I.length;P+=3)N.minX=Math.min(N.minX,I[P]),N.minY=Math.min(N.minY,I[P+1]),N.maxX=Math.max(N.maxX,I[P]),N.maxY=Math.max(N.maxY,I[P+1])}function Hn(N,I,P,D){if(I.geometry){var j=I.geometry.coordinates,q=I.geometry.type,Y=Math.pow(P.tolerance/((1<<P.maxZoom)*P.extent),2),X=[],G=I.id;if(P.promoteId?G=I.properties[P.promoteId]:P.generateId&&(G=D||0),q==="Point")vt(j,X);else if(q==="MultiPoint")for(var ee=0;ee<j.length;ee++)vt(j[ee],X);else if(q==="LineString")ct(j,X,Y,!1);else if(q==="MultiLineString"){if(P.lineMetrics){for(ee=0;ee<j.length;ee++)ct(j[ee],X=[],Y,!1),N.push(oe(G,"LineString",X,I.properties));return}nn(j,X,Y,!1)}else if(q==="Polygon")nn(j,X,Y,!0);else{if(q!=="MultiPolygon"){if(q==="GeometryCollection"){for(ee=0;ee<I.geometry.geometries.length;ee++)Hn(N,{id:G,geometry:I.geometry.geometries[ee],properties:I.properties},P,D);return}throw new Error("Input data is not a valid GeoJSON object.")}for(ee=0;ee<j.length;ee++){var ue=[];nn(j[ee],ue,Y,!0),X.push(ue)}}N.push(oe(G,q,X,I.properties))}}function vt(N,I){I.push(Kn(N[0])),I.push(Ts(N[1])),I.push(0)}function ct(N,I,P,D){for(var j,q,Y=0,X=0;X<N.length;X++){var G=Kn(N[X][0]),ee=Ts(N[X][1]);I.push(G),I.push(ee),I.push(0),X>0&&(Y+=D?(j*ee-G*q)/2:Math.sqrt(Math.pow(G-j,2)+Math.pow(ee-q,2))),j=G,q=ee}var ue=I.length-3;I[2]=1,Zi(I,0,ue,P),I[ue+2]=1,I.size=Math.abs(Y),I.start=0,I.end=I.size}function nn(N,I,P,D){for(var j=0;j<N.length;j++){var q=[];ct(N[j],q,P,D),I.push(q)}}function Kn(N){return N/360+.5}function Ts(N){var I=Math.sin(N*Math.PI/180),P=.5-.25*Math.log((1+I)/(1-I))/Math.PI;return P<0?0:P>1?1:P}function jt(N,I,P,D,j,q,Y,X){if(D/=I,q>=(P/=I)&&Y<D)return N;if(Y<P||q>=D)return null;for(var G=[],ee=0;ee<N.length;ee++){var ue=N[ee],pe=ue.geometry,de=ue.type,qe=j===0?ue.minX:ue.minY,Ye=j===0?ue.maxX:ue.maxY;if(qe>=P&&Ye<D)G.push(ue);else if(!(Ye<P||qe>=D)){var Re=[];if(de==="Point"||de==="MultiPoint")sn(pe,Re,P,D,j);else if(de==="LineString")In(pe,Re,P,D,j,!1,X.lineMetrics);else if(de==="MultiLineString")we(pe,Re,P,D,j,!1);else if(de==="Polygon")we(pe,Re,P,D,j,!0);else if(de==="MultiPolygon")for(var Ne=0;Ne<pe.length;Ne++){var He=[];we(pe[Ne],He,P,D,j,!0),He.length&&Re.push(He)}if(Re.length){if(X.lineMetrics&&de==="LineString"){for(Ne=0;Ne<Re.length;Ne++)G.push(oe(ue.id,de,Re[Ne],ue.tags));continue}de!=="LineString"&&de!=="MultiLineString"||(Re.length===1?(de="LineString",Re=Re[0]):de="MultiLineString"),de!=="Point"&&de!=="MultiPoint"||(de=Re.length===3?"Point":"MultiPoint"),G.push(oe(ue.id,de,Re,ue.tags))}}}return G.length?G:null}function sn(N,I,P,D,j){for(var q=0;q<N.length;q+=3){var Y=N[q+j];Y>=P&&Y<=D&&(I.push(N[q]),I.push(N[q+1]),I.push(N[q+2]))}}function In(N,I,P,D,j,q,Y){for(var X,G,ee=an(N),ue=j===0?hi:An,pe=N.start,de=0;de<N.length-3;de+=3){var qe=N[de],Ye=N[de+1],Re=N[de+2],Ne=N[de+3],He=N[de+4],lt=j===0?qe:Ye,rt=j===0?Ne:He,ht=!1;Y&&(X=Math.sqrt(Math.pow(qe-Ne,2)+Math.pow(Ye-He,2))),lt<P?rt>P&&(G=ue(ee,qe,Ye,Ne,He,P),Y&&(ee.start=pe+X*G)):lt>D?rt<D&&(G=ue(ee,qe,Ye,Ne,He,D),Y&&(ee.start=pe+X*G)):ur(ee,qe,Ye,Re),rt<P&&lt>=P&&(G=ue(ee,qe,Ye,Ne,He,P),ht=!0),rt>D&&lt<=D&&(G=ue(ee,qe,Ye,Ne,He,D),ht=!0),!q&&ht&&(Y&&(ee.end=pe+X*G),I.push(ee),ee=an(N)),Y&&(pe+=X)}var bt=N.length-3;qe=N[bt],Ye=N[bt+1],Re=N[bt+2],(lt=j===0?qe:Ye)>=P&&lt<=D&&ur(ee,qe,Ye,Re),bt=ee.length-3,q&&bt>=3&&(ee[bt]!==ee[0]||ee[bt+1]!==ee[1])&&ur(ee,ee[0],ee[1],ee[2]),ee.length&&I.push(ee)}function an(N){var I=[];return I.size=N.size,I.start=N.start,I.end=N.end,I}function we(N,I,P,D,j,q){for(var Y=0;Y<N.length;Y++)In(N[Y],I,P,D,j,q,!1)}function ur(N,I,P,D){N.push(I),N.push(P),N.push(D)}function hi(N,I,P,D,j,q){var Y=(q-I)/(D-I);return N.push(q),N.push(P+(j-P)*Y),N.push(1),Y}function An(N,I,P,D,j,q){var Y=(q-P)/(j-P);return N.push(I+(D-I)*Y),N.push(q),N.push(1),Y}function jr(N,I){for(var P=[],D=0;D<N.length;D++){var j,q=N[D],Y=q.type;if(Y==="Point"||Y==="MultiPoint"||Y==="LineString")j=be(q.geometry,I);else if(Y==="MultiLineString"||Y==="Polygon"){j=[];for(var X=0;X<q.geometry.length;X++)j.push(be(q.geometry[X],I))}else if(Y==="MultiPolygon")for(j=[],X=0;X<q.geometry.length;X++){for(var G=[],ee=0;ee<q.geometry[X].length;ee++)G.push(be(q.geometry[X][ee],I));j.push(G)}P.push(oe(q.id,Y,j,q.tags))}return P}function be(N,I){var P=[];P.size=N.size,N.start!==void 0&&(P.start=N.start,P.end=N.end);for(var D=0;D<N.length;D+=3)P.push(N[D]+I,N[D+1],N[D+2]);return P}function it(N,I){if(N.transformed)return N;var P,D,j,q=1<<N.z,Y=N.x,X=N.y;for(P=0;P<N.features.length;P++){var G=N.features[P],ee=G.geometry,ue=G.type;if(G.geometry=[],ue===1)for(D=0;D<ee.length;D+=2)G.geometry.push(et(ee[D],ee[D+1],I,q,Y,X));else for(D=0;D<ee.length;D++){var pe=[];for(j=0;j<ee[D].length;j+=2)pe.push(et(ee[D][j],ee[D][j+1],I,q,Y,X));G.geometry.push(pe)}}return N.transformed=!0,N}function et(N,I,P,D,j,q){return[Math.round(P*(N*D-j)),Math.round(P*(I*D-q))]}function Ai(N,I,P,D,j){for(var q=I===j.maxZoom?0:j.tolerance/((1<<I)*j.extent),Y={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:P,y:D,z:I,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},X=0;X<N.length;X++){Y.numFeatures++,Kt(Y,N[X],q,j);var G=N[X].minX,ee=N[X].minY,ue=N[X].maxX,pe=N[X].maxY;G<Y.minX&&(Y.minX=G),ee<Y.minY&&(Y.minY=ee),ue>Y.maxX&&(Y.maxX=ue),pe>Y.maxY&&(Y.maxY=pe)}return Y}function Kt(N,I,P,D){var j=I.geometry,q=I.type,Y=[];if(q==="Point"||q==="MultiPoint")for(var X=0;X<j.length;X+=3)Y.push(j[X]),Y.push(j[X+1]),N.numPoints++,N.numSimplified++;else if(q==="LineString")Je(Y,j,N,P,!1,!1);else if(q==="MultiLineString"||q==="Polygon")for(X=0;X<j.length;X++)Je(Y,j[X],N,P,q==="Polygon",X===0);else if(q==="MultiPolygon")for(var G=0;G<j.length;G++){var ee=j[G];for(X=0;X<ee.length;X++)Je(Y,ee[X],N,P,!0,X===0)}if(Y.length){var ue=I.tags||null;if(q==="LineString"&&D.lineMetrics){for(var pe in ue={},I.tags)ue[pe]=I.tags[pe];ue.mapbox_clip_start=j.start/j.size,ue.mapbox_clip_end=j.end/j.size}var de={geometry:Y,type:q==="Polygon"||q==="MultiPolygon"?3:q==="LineString"||q==="MultiLineString"?2:1,tags:ue};I.id!==null&&(de.id=I.id),N.features.push(de)}}function Je(N,I,P,D,j,q){var Y=D*D;if(D>0&&I.size<(j?Y:D))P.numPoints+=I.length/3;else{for(var X=[],G=0;G<I.length;G+=3)(D===0||I[G+2]>Y)&&(P.numSimplified++,X.push(I[G]),X.push(I[G+1])),P.numPoints++;j&&function(ee,ue){for(var pe=0,de=0,qe=ee.length,Ye=qe-2;de<qe;Ye=de,de+=2)pe+=(ee[de]-ee[Ye])*(ee[de+1]+ee[Ye+1]);if(pe>0===ue)for(de=0,qe=ee.length;de<qe/2;de+=2){var Re=ee[de],Ne=ee[de+1];ee[de]=ee[qe-2-de],ee[de+1]=ee[qe-1-de],ee[qe-2-de]=Re,ee[qe-1-de]=Ne}}(X,q),N.push(X)}}function Ar(N,I){var P=(I=this.options=function(j,q){for(var Y in q)j[Y]=q[Y];return j}(Object.create(this.options),I)).debug;if(P&&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.");var D=function(j,q){var Y=[];if(j.type==="FeatureCollection")for(var X=0;X<j.features.length;X++)Hn(Y,j.features[X],q,X);else Hn(Y,j.type==="Feature"?j:{geometry:j},q);return Y}(N,I);this.tiles={},this.tileCoords=[],P&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",I.indexMaxZoom,I.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),D=function(j,q){var Y=q.buffer/q.extent,X=j,G=jt(j,1,-1-Y,Y,0,-1,2,q),ee=jt(j,1,1-Y,2+Y,0,-1,2,q);return(G||ee)&&(X=jt(j,1,-Y,1+Y,0,-1,2,q)||[],G&&(X=jr(G,1).concat(X)),ee&&(X=X.concat(jr(ee,-1)))),X}(D,I),D.length&&this.splitTile(D,0,0,0),P&&(D.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}function Cr(N,I,P){return 32*((1<<N)*P+I)+N}function er(N,I){return I?N.properties[I]:N.id}function Pr(N,I){if(N==null)return!0;if(N.type==="Feature")return er(N,I)!=null;if(N.type==="FeatureCollection"){const P=new Set;for(const D of N.features){const j=er(D,I);if(j==null||P.has(j))return!1;P.add(j)}return!0}return!1}function ai(N,I){const P=new Map;if(N!=null)if(N.type==="Feature")P.set(er(N,I),N);else for(const D of N.features)P.set(er(D,I),D);return P}function Tt(N,I){const P=N.tileID.canonical;if(!this._geoJSONIndex)return I(null,null);const D=this._geoJSONIndex.getTile(P.z,P.x,P.y);if(!D)return I(null,null);const j=new class{constructor(Y){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=h.EXTENT,this.length=Y.length,this._features=Y}feature(Y){return new class{constructor(X){this._feature=X,this.extent=h.EXTENT,this.type=X.type,this.properties=X.tags,"id"in X&&!isNaN(X.id)&&(this.id=parseInt(X.id,10))}loadGeometry(){if(this._feature.type===1){const X=[];for(const G of this._feature.geometry)X.push([new h.Point(G[0],G[1])]);return X}{const X=[];for(const G of this._feature.geometry){const ee=[];for(const ue of G)ee.push(new h.Point(ue[0],ue[1]));X.push(ee)}return X}}toGeoJSON(X,G,ee){return hr.call(this,X,G,ee)}}(this._features[Y])}}(D.features);let q=tn(j);q.byteOffset===0&&q.byteLength===q.buffer.byteLength||(q=new Uint8Array(q)),I(null,{vectorTile:j,rawData:q.buffer})}Ar.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},Ar.prototype.splitTile=function(N,I,P,D,j,q,Y){for(var X=[N,I,P,D],G=this.options,ee=G.debug;X.length;){D=X.pop(),P=X.pop(),I=X.pop(),N=X.pop();var ue=1<<I,pe=Cr(I,P,D),de=this.tiles[pe];if(!de&&(ee>1&&console.time("creation"),de=this.tiles[pe]=Ai(N,I,P,D,G),this.tileCoords.push({z:I,x:P,y:D}),ee)){ee>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",I,P,D,de.numFeatures,de.numPoints,de.numSimplified),console.timeEnd("creation"));var qe="z"+I;this.stats[qe]=(this.stats[qe]||0)+1,this.total++}if(de.source=N,j){if(I===G.maxZoom||I===j)continue;var Ye=1<<j-I;if(P!==Math.floor(q/Ye)||D!==Math.floor(Y/Ye))continue}else if(I===G.indexMaxZoom||de.numPoints<=G.indexMaxPoints)continue;if(de.source=null,N.length!==0){ee>1&&console.time("clipping");var Re,Ne,He,lt,rt,ht,bt=.5*G.buffer/G.extent,qt=.5-bt,We=.5+bt,zt=1+bt;Re=Ne=He=lt=null,rt=jt(N,ue,P-bt,P+We,0,de.minX,de.maxX,G),ht=jt(N,ue,P+qt,P+zt,0,de.minX,de.maxX,G),N=null,rt&&(Re=jt(rt,ue,D-bt,D+We,1,de.minY,de.maxY,G),Ne=jt(rt,ue,D+qt,D+zt,1,de.minY,de.maxY,G),rt=null),ht&&(He=jt(ht,ue,D-bt,D+We,1,de.minY,de.maxY,G),lt=jt(ht,ue,D+qt,D+zt,1,de.minY,de.maxY,G),ht=null),ee>1&&console.timeEnd("clipping"),X.push(Re||[],I+1,2*P,2*D),X.push(Ne||[],I+1,2*P,2*D+1),X.push(He||[],I+1,2*P+1,2*D),X.push(lt||[],I+1,2*P+1,2*D+1)}}},Ar.prototype.getTile=function(N,I,P){var D=this.options,j=D.extent,q=D.debug;if(N<0||N>24)return null;var Y=1<<N,X=Cr(N,I=(I%Y+Y)%Y,P);if(this.tiles[X])return it(this.tiles[X],j);q>1&&console.log("drilling down to z%d-%d-%d",N,I,P);for(var G,ee=N,ue=I,pe=P;!G&&ee>0;)ee--,ue=Math.floor(ue/2),pe=Math.floor(pe/2),G=this.tiles[Cr(ee,ue,pe)];return G&&G.source?(q>1&&console.log("found parent tile z%d-%d-%d",ee,ue,pe),q>1&&console.time("drilling down"),this.splitTile(G.source,ee,ue,pe,N,I,P),q>1&&console.timeEnd("drilling down"),this.tiles[X]?it(this.tiles[X],j):null):null};class Yn extends Xe{constructor(I,P,D,j){super(I,P,D,Tt),this._dataUpdateable=new Map,this.loadGeoJSON=(q,Y)=>{const{promoteId:X}=q;if(q.request)return h.getJSON(q.request,(G,ee,ue,pe)=>{this._dataUpdateable=Pr(ee,X)?ai(ee,X):void 0,Y(G,ee,ue,pe)});if(typeof q.data=="string")try{const G=JSON.parse(q.data);this._dataUpdateable=Pr(G,X)?ai(G,X):void 0,Y(null,G)}catch{Y(new Error(`Input data given to '${q.source}' is not a valid GeoJSON object.`))}else q.dataDiff?this._dataUpdateable?(function(G,ee,ue){var pe,de,qe,Ye;if(ee.removeAll&&G.clear(),ee.remove)for(const Re of ee.remove)G.delete(Re);if(ee.add)for(const Re of ee.add){const Ne=er(Re,ue);Ne!=null&&G.set(Ne,Re)}if(ee.update)for(const Re of ee.update){let Ne=G.get(Re.id);if(Ne==null)continue;const He=!Re.removeAllProperties&&(((pe=Re.removeProperties)===null||pe===void 0?void 0:pe.length)>0||((de=Re.addOrUpdateProperties)===null||de===void 0?void 0:de.length)>0);if((Re.newGeometry||Re.removeAllProperties||He)&&(Ne={...Ne},G.set(Re.id,Ne),He&&(Ne.properties={...Ne.properties})),Re.newGeometry&&(Ne.geometry=Re.newGeometry),Re.removeAllProperties)Ne.properties={};else if(((qe=Re.removeProperties)===null||qe===void 0?void 0:qe.length)>0)for(const lt of Re.removeProperties)Object.prototype.hasOwnProperty.call(Ne.properties,lt)&&delete Ne.properties[lt];if(((Ye=Re.addOrUpdateProperties)===null||Ye===void 0?void 0:Ye.length)>0)for(const{key:lt,value:rt}of Re.addOrUpdateProperties)Ne.properties[lt]=rt}}(this._dataUpdateable,q.dataDiff,X),Y(null,{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())})):Y(new Error(`Cannot update existing geojson data in ${q.source}`)):Y(new Error(`Input data given to '${q.source}' is not a valid GeoJSON object.`));return{cancel:()=>{}}},j&&(this.loadGeoJSON=j)}loadData(I,P){var D;(D=this._pendingRequest)===null||D===void 0||D.cancel(),this._pendingCallback&&this._pendingCallback(null,{abandoned:!0});const j=!!(I&&I.request&&I.request.collectResourceTiming)&&new h.RequestPerformance(I.request);this._pendingCallback=P,this._pendingRequest=this.loadGeoJSON(I,(q,Y)=>{if(delete this._pendingCallback,delete this._pendingRequest,q||!Y)return P(q);if(typeof Y!="object")return P(new Error(`Input data given to '${I.source}' is not a valid GeoJSON object.`));{Ct(Y,!0);try{if(I.filter){const G=h.createExpression(I.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(G.result==="error")throw new Error(G.value.map(ue=>`${ue.key}: ${ue.message}`).join(", "));Y={type:"FeatureCollection",features:Y.features.filter(ue=>G.value.evaluate({zoom:0},ue))}}this._geoJSONIndex=I.cluster?new Tn(function({superclusterOptions:G,clusterProperties:ee}){if(!ee||!G)return G;const ue={},pe={},de={accumulated:null,zoom:0},qe={properties:null},Ye=Object.keys(ee);for(const Re of Ye){const[Ne,He]=ee[Re],lt=h.createExpression(He),rt=h.createExpression(typeof Ne=="string"?[Ne,["accumulated"],["get",Re]]:Ne);ue[Re]=lt.value,pe[Re]=rt.value}return G.map=Re=>{qe.properties=Re;const Ne={};for(const He of Ye)Ne[He]=ue[He].evaluate(de,qe);return Ne},G.reduce=(Re,Ne)=>{qe.properties=Ne;for(const He of Ye)de.accumulated=Re[He],Re[He]=pe[He].evaluate(de,qe)},G}(I)).load(Y.features):function(G,ee){return new Ar(G,ee)}(Y,I.geojsonVtOptions)}catch(G){return P(G)}this.loaded={};const X={};if(j){const G=j.finish();G&&(X.resourceTiming={},X.resourceTiming[I.source]=JSON.parse(JSON.stringify(G)))}P(null,X)}})}reloadTile(I,P){const D=this.loaded;return D&&D[I.uid]?super.reloadTile(I,P):this.loadTile(I,P)}removeSource(I,P){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),P()}getClusterExpansionZoom(I,P){try{P(null,this._geoJSONIndex.getClusterExpansionZoom(I.clusterId))}catch(D){P(D)}}getClusterChildren(I,P){try{P(null,this._geoJSONIndex.getChildren(I.clusterId))}catch(D){P(D)}}getClusterLeaves(I,P){try{P(null,this._geoJSONIndex.getLeaves(I.clusterId,I.limit,I.offset))}catch(D){P(D)}}}class dr{constructor(I){this.self=I,this.actor=new h.Actor(I,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:Xe,geojson:Yn},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(P,D)=>{if(this.workerSourceTypes[P])throw new Error(`Worker source with name "${P}" already registered.`);this.workerSourceTypes[P]=D},this.self.registerRTLTextPlugin=P=>{if(h.plugin.isParsed())throw new Error("RTL text plugin already registered.");h.plugin.applyArabicShaping=P.applyArabicShaping,h.plugin.processBidirectionalText=P.processBidirectionalText,h.plugin.processStyledBidirectionalText=P.processStyledBidirectionalText}}setReferrer(I,P){this.referrer=P}setImages(I,P,D){this.availableImages[I]=P;for(const j in this.workerSources[I]){const q=this.workerSources[I][j];for(const Y in q)q[Y].availableImages=P}D()}setLayers(I,P,D){this.getLayerIndex(I).replace(P),D()}updateLayers(I,P,D){this.getLayerIndex(I).update(P.layers,P.removedIds),D()}loadTile(I,P,D){this.getWorkerSource(I,P.type,P.source).loadTile(P,D)}loadDEMTile(I,P,D){this.getDEMWorkerSource(I,P.source).loadTile(P,D)}reloadTile(I,P,D){this.getWorkerSource(I,P.type,P.source).reloadTile(P,D)}abortTile(I,P,D){this.getWorkerSource(I,P.type,P.source).abortTile(P,D)}removeTile(I,P,D){this.getWorkerSource(I,P.type,P.source).removeTile(P,D)}removeDEMTile(I,P){this.getDEMWorkerSource(I,P.source).removeTile(P)}removeSource(I,P,D){if(!this.workerSources[I]||!this.workerSources[I][P.type]||!this.workerSources[I][P.type][P.source])return;const j=this.workerSources[I][P.type][P.source];delete this.workerSources[I][P.type][P.source],j.removeSource!==void 0?j.removeSource(P,D):D()}loadWorkerSource(I,P,D){try{this.self.importScripts(P.url),D()}catch(j){D(j.toString())}}syncRTLPluginState(I,P,D){try{h.plugin.setState(P);const j=h.plugin.getPluginURL();if(h.plugin.isLoaded()&&!h.plugin.isParsed()&&j!=null){this.self.importScripts(j);const q=h.plugin.isParsed();D(q?void 0:new Error(`RTL Text Plugin failed to import scripts from ${j}`),q)}}catch(j){D(j.toString())}}getAvailableImages(I){let P=this.availableImages[I];return P||(P=[]),P}getLayerIndex(I){let P=this.layerIndexes[I];return P||(P=this.layerIndexes[I]=new me),P}getWorkerSource(I,P,D){if(this.workerSources[I]||(this.workerSources[I]={}),this.workerSources[I][P]||(this.workerSources[I][P]={}),!this.workerSources[I][P][D]){const j={send:(q,Y,X)=>{this.actor.send(q,Y,X,I)}};this.workerSources[I][P][D]=new this.workerSourceTypes[P](j,this.getLayerIndex(I),this.getAvailableImages(I))}return this.workerSources[I][P][D]}getDEMWorkerSource(I,P){return this.demWorkerSources[I]||(this.demWorkerSources[I]={}),this.demWorkerSources[I][P]||(this.demWorkerSources[I][P]=new je),this.demWorkerSources[I][P]}}return h.isWorker()&&(self.worker=new dr(self)),dr}),he(["./shared"],function(h){var me="3.1.0";class J{static testProp(t){if(!J.docStyle)return t[0];for(let n=0;n<t.length;n++)if(t[n]in J.docStyle)return t[n];return t[0]}static create(t,n,a){const c=window.document.createElement(t);return n!==void 0&&(c.className=n),a&&a.appendChild(c),c}static createNS(t,n){return window.document.createElementNS(t,n)}static disableDrag(){J.docStyle&&J.selectProp&&(J.userSelect=J.docStyle[J.selectProp],J.docStyle[J.selectProp]="none")}static enableDrag(){J.docStyle&&J.selectProp&&(J.docStyle[J.selectProp]=J.userSelect)}static setTransform(t,n){t.style[J.transformProp]=n}static addEventListener(t,n,a,c={}){t.addEventListener(n,a,"passive"in c?c:c.capture)}static removeEventListener(t,n,a,c={}){t.removeEventListener(n,a,"passive"in c?c:c.capture)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",J.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",J.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",J.suppressClickInternal,!0)},0)}static mousePos(t,n){const a=t.getBoundingClientRect();return new h.Point(n.clientX-a.left-t.clientLeft,n.clientY-a.top-t.clientTop)}static touchPos(t,n){const a=t.getBoundingClientRect(),c=[];for(let p=0;p<n.length;p++)c.push(new h.Point(n[p].clientX-a.left-t.clientLeft,n[p].clientY-a.top-t.clientTop));return c}static mouseButton(t){return t.button}static remove(t){t.parentNode&&t.parentNode.removeChild(t)}}J.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,J.selectProp=J.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),J.transformProp=J.testProp(["transform","WebkitTransform"]);const Ke={supported:!1,testSupport:function(o){!Xe&&Ee&&(je?kt(o):ve=o)}};let ve,Ee,Xe=!1,je=!1;function kt(o){const t=o.createTexture();o.bindTexture(o.TEXTURE_2D,t);try{if(o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,Ee),o.isContextLost())return;Ke.supported=!0}catch{}o.deleteTexture(t),Xe=!0}var Dt;typeof document<"u"&&(Ee=document.createElement("img"),Ee.onload=function(){ve&&kt(ve),ve=null,je=!0},Ee.onerror=function(){Xe=!0,ve=null},Ee.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(o){let t,n,a,c;o.resetRequestQueue=()=>{t=[],n=0,a=0,c={}},o.addThrottleControl=v=>{const S=a++;return c[S]=v,S},o.removeThrottleControl=v=>{delete c[v],y()},o.getImage=(v,S,T=!0)=>{Ke.supported&&(v.headers||(v.headers={}),v.headers.accept="image/webp,*/*");const L={requestParameters:v,supportImageRefresh:T,callback:S,cancelled:!1,completed:!1,cancel:()=>{L.completed||L.cancelled||(L.cancelled=!0,L.innerRequest&&(L.innerRequest.cancel(),n--),y())}};return t.push(L),y(),L};const p=v=>{const{requestParameters:S,supportImageRefresh:T,callback:L}=v;return h.extend(S,{type:"image"}),(T!==!1||h.isWorker()||h.getProtocolAction(S.url)||S.headers&&!Object.keys(S.headers).reduce((O,R)=>O&&R==="accept",!0)?h.makeRequest:_)(S,(O,R,B,$)=>{m(v,L,O,R,B,$)})},m=(v,S,T,L,O,R)=>{T?S(T):L instanceof HTMLImageElement||L instanceof ImageBitmap?S(null,L):L&&((B,$)=>{typeof createImageBitmap=="function"?h.arrayBufferToImageBitmap(B,$):h.arrayBufferToImage(B,$)})(L,(B,$)=>{B!=null?S(B):$!=null&&S(null,$,{cacheControl:O,expires:R})}),v.cancelled||(v.completed=!0,n--,y())},y=()=>{const v=(()=>{const S=Object.keys(c);let T=!1;if(S.length>0){for(const L of S)if(T=c[L](),T)break}return T})()?h.config.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:h.config.MAX_PARALLEL_IMAGE_REQUESTS;for(let S=n;S<v&&t.length>0;S++){const T=t.shift();if(T.cancelled){S--;continue}const L=p(T);n++,T.innerRequest=L}},_=(v,S)=>{const T=new Image,L=v.url;let O=!1;const R=v.credentials;return R&&R==="include"?T.crossOrigin="use-credentials":(R&&R==="same-origin"||!h.sameOrigin(L))&&(T.crossOrigin="anonymous"),T.fetchPriority="high",T.onload=()=>{S(null,T),T.onerror=T.onload=null},T.onerror=()=>{O||S(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.")),T.onerror=T.onload=null},T.src=L,{cancel:()=>{O=!0,T.src=""}}}}(Dt||(Dt={})),Dt.resetRequestQueue();var Ct,hr=Dt;(function(o){o.Glyphs="Glyphs",o.Image="Image",o.Source="Source",o.SpriteImage="SpriteImage",o.SpriteJSON="SpriteJSON",o.Style="Style",o.Tile="Tile",o.Unknown="Unknown"})(Ct||(Ct={}));class xi{constructor(t){this._transformRequestFn=t}transformRequest(t,n){return this._transformRequestFn&&this._transformRequestFn(t,n)||{url:t}}normalizeSpriteURL(t,n,a){const c=function(p){const m=p.match(Ta);if(!m)throw new Error(`Unable to parse URL "${p}"`);return{protocol:m[1],authority:m[2],path:m[3]||"/",params:m[4]?m[4].split("&"):[]}}(t);return c.path+=`${n}${a}`,function(p){const m=p.params.length?`?${p.params.join("&")}`:"";return`${p.protocol}://${p.authority}${p.path}${m}`}(c)}setTransformRequest(t){this._transformRequestFn=t}}const Ta=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function Xn(o){var t=new h.ARRAY_TYPE(3);return t[0]=o[0],t[1]=o[1],t[2]=o[2],t}var Or,vn=function(o,t,n){return o[0]=t[0]-n[0],o[1]=t[1]-n[1],o[2]=t[2]-n[2],o};Or=new h.ARRAY_TYPE(3),h.ARRAY_TYPE!=Float32Array&&(Or[0]=0,Or[1]=0,Or[2]=0);var Ii=function(o){var t=o[0],n=o[1];return t*t+n*n};function Qr(o){const t=[];if(typeof o=="string")t.push({id:"default",url:o});else if(o&&o.length>0){const n=[];for(const{id:a,url:c}of o){const p=`${a}${c}`;n.indexOf(p)===-1&&(n.push(p),t.push({id:a,url:c}))}}return t}function ci(o,t,n,a,c){if(a)return void o(a);if(c!==Object.values(t).length||c!==Object.values(n).length)return;const p={};for(const m in t){p[m]={};const y=h.exported.getImageCanvasContext(n[m]),_=t[m];for(const v in _){const{width:S,height:T,x:L,y:O,sdf:R,pixelRatio:B,stretchX:$,stretchY:W,content:ne}=_[v];p[m][v]={data:null,pixelRatio:B,sdf:R,stretchX:$,stretchY:W,content:ne,spriteData:{width:S,height:T,x:L,y:O,context:y}}}}o(null,p)}(function(){var o=new h.ARRAY_TYPE(2);h.ARRAY_TYPE!=Float32Array&&(o[0]=0,o[1]=0)})();class yt{constructor(t,n,a,c){this.context=t,this.format=a,this.texture=t.gl.createTexture(),this.update(n,c)}update(t,n,a){const{width:c,height:p}=t,m=!(this.size&&this.size[0]===c&&this.size[1]===p||a),{context:y}=this,{gl:_}=y;if(this.useMipmap=!!(n&&n.useMipmap),_.bindTexture(_.TEXTURE_2D,this.texture),y.pixelStoreUnpackFlipY.set(!1),y.pixelStoreUnpack.set(1),y.pixelStoreUnpackPremultiplyAlpha.set(this.format===_.RGBA&&(!n||n.premultiply!==!1)),m)this.size=[c,p],t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||h.isImageBitmap(t)?_.texImage2D(_.TEXTURE_2D,0,this.format,this.format,_.UNSIGNED_BYTE,t):_.texImage2D(_.TEXTURE_2D,0,this.format,c,p,0,this.format,_.UNSIGNED_BYTE,t.data);else{const{x:v,y:S}=a||{x:0,y:0};t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||h.isImageBitmap(t)?_.texSubImage2D(_.TEXTURE_2D,0,v,S,_.RGBA,_.UNSIGNED_BYTE,t):_.texSubImage2D(_.TEXTURE_2D,0,v,S,c,p,_.RGBA,_.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&_.generateMipmap(_.TEXTURE_2D)}bind(t,n,a){const{context:c}=this,{gl:p}=c;p.bindTexture(p.TEXTURE_2D,this.texture),a!==p.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(a=p.LINEAR),t!==this.filter&&(p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MAG_FILTER,t),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MIN_FILTER,a||t),this.filter=t),n!==this.wrap&&(p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_S,n),p.texParameteri(p.TEXTURE_2D,p.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(){const{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null}}function Sa(o){const{userImage:t}=o;return!!(t&&t.render&&t.render())&&(o.data.replace(new Uint8Array(t.data.buffer)),!0)}class qi extends h.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new h.RGBAImage({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(const{ids:n,callback:a}of this.requestors)this._notify(n,a);this.requestors=[]}}getImage(t){const n=this.images[t];if(n&&!n.data&&n.spriteData){const a=n.spriteData;n.data=new h.RGBAImage({width:a.width,height:a.height},a.context.getImageData(a.x,a.y,a.width,a.height).data),n.spriteData=null}return n}addImage(t,n){if(this.images[t])throw new Error(`Image id ${t} already exist, use updateImage instead`);this._validate(t,n)&&(this.images[t]=n)}_validate(t,n){let a=!0;const c=n.data||n.spriteData;return this._validateStretch(n.stretchX,c&&c.width)||(this.fire(new h.ErrorEvent(new Error(`Image "${t}" has invalid "stretchX" value`))),a=!1),this._validateStretch(n.stretchY,c&&c.height)||(this.fire(new h.ErrorEvent(new Error(`Image "${t}" has invalid "stretchY" value`))),a=!1),this._validateContent(n.content,n)||(this.fire(new h.ErrorEvent(new Error(`Image "${t}" has invalid "content" value`))),a=!1),a}_validateStretch(t,n){if(!t)return!0;let a=0;for(const c of t){if(c[0]<a||c[1]<c[0]||n<c[1])return!1;a=c[1]}return!0}_validateContent(t,n){if(!t)return!0;if(t.length!==4)return!1;const a=n.spriteData,c=a&&a.width||n.data.width,p=a&&a.height||n.data.height;return!(t[0]<0||c<t[0]||t[1]<0||p<t[1]||t[2]<0||c<t[2]||t[3]<0||p<t[3]||t[2]<t[0]||t[3]<t[1])}updateImage(t,n,a=!0){const c=this.getImage(t);if(a&&(c.data.width!==n.data.width||c.data.height!==n.data.height))throw new Error(`size mismatch between old image (${c.data.width}x${c.data.height}) and new image (${n.data.width}x${n.data.height}).`);n.version=c.version+1,this.images[t]=n,this.updatedImages[t]=!0}removeImage(t){const n=this.images[t];delete this.images[t],delete this.patterns[t],n.userImage&&n.userImage.onRemove&&n.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(t,n){let a=!0;if(!this.isLoaded())for(const c of t)this.images[c]||(a=!1);this.isLoaded()||a?this._notify(t,n):this.requestors.push({ids:t,callback:n})}_notify(t,n){const a={};for(const c of t){let p=this.getImage(c);p||(this.fire(new h.Event("styleimagemissing",{id:c})),p=this.getImage(c)),p?a[c]={data:p.data.clone(),pixelRatio:p.pixelRatio,sdf:p.sdf,version:p.version,stretchX:p.stretchX,stretchY:p.stretchY,content:p.content,hasRenderCallback:!!(p.userImage&&p.userImage.render)}:h.warnOnce(`Image "${c}" 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.`)}n(null,a)}getPixelSize(){const{width:t,height:n}=this.atlasImage;return{width:t,height:n}}getPattern(t){const n=this.patterns[t],a=this.getImage(t);if(!a)return null;if(n&&n.position.version===a.version)return n.position;if(n)n.position.version=a.version;else{const c={w:a.data.width+2,h:a.data.height+2,x:0,y:0},p=new h.ImagePosition(c,a);this.patterns[t]={bin:c,position:p}}return this._updatePatternAtlas(),this.patterns[t].position}bind(t){const n=t.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new yt(t,this.atlasImage,n.RGBA),this.atlasTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}_updatePatternAtlas(){const t=[];for(const p in this.patterns)t.push(this.patterns[p].bin);const{w:n,h:a}=h.potpack(t),c=this.atlasImage;c.resize({width:n||1,height:a||1});for(const p in this.patterns){const{bin:m}=this.patterns[p],y=m.x+1,_=m.y+1,v=this.getImage(p).data,S=v.width,T=v.height;h.RGBAImage.copy(v,c,{x:0,y:0},{x:y,y:_},{width:S,height:T}),h.RGBAImage.copy(v,c,{x:0,y:T-1},{x:y,y:_-1},{width:S,height:1}),h.RGBAImage.copy(v,c,{x:0,y:0},{x:y,y:_+T},{width:S,height:1}),h.RGBAImage.copy(v,c,{x:S-1,y:0},{x:y-1,y:_},{width:1,height:T}),h.RGBAImage.copy(v,c,{x:0,y:0},{x:y+S,y:_},{width:1,height:T})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(t){for(const n of t){if(this.callbackDispatchedThisFrame[n])continue;this.callbackDispatchedThisFrame[n]=!0;const a=this.getImage(n);a||h.warnOnce(`Image with ID: "${n}" was not found`),Sa(a)&&this.updateImage(n,a)}}}const Tr=1e20;function Ur(o,t,n,a,c,p,m,y,_){for(let v=t;v<t+a;v++)en(o,n*p+v,p,c,m,y,_);for(let v=n;v<n+c;v++)en(o,v*p+t,1,a,m,y,_)}function en(o,t,n,a,c,p,m){p[0]=0,m[0]=-Tr,m[1]=Tr,c[0]=o[t];for(let y=1,_=0,v=0;y<a;y++){c[y]=o[t+y*n];const S=y*y;do{const T=p[_];v=(c[y]-c[T]+S-T*T)/(y-T)/2}while(v<=m[_]&&--_>-1);_++,p[_]=y,m[_]=v,m[_+1]=Tr}for(let y=0,_=0;y<a;y++){for(;m[_+1]<y;)_++;const v=p[_],S=y-v;o[t+y*n]=c[v]+S*S}}class Sr{constructor(t,n){this.requestManager=t,this.localIdeographFontFamily=n,this.entries={}}setURL(t){this.url=t}getGlyphs(t,n){const a=[];for(const c in t)for(const p of t[c])a.push({stack:c,id:p});h.asyncAll(a,({stack:c,id:p},m)=>{let y=this.entries[c];y||(y=this.entries[c]={glyphs:{},requests:{},ranges:{}});let _=y.glyphs[p];if(_!==void 0)return void m(null,{stack:c,id:p,glyph:_});if(_=this._tinySDF(y,c,p),_)return y.glyphs[p]=_,void m(null,{stack:c,id:p,glyph:_});const v=Math.floor(p/256);if(256*v>65535)return void m(new Error("glyphs > 65535 not supported"));if(y.ranges[v])return void m(null,{stack:c,id:p,glyph:_});if(!this.url)return void m(new Error("glyphsUrl is not set"));let S=y.requests[v];S||(S=y.requests[v]=[],Sr.loadGlyphRange(c,v,this.url,this.requestManager,(T,L)=>{if(L){for(const O in L)this._doesCharSupportLocalGlyph(+O)||(y.glyphs[+O]=L[+O]);y.ranges[v]=!0}for(const O of S)O(T,L);delete y.requests[v]})),S.push((T,L)=>{T?m(T):L&&m(null,{stack:c,id:p,glyph:L[p]||null})})},(c,p)=>{if(c)n(c);else if(p){const m={};for(const{stack:y,id:_,glyph:v}of p)(m[y]||(m[y]={}))[_]=v&&{id:v.id,bitmap:v.bitmap.clone(),metrics:v.metrics};n(null,m)}})}_doesCharSupportLocalGlyph(t){return!!this.localIdeographFontFamily&&(h.unicodeBlockLookup["CJK Unified Ideographs"](t)||h.unicodeBlockLookup["Hangul Syllables"](t)||h.unicodeBlockLookup.Hiragana(t)||h.unicodeBlockLookup.Katakana(t))}_tinySDF(t,n,a){const c=this.localIdeographFontFamily;if(!c||!this._doesCharSupportLocalGlyph(a))return;let p=t.tinySDF;if(!p){let y="400";/bold/i.test(n)?y="900":/medium/i.test(n)?y="500":/light/i.test(n)&&(y="200"),p=t.tinySDF=new Sr.TinySDF({fontSize:24,buffer:3,radius:8,cutoff:.25,fontFamily:c,fontWeight:y})}const m=p.draw(String.fromCharCode(a));return{id:a,bitmap:new h.AlphaImage({width:m.width||30,height:m.height||30},m.data),metrics:{width:m.glyphWidth||24,height:m.glyphHeight||24,left:m.glyphLeft||0,top:m.glyphTop-27||-8,advance:m.glyphAdvance||24}}}}Sr.loadGlyphRange=function(o,t,n,a,c){const p=256*t,m=p+255,y=a.transformRequest(n.replace("{fontstack}",o).replace("{range}",`${p}-${m}`),Ct.Glyphs);h.getArrayBuffer(y,(_,v)=>{if(_)c(_);else if(v){const S={};for(const T of h.parseGlyphPbf(v))S[T.id]=T;c(null,S)}})},Sr.TinySDF=class{constructor({fontSize:o=24,buffer:t=3,radius:n=8,cutoff:a=.25,fontFamily:c="sans-serif",fontWeight:p="normal",fontStyle:m="normal"}={}){this.buffer=t,this.cutoff=a,this.radius=n;const y=this.size=o+4*t,_=this._createCanvas(y),v=this.ctx=_.getContext("2d",{willReadFrequently:!0});v.font=`${m} ${p} ${o}px ${c}`,v.textBaseline="alphabetic",v.textAlign="left",v.fillStyle="black",this.gridOuter=new Float64Array(y*y),this.gridInner=new Float64Array(y*y),this.f=new Float64Array(y),this.z=new Float64Array(y+1),this.v=new Uint16Array(y)}_createCanvas(o){const t=document.createElement("canvas");return t.width=t.height=o,t}draw(o){const{width:t,actualBoundingBoxAscent:n,actualBoundingBoxDescent:a,actualBoundingBoxLeft:c,actualBoundingBoxRight:p}=this.ctx.measureText(o),m=Math.ceil(n),y=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(p-c))),_=Math.min(this.size-this.buffer,m+Math.ceil(a)),v=y+2*this.buffer,S=_+2*this.buffer,T=Math.max(v*S,0),L=new Uint8ClampedArray(T),O={data:L,width:v,height:S,glyphWidth:y,glyphHeight:_,glyphTop:m,glyphLeft:0,glyphAdvance:t};if(y===0||_===0)return O;const{ctx:R,buffer:B,gridInner:$,gridOuter:W}=this;R.clearRect(B,B,y,_),R.fillText(o,B,B+m);const ne=R.getImageData(B,B,y,_);W.fill(Tr,0,T),$.fill(0,0,T);for(let V=0;V<_;V++)for(let ie=0;ie<y;ie++){const ae=ne.data[4*(V*y+ie)+3]/255;if(ae===0)continue;const fe=(V+B)*v+ie+B;if(ae===1)W[fe]=0,$[fe]=Tr;else{const _e=.5-ae;W[fe]=_e>0?_e*_e:0,$[fe]=_e<0?_e*_e:0}}Ur(W,0,0,v,S,v,this.f,this.v,this.z),Ur($,B,B,y,_,v,this.f,this.v,this.z);for(let V=0;V<T;V++){const ie=Math.sqrt(W[V])-Math.sqrt($[V]);L[V]=Math.round(255-255*(ie/this.radius+this.cutoff))}return O}};class bn{constructor(){this.specification=h.v8Spec.light.position}possiblyEvaluate(t,n){return h.sphericalToCartesian(t.expression.evaluate(n))}interpolate(t,n,a){return{x:h.interpolate.number(t.x,n.x,a),y:h.interpolate.number(t.y,n.y,a),z:h.interpolate.number(t.z,n.z,a)}}}let tn,wn;class Wn extends h.Evented{constructor(t){super(),tn=tn||new h.Properties({anchor:new h.DataConstantProperty(h.v8Spec.light.anchor),position:new bn,color:new h.DataConstantProperty(h.v8Spec.light.color),intensity:new h.DataConstantProperty(h.v8Spec.light.intensity)}),this._transitionable=new h.Transitionable(tn),this.setLight(t),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,n={}){if(!this._validate(h.validateLight,t,n))for(const a in t){const c=t[a];a.endsWith("-transition")?this._transitionable.setTransition(a.slice(0,-11),c):this._transitionable.setValue(a,c)}}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,n,a){return(!a||a.validate!==!1)&&h.emitValidationErrors(this,t.call(h.validateStyle,h.extend({value:n,style:{glyphs:!0,sprite:!0},styleSpec:h.v8Spec})))}}class Nr{constructor(t,n){this.width=t,this.height=n,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(t,n){const a=t.join(",")+String(n);return this.dashEntry[a]||(this.dashEntry[a]=this.addDash(t,n)),this.dashEntry[a]}getDashRanges(t,n,a){const c=[];let p=t.length%2==1?-t[t.length-1]*a:0,m=t[0]*a,y=!0;c.push({left:p,right:m,isDash:y,zeroLength:t[0]===0});let _=t[0];for(let v=1;v<t.length;v++){y=!y;const S=t[v];p=_*a,_+=S,m=_*a,c.push({left:p,right:m,isDash:y,zeroLength:S===0})}return c}addRoundDash(t,n,a){const c=n/2;for(let p=-a;p<=a;p++){const m=this.width*(this.nextRow+a+p);let y=0,_=t[y];for(let v=0;v<this.width;v++){v/_.right>1&&(_=t[++y]);const S=Math.abs(v-_.left),T=Math.abs(v-_.right),L=Math.min(S,T);let O;const R=p/a*(c+1);if(_.isDash){const B=c-Math.abs(R);O=Math.sqrt(L*L+B*B)}else O=c-Math.sqrt(L*L+R*R);this.data[m+v]=Math.max(0,Math.min(255,O+128))}}}addRegularDash(t){for(let y=t.length-1;y>=0;--y){const _=t[y],v=t[y+1];_.zeroLength?t.splice(y,1):v&&v.isDash===_.isDash&&(v.left=_.left,t.splice(y,1))}const n=t[0],a=t[t.length-1];n.isDash===a.isDash&&(n.left=a.left-this.width,a.right=n.right+this.width);const c=this.width*this.nextRow;let p=0,m=t[p];for(let y=0;y<this.width;y++){y/m.right>1&&(m=t[++p]);const _=Math.abs(y-m.left),v=Math.abs(y-m.right),S=Math.min(_,v);this.data[c+y]=Math.max(0,Math.min(255,(m.isDash?S:-S)+128))}}addDash(t,n){const a=n?7:0,c=2*a+1;if(this.nextRow+c>this.height)return h.warnOnce("LineAtlas out of space"),null;let p=0;for(let y=0;y<t.length;y++)p+=t[y];if(p!==0){const y=this.width/p,_=this.getDashRanges(t,this.width,y);n?this.addRoundDash(_,y,a):this.addRegularDash(_)}const m={y:(this.nextRow+a+.5)/this.height,height:2*a/this.height,width:p};return this.nextRow+=c,this.dirty=!0,m}bind(t){const n=t.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))}}class vi{constructor(t,n,a){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=a;const c=this.workerPool.acquire(a);for(let p=0;p<c.length;p++){const m=new vi.Actor(c[p],n,a);m.name=`Worker ${p}`,this.actors.push(m)}if(!this.actors.length)throw new Error("No actors found")}broadcast(t,n,a){h.asyncAll(this.actors,(c,p)=>{c.send(t,n,p)},a=a||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(t=!0){this.actors.forEach(n=>{n.remove()}),this.actors=[],t&&this.workerPool.release(this.id)}}function Gi(o,t,n){const a=function(c,p){if(c)return n(c);if(p){const m=h.pick(h.extend(p,o),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);p.vector_layers&&(m.vectorLayers=p.vector_layers,m.vectorLayerIds=m.vectorLayers.map(y=>y.id)),n(null,m)}};return o.url?h.getJSON(t.transformRequest(o.url,Ct.Source),a):h.exported.frame(()=>a(null,o))}vi.Actor=h.Actor;class si{constructor(t,n){t&&(n?this.setSouthWest(t).setNorthEast(n):Array.isArray(t)&&(t.length===4?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1])))}setNorthEast(t){return this._ne=t instanceof h.LngLat?new h.LngLat(t.lng,t.lat):h.LngLat.convert(t),this}setSouthWest(t){return this._sw=t instanceof h.LngLat?new h.LngLat(t.lng,t.lat):h.LngLat.convert(t),this}extend(t){const n=this._sw,a=this._ne;let c,p;if(t instanceof h.LngLat)c=t,p=t;else{if(!(t instanceof si))return Array.isArray(t)?t.length===4||t.every(Array.isArray)?this.extend(si.convert(t)):this.extend(h.LngLat.convert(t)):t&&("lng"in t||"lon"in t)&&"lat"in t?this.extend(h.LngLat.convert(t)):this;if(c=t._sw,p=t._ne,!c||!p)return this}return n||a?(n.lng=Math.min(c.lng,n.lng),n.lat=Math.min(c.lat,n.lat),a.lng=Math.max(p.lng,a.lng),a.lat=Math.max(p.lat,a.lat)):(this._sw=new h.LngLat(c.lng,c.lat),this._ne=new h.LngLat(p.lng,p.lat)),this}getCenter(){return new h.LngLat((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 h.LngLat(this.getWest(),this.getNorth())}getSouthEast(){return new h.LngLat(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(t){const{lng:n,lat:a}=h.LngLat.convert(t);let c=this._sw.lng<=n&&n<=this._ne.lng;return this._sw.lng>this._ne.lng&&(c=this._sw.lng>=n&&n>=this._ne.lng),this._sw.lat<=a&&a<=this._ne.lat&&c}static convert(t){return t instanceof si?t:t&&new si(t)}static fromLngLat(t,n=0){const a=360*n/40075017,c=a/Math.cos(Math.PI/180*t.lat);return new si(new h.LngLat(t.lng-c,t.lat-a),new h.LngLat(t.lng+c,t.lat+a))}}class Tn{constructor(t,n,a){this.bounds=si.convert(this.validateBounds(t)),this.minzoom=n||0,this.maxzoom=a||24}validateBounds(t){return Array.isArray(t)&&t.length===4?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}contains(t){const n=Math.pow(2,t.z),a=Math.floor(h.mercatorXfromLng(this.bounds.getWest())*n),c=Math.floor(h.mercatorYfromLat(this.bounds.getNorth())*n),p=Math.ceil(h.mercatorXfromLng(this.bounds.getEast())*n),m=Math.ceil(h.mercatorYfromLat(this.bounds.getSouth())*n);return t.x>=a&&t.x<p&&t.y>=c&&t.y<m}}class Sn extends h.Evented{constructor(t,n,a,c){if(super(),this.id=t,this.dispatcher=a,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,h.extend(this,h.pick(n,["url","scheme","tileSize","promoteId"])),this._options=h.extend({type:"vector"},n),this._collectResourceTiming=n.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(c)}load(){this._loaded=!1,this.fire(new h.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=Gi(this._options,this.map._requestManager,(t,n)=>{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),t?this.fire(new h.ErrorEvent(t)):n&&(h.extend(this,n),n.bounds&&(this.tileBounds=new Tn(n.bounds,this.minzoom,this.maxzoom)),this.fire(new h.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new h.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.cancel(),t(),this.load()}setTiles(t){return this.setSourceProperty(()=>{this._options.tiles=t}),this}setUrl(t){return this.setSourceProperty(()=>{this.url=t,this._options.url=t}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return h.extend({},this._options)}loadTile(t,n){const a=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),c={request:this.map._requestManager.transformRequest(a,Ct.Tile),uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};function p(m,y){return delete t.request,t.aborted?n(null):m&&m.status!==404?n(m):(y&&y.resourceTiming&&(t.resourceTiming=y.resourceTiming),this.map._refreshExpiredTiles&&y&&t.setExpiryData(y),t.loadVectorData(y,this.map.painter),n(null),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}c.request.collectResourceTiming=this._collectResourceTiming,t.actor&&t.state!=="expired"?t.state==="loading"?t.reloadCallback=n:t.request=t.actor.send("reloadTile",c,p.bind(this)):(t.actor=this.dispatcher.getActor(),t.request=t.actor.send("loadTile",c,p.bind(this)))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.type,source:this.id},void 0)}unloadTile(t){t.unloadVectorData(),t.actor&&t.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id},void 0)}hasTransition(){return!1}}class rn extends h.Evented{constructor(t,n,a,c){super(),this.id=t,this.dispatcher=a,this.setEventedParent(c),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=h.extend({type:"raster"},n),h.extend(this,h.pick(n,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new h.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=Gi(this._options,this.map._requestManager,(t,n)=>{this._tileJSONRequest=null,this._loaded=!0,t?this.fire(new h.ErrorEvent(t)):n&&(h.extend(this,n),n.bounds&&(this.tileBounds=new Tn(n.bounds,this.minzoom,this.maxzoom)),this.fire(new h.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new h.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return h.extend({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t,n){const a=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.request=hr.getImage(this.map._requestManager.transformRequest(a,Ct.Tile),(c,p,m)=>{if(delete t.request,t.aborted)t.state="unloaded",n(null);else if(c)t.state="errored",n(c);else if(p){this.map._refreshExpiredTiles&&m&&t.setExpiryData(m);const y=this.map.painter.context,_=y.gl;t.texture=this.map.painter.getTileTexture(p.width),t.texture?t.texture.update(p,{useMipmap:!0}):(t.texture=new yt(y,p,_.RGBA,{useMipmap:!0}),t.texture.bind(_.LINEAR,_.CLAMP_TO_EDGE,_.LINEAR_MIPMAP_NEAREST),y.extTextureFilterAnisotropic&&_.texParameterf(_.TEXTURE_2D,y.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,y.extTextureFilterAnisotropicMax)),t.state="loaded",n(null)}},this.map._refreshExpiredTiles)}abortTile(t,n){t.request&&(t.request.cancel(),delete t.request),n()}unloadTile(t,n){t.texture&&this.map.painter.saveTileTexture(t.texture),n()}hasTransition(){return!1}}class Vr extends rn{constructor(t,n,a,c){super(t,n,a,c),this.type="raster-dem",this.maxzoom=22,this._options=h.extend({type:"raster-dem"},n),this.encoding=n.encoding||"mapbox"}serialize(){return{type:"raster-dem",url:this.url,tileSize:this.tileSize,tiles:this.tiles,bounds:this.bounds,encoding:this.encoding}}loadTile(t,n){const a=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);function c(p,m){p&&(t.state="errored",n(p)),m&&(t.dem=m,t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded",n(null))}t.request=hr.getImage(this.map._requestManager.transformRequest(a,Ct.Tile),function(p,m){if(delete t.request,t.aborted)t.state="unloaded",n(null);else if(p)t.state="errored",n(p);else if(m){this.map._refreshExpiredTiles&&t.setExpiryData(m),delete m.cacheControl,delete m.expires;const y=h.isImageBitmap(m)&&(wn==null&&(wn=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),wn)?m:h.exported.getImageData(m,1),_={uid:t.uid,coord:t.tileID,source:this.id,rawImageData:y,encoding:this.encoding};t.actor&&t.state!=="expired"||(t.actor=this.dispatcher.getActor(),t.actor.send("loadDEMTile",_,c.bind(this)))}}.bind(this),this.map._refreshExpiredTiles),t.neighboringTiles=this._getNeighboringTiles(t.tileID)}_getNeighboringTiles(t){const n=t.canonical,a=Math.pow(2,n.z),c=(n.x-1+a)%a,p=n.x===0?t.wrap-1:t.wrap,m=(n.x+1+a)%a,y=n.x+1===a?t.wrap+1:t.wrap,_={};return _[new h.OverscaledTileID(t.overscaledZ,p,n.z,c,n.y).key]={backfilled:!1},_[new h.OverscaledTileID(t.overscaledZ,y,n.z,m,n.y).key]={backfilled:!1},n.y>0&&(_[new h.OverscaledTileID(t.overscaledZ,p,n.z,c,n.y-1).key]={backfilled:!1},_[new h.OverscaledTileID(t.overscaledZ,t.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},_[new h.OverscaledTileID(t.overscaledZ,y,n.z,m,n.y-1).key]={backfilled:!1}),n.y+1<a&&(_[new h.OverscaledTileID(t.overscaledZ,p,n.z,c,n.y+1).key]={backfilled:!1},_[new h.OverscaledTileID(t.overscaledZ,t.wrap,n.z,n.x,n.y+1).key]={backfilled:!1},_[new h.OverscaledTileID(t.overscaledZ,y,n.z,m,n.y+1).key]={backfilled:!1}),_}unloadTile(t){t.demTexture&&this.map.painter.saveTileTexture(t.demTexture),t.fbo&&(t.fbo.destroy(),delete t.fbo),t.dem&&delete t.dem,delete t.neighboringTiles,t.state="unloaded",t.actor&&t.actor.send("removeDEMTile",{uid:t.uid,source:this.id})}}class Er extends h.Evented{constructor(t,n,a,c){super(),this.id=t,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=a.getActor(),this.setEventedParent(c),this._data=n.data,this._options=h.extend({},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;const p=h.EXTENT/this.tileSize;this.workerOptions=h.extend({source:this.id,cluster:n.cluster||!1,geojsonVtOptions:{buffer:(n.buffer!==void 0?n.buffer:128)*p,tolerance:(n.tolerance!==void 0?n.tolerance:.375)*p,extent:h.EXTENT,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:h.EXTENT,radius:(n.clusterRadius||50)*p,log:!1,generateId:n.generateId||!1},clusterProperties:n.clusterProperties,filter:n.filter},n.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}load(){this._updateWorkerData()}onAdd(t){this.map=t,this.load()}setData(t){return this._data=t,this._updateWorkerData(),this}updateData(t){return this._updateWorkerData(t),this}setClusterOptions(t){return this.workerOptions.cluster=t.cluster,t&&(t.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=t.clusterRadius),t.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=t.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(t,n){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:t,source:this.id},n),this}getClusterChildren(t,n){return this.actor.send("geojson.getClusterChildren",{clusterId:t,source:this.id},n),this}getClusterLeaves(t,n,a,c){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:t,limit:n,offset:a},c),this}_updateWorkerData(t){const n=h.extend({},this.workerOptions);t?n.dataDiff=t:typeof this._data=="string"?(n.request=this.map._requestManager.transformRequest(h.exported.resolveURL(this._data),Ct.Source),n.request.collectResourceTiming=this._collectResourceTiming):n.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new h.Event("dataloading",{dataType:"source"})),this.actor.send(`${this.type}.loadData`,n,(a,c)=>{if(this._pendingLoads--,this._removed||c&&c.abandoned)return void this.fire(new h.Event("dataabort",{dataType:"source"}));let p=null;if(c&&c.resourceTiming&&c.resourceTiming[this.id]&&(p=c.resourceTiming[this.id].slice(0)),a)return void this.fire(new h.ErrorEvent(a));const m={dataType:"source"};this._collectResourceTiming&&p&&p.length>0&&h.extend(m,{resourceTiming:p}),this.fire(new h.Event("data",{...m,sourceDataType:"metadata"})),this.fire(new h.Event("data",{...m,sourceDataType:"content"}))})}loaded(){return this._pendingLoads===0}loadTile(t,n){const a=t.actor?"reloadTile":"loadTile";t.actor=this.actor;const c={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};t.request=this.actor.send(a,c,(p,m)=>(delete t.request,t.unloadVectorData(),t.aborted?n(null):p?n(p):(t.loadVectorData(m,this.map.painter,a==="reloadTile"),n(null))))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.aborted=!0}unloadTile(t){t.unloadVectorData(),this.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id})}onRemove(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})}serialize(){return h.extend({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var Ir=h.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Zi extends h.Evented{constructor(t,n,a,c){super(),this.id=t,this.dispatcher=a,this.coordinates=n.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(c),this.options=n}load(t,n){this._loaded=!1,this.fire(new h.Event("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=hr.getImage(this.map._requestManager.transformRequest(this.url,Ct.Image),(a,c)=>{this._request=null,this._loaded=!0,a?this.fire(new h.ErrorEvent(a)):c&&(this.image=c,t&&(this.coordinates=t),n&&n(),this._finishLoading())})}loaded(){return this._loaded}updateImage(t){return t.url?(this._request&&(this._request.cancel(),this._request=null),this.options.url=t.url,this.load(t.coordinates,()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new h.Event("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}onRemove(){this._request&&(this._request.cancel(),this._request=null)}setCoordinates(t){this.coordinates=t;const n=t.map(h.MercatorCoordinate.fromLngLat);this.tileID=function(c){let p=1/0,m=1/0,y=-1/0,_=-1/0;for(const L of c)p=Math.min(p,L.x),m=Math.min(m,L.y),y=Math.max(y,L.x),_=Math.max(_,L.y);const v=Math.max(y-p,_-m),S=Math.max(0,Math.floor(-Math.log(v)/Math.LN2)),T=Math.pow(2,S);return new h.CanonicalTileID(S,Math.floor((p+y)/2*T),Math.floor((m+_)/2*T))}(n),this.minzoom=this.maxzoom=this.tileID.z;const a=n.map(c=>this.tileID.getTilePoint(c)._round());return this._boundsArray=new h.RasterBoundsArray,this._boundsArray.emplaceBack(a[0].x,a[0].y,0,0),this._boundsArray.emplaceBack(a[1].x,a[1].y,h.EXTENT,0),this._boundsArray.emplaceBack(a[3].x,a[3].y,0,h.EXTENT),this._boundsArray.emplaceBack(a[2].x,a[2].y,h.EXTENT,h.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new h.Event("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const t=this.map.painter.context,n=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,Ir.members)),this.boundsSegments||(this.boundsSegments=h.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new yt(t,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let a=!1;for(const c in this.tiles){const p=this.tiles[c];p.state!=="loaded"&&(p.state="loaded",p.texture=this.texture,a=!0)}a&&this.fire(new h.Event("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(t,n){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={},n(null)):(t.state="errored",n(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class En extends Zi{constructor(t,n,a,c){super(t,n,a,c),this.roundZoom=!0,this.type="video",this.options=n}load(){this._loaded=!1;const t=this.options;this.urls=[];for(const n of t.urls)this.urls.push(this.map._requestManager.transformRequest(n,Ct.Source).url);h.getVideo(this.urls,(n,a)=>{this._loaded=!0,n?this.fire(new h.ErrorEvent(n)):a&&(this.video=a,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){const n=this.video.seekable;t<n.start(0)||t>n.end(0)?this.fire(new h.ErrorEvent(new h.ValidationError(`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=t}}getVideo(){return this.video}onAdd(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const t=this.map.painter.context,n=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,Ir.members)),this.boundsSegments||(this.boundsSegments=h.SegmentVector.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 yt(t,this.video,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let a=!1;for(const c in this.tiles){const p=this.tiles[c];p.state!=="loaded"&&(p.state="loaded",p.texture=this.texture,a=!0)}a&&this.fire(new h.Event("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 oe extends Zi{constructor(t,n,a,c){super(t,n,a,c),n.coordinates?Array.isArray(n.coordinates)&&n.coordinates.length===4&&!n.coordinates.some(p=>!Array.isArray(p)||p.length!==2||p.some(m=>typeof m!="number"))||this.fire(new h.ErrorEvent(new h.ValidationError(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new h.ErrorEvent(new h.ValidationError(`sources.${t}`,null,'missing required property "coordinates"'))),n.animate&&typeof n.animate!="boolean"&&this.fire(new h.ErrorEvent(new h.ValidationError(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),n.canvas?typeof n.canvas=="string"||n.canvas instanceof HTMLCanvasElement||this.fire(new h.ErrorEvent(new h.ValidationError(`sources.${t}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new h.ErrorEvent(new h.ValidationError(`sources.${t}`,null,'missing required property "canvas"'))),this.options=n,this.animate=n.animate===void 0||n.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new h.ErrorEvent(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let t=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const n=this.map.painter.context,a=n.gl;this.boundsBuffer||(this.boundsBuffer=n.createVertexBuffer(this._boundsArray,Ir.members)),this.boundsSegments||(this.boundsSegments=h.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new yt(n,this.canvas,a.RGBA,{premultiply:!0});let c=!1;for(const p in this.tiles){const m=this.tiles[p];m.state!=="loaded"&&(m.state="loaded",m.texture=this.texture,c=!0)}c&&this.fire(new h.Event("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}}const $r={vector:Sn,raster:rn,"raster-dem":Vr,geojson:Er,video:En,image:Zi,canvas:oe};function Hn(o,t){const n=h.create();return h.translate(n,n,[1,1,0]),h.scale(n,n,[.5*o.width,.5*o.height,1]),h.multiply(n,n,o.calculatePosMatrix(t.toUnwrapped()))}function vt(o,t,n,a,c,p){const m=function(T,L,O){if(T)for(const R of T){const B=L[R];if(B&&B.source===O&&B.type==="fill-extrusion")return!0}else for(const R in L){const B=L[R];if(B.source===O&&B.type==="fill-extrusion")return!0}return!1}(c&&c.layers,t,o.id),y=p.maxPitchScaleFactor(),_=o.tilesIn(a,y,m);_.sort(ct);const v=[];for(const T of _)v.push({wrappedTileID:T.tileID.wrapped().key,queryResults:T.tile.queryRenderedFeatures(t,n,o._state,T.queryGeometry,T.cameraQueryGeometry,T.scale,c,p,y,Hn(o.transform,T.tileID))});const S=function(T){const L={},O={};for(const R of T){const B=R.queryResults,$=R.wrappedTileID,W=O[$]=O[$]||{};for(const ne in B){const V=B[ne],ie=W[ne]=W[ne]||{},ae=L[ne]=L[ne]||[];for(const fe of V)ie[fe.featureIndex]||(ie[fe.featureIndex]=!0,ae.push(fe))}}return L}(v);for(const T in S)S[T].forEach(L=>{const O=L.feature,R=o.getFeatureState(O.layer["source-layer"],O.id);O.source=O.layer.source,O.layer["source-layer"]&&(O.sourceLayer=O.layer["source-layer"]),O.state=R});return S}function ct(o,t){const n=o.tileID,a=t.tileID;return n.overscaledZ-a.overscaledZ||n.canonical.y-a.canonical.y||n.wrap-a.wrap||n.canonical.x-a.canonical.x}class nn{constructor(t,n){this.timeAdded=0,this.fadeEndTime=0,this.tileID=t,this.uid=h.uniqueId(),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(t){const n=t+this.timeAdded;n<this.fadeEndTime||(this.fadeEndTime=n)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(t){this.demTexture&&t.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(t,n,a){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",t){t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestFeatureIndex.rawTileData=t.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=function(c,p){const m={};if(!p)return m;for(const y of c){const _=y.layerIds.map(v=>p.getLayer(v)).filter(Boolean);if(_.length!==0){y.layers=_,y.stateDependentLayerIds&&(y.stateDependentLayers=y.stateDependentLayerIds.map(v=>_.filter(S=>S.id===v)[0]));for(const v of _)m[v.id]=y}}return m}(t.buckets,n.style),this.hasSymbolBuckets=!1;for(const c in this.buckets){const p=this.buckets[c];if(p instanceof h.SymbolBucket){if(this.hasSymbolBuckets=!0,!a)break;p.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const c in this.buckets){const p=this.buckets[c];if(p instanceof h.SymbolBucket&&p.hasRTLText){this.hasRTLText=!0,h.lazyLoadRTLTextPlugin();break}}this.queryPadding=0;for(const c in this.buckets){const p=this.buckets[c];this.queryPadding=Math.max(this.queryPadding,n.style.getLayer(c).queryRadius(p))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage)}else this.collisionBoxArray=new h.CollisionBoxArray}unloadVectorData(){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(t){return this.buckets[t.id]}upload(t){for(const a in this.buckets){const c=this.buckets[a];c.uploadPending()&&c.upload(t)}const n=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new yt(t,this.imageAtlas.image,n.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new yt(t,this.glyphAtlasImage,n.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,n,a,c,p,m,y,_,v,S){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:c,cameraQueryGeometry:p,scale:m,tileSize:this.tileSize,pixelPosMatrix:S,transform:_,params:y,queryPadding:this.queryPadding*v},t,n,a):{}}querySourceFeatures(t,n){const a=this.latestFeatureIndex;if(!a||!a.rawTileData)return;const c=a.loadVTLayers(),p=n&&n.sourceLayer?n.sourceLayer:"",m=c._geojsonTileLayer||c[p];if(!m)return;const y=h.createFilter(n&&n.filter),{z:_,x:v,y:S}=this.tileID.canonical,T={z:_,x:v,y:S};for(let L=0;L<m.length;L++){const O=m.feature(L);if(y.needGeometry){const $=h.toEvaluationFeature(O,!0);if(!y.filter(new h.EvaluationParameters(this.tileID.overscaledZ),$,this.tileID.canonical))continue}else if(!y.filter(new h.EvaluationParameters(this.tileID.overscaledZ),O))continue;const R=a.getId(O,p),B=new h.GeoJSONFeature(O,_,v,S,R);B.tile=T,t.push(B)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(t){const n=this.expirationTime;if(t.cacheControl){const a=h.parseCacheControl(t.cacheControl);a["max-age"]&&(this.expirationTime=Date.now()+1e3*a["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){const a=Date.now();let c=!1;if(this.expirationTime>a)c=!1;else if(n)if(this.expirationTime<n)c=!0;else{const p=this.expirationTime-n;p?this.expirationTime=a+Math.max(p,3e4):c=!0}else c=!0;c?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}setFeatureState(t,n){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(t).length===0)return;const a=this.latestFeatureIndex.loadVTLayers();for(const c in this.buckets){if(!n.style.hasLayer(c))continue;const p=this.buckets[c],m=p.layers[0].sourceLayer||"_geojsonTileLayer",y=a[m],_=t[m];if(!y||!_||Object.keys(_).length===0)continue;p.update(_,y,this.imageAtlas&&this.imageAtlas.patternPositions||{});const v=n&&n.style&&n.style.getLayer(c);v&&(this.queryPadding=Math.max(this.queryPadding,v.queryRadius(p)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<h.exported.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(t){this.symbolFadeHoldUntil=h.exported.now()+t}setDependencies(t,n){const a={};for(const c of n)a[c]=!0;this.dependencies[t]=a}hasDependency(t,n){for(const a of t){const c=this.dependencies[a];if(c){for(const p of n)if(c[p])return!0}}return!1}}class Kn{constructor(t,n){this.max=t,this.onRemove=n,this.reset()}reset(){for(const t in this.data)for(const n of this.data[t])n.timeout&&clearTimeout(n.timeout),this.onRemove(n.value);return this.data={},this.order=[],this}add(t,n,a){const c=t.wrapped().key;this.data[c]===void 0&&(this.data[c]=[]);const p={value:n,timeout:void 0};if(a!==void 0&&(p.timeout=setTimeout(()=>{this.remove(t,p)},a)),this.data[c].push(p),this.order.push(c),this.order.length>this.max){const m=this._getAndRemoveByKey(this.order[0]);m&&this.onRemove(m)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){const n=this.data[t].shift();return n.timeout&&clearTimeout(n.timeout),this.data[t].length===0&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),n.value}getByKey(t){const n=this.data[t];return n?n[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,n){if(!this.has(t))return this;const a=t.wrapped().key,c=n===void 0?0:this.data[a].indexOf(n),p=this.data[a][c];return this.data[a].splice(c,1),p.timeout&&clearTimeout(p.timeout),this.data[a].length===0&&delete this.data[a],this.onRemove(p.value),this.order.splice(this.order.indexOf(a),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const n=this._getAndRemoveByKey(this.order[0]);n&&this.onRemove(n)}return this}filter(t){const n=[];for(const a in this.data)for(const c of this.data[a])t(c.value)||n.push(c);for(const a of n)this.remove(a.value.tileID,a)}}class Ts{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,n,a){const c=String(n);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][c]=this.stateChanges[t][c]||{},h.extend(this.stateChanges[t][c],a),this.deletedStates[t]===null){this.deletedStates[t]={};for(const p in this.state[t])p!==c&&(this.deletedStates[t][p]=null)}else if(this.deletedStates[t]&&this.deletedStates[t][c]===null){this.deletedStates[t][c]={};for(const p in this.state[t][c])a[p]||(this.deletedStates[t][c][p]=null)}else for(const p in a)this.deletedStates[t]&&this.deletedStates[t][c]&&this.deletedStates[t][c][p]===null&&delete this.deletedStates[t][c][p]}removeFeatureState(t,n,a){if(this.deletedStates[t]===null)return;const c=String(n);if(this.deletedStates[t]=this.deletedStates[t]||{},a&&n!==void 0)this.deletedStates[t][c]!==null&&(this.deletedStates[t][c]=this.deletedStates[t][c]||{},this.deletedStates[t][c][a]=null);else if(n!==void 0)if(this.stateChanges[t]&&this.stateChanges[t][c])for(a in this.deletedStates[t][c]={},this.stateChanges[t][c])this.deletedStates[t][c][a]=null;else this.deletedStates[t][c]=null;else this.deletedStates[t]=null}getState(t,n){const a=String(n),c=h.extend({},(this.state[t]||{})[a],(this.stateChanges[t]||{})[a]);if(this.deletedStates[t]===null)return{};if(this.deletedStates[t]){const p=this.deletedStates[t][n];if(p===null)return{};for(const m in p)delete c[m]}return c}initializeTileState(t,n){t.setFeatureState(this.state,n)}coalesceChanges(t,n){const a={};for(const c in this.stateChanges){this.state[c]=this.state[c]||{};const p={};for(const m in this.stateChanges[c])this.state[c][m]||(this.state[c][m]={}),h.extend(this.state[c][m],this.stateChanges[c][m]),p[m]=this.state[c][m];a[c]=p}for(const c in this.deletedStates){this.state[c]=this.state[c]||{};const p={};if(this.deletedStates[c]===null)for(const m in this.state[c])p[m]={},this.state[c][m]={};else for(const m in this.deletedStates[c]){if(this.deletedStates[c][m]===null)this.state[c][m]={};else for(const y of Object.keys(this.deletedStates[c][m]))delete this.state[c][m][y];p[m]=this.state[c][m]}a[c]=a[c]||{},h.extend(a[c],p)}if(this.stateChanges={},this.deletedStates={},Object.keys(a).length!==0)for(const c in t)t[c].setFeatureState(a,n)}}class jt extends h.Evented{constructor(t,n,a){super(),this.id=t,this.dispatcher=a,this.on("data",c=>{c.dataType==="source"&&c.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&c.dataType==="source"&&c.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=function(c,p,m,y){const _=new $r[p.type](c,p,m,y);if(_.id!==c)throw new Error(`Expected Source id to be ${c} instead of ${_.id}`);return h.bindAll(["load","abort","unload","serialize","prepare"],_),_}(t,n,a,this),this._tiles={},this._cache=new Kn(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Ts,this._didEmitContent=!1,this._updated=!1}onAdd(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._maxTileCacheZoomLevels=t?t._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(t)}onRemove(t){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(t)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!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(const t in this._tiles){const n=this._tiles[t];if(n.state!=="loaded"&&n.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(t,n){return this._source.loadTile(t,n)}_unloadTile(t){if(this._source.unloadTile)return this._source.unloadTile(t,()=>{})}_abortTile(t){this._source.abortTile&&this._source.abortTile(t,()=>{}),this._source.fire(new h.Event("dataabort",{tile:t,coord:t.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const n in this._tiles){const a=this._tiles[n];a.upload(t),a.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(t=>t.tileID).sort(sn).map(t=>t.key)}getRenderableIds(t){const n=[];for(const a in this._tiles)this._isIdRenderable(a,t)&&n.push(this._tiles[a]);return t?n.sort((a,c)=>{const p=a.tileID,m=c.tileID,y=new h.Point(p.canonical.x,p.canonical.y)._rotate(this.transform.angle),_=new h.Point(m.canonical.x,m.canonical.y)._rotate(this.transform.angle);return p.overscaledZ-m.overscaledZ||_.y-y.y||_.x-y.x}).map(a=>a.tileID.key):n.map(a=>a.tileID).sort(sn).map(a=>a.key)}hasRenderableParent(t){const n=this.findLoadedParent(t,0);return!!n&&this._isIdRenderable(n.tileID.key)}_isIdRenderable(t,n){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(n||!this._tiles[t].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const t in this._tiles)this._tiles[t].state!=="errored"&&this._reloadTile(t,"reloading")}}_reloadTile(t,n){const a=this._tiles[t];a&&(a.state!=="loading"&&(a.state=n),this._loadTile(a,this._tileLoaded.bind(this,a,t,n)))}_tileLoaded(t,n,a,c){if(c)return t.state="errored",void(c.status!==404?this._source.fire(new h.ErrorEvent(c,{tile:t})):this.update(this.transform,this.terrain));t.timeAdded=h.exported.now(),a==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(n,t),this.getSource().type==="raster-dem"&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new h.Event("data",{dataType:"source",tile:t,coord:t.tileID}))}_backfillDEM(t){const n=this.getRenderableIds();for(let c=0;c<n.length;c++){const p=n[c];if(t.neighboringTiles&&t.neighboringTiles[p]){const m=this.getTileByID(p);a(t,m),a(m,t)}}function a(c,p){c.needsHillshadePrepare=!0,c.needsTerrainPrepare=!0;let m=p.tileID.canonical.x-c.tileID.canonical.x;const y=p.tileID.canonical.y-c.tileID.canonical.y,_=Math.pow(2,c.tileID.canonical.z),v=p.tileID.key;m===0&&y===0||Math.abs(y)>1||(Math.abs(m)>1&&(Math.abs(m+_)===1?m+=_:Math.abs(m-_)===1&&(m-=_)),p.dem&&c.dem&&(c.dem.backfillBorder(p.dem,m,y),c.neighboringTiles&&c.neighboringTiles[v]&&(c.neighboringTiles[v].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,n,a,c){for(const p in this._tiles){let m=this._tiles[p];if(c[p]||!m.hasData()||m.tileID.overscaledZ<=n||m.tileID.overscaledZ>a)continue;let y=m.tileID;for(;m&&m.tileID.overscaledZ>n+1;){const v=m.tileID.scaledTo(m.tileID.overscaledZ-1);m=this._tiles[v.key],m&&m.hasData()&&(y=v)}let _=y;for(;_.overscaledZ>n;)if(_=_.scaledTo(_.overscaledZ-1),t[_.key]){c[y.key]=y;break}}}findLoadedParent(t,n){if(t.key in this._loadedParentTiles){const a=this._loadedParentTiles[t.key];return a&&a.tileID.overscaledZ>=n?a:null}for(let a=t.overscaledZ-1;a>=n;a--){const c=t.scaledTo(a),p=this._getLoadedTile(c);if(p)return p}}_getLoadedTile(t){const n=this._tiles[t.key];return n&&n.hasData()?n:this._cache.getByKey(t.wrapped().key)}updateCacheSize(t){const n=Math.ceil(t.width/this._source.tileSize)+1,a=Math.ceil(t.height/this._source.tileSize)+1,c=Math.floor(n*a*(this._maxTileCacheZoomLevels===null?h.config.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),p=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,c):c;this._cache.setMaxSize(p)}handleWrapJump(t){const n=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);if(this._prevLng=t,n){const a={};for(const c in this._tiles){const p=this._tiles[c];p.tileID=p.tileID.unwrapTo(p.tileID.wrap+n),a[p.tileID.key]=p}this._tiles=a;for(const c in this._timers)clearTimeout(this._timers[c]),delete this._timers[c];for(const c in this._tiles)this._setTileReloadTimer(c,this._tiles[c])}}update(t,n){if(this.transform=t,this.terrain=n,!this._sourceLoaded||this._paused)return;let a;this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?a=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(S=>new h.OverscaledTileID(S.canonical.z,S.wrap,S.canonical.z,S.canonical.x,S.canonical.y)):(a=t.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:n}),this._source.hasTile&&(a=a.filter(S=>this._source.hasTile(S)))):a=[];const c=t.coveringZoomLevel(this._source),p=Math.max(c-jt.maxOverzooming,this._source.minzoom),m=Math.max(c+jt.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const S={};for(const T of a)if(T.canonical.z>this._source.minzoom){const L=T.scaledTo(T.canonical.z-1);S[L.key]=L;const O=T.scaledTo(Math.max(this._source.minzoom,Math.min(T.canonical.z,5)));S[O.key]=O}a=a.concat(Object.values(S))}const y=a.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,y&&this.fire(new h.Event("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const _=this._updateRetainedTiles(a,c);if(In(this._source.type)){const S={},T={},L=Object.keys(_),O=h.exported.now();for(const R of L){const B=_[R],$=this._tiles[R];if(!$||$.fadeEndTime!==0&&$.fadeEndTime<=O)continue;const W=this.findLoadedParent(B,p);W&&(this._addTile(W.tileID),S[W.tileID.key]=W.tileID),T[R]=B}this._retainLoadedChildren(T,c,m,_);for(const R in S)_[R]||(this._coveredTiles[R]=!0,_[R]=S[R]);if(n){const R={},B={};for(const $ of a)this._tiles[$.key].hasData()?R[$.key]=$:B[$.key]=$;for(const $ in B){const W=B[$].children(this._source.maxzoom);this._tiles[W[0].key]&&this._tiles[W[1].key]&&this._tiles[W[2].key]&&this._tiles[W[3].key]&&(R[W[0].key]=_[W[0].key]=W[0],R[W[1].key]=_[W[1].key]=W[1],R[W[2].key]=_[W[2].key]=W[2],R[W[3].key]=_[W[3].key]=W[3],delete B[$])}for(const $ in B){const W=this.findLoadedParent(B[$],this._source.minzoom);if(W){R[W.tileID.key]=_[W.tileID.key]=W.tileID;for(const ne in R)R[ne].isChildOf(W.tileID)&&delete R[ne]}}for(const $ in this._tiles)R[$]||(this._coveredTiles[$]=!0)}}for(const S in _)this._tiles[S].clearFadeHold();const v=h.keysDifference(this._tiles,_);for(const S of v){const T=this._tiles[S];T.hasSymbolBuckets&&!T.holdingForFade()?T.setHoldDuration(this.map._fadeDuration):T.hasSymbolBuckets&&!T.symbolFadeFinished()||this._removeTile(S)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)}_updateRetainedTiles(t,n){const a={},c={},p=Math.max(n-jt.maxOverzooming,this._source.minzoom),m=Math.max(n+jt.maxUnderzooming,this._source.minzoom),y={};for(const _ of t){const v=this._addTile(_);a[_.key]=_,v.hasData()||n<this._source.maxzoom&&(y[_.key]=_)}this._retainLoadedChildren(y,n,m,a);for(const _ of t){let v=this._tiles[_.key];if(v.hasData())continue;if(n+1>this._source.maxzoom){const T=_.children(this._source.maxzoom)[0],L=this.getTile(T);if(L&&L.hasData()){a[T.key]=T;continue}}else{const T=_.children(this._source.maxzoom);if(a[T[0].key]&&a[T[1].key]&&a[T[2].key]&&a[T[3].key])continue}let S=v.wasRequested();for(let T=_.overscaledZ-1;T>=p;--T){const L=_.scaledTo(T);if(c[L.key])break;if(c[L.key]=!0,v=this.getTile(L),!v&&S&&(v=this._addTile(L)),v){const O=v.hasData();if((S||O)&&(a[L.key]=L),S=v.wasRequested(),O)break}}}return a}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const n=[];let a,c=this._tiles[t].tileID;for(;c.overscaledZ>0;){if(c.key in this._loadedParentTiles){a=this._loadedParentTiles[c.key];break}n.push(c.key);const p=c.scaledTo(c.overscaledZ-1);if(a=this._getLoadedTile(p),a)break;c=p}for(const p of n)this._loadedParentTiles[p]=a}}_addTile(t){let n=this._tiles[t.key];if(n)return n;n=this._cache.getAndRemove(t),n&&(this._setTileReloadTimer(t.key,n),n.tileID=t,this._state.initializeTileState(n,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,n)));const a=n;return n||(n=new nn(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(n,this._tileLoaded.bind(this,n,t.key,n.state))),n.uses++,this._tiles[t.key]=n,a||this._source.fire(new h.Event("dataloading",{tile:n,coord:n.tileID,dataType:"source"})),n}_setTileReloadTimer(t,n){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const a=n.getExpiryTimeout();a&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},a))}_removeTile(t){const n=this._tiles[t];n&&(n.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),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))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(t);this._cache.reset()}tilesIn(t,n,a){const c=[],p=this.transform;if(!p)return c;const m=a?p.getCameraQueryGeometry(t):t,y=t.map(R=>p.pointCoordinate(R,this.terrain)),_=m.map(R=>p.pointCoordinate(R,this.terrain)),v=this.getIds();let S=1/0,T=1/0,L=-1/0,O=-1/0;for(const R of _)S=Math.min(S,R.x),T=Math.min(T,R.y),L=Math.max(L,R.x),O=Math.max(O,R.y);for(let R=0;R<v.length;R++){const B=this._tiles[v[R]];if(B.holdingForFade())continue;const $=B.tileID,W=Math.pow(2,p.zoom-B.tileID.overscaledZ),ne=n*B.queryPadding*h.EXTENT/B.tileSize/W,V=[$.getTilePoint(new h.MercatorCoordinate(S,T)),$.getTilePoint(new h.MercatorCoordinate(L,O))];if(V[0].x-ne<h.EXTENT&&V[0].y-ne<h.EXTENT&&V[1].x+ne>=0&&V[1].y+ne>=0){const ie=y.map(fe=>$.getTilePoint(fe)),ae=_.map(fe=>$.getTilePoint(fe));c.push({tile:B,tileID:$,queryGeometry:ie,cameraQueryGeometry:ae,scale:W})}}return c}getVisibleCoordinates(t){const n=this.getRenderableIds(t).map(a=>this._tiles[a].tileID);for(const a of n)a.posMatrix=this.transform.calculatePosMatrix(a.toUnwrapped());return n}hasTransition(){if(this._source.hasTransition())return!0;if(In(this._source.type)){const t=h.exported.now();for(const n in this._tiles)if(this._tiles[n].fadeEndTime>=t)return!0}return!1}setFeatureState(t,n,a){this._state.updateState(t=t||"_geojsonTileLayer",n,a)}removeFeatureState(t,n,a){this._state.removeFeatureState(t=t||"_geojsonTileLayer",n,a)}getFeatureState(t,n){return this._state.getState(t=t||"_geojsonTileLayer",n)}setDependencies(t,n,a){const c=this._tiles[t];c&&c.setDependencies(n,a)}reloadTilesForDependencies(t,n){for(const a in this._tiles)this._tiles[a].hasDependency(t,n)&&this._reloadTile(a,"reloading");this._cache.filter(a=>!a.hasDependency(t,n))}}function sn(o,t){const n=Math.abs(2*o.wrap)-+(o.wrap<0),a=Math.abs(2*t.wrap)-+(t.wrap<0);return o.overscaledZ-t.overscaledZ||a-n||t.canonical.y-o.canonical.y||t.canonical.x-o.canonical.x}function In(o){return o==="raster"||o==="image"||o==="video"}jt.maxOverzooming=10,jt.maxUnderzooming=3;const an="mapboxgl_preloaded_worker_pool";class we{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<we.workerCount;)this.workers.push(new Worker(h.config.WORKER_URL));return this.active[t]=!0,this.workers.slice()}release(t){delete this.active[t],this.numActive()===0&&(this.workers.forEach(n=>{n.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[an]}numActive(){return Object.keys(this.active).length}}const ur=Math.floor(h.exported.hardwareConcurrency/2);let hi;function An(){return hi||(hi=new we),hi}we.workerCount=h.isSafari(globalThis)?Math.max(Math.min(ur,3),1):1;class jr{constructor(t,n){this.reset(t,n)}reset(t,n){this.points=t||[],this._distances=[0];for(let a=1;a<this.points.length;a++)this._distances[a]=this._distances[a-1]+this.points[a].dist(this.points[a-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(t){if(this.points.length===1)return this.points[0];t=h.clamp(t,0,1);let n=1,a=this._distances[n];const c=t*this.paddedLength+this.padding;for(;a<c&&n<this._distances.length;)a=this._distances[++n];const p=n-1,m=this._distances[p],y=a-m,_=y>0?(c-m)/y:0;return this.points[p].mult(1-_).add(this.points[n].mult(_))}}function be(o,t){let n=!0;return o==="always"||o!=="never"&&t!=="never"||(n=!1),n}class it{constructor(t,n,a){const c=this.boxCells=[],p=this.circleCells=[];this.xCellCount=Math.ceil(t/a),this.yCellCount=Math.ceil(n/a);for(let m=0;m<this.xCellCount*this.yCellCount;m++)c.push([]),p.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=n,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/n,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(t,n,a,c,p){this._forEachCell(n,a,c,p,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(n),this.bboxes.push(a),this.bboxes.push(c),this.bboxes.push(p)}insertCircle(t,n,a,c){this._forEachCell(n-c,a-c,n+c,a+c,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(n),this.circles.push(a),this.circles.push(c)}_insertBoxCell(t,n,a,c,p,m){this.boxCells[p].push(m)}_insertCircleCell(t,n,a,c,p,m){this.circleCells[p].push(m)}_query(t,n,a,c,p,m,y){if(a<0||t>this.width||c<0||n>this.height)return[];const _=[];if(t<=0&&n<=0&&this.width<=a&&this.height<=c){if(p)return[{key:null,x1:t,y1:n,x2:a,y2:c}];for(let v=0;v<this.boxKeys.length;v++)_.push({key:this.boxKeys[v],x1:this.bboxes[4*v],y1:this.bboxes[4*v+1],x2:this.bboxes[4*v+2],y2:this.bboxes[4*v+3]});for(let v=0;v<this.circleKeys.length;v++){const S=this.circles[3*v],T=this.circles[3*v+1],L=this.circles[3*v+2];_.push({key:this.circleKeys[v],x1:S-L,y1:T-L,x2:S+L,y2:T+L})}}else this._forEachCell(t,n,a,c,this._queryCell,_,{hitTest:p,overlapMode:m,seenUids:{box:{},circle:{}}},y);return _}query(t,n,a,c){return this._query(t,n,a,c,!1,null)}hitTest(t,n,a,c,p,m){return this._query(t,n,a,c,!0,p,m).length>0}hitTestCircle(t,n,a,c,p){const m=t-a,y=t+a,_=n-a,v=n+a;if(y<0||m>this.width||v<0||_>this.height)return!1;const S=[];return this._forEachCell(m,_,y,v,this._queryCellCircle,S,{hitTest:!0,overlapMode:c,circle:{x:t,y:n,radius:a},seenUids:{box:{},circle:{}}},p),S.length>0}_queryCell(t,n,a,c,p,m,y,_){const{seenUids:v,hitTest:S,overlapMode:T}=y,L=this.boxCells[p];if(L!==null){const R=this.bboxes;for(const B of L)if(!v.box[B]){v.box[B]=!0;const $=4*B,W=this.boxKeys[B];if(t<=R[$+2]&&n<=R[$+3]&&a>=R[$+0]&&c>=R[$+1]&&(!_||_(W))&&(!S||!be(T,W.overlapMode))&&(m.push({key:W,x1:R[$],y1:R[$+1],x2:R[$+2],y2:R[$+3]}),S))return!0}}const O=this.circleCells[p];if(O!==null){const R=this.circles;for(const B of O)if(!v.circle[B]){v.circle[B]=!0;const $=3*B,W=this.circleKeys[B];if(this._circleAndRectCollide(R[$],R[$+1],R[$+2],t,n,a,c)&&(!_||_(W))&&(!S||!be(T,W.overlapMode))){const ne=R[$],V=R[$+1],ie=R[$+2];if(m.push({key:W,x1:ne-ie,y1:V-ie,x2:ne+ie,y2:V+ie}),S)return!0}}}return!1}_queryCellCircle(t,n,a,c,p,m,y,_){const{circle:v,seenUids:S,overlapMode:T}=y,L=this.boxCells[p];if(L!==null){const R=this.bboxes;for(const B of L)if(!S.box[B]){S.box[B]=!0;const $=4*B,W=this.boxKeys[B];if(this._circleAndRectCollide(v.x,v.y,v.radius,R[$+0],R[$+1],R[$+2],R[$+3])&&(!_||_(W))&&!be(T,W.overlapMode))return m.push(!0),!0}}const O=this.circleCells[p];if(O!==null){const R=this.circles;for(const B of O)if(!S.circle[B]){S.circle[B]=!0;const $=3*B,W=this.circleKeys[B];if(this._circlesCollide(R[$],R[$+1],R[$+2],v.x,v.y,v.radius)&&(!_||_(W))&&!be(T,W.overlapMode))return m.push(!0),!0}}}_forEachCell(t,n,a,c,p,m,y,_){const v=this._convertToXCellCoord(t),S=this._convertToYCellCoord(n),T=this._convertToXCellCoord(a),L=this._convertToYCellCoord(c);for(let O=v;O<=T;O++)for(let R=S;R<=L;R++)if(p.call(this,t,n,a,c,this.xCellCount*R+O,m,y,_))return}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,n,a,c,p,m){const y=c-t,_=p-n,v=a+m;return v*v>y*y+_*_}_circleAndRectCollide(t,n,a,c,p,m,y){const _=(m-c)/2,v=Math.abs(t-(c+_));if(v>_+a)return!1;const S=(y-p)/2,T=Math.abs(n-(p+S));if(T>S+a)return!1;if(v<=_||T<=S)return!0;const L=v-_,O=T-S;return L*L+O*O<=a*a}}function et(o,t,n,a,c){const p=h.create();return t?(h.scale(p,p,[1/c,1/c,1]),n||h.rotateZ(p,p,a.angle)):h.multiply(p,a.labelPlaneMatrix,o),p}function Ai(o,t,n,a,c){if(t){const p=h.clone(o);return h.scale(p,p,[c,c,1]),n||h.rotateZ(p,p,-a.angle),p}return a.glCoordMatrix}function Kt(o,t,n){let a;n?(a=[o.x,o.y,n(o.x,o.y),1],h.transformMat4(a,a,t)):(a=[o.x,o.y,0,1],j(a,a,t));const c=a[3];return{point:new h.Point(a[0]/c,a[1]/c),signedDistanceFromCamera:c}}function Je(o,t){return .5+o/t*.5}function Ar(o,t){const n=o[0]/o[3],a=o[1]/o[3];return n>=-t[0]&&n<=t[0]&&a>=-t[1]&&a<=t[1]}function Cr(o,t,n,a,c,p,m,y,_,v){const S=a?o.textSizeData:o.iconSizeData,T=h.evaluateSizeForZoom(S,n.transform.zoom),L=[256/n.width*2+1,256/n.height*2+1],O=a?o.text.dynamicLayoutVertexArray:o.icon.dynamicLayoutVertexArray;O.clear();const R=o.lineVertexArray,B=a?o.text.placedSymbolArray:o.icon.placedSymbolArray,$=n.transform.width/n.transform.height;let W=!1;for(let ne=0;ne<B.length;ne++){const V=B.get(ne);if(V.hidden||V.writingMode===h.WritingMode.vertical&&!W){D(V.numGlyphs,O);continue}let ie;if(W=!1,v?(ie=[V.anchorX,V.anchorY,v(V.anchorX,V.anchorY),1],h.transformMat4(ie,ie,t)):(ie=[V.anchorX,V.anchorY,0,1],j(ie,ie,t)),!Ar(ie,L)){D(V.numGlyphs,O);continue}const ae=Je(n.transform.cameraToCenterDistance,ie[3]),fe=h.evaluateSizeForFeature(S,T,V),_e=m?fe/ae:fe*ae,xe=new h.Point(V.anchorX,V.anchorY),ge=Kt(xe,c,v).point,ke={projections:{},offsets:{}},Ve=ai(V,_e,!1,y,t,c,p,o.glyphOffsetArray,R,O,ge,xe,ke,$,_,v);W=Ve.useVertical,(Ve.notEnoughRoom||W||Ve.needsFlipping&&ai(V,_e,!0,y,t,c,p,o.glyphOffsetArray,R,O,ge,xe,ke,$,_,v).notEnoughRoom)&&D(V.numGlyphs,O)}a?o.text.dynamicLayoutVertexBuffer.updateData(O):o.icon.dynamicLayoutVertexBuffer.updateData(O)}function er(o,t,n,a,c,p,m,y,_,v,S,T,L){const O=y.glyphStartIndex+y.numGlyphs,R=y.lineStartIndex,B=y.lineStartIndex+y.lineLength,$=t.getoffsetX(y.glyphStartIndex),W=t.getoffsetX(O-1),ne=I(o*$,n,a,c,p,m,y.segment,R,B,_,v,S,T,L);if(!ne)return null;const V=I(o*W,n,a,c,p,m,y.segment,R,B,_,v,S,T,L);return V?{first:ne,last:V}:null}function Pr(o,t,n,a){return o===h.WritingMode.horizontal&&Math.abs(n.y-t.y)>Math.abs(n.x-t.x)*a?{useVertical:!0}:(o===h.WritingMode.vertical?t.y<n.y:t.x>n.x)?{needsFlipping:!0}:null}function ai(o,t,n,a,c,p,m,y,_,v,S,T,L,O,R,B){const $=t/24,W=o.lineOffsetX*$,ne=o.lineOffsetY*$;let V;if(o.numGlyphs>1){const ie=o.glyphStartIndex+o.numGlyphs,ae=o.lineStartIndex,fe=o.lineStartIndex+o.lineLength,_e=er($,y,W,ne,n,S,T,o,_,p,L,R,B);if(!_e)return{notEnoughRoom:!0};const xe=Kt(_e.first.point,m,B).point,ge=Kt(_e.last.point,m,B).point;if(a&&!n){const ke=Pr(o.writingMode,xe,ge,O);if(ke)return ke}V=[_e.first];for(let ke=o.glyphStartIndex+1;ke<ie-1;ke++)V.push(I($*y.getoffsetX(ke),W,ne,n,S,T,o.segment,ae,fe,_,p,L,R,B));V.push(_e.last)}else{if(a&&!n){const ae=Kt(T,c,B).point,fe=o.lineStartIndex+o.segment+1,_e=new h.Point(_.getx(fe),_.gety(fe)),xe=Kt(_e,c,B),ge=xe.signedDistanceFromCamera>0?xe.point:Tt(T,_e,ae,1,c,B),ke=Pr(o.writingMode,ae,ge,O);if(ke)return ke}const ie=I($*y.getoffsetX(o.glyphStartIndex),W,ne,n,S,T,o.segment,o.lineStartIndex,o.lineStartIndex+o.lineLength,_,p,L,R,B);if(!ie)return{notEnoughRoom:!0};V=[ie]}for(const ie of V)h.addDynamicAttributes(v,ie.point,ie.angle);return{}}function Tt(o,t,n,a,c,p){const m=Kt(o.add(o.sub(t)._unit()),c,p).point,y=n.sub(m);return n.add(y._mult(a/y.mag()))}function Yn(o,t){const{projectionCache:n,lineVertexArray:a,labelPlaneMatrix:c,tileAnchorPoint:p,distanceFromAnchor:m,getElevation:y,previousVertex:_,direction:v,absOffsetX:S}=t;if(n.projections[o])return n.projections[o];const T=new h.Point(a.getx(o),a.gety(o)),L=Kt(T,c,y);if(L.signedDistanceFromCamera>0)return n.projections[o]=L.point,L.point;const O=o-v;return Tt(m===0?p:new h.Point(a.getx(O),a.gety(O)),T,_,S-m+1,c,y)}function dr(o,t,n){return o._unit()._perp()._mult(t*n)}function N(o,t,n,a,c,p,m,y){const{projectionCache:_,direction:v}=y;if(_.offsets[o])return _.offsets[o];const S=n.add(t);if(o+v<a||o+v>=c)return _.offsets[o]=S,S;const T=Yn(o+v,y),L=dr(T.sub(n),m,v),O=n.add(L),R=T.add(L);return _.offsets[o]=h.findLineIntersection(p,S,O,R)||S,_.offsets[o]}function I(o,t,n,a,c,p,m,y,_,v,S,T,L,O){const R=a?o-t:o+t;let B=R>0?1:-1,$=0;a&&(B*=-1,$=Math.PI),B<0&&($+=Math.PI);let W,ne,V=B>0?y+m:y+m+1,ie=c,ae=c,fe=0,_e=0;const xe=Math.abs(R),ge=[];let ke;for(;fe+_e<=xe;){if(V+=B,V<y||V>=_)return null;fe+=_e,ae=ie,ne=W;const Se={projectionCache:T,lineVertexArray:v,labelPlaneMatrix:S,tileAnchorPoint:p,distanceFromAnchor:fe,getElevation:O,previousVertex:ae,direction:B,absOffsetX:xe};if(ie=Yn(V,Se),n===0)ge.push(ae),ke=ie.sub(ae);else{let Ze;const Le=ie.sub(ae);Ze=Le.mag()===0?dr(Yn(V+B,Se).sub(ie),n,B):dr(Le,n,B),ne||(ne=ae.add(Ze)),W=N(V,Ze,ie,y,_,ne,n,Se),ge.push(ne),ke=W.sub(ne)}_e=ke.mag()}const Ve=ke._mult((xe-fe)/_e)._add(ne||ae),Qe=$+Math.atan2(ie.y-ae.y,ie.x-ae.x);return ge.push(Ve),{point:Ve,angle:L?Qe:0,path:ge}}const P=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function D(o,t){for(let n=0;n<o;n++){const a=t.length;t.resize(a+4),t.float32.set(P,3*a)}}function j(o,t,n){const a=t[0],c=t[1];return o[0]=n[0]*a+n[4]*c+n[12],o[1]=n[1]*a+n[5]*c+n[13],o[3]=n[3]*a+n[7]*c+n[15],o}const q=100;class Y{constructor(t,n=new it(t.width+200,t.height+200,25),a=new it(t.width+200,t.height+200,25)){this.transform=t,this.grid=n,this.ignoredGrid=a,this.pitchfactor=Math.cos(t._pitch)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+q,this.screenBottomBoundary=t.height+q,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(t,n,a,c,p,m){const y=this.projectAndGetPerspectiveRatio(c,t.anchorPointX,t.anchorPointY,m),_=a*y.perspectiveRatio,v=t.x1*_+y.point.x,S=t.y1*_+y.point.y,T=t.x2*_+y.point.x,L=t.y2*_+y.point.y;return!this.isInsideGrid(v,S,T,L)||n!=="always"&&this.grid.hitTest(v,S,T,L,n,p)||y.perspectiveRatio<this.perspectiveRatioCutoff?{box:[],offscreen:!1}:{box:[v,S,T,L],offscreen:this.isOffscreen(v,S,T,L)}}placeCollisionCircles(t,n,a,c,p,m,y,_,v,S,T,L,O,R){const B=[],$=new h.Point(n.anchorX,n.anchorY),W=Kt($,m,R),ne=Je(this.transform.cameraToCenterDistance,W.signedDistanceFromCamera),V=(S?p/ne:p*ne)/h.ONE_EM,ie=Kt($,y,R).point,ae=er(V,c,n.lineOffsetX*V,n.lineOffsetY*V,!1,ie,$,n,a,y,{projections:{},offsets:{}},!1,R);let fe=!1,_e=!1,xe=!0;if(ae){const ge=.5*L*ne+O,ke=new h.Point(-100,-100),Ve=new h.Point(this.screenRightBoundary,this.screenBottomBoundary),Qe=new jr,Se=ae.first,Ze=ae.last;let Le=[];for(let pt=Se.path.length-1;pt>=1;pt--)Le.push(Se.path[pt]);for(let pt=1;pt<Ze.path.length;pt++)Le.push(Ze.path[pt]);const dt=2.5*ge;if(_){const pt=Le.map(tt=>Kt(tt,_,R));Le=pt.some(tt=>tt.signedDistanceFromCamera<=0)?[]:pt.map(tt=>tt.point)}let Nt=[];if(Le.length>0){const pt=Le[0].clone(),tt=Le[0].clone();for(let Bt=1;Bt<Le.length;Bt++)pt.x=Math.min(pt.x,Le[Bt].x),pt.y=Math.min(pt.y,Le[Bt].y),tt.x=Math.max(tt.x,Le[Bt].x),tt.y=Math.max(tt.y,Le[Bt].y);Nt=pt.x>=ke.x&&tt.x<=Ve.x&&pt.y>=ke.y&&tt.y<=Ve.y?[Le]:tt.x<ke.x||pt.x>Ve.x||tt.y<ke.y||pt.y>Ve.y?[]:h.clipLine([Le],ke.x,ke.y,Ve.x,Ve.y)}for(const pt of Nt){Qe.reset(pt,.25*ge);let tt=0;tt=Qe.length<=.5*ge?1:Math.ceil(Qe.paddedLength/dt)+1;for(let Bt=0;Bt<tt;Bt++){const bi=Bt/Math.max(tt-1,1),Vt=Qe.lerp(bi),ei=Vt.x+q,Ri=Vt.y+q;B.push(ei,Ri,ge,0);const ir=ei-ge,rr=Ri-ge,wi=ei+ge,xr=Ri+ge;if(xe=xe&&this.isOffscreen(ir,rr,wi,xr),_e=_e||this.isInsideGrid(ir,rr,wi,xr),t!=="always"&&this.grid.hitTestCircle(ei,Ri,ge,t,T)&&(fe=!0,!v))return{circles:[],offscreen:!1,collisionDetected:fe}}}}return{circles:!v&&fe||!_e||ne<this.perspectiveRatioCutoff?[]:B,offscreen:xe,collisionDetected:fe}}queryRenderedSymbols(t){if(t.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const n=[];let a=1/0,c=1/0,p=-1/0,m=-1/0;for(const S of t){const T=new h.Point(S.x+q,S.y+q);a=Math.min(a,T.x),c=Math.min(c,T.y),p=Math.max(p,T.x),m=Math.max(m,T.y),n.push(T)}const y=this.grid.query(a,c,p,m).concat(this.ignoredGrid.query(a,c,p,m)),_={},v={};for(const S of y){const T=S.key;if(_[T.bucketInstanceId]===void 0&&(_[T.bucketInstanceId]={}),_[T.bucketInstanceId][T.featureIndex])continue;const L=[new h.Point(S.x1,S.y1),new h.Point(S.x2,S.y1),new h.Point(S.x2,S.y2),new h.Point(S.x1,S.y2)];h.polygonIntersectsPolygon(n,L)&&(_[T.bucketInstanceId][T.featureIndex]=!0,v[T.bucketInstanceId]===void 0&&(v[T.bucketInstanceId]=[]),v[T.bucketInstanceId].push(T.featureIndex))}return v}insertCollisionBox(t,n,a,c,p,m){(a?this.ignoredGrid:this.grid).insert({bucketInstanceId:c,featureIndex:p,collisionGroupID:m,overlapMode:n},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,n,a,c,p,m){const y=a?this.ignoredGrid:this.grid,_={bucketInstanceId:c,featureIndex:p,collisionGroupID:m,overlapMode:n};for(let v=0;v<t.length;v+=4)y.insertCircle(_,t[v],t[v+1],t[v+2])}projectAndGetPerspectiveRatio(t,n,a,c){let p;return c?(p=[n,a,c(n,a),1],h.transformMat4(p,p,t)):(p=[n,a,0,1],j(p,p,t)),{point:new h.Point((p[0]/p[3]+1)/2*this.transform.width+q,(-p[1]/p[3]+1)/2*this.transform.height+q),perspectiveRatio:.5+this.transform.cameraToCenterDistance/p[3]*.5}}isOffscreen(t,n,a,c){return a<q||t>=this.screenRightBoundary||c<q||n>this.screenBottomBoundary}isInsideGrid(t,n,a,c){return a>=0&&t<this.gridRightBoundary&&c>=0&&n<this.gridBottomBoundary}getViewportMatrix(){const t=h.identity([]);return h.translate(t,t,[-100,-100,0]),t}}function X(o,t,n){return t*(h.EXTENT/(o.tileSize*Math.pow(2,n-o.tileID.overscaledZ)))}class G{constructor(t,n,a,c){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?n:-n))):c&&a?1:0,this.placed=a}isHidden(){return this.opacity===0&&!this.placed}}class ee{constructor(t,n,a,c,p){this.text=new G(t?t.text:null,n,a,p),this.icon=new G(t?t.icon:null,n,c,p)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class ue{constructor(t,n,a){this.text=t,this.icon=n,this.skipFade=a}}class pe{constructor(){this.invProjMatrix=h.create(),this.viewportMatrix=h.create(),this.circles=[]}}class de{constructor(t,n,a,c,p){this.bucketInstanceId=t,this.featureIndex=n,this.sourceLayerIndex=a,this.bucketIndex=c,this.tileID=p}}class qe{constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}get(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){const n=++this.maxGroupID;this.collisionGroups[t]={ID:n,predicate:a=>a.collisionGroupID===n}}return this.collisionGroups[t]}}function Ye(o,t,n,a,c){const{horizontalAlign:p,verticalAlign:m}=h.getAnchorAlignment(o),y=-(p-.5)*t,_=-(m-.5)*n,v=h.evaluateVariableOffset(o,a);return new h.Point(y+v[0]*c,_+v[1]*c)}function Re(o,t,n,a,c,p){const{x1:m,x2:y,y1:_,y2:v,anchorPointX:S,anchorPointY:T}=o,L=new h.Point(t,n);return a&&L._rotate(c?p:-p),{x1:m+L.x,y1:_+L.y,x2:y+L.x,y2:v+L.y,anchorPointX:S,anchorPointY:T}}class Ne{constructor(t,n,a,c,p){this.transform=t.clone(),this.terrain=n,this.collisionIndex=new Y(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=a,this.retainedQueryData={},this.collisionGroups=new qe(c),this.collisionCircleArrays={},this.prevPlacement=p,p&&(p.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(t,n,a,c){const p=a.getBucket(n),m=a.latestFeatureIndex;if(!p||!m||n.id!==p.layerIds[0])return;const y=a.collisionBoxArray,_=p.layers[0].layout,v=Math.pow(2,this.transform.zoom-a.tileID.overscaledZ),S=a.tileSize/h.EXTENT,T=this.transform.calculatePosMatrix(a.tileID.toUnwrapped()),L=_.get("text-pitch-alignment")==="map",O=_.get("text-rotation-alignment")==="map",R=X(a,1,this.transform.zoom),B=et(T,L,O,this.transform,R);let $=null;if(L){const ne=Ai(T,L,O,this.transform,R);$=h.multiply([],this.transform.labelPlaneMatrix,ne)}this.retainedQueryData[p.bucketInstanceId]=new de(p.bucketInstanceId,m,p.sourceLayerIndex,p.index,a.tileID);const W={bucket:p,layout:_,posMatrix:T,textLabelPlaneMatrix:B,labelToScreenMatrix:$,scale:v,textPixelRatio:S,holdingForFade:a.holdingForFade(),collisionBoxArray:y,partiallyEvaluatedTextSize:h.evaluateSizeForZoom(p.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(p.sourceID)};if(c)for(const ne of p.sortKeyRanges){const{sortKey:V,symbolInstanceStart:ie,symbolInstanceEnd:ae}=ne;t.push({sortKey:V,symbolInstanceStart:ie,symbolInstanceEnd:ae,parameters:W})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:p.symbolInstances.length,parameters:W})}attemptAnchorPlacement(t,n,a,c,p,m,y,_,v,S,T,L,O,R,B,$){const W=[L.textOffset0,L.textOffset1],ne=Ye(t,a,c,W,p),V=this.collisionIndex.placeCollisionBox(Re(n,ne.x,ne.y,m,y,this.transform.angle),T,_,v,S.predicate,$);if((!B||this.collisionIndex.placeCollisionBox(Re(B,ne.x,ne.y,m,y,this.transform.angle),T,_,v,S.predicate,$).box.length!==0)&&V.box.length>0){let ie;if(this.prevPlacement&&this.prevPlacement.variableOffsets[L.crossTileID]&&this.prevPlacement.placements[L.crossTileID]&&this.prevPlacement.placements[L.crossTileID].text&&(ie=this.prevPlacement.variableOffsets[L.crossTileID].anchor),L.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[L.crossTileID]={textOffset:W,width:a,height:c,anchor:t,textBoxScale:p,prevAnchor:ie},this.markUsedJustification(O,t,L,R),O.allowVerticalPlacement&&(this.markUsedOrientation(O,R,L),this.placedOrientations[L.crossTileID]=R),{shift:ne,placedGlyphBoxes:V}}}placeLayerBucketPart(t,n,a){const{bucket:c,layout:p,posMatrix:m,textLabelPlaneMatrix:y,labelToScreenMatrix:_,textPixelRatio:v,holdingForFade:S,collisionBoxArray:T,partiallyEvaluatedTextSize:L,collisionGroup:O}=t.parameters,R=p.get("text-optional"),B=p.get("icon-optional"),$=h.getOverlapMode(p,"text-overlap","text-allow-overlap"),W=$==="always",ne=h.getOverlapMode(p,"icon-overlap","icon-allow-overlap"),V=ne==="always",ie=p.get("text-rotation-alignment")==="map",ae=p.get("text-pitch-alignment")==="map",fe=p.get("icon-text-fit")!=="none",_e=p.get("symbol-z-order")==="viewport-y",xe=W&&(V||!c.hasIconData()||B),ge=V&&(W||!c.hasTextData()||R);!c.collisionArrays&&T&&c.deserializeCollisionBoxes(T);const ke=this.retainedQueryData[c.bucketInstanceId].tileID,Ve=this.terrain?(Se,Ze)=>this.terrain.getElevation(ke,Se,Ze):null,Qe=(Se,Ze)=>{if(n[Se.crossTileID])return;if(S)return void(this.placements[Se.crossTileID]=new ue(!1,!1,!1));let Le=!1,dt=!1,Nt=!0,pt=null,tt={box:null,offscreen:null},Bt={box:null,offscreen:null},bi=null,Vt=null,ei=null,Ri=0,ir=0,rr=0;Ze.textFeatureIndex?Ri=Ze.textFeatureIndex:Se.useRuntimeCollisionCircles&&(Ri=Se.featureIndex),Ze.verticalTextFeatureIndex&&(ir=Ze.verticalTextFeatureIndex);const wi=Ze.textBox;if(wi){const ui=ft=>{let Yt=h.WritingMode.horizontal;if(c.allowVerticalPlacement&&!ft&&this.prevPlacement){const ii=this.prevPlacement.placedOrientations[Se.crossTileID];ii&&(this.placedOrientations[Se.crossTileID]=ii,Yt=ii,this.markUsedOrientation(c,Yt,Se))}return Yt},ti=(ft,Yt)=>{if(c.allowVerticalPlacement&&Se.numVerticalGlyphVertices>0&&Ze.verticalTextBox){for(const ii of c.writingModes)if(ii===h.WritingMode.vertical?(tt=Yt(),Bt=tt):tt=ft(),tt&&tt.box&&tt.box.length)break}else tt=ft()};if(p.get("text-variable-anchor")){let ft=p.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[Se.crossTileID]){const gt=this.prevPlacement.variableOffsets[Se.crossTileID];ft.indexOf(gt.anchor)>0&&(ft=ft.filter(Jt=>Jt!==gt.anchor),ft.unshift(gt.anchor))}const Yt=(gt,Jt,Bi)=>{const la=gt.x2-gt.x1,zr=gt.y2-gt.y1,xc=Se.textBoxScale,bl=fe&&ne==="never"?Jt:null;let It={box:[],offscreen:!1};const oo=$!=="never"?2*ft.length:ft.length;for(let gs=0;gs<oo;++gs){const Dr=this.attemptAnchorPlacement(ft[gs%ft.length],gt,la,zr,xc,ie,ae,v,m,O,gs>=ft.length?$:"never",Se,c,Bi,bl,Ve);if(Dr&&(It=Dr.placedGlyphBoxes,It&&It.box&&It.box.length)){Le=!0,pt=Dr.shift;break}}return It};ti(()=>Yt(wi,Ze.iconBox,h.WritingMode.horizontal),()=>{const gt=Ze.verticalTextBox;return c.allowVerticalPlacement&&!(tt&&tt.box&&tt.box.length)&&Se.numVerticalGlyphVertices>0&&gt?Yt(gt,Ze.verticalIconBox,h.WritingMode.vertical):{box:null,offscreen:null}}),tt&&(Le=tt.box,Nt=tt.offscreen);const ii=ui(tt&&tt.box);if(!Le&&this.prevPlacement){const gt=this.prevPlacement.variableOffsets[Se.crossTileID];gt&&(this.variableOffsets[Se.crossTileID]=gt,this.markUsedJustification(c,gt.anchor,Se,ii))}}else{const ft=(Yt,ii)=>{const gt=this.collisionIndex.placeCollisionBox(Yt,$,v,m,O.predicate,Ve);return gt&&gt.box&&gt.box.length&&(this.markUsedOrientation(c,ii,Se),this.placedOrientations[Se.crossTileID]=ii),gt};ti(()=>ft(wi,h.WritingMode.horizontal),()=>{const Yt=Ze.verticalTextBox;return c.allowVerticalPlacement&&Se.numVerticalGlyphVertices>0&&Yt?ft(Yt,h.WritingMode.vertical):{box:null,offscreen:null}}),ui(tt&&tt.box&&tt.box.length)}}if(bi=tt,Le=bi&&bi.box&&bi.box.length>0,Nt=bi&&bi.offscreen,Se.useRuntimeCollisionCircles){const ui=c.text.placedSymbolArray.get(Se.centerJustifiedTextSymbolIndex),ti=h.evaluateSizeForFeature(c.textSizeData,L,ui),ft=p.get("text-padding");Vt=this.collisionIndex.placeCollisionCircles($,ui,c.lineVertexArray,c.glyphOffsetArray,ti,m,y,_,a,ae,O.predicate,Se.collisionCircleDiameter,ft,Ve),Vt.circles.length&&Vt.collisionDetected&&!a&&h.warnOnce("Collisions detected, but collision boxes are not shown"),Le=W||Vt.circles.length>0&&!Vt.collisionDetected,Nt=Nt&&Vt.offscreen}if(Ze.iconFeatureIndex&&(rr=Ze.iconFeatureIndex),Ze.iconBox){const ui=ti=>{const ft=fe&&pt?Re(ti,pt.x,pt.y,ie,ae,this.transform.angle):ti;return this.collisionIndex.placeCollisionBox(ft,ne,v,m,O.predicate,Ve)};Bt&&Bt.box&&Bt.box.length&&Ze.verticalIconBox?(ei=ui(Ze.verticalIconBox),dt=ei.box.length>0):(ei=ui(Ze.iconBox),dt=ei.box.length>0),Nt=Nt&&ei.offscreen}const xr=R||Se.numHorizontalGlyphVertices===0&&Se.numVerticalGlyphVertices===0,ms=B||Se.numIconVertices===0;if(xr||ms?ms?xr||(dt=dt&&Le):Le=dt&&Le:dt=Le=dt&&Le,Le&&bi&&bi.box&&this.collisionIndex.insertCollisionBox(bi.box,$,p.get("text-ignore-placement"),c.bucketInstanceId,Bt&&Bt.box&&ir?ir:Ri,O.ID),dt&&ei&&this.collisionIndex.insertCollisionBox(ei.box,ne,p.get("icon-ignore-placement"),c.bucketInstanceId,rr,O.ID),Vt&&(Le&&this.collisionIndex.insertCollisionCircles(Vt.circles,$,p.get("text-ignore-placement"),c.bucketInstanceId,Ri,O.ID),a)){const ui=c.bucketInstanceId;let ti=this.collisionCircleArrays[ui];ti===void 0&&(ti=this.collisionCircleArrays[ui]=new pe);for(let ft=0;ft<Vt.circles.length;ft+=4)ti.circles.push(Vt.circles[ft+0]),ti.circles.push(Vt.circles[ft+1]),ti.circles.push(Vt.circles[ft+2]),ti.circles.push(Vt.collisionDetected?1:0)}if(Se.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(c.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[Se.crossTileID]=new ue(Le||xe,dt||ge,Nt||c.justReloaded),n[Se.crossTileID]=!0};if(_e){if(t.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const Se=c.getSortedSymbolIndexes(this.transform.angle);for(let Ze=Se.length-1;Ze>=0;--Ze){const Le=Se[Ze];Qe(c.symbolInstances.get(Le),c.collisionArrays[Le])}}else for(let Se=t.symbolInstanceStart;Se<t.symbolInstanceEnd;Se++)Qe(c.symbolInstances.get(Se),c.collisionArrays[Se]);if(a&&c.bucketInstanceId in this.collisionCircleArrays){const Se=this.collisionCircleArrays[c.bucketInstanceId];h.invert(Se.invProjMatrix,m),Se.viewportMatrix=this.collisionIndex.getViewportMatrix()}c.justReloaded=!1}markUsedJustification(t,n,a,c){let p;p=c===h.WritingMode.vertical?a.verticalPlacedTextSymbolIndex:{left:a.leftJustifiedTextSymbolIndex,center:a.centerJustifiedTextSymbolIndex,right:a.rightJustifiedTextSymbolIndex}[h.getAnchorJustification(n)];const m=[a.leftJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.rightJustifiedTextSymbolIndex,a.verticalPlacedTextSymbolIndex];for(const y of m)y>=0&&(t.text.placedSymbolArray.get(y).crossTileID=p>=0&&y!==p?0:a.crossTileID)}markUsedOrientation(t,n,a){const c=n===h.WritingMode.horizontal||n===h.WritingMode.horizontalOnly?n:0,p=n===h.WritingMode.vertical?n:0,m=[a.leftJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.rightJustifiedTextSymbolIndex];for(const y of m)t.text.placedSymbolArray.get(y).placedOrientation=c;a.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(a.verticalPlacedTextSymbolIndex).placedOrientation=p)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const n=this.prevPlacement;let a=!1;this.prevZoomAdjustment=n?n.zoomAdjustment(this.transform.zoom):0;const c=n?n.symbolFadeChange(t):1,p=n?n.opacities:{},m=n?n.variableOffsets:{},y=n?n.placedOrientations:{};for(const _ in this.placements){const v=this.placements[_],S=p[_];S?(this.opacities[_]=new ee(S,c,v.text,v.icon),a=a||v.text!==S.text.placed||v.icon!==S.icon.placed):(this.opacities[_]=new ee(null,c,v.text,v.icon,v.skipFade),a=a||v.text||v.icon)}for(const _ in p){const v=p[_];if(!this.opacities[_]){const S=new ee(v,c,!1,!1);S.isHidden()||(this.opacities[_]=S,a=a||v.text.placed||v.icon.placed)}}for(const _ in m)this.variableOffsets[_]||!this.opacities[_]||this.opacities[_].isHidden()||(this.variableOffsets[_]=m[_]);for(const _ in y)this.placedOrientations[_]||!this.opacities[_]||this.opacities[_].isHidden()||(this.placedOrientations[_]=y[_]);if(n&&n.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");a?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=n?n.lastPlacementChangeTime:t)}updateLayerOpacities(t,n){const a={};for(const c of n){const p=c.getBucket(t);p&&c.latestFeatureIndex&&t.id===p.layerIds[0]&&this.updateBucketOpacities(p,a,c.collisionBoxArray)}}updateBucketOpacities(t,n,a){t.hasTextData()&&(t.text.opacityVertexArray.clear(),t.text.hasVisibleVertices=!1),t.hasIconData()&&(t.icon.opacityVertexArray.clear(),t.icon.hasVisibleVertices=!1),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();const c=t.layers[0].layout,p=new ee(null,0,!1,!1,!0),m=c.get("text-allow-overlap"),y=c.get("icon-allow-overlap"),_=c.get("text-variable-anchor"),v=c.get("text-rotation-alignment")==="map",S=c.get("text-pitch-alignment")==="map",T=c.get("icon-text-fit")!=="none",L=new ee(null,0,m&&(y||!t.hasIconData()||c.get("icon-optional")),y&&(m||!t.hasTextData()||c.get("text-optional")),!0);!t.collisionArrays&&a&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(a);const O=(R,B,$)=>{for(let W=0;W<B/4;W++)R.opacityVertexArray.emplaceBack($);R.hasVisibleVertices=R.hasVisibleVertices||$!==oi};for(let R=0;R<t.symbolInstances.length;R++){const B=t.symbolInstances.get(R),{numHorizontalGlyphVertices:$,numVerticalGlyphVertices:W,crossTileID:ne}=B;let V=this.opacities[ne];n[ne]?V=p:V||(V=L,this.opacities[ne]=V),n[ne]=!0;const ie=B.numIconVertices>0,ae=this.placedOrientations[B.crossTileID],fe=ae===h.WritingMode.vertical,_e=ae===h.WritingMode.horizontal||ae===h.WritingMode.horizontalOnly;if($>0||W>0){const xe=qr(V.text);O(t.text,$,fe?oi:xe),O(t.text,W,_e?oi:xe);const ge=V.text.isHidden();[B.rightJustifiedTextSymbolIndex,B.centerJustifiedTextSymbolIndex,B.leftJustifiedTextSymbolIndex].forEach(Qe=>{Qe>=0&&(t.text.placedSymbolArray.get(Qe).hidden=ge||fe?1:0)}),B.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(B.verticalPlacedTextSymbolIndex).hidden=ge||_e?1:0);const ke=this.variableOffsets[B.crossTileID];ke&&this.markUsedJustification(t,ke.anchor,B,ae);const Ve=this.placedOrientations[B.crossTileID];Ve&&(this.markUsedJustification(t,"left",B,Ve),this.markUsedOrientation(t,Ve,B))}if(ie){const xe=qr(V.icon),ge=!(T&&B.verticalPlacedIconSymbolIndex&&fe);B.placedIconSymbolIndex>=0&&(O(t.icon,B.numIconVertices,ge?xe:oi),t.icon.placedSymbolArray.get(B.placedIconSymbolIndex).hidden=V.icon.isHidden()),B.verticalPlacedIconSymbolIndex>=0&&(O(t.icon,B.numVerticalIconVertices,ge?oi:xe),t.icon.placedSymbolArray.get(B.verticalPlacedIconSymbolIndex).hidden=V.icon.isHidden())}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const xe=t.collisionArrays[R];if(xe){let ge=new h.Point(0,0);if(xe.textBox||xe.verticalTextBox){let Ve=!0;if(_){const Qe=this.variableOffsets[ne];Qe?(ge=Ye(Qe.anchor,Qe.width,Qe.height,Qe.textOffset,Qe.textBoxScale),v&&ge._rotate(S?this.transform.angle:-this.transform.angle)):Ve=!1}xe.textBox&&He(t.textCollisionBox.collisionVertexArray,V.text.placed,!Ve||fe,ge.x,ge.y),xe.verticalTextBox&&He(t.textCollisionBox.collisionVertexArray,V.text.placed,!Ve||_e,ge.x,ge.y)}const ke=!!(!_e&&xe.verticalIconBox);xe.iconBox&&He(t.iconCollisionBox.collisionVertexArray,V.icon.placed,ke,T?ge.x:0,T?ge.y:0),xe.verticalIconBox&&He(t.iconCollisionBox.collisionVertexArray,V.icon.placed,!ke,T?ge.x:0,T?ge.y:0)}}}if(t.sortFeatures(this.transform.angle),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.text.opacityVertexArray.length!==t.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${t.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${t.text.layoutVertexArray.length}) / 4`);if(t.icon.opacityVertexArray.length!==t.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${t.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${t.icon.layoutVertexArray.length}) / 4`);if(t.bucketInstanceId in this.collisionCircleArrays){const R=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=R.invProjMatrix,t.placementViewportMatrix=R.viewportMatrix,t.collisionCircleArray=R.circles,delete this.collisionCircleArrays[t.bucketInstanceId]}}symbolFadeChange(t){return this.fadeDuration===0?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(t,n){const a=this.zoomAtLastRecencyCheck===n?1-this.zoomAdjustment(n):1;return this.zoomAtLastRecencyCheck=n,this.commitTime+this.fadeDuration*a>t}setStale(){this.stale=!0}}function He(o,t,n,a,c){o.emplaceBack(t?1:0,n?1:0,a||0,c||0),o.emplaceBack(t?1:0,n?1:0,a||0,c||0),o.emplaceBack(t?1:0,n?1:0,a||0,c||0),o.emplaceBack(t?1:0,n?1:0,a||0,c||0)}const lt=Math.pow(2,25),rt=Math.pow(2,24),ht=Math.pow(2,17),bt=Math.pow(2,16),qt=Math.pow(2,9),We=Math.pow(2,8),zt=Math.pow(2,1);function qr(o){if(o.opacity===0&&!o.placed)return 0;if(o.opacity===1&&o.placed)return 4294967295;const t=o.placed?1:0,n=Math.floor(127*o.opacity);return n*lt+t*rt+n*ht+t*bt+n*qt+t*We+n*zt+t}const oi=0;class Li{constructor(t){this._sortAcrossTiles=t.layout.get("symbol-z-order")!=="viewport-y"&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,n,a,c,p){const m=this._bucketParts;for(;this._currentTileIndex<t.length;)if(n.getBucketParts(m,c,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,p())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,m.sort((y,_)=>y.sortKey-_.sortKey));this._currentPartIndex<m.length;)if(n.placeLayerBucketPart(m[this._currentPartIndex],this._seenCrossTileIDs,a),this._currentPartIndex++,p())return!0;return!1}}class Xi{constructor(t,n,a,c,p,m,y,_){this.placement=new Ne(t,n,m,y,_),this._currentPlacementIndex=a.length-1,this._forceFullPlacement=c,this._showCollisionBoxes=p,this._done=!1}isDone(){return this._done}continuePlacement(t,n,a){const c=h.exported.now(),p=()=>!this._forceFullPlacement&&h.exported.now()-c>2;for(;this._currentPlacementIndex>=0;){const m=n[t[this._currentPlacementIndex]],y=this.placement.collisionIndex.transform.zoom;if(m.type==="symbol"&&(!m.minzoom||m.minzoom<=y)&&(!m.maxzoom||m.maxzoom>y)){if(this._inProgressLayer||(this._inProgressLayer=new Li(m)),this._inProgressLayer.continuePlacement(a[m.source],this.placement,this._showCollisionBoxes,m,p))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const Cn=512/h.EXTENT/2;class Ss{constructor(t,n,a){this.tileID=t,this.bucketInstanceId=a,this._symbolsByKey={};const c=new Map;for(let p=0;p<n.length;p++){const m=n.get(p),y=m.key,_=c.get(y);_?_.push(m):c.set(y,[m])}for(const[p,m]of c){const y={positions:m.map(_=>({x:Math.floor(_.anchorX*Cn),y:Math.floor(_.anchorY*Cn)})),crossTileIDs:m.map(_=>_.crossTileID)};if(y.positions.length>128){const _=new h.KDBush(y.positions.length,16,Uint16Array);for(const{x:v,y:S}of y.positions)_.add(v,S);_.finish(),delete y.positions,y.index=_}this._symbolsByKey[p]=y}}getScaledCoordinates(t,n){const{x:a,y:c,z:p}=this.tileID.canonical,{x:m,y,z:_}=n.canonical,v=Cn/Math.pow(2,_-p),S=(y*h.EXTENT+t.anchorY)*v,T=c*h.EXTENT*Cn;return{x:Math.floor((m*h.EXTENT+t.anchorX)*v-a*h.EXTENT*Cn),y:Math.floor(S-T)}}findMatches(t,n,a){const c=this.tileID.canonical.z<n.canonical.z?1:Math.pow(2,this.tileID.canonical.z-n.canonical.z);for(let p=0;p<t.length;p++){const m=t.get(p);if(m.crossTileID)continue;const y=this._symbolsByKey[m.key];if(!y)continue;const _=this.getScaledCoordinates(m,n);if(y.index){const v=y.index.range(_.x-c,_.y-c,_.x+c,_.y+c).sort();for(const S of v){const T=y.crossTileIDs[S];if(!a[T]){a[T]=!0,m.crossTileID=T;break}}}else if(y.positions)for(let v=0;v<y.positions.length;v++){const S=y.positions[v],T=y.crossTileIDs[v];if(Math.abs(S.x-_.x)<=c&&Math.abs(S.y-_.y)<=c&&!a[T]){a[T]=!0,m.crossTileID=T;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:t})=>t)}}class Gt{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Jn{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const n=Math.round((t-this.lng)/360);if(n!==0)for(const a in this.indexes){const c=this.indexes[a],p={};for(const m in c){const y=c[m];y.tileID=y.tileID.unwrapTo(y.tileID.wrap+n),p[y.tileID.key]=y}this.indexes[a]=p}this.lng=t}addBucket(t,n,a){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===n.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let p=0;p<n.symbolInstances.length;p++)n.symbolInstances.get(p).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]={});const c=this.usedCrossTileIDs[t.overscaledZ];for(const p in this.indexes){const m=this.indexes[p];if(Number(p)>t.overscaledZ)for(const y in m){const _=m[y];_.tileID.isChildOf(t)&&_.findMatches(n.symbolInstances,t,c)}else{const y=m[t.scaledTo(Number(p)).key];y&&y.findMatches(n.symbolInstances,t,c)}}for(let p=0;p<n.symbolInstances.length;p++){const m=n.symbolInstances.get(p);m.crossTileID||(m.crossTileID=a.generate(),c[m.crossTileID]=!0)}return this.indexes[t.overscaledZ]===void 0&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new Ss(t,n.symbolInstances,n.bucketInstanceId),!0}removeBucketCrossTileIDs(t,n){for(const a of n.getCrossTileIDsLists())for(const c of a)delete this.usedCrossTileIDs[t][c]}removeStaleBuckets(t){let n=!1;for(const a in this.indexes){const c=this.indexes[a];for(const p in c)t[c[p].bucketInstanceId]||(this.removeBucketCrossTileIDs(a,c[p]),delete c[p],n=!0)}return n}}class Gr{constructor(){this.layerIndexes={},this.crossTileIDs=new Gt,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,n,a){let c=this.layerIndexes[t.id];c===void 0&&(c=this.layerIndexes[t.id]=new Jn);let p=!1;const m={};c.handleWrapJump(a);for(const y of n){const _=y.getBucket(t);_&&t.id===_.layerIds[0]&&(_.bucketInstanceId||(_.bucketInstanceId=++this.maxBucketInstanceId),c.addBucket(y.tileID,_,this.crossTileIDs)&&(p=!0),m[_.bucketInstanceId]=!0)}return c.removeStaleBuckets(m)&&(p=!0),p}pruneUnusedLayers(t){const n={};t.forEach(a=>{n[a]=!0});for(const a in this.layerIndexes)n[a]||delete this.layerIndexes[a]}}const Ot=(o,t)=>h.emitValidationErrors(o,t&&t.filter(n=>n.identifier!=="source.canvas")),Es=h.pick(h.operations,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setGlyphs","setSprite"]),tr=h.pick(h.operations,["setCenter","setZoom","setBearing","setPitch"]),Uo=h.emptyStyle();class li extends h.Evented{constructor(t,n={}){super(),this.map=t,this.dispatcher=new vi(An(),this,t._getMapId()),this.imageManager=new qi,this.imageManager.setEventedParent(this),this.glyphManager=new Sr(t._requestManager,n.localIdeographFontFamily),this.lineAtlas=new Nr(256,512),this.crossTileSymbolIndex=new Gr,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new h.ZoomHistory,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",h.getReferrer());const a=this;this._rtlTextPluginCallback=li.registerForPluginStateChange(c=>{a.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:c.pluginStatus,pluginURL:c.pluginURL},(p,m)=>{if(h.triggerPluginCompletionEvent(p),m&&m.every(y=>y))for(const y in a.sourceCaches){const _=a.sourceCaches[y].getSource().type;_!=="vector"&&_!=="geojson"||a.sourceCaches[y].reload()}})}),this.on("data",c=>{if(c.dataType!=="source"||c.sourceDataType!=="metadata")return;const p=this.sourceCaches[c.sourceId];if(!p)return;const m=p.getSource();if(m&&m.vectorLayerIds)for(const y in this._layers){const _=this._layers[y];_.source===m.id&&this._validateLayer(_)}})}loadURL(t,n={},a){this.fire(new h.Event("dataloading",{dataType:"style"})),n.validate=typeof n.validate!="boolean"||n.validate;const c=this.map._requestManager.transformRequest(t,Ct.Style);this._request=h.getJSON(c,(p,m)=>{this._request=null,p?this.fire(new h.ErrorEvent(p)):m&&this._load(m,n,a)})}loadJSON(t,n={},a){this.fire(new h.Event("dataloading",{dataType:"style"})),this._request=h.exported.frame(()=>{this._request=null,n.validate=n.validate!==!1,this._load(t,n,a)})}loadEmpty(){this.fire(new h.Event("dataloading",{dataType:"style"})),this._load(Uo,{validate:!1})}_load(t,n,a){const c=n.transformStyle?n.transformStyle(a,t):t;if(!n.validate||!Ot(this,h.validateStyle(c))){this._loaded=!0,this.stylesheet=c;for(const p in c.sources)this.addSource(p,c.sources[p],{validate:!1});c.sprite?this._loadSprite(c.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(c.glyphs),this._createLayers(),this.light=new Wn(this.stylesheet.light),this.map.setTerrain(this.stylesheet.terrain),this.fire(new h.Event("data",{dataType:"style"})),this.fire(new h.Event("style.load"))}}_createLayers(){const t=h.derefLayers(this.stylesheet.layers);this.dispatcher.broadcast("setLayers",t),this._order=t.map(n=>n.id),this._layers={},this._serializedLayers=null;for(const n of t){const a=h.createStyleLayer(n);a.setEventedParent(this,{layer:{id:n.id}}),this._layers[n.id]=a}}_loadSprite(t,n=!1,a=void 0){this.imageManager.setLoaded(!1),this._spriteRequest=function(c,p,m,y){const _=Qr(c),v=_.length,S=m>1?"@2x":"",T={},L={},O={};for(const{id:R,url:B}of _){const $=p.transformRequest(p.normalizeSpriteURL(B,S,".json"),Ct.SpriteJSON),W=`${R}_${$.url}`;T[W]=h.getJSON($,(ie,ae)=>{delete T[W],L[R]=ae,ci(y,L,O,ie,v)});const ne=p.transformRequest(p.normalizeSpriteURL(B,S,".png"),Ct.SpriteImage),V=`${R}_${ne.url}`;T[V]=hr.getImage(ne,(ie,ae)=>{delete T[V],O[R]=ae,ci(y,L,O,ie,v)})}return{cancel(){for(const R of Object.values(T))R.cancel()}}}(t,this.map._requestManager,this.map.getPixelRatio(),(c,p)=>{if(this._spriteRequest=null,c)this.fire(new h.ErrorEvent(c));else if(p)for(const m in p){this._spritesImagesIds[m]=[];const y=this._spritesImagesIds[m]?this._spritesImagesIds[m].filter(_=>!(_ in p)):[];for(const _ of y)this.imageManager.removeImage(_),this._changedImages[_]=!0;for(const _ in p[m]){const v=m==="default"?_:`${m}:${_}`;this._spritesImagesIds[m].push(v),v in this.imageManager.images?this.imageManager.updateImage(v,p[m][_],!1):this.imageManager.addImage(v,p[m][_]),n&&(this._changedImages[v]=!0)}}this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),n&&(this._changed=!0),this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new h.Event("data",{dataType:"style"})),a&&a(c)})}_unloadSprite(){for(const t of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(t),this._changedImages[t]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new h.Event("data",{dataType:"style"}))}_validateLayer(t){const n=this.sourceCaches[t.source];if(!n)return;const a=t.sourceLayer;if(!a)return;const c=n.getSource();(c.type==="geojson"||c.vectorLayerIds&&c.vectorLayerIds.indexOf(a)===-1)&&this.fire(new h.ErrorEvent(new Error(`Source layer "${a}" does not exist on source "${c.id}" as specified by style layer "${t.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(t){const n=this._serializedAllLayers();if(!t||t.length===0)return Object.values(n);const a=[];for(const c of t)n[c]&&a.push(n[c]);return a}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;t=this._serializedLayers={};const n=Object.keys(this._layers);for(const a of n){const c=this._layers[a];c.type!=="custom"&&(t[a]=c.serialize())}return t}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(const t in this.sourceCaches)if(this.sourceCaches[t].hasTransition())return!0;for(const t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(t){if(!this._loaded)return;const n=this._changed;if(this._changed){const c=Object.keys(this._updatedLayers),p=Object.keys(this._removedLayers);(c.length||p.length)&&this._updateWorkerLayers(c,p);for(const m in this._updatedSources){const y=this._updatedSources[m];if(y==="reload")this._reloadSource(m);else{if(y!=="clear")throw new Error(`Invalid action ${y}`);this._clearSource(m)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const m in this._updatedPaintProps)this._layers[m].updateTransitions(t);this.light.updateTransitions(t),this._resetUpdates()}const a={};for(const c in this.sourceCaches){const p=this.sourceCaches[c];a[c]=p.used,p.used=!1}for(const c of this._order){const p=this._layers[c];p.recalculate(t,this._availableImages),!p.isHidden(t.zoom)&&p.source&&(this.sourceCaches[p.source].used=!0)}for(const c in a){const p=this.sourceCaches[c];a[c]!==p.used&&p.fire(new h.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:c}))}this.light.recalculate(t),this.z=t.zoom,n&&this.fire(new h.Event("data",{dataType:"style"}))}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const n in this.sourceCaches)this.sourceCaches[n].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const t in this.sourceCaches)this.sourceCaches[t].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(t,n){this.dispatcher.broadcast("updateLayers",{layers:this._serializeByIds(t),removedIds:n})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(t,n={}){this._checkLoaded();const a=this.serialize();if(t=n.transformStyle?n.transformStyle(a,t):t,Ot(this,h.validateStyle(t)))return!1;(t=h.clone$1(t)).layers=h.derefLayers(t.layers);const c=h.diffStyles(a,t).filter(m=>!(m.command in tr));if(c.length===0)return!1;const p=c.filter(m=>!(m.command in Es));if(p.length>0)throw new Error(`Unimplemented: ${p.map(m=>m.command).join(", ")}.`);for(const m of c)m.command!=="setTransition"&&this[m.command].apply(this,m.args);return this.stylesheet=t,!0}addImage(t,n){if(this.getImage(t))return this.fire(new h.ErrorEvent(new Error(`An image named "${t}" already exists.`)));this.imageManager.addImage(t,n),this._afterImageUpdated(t)}updateImage(t,n){this.imageManager.updateImage(t,n)}getImage(t){return this.imageManager.getImage(t)}removeImage(t){if(!this.getImage(t))return this.fire(new h.ErrorEvent(new Error(`An image named "${t}" does not exist.`)));this.imageManager.removeImage(t),this._afterImageUpdated(t)}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new h.Event("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,n,a={}){if(this._checkLoaded(),this.sourceCaches[t]!==void 0)throw new Error(`Source "${t}" 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(h.validateStyle.source,`sources.${t}`,n,null,a))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);const c=this.sourceCaches[t]=new jt(t,n,this.dispatcher);c.style=this,c.setEventedParent(this,()=>({isSourceLoaded:c.loaded(),source:c.serialize(),sourceId:t})),c.onAdd(this.map),this._changed=!0}removeSource(t){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error("There is no source with this ID");for(const a in this._layers)if(this._layers[a].source===t)return this.fire(new h.ErrorEvent(new Error(`Source "${t}" cannot be removed while layer "${a}" is using it.`)));const n=this.sourceCaches[t];delete this.sourceCaches[t],delete this._updatedSources[t],n.fire(new h.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:t})),n.setEventedParent(null),n.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,n){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error(`There is no source with this ID=${t}`);const a=this.sourceCaches[t].getSource();if(a.type!=="geojson")throw new Error(`geojsonSource.type is ${a.type}, which is !== 'geojson`);a.setData(n),this._changed=!0}getSource(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()}addLayer(t,n,a={}){this._checkLoaded();const c=t.id;if(this.getLayer(c))return void this.fire(new h.ErrorEvent(new Error(`Layer "${c}" already exists on this map.`)));let p;if(t.type==="custom"){if(Ot(this,h.validateCustomStyleLayer(t)))return;p=h.createStyleLayer(t)}else{if(typeof t.source=="object"&&(this.addSource(c,t.source),t=h.clone$1(t),t=h.extend(t,{source:c})),this._validate(h.validateStyle.layer,`layers.${c}`,t,{arrayIndex:-1},a))return;p=h.createStyleLayer(t),this._validateLayer(p),p.setEventedParent(this,{layer:{id:c}})}const m=n?this._order.indexOf(n):this._order.length;if(n&&m===-1)this.fire(new h.ErrorEvent(new Error(`Cannot add layer "${c}" before non-existing layer "${n}".`)));else{if(this._order.splice(m,0,c),this._layerOrderChanged=!0,this._layers[c]=p,this._removedLayers[c]&&p.source&&p.type!=="custom"){const y=this._removedLayers[c];delete this._removedLayers[c],y.type!==p.type?this._updatedSources[p.source]="clear":(this._updatedSources[p.source]="reload",this.sourceCaches[p.source].pause())}this._updateLayer(p),p.onAdd&&p.onAdd(this.map)}}moveLayer(t,n){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new h.ErrorEvent(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===n)return;const a=this._order.indexOf(t);this._order.splice(a,1);const c=n?this._order.indexOf(n):this._order.length;n&&c===-1?this.fire(new h.ErrorEvent(new Error(`Cannot move layer "${t}" before non-existing layer "${n}".`))):(this._order.splice(c,0,t),this._layerOrderChanged=!0)}removeLayer(t){this._checkLoaded();const n=this._layers[t];if(!n)return void this.fire(new h.ErrorEvent(new Error(`Cannot remove non-existing layer "${t}".`)));n.setEventedParent(null);const a=this._order.indexOf(t);this._order.splice(a,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=n,delete this._layers[t],this._serializedLayers&&delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],n.onRemove&&n.onRemove(this.map)}getLayer(t){return this._layers[t]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,n,a){this._checkLoaded();const c=this.getLayer(t);c?c.minzoom===n&&c.maxzoom===a||(n!=null&&(c.minzoom=n),a!=null&&(c.maxzoom=a),this._updateLayer(c)):this.fire(new h.ErrorEvent(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,n,a={}){this._checkLoaded();const c=this.getLayer(t);if(c){if(!h.deepEqual(c.filter,n))return n==null?(c.filter=void 0,void this._updateLayer(c)):void(this._validate(h.validateStyle.filter,`layers.${c.id}.filter`,n,null,a)||(c.filter=h.clone$1(n),this._updateLayer(c)))}else this.fire(new h.ErrorEvent(new Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return h.clone$1(this.getLayer(t).filter)}setLayoutProperty(t,n,a,c={}){this._checkLoaded();const p=this.getLayer(t);p?h.deepEqual(p.getLayoutProperty(n),a)||(p.setLayoutProperty(n,a,c),this._updateLayer(p)):this.fire(new h.ErrorEvent(new Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,n){const a=this.getLayer(t);if(a)return a.getLayoutProperty(n);this.fire(new h.ErrorEvent(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,n,a,c={}){this._checkLoaded();const p=this.getLayer(t);p?h.deepEqual(p.getPaintProperty(n),a)||(p.setPaintProperty(n,a,c)&&this._updateLayer(p),this._changed=!0,this._updatedPaintProps[t]=!0):this.fire(new h.ErrorEvent(new Error(`Cannot style non-existing layer "${t}".`)))}getPaintProperty(t,n){return this.getLayer(t).getPaintProperty(n)}setFeatureState(t,n){this._checkLoaded();const a=t.source,c=t.sourceLayer,p=this.sourceCaches[a];if(p===void 0)return void this.fire(new h.ErrorEvent(new Error(`The source '${a}' does not exist in the map's style.`)));const m=p.getSource().type;m==="geojson"&&c?this.fire(new h.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):m!=="vector"||c?(t.id===void 0&&this.fire(new h.ErrorEvent(new Error("The feature id parameter must be provided."))),p.setFeatureState(c,t.id,n)):this.fire(new h.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(t,n){this._checkLoaded();const a=t.source,c=this.sourceCaches[a];if(c===void 0)return void this.fire(new h.ErrorEvent(new Error(`The source '${a}' does not exist in the map's style.`)));const p=c.getSource().type,m=p==="vector"?t.sourceLayer:void 0;p!=="vector"||m?n&&typeof t.id!="string"&&typeof t.id!="number"?this.fire(new h.ErrorEvent(new Error("A feature id is required to remove its specific state property."))):c.removeFeatureState(m,t.id,n):this.fire(new h.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();const n=t.source,a=t.sourceLayer,c=this.sourceCaches[n];if(c!==void 0)return c.getSource().type!=="vector"||a?(t.id===void 0&&this.fire(new h.ErrorEvent(new Error("The feature id parameter must be provided."))),c.getFeatureState(a,t.id)):void this.fire(new h.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new h.ErrorEvent(new Error(`The source '${n}' does not exist in the map's style.`)))}getTransition(){return h.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){const t=h.mapObject(this.sourceCaches,c=>c.serialize()),n=this._serializeByIds(this._order),a=this.stylesheet;return h.filterObject({version:a.version,name:a.name,metadata:a.metadata,light:a.light,center:a.center,zoom:a.zoom,bearing:a.bearing,pitch:a.pitch,sprite:a.sprite,glyphs:a.glyphs,transition:a.transition,sources:t,layers:n},c=>c!==void 0)}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&this.sourceCaches[t.source].getSource().type!=="raster"&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(t){const n=m=>this._layers[m].type==="fill-extrusion",a={},c=[];for(let m=this._order.length-1;m>=0;m--){const y=this._order[m];if(n(y)){a[y]=m;for(const _ of t){const v=_[y];if(v)for(const S of v)c.push(S)}}}c.sort((m,y)=>y.intersectionZ-m.intersectionZ);const p=[];for(let m=this._order.length-1;m>=0;m--){const y=this._order[m];if(n(y))for(let _=c.length-1;_>=0;_--){const v=c[_].feature;if(a[v.layer.id]<m)break;p.push(v),c.pop()}else for(const _ of t){const v=_[y];if(v)for(const S of v)p.push(S.feature)}}return p}queryRenderedFeatures(t,n,a){n&&n.filter&&this._validate(h.validateStyle.filter,"queryRenderedFeatures.filter",n.filter,null,n);const c={};if(n&&n.layers){if(!Array.isArray(n.layers))return this.fire(new h.ErrorEvent(new Error("parameters.layers must be an Array."))),[];for(const y of n.layers){const _=this._layers[y];if(!_)return this.fire(new h.ErrorEvent(new Error(`The layer '${y}' does not exist in the map's style and cannot be queried for features.`))),[];c[_.source]=!0}}const p=[];n.availableImages=this._availableImages;const m=this._serializedAllLayers();for(const y in this.sourceCaches)n.layers&&!c[y]||p.push(vt(this.sourceCaches[y],this._layers,m,t,n,a));return this.placement&&p.push(function(y,_,v,S,T,L,O){const R={},B=L.queryRenderedSymbols(S),$=[];for(const W of Object.keys(B).map(Number))$.push(O[W]);$.sort(ct);for(const W of $){const ne=W.featureIndex.lookupSymbolFeatures(B[W.bucketInstanceId],_,W.bucketIndex,W.sourceLayerIndex,T.filter,T.layers,T.availableImages,y);for(const V in ne){const ie=R[V]=R[V]||[],ae=ne[V];ae.sort((fe,_e)=>{const xe=W.featureSortOrder;if(xe){const ge=xe.indexOf(fe.featureIndex);return xe.indexOf(_e.featureIndex)-ge}return _e.featureIndex-fe.featureIndex});for(const fe of ae)ie.push(fe)}}for(const W in R)R[W].forEach(ne=>{const V=ne.feature,ie=v[y[W].source].getFeatureState(V.layer["source-layer"],V.id);V.source=V.layer.source,V.layer["source-layer"]&&(V.sourceLayer=V.layer["source-layer"]),V.state=ie});return R}(this._layers,m,this.sourceCaches,t,n,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(p)}querySourceFeatures(t,n){n&&n.filter&&this._validate(h.validateStyle.filter,"querySourceFeatures.filter",n.filter,null,n);const a=this.sourceCaches[t];return a?function(c,p){const m=c.getRenderableIds().map(v=>c.getTileByID(v)),y=[],_={};for(let v=0;v<m.length;v++){const S=m[v],T=S.tileID.canonical.key;_[T]||(_[T]=!0,S.querySourceFeatures(y,p))}return y}(a,n):[]}addSourceType(t,n,a){return li.getSourceType(t)?a(new Error(`A source type called "${t}" already exists.`)):(li.setSourceType(t,n),n.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:t,url:n.workerSourceURL},a):a(null,null))}getLight(){return this.light.getLight()}setLight(t,n={}){this._checkLoaded();const a=this.light.getLight();let c=!1;for(const m in t)if(!h.deepEqual(t[m],a[m])){c=!0;break}if(!c)return;const p={now:h.exported.now(),transition:h.extend({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(t,n),this.light.updateTransitions(p)}_validate(t,n,a,c,p={}){return(!p||p.validate!==!1)&&Ot(this,t.call(h.validateStyle,h.extend({key:n,style:this.serialize(),value:a,styleSpec:h.v8Spec},c)))}_remove(t=!0){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),h.evented.off("pluginStateChange",this._rtlTextPluginCallback);for(const n in this._layers)this._layers[n].setEventedParent(null);for(const n in this.sourceCaches){const a=this.sourceCaches[n];a.setEventedParent(null),a.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove(t)}_clearSource(t){this.sourceCaches[t].clearTiles()}_reloadSource(t){this.sourceCaches[t].resume(),this.sourceCaches[t].reload()}_updateSources(t){for(const n in this.sourceCaches)this.sourceCaches[n].update(t,this.map.terrain)}_generateCollisionBoxes(){for(const t in this.sourceCaches)this._reloadSource(t)}_updatePlacement(t,n,a,c,p=!1){let m=!1,y=!1;const _={};for(const v of this._order){const S=this._layers[v];if(S.type!=="symbol")continue;if(!_[S.source]){const L=this.sourceCaches[S.source];_[S.source]=L.getRenderableIds(!0).map(O=>L.getTileByID(O)).sort((O,R)=>R.tileID.overscaledZ-O.tileID.overscaledZ||(O.tileID.isLessThan(R.tileID)?-1:1))}const T=this.crossTileSymbolIndex.addLayer(S,_[S.source],t.center.lng);m=m||T}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((p=p||this._layerOrderChanged||a===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(h.exported.now(),t.zoom))&&(this.pauseablePlacement=new Xi(t,this.map.terrain,this._order,p,n,a,c,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,_),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(h.exported.now()),y=!0),m&&this.pauseablePlacement.placement.setStale()),y||m)for(const v of this._order){const S=this._layers[v];S.type==="symbol"&&this.placement.updateLayerOpacities(S,_[S.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(h.exported.now())}_releaseSymbolFadeTiles(){for(const t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()}getImages(t,n,a){this.imageManager.getImages(n.icons,a),this._updateTilesForChangedImages();const c=this.sourceCaches[n.source];c&&c.setDependencies(n.tileID.key,n.type,n.icons)}getGlyphs(t,n,a){this.glyphManager.getGlyphs(n.stacks,a);const c=this.sourceCaches[n.source];c&&c.setDependencies(n.tileID.key,n.type,[""])}getResource(t,n,a){return h.makeRequest(n,a)}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(t,n={}){this._checkLoaded(),t&&this._validate(h.validateStyle.glyphs,"glyphs",t,null,n)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=t,this.glyphManager.entries={},this.glyphManager.setURL(t))}addSprite(t,n,a={},c){this._checkLoaded();const p=[{id:t,url:n}],m=[...Qr(this.stylesheet.sprite),...p];this._validate(h.validateStyle.sprite,"sprite",m,null,a)||(this.stylesheet.sprite=m,this._loadSprite(p,!0,c))}removeSprite(t){this._checkLoaded();const n=Qr(this.stylesheet.sprite);if(n.find(a=>a.id===t)){if(this._spritesImagesIds[t])for(const a of this._spritesImagesIds[t])this.imageManager.removeImage(a),this._changedImages[a]=!0;n.splice(n.findIndex(a=>a.id===t),1),this.stylesheet.sprite=n.length>0?n:void 0,delete this._spritesImagesIds[t],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new h.Event("data",{dataType:"style"}))}else this.fire(new h.ErrorEvent(new Error(`Sprite "${t}" doesn't exists on this map.`)))}getSprite(){return Qr(this.stylesheet.sprite)}setSprite(t,n={},a){this._checkLoaded(),t&&this._validate(h.validateStyle.sprite,"sprite",t,null,n)||(this.stylesheet.sprite=t,t?this._loadSprite(t,!0,a):(this._unloadSprite(),a&&a(null)))}}li.getSourceType=function(o){return $r[o]},li.setSourceType=function(o,t){$r[o]=t},li.registerForPluginStateChange=h.registerForPluginStateChange;var Ea=h.createLayout([{name:"a_pos",type:"Int16",components:2}]),Is="attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying float v_depth;void main() {float extent=8192.0;float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/extent;gl_Position=u_matrix*vec4(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}";const Zr={prelude:mt(`#ifdef GL_ES
3
3
  precision mediump float;
4
4
  #else
5
5
  #if !defined(lowp)
@@ -12,7 +12,7 @@ precision mediump float;
12
12
  #define highp
13
13
  #endif
14
14
  #endif
15
- out highp vec4 fragColor;`,`#ifdef GL_ES
15
+ `,`#ifdef GL_ES
16
16
  precision highp float;
17
17
  #else
18
18
  #if !defined(lowp)
@@ -32,7 +32,7 @@ uniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_m
32
32
  #endif
33
33
  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) {
34
34
  #ifdef TERRAIN3D
35
- highp float d=unpack(texture(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));
35
+ 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));
36
36
  #else
37
37
  return 1.0;
38
38
  #endif
@@ -44,7 +44,7 @@ return 1.0;
44
44
  #endif
45
45
  }float ele(vec2 pos) {
46
46
  #ifdef TERRAIN3D
47
- vec4 rgb=(texture(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;
47
+ vec4 rgb=(texture2D(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;
48
48
  #else
49
49
  return 0.0;
50
50
  #endif
@@ -54,15 +54,15 @@ vec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=frac
54
54
  #else
55
55
  return 0.0;
56
56
  #endif
57
- }`),background:_t(`uniform vec4 u_color;uniform float u_opacity;void main() {fragColor=u_color*u_opacity;
57
+ }`),background:mt(`uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;
58
58
  #ifdef OVERDRAW_INSPECTOR
59
- fragColor=vec4(1.0);
59
+ gl_FragColor=vec4(1.0);
60
60
  #endif
61
- }`,"in vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),backgroundPattern:_t(`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;in vec2 v_pos_a;in vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_mix)*u_opacity;
61
+ }`,"attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),backgroundPattern:mt(`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;
62
62
  #ifdef OVERDRAW_INSPECTOR
63
- fragColor=vec4(1.0);
63
+ gl_FragColor=vec4(1.0);
64
64
  #endif
65
- }`,"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;in vec2 a_pos;out vec2 v_pos_a;out 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:_t(`in vec3 v_data;in float v_visibility;
65
+ }`,"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:mt(`varying vec3 v_data;varying float v_visibility;
66
66
  #pragma mapbox: define highp vec4 color
67
67
  #pragma mapbox: define mediump float radius
68
68
  #pragma mapbox: define lowp float blur
@@ -78,11 +78,11 @@ void main() {
78
78
  #pragma mapbox: initialize highp vec4 stroke_color
79
79
  #pragma mapbox: initialize mediump float stroke_width
80
80
  #pragma mapbox: initialize lowp float stroke_opacity
81
- vec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));fragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);
81
+ vec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);
82
82
  #ifdef OVERDRAW_INSPECTOR
83
- fragColor=vec4(1.0);
83
+ gl_FragColor=vec4(1.0);
84
84
  #endif
85
- }`,`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;in vec2 a_pos;out vec3 v_data;out float v_visibility;
85
+ }`,`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;
86
86
  #pragma mapbox: define highp vec4 color
87
87
  #pragma mapbox: define mediump float radius
88
88
  #pragma mapbox: define lowp float blur
@@ -98,16 +98,16 @@ void main(void) {
98
98
  #pragma mapbox: initialize highp vec4 stroke_color
99
99
  #pragma mapbox: initialize mediump float stroke_width
100
100
  #pragma mapbox: initialize lowp float stroke_opacity
101
- 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;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`),clippingMask:_t("void main() {fragColor=vec4(1.0);}","in vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:_t(`uniform highp float u_intensity;in vec2 v_extrude;
101
+ 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;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`),clippingMask:mt("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:mt(`uniform highp float u_intensity;varying vec2 v_extrude;
102
102
  #pragma mapbox: define highp float weight
103
103
  #define GAUSS_COEF 0.3989422804014327
104
104
  void main() {
105
105
  #pragma mapbox: initialize highp float weight
106
- float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);fragColor=vec4(val,1.0,1.0,1.0);
106
+ 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);
107
107
  #ifdef OVERDRAW_INSPECTOR
108
- fragColor=vec4(1.0);
108
+ gl_FragColor=vec4(1.0);
109
109
  #endif
110
- }`,`uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;in vec2 a_pos;out vec2 v_extrude;
110
+ }`,`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;
111
111
  #pragma mapbox: define highp float weight
112
112
  #pragma mapbox: define mediump float radius
113
113
  const highp float ZERO=1.0/255.0/16.0;
@@ -115,42 +115,42 @@ const highp float ZERO=1.0/255.0/16.0;
115
115
  void main(void) {
116
116
  #pragma mapbox: initialize highp float weight
117
117
  #pragma mapbox: initialize mediump float radius
118
- 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,0,1);gl_Position=u_matrix*pos;}`),heatmapTexture:_t(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));fragColor=color*u_opacity;
118
+ 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,0,1);gl_Position=u_matrix*pos;}`),heatmapTexture:mt(`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;
119
119
  #ifdef OVERDRAW_INSPECTOR
120
- fragColor=vec4(0.0);
120
+ gl_FragColor=vec4(0.0);
121
121
  #endif
122
- }`,"uniform mat4 u_matrix;uniform vec2 u_world;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:_t("in float v_placed;in float v_notUsed;void main() {float alpha=0.5;fragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {fragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {fragColor*=.1;}}","in vec2 a_pos;in vec2 a_anchor_pos;in vec2 a_extrude;in vec2 a_placed;in vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;out float v_placed;out float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,get_elevation(a_pos),1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:_t("in float v_radius;in vec2 v_extrude;in float v_perspective_ratio;in 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);fragColor=color*alpha*opacity_t;}","in vec2 a_pos;in float a_radius;in vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;out float v_radius;out vec2 v_extrude;out float v_perspective_ratio;out 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:_t("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);fragColor=mix(u_color,overlay_color,overlay_color.a);}","in vec2 a_pos;out vec2 v_uv;uniform 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:_t(`#pragma mapbox: define highp vec4 color
122
+ }`,"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:mt("varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}","attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,get_elevation(a_pos),1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:mt("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:mt("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:mt(`#pragma mapbox: define highp vec4 color
123
123
  #pragma mapbox: define lowp float opacity
124
124
  void main() {
125
125
  #pragma mapbox: initialize highp vec4 color
126
126
  #pragma mapbox: initialize lowp float opacity
127
- fragColor=color*opacity;
127
+ gl_FragColor=color*opacity;
128
128
  #ifdef OVERDRAW_INSPECTOR
129
- fragColor=vec4(1.0);
129
+ gl_FragColor=vec4(1.0);
130
130
  #endif
131
- }`,`in vec2 a_pos;uniform mat4 u_matrix;
131
+ }`,`attribute vec2 a_pos;uniform mat4 u_matrix;
132
132
  #pragma mapbox: define highp vec4 color
133
133
  #pragma mapbox: define lowp float opacity
134
134
  void main() {
135
135
  #pragma mapbox: initialize highp vec4 color
136
136
  #pragma mapbox: initialize lowp float opacity
137
- gl_Position=u_matrix*vec4(a_pos,0,1);}`),fillOutline:_t(`in vec2 v_pos;
137
+ gl_Position=u_matrix*vec4(a_pos,0,1);}`),fillOutline:mt(`varying vec2 v_pos;
138
138
  #pragma mapbox: define highp vec4 outline_color
139
139
  #pragma mapbox: define lowp float opacity
140
140
  void main() {
141
141
  #pragma mapbox: initialize highp vec4 outline_color
142
142
  #pragma mapbox: initialize lowp float opacity
143
- float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=outline_color*(alpha*opacity);
143
+ float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);
144
144
  #ifdef OVERDRAW_INSPECTOR
145
- fragColor=vec4(1.0);
145
+ gl_FragColor=vec4(1.0);
146
146
  #endif
147
- }`,`in vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;out vec2 v_pos;
147
+ }`,`attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;
148
148
  #pragma mapbox: define highp vec4 outline_color
149
149
  #pragma mapbox: define lowp float opacity
150
150
  void main() {
151
151
  #pragma mapbox: initialize highp vec4 outline_color
152
152
  #pragma mapbox: initialize lowp float opacity
153
- gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillOutlinePattern:_t(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;in vec2 v_pos_a;in vec2 v_pos_b;in vec2 v_pos;
153
+ gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillOutlinePattern:mt(`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;
154
154
  #pragma mapbox: define lowp float opacity
155
155
  #pragma mapbox: define lowp vec4 pattern_from
156
156
  #pragma mapbox: define lowp vec4 pattern_to
@@ -158,11 +158,11 @@ void main() {
158
158
  #pragma mapbox: initialize lowp float opacity
159
159
  #pragma mapbox: initialize mediump vec4 pattern_from
160
160
  #pragma mapbox: initialize mediump vec4 pattern_to
161
- 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=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=mix(color1,color2,u_fade)*alpha*opacity;
161
+ 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;
162
162
  #ifdef OVERDRAW_INSPECTOR
163
- fragColor=vec4(1.0);
163
+ gl_FragColor=vec4(1.0);
164
164
  #endif
165
- }`,`uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;out vec2 v_pos;
165
+ }`,`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;
166
166
  #pragma mapbox: define lowp float opacity
167
167
  #pragma mapbox: define lowp vec4 pattern_from
168
168
  #pragma mapbox: define lowp vec4 pattern_to
@@ -174,10 +174,10 @@ void main() {
174
174
  #pragma mapbox: initialize mediump vec4 pattern_to
175
175
  #pragma mapbox: initialize lowp float pixel_ratio_from
176
176
  #pragma mapbox: initialize lowp float pixel_ratio_to
177
- 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:_t(`#ifdef GL_ES
177
+ 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:mt(`#ifdef GL_ES
178
178
  precision highp float;
179
179
  #endif
180
- uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;
180
+ uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;
181
181
  #pragma mapbox: define lowp float opacity
182
182
  #pragma mapbox: define lowp vec4 pattern_from
183
183
  #pragma mapbox: define lowp vec4 pattern_to
@@ -185,11 +185,11 @@ void main() {
185
185
  #pragma mapbox: initialize lowp float opacity
186
186
  #pragma mapbox: initialize mediump vec4 pattern_from
187
187
  #pragma mapbox: initialize mediump vec4 pattern_to
188
- 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=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_fade)*opacity;
188
+ 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;
189
189
  #ifdef OVERDRAW_INSPECTOR
190
- fragColor=vec4(1.0);
190
+ gl_FragColor=vec4(1.0);
191
191
  #endif
192
- }`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;
192
+ }`,`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;
193
193
  #pragma mapbox: define lowp float opacity
194
194
  #pragma mapbox: define lowp vec4 pattern_from
195
195
  #pragma mapbox: define lowp vec4 pattern_to
@@ -201,15 +201,15 @@ void main() {
201
201
  #pragma mapbox: initialize mediump vec4 pattern_to
202
202
  #pragma mapbox: initialize lowp float pixel_ratio_from
203
203
  #pragma mapbox: initialize lowp float pixel_ratio_to
204
- 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:_t(`in vec4 v_color;void main() {fragColor=v_color;
204
+ 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:mt(`varying vec4 v_color;void main() {gl_FragColor=v_color;
205
205
  #ifdef OVERDRAW_INSPECTOR
206
- fragColor=vec4(1.0);
206
+ gl_FragColor=vec4(1.0);
207
207
  #endif
208
- }`,`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;in vec2 a_pos;in vec4 a_normal_ed;
208
+ }`,`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;
209
209
  #ifdef TERRAIN3D
210
- in vec2 a_centroid;
210
+ attribute vec2 a_centroid;
211
211
  #endif
212
- out vec4 v_color;
212
+ varying vec4 v_color;
213
213
  #pragma mapbox: define highp float base
214
214
  #pragma mapbox: define highp float height
215
215
  #pragma mapbox: define highp vec4 color
@@ -223,7 +223,7 @@ float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_off
223
223
  #else
224
224
  float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
225
225
  #endif
226
- 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:_t(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;in vec4 v_lighting;
226
+ 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:mt(`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;
227
227
  #pragma mapbox: define lowp float base
228
228
  #pragma mapbox: define lowp float height
229
229
  #pragma mapbox: define lowp vec4 pattern_from
@@ -237,15 +237,15 @@ void main() {
237
237
  #pragma mapbox: initialize mediump vec4 pattern_to
238
238
  #pragma mapbox: initialize lowp float pixel_ratio_from
239
239
  #pragma mapbox: initialize lowp float pixel_ratio_to
240
- 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=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);fragColor=mixedColor*v_lighting;
240
+ 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;
241
241
  #ifdef OVERDRAW_INSPECTOR
242
- fragColor=vec4(1.0);
242
+ gl_FragColor=vec4(1.0);
243
243
  #endif
244
- }`,`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;in vec2 a_pos;in vec4 a_normal_ed;
244
+ }`,`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;
245
245
  #ifdef TERRAIN3D
246
- in vec2 a_centroid;
246
+ attribute vec2 a_centroid;
247
247
  #endif
248
- out vec2 v_pos_a;out vec2 v_pos_b;out vec4 v_lighting;
248
+ varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;
249
249
  #pragma mapbox: define lowp float base
250
250
  #pragma mapbox: define lowp float height
251
251
  #pragma mapbox: define lowp vec4 pattern_from
@@ -267,20 +267,20 @@ float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
267
267
  #endif
268
268
  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
269
269
  ? a_pos
270
- : 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:_t(`#ifdef GL_ES
270
+ : 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:mt(`#ifdef GL_ES
271
271
  precision highp float;
272
272
  #endif
273
- uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/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));fragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);
273
+ 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);
274
274
  #ifdef OVERDRAW_INSPECTOR
275
- fragColor=vec4(1.0);
275
+ gl_FragColor=vec4(1.0);
276
276
  #endif
277
- }`,"uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:_t(`uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;
277
+ }`,"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:mt(`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;
278
278
  #define PI 3.141592653589793
279
- void main() {vec4 pixel=texture(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);fragColor=accent_color*(1.0-shade_color.a)+shade_color;
279
+ 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;
280
280
  #ifdef OVERDRAW_INSPECTOR
281
- fragColor=vec4(1.0);
281
+ gl_FragColor=vec4(1.0);
282
282
  #endif
283
- }`,"uniform mat4 u_matrix;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"),line:_t(`uniform lowp float u_device_pixel_ratio;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;
283
+ }`,"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:mt(`uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;
284
284
  #pragma mapbox: define highp vec4 color
285
285
  #pragma mapbox: define lowp float blur
286
286
  #pragma mapbox: define lowp float opacity
@@ -288,13 +288,13 @@ void main() {
288
288
  #pragma mapbox: initialize highp vec4 color
289
289
  #pragma mapbox: initialize lowp float blur
290
290
  #pragma mapbox: initialize lowp float opacity
291
- 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);fragColor=color*(alpha*opacity);
291
+ 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);
292
292
  #ifdef OVERDRAW_INSPECTOR
293
- fragColor=vec4(1.0);
293
+ gl_FragColor=vec4(1.0);
294
294
  #endif
295
295
  }`,`
296
296
  #define scale 0.015873016
297
- in vec2 a_pos_normal;in 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;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp float v_linesofar;
297
+ 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;
298
298
  #pragma mapbox: define highp vec4 color
299
299
  #pragma mapbox: define lowp float blur
300
300
  #pragma mapbox: define lowp float opacity
@@ -314,19 +314,19 @@ v_gamma_scale=1.0;
314
314
  #else
315
315
  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;
316
316
  #endif
317
- v_width2=vec2(outset,inset);}`),lineGradient:_t(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec2 v_uv;
317
+ v_width2=vec2(outset,inset);}`),lineGradient:mt(`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;
318
318
  #pragma mapbox: define lowp float blur
319
319
  #pragma mapbox: define lowp float opacity
320
320
  void main() {
321
321
  #pragma mapbox: initialize lowp float blur
322
322
  #pragma mapbox: initialize lowp float opacity
323
- 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=texture(u_image,v_uv);fragColor=color*(alpha*opacity);
323
+ 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);
324
324
  #ifdef OVERDRAW_INSPECTOR
325
- fragColor=vec4(1.0);
325
+ gl_FragColor=vec4(1.0);
326
326
  #endif
327
327
  }`,`
328
328
  #define scale 0.015873016
329
- in vec2 a_pos_normal;in vec4 a_data;in float a_uv_x;in 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;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;
329
+ 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;
330
330
  #pragma mapbox: define lowp float blur
331
331
  #pragma mapbox: define lowp float opacity
332
332
  #pragma mapbox: define mediump float gapwidth
@@ -344,10 +344,10 @@ v_gamma_scale=1.0;
344
344
  #else
345
345
  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;
346
346
  #endif
347
- v_width2=vec2(outset,inset);}`),linePattern:_t(`#ifdef GL_ES
347
+ v_width2=vec2(outset,inset);}`),linePattern:mt(`#ifdef GL_ES
348
348
  precision highp float;
349
349
  #endif
350
- uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;in vec2 v_normal;in vec2 v_width2;in float v_linesofar;in float v_gamma_scale;in float v_width;
350
+ 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;
351
351
  #pragma mapbox: define lowp vec4 pattern_from
352
352
  #pragma mapbox: define lowp vec4 pattern_to
353
353
  #pragma mapbox: define lowp float pixel_ratio_from
@@ -361,14 +361,14 @@ void main() {
361
361
  #pragma mapbox: initialize lowp float pixel_ratio_to
362
362
  #pragma mapbox: initialize lowp float blur
363
363
  #pragma mapbox: initialize lowp float opacity
364
- 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(texture(u_image,pos_a),texture(u_image,pos_b),u_fade);fragColor=color*alpha*opacity;
364
+ 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;
365
365
  #ifdef OVERDRAW_INSPECTOR
366
- fragColor=vec4(1.0);
366
+ gl_FragColor=vec4(1.0);
367
367
  #endif
368
368
  }`,`
369
369
  #define scale 0.015873016
370
370
  #define LINE_DISTANCE_SCALE 2.0
371
- in vec2 a_pos_normal;in 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;out vec2 v_normal;out vec2 v_width2;out float v_linesofar;out float v_gamma_scale;out float v_width;
371
+ 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;
372
372
  #pragma mapbox: define lowp float blur
373
373
  #pragma mapbox: define lowp float opacity
374
374
  #pragma mapbox: define lowp float offset
@@ -396,7 +396,7 @@ v_gamma_scale=1.0;
396
396
  #else
397
397
  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;
398
398
  #endif
399
- v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:_t(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;
399
+ v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:mt(`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;
400
400
  #pragma mapbox: define highp vec4 color
401
401
  #pragma mapbox: define lowp float blur
402
402
  #pragma mapbox: define lowp float opacity
@@ -408,14 +408,14 @@ void main() {
408
408
  #pragma mapbox: initialize lowp float opacity
409
409
  #pragma mapbox: initialize mediump float width
410
410
  #pragma mapbox: initialize lowp float floorwidth
411
- 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=texture(u_image,v_tex_a).a;float sdfdist_b=texture(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*opacity);
411
+ 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);
412
412
  #ifdef OVERDRAW_INSPECTOR
413
- fragColor=vec4(1.0);
413
+ gl_FragColor=vec4(1.0);
414
414
  #endif
415
415
  }`,`
416
416
  #define scale 0.015873016
417
417
  #define LINE_DISTANCE_SCALE 2.0
418
- in vec2 a_pos_normal;in 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;out vec2 v_normal;out vec2 v_width2;out vec2 v_tex_a;out vec2 v_tex_b;out float v_gamma_scale;
418
+ 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;
419
419
  #pragma mapbox: define highp vec4 color
420
420
  #pragma mapbox: define lowp float blur
421
421
  #pragma mapbox: define lowp float opacity
@@ -437,26 +437,26 @@ v_gamma_scale=1.0;
437
437
  #else
438
438
  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;
439
439
  #endif
440
- 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:_t(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;in vec2 v_pos0;in vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture(u_image0,v_pos0);vec4 color1=texture(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);fragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);
440
+ 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:mt(`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);
441
441
  #ifdef OVERDRAW_INSPECTOR
442
- fragColor=vec4(1.0);
442
+ gl_FragColor=vec4(1.0);
443
443
  #endif
444
- }`,"uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos0;out 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:_t(`uniform sampler2D u_texture;in vec2 v_tex;in float v_fade_opacity;
444
+ }`,"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:mt(`uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;
445
445
  #pragma mapbox: define lowp float opacity
446
446
  void main() {
447
447
  #pragma mapbox: initialize lowp float opacity
448
- lowp float alpha=opacity*v_fade_opacity;fragColor=texture(u_texture,v_tex)*alpha;
448
+ lowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;
449
449
  #ifdef OVERDRAW_INSPECTOR
450
- fragColor=vec4(1.0);
450
+ gl_FragColor=vec4(1.0);
451
451
  #endif
452
- }`,`const float PI=3.141592653589793;in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_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;out vec2 v_tex;out float v_fade_opacity;
452
+ }`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity;
453
453
  #pragma mapbox: define lowp float opacity
454
454
  void main() {
455
455
  #pragma mapbox: initialize lowp float opacity
456
456
  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;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
457
457
  camera_to_anchor_distance/u_camera_to_center_distance :
458
- 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=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),z,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}`),symbolSDF:_t(`#define SDF_PX 8.0
459
- 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;in vec2 v_data0;in vec3 v_data1;
458
+ 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=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),z,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}`),symbolSDF:mt(`#define SDF_PX 8.0
459
+ 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;
460
460
  #pragma mapbox: define highp vec4 fill_color
461
461
  #pragma mapbox: define highp vec4 halo_color
462
462
  #pragma mapbox: define lowp float opacity
@@ -468,11 +468,11 @@ void main() {
468
468
  #pragma mapbox: initialize lowp float opacity
469
469
  #pragma mapbox: initialize lowp float halo_width
470
470
  #pragma mapbox: initialize lowp float halo_blur
471
- 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 buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);fragColor=color*(alpha*opacity*fade_opacity);
471
+ 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 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);
472
472
  #ifdef OVERDRAW_INSPECTOR
473
- fragColor=vec4(1.0);
473
+ gl_FragColor=vec4(1.0);
474
474
  #endif
475
- }`,`const float PI=3.141592653589793;in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_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;out vec2 v_data0;out vec3 v_data1;
475
+ }`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;varying vec2 v_data0;varying vec3 v_data1;
476
476
  #pragma mapbox: define highp vec4 fill_color
477
477
  #pragma mapbox: define highp vec4 halo_color
478
478
  #pragma mapbox: define lowp float opacity
@@ -486,10 +486,10 @@ void main() {
486
486
  #pragma mapbox: initialize lowp float halo_blur
487
487
  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;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
488
488
  camera_to_anchor_distance/u_camera_to_center_distance :
489
- 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=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}`),symbolTextAndIcon:_t(`#define SDF_PX 8.0
489
+ 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=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}`),symbolTextAndIcon:mt(`#define SDF_PX 8.0
490
490
  #define SDF 1.0
491
491
  #define ICON 0.0
492
- 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;in vec4 v_data0;in vec4 v_data1;
492
+ 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;
493
493
  #pragma mapbox: define highp vec4 fill_color
494
494
  #pragma mapbox: define highp vec4 halo_color
495
495
  #pragma mapbox: define lowp float opacity
@@ -501,15 +501,15 @@ void main() {
501
501
  #pragma mapbox: initialize lowp float opacity
502
502
  #pragma mapbox: initialize lowp float halo_width
503
503
  #pragma mapbox: initialize lowp float halo_blur
504
- float fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;fragColor=texture(u_texture_icon,tex_icon)*alpha;
504
+ 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;
505
505
  #ifdef OVERDRAW_INSPECTOR
506
- fragColor=vec4(1.0);
506
+ gl_FragColor=vec4(1.0);
507
507
  #endif
508
- 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=texture(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);fragColor=color*(alpha*opacity*fade_opacity);
508
+ 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);
509
509
  #ifdef OVERDRAW_INSPECTOR
510
- fragColor=vec4(1.0);
510
+ gl_FragColor=vec4(1.0);
511
511
  #endif
512
- }`,`const float PI=3.141592653589793;in vec4 a_pos_offset;in vec4 a_data;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_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;out vec4 v_data0;out vec4 v_data1;
512
+ }`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;varying vec4 v_data0;varying vec4 v_data1;
513
513
  #pragma mapbox: define highp vec4 fill_color
514
514
  #pragma mapbox: define highp vec4 halo_color
515
515
  #pragma mapbox: define lowp float opacity
@@ -523,58 +523,58 @@ void main() {
523
523
  #pragma mapbox: initialize lowp float halo_blur
524
524
  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;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
525
525
  camera_to_anchor_distance/u_camera_to_center_distance :
526
- 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=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`),terrain:_t("uniform sampler2D u_texture;in vec2 v_texture_pos;void main() {fragColor=texture(u_texture,v_texture_pos);}",Tn),terrainDepth:_t("in float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {fragColor=pack(v_depth);}",Tn),terrainCoords:_t("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;in vec2 v_texture_pos;void main() {vec4 rgba=texture(u_texture,v_texture_pos);fragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}",Tn)};function _t(o,t){const n=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,a=t.match(/(attribute|in) ([\w]+) ([\w]+)/g),c=o.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),p=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),m=p?p.concat(c):c,y={};return{fragmentSource:o=o.replace(n,(_,v,S,T,z)=>(y[z]=!0,v==="define"?`
527
- #ifndef HAS_UNIFORM_u_${z}
528
- in ${S} ${T} ${z};
526
+ 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=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`),terrain:mt("uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}",Is),terrainDepth:mt("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);}",Is),terrainCoords:mt("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);}",Is)};function mt(o,t){const n=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,a=t.match(/attribute ([\w]+) ([\w]+)/g),c=o.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),p=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),m=p?p.concat(c):c,y={};return{fragmentSource:o=o.replace(n,(_,v,S,T,L)=>(y[L]=!0,v==="define"?`
527
+ #ifndef HAS_UNIFORM_u_${L}
528
+ varying ${S} ${T} ${L};
529
529
  #else
530
- uniform ${S} ${T} u_${z};
530
+ uniform ${S} ${T} u_${L};
531
531
  #endif
532
532
  `:`
533
- #ifdef HAS_UNIFORM_u_${z}
534
- ${S} ${T} ${z} = u_${z};
535
- #endif
536
- `)),vertexSource:t=t.replace(n,(_,v,S,T,z)=>{const U=T==="float"?"vec2":"vec4",R=z.match(/color/)?"color":U;return y[z]?v==="define"?`
537
- #ifndef HAS_UNIFORM_u_${z}
538
- uniform lowp float u_${z}_t;
539
- in ${S} ${U} a_${z};
540
- out ${S} ${T} ${z};
533
+ #ifdef HAS_UNIFORM_u_${L}
534
+ ${S} ${T} ${L} = u_${L};
535
+ #endif
536
+ `)),vertexSource:t=t.replace(n,(_,v,S,T,L)=>{const O=T==="float"?"vec2":"vec4",R=L.match(/color/)?"color":O;return y[L]?v==="define"?`
537
+ #ifndef HAS_UNIFORM_u_${L}
538
+ uniform lowp float u_${L}_t;
539
+ attribute ${S} ${O} a_${L};
540
+ varying ${S} ${T} ${L};
541
541
  #else
542
- uniform ${S} ${T} u_${z};
542
+ uniform ${S} ${T} u_${L};
543
543
  #endif
544
544
  `:R==="vec4"?`
545
- #ifndef HAS_UNIFORM_u_${z}
546
- ${z} = a_${z};
545
+ #ifndef HAS_UNIFORM_u_${L}
546
+ ${L} = a_${L};
547
547
  #else
548
- ${S} ${T} ${z} = u_${z};
548
+ ${S} ${T} ${L} = u_${L};
549
549
  #endif
550
550
  `:`
551
- #ifndef HAS_UNIFORM_u_${z}
552
- ${z} = unpack_mix_${R}(a_${z}, u_${z}_t);
551
+ #ifndef HAS_UNIFORM_u_${L}
552
+ ${L} = unpack_mix_${R}(a_${L}, u_${L}_t);
553
553
  #else
554
- ${S} ${T} ${z} = u_${z};
554
+ ${S} ${T} ${L} = u_${L};
555
555
  #endif
556
556
  `:v==="define"?`
557
- #ifndef HAS_UNIFORM_u_${z}
558
- uniform lowp float u_${z}_t;
559
- in ${S} ${U} a_${z};
557
+ #ifndef HAS_UNIFORM_u_${L}
558
+ uniform lowp float u_${L}_t;
559
+ attribute ${S} ${O} a_${L};
560
560
  #else
561
- uniform ${S} ${T} u_${z};
561
+ uniform ${S} ${T} u_${L};
562
562
  #endif
563
563
  `:R==="vec4"?`
564
- #ifndef HAS_UNIFORM_u_${z}
565
- ${S} ${T} ${z} = a_${z};
564
+ #ifndef HAS_UNIFORM_u_${L}
565
+ ${S} ${T} ${L} = a_${L};
566
566
  #else
567
- ${S} ${T} ${z} = u_${z};
567
+ ${S} ${T} ${L} = u_${L};
568
568
  #endif
569
569
  `:`
570
- #ifndef HAS_UNIFORM_u_${z}
571
- ${S} ${T} ${z} = unpack_mix_${R}(a_${z}, u_${z}_t);
570
+ #ifndef HAS_UNIFORM_u_${L}
571
+ ${S} ${T} ${L} = unpack_mix_${R}(a_${L}, u_${L}_t);
572
572
  #else
573
- ${S} ${T} ${z} = u_${z};
573
+ ${S} ${T} ${L} = u_${L};
574
574
  #endif
575
- `}),staticAttributes:a,staticUniforms:m}}class ws{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,n,a,c,p,m,y,_,v){this.context=t;let S=this.boundPaintVertexBuffers.length!==c.length;for(let T=0;!S&&T<c.length;T++)this.boundPaintVertexBuffers[T]!==c[T]&&(S=!0);!this.vao||this.boundProgram!==n||this.boundLayoutVertexBuffer!==a||S||this.boundIndexBuffer!==p||this.boundVertexOffset!==m||this.boundDynamicVertexBuffer!==y||this.boundDynamicVertexBuffer2!==_||this.boundDynamicVertexBuffer3!==v?this.freshBind(n,a,c,p,m,y,_,v):(t.bindVertexArray.set(this.vao),y&&y.bind(),p&&p.dynamicDraw&&p.bind(),_&&_.bind(),v&&v.bind())}freshBind(t,n,a,c,p,m,y,_){const v=t.numAttributes,S=this.context,T=S.gl;this.vao&&this.destroy(),this.vao=S.createVertexArray(),S.bindVertexArray.set(this.vao),this.boundProgram=t,this.boundLayoutVertexBuffer=n,this.boundPaintVertexBuffers=a,this.boundIndexBuffer=c,this.boundVertexOffset=p,this.boundDynamicVertexBuffer=m,this.boundDynamicVertexBuffer2=y,this.boundDynamicVertexBuffer3=_,n.enableAttributes(T,t);for(const z of a)z.enableAttributes(T,t);m&&m.enableAttributes(T,t),y&&y.enableAttributes(T,t),_&&_.enableAttributes(T,t),n.bind(),n.setVertexAttribPointers(T,t,p);for(const z of a)z.bind(),z.setVertexAttribPointers(T,t,p);m&&(m.bind(),m.setVertexAttribPointers(T,t,p)),c&&c.bind(),y&&(y.bind(),y.setVertexAttribPointers(T,t,p)),_&&(_.bind(),_.setVertexAttribPointers(T,t,p)),S.currentNumAttributes=v}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}function wa(o){const t=[];for(let n=0;n<o.length;n++){if(o[n]===null)continue;const a=o[n].split(" ");t.push(a.pop())}return t}class Jl{constructor(t,n,a,c,p,m,y){const _=t.gl;this.program=_.createProgram();const v=wa(a.staticAttributes),S=c?c.getBinderAttributes():[],T=v.concat(S),z=Xi.prelude.staticUniforms?wa(Xi.prelude.staticUniforms):[],U=a.staticUniforms?wa(a.staticUniforms):[],R=c?c.getBinderUniforms():[],F=z.concat(U).concat(R),j=[];for(const _e of F)j.indexOf(_e)<0&&j.push(_e);const X=c?c.defines():[];m&&X.push("#define OVERDRAW_INSPECTOR;"),y&&X.push("#define TERRAIN3D;"),X.unshift("#version 300 es");const ne=X.concat(Xi.prelude.fragmentSource,a.fragmentSource).join(`
576
- `),V=X.concat(Xi.prelude.vertexSource,a.vertexSource).join(`
577
- `),ie=_.createShader(_.FRAGMENT_SHADER);if(_.isContextLost())return void(this.failedToCreate=!0);_.shaderSource(ie,ne),_.compileShader(ie),_.attachShader(this.program,ie);const ae=_.createShader(_.VERTEX_SHADER);if(_.isContextLost())return void(this.failedToCreate=!0);_.shaderSource(ae,V),_.compileShader(ae),_.attachShader(this.program,ae),this.attributes={};const fe={};this.numAttributes=T.length;for(let _e=0;_e<this.numAttributes;_e++)T[_e]&&(_.bindAttribLocation(this.program,_e,T[_e]),this.attributes[T[_e]]=_e);_.linkProgram(this.program),_.deleteShader(ae),_.deleteShader(ie);for(let _e=0;_e<j.length;_e++){const xe=j[_e];if(xe&&!fe[xe]){const ge=_.getUniformLocation(this.program,xe);ge&&(fe[xe]=ge)}}this.fixedUniforms=p(t,fe),this.terrainUniforms=((_e,xe)=>({u_depth:new h.Uniform1i(_e,xe.u_depth),u_terrain:new h.Uniform1i(_e,xe.u_terrain),u_terrain_dim:new h.Uniform1f(_e,xe.u_terrain_dim),u_terrain_matrix:new h.UniformMatrix4f(_e,xe.u_terrain_matrix),u_terrain_unpack:new h.Uniform4f(_e,xe.u_terrain_unpack),u_terrain_exaggeration:new h.Uniform1f(_e,xe.u_terrain_exaggeration)}))(t,fe),this.binderUniforms=c?c.getUniforms(t,fe):[]}draw(t,n,a,c,p,m,y,_,v,S,T,z,U,R,F,j,X,ne){const V=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(a),t.setStencilMode(c),t.setColorMode(p),t.setCullFace(m),_){t.activeTexture.set(V.TEXTURE2),V.bindTexture(V.TEXTURE_2D,_.depthTexture),t.activeTexture.set(V.TEXTURE3),V.bindTexture(V.TEXTURE_2D,_.texture);for(const ae in this.terrainUniforms)this.terrainUniforms[ae].set(_[ae])}for(const ae in this.fixedUniforms)this.fixedUniforms[ae].set(y[ae]);F&&F.setUniforms(t,this.binderUniforms,U,{zoom:R});let ie=0;switch(n){case V.LINES:ie=2;break;case V.TRIANGLES:ie=3;break;case V.LINE_STRIP:ie=1}for(const ae of z.get()){const fe=ae.vaos||(ae.vaos={});(fe[v]||(fe[v]=new ws)).bind(t,this,S,F?F.getPaintVertexBuffers():[],T,ae.vertexOffset,j,X,ne),V.drawElements(n,ae.primitiveLength*ie,V.UNSIGNED_SHORT,ae.primitiveOffset*ie*2)}}}function Ts(o,t,n){const a=1/ce(n,1,t.transform.tileZoom),c=Math.pow(2,n.tileID.overscaledZ),p=n.tileSize*Math.pow(2,t.transform.tileZoom)/c,m=p*(n.tileID.canonical.x+n.tileID.wrap*c),y=p*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture.size,u_scale:[a,o.fromScale,o.toScale],u_fade:o.t,u_pixel_coord_upper:[m>>16,y>>16],u_pixel_coord_lower:[65535&m,65535&y]}}const Bo=(o,t,n,a)=>{const c=t.style.light,p=c.properties.get("position"),m=[p.x,p.y,p.z],y=function(){var v=new h.ARRAY_TYPE(9);return h.ARRAY_TYPE!=Float32Array&&(v[1]=0,v[2]=0,v[3]=0,v[5]=0,v[6]=0,v[7]=0),v[0]=1,v[4]=1,v[8]=1,v}();c.properties.get("anchor")==="viewport"&&function(v,S){var T=Math.sin(S),z=Math.cos(S);v[0]=z,v[1]=T,v[2]=0,v[3]=-T,v[4]=z,v[5]=0,v[6]=0,v[7]=0,v[8]=1}(y,-t.transform.angle),function(v,S,T){var z=S[0],U=S[1],R=S[2];v[0]=z*T[0]+U*T[3]+R*T[6],v[1]=z*T[1]+U*T[4]+R*T[7],v[2]=z*T[2]+U*T[5]+R*T[8]}(m,m,y);const _=c.properties.get("color");return{u_matrix:o,u_lightpos:m,u_lightintensity:c.properties.get("intensity"),u_lightcolor:[_.r,_.g,_.b],u_vertical_gradient:+n,u_opacity:a}},Fo=(o,t,n,a,c,p,m)=>h.extend(Bo(o,t,n,a),Ts(p,t,m),{u_height_factor:-Math.pow(2,c.overscaledZ)/m.tileSize/8}),Oo=o=>({u_matrix:o}),Ta=(o,t,n,a)=>h.extend(Oo(o),Ts(n,t,a)),Ql=(o,t)=>({u_matrix:o,u_world:t}),Sa=(o,t,n,a,c)=>h.extend(Ta(o,t,n,a),{u_world:c}),Uo=(o,t,n,a)=>{const c=o.transform;let p,m;if(a.paint.get("circle-pitch-alignment")==="map"){const y=ce(n,1,c.zoom);p=!0,m=[y,y]}else p=!1,m=c.pixelsToGLUnits;return{u_camera_to_center_distance:c.cameraToCenterDistance,u_scale_with_map:+(a.paint.get("circle-pitch-scale")==="map"),u_matrix:o.translatePosMatrix(t.posMatrix,n,a.paint.get("circle-translate"),a.paint.get("circle-translate-anchor")),u_pitch_with_map:+p,u_device_pixel_ratio:o.pixelRatio,u_extrude_scale:m}},No=(o,t,n)=>{const a=ce(n,1,t.zoom),c=Math.pow(2,t.zoom-n.tileID.overscaledZ),p=n.tileID.overscaleFactor();return{u_matrix:o,u_camera_to_center_distance:t.cameraToCenterDistance,u_pixels_to_tile_units:a,u_extrude_scale:[t.pixelsToGLUnits[0]/(a*c),t.pixelsToGLUnits[1]/(a*c)],u_overscale_factor:p}},Ea=(o,t,n=1)=>({u_matrix:o,u_color:t,u_overlay:0,u_overlay_scale:n}),Ia=o=>({u_matrix:o}),en=(o,t,n,a)=>({u_matrix:o,u_extrude_scale:ce(t,1,n),u_intensity:a});function Ss(o,t){const n=Math.pow(2,t.canonical.z),a=t.canonical.y;return[new h.MercatorCoordinate(0,a/n).toLngLat().lat,new h.MercatorCoordinate(0,(a+1)/n).toLngLat().lat]}const Ci=(o,t,n,a)=>{const c=o.transform;return{u_matrix:Wn(o,t,n,a),u_ratio:1/ce(t,1,c.zoom),u_device_pixel_ratio:o.pixelRatio,u_units_to_pixels:[1/c.pixelsToGLUnits[0],1/c.pixelsToGLUnits[1]]}},Es=(o,t,n,a,c)=>h.extend(Ci(o,t,n,c),{u_image:0,u_image_height:a}),Is=(o,t,n,a,c)=>{const p=o.transform,m=Xn(t,p);return{u_matrix:Wn(o,t,n,c),u_texsize:t.imageAtlasTexture.size,u_ratio:1/ce(t,1,p.zoom),u_device_pixel_ratio:o.pixelRatio,u_image:0,u_scale:[m,a.fromScale,a.toScale],u_fade:a.t,u_units_to_pixels:[1/p.pixelsToGLUnits[0],1/p.pixelsToGLUnits[1]]}},Zn=(o,t,n,a,c,p)=>{const m=o.lineAtlas,y=Xn(t,o.transform),_=n.layout.get("line-cap")==="round",v=m.getDash(a.from,_),S=m.getDash(a.to,_),T=v.width*c.fromScale,z=S.width*c.toScale;return h.extend(Ci(o,t,n,p),{u_patternscale_a:[y/T,-v.height/2],u_patternscale_b:[y/z,-S.height/2],u_sdfgamma:m.width/(256*Math.min(T,z)*o.pixelRatio)/2,u_image:0,u_tex_y_a:v.y,u_tex_y_b:S.y,u_mix:c.t})};function Xn(o,t){return 1/ce(o,1,t.tileZoom)}function Wn(o,t,n,a){return o.translatePosMatrix(a?a.posMatrix:t.tileID.posMatrix,t,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}const Hn=(o,t,n,a,c)=>{return{u_matrix:o,u_tl_parent:t,u_scale_parent:n,u_buffer_scale:1,u_fade_t:a.mix,u_opacity:a.opacity*c.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:c.paint.get("raster-brightness-min"),u_brightness_high:c.paint.get("raster-brightness-max"),u_saturation_factor:(m=c.paint.get("raster-saturation"),m>0?1-1/(1.001-m):-m),u_contrast_factor:(p=c.paint.get("raster-contrast"),p>0?1/(1-p):1+p),u_spin_weights:Kn(c.paint.get("raster-hue-rotate"))};var p,m};function Kn(o){o*=Math.PI/180;const t=Math.sin(o),n=Math.cos(o);return[(2*n+1)/3,(-Math.sqrt(3)*t-n+1)/3,(Math.sqrt(3)*t-n+1)/3]}const Yn=(o,t,n,a,c,p,m,y,_,v)=>{const S=c.transform;return{u_is_size_zoom_constant:+(o==="constant"||o==="source"),u_is_size_feature_constant:+(o==="constant"||o==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:S.cameraToCenterDistance,u_pitch:S.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:S.width/S.height,u_fade_change:c.options.fadeDuration?c.symbolFadeChange:1,u_matrix:p,u_label_plane_matrix:m,u_coord_matrix:y,u_is_text:+_,u_pitch_with_map:+a,u_texsize:v,u_texture:0}},Pi=(o,t,n,a,c,p,m,y,_,v,S)=>{const T=c.transform;return h.extend(Yn(o,t,n,a,c,p,m,y,_,v),{u_gamma_scale:a?Math.cos(T._pitch)*T.cameraToCenterDistance:1,u_device_pixel_ratio:c.pixelRatio,u_is_halo:+S})},Bi=(o,t,n,a,c,p,m,y,_,v)=>h.extend(Pi(o,t,n,a,c,p,m,y,!0,_,!0),{u_texsize_icon:v,u_texture_icon:1}),Aa=(o,t,n)=>({u_matrix:o,u_opacity:t,u_color:n}),As=(o,t,n,a,c,p)=>h.extend(function(m,y,_,v){const S=_.imageManager.getPattern(m.from.toString()),T=_.imageManager.getPattern(m.to.toString()),{width:z,height:U}=_.imageManager.getPixelSize(),R=Math.pow(2,v.tileID.overscaledZ),F=v.tileSize*Math.pow(2,_.transform.tileZoom)/R,j=F*(v.tileID.canonical.x+v.tileID.wrap*R),X=F*v.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:S.tl,u_pattern_br_a:S.br,u_pattern_tl_b:T.tl,u_pattern_br_b:T.br,u_texsize:[z,U],u_mix:y.t,u_pattern_size_a:S.displaySize,u_pattern_size_b:T.displaySize,u_scale_a:y.fromScale,u_scale_b:y.toScale,u_tile_units_to_pixels:1/ce(v,1,_.transform.tileZoom),u_pixel_coord_upper:[j>>16,X>>16],u_pixel_coord_lower:[65535&j,65535&X]}}(a,p,n,c),{u_matrix:o,u_opacity:t}),Cs={fillExtrusion:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_lightpos:new h.Uniform3f(o,t.u_lightpos),u_lightintensity:new h.Uniform1f(o,t.u_lightintensity),u_lightcolor:new h.Uniform3f(o,t.u_lightcolor),u_vertical_gradient:new h.Uniform1f(o,t.u_vertical_gradient),u_opacity:new h.Uniform1f(o,t.u_opacity)}),fillExtrusionPattern:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_lightpos:new h.Uniform3f(o,t.u_lightpos),u_lightintensity:new h.Uniform1f(o,t.u_lightintensity),u_lightcolor:new h.Uniform3f(o,t.u_lightcolor),u_vertical_gradient:new h.Uniform1f(o,t.u_vertical_gradient),u_height_factor:new h.Uniform1f(o,t.u_height_factor),u_image:new h.Uniform1i(o,t.u_image),u_texsize:new h.Uniform2f(o,t.u_texsize),u_pixel_coord_upper:new h.Uniform2f(o,t.u_pixel_coord_upper),u_pixel_coord_lower:new h.Uniform2f(o,t.u_pixel_coord_lower),u_scale:new h.Uniform3f(o,t.u_scale),u_fade:new h.Uniform1f(o,t.u_fade),u_opacity:new h.Uniform1f(o,t.u_opacity)}),fill:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix)}),fillPattern:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_image:new h.Uniform1i(o,t.u_image),u_texsize:new h.Uniform2f(o,t.u_texsize),u_pixel_coord_upper:new h.Uniform2f(o,t.u_pixel_coord_upper),u_pixel_coord_lower:new h.Uniform2f(o,t.u_pixel_coord_lower),u_scale:new h.Uniform3f(o,t.u_scale),u_fade:new h.Uniform1f(o,t.u_fade)}),fillOutline:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_world:new h.Uniform2f(o,t.u_world)}),fillOutlinePattern:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_world:new h.Uniform2f(o,t.u_world),u_image:new h.Uniform1i(o,t.u_image),u_texsize:new h.Uniform2f(o,t.u_texsize),u_pixel_coord_upper:new h.Uniform2f(o,t.u_pixel_coord_upper),u_pixel_coord_lower:new h.Uniform2f(o,t.u_pixel_coord_lower),u_scale:new h.Uniform3f(o,t.u_scale),u_fade:new h.Uniform1f(o,t.u_fade)}),circle:(o,t)=>({u_camera_to_center_distance:new h.Uniform1f(o,t.u_camera_to_center_distance),u_scale_with_map:new h.Uniform1i(o,t.u_scale_with_map),u_pitch_with_map:new h.Uniform1i(o,t.u_pitch_with_map),u_extrude_scale:new h.Uniform2f(o,t.u_extrude_scale),u_device_pixel_ratio:new h.Uniform1f(o,t.u_device_pixel_ratio),u_matrix:new h.UniformMatrix4f(o,t.u_matrix)}),collisionBox:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_camera_to_center_distance:new h.Uniform1f(o,t.u_camera_to_center_distance),u_pixels_to_tile_units:new h.Uniform1f(o,t.u_pixels_to_tile_units),u_extrude_scale:new h.Uniform2f(o,t.u_extrude_scale),u_overscale_factor:new h.Uniform1f(o,t.u_overscale_factor)}),collisionCircle:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_inv_matrix:new h.UniformMatrix4f(o,t.u_inv_matrix),u_camera_to_center_distance:new h.Uniform1f(o,t.u_camera_to_center_distance),u_viewport_size:new h.Uniform2f(o,t.u_viewport_size)}),debug:(o,t)=>({u_color:new h.UniformColor(o,t.u_color),u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_overlay:new h.Uniform1i(o,t.u_overlay),u_overlay_scale:new h.Uniform1f(o,t.u_overlay_scale)}),clippingMask:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix)}),heatmap:(o,t)=>({u_extrude_scale:new h.Uniform1f(o,t.u_extrude_scale),u_intensity:new h.Uniform1f(o,t.u_intensity),u_matrix:new h.UniformMatrix4f(o,t.u_matrix)}),heatmapTexture:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_world:new h.Uniform2f(o,t.u_world),u_image:new h.Uniform1i(o,t.u_image),u_color_ramp:new h.Uniform1i(o,t.u_color_ramp),u_opacity:new h.Uniform1f(o,t.u_opacity)}),hillshade:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_image:new h.Uniform1i(o,t.u_image),u_latrange:new h.Uniform2f(o,t.u_latrange),u_light:new h.Uniform2f(o,t.u_light),u_shadow:new h.UniformColor(o,t.u_shadow),u_highlight:new h.UniformColor(o,t.u_highlight),u_accent:new h.UniformColor(o,t.u_accent)}),hillshadePrepare:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_image:new h.Uniform1i(o,t.u_image),u_dimension:new h.Uniform2f(o,t.u_dimension),u_zoom:new h.Uniform1f(o,t.u_zoom),u_unpack:new h.Uniform4f(o,t.u_unpack)}),line:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_ratio:new h.Uniform1f(o,t.u_ratio),u_device_pixel_ratio:new h.Uniform1f(o,t.u_device_pixel_ratio),u_units_to_pixels:new h.Uniform2f(o,t.u_units_to_pixels)}),lineGradient:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_ratio:new h.Uniform1f(o,t.u_ratio),u_device_pixel_ratio:new h.Uniform1f(o,t.u_device_pixel_ratio),u_units_to_pixels:new h.Uniform2f(o,t.u_units_to_pixels),u_image:new h.Uniform1i(o,t.u_image),u_image_height:new h.Uniform1f(o,t.u_image_height)}),linePattern:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_texsize:new h.Uniform2f(o,t.u_texsize),u_ratio:new h.Uniform1f(o,t.u_ratio),u_device_pixel_ratio:new h.Uniform1f(o,t.u_device_pixel_ratio),u_image:new h.Uniform1i(o,t.u_image),u_units_to_pixels:new h.Uniform2f(o,t.u_units_to_pixels),u_scale:new h.Uniform3f(o,t.u_scale),u_fade:new h.Uniform1f(o,t.u_fade)}),lineSDF:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_ratio:new h.Uniform1f(o,t.u_ratio),u_device_pixel_ratio:new h.Uniform1f(o,t.u_device_pixel_ratio),u_units_to_pixels:new h.Uniform2f(o,t.u_units_to_pixels),u_patternscale_a:new h.Uniform2f(o,t.u_patternscale_a),u_patternscale_b:new h.Uniform2f(o,t.u_patternscale_b),u_sdfgamma:new h.Uniform1f(o,t.u_sdfgamma),u_image:new h.Uniform1i(o,t.u_image),u_tex_y_a:new h.Uniform1f(o,t.u_tex_y_a),u_tex_y_b:new h.Uniform1f(o,t.u_tex_y_b),u_mix:new h.Uniform1f(o,t.u_mix)}),raster:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_tl_parent:new h.Uniform2f(o,t.u_tl_parent),u_scale_parent:new h.Uniform1f(o,t.u_scale_parent),u_buffer_scale:new h.Uniform1f(o,t.u_buffer_scale),u_fade_t:new h.Uniform1f(o,t.u_fade_t),u_opacity:new h.Uniform1f(o,t.u_opacity),u_image0:new h.Uniform1i(o,t.u_image0),u_image1:new h.Uniform1i(o,t.u_image1),u_brightness_low:new h.Uniform1f(o,t.u_brightness_low),u_brightness_high:new h.Uniform1f(o,t.u_brightness_high),u_saturation_factor:new h.Uniform1f(o,t.u_saturation_factor),u_contrast_factor:new h.Uniform1f(o,t.u_contrast_factor),u_spin_weights:new h.Uniform3f(o,t.u_spin_weights)}),symbolIcon:(o,t)=>({u_is_size_zoom_constant:new h.Uniform1i(o,t.u_is_size_zoom_constant),u_is_size_feature_constant:new h.Uniform1i(o,t.u_is_size_feature_constant),u_size_t:new h.Uniform1f(o,t.u_size_t),u_size:new h.Uniform1f(o,t.u_size),u_camera_to_center_distance:new h.Uniform1f(o,t.u_camera_to_center_distance),u_pitch:new h.Uniform1f(o,t.u_pitch),u_rotate_symbol:new h.Uniform1i(o,t.u_rotate_symbol),u_aspect_ratio:new h.Uniform1f(o,t.u_aspect_ratio),u_fade_change:new h.Uniform1f(o,t.u_fade_change),u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_label_plane_matrix:new h.UniformMatrix4f(o,t.u_label_plane_matrix),u_coord_matrix:new h.UniformMatrix4f(o,t.u_coord_matrix),u_is_text:new h.Uniform1i(o,t.u_is_text),u_pitch_with_map:new h.Uniform1i(o,t.u_pitch_with_map),u_texsize:new h.Uniform2f(o,t.u_texsize),u_texture:new h.Uniform1i(o,t.u_texture)}),symbolSDF:(o,t)=>({u_is_size_zoom_constant:new h.Uniform1i(o,t.u_is_size_zoom_constant),u_is_size_feature_constant:new h.Uniform1i(o,t.u_is_size_feature_constant),u_size_t:new h.Uniform1f(o,t.u_size_t),u_size:new h.Uniform1f(o,t.u_size),u_camera_to_center_distance:new h.Uniform1f(o,t.u_camera_to_center_distance),u_pitch:new h.Uniform1f(o,t.u_pitch),u_rotate_symbol:new h.Uniform1i(o,t.u_rotate_symbol),u_aspect_ratio:new h.Uniform1f(o,t.u_aspect_ratio),u_fade_change:new h.Uniform1f(o,t.u_fade_change),u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_label_plane_matrix:new h.UniformMatrix4f(o,t.u_label_plane_matrix),u_coord_matrix:new h.UniformMatrix4f(o,t.u_coord_matrix),u_is_text:new h.Uniform1i(o,t.u_is_text),u_pitch_with_map:new h.Uniform1i(o,t.u_pitch_with_map),u_texsize:new h.Uniform2f(o,t.u_texsize),u_texture:new h.Uniform1i(o,t.u_texture),u_gamma_scale:new h.Uniform1f(o,t.u_gamma_scale),u_device_pixel_ratio:new h.Uniform1f(o,t.u_device_pixel_ratio),u_is_halo:new h.Uniform1i(o,t.u_is_halo)}),symbolTextAndIcon:(o,t)=>({u_is_size_zoom_constant:new h.Uniform1i(o,t.u_is_size_zoom_constant),u_is_size_feature_constant:new h.Uniform1i(o,t.u_is_size_feature_constant),u_size_t:new h.Uniform1f(o,t.u_size_t),u_size:new h.Uniform1f(o,t.u_size),u_camera_to_center_distance:new h.Uniform1f(o,t.u_camera_to_center_distance),u_pitch:new h.Uniform1f(o,t.u_pitch),u_rotate_symbol:new h.Uniform1i(o,t.u_rotate_symbol),u_aspect_ratio:new h.Uniform1f(o,t.u_aspect_ratio),u_fade_change:new h.Uniform1f(o,t.u_fade_change),u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_label_plane_matrix:new h.UniformMatrix4f(o,t.u_label_plane_matrix),u_coord_matrix:new h.UniformMatrix4f(o,t.u_coord_matrix),u_is_text:new h.Uniform1i(o,t.u_is_text),u_pitch_with_map:new h.Uniform1i(o,t.u_pitch_with_map),u_texsize:new h.Uniform2f(o,t.u_texsize),u_texsize_icon:new h.Uniform2f(o,t.u_texsize_icon),u_texture:new h.Uniform1i(o,t.u_texture),u_texture_icon:new h.Uniform1i(o,t.u_texture_icon),u_gamma_scale:new h.Uniform1f(o,t.u_gamma_scale),u_device_pixel_ratio:new h.Uniform1f(o,t.u_device_pixel_ratio),u_is_halo:new h.Uniform1i(o,t.u_is_halo)}),background:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_opacity:new h.Uniform1f(o,t.u_opacity),u_color:new h.UniformColor(o,t.u_color)}),backgroundPattern:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_opacity:new h.Uniform1f(o,t.u_opacity),u_image:new h.Uniform1i(o,t.u_image),u_pattern_tl_a:new h.Uniform2f(o,t.u_pattern_tl_a),u_pattern_br_a:new h.Uniform2f(o,t.u_pattern_br_a),u_pattern_tl_b:new h.Uniform2f(o,t.u_pattern_tl_b),u_pattern_br_b:new h.Uniform2f(o,t.u_pattern_br_b),u_texsize:new h.Uniform2f(o,t.u_texsize),u_mix:new h.Uniform1f(o,t.u_mix),u_pattern_size_a:new h.Uniform2f(o,t.u_pattern_size_a),u_pattern_size_b:new h.Uniform2f(o,t.u_pattern_size_b),u_scale_a:new h.Uniform1f(o,t.u_scale_a),u_scale_b:new h.Uniform1f(o,t.u_scale_b),u_pixel_coord_upper:new h.Uniform2f(o,t.u_pixel_coord_upper),u_pixel_coord_lower:new h.Uniform2f(o,t.u_pixel_coord_lower),u_tile_units_to_pixels:new h.Uniform1f(o,t.u_tile_units_to_pixels)}),terrain:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_texture:new h.Uniform1i(o,t.u_texture),u_ele_delta:new h.Uniform1f(o,t.u_ele_delta)}),terrainDepth:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_ele_delta:new h.Uniform1f(o,t.u_ele_delta)}),terrainCoords:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_texture:new h.Uniform1i(o,t.u_texture),u_terrain_coords_id:new h.Uniform1f(o,t.u_terrain_coords_id),u_ele_delta:new h.Uniform1f(o,t.u_ele_delta)})};class Ca{constructor(t,n,a){this.context=t;const c=t.gl;this.buffer=c.createBuffer(),this.dynamicDraw=!!a,this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),c.bufferData(c.ELEMENT_ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?c.DYNAMIC_DRAW:c.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){const 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,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Pa={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Ps{constructor(t,n,a,c){this.length=n.length,this.attributes=a,this.itemSize=n.bytesPerElement,this.dynamicDraw=c,this.context=t;const p=t.gl;this.buffer=p.createBuffer(),t.bindVertexBuffer.set(this.buffer),p.bufferData(p.ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?p.DYNAMIC_DRAW:p.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){if(t.length!==this.length)throw new Error(`Length of new data is ${t.length}, which doesn't match current length of ${this.length}`);const n=this.context.gl;this.bind(),n.bufferSubData(n.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,n){for(let a=0;a<this.attributes.length;a++){const c=n.attributes[this.attributes[a].name];c!==void 0&&t.enableVertexAttribArray(c)}}setVertexAttribPointers(t,n,a){for(let c=0;c<this.attributes.length;c++){const p=this.attributes[c],m=n.attributes[p.name];m!==void 0&&t.vertexAttribPointer(m,p.components,t[Pa[p.type]],!1,this.itemSize,p.offset+this.itemSize*(a||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class ct{constructor(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(t){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class Ma extends ct{getDefault(){return h.Color.transparent}set(t){const n=this.current;(t.r!==n.r||t.g!==n.g||t.b!==n.b||t.a!==n.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class Ms extends ct{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class Vo extends ct{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class $o extends ct{getDefault(){return[!0,!0,!0,!0]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||t[3]!==n[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class Sn extends ct{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class ec extends ct{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class tc extends ct{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){const n=this.current;(t.func!==n.func||t.ref!==n.ref||t.mask!==n.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}}class ic extends ct{getDefault(){const t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}}class rc extends ct{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.STENCIL_TEST):n.disable(n.STENCIL_TEST),this.current=t,this.dirty=!1}}class nc extends ct{getDefault(){return[0,1]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}}class sc extends ct{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.DEPTH_TEST):n.disable(n.DEPTH_TEST),this.current=t,this.dirty=!1}}class ka extends ct{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class ks extends ct{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.BLEND):n.disable(n.BLEND),this.current=t,this.dirty=!1}}class za extends ct{getDefault(){const t=this.gl;return[t.ONE,t.ZERO]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||this.dirty)&&(this.gl.blendFunc(t[0],t[1]),this.current=t,this.dirty=!1)}}class La extends ct{getDefault(){return h.Color.transparent}set(t){const n=this.current;(t.r!==n.r||t.g!==n.g||t.b!==n.b||t.a!==n.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class En extends ct{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}}class jo extends ct{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.CULL_FACE):n.disable(n.CULL_FACE),this.current=t,this.dirty=!1}}class Go extends ct{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class Da extends ct{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}class tn extends ct{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}}class qo extends ct{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class In extends ct{getDefault(){const t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||t[3]!==n[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class An extends ct{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindFramebuffer(n.FRAMEBUFFER,t),this.current=t,this.dirty=!1}}class Zo extends ct{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindRenderbuffer(n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Ra extends ct{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindTexture(n.TEXTURE_2D,t),this.current=t,this.dirty=!1}}class yt extends ct{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindBuffer(n.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class zs extends ct{getDefault(){return null}set(t){const n=this.gl;n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class ac extends ct{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.bindVertexArray(t),this.current=t,this.dirty=!1)}}class Xo extends ct{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}}class Jn extends ct{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}}class oc extends ct{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}}class Ba extends ct{constructor(t,n){super(t),this.context=t,this.parent=n}getDefault(){return null}}class Wo extends Ba{setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class lc extends Ba{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Fa extends Ba{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Ls{constructor(t,n,a,c,p){this.context=t,this.width=n,this.height=a;const m=t.gl,y=this.framebuffer=m.createFramebuffer();if(this.colorAttachment=new Wo(t,y),c)this.depthAttachment=p?new Fa(t,y):new lc(t,y);else if(p)throw new Error("Stencil cannot be setted without depth");if(m.checkFramebufferStatus(m.FRAMEBUFFER)!==m.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer is not complete")}destroy(){const t=this.context.gl,n=this.colorAttachment.get();if(n&&t.deleteTexture(n),this.depthAttachment){const a=this.depthAttachment.get();a&&t.deleteRenderbuffer(a)}t.deleteFramebuffer(this.framebuffer)}}class Dt{constructor(t,n,a){this.blendFunction=t,this.blendColor=n,this.mask=a}}Dt.Replace=[1,0],Dt.disabled=new Dt(Dt.Replace,h.Color.transparent,[!1,!1,!1,!1]),Dt.unblended=new Dt(Dt.Replace,h.Color.transparent,[!0,!0,!0,!0]),Dt.alphaBlended=new Dt([1,771],h.Color.transparent,[!0,!0,!0,!0]);class Oa{constructor(t){this.gl=t,this.clearColor=new Ma(this),this.clearDepth=new Ms(this),this.clearStencil=new Vo(this),this.colorMask=new $o(this),this.depthMask=new Sn(this),this.stencilMask=new ec(this),this.stencilFunc=new tc(this),this.stencilOp=new ic(this),this.stencilTest=new rc(this),this.depthRange=new nc(this),this.depthTest=new sc(this),this.depthFunc=new ka(this),this.blend=new ks(this),this.blendFunc=new za(this),this.blendColor=new La(this),this.blendEquation=new En(this),this.cullFace=new jo(this),this.cullFaceSide=new Go(this),this.frontFace=new Da(this),this.program=new tn(this),this.activeTexture=new qo(this),this.viewport=new In(this),this.bindFramebuffer=new An(this),this.bindRenderbuffer=new Zo(this),this.bindTexture=new Ra(this),this.bindVertexBuffer=new yt(this),this.bindElementBuffer=new zs(this),this.bindVertexArray=new ac(this),this.pixelStoreUnpack=new Xo(this),this.pixelStoreUnpackPremultiplyAlpha=new Jn(this),this.pixelStoreUnpackFlipY=new oc(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE),this.HALF_FLOAT=t.HALF_FLOAT,t.getExtension("EXT_color_buffer_half_float"),t.getExtension("EXT_color_buffer_float"),this.RGBA16F=t.RGBA16F,this.RGB16F=t.RGB16F}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(t,n){return new Ca(this,t,n)}createVertexBuffer(t,n,a){return new Ps(this,t,n,a)}createRenderbuffer(t,n,a){const c=this.gl,p=c.createRenderbuffer();return this.bindRenderbuffer.set(p),c.renderbufferStorage(c.RENDERBUFFER,t,n,a),this.bindRenderbuffer.set(null),p}createFramebuffer(t,n,a,c){return new Ls(this,t,n,a,c)}clear({color:t,depth:n,stencil:a}){const c=this.gl;let p=0;t&&(p|=c.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),n!==void 0&&(p|=c.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(n),this.depthMask.set(!0)),a!==void 0&&(p|=c.STENCIL_BUFFER_BIT,this.clearStencil.set(a),this.stencilMask.set(255)),c.clear(p)}setCullFace(t){t.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace))}setDepthMode(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1)}setStencilMode(t){t.test.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1)}setColorMode(t){h.deepEqual(t.blendFunction,Dt.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor)),this.colorMask.set(t.mask)}createVertexArray(){return this.gl.createVertexArray()}deleteVertexArray(t){return this.gl.deleteVertexArray(t)}unbindVAO(){this.bindVertexArray.set(null)}}class at{constructor(t,n,a){this.func=t,this.mask=n,this.range=a}}at.ReadOnly=!1,at.ReadWrite=!0,at.disabled=new at(519,at.ReadOnly,[0,1]);const Ds=7680;class Tt{constructor(t,n,a,c,p,m){this.test=t,this.ref=n,this.mask=a,this.fail=c,this.depthFail=p,this.pass=m}}Tt.disabled=new Tt({func:519,mask:0},0,0,Ds,Ds,Ds);class wt{constructor(t,n,a){this.enable=t,this.mode=n,this.frontFace=a}}let Cn;function Ho(o,t,n,a,c,p,m){const y=o.context,_=y.gl,v=o.useProgram("collisionBox"),S=[];let T=0,z=0;for(let V=0;V<a.length;V++){const ie=a[V],ae=t.getTile(ie),fe=ae.getBucket(n);if(!fe)continue;let _e=ie.posMatrix;c[0]===0&&c[1]===0||(_e=o.translatePosMatrix(ie.posMatrix,ae,c,p));const xe=m?fe.textCollisionBox:fe.iconCollisionBox,ge=fe.collisionCircleArray;if(ge.length>0){const ke=h.create(),$e=_e;h.mul(ke,fe.placementInvProjMatrix,o.transform.glCoordMatrix),h.mul(ke,ke,fe.placementViewportMatrix),S.push({circleArray:ge,circleOffset:z,transform:$e,invTransform:ke,coord:ie}),T+=ge.length/4,z=T}xe&&v.draw(y,_.LINES,at.disabled,Tt.disabled,o.colorModeForRenderPass(),wt.disabled,No(_e,o.transform,ae),o.style.map.terrain&&o.style.map.terrain.getTerrainData(ie),n.id,xe.layoutVertexBuffer,xe.indexBuffer,xe.segments,null,o.transform.zoom,null,null,xe.collisionVertexBuffer)}if(!m||!S.length)return;const U=o.useProgram("collisionCircle"),R=new h.CollisionCircleLayoutArray;R.resize(4*T),R._trim();let F=0;for(const V of S)for(let ie=0;ie<V.circleArray.length/4;ie++){const ae=4*ie,fe=V.circleArray[ae+0],_e=V.circleArray[ae+1],xe=V.circleArray[ae+2],ge=V.circleArray[ae+3];R.emplace(F++,fe,_e,xe,ge,0),R.emplace(F++,fe,_e,xe,ge,1),R.emplace(F++,fe,_e,xe,ge,2),R.emplace(F++,fe,_e,xe,ge,3)}(!Cn||Cn.length<2*T)&&(Cn=function(V){const ie=2*V,ae=new h.QuadTriangleArray;ae.resize(ie),ae._trim();for(let fe=0;fe<ie;fe++){const _e=6*fe;ae.uint16[_e+0]=4*fe+0,ae.uint16[_e+1]=4*fe+1,ae.uint16[_e+2]=4*fe+2,ae.uint16[_e+3]=4*fe+2,ae.uint16[_e+4]=4*fe+3,ae.uint16[_e+5]=4*fe+0}return ae}(T));const j=y.createIndexBuffer(Cn,!0),X=y.createVertexBuffer(R,h.collisionCircleLayout.members,!0);for(const V of S){const ie={u_matrix:V.transform,u_inv_matrix:V.invTransform,u_camera_to_center_distance:(ne=o.transform).cameraToCenterDistance,u_viewport_size:[ne.width,ne.height]};U.draw(y,_.TRIANGLES,at.disabled,Tt.disabled,o.colorModeForRenderPass(),wt.disabled,ie,o.style.map.terrain&&o.style.map.terrain.getTerrainData(V.coord),n.id,X,j,h.SegmentVector.simpleSegment(0,2*V.circleOffset,V.circleArray.length,V.circleArray.length/2),null,o.transform.zoom,null,null,null)}var ne;X.destroy(),j.destroy()}wt.disabled=new wt(!1,1029,2305),wt.backCCW=new wt(!0,1029,2305);const Ua=h.identity(new Float32Array(16));function cc(o,t,n,a,c,p){const{horizontalAlign:m,verticalAlign:y}=h.getAnchorAlignment(o),_=-(m-.5)*t,v=-(y-.5)*n,S=h.evaluateVariableOffset(o,a);return new h.Point((_/c+S[0])*p,(v/c+S[1])*p)}function Ko(o,t,n,a,c,p,m,y,_,v,S){const T=o.text.placedSymbolArray,z=o.text.dynamicLayoutVertexArray,U=o.icon.dynamicLayoutVertexArray,R={};z.clear();for(let F=0;F<T.length;F++){const j=T.get(F),X=j.hidden||!j.crossTileID||o.allowVerticalPlacement&&!j.placedOrientation?null:a[j.crossTileID];if(X){const ne=new h.Point(j.anchorX,j.anchorY),V=qe(ne,n?m:p,S),ie=Ir(c.cameraToCenterDistance,V.signedDistanceFromCamera);let ae=h.evaluateSizeForFeature(o.textSizeData,_,j)*ie/h.ONE_EM;n&&(ae*=o.tilePixelRatio/y);const{width:fe,height:_e,anchor:xe,textOffset:ge,textBoxScale:ke}=X,$e=cc(xe,fe,_e,ge,ke,ae),Ye=n?qe(ne.add($e),p,S).point:V.point.add(t?$e.rotate(-c.angle):$e),we=o.allowVerticalPlacement&&j.placedOrientation===h.WritingMode.vertical?Math.PI/2:0;for(let Xe=0;Xe<j.numGlyphs;Xe++)h.addDynamicAttributes(z,Ye,we);v&&j.associatedIconIndex>=0&&(R[j.associatedIconIndex]={shiftedAnchor:Ye,angle:we})}else H(j.numGlyphs,z)}if(v){U.clear();const F=o.icon.placedSymbolArray;for(let j=0;j<F.length;j++){const X=F.get(j);if(X.hidden)H(X.numGlyphs,U);else{const ne=R[j];if(ne)for(let V=0;V<X.numGlyphs;V++)h.addDynamicAttributes(U,ne.shiftedAnchor,ne.angle);else H(X.numGlyphs,U)}}o.icon.dynamicLayoutVertexBuffer.updateData(U)}o.text.dynamicLayoutVertexBuffer.updateData(z)}function Rs(o,t,n){return n.iconsInText&&t?"symbolTextAndIcon":o?"symbolSDF":"symbolIcon"}function Bs(o,t,n,a,c,p,m,y,_,v,S,T){const z=o.context,U=z.gl,R=o.transform,F=y==="map",j=_==="map",X=y!=="viewport"&&n.layout.get("symbol-placement")!=="point",ne=F&&!j&&!X,V=!n.layout.get("symbol-sort-key").isConstant();let ie=!1;const ae=o.depthModeForSublayer(0,at.ReadOnly),fe=n.layout.get("text-variable-anchor"),_e=[];for(const xe of a){const ge=t.getTile(xe),ke=ge.getBucket(n);if(!ke)continue;const $e=c?ke.text:ke.icon;if(!$e||!$e.segments.get().length||!$e.hasVisibleVertices)continue;const Ye=$e.programConfigurations.get(n.id),we=c||ke.sdfIcons,Xe=c?ke.textSizeData:ke.iconSizeData,ze=j||R.pitch!==0,ht=o.useProgram(Rs(we,c,ke),Ye),Vt=h.evaluateSizeForZoom(Xe,R.zoom),ut=o.style.map.terrain&&o.style.map.terrain.getTerrainData(xe);let et,Ft,yi,$t,ei=[0,0],Fi=null;if(c)Ft=ge.glyphAtlasTexture,yi=U.LINEAR,et=ge.glyphAtlasTexture.size,ke.iconsInText&&(ei=ge.imageAtlasTexture.size,Fi=ge.imageAtlasTexture,$t=ze||o.options.rotating||o.options.zooming||Xe.kind==="composite"||Xe.kind==="camera"?U.LINEAR:U.NEAREST);else{const Kt=n.layout.get("icon-size").constantOr(0)!==1||ke.iconsNeedLinear;Ft=ge.imageAtlasTexture,yi=we||o.options.rotating||o.options.zooming||Kt||ze?U.LINEAR:U.NEAREST,et=ge.imageAtlasTexture.size}const ir=ce(ge,1,o.transform.zoom),rr=Jt(xe.posMatrix,j,F,o.transform,ir),xi=er(xe.posMatrix,j,F,o.transform,ir),xr=fe&&ke.hasTextData(),us=n.layout.get("icon-text-fit")!=="none"&&xr&&ke.hasIconData();if(X){const Kt=o.style.map.terrain?(na,Pr)=>o.style.map.terrain.getElevation(xe,na,Pr):null,Oi=n.layout.get("text-rotation-alignment")==="map";bn(ke,xe.posMatrix,o,c,rr,xi,j,v,Oi,Kt)}const ci=o.translatePosMatrix(xe.posMatrix,ge,p,m),ti=X||c&&fe||us?Ua:rr,dt=o.translatePosMatrix(xi,ge,p,m,!0),Ht=we&&n.paint.get(c?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let ii;ii=we?ke.iconsInText?Bi(Xe.kind,Vt,ne,j,o,ci,ti,dt,et,ei):Pi(Xe.kind,Vt,ne,j,o,ci,ti,dt,c,et,!0):Yn(Xe.kind,Vt,ne,j,o,ci,ti,dt,c,et);const mt={program:ht,buffers:$e,uniformValues:ii,atlasTexture:Ft,atlasTextureIcon:Fi,atlasInterpolation:yi,atlasInterpolationIcon:$t,isSDF:we,hasHalo:Ht};if(V&&ke.canOverlap){ie=!0;const Kt=$e.segments.get();for(const Oi of Kt)_e.push({segments:new h.SegmentVector([Oi]),sortKey:Oi.sortKey,state:mt,terrainData:ut})}else _e.push({segments:$e.segments,sortKey:0,state:mt,terrainData:ut})}ie&&_e.sort((xe,ge)=>xe.sortKey-ge.sortKey);for(const xe of _e){const ge=xe.state;if(z.activeTexture.set(U.TEXTURE0),ge.atlasTexture.bind(ge.atlasInterpolation,U.CLAMP_TO_EDGE),ge.atlasTextureIcon&&(z.activeTexture.set(U.TEXTURE1),ge.atlasTextureIcon&&ge.atlasTextureIcon.bind(ge.atlasInterpolationIcon,U.CLAMP_TO_EDGE)),ge.isSDF){const ke=ge.uniformValues;ge.hasHalo&&(ke.u_is_halo=1,Na(ge.buffers,xe.segments,n,o,ge.program,ae,S,T,ke,xe.terrainData)),ke.u_is_halo=0}Na(ge.buffers,xe.segments,n,o,ge.program,ae,S,T,ge.uniformValues,xe.terrainData)}}function Na(o,t,n,a,c,p,m,y,_,v){const S=a.context;c.draw(S,S.gl.TRIANGLES,p,m,y,wt.disabled,_,v,n.id,o.layoutVertexBuffer,o.indexBuffer,t,n.paint,a.transform.zoom,o.programConfigurations.get(n.id),o.dynamicLayoutVertexBuffer,o.opacityVertexBuffer)}function Va(o,t,n,a,c){if(!n||!a||!a.imageAtlas)return;const p=a.imageAtlas.patternPositions;let m=p[n.to.toString()],y=p[n.from.toString()];if(!m||!y){const _=c.getPaintProperty(t);m=p[_],y=p[_]}m&&y&&o.setConstantPatternPositions(m,y)}function Qn(o,t,n,a,c,p,m){const y=o.context.gl,_="fill-pattern",v=n.paint.get(_),S=v&&v.constantOr(1),T=n.getCrossfadeParameters();let z,U,R,F,j;m?(U=S&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",z=y.LINES):(U=S?"fillPattern":"fill",z=y.TRIANGLES);const X=v.constantOr(null);for(const ne of a){const V=t.getTile(ne);if(S&&!V.patternsLoaded())continue;const ie=V.getBucket(n);if(!ie)continue;const ae=ie.programConfigurations.get(n.id),fe=o.useProgram(U,ae),_e=o.style.map.terrain&&o.style.map.terrain.getTerrainData(ne);S&&(o.context.activeTexture.set(y.TEXTURE0),V.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),ae.updatePaintBuffers(T)),Va(ae,_,X,V,n);const xe=_e?ne:null,ge=o.translatePosMatrix(xe?xe.posMatrix:ne.posMatrix,V,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));if(m){F=ie.indexBuffer2,j=ie.segments2;const ke=[y.drawingBufferWidth,y.drawingBufferHeight];R=U==="fillOutlinePattern"&&S?Sa(ge,o,T,V,ke):Ql(ge,ke)}else F=ie.indexBuffer,j=ie.segments,R=S?Ta(ge,o,T,V):Oo(ge);fe.draw(o.context,z,c,o.stencilModeForClipping(ne),p,wt.disabled,R,_e,n.id,ie.layoutVertexBuffer,F,j,n.paint,o.transform.zoom,ae)}}function es(o,t,n,a,c,p,m){const y=o.context,_=y.gl,v="fill-extrusion-pattern",S=n.paint.get(v),T=S.constantOr(1),z=n.getCrossfadeParameters(),U=n.paint.get("fill-extrusion-opacity"),R=S.constantOr(null);for(const F of a){const j=t.getTile(F),X=j.getBucket(n);if(!X)continue;const ne=o.style.map.terrain&&o.style.map.terrain.getTerrainData(F),V=X.programConfigurations.get(n.id),ie=o.useProgram(T?"fillExtrusionPattern":"fillExtrusion",V);T&&(o.context.activeTexture.set(_.TEXTURE0),j.imageAtlasTexture.bind(_.LINEAR,_.CLAMP_TO_EDGE),V.updatePaintBuffers(z)),Va(V,v,R,j,n);const ae=o.translatePosMatrix(F.posMatrix,j,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),fe=n.paint.get("fill-extrusion-vertical-gradient"),_e=T?Fo(ae,o,fe,U,F,z,j):Bo(ae,o,fe,U);ie.draw(y,y.gl.TRIANGLES,c,p,m,wt.backCCW,_e,ne,n.id,X.layoutVertexBuffer,X.indexBuffer,X.segments,n.paint,o.transform.zoom,V,o.style.map.terrain&&X.centroidVertexBuffer)}}function hc(o,t,n,a,c,p,m){const y=o.context,_=y.gl,v=n.fbo;if(!v)return;const S=o.useProgram("hillshade"),T=o.style.map.terrain&&o.style.map.terrain.getTerrainData(t);y.activeTexture.set(_.TEXTURE0),_.bindTexture(_.TEXTURE_2D,v.colorAttachment.get()),S.draw(y,_.TRIANGLES,c,p,m,wt.disabled,((z,U,R,F)=>{const j=R.paint.get("hillshade-shadow-color"),X=R.paint.get("hillshade-highlight-color"),ne=R.paint.get("hillshade-accent-color");let V=R.paint.get("hillshade-illumination-direction")*(Math.PI/180);R.paint.get("hillshade-illumination-anchor")==="viewport"&&(V-=z.transform.angle);const ie=!z.options.moving;return{u_matrix:F?F.posMatrix:z.transform.calculatePosMatrix(U.tileID.toUnwrapped(),ie),u_image:0,u_latrange:Ss(0,U.tileID),u_light:[R.paint.get("hillshade-exaggeration"),V],u_shadow:j,u_highlight:X,u_accent:ne}})(o,n,a,T?t:null),T,a.id,o.rasterBoundsBuffer,o.quadTriangleIndexBuffer,o.rasterBoundsSegments)}function Yo(o,t,n,a,c,p){const m=o.context,y=m.gl,_=t.dem;if(_&&_.data){const v=_.dim,S=_.stride,T=_.getPixels();if(m.activeTexture.set(y.TEXTURE1),m.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||o.getTileTexture(S),t.demTexture){const U=t.demTexture;U.update(T,{premultiply:!1}),U.bind(y.NEAREST,y.CLAMP_TO_EDGE)}else t.demTexture=new xt(m,T,y.RGBA,{premultiply:!1}),t.demTexture.bind(y.NEAREST,y.CLAMP_TO_EDGE);m.activeTexture.set(y.TEXTURE0);let z=t.fbo;if(!z){const U=new xt(m,{width:v,height:v,data:null},y.RGBA);U.bind(y.LINEAR,y.CLAMP_TO_EDGE),z=t.fbo=m.createFramebuffer(v,v,!0,!1),z.colorAttachment.set(U.texture)}m.bindFramebuffer.set(z.framebuffer),m.viewport.set([0,0,v,v]),o.useProgram("hillshadePrepare").draw(m,y.TRIANGLES,a,c,p,wt.disabled,((U,R)=>{const F=R.stride,j=h.create();return h.ortho(j,0,h.EXTENT,-h.EXTENT,0,0,1),h.translate(j,j,[0,-h.EXTENT,0]),{u_matrix:j,u_image:1,u_dimension:[F,F],u_zoom:U.overscaledZ,u_unpack:R.getUnpackVector()}})(t.tileID,_),null,n.id,o.rasterBoundsBuffer,o.quadTriangleIndexBuffer,o.rasterBoundsSegments),t.needsHillshadePrepare=!1}}function Nt(o,t,n,a,c,p){const m=a.paint.get("raster-fade-duration");if(!p&&m>0){const y=h.exported.now(),_=(y-o.timeAdded)/m,v=t?(y-t.timeAdded)/m:-1,S=n.getSource(),T=c.coveringZoomLevel({tileSize:S.tileSize,roundZoom:S.roundZoom}),z=!t||Math.abs(t.tileID.overscaledZ-T)>Math.abs(o.tileID.overscaledZ-T),U=z&&o.refreshedUponExpiration?1:h.clamp(z?_:1-v,0,1);return o.refreshedUponExpiration&&_>=1&&(o.refreshedUponExpiration=!1),t?{opacity:1,mix:1-U}:{opacity:U,mix:0}}return{opacity:1,mix:0}}const rn=new h.Color(1,0,0,1),Wi=new h.Color(0,1,0,1),Jo=new h.Color(0,0,1,1),$a=new h.Color(1,0,1,1),Qo=new h.Color(0,1,1,1);function nn(o,t,n,a){Pn(o,0,t+n/2,o.transform.width,n,a)}function ts(o,t,n,a){Pn(o,t-n/2,0,n,o.transform.height,a)}function Pn(o,t,n,a,c,p){const m=o.context,y=m.gl;y.enable(y.SCISSOR_TEST),y.scissor(t*o.pixelRatio,n*o.pixelRatio,a*o.pixelRatio,c*o.pixelRatio),m.clear({color:p}),y.disable(y.SCISSOR_TEST)}function el(o,t,n){const a=o.context,c=a.gl,p=n.posMatrix,m=o.useProgram("debug"),y=at.disabled,_=Tt.disabled,v=o.colorModeForRenderPass(),S="$debug",T=o.style.map.terrain&&o.style.map.terrain.getTerrainData(n);a.activeTexture.set(c.TEXTURE0);const z=t.getTileByID(n.key).latestRawTileData,U=Math.floor((z&&z.byteLength||0)/1024),R=t.getTile(n).tileSize,F=512/Math.min(R,512)*(n.overscaledZ/o.transform.zoom)*.5;let j=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(j+=` => ${n.overscaledZ}`),function(X,ne){X.initDebugOverlayCanvas();const V=X.debugOverlayCanvas,ie=X.context.gl,ae=X.debugOverlayCanvas.getContext("2d");ae.clearRect(0,0,V.width,V.height),ae.shadowColor="white",ae.shadowBlur=2,ae.lineWidth=1.5,ae.strokeStyle="white",ae.textBaseline="top",ae.font="bold 36px Open Sans, sans-serif",ae.fillText(ne,5,5),ae.strokeText(ne,5,5),X.debugOverlayTexture.update(V),X.debugOverlayTexture.bind(ie.LINEAR,ie.CLAMP_TO_EDGE)}(o,`${j} ${U}kB`),m.draw(a,c.TRIANGLES,y,_,Dt.alphaBlended,wt.disabled,Ea(p,h.Color.transparent,F),null,S,o.debugBuffer,o.quadTriangleIndexBuffer,o.debugSegments),m.draw(a,c.LINE_STRIP,y,_,v,wt.disabled,Ea(p,h.Color.red),T,S,o.debugBuffer,o.tileBorderIndexBuffer,o.debugSegments)}function ja(o,t,n){const a=o.context,c=a.gl,p=o.colorModeForRenderPass(),m=new at(c.LEQUAL,at.ReadWrite,o.depthRangeFor3D),y=o.useProgram("terrain"),_=t.getTerrainMesh();a.bindFramebuffer.set(null),a.viewport.set([0,0,o.width,o.height]);for(const v of n){const S=o.renderToTexture.getTexture(v),T=t.getTerrainData(v.tileID);a.activeTexture.set(c.TEXTURE0),c.bindTexture(c.TEXTURE_2D,S.texture);const z={u_matrix:o.transform.calculatePosMatrix(v.tileID.toUnwrapped()),u_texture:0,u_ele_delta:t.getMeshFrameDelta(o.transform.zoom)};y.draw(a,c.TRIANGLES,m,Tt.disabled,p,wt.backCCW,z,T,"terrain",_.vertexBuffer,_.indexBuffer,_.segments)}}const Ga={symbol:function(o,t,n,a,c){if(o.renderPass!=="translucent")return;const p=Tt.disabled,m=o.colorModeForRenderPass();n.layout.get("text-variable-anchor")&&function(y,_,v,S,T,z,U){const R=_.transform,F=T==="map",j=z==="map";for(const X of y){const ne=S.getTile(X),V=ne.getBucket(v);if(!V||!V.text||!V.text.segments.get().length)continue;const ie=h.evaluateSizeForZoom(V.textSizeData,R.zoom),ae=ce(ne,1,_.transform.zoom),fe=Jt(X.posMatrix,j,F,_.transform,ae),_e=v.layout.get("icon-text-fit")!=="none"&&V.hasIconData();if(ie){const xe=Math.pow(2,R.zoom-ne.tileID.overscaledZ);Ko(V,F,j,U,R,fe,X.posMatrix,xe,ie,_e,_.style.map.terrain?(ge,ke)=>_.style.map.terrain.getElevation(X,ge,ke):null)}}}(a,o,n,t,n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),c),n.paint.get("icon-opacity").constantOr(1)!==0&&Bs(o,t,n,a,!1,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),n.layout.get("icon-rotation-alignment"),n.layout.get("icon-pitch-alignment"),n.layout.get("icon-keep-upright"),p,m),n.paint.get("text-opacity").constantOr(1)!==0&&Bs(o,t,n,a,!0,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),n.layout.get("text-keep-upright"),p,m),t.map.showCollisionBoxes&&(Ho(o,t,n,a,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),!0),Ho(o,t,n,a,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),!1))},circle:function(o,t,n,a){if(o.renderPass!=="translucent")return;const c=n.paint.get("circle-opacity"),p=n.paint.get("circle-stroke-width"),m=n.paint.get("circle-stroke-opacity"),y=!n.layout.get("circle-sort-key").isConstant();if(c.constantOr(1)===0&&(p.constantOr(1)===0||m.constantOr(1)===0))return;const _=o.context,v=_.gl,S=o.depthModeForSublayer(0,at.ReadOnly),T=Tt.disabled,z=o.colorModeForRenderPass(),U=[];for(let R=0;R<a.length;R++){const F=a[R],j=t.getTile(F),X=j.getBucket(n);if(!X)continue;const ne=X.programConfigurations.get(n.id),V=o.useProgram("circle",ne),ie=X.layoutVertexBuffer,ae=X.indexBuffer,fe=o.style.map.terrain&&o.style.map.terrain.getTerrainData(F),_e={programConfiguration:ne,program:V,layoutVertexBuffer:ie,indexBuffer:ae,uniformValues:Uo(o,F,j,n),terrainData:fe};if(y){const xe=X.segments.get();for(const ge of xe)U.push({segments:new h.SegmentVector([ge]),sortKey:ge.sortKey,state:_e})}else U.push({segments:X.segments,sortKey:0,state:_e})}y&&U.sort((R,F)=>R.sortKey-F.sortKey);for(const R of U){const{programConfiguration:F,program:j,layoutVertexBuffer:X,indexBuffer:ne,uniformValues:V,terrainData:ie}=R.state;j.draw(_,v.TRIANGLES,S,T,z,wt.disabled,V,ie,n.id,X,ne,R.segments,n.paint,o.transform.zoom,F)}},heatmap:function(o,t,n,a){if(n.paint.get("heatmap-opacity")!==0)if(o.renderPass==="offscreen"){const c=o.context,p=c.gl,m=Tt.disabled,y=new Dt([p.ONE,p.ONE],h.Color.transparent,[!0,!0,!0,!0]);(function(_,v,S){const T=_.gl;_.activeTexture.set(T.TEXTURE1),_.viewport.set([0,0,v.width/4,v.height/4]);let z=S.heatmapFbo;if(z)T.bindTexture(T.TEXTURE_2D,z.colorAttachment.get()),_.bindFramebuffer.set(z.framebuffer);else{const U=T.createTexture();T.bindTexture(T.TEXTURE_2D,U),T.texParameteri(T.TEXTURE_2D,T.TEXTURE_WRAP_S,T.CLAMP_TO_EDGE),T.texParameteri(T.TEXTURE_2D,T.TEXTURE_WRAP_T,T.CLAMP_TO_EDGE),T.texParameteri(T.TEXTURE_2D,T.TEXTURE_MIN_FILTER,T.LINEAR),T.texParameteri(T.TEXTURE_2D,T.TEXTURE_MAG_FILTER,T.LINEAR),z=S.heatmapFbo=_.createFramebuffer(v.width/4,v.height/4,!1,!1),function(R,F,j,X){var ne,V;const ie=R.gl,ae=(ne=R.HALF_FLOAT)!==null&&ne!==void 0?ne:ie.UNSIGNED_BYTE,fe=(V=R.RGBA16F)!==null&&V!==void 0?V:ie.RGBA;ie.texImage2D(ie.TEXTURE_2D,0,fe,F.width/4,F.height/4,0,ie.RGBA,ae,null),X.colorAttachment.set(j)}(_,v,U,z)}})(c,o,n),c.clear({color:h.Color.transparent});for(let _=0;_<a.length;_++){const v=a[_];if(t.hasRenderableParent(v))continue;const S=t.getTile(v),T=S.getBucket(n);if(!T)continue;const z=T.programConfigurations.get(n.id),U=o.useProgram("heatmap",z),{zoom:R}=o.transform;U.draw(c,p.TRIANGLES,at.disabled,m,y,wt.disabled,en(v.posMatrix,S,R,n.paint.get("heatmap-intensity")),null,n.id,T.layoutVertexBuffer,T.indexBuffer,T.segments,n.paint,o.transform.zoom,z)}c.viewport.set([0,0,o.width,o.height])}else o.renderPass==="translucent"&&(o.context.setColorMode(o.colorModeForRenderPass()),function(c,p){const m=c.context,y=m.gl,_=p.heatmapFbo;if(!_)return;m.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,_.colorAttachment.get()),m.activeTexture.set(y.TEXTURE1);let v=p.colorRampTexture;v||(v=p.colorRampTexture=new xt(m,p.colorRamp,y.RGBA)),v.bind(y.LINEAR,y.CLAMP_TO_EDGE),c.useProgram("heatmapTexture").draw(m,y.TRIANGLES,at.disabled,Tt.disabled,c.colorModeForRenderPass(),wt.disabled,((S,T,z,U)=>{const R=h.create();h.ortho(R,0,S.width,S.height,0,0,1);const F=S.context.gl;return{u_matrix:R,u_world:[F.drawingBufferWidth,F.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:T.paint.get("heatmap-opacity")}})(c,p),null,p.id,c.viewportBuffer,c.quadTriangleIndexBuffer,c.viewportSegments,p.paint,c.transform.zoom)}(o,n))},line:function(o,t,n,a){if(o.renderPass!=="translucent")return;const c=n.paint.get("line-opacity"),p=n.paint.get("line-width");if(c.constantOr(1)===0||p.constantOr(1)===0)return;const m=o.depthModeForSublayer(0,at.ReadOnly),y=o.colorModeForRenderPass(),_=n.paint.get("line-dasharray"),v=n.paint.get("line-pattern"),S=v.constantOr(1),T=n.paint.get("line-gradient"),z=n.getCrossfadeParameters(),U=S?"linePattern":_?"lineSDF":T?"lineGradient":"line",R=o.context,F=R.gl;let j=!0;for(const X of a){const ne=t.getTile(X);if(S&&!ne.patternsLoaded())continue;const V=ne.getBucket(n);if(!V)continue;const ie=V.programConfigurations.get(n.id),ae=o.context.program.get(),fe=o.useProgram(U,ie),_e=j||fe.program!==ae,xe=o.style.map.terrain&&o.style.map.terrain.getTerrainData(X),ge=v.constantOr(null);if(ge&&ne.imageAtlas){const Ye=ne.imageAtlas,we=Ye.patternPositions[ge.to.toString()],Xe=Ye.patternPositions[ge.from.toString()];we&&Xe&&ie.setConstantPatternPositions(we,Xe)}const ke=xe?X:null,$e=S?Is(o,ne,n,z,ke):_?Zn(o,ne,n,_,z,ke):T?Es(o,ne,n,V.lineClipsArray.length,ke):Ci(o,ne,n,ke);if(S)R.activeTexture.set(F.TEXTURE0),ne.imageAtlasTexture.bind(F.LINEAR,F.CLAMP_TO_EDGE),ie.updatePaintBuffers(z);else if(_&&(_e||o.lineAtlas.dirty))R.activeTexture.set(F.TEXTURE0),o.lineAtlas.bind(R);else if(T){const Ye=V.gradients[n.id];let we=Ye.texture;if(n.gradientVersion!==Ye.version){let Xe=256;if(n.stepInterpolant){const ze=t.getSource().maxzoom,ht=X.canonical.z===ze?Math.ceil(1<<o.transform.maxZoom-X.canonical.z):1;Xe=h.clamp(h.nextPowerOfTwo(V.maxLineLength/h.EXTENT*1024*ht),256,R.maxTextureSize)}Ye.gradient=h.renderColorRamp({expression:n.gradientExpression(),evaluationKey:"lineProgress",resolution:Xe,image:Ye.gradient||void 0,clips:V.lineClipsArray}),Ye.texture?Ye.texture.update(Ye.gradient):Ye.texture=new xt(R,Ye.gradient,F.RGBA),Ye.version=n.gradientVersion,we=Ye.texture}R.activeTexture.set(F.TEXTURE0),we.bind(n.stepInterpolant?F.NEAREST:F.LINEAR,F.CLAMP_TO_EDGE)}fe.draw(R,F.TRIANGLES,m,o.stencilModeForClipping(X),y,wt.disabled,$e,xe,n.id,V.layoutVertexBuffer,V.indexBuffer,V.segments,n.paint,o.transform.zoom,ie,V.layoutVertexBuffer2),j=!1}},fill:function(o,t,n,a){const c=n.paint.get("fill-color"),p=n.paint.get("fill-opacity");if(p.constantOr(1)===0)return;const m=o.colorModeForRenderPass(),y=n.paint.get("fill-pattern"),_=o.opaquePassEnabledForLayer()&&!y.constantOr(1)&&c.constantOr(h.Color.transparent).a===1&&p.constantOr(0)===1?"opaque":"translucent";if(o.renderPass===_){const v=o.depthModeForSublayer(1,o.renderPass==="opaque"?at.ReadWrite:at.ReadOnly);Qn(o,t,n,a,v,m,!1)}if(o.renderPass==="translucent"&&n.paint.get("fill-antialias")){const v=o.depthModeForSublayer(n.getPaintProperty("fill-outline-color")?2:0,at.ReadOnly);Qn(o,t,n,a,v,m,!0)}},"fill-extrusion":function(o,t,n,a){const c=n.paint.get("fill-extrusion-opacity");if(c!==0&&o.renderPass==="translucent"){const p=new at(o.context.gl.LEQUAL,at.ReadWrite,o.depthRangeFor3D);if(c!==1||n.paint.get("fill-extrusion-pattern").constantOr(1))es(o,t,n,a,p,Tt.disabled,Dt.disabled),es(o,t,n,a,p,o.stencilModeFor3D(),o.colorModeForRenderPass());else{const m=o.colorModeForRenderPass();es(o,t,n,a,p,Tt.disabled,m)}}},hillshade:function(o,t,n,a){if(o.renderPass!=="offscreen"&&o.renderPass!=="translucent")return;const c=o.context,p=o.depthModeForSublayer(0,at.ReadOnly),m=o.colorModeForRenderPass(),[y,_]=o.renderPass==="translucent"?o.stencilConfigForOverlap(a):[{},a];for(const v of _){const S=t.getTile(v);S.needsHillshadePrepare!==void 0&&S.needsHillshadePrepare&&o.renderPass==="offscreen"?Yo(o,S,n,p,Tt.disabled,m):o.renderPass==="translucent"&&hc(o,v,S,n,p,y[v.overscaledZ],m)}c.viewport.set([0,0,o.width,o.height])},raster:function(o,t,n,a){if(o.renderPass!=="translucent"||n.paint.get("raster-opacity")===0||!a.length)return;const c=o.context,p=c.gl,m=t.getSource(),y=o.useProgram("raster"),_=o.colorModeForRenderPass(),[v,S]=m instanceof Zi?[{},a]:o.stencilConfigForOverlap(a),T=S[S.length-1].overscaledZ,z=!o.options.moving;for(const U of S){const R=o.depthModeForSublayer(U.overscaledZ-T,n.paint.get("raster-opacity")===1?at.ReadWrite:at.ReadOnly,p.LESS),F=t.getTile(U);F.registerFadeDuration(n.paint.get("raster-fade-duration"));const j=t.findLoadedParent(U,0),X=Nt(F,j,t,n,o.transform,o.style.map.terrain);let ne,V;const ie=n.paint.get("raster-resampling")==="nearest"?p.NEAREST:p.LINEAR;c.activeTexture.set(p.TEXTURE0),F.texture.bind(ie,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST),c.activeTexture.set(p.TEXTURE1),j?(j.texture.bind(ie,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST),ne=Math.pow(2,j.tileID.overscaledZ-F.tileID.overscaledZ),V=[F.tileID.canonical.x*ne%1,F.tileID.canonical.y*ne%1]):F.texture.bind(ie,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST);const ae=o.style.map.terrain&&o.style.map.terrain.getTerrainData(U),fe=ae?U:null,_e=fe?fe.posMatrix:o.transform.calculatePosMatrix(U.toUnwrapped(),z),xe=Hn(_e,V||[0,0],ne||1,X,n);m instanceof Zi?y.draw(c,p.TRIANGLES,R,Tt.disabled,_,wt.disabled,xe,ae,n.id,m.boundsBuffer,o.quadTriangleIndexBuffer,m.boundsSegments):y.draw(c,p.TRIANGLES,R,v[U.overscaledZ],_,wt.disabled,xe,ae,n.id,o.rasterBoundsBuffer,o.quadTriangleIndexBuffer,o.rasterBoundsSegments)}},background:function(o,t,n,a){const c=n.paint.get("background-color"),p=n.paint.get("background-opacity");if(p===0)return;const m=o.context,y=m.gl,_=o.transform,v=_.tileSize,S=n.paint.get("background-pattern");if(o.isPatternMissing(S))return;const T=!S&&c.a===1&&p===1&&o.opaquePassEnabledForLayer()?"opaque":"translucent";if(o.renderPass!==T)return;const z=Tt.disabled,U=o.depthModeForSublayer(0,T==="opaque"?at.ReadWrite:at.ReadOnly),R=o.colorModeForRenderPass(),F=o.useProgram(S?"backgroundPattern":"background"),j=a||_.coveringTiles({tileSize:v,terrain:o.style.map.terrain});S&&(m.activeTexture.set(y.TEXTURE0),o.imageManager.bind(o.context));const X=n.getCrossfadeParameters();for(const ne of j){const V=a?ne.posMatrix:o.transform.calculatePosMatrix(ne.toUnwrapped()),ie=S?As(V,p,o,S,{tileID:ne,tileSize:v},X):Aa(V,p,c),ae=o.style.map.terrain&&o.style.map.terrain.getTerrainData(ne);F.draw(m,y.TRIANGLES,U,z,R,wt.disabled,ie,ae,n.id,o.tileExtentBuffer,o.quadTriangleIndexBuffer,o.tileExtentSegments)}},debug:function(o,t,n){for(let a=0;a<n.length;a++)el(o,t,n[a])},custom:function(o,t,n){const a=o.context,c=n.implementation;if(o.renderPass==="offscreen"){const p=c.prerender;p&&(o.setCustomLayerDefaults(),a.setColorMode(o.colorModeForRenderPass()),p.call(c,a.gl,o.transform.customLayerMatrix()),a.setDirty(),o.setBaseState())}else if(o.renderPass==="translucent"){o.setCustomLayerDefaults(),a.setColorMode(o.colorModeForRenderPass()),a.setStencilMode(Tt.disabled);const p=c.renderingMode==="3d"?new at(o.context.gl.LEQUAL,at.ReadWrite,o.depthRangeFor3D):o.depthModeForSublayer(0,at.ReadOnly);a.setDepthMode(p),c.render(a.gl,o.transform.customLayerMatrix()),a.setDirty(),o.setBaseState(),a.bindFramebuffer.set(null)}}};class tl{constructor(t,n){this.context=new Oa(t),this.transform=n,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:h.create(),renderTime:0},this.setup(),this.numSublayers=ni.maxUnderzooming+ni.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new qn}resize(t,n,a){if(this.width=t*a,this.height=n*a,this.pixelRatio=a,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const c of this.style._order)this.style._layers[c].resize()}setup(){const t=this.context,n=new h.PosArray;n.emplaceBack(0,0),n.emplaceBack(h.EXTENT,0),n.emplaceBack(0,h.EXTENT),n.emplaceBack(h.EXTENT,h.EXTENT),this.tileExtentBuffer=t.createVertexBuffer(n,wn.members),this.tileExtentSegments=h.SegmentVector.simpleSegment(0,0,4,2);const a=new h.PosArray;a.emplaceBack(0,0),a.emplaceBack(h.EXTENT,0),a.emplaceBack(0,h.EXTENT),a.emplaceBack(h.EXTENT,h.EXTENT),this.debugBuffer=t.createVertexBuffer(a,wn.members),this.debugSegments=h.SegmentVector.simpleSegment(0,0,4,5);const c=new h.RasterBoundsArray;c.emplaceBack(0,0,0,0),c.emplaceBack(h.EXTENT,0,h.EXTENT,0),c.emplaceBack(0,h.EXTENT,0,h.EXTENT),c.emplaceBack(h.EXTENT,h.EXTENT,h.EXTENT,h.EXTENT),this.rasterBoundsBuffer=t.createVertexBuffer(c,ur.members),this.rasterBoundsSegments=h.SegmentVector.simpleSegment(0,0,4,2);const p=new h.PosArray;p.emplaceBack(0,0),p.emplaceBack(1,0),p.emplaceBack(0,1),p.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(p,wn.members),this.viewportSegments=h.SegmentVector.simpleSegment(0,0,4,2);const m=new h.LineStripIndexArray;m.emplaceBack(0),m.emplaceBack(1),m.emplaceBack(3),m.emplaceBack(2),m.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(m);const y=new h.TriangleIndexArray;y.emplaceBack(0,1,2),y.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(y);const _=this.context.gl;this.stencilClearMode=new Tt({func:_.ALWAYS,mask:0},0,255,_.ZERO,_.ZERO,_.ZERO)}clearStencil(){const t=this.context,n=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const a=h.create();h.ortho(a,0,this.width,this.height,0,0,1),h.scale(a,a,[n.drawingBufferWidth,n.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(t,n.TRIANGLES,at.disabled,this.stencilClearMode,Dt.disabled,wt.disabled,Ia(a),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,n){if(this.currentStencilSource===t.source||!t.isTileClipped()||!n||!n.length)return;this.currentStencilSource=t.source;const a=this.context,c=a.gl;this.nextStencilID+n.length>256&&this.clearStencil(),a.setColorMode(Dt.disabled),a.setDepthMode(at.disabled);const p=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const m of n){const y=this._tileClippingMaskIDs[m.key]=this.nextStencilID++,_=this.style.map.terrain&&this.style.map.terrain.getTerrainData(m);p.draw(a,c.TRIANGLES,at.disabled,new Tt({func:c.ALWAYS,mask:0},y,255,c.KEEP,c.KEEP,c.REPLACE),Dt.disabled,wt.disabled,Ia(m.posMatrix),_,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,n=this.context.gl;return new Tt({func:n.NOTEQUAL,mask:255},t,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(t){const n=this.context.gl;return new Tt({func:n.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,n.KEEP,n.KEEP,n.REPLACE)}stencilConfigForOverlap(t){const n=this.context.gl,a=t.sort((m,y)=>y.overscaledZ-m.overscaledZ),c=a[a.length-1].overscaledZ,p=a[0].overscaledZ-c+1;if(p>1){this.currentStencilSource=void 0,this.nextStencilID+p>256&&this.clearStencil();const m={};for(let y=0;y<p;y++)m[y+c]=new Tt({func:n.GEQUAL,mask:255},y+this.nextStencilID,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID+=p,[m,a]}return[{[c]:Tt.disabled},a]}colorModeForRenderPass(){const t=this.context.gl;return this._showOverdrawInspector?new Dt([t.CONSTANT_COLOR,t.ONE],new h.Color(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Dt.unblended:Dt.alphaBlended}depthModeForSublayer(t,n,a){if(!this.opaquePassEnabledForLayer())return at.disabled;const c=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new at(a||this.context.gl.LEQUAL,n,[c,c])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(t,n){this.style=t,this.options=n,this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(h.exported.now()),this.imageManager.beginFrame();const a=this.style._order,c=this.style.sourceCaches,p={},m={},y={};for(const _ in c){const v=c[_];v.used&&v.prepare(this.context),p[_]=v.getVisibleCoordinates(),m[_]=p[_].slice().reverse(),y[_]=v.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let _=0;_<a.length;_++)if(this.style._layers[a[_]].is3D()){this.opaquePassCutoff=_;break}if(this.renderToTexture){this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0;const _=this.style.map.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime);(this.terrainFacilitator.dirty||!h.equals(this.terrainFacilitator.matrix,this.transform.projMatrix)||_.length)&&(h.copy(this.terrainFacilitator.matrix,this.transform.projMatrix),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(v,S){const T=v.context,z=T.gl,U=Dt.unblended,R=new at(z.LEQUAL,at.ReadWrite,[0,1]),F=S.getTerrainMesh(),j=S.sourceCache.getRenderableTiles(),X=v.useProgram("terrainDepth");T.bindFramebuffer.set(S.getFramebuffer("depth").framebuffer),T.viewport.set([0,0,v.width/devicePixelRatio,v.height/devicePixelRatio]),T.clear({color:h.Color.transparent,depth:1});for(const ne of j){const V=S.getTerrainData(ne.tileID),ie={u_matrix:v.transform.calculatePosMatrix(ne.tileID.toUnwrapped()),u_ele_delta:S.getMeshFrameDelta(v.transform.zoom)};X.draw(T,z.TRIANGLES,R,Tt.disabled,U,wt.backCCW,ie,V,"terrain",F.vertexBuffer,F.indexBuffer,F.segments)}T.bindFramebuffer.set(null),T.viewport.set([0,0,v.width,v.height])}(this,this.style.map.terrain),function(v,S){const T=v.context,z=T.gl,U=Dt.unblended,R=new at(z.LEQUAL,at.ReadWrite,[0,1]),F=S.getTerrainMesh(),j=S.getCoordsTexture(),X=S.sourceCache.getRenderableTiles(),ne=v.useProgram("terrainCoords");T.bindFramebuffer.set(S.getFramebuffer("coords").framebuffer),T.viewport.set([0,0,v.width/devicePixelRatio,v.height/devicePixelRatio]),T.clear({color:h.Color.transparent,depth:1}),S.coordsIndex=[];for(const V of X){const ie=S.getTerrainData(V.tileID);T.activeTexture.set(z.TEXTURE0),z.bindTexture(z.TEXTURE_2D,j.texture);const ae={u_matrix:v.transform.calculatePosMatrix(V.tileID.toUnwrapped()),u_terrain_coords_id:(255-S.coordsIndex.length)/255,u_texture:0,u_ele_delta:S.getMeshFrameDelta(v.transform.zoom)};ne.draw(T,z.TRIANGLES,R,Tt.disabled,U,wt.backCCW,ae,ie,"terrain",F.vertexBuffer,F.indexBuffer,F.segments),S.coordsIndex.push(V.tileID.key)}T.bindFramebuffer.set(null),T.viewport.set([0,0,v.width,v.height])}(this,this.style.map.terrain))}this.renderPass="offscreen";for(const _ of a){const v=this.style._layers[_];if(!v.hasOffscreenPass()||v.isHidden(this.transform.zoom))continue;const S=m[v.source];(v.type==="custom"||S.length)&&this.renderLayer(this,c[v.source],v,S)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:n.showOverdrawInspector?h.Color.black:h.Color.transparent,depth:1}),this.clearStencil(),this._showOverdrawInspector=n.showOverdrawInspector,this.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=a.length-1;this.currentLayer>=0;this.currentLayer--){const _=this.style._layers[a[this.currentLayer]],v=c[_.source],S=p[_.source];this._renderTileClippingMasks(_,S),this.renderLayer(this,v,_,S)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<a.length;this.currentLayer++){const _=this.style._layers[a[this.currentLayer]],v=c[_.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(_))continue;const S=(_.type==="symbol"?y:m)[_.source];this._renderTileClippingMasks(_,p[_.source]),this.renderLayer(this,v,_,S)}if(this.options.showTileBoundaries){const _=function(v,S){let T=null;const z=Object.values(v._layers).flatMap(j=>j.source&&!j.isHidden(S)?[v.sourceCaches[j.source]]:[]),U=z.filter(j=>j.getSource().type==="vector"),R=z.filter(j=>j.getSource().type!=="vector"),F=j=>{(!T||T.getSource().maxzoom<j.getSource().maxzoom)&&(T=j)};return U.forEach(j=>F(j)),T||R.forEach(j=>F(j)),T}(this.style,this.transform.zoom);_&&Ga.debug(this,_,_.getVisibleCoordinates())}this.options.showPadding&&function(_){const v=_.transform.padding;nn(_,_.transform.height-(v.top||0),3,rn),nn(_,v.bottom||0,3,Wi),ts(_,v.left||0,3,Jo),ts(_,_.transform.width-(v.right||0),3,$a);const S=_.transform.centerPoint;(function(T,z,U,R){Pn(T,z-1,U-10,2,20,R),Pn(T,z-10,U-1,20,2,R)})(_,S.x,_.transform.height-S.y,Qo)}(this),this.context.setDefault()}renderLayer(t,n,a,c){a.isHidden(this.transform.zoom)||(a.type==="background"||a.type==="custom"||(c||[]).length)&&(this.id=a.id,Ga[a.type](t,n,a,c,this.style.placement.variableOffsets))}translatePosMatrix(t,n,a,c,p){if(!a[0]&&!a[1])return t;const m=p?c==="map"?this.transform.angle:0:c==="viewport"?-this.transform.angle:0;if(m){const v=Math.sin(m),S=Math.cos(m);a=[a[0]*S-a[1]*v,a[0]*v+a[1]*S]}const y=[p?a[0]:ce(n,a[0],this.transform.zoom),p?a[1]:ce(n,a[1],this.transform.zoom),0],_=new Float32Array(16);return h.translate(_,t,y),_}saveTileTexture(t){const n=this._tileTextures[t.size[0]];n?n.push(t):this._tileTextures[t.size[0]]=[t]}getTileTexture(t){const n=this._tileTextures[t];return n&&n.length>0?n.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;const n=this.imageManager.getPattern(t.from.toString()),a=this.imageManager.getPattern(t.to.toString());return!n||!a}useProgram(t,n){this.cache=this.cache||{};const a=t+(n?n.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[a]||(this.cache[a]=new Jl(this.context,t,Xi[t],n,Cs[t],this._showOverdrawInspector,this.style.map.terrain)),this.cache[a]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new xt(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}}class Fs{constructor(t,n){this.points=t,this.planes=n}static fromInvProjectionMatrix(t,n,a){const c=Math.pow(2,a),p=[[-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(y=>{const _=1/(y=h.transformMat4([],y,t))[3]/n*c;return h.mul$1(y,y,[_,_,1/y[3],_])}),m=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(y=>{const _=function(z,U){var R=U[0],F=U[1],j=U[2],X=R*R+F*F+j*j;return X>0&&(X=1/Math.sqrt(X)),z[0]=U[0]*X,z[1]=U[1]*X,z[2]=U[2]*X,z}([],function(z,U,R){var F=U[0],j=U[1],X=U[2],ne=R[0],V=R[1],ie=R[2];return z[0]=j*ie-X*V,z[1]=X*ne-F*ie,z[2]=F*V-j*ne,z}([],mn([],p[y[0]],p[y[1]]),mn([],p[y[2]],p[y[1]]))),v=-((S=_)[0]*(T=p[y[1]])[0]+S[1]*T[1]+S[2]*T[2]);var S,T;return _.concat(v)});return new Fs(p,m)}}class pr{constructor(t,n){this.min=t,this.max=n,this.center=function(a,c,p){return a[0]=.5*c[0],a[1]=.5*c[1],a[2]=.5*c[2],a}([],function(a,c,p){return a[0]=c[0]+p[0],a[1]=c[1]+p[1],a[2]=c[2]+p[2],a}([],this.min,this.max))}quadrant(t){const n=[t%2==0,t<2],a=Un(this.min),c=Un(this.max);for(let p=0;p<n.length;p++)a[p]=n[p]?this.min[p]:this.center[p],c[p]=n[p]?this.center[p]:this.max[p];return c[2]=this.max[2],new pr(a,c)}distanceX(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]}distanceY(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]}intersects(t){const 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]];let a=!0;for(let c=0;c<t.planes.length;c++){const p=t.planes[c];let m=0;for(let y=0;y<n.length;y++)h.dot(p,n[y])>=0&&m++;if(m===0)return 0;m!==n.length&&(a=!1)}if(a)return 2;for(let c=0;c<3;c++){let p=Number.MAX_VALUE,m=-Number.MAX_VALUE;for(let y=0;y<t.points.length;y++){const _=t.points[y][c]-this.min[c];p=Math.min(p,_),m=Math.max(m,_)}if(m<0||p>this.max[c]-this.min[c])return 0}return 1}}class Os{constructor(t=0,n=0,a=0,c=0){if(isNaN(t)||t<0||isNaN(n)||n<0||isNaN(a)||a<0||isNaN(c)||c<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=n,this.left=a,this.right=c}interpolate(t,n,a){return n.top!=null&&t.top!=null&&(this.top=h.interpolate.number(t.top,n.top,a)),n.bottom!=null&&t.bottom!=null&&(this.bottom=h.interpolate.number(t.bottom,n.bottom,a)),n.left!=null&&t.left!=null&&(this.left=h.interpolate.number(t.left,n.left,a)),n.right!=null&&t.right!=null&&(this.right=h.interpolate.number(t.right,n.right,a)),this}getCenter(t,n){const a=h.clamp((this.left+t-this.right)/2,0,t),c=h.clamp((this.top+n-this.bottom)/2,0,n);return new h.Point(a,c)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new Os(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class Us{constructor(t,n,a,c,p){this.tileSize=512,this.maxValidLatitude=85.051129,this.freezeElevation=!1,this._renderWorldCopies=p===void 0||!!p,this._minZoom=t||0,this._maxZoom=n||22,this._minPitch=a??0,this._maxPitch=c??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new h.LngLat(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new Os,this._posMatrixCache={},this._alignedPosMatrixCache={}}clone(){const t=new Us(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.apply(this),t}apply(t){this.tileSize=t.tileSize,this.latRange=t.latRange,this.width=t.width,this.height=t.height,this._center=t._center,this._elevation=t._elevation,this.zoom=t.zoom,this.angle=t.angle,this._fov=t._fov,this._pitch=t._pitch,this._unmodified=t._unmodified,this._edgeInsets=t._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(t){t===void 0?t=!0:t===null&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new h.Point(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(t){const n=-h.wrap(t,-180,180)*Math.PI/180;this.angle!==n&&(this._unmodified=!1,this.angle=n,this._calcMatrices(),this.rotationMatrix=function(){var a=new h.ARRAY_TYPE(4);return h.ARRAY_TYPE!=Float32Array&&(a[1]=0,a[2]=0),a[0]=1,a[3]=1,a}(),function(a,c,p){var m=c[0],y=c[1],_=c[2],v=c[3],S=Math.sin(p),T=Math.cos(p);a[0]=m*T+_*S,a[1]=y*T+v*S,a[2]=m*-S+_*T,a[3]=y*-S+v*T}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const n=h.clamp(t,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(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(t){const n=Math.min(Math.max(t,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(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(t){t!==this._elevation&&(this._elevation=t,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,n,a){this._unmodified=!1,this._edgeInsets.interpolate(t,n,a),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const n=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,n)}getVisibleUnwrappedCoordinates(t){const n=[new h.UnwrappedTileID(0,t)];if(this._renderWorldCopies){const a=this.pointCoordinate(new h.Point(0,0)),c=this.pointCoordinate(new h.Point(this.width,0)),p=this.pointCoordinate(new h.Point(this.width,this.height)),m=this.pointCoordinate(new h.Point(0,this.height)),y=Math.floor(Math.min(a.x,c.x,p.x,m.x)),_=Math.floor(Math.max(a.x,c.x,p.x,m.x)),v=1;for(let S=y-v;S<=_+v;S++)S!==0&&n.push(new h.UnwrappedTileID(S,t))}return n}coveringTiles(t){var n,a;let c=this.coveringZoomLevel(t);const p=c;if(t.minzoom!==void 0&&c<t.minzoom)return[];t.maxzoom!==void 0&&c>t.maxzoom&&(c=t.maxzoom);const m=this.pointCoordinate(this.getCameraPoint()),y=h.MercatorCoordinate.fromLngLat(this.center),_=Math.pow(2,c),v=[_*m.x,_*m.y,0],S=[_*y.x,_*y.y,0],T=Fs.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,c);let z=t.minzoom||0;!t.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(z=c);const U=t.terrain?2/Math.min(this.tileSize,t.tileSize)*this.tileSize:3,R=V=>({aabb:new pr([V*_,0,0],[(V+1)*_,_,0]),zoom:0,x:0,y:0,wrap:V,fullyVisible:!1}),F=[],j=[],X=c,ne=t.reparseOverscaled?p:c;if(this._renderWorldCopies)for(let V=1;V<=3;V++)F.push(R(-V)),F.push(R(V));for(F.push(R(0));F.length>0;){const V=F.pop(),ie=V.x,ae=V.y;let fe=V.fullyVisible;if(!fe){const $e=V.aabb.intersects(T);if($e===0)continue;fe=$e===2}const _e=t.terrain?v:S,xe=V.aabb.distanceX(_e),ge=V.aabb.distanceY(_e),ke=Math.max(Math.abs(xe),Math.abs(ge));if(V.zoom===X||ke>U+(1<<X-V.zoom)-2&&V.zoom>=z){const $e=X-V.zoom,Ye=v[0]-.5-(ie<<$e),we=v[1]-.5-(ae<<$e);j.push({tileID:new h.OverscaledTileID(V.zoom===X?ne:V.zoom,V.wrap,V.zoom,ie,ae),distanceSq:Ti([S[0]-.5-ie,S[1]-.5-ae]),tileDistanceToCamera:Math.sqrt(Ye*Ye+we*we)})}else for(let $e=0;$e<4;$e++){const Ye=(ie<<1)+$e%2,we=(ae<<1)+($e>>1),Xe=V.zoom+1;let ze=V.aabb.quadrant($e);if(t.terrain){const ht=new h.OverscaledTileID(Xe,V.wrap,Xe,Ye,we),Vt=t.terrain.getMinMaxElevation(ht),ut=(n=Vt.minElevation)!==null&&n!==void 0?n:this.elevation,et=(a=Vt.maxElevation)!==null&&a!==void 0?a:this.elevation;ze=new pr([ze.min[0],ze.min[1],ut],[ze.max[0],ze.max[1],et])}F.push({aabb:ze,zoom:Xe,x:Ye,y:we,wrap:V.wrap,fullyVisible:fe})}}return j.sort((V,ie)=>V.distanceSq-ie.distanceSq).map(V=>V.tileID)}resize(t,n){this.width=t,this.height=n,this.pixelsToGLUnits=[2/t,-2/n],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log(t)/Math.LN2}project(t){const n=h.clamp(t.lat,-this.maxValidLatitude,this.maxValidLatitude);return new h.Point(h.mercatorXfromLng(t.lng)*this.worldSize,h.mercatorYfromLat(n)*this.worldSize)}unproject(t){return new h.MercatorCoordinate(t.x/this.worldSize,t.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}updateElevation(t){this.freezeElevation||(this.elevation=t?this.getElevation(this._center,t):0)}getElevation(t,n){const a=h.MercatorCoordinate.fromLngLat(t.wrap()),c=(1<<this.tileZoom)*h.EXTENT,p=a.x*c,m=a.y*c,y=Math.floor(p/h.EXTENT),_=Math.floor(m/h.EXTENT),v=new h.OverscaledTileID(this.tileZoom,0,this.tileZoom,y,_);return n.getElevation(v,p%h.EXTENT,m%h.EXTENT,h.EXTENT)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(t){const n=this.pointLocation(this.centerPoint,t),a=this.getElevation(n,t);if(!(this.elevation-a))return;const c=this.getCameraPosition(),p=h.MercatorCoordinate.fromLngLat(c.lngLat,c.altitude),m=h.MercatorCoordinate.fromLngLat(n,a),y=p.x-m.x,_=p.y-m.y,v=p.z-m.z,S=Math.sqrt(y*y+_*_+v*v),T=this.scaleZoom(this.cameraToCenterDistance/S/this.tileSize);this._elevation=a,this._center=n,this.zoom=T}setLocationAtPoint(t,n){const a=this.pointCoordinate(n),c=this.pointCoordinate(this.centerPoint),p=this.locationCoordinate(t),m=new h.MercatorCoordinate(p.x-(a.x-c.x),p.y-(a.y-c.y));this.center=this.coordinateLocation(m),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(t,n){return n?this.coordinatePoint(this.locationCoordinate(t),this.getElevation(t,n),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(t))}pointLocation(t,n){return this.coordinateLocation(this.pointCoordinate(t,n))}locationCoordinate(t){return h.MercatorCoordinate.fromLngLat(t)}coordinateLocation(t){return t&&t.toLngLat()}pointCoordinate(t,n){if(n){const z=n.pointCoordinate(t);if(z!=null)return z}const a=[t.x,t.y,0,1],c=[t.x,t.y,1,1];h.transformMat4(a,a,this.pixelMatrixInverse),h.transformMat4(c,c,this.pixelMatrixInverse);const p=a[3],m=c[3],y=a[1]/p,_=c[1]/m,v=a[2]/p,S=c[2]/m,T=v===S?0:(0-v)/(S-v);return new h.MercatorCoordinate(h.interpolate.number(a[0]/p,c[0]/m,T)/this.worldSize,h.interpolate.number(y,_,T)/this.worldSize)}coordinatePoint(t,n=0,a=this.pixelMatrix){const c=[t.x*this.worldSize,t.y*this.worldSize,n,1];return h.transformMat4(c,c,a),new h.Point(c[0]/c[3],c[1]/c[3])}getBounds(){const t=Math.max(0,this.height/2-this.getHorizon());return new Gt().extend(this.pointLocation(new h.Point(0,t))).extend(this.pointLocation(new h.Point(this.width,t))).extend(this.pointLocation(new h.Point(this.width,this.height))).extend(this.pointLocation(new h.Point(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new Gt([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])}calculatePosMatrix(t,n=!1){const a=t.key,c=n?this._alignedPosMatrixCache:this._posMatrixCache;if(c[a])return c[a];const p=t.canonical,m=this.worldSize/this.zoomScale(p.z),y=p.x+Math.pow(2,p.z)*t.wrap,_=h.identity(new Float64Array(16));return h.translate(_,_,[y*m,p.y*m,0]),h.scale(_,_,[m/h.EXTENT,m/h.EXTENT,1]),h.multiply(_,n?this.alignedProjMatrix:this.projMatrix,_),c[a]=new Float32Array(_),c[a]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let t,n,a,c,p=-90,m=90,y=-180,_=180;const v=this.size,S=this._unmodified;if(this.latRange){const U=this.latRange;p=h.mercatorYfromLat(U[1])*this.worldSize,m=h.mercatorYfromLat(U[0])*this.worldSize,t=m-p<v.y?v.y/(m-p):0}if(this.lngRange){const U=this.lngRange;y=h.wrap(h.mercatorXfromLng(U[0])*this.worldSize,0,this.worldSize),_=h.wrap(h.mercatorXfromLng(U[1])*this.worldSize,0,this.worldSize),_<y&&(_+=this.worldSize),n=_-y<v.x?v.x/(_-y):0}const T=this.point,z=Math.max(n||0,t||0);if(z)return this.center=this.unproject(new h.Point(n?(_+y)/2:T.x,t?(m+p)/2:T.y)),this.zoom+=this.scaleZoom(z),this._unmodified=S,void(this._constraining=!1);if(this.latRange){const U=T.y,R=v.y/2;U-R<p&&(c=p+R),U+R>m&&(c=m-R)}if(this.lngRange){const U=(y+_)/2,R=h.wrap(T.x,U-this.worldSize/2,U+this.worldSize/2),F=v.x/2;R-F<y&&(a=y+F),R+F>_&&(a=_-F)}a===void 0&&c===void 0||(this.center=this.unproject(new h.Point(a!==void 0?a:T.x,c!==void 0?c:T.y)).wrap()),this._unmodified=S,this._constraining=!1}_calcMatrices(){if(!this.height)return;const t=this.centerOffset,n=this.point.x,a=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=h.mercatorZfromAltitude(1,this.center.lat)*this.worldSize;let c=h.identity(new Float64Array(16));h.scale(c,c,[this.width/2,-this.height/2,1]),h.translate(c,c,[1,-1,0]),this.labelPlaneMatrix=c,c=h.identity(new Float64Array(16)),h.scale(c,c,[1,-1,1]),h.translate(c,c,[-1,-1,0]),h.scale(c,c,[2/this.width,2/this.height,1]),this.glCoordMatrix=c,this.cameraToSeaLevelDistance=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch);const p=this._elevation<0?this.cameraToCenterDistance:this.cameraToSeaLevelDistance,m=Math.PI/2+this._pitch,y=this._fov*(.5+t.y/this.height),_=Math.sin(y)*p/Math.sin(h.clamp(Math.PI-m-y,.01,Math.PI-.01)),v=this.getHorizon(),S=2*Math.atan(v/this.cameraToCenterDistance)*(.5+t.y/(2*v)),T=Math.sin(S)*p/Math.sin(h.clamp(Math.PI-m-S,.01,Math.PI-.01)),z=Math.min(_,T),U=1.01*(Math.cos(Math.PI/2-this._pitch)*z+p),R=this.height/50;c=new Float64Array(16),h.perspective(c,this._fov,this.width/this.height,R,U),c[8]=2*-t.x/this.width,c[9]=2*t.y/this.height,h.scale(c,c,[1,-1,1]),h.translate(c,c,[0,0,-this.cameraToCenterDistance]),h.rotateX(c,c,this._pitch),h.rotateZ(c,c,this.angle),h.translate(c,c,[-n,-a,0]),this.mercatorMatrix=h.scale([],c,[this.worldSize,this.worldSize,this.worldSize]),h.scale(c,c,[1,1,this._pixelPerMeter]),this.pixelMatrix=h.multiply(new Float64Array(16),this.labelPlaneMatrix,c),h.translate(c,c,[0,0,-this.elevation]),this.projMatrix=c,this.invProjMatrix=h.invert([],c),this.pixelMatrix3D=h.multiply(new Float64Array(16),this.labelPlaneMatrix,c);const F=this.width%2/2,j=this.height%2/2,X=Math.cos(this.angle),ne=Math.sin(this.angle),V=n-Math.round(n)+X*F+ne*j,ie=a-Math.round(a)+X*j+ne*F,ae=new Float64Array(c);if(h.translate(ae,ae,[V>.5?V-1:V,ie>.5?ie-1:ie,0]),this.alignedProjMatrix=ae,c=h.invert(new Float64Array(16),this.pixelMatrix),!c)throw new Error("failed to invert matrix");this.pixelMatrixInverse=c,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const t=this.pointCoordinate(new h.Point(0,0)),n=[t.x*this.worldSize,t.y*this.worldSize,0,1];return h.transformMat4(n,n,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new h.Point(0,t))}getCameraQueryGeometry(t){const n=this.getCameraPoint();if(t.length===1)return[t[0],n];{let a=n.x,c=n.y,p=n.x,m=n.y;for(const y of t)a=Math.min(a,y.x),c=Math.min(c,y.y),p=Math.max(p,y.x),m=Math.max(m,y.y);return[new h.Point(a,c),new h.Point(p,c),new h.Point(p,m),new h.Point(a,m),new h.Point(a,c)]}}}class il{constructor(t){this._hashName=t&&encodeURIComponent(t),h.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=function(n,a){let c=!1,p=null;const m=()=>{p=null,c&&(n(),p=setTimeout(m,300),c=!1)};return()=>(c=!0,p||m(),p)}(this._updateHashUnthrottled.bind(this))}addTo(t){return this._map=t,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(t){const n=this._map.getCenter(),a=Math.round(100*this._map.getZoom())/100,c=Math.ceil((a*Math.LN2+Math.log(512/360/.5))/Math.LN10),p=Math.pow(10,c),m=Math.round(n.lng*p)/p,y=Math.round(n.lat*p)/p,_=this._map.getBearing(),v=this._map.getPitch();let S="";if(S+=t?`/${m}/${y}/${a}`:`${a}/${y}/${m}`,(_||v)&&(S+="/"+Math.round(10*_)/10),v&&(S+=`/${Math.round(v)}`),this._hashName){const T=this._hashName;let z=!1;const U=window.location.hash.slice(1).split("&").map(R=>{const F=R.split("=")[0];return F===T?(z=!0,`${F}=${S}`):R}).filter(R=>R);return z||U.push(`${T}=${S}`),`#${U.join("&")}`}return`#${S}`}_getCurrentHash(){const t=window.location.hash.replace("#","");if(this._hashName){let n;return t.split("&").map(a=>a.split("=")).forEach(a=>{a[0]===this._hashName&&(n=a)}),(n&&n[1]||"").split("/")}return t.split("/")}_onHashChange(){const t=this._getCurrentHash();if(t.length>=3&&!t.some(n=>isNaN(n))){const n=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:n,pitch:+(t[4]||0)}),!0}return!1}_updateHashUnthrottled(){const t=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,t)}catch{}}}const is={linearity:.3,easing:h.bezier(0,0,.3,1)},rl=h.extend({deceleration:2500,maxSpeed:1400},is),nl=h.extend({deceleration:20,maxSpeed:1400},is),rs=h.extend({deceleration:1e3,maxSpeed:360},is),sl=h.extend({deceleration:1e3,maxSpeed:90},is);class fr{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:h.exported.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,n=h.exported.now();for(;t.length>0&&n-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const n={zoom:0,bearing:0,pitch:0,pan:new h.Point(0,0),pinchAround:void 0,around:void 0};for(const{settings:p}of this._inertiaBuffer)n.zoom+=p.zoomDelta||0,n.bearing+=p.bearingDelta||0,n.pitch+=p.pitchDelta||0,p.panDelta&&n.pan._add(p.panDelta),p.around&&(n.around=p.around),p.pinchAround&&(n.pinchAround=p.pinchAround);const a=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,c={};if(n.pan.mag()){const p=ns(n.pan.mag(),a,h.extend({},rl,t||{}));c.offset=n.pan.mult(p.amount/n.pan.mag()),c.center=this._map.transform.center,Hi(c,p)}if(n.zoom){const p=ns(n.zoom,a,nl);c.zoom=this._map.transform.zoom+p.amount,Hi(c,p)}if(n.bearing){const p=ns(n.bearing,a,rs);c.bearing=this._map.transform.bearing+h.clamp(p.amount,-179,179),Hi(c,p)}if(n.pitch){const p=ns(n.pitch,a,sl);c.pitch=this._map.transform.pitch+p.amount,Hi(c,p)}if(c.zoom||c.bearing){const p=n.pinchAround===void 0?n.around:n.pinchAround;c.around=p?this._map.unproject(p):this._map.getCenter()}return this.clear(),h.extend(c,{noMoveStart:!0})}}function Hi(o,t){(!o.duration||o.duration<t.duration)&&(o.duration=t.duration,o.easing=t.easing)}function ns(o,t,n){const{maxSpeed:a,linearity:c,deceleration:p}=n,m=h.clamp(o*c/(t/1e3),-a,a),y=Math.abs(m)/(p*c);return{easing:n.easing,duration:1e3*y,amount:m*(y/2)}}class qt extends h.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,a,c={}){const p=Q.mousePos(n.getCanvasContainer(),a),m=n.unproject(p);super(t,h.extend({point:p,lngLat:m,originalEvent:a},c)),this._defaultPrevented=!1,this.target=n}}class jr extends h.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,a){const c=t==="touchend"?a.changedTouches:a.touches,p=Q.touchPos(n.getCanvasContainer(),c),m=p.map(_=>n.unproject(_)),y=p.reduce((_,v,S,T)=>_.add(v.div(T.length)),new h.Point(0,0));super(t,{points:p,point:y,lngLats:m,lngLat:n.unproject(y),originalEvent:a}),this._defaultPrevented=!1}}class uc extends h.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,a){super(t,{originalEvent:a}),this._defaultPrevented=!1}}class dc{constructor(t,n){this._map=t,this._clickTolerance=n.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new uc(t.type,this._map,t))}mousedown(t,n){return this._mousedownPos=n,this._firePreventable(new qt(t.type,this._map,t))}mouseup(t){this._map.fire(new qt(t.type,this._map,t))}click(t,n){this._mousedownPos&&this._mousedownPos.dist(n)>=this._clickTolerance||this._map.fire(new qt(t.type,this._map,t))}dblclick(t){return this._firePreventable(new qt(t.type,this._map,t))}mouseover(t){this._map.fire(new qt(t.type,this._map,t))}mouseout(t){this._map.fire(new qt(t.type,this._map,t))}touchstart(t){return this._firePreventable(new jr(t.type,this._map,t))}touchmove(t){this._map.fire(new jr(t.type,this._map,t))}touchend(t){this._map.fire(new jr(t.type,this._map,t))}touchcancel(t){this._map.fire(new jr(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class pc{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new qt(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new qt("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new qt(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Mn{constructor(t){this._map=t}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(t){return this.transform.pointLocation(h.Point.convert(t),this._map.terrain)}}class ss{constructor(t,n){this._map=t,this._tr=new Mn(t),this._el=t.getCanvasContainer(),this._container=t.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(t,n){this.isEnabled()&&t.shiftKey&&t.button===0&&(Q.disableDrag(),this._startPos=this._lastPos=n,this._active=!0)}mousemoveWindow(t,n){if(!this._active)return;const a=n;if(this._lastPos.equals(a)||!this._box&&a.dist(this._startPos)<this._clickTolerance)return;const c=this._startPos;this._lastPos=a,this._box||(this._box=Q.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",t));const p=Math.min(c.x,a.x),m=Math.max(c.x,a.x),y=Math.min(c.y,a.y),_=Math.max(c.y,a.y);Q.setTransform(this._box,`translate(${p}px,${y}px)`),this._box.style.width=m-p+"px",this._box.style.height=_-y+"px"}mouseupWindow(t,n){if(!this._active||t.button!==0)return;const a=this._startPos,c=n;if(this.reset(),Q.suppressClick(),a.x!==c.x||a.y!==c.y)return this._map.fire(new h.Event("boxzoomend",{originalEvent:t})),{cameraAnimation:p=>p.fitScreenCoordinates(a,c,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",t)}keydown(t){this._active&&t.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(Q.remove(this._box),this._box=null),Q.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,n){return this._map.fire(new h.Event(t,{originalEvent:n}))}}function mr(o,t){if(o.length!==t.length)throw new Error(`The number of touches and points are not equal - touches ${o.length}, points ${t.length}`);const n={};for(let a=0;a<o.length;a++)n[o[a].identifier]=t[a];return n}class De{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(t,n,a){(this.centroid||a.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=t.timeStamp),a.length===this.numTouches&&(this.centroid=function(c){const p=new h.Point(0,0);for(const m of c)p._add(m);return p.div(c.length)}(n),this.touches=mr(a,n)))}touchmove(t,n,a){if(this.aborted||!this.centroid)return;const c=mr(a,n);for(const p in this.touches){const m=c[p];(!m||m.dist(this.touches[p])>30)&&(this.aborted=!0)}}touchend(t,n,a){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),a.length===0){const c=!this.aborted&&this.centroid;if(this.reset(),c)return c}}}class Ns{constructor(t){this.singleTap=new De(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,n,a){this.singleTap.touchstart(t,n,a)}touchmove(t,n,a){this.singleTap.touchmove(t,n,a)}touchend(t,n,a){const c=this.singleTap.touchend(t,n,a);if(c){const p=t.timeStamp-this.lastTime<500,m=!this.lastTap||this.lastTap.dist(c)<30;if(p&&m||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=c,this.count===this.numTaps)return this.reset(),c}}}class as{constructor(t){this._tr=new Mn(t),this._zoomIn=new Ns({numTouches:1,numTaps:2}),this._zoomOut=new Ns({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,n,a){this._zoomIn.touchstart(t,n,a),this._zoomOut.touchstart(t,n,a)}touchmove(t,n,a){this._zoomIn.touchmove(t,n,a),this._zoomOut.touchmove(t,n,a)}touchend(t,n,a){const c=this._zoomIn.touchend(t,n,a),p=this._zoomOut.touchend(t,n,a),m=this._tr;return c?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:y=>y.easeTo({duration:300,zoom:m.zoom+1,around:m.unproject(c)},{originalEvent:t})}):p?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:y=>y.easeTo({duration:300,zoom:m.zoom-1,around:m.unproject(p)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ar{constructor(t){this._enabled=!!t.enable,this._moveStateManager=t.moveStateManager,this._clickTolerance=t.clickTolerance||1,this._moveFunction=t.move,this._activateOnStart=!!t.activateOnStart,t.assignEvents(this),this.reset()}reset(t){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(t)}_move(...t){const n=this._moveFunction(...t);if(n.bearingDelta||n.pitchDelta||n.around||n.panDelta)return this._active=!0,n}dragStart(t,n){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=n.length?n[0]:n,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,n){if(!this.isEnabled())return;const a=this._lastPoint;if(!a)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);const c=n.length?n[0]:n;return!this._moved&&c.dist(a)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=c,this._move(a,c))}dragEnd(t){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(t)&&(this._moved&&Q.suppressClick(),this.reset(t))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const al={0:1,2:2};class Ce{constructor(t){this._correctEvent=t.checkCorrectEvent}startMove(t){const n=Q.mouseButton(t);this._eventButton=n}endMove(t){delete this._eventButton}isValidStartEvent(t){return this._correctEvent(t)}isValidMoveEvent(t){return!function(n,a){const c=al[a];return n.buttons===void 0||(n.buttons&c)!==c}(t,this._eventButton)}isValidEndEvent(t){return Q.mouseButton(t)===this._eventButton}}class Vs{constructor(){this._firstTouch=void 0}_isOneFingerTouch(t){return t.targetTouches.length===1}_isSameTouchEvent(t){return t.targetTouches[0].identifier===this._firstTouch}startMove(t){this._firstTouch=t.targetTouches[0].identifier}endMove(t){delete this._firstTouch}isValidStartEvent(t){return this._isOneFingerTouch(t)}isValidMoveEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}isValidEndEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}}const qa=o=>{o.mousedown=o.dragStart,o.mousemoveWindow=o.dragMove,o.mouseup=o.dragEnd,o.contextmenu=function(t){t.preventDefault()}},ol=({enable:o,clickTolerance:t,bearingDegreesPerPixelMoved:n=.8})=>{const a=new Ce({checkCorrectEvent:c=>Q.mouseButton(c)===0&&c.ctrlKey||Q.mouseButton(c)===2});return new Ar({clickTolerance:t,move:(c,p)=>({bearingDelta:(p.x-c.x)*n}),moveStateManager:a,enable:o,assignEvents:qa})},$s=({enable:o,clickTolerance:t,pitchDegreesPerPixelMoved:n=-.5})=>{const a=new Ce({checkCorrectEvent:c=>Q.mouseButton(c)===0&&c.ctrlKey||Q.mouseButton(c)===2});return new Ar({clickTolerance:t,move:(c,p)=>({pitchDelta:(p.y-c.y)*n}),moveStateManager:a,enable:o,assignEvents:qa})};class ll{constructor(t,n){this._minTouches=t.cooperativeGestures?2:1,this._clickTolerance=t.clickTolerance||1,this._map=n,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new h.Point(0,0),setTimeout(()=>{this._cancelCooperativeMessage=!1},200)}touchstart(t,n,a){return this._calculateTransform(t,n,a)}touchmove(t,n,a){if(this._map._cooperativeGestures&&(this._minTouches===2&&a.length<2&&!this._cancelCooperativeMessage?this._map._onCooperativeGesture(t,!1,a.length):this._cancelCooperativeMessage||(this._cancelCooperativeMessage=!0)),this._active&&!(a.length<this._minTouches))return t.preventDefault(),this._calculateTransform(t,n,a)}touchend(t,n,a){this._calculateTransform(t,n,a),this._active&&a.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,n,a){a.length>0&&(this._active=!0);const c=mr(a,n),p=new h.Point(0,0),m=new h.Point(0,0);let y=0;for(const v in c){const S=c[v],T=this._touches[v];T&&(p._add(S),m._add(S.sub(T)),y++,c[v]=S)}if(this._touches=c,y<this._minTouches||!m.mag())return;const _=m.div(y);return this._sum._add(_),this._sum.mag()<this._clickTolerance?void 0:{around:p.div(y),panDelta:_}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class js{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}_start(t){}_move(t,n,a){return{}}touchstart(t,n,a){this._firstTwoTouches||a.length<2||(this._firstTwoTouches=[a[0].identifier,a[1].identifier],this._start([n[0],n[1]]))}touchmove(t,n,a){if(!this._firstTwoTouches)return;t.preventDefault();const[c,p]=this._firstTwoTouches,m=Gs(a,n,c),y=Gs(a,n,p);if(!m||!y)return;const _=this._aroundCenter?null:m.add(y).div(2);return this._move([m,y],_,t)}touchend(t,n,a){if(!this._firstTwoTouches)return;const[c,p]=this._firstTwoTouches,m=Gs(a,n,c),y=Gs(a,n,p);m&&y||(this._active&&Q.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(t){this._enabled=!0,this._aroundCenter=!!t&&t.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function Gs(o,t,n){for(let a=0;a<o.length;a++)if(o[a].identifier===n)return t[a]}function cl(o,t){return Math.log(o/t)/Math.LN2}class Za extends js{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,n){const a=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(cl(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:cl(this._distance,a),pinchAround:n}}}function qs(o,t){return 180*o.angleWith(t)/Math.PI}class Xa extends js{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(t){this._startVector=this._vector=t[0].sub(t[1]),this._minDiameter=t[0].dist(t[1])}_move(t,n){const a=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:qs(this._vector,a),pinchAround:n}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const n=25/(Math.PI*this._minDiameter)*360,a=qs(t,this._startVector);return Math.abs(a)<n}}function os(o){return Math.abs(o.y)>Math.abs(o.x)}class Mi extends js{constructor(t){super(),this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,n,a){super.touchstart(t,n,a),this._currentTouchCount=a.length}_start(t){this._lastPoints=t,os(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,n,a){if(this._map._cooperativeGestures&&this._currentTouchCount<3)return;const c=t[0].sub(this._lastPoints[0]),p=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(c,p,a.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(c.y+p.y)/2*-.5}):void 0}gestureBeginsVertically(t,n,a){if(this._valid!==void 0)return this._valid;const c=t.mag()>=2,p=n.mag()>=2;if(!c&&!p)return;if(!c||!p)return this._firstMove===void 0&&(this._firstMove=a),a-this._firstMove<100&&void 0;const m=t.y>0==n.y>0;return os(t)&&os(n)&&m}}const Gr={panStep:100,bearingStep:15,pitchStep:10};class hl{constructor(t){this._tr=new Mn(t);const n=Gr;this._panStep=n.panStep,this._bearingStep=n.bearingStep,this._pitchStep=n.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let n=0,a=0,c=0,p=0,m=0;switch(t.keyCode){case 61:case 107:case 171:case 187:n=1;break;case 189:case 109:case 173:n=-1;break;case 37:t.shiftKey?a=-1:(t.preventDefault(),p=-1);break;case 39:t.shiftKey?a=1:(t.preventDefault(),p=1);break;case 38:t.shiftKey?c=1:(t.preventDefault(),m=-1);break;case 40:t.shiftKey?c=-1:(t.preventDefault(),m=1);break;default:return}return this._rotationDisabled&&(a=0,c=0),{cameraAnimation:y=>{const _=this._tr;y.easeTo({duration:300,easeId:"keyboardHandler",easing:Wa,zoom:n?Math.round(_.zoom)+n*(t.shiftKey?2:1):_.zoom,bearing:_.bearing+a*this._bearingStep,pitch:_.pitch+c*this._pitchStep,offset:[-p*this._panStep,-m*this._panStep],center:_.center},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function Wa(o){return o*(2-o)}const Zs=4.000244140625;class Ha{constructor(t,n){this._map=t,this._tr=new Mn(t),this._el=t.getCanvasContainer(),this._handler=n,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,h.bindAll(["_onTimeout"],this)}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=t&&t.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(t){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!t[this._map._metaKey])return;t.preventDefault()}let n=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const a=h.exported.now(),c=a-(this._lastWheelEventTime||0);this._lastWheelEventTime=a,n!==0&&n%Zs==0?this._type="wheel":n!==0&&Math.abs(n)<4?this._type="trackpad":c>400?(this._type=null,this._lastValue=n,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(c*n)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,n+=this._lastValue)),t.shiftKey&&n&&(n/=4),this._type&&(this._lastWheelEvent=t,this._delta-=n,this._active||this._start(t)),t.preventDefault()}_onTimeout(t){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)}_start(t){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const n=Q.mousePos(this._el,t),a=this._tr;this._around=h.LngLat.convert(this._aroundCenter?a.center:a.unproject(n)),this._aroundPoint=a.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const t=this._tr.transform;if(this._delta!==0){const y=this._type==="wheel"&&Math.abs(this._delta)>Zs?this._wheelZoomRate:this._defaultZoomRate;let _=2/(1+Math.exp(-Math.abs(this._delta*y)));this._delta<0&&_!==0&&(_=1/_);const v=typeof this._targetZoom=="number"?t.zoomScale(this._targetZoom):t.scale;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(v*_))),this._type==="wheel"&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const n=typeof this._targetZoom=="number"?this._targetZoom:t.zoom,a=this._startZoom,c=this._easing;let p,m=!1;if(this._type==="wheel"&&a&&c){const y=Math.min((h.exported.now()-this._lastWheelEventTime)/200,1),_=c(y);p=h.interpolate.number(a,n,_),y<1?this._frameId||(this._frameId=!0):m=!0}else p=n,m=!0;return this._active=!0,m&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!m,zoomDelta:p-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let n=h.ease;if(this._prevEase){const a=this._prevEase,c=(h.exported.now()-a.start)/a.duration,p=a.easing(c+.01)-a.easing(c),m=.27/Math.sqrt(p*p+1e-4)*.01,y=Math.sqrt(.0729-m*m);n=h.bezier(m,y,.25,1)}return this._prevEase={start:h.exported.now(),duration:t,easing:n},n}reset(){this._active=!1}}class ul{constructor(t,n){this._clickZoom=t,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 Ki{constructor(t){this._tr=new Mn(t),this.reset()}reset(){this._active=!1}dblclick(t,n){return t.preventDefault(),{cameraAnimation:a=>{a.easeTo({duration:300,zoom:this._tr.zoom+(t.shiftKey?-1:1),around:this._tr.unproject(n)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ct{constructor(){this._tap=new Ns({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()}touchstart(t,n,a){this._swipePoint||(this._tapTime&&t.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?a.length>0&&(this._swipePoint=n[0],this._swipeTouch=a[0].identifier):this._tap.touchstart(t,n,a))}touchmove(t,n,a){if(this._tapTime){if(this._swipePoint){if(a[0].identifier!==this._swipeTouch)return;const c=n[0],p=c.y-this._swipePoint.y;return this._swipePoint=c,t.preventDefault(),this._active=!0,{zoomDelta:p/128}}}else this._tap.touchmove(t,n,a)}touchend(t,n,a){this._tapTime?this._swipePoint&&a.length===0&&this.reset():this._tap.touchend(t,n,a)&&(this._tapTime=t.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Xs{constructor(t,n,a){this._el=t,this._mousePan=n,this._touchPan=a}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class Ka{constructor(t,n,a){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=n,this._mousePitch=a}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 dl{constructor(t,n,a,c){this._el=t,this._touchZoom=n,this._touchRotate=a,this._tapDragZoom=c,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const ls=o=>o.zoom||o.drag||o.pitch||o.rotate;class pl extends h.Event{}function Ya(o){return o.panDelta&&o.panDelta.mag()||o.zoomDelta||o.bearingDelta||o.pitchDelta}class gr{constructor(t,n){this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new fr(t),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n),h.bindAll(["handleEvent","handleWindowEvent"],this);const a=this._el;this._listeners=[[a,"touchstart",{passive:!0}],[a,"touchmove",{passive:!1}],[a,"touchend",void 0],[a,"touchcancel",void 0],[a,"mousedown",void 0],[a,"mousemove",void 0],[a,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[a,"mouseover",void 0],[a,"mouseout",void 0],[a,"dblclick",void 0],[a,"click",void 0],[a,"keydown",{capture:!1}],[a,"keyup",void 0],[a,"wheel",{passive:!1}],[a,"contextmenu",void 0],[window,"blur",void 0]];for(const[c,p,m]of this._listeners)Q.addEventListener(c,p,c===document?this.handleWindowEvent:this.handleEvent,m)}destroy(){for(const[t,n,a]of this._listeners)Q.removeEventListener(t,n,t===document?this.handleWindowEvent:this.handleEvent,a)}_addDefaultHandlers(t){const n=this._map,a=n.getCanvasContainer();this._add("mapEvent",new dc(n,t));const c=n.boxZoom=new ss(n,t);this._add("boxZoom",c);const p=new as(n),m=new Ki(n);n.doubleClickZoom=new ul(m,p),this._add("tapZoom",p),this._add("clickZoom",m);const y=new Ct;this._add("tapDragZoom",y);const _=n.touchPitch=new Mi(n);this._add("touchPitch",_);const v=ol(t),S=$s(t);n.dragRotate=new Ka(t,v,S),this._add("mouseRotate",v,["mousePitch"]),this._add("mousePitch",S,["mouseRotate"]);const T=(({enable:X,clickTolerance:ne})=>{const V=new Ce({checkCorrectEvent:ie=>Q.mouseButton(ie)===0&&!ie.ctrlKey});return new Ar({clickTolerance:ne,move:(ie,ae)=>({around:ae,panDelta:ae.sub(ie)}),activateOnStart:!0,moveStateManager:V,enable:X,assignEvents:qa})})(t),z=new ll(t,n);n.dragPan=new Xs(a,T,z),this._add("mousePan",T),this._add("touchPan",z,["touchZoom","touchRotate"]);const U=new Xa,R=new Za;n.touchZoomRotate=new dl(a,R,U,y),this._add("touchRotate",U,["touchPan","touchZoom"]),this._add("touchZoom",R,["touchPan","touchRotate"]);const F=n.scrollZoom=new Ha(n,this);this._add("scrollZoom",F,["mousePan"]);const j=n.keyboard=new hl(n);this._add("keyboard",j),this._add("blockableMapEvent",new pc(n));for(const X of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])t.interactive&&t[X]&&n[X].enable(t[X])}_add(t,n,a){this._handlers.push({handlerName:t,handler:n,allowed:a}),this._handlersById[t]=n}stop(t){if(!this._updatingCamera){for(const{handler:n}of this._handlers)n.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(const{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!ls(this._eventsInProgress)||this.isZooming()}_blockedByActive(t,n,a){for(const c in t)if(c!==a&&(!n||n.indexOf(c)<0))return!0;return!1}handleWindowEvent(t){this.handleEvent(t,`${t.type}Window`)}_getMapTouches(t){const n=[];for(const a of t)this._el.contains(a.target)&&n.push(a);return n}handleEvent(t,n){if(t.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const a=t.type==="renderFrame"?void 0:t,c={needsRenderFrame:!1},p={},m={},y=t.touches,_=y?this._getMapTouches(y):void 0,v=_?Q.touchPos(this._el,_):Q.mousePos(this._el,t);for(const{handlerName:z,handler:U,allowed:R}of this._handlers){if(!U.isEnabled())continue;let F;this._blockedByActive(m,R,z)?U.reset():U[n||t.type]&&(F=U[n||t.type](t,v,_),this.mergeHandlerResult(c,p,F,z,a),F&&F.needsRenderFrame&&this._triggerRenderFrame()),(F||U.isActive())&&(m[z]=U)}const S={};for(const z in this._previousActiveHandlers)m[z]||(S[z]=a);this._previousActiveHandlers=m,(Object.keys(S).length||Ya(c))&&(this._changes.push([c,p,S]),this._triggerRenderFrame()),(Object.keys(m).length||Ya(c))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:T}=c;T&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],T(this._map))}mergeHandlerResult(t,n,a,c,p){if(!a)return;h.extend(t,a);const m={handlerName:c,originalEvent:a.originalEvent||p};a.zoomDelta!==void 0&&(n.zoom=m),a.panDelta!==void 0&&(n.drag=m),a.pitchDelta!==void 0&&(n.pitch=m),a.bearingDelta!==void 0&&(n.rotate=m)}_applyChanges(){const t={},n={},a={};for(const[c,p,m]of this._changes)c.panDelta&&(t.panDelta=(t.panDelta||new h.Point(0,0))._add(c.panDelta)),c.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+c.zoomDelta),c.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+c.bearingDelta),c.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+c.pitchDelta),c.around!==void 0&&(t.around=c.around),c.pinchAround!==void 0&&(t.pinchAround=c.pinchAround),c.noInertia&&(t.noInertia=c.noInertia),h.extend(n,p),h.extend(a,m);this._updateMapTransform(t,n,a),this._changes=[]}_updateMapTransform(t,n,a){const c=this._map,p=c._getTransformForUpdate(),m=c.terrain;if(!(Ya(t)||m&&this._terrainMovement))return this._fireEvents(n,a,!0);let{panDelta:y,zoomDelta:_,bearingDelta:v,pitchDelta:S,around:T,pinchAround:z}=t;z!==void 0&&(T=z),c._stop(!0),T=T||c.transform.centerPoint;const U=p.pointLocation(y?T.sub(y):T);v&&(p.bearing+=v),S&&(p.pitch+=S),_&&(p.zoom+=_),m?this._terrainMovement||!n.drag&&!n.zoom?n.drag&&this._terrainMovement?p.center=p.pointLocation(p.centerPoint.sub(y)):p.setLocationAtPoint(U,T):(this._terrainMovement=!0,p.freezeElevation=!0,p.setLocationAtPoint(U,T),this._map.once("moveend",()=>{p.freezeElevation=!1,this._terrainMovement=!1,p.recalculateZoom(c.terrain)})):p.setLocationAtPoint(U,T),c._applyUpdatedTransform(p),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(n,a,!0)}_fireEvents(t,n,a){const c=ls(this._eventsInProgress),p=ls(t),m={};for(const S in t){const{originalEvent:T}=t[S];this._eventsInProgress[S]||(m[`${S}start`]=T),this._eventsInProgress[S]=t[S]}!c&&p&&this._fireEvent("movestart",p.originalEvent);for(const S in m)this._fireEvent(S,m[S]);p&&this._fireEvent("move",p.originalEvent);for(const S in t){const{originalEvent:T}=t[S];this._fireEvent(S,T)}const y={};let _;for(const S in this._eventsInProgress){const{handlerName:T,originalEvent:z}=this._eventsInProgress[S];this._handlersById[T].isActive()||(delete this._eventsInProgress[S],_=n[T]||z,y[`${S}end`]=_)}for(const S in y)this._fireEvent(S,y[S]);const v=ls(this._eventsInProgress);if(a&&(c||p)&&!v){this._updatingCamera=!0;const S=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),T=z=>z!==0&&-this._bearingSnap<z&&z<this._bearingSnap;S?(T(S.bearing||this._map.getBearing())&&(S.bearing=0),S.freezeElevation=!0,this._map.easeTo(S,{originalEvent:_})):(this._map.fire(new h.Event("moveend",{originalEvent:_})),T(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(t,n){this._map.fire(new h.Event(t,n?{originalEvent:n}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(t=>{delete this._frameId,this.handleEvent(new pl("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const Ws={extend:(o,...t)=>h.extend(o,...t),run(o){o()},logToElement(o,t=!1,n="log"){const a=window.document.getElementById(n);a&&(t&&(a.innerHTML=""),a.innerHTML+=`<br>${o}`)}};class Ue extends h.Evented{constructor(t,n){super(),this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=n.bearingSnap,h.bindAll(["_renderFrameCallback"],this),this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new h.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(t,n){return this.jumpTo({center:t},n)}panBy(t,n,a){return t=h.Point.convert(t).mult(-1),this.panTo(this.transform.center,h.extend({offset:t},n),a)}panTo(t,n,a){return this.easeTo(h.extend({center:t},n),a)}getZoom(){return this.transform.zoom}setZoom(t,n){return this.jumpTo({zoom:t},n),this}zoomTo(t,n,a){return this.easeTo(h.extend({zoom:t},n),a)}zoomIn(t,n){return this.zoomTo(this.getZoom()+1,t,n),this}zoomOut(t,n){return this.zoomTo(this.getZoom()-1,t,n),this}getBearing(){return this.transform.bearing}setBearing(t,n){return this.jumpTo({bearing:t},n),this}getPadding(){return this.transform.padding}setPadding(t,n){return this.jumpTo({padding:t},n),this}rotateTo(t,n,a){return this.easeTo(h.extend({bearing:t},n),a)}resetNorth(t,n){return this.rotateTo(0,h.extend({duration:1e3},t),n),this}resetNorthPitch(t,n){return this.easeTo(h.extend({bearing:0,pitch:0,duration:1e3},t),n),this}snapToNorth(t,n){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,n):this}getPitch(){return this.transform.pitch}setPitch(t,n){return this.jumpTo({pitch:t},n),this}cameraForBounds(t,n){t=Gt.convert(t);const a=n&&n.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),a,n)}_cameraForBoxAndBearing(t,n,a,c){const p={top:0,bottom:0,right:0,left:0};if(typeof(c=h.extend({padding:p,offset:[0,0],maxZoom:this.transform.maxZoom},c)).padding=="number"){const ae=c.padding;c.padding={top:ae,bottom:ae,right:ae,left:ae}}c.padding=h.extend(p,c.padding);const m=this.transform,y=m.padding,_=m.project(h.LngLat.convert(t)),v=m.project(h.LngLat.convert(n)),S=_.rotate(-a*Math.PI/180),T=v.rotate(-a*Math.PI/180),z=new h.Point(Math.max(S.x,T.x),Math.max(S.y,T.y)),U=new h.Point(Math.min(S.x,T.x),Math.min(S.y,T.y)),R=z.sub(U),F=(m.width-(y.left+y.right+c.padding.left+c.padding.right))/R.x,j=(m.height-(y.top+y.bottom+c.padding.top+c.padding.bottom))/R.y;if(j<0||F<0)return void h.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const X=Math.min(m.scaleZoom(m.scale*Math.min(F,j)),c.maxZoom),ne=h.Point.convert(c.offset),V=new h.Point((c.padding.left-c.padding.right)/2,(c.padding.top-c.padding.bottom)/2).rotate(a*Math.PI/180),ie=ne.add(V).mult(m.scale/m.zoomScale(X));return{center:m.unproject(_.add(v).div(2).sub(ie)),zoom:X,bearing:a}}fitBounds(t,n,a){return this._fitInternal(this.cameraForBounds(t,n),n,a)}fitScreenCoordinates(t,n,a,c,p){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(h.Point.convert(t)),this.transform.pointLocation(h.Point.convert(n)),a,c),c,p)}_fitInternal(t,n,a){return t?(delete(n=h.extend(t,n)).padding,n.linear?this.easeTo(n,a):this.flyTo(n,a)):this}jumpTo(t,n){this.stop();const a=this._getTransformForUpdate();let c=!1,p=!1,m=!1;return"zoom"in t&&a.zoom!==+t.zoom&&(c=!0,a.zoom=+t.zoom),t.center!==void 0&&(a.center=h.LngLat.convert(t.center)),"bearing"in t&&a.bearing!==+t.bearing&&(p=!0,a.bearing=+t.bearing),"pitch"in t&&a.pitch!==+t.pitch&&(m=!0,a.pitch=+t.pitch),t.padding==null||a.isPaddingEqual(t.padding)||(a.padding=t.padding),this._applyUpdatedTransform(a),this.fire(new h.Event("movestart",n)).fire(new h.Event("move",n)),c&&this.fire(new h.Event("zoomstart",n)).fire(new h.Event("zoom",n)).fire(new h.Event("zoomend",n)),p&&this.fire(new h.Event("rotatestart",n)).fire(new h.Event("rotate",n)).fire(new h.Event("rotateend",n)),m&&this.fire(new h.Event("pitchstart",n)).fire(new h.Event("pitch",n)).fire(new h.Event("pitchend",n)),this.fire(new h.Event("moveend",n))}calculateCameraOptionsFromTo(t,n,a,c=0){const p=h.MercatorCoordinate.fromLngLat(t,n),m=h.MercatorCoordinate.fromLngLat(a,c),y=m.x-p.x,_=m.y-p.y,v=m.z-p.z,S=Math.hypot(y,_,v);if(S===0)throw new Error("Can't calculate camera options with same From and To");const T=Math.hypot(y,_),z=this.transform.scaleZoom(this.transform.cameraToCenterDistance/S/this.transform.tileSize),U=180*Math.atan2(y,-_)/Math.PI;let R=180*Math.acos(T/S)/Math.PI;return R=v<0?90-R:90+R,{center:m.toLngLat(),zoom:z,pitch:R,bearing:U}}easeTo(t,n){this._stop(!1,t.easeId),((t=h.extend({offset:[0,0],duration:500,easing:h.ease},t)).animate===!1||!t.essential&&h.exported.prefersReducedMotion)&&(t.duration=0);const a=this._getTransformForUpdate(),c=this.getZoom(),p=this.getBearing(),m=this.getPitch(),y=this.getPadding(),_="zoom"in t?+t.zoom:c,v="bearing"in t?this._normalizeBearing(t.bearing,p):p,S="pitch"in t?+t.pitch:m,T="padding"in t?t.padding:a.padding,z=h.Point.convert(t.offset);let U=a.centerPoint.add(z);const R=a.pointLocation(U),F=h.LngLat.convert(t.center||R);this._normalizeCenter(F);const j=a.project(R),X=a.project(F).sub(j),ne=a.zoomScale(_-c);let V,ie;t.around&&(V=h.LngLat.convert(t.around),ie=a.locationPoint(V));const ae={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||_!==c,this._rotating=this._rotating||p!==v,this._pitching=this._pitching||S!==m,this._padding=!a.isPaddingEqual(T),this._easeId=t.easeId,this._prepareEase(n,t.noMoveStart,ae),this.terrain&&this._prepareElevation(F),this._ease(fe=>{if(this._zooming&&(a.zoom=h.interpolate.number(c,_,fe)),this._rotating&&(a.bearing=h.interpolate.number(p,v,fe)),this._pitching&&(a.pitch=h.interpolate.number(m,S,fe)),this._padding&&(a.interpolatePadding(y,T,fe),U=a.centerPoint.add(z)),this.terrain&&!t.freezeElevation&&this._updateElevation(fe),V)a.setLocationAtPoint(V,ie);else{const _e=a.zoomScale(a.zoom-c),xe=_>c?Math.min(2,ne):Math.max(.5,ne),ge=Math.pow(xe,1-fe),ke=a.unproject(j.add(X.mult(fe*ge)).mult(_e));a.setLocationAtPoint(a.renderWorldCopies?ke.wrap():ke,U)}this._applyUpdatedTransform(a),this._fireMoveEvents(n)},fe=>{this.terrain&&this._finalizeElevation(),this._afterEase(n,fe)},t),this}_prepareEase(t,n,a={}){this._moving=!0,n||a.moving||this.fire(new h.Event("movestart",t)),this._zooming&&!a.zooming&&this.fire(new h.Event("zoomstart",t)),this._rotating&&!a.rotating&&this.fire(new h.Event("rotatestart",t)),this._pitching&&!a.pitching&&this.fire(new h.Event("pitchstart",t))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.transform.getElevation(t,this.terrain),this.transform.freezeElevation=!0}_updateElevation(t){const n=this.transform.getElevation(this._elevationCenter,this.terrain);if(t<1&&n!==this._elevationTarget){const a=this._elevationTarget-this._elevationStart;this._elevationStart+=t*(a-(n-(a*t+this._elevationStart))/(1-t)),this._elevationTarget=n}this.transform.elevation=h.interpolate.number(this._elevationStart,this._elevationTarget,t)}_finalizeElevation(){this.transform.freezeElevation=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_applyUpdatedTransform(t){if(!this.transformCameraUpdate)return;const n=t.clone(),{center:a,zoom:c,pitch:p,bearing:m,elevation:y}=this.transformCameraUpdate(n);a&&(n.center=a),c!==void 0&&(n.zoom=c),p!==void 0&&(n.pitch=p),m!==void 0&&(n.bearing=m),y!==void 0&&(n.elevation=y),this.transform.apply(n)}_fireMoveEvents(t){this.fire(new h.Event("move",t)),this._zooming&&this.fire(new h.Event("zoom",t)),this._rotating&&this.fire(new h.Event("rotate",t)),this._pitching&&this.fire(new h.Event("pitch",t))}_afterEase(t,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId;const a=this._zooming,c=this._rotating,p=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,a&&this.fire(new h.Event("zoomend",t)),c&&this.fire(new h.Event("rotateend",t)),p&&this.fire(new h.Event("pitchend",t)),this.fire(new h.Event("moveend",t))}flyTo(t,n){if(!t.essential&&h.exported.prefersReducedMotion){const ze=h.pick(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(ze,n)}this.stop(),t=h.extend({offset:[0,0],speed:1.2,curve:1.42,easing:h.ease},t);const a=this._getTransformForUpdate(),c=this.getZoom(),p=this.getBearing(),m=this.getPitch(),y=this.getPadding(),_="zoom"in t?h.clamp(+t.zoom,a.minZoom,a.maxZoom):c,v="bearing"in t?this._normalizeBearing(t.bearing,p):p,S="pitch"in t?+t.pitch:m,T="padding"in t?t.padding:a.padding,z=a.zoomScale(_-c),U=h.Point.convert(t.offset);let R=a.centerPoint.add(U);const F=a.pointLocation(R),j=h.LngLat.convert(t.center||F);this._normalizeCenter(j);const X=a.project(F),ne=a.project(j).sub(X);let V=t.curve;const ie=Math.max(a.width,a.height),ae=ie/z,fe=ne.mag();if("minZoom"in t){const ze=h.clamp(Math.min(t.minZoom,c,_),a.minZoom,a.maxZoom),ht=ie/a.zoomScale(ze-c);V=Math.sqrt(ht/fe*2)}const _e=V*V;function xe(ze){const ht=(ae*ae-ie*ie+(ze?-1:1)*_e*_e*fe*fe)/(2*(ze?ae:ie)*_e*fe);return Math.log(Math.sqrt(ht*ht+1)-ht)}function ge(ze){return(Math.exp(ze)-Math.exp(-ze))/2}function ke(ze){return(Math.exp(ze)+Math.exp(-ze))/2}const $e=xe(0);let Ye=function(ze){return ke($e)/ke($e+V*ze)},we=function(ze){return ie*((ke($e)*(ge(ht=$e+V*ze)/ke(ht))-ge($e))/_e)/fe;var ht},Xe=(xe(1)-$e)/V;if(Math.abs(fe)<1e-6||!isFinite(Xe)){if(Math.abs(ie-ae)<1e-6)return this.easeTo(t,n);const ze=ae<ie?-1:1;Xe=Math.abs(Math.log(ae/ie))/V,we=function(){return 0},Ye=function(ht){return Math.exp(ze*V*ht)}}return t.duration="duration"in t?+t.duration:1e3*Xe/("screenSpeed"in t?+t.screenSpeed/V:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=p!==v,this._pitching=S!==m,this._padding=!a.isPaddingEqual(T),this._prepareEase(n,!1),this.terrain&&this._prepareElevation(j),this._ease(ze=>{const ht=ze*Xe,Vt=1/Ye(ht);a.zoom=ze===1?_:c+a.scaleZoom(Vt),this._rotating&&(a.bearing=h.interpolate.number(p,v,ze)),this._pitching&&(a.pitch=h.interpolate.number(m,S,ze)),this._padding&&(a.interpolatePadding(y,T,ze),R=a.centerPoint.add(U)),this.terrain&&!t.freezeElevation&&this._updateElevation(ze);const ut=ze===1?j:a.unproject(X.add(ne.mult(we(ht))).mult(Vt));a.setLocationAtPoint(a.renderWorldCopies?ut.wrap():ut,R),this._applyUpdatedTransform(a),this._fireMoveEvents(n)},()=>{this.terrain&&this._finalizeElevation(),this._afterEase(n)},t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,n){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const a=this._onEaseEnd;delete this._onEaseEnd,a.call(this,n)}if(!t){const a=this.handlers;a&&a.stop(!1)}return this}_ease(t,n,a){a.animate===!1||a.duration===0?(t(1),n()):(this._easeStart=h.exported.now(),this._easeOptions=a,this._onEaseFrame=t,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const t=Math.min((h.exported.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(t)),t<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(t,n){t=h.wrap(t,-180,180);const a=Math.abs(t-n);return Math.abs(t-360-n)<a&&(t-=360),Math.abs(t+360-n)<a&&(t+=360),t}_normalizeCenter(t){const n=this.transform;if(!n.renderWorldCopies||n.lngRange)return;const a=t.lng-n.center.lng;t.lng+=a>180?-360:a<-180?360:0}queryTerrainElevation(t){return this.terrain?this.transform.getElevation(h.LngLat.convert(t),this.terrain)-this.transform.elevation:null}}class Ze{constructor(t={}){this.options=t,h.bindAll(["_toggleAttribution","_updateData","_updateCompact","_updateCompactMinimize"],this)}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options&&this.options.compact,this._container=Q.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=Q.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=Q.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(){Q.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(t,n){const a=this._map._getUIString(`AttributionControl.${n}`);t.title=a,t.setAttribute("aria-label",a)}_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")))}_updateData(t){!t||t.sourceDataType!=="metadata"&&t.sourceDataType!=="visibility"&&t.dataType!=="style"&&t.type!=="terrain"||this._updateAttributions()}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map(c=>typeof c!="string"?"":c)):typeof this.options.customAttribution=="string"&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const c=this._map.style.stylesheet;this.styleOwner=c.owner,this.styleId=c.id}const n=this._map.style.sourceCaches;for(const c in n){const p=n[c];if(p.used||p.usedForTerrain){const m=p.getSource();m.attribution&&t.indexOf(m.attribution)<0&&t.push(m.attribution)}}t=t.filter(c=>String(c).trim()),t.sort((c,p)=>c.length-p.length),t=t.filter((c,p)=>{for(let m=p+1;m<t.length;m++)if(t[m].indexOf(c)>=0)return!1;return!0});const a=t.join(" | ");a!==this._attribHTML&&(this._attribHTML=a,t.length?(this._innerContainer.innerHTML=a,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}_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"))}_updateCompactMinimize(){this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")}}class cs{constructor(t={}){this.options=t,h.bindAll(["_updateCompact"],this)}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=Q.create("div","maplibregl-ctrl");const n=Q.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(){Q.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}_updateCompact(){const t=this._container.children;if(t.length){const n=t[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&n.classList.add("maplibregl-compact"):n.classList.remove("maplibregl-compact")}}}class Ja{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const n=++this._id;return this._queue.push({callback:t,id:n,cancelled:!1}),n}remove(t){const n=this._currentlyRunning,a=n?this._queue.concat(n):this._queue;for(const c of a)if(c.id===t)return void(c.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const n=this._currentlyRunning=this._queue;this._queue=[];for(const a of n)if(!a.cancelled&&(a.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}const Qa={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","TerrainControl.enableTerrain":"Enable terrain","TerrainControl.disableTerrain":"Disable terrain"};var ki=h.createLayout([{name:"a_pos3d",type:"Int16",components:3}]);class Hs extends h.Evented{constructor(t){super(),this.sourceCache=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,t.usedForTerrain=!0,t.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(t,n){this.sourceCache.update(t,n),this._renderableTilesKeys=[];const a={};for(const c of t.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:n}))a[c.key]=!0,this._renderableTilesKeys.push(c.key),this._tiles[c.key]||(c.posMatrix=new Float64Array(16),h.ortho(c.posMatrix,0,h.EXTENT,0,h.EXTENT,0,1),this._tiles[c.key]=new $n(c,this.tileSize));for(const c in this._tiles)a[c]||delete this._tiles[c]}freeRtt(t){for(const n in this._tiles){const a=this._tiles[n];(!t||a.tileID.equals(t)||a.tileID.isChildOf(t)||t.isChildOf(a.tileID))&&(a.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(t=>this.getTileByID(t))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t){const n={};for(const a of this._renderableTilesKeys){const c=this._tiles[a].tileID;if(c.canonical.equals(t.canonical)){const p=t.clone();p.posMatrix=new Float64Array(16),h.ortho(p.posMatrix,0,h.EXTENT,0,h.EXTENT,0,1),n[a]=p}else if(c.canonical.isChildOf(t.canonical)){const p=t.clone();p.posMatrix=new Float64Array(16);const m=c.canonical.z-t.canonical.z,y=c.canonical.x-(c.canonical.x>>m<<m),_=c.canonical.y-(c.canonical.y>>m<<m),v=h.EXTENT>>m;h.ortho(p.posMatrix,0,v,0,v,0,1),h.translate(p.posMatrix,p.posMatrix,[-y*v,-_*v,0]),n[a]=p}else if(t.canonical.isChildOf(c.canonical)){const p=t.clone();p.posMatrix=new Float64Array(16);const m=t.canonical.z-c.canonical.z,y=t.canonical.x-(t.canonical.x>>m<<m),_=t.canonical.y-(t.canonical.y>>m<<m),v=h.EXTENT>>m;h.ortho(p.posMatrix,0,h.EXTENT,0,h.EXTENT,0,1),h.translate(p.posMatrix,p.posMatrix,[y*v,_*v,0]),h.scale(p.posMatrix,p.posMatrix,[1/2**m,1/2**m,0]),n[a]=p}}return n}getSourceTile(t,n){const a=this.sourceCache._source;let c=t.overscaledZ-this.deltaZoom;if(c>a.maxzoom&&(c=a.maxzoom),c<a.minzoom)return null;this._sourceTileCache[t.key]||(this._sourceTileCache[t.key]=t.scaledTo(c).key);let p=this.sourceCache.getTileByID(this._sourceTileCache[t.key]);if((!p||!p.dem)&&n)for(;c>=a.minzoom&&(!p||!p.dem);)p=this.sourceCache.getTileByID(t.scaledTo(c--).key);return p}tilesAfterTime(t=Date.now()){return Object.values(this._tiles).filter(n=>n.timeAdded>=t)}}class _r{constructor(t,n,a){this.painter=t,this.sourceCache=new Hs(n),this.options=a,this.exaggeration=typeof a.exaggeration=="number"?a.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(t,n,a,c=h.EXTENT){if(!(n>=0&&n<c&&a>=0&&a<c))return 0;let p=0;const m=this.getTerrainData(t);if(m.tile&&m.tile.dem){const y=function(R,F,j){var X=F[0],ne=F[1];return R[0]=j[0]*X+j[4]*ne+j[12],R[1]=j[1]*X+j[5]*ne+j[13],R}([],[n/c*h.EXTENT,a/c*h.EXTENT],m.u_terrain_matrix),_=[y[0]*m.tile.dem.dim,y[1]*m.tile.dem.dim],v=[Math.floor(_[0]),Math.floor(_[1])],S=m.tile.dem.get(v[0],v[1]),T=m.tile.dem.get(v[0],v[1]+1),z=m.tile.dem.get(v[0]+1,v[1]),U=m.tile.dem.get(v[0]+1,v[1]+1);p=h.interpolate.number(h.interpolate.number(S,T,_[0]-v[0]),h.interpolate.number(z,U,_[0]-v[0]),_[1]-v[1])}return p}getElevation(t,n,a,c=h.EXTENT){return this.getDEMElevation(t,n,a,c)*this.exaggeration}getTerrainData(t){if(!this._emptyDemTexture){const c=this.painter.context,p=new h.RGBAImage({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new xt(c,p,c.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new xt(c,new h.RGBAImage({width:1,height:1}),c.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(c.gl.NEAREST,c.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=h.identity([])}const n=this.sourceCache.getSourceTile(t,!0);if(n&&n.dem&&(!n.demTexture||n.needsTerrainPrepare)){const c=this.painter.context;n.demTexture=this.painter.getTileTexture(n.dem.stride),n.demTexture?n.demTexture.update(n.dem.getPixels(),{premultiply:!1}):n.demTexture=new xt(c,n.dem.getPixels(),c.gl.RGBA,{premultiply:!1}),n.demTexture.bind(c.gl.NEAREST,c.gl.CLAMP_TO_EDGE),n.needsTerrainPrepare=!1}const a=n&&n+n.tileID.key+t.key;if(a&&!this._demMatrixCache[a]){const c=this.sourceCache.sourceCache._source.maxzoom;let p=t.canonical.z-n.tileID.canonical.z;t.overscaledZ>t.canonical.z&&(t.canonical.z>=c?p=t.canonical.z-c:h.warnOnce("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const m=t.canonical.x-(t.canonical.x>>p<<p),y=t.canonical.y-(t.canonical.y>>p<<p),_=h.fromScaling(new Float64Array(16),[1/(h.EXTENT<<p),1/(h.EXTENT<<p),0]);h.translate(_,_,[m*h.EXTENT,y*h.EXTENT,0]),this._demMatrixCache[t.key]={matrix:_,coord:t}}return{u_depth:2,u_terrain:3,u_terrain_dim:n&&n.dem&&n.dem.dim||1,u_terrain_matrix:a?this._demMatrixCache[t.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(t){const n=this.painter,a=n.width/devicePixelRatio,c=n.height/devicePixelRatio;return!this._fbo||this._fbo.width===a&&this._fbo.height===c||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new xt(n.context,{width:a,height:c,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 xt(n.context,{width:a,height:c,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(a,c,!0,!1),this._fbo.depthAttachment.set(n.context.createRenderbuffer(n.context.gl.DEPTH_COMPONENT16,a,c))),this._fbo.colorAttachment.set(t==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const t=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const n=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let p=0,m=0;p<this._coordsTextureSize;p++)for(let y=0;y<this._coordsTextureSize;y++,m+=4)n[m+0]=255&y,n[m+1]=255&p,n[m+2]=y>>8<<4|p>>8,n[m+3]=0;const a=new h.RGBAImage({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(n.buffer)),c=new xt(t,a,t.gl.RGBA,{premultiply:!1});return c.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=c,c}pointCoordinate(t){const n=new Uint8Array(4),a=this.painter.context,c=a.gl;a.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),c.readPixels(t.x,this.painter.height/devicePixelRatio-t.y-1,1,1,c.RGBA,c.UNSIGNED_BYTE,n),a.bindFramebuffer.set(null);const p=n[0]+(n[2]>>4<<8),m=n[1]+((15&n[2])<<8),y=this.coordsIndex[255-n[3]],_=y&&this.sourceCache.getTileByID(y);if(!_)return null;const v=this._coordsTextureSize,S=(1<<_.tileID.canonical.z)*v;return new h.MercatorCoordinate((_.tileID.canonical.x*v+p)/S,(_.tileID.canonical.y*v+m)/S,this.getElevation(_.tileID,p,m,v))}getTerrainMesh(){if(this._mesh)return this._mesh;const t=this.painter.context,n=new h.Pos3dArray,a=new h.TriangleIndexArray,c=this.meshSize,p=h.EXTENT/c,m=c*c;for(let T=0;T<=c;T++)for(let z=0;z<=c;z++)n.emplaceBack(z*p,T*p,0);for(let T=0;T<m;T+=c+1)for(let z=0;z<c;z++)a.emplaceBack(z+T,c+z+T+1,c+z+T+2),a.emplaceBack(z+T,c+z+T+2,z+T+1);const y=n.length,_=y+2*(c+1);for(const T of[0,1])for(let z=0;z<=c;z++)for(const U of[0,1])n.emplaceBack(z*p,T*h.EXTENT,U);for(let T=0;T<2*c;T+=2)a.emplaceBack(_+T,_+T+1,_+T+3),a.emplaceBack(_+T,_+T+3,_+T+2),a.emplaceBack(y+T,y+T+3,y+T+1),a.emplaceBack(y+T,y+T+2,y+T+3);const v=n.length,S=v+2*(c+1);for(const T of[0,1])for(let z=0;z<=c;z++)for(const U of[0,1])n.emplaceBack(T*h.EXTENT,z*p,U);for(let T=0;T<2*c;T+=2)a.emplaceBack(v+T,v+T+1,v+T+3),a.emplaceBack(v+T,v+T+3,v+T+2),a.emplaceBack(S+T,S+T+3,S+T+1),a.emplaceBack(S+T,S+T+2,S+T+3);return this._mesh={indexBuffer:t.createIndexBuffer(a),vertexBuffer:t.createVertexBuffer(n,ki.members),segments:h.SegmentVector.simpleSegment(0,0,n.length,a.length)},this._mesh}getMeshFrameDelta(t){return 2*Math.PI*h.earthRadius/Math.pow(2,t)/5}getMinMaxElevation(t){const n=this.getTerrainData(t).tile,a={minElevation:null,maxElevation:null};return n&&n.dem&&(a.minElevation=n.dem.min*this.exaggeration,a.maxElevation=n.dem.max*this.exaggeration),a}}class fc{constructor(t,n,a){this._context=t,this._size=n,this._tileSize=a,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const t of this._objects)t.texture.destroy(),t.fbo.destroy()}_createObject(t){const n=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),a=new xt(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return a.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(a.texture),{id:t,fbo:n,texture:a,stamp:-1,inUse:!1}}getObjectForId(t){return this._objects[t]}useObject(t){t.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(n=>t.id!==n),this._recentlyUsed.push(t.id)}stampObject(t){t.stamp=++this._stamp}getOrCreateFreeObject(){for(const 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!");const t=this._createObject(this._objects.length);return this._objects.push(t),t}freeObject(t){t.inUse=!1}freeAllObjects(){for(const t of this._objects)this.freeObject(t)}isFull(){return!(this._objects.length<this._size)&&this._objects.some(t=>!t.inUse)===!1}}const Cr={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Bt{constructor(t,n){this.painter=t,this.terrain=n,this.pool=new fc(t.context,30,n.sourceCache.tileSize*n.qualityFactor)}destruct(){this.pool.destruct()}getTexture(t){return this.pool.getObjectForId(t.rtt[this._stacks.length-1].id).texture}prepareForRender(t,n){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=t._order.filter(a=>!t._layers[a].isHidden(n)),this._coordsDescendingInv={};for(const a in t.sourceCaches){this._coordsDescendingInv[a]={};const c=t.sourceCaches[a].getVisibleCoordinates();for(const p of c){const m=this.terrain.sourceCache.getTerrainCoords(p);for(const y in m)this._coordsDescendingInv[a][y]||(this._coordsDescendingInv[a][y]=[]),this._coordsDescendingInv[a][y].push(m[y])}}this._coordsDescendingInvStr={};for(const a of t._order){const c=t._layers[a],p=c.source;if(Cr[c.type]&&!this._coordsDescendingInvStr[p]){this._coordsDescendingInvStr[p]={};for(const m in this._coordsDescendingInv[p])this._coordsDescendingInvStr[p][m]=this._coordsDescendingInv[p][m].map(y=>y.key).sort().join()}}for(const a of this._renderableTiles)for(const c in this._coordsDescendingInvStr){const p=this._coordsDescendingInvStr[c][a.tileID.key];p&&p!==a.rttCoords[c]&&(a.rtt=[])}}renderLayer(t){if(t.isHidden(this.painter.transform.zoom))return!1;const n=t.type,a=this.painter,c=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(Cr[n]&&(this._prevType&&Cr[this._prevType]||this._stacks.push([]),this._prevType=n,this._stacks[this._stacks.length-1].push(t.id),!c))return!0;if(Cr[this._prevType]||Cr[n]&&c){this._prevType=n;const p=this._stacks.length-1,m=this._stacks[p]||[];for(const y of this._renderableTiles){if(this.pool.isFull()&&(ja(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(y),y.rtt[p]){const v=this.pool.getObjectForId(y.rtt[p].id);if(v.stamp===y.rtt[p].stamp){this.pool.useObject(v);continue}}const _=this.pool.getOrCreateFreeObject();this.pool.useObject(_),this.pool.stampObject(_),y.rtt[p]={id:_.id,stamp:_.stamp},a.context.bindFramebuffer.set(_.fbo.framebuffer),a.context.clear({color:h.Color.transparent,stencil:0}),a.currentStencilSource=void 0;for(let v=0;v<m.length;v++){const S=a.style._layers[m[v]],T=S.source?this._coordsDescendingInv[S.source][y.tileID.key]:[y.tileID];a.context.viewport.set([0,0,_.fbo.width,_.fbo.height]),a._renderTileClippingMasks(S,T),a.renderLayer(a,a.style.sourceCaches[S.source],S,T),S.source&&(y.rttCoords[S.source]=this._coordsDescendingInvStr[S.source][y.tileID.key])}}return ja(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects(),Cr[n]}return!1}}const Zt=me,fl={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:void 0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,maplibreLogo:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,validateStyle:!0},kn=o=>{o.touchstart=o.dragStart,o.touchmoveWindow=o.dragMove,o.touchend=o.dragEnd},Ks={showCompass:!0,showZoom:!0,visualizePitch:!1};class eo{constructor(t,n,a=!1){this._clickTolerance=10;const c=t.dragRotate._mouseRotate.getClickTolerance(),p=t.dragRotate._mousePitch.getClickTolerance();this.element=n,this.mouseRotate=ol({clickTolerance:c,enable:!0}),this.touchRotate=(({enable:m,clickTolerance:y,bearingDegreesPerPixelMoved:_=.8})=>{const v=new Vs;return new Ar({clickTolerance:y,move:(S,T)=>({bearingDelta:(T.x-S.x)*_}),moveStateManager:v,enable:m,assignEvents:kn})})({clickTolerance:c,enable:!0}),this.map=t,a&&(this.mousePitch=$s({clickTolerance:p,enable:!0}),this.touchPitch=(({enable:m,clickTolerance:y,pitchDegreesPerPixelMoved:_=-.5})=>{const v=new Vs;return new Ar({clickTolerance:y,move:(S,T)=>({pitchDelta:(T.y-S.y)*_}),moveStateManager:v,enable:m,assignEvents:kn})})({clickTolerance:p,enable:!0})),h.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),Q.addEventListener(n,"mousedown",this.mousedown),Q.addEventListener(n,"touchstart",this.touchstart,{passive:!1}),Q.addEventListener(n,"touchcancel",this.reset)}startMouse(t,n){this.mouseRotate.dragStart(t,n),this.mousePitch&&this.mousePitch.dragStart(t,n),Q.disableDrag()}startTouch(t,n){this.touchRotate.dragStart(t,n),this.touchPitch&&this.touchPitch.dragStart(t,n),Q.disableDrag()}moveMouse(t,n){const a=this.map,{bearingDelta:c}=this.mouseRotate.dragMove(t,n)||{};if(c&&a.setBearing(a.getBearing()+c),this.mousePitch){const{pitchDelta:p}=this.mousePitch.dragMove(t,n)||{};p&&a.setPitch(a.getPitch()+p)}}moveTouch(t,n){const a=this.map,{bearingDelta:c}=this.touchRotate.dragMove(t,n)||{};if(c&&a.setBearing(a.getBearing()+c),this.touchPitch){const{pitchDelta:p}=this.touchPitch.dragMove(t,n)||{};p&&a.setPitch(a.getPitch()+p)}}off(){const t=this.element;Q.removeEventListener(t,"mousedown",this.mousedown),Q.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),Q.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),Q.removeEventListener(window,"touchend",this.touchend),Q.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){Q.enableDrag(),Q.removeEventListener(window,"mousemove",this.mousemove),Q.removeEventListener(window,"mouseup",this.mouseup),Q.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),Q.removeEventListener(window,"touchend",this.touchend)}mousedown(t){this.startMouse(h.extend({},t,{ctrlKey:!0,preventDefault:()=>t.preventDefault()}),Q.mousePos(this.element,t)),Q.addEventListener(window,"mousemove",this.mousemove),Q.addEventListener(window,"mouseup",this.mouseup)}mousemove(t){this.moveMouse(t,Q.mousePos(this.element,t))}mouseup(t){this.mouseRotate.dragEnd(t),this.mousePitch&&this.mousePitch.dragEnd(t),this.offTemp()}touchstart(t){t.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=Q.touchPos(this.element,t.targetTouches)[0],this.startTouch(t,this._startPos),Q.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),Q.addEventListener(window,"touchend",this.touchend))}touchmove(t){t.targetTouches.length!==1?this.reset():(this._lastPos=Q.touchPos(this.element,t.targetTouches)[0],this.moveTouch(t,this._lastPos))}touchend(t){t.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()}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()}}let yr;function Ys(o,t,n){if(o=new h.LngLat(o.lng,o.lat),t){const a=new h.LngLat(o.lng-360,o.lat),c=new h.LngLat(o.lng+360,o.lat),p=n.locationPoint(o).distSqr(t);n.locationPoint(a).distSqr(t)<p?o=a:n.locationPoint(c).distSqr(t)<p&&(o=c)}for(;Math.abs(o.lng-n.center.lng)>180;){const a=n.locationPoint(o);if(a.x>=0&&a.y>=0&&a.x<=n.width&&a.y<=n.height)break;o.lng>n.center.lng?o.lng-=360:o.lng+=360}return o}const sn={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 Js(o,t,n){const a=o.classList;for(const c in sn)a.remove(`maplibregl-${n}-anchor-${c}`);a.add(`maplibregl-${n}-anchor-${t}`)}class hs extends h.Evented{constructor(t,n){if(super(),(t instanceof HTMLElement||n)&&(t=h.extend({element:t},n)),h.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress"],this),this._anchor=t&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&t.pitchAlignment!=="auto"?t.pitchAlignment:this._rotationAlignment,t&&t.element)this._element=t.element,this._offset=h.Point.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=Q.create("div"),this._element.setAttribute("aria-label","Map marker");const a=Q.createNS("http://www.w3.org/2000/svg","svg"),c=41,p=27;a.setAttributeNS(null,"display","block"),a.setAttributeNS(null,"height",`${c}px`),a.setAttributeNS(null,"width",`${p}px`),a.setAttributeNS(null,"viewBox",`0 0 ${p} ${c}`);const m=Q.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"stroke","none"),m.setAttributeNS(null,"stroke-width","1"),m.setAttributeNS(null,"fill","none"),m.setAttributeNS(null,"fill-rule","evenodd");const y=Q.createNS("http://www.w3.org/2000/svg","g");y.setAttributeNS(null,"fill-rule","nonzero");const _=Q.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"transform","translate(3.0, 29.0)"),_.setAttributeNS(null,"fill","#000000");const v=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const ne of v){const V=Q.createNS("http://www.w3.org/2000/svg","ellipse");V.setAttributeNS(null,"opacity","0.04"),V.setAttributeNS(null,"cx","10.5"),V.setAttributeNS(null,"cy","5.80029008"),V.setAttributeNS(null,"rx",ne.rx),V.setAttributeNS(null,"ry",ne.ry),_.appendChild(V)}const S=Q.createNS("http://www.w3.org/2000/svg","g");S.setAttributeNS(null,"fill",this._color);const T=Q.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"),S.appendChild(T);const z=Q.createNS("http://www.w3.org/2000/svg","g");z.setAttributeNS(null,"opacity","0.25"),z.setAttributeNS(null,"fill","#000000");const U=Q.createNS("http://www.w3.org/2000/svg","path");U.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"),z.appendChild(U);const R=Q.createNS("http://www.w3.org/2000/svg","g");R.setAttributeNS(null,"transform","translate(6.0, 7.0)"),R.setAttributeNS(null,"fill","#FFFFFF");const F=Q.createNS("http://www.w3.org/2000/svg","g");F.setAttributeNS(null,"transform","translate(8.0, 8.0)");const j=Q.createNS("http://www.w3.org/2000/svg","circle");j.setAttributeNS(null,"fill","#000000"),j.setAttributeNS(null,"opacity","0.25"),j.setAttributeNS(null,"cx","5.5"),j.setAttributeNS(null,"cy","5.5"),j.setAttributeNS(null,"r","5.4999962");const X=Q.createNS("http://www.w3.org/2000/svg","circle");X.setAttributeNS(null,"fill","#FFFFFF"),X.setAttributeNS(null,"cx","5.5"),X.setAttributeNS(null,"cy","5.5"),X.setAttributeNS(null,"r","5.4999962"),F.appendChild(j),F.appendChild(X),y.appendChild(_),y.appendChild(S),y.appendChild(z),y.appendChild(R),y.appendChild(F),a.appendChild(y),a.setAttributeNS(null,"height",c*this._scale+"px"),a.setAttributeNS(null,"width",p*this._scale+"px"),this._element.appendChild(a),this._offset=h.Point.convert(t&&t.offset||[0,-14])}this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",a=>{a.preventDefault()}),this._element.addEventListener("mousedown",a=>{a.preventDefault()}),Js(this._element,this._anchor,"marker"),this._popup=null}addTo(t){return this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),Q.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=h.LngLat.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const c=Math.sqrt(Math.pow(13.5,2)/2);t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[c,-1*(38.1-13.5+c)],"bottom-right":[-c,-1*(38.1-13.5+c)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=t,this._lngLat&&this._popup.setLngLat(this._lngLat),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}_onKeyPress(t){const n=t.code,a=t.charCode||t.keyCode;n!=="Space"&&n!=="Enter"&&a!==32&&a!==13||this.togglePopup()}_onMapClick(t){const n=t.originalEvent.target,a=this._element;this._popup&&(n===a||a.contains(n))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const t=this._popup;return t?(t.isOpen()?t.remove():t.addTo(this._map),this):this}_update(t){if(!this._map)return;this._map.transform.renderWorldCopies&&(this._lngLat=Ys(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);let n="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?n=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(n=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let a="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?a="rotateX(0deg)":this._pitchAlignment==="map"&&(a=`rotateX(${this._map.getPitch()}deg)`),t&&t.type!=="moveend"||(this._pos=this._pos.round()),Q.setTransform(this._element,`${sn[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${a} ${n}`),this._map.terrain&&!this._opacityTimeout&&(this._opacityTimeout=setTimeout(()=>{const c=this._map.unproject(this._pos),p=40075016686e-3*Math.abs(Math.cos(this._lngLat.lat*Math.PI/180))/Math.pow(2,this._map.transform.tileZoom+8);this._element.style.opacity=c.distanceTo(this._lngLat)>20*p?"0.2":"1.0",this._opacityTimeout=null},100))}getOffset(){return this._offset}setOffset(t){return this._offset=h.Point.convert(t),this._update(),this}_onMove(t){if(!this._isDragging){const n=this._clickTolerance||this._map._clickTolerance;this._isDragging=t.point.dist(this._pointerdownPos)>=n}this._isDragging&&(this._pos=t.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new h.Event("dragstart"))),this.fire(new h.Event("drag")))}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new h.Event("dragend")),this._state="inactive"}_addDragHandler(t){this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(this._pos).add(this._offset),this._pointerdownPos=t.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))}setDraggable(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&t!=="auto"?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}}const to={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let zn=0,an=!1;const io={maxWidth:100,unit:"metric"};function Qs(o,t,n){const a=n&&n.maxWidth||100,c=o._container.clientHeight/2,p=o.unproject([0,c]),m=o.unproject([a,c]),y=p.distanceTo(m);if(n&&n.unit==="imperial"){const _=3.2808*y;_>5280?on(t,a,_/5280,o._getUIString("ScaleControl.Miles")):on(t,a,_,o._getUIString("ScaleControl.Feet"))}else n&&n.unit==="nautical"?on(t,a,y/1852,o._getUIString("ScaleControl.NauticalMiles")):y>=1e3?on(t,a,y/1e3,o._getUIString("ScaleControl.Kilometers")):on(t,a,y,o._getUIString("ScaleControl.Meters"))}function on(o,t,n,a){const c=function(p){const m=Math.pow(10,`${Math.floor(p)}`.length-1);let y=p/m;return y=y>=10?10:y>=5?5:y>=3?3:y>=2?2:y>=1?1:function(_){const v=Math.pow(10,Math.ceil(-Math.log(_)/Math.LN10));return Math.round(_*v)/v}(y),m*y}(n);o.style.width=t*(c/n)+"px",o.innerHTML=`${c}&nbsp;${a}`}const ea={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},ro=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function ta(o){if(o){if(typeof o=="number"){const t=Math.round(Math.sqrt(.5*Math.pow(o,2)));return{center:new h.Point(0,0),top:new h.Point(0,o),"top-left":new h.Point(t,t),"top-right":new h.Point(-t,t),bottom:new h.Point(0,-o),"bottom-left":new h.Point(t,-t),"bottom-right":new h.Point(-t,-t),left:new h.Point(o,0),right:new h.Point(-o,0)}}if(o instanceof h.Point||Array.isArray(o)){const t=h.Point.convert(o);return{center:t,top:t,"top-left":t,"top-right":t,bottom:t,"bottom-left":t,"bottom-right":t,left:t,right:t}}return{center:h.Point.convert(o.center||[0,0]),top:h.Point.convert(o.top||[0,0]),"top-left":h.Point.convert(o["top-left"]||[0,0]),"top-right":h.Point.convert(o["top-right"]||[0,0]),bottom:h.Point.convert(o.bottom||[0,0]),"bottom-left":h.Point.convert(o["bottom-left"]||[0,0]),"bottom-right":h.Point.convert(o["bottom-right"]||[0,0]),left:h.Point.convert(o.left||[0,0]),right:h.Point.convert(o.right||[0,0])}}return ta(new h.Point(0,0))}const ia=me,ra={setRTLTextPlugin:h.setRTLTextPlugin,getRTLTextPluginStatus:h.getRTLTextPluginStatus,Map:class extends Ue{constructor(o){var t;if(h.PerformanceUtils.mark(h.PerformanceMarkers.create),(o=h.extend({},fl,o)).minZoom!=null&&o.maxZoom!=null&&o.minZoom>o.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(o.minPitch!=null&&o.maxPitch!=null&&o.minPitch>o.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(o.minPitch!=null&&o.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(o.maxPitch!=null&&o.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new Us(o.minZoom,o.maxZoom,o.minPitch,o.maxPitch,o.renderWorldCopies),{bearingSnap:o.bearingSnap}),this._interactive=o.interactive,this._cooperativeGestures=o.cooperativeGestures,this._metaKey=navigator.platform.indexOf("Mac")===0?"metaKey":"ctrlKey",this._maxTileCacheSize=o.maxTileCacheSize,this._failIfMajorPerformanceCaveat=o.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=o.preserveDrawingBuffer,this._antialias=o.antialias,this._trackResize=o.trackResize,this._bearingSnap=o.bearingSnap,this._refreshExpiredTiles=o.refreshExpiredTiles,this._fadeDuration=o.fadeDuration,this._crossSourceCollisions=o.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=o.collectResourceTiming,this._renderTaskQueue=new Ja,this._controls=[],this._mapId=h.uniqueId(),this._locale=h.extend({},Qa,o.locale),this._clickTolerance=o.clickTolerance,this._pixelRatio=(t=o.pixelRatio)!==null&&t!==void 0?t:devicePixelRatio,this.transformCameraUpdate=o.transformCameraUpdate,this._imageQueueHandle=hr.addThrottleControl(()=>this.isMoving()),this._requestManager=new _i(o.transformRequest),typeof o.container=="string"){if(this._container=document.getElementById(o.container),!this._container)throw new Error(`Container '${o.container}' not found.`)}else{if(!(o.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=o.container}if(o.maxBounds&&this.setMaxBounds(o.maxBounds),h.bindAll(["_onWindowOnline","_onMapScroll","_cooperativeGesturesOnWheel","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),this.once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let n=!1;this._resizeObserver=new ResizeObserver(a=>{n?this._trackResize&&this.resize(a)._update():n=!0}),this._resizeObserver.observe(this._container)}this.handlers=new gr(this,o),this._cooperativeGestures&&this._setupCooperativeGestures(),this._hash=o.hash&&new il(typeof o.hash=="string"&&o.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:o.center,zoom:o.zoom,bearing:o.bearing,pitch:o.pitch}),o.bounds&&(this.resize(),this.fitBounds(o.bounds,h.extend({},o.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=o.localIdeographFontFamily,this._validateStyle=o.validateStyle,o.style&&this.setStyle(o.style,{localIdeographFontFamily:o.localIdeographFontFamily}),o.attributionControl&&this.addControl(new Ze({customAttribution:o.customAttribution})),o.maplibreLogo&&this.addControl(new cs,o.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 h.Event(`${n.dataType}data`,n))}),this.on("dataloading",n=>{this.fire(new h.Event(`${n.dataType}dataloading`,n))}),this.on("dataabort",n=>{this.fire(new h.Event("sourcedataabort",n))})}_getMapId(){return this._mapId}addControl(o,t){if(t===void 0&&(t=o.getDefaultPosition?o.getDefaultPosition():"top-right"),!o||!o.onAdd)return this.fire(new h.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const n=o.onAdd(this);this._controls.push(o);const a=this._controlPositions[t];return t.indexOf("bottom")!==-1?a.insertBefore(n,a.firstChild):a.appendChild(n),this}removeControl(o){if(!o||!o.onRemove)return this.fire(new h.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(o);return t>-1&&this._controls.splice(t,1),o.onRemove(this),this}hasControl(o){return this._controls.indexOf(o)>-1}calculateCameraOptionsFromTo(o,t,n,a){return a==null&&this.terrain&&(a=this.transform.getElevation(n,this.terrain)),super.calculateCameraOptionsFromTo(o,t,n,a)}resize(o){var t;const n=this._containerDimensions(),a=n[0],c=n[1];this._resizeCanvas(a,c,this.getPixelRatio()),this.transform.resize(a,c),(t=this._requestedCameraState)===null||t===void 0||t.resize(a,c),this.painter.resize(a,c,this.getPixelRatio());const p=!this._moving;return p&&(this.stop(),this.fire(new h.Event("movestart",o)).fire(new h.Event("move",o))),this.fire(new h.Event("resize",o)),p&&this.fire(new h.Event("moveend",o)),this}getPixelRatio(){return this._pixelRatio}setPixelRatio(o){const[t,n]=this._containerDimensions();this._pixelRatio=o,this._resizeCanvas(t,n,o),this.painter.resize(t,n,o)}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(o){return this.transform.setMaxBounds(Gt.convert(o)),this._update()}setMinZoom(o){if((o=o??-2)>=-2&&o<=this.transform.maxZoom)return this.transform.minZoom=o,this._update(),this.getZoom()<o&&this.setZoom(o),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(o){if((o=o??22)>=this.transform.minZoom)return this.transform.maxZoom=o,this._update(),this.getZoom()>o&&this.setZoom(o),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(o){if((o=o??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(o>=0&&o<=this.transform.maxPitch)return this.transform.minPitch=o,this._update(),this.getPitch()<o&&this.setPitch(o),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(o){if((o=o??60)>85)throw new Error("maxPitch must be less than or equal to 85");if(o>=this.transform.minPitch)return this.transform.maxPitch=o,this._update(),this.getPitch()>o&&this.setPitch(o),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(o){return this.transform.renderWorldCopies=o,this._update()}getCooperativeGestures(){return this._cooperativeGestures}setCooperativeGestures(o){return this._cooperativeGestures=o,this._cooperativeGestures?this._setupCooperativeGestures():this._destroyCooperativeGestures(),this}project(o){return this.transform.locationPoint(h.LngLat.convert(o),this.style&&this.terrain)}unproject(o){return this.transform.pointLocation(h.Point.convert(o),this.terrain)}isMoving(){var o;return this._moving||((o=this.handlers)===null||o===void 0?void 0:o.isMoving())}isZooming(){var o;return this._zooming||((o=this.handlers)===null||o===void 0?void 0:o.isZooming())}isRotating(){var o;return this._rotating||((o=this.handlers)===null||o===void 0?void 0:o.isRotating())}_createDelegatedListener(o,t,n){if(o==="mouseenter"||o==="mouseover"){let a=!1;return{layer:t,listener:n,delegates:{mousemove:p=>{const m=this.getLayer(t)?this.queryRenderedFeatures(p.point,{layers:[t]}):[];m.length?a||(a=!0,n.call(this,new qt(o,this,p.originalEvent,{features:m}))):a=!1},mouseout:()=>{a=!1}}}}if(o==="mouseleave"||o==="mouseout"){let a=!1;return{layer:t,listener:n,delegates:{mousemove:m=>{(this.getLayer(t)?this.queryRenderedFeatures(m.point,{layers:[t]}):[]).length?a=!0:a&&(a=!1,n.call(this,new qt(o,this,m.originalEvent)))},mouseout:m=>{a&&(a=!1,n.call(this,new qt(o,this,m.originalEvent)))}}}}{const a=c=>{const p=this.getLayer(t)?this.queryRenderedFeatures(c.point,{layers:[t]}):[];p.length&&(c.features=p,n.call(this,c),delete c.features)};return{layer:t,listener:n,delegates:{[o]:a}}}}on(o,t,n){if(n===void 0)return super.on(o,t);const a=this._createDelegatedListener(o,t,n);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[o]=this._delegatedListeners[o]||[],this._delegatedListeners[o].push(a);for(const c in a.delegates)this.on(c,a.delegates[c]);return this}once(o,t,n){if(n===void 0)return super.once(o,t);const a=this._createDelegatedListener(o,t,n);for(const c in a.delegates)this.once(c,a.delegates[c]);return this}off(o,t,n){return n===void 0?super.off(o,t):(this._delegatedListeners&&this._delegatedListeners[o]&&(a=>{const c=this._delegatedListeners[o];for(let p=0;p<c.length;p++){const m=c[p];if(m.layer===t&&m.listener===n){for(const y in m.delegates)this.off(y,m.delegates[y]);return c.splice(p,1),this}}})(),this)}queryRenderedFeatures(o,t){if(!this.style)return[];let n;const a=o instanceof h.Point||Array.isArray(o),c=a?o:[[0,0],[this.transform.width,this.transform.height]];if(t=t||(a?{}:o)||{},c instanceof h.Point||typeof c[0]=="number")n=[h.Point.convert(c)];else{const p=h.Point.convert(c[0]),m=h.Point.convert(c[1]);n=[p,new h.Point(m.x,p.y),m,new h.Point(p.x,m.y),p]}return this.style.queryRenderedFeatures(n,t,this.transform)}querySourceFeatures(o,t){return this.style.querySourceFeatures(o,t)}setStyle(o,t){return(t=h.extend({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},t)).diff!==!1&&t.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&o?(this._diffStyle(o,t),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._updateStyle(o,t))}setTransformRequest(o){return this._requestManager.setTransformRequest(o),this}_getUIString(o){const t=this._locale[o];if(t==null)throw new Error(`Missing UI string '${o}'`);return t}_updateStyle(o,t){if(t.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(o,t));const n=this.style&&t.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!o)),o?(this.style=new tr(this,t||{}),this.style.setEventedParent(this,{style:this.style}),typeof o=="string"?this.style.loadURL(o,t,n):this.style.loadJSON(o,t,n),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new tr(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(o,t){if(typeof o=="string"){const n=this._requestManager.transformRequest(o,It.Style);h.getJSON(n,(a,c)=>{a?this.fire(new h.ErrorEvent(a)):c&&this._updateDiff(c,t)})}else typeof o=="object"&&this._updateDiff(o,t)}_updateDiff(o,t){try{this.style.setState(o,t)&&this._update(!0)}catch(n){h.warnOnce(`Unable to perform style diff: ${n.message||n.error||n}. Rebuilding the style from scratch.`),this._updateStyle(o,t)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():h.warnOnce("There is no style added to the map.")}addSource(o,t){return this._lazyInitEmptyStyle(),this.style.addSource(o,t),this._update(!0)}isSourceLoaded(o){const t=this.style&&this.style.sourceCaches[o];if(t!==void 0)return t.loaded();this.fire(new h.ErrorEvent(new Error(`There is no source with ID '${o}'`)))}setTerrain(o){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),o){const t=this.style.sourceCaches[o.source];if(!t)throw new Error(`cannot load terrain, because there exists no source with ID: ${o.source}`);for(const n in this.style._layers){const a=this.style._layers[n];a.type==="hillshade"&&a.source===o.source&&h.warnOnce("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 _r(this.painter,t,o),this.painter.renderToTexture=new Bt(this.painter,this.terrain),this.transform.updateElevation(this.terrain),this._terrainDataCallback=n=>{n.dataType==="style"?this.terrain.sourceCache.freeRtt():n.dataType==="source"&&n.tile&&(n.sourceId===o.source&&this.transform.updateElevation(this.terrain),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.updateElevation(this.terrain);return this.fire(new h.Event("terrain",{terrain:o})),this}getTerrain(){return this.terrain&&this.terrain.options}areTilesLoaded(){const o=this.style&&this.style.sourceCaches;for(const t in o){const n=o[t]._tiles;for(const a in n){const c=n[a];if(c.state!=="loaded"&&c.state!=="errored")return!1}}return!0}addSourceType(o,t,n){return this._lazyInitEmptyStyle(),this.style.addSourceType(o,t,n)}removeSource(o){return this.style.removeSource(o),this._update(!0)}getSource(o){return this.style.getSource(o)}addImage(o,t,{pixelRatio:n=1,sdf:a=!1,stretchX:c,stretchY:p,content:m}={}){if(this._lazyInitEmptyStyle(),t instanceof HTMLImageElement||h.isImageBitmap(t)){const{width:y,height:_,data:v}=h.exported.getImageData(t);this.style.addImage(o,{data:new h.RGBAImage({width:y,height:_},v),pixelRatio:n,stretchX:c,stretchY:p,content:m,sdf:a,version:0})}else{if(t.width===void 0||t.height===void 0)return this.fire(new h.ErrorEvent(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:y,height:_,data:v}=t,S=t;this.style.addImage(o,{data:new h.RGBAImage({width:y,height:_},new Uint8Array(v)),pixelRatio:n,stretchX:c,stretchY:p,content:m,sdf:a,version:0,userImage:S}),S.onAdd&&S.onAdd(this,o)}}}updateImage(o,t){const n=this.style.getImage(o);if(!n)return this.fire(new h.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const a=t instanceof HTMLImageElement||h.isImageBitmap(t)?h.exported.getImageData(t):t,{width:c,height:p,data:m}=a;if(c===void 0||p===void 0)return this.fire(new h.ErrorEvent(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(c!==n.data.width||p!==n.data.height)return this.fire(new h.ErrorEvent(new Error("The width and height of the updated image must be that same as the previous version of the image")));const y=!(t instanceof HTMLImageElement||h.isImageBitmap(t));n.data.replace(m,y),this.style.updateImage(o,n)}getImage(o){return this.style.getImage(o)}hasImage(o){return o?!!this.style.getImage(o):(this.fire(new h.ErrorEvent(new Error("Missing required image id"))),!1)}removeImage(o){this.style.removeImage(o)}loadImage(o,t){hr.getImage(this._requestManager.transformRequest(o,It.Image),t)}listImages(){return this.style.listImages()}addLayer(o,t){return this._lazyInitEmptyStyle(),this.style.addLayer(o,t),this._update(!0)}moveLayer(o,t){return this.style.moveLayer(o,t),this._update(!0)}removeLayer(o){return this.style.removeLayer(o),this._update(!0)}getLayer(o){return this.style.getLayer(o)}setLayerZoomRange(o,t,n){return this.style.setLayerZoomRange(o,t,n),this._update(!0)}setFilter(o,t,n={}){return this.style.setFilter(o,t,n),this._update(!0)}getFilter(o){return this.style.getFilter(o)}setPaintProperty(o,t,n,a={}){return this.style.setPaintProperty(o,t,n,a),this._update(!0)}getPaintProperty(o,t){return this.style.getPaintProperty(o,t)}setLayoutProperty(o,t,n,a={}){return this.style.setLayoutProperty(o,t,n,a),this._update(!0)}getLayoutProperty(o,t){return this.style.getLayoutProperty(o,t)}setGlyphs(o,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(o,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(o,t,n={}){return this._lazyInitEmptyStyle(),this.style.addSprite(o,t,n,a=>{a||this._update(!0)}),this}removeSprite(o){return this._lazyInitEmptyStyle(),this.style.removeSprite(o),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(o,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(o,t,n=>{n||this._update(!0)}),this}setLight(o,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(o,t),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(o,t){return this.style.setFeatureState(o,t),this._update()}removeFeatureState(o,t){return this.style.removeFeatureState(o,t),this._update()}getFeatureState(o){return this.style.getFeatureState(o)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let o=0,t=0;return this._container&&(o=this._container.clientWidth||400,t=this._container.clientHeight||300),[o,t]}_setupContainer(){const o=this._container;o.classList.add("maplibregl-map");const t=this._canvasContainer=Q.create("div","maplibregl-canvas-container",o);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=Q.create("canvas","maplibregl-canvas",t),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");const n=this._containerDimensions();this._resizeCanvas(n[0],n[1],this.getPixelRatio());const a=this._controlContainer=Q.create("div","maplibregl-control-container",o),c=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(p=>{c[p]=Q.create("div",`maplibregl-ctrl-${p} `,a)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_cooperativeGesturesOnWheel(o){this._onCooperativeGesture(o,o[this._metaKey],1)}_setupCooperativeGestures(){this._cooperativeGesturesScreen=Q.create("div","maplibregl-cooperative-gesture-screen",this._container);let o=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.windowsHelpText?this._cooperativeGestures.windowsHelpText:"Use Ctrl + scroll to zoom the map";navigator.platform.indexOf("Mac")===0&&(o=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.macHelpText?this._cooperativeGestures.macHelpText:"Use \u2318 + scroll to zoom the map"),this._cooperativeGesturesScreen.innerHTML=`
575
+ `}),staticAttributes:a,staticUniforms:m}}class Xr{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,n,a,c,p,m,y,_,v){this.context=t;let S=this.boundPaintVertexBuffers.length!==c.length;for(let T=0;!S&&T<c.length;T++)this.boundPaintVertexBuffers[T]!==c[T]&&(S=!0);!this.vao||this.boundProgram!==n||this.boundLayoutVertexBuffer!==a||S||this.boundIndexBuffer!==p||this.boundVertexOffset!==m||this.boundDynamicVertexBuffer!==y||this.boundDynamicVertexBuffer2!==_||this.boundDynamicVertexBuffer3!==v?this.freshBind(n,a,c,p,m,y,_,v):(t.bindVertexArray.set(this.vao),y&&y.bind(),p&&p.dynamicDraw&&p.bind(),_&&_.bind(),v&&v.bind())}freshBind(t,n,a,c,p,m,y,_){const v=t.numAttributes,S=this.context,T=S.gl;this.vao&&this.destroy(),this.vao=S.createVertexArray(),S.bindVertexArray.set(this.vao),this.boundProgram=t,this.boundLayoutVertexBuffer=n,this.boundPaintVertexBuffers=a,this.boundIndexBuffer=c,this.boundVertexOffset=p,this.boundDynamicVertexBuffer=m,this.boundDynamicVertexBuffer2=y,this.boundDynamicVertexBuffer3=_,n.enableAttributes(T,t);for(const L of a)L.enableAttributes(T,t);m&&m.enableAttributes(T,t),y&&y.enableAttributes(T,t),_&&_.enableAttributes(T,t),n.bind(),n.setVertexAttribPointers(T,t,p);for(const L of a)L.bind(),L.setVertexAttribPointers(T,t,p);m&&(m.bind(),m.setVertexAttribPointers(T,t,p)),c&&c.bind(),y&&(y.bind(),y.setVertexAttribPointers(T,t,p)),_&&(_.bind(),_.setVertexAttribPointers(T,t,p)),S.currentNumAttributes=v}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}function Qn(o){const t=[];for(let n=0;n<o.length;n++){if(o[n]===null)continue;const a=o[n].split(" ");t.push(a.pop())}return t}class As{constructor(t,n,a,c,p,m,y){const _=t.gl;this.program=_.createProgram();const v=Qn(a.staticAttributes),S=c?c.getBinderAttributes():[],T=v.concat(S),L=Zr.prelude.staticUniforms?Qn(Zr.prelude.staticUniforms):[],O=a.staticUniforms?Qn(a.staticUniforms):[],R=c?c.getBinderUniforms():[],B=L.concat(O).concat(R),$=[];for(const _e of B)$.indexOf(_e)<0&&$.push(_e);const W=c?c.defines():[];m&&W.push("#define OVERDRAW_INSPECTOR;"),y&&W.push("#define TERRAIN3D;");const ne=W.concat(Zr.prelude.fragmentSource,a.fragmentSource).join(`
576
+ `),V=W.concat(Zr.prelude.vertexSource,a.vertexSource).join(`
577
+ `),ie=_.createShader(_.FRAGMENT_SHADER);if(_.isContextLost())return void(this.failedToCreate=!0);_.shaderSource(ie,ne),_.compileShader(ie),_.attachShader(this.program,ie);const ae=_.createShader(_.VERTEX_SHADER);if(_.isContextLost())return void(this.failedToCreate=!0);_.shaderSource(ae,V),_.compileShader(ae),_.attachShader(this.program,ae),this.attributes={};const fe={};this.numAttributes=T.length;for(let _e=0;_e<this.numAttributes;_e++)T[_e]&&(_.bindAttribLocation(this.program,_e,T[_e]),this.attributes[T[_e]]=_e);_.linkProgram(this.program),_.deleteShader(ae),_.deleteShader(ie);for(let _e=0;_e<$.length;_e++){const xe=$[_e];if(xe&&!fe[xe]){const ge=_.getUniformLocation(this.program,xe);ge&&(fe[xe]=ge)}}this.fixedUniforms=p(t,fe),this.terrainUniforms=((_e,xe)=>({u_depth:new h.Uniform1i(_e,xe.u_depth),u_terrain:new h.Uniform1i(_e,xe.u_terrain),u_terrain_dim:new h.Uniform1f(_e,xe.u_terrain_dim),u_terrain_matrix:new h.UniformMatrix4f(_e,xe.u_terrain_matrix),u_terrain_unpack:new h.Uniform4f(_e,xe.u_terrain_unpack),u_terrain_exaggeration:new h.Uniform1f(_e,xe.u_terrain_exaggeration)}))(t,fe),this.binderUniforms=c?c.getUniforms(t,fe):[]}draw(t,n,a,c,p,m,y,_,v,S,T,L,O,R,B,$,W,ne){const V=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(a),t.setStencilMode(c),t.setColorMode(p),t.setCullFace(m),_){t.activeTexture.set(V.TEXTURE2),V.bindTexture(V.TEXTURE_2D,_.depthTexture),t.activeTexture.set(V.TEXTURE3),V.bindTexture(V.TEXTURE_2D,_.texture);for(const ae in this.terrainUniforms)this.terrainUniforms[ae].set(_[ae])}for(const ae in this.fixedUniforms)this.fixedUniforms[ae].set(y[ae]);B&&B.setUniforms(t,this.binderUniforms,O,{zoom:R});let ie=0;switch(n){case V.LINES:ie=2;break;case V.TRIANGLES:ie=3;break;case V.LINE_STRIP:ie=1}for(const ae of L.get()){const fe=ae.vaos||(ae.vaos={});(fe[v]||(fe[v]=new Xr)).bind(t,this,S,B?B.getPaintVertexBuffers():[],T,ae.vertexOffset,$,W,ne),V.drawElements(n,ae.primitiveLength*ie,V.UNSIGNED_SHORT,ae.primitiveOffset*ie*2)}}}function No(o,t,n){const a=1/X(n,1,t.transform.tileZoom),c=Math.pow(2,n.tileID.overscaledZ),p=n.tileSize*Math.pow(2,t.transform.tileZoom)/c,m=p*(n.tileID.canonical.x+n.tileID.wrap*c),y=p*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture.size,u_scale:[a,o.fromScale,o.toScale],u_fade:o.t,u_pixel_coord_upper:[m>>16,y>>16],u_pixel_coord_lower:[65535&m,65535&y]}}const Vo=(o,t,n,a)=>{const c=t.style.light,p=c.properties.get("position"),m=[p.x,p.y,p.z],y=function(){var v=new h.ARRAY_TYPE(9);return h.ARRAY_TYPE!=Float32Array&&(v[1]=0,v[2]=0,v[3]=0,v[5]=0,v[6]=0,v[7]=0),v[0]=1,v[4]=1,v[8]=1,v}();c.properties.get("anchor")==="viewport"&&function(v,S){var T=Math.sin(S),L=Math.cos(S);v[0]=L,v[1]=T,v[2]=0,v[3]=-T,v[4]=L,v[5]=0,v[6]=0,v[7]=0,v[8]=1}(y,-t.transform.angle),function(v,S,T){var L=S[0],O=S[1],R=S[2];v[0]=L*T[0]+O*T[3]+R*T[6],v[1]=L*T[1]+O*T[4]+R*T[7],v[2]=L*T[2]+O*T[5]+R*T[8]}(m,m,y);const _=c.properties.get("color");return{u_matrix:o,u_lightpos:m,u_lightintensity:c.properties.get("intensity"),u_lightcolor:[_.r,_.g,_.b],u_vertical_gradient:+n,u_opacity:a}},Ia=(o,t,n,a,c,p,m)=>h.extend(Vo(o,t,n,a),No(p,t,m),{u_height_factor:-Math.pow(2,c.overscaledZ)/m.tileSize/8}),$o=o=>({u_matrix:o}),Aa=(o,t,n,a)=>h.extend($o(o),No(n,t,a)),ic=(o,t)=>({u_matrix:o,u_world:t}),jo=(o,t,n,a,c)=>h.extend(Aa(o,t,n,a),{u_world:c}),rc=(o,t,n,a)=>{const c=o.transform;let p,m;if(a.paint.get("circle-pitch-alignment")==="map"){const y=X(n,1,c.zoom);p=!0,m=[y,y]}else p=!1,m=c.pixelsToGLUnits;return{u_camera_to_center_distance:c.cameraToCenterDistance,u_scale_with_map:+(a.paint.get("circle-pitch-scale")==="map"),u_matrix:o.translatePosMatrix(t.posMatrix,n,a.paint.get("circle-translate"),a.paint.get("circle-translate-anchor")),u_pitch_with_map:+p,u_device_pixel_ratio:o.pixelRatio,u_extrude_scale:m}},Ca=(o,t,n)=>{const a=X(n,1,t.zoom),c=Math.pow(2,t.zoom-n.tileID.overscaledZ),p=n.tileID.overscaleFactor();return{u_matrix:o,u_camera_to_center_distance:t.cameraToCenterDistance,u_pixels_to_tile_units:a,u_extrude_scale:[t.pixelsToGLUnits[0]/(a*c),t.pixelsToGLUnits[1]/(a*c)],u_overscale_factor:p}},Pa=(o,t,n=1)=>({u_matrix:o,u_color:t,u_overlay:0,u_overlay_scale:n}),Ma=o=>({u_matrix:o}),qo=(o,t,n,a)=>({u_matrix:o,u_extrude_scale:X(t,1,n),u_intensity:a});function Go(o,t){const n=Math.pow(2,t.canonical.z),a=t.canonical.y;return[new h.MercatorCoordinate(0,a/n).toLngLat().lat,new h.MercatorCoordinate(0,(a+1)/n).toLngLat().lat]}const Mr=(o,t,n,a)=>{const c=o.transform;return{u_matrix:Pn(o,t,n,a),u_ratio:1/X(t,1,c.zoom),u_device_pixel_ratio:o.pixelRatio,u_units_to_pixels:[1/c.pixelsToGLUnits[0],1/c.pixelsToGLUnits[1]]}},Cs=(o,t,n,a,c)=>h.extend(Mr(o,t,n,c),{u_image:0,u_image_height:a}),Wi=(o,t,n,a,c)=>{const p=o.transform,m=es(t,p);return{u_matrix:Pn(o,t,n,c),u_texsize:t.imageAtlasTexture.size,u_ratio:1/X(t,1,p.zoom),u_device_pixel_ratio:o.pixelRatio,u_image:0,u_scale:[m,a.fromScale,a.toScale],u_fade:a.t,u_units_to_pixels:[1/p.pixelsToGLUnits[0],1/p.pixelsToGLUnits[1]]}},Ps=(o,t,n,a,c,p)=>{const m=o.lineAtlas,y=es(t,o.transform),_=n.layout.get("line-cap")==="round",v=m.getDash(a.from,_),S=m.getDash(a.to,_),T=v.width*c.fromScale,L=S.width*c.toScale;return h.extend(Mr(o,t,n,p),{u_patternscale_a:[y/T,-v.height/2],u_patternscale_b:[y/L,-S.height/2],u_sdfgamma:m.width/(256*Math.min(T,L)*o.pixelRatio)/2,u_image:0,u_tex_y_a:v.y,u_tex_y_b:S.y,u_mix:c.t})};function es(o,t){return 1/X(o,1,t.tileZoom)}function Pn(o,t,n,a){return o.translatePosMatrix(a?a.posMatrix:t.tileID.posMatrix,t,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}const Ms=(o,t,n,a,c)=>{return{u_matrix:o,u_tl_parent:t,u_scale_parent:n,u_buffer_scale:1,u_fade_t:a.mix,u_opacity:a.opacity*c.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:c.paint.get("raster-brightness-min"),u_brightness_high:c.paint.get("raster-brightness-max"),u_saturation_factor:(m=c.paint.get("raster-saturation"),m>0?1-1/(1.001-m):-m),u_contrast_factor:(p=c.paint.get("raster-contrast"),p>0?1/(1-p):1+p),u_spin_weights:ks(c.paint.get("raster-hue-rotate"))};var p,m};function ks(o){o*=Math.PI/180;const t=Math.sin(o),n=Math.cos(o);return[(2*n+1)/3,(-Math.sqrt(3)*t-n+1)/3,(Math.sqrt(3)*t-n+1)/3]}const Mn=(o,t,n,a,c,p,m,y,_,v)=>{const S=c.transform;return{u_is_size_zoom_constant:+(o==="constant"||o==="source"),u_is_size_feature_constant:+(o==="constant"||o==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:S.cameraToCenterDistance,u_pitch:S.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:S.width/S.height,u_fade_change:c.options.fadeDuration?c.symbolFadeChange:1,u_matrix:p,u_label_plane_matrix:m,u_coord_matrix:y,u_is_text:+_,u_pitch_with_map:+a,u_texsize:v,u_texture:0}},kn=(o,t,n,a,c,p,m,y,_,v,S)=>{const T=c.transform;return h.extend(Mn(o,t,n,a,c,p,m,y,_,v),{u_gamma_scale:a?Math.cos(T._pitch)*T.cameraToCenterDistance:1,u_device_pixel_ratio:c.pixelRatio,u_is_halo:+S})},Ls=(o,t,n,a,c,p,m,y,_,v)=>h.extend(kn(o,t,n,a,c,p,m,y,!0,_,!0),{u_texsize_icon:v,u_texture_icon:1}),zi=(o,t,n)=>({u_matrix:o,u_opacity:t,u_color:n}),Di=(o,t,n,a,c,p)=>h.extend(function(m,y,_,v){const S=_.imageManager.getPattern(m.from.toString()),T=_.imageManager.getPattern(m.to.toString()),{width:L,height:O}=_.imageManager.getPixelSize(),R=Math.pow(2,v.tileID.overscaledZ),B=v.tileSize*Math.pow(2,_.transform.tileZoom)/R,$=B*(v.tileID.canonical.x+v.tileID.wrap*R),W=B*v.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:S.tl,u_pattern_br_a:S.br,u_pattern_tl_b:T.tl,u_pattern_br_b:T.br,u_texsize:[L,O],u_mix:y.t,u_pattern_size_a:S.displaySize,u_pattern_size_b:T.displaySize,u_scale_a:y.fromScale,u_scale_b:y.toScale,u_tile_units_to_pixels:1/X(v,1,_.transform.tileZoom),u_pixel_coord_upper:[$>>16,W>>16],u_pixel_coord_lower:[65535&$,65535&W]}}(a,p,n,c),{u_matrix:o,u_opacity:t}),ka={fillExtrusion:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_lightpos:new h.Uniform3f(o,t.u_lightpos),u_lightintensity:new h.Uniform1f(o,t.u_lightintensity),u_lightcolor:new h.Uniform3f(o,t.u_lightcolor),u_vertical_gradient:new h.Uniform1f(o,t.u_vertical_gradient),u_opacity:new h.Uniform1f(o,t.u_opacity)}),fillExtrusionPattern:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_lightpos:new h.Uniform3f(o,t.u_lightpos),u_lightintensity:new h.Uniform1f(o,t.u_lightintensity),u_lightcolor:new h.Uniform3f(o,t.u_lightcolor),u_vertical_gradient:new h.Uniform1f(o,t.u_vertical_gradient),u_height_factor:new h.Uniform1f(o,t.u_height_factor),u_image:new h.Uniform1i(o,t.u_image),u_texsize:new h.Uniform2f(o,t.u_texsize),u_pixel_coord_upper:new h.Uniform2f(o,t.u_pixel_coord_upper),u_pixel_coord_lower:new h.Uniform2f(o,t.u_pixel_coord_lower),u_scale:new h.Uniform3f(o,t.u_scale),u_fade:new h.Uniform1f(o,t.u_fade),u_opacity:new h.Uniform1f(o,t.u_opacity)}),fill:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix)}),fillPattern:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_image:new h.Uniform1i(o,t.u_image),u_texsize:new h.Uniform2f(o,t.u_texsize),u_pixel_coord_upper:new h.Uniform2f(o,t.u_pixel_coord_upper),u_pixel_coord_lower:new h.Uniform2f(o,t.u_pixel_coord_lower),u_scale:new h.Uniform3f(o,t.u_scale),u_fade:new h.Uniform1f(o,t.u_fade)}),fillOutline:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_world:new h.Uniform2f(o,t.u_world)}),fillOutlinePattern:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_world:new h.Uniform2f(o,t.u_world),u_image:new h.Uniform1i(o,t.u_image),u_texsize:new h.Uniform2f(o,t.u_texsize),u_pixel_coord_upper:new h.Uniform2f(o,t.u_pixel_coord_upper),u_pixel_coord_lower:new h.Uniform2f(o,t.u_pixel_coord_lower),u_scale:new h.Uniform3f(o,t.u_scale),u_fade:new h.Uniform1f(o,t.u_fade)}),circle:(o,t)=>({u_camera_to_center_distance:new h.Uniform1f(o,t.u_camera_to_center_distance),u_scale_with_map:new h.Uniform1i(o,t.u_scale_with_map),u_pitch_with_map:new h.Uniform1i(o,t.u_pitch_with_map),u_extrude_scale:new h.Uniform2f(o,t.u_extrude_scale),u_device_pixel_ratio:new h.Uniform1f(o,t.u_device_pixel_ratio),u_matrix:new h.UniformMatrix4f(o,t.u_matrix)}),collisionBox:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_camera_to_center_distance:new h.Uniform1f(o,t.u_camera_to_center_distance),u_pixels_to_tile_units:new h.Uniform1f(o,t.u_pixels_to_tile_units),u_extrude_scale:new h.Uniform2f(o,t.u_extrude_scale),u_overscale_factor:new h.Uniform1f(o,t.u_overscale_factor)}),collisionCircle:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_inv_matrix:new h.UniformMatrix4f(o,t.u_inv_matrix),u_camera_to_center_distance:new h.Uniform1f(o,t.u_camera_to_center_distance),u_viewport_size:new h.Uniform2f(o,t.u_viewport_size)}),debug:(o,t)=>({u_color:new h.UniformColor(o,t.u_color),u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_overlay:new h.Uniform1i(o,t.u_overlay),u_overlay_scale:new h.Uniform1f(o,t.u_overlay_scale)}),clippingMask:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix)}),heatmap:(o,t)=>({u_extrude_scale:new h.Uniform1f(o,t.u_extrude_scale),u_intensity:new h.Uniform1f(o,t.u_intensity),u_matrix:new h.UniformMatrix4f(o,t.u_matrix)}),heatmapTexture:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_world:new h.Uniform2f(o,t.u_world),u_image:new h.Uniform1i(o,t.u_image),u_color_ramp:new h.Uniform1i(o,t.u_color_ramp),u_opacity:new h.Uniform1f(o,t.u_opacity)}),hillshade:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_image:new h.Uniform1i(o,t.u_image),u_latrange:new h.Uniform2f(o,t.u_latrange),u_light:new h.Uniform2f(o,t.u_light),u_shadow:new h.UniformColor(o,t.u_shadow),u_highlight:new h.UniformColor(o,t.u_highlight),u_accent:new h.UniformColor(o,t.u_accent)}),hillshadePrepare:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_image:new h.Uniform1i(o,t.u_image),u_dimension:new h.Uniform2f(o,t.u_dimension),u_zoom:new h.Uniform1f(o,t.u_zoom),u_unpack:new h.Uniform4f(o,t.u_unpack)}),line:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_ratio:new h.Uniform1f(o,t.u_ratio),u_device_pixel_ratio:new h.Uniform1f(o,t.u_device_pixel_ratio),u_units_to_pixels:new h.Uniform2f(o,t.u_units_to_pixels)}),lineGradient:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_ratio:new h.Uniform1f(o,t.u_ratio),u_device_pixel_ratio:new h.Uniform1f(o,t.u_device_pixel_ratio),u_units_to_pixels:new h.Uniform2f(o,t.u_units_to_pixels),u_image:new h.Uniform1i(o,t.u_image),u_image_height:new h.Uniform1f(o,t.u_image_height)}),linePattern:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_texsize:new h.Uniform2f(o,t.u_texsize),u_ratio:new h.Uniform1f(o,t.u_ratio),u_device_pixel_ratio:new h.Uniform1f(o,t.u_device_pixel_ratio),u_image:new h.Uniform1i(o,t.u_image),u_units_to_pixels:new h.Uniform2f(o,t.u_units_to_pixels),u_scale:new h.Uniform3f(o,t.u_scale),u_fade:new h.Uniform1f(o,t.u_fade)}),lineSDF:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_ratio:new h.Uniform1f(o,t.u_ratio),u_device_pixel_ratio:new h.Uniform1f(o,t.u_device_pixel_ratio),u_units_to_pixels:new h.Uniform2f(o,t.u_units_to_pixels),u_patternscale_a:new h.Uniform2f(o,t.u_patternscale_a),u_patternscale_b:new h.Uniform2f(o,t.u_patternscale_b),u_sdfgamma:new h.Uniform1f(o,t.u_sdfgamma),u_image:new h.Uniform1i(o,t.u_image),u_tex_y_a:new h.Uniform1f(o,t.u_tex_y_a),u_tex_y_b:new h.Uniform1f(o,t.u_tex_y_b),u_mix:new h.Uniform1f(o,t.u_mix)}),raster:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_tl_parent:new h.Uniform2f(o,t.u_tl_parent),u_scale_parent:new h.Uniform1f(o,t.u_scale_parent),u_buffer_scale:new h.Uniform1f(o,t.u_buffer_scale),u_fade_t:new h.Uniform1f(o,t.u_fade_t),u_opacity:new h.Uniform1f(o,t.u_opacity),u_image0:new h.Uniform1i(o,t.u_image0),u_image1:new h.Uniform1i(o,t.u_image1),u_brightness_low:new h.Uniform1f(o,t.u_brightness_low),u_brightness_high:new h.Uniform1f(o,t.u_brightness_high),u_saturation_factor:new h.Uniform1f(o,t.u_saturation_factor),u_contrast_factor:new h.Uniform1f(o,t.u_contrast_factor),u_spin_weights:new h.Uniform3f(o,t.u_spin_weights)}),symbolIcon:(o,t)=>({u_is_size_zoom_constant:new h.Uniform1i(o,t.u_is_size_zoom_constant),u_is_size_feature_constant:new h.Uniform1i(o,t.u_is_size_feature_constant),u_size_t:new h.Uniform1f(o,t.u_size_t),u_size:new h.Uniform1f(o,t.u_size),u_camera_to_center_distance:new h.Uniform1f(o,t.u_camera_to_center_distance),u_pitch:new h.Uniform1f(o,t.u_pitch),u_rotate_symbol:new h.Uniform1i(o,t.u_rotate_symbol),u_aspect_ratio:new h.Uniform1f(o,t.u_aspect_ratio),u_fade_change:new h.Uniform1f(o,t.u_fade_change),u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_label_plane_matrix:new h.UniformMatrix4f(o,t.u_label_plane_matrix),u_coord_matrix:new h.UniformMatrix4f(o,t.u_coord_matrix),u_is_text:new h.Uniform1i(o,t.u_is_text),u_pitch_with_map:new h.Uniform1i(o,t.u_pitch_with_map),u_texsize:new h.Uniform2f(o,t.u_texsize),u_texture:new h.Uniform1i(o,t.u_texture)}),symbolSDF:(o,t)=>({u_is_size_zoom_constant:new h.Uniform1i(o,t.u_is_size_zoom_constant),u_is_size_feature_constant:new h.Uniform1i(o,t.u_is_size_feature_constant),u_size_t:new h.Uniform1f(o,t.u_size_t),u_size:new h.Uniform1f(o,t.u_size),u_camera_to_center_distance:new h.Uniform1f(o,t.u_camera_to_center_distance),u_pitch:new h.Uniform1f(o,t.u_pitch),u_rotate_symbol:new h.Uniform1i(o,t.u_rotate_symbol),u_aspect_ratio:new h.Uniform1f(o,t.u_aspect_ratio),u_fade_change:new h.Uniform1f(o,t.u_fade_change),u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_label_plane_matrix:new h.UniformMatrix4f(o,t.u_label_plane_matrix),u_coord_matrix:new h.UniformMatrix4f(o,t.u_coord_matrix),u_is_text:new h.Uniform1i(o,t.u_is_text),u_pitch_with_map:new h.Uniform1i(o,t.u_pitch_with_map),u_texsize:new h.Uniform2f(o,t.u_texsize),u_texture:new h.Uniform1i(o,t.u_texture),u_gamma_scale:new h.Uniform1f(o,t.u_gamma_scale),u_device_pixel_ratio:new h.Uniform1f(o,t.u_device_pixel_ratio),u_is_halo:new h.Uniform1i(o,t.u_is_halo)}),symbolTextAndIcon:(o,t)=>({u_is_size_zoom_constant:new h.Uniform1i(o,t.u_is_size_zoom_constant),u_is_size_feature_constant:new h.Uniform1i(o,t.u_is_size_feature_constant),u_size_t:new h.Uniform1f(o,t.u_size_t),u_size:new h.Uniform1f(o,t.u_size),u_camera_to_center_distance:new h.Uniform1f(o,t.u_camera_to_center_distance),u_pitch:new h.Uniform1f(o,t.u_pitch),u_rotate_symbol:new h.Uniform1i(o,t.u_rotate_symbol),u_aspect_ratio:new h.Uniform1f(o,t.u_aspect_ratio),u_fade_change:new h.Uniform1f(o,t.u_fade_change),u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_label_plane_matrix:new h.UniformMatrix4f(o,t.u_label_plane_matrix),u_coord_matrix:new h.UniformMatrix4f(o,t.u_coord_matrix),u_is_text:new h.Uniform1i(o,t.u_is_text),u_pitch_with_map:new h.Uniform1i(o,t.u_pitch_with_map),u_texsize:new h.Uniform2f(o,t.u_texsize),u_texsize_icon:new h.Uniform2f(o,t.u_texsize_icon),u_texture:new h.Uniform1i(o,t.u_texture),u_texture_icon:new h.Uniform1i(o,t.u_texture_icon),u_gamma_scale:new h.Uniform1f(o,t.u_gamma_scale),u_device_pixel_ratio:new h.Uniform1f(o,t.u_device_pixel_ratio),u_is_halo:new h.Uniform1i(o,t.u_is_halo)}),background:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_opacity:new h.Uniform1f(o,t.u_opacity),u_color:new h.UniformColor(o,t.u_color)}),backgroundPattern:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_opacity:new h.Uniform1f(o,t.u_opacity),u_image:new h.Uniform1i(o,t.u_image),u_pattern_tl_a:new h.Uniform2f(o,t.u_pattern_tl_a),u_pattern_br_a:new h.Uniform2f(o,t.u_pattern_br_a),u_pattern_tl_b:new h.Uniform2f(o,t.u_pattern_tl_b),u_pattern_br_b:new h.Uniform2f(o,t.u_pattern_br_b),u_texsize:new h.Uniform2f(o,t.u_texsize),u_mix:new h.Uniform1f(o,t.u_mix),u_pattern_size_a:new h.Uniform2f(o,t.u_pattern_size_a),u_pattern_size_b:new h.Uniform2f(o,t.u_pattern_size_b),u_scale_a:new h.Uniform1f(o,t.u_scale_a),u_scale_b:new h.Uniform1f(o,t.u_scale_b),u_pixel_coord_upper:new h.Uniform2f(o,t.u_pixel_coord_upper),u_pixel_coord_lower:new h.Uniform2f(o,t.u_pixel_coord_lower),u_tile_units_to_pixels:new h.Uniform1f(o,t.u_tile_units_to_pixels)}),terrain:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_texture:new h.Uniform1i(o,t.u_texture),u_ele_delta:new h.Uniform1f(o,t.u_ele_delta)}),terrainDepth:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_ele_delta:new h.Uniform1f(o,t.u_ele_delta)}),terrainCoords:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_texture:new h.Uniform1i(o,t.u_texture),u_terrain_coords_id:new h.Uniform1f(o,t.u_terrain_coords_id),u_ele_delta:new h.Uniform1f(o,t.u_ele_delta)})};class zs{constructor(t,n,a){this.context=t;const c=t.gl;this.buffer=c.createBuffer(),this.dynamicDraw=!!a,this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),c.bufferData(c.ELEMENT_ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?c.DYNAMIC_DRAW:c.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){const 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,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Ds={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class La{constructor(t,n,a,c){this.length=n.length,this.attributes=a,this.itemSize=n.bytesPerElement,this.dynamicDraw=c,this.context=t;const p=t.gl;this.buffer=p.createBuffer(),t.bindVertexBuffer.set(this.buffer),p.bufferData(p.ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?p.DYNAMIC_DRAW:p.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){if(t.length!==this.length)throw new Error(`Length of new data is ${t.length}, which doesn't match current length of ${this.length}`);const n=this.context.gl;this.bind(),n.bufferSubData(n.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,n){for(let a=0;a<this.attributes.length;a++){const c=n.attributes[this.attributes[a].name];c!==void 0&&t.enableVertexAttribArray(c)}}setVertexAttribPointers(t,n,a){for(let c=0;c<this.attributes.length;c++){const p=this.attributes[c],m=n.attributes[p.name];m!==void 0&&t.vertexAttribPointer(m,p.components,t[Ds[p.type]],!1,this.itemSize,p.offset+this.itemSize*(a||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const ts=new WeakMap;function on(o){if(ts.has(o))return ts.get(o);{const t=o.getParameter(o.VERSION).startsWith("WebGL 2.0");return ts.set(o,t),t}}class ut{constructor(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(t){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class za extends ut{getDefault(){return h.Color.transparent}set(t){const n=this.current;(t.r!==n.r||t.g!==n.g||t.b!==n.b||t.a!==n.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class Rs extends ut{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class Zo extends ut{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class Xo extends ut{getDefault(){return[!0,!0,!0,!0]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||t[3]!==n[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class Ln extends ut{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class nc extends ut{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class sc extends ut{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){const n=this.current;(t.func!==n.func||t.ref!==n.ref||t.mask!==n.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}}class ac extends ut{getDefault(){const t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}}class oc extends ut{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.STENCIL_TEST):n.disable(n.STENCIL_TEST),this.current=t,this.dirty=!1}}class lc extends ut{getDefault(){return[0,1]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}}class cc extends ut{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.DEPTH_TEST):n.disable(n.DEPTH_TEST),this.current=t,this.dirty=!1}}class Da extends ut{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class Bs extends ut{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.BLEND):n.disable(n.BLEND),this.current=t,this.dirty=!1}}class Ra extends ut{getDefault(){const t=this.gl;return[t.ONE,t.ZERO]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||this.dirty)&&(this.gl.blendFunc(t[0],t[1]),this.current=t,this.dirty=!1)}}class Ba extends ut{getDefault(){return h.Color.transparent}set(t){const n=this.current;(t.r!==n.r||t.g!==n.g||t.b!==n.b||t.a!==n.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class zn extends ut{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}}class Wo extends ut{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.CULL_FACE):n.disable(n.CULL_FACE),this.current=t,this.dirty=!1}}class Ho extends ut{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class Fa extends ut{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}class ln extends ut{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}}class Ko extends ut{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class Dn extends ut{getDefault(){const t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||t[3]!==n[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class Rn extends ut{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindFramebuffer(n.FRAMEBUFFER,t),this.current=t,this.dirty=!1}}class Yo extends ut{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindRenderbuffer(n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Oa extends ut{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindTexture(n.TEXTURE_2D,t),this.current=t,this.dirty=!1}}class _t extends ut{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindBuffer(n.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Fs extends ut{getDefault(){return null}set(t){const n=this.gl;n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class hc extends ut{getDefault(){return null}set(t){var n;if(t===this.current&&!this.dirty)return;const a=this.gl;on(a)?a.bindVertexArray(t):(n=a.getExtension("OES_vertex_array_object"))===null||n===void 0||n.bindVertexArrayOES(t),this.current=t,this.dirty=!1}}class Jo extends ut{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}}class is extends ut{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}}class uc extends ut{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}}class Ua extends ut{constructor(t,n){super(t),this.context=t,this.parent=n}getDefault(){return null}}class Qo extends Ua{setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class dc extends Ua{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Na extends Ua{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Os{constructor(t,n,a,c,p){this.context=t,this.width=n,this.height=a;const m=t.gl,y=this.framebuffer=m.createFramebuffer();if(this.colorAttachment=new Qo(t,y),c)this.depthAttachment=p?new Na(t,y):new dc(t,y);else if(p)throw new Error("Stencil cannot be setted without depth");if(m.checkFramebufferStatus(m.FRAMEBUFFER)!==m.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer is not complete")}destroy(){const t=this.context.gl,n=this.colorAttachment.get();if(n&&t.deleteTexture(n),this.depthAttachment){const a=this.depthAttachment.get();a&&t.deleteRenderbuffer(a)}t.deleteFramebuffer(this.framebuffer)}}class Lt{constructor(t,n,a){this.blendFunction=t,this.blendColor=n,this.mask=a}}Lt.Replace=[1,0],Lt.disabled=new Lt(Lt.Replace,h.Color.transparent,[!1,!1,!1,!1]),Lt.unblended=new Lt(Lt.Replace,h.Color.transparent,[!0,!0,!0,!0]),Lt.alphaBlended=new Lt([1,771],h.Color.transparent,[!0,!0,!0,!0]);class Va{constructor(t){var n,a;if(this.gl=t,this.clearColor=new za(this),this.clearDepth=new Rs(this),this.clearStencil=new Zo(this),this.colorMask=new Xo(this),this.depthMask=new Ln(this),this.stencilMask=new nc(this),this.stencilFunc=new sc(this),this.stencilOp=new ac(this),this.stencilTest=new oc(this),this.depthRange=new lc(this),this.depthTest=new cc(this),this.depthFunc=new Da(this),this.blend=new Bs(this),this.blendFunc=new Ra(this),this.blendColor=new Ba(this),this.blendEquation=new zn(this),this.cullFace=new Wo(this),this.cullFaceSide=new Ho(this),this.frontFace=new Fa(this),this.program=new ln(this),this.activeTexture=new Ko(this),this.viewport=new Dn(this),this.bindFramebuffer=new Rn(this),this.bindRenderbuffer=new Yo(this),this.bindTexture=new Oa(this),this.bindVertexBuffer=new _t(this),this.bindElementBuffer=new Fs(this),this.bindVertexArray=new hc(this),this.pixelStoreUnpack=new Jo(this),this.pixelStoreUnpackPremultiplyAlpha=new is(this),this.pixelStoreUnpackFlipY=new uc(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE),on(t)){this.HALF_FLOAT=t.HALF_FLOAT;const c=t.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(n=t.RGBA16F)!==null&&n!==void 0?n:c?.RGBA16F_EXT,this.RGB16F=(a=t.RGB16F)!==null&&a!==void 0?a:c?.RGB16F_EXT,t.getExtension("EXT_color_buffer_float")}else{t.getExtension("EXT_color_buffer_half_float"),t.getExtension("OES_texture_half_float_linear");const c=t.getExtension("OES_texture_half_float");this.HALF_FLOAT=c?.HALF_FLOAT_OES}}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(t,n){return new zs(this,t,n)}createVertexBuffer(t,n,a){return new La(this,t,n,a)}createRenderbuffer(t,n,a){const c=this.gl,p=c.createRenderbuffer();return this.bindRenderbuffer.set(p),c.renderbufferStorage(c.RENDERBUFFER,t,n,a),this.bindRenderbuffer.set(null),p}createFramebuffer(t,n,a,c){return new Os(this,t,n,a,c)}clear({color:t,depth:n,stencil:a}){const c=this.gl;let p=0;t&&(p|=c.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),n!==void 0&&(p|=c.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(n),this.depthMask.set(!0)),a!==void 0&&(p|=c.STENCIL_BUFFER_BIT,this.clearStencil.set(a),this.stencilMask.set(255)),c.clear(p)}setCullFace(t){t.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace))}setDepthMode(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1)}setStencilMode(t){t.test.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1)}setColorMode(t){h.deepEqual(t.blendFunction,Lt.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor)),this.colorMask.set(t.mask)}createVertexArray(){var t;return on(this.gl)?this.gl.createVertexArray():(t=this.gl.getExtension("OES_vertex_array_object"))===null||t===void 0?void 0:t.createVertexArrayOES()}deleteVertexArray(t){var n;return on(this.gl)?this.gl.deleteVertexArray(t):(n=this.gl.getExtension("OES_vertex_array_object"))===null||n===void 0?void 0:n.deleteVertexArrayOES(t)}unbindVAO(){this.bindVertexArray.set(null)}}class ot{constructor(t,n,a){this.func=t,this.mask=n,this.range=a}}ot.ReadOnly=!1,ot.ReadWrite=!0,ot.disabled=new ot(519,ot.ReadOnly,[0,1]);const Us=7680;class St{constructor(t,n,a,c,p,m){this.test=t,this.ref=n,this.mask=a,this.fail=c,this.depthFail=p,this.pass=m}}St.disabled=new St({func:519,mask:0},0,0,Us,Us,Us);class wt{constructor(t,n,a){this.enable=t,this.mode=n,this.frontFace=a}}let Bn;function el(o,t,n,a,c,p,m){const y=o.context,_=y.gl,v=o.useProgram("collisionBox"),S=[];let T=0,L=0;for(let V=0;V<a.length;V++){const ie=a[V],ae=t.getTile(ie),fe=ae.getBucket(n);if(!fe)continue;let _e=ie.posMatrix;c[0]===0&&c[1]===0||(_e=o.translatePosMatrix(ie.posMatrix,ae,c,p));const xe=m?fe.textCollisionBox:fe.iconCollisionBox,ge=fe.collisionCircleArray;if(ge.length>0){const ke=h.create(),Ve=_e;h.mul(ke,fe.placementInvProjMatrix,o.transform.glCoordMatrix),h.mul(ke,ke,fe.placementViewportMatrix),S.push({circleArray:ge,circleOffset:L,transform:Ve,invTransform:ke,coord:ie}),T+=ge.length/4,L=T}xe&&v.draw(y,_.LINES,ot.disabled,St.disabled,o.colorModeForRenderPass(),wt.disabled,Ca(_e,o.transform,ae),o.style.map.terrain&&o.style.map.terrain.getTerrainData(ie),n.id,xe.layoutVertexBuffer,xe.indexBuffer,xe.segments,null,o.transform.zoom,null,null,xe.collisionVertexBuffer)}if(!m||!S.length)return;const O=o.useProgram("collisionCircle"),R=new h.CollisionCircleLayoutArray;R.resize(4*T),R._trim();let B=0;for(const V of S)for(let ie=0;ie<V.circleArray.length/4;ie++){const ae=4*ie,fe=V.circleArray[ae+0],_e=V.circleArray[ae+1],xe=V.circleArray[ae+2],ge=V.circleArray[ae+3];R.emplace(B++,fe,_e,xe,ge,0),R.emplace(B++,fe,_e,xe,ge,1),R.emplace(B++,fe,_e,xe,ge,2),R.emplace(B++,fe,_e,xe,ge,3)}(!Bn||Bn.length<2*T)&&(Bn=function(V){const ie=2*V,ae=new h.QuadTriangleArray;ae.resize(ie),ae._trim();for(let fe=0;fe<ie;fe++){const _e=6*fe;ae.uint16[_e+0]=4*fe+0,ae.uint16[_e+1]=4*fe+1,ae.uint16[_e+2]=4*fe+2,ae.uint16[_e+3]=4*fe+2,ae.uint16[_e+4]=4*fe+3,ae.uint16[_e+5]=4*fe+0}return ae}(T));const $=y.createIndexBuffer(Bn,!0),W=y.createVertexBuffer(R,h.collisionCircleLayout.members,!0);for(const V of S){const ie={u_matrix:V.transform,u_inv_matrix:V.invTransform,u_camera_to_center_distance:(ne=o.transform).cameraToCenterDistance,u_viewport_size:[ne.width,ne.height]};O.draw(y,_.TRIANGLES,ot.disabled,St.disabled,o.colorModeForRenderPass(),wt.disabled,ie,o.style.map.terrain&&o.style.map.terrain.getTerrainData(V.coord),n.id,W,$,h.SegmentVector.simpleSegment(0,2*V.circleOffset,V.circleArray.length,V.circleArray.length/2),null,o.transform.zoom,null,null,null)}var ne;W.destroy(),$.destroy()}wt.disabled=new wt(!1,1029,2305),wt.backCCW=new wt(!0,1029,2305);const $a=h.identity(new Float32Array(16));function pc(o,t,n,a,c,p){const{horizontalAlign:m,verticalAlign:y}=h.getAnchorAlignment(o),_=-(m-.5)*t,v=-(y-.5)*n,S=h.evaluateVariableOffset(o,a);return new h.Point((_/c+S[0])*p,(v/c+S[1])*p)}function tl(o,t,n,a,c,p,m,y,_,v,S){const T=o.text.placedSymbolArray,L=o.text.dynamicLayoutVertexArray,O=o.icon.dynamicLayoutVertexArray,R={};L.clear();for(let B=0;B<T.length;B++){const $=T.get(B),W=$.hidden||!$.crossTileID||o.allowVerticalPlacement&&!$.placedOrientation?null:a[$.crossTileID];if(W){const ne=new h.Point($.anchorX,$.anchorY),V=Kt(ne,n?m:p,S),ie=Je(c.cameraToCenterDistance,V.signedDistanceFromCamera);let ae=h.evaluateSizeForFeature(o.textSizeData,_,$)*ie/h.ONE_EM;n&&(ae*=o.tilePixelRatio/y);const{width:fe,height:_e,anchor:xe,textOffset:ge,textBoxScale:ke}=W,Ve=pc(xe,fe,_e,ge,ke,ae),Qe=n?Kt(ne.add(Ve),p,S).point:V.point.add(t?Ve.rotate(-c.angle):Ve),Se=o.allowVerticalPlacement&&$.placedOrientation===h.WritingMode.vertical?Math.PI/2:0;for(let Ze=0;Ze<$.numGlyphs;Ze++)h.addDynamicAttributes(L,Qe,Se);v&&$.associatedIconIndex>=0&&(R[$.associatedIconIndex]={shiftedAnchor:Qe,angle:Se})}else D($.numGlyphs,L)}if(v){O.clear();const B=o.icon.placedSymbolArray;for(let $=0;$<B.length;$++){const W=B.get($);if(W.hidden)D(W.numGlyphs,O);else{const ne=R[$];if(ne)for(let V=0;V<W.numGlyphs;V++)h.addDynamicAttributes(O,ne.shiftedAnchor,ne.angle);else D(W.numGlyphs,O)}}o.icon.dynamicLayoutVertexBuffer.updateData(O)}o.text.dynamicLayoutVertexBuffer.updateData(L)}function Ns(o,t,n){return n.iconsInText&&t?"symbolTextAndIcon":o?"symbolSDF":"symbolIcon"}function Vs(o,t,n,a,c,p,m,y,_,v,S,T){const L=o.context,O=L.gl,R=o.transform,B=y==="map",$=_==="map",W=y!=="viewport"&&n.layout.get("symbol-placement")!=="point",ne=B&&!$&&!W,V=!n.layout.get("symbol-sort-key").isConstant();let ie=!1;const ae=o.depthModeForSublayer(0,ot.ReadOnly),fe=n.layout.get("text-variable-anchor"),_e=[];for(const xe of a){const ge=t.getTile(xe),ke=ge.getBucket(n);if(!ke)continue;const Ve=c?ke.text:ke.icon;if(!Ve||!Ve.segments.get().length||!Ve.hasVisibleVertices)continue;const Qe=Ve.programConfigurations.get(n.id),Se=c||ke.sdfIcons,Ze=c?ke.textSizeData:ke.iconSizeData,Le=$||R.pitch!==0,dt=o.useProgram(Ns(Se,c,ke),Qe),Nt=h.evaluateSizeForZoom(Ze,R.zoom),pt=o.style.map.terrain&&o.style.map.terrain.getTerrainData(xe);let tt,Bt,bi,Vt,ei=[0,0],Ri=null;if(c)Bt=ge.glyphAtlasTexture,bi=O.LINEAR,tt=ge.glyphAtlasTexture.size,ke.iconsInText&&(ei=ge.imageAtlasTexture.size,Ri=ge.imageAtlasTexture,Vt=Le||o.options.rotating||o.options.zooming||Ze.kind==="composite"||Ze.kind==="camera"?O.LINEAR:O.NEAREST);else{const Jt=n.layout.get("icon-size").constantOr(0)!==1||ke.iconsNeedLinear;Bt=ge.imageAtlasTexture,bi=Se||o.options.rotating||o.options.zooming||Jt||Le?O.LINEAR:O.NEAREST,tt=ge.imageAtlasTexture.size}const ir=X(ge,1,o.transform.zoom),rr=et(xe.posMatrix,$,B,o.transform,ir),wi=Ai(xe.posMatrix,$,B,o.transform,ir),xr=fe&&ke.hasTextData(),ms=n.layout.get("icon-text-fit")!=="none"&&xr&&ke.hasIconData();if(W){const Jt=o.style.map.terrain?(la,zr)=>o.style.map.terrain.getElevation(xe,la,zr):null,Bi=n.layout.get("text-rotation-alignment")==="map";Cr(ke,xe.posMatrix,o,c,rr,wi,$,v,Bi,Jt)}const ui=o.translatePosMatrix(xe.posMatrix,ge,p,m),ti=W||c&&fe||ms?$a:rr,ft=o.translatePosMatrix(wi,ge,p,m,!0),Yt=Se&&n.paint.get(c?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let ii;ii=Se?ke.iconsInText?Ls(Ze.kind,Nt,ne,$,o,ui,ti,ft,tt,ei):kn(Ze.kind,Nt,ne,$,o,ui,ti,ft,c,tt,!0):Mn(Ze.kind,Nt,ne,$,o,ui,ti,ft,c,tt);const gt={program:dt,buffers:Ve,uniformValues:ii,atlasTexture:Bt,atlasTextureIcon:Ri,atlasInterpolation:bi,atlasInterpolationIcon:Vt,isSDF:Se,hasHalo:Yt};if(V&&ke.canOverlap){ie=!0;const Jt=Ve.segments.get();for(const Bi of Jt)_e.push({segments:new h.SegmentVector([Bi]),sortKey:Bi.sortKey,state:gt,terrainData:pt})}else _e.push({segments:Ve.segments,sortKey:0,state:gt,terrainData:pt})}ie&&_e.sort((xe,ge)=>xe.sortKey-ge.sortKey);for(const xe of _e){const ge=xe.state;if(L.activeTexture.set(O.TEXTURE0),ge.atlasTexture.bind(ge.atlasInterpolation,O.CLAMP_TO_EDGE),ge.atlasTextureIcon&&(L.activeTexture.set(O.TEXTURE1),ge.atlasTextureIcon&&ge.atlasTextureIcon.bind(ge.atlasInterpolationIcon,O.CLAMP_TO_EDGE)),ge.isSDF){const ke=ge.uniformValues;ge.hasHalo&&(ke.u_is_halo=1,ja(ge.buffers,xe.segments,n,o,ge.program,ae,S,T,ke,xe.terrainData)),ke.u_is_halo=0}ja(ge.buffers,xe.segments,n,o,ge.program,ae,S,T,ge.uniformValues,xe.terrainData)}}function ja(o,t,n,a,c,p,m,y,_,v){const S=a.context;c.draw(S,S.gl.TRIANGLES,p,m,y,wt.disabled,_,v,n.id,o.layoutVertexBuffer,o.indexBuffer,t,n.paint,a.transform.zoom,o.programConfigurations.get(n.id),o.dynamicLayoutVertexBuffer,o.opacityVertexBuffer)}function qa(o,t,n,a,c){if(!n||!a||!a.imageAtlas)return;const p=a.imageAtlas.patternPositions;let m=p[n.to.toString()],y=p[n.from.toString()];if(!m||!y){const _=c.getPaintProperty(t);m=p[_],y=p[_]}m&&y&&o.setConstantPatternPositions(m,y)}function rs(o,t,n,a,c,p,m){const y=o.context.gl,_="fill-pattern",v=n.paint.get(_),S=v&&v.constantOr(1),T=n.getCrossfadeParameters();let L,O,R,B,$;m?(O=S&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",L=y.LINES):(O=S?"fillPattern":"fill",L=y.TRIANGLES);const W=v.constantOr(null);for(const ne of a){const V=t.getTile(ne);if(S&&!V.patternsLoaded())continue;const ie=V.getBucket(n);if(!ie)continue;const ae=ie.programConfigurations.get(n.id),fe=o.useProgram(O,ae),_e=o.style.map.terrain&&o.style.map.terrain.getTerrainData(ne);S&&(o.context.activeTexture.set(y.TEXTURE0),V.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),ae.updatePaintBuffers(T)),qa(ae,_,W,V,n);const xe=_e?ne:null,ge=o.translatePosMatrix(xe?xe.posMatrix:ne.posMatrix,V,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));if(m){B=ie.indexBuffer2,$=ie.segments2;const ke=[y.drawingBufferWidth,y.drawingBufferHeight];R=O==="fillOutlinePattern"&&S?jo(ge,o,T,V,ke):ic(ge,ke)}else B=ie.indexBuffer,$=ie.segments,R=S?Aa(ge,o,T,V):$o(ge);fe.draw(o.context,L,c,o.stencilModeForClipping(ne),p,wt.disabled,R,_e,n.id,ie.layoutVertexBuffer,B,$,n.paint,o.transform.zoom,ae)}}function ns(o,t,n,a,c,p,m){const y=o.context,_=y.gl,v="fill-extrusion-pattern",S=n.paint.get(v),T=S.constantOr(1),L=n.getCrossfadeParameters(),O=n.paint.get("fill-extrusion-opacity"),R=S.constantOr(null);for(const B of a){const $=t.getTile(B),W=$.getBucket(n);if(!W)continue;const ne=o.style.map.terrain&&o.style.map.terrain.getTerrainData(B),V=W.programConfigurations.get(n.id),ie=o.useProgram(T?"fillExtrusionPattern":"fillExtrusion",V);T&&(o.context.activeTexture.set(_.TEXTURE0),$.imageAtlasTexture.bind(_.LINEAR,_.CLAMP_TO_EDGE),V.updatePaintBuffers(L)),qa(V,v,R,$,n);const ae=o.translatePosMatrix(B.posMatrix,$,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),fe=n.paint.get("fill-extrusion-vertical-gradient"),_e=T?Ia(ae,o,fe,O,B,L,$):Vo(ae,o,fe,O);ie.draw(y,y.gl.TRIANGLES,c,p,m,wt.backCCW,_e,ne,n.id,W.layoutVertexBuffer,W.indexBuffer,W.segments,n.paint,o.transform.zoom,V,o.style.map.terrain&&W.centroidVertexBuffer)}}function fc(o,t,n,a,c,p,m){const y=o.context,_=y.gl,v=n.fbo;if(!v)return;const S=o.useProgram("hillshade"),T=o.style.map.terrain&&o.style.map.terrain.getTerrainData(t);y.activeTexture.set(_.TEXTURE0),_.bindTexture(_.TEXTURE_2D,v.colorAttachment.get()),S.draw(y,_.TRIANGLES,c,p,m,wt.disabled,((L,O,R,B)=>{const $=R.paint.get("hillshade-shadow-color"),W=R.paint.get("hillshade-highlight-color"),ne=R.paint.get("hillshade-accent-color");let V=R.paint.get("hillshade-illumination-direction")*(Math.PI/180);R.paint.get("hillshade-illumination-anchor")==="viewport"&&(V-=L.transform.angle);const ie=!L.options.moving;return{u_matrix:B?B.posMatrix:L.transform.calculatePosMatrix(O.tileID.toUnwrapped(),ie),u_image:0,u_latrange:Go(0,O.tileID),u_light:[R.paint.get("hillshade-exaggeration"),V],u_shadow:$,u_highlight:W,u_accent:ne}})(o,n,a,T?t:null),T,a.id,o.rasterBoundsBuffer,o.quadTriangleIndexBuffer,o.rasterBoundsSegments)}function il(o,t,n,a,c,p){const m=o.context,y=m.gl,_=t.dem;if(_&&_.data){const v=_.dim,S=_.stride,T=_.getPixels();if(m.activeTexture.set(y.TEXTURE1),m.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||o.getTileTexture(S),t.demTexture){const O=t.demTexture;O.update(T,{premultiply:!1}),O.bind(y.NEAREST,y.CLAMP_TO_EDGE)}else t.demTexture=new yt(m,T,y.RGBA,{premultiply:!1}),t.demTexture.bind(y.NEAREST,y.CLAMP_TO_EDGE);m.activeTexture.set(y.TEXTURE0);let L=t.fbo;if(!L){const O=new yt(m,{width:v,height:v,data:null},y.RGBA);O.bind(y.LINEAR,y.CLAMP_TO_EDGE),L=t.fbo=m.createFramebuffer(v,v,!0,!1),L.colorAttachment.set(O.texture)}m.bindFramebuffer.set(L.framebuffer),m.viewport.set([0,0,v,v]),o.useProgram("hillshadePrepare").draw(m,y.TRIANGLES,a,c,p,wt.disabled,((O,R)=>{const B=R.stride,$=h.create();return h.ortho($,0,h.EXTENT,-h.EXTENT,0,0,1),h.translate($,$,[0,-h.EXTENT,0]),{u_matrix:$,u_image:1,u_dimension:[B,B],u_zoom:O.overscaledZ,u_unpack:R.getUnpackVector()}})(t.tileID,_),null,n.id,o.rasterBoundsBuffer,o.quadTriangleIndexBuffer,o.rasterBoundsSegments),t.needsHillshadePrepare=!1}}function Ut(o,t,n,a,c,p){const m=a.paint.get("raster-fade-duration");if(!p&&m>0){const y=h.exported.now(),_=(y-o.timeAdded)/m,v=t?(y-t.timeAdded)/m:-1,S=n.getSource(),T=c.coveringZoomLevel({tileSize:S.tileSize,roundZoom:S.roundZoom}),L=!t||Math.abs(t.tileID.overscaledZ-T)>Math.abs(o.tileID.overscaledZ-T),O=L&&o.refreshedUponExpiration?1:h.clamp(L?_:1-v,0,1);return o.refreshedUponExpiration&&_>=1&&(o.refreshedUponExpiration=!1),t?{opacity:1,mix:1-O}:{opacity:O,mix:0}}return{opacity:1,mix:0}}const cn=new h.Color(1,0,0,1),Hi=new h.Color(0,1,0,1),rl=new h.Color(0,0,1,1),Ga=new h.Color(1,0,1,1),nl=new h.Color(0,1,1,1);function hn(o,t,n,a){Fn(o,0,t+n/2,o.transform.width,n,a)}function ss(o,t,n,a){Fn(o,t-n/2,0,n,o.transform.height,a)}function Fn(o,t,n,a,c,p){const m=o.context,y=m.gl;y.enable(y.SCISSOR_TEST),y.scissor(t*o.pixelRatio,n*o.pixelRatio,a*o.pixelRatio,c*o.pixelRatio),m.clear({color:p}),y.disable(y.SCISSOR_TEST)}function sl(o,t,n){const a=o.context,c=a.gl,p=n.posMatrix,m=o.useProgram("debug"),y=ot.disabled,_=St.disabled,v=o.colorModeForRenderPass(),S="$debug",T=o.style.map.terrain&&o.style.map.terrain.getTerrainData(n);a.activeTexture.set(c.TEXTURE0);const L=t.getTileByID(n.key).latestRawTileData,O=Math.floor((L&&L.byteLength||0)/1024),R=t.getTile(n).tileSize,B=512/Math.min(R,512)*(n.overscaledZ/o.transform.zoom)*.5;let $=n.canonical.toString();n.overscaledZ!==n.canonical.z&&($+=` => ${n.overscaledZ}`),function(W,ne){W.initDebugOverlayCanvas();const V=W.debugOverlayCanvas,ie=W.context.gl,ae=W.debugOverlayCanvas.getContext("2d");ae.clearRect(0,0,V.width,V.height),ae.shadowColor="white",ae.shadowBlur=2,ae.lineWidth=1.5,ae.strokeStyle="white",ae.textBaseline="top",ae.font="bold 36px Open Sans, sans-serif",ae.fillText(ne,5,5),ae.strokeText(ne,5,5),W.debugOverlayTexture.update(V),W.debugOverlayTexture.bind(ie.LINEAR,ie.CLAMP_TO_EDGE)}(o,`${$} ${O}kB`),m.draw(a,c.TRIANGLES,y,_,Lt.alphaBlended,wt.disabled,Pa(p,h.Color.transparent,B),null,S,o.debugBuffer,o.quadTriangleIndexBuffer,o.debugSegments),m.draw(a,c.LINE_STRIP,y,_,v,wt.disabled,Pa(p,h.Color.red),T,S,o.debugBuffer,o.tileBorderIndexBuffer,o.debugSegments)}function Za(o,t,n){const a=o.context,c=a.gl,p=o.colorModeForRenderPass(),m=new ot(c.LEQUAL,ot.ReadWrite,o.depthRangeFor3D),y=o.useProgram("terrain"),_=t.getTerrainMesh();a.bindFramebuffer.set(null),a.viewport.set([0,0,o.width,o.height]);for(const v of n){const S=o.renderToTexture.getTexture(v),T=t.getTerrainData(v.tileID);a.activeTexture.set(c.TEXTURE0),c.bindTexture(c.TEXTURE_2D,S.texture);const L={u_matrix:o.transform.calculatePosMatrix(v.tileID.toUnwrapped()),u_texture:0,u_ele_delta:t.getMeshFrameDelta(o.transform.zoom)};y.draw(a,c.TRIANGLES,m,St.disabled,p,wt.backCCW,L,T,"terrain",_.vertexBuffer,_.indexBuffer,_.segments)}}const Xa={symbol:function(o,t,n,a,c){if(o.renderPass!=="translucent")return;const p=St.disabled,m=o.colorModeForRenderPass();n.layout.get("text-variable-anchor")&&function(y,_,v,S,T,L,O){const R=_.transform,B=T==="map",$=L==="map";for(const W of y){const ne=S.getTile(W),V=ne.getBucket(v);if(!V||!V.text||!V.text.segments.get().length)continue;const ie=h.evaluateSizeForZoom(V.textSizeData,R.zoom),ae=X(ne,1,_.transform.zoom),fe=et(W.posMatrix,$,B,_.transform,ae),_e=v.layout.get("icon-text-fit")!=="none"&&V.hasIconData();if(ie){const xe=Math.pow(2,R.zoom-ne.tileID.overscaledZ);tl(V,B,$,O,R,fe,W.posMatrix,xe,ie,_e,_.style.map.terrain?(ge,ke)=>_.style.map.terrain.getElevation(W,ge,ke):null)}}}(a,o,n,t,n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),c),n.paint.get("icon-opacity").constantOr(1)!==0&&Vs(o,t,n,a,!1,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),n.layout.get("icon-rotation-alignment"),n.layout.get("icon-pitch-alignment"),n.layout.get("icon-keep-upright"),p,m),n.paint.get("text-opacity").constantOr(1)!==0&&Vs(o,t,n,a,!0,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),n.layout.get("text-keep-upright"),p,m),t.map.showCollisionBoxes&&(el(o,t,n,a,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),!0),el(o,t,n,a,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),!1))},circle:function(o,t,n,a){if(o.renderPass!=="translucent")return;const c=n.paint.get("circle-opacity"),p=n.paint.get("circle-stroke-width"),m=n.paint.get("circle-stroke-opacity"),y=!n.layout.get("circle-sort-key").isConstant();if(c.constantOr(1)===0&&(p.constantOr(1)===0||m.constantOr(1)===0))return;const _=o.context,v=_.gl,S=o.depthModeForSublayer(0,ot.ReadOnly),T=St.disabled,L=o.colorModeForRenderPass(),O=[];for(let R=0;R<a.length;R++){const B=a[R],$=t.getTile(B),W=$.getBucket(n);if(!W)continue;const ne=W.programConfigurations.get(n.id),V=o.useProgram("circle",ne),ie=W.layoutVertexBuffer,ae=W.indexBuffer,fe=o.style.map.terrain&&o.style.map.terrain.getTerrainData(B),_e={programConfiguration:ne,program:V,layoutVertexBuffer:ie,indexBuffer:ae,uniformValues:rc(o,B,$,n),terrainData:fe};if(y){const xe=W.segments.get();for(const ge of xe)O.push({segments:new h.SegmentVector([ge]),sortKey:ge.sortKey,state:_e})}else O.push({segments:W.segments,sortKey:0,state:_e})}y&&O.sort((R,B)=>R.sortKey-B.sortKey);for(const R of O){const{programConfiguration:B,program:$,layoutVertexBuffer:W,indexBuffer:ne,uniformValues:V,terrainData:ie}=R.state;$.draw(_,v.TRIANGLES,S,T,L,wt.disabled,V,ie,n.id,W,ne,R.segments,n.paint,o.transform.zoom,B)}},heatmap:function(o,t,n,a){if(n.paint.get("heatmap-opacity")!==0)if(o.renderPass==="offscreen"){const c=o.context,p=c.gl,m=St.disabled,y=new Lt([p.ONE,p.ONE],h.Color.transparent,[!0,!0,!0,!0]);(function(_,v,S){const T=_.gl;_.activeTexture.set(T.TEXTURE1),_.viewport.set([0,0,v.width/4,v.height/4]);let L=S.heatmapFbo;if(L)T.bindTexture(T.TEXTURE_2D,L.colorAttachment.get()),_.bindFramebuffer.set(L.framebuffer);else{const O=T.createTexture();T.bindTexture(T.TEXTURE_2D,O),T.texParameteri(T.TEXTURE_2D,T.TEXTURE_WRAP_S,T.CLAMP_TO_EDGE),T.texParameteri(T.TEXTURE_2D,T.TEXTURE_WRAP_T,T.CLAMP_TO_EDGE),T.texParameteri(T.TEXTURE_2D,T.TEXTURE_MIN_FILTER,T.LINEAR),T.texParameteri(T.TEXTURE_2D,T.TEXTURE_MAG_FILTER,T.LINEAR),L=S.heatmapFbo=_.createFramebuffer(v.width/4,v.height/4,!1,!1),function(R,B,$,W){var ne,V;const ie=R.gl,ae=(ne=R.HALF_FLOAT)!==null&&ne!==void 0?ne:ie.UNSIGNED_BYTE,fe=(V=R.RGBA16F)!==null&&V!==void 0?V:ie.RGBA;ie.texImage2D(ie.TEXTURE_2D,0,fe,B.width/4,B.height/4,0,ie.RGBA,ae,null),W.colorAttachment.set($)}(_,v,O,L)}})(c,o,n),c.clear({color:h.Color.transparent});for(let _=0;_<a.length;_++){const v=a[_];if(t.hasRenderableParent(v))continue;const S=t.getTile(v),T=S.getBucket(n);if(!T)continue;const L=T.programConfigurations.get(n.id),O=o.useProgram("heatmap",L),{zoom:R}=o.transform;O.draw(c,p.TRIANGLES,ot.disabled,m,y,wt.disabled,qo(v.posMatrix,S,R,n.paint.get("heatmap-intensity")),null,n.id,T.layoutVertexBuffer,T.indexBuffer,T.segments,n.paint,o.transform.zoom,L)}c.viewport.set([0,0,o.width,o.height])}else o.renderPass==="translucent"&&(o.context.setColorMode(o.colorModeForRenderPass()),function(c,p){const m=c.context,y=m.gl,_=p.heatmapFbo;if(!_)return;m.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,_.colorAttachment.get()),m.activeTexture.set(y.TEXTURE1);let v=p.colorRampTexture;v||(v=p.colorRampTexture=new yt(m,p.colorRamp,y.RGBA)),v.bind(y.LINEAR,y.CLAMP_TO_EDGE),c.useProgram("heatmapTexture").draw(m,y.TRIANGLES,ot.disabled,St.disabled,c.colorModeForRenderPass(),wt.disabled,((S,T,L,O)=>{const R=h.create();h.ortho(R,0,S.width,S.height,0,0,1);const B=S.context.gl;return{u_matrix:R,u_world:[B.drawingBufferWidth,B.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:T.paint.get("heatmap-opacity")}})(c,p),null,p.id,c.viewportBuffer,c.quadTriangleIndexBuffer,c.viewportSegments,p.paint,c.transform.zoom)}(o,n))},line:function(o,t,n,a){if(o.renderPass!=="translucent")return;const c=n.paint.get("line-opacity"),p=n.paint.get("line-width");if(c.constantOr(1)===0||p.constantOr(1)===0)return;const m=o.depthModeForSublayer(0,ot.ReadOnly),y=o.colorModeForRenderPass(),_=n.paint.get("line-dasharray"),v=n.paint.get("line-pattern"),S=v.constantOr(1),T=n.paint.get("line-gradient"),L=n.getCrossfadeParameters(),O=S?"linePattern":_?"lineSDF":T?"lineGradient":"line",R=o.context,B=R.gl;let $=!0;for(const W of a){const ne=t.getTile(W);if(S&&!ne.patternsLoaded())continue;const V=ne.getBucket(n);if(!V)continue;const ie=V.programConfigurations.get(n.id),ae=o.context.program.get(),fe=o.useProgram(O,ie),_e=$||fe.program!==ae,xe=o.style.map.terrain&&o.style.map.terrain.getTerrainData(W),ge=v.constantOr(null);if(ge&&ne.imageAtlas){const Qe=ne.imageAtlas,Se=Qe.patternPositions[ge.to.toString()],Ze=Qe.patternPositions[ge.from.toString()];Se&&Ze&&ie.setConstantPatternPositions(Se,Ze)}const ke=xe?W:null,Ve=S?Wi(o,ne,n,L,ke):_?Ps(o,ne,n,_,L,ke):T?Cs(o,ne,n,V.lineClipsArray.length,ke):Mr(o,ne,n,ke);if(S)R.activeTexture.set(B.TEXTURE0),ne.imageAtlasTexture.bind(B.LINEAR,B.CLAMP_TO_EDGE),ie.updatePaintBuffers(L);else if(_&&(_e||o.lineAtlas.dirty))R.activeTexture.set(B.TEXTURE0),o.lineAtlas.bind(R);else if(T){const Qe=V.gradients[n.id];let Se=Qe.texture;if(n.gradientVersion!==Qe.version){let Ze=256;if(n.stepInterpolant){const Le=t.getSource().maxzoom,dt=W.canonical.z===Le?Math.ceil(1<<o.transform.maxZoom-W.canonical.z):1;Ze=h.clamp(h.nextPowerOfTwo(V.maxLineLength/h.EXTENT*1024*dt),256,R.maxTextureSize)}Qe.gradient=h.renderColorRamp({expression:n.gradientExpression(),evaluationKey:"lineProgress",resolution:Ze,image:Qe.gradient||void 0,clips:V.lineClipsArray}),Qe.texture?Qe.texture.update(Qe.gradient):Qe.texture=new yt(R,Qe.gradient,B.RGBA),Qe.version=n.gradientVersion,Se=Qe.texture}R.activeTexture.set(B.TEXTURE0),Se.bind(n.stepInterpolant?B.NEAREST:B.LINEAR,B.CLAMP_TO_EDGE)}fe.draw(R,B.TRIANGLES,m,o.stencilModeForClipping(W),y,wt.disabled,Ve,xe,n.id,V.layoutVertexBuffer,V.indexBuffer,V.segments,n.paint,o.transform.zoom,ie,V.layoutVertexBuffer2),$=!1}},fill:function(o,t,n,a){const c=n.paint.get("fill-color"),p=n.paint.get("fill-opacity");if(p.constantOr(1)===0)return;const m=o.colorModeForRenderPass(),y=n.paint.get("fill-pattern"),_=o.opaquePassEnabledForLayer()&&!y.constantOr(1)&&c.constantOr(h.Color.transparent).a===1&&p.constantOr(0)===1?"opaque":"translucent";if(o.renderPass===_){const v=o.depthModeForSublayer(1,o.renderPass==="opaque"?ot.ReadWrite:ot.ReadOnly);rs(o,t,n,a,v,m,!1)}if(o.renderPass==="translucent"&&n.paint.get("fill-antialias")){const v=o.depthModeForSublayer(n.getPaintProperty("fill-outline-color")?2:0,ot.ReadOnly);rs(o,t,n,a,v,m,!0)}},"fill-extrusion":function(o,t,n,a){const c=n.paint.get("fill-extrusion-opacity");if(c!==0&&o.renderPass==="translucent"){const p=new ot(o.context.gl.LEQUAL,ot.ReadWrite,o.depthRangeFor3D);if(c!==1||n.paint.get("fill-extrusion-pattern").constantOr(1))ns(o,t,n,a,p,St.disabled,Lt.disabled),ns(o,t,n,a,p,o.stencilModeFor3D(),o.colorModeForRenderPass());else{const m=o.colorModeForRenderPass();ns(o,t,n,a,p,St.disabled,m)}}},hillshade:function(o,t,n,a){if(o.renderPass!=="offscreen"&&o.renderPass!=="translucent")return;const c=o.context,p=o.depthModeForSublayer(0,ot.ReadOnly),m=o.colorModeForRenderPass(),[y,_]=o.renderPass==="translucent"?o.stencilConfigForOverlap(a):[{},a];for(const v of _){const S=t.getTile(v);S.needsHillshadePrepare!==void 0&&S.needsHillshadePrepare&&o.renderPass==="offscreen"?il(o,S,n,p,St.disabled,m):o.renderPass==="translucent"&&fc(o,v,S,n,p,y[v.overscaledZ],m)}c.viewport.set([0,0,o.width,o.height])},raster:function(o,t,n,a){if(o.renderPass!=="translucent"||n.paint.get("raster-opacity")===0||!a.length)return;const c=o.context,p=c.gl,m=t.getSource(),y=o.useProgram("raster"),_=o.colorModeForRenderPass(),[v,S]=m instanceof Zi?[{},a]:o.stencilConfigForOverlap(a),T=S[S.length-1].overscaledZ,L=!o.options.moving;for(const O of S){const R=o.depthModeForSublayer(O.overscaledZ-T,n.paint.get("raster-opacity")===1?ot.ReadWrite:ot.ReadOnly,p.LESS),B=t.getTile(O);B.registerFadeDuration(n.paint.get("raster-fade-duration"));const $=t.findLoadedParent(O,0),W=Ut(B,$,t,n,o.transform,o.style.map.terrain);let ne,V;const ie=n.paint.get("raster-resampling")==="nearest"?p.NEAREST:p.LINEAR;c.activeTexture.set(p.TEXTURE0),B.texture.bind(ie,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST),c.activeTexture.set(p.TEXTURE1),$?($.texture.bind(ie,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST),ne=Math.pow(2,$.tileID.overscaledZ-B.tileID.overscaledZ),V=[B.tileID.canonical.x*ne%1,B.tileID.canonical.y*ne%1]):B.texture.bind(ie,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST);const ae=o.style.map.terrain&&o.style.map.terrain.getTerrainData(O),fe=ae?O:null,_e=fe?fe.posMatrix:o.transform.calculatePosMatrix(O.toUnwrapped(),L),xe=Ms(_e,V||[0,0],ne||1,W,n);m instanceof Zi?y.draw(c,p.TRIANGLES,R,St.disabled,_,wt.disabled,xe,ae,n.id,m.boundsBuffer,o.quadTriangleIndexBuffer,m.boundsSegments):y.draw(c,p.TRIANGLES,R,v[O.overscaledZ],_,wt.disabled,xe,ae,n.id,o.rasterBoundsBuffer,o.quadTriangleIndexBuffer,o.rasterBoundsSegments)}},background:function(o,t,n,a){const c=n.paint.get("background-color"),p=n.paint.get("background-opacity");if(p===0)return;const m=o.context,y=m.gl,_=o.transform,v=_.tileSize,S=n.paint.get("background-pattern");if(o.isPatternMissing(S))return;const T=!S&&c.a===1&&p===1&&o.opaquePassEnabledForLayer()?"opaque":"translucent";if(o.renderPass!==T)return;const L=St.disabled,O=o.depthModeForSublayer(0,T==="opaque"?ot.ReadWrite:ot.ReadOnly),R=o.colorModeForRenderPass(),B=o.useProgram(S?"backgroundPattern":"background"),$=a||_.coveringTiles({tileSize:v,terrain:o.style.map.terrain});S&&(m.activeTexture.set(y.TEXTURE0),o.imageManager.bind(o.context));const W=n.getCrossfadeParameters();for(const ne of $){const V=a?ne.posMatrix:o.transform.calculatePosMatrix(ne.toUnwrapped()),ie=S?Di(V,p,o,S,{tileID:ne,tileSize:v},W):zi(V,p,c),ae=o.style.map.terrain&&o.style.map.terrain.getTerrainData(ne);B.draw(m,y.TRIANGLES,O,L,R,wt.disabled,ie,ae,n.id,o.tileExtentBuffer,o.quadTriangleIndexBuffer,o.tileExtentSegments)}},debug:function(o,t,n){for(let a=0;a<n.length;a++)sl(o,t,n[a])},custom:function(o,t,n){const a=o.context,c=n.implementation;if(o.renderPass==="offscreen"){const p=c.prerender;p&&(o.setCustomLayerDefaults(),a.setColorMode(o.colorModeForRenderPass()),p.call(c,a.gl,o.transform.customLayerMatrix()),a.setDirty(),o.setBaseState())}else if(o.renderPass==="translucent"){o.setCustomLayerDefaults(),a.setColorMode(o.colorModeForRenderPass()),a.setStencilMode(St.disabled);const p=c.renderingMode==="3d"?new ot(o.context.gl.LEQUAL,ot.ReadWrite,o.depthRangeFor3D):o.depthModeForSublayer(0,ot.ReadOnly);a.setDepthMode(p),c.render(a.gl,o.transform.customLayerMatrix()),a.setDirty(),o.setBaseState(),a.bindFramebuffer.set(null)}}};class al{constructor(t,n){this.context=new Va(t),this.transform=n,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:h.create(),renderTime:0},this.setup(),this.numSublayers=jt.maxUnderzooming+jt.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Gr}resize(t,n,a){if(this.width=t*a,this.height=n*a,this.pixelRatio=a,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const c of this.style._order)this.style._layers[c].resize()}setup(){const t=this.context,n=new h.PosArray;n.emplaceBack(0,0),n.emplaceBack(h.EXTENT,0),n.emplaceBack(0,h.EXTENT),n.emplaceBack(h.EXTENT,h.EXTENT),this.tileExtentBuffer=t.createVertexBuffer(n,Ea.members),this.tileExtentSegments=h.SegmentVector.simpleSegment(0,0,4,2);const a=new h.PosArray;a.emplaceBack(0,0),a.emplaceBack(h.EXTENT,0),a.emplaceBack(0,h.EXTENT),a.emplaceBack(h.EXTENT,h.EXTENT),this.debugBuffer=t.createVertexBuffer(a,Ea.members),this.debugSegments=h.SegmentVector.simpleSegment(0,0,4,5);const c=new h.RasterBoundsArray;c.emplaceBack(0,0,0,0),c.emplaceBack(h.EXTENT,0,h.EXTENT,0),c.emplaceBack(0,h.EXTENT,0,h.EXTENT),c.emplaceBack(h.EXTENT,h.EXTENT,h.EXTENT,h.EXTENT),this.rasterBoundsBuffer=t.createVertexBuffer(c,Ir.members),this.rasterBoundsSegments=h.SegmentVector.simpleSegment(0,0,4,2);const p=new h.PosArray;p.emplaceBack(0,0),p.emplaceBack(1,0),p.emplaceBack(0,1),p.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(p,Ea.members),this.viewportSegments=h.SegmentVector.simpleSegment(0,0,4,2);const m=new h.LineStripIndexArray;m.emplaceBack(0),m.emplaceBack(1),m.emplaceBack(3),m.emplaceBack(2),m.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(m);const y=new h.TriangleIndexArray;y.emplaceBack(0,1,2),y.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(y);const _=this.context.gl;this.stencilClearMode=new St({func:_.ALWAYS,mask:0},0,255,_.ZERO,_.ZERO,_.ZERO)}clearStencil(){const t=this.context,n=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const a=h.create();h.ortho(a,0,this.width,this.height,0,0,1),h.scale(a,a,[n.drawingBufferWidth,n.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(t,n.TRIANGLES,ot.disabled,this.stencilClearMode,Lt.disabled,wt.disabled,Ma(a),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,n){if(this.currentStencilSource===t.source||!t.isTileClipped()||!n||!n.length)return;this.currentStencilSource=t.source;const a=this.context,c=a.gl;this.nextStencilID+n.length>256&&this.clearStencil(),a.setColorMode(Lt.disabled),a.setDepthMode(ot.disabled);const p=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const m of n){const y=this._tileClippingMaskIDs[m.key]=this.nextStencilID++,_=this.style.map.terrain&&this.style.map.terrain.getTerrainData(m);p.draw(a,c.TRIANGLES,ot.disabled,new St({func:c.ALWAYS,mask:0},y,255,c.KEEP,c.KEEP,c.REPLACE),Lt.disabled,wt.disabled,Ma(m.posMatrix),_,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,n=this.context.gl;return new St({func:n.NOTEQUAL,mask:255},t,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(t){const n=this.context.gl;return new St({func:n.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,n.KEEP,n.KEEP,n.REPLACE)}stencilConfigForOverlap(t){const n=this.context.gl,a=t.sort((m,y)=>y.overscaledZ-m.overscaledZ),c=a[a.length-1].overscaledZ,p=a[0].overscaledZ-c+1;if(p>1){this.currentStencilSource=void 0,this.nextStencilID+p>256&&this.clearStencil();const m={};for(let y=0;y<p;y++)m[y+c]=new St({func:n.GEQUAL,mask:255},y+this.nextStencilID,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID+=p,[m,a]}return[{[c]:St.disabled},a]}colorModeForRenderPass(){const t=this.context.gl;return this._showOverdrawInspector?new Lt([t.CONSTANT_COLOR,t.ONE],new h.Color(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Lt.unblended:Lt.alphaBlended}depthModeForSublayer(t,n,a){if(!this.opaquePassEnabledForLayer())return ot.disabled;const c=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new ot(a||this.context.gl.LEQUAL,n,[c,c])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(t,n){this.style=t,this.options=n,this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(h.exported.now()),this.imageManager.beginFrame();const a=this.style._order,c=this.style.sourceCaches,p={},m={},y={};for(const _ in c){const v=c[_];v.used&&v.prepare(this.context),p[_]=v.getVisibleCoordinates(),m[_]=p[_].slice().reverse(),y[_]=v.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let _=0;_<a.length;_++)if(this.style._layers[a[_]].is3D()){this.opaquePassCutoff=_;break}if(this.renderToTexture){this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0;const _=this.style.map.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime);(this.terrainFacilitator.dirty||!h.equals(this.terrainFacilitator.matrix,this.transform.projMatrix)||_.length)&&(h.copy(this.terrainFacilitator.matrix,this.transform.projMatrix),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(v,S){const T=v.context,L=T.gl,O=Lt.unblended,R=new ot(L.LEQUAL,ot.ReadWrite,[0,1]),B=S.getTerrainMesh(),$=S.sourceCache.getRenderableTiles(),W=v.useProgram("terrainDepth");T.bindFramebuffer.set(S.getFramebuffer("depth").framebuffer),T.viewport.set([0,0,v.width/devicePixelRatio,v.height/devicePixelRatio]),T.clear({color:h.Color.transparent,depth:1});for(const ne of $){const V=S.getTerrainData(ne.tileID),ie={u_matrix:v.transform.calculatePosMatrix(ne.tileID.toUnwrapped()),u_ele_delta:S.getMeshFrameDelta(v.transform.zoom)};W.draw(T,L.TRIANGLES,R,St.disabled,O,wt.backCCW,ie,V,"terrain",B.vertexBuffer,B.indexBuffer,B.segments)}T.bindFramebuffer.set(null),T.viewport.set([0,0,v.width,v.height])}(this,this.style.map.terrain),function(v,S){const T=v.context,L=T.gl,O=Lt.unblended,R=new ot(L.LEQUAL,ot.ReadWrite,[0,1]),B=S.getTerrainMesh(),$=S.getCoordsTexture(),W=S.sourceCache.getRenderableTiles(),ne=v.useProgram("terrainCoords");T.bindFramebuffer.set(S.getFramebuffer("coords").framebuffer),T.viewport.set([0,0,v.width/devicePixelRatio,v.height/devicePixelRatio]),T.clear({color:h.Color.transparent,depth:1}),S.coordsIndex=[];for(const V of W){const ie=S.getTerrainData(V.tileID);T.activeTexture.set(L.TEXTURE0),L.bindTexture(L.TEXTURE_2D,$.texture);const ae={u_matrix:v.transform.calculatePosMatrix(V.tileID.toUnwrapped()),u_terrain_coords_id:(255-S.coordsIndex.length)/255,u_texture:0,u_ele_delta:S.getMeshFrameDelta(v.transform.zoom)};ne.draw(T,L.TRIANGLES,R,St.disabled,O,wt.backCCW,ae,ie,"terrain",B.vertexBuffer,B.indexBuffer,B.segments),S.coordsIndex.push(V.tileID.key)}T.bindFramebuffer.set(null),T.viewport.set([0,0,v.width,v.height])}(this,this.style.map.terrain))}this.renderPass="offscreen";for(const _ of a){const v=this.style._layers[_];if(!v.hasOffscreenPass()||v.isHidden(this.transform.zoom))continue;const S=m[v.source];(v.type==="custom"||S.length)&&this.renderLayer(this,c[v.source],v,S)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:n.showOverdrawInspector?h.Color.black:h.Color.transparent,depth:1}),this.clearStencil(),this._showOverdrawInspector=n.showOverdrawInspector,this.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=a.length-1;this.currentLayer>=0;this.currentLayer--){const _=this.style._layers[a[this.currentLayer]],v=c[_.source],S=p[_.source];this._renderTileClippingMasks(_,S),this.renderLayer(this,v,_,S)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<a.length;this.currentLayer++){const _=this.style._layers[a[this.currentLayer]],v=c[_.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(_))continue;const S=(_.type==="symbol"?y:m)[_.source];this._renderTileClippingMasks(_,p[_.source]),this.renderLayer(this,v,_,S)}if(this.options.showTileBoundaries){const _=function(v,S){let T=null;const L=Object.values(v._layers).flatMap($=>$.source&&!$.isHidden(S)?[v.sourceCaches[$.source]]:[]),O=L.filter($=>$.getSource().type==="vector"),R=L.filter($=>$.getSource().type!=="vector"),B=$=>{(!T||T.getSource().maxzoom<$.getSource().maxzoom)&&(T=$)};return O.forEach($=>B($)),T||R.forEach($=>B($)),T}(this.style,this.transform.zoom);_&&Xa.debug(this,_,_.getVisibleCoordinates())}this.options.showPadding&&function(_){const v=_.transform.padding;hn(_,_.transform.height-(v.top||0),3,cn),hn(_,v.bottom||0,3,Hi),ss(_,v.left||0,3,rl),ss(_,_.transform.width-(v.right||0),3,Ga);const S=_.transform.centerPoint;(function(T,L,O,R){Fn(T,L-1,O-10,2,20,R),Fn(T,L-10,O-1,20,2,R)})(_,S.x,_.transform.height-S.y,nl)}(this),this.context.setDefault()}renderLayer(t,n,a,c){a.isHidden(this.transform.zoom)||(a.type==="background"||a.type==="custom"||(c||[]).length)&&(this.id=a.id,Xa[a.type](t,n,a,c,this.style.placement.variableOffsets))}translatePosMatrix(t,n,a,c,p){if(!a[0]&&!a[1])return t;const m=p?c==="map"?this.transform.angle:0:c==="viewport"?-this.transform.angle:0;if(m){const v=Math.sin(m),S=Math.cos(m);a=[a[0]*S-a[1]*v,a[0]*v+a[1]*S]}const y=[p?a[0]:X(n,a[0],this.transform.zoom),p?a[1]:X(n,a[1],this.transform.zoom),0],_=new Float32Array(16);return h.translate(_,t,y),_}saveTileTexture(t){const n=this._tileTextures[t.size[0]];n?n.push(t):this._tileTextures[t.size[0]]=[t]}getTileTexture(t){const n=this._tileTextures[t];return n&&n.length>0?n.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;const n=this.imageManager.getPattern(t.from.toString()),a=this.imageManager.getPattern(t.to.toString());return!n||!a}useProgram(t,n){this.cache=this.cache||{};const a=t+(n?n.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[a]||(this.cache[a]=new As(this.context,t,Zr[t],n,ka[t],this._showOverdrawInspector,this.style.map.terrain)),this.cache[a]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new yt(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}}class $s{constructor(t,n){this.points=t,this.planes=n}static fromInvProjectionMatrix(t,n,a){const c=Math.pow(2,a),p=[[-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(y=>{const _=1/(y=h.transformMat4([],y,t))[3]/n*c;return h.mul$1(y,y,[_,_,1/y[3],_])}),m=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(y=>{const _=function(L,O){var R=O[0],B=O[1],$=O[2],W=R*R+B*B+$*$;return W>0&&(W=1/Math.sqrt(W)),L[0]=O[0]*W,L[1]=O[1]*W,L[2]=O[2]*W,L}([],function(L,O,R){var B=O[0],$=O[1],W=O[2],ne=R[0],V=R[1],ie=R[2];return L[0]=$*ie-W*V,L[1]=W*ne-B*ie,L[2]=B*V-$*ne,L}([],vn([],p[y[0]],p[y[1]]),vn([],p[y[2]],p[y[1]]))),v=-((S=_)[0]*(T=p[y[1]])[0]+S[1]*T[1]+S[2]*T[2]);var S,T;return _.concat(v)});return new $s(p,m)}}class pr{constructor(t,n){this.min=t,this.max=n,this.center=function(a,c,p){return a[0]=.5*c[0],a[1]=.5*c[1],a[2]=.5*c[2],a}([],function(a,c,p){return a[0]=c[0]+p[0],a[1]=c[1]+p[1],a[2]=c[2]+p[2],a}([],this.min,this.max))}quadrant(t){const n=[t%2==0,t<2],a=Xn(this.min),c=Xn(this.max);for(let p=0;p<n.length;p++)a[p]=n[p]?this.min[p]:this.center[p],c[p]=n[p]?this.center[p]:this.max[p];return c[2]=this.max[2],new pr(a,c)}distanceX(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]}distanceY(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]}intersects(t){const 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]];let a=!0;for(let c=0;c<t.planes.length;c++){const p=t.planes[c];let m=0;for(let y=0;y<n.length;y++)h.dot(p,n[y])>=0&&m++;if(m===0)return 0;m!==n.length&&(a=!1)}if(a)return 2;for(let c=0;c<3;c++){let p=Number.MAX_VALUE,m=-Number.MAX_VALUE;for(let y=0;y<t.points.length;y++){const _=t.points[y][c]-this.min[c];p=Math.min(p,_),m=Math.max(m,_)}if(m<0||p>this.max[c]-this.min[c])return 0}return 1}}class js{constructor(t=0,n=0,a=0,c=0){if(isNaN(t)||t<0||isNaN(n)||n<0||isNaN(a)||a<0||isNaN(c)||c<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=n,this.left=a,this.right=c}interpolate(t,n,a){return n.top!=null&&t.top!=null&&(this.top=h.interpolate.number(t.top,n.top,a)),n.bottom!=null&&t.bottom!=null&&(this.bottom=h.interpolate.number(t.bottom,n.bottom,a)),n.left!=null&&t.left!=null&&(this.left=h.interpolate.number(t.left,n.left,a)),n.right!=null&&t.right!=null&&(this.right=h.interpolate.number(t.right,n.right,a)),this}getCenter(t,n){const a=h.clamp((this.left+t-this.right)/2,0,t),c=h.clamp((this.top+n-this.bottom)/2,0,n);return new h.Point(a,c)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new js(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class qs{constructor(t,n,a,c,p){this.tileSize=512,this.maxValidLatitude=85.051129,this.freezeElevation=!1,this._renderWorldCopies=p===void 0||!!p,this._minZoom=t||0,this._maxZoom=n||22,this._minPitch=a??0,this._maxPitch=c??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new h.LngLat(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new js,this._posMatrixCache={},this._alignedPosMatrixCache={}}clone(){const t=new qs(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.apply(this),t}apply(t){this.tileSize=t.tileSize,this.latRange=t.latRange,this.width=t.width,this.height=t.height,this._center=t._center,this._elevation=t._elevation,this.zoom=t.zoom,this.angle=t.angle,this._fov=t._fov,this._pitch=t._pitch,this._unmodified=t._unmodified,this._edgeInsets=t._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(t){t===void 0?t=!0:t===null&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new h.Point(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(t){const n=-h.wrap(t,-180,180)*Math.PI/180;this.angle!==n&&(this._unmodified=!1,this.angle=n,this._calcMatrices(),this.rotationMatrix=function(){var a=new h.ARRAY_TYPE(4);return h.ARRAY_TYPE!=Float32Array&&(a[1]=0,a[2]=0),a[0]=1,a[3]=1,a}(),function(a,c,p){var m=c[0],y=c[1],_=c[2],v=c[3],S=Math.sin(p),T=Math.cos(p);a[0]=m*T+_*S,a[1]=y*T+v*S,a[2]=m*-S+_*T,a[3]=y*-S+v*T}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const n=h.clamp(t,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(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(t){const n=Math.min(Math.max(t,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(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(t){t!==this._elevation&&(this._elevation=t,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,n,a){this._unmodified=!1,this._edgeInsets.interpolate(t,n,a),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const n=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,n)}getVisibleUnwrappedCoordinates(t){const n=[new h.UnwrappedTileID(0,t)];if(this._renderWorldCopies){const a=this.pointCoordinate(new h.Point(0,0)),c=this.pointCoordinate(new h.Point(this.width,0)),p=this.pointCoordinate(new h.Point(this.width,this.height)),m=this.pointCoordinate(new h.Point(0,this.height)),y=Math.floor(Math.min(a.x,c.x,p.x,m.x)),_=Math.floor(Math.max(a.x,c.x,p.x,m.x)),v=1;for(let S=y-v;S<=_+v;S++)S!==0&&n.push(new h.UnwrappedTileID(S,t))}return n}coveringTiles(t){var n,a;let c=this.coveringZoomLevel(t);const p=c;if(t.minzoom!==void 0&&c<t.minzoom)return[];t.maxzoom!==void 0&&c>t.maxzoom&&(c=t.maxzoom);const m=this.pointCoordinate(this.getCameraPoint()),y=h.MercatorCoordinate.fromLngLat(this.center),_=Math.pow(2,c),v=[_*m.x,_*m.y,0],S=[_*y.x,_*y.y,0],T=$s.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,c);let L=t.minzoom||0;!t.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(L=c);const O=t.terrain?2/Math.min(this.tileSize,t.tileSize)*this.tileSize:3,R=V=>({aabb:new pr([V*_,0,0],[(V+1)*_,_,0]),zoom:0,x:0,y:0,wrap:V,fullyVisible:!1}),B=[],$=[],W=c,ne=t.reparseOverscaled?p:c;if(this._renderWorldCopies)for(let V=1;V<=3;V++)B.push(R(-V)),B.push(R(V));for(B.push(R(0));B.length>0;){const V=B.pop(),ie=V.x,ae=V.y;let fe=V.fullyVisible;if(!fe){const Ve=V.aabb.intersects(T);if(Ve===0)continue;fe=Ve===2}const _e=t.terrain?v:S,xe=V.aabb.distanceX(_e),ge=V.aabb.distanceY(_e),ke=Math.max(Math.abs(xe),Math.abs(ge));if(V.zoom===W||ke>O+(1<<W-V.zoom)-2&&V.zoom>=L){const Ve=W-V.zoom,Qe=v[0]-.5-(ie<<Ve),Se=v[1]-.5-(ae<<Ve);$.push({tileID:new h.OverscaledTileID(V.zoom===W?ne:V.zoom,V.wrap,V.zoom,ie,ae),distanceSq:Ii([S[0]-.5-ie,S[1]-.5-ae]),tileDistanceToCamera:Math.sqrt(Qe*Qe+Se*Se)})}else for(let Ve=0;Ve<4;Ve++){const Qe=(ie<<1)+Ve%2,Se=(ae<<1)+(Ve>>1),Ze=V.zoom+1;let Le=V.aabb.quadrant(Ve);if(t.terrain){const dt=new h.OverscaledTileID(Ze,V.wrap,Ze,Qe,Se),Nt=t.terrain.getMinMaxElevation(dt),pt=(n=Nt.minElevation)!==null&&n!==void 0?n:this.elevation,tt=(a=Nt.maxElevation)!==null&&a!==void 0?a:this.elevation;Le=new pr([Le.min[0],Le.min[1],pt],[Le.max[0],Le.max[1],tt])}B.push({aabb:Le,zoom:Ze,x:Qe,y:Se,wrap:V.wrap,fullyVisible:fe})}}return $.sort((V,ie)=>V.distanceSq-ie.distanceSq).map(V=>V.tileID)}resize(t,n){this.width=t,this.height=n,this.pixelsToGLUnits=[2/t,-2/n],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log(t)/Math.LN2}project(t){const n=h.clamp(t.lat,-this.maxValidLatitude,this.maxValidLatitude);return new h.Point(h.mercatorXfromLng(t.lng)*this.worldSize,h.mercatorYfromLat(n)*this.worldSize)}unproject(t){return new h.MercatorCoordinate(t.x/this.worldSize,t.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}updateElevation(t){this.freezeElevation||(this.elevation=t?this.getElevation(this._center,t):0)}getElevation(t,n){const a=h.MercatorCoordinate.fromLngLat(t.wrap()),c=(1<<this.tileZoom)*h.EXTENT,p=a.x*c,m=a.y*c,y=Math.floor(p/h.EXTENT),_=Math.floor(m/h.EXTENT),v=new h.OverscaledTileID(this.tileZoom,0,this.tileZoom,y,_);return n.getElevation(v,p%h.EXTENT,m%h.EXTENT,h.EXTENT)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(t){const n=this.pointLocation(this.centerPoint,t),a=this.getElevation(n,t);if(!(this.elevation-a))return;const c=this.getCameraPosition(),p=h.MercatorCoordinate.fromLngLat(c.lngLat,c.altitude),m=h.MercatorCoordinate.fromLngLat(n,a),y=p.x-m.x,_=p.y-m.y,v=p.z-m.z,S=Math.sqrt(y*y+_*_+v*v),T=this.scaleZoom(this.cameraToCenterDistance/S/this.tileSize);this._elevation=a,this._center=n,this.zoom=T}setLocationAtPoint(t,n){const a=this.pointCoordinate(n),c=this.pointCoordinate(this.centerPoint),p=this.locationCoordinate(t),m=new h.MercatorCoordinate(p.x-(a.x-c.x),p.y-(a.y-c.y));this.center=this.coordinateLocation(m),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(t,n){return n?this.coordinatePoint(this.locationCoordinate(t),this.getElevation(t,n),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(t))}pointLocation(t,n){return this.coordinateLocation(this.pointCoordinate(t,n))}locationCoordinate(t){return h.MercatorCoordinate.fromLngLat(t)}coordinateLocation(t){return t&&t.toLngLat()}pointCoordinate(t,n){if(n){const L=n.pointCoordinate(t);if(L!=null)return L}const a=[t.x,t.y,0,1],c=[t.x,t.y,1,1];h.transformMat4(a,a,this.pixelMatrixInverse),h.transformMat4(c,c,this.pixelMatrixInverse);const p=a[3],m=c[3],y=a[1]/p,_=c[1]/m,v=a[2]/p,S=c[2]/m,T=v===S?0:(0-v)/(S-v);return new h.MercatorCoordinate(h.interpolate.number(a[0]/p,c[0]/m,T)/this.worldSize,h.interpolate.number(y,_,T)/this.worldSize)}coordinatePoint(t,n=0,a=this.pixelMatrix){const c=[t.x*this.worldSize,t.y*this.worldSize,n,1];return h.transformMat4(c,c,a),new h.Point(c[0]/c[3],c[1]/c[3])}getBounds(){const t=Math.max(0,this.height/2-this.getHorizon());return new si().extend(this.pointLocation(new h.Point(0,t))).extend(this.pointLocation(new h.Point(this.width,t))).extend(this.pointLocation(new h.Point(this.width,this.height))).extend(this.pointLocation(new h.Point(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new si([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])}calculatePosMatrix(t,n=!1){const a=t.key,c=n?this._alignedPosMatrixCache:this._posMatrixCache;if(c[a])return c[a];const p=t.canonical,m=this.worldSize/this.zoomScale(p.z),y=p.x+Math.pow(2,p.z)*t.wrap,_=h.identity(new Float64Array(16));return h.translate(_,_,[y*m,p.y*m,0]),h.scale(_,_,[m/h.EXTENT,m/h.EXTENT,1]),h.multiply(_,n?this.alignedProjMatrix:this.projMatrix,_),c[a]=new Float32Array(_),c[a]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let t,n,a,c,p=-90,m=90,y=-180,_=180;const v=this.size,S=this._unmodified;if(this.latRange){const O=this.latRange;p=h.mercatorYfromLat(O[1])*this.worldSize,m=h.mercatorYfromLat(O[0])*this.worldSize,t=m-p<v.y?v.y/(m-p):0}if(this.lngRange){const O=this.lngRange;y=h.wrap(h.mercatorXfromLng(O[0])*this.worldSize,0,this.worldSize),_=h.wrap(h.mercatorXfromLng(O[1])*this.worldSize,0,this.worldSize),_<y&&(_+=this.worldSize),n=_-y<v.x?v.x/(_-y):0}const T=this.point,L=Math.max(n||0,t||0);if(L)return this.center=this.unproject(new h.Point(n?(_+y)/2:T.x,t?(m+p)/2:T.y)),this.zoom+=this.scaleZoom(L),this._unmodified=S,void(this._constraining=!1);if(this.latRange){const O=T.y,R=v.y/2;O-R<p&&(c=p+R),O+R>m&&(c=m-R)}if(this.lngRange){const O=(y+_)/2,R=h.wrap(T.x,O-this.worldSize/2,O+this.worldSize/2),B=v.x/2;R-B<y&&(a=y+B),R+B>_&&(a=_-B)}a===void 0&&c===void 0||(this.center=this.unproject(new h.Point(a!==void 0?a:T.x,c!==void 0?c:T.y)).wrap()),this._unmodified=S,this._constraining=!1}_calcMatrices(){if(!this.height)return;const t=this.centerOffset,n=this.point.x,a=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=h.mercatorZfromAltitude(1,this.center.lat)*this.worldSize;let c=h.identity(new Float64Array(16));h.scale(c,c,[this.width/2,-this.height/2,1]),h.translate(c,c,[1,-1,0]),this.labelPlaneMatrix=c,c=h.identity(new Float64Array(16)),h.scale(c,c,[1,-1,1]),h.translate(c,c,[-1,-1,0]),h.scale(c,c,[2/this.width,2/this.height,1]),this.glCoordMatrix=c,this.cameraToSeaLevelDistance=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch);const p=this._elevation<0?this.cameraToCenterDistance:this.cameraToSeaLevelDistance,m=Math.PI/2+this._pitch,y=this._fov*(.5+t.y/this.height),_=Math.sin(y)*p/Math.sin(h.clamp(Math.PI-m-y,.01,Math.PI-.01)),v=this.getHorizon(),S=2*Math.atan(v/this.cameraToCenterDistance)*(.5+t.y/(2*v)),T=Math.sin(S)*p/Math.sin(h.clamp(Math.PI-m-S,.01,Math.PI-.01)),L=Math.min(_,T),O=1.01*(Math.cos(Math.PI/2-this._pitch)*L+p),R=this.height/50;c=new Float64Array(16),h.perspective(c,this._fov,this.width/this.height,R,O),c[8]=2*-t.x/this.width,c[9]=2*t.y/this.height,h.scale(c,c,[1,-1,1]),h.translate(c,c,[0,0,-this.cameraToCenterDistance]),h.rotateX(c,c,this._pitch),h.rotateZ(c,c,this.angle),h.translate(c,c,[-n,-a,0]),this.mercatorMatrix=h.scale([],c,[this.worldSize,this.worldSize,this.worldSize]),h.scale(c,c,[1,1,this._pixelPerMeter]),this.pixelMatrix=h.multiply(new Float64Array(16),this.labelPlaneMatrix,c),h.translate(c,c,[0,0,-this.elevation]),this.projMatrix=c,this.invProjMatrix=h.invert([],c),this.pixelMatrix3D=h.multiply(new Float64Array(16),this.labelPlaneMatrix,c);const B=this.width%2/2,$=this.height%2/2,W=Math.cos(this.angle),ne=Math.sin(this.angle),V=n-Math.round(n)+W*B+ne*$,ie=a-Math.round(a)+W*$+ne*B,ae=new Float64Array(c);if(h.translate(ae,ae,[V>.5?V-1:V,ie>.5?ie-1:ie,0]),this.alignedProjMatrix=ae,c=h.invert(new Float64Array(16),this.pixelMatrix),!c)throw new Error("failed to invert matrix");this.pixelMatrixInverse=c,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const t=this.pointCoordinate(new h.Point(0,0)),n=[t.x*this.worldSize,t.y*this.worldSize,0,1];return h.transformMat4(n,n,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new h.Point(0,t))}getCameraQueryGeometry(t){const n=this.getCameraPoint();if(t.length===1)return[t[0],n];{let a=n.x,c=n.y,p=n.x,m=n.y;for(const y of t)a=Math.min(a,y.x),c=Math.min(c,y.y),p=Math.max(p,y.x),m=Math.max(m,y.y);return[new h.Point(a,c),new h.Point(p,c),new h.Point(p,m),new h.Point(a,m),new h.Point(a,c)]}}}class ol{constructor(t){this._hashName=t&&encodeURIComponent(t),h.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=function(n,a){let c=!1,p=null;const m=()=>{p=null,c&&(n(),p=setTimeout(m,300),c=!1)};return()=>(c=!0,p||m(),p)}(this._updateHashUnthrottled.bind(this))}addTo(t){return this._map=t,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(t){const n=this._map.getCenter(),a=Math.round(100*this._map.getZoom())/100,c=Math.ceil((a*Math.LN2+Math.log(512/360/.5))/Math.LN10),p=Math.pow(10,c),m=Math.round(n.lng*p)/p,y=Math.round(n.lat*p)/p,_=this._map.getBearing(),v=this._map.getPitch();let S="";if(S+=t?`/${m}/${y}/${a}`:`${a}/${y}/${m}`,(_||v)&&(S+="/"+Math.round(10*_)/10),v&&(S+=`/${Math.round(v)}`),this._hashName){const T=this._hashName;let L=!1;const O=window.location.hash.slice(1).split("&").map(R=>{const B=R.split("=")[0];return B===T?(L=!0,`${B}=${S}`):R}).filter(R=>R);return L||O.push(`${T}=${S}`),`#${O.join("&")}`}return`#${S}`}_getCurrentHash(){const t=window.location.hash.replace("#","");if(this._hashName){let n;return t.split("&").map(a=>a.split("=")).forEach(a=>{a[0]===this._hashName&&(n=a)}),(n&&n[1]||"").split("/")}return t.split("/")}_onHashChange(){const t=this._getCurrentHash();if(t.length>=3&&!t.some(n=>isNaN(n))){const n=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:n,pitch:+(t[4]||0)}),!0}return!1}_updateHashUnthrottled(){const t=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,t)}catch{}}}const as={linearity:.3,easing:h.bezier(0,0,.3,1)},ll=h.extend({deceleration:2500,maxSpeed:1400},as),cl=h.extend({deceleration:20,maxSpeed:1400},as),os=h.extend({deceleration:1e3,maxSpeed:360},as),hl=h.extend({deceleration:1e3,maxSpeed:90},as);class fr{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:h.exported.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,n=h.exported.now();for(;t.length>0&&n-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const n={zoom:0,bearing:0,pitch:0,pan:new h.Point(0,0),pinchAround:void 0,around:void 0};for(const{settings:p}of this._inertiaBuffer)n.zoom+=p.zoomDelta||0,n.bearing+=p.bearingDelta||0,n.pitch+=p.pitchDelta||0,p.panDelta&&n.pan._add(p.panDelta),p.around&&(n.around=p.around),p.pinchAround&&(n.pinchAround=p.pinchAround);const a=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,c={};if(n.pan.mag()){const p=ls(n.pan.mag(),a,h.extend({},ll,t||{}));c.offset=n.pan.mult(p.amount/n.pan.mag()),c.center=this._map.transform.center,Ki(c,p)}if(n.zoom){const p=ls(n.zoom,a,cl);c.zoom=this._map.transform.zoom+p.amount,Ki(c,p)}if(n.bearing){const p=ls(n.bearing,a,os);c.bearing=this._map.transform.bearing+h.clamp(p.amount,-179,179),Ki(c,p)}if(n.pitch){const p=ls(n.pitch,a,hl);c.pitch=this._map.transform.pitch+p.amount,Ki(c,p)}if(c.zoom||c.bearing){const p=n.pinchAround===void 0?n.around:n.pinchAround;c.around=p?this._map.unproject(p):this._map.getCenter()}return this.clear(),h.extend(c,{noMoveStart:!0})}}function Ki(o,t){(!o.duration||o.duration<t.duration)&&(o.duration=t.duration,o.easing=t.easing)}function ls(o,t,n){const{maxSpeed:a,linearity:c,deceleration:p}=n,m=h.clamp(o*c/(t/1e3),-a,a),y=Math.abs(m)/(p*c);return{easing:n.easing,duration:1e3*y,amount:m*(y/2)}}class Zt extends h.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,a,c={}){const p=J.mousePos(n.getCanvasContainer(),a),m=n.unproject(p);super(t,h.extend({point:p,lngLat:m,originalEvent:a},c)),this._defaultPrevented=!1,this.target=n}}class Wr extends h.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,a){const c=t==="touchend"?a.changedTouches:a.touches,p=J.touchPos(n.getCanvasContainer(),c),m=p.map(_=>n.unproject(_)),y=p.reduce((_,v,S,T)=>_.add(v.div(T.length)),new h.Point(0,0));super(t,{points:p,point:y,lngLats:m,lngLat:n.unproject(y),originalEvent:a}),this._defaultPrevented=!1}}class mc extends h.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,a){super(t,{originalEvent:a}),this._defaultPrevented=!1}}class gc{constructor(t,n){this._map=t,this._clickTolerance=n.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new mc(t.type,this._map,t))}mousedown(t,n){return this._mousedownPos=n,this._firePreventable(new Zt(t.type,this._map,t))}mouseup(t){this._map.fire(new Zt(t.type,this._map,t))}click(t,n){this._mousedownPos&&this._mousedownPos.dist(n)>=this._clickTolerance||this._map.fire(new Zt(t.type,this._map,t))}dblclick(t){return this._firePreventable(new Zt(t.type,this._map,t))}mouseover(t){this._map.fire(new Zt(t.type,this._map,t))}mouseout(t){this._map.fire(new Zt(t.type,this._map,t))}touchstart(t){return this._firePreventable(new Wr(t.type,this._map,t))}touchmove(t){this._map.fire(new Wr(t.type,this._map,t))}touchend(t){this._map.fire(new Wr(t.type,this._map,t))}touchcancel(t){this._map.fire(new Wr(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class _c{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new Zt(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Zt("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new Zt(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class On{constructor(t){this._map=t}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(t){return this.transform.pointLocation(h.Point.convert(t),this._map.terrain)}}class cs{constructor(t,n){this._map=t,this._tr=new On(t),this._el=t.getCanvasContainer(),this._container=t.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(t,n){this.isEnabled()&&t.shiftKey&&t.button===0&&(J.disableDrag(),this._startPos=this._lastPos=n,this._active=!0)}mousemoveWindow(t,n){if(!this._active)return;const a=n;if(this._lastPos.equals(a)||!this._box&&a.dist(this._startPos)<this._clickTolerance)return;const c=this._startPos;this._lastPos=a,this._box||(this._box=J.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",t));const p=Math.min(c.x,a.x),m=Math.max(c.x,a.x),y=Math.min(c.y,a.y),_=Math.max(c.y,a.y);J.setTransform(this._box,`translate(${p}px,${y}px)`),this._box.style.width=m-p+"px",this._box.style.height=_-y+"px"}mouseupWindow(t,n){if(!this._active||t.button!==0)return;const a=this._startPos,c=n;if(this.reset(),J.suppressClick(),a.x!==c.x||a.y!==c.y)return this._map.fire(new h.Event("boxzoomend",{originalEvent:t})),{cameraAnimation:p=>p.fitScreenCoordinates(a,c,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",t)}keydown(t){this._active&&t.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(J.remove(this._box),this._box=null),J.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,n){return this._map.fire(new h.Event(t,{originalEvent:n}))}}function mr(o,t){if(o.length!==t.length)throw new Error(`The number of touches and points are not equal - touches ${o.length}, points ${t.length}`);const n={};for(let a=0;a<o.length;a++)n[o[a].identifier]=t[a];return n}class De{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(t,n,a){(this.centroid||a.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=t.timeStamp),a.length===this.numTouches&&(this.centroid=function(c){const p=new h.Point(0,0);for(const m of c)p._add(m);return p.div(c.length)}(n),this.touches=mr(a,n)))}touchmove(t,n,a){if(this.aborted||!this.centroid)return;const c=mr(a,n);for(const p in this.touches){const m=c[p];(!m||m.dist(this.touches[p])>30)&&(this.aborted=!0)}}touchend(t,n,a){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),a.length===0){const c=!this.aborted&&this.centroid;if(this.reset(),c)return c}}}class Gs{constructor(t){this.singleTap=new De(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,n,a){this.singleTap.touchstart(t,n,a)}touchmove(t,n,a){this.singleTap.touchmove(t,n,a)}touchend(t,n,a){const c=this.singleTap.touchend(t,n,a);if(c){const p=t.timeStamp-this.lastTime<500,m=!this.lastTap||this.lastTap.dist(c)<30;if(p&&m||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=c,this.count===this.numTaps)return this.reset(),c}}}class hs{constructor(t){this._tr=new On(t),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(t,n,a){this._zoomIn.touchstart(t,n,a),this._zoomOut.touchstart(t,n,a)}touchmove(t,n,a){this._zoomIn.touchmove(t,n,a),this._zoomOut.touchmove(t,n,a)}touchend(t,n,a){const c=this._zoomIn.touchend(t,n,a),p=this._zoomOut.touchend(t,n,a),m=this._tr;return c?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:y=>y.easeTo({duration:300,zoom:m.zoom+1,around:m.unproject(c)},{originalEvent:t})}):p?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:y=>y.easeTo({duration:300,zoom:m.zoom-1,around:m.unproject(p)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class kr{constructor(t){this._enabled=!!t.enable,this._moveStateManager=t.moveStateManager,this._clickTolerance=t.clickTolerance||1,this._moveFunction=t.move,this._activateOnStart=!!t.activateOnStart,t.assignEvents(this),this.reset()}reset(t){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(t)}_move(...t){const n=this._moveFunction(...t);if(n.bearingDelta||n.pitchDelta||n.around||n.panDelta)return this._active=!0,n}dragStart(t,n){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=n.length?n[0]:n,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,n){if(!this.isEnabled())return;const a=this._lastPoint;if(!a)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);const c=n.length?n[0]:n;return!this._moved&&c.dist(a)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=c,this._move(a,c))}dragEnd(t){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(t)&&(this._moved&&J.suppressClick(),this.reset(t))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const ul={0:1,2:2};class Ce{constructor(t){this._correctEvent=t.checkCorrectEvent}startMove(t){const n=J.mouseButton(t);this._eventButton=n}endMove(t){delete this._eventButton}isValidStartEvent(t){return this._correctEvent(t)}isValidMoveEvent(t){return!function(n,a){const c=ul[a];return n.buttons===void 0||(n.buttons&c)!==c}(t,this._eventButton)}isValidEndEvent(t){return J.mouseButton(t)===this._eventButton}}class Zs{constructor(){this._firstTouch=void 0}_isOneFingerTouch(t){return t.targetTouches.length===1}_isSameTouchEvent(t){return t.targetTouches[0].identifier===this._firstTouch}startMove(t){this._firstTouch=t.targetTouches[0].identifier}endMove(t){delete this._firstTouch}isValidStartEvent(t){return this._isOneFingerTouch(t)}isValidMoveEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}isValidEndEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}}const Wa=o=>{o.mousedown=o.dragStart,o.mousemoveWindow=o.dragMove,o.mouseup=o.dragEnd,o.contextmenu=function(t){t.preventDefault()}},dl=({enable:o,clickTolerance:t,bearingDegreesPerPixelMoved:n=.8})=>{const a=new Ce({checkCorrectEvent:c=>J.mouseButton(c)===0&&c.ctrlKey||J.mouseButton(c)===2});return new kr({clickTolerance:t,move:(c,p)=>({bearingDelta:(p.x-c.x)*n}),moveStateManager:a,enable:o,assignEvents:Wa})},Xs=({enable:o,clickTolerance:t,pitchDegreesPerPixelMoved:n=-.5})=>{const a=new Ce({checkCorrectEvent:c=>J.mouseButton(c)===0&&c.ctrlKey||J.mouseButton(c)===2});return new kr({clickTolerance:t,move:(c,p)=>({pitchDelta:(p.y-c.y)*n}),moveStateManager:a,enable:o,assignEvents:Wa})};class pl{constructor(t,n){this._minTouches=t.cooperativeGestures?2:1,this._clickTolerance=t.clickTolerance||1,this._map=n,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new h.Point(0,0),setTimeout(()=>{this._cancelCooperativeMessage=!1},200)}touchstart(t,n,a){return this._calculateTransform(t,n,a)}touchmove(t,n,a){if(this._map._cooperativeGestures&&(this._minTouches===2&&a.length<2&&!this._cancelCooperativeMessage?this._map._onCooperativeGesture(t,!1,a.length):this._cancelCooperativeMessage||(this._cancelCooperativeMessage=!0)),this._active&&!(a.length<this._minTouches))return t.preventDefault(),this._calculateTransform(t,n,a)}touchend(t,n,a){this._calculateTransform(t,n,a),this._active&&a.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,n,a){a.length>0&&(this._active=!0);const c=mr(a,n),p=new h.Point(0,0),m=new h.Point(0,0);let y=0;for(const v in c){const S=c[v],T=this._touches[v];T&&(p._add(S),m._add(S.sub(T)),y++,c[v]=S)}if(this._touches=c,y<this._minTouches||!m.mag())return;const _=m.div(y);return this._sum._add(_),this._sum.mag()<this._clickTolerance?void 0:{around:p.div(y),panDelta:_}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ws{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}_start(t){}_move(t,n,a){return{}}touchstart(t,n,a){this._firstTwoTouches||a.length<2||(this._firstTwoTouches=[a[0].identifier,a[1].identifier],this._start([n[0],n[1]]))}touchmove(t,n,a){if(!this._firstTwoTouches)return;t.preventDefault();const[c,p]=this._firstTwoTouches,m=Hs(a,n,c),y=Hs(a,n,p);if(!m||!y)return;const _=this._aroundCenter?null:m.add(y).div(2);return this._move([m,y],_,t)}touchend(t,n,a){if(!this._firstTwoTouches)return;const[c,p]=this._firstTwoTouches,m=Hs(a,n,c),y=Hs(a,n,p);m&&y||(this._active&&J.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(t){this._enabled=!0,this._aroundCenter=!!t&&t.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function Hs(o,t,n){for(let a=0;a<o.length;a++)if(o[a].identifier===n)return t[a]}function fl(o,t){return Math.log(o/t)/Math.LN2}class Ha extends Ws{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,n){const a=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(fl(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:fl(this._distance,a),pinchAround:n}}}function Ks(o,t){return 180*o.angleWith(t)/Math.PI}class Ka extends Ws{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(t){this._startVector=this._vector=t[0].sub(t[1]),this._minDiameter=t[0].dist(t[1])}_move(t,n){const a=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:Ks(this._vector,a),pinchAround:n}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const n=25/(Math.PI*this._minDiameter)*360,a=Ks(t,this._startVector);return Math.abs(a)<n}}function us(o){return Math.abs(o.y)>Math.abs(o.x)}class Ci extends Ws{constructor(t){super(),this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,n,a){super.touchstart(t,n,a),this._currentTouchCount=a.length}_start(t){this._lastPoints=t,us(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,n,a){if(this._map._cooperativeGestures&&this._currentTouchCount<3)return;const c=t[0].sub(this._lastPoints[0]),p=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(c,p,a.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(c.y+p.y)/2*-.5}):void 0}gestureBeginsVertically(t,n,a){if(this._valid!==void 0)return this._valid;const c=t.mag()>=2,p=n.mag()>=2;if(!c&&!p)return;if(!c||!p)return this._firstMove===void 0&&(this._firstMove=a),a-this._firstMove<100&&void 0;const m=t.y>0==n.y>0;return us(t)&&us(n)&&m}}const Hr={panStep:100,bearingStep:15,pitchStep:10};class ml{constructor(t){this._tr=new On(t);const n=Hr;this._panStep=n.panStep,this._bearingStep=n.bearingStep,this._pitchStep=n.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let n=0,a=0,c=0,p=0,m=0;switch(t.keyCode){case 61:case 107:case 171:case 187:n=1;break;case 189:case 109:case 173:n=-1;break;case 37:t.shiftKey?a=-1:(t.preventDefault(),p=-1);break;case 39:t.shiftKey?a=1:(t.preventDefault(),p=1);break;case 38:t.shiftKey?c=1:(t.preventDefault(),m=-1);break;case 40:t.shiftKey?c=-1:(t.preventDefault(),m=1);break;default:return}return this._rotationDisabled&&(a=0,c=0),{cameraAnimation:y=>{const _=this._tr;y.easeTo({duration:300,easeId:"keyboardHandler",easing:Ya,zoom:n?Math.round(_.zoom)+n*(t.shiftKey?2:1):_.zoom,bearing:_.bearing+a*this._bearingStep,pitch:_.pitch+c*this._pitchStep,offset:[-p*this._panStep,-m*this._panStep],center:_.center},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function Ya(o){return o*(2-o)}const Ys=4.000244140625;class Ja{constructor(t,n){this._map=t,this._tr=new On(t),this._el=t.getCanvasContainer(),this._handler=n,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,h.bindAll(["_onTimeout"],this)}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=t&&t.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(t){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!t[this._map._metaKey])return;t.preventDefault()}let n=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const a=h.exported.now(),c=a-(this._lastWheelEventTime||0);this._lastWheelEventTime=a,n!==0&&n%Ys==0?this._type="wheel":n!==0&&Math.abs(n)<4?this._type="trackpad":c>400?(this._type=null,this._lastValue=n,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(c*n)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,n+=this._lastValue)),t.shiftKey&&n&&(n/=4),this._type&&(this._lastWheelEvent=t,this._delta-=n,this._active||this._start(t)),t.preventDefault()}_onTimeout(t){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)}_start(t){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const n=J.mousePos(this._el,t),a=this._tr;this._around=h.LngLat.convert(this._aroundCenter?a.center:a.unproject(n)),this._aroundPoint=a.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const t=this._tr.transform;if(this._delta!==0){const y=this._type==="wheel"&&Math.abs(this._delta)>Ys?this._wheelZoomRate:this._defaultZoomRate;let _=2/(1+Math.exp(-Math.abs(this._delta*y)));this._delta<0&&_!==0&&(_=1/_);const v=typeof this._targetZoom=="number"?t.zoomScale(this._targetZoom):t.scale;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(v*_))),this._type==="wheel"&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const n=typeof this._targetZoom=="number"?this._targetZoom:t.zoom,a=this._startZoom,c=this._easing;let p,m=!1;if(this._type==="wheel"&&a&&c){const y=Math.min((h.exported.now()-this._lastWheelEventTime)/200,1),_=c(y);p=h.interpolate.number(a,n,_),y<1?this._frameId||(this._frameId=!0):m=!0}else p=n,m=!0;return this._active=!0,m&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!m,zoomDelta:p-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let n=h.ease;if(this._prevEase){const a=this._prevEase,c=(h.exported.now()-a.start)/a.duration,p=a.easing(c+.01)-a.easing(c),m=.27/Math.sqrt(p*p+1e-4)*.01,y=Math.sqrt(.0729-m*m);n=h.bezier(m,y,.25,1)}return this._prevEase={start:h.exported.now(),duration:t,easing:n},n}reset(){this._active=!1}}class gl{constructor(t,n){this._clickZoom=t,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 Yi{constructor(t){this._tr=new On(t),this.reset()}reset(){this._active=!1}dblclick(t,n){return t.preventDefault(),{cameraAnimation:a=>{a.easeTo({duration:300,zoom:this._tr.zoom+(t.shiftKey?-1:1),around:this._tr.unproject(n)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Pt{constructor(){this._tap=new Gs({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()}touchstart(t,n,a){this._swipePoint||(this._tapTime&&t.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?a.length>0&&(this._swipePoint=n[0],this._swipeTouch=a[0].identifier):this._tap.touchstart(t,n,a))}touchmove(t,n,a){if(this._tapTime){if(this._swipePoint){if(a[0].identifier!==this._swipeTouch)return;const c=n[0],p=c.y-this._swipePoint.y;return this._swipePoint=c,t.preventDefault(),this._active=!0,{zoomDelta:p/128}}}else this._tap.touchmove(t,n,a)}touchend(t,n,a){this._tapTime?this._swipePoint&&a.length===0&&this.reset():this._tap.touchend(t,n,a)&&(this._tapTime=t.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Js{constructor(t,n,a){this._el=t,this._mousePan=n,this._touchPan=a}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class Qa{constructor(t,n,a){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=n,this._mousePitch=a}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 _l{constructor(t,n,a,c){this._el=t,this._touchZoom=n,this._touchRotate=a,this._tapDragZoom=c,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const ds=o=>o.zoom||o.drag||o.pitch||o.rotate;class yl extends h.Event{}function eo(o){return o.panDelta&&o.panDelta.mag()||o.zoomDelta||o.bearingDelta||o.pitchDelta}class gr{constructor(t,n){this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new fr(t),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n),h.bindAll(["handleEvent","handleWindowEvent"],this);const a=this._el;this._listeners=[[a,"touchstart",{passive:!0}],[a,"touchmove",{passive:!1}],[a,"touchend",void 0],[a,"touchcancel",void 0],[a,"mousedown",void 0],[a,"mousemove",void 0],[a,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[a,"mouseover",void 0],[a,"mouseout",void 0],[a,"dblclick",void 0],[a,"click",void 0],[a,"keydown",{capture:!1}],[a,"keyup",void 0],[a,"wheel",{passive:!1}],[a,"contextmenu",void 0],[window,"blur",void 0]];for(const[c,p,m]of this._listeners)J.addEventListener(c,p,c===document?this.handleWindowEvent:this.handleEvent,m)}destroy(){for(const[t,n,a]of this._listeners)J.removeEventListener(t,n,t===document?this.handleWindowEvent:this.handleEvent,a)}_addDefaultHandlers(t){const n=this._map,a=n.getCanvasContainer();this._add("mapEvent",new gc(n,t));const c=n.boxZoom=new cs(n,t);this._add("boxZoom",c);const p=new hs(n),m=new Yi(n);n.doubleClickZoom=new gl(m,p),this._add("tapZoom",p),this._add("clickZoom",m);const y=new Pt;this._add("tapDragZoom",y);const _=n.touchPitch=new Ci(n);this._add("touchPitch",_);const v=dl(t),S=Xs(t);n.dragRotate=new Qa(t,v,S),this._add("mouseRotate",v,["mousePitch"]),this._add("mousePitch",S,["mouseRotate"]);const T=(({enable:W,clickTolerance:ne})=>{const V=new Ce({checkCorrectEvent:ie=>J.mouseButton(ie)===0&&!ie.ctrlKey});return new kr({clickTolerance:ne,move:(ie,ae)=>({around:ae,panDelta:ae.sub(ie)}),activateOnStart:!0,moveStateManager:V,enable:W,assignEvents:Wa})})(t),L=new pl(t,n);n.dragPan=new Js(a,T,L),this._add("mousePan",T),this._add("touchPan",L,["touchZoom","touchRotate"]);const O=new Ka,R=new Ha;n.touchZoomRotate=new _l(a,R,O,y),this._add("touchRotate",O,["touchPan","touchZoom"]),this._add("touchZoom",R,["touchPan","touchRotate"]);const B=n.scrollZoom=new Ja(n,this);this._add("scrollZoom",B,["mousePan"]);const $=n.keyboard=new ml(n);this._add("keyboard",$),this._add("blockableMapEvent",new _c(n));for(const W of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])t.interactive&&t[W]&&n[W].enable(t[W])}_add(t,n,a){this._handlers.push({handlerName:t,handler:n,allowed:a}),this._handlersById[t]=n}stop(t){if(!this._updatingCamera){for(const{handler:n}of this._handlers)n.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(const{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!ds(this._eventsInProgress)||this.isZooming()}_blockedByActive(t,n,a){for(const c in t)if(c!==a&&(!n||n.indexOf(c)<0))return!0;return!1}handleWindowEvent(t){this.handleEvent(t,`${t.type}Window`)}_getMapTouches(t){const n=[];for(const a of t)this._el.contains(a.target)&&n.push(a);return n}handleEvent(t,n){if(t.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const a=t.type==="renderFrame"?void 0:t,c={needsRenderFrame:!1},p={},m={},y=t.touches,_=y?this._getMapTouches(y):void 0,v=_?J.touchPos(this._el,_):J.mousePos(this._el,t);for(const{handlerName:L,handler:O,allowed:R}of this._handlers){if(!O.isEnabled())continue;let B;this._blockedByActive(m,R,L)?O.reset():O[n||t.type]&&(B=O[n||t.type](t,v,_),this.mergeHandlerResult(c,p,B,L,a),B&&B.needsRenderFrame&&this._triggerRenderFrame()),(B||O.isActive())&&(m[L]=O)}const S={};for(const L in this._previousActiveHandlers)m[L]||(S[L]=a);this._previousActiveHandlers=m,(Object.keys(S).length||eo(c))&&(this._changes.push([c,p,S]),this._triggerRenderFrame()),(Object.keys(m).length||eo(c))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:T}=c;T&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],T(this._map))}mergeHandlerResult(t,n,a,c,p){if(!a)return;h.extend(t,a);const m={handlerName:c,originalEvent:a.originalEvent||p};a.zoomDelta!==void 0&&(n.zoom=m),a.panDelta!==void 0&&(n.drag=m),a.pitchDelta!==void 0&&(n.pitch=m),a.bearingDelta!==void 0&&(n.rotate=m)}_applyChanges(){const t={},n={},a={};for(const[c,p,m]of this._changes)c.panDelta&&(t.panDelta=(t.panDelta||new h.Point(0,0))._add(c.panDelta)),c.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+c.zoomDelta),c.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+c.bearingDelta),c.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+c.pitchDelta),c.around!==void 0&&(t.around=c.around),c.pinchAround!==void 0&&(t.pinchAround=c.pinchAround),c.noInertia&&(t.noInertia=c.noInertia),h.extend(n,p),h.extend(a,m);this._updateMapTransform(t,n,a),this._changes=[]}_updateMapTransform(t,n,a){const c=this._map,p=c._getTransformForUpdate(),m=c.terrain;if(!(eo(t)||m&&this._terrainMovement))return this._fireEvents(n,a,!0);let{panDelta:y,zoomDelta:_,bearingDelta:v,pitchDelta:S,around:T,pinchAround:L}=t;L!==void 0&&(T=L),c._stop(!0),T=T||c.transform.centerPoint;const O=p.pointLocation(y?T.sub(y):T);v&&(p.bearing+=v),S&&(p.pitch+=S),_&&(p.zoom+=_),m?this._terrainMovement||!n.drag&&!n.zoom?n.drag&&this._terrainMovement?p.center=p.pointLocation(p.centerPoint.sub(y)):p.setLocationAtPoint(O,T):(this._terrainMovement=!0,p.freezeElevation=!0,p.setLocationAtPoint(O,T),this._map.once("moveend",()=>{p.freezeElevation=!1,this._terrainMovement=!1,p.recalculateZoom(c.terrain)})):p.setLocationAtPoint(O,T),c._applyUpdatedTransform(p),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(n,a,!0)}_fireEvents(t,n,a){const c=ds(this._eventsInProgress),p=ds(t),m={};for(const S in t){const{originalEvent:T}=t[S];this._eventsInProgress[S]||(m[`${S}start`]=T),this._eventsInProgress[S]=t[S]}!c&&p&&this._fireEvent("movestart",p.originalEvent);for(const S in m)this._fireEvent(S,m[S]);p&&this._fireEvent("move",p.originalEvent);for(const S in t){const{originalEvent:T}=t[S];this._fireEvent(S,T)}const y={};let _;for(const S in this._eventsInProgress){const{handlerName:T,originalEvent:L}=this._eventsInProgress[S];this._handlersById[T].isActive()||(delete this._eventsInProgress[S],_=n[T]||L,y[`${S}end`]=_)}for(const S in y)this._fireEvent(S,y[S]);const v=ds(this._eventsInProgress);if(a&&(c||p)&&!v){this._updatingCamera=!0;const S=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),T=L=>L!==0&&-this._bearingSnap<L&&L<this._bearingSnap;S?(T(S.bearing||this._map.getBearing())&&(S.bearing=0),S.freezeElevation=!0,this._map.easeTo(S,{originalEvent:_})):(this._map.fire(new h.Event("moveend",{originalEvent:_})),T(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(t,n){this._map.fire(new h.Event(t,n?{originalEvent:n}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(t=>{delete this._frameId,this.handleEvent(new yl("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const Qs={extend:(o,...t)=>h.extend(o,...t),run(o){o()},logToElement(o,t=!1,n="log"){const a=window.document.getElementById(n);a&&(t&&(a.innerHTML=""),a.innerHTML+=`<br>${o}`)}};class Ue extends h.Evented{constructor(t,n){super(),this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=n.bearingSnap,h.bindAll(["_renderFrameCallback"],this),this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new h.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(t,n){return this.jumpTo({center:t},n)}panBy(t,n,a){return t=h.Point.convert(t).mult(-1),this.panTo(this.transform.center,h.extend({offset:t},n),a)}panTo(t,n,a){return this.easeTo(h.extend({center:t},n),a)}getZoom(){return this.transform.zoom}setZoom(t,n){return this.jumpTo({zoom:t},n),this}zoomTo(t,n,a){return this.easeTo(h.extend({zoom:t},n),a)}zoomIn(t,n){return this.zoomTo(this.getZoom()+1,t,n),this}zoomOut(t,n){return this.zoomTo(this.getZoom()-1,t,n),this}getBearing(){return this.transform.bearing}setBearing(t,n){return this.jumpTo({bearing:t},n),this}getPadding(){return this.transform.padding}setPadding(t,n){return this.jumpTo({padding:t},n),this}rotateTo(t,n,a){return this.easeTo(h.extend({bearing:t},n),a)}resetNorth(t,n){return this.rotateTo(0,h.extend({duration:1e3},t),n),this}resetNorthPitch(t,n){return this.easeTo(h.extend({bearing:0,pitch:0,duration:1e3},t),n),this}snapToNorth(t,n){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,n):this}getPitch(){return this.transform.pitch}setPitch(t,n){return this.jumpTo({pitch:t},n),this}cameraForBounds(t,n){t=si.convert(t);const a=n&&n.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),a,n)}_cameraForBoxAndBearing(t,n,a,c){const p={top:0,bottom:0,right:0,left:0};if(typeof(c=h.extend({padding:p,offset:[0,0],maxZoom:this.transform.maxZoom},c)).padding=="number"){const ae=c.padding;c.padding={top:ae,bottom:ae,right:ae,left:ae}}c.padding=h.extend(p,c.padding);const m=this.transform,y=m.padding,_=m.project(h.LngLat.convert(t)),v=m.project(h.LngLat.convert(n)),S=_.rotate(-a*Math.PI/180),T=v.rotate(-a*Math.PI/180),L=new h.Point(Math.max(S.x,T.x),Math.max(S.y,T.y)),O=new h.Point(Math.min(S.x,T.x),Math.min(S.y,T.y)),R=L.sub(O),B=(m.width-(y.left+y.right+c.padding.left+c.padding.right))/R.x,$=(m.height-(y.top+y.bottom+c.padding.top+c.padding.bottom))/R.y;if($<0||B<0)return void h.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const W=Math.min(m.scaleZoom(m.scale*Math.min(B,$)),c.maxZoom),ne=h.Point.convert(c.offset),V=new h.Point((c.padding.left-c.padding.right)/2,(c.padding.top-c.padding.bottom)/2).rotate(a*Math.PI/180),ie=ne.add(V).mult(m.scale/m.zoomScale(W));return{center:m.unproject(_.add(v).div(2).sub(ie)),zoom:W,bearing:a}}fitBounds(t,n,a){return this._fitInternal(this.cameraForBounds(t,n),n,a)}fitScreenCoordinates(t,n,a,c,p){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(h.Point.convert(t)),this.transform.pointLocation(h.Point.convert(n)),a,c),c,p)}_fitInternal(t,n,a){return t?(delete(n=h.extend(t,n)).padding,n.linear?this.easeTo(n,a):this.flyTo(n,a)):this}jumpTo(t,n){this.stop();const a=this._getTransformForUpdate();let c=!1,p=!1,m=!1;return"zoom"in t&&a.zoom!==+t.zoom&&(c=!0,a.zoom=+t.zoom),t.center!==void 0&&(a.center=h.LngLat.convert(t.center)),"bearing"in t&&a.bearing!==+t.bearing&&(p=!0,a.bearing=+t.bearing),"pitch"in t&&a.pitch!==+t.pitch&&(m=!0,a.pitch=+t.pitch),t.padding==null||a.isPaddingEqual(t.padding)||(a.padding=t.padding),this._applyUpdatedTransform(a),this.fire(new h.Event("movestart",n)).fire(new h.Event("move",n)),c&&this.fire(new h.Event("zoomstart",n)).fire(new h.Event("zoom",n)).fire(new h.Event("zoomend",n)),p&&this.fire(new h.Event("rotatestart",n)).fire(new h.Event("rotate",n)).fire(new h.Event("rotateend",n)),m&&this.fire(new h.Event("pitchstart",n)).fire(new h.Event("pitch",n)).fire(new h.Event("pitchend",n)),this.fire(new h.Event("moveend",n))}calculateCameraOptionsFromTo(t,n,a,c=0){const p=h.MercatorCoordinate.fromLngLat(t,n),m=h.MercatorCoordinate.fromLngLat(a,c),y=m.x-p.x,_=m.y-p.y,v=m.z-p.z,S=Math.hypot(y,_,v);if(S===0)throw new Error("Can't calculate camera options with same From and To");const T=Math.hypot(y,_),L=this.transform.scaleZoom(this.transform.cameraToCenterDistance/S/this.transform.tileSize),O=180*Math.atan2(y,-_)/Math.PI;let R=180*Math.acos(T/S)/Math.PI;return R=v<0?90-R:90+R,{center:m.toLngLat(),zoom:L,pitch:R,bearing:O}}easeTo(t,n){this._stop(!1,t.easeId),((t=h.extend({offset:[0,0],duration:500,easing:h.ease},t)).animate===!1||!t.essential&&h.exported.prefersReducedMotion)&&(t.duration=0);const a=this._getTransformForUpdate(),c=this.getZoom(),p=this.getBearing(),m=this.getPitch(),y=this.getPadding(),_="zoom"in t?+t.zoom:c,v="bearing"in t?this._normalizeBearing(t.bearing,p):p,S="pitch"in t?+t.pitch:m,T="padding"in t?t.padding:a.padding,L=h.Point.convert(t.offset);let O=a.centerPoint.add(L);const R=a.pointLocation(O),B=h.LngLat.convert(t.center||R);this._normalizeCenter(B);const $=a.project(R),W=a.project(B).sub($),ne=a.zoomScale(_-c);let V,ie;t.around&&(V=h.LngLat.convert(t.around),ie=a.locationPoint(V));const ae={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||_!==c,this._rotating=this._rotating||p!==v,this._pitching=this._pitching||S!==m,this._padding=!a.isPaddingEqual(T),this._easeId=t.easeId,this._prepareEase(n,t.noMoveStart,ae),this.terrain&&this._prepareElevation(B),this._ease(fe=>{if(this._zooming&&(a.zoom=h.interpolate.number(c,_,fe)),this._rotating&&(a.bearing=h.interpolate.number(p,v,fe)),this._pitching&&(a.pitch=h.interpolate.number(m,S,fe)),this._padding&&(a.interpolatePadding(y,T,fe),O=a.centerPoint.add(L)),this.terrain&&!t.freezeElevation&&this._updateElevation(fe),V)a.setLocationAtPoint(V,ie);else{const _e=a.zoomScale(a.zoom-c),xe=_>c?Math.min(2,ne):Math.max(.5,ne),ge=Math.pow(xe,1-fe),ke=a.unproject($.add(W.mult(fe*ge)).mult(_e));a.setLocationAtPoint(a.renderWorldCopies?ke.wrap():ke,O)}this._applyUpdatedTransform(a),this._fireMoveEvents(n)},fe=>{this.terrain&&this._finalizeElevation(),this._afterEase(n,fe)},t),this}_prepareEase(t,n,a={}){this._moving=!0,n||a.moving||this.fire(new h.Event("movestart",t)),this._zooming&&!a.zooming&&this.fire(new h.Event("zoomstart",t)),this._rotating&&!a.rotating&&this.fire(new h.Event("rotatestart",t)),this._pitching&&!a.pitching&&this.fire(new h.Event("pitchstart",t))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.transform.getElevation(t,this.terrain),this.transform.freezeElevation=!0}_updateElevation(t){const n=this.transform.getElevation(this._elevationCenter,this.terrain);if(t<1&&n!==this._elevationTarget){const a=this._elevationTarget-this._elevationStart;this._elevationStart+=t*(a-(n-(a*t+this._elevationStart))/(1-t)),this._elevationTarget=n}this.transform.elevation=h.interpolate.number(this._elevationStart,this._elevationTarget,t)}_finalizeElevation(){this.transform.freezeElevation=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_applyUpdatedTransform(t){if(!this.transformCameraUpdate)return;const n=t.clone(),{center:a,zoom:c,pitch:p,bearing:m,elevation:y}=this.transformCameraUpdate(n);a&&(n.center=a),c!==void 0&&(n.zoom=c),p!==void 0&&(n.pitch=p),m!==void 0&&(n.bearing=m),y!==void 0&&(n.elevation=y),this.transform.apply(n)}_fireMoveEvents(t){this.fire(new h.Event("move",t)),this._zooming&&this.fire(new h.Event("zoom",t)),this._rotating&&this.fire(new h.Event("rotate",t)),this._pitching&&this.fire(new h.Event("pitch",t))}_afterEase(t,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId;const a=this._zooming,c=this._rotating,p=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,a&&this.fire(new h.Event("zoomend",t)),c&&this.fire(new h.Event("rotateend",t)),p&&this.fire(new h.Event("pitchend",t)),this.fire(new h.Event("moveend",t))}flyTo(t,n){if(!t.essential&&h.exported.prefersReducedMotion){const Le=h.pick(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(Le,n)}this.stop(),t=h.extend({offset:[0,0],speed:1.2,curve:1.42,easing:h.ease},t);const a=this._getTransformForUpdate(),c=this.getZoom(),p=this.getBearing(),m=this.getPitch(),y=this.getPadding(),_="zoom"in t?h.clamp(+t.zoom,a.minZoom,a.maxZoom):c,v="bearing"in t?this._normalizeBearing(t.bearing,p):p,S="pitch"in t?+t.pitch:m,T="padding"in t?t.padding:a.padding,L=a.zoomScale(_-c),O=h.Point.convert(t.offset);let R=a.centerPoint.add(O);const B=a.pointLocation(R),$=h.LngLat.convert(t.center||B);this._normalizeCenter($);const W=a.project(B),ne=a.project($).sub(W);let V=t.curve;const ie=Math.max(a.width,a.height),ae=ie/L,fe=ne.mag();if("minZoom"in t){const Le=h.clamp(Math.min(t.minZoom,c,_),a.minZoom,a.maxZoom),dt=ie/a.zoomScale(Le-c);V=Math.sqrt(dt/fe*2)}const _e=V*V;function xe(Le){const dt=(ae*ae-ie*ie+(Le?-1:1)*_e*_e*fe*fe)/(2*(Le?ae:ie)*_e*fe);return Math.log(Math.sqrt(dt*dt+1)-dt)}function ge(Le){return(Math.exp(Le)-Math.exp(-Le))/2}function ke(Le){return(Math.exp(Le)+Math.exp(-Le))/2}const Ve=xe(0);let Qe=function(Le){return ke(Ve)/ke(Ve+V*Le)},Se=function(Le){return ie*((ke(Ve)*(ge(dt=Ve+V*Le)/ke(dt))-ge(Ve))/_e)/fe;var dt},Ze=(xe(1)-Ve)/V;if(Math.abs(fe)<1e-6||!isFinite(Ze)){if(Math.abs(ie-ae)<1e-6)return this.easeTo(t,n);const Le=ae<ie?-1:1;Ze=Math.abs(Math.log(ae/ie))/V,Se=function(){return 0},Qe=function(dt){return Math.exp(Le*V*dt)}}return t.duration="duration"in t?+t.duration:1e3*Ze/("screenSpeed"in t?+t.screenSpeed/V:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=p!==v,this._pitching=S!==m,this._padding=!a.isPaddingEqual(T),this._prepareEase(n,!1),this.terrain&&this._prepareElevation($),this._ease(Le=>{const dt=Le*Ze,Nt=1/Qe(dt);a.zoom=Le===1?_:c+a.scaleZoom(Nt),this._rotating&&(a.bearing=h.interpolate.number(p,v,Le)),this._pitching&&(a.pitch=h.interpolate.number(m,S,Le)),this._padding&&(a.interpolatePadding(y,T,Le),R=a.centerPoint.add(O)),this.terrain&&!t.freezeElevation&&this._updateElevation(Le);const pt=Le===1?$:a.unproject(W.add(ne.mult(Se(dt))).mult(Nt));a.setLocationAtPoint(a.renderWorldCopies?pt.wrap():pt,R),this._applyUpdatedTransform(a),this._fireMoveEvents(n)},()=>{this.terrain&&this._finalizeElevation(),this._afterEase(n)},t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,n){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const a=this._onEaseEnd;delete this._onEaseEnd,a.call(this,n)}if(!t){const a=this.handlers;a&&a.stop(!1)}return this}_ease(t,n,a){a.animate===!1||a.duration===0?(t(1),n()):(this._easeStart=h.exported.now(),this._easeOptions=a,this._onEaseFrame=t,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const t=Math.min((h.exported.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(t)),t<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(t,n){t=h.wrap(t,-180,180);const a=Math.abs(t-n);return Math.abs(t-360-n)<a&&(t-=360),Math.abs(t+360-n)<a&&(t+=360),t}_normalizeCenter(t){const n=this.transform;if(!n.renderWorldCopies||n.lngRange)return;const a=t.lng-n.center.lng;t.lng+=a>180?-360:a<-180?360:0}queryTerrainElevation(t){return this.terrain?this.transform.getElevation(h.LngLat.convert(t),this.terrain)-this.transform.elevation:null}}class Ge{constructor(t={}){this.options=t,h.bindAll(["_toggleAttribution","_updateData","_updateCompact","_updateCompactMinimize"],this)}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options&&this.options.compact,this._container=J.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=J.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=J.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(){J.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(t,n){const a=this._map._getUIString(`AttributionControl.${n}`);t.title=a,t.setAttribute("aria-label",a)}_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")))}_updateData(t){!t||t.sourceDataType!=="metadata"&&t.sourceDataType!=="visibility"&&t.dataType!=="style"&&t.type!=="terrain"||this._updateAttributions()}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map(c=>typeof c!="string"?"":c)):typeof this.options.customAttribution=="string"&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const c=this._map.style.stylesheet;this.styleOwner=c.owner,this.styleId=c.id}const n=this._map.style.sourceCaches;for(const c in n){const p=n[c];if(p.used||p.usedForTerrain){const m=p.getSource();m.attribution&&t.indexOf(m.attribution)<0&&t.push(m.attribution)}}t=t.filter(c=>String(c).trim()),t.sort((c,p)=>c.length-p.length),t=t.filter((c,p)=>{for(let m=p+1;m<t.length;m++)if(t[m].indexOf(c)>=0)return!1;return!0});const a=t.join(" | ");a!==this._attribHTML&&(this._attribHTML=a,t.length?(this._innerContainer.innerHTML=a,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}_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"))}_updateCompactMinimize(){this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")}}class ps{constructor(t={}){this.options=t,h.bindAll(["_updateCompact"],this)}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=J.create("div","maplibregl-ctrl");const n=J.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(){J.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}_updateCompact(){const t=this._container.children;if(t.length){const n=t[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&n.classList.add("maplibregl-compact"):n.classList.remove("maplibregl-compact")}}}class to{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const n=++this._id;return this._queue.push({callback:t,id:n,cancelled:!1}),n}remove(t){const n=this._currentlyRunning,a=n?this._queue.concat(n):this._queue;for(const c of a)if(c.id===t)return void(c.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const n=this._currentlyRunning=this._queue;this._queue=[];for(const a of n)if(!a.cancelled&&(a.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}const io={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","TerrainControl.enableTerrain":"Enable terrain","TerrainControl.disableTerrain":"Disable terrain"};var Pi=h.createLayout([{name:"a_pos3d",type:"Int16",components:3}]);class xl extends h.Evented{constructor(t){super(),this.sourceCache=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,t.usedForTerrain=!0,t.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(t,n){this.sourceCache.update(t,n),this._renderableTilesKeys=[];const a={};for(const c of t.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:n}))a[c.key]=!0,this._renderableTilesKeys.push(c.key),this._tiles[c.key]||(c.posMatrix=new Float64Array(16),h.ortho(c.posMatrix,0,h.EXTENT,0,h.EXTENT,0,1),this._tiles[c.key]=new nn(c,this.tileSize));for(const c in this._tiles)a[c]||delete this._tiles[c]}freeRtt(t){for(const n in this._tiles){const a=this._tiles[n];(!t||a.tileID.equals(t)||a.tileID.isChildOf(t)||t.isChildOf(a.tileID))&&(a.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(t=>this.getTileByID(t))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t){const n={};for(const a of this._renderableTilesKeys){const c=this._tiles[a].tileID;if(c.canonical.equals(t.canonical)){const p=t.clone();p.posMatrix=new Float64Array(16),h.ortho(p.posMatrix,0,h.EXTENT,0,h.EXTENT,0,1),n[a]=p}else if(c.canonical.isChildOf(t.canonical)){const p=t.clone();p.posMatrix=new Float64Array(16);const m=c.canonical.z-t.canonical.z,y=c.canonical.x-(c.canonical.x>>m<<m),_=c.canonical.y-(c.canonical.y>>m<<m),v=h.EXTENT>>m;h.ortho(p.posMatrix,0,v,0,v,0,1),h.translate(p.posMatrix,p.posMatrix,[-y*v,-_*v,0]),n[a]=p}else if(t.canonical.isChildOf(c.canonical)){const p=t.clone();p.posMatrix=new Float64Array(16);const m=t.canonical.z-c.canonical.z,y=t.canonical.x-(t.canonical.x>>m<<m),_=t.canonical.y-(t.canonical.y>>m<<m),v=h.EXTENT>>m;h.ortho(p.posMatrix,0,h.EXTENT,0,h.EXTENT,0,1),h.translate(p.posMatrix,p.posMatrix,[y*v,_*v,0]),h.scale(p.posMatrix,p.posMatrix,[1/2**m,1/2**m,0]),n[a]=p}}return n}getSourceTile(t,n){const a=this.sourceCache._source;let c=t.overscaledZ-this.deltaZoom;if(c>a.maxzoom&&(c=a.maxzoom),c<a.minzoom)return null;this._sourceTileCache[t.key]||(this._sourceTileCache[t.key]=t.scaledTo(c).key);let p=this.sourceCache.getTileByID(this._sourceTileCache[t.key]);if((!p||!p.dem)&&n)for(;c>=a.minzoom&&(!p||!p.dem);)p=this.sourceCache.getTileByID(t.scaledTo(c--).key);return p}tilesAfterTime(t=Date.now()){return Object.values(this._tiles).filter(n=>n.timeAdded>=t)}}class _r{constructor(t,n,a){this.painter=t,this.sourceCache=new xl(n),this.options=a,this.exaggeration=typeof a.exaggeration=="number"?a.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(t,n,a,c=h.EXTENT){if(!(n>=0&&n<c&&a>=0&&a<c))return 0;let p=0;const m=this.getTerrainData(t);if(m.tile&&m.tile.dem){const y=function(R,B,$){var W=B[0],ne=B[1];return R[0]=$[0]*W+$[4]*ne+$[12],R[1]=$[1]*W+$[5]*ne+$[13],R}([],[n/c*h.EXTENT,a/c*h.EXTENT],m.u_terrain_matrix),_=[y[0]*m.tile.dem.dim,y[1]*m.tile.dem.dim],v=[Math.floor(_[0]),Math.floor(_[1])],S=m.tile.dem.get(v[0],v[1]),T=m.tile.dem.get(v[0],v[1]+1),L=m.tile.dem.get(v[0]+1,v[1]),O=m.tile.dem.get(v[0]+1,v[1]+1);p=h.interpolate.number(h.interpolate.number(S,T,_[0]-v[0]),h.interpolate.number(L,O,_[0]-v[0]),_[1]-v[1])}return p}getElevation(t,n,a,c=h.EXTENT){return this.getDEMElevation(t,n,a,c)*this.exaggeration}getTerrainData(t){if(!this._emptyDemTexture){const c=this.painter.context,p=new h.RGBAImage({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new yt(c,p,c.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new yt(c,new h.RGBAImage({width:1,height:1}),c.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(c.gl.NEAREST,c.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=h.identity([])}const n=this.sourceCache.getSourceTile(t,!0);if(n&&n.dem&&(!n.demTexture||n.needsTerrainPrepare)){const c=this.painter.context;n.demTexture=this.painter.getTileTexture(n.dem.stride),n.demTexture?n.demTexture.update(n.dem.getPixels(),{premultiply:!1}):n.demTexture=new yt(c,n.dem.getPixels(),c.gl.RGBA,{premultiply:!1}),n.demTexture.bind(c.gl.NEAREST,c.gl.CLAMP_TO_EDGE),n.needsTerrainPrepare=!1}const a=n&&n+n.tileID.key+t.key;if(a&&!this._demMatrixCache[a]){const c=this.sourceCache.sourceCache._source.maxzoom;let p=t.canonical.z-n.tileID.canonical.z;t.overscaledZ>t.canonical.z&&(t.canonical.z>=c?p=t.canonical.z-c:h.warnOnce("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const m=t.canonical.x-(t.canonical.x>>p<<p),y=t.canonical.y-(t.canonical.y>>p<<p),_=h.fromScaling(new Float64Array(16),[1/(h.EXTENT<<p),1/(h.EXTENT<<p),0]);h.translate(_,_,[m*h.EXTENT,y*h.EXTENT,0]),this._demMatrixCache[t.key]={matrix:_,coord:t}}return{u_depth:2,u_terrain:3,u_terrain_dim:n&&n.dem&&n.dem.dim||1,u_terrain_matrix:a?this._demMatrixCache[t.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(t){const n=this.painter,a=n.width/devicePixelRatio,c=n.height/devicePixelRatio;return!this._fbo||this._fbo.width===a&&this._fbo.height===c||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new yt(n.context,{width:a,height:c,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 yt(n.context,{width:a,height:c,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(a,c,!0,!1),this._fbo.depthAttachment.set(n.context.createRenderbuffer(n.context.gl.DEPTH_COMPONENT16,a,c))),this._fbo.colorAttachment.set(t==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const t=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const n=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let p=0,m=0;p<this._coordsTextureSize;p++)for(let y=0;y<this._coordsTextureSize;y++,m+=4)n[m+0]=255&y,n[m+1]=255&p,n[m+2]=y>>8<<4|p>>8,n[m+3]=0;const a=new h.RGBAImage({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(n.buffer)),c=new yt(t,a,t.gl.RGBA,{premultiply:!1});return c.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=c,c}pointCoordinate(t){const n=new Uint8Array(4),a=this.painter.context,c=a.gl;a.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),c.readPixels(t.x,this.painter.height/devicePixelRatio-t.y-1,1,1,c.RGBA,c.UNSIGNED_BYTE,n),a.bindFramebuffer.set(null);const p=n[0]+(n[2]>>4<<8),m=n[1]+((15&n[2])<<8),y=this.coordsIndex[255-n[3]],_=y&&this.sourceCache.getTileByID(y);if(!_)return null;const v=this._coordsTextureSize,S=(1<<_.tileID.canonical.z)*v;return new h.MercatorCoordinate((_.tileID.canonical.x*v+p)/S,(_.tileID.canonical.y*v+m)/S,this.getElevation(_.tileID,p,m,v))}getTerrainMesh(){if(this._mesh)return this._mesh;const t=this.painter.context,n=new h.Pos3dArray,a=new h.TriangleIndexArray,c=this.meshSize,p=h.EXTENT/c,m=c*c;for(let T=0;T<=c;T++)for(let L=0;L<=c;L++)n.emplaceBack(L*p,T*p,0);for(let T=0;T<m;T+=c+1)for(let L=0;L<c;L++)a.emplaceBack(L+T,c+L+T+1,c+L+T+2),a.emplaceBack(L+T,c+L+T+2,L+T+1);const y=n.length,_=y+2*(c+1);for(const T of[0,1])for(let L=0;L<=c;L++)for(const O of[0,1])n.emplaceBack(L*p,T*h.EXTENT,O);for(let T=0;T<2*c;T+=2)a.emplaceBack(_+T,_+T+1,_+T+3),a.emplaceBack(_+T,_+T+3,_+T+2),a.emplaceBack(y+T,y+T+3,y+T+1),a.emplaceBack(y+T,y+T+2,y+T+3);const v=n.length,S=v+2*(c+1);for(const T of[0,1])for(let L=0;L<=c;L++)for(const O of[0,1])n.emplaceBack(T*h.EXTENT,L*p,O);for(let T=0;T<2*c;T+=2)a.emplaceBack(v+T,v+T+1,v+T+3),a.emplaceBack(v+T,v+T+3,v+T+2),a.emplaceBack(S+T,S+T+3,S+T+1),a.emplaceBack(S+T,S+T+2,S+T+3);return this._mesh={indexBuffer:t.createIndexBuffer(a),vertexBuffer:t.createVertexBuffer(n,Pi.members),segments:h.SegmentVector.simpleSegment(0,0,n.length,a.length)},this._mesh}getMeshFrameDelta(t){return 2*Math.PI*h.earthRadius/Math.pow(2,t)/5}getMinMaxElevation(t){const n=this.getTerrainData(t).tile,a={minElevation:null,maxElevation:null};return n&&n.dem&&(a.minElevation=n.dem.min*this.exaggeration,a.maxElevation=n.dem.max*this.exaggeration),a}}class yc{constructor(t,n,a){this._context=t,this._size=n,this._tileSize=a,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const t of this._objects)t.texture.destroy(),t.fbo.destroy()}_createObject(t){const n=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),a=new yt(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return a.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(a.texture),{id:t,fbo:n,texture:a,stamp:-1,inUse:!1}}getObjectForId(t){return this._objects[t]}useObject(t){t.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(n=>t.id!==n),this._recentlyUsed.push(t.id)}stampObject(t){t.stamp=++this._stamp}getOrCreateFreeObject(){for(const 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!");const t=this._createObject(this._objects.length);return this._objects.push(t),t}freeObject(t){t.inUse=!1}freeAllObjects(){for(const t of this._objects)this.freeObject(t)}isFull(){return!(this._objects.length<this._size)&&this._objects.some(t=>!t.inUse)===!1}}const Lr={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Rt{constructor(t,n){this.painter=t,this.terrain=n,this.pool=new yc(t.context,30,n.sourceCache.tileSize*n.qualityFactor)}destruct(){this.pool.destruct()}getTexture(t){return this.pool.getObjectForId(t.rtt[this._stacks.length-1].id).texture}prepareForRender(t,n){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=t._order.filter(a=>!t._layers[a].isHidden(n)),this._coordsDescendingInv={};for(const a in t.sourceCaches){this._coordsDescendingInv[a]={};const c=t.sourceCaches[a].getVisibleCoordinates();for(const p of c){const m=this.terrain.sourceCache.getTerrainCoords(p);for(const y in m)this._coordsDescendingInv[a][y]||(this._coordsDescendingInv[a][y]=[]),this._coordsDescendingInv[a][y].push(m[y])}}this._coordsDescendingInvStr={};for(const a of t._order){const c=t._layers[a],p=c.source;if(Lr[c.type]&&!this._coordsDescendingInvStr[p]){this._coordsDescendingInvStr[p]={};for(const m in this._coordsDescendingInv[p])this._coordsDescendingInvStr[p][m]=this._coordsDescendingInv[p][m].map(y=>y.key).sort().join()}}for(const a of this._renderableTiles)for(const c in this._coordsDescendingInvStr){const p=this._coordsDescendingInvStr[c][a.tileID.key];p&&p!==a.rttCoords[c]&&(a.rtt=[])}}renderLayer(t){if(t.isHidden(this.painter.transform.zoom))return!1;const n=t.type,a=this.painter,c=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(Lr[n]&&(this._prevType&&Lr[this._prevType]||this._stacks.push([]),this._prevType=n,this._stacks[this._stacks.length-1].push(t.id),!c))return!0;if(Lr[this._prevType]||Lr[n]&&c){this._prevType=n;const p=this._stacks.length-1,m=this._stacks[p]||[];for(const y of this._renderableTiles){if(this.pool.isFull()&&(Za(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(y),y.rtt[p]){const v=this.pool.getObjectForId(y.rtt[p].id);if(v.stamp===y.rtt[p].stamp){this.pool.useObject(v);continue}}const _=this.pool.getOrCreateFreeObject();this.pool.useObject(_),this.pool.stampObject(_),y.rtt[p]={id:_.id,stamp:_.stamp},a.context.bindFramebuffer.set(_.fbo.framebuffer),a.context.clear({color:h.Color.transparent,stencil:0}),a.currentStencilSource=void 0;for(let v=0;v<m.length;v++){const S=a.style._layers[m[v]],T=S.source?this._coordsDescendingInv[S.source][y.tileID.key]:[y.tileID];a.context.viewport.set([0,0,_.fbo.width,_.fbo.height]),a._renderTileClippingMasks(S,T),a.renderLayer(a,a.style.sourceCaches[S.source],S,T),S.source&&(y.rttCoords[S.source]=this._coordsDescendingInvStr[S.source][y.tileID.key])}}return Za(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects(),Lr[n]}return!1}}const Xt=me,vl={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:void 0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,maplibreLogo:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:h.config.MAX_TILE_CACHE_ZOOM_LEVELS,localIdeographFontFamily:"sans-serif",transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,validateStyle:!0},Un=o=>{o.touchstart=o.dragStart,o.touchmoveWindow=o.dragMove,o.touchend=o.dragEnd},ea={showCompass:!0,showZoom:!0,visualizePitch:!1};class ro{constructor(t,n,a=!1){this._clickTolerance=10;const c=t.dragRotate._mouseRotate.getClickTolerance(),p=t.dragRotate._mousePitch.getClickTolerance();this.element=n,this.mouseRotate=dl({clickTolerance:c,enable:!0}),this.touchRotate=(({enable:m,clickTolerance:y,bearingDegreesPerPixelMoved:_=.8})=>{const v=new Zs;return new kr({clickTolerance:y,move:(S,T)=>({bearingDelta:(T.x-S.x)*_}),moveStateManager:v,enable:m,assignEvents:Un})})({clickTolerance:c,enable:!0}),this.map=t,a&&(this.mousePitch=Xs({clickTolerance:p,enable:!0}),this.touchPitch=(({enable:m,clickTolerance:y,pitchDegreesPerPixelMoved:_=-.5})=>{const v=new Zs;return new kr({clickTolerance:y,move:(S,T)=>({pitchDelta:(T.y-S.y)*_}),moveStateManager:v,enable:m,assignEvents:Un})})({clickTolerance:p,enable:!0})),h.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),J.addEventListener(n,"mousedown",this.mousedown),J.addEventListener(n,"touchstart",this.touchstart,{passive:!1}),J.addEventListener(n,"touchcancel",this.reset)}startMouse(t,n){this.mouseRotate.dragStart(t,n),this.mousePitch&&this.mousePitch.dragStart(t,n),J.disableDrag()}startTouch(t,n){this.touchRotate.dragStart(t,n),this.touchPitch&&this.touchPitch.dragStart(t,n),J.disableDrag()}moveMouse(t,n){const a=this.map,{bearingDelta:c}=this.mouseRotate.dragMove(t,n)||{};if(c&&a.setBearing(a.getBearing()+c),this.mousePitch){const{pitchDelta:p}=this.mousePitch.dragMove(t,n)||{};p&&a.setPitch(a.getPitch()+p)}}moveTouch(t,n){const a=this.map,{bearingDelta:c}=this.touchRotate.dragMove(t,n)||{};if(c&&a.setBearing(a.getBearing()+c),this.touchPitch){const{pitchDelta:p}=this.touchPitch.dragMove(t,n)||{};p&&a.setPitch(a.getPitch()+p)}}off(){const t=this.element;J.removeEventListener(t,"mousedown",this.mousedown),J.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),J.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),J.removeEventListener(window,"touchend",this.touchend),J.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){J.enableDrag(),J.removeEventListener(window,"mousemove",this.mousemove),J.removeEventListener(window,"mouseup",this.mouseup),J.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),J.removeEventListener(window,"touchend",this.touchend)}mousedown(t){this.startMouse(h.extend({},t,{ctrlKey:!0,preventDefault:()=>t.preventDefault()}),J.mousePos(this.element,t)),J.addEventListener(window,"mousemove",this.mousemove),J.addEventListener(window,"mouseup",this.mouseup)}mousemove(t){this.moveMouse(t,J.mousePos(this.element,t))}mouseup(t){this.mouseRotate.dragEnd(t),this.mousePitch&&this.mousePitch.dragEnd(t),this.offTemp()}touchstart(t){t.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=J.touchPos(this.element,t.targetTouches)[0],this.startTouch(t,this._startPos),J.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),J.addEventListener(window,"touchend",this.touchend))}touchmove(t){t.targetTouches.length!==1?this.reset():(this._lastPos=J.touchPos(this.element,t.targetTouches)[0],this.moveTouch(t,this._lastPos))}touchend(t){t.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()}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()}}let yr;function ta(o,t,n){if(o=new h.LngLat(o.lng,o.lat),t){const a=new h.LngLat(o.lng-360,o.lat),c=new h.LngLat(o.lng+360,o.lat),p=n.locationPoint(o).distSqr(t);n.locationPoint(a).distSqr(t)<p?o=a:n.locationPoint(c).distSqr(t)<p&&(o=c)}for(;Math.abs(o.lng-n.center.lng)>180;){const a=n.locationPoint(o);if(a.x>=0&&a.y>=0&&a.x<=n.width&&a.y<=n.height)break;o.lng>n.center.lng?o.lng-=360:o.lng+=360}return o}const un={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 ia(o,t,n){const a=o.classList;for(const c in un)a.remove(`maplibregl-${n}-anchor-${c}`);a.add(`maplibregl-${n}-anchor-${t}`)}class fs extends h.Evented{constructor(t,n){if(super(),(t instanceof HTMLElement||n)&&(t=h.extend({element:t},n)),h.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress"],this),this._anchor=t&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&t.pitchAlignment!=="auto"?t.pitchAlignment:this._rotationAlignment,t&&t.element)this._element=t.element,this._offset=h.Point.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=J.create("div"),this._element.setAttribute("aria-label","Map marker");const a=J.createNS("http://www.w3.org/2000/svg","svg"),c=41,p=27;a.setAttributeNS(null,"display","block"),a.setAttributeNS(null,"height",`${c}px`),a.setAttributeNS(null,"width",`${p}px`),a.setAttributeNS(null,"viewBox",`0 0 ${p} ${c}`);const m=J.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"stroke","none"),m.setAttributeNS(null,"stroke-width","1"),m.setAttributeNS(null,"fill","none"),m.setAttributeNS(null,"fill-rule","evenodd");const y=J.createNS("http://www.w3.org/2000/svg","g");y.setAttributeNS(null,"fill-rule","nonzero");const _=J.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"transform","translate(3.0, 29.0)"),_.setAttributeNS(null,"fill","#000000");const v=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const ne of v){const V=J.createNS("http://www.w3.org/2000/svg","ellipse");V.setAttributeNS(null,"opacity","0.04"),V.setAttributeNS(null,"cx","10.5"),V.setAttributeNS(null,"cy","5.80029008"),V.setAttributeNS(null,"rx",ne.rx),V.setAttributeNS(null,"ry",ne.ry),_.appendChild(V)}const S=J.createNS("http://www.w3.org/2000/svg","g");S.setAttributeNS(null,"fill",this._color);const T=J.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"),S.appendChild(T);const L=J.createNS("http://www.w3.org/2000/svg","g");L.setAttributeNS(null,"opacity","0.25"),L.setAttributeNS(null,"fill","#000000");const O=J.createNS("http://www.w3.org/2000/svg","path");O.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"),L.appendChild(O);const R=J.createNS("http://www.w3.org/2000/svg","g");R.setAttributeNS(null,"transform","translate(6.0, 7.0)"),R.setAttributeNS(null,"fill","#FFFFFF");const B=J.createNS("http://www.w3.org/2000/svg","g");B.setAttributeNS(null,"transform","translate(8.0, 8.0)");const $=J.createNS("http://www.w3.org/2000/svg","circle");$.setAttributeNS(null,"fill","#000000"),$.setAttributeNS(null,"opacity","0.25"),$.setAttributeNS(null,"cx","5.5"),$.setAttributeNS(null,"cy","5.5"),$.setAttributeNS(null,"r","5.4999962");const W=J.createNS("http://www.w3.org/2000/svg","circle");W.setAttributeNS(null,"fill","#FFFFFF"),W.setAttributeNS(null,"cx","5.5"),W.setAttributeNS(null,"cy","5.5"),W.setAttributeNS(null,"r","5.4999962"),B.appendChild($),B.appendChild(W),y.appendChild(_),y.appendChild(S),y.appendChild(L),y.appendChild(R),y.appendChild(B),a.appendChild(y),a.setAttributeNS(null,"height",c*this._scale+"px"),a.setAttributeNS(null,"width",p*this._scale+"px"),this._element.appendChild(a),this._offset=h.Point.convert(t&&t.offset||[0,-14])}this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",a=>{a.preventDefault()}),this._element.addEventListener("mousedown",a=>{a.preventDefault()}),ia(this._element,this._anchor,"marker"),this._popup=null}addTo(t){return this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),J.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=h.LngLat.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const c=Math.sqrt(Math.pow(13.5,2)/2);t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[c,-1*(38.1-13.5+c)],"bottom-right":[-c,-1*(38.1-13.5+c)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=t,this._lngLat&&this._popup.setLngLat(this._lngLat),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}_onKeyPress(t){const n=t.code,a=t.charCode||t.keyCode;n!=="Space"&&n!=="Enter"&&a!==32&&a!==13||this.togglePopup()}_onMapClick(t){const n=t.originalEvent.target,a=this._element;this._popup&&(n===a||a.contains(n))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const t=this._popup;return t?(t.isOpen()?t.remove():t.addTo(this._map),this):this}_update(t){if(!this._map)return;this._map.transform.renderWorldCopies&&(this._lngLat=ta(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);let n="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?n=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(n=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let a="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?a="rotateX(0deg)":this._pitchAlignment==="map"&&(a=`rotateX(${this._map.getPitch()}deg)`),t&&t.type!=="moveend"||(this._pos=this._pos.round()),J.setTransform(this._element,`${un[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${a} ${n}`),this._map.terrain&&!this._opacityTimeout&&(this._opacityTimeout=setTimeout(()=>{const c=this._map.unproject(this._pos),p=40075016686e-3*Math.abs(Math.cos(this._lngLat.lat*Math.PI/180))/Math.pow(2,this._map.transform.tileZoom+8);this._element.style.opacity=c.distanceTo(this._lngLat)>20*p?"0.2":"1.0",this._opacityTimeout=null},100))}getOffset(){return this._offset}setOffset(t){return this._offset=h.Point.convert(t),this._update(),this}_onMove(t){if(!this._isDragging){const n=this._clickTolerance||this._map._clickTolerance;this._isDragging=t.point.dist(this._pointerdownPos)>=n}this._isDragging&&(this._pos=t.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new h.Event("dragstart"))),this.fire(new h.Event("drag")))}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new h.Event("dragend")),this._state="inactive"}_addDragHandler(t){this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(this._pos).add(this._offset),this._pointerdownPos=t.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))}setDraggable(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&t!=="auto"?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}}const no={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Nn=0,dn=!1;const so={maxWidth:100,unit:"metric"};function ra(o,t,n){const a=n&&n.maxWidth||100,c=o._container.clientHeight/2,p=o.unproject([0,c]),m=o.unproject([a,c]),y=p.distanceTo(m);if(n&&n.unit==="imperial"){const _=3.2808*y;_>5280?pn(t,a,_/5280,o._getUIString("ScaleControl.Miles")):pn(t,a,_,o._getUIString("ScaleControl.Feet"))}else n&&n.unit==="nautical"?pn(t,a,y/1852,o._getUIString("ScaleControl.NauticalMiles")):y>=1e3?pn(t,a,y/1e3,o._getUIString("ScaleControl.Kilometers")):pn(t,a,y,o._getUIString("ScaleControl.Meters"))}function pn(o,t,n,a){const c=function(p){const m=Math.pow(10,`${Math.floor(p)}`.length-1);let y=p/m;return y=y>=10?10:y>=5?5:y>=3?3:y>=2?2:y>=1?1:function(_){const v=Math.pow(10,Math.ceil(-Math.log(_)/Math.LN10));return Math.round(_*v)/v}(y),m*y}(n);o.style.width=t*(c/n)+"px",o.innerHTML=`${c}&nbsp;${a}`}const na={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},ao=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function sa(o){if(o){if(typeof o=="number"){const t=Math.round(Math.sqrt(.5*Math.pow(o,2)));return{center:new h.Point(0,0),top:new h.Point(0,o),"top-left":new h.Point(t,t),"top-right":new h.Point(-t,t),bottom:new h.Point(0,-o),"bottom-left":new h.Point(t,-t),"bottom-right":new h.Point(-t,-t),left:new h.Point(o,0),right:new h.Point(-o,0)}}if(o instanceof h.Point||Array.isArray(o)){const t=h.Point.convert(o);return{center:t,top:t,"top-left":t,"top-right":t,bottom:t,"bottom-left":t,"bottom-right":t,left:t,right:t}}return{center:h.Point.convert(o.center||[0,0]),top:h.Point.convert(o.top||[0,0]),"top-left":h.Point.convert(o["top-left"]||[0,0]),"top-right":h.Point.convert(o["top-right"]||[0,0]),bottom:h.Point.convert(o.bottom||[0,0]),"bottom-left":h.Point.convert(o["bottom-left"]||[0,0]),"bottom-right":h.Point.convert(o["bottom-right"]||[0,0]),left:h.Point.convert(o.left||[0,0]),right:h.Point.convert(o.right||[0,0])}}return sa(new h.Point(0,0))}const aa=me,oa={setRTLTextPlugin:h.setRTLTextPlugin,getRTLTextPluginStatus:h.getRTLTextPluginStatus,Map:class extends Ue{constructor(o){var t;if(h.PerformanceUtils.mark(h.PerformanceMarkers.create),(o=h.extend({},vl,o)).minZoom!=null&&o.maxZoom!=null&&o.minZoom>o.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(o.minPitch!=null&&o.maxPitch!=null&&o.minPitch>o.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(o.minPitch!=null&&o.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(o.maxPitch!=null&&o.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new qs(o.minZoom,o.maxZoom,o.minPitch,o.maxPitch,o.renderWorldCopies),{bearingSnap:o.bearingSnap}),this._interactive=o.interactive,this._cooperativeGestures=o.cooperativeGestures,this._metaKey=navigator.platform.indexOf("Mac")===0?"metaKey":"ctrlKey",this._maxTileCacheSize=o.maxTileCacheSize,this._maxTileCacheZoomLevels=o.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=o.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=o.preserveDrawingBuffer,this._antialias=o.antialias,this._trackResize=o.trackResize,this._bearingSnap=o.bearingSnap,this._refreshExpiredTiles=o.refreshExpiredTiles,this._fadeDuration=o.fadeDuration,this._crossSourceCollisions=o.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=o.collectResourceTiming,this._renderTaskQueue=new to,this._controls=[],this._mapId=h.uniqueId(),this._locale=h.extend({},io,o.locale),this._clickTolerance=o.clickTolerance,this._pixelRatio=(t=o.pixelRatio)!==null&&t!==void 0?t:devicePixelRatio,this.transformCameraUpdate=o.transformCameraUpdate,this._imageQueueHandle=hr.addThrottleControl(()=>this.isMoving()),this._requestManager=new xi(o.transformRequest),typeof o.container=="string"){if(this._container=document.getElementById(o.container),!this._container)throw new Error(`Container '${o.container}' not found.`)}else{if(!(o.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=o.container}if(o.maxBounds&&this.setMaxBounds(o.maxBounds),h.bindAll(["_onWindowOnline","_onMapScroll","_cooperativeGesturesOnWheel","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),this.once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let n=!1;this._resizeObserver=new ResizeObserver(a=>{n?this._trackResize&&this.resize(a)._update():n=!0}),this._resizeObserver.observe(this._container)}this.handlers=new gr(this,o),this._cooperativeGestures&&this._setupCooperativeGestures(),this._hash=o.hash&&new ol(typeof o.hash=="string"&&o.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:o.center,zoom:o.zoom,bearing:o.bearing,pitch:o.pitch}),o.bounds&&(this.resize(),this.fitBounds(o.bounds,h.extend({},o.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=o.localIdeographFontFamily,this._validateStyle=o.validateStyle,o.style&&this.setStyle(o.style,{localIdeographFontFamily:o.localIdeographFontFamily}),o.attributionControl&&this.addControl(new Ge({customAttribution:o.customAttribution})),o.maplibreLogo&&this.addControl(new ps,o.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 h.Event(`${n.dataType}data`,n))}),this.on("dataloading",n=>{this.fire(new h.Event(`${n.dataType}dataloading`,n))}),this.on("dataabort",n=>{this.fire(new h.Event("sourcedataabort",n))})}_getMapId(){return this._mapId}addControl(o,t){if(t===void 0&&(t=o.getDefaultPosition?o.getDefaultPosition():"top-right"),!o||!o.onAdd)return this.fire(new h.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const n=o.onAdd(this);this._controls.push(o);const a=this._controlPositions[t];return t.indexOf("bottom")!==-1?a.insertBefore(n,a.firstChild):a.appendChild(n),this}removeControl(o){if(!o||!o.onRemove)return this.fire(new h.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(o);return t>-1&&this._controls.splice(t,1),o.onRemove(this),this}hasControl(o){return this._controls.indexOf(o)>-1}calculateCameraOptionsFromTo(o,t,n,a){return a==null&&this.terrain&&(a=this.transform.getElevation(n,this.terrain)),super.calculateCameraOptionsFromTo(o,t,n,a)}resize(o){var t;const n=this._containerDimensions(),a=n[0],c=n[1];this._resizeCanvas(a,c,this.getPixelRatio()),this.transform.resize(a,c),(t=this._requestedCameraState)===null||t===void 0||t.resize(a,c),this.painter.resize(a,c,this.getPixelRatio());const p=!this._moving;return p&&(this.stop(),this.fire(new h.Event("movestart",o)).fire(new h.Event("move",o))),this.fire(new h.Event("resize",o)),p&&this.fire(new h.Event("moveend",o)),this}getPixelRatio(){return this._pixelRatio}setPixelRatio(o){const[t,n]=this._containerDimensions();this._pixelRatio=o,this._resizeCanvas(t,n,o),this.painter.resize(t,n,o)}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(o){return this.transform.setMaxBounds(si.convert(o)),this._update()}setMinZoom(o){if((o=o??-2)>=-2&&o<=this.transform.maxZoom)return this.transform.minZoom=o,this._update(),this.getZoom()<o&&this.setZoom(o),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(o){if((o=o??22)>=this.transform.minZoom)return this.transform.maxZoom=o,this._update(),this.getZoom()>o&&this.setZoom(o),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(o){if((o=o??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(o>=0&&o<=this.transform.maxPitch)return this.transform.minPitch=o,this._update(),this.getPitch()<o&&this.setPitch(o),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(o){if((o=o??60)>85)throw new Error("maxPitch must be less than or equal to 85");if(o>=this.transform.minPitch)return this.transform.maxPitch=o,this._update(),this.getPitch()>o&&this.setPitch(o),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(o){return this.transform.renderWorldCopies=o,this._update()}getCooperativeGestures(){return this._cooperativeGestures}setCooperativeGestures(o){return this._cooperativeGestures=o,this._cooperativeGestures?this._setupCooperativeGestures():this._destroyCooperativeGestures(),this}project(o){return this.transform.locationPoint(h.LngLat.convert(o),this.style&&this.terrain)}unproject(o){return this.transform.pointLocation(h.Point.convert(o),this.terrain)}isMoving(){var o;return this._moving||((o=this.handlers)===null||o===void 0?void 0:o.isMoving())}isZooming(){var o;return this._zooming||((o=this.handlers)===null||o===void 0?void 0:o.isZooming())}isRotating(){var o;return this._rotating||((o=this.handlers)===null||o===void 0?void 0:o.isRotating())}_createDelegatedListener(o,t,n){if(o==="mouseenter"||o==="mouseover"){let a=!1;return{layer:t,listener:n,delegates:{mousemove:p=>{const m=this.getLayer(t)?this.queryRenderedFeatures(p.point,{layers:[t]}):[];m.length?a||(a=!0,n.call(this,new Zt(o,this,p.originalEvent,{features:m}))):a=!1},mouseout:()=>{a=!1}}}}if(o==="mouseleave"||o==="mouseout"){let a=!1;return{layer:t,listener:n,delegates:{mousemove:m=>{(this.getLayer(t)?this.queryRenderedFeatures(m.point,{layers:[t]}):[]).length?a=!0:a&&(a=!1,n.call(this,new Zt(o,this,m.originalEvent)))},mouseout:m=>{a&&(a=!1,n.call(this,new Zt(o,this,m.originalEvent)))}}}}{const a=c=>{const p=this.getLayer(t)?this.queryRenderedFeatures(c.point,{layers:[t]}):[];p.length&&(c.features=p,n.call(this,c),delete c.features)};return{layer:t,listener:n,delegates:{[o]:a}}}}on(o,t,n){if(n===void 0)return super.on(o,t);const a=this._createDelegatedListener(o,t,n);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[o]=this._delegatedListeners[o]||[],this._delegatedListeners[o].push(a);for(const c in a.delegates)this.on(c,a.delegates[c]);return this}once(o,t,n){if(n===void 0)return super.once(o,t);const a=this._createDelegatedListener(o,t,n);for(const c in a.delegates)this.once(c,a.delegates[c]);return this}off(o,t,n){return n===void 0?super.off(o,t):(this._delegatedListeners&&this._delegatedListeners[o]&&(a=>{const c=this._delegatedListeners[o];for(let p=0;p<c.length;p++){const m=c[p];if(m.layer===t&&m.listener===n){for(const y in m.delegates)this.off(y,m.delegates[y]);return c.splice(p,1),this}}})(),this)}queryRenderedFeatures(o,t){if(!this.style)return[];let n;const a=o instanceof h.Point||Array.isArray(o),c=a?o:[[0,0],[this.transform.width,this.transform.height]];if(t=t||(a?{}:o)||{},c instanceof h.Point||typeof c[0]=="number")n=[h.Point.convert(c)];else{const p=h.Point.convert(c[0]),m=h.Point.convert(c[1]);n=[p,new h.Point(m.x,p.y),m,new h.Point(p.x,m.y),p]}return this.style.queryRenderedFeatures(n,t,this.transform)}querySourceFeatures(o,t){return this.style.querySourceFeatures(o,t)}setStyle(o,t){return(t=h.extend({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},t)).diff!==!1&&t.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&o?(this._diffStyle(o,t),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._updateStyle(o,t))}setTransformRequest(o){return this._requestManager.setTransformRequest(o),this}_getUIString(o){const t=this._locale[o];if(t==null)throw new Error(`Missing UI string '${o}'`);return t}_updateStyle(o,t){if(t.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(o,t));const n=this.style&&t.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!o)),o?(this.style=new li(this,t||{}),this.style.setEventedParent(this,{style:this.style}),typeof o=="string"?this.style.loadURL(o,t,n):this.style.loadJSON(o,t,n),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new li(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(o,t){if(typeof o=="string"){const n=this._requestManager.transformRequest(o,Ct.Style);h.getJSON(n,(a,c)=>{a?this.fire(new h.ErrorEvent(a)):c&&this._updateDiff(c,t)})}else typeof o=="object"&&this._updateDiff(o,t)}_updateDiff(o,t){try{this.style.setState(o,t)&&this._update(!0)}catch(n){h.warnOnce(`Unable to perform style diff: ${n.message||n.error||n}. Rebuilding the style from scratch.`),this._updateStyle(o,t)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():h.warnOnce("There is no style added to the map.")}addSource(o,t){return this._lazyInitEmptyStyle(),this.style.addSource(o,t),this._update(!0)}isSourceLoaded(o){const t=this.style&&this.style.sourceCaches[o];if(t!==void 0)return t.loaded();this.fire(new h.ErrorEvent(new Error(`There is no source with ID '${o}'`)))}setTerrain(o){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),o){const t=this.style.sourceCaches[o.source];if(!t)throw new Error(`cannot load terrain, because there exists no source with ID: ${o.source}`);for(const n in this.style._layers){const a=this.style._layers[n];a.type==="hillshade"&&a.source===o.source&&h.warnOnce("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 _r(this.painter,t,o),this.painter.renderToTexture=new Rt(this.painter,this.terrain),this.transform.updateElevation(this.terrain),this._terrainDataCallback=n=>{n.dataType==="style"?this.terrain.sourceCache.freeRtt():n.dataType==="source"&&n.tile&&(n.sourceId===o.source&&this.transform.updateElevation(this.terrain),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.updateElevation(this.terrain);return this.fire(new h.Event("terrain",{terrain:o})),this}getTerrain(){return this.terrain&&this.terrain.options}areTilesLoaded(){const o=this.style&&this.style.sourceCaches;for(const t in o){const n=o[t]._tiles;for(const a in n){const c=n[a];if(c.state!=="loaded"&&c.state!=="errored")return!1}}return!0}addSourceType(o,t,n){return this._lazyInitEmptyStyle(),this.style.addSourceType(o,t,n)}removeSource(o){return this.style.removeSource(o),this._update(!0)}getSource(o){return this.style.getSource(o)}addImage(o,t,{pixelRatio:n=1,sdf:a=!1,stretchX:c,stretchY:p,content:m}={}){if(this._lazyInitEmptyStyle(),t instanceof HTMLImageElement||h.isImageBitmap(t)){const{width:y,height:_,data:v}=h.exported.getImageData(t);this.style.addImage(o,{data:new h.RGBAImage({width:y,height:_},v),pixelRatio:n,stretchX:c,stretchY:p,content:m,sdf:a,version:0})}else{if(t.width===void 0||t.height===void 0)return this.fire(new h.ErrorEvent(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:y,height:_,data:v}=t,S=t;this.style.addImage(o,{data:new h.RGBAImage({width:y,height:_},new Uint8Array(v)),pixelRatio:n,stretchX:c,stretchY:p,content:m,sdf:a,version:0,userImage:S}),S.onAdd&&S.onAdd(this,o)}}}updateImage(o,t){const n=this.style.getImage(o);if(!n)return this.fire(new h.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const a=t instanceof HTMLImageElement||h.isImageBitmap(t)?h.exported.getImageData(t):t,{width:c,height:p,data:m}=a;if(c===void 0||p===void 0)return this.fire(new h.ErrorEvent(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(c!==n.data.width||p!==n.data.height)return this.fire(new h.ErrorEvent(new Error("The width and height of the updated image must be that same as the previous version of the image")));const y=!(t instanceof HTMLImageElement||h.isImageBitmap(t));n.data.replace(m,y),this.style.updateImage(o,n)}getImage(o){return this.style.getImage(o)}hasImage(o){return o?!!this.style.getImage(o):(this.fire(new h.ErrorEvent(new Error("Missing required image id"))),!1)}removeImage(o){this.style.removeImage(o)}loadImage(o,t){hr.getImage(this._requestManager.transformRequest(o,Ct.Image),t)}listImages(){return this.style.listImages()}addLayer(o,t){return this._lazyInitEmptyStyle(),this.style.addLayer(o,t),this._update(!0)}moveLayer(o,t){return this.style.moveLayer(o,t),this._update(!0)}removeLayer(o){return this.style.removeLayer(o),this._update(!0)}getLayer(o){return this.style.getLayer(o)}setLayerZoomRange(o,t,n){return this.style.setLayerZoomRange(o,t,n),this._update(!0)}setFilter(o,t,n={}){return this.style.setFilter(o,t,n),this._update(!0)}getFilter(o){return this.style.getFilter(o)}setPaintProperty(o,t,n,a={}){return this.style.setPaintProperty(o,t,n,a),this._update(!0)}getPaintProperty(o,t){return this.style.getPaintProperty(o,t)}setLayoutProperty(o,t,n,a={}){return this.style.setLayoutProperty(o,t,n,a),this._update(!0)}getLayoutProperty(o,t){return this.style.getLayoutProperty(o,t)}setGlyphs(o,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(o,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(o,t,n={}){return this._lazyInitEmptyStyle(),this.style.addSprite(o,t,n,a=>{a||this._update(!0)}),this}removeSprite(o){return this._lazyInitEmptyStyle(),this.style.removeSprite(o),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(o,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(o,t,n=>{n||this._update(!0)}),this}setLight(o,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(o,t),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(o,t){return this.style.setFeatureState(o,t),this._update()}removeFeatureState(o,t){return this.style.removeFeatureState(o,t),this._update()}getFeatureState(o){return this.style.getFeatureState(o)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let o=0,t=0;return this._container&&(o=this._container.clientWidth||400,t=this._container.clientHeight||300),[o,t]}_setupContainer(){const o=this._container;o.classList.add("maplibregl-map");const t=this._canvasContainer=J.create("div","maplibregl-canvas-container",o);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=J.create("canvas","maplibregl-canvas",t),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");const n=this._containerDimensions();this._resizeCanvas(n[0],n[1],this.getPixelRatio());const a=this._controlContainer=J.create("div","maplibregl-control-container",o),c=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(p=>{c[p]=J.create("div",`maplibregl-ctrl-${p} `,a)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_cooperativeGesturesOnWheel(o){this._onCooperativeGesture(o,o[this._metaKey],1)}_setupCooperativeGestures(){this._cooperativeGesturesScreen=J.create("div","maplibregl-cooperative-gesture-screen",this._container);let o=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.windowsHelpText?this._cooperativeGestures.windowsHelpText:"Use Ctrl + scroll to zoom the map";navigator.platform.indexOf("Mac")===0&&(o=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.macHelpText?this._cooperativeGestures.macHelpText:"Use \u2318 + scroll to zoom the map"),this._cooperativeGesturesScreen.innerHTML=`
578
578
  <div class="maplibregl-desktop-message">${o}</div>
579
579
  <div class="maplibregl-mobile-message">${typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.mobileHelpText?this._cooperativeGestures.mobileHelpText:"Use two fingers to move the map"}</div>
580
- `,this._canvasContainer.addEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.add("maplibregl-cooperative-gestures")}_destroyCooperativeGestures(){Q.remove(this._cooperativeGesturesScreen),this._canvasContainer.removeEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.remove("maplibregl-cooperative-gestures")}_resizeCanvas(o,t,n){this._canvas.width=n*o,this._canvas.height=n*t,this._canvas.style.width=`${o}px`,this._canvas.style.height=`${t}px`}_setupPainter(){const o={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let t=null;this._canvas.addEventListener("webglcontextcreationerror",a=>{t={requestedAttributes:o},a&&(t.statusMessage=a.statusMessage,t.type=a.type)},{once:!0});const n=this._canvas.getContext("webgl2",o);if(!n){const a="Failed to initialize WebGL";throw t?(t.message=a,new Error(JSON.stringify(t))):new Error(a)}this.painter=new tl(n,this.transform),He.testSupport(n)}_contextLost(o){o.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new h.Event("webglcontextlost",{originalEvent:o}))}_contextRestored(o){this._setupPainter(),this.resize(),this._update(),this.fire(new h.Event("webglcontextrestored",{originalEvent:o}))}_onMapScroll(o){if(o.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}_onCooperativeGesture(o,t,n){return!t&&n<2&&(this._cooperativeGesturesScreen.classList.add("maplibregl-show"),setTimeout(()=>{this._cooperativeGesturesScreen.classList.remove("maplibregl-show")},100)),!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(o){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||o,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(o){return this._update(),this._renderTaskQueue.add(o)}_cancelRenderFrame(o){this._renderTaskQueue.remove(o)}_render(o){const t=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(o),this._removed)return;let n=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const c=this.transform.zoom,p=h.exported.now();this.style.zoomHistory.update(c,p);const m=new h.EvaluationParameters(c,{now:p,fadeDuration:t,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),y=m.crossFadingFactor();y===1&&y===this._crossFadingFactor||(n=!0,this._crossFadingFactor=y),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.updateElevation(this.terrain),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,t,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:t,showPadding:this.showPadding}),this.fire(new h.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,h.PerformanceUtils.mark(h.PerformanceMarkers.load),this.fire(new h.Event("load"))),this.style&&(this.style.hasTransitions()||n)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const a=this._sourcesDirty||this._styleDirty||this._placementDirty;return a||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new h.Event("idle")),!this._loaded||this._fullyLoaded||a||(this._fullyLoaded=!0,h.PerformanceUtils.mark(h.PerformanceMarkers.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){var o;this._hash&&this._hash.remove();for(const n of this._controls)n.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),hr.removeThrottleControl(this._imageQueueHandle),(o=this._resizeObserver)===null||o===void 0||o.disconnect();const t=this.painter.context.gl.getExtension("WEBGL_lose_context");t&&t.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),Q.remove(this._canvasContainer),Q.remove(this._controlContainer),this._cooperativeGestures&&this._destroyCooperativeGestures(),this._container.classList.remove("maplibregl-map"),h.PerformanceUtils.clearMetrics(),this._removed=!0,this.fire(new h.Event("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=h.exported.frame(o=>{h.PerformanceUtils.frame(o),this._frame=null,this._render(o)}))}_onWindowOnline(){this._update()}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(o){this._showTileBoundaries!==o&&(this._showTileBoundaries=o,this._update())}get showPadding(){return!!this._showPadding}set showPadding(o){this._showPadding!==o&&(this._showPadding=o,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(o){this._showCollisionBoxes!==o&&(this._showCollisionBoxes=o,o?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(o){this._showOverdrawInspector!==o&&(this._showOverdrawInspector=o,this._update())}get repaint(){return!!this._repaint}set repaint(o){this._repaint!==o&&(this._repaint=o,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(o){this._vertices=o,this._update()}get version(){return Zt}getCameraTargetElevation(){return this.transform.elevation}},NavigationControl:class{constructor(o){this.options=h.extend({},Ks,o),this._container=Q.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(h.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",t=>this._map.zoomIn({},{originalEvent:t})),Q.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",t=>this._map.zoomOut({},{originalEvent:t})),Q.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(h.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("maplibregl-ctrl-compass",t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})}),this._compassIcon=Q.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const o=this._map.getZoom(),t=o===this._map.getMaxZoom(),n=o===this._map.getMinZoom();this._zoomInButton.disabled=t,this._zoomOutButton.disabled=n,this._zoomInButton.setAttribute("aria-disabled",t.toString()),this._zoomOutButton.setAttribute("aria-disabled",n.toString())}_rotateCompassArrow(){const o=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=o}onAdd(o){return this._map=o,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 eo(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){Q.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(o,t){const n=Q.create("button",o,this._container);return n.type="button",n.addEventListener("click",t),n}_setButtonTitle(o,t){const n=this._map._getUIString(`NavigationControl.${t}`);o.title=n,o.setAttribute("aria-label",n)}},GeolocateControl:class extends h.Evented{constructor(o){super(),this.options=h.extend({},to,o),h.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker"],this)}onAdd(o){return this._map=o,this._container=Q.create("div","maplibregl-ctrl maplibregl-ctrl-group"),function(t,n=!1){yr===void 0||n?window.navigator.permissions!==void 0?window.navigator.permissions.query({name:"geolocation"}).then(a=>{yr=a.state!=="denied",t(yr)}).catch(()=>{yr=!!window.navigator.geolocation,t(yr)}):(yr=!!window.navigator.geolocation,t(yr)):t(yr)}(this._setupUI),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(),Q.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,zn=0,an=!1}_isOutOfMapMaxBounds(o){const t=this._map.getMaxBounds(),n=o.coords;return t&&(n.longitude<t.getWest()||n.longitude>t.getEast()||n.latitude<t.getSouth()||n.latitude>t.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}`)}}_onSuccess(o){if(this._map){if(this._isOutOfMapMaxBounds(o))return this._setErrorState(),this.fire(new h.Event("outofmaxbounds",o)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=o,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(o),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(o),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new h.Event("geolocate",o)),this._finish()}}_updateCamera(o){const t=new h.LngLat(o.coords.longitude,o.coords.latitude),n=o.coords.accuracy,a=this._map.getBearing(),c=h.extend({bearing:a},this.options.fitBoundsOptions),p=Gt.fromLngLat(t,n);this._map.fitBounds(p,c,{geolocateSource:!0})}_updateMarker(o){if(o){const t=new h.LngLat(o.coords.longitude,o.coords.latitude);this._accuracyCircleMarker.setLngLat(t).addTo(this._map),this._userLocationDotMarker.setLngLat(t).addTo(this._map),this._accuracy=o.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const o=this._map.getBounds(),t=o.getSouthEast(),n=o.getNorthEast(),a=t.distanceTo(n),c=Math.ceil(this._accuracy/(a/this._map._container.clientHeight)*2);this._circleElement.style.width=`${c}px`,this._circleElement.style.height=`${c}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_onError(o){if(this._map){if(this.options.trackUserLocation)if(o.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;const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(o.code===3&&an)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new h.Event("error",o)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(o){if(this._map){if(this._container.addEventListener("contextmenu",t=>t.preventDefault()),this._geolocateButton=Q.create("button","maplibregl-ctrl-geolocate",this._container),Q.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",o===!1){h.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}else{const t=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=Q.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new hs(this._dotElement),this._circleElement=Q.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new hs({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",t=>{t.geolocateSource||this._watchState!=="ACTIVE_LOCK"||t.originalEvent&&t.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 h.Event("trackuserlocationend")))})}}trigger(){if(!this._setup)return h.warnOnce("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new h.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":zn--,an=!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 h.Event("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 h.Event("trackuserlocationstart"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),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 o;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),zn++,zn>1?(o={maximumAge:6e5,timeout:0},an=!0):(o=this.options.positionOptions,an=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,o)}}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)}},AttributionControl:Ze,LogoControl:cs,ScaleControl:class{constructor(o){this.options=h.extend({},io,o),h.bindAll(["_onMove","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_onMove(){Qs(this._map,this._container,this.options)}onAdd(o){return this._map=o,this._container=Q.create("div","maplibregl-ctrl maplibregl-ctrl-scale",o.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){Q.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}setUnit(o){this.options.unit=o,Qs(this._map,this._container,this.options)}},FullscreenControl:class extends h.Evented{constructor(o={}){super(),this._onFullscreenChange=()=>{(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,o&&o.container&&(o.container instanceof HTMLElement?this._container=o.container:h.warnOnce("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(o){return this._map=o,this._container||(this._container=this._map.getContainer()),this._controlContainer=Q.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){Q.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const o=this._fullscreenButton=Q.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);Q.create("span","maplibregl-ctrl-icon",o).setAttribute("aria-hidden","true"),o.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const o=this._getTitle();this._fullscreenButton.setAttribute("aria-label",o),this._fullscreenButton.title=o}_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 h.Event("fullscreenstart")),this._map._cooperativeGestures&&(this._prevCooperativeGestures=this._map._cooperativeGestures,this._map.setCooperativeGestures())):(this.fire(new h.Event("fullscreenend")),this._prevCooperativeGestures&&(this._map.setCooperativeGestures(this._prevCooperativeGestures),delete this._prevCooperativeGestures))}_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()}},TerrainControl:class{constructor(o){this.options=o,h.bindAll(["_toggleTerrain","_updateTerrainIcon"],this)}onAdd(o){return this._map=o,this._container=Q.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=Q.create("button","maplibregl-ctrl-terrain",this._container),Q.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(){Q.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}_toggleTerrain(){this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()}_updateTerrainIcon(){this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),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.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))}},Popup:class extends h.Evented{constructor(o){super(),this.options=h.extend(Object.create(ea),o),h.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this)}addTo(o){return this._map&&this.remove(),this._map=o,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 h.Event("open")),this}isOpen(){return!!this._map}remove(){return this._content&&Q.remove(this._content),this._container&&(Q.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new h.Event("close")),this}getLngLat(){return this._lngLat}setLngLat(o){return this._lngLat=h.LngLat.convert(o),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(o){return this.setDOMContent(document.createTextNode(o))}setHTML(o){const t=document.createDocumentFragment(),n=document.createElement("body");let a;for(n.innerHTML=o;a=n.firstChild,a;)t.appendChild(a);return this.setDOMContent(t)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(o){return this.options.maxWidth=o,this._update(),this}setDOMContent(o){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=Q.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(o),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(o){this._container&&this._container.classList.add(o)}removeClassName(o){this._container&&this._container.classList.remove(o)}setOffset(o){return this.options.offset=o,this._update(),this}toggleClassName(o){if(this._container)return this._container.classList.toggle(o)}_createCloseButton(){this.options.closeButton&&(this._closeButton=Q.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_onMouseUp(o){this._update(o.point)}_onMouseMove(o){this._update(o.point)}_onDrag(o){this._update(o.point)}_update(o){if(!this._map||!this._lngLat&&!this._trackPointer||!this._content||(this._container||(this._container=Q.create("div","maplibregl-popup",this._map.getContainer()),this._tip=Q.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach(p=>this._container.classList.add(p)),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")),this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=Ys(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!o))return;const t=this._pos=this._trackPointer&&o?o:this._map.project(this._lngLat);let n=this.options.anchor;const a=ta(this.options.offset);if(!n){const p=this._container.offsetWidth,m=this._container.offsetHeight;let y;y=t.y+a.bottom.y<m?["top"]:t.y>this._map.transform.height-m?["bottom"]:[],t.x<p/2?y.push("left"):t.x>this._map.transform.width-p/2&&y.push("right"),n=y.length===0?"bottom":y.join("-")}const c=t.add(a[n]).round();Q.setTransform(this._container,`${sn[n]} translate(${c.x}px,${c.y}px)`),Js(this._container,n,"popup")}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const o=this._container.querySelector(ro);o&&o.focus()}_onClose(){this.remove()}},Marker:hs,Style:tr,LngLat:h.LngLat,LngLatBounds:Gt,Point:h.Point,MercatorCoordinate:h.MercatorCoordinate,Evented:h.Evented,AJAXError:h.AJAXError,config:h.config,CanvasSource:Kr,GeoJSONSource:Qi,ImageSource:Zi,RasterDEMTileSource:vn,RasterTileSource:Ur,VectorTileSource:Vn,VideoSource:oe,prewarm:function(){Er().acquire(Ie)},clearPrewarmedResources:function(){const o=dr;o&&(o.isPreloaded()&&o.numActive()===1?(o.release(Ie),dr=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},get version(){return ia},get workerCount(){return Si.workerCount},set workerCount(o){Si.workerCount=o},get maxParallelImageRequests(){return h.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(o){h.config.MAX_PARALLEL_IMAGE_REQUESTS=o},get workerUrl(){return h.config.WORKER_URL},set workerUrl(o){h.config.WORKER_URL=o},addProtocol(o,t){h.config.REGISTERED_PROTOCOLS[o]=t},removeProtocol(o){delete h.config.REGISTERED_PROTOCOLS[o]}};return Ws.extend(ra,{isSafari:h.isSafari,getPerformanceMetrics:h.PerformanceUtils.getPerformanceMetrics}),ra});var le=te;return le})})(ah);var qd=ah.exports,rt=sh(qd);const oh="3.7.5",Zd=oh,Xd=typeof atob=="function",Wd=typeof btoa=="function",gs=typeof Buffer=="function",lh=typeof TextDecoder=="function"?new TextDecoder:void 0,ch=typeof TextEncoder=="function"?new TextEncoder:void 0,Hd="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",ma=Array.prototype.slice.call(Hd),To=(A=>{let x={};return A.forEach((k,K)=>x[k]=K),x})(ma),Kd=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,mi=String.fromCharCode.bind(String),hh=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):A=>new Uint8Array(Array.prototype.slice.call(A,0)),uh=A=>A.replace(/=/g,"").replace(/[+\/]/g,x=>x=="+"?"-":"_"),dh=A=>A.replace(/[^A-Za-z0-9\+\/]/g,""),ph=A=>{let x,k,K,te,ue="";const le=A.length%3;for(let h=0;h<A.length;){if((k=A.charCodeAt(h++))>255||(K=A.charCodeAt(h++))>255||(te=A.charCodeAt(h++))>255)throw new TypeError("invalid character found");x=k<<16|K<<8|te,ue+=ma[x>>18&63]+ma[x>>12&63]+ma[x>>6&63]+ma[x&63]}return le?ue.slice(0,le-3)+"===".substring(le):ue},Ol=Wd?A=>btoa(A):gs?A=>Buffer.from(A,"binary").toString("base64"):ph,Ul=gs?A=>Buffer.from(A).toString("base64"):A=>{let k=[];for(let K=0,te=A.length;K<te;K+=4096)k.push(mi.apply(null,A.subarray(K,K+4096)));return Ol(k.join(""))},So=(A,x=!1)=>x?uh(Ul(A)):Ul(A),Yd=A=>{if(A.length<2){var x=A.charCodeAt(0);return x<128?A:x<2048?mi(192|x>>>6)+mi(128|x&63):mi(224|x>>>12&15)+mi(128|x>>>6&63)+mi(128|x&63)}else{var x=65536+(A.charCodeAt(0)-55296)*1024+(A.charCodeAt(1)-56320);return mi(240|x>>>18&7)+mi(128|x>>>12&63)+mi(128|x>>>6&63)+mi(128|x&63)}},Jd=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,fh=A=>A.replace(Jd,Yd),mh=gs?A=>Buffer.from(A,"utf8").toString("base64"):ch?A=>Ul(ch.encode(A)):A=>Ol(fh(A)),_s=(A,x=!1)=>x?uh(mh(A)):mh(A),gh=A=>_s(A,!0),Qd=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,ep=A=>{switch(A.length){case 4:var x=(7&A.charCodeAt(0))<<18|(63&A.charCodeAt(1))<<12|(63&A.charCodeAt(2))<<6|63&A.charCodeAt(3),k=x-65536;return mi((k>>>10)+55296)+mi((k&1023)+56320);case 3:return mi((15&A.charCodeAt(0))<<12|(63&A.charCodeAt(1))<<6|63&A.charCodeAt(2));default:return mi((31&A.charCodeAt(0))<<6|63&A.charCodeAt(1))}},_h=A=>A.replace(Qd,ep),yh=A=>{if(A=A.replace(/\s+/g,""),!Kd.test(A))throw new TypeError("malformed base64.");A+="==".slice(2-(A.length&3));let x,k="",K,te;for(let ue=0;ue<A.length;)x=To[A.charAt(ue++)]<<18|To[A.charAt(ue++)]<<12|(K=To[A.charAt(ue++)])<<6|(te=To[A.charAt(ue++)]),k+=K===64?mi(x>>16&255):te===64?mi(x>>16&255,x>>8&255):mi(x>>16&255,x>>8&255,x&255);return k},Nl=Xd?A=>atob(dh(A)):gs?A=>Buffer.from(A,"base64").toString("binary"):yh,xh=gs?A=>hh(Buffer.from(A,"base64")):A=>hh(Nl(A).split("").map(x=>x.charCodeAt(0))),vh=A=>xh(bh(A)),tp=gs?A=>Buffer.from(A,"base64").toString("utf8"):lh?A=>lh.decode(xh(A)):A=>_h(Nl(A)),bh=A=>dh(A.replace(/[-_]/g,x=>x=="-"?"+":"/")),Vl=A=>tp(bh(A)),ip=A=>{if(typeof A!="string")return!1;const x=A.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(x)||!/[^\s0-9a-zA-Z\-_]/.test(x)},wh=A=>({value:A,enumerable:!1,writable:!0,configurable:!0}),Th=function(){const A=(x,k)=>Object.defineProperty(String.prototype,x,wh(k));A("fromBase64",function(){return Vl(this)}),A("toBase64",function(x){return _s(this,x)}),A("toBase64URI",function(){return _s(this,!0)}),A("toBase64URL",function(){return _s(this,!0)}),A("toUint8Array",function(){return vh(this)})},Sh=function(){const A=(x,k)=>Object.defineProperty(Uint8Array.prototype,x,wh(k));A("toBase64",function(x){return So(this,x)}),A("toBase64URI",function(){return So(this,!0)}),A("toBase64URL",function(){return So(this,!0)})},rp={version:oh,VERSION:Zd,atob:Nl,atobPolyfill:yh,btoa:Ol,btoaPolyfill:ph,fromBase64:Vl,toBase64:_s,encode:_s,encodeURI:gh,encodeURL:gh,utob:fh,btou:_h,decode:Vl,isValid:ip,fromUint8Array:So,toUint8Array:vh,extendString:Th,extendUint8Array:Sh,extendBuiltins:()=>{Th(),Sh()}};var $l={exports:{}},ys=typeof Reflect=="object"?Reflect:null,Eh=ys&&typeof ys.apply=="function"?ys.apply:function(x,k,K){return Function.prototype.apply.call(x,k,K)},Eo;ys&&typeof ys.ownKeys=="function"?Eo=ys.ownKeys:Object.getOwnPropertySymbols?Eo=function(x){return Object.getOwnPropertyNames(x).concat(Object.getOwnPropertySymbols(x))}:Eo=function(x){return Object.getOwnPropertyNames(x)};function np(A){console&&console.warn&&console.warn(A)}var Ih=Number.isNaN||function(x){return x!==x};function St(){St.init.call(this)}$l.exports=St,$l.exports.once=lp,St.EventEmitter=St,St.prototype._events=void 0,St.prototype._eventsCount=0,St.prototype._maxListeners=void 0;var Ah=10;function Io(A){if(typeof A!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof A)}Object.defineProperty(St,"defaultMaxListeners",{enumerable:!0,get:function(){return Ah},set:function(A){if(typeof A!="number"||A<0||Ih(A))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+A+".");Ah=A}}),St.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},St.prototype.setMaxListeners=function(x){if(typeof x!="number"||x<0||Ih(x))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+x+".");return this._maxListeners=x,this};function Ch(A){return A._maxListeners===void 0?St.defaultMaxListeners:A._maxListeners}St.prototype.getMaxListeners=function(){return Ch(this)},St.prototype.emit=function(x){for(var k=[],K=1;K<arguments.length;K++)k.push(arguments[K]);var te=x==="error",ue=this._events;if(ue!==void 0)te=te&&ue.error===void 0;else if(!te)return!1;if(te){var le;if(k.length>0&&(le=k[0]),le instanceof Error)throw le;var h=new Error("Unhandled error."+(le?" ("+le.message+")":""));throw h.context=le,h}var me=ue[x];if(me===void 0)return!1;if(typeof me=="function")Eh(me,this,k);else for(var Q=me.length,He=Lh(me,Q),K=0;K<Q;++K)Eh(He[K],this,k);return!0};function Ph(A,x,k,K){var te,ue,le;if(Io(k),ue=A._events,ue===void 0?(ue=A._events=Object.create(null),A._eventsCount=0):(ue.newListener!==void 0&&(A.emit("newListener",x,k.listener?k.listener:k),ue=A._events),le=ue[x]),le===void 0)le=ue[x]=k,++A._eventsCount;else if(typeof le=="function"?le=ue[x]=K?[k,le]:[le,k]:K?le.unshift(k):le.push(k),te=Ch(A),te>0&&le.length>te&&!le.warned){le.warned=!0;var h=new Error("Possible EventEmitter memory leak detected. "+le.length+" "+String(x)+" listeners added. Use emitter.setMaxListeners() to increase limit");h.name="MaxListenersExceededWarning",h.emitter=A,h.type=x,h.count=le.length,np(h)}return A}St.prototype.addListener=function(x,k){return Ph(this,x,k,!1)},St.prototype.on=St.prototype.addListener,St.prototype.prependListener=function(x,k){return Ph(this,x,k,!0)};function sp(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Mh(A,x,k){var K={fired:!1,wrapFn:void 0,target:A,type:x,listener:k},te=sp.bind(K);return te.listener=k,K.wrapFn=te,te}St.prototype.once=function(x,k){return Io(k),this.on(x,Mh(this,x,k)),this},St.prototype.prependOnceListener=function(x,k){return Io(k),this.prependListener(x,Mh(this,x,k)),this},St.prototype.removeListener=function(x,k){var K,te,ue,le,h;if(Io(k),te=this._events,te===void 0)return this;if(K=te[x],K===void 0)return this;if(K===k||K.listener===k)--this._eventsCount===0?this._events=Object.create(null):(delete te[x],te.removeListener&&this.emit("removeListener",x,K.listener||k));else if(typeof K!="function"){for(ue=-1,le=K.length-1;le>=0;le--)if(K[le]===k||K[le].listener===k){h=K[le].listener,ue=le;break}if(ue<0)return this;ue===0?K.shift():ap(K,ue),K.length===1&&(te[x]=K[0]),te.removeListener!==void 0&&this.emit("removeListener",x,h||k)}return this},St.prototype.off=St.prototype.removeListener,St.prototype.removeAllListeners=function(x){var k,K,te;if(K=this._events,K===void 0)return this;if(K.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):K[x]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete K[x]),this;if(arguments.length===0){var ue=Object.keys(K),le;for(te=0;te<ue.length;++te)le=ue[te],le!=="removeListener"&&this.removeAllListeners(le);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(k=K[x],typeof k=="function")this.removeListener(x,k);else if(k!==void 0)for(te=k.length-1;te>=0;te--)this.removeListener(x,k[te]);return this};function kh(A,x,k){var K=A._events;if(K===void 0)return[];var te=K[x];return te===void 0?[]:typeof te=="function"?k?[te.listener||te]:[te]:k?op(te):Lh(te,te.length)}St.prototype.listeners=function(x){return kh(this,x,!0)},St.prototype.rawListeners=function(x){return kh(this,x,!1)},St.listenerCount=function(A,x){return typeof A.listenerCount=="function"?A.listenerCount(x):zh.call(A,x)},St.prototype.listenerCount=zh;function zh(A){var x=this._events;if(x!==void 0){var k=x[A];if(typeof k=="function")return 1;if(k!==void 0)return k.length}return 0}St.prototype.eventNames=function(){return this._eventsCount>0?Eo(this._events):[]};function Lh(A,x){for(var k=new Array(x),K=0;K<x;++K)k[K]=A[K];return k}function ap(A,x){for(;x+1<A.length;x++)A[x]=A[x+1];A.pop()}function op(A){for(var x=new Array(A.length),k=0;k<x.length;++k)x[k]=A[k].listener||A[k];return x}function lp(A,x){return new Promise(function(k,K){function te(le){A.removeListener(x,ue),K(le)}function ue(){typeof A.removeListener=="function"&&A.removeListener("error",te),k([].slice.call(arguments))}Dh(A,x,ue,{once:!0}),x!=="error"&&cp(A,te,{once:!0})})}function cp(A,x,k){typeof A.on=="function"&&Dh(A,"error",x,k)}function Dh(A,x,k,K){if(typeof A.on=="function")K.once?A.once(x,k):A.on(x,k);else if(typeof A.addEventListener=="function")A.addEventListener(x,function te(ue){K.once&&A.removeEventListener(x,te),k(ue)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof A)}var hp=$l.exports,up=sh(hp);const lr={AUTO:"auto",STYLE_LOCK:"style_lock",LATIN:"latin",NON_LATIN:"nonlatin",LOCAL:"",ALBANIAN:"sq",AMHARIC:"am",ARABIC:"ar",ARMENIAN:"hy",AZERBAIJANI:"az",BASQUE:"eu",BELORUSSIAN:"be",BOSNIAN:"bs",BRETON:"br",BULGARIAN:"bg",CATALAN:"ca",CHINESE:"zh",CORSICAN:"co",CROATIAN:"hr",CZECH:"cs",DANISH:"da",DUTCH:"nl",ENGLISH:"en",ESPERANTO:"eo",ESTONIAN:"et",FINNISH:"fi",FRENCH:"fr",FRISIAN:"fy",GEORGIAN:"ka",GERMAN:"de",GREEK:"el",HEBREW:"he",HINDI:"hi",HUNGARIAN:"hu",ICELANDIC:"is",INDONESIAN:"id",IRISH:"ga",ITALIAN:"it",JAPANESE:"ja",JAPANESE_HIRAGANA:"ja-Hira",JAPANESE_KANA:"ja_kana",JAPANESE_LATIN:"ja_rm",JAPANESE_2018:"ja-Latn",KANNADA:"kn",KAZAKH:"kk",KOREAN:"ko",KOREAN_LATIN:"ko-Latn",KURDISH:"ku",ROMAN_LATIN:"la",LATVIAN:"lv",LITHUANIAN:"lt",LUXEMBOURGISH:"lb",MACEDONIAN:"mk",MALAYALAM:"ml",MALTESE:"mt",NORWEGIAN:"no",OCCITAN:"oc",POLISH:"pl",PORTUGUESE:"pt",ROMANIAN:"ro",ROMANSH:"rm",RUSSIAN:"ru",SCOTTISH_GAELIC:"gd",SERBIAN_CYRILLIC:"sr",SERBIAN_LATIN:"sr-Latn",SLOVAK:"sk",SLOVENE:"sl",SPANISH:"es",SWEDISH:"sv",TAMIL:"ta",TELUGU:"te",THAI:"th",TURKISH:"tr",UKRAINIAN:"uk",WELSH:"cy"},dp=new Set(Object.values(lr));function Rh(A){return dp.has(A)}const pp=new Set(Object.values(lr));function jl(){if(typeof navigator>"u")return Intl.DateTimeFormat().resolvedOptions().locale.split("-")[0];const A=Array.from(new Set(navigator.languages.map(x=>x.split("-")[0]))).filter(x=>pp.has(x));return A.length?A[0]:lr.LATIN}function fp(){return typeof self<"u"?fetch.bind(self):typeof global<"u"&&global.fetch?global.fetch:null}class mp{constructor(){this._apiKey="",this._fetch=fp()}set apiKey(x){this._apiKey=x}get apiKey(){return this._apiKey}set fetch(x){this._fetch=x}get fetch(){return this._fetch}}const Ji=new mp,ga={AUTO:"auto",ALBANIAN:"sq",ARABIC:"ar",ARMENIAN:"hy",AZERBAIJANI:"az",BELORUSSIAN:"be",BOSNIAN:"bs",BRETON:"br",BULGARIAN:"bg",CATALAN:"ca",CHINESE:"zh",CROATIAN:"hr",CZECH:"cs",DANISH:"da",DUTCH:"nl",ENGLISH:"en",ESPERANTO:"eo",ESTONIAN:"et",FINNISH:"fi",FRENCH:"fr",FRISIAN:"fy",GEORGIAN:"ka",GERMAN:"de",GREEK:"el",HEBREW:"he",HUNGARIAN:"hu",ICELANDIC:"is",IRISH:"ga",ITALIAN:"it",JAPANESE:"ja",KANNADA:"kn",KAZAKH:"kk",KOREAN:"ko",ROMAN_LATIN:"la",LATVIAN:"lv",LITHUANIAN:"lt",LUXEMBOURGISH:"lb",MACEDONIAN:"mk",MALTESE:"mt",NORWEGIAN:"no",POLISH:"pl",PORTUGUESE:"pt",ROMANIAN:"ro",ROMANSH:"rm",RUSSIAN:"ru",SCOTTISH_GAELIC:"gd",SERBIAN_CYRILLIC:"sr",SLOVAK:"sk",SLOVENE:"sl",SPANISH:"es",SWEDISH:"sv",THAI:"th",TURKISH:"tr",UKRAINIAN:"uk",WELSH:"cy"},gp=new Set(Object.values(ga));function _p(){if(typeof navigator>"u")return Intl.DateTimeFormat().resolvedOptions().locale.split("-")[0];const A=Array.from(new Set(navigator.languages.map(x=>x.split("-")[0]))).filter(x=>gp.has(x));return A.length?A[0]:ga.ENGLISH}var yp=(A,x,k)=>new Promise((K,te)=>{var ue=me=>{try{h(k.next(me))}catch(Q){te(Q)}},le=me=>{try{h(k.throw(me))}catch(Q){te(Q)}},h=me=>me.done?K(me.value):Promise.resolve(me.value).then(ue,le);h((k=k.apply(A,x)).next())});function pn(A){return yp(this,arguments,function*(x,k={}){if(Ji.fetch===null)throw new Error("The fetch function was not found. If on NodeJS < 18 please specify the fetch function with config.fetch");if(new URL(x).searchParams.get("key").trim()==="")throw new Error("The MapTiler Cloud API key is missing. Set it in `config.apiKey` or get one for free at https://maptiler.com");return Ji.fetch(x,k)})}const cr={maptilerApiURL:"https://api.maptiler.com/",mapStyle:"streets-v2"};Object.freeze(cr);class Zr extends Error{constructor(x,k=""){super(`Call to enpoint ${x.url} failed with the status code ${x.status}. ${k}`),this.res=x}}var Ao=(A,x,k)=>new Promise((K,te)=>{var ue=me=>{try{h(k.next(me))}catch(Q){te(Q)}},le=me=>{try{h(k.throw(me))}catch(Q){te(Q)}},h=me=>me.done?K(me.value):Promise.resolve(me.value).then(ue,le);h((k=k.apply(A,x)).next())});const Co={400:"Query too long / Invalid parameters",403:"Key is missing, invalid or restricted"};function Bh(A,x){if(x.language==null)return;const k=Array.from(new Set((Array.isArray(x.language)?x.language:[x.language]).map(K=>K===ga.AUTO?_p():K))).join(",");A.set("language",k)}function Fh(A,x){var k;A.set("key",(k=x.apiKey)!=null?k:Ji.apiKey),x.limit!=null&&A.set("limit",String(x.limit)),x.types!=null&&A.set("types",x.types.join(",")),Bh(A,x)}function Oh(A,x){Fh(A,x),x.bbox!=null&&A.set("bbox",x.bbox.join(",")),x.proximity!=null&&A.set("proximity",x.proximity.join(",")),x.country!=null&&A.set("country",x.country.join(",")),x.fuzzyMatch!=null&&A.set("fuzzyMatch",x.fuzzyMatch?"true":"false"),x.autocomplete!=null&&A.set("autocomplete",x.autocomplete?"true":"false")}function xp(A){return Ao(this,arguments,function*(x,k={}){var K;if(typeof x!="string"||x.trim().length===0)throw new Error("The query must be a non-empty string");const te=new URL(`geocoding/${encodeURIComponent(x)}.json`,cr.maptilerApiURL),{searchParams:ue}=te;Oh(ue,k);const le=te.toString(),h=yield pn(le);if(!h.ok)throw new Zr(h,(K=Co[h.status])!=null?K:"");return yield h.json()})}function vp(A){return Ao(this,arguments,function*(x,k={}){var K;if(!Array.isArray(x)||x.length<2)throw new Error("The position must be an array of form [lng, lat].");const te=new URL(`geocoding/${x[0]},${x[1]}.json`,cr.maptilerApiURL);Fh(te.searchParams,k);const ue=te.toString(),le=yield pn(ue);if(!le.ok)throw new Zr(le,(K=Co[le.status])!=null?K:"");return yield le.json()})}function bp(A){return Ao(this,arguments,function*(x,k={}){var K;const te=new URL(`geocoding/${x}.json`,cr.maptilerApiURL);Bh(te.searchParams,k);const ue=te.toString(),le=yield pn(ue);if(!le.ok)throw new Zr(le,(K=Co[le.status])!=null?K:"");return yield le.json()})}function wp(A){return Ao(this,arguments,function*(x,k={}){var K;if(!x.length)return[];const te=x.map(He=>encodeURIComponent(He)).join(";"),ue=new URL(`geocoding/${te}.json`,cr.maptilerApiURL),{searchParams:le}=ue;Oh(le,k);const h=ue.toString(),me=yield pn(h);if(!me.ok)throw new Zr(me,(K=Co[me.status])!=null?K:"");const Q=yield me.json();return x.length===1?[Q]:Q})}const Tp={forward:xp,reverse:vp,byId:bp,batch:wp,language:ga};var Sp=(A,x,k)=>new Promise((K,te)=>{var ue=me=>{try{h(k.next(me))}catch(Q){te(Q)}},le=me=>{try{h(k.throw(me))}catch(Q){te(Q)}},h=me=>me.done?K(me.value):Promise.resolve(me.value).then(ue,le);h((k=k.apply(A,x)).next())});const Uh={403:"Key is missing, invalid or restricted"};function Ep(){return Sp(this,arguments,function*(A={}){var x;const k=new URL("geolocation/ip.json",cr.maptilerApiURL);k.searchParams.set("key",(x=A.apiKey)!=null?x:Ji.apiKey);const K=k.toString(),te=yield pn(K);if(!te.ok)throw new Zr(te,te.status in Uh?Uh[te.status]:"");return yield te.json()})}const Gl={info:Ep};var Nh=(A,x,k)=>new Promise((K,te)=>{var ue=me=>{try{h(k.next(me))}catch(Q){te(Q)}},le=me=>{try{h(k.throw(me))}catch(Q){te(Q)}},h=me=>me.done?K(me.value):Promise.resolve(me.value).then(ue,le);h((k=k.apply(A,x)).next())});const Po={403:"Key is missing, invalid or restricted"};function Ip(A){return Nh(this,arguments,function*(x,k={}){var K;if(typeof x!="string"||x.trim().length===0)throw new Error("The query must be a non-empty string");const te=new URL(`coordinates/search/${x}.json`,cr.maptilerApiURL);te.searchParams.set("key",(K=k.apiKey)!=null?K:Ji.apiKey),"limit"in k&&te.searchParams.set("limit",k.limit.toString()),"transformations"in k&&te.searchParams.set("transformations",k.transformations.toString()),"exports"in k&&te.searchParams.set("exports",k.exports.toString());const ue=te.toString(),le=yield pn(ue);if(!le.ok)throw new Zr(le,le.status in Po?Po[le.status]:"");return yield le.json()})}function Ap(A){return Nh(this,arguments,function*(x,k={}){var K;const te=(Array.isArray(x[0])?x:[x]).map(Q=>`${Q[0]},${Q[1]}`).join(";"),ue=new URL(`coordinates/transform/${te}.json`,cr.maptilerApiURL);ue.searchParams.set("key",(K=k.apiKey)!=null?K:Ji.apiKey),"sourceCrs"in k&&ue.searchParams.set("s_srs",k.sourceCrs.toString()),"targetCrs"in k&&ue.searchParams.set("t_srs",k.targetCrs.toString()),"operations"in k&&ue.searchParams.set("ops",(Array.isArray(k.operations)?k.operations:[k.operations]).join("|"));const le=ue.toString(),h=yield pn(le);if(!h.ok)throw new Zr(h,h.status in Po?Po[h.status]:"");return yield h.json()})}const Cp={search:Ip,transform:Ap};var Pp=(A,x,k)=>new Promise((K,te)=>{var ue=me=>{try{h(k.next(me))}catch(Q){te(Q)}},le=me=>{try{h(k.throw(me))}catch(Q){te(Q)}},h=me=>me.done?K(me.value):Promise.resolve(me.value).then(ue,le);h((k=k.apply(A,x)).next())});const Vh={403:"Key is missing, invalid or restricted"};function Mp(A){return Pp(this,arguments,function*(x,k={}){var K;if(typeof x!="string"||x.trim().length===0)throw new Error("The data ID must be a non-empty string");const te=new URL(`data/${encodeURIComponent(x)}/features.json`,cr.maptilerApiURL);te.searchParams.set("key",(K=k.apiKey)!=null?K:Ji.apiKey);const ue=te.toString(),le=yield pn(ue);if(!le.ok)throw new Zr(le,le.status in Vh?Vh[le.status]:"");return yield le.json()})}const kp={get:Mp};function $h(A){const x=/^maptiler:\/\/(.*)/;let k;const K=A.trim();let te;return K.startsWith("http://")||K.startsWith("https://")?te=K:(k=x.exec(K))!==null?te=`https://api.maptiler.com/maps/${k[1]}/style.json`:te=`https://api.maptiler.com/maps/${K}/style.json`,te}class Mo{constructor(x,k,K,te,ue,le){this.name=x,this.variantType=k,this.id=K,this.referenceStyle=te,this.description=ue,this.imageURL=le}getName(){return this.name}getFullName(){return`${this.referenceStyle.getName()} ${this.name}`}getType(){return this.variantType}getId(){return this.id}getDescription(){return this.description}getReferenceStyle(){return this.referenceStyle}hasVariant(x){return this.referenceStyle.hasVariant(x)}getVariant(x){return this.referenceStyle.getVariant(x)}getVariants(){return this.referenceStyle.getVariants().filter(x=>x!==this)}getImageURL(){return this.imageURL}getExpandedStyleURL(){return $h(this.getId())}}class ko{constructor(x,k){this.name=x,this.id=k,this.variants={},this.orderedVariants=[]}getName(){return this.name}getId(){return this.id}addVariant(x){this.variants[x.getType()]=x,this.orderedVariants.push(x)}hasVariant(x){return x in this.variants}getVariant(x){return x in this.variants?this.variants[x]:this.orderedVariants[0]}getVariants(){return Object.values(this.variants)}getDefaultVariant(){return this.orderedVariants[0]}}const zo=[{referenceStyleID:"STREETS",name:"Streets",description:"",variants:[{id:"streets-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"streets-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"streets-v2-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""},{id:"streets-v2-night",name:"Night",variantType:"NIGHT",description:"",imageURL:""},{id:"streets-v2-pastel",name:"Pastel",variantType:"PASTEL",description:"",imageURL:""}]},{referenceStyleID:"OUTDOOR",name:"Outdoor",description:"",variants:[{id:"outdoor-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"outdoor-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""}]},{referenceStyleID:"WINTER",name:"Winter",description:"",variants:[{id:"winter-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"winter-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""}]},{referenceStyleID:"SATELLITE",name:"Satellite",description:"",variants:[{id:"satellite",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"HYBRID",name:"Hybrid",description:"",variants:[{id:"hybrid",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"BASIC",name:"Basic",description:"",variants:[{id:"basic-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"basic-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"basic-v2-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""}]},{referenceStyleID:"BRIGHT",name:"Bright",description:"",variants:[{id:"bright-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"bright-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"bright-v2-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""},{id:"bright-v2-pastel",name:"Pastel",variantType:"PASTEL",description:"",imageURL:""}]},{referenceStyleID:"OPENSTREETMAP",name:"OpenStreetMap",description:"",variants:[{id:"openstreetmap",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"TOPO",name:"Topo",description:"",variants:[{id:"topo-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"topo-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"topo-v2-shiny",name:"Shiny",variantType:"SHINY",description:"",imageURL:""},{id:"topo-v2-pastel",name:"Pastel",variantType:"PASTEL",description:"",imageURL:""},{id:"topo-v2-topographique",name:"Topographique",variantType:"TOPOGRAPHIQUE",description:"",imageURL:""}]},{referenceStyleID:"VOYAGER",name:"Voyager",description:"",variants:[{id:"voyager-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"voyager-v2-darkmatter",name:"Darkmatter",variantType:"DARK",description:"",imageURL:""},{id:"voyager-v2-positron",name:"Positron",variantType:"LIGHT",description:"",imageURL:""},{id:"voyager-v2-vintage",name:"Vintage",variantType:"VINTAGE",description:"",imageURL:""}]},{referenceStyleID:"TONER",name:"Toner",description:"",variants:[{id:"toner-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"toner-v2-background",name:"Background",variantType:"BACKGROUND",description:"",imageURL:""},{id:"toner-v2-lite",name:"Lite",variantType:"LITE",description:"",imageURL:""},{id:"toner-v2-lines",name:"Lines",variantType:"LINES",description:"",imageURL:""}]},{referenceStyleID:"DATAVIZ",name:"Dataviz",description:"",variants:[{id:"dataviz",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"dataviz-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"dataviz-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""}]},{referenceStyleID:"BACKDROP",name:"Backdrop",description:"",variants:[{id:"backdrop",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"backdrop-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"backdrop-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""}]},{referenceStyleID:"OCEAN",name:"Ocean",description:"",variants:[{id:"ocean",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]}];function zp(A){return new Proxy(A,{get(x,k,K){return x.hasVariant(k)?x.getVariant(k):k.toString().toUpperCase()===k?A.getDefaultVariant():Reflect.get(x,k,K)}})}function Lp(){const A={};for(let x=0;x<zo.length;x+=1){const k=zo[x],K=zp(new ko(k.name,k.referenceStyleID));for(let te=0;te<k.variants.length;te+=1){const ue=k.variants[te],le=new Mo(ue.name,ue.variantType,ue.id,K,ue.description,ue.imageURL);K.addVariant(le)}A[k.referenceStyleID]=K}return A}function ql(A){if(!A)return Zl[zo[0].referenceStyleID].getDefaultVariant().getId();if(typeof A=="string"||A instanceof String)return A.trim().toLowerCase();if(A instanceof Mo)return A.getId();if(A instanceof ko)return A.getDefaultVariant().getId()}const Zl=Lp();function Dp(A,x,k){let K=x[0],te=x[1],ue=k[0]-K,le=k[1]-te;if(ue!==0||le!==0){const h=((A[0]-K)*ue+(A[1]-te)*le)/(ue*ue+le*le);h>1?(K=k[0],te=k[1]):h>0&&(K+=ue*h,te+=le*h)}return ue=A[0]-K,le=A[1]-te,ue*ue+le*le}function Xl(A,x,k,K,te){let ue=K,le;for(let h=x+1;h<k;h++){const me=Dp(A[h],A[x],A[k]);me>ue&&(le=h,ue=me)}ue>K&&(le-x>1&&Xl(A,x,le,K,te),te.push(A[le]),k-le>1&&Xl(A,le,k,K,te))}function Rp(A,x){const k=A.length-1,K=[A[0]];return Xl(A,0,k,x,K),K.push(A[k]),K}function Bp(A,x){if(A.length<=2)return A;const k=x!==void 0?x*x:1;return Rp(A,k)}function Wl(A,x=!0){let k=`${A[0]},${A[1]}`;return A.length===3&&x&&(k+=`,${A[2]}`),k}function Hl(A,x=3e3){let k=A.map(ue=>ue.join(",")).join("|"),K=5e-6;const te=1e-5;for(;k.length>x;)k=Bp(A,K).map(le=>`${le[0]},${le[1]}`).join("|"),K+=te;return k}function Fp(A,x,k={}){var K,te,ue,le,h;const me=ql(k.style),Q=k.hiDPI?"@2x":"",He=(K=k.format)!=null?K:"png";let ve=~~((te=k.width)!=null?te:1024),Te=~~((ue=k.height)!=null?ue:1024);k.hiDPI&&(ve=~~(ve/2),Te=~~(Te/2));const We=new URL(`maps/${encodeURIComponent(me)}/static/${A[0]},${A[1]},${x}/${ve}x${Te}${Q}.${He}`,cr.maptilerApiURL);if("attribution"in k&&We.searchParams.set("attribution",k.attribution.toString()),"markers"in k){let Ge="";const kt="markerIcon"in k;kt&&(Ge+=`icon:${k.markerIcon}|`),kt&&"markerAnchor"in k&&(Ge+=`anchor:${k.markerAnchor}|`),kt&&k.hiDPI&&(Ge+="scale:2|");const Rt=Array.isArray(k.markers[0])?k.markers:[k.markers];Ge+=Rt.map(It=>Wl(It,!kt)).join("|"),We.searchParams.set("markers",Ge)}if("path"in k){let Ge="";if(Ge+=`fill:${(le=k.pathFillColor)!=null?le:"none"}|`,"pathStrokeColor"in k&&(Ge+=`stroke:${k.pathStrokeColor}|`),"pathWidth"in k){const kt=k.pathWidth/(k.hiDPI?2:1);Ge+=`width:${kt.toString()}|`}Ge+=Hl(k.path),We.searchParams.set("path",Ge)}return We.searchParams.set("key",(h=k.apiKey)!=null?h:Ji.apiKey),We.toString()}function Op(A,x={}){var k,K,te,ue,le;const h=ql(x.style),me=x.hiDPI?"@2x":"",Q=(k=x.format)!=null?k:"png";let He=~~((K=x.width)!=null?K:1024),ve=~~((te=x.height)!=null?te:1024);x.hiDPI&&(He=~~(He/2),ve=~~(ve/2));const Te=new URL(`maps/${encodeURIComponent(h)}/static/${A[0]},${A[1]},${A[2]},${A[3]}/${He}x${ve}${me}.${Q}`,cr.maptilerApiURL);if("attribution"in x&&Te.searchParams.set("attribution",x.attribution.toString()),"padding"in x&&Te.searchParams.set("padding",x.padding.toString()),"markers"in x){let We="";const Ge="markerIcon"in x;Ge&&(We+=`icon:${x.markerIcon}|`),Ge&&"markerAnchor"in x&&(We+=`anchor:${x.markerAnchor}|`),Ge&&x.hiDPI&&(We+="scale:2|");const kt=Array.isArray(x.markers[0])?x.markers:[x.markers];We+=kt.map(Rt=>Wl(Rt,!Ge)).join("|"),Te.searchParams.set("markers",We)}if("path"in x){let We="";if(We+=`fill:${(ue=x.pathFillColor)!=null?ue:"none"}|`,"pathStrokeColor"in x&&(We+=`stroke:${x.pathStrokeColor}|`),"pathWidth"in x){const Ge=x.pathWidth/(x.hiDPI?2:1);We+=`width:${Ge.toString()}|`}We+=Hl(x.path),Te.searchParams.set("path",We)}return Te.searchParams.set("key",(le=x.apiKey)!=null?le:Ji.apiKey),Te.toString()}function Up(A={}){var x,k,K,te,ue;if(!("markers"in A)&&!("path"in A))throw new Error("Automatic static maps require markers and/or path to be created.");const le=ql(A.style),h=A.hiDPI?"@2x":"",me=(x=A.format)!=null?x:"png";let Q=~~((k=A.width)!=null?k:1024),He=~~((K=A.height)!=null?K:1024);A.hiDPI&&(Q=~~(Q/2),He=~~(He/2));const ve=new URL(`maps/${encodeURIComponent(le)}/static/auto/${Q}x${He}${h}.${me}`,cr.maptilerApiURL);if("attribution"in A&&ve.searchParams.set("attribution",A.attribution.toString()),"padding"in A&&ve.searchParams.set("padding",A.padding.toString()),"markers"in A){let Te="";const We="markerIcon"in A;We&&(Te+=`icon:${A.markerIcon}|`),We&&"markerAnchor"in A&&(Te+=`anchor:${A.markerAnchor}|`),We&&A.hiDPI&&(Te+="scale:2|");const Ge=Array.isArray(A.markers[0])?A.markers:[A.markers];Te+=Ge.map(kt=>Wl(kt,!We)).join("|"),ve.searchParams.set("markers",Te)}if("path"in A){let Te="";if(Te+=`fill:${(te=A.pathFillColor)!=null?te:"none"}|`,"pathStrokeColor"in A&&(Te+=`stroke:${A.pathStrokeColor}|`),"pathWidth"in A){const We=A.pathWidth/(A.hiDPI?2:1);Te+=`width:${We.toString()}|`}Te+=Hl(A.path),ve.searchParams.set("path",Te)}return ve.searchParams.set("key",(ue=A.apiKey)!=null?ue:Ji.apiKey),ve.toString()}const Np={centered:Fp,bounded:Op,automatic:Up};let Lo;const Vp=new Uint8Array(16);function $p(){if(!Lo&&(Lo=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Lo))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Lo(Vp)}const gi=[];for(let A=0;A<256;++A)gi.push((A+256).toString(16).slice(1));function jp(A,x=0){return(gi[A[x+0]]+gi[A[x+1]]+gi[A[x+2]]+gi[A[x+3]]+"-"+gi[A[x+4]]+gi[A[x+5]]+"-"+gi[A[x+6]]+gi[A[x+7]]+"-"+gi[A[x+8]]+gi[A[x+9]]+"-"+gi[A[x+10]]+gi[A[x+11]]+gi[A[x+12]]+gi[A[x+13]]+gi[A[x+14]]+gi[A[x+15]]).toLowerCase()}var jh={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Gp(A,x,k){if(jh.randomUUID&&!x&&!A)return jh.randomUUID();A=A||{};const K=A.random||(A.rng||$p)();if(K[6]=K[6]&15|64,K[8]=K[8]&63|128,x){k=k||0;for(let te=0;te<16;++te)x[k+te]=K[te];return x}return jp(K)}const Gh=Gp();let qh=class extends up{constructor(){super(),this.primaryLanguage=lr.AUTO,this.secondaryLanguage=null,this.session=!0,this._unit="metric",this._apiKey=""}set unit(x){this._unit=x,this.emit("unit",x)}get unit(){return this._unit}set apiKey(x){this._apiKey=x,Ji.apiKey=x,this.emit("apiKey",x)}get apiKey(){return this._apiKey}set fetch(x){Ji.fetch=x}get fetch(){return Ji.fetch}};const wr=new qh,Gi={maptilerLogoURL:"https://api.maptiler.com/resources/logo.svg",maptilerURL:"https://www.maptiler.com/",maptilerApiHost:"api.maptiler.com",rtlPluginURL:"https://cdn.maptiler.com/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.min.js",primaryLanguage:lr.AUTO,secondaryLanguage:lr.LOCAL,terrainSourceURL:"https://api.maptiler.com/tiles/terrain-rgb-v2/tiles.json",terrainSourceId:"maptiler-terrain"};Object.freeze(Gi);class Zh extends rt.LogoControl{onAdd(x){return super.onAdd(x)}}class Kl extends Zh{constructor(x={}){var k,K;super(x),this.logoURL="",this.linkURL="",this.logoURL=(k=x.logoURL)!=null?k:Gi.maptilerLogoURL,this.linkURL=(K=x.linkURL)!=null?K:Gi.maptilerURL}onAdd(x){this._map=x,this._compact=this.options&&this.options.compact,this._container=window.document.createElement("div"),this._container.className="maplibregl-ctrl";const k=window.document.createElement("a");return k.style.backgroundRepeat="no-repeat",k.style.cursor="pointer",k.style.display="block",k.style.height="23px",k.style.margin="0 0 -4px -4px",k.style.overflow="hidden",k.style.width="88px",k.style.backgroundImage=`url(${this.logoURL})`,k.style.backgroundSize="100px 30px",k.style.width="100px",k.style.height="30px",k.target="_blank",k.rel="noopener",k.href=this.linkURL,k.setAttribute("aria-label","MapTiler logo"),k.setAttribute("rel","noopener"),this._container.appendChild(k),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}}var qp=Object.defineProperty,Xh=Object.getOwnPropertySymbols,Zp=Object.prototype.hasOwnProperty,Xp=Object.prototype.propertyIsEnumerable,Wh=(A,x,k)=>x in A?qp(A,x,{enumerable:!0,configurable:!0,writable:!0,value:k}):A[x]=k,Hh=(A,x)=>{for(var k in x||(x={}))Zp.call(x,k)&&Wh(A,k,x[k]);if(Xh)for(var k of Xh(x))Xp.call(x,k)&&Wh(A,k,x[k]);return A};function Wp(){rt.getRTLTextPluginStatus()==="unavailable"&&rt.setRTLTextPlugin(Gi.rtlPluginURL,null,!0)}function Hp(A,x){A.forEach(k=>{x[k]&&(x[k]=x[k].bind(x))})}function On(A,x,k){const K=window.document.createElement(A);return x!==void 0&&(K.className=x),k&&k.appendChild(K),K}function Kp(A){A.parentNode&&A.parentNode.removeChild(A)}function Kh(A,x){let k=null;try{k=new URL(A)}catch{return{url:A}}return k.host===Gi.maptilerApiHost&&(k.searchParams.has("key")||k.searchParams.append("key",wr.apiKey),wr.session&&k.searchParams.append("mtsid",Gh)),{url:k.href}}function Yh(A=null){return function(x,k){if(A){const K=A(x,k),te=Kh(K.url);return Hh(Hh({},K),te)}else return Kh(x)}}function Jh(A){return A?typeof A=="string"||A instanceof String?!A.startsWith("http")&&A.toLowerCase().includes(".json")?A:$h(A):A instanceof Mo?A.getExpandedStyleURL():A instanceof ko?A.getDefaultVariant().getExpandedStyleURL():A:Zl[zo[0].referenceStyleID].getDefaultVariant().getExpandedStyleURL()}class Qh{constructor(){Hp(["_toggleTerrain","_updateTerrainIcon"],this)}onAdd(x){return this._map=x,this._container=On("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=On("button","maplibregl-ctrl-terrain",this._container),On("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(){Kp(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}_toggleTerrain(){this._map.hasTerrain()?this._map.disableTerrain():this._map.enableTerrain(),this._updateTerrainIcon()}_updateTerrainIcon(){this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.hasTerrain()?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))}}class eu extends rt.NavigationControl{onAdd(x){return super.onAdd(x)}}class tu extends eu{constructor(){super({showCompass:!0,showZoom:!0,visualizePitch:!0}),this._compass.removeEventListener("click",this._compass.clickFunction),this._compass.addEventListener("click",x=>{this._map.getPitch()===0?this._map.easeTo({pitch:Math.min(this._map.getMaxPitch(),80)}):this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:x}):this._map.resetNorth({},{originalEvent:x})})}_createButton(x,k){const K=super._createButton(x,k);return K.clickFunction=k,K}_rotateCompassArrow(){const x=this.options.visualizePitch?`scale(${Math.min(1.5,1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5))}) rotateX(${Math.min(70,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=x}}class iu extends rt.GeolocateControl{onAdd(x){return super.onAdd(x)}}var Yp=Object.defineProperty,Jp=Object.defineProperties,Qp=Object.getOwnPropertyDescriptors,ru=Object.getOwnPropertySymbols,ef=Object.prototype.hasOwnProperty,tf=Object.prototype.propertyIsEnumerable,nu=(A,x,k)=>x in A?Yp(A,x,{enumerable:!0,configurable:!0,writable:!0,value:k}):A[x]=k,rf=(A,x)=>{for(var k in x||(x={}))ef.call(x,k)&&nu(A,k,x[k]);if(ru)for(var k of ru(x))tf.call(x,k)&&nu(A,k,x[k]);return A},nf=(A,x)=>Jp(A,Qp(x));const su=rt.Marker,au=rt.LngLat,sf=rt.LngLatBounds;class ou extends iu{constructor(){super(...arguments),this.lastUpdatedCenter=new au(0,0)}_updateCamera(x){const k=new au(x.coords.longitude,x.coords.latitude),K=x.coords.accuracy,te=this._map.getBearing(),ue=nf(rf({bearing:te},this.options.fitBoundsOptions),{linear:!0}),le=this._map.getZoom();le>this.options.fitBoundsOptions.maxZoom&&(ue.zoom=le),this._map.fitBounds(sf.fromLngLat(k,K),ue,{geolocateSource:!0});let h=!1;const me=()=>{h=!0};this._map.once("click",me),this._map.once("dblclick",me),this._map.once("dragstart",me),this._map.once("mousedown",me),this._map.once("touchstart",me),this._map.once("wheel",me),this._map.once("moveend",()=>{this._map.off("click",me),this._map.off("dblclick",me),this._map.off("dragstart",me),this._map.off("mousedown",me),this._map.off("touchstart",me),this._map.off("wheel",me),!h&&(this.lastUpdatedCenter=this._map.getCenter())})}_setupUI(x){if(this.lastUpdatedCenter=this._map.getCenter(),this._container.addEventListener("contextmenu",k=>k.preventDefault()),this._geolocateButton=On("button","maplibregl-ctrl-geolocate",this._container),On("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",x===!1){const k=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=k,this._geolocateButton.setAttribute("aria-label",k)}else{const k=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=k,this._geolocateButton.setAttribute("aria-label",k)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=On("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new su(this._dotElement),this._circleElement=On("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new su({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("move",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("moveend",k=>{const K=k.originalEvent&&k.originalEvent.type==="resize",te=this.lastUpdatedCenter.distanceTo(this._map.getCenter());!k.geolocateSource&&this._watchState==="ACTIVE_LOCK"&&!K&&te>1&&(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new Event("trackuserlocationend")))})}_updateCircleRadius(){if(this._watchState!=="BACKGROUND"&&this._watchState!=="ACTIVE_LOCK")return;const x=[this._lastKnownPosition.coords.longitude,this._lastKnownPosition.coords.latitude],k=this._map.project(x),K=this._map.unproject([k.x,k.y]),te=this._map.unproject([k.x+20,k.y]),ue=K.distanceTo(te)/20,le=Math.ceil(2*this._accuracy/ue);this._circleElement.style.width=`${le}px`,this._circleElement.style.height=`${le}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}}class lu extends rt.AttributionControl{onAdd(x){return super.onAdd(x)}}class cu extends rt.ScaleControl{onAdd(x){return super.onAdd(x)}}class hu extends rt.FullscreenControl{onAdd(x){return super.onAdd(x)}}var af=Object.defineProperty,of=Object.defineProperties,lf=Object.getOwnPropertyDescriptors,uu=Object.getOwnPropertySymbols,cf=Object.prototype.hasOwnProperty,hf=Object.prototype.propertyIsEnumerable,du=(A,x,k)=>x in A?af(A,x,{enumerable:!0,configurable:!0,writable:!0,value:k}):A[x]=k,uf=(A,x)=>{for(var k in x||(x={}))cf.call(x,k)&&du(A,k,x[k]);if(uu)for(var k of uu(x))hf.call(x,k)&&du(A,k,x[k]);return A},df=(A,x)=>of(A,lf(x)),fn=(A,x,k)=>new Promise((K,te)=>{var ue=me=>{try{h(k.next(me))}catch(Q){te(Q)}},le=me=>{try{h(k.throw(me))}catch(Q){te(Q)}},h=me=>me.done?K(me.value):Promise.resolve(me.value).then(ue,le);h((k=k.apply(A,x)).next())});const pu={POINT:"POINT",COUNTRY:"COUNTRY"};let pf=class extends rt.Map{constructor(x){var k,K,te;x.apiKey&&(wr.apiKey=x.apiKey);const ue=Jh(x.style),le=location.hash;wr.apiKey||console.warn("MapTiler Cloud API key is not set. Visit https://maptiler.com and try Cloud for free!"),super(df(uf({},x),{style:ue,maplibreLogo:!1,transformRequest:Yh(x.transformRequest)})),this.isTerrainEnabled=!1,this.terrainExaggeration=1,this.primaryLanguage=null,this.secondaryLanguage=null,this.terrainGrowing=!1,this.terrainFlattening=!1,this.primaryLanguage=(k=x.language)!=null?k:wr.primaryLanguage,this.secondaryLanguage=wr.secondaryLanguage,this.terrainExaggeration=(K=x.terrainExaggeration)!=null?K:this.terrainExaggeration,this.once("styledata",()=>fn(this,null,function*(){if(!x.geolocate||x.center||x.hash&&le)return;try{if(x.geolocate===pu.COUNTRY){yield this.fitToIpBounds();return}}catch(Te){console.warn(Te.message)}let ve=null;try{yield this.centerOnIpPoint(x.zoom),ve=this.getCameraHash()}catch(Te){console.warn(Te.message)}(yield navigator.permissions.query({name:"geolocation"})).state==="granted"&&navigator.geolocation.getCurrentPosition(Te=>{ve===this.getCameraHash()&&(this.terrain?this.easeTo({center:[Te.coords.longitude,Te.coords.latitude],zoom:x.zoom||12,duration:2e3}):this.once("terrain",()=>{this.easeTo({center:[Te.coords.longitude,Te.coords.latitude],zoom:x.zoom||12,duration:2e3})}))},null,{maximumAge:24*3600*1e3,timeout:5e3,enableHighAccuracy:!1})})),this.on("styledata",()=>{this.setPrimaryLanguage(this.primaryLanguage),this.setSecondaryLanguage(this.secondaryLanguage)}),this.on("styledata",()=>{this.getTerrain()===null&&this.isTerrainEnabled&&this.enableTerrain(this.terrainExaggeration)}),this.once("load",()=>fn(this,null,function*(){Wp()})),this.once("load",()=>fn(this,null,function*(){let ve={logo:null};try{const Te=Object.keys(this.style.sourceCaches).map(Ge=>this.getSource(Ge)).filter(Ge=>typeof Ge.url=="string"&&Ge.url.includes("tiles.json")),We=new URL(Te[0].url);We.searchParams.has("key")||We.searchParams.append("key",wr.apiKey),ve=yield(yield fetch(We.href)).json()}catch{}if("logo"in ve&&ve.logo){const Te=ve.logo;this.addControl(new Kl({logoURL:Te}),x.logoPosition),x.attributionControl===!1&&this.addControl(new lu({customAttribution:x.customAttribution}))}else x.maptilerLogo&&this.addControl(new Kl,x.logoPosition);if(x.scaleControl){const Te=x.scaleControl===!0||x.scaleControl===void 0?"bottom-right":x.scaleControl,We=new cu({unit:wr.unit});this.addControl(We,Te),wr.on("unit",Ge=>{We.setUnit(Ge)})}if(x.navigationControl!==!1){const Te=x.navigationControl===!0||x.navigationControl===void 0?"top-right":x.navigationControl;this.addControl(new tu,Te)}if(x.geolocateControl!==!1){const Te=x.geolocateControl===!0||x.geolocateControl===void 0?"top-right":x.geolocateControl;this.addControl(new ou({positionOptions:{enableHighAccuracy:!0,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!0,showAccuracyCircle:!0,showUserLocation:!0}),Te)}if(x.terrainControl){const Te=x.terrainControl===!0||x.terrainControl===void 0?"top-right":x.terrainControl;this.addControl(new Qh,Te)}if(x.fullscreenControl){const Te=x.fullscreenControl===!0||x.fullscreenControl===void 0?"top-right":x.fullscreenControl;this.addControl(new hu({}),Te)}}));let h=!1,me=!1,Q=null;this.once("load",ve=>{h=!0,me&&this.fire("loadWithTerrain",Q)});const He=ve=>{ve.terrain&&(me=!0,Q={type:"loadWithTerrain",target:this,terrain:ve.terrain},this.off("terrain",He),h&&this.fire("loadWithTerrain",Q))};this.on("terrain",He),x.terrain&&this.enableTerrain((te=x.terrainExaggeration)!=null?te:this.terrainExaggeration)}onLoadAsync(){return fn(this,null,function*(){return new Promise((x,k)=>{if(this.loaded())return x(this);this.once("load",K=>{x(this)})})})}onLoadWithTerrainAsync(){return fn(this,null,function*(){return new Promise((x,k)=>{if(this.loaded()&&this.terrain)return x(this);this.once("loadWithTerrain",K=>{x(this)})})})}setStyle(x,k){return super.setStyle(Jh(x),k)}setLanguage(x=Gi.primaryLanguage){if(x===lr.AUTO)return this.setLanguage(jl());this.setPrimaryLanguage(x)}setPrimaryLanguage(x=Gi.primaryLanguage){if(this.primaryLanguage===lr.STYLE_LOCK){console.warn("The language cannot be changed because this map has been instantiated with the STYLE_LOCK language flag.");return}Rh(x)&&(this.primaryLanguage=x,this.onStyleReady(()=>{if(x===lr.AUTO)return this.setPrimaryLanguage(jl());const k=this.getStyle().layers,K=/^\s*{\s*name\s*(:\s*(\S*))?\s*}$/,te=/^\s*name\s*(:\s*(\S*))?\s*$/,ue=/^\s*{\s*name\s*(:\s*(\S*))?\s*}(\s*){\s*name\s*(:\s*(\S*))?\s*}$/,le=/^(.*)({\s*name\s*(:\s*(\S*))?\s*})(.*)$/,h=x?`name:${x}`:"name",me=["case",["has",h],["get",h],["get","name"]];for(let Q=0;Q<k.length;Q+=1){const He=k[Q],ve=He.layout;if(!ve||!ve["text-field"])continue;const Te=this.getLayoutProperty(He.id,"text-field");let We;if(Array.isArray(Te)&&Te.length>=2&&Te[0].trim().toLowerCase()==="concat"){const Ge=Te.slice();for(let kt=0;kt<Te.length;kt+=1){const Rt=Te[kt];if((typeof Rt=="string"||Rt instanceof String)&&K.exec(Rt.toString())){Ge[kt]=me;break}else if(Array.isArray(Rt)&&Rt.length>=2&&Rt[0].trim().toLowerCase()==="get"&&te.exec(Rt[1].toString())){Ge[kt]=me;break}else if(Array.isArray(Rt)&&Rt.length===4&&Rt[0].trim().toLowerCase()==="case"){Ge[kt]=me;break}}this.setLayoutProperty(He.id,"text-field",Ge)}else if(Array.isArray(Te)&&Te.length>=2&&Te[0].trim().toLowerCase()==="get"&&te.exec(Te[1].toString())){const Ge=me;this.setLayoutProperty(He.id,"text-field",Ge)}else if((typeof Te=="string"||Te instanceof String)&&K.exec(Te.toString())){const Ge=me;this.setLayoutProperty(He.id,"text-field",Ge)}else if(Array.isArray(Te)&&Te.length===4&&Te[0].trim().toLowerCase()==="case"){const Ge=me;this.setLayoutProperty(He.id,"text-field",Ge)}else if((typeof Te=="string"||Te instanceof String)&&(We=ue.exec(Te.toString()))!==null){const Ge=`{${h}}${We[3]}{name${We[4]||""}}`;this.setLayoutProperty(He.id,"text-field",Ge)}else if((typeof Te=="string"||Te instanceof String)&&(We=le.exec(Te.toString()))!==null){const Ge=`${We[1]}{${h}}${We[5]}`;this.setLayoutProperty(He.id,"text-field",Ge)}}}))}setSecondaryLanguage(x=Gi.secondaryLanguage){if(this.primaryLanguage===lr.STYLE_LOCK){console.warn("The language cannot be changed because this map has been instantiated with the STYLE_LOCK language flag.");return}Rh(x)&&(this.secondaryLanguage=x,this.onStyleReady(()=>{if(x===lr.AUTO)return this.setSecondaryLanguage(jl());const k=this.getStyle().layers,K=/^\s*{\s*name\s*(:\s*(\S*))?\s*}$/,te=/^\s*name\s*(:\s*(\S*))?\s*$/,ue=/^\s*{\s*name\s*(:\s*(\S*))?\s*}(\s*){\s*name\s*(:\s*(\S*))?\s*}$/;let le;for(let h=0;h<k.length;h+=1){const me=k[h],Q=me.layout;if(!Q||!Q["text-field"])continue;const He=this.getLayoutProperty(me.id,"text-field");let ve;if(Array.isArray(He)&&He.length>=2&&He[0].trim().toLowerCase()==="concat"){ve=He.slice();let Te=0;for(let We=0;We<He.length;We+=1){const Ge=He[We];if((typeof Ge=="string"||Ge instanceof String)&&K.exec(Ge.toString())){if(Te===1){ve[We]=`{name:${x}}`;break}Te+=1}else if(Array.isArray(Ge)&&Ge.length>=2&&Ge[0].trim().toLowerCase()==="get"&&te.exec(Ge[1].toString())){if(Te===1){ve[We][1]=`name:${x}`;break}Te+=1}else if(Array.isArray(Ge)&&Ge.length===4&&Ge[0].trim().toLowerCase()==="case"){if(Te===1){ve[We]=["get",`name:${x}`];break}Te+=1}}this.setLayoutProperty(me.id,"text-field",ve)}else if((typeof He=="string"||He instanceof String)&&(le=ue.exec(He.toString()))!==null){const Te=x?`name:${x}`:"name";ve=`{name${le[1]||""}}${le[3]}{${Te}}`,this.setLayoutProperty(me.id,"text-field",ve)}}}))}getPrimaryLanguage(){return this.primaryLanguage}getSecondaryLanguage(){return this.secondaryLanguage}getTerrainExaggeration(){return this.terrainExaggeration}hasTerrain(){return this.isTerrainEnabled}growTerrain(x,k=1e3){if(!this.terrain)return;const K=performance.now(),te=this.terrain.exaggeration,ue=x-te,le=()=>{if(!this.terrain||this.terrainFlattening)return;const h=(performance.now()-K)/k;if(h<.99){const me=1-Math.pow(1-h,4),Q=te+me*ue;this.terrain.exaggeration=Q,requestAnimationFrame(le)}else this.terrainGrowing=!1,this.terrainFlattening=!1,this.terrain.exaggeration=x;this.triggerRepaint()};this.terrainGrowing=!0,this.terrainFlattening=!1,requestAnimationFrame(le)}enableTerrain(x=this.terrainExaggeration){if(x<0){console.warn("Terrain exaggeration cannot be negative.");return}const k=te=>fn(this,null,function*(){!this.terrain||te.type!=="data"||te.dataType!=="source"||!("source"in te)||te.sourceId!=="maptiler-terrain"||te.source.type!=="raster-dem"||te.isSourceLoaded&&(this.off("data",k),this.growTerrain(x))}),K=()=>{this.isTerrainEnabled=!0,this.terrainExaggeration=x,this.on("data",k),this.addSource(Gi.terrainSourceId,{type:"raster-dem",url:Gi.terrainSourceURL}),this.setTerrain({source:Gi.terrainSourceId,exaggeration:0})};if(this.getTerrain()){this.isTerrainEnabled=!0,this.growTerrain(x);return}this.loaded()||this.isTerrainEnabled?K():this.once("load",()=>{this.getTerrain()&&this.getSource(Gi.terrainSourceId)||K()})}disableTerrain(){if(!this.terrain)return;this.isTerrainEnabled=!1;const x=1*1e3,k=performance.now(),K=this.terrain.exaggeration,te=()=>{if(!this.terrain||this.terrainGrowing)return;const ue=(performance.now()-k)/x;if(ue<.99){const le=Math.pow(1-ue,4),h=K*le;this.terrain.exaggeration=h,requestAnimationFrame(te)}else this.terrain.exaggeration=0,this.terrainGrowing=!1,this.terrainFlattening=!1,this.setTerrain(null),this.getSource(Gi.terrainSourceId)&&this.removeSource(Gi.terrainSourceId);this.triggerRepaint()};this.terrainGrowing=!1,this.terrainFlattening=!0,requestAnimationFrame(te)}setTerrainExaggeration(x,k=!0){!k&&this.terrain?(this.terrainExaggeration=x,this.terrain.exaggeration=x,this.triggerRepaint()):this.enableTerrain(x)}onStyleReady(x){this.isStyleLoaded()?x():this.once("styledata",()=>{x()})}fitToIpBounds(){return fn(this,null,function*(){const x=yield Gl.info();this.fitBounds(x.country_bounds,{duration:0,padding:100})})}centerOnIpPoint(x){return fn(this,null,function*(){const k=yield Gl.info();this.jumpTo({center:[k.longitude,k.latitude],zoom:x||11})})}getCameraHash(){const x=new Float32Array(5),k=this.getCenter();return x[0]=k.lng,x[1]=k.lat,x[2]=this.getZoom(),x[3]=this.getPitch(),x[4]=this.getBearing(),rp.fromUint8Array(new Uint8Array(x.buffer))}getSdkConfig(){return wr}getMaptilerSessionId(){return Gh}setTransformRequest(x){return super.setTransformRequest(Yh(x)),this}};class ff extends rt.Marker{addTo(x){return super.addTo(x)}}class mf extends rt.Popup{addTo(x){return super.addTo(x)}}class gf extends rt.Style{constructor(x,k={}){super(x,k)}}class _f extends rt.CanvasSource{onAdd(x){super.onAdd(x)}}class yf extends rt.GeoJSONSource{onAdd(x){super.onAdd(x)}}class xf extends rt.ImageSource{onAdd(x){super.onAdd(x)}}class vf extends rt.RasterTileSource{onAdd(x){super.onAdd(x)}}class bf extends rt.RasterDEMTileSource{onAdd(x){super.onAdd(x)}}class wf extends rt.VectorTileSource{onAdd(x){super.onAdd(x)}}class Tf extends rt.VideoSource{onAdd(x){super.onAdd(x)}}class Sf extends rt.TerrainControl{onAdd(x){return super.onAdd(x)}}class _a{constructor(x,k){this.x=x,this.y=k}_matMult(x){const k=x[0]*this.x+x[1]*this.y,K=x[2]*this.x+x[3]*this.y;return this.x=k,this.y=K,this}_add(x){return this.x+=x.x,this.y+=x.y,this}_sub(x){return this.x-=x.x,this.y-=x.y,this}_mult(x){return this.x*=x,this.y*=x,this}_div(x){return this.x/=x,this.y/=x,this}_multByPoint(x){return this.x*=x.x,this.y*=x.y,this}_divByPoint(x){return this.x/=x.x,this.y/=x.y,this}_unit(){return this._div(this.mag()),this}_perp(){const x=this.y;return this.y=this.x,this.x=-x,this}_rotate(x){const k=Math.cos(x),K=Math.sin(x),te=k*this.x-K*this.y,ue=K*this.x+k*this.y;return this.x=te,this.y=ue,this}_rotateAround(x,k){const K=Math.cos(x),te=Math.sin(x),ue=k.x+K*(this.x-k.x)-te*(this.y-k.y),le=k.y+te*(this.x-k.x)+K*(this.y-k.y);return this.x=ue,this.y=le,this}_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}clone(){return new _a(this.x,this.y)}add(x){return this.clone()._add(x)}sub(x){return this.clone()._sub(x)}multByPoint(x){return this.clone()._multByPoint(x)}divByPoint(x){return this.clone()._divByPoint(x)}mult(x){return this.clone()._mult(x)}div(x){return this.clone()._div(x)}rotate(x){return this.clone()._rotate(x)}rotateAround(x,k){return this.clone()._rotateAround(x,k)}matMult(x){return this.clone()._matMult(x)}unit(){return this.clone()._unit()}perp(){return this.clone()._perp()}round(){return this.clone()._round()}mag(){return Math.sqrt(this.x*this.x+this.y*this.y)}equals(x){return this.x===x.x&&this.y===x.y}dist(x){return Math.sqrt(this.distSqr(x))}distSqr(x){const k=x.x-this.x,K=x.y-this.y;return k*k+K*K}angle(){return Math.atan2(this.y,this.x)}angleTo(x){return Math.atan2(this.y-x.y,this.x-x.x)}angleWith(x){return this.angleWithSep(x.x,x.y)}angleWithSep(x,k){return Math.atan2(this.x*k-this.y*x,this.x*x+this.y*k)}static convert(x){return x instanceof _a?x:Array.isArray(x)?new _a(x[0],x[1]):x}}const{setRTLTextPlugin:Ef,getRTLTextPluginStatus:If,LngLat:Af,LngLatBounds:Cf,MercatorCoordinate:Pf,Evented:Mf,AJAXError:kf,prewarm:zf,clearPrewarmedResources:Lf,version:Df,workerCount:Rf,maxParallelImageRequests:Bf,workerUrl:Ff,addProtocol:Of,removeProtocol:Uf}=rt,Nf=rt.Map,Vf=rt.Marker,$f=rt.Popup,jf=rt.Style,Gf=rt.CanvasSource,qf=rt.GeoJSONSource,Zf=rt.ImageSource,Xf=rt.RasterTileSource,Wf=rt.RasterDEMTileSource,Hf=rt.VectorTileSource,Kf=rt.VideoSource;rt.NavigationControl,rt.GeolocateControl,rt.AttributionControl,rt.LogoControl,rt.ScaleControl,rt.FullscreenControl,rt.TerrainControl,Oe.AJAXError=kf,Oe.AttributionControl=lu,Oe.CanvasSource=_f,Oe.CanvasSourceMLGL=Gf,Oe.Evented=Mf,Oe.FullscreenControl=hu,Oe.GeoJSONSource=yf,Oe.GeoJSONSourceMLGL=qf,Oe.GeolocateControl=iu,Oe.GeolocationType=pu,Oe.ImageSource=xf,Oe.ImageSourceMLGL=Zf,Oe.Language=lr,Oe.LanguageGeocoding=ga,Oe.LngLat=Af,Oe.LngLatBounds=Cf,Oe.LogoControl=Zh,Oe.Map=pf,Oe.MapMLGL=Nf,Oe.MapStyle=Zl,Oe.MapStyleVariant=Mo,Oe.MaptilerGeolocateControl=ou,Oe.MaptilerLogoControl=Kl,Oe.MaptilerNavigationControl=tu,Oe.MaptilerTerrainControl=Qh,Oe.Marker=ff,Oe.MarkerMLGL=Vf,Oe.MercatorCoordinate=Pf,Oe.NavigationControl=eu,Oe.Point=_a,Oe.Popup=mf,Oe.PopupMLGL=$f,Oe.RasterDEMTileSource=bf,Oe.RasterDEMTileSourceMLGL=Wf,Oe.RasterTileSource=vf,Oe.RasterTileSourceMLGL=Xf,Oe.ReferenceMapStyle=ko,Oe.ScaleControl=cu,Oe.SdkConfig=qh,Oe.ServiceError=Zr,Oe.Style=gf,Oe.StyleMLGL=jf,Oe.TerrainControl=Sf,Oe.VectorTileSource=wf,Oe.VectorTileSourceMLGL=Hf,Oe.VideoSource=Tf,Oe.VideoSourceMLGL=Kf,Oe.addProtocol=Of,Oe.clearPrewarmedResources=Lf,Oe.config=wr,Oe.coordinates=Cp,Oe.data=kp,Oe.geocoding=Tp,Oe.geolocation=Gl,Oe.getRTLTextPluginStatus=If,Oe.maxParallelImageRequests=Bf,Oe.prewarm=zf,Oe.removeProtocol=Uf,Oe.setRTLTextPlugin=Ef,Oe.staticMaps=Np,Oe.version=Df,Oe.workerCount=Rf,Oe.workerUrl=Ff});
580
+ `,this._canvasContainer.addEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.add("maplibregl-cooperative-gestures")}_destroyCooperativeGestures(){J.remove(this._cooperativeGesturesScreen),this._canvasContainer.removeEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.remove("maplibregl-cooperative-gestures")}_resizeCanvas(o,t,n){this._canvas.width=n*o,this._canvas.height=n*t,this._canvas.style.width=`${o}px`,this._canvas.style.height=`${t}px`}_setupPainter(){const o={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let t=null;this._canvas.addEventListener("webglcontextcreationerror",a=>{t={requestedAttributes:o},a&&(t.statusMessage=a.statusMessage,t.type=a.type)},{once:!0});const n=this._canvas.getContext("webgl2",o)||this._canvas.getContext("webgl",o);if(!n){const a="Failed to initialize WebGL";throw t?(t.message=a,new Error(JSON.stringify(t))):new Error(a)}this.painter=new al(n,this.transform),Ke.testSupport(n)}_contextLost(o){o.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new h.Event("webglcontextlost",{originalEvent:o}))}_contextRestored(o){this._setupPainter(),this.resize(),this._update(),this.fire(new h.Event("webglcontextrestored",{originalEvent:o}))}_onMapScroll(o){if(o.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}_onCooperativeGesture(o,t,n){return!t&&n<2&&(this._cooperativeGesturesScreen.classList.add("maplibregl-show"),setTimeout(()=>{this._cooperativeGesturesScreen.classList.remove("maplibregl-show")},100)),!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(o){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||o,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(o){return this._update(),this._renderTaskQueue.add(o)}_cancelRenderFrame(o){this._renderTaskQueue.remove(o)}_render(o){const t=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(o),this._removed)return;let n=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const c=this.transform.zoom,p=h.exported.now();this.style.zoomHistory.update(c,p);const m=new h.EvaluationParameters(c,{now:p,fadeDuration:t,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),y=m.crossFadingFactor();y===1&&y===this._crossFadingFactor||(n=!0,this._crossFadingFactor=y),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.updateElevation(this.terrain),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,t,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:t,showPadding:this.showPadding}),this.fire(new h.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,h.PerformanceUtils.mark(h.PerformanceMarkers.load),this.fire(new h.Event("load"))),this.style&&(this.style.hasTransitions()||n)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const a=this._sourcesDirty||this._styleDirty||this._placementDirty;return a||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new h.Event("idle")),!this._loaded||this._fullyLoaded||a||(this._fullyLoaded=!0,h.PerformanceUtils.mark(h.PerformanceMarkers.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){var o;this._hash&&this._hash.remove();for(const n of this._controls)n.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),hr.removeThrottleControl(this._imageQueueHandle),(o=this._resizeObserver)===null||o===void 0||o.disconnect();const t=this.painter.context.gl.getExtension("WEBGL_lose_context");t&&t.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),J.remove(this._canvasContainer),J.remove(this._controlContainer),this._cooperativeGestures&&this._destroyCooperativeGestures(),this._container.classList.remove("maplibregl-map"),h.PerformanceUtils.clearMetrics(),this._removed=!0,this.fire(new h.Event("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=h.exported.frame(o=>{h.PerformanceUtils.frame(o),this._frame=null,this._render(o)}))}_onWindowOnline(){this._update()}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(o){this._showTileBoundaries!==o&&(this._showTileBoundaries=o,this._update())}get showPadding(){return!!this._showPadding}set showPadding(o){this._showPadding!==o&&(this._showPadding=o,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(o){this._showCollisionBoxes!==o&&(this._showCollisionBoxes=o,o?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(o){this._showOverdrawInspector!==o&&(this._showOverdrawInspector=o,this._update())}get repaint(){return!!this._repaint}set repaint(o){this._repaint!==o&&(this._repaint=o,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(o){this._vertices=o,this._update()}get version(){return Xt}getCameraTargetElevation(){return this.transform.elevation}},NavigationControl:class{constructor(o){this.options=h.extend({},ea,o),this._container=J.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(h.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",t=>this._map.zoomIn({},{originalEvent:t})),J.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",t=>this._map.zoomOut({},{originalEvent:t})),J.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(h.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("maplibregl-ctrl-compass",t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})}),this._compassIcon=J.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const o=this._map.getZoom(),t=o===this._map.getMaxZoom(),n=o===this._map.getMinZoom();this._zoomInButton.disabled=t,this._zoomOutButton.disabled=n,this._zoomInButton.setAttribute("aria-disabled",t.toString()),this._zoomOutButton.setAttribute("aria-disabled",n.toString())}_rotateCompassArrow(){const o=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=o}onAdd(o){return this._map=o,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 ro(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){J.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(o,t){const n=J.create("button",o,this._container);return n.type="button",n.addEventListener("click",t),n}_setButtonTitle(o,t){const n=this._map._getUIString(`NavigationControl.${t}`);o.title=n,o.setAttribute("aria-label",n)}},GeolocateControl:class extends h.Evented{constructor(o){super(),this.options=h.extend({},no,o),h.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker"],this)}onAdd(o){return this._map=o,this._container=J.create("div","maplibregl-ctrl maplibregl-ctrl-group"),function(t,n=!1){yr===void 0||n?window.navigator.permissions!==void 0?window.navigator.permissions.query({name:"geolocation"}).then(a=>{yr=a.state!=="denied",t(yr)}).catch(()=>{yr=!!window.navigator.geolocation,t(yr)}):(yr=!!window.navigator.geolocation,t(yr)):t(yr)}(this._setupUI),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(),J.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Nn=0,dn=!1}_isOutOfMapMaxBounds(o){const t=this._map.getMaxBounds(),n=o.coords;return t&&(n.longitude<t.getWest()||n.longitude>t.getEast()||n.latitude<t.getSouth()||n.latitude>t.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}`)}}_onSuccess(o){if(this._map){if(this._isOutOfMapMaxBounds(o))return this._setErrorState(),this.fire(new h.Event("outofmaxbounds",o)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=o,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(o),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(o),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new h.Event("geolocate",o)),this._finish()}}_updateCamera(o){const t=new h.LngLat(o.coords.longitude,o.coords.latitude),n=o.coords.accuracy,a=this._map.getBearing(),c=h.extend({bearing:a},this.options.fitBoundsOptions),p=si.fromLngLat(t,n);this._map.fitBounds(p,c,{geolocateSource:!0})}_updateMarker(o){if(o){const t=new h.LngLat(o.coords.longitude,o.coords.latitude);this._accuracyCircleMarker.setLngLat(t).addTo(this._map),this._userLocationDotMarker.setLngLat(t).addTo(this._map),this._accuracy=o.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const o=this._map.getBounds(),t=o.getSouthEast(),n=o.getNorthEast(),a=t.distanceTo(n),c=Math.ceil(this._accuracy/(a/this._map._container.clientHeight)*2);this._circleElement.style.width=`${c}px`,this._circleElement.style.height=`${c}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_onError(o){if(this._map){if(this.options.trackUserLocation)if(o.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;const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(o.code===3&&dn)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new h.Event("error",o)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(o){if(this._map){if(this._container.addEventListener("contextmenu",t=>t.preventDefault()),this._geolocateButton=J.create("button","maplibregl-ctrl-geolocate",this._container),J.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",o===!1){h.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}else{const t=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=J.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new fs(this._dotElement),this._circleElement=J.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new fs({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",t=>{t.geolocateSource||this._watchState!=="ACTIVE_LOCK"||t.originalEvent&&t.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 h.Event("trackuserlocationend")))})}}trigger(){if(!this._setup)return h.warnOnce("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new h.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Nn--,dn=!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 h.Event("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 h.Event("trackuserlocationstart"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),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 o;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Nn++,Nn>1?(o={maximumAge:6e5,timeout:0},dn=!0):(o=this.options.positionOptions,dn=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,o)}}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)}},AttributionControl:Ge,LogoControl:ps,ScaleControl:class{constructor(o){this.options=h.extend({},so,o),h.bindAll(["_onMove","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_onMove(){ra(this._map,this._container,this.options)}onAdd(o){return this._map=o,this._container=J.create("div","maplibregl-ctrl maplibregl-ctrl-scale",o.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){J.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}setUnit(o){this.options.unit=o,ra(this._map,this._container,this.options)}},FullscreenControl:class extends h.Evented{constructor(o={}){super(),this._onFullscreenChange=()=>{(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,o&&o.container&&(o.container instanceof HTMLElement?this._container=o.container:h.warnOnce("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(o){return this._map=o,this._container||(this._container=this._map.getContainer()),this._controlContainer=J.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){J.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const o=this._fullscreenButton=J.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);J.create("span","maplibregl-ctrl-icon",o).setAttribute("aria-hidden","true"),o.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const o=this._getTitle();this._fullscreenButton.setAttribute("aria-label",o),this._fullscreenButton.title=o}_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 h.Event("fullscreenstart")),this._map._cooperativeGestures&&(this._prevCooperativeGestures=this._map._cooperativeGestures,this._map.setCooperativeGestures())):(this.fire(new h.Event("fullscreenend")),this._prevCooperativeGestures&&(this._map.setCooperativeGestures(this._prevCooperativeGestures),delete this._prevCooperativeGestures))}_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()}},TerrainControl:class{constructor(o){this.options=o,h.bindAll(["_toggleTerrain","_updateTerrainIcon"],this)}onAdd(o){return this._map=o,this._container=J.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=J.create("button","maplibregl-ctrl-terrain",this._container),J.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(){J.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}_toggleTerrain(){this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()}_updateTerrainIcon(){this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),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.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))}},Popup:class extends h.Evented{constructor(o){super(),this.options=h.extend(Object.create(na),o),h.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this)}addTo(o){return this._map&&this.remove(),this._map=o,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 h.Event("open")),this}isOpen(){return!!this._map}remove(){return this._content&&J.remove(this._content),this._container&&(J.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new h.Event("close")),this}getLngLat(){return this._lngLat}setLngLat(o){return this._lngLat=h.LngLat.convert(o),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(o){return this.setDOMContent(document.createTextNode(o))}setHTML(o){const t=document.createDocumentFragment(),n=document.createElement("body");let a;for(n.innerHTML=o;a=n.firstChild,a;)t.appendChild(a);return this.setDOMContent(t)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(o){return this.options.maxWidth=o,this._update(),this}setDOMContent(o){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=J.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(o),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(o){this._container&&this._container.classList.add(o)}removeClassName(o){this._container&&this._container.classList.remove(o)}setOffset(o){return this.options.offset=o,this._update(),this}toggleClassName(o){if(this._container)return this._container.classList.toggle(o)}_createCloseButton(){this.options.closeButton&&(this._closeButton=J.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_onMouseUp(o){this._update(o.point)}_onMouseMove(o){this._update(o.point)}_onDrag(o){this._update(o.point)}_update(o){if(!this._map||!this._lngLat&&!this._trackPointer||!this._content||(this._container||(this._container=J.create("div","maplibregl-popup",this._map.getContainer()),this._tip=J.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach(p=>this._container.classList.add(p)),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")),this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=ta(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!o))return;const t=this._pos=this._trackPointer&&o?o:this._map.project(this._lngLat);let n=this.options.anchor;const a=sa(this.options.offset);if(!n){const p=this._container.offsetWidth,m=this._container.offsetHeight;let y;y=t.y+a.bottom.y<m?["top"]:t.y>this._map.transform.height-m?["bottom"]:[],t.x<p/2?y.push("left"):t.x>this._map.transform.width-p/2&&y.push("right"),n=y.length===0?"bottom":y.join("-")}const c=t.add(a[n]).round();J.setTransform(this._container,`${un[n]} translate(${c.x}px,${c.y}px)`),ia(this._container,n,"popup")}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const o=this._container.querySelector(ao);o&&o.focus()}_onClose(){this.remove()}},Marker:fs,Style:li,LngLat:h.LngLat,LngLatBounds:si,Point:h.Point,MercatorCoordinate:h.MercatorCoordinate,Evented:h.Evented,AJAXError:h.AJAXError,config:h.config,CanvasSource:oe,GeoJSONSource:Er,ImageSource:Zi,RasterDEMTileSource:Vr,RasterTileSource:rn,VectorTileSource:Sn,VideoSource:En,prewarm:function(){An().acquire(an)},clearPrewarmedResources:function(){const o=hi;o&&(o.isPreloaded()&&o.numActive()===1?(o.release(an),hi=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},get version(){return aa},get workerCount(){return we.workerCount},set workerCount(o){we.workerCount=o},get maxParallelImageRequests(){return h.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(o){h.config.MAX_PARALLEL_IMAGE_REQUESTS=o},get workerUrl(){return h.config.WORKER_URL},set workerUrl(o){h.config.WORKER_URL=o},addProtocol(o,t){h.config.REGISTERED_PROTOCOLS[o]=t},removeProtocol(o){delete h.config.REGISTERED_PROTOCOLS[o]}};return Qs.extend(oa,{isSafari:h.isSafari,getPerformanceMetrics:h.PerformanceUtils.getPerformanceMetrics}),oa});var le=te;return le})})(uh);var Yd=uh.exports,nt=hh(Yd);const dh="3.7.5",Jd=dh,Qd=typeof atob=="function",ep=typeof btoa=="function",vs=typeof Buffer=="function",ph=typeof TextDecoder=="function"?new TextDecoder:void 0,fh=typeof TextEncoder=="function"?new TextEncoder:void 0,tp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",va=Array.prototype.slice.call(tp),Co=(A=>{let x={};return A.forEach((k,K)=>x[k]=K),x})(va),ip=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,_i=String.fromCharCode.bind(String),mh=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):A=>new Uint8Array(Array.prototype.slice.call(A,0)),gh=A=>A.replace(/=/g,"").replace(/[+\/]/g,x=>x=="+"?"-":"_"),_h=A=>A.replace(/[^A-Za-z0-9\+\/]/g,""),yh=A=>{let x,k,K,te,he="";const le=A.length%3;for(let h=0;h<A.length;){if((k=A.charCodeAt(h++))>255||(K=A.charCodeAt(h++))>255||(te=A.charCodeAt(h++))>255)throw new TypeError("invalid character found");x=k<<16|K<<8|te,he+=va[x>>18&63]+va[x>>12&63]+va[x>>6&63]+va[x&63]}return le?he.slice(0,le-3)+"===".substring(le):he},jl=ep?A=>btoa(A):vs?A=>Buffer.from(A,"binary").toString("base64"):yh,ql=vs?A=>Buffer.from(A).toString("base64"):A=>{let k=[];for(let K=0,te=A.length;K<te;K+=4096)k.push(_i.apply(null,A.subarray(K,K+4096)));return jl(k.join(""))},Po=(A,x=!1)=>x?gh(ql(A)):ql(A),rp=A=>{if(A.length<2){var x=A.charCodeAt(0);return x<128?A:x<2048?_i(192|x>>>6)+_i(128|x&63):_i(224|x>>>12&15)+_i(128|x>>>6&63)+_i(128|x&63)}else{var x=65536+(A.charCodeAt(0)-55296)*1024+(A.charCodeAt(1)-56320);return _i(240|x>>>18&7)+_i(128|x>>>12&63)+_i(128|x>>>6&63)+_i(128|x&63)}},np=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,xh=A=>A.replace(np,rp),vh=vs?A=>Buffer.from(A,"utf8").toString("base64"):fh?A=>ql(fh.encode(A)):A=>jl(xh(A)),bs=(A,x=!1)=>x?gh(vh(A)):vh(A),bh=A=>bs(A,!0),sp=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,ap=A=>{switch(A.length){case 4:var x=(7&A.charCodeAt(0))<<18|(63&A.charCodeAt(1))<<12|(63&A.charCodeAt(2))<<6|63&A.charCodeAt(3),k=x-65536;return _i((k>>>10)+55296)+_i((k&1023)+56320);case 3:return _i((15&A.charCodeAt(0))<<12|(63&A.charCodeAt(1))<<6|63&A.charCodeAt(2));default:return _i((31&A.charCodeAt(0))<<6|63&A.charCodeAt(1))}},wh=A=>A.replace(sp,ap),Th=A=>{if(A=A.replace(/\s+/g,""),!ip.test(A))throw new TypeError("malformed base64.");A+="==".slice(2-(A.length&3));let x,k="",K,te;for(let he=0;he<A.length;)x=Co[A.charAt(he++)]<<18|Co[A.charAt(he++)]<<12|(K=Co[A.charAt(he++)])<<6|(te=Co[A.charAt(he++)]),k+=K===64?_i(x>>16&255):te===64?_i(x>>16&255,x>>8&255):_i(x>>16&255,x>>8&255,x&255);return k},Gl=Qd?A=>atob(_h(A)):vs?A=>Buffer.from(A,"base64").toString("binary"):Th,Sh=vs?A=>mh(Buffer.from(A,"base64")):A=>mh(Gl(A).split("").map(x=>x.charCodeAt(0))),Eh=A=>Sh(Ih(A)),op=vs?A=>Buffer.from(A,"base64").toString("utf8"):ph?A=>ph.decode(Sh(A)):A=>wh(Gl(A)),Ih=A=>_h(A.replace(/[-_]/g,x=>x=="-"?"+":"/")),Zl=A=>op(Ih(A)),lp=A=>{if(typeof A!="string")return!1;const x=A.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(x)||!/[^\s0-9a-zA-Z\-_]/.test(x)},Ah=A=>({value:A,enumerable:!1,writable:!0,configurable:!0}),Ch=function(){const A=(x,k)=>Object.defineProperty(String.prototype,x,Ah(k));A("fromBase64",function(){return Zl(this)}),A("toBase64",function(x){return bs(this,x)}),A("toBase64URI",function(){return bs(this,!0)}),A("toBase64URL",function(){return bs(this,!0)}),A("toUint8Array",function(){return Eh(this)})},Ph=function(){const A=(x,k)=>Object.defineProperty(Uint8Array.prototype,x,Ah(k));A("toBase64",function(x){return Po(this,x)}),A("toBase64URI",function(){return Po(this,!0)}),A("toBase64URL",function(){return Po(this,!0)})},cp={version:dh,VERSION:Jd,atob:Gl,atobPolyfill:Th,btoa:jl,btoaPolyfill:yh,fromBase64:Zl,toBase64:bs,encode:bs,encodeURI:bh,encodeURL:bh,utob:xh,btou:wh,decode:Zl,isValid:lp,fromUint8Array:Po,toUint8Array:Eh,extendString:Ch,extendUint8Array:Ph,extendBuiltins:()=>{Ch(),Ph()}};var Xl={exports:{}},ws=typeof Reflect=="object"?Reflect:null,Mh=ws&&typeof ws.apply=="function"?ws.apply:function(x,k,K){return Function.prototype.apply.call(x,k,K)},Mo;ws&&typeof ws.ownKeys=="function"?Mo=ws.ownKeys:Object.getOwnPropertySymbols?Mo=function(x){return Object.getOwnPropertyNames(x).concat(Object.getOwnPropertySymbols(x))}:Mo=function(x){return Object.getOwnPropertyNames(x)};function hp(A){console&&console.warn&&console.warn(A)}var kh=Number.isNaN||function(x){return x!==x};function Et(){Et.init.call(this)}Xl.exports=Et,Xl.exports.once=fp,Et.EventEmitter=Et,Et.prototype._events=void 0,Et.prototype._eventsCount=0,Et.prototype._maxListeners=void 0;var Lh=10;function ko(A){if(typeof A!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof A)}Object.defineProperty(Et,"defaultMaxListeners",{enumerable:!0,get:function(){return Lh},set:function(A){if(typeof A!="number"||A<0||kh(A))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+A+".");Lh=A}}),Et.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Et.prototype.setMaxListeners=function(x){if(typeof x!="number"||x<0||kh(x))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+x+".");return this._maxListeners=x,this};function zh(A){return A._maxListeners===void 0?Et.defaultMaxListeners:A._maxListeners}Et.prototype.getMaxListeners=function(){return zh(this)},Et.prototype.emit=function(x){for(var k=[],K=1;K<arguments.length;K++)k.push(arguments[K]);var te=x==="error",he=this._events;if(he!==void 0)te=te&&he.error===void 0;else if(!te)return!1;if(te){var le;if(k.length>0&&(le=k[0]),le instanceof Error)throw le;var h=new Error("Unhandled error."+(le?" ("+le.message+")":""));throw h.context=le,h}var me=he[x];if(me===void 0)return!1;if(typeof me=="function")Mh(me,this,k);else for(var J=me.length,Ke=Oh(me,J),K=0;K<J;++K)Mh(Ke[K],this,k);return!0};function Dh(A,x,k,K){var te,he,le;if(ko(k),he=A._events,he===void 0?(he=A._events=Object.create(null),A._eventsCount=0):(he.newListener!==void 0&&(A.emit("newListener",x,k.listener?k.listener:k),he=A._events),le=he[x]),le===void 0)le=he[x]=k,++A._eventsCount;else if(typeof le=="function"?le=he[x]=K?[k,le]:[le,k]:K?le.unshift(k):le.push(k),te=zh(A),te>0&&le.length>te&&!le.warned){le.warned=!0;var h=new Error("Possible EventEmitter memory leak detected. "+le.length+" "+String(x)+" listeners added. Use emitter.setMaxListeners() to increase limit");h.name="MaxListenersExceededWarning",h.emitter=A,h.type=x,h.count=le.length,hp(h)}return A}Et.prototype.addListener=function(x,k){return Dh(this,x,k,!1)},Et.prototype.on=Et.prototype.addListener,Et.prototype.prependListener=function(x,k){return Dh(this,x,k,!0)};function up(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Rh(A,x,k){var K={fired:!1,wrapFn:void 0,target:A,type:x,listener:k},te=up.bind(K);return te.listener=k,K.wrapFn=te,te}Et.prototype.once=function(x,k){return ko(k),this.on(x,Rh(this,x,k)),this},Et.prototype.prependOnceListener=function(x,k){return ko(k),this.prependListener(x,Rh(this,x,k)),this},Et.prototype.removeListener=function(x,k){var K,te,he,le,h;if(ko(k),te=this._events,te===void 0)return this;if(K=te[x],K===void 0)return this;if(K===k||K.listener===k)--this._eventsCount===0?this._events=Object.create(null):(delete te[x],te.removeListener&&this.emit("removeListener",x,K.listener||k));else if(typeof K!="function"){for(he=-1,le=K.length-1;le>=0;le--)if(K[le]===k||K[le].listener===k){h=K[le].listener,he=le;break}if(he<0)return this;he===0?K.shift():dp(K,he),K.length===1&&(te[x]=K[0]),te.removeListener!==void 0&&this.emit("removeListener",x,h||k)}return this},Et.prototype.off=Et.prototype.removeListener,Et.prototype.removeAllListeners=function(x){var k,K,te;if(K=this._events,K===void 0)return this;if(K.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):K[x]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete K[x]),this;if(arguments.length===0){var he=Object.keys(K),le;for(te=0;te<he.length;++te)le=he[te],le!=="removeListener"&&this.removeAllListeners(le);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(k=K[x],typeof k=="function")this.removeListener(x,k);else if(k!==void 0)for(te=k.length-1;te>=0;te--)this.removeListener(x,k[te]);return this};function Bh(A,x,k){var K=A._events;if(K===void 0)return[];var te=K[x];return te===void 0?[]:typeof te=="function"?k?[te.listener||te]:[te]:k?pp(te):Oh(te,te.length)}Et.prototype.listeners=function(x){return Bh(this,x,!0)},Et.prototype.rawListeners=function(x){return Bh(this,x,!1)},Et.listenerCount=function(A,x){return typeof A.listenerCount=="function"?A.listenerCount(x):Fh.call(A,x)},Et.prototype.listenerCount=Fh;function Fh(A){var x=this._events;if(x!==void 0){var k=x[A];if(typeof k=="function")return 1;if(k!==void 0)return k.length}return 0}Et.prototype.eventNames=function(){return this._eventsCount>0?Mo(this._events):[]};function Oh(A,x){for(var k=new Array(x),K=0;K<x;++K)k[K]=A[K];return k}function dp(A,x){for(;x+1<A.length;x++)A[x]=A[x+1];A.pop()}function pp(A){for(var x=new Array(A.length),k=0;k<x.length;++k)x[k]=A[k].listener||A[k];return x}function fp(A,x){return new Promise(function(k,K){function te(le){A.removeListener(x,he),K(le)}function he(){typeof A.removeListener=="function"&&A.removeListener("error",te),k([].slice.call(arguments))}Uh(A,x,he,{once:!0}),x!=="error"&&mp(A,te,{once:!0})})}function mp(A,x,k){typeof A.on=="function"&&Uh(A,"error",x,k)}function Uh(A,x,k,K){if(typeof A.on=="function")K.once?A.once(x,k):A.on(x,k);else if(typeof A.addEventListener=="function")A.addEventListener(x,function te(he){K.once&&A.removeEventListener(x,te),k(he)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof A)}var gp=Xl.exports,_p=hh(gp);const lr={AUTO:"auto",STYLE_LOCK:"style_lock",LATIN:"latin",NON_LATIN:"nonlatin",LOCAL:"",ALBANIAN:"sq",AMHARIC:"am",ARABIC:"ar",ARMENIAN:"hy",AZERBAIJANI:"az",BASQUE:"eu",BELORUSSIAN:"be",BOSNIAN:"bs",BRETON:"br",BULGARIAN:"bg",CATALAN:"ca",CHINESE:"zh",CORSICAN:"co",CROATIAN:"hr",CZECH:"cs",DANISH:"da",DUTCH:"nl",ENGLISH:"en",ESPERANTO:"eo",ESTONIAN:"et",FINNISH:"fi",FRENCH:"fr",FRISIAN:"fy",GEORGIAN:"ka",GERMAN:"de",GREEK:"el",HEBREW:"he",HINDI:"hi",HUNGARIAN:"hu",ICELANDIC:"is",INDONESIAN:"id",IRISH:"ga",ITALIAN:"it",JAPANESE:"ja",JAPANESE_HIRAGANA:"ja-Hira",JAPANESE_KANA:"ja_kana",JAPANESE_LATIN:"ja_rm",JAPANESE_2018:"ja-Latn",KANNADA:"kn",KAZAKH:"kk",KOREAN:"ko",KOREAN_LATIN:"ko-Latn",KURDISH:"ku",ROMAN_LATIN:"la",LATVIAN:"lv",LITHUANIAN:"lt",LUXEMBOURGISH:"lb",MACEDONIAN:"mk",MALAYALAM:"ml",MALTESE:"mt",NORWEGIAN:"no",OCCITAN:"oc",POLISH:"pl",PORTUGUESE:"pt",ROMANIAN:"ro",ROMANSH:"rm",RUSSIAN:"ru",SCOTTISH_GAELIC:"gd",SERBIAN_CYRILLIC:"sr",SERBIAN_LATIN:"sr-Latn",SLOVAK:"sk",SLOVENE:"sl",SPANISH:"es",SWEDISH:"sv",TAMIL:"ta",TELUGU:"te",THAI:"th",TURKISH:"tr",UKRAINIAN:"uk",WELSH:"cy"},yp=new Set(Object.values(lr));function Nh(A){return yp.has(A)}const xp=new Set(Object.values(lr));function Wl(){if(typeof navigator>"u")return Intl.DateTimeFormat().resolvedOptions().locale.split("-")[0];const A=Array.from(new Set(navigator.languages.map(x=>x.split("-")[0]))).filter(x=>xp.has(x));return A.length?A[0]:lr.LATIN}function vp(){return typeof self<"u"?fetch.bind(self):typeof global<"u"&&global.fetch?global.fetch:null}class bp{constructor(){this._apiKey="",this._fetch=vp()}set apiKey(x){this._apiKey=x}get apiKey(){return this._apiKey}set fetch(x){this._fetch=x}get fetch(){return this._fetch}}const Qi=new bp,ba={AUTO:"auto",ALBANIAN:"sq",ARABIC:"ar",ARMENIAN:"hy",AZERBAIJANI:"az",BELORUSSIAN:"be",BOSNIAN:"bs",BRETON:"br",BULGARIAN:"bg",CATALAN:"ca",CHINESE:"zh",CROATIAN:"hr",CZECH:"cs",DANISH:"da",DUTCH:"nl",ENGLISH:"en",ESPERANTO:"eo",ESTONIAN:"et",FINNISH:"fi",FRENCH:"fr",FRISIAN:"fy",GEORGIAN:"ka",GERMAN:"de",GREEK:"el",HEBREW:"he",HUNGARIAN:"hu",ICELANDIC:"is",IRISH:"ga",ITALIAN:"it",JAPANESE:"ja",KANNADA:"kn",KAZAKH:"kk",KOREAN:"ko",ROMAN_LATIN:"la",LATVIAN:"lv",LITHUANIAN:"lt",LUXEMBOURGISH:"lb",MACEDONIAN:"mk",MALTESE:"mt",NORWEGIAN:"no",POLISH:"pl",PORTUGUESE:"pt",ROMANIAN:"ro",ROMANSH:"rm",RUSSIAN:"ru",SCOTTISH_GAELIC:"gd",SERBIAN_CYRILLIC:"sr",SLOVAK:"sk",SLOVENE:"sl",SPANISH:"es",SWEDISH:"sv",THAI:"th",TURKISH:"tr",UKRAINIAN:"uk",WELSH:"cy"},wp=new Set(Object.values(ba));function Tp(){if(typeof navigator>"u")return Intl.DateTimeFormat().resolvedOptions().locale.split("-")[0];const A=Array.from(new Set(navigator.languages.map(x=>x.split("-")[0]))).filter(x=>wp.has(x));return A.length?A[0]:ba.ENGLISH}var Sp=(A,x,k)=>new Promise((K,te)=>{var he=me=>{try{h(k.next(me))}catch(J){te(J)}},le=me=>{try{h(k.throw(me))}catch(J){te(J)}},h=me=>me.done?K(me.value):Promise.resolve(me.value).then(he,le);h((k=k.apply(A,x)).next())});function yn(A){return Sp(this,arguments,function*(x,k={}){if(Qi.fetch===null)throw new Error("The fetch function was not found. If on NodeJS < 18 please specify the fetch function with config.fetch");if(new URL(x).searchParams.get("key").trim()==="")throw new Error("The MapTiler Cloud API key is missing. Set it in `config.apiKey` or get one for free at https://maptiler.com");return Qi.fetch(x,k)})}const cr={maptilerApiURL:"https://api.maptiler.com/",mapStyle:"streets-v2"};Object.freeze(cr);class Jr extends Error{constructor(x,k=""){super(`Call to enpoint ${x.url} failed with the status code ${x.status}. ${k}`),this.res=x}}var Lo=(A,x,k)=>new Promise((K,te)=>{var he=me=>{try{h(k.next(me))}catch(J){te(J)}},le=me=>{try{h(k.throw(me))}catch(J){te(J)}},h=me=>me.done?K(me.value):Promise.resolve(me.value).then(he,le);h((k=k.apply(A,x)).next())});const zo={400:"Query too long / Invalid parameters",403:"Key is missing, invalid or restricted"};function Vh(A,x){if(x.language==null)return;const k=Array.from(new Set((Array.isArray(x.language)?x.language:[x.language]).map(K=>K===ba.AUTO?Tp():K))).join(",");A.set("language",k)}function $h(A,x){var k;A.set("key",(k=x.apiKey)!=null?k:Qi.apiKey),x.limit!=null&&A.set("limit",String(x.limit)),x.types!=null&&A.set("types",x.types.join(",")),Vh(A,x)}function jh(A,x){$h(A,x),x.bbox!=null&&A.set("bbox",x.bbox.join(",")),x.proximity!=null&&A.set("proximity",x.proximity.join(",")),x.country!=null&&A.set("country",x.country.join(",")),x.fuzzyMatch!=null&&A.set("fuzzyMatch",x.fuzzyMatch?"true":"false"),x.autocomplete!=null&&A.set("autocomplete",x.autocomplete?"true":"false")}function Ep(A){return Lo(this,arguments,function*(x,k={}){var K;if(typeof x!="string"||x.trim().length===0)throw new Error("The query must be a non-empty string");const te=new URL(`geocoding/${encodeURIComponent(x)}.json`,cr.maptilerApiURL),{searchParams:he}=te;jh(he,k);const le=te.toString(),h=yield yn(le);if(!h.ok)throw new Jr(h,(K=zo[h.status])!=null?K:"");return yield h.json()})}function Ip(A){return Lo(this,arguments,function*(x,k={}){var K;if(!Array.isArray(x)||x.length<2)throw new Error("The position must be an array of form [lng, lat].");const te=new URL(`geocoding/${x[0]},${x[1]}.json`,cr.maptilerApiURL);$h(te.searchParams,k);const he=te.toString(),le=yield yn(he);if(!le.ok)throw new Jr(le,(K=zo[le.status])!=null?K:"");return yield le.json()})}function Ap(A){return Lo(this,arguments,function*(x,k={}){var K;const te=new URL(`geocoding/${x}.json`,cr.maptilerApiURL);Vh(te.searchParams,k);const he=te.toString(),le=yield yn(he);if(!le.ok)throw new Jr(le,(K=zo[le.status])!=null?K:"");return yield le.json()})}function Cp(A){return Lo(this,arguments,function*(x,k={}){var K;if(!x.length)return[];const te=x.map(Ke=>encodeURIComponent(Ke)).join(";"),he=new URL(`geocoding/${te}.json`,cr.maptilerApiURL),{searchParams:le}=he;jh(le,k);const h=he.toString(),me=yield yn(h);if(!me.ok)throw new Jr(me,(K=zo[me.status])!=null?K:"");const J=yield me.json();return x.length===1?[J]:J})}const Pp={forward:Ep,reverse:Ip,byId:Ap,batch:Cp,language:ba};var Mp=(A,x,k)=>new Promise((K,te)=>{var he=me=>{try{h(k.next(me))}catch(J){te(J)}},le=me=>{try{h(k.throw(me))}catch(J){te(J)}},h=me=>me.done?K(me.value):Promise.resolve(me.value).then(he,le);h((k=k.apply(A,x)).next())});const qh={403:"Key is missing, invalid or restricted"};function kp(){return Mp(this,arguments,function*(A={}){var x;const k=new URL("geolocation/ip.json",cr.maptilerApiURL);k.searchParams.set("key",(x=A.apiKey)!=null?x:Qi.apiKey);const K=k.toString(),te=yield yn(K);if(!te.ok)throw new Jr(te,te.status in qh?qh[te.status]:"");return yield te.json()})}const Hl={info:kp};var Gh=(A,x,k)=>new Promise((K,te)=>{var he=me=>{try{h(k.next(me))}catch(J){te(J)}},le=me=>{try{h(k.throw(me))}catch(J){te(J)}},h=me=>me.done?K(me.value):Promise.resolve(me.value).then(he,le);h((k=k.apply(A,x)).next())});const Do={403:"Key is missing, invalid or restricted"};function Lp(A){return Gh(this,arguments,function*(x,k={}){var K;if(typeof x!="string"||x.trim().length===0)throw new Error("The query must be a non-empty string");const te=new URL(`coordinates/search/${x}.json`,cr.maptilerApiURL);te.searchParams.set("key",(K=k.apiKey)!=null?K:Qi.apiKey),"limit"in k&&te.searchParams.set("limit",k.limit.toString()),"transformations"in k&&te.searchParams.set("transformations",k.transformations.toString()),"exports"in k&&te.searchParams.set("exports",k.exports.toString());const he=te.toString(),le=yield yn(he);if(!le.ok)throw new Jr(le,le.status in Do?Do[le.status]:"");return yield le.json()})}function zp(A){return Gh(this,arguments,function*(x,k={}){var K;const te=(Array.isArray(x[0])?x:[x]).map(J=>`${J[0]},${J[1]}`).join(";"),he=new URL(`coordinates/transform/${te}.json`,cr.maptilerApiURL);he.searchParams.set("key",(K=k.apiKey)!=null?K:Qi.apiKey),"sourceCrs"in k&&he.searchParams.set("s_srs",k.sourceCrs.toString()),"targetCrs"in k&&he.searchParams.set("t_srs",k.targetCrs.toString()),"operations"in k&&he.searchParams.set("ops",(Array.isArray(k.operations)?k.operations:[k.operations]).join("|"));const le=he.toString(),h=yield yn(le);if(!h.ok)throw new Jr(h,h.status in Do?Do[h.status]:"");return yield h.json()})}const Dp={search:Lp,transform:zp};var Rp=(A,x,k)=>new Promise((K,te)=>{var he=me=>{try{h(k.next(me))}catch(J){te(J)}},le=me=>{try{h(k.throw(me))}catch(J){te(J)}},h=me=>me.done?K(me.value):Promise.resolve(me.value).then(he,le);h((k=k.apply(A,x)).next())});const Zh={403:"Key is missing, invalid or restricted"};function Bp(A){return Rp(this,arguments,function*(x,k={}){var K;if(typeof x!="string"||x.trim().length===0)throw new Error("The data ID must be a non-empty string");const te=new URL(`data/${encodeURIComponent(x)}/features.json`,cr.maptilerApiURL);te.searchParams.set("key",(K=k.apiKey)!=null?K:Qi.apiKey);const he=te.toString(),le=yield yn(he);if(!le.ok)throw new Jr(le,le.status in Zh?Zh[le.status]:"");return yield le.json()})}const Fp={get:Bp};function Xh(A){const x=/^maptiler:\/\/(.*)/;let k;const K=A.trim();let te;return K.startsWith("http://")||K.startsWith("https://")?te=K:(k=x.exec(K))!==null?te=`https://api.maptiler.com/maps/${k[1]}/style.json`:te=`https://api.maptiler.com/maps/${K}/style.json`,te}class Ro{constructor(x,k,K,te,he,le){this.name=x,this.variantType=k,this.id=K,this.referenceStyle=te,this.description=he,this.imageURL=le}getName(){return this.name}getFullName(){return`${this.referenceStyle.getName()} ${this.name}`}getType(){return this.variantType}getId(){return this.id}getDescription(){return this.description}getReferenceStyle(){return this.referenceStyle}hasVariant(x){return this.referenceStyle.hasVariant(x)}getVariant(x){return this.referenceStyle.getVariant(x)}getVariants(){return this.referenceStyle.getVariants().filter(x=>x!==this)}getImageURL(){return this.imageURL}getExpandedStyleURL(){return Xh(this.getId())}}class Bo{constructor(x,k){this.name=x,this.id=k,this.variants={},this.orderedVariants=[]}getName(){return this.name}getId(){return this.id}addVariant(x){this.variants[x.getType()]=x,this.orderedVariants.push(x)}hasVariant(x){return x in this.variants}getVariant(x){return x in this.variants?this.variants[x]:this.orderedVariants[0]}getVariants(){return Object.values(this.variants)}getDefaultVariant(){return this.orderedVariants[0]}}const Fo=[{referenceStyleID:"STREETS",name:"Streets",description:"",variants:[{id:"streets-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"streets-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"streets-v2-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""},{id:"streets-v2-night",name:"Night",variantType:"NIGHT",description:"",imageURL:""},{id:"streets-v2-pastel",name:"Pastel",variantType:"PASTEL",description:"",imageURL:""}]},{referenceStyleID:"OUTDOOR",name:"Outdoor",description:"",variants:[{id:"outdoor-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"outdoor-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""}]},{referenceStyleID:"WINTER",name:"Winter",description:"",variants:[{id:"winter-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"winter-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""}]},{referenceStyleID:"SATELLITE",name:"Satellite",description:"",variants:[{id:"satellite",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"HYBRID",name:"Hybrid",description:"",variants:[{id:"hybrid",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"BASIC",name:"Basic",description:"",variants:[{id:"basic-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"basic-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"basic-v2-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""}]},{referenceStyleID:"BRIGHT",name:"Bright",description:"",variants:[{id:"bright-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"bright-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"bright-v2-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""},{id:"bright-v2-pastel",name:"Pastel",variantType:"PASTEL",description:"",imageURL:""}]},{referenceStyleID:"OPENSTREETMAP",name:"OpenStreetMap",description:"",variants:[{id:"openstreetmap",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"TOPO",name:"Topo",description:"",variants:[{id:"topo-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"topo-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"topo-v2-shiny",name:"Shiny",variantType:"SHINY",description:"",imageURL:""},{id:"topo-v2-pastel",name:"Pastel",variantType:"PASTEL",description:"",imageURL:""},{id:"topo-v2-topographique",name:"Topographique",variantType:"TOPOGRAPHIQUE",description:"",imageURL:""}]},{referenceStyleID:"VOYAGER",name:"Voyager",description:"",variants:[{id:"voyager-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"voyager-v2-darkmatter",name:"Darkmatter",variantType:"DARK",description:"",imageURL:""},{id:"voyager-v2-positron",name:"Positron",variantType:"LIGHT",description:"",imageURL:""},{id:"voyager-v2-vintage",name:"Vintage",variantType:"VINTAGE",description:"",imageURL:""}]},{referenceStyleID:"TONER",name:"Toner",description:"",variants:[{id:"toner-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"toner-v2-background",name:"Background",variantType:"BACKGROUND",description:"",imageURL:""},{id:"toner-v2-lite",name:"Lite",variantType:"LITE",description:"",imageURL:""},{id:"toner-v2-lines",name:"Lines",variantType:"LINES",description:"",imageURL:""}]},{referenceStyleID:"DATAVIZ",name:"Dataviz",description:"",variants:[{id:"dataviz",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"dataviz-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"dataviz-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""}]},{referenceStyleID:"BACKDROP",name:"Backdrop",description:"",variants:[{id:"backdrop",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"backdrop-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"backdrop-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""}]},{referenceStyleID:"OCEAN",name:"Ocean",description:"",variants:[{id:"ocean",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]}];function Op(A){return new Proxy(A,{get(x,k,K){return x.hasVariant(k)?x.getVariant(k):k.toString().toUpperCase()===k?A.getDefaultVariant():Reflect.get(x,k,K)}})}function Up(){const A={};for(let x=0;x<Fo.length;x+=1){const k=Fo[x],K=Op(new Bo(k.name,k.referenceStyleID));for(let te=0;te<k.variants.length;te+=1){const he=k.variants[te],le=new Ro(he.name,he.variantType,he.id,K,he.description,he.imageURL);K.addVariant(le)}A[k.referenceStyleID]=K}return A}function Kl(A){if(!A)return Yl[Fo[0].referenceStyleID].getDefaultVariant().getId();if(typeof A=="string"||A instanceof String)return A.trim().toLowerCase();if(A instanceof Ro)return A.getId();if(A instanceof Bo)return A.getDefaultVariant().getId()}const Yl=Up();function Np(A,x,k){let K=x[0],te=x[1],he=k[0]-K,le=k[1]-te;if(he!==0||le!==0){const h=((A[0]-K)*he+(A[1]-te)*le)/(he*he+le*le);h>1?(K=k[0],te=k[1]):h>0&&(K+=he*h,te+=le*h)}return he=A[0]-K,le=A[1]-te,he*he+le*le}function Jl(A,x,k,K,te){let he=K,le;for(let h=x+1;h<k;h++){const me=Np(A[h],A[x],A[k]);me>he&&(le=h,he=me)}he>K&&(le-x>1&&Jl(A,x,le,K,te),te.push(A[le]),k-le>1&&Jl(A,le,k,K,te))}function Vp(A,x){const k=A.length-1,K=[A[0]];return Jl(A,0,k,x,K),K.push(A[k]),K}function $p(A,x){if(A.length<=2)return A;const k=x!==void 0?x*x:1;return Vp(A,k)}function Ql(A,x=!0){let k=`${A[0]},${A[1]}`;return A.length===3&&x&&(k+=`,${A[2]}`),k}function ec(A,x=3e3){let k=A.map(he=>he.join(",")).join("|"),K=5e-6;const te=1e-5;for(;k.length>x;)k=$p(A,K).map(le=>`${le[0]},${le[1]}`).join("|"),K+=te;return k}function jp(A,x,k={}){var K,te,he,le,h;const me=Kl(k.style),J=k.hiDPI?"@2x":"",Ke=(K=k.format)!=null?K:"png";let ve=~~((te=k.width)!=null?te:1024),Ee=~~((he=k.height)!=null?he:1024);k.hiDPI&&(ve=~~(ve/2),Ee=~~(Ee/2));const Xe=new URL(`maps/${encodeURIComponent(me)}/static/${A[0]},${A[1]},${x}/${ve}x${Ee}${J}.${Ke}`,cr.maptilerApiURL);if("attribution"in k&&Xe.searchParams.set("attribution",k.attribution.toString()),"markers"in k){let je="";const kt="markerIcon"in k;kt&&(je+=`icon:${k.markerIcon}|`),kt&&"markerAnchor"in k&&(je+=`anchor:${k.markerAnchor}|`),kt&&k.hiDPI&&(je+="scale:2|");const Dt=Array.isArray(k.markers[0])?k.markers:[k.markers];je+=Dt.map(Ct=>Ql(Ct,!kt)).join("|"),Xe.searchParams.set("markers",je)}if("path"in k){let je="";if(je+=`fill:${(le=k.pathFillColor)!=null?le:"none"}|`,"pathStrokeColor"in k&&(je+=`stroke:${k.pathStrokeColor}|`),"pathWidth"in k){const kt=k.pathWidth/(k.hiDPI?2:1);je+=`width:${kt.toString()}|`}je+=ec(k.path),Xe.searchParams.set("path",je)}return Xe.searchParams.set("key",(h=k.apiKey)!=null?h:Qi.apiKey),Xe.toString()}function qp(A,x={}){var k,K,te,he,le;const h=Kl(x.style),me=x.hiDPI?"@2x":"",J=(k=x.format)!=null?k:"png";let Ke=~~((K=x.width)!=null?K:1024),ve=~~((te=x.height)!=null?te:1024);x.hiDPI&&(Ke=~~(Ke/2),ve=~~(ve/2));const Ee=new URL(`maps/${encodeURIComponent(h)}/static/${A[0]},${A[1]},${A[2]},${A[3]}/${Ke}x${ve}${me}.${J}`,cr.maptilerApiURL);if("attribution"in x&&Ee.searchParams.set("attribution",x.attribution.toString()),"padding"in x&&Ee.searchParams.set("padding",x.padding.toString()),"markers"in x){let Xe="";const je="markerIcon"in x;je&&(Xe+=`icon:${x.markerIcon}|`),je&&"markerAnchor"in x&&(Xe+=`anchor:${x.markerAnchor}|`),je&&x.hiDPI&&(Xe+="scale:2|");const kt=Array.isArray(x.markers[0])?x.markers:[x.markers];Xe+=kt.map(Dt=>Ql(Dt,!je)).join("|"),Ee.searchParams.set("markers",Xe)}if("path"in x){let Xe="";if(Xe+=`fill:${(he=x.pathFillColor)!=null?he:"none"}|`,"pathStrokeColor"in x&&(Xe+=`stroke:${x.pathStrokeColor}|`),"pathWidth"in x){const je=x.pathWidth/(x.hiDPI?2:1);Xe+=`width:${je.toString()}|`}Xe+=ec(x.path),Ee.searchParams.set("path",Xe)}return Ee.searchParams.set("key",(le=x.apiKey)!=null?le:Qi.apiKey),Ee.toString()}function Gp(A={}){var x,k,K,te,he;if(!("markers"in A)&&!("path"in A))throw new Error("Automatic static maps require markers and/or path to be created.");const le=Kl(A.style),h=A.hiDPI?"@2x":"",me=(x=A.format)!=null?x:"png";let J=~~((k=A.width)!=null?k:1024),Ke=~~((K=A.height)!=null?K:1024);A.hiDPI&&(J=~~(J/2),Ke=~~(Ke/2));const ve=new URL(`maps/${encodeURIComponent(le)}/static/auto/${J}x${Ke}${h}.${me}`,cr.maptilerApiURL);if("attribution"in A&&ve.searchParams.set("attribution",A.attribution.toString()),"padding"in A&&ve.searchParams.set("padding",A.padding.toString()),"markers"in A){let Ee="";const Xe="markerIcon"in A;Xe&&(Ee+=`icon:${A.markerIcon}|`),Xe&&"markerAnchor"in A&&(Ee+=`anchor:${A.markerAnchor}|`),Xe&&A.hiDPI&&(Ee+="scale:2|");const je=Array.isArray(A.markers[0])?A.markers:[A.markers];Ee+=je.map(kt=>Ql(kt,!Xe)).join("|"),ve.searchParams.set("markers",Ee)}if("path"in A){let Ee="";if(Ee+=`fill:${(te=A.pathFillColor)!=null?te:"none"}|`,"pathStrokeColor"in A&&(Ee+=`stroke:${A.pathStrokeColor}|`),"pathWidth"in A){const Xe=A.pathWidth/(A.hiDPI?2:1);Ee+=`width:${Xe.toString()}|`}Ee+=ec(A.path),ve.searchParams.set("path",Ee)}return ve.searchParams.set("key",(he=A.apiKey)!=null?he:Qi.apiKey),ve.toString()}const Zp={centered:jp,bounded:qp,automatic:Gp};let Oo;const Xp=new Uint8Array(16);function Wp(){if(!Oo&&(Oo=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Oo))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Oo(Xp)}const yi=[];for(let A=0;A<256;++A)yi.push((A+256).toString(16).slice(1));function Hp(A,x=0){return(yi[A[x+0]]+yi[A[x+1]]+yi[A[x+2]]+yi[A[x+3]]+"-"+yi[A[x+4]]+yi[A[x+5]]+"-"+yi[A[x+6]]+yi[A[x+7]]+"-"+yi[A[x+8]]+yi[A[x+9]]+"-"+yi[A[x+10]]+yi[A[x+11]]+yi[A[x+12]]+yi[A[x+13]]+yi[A[x+14]]+yi[A[x+15]]).toLowerCase()}var Wh={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Kp(A,x,k){if(Wh.randomUUID&&!x&&!A)return Wh.randomUUID();A=A||{};const K=A.random||(A.rng||Wp)();if(K[6]=K[6]&15|64,K[8]=K[8]&63|128,x){k=k||0;for(let te=0;te<16;++te)x[k+te]=K[te];return x}return Hp(K)}const Hh=Kp();let Kh=class extends _p{constructor(){super(),this.primaryLanguage=lr.AUTO,this.secondaryLanguage=null,this.session=!0,this._unit="metric",this._apiKey=""}set unit(x){this._unit=x,this.emit("unit",x)}get unit(){return this._unit}set apiKey(x){this._apiKey=x,Qi.apiKey=x,this.emit("apiKey",x)}get apiKey(){return this._apiKey}set fetch(x){Qi.fetch=x}get fetch(){return Qi.fetch}};const wr=new Kh,ji={maptilerLogoURL:"https://api.maptiler.com/resources/logo.svg",maptilerURL:"https://www.maptiler.com/",maptilerApiHost:"api.maptiler.com",rtlPluginURL:"https://cdn.maptiler.com/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.min.js",primaryLanguage:lr.AUTO,secondaryLanguage:lr.LOCAL,terrainSourceURL:"https://api.maptiler.com/tiles/terrain-rgb-v2/tiles.json",terrainSourceId:"maptiler-terrain"};Object.freeze(ji);class Yh extends nt.LogoControl{onAdd(x){return super.onAdd(x)}}class tc extends Yh{constructor(x={}){var k,K;super(x),this.logoURL="",this.linkURL="",this.logoURL=(k=x.logoURL)!=null?k:ji.maptilerLogoURL,this.linkURL=(K=x.linkURL)!=null?K:ji.maptilerURL}onAdd(x){this._map=x,this._compact=this.options&&this.options.compact,this._container=window.document.createElement("div"),this._container.className="maplibregl-ctrl";const k=window.document.createElement("a");return k.style.backgroundRepeat="no-repeat",k.style.cursor="pointer",k.style.display="block",k.style.height="23px",k.style.margin="0 0 -4px -4px",k.style.overflow="hidden",k.style.width="88px",k.style.backgroundImage=`url(${this.logoURL})`,k.style.backgroundSize="100px 30px",k.style.width="100px",k.style.height="30px",k.target="_blank",k.rel="noopener",k.href=this.linkURL,k.setAttribute("aria-label","MapTiler logo"),k.setAttribute("rel","noopener"),this._container.appendChild(k),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}}var Yp=Object.defineProperty,Jh=Object.getOwnPropertySymbols,Jp=Object.prototype.hasOwnProperty,Qp=Object.prototype.propertyIsEnumerable,Qh=(A,x,k)=>x in A?Yp(A,x,{enumerable:!0,configurable:!0,writable:!0,value:k}):A[x]=k,eu=(A,x)=>{for(var k in x||(x={}))Jp.call(x,k)&&Qh(A,k,x[k]);if(Jh)for(var k of Jh(x))Qp.call(x,k)&&Qh(A,k,x[k]);return A};function ef(){nt.getRTLTextPluginStatus()==="unavailable"&&nt.setRTLTextPlugin(ji.rtlPluginURL,null,!0)}function tf(A,x){A.forEach(k=>{x[k]&&(x[k]=x[k].bind(x))})}function Zn(A,x,k){const K=window.document.createElement(A);return x!==void 0&&(K.className=x),k&&k.appendChild(K),K}function rf(A){A.parentNode&&A.parentNode.removeChild(A)}function tu(A,x){let k=null;try{k=new URL(A)}catch{return{url:A}}return k.host===ji.maptilerApiHost&&(k.searchParams.has("key")||k.searchParams.append("key",wr.apiKey),wr.session&&k.searchParams.append("mtsid",Hh)),{url:k.href}}function iu(A=null){return function(x,k){if(A){const K=A(x,k),te=tu(K.url);return eu(eu({},K),te)}else return tu(x)}}function ru(A){return A?typeof A=="string"||A instanceof String?!A.startsWith("http")&&A.toLowerCase().includes(".json")?A:Xh(A):A instanceof Ro?A.getExpandedStyleURL():A instanceof Bo?A.getDefaultVariant().getExpandedStyleURL():A:Yl[Fo[0].referenceStyleID].getDefaultVariant().getExpandedStyleURL()}class nu{constructor(){tf(["_toggleTerrain","_updateTerrainIcon"],this)}onAdd(x){return this._map=x,this._container=Zn("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=Zn("button","maplibregl-ctrl-terrain",this._container),Zn("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(){rf(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}_toggleTerrain(){this._map.hasTerrain()?this._map.disableTerrain():this._map.enableTerrain(),this._updateTerrainIcon()}_updateTerrainIcon(){this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.hasTerrain()?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))}}class su extends nt.NavigationControl{onAdd(x){return super.onAdd(x)}}class au extends su{constructor(){super({showCompass:!0,showZoom:!0,visualizePitch:!0}),this._compass.removeEventListener("click",this._compass.clickFunction),this._compass.addEventListener("click",x=>{this._map.getPitch()===0?this._map.easeTo({pitch:Math.min(this._map.getMaxPitch(),80)}):this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:x}):this._map.resetNorth({},{originalEvent:x})})}_createButton(x,k){const K=super._createButton(x,k);return K.clickFunction=k,K}_rotateCompassArrow(){const x=this.options.visualizePitch?`scale(${Math.min(1.5,1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5))}) rotateX(${Math.min(70,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=x}}class ou extends nt.GeolocateControl{onAdd(x){return super.onAdd(x)}}var nf=Object.defineProperty,sf=Object.defineProperties,af=Object.getOwnPropertyDescriptors,lu=Object.getOwnPropertySymbols,of=Object.prototype.hasOwnProperty,lf=Object.prototype.propertyIsEnumerable,cu=(A,x,k)=>x in A?nf(A,x,{enumerable:!0,configurable:!0,writable:!0,value:k}):A[x]=k,cf=(A,x)=>{for(var k in x||(x={}))of.call(x,k)&&cu(A,k,x[k]);if(lu)for(var k of lu(x))lf.call(x,k)&&cu(A,k,x[k]);return A},hf=(A,x)=>sf(A,af(x));const hu=nt.Marker,uu=nt.LngLat,uf=nt.LngLatBounds;class du extends ou{constructor(){super(...arguments),this.lastUpdatedCenter=new uu(0,0)}_updateCamera(x){const k=new uu(x.coords.longitude,x.coords.latitude),K=x.coords.accuracy,te=this._map.getBearing(),he=hf(cf({bearing:te},this.options.fitBoundsOptions),{linear:!0}),le=this._map.getZoom();le>this.options.fitBoundsOptions.maxZoom&&(he.zoom=le),this._map.fitBounds(uf.fromLngLat(k,K),he,{geolocateSource:!0});let h=!1;const me=()=>{h=!0};this._map.once("click",me),this._map.once("dblclick",me),this._map.once("dragstart",me),this._map.once("mousedown",me),this._map.once("touchstart",me),this._map.once("wheel",me),this._map.once("moveend",()=>{this._map.off("click",me),this._map.off("dblclick",me),this._map.off("dragstart",me),this._map.off("mousedown",me),this._map.off("touchstart",me),this._map.off("wheel",me),!h&&(this.lastUpdatedCenter=this._map.getCenter())})}_setupUI(x){if(this.lastUpdatedCenter=this._map.getCenter(),this._container.addEventListener("contextmenu",k=>k.preventDefault()),this._geolocateButton=Zn("button","maplibregl-ctrl-geolocate",this._container),Zn("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",x===!1){const k=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=k,this._geolocateButton.setAttribute("aria-label",k)}else{const k=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=k,this._geolocateButton.setAttribute("aria-label",k)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=Zn("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new hu(this._dotElement),this._circleElement=Zn("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new hu({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("move",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("moveend",k=>{const K=k.originalEvent&&k.originalEvent.type==="resize",te=this.lastUpdatedCenter.distanceTo(this._map.getCenter());!k.geolocateSource&&this._watchState==="ACTIVE_LOCK"&&!K&&te>1&&(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new Event("trackuserlocationend")))})}_updateCircleRadius(){if(this._watchState!=="BACKGROUND"&&this._watchState!=="ACTIVE_LOCK")return;const x=[this._lastKnownPosition.coords.longitude,this._lastKnownPosition.coords.latitude],k=this._map.project(x),K=this._map.unproject([k.x,k.y]),te=this._map.unproject([k.x+20,k.y]),he=K.distanceTo(te)/20,le=Math.ceil(2*this._accuracy/he);this._circleElement.style.width=`${le}px`,this._circleElement.style.height=`${le}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}}class pu extends nt.AttributionControl{onAdd(x){return super.onAdd(x)}}class fu extends nt.ScaleControl{onAdd(x){return super.onAdd(x)}}class mu extends nt.FullscreenControl{onAdd(x){return super.onAdd(x)}}var df=Object.defineProperty,pf=Object.defineProperties,ff=Object.getOwnPropertyDescriptors,gu=Object.getOwnPropertySymbols,mf=Object.prototype.hasOwnProperty,gf=Object.prototype.propertyIsEnumerable,_u=(A,x,k)=>x in A?df(A,x,{enumerable:!0,configurable:!0,writable:!0,value:k}):A[x]=k,_f=(A,x)=>{for(var k in x||(x={}))mf.call(x,k)&&_u(A,k,x[k]);if(gu)for(var k of gu(x))gf.call(x,k)&&_u(A,k,x[k]);return A},yf=(A,x)=>pf(A,ff(x)),xn=(A,x,k)=>new Promise((K,te)=>{var he=me=>{try{h(k.next(me))}catch(J){te(J)}},le=me=>{try{h(k.throw(me))}catch(J){te(J)}},h=me=>me.done?K(me.value):Promise.resolve(me.value).then(he,le);h((k=k.apply(A,x)).next())});const yu={POINT:"POINT",COUNTRY:"COUNTRY"};let xf=class extends nt.Map{constructor(x){var k,K,te;x.apiKey&&(wr.apiKey=x.apiKey);const he=ru(x.style),le=location.hash;wr.apiKey||console.warn("MapTiler Cloud API key is not set. Visit https://maptiler.com and try Cloud for free!"),super(yf(_f({},x),{style:he,maplibreLogo:!1,transformRequest:iu(x.transformRequest)})),this.isTerrainEnabled=!1,this.terrainExaggeration=1,this.primaryLanguage=null,this.secondaryLanguage=null,this.terrainGrowing=!1,this.terrainFlattening=!1,this.primaryLanguage=(k=x.language)!=null?k:wr.primaryLanguage,this.secondaryLanguage=wr.secondaryLanguage,this.terrainExaggeration=(K=x.terrainExaggeration)!=null?K:this.terrainExaggeration,this.once("styledata",()=>xn(this,null,function*(){if(!x.geolocate||x.center||x.hash&&le)return;try{if(x.geolocate===yu.COUNTRY){yield this.fitToIpBounds();return}}catch(Ee){console.warn(Ee.message)}let ve=null;try{yield this.centerOnIpPoint(x.zoom),ve=this.getCameraHash()}catch(Ee){console.warn(Ee.message)}(yield navigator.permissions.query({name:"geolocation"})).state==="granted"&&navigator.geolocation.getCurrentPosition(Ee=>{ve===this.getCameraHash()&&(this.terrain?this.easeTo({center:[Ee.coords.longitude,Ee.coords.latitude],zoom:x.zoom||12,duration:2e3}):this.once("terrain",()=>{this.easeTo({center:[Ee.coords.longitude,Ee.coords.latitude],zoom:x.zoom||12,duration:2e3})}))},null,{maximumAge:24*3600*1e3,timeout:5e3,enableHighAccuracy:!1})})),this.on("styledata",()=>{this.setPrimaryLanguage(this.primaryLanguage),this.setSecondaryLanguage(this.secondaryLanguage)}),this.on("styledata",()=>{this.getTerrain()===null&&this.isTerrainEnabled&&this.enableTerrain(this.terrainExaggeration)}),this.once("load",()=>xn(this,null,function*(){ef()})),this.once("load",()=>xn(this,null,function*(){let ve={logo:null};try{const Ee=Object.keys(this.style.sourceCaches).map(je=>this.getSource(je)).filter(je=>typeof je.url=="string"&&je.url.includes("tiles.json")),Xe=new URL(Ee[0].url);Xe.searchParams.has("key")||Xe.searchParams.append("key",wr.apiKey),ve=yield(yield fetch(Xe.href)).json()}catch{}if("logo"in ve&&ve.logo){const Ee=ve.logo;this.addControl(new tc({logoURL:Ee}),x.logoPosition),x.attributionControl===!1&&this.addControl(new pu({customAttribution:x.customAttribution}))}else x.maptilerLogo&&this.addControl(new tc,x.logoPosition);if(x.scaleControl){const Ee=x.scaleControl===!0||x.scaleControl===void 0?"bottom-right":x.scaleControl,Xe=new fu({unit:wr.unit});this.addControl(Xe,Ee),wr.on("unit",je=>{Xe.setUnit(je)})}if(x.navigationControl!==!1){const Ee=x.navigationControl===!0||x.navigationControl===void 0?"top-right":x.navigationControl;this.addControl(new au,Ee)}if(x.geolocateControl!==!1){const Ee=x.geolocateControl===!0||x.geolocateControl===void 0?"top-right":x.geolocateControl;this.addControl(new du({positionOptions:{enableHighAccuracy:!0,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!0,showAccuracyCircle:!0,showUserLocation:!0}),Ee)}if(x.terrainControl){const Ee=x.terrainControl===!0||x.terrainControl===void 0?"top-right":x.terrainControl;this.addControl(new nu,Ee)}if(x.fullscreenControl){const Ee=x.fullscreenControl===!0||x.fullscreenControl===void 0?"top-right":x.fullscreenControl;this.addControl(new mu({}),Ee)}}));let h=!1,me=!1,J=null;this.once("load",ve=>{h=!0,me&&this.fire("loadWithTerrain",J)});const Ke=ve=>{ve.terrain&&(me=!0,J={type:"loadWithTerrain",target:this,terrain:ve.terrain},this.off("terrain",Ke),h&&this.fire("loadWithTerrain",J))};this.on("terrain",Ke),x.terrain&&this.enableTerrain((te=x.terrainExaggeration)!=null?te:this.terrainExaggeration)}onLoadAsync(){return xn(this,null,function*(){return new Promise((x,k)=>{if(this.loaded())return x(this);this.once("load",K=>{x(this)})})})}onLoadWithTerrainAsync(){return xn(this,null,function*(){return new Promise((x,k)=>{if(this.loaded()&&this.terrain)return x(this);this.once("loadWithTerrain",K=>{x(this)})})})}setStyle(x,k){return super.setStyle(ru(x),k)}setLanguage(x=ji.primaryLanguage){if(x===lr.AUTO)return this.setLanguage(Wl());this.setPrimaryLanguage(x)}setPrimaryLanguage(x=ji.primaryLanguage){if(this.primaryLanguage===lr.STYLE_LOCK){console.warn("The language cannot be changed because this map has been instantiated with the STYLE_LOCK language flag.");return}Nh(x)&&(this.primaryLanguage=x,this.onStyleReady(()=>{if(x===lr.AUTO)return this.setPrimaryLanguage(Wl());const k=this.getStyle().layers,K=/^\s*{\s*name\s*(:\s*(\S*))?\s*}$/,te=/^\s*name\s*(:\s*(\S*))?\s*$/,he=/^\s*{\s*name\s*(:\s*(\S*))?\s*}(\s*){\s*name\s*(:\s*(\S*))?\s*}$/,le=/^(.*)({\s*name\s*(:\s*(\S*))?\s*})(.*)$/,h=x?`name:${x}`:"name",me=["case",["has",h],["get",h],["get","name"]];for(let J=0;J<k.length;J+=1){const Ke=k[J],ve=Ke.layout;if(!ve||!ve["text-field"])continue;const Ee=this.getLayoutProperty(Ke.id,"text-field");let Xe;if(Array.isArray(Ee)&&Ee.length>=2&&Ee[0].trim().toLowerCase()==="concat"){const je=Ee.slice();for(let kt=0;kt<Ee.length;kt+=1){const Dt=Ee[kt];if((typeof Dt=="string"||Dt instanceof String)&&K.exec(Dt.toString())){je[kt]=me;break}else if(Array.isArray(Dt)&&Dt.length>=2&&Dt[0].trim().toLowerCase()==="get"&&te.exec(Dt[1].toString())){je[kt]=me;break}else if(Array.isArray(Dt)&&Dt.length===4&&Dt[0].trim().toLowerCase()==="case"){je[kt]=me;break}}this.setLayoutProperty(Ke.id,"text-field",je)}else if(Array.isArray(Ee)&&Ee.length>=2&&Ee[0].trim().toLowerCase()==="get"&&te.exec(Ee[1].toString())){const je=me;this.setLayoutProperty(Ke.id,"text-field",je)}else if((typeof Ee=="string"||Ee instanceof String)&&K.exec(Ee.toString())){const je=me;this.setLayoutProperty(Ke.id,"text-field",je)}else if(Array.isArray(Ee)&&Ee.length===4&&Ee[0].trim().toLowerCase()==="case"){const je=me;this.setLayoutProperty(Ke.id,"text-field",je)}else if((typeof Ee=="string"||Ee instanceof String)&&(Xe=he.exec(Ee.toString()))!==null){const je=`{${h}}${Xe[3]}{name${Xe[4]||""}}`;this.setLayoutProperty(Ke.id,"text-field",je)}else if((typeof Ee=="string"||Ee instanceof String)&&(Xe=le.exec(Ee.toString()))!==null){const je=`${Xe[1]}{${h}}${Xe[5]}`;this.setLayoutProperty(Ke.id,"text-field",je)}}}))}setSecondaryLanguage(x=ji.secondaryLanguage){if(this.primaryLanguage===lr.STYLE_LOCK){console.warn("The language cannot be changed because this map has been instantiated with the STYLE_LOCK language flag.");return}Nh(x)&&(this.secondaryLanguage=x,this.onStyleReady(()=>{if(x===lr.AUTO)return this.setSecondaryLanguage(Wl());const k=this.getStyle().layers,K=/^\s*{\s*name\s*(:\s*(\S*))?\s*}$/,te=/^\s*name\s*(:\s*(\S*))?\s*$/,he=/^\s*{\s*name\s*(:\s*(\S*))?\s*}(\s*){\s*name\s*(:\s*(\S*))?\s*}$/;let le;for(let h=0;h<k.length;h+=1){const me=k[h],J=me.layout;if(!J||!J["text-field"])continue;const Ke=this.getLayoutProperty(me.id,"text-field");let ve;if(Array.isArray(Ke)&&Ke.length>=2&&Ke[0].trim().toLowerCase()==="concat"){ve=Ke.slice();let Ee=0;for(let Xe=0;Xe<Ke.length;Xe+=1){const je=Ke[Xe];if((typeof je=="string"||je instanceof String)&&K.exec(je.toString())){if(Ee===1){ve[Xe]=`{name:${x}}`;break}Ee+=1}else if(Array.isArray(je)&&je.length>=2&&je[0].trim().toLowerCase()==="get"&&te.exec(je[1].toString())){if(Ee===1){ve[Xe][1]=`name:${x}`;break}Ee+=1}else if(Array.isArray(je)&&je.length===4&&je[0].trim().toLowerCase()==="case"){if(Ee===1){ve[Xe]=["get",`name:${x}`];break}Ee+=1}}this.setLayoutProperty(me.id,"text-field",ve)}else if((typeof Ke=="string"||Ke instanceof String)&&(le=he.exec(Ke.toString()))!==null){const Ee=x?`name:${x}`:"name";ve=`{name${le[1]||""}}${le[3]}{${Ee}}`,this.setLayoutProperty(me.id,"text-field",ve)}}}))}getPrimaryLanguage(){return this.primaryLanguage}getSecondaryLanguage(){return this.secondaryLanguage}getTerrainExaggeration(){return this.terrainExaggeration}hasTerrain(){return this.isTerrainEnabled}growTerrain(x,k=1e3){if(!this.terrain)return;const K=performance.now(),te=this.terrain.exaggeration,he=x-te,le=()=>{if(!this.terrain||this.terrainFlattening)return;const h=(performance.now()-K)/k;if(h<.99){const me=1-Math.pow(1-h,4),J=te+me*he;this.terrain.exaggeration=J,requestAnimationFrame(le)}else this.terrainGrowing=!1,this.terrainFlattening=!1,this.terrain.exaggeration=x;this.triggerRepaint()};this.terrainGrowing=!0,this.terrainFlattening=!1,requestAnimationFrame(le)}enableTerrain(x=this.terrainExaggeration){if(x<0){console.warn("Terrain exaggeration cannot be negative.");return}const k=te=>xn(this,null,function*(){!this.terrain||te.type!=="data"||te.dataType!=="source"||!("source"in te)||te.sourceId!=="maptiler-terrain"||te.source.type!=="raster-dem"||te.isSourceLoaded&&(this.off("data",k),this.growTerrain(x))}),K=()=>{this.isTerrainEnabled=!0,this.terrainExaggeration=x,this.on("data",k),this.addSource(ji.terrainSourceId,{type:"raster-dem",url:ji.terrainSourceURL}),this.setTerrain({source:ji.terrainSourceId,exaggeration:0})};if(this.getTerrain()){this.isTerrainEnabled=!0,this.growTerrain(x);return}this.loaded()||this.isTerrainEnabled?K():this.once("load",()=>{this.getTerrain()&&this.getSource(ji.terrainSourceId)||K()})}disableTerrain(){if(!this.terrain)return;this.isTerrainEnabled=!1;const x=1*1e3,k=performance.now(),K=this.terrain.exaggeration,te=()=>{if(!this.terrain||this.terrainGrowing)return;const he=(performance.now()-k)/x;if(he<.99){const le=Math.pow(1-he,4),h=K*le;this.terrain.exaggeration=h,requestAnimationFrame(te)}else this.terrain.exaggeration=0,this.terrainGrowing=!1,this.terrainFlattening=!1,this.setTerrain(null),this.getSource(ji.terrainSourceId)&&this.removeSource(ji.terrainSourceId);this.triggerRepaint()};this.terrainGrowing=!1,this.terrainFlattening=!0,requestAnimationFrame(te)}setTerrainExaggeration(x,k=!0){!k&&this.terrain?(this.terrainExaggeration=x,this.terrain.exaggeration=x,this.triggerRepaint()):this.enableTerrain(x)}onStyleReady(x){this.isStyleLoaded()?x():this.once("styledata",()=>{x()})}fitToIpBounds(){return xn(this,null,function*(){const x=yield Hl.info();this.fitBounds(x.country_bounds,{duration:0,padding:100})})}centerOnIpPoint(x){return xn(this,null,function*(){const k=yield Hl.info();this.jumpTo({center:[k.longitude,k.latitude],zoom:x||11})})}getCameraHash(){const x=new Float32Array(5),k=this.getCenter();return x[0]=k.lng,x[1]=k.lat,x[2]=this.getZoom(),x[3]=this.getPitch(),x[4]=this.getBearing(),cp.fromUint8Array(new Uint8Array(x.buffer))}getSdkConfig(){return wr}getMaptilerSessionId(){return Hh}setTransformRequest(x){return super.setTransformRequest(iu(x)),this}};class vf extends nt.Marker{addTo(x){return super.addTo(x)}}class bf extends nt.Popup{addTo(x){return super.addTo(x)}}class wf extends nt.Style{constructor(x,k={}){super(x,k)}}class Tf extends nt.CanvasSource{onAdd(x){super.onAdd(x)}}class Sf extends nt.GeoJSONSource{onAdd(x){super.onAdd(x)}}class Ef extends nt.ImageSource{onAdd(x){super.onAdd(x)}}class If extends nt.RasterTileSource{onAdd(x){super.onAdd(x)}}class Af extends nt.RasterDEMTileSource{onAdd(x){super.onAdd(x)}}class Cf extends nt.VectorTileSource{onAdd(x){super.onAdd(x)}}class Pf extends nt.VideoSource{onAdd(x){super.onAdd(x)}}class Mf extends nt.TerrainControl{onAdd(x){return super.onAdd(x)}}class wa{constructor(x,k){this.x=x,this.y=k}_matMult(x){const k=x[0]*this.x+x[1]*this.y,K=x[2]*this.x+x[3]*this.y;return this.x=k,this.y=K,this}_add(x){return this.x+=x.x,this.y+=x.y,this}_sub(x){return this.x-=x.x,this.y-=x.y,this}_mult(x){return this.x*=x,this.y*=x,this}_div(x){return this.x/=x,this.y/=x,this}_multByPoint(x){return this.x*=x.x,this.y*=x.y,this}_divByPoint(x){return this.x/=x.x,this.y/=x.y,this}_unit(){return this._div(this.mag()),this}_perp(){const x=this.y;return this.y=this.x,this.x=-x,this}_rotate(x){const k=Math.cos(x),K=Math.sin(x),te=k*this.x-K*this.y,he=K*this.x+k*this.y;return this.x=te,this.y=he,this}_rotateAround(x,k){const K=Math.cos(x),te=Math.sin(x),he=k.x+K*(this.x-k.x)-te*(this.y-k.y),le=k.y+te*(this.x-k.x)+K*(this.y-k.y);return this.x=he,this.y=le,this}_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}clone(){return new wa(this.x,this.y)}add(x){return this.clone()._add(x)}sub(x){return this.clone()._sub(x)}multByPoint(x){return this.clone()._multByPoint(x)}divByPoint(x){return this.clone()._divByPoint(x)}mult(x){return this.clone()._mult(x)}div(x){return this.clone()._div(x)}rotate(x){return this.clone()._rotate(x)}rotateAround(x,k){return this.clone()._rotateAround(x,k)}matMult(x){return this.clone()._matMult(x)}unit(){return this.clone()._unit()}perp(){return this.clone()._perp()}round(){return this.clone()._round()}mag(){return Math.sqrt(this.x*this.x+this.y*this.y)}equals(x){return this.x===x.x&&this.y===x.y}dist(x){return Math.sqrt(this.distSqr(x))}distSqr(x){const k=x.x-this.x,K=x.y-this.y;return k*k+K*K}angle(){return Math.atan2(this.y,this.x)}angleTo(x){return Math.atan2(this.y-x.y,this.x-x.x)}angleWith(x){return this.angleWithSep(x.x,x.y)}angleWithSep(x,k){return Math.atan2(this.x*k-this.y*x,this.x*x+this.y*k)}static convert(x){return x instanceof wa?x:Array.isArray(x)?new wa(x[0],x[1]):x}}const{setRTLTextPlugin:kf,getRTLTextPluginStatus:Lf,LngLat:zf,LngLatBounds:Df,MercatorCoordinate:Rf,Evented:Bf,AJAXError:Ff,prewarm:Of,clearPrewarmedResources:Uf,version:Nf,workerCount:Vf,maxParallelImageRequests:$f,workerUrl:jf,addProtocol:qf,removeProtocol:Gf}=nt,Zf=nt.Map,Xf=nt.Marker,Wf=nt.Popup,Hf=nt.Style,Kf=nt.CanvasSource,Yf=nt.GeoJSONSource,Jf=nt.ImageSource,Qf=nt.RasterTileSource,em=nt.RasterDEMTileSource,tm=nt.VectorTileSource,im=nt.VideoSource;nt.NavigationControl,nt.GeolocateControl,nt.AttributionControl,nt.LogoControl,nt.ScaleControl,nt.FullscreenControl,nt.TerrainControl,Oe.AJAXError=Ff,Oe.AttributionControl=pu,Oe.CanvasSource=Tf,Oe.CanvasSourceMLGL=Kf,Oe.Evented=Bf,Oe.FullscreenControl=mu,Oe.GeoJSONSource=Sf,Oe.GeoJSONSourceMLGL=Yf,Oe.GeolocateControl=ou,Oe.GeolocationType=yu,Oe.ImageSource=Ef,Oe.ImageSourceMLGL=Jf,Oe.Language=lr,Oe.LanguageGeocoding=ba,Oe.LngLat=zf,Oe.LngLatBounds=Df,Oe.LogoControl=Yh,Oe.Map=xf,Oe.MapMLGL=Zf,Oe.MapStyle=Yl,Oe.MapStyleVariant=Ro,Oe.MaptilerGeolocateControl=du,Oe.MaptilerLogoControl=tc,Oe.MaptilerNavigationControl=au,Oe.MaptilerTerrainControl=nu,Oe.Marker=vf,Oe.MarkerMLGL=Xf,Oe.MercatorCoordinate=Rf,Oe.NavigationControl=su,Oe.Point=wa,Oe.Popup=bf,Oe.PopupMLGL=Wf,Oe.RasterDEMTileSource=Af,Oe.RasterDEMTileSourceMLGL=em,Oe.RasterTileSource=If,Oe.RasterTileSourceMLGL=Qf,Oe.ReferenceMapStyle=Bo,Oe.ScaleControl=fu,Oe.SdkConfig=Kh,Oe.ServiceError=Jr,Oe.Style=wf,Oe.StyleMLGL=Hf,Oe.TerrainControl=Mf,Oe.VectorTileSource=Cf,Oe.VectorTileSourceMLGL=tm,Oe.VideoSource=Pf,Oe.VideoSourceMLGL=im,Oe.addProtocol=qf,Oe.clearPrewarmedResources=Uf,Oe.config=wr,Oe.coordinates=Dp,Oe.data=Fp,Oe.geocoding=Pp,Oe.geolocation=Hl,Oe.getRTLTextPluginStatus=Lf,Oe.maxParallelImageRequests=$f,Oe.prewarm=Of,Oe.removeProtocol=Gf,Oe.setRTLTextPlugin=kf,Oe.staticMaps=Zp,Oe.version=Nf,Oe.workerCount=Vf,Oe.workerUrl=jf});