@opengis/partsmap 0.0.71 → 0.0.73
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/PartsMap.js +1274 -1246
- package/dist/PartsMap.umd.cjs +2 -2
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/PartsMap.umd.cjs
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
* MapLibre GL JS
|
3
3
|
* @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v4.5.2/LICENSE.txt
|
4
4
|
*/(function(f,v){(function(k,P){f.exports=P()})(zp,function(){var k={},P={};function L(T,c,fe){if(P[T]=fe,T==="index"){var me="var sharedModule = {}; ("+P.shared+")(sharedModule); ("+P.worker+")(sharedModule);",ve={};return P.shared(ve),P.index(k,ve),typeof window<"u"&&k.setWorkerUrl(window.URL.createObjectURL(new Blob([me],{type:"text/javascript"}))),k}}L("shared",["exports"],function(T){function c(i,e,r,s){return new(r||(r=Promise))(function(l,d){function p(x){try{_(s.next(x))}catch(S){d(S)}}function m(x){try{_(s.throw(x))}catch(S){d(S)}}function _(x){var S;x.done?l(x.value):(S=x.value,S instanceof r?S:new r(function(I){I(S)})).then(p,m)}_((s=s.apply(i,e||[])).next())})}function fe(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}typeof SuppressedError=="function"&&SuppressedError;var me=ve;function ve(i,e){this.x=i,this.y=e}ve.prototype={clone:function(){return new ve(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}},ve.convert=function(i){return i instanceof ve?i:Array.isArray(i)?new ve(i[0],i[1]):i};var le=fe(me),oe=ht;function ht(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}ht.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 d=this.sampleCurveDerivativeX(r);if(Math.abs(d)<1e-6)break;r-=l/d}var p=0,m=1;for(r=i,s=0;s<20&&(l=this.sampleCurveX(r),!(Math.abs(l-i)<e));s++)i>l?p=r:m=r,r=.5*(m-p)+p;return r},solve:function(i,e){return this.sampleCurveY(this.solveCurveX(i,e))}};var je=fe(oe);let Ke,Oe;function ft(){return Ke==null&&(Ke=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Ke}function st(){if(Oe==null&&(Oe=!1,ft())){const e=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(e){for(let s=0;s<5*5;s++){const l=4*s;e.fillStyle=`rgb(${l},${l+1},${l+2})`,e.fillRect(s%5,Math.floor(s/5),1,1)}const r=e.getImageData(0,0,5,5).data;for(let s=0;s<5*5*4;s++)if(s%4!=3&&r[s]!==s){Oe=!0;break}}}return Oe||!1}function He(i,e,r,s){const l=new je(i,e,r,s);return d=>l.solve(d)}const Ft=He(.25,.1,.25,1);function wt(i,e,r){return Math.min(r,Math.max(e,i))}function Xt(i,e,r){const s=r-e,l=((i-e)%s+s)%s+e;return l===e?r:l}function $t(i,...e){for(const r of e)for(const s in r)i[s]=r[s];return i}let Vr=1;function bi(i,e,r){const s={};for(const l in i)s[l]=e.call(this,i[l],l,i);return s}function Nr(i,e,r){const s={};for(const l in i)e.call(this,i[l],l,i)&&(s[l]=i[l]);return s}function St(i){return Array.isArray(i)?i.map(St):typeof i=="object"&&i?bi(i,St):i}const js={};function li(i){js[i]||(typeof console<"u"&&console.warn(i),js[i]=!0)}function wi(i,e,r){return(r.y-i.y)*(e.x-i.x)>(e.y-i.y)*(r.x-i.x)}function Cr(i){return typeof WorkerGlobalScope<"u"&&i!==void 0&&i instanceof WorkerGlobalScope}let En=null;function dr(i){return typeof ImageBitmap<"u"&&i instanceof ImageBitmap}const Us="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function on(i,e,r,s,l){return c(this,void 0,void 0,function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");const d=new VideoFrame(i,{timestamp:0});try{const p=d==null?void 0:d.format;if(!p||!p.startsWith("BGR")&&!p.startsWith("RGB"))throw new Error(`Unrecognized format ${p}`);const m=p.startsWith("BGR"),_=new Uint8ClampedArray(s*l*4);if(yield d.copyTo(_,function(x,S,I,A,D){const B=4*Math.max(-S,0),O=(Math.max(0,I)-I)*A*4+B,q=4*A,J=Math.max(0,S),ae=Math.max(0,I);return{rect:{x:J,y:ae,width:Math.min(x.width,S+A)-J,height:Math.min(x.height,I+D)-ae},layout:[{offset:O,stride:q}]}}(i,e,r,s,l)),m)for(let x=0;x<_.length;x+=4){const S=_[x];_[x]=_[x+2],_[x+2]=S}return _}finally{d.close()}})}let Er,Ei;const Qi="AbortError";function Pn(){return new Error(Qi)}const $r={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function pr(i){return $r.REGISTERED_PROTOCOLS[i.substring(0,i.indexOf("://"))]}const An="global-dispatcher";class Oi 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 er=()=>Cr(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,an=function(i,e){if(/:\/\//.test(i.url)&&!/^https?:|^file:/.test(i.url)){const s=pr(i.url);if(s)return s(i,e);if(Cr(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:i,targetMapId:An},e)}if(!(/^file:/.test(r=i.url)||/^file:/.test(er())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(s,l){return c(this,void 0,void 0,function*(){const d=new Request(s.url,{method:s.method||"GET",body:s.body,credentials:s.credentials,headers:s.headers,cache:s.cache,referrer:er(),signal:l.signal});s.type!=="json"||d.headers.has("Accept")||d.headers.set("Accept","application/json");const p=yield fetch(d);if(!p.ok){const x=yield p.blob();throw new Oi(p.status,p.statusText,s.url,x)}let m;m=s.type==="arrayBuffer"||s.type==="image"?p.arrayBuffer():s.type==="json"?p.json():p.text();const _=yield m;if(l.signal.aborted)throw Pn();return{data:_,cacheControl:p.headers.get("Cache-Control"),expires:p.headers.get("Expires")}})}(i,e);if(Cr(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:i,mustQueue:!0,targetMapId:An},e)}var r;return function(s,l){return new Promise((d,p)=>{var m;const _=new XMLHttpRequest;_.open(s.method||"GET",s.url,!0),s.type!=="arrayBuffer"&&s.type!=="image"||(_.responseType="arraybuffer");for(const x in s.headers)_.setRequestHeader(x,s.headers[x]);s.type==="json"&&(_.responseType="text",!((m=s.headers)===null||m===void 0)&&m.Accept||_.setRequestHeader("Accept","application/json")),_.withCredentials=s.credentials==="include",_.onerror=()=>{p(new Error(_.statusText))},_.onload=()=>{if(!l.signal.aborted)if((_.status>=200&&_.status<300||_.status===0)&&_.response!==null){let x=_.response;if(s.type==="json")try{x=JSON.parse(_.response)}catch(S){return void p(S)}d({data:x,cacheControl:_.getResponseHeader("Cache-Control"),expires:_.getResponseHeader("Expires")})}else{const x=new Blob([_.response],{type:_.getResponseHeader("Content-Type")});p(new Oi(_.status,_.statusText,s.url,x))}},l.signal.addEventListener("abort",()=>{_.abort(),p(Pn())}),_.send(s.body)})}(i,e)};function ln(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 ns(i,e,r){r[i]&&r[i].indexOf(e)!==-1||(r[i]=r[i]||[],r[i].push(e))}function Pr(i,e,r){if(r&&r[i]){const s=r[i].indexOf(e);s!==-1&&r[i].splice(s,1)}}class jr{constructor(e,r={}){$t(this,r),this.type=e}}class Ur extends jr{constructor(e,r={}){super("error",$t({error:e},r))}}class Mn{on(e,r){return this._listeners=this._listeners||{},ns(e,r,this._listeners),this}off(e,r){return Pr(e,r,this._listeners),Pr(e,r,this._oneTimeListeners),this}once(e,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},ns(e,r,this._oneTimeListeners),this):new Promise(s=>this.once(e,s))}fire(e,r){typeof e=="string"&&(e=new jr(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 m of l)m.call(this,e);const d=this._oneTimeListeners&&this._oneTimeListeners[s]?this._oneTimeListeners[s].slice():[];for(const m of d)Pr(s,m,this._oneTimeListeners),m.call(this,e);const p=this._eventedParent;p&&($t(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),p.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 ue={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"enum",default:"mercator",values:{mercator:{},globe:{}}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};const cn=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function ss(i,e){const r={};for(const s in i)s!=="ref"&&(r[s]=i[s]);return cn.forEach(s=>{s in e&&(r[s]=e[s])}),r}function yt(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(!yt(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(!yt(i[r],e[r]))return!1;return!0}return i===e}function jt(i,e){i.push(e)}function os(i,e,r){jt(r,{command:"addSource",args:[i,e[i]]})}function qr(i,e,r){jt(e,{command:"removeSource",args:[i]}),r[i]=!0}function Ar(i,e,r,s){qr(i,r,s),os(i,e,r)}function zn(i,e,r){let s;for(s in i[r])if(Object.prototype.hasOwnProperty.call(i[r],s)&&s!=="data"&&!yt(i[r][s],e[r][s]))return!1;for(s in e[r])if(Object.prototype.hasOwnProperty.call(e[r],s)&&s!=="data"&&!yt(i[r][s],e[r][s]))return!1;return!0}function Xi(i,e,r,s,l,d){i=i||{},e=e||{};for(const p in i)Object.prototype.hasOwnProperty.call(i,p)&&(yt(i[p],e[p])||r.push({command:d,args:[s,p,e[p],l]}));for(const p in e)Object.prototype.hasOwnProperty.call(e,p)&&!Object.prototype.hasOwnProperty.call(i,p)&&(yt(i[p],e[p])||r.push({command:d,args:[s,p,e[p],l]}))}function as(i){return i.id}function ls(i,e){return i[e.id]=e,i}class ke{constructor(e,r,s,l){this.message=(e?`${e}: `:"")+s,l&&(this.identifier=l),r!=null&&r.__line__&&(this.line=r.__line__)}}function fr(i,...e){for(const r of e)for(const s in r)i[s]=r[s];return i}class Si extends Error{constructor(e,r){super(r),this.message=r,this.key=e}}class mr{constructor(e,r=[]){this.parent=e,this.bindings={};for(const[s,l]of r)this.bindings[s]=l}concat(e){return new mr(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 Zr={kind:"null"},Ee={kind:"number"},at={kind:"string"},Ye={kind:"boolean"},Pi={kind:"color"},tr={kind:"object"},it={kind:"value"},gr={kind:"collator"},Mr={kind:"formatted"},Gr={kind:"padding"},_r={kind:"resolvedImage"},X={kind:"variableAnchorOffsetCollection"};function z(i,e){return{kind:"array",itemType:i,N:e}}function M(i){if(i.kind==="array"){const e=M(i.itemType);return typeof i.N=="number"?`array<${e}, ${i.N}>`:i.itemType.kind==="value"?"array":`array<${e}>`}return i.kind}const V=[Zr,Ee,at,Ye,Pi,Mr,tr,z(it),Gr,_r,X];function G(i,e){if(e.kind==="error")return null;if(i.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!G(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 V)if(!G(r,e))return null}}return`Expected ${M(i)} but found ${M(e)} instead.`}function ee(i,e){return e.some(r=>r.kind===i.kind)}function ie(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 ne(i,e){return i.kind==="array"&&e.kind==="array"?i.itemType.kind===e.itemType.kind&&typeof i.N=="number":i.kind===e.kind}const K=.96422,pe=.82521,xe=4/29,he=6/29,Ie=3*he*he,Ge=he*he*he,Xe=Math.PI/180,nt=180/Math.PI;function mt(i){return(i%=360)<0&&(i+=360),i}function rt([i,e,r,s]){let l,d;const p=Ut((.2225045*(i=Ct(i))+.7168786*(e=Ct(e))+.0606169*(r=Ct(r)))/1);i===e&&e===r?l=d=p:(l=Ut((.4360747*i+.3850649*e+.1430804*r)/K),d=Ut((.0139322*i+.0971045*e+.7141733*r)/pe));const m=116*p-16;return[m<0?0:m,500*(l-p),200*(p-d),s]}function Ct(i){return i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function Ut(i){return i>Ge?Math.pow(i,1/3):i/Ie+xe}function Kt([i,e,r,s]){let l=(i+16)/116,d=isNaN(e)?l:l+e/500,p=isNaN(r)?l:l-r/200;return l=1*vt(l),d=K*vt(d),p=pe*vt(p),[lt(3.1338561*d-1.6168667*l-.4906146*p),lt(-.9787684*d+1.9161415*l+.033454*p),lt(.0719453*d-.2289914*l+1.4052427*p),s]}function lt(i){return(i=i<=.00304?12.92*i:1.055*Math.pow(i,1/2.4)-.055)<0?0:i>1?1:i}function vt(i){return i>he?i*i*i:Ie*(i-xe)}function Ot(i){return parseInt(i.padEnd(2,i),16)/255}function ei(i,e){return ci(e?i/100:i,0,1)}function ci(i,e,r){return Math.min(Math.max(e,i),r)}function hi(i){return!i.some(Number.isNaN)}const cs={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 bt{constructor(e,r,s,l=1,d=!0){this.r=e,this.g=r,this.b=s,this.a=l,d||(this.r*=l,this.g*=l,this.b*=l,l||this.overwriteGetter("rgb",[e,r,s,l]))}static parse(e){if(e instanceof bt)return e;if(typeof e!="string")return;const r=function(s){if((s=s.toLowerCase().trim())==="transparent")return[0,0,0,0];const l=cs[s];if(l){const[p,m,_]=l;return[p/255,m/255,_/255,1]}if(s.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(s)){const p=s.length<6?1:2;let m=1;return[Ot(s.slice(m,m+=p)),Ot(s.slice(m,m+=p)),Ot(s.slice(m,m+=p)),Ot(s.slice(m,m+p)||"ff")]}if(s.startsWith("rgb")){const p=s.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(p){const[m,_,x,S,I,A,D,B,O,q,J,ae]=p,Q=[S||" ",D||" ",q].join("");if(Q===" "||Q===" /"||Q===",,"||Q===",,,"){const re=[x,A,O].join(""),de=re==="%%%"?100:re===""?255:0;if(de){const be=[ci(+_/de,0,1),ci(+I/de,0,1),ci(+B/de,0,1),J?ei(+J,ae):1];if(hi(be))return be}}return}}const d=s.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(d){const[p,m,_,x,S,I,A,D,B]=d,O=[_||" ",S||" ",A].join("");if(O===" "||O===" /"||O===",,"||O===",,,"){const q=[+m,ci(+x,0,100),ci(+I,0,100),D?ei(+D,B):1];if(hi(q))return function([J,ae,Q,re]){function de(be){const Le=(be+J/30)%12,We=ae*Math.min(Q,1-Q);return Q-We*Math.max(-1,Math.min(Le-3,9-Le,1))}return J=mt(J),ae/=100,Q/=100,[de(0),de(8),de(4),re]}(q)}}}(e);return r?new bt(...r,!1):void 0}get rgb(){const{r:e,g:r,b:s,a:l}=this,d=l||1/0;return this.overwriteGetter("rgb",[e/d,r/d,s/d,l])}get hcl(){return this.overwriteGetter("hcl",function(e){const[r,s,l,d]=rt(e),p=Math.sqrt(s*s+l*l);return[Math.round(1e4*p)?mt(Math.atan2(l,s)*nt):NaN,p,r,d]}(this.rgb))}get lab(){return this.overwriteGetter("lab",rt(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(d=>Math.round(255*d)).join(",")},${l})`}}bt.black=new bt(0,0,0,1),bt.white=new bt(1,1,1,1),bt.transparent=new bt(0,0,0,0),bt.red=new bt(1,0,0,1);class Uo{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 qo{constructor(e,r,s,l,d){this.text=e,this.image=r,this.scale=s,this.fontStack=l,this.textColor=d}}class Vi{constructor(e){this.sections=e}static fromString(e){return new Vi([new qo(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 Vi?e:Vi.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}}class Ni{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Ni)return e;if(typeof e=="number")return new Ni([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 Ni(e)}}toString(){return JSON.stringify(this.values)}}const Vc=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class $i{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof $i)return e;if(Array.isArray(e)&&!(e.length<1)&&e.length%2==0){for(let r=0;r<e.length;r+=2){const s=e[r],l=e[r+1];if(typeof s!="string"||!Vc.has(s)||!Array.isArray(l)||l.length!==2||typeof l[0]!="number"||typeof l[1]!="number")return}return new $i(e)}}toString(){return JSON.stringify(this.values)}}class ui{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new ui({name:e,available:!1}):null}}function qs(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 hs(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof bt||i instanceof Uo||i instanceof Vi||i instanceof Ni||i instanceof $i||i instanceof ui)return!0;if(Array.isArray(i)){for(const e of i)if(!hs(e))return!1;return!0}if(typeof i=="object"){for(const e in i)if(!hs(i[e]))return!1;return!0}return!1}function Yt(i){if(i===null)return Zr;if(typeof i=="string")return at;if(typeof i=="boolean")return Ye;if(typeof i=="number")return Ee;if(i instanceof bt)return Pi;if(i instanceof Uo)return gr;if(i instanceof Vi)return Mr;if(i instanceof Ni)return Gr;if(i instanceof $i)return X;if(i instanceof ui)return _r;if(Array.isArray(i)){const e=i.length;let r;for(const s of i){const l=Yt(s);if(r){if(r===l)continue;r=it;break}r=l}return z(r||it,e)}return tr}function zr(i){const e=typeof i;return i===null?"":e==="string"||e==="number"||e==="boolean"?String(i):i instanceof bt||i instanceof Vi||i instanceof Ni||i instanceof $i||i instanceof ui?i.toString():JSON.stringify(i)}class hn{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(!hs(e[1]))return r.error("invalid value");const s=e[1];let l=Yt(s);const d=r.expectedType;return l.kind!=="array"||l.N!==0||!d||d.kind!=="array"||typeof d.N=="number"&&d.N!==0||(l=d),new hn(l,s)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class Wt{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const Zs={string:at,number:Ee,boolean:Ye,object:tr};class Wi{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 d=e[0];if(d==="array"){let m,_;if(e.length>2){const x=e[1];if(typeof x!="string"||!(x in Zs)||x==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);m=Zs[x],l++}else m=it;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);_=e[2],l++}s=z(m,_)}else{if(!Zs[d])throw new Error(`Types doesn't contain name = ${d}`);s=Zs[d]}const p=[];for(;l<e.length;l++){const m=r.parse(e[l],l,it);if(!m)return null;p.push(m)}return new Wi(s,p)}evaluate(e){for(let r=0;r<this.args.length;r++){const s=this.args[r].evaluate(e);if(!G(this.type,Yt(s)))return s;if(r===this.args.length-1)throw new Wt(`Expected value to be of type ${M(this.type)}, but found ${M(Yt(s))} instead.`)}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const us={"to-boolean":Ye,"to-color":Pi,"to-number":Ee,"to-string":at};class Hr{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(!us[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=us[s],d=[];for(let p=1;p<e.length;p++){const m=r.parse(e[p],p,it);if(!m)return null;d.push(m)}return new Hr(l,d)}evaluate(e){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(e);case"color":{let r,s;for(const l of this.args){if(r=l.evaluate(e),s=null,r instanceof bt)return r;if(typeof r=="string"){const d=e.parseColor(r);if(d)return d}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.`:qs(r[0],r[1],r[2],r[3]),!s))return new bt(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new Wt(s||`Could not parse color from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"padding":{let r;for(const s of this.args){r=s.evaluate(e);const l=Ni.parse(r);if(l)return l}throw new Wt(`Could not parse padding from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"variableAnchorOffsetCollection":{let r;for(const s of this.args){r=s.evaluate(e);const l=$i.parse(r);if(l)return l}throw new Wt(`Could not parse variableAnchorOffsetCollection from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"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 Wt(`Could not convert ${JSON.stringify(r)} to number.`)}case"formatted":return Vi.fromString(zr(this.args[0].evaluate(e)));case"resolvedImage":return ui.fromString(zr(this.args[0].evaluate(e)));default:return zr(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const Zo=["Unknown","Point","LineString","Polygon"];class ds{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"?Zo[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]=bt.parse(e)),r}}class Xr{constructor(e,r,s=[],l,d=new mr,p=[]){this.registry=e,this.path=s,this.key=s.map(m=>`[${m}]`).join(""),this.scope=d,this.errors=p,this.expectedType=l,this._isConstant=r}parse(e,r,s,l,d={}){return r?this.concat(r,s,l)._parse(e,d):this._parse(e,d)}_parse(e,r){function s(l,d,p){return p==="assert"?new Wi(d,[l]):p==="coerce"?new Hr(d,[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 d=this.registry[l];if(d){let p=d.parse(e,this);if(!p)return null;if(this.expectedType){const m=this.expectedType,_=p.type;if(m.kind!=="string"&&m.kind!=="number"&&m.kind!=="boolean"&&m.kind!=="object"&&m.kind!=="array"||_.kind!=="value")if(m.kind!=="color"&&m.kind!=="formatted"&&m.kind!=="resolvedImage"||_.kind!=="value"&&_.kind!=="string")if(m.kind!=="padding"||_.kind!=="value"&&_.kind!=="number"&&_.kind!=="array")if(m.kind!=="variableAnchorOffsetCollection"||_.kind!=="value"&&_.kind!=="array"){if(this.checkSubtype(m,_))return null}else p=s(p,m,r.typeAnnotation||"coerce");else p=s(p,m,r.typeAnnotation||"coerce");else p=s(p,m,r.typeAnnotation||"coerce");else p=s(p,m,r.typeAnnotation||"assert")}if(!(p instanceof hn)&&p.type.kind!=="resolvedImage"&&this._isConstant(p)){const m=new ds;try{p=new hn(p.type,p.evaluate(m))}catch(_){return this.error(_.message),null}}return p}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,d=s?this.scope.concat(s):this.scope;return new Xr(this.registry,this._isConstant,l,r||null,d,this.errors)}error(e,...r){const s=`${this.key}${r.map(l=>`[${l}]`).join("")}`;this.errors.push(new Si(s,e))}checkSubtype(e,r){const s=G(e,r);return s&&this.error(s),s}}class xt{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 d=1;d<e.length-1;d+=2){const p=e[d];if(typeof p!="string")return r.error(`Expected string, but found ${typeof p} instead.`,d);if(/[^a-zA-Z0-9_]/.test(p))return r.error("Variable names must contain only alphanumeric characters or '_'.",d);const m=r.parse(e[d+1],d+1);if(!m)return null;s.push([p,m])}const l=r.parse(e[e.length-1],e.length-1,r.expectedType,s);return l?new xt(s,l):null}outputDefined(){return this.result.outputDefined()}}class Gs{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 Gs(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 Go{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,Ee),l=r.parse(e[2],2,z(r.expectedType||it));return s&&l?new Go(l.type.itemType,s,l):null}evaluate(e){const r=this.index.evaluate(e),s=this.input.evaluate(e);if(r<0)throw new Wt(`Array index out of bounds: ${r} < 0.`);if(r>=s.length)throw new Wt(`Array index out of bounds: ${r} > ${s.length-1}.`);if(r!==Math.floor(r))throw new Wt(`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 ps{constructor(e,r){this.type=Ye,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,it),l=r.parse(e[2],2,it);return s&&l?ee(s.type,[Ye,at,Ee,Zr,it])?new ps(s,l):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${M(s.type)} instead`):null}evaluate(e){const r=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(!s)return!1;if(!ie(r,["boolean","string","number","null"]))throw new Wt(`Expected first argument to be of type boolean, string, number or null, but found ${M(Yt(r))} instead.`);if(!ie(s,["string","array"]))throw new Wt(`Expected second argument to be of type array or string, but found ${M(Yt(s))} instead.`);return s.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class Hs{constructor(e,r,s){this.type=Ee,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,it),l=r.parse(e[2],2,it);if(!s||!l)return null;if(!ee(s.type,[Ye,at,Ee,Zr,it]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${M(s.type)} instead`);if(e.length===4){const d=r.parse(e[3],3,Ee);return d?new Hs(s,l,d):null}return new Hs(s,l)}evaluate(e){const r=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(!ie(r,["boolean","string","number","null"]))throw new Wt(`Expected first argument to be of type boolean, string, number or null, but found ${M(Yt(r))} instead.`);if(!ie(s,["string","array"]))throw new Wt(`Expected second argument to be of type array or string, but found ${M(Yt(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 Xs{constructor(e,r,s,l,d,p){this.inputType=e,this.type=r,this.input=s,this.cases=l,this.outputs=d,this.otherwise=p}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 d={},p=[];for(let x=2;x<e.length-1;x+=2){let S=e[x];const I=e[x+1];Array.isArray(S)||(S=[S]);const A=r.concat(x);if(S.length===0)return A.error("Expected at least one branch label.");for(const B of S){if(typeof B!="number"&&typeof B!="string")return A.error("Branch labels must be numbers or strings.");if(typeof B=="number"&&Math.abs(B)>Number.MAX_SAFE_INTEGER)return A.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof B=="number"&&Math.floor(B)!==B)return A.error("Numeric branch labels must be integer values.");if(s){if(A.checkSubtype(s,Yt(B)))return null}else s=Yt(B);if(d[String(B)]!==void 0)return A.error("Branch labels must be unique.");d[String(B)]=p.length}const D=r.parse(I,x,l);if(!D)return null;l=l||D.type,p.push(D)}const m=r.parse(e[1],1,it);if(!m)return null;const _=r.parse(e[e.length-1],e.length-1,l);return _?m.type.kind!=="value"&&r.concat(1).checkSubtype(s,m.type)?null:new Xs(s,l,m,d,p,_):null}evaluate(e){const r=this.input.evaluate(e);return(Yt(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 Ws{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 p=1;p<e.length-1;p+=2){const m=r.parse(e[p],p,Ye);if(!m)return null;const _=r.parse(e[p+1],p+1,s);if(!_)return null;l.push([m,_]),s=s||_.type}const d=r.parse(e[e.length-1],e.length-1,s);if(!d)return null;if(!s)throw new Error("Can't infer output type");return new Ws(s,l,d)}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 Js{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,it),l=r.parse(e[2],2,Ee);if(!s||!l)return null;if(!ee(s.type,[z(it),at,it]))return r.error(`Expected first argument to be of type array or string, but found ${M(s.type)} instead`);if(e.length===4){const d=r.parse(e[3],3,Ee);return d?new Js(s.type,s,l,d):null}return new Js(s.type,s,l)}evaluate(e){const r=this.input.evaluate(e),s=this.beginIndex.evaluate(e);if(!ie(r,["string","array"]))throw new Wt(`Expected first argument to be of type array or string, but found ${M(Yt(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 fs(i,e){const r=i.length-1;let s,l,d=0,p=r,m=0;for(;d<=p;)if(m=Math.floor((d+p)/2),s=i[m],l=i[m+1],s<=e){if(m===r||e<l)return m;d=m+1}else{if(!(s>e))throw new Wt("Input is not a number.");p=m-1}return 0}class Dn{constructor(e,r,s){this.type=e,this.input=r,this.labels=[],this.outputs=[];for(const[l,d]of s)this.labels.push(l),this.outputs.push(d)}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,Ee);if(!s)return null;const l=[];let d=null;r.expectedType&&r.expectedType.kind!=="value"&&(d=r.expectedType);for(let p=1;p<e.length;p+=2){const m=p===1?-1/0:e[p],_=e[p+1],x=p,S=p+1;if(typeof m!="number")return r.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',x);if(l.length&&l[l.length-1][0]>=m)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',x);const I=r.parse(_,S,d);if(!I)return null;d=d||I.type,l.push([m,I])}return new Dn(d,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 d=r.length;return l>=r[d-1]?s[d-1].evaluate(e):s[fs(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 Nc(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var $c=gl;function gl(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}gl.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 d=this.sampleCurveDerivativeX(r);if(Math.abs(d)<1e-6)break;r-=l/d}var p=0,m=1;for(r=i,s=0;s<20&&(l=this.sampleCurveX(r),!(Math.abs(l-i)<e));s++)i>l?p=r:m=r,r=.5*(m-p)+p;return r},solve:function(i,e){return this.sampleCurveY(this.solveCurveX(i,e))}};var jc=Nc($c);function Wr(i,e,r){return i+r*(e-i)}function ms(i,e,r){return i.map((s,l)=>Wr(s,e[l],r))}const ji={number:Wr,color:function(i,e,r,s="rgb"){switch(s){case"rgb":{const[l,d,p,m]=ms(i.rgb,e.rgb,r);return new bt(l,d,p,m,!1)}case"hcl":{const[l,d,p,m]=i.hcl,[_,x,S,I]=e.hcl;let A,D;if(isNaN(l)||isNaN(_))isNaN(l)?isNaN(_)?A=NaN:(A=_,p!==1&&p!==0||(D=x)):(A=l,S!==1&&S!==0||(D=d));else{let ae=_-l;_>l&&ae>180?ae-=360:_<l&&l-_>180&&(ae+=360),A=l+r*ae}const[B,O,q,J]=function([ae,Q,re,de]){return ae=isNaN(ae)?0:ae*Xe,Kt([re,Math.cos(ae)*Q,Math.sin(ae)*Q,de])}([A,D??Wr(d,x,r),Wr(p,S,r),Wr(m,I,r)]);return new bt(B,O,q,J,!1)}case"lab":{const[l,d,p,m]=Kt(ms(i.lab,e.lab,r));return new bt(l,d,p,m,!1)}}},array:ms,padding:function(i,e,r){return new Ni(ms(i.values,e.values,r))},variableAnchorOffsetCollection:function(i,e,r){const s=i.values,l=e.values;if(s.length!==l.length)throw new Wt(`Cannot interpolate values of different length. from: ${i.toString()}, to: ${e.toString()}`);const d=[];for(let p=0;p<s.length;p+=2){if(s[p]!==l[p])throw new Wt(`Cannot interpolate values containing mismatched anchors. from[${p}]: ${s[p]}, to[${p}]: ${l[p]}`);d.push(s[p]);const[m,_]=s[p+1],[x,S]=l[p+1];d.push([Wr(m,x,r),Wr(_,S,r)])}return new $i(d)}};class Ui{constructor(e,r,s,l,d){this.type=e,this.operator=r,this.interpolation=s,this.input=l,this.labels=[],this.outputs=[];for(const[p,m]of d)this.labels.push(p),this.outputs.push(m)}static interpolationFactor(e,r,s,l){let d=0;if(e.name==="exponential")d=gs(r,e.base,s,l);else if(e.name==="linear")d=gs(r,1,s,l);else if(e.name==="cubic-bezier"){const p=e.controlPoints;d=new jc(p[0],p[1],p[2],p[3]).solve(gs(r,1,s,l))}return d}static parse(e,r){let[s,l,d,...p]=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 x=l[1];if(typeof x!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);l={name:"exponential",base:x}}else{if(l[0]!=="cubic-bezier")return r.error(`Unknown interpolation type ${String(l[0])}`,1,0);{const x=l.slice(1);if(x.length!==4||x.some(S=>typeof S!="number"||S<0||S>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);l={name:"cubic-bezier",controlPoints:x}}}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(d=r.parse(d,2,Ee),!d)return null;const m=[];let _=null;s==="interpolate-hcl"||s==="interpolate-lab"?_=Pi:r.expectedType&&r.expectedType.kind!=="value"&&(_=r.expectedType);for(let x=0;x<p.length;x+=2){const S=p[x],I=p[x+1],A=x+3,D=x+4;if(typeof S!="number")return r.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',A);if(m.length&&m[m.length-1][0]>=S)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',A);const B=r.parse(I,D,_);if(!B)return null;_=_||B.type,m.push([S,B])}return ne(_,Ee)||ne(_,Pi)||ne(_,Gr)||ne(_,X)||ne(_,z(Ee))?new Ui(_,s,l,d,m):r.error(`Type ${M(_)} 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 d=r.length;if(l>=r[d-1])return s[d-1].evaluate(e);const p=fs(r,l),m=Ui.interpolationFactor(this.interpolation,l,r[p],r[p+1]),_=s[p].evaluate(e),x=s[p+1].evaluate(e);switch(this.operator){case"interpolate":return ji[this.type.kind](_,x,m);case"interpolate-hcl":return ji.color(_,x,m,"hcl");case"interpolate-lab":return ji.color(_,x,m,"lab")}}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function gs(i,e,r,s){const l=s-r,d=i-r;return l===0?0:e===1?d/l:(Math.pow(e,d)-1)/(Math.pow(e,l)-1)}class Ks{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 d=[];for(const m of e.slice(1)){const _=r.parse(m,1+d.length,s,void 0,{typeAnnotation:"omit"});if(!_)return null;s=s||_.type,d.push(_)}if(!s)throw new Error("No output type");const p=l&&d.some(m=>G(l,m.type));return new Ks(p?it:s,d)}evaluate(e){let r,s=null,l=0;for(const d of this.args)if(l++,s=d.evaluate(e),s&&s instanceof ui&&!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())}}function _l(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 yl(i,e,r,s){return s.compare(e,r)===0}function un(i,e,r){const s=i!=="=="&&i!=="!=";return class Mp{constructor(d,p,m){this.type=Ye,this.lhs=d,this.rhs=p,this.collator=m,this.hasUntypedArgument=d.type.kind==="value"||p.type.kind==="value"}static parse(d,p){if(d.length!==3&&d.length!==4)return p.error("Expected two or three arguments.");const m=d[0];let _=p.parse(d[1],1,it);if(!_)return null;if(!_l(m,_.type))return p.concat(1).error(`"${m}" comparisons are not supported for type '${M(_.type)}'.`);let x=p.parse(d[2],2,it);if(!x)return null;if(!_l(m,x.type))return p.concat(2).error(`"${m}" comparisons are not supported for type '${M(x.type)}'.`);if(_.type.kind!==x.type.kind&&_.type.kind!=="value"&&x.type.kind!=="value")return p.error(`Cannot compare types '${M(_.type)}' and '${M(x.type)}'.`);s&&(_.type.kind==="value"&&x.type.kind!=="value"?_=new Wi(x.type,[_]):_.type.kind!=="value"&&x.type.kind==="value"&&(x=new Wi(_.type,[x])));let S=null;if(d.length===4){if(_.type.kind!=="string"&&x.type.kind!=="string"&&_.type.kind!=="value"&&x.type.kind!=="value")return p.error("Cannot use collator to compare non-string types.");if(S=p.parse(d[3],3,gr),!S)return null}return new Mp(_,x,S)}evaluate(d){const p=this.lhs.evaluate(d),m=this.rhs.evaluate(d);if(s&&this.hasUntypedArgument){const _=Yt(p),x=Yt(m);if(_.kind!==x.kind||_.kind!=="string"&&_.kind!=="number")throw new Wt(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${_.kind}, ${x.kind}) instead.`)}if(this.collator&&!s&&this.hasUntypedArgument){const _=Yt(p),x=Yt(m);if(_.kind!=="string"||x.kind!=="string")return e(d,p,m)}return this.collator?r(d,p,m,this.collator.evaluate(d)):e(d,p,m)}eachChild(d){d(this.lhs),d(this.rhs),this.collator&&d(this.collator)}outputDefined(){return!0}}}const xl=un("==",function(i,e,r){return e===r},yl),Uc=un("!=",function(i,e,r){return e!==r},function(i,e,r,s){return!yl(0,e,r,s)}),qc=un("<",function(i,e,r){return e<r},function(i,e,r,s){return s.compare(e,r)<0}),vl=un(">",function(i,e,r){return e>r},function(i,e,r,s){return s.compare(e,r)>0}),bl=un("<=",function(i,e,r){return e<=r},function(i,e,r,s){return s.compare(e,r)<=0}),Zc=un(">=",function(i,e,r){return e>=r},function(i,e,r,s){return s.compare(e,r)>=0});class Ys{constructor(e,r,s){this.type=gr,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,Ye);if(!l)return null;const d=r.parse(s["diacritic-sensitive"]!==void 0&&s["diacritic-sensitive"],1,Ye);if(!d)return null;let p=null;return s.locale&&(p=r.parse(s.locale,1,at),!p)?null:new Ys(l,d,p)}evaluate(e){return new Uo(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}}class Ho{constructor(e,r,s,l,d){this.type=at,this.number=e,this.locale=r,this.currency=s,this.minFractionDigits=l,this.maxFractionDigits=d}static parse(e,r){if(e.length!==3)return r.error("Expected two arguments.");const s=r.parse(e[1],1,Ee);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 d=null;if(l.locale&&(d=r.parse(l.locale,1,at),!d))return null;let p=null;if(l.currency&&(p=r.parse(l.currency,1,at),!p))return null;let m=null;if(l["min-fraction-digits"]&&(m=r.parse(l["min-fraction-digits"],1,Ee),!m))return null;let _=null;return l["max-fraction-digits"]&&(_=r.parse(l["max-fraction-digits"],1,Ee),!_)?null:new Ho(s,d,p,m,_)}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 Qs{constructor(e){this.type=Mr,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 d=!1;for(let p=1;p<=e.length-1;++p){const m=e[p];if(d&&typeof m=="object"&&!Array.isArray(m)){d=!1;let _=null;if(m["font-scale"]&&(_=r.parse(m["font-scale"],1,Ee),!_))return null;let x=null;if(m["text-font"]&&(x=r.parse(m["text-font"],1,z(at)),!x))return null;let S=null;if(m["text-color"]&&(S=r.parse(m["text-color"],1,Pi),!S))return null;const I=l[l.length-1];I.scale=_,I.font=x,I.textColor=S}else{const _=r.parse(e[p],1,it);if(!_)return null;const x=_.type.kind;if(x!=="string"&&x!=="value"&&x!=="null"&&x!=="resolvedImage")return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");d=!0,l.push({content:_,scale:null,font:null,textColor:null})}}return new Qs(l)}evaluate(e){return new Vi(this.sections.map(r=>{const s=r.content.evaluate(e);return Yt(s)===_r?new qo("",s,null,null,null):new qo(zr(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 Xo{constructor(e){this.type=_r,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected two arguments.");const s=r.parse(e[1],1,at);return s?new Xo(s):r.error("No image name provided.")}evaluate(e){const r=this.input.evaluate(e),s=ui.fromString(r);return s&&e.availableImages&&(s.available=e.availableImages.indexOf(r)>-1),s}eachChild(e){e(this.input)}outputDefined(){return!1}}class Wo{constructor(e){this.type=Ee,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 ${M(s.type)} instead.`):new Wo(s):null}evaluate(e){const r=this.input.evaluate(e);if(typeof r=="string"||Array.isArray(r))return r.length;throw new Wt(`Expected value to be of type string or array, but found ${M(Yt(r))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const yr=8192;function Jo(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*yr),Math.round(s*l*yr)]}function Ln(i,e){const r=Math.pow(2,e.z);return[(l=(i[0]/yr+e.x)/r,360*l-180),(s=(i[1]/yr+e.y)/r,360/Math.PI*Math.atan(Math.exp((180-360*s)*Math.PI/180))-90)];var s,l}function pt(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 _s(i,e){return!(i[0]<=e[0]||i[2]>=e[2]||i[1]<=e[1]||i[3]>=e[3])}function Gc(i,e,r){const s=i[0]-e[0],l=i[1]-e[1],d=i[0]-r[0],p=i[1]-r[1];return s*p-d*l==0&&s*d<=0&&l*p<=0}function eo(i,e,r,s){return(l=[s[0]-r[0],s[1]-r[1]])[0]*(d=[e[0]-i[0],e[1]-i[1]])[1]-l[1]*d[0]!=0&&!(!Sl(i,e,r,s)||!Sl(r,s,i,e));var l,d}function Hc(i,e,r){for(const s of r)for(let l=0;l<s.length-1;++l)if(eo(i,e,s[l],s[l+1]))return!0;return!1}function Rn(i,e,r=!1){let s=!1;for(const m of e)for(let _=0;_<m.length-1;_++){if(Gc(i,m[_],m[_+1]))return r;(d=m[_])[1]>(l=i)[1]!=(p=m[_+1])[1]>l[1]&&l[0]<(p[0]-d[0])*(l[1]-d[1])/(p[1]-d[1])+d[0]&&(s=!s)}var l,d,p;return s}function Xc(i,e){for(const r of e)if(Rn(i,r))return!0;return!1}function wl(i,e){for(const r of i)if(!Rn(r,e))return!1;for(let r=0;r<i.length-1;++r)if(Hc(i[r],i[r+1],e))return!1;return!0}function Wc(i,e){for(const r of e)if(wl(i,r))return!0;return!1}function Sl(i,e,r,s){const l=s[0]-r[0],d=s[1]-r[1],p=(i[0]-r[0])*d-l*(i[1]-r[1]),m=(e[0]-r[0])*d-l*(e[1]-r[1]);return p>0&&m<0||p<0&&m>0}function Ko(i,e,r){const s=[];for(let l=0;l<i.length;l++){const d=[];for(let p=0;p<i[l].length;p++){const m=Jo(i[l][p],r);pt(e,m),d.push(m)}s.push(d)}return s}function Tl(i,e,r){const s=[];for(let l=0;l<i.length;l++){const d=Ko(i[l],e,r);s.push(d)}return s}function kl(i,e,r,s){if(i[0]<r[0]||i[0]>r[2]){const l=.5*s;let d=i[0]-r[0]>l?-s:r[0]-i[0]>l?s:0;d===0&&(d=i[0]-r[2]>l?-s:r[2]-i[0]>l?s:0),i[0]+=d}pt(e,i)}function Il(i,e,r,s){const l=Math.pow(2,s.z)*yr,d=[s.x*yr,s.y*yr],p=[];for(const m of i)for(const _ of m){const x=[_.x+d[0],_.y+d[1]];kl(x,e,r,l),p.push(x)}return p}function Cl(i,e,r,s){const l=Math.pow(2,s.z)*yr,d=[s.x*yr,s.y*yr],p=[];for(const _ of i){const x=[];for(const S of _){const I=[S.x+d[0],S.y+d[1]];pt(e,I),x.push(I)}p.push(x)}if(e[2]-e[0]<=l/2){(m=e)[0]=m[1]=1/0,m[2]=m[3]=-1/0;for(const _ of p)for(const x of _)kl(x,e,r,l)}var m;return p}class dn{constructor(e,r){this.type=Ye,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(hs(e[1])){const s=e[1];if(s.type==="FeatureCollection"){const l=[];for(const d of s.features){const{type:p,coordinates:m}=d.geometry;p==="Polygon"&&l.push(m),p==="MultiPolygon"&&l.push(...m)}if(l.length)return new dn(s,{type:"MultiPolygon",coordinates:l})}else if(s.type==="Feature"){const l=s.geometry.type;if(l==="Polygon"||l==="MultiPolygon")return new dn(s,s.geometry)}else if(s.type==="Polygon"||s.type==="MultiPolygon")return new dn(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],d=[1/0,1/0,-1/0,-1/0],p=r.canonicalID();if(s.type==="Polygon"){const m=Ko(s.coordinates,d,p),_=Il(r.geometry(),l,d,p);if(!_s(l,d))return!1;for(const x of _)if(!Rn(x,m))return!1}if(s.type==="MultiPolygon"){const m=Tl(s.coordinates,d,p),_=Il(r.geometry(),l,d,p);if(!_s(l,d))return!1;for(const x of _)if(!Xc(x,m))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],d=[1/0,1/0,-1/0,-1/0],p=r.canonicalID();if(s.type==="Polygon"){const m=Ko(s.coordinates,d,p),_=Cl(r.geometry(),l,d,p);if(!_s(l,d))return!1;for(const x of _)if(!wl(x,m))return!1}if(s.type==="MultiPolygon"){const m=Tl(s.coordinates,d,p),_=Cl(r.geometry(),l,d,p);if(!_s(l,d))return!1;for(const x of _)if(!Wc(x,m))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let El=class{constructor(i=[],e=Jc){if(this.data=i,this.length=this.data.length,this.compare=e,this.length>0)for(let r=(this.length>>1)-1;r>=0;r--)this._down(r)}push(i){this.data.push(i),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const i=this.data[0],e=this.data.pop();return this.length--,this.length>0&&(this.data[0]=e,this._down(0)),i}peek(){return this.data[0]}_up(i){const{data:e,compare:r}=this,s=e[i];for(;i>0;){const l=i-1>>1,d=e[l];if(r(s,d)>=0)break;e[i]=d,i=l}e[i]=s}_down(i){const{data:e,compare:r}=this,s=this.length>>1,l=e[i];for(;i<s;){let d=1+(i<<1),p=e[d];const m=d+1;if(m<this.length&&r(e[m],p)<0&&(d=m,p=e[m]),r(p,l)>=0)break;e[i]=p,i=d}e[i]=l}};function Jc(i,e){return i<e?-1:i>e?1:0}function Kc(i,e,r,s,l){Pl(i,e,r,s||i.length-1,l||Yc)}function Pl(i,e,r,s,l){for(;s>r;){if(s-r>600){var d=s-r+1,p=e-r+1,m=Math.log(d),_=.5*Math.exp(2*m/3),x=.5*Math.sqrt(m*_*(d-_)/d)*(p-d/2<0?-1:1);Pl(i,e,Math.max(r,Math.floor(e-p*_/d+x)),Math.min(s,Math.floor(e+(d-p)*_/d+x)),l)}var S=i[e],I=r,A=s;for(ys(i,r,e),l(i[s],S)>0&&ys(i,r,s);I<A;){for(ys(i,I,A),I++,A--;l(i[I],S)<0;)I++;for(;l(i[A],S)>0;)A--}l(i[r],S)===0?ys(i,r,A):ys(i,++A,s),A<=e&&(r=A+1),e<=A&&(s=A-1)}}function ys(i,e,r){var s=i[e];i[e]=i[r],i[r]=s}function Yc(i,e){return i<e?-1:i>e?1:0}function to(i,e){if(i.length<=1)return[i];const r=[];let s,l;for(const d of i){const p=eh(d);p!==0&&(d.area=Math.abs(p),l===void 0&&(l=p<0),l===p<0?(s&&r.push(s),s=[d]):s.push(d))}if(s&&r.push(s),e>1)for(let d=0;d<r.length;d++)r[d].length<=e||(Kc(r[d],e,1,r[d].length-1,Qc),r[d]=r[d].slice(0,e));return r}function Qc(i,e){return e.area-i.area}function eh(i){let e=0;for(let r,s,l=0,d=i.length,p=d-1;l<d;p=l++)r=i[l],s=i[p],e+=(s.x-r.x)*(r.y+s.y);return e}const Al=1/298.257223563,Ml=Al*(2-Al),zl=Math.PI/180;class Yo{constructor(e){const r=6378.137*zl*1e3,s=Math.cos(e*zl),l=1/(1-Ml*(1-s*s)),d=Math.sqrt(l);this.kx=r*d*s,this.ky=r*d*l*(1-Ml)}distance(e,r){const s=this.wrap(e[0]-r[0])*this.kx,l=(e[1]-r[1])*this.ky;return Math.sqrt(s*s+l*l)}pointOnLine(e,r){let s,l,d,p,m=1/0;for(let _=0;_<e.length-1;_++){let x=e[_][0],S=e[_][1],I=this.wrap(e[_+1][0]-x)*this.kx,A=(e[_+1][1]-S)*this.ky,D=0;I===0&&A===0||(D=(this.wrap(r[0]-x)*this.kx*I+(r[1]-S)*this.ky*A)/(I*I+A*A),D>1?(x=e[_+1][0],S=e[_+1][1]):D>0&&(x+=I/this.kx*D,S+=A/this.ky*D)),I=this.wrap(r[0]-x)*this.kx,A=(r[1]-S)*this.ky;const B=I*I+A*A;B<m&&(m=B,s=x,l=S,d=_,p=D)}return{point:[s,l],index:d,t:Math.max(0,Math.min(1,p))}}wrap(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}}function Dl(i,e){return e[0]-i[0]}function io(i){return i[1]-i[0]+1}function Dr(i,e){return i[1]>=i[0]&&i[1]<e}function xs(i,e){if(i[0]>i[1])return[null,null];const r=io(i);if(e){if(r===2)return[i,null];const l=Math.floor(r/2);return[[i[0],i[0]+l],[i[0]+l,i[1]]]}if(r===1)return[i,null];const s=Math.floor(r/2)-1;return[[i[0],i[0]+s],[i[0]+s+1,i[1]]]}function Qo(i,e){if(!Dr(e,i.length))return[1/0,1/0,-1/0,-1/0];const r=[1/0,1/0,-1/0,-1/0];for(let s=e[0];s<=e[1];++s)pt(r,i[s]);return r}function ea(i){const e=[1/0,1/0,-1/0,-1/0];for(const r of i)for(const s of r)pt(e,s);return e}function Ll(i){return i[0]!==-1/0&&i[1]!==-1/0&&i[2]!==1/0&&i[3]!==1/0}function ta(i,e,r){if(!Ll(i)||!Ll(e))return NaN;let s=0,l=0;return i[2]<e[0]&&(s=e[0]-i[2]),i[0]>e[2]&&(s=i[0]-e[2]),i[1]>e[3]&&(l=i[1]-e[3]),i[3]<e[1]&&(l=e[1]-i[3]),r.distance([0,0],[s,l])}function Et(i,e,r){const s=r.pointOnLine(e,i);return r.distance(i,s.point)}function ia(i,e,r,s,l){const d=Math.min(Et(i,[r,s],l),Et(e,[r,s],l)),p=Math.min(Et(r,[i,e],l),Et(s,[i,e],l));return Math.min(d,p)}function ut(i,e,r,s,l){if(!Dr(e,i.length)||!Dr(s,r.length))return 1/0;let d=1/0;for(let p=e[0];p<e[1];++p){const m=i[p],_=i[p+1];for(let x=s[0];x<s[1];++x){const S=r[x],I=r[x+1];if(eo(m,_,S,I))return 0;d=Math.min(d,ia(m,_,S,I,l))}}return d}function ra(i,e,r,s,l){if(!Dr(e,i.length)||!Dr(s,r.length))return NaN;let d=1/0;for(let p=e[0];p<=e[1];++p)for(let m=s[0];m<=s[1];++m)if(d=Math.min(d,l.distance(i[p],r[m])),d===0)return d;return d}function Vt(i,e,r){if(Rn(i,e,!0))return 0;let s=1/0;for(const l of e){const d=l[0],p=l[l.length-1];if(d!==p&&(s=Math.min(s,Et(i,[p,d],r)),s===0))return s;const m=r.pointOnLine(l,i);if(s=Math.min(s,r.distance(i,m.point)),s===0)return s}return s}function Mt(i,e,r,s){if(!Dr(e,i.length))return NaN;for(let d=e[0];d<=e[1];++d)if(Rn(i[d],r,!0))return 0;let l=1/0;for(let d=e[0];d<e[1];++d){const p=i[d],m=i[d+1];for(const _ of r)for(let x=0,S=_.length,I=S-1;x<S;I=x++){const A=_[I],D=_[x];if(eo(p,m,A,D))return 0;l=Math.min(l,ia(p,m,A,D,s))}}return l}function vs(i,e){for(const r of i)for(const s of r)if(Rn(s,e,!0))return!0;return!1}function Rl(i,e,r,s=1/0){const l=ea(i),d=ea(e);if(s!==1/0&&ta(l,d,r)>=s)return s;if(_s(l,d)){if(vs(i,e))return 0}else if(vs(e,i))return 0;let p=1/0;for(const m of i)for(let _=0,x=m.length,S=x-1;_<x;S=_++){const I=m[S],A=m[_];for(const D of e)for(let B=0,O=D.length,q=O-1;B<O;q=B++){const J=D[q],ae=D[B];if(eo(I,A,J,ae))return 0;p=Math.min(p,ia(I,A,J,ae,r))}}return p}function na(i,e,r,s,l,d){if(!d)return;const p=ta(Qo(s,d),l,r);p<e&&i.push([p,d,[0,0]])}function ro(i,e,r,s,l,d,p){if(!d||!p)return;const m=ta(Qo(s,d),Qo(l,p),r);m<e&&i.push([m,d,p])}function no(i,e,r,s,l=1/0){let d=Math.min(s.distance(i[0],r[0][0]),l);if(d===0)return d;const p=new El([[0,[0,i.length-1],[0,0]]],Dl),m=ea(r);for(;p.length>0;){const _=p.pop();if(_[0]>=d)continue;const x=_[1],S=e?50:100;if(io(x)<=S){if(!Dr(x,i.length))return NaN;if(e){const I=Mt(i,x,r,s);if(isNaN(I)||I===0)return I;d=Math.min(d,I)}else for(let I=x[0];I<=x[1];++I){const A=Vt(i[I],r,s);if(d=Math.min(d,A),d===0)return 0}}else{const I=xs(x,e);na(p,d,s,i,m,I[0]),na(p,d,s,i,m,I[1])}}return d}function so(i,e,r,s,l,d=1/0){let p=Math.min(d,l.distance(i[0],r[0]));if(p===0)return p;const m=new El([[0,[0,i.length-1],[0,r.length-1]]],Dl);for(;m.length>0;){const _=m.pop();if(_[0]>=p)continue;const x=_[1],S=_[2],I=e?50:100,A=s?50:100;if(io(x)<=I&&io(S)<=A){if(!Dr(x,i.length)&&Dr(S,r.length))return NaN;let D;if(e&&s)D=ut(i,x,r,S,l),p=Math.min(p,D);else if(e&&!s){const B=i.slice(x[0],x[1]+1);for(let O=S[0];O<=S[1];++O)if(D=Et(r[O],B,l),p=Math.min(p,D),p===0)return p}else if(!e&&s){const B=r.slice(S[0],S[1]+1);for(let O=x[0];O<=x[1];++O)if(D=Et(i[O],B,l),p=Math.min(p,D),p===0)return p}else D=ra(i,x,r,S,l),p=Math.min(p,D)}else{const D=xs(x,e),B=xs(S,s);ro(m,p,l,i,r,D[0],B[0]),ro(m,p,l,i,r,D[0],B[1]),ro(m,p,l,i,r,D[1],B[0]),ro(m,p,l,i,r,D[1],B[1])}}return p}function sa(i){return i.type==="MultiPolygon"?i.coordinates.map(e=>({type:"Polygon",coordinates:e})):i.type==="MultiLineString"?i.coordinates.map(e=>({type:"LineString",coordinates:e})):i.type==="MultiPoint"?i.coordinates.map(e=>({type:"Point",coordinates:e})):[i]}class Jr{constructor(e,r){this.type=Ee,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error(`'distance' expression requires exactly one argument, but found ${e.length-1} instead.`);if(hs(e[1])){const s=e[1];if(s.type==="FeatureCollection")return new Jr(s,s.features.map(l=>sa(l.geometry)).flat());if(s.type==="Feature")return new Jr(s,sa(s.geometry));if("type"in s&&"coordinates"in s)return new Jr(s,sa(s))}return r.error("'distance' 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=r.geometry(),d=l.flat().map(_=>Ln([_.x,_.y],r.canonical));if(l.length===0)return NaN;const p=new Yo(d[0][1]);let m=1/0;for(const _ of s){switch(_.type){case"Point":m=Math.min(m,so(d,!1,[_.coordinates],!1,p,m));break;case"LineString":m=Math.min(m,so(d,!1,_.coordinates,!0,p,m));break;case"Polygon":m=Math.min(m,no(d,!1,_.coordinates,p,m))}if(m===0)return m}return m}(e,this.geometries);if(e.geometryType()==="LineString")return function(r,s){const l=r.geometry(),d=l.flat().map(_=>Ln([_.x,_.y],r.canonical));if(l.length===0)return NaN;const p=new Yo(d[0][1]);let m=1/0;for(const _ of s){switch(_.type){case"Point":m=Math.min(m,so(d,!0,[_.coordinates],!1,p,m));break;case"LineString":m=Math.min(m,so(d,!0,_.coordinates,!0,p,m));break;case"Polygon":m=Math.min(m,no(d,!0,_.coordinates,p,m))}if(m===0)return m}return m}(e,this.geometries);if(e.geometryType()==="Polygon")return function(r,s){const l=r.geometry();if(l.length===0||l[0].length===0)return NaN;const d=to(l,0).map(_=>_.map(x=>x.map(S=>Ln([S.x,S.y],r.canonical)))),p=new Yo(d[0][0][0][1]);let m=1/0;for(const _ of s)for(const x of d){switch(_.type){case"Point":m=Math.min(m,no([_.coordinates],!1,x,p,m));break;case"LineString":m=Math.min(m,no(_.coordinates,!0,x,p,m));break;case"Polygon":m=Math.min(m,Rl(x,_.coordinates,p,m))}if(m===0)return m}return m}(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}const pn={"==":xl,"!=":Uc,">":vl,"<":qc,">=":Zc,"<=":bl,array:Wi,at:Go,boolean:Wi,case:Ws,coalesce:Ks,collator:Ys,format:Qs,image:Xo,in:ps,"index-of":Hs,interpolate:Ui,"interpolate-hcl":Ui,"interpolate-lab":Ui,length:Wo,let:xt,literal:hn,match:Xs,number:Wi,"number-format":Ho,object:Wi,slice:Js,step:Dn,string:Wi,"to-boolean":Hr,"to-color":Hr,"to-number":Hr,"to-string":Hr,var:Gs,within:dn,distance:Jr};class qi{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=qi.definitions[s];if(!l)return r.error(`Unknown expression "${s}". If you wanted a literal array, use ["literal", [...]].`,0);const d=Array.isArray(l)?l[0]:l.type,p=Array.isArray(l)?[[l[1],l[2]]]:l.overloads,m=p.filter(([x])=>!Array.isArray(x)||x.length===e.length-1);let _=null;for(const[x,S]of m){_=new Xr(r.registry,ao,r.path,null,r.scope);const I=[];let A=!1;for(let D=1;D<e.length;D++){const B=e[D],O=Array.isArray(x)?x[D-1]:x.type,q=_.parse(B,1+I.length,O);if(!q){A=!0;break}I.push(q)}if(!A)if(Array.isArray(x)&&x.length!==I.length)_.error(`Expected ${x.length} arguments, but found ${I.length} instead.`);else{for(let D=0;D<I.length;D++){const B=Array.isArray(x)?x[D]:x.type,O=I[D];_.concat(D+1).checkSubtype(B,O.type)}if(_.errors.length===0)return new qi(s,d,S,I)}}if(m.length===1)r.errors.push(..._.errors);else{const x=(m.length?m:p).map(([I])=>{return A=I,Array.isArray(A)?`(${A.map(M).join(", ")})`:`(${M(A.type)}...)`;var A}).join(" | "),S=[];for(let I=1;I<e.length;I++){const A=r.parse(e[I],1+S.length);if(!A)return null;S.push(M(A.type))}r.error(`Expected arguments of type ${x}, but found (${S.join(", ")}) instead.`)}return null}static register(e,r){qi.definitions=r;for(const s in r)e[s]=qi}}function oa(i,[e,r,s,l]){e=e.evaluate(i),r=r.evaluate(i),s=s.evaluate(i);const d=l?l.evaluate(i):1,p=qs(e,r,s,d);if(p)throw new Wt(p);return new bt(e/255,r/255,s/255,d,!1)}function oo(i,e){return i in e}function aa(i,e){const r=e[i];return r===void 0?null:r}function fn(i){return{type:i}}function ao(i){if(i instanceof Gs)return ao(i.boundExpression);if(i instanceof qi&&i.name==="error"||i instanceof Ys||i instanceof dn||i instanceof Jr)return!1;const e=i instanceof Hr||i instanceof Wi;let r=!0;return i.eachChild(s=>{r=e?r&&ao(s):r&&s instanceof hn}),!!r&&lo(i)&&co(i,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function lo(i){if(i instanceof qi&&(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 dn||i instanceof Jr)return!1;let e=!0;return i.eachChild(r=>{e&&!lo(r)&&(e=!1)}),e}function bs(i){if(i instanceof qi&&i.name==="feature-state")return!1;let e=!0;return i.eachChild(r=>{e&&!bs(r)&&(e=!1)}),e}function co(i,e){if(i instanceof qi&&e.indexOf(i.name)>=0)return!1;let r=!0;return i.eachChild(s=>{r&&!co(s,e)&&(r=!1)}),r}function Bl(i){return{result:"success",value:i}}function Bn(i){return{result:"error",value:i}}function mn(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function la(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function Fn(i){return!!i.expression&&i.expression.interpolated}function gt(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":i===null?"null":typeof i}function ws(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function Fl(i){return i}function Ol(i,e){const r=e.type==="color",s=i.stops&&typeof i.stops[0][0]=="object",l=s||!(s||i.property!==void 0),d=i.type||(Fn(e)?"exponential":"interval");if(r||e.type==="padding"){const S=r?bt.parse:Ni.parse;(i=fr({},i)).stops&&(i.stops=i.stops.map(I=>[I[0],S(I[1])])),i.default=S(i.default?i.default:e.default)}if(i.colorSpace&&(p=i.colorSpace)!=="rgb"&&p!=="hcl"&&p!=="lab")throw new Error(`Unknown color space: "${i.colorSpace}"`);var p;let m,_,x;if(d==="exponential")m=ca;else if(d==="interval")m=uo;else if(d==="categorical"){m=ho,_=Object.create(null);for(const S of i.stops)_[S[0]]=S[1];x=typeof i.stops[0][0]}else{if(d!=="identity")throw new Error(`Unknown function type "${d}"`);m=ha}if(s){const S={},I=[];for(let B=0;B<i.stops.length;B++){const O=i.stops[B],q=O[0].zoom;S[q]===void 0&&(S[q]={zoom:q,type:i.type,property:i.property,default:i.default,stops:[]},I.push(q)),S[q].stops.push([O[0].value,O[1]])}const A=[];for(const B of I)A.push([S[B].zoom,Ol(S[B],e)]);const D={name:"linear"};return{kind:"composite",interpolationType:D,interpolationFactor:Ui.interpolationFactor.bind(void 0,D),zoomStops:A.map(B=>B[0]),evaluate:({zoom:B},O)=>ca({stops:A,base:i.base},e,B).evaluate(B,O)}}if(l){const S=d==="exponential"?{name:"exponential",base:i.base!==void 0?i.base:1}:null;return{kind:"camera",interpolationType:S,interpolationFactor:Ui.interpolationFactor.bind(void 0,S),zoomStops:i.stops.map(I=>I[0]),evaluate:({zoom:I})=>m(i,e,I,_,x)}}return{kind:"source",evaluate(S,I){const A=I&&I.properties?I.properties[i.property]:void 0;return A===void 0?gn(i.default,e.default):m(i,e,A,_,x)}}}function gn(i,e,r){return i!==void 0?i:e!==void 0?e:r!==void 0?r:void 0}function ho(i,e,r,s,l){return gn(typeof r===l?s[r]:void 0,i.default,e.default)}function uo(i,e,r){if(gt(r)!=="number")return gn(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=fs(i.stops.map(d=>d[0]),r);return i.stops[l][1]}function ca(i,e,r){const s=i.base!==void 0?i.base:1;if(gt(r)!=="number")return gn(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 d=fs(i.stops.map(S=>S[0]),r),p=function(S,I,A,D){const B=D-A,O=S-A;return B===0?0:I===1?O/B:(Math.pow(I,O)-1)/(Math.pow(I,B)-1)}(r,s,i.stops[d][0],i.stops[d+1][0]),m=i.stops[d][1],_=i.stops[d+1][1],x=ji[e.type]||Fl;return typeof m.evaluate=="function"?{evaluate(...S){const I=m.evaluate.apply(void 0,S),A=_.evaluate.apply(void 0,S);if(I!==void 0&&A!==void 0)return x(I,A,p,i.colorSpace)}}:x(m,_,p,i.colorSpace)}function ha(i,e,r){switch(e.type){case"color":r=bt.parse(r);break;case"formatted":r=Vi.fromString(r.toString());break;case"resolvedImage":r=ui.fromString(r.toString());break;case"padding":r=Ni.parse(r);break;default:gt(r)===e.type||e.type==="enum"&&e.values[r]||(r=void 0)}return gn(r,i.default,e.default)}qi.register(pn,{error:[{kind:"error"},[at],(i,[e])=>{throw new Wt(e.evaluate(i))}],typeof:[at,[it],(i,[e])=>M(Yt(e.evaluate(i)))],"to-rgba":[z(Ee,4),[Pi],(i,[e])=>{const[r,s,l,d]=e.evaluate(i).rgb;return[255*r,255*s,255*l,d]}],rgb:[Pi,[Ee,Ee,Ee],oa],rgba:[Pi,[Ee,Ee,Ee,Ee],oa],has:{type:Ye,overloads:[[[at],(i,[e])=>oo(e.evaluate(i),i.properties())],[[at,tr],(i,[e,r])=>oo(e.evaluate(i),r.evaluate(i))]]},get:{type:it,overloads:[[[at],(i,[e])=>aa(e.evaluate(i),i.properties())],[[at,tr],(i,[e,r])=>aa(e.evaluate(i),r.evaluate(i))]]},"feature-state":[it,[at],(i,[e])=>aa(e.evaluate(i),i.featureState||{})],properties:[tr,[],i=>i.properties()],"geometry-type":[at,[],i=>i.geometryType()],id:[it,[],i=>i.id()],zoom:[Ee,[],i=>i.globals.zoom],"heatmap-density":[Ee,[],i=>i.globals.heatmapDensity||0],"line-progress":[Ee,[],i=>i.globals.lineProgress||0],accumulated:[it,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[Ee,fn(Ee),(i,e)=>{let r=0;for(const s of e)r+=s.evaluate(i);return r}],"*":[Ee,fn(Ee),(i,e)=>{let r=1;for(const s of e)r*=s.evaluate(i);return r}],"-":{type:Ee,overloads:[[[Ee,Ee],(i,[e,r])=>e.evaluate(i)-r.evaluate(i)],[[Ee],(i,[e])=>-e.evaluate(i)]]},"/":[Ee,[Ee,Ee],(i,[e,r])=>e.evaluate(i)/r.evaluate(i)],"%":[Ee,[Ee,Ee],(i,[e,r])=>e.evaluate(i)%r.evaluate(i)],ln2:[Ee,[],()=>Math.LN2],pi:[Ee,[],()=>Math.PI],e:[Ee,[],()=>Math.E],"^":[Ee,[Ee,Ee],(i,[e,r])=>Math.pow(e.evaluate(i),r.evaluate(i))],sqrt:[Ee,[Ee],(i,[e])=>Math.sqrt(e.evaluate(i))],log10:[Ee,[Ee],(i,[e])=>Math.log(e.evaluate(i))/Math.LN10],ln:[Ee,[Ee],(i,[e])=>Math.log(e.evaluate(i))],log2:[Ee,[Ee],(i,[e])=>Math.log(e.evaluate(i))/Math.LN2],sin:[Ee,[Ee],(i,[e])=>Math.sin(e.evaluate(i))],cos:[Ee,[Ee],(i,[e])=>Math.cos(e.evaluate(i))],tan:[Ee,[Ee],(i,[e])=>Math.tan(e.evaluate(i))],asin:[Ee,[Ee],(i,[e])=>Math.asin(e.evaluate(i))],acos:[Ee,[Ee],(i,[e])=>Math.acos(e.evaluate(i))],atan:[Ee,[Ee],(i,[e])=>Math.atan(e.evaluate(i))],min:[Ee,fn(Ee),(i,e)=>Math.min(...e.map(r=>r.evaluate(i)))],max:[Ee,fn(Ee),(i,e)=>Math.max(...e.map(r=>r.evaluate(i)))],abs:[Ee,[Ee],(i,[e])=>Math.abs(e.evaluate(i))],round:[Ee,[Ee],(i,[e])=>{const r=e.evaluate(i);return r<0?-Math.round(-r):Math.round(r)}],floor:[Ee,[Ee],(i,[e])=>Math.floor(e.evaluate(i))],ceil:[Ee,[Ee],(i,[e])=>Math.ceil(e.evaluate(i))],"filter-==":[Ye,[at,it],(i,[e,r])=>i.properties()[e.value]===r.value],"filter-id-==":[Ye,[it],(i,[e])=>i.id()===e.value],"filter-type-==":[Ye,[at],(i,[e])=>i.geometryType()===e.value],"filter-<":[Ye,[at,it],(i,[e,r])=>{const s=i.properties()[e.value],l=r.value;return typeof s==typeof l&&s<l}],"filter-id-<":[Ye,[it],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r<s}],"filter->":[Ye,[at,it],(i,[e,r])=>{const s=i.properties()[e.value],l=r.value;return typeof s==typeof l&&s>l}],"filter-id->":[Ye,[it],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r>s}],"filter-<=":[Ye,[at,it],(i,[e,r])=>{const s=i.properties()[e.value],l=r.value;return typeof s==typeof l&&s<=l}],"filter-id-<=":[Ye,[it],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r<=s}],"filter->=":[Ye,[at,it],(i,[e,r])=>{const s=i.properties()[e.value],l=r.value;return typeof s==typeof l&&s>=l}],"filter-id->=":[Ye,[it],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r>=s}],"filter-has":[Ye,[it],(i,[e])=>e.value in i.properties()],"filter-has-id":[Ye,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[Ye,[z(at)],(i,[e])=>e.value.indexOf(i.geometryType())>=0],"filter-id-in":[Ye,[z(it)],(i,[e])=>e.value.indexOf(i.id())>=0],"filter-in-small":[Ye,[at,z(it)],(i,[e,r])=>r.value.indexOf(i.properties()[e.value])>=0],"filter-in-large":[Ye,[at,z(it)],(i,[e,r])=>function(s,l,d,p){for(;d<=p;){const m=d+p>>1;if(l[m]===s)return!0;l[m]>s?p=m-1:d=m+1}return!1}(i.properties()[e.value],r.value,0,r.value.length-1)],all:{type:Ye,overloads:[[[Ye,Ye],(i,[e,r])=>e.evaluate(i)&&r.evaluate(i)],[fn(Ye),(i,e)=>{for(const r of e)if(!r.evaluate(i))return!1;return!0}]]},any:{type:Ye,overloads:[[[Ye,Ye],(i,[e,r])=>e.evaluate(i)||r.evaluate(i)],[fn(Ye),(i,e)=>{for(const r of e)if(r.evaluate(i))return!0;return!1}]]},"!":[Ye,[Ye],(i,[e])=>!e.evaluate(i)],"is-supported-script":[Ye,[at],(i,[e])=>{const r=i.globals&&i.globals.isSupportedScript;return!r||r(e.evaluate(i))}],upcase:[at,[at],(i,[e])=>e.evaluate(i).toUpperCase()],downcase:[at,[at],(i,[e])=>e.evaluate(i).toLowerCase()],concat:[at,fn(it),(i,e)=>e.map(r=>zr(r.evaluate(i))).join("")],"resolved-locale":[at,[gr],(i,[e])=>e.evaluate(i).resolvedLocale()]});class po{constructor(e,r){var s;this.expression=e,this._warningHistory={},this._evaluator=new ds,this._defaultValue=r?(s=r).type==="color"&&ws(s.default)?new bt(0,0,0,0):s.type==="color"?bt.parse(s.default)||null:s.type==="padding"?Ni.parse(s.default)||null:s.type==="variableAnchorOffsetCollection"?$i.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,d,p){return this._evaluator.globals=e,this._evaluator.feature=r,this._evaluator.featureState=s,this._evaluator.canonical=l,this._evaluator.availableImages=d||null,this._evaluator.formattedSection=p,this.expression.evaluate(this._evaluator)}evaluate(e,r,s,l,d,p){this._evaluator.globals=e,this._evaluator.feature=r||null,this._evaluator.featureState=s||null,this._evaluator.canonical=l,this._evaluator.availableImages=d||null,this._evaluator.formattedSection=p||null;try{const m=this.expression.evaluate(this._evaluator);if(m==null||typeof m=="number"&&m!=m)return this._defaultValue;if(this._enumValues&&!(m in this._enumValues))throw new Wt(`Expected value to be one of ${Object.keys(this._enumValues).map(_=>JSON.stringify(_)).join(", ")}, but found ${JSON.stringify(m)} instead.`);return m}catch(m){return this._warningHistory[m.message]||(this._warningHistory[m.message]=!0,typeof console<"u"&&console.warn(m.message)),this._defaultValue}}}function Ss(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in pn}function _n(i,e){const r=new Xr(pn,ao,[],e?function(l){const d={color:Pi,string:at,number:Ee,enum:at,boolean:Ye,formatted:Mr,padding:Gr,resolvedImage:_r,variableAnchorOffsetCollection:X};return l.type==="array"?z(d[l.value]||it,l.length):d[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?Bl(new po(s,e)):Bn(r.errors)}class ua{constructor(e,r){this.kind=e,this._styleExpression=r,this.isStateDependent=e!=="constant"&&!bs(r.expression)}evaluateWithoutErrorHandling(e,r,s,l,d,p){return this._styleExpression.evaluateWithoutErrorHandling(e,r,s,l,d,p)}evaluate(e,r,s,l,d,p){return this._styleExpression.evaluate(e,r,s,l,d,p)}}class da{constructor(e,r,s,l){this.kind=e,this.zoomStops=s,this._styleExpression=r,this.isStateDependent=e!=="camera"&&!bs(r.expression),this.interpolationType=l}evaluateWithoutErrorHandling(e,r,s,l,d,p){return this._styleExpression.evaluateWithoutErrorHandling(e,r,s,l,d,p)}evaluate(e,r,s,l,d,p){return this._styleExpression.evaluate(e,r,s,l,d,p)}interpolationFactor(e,r,s){return this.interpolationType?Ui.interpolationFactor(this.interpolationType,e,r,s):0}}function Vl(i,e){const r=_n(i,e);if(r.result==="error")return r;const s=r.value.expression,l=lo(s);if(!l&&!mn(e))return Bn([new Si("","data expressions not supported")]);const d=co(s,["zoom"]);if(!d&&!la(e))return Bn([new Si("","zoom expressions not supported")]);const p=mo(s);return p||d?p instanceof Si?Bn([p]):p instanceof Ui&&!Fn(e)?Bn([new Si("",'"interpolate" expressions cannot be used with this property')]):Bl(p?new da(l?"camera":"composite",r.value,p.labels,p instanceof Ui?p.interpolation:void 0):new ua(l?"constant":"source",r.value)):Bn([new Si("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class fo{constructor(e,r){this._parameters=e,this._specification=r,fr(this,Ol(this._parameters,this._specification))}static deserialize(e){return new fo(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function mo(i){let e=null;if(i instanceof xt)e=mo(i.result);else if(i instanceof Ks){for(const r of i.args)if(e=mo(r),e)break}else(i instanceof Dn||i instanceof Ui)&&i.input instanceof qi&&i.input.name==="zoom"&&(e=i);return e instanceof Si||i.eachChild(r=>{const s=mo(r);s instanceof Si?e=s:!e&&s?e=new Si("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&s&&e!==s&&(e=new Si("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function On(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(!On(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const go={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Ti(i){if(i==null)return{filter:()=>!0,needGeometry:!1};On(i)||(i=_o(i));const e=_n(i,go);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:pa(i)}}function Ts(i,e){return i<e?-1:i>e?1:0}function pa(i){if(!Array.isArray(i))return!1;if(i[0]==="within"||i[0]==="distance")return!0;for(let e=1;e<i.length;e++)if(pa(i[e]))return!0;return!1}function _o(i){if(!i)return!0;const e=i[0];return i.length<=1?e!=="any":e==="=="?fa(i[1],i[2],"=="):e==="!="?Nn(fa(i[1],i[2],"==")):e==="<"||e===">"||e==="<="||e===">="?fa(i[1],i[2],e):e==="any"?(r=i.slice(1),["any"].concat(r.map(_o))):e==="all"?["all"].concat(i.slice(1).map(_o)):e==="none"?["all"].concat(i.slice(1).map(_o).map(Nn)):e==="in"?Vn(i[1],i.slice(2)):e==="!in"?Nn(Vn(i[1],i.slice(2))):e==="has"?ma(i[1]):e!=="!has"||Nn(ma(i[1]));var r}function fa(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 Vn(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(Ts)]]:["filter-in-small",i,["literal",e]]}}function ma(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function Nn(i){return["!",i]}function ga(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 d of i)l+=`${ga(d)},`;return`${l}]`}const r=Object.keys(i).sort();let s="{";for(let l=0;l<r.length;l++)s+=`${JSON.stringify(r[l])}:${ga(i[r[l]])},`;return`${s}}`}function _a(i){let e="";for(const r of cn)e+=`/${ga(i[r])}`;return e}function Nl(i){const e=i.value;return e?[new ke(i.key,e,"constants have been deprecated as of v8")]:[]}function zt(i){return i instanceof Number||i instanceof String||i instanceof Boolean?i.valueOf():i}function yn(i){if(Array.isArray(i))return i.map(yn);if(i instanceof Object&&!(i instanceof Number||i instanceof String||i instanceof Boolean)){const e={};for(const r in i)e[r]=yn(i[r]);return e}return zt(i)}function Ai(i){const e=i.key,r=i.value,s=i.valueSpec||{},l=i.objectElementValidators||{},d=i.style,p=i.styleSpec,m=i.validateSpec;let _=[];const x=gt(r);if(x!=="object")return[new ke(e,r,`object expected, ${x} found`)];for(const S in r){const I=S.split(".")[0],A=s[I]||s["*"];let D;if(l[I])D=l[I];else if(s[I])D=m;else if(l["*"])D=l["*"];else{if(!s["*"]){_.push(new ke(e,r[S],`unknown property "${S}"`));continue}D=m}_=_.concat(D({key:(e&&`${e}.`)+S,value:r[S],valueSpec:A,style:d,styleSpec:p,object:r,objectKey:S,validateSpec:m},r))}for(const S in s)l[S]||s[S].required&&s[S].default===void 0&&r[S]===void 0&&_.push(new ke(e,r,`missing required property "${S}"`));return _}function yo(i){const e=i.value,r=i.valueSpec,s=i.style,l=i.styleSpec,d=i.key,p=i.arrayElementValidator||i.validateSpec;if(gt(e)!=="array")return[new ke(d,e,`array expected, ${gt(e)} found`)];if(r.length&&e.length!==r.length)return[new ke(d,e,`array length ${r.length} expected, length ${e.length} found`)];if(r["min-length"]&&e.length<r["min-length"])return[new ke(d,e,`array length at least ${r["min-length"]} expected, length ${e.length} found`)];let m={type:r.value,values:r.values};l.$version<7&&(m.function=r.function),gt(r.value)==="object"&&(m=r.value);let _=[];for(let x=0;x<e.length;x++)_=_.concat(p({array:e,arrayIndex:x,value:e[x],valueSpec:m,validateSpec:i.validateSpec,style:s,styleSpec:l,key:`${d}[${x}]`}));return _}function ks(i){const e=i.key,r=i.value,s=i.valueSpec;let l=gt(r);return l==="number"&&r!=r&&(l="NaN"),l!=="number"?[new ke(e,r,`number expected, ${l} found`)]:"minimum"in s&&r<s.minimum?[new ke(e,r,`${r} is less than the minimum value ${s.minimum}`)]:"maximum"in s&&r>s.maximum?[new ke(e,r,`${r} is greater than the maximum value ${s.maximum}`)]:[]}function ya(i){const e=i.valueSpec,r=zt(i.value.type);let s,l,d,p={};const m=r!=="categorical"&&i.value.property===void 0,_=!m,x=gt(i.value.stops)==="array"&>(i.value.stops[0])==="array"&>(i.value.stops[0][0])==="object",S=Ai({key:i.key,value:i.value,valueSpec:i.styleSpec.function,validateSpec:i.validateSpec,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{stops:function(D){if(r==="identity")return[new ke(D.key,D.value,'identity function may not have a "stops" property')];let B=[];const O=D.value;return B=B.concat(yo({key:D.key,value:O,valueSpec:D.valueSpec,validateSpec:D.validateSpec,style:D.style,styleSpec:D.styleSpec,arrayElementValidator:I})),gt(O)==="array"&&O.length===0&&B.push(new ke(D.key,O,"array must have at least one stop")),B},default:function(D){return D.validateSpec({key:D.key,value:D.value,valueSpec:e,validateSpec:D.validateSpec,style:D.style,styleSpec:D.styleSpec})}}});return r==="identity"&&m&&S.push(new ke(i.key,i.value,'missing required property "property"')),r==="identity"||i.value.stops||S.push(new ke(i.key,i.value,'missing required property "stops"')),r==="exponential"&&i.valueSpec.expression&&!Fn(i.valueSpec)&&S.push(new ke(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(_&&!mn(i.valueSpec)?S.push(new ke(i.key,i.value,"property functions not supported")):m&&!la(i.valueSpec)&&S.push(new ke(i.key,i.value,"zoom functions not supported"))),r!=="categorical"&&!x||i.value.property!==void 0||S.push(new ke(i.key,i.value,'"property" property is required')),S;function I(D){let B=[];const O=D.value,q=D.key;if(gt(O)!=="array")return[new ke(q,O,`array expected, ${gt(O)} found`)];if(O.length!==2)return[new ke(q,O,`array length 2 expected, length ${O.length} found`)];if(x){if(gt(O[0])!=="object")return[new ke(q,O,`object expected, ${gt(O[0])} found`)];if(O[0].zoom===void 0)return[new ke(q,O,"object stop key must have zoom")];if(O[0].value===void 0)return[new ke(q,O,"object stop key must have value")];if(d&&d>zt(O[0].zoom))return[new ke(q,O[0].zoom,"stop zoom values must appear in ascending order")];zt(O[0].zoom)!==d&&(d=zt(O[0].zoom),l=void 0,p={}),B=B.concat(Ai({key:`${q}[0]`,value:O[0],valueSpec:{zoom:{}},validateSpec:D.validateSpec,style:D.style,styleSpec:D.styleSpec,objectElementValidators:{zoom:ks,value:A}}))}else B=B.concat(A({key:`${q}[0]`,value:O[0],valueSpec:{},validateSpec:D.validateSpec,style:D.style,styleSpec:D.styleSpec},O));return Ss(yn(O[1]))?B.concat([new ke(`${q}[1]`,O[1],"expressions are not allowed in function stops.")]):B.concat(D.validateSpec({key:`${q}[1]`,value:O[1],valueSpec:e,validateSpec:D.validateSpec,style:D.style,styleSpec:D.styleSpec}))}function A(D,B){const O=gt(D.value),q=zt(D.value),J=D.value!==null?D.value:B;if(s){if(O!==s)return[new ke(D.key,J,`${O} stop domain type must match previous stop domain type ${s}`)]}else s=O;if(O!=="number"&&O!=="string"&&O!=="boolean")return[new ke(D.key,J,"stop domain value must be a number, string, or boolean")];if(O!=="number"&&r!=="categorical"){let ae=`number expected, ${O} found`;return mn(e)&&r===void 0&&(ae+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new ke(D.key,J,ae)]}return r!=="categorical"||O!=="number"||isFinite(q)&&Math.floor(q)===q?r!=="categorical"&&O==="number"&&l!==void 0&&q<l?[new ke(D.key,J,"stop domain values must appear in ascending order")]:(l=q,r==="categorical"&&q in p?[new ke(D.key,J,"stop domain values must be unique")]:(p[q]=!0,[])):[new ke(D.key,J,`integer expected, found ${q}`)]}}function xn(i){const e=(i.expressionContext==="property"?Vl:_n)(yn(i.value),i.valueSpec);if(e.result==="error")return e.value.map(s=>new ke(`${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 ke(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"&&!bs(r))return[new ke(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if(i.expressionContext==="filter"&&!bs(r))return[new ke(i.key,i.value,'"feature-state" data expressions are not supported with filters.')];if(i.expressionContext&&i.expressionContext.indexOf("cluster")===0){if(!co(r,["zoom","feature-state"]))return[new ke(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(i.expressionContext==="cluster-initial"&&!lo(r))return[new ke(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Is(i){const e=i.key,r=i.value,s=i.valueSpec,l=[];return Array.isArray(s.values)?s.values.indexOf(zt(r))===-1&&l.push(new ke(e,r,`expected one of [${s.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(s.values).indexOf(zt(r))===-1&&l.push(new ke(e,r,`expected one of [${Object.keys(s.values).join(", ")}], ${JSON.stringify(r)} found`)),l}function Cs(i){return On(yn(i.value))?xn(fr({},i,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Es(i)}function Es(i){const e=i.value,r=i.key;if(gt(e)!=="array")return[new ke(r,e,`array expected, ${gt(e)} found`)];const s=i.styleSpec;let l,d=[];if(e.length<1)return[new ke(r,e,"filter array must have at least 1 element")];switch(d=d.concat(Is({key:`${r}[0]`,value:e[0],valueSpec:s.filter_operator,style:i.style,styleSpec:i.styleSpec})),zt(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&zt(e[1])==="$type"&&d.push(new ke(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&d.push(new ke(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(l=gt(e[1]),l!=="string"&&d.push(new ke(`${r}[1]`,e[1],`string expected, ${l} found`)));for(let p=2;p<e.length;p++)l=gt(e[p]),zt(e[1])==="$type"?d=d.concat(Is({key:`${r}[${p}]`,value:e[p],valueSpec:s.geometry_type,style:i.style,styleSpec:i.styleSpec})):l!=="string"&&l!=="number"&&l!=="boolean"&&d.push(new ke(`${r}[${p}]`,e[p],`string, number, or boolean expected, ${l} found`));break;case"any":case"all":case"none":for(let p=1;p<e.length;p++)d=d.concat(Es({key:`${r}[${p}]`,value:e[p],style:i.style,styleSpec:i.styleSpec}));break;case"has":case"!has":l=gt(e[1]),e.length!==2?d.push(new ke(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):l!=="string"&&d.push(new ke(`${r}[1]`,e[1],`string expected, ${l} found`))}return d}function xa(i,e){const r=i.key,s=i.validateSpec,l=i.style,d=i.styleSpec,p=i.value,m=i.objectKey,_=d[`${e}_${i.layerType}`];if(!_)return[];const x=m.match(/^(.*)-transition$/);if(e==="paint"&&x&&_[x[1]]&&_[x[1]].transition)return s({key:r,value:p,valueSpec:d.transition,style:l,styleSpec:d});const S=i.valueSpec||_[m];if(!S)return[new ke(r,p,`unknown property "${m}"`)];let I;if(gt(p)==="string"&&mn(S)&&!S.tokens&&(I=/^{([^}]+)}$/.exec(p)))return[new ke(r,p,`"${m}" does not support interpolation syntax
|
5
|
-
Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(I[1])} }\`.`)];const A=[];return i.layerType==="symbol"&&(m==="text-field"&&l&&!l.glyphs&&A.push(new ke(r,p,'use of "text-field" requires a style "glyphs" property')),m==="text-font"&&ws(yn(p))&&zt(p.type)==="identity"&&A.push(new ke(r,p,'"text-font" does not support identity functions'))),A.concat(s({key:i.key,value:p,valueSpec:S,style:l,styleSpec:d,expressionContext:"property",propertyType:e,propertyKey:m}))}function va(i){return xa(i,"paint")}function ba(i){return xa(i,"layout")}function wa(i){let e=[];const r=i.value,s=i.key,l=i.style,d=i.styleSpec;r.type||r.ref||e.push(new ke(s,r,'either "type" or "ref" is required'));let p=zt(r.type);const m=zt(r.ref);if(r.id){const _=zt(r.id);for(let x=0;x<i.arrayIndex;x++){const S=l.layers[x];zt(S.id)===_&&e.push(new ke(s,r.id,`duplicate layer id "${r.id}", previously used at line ${S.id.__line__}`))}}if("ref"in r){let _;["type","source","source-layer","filter","layout"].forEach(x=>{x in r&&e.push(new ke(s,r[x],`"${x}" is prohibited for ref layers`))}),l.layers.forEach(x=>{zt(x.id)===m&&(_=x)}),_?_.ref?e.push(new ke(s,r.ref,"ref cannot reference another ref layer")):p=zt(_.type):e.push(new ke(s,r.ref,`ref layer "${m}" not found`))}else if(p!=="background")if(r.source){const _=l.sources&&l.sources[r.source],x=_&&zt(_.type);_?x==="vector"&&p==="raster"?e.push(new ke(s,r.source,`layer "${r.id}" requires a raster source`)):x!=="raster-dem"&&p==="hillshade"?e.push(new ke(s,r.source,`layer "${r.id}" requires a raster-dem source`)):x==="raster"&&p!=="raster"?e.push(new ke(s,r.source,`layer "${r.id}" requires a vector source`)):x!=="vector"||r["source-layer"]?x==="raster-dem"&&p!=="hillshade"?e.push(new ke(s,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):p!=="line"||!r.paint||!r.paint["line-gradient"]||x==="geojson"&&_.lineMetrics||e.push(new ke(s,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new ke(s,r,`layer "${r.id}" must specify a "source-layer"`)):e.push(new ke(s,r.source,`source "${r.source}" not found`))}else e.push(new ke(s,r,'missing required property "source"'));return e=e.concat(Ai({key:s,value:r,valueSpec:d.layer,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,objectElementValidators:{"*":()=>[],type:()=>i.validateSpec({key:`${s}.type`,value:r.type,valueSpec:d.layer.type,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,object:r,objectKey:"type"}),filter:Cs,layout:_=>Ai({layer:r,key:_.key,value:_.value,style:_.style,styleSpec:_.styleSpec,validateSpec:_.validateSpec,objectElementValidators:{"*":x=>ba(fr({layerType:p},x))}}),paint:_=>Ai({layer:r,key:_.key,value:_.value,style:_.style,styleSpec:_.styleSpec,validateSpec:_.validateSpec,objectElementValidators:{"*":x=>va(fr({layerType:p},x))}})}})),e}function Lr(i){const e=i.value,r=i.key,s=gt(e);return s!=="string"?[new ke(r,e,`string expected, ${s} found`)]:[]}const Sa={promoteId:function({key:i,value:e}){if(gt(e)==="string")return Lr({key:i,value:e});{const r=[];for(const s in e)r.push(...Lr({key:`${i}.${s}`,value:e[s]}));return r}}};function $l(i){const e=i.value,r=i.key,s=i.styleSpec,l=i.style,d=i.validateSpec;if(!e.type)return[new ke(r,e,'"type" is required')];const p=zt(e.type);let m;switch(p){case"vector":case"raster":return m=Ai({key:r,value:e,valueSpec:s[`source_${p.replace("-","_")}`],style:i.style,styleSpec:s,objectElementValidators:Sa,validateSpec:d}),m;case"raster-dem":return m=function(_){var x;const S=(x=_.sourceName)!==null&&x!==void 0?x:"",I=_.value,A=_.styleSpec,D=A.source_raster_dem,B=_.style;let O=[];const q=gt(I);if(I===void 0)return O;if(q!=="object")return O.push(new ke("source_raster_dem",I,`object expected, ${q} found`)),O;const J=zt(I.encoding)==="custom",ae=["redFactor","greenFactor","blueFactor","baseShift"],Q=_.value.encoding?`"${_.value.encoding}"`:"Default";for(const re in I)!J&&ae.includes(re)?O.push(new ke(re,I[re],`In "${S}": "${re}" is only valid when "encoding" is set to "custom". ${Q} encoding found`)):D[re]?O=O.concat(_.validateSpec({key:re,value:I[re],valueSpec:D[re],validateSpec:_.validateSpec,style:B,styleSpec:A})):O.push(new ke(re,I[re],`unknown property "${re}"`));return O}({sourceName:r,value:e,style:i.style,styleSpec:s,validateSpec:d}),m;case"geojson":if(m=Ai({key:r,value:e,valueSpec:s.source_geojson,style:l,styleSpec:s,validateSpec:d,objectElementValidators:Sa}),e.cluster)for(const _ in e.clusterProperties){const[x,S]=e.clusterProperties[_],I=typeof x=="string"?[x,["accumulated"],["get",_]]:x;m.push(...xn({key:`${r}.${_}.map`,value:S,validateSpec:d,expressionContext:"cluster-map"})),m.push(...xn({key:`${r}.${_}.reduce`,value:I,validateSpec:d,expressionContext:"cluster-reduce"}))}return m;case"video":return Ai({key:r,value:e,valueSpec:s.source_video,style:l,validateSpec:d,styleSpec:s});case"image":return Ai({key:r,value:e,valueSpec:s.source_image,style:l,validateSpec:d,styleSpec:s});case"canvas":return[new ke(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Is({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:l,validateSpec:d,styleSpec:s})}}function Ta(i){const e=i.value,r=i.styleSpec,s=r.light,l=i.style;let d=[];const p=gt(e);if(e===void 0)return d;if(p!=="object")return d=d.concat([new ke("light",e,`object expected, ${p} found`)]),d;for(const m in e){const _=m.match(/^(.*)-transition$/);d=d.concat(_&&s[_[1]]&&s[_[1]].transition?i.validateSpec({key:m,value:e[m],valueSpec:r.transition,validateSpec:i.validateSpec,style:l,styleSpec:r}):s[m]?i.validateSpec({key:m,value:e[m],valueSpec:s[m],validateSpec:i.validateSpec,style:l,styleSpec:r}):[new ke(m,e[m],`unknown property "${m}"`)])}return d}function jl(i){const e=i.value,r=i.styleSpec,s=r.sky,l=i.style,d=gt(e);if(e===void 0)return[];if(d!=="object")return[new ke("sky",e,`object expected, ${d} found`)];let p=[];for(const m in e)p=p.concat(s[m]?i.validateSpec({key:m,value:e[m],valueSpec:s[m],style:l,styleSpec:r}):[new ke(m,e[m],`unknown property "${m}"`)]);return p}function ka(i){const e=i.value,r=i.styleSpec,s=r.terrain,l=i.style;let d=[];const p=gt(e);if(e===void 0)return d;if(p!=="object")return d=d.concat([new ke("terrain",e,`object expected, ${p} found`)]),d;for(const m in e)d=d.concat(s[m]?i.validateSpec({key:m,value:e[m],valueSpec:s[m],validateSpec:i.validateSpec,style:l,styleSpec:r}):[new ke(m,e[m],`unknown property "${m}"`)]);return d}function Ia(i){let e=[];const r=i.value,s=i.key;if(Array.isArray(r)){const l=[],d=[];for(const p in r)r[p].id&&l.includes(r[p].id)&&e.push(new ke(s,r,`all the sprites' ids must be unique, but ${r[p].id} is duplicated`)),l.push(r[p].id),r[p].url&&d.includes(r[p].url)&&e.push(new ke(s,r,`all the sprites' URLs must be unique, but ${r[p].url} is duplicated`)),d.push(r[p].url),e=e.concat(Ai({key:`${s}[${p}]`,value:r[p],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:i.validateSpec}));return e}return Lr({key:s,value:r})}const Ca={"*":()=>[],array:yo,boolean:function(i){const e=i.value,r=i.key,s=gt(e);return s!=="boolean"?[new ke(r,e,`boolean expected, ${s} found`)]:[]},number:ks,color:function(i){const e=i.key,r=i.value,s=gt(r);return s!=="string"?[new ke(e,r,`color expected, ${s} found`)]:bt.parse(String(r))?[]:[new ke(e,r,`color expected, "${r}" found`)]},constants:Nl,enum:Is,filter:Cs,function:ya,layer:wa,object:Ai,source:$l,light:Ta,sky:jl,terrain:ka,projection:function(i){const e=i.value,r=i.styleSpec,s=r.projection,l=i.style,d=gt(e);if(e===void 0)return[];if(d!=="object")return[new ke("projection",e,`object expected, ${d} found`)];let p=[];for(const m in e)p=p.concat(s[m]?i.validateSpec({key:m,value:e[m],valueSpec:s[m],style:l,styleSpec:r}):[new ke(m,e[m],`unknown property "${m}"`)]);return p},string:Lr,formatted:function(i){return Lr(i).length===0?[]:xn(i)},resolvedImage:function(i){return Lr(i).length===0?[]:xn(i)},padding:function(i){const e=i.key,r=i.value;if(gt(r)==="array"){if(r.length<1||r.length>4)return[new ke(e,r,`padding requires 1 to 4 values; ${r.length} values found`)];const s={type:"number"};let l=[];for(let d=0;d<r.length;d++)l=l.concat(i.validateSpec({key:`${e}[${d}]`,value:r[d],validateSpec:i.validateSpec,valueSpec:s}));return l}return ks({key:e,value:r,valueSpec:{}})},variableAnchorOffsetCollection:function(i){const e=i.key,r=i.value,s=gt(r),l=i.styleSpec;if(s!=="array"||r.length<1||r.length%2!=0)return[new ke(e,r,"variableAnchorOffsetCollection requires a non-empty array of even length")];let d=[];for(let p=0;p<r.length;p+=2)d=d.concat(Is({key:`${e}[${p}]`,value:r[p],valueSpec:l.layout_symbol["text-anchor"]})),d=d.concat(yo({key:`${e}[${p+1}]`,value:r[p+1],valueSpec:{length:2,value:"number"},validateSpec:i.validateSpec,style:i.style,styleSpec:l}));return d},sprite:Ia};function Ps(i){const e=i.value,r=i.valueSpec,s=i.styleSpec;return i.validateSpec=Ps,r.expression&&ws(zt(e))?ya(i):r.expression&&Ss(yn(e))?xn(i):r.type&&Ca[r.type]?Ca[r.type](i):Ai(fr({},i,{valueSpec:r.type?s[r.type]:r}))}function Ul(i){const e=i.value,r=i.key,s=Lr(i);return s.length||(e.indexOf("{fontstack}")===-1&&s.push(new ke(r,e,'"glyphs" url must include a "{fontstack}" token')),e.indexOf("{range}")===-1&&s.push(new ke(r,e,'"glyphs" url must include a "{range}" token'))),s}function Ji(i,e=ue){let r=[];return r=r.concat(Ps({key:"",value:i,valueSpec:e.$root,styleSpec:e,style:i,validateSpec:Ps,objectElementValidators:{glyphs:Ul,"*":()=>[]}})),i.constants&&(r=r.concat(Nl({key:"constants",value:i.constants,style:i,styleSpec:e,validateSpec:Ps}))),Ea(r)}function ir(i){return function(e){return i({...e,validateSpec:Ps})}}function Ea(i){return[].concat(i).sort((e,r)=>e.line-r.line)}function rr(i){return function(...e){return Ea(i.apply(this,e))}}Ji.source=rr(ir($l)),Ji.sprite=rr(ir(Ia)),Ji.glyphs=rr(ir(Ul)),Ji.light=rr(ir(Ta)),Ji.sky=rr(ir(jl)),Ji.terrain=rr(ir(ka)),Ji.layer=rr(ir(wa)),Ji.filter=rr(ir(Cs)),Ji.paintProperty=rr(ir(va)),Ji.layoutProperty=rr(ir(ba));const Rr=Ji,th=Rr.light,Pa=Rr.sky,ih=Rr.paintProperty,rh=Rr.layoutProperty;function Aa(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 $n{constructor(e,r,s){const l=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const p=new Int32Array(this.arrayBuffer);e=p[0],this.d=(r=p[1])+2*(s=p[2]);for(let _=0;_<this.d*this.d;_++){const x=p[3+_],S=p[3+_+1];l.push(x===S?null:p.subarray(x,S))}const m=p[3+l.length+1];this.keys=p.subarray(p[3+l.length],m),this.bboxes=p.subarray(m),this.insert=this._insertReadonly}else{this.d=r+2*s;for(let p=0;p<this.d*this.d;p++)l.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=e,this.padding=s,this.scale=r/e,this.uid=0;const d=s/r*e;this.min=-d,this.max=e+d}insert(e,r,s,l,d){this._forEachCell(r,s,l,d,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(d)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,r,s,l,d,p){this.cells[d].push(p)}query(e,r,s,l,d){const p=this.min,m=this.max;if(e<=p&&r<=p&&m<=s&&m<=l&&!d)return Array.prototype.slice.call(this.keys);{const _=[];return this._forEachCell(e,r,s,l,this._queryCell,_,{},d),_}}_queryCell(e,r,s,l,d,p,m,_){const x=this.cells[d];if(x!==null){const S=this.keys,I=this.bboxes;for(let A=0;A<x.length;A++){const D=x[A];if(m[D]===void 0){const B=4*D;(_?_(I[B+0],I[B+1],I[B+2],I[B+3]):e<=I[B+2]&&r<=I[B+3]&&s>=I[B+0]&&l>=I[B+1])?(m[D]=!0,p.push(S[D])):m[D]=!1}}}}_forEachCell(e,r,s,l,d,p,m,_){const x=this._convertToCellCoord(e),S=this._convertToCellCoord(r),I=this._convertToCellCoord(s),A=this._convertToCellCoord(l);for(let D=x;D<=I;D++)for(let B=S;B<=A;B++){const O=this.d*B+D;if((!_||_(this._convertFromCellCoord(D),this._convertFromCellCoord(B),this._convertFromCellCoord(D+1),this._convertFromCellCoord(B+1)))&&d.call(this,e,r,s,l,O,p,m,_))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 p=0;p<this.cells.length;p++)s+=this.cells[p].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 d=r;for(let p=0;p<e.length;p++){const m=e[p];l[3+p]=d,l.set(m,d),d+=m.length}return l[3+e.length]=d,l.set(this.keys,d),d+=this.keys.length,l[3+e.length+1]=d,l.set(this.bboxes,d),d+=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 $n(e.buffer)}}const xr={};function Fe(i,e,r={}){if(xr[i])throw new Error(`${i} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:i,writeable:!1}),xr[i]={klass:e,omit:r.omit||[],shallow:r.shallow||[]}}Fe("Object",Object),Fe("TransferableGridIndex",$n),Fe("Color",bt),Fe("Error",Error),Fe("AJAXError",Oi),Fe("ResolvedImage",ui),Fe("StylePropertyFunction",fo),Fe("StyleExpression",po,{omit:["_evaluator"]}),Fe("ZoomDependentExpression",da),Fe("ZoomConstantExpression",ua),Fe("CompoundExpression",qi,{omit:["_evaluate"]});for(const i in pn)pn[i]._classRegistryKey||Fe(`Expression_${i}`,pn[i]);function ql(i){return i&&typeof ArrayBuffer<"u"&&(i instanceof ArrayBuffer||i.constructor&&i.constructor.name==="ArrayBuffer")}function Ma(i){return i.$name||i.constructor._classRegistryKey}function Zl(i){return!function(e){if(e===null||typeof e!="object")return!1;const r=Ma(e);return!(!r||r==="Object")}(i)&&(i==null||typeof i=="boolean"||typeof i=="number"||typeof i=="string"||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp||i instanceof Blob||i instanceof Error||ql(i)||dr(i)||ArrayBuffer.isView(i)||i instanceof ImageData)}function As(i,e){if(Zl(i))return(ql(i)||dr(i))&&e&&e.push(i),ArrayBuffer.isView(i)&&e&&e.push(i.buffer),i instanceof ImageData&&e&&e.push(i.data.buffer),i;if(Array.isArray(i)){const d=[];for(const p of i)d.push(As(p,e));return d}if(typeof i!="object")throw new Error("can't serialize object of type "+typeof i);const r=Ma(i);if(!r)throw new Error(`can't serialize object of unregistered class ${i.constructor.name}`);if(!xr[r])throw new Error(`${r} is not registered.`);const{klass:s}=xr[r],l=s.serialize?s.serialize(i,e):{};if(s.serialize){if(e&&l===e[e.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const d in i){if(!i.hasOwnProperty(d)||xr[r].omit.indexOf(d)>=0)continue;const p=i[d];l[d]=xr[r].shallow.indexOf(d)>=0?p:As(p,e)}i instanceof Error&&(l.message=i.message)}if(l.$name)throw new Error("$name property is reserved for worker serialization logic.");return r!=="Object"&&(l.$name=r),l}function vr(i){if(Zl(i))return i;if(Array.isArray(i))return i.map(vr);if(typeof i!="object")throw new Error("can't deserialize object of type "+typeof i);const e=Ma(i)||"Object";if(!xr[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:r}=xr[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 d=i[l];s[l]=xr[e].shallow.indexOf(l)>=0?d:vr(d)}return s}class Gl{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 ze={"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 za(i){for(const e of i)if(Da(e.charCodeAt(0)))return!0;return!1}function nh(i){for(const e of i)if(!Hl(e.charCodeAt(0)))return!1;return!0}function Hl(i){return!(ze.Arabic(i)||ze["Arabic Supplement"](i)||ze["Arabic Extended-A"](i)||ze["Arabic Presentation Forms-A"](i)||ze["Arabic Presentation Forms-B"](i))}function Da(i){return!(i!==746&&i!==747&&(i<4352||!(ze["Bopomofo Extended"](i)||ze.Bopomofo(i)||ze["CJK Compatibility Forms"](i)&&!(i>=65097&&i<=65103)||ze["CJK Compatibility Ideographs"](i)||ze["CJK Compatibility"](i)||ze["CJK Radicals Supplement"](i)||ze["CJK Strokes"](i)||!(!ze["CJK Symbols and Punctuation"](i)||i>=12296&&i<=12305||i>=12308&&i<=12319||i===12336)||ze["CJK Unified Ideographs Extension A"](i)||ze["CJK Unified Ideographs"](i)||ze["Enclosed CJK Letters and Months"](i)||ze["Hangul Compatibility Jamo"](i)||ze["Hangul Jamo Extended-A"](i)||ze["Hangul Jamo Extended-B"](i)||ze["Hangul Jamo"](i)||ze["Hangul Syllables"](i)||ze.Hiragana(i)||ze["Ideographic Description Characters"](i)||ze.Kanbun(i)||ze["Kangxi Radicals"](i)||ze["Katakana Phonetic Extensions"](i)||ze.Katakana(i)&&i!==12540||!(!ze["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)||!(!ze["Small Form Variants"](i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||ze["Unified Canadian Aboriginal Syllabics"](i)||ze["Unified Canadian Aboriginal Syllabics Extended"](i)||ze["Vertical Forms"](i)||ze["Yijing Hexagram Symbols"](i)||ze["Yi Syllables"](i)||ze["Yi Radicals"](i))))}function Xl(i){return!(Da(i)||function(e){return!!(ze["Latin-1 Supplement"](e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||ze["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)||ze["Letterlike Symbols"](e)||ze["Number Forms"](e)||ze["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)||ze["Control Pictures"](e)&&e!==9251||ze["Optical Character Recognition"](e)||ze["Enclosed Alphanumerics"](e)||ze["Geometric Shapes"](e)||ze["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||ze["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||ze["CJK Symbols and Punctuation"](e)||ze.Katakana(e)||ze["Private Use Area"](e)||ze["CJK Compatibility Forms"](e)||ze["Small Form Variants"](e)||ze["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 Kr(i){return i>=1424&&i<=2303||ze["Arabic Presentation Forms-A"](i)||ze["Arabic Presentation Forms-B"](i)}function Wl(i,e){return!(!e&&Kr(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||ze.Khmer(i))}function La(i){for(const e of i)if(Kr(e.charCodeAt(0)))return!0;return!1}const Yr=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null}setState(i){this.pluginStatus=i.pluginStatus,this.pluginURL=i.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(i){this.applyArabicShaping=i.applyArabicShaping,this.processBidirectionalText=i.processBidirectionalText,this.processStyledBidirectionalText=i.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class 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 Gl,this.transition={})}isSupportedScript(e){return function(r,s){for(const l of r)if(!Wl(l.charCodeAt(0),s))return!1;return!0}(e,Yr.getRTLTextPluginStatus()==="loaded")}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 xo{constructor(e,r){this.property=e,this.value=r,this.expression=function(s,l){if(ws(s))return new fo(s,l);if(Ss(s)){const d=Vl(s,l);if(d.result==="error")throw new Error(d.value.map(p=>`${p.key}: ${p.message}`).join(", "));return d.value}{let d=s;return l.type==="color"&&typeof s=="string"?d=bt.parse(s):l.type!=="padding"||typeof s!="number"&&!Array.isArray(s)?l.type==="variableAnchorOffsetCollection"&&Array.isArray(s)&&(d=$i.parse(s)):d=Ni.parse(s),{kind:"constant",evaluate:()=>d}}}(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 jn{constructor(e){this.property=e,this.value=new xo(e,void 0)}transitioned(e,r){return new Jl(this.property,this.value,r,$t({},e.transition,this.transition),e.now)}untransitioned(){return new Jl(this.property,this.value,null,{},0)}}class Un{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return St(this._values[e].value.value)}setValue(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new jn(this._values[e].property)),this._values[e].value=new xo(this._values[e].property,r===null?void 0:St(r))}getTransition(e){return St(this._values[e].transition)}setTransition(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new jn(this._values[e].property)),this._values[e].transition=St(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 Ra(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 Ra(this._properties);for(const r of Object.keys(this._values))e._values[r]=this._values[r].untransitioned();return e}}class Jl{constructor(e,r,s,l,d){this.property=e,this.value=r,this.begin=d+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,d=this.value.possiblyEvaluate(e,r,s),p=this.prior;if(p){if(l>this.end)return this.prior=null,d;if(this.value.isDataDriven())return this.prior=null,d;if(l<this.begin)return p.possiblyEvaluate(e,r,s);{const m=(l-this.begin)/(this.end-this.begin);return this.property.interpolate(p.possiblyEvaluate(e,r,s),d,function(_){if(_<=0)return 0;if(_>=1)return 1;const x=_*_,S=x*_;return 4*(_<.5?S:3*(_-x)+S-.75)}(m))}}return d}}class Ra{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,r,s){const l=new vo(this._properties);for(const d of Object.keys(this._values))l._values[d]=this._values[d].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 Ms{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}hasValue(e){return this._values[e].value!==void 0}getValue(e){return St(this._values[e].value)}setValue(e,r){this._values[e]=new xo(this._values[e].property,r===null?void 0:St(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 vo(this._properties);for(const d of Object.keys(this._values))l._values[d]=this._values[d].possiblyEvaluate(e,r,s);return l}}class br{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 vo{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class qe{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=ji[this.specification.type];return l?l(e,r,s):e}}class Je{constructor(e,r){this.specification=e,this.overrides=r}possiblyEvaluate(e,r,s,l){return new br(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 br(this,{kind:"constant",value:void 0},e.parameters);const l=ji[this.specification.type];if(l){const d=l(e.value.value,r.value.value,s);return new br(this,{kind:"constant",value:d},e.parameters)}return e}evaluate(e,r,s,l,d,p){return e.kind==="constant"?e.value:e.evaluate(r,s,l,d,p)}}class u extends Je{possiblyEvaluate(e,r,s,l){if(e.value===void 0)return new br(this,{kind:"constant",value:void 0},r);if(e.expression.kind==="constant"){const d=e.expression.evaluate(r,null,{},s,l),p=e.property.specification.type==="resolvedImage"&&typeof d!="string"?d.name:d,m=this._calculate(p,p,p,r);return new br(this,{kind:"constant",value:m},r)}if(e.expression.kind==="camera"){const d=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 br(this,{kind:"constant",value:d},r)}return new br(this,e.expression,r)}evaluate(e,r,s,l,d,p){if(e.kind==="source"){const m=e.evaluate(r,s,l,d,p);return this._calculate(m,m,m,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 t{constructor(e){this.specification=e}possiblyEvaluate(e,r,s,l){if(e.value!==void 0){if(e.expression.kind==="constant"){const d=e.expression.evaluate(r,null,{},s,l);return this._calculate(d,d,d,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 n{constructor(e){this.specification=e}possiblyEvaluate(e,r,s,l){return!!e.expression.evaluate(r,null,{},s,l)}interpolate(){return!1}}class o{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 xo(s,void 0),d=this.defaultTransitionablePropertyValues[r]=new jn(s);this.defaultTransitioningPropertyValues[r]=d.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=l.possiblyEvaluate({})}}}Fe("DataDrivenProperty",Je),Fe("DataConstantProperty",qe),Fe("CrossFadedDataDrivenProperty",u),Fe("CrossFadedProperty",t),Fe("ColorRampProperty",n);const a="-transition";class h extends Mn{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 Ms(r.layout)),r.paint)){this._transitionablePaint=new Un(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 vo(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(rh,`layers.${this.id}.layout.${e}`,e,r,s)||(e!=="visibility"?this._unevaluatedLayout.setValue(e,r):this.visibility=r)}getPaintProperty(e){return e.endsWith(a)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,r,s={}){if(r!=null&&this._validate(ih,`layers.${this.id}.paint.${e}`,e,r,s))return!1;if(e.endsWith(a))return this._transitionablePaint.setTransition(e.slice(0,-11),r||void 0),!1;{const l=this._transitionablePaint._values[e],d=l.property.specification["property-type"]==="cross-faded-data-driven",p=l.value.isDataDriven(),m=l.value;this._transitionablePaint.setValue(e,r),this._handleSpecialPaintPropertyUpdate(e);const _=this._transitionablePaint._values[e].value;return _.isDataDriven()||p||d||this._handleOverridablePaintPropertyUpdate(e,m,_)}}_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),Nr(e,(r,s)=>!(r===void 0||s==="layout"&&!Object.keys(r).length||s==="paint"&&!Object.keys(r).length))}_validate(e,r,s,l,d={}){return(!d||d.validate!==!1)&&Aa(this,e.call(Rr,{key:r,layerType:this.type,objectKey:s,value:l,styleSpec:ue,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 br&&mn(r.property.specification)&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}}const g={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class y{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 b{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 w(i,e=1){let r=0,s=0;return{members:i.map(l=>{const d=g[l.type].BYTES_PER_ELEMENT,p=r=C(r,Math.max(e,d)),m=l.components||1;return s=Math.max(s,d),r+=d*m,{name:l.name,type:l.type,components:m,offset:p}}),size:C(r,Math.max(s,e)),alignment:e}}function C(i,e){return Math.ceil(i/e)*e}class E extends b{_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}}E.prototype.bytesPerElement=4,Fe("StructArrayLayout2i4",E);class R extends b{_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 d=3*e;return this.int16[d+0]=r,this.int16[d+1]=s,this.int16[d+2]=l,e}}R.prototype.bytesPerElement=6,Fe("StructArrayLayout3i6",R);class F extends b{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l){const d=this.length;return this.resize(d+1),this.emplace(d,e,r,s,l)}emplace(e,r,s,l,d){const p=4*e;return this.int16[p+0]=r,this.int16[p+1]=s,this.int16[p+2]=l,this.int16[p+3]=d,e}}F.prototype.bytesPerElement=8,Fe("StructArrayLayout4i8",F);class $ extends b{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,d,p){const m=this.length;return this.resize(m+1),this.emplace(m,e,r,s,l,d,p)}emplace(e,r,s,l,d,p,m){const _=6*e;return this.int16[_+0]=r,this.int16[_+1]=s,this.int16[_+2]=l,this.int16[_+3]=d,this.int16[_+4]=p,this.int16[_+5]=m,e}}$.prototype.bytesPerElement=12,Fe("StructArrayLayout2i4i12",$);class H extends b{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,d,p){const m=this.length;return this.resize(m+1),this.emplace(m,e,r,s,l,d,p)}emplace(e,r,s,l,d,p,m){const _=4*e,x=8*e;return this.int16[_+0]=r,this.int16[_+1]=s,this.uint8[x+4]=l,this.uint8[x+5]=d,this.uint8[x+6]=p,this.uint8[x+7]=m,e}}H.prototype.bytesPerElement=8,Fe("StructArrayLayout2i4ub8",H);class U extends b{_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}}U.prototype.bytesPerElement=8,Fe("StructArrayLayout2f8",U);class W extends b{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,d,p,m,_,x,S){const I=this.length;return this.resize(I+1),this.emplace(I,e,r,s,l,d,p,m,_,x,S)}emplace(e,r,s,l,d,p,m,_,x,S,I){const A=10*e;return this.uint16[A+0]=r,this.uint16[A+1]=s,this.uint16[A+2]=l,this.uint16[A+3]=d,this.uint16[A+4]=p,this.uint16[A+5]=m,this.uint16[A+6]=_,this.uint16[A+7]=x,this.uint16[A+8]=S,this.uint16[A+9]=I,e}}W.prototype.bytesPerElement=20,Fe("StructArrayLayout10ui20",W);class Y extends b{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,d,p,m,_,x,S,I,A){const D=this.length;return this.resize(D+1),this.emplace(D,e,r,s,l,d,p,m,_,x,S,I,A)}emplace(e,r,s,l,d,p,m,_,x,S,I,A,D){const B=12*e;return this.int16[B+0]=r,this.int16[B+1]=s,this.int16[B+2]=l,this.int16[B+3]=d,this.uint16[B+4]=p,this.uint16[B+5]=m,this.uint16[B+6]=_,this.uint16[B+7]=x,this.int16[B+8]=S,this.int16[B+9]=I,this.int16[B+10]=A,this.int16[B+11]=D,e}}Y.prototype.bytesPerElement=24,Fe("StructArrayLayout4i4ui4i24",Y);class j extends b{_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 d=3*e;return this.float32[d+0]=r,this.float32[d+1]=s,this.float32[d+2]=l,e}}j.prototype.bytesPerElement=12,Fe("StructArrayLayout3f12",j);class te extends b{_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}}te.prototype.bytesPerElement=4,Fe("StructArrayLayout1ul4",te);class se extends b{_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,d,p,m,_,x){const S=this.length;return this.resize(S+1),this.emplace(S,e,r,s,l,d,p,m,_,x)}emplace(e,r,s,l,d,p,m,_,x,S){const I=10*e,A=5*e;return this.int16[I+0]=r,this.int16[I+1]=s,this.int16[I+2]=l,this.int16[I+3]=d,this.int16[I+4]=p,this.int16[I+5]=m,this.uint32[A+3]=_,this.uint16[I+8]=x,this.uint16[I+9]=S,e}}se.prototype.bytesPerElement=20,Fe("StructArrayLayout6i1ul2ui20",se);class ce extends b{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,d,p){const m=this.length;return this.resize(m+1),this.emplace(m,e,r,s,l,d,p)}emplace(e,r,s,l,d,p,m){const _=6*e;return this.int16[_+0]=r,this.int16[_+1]=s,this.int16[_+2]=l,this.int16[_+3]=d,this.int16[_+4]=p,this.int16[_+5]=m,e}}ce.prototype.bytesPerElement=12,Fe("StructArrayLayout2i2i2i12",ce);class ye extends b{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,d){const p=this.length;return this.resize(p+1),this.emplace(p,e,r,s,l,d)}emplace(e,r,s,l,d,p){const m=4*e,_=8*e;return this.float32[m+0]=r,this.float32[m+1]=s,this.float32[m+2]=l,this.int16[_+6]=d,this.int16[_+7]=p,e}}ye.prototype.bytesPerElement=16,Fe("StructArrayLayout2f1f2i16",ye);class we extends b{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,d,p){const m=this.length;return this.resize(m+1),this.emplace(m,e,r,s,l,d,p)}emplace(e,r,s,l,d,p,m){const _=16*e,x=4*e,S=8*e;return this.uint8[_+0]=r,this.uint8[_+1]=s,this.float32[x+1]=l,this.float32[x+2]=d,this.int16[S+6]=p,this.int16[S+7]=m,e}}we.prototype.bytesPerElement=16,Fe("StructArrayLayout2ub2f2i16",we);class De extends b{_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 d=3*e;return this.uint16[d+0]=r,this.uint16[d+1]=s,this.uint16[d+2]=l,e}}De.prototype.bytesPerElement=6,Fe("StructArrayLayout3ui6",De);class Re extends b{_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,d,p,m,_,x,S,I,A,D,B,O,q,J){const ae=this.length;return this.resize(ae+1),this.emplace(ae,e,r,s,l,d,p,m,_,x,S,I,A,D,B,O,q,J)}emplace(e,r,s,l,d,p,m,_,x,S,I,A,D,B,O,q,J,ae){const Q=24*e,re=12*e,de=48*e;return this.int16[Q+0]=r,this.int16[Q+1]=s,this.uint16[Q+2]=l,this.uint16[Q+3]=d,this.uint32[re+2]=p,this.uint32[re+3]=m,this.uint32[re+4]=_,this.uint16[Q+10]=x,this.uint16[Q+11]=S,this.uint16[Q+12]=I,this.float32[re+7]=A,this.float32[re+8]=D,this.uint8[de+36]=B,this.uint8[de+37]=O,this.uint8[de+38]=q,this.uint32[re+10]=J,this.int16[Q+22]=ae,e}}Re.prototype.bytesPerElement=48,Fe("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Re);class Se extends b{_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,d,p,m,_,x,S,I,A,D,B,O,q,J,ae,Q,re,de,be,Le,We,Me,Pe,Ue,Ve){const Be=this.length;return this.resize(Be+1),this.emplace(Be,e,r,s,l,d,p,m,_,x,S,I,A,D,B,O,q,J,ae,Q,re,de,be,Le,We,Me,Pe,Ue,Ve)}emplace(e,r,s,l,d,p,m,_,x,S,I,A,D,B,O,q,J,ae,Q,re,de,be,Le,We,Me,Pe,Ue,Ve,Be){const _e=32*e,Ze=16*e;return this.int16[_e+0]=r,this.int16[_e+1]=s,this.int16[_e+2]=l,this.int16[_e+3]=d,this.int16[_e+4]=p,this.int16[_e+5]=m,this.int16[_e+6]=_,this.int16[_e+7]=x,this.uint16[_e+8]=S,this.uint16[_e+9]=I,this.uint16[_e+10]=A,this.uint16[_e+11]=D,this.uint16[_e+12]=B,this.uint16[_e+13]=O,this.uint16[_e+14]=q,this.uint16[_e+15]=J,this.uint16[_e+16]=ae,this.uint16[_e+17]=Q,this.uint16[_e+18]=re,this.uint16[_e+19]=de,this.uint16[_e+20]=be,this.uint16[_e+21]=Le,this.uint16[_e+22]=We,this.uint32[Ze+12]=Me,this.float32[Ze+13]=Pe,this.float32[Ze+14]=Ue,this.uint16[_e+30]=Ve,this.uint16[_e+31]=Be,e}}Se.prototype.bytesPerElement=64,Fe("StructArrayLayout8i15ui1ul2f2ui64",Se);class Te extends b{_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}}Te.prototype.bytesPerElement=4,Fe("StructArrayLayout1f4",Te);class Ne extends b{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(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 d=3*e;return this.uint16[6*e+0]=r,this.float32[d+1]=s,this.float32[d+2]=l,e}}Ne.prototype.bytesPerElement=12,Fe("StructArrayLayout1ui2f12",Ne);class tt extends b{_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 d=4*e;return this.uint32[2*e+0]=r,this.uint16[d+2]=s,this.uint16[d+3]=l,e}}tt.prototype.bytesPerElement=8,Fe("StructArrayLayout1ul2ui8",tt);class Ce extends b{_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}}Ce.prototype.bytesPerElement=4,Fe("StructArrayLayout2ui4",Ce);class Ae extends b{_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}}Ae.prototype.bytesPerElement=2,Fe("StructArrayLayout1ui2",Ae);class Qe extends b{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,s,l){const d=this.length;return this.resize(d+1),this.emplace(d,e,r,s,l)}emplace(e,r,s,l,d){const p=4*e;return this.float32[p+0]=r,this.float32[p+1]=s,this.float32[p+2]=l,this.float32[p+3]=d,e}}Qe.prototype.bytesPerElement=16,Fe("StructArrayLayout4f16",Qe);class Dt extends y{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 le(this.anchorPointX,this.anchorPointY)}}Dt.prototype.size=20;class ot extends se{get(e){return new Dt(this,e)}}Fe("CollisionBoxArray",ot);class dt extends y{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]}}dt.prototype.size=48;class Lt extends Re{get(e){return new dt(this,e)}}Fe("PlacedSymbolArray",Lt);class di extends y{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 collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}di.prototype.size=64;class nr extends Se{get(e){return new di(this,e)}}Fe("SymbolInstanceArray",nr);class Rt extends Te{getoffsetX(e){return this.float32[1*e+0]}}Fe("GlyphOffsetArray",Rt);class Mi extends R{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}Fe("SymbolLineVertexArray",Mi);class ki extends y{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}}ki.prototype.size=12;class pi extends Ne{get(e){return new ki(this,e)}}Fe("TextAnchorOffsetArray",pi);class fi extends y{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]}}fi.prototype.size=8;class sr extends tt{get(e){return new fi(this,e)}}Fe("FeatureIndexArray",sr);class vn extends E{}class bo extends E{}class qn extends E{}class bn extends ${}class wo extends H{}class Ba extends U{}class oi extends W{}class or extends Y{}class Qr extends j{}class Zn extends te{}class mi extends ce{}class gi extends we{}class ri extends De{}class Nt extends Ce{}const Gn=w([{name:"a_pos",components:2,type:"Int16"}],4),{members:Fa}=Gn;class ti{constructor(e=[]){this.segments=e}prepareSegment(e,r,s,l){let d=this.segments[this.segments.length-1];return e>ti.MAX_VERTEX_ARRAY_LENGTH&&li(`Max vertices per segment is ${ti.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!d||d.vertexLength+e>ti.MAX_VERTEX_ARRAY_LENGTH||d.sortKey!==l)&&(d={vertexOffset:r.length,primitiveOffset:s.length,vertexLength:0,primitiveLength:0},l!==void 0&&(d.sortKey=l),this.segments.push(d)),d}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 ti([{vertexOffset:e,primitiveOffset:r,vertexLength:s,primitiveLength:l,vaos:{},sortKey:0}])}}function Kl(i,e){return 256*(i=wt(Math.floor(i),0,255))+wt(Math.floor(e),0,255)}ti.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Fe("SegmentVector",ti);const So=w([{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 To={exports:{}},en={exports:{}};en.exports=function(i,e){var r,s,l,d,p,m,_,x;for(s=i.length-(r=3&i.length),l=e,p=3432918353,m=461845907,x=0;x<s;)_=255&i.charCodeAt(x)|(255&i.charCodeAt(++x))<<8|(255&i.charCodeAt(++x))<<16|(255&i.charCodeAt(++x))<<24,++x,l=27492+(65535&(d=5*(65535&(l=(l^=_=(65535&(_=(_=(65535&_)*p+(((_>>>16)*p&65535)<<16)&4294967295)<<15|_>>>17))*m+(((_>>>16)*m&65535)<<16)&4294967295)<<13|l>>>19))+((5*(l>>>16)&65535)<<16)&4294967295))+((58964+(d>>>16)&65535)<<16);switch(_=0,r){case 3:_^=(255&i.charCodeAt(x+2))<<16;case 2:_^=(255&i.charCodeAt(x+1))<<8;case 1:l^=_=(65535&(_=(_=(65535&(_^=255&i.charCodeAt(x)))*p+(((_>>>16)*p&65535)<<16)&4294967295)<<15|_>>>17))*m+(((_>>>16)*m&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 Yl=en.exports,Oa={exports:{}};Oa.exports=function(i,e){for(var r,s=i.length,l=e^s,d=0;s>=4;)r=1540483477*(65535&(r=255&i.charCodeAt(d)|(255&i.charCodeAt(++d))<<8|(255&i.charCodeAt(++d))<<16|(255&i.charCodeAt(++d))<<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,++d;switch(s){case 3:l^=(255&i.charCodeAt(d+2))<<16;case 2:l^=(255&i.charCodeAt(d+1))<<8;case 1:l=1540483477*(65535&(l^=255&i.charCodeAt(d)))+((1540483477*(l>>>16)&65535)<<16)}return l=1540483477*(65535&(l^=l>>>13))+((1540483477*(l>>>16)&65535)<<16),(l^=l>>>15)>>>0};var Va=Yl,Na=Oa.exports;To.exports=Va,To.exports.murmur3=Va,To.exports.murmur2=Na;var ko=fe(To.exports);class Hn{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,s,l){this.ids.push(Hu(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=Hu(e);let s=0,l=this.ids.length-1;for(;s<l;){const p=s+l>>1;this.ids[p]>=r?l=p:s=p+1}const d=[];for(;this.ids[s]===r;)d.push({index:this.positions[3*s],start:this.positions[3*s+1],end:this.positions[3*s+2]}),s++;return d}static serialize(e,r){const s=new Float64Array(e.ids),l=new Uint32Array(e.positions);return sh(s,l,0,s.length-1),r&&r.push(s.buffer,l.buffer),{ids:s,positions:l}}static deserialize(e){const r=new Hn;return r.ids=e.ids,r.positions=e.positions,r.indexed=!0,r}}function Hu(i){const e=+i;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:ko(String(i))}function sh(i,e,r,s){for(;r<s;){const l=i[r+s>>1];let d=r-1,p=s+1;for(;;){do d++;while(i[d]<l);do p--;while(i[p]>l);if(d>=p)break;Ql(i,d,p),Ql(e,3*d,3*p),Ql(e,3*d+1,3*p+1),Ql(e,3*d+2,3*p+2)}p-r<s-p?(sh(i,e,r,p),r=p+1):(sh(i,e,p+1,s),s=p)}}function Ql(i,e,r){const s=i[e];i[e]=i[r],i[r]=s}Fe("FeaturePositionMap",Hn);class zs{constructor(e,r){this.gl=e.gl,this.location=r}}class ec extends zs{constructor(e,r){super(e,r),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}}class Xu extends zs{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 Wu extends zs{constructor(e,r){super(e,r),this.current=bt.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 w_=new Float32Array(16);function oh(i){return[Kl(255*i.r,255*i.g),Kl(255*i.b,255*i.a)]}class $a{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 Wu(e,r):new ec(e,r)}}class Io{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 d=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;d&&e.set(d)}getBinding(e,r,s){return s.substr(0,9)==="u_pattern"?new Xu(e,r):new ec(e,r)}}class wn{constructor(e,r,s,l){this.expression=e,this.type=s,this.maxValue=0,this.paintVertexAttributes=r.map(d=>({name:`a_${d}`,type:"Float32",components:s==="color"?2:1,offset:0})),this.paintVertexArray=new l}populatePaintArray(e,r,s,l,d){const p=this.paintVertexArray.length,m=this.expression.evaluate(new Pt(0),r,{},l,[],d);this.paintVertexArray.resize(e),this._setPaintValue(p,e,m)}updatePaintArray(e,r,s,l){const d=this.expression.evaluate({zoom:0},s,l);this._setPaintValue(e,r,d)}_setPaintValue(e,r,s){if(this.type==="color"){const l=oh(s);for(let d=e;d<r;d++)this.paintVertexArray.emplace(d,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 Br{constructor(e,r,s,l,d,p){this.expression=e,this.uniformNames=r.map(m=>`u_${m}_t`),this.type=s,this.useIntegerZoom=l,this.zoom=d,this.maxValue=0,this.paintVertexAttributes=r.map(m=>({name:`a_${m}`,type:"Float32",components:s==="color"?4:2,offset:0})),this.paintVertexArray=new p}populatePaintArray(e,r,s,l,d){const p=this.expression.evaluate(new Pt(this.zoom),r,{},l,[],d),m=this.expression.evaluate(new Pt(this.zoom+1),r,{},l,[],d),_=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(_,e,p,m)}updatePaintArray(e,r,s,l){const d=this.expression.evaluate({zoom:this.zoom},s,l),p=this.expression.evaluate({zoom:this.zoom+1},s,l);this._setPaintValue(e,r,d,p)}_setPaintValue(e,r,s,l){if(this.type==="color"){const d=oh(s),p=oh(l);for(let m=e;m<r;m++)this.paintVertexArray.emplace(m,d[0],d[1],p[0],p[1])}else{for(let d=e;d<r;d++)this.paintVertexArray.emplace(d,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=wt(this.expression.interpolationFactor(s,this.zoom,this.zoom+1),0,1);e.set(l)}getBinding(e,r,s){return new ec(e,r)}}class Xn{constructor(e,r,s,l,d,p){this.expression=e,this.type=r,this.useIntegerZoom=s,this.zoom=l,this.layerId=p,this.zoomInPaintVertexArray=new d,this.zoomOutPaintVertexArray=new d}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,d){this._setPaintValues(e,r,s.patterns&&s.patterns[this.layerId],d)}_setPaintValues(e,r,s,l){if(!l||!s)return;const{min:d,mid:p,max:m}=s,_=l[d],x=l[p],S=l[m];if(_&&x&&S)for(let I=e;I<r;I++)this.zoomInPaintVertexArray.emplace(I,x.tl[0],x.tl[1],x.br[0],x.br[1],_.tl[0],_.tl[1],_.br[0],_.br[1],x.pixelRatio,_.pixelRatio),this.zoomOutPaintVertexArray.emplace(I,x.tl[0],x.tl[1],x.br[0],x.br[1],S.tl[0],S.tl[1],S.br[0],S.br[1],x.pixelRatio,S.pixelRatio)}upload(e){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,So.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,So.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class Ju{constructor(e,r,s){this.binders={},this._buffers=[];const l=[];for(const d in e.paint._values){if(!s(d))continue;const p=e.paint.get(d);if(!(p instanceof br&&mn(p.property.specification)))continue;const m=S_(d,e.type),_=p.value,x=p.property.specification.type,S=p.property.useIntegerZoom,I=p.property.specification["property-type"],A=I==="cross-faded"||I==="cross-faded-data-driven";if(_.kind==="constant")this.binders[d]=A?new Io(_.value,m):new $a(_.value,m,x),l.push(`/u_${d}`);else if(_.kind==="source"||A){const D=Ku(d,x,"source");this.binders[d]=A?new Xn(_,x,S,r,D,e.id):new wn(_,m,x,D),l.push(`/a_${d}`)}else{const D=Ku(d,x,"composite");this.binders[d]=new Br(_,m,x,S,r,D),l.push(`/z_${d}`)}}this.cacheKey=l.sort().join("")}getMaxValue(e){const r=this.binders[e];return r instanceof wn||r instanceof Br?r.maxValue:0}populatePaintArrays(e,r,s,l,d){for(const p in this.binders){const m=this.binders[p];(m instanceof wn||m instanceof Br||m instanceof Xn)&&m.populatePaintArray(e,r,s,l,d)}}setConstantPatternPositions(e,r){for(const s in this.binders){const l=this.binders[s];l instanceof Io&&l.setConstantPatternPositions(e,r)}}updatePaintArrays(e,r,s,l,d){let p=!1;for(const m in e){const _=r.getPositions(m);for(const x of _){const S=s.feature(x.index);for(const I in this.binders){const A=this.binders[I];if((A instanceof wn||A instanceof Br||A instanceof Xn)&&A.expression.isStateDependent===!0){const D=l.paint.get(I);A.expression=D.value,A.updatePaintArray(x.start,x.end,S,e[m],d),p=!0}}}}return p}defines(){const e=[];for(const r in this.binders){const s=this.binders[r];(s instanceof $a||s instanceof Io)&&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 wn||s instanceof Br)for(let l=0;l<s.paintVertexAttributes.length;l++)e.push(s.paintVertexAttributes[l].name);else if(s instanceof Xn)for(let l=0;l<So.members.length;l++)e.push(So.members[l].name)}return e}getBinderUniforms(){const e=[];for(const r in this.binders){const s=this.binders[r];if(s instanceof $a||s instanceof Io||s instanceof Br)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 d=this.binders[l];if(d instanceof $a||d instanceof Io||d instanceof Br){for(const p of d.uniformNames)if(r[p]){const m=d.getBinding(e,r[p],p);s.push({name:p,property:l,binding:m})}}}return s}setUniforms(e,r,s,l){for(const{name:d,property:p,binding:m}of r)this.binders[p].setUniform(m,l,s.get(p),d)}updatePaintBuffers(e){this._buffers=[];for(const r in this.binders){const s=this.binders[r];if(e&&s instanceof Xn){const l=e.fromScale===2?s.zoomInPaintVertexBuffer:s.zoomOutPaintVertexBuffer;l&&this._buffers.push(l)}else(s instanceof wn||s instanceof Br)&&s.paintVertexBuffer&&this._buffers.push(s.paintVertexBuffer)}}upload(e){for(const r in this.binders){const s=this.binders[r];(s instanceof wn||s instanceof Br||s instanceof Xn)&&s.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const r=this.binders[e];(r instanceof wn||r instanceof Br||r instanceof Xn)&&r.destroy()}}}class Ds{constructor(e,r,s=()=>!0){this.programConfigurations={};for(const l of e)this.programConfigurations[l.id]=new Ju(l,r,s);this.needsUpload=!1,this._featureMap=new Hn,this._bufferOffset=0}populatePaintArrays(e,r,s,l,d,p){for(const m in this.programConfigurations)this.programConfigurations[m].populatePaintArrays(e,r,l,d,p);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 d of s)this.needsUpload=this.programConfigurations[d.id].updatePaintArrays(e,this._featureMap,r,d,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 S_(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 Ku(i,e,r){const s={color:{source:U,composite:Qe},number:{source:Te,composite:U}},l=function(d){return{"line-pattern":{source:oi,composite:oi},"fill-pattern":{source:oi,composite:oi},"fill-extrusion-pattern":{source:oi,composite:oi}}[d]}(i);return l&&l[r]||s[e][r]}Fe("ConstantBinder",$a),Fe("CrossFadedConstantBinder",Io),Fe("SourceExpressionBinder",wn),Fe("CrossFadedCompositeBinder",Xn),Fe("CompositeExpressionBinder",Br),Fe("ProgramConfiguration",Ju,{omit:["_buffers"]}),Fe("ProgramConfigurationSet",Ds);const Qt=8192,ah=Math.pow(2,14)-1,Yu=-ah-1;function Ls(i){const e=Qt/i.extent,r=i.loadGeometry();for(let s=0;s<r.length;s++){const l=r[s];for(let d=0;d<l.length;d++){const p=l[d],m=Math.round(p.x*e),_=Math.round(p.y*e);p.x=wt(m,Yu,ah),p.y=wt(_,Yu,ah),(m<p.x||m>p.x+1||_<p.y||_>p.y+1)&&li("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function Rs(i,e){return{type:i.type,id:i.id,properties:i.properties,geometry:e?Ls(i):[]}}function tc(i,e,r,s,l){i.emplaceBack(2*e+(s+1)/2,2*r+(l+1)/2)}class lh{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 bo,this.indexArray=new ri,this.segments=new ti,this.programConfigurations=new Ds(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],d=[];let p=null,m=!1;l.type==="circle"&&(p=l.layout.get("circle-sort-key"),m=!p.isConstant());for(const{feature:_,id:x,index:S,sourceLayerIndex:I}of e){const A=this.layers[0]._featureFilter.needGeometry,D=Rs(_,A);if(!this.layers[0]._featureFilter.filter(new Pt(this.zoom),D,s))continue;const B=m?p.evaluate(D,{},s):void 0,O={id:x,properties:_.properties,type:_.type,sourceLayerIndex:I,index:S,geometry:A?D.geometry:Ls(_),patterns:{},sortKey:B};d.push(O)}m&&d.sort((_,x)=>_.sortKey-x.sortKey);for(const _ of d){const{geometry:x,index:S,sourceLayerIndex:I}=_,A=e[S].feature;this.addFeature(_,x,S,s),r.featureIndex.insert(A,x,S,I,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,Fa),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 d of r)for(const p of d){const m=p.x,_=p.y;if(m<0||m>=Qt||_<0||_>=Qt)continue;const x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),S=x.vertexLength;tc(this.layoutVertexArray,m,_,-1,-1),tc(this.layoutVertexArray,m,_,1,-1),tc(this.layoutVertexArray,m,_,1,1),tc(this.layoutVertexArray,m,_,-1,1),this.indexArray.emplaceBack(S,S+1,S+2),this.indexArray.emplaceBack(S,S+3,S+2),x.vertexLength+=4,x.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,{},l)}}function Qu(i,e){for(let r=0;r<i.length;r++)if(Co(e,i[r]))return!0;for(let r=0;r<e.length;r++)if(Co(i,e[r]))return!0;return!!ch(i,e)}function T_(i,e,r){return!!Co(i,e)||!!hh(e,i,r)}function ed(i,e){if(i.length===1)return id(e,i[0]);for(let r=0;r<e.length;r++){const s=e[r];for(let l=0;l<s.length;l++)if(Co(i,s[l]))return!0}for(let r=0;r<i.length;r++)if(id(e,i[r]))return!0;for(let r=0;r<e.length;r++)if(ch(i,e[r]))return!0;return!1}function k_(i,e,r){if(i.length>1){if(ch(i,e))return!0;for(let s=0;s<e.length;s++)if(hh(e[s],i,r))return!0}for(let s=0;s<i.length;s++)if(hh(i[s],e,r))return!0;return!1}function ch(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 d=0;d<e.length-1;d++)if(I_(s,l,e[d],e[d+1]))return!0}return!1}function I_(i,e,r,s){return wi(i,r,s)!==wi(e,r,s)&&wi(i,e,r)!==wi(i,e,s)}function hh(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(td(i,e[l-1],e[l])<s)return!0;return!1}function td(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 id(i,e){let r,s,l,d=!1;for(let p=0;p<i.length;p++){r=i[p];for(let m=0,_=r.length-1;m<r.length;_=m++)s=r[m],l=r[_],s.y>e.y!=l.y>e.y&&e.x<(l.x-s.x)*(e.y-s.y)/(l.y-s.y)+s.x&&(d=!d)}return d}function Co(i,e){let r=!1;for(let s=0,l=i.length-1;s<i.length;l=s++){const d=i[s],p=i[l];d.y>e.y!=p.y>e.y&&e.x<(p.x-d.x)*(e.y-d.y)/(p.y-d.y)+d.x&&(r=!r)}return r}function C_(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 d=wi(i,e,r[0]);return d!==wi(i,e,r[1])||d!==wi(i,e,r[2])||d!==wi(i,e,r[3])}function ja(i,e,r){const s=e.paint.get(i).value;return s.kind==="constant"?s.value:r.programConfigurations.get(e.id).getMaxValue(i)}function ic(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function rc(i,e,r,s,l){if(!e[0]&&!e[1])return i;const d=le.convert(e)._mult(l);r==="viewport"&&d._rotate(-s);const p=[];for(let m=0;m<i.length;m++)p.push(i[m].sub(d));return p}let rd,nd;Fe("CircleBucket",lh,{omit:["layers"]});var E_={get paint(){return nd=nd||new o({"circle-radius":new Je(ue.paint_circle["circle-radius"]),"circle-color":new Je(ue.paint_circle["circle-color"]),"circle-blur":new Je(ue.paint_circle["circle-blur"]),"circle-opacity":new Je(ue.paint_circle["circle-opacity"]),"circle-translate":new qe(ue.paint_circle["circle-translate"]),"circle-translate-anchor":new qe(ue.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new qe(ue.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new qe(ue.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Je(ue.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Je(ue.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Je(ue.paint_circle["circle-stroke-opacity"])})},get layout(){return rd=rd||new o({"circle-sort-key":new Je(ue.layout_circle["circle-sort-key"])})}},zi=1e-6,Eo=typeof Float32Array<"u"?Float32Array:Array;function uh(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 sd(i,e,r){var s=e[0],l=e[1],d=e[2],p=e[3],m=e[4],_=e[5],x=e[6],S=e[7],I=e[8],A=e[9],D=e[10],B=e[11],O=e[12],q=e[13],J=e[14],ae=e[15],Q=r[0],re=r[1],de=r[2],be=r[3];return i[0]=Q*s+re*m+de*I+be*O,i[1]=Q*l+re*_+de*A+be*q,i[2]=Q*d+re*x+de*D+be*J,i[3]=Q*p+re*S+de*B+be*ae,i[4]=(Q=r[4])*s+(re=r[5])*m+(de=r[6])*I+(be=r[7])*O,i[5]=Q*l+re*_+de*A+be*q,i[6]=Q*d+re*x+de*D+be*J,i[7]=Q*p+re*S+de*B+be*ae,i[8]=(Q=r[8])*s+(re=r[9])*m+(de=r[10])*I+(be=r[11])*O,i[9]=Q*l+re*_+de*A+be*q,i[10]=Q*d+re*x+de*D+be*J,i[11]=Q*p+re*S+de*B+be*ae,i[12]=(Q=r[12])*s+(re=r[13])*m+(de=r[14])*I+(be=r[15])*O,i[13]=Q*l+re*_+de*A+be*q,i[14]=Q*d+re*x+de*D+be*J,i[15]=Q*p+re*S+de*B+be*ae,i}Math.hypot||(Math.hypot=function(){for(var i=0,e=arguments.length;e--;)i+=arguments[e]*arguments[e];return Math.sqrt(i)});var Ua,P_=sd;function nc(i,e,r){var s=e[0],l=e[1],d=e[2],p=e[3];return i[0]=r[0]*s+r[4]*l+r[8]*d+r[12]*p,i[1]=r[1]*s+r[5]*l+r[9]*d+r[13]*p,i[2]=r[2]*s+r[6]*l+r[10]*d+r[14]*p,i[3]=r[3]*s+r[7]*l+r[11]*d+r[15]*p,i}Ua=new Eo(4),Eo!=Float32Array&&(Ua[0]=0,Ua[1]=0,Ua[2]=0,Ua[3]=0);class A_ extends h{constructor(e){super(e,E_)}createBucket(e){return new lh(e)}queryRadius(e){const r=e;return ja("circle-radius",this,r)+ja("circle-stroke-width",this,r)+ic(this.paint.get("circle-translate"))}queryIntersectsFeature(e,r,s,l,d,p,m,_){const x=rc(e,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),p.angle,m),S=this.paint.get("circle-radius").evaluate(r,s)+this.paint.get("circle-stroke-width").evaluate(r,s),I=this.paint.get("circle-pitch-alignment")==="map",A=I?x:function(B,O){return B.map(q=>od(q,O))}(x,_),D=I?S*m:S;for(const B of l)for(const O of B){const q=I?O:od(O,_);let J=D;const ae=nc([],[O.x,O.y,0,1],_);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?J*=ae[3]/p.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(J*=p.cameraToCenterDistance/ae[3]),T_(A,q,J))return!0}return!1}}function od(i,e){const r=nc([],[i.x,i.y,0,1],e);return new le(r[0]/r[3],r[1]/r[3])}class ad extends lh{}let ld;Fe("HeatmapBucket",ad,{omit:["layers"]});var M_={get paint(){return ld=ld||new o({"heatmap-radius":new Je(ue.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Je(ue.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new qe(ue.paint_heatmap["heatmap-intensity"]),"heatmap-color":new n(ue.paint_heatmap["heatmap-color"]),"heatmap-opacity":new qe(ue.paint_heatmap["heatmap-opacity"])})}};function dh(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 cd(i,{width:e,height:r},s){if(e===i.width&&r===i.height)return;const l=dh({},{width:e,height:r},s);ph(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 ph(i,e,r,s,l,d){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 p=i.data,m=e.data;if(p===m)throw new Error("srcData equals dstData, so image is already copied");for(let _=0;_<l.height;_++){const x=((r.y+_)*i.width+r.x)*d,S=((s.y+_)*e.width+s.x)*d;for(let I=0;I<l.width*d;I++)m[S+I]=p[x+I]}return e}class qa{constructor(e,r){dh(this,e,1,r)}resize(e){cd(this,e,1)}clone(){return new qa({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,s,l,d){ph(e,r,s,l,d,1)}}class ar{constructor(e,r){dh(this,e,4,r)}resize(e){cd(this,e,4)}replace(e,r){r?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new ar({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,s,l,d){ph(e,r,s,l,d,4)}}function hd(i){const e={},r=i.resolution||256,s=i.clips?i.clips.length:1,l=i.image||new ar({width:r,height:s});if(Math.log(r)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${r}`);const d=(p,m,_)=>{e[i.evaluationKey]=_;const x=i.expression.evaluate(e);l.data[p+m+0]=Math.floor(255*x.r/x.a),l.data[p+m+1]=Math.floor(255*x.g/x.a),l.data[p+m+2]=Math.floor(255*x.b/x.a),l.data[p+m+3]=Math.floor(255*x.a)};if(i.clips)for(let p=0,m=0;p<s;++p,m+=4*r)for(let _=0,x=0;_<r;_++,x+=4){const S=_/(r-1),{start:I,end:A}=i.clips[p];d(m,x,I*(1-S)+A*S)}else for(let p=0,m=0;p<r;p++,m+=4)d(0,m,p/(r-1));return l}Fe("AlphaImage",qa),Fe("RGBAImage",ar);class z_ extends h{createBucket(e){return new ad(e)}constructor(e){super(e,M_),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){e==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=hd({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"}}let ud;var D_={get paint(){return ud=ud||new o({"hillshade-illumination-direction":new qe(ue.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new qe(ue.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new qe(ue.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new qe(ue.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new qe(ue.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new qe(ue.paint_hillshade["hillshade-accent-color"])})}};class L_ extends h{constructor(e){super(e,D_)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}}const R_=w([{name:"a_pos",components:2,type:"Int16"}],4),{members:B_}=R_;function dd(i,e,r=2){const s=e&&e.length,l=s?e[0]*r:i.length;let d=pd(i,0,l,r,!0);const p=[];if(!d||d.next===d.prev)return p;let m,_,x;if(s&&(d=function(S,I,A,D){const B=[];for(let O=0,q=I.length;O<q;O++){const J=pd(S,I[O]*D,O<q-1?I[O+1]*D:S.length,D,!1);J===J.next&&(J.steiner=!0),B.push(q_(J))}B.sort($_);for(let O=0;O<B.length;O++)A=j_(B[O],A);return A}(i,e,d,r)),i.length>80*r){m=1/0,_=1/0;let S=-1/0,I=-1/0;for(let A=r;A<l;A+=r){const D=i[A],B=i[A+1];D<m&&(m=D),B<_&&(_=B),D>S&&(S=D),B>I&&(I=B)}x=Math.max(S-m,I-_),x=x!==0?32767/x:0}return Za(d,p,r,m,_,x,0),p}function pd(i,e,r,s,l){let d;if(l===function(p,m,_,x){let S=0;for(let I=m,A=_-x;I<_;I+=x)S+=(p[A]-p[I])*(p[I+1]+p[A+1]),A=I;return S}(i,e,r,s)>0)for(let p=e;p<r;p+=s)d=gd(p/s|0,i[p],i[p+1],d);else for(let p=r-s;p>=e;p-=s)d=gd(p/s|0,i[p],i[p+1],d);return d&&sc(d,d.next)&&(Ha(d),d=d.next),d}function Bs(i,e){if(!i)return i;e||(e=i);let r,s=i;do if(r=!1,s.steiner||!sc(s,s.next)&&Jt(s.prev,s,s.next)!==0)s=s.next;else{if(Ha(s),s=e=s.prev,s===s.next)break;r=!0}while(r||s!==e);return e}function Za(i,e,r,s,l,d,p){if(!i)return;!p&&d&&function(_,x,S,I){let A=_;do A.z===0&&(A.z=fh(A.x,A.y,x,S,I)),A.prevZ=A.prev,A.nextZ=A.next,A=A.next;while(A!==_);A.prevZ.nextZ=null,A.prevZ=null,function(D){let B,O=1;do{let q,J=D;D=null;let ae=null;for(B=0;J;){B++;let Q=J,re=0;for(let be=0;be<O&&(re++,Q=Q.nextZ,Q);be++);let de=O;for(;re>0||de>0&&Q;)re!==0&&(de===0||!Q||J.z<=Q.z)?(q=J,J=J.nextZ,re--):(q=Q,Q=Q.nextZ,de--),ae?ae.nextZ=q:D=q,q.prevZ=ae,ae=q;J=Q}ae.nextZ=null,O*=2}while(B>1)}(A)}(i,s,l,d);let m=i;for(;i.prev!==i.next;){const _=i.prev,x=i.next;if(d?O_(i,s,l,d):F_(i))e.push(_.i,i.i,x.i),Ha(i),i=x.next,m=x.next;else if((i=x)===m){p?p===1?Za(i=V_(Bs(i),e),e,r,s,l,d,2):p===2&&N_(i,e,r,s,l,d):Za(Bs(i),e,r,s,l,d,1);break}}}function F_(i){const e=i.prev,r=i,s=i.next;if(Jt(e,r,s)>=0)return!1;const l=e.x,d=r.x,p=s.x,m=e.y,_=r.y,x=s.y,S=l<d?l<p?l:p:d<p?d:p,I=m<_?m<x?m:x:_<x?_:x,A=l>d?l>p?l:p:d>p?d:p,D=m>_?m>x?m:x:_>x?_:x;let B=s.next;for(;B!==e;){if(B.x>=S&&B.x<=A&&B.y>=I&&B.y<=D&&Po(l,m,d,_,p,x,B.x,B.y)&&Jt(B.prev,B,B.next)>=0)return!1;B=B.next}return!0}function O_(i,e,r,s){const l=i.prev,d=i,p=i.next;if(Jt(l,d,p)>=0)return!1;const m=l.x,_=d.x,x=p.x,S=l.y,I=d.y,A=p.y,D=m<_?m<x?m:x:_<x?_:x,B=S<I?S<A?S:A:I<A?I:A,O=m>_?m>x?m:x:_>x?_:x,q=S>I?S>A?S:A:I>A?I:A,J=fh(D,B,e,r,s),ae=fh(O,q,e,r,s);let Q=i.prevZ,re=i.nextZ;for(;Q&&Q.z>=J&&re&&re.z<=ae;){if(Q.x>=D&&Q.x<=O&&Q.y>=B&&Q.y<=q&&Q!==l&&Q!==p&&Po(m,S,_,I,x,A,Q.x,Q.y)&&Jt(Q.prev,Q,Q.next)>=0||(Q=Q.prevZ,re.x>=D&&re.x<=O&&re.y>=B&&re.y<=q&&re!==l&&re!==p&&Po(m,S,_,I,x,A,re.x,re.y)&&Jt(re.prev,re,re.next)>=0))return!1;re=re.nextZ}for(;Q&&Q.z>=J;){if(Q.x>=D&&Q.x<=O&&Q.y>=B&&Q.y<=q&&Q!==l&&Q!==p&&Po(m,S,_,I,x,A,Q.x,Q.y)&&Jt(Q.prev,Q,Q.next)>=0)return!1;Q=Q.prevZ}for(;re&&re.z<=ae;){if(re.x>=D&&re.x<=O&&re.y>=B&&re.y<=q&&re!==l&&re!==p&&Po(m,S,_,I,x,A,re.x,re.y)&&Jt(re.prev,re,re.next)>=0)return!1;re=re.nextZ}return!0}function V_(i,e){let r=i;do{const s=r.prev,l=r.next.next;!sc(s,l)&&fd(s,r,r.next,l)&&Ga(s,l)&&Ga(l,s)&&(e.push(s.i,r.i,l.i),Ha(r),Ha(r.next),r=i=l),r=r.next}while(r!==i);return Bs(r)}function N_(i,e,r,s,l,d){let p=i;do{let m=p.next.next;for(;m!==p.prev;){if(p.i!==m.i&&Z_(p,m)){let _=md(p,m);return p=Bs(p,p.next),_=Bs(_,_.next),Za(p,e,r,s,l,d,0),void Za(_,e,r,s,l,d,0)}m=m.next}p=p.next}while(p!==i)}function $_(i,e){return i.x-e.x}function j_(i,e){const r=function(l,d){let p=d;const m=l.x,_=l.y;let x,S=-1/0;do{if(_<=p.y&&_>=p.next.y&&p.next.y!==p.y){const O=p.x+(_-p.y)*(p.next.x-p.x)/(p.next.y-p.y);if(O<=m&&O>S&&(S=O,x=p.x<p.next.x?p:p.next,O===m))return x}p=p.next}while(p!==d);if(!x)return null;const I=x,A=x.x,D=x.y;let B=1/0;p=x;do{if(m>=p.x&&p.x>=A&&m!==p.x&&Po(_<D?m:S,_,A,D,_<D?S:m,_,p.x,p.y)){const O=Math.abs(_-p.y)/(m-p.x);Ga(p,l)&&(O<B||O===B&&(p.x>x.x||p.x===x.x&&U_(x,p)))&&(x=p,B=O)}p=p.next}while(p!==I);return x}(i,e);if(!r)return e;const s=md(r,i);return Bs(s,s.next),Bs(r,r.next)}function U_(i,e){return Jt(i.prev,i,e.prev)<0&&Jt(e.next,i,i.next)<0}function fh(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 q_(i){let 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 Po(i,e,r,s,l,d,p,m){return(l-p)*(e-m)>=(i-p)*(d-m)&&(i-p)*(s-m)>=(r-p)*(e-m)&&(r-p)*(d-m)>=(l-p)*(s-m)}function Z_(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!function(r,s){let l=r;do{if(l.i!==r.i&&l.next.i!==r.i&&l.i!==s.i&&l.next.i!==s.i&&fd(l,l.next,r,s))return!0;l=l.next}while(l!==r);return!1}(i,e)&&(Ga(i,e)&&Ga(e,i)&&function(r,s){let l=r,d=!1;const p=(r.x+s.x)/2,m=(r.y+s.y)/2;do l.y>m!=l.next.y>m&&l.next.y!==l.y&&p<(l.next.x-l.x)*(m-l.y)/(l.next.y-l.y)+l.x&&(d=!d),l=l.next;while(l!==r);return d}(i,e)&&(Jt(i.prev,i,e.prev)||Jt(i,e.prev,e))||sc(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 sc(i,e){return i.x===e.x&&i.y===e.y}function fd(i,e,r,s){const l=ac(Jt(i,e,r)),d=ac(Jt(i,e,s)),p=ac(Jt(r,s,i)),m=ac(Jt(r,s,e));return l!==d&&p!==m||!(l!==0||!oc(i,r,e))||!(d!==0||!oc(i,s,e))||!(p!==0||!oc(r,i,s))||!(m!==0||!oc(r,e,s))}function oc(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 ac(i){return i>0?1:i<0?-1:0}function Ga(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 md(i,e){const r=mh(i.i,i.x,i.y),s=mh(e.i,e.x,e.y),l=i.next,d=e.prev;return i.next=e,e.prev=i,r.next=l,l.prev=r,s.next=r,r.prev=s,d.next=s,s.prev=d,s}function gd(i,e,r,s){const l=mh(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 Ha(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 mh(i,e,r){return{i,x:e,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function gh(i,e,r){const s=r.patternDependencies;let l=!1;for(const d of e){const p=d.paint.get(`${i}-pattern`);p.isConstant()||(l=!0);const m=p.constantOr(null);m&&(l=!0,s[m.to]=!0,s[m.from]=!0)}return l}function _h(i,e,r,s,l){const d=l.patternDependencies;for(const p of e){const m=p.paint.get(`${i}-pattern`).value;if(m.kind!=="constant"){let _=m.evaluate({zoom:s-1},r,{},l.availableImages),x=m.evaluate({zoom:s},r,{},l.availableImages),S=m.evaluate({zoom:s+1},r,{},l.availableImages);_=_&&_.name?_.name:_,x=x&&x.name?x.name:x,S=S&&S.name?S.name:S,d[_]=!0,d[x]=!0,d[S]=!0,r.patterns[p.id]={min:_,mid:x,max:S}}}return r}class yh{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 qn,this.indexArray=new ri,this.indexArray2=new Nt,this.programConfigurations=new Ds(e.layers,e.zoom),this.segments=new ti,this.segments2=new ti,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,s){this.hasPattern=gh("fill",this.layers,r);const l=this.layers[0].layout.get("fill-sort-key"),d=!l.isConstant(),p=[];for(const{feature:m,id:_,index:x,sourceLayerIndex:S}of e){const I=this.layers[0]._featureFilter.needGeometry,A=Rs(m,I);if(!this.layers[0]._featureFilter.filter(new Pt(this.zoom),A,s))continue;const D=d?l.evaluate(A,{},s,r.availableImages):void 0,B={id:_,properties:m.properties,type:m.type,sourceLayerIndex:S,index:x,geometry:I?A.geometry:Ls(m),patterns:{},sortKey:D};p.push(B)}d&&p.sort((m,_)=>m.sortKey-_.sortKey);for(const m of p){const{geometry:_,index:x,sourceLayerIndex:S}=m;if(this.hasPattern){const I=_h("fill",this.layers,m,this.zoom,r);this.patternFeatures.push(I)}else this.addFeature(m,_,x,s,{});r.featureIndex.insert(e[x].feature,_,x,S,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,B_),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,d){for(const p of to(r,500)){let m=0;for(const D of p)m+=D.length;const _=this.segments.prepareSegment(m,this.layoutVertexArray,this.indexArray),x=_.vertexLength,S=[],I=[];for(const D of p){if(D.length===0)continue;D!==p[0]&&I.push(S.length/2);const B=this.segments2.prepareSegment(D.length,this.layoutVertexArray,this.indexArray2),O=B.vertexLength;this.layoutVertexArray.emplaceBack(D[0].x,D[0].y),this.indexArray2.emplaceBack(O+D.length-1,O),S.push(D[0].x),S.push(D[0].y);for(let q=1;q<D.length;q++)this.layoutVertexArray.emplaceBack(D[q].x,D[q].y),this.indexArray2.emplaceBack(O+q-1,O+q),S.push(D[q].x),S.push(D[q].y);B.vertexLength+=D.length,B.primitiveLength+=D.length}const A=dd(S,I);for(let D=0;D<A.length;D+=3)this.indexArray.emplaceBack(x+A[D],x+A[D+1],x+A[D+2]);_.vertexLength+=m,_.primitiveLength+=A.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,d,l)}}let _d,yd;Fe("FillBucket",yh,{omit:["layers","patternFeatures"]});var G_={get paint(){return yd=yd||new o({"fill-antialias":new qe(ue.paint_fill["fill-antialias"]),"fill-opacity":new Je(ue.paint_fill["fill-opacity"]),"fill-color":new Je(ue.paint_fill["fill-color"]),"fill-outline-color":new Je(ue.paint_fill["fill-outline-color"]),"fill-translate":new qe(ue.paint_fill["fill-translate"]),"fill-translate-anchor":new qe(ue.paint_fill["fill-translate-anchor"]),"fill-pattern":new u(ue.paint_fill["fill-pattern"])})},get layout(){return _d=_d||new o({"fill-sort-key":new Je(ue.layout_fill["fill-sort-key"])})}};class H_ extends h{constructor(e){super(e,G_)}recalculate(e,r){super.recalculate(e,r);const s=this.paint._values["fill-outline-color"];s.value.kind==="constant"&&s.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(e){return new yh(e)}queryRadius(){return ic(this.paint.get("fill-translate"))}queryIntersectsFeature(e,r,s,l,d,p,m){return ed(rc(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),p.angle,m),l)}isTileClipped(){return!0}}const X_=w([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),W_=w([{name:"a_centroid",components:2,type:"Int16"}],4),{members:J_}=X_;var Wn={},K_=me,xd=Ao;function Ao(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(Y_,this,e)}function Y_(i,e,r){i==1?e.id=r.readVarint():i==2?function(s,l){for(var d=s.readVarint()+s.pos;s.pos<d;){var p=l._keys[s.readVarint()],m=l._values[s.readVarint()];l.properties[p]=m}}(r,e):i==3?e.type=r.readVarint():i==4&&(e._geometry=r.pos)}function Q_(i){for(var e,r,s=0,l=0,d=i.length,p=d-1;l<d;p=l++)s+=((r=i[p]).x-(e=i[l]).x)*(e.y+r.y);return s}Ao.types=["Unknown","Point","LineString","Polygon"],Ao.prototype.loadGeometry=function(){var i=this._pbf;i.pos=this._geometry;for(var e,r=i.readVarint()+i.pos,s=1,l=0,d=0,p=0,m=[];i.pos<r;){if(l<=0){var _=i.readVarint();s=7&_,l=_>>3}if(l--,s===1||s===2)d+=i.readSVarint(),p+=i.readSVarint(),s===1&&(e&&m.push(e),e=[]),e.push(new K_(d,p));else{if(s!==7)throw new Error("unknown command "+s);e&&e.push(e[0].clone())}}return e&&m.push(e),m},Ao.prototype.bbox=function(){var i=this._pbf;i.pos=this._geometry;for(var e=i.readVarint()+i.pos,r=1,s=0,l=0,d=0,p=1/0,m=-1/0,_=1/0,x=-1/0;i.pos<e;){if(s<=0){var S=i.readVarint();r=7&S,s=S>>3}if(s--,r===1||r===2)(l+=i.readSVarint())<p&&(p=l),l>m&&(m=l),(d+=i.readSVarint())<_&&(_=d),d>x&&(x=d);else if(r!==7)throw new Error("unknown command "+r)}return[p,_,m,x]},Ao.prototype.toGeoJSON=function(i,e,r){var s,l,d=this.extent*Math.pow(2,r),p=this.extent*i,m=this.extent*e,_=this.loadGeometry(),x=Ao.types[this.type];function S(D){for(var B=0;B<D.length;B++){var O=D[B];D[B]=[360*(O.x+p)/d-180,360/Math.PI*Math.atan(Math.exp((180-360*(O.y+m)/d)*Math.PI/180))-90]}}switch(this.type){case 1:var I=[];for(s=0;s<_.length;s++)I[s]=_[s][0];S(_=I);break;case 2:for(s=0;s<_.length;s++)S(_[s]);break;case 3:for(_=function(D){var B=D.length;if(B<=1)return[D];for(var O,q,J=[],ae=0;ae<B;ae++){var Q=Q_(D[ae]);Q!==0&&(q===void 0&&(q=Q<0),q===Q<0?(O&&J.push(O),O=[D[ae]]):O.push(D[ae]))}return O&&J.push(O),J}(_),s=0;s<_.length;s++)for(l=0;l<_[s].length;l++)S(_[s][l])}_.length===1?_=_[0]:x="Multi"+x;var A={type:"Feature",geometry:{type:x,coordinates:_},properties:this.properties};return"id"in this&&(A.id=this.id),A};var ey=xd,vd=bd;function bd(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(ty,this,e),this.length=this._features.length}function ty(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,d=s.readVarint()+s.pos;s.pos<d;){var p=s.readVarint()>>3;l=p===1?s.readString():p===2?s.readFloat():p===3?s.readDouble():p===4?s.readVarint64():p===5?s.readVarint():p===6?s.readSVarint():p===7?s.readBoolean():null}return l}(r))}bd.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 ey(this._pbf,e,this.extent,this._keys,this._values)};var iy=vd;function ry(i,e,r){if(i===3){var s=new iy(r,r.readVarint()+r.pos);s.length&&(e[s.name]=s)}}Wn.VectorTile=function(i,e){this.layers=i.readFields(ry,{},e)},Wn.VectorTileFeature=xd,Wn.VectorTileLayer=vd;const ny=Wn.VectorTileFeature.types,xh=Math.pow(2,13);function Xa(i,e,r,s,l,d,p,m){i.emplaceBack(e,r,2*Math.floor(s*xh)+p,l*xh*2,d*xh*2,Math.round(m))}class vh{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 bn,this.centroidVertexArray=new vn,this.indexArray=new ri,this.programConfigurations=new Ds(e.layers,e.zoom),this.segments=new ti,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,s){this.features=[],this.hasPattern=gh("fill-extrusion",this.layers,r);for(const{feature:l,id:d,index:p,sourceLayerIndex:m}of e){const _=this.layers[0]._featureFilter.needGeometry,x=Rs(l,_);if(!this.layers[0]._featureFilter.filter(new Pt(this.zoom),x,s))continue;const S={id:d,sourceLayerIndex:m,index:p,geometry:_?x.geometry:Ls(l),properties:l.properties,type:l.type,patterns:{}};this.hasPattern?this.features.push(_h("fill-extrusion",this.layers,S,this.zoom,r)):this.addFeature(S,S.geometry,p,s,{}),r.featureIndex.insert(l,S.geometry,p,m,this.index,!0)}}addFeatures(e,r,s){for(const l of this.features){const{geometry:d}=l;this.addFeature(l,d,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,J_),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,W_.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,d){for(const p of to(r,500)){const m={x:0,y:0,vertexCount:0};let _=0;for(const B of p)_+=B.length;let x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const B of p){if(B.length===0||oy(B))continue;let O=0;for(let q=0;q<B.length;q++){const J=B[q];if(q>=1){const ae=B[q-1];if(!sy(J,ae)){x.vertexLength+4>ti.MAX_VERTEX_ARRAY_LENGTH&&(x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const Q=J.sub(ae)._perp()._unit(),re=ae.dist(J);O+re>32768&&(O=0),Xa(this.layoutVertexArray,J.x,J.y,Q.x,Q.y,0,0,O),Xa(this.layoutVertexArray,J.x,J.y,Q.x,Q.y,0,1,O),m.x+=2*J.x,m.y+=2*J.y,m.vertexCount+=2,O+=re,Xa(this.layoutVertexArray,ae.x,ae.y,Q.x,Q.y,0,0,O),Xa(this.layoutVertexArray,ae.x,ae.y,Q.x,Q.y,0,1,O),m.x+=2*ae.x,m.y+=2*ae.y,m.vertexCount+=2;const de=x.vertexLength;this.indexArray.emplaceBack(de,de+2,de+1),this.indexArray.emplaceBack(de+1,de+2,de+3),x.vertexLength+=4,x.primitiveLength+=2}}}}if(x.vertexLength+_>ti.MAX_VERTEX_ARRAY_LENGTH&&(x=this.segments.prepareSegment(_,this.layoutVertexArray,this.indexArray)),ny[e.type]!=="Polygon")continue;const S=[],I=[],A=x.vertexLength;for(const B of p)if(B.length!==0){B!==p[0]&&I.push(S.length/2);for(let O=0;O<B.length;O++){const q=B[O];Xa(this.layoutVertexArray,q.x,q.y,0,0,1,1,0),m.x+=q.x,m.y+=q.y,m.vertexCount+=1,S.push(q.x),S.push(q.y)}}const D=dd(S,I);for(let B=0;B<D.length;B+=3)this.indexArray.emplaceBack(A+D[B],A+D[B+2],A+D[B+1]);x.primitiveLength+=D.length/3,x.vertexLength+=_;for(let B=0;B<m.vertexCount;B++){const O=Math.floor(m.x/m.vertexCount),q=Math.floor(m.y/m.vertexCount);this.centroidVertexArray.emplaceBack(O,q)}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,d,l)}}function sy(i,e){return i.x===e.x&&(i.x<0||i.x>Qt)||i.y===e.y&&(i.y<0||i.y>Qt)}function oy(i){return i.every(e=>e.x<0)||i.every(e=>e.x>Qt)||i.every(e=>e.y<0)||i.every(e=>e.y>Qt)}let wd;Fe("FillExtrusionBucket",vh,{omit:["layers","features"]});var ay={get paint(){return wd=wd||new o({"fill-extrusion-opacity":new qe(ue["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Je(ue["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new qe(ue["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new qe(ue["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new u(ue["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Je(ue["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Je(ue["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new qe(ue["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class ly extends h{constructor(e){super(e,ay)}createBucket(e){return new vh(e)}queryRadius(){return ic(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(e,r,s,l,d,p,m,_){const x=rc(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),p.angle,m),S=this.paint.get("fill-extrusion-height").evaluate(r,s),I=this.paint.get("fill-extrusion-base").evaluate(r,s),A=function(B,O,q,J){const ae=[];for(const Q of B){const re=[Q.x,Q.y,0,1];nc(re,re,O),ae.push(new le(re[0]/re[3],re[1]/re[3]))}return ae}(x,_),D=function(B,O,q,J){const ae=[],Q=[],re=J[8]*O,de=J[9]*O,be=J[10]*O,Le=J[11]*O,We=J[8]*q,Me=J[9]*q,Pe=J[10]*q,Ue=J[11]*q;for(const Ve of B){const Be=[],_e=[];for(const Ze of Ve){const $e=Ze.x,et=Ze.y,It=J[0]*$e+J[4]*et+J[12],kt=J[1]*$e+J[5]*et+J[13],ni=J[2]*$e+J[6]*et+J[14],wr=J[3]*$e+J[7]*et+J[15],yi=ni+be,Gt=wr+Le,Di=It+We,Li=kt+Me,Ri=ni+Pe,Ht=wr+Ue,si=new le((It+re)/Gt,(kt+de)/Gt);si.z=yi/Gt,Be.push(si);const Ii=new le(Di/Ht,Li/Ht);Ii.z=Ri/Ht,_e.push(Ii)}ae.push(Be),Q.push(_e)}return[ae,Q]}(l,I,S,_);return function(B,O,q){let J=1/0;ed(q,O)&&(J=Sd(q,O[0]));for(let ae=0;ae<O.length;ae++){const Q=O[ae],re=B[ae];for(let de=0;de<Q.length-1;de++){const be=Q[de],Le=[be,Q[de+1],re[de+1],re[de],be];Qu(q,Le)&&(J=Math.min(J,Sd(q,Le)))}}return J!==1/0&&J}(D[0],D[1],A)}}function Wa(i,e){return i.x*e.x+i.y*e.y}function Sd(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 d=e[r],p=i[0],m=l.sub(s),_=d.sub(s),x=p.sub(s),S=Wa(m,m),I=Wa(m,_),A=Wa(_,_),D=Wa(x,m),B=Wa(x,_),O=S*A-I*I,q=(A*D-I*B)/O,J=(S*B-I*D)/O,ae=s.z*(1-q-J)+l.z*q+d.z*J;if(isFinite(ae))return ae}return 1/0}{let r=1/0;for(const s of e)r=Math.min(r,s.z);return r}}const cy=w([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:hy}=cy,uy=w([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:dy}=uy,py=Wn.VectorTileFeature.types,fy=Math.cos(Math.PI/180*37.5),Td=Math.pow(2,14)/.5;class bh{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 wo,this.layoutVertexArray2=new Ba,this.indexArray=new ri,this.programConfigurations=new Ds(e.layers,e.zoom),this.segments=new ti,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,s){this.hasPattern=gh("line",this.layers,r);const l=this.layers[0].layout.get("line-sort-key"),d=!l.isConstant(),p=[];for(const{feature:m,id:_,index:x,sourceLayerIndex:S}of e){const I=this.layers[0]._featureFilter.needGeometry,A=Rs(m,I);if(!this.layers[0]._featureFilter.filter(new Pt(this.zoom),A,s))continue;const D=d?l.evaluate(A,{},s):void 0,B={id:_,properties:m.properties,type:m.type,sourceLayerIndex:S,index:x,geometry:I?A.geometry:Ls(m),patterns:{},sortKey:D};p.push(B)}d&&p.sort((m,_)=>m.sortKey-_.sortKey);for(const m of p){const{geometry:_,index:x,sourceLayerIndex:S}=m;if(this.hasPattern){const I=_h("line",this.layers,m,this.zoom,r);this.patternFeatures.push(I)}else this.addFeature(m,_,x,s,{});r.featureIndex.insert(e[x].feature,_,x,S,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,dy)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,hy),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,d){const p=this.layers[0].layout,m=p.get("line-join").evaluate(e,{}),_=p.get("line-cap"),x=p.get("line-miter-limit"),S=p.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const I of r)this.addLine(I,e,m,_,x,S);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,d,l)}addLine(e,r,s,l,d,p){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let J=0;J<e.length-1;J++)this.totalDistance+=e[J].dist(e[J+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const m=py[r.type]==="Polygon";let _=e.length;for(;_>=2&&e[_-1].equals(e[_-2]);)_--;let x=0;for(;x<_-1&&e[x].equals(e[x+1]);)x++;if(_<(m?3:2))return;s==="bevel"&&(d=1.05);const S=this.overscaling<=16?15*Qt/(512*this.overscaling):0,I=this.segments.prepareSegment(10*_,this.layoutVertexArray,this.indexArray);let A,D,B,O,q;this.e1=this.e2=-1,m&&(A=e[_-2],q=e[x].sub(A)._unit()._perp());for(let J=x;J<_;J++){if(B=J===_-1?m?e[x+1]:void 0:e[J+1],B&&e[J].equals(B))continue;q&&(O=q),A&&(D=A),A=e[J],q=B?B.sub(A)._unit()._perp():O,O=O||q;let ae=O.add(q);ae.x===0&&ae.y===0||ae._unit();const Q=O.x*q.x+O.y*q.y,re=ae.x*q.x+ae.y*q.y,de=re!==0?1/re:1/0,be=2*Math.sqrt(2-2*re),Le=re<fy&&D&&B,We=O.x*q.y-O.y*q.x>0;if(Le&&J>x){const Ue=A.dist(D);if(Ue>2*S){const Ve=A.sub(A.sub(D)._mult(S/Ue)._round());this.updateDistance(D,Ve),this.addCurrentVertex(Ve,O,0,0,I),D=Ve}}const Me=D&&B;let Pe=Me?s:m?"butt":l;if(Me&&Pe==="round"&&(de<p?Pe="miter":de<=2&&(Pe="fakeround")),Pe==="miter"&&de>d&&(Pe="bevel"),Pe==="bevel"&&(de>2&&(Pe="flipbevel"),de<d&&(Pe="miter")),D&&this.updateDistance(D,A),Pe==="miter")ae._mult(de),this.addCurrentVertex(A,ae,0,0,I);else if(Pe==="flipbevel"){if(de>100)ae=q.mult(-1);else{const Ue=de*O.add(q).mag()/O.sub(q).mag();ae._perp()._mult(Ue*(We?-1:1))}this.addCurrentVertex(A,ae,0,0,I),this.addCurrentVertex(A,ae.mult(-1),0,0,I)}else if(Pe==="bevel"||Pe==="fakeround"){const Ue=-Math.sqrt(de*de-1),Ve=We?Ue:0,Be=We?0:Ue;if(D&&this.addCurrentVertex(A,O,Ve,Be,I),Pe==="fakeround"){const _e=Math.round(180*be/Math.PI/20);for(let Ze=1;Ze<_e;Ze++){let $e=Ze/_e;if($e!==.5){const It=$e-.5;$e+=$e*It*($e-1)*((1.0904+Q*(Q*(3.55645-1.43519*Q)-3.2452))*It*It+(.848013+Q*(.215638*Q-1.06021)))}const et=q.sub(O)._mult($e)._add(O)._unit()._mult(We?-1:1);this.addHalfVertex(A,et.x,et.y,!1,We,0,I)}}B&&this.addCurrentVertex(A,q,-Ve,-Be,I)}else if(Pe==="butt")this.addCurrentVertex(A,ae,0,0,I);else if(Pe==="square"){const Ue=D?1:-1;this.addCurrentVertex(A,ae,Ue,Ue,I)}else Pe==="round"&&(D&&(this.addCurrentVertex(A,O,0,0,I),this.addCurrentVertex(A,O,1,1,I,!0)),B&&(this.addCurrentVertex(A,q,-1,-1,I,!0),this.addCurrentVertex(A,q,0,0,I)));if(Le&&J<_-1){const Ue=A.dist(B);if(Ue>2*S){const Ve=A.add(B.sub(A)._mult(S/Ue)._round());this.updateDistance(A,Ve),this.addCurrentVertex(Ve,q,0,0,I),A=Ve}}}}addCurrentVertex(e,r,s,l,d,p=!1){const m=r.y*l-r.x,_=-r.y-r.x*l;this.addHalfVertex(e,r.x+r.y*s,r.y-r.x*s,p,!1,s,d),this.addHalfVertex(e,m,_,p,!0,-l,d),this.distance>Td/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,r,s,l,d,p))}addHalfVertex({x:e,y:r},s,l,d,p,m,_){const x=.5*(this.lineClips?this.scaledDistance*(Td-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(d?1:0),(r<<1)+(p?1:0),Math.round(63*s)+128,Math.round(63*l)+128,1+(m===0?0:m<0?-1:1)|(63&x)<<2,x>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const S=_.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,S),_.primitiveLength++),p?this.e2=S:this.e1=S}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 kd,Id;Fe("LineBucket",bh,{omit:["layers","patternFeatures"]});var Cd={get paint(){return Id=Id||new o({"line-opacity":new Je(ue.paint_line["line-opacity"]),"line-color":new Je(ue.paint_line["line-color"]),"line-translate":new qe(ue.paint_line["line-translate"]),"line-translate-anchor":new qe(ue.paint_line["line-translate-anchor"]),"line-width":new Je(ue.paint_line["line-width"]),"line-gap-width":new Je(ue.paint_line["line-gap-width"]),"line-offset":new Je(ue.paint_line["line-offset"]),"line-blur":new Je(ue.paint_line["line-blur"]),"line-dasharray":new t(ue.paint_line["line-dasharray"]),"line-pattern":new u(ue.paint_line["line-pattern"]),"line-gradient":new n(ue.paint_line["line-gradient"])})},get layout(){return kd=kd||new o({"line-cap":new qe(ue.layout_line["line-cap"]),"line-join":new Je(ue.layout_line["line-join"]),"line-miter-limit":new qe(ue.layout_line["line-miter-limit"]),"line-round-limit":new qe(ue.layout_line["line-round-limit"]),"line-sort-key":new Je(ue.layout_line["line-sort-key"])})}};class my extends Je{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=$t({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(e,r,s,l)}}let lc;class gy extends h{constructor(e){super(e,Cd),this.gradientVersion=0,lc||(lc=new my(Cd.paint.properties["line-width"].specification),lc.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e==="line-gradient"){const r=this.gradientExpression();this.stepInterpolant=!!function(s){return s._styleExpression!==void 0}(r)&&r._styleExpression.expression instanceof Dn,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(e,r){super.recalculate(e,r),this.paint._values["line-floorwidth"]=lc.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new bh(e)}queryRadius(e){const r=e,s=Ed(ja("line-width",this,r),ja("line-gap-width",this,r)),l=ja("line-offset",this,r);return s/2+Math.abs(l)+ic(this.paint.get("line-translate"))}queryIntersectsFeature(e,r,s,l,d,p,m){const _=rc(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),p.angle,m),x=m/2*Ed(this.paint.get("line-width").evaluate(r,s),this.paint.get("line-gap-width").evaluate(r,s)),S=this.paint.get("line-offset").evaluate(r,s);return S&&(l=function(I,A){const D=[];for(let B=0;B<I.length;B++){const O=I[B],q=[];for(let J=0;J<O.length;J++){const ae=O[J-1],Q=O[J],re=O[J+1],de=J===0?new le(0,0):Q.sub(ae)._unit()._perp(),be=J===O.length-1?new le(0,0):re.sub(Q)._unit()._perp(),Le=de._add(be)._unit(),We=Le.x*be.x+Le.y*be.y;We!==0&&Le._mult(1/We),q.push(Le._mult(A)._add(Q))}D.push(q)}return D}(l,S*m)),function(I,A,D){for(let B=0;B<A.length;B++){const O=A[B];if(I.length>=3){for(let q=0;q<O.length;q++)if(Co(I,O[q]))return!0}if(k_(I,O,D))return!0}return!1}(_,l,x)}isTileClipped(){return!0}}function Ed(i,e){return e>0?e+2*i:i}const _y=w([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),yy=w([{name:"a_projected_pos",components:3,type:"Float32"}],4);w([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const xy=w([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);w([{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 Pd=w([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),vy=w([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function by(i,e,r){return i.sections.forEach(s=>{s.text=function(l,d,p){const m=d.layout.get("text-transform").evaluate(p,{});return m==="uppercase"?l=l.toLocaleUpperCase():m==="lowercase"&&(l=l.toLocaleLowerCase()),Yr.applyArabicShaping&&(l=Yr.applyArabicShaping(l)),l}(s.text,e,r)}),i}w([{name:"triangle",components:3,type:"Uint16"}]),w([{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"}]),w([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),w([{type:"Float32",name:"offsetX"}]),w([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),w([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const Ja={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var ii=24,Ad=Tt,Md=function(i,e,r,s,l){var d,p,m=8*l-s-1,_=(1<<m)-1,x=_>>1,S=-7,I=l-1,A=-1,D=i[e+I];for(I+=A,d=D&(1<<-S)-1,D>>=-S,S+=m;S>0;d=256*d+i[e+I],I+=A,S-=8);for(p=d&(1<<-S)-1,d>>=-S,S+=s;S>0;p=256*p+i[e+I],I+=A,S-=8);if(d===0)d=1-x;else{if(d===_)return p?NaN:1/0*(D?-1:1);p+=Math.pow(2,s),d-=x}return(D?-1:1)*p*Math.pow(2,d-s)},zd=function(i,e,r,s,l,d){var p,m,_,x=8*d-l-1,S=(1<<x)-1,I=S>>1,A=l===23?Math.pow(2,-24)-Math.pow(2,-77):0,D=0,B=1,O=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(m=isNaN(e)?1:0,p=S):(p=Math.floor(Math.log(e)/Math.LN2),e*(_=Math.pow(2,-p))<1&&(p--,_*=2),(e+=p+I>=1?A/_:A*Math.pow(2,1-I))*_>=2&&(p++,_/=2),p+I>=S?(m=0,p=S):p+I>=1?(m=(e*_-1)*Math.pow(2,l),p+=I):(m=e*Math.pow(2,I-1)*Math.pow(2,l),p=0));l>=8;i[r+D]=255&m,D+=B,m/=256,l-=8);for(p=p<<l|m,x+=l;x>0;i[r+D]=255&p,D+=B,p/=256,x-=8);i[r+D-B]|=128*O};function Tt(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}Tt.Varint=0,Tt.Fixed64=1,Tt.Bytes=2,Tt.Fixed32=5;var wh=4294967296,Dd=1/wh,Ld=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function Sn(i){return i.type===Tt.Bytes?i.readVarint()+i.pos:i.pos+1}function Mo(i,e,r){return r?4294967296*e+(i>>>0):4294967296*(e>>>0)+(i>>>0)}function Rd(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 wy(i,e){for(var r=0;r<i.length;r++)e.writeVarint(i[r])}function Sy(i,e){for(var r=0;r<i.length;r++)e.writeSVarint(i[r])}function Ty(i,e){for(var r=0;r<i.length;r++)e.writeFloat(i[r])}function ky(i,e){for(var r=0;r<i.length;r++)e.writeDouble(i[r])}function Iy(i,e){for(var r=0;r<i.length;r++)e.writeBoolean(i[r])}function Cy(i,e){for(var r=0;r<i.length;r++)e.writeFixed32(i[r])}function Ey(i,e){for(var r=0;r<i.length;r++)e.writeSFixed32(i[r])}function Py(i,e){for(var r=0;r<i.length;r++)e.writeFixed64(i[r])}function Ay(i,e){for(var r=0;r<i.length;r++)e.writeSFixed64(i[r])}function cc(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+16777216*i[e+3]}function zo(i,e,r){i[r]=e,i[r+1]=e>>>8,i[r+2]=e>>>16,i[r+3]=e>>>24}function Bd(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+(i[e+3]<<24)}Tt.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,d=this.pos;this.type=7&s,i(l,e,this),this.pos===d&&this.skip(s)}return e},readMessage:function(i,e){return this.readFields(i,e,this.readVarint()+this.pos)},readFixed32:function(){var i=cc(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=Bd(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=cc(this.buf,this.pos)+cc(this.buf,this.pos+4)*wh;return this.pos+=8,i},readSFixed64:function(){var i=cc(this.buf,this.pos)+Bd(this.buf,this.pos+4)*wh;return this.pos+=8,i},readFloat:function(){var i=Md(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=Md(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,d,p){var m,_,x=p.buf;if(m=(112&(_=x[p.pos++]))>>4,_<128||(m|=(127&(_=x[p.pos++]))<<3,_<128)||(m|=(127&(_=x[p.pos++]))<<10,_<128)||(m|=(127&(_=x[p.pos++]))<<17,_<128)||(m|=(127&(_=x[p.pos++]))<<24,_<128)||(m|=(1&(_=x[p.pos++]))<<31,_<128))return Mo(l,m,d);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&&Ld?function(r,s,l){return Ld.decode(r.subarray(s,l))}(this.buf,e,i):function(r,s,l){for(var d="",p=s;p<l;){var m,_,x,S=r[p],I=null,A=S>239?4:S>223?3:S>191?2:1;if(p+A>l)break;A===1?S<128&&(I=S):A===2?(192&(m=r[p+1]))==128&&(I=(31&S)<<6|63&m)<=127&&(I=null):A===3?(_=r[p+2],(192&(m=r[p+1]))==128&&(192&_)==128&&((I=(15&S)<<12|(63&m)<<6|63&_)<=2047||I>=55296&&I<=57343)&&(I=null)):A===4&&(_=r[p+2],x=r[p+3],(192&(m=r[p+1]))==128&&(192&_)==128&&(192&x)==128&&((I=(15&S)<<18|(63&m)<<12|(63&_)<<6|63&x)<=65535||I>=1114112)&&(I=null)),I===null?(I=65533,A=1):I>65535&&(I-=65536,d+=String.fromCharCode(I>>>10&1023|55296),I=56320|1023&I),d+=String.fromCharCode(I),p+=A}return d}(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!==Tt.Bytes)return i.push(this.readVarint(e));var r=Sn(this);for(i=i||[];this.pos<r;)i.push(this.readVarint(e));return i},readPackedSVarint:function(i){if(this.type!==Tt.Bytes)return i.push(this.readSVarint());var e=Sn(this);for(i=i||[];this.pos<e;)i.push(this.readSVarint());return i},readPackedBoolean:function(i){if(this.type!==Tt.Bytes)return i.push(this.readBoolean());var e=Sn(this);for(i=i||[];this.pos<e;)i.push(this.readBoolean());return i},readPackedFloat:function(i){if(this.type!==Tt.Bytes)return i.push(this.readFloat());var e=Sn(this);for(i=i||[];this.pos<e;)i.push(this.readFloat());return i},readPackedDouble:function(i){if(this.type!==Tt.Bytes)return i.push(this.readDouble());var e=Sn(this);for(i=i||[];this.pos<e;)i.push(this.readDouble());return i},readPackedFixed32:function(i){if(this.type!==Tt.Bytes)return i.push(this.readFixed32());var e=Sn(this);for(i=i||[];this.pos<e;)i.push(this.readFixed32());return i},readPackedSFixed32:function(i){if(this.type!==Tt.Bytes)return i.push(this.readSFixed32());var e=Sn(this);for(i=i||[];this.pos<e;)i.push(this.readSFixed32());return i},readPackedFixed64:function(i){if(this.type!==Tt.Bytes)return i.push(this.readFixed64());var e=Sn(this);for(i=i||[];this.pos<e;)i.push(this.readFixed64());return i},readPackedSFixed64:function(i){if(this.type!==Tt.Bytes)return i.push(this.readSFixed64());var e=Sn(this);for(i=i||[];this.pos<e;)i.push(this.readSFixed64());return i},skip:function(i){var e=7&i;if(e===Tt.Varint)for(;this.buf[this.pos++]>127;);else if(e===Tt.Bytes)this.pos=this.readVarint()+this.pos;else if(e===Tt.Fixed32)this.pos+=4;else{if(e!==Tt.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),zo(this.buf,i,this.pos),this.pos+=4},writeSFixed32:function(i){this.realloc(4),zo(this.buf,i,this.pos),this.pos+=4},writeFixed64:function(i){this.realloc(8),zo(this.buf,-1&i,this.pos),zo(this.buf,Math.floor(i*Dd),this.pos+4),this.pos+=8},writeSFixed64:function(i){this.realloc(8),zo(this.buf,-1&i,this.pos),zo(this.buf,Math.floor(i*Dd),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(d,p,m){m.buf[m.pos++]=127&d|128,d>>>=7,m.buf[m.pos++]=127&d|128,d>>>=7,m.buf[m.pos++]=127&d|128,d>>>=7,m.buf[m.pos++]=127&d|128,m.buf[m.pos]=127&(d>>>=7)}(s,0,r),function(d,p){var m=(7&d)<<4;p.buf[p.pos++]|=m|((d>>>=3)?128:0),d&&(p.buf[p.pos++]=127&d|((d>>>=7)?128:0),d&&(p.buf[p.pos++]=127&d|((d>>>=7)?128:0),d&&(p.buf[p.pos++]=127&d|((d>>>=7)?128:0),d&&(p.buf[p.pos++]=127&d|((d>>>=7)?128:0),d&&(p.buf[p.pos++]=127&d)))))}(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,d){for(var p,m,_=0;_<l.length;_++){if((p=l.charCodeAt(_))>55295&&p<57344){if(!m){p>56319||_+1===l.length?(s[d++]=239,s[d++]=191,s[d++]=189):m=p;continue}if(p<56320){s[d++]=239,s[d++]=191,s[d++]=189,m=p;continue}p=m-55296<<10|p-56320|65536,m=null}else m&&(s[d++]=239,s[d++]=191,s[d++]=189,m=null);p<128?s[d++]=p:(p<2048?s[d++]=p>>6|192:(p<65536?s[d++]=p>>12|224:(s[d++]=p>>18|240,s[d++]=p>>12&63|128),s[d++]=p>>6&63|128),s[d++]=63&p|128)}return d}(this.buf,i,this.pos);var r=this.pos-e;r>=128&&Rd(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(i){this.realloc(4),zd(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),zd(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&&Rd(r,s,this),this.pos=r-1,this.writeVarint(s),this.pos+=s},writeMessage:function(i,e,r){this.writeTag(i,Tt.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(i,e){e.length&&this.writeMessage(i,wy,e)},writePackedSVarint:function(i,e){e.length&&this.writeMessage(i,Sy,e)},writePackedBoolean:function(i,e){e.length&&this.writeMessage(i,Iy,e)},writePackedFloat:function(i,e){e.length&&this.writeMessage(i,Ty,e)},writePackedDouble:function(i,e){e.length&&this.writeMessage(i,ky,e)},writePackedFixed32:function(i,e){e.length&&this.writeMessage(i,Cy,e)},writePackedSFixed32:function(i,e){e.length&&this.writeMessage(i,Ey,e)},writePackedFixed64:function(i,e){e.length&&this.writeMessage(i,Py,e)},writePackedSFixed64:function(i,e){e.length&&this.writeMessage(i,Ay,e)},writeBytesField:function(i,e){this.writeTag(i,Tt.Bytes),this.writeBytes(e)},writeFixed32Field:function(i,e){this.writeTag(i,Tt.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(i,e){this.writeTag(i,Tt.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(i,e){this.writeTag(i,Tt.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(i,e){this.writeTag(i,Tt.Fixed64),this.writeSFixed64(e)},writeVarintField:function(i,e){this.writeTag(i,Tt.Varint),this.writeVarint(e)},writeSVarintField:function(i,e){this.writeTag(i,Tt.Varint),this.writeSVarint(e)},writeStringField:function(i,e){this.writeTag(i,Tt.Bytes),this.writeString(e)},writeFloatField:function(i,e){this.writeTag(i,Tt.Fixed32),this.writeFloat(e)},writeDoubleField:function(i,e){this.writeTag(i,Tt.Fixed64),this.writeDouble(e)},writeBooleanField:function(i,e){this.writeVarintField(i,!!e)}};var Sh=fe(Ad);const Th=3;function My(i,e,r){i===1&&r.readMessage(zy,e)}function zy(i,e,r){if(i===3){const{id:s,bitmap:l,width:d,height:p,left:m,top:_,advance:x}=r.readMessage(Dy,{});e.push({id:s,bitmap:new qa({width:d+2*Th,height:p+2*Th},l),metrics:{width:d,height:p,left:m,top:_,advance:x}})}}function Dy(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 Fd=Th;function Od(i){let e=0,r=0;for(const p of i)e+=p.w*p.h,r=Math.max(r,p.w);i.sort((p,m)=>m.h-p.h);const s=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}];let l=0,d=0;for(const p of i)for(let m=s.length-1;m>=0;m--){const _=s[m];if(!(p.w>_.w||p.h>_.h)){if(p.x=_.x,p.y=_.y,d=Math.max(d,p.y+p.h),l=Math.max(l,p.x+p.w),p.w===_.w&&p.h===_.h){const x=s.pop();m<s.length&&(s[m]=x)}else p.h===_.h?(_.x+=p.w,_.w-=p.w):p.w===_.w?(_.y+=p.h,_.h-=p.h):(s.push({x:_.x+p.w,y:_.y,w:_.w-p.w,h:p.h}),_.y+=p.h,_.h-=p.h);break}}return{w:l,h:d,fill:e/(l*d)||0}}const Zi=1;class kh{constructor(e,{pixelRatio:r,version:s,stretchX:l,stretchY:d,content:p,textFitWidth:m,textFitHeight:_}){this.paddedRect=e,this.pixelRatio=r,this.stretchX=l,this.stretchY=d,this.content=p,this.version=s,this.textFitWidth=m,this.textFitHeight=_}get tl(){return[this.paddedRect.x+Zi,this.paddedRect.y+Zi]}get br(){return[this.paddedRect.x+this.paddedRect.w-Zi,this.paddedRect.y+this.paddedRect.h-Zi]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2*Zi)/this.pixelRatio,(this.paddedRect.h-2*Zi)/this.pixelRatio]}}class Vd{constructor(e,r){const s={},l={};this.haveRenderCallbacks=[];const d=[];this.addImages(e,s,d),this.addImages(r,l,d);const{w:p,h:m}=Od(d),_=new ar({width:p||1,height:m||1});for(const x in e){const S=e[x],I=s[x].paddedRect;ar.copy(S.data,_,{x:0,y:0},{x:I.x+Zi,y:I.y+Zi},S.data)}for(const x in r){const S=r[x],I=l[x].paddedRect,A=I.x+Zi,D=I.y+Zi,B=S.data.width,O=S.data.height;ar.copy(S.data,_,{x:0,y:0},{x:A,y:D},S.data),ar.copy(S.data,_,{x:0,y:O-1},{x:A,y:D-1},{width:B,height:1}),ar.copy(S.data,_,{x:0,y:0},{x:A,y:D+O},{width:B,height:1}),ar.copy(S.data,_,{x:B-1,y:0},{x:A-1,y:D},{width:1,height:O}),ar.copy(S.data,_,{x:0,y:0},{x:A+B,y:D},{width:1,height:O})}this.image=_,this.iconPositions=s,this.patternPositions=l}addImages(e,r,s){for(const l in e){const d=e[l],p={x:0,y:0,w:d.data.width+2*Zi,h:d.data.height+2*Zi};s.push(p),r[l]=new kh(p,d),d.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,d]=e.tl;s.update(r.data,void 0,{x:l,y:d})}}var Jn;Fe("ImagePosition",kh),Fe("ImageAtlas",Vd),T.ai=void 0,(Jn=T.ai||(T.ai={}))[Jn.none=0]="none",Jn[Jn.horizontal=1]="horizontal",Jn[Jn.vertical=2]="vertical",Jn[Jn.horizontalOnly=3]="horizontalOnly";const Ka=-17;class Ya{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(e,r){const s=new Ya;return s.scale=e||1,s.fontStack=r,s}static forImage(e){const r=new Ya;return r.imageName=e,r}}class Do{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,r){const s=new Do;for(let l=0;l<e.sections.length;l++){const d=e.sections[l];d.image?s.addImageSection(d):s.addTextSection(d,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,d=e.charCodeAt(s-1)||null;r+=l&&Xl(l)&&!Ja[e[s+1]]||d&&Xl(d)&&!Ja[e[s-1]]||!Ja[e[s]]?e[s]:Ja[e[s]]}return r}(this.text)}trim(){let e=0;for(let s=0;s<this.text.length&&uc[this.text.charCodeAt(s)];s++)e++;let r=this.text.length;for(let s=this.text.length-1;s>=0&&s>=e&&uc[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 Do;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(Ya.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 li("Can't add FormattedSection with an empty image.");const s=this.getNextImageSectionCharCode();s?(this.text+=String.fromCharCode(s),this.sections.push(Ya.forImage(r)),this.sectionIndex.push(this.sections.length-1)):li("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function hc(i,e,r,s,l,d,p,m,_,x,S,I,A,D,B){const O=Do.fromFeature(i,l);let q;I===T.ai.vertical&&O.verticalizePunctuation();const{processBidirectionalText:J,processStyledBidirectionalText:ae}=Yr;if(J&&O.sections.length===1){q=[];const de=J(O.toString(),Ih(O,x,d,e,s,D));for(const be of de){const Le=new Do;Le.text=be,Le.sections=O.sections;for(let We=0;We<be.length;We++)Le.sectionIndex.push(0);q.push(Le)}}else if(ae){q=[];const de=ae(O.text,O.sectionIndex,Ih(O,x,d,e,s,D));for(const be of de){const Le=new Do;Le.text=be[0],Le.sectionIndex=be[1],Le.sections=O.sections,q.push(Le)}}else q=function(de,be){const Le=[],We=de.text;let Me=0;for(const Pe of be)Le.push(de.substring(Me,Pe)),Me=Pe;return Me<We.length&&Le.push(de.substring(Me,We.length)),Le}(O,Ih(O,x,d,e,s,D));const Q=[],re={positionedLines:Q,text:O.toString(),top:S[1],bottom:S[1],left:S[0],right:S[0],writingMode:I,iconsInText:!1,verticalizable:!1};return function(de,be,Le,We,Me,Pe,Ue,Ve,Be,_e,Ze,$e){let et=0,It=Ka,kt=0,ni=0;const wr=Ve==="right"?1:Ve==="left"?0:.5;let yi=0;for(const Ht of Me){Ht.trim();const si=Ht.getMaxScale(),Ii=(si-1)*ii,xi={positionedGlyphs:[],lineOffset:0};de.positionedLines[yi]=xi;const Bi=xi.positionedGlyphs;let vi=0;if(!Ht.length()){It+=Pe,++yi;continue}for(let Gi=0;Gi<Ht.length();Gi++){const _t=Ht.getSection(Gi),At=Ht.getSectionIndex(Gi),Bt=Ht.getCharCode(Gi);let Ki=0,qt=null,Fo=null,rn=null,nn=ii;const Sr=!(Be===T.ai.horizontal||!Ze&&!Da(Bt)||Ze&&(uc[Bt]||(Gt=Bt,ze.Arabic(Gt)||ze["Arabic Supplement"](Gt)||ze["Arabic Extended-A"](Gt)||ze["Arabic Presentation Forms-A"](Gt)||ze["Arabic Presentation Forms-B"](Gt))));if(_t.imageName){const hr=We[_t.imageName];if(!hr)continue;rn=_t.imageName,de.iconsInText=de.iconsInText||!0,Fo=hr.paddedRect;const ai=hr.displaySize;_t.scale=_t.scale*ii/$e,qt={width:ai[0],height:ai[1],left:Zi,top:-Fd,advance:Sr?ai[1]:ai[0]},Ki=Ii+(ii-ai[1]*_t.scale),nn=qt.advance;const Tn=Sr?ai[0]*_t.scale-ii*si:ai[1]*_t.scale-ii*si;Tn>0&&Tn>vi&&(vi=Tn)}else{const hr=Le[_t.fontStack],ai=hr&&hr[Bt];if(ai&&ai.rect)Fo=ai.rect,qt=ai.metrics;else{const Tn=be[_t.fontStack],rl=Tn&&Tn[Bt];if(!rl)continue;qt=rl.metrics}Ki=(si-_t.scale)*ii}Sr?(de.verticalizable=!0,Bi.push({glyph:Bt,imageName:rn,x:et,y:It+Ki,vertical:Sr,scale:_t.scale,fontStack:_t.fontStack,sectionIndex:At,metrics:qt,rect:Fo}),et+=nn*_t.scale+_e):(Bi.push({glyph:Bt,imageName:rn,x:et,y:It+Ki,vertical:Sr,scale:_t.scale,fontStack:_t.fontStack,sectionIndex:At,metrics:qt,rect:Fo}),et+=qt.advance*_t.scale+_e)}Bi.length!==0&&(kt=Math.max(et-_e,kt),Fy(Bi,0,Bi.length-1,wr,vi)),et=0;const cr=Pe*si+vi;xi.lineOffset=Math.max(vi,Ii),It+=cr,ni=Math.max(cr,ni),++yi}var Gt;const Di=It-Ka,{horizontalAlign:Li,verticalAlign:Ri}=Ch(Ue);(function(Ht,si,Ii,xi,Bi,vi,cr,Gi,_t){const At=(si-Ii)*Bi;let Bt=0;Bt=vi!==cr?-Gi*xi-Ka:(-xi*_t+.5)*cr;for(const Ki of Ht)for(const qt of Ki.positionedGlyphs)qt.x+=At,qt.y+=Bt})(de.positionedLines,wr,Li,Ri,kt,ni,Pe,Di,Me.length),de.top+=-Ri*Di,de.bottom=de.top+Di,de.left+=-Li*kt,de.right=de.left+kt}(re,e,r,s,q,p,m,_,I,x,A,B),!function(de){for(const be of de)if(be.positionedGlyphs.length!==0)return!1;return!0}(Q)&&re}const uc={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Ly={10:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},Ry={40:!0};function Nd(i,e,r,s,l,d){if(e.imageName){const p=s[e.imageName];return p?p.displaySize[0]*e.scale*ii/d+l:0}{const p=r[e.fontStack],m=p&&p[i];return m?m.metrics.advance*e.scale+l:0}}function $d(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 By(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 jd(i,e,r,s,l,d){let p=null,m=$d(e,r,l,d);for(const _ of s){const x=$d(e-_.x,r,l,d)+_.badness;x<=m&&(p=_,m=x)}return{index:i,x:e,priorBreak:p,badness:m}}function Ud(i){return i?Ud(i.priorBreak).concat(i.index):[]}function Ih(i,e,r,s,l,d){if(!i)return[];const p=[],m=function(I,A,D,B,O,q){let J=0;for(let ae=0;ae<I.length();ae++){const Q=I.getSection(ae);J+=Nd(I.getCharCode(ae),Q,B,O,A,q)}return J/Math.max(1,Math.ceil(J/D))}(i,e,r,s,l,d),_=i.text.indexOf("")>=0;let x=0;for(let I=0;I<i.length();I++){const A=i.getSection(I),D=i.getCharCode(I);if(uc[D]||(x+=Nd(D,A,s,l,e,d)),I<i.length()-1){const B=!((S=D)<11904||!(ze["Bopomofo Extended"](S)||ze.Bopomofo(S)||ze["CJK Compatibility Forms"](S)||ze["CJK Compatibility Ideographs"](S)||ze["CJK Compatibility"](S)||ze["CJK Radicals Supplement"](S)||ze["CJK Strokes"](S)||ze["CJK Symbols and Punctuation"](S)||ze["CJK Unified Ideographs Extension A"](S)||ze["CJK Unified Ideographs"](S)||ze["Enclosed CJK Letters and Months"](S)||ze["Halfwidth and Fullwidth Forms"](S)||ze.Hiragana(S)||ze["Ideographic Description Characters"](S)||ze["Kangxi Radicals"](S)||ze["Katakana Phonetic Extensions"](S)||ze.Katakana(S)||ze["Vertical Forms"](S)||ze["Yi Radicals"](S)||ze["Yi Syllables"](S)));(Ly[D]||B||A.imageName||I!==i.length()-2&&Ry[i.getCharCode(I+1)])&&p.push(jd(I+1,x,m,p,By(D,i.getCharCode(I+1),B&&_),!1))}}var S;return Ud(jd(i.length(),x,m,p,0,!0))}function Ch(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 Fy(i,e,r,s,l){if(!s&&!l)return;const d=i[r],p=(i[r].x+d.metrics.advance*d.scale)*s;for(let m=e;m<=r;m++)i[m].x-=p,i[m].y+=l}function Oy(i,e,r){const{horizontalAlign:s,verticalAlign:l}=Ch(r),d=e[0]-i.displaySize[0]*s,p=e[1]-i.displaySize[1]*l;return{image:i,top:p,bottom:p+i.displaySize[1],left:d,right:d+i.displaySize[0]}}function qd(i){var e,r;let s=i.left,l=i.top,d=i.right-s,p=i.bottom-l;const m=(e=i.image.textFitWidth)!==null&&e!==void 0?e:"stretchOrShrink",_=(r=i.image.textFitHeight)!==null&&r!==void 0?r:"stretchOrShrink",x=(i.image.content[2]-i.image.content[0])/(i.image.content[3]-i.image.content[1]);if(_==="proportional"){if(m==="stretchOnly"&&d/p<x||m==="proportional"){const S=Math.ceil(p*x);s*=S/d,d=S}}else if(m==="proportional"&&_==="stretchOnly"&&x!==0&&d/p>x){const S=Math.ceil(d/x);l*=S/p,p=S}return{x1:s,y1:l,x2:s+d,y2:l+p}}function Zd(i,e,r,s,l,d){const p=i.image;let m;if(p.content){const q=p.content,J=p.pixelRatio||1;m=[q[0]/J,q[1]/J,p.displaySize[0]-q[2]/J,p.displaySize[1]-q[3]/J]}const _=e.left*d,x=e.right*d;let S,I,A,D;r==="width"||r==="both"?(D=l[0]+_-s[3],I=l[0]+x+s[1]):(D=l[0]+(_+x-p.displaySize[0])/2,I=D+p.displaySize[0]);const B=e.top*d,O=e.bottom*d;return r==="height"||r==="both"?(S=l[1]+B-s[0],A=l[1]+O+s[2]):(S=l[1]+(B+O-p.displaySize[1])/2,A=S+p.displaySize[1]),{image:p,top:S,right:I,bottom:A,left:D,collisionPadding:m}}const Qa=255,tn=128,Kn=Qa*tn;function Gd(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 d=0;for(;d<s.length&&s[d]<=i;)d++;d=Math.max(0,d-1);let p=d;for(;p<s.length&&s[p]<i+1;)p++;p=Math.min(s.length-1,p);const m=s[d],_=s[p];return r.kind==="composite"?{kind:"composite",minZoom:m,maxZoom:_,interpolationType:l}:{kind:"camera",minZoom:m,maxZoom:_,minSize:r.evaluate(new Pt(m)),maxSize:r.evaluate(new Pt(_)),interpolationType:l}}}function Eh(i,e,r){let s="never";const l=i.get(e);return l?s=l:i.get(r)&&(s="always"),s}const Vy=Wn.VectorTileFeature.types,Ny=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function dc(i,e,r,s,l,d,p,m,_,x,S,I,A){const D=m?Math.min(Kn,Math.round(m[0])):0,B=m?Math.min(Kn,Math.round(m[1])):0;i.emplaceBack(e,r,Math.round(32*s),Math.round(32*l),d,p,(D<<1)+(_?1:0),B,16*x,16*S,256*I,256*A)}function Ph(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 $y(i){for(const e of i.sections)if(La(e.text))return!0;return!1}class Ah{constructor(e){this.layoutVertexArray=new or,this.indexArray=new ri,this.programConfigurations=e,this.segments=new ti,this.dynamicLayoutVertexArray=new Qr,this.opacityVertexArray=new Zn,this.hasVisibleVertices=!1,this.placedSymbolArray=new Lt}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,_y.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,yy.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,Ny,!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())}}Fe("SymbolBuffers",Ah);class Mh{constructor(e,r,s){this.layoutVertexArray=new e,this.layoutAttributes=r,this.indexArray=new s,this.segments=new ti,this.collisionVertexArray=new gi}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,xy.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}Fe("CollisionBuffers",Mh);class Lo{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(p=>p.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=uh([]),this.placementViewportMatrix=uh([]);const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Gd(this.zoom,r["text-size"]),this.iconSizeData=Gd(this.zoom,r["icon-size"]);const s=this.layers[0].layout,l=s.get("symbol-sort-key"),d=s.get("symbol-z-order");this.canOverlap=Eh(s,"text-overlap","text-allow-overlap")!=="never"||Eh(s,"icon-overlap","icon-allow-overlap")!=="never"||s.get("text-ignore-placement")||s.get("icon-ignore-placement"),this.sortFeaturesByKey=d!=="viewport-y"&&!l.isConstant(),this.sortFeaturesByY=(d==="viewport-y"||d==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,s.get("symbol-placement")==="point"&&(this.writingModes=s.get("text-writing-mode").map(p=>T.ai[p])),this.stateDependentLayerIds=this.layers.filter(p=>p.isStateDependent()).map(p=>p.id),this.sourceID=e.sourceID}createArrays(){this.text=new Ah(new Ds(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new Ah(new Ds(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new Rt,this.lineVertexArray=new Mi,this.symbolInstances=new nr,this.textAnchorOffsets=new pi}calculateGlyphDependencies(e,r,s,l,d){for(let p=0;p<e.length;p++)if(r[e.charCodeAt(p)]=!0,(s||l)&&d){const m=Ja[e.charAt(p)];m&&(r[m.charCodeAt(0)]=!0)}}populate(e,r,s){const l=this.layers[0],d=l.layout,p=d.get("text-font"),m=d.get("text-field"),_=d.get("icon-image"),x=(m.value.kind!=="constant"||m.value.value instanceof Vi&&!m.value.value.isEmpty()||m.value.value.toString().length>0)&&(p.value.kind!=="constant"||p.value.value.length>0),S=_.value.kind!=="constant"||!!_.value.value||Object.keys(_.parameters).length>0,I=d.get("symbol-sort-key");if(this.features=[],!x&&!S)return;const A=r.iconDependencies,D=r.glyphDependencies,B=r.availableImages,O=new Pt(this.zoom);for(const{feature:q,id:J,index:ae,sourceLayerIndex:Q}of e){const re=l._featureFilter.needGeometry,de=Rs(q,re);if(!l._featureFilter.filter(O,de,s))continue;let be,Le;if(re||(de.geometry=Ls(q)),x){const Me=l.getValueAndResolveTokens("text-field",de,s,B),Pe=Vi.factory(Me),Ue=this.hasRTLText=this.hasRTLText||$y(Pe);(!Ue||Yr.getRTLTextPluginStatus()==="unavailable"||Ue&&Yr.isParsed())&&(be=by(Pe,l,de))}if(S){const Me=l.getValueAndResolveTokens("icon-image",de,s,B);Le=Me instanceof ui?Me:ui.fromString(Me)}if(!be&&!Le)continue;const We=this.sortFeaturesByKey?I.evaluate(de,{},s):void 0;if(this.features.push({id:J,text:be,icon:Le,index:ae,sourceLayerIndex:Q,geometry:de.geometry,properties:q.properties,type:Vy[q.type],sortKey:We}),Le&&(A[Le.name]=!0),be){const Me=p.evaluate(de,{},s).join(","),Pe=d.get("text-rotation-alignment")!=="viewport"&&d.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(T.ai.vertical)>=0;for(const Ue of be.sections)if(Ue.image)A[Ue.image.name]=!0;else{const Ve=za(be.toString()),Be=Ue.fontStack||Me,_e=D[Be]=D[Be]||{};this.calculateGlyphDependencies(Ue.text,_e,Pe,this.allowVerticalPlacement,Ve)}}}d.get("symbol-placement")==="line"&&(this.features=function(q){const J={},ae={},Q=[];let re=0;function de(Me){Q.push(q[Me]),re++}function be(Me,Pe,Ue){const Ve=ae[Me];return delete ae[Me],ae[Pe]=Ve,Q[Ve].geometry[0].pop(),Q[Ve].geometry[0]=Q[Ve].geometry[0].concat(Ue[0]),Ve}function Le(Me,Pe,Ue){const Ve=J[Pe];return delete J[Pe],J[Me]=Ve,Q[Ve].geometry[0].shift(),Q[Ve].geometry[0]=Ue[0].concat(Q[Ve].geometry[0]),Ve}function We(Me,Pe,Ue){const Ve=Ue?Pe[0][Pe[0].length-1]:Pe[0][0];return`${Me}:${Ve.x}:${Ve.y}`}for(let Me=0;Me<q.length;Me++){const Pe=q[Me],Ue=Pe.geometry,Ve=Pe.text?Pe.text.toString():null;if(!Ve){de(Me);continue}const Be=We(Ve,Ue),_e=We(Ve,Ue,!0);if(Be in ae&&_e in J&&ae[Be]!==J[_e]){const Ze=Le(Be,_e,Ue),$e=be(Be,_e,Q[Ze].geometry);delete J[Be],delete ae[_e],ae[We(Ve,Q[$e].geometry,!0)]=$e,Q[Ze].geometry=null}else Be in ae?be(Be,_e,Ue):_e in J?Le(Be,_e,Ue):(de(Me),J[Be]=re-1,ae[_e]=re-1)}return Q.filter(Me=>Me.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((q,J)=>q.sortKey-J.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]),d=e.dist(r[e.segment]);const p={};for(let m=e.segment+1;m<r.length;m++)p[m]={x:r[m].x,y:r[m].y,tileUnitDistanceFromAnchor:l},m<r.length-1&&(l+=r[m+1].dist(r[m]));for(let m=e.segment||0;m>=0;m--)p[m]={x:r[m].x,y:r[m].y,tileUnitDistanceFromAnchor:d},m>0&&(d+=r[m-1].dist(r[m]));for(let m=0;m<r.length;m++){const _=p[m];this.lineVertexArray.emplaceBack(_.x,_.y,_.tileUnitDistanceFromAnchor)}}return{lineStartIndex:s,lineLength:this.lineVertexArray.length-s}}addSymbols(e,r,s,l,d,p,m,_,x,S,I,A){const D=e.indexArray,B=e.layoutVertexArray,O=e.segments.prepareSegment(4*r.length,B,D,this.canOverlap?p.sortKey:void 0),q=this.glyphOffsetArray.length,J=O.vertexLength,ae=this.allowVerticalPlacement&&m===T.ai.vertical?Math.PI/2:0,Q=p.text&&p.text.sections;for(let re=0;re<r.length;re++){const{tl:de,tr:be,bl:Le,br:We,tex:Me,pixelOffsetTL:Pe,pixelOffsetBR:Ue,minFontScaleX:Ve,minFontScaleY:Be,glyphOffset:_e,isSDF:Ze,sectionIndex:$e}=r[re],et=O.vertexLength,It=_e[1];dc(B,_.x,_.y,de.x,It+de.y,Me.x,Me.y,s,Ze,Pe.x,Pe.y,Ve,Be),dc(B,_.x,_.y,be.x,It+be.y,Me.x+Me.w,Me.y,s,Ze,Ue.x,Pe.y,Ve,Be),dc(B,_.x,_.y,Le.x,It+Le.y,Me.x,Me.y+Me.h,s,Ze,Pe.x,Ue.y,Ve,Be),dc(B,_.x,_.y,We.x,It+We.y,Me.x+Me.w,Me.y+Me.h,s,Ze,Ue.x,Ue.y,Ve,Be),Ph(e.dynamicLayoutVertexArray,_,ae),D.emplaceBack(et,et+1,et+2),D.emplaceBack(et+1,et+2,et+3),O.vertexLength+=4,O.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(_e[0]),re!==r.length-1&&$e===r[re+1].sectionIndex||e.programConfigurations.populatePaintArrays(B.length,p,p.index,{},A,Q&&Q[$e])}e.placedSymbolArray.emplaceBack(_.x,_.y,q,this.glyphOffsetArray.length-q,J,x,S,_.segment,s?s[0]:0,s?s[1]:0,l[0],l[1],m,0,!1,0,I)}_addCollisionDebugVertex(e,r,s,l,d,p){return r.emplaceBack(0,0),e.emplaceBack(s.x,s.y,l,d,Math.round(p.x),Math.round(p.y))}addCollisionDebugVertices(e,r,s,l,d,p,m){const _=d.segments.prepareSegment(4,d.layoutVertexArray,d.indexArray),x=_.vertexLength,S=d.layoutVertexArray,I=d.collisionVertexArray,A=m.anchorX,D=m.anchorY;this._addCollisionDebugVertex(S,I,p,A,D,new le(e,r)),this._addCollisionDebugVertex(S,I,p,A,D,new le(s,r)),this._addCollisionDebugVertex(S,I,p,A,D,new le(s,l)),this._addCollisionDebugVertex(S,I,p,A,D,new le(e,l)),_.vertexLength+=4;const B=d.indexArray;B.emplaceBack(x,x+1),B.emplaceBack(x+1,x+2),B.emplaceBack(x+2,x+3),B.emplaceBack(x+3,x),_.primitiveLength+=4}addDebugCollisionBoxes(e,r,s,l){for(let d=e;d<r;d++){const p=this.collisionBoxArray.get(d);this.addCollisionDebugVertices(p.x1,p.y1,p.x2,p.y2,l?this.textCollisionBox:this.iconCollisionBox,p.anchorPoint,s)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Mh(mi,Pd.members,Nt),this.iconCollisionBox=new Mh(mi,Pd.members,Nt);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,d,p,m,_,x){const S={};for(let I=r;I<s;I++){const A=e.get(I);S.textBox={x1:A.x1,y1:A.y1,x2:A.x2,y2:A.y2,anchorPointX:A.anchorPointX,anchorPointY:A.anchorPointY},S.textFeatureIndex=A.featureIndex;break}for(let I=l;I<d;I++){const A=e.get(I);S.verticalTextBox={x1:A.x1,y1:A.y1,x2:A.x2,y2:A.y2,anchorPointX:A.anchorPointX,anchorPointY:A.anchorPointY},S.verticalTextFeatureIndex=A.featureIndex;break}for(let I=p;I<m;I++){const A=e.get(I);S.iconBox={x1:A.x1,y1:A.y1,x2:A.x2,y2:A.y2,anchorPointX:A.anchorPointX,anchorPointY:A.anchorPointY},S.iconFeatureIndex=A.featureIndex;break}for(let I=_;I<x;I++){const A=e.get(I);S.verticalIconBox={x1:A.x1,y1:A.y1,x2:A.x2,y2:A.y2,anchorPointX:A.anchorPointX,anchorPointY:A.anchorPointY},S.verticalIconFeatureIndex=A.featureIndex;break}return S}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 d=s.vertexStartIndex;d<l;d+=4)e.indexArray.emplaceBack(d,d+1,d+2),e.indexArray.emplaceBack(d+1,d+2,d+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const r=Math.sin(e),s=Math.cos(e),l=[],d=[],p=[];for(let m=0;m<this.symbolInstances.length;++m){p.push(m);const _=this.symbolInstances.get(m);l.push(0|Math.round(r*_.anchorX+s*_.anchorY)),d.push(_.featureIndex)}return p.sort((m,_)=>l[m]-l[_]||d[_]-d[m]),p}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,d,p)=>{l>=0&&p.indexOf(l)===d&&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 Hd,Xd;Fe("SymbolBucket",Lo,{omit:["layers","collisionBoxArray","features","compareText"]}),Lo.MAX_GLYPHS=65535,Lo.addDynamicAttributes=Ph;var zh={get paint(){return Xd=Xd||new o({"icon-opacity":new Je(ue.paint_symbol["icon-opacity"]),"icon-color":new Je(ue.paint_symbol["icon-color"]),"icon-halo-color":new Je(ue.paint_symbol["icon-halo-color"]),"icon-halo-width":new Je(ue.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Je(ue.paint_symbol["icon-halo-blur"]),"icon-translate":new qe(ue.paint_symbol["icon-translate"]),"icon-translate-anchor":new qe(ue.paint_symbol["icon-translate-anchor"]),"text-opacity":new Je(ue.paint_symbol["text-opacity"]),"text-color":new Je(ue.paint_symbol["text-color"],{runtimeType:Pi,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new Je(ue.paint_symbol["text-halo-color"]),"text-halo-width":new Je(ue.paint_symbol["text-halo-width"]),"text-halo-blur":new Je(ue.paint_symbol["text-halo-blur"]),"text-translate":new qe(ue.paint_symbol["text-translate"]),"text-translate-anchor":new qe(ue.paint_symbol["text-translate-anchor"])})},get layout(){return Hd=Hd||new o({"symbol-placement":new qe(ue.layout_symbol["symbol-placement"]),"symbol-spacing":new qe(ue.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new qe(ue.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Je(ue.layout_symbol["symbol-sort-key"]),"symbol-z-order":new qe(ue.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new qe(ue.layout_symbol["icon-allow-overlap"]),"icon-overlap":new qe(ue.layout_symbol["icon-overlap"]),"icon-ignore-placement":new qe(ue.layout_symbol["icon-ignore-placement"]),"icon-optional":new qe(ue.layout_symbol["icon-optional"]),"icon-rotation-alignment":new qe(ue.layout_symbol["icon-rotation-alignment"]),"icon-size":new Je(ue.layout_symbol["icon-size"]),"icon-text-fit":new qe(ue.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new qe(ue.layout_symbol["icon-text-fit-padding"]),"icon-image":new Je(ue.layout_symbol["icon-image"]),"icon-rotate":new Je(ue.layout_symbol["icon-rotate"]),"icon-padding":new Je(ue.layout_symbol["icon-padding"]),"icon-keep-upright":new qe(ue.layout_symbol["icon-keep-upright"]),"icon-offset":new Je(ue.layout_symbol["icon-offset"]),"icon-anchor":new Je(ue.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new qe(ue.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new qe(ue.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new qe(ue.layout_symbol["text-rotation-alignment"]),"text-field":new Je(ue.layout_symbol["text-field"]),"text-font":new Je(ue.layout_symbol["text-font"]),"text-size":new Je(ue.layout_symbol["text-size"]),"text-max-width":new Je(ue.layout_symbol["text-max-width"]),"text-line-height":new qe(ue.layout_symbol["text-line-height"]),"text-letter-spacing":new Je(ue.layout_symbol["text-letter-spacing"]),"text-justify":new Je(ue.layout_symbol["text-justify"]),"text-radial-offset":new Je(ue.layout_symbol["text-radial-offset"]),"text-variable-anchor":new qe(ue.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Je(ue.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Je(ue.layout_symbol["text-anchor"]),"text-max-angle":new qe(ue.layout_symbol["text-max-angle"]),"text-writing-mode":new qe(ue.layout_symbol["text-writing-mode"]),"text-rotate":new Je(ue.layout_symbol["text-rotate"]),"text-padding":new qe(ue.layout_symbol["text-padding"]),"text-keep-upright":new qe(ue.layout_symbol["text-keep-upright"]),"text-transform":new Je(ue.layout_symbol["text-transform"]),"text-offset":new Je(ue.layout_symbol["text-offset"]),"text-allow-overlap":new qe(ue.layout_symbol["text-allow-overlap"]),"text-overlap":new qe(ue.layout_symbol["text-overlap"]),"text-ignore-placement":new qe(ue.layout_symbol["text-ignore-placement"]),"text-optional":new qe(ue.layout_symbol["text-optional"])})}};class Wd{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:Zr,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}}Fe("FormatSectionOverride",Wd,{omit:["defaultValue"]});class pc extends h{constructor(e){super(e,zh)}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 d of s)l.indexOf(d)<0&&l.push(d);this.layout._values["text-writing-mode"]=l}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,r,s,l){const d=this.layout.get(e).evaluate(r,{},s,l),p=this._unevaluatedLayout._values[e];return p.isDataDriven()||Ss(p.value)||!d?d:function(m,_){return _.replace(/{([^{}]+)}/g,(x,S)=>m&&S in m?String(m[S]):"")}(r.properties,d)}createBucket(e){return new Lo(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const e of zh.paint.overridableProperties){if(!pc.hasPaintOverride(this.layout,e))continue;const r=this.paint.get(e),s=new Wd(r),l=new po(s,r.property.specification);let d=null;d=r.value.kind==="constant"||r.value.kind==="source"?new ua("source",l):new da("composite",l,r.value.zoomStops),this.paint._values[e]=new br(r.property,d,r.parameters)}}_handleOverridablePaintPropertyUpdate(e,r,s){return!(!this.layout||r.isDataDriven()||s.isDataDriven())&&pc.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,r){const s=e.get("text-field"),l=zh.paint.properties[r];let d=!1;const p=m=>{for(const _ of m)if(l.overrides&&l.overrides.hasOverride(_))return void(d=!0)};if(s.value.kind==="constant"&&s.value.value instanceof Vi)p(s.value.value.sections);else if(s.value.kind==="source"){const m=x=>{d||(x instanceof hn&&Yt(x.value)===Mr?p(x.value.sections):x instanceof Qs?p(x.sections):x.eachChild(m))},_=s.value;_._styleExpression&&m(_._styleExpression.expression)}return d}}let Jd;var jy={get paint(){return Jd=Jd||new o({"background-color":new qe(ue.paint_background["background-color"]),"background-pattern":new t(ue.paint_background["background-pattern"]),"background-opacity":new qe(ue.paint_background["background-opacity"])})}};class Uy extends h{constructor(e){super(e,jy)}}let Kd;var qy={get paint(){return Kd=Kd||new o({"raster-opacity":new qe(ue.paint_raster["raster-opacity"]),"raster-hue-rotate":new qe(ue.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new qe(ue.paint_raster["raster-brightness-min"]),"raster-brightness-max":new qe(ue.paint_raster["raster-brightness-max"]),"raster-saturation":new qe(ue.paint_raster["raster-saturation"]),"raster-contrast":new qe(ue.paint_raster["raster-contrast"]),"raster-resampling":new qe(ue.paint_raster["raster-resampling"]),"raster-fade-duration":new qe(ue.paint_raster["raster-fade-duration"])})}};class Zy extends h{constructor(e){super(e,qy)}}class Gy extends h{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")}}class Hy{constructor(e){this._methodToThrottle=e,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}const Dh=63710088e-1;class Yn{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 Yn(Xt(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,d=Math.sin(s)*Math.sin(l)+Math.cos(s)*Math.cos(l)*Math.cos((e.lng-this.lng)*r);return Dh*Math.acos(Math.min(d,1))}static convert(e){if(e instanceof Yn)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new Yn(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new Yn(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*Dh;function Qd(i){return Yd*Math.cos(i*Math.PI/180)}function ep(i){return(180+i)/360}function tp(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function ip(i,e){return i/Qd(e)}function Lh(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}class fc{constructor(e,r,s=0){this.x=+e,this.y=+r,this.z=+s}static fromLngLat(e,r=0){const s=Yn.convert(e);return new fc(ep(s.lng),tp(s.lat),ip(r,s.lat))}toLngLat(){return new Yn(360*this.x-180,Lh(this.y))}toAltitude(){return this.z*Qd(Lh(this.y))}meterInMercatorCoordinateUnits(){return 1/Yd*(e=Lh(this.y),1/Math.cos(e*Math.PI/180));var e}}function rp(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 Rh{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=el(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=(p=this.y,m=this.z,_=rp(256*(d=this.x),256*(p=Math.pow(2,m)-p-1),m),x=rp(256*(d+1),256*(p+1),m),_[0]+","+_[1]+","+x[0]+","+x[1]);var d,p,m,_,x;const S=function(I,A,D){let B,O="";for(let q=I;q>0;q--)B=1<<q-1,O+=(A&B?1:0)+(D&B?2:0);return O}(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,S).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 le((e.x*r-this.x)*Qt,(e.y*r-this.y)*Qt)}toString(){return`${this.z}/${this.x}/${this.y}`}}class np{constructor(e,r){this.wrap=e,this.canonical=r,this.key=el(e,r.z,r.z,r.x,r.y)}}class lr{constructor(e,r,s,l,d){if(e<s)throw new Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${s}`);this.overscaledZ=e,this.wrap=r,this.canonical=new Rh(s,+l,+d),this.key=el(r,e,s,l,d)}clone(){return new lr(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 lr(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new lr(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?el(this.wrap*+r,e,this.canonical.z,this.canonical.x,this.canonical.y):el(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 lr(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 lr(r,this.wrap,r,s,l),new lr(r,this.wrap,r,s+1,l),new lr(r,this.wrap,r,s,l+1),new lr(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 lr(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new lr(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 np(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new fc(e.x-this.wrap,e.y))}}function el(i,e,r,s,l){(i*=2)<0&&(i=-1*i-1);const d=1<<r;return(d*d*i+d*l+s).toString(36)+r.toString(36)+e.toString(36)}Fe("CanonicalTileID",Rh),Fe("OverscaledTileID",lr,{omit:["posMatrix"]});class sp{constructor(e,r,s,l=1,d=1,p=1,m=0){if(this.uid=e,r.height!==r.width)throw new RangeError("DEM tiles must be square");if(s&&!["mapbox","terrarium","custom"].includes(s))return void li(`"${s}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=r.height;const _=this.dim=r.height-2;switch(this.data=new Uint32Array(r.data.buffer),s){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=l,this.greenFactor=d,this.blueFactor=p,this.baseShift=m;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let x=0;x<_;x++)this.data[this._idx(-1,x)]=this.data[this._idx(0,x)],this.data[this._idx(_,x)]=this.data[this._idx(_-1,x)],this.data[this._idx(x,-1)]=this.data[this._idx(x,0)],this.data[this._idx(x,_)]=this.data[this._idx(x,_-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(_,-1)]=this.data[this._idx(_-1,0)],this.data[this._idx(-1,_)]=this.data[this._idx(0,_-1)],this.data[this._idx(_,_)]=this.data[this._idx(_-1,_-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let x=0;x<_;x++)for(let S=0;S<_;S++){const I=this.get(x,S);I>this.max&&(this.max=I),I<this.min&&(this.min=I)}}get(e,r){const s=new Uint8Array(this.data.buffer),l=4*this._idx(e,r);return this.unpack(s[l],s[l+1],s[l+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_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)}unpack(e,r,s){return e*this.redFactor+r*this.greenFactor+s*this.blueFactor-this.baseShift}getPixels(){return new ar({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,d=r*this.dim+this.dim,p=s*this.dim,m=s*this.dim+this.dim;switch(r){case-1:l=d-1;break;case 1:d=l+1}switch(s){case-1:p=m-1;break;case 1:m=p+1}const _=-r*this.dim,x=-s*this.dim;for(let S=p;S<m;S++)for(let I=l;I<d;I++)this.data[this._idx(I,S)]=e.data[this._idx(I+_,S+x)]}}Fe("DEMData",sp);class op{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 ap{constructor(e,r,s,l,d){this.type="Feature",this._vectorTileFeature=e,e._z=r,e._x=s,e._y=l,this.properties=e.properties,this.id=d}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 lp{constructor(e,r){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new $n(Qt,16,0),this.grid3D=new $n(Qt,16,0),this.featureIndexArray=new sr,this.promoteId=r}insert(e,r,s,l,d,p){const m=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(s,l,d);const _=p?this.grid3D:this.grid;for(let x=0;x<r.length;x++){const S=r[x],I=[1/0,1/0,-1/0,-1/0];for(let A=0;A<S.length;A++){const D=S[A];I[0]=Math.min(I[0],D.x),I[1]=Math.min(I[1],D.y),I[2]=Math.max(I[2],D.x),I[3]=Math.max(I[3],D.y)}I[0]<Qt&&I[1]<Qt&&I[2]>=0&&I[3]>=0&&_.insert(m,I[0],I[1],I[2],I[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Wn.VectorTile(new Sh(this.rawTileData)).layers,this.sourceLayerCoder=new op(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,r,s,l){this.loadVTLayers();const d=e.params||{},p=Qt/e.tileSize/e.scale,m=Ti(d.filter),_=e.queryGeometry,x=e.queryPadding*p,S=hp(_),I=this.grid.query(S.minX-x,S.minY-x,S.maxX+x,S.maxY+x),A=hp(e.cameraQueryGeometry),D=this.grid3D.query(A.minX-x,A.minY-x,A.maxX+x,A.maxY+x,(q,J,ae,Q)=>function(re,de,be,Le,We){for(const Pe of re)if(de<=Pe.x&&be<=Pe.y&&Le>=Pe.x&&We>=Pe.y)return!0;const Me=[new le(de,be),new le(de,We),new le(Le,We),new le(Le,be)];if(re.length>2){for(const Pe of Me)if(Co(re,Pe))return!0}for(let Pe=0;Pe<re.length-1;Pe++)if(C_(re[Pe],re[Pe+1],Me))return!0;return!1}(e.cameraQueryGeometry,q-x,J-x,ae+x,Q+x));for(const q of D)I.push(q);I.sort(Xy);const B={};let O;for(let q=0;q<I.length;q++){const J=I[q];if(J===O)continue;O=J;const ae=this.featureIndexArray.get(J);let Q=null;this.loadMatchingFeature(B,ae.bucketIndex,ae.sourceLayerIndex,ae.featureIndex,m,d.layers,d.availableImages,r,s,l,(re,de,be)=>(Q||(Q=Ls(re)),de.queryIntersectsFeature(_,re,be,Q,this.z,e.transform,p,e.pixelPosMatrix)))}return B}loadMatchingFeature(e,r,s,l,d,p,m,_,x,S,I){const A=this.bucketLayerIDs[r];if(p&&!function(q,J){for(let ae=0;ae<q.length;ae++)if(J.indexOf(q[ae])>=0)return!0;return!1}(p,A))return;const D=this.sourceLayerCoder.decode(s),B=this.vtLayers[D].feature(l);if(d.needGeometry){const q=Rs(B,!0);if(!d.filter(new Pt(this.tileID.overscaledZ),q,this.tileID.canonical))return}else if(!d.filter(new Pt(this.tileID.overscaledZ),B))return;const O=this.getId(B,D);for(let q=0;q<A.length;q++){const J=A[q];if(p&&p.indexOf(J)<0)continue;const ae=_[J];if(!ae)continue;let Q={};O&&S&&(Q=S.getState(ae.sourceLayer||"_geojsonTileLayer",O));const re=$t({},x[J]);re.paint=cp(re.paint,ae.paint,B,Q,m),re.layout=cp(re.layout,ae.layout,B,Q,m);const de=!I||I(B,ae,Q);if(!de)continue;const be=new ap(B,this.z,this.x,this.y,O);be.layer=re;let Le=e[J];Le===void 0&&(Le=e[J]=[]),Le.push({featureIndex:l,feature:be,intersectionZ:de})}}lookupSymbolFeatures(e,r,s,l,d,p,m,_){const x={};this.loadVTLayers();const S=Ti(d);for(const I of e)this.loadMatchingFeature(x,s,l,I,S,p,m,_,r);return x}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 cp(i,e,r,s,l){return bi(i,(d,p)=>{const m=e instanceof vo?e.get(p):null;return m&&m.evaluate?m.evaluate(r,s,l):m})}function hp(i){let e=1/0,r=1/0,s=-1/0,l=-1/0;for(const d of i)e=Math.min(e,d.x),r=Math.min(r,d.y),s=Math.max(s,d.x),l=Math.max(l,d.y);return{minX:e,minY:r,maxX:s,maxY:l}}function Xy(i,e){return e-i}function up(i,e,r,s,l){const d=[];for(let p=0;p<i.length;p++){const m=i[p];let _;for(let x=0;x<m.length-1;x++){let S=m[x],I=m[x+1];S.x<e&&I.x<e||(S.x<e?S=new le(e,S.y+(e-S.x)/(I.x-S.x)*(I.y-S.y))._round():I.x<e&&(I=new le(e,S.y+(e-S.x)/(I.x-S.x)*(I.y-S.y))._round()),S.y<r&&I.y<r||(S.y<r?S=new le(S.x+(r-S.y)/(I.y-S.y)*(I.x-S.x),r)._round():I.y<r&&(I=new le(S.x+(r-S.y)/(I.y-S.y)*(I.x-S.x),r)._round()),S.x>=s&&I.x>=s||(S.x>=s?S=new le(s,S.y+(s-S.x)/(I.x-S.x)*(I.y-S.y))._round():I.x>=s&&(I=new le(s,S.y+(s-S.x)/(I.x-S.x)*(I.y-S.y))._round()),S.y>=l&&I.y>=l||(S.y>=l?S=new le(S.x+(l-S.y)/(I.y-S.y)*(I.x-S.x),l)._round():I.y>=l&&(I=new le(S.x+(l-S.y)/(I.y-S.y)*(I.x-S.x),l)._round()),_&&S.equals(_[_.length-1])||(_=[S],d.push(_)),_.push(I)))))}}return d}Fe("FeatureIndex",lp,{omit:["rawTileData","sourceLayerCoder"]});class Qn extends le{constructor(e,r,s,l){super(e,r),this.angle=s,l!==void 0&&(this.segment=l)}clone(){return new Qn(this.x,this.y,this.angle,this.segment)}}function dp(i,e,r,s,l){if(e.segment===void 0||r===0)return!0;let d=e,p=e.segment+1,m=0;for(;m>-r/2;){if(p--,p<0)return!1;m-=i[p].dist(d),d=i[p]}m+=i[p].dist(i[p+1]),p++;const _=[];let x=0;for(;m<r/2;){const S=i[p],I=i[p+1];if(!I)return!1;let A=i[p-1].angleTo(S)-S.angleTo(I);for(A=Math.abs((A+3*Math.PI)%(2*Math.PI)-Math.PI),_.push({distance:m,angleDelta:A}),x+=A;m-_[0].distance>s;)x-=_.shift().angleDelta;if(x>l)return!1;p++,m+=S.dist(I)}return!0}function pp(i){let e=0;for(let r=0;r<i.length-1;r++)e+=i[r].dist(i[r+1]);return e}function fp(i,e,r){return i?.6*e*r:0}function mp(i,e){return Math.max(i?i.right-i.left:0,e?e.right-e.left:0)}function Wy(i,e,r,s,l,d){const p=fp(r,l,d),m=mp(r,s)*d;let _=0;const x=pp(i)/2;for(let S=0;S<i.length-1;S++){const I=i[S],A=i[S+1],D=I.dist(A);if(_+D>x){const B=(x-_)/D,O=ji.number(I.x,A.x,B),q=ji.number(I.y,A.y,B),J=new Qn(O,q,A.angleTo(I),S);return J._round(),!p||dp(i,J,m,p,e)?J:void 0}_+=D}}function Jy(i,e,r,s,l,d,p,m,_){const x=fp(s,d,p),S=mp(s,l),I=S*p,A=i[0].x===0||i[0].x===_||i[0].y===0||i[0].y===_;return e-I<e/4&&(e=I+e/4),gp(i,A?e/2*m%e:(S/2+2*d)*p*m%e,e,x,r,I,A,!1,_)}function gp(i,e,r,s,l,d,p,m,_){const x=d/2,S=pp(i);let I=0,A=e-r,D=[];for(let B=0;B<i.length-1;B++){const O=i[B],q=i[B+1],J=O.dist(q),ae=q.angleTo(O);for(;A+r<I+J;){A+=r;const Q=(A-I)/J,re=ji.number(O.x,q.x,Q),de=ji.number(O.y,q.y,Q);if(re>=0&&re<_&&de>=0&&de<_&&A-x>=0&&A+x<=S){const be=new Qn(re,de,ae,B);be._round(),s&&!dp(i,be,d,s,l)||D.push(be)}}I+=J}return m||D.length||p||(D=gp(i,I/2,r,s,l,d,p,!0,_)),D}Fe("Anchor",Qn);const Ro=Zi;function _p(i,e,r,s){const l=[],d=i.image,p=d.pixelRatio,m=d.paddedRect.w-2*Ro,_=d.paddedRect.h-2*Ro;let x={x1:i.left,y1:i.top,x2:i.right,y2:i.bottom};const S=d.stretchX||[[0,m]],I=d.stretchY||[[0,_]],A=(_e,Ze)=>_e+Ze[1]-Ze[0],D=S.reduce(A,0),B=I.reduce(A,0),O=m-D,q=_-B;let J=0,ae=D,Q=0,re=B,de=0,be=O,Le=0,We=q;if(d.content&&s){const _e=d.content,Ze=_e[2]-_e[0],$e=_e[3]-_e[1];(d.textFitWidth||d.textFitHeight)&&(x=qd(i)),J=mc(S,0,_e[0]),Q=mc(I,0,_e[1]),ae=mc(S,_e[0],_e[2]),re=mc(I,_e[1],_e[3]),de=_e[0]-J,Le=_e[1]-Q,be=Ze-ae,We=$e-re}const Me=x.x1,Pe=x.y1,Ue=x.x2-Me,Ve=x.y2-Pe,Be=(_e,Ze,$e,et)=>{const It=gc(_e.stretch-J,ae,Ue,Me),kt=_c(_e.fixed-de,be,_e.stretch,D),ni=gc(Ze.stretch-Q,re,Ve,Pe),wr=_c(Ze.fixed-Le,We,Ze.stretch,B),yi=gc($e.stretch-J,ae,Ue,Me),Gt=_c($e.fixed-de,be,$e.stretch,D),Di=gc(et.stretch-Q,re,Ve,Pe),Li=_c(et.fixed-Le,We,et.stretch,B),Ri=new le(It,ni),Ht=new le(yi,ni),si=new le(yi,Di),Ii=new le(It,Di),xi=new le(kt/p,wr/p),Bi=new le(Gt/p,Li/p),vi=e*Math.PI/180;if(vi){const _t=Math.sin(vi),At=Math.cos(vi),Bt=[At,-_t,_t,At];Ri._matMult(Bt),Ht._matMult(Bt),Ii._matMult(Bt),si._matMult(Bt)}const cr=_e.stretch+_e.fixed,Gi=Ze.stretch+Ze.fixed;return{tl:Ri,tr:Ht,bl:Ii,br:si,tex:{x:d.paddedRect.x+Ro+cr,y:d.paddedRect.y+Ro+Gi,w:$e.stretch+$e.fixed-cr,h:et.stretch+et.fixed-Gi},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:xi,pixelOffsetBR:Bi,minFontScaleX:be/p/Ue,minFontScaleY:We/p/Ve,isSDF:r}};if(s&&(d.stretchX||d.stretchY)){const _e=yp(S,O,D),Ze=yp(I,q,B);for(let $e=0;$e<_e.length-1;$e++){const et=_e[$e],It=_e[$e+1];for(let kt=0;kt<Ze.length-1;kt++)l.push(Be(et,Ze[kt],It,Ze[kt+1]))}}else l.push(Be({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:m+1},{fixed:0,stretch:_+1}));return l}function mc(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 yp(i,e,r){const s=[{fixed:-Ro,stretch:0}];for(const[l,d]of i){const p=s[s.length-1];s.push({fixed:l-p.stretch,stretch:p.stretch}),s.push({fixed:l-p.stretch,stretch:p.stretch+(d-l)})}return s.push({fixed:e+Ro,stretch:r}),s}function gc(i,e,r,s){return i/e*r+s}function _c(i,e,r,s){return i-e*r/s}class yc{constructor(e,r,s,l,d,p,m,_,x,S){var I;if(this.boxStartIndex=e.length,x){let A=p.top,D=p.bottom;const B=p.collisionPadding;B&&(A-=B[1],D+=B[3]);let O=D-A;O>0&&(O=Math.max(10,O),this.circleDiameter=O)}else{const A=!((I=p.image)===null||I===void 0)&&I.content&&(p.image.textFitWidth||p.image.textFitHeight)?qd(p):{x1:p.left,y1:p.top,x2:p.right,y2:p.bottom};A.y1=A.y1*m-_[0],A.y2=A.y2*m+_[2],A.x1=A.x1*m-_[3],A.x2=A.x2*m+_[1];const D=p.collisionPadding;if(D&&(A.x1-=D[0]*m,A.y1-=D[1]*m,A.x2+=D[2]*m,A.y2+=D[3]*m),S){const B=new le(A.x1,A.y1),O=new le(A.x2,A.y1),q=new le(A.x1,A.y2),J=new le(A.x2,A.y2),ae=S*Math.PI/180;B._rotate(ae),O._rotate(ae),q._rotate(ae),J._rotate(ae),A.x1=Math.min(B.x,O.x,q.x,J.x),A.x2=Math.max(B.x,O.x,q.x,J.x),A.y1=Math.min(B.y,O.y,q.y,J.y),A.y2=Math.max(B.y,O.y,q.y,J.y)}e.emplaceBack(r.x,r.y,A.x1,A.y1,A.x2,A.y2,s,l,d)}this.boxEndIndex=e.length}}class Ky{constructor(e=[],r=(s,l)=>s<l?-1:s>l?1:0){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._up(this.length++)}pop(){if(this.length===0)return;const e=this.data[0],r=this.data.pop();return--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 d=e-1>>1,p=r[d];if(s(l,p)>=0)break;r[e]=p,e=d}r[e]=l}_down(e){const{data:r,compare:s}=this,l=this.length>>1,d=r[e];for(;e<l;){let p=1+(e<<1);const m=p+1;if(m<this.length&&s(r[m],r[p])<0&&(p=m),s(r[p],d)>=0)break;r[e]=r[p],e=p}r[e]=d}}function Yy(i,e=1,r=!1){let s=1/0,l=1/0,d=-1/0,p=-1/0;const m=i[0];for(let D=0;D<m.length;D++){const B=m[D];(!D||B.x<s)&&(s=B.x),(!D||B.y<l)&&(l=B.y),(!D||B.x>d)&&(d=B.x),(!D||B.y>p)&&(p=B.y)}const _=Math.min(d-s,p-l);let x=_/2;const S=new Ky([],Qy);if(_===0)return new le(s,l);for(let D=s;D<d;D+=_)for(let B=l;B<p;B+=_)S.push(new Bo(D+x,B+x,x,i));let I=function(D){let B=0,O=0,q=0;const J=D[0];for(let ae=0,Q=J.length,re=Q-1;ae<Q;re=ae++){const de=J[ae],be=J[re],Le=de.x*be.y-be.x*de.y;O+=(de.x+be.x)*Le,q+=(de.y+be.y)*Le,B+=3*Le}return new Bo(O/B,q/B,0,D)}(i),A=S.length;for(;S.length;){const D=S.pop();(D.d>I.d||!I.d)&&(I=D,r&&console.log("found best %d after %d probes",Math.round(1e4*D.d)/1e4,A)),D.max-I.d<=e||(x=D.h/2,S.push(new Bo(D.p.x-x,D.p.y-x,x,i)),S.push(new Bo(D.p.x+x,D.p.y-x,x,i)),S.push(new Bo(D.p.x-x,D.p.y+x,x,i)),S.push(new Bo(D.p.x+x,D.p.y+x,x,i)),A+=4)}return r&&(console.log(`num probes: ${A}`),console.log(`best distance: ${I.d}`)),I.p}function Qy(i,e){return e.max-i.max}function Bo(i,e,r,s){this.p=new le(i,e),this.h=r,this.d=function(l,d){let p=!1,m=1/0;for(let _=0;_<d.length;_++){const x=d[_];for(let S=0,I=x.length,A=I-1;S<I;A=S++){const D=x[S],B=x[A];D.y>l.y!=B.y>l.y&&l.x<(B.x-D.x)*(l.y-D.y)/(B.y-D.y)+D.x&&(p=!p),m=Math.min(m,td(l,D,B))}}return(p?1:-1)*Math.sqrt(m)}(this.p,s),this.max=this.d+this.h*Math.SQRT2}var _i;T.ar=void 0,(_i=T.ar||(T.ar={}))[_i.center=1]="center",_i[_i.left=2]="left",_i[_i.right=3]="right",_i[_i.top=4]="top",_i[_i.bottom=5]="bottom",_i[_i["top-left"]=6]="top-left",_i[_i["top-right"]=7]="top-right",_i[_i["bottom-left"]=8]="bottom-left",_i[_i["bottom-right"]=9]="bottom-right";const es=7,Bh=Number.POSITIVE_INFINITY;function xp(i,e){return e[1]!==Bh?function(r,s,l){let d=0,p=0;switch(s=Math.abs(s),l=Math.abs(l),r){case"top-right":case"top-left":case"top":p=l-es;break;case"bottom-right":case"bottom-left":case"bottom":p=-l+es}switch(r){case"top-right":case"bottom-right":case"right":d=-s;break;case"top-left":case"bottom-left":case"left":d=s}return[d,p]}(i,e[0],e[1]):function(r,s){let l=0,d=0;s<0&&(s=0);const p=s/Math.SQRT2;switch(r){case"top-right":case"top-left":d=p-es;break;case"bottom-right":case"bottom-left":d=-p+es;break;case"bottom":d=-s+es;break;case"top":d=s-es}switch(r){case"top-right":case"bottom-right":l=-p;break;case"top-left":case"bottom-left":l=p;break;case"left":l=s;break;case"right":l=-s}return[l,d]}(i,e[0])}function vp(i,e,r){var s;const l=i.layout,d=(s=l.get("text-variable-anchor-offset"))===null||s===void 0?void 0:s.evaluate(e,{},r);if(d){const m=d.values,_=[];for(let x=0;x<m.length;x+=2){const S=_[x]=m[x],I=m[x+1].map(A=>A*ii);S.startsWith("top")?I[1]-=es:S.startsWith("bottom")&&(I[1]+=es),_[x+1]=I}return new $i(_)}const p=l.get("text-variable-anchor");if(p){let m;m=i._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[l.get("text-radial-offset").evaluate(e,{},r)*ii,Bh]:l.get("text-offset").evaluate(e,{},r).map(x=>x*ii);const _=[];for(const x of p)_.push(x,xp(x,m));return new $i(_)}return null}function Fh(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 e0(i,e,r,s,l,d,p,m,_,x,S){let I=d.textMaxSize.evaluate(e,{});I===void 0&&(I=p);const A=i.layers[0].layout,D=A.get("icon-offset").evaluate(e,{},S),B=wp(r.horizontal),O=p/24,q=i.tilePixelRatio*O,J=i.tilePixelRatio*I/24,ae=i.tilePixelRatio*m,Q=i.tilePixelRatio*A.get("symbol-spacing"),re=A.get("text-padding")*i.tilePixelRatio,de=function(_e,Ze,$e,et=1){const It=_e.get("icon-padding").evaluate(Ze,{},$e),kt=It&&It.values;return[kt[0]*et,kt[1]*et,kt[2]*et,kt[3]*et]}(A,e,S,i.tilePixelRatio),be=A.get("text-max-angle")/180*Math.PI,Le=A.get("text-rotation-alignment")!=="viewport"&&A.get("symbol-placement")!=="point",We=A.get("icon-rotation-alignment")==="map"&&A.get("symbol-placement")!=="point",Me=A.get("symbol-placement"),Pe=Q/2,Ue=A.get("icon-text-fit");let Ve;s&&Ue!=="none"&&(i.allowVerticalPlacement&&r.vertical&&(Ve=Zd(s,r.vertical,Ue,A.get("icon-text-fit-padding"),D,O)),B&&(s=Zd(s,B,Ue,A.get("icon-text-fit-padding"),D,O)));const Be=(_e,Ze)=>{Ze.x<0||Ze.x>=Qt||Ze.y<0||Ze.y>=Qt||function($e,et,It,kt,ni,wr,yi,Gt,Di,Li,Ri,Ht,si,Ii,xi,Bi,vi,cr,Gi,_t,At,Bt,Ki,qt,Fo){const rn=$e.addToLineVertexArray(et,It);let nn,Sr,hr,ai,Tn=0,rl=0,Ip=0,Cp=0,Zh=-1,Gh=-1;const kn={};let Ep=ko("");if($e.allowVerticalPlacement&&kt.vertical){const Ci=Gt.layout.get("text-rotate").evaluate(At,{},qt)+90;hr=new yc(Di,et,Li,Ri,Ht,kt.vertical,si,Ii,xi,Ci),yi&&(ai=new yc(Di,et,Li,Ri,Ht,yi,vi,cr,xi,Ci))}if(ni){const Ci=Gt.layout.get("icon-rotate").evaluate(At,{}),ur=Gt.layout.get("icon-text-fit")!=="none",Fs=_p(ni,Ci,Ki,ur),Or=yi?_p(yi,Ci,Ki,ur):void 0;Sr=new yc(Di,et,Li,Ri,Ht,ni,vi,cr,!1,Ci),Tn=4*Fs.length;const Os=$e.iconSizeData;let sn=null;Os.kind==="source"?(sn=[tn*Gt.layout.get("icon-size").evaluate(At,{})],sn[0]>Kn&&li(`${$e.layerIds[0]}: Value for "icon-size" is >= ${Qa}. Reduce your "icon-size".`)):Os.kind==="composite"&&(sn=[tn*Bt.compositeIconSizes[0].evaluate(At,{},qt),tn*Bt.compositeIconSizes[1].evaluate(At,{},qt)],(sn[0]>Kn||sn[1]>Kn)&&li(`${$e.layerIds[0]}: Value for "icon-size" is >= ${Qa}. Reduce your "icon-size".`)),$e.addSymbols($e.icon,Fs,sn,_t,Gi,At,T.ai.none,et,rn.lineStartIndex,rn.lineLength,-1,qt),Zh=$e.icon.placedSymbolArray.length-1,Or&&(rl=4*Or.length,$e.addSymbols($e.icon,Or,sn,_t,Gi,At,T.ai.vertical,et,rn.lineStartIndex,rn.lineLength,-1,qt),Gh=$e.icon.placedSymbolArray.length-1)}const Pp=Object.keys(kt.horizontal);for(const Ci of Pp){const ur=kt.horizontal[Ci];if(!nn){Ep=ko(ur.text);const Or=Gt.layout.get("text-rotate").evaluate(At,{},qt);nn=new yc(Di,et,Li,Ri,Ht,ur,si,Ii,xi,Or)}const Fs=ur.positionedLines.length===1;if(Ip+=bp($e,et,ur,wr,Gt,xi,At,Bi,rn,kt.vertical?T.ai.horizontal:T.ai.horizontalOnly,Fs?Pp:[Ci],kn,Zh,Bt,qt),Fs)break}kt.vertical&&(Cp+=bp($e,et,kt.vertical,wr,Gt,xi,At,Bi,rn,T.ai.vertical,["vertical"],kn,Gh,Bt,qt));const r0=nn?nn.boxStartIndex:$e.collisionBoxArray.length,n0=nn?nn.boxEndIndex:$e.collisionBoxArray.length,s0=hr?hr.boxStartIndex:$e.collisionBoxArray.length,o0=hr?hr.boxEndIndex:$e.collisionBoxArray.length,a0=Sr?Sr.boxStartIndex:$e.collisionBoxArray.length,l0=Sr?Sr.boxEndIndex:$e.collisionBoxArray.length,c0=ai?ai.boxStartIndex:$e.collisionBoxArray.length,h0=ai?ai.boxEndIndex:$e.collisionBoxArray.length;let Fr=-1;const vc=(Ci,ur)=>Ci&&Ci.circleDiameter?Math.max(Ci.circleDiameter,ur):ur;Fr=vc(nn,Fr),Fr=vc(hr,Fr),Fr=vc(Sr,Fr),Fr=vc(ai,Fr);const Ap=Fr>-1?1:0;Ap&&(Fr*=Fo/ii),$e.glyphOffsetArray.length>=Lo.MAX_GLYPHS&&li("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),At.sortKey!==void 0&&$e.addToSortKeyRanges($e.symbolInstances.length,At.sortKey);const u0=vp(Gt,At,qt),[d0,p0]=function(Ci,ur){const Fs=Ci.length,Or=ur==null?void 0:ur.values;if((Or==null?void 0:Or.length)>0)for(let Os=0;Os<Or.length;Os+=2){const sn=Or[Os+1];Ci.emplaceBack(T.ar[Or[Os]],sn[0],sn[1])}return[Fs,Ci.length]}($e.textAnchorOffsets,u0);$e.symbolInstances.emplaceBack(et.x,et.y,kn.right>=0?kn.right:-1,kn.center>=0?kn.center:-1,kn.left>=0?kn.left:-1,kn.vertical||-1,Zh,Gh,Ep,r0,n0,s0,o0,a0,l0,c0,h0,Li,Ip,Cp,Tn,rl,Ap,0,si,Fr,d0,p0)}(i,Ze,_e,r,s,l,Ve,i.layers[0],i.collisionBoxArray,e.index,e.sourceLayerIndex,i.index,q,[re,re,re,re],Le,_,ae,de,We,D,e,d,x,S,p)};if(Me==="line")for(const _e of up(e.geometry,0,0,Qt,Qt)){const Ze=Jy(_e,Q,be,r.vertical||B,s,24,J,i.overscaling,Qt);for(const $e of Ze)B&&t0(i,B.text,Pe,$e)||Be(_e,$e)}else if(Me==="line-center"){for(const _e of e.geometry)if(_e.length>1){const Ze=Wy(_e,be,r.vertical||B,s,24,J);Ze&&Be(_e,Ze)}}else if(e.type==="Polygon")for(const _e of to(e.geometry,0)){const Ze=Yy(_e,16);Be(_e[0],new Qn(Ze.x,Ze.y,0))}else if(e.type==="LineString")for(const _e of e.geometry)Be(_e,new Qn(_e[0].x,_e[0].y,0));else if(e.type==="Point")for(const _e of e.geometry)for(const Ze of _e)Be([Ze],new Qn(Ze.x,Ze.y,0))}function bp(i,e,r,s,l,d,p,m,_,x,S,I,A,D,B){const O=function(ae,Q,re,de,be,Le,We,Me){const Pe=de.layout.get("text-rotate").evaluate(Le,{})*Math.PI/180,Ue=[];for(const Ve of Q.positionedLines)for(const Be of Ve.positionedGlyphs){if(!Be.rect)continue;const _e=Be.rect||{};let Ze=Fd+1,$e=!0,et=1,It=0;const kt=(be||Me)&&Be.vertical,ni=Be.metrics.advance*Be.scale/2;if(Me&&Q.verticalizable&&(It=Ve.lineOffset/2-(Be.imageName?-(ii-Be.metrics.width*Be.scale)/2:(Be.scale-1)*ii)),Be.imageName){const _t=We[Be.imageName];$e=_t.sdf,et=_t.pixelRatio,Ze=Zi/et}const wr=be?[Be.x+ni,Be.y]:[0,0];let yi=be?[0,0]:[Be.x+ni+re[0],Be.y+re[1]-It],Gt=[0,0];kt&&(Gt=yi,yi=[0,0]);const Di=Be.metrics.isDoubleResolution?2:1,Li=(Be.metrics.left-Ze)*Be.scale-ni+yi[0],Ri=(-Be.metrics.top-Ze)*Be.scale+yi[1],Ht=Li+_e.w/Di*Be.scale/et,si=Ri+_e.h/Di*Be.scale/et,Ii=new le(Li,Ri),xi=new le(Ht,Ri),Bi=new le(Li,si),vi=new le(Ht,si);if(kt){const _t=new le(-ni,ni-Ka),At=-Math.PI/2,Bt=ii/2-ni,Ki=new le(5-Ka-Bt,-(Be.imageName?Bt:0)),qt=new le(...Gt);Ii._rotateAround(At,_t)._add(Ki)._add(qt),xi._rotateAround(At,_t)._add(Ki)._add(qt),Bi._rotateAround(At,_t)._add(Ki)._add(qt),vi._rotateAround(At,_t)._add(Ki)._add(qt)}if(Pe){const _t=Math.sin(Pe),At=Math.cos(Pe),Bt=[At,-_t,_t,At];Ii._matMult(Bt),xi._matMult(Bt),Bi._matMult(Bt),vi._matMult(Bt)}const cr=new le(0,0),Gi=new le(0,0);Ue.push({tl:Ii,tr:xi,bl:Bi,br:vi,tex:_e,writingMode:Q.writingMode,glyphOffset:wr,sectionIndex:Be.sectionIndex,isSDF:$e,pixelOffsetTL:cr,pixelOffsetBR:Gi,minFontScaleX:0,minFontScaleY:0})}return Ue}(0,r,m,l,d,p,s,i.allowVerticalPlacement),q=i.textSizeData;let J=null;q.kind==="source"?(J=[tn*l.layout.get("text-size").evaluate(p,{})],J[0]>Kn&&li(`${i.layerIds[0]}: Value for "text-size" is >= ${Qa}. Reduce your "text-size".`)):q.kind==="composite"&&(J=[tn*D.compositeTextSizes[0].evaluate(p,{},B),tn*D.compositeTextSizes[1].evaluate(p,{},B)],(J[0]>Kn||J[1]>Kn)&&li(`${i.layerIds[0]}: Value for "text-size" is >= ${Qa}. Reduce your "text-size".`)),i.addSymbols(i.text,O,J,m,d,p,x,e,_.lineStartIndex,_.lineLength,A,B);for(const ae of S)I[ae]=i.text.placedSymbolArray.length-1;return 4*O.length}function wp(i){for(const e in i)return i[e];return null}function t0(i,e,r,s){const l=i.compareText;if(e in l){const d=l[e];for(let p=d.length-1;p>=0;p--)if(s.dist(d[p])<r)return!0}else l[e]=[];return l[e].push(s),!1}const Sp=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Oh{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 d=Sp[15&s];if(!d)throw new Error("Unrecognized array type.");const[p]=new Uint16Array(e,2,1),[m]=new Uint32Array(e,4,1);return new Oh(m,p,d,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 d=Sp.indexOf(this.ArrayType),p=2*e*this.ArrayType.BYTES_PER_ELEMENT,m=e*this.IndexArrayType.BYTES_PER_ELEMENT,_=(8-m%8)%8;if(d<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+m+_,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+p+m+_),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+m+_,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+d]),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 Vh(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:d,coords:p,nodeSize:m}=this,_=[0,d.length-1,0],x=[];for(;_.length;){const S=_.pop()||0,I=_.pop()||0,A=_.pop()||0;if(I-A<=m){for(let q=A;q<=I;q++){const J=p[2*q],ae=p[2*q+1];J>=e&&J<=s&&ae>=r&&ae<=l&&x.push(d[q])}continue}const D=A+I>>1,B=p[2*D],O=p[2*D+1];B>=e&&B<=s&&O>=r&&O<=l&&x.push(d[D]),(S===0?e<=B:r<=O)&&(_.push(A),_.push(D-1),_.push(1-S)),(S===0?s>=B:l>=O)&&(_.push(D+1),_.push(I),_.push(1-S))}return x}within(e,r,s){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:l,coords:d,nodeSize:p}=this,m=[0,l.length-1,0],_=[],x=s*s;for(;m.length;){const S=m.pop()||0,I=m.pop()||0,A=m.pop()||0;if(I-A<=p){for(let q=A;q<=I;q++)kp(d[2*q],d[2*q+1],e,r)<=x&&_.push(l[q]);continue}const D=A+I>>1,B=d[2*D],O=d[2*D+1];kp(B,O,e,r)<=x&&_.push(l[D]),(S===0?e-s<=B:r-s<=O)&&(m.push(A),m.push(D-1),m.push(1-S)),(S===0?e+s>=B:r+s>=O)&&(m.push(D+1),m.push(I),m.push(1-S))}return _}}function Vh(i,e,r,s,l,d){if(l-s<=r)return;const p=s+l>>1;Tp(i,e,p,s,l,d),Vh(i,e,r,s,p-1,1-d),Vh(i,e,r,p+1,l,1-d)}function Tp(i,e,r,s,l,d){for(;l>s;){if(l-s>600){const x=l-s+1,S=r-s+1,I=Math.log(x),A=.5*Math.exp(2*I/3),D=.5*Math.sqrt(I*A*(x-A)/x)*(S-x/2<0?-1:1);Tp(i,e,r,Math.max(s,Math.floor(r-S*A/x+D)),Math.min(l,Math.floor(r+(x-S)*A/x+D)),d)}const p=e[2*r+d];let m=s,_=l;for(tl(i,e,s,r),e[2*l+d]>p&&tl(i,e,s,l);m<_;){for(tl(i,e,m,_),m++,_--;e[2*m+d]<p;)m++;for(;e[2*_+d]>p;)_--}e[2*s+d]===p?tl(i,e,s,_):(_++,tl(i,e,_,l)),_<=r&&(s=_+1),r<=_&&(l=_-1)}}function tl(i,e,r,s){Nh(i,r,s),Nh(e,2*r,2*s),Nh(e,2*r+1,2*s+1)}function Nh(i,e,r){const s=i[e];i[e]=i[r],i[r]=s}function kp(i,e,r,s){const l=i-r,d=e-s;return l*l+d*d}var $h;T.bf=void 0,($h=T.bf||(T.bf={})).create="create",$h.load="load",$h.fullLoad="fullLoad";let xc=null,il=[];const jh=1e3/60,Uh="loadTime",qh="fullLoadTime",i0={mark(i){performance.mark(i)},frame(i){const e=i;xc!=null&&il.push(e-xc),xc=e},clearMetrics(){xc=null,il=[],performance.clearMeasures(Uh),performance.clearMeasures(qh);for(const i in T.bf)performance.clearMarks(T.bf[i])},getPerformanceMetrics(){performance.measure(Uh,T.bf.create,T.bf.load),performance.measure(qh,T.bf.create,T.bf.fullLoad);const i=performance.getEntriesByName(Uh)[0].duration,e=performance.getEntriesByName(qh)[0].duration,r=il.length,s=1/(il.reduce((d,p)=>d+p,0)/r/1e3),l=il.filter(d=>d>jh).reduce((d,p)=>d+(p-jh)/jh,0);return{loadTime:i,fullLoadTime:e,fps:s,percentDroppedFrames:l/(r+l)*100,totalFrames:r}}};T.$=class extends F{},T.A=Eo,T.B=Pa,T.C=function(i){if(En==null){const e=i.navigator?i.navigator.userAgent:null;En=!!i.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return En},T.D=qe,T.E=Mn,T.F=class{constructor(i,e){this.target=i,this.mapId=e,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new Hy(()=>this.process()),this.subscription=function(r,s,l,d){return r.addEventListener(s,l,!1),{unsubscribe:()=>{r.removeEventListener(s,l,!1)}}}(this.target,"message",r=>this.receive(r)),this.globalScope=Cr(self)?i:window}registerMessageHandler(i,e){this.messageHandlers[i]=e}sendAsync(i,e){return new Promise((r,s)=>{const l=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[l]={resolve:r,reject:s},e&&e.signal.addEventListener("abort",()=>{delete this.resolveRejects[l];const m={id:l,type:"<cancel>",origin:location.origin,targetMapId:i.targetMapId,sourceMapId:this.mapId};this.target.postMessage(m)},{once:!0});const d=[],p=Object.assign(Object.assign({},i),{id:l,sourceMapId:this.mapId,origin:location.origin,data:As(i.data,d)});this.target.postMessage(p,{transfer:d})})}receive(i){const e=i.data,r=e.id;if(!(e.origin!=="file://"&&location.origin!=="file://"&&e.origin!=="resource://android"&&location.origin!=="resource://android"&&e.origin!==location.origin||e.targetMapId&&this.mapId!==e.targetMapId)){if(e.type==="<cancel>"){delete this.tasks[r];const s=this.abortControllers[r];return delete this.abortControllers[r],void(s&&s.abort())}if(Cr(self)||e.mustQueue)return this.tasks[r]=e,this.taskQueue.push(r),void this.invoker.trigger();this.processTask(r,e)}}process(){if(this.taskQueue.length===0)return;const i=this.taskQueue.shift(),e=this.tasks[i];delete this.tasks[i],this.taskQueue.length>0&&this.invoker.trigger(),e&&this.processTask(i,e)}processTask(i,e){return c(this,void 0,void 0,function*(){if(e.type==="<response>"){const l=this.resolveRejects[i];return delete this.resolveRejects[i],l?void(e.error?l.reject(vr(e.error)):l.resolve(vr(e.data))):void 0}if(!this.messageHandlers[e.type])return void this.completeTask(i,new Error(`Could not find a registered handler for ${e.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const r=vr(e.data),s=new AbortController;this.abortControllers[i]=s;try{const l=yield this.messageHandlers[e.type](e.sourceMapId,r,s);this.completeTask(i,null,l)}catch(l){this.completeTask(i,l)}})}completeTask(i,e,r){const s=[];delete this.abortControllers[i];const l={id:i,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:e?As(e):null,data:As(r,s)};this.target.postMessage(l,{transfer:s})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},T.G=An,T.H=function(){var i=new Eo(16);return Eo!=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},T.I=kh,T.J=function(i,e,r){var s,l,d,p,m,_,x,S,I,A,D,B,O=r[0],q=r[1],J=r[2];return e===i?(i[12]=e[0]*O+e[4]*q+e[8]*J+e[12],i[13]=e[1]*O+e[5]*q+e[9]*J+e[13],i[14]=e[2]*O+e[6]*q+e[10]*J+e[14],i[15]=e[3]*O+e[7]*q+e[11]*J+e[15]):(l=e[1],d=e[2],p=e[3],m=e[4],_=e[5],x=e[6],S=e[7],I=e[8],A=e[9],D=e[10],B=e[11],i[0]=s=e[0],i[1]=l,i[2]=d,i[3]=p,i[4]=m,i[5]=_,i[6]=x,i[7]=S,i[8]=I,i[9]=A,i[10]=D,i[11]=B,i[12]=s*O+m*q+I*J+e[12],i[13]=l*O+_*q+A*J+e[13],i[14]=d*O+x*q+D*J+e[14],i[15]=p*O+S*q+B*J+e[15]),i},T.K=function(i,e,r){var s=r[0],l=r[1],d=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]*d,i[9]=e[9]*d,i[10]=e[10]*d,i[11]=e[11]*d,i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i},T.L=sd,T.M=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},T.N=Yn,T.O=ep,T.P=le,T.Q=tp,T.R=ar,T.S=lr,T.T=Un,T.U=ft,T.V=st,T.W=on,T.X=Qt,T.Y=w,T.Z=fc,T._=c,T.a=$r,T.a$=function(i,e){var r=i[0],s=i[1],l=i[2],d=i[3],p=i[4],m=i[5],_=i[6],x=i[7],S=i[8],I=i[9],A=i[10],D=i[11],B=i[12],O=i[13],q=i[14],J=i[15],ae=e[0],Q=e[1],re=e[2],de=e[3],be=e[4],Le=e[5],We=e[6],Me=e[7],Pe=e[8],Ue=e[9],Ve=e[10],Be=e[11],_e=e[12],Ze=e[13],$e=e[14],et=e[15];return Math.abs(r-ae)<=zi*Math.max(1,Math.abs(r),Math.abs(ae))&&Math.abs(s-Q)<=zi*Math.max(1,Math.abs(s),Math.abs(Q))&&Math.abs(l-re)<=zi*Math.max(1,Math.abs(l),Math.abs(re))&&Math.abs(d-de)<=zi*Math.max(1,Math.abs(d),Math.abs(de))&&Math.abs(p-be)<=zi*Math.max(1,Math.abs(p),Math.abs(be))&&Math.abs(m-Le)<=zi*Math.max(1,Math.abs(m),Math.abs(Le))&&Math.abs(_-We)<=zi*Math.max(1,Math.abs(_),Math.abs(We))&&Math.abs(x-Me)<=zi*Math.max(1,Math.abs(x),Math.abs(Me))&&Math.abs(S-Pe)<=zi*Math.max(1,Math.abs(S),Math.abs(Pe))&&Math.abs(I-Ue)<=zi*Math.max(1,Math.abs(I),Math.abs(Ue))&&Math.abs(A-Ve)<=zi*Math.max(1,Math.abs(A),Math.abs(Ve))&&Math.abs(D-Be)<=zi*Math.max(1,Math.abs(D),Math.abs(Be))&&Math.abs(B-_e)<=zi*Math.max(1,Math.abs(B),Math.abs(_e))&&Math.abs(O-Ze)<=zi*Math.max(1,Math.abs(O),Math.abs(Ze))&&Math.abs(q-$e)<=zi*Math.max(1,Math.abs(q),Math.abs($e))&&Math.abs(J-et)<=zi*Math.max(1,Math.abs(J),Math.abs(et))},T.a0=ti,T.a1=Rh,T.a2=ke,T.a3=i=>{const e=window.document.createElement("video");return e.muted=!0,new Promise(r=>{e.onloadstart=()=>{r(e)};for(const s of i){const l=window.document.createElement("source");ln(s)||(e.crossOrigin="Anonymous"),l.src=s,e.appendChild(l)}})},T.a4=function(){return Vr++},T.a5=ot,T.a6=Lo,T.a7=Ti,T.a8=Rs,T.a9=Pt,T.aA=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]=ss(i[r],e[i[r].ref]));return i},T.aB=function(i){if(i.type==="custom")return new Gy(i);switch(i.type){case"background":return new Uy(i);case"circle":return new A_(i);case"fill":return new H_(i);case"fill-extrusion":return new ly(i);case"heatmap":return new z_(i);case"hillshade":return new L_(i);case"line":return new gy(i);case"raster":return new Zy(i);case"symbol":return new pc(i)}},T.aC=St,T.aD=function(i,e){if(!i)return[{command:"setStyle",args:[e]}];let r=[];try{if(!yt(i.version,e.version))return[{command:"setStyle",args:[e]}];yt(i.center,e.center)||r.push({command:"setCenter",args:[e.center]}),yt(i.zoom,e.zoom)||r.push({command:"setZoom",args:[e.zoom]}),yt(i.bearing,e.bearing)||r.push({command:"setBearing",args:[e.bearing]}),yt(i.pitch,e.pitch)||r.push({command:"setPitch",args:[e.pitch]}),yt(i.sprite,e.sprite)||r.push({command:"setSprite",args:[e.sprite]}),yt(i.glyphs,e.glyphs)||r.push({command:"setGlyphs",args:[e.glyphs]}),yt(i.transition,e.transition)||r.push({command:"setTransition",args:[e.transition]}),yt(i.light,e.light)||r.push({command:"setLight",args:[e.light]}),yt(i.terrain,e.terrain)||r.push({command:"setTerrain",args:[e.terrain]}),yt(i.sky,e.sky)||r.push({command:"setSky",args:[e.sky]}),yt(i.projection,e.projection)||r.push({command:"setProjection",args:[e.projection]});const s={},l=[];(function(p,m,_,x){let S;for(S in m=m||{},p=p||{})Object.prototype.hasOwnProperty.call(p,S)&&(Object.prototype.hasOwnProperty.call(m,S)||qr(S,_,x));for(S in m)Object.prototype.hasOwnProperty.call(m,S)&&(Object.prototype.hasOwnProperty.call(p,S)?yt(p[S],m[S])||(p[S].type==="geojson"&&m[S].type==="geojson"&&zn(p,m,S)?jt(_,{command:"setGeoJSONSourceData",args:[S,m[S].data]}):Ar(S,m,_,x)):os(S,m,_))})(i.sources,e.sources,l,s);const d=[];i.layers&&i.layers.forEach(p=>{"source"in p&&s[p.source]?r.push({command:"removeLayer",args:[p.id]}):d.push(p)}),r=r.concat(l),function(p,m,_){m=m||[];const x=(p=p||[]).map(as),S=m.map(as),I=p.reduce(ls,{}),A=m.reduce(ls,{}),D=x.slice(),B=Object.create(null);let O,q,J,ae,Q;for(let re=0,de=0;re<x.length;re++)O=x[re],Object.prototype.hasOwnProperty.call(A,O)?de++:(jt(_,{command:"removeLayer",args:[O]}),D.splice(D.indexOf(O,de),1));for(let re=0,de=0;re<S.length;re++)O=S[S.length-1-re],D[D.length-1-re]!==O&&(Object.prototype.hasOwnProperty.call(I,O)?(jt(_,{command:"removeLayer",args:[O]}),D.splice(D.lastIndexOf(O,D.length-de),1)):de++,ae=D[D.length-re],jt(_,{command:"addLayer",args:[A[O],ae]}),D.splice(D.length-re,0,O),B[O]=!0);for(let re=0;re<S.length;re++)if(O=S[re],q=I[O],J=A[O],!B[O]&&!yt(q,J))if(yt(q.source,J.source)&&yt(q["source-layer"],J["source-layer"])&&yt(q.type,J.type)){for(Q in Xi(q.layout,J.layout,_,O,null,"setLayoutProperty"),Xi(q.paint,J.paint,_,O,null,"setPaintProperty"),yt(q.filter,J.filter)||jt(_,{command:"setFilter",args:[O,J.filter]}),yt(q.minzoom,J.minzoom)&&yt(q.maxzoom,J.maxzoom)||jt(_,{command:"setLayerZoomRange",args:[O,J.minzoom,J.maxzoom]}),q)Object.prototype.hasOwnProperty.call(q,Q)&&Q!=="layout"&&Q!=="paint"&&Q!=="filter"&&Q!=="metadata"&&Q!=="minzoom"&&Q!=="maxzoom"&&(Q.indexOf("paint.")===0?Xi(q[Q],J[Q],_,O,Q.slice(6),"setPaintProperty"):yt(q[Q],J[Q])||jt(_,{command:"setLayerProperty",args:[O,Q,J[Q]]}));for(Q in J)Object.prototype.hasOwnProperty.call(J,Q)&&!Object.prototype.hasOwnProperty.call(q,Q)&&Q!=="layout"&&Q!=="paint"&&Q!=="filter"&&Q!=="metadata"&&Q!=="minzoom"&&Q!=="maxzoom"&&(Q.indexOf("paint.")===0?Xi(q[Q],J[Q],_,O,Q.slice(6),"setPaintProperty"):yt(q[Q],J[Q])||jt(_,{command:"setLayerProperty",args:[O,Q,J[Q]]}))}else jt(_,{command:"removeLayer",args:[O]}),ae=D[D.lastIndexOf(O)+1],jt(_,{command:"addLayer",args:[J,ae]})}(d,e.layers,r)}catch(s){console.warn("Unable to compute style diff:",s),r=[{command:"setStyle",args:[e]}]}return r},T.aE=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},T.aF=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},T.aG=bi,T.aH=Nr,T.aI=class extends zs{constructor(i,e){super(i,e),this.current=0}set(i){this.current!==i&&(this.current=i,this.gl.uniform1i(this.location,i))}},T.aJ=ec,T.aK=class extends zs{constructor(i,e){super(i,e),this.current=w_}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}}},T.aL=Xu,T.aM=Wu,T.aN=bt,T.aO=class extends zs{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]))}},T.aP=class extends zs{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]))}},T.aQ=function(i,e,r,s,l,d,p){var m=1/(e-r),_=1/(s-l),x=1/(d-p);return i[0]=-2*m,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=-2*_,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=2*x,i[11]=0,i[12]=(e+r)*m,i[13]=(l+s)*_,i[14]=(p+d)*x,i[15]=1,i},T.aR=P_,T.aS=class extends ye{},T.aT=vy,T.aU=class extends De{},T.aV=function(i){return i<=1?1:Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))},T.aW=hd,T.aX=vn,T.aY=ri,T.aZ=class extends Ae{},T.a_=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]},T.aa=ap,T.ab=function(i){const e={};if(i.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(r,s,l,d)=>{const p=l||d;return e[s]=!p||p.toLowerCase(),""}),e["max-age"]){const r=parseInt(e["max-age"],10);isNaN(r)?delete e["max-age"]:e["max-age"]=r}return e},T.ac=function(i,e){const r=[];for(const s in i)s in e||r.push(s);return r},T.ad=wt,T.ae=function(i,e,r){var s=Math.sin(r),l=Math.cos(r),d=e[0],p=e[1],m=e[2],_=e[3],x=e[4],S=e[5],I=e[6],A=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]=d*l+x*s,i[1]=p*l+S*s,i[2]=m*l+I*s,i[3]=_*l+A*s,i[4]=x*l-d*s,i[5]=S*l-p*s,i[6]=I*l-m*s,i[7]=A*l-_*s,i},T.af=function(i){var e=new Eo(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},T.ag=nc,T.ah=function(i,e){let r=0,s=0;if(i.kind==="constant")s=i.layoutSize;else if(i.kind!=="source"){const{interpolationType:l,minZoom:d,maxZoom:p}=i,m=l?wt(Ui.interpolationFactor(l,e,d,p),0,1):0;i.kind==="camera"?s=ji.number(i.minSize,i.maxSize,m):r=m}return{uSizeT:r,uSize:s}},T.aj=function(i,{uSize:e,uSizeT:r},{lowerSize:s,upperSize:l}){return i.kind==="source"?s/tn:i.kind==="composite"?ji.number(s/tn,l/tn,r):e},T.ak=Ph,T.al=function(i,e,r,s){const l=e.y-i.y,d=e.x-i.x,p=s.y-r.y,m=s.x-r.x,_=p*d-m*l;if(_===0)return null;const x=(m*(i.y-r.y)-p*(i.x-r.x))/_;return new le(i.x+x*d,i.y+x*l)},T.am=up,T.an=Qu,T.ao=uh,T.ap=function(i){let e=1/0,r=1/0,s=-1/0,l=-1/0;for(const d of i)e=Math.min(e,d.x),r=Math.min(r,d.y),s=Math.max(s,d.x),l=Math.max(l,d.y);return[e,r,s,l]},T.aq=ii,T.as=Eh,T.at=function(i,e){var r=e[0],s=e[1],l=e[2],d=e[3],p=e[4],m=e[5],_=e[6],x=e[7],S=e[8],I=e[9],A=e[10],D=e[11],B=e[12],O=e[13],q=e[14],J=e[15],ae=r*m-s*p,Q=r*_-l*p,re=r*x-d*p,de=s*_-l*m,be=s*x-d*m,Le=l*x-d*_,We=S*O-I*B,Me=S*q-A*B,Pe=S*J-D*B,Ue=I*q-A*O,Ve=I*J-D*O,Be=A*J-D*q,_e=ae*Be-Q*Ve+re*Ue+de*Pe-be*Me+Le*We;return _e?(i[0]=(m*Be-_*Ve+x*Ue)*(_e=1/_e),i[1]=(l*Ve-s*Be-d*Ue)*_e,i[2]=(O*Le-q*be+J*de)*_e,i[3]=(A*be-I*Le-D*de)*_e,i[4]=(_*Pe-p*Be-x*Me)*_e,i[5]=(r*Be-l*Pe+d*Me)*_e,i[6]=(q*re-B*Le-J*Q)*_e,i[7]=(S*Le-A*re+D*Q)*_e,i[8]=(p*Ve-m*Pe+x*We)*_e,i[9]=(s*Pe-r*Ve-d*We)*_e,i[10]=(B*be-O*re+J*ae)*_e,i[11]=(I*re-S*be-D*ae)*_e,i[12]=(m*Me-p*Ue-_*We)*_e,i[13]=(r*Ue-s*Me+l*We)*_e,i[14]=(O*Q-B*de-q*ae)*_e,i[15]=(S*de-I*Q+A*ae)*_e,i):null},T.au=Fh,T.av=Ch,T.aw=Oh,T.ax=function(){const i={},e=ue.$version;for(const r in ue.$root){const s=ue.$root[r];if(s.required){let l=null;l=r==="version"?e:s.type==="array"?[]:{},l!=null&&(i[r]=l)}}return i},T.ay=Gl,T.az=er,T.b=dr,T.b0=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},T.b1=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},T.b2=function(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]+i[3]*e[3]},T.b3=Xt,T.b4=np,T.b5=ip,T.b6=function(i,e,r,s,l){var d,p=1/Math.tan(e/2);return i[0]=p/r,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=p,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)*(d=1/(s-l)),i[14]=2*l*s*d):(i[10]=-1,i[14]=-2*s),i},T.b7=function(i,e,r){var s=Math.sin(r),l=Math.cos(r),d=e[4],p=e[5],m=e[6],_=e[7],x=e[8],S=e[9],I=e[10],A=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]=d*l+x*s,i[5]=p*l+S*s,i[6]=m*l+I*s,i[7]=_*l+A*s,i[8]=x*l-d*s,i[9]=S*l-p*s,i[10]=I*l-m*s,i[11]=A*l-_*s,i},T.b8=He,T.b9=Ft,T.bA=function(i){return i.message===Qi},T.bB=_n,T.bC=Yr,T.ba=function(i){return i*Math.PI/180},T.bb=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},T.bc=class extends R{},T.bd=Dh,T.be=i0,T.bg=Oi,T.bh=function(i,e){$r.REGISTERED_PROTOCOLS[i]=e},T.bi=function(i){delete $r.REGISTERED_PROTOCOLS[i]},T.bj=function(i,e){const r={};for(let l=0;l<i.length;l++){const d=e&&e[i[l].id]||_a(i[l]);e&&(e[i[l].id]=d);let p=r[d];p||(p=r[d]=[]),p.push(i[l])}const s=[];for(const l in r)s.push(r[l]);return s},T.bk=Fe,T.bl=op,T.bm=lp,T.bn=Vd,T.bo=function(i){i.bucket.createArrays(),i.bucket.tilePixelRatio=Qt/(512*i.bucket.overscaling),i.bucket.compareText={},i.bucket.iconsNeedLinear=!1;const e=i.bucket.layers[0],r=e.layout,s=e._unevaluatedLayout._values,l={layoutIconSize:s["icon-size"].possiblyEvaluate(new Pt(i.bucket.zoom+1),i.canonical),layoutTextSize:s["text-size"].possiblyEvaluate(new Pt(i.bucket.zoom+1),i.canonical),textMaxSize:s["text-size"].possiblyEvaluate(new Pt(18))};if(i.bucket.textSizeData.kind==="composite"){const{minZoom:x,maxZoom:S}=i.bucket.textSizeData;l.compositeTextSizes=[s["text-size"].possiblyEvaluate(new Pt(x),i.canonical),s["text-size"].possiblyEvaluate(new Pt(S),i.canonical)]}if(i.bucket.iconSizeData.kind==="composite"){const{minZoom:x,maxZoom:S}=i.bucket.iconSizeData;l.compositeIconSizes=[s["icon-size"].possiblyEvaluate(new Pt(x),i.canonical),s["icon-size"].possiblyEvaluate(new Pt(S),i.canonical)]}const d=r.get("text-line-height")*ii,p=r.get("text-rotation-alignment")!=="viewport"&&r.get("symbol-placement")!=="point",m=r.get("text-keep-upright"),_=r.get("text-size");for(const x of i.bucket.features){const S=r.get("text-font").evaluate(x,{},i.canonical).join(","),I=_.evaluate(x,{},i.canonical),A=l.layoutTextSize.evaluate(x,{},i.canonical),D=l.layoutIconSize.evaluate(x,{},i.canonical),B={horizontal:{},vertical:void 0},O=x.text;let q,J=[0,0];if(O){const re=O.toString(),de=r.get("text-letter-spacing").evaluate(x,{},i.canonical)*ii,be=nh(re)?de:0,Le=r.get("text-anchor").evaluate(x,{},i.canonical),We=vp(e,x,i.canonical);if(!We){const Ve=r.get("text-radial-offset").evaluate(x,{},i.canonical);J=Ve?xp(Le,[Ve*ii,Bh]):r.get("text-offset").evaluate(x,{},i.canonical).map(Be=>Be*ii)}let Me=p?"center":r.get("text-justify").evaluate(x,{},i.canonical);const Pe=r.get("symbol-placement")==="point"?r.get("text-max-width").evaluate(x,{},i.canonical)*ii:1/0,Ue=()=>{i.bucket.allowVerticalPlacement&&za(re)&&(B.vertical=hc(O,i.glyphMap,i.glyphPositions,i.imagePositions,S,Pe,d,Le,"left",be,J,T.ai.vertical,!0,A,I))};if(!p&&We){const Ve=new Set;if(Me==="auto")for(let _e=0;_e<We.values.length;_e+=2)Ve.add(Fh(We.values[_e]));else Ve.add(Me);let Be=!1;for(const _e of Ve)if(!B.horizontal[_e])if(Be)B.horizontal[_e]=B.horizontal[0];else{const Ze=hc(O,i.glyphMap,i.glyphPositions,i.imagePositions,S,Pe,d,"center",_e,be,J,T.ai.horizontal,!1,A,I);Ze&&(B.horizontal[_e]=Ze,Be=Ze.positionedLines.length===1)}Ue()}else{Me==="auto"&&(Me=Fh(Le));const Ve=hc(O,i.glyphMap,i.glyphPositions,i.imagePositions,S,Pe,d,Le,Me,be,J,T.ai.horizontal,!1,A,I);Ve&&(B.horizontal[Me]=Ve),Ue(),za(re)&&p&&m&&(B.vertical=hc(O,i.glyphMap,i.glyphPositions,i.imagePositions,S,Pe,d,Le,Me,be,J,T.ai.vertical,!1,A,I))}}let ae=!1;if(x.icon&&x.icon.name){const re=i.imageMap[x.icon.name];re&&(q=Oy(i.imagePositions[x.icon.name],r.get("icon-offset").evaluate(x,{},i.canonical),r.get("icon-anchor").evaluate(x,{},i.canonical)),ae=!!re.sdf,i.bucket.sdfIcons===void 0?i.bucket.sdfIcons=ae:i.bucket.sdfIcons!==ae&&li("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(re.pixelRatio!==i.bucket.pixelRatio||r.get("icon-rotate").constantOr(1)!==0)&&(i.bucket.iconsNeedLinear=!0))}const Q=wp(B.horizontal)||B.vertical;i.bucket.iconsInText=!!Q&&Q.iconsInText,(Q||q)&&e0(i.bucket,x,B,q,i.imageMap,l,A,D,J,ae,i.canonical)}i.showCollisionBoxes&&i.bucket.generateCollisionDebugBuffers()},T.bp=bh,T.bq=yh,T.br=vh,T.bs=Wn,T.bt=Sh,T.bu=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}},T.bv=function(i,e,r,s,l){return c(this,void 0,void 0,function*(){if(st())try{return yield on(i,e,r,s,l)}catch{}return function(d,p,m,_,x){const S=d.width,I=d.height;Er&&Ei||(Er=new OffscreenCanvas(S,I),Ei=Er.getContext("2d",{willReadFrequently:!0})),Er.width=S,Er.height=I,Ei.drawImage(d,0,0,S,I);const A=Ei.getImageData(p,m,_,x);return Ei.clearRect(0,0,S,I),A.data}(i,e,r,s,l)})},T.bw=sp,T.bx=fe,T.by=me,T.bz=Ad,T.c=Pn,T.d=i=>c(void 0,void 0,void 0,function*(){if(i.byteLength===0)return createImageBitmap(new ImageData(1,1));const e=new Blob([new Uint8Array(i)],{type:"image/png"});try{return createImageBitmap(e)}catch(r){throw new Error(`Could not load image because of ${r.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),T.e=$t,T.f=i=>new Promise((e,r)=>{const s=new Image;s.onload=()=>{e(s),URL.revokeObjectURL(s.src),s.onload=null,window.requestAnimationFrame(()=>{s.src=Us})},s.onerror=()=>r(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const l=new Blob([new Uint8Array(i)],{type:"image/png"});s.src=i.byteLength?URL.createObjectURL(l):Us}),T.g=pr,T.h=(i,e)=>an($t(i,{type:"json"}),e),T.i=Cr,T.j=Ur,T.k=jr,T.l=(i,e)=>an($t(i,{type:"arrayBuffer"}),e),T.m=an,T.n=function(i){return new Sh(i).readFields(My,[])},T.o=qa,T.p=Od,T.q=o,T.r=th,T.s=ln,T.t=Aa,T.u=ze,T.v=ue,T.w=li,T.x=Rr,T.y=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)}},T.z=ji}),L("worker",["./shared"],function(T){class c{constructor(z){this.keyCache={},z&&this.replace(z)}replace(z){this._layerConfigs={},this._layers={},this.update(z,[])}update(z,M){for(const G of z){this._layerConfigs[G.id]=G;const ee=this._layers[G.id]=T.aB(G);ee._featureFilter=T.a7(ee.filter),this.keyCache[G.id]&&delete this.keyCache[G.id]}for(const G of M)delete this.keyCache[G],delete this._layerConfigs[G],delete this._layers[G];this.familiesBySource={};const V=T.bj(Object.values(this._layerConfigs),this.keyCache);for(const G of V){const ee=G.map(he=>this._layers[he.id]),ie=ee[0];if(ie.visibility==="none")continue;const ne=ie.source||"";let K=this.familiesBySource[ne];K||(K=this.familiesBySource[ne]={});const pe=ie.sourceLayer||"_geojsonTileLayer";let xe=K[pe];xe||(xe=K[pe]=[]),xe.push(ee)}}}class fe{constructor(z){const M={},V=[];for(const ne in z){const K=z[ne],pe=M[ne]={};for(const xe in K){const he=K[+xe];if(!he||he.bitmap.width===0||he.bitmap.height===0)continue;const Ie={x:0,y:0,w:he.bitmap.width+2,h:he.bitmap.height+2};V.push(Ie),pe[xe]={rect:Ie,metrics:he.metrics}}}const{w:G,h:ee}=T.p(V),ie=new T.o({width:G||1,height:ee||1});for(const ne in z){const K=z[ne];for(const pe in K){const xe=K[+pe];if(!xe||xe.bitmap.width===0||xe.bitmap.height===0)continue;const he=M[ne][pe].rect;T.o.copy(xe.bitmap,ie,{x:0,y:0},{x:he.x+1,y:he.y+1},xe.bitmap)}}this.image=ie,this.positions=M}}T.bk("GlyphAtlas",fe);class me{constructor(z){this.tileID=new T.S(z.tileID.overscaledZ,z.tileID.wrap,z.tileID.canonical.z,z.tileID.canonical.x,z.tileID.canonical.y),this.uid=z.uid,this.zoom=z.zoom,this.pixelRatio=z.pixelRatio,this.tileSize=z.tileSize,this.source=z.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=z.showCollisionBoxes,this.collectResourceTiming=!!z.collectResourceTiming,this.returnDependencies=!!z.returnDependencies,this.promoteId=z.promoteId,this.inFlightDependencies=[]}parse(z,M,V,G){return T._(this,void 0,void 0,function*(){this.status="parsing",this.data=z,this.collisionBoxArray=new T.a5;const ee=new T.bl(Object.keys(z.layers).sort()),ie=new T.bm(this.tileID,this.promoteId);ie.bucketLayerIDs=[];const ne={},K={featureIndex:ie,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:V},pe=M.familiesBySource[this.source];for(const lt in pe){const vt=z.layers[lt];if(!vt)continue;vt.version===1&&T.w(`Vector tile source "${this.source}" layer "${lt}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const Ot=ee.encode(lt),ei=[];for(let ci=0;ci<vt.length;ci++){const hi=vt.feature(ci),cs=ie.getId(hi,lt);ei.push({feature:hi,id:cs,index:ci,sourceLayerIndex:Ot})}for(const ci of pe[lt]){const hi=ci[0];hi.source!==this.source&&T.w(`layer.source = ${hi.source} does not equal this.source = ${this.source}`),hi.minzoom&&this.zoom<Math.floor(hi.minzoom)||hi.maxzoom&&this.zoom>=hi.maxzoom||hi.visibility!=="none"&&(ve(ci,this.zoom,V),(ne[hi.id]=hi.createBucket({index:ie.bucketLayerIDs.length,layers:ci,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Ot,sourceID:this.source})).populate(ei,K,this.tileID.canonical),ie.bucketLayerIDs.push(ci.map(cs=>cs.id)))}}const xe=T.aG(K.glyphDependencies,lt=>Object.keys(lt).map(Number));this.inFlightDependencies.forEach(lt=>lt==null?void 0:lt.abort()),this.inFlightDependencies=[];let he=Promise.resolve({});if(Object.keys(xe).length){const lt=new AbortController;this.inFlightDependencies.push(lt),he=G.sendAsync({type:"GG",data:{stacks:xe,source:this.source,tileID:this.tileID,type:"glyphs"}},lt)}const Ie=Object.keys(K.iconDependencies);let Ge=Promise.resolve({});if(Ie.length){const lt=new AbortController;this.inFlightDependencies.push(lt),Ge=G.sendAsync({type:"GI",data:{icons:Ie,source:this.source,tileID:this.tileID,type:"icons"}},lt)}const Xe=Object.keys(K.patternDependencies);let nt=Promise.resolve({});if(Xe.length){const lt=new AbortController;this.inFlightDependencies.push(lt),nt=G.sendAsync({type:"GI",data:{icons:Xe,source:this.source,tileID:this.tileID,type:"patterns"}},lt)}const[mt,rt,Ct]=yield Promise.all([he,Ge,nt]),Ut=new fe(mt),Kt=new T.bn(rt,Ct);for(const lt in ne){const vt=ne[lt];vt instanceof T.a6?(ve(vt.layers,this.zoom,V),T.bo({bucket:vt,glyphMap:mt,glyphPositions:Ut.positions,imageMap:rt,imagePositions:Kt.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):vt.hasPattern&&(vt instanceof T.bp||vt instanceof T.bq||vt instanceof T.br)&&(ve(vt.layers,this.zoom,V),vt.addFeatures(K,this.tileID.canonical,Kt.patternPositions))}return this.status="done",{buckets:Object.values(ne).filter(lt=>!lt.isEmpty()),featureIndex:ie,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Ut.image,imageAtlas:Kt,glyphMap:this.returnDependencies?mt:null,iconMap:this.returnDependencies?rt:null,glyphPositions:this.returnDependencies?Ut.positions:null}})}}function ve(X,z,M){const V=new T.a9(z);for(const G of X)G.recalculate(V,M)}class le{constructor(z,M,V){this.actor=z,this.layerIndex=M,this.availableImages=V,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(z,M){return T._(this,void 0,void 0,function*(){const V=yield T.l(z.request,M);try{return{vectorTile:new T.bs.VectorTile(new T.bt(V.data)),rawData:V.data,cacheControl:V.cacheControl,expires:V.expires}}catch(G){const ee=new Uint8Array(V.data);let ie=`Unable to parse the tile at ${z.request.url}, `;throw ie+=ee[0]===31&&ee[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${G.message}`,new Error(ie)}})}loadTile(z){return T._(this,void 0,void 0,function*(){const M=z.uid,V=!!(z&&z.request&&z.request.collectResourceTiming)&&new T.bu(z.request),G=new me(z);this.loading[M]=G;const ee=new AbortController;G.abort=ee;try{const ie=yield this.loadVectorTile(z,ee);if(delete this.loading[M],!ie)return null;const ne=ie.rawData,K={};ie.expires&&(K.expires=ie.expires),ie.cacheControl&&(K.cacheControl=ie.cacheControl);const pe={};if(V){const he=V.finish();he&&(pe.resourceTiming=JSON.parse(JSON.stringify(he)))}G.vectorTile=ie.vectorTile;const xe=G.parse(ie.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[M]=G,this.fetching[M]={rawTileData:ne,cacheControl:K,resourceTiming:pe};try{const he=yield xe;return T.e({rawTileData:ne.slice(0)},he,K,pe)}finally{delete this.fetching[M]}}catch(ie){throw delete this.loading[M],G.status="done",this.loaded[M]=G,ie}})}reloadTile(z){return T._(this,void 0,void 0,function*(){const M=z.uid;if(!this.loaded||!this.loaded[M])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const V=this.loaded[M];if(V.showCollisionBoxes=z.showCollisionBoxes,V.status==="parsing"){const G=yield V.parse(V.vectorTile,this.layerIndex,this.availableImages,this.actor);let ee;if(this.fetching[M]){const{rawTileData:ie,cacheControl:ne,resourceTiming:K}=this.fetching[M];delete this.fetching[M],ee=T.e({rawTileData:ie.slice(0)},G,ne,K)}else ee=G;return ee}if(V.status==="done"&&V.vectorTile)return V.parse(V.vectorTile,this.layerIndex,this.availableImages,this.actor)})}abortTile(z){return T._(this,void 0,void 0,function*(){const M=this.loading,V=z.uid;M&&M[V]&&M[V].abort&&(M[V].abort.abort(),delete M[V])})}removeTile(z){return T._(this,void 0,void 0,function*(){this.loaded&&this.loaded[z.uid]&&delete this.loaded[z.uid]})}}class oe{constructor(){this.loaded={}}loadTile(z){return T._(this,void 0,void 0,function*(){const{uid:M,encoding:V,rawImageData:G,redFactor:ee,greenFactor:ie,blueFactor:ne,baseShift:K}=z,pe=G.width+2,xe=G.height+2,he=T.b(G)?new T.R({width:pe,height:xe},yield T.bv(G,-1,-1,pe,xe)):G,Ie=new T.bw(M,he,V,ee,ie,ne,K);return this.loaded=this.loaded||{},this.loaded[M]=Ie,Ie})}removeTile(z){const M=this.loaded,V=z.uid;M&&M[V]&&delete M[V]}}function ht(X,z){if(X.length!==0){je(X[0],z);for(var M=1;M<X.length;M++)je(X[M],!z)}}function je(X,z){for(var M=0,V=0,G=0,ee=X.length,ie=ee-1;G<ee;ie=G++){var ne=(X[G][0]-X[ie][0])*(X[ie][1]+X[G][1]),K=M+ne;V+=Math.abs(M)>=Math.abs(ne)?M-K+ne:ne-K+M,M=K}M+V>=0!=!!z&&X.reverse()}var Ke=T.bx(function X(z,M){var V,G=z&&z.type;if(G==="FeatureCollection")for(V=0;V<z.features.length;V++)X(z.features[V],M);else if(G==="GeometryCollection")for(V=0;V<z.geometries.length;V++)X(z.geometries[V],M);else if(G==="Feature")X(z.geometry,M);else if(G==="Polygon")ht(z.coordinates,M);else if(G==="MultiPolygon")for(V=0;V<z.coordinates.length;V++)ht(z.coordinates[V],M);return z});const Oe=T.bs.VectorTileFeature.prototype.toGeoJSON;var ft={exports:{}},st=T.by,He=T.bs.VectorTileFeature,Ft=wt;function wt(X,z){this.options=z||{},this.features=X,this.length=X.length}function Xt(X,z){this.id=typeof X.id=="number"?X.id:void 0,this.type=X.type,this.rawGeometry=X.type===1?[X.geometry]:X.geometry,this.properties=X.tags,this.extent=z||4096}wt.prototype.feature=function(X){return new Xt(this.features[X],this.options.extent)},Xt.prototype.loadGeometry=function(){var X=this.rawGeometry;this.geometry=[];for(var z=0;z<X.length;z++){for(var M=X[z],V=[],G=0;G<M.length;G++)V.push(new st(M[G][0],M[G][1]));this.geometry.push(V)}return this.geometry},Xt.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var X=this.geometry,z=1/0,M=-1/0,V=1/0,G=-1/0,ee=0;ee<X.length;ee++)for(var ie=X[ee],ne=0;ne<ie.length;ne++){var K=ie[ne];z=Math.min(z,K.x),M=Math.max(M,K.x),V=Math.min(V,K.y),G=Math.max(G,K.y)}return[z,V,M,G]},Xt.prototype.toGeoJSON=He.prototype.toGeoJSON;var $t=T.bz,Vr=Ft;function bi(X){var z=new $t;return function(M,V){for(var G in M.layers)V.writeMessage(3,Nr,M.layers[G])}(X,z),z.finish()}function Nr(X,z){var M;z.writeVarintField(15,X.version||1),z.writeStringField(1,X.name||""),z.writeVarintField(5,X.extent||4096);var V={keys:[],values:[],keycache:{},valuecache:{}};for(M=0;M<X.length;M++)V.feature=X.feature(M),z.writeMessage(2,St,V);var G=V.keys;for(M=0;M<G.length;M++)z.writeStringField(3,G[M]);var ee=V.values;for(M=0;M<ee.length;M++)z.writeMessage(4,En,ee[M])}function St(X,z){var M=X.feature;M.id!==void 0&&z.writeVarintField(1,M.id),z.writeMessage(2,js,X),z.writeVarintField(3,M.type),z.writeMessage(4,Cr,M)}function js(X,z){var M=X.feature,V=X.keys,G=X.values,ee=X.keycache,ie=X.valuecache;for(var ne in M.properties){var K=M.properties[ne],pe=ee[ne];if(K!==null){pe===void 0&&(V.push(ne),ee[ne]=pe=V.length-1),z.writeVarint(pe);var xe=typeof K;xe!=="string"&&xe!=="boolean"&&xe!=="number"&&(K=JSON.stringify(K));var he=xe+":"+K,Ie=ie[he];Ie===void 0&&(G.push(K),ie[he]=Ie=G.length-1),z.writeVarint(Ie)}}}function li(X,z){return(z<<3)+(7&X)}function wi(X){return X<<1^X>>31}function Cr(X,z){for(var M=X.loadGeometry(),V=X.type,G=0,ee=0,ie=M.length,ne=0;ne<ie;ne++){var K=M[ne],pe=1;V===1&&(pe=K.length),z.writeVarint(li(1,pe));for(var xe=V===3?K.length-1:K.length,he=0;he<xe;he++){he===1&&V!==1&&z.writeVarint(li(2,xe-1));var Ie=K[he].x-G,Ge=K[he].y-ee;z.writeVarint(wi(Ie)),z.writeVarint(wi(Ge)),G+=Ie,ee+=Ge}V===3&&z.writeVarint(li(7,1))}}function En(X,z){var M=typeof X;M==="string"?z.writeStringField(1,X):M==="boolean"?z.writeBooleanField(7,X):M==="number"&&(X%1!=0?z.writeDoubleField(3,X):X<0?z.writeSVarintField(6,X):z.writeVarintField(5,X))}ft.exports=bi,ft.exports.fromVectorTileJs=bi,ft.exports.fromGeojsonVt=function(X,z){z=z||{};var M={};for(var V in X)M[V]=new Vr(X[V].features,z),M[V].name=V,M[V].version=z.version,M[V].extent=z.extent;return bi({layers:M})},ft.exports.GeoJSONWrapper=Vr;var dr=T.bx(ft.exports);const Us={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:X=>X},on=Math.fround||(Er=new Float32Array(1),X=>(Er[0]=+X,Er[0]));var Er;const Ei=3,Qi=5,Pn=6;class $r{constructor(z){this.options=Object.assign(Object.create(Us),z),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(z){const{log:M,minZoom:V,maxZoom:G}=this.options;M&&console.time("total time");const ee=`prepare ${z.length} points`;M&&console.time(ee),this.points=z;const ie=[];for(let K=0;K<z.length;K++){const pe=z[K];if(!pe.geometry)continue;const[xe,he]=pe.geometry.coordinates,Ie=on(Oi(xe)),Ge=on(er(he));ie.push(Ie,Ge,1/0,K,-1,1),this.options.reduce&&ie.push(0)}let ne=this.trees[G+1]=this._createTree(ie);M&&console.timeEnd(ee);for(let K=G;K>=V;K--){const pe=+Date.now();ne=this.trees[K]=this._createTree(this._cluster(ne,K)),M&&console.log("z%d: %d clusters in %dms",K,ne.numItems,+Date.now()-pe)}return M&&console.timeEnd("total time"),this}getClusters(z,M){let V=((z[0]+180)%360+360)%360-180;const G=Math.max(-90,Math.min(90,z[1]));let ee=z[2]===180?180:((z[2]+180)%360+360)%360-180;const ie=Math.max(-90,Math.min(90,z[3]));if(z[2]-z[0]>=360)V=-180,ee=180;else if(V>ee){const he=this.getClusters([V,G,180,ie],M),Ie=this.getClusters([-180,G,ee,ie],M);return he.concat(Ie)}const ne=this.trees[this._limitZoom(M)],K=ne.range(Oi(V),er(ie),Oi(ee),er(G)),pe=ne.data,xe=[];for(const he of K){const Ie=this.stride*he;xe.push(pe[Ie+Qi]>1?pr(pe,Ie,this.clusterProps):this.points[pe[Ie+Ei]])}return xe}getChildren(z){const M=this._getOriginId(z),V=this._getOriginZoom(z),G="No cluster with the specified id.",ee=this.trees[V];if(!ee)throw new Error(G);const ie=ee.data;if(M*this.stride>=ie.length)throw new Error(G);const ne=this.options.radius/(this.options.extent*Math.pow(2,V-1)),K=ee.within(ie[M*this.stride],ie[M*this.stride+1],ne),pe=[];for(const xe of K){const he=xe*this.stride;ie[he+4]===z&&pe.push(ie[he+Qi]>1?pr(ie,he,this.clusterProps):this.points[ie[he+Ei]])}if(pe.length===0)throw new Error(G);return pe}getLeaves(z,M,V){const G=[];return this._appendLeaves(G,z,M=M||10,V=V||0,0),G}getTile(z,M,V){const G=this.trees[this._limitZoom(z)],ee=Math.pow(2,z),{extent:ie,radius:ne}=this.options,K=ne/ie,pe=(V-K)/ee,xe=(V+1+K)/ee,he={features:[]};return this._addTileFeatures(G.range((M-K)/ee,pe,(M+1+K)/ee,xe),G.data,M,V,ee,he),M===0&&this._addTileFeatures(G.range(1-K/ee,pe,1,xe),G.data,ee,V,ee,he),M===ee-1&&this._addTileFeatures(G.range(0,pe,K/ee,xe),G.data,-1,V,ee,he),he.features.length?he:null}getClusterExpansionZoom(z){let M=this._getOriginZoom(z)-1;for(;M<=this.options.maxZoom;){const V=this.getChildren(z);if(M++,V.length!==1)break;z=V[0].properties.cluster_id}return M}_appendLeaves(z,M,V,G,ee){const ie=this.getChildren(M);for(const ne of ie){const K=ne.properties;if(K&&K.cluster?ee+K.point_count<=G?ee+=K.point_count:ee=this._appendLeaves(z,K.cluster_id,V,G,ee):ee<G?ee++:z.push(ne),z.length===V)break}return ee}_createTree(z){const M=new T.aw(z.length/this.stride|0,this.options.nodeSize,Float32Array);for(let V=0;V<z.length;V+=this.stride)M.add(z[V],z[V+1]);return M.finish(),M.data=z,M}_addTileFeatures(z,M,V,G,ee,ie){for(const ne of z){const K=ne*this.stride,pe=M[K+Qi]>1;let xe,he,Ie;if(pe)xe=An(M,K,this.clusterProps),he=M[K],Ie=M[K+1];else{const nt=this.points[M[K+Ei]];xe=nt.properties;const[mt,rt]=nt.geometry.coordinates;he=Oi(mt),Ie=er(rt)}const Ge={type:1,geometry:[[Math.round(this.options.extent*(he*ee-V)),Math.round(this.options.extent*(Ie*ee-G))]],tags:xe};let Xe;Xe=pe||this.options.generateId?M[K+Ei]:this.points[M[K+Ei]].id,Xe!==void 0&&(Ge.id=Xe),ie.features.push(Ge)}}_limitZoom(z){return Math.max(this.options.minZoom,Math.min(Math.floor(+z),this.options.maxZoom+1))}_cluster(z,M){const{radius:V,extent:G,reduce:ee,minPoints:ie}=this.options,ne=V/(G*Math.pow(2,M)),K=z.data,pe=[],xe=this.stride;for(let he=0;he<K.length;he+=xe){if(K[he+2]<=M)continue;K[he+2]=M;const Ie=K[he],Ge=K[he+1],Xe=z.within(K[he],K[he+1],ne),nt=K[he+Qi];let mt=nt;for(const rt of Xe){const Ct=rt*xe;K[Ct+2]>M&&(mt+=K[Ct+Qi])}if(mt>nt&&mt>=ie){let rt,Ct=Ie*nt,Ut=Ge*nt,Kt=-1;const lt=((he/xe|0)<<5)+(M+1)+this.points.length;for(const vt of Xe){const Ot=vt*xe;if(K[Ot+2]<=M)continue;K[Ot+2]=M;const ei=K[Ot+Qi];Ct+=K[Ot]*ei,Ut+=K[Ot+1]*ei,K[Ot+4]=lt,ee&&(rt||(rt=this._map(K,he,!0),Kt=this.clusterProps.length,this.clusterProps.push(rt)),ee(rt,this._map(K,Ot)))}K[he+4]=lt,pe.push(Ct/mt,Ut/mt,1/0,lt,-1,mt),ee&&pe.push(Kt)}else{for(let rt=0;rt<xe;rt++)pe.push(K[he+rt]);if(mt>1)for(const rt of Xe){const Ct=rt*xe;if(!(K[Ct+2]<=M)){K[Ct+2]=M;for(let Ut=0;Ut<xe;Ut++)pe.push(K[Ct+Ut])}}}}return pe}_getOriginId(z){return z-this.points.length>>5}_getOriginZoom(z){return(z-this.points.length)%32}_map(z,M,V){if(z[M+Qi]>1){const ie=this.clusterProps[z[M+Pn]];return V?Object.assign({},ie):ie}const G=this.points[z[M+Ei]].properties,ee=this.options.map(G);return V&&ee===G?Object.assign({},ee):ee}}function pr(X,z,M){return{type:"Feature",id:X[z+Ei],properties:An(X,z,M),geometry:{type:"Point",coordinates:[(V=X[z],360*(V-.5)),an(X[z+1])]}};var V}function An(X,z,M){const V=X[z+Qi],G=V>=1e4?`${Math.round(V/1e3)}k`:V>=1e3?Math.round(V/100)/10+"k":V,ee=X[z+Pn],ie=ee===-1?{}:Object.assign({},M[ee]);return Object.assign(ie,{cluster:!0,cluster_id:X[z+Ei],point_count:V,point_count_abbreviated:G})}function Oi(X){return X/360+.5}function er(X){const z=Math.sin(X*Math.PI/180),M=.5-.25*Math.log((1+z)/(1-z))/Math.PI;return M<0?0:M>1?1:M}function an(X){const z=(180-360*X)*Math.PI/180;return 360*Math.atan(Math.exp(z))/Math.PI-90}function ln(X,z,M,V){let G=V;const ee=z+(M-z>>1);let ie,ne=M-z;const K=X[z],pe=X[z+1],xe=X[M],he=X[M+1];for(let Ie=z+3;Ie<M;Ie+=3){const Ge=ns(X[Ie],X[Ie+1],K,pe,xe,he);if(Ge>G)ie=Ie,G=Ge;else if(Ge===G){const Xe=Math.abs(Ie-ee);Xe<ne&&(ie=Ie,ne=Xe)}}G>V&&(ie-z>3&&ln(X,z,ie,V),X[ie+2]=G,M-ie>3&&ln(X,ie,M,V))}function ns(X,z,M,V,G,ee){let ie=G-M,ne=ee-V;if(ie!==0||ne!==0){const K=((X-M)*ie+(z-V)*ne)/(ie*ie+ne*ne);K>1?(M=G,V=ee):K>0&&(M+=ie*K,V+=ne*K)}return ie=X-M,ne=z-V,ie*ie+ne*ne}function Pr(X,z,M,V){const G={id:X??null,type:z,geometry:M,tags:V,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(z==="Point"||z==="MultiPoint"||z==="LineString")jr(G,M);else if(z==="Polygon")jr(G,M[0]);else if(z==="MultiLineString")for(const ee of M)jr(G,ee);else if(z==="MultiPolygon")for(const ee of M)jr(G,ee[0]);return G}function jr(X,z){for(let M=0;M<z.length;M+=3)X.minX=Math.min(X.minX,z[M]),X.minY=Math.min(X.minY,z[M+1]),X.maxX=Math.max(X.maxX,z[M]),X.maxY=Math.max(X.maxY,z[M+1])}function Ur(X,z,M,V){if(!z.geometry)return;const G=z.geometry.coordinates;if(G&&G.length===0)return;const ee=z.geometry.type,ie=Math.pow(M.tolerance/((1<<M.maxZoom)*M.extent),2);let ne=[],K=z.id;if(M.promoteId?K=z.properties[M.promoteId]:M.generateId&&(K=V||0),ee==="Point")Mn(G,ne);else if(ee==="MultiPoint")for(const pe of G)Mn(pe,ne);else if(ee==="LineString")ue(G,ne,ie,!1);else if(ee==="MultiLineString"){if(M.lineMetrics){for(const pe of G)ne=[],ue(pe,ne,ie,!1),X.push(Pr(K,"LineString",ne,z.properties));return}cn(G,ne,ie,!1)}else if(ee==="Polygon")cn(G,ne,ie,!0);else{if(ee!=="MultiPolygon"){if(ee==="GeometryCollection"){for(const pe of z.geometry.geometries)Ur(X,{id:K,geometry:pe,properties:z.properties},M,V);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const pe of G){const xe=[];cn(pe,xe,ie,!0),ne.push(xe)}}X.push(Pr(K,ee,ne,z.properties))}function Mn(X,z){z.push(ss(X[0]),yt(X[1]),0)}function ue(X,z,M,V){let G,ee,ie=0;for(let K=0;K<X.length;K++){const pe=ss(X[K][0]),xe=yt(X[K][1]);z.push(pe,xe,0),K>0&&(ie+=V?(G*xe-pe*ee)/2:Math.sqrt(Math.pow(pe-G,2)+Math.pow(xe-ee,2))),G=pe,ee=xe}const ne=z.length-3;z[2]=1,ln(z,0,ne,M),z[ne+2]=1,z.size=Math.abs(ie),z.start=0,z.end=z.size}function cn(X,z,M,V){for(let G=0;G<X.length;G++){const ee=[];ue(X[G],ee,M,V),z.push(ee)}}function ss(X){return X/360+.5}function yt(X){const z=Math.sin(X*Math.PI/180),M=.5-.25*Math.log((1+z)/(1-z))/Math.PI;return M<0?0:M>1?1:M}function jt(X,z,M,V,G,ee,ie,ne){if(V/=z,ee>=(M/=z)&&ie<V)return X;if(ie<M||ee>=V)return null;const K=[];for(const pe of X){const xe=pe.geometry;let he=pe.type;const Ie=G===0?pe.minX:pe.minY,Ge=G===0?pe.maxX:pe.maxY;if(Ie>=M&&Ge<V){K.push(pe);continue}if(Ge<M||Ie>=V)continue;let Xe=[];if(he==="Point"||he==="MultiPoint")os(xe,Xe,M,V,G);else if(he==="LineString")qr(xe,Xe,M,V,G,!1,ne.lineMetrics);else if(he==="MultiLineString")zn(xe,Xe,M,V,G,!1);else if(he==="Polygon")zn(xe,Xe,M,V,G,!0);else if(he==="MultiPolygon")for(const nt of xe){const mt=[];zn(nt,mt,M,V,G,!0),mt.length&&Xe.push(mt)}if(Xe.length){if(ne.lineMetrics&&he==="LineString"){for(const nt of Xe)K.push(Pr(pe.id,he,nt,pe.tags));continue}he!=="LineString"&&he!=="MultiLineString"||(Xe.length===1?(he="LineString",Xe=Xe[0]):he="MultiLineString"),he!=="Point"&&he!=="MultiPoint"||(he=Xe.length===3?"Point":"MultiPoint"),K.push(Pr(pe.id,he,Xe,pe.tags))}}return K.length?K:null}function os(X,z,M,V,G){for(let ee=0;ee<X.length;ee+=3){const ie=X[ee+G];ie>=M&&ie<=V&&Xi(z,X[ee],X[ee+1],X[ee+2])}}function qr(X,z,M,V,G,ee,ie){let ne=Ar(X);const K=G===0?as:ls;let pe,xe,he=X.start;for(let mt=0;mt<X.length-3;mt+=3){const rt=X[mt],Ct=X[mt+1],Ut=X[mt+2],Kt=X[mt+3],lt=X[mt+4],vt=G===0?rt:Ct,Ot=G===0?Kt:lt;let ei=!1;ie&&(pe=Math.sqrt(Math.pow(rt-Kt,2)+Math.pow(Ct-lt,2))),vt<M?Ot>M&&(xe=K(ne,rt,Ct,Kt,lt,M),ie&&(ne.start=he+pe*xe)):vt>V?Ot<V&&(xe=K(ne,rt,Ct,Kt,lt,V),ie&&(ne.start=he+pe*xe)):Xi(ne,rt,Ct,Ut),Ot<M&&vt>=M&&(xe=K(ne,rt,Ct,Kt,lt,M),ei=!0),Ot>V&&vt<=V&&(xe=K(ne,rt,Ct,Kt,lt,V),ei=!0),!ee&&ei&&(ie&&(ne.end=he+pe*xe),z.push(ne),ne=Ar(X)),ie&&(he+=pe)}let Ie=X.length-3;const Ge=X[Ie],Xe=X[Ie+1],nt=G===0?Ge:Xe;nt>=M&&nt<=V&&Xi(ne,Ge,Xe,X[Ie+2]),Ie=ne.length-3,ee&&Ie>=3&&(ne[Ie]!==ne[0]||ne[Ie+1]!==ne[1])&&Xi(ne,ne[0],ne[1],ne[2]),ne.length&&z.push(ne)}function Ar(X){const z=[];return z.size=X.size,z.start=X.start,z.end=X.end,z}function zn(X,z,M,V,G,ee){for(const ie of X)qr(ie,z,M,V,G,ee,!1)}function Xi(X,z,M,V){X.push(z,M,V)}function as(X,z,M,V,G,ee){const ie=(ee-z)/(V-z);return Xi(X,ee,M+(G-M)*ie,1),ie}function ls(X,z,M,V,G,ee){const ie=(ee-M)/(G-M);return Xi(X,z+(V-z)*ie,ee,1),ie}function ke(X,z){const M=[];for(let V=0;V<X.length;V++){const G=X[V],ee=G.type;let ie;if(ee==="Point"||ee==="MultiPoint"||ee==="LineString")ie=fr(G.geometry,z);else if(ee==="MultiLineString"||ee==="Polygon"){ie=[];for(const ne of G.geometry)ie.push(fr(ne,z))}else if(ee==="MultiPolygon"){ie=[];for(const ne of G.geometry){const K=[];for(const pe of ne)K.push(fr(pe,z));ie.push(K)}}M.push(Pr(G.id,ee,ie,G.tags))}return M}function fr(X,z){const M=[];M.size=X.size,X.start!==void 0&&(M.start=X.start,M.end=X.end);for(let V=0;V<X.length;V+=3)M.push(X[V]+z,X[V+1],X[V+2]);return M}function Si(X,z){if(X.transformed)return X;const M=1<<X.z,V=X.x,G=X.y;for(const ee of X.features){const ie=ee.geometry,ne=ee.type;if(ee.geometry=[],ne===1)for(let K=0;K<ie.length;K+=2)ee.geometry.push(mr(ie[K],ie[K+1],z,M,V,G));else for(let K=0;K<ie.length;K++){const pe=[];for(let xe=0;xe<ie[K].length;xe+=2)pe.push(mr(ie[K][xe],ie[K][xe+1],z,M,V,G));ee.geometry.push(pe)}}return X.transformed=!0,X}function mr(X,z,M,V,G,ee){return[Math.round(M*(X*V-G)),Math.round(M*(z*V-ee))]}function Zr(X,z,M,V,G){const ee=z===G.maxZoom?0:G.tolerance/((1<<z)*G.extent),ie={features:[],numPoints:0,numSimplified:0,numFeatures:X.length,source:null,x:M,y:V,z,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const ne of X)Ee(ie,ne,ee,G);return ie}function Ee(X,z,M,V){const G=z.geometry,ee=z.type,ie=[];if(X.minX=Math.min(X.minX,z.minX),X.minY=Math.min(X.minY,z.minY),X.maxX=Math.max(X.maxX,z.maxX),X.maxY=Math.max(X.maxY,z.maxY),ee==="Point"||ee==="MultiPoint")for(let ne=0;ne<G.length;ne+=3)ie.push(G[ne],G[ne+1]),X.numPoints++,X.numSimplified++;else if(ee==="LineString")at(ie,G,X,M,!1,!1);else if(ee==="MultiLineString"||ee==="Polygon")for(let ne=0;ne<G.length;ne++)at(ie,G[ne],X,M,ee==="Polygon",ne===0);else if(ee==="MultiPolygon")for(let ne=0;ne<G.length;ne++){const K=G[ne];for(let pe=0;pe<K.length;pe++)at(ie,K[pe],X,M,!0,pe===0)}if(ie.length){let ne=z.tags||null;if(ee==="LineString"&&V.lineMetrics){ne={};for(const pe in z.tags)ne[pe]=z.tags[pe];ne.mapbox_clip_start=G.start/G.size,ne.mapbox_clip_end=G.end/G.size}const K={geometry:ie,type:ee==="Polygon"||ee==="MultiPolygon"?3:ee==="LineString"||ee==="MultiLineString"?2:1,tags:ne};z.id!==null&&(K.id=z.id),X.features.push(K)}}function at(X,z,M,V,G,ee){const ie=V*V;if(V>0&&z.size<(G?ie:V))return void(M.numPoints+=z.length/3);const ne=[];for(let K=0;K<z.length;K+=3)(V===0||z[K+2]>ie)&&(M.numSimplified++,ne.push(z[K],z[K+1])),M.numPoints++;G&&function(K,pe){let xe=0;for(let he=0,Ie=K.length,Ge=Ie-2;he<Ie;Ge=he,he+=2)xe+=(K[he]-K[Ge])*(K[he+1]+K[Ge+1]);if(xe>0===pe)for(let he=0,Ie=K.length;he<Ie/2;he+=2){const Ge=K[he],Xe=K[he+1];K[he]=K[Ie-2-he],K[he+1]=K[Ie-1-he],K[Ie-2-he]=Ge,K[Ie-1-he]=Xe}}(ne,ee),X.push(ne)}const Ye={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class Pi{constructor(z,M){const V=(M=this.options=function(ee,ie){for(const ne in ie)ee[ne]=ie[ne];return ee}(Object.create(Ye),M)).debug;if(V&&console.time("preprocess data"),M.maxZoom<0||M.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(M.promoteId&&M.generateId)throw new Error("promoteId and generateId cannot be used together.");let G=function(ee,ie){const ne=[];if(ee.type==="FeatureCollection")for(let K=0;K<ee.features.length;K++)Ur(ne,ee.features[K],ie,K);else Ur(ne,ee.type==="Feature"?ee:{geometry:ee},ie);return ne}(z,M);this.tiles={},this.tileCoords=[],V&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",M.indexMaxZoom,M.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),G=function(ee,ie){const ne=ie.buffer/ie.extent;let K=ee;const pe=jt(ee,1,-1-ne,ne,0,-1,2,ie),xe=jt(ee,1,1-ne,2+ne,0,-1,2,ie);return(pe||xe)&&(K=jt(ee,1,-ne,1+ne,0,-1,2,ie)||[],pe&&(K=ke(pe,1).concat(K)),xe&&(K=K.concat(ke(xe,-1)))),K}(G,M),G.length&&this.splitTile(G,0,0,0),V&&(G.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}splitTile(z,M,V,G,ee,ie,ne){const K=[z,M,V,G],pe=this.options,xe=pe.debug;for(;K.length;){G=K.pop(),V=K.pop(),M=K.pop(),z=K.pop();const he=1<<M,Ie=tr(M,V,G);let Ge=this.tiles[Ie];if(!Ge&&(xe>1&&console.time("creation"),Ge=this.tiles[Ie]=Zr(z,M,V,G,pe),this.tileCoords.push({z:M,x:V,y:G}),xe)){xe>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",M,V,G,Ge.numFeatures,Ge.numPoints,Ge.numSimplified),console.timeEnd("creation"));const ei=`z${M}`;this.stats[ei]=(this.stats[ei]||0)+1,this.total++}if(Ge.source=z,ee==null){if(M===pe.indexMaxZoom||Ge.numPoints<=pe.indexMaxPoints)continue}else{if(M===pe.maxZoom||M===ee)continue;if(ee!=null){const ei=ee-M;if(V!==ie>>ei||G!==ne>>ei)continue}}if(Ge.source=null,z.length===0)continue;xe>1&&console.time("clipping");const Xe=.5*pe.buffer/pe.extent,nt=.5-Xe,mt=.5+Xe,rt=1+Xe;let Ct=null,Ut=null,Kt=null,lt=null,vt=jt(z,he,V-Xe,V+mt,0,Ge.minX,Ge.maxX,pe),Ot=jt(z,he,V+nt,V+rt,0,Ge.minX,Ge.maxX,pe);z=null,vt&&(Ct=jt(vt,he,G-Xe,G+mt,1,Ge.minY,Ge.maxY,pe),Ut=jt(vt,he,G+nt,G+rt,1,Ge.minY,Ge.maxY,pe),vt=null),Ot&&(Kt=jt(Ot,he,G-Xe,G+mt,1,Ge.minY,Ge.maxY,pe),lt=jt(Ot,he,G+nt,G+rt,1,Ge.minY,Ge.maxY,pe),Ot=null),xe>1&&console.timeEnd("clipping"),K.push(Ct||[],M+1,2*V,2*G),K.push(Ut||[],M+1,2*V,2*G+1),K.push(Kt||[],M+1,2*V+1,2*G),K.push(lt||[],M+1,2*V+1,2*G+1)}}getTile(z,M,V){z=+z,M=+M,V=+V;const G=this.options,{extent:ee,debug:ie}=G;if(z<0||z>24)return null;const ne=1<<z,K=tr(z,M=M+ne&ne-1,V);if(this.tiles[K])return Si(this.tiles[K],ee);ie>1&&console.log("drilling down to z%d-%d-%d",z,M,V);let pe,xe=z,he=M,Ie=V;for(;!pe&&xe>0;)xe--,he>>=1,Ie>>=1,pe=this.tiles[tr(xe,he,Ie)];return pe&&pe.source?(ie>1&&(console.log("found parent tile z%d-%d-%d",xe,he,Ie),console.time("drilling down")),this.splitTile(pe.source,xe,he,Ie,z,M,V),ie>1&&console.timeEnd("drilling down"),this.tiles[K]?Si(this.tiles[K],ee):null):null}}function tr(X,z,M){return 32*((1<<X)*M+z)+X}function it(X,z){return z?X.properties[z]:X.id}function gr(X,z){if(X==null)return!0;if(X.type==="Feature")return it(X,z)!=null;if(X.type==="FeatureCollection"){const M=new Set;for(const V of X.features){const G=it(V,z);if(G==null||M.has(G))return!1;M.add(G)}return!0}return!1}function Mr(X,z){const M=new Map;if(X!=null)if(X.type==="Feature")M.set(it(X,z),X);else for(const V of X.features)M.set(it(V,z),V);return M}class Gr extends le{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(z,M){return T._(this,void 0,void 0,function*(){const V=z.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const G=this._geoJSONIndex.getTile(V.z,V.x,V.y);if(!G)return null;const ee=new class{constructor(ne){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=T.X,this.length=ne.length,this._features=ne}feature(ne){return new class{constructor(K){this._feature=K,this.extent=T.X,this.type=K.type,this.properties=K.tags,"id"in K&&!isNaN(K.id)&&(this.id=parseInt(K.id,10))}loadGeometry(){if(this._feature.type===1){const K=[];for(const pe of this._feature.geometry)K.push([new T.P(pe[0],pe[1])]);return K}{const K=[];for(const pe of this._feature.geometry){const xe=[];for(const he of pe)xe.push(new T.P(he[0],he[1]));K.push(xe)}return K}}toGeoJSON(K,pe,xe){return Oe.call(this,K,pe,xe)}}(this._features[ne])}}(G.features);let ie=dr(ee);return ie.byteOffset===0&&ie.byteLength===ie.buffer.byteLength||(ie=new Uint8Array(ie)),{vectorTile:ee,rawData:ie.buffer}})}loadData(z){return T._(this,void 0,void 0,function*(){var M;(M=this._pendingRequest)===null||M===void 0||M.abort();const V=!!(z&&z.request&&z.request.collectResourceTiming)&&new T.bu(z.request);this._pendingRequest=new AbortController;try{this._pendingData=this.loadAndProcessGeoJSON(z,this._pendingRequest),this._geoJSONIndex=z.cluster?new $r(function({superclusterOptions:ie,clusterProperties:ne}){if(!ne||!ie)return ie;const K={},pe={},xe={accumulated:null,zoom:0},he={properties:null},Ie=Object.keys(ne);for(const Ge of Ie){const[Xe,nt]=ne[Ge],mt=T.bB(nt),rt=T.bB(typeof Xe=="string"?[Xe,["accumulated"],["get",Ge]]:Xe);K[Ge]=mt.value,pe[Ge]=rt.value}return ie.map=Ge=>{he.properties=Ge;const Xe={};for(const nt of Ie)Xe[nt]=K[nt].evaluate(xe,he);return Xe},ie.reduce=(Ge,Xe)=>{he.properties=Xe;for(const nt of Ie)xe.accumulated=Ge[nt],Ge[nt]=pe[nt].evaluate(xe,he)},ie}(z)).load((yield this._pendingData).features):(G=yield this._pendingData,new Pi(G,z.geojsonVtOptions)),this.loaded={};const ee={};if(V){const ie=V.finish();ie&&(ee.resourceTiming={},ee.resourceTiming[z.source]=JSON.parse(JSON.stringify(ie)))}return ee}catch(ee){if(delete this._pendingRequest,T.bA(ee))return{abandoned:!0};throw ee}var G})}getData(){return T._(this,void 0,void 0,function*(){return this._pendingData})}reloadTile(z){const M=this.loaded;return M&&M[z.uid]?super.reloadTile(z):this.loadTile(z)}loadAndProcessGeoJSON(z,M){return T._(this,void 0,void 0,function*(){let V=yield this.loadGeoJSON(z,M);if(delete this._pendingRequest,typeof V!="object")throw new Error(`Input data given to '${z.source}' is not a valid GeoJSON object.`);if(Ke(V,!0),z.filter){const G=T.bB(z.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(G.result==="error")throw new Error(G.value.map(ie=>`${ie.key}: ${ie.message}`).join(", "));V={type:"FeatureCollection",features:V.features.filter(ie=>G.value.evaluate({zoom:0},ie))}}return V})}loadGeoJSON(z,M){return T._(this,void 0,void 0,function*(){const{promoteId:V}=z;if(z.request){const G=yield T.h(z.request,M);return this._dataUpdateable=gr(G.data,V)?Mr(G.data,V):void 0,G.data}if(typeof z.data=="string")try{const G=JSON.parse(z.data);return this._dataUpdateable=gr(G,V)?Mr(G,V):void 0,G}catch{throw new Error(`Input data given to '${z.source}' is not a valid GeoJSON object.`)}if(!z.dataDiff)throw new Error(`Input data given to '${z.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${z.source}`);return function(G,ee,ie){var ne,K,pe,xe;if(ee.removeAll&&G.clear(),ee.remove)for(const he of ee.remove)G.delete(he);if(ee.add)for(const he of ee.add){const Ie=it(he,ie);Ie!=null&&G.set(Ie,he)}if(ee.update)for(const he of ee.update){let Ie=G.get(he.id);if(Ie==null)continue;const Ge=!he.removeAllProperties&&(((ne=he.removeProperties)===null||ne===void 0?void 0:ne.length)>0||((K=he.addOrUpdateProperties)===null||K===void 0?void 0:K.length)>0);if((he.newGeometry||he.removeAllProperties||Ge)&&(Ie=Object.assign({},Ie),G.set(he.id,Ie),Ge&&(Ie.properties=Object.assign({},Ie.properties))),he.newGeometry&&(Ie.geometry=he.newGeometry),he.removeAllProperties)Ie.properties={};else if(((pe=he.removeProperties)===null||pe===void 0?void 0:pe.length)>0)for(const Xe of he.removeProperties)Object.prototype.hasOwnProperty.call(Ie.properties,Xe)&&delete Ie.properties[Xe];if(((xe=he.addOrUpdateProperties)===null||xe===void 0?void 0:xe.length)>0)for(const{key:Xe,value:nt}of he.addOrUpdateProperties)Ie.properties[Xe]=nt}}(this._dataUpdateable,z.dataDiff,V),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(z){return T._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(z){return this._geoJSONIndex.getClusterExpansionZoom(z.clusterId)}getClusterChildren(z){return this._geoJSONIndex.getChildren(z.clusterId)}getClusterLeaves(z){return this._geoJSONIndex.getLeaves(z.clusterId,z.limit,z.offset)}}class _r{constructor(z){this.self=z,this.actor=new T.F(z),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(M,V)=>{if(this.externalWorkerSourceTypes[M])throw new Error(`Worker source with name "${M}" already registered.`);this.externalWorkerSourceTypes[M]=V},this.self.addProtocol=T.bh,this.self.removeProtocol=T.bi,this.self.registerRTLTextPlugin=M=>{if(T.bC.isParsed())throw new Error("RTL text plugin already registered.");T.bC.setMethods(M)},this.actor.registerMessageHandler("LDT",(M,V)=>this._getDEMWorkerSource(M,V.source).loadTile(V)),this.actor.registerMessageHandler("RDT",(M,V)=>T._(this,void 0,void 0,function*(){this._getDEMWorkerSource(M,V.source).removeTile(V)})),this.actor.registerMessageHandler("GCEZ",(M,V)=>T._(this,void 0,void 0,function*(){return this._getWorkerSource(M,V.type,V.source).getClusterExpansionZoom(V)})),this.actor.registerMessageHandler("GCC",(M,V)=>T._(this,void 0,void 0,function*(){return this._getWorkerSource(M,V.type,V.source).getClusterChildren(V)})),this.actor.registerMessageHandler("GCL",(M,V)=>T._(this,void 0,void 0,function*(){return this._getWorkerSource(M,V.type,V.source).getClusterLeaves(V)})),this.actor.registerMessageHandler("LD",(M,V)=>this._getWorkerSource(M,V.type,V.source).loadData(V)),this.actor.registerMessageHandler("GD",(M,V)=>this._getWorkerSource(M,V.type,V.source).getData()),this.actor.registerMessageHandler("LT",(M,V)=>this._getWorkerSource(M,V.type,V.source).loadTile(V)),this.actor.registerMessageHandler("RT",(M,V)=>this._getWorkerSource(M,V.type,V.source).reloadTile(V)),this.actor.registerMessageHandler("AT",(M,V)=>this._getWorkerSource(M,V.type,V.source).abortTile(V)),this.actor.registerMessageHandler("RMT",(M,V)=>this._getWorkerSource(M,V.type,V.source).removeTile(V)),this.actor.registerMessageHandler("RS",(M,V)=>T._(this,void 0,void 0,function*(){if(!this.workerSources[M]||!this.workerSources[M][V.type]||!this.workerSources[M][V.type][V.source])return;const G=this.workerSources[M][V.type][V.source];delete this.workerSources[M][V.type][V.source],G.removeSource!==void 0&&G.removeSource(V)})),this.actor.registerMessageHandler("RM",M=>T._(this,void 0,void 0,function*(){delete this.layerIndexes[M],delete this.availableImages[M],delete this.workerSources[M],delete this.demWorkerSources[M]})),this.actor.registerMessageHandler("SR",(M,V)=>T._(this,void 0,void 0,function*(){this.referrer=V})),this.actor.registerMessageHandler("SRPS",(M,V)=>this._syncRTLPluginState(M,V)),this.actor.registerMessageHandler("IS",(M,V)=>T._(this,void 0,void 0,function*(){this.self.importScripts(V)})),this.actor.registerMessageHandler("SI",(M,V)=>this._setImages(M,V)),this.actor.registerMessageHandler("UL",(M,V)=>T._(this,void 0,void 0,function*(){this._getLayerIndex(M).update(V.layers,V.removedIds)})),this.actor.registerMessageHandler("SL",(M,V)=>T._(this,void 0,void 0,function*(){this._getLayerIndex(M).replace(V)}))}_setImages(z,M){return T._(this,void 0,void 0,function*(){this.availableImages[z]=M;for(const V in this.workerSources[z]){const G=this.workerSources[z][V];for(const ee in G)G[ee].availableImages=M}})}_syncRTLPluginState(z,M){return T._(this,void 0,void 0,function*(){if(T.bC.isParsed())return T.bC.getState();if(M.pluginStatus!=="loading")return T.bC.setState(M),M;const V=M.pluginURL;if(this.self.importScripts(V),T.bC.isParsed()){const G={pluginStatus:"loaded",pluginURL:V};return T.bC.setState(G),G}throw T.bC.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${V}`)})}_getAvailableImages(z){let M=this.availableImages[z];return M||(M=[]),M}_getLayerIndex(z){let M=this.layerIndexes[z];return M||(M=this.layerIndexes[z]=new c),M}_getWorkerSource(z,M,V){if(this.workerSources[z]||(this.workerSources[z]={}),this.workerSources[z][M]||(this.workerSources[z][M]={}),!this.workerSources[z][M][V]){const G={sendAsync:(ee,ie)=>(ee.targetMapId=z,this.actor.sendAsync(ee,ie))};switch(M){case"vector":this.workerSources[z][M][V]=new le(G,this._getLayerIndex(z),this._getAvailableImages(z));break;case"geojson":this.workerSources[z][M][V]=new Gr(G,this._getLayerIndex(z),this._getAvailableImages(z));break;default:this.workerSources[z][M][V]=new this.externalWorkerSourceTypes[M](G,this._getLayerIndex(z),this._getAvailableImages(z))}}return this.workerSources[z][M][V]}_getDEMWorkerSource(z,M){return this.demWorkerSources[z]||(this.demWorkerSources[z]={}),this.demWorkerSources[z][M]||(this.demWorkerSources[z][M]=new oe),this.demWorkerSources[z][M]}}return T.i(self)&&(self.worker=new _r(self)),_r}),L("index",["exports","./shared"],function(T,c){var fe="4.5.2";let me,ve;const le={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:u=>new Promise((t,n)=>{const o=requestAnimationFrame(t);u.signal.addEventListener("abort",()=>{cancelAnimationFrame(o),n(c.c())})}),getImageData(u,t=0){return this.getImageCanvasContext(u).getImageData(-t,-t,u.width+2*t,u.height+2*t)},getImageCanvasContext(u){const t=window.document.createElement("canvas"),n=t.getContext("2d",{willReadFrequently:!0});if(!n)throw new Error("failed to create canvas 2d context");return t.width=u.width,t.height=u.height,n.drawImage(u,0,0,u.width,u.height),n},resolveURL:u=>(me||(me=document.createElement("a")),me.href=u,me.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(ve==null&&(ve=matchMedia("(prefers-reduced-motion: reduce)")),ve.matches)}};class oe{static testProp(t){if(!oe.docStyle)return t[0];for(let n=0;n<t.length;n++)if(t[n]in oe.docStyle)return t[n];return t[0]}static create(t,n,o){const a=window.document.createElement(t);return n!==void 0&&(a.className=n),o&&o.appendChild(a),a}static createNS(t,n){return window.document.createElementNS(t,n)}static disableDrag(){oe.docStyle&&oe.selectProp&&(oe.userSelect=oe.docStyle[oe.selectProp],oe.docStyle[oe.selectProp]="none")}static enableDrag(){oe.docStyle&&oe.selectProp&&(oe.docStyle[oe.selectProp]=oe.userSelect)}static setTransform(t,n){t.style[oe.transformProp]=n}static addEventListener(t,n,o,a={}){t.addEventListener(n,o,"passive"in a?a:a.capture)}static removeEventListener(t,n,o,a={}){t.removeEventListener(n,o,"passive"in a?a:a.capture)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",oe.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",oe.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",oe.suppressClickInternal,!0)},0)}static getScale(t){const n=t.getBoundingClientRect();return{x:n.width/t.offsetWidth||1,y:n.height/t.offsetHeight||1,boundingClientRect:n}}static getPoint(t,n,o){const a=n.boundingClientRect;return new c.P((o.clientX-a.left)/n.x-t.clientLeft,(o.clientY-a.top)/n.y-t.clientTop)}static mousePos(t,n){const o=oe.getScale(t);return oe.getPoint(t,o,n)}static touchPos(t,n){const o=[],a=oe.getScale(t);for(let h=0;h<n.length;h++)o.push(oe.getPoint(t,a,n[h]));return o}static mouseButton(t){return t.button}static remove(t){t.parentNode&&t.parentNode.removeChild(t)}}oe.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,oe.selectProp=oe.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),oe.transformProp=oe.testProp(["transform","WebkitTransform"]);const ht={supported:!1,testSupport:function(u){!Oe&&Ke&&(ft?st(u):je=u)}};let je,Ke,Oe=!1,ft=!1;function st(u){const t=u.createTexture();u.bindTexture(u.TEXTURE_2D,t);try{if(u.texImage2D(u.TEXTURE_2D,0,u.RGBA,u.RGBA,u.UNSIGNED_BYTE,Ke),u.isContextLost())return;ht.supported=!0}catch{}u.deleteTexture(t),Oe=!0}var He;typeof document<"u"&&(Ke=document.createElement("img"),Ke.onload=()=>{je&&st(je),je=null,ft=!0},Ke.onerror=()=>{Oe=!0,je=null},Ke.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(u){let t,n,o,a;u.resetRequestQueue=()=>{t=[],n=0,o=0,a={}},u.addThrottleControl=b=>{const w=o++;return a[w]=b,w},u.removeThrottleControl=b=>{delete a[b],g()},u.getImage=(b,w,C=!0)=>new Promise((E,R)=>{ht.supported&&(b.headers||(b.headers={}),b.headers.accept="image/webp,*/*"),c.e(b,{type:"image"}),t.push({abortController:w,requestParameters:b,supportImageRefresh:C,state:"queued",onError:F=>{R(F)},onSuccess:F=>{E(F)}}),g()});const h=b=>c._(this,void 0,void 0,function*(){b.state="running";const{requestParameters:w,supportImageRefresh:C,onError:E,onSuccess:R,abortController:F}=b,$=C===!1&&!c.i(self)&&!c.g(w.url)&&(!w.headers||Object.keys(w.headers).reduce((W,Y)=>W&&Y==="accept",!0));n++;const H=$?y(w,F):c.m(w,F);try{const W=yield H;delete b.abortController,b.state="completed",W.data instanceof HTMLImageElement||c.b(W.data)?R(W):W.data&&R({data:yield(U=W.data,typeof createImageBitmap=="function"?c.d(U):c.f(U)),cacheControl:W.cacheControl,expires:W.expires})}catch(W){delete b.abortController,E(W)}finally{n--,g()}var U}),g=()=>{const b=(()=>{for(const w of Object.keys(a))if(a[w]())return!0;return!1})()?c.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:c.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let w=n;w<b&&t.length>0;w++){const C=t.shift();C.abortController.signal.aborted?w--:h(C)}},y=(b,w)=>new Promise((C,E)=>{const R=new Image,F=b.url,$=b.credentials;$&&$==="include"?R.crossOrigin="use-credentials":($&&$==="same-origin"||!c.s(F))&&(R.crossOrigin="anonymous"),w.signal.addEventListener("abort",()=>{R.src="",E(c.c())}),R.fetchPriority="high",R.onload=()=>{R.onerror=R.onload=null,C({data:R})},R.onerror=()=>{R.onerror=R.onload=null,w.signal.aborted||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."))},R.src=F})}(He||(He={})),He.resetRequestQueue();class Ft{constructor(t){this._transformRequestFn=t}transformRequest(t,n){return this._transformRequestFn&&this._transformRequestFn(t,n)||{url:t}}setTransformRequest(t){this._transformRequestFn=t}}function wt(u){var t=new c.A(3);return t[0]=u[0],t[1]=u[1],t[2]=u[2],t}var Xt,$t=function(u,t,n){return u[0]=t[0]-n[0],u[1]=t[1]-n[1],u[2]=t[2]-n[2],u};Xt=new c.A(3),c.A!=Float32Array&&(Xt[0]=0,Xt[1]=0,Xt[2]=0);var Vr=function(u){var t=u[0],n=u[1];return t*t+n*n};function bi(u){const t=[];if(typeof u=="string")t.push({id:"default",url:u});else if(u&&u.length>0){const n=[];for(const{id:o,url:a}of u){const h=`${o}${a}`;n.indexOf(h)===-1&&(n.push(h),t.push({id:o,url:a}))}}return t}function Nr(u,t,n){const o=u.split("?");return o[0]+=`${t}${n}`,o.join("?")}(function(){var u=new c.A(2);c.A!=Float32Array&&(u[0]=0,u[1]=0)})();class St{constructor(t,n,o,a){this.context=t,this.format=o,this.texture=t.gl.createTexture(),this.update(n,a)}update(t,n,o){const{width:a,height:h}=t,g=!(this.size&&this.size[0]===a&&this.size[1]===h||o),{context:y}=this,{gl:b}=y;if(this.useMipmap=!!(n&&n.useMipmap),b.bindTexture(b.TEXTURE_2D,this.texture),y.pixelStoreUnpackFlipY.set(!1),y.pixelStoreUnpack.set(1),y.pixelStoreUnpackPremultiplyAlpha.set(this.format===b.RGBA&&(!n||n.premultiply!==!1)),g)this.size=[a,h],t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||c.b(t)?b.texImage2D(b.TEXTURE_2D,0,this.format,this.format,b.UNSIGNED_BYTE,t):b.texImage2D(b.TEXTURE_2D,0,this.format,a,h,0,this.format,b.UNSIGNED_BYTE,t.data);else{const{x:w,y:C}=o||{x:0,y:0};t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||c.b(t)?b.texSubImage2D(b.TEXTURE_2D,0,w,C,b.RGBA,b.UNSIGNED_BYTE,t):b.texSubImage2D(b.TEXTURE_2D,0,w,C,a,h,b.RGBA,b.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&b.generateMipmap(b.TEXTURE_2D)}bind(t,n,o){const{context:a}=this,{gl:h}=a;h.bindTexture(h.TEXTURE_2D,this.texture),o!==h.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(o=h.LINEAR),t!==this.filter&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,t),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,o||t),this.filter=t),n!==this.wrap&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,n),h.texParameteri(h.TEXTURE_2D,h.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 js(u){const{userImage:t}=u;return!!(t&&t.render&&t.render())&&(u.data.replace(new Uint8Array(t.data.buffer)),!0)}class li extends c.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new c.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(const{ids:n,promiseResolve:o}of this.requestors)o(this._getImagesForIds(n));this.requestors=[]}}getImage(t){const n=this.images[t];if(n&&!n.data&&n.spriteData){const o=n.spriteData;n.data=new c.R({width:o.width,height:o.height},o.context.getImageData(o.x,o.y,o.width,o.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 o=!0;const a=n.data||n.spriteData;return this._validateStretch(n.stretchX,a&&a.width)||(this.fire(new c.j(new Error(`Image "${t}" has invalid "stretchX" value`))),o=!1),this._validateStretch(n.stretchY,a&&a.height)||(this.fire(new c.j(new Error(`Image "${t}" has invalid "stretchY" value`))),o=!1),this._validateContent(n.content,n)||(this.fire(new c.j(new Error(`Image "${t}" has invalid "content" value`))),o=!1),o}_validateStretch(t,n){if(!t)return!0;let o=0;for(const a of t){if(a[0]<o||a[1]<a[0]||n<a[1])return!1;o=a[1]}return!0}_validateContent(t,n){if(!t)return!0;if(t.length!==4)return!1;const o=n.spriteData,a=o&&o.width||n.data.width,h=o&&o.height||n.data.height;return!(t[0]<0||a<t[0]||t[1]<0||h<t[1]||t[2]<0||a<t[2]||t[3]<0||h<t[3]||t[2]<t[0]||t[3]<t[1])}updateImage(t,n,o=!0){const a=this.getImage(t);if(o&&(a.data.width!==n.data.width||a.data.height!==n.data.height))throw new Error(`size mismatch between old image (${a.data.width}x${a.data.height}) and new image (${n.data.width}x${n.data.height}).`);n.version=a.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){return new Promise((n,o)=>{let a=!0;if(!this.isLoaded())for(const h of t)this.images[h]||(a=!1);this.isLoaded()||a?n(this._getImagesForIds(t)):this.requestors.push({ids:t,promiseResolve:n})})}_getImagesForIds(t){const n={};for(const o of t){let a=this.getImage(o);a||(this.fire(new c.k("styleimagemissing",{id:o})),a=this.getImage(o)),a?n[o]={data:a.data.clone(),pixelRatio:a.pixelRatio,sdf:a.sdf,version:a.version,stretchX:a.stretchX,stretchY:a.stretchY,content:a.content,textFitWidth:a.textFitWidth,textFitHeight:a.textFitHeight,hasRenderCallback:!!(a.userImage&&a.userImage.render)}:c.w(`Image "${o}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}return n}getPixelSize(){const{width:t,height:n}=this.atlasImage;return{width:t,height:n}}getPattern(t){const n=this.patterns[t],o=this.getImage(t);if(!o)return null;if(n&&n.position.version===o.version)return n.position;if(n)n.position.version=o.version;else{const a={w:o.data.width+2,h:o.data.height+2,x:0,y:0},h=new c.I(a,o);this.patterns[t]={bin:a,position:h}}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 St(t,this.atlasImage,n.RGBA),this.atlasTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}_updatePatternAtlas(){const t=[];for(const h in this.patterns)t.push(this.patterns[h].bin);const{w:n,h:o}=c.p(t),a=this.atlasImage;a.resize({width:n||1,height:o||1});for(const h in this.patterns){const{bin:g}=this.patterns[h],y=g.x+1,b=g.y+1,w=this.getImage(h).data,C=w.width,E=w.height;c.R.copy(w,a,{x:0,y:0},{x:y,y:b},{width:C,height:E}),c.R.copy(w,a,{x:0,y:E-1},{x:y,y:b-1},{width:C,height:1}),c.R.copy(w,a,{x:0,y:0},{x:y,y:b+E},{width:C,height:1}),c.R.copy(w,a,{x:C-1,y:0},{x:y-1,y:b},{width:1,height:E}),c.R.copy(w,a,{x:0,y:0},{x:y+C,y:b},{width:1,height:E})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(t){for(const n of t){if(this.callbackDispatchedThisFrame[n])continue;this.callbackDispatchedThisFrame[n]=!0;const o=this.getImage(n);o||c.w(`Image with ID: "${n}" was not found`),js(o)&&this.updateImage(n,o)}}}const wi=1e20;function Cr(u,t,n,o,a,h,g,y,b){for(let w=t;w<t+o;w++)En(u,n*h+w,h,a,g,y,b);for(let w=n;w<n+a;w++)En(u,w*h+t,1,o,g,y,b)}function En(u,t,n,o,a,h,g){h[0]=0,g[0]=-wi,g[1]=wi,a[0]=u[t];for(let y=1,b=0,w=0;y<o;y++){a[y]=u[t+y*n];const C=y*y;do{const E=h[b];w=(a[y]-a[E]+C-E*E)/(y-E)/2}while(w<=g[b]&&--b>-1);b++,h[b]=y,g[b]=w,g[b+1]=wi}for(let y=0,b=0;y<o;y++){for(;g[b+1]<y;)b++;const w=h[b],C=y-w;u[t+y*n]=a[w]+C*C}}class dr{constructor(t,n){this.requestManager=t,this.localIdeographFontFamily=n,this.entries={}}setURL(t){this.url=t}getGlyphs(t){return c._(this,void 0,void 0,function*(){const n=[];for(const h in t)for(const g of t[h])n.push(this._getAndCacheGlyphsPromise(h,g));const o=yield Promise.all(n),a={};for(const{stack:h,id:g,glyph:y}of o)a[h]||(a[h]={}),a[h][g]=y&&{id:y.id,bitmap:y.bitmap.clone(),metrics:y.metrics};return a})}_getAndCacheGlyphsPromise(t,n){return c._(this,void 0,void 0,function*(){let o=this.entries[t];o||(o=this.entries[t]={glyphs:{},requests:{},ranges:{}});let a=o.glyphs[n];if(a!==void 0)return{stack:t,id:n,glyph:a};if(a=this._tinySDF(o,t,n),a)return o.glyphs[n]=a,{stack:t,id:n,glyph:a};const h=Math.floor(n/256);if(256*h>65535)throw new Error("glyphs > 65535 not supported");if(o.ranges[h])return{stack:t,id:n,glyph:a};if(!this.url)throw new Error("glyphsUrl is not set");if(!o.requests[h]){const y=dr.loadGlyphRange(t,h,this.url,this.requestManager);o.requests[h]=y}const g=yield o.requests[h];for(const y in g)this._doesCharSupportLocalGlyph(+y)||(o.glyphs[+y]=g[+y]);return o.ranges[h]=!0,{stack:t,id:n,glyph:g[n]||null}})}_doesCharSupportLocalGlyph(t){return!!this.localIdeographFontFamily&&(c.u["CJK Unified Ideographs"](t)||c.u["Hangul Syllables"](t)||c.u.Hiragana(t)||c.u.Katakana(t))}_tinySDF(t,n,o){const a=this.localIdeographFontFamily;if(!a||!this._doesCharSupportLocalGlyph(o))return;let h=t.tinySDF;if(!h){let y="400";/bold/i.test(n)?y="900":/medium/i.test(n)?y="500":/light/i.test(n)&&(y="200"),h=t.tinySDF=new dr.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:a,fontWeight:y})}const g=h.draw(String.fromCharCode(o));return{id:o,bitmap:new c.o({width:g.width||60,height:g.height||60},g.data),metrics:{width:g.glyphWidth/2||24,height:g.glyphHeight/2||24,left:g.glyphLeft/2+.5||0,top:g.glyphTop/2-27.5||-8,advance:g.glyphAdvance/2||24,isDoubleResolution:!0}}}}dr.loadGlyphRange=function(u,t,n,o){return c._(this,void 0,void 0,function*(){const a=256*t,h=a+255,g=o.transformRequest(n.replace("{fontstack}",u).replace("{range}",`${a}-${h}`),"Glyphs"),y=yield c.l(g,new AbortController);if(!y||!y.data)throw new Error(`Could not load glyph range. range: ${t}, ${a}-${h}`);const b={};for(const w of c.n(y.data))b[w.id]=w;return b})},dr.TinySDF=class{constructor({fontSize:u=24,buffer:t=3,radius:n=8,cutoff:o=.25,fontFamily:a="sans-serif",fontWeight:h="normal",fontStyle:g="normal"}={}){this.buffer=t,this.cutoff=o,this.radius=n;const y=this.size=u+4*t,b=this._createCanvas(y),w=this.ctx=b.getContext("2d",{willReadFrequently:!0});w.font=`${g} ${h} ${u}px ${a}`,w.textBaseline="alphabetic",w.textAlign="left",w.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(u){const t=document.createElement("canvas");return t.width=t.height=u,t}draw(u){const{width:t,actualBoundingBoxAscent:n,actualBoundingBoxDescent:o,actualBoundingBoxLeft:a,actualBoundingBoxRight:h}=this.ctx.measureText(u),g=Math.ceil(n),y=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(h-a))),b=Math.min(this.size-this.buffer,g+Math.ceil(o)),w=y+2*this.buffer,C=b+2*this.buffer,E=Math.max(w*C,0),R=new Uint8ClampedArray(E),F={data:R,width:w,height:C,glyphWidth:y,glyphHeight:b,glyphTop:g,glyphLeft:0,glyphAdvance:t};if(y===0||b===0)return F;const{ctx:$,buffer:H,gridInner:U,gridOuter:W}=this;$.clearRect(H,H,y,b),$.fillText(u,H,H+g);const Y=$.getImageData(H,H,y,b);W.fill(wi,0,E),U.fill(0,0,E);for(let j=0;j<b;j++)for(let te=0;te<y;te++){const se=Y.data[4*(j*y+te)+3]/255;if(se===0)continue;const ce=(j+H)*w+te+H;if(se===1)W[ce]=0,U[ce]=wi;else{const ye=.5-se;W[ce]=ye>0?ye*ye:0,U[ce]=ye<0?ye*ye:0}}Cr(W,0,0,w,C,w,this.f,this.v,this.z),Cr(U,H,H,y,b,w,this.f,this.v,this.z);for(let j=0;j<E;j++){const te=Math.sqrt(W[j])-Math.sqrt(U[j]);R[j]=Math.round(255-255*(te/this.radius+this.cutoff))}return F}};class Us{constructor(){this.specification=c.v.light.position}possiblyEvaluate(t,n){return c.y(t.expression.evaluate(n))}interpolate(t,n,o){return{x:c.z.number(t.x,n.x,o),y:c.z.number(t.y,n.y,o),z:c.z.number(t.z,n.z,o)}}}let on;class Er extends c.E{constructor(t){super(),on=on||new c.q({anchor:new c.D(c.v.light.anchor),position:new Us,color:new c.D(c.v.light.color),intensity:new c.D(c.v.light.intensity)}),this._transitionable=new c.T(on),this.setLight(t),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,n={}){if(!this._validate(c.r,t,n))for(const o in t){const a=t[o];o.endsWith("-transition")?this._transitionable.setTransition(o.slice(0,-11),a):this._transitionable.setValue(o,a)}}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,o){return(!o||o.validate!==!1)&&c.t(this,t.call(c.x,{value:n,style:{glyphs:!0,sprite:!0},styleSpec:c.v}))}}const Ei=new c.q({"sky-color":new c.D(c.v.sky["sky-color"]),"horizon-color":new c.D(c.v.sky["horizon-color"]),"fog-color":new c.D(c.v.sky["fog-color"]),"fog-ground-blend":new c.D(c.v.sky["fog-ground-blend"]),"horizon-fog-blend":new c.D(c.v.sky["horizon-fog-blend"]),"sky-horizon-blend":new c.D(c.v.sky["sky-horizon-blend"]),"atmosphere-blend":new c.D(c.v.sky["atmosphere-blend"])});class Qi extends c.E{constructor(t){super(),this._transitionable=new c.T(Ei),this.setSky(t),this._transitioning=this._transitionable.untransitioned()}setSky(t,n={}){if(!this._validate(c.B,t,n))for(const o in t){const a=t[o];o.endsWith("-transition")?this._transitionable.setTransition(o.slice(0,-11),a):this._transitionable.setValue(o,a)}}getSky(){return this._transitionable.serialize()}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,n,o={}){return(o==null?void 0:o.validate)!==!1&&c.t(this,t.call(c.x,c.e({value:n,style:{glyphs:!0,sprite:!0},styleSpec:c.v})))}calculateFogBlendOpacity(t){return t<60?0:t<70?(t-60)/10:1}}class Pn{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 o=t.join(",")+String(n);return this.dashEntry[o]||(this.dashEntry[o]=this.addDash(t,n)),this.dashEntry[o]}getDashRanges(t,n,o){const a=[];let h=t.length%2==1?-t[t.length-1]*o:0,g=t[0]*o,y=!0;a.push({left:h,right:g,isDash:y,zeroLength:t[0]===0});let b=t[0];for(let w=1;w<t.length;w++){y=!y;const C=t[w];h=b*o,b+=C,g=b*o,a.push({left:h,right:g,isDash:y,zeroLength:C===0})}return a}addRoundDash(t,n,o){const a=n/2;for(let h=-o;h<=o;h++){const g=this.width*(this.nextRow+o+h);let y=0,b=t[y];for(let w=0;w<this.width;w++){w/b.right>1&&(b=t[++y]);const C=Math.abs(w-b.left),E=Math.abs(w-b.right),R=Math.min(C,E);let F;const $=h/o*(a+1);if(b.isDash){const H=a-Math.abs($);F=Math.sqrt(R*R+H*H)}else F=a-Math.sqrt(R*R+$*$);this.data[g+w]=Math.max(0,Math.min(255,F+128))}}}addRegularDash(t){for(let y=t.length-1;y>=0;--y){const b=t[y],w=t[y+1];b.zeroLength?t.splice(y,1):w&&w.isDash===b.isDash&&(w.left=b.left,t.splice(y,1))}const n=t[0],o=t[t.length-1];n.isDash===o.isDash&&(n.left=o.left-this.width,o.right=n.right+this.width);const a=this.width*this.nextRow;let h=0,g=t[h];for(let y=0;y<this.width;y++){y/g.right>1&&(g=t[++h]);const b=Math.abs(y-g.left),w=Math.abs(y-g.right),C=Math.min(b,w);this.data[a+y]=Math.max(0,Math.min(255,(g.isDash?C:-C)+128))}}addDash(t,n){const o=n?7:0,a=2*o+1;if(this.nextRow+a>this.height)return c.w("LineAtlas out of space"),null;let h=0;for(let y=0;y<t.length;y++)h+=t[y];if(h!==0){const y=this.width/h,b=this.getDashRanges(t,this.width,y);n?this.addRoundDash(b,y,o):this.addRegularDash(b)}const g={y:(this.nextRow+o+.5)/this.height,height:2*o/this.height,width:h};return this.nextRow+=a,this.dirty=!0,g}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))}}const $r="maplibre_preloaded_worker_pool";class pr{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<pr.workerCount;)this.workers.push(new Worker(c.a.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[$r]}numActive(){return Object.keys(this.active).length}}const An=Math.floor(le.hardwareConcurrency/2);let Oi,er;function an(){return Oi||(Oi=new pr),Oi}pr.workerCount=c.C(globalThis)?Math.max(Math.min(An,3),1):1;class ln{constructor(t,n){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=n;const o=this.workerPool.acquire(n);for(let a=0;a<o.length;a++){const h=new c.F(o[a],n);h.name=`Worker ${a}`,this.actors.push(h)}if(!this.actors.length)throw new Error("No actors found")}broadcast(t,n){const o=[];for(const a of this.actors)o.push(a.sendAsync({type:t,data:n}));return Promise.all(o)}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)}registerMessageHandler(t,n){for(const o of this.actors)o.registerMessageHandler(t,n)}}function ns(){return er||(er=new ln(an(),c.G),er.registerMessageHandler("GR",(u,t,n)=>c.m(t,n))),er}function Pr(u,t){const n=c.H();return c.J(n,n,[1,1,0]),c.K(n,n,[.5*u.width,.5*u.height,1]),c.L(n,n,u.calculatePosMatrix(t.toUnwrapped()))}function jr(u,t,n,o,a,h){const g=function(E,R,F){if(E)for(const $ of E){const H=R[$];if(H&&H.source===F&&H.type==="fill-extrusion")return!0}else for(const $ in R){const H=R[$];if(H.source===F&&H.type==="fill-extrusion")return!0}return!1}(a&&a.layers,t,u.id),y=h.maxPitchScaleFactor(),b=u.tilesIn(o,y,g);b.sort(Ur);const w=[];for(const E of b)w.push({wrappedTileID:E.tileID.wrapped().key,queryResults:E.tile.queryRenderedFeatures(t,n,u._state,E.queryGeometry,E.cameraQueryGeometry,E.scale,a,h,y,Pr(u.transform,E.tileID))});const C=function(E){const R={},F={};for(const $ of E){const H=$.queryResults,U=$.wrappedTileID,W=F[U]=F[U]||{};for(const Y in H){const j=H[Y],te=W[Y]=W[Y]||{},se=R[Y]=R[Y]||[];for(const ce of j)te[ce.featureIndex]||(te[ce.featureIndex]=!0,se.push(ce))}}return R}(w);for(const E in C)C[E].forEach(R=>{const F=R.feature,$=u.getFeatureState(F.layer["source-layer"],F.id);F.source=F.layer.source,F.layer["source-layer"]&&(F.sourceLayer=F.layer["source-layer"]),F.state=$});return C}function Ur(u,t){const n=u.tileID,o=t.tileID;return n.overscaledZ-o.overscaledZ||n.canonical.y-o.canonical.y||n.wrap-o.wrap||n.canonical.x-o.canonical.x}function Mn(u,t,n){return c._(this,void 0,void 0,function*(){let o=u;if(u.url?o=(yield c.h(t.transformRequest(u.url,"Source"),n)).data:yield le.frameAsync(n),!o)return null;const a=c.M(c.e(o,u),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in o&&o.vector_layers&&(a.vectorLayerIds=o.vector_layers.map(h=>h.id)),a})}class ue{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 c.N?new c.N(t.lng,t.lat):c.N.convert(t),this}setSouthWest(t){return this._sw=t instanceof c.N?new c.N(t.lng,t.lat):c.N.convert(t),this}extend(t){const n=this._sw,o=this._ne;let a,h;if(t instanceof c.N)a=t,h=t;else{if(!(t instanceof ue))return Array.isArray(t)?t.length===4||t.every(Array.isArray)?this.extend(ue.convert(t)):this.extend(c.N.convert(t)):t&&("lng"in t||"lon"in t)&&"lat"in t?this.extend(c.N.convert(t)):this;if(a=t._sw,h=t._ne,!a||!h)return this}return n||o?(n.lng=Math.min(a.lng,n.lng),n.lat=Math.min(a.lat,n.lat),o.lng=Math.max(h.lng,o.lng),o.lat=Math.max(h.lat,o.lat)):(this._sw=new c.N(a.lng,a.lat),this._ne=new c.N(h.lng,h.lat)),this}getCenter(){return new c.N((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new c.N(this.getWest(),this.getNorth())}getSouthEast(){return new c.N(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(t){const{lng:n,lat:o}=c.N.convert(t);let a=this._sw.lng<=n&&n<=this._ne.lng;return this._sw.lng>this._ne.lng&&(a=this._sw.lng>=n&&n>=this._ne.lng),this._sw.lat<=o&&o<=this._ne.lat&&a}static convert(t){return t instanceof ue?t:t&&new ue(t)}static fromLngLat(t,n=0){const o=360*n/40075017,a=o/Math.cos(Math.PI/180*t.lat);return new ue(new c.N(t.lng-a,t.lat-o),new c.N(t.lng+a,t.lat+o))}}class cn{constructor(t,n,o){this.bounds=ue.convert(this.validateBounds(t)),this.minzoom=n||0,this.maxzoom=o||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),o=Math.floor(c.O(this.bounds.getWest())*n),a=Math.floor(c.Q(this.bounds.getNorth())*n),h=Math.ceil(c.O(this.bounds.getEast())*n),g=Math.ceil(c.Q(this.bounds.getSouth())*n);return t.x>=o&&t.x<h&&t.y>=a&&t.y<g}}class ss extends c.E{constructor(t,n,o,a){if(super(),this.id=t,this.dispatcher=o,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,c.e(this,c.M(n,["url","scheme","tileSize","promoteId"])),this._options=c.e({type:"vector"},n),this._collectResourceTiming=n.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(a)}load(){return c._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new c.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const t=yield Mn(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),t&&(c.e(this,t),t.bounds&&(this.tileBounds=new cn(t.bounds,this.minzoom,this.maxzoom)),this.fire(new c.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new c.k("data",{dataType:"source",sourceDataType:"content"})))}catch(t){this._tileJSONRequest=null,this.fire(new c.j(t))}})}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.abort(),t(),this.load()}setTiles(t){return this.setSourceProperty(()=>{this._options.tiles=t}),this}setUrl(t){return this.setSourceProperty(()=>{this.url=t,this._options.url=t}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return c.e({},this._options)}loadTile(t){return c._(this,void 0,void 0,function*(){const n=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),o={request:this.map._requestManager.transformRequest(n,"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};o.request.collectResourceTiming=this._collectResourceTiming;let a="RT";if(t.actor&&t.state!=="expired"){if(t.state==="loading")return new Promise((h,g)=>{t.reloadPromise={resolve:h,reject:g}})}else t.actor=this.dispatcher.getActor(),a="LT";t.abortController=new AbortController;try{const h=yield t.actor.sendAsync({type:a,data:o},t.abortController);if(delete t.abortController,t.aborted)return;this._afterTileLoadWorkerResponse(t,h)}catch(h){if(delete t.abortController,t.aborted)return;if(h&&h.status!==404)throw h;this._afterTileLoadWorkerResponse(t,null)}})}_afterTileLoadWorkerResponse(t,n){if(n&&n.resourceTiming&&(t.resourceTiming=n.resourceTiming),n&&this.map._refreshExpiredTiles&&t.setExpiryData(n),t.loadVectorData(n,this.map.painter),t.reloadPromise){const o=t.reloadPromise;t.reloadPromise=null,this.loadTile(t).then(o.resolve).catch(o.reject)}}abortTile(t){return c._(this,void 0,void 0,function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.actor&&(yield t.actor.sendAsync({type:"AT",data:{uid:t.uid,type:this.type,source:this.id}}))})}unloadTile(t){return c._(this,void 0,void 0,function*(){t.unloadVectorData(),t.actor&&(yield t.actor.sendAsync({type:"RMT",data:{uid:t.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class yt extends c.E{constructor(t,n,o,a){super(),this.id=t,this.dispatcher=o,this.setEventedParent(a),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=c.e({type:"raster"},n),c.e(this,c.M(n,["url","scheme","tileSize"]))}load(){return c._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new c.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const t=yield Mn(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,t&&(c.e(this,t),t.bounds&&(this.tileBounds=new cn(t.bounds,this.minzoom,this.maxzoom)),this.fire(new c.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new c.k("data",{dataType:"source",sourceDataType:"content"})))}catch(t){this._tileJSONRequest=null,this.fire(new c.j(t))}})}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(t){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),t(),this.load()}setTiles(t){return this.setSourceProperty(()=>{this._options.tiles=t}),this}setUrl(t){return this.setSourceProperty(()=>{this.url=t,this._options.url=t}),this}serialize(){return c.e({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t){return c._(this,void 0,void 0,function*(){const n=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.abortController=new AbortController;try{const o=yield He.getImage(this.map._requestManager.transformRequest(n,"Tile"),t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(o&&o.data){this.map._refreshExpiredTiles&&o.cacheControl&&o.expires&&t.setExpiryData({cacheControl:o.cacheControl,expires:o.expires});const a=this.map.painter.context,h=a.gl,g=o.data;t.texture=this.map.painter.getTileTexture(g.width),t.texture?t.texture.update(g,{useMipmap:!0}):(t.texture=new St(a,g,h.RGBA,{useMipmap:!0}),t.texture.bind(h.LINEAR,h.CLAMP_TO_EDGE,h.LINEAR_MIPMAP_NEAREST)),t.state="loaded"}}catch(o){if(delete t.abortController,t.aborted)t.state="unloaded";else if(o)throw t.state="errored",o}})}abortTile(t){return c._(this,void 0,void 0,function*(){t.abortController&&(t.abortController.abort(),delete t.abortController)})}unloadTile(t){return c._(this,void 0,void 0,function*(){t.texture&&this.map.painter.saveTileTexture(t.texture)})}hasTransition(){return!1}}class jt extends yt{constructor(t,n,o,a){super(t,n,o,a),this.type="raster-dem",this.maxzoom=22,this._options=c.e({type:"raster-dem"},n),this.encoding=n.encoding||"mapbox",this.redFactor=n.redFactor,this.greenFactor=n.greenFactor,this.blueFactor=n.blueFactor,this.baseShift=n.baseShift}loadTile(t){return c._(this,void 0,void 0,function*(){const n=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),o=this.map._requestManager.transformRequest(n,"Tile");t.neighboringTiles=this._getNeighboringTiles(t.tileID),t.abortController=new AbortController;try{const a=yield He.getImage(o,t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(a&&a.data){const h=a.data;this.map._refreshExpiredTiles&&a.cacheControl&&a.expires&&t.setExpiryData({cacheControl:a.cacheControl,expires:a.expires});const g=c.b(h)&&c.U()?h:yield this.readImageNow(h),y={type:this.type,uid:t.uid,source:this.id,rawImageData:g,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!t.actor||t.state==="expired"){t.actor=this.dispatcher.getActor();const b=yield t.actor.sendAsync({type:"LDT",data:y});t.dem=b,t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded"}}}catch(a){if(delete t.abortController,t.aborted)t.state="unloaded";else if(a)throw t.state="errored",a}})}readImageNow(t){return c._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&c.V()){const n=t.width+2,o=t.height+2;try{return new c.R({width:n,height:o},yield c.W(t,-1,-1,n,o))}catch{}}return le.getImageData(t,1)})}_getNeighboringTiles(t){const n=t.canonical,o=Math.pow(2,n.z),a=(n.x-1+o)%o,h=n.x===0?t.wrap-1:t.wrap,g=(n.x+1+o)%o,y=n.x+1===o?t.wrap+1:t.wrap,b={};return b[new c.S(t.overscaledZ,h,n.z,a,n.y).key]={backfilled:!1},b[new c.S(t.overscaledZ,y,n.z,g,n.y).key]={backfilled:!1},n.y>0&&(b[new c.S(t.overscaledZ,h,n.z,a,n.y-1).key]={backfilled:!1},b[new c.S(t.overscaledZ,t.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},b[new c.S(t.overscaledZ,y,n.z,g,n.y-1).key]={backfilled:!1}),n.y+1<o&&(b[new c.S(t.overscaledZ,h,n.z,a,n.y+1).key]={backfilled:!1},b[new c.S(t.overscaledZ,t.wrap,n.z,n.x,n.y+1).key]={backfilled:!1},b[new c.S(t.overscaledZ,y,n.z,g,n.y+1).key]={backfilled:!1}),b}unloadTile(t){return c._(this,void 0,void 0,function*(){t.demTexture&&this.map.painter.saveTileTexture(t.demTexture),t.fbo&&(t.fbo.destroy(),delete t.fbo),t.dem&&delete t.dem,delete t.neighboringTiles,t.state="unloaded",t.actor&&(yield t.actor.sendAsync({type:"RDT",data:{type:this.type,uid:t.uid,source:this.id}}))})}}class os extends c.E{constructor(t,n,o,a){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=o.getActor(),this.setEventedParent(a),this._data=n.data,this._options=c.e({},n),this._collectResourceTiming=n.collectResourceTiming,n.maxzoom!==void 0&&(this.maxzoom=n.maxzoom),n.type&&(this.type=n.type),n.attribution&&(this.attribution=n.attribution),this.promoteId=n.promoteId;const h=c.X/this.tileSize;this.workerOptions=c.e({source:this.id,cluster:n.cluster||!1,geojsonVtOptions:{buffer:(n.buffer!==void 0?n.buffer:128)*h,tolerance:(n.tolerance!==void 0?n.tolerance:.375)*h,extent:c.X,maxZoom:this.maxzoom,lineMetrics:n.lineMetrics||!1,generateId:n.generateId||!1},superclusterOptions:{maxZoom:n.clusterMaxZoom!==void 0?n.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,n.clusterMinPoints||2),extent:c.X,radius:(n.clusterRadius||50)*h,log:!1,generateId:n.generateId||!1},clusterProperties:n.clusterProperties,filter:n.filter},n.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}load(){return c._(this,void 0,void 0,function*(){yield this._updateWorkerData()})}onAdd(t){this.map=t,this.load()}setData(t){return this._data=t,this._updateWorkerData(),this}updateData(t){return this._updateWorkerData(t),this}getData(){return c._(this,void 0,void 0,function*(){const t=c.e({type:this.type},this.workerOptions);return this.actor.sendAsync({type:"GD",data:t})})}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){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:t,source:this.id}})}getClusterChildren(t){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:t,source:this.id}})}getClusterLeaves(t,n,o){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:t,limit:n,offset:o}})}_updateWorkerData(t){return c._(this,void 0,void 0,function*(){const n=c.e({type:this.type},this.workerOptions);t?n.dataDiff=t:typeof this._data=="string"?(n.request=this.map._requestManager.transformRequest(le.resolveURL(this._data),"Source"),n.request.collectResourceTiming=this._collectResourceTiming):n.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new c.k("dataloading",{dataType:"source"}));try{const o=yield this.actor.sendAsync({type:"LD",data:n});if(this._pendingLoads--,this._removed||o.abandoned)return void this.fire(new c.k("dataabort",{dataType:"source"}));let a=null;o.resourceTiming&&o.resourceTiming[this.id]&&(a=o.resourceTiming[this.id].slice(0));const h={dataType:"source"};this._collectResourceTiming&&a&&a.length>0&&c.e(h,{resourceTiming:a}),this.fire(new c.k("data",Object.assign(Object.assign({},h),{sourceDataType:"metadata"}))),this.fire(new c.k("data",Object.assign(Object.assign({},h),{sourceDataType:"content"})))}catch(o){if(this._pendingLoads--,this._removed)return void this.fire(new c.k("dataabort",{dataType:"source"}));this.fire(new c.j(o))}})}loaded(){return this._pendingLoads===0}loadTile(t){return c._(this,void 0,void 0,function*(){const n=t.actor?"RT":"LT";t.actor=this.actor;const o={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};t.abortController=new AbortController;const a=yield this.actor.sendAsync({type:n,data:o},t.abortController);delete t.abortController,t.unloadVectorData(),t.aborted||t.loadVectorData(a,this.map.painter,n==="RT")})}abortTile(t){return c._(this,void 0,void 0,function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.aborted=!0})}unloadTile(t){return c._(this,void 0,void 0,function*(){t.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:t.uid,type:this.type,source:this.id}})})}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return c.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var qr=c.Y([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Ar extends c.E{constructor(t,n,o,a){super(),this.id=t,this.dispatcher=o,this.coordinates=n.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(a),this.options=n}load(t){return c._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new c.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const n=yield He.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,n&&n.data&&(this.image=n.data,t&&(this.coordinates=t),this._finishLoading())}catch(n){this._request=null,this._loaded=!0,this.fire(new c.j(n))}})}loaded(){return this._loaded}updateImage(t){return t.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=t.url,this.load(t.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new c.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(t){this.coordinates=t;const n=t.map(c.Z.fromLngLat);this.tileID=function(a){let h=1/0,g=1/0,y=-1/0,b=-1/0;for(const R of a)h=Math.min(h,R.x),g=Math.min(g,R.y),y=Math.max(y,R.x),b=Math.max(b,R.y);const w=Math.max(y-h,b-g),C=Math.max(0,Math.floor(-Math.log(w)/Math.LN2)),E=Math.pow(2,C);return new c.a1(C,Math.floor((h+y)/2*E),Math.floor((g+b)/2*E))}(n),this.minzoom=this.maxzoom=this.tileID.z;const o=n.map(a=>this.tileID.getTilePoint(a)._round());return this._boundsArray=new c.$,this._boundsArray.emplaceBack(o[0].x,o[0].y,0,0),this._boundsArray.emplaceBack(o[1].x,o[1].y,c.X,0),this._boundsArray.emplaceBack(o[3].x,o[3].y,0,c.X),this._boundsArray.emplaceBack(o[2].x,o[2].y,c.X,c.X),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new c.k("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,qr.members)),this.boundsSegments||(this.boundsSegments=c.a0.simpleSegment(0,0,4,2)),this.texture||(this.texture=new St(t,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let o=!1;for(const a in this.tiles){const h=this.tiles[a];h.state!=="loaded"&&(h.state="loaded",h.texture=this.texture,o=!0)}o&&this.fire(new c.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(t){return c._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={}):t.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class zn extends Ar{constructor(t,n,o,a){super(t,n,o,a),this.roundZoom=!0,this.type="video",this.options=n}load(){return c._(this,void 0,void 0,function*(){this._loaded=!1;const t=this.options;this.urls=[];for(const n of t.urls)this.urls.push(this.map._requestManager.transformRequest(n,"Source").url);try{const n=yield c.a3(this.urls);if(this._loaded=!0,!n)return;this.video=n,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(n){this.fire(new c.j(n))}})}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 c.j(new c.a2(`sources.${this.id}`,null,`Playback for this video can be set only between the ${n.start(0)} and ${n.end(0)}-second mark.`))):this.video.currentTime=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,qr.members)),this.boundsSegments||(this.boundsSegments=c.a0.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),n.texSubImage2D(n.TEXTURE_2D,0,0,0,n.RGBA,n.UNSIGNED_BYTE,this.video)):(this.texture=new St(t,this.video,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let o=!1;for(const a in this.tiles){const h=this.tiles[a];h.state!=="loaded"&&(h.state="loaded",h.texture=this.texture,o=!0)}o&&this.fire(new c.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class Xi extends Ar{constructor(t,n,o,a){super(t,n,o,a),n.coordinates?Array.isArray(n.coordinates)&&n.coordinates.length===4&&!n.coordinates.some(h=>!Array.isArray(h)||h.length!==2||h.some(g=>typeof g!="number"))||this.fire(new c.j(new c.a2(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new c.j(new c.a2(`sources.${t}`,null,'missing required property "coordinates"'))),n.animate&&typeof n.animate!="boolean"&&this.fire(new c.j(new c.a2(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),n.canvas?typeof n.canvas=="string"||n.canvas instanceof HTMLCanvasElement||this.fire(new c.j(new c.a2(`sources.${t}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new c.j(new c.a2(`sources.${t}`,null,'missing required property "canvas"'))),this.options=n,this.animate=n.animate===void 0||n.animate}load(){return c._(this,void 0,void 0,function*(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new c.j(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())})}getCanvas(){return this.canvas}onAdd(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let t=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const n=this.map.painter.context,o=n.gl;this.boundsBuffer||(this.boundsBuffer=n.createVertexBuffer(this._boundsArray,qr.members)),this.boundsSegments||(this.boundsSegments=c.a0.simpleSegment(0,0,4,2)),this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new St(n,this.canvas,o.RGBA,{premultiply:!0});let a=!1;for(const h in this.tiles){const g=this.tiles[h];g.state!=="loaded"&&(g.state="loaded",g.texture=this.texture,a=!0)}a&&this.fire(new c.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}}const as={},ls=u=>{switch(u){case"geojson":return os;case"image":return Ar;case"raster":return yt;case"raster-dem":return jt;case"vector":return ss;case"video":return zn;case"canvas":return Xi}return as[u]},ke="RTLPluginLoaded";class fr extends c.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=ns()}_syncState(t){return this.status=t,this.dispatcher.broadcast("SRPS",{pluginStatus:t,pluginURL:this.url}).catch(n=>{throw this.status="error",n})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(t){return c._(this,arguments,void 0,function*(n,o=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=le.resolveURL(n),!this.url)throw new Error(`requested url ${n} is invalid`);if(this.status==="unavailable"){if(!o)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return c._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new c.k(ke))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let Si=null;function mr(){return Si||(Si=new fr),Si}class Zr{constructor(t,n){this.timeAdded=0,this.fadeEndTime=0,this.tileID=t,this.uid=c.a4(),this.uses=0,this.tileSize=n,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(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,o){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(a,h){const g={};if(!h)return g;for(const y of a){const b=y.layerIds.map(w=>h.getLayer(w)).filter(Boolean);if(b.length!==0){y.layers=b,y.stateDependentLayerIds&&(y.stateDependentLayers=y.stateDependentLayerIds.map(w=>b.filter(C=>C.id===w)[0]));for(const w of b)g[w.id]=y}}return g}(t.buckets,n.style),this.hasSymbolBuckets=!1;for(const a in this.buckets){const h=this.buckets[a];if(h instanceof c.a6){if(this.hasSymbolBuckets=!0,!o)break;h.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const a in this.buckets){const h=this.buckets[a];if(h instanceof c.a6&&h.hasRTLText){this.hasRTLText=!0,mr().lazyLoad();break}}this.queryPadding=0;for(const a in this.buckets){const h=this.buckets[a];this.queryPadding=Math.max(this.queryPadding,n.style.getLayer(a).queryRadius(h))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage)}else this.collisionBoxArray=new c.a5}unloadVectorData(){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(t){return this.buckets[t.id]}upload(t){for(const o in this.buckets){const a=this.buckets[o];a.uploadPending()&&a.upload(t)}const n=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new St(t,this.imageAtlas.image,n.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new St(t,this.glyphAtlasImage,n.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,n,o,a,h,g,y,b,w,C){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:a,cameraQueryGeometry:h,scale:g,tileSize:this.tileSize,pixelPosMatrix:C,transform:b,params:y,queryPadding:this.queryPadding*w},t,n,o):{}}querySourceFeatures(t,n){const o=this.latestFeatureIndex;if(!o||!o.rawTileData)return;const a=o.loadVTLayers(),h=n&&n.sourceLayer?n.sourceLayer:"",g=a._geojsonTileLayer||a[h];if(!g)return;const y=c.a7(n&&n.filter),{z:b,x:w,y:C}=this.tileID.canonical,E={z:b,x:w,y:C};for(let R=0;R<g.length;R++){const F=g.feature(R);if(y.needGeometry){const U=c.a8(F,!0);if(!y.filter(new c.a9(this.tileID.overscaledZ),U,this.tileID.canonical))continue}else if(!y.filter(new c.a9(this.tileID.overscaledZ),F))continue;const $=o.getId(F,h),H=new c.aa(F,b,w,C,$);H.tile=E,t.push(H)}}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 o=c.ab(t.cacheControl);o["max-age"]&&(this.expirationTime=Date.now()+1e3*o["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){const o=Date.now();let a=!1;if(this.expirationTime>o)a=!1;else if(n)if(this.expirationTime<n)a=!0;else{const h=this.expirationTime-n;h?this.expirationTime=o+Math.max(h,3e4):a=!0}else a=!0;a?(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 o=this.latestFeatureIndex.loadVTLayers();for(const a in this.buckets){if(!n.style.hasLayer(a))continue;const h=this.buckets[a],g=h.layers[0].sourceLayer||"_geojsonTileLayer",y=o[g],b=t[g];if(!y||!b||Object.keys(b).length===0)continue;h.update(b,y,this.imageAtlas&&this.imageAtlas.patternPositions||{});const w=n&&n.style&&n.style.getLayer(a);w&&(this.queryPadding=Math.max(this.queryPadding,w.queryRadius(h)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<le.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(t){this.symbolFadeHoldUntil=le.now()+t}setDependencies(t,n){const o={};for(const a of n)o[a]=!0;this.dependencies[t]=o}hasDependency(t,n){for(const o of t){const a=this.dependencies[o];if(a){for(const h of n)if(a[h])return!0}}return!1}}class Ee{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,o){const a=t.wrapped().key;this.data[a]===void 0&&(this.data[a]=[]);const h={value:n,timeout:void 0};if(o!==void 0&&(h.timeout=setTimeout(()=>{this.remove(t,h)},o)),this.data[a].push(h),this.order.push(a),this.order.length>this.max){const g=this._getAndRemoveByKey(this.order[0]);g&&this.onRemove(g)}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 o=t.wrapped().key,a=n===void 0?0:this.data[o].indexOf(n),h=this.data[o][a];return this.data[o].splice(a,1),h.timeout&&clearTimeout(h.timeout),this.data[o].length===0&&delete this.data[o],this.onRemove(h.value),this.order.splice(this.order.indexOf(o),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 o in this.data)for(const a of this.data[o])t(a.value)||n.push(a);for(const o of n)this.remove(o.value.tileID,o)}}class at{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,n,o){const a=String(n);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][a]=this.stateChanges[t][a]||{},c.e(this.stateChanges[t][a],o),this.deletedStates[t]===null){this.deletedStates[t]={};for(const h in this.state[t])h!==a&&(this.deletedStates[t][h]=null)}else if(this.deletedStates[t]&&this.deletedStates[t][a]===null){this.deletedStates[t][a]={};for(const h in this.state[t][a])o[h]||(this.deletedStates[t][a][h]=null)}else for(const h in o)this.deletedStates[t]&&this.deletedStates[t][a]&&this.deletedStates[t][a][h]===null&&delete this.deletedStates[t][a][h]}removeFeatureState(t,n,o){if(this.deletedStates[t]===null)return;const a=String(n);if(this.deletedStates[t]=this.deletedStates[t]||{},o&&n!==void 0)this.deletedStates[t][a]!==null&&(this.deletedStates[t][a]=this.deletedStates[t][a]||{},this.deletedStates[t][a][o]=null);else if(n!==void 0)if(this.stateChanges[t]&&this.stateChanges[t][a])for(o in this.deletedStates[t][a]={},this.stateChanges[t][a])this.deletedStates[t][a][o]=null;else this.deletedStates[t][a]=null;else this.deletedStates[t]=null}getState(t,n){const o=String(n),a=c.e({},(this.state[t]||{})[o],(this.stateChanges[t]||{})[o]);if(this.deletedStates[t]===null)return{};if(this.deletedStates[t]){const h=this.deletedStates[t][n];if(h===null)return{};for(const g in h)delete a[g]}return a}initializeTileState(t,n){t.setFeatureState(this.state,n)}coalesceChanges(t,n){const o={};for(const a in this.stateChanges){this.state[a]=this.state[a]||{};const h={};for(const g in this.stateChanges[a])this.state[a][g]||(this.state[a][g]={}),c.e(this.state[a][g],this.stateChanges[a][g]),h[g]=this.state[a][g];o[a]=h}for(const a in this.deletedStates){this.state[a]=this.state[a]||{};const h={};if(this.deletedStates[a]===null)for(const g in this.state[a])h[g]={},this.state[a][g]={};else for(const g in this.deletedStates[a]){if(this.deletedStates[a][g]===null)this.state[a][g]={};else for(const y of Object.keys(this.deletedStates[a][g]))delete this.state[a][g][y];h[g]=this.state[a][g]}o[a]=o[a]||{},c.e(o[a],h)}if(this.stateChanges={},this.deletedStates={},Object.keys(o).length!==0)for(const a in t)t[a].setFeatureState(o,n)}}class Ye extends c.E{constructor(t,n,o){super(),this.id=t,this.dispatcher=o,this.on("data",a=>this._dataHandler(a)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((a,h,g,y)=>{const b=new(ls(h.type))(a,h,g,y);if(b.id!==a)throw new Error(`Expected Source id to be ${a} instead of ${b.id}`);return b})(t,n,o,this),this._tiles={},this._cache=new Ee(0,a=>this._unloadTile(a)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new at,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,o){return c._(this,void 0,void 0,function*(){try{yield this._source.loadTile(t),this._tileLoaded(t,n,o)}catch(a){t.state="errored",a.status!==404?this._source.fire(new c.j(a,{tile:t})):this.update(this.transform,this.terrain)}})}_unloadTile(t){this._source.unloadTile&&this._source.unloadTile(t)}_abortTile(t){this._source.abortTile&&this._source.abortTile(t),this._source.fire(new c.k("dataabort",{tile:t,coord:t.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const n in this._tiles){const o=this._tiles[n];o.upload(t),o.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(t=>t.tileID).sort(Pi).map(t=>t.key)}getRenderableIds(t){const n=[];for(const o in this._tiles)this._isIdRenderable(o,t)&&n.push(this._tiles[o]);return t?n.sort((o,a)=>{const h=o.tileID,g=a.tileID,y=new c.P(h.canonical.x,h.canonical.y)._rotate(this.transform.angle),b=new c.P(g.canonical.x,g.canonical.y)._rotate(this.transform.angle);return h.overscaledZ-g.overscaledZ||b.y-y.y||b.x-y.x}).map(o=>o.tileID.key):n.map(o=>o.tileID).sort(Pi).map(o=>o.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){return c._(this,void 0,void 0,function*(){const o=this._tiles[t];o&&(o.state!=="loading"&&(o.state=n),yield this._loadTile(o,t,n))})}_tileLoaded(t,n,o){t.timeAdded=le.now(),o==="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 c.k("data",{dataType:"source",tile:t,coord:t.tileID}))}_backfillDEM(t){const n=this.getRenderableIds();for(let a=0;a<n.length;a++){const h=n[a];if(t.neighboringTiles&&t.neighboringTiles[h]){const g=this.getTileByID(h);o(t,g),o(g,t)}}function o(a,h){a.needsHillshadePrepare=!0,a.needsTerrainPrepare=!0;let g=h.tileID.canonical.x-a.tileID.canonical.x;const y=h.tileID.canonical.y-a.tileID.canonical.y,b=Math.pow(2,a.tileID.canonical.z),w=h.tileID.key;g===0&&y===0||Math.abs(y)>1||(Math.abs(g)>1&&(Math.abs(g+b)===1?g+=b:Math.abs(g-b)===1&&(g-=b)),h.dem&&a.dem&&(a.dem.backfillBorder(h.dem,g,y),a.neighboringTiles&&a.neighboringTiles[w]&&(a.neighboringTiles[w].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,n,o,a){for(const h in this._tiles){let g=this._tiles[h];if(a[h]||!g.hasData()||g.tileID.overscaledZ<=n||g.tileID.overscaledZ>o)continue;let y=g.tileID;for(;g&&g.tileID.overscaledZ>n+1;){const w=g.tileID.scaledTo(g.tileID.overscaledZ-1);g=this._tiles[w.key],g&&g.hasData()&&(y=w)}let b=y;for(;b.overscaledZ>n;)if(b=b.scaledTo(b.overscaledZ-1),t[b.key]){a[y.key]=y;break}}}findLoadedParent(t,n){if(t.key in this._loadedParentTiles){const o=this._loadedParentTiles[t.key];return o&&o.tileID.overscaledZ>=n?o:null}for(let o=t.overscaledZ-1;o>=n;o--){const a=t.scaledTo(o),h=this._getLoadedTile(a);if(h)return h}}findLoadedSibling(t){return this._getLoadedTile(t)}_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,o=Math.ceil(t.height/this._source.tileSize)+1,a=Math.floor(n*o*(this._maxTileCacheZoomLevels===null?c.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),h=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,a):a;this._cache.setMaxSize(h)}handleWrapJump(t){const n=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);if(this._prevLng=t,n){const o={};for(const a in this._tiles){const h=this._tiles[a];h.tileID=h.tileID.unwrapTo(h.tileID.wrap+n),o[h.tileID.key]=h}this._tiles=o;for(const a in this._timers)clearTimeout(this._timers[a]),delete this._timers[a];for(const a in this._tiles)this._setTileReloadTimer(a,this._tiles[a])}}_updateCoveredAndRetainedTiles(t,n,o,a,h,g){const y={},b={},w=Object.keys(t),C=le.now();for(const E of w){const R=t[E],F=this._tiles[E];if(!F||F.fadeEndTime!==0&&F.fadeEndTime<=C)continue;const $=this.findLoadedParent(R,n),H=this.findLoadedSibling(R),U=$||H||null;U&&(this._addTile(U.tileID),y[U.tileID.key]=U.tileID),b[E]=R}this._retainLoadedChildren(b,a,o,t);for(const E in y)t[E]||(this._coveredTiles[E]=!0,t[E]=y[E]);if(g){const E={},R={};for(const F of h)this._tiles[F.key].hasData()?E[F.key]=F:R[F.key]=F;for(const F in R){const $=R[F].children(this._source.maxzoom);this._tiles[$[0].key]&&this._tiles[$[1].key]&&this._tiles[$[2].key]&&this._tiles[$[3].key]&&(E[$[0].key]=t[$[0].key]=$[0],E[$[1].key]=t[$[1].key]=$[1],E[$[2].key]=t[$[2].key]=$[2],E[$[3].key]=t[$[3].key]=$[3],delete R[F])}for(const F in R){const $=R[F],H=this.findLoadedParent($,this._source.minzoom),U=this.findLoadedSibling($),W=H||U||null;if(W){E[W.tileID.key]=t[W.tileID.key]=W.tileID;for(const Y in E)E[Y].isChildOf(W.tileID)&&delete E[Y]}}for(const F in this._tiles)E[F]||(this._coveredTiles[F]=!0)}}update(t,n){if(!this._sourceLoaded||this._paused)return;let o;this.transform=t,this.terrain=n,this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?o=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(C=>new c.S(C.canonical.z,C.wrap,C.canonical.z,C.canonical.x,C.canonical.y)):(o=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&&(o=o.filter(C=>this._source.hasTile(C)))):o=[];const a=t.coveringZoomLevel(this._source),h=Math.max(a-Ye.maxOverzooming,this._source.minzoom),g=Math.max(a+Ye.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const C={};for(const E of o)if(E.canonical.z>this._source.minzoom){const R=E.scaledTo(E.canonical.z-1);C[R.key]=R;const F=E.scaledTo(Math.max(this._source.minzoom,Math.min(E.canonical.z,5)));C[F.key]=F}o=o.concat(Object.values(C))}const y=o.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,y&&this.fire(new c.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const b=this._updateRetainedTiles(o,a);tr(this._source.type)&&this._updateCoveredAndRetainedTiles(b,h,g,a,o,n);for(const C in b)this._tiles[C].clearFadeHold();const w=c.ac(this._tiles,b);for(const C of w){const E=this._tiles[C];E.hasSymbolBuckets&&!E.holdingForFade()?E.setHoldDuration(this.map._fadeDuration):E.hasSymbolBuckets&&!E.symbolFadeFinished()||this._removeTile(C)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)}_updateRetainedTiles(t,n){var o;const a={},h={},g=Math.max(n-Ye.maxOverzooming,this._source.minzoom),y=Math.max(n+Ye.maxUnderzooming,this._source.minzoom),b={};for(const w of t){const C=this._addTile(w);a[w.key]=w,C.hasData()||n<this._source.maxzoom&&(b[w.key]=w)}this._retainLoadedChildren(b,n,y,a);for(const w of t){let C=this._tiles[w.key];if(C.hasData())continue;if(n+1>this._source.maxzoom){const R=w.children(this._source.maxzoom)[0],F=this.getTile(R);if(F&&F.hasData()){a[R.key]=R;continue}}else{const R=w.children(this._source.maxzoom);if(a[R[0].key]&&a[R[1].key]&&a[R[2].key]&&a[R[3].key])continue}let E=C.wasRequested();for(let R=w.overscaledZ-1;R>=g;--R){const F=w.scaledTo(R);if(h[F.key])break;if(h[F.key]=!0,C=this.getTile(F),!C&&E&&(C=this._addTile(F)),C){const $=C.hasData();if(($||!(!((o=this.map)===null||o===void 0)&&o.cancelPendingTileRequestsWhileZooming)||E)&&(a[F.key]=F),E=C.wasRequested(),$)break}}}return a}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const n=[];let o,a=this._tiles[t].tileID;for(;a.overscaledZ>0;){if(a.key in this._loadedParentTiles){o=this._loadedParentTiles[a.key];break}n.push(a.key);const h=a.scaledTo(a.overscaledZ-1);if(o=this._getLoadedTile(h),o)break;a=h}for(const h of n)this._loadedParentTiles[h]=o}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(const t in this._tiles){const n=this._tiles[t].tileID,o=this._getLoadedTile(n);this._loadedSiblingTiles[n.key]=o}}_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 o=n;return n||(n=new Zr(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(n,t.key,n.state)),n.uses++,this._tiles[t.key]=n,o||this._source.fire(new c.k("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 o=n.getExpiryTimeout();o&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},o))}_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))))}_dataHandler(t){const n=t.sourceDataType;t.dataType==="source"&&n==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&t.dataType==="source"&&n==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(t);this._cache.reset()}tilesIn(t,n,o){const a=[],h=this.transform;if(!h)return a;const g=o?h.getCameraQueryGeometry(t):t,y=t.map($=>h.pointCoordinate($,this.terrain)),b=g.map($=>h.pointCoordinate($,this.terrain)),w=this.getIds();let C=1/0,E=1/0,R=-1/0,F=-1/0;for(const $ of b)C=Math.min(C,$.x),E=Math.min(E,$.y),R=Math.max(R,$.x),F=Math.max(F,$.y);for(let $=0;$<w.length;$++){const H=this._tiles[w[$]];if(H.holdingForFade())continue;const U=H.tileID,W=Math.pow(2,h.zoom-H.tileID.overscaledZ),Y=n*H.queryPadding*c.X/H.tileSize/W,j=[U.getTilePoint(new c.Z(C,E)),U.getTilePoint(new c.Z(R,F))];if(j[0].x-Y<c.X&&j[0].y-Y<c.X&&j[1].x+Y>=0&&j[1].y+Y>=0){const te=y.map(ce=>U.getTilePoint(ce)),se=b.map(ce=>U.getTilePoint(ce));a.push({tile:H,tileID:U,queryGeometry:te,cameraQueryGeometry:se,scale:W})}}return a}getVisibleCoordinates(t){const n=this.getRenderableIds(t).map(o=>this._tiles[o].tileID);for(const o of n)o.posMatrix=this.transform.calculatePosMatrix(o.toUnwrapped());return n}hasTransition(){if(this._source.hasTransition())return!0;if(tr(this._source.type)){const t=le.now();for(const n in this._tiles)if(this._tiles[n].fadeEndTime>=t)return!0}return!1}setFeatureState(t,n,o){this._state.updateState(t=t||"_geojsonTileLayer",n,o)}removeFeatureState(t,n,o){this._state.removeFeatureState(t=t||"_geojsonTileLayer",n,o)}getFeatureState(t,n){return this._state.getState(t=t||"_geojsonTileLayer",n)}setDependencies(t,n,o){const a=this._tiles[t];a&&a.setDependencies(n,o)}reloadTilesForDependencies(t,n){for(const o in this._tiles)this._tiles[o].hasDependency(t,n)&&this._reloadTile(o,"reloading");this._cache.filter(o=>!o.hasDependency(t,n))}}function Pi(u,t){const n=Math.abs(2*u.wrap)-+(u.wrap<0),o=Math.abs(2*t.wrap)-+(t.wrap<0);return u.overscaledZ-t.overscaledZ||o-n||t.canonical.y-u.canonical.y||t.canonical.x-u.canonical.x}function tr(u){return u==="raster"||u==="image"||u==="video"}Ye.maxOverzooming=10,Ye.maxUnderzooming=3;class it{constructor(t,n){this.reset(t,n)}reset(t,n){this.points=t||[],this._distances=[0];for(let o=1;o<this.points.length;o++)this._distances[o]=this._distances[o-1]+this.points[o].dist(this.points[o-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=c.ad(t,0,1);let n=1,o=this._distances[n];const a=t*this.paddedLength+this.padding;for(;o<a&&n<this._distances.length;)o=this._distances[++n];const h=n-1,g=this._distances[h],y=o-g,b=y>0?(a-g)/y:0;return this.points[h].mult(1-b).add(this.points[n].mult(b))}}function gr(u,t){let n=!0;return u==="always"||u!=="never"&&t!=="never"||(n=!1),n}class Mr{constructor(t,n,o){const a=this.boxCells=[],h=this.circleCells=[];this.xCellCount=Math.ceil(t/o),this.yCellCount=Math.ceil(n/o);for(let g=0;g<this.xCellCount*this.yCellCount;g++)a.push([]),h.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,o,a,h){this._forEachCell(n,o,a,h,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(n),this.bboxes.push(o),this.bboxes.push(a),this.bboxes.push(h)}insertCircle(t,n,o,a){this._forEachCell(n-a,o-a,n+a,o+a,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(n),this.circles.push(o),this.circles.push(a)}_insertBoxCell(t,n,o,a,h,g){this.boxCells[h].push(g)}_insertCircleCell(t,n,o,a,h,g){this.circleCells[h].push(g)}_query(t,n,o,a,h,g,y){if(o<0||t>this.width||a<0||n>this.height)return[];const b=[];if(t<=0&&n<=0&&this.width<=o&&this.height<=a){if(h)return[{key:null,x1:t,y1:n,x2:o,y2:a}];for(let w=0;w<this.boxKeys.length;w++)b.push({key:this.boxKeys[w],x1:this.bboxes[4*w],y1:this.bboxes[4*w+1],x2:this.bboxes[4*w+2],y2:this.bboxes[4*w+3]});for(let w=0;w<this.circleKeys.length;w++){const C=this.circles[3*w],E=this.circles[3*w+1],R=this.circles[3*w+2];b.push({key:this.circleKeys[w],x1:C-R,y1:E-R,x2:C+R,y2:E+R})}}else this._forEachCell(t,n,o,a,this._queryCell,b,{hitTest:h,overlapMode:g,seenUids:{box:{},circle:{}}},y);return b}query(t,n,o,a){return this._query(t,n,o,a,!1,null)}hitTest(t,n,o,a,h,g){return this._query(t,n,o,a,!0,h,g).length>0}hitTestCircle(t,n,o,a,h){const g=t-o,y=t+o,b=n-o,w=n+o;if(y<0||g>this.width||w<0||b>this.height)return!1;const C=[];return this._forEachCell(g,b,y,w,this._queryCellCircle,C,{hitTest:!0,overlapMode:a,circle:{x:t,y:n,radius:o},seenUids:{box:{},circle:{}}},h),C.length>0}_queryCell(t,n,o,a,h,g,y,b){const{seenUids:w,hitTest:C,overlapMode:E}=y,R=this.boxCells[h];if(R!==null){const $=this.bboxes;for(const H of R)if(!w.box[H]){w.box[H]=!0;const U=4*H,W=this.boxKeys[H];if(t<=$[U+2]&&n<=$[U+3]&&o>=$[U+0]&&a>=$[U+1]&&(!b||b(W))&&(!C||!gr(E,W.overlapMode))&&(g.push({key:W,x1:$[U],y1:$[U+1],x2:$[U+2],y2:$[U+3]}),C))return!0}}const F=this.circleCells[h];if(F!==null){const $=this.circles;for(const H of F)if(!w.circle[H]){w.circle[H]=!0;const U=3*H,W=this.circleKeys[H];if(this._circleAndRectCollide($[U],$[U+1],$[U+2],t,n,o,a)&&(!b||b(W))&&(!C||!gr(E,W.overlapMode))){const Y=$[U],j=$[U+1],te=$[U+2];if(g.push({key:W,x1:Y-te,y1:j-te,x2:Y+te,y2:j+te}),C)return!0}}}return!1}_queryCellCircle(t,n,o,a,h,g,y,b){const{circle:w,seenUids:C,overlapMode:E}=y,R=this.boxCells[h];if(R!==null){const $=this.bboxes;for(const H of R)if(!C.box[H]){C.box[H]=!0;const U=4*H,W=this.boxKeys[H];if(this._circleAndRectCollide(w.x,w.y,w.radius,$[U+0],$[U+1],$[U+2],$[U+3])&&(!b||b(W))&&!gr(E,W.overlapMode))return g.push(!0),!0}}const F=this.circleCells[h];if(F!==null){const $=this.circles;for(const H of F)if(!C.circle[H]){C.circle[H]=!0;const U=3*H,W=this.circleKeys[H];if(this._circlesCollide($[U],$[U+1],$[U+2],w.x,w.y,w.radius)&&(!b||b(W))&&!gr(E,W.overlapMode))return g.push(!0),!0}}}_forEachCell(t,n,o,a,h,g,y,b){const w=this._convertToXCellCoord(t),C=this._convertToYCellCoord(n),E=this._convertToXCellCoord(o),R=this._convertToYCellCoord(a);for(let F=w;F<=E;F++)for(let $=C;$<=R;$++)if(h.call(this,t,n,o,a,this.xCellCount*$+F,g,y,b))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,o,a,h,g){const y=a-t,b=h-n,w=o+g;return w*w>y*y+b*b}_circleAndRectCollide(t,n,o,a,h,g,y){const b=(g-a)/2,w=Math.abs(t-(a+b));if(w>b+o)return!1;const C=(y-h)/2,E=Math.abs(n-(h+C));if(E>C+o)return!1;if(w<=b||E<=C)return!0;const R=w-b,F=E-C;return R*R+F*F<=o*o}}function Gr(u,t,n,o,a){const h=c.H();return t?(c.K(h,h,[1/a,1/a,1]),n||c.ae(h,h,o.angle)):c.L(h,o.labelPlaneMatrix,u),h}function _r(u,t,n,o,a){if(t){const h=c.af(u);return c.K(h,h,[a,a,1]),n||c.ae(h,h,-o.angle),h}return o.glCoordMatrix}function X(u,t,n){let o;n?(o=[u.x,u.y,n(u.x,u.y),1],c.ag(o,o,t)):(o=[u.x,u.y,0,1],function(h,g,y){const b=g[0],w=g[1];h[0]=y[0]*b+y[4]*w+y[12],h[1]=y[1]*b+y[5]*w+y[13],h[3]=y[3]*b+y[7]*w+y[15]}(o,o,t));const a=o[3];return{point:new c.P(o[0]/a,o[1]/a),signedDistanceFromCamera:a,isOccluded:!1}}function z(u,t){return .5+u/t*.5}function M(u,t){return u.x>=-t[0]&&u.x<=t[0]&&u.y>=-t[1]&&u.y<=t[1]}function V(u,t,n,o,a,h,g,y,b,w,C,E,R,F,$){const H=o?u.textSizeData:u.iconSizeData,U=c.ah(H,n.transform.zoom),W=[256/n.width*2+1,256/n.height*2+1],Y=o?u.text.dynamicLayoutVertexArray:u.icon.dynamicLayoutVertexArray;Y.clear();const j=u.lineVertexArray,te=o?u.text.placedSymbolArray:u.icon.placedSymbolArray,se=n.transform.width/n.transform.height;let ce=!1;for(let ye=0;ye<te.length;ye++){const we=te.get(ye);if(we.hidden||we.writingMode===c.ai.vertical&&!ce){Xe(we.numGlyphs,Y);continue}ce=!1;const De=X(new c.P(we.anchorX,we.anchorY),t,$);if(!M(De.point,W)){Xe(we.numGlyphs,Y);continue}const Re=z(n.transform.cameraToCenterDistance,De.signedDistanceFromCamera),Se=c.aj(H,U,we),Te=g?Se/Re:Se*Re,Ne={getElevation:$,labelPlaneMatrix:a,lineVertexArray:j,pitchWithMap:g,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},projection:w,tileAnchorPoint:new c.P(we.anchorX,we.anchorY),unwrappedTileID:C,width:E,height:R,translation:F},tt=ie(Ne,we,Te,!1,y,t,h,u.glyphOffsetArray,Y,se,b);ce=tt.useVertical,(tt.notEnoughRoom||ce||tt.needsFlipping&&ie(Ne,we,Te,!0,y,t,h,u.glyphOffsetArray,Y,se,b).notEnoughRoom)&&Xe(we.numGlyphs,Y)}o?u.text.dynamicLayoutVertexBuffer.updateData(Y):u.icon.dynamicLayoutVertexBuffer.updateData(Y)}function G(u,t,n,o,a,h,g,y){const b=h.glyphStartIndex+h.numGlyphs,w=h.lineStartIndex,C=h.lineStartIndex+h.lineLength,E=t.getoffsetX(h.glyphStartIndex),R=t.getoffsetX(b-1),F=Ie(u*E,n,o,a,h.segment,w,C,y,g);if(!F)return null;const $=Ie(u*R,n,o,a,h.segment,w,C,y,g);return $?y.projectionCache.anyProjectionOccluded?null:{first:F,last:$}:null}function ee(u,t,n,o){return u===c.ai.horizontal&&Math.abs(n.y-t.y)>Math.abs(n.x-t.x)*o?{useVertical:!0}:(u===c.ai.vertical?t.y<n.y:t.x>n.x)?{needsFlipping:!0}:null}function ie(u,t,n,o,a,h,g,y,b,w,C){const E=n/24,R=t.lineOffsetX*E,F=t.lineOffsetY*E;let $;if(t.numGlyphs>1){const H=t.glyphStartIndex+t.numGlyphs,U=t.lineStartIndex,W=t.lineStartIndex+t.lineLength,Y=G(E,y,R,F,o,t,C,u);if(!Y)return{notEnoughRoom:!0};const j=X(Y.first.point,g,u.getElevation).point,te=X(Y.last.point,g,u.getElevation).point;if(a&&!o){const se=ee(t.writingMode,j,te,w);if(se)return se}$=[Y.first];for(let se=t.glyphStartIndex+1;se<H-1;se++)$.push(Ie(E*y.getoffsetX(se),R,F,o,t.segment,U,W,u,C));$.push(Y.last)}else{if(a&&!o){const U=X(u.tileAnchorPoint,h,u.getElevation).point,W=t.lineStartIndex+t.segment+1,Y=new c.P(u.lineVertexArray.getx(W),u.lineVertexArray.gety(W)),j=X(Y,h,u.getElevation),te=j.signedDistanceFromCamera>0?j.point:function(ce,ye,we,De,Re,Se){return ne(ce,ye,we,1,Re,Se)}(u.tileAnchorPoint,Y,U,0,h,u),se=ee(t.writingMode,U,te,w);if(se)return se}const H=Ie(E*y.getoffsetX(t.glyphStartIndex),R,F,o,t.segment,t.lineStartIndex,t.lineStartIndex+t.lineLength,u,C);if(!H||u.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};$=[H]}for(const H of $)c.ak(b,H.point,H.angle);return{}}function ne(u,t,n,o,a,h){const g=u.add(u.sub(t)._unit()),y=a!==void 0?X(g,a,h.getElevation).point:pe(g.x,g.y,h).point,b=n.sub(y);return n.add(b._mult(o/b.mag()))}function K(u,t,n){const o=t.projectionCache;if(o.projections[u])return o.projections[u];const a=new c.P(t.lineVertexArray.getx(u),t.lineVertexArray.gety(u)),h=pe(a.x,a.y,t);if(h.signedDistanceFromCamera>0)return o.projections[u]=h.point,o.anyProjectionOccluded=o.anyProjectionOccluded||h.isOccluded,h.point;const g=u-n.direction;return function(y,b,w,C,E){return ne(y,b,w,C,void 0,E)}(n.distanceFromAnchor===0?t.tileAnchorPoint:new c.P(t.lineVertexArray.getx(g),t.lineVertexArray.gety(g)),a,n.previousVertex,n.absOffsetX-n.distanceFromAnchor+1,t)}function pe(u,t,n){const o=u+n.translation[0],a=t+n.translation[1];let h;return!n.pitchWithMap&&n.projection.useSpecialProjectionForSymbols?(h=n.projection.projectTileCoordinates(o,a,n.unwrappedTileID,n.getElevation),h.point.x=(.5*h.point.x+.5)*n.width,h.point.y=(.5*-h.point.y+.5)*n.height):(h=X(new c.P(o,a),n.labelPlaneMatrix,n.getElevation),h.isOccluded=!1),h}function xe(u,t,n){return u._unit()._perp()._mult(t*n)}function he(u,t,n,o,a,h,g,y,b){if(y.projectionCache.offsets[u])return y.projectionCache.offsets[u];const w=n.add(t);if(u+b.direction<o||u+b.direction>=a)return y.projectionCache.offsets[u]=w,w;const C=K(u+b.direction,y,b),E=xe(C.sub(n),g,b.direction),R=n.add(E),F=C.add(E);return y.projectionCache.offsets[u]=c.al(h,w,R,F)||w,y.projectionCache.offsets[u]}function Ie(u,t,n,o,a,h,g,y,b){const w=o?u-t:u+t;let C=w>0?1:-1,E=0;o&&(C*=-1,E=Math.PI),C<0&&(E+=Math.PI);let R,F=C>0?h+a:h+a+1;y.projectionCache.cachedAnchorPoint?R=y.projectionCache.cachedAnchorPoint:(R=pe(y.tileAnchorPoint.x,y.tileAnchorPoint.y,y).point,y.projectionCache.cachedAnchorPoint=R);let $,H,U=R,W=R,Y=0,j=0;const te=Math.abs(w),se=[];let ce;for(;Y+j<=te;){if(F+=C,F<h||F>=g)return null;Y+=j,W=U,H=$;const De={absOffsetX:te,direction:C,distanceFromAnchor:Y,previousVertex:W};if(U=K(F,y,De),n===0)se.push(W),ce=U.sub(W);else{let Re;const Se=U.sub(W);Re=Se.mag()===0?xe(K(F+C,y,De).sub(U),n,C):xe(Se,n,C),H||(H=W.add(Re)),$=he(F,Re,U,h,g,H,n,y,De),se.push(H),ce=$.sub(H)}j=ce.mag()}const ye=ce._mult((te-Y)/j)._add(H||W),we=E+Math.atan2(U.y-W.y,U.x-W.x);return se.push(ye),{point:ye,angle:b?we:0,path:se}}const Ge=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Xe(u,t){for(let n=0;n<u;n++){const o=t.length;t.resize(o+4),t.float32.set(Ge,3*o)}}const nt=100;class mt{constructor(t,n,o=new Mr(t.width+200,t.height+200,25),a=new Mr(t.width+200,t.height+200,25)){this.transform=t,this.mapProjection=n,this.grid=o,this.ignoredGrid=a,this.pitchFactor=Math.cos(t._pitch)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+nt,this.screenBottomBoundary=t.height+nt,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(t,n,o,a,h,g,y,b,w,C,E){const R=t.anchorPointX+b[0],F=t.anchorPointY+b[1],$=this.projectAndGetPerspectiveRatio(a,R,F,h,C),H=this._projectCollisionBox(t,o,a,h,g,y,b,$,C,E),[U,W,Y,j]=H.box;return this.mapProjection.useSpecialProjectionForSymbols&&(g?H.allPointsOccluded:this.mapProjection.isOccluded(R,F,h))||$.perspectiveRatio<this.perspectiveRatioCutoff||!this.isInsideGrid(U,W,Y,j)||n!=="always"&&this.grid.hitTest(U,W,Y,j,n,w)?{box:[U,W,Y,j],placeable:!1,offscreen:!1}:{box:[U,W,Y,j],placeable:!0,offscreen:this.isOffscreen(U,W,Y,j)}}placeCollisionCircles(t,n,o,a,h,g,y,b,w,C,E,R,F,$,H,U){const W=[],Y=new c.P(n.anchorX,n.anchorY),j=this.getPerspectiveRatio(g,Y.x,Y.y,y,U),te=(E?h/j:h*j)/c.aq,se={getElevation:U,labelPlaneMatrix:b,lineVertexArray:o,pitchWithMap:E,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},projection:this.mapProjection,tileAnchorPoint:Y,unwrappedTileID:y,width:this.transform.width,height:this.transform.height,translation:H},ce=G(te,a,n.lineOffsetX*te,n.lineOffsetY*te,!1,n,!1,se);let ye=!1,we=!1,De=!0;if(ce){const Re=.5*F*j+$,Se=new c.P(-100,-100),Te=new c.P(this.screenRightBoundary,this.screenBottomBoundary),Ne=new it,tt=ce.first,Ce=ce.last;let Ae=[];for(let ot=tt.path.length-1;ot>=1;ot--)Ae.push(tt.path[ot]);for(let ot=1;ot<Ce.path.length;ot++)Ae.push(Ce.path[ot]);const Qe=2.5*Re;if(w){const ot=this.projectPathToScreenSpace(Ae,se,w);Ae=ot.some(dt=>dt.signedDistanceFromCamera<=0)?[]:ot.map(dt=>dt.point)}let Dt=[];if(Ae.length>0){const ot=Ae[0].clone(),dt=Ae[0].clone();for(let Lt=1;Lt<Ae.length;Lt++)ot.x=Math.min(ot.x,Ae[Lt].x),ot.y=Math.min(ot.y,Ae[Lt].y),dt.x=Math.max(dt.x,Ae[Lt].x),dt.y=Math.max(dt.y,Ae[Lt].y);Dt=ot.x>=Se.x&&dt.x<=Te.x&&ot.y>=Se.y&&dt.y<=Te.y?[Ae]:dt.x<Se.x||ot.x>Te.x||dt.y<Se.y||ot.y>Te.y?[]:c.am([Ae],Se.x,Se.y,Te.x,Te.y)}for(const ot of Dt){Ne.reset(ot,.25*Re);let dt=0;dt=Ne.length<=.5*Re?1:Math.ceil(Ne.paddedLength/Qe)+1;for(let Lt=0;Lt<dt;Lt++){const di=Lt/Math.max(dt-1,1),nr=Ne.lerp(di),Rt=nr.x+nt,Mi=nr.y+nt;W.push(Rt,Mi,Re,0);const ki=Rt-Re,pi=Mi-Re,fi=Rt+Re,sr=Mi+Re;if(De=De&&this.isOffscreen(ki,pi,fi,sr),we=we||this.isInsideGrid(ki,pi,fi,sr),t!=="always"&&this.grid.hitTestCircle(Rt,Mi,Re,t,R)&&(ye=!0,!C))return{circles:[],offscreen:!1,collisionDetected:ye}}}}return{circles:!C&&ye||!we||j<this.perspectiveRatioCutoff?[]:W,offscreen:De,collisionDetected:ye}}projectPathToScreenSpace(t,n,o){return t.map(a=>X(a,o,n.getElevation))}queryRenderedSymbols(t){if(t.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const n=[];let o=1/0,a=1/0,h=-1/0,g=-1/0;for(const C of t){const E=new c.P(C.x+nt,C.y+nt);o=Math.min(o,E.x),a=Math.min(a,E.y),h=Math.max(h,E.x),g=Math.max(g,E.y),n.push(E)}const y=this.grid.query(o,a,h,g).concat(this.ignoredGrid.query(o,a,h,g)),b={},w={};for(const C of y){const E=C.key;if(b[E.bucketInstanceId]===void 0&&(b[E.bucketInstanceId]={}),b[E.bucketInstanceId][E.featureIndex])continue;const R=[new c.P(C.x1,C.y1),new c.P(C.x2,C.y1),new c.P(C.x2,C.y2),new c.P(C.x1,C.y2)];c.an(n,R)&&(b[E.bucketInstanceId][E.featureIndex]=!0,w[E.bucketInstanceId]===void 0&&(w[E.bucketInstanceId]=[]),w[E.bucketInstanceId].push(E.featureIndex))}return w}insertCollisionBox(t,n,o,a,h,g){(o?this.ignoredGrid:this.grid).insert({bucketInstanceId:a,featureIndex:h,collisionGroupID:g,overlapMode:n},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,n,o,a,h,g){const y=o?this.ignoredGrid:this.grid,b={bucketInstanceId:a,featureIndex:h,collisionGroupID:g,overlapMode:n};for(let w=0;w<t.length;w+=4)y.insertCircle(b,t[w],t[w+1],t[w+2])}projectAndGetPerspectiveRatio(t,n,o,a,h){const g=this.mapProjection.useSpecialProjectionForSymbols?this.mapProjection.projectTileCoordinates(n,o,a,h):X(new c.P(n,o),t,h);return{point:new c.P((g.point.x+1)/2*this.transform.width+nt,(1-g.point.y)/2*this.transform.height+nt),perspectiveRatio:.5+this.transform.cameraToCenterDistance/g.signedDistanceFromCamera*.5,isOccluded:g.isOccluded,signedDistanceFromCamera:g.signedDistanceFromCamera}}getPerspectiveRatio(t,n,o,a,h){const g=this.mapProjection.useSpecialProjectionForSymbols?this.mapProjection.projectTileCoordinates(n,o,a,h):X(new c.P(n,o),t,h);return .5+this.transform.cameraToCenterDistance/g.signedDistanceFromCamera*.5}isOffscreen(t,n,o,a){return o<nt||t>=this.screenRightBoundary||a<nt||n>this.screenBottomBoundary}isInsideGrid(t,n,o,a){return o>=0&&t<this.gridRightBoundary&&a>=0&&n<this.gridBottomBoundary}getViewportMatrix(){const t=c.ao([]);return c.J(t,t,[-100,-100,0]),t}_projectCollisionBox(t,n,o,a,h,g,y,b,w,C){const E=n*b.perspectiveRatio;let R=new c.P(1,0),F=new c.P(0,1);const $=new c.P(t.anchorPointX+y[0],t.anchorPointY+y[1]);if(g&&!h){const Re=this.projectAndGetPerspectiveRatio(o,$.x+1,$.y,a,w).point.sub(b.point).unit(),Se=Math.atan(Re.y/Re.x)+(Re.x<0?Math.PI:0),Te=Math.sin(Se),Ne=Math.cos(Se);R=new c.P(Ne,Te),F=new c.P(-Te,Ne)}else if(!g&&h){const Re=-this.transform.angle,Se=Math.sin(Re),Te=Math.cos(Re);R=new c.P(Te,Se),F=new c.P(-Se,Te)}let H=b.point,U=E;if(h){H=$;const Re=this.transform.zoom-Math.floor(this.transform.zoom);U=Math.pow(2,-Re),U*=this.mapProjection.getPitchedTextCorrection(this.transform,$,a),C||(U*=c.ad(.5+b.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))}C&&(H=H.add(R.mult(C.x*U)).add(F.mult(C.y*U)));const W=t.x1*U,Y=t.x2*U,j=(W+Y)/2,te=t.y1*U,se=t.y2*U,ce=(te+se)/2,ye=[{offsetX:W,offsetY:te},{offsetX:j,offsetY:te},{offsetX:Y,offsetY:te},{offsetX:Y,offsetY:ce},{offsetX:Y,offsetY:se},{offsetX:j,offsetY:se},{offsetX:W,offsetY:se},{offsetX:W,offsetY:ce}];let we=[];for(const{offsetX:Re,offsetY:Se}of ye)we.push(new c.P(H.x+R.x*Re+F.x*Se,H.y+R.y*Re+F.y*Se));let De=!1;if(h){const Re=we.map(Se=>this.projectAndGetPerspectiveRatio(o,Se.x,Se.y,a,w));De=Re.some(Se=>!Se.isOccluded),we=Re.map(Se=>Se.point)}else De=!0;return{box:c.ap(we),allPointsOccluded:!De}}}function rt(u,t,n){return t*(c.X/(u.tileSize*Math.pow(2,n-u.tileID.overscaledZ)))}class Ct{constructor(t,n,o,a){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?n:-n))):a&&o?1:0,this.placed=o}isHidden(){return this.opacity===0&&!this.placed}}class Ut{constructor(t,n,o,a,h){this.text=new Ct(t?t.text:null,n,o,h),this.icon=new Ct(t?t.icon:null,n,a,h)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Kt{constructor(t,n,o){this.text=t,this.icon=n,this.skipFade=o}}class lt{constructor(){this.invProjMatrix=c.H(),this.viewportMatrix=c.H(),this.circles=[]}}class vt{constructor(t,n,o,a,h){this.bucketInstanceId=t,this.featureIndex=n,this.sourceLayerIndex=o,this.bucketIndex=a,this.tileID=h}}class Ot{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:o=>o.collisionGroupID===n}}return this.collisionGroups[t]}}function ei(u,t,n,o,a){const{horizontalAlign:h,verticalAlign:g}=c.av(u);return new c.P(-(h-.5)*t+o[0]*a,-(g-.5)*n+o[1]*a)}class ci{constructor(t,n,o,a,h,g){this.transform=t.clone(),this.terrain=o,this.collisionIndex=new mt(this.transform,n),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=a,this.retainedQueryData={},this.collisionGroups=new Ot(h),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=g,g&&(g.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(t){const n=this.terrain;return n?(o,a)=>n.getElevation(t,o,a):null}getBucketParts(t,n,o,a){const h=o.getBucket(n),g=o.latestFeatureIndex;if(!h||!g||n.id!==h.layerIds[0])return;const y=o.collisionBoxArray,b=h.layers[0].layout,w=h.layers[0].paint,C=Math.pow(2,this.transform.zoom-o.tileID.overscaledZ),E=o.tileSize/c.X,R=o.tileID.toUnwrapped(),F=this.transform.calculatePosMatrix(R),$=b.get("text-pitch-alignment")==="map",H=b.get("text-rotation-alignment")==="map",U=rt(o,1,this.transform.zoom),W=this.collisionIndex.mapProjection.translatePosition(this.transform,o,w.get("text-translate"),w.get("text-translate-anchor")),Y=this.collisionIndex.mapProjection.translatePosition(this.transform,o,w.get("icon-translate"),w.get("icon-translate-anchor")),j=Gr(F,$,H,this.transform,U);let te=null;if($){const ce=_r(F,$,H,this.transform,U);te=c.L([],this.transform.labelPlaneMatrix,ce)}this.retainedQueryData[h.bucketInstanceId]=new vt(h.bucketInstanceId,g,h.sourceLayerIndex,h.index,o.tileID);const se={bucket:h,layout:b,translationText:W,translationIcon:Y,posMatrix:F,unwrappedTileID:R,textLabelPlaneMatrix:j,labelToScreenMatrix:te,scale:C,textPixelRatio:E,holdingForFade:o.holdingForFade(),collisionBoxArray:y,partiallyEvaluatedTextSize:c.ah(h.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(h.sourceID)};if(a)for(const ce of h.sortKeyRanges){const{sortKey:ye,symbolInstanceStart:we,symbolInstanceEnd:De}=ce;t.push({sortKey:ye,symbolInstanceStart:we,symbolInstanceEnd:De,parameters:se})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:h.symbolInstances.length,parameters:se})}attemptAnchorPlacement(t,n,o,a,h,g,y,b,w,C,E,R,F,$,H,U,W,Y,j){const te=c.ar[t.textAnchor],se=[t.textOffset0,t.textOffset1],ce=ei(te,o,a,se,h),ye=this.collisionIndex.placeCollisionBox(n,R,b,w,C,y,g,U,E.predicate,j,ce);if((!Y||this.collisionIndex.placeCollisionBox(Y,R,b,w,C,y,g,W,E.predicate,j,ce).placeable)&&ye.placeable){let we;if(this.prevPlacement&&this.prevPlacement.variableOffsets[F.crossTileID]&&this.prevPlacement.placements[F.crossTileID]&&this.prevPlacement.placements[F.crossTileID].text&&(we=this.prevPlacement.variableOffsets[F.crossTileID].anchor),F.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[F.crossTileID]={textOffset:se,width:o,height:a,anchor:te,textBoxScale:h,prevAnchor:we},this.markUsedJustification($,te,F,H),$.allowVerticalPlacement&&(this.markUsedOrientation($,H,F),this.placedOrientations[F.crossTileID]=H),{shift:ce,placedGlyphBoxes:ye}}}placeLayerBucketPart(t,n,o){const{bucket:a,layout:h,translationText:g,translationIcon:y,posMatrix:b,unwrappedTileID:w,textLabelPlaneMatrix:C,labelToScreenMatrix:E,textPixelRatio:R,holdingForFade:F,collisionBoxArray:$,partiallyEvaluatedTextSize:H,collisionGroup:U}=t.parameters,W=h.get("text-optional"),Y=h.get("icon-optional"),j=c.as(h,"text-overlap","text-allow-overlap"),te=j==="always",se=c.as(h,"icon-overlap","icon-allow-overlap"),ce=se==="always",ye=h.get("text-rotation-alignment")==="map",we=h.get("text-pitch-alignment")==="map",De=h.get("icon-text-fit")!=="none",Re=h.get("symbol-z-order")==="viewport-y",Se=te&&(ce||!a.hasIconData()||Y),Te=ce&&(te||!a.hasTextData()||W);!a.collisionArrays&&$&&a.deserializeCollisionBoxes($);const Ne=this._getTerrainElevationFunc(this.retainedQueryData[a.bucketInstanceId].tileID),tt=(Ce,Ae,Qe)=>{var Dt,ot;if(n[Ce.crossTileID])return;if(F)return void(this.placements[Ce.crossTileID]=new Kt(!1,!1,!1));let dt=!1,Lt=!1,di=!0,nr=null,Rt={box:null,placeable:!1,offscreen:null},Mi={box:null,placeable:!1,offscreen:null},ki=null,pi=null,fi=null,sr=0,vn=0,bo=0;Ae.textFeatureIndex?sr=Ae.textFeatureIndex:Ce.useRuntimeCollisionCircles&&(sr=Ce.featureIndex),Ae.verticalTextFeatureIndex&&(vn=Ae.verticalTextFeatureIndex);const qn=Ae.textBox;if(qn){const oi=mi=>{let gi=c.ai.horizontal;if(a.allowVerticalPlacement&&!mi&&this.prevPlacement){const ri=this.prevPlacement.placedOrientations[Ce.crossTileID];ri&&(this.placedOrientations[Ce.crossTileID]=ri,gi=ri,this.markUsedOrientation(a,gi,Ce))}return gi},or=(mi,gi)=>{if(a.allowVerticalPlacement&&Ce.numVerticalGlyphVertices>0&&Ae.verticalTextBox){for(const ri of a.writingModes)if(ri===c.ai.vertical?(Rt=gi(),Mi=Rt):Rt=mi(),Rt&&Rt.placeable)break}else Rt=mi()},Qr=Ce.textAnchorOffsetStartIndex,Zn=Ce.textAnchorOffsetEndIndex;if(Zn===Qr){const mi=(gi,ri)=>{const Nt=this.collisionIndex.placeCollisionBox(gi,j,R,b,w,we,ye,g,U.predicate,Ne);return Nt&&Nt.placeable&&(this.markUsedOrientation(a,ri,Ce),this.placedOrientations[Ce.crossTileID]=ri),Nt};or(()=>mi(qn,c.ai.horizontal),()=>{const gi=Ae.verticalTextBox;return a.allowVerticalPlacement&&Ce.numVerticalGlyphVertices>0&&gi?mi(gi,c.ai.vertical):{box:null,offscreen:null}}),oi(Rt&&Rt.placeable)}else{let mi=c.ar[(ot=(Dt=this.prevPlacement)===null||Dt===void 0?void 0:Dt.variableOffsets[Ce.crossTileID])===null||ot===void 0?void 0:ot.anchor];const gi=(Nt,Gn,Fa)=>{const ti=Nt.x2-Nt.x1,Kl=Nt.y2-Nt.y1,So=Ce.textBoxScale,To=De&&se==="never"?Gn:null;let en=null,Yl=j==="never"?1:2,Oa="never";mi&&Yl++;for(let Va=0;Va<Yl;Va++){for(let Na=Qr;Na<Zn;Na++){const ko=a.textAnchorOffsets.get(Na);if(mi&&ko.textAnchor!==mi)continue;const Hn=this.attemptAnchorPlacement(ko,Nt,ti,Kl,So,ye,we,R,b,w,U,Oa,Ce,a,Fa,g,y,To,Ne);if(Hn&&(en=Hn.placedGlyphBoxes,en&&en.placeable))return dt=!0,nr=Hn.shift,en}mi?mi=null:Oa=j}return o&&!en&&(en={box:this.collisionIndex.placeCollisionBox(qn,"always",R,b,w,we,ye,g,U.predicate,Ne,new c.P(0,0)).box,offscreen:!1,placeable:!1}),en};or(()=>gi(qn,Ae.iconBox,c.ai.horizontal),()=>{const Nt=Ae.verticalTextBox;return a.allowVerticalPlacement&&(!Rt||!Rt.placeable)&&Ce.numVerticalGlyphVertices>0&&Nt?gi(Nt,Ae.verticalIconBox,c.ai.vertical):{box:null,occluded:!0,offscreen:null}}),Rt&&(dt=Rt.placeable,di=Rt.offscreen);const ri=oi(Rt&&Rt.placeable);if(!dt&&this.prevPlacement){const Nt=this.prevPlacement.variableOffsets[Ce.crossTileID];Nt&&(this.variableOffsets[Ce.crossTileID]=Nt,this.markUsedJustification(a,Nt.anchor,Ce,ri))}}}if(ki=Rt,dt=ki&&ki.placeable,di=ki&&ki.offscreen,Ce.useRuntimeCollisionCircles){const oi=a.text.placedSymbolArray.get(Ce.centerJustifiedTextSymbolIndex),or=c.aj(a.textSizeData,H,oi),Qr=h.get("text-padding");pi=this.collisionIndex.placeCollisionCircles(j,oi,a.lineVertexArray,a.glyphOffsetArray,or,b,w,C,E,o,we,U.predicate,Ce.collisionCircleDiameter,Qr,g,Ne),pi.circles.length&&pi.collisionDetected&&!o&&c.w("Collisions detected, but collision boxes are not shown"),dt=te||pi.circles.length>0&&!pi.collisionDetected,di=di&&pi.offscreen}if(Ae.iconFeatureIndex&&(bo=Ae.iconFeatureIndex),Ae.iconBox){const oi=or=>this.collisionIndex.placeCollisionBox(or,se,R,b,w,we,ye,y,U.predicate,Ne,De&&nr?nr:void 0);Mi&&Mi.placeable&&Ae.verticalIconBox?(fi=oi(Ae.verticalIconBox),Lt=fi.placeable):(fi=oi(Ae.iconBox),Lt=fi.placeable),di=di&&fi.offscreen}const bn=W||Ce.numHorizontalGlyphVertices===0&&Ce.numVerticalGlyphVertices===0,wo=Y||Ce.numIconVertices===0;bn||wo?wo?bn||(Lt=Lt&&dt):dt=Lt&&dt:Lt=dt=Lt&&dt;const Ba=Lt&&fi.placeable;if(dt&&ki.placeable&&this.collisionIndex.insertCollisionBox(ki.box,j,h.get("text-ignore-placement"),a.bucketInstanceId,Mi&&Mi.placeable&&vn?vn:sr,U.ID),Ba&&this.collisionIndex.insertCollisionBox(fi.box,se,h.get("icon-ignore-placement"),a.bucketInstanceId,bo,U.ID),pi&&dt&&this.collisionIndex.insertCollisionCircles(pi.circles,j,h.get("text-ignore-placement"),a.bucketInstanceId,sr,U.ID),o&&this.storeCollisionData(a.bucketInstanceId,Qe,Ae,ki,fi,pi),Ce.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(a.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[Ce.crossTileID]=new Kt(dt||Se,Lt||Te,di||a.justReloaded),n[Ce.crossTileID]=!0};if(Re){if(t.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const Ce=a.getSortedSymbolIndexes(this.transform.angle);for(let Ae=Ce.length-1;Ae>=0;--Ae){const Qe=Ce[Ae];tt(a.symbolInstances.get(Qe),a.collisionArrays[Qe],Qe)}}else for(let Ce=t.symbolInstanceStart;Ce<t.symbolInstanceEnd;Ce++)tt(a.symbolInstances.get(Ce),a.collisionArrays[Ce],Ce);if(o&&a.bucketInstanceId in this.collisionCircleArrays){const Ce=this.collisionCircleArrays[a.bucketInstanceId];c.at(Ce.invProjMatrix,b),Ce.viewportMatrix=this.collisionIndex.getViewportMatrix()}a.justReloaded=!1}storeCollisionData(t,n,o,a,h,g){if(o.textBox||o.iconBox){let y,b;this.collisionBoxArrays.has(t)?y=this.collisionBoxArrays.get(t):(y=new Map,this.collisionBoxArrays.set(t,y)),y.has(n)?b=y.get(n):(b={text:null,icon:null},y.set(n,b)),o.textBox&&(b.text=a.box),o.iconBox&&(b.icon=h.box)}if(g){let y=this.collisionCircleArrays[t];y===void 0&&(y=this.collisionCircleArrays[t]=new lt);for(let b=0;b<g.circles.length;b+=4)y.circles.push(g.circles[b+0]),y.circles.push(g.circles[b+1]),y.circles.push(g.circles[b+2]),y.circles.push(g.collisionDetected?1:0)}}markUsedJustification(t,n,o,a){let h;h=a===c.ai.vertical?o.verticalPlacedTextSymbolIndex:{left:o.leftJustifiedTextSymbolIndex,center:o.centerJustifiedTextSymbolIndex,right:o.rightJustifiedTextSymbolIndex}[c.au(n)];const g=[o.leftJustifiedTextSymbolIndex,o.centerJustifiedTextSymbolIndex,o.rightJustifiedTextSymbolIndex,o.verticalPlacedTextSymbolIndex];for(const y of g)y>=0&&(t.text.placedSymbolArray.get(y).crossTileID=h>=0&&y!==h?0:o.crossTileID)}markUsedOrientation(t,n,o){const a=n===c.ai.horizontal||n===c.ai.horizontalOnly?n:0,h=n===c.ai.vertical?n:0,g=[o.leftJustifiedTextSymbolIndex,o.centerJustifiedTextSymbolIndex,o.rightJustifiedTextSymbolIndex];for(const y of g)t.text.placedSymbolArray.get(y).placedOrientation=a;o.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(o.verticalPlacedTextSymbolIndex).placedOrientation=h)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const n=this.prevPlacement;let o=!1;this.prevZoomAdjustment=n?n.zoomAdjustment(this.transform.zoom):0;const a=n?n.symbolFadeChange(t):1,h=n?n.opacities:{},g=n?n.variableOffsets:{},y=n?n.placedOrientations:{};for(const b in this.placements){const w=this.placements[b],C=h[b];C?(this.opacities[b]=new Ut(C,a,w.text,w.icon),o=o||w.text!==C.text.placed||w.icon!==C.icon.placed):(this.opacities[b]=new Ut(null,a,w.text,w.icon,w.skipFade),o=o||w.text||w.icon)}for(const b in h){const w=h[b];if(!this.opacities[b]){const C=new Ut(w,a,!1,!1);C.isHidden()||(this.opacities[b]=C,o=o||w.text.placed||w.icon.placed)}}for(const b in g)this.variableOffsets[b]||!this.opacities[b]||this.opacities[b].isHidden()||(this.variableOffsets[b]=g[b]);for(const b in y)this.placedOrientations[b]||!this.opacities[b]||this.opacities[b].isHidden()||(this.placedOrientations[b]=y[b]);if(n&&n.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");o?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=n?n.lastPlacementChangeTime:t)}updateLayerOpacities(t,n){const o={};for(const a of n){const h=a.getBucket(t);h&&a.latestFeatureIndex&&t.id===h.layerIds[0]&&this.updateBucketOpacities(h,a.tileID,o,a.collisionBoxArray)}}updateBucketOpacities(t,n,o,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 h=t.layers[0],g=h.layout,y=new Ut(null,0,!1,!1,!0),b=g.get("text-allow-overlap"),w=g.get("icon-allow-overlap"),C=h._unevaluatedLayout.hasValue("text-variable-anchor")||h._unevaluatedLayout.hasValue("text-variable-anchor-offset"),E=g.get("text-rotation-alignment")==="map",R=g.get("text-pitch-alignment")==="map",F=g.get("icon-text-fit")!=="none",$=new Ut(null,0,b&&(w||!t.hasIconData()||g.get("icon-optional")),w&&(b||!t.hasTextData()||g.get("text-optional")),!0);!t.collisionArrays&&a&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(a);const H=(W,Y,j)=>{for(let te=0;te<Y/4;te++)W.opacityVertexArray.emplaceBack(j);W.hasVisibleVertices=W.hasVisibleVertices||j!==ui},U=this.collisionBoxArrays.get(t.bucketInstanceId);for(let W=0;W<t.symbolInstances.length;W++){const Y=t.symbolInstances.get(W),{numHorizontalGlyphVertices:j,numVerticalGlyphVertices:te,crossTileID:se}=Y;let ce=this.opacities[se];o[se]?ce=y:ce||(ce=$,this.opacities[se]=ce),o[se]=!0;const ye=Y.numIconVertices>0,we=this.placedOrientations[Y.crossTileID],De=we===c.ai.vertical,Re=we===c.ai.horizontal||we===c.ai.horizontalOnly;if(j>0||te>0){const Te=$i(ce.text);H(t.text,j,De?ui:Te),H(t.text,te,Re?ui:Te);const Ne=ce.text.isHidden();[Y.rightJustifiedTextSymbolIndex,Y.centerJustifiedTextSymbolIndex,Y.leftJustifiedTextSymbolIndex].forEach(Ae=>{Ae>=0&&(t.text.placedSymbolArray.get(Ae).hidden=Ne||De?1:0)}),Y.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(Y.verticalPlacedTextSymbolIndex).hidden=Ne||Re?1:0);const tt=this.variableOffsets[Y.crossTileID];tt&&this.markUsedJustification(t,tt.anchor,Y,we);const Ce=this.placedOrientations[Y.crossTileID];Ce&&(this.markUsedJustification(t,"left",Y,Ce),this.markUsedOrientation(t,Ce,Y))}if(ye){const Te=$i(ce.icon),Ne=!(F&&Y.verticalPlacedIconSymbolIndex&&De);Y.placedIconSymbolIndex>=0&&(H(t.icon,Y.numIconVertices,Ne?Te:ui),t.icon.placedSymbolArray.get(Y.placedIconSymbolIndex).hidden=ce.icon.isHidden()),Y.verticalPlacedIconSymbolIndex>=0&&(H(t.icon,Y.numVerticalIconVertices,Ne?ui:Te),t.icon.placedSymbolArray.get(Y.verticalPlacedIconSymbolIndex).hidden=ce.icon.isHidden())}const Se=U&&U.has(W)?U.get(W):{text:null,icon:null};if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const Te=t.collisionArrays[W];if(Te){let Ne=new c.P(0,0);if(Te.textBox||Te.verticalTextBox){let tt=!0;if(C){const Ce=this.variableOffsets[se];Ce?(Ne=ei(Ce.anchor,Ce.width,Ce.height,Ce.textOffset,Ce.textBoxScale),E&&Ne._rotate(R?this.transform.angle:-this.transform.angle)):tt=!1}if(Te.textBox||Te.verticalTextBox){let Ce;Te.textBox&&(Ce=De),Te.verticalTextBox&&(Ce=Re),hi(t.textCollisionBox.collisionVertexArray,ce.text.placed,!tt||Ce,Se.text,Ne.x,Ne.y)}}if(Te.iconBox||Te.verticalIconBox){const tt=!!(!Re&&Te.verticalIconBox);let Ce;Te.iconBox&&(Ce=tt),Te.verticalIconBox&&(Ce=!tt),hi(t.iconCollisionBox.collisionVertexArray,ce.icon.placed,Ce,Se.icon,F?Ne.x:0,F?Ne.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 W=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=W.invProjMatrix,t.placementViewportMatrix=W.viewportMatrix,t.collisionCircleArray=W.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 o=this.zoomAtLastRecencyCheck===n?1-this.zoomAdjustment(n):1;return this.zoomAtLastRecencyCheck=n,this.commitTime+this.fadeDuration*o>t}setStale(){this.stale=!0}}function hi(u,t,n,o,a,h){o&&o.length!==0||(o=[0,0,0,0]);const g=o[0]-nt,y=o[1]-nt,b=o[2]-nt,w=o[3]-nt;u.emplaceBack(t?1:0,n?1:0,a||0,h||0,g,y),u.emplaceBack(t?1:0,n?1:0,a||0,h||0,b,y),u.emplaceBack(t?1:0,n?1:0,a||0,h||0,b,w),u.emplaceBack(t?1:0,n?1:0,a||0,h||0,g,w)}const cs=Math.pow(2,25),bt=Math.pow(2,24),Uo=Math.pow(2,17),qo=Math.pow(2,16),Vi=Math.pow(2,9),Ni=Math.pow(2,8),Vc=Math.pow(2,1);function $i(u){if(u.opacity===0&&!u.placed)return 0;if(u.opacity===1&&u.placed)return 4294967295;const t=u.placed?1:0,n=Math.floor(127*u.opacity);return n*cs+t*bt+n*Uo+t*qo+n*Vi+t*Ni+n*Vc+t}const ui=0;function qs(){return{isOccluded:(u,t,n)=>!1,getPitchedTextCorrection:(u,t,n)=>1,get useSpecialProjectionForSymbols(){return!1},projectTileCoordinates(u,t,n,o){throw new Error("Not implemented.")},translatePosition:(u,t,n,o)=>function(a,h,g,y,b=!1){if(!g[0]&&!g[1])return[0,0];const w=b?y==="map"?a.angle:0:y==="viewport"?-a.angle:0;if(w){const C=Math.sin(w),E=Math.cos(w);g=[g[0]*E-g[1]*C,g[0]*C+g[1]*E]}return[b?g[0]:rt(h,g[0],a.zoom),b?g[1]:rt(h,g[1],a.zoom)]}(u,t,n,o),getCircleRadiusCorrection:u=>1}}class hs{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,o,a,h){const g=this._bucketParts;for(;this._currentTileIndex<t.length;)if(n.getBucketParts(g,a,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,h())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,g.sort((y,b)=>y.sortKey-b.sortKey));this._currentPartIndex<g.length;)if(n.placeLayerBucketPart(g[this._currentPartIndex],this._seenCrossTileIDs,o),this._currentPartIndex++,h())return!0;return!1}}class Yt{constructor(t,n,o,a,h,g,y,b){this.placement=new ci(t,qs(),n,g,y,b),this._currentPlacementIndex=o.length-1,this._forceFullPlacement=a,this._showCollisionBoxes=h,this._done=!1}isDone(){return this._done}continuePlacement(t,n,o){const a=le.now(),h=()=>!this._forceFullPlacement&&le.now()-a>2;for(;this._currentPlacementIndex>=0;){const g=n[t[this._currentPlacementIndex]],y=this.placement.collisionIndex.transform.zoom;if(g.type==="symbol"&&(!g.minzoom||g.minzoom<=y)&&(!g.maxzoom||g.maxzoom>y)){if(this._inProgressLayer||(this._inProgressLayer=new hs(g)),this._inProgressLayer.continuePlacement(o[g.source],this.placement,this._showCollisionBoxes,g,h))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const zr=512/c.X/2;class hn{constructor(t,n,o){this.tileID=t,this.bucketInstanceId=o,this._symbolsByKey={};const a=new Map;for(let h=0;h<n.length;h++){const g=n.get(h),y=g.key,b=a.get(y);b?b.push(g):a.set(y,[g])}for(const[h,g]of a){const y={positions:g.map(b=>({x:Math.floor(b.anchorX*zr),y:Math.floor(b.anchorY*zr)})),crossTileIDs:g.map(b=>b.crossTileID)};if(y.positions.length>128){const b=new c.aw(y.positions.length,16,Uint16Array);for(const{x:w,y:C}of y.positions)b.add(w,C);b.finish(),delete y.positions,y.index=b}this._symbolsByKey[h]=y}}getScaledCoordinates(t,n){const{x:o,y:a,z:h}=this.tileID.canonical,{x:g,y,z:b}=n.canonical,w=zr/Math.pow(2,b-h),C=(y*c.X+t.anchorY)*w,E=a*c.X*zr;return{x:Math.floor((g*c.X+t.anchorX)*w-o*c.X*zr),y:Math.floor(C-E)}}findMatches(t,n,o){const a=this.tileID.canonical.z<n.canonical.z?1:Math.pow(2,this.tileID.canonical.z-n.canonical.z);for(let h=0;h<t.length;h++){const g=t.get(h);if(g.crossTileID)continue;const y=this._symbolsByKey[g.key];if(!y)continue;const b=this.getScaledCoordinates(g,n);if(y.index){const w=y.index.range(b.x-a,b.y-a,b.x+a,b.y+a).sort();for(const C of w){const E=y.crossTileIDs[C];if(!o[E]){o[E]=!0,g.crossTileID=E;break}}}else if(y.positions)for(let w=0;w<y.positions.length;w++){const C=y.positions[w],E=y.crossTileIDs[w];if(Math.abs(C.x-b.x)<=a&&Math.abs(C.y-b.y)<=a&&!o[E]){o[E]=!0,g.crossTileID=E;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:t})=>t)}}class Wt{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Zs{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const n=Math.round((t-this.lng)/360);if(n!==0)for(const o in this.indexes){const a=this.indexes[o],h={};for(const g in a){const y=a[g];y.tileID=y.tileID.unwrapTo(y.tileID.wrap+n),h[y.tileID.key]=y}this.indexes[o]=h}this.lng=t}addBucket(t,n,o){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 h=0;h<n.symbolInstances.length;h++)n.symbolInstances.get(h).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]={});const a=this.usedCrossTileIDs[t.overscaledZ];for(const h in this.indexes){const g=this.indexes[h];if(Number(h)>t.overscaledZ)for(const y in g){const b=g[y];b.tileID.isChildOf(t)&&b.findMatches(n.symbolInstances,t,a)}else{const y=g[t.scaledTo(Number(h)).key];y&&y.findMatches(n.symbolInstances,t,a)}}for(let h=0;h<n.symbolInstances.length;h++){const g=n.symbolInstances.get(h);g.crossTileID||(g.crossTileID=o.generate(),a[g.crossTileID]=!0)}return this.indexes[t.overscaledZ]===void 0&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new hn(t,n.symbolInstances,n.bucketInstanceId),!0}removeBucketCrossTileIDs(t,n){for(const o of n.getCrossTileIDsLists())for(const a of o)delete this.usedCrossTileIDs[t][a]}removeStaleBuckets(t){let n=!1;for(const o in this.indexes){const a=this.indexes[o];for(const h in a)t[a[h].bucketInstanceId]||(this.removeBucketCrossTileIDs(o,a[h]),delete a[h],n=!0)}return n}}class Wi{constructor(){this.layerIndexes={},this.crossTileIDs=new Wt,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,n,o){let a=this.layerIndexes[t.id];a===void 0&&(a=this.layerIndexes[t.id]=new Zs);let h=!1;const g={};a.handleWrapJump(o);for(const y of n){const b=y.getBucket(t);b&&t.id===b.layerIds[0]&&(b.bucketInstanceId||(b.bucketInstanceId=++this.maxBucketInstanceId),a.addBucket(y.tileID,b,this.crossTileIDs)&&(h=!0),g[b.bucketInstanceId]=!0)}return a.removeStaleBuckets(g)&&(h=!0),h}pruneUnusedLayers(t){const n={};t.forEach(o=>{n[o]=!0});for(const o in this.layerIndexes)n[o]||delete this.layerIndexes[o]}}const us=(u,t)=>c.t(u,t&&t.filter(n=>n.identifier!=="source.canvas")),Hr=c.ax();class Zo extends c.E{constructor(t,n={}){super(),this._rtlPluginLoaded=()=>{for(const o in this.sourceCaches){const a=this.sourceCaches[o].getSource().type;a!=="vector"&&a!=="geojson"||this.sourceCaches[o].reload()}},this.map=t,this.dispatcher=new ln(an(),t._getMapId()),this.dispatcher.registerMessageHandler("GG",(o,a)=>this.getGlyphs(o,a)),this.dispatcher.registerMessageHandler("GI",(o,a)=>this.getImages(o,a)),this.imageManager=new li,this.imageManager.setEventedParent(this),this.glyphManager=new dr(t._requestManager,n.localIdeographFontFamily),this.lineAtlas=new Pn(256,512),this.crossTileSymbolIndex=new Wi,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new c.ay,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",c.az()),mr().on(ke,this._rtlPluginLoaded),this.on("data",o=>{if(o.dataType!=="source"||o.sourceDataType!=="metadata")return;const a=this.sourceCaches[o.sourceId];if(!a)return;const h=a.getSource();if(h&&h.vectorLayerIds)for(const g in this._layers){const y=this._layers[g];y.source===h.id&&this._validateLayer(y)}})}loadURL(t,n={},o){this.fire(new c.k("dataloading",{dataType:"style"})),n.validate=typeof n.validate!="boolean"||n.validate;const a=this.map._requestManager.transformRequest(t,"Style");this._loadStyleRequest=new AbortController;const h=this._loadStyleRequest;c.h(a,this._loadStyleRequest).then(g=>{this._loadStyleRequest=null,this._load(g.data,n,o)}).catch(g=>{this._loadStyleRequest=null,g&&!h.signal.aborted&&this.fire(new c.j(g))})}loadJSON(t,n={},o){this.fire(new c.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,le.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,n.validate=n.validate!==!1,this._load(t,n,o)}).catch(()=>{})}loadEmpty(){this.fire(new c.k("dataloading",{dataType:"style"})),this._load(Hr,{validate:!1})}_load(t,n,o){var a;const h=n.transformStyle?n.transformStyle(o,t):t;if(!n.validate||!us(this,c.x(h))){this._loaded=!0,this.stylesheet=h;for(const g in h.sources)this.addSource(g,h.sources[g],{validate:!1});h.sprite?this._loadSprite(h.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(h.glyphs),this._createLayers(),this.light=new Er(this.stylesheet.light),this.sky=new Qi(this.stylesheet.sky),this.map.setTerrain((a=this.stylesheet.terrain)!==null&&a!==void 0?a:null),this.fire(new c.k("data",{dataType:"style"})),this.fire(new c.k("style.load"))}}_createLayers(){const t=c.aA(this.stylesheet.layers);this.dispatcher.broadcast("SL",t),this._order=t.map(n=>n.id),this._layers={},this._serializedLayers=null;for(const n of t){const o=c.aB(n);o.setEventedParent(this,{layer:{id:n.id}}),this._layers[n.id]=o}}_loadSprite(t,n=!1,o=void 0){let a;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(h,g,y,b){return c._(this,void 0,void 0,function*(){const w=bi(h),C=y>1?"@2x":"",E={},R={};for(const{id:F,url:$}of w){const H=g.transformRequest(Nr($,C,".json"),"SpriteJSON");E[F]=c.h(H,b);const U=g.transformRequest(Nr($,C,".png"),"SpriteImage");R[F]=He.getImage(U,b)}return yield Promise.all([...Object.values(E),...Object.values(R)]),function(F,$){return c._(this,void 0,void 0,function*(){const H={};for(const U in F){H[U]={};const W=le.getImageCanvasContext((yield $[U]).data),Y=(yield F[U]).data;for(const j in Y){const{width:te,height:se,x:ce,y:ye,sdf:we,pixelRatio:De,stretchX:Re,stretchY:Se,content:Te,textFitWidth:Ne,textFitHeight:tt}=Y[j];H[U][j]={data:null,pixelRatio:De,sdf:we,stretchX:Re,stretchY:Se,content:Te,textFitWidth:Ne,textFitHeight:tt,spriteData:{width:te,height:se,x:ce,y:ye,context:W}}}}return H})}(E,R)})}(t,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(h=>{if(this._spriteRequest=null,h)for(const g in h){this._spritesImagesIds[g]=[];const y=this._spritesImagesIds[g]?this._spritesImagesIds[g].filter(b=>!(b in h)):[];for(const b of y)this.imageManager.removeImage(b),this._changedImages[b]=!0;for(const b in h[g]){const w=g==="default"?b:`${g}:${b}`;this._spritesImagesIds[g].push(w),w in this.imageManager.images?this.imageManager.updateImage(w,h[g][b],!1):this.imageManager.addImage(w,h[g][b]),n&&(this._changedImages[w]=!0)}}}).catch(h=>{this._spriteRequest=null,a=h,this.fire(new c.j(a))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),n&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new c.k("data",{dataType:"style"})),o&&o(a)})}_unloadSprite(){for(const t of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(t),this._changedImages[t]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new c.k("data",{dataType:"style"}))}_validateLayer(t){const n=this.sourceCaches[t.source];if(!n)return;const o=t.sourceLayer;if(!o)return;const a=n.getSource();(a.type==="geojson"||a.vectorLayerIds&&a.vectorLayerIds.indexOf(o)===-1)&&this.fire(new c.j(new Error(`Source layer "${o}" does not exist on source "${a.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 o=[];for(const a of t)n[a]&&o.push(n[a]);return o}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;t=this._serializedLayers={};const n=Object.keys(this._layers);for(const o of n){const a=this._layers[o];a.type!=="custom"&&(t[o]=a.serialize())}return t}hasTransitions(){if(this.light&&this.light.hasTransition()||this.sky&&this.sky.hasTransition())return!0;for(const t in this.sourceCaches)if(this.sourceCaches[t].hasTransition())return!0;for(const t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(t){if(!this._loaded)return;const n=this._changed;if(n){const a=Object.keys(this._updatedLayers),h=Object.keys(this._removedLayers);(a.length||h.length)&&this._updateWorkerLayers(a,h);for(const g in this._updatedSources){const y=this._updatedSources[g];if(y==="reload")this._reloadSource(g);else{if(y!=="clear")throw new Error(`Invalid action ${y}`);this._clearSource(g)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const g in this._updatedPaintProps)this._layers[g].updateTransitions(t);this.light.updateTransitions(t),this.sky.updateTransitions(t),this._resetUpdates()}const o={};for(const a in this.sourceCaches){const h=this.sourceCaches[a];o[a]=h.used,h.used=!1}for(const a of this._order){const h=this._layers[a];h.recalculate(t,this._availableImages),!h.isHidden(t.zoom)&&h.source&&(this.sourceCaches[h.source].used=!0)}for(const a in o){const h=this.sourceCaches[a];!!o[a]!=!!h.used&&h.fire(new c.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:a}))}this.light.recalculate(t),this.sky.recalculate(t),this.z=t.zoom,n&&this.fire(new c.k("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("UL",{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={}){var o;this._checkLoaded();const a=this.serialize();if(t=n.transformStyle?n.transformStyle(a,t):t,((o=n.validate)===null||o===void 0||o)&&us(this,c.x(t)))return!1;(t=c.aC(t)).layers=c.aA(t.layers);const h=c.aD(a,t),g=this._getOperationsToPerform(h);if(g.unimplemented.length>0)throw new Error(`Unimplemented: ${g.unimplemented.join(", ")}.`);if(g.operations.length===0)return!1;for(const y of g.operations)y();return this.stylesheet=t,this._serializedLayers=null,!0}_getOperationsToPerform(t){const n=[],o=[];for(const a of t)switch(a.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":n.push(()=>this.addLayer.apply(this,a.args));break;case"removeLayer":n.push(()=>this.removeLayer.apply(this,a.args));break;case"setPaintProperty":n.push(()=>this.setPaintProperty.apply(this,a.args));break;case"setLayoutProperty":n.push(()=>this.setLayoutProperty.apply(this,a.args));break;case"setFilter":n.push(()=>this.setFilter.apply(this,a.args));break;case"addSource":n.push(()=>this.addSource.apply(this,a.args));break;case"removeSource":n.push(()=>this.removeSource.apply(this,a.args));break;case"setLayerZoomRange":n.push(()=>this.setLayerZoomRange.apply(this,a.args));break;case"setLight":n.push(()=>this.setLight.apply(this,a.args));break;case"setGeoJSONSourceData":n.push(()=>this.setGeoJSONSourceData.apply(this,a.args));break;case"setGlyphs":n.push(()=>this.setGlyphs.apply(this,a.args));break;case"setSprite":n.push(()=>this.setSprite.apply(this,a.args));break;case"setSky":n.push(()=>this.setSky.apply(this,a.args));break;case"setTerrain":n.push(()=>this.map.setTerrain.apply(this,a.args));break;case"setTransition":n.push(()=>{});break;default:o.push(a.command)}return{operations:n,unimplemented:o}}addImage(t,n){if(this.getImage(t))return this.fire(new c.j(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 c.j(new Error(`An image named "${t}" does not exist.`)));this.imageManager.removeImage(t),this._afterImageUpdated(t)}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new c.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,n,o={}){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(c.x.source,`sources.${t}`,n,null,o))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);const a=this.sourceCaches[t]=new Ye(t,n,this.dispatcher);a.style=this,a.setEventedParent(this,()=>({isSourceLoaded:a.loaded(),source:a.serialize(),sourceId:t})),a.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 o in this._layers)if(this._layers[o].source===t)return this.fire(new c.j(new Error(`Source "${t}" cannot be removed while layer "${o}" is using it.`)));const n=this.sourceCaches[t];delete this.sourceCaches[t],delete this._updatedSources[t],n.fire(new c.k("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 o=this.sourceCaches[t].getSource();if(o.type!=="geojson")throw new Error(`geojsonSource.type is ${o.type}, which is !== 'geojson`);o.setData(n),this._changed=!0}getSource(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()}addLayer(t,n,o={}){this._checkLoaded();const a=t.id;if(this.getLayer(a))return void this.fire(new c.j(new Error(`Layer "${a}" already exists on this map.`)));let h;if(t.type==="custom"){if(us(this,c.aE(t)))return;h=c.aB(t)}else{if("source"in t&&typeof t.source=="object"&&(this.addSource(a,t.source),t=c.aC(t),t=c.e(t,{source:a})),this._validate(c.x.layer,`layers.${a}`,t,{arrayIndex:-1},o))return;h=c.aB(t),this._validateLayer(h),h.setEventedParent(this,{layer:{id:a}})}const g=n?this._order.indexOf(n):this._order.length;if(n&&g===-1)this.fire(new c.j(new Error(`Cannot add layer "${a}" before non-existing layer "${n}".`)));else{if(this._order.splice(g,0,a),this._layerOrderChanged=!0,this._layers[a]=h,this._removedLayers[a]&&h.source&&h.type!=="custom"){const y=this._removedLayers[a];delete this._removedLayers[a],y.type!==h.type?this._updatedSources[h.source]="clear":(this._updatedSources[h.source]="reload",this.sourceCaches[h.source].pause())}this._updateLayer(h),h.onAdd&&h.onAdd(this.map)}}moveLayer(t,n){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new c.j(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===n)return;const o=this._order.indexOf(t);this._order.splice(o,1);const a=n?this._order.indexOf(n):this._order.length;n&&a===-1?this.fire(new c.j(new Error(`Cannot move layer "${t}" before non-existing layer "${n}".`))):(this._order.splice(a,0,t),this._layerOrderChanged=!0)}removeLayer(t){this._checkLoaded();const n=this._layers[t];if(!n)return void this.fire(new c.j(new Error(`Cannot remove non-existing layer "${t}".`)));n.setEventedParent(null);const o=this._order.indexOf(t);this._order.splice(o,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]}getLayersOrder(){return[...this._order]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,n,o){this._checkLoaded();const a=this.getLayer(t);a?a.minzoom===n&&a.maxzoom===o||(n!=null&&(a.minzoom=n),o!=null&&(a.maxzoom=o),this._updateLayer(a)):this.fire(new c.j(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,n,o={}){this._checkLoaded();const a=this.getLayer(t);if(a){if(!c.aF(a.filter,n))return n==null?(a.filter=void 0,void this._updateLayer(a)):void(this._validate(c.x.filter,`layers.${a.id}.filter`,n,null,o)||(a.filter=c.aC(n),this._updateLayer(a)))}else this.fire(new c.j(new Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return c.aC(this.getLayer(t).filter)}setLayoutProperty(t,n,o,a={}){this._checkLoaded();const h=this.getLayer(t);h?c.aF(h.getLayoutProperty(n),o)||(h.setLayoutProperty(n,o,a),this._updateLayer(h)):this.fire(new c.j(new Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,n){const o=this.getLayer(t);if(o)return o.getLayoutProperty(n);this.fire(new c.j(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,n,o,a={}){this._checkLoaded();const h=this.getLayer(t);h?c.aF(h.getPaintProperty(n),o)||(h.setPaintProperty(n,o,a)&&this._updateLayer(h),this._changed=!0,this._updatedPaintProps[t]=!0,this._serializedLayers=null):this.fire(new c.j(new Error(`Cannot style non-existing layer "${t}".`)))}getPaintProperty(t,n){return this.getLayer(t).getPaintProperty(n)}setFeatureState(t,n){this._checkLoaded();const o=t.source,a=t.sourceLayer,h=this.sourceCaches[o];if(h===void 0)return void this.fire(new c.j(new Error(`The source '${o}' does not exist in the map's style.`)));const g=h.getSource().type;g==="geojson"&&a?this.fire(new c.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):g!=="vector"||a?(t.id===void 0&&this.fire(new c.j(new Error("The feature id parameter must be provided."))),h.setFeatureState(a,t.id,n)):this.fire(new c.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(t,n){this._checkLoaded();const o=t.source,a=this.sourceCaches[o];if(a===void 0)return void this.fire(new c.j(new Error(`The source '${o}' does not exist in the map's style.`)));const h=a.getSource().type,g=h==="vector"?t.sourceLayer:void 0;h!=="vector"||g?n&&typeof t.id!="string"&&typeof t.id!="number"?this.fire(new c.j(new Error("A feature id is required to remove its specific state property."))):a.removeFeatureState(g,t.id,n):this.fire(new c.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();const n=t.source,o=t.sourceLayer,a=this.sourceCaches[n];if(a!==void 0)return a.getSource().type!=="vector"||o?(t.id===void 0&&this.fire(new c.j(new Error("The feature id parameter must be provided."))),a.getFeatureState(o,t.id)):void this.fire(new c.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new c.j(new Error(`The source '${n}' does not exist in the map's style.`)))}getTransition(){return c.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const t=c.aG(this.sourceCaches,h=>h.serialize()),n=this._serializeByIds(this._order),o=this.map.getTerrain()||void 0,a=this.stylesheet;return c.aH({version:a.version,name:a.name,metadata:a.metadata,light:a.light,sky:a.sky,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,terrain:o},h=>h!==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=g=>this._layers[g].type==="fill-extrusion",o={},a=[];for(let g=this._order.length-1;g>=0;g--){const y=this._order[g];if(n(y)){o[y]=g;for(const b of t){const w=b[y];if(w)for(const C of w)a.push(C)}}}a.sort((g,y)=>y.intersectionZ-g.intersectionZ);const h=[];for(let g=this._order.length-1;g>=0;g--){const y=this._order[g];if(n(y))for(let b=a.length-1;b>=0;b--){const w=a[b].feature;if(o[w.layer.id]<g)break;h.push(w),a.pop()}else for(const b of t){const w=b[y];if(w)for(const C of w)h.push(C.feature)}}return h}queryRenderedFeatures(t,n,o){n&&n.filter&&this._validate(c.x.filter,"queryRenderedFeatures.filter",n.filter,null,n);const a={};if(n&&n.layers){if(!Array.isArray(n.layers))return this.fire(new c.j(new Error("parameters.layers must be an Array."))),[];for(const y of n.layers){const b=this._layers[y];if(!b)return this.fire(new c.j(new Error(`The layer '${y}' does not exist in the map's style and cannot be queried for features.`))),[];a[b.source]=!0}}const h=[];n.availableImages=this._availableImages;const g=this._serializedAllLayers();for(const y in this.sourceCaches)n.layers&&!a[y]||h.push(jr(this.sourceCaches[y],this._layers,g,t,n,o));return this.placement&&h.push(function(y,b,w,C,E,R,F){const $={},H=R.queryRenderedSymbols(C),U=[];for(const W of Object.keys(H).map(Number))U.push(F[W]);U.sort(Ur);for(const W of U){const Y=W.featureIndex.lookupSymbolFeatures(H[W.bucketInstanceId],b,W.bucketIndex,W.sourceLayerIndex,E.filter,E.layers,E.availableImages,y);for(const j in Y){const te=$[j]=$[j]||[],se=Y[j];se.sort((ce,ye)=>{const we=W.featureSortOrder;if(we){const De=we.indexOf(ce.featureIndex);return we.indexOf(ye.featureIndex)-De}return ye.featureIndex-ce.featureIndex});for(const ce of se)te.push(ce)}}for(const W in $)$[W].forEach(Y=>{const j=Y.feature,te=w[y[W].source].getFeatureState(j.layer["source-layer"],j.id);j.source=j.layer.source,j.layer["source-layer"]&&(j.sourceLayer=j.layer["source-layer"]),j.state=te});return $}(this._layers,g,this.sourceCaches,t,n,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(h)}querySourceFeatures(t,n){n&&n.filter&&this._validate(c.x.filter,"querySourceFeatures.filter",n.filter,null,n);const o=this.sourceCaches[t];return o?function(a,h){const g=a.getRenderableIds().map(w=>a.getTileByID(w)),y=[],b={};for(let w=0;w<g.length;w++){const C=g[w],E=C.tileID.canonical.key;b[E]||(b[E]=!0,C.querySourceFeatures(y,h))}return y}(o,n):[]}getLight(){return this.light.getLight()}setLight(t,n={}){this._checkLoaded();const o=this.light.getLight();let a=!1;for(const g in t)if(!c.aF(t[g],o[g])){a=!0;break}if(!a)return;const h={now:le.now(),transition:c.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(t,n),this.light.updateTransitions(h)}getSky(){var t;return(t=this.stylesheet)===null||t===void 0?void 0:t.sky}setSky(t,n={}){const o=this.sky.getSky();let a=!1;t||o&&(a=!0);for(const g in t)if(!c.aF(t[g],o[g])){a=!0;break}if(!a)return;const h={now:le.now(),transition:c.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=t,this.sky.setSky(t,n),this.sky.updateTransitions(h)}_validate(t,n,o,a,h={}){return(!h||h.validate!==!1)&&us(this,t.call(c.x,c.e({key:n,style:this.serialize(),value:o,styleSpec:c.v},a)))}_remove(t=!0){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null),mr().off(ke,this._rtlPluginLoaded);for(const n in this._layers)this._layers[n].setEventedParent(null);for(const n in this.sourceCaches){const o=this.sourceCaches[n];o.setEventedParent(null),o.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),t&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(t)}_clearSource(t){this.sourceCaches[t].clearTiles()}_reloadSource(t){this.sourceCaches[t].resume(),this.sourceCaches[t].reload()}_updateSources(t){for(const 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,o,a,h=!1){let g=!1,y=!1;const b={};for(const w of this._order){const C=this._layers[w];if(C.type!=="symbol")continue;if(!b[C.source]){const R=this.sourceCaches[C.source];b[C.source]=R.getRenderableIds(!0).map(F=>R.getTileByID(F)).sort((F,$)=>$.tileID.overscaledZ-F.tileID.overscaledZ||(F.tileID.isLessThan($.tileID)?-1:1))}const E=this.crossTileSymbolIndex.addLayer(C,b[C.source],t.center.lng);g=g||E}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((h=h||this._layerOrderChanged||o===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(le.now(),t.zoom))&&(this.pauseablePlacement=new Yt(t,this.map.terrain,this._order,h,n,o,a,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,b),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(le.now()),y=!0),g&&this.pauseablePlacement.placement.setStale()),y||g)for(const w of this._order){const C=this._layers[w];C.type==="symbol"&&this.placement.updateLayerOpacities(C,b[C.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(le.now())}_releaseSymbolFadeTiles(){for(const t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()}getImages(t,n){return c._(this,void 0,void 0,function*(){const o=yield this.imageManager.getImages(n.icons);this._updateTilesForChangedImages();const a=this.sourceCaches[n.source];return a&&a.setDependencies(n.tileID.key,n.type,n.icons),o})}getGlyphs(t,n){return c._(this,void 0,void 0,function*(){const o=yield this.glyphManager.getGlyphs(n.stacks),a=this.sourceCaches[n.source];return a&&a.setDependencies(n.tileID.key,n.type,[""]),o})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(t,n={}){this._checkLoaded(),t&&this._validate(c.x.glyphs,"glyphs",t,null,n)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=t,this.glyphManager.entries={},this.glyphManager.setURL(t))}addSprite(t,n,o={},a){this._checkLoaded();const h=[{id:t,url:n}],g=[...bi(this.stylesheet.sprite),...h];this._validate(c.x.sprite,"sprite",g,null,o)||(this.stylesheet.sprite=g,this._loadSprite(h,!0,a))}removeSprite(t){this._checkLoaded();const n=bi(this.stylesheet.sprite);if(n.find(o=>o.id===t)){if(this._spritesImagesIds[t])for(const o of this._spritesImagesIds[t])this.imageManager.removeImage(o),this._changedImages[o]=!0;n.splice(n.findIndex(o=>o.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("SI",this._availableImages),this.fire(new c.k("data",{dataType:"style"}))}else this.fire(new c.j(new Error(`Sprite "${t}" doesn't exists on this map.`)))}getSprite(){return bi(this.stylesheet.sprite)}setSprite(t,n={},o){this._checkLoaded(),t&&this._validate(c.x.sprite,"sprite",t,null,n)||(this.stylesheet.sprite=t,t?this._loadSprite(t,!0,o):(this._unloadSprite(),o&&o(null)))}}var ds=c.Y([{name:"a_pos",type:"Int16",components:2}]);const Xr={prelude:xt(`#ifdef GL_ES
|
5
|
+
Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(I[1])} }\`.`)];const A=[];return i.layerType==="symbol"&&(m==="text-field"&&l&&!l.glyphs&&A.push(new ke(r,p,'use of "text-field" requires a style "glyphs" property')),m==="text-font"&&ws(yn(p))&&zt(p.type)==="identity"&&A.push(new ke(r,p,'"text-font" does not support identity functions'))),A.concat(s({key:i.key,value:p,valueSpec:S,style:l,styleSpec:d,expressionContext:"property",propertyType:e,propertyKey:m}))}function va(i){return xa(i,"paint")}function ba(i){return xa(i,"layout")}function wa(i){let e=[];const r=i.value,s=i.key,l=i.style,d=i.styleSpec;r.type||r.ref||e.push(new ke(s,r,'either "type" or "ref" is required'));let p=zt(r.type);const m=zt(r.ref);if(r.id){const _=zt(r.id);for(let x=0;x<i.arrayIndex;x++){const S=l.layers[x];zt(S.id)===_&&e.push(new ke(s,r.id,`duplicate layer id "${r.id}", previously used at line ${S.id.__line__}`))}}if("ref"in r){let _;["type","source","source-layer","filter","layout"].forEach(x=>{x in r&&e.push(new ke(s,r[x],`"${x}" is prohibited for ref layers`))}),l.layers.forEach(x=>{zt(x.id)===m&&(_=x)}),_?_.ref?e.push(new ke(s,r.ref,"ref cannot reference another ref layer")):p=zt(_.type):e.push(new ke(s,r.ref,`ref layer "${m}" not found`))}else if(p!=="background")if(r.source){const _=l.sources&&l.sources[r.source],x=_&&zt(_.type);_?x==="vector"&&p==="raster"?e.push(new ke(s,r.source,`layer "${r.id}" requires a raster source`)):x!=="raster-dem"&&p==="hillshade"?e.push(new ke(s,r.source,`layer "${r.id}" requires a raster-dem source`)):x==="raster"&&p!=="raster"?e.push(new ke(s,r.source,`layer "${r.id}" requires a vector source`)):x!=="vector"||r["source-layer"]?x==="raster-dem"&&p!=="hillshade"?e.push(new ke(s,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):p!=="line"||!r.paint||!r.paint["line-gradient"]||x==="geojson"&&_.lineMetrics||e.push(new ke(s,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new ke(s,r,`layer "${r.id}" must specify a "source-layer"`)):e.push(new ke(s,r.source,`source "${r.source}" not found`))}else e.push(new ke(s,r,'missing required property "source"'));return e=e.concat(Ai({key:s,value:r,valueSpec:d.layer,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,objectElementValidators:{"*":()=>[],type:()=>i.validateSpec({key:`${s}.type`,value:r.type,valueSpec:d.layer.type,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,object:r,objectKey:"type"}),filter:Cs,layout:_=>Ai({layer:r,key:_.key,value:_.value,style:_.style,styleSpec:_.styleSpec,validateSpec:_.validateSpec,objectElementValidators:{"*":x=>ba(fr({layerType:p},x))}}),paint:_=>Ai({layer:r,key:_.key,value:_.value,style:_.style,styleSpec:_.styleSpec,validateSpec:_.validateSpec,objectElementValidators:{"*":x=>va(fr({layerType:p},x))}})}})),e}function Lr(i){const e=i.value,r=i.key,s=gt(e);return s!=="string"?[new ke(r,e,`string expected, ${s} found`)]:[]}const Sa={promoteId:function({key:i,value:e}){if(gt(e)==="string")return Lr({key:i,value:e});{const r=[];for(const s in e)r.push(...Lr({key:`${i}.${s}`,value:e[s]}));return r}}};function $l(i){const e=i.value,r=i.key,s=i.styleSpec,l=i.style,d=i.validateSpec;if(!e.type)return[new ke(r,e,'"type" is required')];const p=zt(e.type);let m;switch(p){case"vector":case"raster":return m=Ai({key:r,value:e,valueSpec:s[`source_${p.replace("-","_")}`],style:i.style,styleSpec:s,objectElementValidators:Sa,validateSpec:d}),m;case"raster-dem":return m=function(_){var x;const S=(x=_.sourceName)!==null&&x!==void 0?x:"",I=_.value,A=_.styleSpec,D=A.source_raster_dem,B=_.style;let O=[];const q=gt(I);if(I===void 0)return O;if(q!=="object")return O.push(new ke("source_raster_dem",I,`object expected, ${q} found`)),O;const J=zt(I.encoding)==="custom",ae=["redFactor","greenFactor","blueFactor","baseShift"],Q=_.value.encoding?`"${_.value.encoding}"`:"Default";for(const re in I)!J&&ae.includes(re)?O.push(new ke(re,I[re],`In "${S}": "${re}" is only valid when "encoding" is set to "custom". ${Q} encoding found`)):D[re]?O=O.concat(_.validateSpec({key:re,value:I[re],valueSpec:D[re],validateSpec:_.validateSpec,style:B,styleSpec:A})):O.push(new ke(re,I[re],`unknown property "${re}"`));return O}({sourceName:r,value:e,style:i.style,styleSpec:s,validateSpec:d}),m;case"geojson":if(m=Ai({key:r,value:e,valueSpec:s.source_geojson,style:l,styleSpec:s,validateSpec:d,objectElementValidators:Sa}),e.cluster)for(const _ in e.clusterProperties){const[x,S]=e.clusterProperties[_],I=typeof x=="string"?[x,["accumulated"],["get",_]]:x;m.push(...xn({key:`${r}.${_}.map`,value:S,validateSpec:d,expressionContext:"cluster-map"})),m.push(...xn({key:`${r}.${_}.reduce`,value:I,validateSpec:d,expressionContext:"cluster-reduce"}))}return m;case"video":return Ai({key:r,value:e,valueSpec:s.source_video,style:l,validateSpec:d,styleSpec:s});case"image":return Ai({key:r,value:e,valueSpec:s.source_image,style:l,validateSpec:d,styleSpec:s});case"canvas":return[new ke(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Is({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:l,validateSpec:d,styleSpec:s})}}function Ta(i){const e=i.value,r=i.styleSpec,s=r.light,l=i.style;let d=[];const p=gt(e);if(e===void 0)return d;if(p!=="object")return d=d.concat([new ke("light",e,`object expected, ${p} found`)]),d;for(const m in e){const _=m.match(/^(.*)-transition$/);d=d.concat(_&&s[_[1]]&&s[_[1]].transition?i.validateSpec({key:m,value:e[m],valueSpec:r.transition,validateSpec:i.validateSpec,style:l,styleSpec:r}):s[m]?i.validateSpec({key:m,value:e[m],valueSpec:s[m],validateSpec:i.validateSpec,style:l,styleSpec:r}):[new ke(m,e[m],`unknown property "${m}"`)])}return d}function jl(i){const e=i.value,r=i.styleSpec,s=r.sky,l=i.style,d=gt(e);if(e===void 0)return[];if(d!=="object")return[new ke("sky",e,`object expected, ${d} found`)];let p=[];for(const m in e)p=p.concat(s[m]?i.validateSpec({key:m,value:e[m],valueSpec:s[m],style:l,styleSpec:r}):[new ke(m,e[m],`unknown property "${m}"`)]);return p}function ka(i){const e=i.value,r=i.styleSpec,s=r.terrain,l=i.style;let d=[];const p=gt(e);if(e===void 0)return d;if(p!=="object")return d=d.concat([new ke("terrain",e,`object expected, ${p} found`)]),d;for(const m in e)d=d.concat(s[m]?i.validateSpec({key:m,value:e[m],valueSpec:s[m],validateSpec:i.validateSpec,style:l,styleSpec:r}):[new ke(m,e[m],`unknown property "${m}"`)]);return d}function Ia(i){let e=[];const r=i.value,s=i.key;if(Array.isArray(r)){const l=[],d=[];for(const p in r)r[p].id&&l.includes(r[p].id)&&e.push(new ke(s,r,`all the sprites' ids must be unique, but ${r[p].id} is duplicated`)),l.push(r[p].id),r[p].url&&d.includes(r[p].url)&&e.push(new ke(s,r,`all the sprites' URLs must be unique, but ${r[p].url} is duplicated`)),d.push(r[p].url),e=e.concat(Ai({key:`${s}[${p}]`,value:r[p],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:i.validateSpec}));return e}return Lr({key:s,value:r})}const Ca={"*":()=>[],array:yo,boolean:function(i){const e=i.value,r=i.key,s=gt(e);return s!=="boolean"?[new ke(r,e,`boolean expected, ${s} found`)]:[]},number:ks,color:function(i){const e=i.key,r=i.value,s=gt(r);return s!=="string"?[new ke(e,r,`color expected, ${s} found`)]:bt.parse(String(r))?[]:[new ke(e,r,`color expected, "${r}" found`)]},constants:Nl,enum:Is,filter:Cs,function:ya,layer:wa,object:Ai,source:$l,light:Ta,sky:jl,terrain:ka,projection:function(i){const e=i.value,r=i.styleSpec,s=r.projection,l=i.style,d=gt(e);if(e===void 0)return[];if(d!=="object")return[new ke("projection",e,`object expected, ${d} found`)];let p=[];for(const m in e)p=p.concat(s[m]?i.validateSpec({key:m,value:e[m],valueSpec:s[m],style:l,styleSpec:r}):[new ke(m,e[m],`unknown property "${m}"`)]);return p},string:Lr,formatted:function(i){return Lr(i).length===0?[]:xn(i)},resolvedImage:function(i){return Lr(i).length===0?[]:xn(i)},padding:function(i){const e=i.key,r=i.value;if(gt(r)==="array"){if(r.length<1||r.length>4)return[new ke(e,r,`padding requires 1 to 4 values; ${r.length} values found`)];const s={type:"number"};let l=[];for(let d=0;d<r.length;d++)l=l.concat(i.validateSpec({key:`${e}[${d}]`,value:r[d],validateSpec:i.validateSpec,valueSpec:s}));return l}return ks({key:e,value:r,valueSpec:{}})},variableAnchorOffsetCollection:function(i){const e=i.key,r=i.value,s=gt(r),l=i.styleSpec;if(s!=="array"||r.length<1||r.length%2!=0)return[new ke(e,r,"variableAnchorOffsetCollection requires a non-empty array of even length")];let d=[];for(let p=0;p<r.length;p+=2)d=d.concat(Is({key:`${e}[${p}]`,value:r[p],valueSpec:l.layout_symbol["text-anchor"]})),d=d.concat(yo({key:`${e}[${p+1}]`,value:r[p+1],valueSpec:{length:2,value:"number"},validateSpec:i.validateSpec,style:i.style,styleSpec:l}));return d},sprite:Ia};function Ps(i){const e=i.value,r=i.valueSpec,s=i.styleSpec;return i.validateSpec=Ps,r.expression&&ws(zt(e))?ya(i):r.expression&&Ss(yn(e))?xn(i):r.type&&Ca[r.type]?Ca[r.type](i):Ai(fr({},i,{valueSpec:r.type?s[r.type]:r}))}function Ul(i){const e=i.value,r=i.key,s=Lr(i);return s.length||(e.indexOf("{fontstack}")===-1&&s.push(new ke(r,e,'"glyphs" url must include a "{fontstack}" token')),e.indexOf("{range}")===-1&&s.push(new ke(r,e,'"glyphs" url must include a "{range}" token'))),s}function Ji(i,e=ue){let r=[];return r=r.concat(Ps({key:"",value:i,valueSpec:e.$root,styleSpec:e,style:i,validateSpec:Ps,objectElementValidators:{glyphs:Ul,"*":()=>[]}})),i.constants&&(r=r.concat(Nl({key:"constants",value:i.constants,style:i,styleSpec:e,validateSpec:Ps}))),Ea(r)}function ir(i){return function(e){return i({...e,validateSpec:Ps})}}function Ea(i){return[].concat(i).sort((e,r)=>e.line-r.line)}function rr(i){return function(...e){return Ea(i.apply(this,e))}}Ji.source=rr(ir($l)),Ji.sprite=rr(ir(Ia)),Ji.glyphs=rr(ir(Ul)),Ji.light=rr(ir(Ta)),Ji.sky=rr(ir(jl)),Ji.terrain=rr(ir(ka)),Ji.layer=rr(ir(wa)),Ji.filter=rr(ir(Cs)),Ji.paintProperty=rr(ir(va)),Ji.layoutProperty=rr(ir(ba));const Rr=Ji,th=Rr.light,Pa=Rr.sky,ih=Rr.paintProperty,rh=Rr.layoutProperty;function Aa(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 $n{constructor(e,r,s){const l=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const p=new Int32Array(this.arrayBuffer);e=p[0],this.d=(r=p[1])+2*(s=p[2]);for(let _=0;_<this.d*this.d;_++){const x=p[3+_],S=p[3+_+1];l.push(x===S?null:p.subarray(x,S))}const m=p[3+l.length+1];this.keys=p.subarray(p[3+l.length],m),this.bboxes=p.subarray(m),this.insert=this._insertReadonly}else{this.d=r+2*s;for(let p=0;p<this.d*this.d;p++)l.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=e,this.padding=s,this.scale=r/e,this.uid=0;const d=s/r*e;this.min=-d,this.max=e+d}insert(e,r,s,l,d){this._forEachCell(r,s,l,d,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(d)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,r,s,l,d,p){this.cells[d].push(p)}query(e,r,s,l,d){const p=this.min,m=this.max;if(e<=p&&r<=p&&m<=s&&m<=l&&!d)return Array.prototype.slice.call(this.keys);{const _=[];return this._forEachCell(e,r,s,l,this._queryCell,_,{},d),_}}_queryCell(e,r,s,l,d,p,m,_){const x=this.cells[d];if(x!==null){const S=this.keys,I=this.bboxes;for(let A=0;A<x.length;A++){const D=x[A];if(m[D]===void 0){const B=4*D;(_?_(I[B+0],I[B+1],I[B+2],I[B+3]):e<=I[B+2]&&r<=I[B+3]&&s>=I[B+0]&&l>=I[B+1])?(m[D]=!0,p.push(S[D])):m[D]=!1}}}}_forEachCell(e,r,s,l,d,p,m,_){const x=this._convertToCellCoord(e),S=this._convertToCellCoord(r),I=this._convertToCellCoord(s),A=this._convertToCellCoord(l);for(let D=x;D<=I;D++)for(let B=S;B<=A;B++){const O=this.d*B+D;if((!_||_(this._convertFromCellCoord(D),this._convertFromCellCoord(B),this._convertFromCellCoord(D+1),this._convertFromCellCoord(B+1)))&&d.call(this,e,r,s,l,O,p,m,_))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 p=0;p<this.cells.length;p++)s+=this.cells[p].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 d=r;for(let p=0;p<e.length;p++){const m=e[p];l[3+p]=d,l.set(m,d),d+=m.length}return l[3+e.length]=d,l.set(this.keys,d),d+=this.keys.length,l[3+e.length+1]=d,l.set(this.bboxes,d),d+=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 $n(e.buffer)}}const xr={};function Fe(i,e,r={}){if(xr[i])throw new Error(`${i} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:i,writeable:!1}),xr[i]={klass:e,omit:r.omit||[],shallow:r.shallow||[]}}Fe("Object",Object),Fe("TransferableGridIndex",$n),Fe("Color",bt),Fe("Error",Error),Fe("AJAXError",Oi),Fe("ResolvedImage",ui),Fe("StylePropertyFunction",fo),Fe("StyleExpression",po,{omit:["_evaluator"]}),Fe("ZoomDependentExpression",da),Fe("ZoomConstantExpression",ua),Fe("CompoundExpression",qi,{omit:["_evaluate"]});for(const i in pn)pn[i]._classRegistryKey||Fe(`Expression_${i}`,pn[i]);function ql(i){return i&&typeof ArrayBuffer<"u"&&(i instanceof ArrayBuffer||i.constructor&&i.constructor.name==="ArrayBuffer")}function Ma(i){return i.$name||i.constructor._classRegistryKey}function Zl(i){return!function(e){if(e===null||typeof e!="object")return!1;const r=Ma(e);return!(!r||r==="Object")}(i)&&(i==null||typeof i=="boolean"||typeof i=="number"||typeof i=="string"||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp||i instanceof Blob||i instanceof Error||ql(i)||dr(i)||ArrayBuffer.isView(i)||i instanceof ImageData)}function As(i,e){if(Zl(i))return(ql(i)||dr(i))&&e&&e.push(i),ArrayBuffer.isView(i)&&e&&e.push(i.buffer),i instanceof ImageData&&e&&e.push(i.data.buffer),i;if(Array.isArray(i)){const d=[];for(const p of i)d.push(As(p,e));return d}if(typeof i!="object")throw new Error("can't serialize object of type "+typeof i);const r=Ma(i);if(!r)throw new Error(`can't serialize object of unregistered class ${i.constructor.name}`);if(!xr[r])throw new Error(`${r} is not registered.`);const{klass:s}=xr[r],l=s.serialize?s.serialize(i,e):{};if(s.serialize){if(e&&l===e[e.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const d in i){if(!i.hasOwnProperty(d)||xr[r].omit.indexOf(d)>=0)continue;const p=i[d];l[d]=xr[r].shallow.indexOf(d)>=0?p:As(p,e)}i instanceof Error&&(l.message=i.message)}if(l.$name)throw new Error("$name property is reserved for worker serialization logic.");return r!=="Object"&&(l.$name=r),l}function vr(i){if(Zl(i))return i;if(Array.isArray(i))return i.map(vr);if(typeof i!="object")throw new Error("can't deserialize object of type "+typeof i);const e=Ma(i)||"Object";if(!xr[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:r}=xr[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 d=i[l];s[l]=xr[e].shallow.indexOf(l)>=0?d:vr(d)}return s}class Gl{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 ze={"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 za(i){for(const e of i)if(Da(e.charCodeAt(0)))return!0;return!1}function nh(i){for(const e of i)if(!Hl(e.charCodeAt(0)))return!1;return!0}function Hl(i){return!(ze.Arabic(i)||ze["Arabic Supplement"](i)||ze["Arabic Extended-A"](i)||ze["Arabic Presentation Forms-A"](i)||ze["Arabic Presentation Forms-B"](i))}function Da(i){return!(i!==746&&i!==747&&(i<4352||!(ze["Bopomofo Extended"](i)||ze.Bopomofo(i)||ze["CJK Compatibility Forms"](i)&&!(i>=65097&&i<=65103)||ze["CJK Compatibility Ideographs"](i)||ze["CJK Compatibility"](i)||ze["CJK Radicals Supplement"](i)||ze["CJK Strokes"](i)||!(!ze["CJK Symbols and Punctuation"](i)||i>=12296&&i<=12305||i>=12308&&i<=12319||i===12336)||ze["CJK Unified Ideographs Extension A"](i)||ze["CJK Unified Ideographs"](i)||ze["Enclosed CJK Letters and Months"](i)||ze["Hangul Compatibility Jamo"](i)||ze["Hangul Jamo Extended-A"](i)||ze["Hangul Jamo Extended-B"](i)||ze["Hangul Jamo"](i)||ze["Hangul Syllables"](i)||ze.Hiragana(i)||ze["Ideographic Description Characters"](i)||ze.Kanbun(i)||ze["Kangxi Radicals"](i)||ze["Katakana Phonetic Extensions"](i)||ze.Katakana(i)&&i!==12540||!(!ze["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)||!(!ze["Small Form Variants"](i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||ze["Unified Canadian Aboriginal Syllabics"](i)||ze["Unified Canadian Aboriginal Syllabics Extended"](i)||ze["Vertical Forms"](i)||ze["Yijing Hexagram Symbols"](i)||ze["Yi Syllables"](i)||ze["Yi Radicals"](i))))}function Xl(i){return!(Da(i)||function(e){return!!(ze["Latin-1 Supplement"](e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||ze["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)||ze["Letterlike Symbols"](e)||ze["Number Forms"](e)||ze["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)||ze["Control Pictures"](e)&&e!==9251||ze["Optical Character Recognition"](e)||ze["Enclosed Alphanumerics"](e)||ze["Geometric Shapes"](e)||ze["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||ze["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||ze["CJK Symbols and Punctuation"](e)||ze.Katakana(e)||ze["Private Use Area"](e)||ze["CJK Compatibility Forms"](e)||ze["Small Form Variants"](e)||ze["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 Kr(i){return i>=1424&&i<=2303||ze["Arabic Presentation Forms-A"](i)||ze["Arabic Presentation Forms-B"](i)}function Wl(i,e){return!(!e&&Kr(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||ze.Khmer(i))}function La(i){for(const e of i)if(Kr(e.charCodeAt(0)))return!0;return!1}const Yr=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null}setState(i){this.pluginStatus=i.pluginStatus,this.pluginURL=i.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(i){this.applyArabicShaping=i.applyArabicShaping,this.processBidirectionalText=i.processBidirectionalText,this.processStyledBidirectionalText=i.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class 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 Gl,this.transition={})}isSupportedScript(e){return function(r,s){for(const l of r)if(!Wl(l.charCodeAt(0),s))return!1;return!0}(e,Yr.getRTLTextPluginStatus()==="loaded")}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 xo{constructor(e,r){this.property=e,this.value=r,this.expression=function(s,l){if(ws(s))return new fo(s,l);if(Ss(s)){const d=Vl(s,l);if(d.result==="error")throw new Error(d.value.map(p=>`${p.key}: ${p.message}`).join(", "));return d.value}{let d=s;return l.type==="color"&&typeof s=="string"?d=bt.parse(s):l.type!=="padding"||typeof s!="number"&&!Array.isArray(s)?l.type==="variableAnchorOffsetCollection"&&Array.isArray(s)&&(d=$i.parse(s)):d=Ni.parse(s),{kind:"constant",evaluate:()=>d}}}(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 jn{constructor(e){this.property=e,this.value=new xo(e,void 0)}transitioned(e,r){return new Jl(this.property,this.value,r,$t({},e.transition,this.transition),e.now)}untransitioned(){return new Jl(this.property,this.value,null,{},0)}}class Un{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return St(this._values[e].value.value)}setValue(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new jn(this._values[e].property)),this._values[e].value=new xo(this._values[e].property,r===null?void 0:St(r))}getTransition(e){return St(this._values[e].transition)}setTransition(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new jn(this._values[e].property)),this._values[e].transition=St(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 Ra(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 Ra(this._properties);for(const r of Object.keys(this._values))e._values[r]=this._values[r].untransitioned();return e}}class Jl{constructor(e,r,s,l,d){this.property=e,this.value=r,this.begin=d+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,d=this.value.possiblyEvaluate(e,r,s),p=this.prior;if(p){if(l>this.end)return this.prior=null,d;if(this.value.isDataDriven())return this.prior=null,d;if(l<this.begin)return p.possiblyEvaluate(e,r,s);{const m=(l-this.begin)/(this.end-this.begin);return this.property.interpolate(p.possiblyEvaluate(e,r,s),d,function(_){if(_<=0)return 0;if(_>=1)return 1;const x=_*_,S=x*_;return 4*(_<.5?S:3*(_-x)+S-.75)}(m))}}return d}}class Ra{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,r,s){const l=new vo(this._properties);for(const d of Object.keys(this._values))l._values[d]=this._values[d].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 Ms{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}hasValue(e){return this._values[e].value!==void 0}getValue(e){return St(this._values[e].value)}setValue(e,r){this._values[e]=new xo(this._values[e].property,r===null?void 0:St(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 vo(this._properties);for(const d of Object.keys(this._values))l._values[d]=this._values[d].possiblyEvaluate(e,r,s);return l}}class br{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 vo{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class qe{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=ji[this.specification.type];return l?l(e,r,s):e}}class Je{constructor(e,r){this.specification=e,this.overrides=r}possiblyEvaluate(e,r,s,l){return new br(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 br(this,{kind:"constant",value:void 0},e.parameters);const l=ji[this.specification.type];if(l){const d=l(e.value.value,r.value.value,s);return new br(this,{kind:"constant",value:d},e.parameters)}return e}evaluate(e,r,s,l,d,p){return e.kind==="constant"?e.value:e.evaluate(r,s,l,d,p)}}class u extends Je{possiblyEvaluate(e,r,s,l){if(e.value===void 0)return new br(this,{kind:"constant",value:void 0},r);if(e.expression.kind==="constant"){const d=e.expression.evaluate(r,null,{},s,l),p=e.property.specification.type==="resolvedImage"&&typeof d!="string"?d.name:d,m=this._calculate(p,p,p,r);return new br(this,{kind:"constant",value:m},r)}if(e.expression.kind==="camera"){const d=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 br(this,{kind:"constant",value:d},r)}return new br(this,e.expression,r)}evaluate(e,r,s,l,d,p){if(e.kind==="source"){const m=e.evaluate(r,s,l,d,p);return this._calculate(m,m,m,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 t{constructor(e){this.specification=e}possiblyEvaluate(e,r,s,l){if(e.value!==void 0){if(e.expression.kind==="constant"){const d=e.expression.evaluate(r,null,{},s,l);return this._calculate(d,d,d,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 n{constructor(e){this.specification=e}possiblyEvaluate(e,r,s,l){return!!e.expression.evaluate(r,null,{},s,l)}interpolate(){return!1}}class o{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 xo(s,void 0),d=this.defaultTransitionablePropertyValues[r]=new jn(s);this.defaultTransitioningPropertyValues[r]=d.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=l.possiblyEvaluate({})}}}Fe("DataDrivenProperty",Je),Fe("DataConstantProperty",qe),Fe("CrossFadedDataDrivenProperty",u),Fe("CrossFadedProperty",t),Fe("ColorRampProperty",n);const a="-transition";class h extends Mn{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 Ms(r.layout)),r.paint)){this._transitionablePaint=new Un(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 vo(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(rh,`layers.${this.id}.layout.${e}`,e,r,s)||(e!=="visibility"?this._unevaluatedLayout.setValue(e,r):this.visibility=r)}getPaintProperty(e){return e.endsWith(a)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,r,s={}){if(r!=null&&this._validate(ih,`layers.${this.id}.paint.${e}`,e,r,s))return!1;if(e.endsWith(a))return this._transitionablePaint.setTransition(e.slice(0,-11),r||void 0),!1;{const l=this._transitionablePaint._values[e],d=l.property.specification["property-type"]==="cross-faded-data-driven",p=l.value.isDataDriven(),m=l.value;this._transitionablePaint.setValue(e,r),this._handleSpecialPaintPropertyUpdate(e);const _=this._transitionablePaint._values[e].value;return _.isDataDriven()||p||d||this._handleOverridablePaintPropertyUpdate(e,m,_)}}_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),Nr(e,(r,s)=>!(r===void 0||s==="layout"&&!Object.keys(r).length||s==="paint"&&!Object.keys(r).length))}_validate(e,r,s,l,d={}){return(!d||d.validate!==!1)&&Aa(this,e.call(Rr,{key:r,layerType:this.type,objectKey:s,value:l,styleSpec:ue,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 br&&mn(r.property.specification)&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}}const g={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class y{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 b{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 w(i,e=1){let r=0,s=0;return{members:i.map(l=>{const d=g[l.type].BYTES_PER_ELEMENT,p=r=C(r,Math.max(e,d)),m=l.components||1;return s=Math.max(s,d),r+=d*m,{name:l.name,type:l.type,components:m,offset:p}}),size:C(r,Math.max(s,e)),alignment:e}}function C(i,e){return Math.ceil(i/e)*e}class E extends b{_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}}E.prototype.bytesPerElement=4,Fe("StructArrayLayout2i4",E);class R extends b{_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 d=3*e;return this.int16[d+0]=r,this.int16[d+1]=s,this.int16[d+2]=l,e}}R.prototype.bytesPerElement=6,Fe("StructArrayLayout3i6",R);class F extends b{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l){const d=this.length;return this.resize(d+1),this.emplace(d,e,r,s,l)}emplace(e,r,s,l,d){const p=4*e;return this.int16[p+0]=r,this.int16[p+1]=s,this.int16[p+2]=l,this.int16[p+3]=d,e}}F.prototype.bytesPerElement=8,Fe("StructArrayLayout4i8",F);class $ extends b{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,d,p){const m=this.length;return this.resize(m+1),this.emplace(m,e,r,s,l,d,p)}emplace(e,r,s,l,d,p,m){const _=6*e;return this.int16[_+0]=r,this.int16[_+1]=s,this.int16[_+2]=l,this.int16[_+3]=d,this.int16[_+4]=p,this.int16[_+5]=m,e}}$.prototype.bytesPerElement=12,Fe("StructArrayLayout2i4i12",$);class H extends b{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,d,p){const m=this.length;return this.resize(m+1),this.emplace(m,e,r,s,l,d,p)}emplace(e,r,s,l,d,p,m){const _=4*e,x=8*e;return this.int16[_+0]=r,this.int16[_+1]=s,this.uint8[x+4]=l,this.uint8[x+5]=d,this.uint8[x+6]=p,this.uint8[x+7]=m,e}}H.prototype.bytesPerElement=8,Fe("StructArrayLayout2i4ub8",H);class U extends b{_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}}U.prototype.bytesPerElement=8,Fe("StructArrayLayout2f8",U);class W extends b{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,d,p,m,_,x,S){const I=this.length;return this.resize(I+1),this.emplace(I,e,r,s,l,d,p,m,_,x,S)}emplace(e,r,s,l,d,p,m,_,x,S,I){const A=10*e;return this.uint16[A+0]=r,this.uint16[A+1]=s,this.uint16[A+2]=l,this.uint16[A+3]=d,this.uint16[A+4]=p,this.uint16[A+5]=m,this.uint16[A+6]=_,this.uint16[A+7]=x,this.uint16[A+8]=S,this.uint16[A+9]=I,e}}W.prototype.bytesPerElement=20,Fe("StructArrayLayout10ui20",W);class Y extends b{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,d,p,m,_,x,S,I,A){const D=this.length;return this.resize(D+1),this.emplace(D,e,r,s,l,d,p,m,_,x,S,I,A)}emplace(e,r,s,l,d,p,m,_,x,S,I,A,D){const B=12*e;return this.int16[B+0]=r,this.int16[B+1]=s,this.int16[B+2]=l,this.int16[B+3]=d,this.uint16[B+4]=p,this.uint16[B+5]=m,this.uint16[B+6]=_,this.uint16[B+7]=x,this.int16[B+8]=S,this.int16[B+9]=I,this.int16[B+10]=A,this.int16[B+11]=D,e}}Y.prototype.bytesPerElement=24,Fe("StructArrayLayout4i4ui4i24",Y);class j extends b{_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 d=3*e;return this.float32[d+0]=r,this.float32[d+1]=s,this.float32[d+2]=l,e}}j.prototype.bytesPerElement=12,Fe("StructArrayLayout3f12",j);class te extends b{_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}}te.prototype.bytesPerElement=4,Fe("StructArrayLayout1ul4",te);class se extends b{_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,d,p,m,_,x){const S=this.length;return this.resize(S+1),this.emplace(S,e,r,s,l,d,p,m,_,x)}emplace(e,r,s,l,d,p,m,_,x,S){const I=10*e,A=5*e;return this.int16[I+0]=r,this.int16[I+1]=s,this.int16[I+2]=l,this.int16[I+3]=d,this.int16[I+4]=p,this.int16[I+5]=m,this.uint32[A+3]=_,this.uint16[I+8]=x,this.uint16[I+9]=S,e}}se.prototype.bytesPerElement=20,Fe("StructArrayLayout6i1ul2ui20",se);class ce extends b{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,d,p){const m=this.length;return this.resize(m+1),this.emplace(m,e,r,s,l,d,p)}emplace(e,r,s,l,d,p,m){const _=6*e;return this.int16[_+0]=r,this.int16[_+1]=s,this.int16[_+2]=l,this.int16[_+3]=d,this.int16[_+4]=p,this.int16[_+5]=m,e}}ce.prototype.bytesPerElement=12,Fe("StructArrayLayout2i2i2i12",ce);class ye extends b{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,d){const p=this.length;return this.resize(p+1),this.emplace(p,e,r,s,l,d)}emplace(e,r,s,l,d,p){const m=4*e,_=8*e;return this.float32[m+0]=r,this.float32[m+1]=s,this.float32[m+2]=l,this.int16[_+6]=d,this.int16[_+7]=p,e}}ye.prototype.bytesPerElement=16,Fe("StructArrayLayout2f1f2i16",ye);class we extends b{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,d,p){const m=this.length;return this.resize(m+1),this.emplace(m,e,r,s,l,d,p)}emplace(e,r,s,l,d,p,m){const _=16*e,x=4*e,S=8*e;return this.uint8[_+0]=r,this.uint8[_+1]=s,this.float32[x+1]=l,this.float32[x+2]=d,this.int16[S+6]=p,this.int16[S+7]=m,e}}we.prototype.bytesPerElement=16,Fe("StructArrayLayout2ub2f2i16",we);class De extends b{_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 d=3*e;return this.uint16[d+0]=r,this.uint16[d+1]=s,this.uint16[d+2]=l,e}}De.prototype.bytesPerElement=6,Fe("StructArrayLayout3ui6",De);class Re extends b{_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,d,p,m,_,x,S,I,A,D,B,O,q,J){const ae=this.length;return this.resize(ae+1),this.emplace(ae,e,r,s,l,d,p,m,_,x,S,I,A,D,B,O,q,J)}emplace(e,r,s,l,d,p,m,_,x,S,I,A,D,B,O,q,J,ae){const Q=24*e,re=12*e,de=48*e;return this.int16[Q+0]=r,this.int16[Q+1]=s,this.uint16[Q+2]=l,this.uint16[Q+3]=d,this.uint32[re+2]=p,this.uint32[re+3]=m,this.uint32[re+4]=_,this.uint16[Q+10]=x,this.uint16[Q+11]=S,this.uint16[Q+12]=I,this.float32[re+7]=A,this.float32[re+8]=D,this.uint8[de+36]=B,this.uint8[de+37]=O,this.uint8[de+38]=q,this.uint32[re+10]=J,this.int16[Q+22]=ae,e}}Re.prototype.bytesPerElement=48,Fe("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Re);class Se extends b{_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,d,p,m,_,x,S,I,A,D,B,O,q,J,ae,Q,re,de,be,Le,We,Me,Pe,Ue,Ve){const Be=this.length;return this.resize(Be+1),this.emplace(Be,e,r,s,l,d,p,m,_,x,S,I,A,D,B,O,q,J,ae,Q,re,de,be,Le,We,Me,Pe,Ue,Ve)}emplace(e,r,s,l,d,p,m,_,x,S,I,A,D,B,O,q,J,ae,Q,re,de,be,Le,We,Me,Pe,Ue,Ve,Be){const _e=32*e,Ze=16*e;return this.int16[_e+0]=r,this.int16[_e+1]=s,this.int16[_e+2]=l,this.int16[_e+3]=d,this.int16[_e+4]=p,this.int16[_e+5]=m,this.int16[_e+6]=_,this.int16[_e+7]=x,this.uint16[_e+8]=S,this.uint16[_e+9]=I,this.uint16[_e+10]=A,this.uint16[_e+11]=D,this.uint16[_e+12]=B,this.uint16[_e+13]=O,this.uint16[_e+14]=q,this.uint16[_e+15]=J,this.uint16[_e+16]=ae,this.uint16[_e+17]=Q,this.uint16[_e+18]=re,this.uint16[_e+19]=de,this.uint16[_e+20]=be,this.uint16[_e+21]=Le,this.uint16[_e+22]=We,this.uint32[Ze+12]=Me,this.float32[Ze+13]=Pe,this.float32[Ze+14]=Ue,this.uint16[_e+30]=Ve,this.uint16[_e+31]=Be,e}}Se.prototype.bytesPerElement=64,Fe("StructArrayLayout8i15ui1ul2f2ui64",Se);class Te extends b{_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}}Te.prototype.bytesPerElement=4,Fe("StructArrayLayout1f4",Te);class Ne extends b{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(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 d=3*e;return this.uint16[6*e+0]=r,this.float32[d+1]=s,this.float32[d+2]=l,e}}Ne.prototype.bytesPerElement=12,Fe("StructArrayLayout1ui2f12",Ne);class tt extends b{_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 d=4*e;return this.uint32[2*e+0]=r,this.uint16[d+2]=s,this.uint16[d+3]=l,e}}tt.prototype.bytesPerElement=8,Fe("StructArrayLayout1ul2ui8",tt);class Ce extends b{_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}}Ce.prototype.bytesPerElement=4,Fe("StructArrayLayout2ui4",Ce);class Ae extends b{_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}}Ae.prototype.bytesPerElement=2,Fe("StructArrayLayout1ui2",Ae);class Qe extends b{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,s,l){const d=this.length;return this.resize(d+1),this.emplace(d,e,r,s,l)}emplace(e,r,s,l,d){const p=4*e;return this.float32[p+0]=r,this.float32[p+1]=s,this.float32[p+2]=l,this.float32[p+3]=d,e}}Qe.prototype.bytesPerElement=16,Fe("StructArrayLayout4f16",Qe);class Dt extends y{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 le(this.anchorPointX,this.anchorPointY)}}Dt.prototype.size=20;class ot extends se{get(e){return new Dt(this,e)}}Fe("CollisionBoxArray",ot);class dt extends y{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]}}dt.prototype.size=48;class Lt extends Re{get(e){return new dt(this,e)}}Fe("PlacedSymbolArray",Lt);class di extends y{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 collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}di.prototype.size=64;class nr extends Se{get(e){return new di(this,e)}}Fe("SymbolInstanceArray",nr);class Rt extends Te{getoffsetX(e){return this.float32[1*e+0]}}Fe("GlyphOffsetArray",Rt);class Mi extends R{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}Fe("SymbolLineVertexArray",Mi);class ki extends y{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}}ki.prototype.size=12;class pi extends Ne{get(e){return new ki(this,e)}}Fe("TextAnchorOffsetArray",pi);class fi extends y{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]}}fi.prototype.size=8;class sr extends tt{get(e){return new fi(this,e)}}Fe("FeatureIndexArray",sr);class vn extends E{}class bo extends E{}class qn extends E{}class bn extends ${}class wo extends H{}class Ba extends U{}class oi extends W{}class or extends Y{}class Qr extends j{}class Zn extends te{}class mi extends ce{}class gi extends we{}class ri extends De{}class Nt extends Ce{}const Gn=w([{name:"a_pos",components:2,type:"Int16"}],4),{members:Fa}=Gn;class ti{constructor(e=[]){this.segments=e}prepareSegment(e,r,s,l){let d=this.segments[this.segments.length-1];return e>ti.MAX_VERTEX_ARRAY_LENGTH&&li(`Max vertices per segment is ${ti.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!d||d.vertexLength+e>ti.MAX_VERTEX_ARRAY_LENGTH||d.sortKey!==l)&&(d={vertexOffset:r.length,primitiveOffset:s.length,vertexLength:0,primitiveLength:0},l!==void 0&&(d.sortKey=l),this.segments.push(d)),d}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 ti([{vertexOffset:e,primitiveOffset:r,vertexLength:s,primitiveLength:l,vaos:{},sortKey:0}])}}function Kl(i,e){return 256*(i=wt(Math.floor(i),0,255))+wt(Math.floor(e),0,255)}ti.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Fe("SegmentVector",ti);const So=w([{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 To={exports:{}},en={exports:{}};en.exports=function(i,e){var r,s,l,d,p,m,_,x;for(s=i.length-(r=3&i.length),l=e,p=3432918353,m=461845907,x=0;x<s;)_=255&i.charCodeAt(x)|(255&i.charCodeAt(++x))<<8|(255&i.charCodeAt(++x))<<16|(255&i.charCodeAt(++x))<<24,++x,l=27492+(65535&(d=5*(65535&(l=(l^=_=(65535&(_=(_=(65535&_)*p+(((_>>>16)*p&65535)<<16)&4294967295)<<15|_>>>17))*m+(((_>>>16)*m&65535)<<16)&4294967295)<<13|l>>>19))+((5*(l>>>16)&65535)<<16)&4294967295))+((58964+(d>>>16)&65535)<<16);switch(_=0,r){case 3:_^=(255&i.charCodeAt(x+2))<<16;case 2:_^=(255&i.charCodeAt(x+1))<<8;case 1:l^=_=(65535&(_=(_=(65535&(_^=255&i.charCodeAt(x)))*p+(((_>>>16)*p&65535)<<16)&4294967295)<<15|_>>>17))*m+(((_>>>16)*m&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 Yl=en.exports,Oa={exports:{}};Oa.exports=function(i,e){for(var r,s=i.length,l=e^s,d=0;s>=4;)r=1540483477*(65535&(r=255&i.charCodeAt(d)|(255&i.charCodeAt(++d))<<8|(255&i.charCodeAt(++d))<<16|(255&i.charCodeAt(++d))<<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,++d;switch(s){case 3:l^=(255&i.charCodeAt(d+2))<<16;case 2:l^=(255&i.charCodeAt(d+1))<<8;case 1:l=1540483477*(65535&(l^=255&i.charCodeAt(d)))+((1540483477*(l>>>16)&65535)<<16)}return l=1540483477*(65535&(l^=l>>>13))+((1540483477*(l>>>16)&65535)<<16),(l^=l>>>15)>>>0};var Va=Yl,Na=Oa.exports;To.exports=Va,To.exports.murmur3=Va,To.exports.murmur2=Na;var ko=fe(To.exports);class Hn{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,s,l){this.ids.push(Hu(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=Hu(e);let s=0,l=this.ids.length-1;for(;s<l;){const p=s+l>>1;this.ids[p]>=r?l=p:s=p+1}const d=[];for(;this.ids[s]===r;)d.push({index:this.positions[3*s],start:this.positions[3*s+1],end:this.positions[3*s+2]}),s++;return d}static serialize(e,r){const s=new Float64Array(e.ids),l=new Uint32Array(e.positions);return sh(s,l,0,s.length-1),r&&r.push(s.buffer,l.buffer),{ids:s,positions:l}}static deserialize(e){const r=new Hn;return r.ids=e.ids,r.positions=e.positions,r.indexed=!0,r}}function Hu(i){const e=+i;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:ko(String(i))}function sh(i,e,r,s){for(;r<s;){const l=i[r+s>>1];let d=r-1,p=s+1;for(;;){do d++;while(i[d]<l);do p--;while(i[p]>l);if(d>=p)break;Ql(i,d,p),Ql(e,3*d,3*p),Ql(e,3*d+1,3*p+1),Ql(e,3*d+2,3*p+2)}p-r<s-p?(sh(i,e,r,p),r=p+1):(sh(i,e,p+1,s),s=p)}}function Ql(i,e,r){const s=i[e];i[e]=i[r],i[r]=s}Fe("FeaturePositionMap",Hn);class zs{constructor(e,r){this.gl=e.gl,this.location=r}}class ec extends zs{constructor(e,r){super(e,r),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}}class Xu extends zs{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 Wu extends zs{constructor(e,r){super(e,r),this.current=bt.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 T_=new Float32Array(16);function oh(i){return[Kl(255*i.r,255*i.g),Kl(255*i.b,255*i.a)]}class $a{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 Wu(e,r):new ec(e,r)}}class Io{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 d=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;d&&e.set(d)}getBinding(e,r,s){return s.substr(0,9)==="u_pattern"?new Xu(e,r):new ec(e,r)}}class wn{constructor(e,r,s,l){this.expression=e,this.type=s,this.maxValue=0,this.paintVertexAttributes=r.map(d=>({name:`a_${d}`,type:"Float32",components:s==="color"?2:1,offset:0})),this.paintVertexArray=new l}populatePaintArray(e,r,s,l,d){const p=this.paintVertexArray.length,m=this.expression.evaluate(new Pt(0),r,{},l,[],d);this.paintVertexArray.resize(e),this._setPaintValue(p,e,m)}updatePaintArray(e,r,s,l){const d=this.expression.evaluate({zoom:0},s,l);this._setPaintValue(e,r,d)}_setPaintValue(e,r,s){if(this.type==="color"){const l=oh(s);for(let d=e;d<r;d++)this.paintVertexArray.emplace(d,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 Br{constructor(e,r,s,l,d,p){this.expression=e,this.uniformNames=r.map(m=>`u_${m}_t`),this.type=s,this.useIntegerZoom=l,this.zoom=d,this.maxValue=0,this.paintVertexAttributes=r.map(m=>({name:`a_${m}`,type:"Float32",components:s==="color"?4:2,offset:0})),this.paintVertexArray=new p}populatePaintArray(e,r,s,l,d){const p=this.expression.evaluate(new Pt(this.zoom),r,{},l,[],d),m=this.expression.evaluate(new Pt(this.zoom+1),r,{},l,[],d),_=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(_,e,p,m)}updatePaintArray(e,r,s,l){const d=this.expression.evaluate({zoom:this.zoom},s,l),p=this.expression.evaluate({zoom:this.zoom+1},s,l);this._setPaintValue(e,r,d,p)}_setPaintValue(e,r,s,l){if(this.type==="color"){const d=oh(s),p=oh(l);for(let m=e;m<r;m++)this.paintVertexArray.emplace(m,d[0],d[1],p[0],p[1])}else{for(let d=e;d<r;d++)this.paintVertexArray.emplace(d,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=wt(this.expression.interpolationFactor(s,this.zoom,this.zoom+1),0,1);e.set(l)}getBinding(e,r,s){return new ec(e,r)}}class Xn{constructor(e,r,s,l,d,p){this.expression=e,this.type=r,this.useIntegerZoom=s,this.zoom=l,this.layerId=p,this.zoomInPaintVertexArray=new d,this.zoomOutPaintVertexArray=new d}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,d){this._setPaintValues(e,r,s.patterns&&s.patterns[this.layerId],d)}_setPaintValues(e,r,s,l){if(!l||!s)return;const{min:d,mid:p,max:m}=s,_=l[d],x=l[p],S=l[m];if(_&&x&&S)for(let I=e;I<r;I++)this.zoomInPaintVertexArray.emplace(I,x.tl[0],x.tl[1],x.br[0],x.br[1],_.tl[0],_.tl[1],_.br[0],_.br[1],x.pixelRatio,_.pixelRatio),this.zoomOutPaintVertexArray.emplace(I,x.tl[0],x.tl[1],x.br[0],x.br[1],S.tl[0],S.tl[1],S.br[0],S.br[1],x.pixelRatio,S.pixelRatio)}upload(e){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,So.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,So.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class Ju{constructor(e,r,s){this.binders={},this._buffers=[];const l=[];for(const d in e.paint._values){if(!s(d))continue;const p=e.paint.get(d);if(!(p instanceof br&&mn(p.property.specification)))continue;const m=k_(d,e.type),_=p.value,x=p.property.specification.type,S=p.property.useIntegerZoom,I=p.property.specification["property-type"],A=I==="cross-faded"||I==="cross-faded-data-driven";if(_.kind==="constant")this.binders[d]=A?new Io(_.value,m):new $a(_.value,m,x),l.push(`/u_${d}`);else if(_.kind==="source"||A){const D=Ku(d,x,"source");this.binders[d]=A?new Xn(_,x,S,r,D,e.id):new wn(_,m,x,D),l.push(`/a_${d}`)}else{const D=Ku(d,x,"composite");this.binders[d]=new Br(_,m,x,S,r,D),l.push(`/z_${d}`)}}this.cacheKey=l.sort().join("")}getMaxValue(e){const r=this.binders[e];return r instanceof wn||r instanceof Br?r.maxValue:0}populatePaintArrays(e,r,s,l,d){for(const p in this.binders){const m=this.binders[p];(m instanceof wn||m instanceof Br||m instanceof Xn)&&m.populatePaintArray(e,r,s,l,d)}}setConstantPatternPositions(e,r){for(const s in this.binders){const l=this.binders[s];l instanceof Io&&l.setConstantPatternPositions(e,r)}}updatePaintArrays(e,r,s,l,d){let p=!1;for(const m in e){const _=r.getPositions(m);for(const x of _){const S=s.feature(x.index);for(const I in this.binders){const A=this.binders[I];if((A instanceof wn||A instanceof Br||A instanceof Xn)&&A.expression.isStateDependent===!0){const D=l.paint.get(I);A.expression=D.value,A.updatePaintArray(x.start,x.end,S,e[m],d),p=!0}}}}return p}defines(){const e=[];for(const r in this.binders){const s=this.binders[r];(s instanceof $a||s instanceof Io)&&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 wn||s instanceof Br)for(let l=0;l<s.paintVertexAttributes.length;l++)e.push(s.paintVertexAttributes[l].name);else if(s instanceof Xn)for(let l=0;l<So.members.length;l++)e.push(So.members[l].name)}return e}getBinderUniforms(){const e=[];for(const r in this.binders){const s=this.binders[r];if(s instanceof $a||s instanceof Io||s instanceof Br)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 d=this.binders[l];if(d instanceof $a||d instanceof Io||d instanceof Br){for(const p of d.uniformNames)if(r[p]){const m=d.getBinding(e,r[p],p);s.push({name:p,property:l,binding:m})}}}return s}setUniforms(e,r,s,l){for(const{name:d,property:p,binding:m}of r)this.binders[p].setUniform(m,l,s.get(p),d)}updatePaintBuffers(e){this._buffers=[];for(const r in this.binders){const s=this.binders[r];if(e&&s instanceof Xn){const l=e.fromScale===2?s.zoomInPaintVertexBuffer:s.zoomOutPaintVertexBuffer;l&&this._buffers.push(l)}else(s instanceof wn||s instanceof Br)&&s.paintVertexBuffer&&this._buffers.push(s.paintVertexBuffer)}}upload(e){for(const r in this.binders){const s=this.binders[r];(s instanceof wn||s instanceof Br||s instanceof Xn)&&s.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const r=this.binders[e];(r instanceof wn||r instanceof Br||r instanceof Xn)&&r.destroy()}}}class Ds{constructor(e,r,s=()=>!0){this.programConfigurations={};for(const l of e)this.programConfigurations[l.id]=new Ju(l,r,s);this.needsUpload=!1,this._featureMap=new Hn,this._bufferOffset=0}populatePaintArrays(e,r,s,l,d,p){for(const m in this.programConfigurations)this.programConfigurations[m].populatePaintArrays(e,r,l,d,p);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 d of s)this.needsUpload=this.programConfigurations[d.id].updatePaintArrays(e,this._featureMap,r,d,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 k_(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 Ku(i,e,r){const s={color:{source:U,composite:Qe},number:{source:Te,composite:U}},l=function(d){return{"line-pattern":{source:oi,composite:oi},"fill-pattern":{source:oi,composite:oi},"fill-extrusion-pattern":{source:oi,composite:oi}}[d]}(i);return l&&l[r]||s[e][r]}Fe("ConstantBinder",$a),Fe("CrossFadedConstantBinder",Io),Fe("SourceExpressionBinder",wn),Fe("CrossFadedCompositeBinder",Xn),Fe("CompositeExpressionBinder",Br),Fe("ProgramConfiguration",Ju,{omit:["_buffers"]}),Fe("ProgramConfigurationSet",Ds);const Qt=8192,ah=Math.pow(2,14)-1,Yu=-ah-1;function Ls(i){const e=Qt/i.extent,r=i.loadGeometry();for(let s=0;s<r.length;s++){const l=r[s];for(let d=0;d<l.length;d++){const p=l[d],m=Math.round(p.x*e),_=Math.round(p.y*e);p.x=wt(m,Yu,ah),p.y=wt(_,Yu,ah),(m<p.x||m>p.x+1||_<p.y||_>p.y+1)&&li("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function Rs(i,e){return{type:i.type,id:i.id,properties:i.properties,geometry:e?Ls(i):[]}}function tc(i,e,r,s,l){i.emplaceBack(2*e+(s+1)/2,2*r+(l+1)/2)}class lh{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 bo,this.indexArray=new ri,this.segments=new ti,this.programConfigurations=new Ds(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],d=[];let p=null,m=!1;l.type==="circle"&&(p=l.layout.get("circle-sort-key"),m=!p.isConstant());for(const{feature:_,id:x,index:S,sourceLayerIndex:I}of e){const A=this.layers[0]._featureFilter.needGeometry,D=Rs(_,A);if(!this.layers[0]._featureFilter.filter(new Pt(this.zoom),D,s))continue;const B=m?p.evaluate(D,{},s):void 0,O={id:x,properties:_.properties,type:_.type,sourceLayerIndex:I,index:S,geometry:A?D.geometry:Ls(_),patterns:{},sortKey:B};d.push(O)}m&&d.sort((_,x)=>_.sortKey-x.sortKey);for(const _ of d){const{geometry:x,index:S,sourceLayerIndex:I}=_,A=e[S].feature;this.addFeature(_,x,S,s),r.featureIndex.insert(A,x,S,I,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,Fa),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 d of r)for(const p of d){const m=p.x,_=p.y;if(m<0||m>=Qt||_<0||_>=Qt)continue;const x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),S=x.vertexLength;tc(this.layoutVertexArray,m,_,-1,-1),tc(this.layoutVertexArray,m,_,1,-1),tc(this.layoutVertexArray,m,_,1,1),tc(this.layoutVertexArray,m,_,-1,1),this.indexArray.emplaceBack(S,S+1,S+2),this.indexArray.emplaceBack(S,S+3,S+2),x.vertexLength+=4,x.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,{},l)}}function Qu(i,e){for(let r=0;r<i.length;r++)if(Co(e,i[r]))return!0;for(let r=0;r<e.length;r++)if(Co(i,e[r]))return!0;return!!ch(i,e)}function I_(i,e,r){return!!Co(i,e)||!!hh(e,i,r)}function ed(i,e){if(i.length===1)return id(e,i[0]);for(let r=0;r<e.length;r++){const s=e[r];for(let l=0;l<s.length;l++)if(Co(i,s[l]))return!0}for(let r=0;r<i.length;r++)if(id(e,i[r]))return!0;for(let r=0;r<e.length;r++)if(ch(i,e[r]))return!0;return!1}function C_(i,e,r){if(i.length>1){if(ch(i,e))return!0;for(let s=0;s<e.length;s++)if(hh(e[s],i,r))return!0}for(let s=0;s<i.length;s++)if(hh(i[s],e,r))return!0;return!1}function ch(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 d=0;d<e.length-1;d++)if(E_(s,l,e[d],e[d+1]))return!0}return!1}function E_(i,e,r,s){return wi(i,r,s)!==wi(e,r,s)&&wi(i,e,r)!==wi(i,e,s)}function hh(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(td(i,e[l-1],e[l])<s)return!0;return!1}function td(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 id(i,e){let r,s,l,d=!1;for(let p=0;p<i.length;p++){r=i[p];for(let m=0,_=r.length-1;m<r.length;_=m++)s=r[m],l=r[_],s.y>e.y!=l.y>e.y&&e.x<(l.x-s.x)*(e.y-s.y)/(l.y-s.y)+s.x&&(d=!d)}return d}function Co(i,e){let r=!1;for(let s=0,l=i.length-1;s<i.length;l=s++){const d=i[s],p=i[l];d.y>e.y!=p.y>e.y&&e.x<(p.x-d.x)*(e.y-d.y)/(p.y-d.y)+d.x&&(r=!r)}return r}function P_(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 d=wi(i,e,r[0]);return d!==wi(i,e,r[1])||d!==wi(i,e,r[2])||d!==wi(i,e,r[3])}function ja(i,e,r){const s=e.paint.get(i).value;return s.kind==="constant"?s.value:r.programConfigurations.get(e.id).getMaxValue(i)}function ic(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function rc(i,e,r,s,l){if(!e[0]&&!e[1])return i;const d=le.convert(e)._mult(l);r==="viewport"&&d._rotate(-s);const p=[];for(let m=0;m<i.length;m++)p.push(i[m].sub(d));return p}let rd,nd;Fe("CircleBucket",lh,{omit:["layers"]});var A_={get paint(){return nd=nd||new o({"circle-radius":new Je(ue.paint_circle["circle-radius"]),"circle-color":new Je(ue.paint_circle["circle-color"]),"circle-blur":new Je(ue.paint_circle["circle-blur"]),"circle-opacity":new Je(ue.paint_circle["circle-opacity"]),"circle-translate":new qe(ue.paint_circle["circle-translate"]),"circle-translate-anchor":new qe(ue.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new qe(ue.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new qe(ue.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Je(ue.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Je(ue.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Je(ue.paint_circle["circle-stroke-opacity"])})},get layout(){return rd=rd||new o({"circle-sort-key":new Je(ue.layout_circle["circle-sort-key"])})}},zi=1e-6,Eo=typeof Float32Array<"u"?Float32Array:Array;function uh(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 sd(i,e,r){var s=e[0],l=e[1],d=e[2],p=e[3],m=e[4],_=e[5],x=e[6],S=e[7],I=e[8],A=e[9],D=e[10],B=e[11],O=e[12],q=e[13],J=e[14],ae=e[15],Q=r[0],re=r[1],de=r[2],be=r[3];return i[0]=Q*s+re*m+de*I+be*O,i[1]=Q*l+re*_+de*A+be*q,i[2]=Q*d+re*x+de*D+be*J,i[3]=Q*p+re*S+de*B+be*ae,i[4]=(Q=r[4])*s+(re=r[5])*m+(de=r[6])*I+(be=r[7])*O,i[5]=Q*l+re*_+de*A+be*q,i[6]=Q*d+re*x+de*D+be*J,i[7]=Q*p+re*S+de*B+be*ae,i[8]=(Q=r[8])*s+(re=r[9])*m+(de=r[10])*I+(be=r[11])*O,i[9]=Q*l+re*_+de*A+be*q,i[10]=Q*d+re*x+de*D+be*J,i[11]=Q*p+re*S+de*B+be*ae,i[12]=(Q=r[12])*s+(re=r[13])*m+(de=r[14])*I+(be=r[15])*O,i[13]=Q*l+re*_+de*A+be*q,i[14]=Q*d+re*x+de*D+be*J,i[15]=Q*p+re*S+de*B+be*ae,i}Math.hypot||(Math.hypot=function(){for(var i=0,e=arguments.length;e--;)i+=arguments[e]*arguments[e];return Math.sqrt(i)});var Ua,M_=sd;function nc(i,e,r){var s=e[0],l=e[1],d=e[2],p=e[3];return i[0]=r[0]*s+r[4]*l+r[8]*d+r[12]*p,i[1]=r[1]*s+r[5]*l+r[9]*d+r[13]*p,i[2]=r[2]*s+r[6]*l+r[10]*d+r[14]*p,i[3]=r[3]*s+r[7]*l+r[11]*d+r[15]*p,i}Ua=new Eo(4),Eo!=Float32Array&&(Ua[0]=0,Ua[1]=0,Ua[2]=0,Ua[3]=0);class z_ extends h{constructor(e){super(e,A_)}createBucket(e){return new lh(e)}queryRadius(e){const r=e;return ja("circle-radius",this,r)+ja("circle-stroke-width",this,r)+ic(this.paint.get("circle-translate"))}queryIntersectsFeature(e,r,s,l,d,p,m,_){const x=rc(e,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),p.angle,m),S=this.paint.get("circle-radius").evaluate(r,s)+this.paint.get("circle-stroke-width").evaluate(r,s),I=this.paint.get("circle-pitch-alignment")==="map",A=I?x:function(B,O){return B.map(q=>od(q,O))}(x,_),D=I?S*m:S;for(const B of l)for(const O of B){const q=I?O:od(O,_);let J=D;const ae=nc([],[O.x,O.y,0,1],_);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?J*=ae[3]/p.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(J*=p.cameraToCenterDistance/ae[3]),I_(A,q,J))return!0}return!1}}function od(i,e){const r=nc([],[i.x,i.y,0,1],e);return new le(r[0]/r[3],r[1]/r[3])}class ad extends lh{}let ld;Fe("HeatmapBucket",ad,{omit:["layers"]});var D_={get paint(){return ld=ld||new o({"heatmap-radius":new Je(ue.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Je(ue.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new qe(ue.paint_heatmap["heatmap-intensity"]),"heatmap-color":new n(ue.paint_heatmap["heatmap-color"]),"heatmap-opacity":new qe(ue.paint_heatmap["heatmap-opacity"])})}};function dh(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 cd(i,{width:e,height:r},s){if(e===i.width&&r===i.height)return;const l=dh({},{width:e,height:r},s);ph(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 ph(i,e,r,s,l,d){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 p=i.data,m=e.data;if(p===m)throw new Error("srcData equals dstData, so image is already copied");for(let _=0;_<l.height;_++){const x=((r.y+_)*i.width+r.x)*d,S=((s.y+_)*e.width+s.x)*d;for(let I=0;I<l.width*d;I++)m[S+I]=p[x+I]}return e}class qa{constructor(e,r){dh(this,e,1,r)}resize(e){cd(this,e,1)}clone(){return new qa({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,s,l,d){ph(e,r,s,l,d,1)}}class ar{constructor(e,r){dh(this,e,4,r)}resize(e){cd(this,e,4)}replace(e,r){r?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new ar({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,s,l,d){ph(e,r,s,l,d,4)}}function hd(i){const e={},r=i.resolution||256,s=i.clips?i.clips.length:1,l=i.image||new ar({width:r,height:s});if(Math.log(r)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${r}`);const d=(p,m,_)=>{e[i.evaluationKey]=_;const x=i.expression.evaluate(e);l.data[p+m+0]=Math.floor(255*x.r/x.a),l.data[p+m+1]=Math.floor(255*x.g/x.a),l.data[p+m+2]=Math.floor(255*x.b/x.a),l.data[p+m+3]=Math.floor(255*x.a)};if(i.clips)for(let p=0,m=0;p<s;++p,m+=4*r)for(let _=0,x=0;_<r;_++,x+=4){const S=_/(r-1),{start:I,end:A}=i.clips[p];d(m,x,I*(1-S)+A*S)}else for(let p=0,m=0;p<r;p++,m+=4)d(0,m,p/(r-1));return l}Fe("AlphaImage",qa),Fe("RGBAImage",ar);class L_ extends h{createBucket(e){return new ad(e)}constructor(e){super(e,D_),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){e==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=hd({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"}}let ud;var R_={get paint(){return ud=ud||new o({"hillshade-illumination-direction":new qe(ue.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new qe(ue.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new qe(ue.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new qe(ue.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new qe(ue.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new qe(ue.paint_hillshade["hillshade-accent-color"])})}};class B_ extends h{constructor(e){super(e,R_)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}}const F_=w([{name:"a_pos",components:2,type:"Int16"}],4),{members:O_}=F_;function dd(i,e,r=2){const s=e&&e.length,l=s?e[0]*r:i.length;let d=pd(i,0,l,r,!0);const p=[];if(!d||d.next===d.prev)return p;let m,_,x;if(s&&(d=function(S,I,A,D){const B=[];for(let O=0,q=I.length;O<q;O++){const J=pd(S,I[O]*D,O<q-1?I[O+1]*D:S.length,D,!1);J===J.next&&(J.steiner=!0),B.push(G_(J))}B.sort(U_);for(let O=0;O<B.length;O++)A=q_(B[O],A);return A}(i,e,d,r)),i.length>80*r){m=1/0,_=1/0;let S=-1/0,I=-1/0;for(let A=r;A<l;A+=r){const D=i[A],B=i[A+1];D<m&&(m=D),B<_&&(_=B),D>S&&(S=D),B>I&&(I=B)}x=Math.max(S-m,I-_),x=x!==0?32767/x:0}return Za(d,p,r,m,_,x,0),p}function pd(i,e,r,s,l){let d;if(l===function(p,m,_,x){let S=0;for(let I=m,A=_-x;I<_;I+=x)S+=(p[A]-p[I])*(p[I+1]+p[A+1]),A=I;return S}(i,e,r,s)>0)for(let p=e;p<r;p+=s)d=gd(p/s|0,i[p],i[p+1],d);else for(let p=r-s;p>=e;p-=s)d=gd(p/s|0,i[p],i[p+1],d);return d&&sc(d,d.next)&&(Ha(d),d=d.next),d}function Bs(i,e){if(!i)return i;e||(e=i);let r,s=i;do if(r=!1,s.steiner||!sc(s,s.next)&&Jt(s.prev,s,s.next)!==0)s=s.next;else{if(Ha(s),s=e=s.prev,s===s.next)break;r=!0}while(r||s!==e);return e}function Za(i,e,r,s,l,d,p){if(!i)return;!p&&d&&function(_,x,S,I){let A=_;do A.z===0&&(A.z=fh(A.x,A.y,x,S,I)),A.prevZ=A.prev,A.nextZ=A.next,A=A.next;while(A!==_);A.prevZ.nextZ=null,A.prevZ=null,function(D){let B,O=1;do{let q,J=D;D=null;let ae=null;for(B=0;J;){B++;let Q=J,re=0;for(let be=0;be<O&&(re++,Q=Q.nextZ,Q);be++);let de=O;for(;re>0||de>0&&Q;)re!==0&&(de===0||!Q||J.z<=Q.z)?(q=J,J=J.nextZ,re--):(q=Q,Q=Q.nextZ,de--),ae?ae.nextZ=q:D=q,q.prevZ=ae,ae=q;J=Q}ae.nextZ=null,O*=2}while(B>1)}(A)}(i,s,l,d);let m=i;for(;i.prev!==i.next;){const _=i.prev,x=i.next;if(d?N_(i,s,l,d):V_(i))e.push(_.i,i.i,x.i),Ha(i),i=x.next,m=x.next;else if((i=x)===m){p?p===1?Za(i=$_(Bs(i),e),e,r,s,l,d,2):p===2&&j_(i,e,r,s,l,d):Za(Bs(i),e,r,s,l,d,1);break}}}function V_(i){const e=i.prev,r=i,s=i.next;if(Jt(e,r,s)>=0)return!1;const l=e.x,d=r.x,p=s.x,m=e.y,_=r.y,x=s.y,S=l<d?l<p?l:p:d<p?d:p,I=m<_?m<x?m:x:_<x?_:x,A=l>d?l>p?l:p:d>p?d:p,D=m>_?m>x?m:x:_>x?_:x;let B=s.next;for(;B!==e;){if(B.x>=S&&B.x<=A&&B.y>=I&&B.y<=D&&Po(l,m,d,_,p,x,B.x,B.y)&&Jt(B.prev,B,B.next)>=0)return!1;B=B.next}return!0}function N_(i,e,r,s){const l=i.prev,d=i,p=i.next;if(Jt(l,d,p)>=0)return!1;const m=l.x,_=d.x,x=p.x,S=l.y,I=d.y,A=p.y,D=m<_?m<x?m:x:_<x?_:x,B=S<I?S<A?S:A:I<A?I:A,O=m>_?m>x?m:x:_>x?_:x,q=S>I?S>A?S:A:I>A?I:A,J=fh(D,B,e,r,s),ae=fh(O,q,e,r,s);let Q=i.prevZ,re=i.nextZ;for(;Q&&Q.z>=J&&re&&re.z<=ae;){if(Q.x>=D&&Q.x<=O&&Q.y>=B&&Q.y<=q&&Q!==l&&Q!==p&&Po(m,S,_,I,x,A,Q.x,Q.y)&&Jt(Q.prev,Q,Q.next)>=0||(Q=Q.prevZ,re.x>=D&&re.x<=O&&re.y>=B&&re.y<=q&&re!==l&&re!==p&&Po(m,S,_,I,x,A,re.x,re.y)&&Jt(re.prev,re,re.next)>=0))return!1;re=re.nextZ}for(;Q&&Q.z>=J;){if(Q.x>=D&&Q.x<=O&&Q.y>=B&&Q.y<=q&&Q!==l&&Q!==p&&Po(m,S,_,I,x,A,Q.x,Q.y)&&Jt(Q.prev,Q,Q.next)>=0)return!1;Q=Q.prevZ}for(;re&&re.z<=ae;){if(re.x>=D&&re.x<=O&&re.y>=B&&re.y<=q&&re!==l&&re!==p&&Po(m,S,_,I,x,A,re.x,re.y)&&Jt(re.prev,re,re.next)>=0)return!1;re=re.nextZ}return!0}function $_(i,e){let r=i;do{const s=r.prev,l=r.next.next;!sc(s,l)&&fd(s,r,r.next,l)&&Ga(s,l)&&Ga(l,s)&&(e.push(s.i,r.i,l.i),Ha(r),Ha(r.next),r=i=l),r=r.next}while(r!==i);return Bs(r)}function j_(i,e,r,s,l,d){let p=i;do{let m=p.next.next;for(;m!==p.prev;){if(p.i!==m.i&&H_(p,m)){let _=md(p,m);return p=Bs(p,p.next),_=Bs(_,_.next),Za(p,e,r,s,l,d,0),void Za(_,e,r,s,l,d,0)}m=m.next}p=p.next}while(p!==i)}function U_(i,e){return i.x-e.x}function q_(i,e){const r=function(l,d){let p=d;const m=l.x,_=l.y;let x,S=-1/0;do{if(_<=p.y&&_>=p.next.y&&p.next.y!==p.y){const O=p.x+(_-p.y)*(p.next.x-p.x)/(p.next.y-p.y);if(O<=m&&O>S&&(S=O,x=p.x<p.next.x?p:p.next,O===m))return x}p=p.next}while(p!==d);if(!x)return null;const I=x,A=x.x,D=x.y;let B=1/0;p=x;do{if(m>=p.x&&p.x>=A&&m!==p.x&&Po(_<D?m:S,_,A,D,_<D?S:m,_,p.x,p.y)){const O=Math.abs(_-p.y)/(m-p.x);Ga(p,l)&&(O<B||O===B&&(p.x>x.x||p.x===x.x&&Z_(x,p)))&&(x=p,B=O)}p=p.next}while(p!==I);return x}(i,e);if(!r)return e;const s=md(r,i);return Bs(s,s.next),Bs(r,r.next)}function Z_(i,e){return Jt(i.prev,i,e.prev)<0&&Jt(e.next,i,i.next)<0}function fh(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 G_(i){let 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 Po(i,e,r,s,l,d,p,m){return(l-p)*(e-m)>=(i-p)*(d-m)&&(i-p)*(s-m)>=(r-p)*(e-m)&&(r-p)*(d-m)>=(l-p)*(s-m)}function H_(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!function(r,s){let l=r;do{if(l.i!==r.i&&l.next.i!==r.i&&l.i!==s.i&&l.next.i!==s.i&&fd(l,l.next,r,s))return!0;l=l.next}while(l!==r);return!1}(i,e)&&(Ga(i,e)&&Ga(e,i)&&function(r,s){let l=r,d=!1;const p=(r.x+s.x)/2,m=(r.y+s.y)/2;do l.y>m!=l.next.y>m&&l.next.y!==l.y&&p<(l.next.x-l.x)*(m-l.y)/(l.next.y-l.y)+l.x&&(d=!d),l=l.next;while(l!==r);return d}(i,e)&&(Jt(i.prev,i,e.prev)||Jt(i,e.prev,e))||sc(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 sc(i,e){return i.x===e.x&&i.y===e.y}function fd(i,e,r,s){const l=ac(Jt(i,e,r)),d=ac(Jt(i,e,s)),p=ac(Jt(r,s,i)),m=ac(Jt(r,s,e));return l!==d&&p!==m||!(l!==0||!oc(i,r,e))||!(d!==0||!oc(i,s,e))||!(p!==0||!oc(r,i,s))||!(m!==0||!oc(r,e,s))}function oc(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 ac(i){return i>0?1:i<0?-1:0}function Ga(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 md(i,e){const r=mh(i.i,i.x,i.y),s=mh(e.i,e.x,e.y),l=i.next,d=e.prev;return i.next=e,e.prev=i,r.next=l,l.prev=r,s.next=r,r.prev=s,d.next=s,s.prev=d,s}function gd(i,e,r,s){const l=mh(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 Ha(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 mh(i,e,r){return{i,x:e,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function gh(i,e,r){const s=r.patternDependencies;let l=!1;for(const d of e){const p=d.paint.get(`${i}-pattern`);p.isConstant()||(l=!0);const m=p.constantOr(null);m&&(l=!0,s[m.to]=!0,s[m.from]=!0)}return l}function _h(i,e,r,s,l){const d=l.patternDependencies;for(const p of e){const m=p.paint.get(`${i}-pattern`).value;if(m.kind!=="constant"){let _=m.evaluate({zoom:s-1},r,{},l.availableImages),x=m.evaluate({zoom:s},r,{},l.availableImages),S=m.evaluate({zoom:s+1},r,{},l.availableImages);_=_&&_.name?_.name:_,x=x&&x.name?x.name:x,S=S&&S.name?S.name:S,d[_]=!0,d[x]=!0,d[S]=!0,r.patterns[p.id]={min:_,mid:x,max:S}}}return r}class yh{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 qn,this.indexArray=new ri,this.indexArray2=new Nt,this.programConfigurations=new Ds(e.layers,e.zoom),this.segments=new ti,this.segments2=new ti,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,s){this.hasPattern=gh("fill",this.layers,r);const l=this.layers[0].layout.get("fill-sort-key"),d=!l.isConstant(),p=[];for(const{feature:m,id:_,index:x,sourceLayerIndex:S}of e){const I=this.layers[0]._featureFilter.needGeometry,A=Rs(m,I);if(!this.layers[0]._featureFilter.filter(new Pt(this.zoom),A,s))continue;const D=d?l.evaluate(A,{},s,r.availableImages):void 0,B={id:_,properties:m.properties,type:m.type,sourceLayerIndex:S,index:x,geometry:I?A.geometry:Ls(m),patterns:{},sortKey:D};p.push(B)}d&&p.sort((m,_)=>m.sortKey-_.sortKey);for(const m of p){const{geometry:_,index:x,sourceLayerIndex:S}=m;if(this.hasPattern){const I=_h("fill",this.layers,m,this.zoom,r);this.patternFeatures.push(I)}else this.addFeature(m,_,x,s,{});r.featureIndex.insert(e[x].feature,_,x,S,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,O_),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,d){for(const p of to(r,500)){let m=0;for(const D of p)m+=D.length;const _=this.segments.prepareSegment(m,this.layoutVertexArray,this.indexArray),x=_.vertexLength,S=[],I=[];for(const D of p){if(D.length===0)continue;D!==p[0]&&I.push(S.length/2);const B=this.segments2.prepareSegment(D.length,this.layoutVertexArray,this.indexArray2),O=B.vertexLength;this.layoutVertexArray.emplaceBack(D[0].x,D[0].y),this.indexArray2.emplaceBack(O+D.length-1,O),S.push(D[0].x),S.push(D[0].y);for(let q=1;q<D.length;q++)this.layoutVertexArray.emplaceBack(D[q].x,D[q].y),this.indexArray2.emplaceBack(O+q-1,O+q),S.push(D[q].x),S.push(D[q].y);B.vertexLength+=D.length,B.primitiveLength+=D.length}const A=dd(S,I);for(let D=0;D<A.length;D+=3)this.indexArray.emplaceBack(x+A[D],x+A[D+1],x+A[D+2]);_.vertexLength+=m,_.primitiveLength+=A.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,d,l)}}let _d,yd;Fe("FillBucket",yh,{omit:["layers","patternFeatures"]});var X_={get paint(){return yd=yd||new o({"fill-antialias":new qe(ue.paint_fill["fill-antialias"]),"fill-opacity":new Je(ue.paint_fill["fill-opacity"]),"fill-color":new Je(ue.paint_fill["fill-color"]),"fill-outline-color":new Je(ue.paint_fill["fill-outline-color"]),"fill-translate":new qe(ue.paint_fill["fill-translate"]),"fill-translate-anchor":new qe(ue.paint_fill["fill-translate-anchor"]),"fill-pattern":new u(ue.paint_fill["fill-pattern"])})},get layout(){return _d=_d||new o({"fill-sort-key":new Je(ue.layout_fill["fill-sort-key"])})}};class W_ extends h{constructor(e){super(e,X_)}recalculate(e,r){super.recalculate(e,r);const s=this.paint._values["fill-outline-color"];s.value.kind==="constant"&&s.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(e){return new yh(e)}queryRadius(){return ic(this.paint.get("fill-translate"))}queryIntersectsFeature(e,r,s,l,d,p,m){return ed(rc(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),p.angle,m),l)}isTileClipped(){return!0}}const J_=w([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),K_=w([{name:"a_centroid",components:2,type:"Int16"}],4),{members:Y_}=J_;var Wn={},Q_=me,xd=Ao;function Ao(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(ey,this,e)}function ey(i,e,r){i==1?e.id=r.readVarint():i==2?function(s,l){for(var d=s.readVarint()+s.pos;s.pos<d;){var p=l._keys[s.readVarint()],m=l._values[s.readVarint()];l.properties[p]=m}}(r,e):i==3?e.type=r.readVarint():i==4&&(e._geometry=r.pos)}function ty(i){for(var e,r,s=0,l=0,d=i.length,p=d-1;l<d;p=l++)s+=((r=i[p]).x-(e=i[l]).x)*(e.y+r.y);return s}Ao.types=["Unknown","Point","LineString","Polygon"],Ao.prototype.loadGeometry=function(){var i=this._pbf;i.pos=this._geometry;for(var e,r=i.readVarint()+i.pos,s=1,l=0,d=0,p=0,m=[];i.pos<r;){if(l<=0){var _=i.readVarint();s=7&_,l=_>>3}if(l--,s===1||s===2)d+=i.readSVarint(),p+=i.readSVarint(),s===1&&(e&&m.push(e),e=[]),e.push(new Q_(d,p));else{if(s!==7)throw new Error("unknown command "+s);e&&e.push(e[0].clone())}}return e&&m.push(e),m},Ao.prototype.bbox=function(){var i=this._pbf;i.pos=this._geometry;for(var e=i.readVarint()+i.pos,r=1,s=0,l=0,d=0,p=1/0,m=-1/0,_=1/0,x=-1/0;i.pos<e;){if(s<=0){var S=i.readVarint();r=7&S,s=S>>3}if(s--,r===1||r===2)(l+=i.readSVarint())<p&&(p=l),l>m&&(m=l),(d+=i.readSVarint())<_&&(_=d),d>x&&(x=d);else if(r!==7)throw new Error("unknown command "+r)}return[p,_,m,x]},Ao.prototype.toGeoJSON=function(i,e,r){var s,l,d=this.extent*Math.pow(2,r),p=this.extent*i,m=this.extent*e,_=this.loadGeometry(),x=Ao.types[this.type];function S(D){for(var B=0;B<D.length;B++){var O=D[B];D[B]=[360*(O.x+p)/d-180,360/Math.PI*Math.atan(Math.exp((180-360*(O.y+m)/d)*Math.PI/180))-90]}}switch(this.type){case 1:var I=[];for(s=0;s<_.length;s++)I[s]=_[s][0];S(_=I);break;case 2:for(s=0;s<_.length;s++)S(_[s]);break;case 3:for(_=function(D){var B=D.length;if(B<=1)return[D];for(var O,q,J=[],ae=0;ae<B;ae++){var Q=ty(D[ae]);Q!==0&&(q===void 0&&(q=Q<0),q===Q<0?(O&&J.push(O),O=[D[ae]]):O.push(D[ae]))}return O&&J.push(O),J}(_),s=0;s<_.length;s++)for(l=0;l<_[s].length;l++)S(_[s][l])}_.length===1?_=_[0]:x="Multi"+x;var A={type:"Feature",geometry:{type:x,coordinates:_},properties:this.properties};return"id"in this&&(A.id=this.id),A};var iy=xd,vd=bd;function bd(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(ry,this,e),this.length=this._features.length}function ry(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,d=s.readVarint()+s.pos;s.pos<d;){var p=s.readVarint()>>3;l=p===1?s.readString():p===2?s.readFloat():p===3?s.readDouble():p===4?s.readVarint64():p===5?s.readVarint():p===6?s.readSVarint():p===7?s.readBoolean():null}return l}(r))}bd.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 iy(this._pbf,e,this.extent,this._keys,this._values)};var ny=vd;function sy(i,e,r){if(i===3){var s=new ny(r,r.readVarint()+r.pos);s.length&&(e[s.name]=s)}}Wn.VectorTile=function(i,e){this.layers=i.readFields(sy,{},e)},Wn.VectorTileFeature=xd,Wn.VectorTileLayer=vd;const oy=Wn.VectorTileFeature.types,xh=Math.pow(2,13);function Xa(i,e,r,s,l,d,p,m){i.emplaceBack(e,r,2*Math.floor(s*xh)+p,l*xh*2,d*xh*2,Math.round(m))}class vh{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 bn,this.centroidVertexArray=new vn,this.indexArray=new ri,this.programConfigurations=new Ds(e.layers,e.zoom),this.segments=new ti,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,s){this.features=[],this.hasPattern=gh("fill-extrusion",this.layers,r);for(const{feature:l,id:d,index:p,sourceLayerIndex:m}of e){const _=this.layers[0]._featureFilter.needGeometry,x=Rs(l,_);if(!this.layers[0]._featureFilter.filter(new Pt(this.zoom),x,s))continue;const S={id:d,sourceLayerIndex:m,index:p,geometry:_?x.geometry:Ls(l),properties:l.properties,type:l.type,patterns:{}};this.hasPattern?this.features.push(_h("fill-extrusion",this.layers,S,this.zoom,r)):this.addFeature(S,S.geometry,p,s,{}),r.featureIndex.insert(l,S.geometry,p,m,this.index,!0)}}addFeatures(e,r,s){for(const l of this.features){const{geometry:d}=l;this.addFeature(l,d,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,Y_),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,K_.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,d){for(const p of to(r,500)){const m={x:0,y:0,vertexCount:0};let _=0;for(const B of p)_+=B.length;let x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const B of p){if(B.length===0||ly(B))continue;let O=0;for(let q=0;q<B.length;q++){const J=B[q];if(q>=1){const ae=B[q-1];if(!ay(J,ae)){x.vertexLength+4>ti.MAX_VERTEX_ARRAY_LENGTH&&(x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const Q=J.sub(ae)._perp()._unit(),re=ae.dist(J);O+re>32768&&(O=0),Xa(this.layoutVertexArray,J.x,J.y,Q.x,Q.y,0,0,O),Xa(this.layoutVertexArray,J.x,J.y,Q.x,Q.y,0,1,O),m.x+=2*J.x,m.y+=2*J.y,m.vertexCount+=2,O+=re,Xa(this.layoutVertexArray,ae.x,ae.y,Q.x,Q.y,0,0,O),Xa(this.layoutVertexArray,ae.x,ae.y,Q.x,Q.y,0,1,O),m.x+=2*ae.x,m.y+=2*ae.y,m.vertexCount+=2;const de=x.vertexLength;this.indexArray.emplaceBack(de,de+2,de+1),this.indexArray.emplaceBack(de+1,de+2,de+3),x.vertexLength+=4,x.primitiveLength+=2}}}}if(x.vertexLength+_>ti.MAX_VERTEX_ARRAY_LENGTH&&(x=this.segments.prepareSegment(_,this.layoutVertexArray,this.indexArray)),oy[e.type]!=="Polygon")continue;const S=[],I=[],A=x.vertexLength;for(const B of p)if(B.length!==0){B!==p[0]&&I.push(S.length/2);for(let O=0;O<B.length;O++){const q=B[O];Xa(this.layoutVertexArray,q.x,q.y,0,0,1,1,0),m.x+=q.x,m.y+=q.y,m.vertexCount+=1,S.push(q.x),S.push(q.y)}}const D=dd(S,I);for(let B=0;B<D.length;B+=3)this.indexArray.emplaceBack(A+D[B],A+D[B+2],A+D[B+1]);x.primitiveLength+=D.length/3,x.vertexLength+=_;for(let B=0;B<m.vertexCount;B++){const O=Math.floor(m.x/m.vertexCount),q=Math.floor(m.y/m.vertexCount);this.centroidVertexArray.emplaceBack(O,q)}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,d,l)}}function ay(i,e){return i.x===e.x&&(i.x<0||i.x>Qt)||i.y===e.y&&(i.y<0||i.y>Qt)}function ly(i){return i.every(e=>e.x<0)||i.every(e=>e.x>Qt)||i.every(e=>e.y<0)||i.every(e=>e.y>Qt)}let wd;Fe("FillExtrusionBucket",vh,{omit:["layers","features"]});var cy={get paint(){return wd=wd||new o({"fill-extrusion-opacity":new qe(ue["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Je(ue["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new qe(ue["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new qe(ue["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new u(ue["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Je(ue["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Je(ue["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new qe(ue["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class hy extends h{constructor(e){super(e,cy)}createBucket(e){return new vh(e)}queryRadius(){return ic(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(e,r,s,l,d,p,m,_){const x=rc(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),p.angle,m),S=this.paint.get("fill-extrusion-height").evaluate(r,s),I=this.paint.get("fill-extrusion-base").evaluate(r,s),A=function(B,O,q,J){const ae=[];for(const Q of B){const re=[Q.x,Q.y,0,1];nc(re,re,O),ae.push(new le(re[0]/re[3],re[1]/re[3]))}return ae}(x,_),D=function(B,O,q,J){const ae=[],Q=[],re=J[8]*O,de=J[9]*O,be=J[10]*O,Le=J[11]*O,We=J[8]*q,Me=J[9]*q,Pe=J[10]*q,Ue=J[11]*q;for(const Ve of B){const Be=[],_e=[];for(const Ze of Ve){const $e=Ze.x,et=Ze.y,It=J[0]*$e+J[4]*et+J[12],kt=J[1]*$e+J[5]*et+J[13],ni=J[2]*$e+J[6]*et+J[14],wr=J[3]*$e+J[7]*et+J[15],yi=ni+be,Gt=wr+Le,Di=It+We,Li=kt+Me,Ri=ni+Pe,Ht=wr+Ue,si=new le((It+re)/Gt,(kt+de)/Gt);si.z=yi/Gt,Be.push(si);const Ii=new le(Di/Ht,Li/Ht);Ii.z=Ri/Ht,_e.push(Ii)}ae.push(Be),Q.push(_e)}return[ae,Q]}(l,I,S,_);return function(B,O,q){let J=1/0;ed(q,O)&&(J=Sd(q,O[0]));for(let ae=0;ae<O.length;ae++){const Q=O[ae],re=B[ae];for(let de=0;de<Q.length-1;de++){const be=Q[de],Le=[be,Q[de+1],re[de+1],re[de],be];Qu(q,Le)&&(J=Math.min(J,Sd(q,Le)))}}return J!==1/0&&J}(D[0],D[1],A)}}function Wa(i,e){return i.x*e.x+i.y*e.y}function Sd(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 d=e[r],p=i[0],m=l.sub(s),_=d.sub(s),x=p.sub(s),S=Wa(m,m),I=Wa(m,_),A=Wa(_,_),D=Wa(x,m),B=Wa(x,_),O=S*A-I*I,q=(A*D-I*B)/O,J=(S*B-I*D)/O,ae=s.z*(1-q-J)+l.z*q+d.z*J;if(isFinite(ae))return ae}return 1/0}{let r=1/0;for(const s of e)r=Math.min(r,s.z);return r}}const uy=w([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:dy}=uy,py=w([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:fy}=py,my=Wn.VectorTileFeature.types,gy=Math.cos(Math.PI/180*37.5),Td=Math.pow(2,14)/.5;class bh{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 wo,this.layoutVertexArray2=new Ba,this.indexArray=new ri,this.programConfigurations=new Ds(e.layers,e.zoom),this.segments=new ti,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,s){this.hasPattern=gh("line",this.layers,r);const l=this.layers[0].layout.get("line-sort-key"),d=!l.isConstant(),p=[];for(const{feature:m,id:_,index:x,sourceLayerIndex:S}of e){const I=this.layers[0]._featureFilter.needGeometry,A=Rs(m,I);if(!this.layers[0]._featureFilter.filter(new Pt(this.zoom),A,s))continue;const D=d?l.evaluate(A,{},s):void 0,B={id:_,properties:m.properties,type:m.type,sourceLayerIndex:S,index:x,geometry:I?A.geometry:Ls(m),patterns:{},sortKey:D};p.push(B)}d&&p.sort((m,_)=>m.sortKey-_.sortKey);for(const m of p){const{geometry:_,index:x,sourceLayerIndex:S}=m;if(this.hasPattern){const I=_h("line",this.layers,m,this.zoom,r);this.patternFeatures.push(I)}else this.addFeature(m,_,x,s,{});r.featureIndex.insert(e[x].feature,_,x,S,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,fy)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,dy),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,d){const p=this.layers[0].layout,m=p.get("line-join").evaluate(e,{}),_=p.get("line-cap"),x=p.get("line-miter-limit"),S=p.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const I of r)this.addLine(I,e,m,_,x,S);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,d,l)}addLine(e,r,s,l,d,p){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let J=0;J<e.length-1;J++)this.totalDistance+=e[J].dist(e[J+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const m=my[r.type]==="Polygon";let _=e.length;for(;_>=2&&e[_-1].equals(e[_-2]);)_--;let x=0;for(;x<_-1&&e[x].equals(e[x+1]);)x++;if(_<(m?3:2))return;s==="bevel"&&(d=1.05);const S=this.overscaling<=16?15*Qt/(512*this.overscaling):0,I=this.segments.prepareSegment(10*_,this.layoutVertexArray,this.indexArray);let A,D,B,O,q;this.e1=this.e2=-1,m&&(A=e[_-2],q=e[x].sub(A)._unit()._perp());for(let J=x;J<_;J++){if(B=J===_-1?m?e[x+1]:void 0:e[J+1],B&&e[J].equals(B))continue;q&&(O=q),A&&(D=A),A=e[J],q=B?B.sub(A)._unit()._perp():O,O=O||q;let ae=O.add(q);ae.x===0&&ae.y===0||ae._unit();const Q=O.x*q.x+O.y*q.y,re=ae.x*q.x+ae.y*q.y,de=re!==0?1/re:1/0,be=2*Math.sqrt(2-2*re),Le=re<gy&&D&&B,We=O.x*q.y-O.y*q.x>0;if(Le&&J>x){const Ue=A.dist(D);if(Ue>2*S){const Ve=A.sub(A.sub(D)._mult(S/Ue)._round());this.updateDistance(D,Ve),this.addCurrentVertex(Ve,O,0,0,I),D=Ve}}const Me=D&&B;let Pe=Me?s:m?"butt":l;if(Me&&Pe==="round"&&(de<p?Pe="miter":de<=2&&(Pe="fakeround")),Pe==="miter"&&de>d&&(Pe="bevel"),Pe==="bevel"&&(de>2&&(Pe="flipbevel"),de<d&&(Pe="miter")),D&&this.updateDistance(D,A),Pe==="miter")ae._mult(de),this.addCurrentVertex(A,ae,0,0,I);else if(Pe==="flipbevel"){if(de>100)ae=q.mult(-1);else{const Ue=de*O.add(q).mag()/O.sub(q).mag();ae._perp()._mult(Ue*(We?-1:1))}this.addCurrentVertex(A,ae,0,0,I),this.addCurrentVertex(A,ae.mult(-1),0,0,I)}else if(Pe==="bevel"||Pe==="fakeround"){const Ue=-Math.sqrt(de*de-1),Ve=We?Ue:0,Be=We?0:Ue;if(D&&this.addCurrentVertex(A,O,Ve,Be,I),Pe==="fakeround"){const _e=Math.round(180*be/Math.PI/20);for(let Ze=1;Ze<_e;Ze++){let $e=Ze/_e;if($e!==.5){const It=$e-.5;$e+=$e*It*($e-1)*((1.0904+Q*(Q*(3.55645-1.43519*Q)-3.2452))*It*It+(.848013+Q*(.215638*Q-1.06021)))}const et=q.sub(O)._mult($e)._add(O)._unit()._mult(We?-1:1);this.addHalfVertex(A,et.x,et.y,!1,We,0,I)}}B&&this.addCurrentVertex(A,q,-Ve,-Be,I)}else if(Pe==="butt")this.addCurrentVertex(A,ae,0,0,I);else if(Pe==="square"){const Ue=D?1:-1;this.addCurrentVertex(A,ae,Ue,Ue,I)}else Pe==="round"&&(D&&(this.addCurrentVertex(A,O,0,0,I),this.addCurrentVertex(A,O,1,1,I,!0)),B&&(this.addCurrentVertex(A,q,-1,-1,I,!0),this.addCurrentVertex(A,q,0,0,I)));if(Le&&J<_-1){const Ue=A.dist(B);if(Ue>2*S){const Ve=A.add(B.sub(A)._mult(S/Ue)._round());this.updateDistance(A,Ve),this.addCurrentVertex(Ve,q,0,0,I),A=Ve}}}}addCurrentVertex(e,r,s,l,d,p=!1){const m=r.y*l-r.x,_=-r.y-r.x*l;this.addHalfVertex(e,r.x+r.y*s,r.y-r.x*s,p,!1,s,d),this.addHalfVertex(e,m,_,p,!0,-l,d),this.distance>Td/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,r,s,l,d,p))}addHalfVertex({x:e,y:r},s,l,d,p,m,_){const x=.5*(this.lineClips?this.scaledDistance*(Td-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(d?1:0),(r<<1)+(p?1:0),Math.round(63*s)+128,Math.round(63*l)+128,1+(m===0?0:m<0?-1:1)|(63&x)<<2,x>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const S=_.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,S),_.primitiveLength++),p?this.e2=S:this.e1=S}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 kd,Id;Fe("LineBucket",bh,{omit:["layers","patternFeatures"]});var Cd={get paint(){return Id=Id||new o({"line-opacity":new Je(ue.paint_line["line-opacity"]),"line-color":new Je(ue.paint_line["line-color"]),"line-translate":new qe(ue.paint_line["line-translate"]),"line-translate-anchor":new qe(ue.paint_line["line-translate-anchor"]),"line-width":new Je(ue.paint_line["line-width"]),"line-gap-width":new Je(ue.paint_line["line-gap-width"]),"line-offset":new Je(ue.paint_line["line-offset"]),"line-blur":new Je(ue.paint_line["line-blur"]),"line-dasharray":new t(ue.paint_line["line-dasharray"]),"line-pattern":new u(ue.paint_line["line-pattern"]),"line-gradient":new n(ue.paint_line["line-gradient"])})},get layout(){return kd=kd||new o({"line-cap":new qe(ue.layout_line["line-cap"]),"line-join":new Je(ue.layout_line["line-join"]),"line-miter-limit":new qe(ue.layout_line["line-miter-limit"]),"line-round-limit":new qe(ue.layout_line["line-round-limit"]),"line-sort-key":new Je(ue.layout_line["line-sort-key"])})}};class _y extends Je{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=$t({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(e,r,s,l)}}let lc;class yy extends h{constructor(e){super(e,Cd),this.gradientVersion=0,lc||(lc=new _y(Cd.paint.properties["line-width"].specification),lc.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e==="line-gradient"){const r=this.gradientExpression();this.stepInterpolant=!!function(s){return s._styleExpression!==void 0}(r)&&r._styleExpression.expression instanceof Dn,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(e,r){super.recalculate(e,r),this.paint._values["line-floorwidth"]=lc.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new bh(e)}queryRadius(e){const r=e,s=Ed(ja("line-width",this,r),ja("line-gap-width",this,r)),l=ja("line-offset",this,r);return s/2+Math.abs(l)+ic(this.paint.get("line-translate"))}queryIntersectsFeature(e,r,s,l,d,p,m){const _=rc(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),p.angle,m),x=m/2*Ed(this.paint.get("line-width").evaluate(r,s),this.paint.get("line-gap-width").evaluate(r,s)),S=this.paint.get("line-offset").evaluate(r,s);return S&&(l=function(I,A){const D=[];for(let B=0;B<I.length;B++){const O=I[B],q=[];for(let J=0;J<O.length;J++){const ae=O[J-1],Q=O[J],re=O[J+1],de=J===0?new le(0,0):Q.sub(ae)._unit()._perp(),be=J===O.length-1?new le(0,0):re.sub(Q)._unit()._perp(),Le=de._add(be)._unit(),We=Le.x*be.x+Le.y*be.y;We!==0&&Le._mult(1/We),q.push(Le._mult(A)._add(Q))}D.push(q)}return D}(l,S*m)),function(I,A,D){for(let B=0;B<A.length;B++){const O=A[B];if(I.length>=3){for(let q=0;q<O.length;q++)if(Co(I,O[q]))return!0}if(C_(I,O,D))return!0}return!1}(_,l,x)}isTileClipped(){return!0}}function Ed(i,e){return e>0?e+2*i:i}const xy=w([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),vy=w([{name:"a_projected_pos",components:3,type:"Float32"}],4);w([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const by=w([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);w([{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 Pd=w([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),wy=w([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function Sy(i,e,r){return i.sections.forEach(s=>{s.text=function(l,d,p){const m=d.layout.get("text-transform").evaluate(p,{});return m==="uppercase"?l=l.toLocaleUpperCase():m==="lowercase"&&(l=l.toLocaleLowerCase()),Yr.applyArabicShaping&&(l=Yr.applyArabicShaping(l)),l}(s.text,e,r)}),i}w([{name:"triangle",components:3,type:"Uint16"}]),w([{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"}]),w([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),w([{type:"Float32",name:"offsetX"}]),w([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),w([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const Ja={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var ii=24,Ad=Tt,Md=function(i,e,r,s,l){var d,p,m=8*l-s-1,_=(1<<m)-1,x=_>>1,S=-7,I=l-1,A=-1,D=i[e+I];for(I+=A,d=D&(1<<-S)-1,D>>=-S,S+=m;S>0;d=256*d+i[e+I],I+=A,S-=8);for(p=d&(1<<-S)-1,d>>=-S,S+=s;S>0;p=256*p+i[e+I],I+=A,S-=8);if(d===0)d=1-x;else{if(d===_)return p?NaN:1/0*(D?-1:1);p+=Math.pow(2,s),d-=x}return(D?-1:1)*p*Math.pow(2,d-s)},zd=function(i,e,r,s,l,d){var p,m,_,x=8*d-l-1,S=(1<<x)-1,I=S>>1,A=l===23?Math.pow(2,-24)-Math.pow(2,-77):0,D=0,B=1,O=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(m=isNaN(e)?1:0,p=S):(p=Math.floor(Math.log(e)/Math.LN2),e*(_=Math.pow(2,-p))<1&&(p--,_*=2),(e+=p+I>=1?A/_:A*Math.pow(2,1-I))*_>=2&&(p++,_/=2),p+I>=S?(m=0,p=S):p+I>=1?(m=(e*_-1)*Math.pow(2,l),p+=I):(m=e*Math.pow(2,I-1)*Math.pow(2,l),p=0));l>=8;i[r+D]=255&m,D+=B,m/=256,l-=8);for(p=p<<l|m,x+=l;x>0;i[r+D]=255&p,D+=B,p/=256,x-=8);i[r+D-B]|=128*O};function Tt(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}Tt.Varint=0,Tt.Fixed64=1,Tt.Bytes=2,Tt.Fixed32=5;var wh=4294967296,Dd=1/wh,Ld=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function Sn(i){return i.type===Tt.Bytes?i.readVarint()+i.pos:i.pos+1}function Mo(i,e,r){return r?4294967296*e+(i>>>0):4294967296*(e>>>0)+(i>>>0)}function Rd(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 Ty(i,e){for(var r=0;r<i.length;r++)e.writeVarint(i[r])}function ky(i,e){for(var r=0;r<i.length;r++)e.writeSVarint(i[r])}function Iy(i,e){for(var r=0;r<i.length;r++)e.writeFloat(i[r])}function Cy(i,e){for(var r=0;r<i.length;r++)e.writeDouble(i[r])}function Ey(i,e){for(var r=0;r<i.length;r++)e.writeBoolean(i[r])}function Py(i,e){for(var r=0;r<i.length;r++)e.writeFixed32(i[r])}function Ay(i,e){for(var r=0;r<i.length;r++)e.writeSFixed32(i[r])}function My(i,e){for(var r=0;r<i.length;r++)e.writeFixed64(i[r])}function zy(i,e){for(var r=0;r<i.length;r++)e.writeSFixed64(i[r])}function cc(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+16777216*i[e+3]}function zo(i,e,r){i[r]=e,i[r+1]=e>>>8,i[r+2]=e>>>16,i[r+3]=e>>>24}function Bd(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+(i[e+3]<<24)}Tt.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,d=this.pos;this.type=7&s,i(l,e,this),this.pos===d&&this.skip(s)}return e},readMessage:function(i,e){return this.readFields(i,e,this.readVarint()+this.pos)},readFixed32:function(){var i=cc(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=Bd(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=cc(this.buf,this.pos)+cc(this.buf,this.pos+4)*wh;return this.pos+=8,i},readSFixed64:function(){var i=cc(this.buf,this.pos)+Bd(this.buf,this.pos+4)*wh;return this.pos+=8,i},readFloat:function(){var i=Md(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=Md(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,d,p){var m,_,x=p.buf;if(m=(112&(_=x[p.pos++]))>>4,_<128||(m|=(127&(_=x[p.pos++]))<<3,_<128)||(m|=(127&(_=x[p.pos++]))<<10,_<128)||(m|=(127&(_=x[p.pos++]))<<17,_<128)||(m|=(127&(_=x[p.pos++]))<<24,_<128)||(m|=(1&(_=x[p.pos++]))<<31,_<128))return Mo(l,m,d);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&&Ld?function(r,s,l){return Ld.decode(r.subarray(s,l))}(this.buf,e,i):function(r,s,l){for(var d="",p=s;p<l;){var m,_,x,S=r[p],I=null,A=S>239?4:S>223?3:S>191?2:1;if(p+A>l)break;A===1?S<128&&(I=S):A===2?(192&(m=r[p+1]))==128&&(I=(31&S)<<6|63&m)<=127&&(I=null):A===3?(_=r[p+2],(192&(m=r[p+1]))==128&&(192&_)==128&&((I=(15&S)<<12|(63&m)<<6|63&_)<=2047||I>=55296&&I<=57343)&&(I=null)):A===4&&(_=r[p+2],x=r[p+3],(192&(m=r[p+1]))==128&&(192&_)==128&&(192&x)==128&&((I=(15&S)<<18|(63&m)<<12|(63&_)<<6|63&x)<=65535||I>=1114112)&&(I=null)),I===null?(I=65533,A=1):I>65535&&(I-=65536,d+=String.fromCharCode(I>>>10&1023|55296),I=56320|1023&I),d+=String.fromCharCode(I),p+=A}return d}(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!==Tt.Bytes)return i.push(this.readVarint(e));var r=Sn(this);for(i=i||[];this.pos<r;)i.push(this.readVarint(e));return i},readPackedSVarint:function(i){if(this.type!==Tt.Bytes)return i.push(this.readSVarint());var e=Sn(this);for(i=i||[];this.pos<e;)i.push(this.readSVarint());return i},readPackedBoolean:function(i){if(this.type!==Tt.Bytes)return i.push(this.readBoolean());var e=Sn(this);for(i=i||[];this.pos<e;)i.push(this.readBoolean());return i},readPackedFloat:function(i){if(this.type!==Tt.Bytes)return i.push(this.readFloat());var e=Sn(this);for(i=i||[];this.pos<e;)i.push(this.readFloat());return i},readPackedDouble:function(i){if(this.type!==Tt.Bytes)return i.push(this.readDouble());var e=Sn(this);for(i=i||[];this.pos<e;)i.push(this.readDouble());return i},readPackedFixed32:function(i){if(this.type!==Tt.Bytes)return i.push(this.readFixed32());var e=Sn(this);for(i=i||[];this.pos<e;)i.push(this.readFixed32());return i},readPackedSFixed32:function(i){if(this.type!==Tt.Bytes)return i.push(this.readSFixed32());var e=Sn(this);for(i=i||[];this.pos<e;)i.push(this.readSFixed32());return i},readPackedFixed64:function(i){if(this.type!==Tt.Bytes)return i.push(this.readFixed64());var e=Sn(this);for(i=i||[];this.pos<e;)i.push(this.readFixed64());return i},readPackedSFixed64:function(i){if(this.type!==Tt.Bytes)return i.push(this.readSFixed64());var e=Sn(this);for(i=i||[];this.pos<e;)i.push(this.readSFixed64());return i},skip:function(i){var e=7&i;if(e===Tt.Varint)for(;this.buf[this.pos++]>127;);else if(e===Tt.Bytes)this.pos=this.readVarint()+this.pos;else if(e===Tt.Fixed32)this.pos+=4;else{if(e!==Tt.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),zo(this.buf,i,this.pos),this.pos+=4},writeSFixed32:function(i){this.realloc(4),zo(this.buf,i,this.pos),this.pos+=4},writeFixed64:function(i){this.realloc(8),zo(this.buf,-1&i,this.pos),zo(this.buf,Math.floor(i*Dd),this.pos+4),this.pos+=8},writeSFixed64:function(i){this.realloc(8),zo(this.buf,-1&i,this.pos),zo(this.buf,Math.floor(i*Dd),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(d,p,m){m.buf[m.pos++]=127&d|128,d>>>=7,m.buf[m.pos++]=127&d|128,d>>>=7,m.buf[m.pos++]=127&d|128,d>>>=7,m.buf[m.pos++]=127&d|128,m.buf[m.pos]=127&(d>>>=7)}(s,0,r),function(d,p){var m=(7&d)<<4;p.buf[p.pos++]|=m|((d>>>=3)?128:0),d&&(p.buf[p.pos++]=127&d|((d>>>=7)?128:0),d&&(p.buf[p.pos++]=127&d|((d>>>=7)?128:0),d&&(p.buf[p.pos++]=127&d|((d>>>=7)?128:0),d&&(p.buf[p.pos++]=127&d|((d>>>=7)?128:0),d&&(p.buf[p.pos++]=127&d)))))}(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,d){for(var p,m,_=0;_<l.length;_++){if((p=l.charCodeAt(_))>55295&&p<57344){if(!m){p>56319||_+1===l.length?(s[d++]=239,s[d++]=191,s[d++]=189):m=p;continue}if(p<56320){s[d++]=239,s[d++]=191,s[d++]=189,m=p;continue}p=m-55296<<10|p-56320|65536,m=null}else m&&(s[d++]=239,s[d++]=191,s[d++]=189,m=null);p<128?s[d++]=p:(p<2048?s[d++]=p>>6|192:(p<65536?s[d++]=p>>12|224:(s[d++]=p>>18|240,s[d++]=p>>12&63|128),s[d++]=p>>6&63|128),s[d++]=63&p|128)}return d}(this.buf,i,this.pos);var r=this.pos-e;r>=128&&Rd(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(i){this.realloc(4),zd(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),zd(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&&Rd(r,s,this),this.pos=r-1,this.writeVarint(s),this.pos+=s},writeMessage:function(i,e,r){this.writeTag(i,Tt.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(i,e){e.length&&this.writeMessage(i,Ty,e)},writePackedSVarint:function(i,e){e.length&&this.writeMessage(i,ky,e)},writePackedBoolean:function(i,e){e.length&&this.writeMessage(i,Ey,e)},writePackedFloat:function(i,e){e.length&&this.writeMessage(i,Iy,e)},writePackedDouble:function(i,e){e.length&&this.writeMessage(i,Cy,e)},writePackedFixed32:function(i,e){e.length&&this.writeMessage(i,Py,e)},writePackedSFixed32:function(i,e){e.length&&this.writeMessage(i,Ay,e)},writePackedFixed64:function(i,e){e.length&&this.writeMessage(i,My,e)},writePackedSFixed64:function(i,e){e.length&&this.writeMessage(i,zy,e)},writeBytesField:function(i,e){this.writeTag(i,Tt.Bytes),this.writeBytes(e)},writeFixed32Field:function(i,e){this.writeTag(i,Tt.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(i,e){this.writeTag(i,Tt.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(i,e){this.writeTag(i,Tt.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(i,e){this.writeTag(i,Tt.Fixed64),this.writeSFixed64(e)},writeVarintField:function(i,e){this.writeTag(i,Tt.Varint),this.writeVarint(e)},writeSVarintField:function(i,e){this.writeTag(i,Tt.Varint),this.writeSVarint(e)},writeStringField:function(i,e){this.writeTag(i,Tt.Bytes),this.writeString(e)},writeFloatField:function(i,e){this.writeTag(i,Tt.Fixed32),this.writeFloat(e)},writeDoubleField:function(i,e){this.writeTag(i,Tt.Fixed64),this.writeDouble(e)},writeBooleanField:function(i,e){this.writeVarintField(i,!!e)}};var Sh=fe(Ad);const Th=3;function Dy(i,e,r){i===1&&r.readMessage(Ly,e)}function Ly(i,e,r){if(i===3){const{id:s,bitmap:l,width:d,height:p,left:m,top:_,advance:x}=r.readMessage(Ry,{});e.push({id:s,bitmap:new qa({width:d+2*Th,height:p+2*Th},l),metrics:{width:d,height:p,left:m,top:_,advance:x}})}}function Ry(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 Fd=Th;function Od(i){let e=0,r=0;for(const p of i)e+=p.w*p.h,r=Math.max(r,p.w);i.sort((p,m)=>m.h-p.h);const s=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}];let l=0,d=0;for(const p of i)for(let m=s.length-1;m>=0;m--){const _=s[m];if(!(p.w>_.w||p.h>_.h)){if(p.x=_.x,p.y=_.y,d=Math.max(d,p.y+p.h),l=Math.max(l,p.x+p.w),p.w===_.w&&p.h===_.h){const x=s.pop();m<s.length&&(s[m]=x)}else p.h===_.h?(_.x+=p.w,_.w-=p.w):p.w===_.w?(_.y+=p.h,_.h-=p.h):(s.push({x:_.x+p.w,y:_.y,w:_.w-p.w,h:p.h}),_.y+=p.h,_.h-=p.h);break}}return{w:l,h:d,fill:e/(l*d)||0}}const Zi=1;class kh{constructor(e,{pixelRatio:r,version:s,stretchX:l,stretchY:d,content:p,textFitWidth:m,textFitHeight:_}){this.paddedRect=e,this.pixelRatio=r,this.stretchX=l,this.stretchY=d,this.content=p,this.version=s,this.textFitWidth=m,this.textFitHeight=_}get tl(){return[this.paddedRect.x+Zi,this.paddedRect.y+Zi]}get br(){return[this.paddedRect.x+this.paddedRect.w-Zi,this.paddedRect.y+this.paddedRect.h-Zi]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2*Zi)/this.pixelRatio,(this.paddedRect.h-2*Zi)/this.pixelRatio]}}class Vd{constructor(e,r){const s={},l={};this.haveRenderCallbacks=[];const d=[];this.addImages(e,s,d),this.addImages(r,l,d);const{w:p,h:m}=Od(d),_=new ar({width:p||1,height:m||1});for(const x in e){const S=e[x],I=s[x].paddedRect;ar.copy(S.data,_,{x:0,y:0},{x:I.x+Zi,y:I.y+Zi},S.data)}for(const x in r){const S=r[x],I=l[x].paddedRect,A=I.x+Zi,D=I.y+Zi,B=S.data.width,O=S.data.height;ar.copy(S.data,_,{x:0,y:0},{x:A,y:D},S.data),ar.copy(S.data,_,{x:0,y:O-1},{x:A,y:D-1},{width:B,height:1}),ar.copy(S.data,_,{x:0,y:0},{x:A,y:D+O},{width:B,height:1}),ar.copy(S.data,_,{x:B-1,y:0},{x:A-1,y:D},{width:1,height:O}),ar.copy(S.data,_,{x:0,y:0},{x:A+B,y:D},{width:1,height:O})}this.image=_,this.iconPositions=s,this.patternPositions=l}addImages(e,r,s){for(const l in e){const d=e[l],p={x:0,y:0,w:d.data.width+2*Zi,h:d.data.height+2*Zi};s.push(p),r[l]=new kh(p,d),d.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,d]=e.tl;s.update(r.data,void 0,{x:l,y:d})}}var Jn;Fe("ImagePosition",kh),Fe("ImageAtlas",Vd),T.ai=void 0,(Jn=T.ai||(T.ai={}))[Jn.none=0]="none",Jn[Jn.horizontal=1]="horizontal",Jn[Jn.vertical=2]="vertical",Jn[Jn.horizontalOnly=3]="horizontalOnly";const Ka=-17;class Ya{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(e,r){const s=new Ya;return s.scale=e||1,s.fontStack=r,s}static forImage(e){const r=new Ya;return r.imageName=e,r}}class Do{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,r){const s=new Do;for(let l=0;l<e.sections.length;l++){const d=e.sections[l];d.image?s.addImageSection(d):s.addTextSection(d,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,d=e.charCodeAt(s-1)||null;r+=l&&Xl(l)&&!Ja[e[s+1]]||d&&Xl(d)&&!Ja[e[s-1]]||!Ja[e[s]]?e[s]:Ja[e[s]]}return r}(this.text)}trim(){let e=0;for(let s=0;s<this.text.length&&uc[this.text.charCodeAt(s)];s++)e++;let r=this.text.length;for(let s=this.text.length-1;s>=0&&s>=e&&uc[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 Do;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(Ya.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 li("Can't add FormattedSection with an empty image.");const s=this.getNextImageSectionCharCode();s?(this.text+=String.fromCharCode(s),this.sections.push(Ya.forImage(r)),this.sectionIndex.push(this.sections.length-1)):li("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function hc(i,e,r,s,l,d,p,m,_,x,S,I,A,D,B){const O=Do.fromFeature(i,l);let q;I===T.ai.vertical&&O.verticalizePunctuation();const{processBidirectionalText:J,processStyledBidirectionalText:ae}=Yr;if(J&&O.sections.length===1){q=[];const de=J(O.toString(),Ih(O,x,d,e,s,D));for(const be of de){const Le=new Do;Le.text=be,Le.sections=O.sections;for(let We=0;We<be.length;We++)Le.sectionIndex.push(0);q.push(Le)}}else if(ae){q=[];const de=ae(O.text,O.sectionIndex,Ih(O,x,d,e,s,D));for(const be of de){const Le=new Do;Le.text=be[0],Le.sectionIndex=be[1],Le.sections=O.sections,q.push(Le)}}else q=function(de,be){const Le=[],We=de.text;let Me=0;for(const Pe of be)Le.push(de.substring(Me,Pe)),Me=Pe;return Me<We.length&&Le.push(de.substring(Me,We.length)),Le}(O,Ih(O,x,d,e,s,D));const Q=[],re={positionedLines:Q,text:O.toString(),top:S[1],bottom:S[1],left:S[0],right:S[0],writingMode:I,iconsInText:!1,verticalizable:!1};return function(de,be,Le,We,Me,Pe,Ue,Ve,Be,_e,Ze,$e){let et=0,It=Ka,kt=0,ni=0;const wr=Ve==="right"?1:Ve==="left"?0:.5;let yi=0;for(const Ht of Me){Ht.trim();const si=Ht.getMaxScale(),Ii=(si-1)*ii,xi={positionedGlyphs:[],lineOffset:0};de.positionedLines[yi]=xi;const Bi=xi.positionedGlyphs;let vi=0;if(!Ht.length()){It+=Pe,++yi;continue}for(let Gi=0;Gi<Ht.length();Gi++){const _t=Ht.getSection(Gi),At=Ht.getSectionIndex(Gi),Bt=Ht.getCharCode(Gi);let Ki=0,qt=null,Fo=null,rn=null,nn=ii;const Sr=!(Be===T.ai.horizontal||!Ze&&!Da(Bt)||Ze&&(uc[Bt]||(Gt=Bt,ze.Arabic(Gt)||ze["Arabic Supplement"](Gt)||ze["Arabic Extended-A"](Gt)||ze["Arabic Presentation Forms-A"](Gt)||ze["Arabic Presentation Forms-B"](Gt))));if(_t.imageName){const hr=We[_t.imageName];if(!hr)continue;rn=_t.imageName,de.iconsInText=de.iconsInText||!0,Fo=hr.paddedRect;const ai=hr.displaySize;_t.scale=_t.scale*ii/$e,qt={width:ai[0],height:ai[1],left:Zi,top:-Fd,advance:Sr?ai[1]:ai[0]},Ki=Ii+(ii-ai[1]*_t.scale),nn=qt.advance;const Tn=Sr?ai[0]*_t.scale-ii*si:ai[1]*_t.scale-ii*si;Tn>0&&Tn>vi&&(vi=Tn)}else{const hr=Le[_t.fontStack],ai=hr&&hr[Bt];if(ai&&ai.rect)Fo=ai.rect,qt=ai.metrics;else{const Tn=be[_t.fontStack],rl=Tn&&Tn[Bt];if(!rl)continue;qt=rl.metrics}Ki=(si-_t.scale)*ii}Sr?(de.verticalizable=!0,Bi.push({glyph:Bt,imageName:rn,x:et,y:It+Ki,vertical:Sr,scale:_t.scale,fontStack:_t.fontStack,sectionIndex:At,metrics:qt,rect:Fo}),et+=nn*_t.scale+_e):(Bi.push({glyph:Bt,imageName:rn,x:et,y:It+Ki,vertical:Sr,scale:_t.scale,fontStack:_t.fontStack,sectionIndex:At,metrics:qt,rect:Fo}),et+=qt.advance*_t.scale+_e)}Bi.length!==0&&(kt=Math.max(et-_e,kt),Vy(Bi,0,Bi.length-1,wr,vi)),et=0;const cr=Pe*si+vi;xi.lineOffset=Math.max(vi,Ii),It+=cr,ni=Math.max(cr,ni),++yi}var Gt;const Di=It-Ka,{horizontalAlign:Li,verticalAlign:Ri}=Ch(Ue);(function(Ht,si,Ii,xi,Bi,vi,cr,Gi,_t){const At=(si-Ii)*Bi;let Bt=0;Bt=vi!==cr?-Gi*xi-Ka:(-xi*_t+.5)*cr;for(const Ki of Ht)for(const qt of Ki.positionedGlyphs)qt.x+=At,qt.y+=Bt})(de.positionedLines,wr,Li,Ri,kt,ni,Pe,Di,Me.length),de.top+=-Ri*Di,de.bottom=de.top+Di,de.left+=-Li*kt,de.right=de.left+kt}(re,e,r,s,q,p,m,_,I,x,A,B),!function(de){for(const be of de)if(be.positionedGlyphs.length!==0)return!1;return!0}(Q)&&re}const uc={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},By={10:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},Fy={40:!0};function Nd(i,e,r,s,l,d){if(e.imageName){const p=s[e.imageName];return p?p.displaySize[0]*e.scale*ii/d+l:0}{const p=r[e.fontStack],m=p&&p[i];return m?m.metrics.advance*e.scale+l:0}}function $d(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 Oy(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 jd(i,e,r,s,l,d){let p=null,m=$d(e,r,l,d);for(const _ of s){const x=$d(e-_.x,r,l,d)+_.badness;x<=m&&(p=_,m=x)}return{index:i,x:e,priorBreak:p,badness:m}}function Ud(i){return i?Ud(i.priorBreak).concat(i.index):[]}function Ih(i,e,r,s,l,d){if(!i)return[];const p=[],m=function(I,A,D,B,O,q){let J=0;for(let ae=0;ae<I.length();ae++){const Q=I.getSection(ae);J+=Nd(I.getCharCode(ae),Q,B,O,A,q)}return J/Math.max(1,Math.ceil(J/D))}(i,e,r,s,l,d),_=i.text.indexOf("")>=0;let x=0;for(let I=0;I<i.length();I++){const A=i.getSection(I),D=i.getCharCode(I);if(uc[D]||(x+=Nd(D,A,s,l,e,d)),I<i.length()-1){const B=!((S=D)<11904||!(ze["Bopomofo Extended"](S)||ze.Bopomofo(S)||ze["CJK Compatibility Forms"](S)||ze["CJK Compatibility Ideographs"](S)||ze["CJK Compatibility"](S)||ze["CJK Radicals Supplement"](S)||ze["CJK Strokes"](S)||ze["CJK Symbols and Punctuation"](S)||ze["CJK Unified Ideographs Extension A"](S)||ze["CJK Unified Ideographs"](S)||ze["Enclosed CJK Letters and Months"](S)||ze["Halfwidth and Fullwidth Forms"](S)||ze.Hiragana(S)||ze["Ideographic Description Characters"](S)||ze["Kangxi Radicals"](S)||ze["Katakana Phonetic Extensions"](S)||ze.Katakana(S)||ze["Vertical Forms"](S)||ze["Yi Radicals"](S)||ze["Yi Syllables"](S)));(By[D]||B||A.imageName||I!==i.length()-2&&Fy[i.getCharCode(I+1)])&&p.push(jd(I+1,x,m,p,Oy(D,i.getCharCode(I+1),B&&_),!1))}}var S;return Ud(jd(i.length(),x,m,p,0,!0))}function Ch(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 Vy(i,e,r,s,l){if(!s&&!l)return;const d=i[r],p=(i[r].x+d.metrics.advance*d.scale)*s;for(let m=e;m<=r;m++)i[m].x-=p,i[m].y+=l}function Ny(i,e,r){const{horizontalAlign:s,verticalAlign:l}=Ch(r),d=e[0]-i.displaySize[0]*s,p=e[1]-i.displaySize[1]*l;return{image:i,top:p,bottom:p+i.displaySize[1],left:d,right:d+i.displaySize[0]}}function qd(i){var e,r;let s=i.left,l=i.top,d=i.right-s,p=i.bottom-l;const m=(e=i.image.textFitWidth)!==null&&e!==void 0?e:"stretchOrShrink",_=(r=i.image.textFitHeight)!==null&&r!==void 0?r:"stretchOrShrink",x=(i.image.content[2]-i.image.content[0])/(i.image.content[3]-i.image.content[1]);if(_==="proportional"){if(m==="stretchOnly"&&d/p<x||m==="proportional"){const S=Math.ceil(p*x);s*=S/d,d=S}}else if(m==="proportional"&&_==="stretchOnly"&&x!==0&&d/p>x){const S=Math.ceil(d/x);l*=S/p,p=S}return{x1:s,y1:l,x2:s+d,y2:l+p}}function Zd(i,e,r,s,l,d){const p=i.image;let m;if(p.content){const q=p.content,J=p.pixelRatio||1;m=[q[0]/J,q[1]/J,p.displaySize[0]-q[2]/J,p.displaySize[1]-q[3]/J]}const _=e.left*d,x=e.right*d;let S,I,A,D;r==="width"||r==="both"?(D=l[0]+_-s[3],I=l[0]+x+s[1]):(D=l[0]+(_+x-p.displaySize[0])/2,I=D+p.displaySize[0]);const B=e.top*d,O=e.bottom*d;return r==="height"||r==="both"?(S=l[1]+B-s[0],A=l[1]+O+s[2]):(S=l[1]+(B+O-p.displaySize[1])/2,A=S+p.displaySize[1]),{image:p,top:S,right:I,bottom:A,left:D,collisionPadding:m}}const Qa=255,tn=128,Kn=Qa*tn;function Gd(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 d=0;for(;d<s.length&&s[d]<=i;)d++;d=Math.max(0,d-1);let p=d;for(;p<s.length&&s[p]<i+1;)p++;p=Math.min(s.length-1,p);const m=s[d],_=s[p];return r.kind==="composite"?{kind:"composite",minZoom:m,maxZoom:_,interpolationType:l}:{kind:"camera",minZoom:m,maxZoom:_,minSize:r.evaluate(new Pt(m)),maxSize:r.evaluate(new Pt(_)),interpolationType:l}}}function Eh(i,e,r){let s="never";const l=i.get(e);return l?s=l:i.get(r)&&(s="always"),s}const $y=Wn.VectorTileFeature.types,jy=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function dc(i,e,r,s,l,d,p,m,_,x,S,I,A){const D=m?Math.min(Kn,Math.round(m[0])):0,B=m?Math.min(Kn,Math.round(m[1])):0;i.emplaceBack(e,r,Math.round(32*s),Math.round(32*l),d,p,(D<<1)+(_?1:0),B,16*x,16*S,256*I,256*A)}function Ph(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 Uy(i){for(const e of i.sections)if(La(e.text))return!0;return!1}class Ah{constructor(e){this.layoutVertexArray=new or,this.indexArray=new ri,this.programConfigurations=e,this.segments=new ti,this.dynamicLayoutVertexArray=new Qr,this.opacityVertexArray=new Zn,this.hasVisibleVertices=!1,this.placedSymbolArray=new Lt}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,xy.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,vy.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,jy,!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())}}Fe("SymbolBuffers",Ah);class Mh{constructor(e,r,s){this.layoutVertexArray=new e,this.layoutAttributes=r,this.indexArray=new s,this.segments=new ti,this.collisionVertexArray=new gi}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,by.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}Fe("CollisionBuffers",Mh);class Lo{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(p=>p.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=uh([]),this.placementViewportMatrix=uh([]);const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Gd(this.zoom,r["text-size"]),this.iconSizeData=Gd(this.zoom,r["icon-size"]);const s=this.layers[0].layout,l=s.get("symbol-sort-key"),d=s.get("symbol-z-order");this.canOverlap=Eh(s,"text-overlap","text-allow-overlap")!=="never"||Eh(s,"icon-overlap","icon-allow-overlap")!=="never"||s.get("text-ignore-placement")||s.get("icon-ignore-placement"),this.sortFeaturesByKey=d!=="viewport-y"&&!l.isConstant(),this.sortFeaturesByY=(d==="viewport-y"||d==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,s.get("symbol-placement")==="point"&&(this.writingModes=s.get("text-writing-mode").map(p=>T.ai[p])),this.stateDependentLayerIds=this.layers.filter(p=>p.isStateDependent()).map(p=>p.id),this.sourceID=e.sourceID}createArrays(){this.text=new Ah(new Ds(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new Ah(new Ds(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new Rt,this.lineVertexArray=new Mi,this.symbolInstances=new nr,this.textAnchorOffsets=new pi}calculateGlyphDependencies(e,r,s,l,d){for(let p=0;p<e.length;p++)if(r[e.charCodeAt(p)]=!0,(s||l)&&d){const m=Ja[e.charAt(p)];m&&(r[m.charCodeAt(0)]=!0)}}populate(e,r,s){const l=this.layers[0],d=l.layout,p=d.get("text-font"),m=d.get("text-field"),_=d.get("icon-image"),x=(m.value.kind!=="constant"||m.value.value instanceof Vi&&!m.value.value.isEmpty()||m.value.value.toString().length>0)&&(p.value.kind!=="constant"||p.value.value.length>0),S=_.value.kind!=="constant"||!!_.value.value||Object.keys(_.parameters).length>0,I=d.get("symbol-sort-key");if(this.features=[],!x&&!S)return;const A=r.iconDependencies,D=r.glyphDependencies,B=r.availableImages,O=new Pt(this.zoom);for(const{feature:q,id:J,index:ae,sourceLayerIndex:Q}of e){const re=l._featureFilter.needGeometry,de=Rs(q,re);if(!l._featureFilter.filter(O,de,s))continue;let be,Le;if(re||(de.geometry=Ls(q)),x){const Me=l.getValueAndResolveTokens("text-field",de,s,B),Pe=Vi.factory(Me),Ue=this.hasRTLText=this.hasRTLText||Uy(Pe);(!Ue||Yr.getRTLTextPluginStatus()==="unavailable"||Ue&&Yr.isParsed())&&(be=Sy(Pe,l,de))}if(S){const Me=l.getValueAndResolveTokens("icon-image",de,s,B);Le=Me instanceof ui?Me:ui.fromString(Me)}if(!be&&!Le)continue;const We=this.sortFeaturesByKey?I.evaluate(de,{},s):void 0;if(this.features.push({id:J,text:be,icon:Le,index:ae,sourceLayerIndex:Q,geometry:de.geometry,properties:q.properties,type:$y[q.type],sortKey:We}),Le&&(A[Le.name]=!0),be){const Me=p.evaluate(de,{},s).join(","),Pe=d.get("text-rotation-alignment")!=="viewport"&&d.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(T.ai.vertical)>=0;for(const Ue of be.sections)if(Ue.image)A[Ue.image.name]=!0;else{const Ve=za(be.toString()),Be=Ue.fontStack||Me,_e=D[Be]=D[Be]||{};this.calculateGlyphDependencies(Ue.text,_e,Pe,this.allowVerticalPlacement,Ve)}}}d.get("symbol-placement")==="line"&&(this.features=function(q){const J={},ae={},Q=[];let re=0;function de(Me){Q.push(q[Me]),re++}function be(Me,Pe,Ue){const Ve=ae[Me];return delete ae[Me],ae[Pe]=Ve,Q[Ve].geometry[0].pop(),Q[Ve].geometry[0]=Q[Ve].geometry[0].concat(Ue[0]),Ve}function Le(Me,Pe,Ue){const Ve=J[Pe];return delete J[Pe],J[Me]=Ve,Q[Ve].geometry[0].shift(),Q[Ve].geometry[0]=Ue[0].concat(Q[Ve].geometry[0]),Ve}function We(Me,Pe,Ue){const Ve=Ue?Pe[0][Pe[0].length-1]:Pe[0][0];return`${Me}:${Ve.x}:${Ve.y}`}for(let Me=0;Me<q.length;Me++){const Pe=q[Me],Ue=Pe.geometry,Ve=Pe.text?Pe.text.toString():null;if(!Ve){de(Me);continue}const Be=We(Ve,Ue),_e=We(Ve,Ue,!0);if(Be in ae&&_e in J&&ae[Be]!==J[_e]){const Ze=Le(Be,_e,Ue),$e=be(Be,_e,Q[Ze].geometry);delete J[Be],delete ae[_e],ae[We(Ve,Q[$e].geometry,!0)]=$e,Q[Ze].geometry=null}else Be in ae?be(Be,_e,Ue):_e in J?Le(Be,_e,Ue):(de(Me),J[Be]=re-1,ae[_e]=re-1)}return Q.filter(Me=>Me.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((q,J)=>q.sortKey-J.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]),d=e.dist(r[e.segment]);const p={};for(let m=e.segment+1;m<r.length;m++)p[m]={x:r[m].x,y:r[m].y,tileUnitDistanceFromAnchor:l},m<r.length-1&&(l+=r[m+1].dist(r[m]));for(let m=e.segment||0;m>=0;m--)p[m]={x:r[m].x,y:r[m].y,tileUnitDistanceFromAnchor:d},m>0&&(d+=r[m-1].dist(r[m]));for(let m=0;m<r.length;m++){const _=p[m];this.lineVertexArray.emplaceBack(_.x,_.y,_.tileUnitDistanceFromAnchor)}}return{lineStartIndex:s,lineLength:this.lineVertexArray.length-s}}addSymbols(e,r,s,l,d,p,m,_,x,S,I,A){const D=e.indexArray,B=e.layoutVertexArray,O=e.segments.prepareSegment(4*r.length,B,D,this.canOverlap?p.sortKey:void 0),q=this.glyphOffsetArray.length,J=O.vertexLength,ae=this.allowVerticalPlacement&&m===T.ai.vertical?Math.PI/2:0,Q=p.text&&p.text.sections;for(let re=0;re<r.length;re++){const{tl:de,tr:be,bl:Le,br:We,tex:Me,pixelOffsetTL:Pe,pixelOffsetBR:Ue,minFontScaleX:Ve,minFontScaleY:Be,glyphOffset:_e,isSDF:Ze,sectionIndex:$e}=r[re],et=O.vertexLength,It=_e[1];dc(B,_.x,_.y,de.x,It+de.y,Me.x,Me.y,s,Ze,Pe.x,Pe.y,Ve,Be),dc(B,_.x,_.y,be.x,It+be.y,Me.x+Me.w,Me.y,s,Ze,Ue.x,Pe.y,Ve,Be),dc(B,_.x,_.y,Le.x,It+Le.y,Me.x,Me.y+Me.h,s,Ze,Pe.x,Ue.y,Ve,Be),dc(B,_.x,_.y,We.x,It+We.y,Me.x+Me.w,Me.y+Me.h,s,Ze,Ue.x,Ue.y,Ve,Be),Ph(e.dynamicLayoutVertexArray,_,ae),D.emplaceBack(et,et+1,et+2),D.emplaceBack(et+1,et+2,et+3),O.vertexLength+=4,O.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(_e[0]),re!==r.length-1&&$e===r[re+1].sectionIndex||e.programConfigurations.populatePaintArrays(B.length,p,p.index,{},A,Q&&Q[$e])}e.placedSymbolArray.emplaceBack(_.x,_.y,q,this.glyphOffsetArray.length-q,J,x,S,_.segment,s?s[0]:0,s?s[1]:0,l[0],l[1],m,0,!1,0,I)}_addCollisionDebugVertex(e,r,s,l,d,p){return r.emplaceBack(0,0),e.emplaceBack(s.x,s.y,l,d,Math.round(p.x),Math.round(p.y))}addCollisionDebugVertices(e,r,s,l,d,p,m){const _=d.segments.prepareSegment(4,d.layoutVertexArray,d.indexArray),x=_.vertexLength,S=d.layoutVertexArray,I=d.collisionVertexArray,A=m.anchorX,D=m.anchorY;this._addCollisionDebugVertex(S,I,p,A,D,new le(e,r)),this._addCollisionDebugVertex(S,I,p,A,D,new le(s,r)),this._addCollisionDebugVertex(S,I,p,A,D,new le(s,l)),this._addCollisionDebugVertex(S,I,p,A,D,new le(e,l)),_.vertexLength+=4;const B=d.indexArray;B.emplaceBack(x,x+1),B.emplaceBack(x+1,x+2),B.emplaceBack(x+2,x+3),B.emplaceBack(x+3,x),_.primitiveLength+=4}addDebugCollisionBoxes(e,r,s,l){for(let d=e;d<r;d++){const p=this.collisionBoxArray.get(d);this.addCollisionDebugVertices(p.x1,p.y1,p.x2,p.y2,l?this.textCollisionBox:this.iconCollisionBox,p.anchorPoint,s)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Mh(mi,Pd.members,Nt),this.iconCollisionBox=new Mh(mi,Pd.members,Nt);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,d,p,m,_,x){const S={};for(let I=r;I<s;I++){const A=e.get(I);S.textBox={x1:A.x1,y1:A.y1,x2:A.x2,y2:A.y2,anchorPointX:A.anchorPointX,anchorPointY:A.anchorPointY},S.textFeatureIndex=A.featureIndex;break}for(let I=l;I<d;I++){const A=e.get(I);S.verticalTextBox={x1:A.x1,y1:A.y1,x2:A.x2,y2:A.y2,anchorPointX:A.anchorPointX,anchorPointY:A.anchorPointY},S.verticalTextFeatureIndex=A.featureIndex;break}for(let I=p;I<m;I++){const A=e.get(I);S.iconBox={x1:A.x1,y1:A.y1,x2:A.x2,y2:A.y2,anchorPointX:A.anchorPointX,anchorPointY:A.anchorPointY},S.iconFeatureIndex=A.featureIndex;break}for(let I=_;I<x;I++){const A=e.get(I);S.verticalIconBox={x1:A.x1,y1:A.y1,x2:A.x2,y2:A.y2,anchorPointX:A.anchorPointX,anchorPointY:A.anchorPointY},S.verticalIconFeatureIndex=A.featureIndex;break}return S}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 d=s.vertexStartIndex;d<l;d+=4)e.indexArray.emplaceBack(d,d+1,d+2),e.indexArray.emplaceBack(d+1,d+2,d+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const r=Math.sin(e),s=Math.cos(e),l=[],d=[],p=[];for(let m=0;m<this.symbolInstances.length;++m){p.push(m);const _=this.symbolInstances.get(m);l.push(0|Math.round(r*_.anchorX+s*_.anchorY)),d.push(_.featureIndex)}return p.sort((m,_)=>l[m]-l[_]||d[_]-d[m]),p}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,d,p)=>{l>=0&&p.indexOf(l)===d&&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 Hd,Xd;Fe("SymbolBucket",Lo,{omit:["layers","collisionBoxArray","features","compareText"]}),Lo.MAX_GLYPHS=65535,Lo.addDynamicAttributes=Ph;var zh={get paint(){return Xd=Xd||new o({"icon-opacity":new Je(ue.paint_symbol["icon-opacity"]),"icon-color":new Je(ue.paint_symbol["icon-color"]),"icon-halo-color":new Je(ue.paint_symbol["icon-halo-color"]),"icon-halo-width":new Je(ue.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Je(ue.paint_symbol["icon-halo-blur"]),"icon-translate":new qe(ue.paint_symbol["icon-translate"]),"icon-translate-anchor":new qe(ue.paint_symbol["icon-translate-anchor"]),"text-opacity":new Je(ue.paint_symbol["text-opacity"]),"text-color":new Je(ue.paint_symbol["text-color"],{runtimeType:Pi,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new Je(ue.paint_symbol["text-halo-color"]),"text-halo-width":new Je(ue.paint_symbol["text-halo-width"]),"text-halo-blur":new Je(ue.paint_symbol["text-halo-blur"]),"text-translate":new qe(ue.paint_symbol["text-translate"]),"text-translate-anchor":new qe(ue.paint_symbol["text-translate-anchor"])})},get layout(){return Hd=Hd||new o({"symbol-placement":new qe(ue.layout_symbol["symbol-placement"]),"symbol-spacing":new qe(ue.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new qe(ue.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Je(ue.layout_symbol["symbol-sort-key"]),"symbol-z-order":new qe(ue.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new qe(ue.layout_symbol["icon-allow-overlap"]),"icon-overlap":new qe(ue.layout_symbol["icon-overlap"]),"icon-ignore-placement":new qe(ue.layout_symbol["icon-ignore-placement"]),"icon-optional":new qe(ue.layout_symbol["icon-optional"]),"icon-rotation-alignment":new qe(ue.layout_symbol["icon-rotation-alignment"]),"icon-size":new Je(ue.layout_symbol["icon-size"]),"icon-text-fit":new qe(ue.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new qe(ue.layout_symbol["icon-text-fit-padding"]),"icon-image":new Je(ue.layout_symbol["icon-image"]),"icon-rotate":new Je(ue.layout_symbol["icon-rotate"]),"icon-padding":new Je(ue.layout_symbol["icon-padding"]),"icon-keep-upright":new qe(ue.layout_symbol["icon-keep-upright"]),"icon-offset":new Je(ue.layout_symbol["icon-offset"]),"icon-anchor":new Je(ue.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new qe(ue.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new qe(ue.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new qe(ue.layout_symbol["text-rotation-alignment"]),"text-field":new Je(ue.layout_symbol["text-field"]),"text-font":new Je(ue.layout_symbol["text-font"]),"text-size":new Je(ue.layout_symbol["text-size"]),"text-max-width":new Je(ue.layout_symbol["text-max-width"]),"text-line-height":new qe(ue.layout_symbol["text-line-height"]),"text-letter-spacing":new Je(ue.layout_symbol["text-letter-spacing"]),"text-justify":new Je(ue.layout_symbol["text-justify"]),"text-radial-offset":new Je(ue.layout_symbol["text-radial-offset"]),"text-variable-anchor":new qe(ue.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Je(ue.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Je(ue.layout_symbol["text-anchor"]),"text-max-angle":new qe(ue.layout_symbol["text-max-angle"]),"text-writing-mode":new qe(ue.layout_symbol["text-writing-mode"]),"text-rotate":new Je(ue.layout_symbol["text-rotate"]),"text-padding":new qe(ue.layout_symbol["text-padding"]),"text-keep-upright":new qe(ue.layout_symbol["text-keep-upright"]),"text-transform":new Je(ue.layout_symbol["text-transform"]),"text-offset":new Je(ue.layout_symbol["text-offset"]),"text-allow-overlap":new qe(ue.layout_symbol["text-allow-overlap"]),"text-overlap":new qe(ue.layout_symbol["text-overlap"]),"text-ignore-placement":new qe(ue.layout_symbol["text-ignore-placement"]),"text-optional":new qe(ue.layout_symbol["text-optional"])})}};class Wd{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:Zr,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}}Fe("FormatSectionOverride",Wd,{omit:["defaultValue"]});class pc extends h{constructor(e){super(e,zh)}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 d of s)l.indexOf(d)<0&&l.push(d);this.layout._values["text-writing-mode"]=l}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,r,s,l){const d=this.layout.get(e).evaluate(r,{},s,l),p=this._unevaluatedLayout._values[e];return p.isDataDriven()||Ss(p.value)||!d?d:function(m,_){return _.replace(/{([^{}]+)}/g,(x,S)=>m&&S in m?String(m[S]):"")}(r.properties,d)}createBucket(e){return new Lo(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const e of zh.paint.overridableProperties){if(!pc.hasPaintOverride(this.layout,e))continue;const r=this.paint.get(e),s=new Wd(r),l=new po(s,r.property.specification);let d=null;d=r.value.kind==="constant"||r.value.kind==="source"?new ua("source",l):new da("composite",l,r.value.zoomStops),this.paint._values[e]=new br(r.property,d,r.parameters)}}_handleOverridablePaintPropertyUpdate(e,r,s){return!(!this.layout||r.isDataDriven()||s.isDataDriven())&&pc.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,r){const s=e.get("text-field"),l=zh.paint.properties[r];let d=!1;const p=m=>{for(const _ of m)if(l.overrides&&l.overrides.hasOverride(_))return void(d=!0)};if(s.value.kind==="constant"&&s.value.value instanceof Vi)p(s.value.value.sections);else if(s.value.kind==="source"){const m=x=>{d||(x instanceof hn&&Yt(x.value)===Mr?p(x.value.sections):x instanceof Qs?p(x.sections):x.eachChild(m))},_=s.value;_._styleExpression&&m(_._styleExpression.expression)}return d}}let Jd;var qy={get paint(){return Jd=Jd||new o({"background-color":new qe(ue.paint_background["background-color"]),"background-pattern":new t(ue.paint_background["background-pattern"]),"background-opacity":new qe(ue.paint_background["background-opacity"])})}};class Zy extends h{constructor(e){super(e,qy)}}let Kd;var Gy={get paint(){return Kd=Kd||new o({"raster-opacity":new qe(ue.paint_raster["raster-opacity"]),"raster-hue-rotate":new qe(ue.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new qe(ue.paint_raster["raster-brightness-min"]),"raster-brightness-max":new qe(ue.paint_raster["raster-brightness-max"]),"raster-saturation":new qe(ue.paint_raster["raster-saturation"]),"raster-contrast":new qe(ue.paint_raster["raster-contrast"]),"raster-resampling":new qe(ue.paint_raster["raster-resampling"]),"raster-fade-duration":new qe(ue.paint_raster["raster-fade-duration"])})}};class Hy extends h{constructor(e){super(e,Gy)}}class Xy extends h{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")}}class Wy{constructor(e){this._methodToThrottle=e,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}const Dh=63710088e-1;class Yn{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 Yn(Xt(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,d=Math.sin(s)*Math.sin(l)+Math.cos(s)*Math.cos(l)*Math.cos((e.lng-this.lng)*r);return Dh*Math.acos(Math.min(d,1))}static convert(e){if(e instanceof Yn)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new Yn(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new Yn(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*Dh;function Qd(i){return Yd*Math.cos(i*Math.PI/180)}function ep(i){return(180+i)/360}function tp(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function ip(i,e){return i/Qd(e)}function Lh(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}class fc{constructor(e,r,s=0){this.x=+e,this.y=+r,this.z=+s}static fromLngLat(e,r=0){const s=Yn.convert(e);return new fc(ep(s.lng),tp(s.lat),ip(r,s.lat))}toLngLat(){return new Yn(360*this.x-180,Lh(this.y))}toAltitude(){return this.z*Qd(Lh(this.y))}meterInMercatorCoordinateUnits(){return 1/Yd*(e=Lh(this.y),1/Math.cos(e*Math.PI/180));var e}}function rp(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 Rh{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=el(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=(p=this.y,m=this.z,_=rp(256*(d=this.x),256*(p=Math.pow(2,m)-p-1),m),x=rp(256*(d+1),256*(p+1),m),_[0]+","+_[1]+","+x[0]+","+x[1]);var d,p,m,_,x;const S=function(I,A,D){let B,O="";for(let q=I;q>0;q--)B=1<<q-1,O+=(A&B?1:0)+(D&B?2:0);return O}(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,S).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 le((e.x*r-this.x)*Qt,(e.y*r-this.y)*Qt)}toString(){return`${this.z}/${this.x}/${this.y}`}}class np{constructor(e,r){this.wrap=e,this.canonical=r,this.key=el(e,r.z,r.z,r.x,r.y)}}class lr{constructor(e,r,s,l,d){if(e<s)throw new Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${s}`);this.overscaledZ=e,this.wrap=r,this.canonical=new Rh(s,+l,+d),this.key=el(r,e,s,l,d)}clone(){return new lr(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 lr(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new lr(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?el(this.wrap*+r,e,this.canonical.z,this.canonical.x,this.canonical.y):el(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 lr(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 lr(r,this.wrap,r,s,l),new lr(r,this.wrap,r,s+1,l),new lr(r,this.wrap,r,s,l+1),new lr(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 lr(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new lr(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 np(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new fc(e.x-this.wrap,e.y))}}function el(i,e,r,s,l){(i*=2)<0&&(i=-1*i-1);const d=1<<r;return(d*d*i+d*l+s).toString(36)+r.toString(36)+e.toString(36)}Fe("CanonicalTileID",Rh),Fe("OverscaledTileID",lr,{omit:["posMatrix"]});class sp{constructor(e,r,s,l=1,d=1,p=1,m=0){if(this.uid=e,r.height!==r.width)throw new RangeError("DEM tiles must be square");if(s&&!["mapbox","terrarium","custom"].includes(s))return void li(`"${s}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=r.height;const _=this.dim=r.height-2;switch(this.data=new Uint32Array(r.data.buffer),s){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=l,this.greenFactor=d,this.blueFactor=p,this.baseShift=m;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let x=0;x<_;x++)this.data[this._idx(-1,x)]=this.data[this._idx(0,x)],this.data[this._idx(_,x)]=this.data[this._idx(_-1,x)],this.data[this._idx(x,-1)]=this.data[this._idx(x,0)],this.data[this._idx(x,_)]=this.data[this._idx(x,_-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(_,-1)]=this.data[this._idx(_-1,0)],this.data[this._idx(-1,_)]=this.data[this._idx(0,_-1)],this.data[this._idx(_,_)]=this.data[this._idx(_-1,_-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let x=0;x<_;x++)for(let S=0;S<_;S++){const I=this.get(x,S);I>this.max&&(this.max=I),I<this.min&&(this.min=I)}}get(e,r){const s=new Uint8Array(this.data.buffer),l=4*this._idx(e,r);return this.unpack(s[l],s[l+1],s[l+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_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)}unpack(e,r,s){return e*this.redFactor+r*this.greenFactor+s*this.blueFactor-this.baseShift}getPixels(){return new ar({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,d=r*this.dim+this.dim,p=s*this.dim,m=s*this.dim+this.dim;switch(r){case-1:l=d-1;break;case 1:d=l+1}switch(s){case-1:p=m-1;break;case 1:m=p+1}const _=-r*this.dim,x=-s*this.dim;for(let S=p;S<m;S++)for(let I=l;I<d;I++)this.data[this._idx(I,S)]=e.data[this._idx(I+_,S+x)]}}Fe("DEMData",sp);class op{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 ap{constructor(e,r,s,l,d){this.type="Feature",this._vectorTileFeature=e,e._z=r,e._x=s,e._y=l,this.properties=e.properties,this.id=d}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 lp{constructor(e,r){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new $n(Qt,16,0),this.grid3D=new $n(Qt,16,0),this.featureIndexArray=new sr,this.promoteId=r}insert(e,r,s,l,d,p){const m=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(s,l,d);const _=p?this.grid3D:this.grid;for(let x=0;x<r.length;x++){const S=r[x],I=[1/0,1/0,-1/0,-1/0];for(let A=0;A<S.length;A++){const D=S[A];I[0]=Math.min(I[0],D.x),I[1]=Math.min(I[1],D.y),I[2]=Math.max(I[2],D.x),I[3]=Math.max(I[3],D.y)}I[0]<Qt&&I[1]<Qt&&I[2]>=0&&I[3]>=0&&_.insert(m,I[0],I[1],I[2],I[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Wn.VectorTile(new Sh(this.rawTileData)).layers,this.sourceLayerCoder=new op(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,r,s,l){this.loadVTLayers();const d=e.params||{},p=Qt/e.tileSize/e.scale,m=Ti(d.filter),_=e.queryGeometry,x=e.queryPadding*p,S=hp(_),I=this.grid.query(S.minX-x,S.minY-x,S.maxX+x,S.maxY+x),A=hp(e.cameraQueryGeometry),D=this.grid3D.query(A.minX-x,A.minY-x,A.maxX+x,A.maxY+x,(q,J,ae,Q)=>function(re,de,be,Le,We){for(const Pe of re)if(de<=Pe.x&&be<=Pe.y&&Le>=Pe.x&&We>=Pe.y)return!0;const Me=[new le(de,be),new le(de,We),new le(Le,We),new le(Le,be)];if(re.length>2){for(const Pe of Me)if(Co(re,Pe))return!0}for(let Pe=0;Pe<re.length-1;Pe++)if(P_(re[Pe],re[Pe+1],Me))return!0;return!1}(e.cameraQueryGeometry,q-x,J-x,ae+x,Q+x));for(const q of D)I.push(q);I.sort(Jy);const B={};let O;for(let q=0;q<I.length;q++){const J=I[q];if(J===O)continue;O=J;const ae=this.featureIndexArray.get(J);let Q=null;this.loadMatchingFeature(B,ae.bucketIndex,ae.sourceLayerIndex,ae.featureIndex,m,d.layers,d.availableImages,r,s,l,(re,de,be)=>(Q||(Q=Ls(re)),de.queryIntersectsFeature(_,re,be,Q,this.z,e.transform,p,e.pixelPosMatrix)))}return B}loadMatchingFeature(e,r,s,l,d,p,m,_,x,S,I){const A=this.bucketLayerIDs[r];if(p&&!function(q,J){for(let ae=0;ae<q.length;ae++)if(J.indexOf(q[ae])>=0)return!0;return!1}(p,A))return;const D=this.sourceLayerCoder.decode(s),B=this.vtLayers[D].feature(l);if(d.needGeometry){const q=Rs(B,!0);if(!d.filter(new Pt(this.tileID.overscaledZ),q,this.tileID.canonical))return}else if(!d.filter(new Pt(this.tileID.overscaledZ),B))return;const O=this.getId(B,D);for(let q=0;q<A.length;q++){const J=A[q];if(p&&p.indexOf(J)<0)continue;const ae=_[J];if(!ae)continue;let Q={};O&&S&&(Q=S.getState(ae.sourceLayer||"_geojsonTileLayer",O));const re=$t({},x[J]);re.paint=cp(re.paint,ae.paint,B,Q,m),re.layout=cp(re.layout,ae.layout,B,Q,m);const de=!I||I(B,ae,Q);if(!de)continue;const be=new ap(B,this.z,this.x,this.y,O);be.layer=re;let Le=e[J];Le===void 0&&(Le=e[J]=[]),Le.push({featureIndex:l,feature:be,intersectionZ:de})}}lookupSymbolFeatures(e,r,s,l,d,p,m,_){const x={};this.loadVTLayers();const S=Ti(d);for(const I of e)this.loadMatchingFeature(x,s,l,I,S,p,m,_,r);return x}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 cp(i,e,r,s,l){return bi(i,(d,p)=>{const m=e instanceof vo?e.get(p):null;return m&&m.evaluate?m.evaluate(r,s,l):m})}function hp(i){let e=1/0,r=1/0,s=-1/0,l=-1/0;for(const d of i)e=Math.min(e,d.x),r=Math.min(r,d.y),s=Math.max(s,d.x),l=Math.max(l,d.y);return{minX:e,minY:r,maxX:s,maxY:l}}function Jy(i,e){return e-i}function up(i,e,r,s,l){const d=[];for(let p=0;p<i.length;p++){const m=i[p];let _;for(let x=0;x<m.length-1;x++){let S=m[x],I=m[x+1];S.x<e&&I.x<e||(S.x<e?S=new le(e,S.y+(e-S.x)/(I.x-S.x)*(I.y-S.y))._round():I.x<e&&(I=new le(e,S.y+(e-S.x)/(I.x-S.x)*(I.y-S.y))._round()),S.y<r&&I.y<r||(S.y<r?S=new le(S.x+(r-S.y)/(I.y-S.y)*(I.x-S.x),r)._round():I.y<r&&(I=new le(S.x+(r-S.y)/(I.y-S.y)*(I.x-S.x),r)._round()),S.x>=s&&I.x>=s||(S.x>=s?S=new le(s,S.y+(s-S.x)/(I.x-S.x)*(I.y-S.y))._round():I.x>=s&&(I=new le(s,S.y+(s-S.x)/(I.x-S.x)*(I.y-S.y))._round()),S.y>=l&&I.y>=l||(S.y>=l?S=new le(S.x+(l-S.y)/(I.y-S.y)*(I.x-S.x),l)._round():I.y>=l&&(I=new le(S.x+(l-S.y)/(I.y-S.y)*(I.x-S.x),l)._round()),_&&S.equals(_[_.length-1])||(_=[S],d.push(_)),_.push(I)))))}}return d}Fe("FeatureIndex",lp,{omit:["rawTileData","sourceLayerCoder"]});class Qn extends le{constructor(e,r,s,l){super(e,r),this.angle=s,l!==void 0&&(this.segment=l)}clone(){return new Qn(this.x,this.y,this.angle,this.segment)}}function dp(i,e,r,s,l){if(e.segment===void 0||r===0)return!0;let d=e,p=e.segment+1,m=0;for(;m>-r/2;){if(p--,p<0)return!1;m-=i[p].dist(d),d=i[p]}m+=i[p].dist(i[p+1]),p++;const _=[];let x=0;for(;m<r/2;){const S=i[p],I=i[p+1];if(!I)return!1;let A=i[p-1].angleTo(S)-S.angleTo(I);for(A=Math.abs((A+3*Math.PI)%(2*Math.PI)-Math.PI),_.push({distance:m,angleDelta:A}),x+=A;m-_[0].distance>s;)x-=_.shift().angleDelta;if(x>l)return!1;p++,m+=S.dist(I)}return!0}function pp(i){let e=0;for(let r=0;r<i.length-1;r++)e+=i[r].dist(i[r+1]);return e}function fp(i,e,r){return i?.6*e*r:0}function mp(i,e){return Math.max(i?i.right-i.left:0,e?e.right-e.left:0)}function Ky(i,e,r,s,l,d){const p=fp(r,l,d),m=mp(r,s)*d;let _=0;const x=pp(i)/2;for(let S=0;S<i.length-1;S++){const I=i[S],A=i[S+1],D=I.dist(A);if(_+D>x){const B=(x-_)/D,O=ji.number(I.x,A.x,B),q=ji.number(I.y,A.y,B),J=new Qn(O,q,A.angleTo(I),S);return J._round(),!p||dp(i,J,m,p,e)?J:void 0}_+=D}}function Yy(i,e,r,s,l,d,p,m,_){const x=fp(s,d,p),S=mp(s,l),I=S*p,A=i[0].x===0||i[0].x===_||i[0].y===0||i[0].y===_;return e-I<e/4&&(e=I+e/4),gp(i,A?e/2*m%e:(S/2+2*d)*p*m%e,e,x,r,I,A,!1,_)}function gp(i,e,r,s,l,d,p,m,_){const x=d/2,S=pp(i);let I=0,A=e-r,D=[];for(let B=0;B<i.length-1;B++){const O=i[B],q=i[B+1],J=O.dist(q),ae=q.angleTo(O);for(;A+r<I+J;){A+=r;const Q=(A-I)/J,re=ji.number(O.x,q.x,Q),de=ji.number(O.y,q.y,Q);if(re>=0&&re<_&&de>=0&&de<_&&A-x>=0&&A+x<=S){const be=new Qn(re,de,ae,B);be._round(),s&&!dp(i,be,d,s,l)||D.push(be)}}I+=J}return m||D.length||p||(D=gp(i,I/2,r,s,l,d,p,!0,_)),D}Fe("Anchor",Qn);const Ro=Zi;function _p(i,e,r,s){const l=[],d=i.image,p=d.pixelRatio,m=d.paddedRect.w-2*Ro,_=d.paddedRect.h-2*Ro;let x={x1:i.left,y1:i.top,x2:i.right,y2:i.bottom};const S=d.stretchX||[[0,m]],I=d.stretchY||[[0,_]],A=(_e,Ze)=>_e+Ze[1]-Ze[0],D=S.reduce(A,0),B=I.reduce(A,0),O=m-D,q=_-B;let J=0,ae=D,Q=0,re=B,de=0,be=O,Le=0,We=q;if(d.content&&s){const _e=d.content,Ze=_e[2]-_e[0],$e=_e[3]-_e[1];(d.textFitWidth||d.textFitHeight)&&(x=qd(i)),J=mc(S,0,_e[0]),Q=mc(I,0,_e[1]),ae=mc(S,_e[0],_e[2]),re=mc(I,_e[1],_e[3]),de=_e[0]-J,Le=_e[1]-Q,be=Ze-ae,We=$e-re}const Me=x.x1,Pe=x.y1,Ue=x.x2-Me,Ve=x.y2-Pe,Be=(_e,Ze,$e,et)=>{const It=gc(_e.stretch-J,ae,Ue,Me),kt=_c(_e.fixed-de,be,_e.stretch,D),ni=gc(Ze.stretch-Q,re,Ve,Pe),wr=_c(Ze.fixed-Le,We,Ze.stretch,B),yi=gc($e.stretch-J,ae,Ue,Me),Gt=_c($e.fixed-de,be,$e.stretch,D),Di=gc(et.stretch-Q,re,Ve,Pe),Li=_c(et.fixed-Le,We,et.stretch,B),Ri=new le(It,ni),Ht=new le(yi,ni),si=new le(yi,Di),Ii=new le(It,Di),xi=new le(kt/p,wr/p),Bi=new le(Gt/p,Li/p),vi=e*Math.PI/180;if(vi){const _t=Math.sin(vi),At=Math.cos(vi),Bt=[At,-_t,_t,At];Ri._matMult(Bt),Ht._matMult(Bt),Ii._matMult(Bt),si._matMult(Bt)}const cr=_e.stretch+_e.fixed,Gi=Ze.stretch+Ze.fixed;return{tl:Ri,tr:Ht,bl:Ii,br:si,tex:{x:d.paddedRect.x+Ro+cr,y:d.paddedRect.y+Ro+Gi,w:$e.stretch+$e.fixed-cr,h:et.stretch+et.fixed-Gi},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:xi,pixelOffsetBR:Bi,minFontScaleX:be/p/Ue,minFontScaleY:We/p/Ve,isSDF:r}};if(s&&(d.stretchX||d.stretchY)){const _e=yp(S,O,D),Ze=yp(I,q,B);for(let $e=0;$e<_e.length-1;$e++){const et=_e[$e],It=_e[$e+1];for(let kt=0;kt<Ze.length-1;kt++)l.push(Be(et,Ze[kt],It,Ze[kt+1]))}}else l.push(Be({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:m+1},{fixed:0,stretch:_+1}));return l}function mc(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 yp(i,e,r){const s=[{fixed:-Ro,stretch:0}];for(const[l,d]of i){const p=s[s.length-1];s.push({fixed:l-p.stretch,stretch:p.stretch}),s.push({fixed:l-p.stretch,stretch:p.stretch+(d-l)})}return s.push({fixed:e+Ro,stretch:r}),s}function gc(i,e,r,s){return i/e*r+s}function _c(i,e,r,s){return i-e*r/s}class yc{constructor(e,r,s,l,d,p,m,_,x,S){var I;if(this.boxStartIndex=e.length,x){let A=p.top,D=p.bottom;const B=p.collisionPadding;B&&(A-=B[1],D+=B[3]);let O=D-A;O>0&&(O=Math.max(10,O),this.circleDiameter=O)}else{const A=!((I=p.image)===null||I===void 0)&&I.content&&(p.image.textFitWidth||p.image.textFitHeight)?qd(p):{x1:p.left,y1:p.top,x2:p.right,y2:p.bottom};A.y1=A.y1*m-_[0],A.y2=A.y2*m+_[2],A.x1=A.x1*m-_[3],A.x2=A.x2*m+_[1];const D=p.collisionPadding;if(D&&(A.x1-=D[0]*m,A.y1-=D[1]*m,A.x2+=D[2]*m,A.y2+=D[3]*m),S){const B=new le(A.x1,A.y1),O=new le(A.x2,A.y1),q=new le(A.x1,A.y2),J=new le(A.x2,A.y2),ae=S*Math.PI/180;B._rotate(ae),O._rotate(ae),q._rotate(ae),J._rotate(ae),A.x1=Math.min(B.x,O.x,q.x,J.x),A.x2=Math.max(B.x,O.x,q.x,J.x),A.y1=Math.min(B.y,O.y,q.y,J.y),A.y2=Math.max(B.y,O.y,q.y,J.y)}e.emplaceBack(r.x,r.y,A.x1,A.y1,A.x2,A.y2,s,l,d)}this.boxEndIndex=e.length}}class Qy{constructor(e=[],r=(s,l)=>s<l?-1:s>l?1:0){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._up(this.length++)}pop(){if(this.length===0)return;const e=this.data[0],r=this.data.pop();return--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 d=e-1>>1,p=r[d];if(s(l,p)>=0)break;r[e]=p,e=d}r[e]=l}_down(e){const{data:r,compare:s}=this,l=this.length>>1,d=r[e];for(;e<l;){let p=1+(e<<1);const m=p+1;if(m<this.length&&s(r[m],r[p])<0&&(p=m),s(r[p],d)>=0)break;r[e]=r[p],e=p}r[e]=d}}function e0(i,e=1,r=!1){let s=1/0,l=1/0,d=-1/0,p=-1/0;const m=i[0];for(let D=0;D<m.length;D++){const B=m[D];(!D||B.x<s)&&(s=B.x),(!D||B.y<l)&&(l=B.y),(!D||B.x>d)&&(d=B.x),(!D||B.y>p)&&(p=B.y)}const _=Math.min(d-s,p-l);let x=_/2;const S=new Qy([],t0);if(_===0)return new le(s,l);for(let D=s;D<d;D+=_)for(let B=l;B<p;B+=_)S.push(new Bo(D+x,B+x,x,i));let I=function(D){let B=0,O=0,q=0;const J=D[0];for(let ae=0,Q=J.length,re=Q-1;ae<Q;re=ae++){const de=J[ae],be=J[re],Le=de.x*be.y-be.x*de.y;O+=(de.x+be.x)*Le,q+=(de.y+be.y)*Le,B+=3*Le}return new Bo(O/B,q/B,0,D)}(i),A=S.length;for(;S.length;){const D=S.pop();(D.d>I.d||!I.d)&&(I=D,r&&console.log("found best %d after %d probes",Math.round(1e4*D.d)/1e4,A)),D.max-I.d<=e||(x=D.h/2,S.push(new Bo(D.p.x-x,D.p.y-x,x,i)),S.push(new Bo(D.p.x+x,D.p.y-x,x,i)),S.push(new Bo(D.p.x-x,D.p.y+x,x,i)),S.push(new Bo(D.p.x+x,D.p.y+x,x,i)),A+=4)}return r&&(console.log(`num probes: ${A}`),console.log(`best distance: ${I.d}`)),I.p}function t0(i,e){return e.max-i.max}function Bo(i,e,r,s){this.p=new le(i,e),this.h=r,this.d=function(l,d){let p=!1,m=1/0;for(let _=0;_<d.length;_++){const x=d[_];for(let S=0,I=x.length,A=I-1;S<I;A=S++){const D=x[S],B=x[A];D.y>l.y!=B.y>l.y&&l.x<(B.x-D.x)*(l.y-D.y)/(B.y-D.y)+D.x&&(p=!p),m=Math.min(m,td(l,D,B))}}return(p?1:-1)*Math.sqrt(m)}(this.p,s),this.max=this.d+this.h*Math.SQRT2}var _i;T.ar=void 0,(_i=T.ar||(T.ar={}))[_i.center=1]="center",_i[_i.left=2]="left",_i[_i.right=3]="right",_i[_i.top=4]="top",_i[_i.bottom=5]="bottom",_i[_i["top-left"]=6]="top-left",_i[_i["top-right"]=7]="top-right",_i[_i["bottom-left"]=8]="bottom-left",_i[_i["bottom-right"]=9]="bottom-right";const es=7,Bh=Number.POSITIVE_INFINITY;function xp(i,e){return e[1]!==Bh?function(r,s,l){let d=0,p=0;switch(s=Math.abs(s),l=Math.abs(l),r){case"top-right":case"top-left":case"top":p=l-es;break;case"bottom-right":case"bottom-left":case"bottom":p=-l+es}switch(r){case"top-right":case"bottom-right":case"right":d=-s;break;case"top-left":case"bottom-left":case"left":d=s}return[d,p]}(i,e[0],e[1]):function(r,s){let l=0,d=0;s<0&&(s=0);const p=s/Math.SQRT2;switch(r){case"top-right":case"top-left":d=p-es;break;case"bottom-right":case"bottom-left":d=-p+es;break;case"bottom":d=-s+es;break;case"top":d=s-es}switch(r){case"top-right":case"bottom-right":l=-p;break;case"top-left":case"bottom-left":l=p;break;case"left":l=s;break;case"right":l=-s}return[l,d]}(i,e[0])}function vp(i,e,r){var s;const l=i.layout,d=(s=l.get("text-variable-anchor-offset"))===null||s===void 0?void 0:s.evaluate(e,{},r);if(d){const m=d.values,_=[];for(let x=0;x<m.length;x+=2){const S=_[x]=m[x],I=m[x+1].map(A=>A*ii);S.startsWith("top")?I[1]-=es:S.startsWith("bottom")&&(I[1]+=es),_[x+1]=I}return new $i(_)}const p=l.get("text-variable-anchor");if(p){let m;m=i._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[l.get("text-radial-offset").evaluate(e,{},r)*ii,Bh]:l.get("text-offset").evaluate(e,{},r).map(x=>x*ii);const _=[];for(const x of p)_.push(x,xp(x,m));return new $i(_)}return null}function Fh(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 i0(i,e,r,s,l,d,p,m,_,x,S){let I=d.textMaxSize.evaluate(e,{});I===void 0&&(I=p);const A=i.layers[0].layout,D=A.get("icon-offset").evaluate(e,{},S),B=wp(r.horizontal),O=p/24,q=i.tilePixelRatio*O,J=i.tilePixelRatio*I/24,ae=i.tilePixelRatio*m,Q=i.tilePixelRatio*A.get("symbol-spacing"),re=A.get("text-padding")*i.tilePixelRatio,de=function(_e,Ze,$e,et=1){const It=_e.get("icon-padding").evaluate(Ze,{},$e),kt=It&&It.values;return[kt[0]*et,kt[1]*et,kt[2]*et,kt[3]*et]}(A,e,S,i.tilePixelRatio),be=A.get("text-max-angle")/180*Math.PI,Le=A.get("text-rotation-alignment")!=="viewport"&&A.get("symbol-placement")!=="point",We=A.get("icon-rotation-alignment")==="map"&&A.get("symbol-placement")!=="point",Me=A.get("symbol-placement"),Pe=Q/2,Ue=A.get("icon-text-fit");let Ve;s&&Ue!=="none"&&(i.allowVerticalPlacement&&r.vertical&&(Ve=Zd(s,r.vertical,Ue,A.get("icon-text-fit-padding"),D,O)),B&&(s=Zd(s,B,Ue,A.get("icon-text-fit-padding"),D,O)));const Be=(_e,Ze)=>{Ze.x<0||Ze.x>=Qt||Ze.y<0||Ze.y>=Qt||function($e,et,It,kt,ni,wr,yi,Gt,Di,Li,Ri,Ht,si,Ii,xi,Bi,vi,cr,Gi,_t,At,Bt,Ki,qt,Fo){const rn=$e.addToLineVertexArray(et,It);let nn,Sr,hr,ai,Tn=0,rl=0,Ip=0,Cp=0,Zh=-1,Gh=-1;const kn={};let Ep=ko("");if($e.allowVerticalPlacement&&kt.vertical){const Ci=Gt.layout.get("text-rotate").evaluate(At,{},qt)+90;hr=new yc(Di,et,Li,Ri,Ht,kt.vertical,si,Ii,xi,Ci),yi&&(ai=new yc(Di,et,Li,Ri,Ht,yi,vi,cr,xi,Ci))}if(ni){const Ci=Gt.layout.get("icon-rotate").evaluate(At,{}),ur=Gt.layout.get("icon-text-fit")!=="none",Fs=_p(ni,Ci,Ki,ur),Or=yi?_p(yi,Ci,Ki,ur):void 0;Sr=new yc(Di,et,Li,Ri,Ht,ni,vi,cr,!1,Ci),Tn=4*Fs.length;const Os=$e.iconSizeData;let sn=null;Os.kind==="source"?(sn=[tn*Gt.layout.get("icon-size").evaluate(At,{})],sn[0]>Kn&&li(`${$e.layerIds[0]}: Value for "icon-size" is >= ${Qa}. Reduce your "icon-size".`)):Os.kind==="composite"&&(sn=[tn*Bt.compositeIconSizes[0].evaluate(At,{},qt),tn*Bt.compositeIconSizes[1].evaluate(At,{},qt)],(sn[0]>Kn||sn[1]>Kn)&&li(`${$e.layerIds[0]}: Value for "icon-size" is >= ${Qa}. Reduce your "icon-size".`)),$e.addSymbols($e.icon,Fs,sn,_t,Gi,At,T.ai.none,et,rn.lineStartIndex,rn.lineLength,-1,qt),Zh=$e.icon.placedSymbolArray.length-1,Or&&(rl=4*Or.length,$e.addSymbols($e.icon,Or,sn,_t,Gi,At,T.ai.vertical,et,rn.lineStartIndex,rn.lineLength,-1,qt),Gh=$e.icon.placedSymbolArray.length-1)}const Pp=Object.keys(kt.horizontal);for(const Ci of Pp){const ur=kt.horizontal[Ci];if(!nn){Ep=ko(ur.text);const Or=Gt.layout.get("text-rotate").evaluate(At,{},qt);nn=new yc(Di,et,Li,Ri,Ht,ur,si,Ii,xi,Or)}const Fs=ur.positionedLines.length===1;if(Ip+=bp($e,et,ur,wr,Gt,xi,At,Bi,rn,kt.vertical?T.ai.horizontal:T.ai.horizontalOnly,Fs?Pp:[Ci],kn,Zh,Bt,qt),Fs)break}kt.vertical&&(Cp+=bp($e,et,kt.vertical,wr,Gt,xi,At,Bi,rn,T.ai.vertical,["vertical"],kn,Gh,Bt,qt));const s0=nn?nn.boxStartIndex:$e.collisionBoxArray.length,o0=nn?nn.boxEndIndex:$e.collisionBoxArray.length,a0=hr?hr.boxStartIndex:$e.collisionBoxArray.length,l0=hr?hr.boxEndIndex:$e.collisionBoxArray.length,c0=Sr?Sr.boxStartIndex:$e.collisionBoxArray.length,h0=Sr?Sr.boxEndIndex:$e.collisionBoxArray.length,u0=ai?ai.boxStartIndex:$e.collisionBoxArray.length,d0=ai?ai.boxEndIndex:$e.collisionBoxArray.length;let Fr=-1;const vc=(Ci,ur)=>Ci&&Ci.circleDiameter?Math.max(Ci.circleDiameter,ur):ur;Fr=vc(nn,Fr),Fr=vc(hr,Fr),Fr=vc(Sr,Fr),Fr=vc(ai,Fr);const Ap=Fr>-1?1:0;Ap&&(Fr*=Fo/ii),$e.glyphOffsetArray.length>=Lo.MAX_GLYPHS&&li("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),At.sortKey!==void 0&&$e.addToSortKeyRanges($e.symbolInstances.length,At.sortKey);const p0=vp(Gt,At,qt),[f0,m0]=function(Ci,ur){const Fs=Ci.length,Or=ur==null?void 0:ur.values;if((Or==null?void 0:Or.length)>0)for(let Os=0;Os<Or.length;Os+=2){const sn=Or[Os+1];Ci.emplaceBack(T.ar[Or[Os]],sn[0],sn[1])}return[Fs,Ci.length]}($e.textAnchorOffsets,p0);$e.symbolInstances.emplaceBack(et.x,et.y,kn.right>=0?kn.right:-1,kn.center>=0?kn.center:-1,kn.left>=0?kn.left:-1,kn.vertical||-1,Zh,Gh,Ep,s0,o0,a0,l0,c0,h0,u0,d0,Li,Ip,Cp,Tn,rl,Ap,0,si,Fr,f0,m0)}(i,Ze,_e,r,s,l,Ve,i.layers[0],i.collisionBoxArray,e.index,e.sourceLayerIndex,i.index,q,[re,re,re,re],Le,_,ae,de,We,D,e,d,x,S,p)};if(Me==="line")for(const _e of up(e.geometry,0,0,Qt,Qt)){const Ze=Yy(_e,Q,be,r.vertical||B,s,24,J,i.overscaling,Qt);for(const $e of Ze)B&&r0(i,B.text,Pe,$e)||Be(_e,$e)}else if(Me==="line-center"){for(const _e of e.geometry)if(_e.length>1){const Ze=Ky(_e,be,r.vertical||B,s,24,J);Ze&&Be(_e,Ze)}}else if(e.type==="Polygon")for(const _e of to(e.geometry,0)){const Ze=e0(_e,16);Be(_e[0],new Qn(Ze.x,Ze.y,0))}else if(e.type==="LineString")for(const _e of e.geometry)Be(_e,new Qn(_e[0].x,_e[0].y,0));else if(e.type==="Point")for(const _e of e.geometry)for(const Ze of _e)Be([Ze],new Qn(Ze.x,Ze.y,0))}function bp(i,e,r,s,l,d,p,m,_,x,S,I,A,D,B){const O=function(ae,Q,re,de,be,Le,We,Me){const Pe=de.layout.get("text-rotate").evaluate(Le,{})*Math.PI/180,Ue=[];for(const Ve of Q.positionedLines)for(const Be of Ve.positionedGlyphs){if(!Be.rect)continue;const _e=Be.rect||{};let Ze=Fd+1,$e=!0,et=1,It=0;const kt=(be||Me)&&Be.vertical,ni=Be.metrics.advance*Be.scale/2;if(Me&&Q.verticalizable&&(It=Ve.lineOffset/2-(Be.imageName?-(ii-Be.metrics.width*Be.scale)/2:(Be.scale-1)*ii)),Be.imageName){const _t=We[Be.imageName];$e=_t.sdf,et=_t.pixelRatio,Ze=Zi/et}const wr=be?[Be.x+ni,Be.y]:[0,0];let yi=be?[0,0]:[Be.x+ni+re[0],Be.y+re[1]-It],Gt=[0,0];kt&&(Gt=yi,yi=[0,0]);const Di=Be.metrics.isDoubleResolution?2:1,Li=(Be.metrics.left-Ze)*Be.scale-ni+yi[0],Ri=(-Be.metrics.top-Ze)*Be.scale+yi[1],Ht=Li+_e.w/Di*Be.scale/et,si=Ri+_e.h/Di*Be.scale/et,Ii=new le(Li,Ri),xi=new le(Ht,Ri),Bi=new le(Li,si),vi=new le(Ht,si);if(kt){const _t=new le(-ni,ni-Ka),At=-Math.PI/2,Bt=ii/2-ni,Ki=new le(5-Ka-Bt,-(Be.imageName?Bt:0)),qt=new le(...Gt);Ii._rotateAround(At,_t)._add(Ki)._add(qt),xi._rotateAround(At,_t)._add(Ki)._add(qt),Bi._rotateAround(At,_t)._add(Ki)._add(qt),vi._rotateAround(At,_t)._add(Ki)._add(qt)}if(Pe){const _t=Math.sin(Pe),At=Math.cos(Pe),Bt=[At,-_t,_t,At];Ii._matMult(Bt),xi._matMult(Bt),Bi._matMult(Bt),vi._matMult(Bt)}const cr=new le(0,0),Gi=new le(0,0);Ue.push({tl:Ii,tr:xi,bl:Bi,br:vi,tex:_e,writingMode:Q.writingMode,glyphOffset:wr,sectionIndex:Be.sectionIndex,isSDF:$e,pixelOffsetTL:cr,pixelOffsetBR:Gi,minFontScaleX:0,minFontScaleY:0})}return Ue}(0,r,m,l,d,p,s,i.allowVerticalPlacement),q=i.textSizeData;let J=null;q.kind==="source"?(J=[tn*l.layout.get("text-size").evaluate(p,{})],J[0]>Kn&&li(`${i.layerIds[0]}: Value for "text-size" is >= ${Qa}. Reduce your "text-size".`)):q.kind==="composite"&&(J=[tn*D.compositeTextSizes[0].evaluate(p,{},B),tn*D.compositeTextSizes[1].evaluate(p,{},B)],(J[0]>Kn||J[1]>Kn)&&li(`${i.layerIds[0]}: Value for "text-size" is >= ${Qa}. Reduce your "text-size".`)),i.addSymbols(i.text,O,J,m,d,p,x,e,_.lineStartIndex,_.lineLength,A,B);for(const ae of S)I[ae]=i.text.placedSymbolArray.length-1;return 4*O.length}function wp(i){for(const e in i)return i[e];return null}function r0(i,e,r,s){const l=i.compareText;if(e in l){const d=l[e];for(let p=d.length-1;p>=0;p--)if(s.dist(d[p])<r)return!0}else l[e]=[];return l[e].push(s),!1}const Sp=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Oh{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 d=Sp[15&s];if(!d)throw new Error("Unrecognized array type.");const[p]=new Uint16Array(e,2,1),[m]=new Uint32Array(e,4,1);return new Oh(m,p,d,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 d=Sp.indexOf(this.ArrayType),p=2*e*this.ArrayType.BYTES_PER_ELEMENT,m=e*this.IndexArrayType.BYTES_PER_ELEMENT,_=(8-m%8)%8;if(d<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+m+_,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+p+m+_),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+m+_,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+d]),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 Vh(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:d,coords:p,nodeSize:m}=this,_=[0,d.length-1,0],x=[];for(;_.length;){const S=_.pop()||0,I=_.pop()||0,A=_.pop()||0;if(I-A<=m){for(let q=A;q<=I;q++){const J=p[2*q],ae=p[2*q+1];J>=e&&J<=s&&ae>=r&&ae<=l&&x.push(d[q])}continue}const D=A+I>>1,B=p[2*D],O=p[2*D+1];B>=e&&B<=s&&O>=r&&O<=l&&x.push(d[D]),(S===0?e<=B:r<=O)&&(_.push(A),_.push(D-1),_.push(1-S)),(S===0?s>=B:l>=O)&&(_.push(D+1),_.push(I),_.push(1-S))}return x}within(e,r,s){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:l,coords:d,nodeSize:p}=this,m=[0,l.length-1,0],_=[],x=s*s;for(;m.length;){const S=m.pop()||0,I=m.pop()||0,A=m.pop()||0;if(I-A<=p){for(let q=A;q<=I;q++)kp(d[2*q],d[2*q+1],e,r)<=x&&_.push(l[q]);continue}const D=A+I>>1,B=d[2*D],O=d[2*D+1];kp(B,O,e,r)<=x&&_.push(l[D]),(S===0?e-s<=B:r-s<=O)&&(m.push(A),m.push(D-1),m.push(1-S)),(S===0?e+s>=B:r+s>=O)&&(m.push(D+1),m.push(I),m.push(1-S))}return _}}function Vh(i,e,r,s,l,d){if(l-s<=r)return;const p=s+l>>1;Tp(i,e,p,s,l,d),Vh(i,e,r,s,p-1,1-d),Vh(i,e,r,p+1,l,1-d)}function Tp(i,e,r,s,l,d){for(;l>s;){if(l-s>600){const x=l-s+1,S=r-s+1,I=Math.log(x),A=.5*Math.exp(2*I/3),D=.5*Math.sqrt(I*A*(x-A)/x)*(S-x/2<0?-1:1);Tp(i,e,r,Math.max(s,Math.floor(r-S*A/x+D)),Math.min(l,Math.floor(r+(x-S)*A/x+D)),d)}const p=e[2*r+d];let m=s,_=l;for(tl(i,e,s,r),e[2*l+d]>p&&tl(i,e,s,l);m<_;){for(tl(i,e,m,_),m++,_--;e[2*m+d]<p;)m++;for(;e[2*_+d]>p;)_--}e[2*s+d]===p?tl(i,e,s,_):(_++,tl(i,e,_,l)),_<=r&&(s=_+1),r<=_&&(l=_-1)}}function tl(i,e,r,s){Nh(i,r,s),Nh(e,2*r,2*s),Nh(e,2*r+1,2*s+1)}function Nh(i,e,r){const s=i[e];i[e]=i[r],i[r]=s}function kp(i,e,r,s){const l=i-r,d=e-s;return l*l+d*d}var $h;T.bf=void 0,($h=T.bf||(T.bf={})).create="create",$h.load="load",$h.fullLoad="fullLoad";let xc=null,il=[];const jh=1e3/60,Uh="loadTime",qh="fullLoadTime",n0={mark(i){performance.mark(i)},frame(i){const e=i;xc!=null&&il.push(e-xc),xc=e},clearMetrics(){xc=null,il=[],performance.clearMeasures(Uh),performance.clearMeasures(qh);for(const i in T.bf)performance.clearMarks(T.bf[i])},getPerformanceMetrics(){performance.measure(Uh,T.bf.create,T.bf.load),performance.measure(qh,T.bf.create,T.bf.fullLoad);const i=performance.getEntriesByName(Uh)[0].duration,e=performance.getEntriesByName(qh)[0].duration,r=il.length,s=1/(il.reduce((d,p)=>d+p,0)/r/1e3),l=il.filter(d=>d>jh).reduce((d,p)=>d+(p-jh)/jh,0);return{loadTime:i,fullLoadTime:e,fps:s,percentDroppedFrames:l/(r+l)*100,totalFrames:r}}};T.$=class extends F{},T.A=Eo,T.B=Pa,T.C=function(i){if(En==null){const e=i.navigator?i.navigator.userAgent:null;En=!!i.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return En},T.D=qe,T.E=Mn,T.F=class{constructor(i,e){this.target=i,this.mapId=e,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new Wy(()=>this.process()),this.subscription=function(r,s,l,d){return r.addEventListener(s,l,!1),{unsubscribe:()=>{r.removeEventListener(s,l,!1)}}}(this.target,"message",r=>this.receive(r)),this.globalScope=Cr(self)?i:window}registerMessageHandler(i,e){this.messageHandlers[i]=e}sendAsync(i,e){return new Promise((r,s)=>{const l=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[l]={resolve:r,reject:s},e&&e.signal.addEventListener("abort",()=>{delete this.resolveRejects[l];const m={id:l,type:"<cancel>",origin:location.origin,targetMapId:i.targetMapId,sourceMapId:this.mapId};this.target.postMessage(m)},{once:!0});const d=[],p=Object.assign(Object.assign({},i),{id:l,sourceMapId:this.mapId,origin:location.origin,data:As(i.data,d)});this.target.postMessage(p,{transfer:d})})}receive(i){const e=i.data,r=e.id;if(!(e.origin!=="file://"&&location.origin!=="file://"&&e.origin!=="resource://android"&&location.origin!=="resource://android"&&e.origin!==location.origin||e.targetMapId&&this.mapId!==e.targetMapId)){if(e.type==="<cancel>"){delete this.tasks[r];const s=this.abortControllers[r];return delete this.abortControllers[r],void(s&&s.abort())}if(Cr(self)||e.mustQueue)return this.tasks[r]=e,this.taskQueue.push(r),void this.invoker.trigger();this.processTask(r,e)}}process(){if(this.taskQueue.length===0)return;const i=this.taskQueue.shift(),e=this.tasks[i];delete this.tasks[i],this.taskQueue.length>0&&this.invoker.trigger(),e&&this.processTask(i,e)}processTask(i,e){return c(this,void 0,void 0,function*(){if(e.type==="<response>"){const l=this.resolveRejects[i];return delete this.resolveRejects[i],l?void(e.error?l.reject(vr(e.error)):l.resolve(vr(e.data))):void 0}if(!this.messageHandlers[e.type])return void this.completeTask(i,new Error(`Could not find a registered handler for ${e.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const r=vr(e.data),s=new AbortController;this.abortControllers[i]=s;try{const l=yield this.messageHandlers[e.type](e.sourceMapId,r,s);this.completeTask(i,null,l)}catch(l){this.completeTask(i,l)}})}completeTask(i,e,r){const s=[];delete this.abortControllers[i];const l={id:i,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:e?As(e):null,data:As(r,s)};this.target.postMessage(l,{transfer:s})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},T.G=An,T.H=function(){var i=new Eo(16);return Eo!=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},T.I=kh,T.J=function(i,e,r){var s,l,d,p,m,_,x,S,I,A,D,B,O=r[0],q=r[1],J=r[2];return e===i?(i[12]=e[0]*O+e[4]*q+e[8]*J+e[12],i[13]=e[1]*O+e[5]*q+e[9]*J+e[13],i[14]=e[2]*O+e[6]*q+e[10]*J+e[14],i[15]=e[3]*O+e[7]*q+e[11]*J+e[15]):(l=e[1],d=e[2],p=e[3],m=e[4],_=e[5],x=e[6],S=e[7],I=e[8],A=e[9],D=e[10],B=e[11],i[0]=s=e[0],i[1]=l,i[2]=d,i[3]=p,i[4]=m,i[5]=_,i[6]=x,i[7]=S,i[8]=I,i[9]=A,i[10]=D,i[11]=B,i[12]=s*O+m*q+I*J+e[12],i[13]=l*O+_*q+A*J+e[13],i[14]=d*O+x*q+D*J+e[14],i[15]=p*O+S*q+B*J+e[15]),i},T.K=function(i,e,r){var s=r[0],l=r[1],d=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]*d,i[9]=e[9]*d,i[10]=e[10]*d,i[11]=e[11]*d,i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i},T.L=sd,T.M=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},T.N=Yn,T.O=ep,T.P=le,T.Q=tp,T.R=ar,T.S=lr,T.T=Un,T.U=ft,T.V=st,T.W=on,T.X=Qt,T.Y=w,T.Z=fc,T._=c,T.a=$r,T.a$=function(i,e){var r=i[0],s=i[1],l=i[2],d=i[3],p=i[4],m=i[5],_=i[6],x=i[7],S=i[8],I=i[9],A=i[10],D=i[11],B=i[12],O=i[13],q=i[14],J=i[15],ae=e[0],Q=e[1],re=e[2],de=e[3],be=e[4],Le=e[5],We=e[6],Me=e[7],Pe=e[8],Ue=e[9],Ve=e[10],Be=e[11],_e=e[12],Ze=e[13],$e=e[14],et=e[15];return Math.abs(r-ae)<=zi*Math.max(1,Math.abs(r),Math.abs(ae))&&Math.abs(s-Q)<=zi*Math.max(1,Math.abs(s),Math.abs(Q))&&Math.abs(l-re)<=zi*Math.max(1,Math.abs(l),Math.abs(re))&&Math.abs(d-de)<=zi*Math.max(1,Math.abs(d),Math.abs(de))&&Math.abs(p-be)<=zi*Math.max(1,Math.abs(p),Math.abs(be))&&Math.abs(m-Le)<=zi*Math.max(1,Math.abs(m),Math.abs(Le))&&Math.abs(_-We)<=zi*Math.max(1,Math.abs(_),Math.abs(We))&&Math.abs(x-Me)<=zi*Math.max(1,Math.abs(x),Math.abs(Me))&&Math.abs(S-Pe)<=zi*Math.max(1,Math.abs(S),Math.abs(Pe))&&Math.abs(I-Ue)<=zi*Math.max(1,Math.abs(I),Math.abs(Ue))&&Math.abs(A-Ve)<=zi*Math.max(1,Math.abs(A),Math.abs(Ve))&&Math.abs(D-Be)<=zi*Math.max(1,Math.abs(D),Math.abs(Be))&&Math.abs(B-_e)<=zi*Math.max(1,Math.abs(B),Math.abs(_e))&&Math.abs(O-Ze)<=zi*Math.max(1,Math.abs(O),Math.abs(Ze))&&Math.abs(q-$e)<=zi*Math.max(1,Math.abs(q),Math.abs($e))&&Math.abs(J-et)<=zi*Math.max(1,Math.abs(J),Math.abs(et))},T.a0=ti,T.a1=Rh,T.a2=ke,T.a3=i=>{const e=window.document.createElement("video");return e.muted=!0,new Promise(r=>{e.onloadstart=()=>{r(e)};for(const s of i){const l=window.document.createElement("source");ln(s)||(e.crossOrigin="Anonymous"),l.src=s,e.appendChild(l)}})},T.a4=function(){return Vr++},T.a5=ot,T.a6=Lo,T.a7=Ti,T.a8=Rs,T.a9=Pt,T.aA=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]=ss(i[r],e[i[r].ref]));return i},T.aB=function(i){if(i.type==="custom")return new Xy(i);switch(i.type){case"background":return new Zy(i);case"circle":return new z_(i);case"fill":return new W_(i);case"fill-extrusion":return new hy(i);case"heatmap":return new L_(i);case"hillshade":return new B_(i);case"line":return new yy(i);case"raster":return new Hy(i);case"symbol":return new pc(i)}},T.aC=St,T.aD=function(i,e){if(!i)return[{command:"setStyle",args:[e]}];let r=[];try{if(!yt(i.version,e.version))return[{command:"setStyle",args:[e]}];yt(i.center,e.center)||r.push({command:"setCenter",args:[e.center]}),yt(i.zoom,e.zoom)||r.push({command:"setZoom",args:[e.zoom]}),yt(i.bearing,e.bearing)||r.push({command:"setBearing",args:[e.bearing]}),yt(i.pitch,e.pitch)||r.push({command:"setPitch",args:[e.pitch]}),yt(i.sprite,e.sprite)||r.push({command:"setSprite",args:[e.sprite]}),yt(i.glyphs,e.glyphs)||r.push({command:"setGlyphs",args:[e.glyphs]}),yt(i.transition,e.transition)||r.push({command:"setTransition",args:[e.transition]}),yt(i.light,e.light)||r.push({command:"setLight",args:[e.light]}),yt(i.terrain,e.terrain)||r.push({command:"setTerrain",args:[e.terrain]}),yt(i.sky,e.sky)||r.push({command:"setSky",args:[e.sky]}),yt(i.projection,e.projection)||r.push({command:"setProjection",args:[e.projection]});const s={},l=[];(function(p,m,_,x){let S;for(S in m=m||{},p=p||{})Object.prototype.hasOwnProperty.call(p,S)&&(Object.prototype.hasOwnProperty.call(m,S)||qr(S,_,x));for(S in m)Object.prototype.hasOwnProperty.call(m,S)&&(Object.prototype.hasOwnProperty.call(p,S)?yt(p[S],m[S])||(p[S].type==="geojson"&&m[S].type==="geojson"&&zn(p,m,S)?jt(_,{command:"setGeoJSONSourceData",args:[S,m[S].data]}):Ar(S,m,_,x)):os(S,m,_))})(i.sources,e.sources,l,s);const d=[];i.layers&&i.layers.forEach(p=>{"source"in p&&s[p.source]?r.push({command:"removeLayer",args:[p.id]}):d.push(p)}),r=r.concat(l),function(p,m,_){m=m||[];const x=(p=p||[]).map(as),S=m.map(as),I=p.reduce(ls,{}),A=m.reduce(ls,{}),D=x.slice(),B=Object.create(null);let O,q,J,ae,Q;for(let re=0,de=0;re<x.length;re++)O=x[re],Object.prototype.hasOwnProperty.call(A,O)?de++:(jt(_,{command:"removeLayer",args:[O]}),D.splice(D.indexOf(O,de),1));for(let re=0,de=0;re<S.length;re++)O=S[S.length-1-re],D[D.length-1-re]!==O&&(Object.prototype.hasOwnProperty.call(I,O)?(jt(_,{command:"removeLayer",args:[O]}),D.splice(D.lastIndexOf(O,D.length-de),1)):de++,ae=D[D.length-re],jt(_,{command:"addLayer",args:[A[O],ae]}),D.splice(D.length-re,0,O),B[O]=!0);for(let re=0;re<S.length;re++)if(O=S[re],q=I[O],J=A[O],!B[O]&&!yt(q,J))if(yt(q.source,J.source)&&yt(q["source-layer"],J["source-layer"])&&yt(q.type,J.type)){for(Q in Xi(q.layout,J.layout,_,O,null,"setLayoutProperty"),Xi(q.paint,J.paint,_,O,null,"setPaintProperty"),yt(q.filter,J.filter)||jt(_,{command:"setFilter",args:[O,J.filter]}),yt(q.minzoom,J.minzoom)&&yt(q.maxzoom,J.maxzoom)||jt(_,{command:"setLayerZoomRange",args:[O,J.minzoom,J.maxzoom]}),q)Object.prototype.hasOwnProperty.call(q,Q)&&Q!=="layout"&&Q!=="paint"&&Q!=="filter"&&Q!=="metadata"&&Q!=="minzoom"&&Q!=="maxzoom"&&(Q.indexOf("paint.")===0?Xi(q[Q],J[Q],_,O,Q.slice(6),"setPaintProperty"):yt(q[Q],J[Q])||jt(_,{command:"setLayerProperty",args:[O,Q,J[Q]]}));for(Q in J)Object.prototype.hasOwnProperty.call(J,Q)&&!Object.prototype.hasOwnProperty.call(q,Q)&&Q!=="layout"&&Q!=="paint"&&Q!=="filter"&&Q!=="metadata"&&Q!=="minzoom"&&Q!=="maxzoom"&&(Q.indexOf("paint.")===0?Xi(q[Q],J[Q],_,O,Q.slice(6),"setPaintProperty"):yt(q[Q],J[Q])||jt(_,{command:"setLayerProperty",args:[O,Q,J[Q]]}))}else jt(_,{command:"removeLayer",args:[O]}),ae=D[D.lastIndexOf(O)+1],jt(_,{command:"addLayer",args:[J,ae]})}(d,e.layers,r)}catch(s){console.warn("Unable to compute style diff:",s),r=[{command:"setStyle",args:[e]}]}return r},T.aE=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},T.aF=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},T.aG=bi,T.aH=Nr,T.aI=class extends zs{constructor(i,e){super(i,e),this.current=0}set(i){this.current!==i&&(this.current=i,this.gl.uniform1i(this.location,i))}},T.aJ=ec,T.aK=class extends zs{constructor(i,e){super(i,e),this.current=T_}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}}},T.aL=Xu,T.aM=Wu,T.aN=bt,T.aO=class extends zs{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]))}},T.aP=class extends zs{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]))}},T.aQ=function(i,e,r,s,l,d,p){var m=1/(e-r),_=1/(s-l),x=1/(d-p);return i[0]=-2*m,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=-2*_,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=2*x,i[11]=0,i[12]=(e+r)*m,i[13]=(l+s)*_,i[14]=(p+d)*x,i[15]=1,i},T.aR=M_,T.aS=class extends ye{},T.aT=wy,T.aU=class extends De{},T.aV=function(i){return i<=1?1:Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))},T.aW=hd,T.aX=vn,T.aY=ri,T.aZ=class extends Ae{},T.a_=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]},T.aa=ap,T.ab=function(i){const e={};if(i.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(r,s,l,d)=>{const p=l||d;return e[s]=!p||p.toLowerCase(),""}),e["max-age"]){const r=parseInt(e["max-age"],10);isNaN(r)?delete e["max-age"]:e["max-age"]=r}return e},T.ac=function(i,e){const r=[];for(const s in i)s in e||r.push(s);return r},T.ad=wt,T.ae=function(i,e,r){var s=Math.sin(r),l=Math.cos(r),d=e[0],p=e[1],m=e[2],_=e[3],x=e[4],S=e[5],I=e[6],A=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]=d*l+x*s,i[1]=p*l+S*s,i[2]=m*l+I*s,i[3]=_*l+A*s,i[4]=x*l-d*s,i[5]=S*l-p*s,i[6]=I*l-m*s,i[7]=A*l-_*s,i},T.af=function(i){var e=new Eo(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},T.ag=nc,T.ah=function(i,e){let r=0,s=0;if(i.kind==="constant")s=i.layoutSize;else if(i.kind!=="source"){const{interpolationType:l,minZoom:d,maxZoom:p}=i,m=l?wt(Ui.interpolationFactor(l,e,d,p),0,1):0;i.kind==="camera"?s=ji.number(i.minSize,i.maxSize,m):r=m}return{uSizeT:r,uSize:s}},T.aj=function(i,{uSize:e,uSizeT:r},{lowerSize:s,upperSize:l}){return i.kind==="source"?s/tn:i.kind==="composite"?ji.number(s/tn,l/tn,r):e},T.ak=Ph,T.al=function(i,e,r,s){const l=e.y-i.y,d=e.x-i.x,p=s.y-r.y,m=s.x-r.x,_=p*d-m*l;if(_===0)return null;const x=(m*(i.y-r.y)-p*(i.x-r.x))/_;return new le(i.x+x*d,i.y+x*l)},T.am=up,T.an=Qu,T.ao=uh,T.ap=function(i){let e=1/0,r=1/0,s=-1/0,l=-1/0;for(const d of i)e=Math.min(e,d.x),r=Math.min(r,d.y),s=Math.max(s,d.x),l=Math.max(l,d.y);return[e,r,s,l]},T.aq=ii,T.as=Eh,T.at=function(i,e){var r=e[0],s=e[1],l=e[2],d=e[3],p=e[4],m=e[5],_=e[6],x=e[7],S=e[8],I=e[9],A=e[10],D=e[11],B=e[12],O=e[13],q=e[14],J=e[15],ae=r*m-s*p,Q=r*_-l*p,re=r*x-d*p,de=s*_-l*m,be=s*x-d*m,Le=l*x-d*_,We=S*O-I*B,Me=S*q-A*B,Pe=S*J-D*B,Ue=I*q-A*O,Ve=I*J-D*O,Be=A*J-D*q,_e=ae*Be-Q*Ve+re*Ue+de*Pe-be*Me+Le*We;return _e?(i[0]=(m*Be-_*Ve+x*Ue)*(_e=1/_e),i[1]=(l*Ve-s*Be-d*Ue)*_e,i[2]=(O*Le-q*be+J*de)*_e,i[3]=(A*be-I*Le-D*de)*_e,i[4]=(_*Pe-p*Be-x*Me)*_e,i[5]=(r*Be-l*Pe+d*Me)*_e,i[6]=(q*re-B*Le-J*Q)*_e,i[7]=(S*Le-A*re+D*Q)*_e,i[8]=(p*Ve-m*Pe+x*We)*_e,i[9]=(s*Pe-r*Ve-d*We)*_e,i[10]=(B*be-O*re+J*ae)*_e,i[11]=(I*re-S*be-D*ae)*_e,i[12]=(m*Me-p*Ue-_*We)*_e,i[13]=(r*Ue-s*Me+l*We)*_e,i[14]=(O*Q-B*de-q*ae)*_e,i[15]=(S*de-I*Q+A*ae)*_e,i):null},T.au=Fh,T.av=Ch,T.aw=Oh,T.ax=function(){const i={},e=ue.$version;for(const r in ue.$root){const s=ue.$root[r];if(s.required){let l=null;l=r==="version"?e:s.type==="array"?[]:{},l!=null&&(i[r]=l)}}return i},T.ay=Gl,T.az=er,T.b=dr,T.b0=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},T.b1=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},T.b2=function(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]+i[3]*e[3]},T.b3=Xt,T.b4=np,T.b5=ip,T.b6=function(i,e,r,s,l){var d,p=1/Math.tan(e/2);return i[0]=p/r,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=p,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)*(d=1/(s-l)),i[14]=2*l*s*d):(i[10]=-1,i[14]=-2*s),i},T.b7=function(i,e,r){var s=Math.sin(r),l=Math.cos(r),d=e[4],p=e[5],m=e[6],_=e[7],x=e[8],S=e[9],I=e[10],A=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]=d*l+x*s,i[5]=p*l+S*s,i[6]=m*l+I*s,i[7]=_*l+A*s,i[8]=x*l-d*s,i[9]=S*l-p*s,i[10]=I*l-m*s,i[11]=A*l-_*s,i},T.b8=He,T.b9=Ft,T.bA=function(i){return i.message===Qi},T.bB=_n,T.bC=Yr,T.ba=function(i){return i*Math.PI/180},T.bb=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},T.bc=class extends R{},T.bd=Dh,T.be=n0,T.bg=Oi,T.bh=function(i,e){$r.REGISTERED_PROTOCOLS[i]=e},T.bi=function(i){delete $r.REGISTERED_PROTOCOLS[i]},T.bj=function(i,e){const r={};for(let l=0;l<i.length;l++){const d=e&&e[i[l].id]||_a(i[l]);e&&(e[i[l].id]=d);let p=r[d];p||(p=r[d]=[]),p.push(i[l])}const s=[];for(const l in r)s.push(r[l]);return s},T.bk=Fe,T.bl=op,T.bm=lp,T.bn=Vd,T.bo=function(i){i.bucket.createArrays(),i.bucket.tilePixelRatio=Qt/(512*i.bucket.overscaling),i.bucket.compareText={},i.bucket.iconsNeedLinear=!1;const e=i.bucket.layers[0],r=e.layout,s=e._unevaluatedLayout._values,l={layoutIconSize:s["icon-size"].possiblyEvaluate(new Pt(i.bucket.zoom+1),i.canonical),layoutTextSize:s["text-size"].possiblyEvaluate(new Pt(i.bucket.zoom+1),i.canonical),textMaxSize:s["text-size"].possiblyEvaluate(new Pt(18))};if(i.bucket.textSizeData.kind==="composite"){const{minZoom:x,maxZoom:S}=i.bucket.textSizeData;l.compositeTextSizes=[s["text-size"].possiblyEvaluate(new Pt(x),i.canonical),s["text-size"].possiblyEvaluate(new Pt(S),i.canonical)]}if(i.bucket.iconSizeData.kind==="composite"){const{minZoom:x,maxZoom:S}=i.bucket.iconSizeData;l.compositeIconSizes=[s["icon-size"].possiblyEvaluate(new Pt(x),i.canonical),s["icon-size"].possiblyEvaluate(new Pt(S),i.canonical)]}const d=r.get("text-line-height")*ii,p=r.get("text-rotation-alignment")!=="viewport"&&r.get("symbol-placement")!=="point",m=r.get("text-keep-upright"),_=r.get("text-size");for(const x of i.bucket.features){const S=r.get("text-font").evaluate(x,{},i.canonical).join(","),I=_.evaluate(x,{},i.canonical),A=l.layoutTextSize.evaluate(x,{},i.canonical),D=l.layoutIconSize.evaluate(x,{},i.canonical),B={horizontal:{},vertical:void 0},O=x.text;let q,J=[0,0];if(O){const re=O.toString(),de=r.get("text-letter-spacing").evaluate(x,{},i.canonical)*ii,be=nh(re)?de:0,Le=r.get("text-anchor").evaluate(x,{},i.canonical),We=vp(e,x,i.canonical);if(!We){const Ve=r.get("text-radial-offset").evaluate(x,{},i.canonical);J=Ve?xp(Le,[Ve*ii,Bh]):r.get("text-offset").evaluate(x,{},i.canonical).map(Be=>Be*ii)}let Me=p?"center":r.get("text-justify").evaluate(x,{},i.canonical);const Pe=r.get("symbol-placement")==="point"?r.get("text-max-width").evaluate(x,{},i.canonical)*ii:1/0,Ue=()=>{i.bucket.allowVerticalPlacement&&za(re)&&(B.vertical=hc(O,i.glyphMap,i.glyphPositions,i.imagePositions,S,Pe,d,Le,"left",be,J,T.ai.vertical,!0,A,I))};if(!p&&We){const Ve=new Set;if(Me==="auto")for(let _e=0;_e<We.values.length;_e+=2)Ve.add(Fh(We.values[_e]));else Ve.add(Me);let Be=!1;for(const _e of Ve)if(!B.horizontal[_e])if(Be)B.horizontal[_e]=B.horizontal[0];else{const Ze=hc(O,i.glyphMap,i.glyphPositions,i.imagePositions,S,Pe,d,"center",_e,be,J,T.ai.horizontal,!1,A,I);Ze&&(B.horizontal[_e]=Ze,Be=Ze.positionedLines.length===1)}Ue()}else{Me==="auto"&&(Me=Fh(Le));const Ve=hc(O,i.glyphMap,i.glyphPositions,i.imagePositions,S,Pe,d,Le,Me,be,J,T.ai.horizontal,!1,A,I);Ve&&(B.horizontal[Me]=Ve),Ue(),za(re)&&p&&m&&(B.vertical=hc(O,i.glyphMap,i.glyphPositions,i.imagePositions,S,Pe,d,Le,Me,be,J,T.ai.vertical,!1,A,I))}}let ae=!1;if(x.icon&&x.icon.name){const re=i.imageMap[x.icon.name];re&&(q=Ny(i.imagePositions[x.icon.name],r.get("icon-offset").evaluate(x,{},i.canonical),r.get("icon-anchor").evaluate(x,{},i.canonical)),ae=!!re.sdf,i.bucket.sdfIcons===void 0?i.bucket.sdfIcons=ae:i.bucket.sdfIcons!==ae&&li("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(re.pixelRatio!==i.bucket.pixelRatio||r.get("icon-rotate").constantOr(1)!==0)&&(i.bucket.iconsNeedLinear=!0))}const Q=wp(B.horizontal)||B.vertical;i.bucket.iconsInText=!!Q&&Q.iconsInText,(Q||q)&&i0(i.bucket,x,B,q,i.imageMap,l,A,D,J,ae,i.canonical)}i.showCollisionBoxes&&i.bucket.generateCollisionDebugBuffers()},T.bp=bh,T.bq=yh,T.br=vh,T.bs=Wn,T.bt=Sh,T.bu=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}},T.bv=function(i,e,r,s,l){return c(this,void 0,void 0,function*(){if(st())try{return yield on(i,e,r,s,l)}catch{}return function(d,p,m,_,x){const S=d.width,I=d.height;Er&&Ei||(Er=new OffscreenCanvas(S,I),Ei=Er.getContext("2d",{willReadFrequently:!0})),Er.width=S,Er.height=I,Ei.drawImage(d,0,0,S,I);const A=Ei.getImageData(p,m,_,x);return Ei.clearRect(0,0,S,I),A.data}(i,e,r,s,l)})},T.bw=sp,T.bx=fe,T.by=me,T.bz=Ad,T.c=Pn,T.d=i=>c(void 0,void 0,void 0,function*(){if(i.byteLength===0)return createImageBitmap(new ImageData(1,1));const e=new Blob([new Uint8Array(i)],{type:"image/png"});try{return createImageBitmap(e)}catch(r){throw new Error(`Could not load image because of ${r.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),T.e=$t,T.f=i=>new Promise((e,r)=>{const s=new Image;s.onload=()=>{e(s),URL.revokeObjectURL(s.src),s.onload=null,window.requestAnimationFrame(()=>{s.src=Us})},s.onerror=()=>r(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const l=new Blob([new Uint8Array(i)],{type:"image/png"});s.src=i.byteLength?URL.createObjectURL(l):Us}),T.g=pr,T.h=(i,e)=>an($t(i,{type:"json"}),e),T.i=Cr,T.j=Ur,T.k=jr,T.l=(i,e)=>an($t(i,{type:"arrayBuffer"}),e),T.m=an,T.n=function(i){return new Sh(i).readFields(Dy,[])},T.o=qa,T.p=Od,T.q=o,T.r=th,T.s=ln,T.t=Aa,T.u=ze,T.v=ue,T.w=li,T.x=Rr,T.y=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)}},T.z=ji}),L("worker",["./shared"],function(T){class c{constructor(z){this.keyCache={},z&&this.replace(z)}replace(z){this._layerConfigs={},this._layers={},this.update(z,[])}update(z,M){for(const G of z){this._layerConfigs[G.id]=G;const ee=this._layers[G.id]=T.aB(G);ee._featureFilter=T.a7(ee.filter),this.keyCache[G.id]&&delete this.keyCache[G.id]}for(const G of M)delete this.keyCache[G],delete this._layerConfigs[G],delete this._layers[G];this.familiesBySource={};const V=T.bj(Object.values(this._layerConfigs),this.keyCache);for(const G of V){const ee=G.map(he=>this._layers[he.id]),ie=ee[0];if(ie.visibility==="none")continue;const ne=ie.source||"";let K=this.familiesBySource[ne];K||(K=this.familiesBySource[ne]={});const pe=ie.sourceLayer||"_geojsonTileLayer";let xe=K[pe];xe||(xe=K[pe]=[]),xe.push(ee)}}}class fe{constructor(z){const M={},V=[];for(const ne in z){const K=z[ne],pe=M[ne]={};for(const xe in K){const he=K[+xe];if(!he||he.bitmap.width===0||he.bitmap.height===0)continue;const Ie={x:0,y:0,w:he.bitmap.width+2,h:he.bitmap.height+2};V.push(Ie),pe[xe]={rect:Ie,metrics:he.metrics}}}const{w:G,h:ee}=T.p(V),ie=new T.o({width:G||1,height:ee||1});for(const ne in z){const K=z[ne];for(const pe in K){const xe=K[+pe];if(!xe||xe.bitmap.width===0||xe.bitmap.height===0)continue;const he=M[ne][pe].rect;T.o.copy(xe.bitmap,ie,{x:0,y:0},{x:he.x+1,y:he.y+1},xe.bitmap)}}this.image=ie,this.positions=M}}T.bk("GlyphAtlas",fe);class me{constructor(z){this.tileID=new T.S(z.tileID.overscaledZ,z.tileID.wrap,z.tileID.canonical.z,z.tileID.canonical.x,z.tileID.canonical.y),this.uid=z.uid,this.zoom=z.zoom,this.pixelRatio=z.pixelRatio,this.tileSize=z.tileSize,this.source=z.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=z.showCollisionBoxes,this.collectResourceTiming=!!z.collectResourceTiming,this.returnDependencies=!!z.returnDependencies,this.promoteId=z.promoteId,this.inFlightDependencies=[]}parse(z,M,V,G){return T._(this,void 0,void 0,function*(){this.status="parsing",this.data=z,this.collisionBoxArray=new T.a5;const ee=new T.bl(Object.keys(z.layers).sort()),ie=new T.bm(this.tileID,this.promoteId);ie.bucketLayerIDs=[];const ne={},K={featureIndex:ie,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:V},pe=M.familiesBySource[this.source];for(const lt in pe){const vt=z.layers[lt];if(!vt)continue;vt.version===1&&T.w(`Vector tile source "${this.source}" layer "${lt}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const Ot=ee.encode(lt),ei=[];for(let ci=0;ci<vt.length;ci++){const hi=vt.feature(ci),cs=ie.getId(hi,lt);ei.push({feature:hi,id:cs,index:ci,sourceLayerIndex:Ot})}for(const ci of pe[lt]){const hi=ci[0];hi.source!==this.source&&T.w(`layer.source = ${hi.source} does not equal this.source = ${this.source}`),hi.minzoom&&this.zoom<Math.floor(hi.minzoom)||hi.maxzoom&&this.zoom>=hi.maxzoom||hi.visibility!=="none"&&(ve(ci,this.zoom,V),(ne[hi.id]=hi.createBucket({index:ie.bucketLayerIDs.length,layers:ci,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Ot,sourceID:this.source})).populate(ei,K,this.tileID.canonical),ie.bucketLayerIDs.push(ci.map(cs=>cs.id)))}}const xe=T.aG(K.glyphDependencies,lt=>Object.keys(lt).map(Number));this.inFlightDependencies.forEach(lt=>lt==null?void 0:lt.abort()),this.inFlightDependencies=[];let he=Promise.resolve({});if(Object.keys(xe).length){const lt=new AbortController;this.inFlightDependencies.push(lt),he=G.sendAsync({type:"GG",data:{stacks:xe,source:this.source,tileID:this.tileID,type:"glyphs"}},lt)}const Ie=Object.keys(K.iconDependencies);let Ge=Promise.resolve({});if(Ie.length){const lt=new AbortController;this.inFlightDependencies.push(lt),Ge=G.sendAsync({type:"GI",data:{icons:Ie,source:this.source,tileID:this.tileID,type:"icons"}},lt)}const Xe=Object.keys(K.patternDependencies);let nt=Promise.resolve({});if(Xe.length){const lt=new AbortController;this.inFlightDependencies.push(lt),nt=G.sendAsync({type:"GI",data:{icons:Xe,source:this.source,tileID:this.tileID,type:"patterns"}},lt)}const[mt,rt,Ct]=yield Promise.all([he,Ge,nt]),Ut=new fe(mt),Kt=new T.bn(rt,Ct);for(const lt in ne){const vt=ne[lt];vt instanceof T.a6?(ve(vt.layers,this.zoom,V),T.bo({bucket:vt,glyphMap:mt,glyphPositions:Ut.positions,imageMap:rt,imagePositions:Kt.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):vt.hasPattern&&(vt instanceof T.bp||vt instanceof T.bq||vt instanceof T.br)&&(ve(vt.layers,this.zoom,V),vt.addFeatures(K,this.tileID.canonical,Kt.patternPositions))}return this.status="done",{buckets:Object.values(ne).filter(lt=>!lt.isEmpty()),featureIndex:ie,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Ut.image,imageAtlas:Kt,glyphMap:this.returnDependencies?mt:null,iconMap:this.returnDependencies?rt:null,glyphPositions:this.returnDependencies?Ut.positions:null}})}}function ve(X,z,M){const V=new T.a9(z);for(const G of X)G.recalculate(V,M)}class le{constructor(z,M,V){this.actor=z,this.layerIndex=M,this.availableImages=V,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(z,M){return T._(this,void 0,void 0,function*(){const V=yield T.l(z.request,M);try{return{vectorTile:new T.bs.VectorTile(new T.bt(V.data)),rawData:V.data,cacheControl:V.cacheControl,expires:V.expires}}catch(G){const ee=new Uint8Array(V.data);let ie=`Unable to parse the tile at ${z.request.url}, `;throw ie+=ee[0]===31&&ee[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${G.message}`,new Error(ie)}})}loadTile(z){return T._(this,void 0,void 0,function*(){const M=z.uid,V=!!(z&&z.request&&z.request.collectResourceTiming)&&new T.bu(z.request),G=new me(z);this.loading[M]=G;const ee=new AbortController;G.abort=ee;try{const ie=yield this.loadVectorTile(z,ee);if(delete this.loading[M],!ie)return null;const ne=ie.rawData,K={};ie.expires&&(K.expires=ie.expires),ie.cacheControl&&(K.cacheControl=ie.cacheControl);const pe={};if(V){const he=V.finish();he&&(pe.resourceTiming=JSON.parse(JSON.stringify(he)))}G.vectorTile=ie.vectorTile;const xe=G.parse(ie.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[M]=G,this.fetching[M]={rawTileData:ne,cacheControl:K,resourceTiming:pe};try{const he=yield xe;return T.e({rawTileData:ne.slice(0)},he,K,pe)}finally{delete this.fetching[M]}}catch(ie){throw delete this.loading[M],G.status="done",this.loaded[M]=G,ie}})}reloadTile(z){return T._(this,void 0,void 0,function*(){const M=z.uid;if(!this.loaded||!this.loaded[M])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const V=this.loaded[M];if(V.showCollisionBoxes=z.showCollisionBoxes,V.status==="parsing"){const G=yield V.parse(V.vectorTile,this.layerIndex,this.availableImages,this.actor);let ee;if(this.fetching[M]){const{rawTileData:ie,cacheControl:ne,resourceTiming:K}=this.fetching[M];delete this.fetching[M],ee=T.e({rawTileData:ie.slice(0)},G,ne,K)}else ee=G;return ee}if(V.status==="done"&&V.vectorTile)return V.parse(V.vectorTile,this.layerIndex,this.availableImages,this.actor)})}abortTile(z){return T._(this,void 0,void 0,function*(){const M=this.loading,V=z.uid;M&&M[V]&&M[V].abort&&(M[V].abort.abort(),delete M[V])})}removeTile(z){return T._(this,void 0,void 0,function*(){this.loaded&&this.loaded[z.uid]&&delete this.loaded[z.uid]})}}class oe{constructor(){this.loaded={}}loadTile(z){return T._(this,void 0,void 0,function*(){const{uid:M,encoding:V,rawImageData:G,redFactor:ee,greenFactor:ie,blueFactor:ne,baseShift:K}=z,pe=G.width+2,xe=G.height+2,he=T.b(G)?new T.R({width:pe,height:xe},yield T.bv(G,-1,-1,pe,xe)):G,Ie=new T.bw(M,he,V,ee,ie,ne,K);return this.loaded=this.loaded||{},this.loaded[M]=Ie,Ie})}removeTile(z){const M=this.loaded,V=z.uid;M&&M[V]&&delete M[V]}}function ht(X,z){if(X.length!==0){je(X[0],z);for(var M=1;M<X.length;M++)je(X[M],!z)}}function je(X,z){for(var M=0,V=0,G=0,ee=X.length,ie=ee-1;G<ee;ie=G++){var ne=(X[G][0]-X[ie][0])*(X[ie][1]+X[G][1]),K=M+ne;V+=Math.abs(M)>=Math.abs(ne)?M-K+ne:ne-K+M,M=K}M+V>=0!=!!z&&X.reverse()}var Ke=T.bx(function X(z,M){var V,G=z&&z.type;if(G==="FeatureCollection")for(V=0;V<z.features.length;V++)X(z.features[V],M);else if(G==="GeometryCollection")for(V=0;V<z.geometries.length;V++)X(z.geometries[V],M);else if(G==="Feature")X(z.geometry,M);else if(G==="Polygon")ht(z.coordinates,M);else if(G==="MultiPolygon")for(V=0;V<z.coordinates.length;V++)ht(z.coordinates[V],M);return z});const Oe=T.bs.VectorTileFeature.prototype.toGeoJSON;var ft={exports:{}},st=T.by,He=T.bs.VectorTileFeature,Ft=wt;function wt(X,z){this.options=z||{},this.features=X,this.length=X.length}function Xt(X,z){this.id=typeof X.id=="number"?X.id:void 0,this.type=X.type,this.rawGeometry=X.type===1?[X.geometry]:X.geometry,this.properties=X.tags,this.extent=z||4096}wt.prototype.feature=function(X){return new Xt(this.features[X],this.options.extent)},Xt.prototype.loadGeometry=function(){var X=this.rawGeometry;this.geometry=[];for(var z=0;z<X.length;z++){for(var M=X[z],V=[],G=0;G<M.length;G++)V.push(new st(M[G][0],M[G][1]));this.geometry.push(V)}return this.geometry},Xt.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var X=this.geometry,z=1/0,M=-1/0,V=1/0,G=-1/0,ee=0;ee<X.length;ee++)for(var ie=X[ee],ne=0;ne<ie.length;ne++){var K=ie[ne];z=Math.min(z,K.x),M=Math.max(M,K.x),V=Math.min(V,K.y),G=Math.max(G,K.y)}return[z,V,M,G]},Xt.prototype.toGeoJSON=He.prototype.toGeoJSON;var $t=T.bz,Vr=Ft;function bi(X){var z=new $t;return function(M,V){for(var G in M.layers)V.writeMessage(3,Nr,M.layers[G])}(X,z),z.finish()}function Nr(X,z){var M;z.writeVarintField(15,X.version||1),z.writeStringField(1,X.name||""),z.writeVarintField(5,X.extent||4096);var V={keys:[],values:[],keycache:{},valuecache:{}};for(M=0;M<X.length;M++)V.feature=X.feature(M),z.writeMessage(2,St,V);var G=V.keys;for(M=0;M<G.length;M++)z.writeStringField(3,G[M]);var ee=V.values;for(M=0;M<ee.length;M++)z.writeMessage(4,En,ee[M])}function St(X,z){var M=X.feature;M.id!==void 0&&z.writeVarintField(1,M.id),z.writeMessage(2,js,X),z.writeVarintField(3,M.type),z.writeMessage(4,Cr,M)}function js(X,z){var M=X.feature,V=X.keys,G=X.values,ee=X.keycache,ie=X.valuecache;for(var ne in M.properties){var K=M.properties[ne],pe=ee[ne];if(K!==null){pe===void 0&&(V.push(ne),ee[ne]=pe=V.length-1),z.writeVarint(pe);var xe=typeof K;xe!=="string"&&xe!=="boolean"&&xe!=="number"&&(K=JSON.stringify(K));var he=xe+":"+K,Ie=ie[he];Ie===void 0&&(G.push(K),ie[he]=Ie=G.length-1),z.writeVarint(Ie)}}}function li(X,z){return(z<<3)+(7&X)}function wi(X){return X<<1^X>>31}function Cr(X,z){for(var M=X.loadGeometry(),V=X.type,G=0,ee=0,ie=M.length,ne=0;ne<ie;ne++){var K=M[ne],pe=1;V===1&&(pe=K.length),z.writeVarint(li(1,pe));for(var xe=V===3?K.length-1:K.length,he=0;he<xe;he++){he===1&&V!==1&&z.writeVarint(li(2,xe-1));var Ie=K[he].x-G,Ge=K[he].y-ee;z.writeVarint(wi(Ie)),z.writeVarint(wi(Ge)),G+=Ie,ee+=Ge}V===3&&z.writeVarint(li(7,1))}}function En(X,z){var M=typeof X;M==="string"?z.writeStringField(1,X):M==="boolean"?z.writeBooleanField(7,X):M==="number"&&(X%1!=0?z.writeDoubleField(3,X):X<0?z.writeSVarintField(6,X):z.writeVarintField(5,X))}ft.exports=bi,ft.exports.fromVectorTileJs=bi,ft.exports.fromGeojsonVt=function(X,z){z=z||{};var M={};for(var V in X)M[V]=new Vr(X[V].features,z),M[V].name=V,M[V].version=z.version,M[V].extent=z.extent;return bi({layers:M})},ft.exports.GeoJSONWrapper=Vr;var dr=T.bx(ft.exports);const Us={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:X=>X},on=Math.fround||(Er=new Float32Array(1),X=>(Er[0]=+X,Er[0]));var Er;const Ei=3,Qi=5,Pn=6;class $r{constructor(z){this.options=Object.assign(Object.create(Us),z),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(z){const{log:M,minZoom:V,maxZoom:G}=this.options;M&&console.time("total time");const ee=`prepare ${z.length} points`;M&&console.time(ee),this.points=z;const ie=[];for(let K=0;K<z.length;K++){const pe=z[K];if(!pe.geometry)continue;const[xe,he]=pe.geometry.coordinates,Ie=on(Oi(xe)),Ge=on(er(he));ie.push(Ie,Ge,1/0,K,-1,1),this.options.reduce&&ie.push(0)}let ne=this.trees[G+1]=this._createTree(ie);M&&console.timeEnd(ee);for(let K=G;K>=V;K--){const pe=+Date.now();ne=this.trees[K]=this._createTree(this._cluster(ne,K)),M&&console.log("z%d: %d clusters in %dms",K,ne.numItems,+Date.now()-pe)}return M&&console.timeEnd("total time"),this}getClusters(z,M){let V=((z[0]+180)%360+360)%360-180;const G=Math.max(-90,Math.min(90,z[1]));let ee=z[2]===180?180:((z[2]+180)%360+360)%360-180;const ie=Math.max(-90,Math.min(90,z[3]));if(z[2]-z[0]>=360)V=-180,ee=180;else if(V>ee){const he=this.getClusters([V,G,180,ie],M),Ie=this.getClusters([-180,G,ee,ie],M);return he.concat(Ie)}const ne=this.trees[this._limitZoom(M)],K=ne.range(Oi(V),er(ie),Oi(ee),er(G)),pe=ne.data,xe=[];for(const he of K){const Ie=this.stride*he;xe.push(pe[Ie+Qi]>1?pr(pe,Ie,this.clusterProps):this.points[pe[Ie+Ei]])}return xe}getChildren(z){const M=this._getOriginId(z),V=this._getOriginZoom(z),G="No cluster with the specified id.",ee=this.trees[V];if(!ee)throw new Error(G);const ie=ee.data;if(M*this.stride>=ie.length)throw new Error(G);const ne=this.options.radius/(this.options.extent*Math.pow(2,V-1)),K=ee.within(ie[M*this.stride],ie[M*this.stride+1],ne),pe=[];for(const xe of K){const he=xe*this.stride;ie[he+4]===z&&pe.push(ie[he+Qi]>1?pr(ie,he,this.clusterProps):this.points[ie[he+Ei]])}if(pe.length===0)throw new Error(G);return pe}getLeaves(z,M,V){const G=[];return this._appendLeaves(G,z,M=M||10,V=V||0,0),G}getTile(z,M,V){const G=this.trees[this._limitZoom(z)],ee=Math.pow(2,z),{extent:ie,radius:ne}=this.options,K=ne/ie,pe=(V-K)/ee,xe=(V+1+K)/ee,he={features:[]};return this._addTileFeatures(G.range((M-K)/ee,pe,(M+1+K)/ee,xe),G.data,M,V,ee,he),M===0&&this._addTileFeatures(G.range(1-K/ee,pe,1,xe),G.data,ee,V,ee,he),M===ee-1&&this._addTileFeatures(G.range(0,pe,K/ee,xe),G.data,-1,V,ee,he),he.features.length?he:null}getClusterExpansionZoom(z){let M=this._getOriginZoom(z)-1;for(;M<=this.options.maxZoom;){const V=this.getChildren(z);if(M++,V.length!==1)break;z=V[0].properties.cluster_id}return M}_appendLeaves(z,M,V,G,ee){const ie=this.getChildren(M);for(const ne of ie){const K=ne.properties;if(K&&K.cluster?ee+K.point_count<=G?ee+=K.point_count:ee=this._appendLeaves(z,K.cluster_id,V,G,ee):ee<G?ee++:z.push(ne),z.length===V)break}return ee}_createTree(z){const M=new T.aw(z.length/this.stride|0,this.options.nodeSize,Float32Array);for(let V=0;V<z.length;V+=this.stride)M.add(z[V],z[V+1]);return M.finish(),M.data=z,M}_addTileFeatures(z,M,V,G,ee,ie){for(const ne of z){const K=ne*this.stride,pe=M[K+Qi]>1;let xe,he,Ie;if(pe)xe=An(M,K,this.clusterProps),he=M[K],Ie=M[K+1];else{const nt=this.points[M[K+Ei]];xe=nt.properties;const[mt,rt]=nt.geometry.coordinates;he=Oi(mt),Ie=er(rt)}const Ge={type:1,geometry:[[Math.round(this.options.extent*(he*ee-V)),Math.round(this.options.extent*(Ie*ee-G))]],tags:xe};let Xe;Xe=pe||this.options.generateId?M[K+Ei]:this.points[M[K+Ei]].id,Xe!==void 0&&(Ge.id=Xe),ie.features.push(Ge)}}_limitZoom(z){return Math.max(this.options.minZoom,Math.min(Math.floor(+z),this.options.maxZoom+1))}_cluster(z,M){const{radius:V,extent:G,reduce:ee,minPoints:ie}=this.options,ne=V/(G*Math.pow(2,M)),K=z.data,pe=[],xe=this.stride;for(let he=0;he<K.length;he+=xe){if(K[he+2]<=M)continue;K[he+2]=M;const Ie=K[he],Ge=K[he+1],Xe=z.within(K[he],K[he+1],ne),nt=K[he+Qi];let mt=nt;for(const rt of Xe){const Ct=rt*xe;K[Ct+2]>M&&(mt+=K[Ct+Qi])}if(mt>nt&&mt>=ie){let rt,Ct=Ie*nt,Ut=Ge*nt,Kt=-1;const lt=((he/xe|0)<<5)+(M+1)+this.points.length;for(const vt of Xe){const Ot=vt*xe;if(K[Ot+2]<=M)continue;K[Ot+2]=M;const ei=K[Ot+Qi];Ct+=K[Ot]*ei,Ut+=K[Ot+1]*ei,K[Ot+4]=lt,ee&&(rt||(rt=this._map(K,he,!0),Kt=this.clusterProps.length,this.clusterProps.push(rt)),ee(rt,this._map(K,Ot)))}K[he+4]=lt,pe.push(Ct/mt,Ut/mt,1/0,lt,-1,mt),ee&&pe.push(Kt)}else{for(let rt=0;rt<xe;rt++)pe.push(K[he+rt]);if(mt>1)for(const rt of Xe){const Ct=rt*xe;if(!(K[Ct+2]<=M)){K[Ct+2]=M;for(let Ut=0;Ut<xe;Ut++)pe.push(K[Ct+Ut])}}}}return pe}_getOriginId(z){return z-this.points.length>>5}_getOriginZoom(z){return(z-this.points.length)%32}_map(z,M,V){if(z[M+Qi]>1){const ie=this.clusterProps[z[M+Pn]];return V?Object.assign({},ie):ie}const G=this.points[z[M+Ei]].properties,ee=this.options.map(G);return V&&ee===G?Object.assign({},ee):ee}}function pr(X,z,M){return{type:"Feature",id:X[z+Ei],properties:An(X,z,M),geometry:{type:"Point",coordinates:[(V=X[z],360*(V-.5)),an(X[z+1])]}};var V}function An(X,z,M){const V=X[z+Qi],G=V>=1e4?`${Math.round(V/1e3)}k`:V>=1e3?Math.round(V/100)/10+"k":V,ee=X[z+Pn],ie=ee===-1?{}:Object.assign({},M[ee]);return Object.assign(ie,{cluster:!0,cluster_id:X[z+Ei],point_count:V,point_count_abbreviated:G})}function Oi(X){return X/360+.5}function er(X){const z=Math.sin(X*Math.PI/180),M=.5-.25*Math.log((1+z)/(1-z))/Math.PI;return M<0?0:M>1?1:M}function an(X){const z=(180-360*X)*Math.PI/180;return 360*Math.atan(Math.exp(z))/Math.PI-90}function ln(X,z,M,V){let G=V;const ee=z+(M-z>>1);let ie,ne=M-z;const K=X[z],pe=X[z+1],xe=X[M],he=X[M+1];for(let Ie=z+3;Ie<M;Ie+=3){const Ge=ns(X[Ie],X[Ie+1],K,pe,xe,he);if(Ge>G)ie=Ie,G=Ge;else if(Ge===G){const Xe=Math.abs(Ie-ee);Xe<ne&&(ie=Ie,ne=Xe)}}G>V&&(ie-z>3&&ln(X,z,ie,V),X[ie+2]=G,M-ie>3&&ln(X,ie,M,V))}function ns(X,z,M,V,G,ee){let ie=G-M,ne=ee-V;if(ie!==0||ne!==0){const K=((X-M)*ie+(z-V)*ne)/(ie*ie+ne*ne);K>1?(M=G,V=ee):K>0&&(M+=ie*K,V+=ne*K)}return ie=X-M,ne=z-V,ie*ie+ne*ne}function Pr(X,z,M,V){const G={id:X??null,type:z,geometry:M,tags:V,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(z==="Point"||z==="MultiPoint"||z==="LineString")jr(G,M);else if(z==="Polygon")jr(G,M[0]);else if(z==="MultiLineString")for(const ee of M)jr(G,ee);else if(z==="MultiPolygon")for(const ee of M)jr(G,ee[0]);return G}function jr(X,z){for(let M=0;M<z.length;M+=3)X.minX=Math.min(X.minX,z[M]),X.minY=Math.min(X.minY,z[M+1]),X.maxX=Math.max(X.maxX,z[M]),X.maxY=Math.max(X.maxY,z[M+1])}function Ur(X,z,M,V){if(!z.geometry)return;const G=z.geometry.coordinates;if(G&&G.length===0)return;const ee=z.geometry.type,ie=Math.pow(M.tolerance/((1<<M.maxZoom)*M.extent),2);let ne=[],K=z.id;if(M.promoteId?K=z.properties[M.promoteId]:M.generateId&&(K=V||0),ee==="Point")Mn(G,ne);else if(ee==="MultiPoint")for(const pe of G)Mn(pe,ne);else if(ee==="LineString")ue(G,ne,ie,!1);else if(ee==="MultiLineString"){if(M.lineMetrics){for(const pe of G)ne=[],ue(pe,ne,ie,!1),X.push(Pr(K,"LineString",ne,z.properties));return}cn(G,ne,ie,!1)}else if(ee==="Polygon")cn(G,ne,ie,!0);else{if(ee!=="MultiPolygon"){if(ee==="GeometryCollection"){for(const pe of z.geometry.geometries)Ur(X,{id:K,geometry:pe,properties:z.properties},M,V);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const pe of G){const xe=[];cn(pe,xe,ie,!0),ne.push(xe)}}X.push(Pr(K,ee,ne,z.properties))}function Mn(X,z){z.push(ss(X[0]),yt(X[1]),0)}function ue(X,z,M,V){let G,ee,ie=0;for(let K=0;K<X.length;K++){const pe=ss(X[K][0]),xe=yt(X[K][1]);z.push(pe,xe,0),K>0&&(ie+=V?(G*xe-pe*ee)/2:Math.sqrt(Math.pow(pe-G,2)+Math.pow(xe-ee,2))),G=pe,ee=xe}const ne=z.length-3;z[2]=1,ln(z,0,ne,M),z[ne+2]=1,z.size=Math.abs(ie),z.start=0,z.end=z.size}function cn(X,z,M,V){for(let G=0;G<X.length;G++){const ee=[];ue(X[G],ee,M,V),z.push(ee)}}function ss(X){return X/360+.5}function yt(X){const z=Math.sin(X*Math.PI/180),M=.5-.25*Math.log((1+z)/(1-z))/Math.PI;return M<0?0:M>1?1:M}function jt(X,z,M,V,G,ee,ie,ne){if(V/=z,ee>=(M/=z)&&ie<V)return X;if(ie<M||ee>=V)return null;const K=[];for(const pe of X){const xe=pe.geometry;let he=pe.type;const Ie=G===0?pe.minX:pe.minY,Ge=G===0?pe.maxX:pe.maxY;if(Ie>=M&&Ge<V){K.push(pe);continue}if(Ge<M||Ie>=V)continue;let Xe=[];if(he==="Point"||he==="MultiPoint")os(xe,Xe,M,V,G);else if(he==="LineString")qr(xe,Xe,M,V,G,!1,ne.lineMetrics);else if(he==="MultiLineString")zn(xe,Xe,M,V,G,!1);else if(he==="Polygon")zn(xe,Xe,M,V,G,!0);else if(he==="MultiPolygon")for(const nt of xe){const mt=[];zn(nt,mt,M,V,G,!0),mt.length&&Xe.push(mt)}if(Xe.length){if(ne.lineMetrics&&he==="LineString"){for(const nt of Xe)K.push(Pr(pe.id,he,nt,pe.tags));continue}he!=="LineString"&&he!=="MultiLineString"||(Xe.length===1?(he="LineString",Xe=Xe[0]):he="MultiLineString"),he!=="Point"&&he!=="MultiPoint"||(he=Xe.length===3?"Point":"MultiPoint"),K.push(Pr(pe.id,he,Xe,pe.tags))}}return K.length?K:null}function os(X,z,M,V,G){for(let ee=0;ee<X.length;ee+=3){const ie=X[ee+G];ie>=M&&ie<=V&&Xi(z,X[ee],X[ee+1],X[ee+2])}}function qr(X,z,M,V,G,ee,ie){let ne=Ar(X);const K=G===0?as:ls;let pe,xe,he=X.start;for(let mt=0;mt<X.length-3;mt+=3){const rt=X[mt],Ct=X[mt+1],Ut=X[mt+2],Kt=X[mt+3],lt=X[mt+4],vt=G===0?rt:Ct,Ot=G===0?Kt:lt;let ei=!1;ie&&(pe=Math.sqrt(Math.pow(rt-Kt,2)+Math.pow(Ct-lt,2))),vt<M?Ot>M&&(xe=K(ne,rt,Ct,Kt,lt,M),ie&&(ne.start=he+pe*xe)):vt>V?Ot<V&&(xe=K(ne,rt,Ct,Kt,lt,V),ie&&(ne.start=he+pe*xe)):Xi(ne,rt,Ct,Ut),Ot<M&&vt>=M&&(xe=K(ne,rt,Ct,Kt,lt,M),ei=!0),Ot>V&&vt<=V&&(xe=K(ne,rt,Ct,Kt,lt,V),ei=!0),!ee&&ei&&(ie&&(ne.end=he+pe*xe),z.push(ne),ne=Ar(X)),ie&&(he+=pe)}let Ie=X.length-3;const Ge=X[Ie],Xe=X[Ie+1],nt=G===0?Ge:Xe;nt>=M&&nt<=V&&Xi(ne,Ge,Xe,X[Ie+2]),Ie=ne.length-3,ee&&Ie>=3&&(ne[Ie]!==ne[0]||ne[Ie+1]!==ne[1])&&Xi(ne,ne[0],ne[1],ne[2]),ne.length&&z.push(ne)}function Ar(X){const z=[];return z.size=X.size,z.start=X.start,z.end=X.end,z}function zn(X,z,M,V,G,ee){for(const ie of X)qr(ie,z,M,V,G,ee,!1)}function Xi(X,z,M,V){X.push(z,M,V)}function as(X,z,M,V,G,ee){const ie=(ee-z)/(V-z);return Xi(X,ee,M+(G-M)*ie,1),ie}function ls(X,z,M,V,G,ee){const ie=(ee-M)/(G-M);return Xi(X,z+(V-z)*ie,ee,1),ie}function ke(X,z){const M=[];for(let V=0;V<X.length;V++){const G=X[V],ee=G.type;let ie;if(ee==="Point"||ee==="MultiPoint"||ee==="LineString")ie=fr(G.geometry,z);else if(ee==="MultiLineString"||ee==="Polygon"){ie=[];for(const ne of G.geometry)ie.push(fr(ne,z))}else if(ee==="MultiPolygon"){ie=[];for(const ne of G.geometry){const K=[];for(const pe of ne)K.push(fr(pe,z));ie.push(K)}}M.push(Pr(G.id,ee,ie,G.tags))}return M}function fr(X,z){const M=[];M.size=X.size,X.start!==void 0&&(M.start=X.start,M.end=X.end);for(let V=0;V<X.length;V+=3)M.push(X[V]+z,X[V+1],X[V+2]);return M}function Si(X,z){if(X.transformed)return X;const M=1<<X.z,V=X.x,G=X.y;for(const ee of X.features){const ie=ee.geometry,ne=ee.type;if(ee.geometry=[],ne===1)for(let K=0;K<ie.length;K+=2)ee.geometry.push(mr(ie[K],ie[K+1],z,M,V,G));else for(let K=0;K<ie.length;K++){const pe=[];for(let xe=0;xe<ie[K].length;xe+=2)pe.push(mr(ie[K][xe],ie[K][xe+1],z,M,V,G));ee.geometry.push(pe)}}return X.transformed=!0,X}function mr(X,z,M,V,G,ee){return[Math.round(M*(X*V-G)),Math.round(M*(z*V-ee))]}function Zr(X,z,M,V,G){const ee=z===G.maxZoom?0:G.tolerance/((1<<z)*G.extent),ie={features:[],numPoints:0,numSimplified:0,numFeatures:X.length,source:null,x:M,y:V,z,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const ne of X)Ee(ie,ne,ee,G);return ie}function Ee(X,z,M,V){const G=z.geometry,ee=z.type,ie=[];if(X.minX=Math.min(X.minX,z.minX),X.minY=Math.min(X.minY,z.minY),X.maxX=Math.max(X.maxX,z.maxX),X.maxY=Math.max(X.maxY,z.maxY),ee==="Point"||ee==="MultiPoint")for(let ne=0;ne<G.length;ne+=3)ie.push(G[ne],G[ne+1]),X.numPoints++,X.numSimplified++;else if(ee==="LineString")at(ie,G,X,M,!1,!1);else if(ee==="MultiLineString"||ee==="Polygon")for(let ne=0;ne<G.length;ne++)at(ie,G[ne],X,M,ee==="Polygon",ne===0);else if(ee==="MultiPolygon")for(let ne=0;ne<G.length;ne++){const K=G[ne];for(let pe=0;pe<K.length;pe++)at(ie,K[pe],X,M,!0,pe===0)}if(ie.length){let ne=z.tags||null;if(ee==="LineString"&&V.lineMetrics){ne={};for(const pe in z.tags)ne[pe]=z.tags[pe];ne.mapbox_clip_start=G.start/G.size,ne.mapbox_clip_end=G.end/G.size}const K={geometry:ie,type:ee==="Polygon"||ee==="MultiPolygon"?3:ee==="LineString"||ee==="MultiLineString"?2:1,tags:ne};z.id!==null&&(K.id=z.id),X.features.push(K)}}function at(X,z,M,V,G,ee){const ie=V*V;if(V>0&&z.size<(G?ie:V))return void(M.numPoints+=z.length/3);const ne=[];for(let K=0;K<z.length;K+=3)(V===0||z[K+2]>ie)&&(M.numSimplified++,ne.push(z[K],z[K+1])),M.numPoints++;G&&function(K,pe){let xe=0;for(let he=0,Ie=K.length,Ge=Ie-2;he<Ie;Ge=he,he+=2)xe+=(K[he]-K[Ge])*(K[he+1]+K[Ge+1]);if(xe>0===pe)for(let he=0,Ie=K.length;he<Ie/2;he+=2){const Ge=K[he],Xe=K[he+1];K[he]=K[Ie-2-he],K[he+1]=K[Ie-1-he],K[Ie-2-he]=Ge,K[Ie-1-he]=Xe}}(ne,ee),X.push(ne)}const Ye={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class Pi{constructor(z,M){const V=(M=this.options=function(ee,ie){for(const ne in ie)ee[ne]=ie[ne];return ee}(Object.create(Ye),M)).debug;if(V&&console.time("preprocess data"),M.maxZoom<0||M.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(M.promoteId&&M.generateId)throw new Error("promoteId and generateId cannot be used together.");let G=function(ee,ie){const ne=[];if(ee.type==="FeatureCollection")for(let K=0;K<ee.features.length;K++)Ur(ne,ee.features[K],ie,K);else Ur(ne,ee.type==="Feature"?ee:{geometry:ee},ie);return ne}(z,M);this.tiles={},this.tileCoords=[],V&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",M.indexMaxZoom,M.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),G=function(ee,ie){const ne=ie.buffer/ie.extent;let K=ee;const pe=jt(ee,1,-1-ne,ne,0,-1,2,ie),xe=jt(ee,1,1-ne,2+ne,0,-1,2,ie);return(pe||xe)&&(K=jt(ee,1,-ne,1+ne,0,-1,2,ie)||[],pe&&(K=ke(pe,1).concat(K)),xe&&(K=K.concat(ke(xe,-1)))),K}(G,M),G.length&&this.splitTile(G,0,0,0),V&&(G.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}splitTile(z,M,V,G,ee,ie,ne){const K=[z,M,V,G],pe=this.options,xe=pe.debug;for(;K.length;){G=K.pop(),V=K.pop(),M=K.pop(),z=K.pop();const he=1<<M,Ie=tr(M,V,G);let Ge=this.tiles[Ie];if(!Ge&&(xe>1&&console.time("creation"),Ge=this.tiles[Ie]=Zr(z,M,V,G,pe),this.tileCoords.push({z:M,x:V,y:G}),xe)){xe>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",M,V,G,Ge.numFeatures,Ge.numPoints,Ge.numSimplified),console.timeEnd("creation"));const ei=`z${M}`;this.stats[ei]=(this.stats[ei]||0)+1,this.total++}if(Ge.source=z,ee==null){if(M===pe.indexMaxZoom||Ge.numPoints<=pe.indexMaxPoints)continue}else{if(M===pe.maxZoom||M===ee)continue;if(ee!=null){const ei=ee-M;if(V!==ie>>ei||G!==ne>>ei)continue}}if(Ge.source=null,z.length===0)continue;xe>1&&console.time("clipping");const Xe=.5*pe.buffer/pe.extent,nt=.5-Xe,mt=.5+Xe,rt=1+Xe;let Ct=null,Ut=null,Kt=null,lt=null,vt=jt(z,he,V-Xe,V+mt,0,Ge.minX,Ge.maxX,pe),Ot=jt(z,he,V+nt,V+rt,0,Ge.minX,Ge.maxX,pe);z=null,vt&&(Ct=jt(vt,he,G-Xe,G+mt,1,Ge.minY,Ge.maxY,pe),Ut=jt(vt,he,G+nt,G+rt,1,Ge.minY,Ge.maxY,pe),vt=null),Ot&&(Kt=jt(Ot,he,G-Xe,G+mt,1,Ge.minY,Ge.maxY,pe),lt=jt(Ot,he,G+nt,G+rt,1,Ge.minY,Ge.maxY,pe),Ot=null),xe>1&&console.timeEnd("clipping"),K.push(Ct||[],M+1,2*V,2*G),K.push(Ut||[],M+1,2*V,2*G+1),K.push(Kt||[],M+1,2*V+1,2*G),K.push(lt||[],M+1,2*V+1,2*G+1)}}getTile(z,M,V){z=+z,M=+M,V=+V;const G=this.options,{extent:ee,debug:ie}=G;if(z<0||z>24)return null;const ne=1<<z,K=tr(z,M=M+ne&ne-1,V);if(this.tiles[K])return Si(this.tiles[K],ee);ie>1&&console.log("drilling down to z%d-%d-%d",z,M,V);let pe,xe=z,he=M,Ie=V;for(;!pe&&xe>0;)xe--,he>>=1,Ie>>=1,pe=this.tiles[tr(xe,he,Ie)];return pe&&pe.source?(ie>1&&(console.log("found parent tile z%d-%d-%d",xe,he,Ie),console.time("drilling down")),this.splitTile(pe.source,xe,he,Ie,z,M,V),ie>1&&console.timeEnd("drilling down"),this.tiles[K]?Si(this.tiles[K],ee):null):null}}function tr(X,z,M){return 32*((1<<X)*M+z)+X}function it(X,z){return z?X.properties[z]:X.id}function gr(X,z){if(X==null)return!0;if(X.type==="Feature")return it(X,z)!=null;if(X.type==="FeatureCollection"){const M=new Set;for(const V of X.features){const G=it(V,z);if(G==null||M.has(G))return!1;M.add(G)}return!0}return!1}function Mr(X,z){const M=new Map;if(X!=null)if(X.type==="Feature")M.set(it(X,z),X);else for(const V of X.features)M.set(it(V,z),V);return M}class Gr extends le{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(z,M){return T._(this,void 0,void 0,function*(){const V=z.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const G=this._geoJSONIndex.getTile(V.z,V.x,V.y);if(!G)return null;const ee=new class{constructor(ne){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=T.X,this.length=ne.length,this._features=ne}feature(ne){return new class{constructor(K){this._feature=K,this.extent=T.X,this.type=K.type,this.properties=K.tags,"id"in K&&!isNaN(K.id)&&(this.id=parseInt(K.id,10))}loadGeometry(){if(this._feature.type===1){const K=[];for(const pe of this._feature.geometry)K.push([new T.P(pe[0],pe[1])]);return K}{const K=[];for(const pe of this._feature.geometry){const xe=[];for(const he of pe)xe.push(new T.P(he[0],he[1]));K.push(xe)}return K}}toGeoJSON(K,pe,xe){return Oe.call(this,K,pe,xe)}}(this._features[ne])}}(G.features);let ie=dr(ee);return ie.byteOffset===0&&ie.byteLength===ie.buffer.byteLength||(ie=new Uint8Array(ie)),{vectorTile:ee,rawData:ie.buffer}})}loadData(z){return T._(this,void 0,void 0,function*(){var M;(M=this._pendingRequest)===null||M===void 0||M.abort();const V=!!(z&&z.request&&z.request.collectResourceTiming)&&new T.bu(z.request);this._pendingRequest=new AbortController;try{this._pendingData=this.loadAndProcessGeoJSON(z,this._pendingRequest),this._geoJSONIndex=z.cluster?new $r(function({superclusterOptions:ie,clusterProperties:ne}){if(!ne||!ie)return ie;const K={},pe={},xe={accumulated:null,zoom:0},he={properties:null},Ie=Object.keys(ne);for(const Ge of Ie){const[Xe,nt]=ne[Ge],mt=T.bB(nt),rt=T.bB(typeof Xe=="string"?[Xe,["accumulated"],["get",Ge]]:Xe);K[Ge]=mt.value,pe[Ge]=rt.value}return ie.map=Ge=>{he.properties=Ge;const Xe={};for(const nt of Ie)Xe[nt]=K[nt].evaluate(xe,he);return Xe},ie.reduce=(Ge,Xe)=>{he.properties=Xe;for(const nt of Ie)xe.accumulated=Ge[nt],Ge[nt]=pe[nt].evaluate(xe,he)},ie}(z)).load((yield this._pendingData).features):(G=yield this._pendingData,new Pi(G,z.geojsonVtOptions)),this.loaded={};const ee={};if(V){const ie=V.finish();ie&&(ee.resourceTiming={},ee.resourceTiming[z.source]=JSON.parse(JSON.stringify(ie)))}return ee}catch(ee){if(delete this._pendingRequest,T.bA(ee))return{abandoned:!0};throw ee}var G})}getData(){return T._(this,void 0,void 0,function*(){return this._pendingData})}reloadTile(z){const M=this.loaded;return M&&M[z.uid]?super.reloadTile(z):this.loadTile(z)}loadAndProcessGeoJSON(z,M){return T._(this,void 0,void 0,function*(){let V=yield this.loadGeoJSON(z,M);if(delete this._pendingRequest,typeof V!="object")throw new Error(`Input data given to '${z.source}' is not a valid GeoJSON object.`);if(Ke(V,!0),z.filter){const G=T.bB(z.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(G.result==="error")throw new Error(G.value.map(ie=>`${ie.key}: ${ie.message}`).join(", "));V={type:"FeatureCollection",features:V.features.filter(ie=>G.value.evaluate({zoom:0},ie))}}return V})}loadGeoJSON(z,M){return T._(this,void 0,void 0,function*(){const{promoteId:V}=z;if(z.request){const G=yield T.h(z.request,M);return this._dataUpdateable=gr(G.data,V)?Mr(G.data,V):void 0,G.data}if(typeof z.data=="string")try{const G=JSON.parse(z.data);return this._dataUpdateable=gr(G,V)?Mr(G,V):void 0,G}catch{throw new Error(`Input data given to '${z.source}' is not a valid GeoJSON object.`)}if(!z.dataDiff)throw new Error(`Input data given to '${z.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${z.source}`);return function(G,ee,ie){var ne,K,pe,xe;if(ee.removeAll&&G.clear(),ee.remove)for(const he of ee.remove)G.delete(he);if(ee.add)for(const he of ee.add){const Ie=it(he,ie);Ie!=null&&G.set(Ie,he)}if(ee.update)for(const he of ee.update){let Ie=G.get(he.id);if(Ie==null)continue;const Ge=!he.removeAllProperties&&(((ne=he.removeProperties)===null||ne===void 0?void 0:ne.length)>0||((K=he.addOrUpdateProperties)===null||K===void 0?void 0:K.length)>0);if((he.newGeometry||he.removeAllProperties||Ge)&&(Ie=Object.assign({},Ie),G.set(he.id,Ie),Ge&&(Ie.properties=Object.assign({},Ie.properties))),he.newGeometry&&(Ie.geometry=he.newGeometry),he.removeAllProperties)Ie.properties={};else if(((pe=he.removeProperties)===null||pe===void 0?void 0:pe.length)>0)for(const Xe of he.removeProperties)Object.prototype.hasOwnProperty.call(Ie.properties,Xe)&&delete Ie.properties[Xe];if(((xe=he.addOrUpdateProperties)===null||xe===void 0?void 0:xe.length)>0)for(const{key:Xe,value:nt}of he.addOrUpdateProperties)Ie.properties[Xe]=nt}}(this._dataUpdateable,z.dataDiff,V),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(z){return T._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(z){return this._geoJSONIndex.getClusterExpansionZoom(z.clusterId)}getClusterChildren(z){return this._geoJSONIndex.getChildren(z.clusterId)}getClusterLeaves(z){return this._geoJSONIndex.getLeaves(z.clusterId,z.limit,z.offset)}}class _r{constructor(z){this.self=z,this.actor=new T.F(z),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(M,V)=>{if(this.externalWorkerSourceTypes[M])throw new Error(`Worker source with name "${M}" already registered.`);this.externalWorkerSourceTypes[M]=V},this.self.addProtocol=T.bh,this.self.removeProtocol=T.bi,this.self.registerRTLTextPlugin=M=>{if(T.bC.isParsed())throw new Error("RTL text plugin already registered.");T.bC.setMethods(M)},this.actor.registerMessageHandler("LDT",(M,V)=>this._getDEMWorkerSource(M,V.source).loadTile(V)),this.actor.registerMessageHandler("RDT",(M,V)=>T._(this,void 0,void 0,function*(){this._getDEMWorkerSource(M,V.source).removeTile(V)})),this.actor.registerMessageHandler("GCEZ",(M,V)=>T._(this,void 0,void 0,function*(){return this._getWorkerSource(M,V.type,V.source).getClusterExpansionZoom(V)})),this.actor.registerMessageHandler("GCC",(M,V)=>T._(this,void 0,void 0,function*(){return this._getWorkerSource(M,V.type,V.source).getClusterChildren(V)})),this.actor.registerMessageHandler("GCL",(M,V)=>T._(this,void 0,void 0,function*(){return this._getWorkerSource(M,V.type,V.source).getClusterLeaves(V)})),this.actor.registerMessageHandler("LD",(M,V)=>this._getWorkerSource(M,V.type,V.source).loadData(V)),this.actor.registerMessageHandler("GD",(M,V)=>this._getWorkerSource(M,V.type,V.source).getData()),this.actor.registerMessageHandler("LT",(M,V)=>this._getWorkerSource(M,V.type,V.source).loadTile(V)),this.actor.registerMessageHandler("RT",(M,V)=>this._getWorkerSource(M,V.type,V.source).reloadTile(V)),this.actor.registerMessageHandler("AT",(M,V)=>this._getWorkerSource(M,V.type,V.source).abortTile(V)),this.actor.registerMessageHandler("RMT",(M,V)=>this._getWorkerSource(M,V.type,V.source).removeTile(V)),this.actor.registerMessageHandler("RS",(M,V)=>T._(this,void 0,void 0,function*(){if(!this.workerSources[M]||!this.workerSources[M][V.type]||!this.workerSources[M][V.type][V.source])return;const G=this.workerSources[M][V.type][V.source];delete this.workerSources[M][V.type][V.source],G.removeSource!==void 0&&G.removeSource(V)})),this.actor.registerMessageHandler("RM",M=>T._(this,void 0,void 0,function*(){delete this.layerIndexes[M],delete this.availableImages[M],delete this.workerSources[M],delete this.demWorkerSources[M]})),this.actor.registerMessageHandler("SR",(M,V)=>T._(this,void 0,void 0,function*(){this.referrer=V})),this.actor.registerMessageHandler("SRPS",(M,V)=>this._syncRTLPluginState(M,V)),this.actor.registerMessageHandler("IS",(M,V)=>T._(this,void 0,void 0,function*(){this.self.importScripts(V)})),this.actor.registerMessageHandler("SI",(M,V)=>this._setImages(M,V)),this.actor.registerMessageHandler("UL",(M,V)=>T._(this,void 0,void 0,function*(){this._getLayerIndex(M).update(V.layers,V.removedIds)})),this.actor.registerMessageHandler("SL",(M,V)=>T._(this,void 0,void 0,function*(){this._getLayerIndex(M).replace(V)}))}_setImages(z,M){return T._(this,void 0,void 0,function*(){this.availableImages[z]=M;for(const V in this.workerSources[z]){const G=this.workerSources[z][V];for(const ee in G)G[ee].availableImages=M}})}_syncRTLPluginState(z,M){return T._(this,void 0,void 0,function*(){if(T.bC.isParsed())return T.bC.getState();if(M.pluginStatus!=="loading")return T.bC.setState(M),M;const V=M.pluginURL;if(this.self.importScripts(V),T.bC.isParsed()){const G={pluginStatus:"loaded",pluginURL:V};return T.bC.setState(G),G}throw T.bC.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${V}`)})}_getAvailableImages(z){let M=this.availableImages[z];return M||(M=[]),M}_getLayerIndex(z){let M=this.layerIndexes[z];return M||(M=this.layerIndexes[z]=new c),M}_getWorkerSource(z,M,V){if(this.workerSources[z]||(this.workerSources[z]={}),this.workerSources[z][M]||(this.workerSources[z][M]={}),!this.workerSources[z][M][V]){const G={sendAsync:(ee,ie)=>(ee.targetMapId=z,this.actor.sendAsync(ee,ie))};switch(M){case"vector":this.workerSources[z][M][V]=new le(G,this._getLayerIndex(z),this._getAvailableImages(z));break;case"geojson":this.workerSources[z][M][V]=new Gr(G,this._getLayerIndex(z),this._getAvailableImages(z));break;default:this.workerSources[z][M][V]=new this.externalWorkerSourceTypes[M](G,this._getLayerIndex(z),this._getAvailableImages(z))}}return this.workerSources[z][M][V]}_getDEMWorkerSource(z,M){return this.demWorkerSources[z]||(this.demWorkerSources[z]={}),this.demWorkerSources[z][M]||(this.demWorkerSources[z][M]=new oe),this.demWorkerSources[z][M]}}return T.i(self)&&(self.worker=new _r(self)),_r}),L("index",["exports","./shared"],function(T,c){var fe="4.5.2";let me,ve;const le={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:u=>new Promise((t,n)=>{const o=requestAnimationFrame(t);u.signal.addEventListener("abort",()=>{cancelAnimationFrame(o),n(c.c())})}),getImageData(u,t=0){return this.getImageCanvasContext(u).getImageData(-t,-t,u.width+2*t,u.height+2*t)},getImageCanvasContext(u){const t=window.document.createElement("canvas"),n=t.getContext("2d",{willReadFrequently:!0});if(!n)throw new Error("failed to create canvas 2d context");return t.width=u.width,t.height=u.height,n.drawImage(u,0,0,u.width,u.height),n},resolveURL:u=>(me||(me=document.createElement("a")),me.href=u,me.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(ve==null&&(ve=matchMedia("(prefers-reduced-motion: reduce)")),ve.matches)}};class oe{static testProp(t){if(!oe.docStyle)return t[0];for(let n=0;n<t.length;n++)if(t[n]in oe.docStyle)return t[n];return t[0]}static create(t,n,o){const a=window.document.createElement(t);return n!==void 0&&(a.className=n),o&&o.appendChild(a),a}static createNS(t,n){return window.document.createElementNS(t,n)}static disableDrag(){oe.docStyle&&oe.selectProp&&(oe.userSelect=oe.docStyle[oe.selectProp],oe.docStyle[oe.selectProp]="none")}static enableDrag(){oe.docStyle&&oe.selectProp&&(oe.docStyle[oe.selectProp]=oe.userSelect)}static setTransform(t,n){t.style[oe.transformProp]=n}static addEventListener(t,n,o,a={}){t.addEventListener(n,o,"passive"in a?a:a.capture)}static removeEventListener(t,n,o,a={}){t.removeEventListener(n,o,"passive"in a?a:a.capture)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",oe.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",oe.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",oe.suppressClickInternal,!0)},0)}static getScale(t){const n=t.getBoundingClientRect();return{x:n.width/t.offsetWidth||1,y:n.height/t.offsetHeight||1,boundingClientRect:n}}static getPoint(t,n,o){const a=n.boundingClientRect;return new c.P((o.clientX-a.left)/n.x-t.clientLeft,(o.clientY-a.top)/n.y-t.clientTop)}static mousePos(t,n){const o=oe.getScale(t);return oe.getPoint(t,o,n)}static touchPos(t,n){const o=[],a=oe.getScale(t);for(let h=0;h<n.length;h++)o.push(oe.getPoint(t,a,n[h]));return o}static mouseButton(t){return t.button}static remove(t){t.parentNode&&t.parentNode.removeChild(t)}}oe.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,oe.selectProp=oe.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),oe.transformProp=oe.testProp(["transform","WebkitTransform"]);const ht={supported:!1,testSupport:function(u){!Oe&&Ke&&(ft?st(u):je=u)}};let je,Ke,Oe=!1,ft=!1;function st(u){const t=u.createTexture();u.bindTexture(u.TEXTURE_2D,t);try{if(u.texImage2D(u.TEXTURE_2D,0,u.RGBA,u.RGBA,u.UNSIGNED_BYTE,Ke),u.isContextLost())return;ht.supported=!0}catch{}u.deleteTexture(t),Oe=!0}var He;typeof document<"u"&&(Ke=document.createElement("img"),Ke.onload=()=>{je&&st(je),je=null,ft=!0},Ke.onerror=()=>{Oe=!0,je=null},Ke.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(u){let t,n,o,a;u.resetRequestQueue=()=>{t=[],n=0,o=0,a={}},u.addThrottleControl=b=>{const w=o++;return a[w]=b,w},u.removeThrottleControl=b=>{delete a[b],g()},u.getImage=(b,w,C=!0)=>new Promise((E,R)=>{ht.supported&&(b.headers||(b.headers={}),b.headers.accept="image/webp,*/*"),c.e(b,{type:"image"}),t.push({abortController:w,requestParameters:b,supportImageRefresh:C,state:"queued",onError:F=>{R(F)},onSuccess:F=>{E(F)}}),g()});const h=b=>c._(this,void 0,void 0,function*(){b.state="running";const{requestParameters:w,supportImageRefresh:C,onError:E,onSuccess:R,abortController:F}=b,$=C===!1&&!c.i(self)&&!c.g(w.url)&&(!w.headers||Object.keys(w.headers).reduce((W,Y)=>W&&Y==="accept",!0));n++;const H=$?y(w,F):c.m(w,F);try{const W=yield H;delete b.abortController,b.state="completed",W.data instanceof HTMLImageElement||c.b(W.data)?R(W):W.data&&R({data:yield(U=W.data,typeof createImageBitmap=="function"?c.d(U):c.f(U)),cacheControl:W.cacheControl,expires:W.expires})}catch(W){delete b.abortController,E(W)}finally{n--,g()}var U}),g=()=>{const b=(()=>{for(const w of Object.keys(a))if(a[w]())return!0;return!1})()?c.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:c.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let w=n;w<b&&t.length>0;w++){const C=t.shift();C.abortController.signal.aborted?w--:h(C)}},y=(b,w)=>new Promise((C,E)=>{const R=new Image,F=b.url,$=b.credentials;$&&$==="include"?R.crossOrigin="use-credentials":($&&$==="same-origin"||!c.s(F))&&(R.crossOrigin="anonymous"),w.signal.addEventListener("abort",()=>{R.src="",E(c.c())}),R.fetchPriority="high",R.onload=()=>{R.onerror=R.onload=null,C({data:R})},R.onerror=()=>{R.onerror=R.onload=null,w.signal.aborted||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."))},R.src=F})}(He||(He={})),He.resetRequestQueue();class Ft{constructor(t){this._transformRequestFn=t}transformRequest(t,n){return this._transformRequestFn&&this._transformRequestFn(t,n)||{url:t}}setTransformRequest(t){this._transformRequestFn=t}}function wt(u){var t=new c.A(3);return t[0]=u[0],t[1]=u[1],t[2]=u[2],t}var Xt,$t=function(u,t,n){return u[0]=t[0]-n[0],u[1]=t[1]-n[1],u[2]=t[2]-n[2],u};Xt=new c.A(3),c.A!=Float32Array&&(Xt[0]=0,Xt[1]=0,Xt[2]=0);var Vr=function(u){var t=u[0],n=u[1];return t*t+n*n};function bi(u){const t=[];if(typeof u=="string")t.push({id:"default",url:u});else if(u&&u.length>0){const n=[];for(const{id:o,url:a}of u){const h=`${o}${a}`;n.indexOf(h)===-1&&(n.push(h),t.push({id:o,url:a}))}}return t}function Nr(u,t,n){const o=u.split("?");return o[0]+=`${t}${n}`,o.join("?")}(function(){var u=new c.A(2);c.A!=Float32Array&&(u[0]=0,u[1]=0)})();class St{constructor(t,n,o,a){this.context=t,this.format=o,this.texture=t.gl.createTexture(),this.update(n,a)}update(t,n,o){const{width:a,height:h}=t,g=!(this.size&&this.size[0]===a&&this.size[1]===h||o),{context:y}=this,{gl:b}=y;if(this.useMipmap=!!(n&&n.useMipmap),b.bindTexture(b.TEXTURE_2D,this.texture),y.pixelStoreUnpackFlipY.set(!1),y.pixelStoreUnpack.set(1),y.pixelStoreUnpackPremultiplyAlpha.set(this.format===b.RGBA&&(!n||n.premultiply!==!1)),g)this.size=[a,h],t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||c.b(t)?b.texImage2D(b.TEXTURE_2D,0,this.format,this.format,b.UNSIGNED_BYTE,t):b.texImage2D(b.TEXTURE_2D,0,this.format,a,h,0,this.format,b.UNSIGNED_BYTE,t.data);else{const{x:w,y:C}=o||{x:0,y:0};t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||c.b(t)?b.texSubImage2D(b.TEXTURE_2D,0,w,C,b.RGBA,b.UNSIGNED_BYTE,t):b.texSubImage2D(b.TEXTURE_2D,0,w,C,a,h,b.RGBA,b.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&b.generateMipmap(b.TEXTURE_2D)}bind(t,n,o){const{context:a}=this,{gl:h}=a;h.bindTexture(h.TEXTURE_2D,this.texture),o!==h.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(o=h.LINEAR),t!==this.filter&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,t),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,o||t),this.filter=t),n!==this.wrap&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,n),h.texParameteri(h.TEXTURE_2D,h.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 js(u){const{userImage:t}=u;return!!(t&&t.render&&t.render())&&(u.data.replace(new Uint8Array(t.data.buffer)),!0)}class li extends c.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new c.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(const{ids:n,promiseResolve:o}of this.requestors)o(this._getImagesForIds(n));this.requestors=[]}}getImage(t){const n=this.images[t];if(n&&!n.data&&n.spriteData){const o=n.spriteData;n.data=new c.R({width:o.width,height:o.height},o.context.getImageData(o.x,o.y,o.width,o.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 o=!0;const a=n.data||n.spriteData;return this._validateStretch(n.stretchX,a&&a.width)||(this.fire(new c.j(new Error(`Image "${t}" has invalid "stretchX" value`))),o=!1),this._validateStretch(n.stretchY,a&&a.height)||(this.fire(new c.j(new Error(`Image "${t}" has invalid "stretchY" value`))),o=!1),this._validateContent(n.content,n)||(this.fire(new c.j(new Error(`Image "${t}" has invalid "content" value`))),o=!1),o}_validateStretch(t,n){if(!t)return!0;let o=0;for(const a of t){if(a[0]<o||a[1]<a[0]||n<a[1])return!1;o=a[1]}return!0}_validateContent(t,n){if(!t)return!0;if(t.length!==4)return!1;const o=n.spriteData,a=o&&o.width||n.data.width,h=o&&o.height||n.data.height;return!(t[0]<0||a<t[0]||t[1]<0||h<t[1]||t[2]<0||a<t[2]||t[3]<0||h<t[3]||t[2]<t[0]||t[3]<t[1])}updateImage(t,n,o=!0){const a=this.getImage(t);if(o&&(a.data.width!==n.data.width||a.data.height!==n.data.height))throw new Error(`size mismatch between old image (${a.data.width}x${a.data.height}) and new image (${n.data.width}x${n.data.height}).`);n.version=a.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){return new Promise((n,o)=>{let a=!0;if(!this.isLoaded())for(const h of t)this.images[h]||(a=!1);this.isLoaded()||a?n(this._getImagesForIds(t)):this.requestors.push({ids:t,promiseResolve:n})})}_getImagesForIds(t){const n={};for(const o of t){let a=this.getImage(o);a||(this.fire(new c.k("styleimagemissing",{id:o})),a=this.getImage(o)),a?n[o]={data:a.data.clone(),pixelRatio:a.pixelRatio,sdf:a.sdf,version:a.version,stretchX:a.stretchX,stretchY:a.stretchY,content:a.content,textFitWidth:a.textFitWidth,textFitHeight:a.textFitHeight,hasRenderCallback:!!(a.userImage&&a.userImage.render)}:c.w(`Image "${o}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}return n}getPixelSize(){const{width:t,height:n}=this.atlasImage;return{width:t,height:n}}getPattern(t){const n=this.patterns[t],o=this.getImage(t);if(!o)return null;if(n&&n.position.version===o.version)return n.position;if(n)n.position.version=o.version;else{const a={w:o.data.width+2,h:o.data.height+2,x:0,y:0},h=new c.I(a,o);this.patterns[t]={bin:a,position:h}}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 St(t,this.atlasImage,n.RGBA),this.atlasTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}_updatePatternAtlas(){const t=[];for(const h in this.patterns)t.push(this.patterns[h].bin);const{w:n,h:o}=c.p(t),a=this.atlasImage;a.resize({width:n||1,height:o||1});for(const h in this.patterns){const{bin:g}=this.patterns[h],y=g.x+1,b=g.y+1,w=this.getImage(h).data,C=w.width,E=w.height;c.R.copy(w,a,{x:0,y:0},{x:y,y:b},{width:C,height:E}),c.R.copy(w,a,{x:0,y:E-1},{x:y,y:b-1},{width:C,height:1}),c.R.copy(w,a,{x:0,y:0},{x:y,y:b+E},{width:C,height:1}),c.R.copy(w,a,{x:C-1,y:0},{x:y-1,y:b},{width:1,height:E}),c.R.copy(w,a,{x:0,y:0},{x:y+C,y:b},{width:1,height:E})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(t){for(const n of t){if(this.callbackDispatchedThisFrame[n])continue;this.callbackDispatchedThisFrame[n]=!0;const o=this.getImage(n);o||c.w(`Image with ID: "${n}" was not found`),js(o)&&this.updateImage(n,o)}}}const wi=1e20;function Cr(u,t,n,o,a,h,g,y,b){for(let w=t;w<t+o;w++)En(u,n*h+w,h,a,g,y,b);for(let w=n;w<n+a;w++)En(u,w*h+t,1,o,g,y,b)}function En(u,t,n,o,a,h,g){h[0]=0,g[0]=-wi,g[1]=wi,a[0]=u[t];for(let y=1,b=0,w=0;y<o;y++){a[y]=u[t+y*n];const C=y*y;do{const E=h[b];w=(a[y]-a[E]+C-E*E)/(y-E)/2}while(w<=g[b]&&--b>-1);b++,h[b]=y,g[b]=w,g[b+1]=wi}for(let y=0,b=0;y<o;y++){for(;g[b+1]<y;)b++;const w=h[b],C=y-w;u[t+y*n]=a[w]+C*C}}class dr{constructor(t,n){this.requestManager=t,this.localIdeographFontFamily=n,this.entries={}}setURL(t){this.url=t}getGlyphs(t){return c._(this,void 0,void 0,function*(){const n=[];for(const h in t)for(const g of t[h])n.push(this._getAndCacheGlyphsPromise(h,g));const o=yield Promise.all(n),a={};for(const{stack:h,id:g,glyph:y}of o)a[h]||(a[h]={}),a[h][g]=y&&{id:y.id,bitmap:y.bitmap.clone(),metrics:y.metrics};return a})}_getAndCacheGlyphsPromise(t,n){return c._(this,void 0,void 0,function*(){let o=this.entries[t];o||(o=this.entries[t]={glyphs:{},requests:{},ranges:{}});let a=o.glyphs[n];if(a!==void 0)return{stack:t,id:n,glyph:a};if(a=this._tinySDF(o,t,n),a)return o.glyphs[n]=a,{stack:t,id:n,glyph:a};const h=Math.floor(n/256);if(256*h>65535)throw new Error("glyphs > 65535 not supported");if(o.ranges[h])return{stack:t,id:n,glyph:a};if(!this.url)throw new Error("glyphsUrl is not set");if(!o.requests[h]){const y=dr.loadGlyphRange(t,h,this.url,this.requestManager);o.requests[h]=y}const g=yield o.requests[h];for(const y in g)this._doesCharSupportLocalGlyph(+y)||(o.glyphs[+y]=g[+y]);return o.ranges[h]=!0,{stack:t,id:n,glyph:g[n]||null}})}_doesCharSupportLocalGlyph(t){return!!this.localIdeographFontFamily&&(c.u["CJK Unified Ideographs"](t)||c.u["Hangul Syllables"](t)||c.u.Hiragana(t)||c.u.Katakana(t))}_tinySDF(t,n,o){const a=this.localIdeographFontFamily;if(!a||!this._doesCharSupportLocalGlyph(o))return;let h=t.tinySDF;if(!h){let y="400";/bold/i.test(n)?y="900":/medium/i.test(n)?y="500":/light/i.test(n)&&(y="200"),h=t.tinySDF=new dr.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:a,fontWeight:y})}const g=h.draw(String.fromCharCode(o));return{id:o,bitmap:new c.o({width:g.width||60,height:g.height||60},g.data),metrics:{width:g.glyphWidth/2||24,height:g.glyphHeight/2||24,left:g.glyphLeft/2+.5||0,top:g.glyphTop/2-27.5||-8,advance:g.glyphAdvance/2||24,isDoubleResolution:!0}}}}dr.loadGlyphRange=function(u,t,n,o){return c._(this,void 0,void 0,function*(){const a=256*t,h=a+255,g=o.transformRequest(n.replace("{fontstack}",u).replace("{range}",`${a}-${h}`),"Glyphs"),y=yield c.l(g,new AbortController);if(!y||!y.data)throw new Error(`Could not load glyph range. range: ${t}, ${a}-${h}`);const b={};for(const w of c.n(y.data))b[w.id]=w;return b})},dr.TinySDF=class{constructor({fontSize:u=24,buffer:t=3,radius:n=8,cutoff:o=.25,fontFamily:a="sans-serif",fontWeight:h="normal",fontStyle:g="normal"}={}){this.buffer=t,this.cutoff=o,this.radius=n;const y=this.size=u+4*t,b=this._createCanvas(y),w=this.ctx=b.getContext("2d",{willReadFrequently:!0});w.font=`${g} ${h} ${u}px ${a}`,w.textBaseline="alphabetic",w.textAlign="left",w.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(u){const t=document.createElement("canvas");return t.width=t.height=u,t}draw(u){const{width:t,actualBoundingBoxAscent:n,actualBoundingBoxDescent:o,actualBoundingBoxLeft:a,actualBoundingBoxRight:h}=this.ctx.measureText(u),g=Math.ceil(n),y=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(h-a))),b=Math.min(this.size-this.buffer,g+Math.ceil(o)),w=y+2*this.buffer,C=b+2*this.buffer,E=Math.max(w*C,0),R=new Uint8ClampedArray(E),F={data:R,width:w,height:C,glyphWidth:y,glyphHeight:b,glyphTop:g,glyphLeft:0,glyphAdvance:t};if(y===0||b===0)return F;const{ctx:$,buffer:H,gridInner:U,gridOuter:W}=this;$.clearRect(H,H,y,b),$.fillText(u,H,H+g);const Y=$.getImageData(H,H,y,b);W.fill(wi,0,E),U.fill(0,0,E);for(let j=0;j<b;j++)for(let te=0;te<y;te++){const se=Y.data[4*(j*y+te)+3]/255;if(se===0)continue;const ce=(j+H)*w+te+H;if(se===1)W[ce]=0,U[ce]=wi;else{const ye=.5-se;W[ce]=ye>0?ye*ye:0,U[ce]=ye<0?ye*ye:0}}Cr(W,0,0,w,C,w,this.f,this.v,this.z),Cr(U,H,H,y,b,w,this.f,this.v,this.z);for(let j=0;j<E;j++){const te=Math.sqrt(W[j])-Math.sqrt(U[j]);R[j]=Math.round(255-255*(te/this.radius+this.cutoff))}return F}};class Us{constructor(){this.specification=c.v.light.position}possiblyEvaluate(t,n){return c.y(t.expression.evaluate(n))}interpolate(t,n,o){return{x:c.z.number(t.x,n.x,o),y:c.z.number(t.y,n.y,o),z:c.z.number(t.z,n.z,o)}}}let on;class Er extends c.E{constructor(t){super(),on=on||new c.q({anchor:new c.D(c.v.light.anchor),position:new Us,color:new c.D(c.v.light.color),intensity:new c.D(c.v.light.intensity)}),this._transitionable=new c.T(on),this.setLight(t),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,n={}){if(!this._validate(c.r,t,n))for(const o in t){const a=t[o];o.endsWith("-transition")?this._transitionable.setTransition(o.slice(0,-11),a):this._transitionable.setValue(o,a)}}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,o){return(!o||o.validate!==!1)&&c.t(this,t.call(c.x,{value:n,style:{glyphs:!0,sprite:!0},styleSpec:c.v}))}}const Ei=new c.q({"sky-color":new c.D(c.v.sky["sky-color"]),"horizon-color":new c.D(c.v.sky["horizon-color"]),"fog-color":new c.D(c.v.sky["fog-color"]),"fog-ground-blend":new c.D(c.v.sky["fog-ground-blend"]),"horizon-fog-blend":new c.D(c.v.sky["horizon-fog-blend"]),"sky-horizon-blend":new c.D(c.v.sky["sky-horizon-blend"]),"atmosphere-blend":new c.D(c.v.sky["atmosphere-blend"])});class Qi extends c.E{constructor(t){super(),this._transitionable=new c.T(Ei),this.setSky(t),this._transitioning=this._transitionable.untransitioned()}setSky(t,n={}){if(!this._validate(c.B,t,n))for(const o in t){const a=t[o];o.endsWith("-transition")?this._transitionable.setTransition(o.slice(0,-11),a):this._transitionable.setValue(o,a)}}getSky(){return this._transitionable.serialize()}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,n,o={}){return(o==null?void 0:o.validate)!==!1&&c.t(this,t.call(c.x,c.e({value:n,style:{glyphs:!0,sprite:!0},styleSpec:c.v})))}calculateFogBlendOpacity(t){return t<60?0:t<70?(t-60)/10:1}}class Pn{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 o=t.join(",")+String(n);return this.dashEntry[o]||(this.dashEntry[o]=this.addDash(t,n)),this.dashEntry[o]}getDashRanges(t,n,o){const a=[];let h=t.length%2==1?-t[t.length-1]*o:0,g=t[0]*o,y=!0;a.push({left:h,right:g,isDash:y,zeroLength:t[0]===0});let b=t[0];for(let w=1;w<t.length;w++){y=!y;const C=t[w];h=b*o,b+=C,g=b*o,a.push({left:h,right:g,isDash:y,zeroLength:C===0})}return a}addRoundDash(t,n,o){const a=n/2;for(let h=-o;h<=o;h++){const g=this.width*(this.nextRow+o+h);let y=0,b=t[y];for(let w=0;w<this.width;w++){w/b.right>1&&(b=t[++y]);const C=Math.abs(w-b.left),E=Math.abs(w-b.right),R=Math.min(C,E);let F;const $=h/o*(a+1);if(b.isDash){const H=a-Math.abs($);F=Math.sqrt(R*R+H*H)}else F=a-Math.sqrt(R*R+$*$);this.data[g+w]=Math.max(0,Math.min(255,F+128))}}}addRegularDash(t){for(let y=t.length-1;y>=0;--y){const b=t[y],w=t[y+1];b.zeroLength?t.splice(y,1):w&&w.isDash===b.isDash&&(w.left=b.left,t.splice(y,1))}const n=t[0],o=t[t.length-1];n.isDash===o.isDash&&(n.left=o.left-this.width,o.right=n.right+this.width);const a=this.width*this.nextRow;let h=0,g=t[h];for(let y=0;y<this.width;y++){y/g.right>1&&(g=t[++h]);const b=Math.abs(y-g.left),w=Math.abs(y-g.right),C=Math.min(b,w);this.data[a+y]=Math.max(0,Math.min(255,(g.isDash?C:-C)+128))}}addDash(t,n){const o=n?7:0,a=2*o+1;if(this.nextRow+a>this.height)return c.w("LineAtlas out of space"),null;let h=0;for(let y=0;y<t.length;y++)h+=t[y];if(h!==0){const y=this.width/h,b=this.getDashRanges(t,this.width,y);n?this.addRoundDash(b,y,o):this.addRegularDash(b)}const g={y:(this.nextRow+o+.5)/this.height,height:2*o/this.height,width:h};return this.nextRow+=a,this.dirty=!0,g}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))}}const $r="maplibre_preloaded_worker_pool";class pr{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<pr.workerCount;)this.workers.push(new Worker(c.a.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[$r]}numActive(){return Object.keys(this.active).length}}const An=Math.floor(le.hardwareConcurrency/2);let Oi,er;function an(){return Oi||(Oi=new pr),Oi}pr.workerCount=c.C(globalThis)?Math.max(Math.min(An,3),1):1;class ln{constructor(t,n){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=n;const o=this.workerPool.acquire(n);for(let a=0;a<o.length;a++){const h=new c.F(o[a],n);h.name=`Worker ${a}`,this.actors.push(h)}if(!this.actors.length)throw new Error("No actors found")}broadcast(t,n){const o=[];for(const a of this.actors)o.push(a.sendAsync({type:t,data:n}));return Promise.all(o)}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)}registerMessageHandler(t,n){for(const o of this.actors)o.registerMessageHandler(t,n)}}function ns(){return er||(er=new ln(an(),c.G),er.registerMessageHandler("GR",(u,t,n)=>c.m(t,n))),er}function Pr(u,t){const n=c.H();return c.J(n,n,[1,1,0]),c.K(n,n,[.5*u.width,.5*u.height,1]),c.L(n,n,u.calculatePosMatrix(t.toUnwrapped()))}function jr(u,t,n,o,a,h){const g=function(E,R,F){if(E)for(const $ of E){const H=R[$];if(H&&H.source===F&&H.type==="fill-extrusion")return!0}else for(const $ in R){const H=R[$];if(H.source===F&&H.type==="fill-extrusion")return!0}return!1}(a&&a.layers,t,u.id),y=h.maxPitchScaleFactor(),b=u.tilesIn(o,y,g);b.sort(Ur);const w=[];for(const E of b)w.push({wrappedTileID:E.tileID.wrapped().key,queryResults:E.tile.queryRenderedFeatures(t,n,u._state,E.queryGeometry,E.cameraQueryGeometry,E.scale,a,h,y,Pr(u.transform,E.tileID))});const C=function(E){const R={},F={};for(const $ of E){const H=$.queryResults,U=$.wrappedTileID,W=F[U]=F[U]||{};for(const Y in H){const j=H[Y],te=W[Y]=W[Y]||{},se=R[Y]=R[Y]||[];for(const ce of j)te[ce.featureIndex]||(te[ce.featureIndex]=!0,se.push(ce))}}return R}(w);for(const E in C)C[E].forEach(R=>{const F=R.feature,$=u.getFeatureState(F.layer["source-layer"],F.id);F.source=F.layer.source,F.layer["source-layer"]&&(F.sourceLayer=F.layer["source-layer"]),F.state=$});return C}function Ur(u,t){const n=u.tileID,o=t.tileID;return n.overscaledZ-o.overscaledZ||n.canonical.y-o.canonical.y||n.wrap-o.wrap||n.canonical.x-o.canonical.x}function Mn(u,t,n){return c._(this,void 0,void 0,function*(){let o=u;if(u.url?o=(yield c.h(t.transformRequest(u.url,"Source"),n)).data:yield le.frameAsync(n),!o)return null;const a=c.M(c.e(o,u),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in o&&o.vector_layers&&(a.vectorLayerIds=o.vector_layers.map(h=>h.id)),a})}class ue{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 c.N?new c.N(t.lng,t.lat):c.N.convert(t),this}setSouthWest(t){return this._sw=t instanceof c.N?new c.N(t.lng,t.lat):c.N.convert(t),this}extend(t){const n=this._sw,o=this._ne;let a,h;if(t instanceof c.N)a=t,h=t;else{if(!(t instanceof ue))return Array.isArray(t)?t.length===4||t.every(Array.isArray)?this.extend(ue.convert(t)):this.extend(c.N.convert(t)):t&&("lng"in t||"lon"in t)&&"lat"in t?this.extend(c.N.convert(t)):this;if(a=t._sw,h=t._ne,!a||!h)return this}return n||o?(n.lng=Math.min(a.lng,n.lng),n.lat=Math.min(a.lat,n.lat),o.lng=Math.max(h.lng,o.lng),o.lat=Math.max(h.lat,o.lat)):(this._sw=new c.N(a.lng,a.lat),this._ne=new c.N(h.lng,h.lat)),this}getCenter(){return new c.N((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new c.N(this.getWest(),this.getNorth())}getSouthEast(){return new c.N(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(t){const{lng:n,lat:o}=c.N.convert(t);let a=this._sw.lng<=n&&n<=this._ne.lng;return this._sw.lng>this._ne.lng&&(a=this._sw.lng>=n&&n>=this._ne.lng),this._sw.lat<=o&&o<=this._ne.lat&&a}static convert(t){return t instanceof ue?t:t&&new ue(t)}static fromLngLat(t,n=0){const o=360*n/40075017,a=o/Math.cos(Math.PI/180*t.lat);return new ue(new c.N(t.lng-a,t.lat-o),new c.N(t.lng+a,t.lat+o))}}class cn{constructor(t,n,o){this.bounds=ue.convert(this.validateBounds(t)),this.minzoom=n||0,this.maxzoom=o||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),o=Math.floor(c.O(this.bounds.getWest())*n),a=Math.floor(c.Q(this.bounds.getNorth())*n),h=Math.ceil(c.O(this.bounds.getEast())*n),g=Math.ceil(c.Q(this.bounds.getSouth())*n);return t.x>=o&&t.x<h&&t.y>=a&&t.y<g}}class ss extends c.E{constructor(t,n,o,a){if(super(),this.id=t,this.dispatcher=o,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,c.e(this,c.M(n,["url","scheme","tileSize","promoteId"])),this._options=c.e({type:"vector"},n),this._collectResourceTiming=n.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(a)}load(){return c._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new c.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const t=yield Mn(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),t&&(c.e(this,t),t.bounds&&(this.tileBounds=new cn(t.bounds,this.minzoom,this.maxzoom)),this.fire(new c.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new c.k("data",{dataType:"source",sourceDataType:"content"})))}catch(t){this._tileJSONRequest=null,this.fire(new c.j(t))}})}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.abort(),t(),this.load()}setTiles(t){return this.setSourceProperty(()=>{this._options.tiles=t}),this}setUrl(t){return this.setSourceProperty(()=>{this.url=t,this._options.url=t}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return c.e({},this._options)}loadTile(t){return c._(this,void 0,void 0,function*(){const n=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),o={request:this.map._requestManager.transformRequest(n,"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};o.request.collectResourceTiming=this._collectResourceTiming;let a="RT";if(t.actor&&t.state!=="expired"){if(t.state==="loading")return new Promise((h,g)=>{t.reloadPromise={resolve:h,reject:g}})}else t.actor=this.dispatcher.getActor(),a="LT";t.abortController=new AbortController;try{const h=yield t.actor.sendAsync({type:a,data:o},t.abortController);if(delete t.abortController,t.aborted)return;this._afterTileLoadWorkerResponse(t,h)}catch(h){if(delete t.abortController,t.aborted)return;if(h&&h.status!==404)throw h;this._afterTileLoadWorkerResponse(t,null)}})}_afterTileLoadWorkerResponse(t,n){if(n&&n.resourceTiming&&(t.resourceTiming=n.resourceTiming),n&&this.map._refreshExpiredTiles&&t.setExpiryData(n),t.loadVectorData(n,this.map.painter),t.reloadPromise){const o=t.reloadPromise;t.reloadPromise=null,this.loadTile(t).then(o.resolve).catch(o.reject)}}abortTile(t){return c._(this,void 0,void 0,function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.actor&&(yield t.actor.sendAsync({type:"AT",data:{uid:t.uid,type:this.type,source:this.id}}))})}unloadTile(t){return c._(this,void 0,void 0,function*(){t.unloadVectorData(),t.actor&&(yield t.actor.sendAsync({type:"RMT",data:{uid:t.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class yt extends c.E{constructor(t,n,o,a){super(),this.id=t,this.dispatcher=o,this.setEventedParent(a),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=c.e({type:"raster"},n),c.e(this,c.M(n,["url","scheme","tileSize"]))}load(){return c._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new c.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const t=yield Mn(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,t&&(c.e(this,t),t.bounds&&(this.tileBounds=new cn(t.bounds,this.minzoom,this.maxzoom)),this.fire(new c.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new c.k("data",{dataType:"source",sourceDataType:"content"})))}catch(t){this._tileJSONRequest=null,this.fire(new c.j(t))}})}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(t){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),t(),this.load()}setTiles(t){return this.setSourceProperty(()=>{this._options.tiles=t}),this}setUrl(t){return this.setSourceProperty(()=>{this.url=t,this._options.url=t}),this}serialize(){return c.e({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t){return c._(this,void 0,void 0,function*(){const n=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.abortController=new AbortController;try{const o=yield He.getImage(this.map._requestManager.transformRequest(n,"Tile"),t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(o&&o.data){this.map._refreshExpiredTiles&&o.cacheControl&&o.expires&&t.setExpiryData({cacheControl:o.cacheControl,expires:o.expires});const a=this.map.painter.context,h=a.gl,g=o.data;t.texture=this.map.painter.getTileTexture(g.width),t.texture?t.texture.update(g,{useMipmap:!0}):(t.texture=new St(a,g,h.RGBA,{useMipmap:!0}),t.texture.bind(h.LINEAR,h.CLAMP_TO_EDGE,h.LINEAR_MIPMAP_NEAREST)),t.state="loaded"}}catch(o){if(delete t.abortController,t.aborted)t.state="unloaded";else if(o)throw t.state="errored",o}})}abortTile(t){return c._(this,void 0,void 0,function*(){t.abortController&&(t.abortController.abort(),delete t.abortController)})}unloadTile(t){return c._(this,void 0,void 0,function*(){t.texture&&this.map.painter.saveTileTexture(t.texture)})}hasTransition(){return!1}}class jt extends yt{constructor(t,n,o,a){super(t,n,o,a),this.type="raster-dem",this.maxzoom=22,this._options=c.e({type:"raster-dem"},n),this.encoding=n.encoding||"mapbox",this.redFactor=n.redFactor,this.greenFactor=n.greenFactor,this.blueFactor=n.blueFactor,this.baseShift=n.baseShift}loadTile(t){return c._(this,void 0,void 0,function*(){const n=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),o=this.map._requestManager.transformRequest(n,"Tile");t.neighboringTiles=this._getNeighboringTiles(t.tileID),t.abortController=new AbortController;try{const a=yield He.getImage(o,t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(a&&a.data){const h=a.data;this.map._refreshExpiredTiles&&a.cacheControl&&a.expires&&t.setExpiryData({cacheControl:a.cacheControl,expires:a.expires});const g=c.b(h)&&c.U()?h:yield this.readImageNow(h),y={type:this.type,uid:t.uid,source:this.id,rawImageData:g,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!t.actor||t.state==="expired"){t.actor=this.dispatcher.getActor();const b=yield t.actor.sendAsync({type:"LDT",data:y});t.dem=b,t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded"}}}catch(a){if(delete t.abortController,t.aborted)t.state="unloaded";else if(a)throw t.state="errored",a}})}readImageNow(t){return c._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&c.V()){const n=t.width+2,o=t.height+2;try{return new c.R({width:n,height:o},yield c.W(t,-1,-1,n,o))}catch{}}return le.getImageData(t,1)})}_getNeighboringTiles(t){const n=t.canonical,o=Math.pow(2,n.z),a=(n.x-1+o)%o,h=n.x===0?t.wrap-1:t.wrap,g=(n.x+1+o)%o,y=n.x+1===o?t.wrap+1:t.wrap,b={};return b[new c.S(t.overscaledZ,h,n.z,a,n.y).key]={backfilled:!1},b[new c.S(t.overscaledZ,y,n.z,g,n.y).key]={backfilled:!1},n.y>0&&(b[new c.S(t.overscaledZ,h,n.z,a,n.y-1).key]={backfilled:!1},b[new c.S(t.overscaledZ,t.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},b[new c.S(t.overscaledZ,y,n.z,g,n.y-1).key]={backfilled:!1}),n.y+1<o&&(b[new c.S(t.overscaledZ,h,n.z,a,n.y+1).key]={backfilled:!1},b[new c.S(t.overscaledZ,t.wrap,n.z,n.x,n.y+1).key]={backfilled:!1},b[new c.S(t.overscaledZ,y,n.z,g,n.y+1).key]={backfilled:!1}),b}unloadTile(t){return c._(this,void 0,void 0,function*(){t.demTexture&&this.map.painter.saveTileTexture(t.demTexture),t.fbo&&(t.fbo.destroy(),delete t.fbo),t.dem&&delete t.dem,delete t.neighboringTiles,t.state="unloaded",t.actor&&(yield t.actor.sendAsync({type:"RDT",data:{type:this.type,uid:t.uid,source:this.id}}))})}}class os extends c.E{constructor(t,n,o,a){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=o.getActor(),this.setEventedParent(a),this._data=n.data,this._options=c.e({},n),this._collectResourceTiming=n.collectResourceTiming,n.maxzoom!==void 0&&(this.maxzoom=n.maxzoom),n.type&&(this.type=n.type),n.attribution&&(this.attribution=n.attribution),this.promoteId=n.promoteId;const h=c.X/this.tileSize;this.workerOptions=c.e({source:this.id,cluster:n.cluster||!1,geojsonVtOptions:{buffer:(n.buffer!==void 0?n.buffer:128)*h,tolerance:(n.tolerance!==void 0?n.tolerance:.375)*h,extent:c.X,maxZoom:this.maxzoom,lineMetrics:n.lineMetrics||!1,generateId:n.generateId||!1},superclusterOptions:{maxZoom:n.clusterMaxZoom!==void 0?n.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,n.clusterMinPoints||2),extent:c.X,radius:(n.clusterRadius||50)*h,log:!1,generateId:n.generateId||!1},clusterProperties:n.clusterProperties,filter:n.filter},n.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}load(){return c._(this,void 0,void 0,function*(){yield this._updateWorkerData()})}onAdd(t){this.map=t,this.load()}setData(t){return this._data=t,this._updateWorkerData(),this}updateData(t){return this._updateWorkerData(t),this}getData(){return c._(this,void 0,void 0,function*(){const t=c.e({type:this.type},this.workerOptions);return this.actor.sendAsync({type:"GD",data:t})})}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){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:t,source:this.id}})}getClusterChildren(t){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:t,source:this.id}})}getClusterLeaves(t,n,o){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:t,limit:n,offset:o}})}_updateWorkerData(t){return c._(this,void 0,void 0,function*(){const n=c.e({type:this.type},this.workerOptions);t?n.dataDiff=t:typeof this._data=="string"?(n.request=this.map._requestManager.transformRequest(le.resolveURL(this._data),"Source"),n.request.collectResourceTiming=this._collectResourceTiming):n.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new c.k("dataloading",{dataType:"source"}));try{const o=yield this.actor.sendAsync({type:"LD",data:n});if(this._pendingLoads--,this._removed||o.abandoned)return void this.fire(new c.k("dataabort",{dataType:"source"}));let a=null;o.resourceTiming&&o.resourceTiming[this.id]&&(a=o.resourceTiming[this.id].slice(0));const h={dataType:"source"};this._collectResourceTiming&&a&&a.length>0&&c.e(h,{resourceTiming:a}),this.fire(new c.k("data",Object.assign(Object.assign({},h),{sourceDataType:"metadata"}))),this.fire(new c.k("data",Object.assign(Object.assign({},h),{sourceDataType:"content"})))}catch(o){if(this._pendingLoads--,this._removed)return void this.fire(new c.k("dataabort",{dataType:"source"}));this.fire(new c.j(o))}})}loaded(){return this._pendingLoads===0}loadTile(t){return c._(this,void 0,void 0,function*(){const n=t.actor?"RT":"LT";t.actor=this.actor;const o={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};t.abortController=new AbortController;const a=yield this.actor.sendAsync({type:n,data:o},t.abortController);delete t.abortController,t.unloadVectorData(),t.aborted||t.loadVectorData(a,this.map.painter,n==="RT")})}abortTile(t){return c._(this,void 0,void 0,function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.aborted=!0})}unloadTile(t){return c._(this,void 0,void 0,function*(){t.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:t.uid,type:this.type,source:this.id}})})}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return c.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var qr=c.Y([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Ar extends c.E{constructor(t,n,o,a){super(),this.id=t,this.dispatcher=o,this.coordinates=n.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(a),this.options=n}load(t){return c._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new c.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const n=yield He.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,n&&n.data&&(this.image=n.data,t&&(this.coordinates=t),this._finishLoading())}catch(n){this._request=null,this._loaded=!0,this.fire(new c.j(n))}})}loaded(){return this._loaded}updateImage(t){return t.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=t.url,this.load(t.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new c.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(t){this.coordinates=t;const n=t.map(c.Z.fromLngLat);this.tileID=function(a){let h=1/0,g=1/0,y=-1/0,b=-1/0;for(const R of a)h=Math.min(h,R.x),g=Math.min(g,R.y),y=Math.max(y,R.x),b=Math.max(b,R.y);const w=Math.max(y-h,b-g),C=Math.max(0,Math.floor(-Math.log(w)/Math.LN2)),E=Math.pow(2,C);return new c.a1(C,Math.floor((h+y)/2*E),Math.floor((g+b)/2*E))}(n),this.minzoom=this.maxzoom=this.tileID.z;const o=n.map(a=>this.tileID.getTilePoint(a)._round());return this._boundsArray=new c.$,this._boundsArray.emplaceBack(o[0].x,o[0].y,0,0),this._boundsArray.emplaceBack(o[1].x,o[1].y,c.X,0),this._boundsArray.emplaceBack(o[3].x,o[3].y,0,c.X),this._boundsArray.emplaceBack(o[2].x,o[2].y,c.X,c.X),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new c.k("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,qr.members)),this.boundsSegments||(this.boundsSegments=c.a0.simpleSegment(0,0,4,2)),this.texture||(this.texture=new St(t,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let o=!1;for(const a in this.tiles){const h=this.tiles[a];h.state!=="loaded"&&(h.state="loaded",h.texture=this.texture,o=!0)}o&&this.fire(new c.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(t){return c._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={}):t.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class zn extends Ar{constructor(t,n,o,a){super(t,n,o,a),this.roundZoom=!0,this.type="video",this.options=n}load(){return c._(this,void 0,void 0,function*(){this._loaded=!1;const t=this.options;this.urls=[];for(const n of t.urls)this.urls.push(this.map._requestManager.transformRequest(n,"Source").url);try{const n=yield c.a3(this.urls);if(this._loaded=!0,!n)return;this.video=n,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(n){this.fire(new c.j(n))}})}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 c.j(new c.a2(`sources.${this.id}`,null,`Playback for this video can be set only between the ${n.start(0)} and ${n.end(0)}-second mark.`))):this.video.currentTime=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,qr.members)),this.boundsSegments||(this.boundsSegments=c.a0.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),n.texSubImage2D(n.TEXTURE_2D,0,0,0,n.RGBA,n.UNSIGNED_BYTE,this.video)):(this.texture=new St(t,this.video,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let o=!1;for(const a in this.tiles){const h=this.tiles[a];h.state!=="loaded"&&(h.state="loaded",h.texture=this.texture,o=!0)}o&&this.fire(new c.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class Xi extends Ar{constructor(t,n,o,a){super(t,n,o,a),n.coordinates?Array.isArray(n.coordinates)&&n.coordinates.length===4&&!n.coordinates.some(h=>!Array.isArray(h)||h.length!==2||h.some(g=>typeof g!="number"))||this.fire(new c.j(new c.a2(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new c.j(new c.a2(`sources.${t}`,null,'missing required property "coordinates"'))),n.animate&&typeof n.animate!="boolean"&&this.fire(new c.j(new c.a2(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),n.canvas?typeof n.canvas=="string"||n.canvas instanceof HTMLCanvasElement||this.fire(new c.j(new c.a2(`sources.${t}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new c.j(new c.a2(`sources.${t}`,null,'missing required property "canvas"'))),this.options=n,this.animate=n.animate===void 0||n.animate}load(){return c._(this,void 0,void 0,function*(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new c.j(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())})}getCanvas(){return this.canvas}onAdd(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let t=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const n=this.map.painter.context,o=n.gl;this.boundsBuffer||(this.boundsBuffer=n.createVertexBuffer(this._boundsArray,qr.members)),this.boundsSegments||(this.boundsSegments=c.a0.simpleSegment(0,0,4,2)),this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new St(n,this.canvas,o.RGBA,{premultiply:!0});let a=!1;for(const h in this.tiles){const g=this.tiles[h];g.state!=="loaded"&&(g.state="loaded",g.texture=this.texture,a=!0)}a&&this.fire(new c.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}}const as={},ls=u=>{switch(u){case"geojson":return os;case"image":return Ar;case"raster":return yt;case"raster-dem":return jt;case"vector":return ss;case"video":return zn;case"canvas":return Xi}return as[u]},ke="RTLPluginLoaded";class fr extends c.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=ns()}_syncState(t){return this.status=t,this.dispatcher.broadcast("SRPS",{pluginStatus:t,pluginURL:this.url}).catch(n=>{throw this.status="error",n})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(t){return c._(this,arguments,void 0,function*(n,o=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=le.resolveURL(n),!this.url)throw new Error(`requested url ${n} is invalid`);if(this.status==="unavailable"){if(!o)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return c._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new c.k(ke))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let Si=null;function mr(){return Si||(Si=new fr),Si}class Zr{constructor(t,n){this.timeAdded=0,this.fadeEndTime=0,this.tileID=t,this.uid=c.a4(),this.uses=0,this.tileSize=n,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(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,o){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(a,h){const g={};if(!h)return g;for(const y of a){const b=y.layerIds.map(w=>h.getLayer(w)).filter(Boolean);if(b.length!==0){y.layers=b,y.stateDependentLayerIds&&(y.stateDependentLayers=y.stateDependentLayerIds.map(w=>b.filter(C=>C.id===w)[0]));for(const w of b)g[w.id]=y}}return g}(t.buckets,n.style),this.hasSymbolBuckets=!1;for(const a in this.buckets){const h=this.buckets[a];if(h instanceof c.a6){if(this.hasSymbolBuckets=!0,!o)break;h.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const a in this.buckets){const h=this.buckets[a];if(h instanceof c.a6&&h.hasRTLText){this.hasRTLText=!0,mr().lazyLoad();break}}this.queryPadding=0;for(const a in this.buckets){const h=this.buckets[a];this.queryPadding=Math.max(this.queryPadding,n.style.getLayer(a).queryRadius(h))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage)}else this.collisionBoxArray=new c.a5}unloadVectorData(){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(t){return this.buckets[t.id]}upload(t){for(const o in this.buckets){const a=this.buckets[o];a.uploadPending()&&a.upload(t)}const n=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new St(t,this.imageAtlas.image,n.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new St(t,this.glyphAtlasImage,n.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,n,o,a,h,g,y,b,w,C){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:a,cameraQueryGeometry:h,scale:g,tileSize:this.tileSize,pixelPosMatrix:C,transform:b,params:y,queryPadding:this.queryPadding*w},t,n,o):{}}querySourceFeatures(t,n){const o=this.latestFeatureIndex;if(!o||!o.rawTileData)return;const a=o.loadVTLayers(),h=n&&n.sourceLayer?n.sourceLayer:"",g=a._geojsonTileLayer||a[h];if(!g)return;const y=c.a7(n&&n.filter),{z:b,x:w,y:C}=this.tileID.canonical,E={z:b,x:w,y:C};for(let R=0;R<g.length;R++){const F=g.feature(R);if(y.needGeometry){const U=c.a8(F,!0);if(!y.filter(new c.a9(this.tileID.overscaledZ),U,this.tileID.canonical))continue}else if(!y.filter(new c.a9(this.tileID.overscaledZ),F))continue;const $=o.getId(F,h),H=new c.aa(F,b,w,C,$);H.tile=E,t.push(H)}}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 o=c.ab(t.cacheControl);o["max-age"]&&(this.expirationTime=Date.now()+1e3*o["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){const o=Date.now();let a=!1;if(this.expirationTime>o)a=!1;else if(n)if(this.expirationTime<n)a=!0;else{const h=this.expirationTime-n;h?this.expirationTime=o+Math.max(h,3e4):a=!0}else a=!0;a?(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 o=this.latestFeatureIndex.loadVTLayers();for(const a in this.buckets){if(!n.style.hasLayer(a))continue;const h=this.buckets[a],g=h.layers[0].sourceLayer||"_geojsonTileLayer",y=o[g],b=t[g];if(!y||!b||Object.keys(b).length===0)continue;h.update(b,y,this.imageAtlas&&this.imageAtlas.patternPositions||{});const w=n&&n.style&&n.style.getLayer(a);w&&(this.queryPadding=Math.max(this.queryPadding,w.queryRadius(h)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<le.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(t){this.symbolFadeHoldUntil=le.now()+t}setDependencies(t,n){const o={};for(const a of n)o[a]=!0;this.dependencies[t]=o}hasDependency(t,n){for(const o of t){const a=this.dependencies[o];if(a){for(const h of n)if(a[h])return!0}}return!1}}class Ee{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,o){const a=t.wrapped().key;this.data[a]===void 0&&(this.data[a]=[]);const h={value:n,timeout:void 0};if(o!==void 0&&(h.timeout=setTimeout(()=>{this.remove(t,h)},o)),this.data[a].push(h),this.order.push(a),this.order.length>this.max){const g=this._getAndRemoveByKey(this.order[0]);g&&this.onRemove(g)}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 o=t.wrapped().key,a=n===void 0?0:this.data[o].indexOf(n),h=this.data[o][a];return this.data[o].splice(a,1),h.timeout&&clearTimeout(h.timeout),this.data[o].length===0&&delete this.data[o],this.onRemove(h.value),this.order.splice(this.order.indexOf(o),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 o in this.data)for(const a of this.data[o])t(a.value)||n.push(a);for(const o of n)this.remove(o.value.tileID,o)}}class at{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,n,o){const a=String(n);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][a]=this.stateChanges[t][a]||{},c.e(this.stateChanges[t][a],o),this.deletedStates[t]===null){this.deletedStates[t]={};for(const h in this.state[t])h!==a&&(this.deletedStates[t][h]=null)}else if(this.deletedStates[t]&&this.deletedStates[t][a]===null){this.deletedStates[t][a]={};for(const h in this.state[t][a])o[h]||(this.deletedStates[t][a][h]=null)}else for(const h in o)this.deletedStates[t]&&this.deletedStates[t][a]&&this.deletedStates[t][a][h]===null&&delete this.deletedStates[t][a][h]}removeFeatureState(t,n,o){if(this.deletedStates[t]===null)return;const a=String(n);if(this.deletedStates[t]=this.deletedStates[t]||{},o&&n!==void 0)this.deletedStates[t][a]!==null&&(this.deletedStates[t][a]=this.deletedStates[t][a]||{},this.deletedStates[t][a][o]=null);else if(n!==void 0)if(this.stateChanges[t]&&this.stateChanges[t][a])for(o in this.deletedStates[t][a]={},this.stateChanges[t][a])this.deletedStates[t][a][o]=null;else this.deletedStates[t][a]=null;else this.deletedStates[t]=null}getState(t,n){const o=String(n),a=c.e({},(this.state[t]||{})[o],(this.stateChanges[t]||{})[o]);if(this.deletedStates[t]===null)return{};if(this.deletedStates[t]){const h=this.deletedStates[t][n];if(h===null)return{};for(const g in h)delete a[g]}return a}initializeTileState(t,n){t.setFeatureState(this.state,n)}coalesceChanges(t,n){const o={};for(const a in this.stateChanges){this.state[a]=this.state[a]||{};const h={};for(const g in this.stateChanges[a])this.state[a][g]||(this.state[a][g]={}),c.e(this.state[a][g],this.stateChanges[a][g]),h[g]=this.state[a][g];o[a]=h}for(const a in this.deletedStates){this.state[a]=this.state[a]||{};const h={};if(this.deletedStates[a]===null)for(const g in this.state[a])h[g]={},this.state[a][g]={};else for(const g in this.deletedStates[a]){if(this.deletedStates[a][g]===null)this.state[a][g]={};else for(const y of Object.keys(this.deletedStates[a][g]))delete this.state[a][g][y];h[g]=this.state[a][g]}o[a]=o[a]||{},c.e(o[a],h)}if(this.stateChanges={},this.deletedStates={},Object.keys(o).length!==0)for(const a in t)t[a].setFeatureState(o,n)}}class Ye extends c.E{constructor(t,n,o){super(),this.id=t,this.dispatcher=o,this.on("data",a=>this._dataHandler(a)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((a,h,g,y)=>{const b=new(ls(h.type))(a,h,g,y);if(b.id!==a)throw new Error(`Expected Source id to be ${a} instead of ${b.id}`);return b})(t,n,o,this),this._tiles={},this._cache=new Ee(0,a=>this._unloadTile(a)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new at,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,o){return c._(this,void 0,void 0,function*(){try{yield this._source.loadTile(t),this._tileLoaded(t,n,o)}catch(a){t.state="errored",a.status!==404?this._source.fire(new c.j(a,{tile:t})):this.update(this.transform,this.terrain)}})}_unloadTile(t){this._source.unloadTile&&this._source.unloadTile(t)}_abortTile(t){this._source.abortTile&&this._source.abortTile(t),this._source.fire(new c.k("dataabort",{tile:t,coord:t.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const n in this._tiles){const o=this._tiles[n];o.upload(t),o.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(t=>t.tileID).sort(Pi).map(t=>t.key)}getRenderableIds(t){const n=[];for(const o in this._tiles)this._isIdRenderable(o,t)&&n.push(this._tiles[o]);return t?n.sort((o,a)=>{const h=o.tileID,g=a.tileID,y=new c.P(h.canonical.x,h.canonical.y)._rotate(this.transform.angle),b=new c.P(g.canonical.x,g.canonical.y)._rotate(this.transform.angle);return h.overscaledZ-g.overscaledZ||b.y-y.y||b.x-y.x}).map(o=>o.tileID.key):n.map(o=>o.tileID).sort(Pi).map(o=>o.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){return c._(this,void 0,void 0,function*(){const o=this._tiles[t];o&&(o.state!=="loading"&&(o.state=n),yield this._loadTile(o,t,n))})}_tileLoaded(t,n,o){t.timeAdded=le.now(),o==="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 c.k("data",{dataType:"source",tile:t,coord:t.tileID}))}_backfillDEM(t){const n=this.getRenderableIds();for(let a=0;a<n.length;a++){const h=n[a];if(t.neighboringTiles&&t.neighboringTiles[h]){const g=this.getTileByID(h);o(t,g),o(g,t)}}function o(a,h){a.needsHillshadePrepare=!0,a.needsTerrainPrepare=!0;let g=h.tileID.canonical.x-a.tileID.canonical.x;const y=h.tileID.canonical.y-a.tileID.canonical.y,b=Math.pow(2,a.tileID.canonical.z),w=h.tileID.key;g===0&&y===0||Math.abs(y)>1||(Math.abs(g)>1&&(Math.abs(g+b)===1?g+=b:Math.abs(g-b)===1&&(g-=b)),h.dem&&a.dem&&(a.dem.backfillBorder(h.dem,g,y),a.neighboringTiles&&a.neighboringTiles[w]&&(a.neighboringTiles[w].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,n,o,a){for(const h in this._tiles){let g=this._tiles[h];if(a[h]||!g.hasData()||g.tileID.overscaledZ<=n||g.tileID.overscaledZ>o)continue;let y=g.tileID;for(;g&&g.tileID.overscaledZ>n+1;){const w=g.tileID.scaledTo(g.tileID.overscaledZ-1);g=this._tiles[w.key],g&&g.hasData()&&(y=w)}let b=y;for(;b.overscaledZ>n;)if(b=b.scaledTo(b.overscaledZ-1),t[b.key]){a[y.key]=y;break}}}findLoadedParent(t,n){if(t.key in this._loadedParentTiles){const o=this._loadedParentTiles[t.key];return o&&o.tileID.overscaledZ>=n?o:null}for(let o=t.overscaledZ-1;o>=n;o--){const a=t.scaledTo(o),h=this._getLoadedTile(a);if(h)return h}}findLoadedSibling(t){return this._getLoadedTile(t)}_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,o=Math.ceil(t.height/this._source.tileSize)+1,a=Math.floor(n*o*(this._maxTileCacheZoomLevels===null?c.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),h=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,a):a;this._cache.setMaxSize(h)}handleWrapJump(t){const n=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);if(this._prevLng=t,n){const o={};for(const a in this._tiles){const h=this._tiles[a];h.tileID=h.tileID.unwrapTo(h.tileID.wrap+n),o[h.tileID.key]=h}this._tiles=o;for(const a in this._timers)clearTimeout(this._timers[a]),delete this._timers[a];for(const a in this._tiles)this._setTileReloadTimer(a,this._tiles[a])}}_updateCoveredAndRetainedTiles(t,n,o,a,h,g){const y={},b={},w=Object.keys(t),C=le.now();for(const E of w){const R=t[E],F=this._tiles[E];if(!F||F.fadeEndTime!==0&&F.fadeEndTime<=C)continue;const $=this.findLoadedParent(R,n),H=this.findLoadedSibling(R),U=$||H||null;U&&(this._addTile(U.tileID),y[U.tileID.key]=U.tileID),b[E]=R}this._retainLoadedChildren(b,a,o,t);for(const E in y)t[E]||(this._coveredTiles[E]=!0,t[E]=y[E]);if(g){const E={},R={};for(const F of h)this._tiles[F.key].hasData()?E[F.key]=F:R[F.key]=F;for(const F in R){const $=R[F].children(this._source.maxzoom);this._tiles[$[0].key]&&this._tiles[$[1].key]&&this._tiles[$[2].key]&&this._tiles[$[3].key]&&(E[$[0].key]=t[$[0].key]=$[0],E[$[1].key]=t[$[1].key]=$[1],E[$[2].key]=t[$[2].key]=$[2],E[$[3].key]=t[$[3].key]=$[3],delete R[F])}for(const F in R){const $=R[F],H=this.findLoadedParent($,this._source.minzoom),U=this.findLoadedSibling($),W=H||U||null;if(W){E[W.tileID.key]=t[W.tileID.key]=W.tileID;for(const Y in E)E[Y].isChildOf(W.tileID)&&delete E[Y]}}for(const F in this._tiles)E[F]||(this._coveredTiles[F]=!0)}}update(t,n){if(!this._sourceLoaded||this._paused)return;let o;this.transform=t,this.terrain=n,this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?o=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(C=>new c.S(C.canonical.z,C.wrap,C.canonical.z,C.canonical.x,C.canonical.y)):(o=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&&(o=o.filter(C=>this._source.hasTile(C)))):o=[];const a=t.coveringZoomLevel(this._source),h=Math.max(a-Ye.maxOverzooming,this._source.minzoom),g=Math.max(a+Ye.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const C={};for(const E of o)if(E.canonical.z>this._source.minzoom){const R=E.scaledTo(E.canonical.z-1);C[R.key]=R;const F=E.scaledTo(Math.max(this._source.minzoom,Math.min(E.canonical.z,5)));C[F.key]=F}o=o.concat(Object.values(C))}const y=o.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,y&&this.fire(new c.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const b=this._updateRetainedTiles(o,a);tr(this._source.type)&&this._updateCoveredAndRetainedTiles(b,h,g,a,o,n);for(const C in b)this._tiles[C].clearFadeHold();const w=c.ac(this._tiles,b);for(const C of w){const E=this._tiles[C];E.hasSymbolBuckets&&!E.holdingForFade()?E.setHoldDuration(this.map._fadeDuration):E.hasSymbolBuckets&&!E.symbolFadeFinished()||this._removeTile(C)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)}_updateRetainedTiles(t,n){var o;const a={},h={},g=Math.max(n-Ye.maxOverzooming,this._source.minzoom),y=Math.max(n+Ye.maxUnderzooming,this._source.minzoom),b={};for(const w of t){const C=this._addTile(w);a[w.key]=w,C.hasData()||n<this._source.maxzoom&&(b[w.key]=w)}this._retainLoadedChildren(b,n,y,a);for(const w of t){let C=this._tiles[w.key];if(C.hasData())continue;if(n+1>this._source.maxzoom){const R=w.children(this._source.maxzoom)[0],F=this.getTile(R);if(F&&F.hasData()){a[R.key]=R;continue}}else{const R=w.children(this._source.maxzoom);if(a[R[0].key]&&a[R[1].key]&&a[R[2].key]&&a[R[3].key])continue}let E=C.wasRequested();for(let R=w.overscaledZ-1;R>=g;--R){const F=w.scaledTo(R);if(h[F.key])break;if(h[F.key]=!0,C=this.getTile(F),!C&&E&&(C=this._addTile(F)),C){const $=C.hasData();if(($||!(!((o=this.map)===null||o===void 0)&&o.cancelPendingTileRequestsWhileZooming)||E)&&(a[F.key]=F),E=C.wasRequested(),$)break}}}return a}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const n=[];let o,a=this._tiles[t].tileID;for(;a.overscaledZ>0;){if(a.key in this._loadedParentTiles){o=this._loadedParentTiles[a.key];break}n.push(a.key);const h=a.scaledTo(a.overscaledZ-1);if(o=this._getLoadedTile(h),o)break;a=h}for(const h of n)this._loadedParentTiles[h]=o}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(const t in this._tiles){const n=this._tiles[t].tileID,o=this._getLoadedTile(n);this._loadedSiblingTiles[n.key]=o}}_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 o=n;return n||(n=new Zr(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(n,t.key,n.state)),n.uses++,this._tiles[t.key]=n,o||this._source.fire(new c.k("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 o=n.getExpiryTimeout();o&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},o))}_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))))}_dataHandler(t){const n=t.sourceDataType;t.dataType==="source"&&n==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&t.dataType==="source"&&n==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(t);this._cache.reset()}tilesIn(t,n,o){const a=[],h=this.transform;if(!h)return a;const g=o?h.getCameraQueryGeometry(t):t,y=t.map($=>h.pointCoordinate($,this.terrain)),b=g.map($=>h.pointCoordinate($,this.terrain)),w=this.getIds();let C=1/0,E=1/0,R=-1/0,F=-1/0;for(const $ of b)C=Math.min(C,$.x),E=Math.min(E,$.y),R=Math.max(R,$.x),F=Math.max(F,$.y);for(let $=0;$<w.length;$++){const H=this._tiles[w[$]];if(H.holdingForFade())continue;const U=H.tileID,W=Math.pow(2,h.zoom-H.tileID.overscaledZ),Y=n*H.queryPadding*c.X/H.tileSize/W,j=[U.getTilePoint(new c.Z(C,E)),U.getTilePoint(new c.Z(R,F))];if(j[0].x-Y<c.X&&j[0].y-Y<c.X&&j[1].x+Y>=0&&j[1].y+Y>=0){const te=y.map(ce=>U.getTilePoint(ce)),se=b.map(ce=>U.getTilePoint(ce));a.push({tile:H,tileID:U,queryGeometry:te,cameraQueryGeometry:se,scale:W})}}return a}getVisibleCoordinates(t){const n=this.getRenderableIds(t).map(o=>this._tiles[o].tileID);for(const o of n)o.posMatrix=this.transform.calculatePosMatrix(o.toUnwrapped());return n}hasTransition(){if(this._source.hasTransition())return!0;if(tr(this._source.type)){const t=le.now();for(const n in this._tiles)if(this._tiles[n].fadeEndTime>=t)return!0}return!1}setFeatureState(t,n,o){this._state.updateState(t=t||"_geojsonTileLayer",n,o)}removeFeatureState(t,n,o){this._state.removeFeatureState(t=t||"_geojsonTileLayer",n,o)}getFeatureState(t,n){return this._state.getState(t=t||"_geojsonTileLayer",n)}setDependencies(t,n,o){const a=this._tiles[t];a&&a.setDependencies(n,o)}reloadTilesForDependencies(t,n){for(const o in this._tiles)this._tiles[o].hasDependency(t,n)&&this._reloadTile(o,"reloading");this._cache.filter(o=>!o.hasDependency(t,n))}}function Pi(u,t){const n=Math.abs(2*u.wrap)-+(u.wrap<0),o=Math.abs(2*t.wrap)-+(t.wrap<0);return u.overscaledZ-t.overscaledZ||o-n||t.canonical.y-u.canonical.y||t.canonical.x-u.canonical.x}function tr(u){return u==="raster"||u==="image"||u==="video"}Ye.maxOverzooming=10,Ye.maxUnderzooming=3;class it{constructor(t,n){this.reset(t,n)}reset(t,n){this.points=t||[],this._distances=[0];for(let o=1;o<this.points.length;o++)this._distances[o]=this._distances[o-1]+this.points[o].dist(this.points[o-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=c.ad(t,0,1);let n=1,o=this._distances[n];const a=t*this.paddedLength+this.padding;for(;o<a&&n<this._distances.length;)o=this._distances[++n];const h=n-1,g=this._distances[h],y=o-g,b=y>0?(a-g)/y:0;return this.points[h].mult(1-b).add(this.points[n].mult(b))}}function gr(u,t){let n=!0;return u==="always"||u!=="never"&&t!=="never"||(n=!1),n}class Mr{constructor(t,n,o){const a=this.boxCells=[],h=this.circleCells=[];this.xCellCount=Math.ceil(t/o),this.yCellCount=Math.ceil(n/o);for(let g=0;g<this.xCellCount*this.yCellCount;g++)a.push([]),h.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,o,a,h){this._forEachCell(n,o,a,h,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(n),this.bboxes.push(o),this.bboxes.push(a),this.bboxes.push(h)}insertCircle(t,n,o,a){this._forEachCell(n-a,o-a,n+a,o+a,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(n),this.circles.push(o),this.circles.push(a)}_insertBoxCell(t,n,o,a,h,g){this.boxCells[h].push(g)}_insertCircleCell(t,n,o,a,h,g){this.circleCells[h].push(g)}_query(t,n,o,a,h,g,y){if(o<0||t>this.width||a<0||n>this.height)return[];const b=[];if(t<=0&&n<=0&&this.width<=o&&this.height<=a){if(h)return[{key:null,x1:t,y1:n,x2:o,y2:a}];for(let w=0;w<this.boxKeys.length;w++)b.push({key:this.boxKeys[w],x1:this.bboxes[4*w],y1:this.bboxes[4*w+1],x2:this.bboxes[4*w+2],y2:this.bboxes[4*w+3]});for(let w=0;w<this.circleKeys.length;w++){const C=this.circles[3*w],E=this.circles[3*w+1],R=this.circles[3*w+2];b.push({key:this.circleKeys[w],x1:C-R,y1:E-R,x2:C+R,y2:E+R})}}else this._forEachCell(t,n,o,a,this._queryCell,b,{hitTest:h,overlapMode:g,seenUids:{box:{},circle:{}}},y);return b}query(t,n,o,a){return this._query(t,n,o,a,!1,null)}hitTest(t,n,o,a,h,g){return this._query(t,n,o,a,!0,h,g).length>0}hitTestCircle(t,n,o,a,h){const g=t-o,y=t+o,b=n-o,w=n+o;if(y<0||g>this.width||w<0||b>this.height)return!1;const C=[];return this._forEachCell(g,b,y,w,this._queryCellCircle,C,{hitTest:!0,overlapMode:a,circle:{x:t,y:n,radius:o},seenUids:{box:{},circle:{}}},h),C.length>0}_queryCell(t,n,o,a,h,g,y,b){const{seenUids:w,hitTest:C,overlapMode:E}=y,R=this.boxCells[h];if(R!==null){const $=this.bboxes;for(const H of R)if(!w.box[H]){w.box[H]=!0;const U=4*H,W=this.boxKeys[H];if(t<=$[U+2]&&n<=$[U+3]&&o>=$[U+0]&&a>=$[U+1]&&(!b||b(W))&&(!C||!gr(E,W.overlapMode))&&(g.push({key:W,x1:$[U],y1:$[U+1],x2:$[U+2],y2:$[U+3]}),C))return!0}}const F=this.circleCells[h];if(F!==null){const $=this.circles;for(const H of F)if(!w.circle[H]){w.circle[H]=!0;const U=3*H,W=this.circleKeys[H];if(this._circleAndRectCollide($[U],$[U+1],$[U+2],t,n,o,a)&&(!b||b(W))&&(!C||!gr(E,W.overlapMode))){const Y=$[U],j=$[U+1],te=$[U+2];if(g.push({key:W,x1:Y-te,y1:j-te,x2:Y+te,y2:j+te}),C)return!0}}}return!1}_queryCellCircle(t,n,o,a,h,g,y,b){const{circle:w,seenUids:C,overlapMode:E}=y,R=this.boxCells[h];if(R!==null){const $=this.bboxes;for(const H of R)if(!C.box[H]){C.box[H]=!0;const U=4*H,W=this.boxKeys[H];if(this._circleAndRectCollide(w.x,w.y,w.radius,$[U+0],$[U+1],$[U+2],$[U+3])&&(!b||b(W))&&!gr(E,W.overlapMode))return g.push(!0),!0}}const F=this.circleCells[h];if(F!==null){const $=this.circles;for(const H of F)if(!C.circle[H]){C.circle[H]=!0;const U=3*H,W=this.circleKeys[H];if(this._circlesCollide($[U],$[U+1],$[U+2],w.x,w.y,w.radius)&&(!b||b(W))&&!gr(E,W.overlapMode))return g.push(!0),!0}}}_forEachCell(t,n,o,a,h,g,y,b){const w=this._convertToXCellCoord(t),C=this._convertToYCellCoord(n),E=this._convertToXCellCoord(o),R=this._convertToYCellCoord(a);for(let F=w;F<=E;F++)for(let $=C;$<=R;$++)if(h.call(this,t,n,o,a,this.xCellCount*$+F,g,y,b))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,o,a,h,g){const y=a-t,b=h-n,w=o+g;return w*w>y*y+b*b}_circleAndRectCollide(t,n,o,a,h,g,y){const b=(g-a)/2,w=Math.abs(t-(a+b));if(w>b+o)return!1;const C=(y-h)/2,E=Math.abs(n-(h+C));if(E>C+o)return!1;if(w<=b||E<=C)return!0;const R=w-b,F=E-C;return R*R+F*F<=o*o}}function Gr(u,t,n,o,a){const h=c.H();return t?(c.K(h,h,[1/a,1/a,1]),n||c.ae(h,h,o.angle)):c.L(h,o.labelPlaneMatrix,u),h}function _r(u,t,n,o,a){if(t){const h=c.af(u);return c.K(h,h,[a,a,1]),n||c.ae(h,h,-o.angle),h}return o.glCoordMatrix}function X(u,t,n){let o;n?(o=[u.x,u.y,n(u.x,u.y),1],c.ag(o,o,t)):(o=[u.x,u.y,0,1],function(h,g,y){const b=g[0],w=g[1];h[0]=y[0]*b+y[4]*w+y[12],h[1]=y[1]*b+y[5]*w+y[13],h[3]=y[3]*b+y[7]*w+y[15]}(o,o,t));const a=o[3];return{point:new c.P(o[0]/a,o[1]/a),signedDistanceFromCamera:a,isOccluded:!1}}function z(u,t){return .5+u/t*.5}function M(u,t){return u.x>=-t[0]&&u.x<=t[0]&&u.y>=-t[1]&&u.y<=t[1]}function V(u,t,n,o,a,h,g,y,b,w,C,E,R,F,$){const H=o?u.textSizeData:u.iconSizeData,U=c.ah(H,n.transform.zoom),W=[256/n.width*2+1,256/n.height*2+1],Y=o?u.text.dynamicLayoutVertexArray:u.icon.dynamicLayoutVertexArray;Y.clear();const j=u.lineVertexArray,te=o?u.text.placedSymbolArray:u.icon.placedSymbolArray,se=n.transform.width/n.transform.height;let ce=!1;for(let ye=0;ye<te.length;ye++){const we=te.get(ye);if(we.hidden||we.writingMode===c.ai.vertical&&!ce){Xe(we.numGlyphs,Y);continue}ce=!1;const De=X(new c.P(we.anchorX,we.anchorY),t,$);if(!M(De.point,W)){Xe(we.numGlyphs,Y);continue}const Re=z(n.transform.cameraToCenterDistance,De.signedDistanceFromCamera),Se=c.aj(H,U,we),Te=g?Se/Re:Se*Re,Ne={getElevation:$,labelPlaneMatrix:a,lineVertexArray:j,pitchWithMap:g,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},projection:w,tileAnchorPoint:new c.P(we.anchorX,we.anchorY),unwrappedTileID:C,width:E,height:R,translation:F},tt=ie(Ne,we,Te,!1,y,t,h,u.glyphOffsetArray,Y,se,b);ce=tt.useVertical,(tt.notEnoughRoom||ce||tt.needsFlipping&&ie(Ne,we,Te,!0,y,t,h,u.glyphOffsetArray,Y,se,b).notEnoughRoom)&&Xe(we.numGlyphs,Y)}o?u.text.dynamicLayoutVertexBuffer.updateData(Y):u.icon.dynamicLayoutVertexBuffer.updateData(Y)}function G(u,t,n,o,a,h,g,y){const b=h.glyphStartIndex+h.numGlyphs,w=h.lineStartIndex,C=h.lineStartIndex+h.lineLength,E=t.getoffsetX(h.glyphStartIndex),R=t.getoffsetX(b-1),F=Ie(u*E,n,o,a,h.segment,w,C,y,g);if(!F)return null;const $=Ie(u*R,n,o,a,h.segment,w,C,y,g);return $?y.projectionCache.anyProjectionOccluded?null:{first:F,last:$}:null}function ee(u,t,n,o){return u===c.ai.horizontal&&Math.abs(n.y-t.y)>Math.abs(n.x-t.x)*o?{useVertical:!0}:(u===c.ai.vertical?t.y<n.y:t.x>n.x)?{needsFlipping:!0}:null}function ie(u,t,n,o,a,h,g,y,b,w,C){const E=n/24,R=t.lineOffsetX*E,F=t.lineOffsetY*E;let $;if(t.numGlyphs>1){const H=t.glyphStartIndex+t.numGlyphs,U=t.lineStartIndex,W=t.lineStartIndex+t.lineLength,Y=G(E,y,R,F,o,t,C,u);if(!Y)return{notEnoughRoom:!0};const j=X(Y.first.point,g,u.getElevation).point,te=X(Y.last.point,g,u.getElevation).point;if(a&&!o){const se=ee(t.writingMode,j,te,w);if(se)return se}$=[Y.first];for(let se=t.glyphStartIndex+1;se<H-1;se++)$.push(Ie(E*y.getoffsetX(se),R,F,o,t.segment,U,W,u,C));$.push(Y.last)}else{if(a&&!o){const U=X(u.tileAnchorPoint,h,u.getElevation).point,W=t.lineStartIndex+t.segment+1,Y=new c.P(u.lineVertexArray.getx(W),u.lineVertexArray.gety(W)),j=X(Y,h,u.getElevation),te=j.signedDistanceFromCamera>0?j.point:function(ce,ye,we,De,Re,Se){return ne(ce,ye,we,1,Re,Se)}(u.tileAnchorPoint,Y,U,0,h,u),se=ee(t.writingMode,U,te,w);if(se)return se}const H=Ie(E*y.getoffsetX(t.glyphStartIndex),R,F,o,t.segment,t.lineStartIndex,t.lineStartIndex+t.lineLength,u,C);if(!H||u.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};$=[H]}for(const H of $)c.ak(b,H.point,H.angle);return{}}function ne(u,t,n,o,a,h){const g=u.add(u.sub(t)._unit()),y=a!==void 0?X(g,a,h.getElevation).point:pe(g.x,g.y,h).point,b=n.sub(y);return n.add(b._mult(o/b.mag()))}function K(u,t,n){const o=t.projectionCache;if(o.projections[u])return o.projections[u];const a=new c.P(t.lineVertexArray.getx(u),t.lineVertexArray.gety(u)),h=pe(a.x,a.y,t);if(h.signedDistanceFromCamera>0)return o.projections[u]=h.point,o.anyProjectionOccluded=o.anyProjectionOccluded||h.isOccluded,h.point;const g=u-n.direction;return function(y,b,w,C,E){return ne(y,b,w,C,void 0,E)}(n.distanceFromAnchor===0?t.tileAnchorPoint:new c.P(t.lineVertexArray.getx(g),t.lineVertexArray.gety(g)),a,n.previousVertex,n.absOffsetX-n.distanceFromAnchor+1,t)}function pe(u,t,n){const o=u+n.translation[0],a=t+n.translation[1];let h;return!n.pitchWithMap&&n.projection.useSpecialProjectionForSymbols?(h=n.projection.projectTileCoordinates(o,a,n.unwrappedTileID,n.getElevation),h.point.x=(.5*h.point.x+.5)*n.width,h.point.y=(.5*-h.point.y+.5)*n.height):(h=X(new c.P(o,a),n.labelPlaneMatrix,n.getElevation),h.isOccluded=!1),h}function xe(u,t,n){return u._unit()._perp()._mult(t*n)}function he(u,t,n,o,a,h,g,y,b){if(y.projectionCache.offsets[u])return y.projectionCache.offsets[u];const w=n.add(t);if(u+b.direction<o||u+b.direction>=a)return y.projectionCache.offsets[u]=w,w;const C=K(u+b.direction,y,b),E=xe(C.sub(n),g,b.direction),R=n.add(E),F=C.add(E);return y.projectionCache.offsets[u]=c.al(h,w,R,F)||w,y.projectionCache.offsets[u]}function Ie(u,t,n,o,a,h,g,y,b){const w=o?u-t:u+t;let C=w>0?1:-1,E=0;o&&(C*=-1,E=Math.PI),C<0&&(E+=Math.PI);let R,F=C>0?h+a:h+a+1;y.projectionCache.cachedAnchorPoint?R=y.projectionCache.cachedAnchorPoint:(R=pe(y.tileAnchorPoint.x,y.tileAnchorPoint.y,y).point,y.projectionCache.cachedAnchorPoint=R);let $,H,U=R,W=R,Y=0,j=0;const te=Math.abs(w),se=[];let ce;for(;Y+j<=te;){if(F+=C,F<h||F>=g)return null;Y+=j,W=U,H=$;const De={absOffsetX:te,direction:C,distanceFromAnchor:Y,previousVertex:W};if(U=K(F,y,De),n===0)se.push(W),ce=U.sub(W);else{let Re;const Se=U.sub(W);Re=Se.mag()===0?xe(K(F+C,y,De).sub(U),n,C):xe(Se,n,C),H||(H=W.add(Re)),$=he(F,Re,U,h,g,H,n,y,De),se.push(H),ce=$.sub(H)}j=ce.mag()}const ye=ce._mult((te-Y)/j)._add(H||W),we=E+Math.atan2(U.y-W.y,U.x-W.x);return se.push(ye),{point:ye,angle:b?we:0,path:se}}const Ge=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Xe(u,t){for(let n=0;n<u;n++){const o=t.length;t.resize(o+4),t.float32.set(Ge,3*o)}}const nt=100;class mt{constructor(t,n,o=new Mr(t.width+200,t.height+200,25),a=new Mr(t.width+200,t.height+200,25)){this.transform=t,this.mapProjection=n,this.grid=o,this.ignoredGrid=a,this.pitchFactor=Math.cos(t._pitch)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+nt,this.screenBottomBoundary=t.height+nt,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(t,n,o,a,h,g,y,b,w,C,E){const R=t.anchorPointX+b[0],F=t.anchorPointY+b[1],$=this.projectAndGetPerspectiveRatio(a,R,F,h,C),H=this._projectCollisionBox(t,o,a,h,g,y,b,$,C,E),[U,W,Y,j]=H.box;return this.mapProjection.useSpecialProjectionForSymbols&&(g?H.allPointsOccluded:this.mapProjection.isOccluded(R,F,h))||$.perspectiveRatio<this.perspectiveRatioCutoff||!this.isInsideGrid(U,W,Y,j)||n!=="always"&&this.grid.hitTest(U,W,Y,j,n,w)?{box:[U,W,Y,j],placeable:!1,offscreen:!1}:{box:[U,W,Y,j],placeable:!0,offscreen:this.isOffscreen(U,W,Y,j)}}placeCollisionCircles(t,n,o,a,h,g,y,b,w,C,E,R,F,$,H,U){const W=[],Y=new c.P(n.anchorX,n.anchorY),j=this.getPerspectiveRatio(g,Y.x,Y.y,y,U),te=(E?h/j:h*j)/c.aq,se={getElevation:U,labelPlaneMatrix:b,lineVertexArray:o,pitchWithMap:E,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},projection:this.mapProjection,tileAnchorPoint:Y,unwrappedTileID:y,width:this.transform.width,height:this.transform.height,translation:H},ce=G(te,a,n.lineOffsetX*te,n.lineOffsetY*te,!1,n,!1,se);let ye=!1,we=!1,De=!0;if(ce){const Re=.5*F*j+$,Se=new c.P(-100,-100),Te=new c.P(this.screenRightBoundary,this.screenBottomBoundary),Ne=new it,tt=ce.first,Ce=ce.last;let Ae=[];for(let ot=tt.path.length-1;ot>=1;ot--)Ae.push(tt.path[ot]);for(let ot=1;ot<Ce.path.length;ot++)Ae.push(Ce.path[ot]);const Qe=2.5*Re;if(w){const ot=this.projectPathToScreenSpace(Ae,se,w);Ae=ot.some(dt=>dt.signedDistanceFromCamera<=0)?[]:ot.map(dt=>dt.point)}let Dt=[];if(Ae.length>0){const ot=Ae[0].clone(),dt=Ae[0].clone();for(let Lt=1;Lt<Ae.length;Lt++)ot.x=Math.min(ot.x,Ae[Lt].x),ot.y=Math.min(ot.y,Ae[Lt].y),dt.x=Math.max(dt.x,Ae[Lt].x),dt.y=Math.max(dt.y,Ae[Lt].y);Dt=ot.x>=Se.x&&dt.x<=Te.x&&ot.y>=Se.y&&dt.y<=Te.y?[Ae]:dt.x<Se.x||ot.x>Te.x||dt.y<Se.y||ot.y>Te.y?[]:c.am([Ae],Se.x,Se.y,Te.x,Te.y)}for(const ot of Dt){Ne.reset(ot,.25*Re);let dt=0;dt=Ne.length<=.5*Re?1:Math.ceil(Ne.paddedLength/Qe)+1;for(let Lt=0;Lt<dt;Lt++){const di=Lt/Math.max(dt-1,1),nr=Ne.lerp(di),Rt=nr.x+nt,Mi=nr.y+nt;W.push(Rt,Mi,Re,0);const ki=Rt-Re,pi=Mi-Re,fi=Rt+Re,sr=Mi+Re;if(De=De&&this.isOffscreen(ki,pi,fi,sr),we=we||this.isInsideGrid(ki,pi,fi,sr),t!=="always"&&this.grid.hitTestCircle(Rt,Mi,Re,t,R)&&(ye=!0,!C))return{circles:[],offscreen:!1,collisionDetected:ye}}}}return{circles:!C&&ye||!we||j<this.perspectiveRatioCutoff?[]:W,offscreen:De,collisionDetected:ye}}projectPathToScreenSpace(t,n,o){return t.map(a=>X(a,o,n.getElevation))}queryRenderedSymbols(t){if(t.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const n=[];let o=1/0,a=1/0,h=-1/0,g=-1/0;for(const C of t){const E=new c.P(C.x+nt,C.y+nt);o=Math.min(o,E.x),a=Math.min(a,E.y),h=Math.max(h,E.x),g=Math.max(g,E.y),n.push(E)}const y=this.grid.query(o,a,h,g).concat(this.ignoredGrid.query(o,a,h,g)),b={},w={};for(const C of y){const E=C.key;if(b[E.bucketInstanceId]===void 0&&(b[E.bucketInstanceId]={}),b[E.bucketInstanceId][E.featureIndex])continue;const R=[new c.P(C.x1,C.y1),new c.P(C.x2,C.y1),new c.P(C.x2,C.y2),new c.P(C.x1,C.y2)];c.an(n,R)&&(b[E.bucketInstanceId][E.featureIndex]=!0,w[E.bucketInstanceId]===void 0&&(w[E.bucketInstanceId]=[]),w[E.bucketInstanceId].push(E.featureIndex))}return w}insertCollisionBox(t,n,o,a,h,g){(o?this.ignoredGrid:this.grid).insert({bucketInstanceId:a,featureIndex:h,collisionGroupID:g,overlapMode:n},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,n,o,a,h,g){const y=o?this.ignoredGrid:this.grid,b={bucketInstanceId:a,featureIndex:h,collisionGroupID:g,overlapMode:n};for(let w=0;w<t.length;w+=4)y.insertCircle(b,t[w],t[w+1],t[w+2])}projectAndGetPerspectiveRatio(t,n,o,a,h){const g=this.mapProjection.useSpecialProjectionForSymbols?this.mapProjection.projectTileCoordinates(n,o,a,h):X(new c.P(n,o),t,h);return{point:new c.P((g.point.x+1)/2*this.transform.width+nt,(1-g.point.y)/2*this.transform.height+nt),perspectiveRatio:.5+this.transform.cameraToCenterDistance/g.signedDistanceFromCamera*.5,isOccluded:g.isOccluded,signedDistanceFromCamera:g.signedDistanceFromCamera}}getPerspectiveRatio(t,n,o,a,h){const g=this.mapProjection.useSpecialProjectionForSymbols?this.mapProjection.projectTileCoordinates(n,o,a,h):X(new c.P(n,o),t,h);return .5+this.transform.cameraToCenterDistance/g.signedDistanceFromCamera*.5}isOffscreen(t,n,o,a){return o<nt||t>=this.screenRightBoundary||a<nt||n>this.screenBottomBoundary}isInsideGrid(t,n,o,a){return o>=0&&t<this.gridRightBoundary&&a>=0&&n<this.gridBottomBoundary}getViewportMatrix(){const t=c.ao([]);return c.J(t,t,[-100,-100,0]),t}_projectCollisionBox(t,n,o,a,h,g,y,b,w,C){const E=n*b.perspectiveRatio;let R=new c.P(1,0),F=new c.P(0,1);const $=new c.P(t.anchorPointX+y[0],t.anchorPointY+y[1]);if(g&&!h){const Re=this.projectAndGetPerspectiveRatio(o,$.x+1,$.y,a,w).point.sub(b.point).unit(),Se=Math.atan(Re.y/Re.x)+(Re.x<0?Math.PI:0),Te=Math.sin(Se),Ne=Math.cos(Se);R=new c.P(Ne,Te),F=new c.P(-Te,Ne)}else if(!g&&h){const Re=-this.transform.angle,Se=Math.sin(Re),Te=Math.cos(Re);R=new c.P(Te,Se),F=new c.P(-Se,Te)}let H=b.point,U=E;if(h){H=$;const Re=this.transform.zoom-Math.floor(this.transform.zoom);U=Math.pow(2,-Re),U*=this.mapProjection.getPitchedTextCorrection(this.transform,$,a),C||(U*=c.ad(.5+b.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))}C&&(H=H.add(R.mult(C.x*U)).add(F.mult(C.y*U)));const W=t.x1*U,Y=t.x2*U,j=(W+Y)/2,te=t.y1*U,se=t.y2*U,ce=(te+se)/2,ye=[{offsetX:W,offsetY:te},{offsetX:j,offsetY:te},{offsetX:Y,offsetY:te},{offsetX:Y,offsetY:ce},{offsetX:Y,offsetY:se},{offsetX:j,offsetY:se},{offsetX:W,offsetY:se},{offsetX:W,offsetY:ce}];let we=[];for(const{offsetX:Re,offsetY:Se}of ye)we.push(new c.P(H.x+R.x*Re+F.x*Se,H.y+R.y*Re+F.y*Se));let De=!1;if(h){const Re=we.map(Se=>this.projectAndGetPerspectiveRatio(o,Se.x,Se.y,a,w));De=Re.some(Se=>!Se.isOccluded),we=Re.map(Se=>Se.point)}else De=!0;return{box:c.ap(we),allPointsOccluded:!De}}}function rt(u,t,n){return t*(c.X/(u.tileSize*Math.pow(2,n-u.tileID.overscaledZ)))}class Ct{constructor(t,n,o,a){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?n:-n))):a&&o?1:0,this.placed=o}isHidden(){return this.opacity===0&&!this.placed}}class Ut{constructor(t,n,o,a,h){this.text=new Ct(t?t.text:null,n,o,h),this.icon=new Ct(t?t.icon:null,n,a,h)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Kt{constructor(t,n,o){this.text=t,this.icon=n,this.skipFade=o}}class lt{constructor(){this.invProjMatrix=c.H(),this.viewportMatrix=c.H(),this.circles=[]}}class vt{constructor(t,n,o,a,h){this.bucketInstanceId=t,this.featureIndex=n,this.sourceLayerIndex=o,this.bucketIndex=a,this.tileID=h}}class Ot{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:o=>o.collisionGroupID===n}}return this.collisionGroups[t]}}function ei(u,t,n,o,a){const{horizontalAlign:h,verticalAlign:g}=c.av(u);return new c.P(-(h-.5)*t+o[0]*a,-(g-.5)*n+o[1]*a)}class ci{constructor(t,n,o,a,h,g){this.transform=t.clone(),this.terrain=o,this.collisionIndex=new mt(this.transform,n),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=a,this.retainedQueryData={},this.collisionGroups=new Ot(h),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=g,g&&(g.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(t){const n=this.terrain;return n?(o,a)=>n.getElevation(t,o,a):null}getBucketParts(t,n,o,a){const h=o.getBucket(n),g=o.latestFeatureIndex;if(!h||!g||n.id!==h.layerIds[0])return;const y=o.collisionBoxArray,b=h.layers[0].layout,w=h.layers[0].paint,C=Math.pow(2,this.transform.zoom-o.tileID.overscaledZ),E=o.tileSize/c.X,R=o.tileID.toUnwrapped(),F=this.transform.calculatePosMatrix(R),$=b.get("text-pitch-alignment")==="map",H=b.get("text-rotation-alignment")==="map",U=rt(o,1,this.transform.zoom),W=this.collisionIndex.mapProjection.translatePosition(this.transform,o,w.get("text-translate"),w.get("text-translate-anchor")),Y=this.collisionIndex.mapProjection.translatePosition(this.transform,o,w.get("icon-translate"),w.get("icon-translate-anchor")),j=Gr(F,$,H,this.transform,U);let te=null;if($){const ce=_r(F,$,H,this.transform,U);te=c.L([],this.transform.labelPlaneMatrix,ce)}this.retainedQueryData[h.bucketInstanceId]=new vt(h.bucketInstanceId,g,h.sourceLayerIndex,h.index,o.tileID);const se={bucket:h,layout:b,translationText:W,translationIcon:Y,posMatrix:F,unwrappedTileID:R,textLabelPlaneMatrix:j,labelToScreenMatrix:te,scale:C,textPixelRatio:E,holdingForFade:o.holdingForFade(),collisionBoxArray:y,partiallyEvaluatedTextSize:c.ah(h.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(h.sourceID)};if(a)for(const ce of h.sortKeyRanges){const{sortKey:ye,symbolInstanceStart:we,symbolInstanceEnd:De}=ce;t.push({sortKey:ye,symbolInstanceStart:we,symbolInstanceEnd:De,parameters:se})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:h.symbolInstances.length,parameters:se})}attemptAnchorPlacement(t,n,o,a,h,g,y,b,w,C,E,R,F,$,H,U,W,Y,j){const te=c.ar[t.textAnchor],se=[t.textOffset0,t.textOffset1],ce=ei(te,o,a,se,h),ye=this.collisionIndex.placeCollisionBox(n,R,b,w,C,y,g,U,E.predicate,j,ce);if((!Y||this.collisionIndex.placeCollisionBox(Y,R,b,w,C,y,g,W,E.predicate,j,ce).placeable)&&ye.placeable){let we;if(this.prevPlacement&&this.prevPlacement.variableOffsets[F.crossTileID]&&this.prevPlacement.placements[F.crossTileID]&&this.prevPlacement.placements[F.crossTileID].text&&(we=this.prevPlacement.variableOffsets[F.crossTileID].anchor),F.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[F.crossTileID]={textOffset:se,width:o,height:a,anchor:te,textBoxScale:h,prevAnchor:we},this.markUsedJustification($,te,F,H),$.allowVerticalPlacement&&(this.markUsedOrientation($,H,F),this.placedOrientations[F.crossTileID]=H),{shift:ce,placedGlyphBoxes:ye}}}placeLayerBucketPart(t,n,o){const{bucket:a,layout:h,translationText:g,translationIcon:y,posMatrix:b,unwrappedTileID:w,textLabelPlaneMatrix:C,labelToScreenMatrix:E,textPixelRatio:R,holdingForFade:F,collisionBoxArray:$,partiallyEvaluatedTextSize:H,collisionGroup:U}=t.parameters,W=h.get("text-optional"),Y=h.get("icon-optional"),j=c.as(h,"text-overlap","text-allow-overlap"),te=j==="always",se=c.as(h,"icon-overlap","icon-allow-overlap"),ce=se==="always",ye=h.get("text-rotation-alignment")==="map",we=h.get("text-pitch-alignment")==="map",De=h.get("icon-text-fit")!=="none",Re=h.get("symbol-z-order")==="viewport-y",Se=te&&(ce||!a.hasIconData()||Y),Te=ce&&(te||!a.hasTextData()||W);!a.collisionArrays&&$&&a.deserializeCollisionBoxes($);const Ne=this._getTerrainElevationFunc(this.retainedQueryData[a.bucketInstanceId].tileID),tt=(Ce,Ae,Qe)=>{var Dt,ot;if(n[Ce.crossTileID])return;if(F)return void(this.placements[Ce.crossTileID]=new Kt(!1,!1,!1));let dt=!1,Lt=!1,di=!0,nr=null,Rt={box:null,placeable:!1,offscreen:null},Mi={box:null,placeable:!1,offscreen:null},ki=null,pi=null,fi=null,sr=0,vn=0,bo=0;Ae.textFeatureIndex?sr=Ae.textFeatureIndex:Ce.useRuntimeCollisionCircles&&(sr=Ce.featureIndex),Ae.verticalTextFeatureIndex&&(vn=Ae.verticalTextFeatureIndex);const qn=Ae.textBox;if(qn){const oi=mi=>{let gi=c.ai.horizontal;if(a.allowVerticalPlacement&&!mi&&this.prevPlacement){const ri=this.prevPlacement.placedOrientations[Ce.crossTileID];ri&&(this.placedOrientations[Ce.crossTileID]=ri,gi=ri,this.markUsedOrientation(a,gi,Ce))}return gi},or=(mi,gi)=>{if(a.allowVerticalPlacement&&Ce.numVerticalGlyphVertices>0&&Ae.verticalTextBox){for(const ri of a.writingModes)if(ri===c.ai.vertical?(Rt=gi(),Mi=Rt):Rt=mi(),Rt&&Rt.placeable)break}else Rt=mi()},Qr=Ce.textAnchorOffsetStartIndex,Zn=Ce.textAnchorOffsetEndIndex;if(Zn===Qr){const mi=(gi,ri)=>{const Nt=this.collisionIndex.placeCollisionBox(gi,j,R,b,w,we,ye,g,U.predicate,Ne);return Nt&&Nt.placeable&&(this.markUsedOrientation(a,ri,Ce),this.placedOrientations[Ce.crossTileID]=ri),Nt};or(()=>mi(qn,c.ai.horizontal),()=>{const gi=Ae.verticalTextBox;return a.allowVerticalPlacement&&Ce.numVerticalGlyphVertices>0&&gi?mi(gi,c.ai.vertical):{box:null,offscreen:null}}),oi(Rt&&Rt.placeable)}else{let mi=c.ar[(ot=(Dt=this.prevPlacement)===null||Dt===void 0?void 0:Dt.variableOffsets[Ce.crossTileID])===null||ot===void 0?void 0:ot.anchor];const gi=(Nt,Gn,Fa)=>{const ti=Nt.x2-Nt.x1,Kl=Nt.y2-Nt.y1,So=Ce.textBoxScale,To=De&&se==="never"?Gn:null;let en=null,Yl=j==="never"?1:2,Oa="never";mi&&Yl++;for(let Va=0;Va<Yl;Va++){for(let Na=Qr;Na<Zn;Na++){const ko=a.textAnchorOffsets.get(Na);if(mi&&ko.textAnchor!==mi)continue;const Hn=this.attemptAnchorPlacement(ko,Nt,ti,Kl,So,ye,we,R,b,w,U,Oa,Ce,a,Fa,g,y,To,Ne);if(Hn&&(en=Hn.placedGlyphBoxes,en&&en.placeable))return dt=!0,nr=Hn.shift,en}mi?mi=null:Oa=j}return o&&!en&&(en={box:this.collisionIndex.placeCollisionBox(qn,"always",R,b,w,we,ye,g,U.predicate,Ne,new c.P(0,0)).box,offscreen:!1,placeable:!1}),en};or(()=>gi(qn,Ae.iconBox,c.ai.horizontal),()=>{const Nt=Ae.verticalTextBox;return a.allowVerticalPlacement&&(!Rt||!Rt.placeable)&&Ce.numVerticalGlyphVertices>0&&Nt?gi(Nt,Ae.verticalIconBox,c.ai.vertical):{box:null,occluded:!0,offscreen:null}}),Rt&&(dt=Rt.placeable,di=Rt.offscreen);const ri=oi(Rt&&Rt.placeable);if(!dt&&this.prevPlacement){const Nt=this.prevPlacement.variableOffsets[Ce.crossTileID];Nt&&(this.variableOffsets[Ce.crossTileID]=Nt,this.markUsedJustification(a,Nt.anchor,Ce,ri))}}}if(ki=Rt,dt=ki&&ki.placeable,di=ki&&ki.offscreen,Ce.useRuntimeCollisionCircles){const oi=a.text.placedSymbolArray.get(Ce.centerJustifiedTextSymbolIndex),or=c.aj(a.textSizeData,H,oi),Qr=h.get("text-padding");pi=this.collisionIndex.placeCollisionCircles(j,oi,a.lineVertexArray,a.glyphOffsetArray,or,b,w,C,E,o,we,U.predicate,Ce.collisionCircleDiameter,Qr,g,Ne),pi.circles.length&&pi.collisionDetected&&!o&&c.w("Collisions detected, but collision boxes are not shown"),dt=te||pi.circles.length>0&&!pi.collisionDetected,di=di&&pi.offscreen}if(Ae.iconFeatureIndex&&(bo=Ae.iconFeatureIndex),Ae.iconBox){const oi=or=>this.collisionIndex.placeCollisionBox(or,se,R,b,w,we,ye,y,U.predicate,Ne,De&&nr?nr:void 0);Mi&&Mi.placeable&&Ae.verticalIconBox?(fi=oi(Ae.verticalIconBox),Lt=fi.placeable):(fi=oi(Ae.iconBox),Lt=fi.placeable),di=di&&fi.offscreen}const bn=W||Ce.numHorizontalGlyphVertices===0&&Ce.numVerticalGlyphVertices===0,wo=Y||Ce.numIconVertices===0;bn||wo?wo?bn||(Lt=Lt&&dt):dt=Lt&&dt:Lt=dt=Lt&&dt;const Ba=Lt&&fi.placeable;if(dt&&ki.placeable&&this.collisionIndex.insertCollisionBox(ki.box,j,h.get("text-ignore-placement"),a.bucketInstanceId,Mi&&Mi.placeable&&vn?vn:sr,U.ID),Ba&&this.collisionIndex.insertCollisionBox(fi.box,se,h.get("icon-ignore-placement"),a.bucketInstanceId,bo,U.ID),pi&&dt&&this.collisionIndex.insertCollisionCircles(pi.circles,j,h.get("text-ignore-placement"),a.bucketInstanceId,sr,U.ID),o&&this.storeCollisionData(a.bucketInstanceId,Qe,Ae,ki,fi,pi),Ce.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(a.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[Ce.crossTileID]=new Kt(dt||Se,Lt||Te,di||a.justReloaded),n[Ce.crossTileID]=!0};if(Re){if(t.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const Ce=a.getSortedSymbolIndexes(this.transform.angle);for(let Ae=Ce.length-1;Ae>=0;--Ae){const Qe=Ce[Ae];tt(a.symbolInstances.get(Qe),a.collisionArrays[Qe],Qe)}}else for(let Ce=t.symbolInstanceStart;Ce<t.symbolInstanceEnd;Ce++)tt(a.symbolInstances.get(Ce),a.collisionArrays[Ce],Ce);if(o&&a.bucketInstanceId in this.collisionCircleArrays){const Ce=this.collisionCircleArrays[a.bucketInstanceId];c.at(Ce.invProjMatrix,b),Ce.viewportMatrix=this.collisionIndex.getViewportMatrix()}a.justReloaded=!1}storeCollisionData(t,n,o,a,h,g){if(o.textBox||o.iconBox){let y,b;this.collisionBoxArrays.has(t)?y=this.collisionBoxArrays.get(t):(y=new Map,this.collisionBoxArrays.set(t,y)),y.has(n)?b=y.get(n):(b={text:null,icon:null},y.set(n,b)),o.textBox&&(b.text=a.box),o.iconBox&&(b.icon=h.box)}if(g){let y=this.collisionCircleArrays[t];y===void 0&&(y=this.collisionCircleArrays[t]=new lt);for(let b=0;b<g.circles.length;b+=4)y.circles.push(g.circles[b+0]),y.circles.push(g.circles[b+1]),y.circles.push(g.circles[b+2]),y.circles.push(g.collisionDetected?1:0)}}markUsedJustification(t,n,o,a){let h;h=a===c.ai.vertical?o.verticalPlacedTextSymbolIndex:{left:o.leftJustifiedTextSymbolIndex,center:o.centerJustifiedTextSymbolIndex,right:o.rightJustifiedTextSymbolIndex}[c.au(n)];const g=[o.leftJustifiedTextSymbolIndex,o.centerJustifiedTextSymbolIndex,o.rightJustifiedTextSymbolIndex,o.verticalPlacedTextSymbolIndex];for(const y of g)y>=0&&(t.text.placedSymbolArray.get(y).crossTileID=h>=0&&y!==h?0:o.crossTileID)}markUsedOrientation(t,n,o){const a=n===c.ai.horizontal||n===c.ai.horizontalOnly?n:0,h=n===c.ai.vertical?n:0,g=[o.leftJustifiedTextSymbolIndex,o.centerJustifiedTextSymbolIndex,o.rightJustifiedTextSymbolIndex];for(const y of g)t.text.placedSymbolArray.get(y).placedOrientation=a;o.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(o.verticalPlacedTextSymbolIndex).placedOrientation=h)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const n=this.prevPlacement;let o=!1;this.prevZoomAdjustment=n?n.zoomAdjustment(this.transform.zoom):0;const a=n?n.symbolFadeChange(t):1,h=n?n.opacities:{},g=n?n.variableOffsets:{},y=n?n.placedOrientations:{};for(const b in this.placements){const w=this.placements[b],C=h[b];C?(this.opacities[b]=new Ut(C,a,w.text,w.icon),o=o||w.text!==C.text.placed||w.icon!==C.icon.placed):(this.opacities[b]=new Ut(null,a,w.text,w.icon,w.skipFade),o=o||w.text||w.icon)}for(const b in h){const w=h[b];if(!this.opacities[b]){const C=new Ut(w,a,!1,!1);C.isHidden()||(this.opacities[b]=C,o=o||w.text.placed||w.icon.placed)}}for(const b in g)this.variableOffsets[b]||!this.opacities[b]||this.opacities[b].isHidden()||(this.variableOffsets[b]=g[b]);for(const b in y)this.placedOrientations[b]||!this.opacities[b]||this.opacities[b].isHidden()||(this.placedOrientations[b]=y[b]);if(n&&n.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");o?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=n?n.lastPlacementChangeTime:t)}updateLayerOpacities(t,n){const o={};for(const a of n){const h=a.getBucket(t);h&&a.latestFeatureIndex&&t.id===h.layerIds[0]&&this.updateBucketOpacities(h,a.tileID,o,a.collisionBoxArray)}}updateBucketOpacities(t,n,o,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 h=t.layers[0],g=h.layout,y=new Ut(null,0,!1,!1,!0),b=g.get("text-allow-overlap"),w=g.get("icon-allow-overlap"),C=h._unevaluatedLayout.hasValue("text-variable-anchor")||h._unevaluatedLayout.hasValue("text-variable-anchor-offset"),E=g.get("text-rotation-alignment")==="map",R=g.get("text-pitch-alignment")==="map",F=g.get("icon-text-fit")!=="none",$=new Ut(null,0,b&&(w||!t.hasIconData()||g.get("icon-optional")),w&&(b||!t.hasTextData()||g.get("text-optional")),!0);!t.collisionArrays&&a&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(a);const H=(W,Y,j)=>{for(let te=0;te<Y/4;te++)W.opacityVertexArray.emplaceBack(j);W.hasVisibleVertices=W.hasVisibleVertices||j!==ui},U=this.collisionBoxArrays.get(t.bucketInstanceId);for(let W=0;W<t.symbolInstances.length;W++){const Y=t.symbolInstances.get(W),{numHorizontalGlyphVertices:j,numVerticalGlyphVertices:te,crossTileID:se}=Y;let ce=this.opacities[se];o[se]?ce=y:ce||(ce=$,this.opacities[se]=ce),o[se]=!0;const ye=Y.numIconVertices>0,we=this.placedOrientations[Y.crossTileID],De=we===c.ai.vertical,Re=we===c.ai.horizontal||we===c.ai.horizontalOnly;if(j>0||te>0){const Te=$i(ce.text);H(t.text,j,De?ui:Te),H(t.text,te,Re?ui:Te);const Ne=ce.text.isHidden();[Y.rightJustifiedTextSymbolIndex,Y.centerJustifiedTextSymbolIndex,Y.leftJustifiedTextSymbolIndex].forEach(Ae=>{Ae>=0&&(t.text.placedSymbolArray.get(Ae).hidden=Ne||De?1:0)}),Y.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(Y.verticalPlacedTextSymbolIndex).hidden=Ne||Re?1:0);const tt=this.variableOffsets[Y.crossTileID];tt&&this.markUsedJustification(t,tt.anchor,Y,we);const Ce=this.placedOrientations[Y.crossTileID];Ce&&(this.markUsedJustification(t,"left",Y,Ce),this.markUsedOrientation(t,Ce,Y))}if(ye){const Te=$i(ce.icon),Ne=!(F&&Y.verticalPlacedIconSymbolIndex&&De);Y.placedIconSymbolIndex>=0&&(H(t.icon,Y.numIconVertices,Ne?Te:ui),t.icon.placedSymbolArray.get(Y.placedIconSymbolIndex).hidden=ce.icon.isHidden()),Y.verticalPlacedIconSymbolIndex>=0&&(H(t.icon,Y.numVerticalIconVertices,Ne?ui:Te),t.icon.placedSymbolArray.get(Y.verticalPlacedIconSymbolIndex).hidden=ce.icon.isHidden())}const Se=U&&U.has(W)?U.get(W):{text:null,icon:null};if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const Te=t.collisionArrays[W];if(Te){let Ne=new c.P(0,0);if(Te.textBox||Te.verticalTextBox){let tt=!0;if(C){const Ce=this.variableOffsets[se];Ce?(Ne=ei(Ce.anchor,Ce.width,Ce.height,Ce.textOffset,Ce.textBoxScale),E&&Ne._rotate(R?this.transform.angle:-this.transform.angle)):tt=!1}if(Te.textBox||Te.verticalTextBox){let Ce;Te.textBox&&(Ce=De),Te.verticalTextBox&&(Ce=Re),hi(t.textCollisionBox.collisionVertexArray,ce.text.placed,!tt||Ce,Se.text,Ne.x,Ne.y)}}if(Te.iconBox||Te.verticalIconBox){const tt=!!(!Re&&Te.verticalIconBox);let Ce;Te.iconBox&&(Ce=tt),Te.verticalIconBox&&(Ce=!tt),hi(t.iconCollisionBox.collisionVertexArray,ce.icon.placed,Ce,Se.icon,F?Ne.x:0,F?Ne.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 W=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=W.invProjMatrix,t.placementViewportMatrix=W.viewportMatrix,t.collisionCircleArray=W.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 o=this.zoomAtLastRecencyCheck===n?1-this.zoomAdjustment(n):1;return this.zoomAtLastRecencyCheck=n,this.commitTime+this.fadeDuration*o>t}setStale(){this.stale=!0}}function hi(u,t,n,o,a,h){o&&o.length!==0||(o=[0,0,0,0]);const g=o[0]-nt,y=o[1]-nt,b=o[2]-nt,w=o[3]-nt;u.emplaceBack(t?1:0,n?1:0,a||0,h||0,g,y),u.emplaceBack(t?1:0,n?1:0,a||0,h||0,b,y),u.emplaceBack(t?1:0,n?1:0,a||0,h||0,b,w),u.emplaceBack(t?1:0,n?1:0,a||0,h||0,g,w)}const cs=Math.pow(2,25),bt=Math.pow(2,24),Uo=Math.pow(2,17),qo=Math.pow(2,16),Vi=Math.pow(2,9),Ni=Math.pow(2,8),Vc=Math.pow(2,1);function $i(u){if(u.opacity===0&&!u.placed)return 0;if(u.opacity===1&&u.placed)return 4294967295;const t=u.placed?1:0,n=Math.floor(127*u.opacity);return n*cs+t*bt+n*Uo+t*qo+n*Vi+t*Ni+n*Vc+t}const ui=0;function qs(){return{isOccluded:(u,t,n)=>!1,getPitchedTextCorrection:(u,t,n)=>1,get useSpecialProjectionForSymbols(){return!1},projectTileCoordinates(u,t,n,o){throw new Error("Not implemented.")},translatePosition:(u,t,n,o)=>function(a,h,g,y,b=!1){if(!g[0]&&!g[1])return[0,0];const w=b?y==="map"?a.angle:0:y==="viewport"?-a.angle:0;if(w){const C=Math.sin(w),E=Math.cos(w);g=[g[0]*E-g[1]*C,g[0]*C+g[1]*E]}return[b?g[0]:rt(h,g[0],a.zoom),b?g[1]:rt(h,g[1],a.zoom)]}(u,t,n,o),getCircleRadiusCorrection:u=>1}}class hs{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,o,a,h){const g=this._bucketParts;for(;this._currentTileIndex<t.length;)if(n.getBucketParts(g,a,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,h())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,g.sort((y,b)=>y.sortKey-b.sortKey));this._currentPartIndex<g.length;)if(n.placeLayerBucketPart(g[this._currentPartIndex],this._seenCrossTileIDs,o),this._currentPartIndex++,h())return!0;return!1}}class Yt{constructor(t,n,o,a,h,g,y,b){this.placement=new ci(t,qs(),n,g,y,b),this._currentPlacementIndex=o.length-1,this._forceFullPlacement=a,this._showCollisionBoxes=h,this._done=!1}isDone(){return this._done}continuePlacement(t,n,o){const a=le.now(),h=()=>!this._forceFullPlacement&&le.now()-a>2;for(;this._currentPlacementIndex>=0;){const g=n[t[this._currentPlacementIndex]],y=this.placement.collisionIndex.transform.zoom;if(g.type==="symbol"&&(!g.minzoom||g.minzoom<=y)&&(!g.maxzoom||g.maxzoom>y)){if(this._inProgressLayer||(this._inProgressLayer=new hs(g)),this._inProgressLayer.continuePlacement(o[g.source],this.placement,this._showCollisionBoxes,g,h))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const zr=512/c.X/2;class hn{constructor(t,n,o){this.tileID=t,this.bucketInstanceId=o,this._symbolsByKey={};const a=new Map;for(let h=0;h<n.length;h++){const g=n.get(h),y=g.key,b=a.get(y);b?b.push(g):a.set(y,[g])}for(const[h,g]of a){const y={positions:g.map(b=>({x:Math.floor(b.anchorX*zr),y:Math.floor(b.anchorY*zr)})),crossTileIDs:g.map(b=>b.crossTileID)};if(y.positions.length>128){const b=new c.aw(y.positions.length,16,Uint16Array);for(const{x:w,y:C}of y.positions)b.add(w,C);b.finish(),delete y.positions,y.index=b}this._symbolsByKey[h]=y}}getScaledCoordinates(t,n){const{x:o,y:a,z:h}=this.tileID.canonical,{x:g,y,z:b}=n.canonical,w=zr/Math.pow(2,b-h),C=(y*c.X+t.anchorY)*w,E=a*c.X*zr;return{x:Math.floor((g*c.X+t.anchorX)*w-o*c.X*zr),y:Math.floor(C-E)}}findMatches(t,n,o){const a=this.tileID.canonical.z<n.canonical.z?1:Math.pow(2,this.tileID.canonical.z-n.canonical.z);for(let h=0;h<t.length;h++){const g=t.get(h);if(g.crossTileID)continue;const y=this._symbolsByKey[g.key];if(!y)continue;const b=this.getScaledCoordinates(g,n);if(y.index){const w=y.index.range(b.x-a,b.y-a,b.x+a,b.y+a).sort();for(const C of w){const E=y.crossTileIDs[C];if(!o[E]){o[E]=!0,g.crossTileID=E;break}}}else if(y.positions)for(let w=0;w<y.positions.length;w++){const C=y.positions[w],E=y.crossTileIDs[w];if(Math.abs(C.x-b.x)<=a&&Math.abs(C.y-b.y)<=a&&!o[E]){o[E]=!0,g.crossTileID=E;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:t})=>t)}}class Wt{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Zs{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const n=Math.round((t-this.lng)/360);if(n!==0)for(const o in this.indexes){const a=this.indexes[o],h={};for(const g in a){const y=a[g];y.tileID=y.tileID.unwrapTo(y.tileID.wrap+n),h[y.tileID.key]=y}this.indexes[o]=h}this.lng=t}addBucket(t,n,o){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 h=0;h<n.symbolInstances.length;h++)n.symbolInstances.get(h).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]={});const a=this.usedCrossTileIDs[t.overscaledZ];for(const h in this.indexes){const g=this.indexes[h];if(Number(h)>t.overscaledZ)for(const y in g){const b=g[y];b.tileID.isChildOf(t)&&b.findMatches(n.symbolInstances,t,a)}else{const y=g[t.scaledTo(Number(h)).key];y&&y.findMatches(n.symbolInstances,t,a)}}for(let h=0;h<n.symbolInstances.length;h++){const g=n.symbolInstances.get(h);g.crossTileID||(g.crossTileID=o.generate(),a[g.crossTileID]=!0)}return this.indexes[t.overscaledZ]===void 0&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new hn(t,n.symbolInstances,n.bucketInstanceId),!0}removeBucketCrossTileIDs(t,n){for(const o of n.getCrossTileIDsLists())for(const a of o)delete this.usedCrossTileIDs[t][a]}removeStaleBuckets(t){let n=!1;for(const o in this.indexes){const a=this.indexes[o];for(const h in a)t[a[h].bucketInstanceId]||(this.removeBucketCrossTileIDs(o,a[h]),delete a[h],n=!0)}return n}}class Wi{constructor(){this.layerIndexes={},this.crossTileIDs=new Wt,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,n,o){let a=this.layerIndexes[t.id];a===void 0&&(a=this.layerIndexes[t.id]=new Zs);let h=!1;const g={};a.handleWrapJump(o);for(const y of n){const b=y.getBucket(t);b&&t.id===b.layerIds[0]&&(b.bucketInstanceId||(b.bucketInstanceId=++this.maxBucketInstanceId),a.addBucket(y.tileID,b,this.crossTileIDs)&&(h=!0),g[b.bucketInstanceId]=!0)}return a.removeStaleBuckets(g)&&(h=!0),h}pruneUnusedLayers(t){const n={};t.forEach(o=>{n[o]=!0});for(const o in this.layerIndexes)n[o]||delete this.layerIndexes[o]}}const us=(u,t)=>c.t(u,t&&t.filter(n=>n.identifier!=="source.canvas")),Hr=c.ax();class Zo extends c.E{constructor(t,n={}){super(),this._rtlPluginLoaded=()=>{for(const o in this.sourceCaches){const a=this.sourceCaches[o].getSource().type;a!=="vector"&&a!=="geojson"||this.sourceCaches[o].reload()}},this.map=t,this.dispatcher=new ln(an(),t._getMapId()),this.dispatcher.registerMessageHandler("GG",(o,a)=>this.getGlyphs(o,a)),this.dispatcher.registerMessageHandler("GI",(o,a)=>this.getImages(o,a)),this.imageManager=new li,this.imageManager.setEventedParent(this),this.glyphManager=new dr(t._requestManager,n.localIdeographFontFamily),this.lineAtlas=new Pn(256,512),this.crossTileSymbolIndex=new Wi,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new c.ay,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",c.az()),mr().on(ke,this._rtlPluginLoaded),this.on("data",o=>{if(o.dataType!=="source"||o.sourceDataType!=="metadata")return;const a=this.sourceCaches[o.sourceId];if(!a)return;const h=a.getSource();if(h&&h.vectorLayerIds)for(const g in this._layers){const y=this._layers[g];y.source===h.id&&this._validateLayer(y)}})}loadURL(t,n={},o){this.fire(new c.k("dataloading",{dataType:"style"})),n.validate=typeof n.validate!="boolean"||n.validate;const a=this.map._requestManager.transformRequest(t,"Style");this._loadStyleRequest=new AbortController;const h=this._loadStyleRequest;c.h(a,this._loadStyleRequest).then(g=>{this._loadStyleRequest=null,this._load(g.data,n,o)}).catch(g=>{this._loadStyleRequest=null,g&&!h.signal.aborted&&this.fire(new c.j(g))})}loadJSON(t,n={},o){this.fire(new c.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,le.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,n.validate=n.validate!==!1,this._load(t,n,o)}).catch(()=>{})}loadEmpty(){this.fire(new c.k("dataloading",{dataType:"style"})),this._load(Hr,{validate:!1})}_load(t,n,o){var a;const h=n.transformStyle?n.transformStyle(o,t):t;if(!n.validate||!us(this,c.x(h))){this._loaded=!0,this.stylesheet=h;for(const g in h.sources)this.addSource(g,h.sources[g],{validate:!1});h.sprite?this._loadSprite(h.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(h.glyphs),this._createLayers(),this.light=new Er(this.stylesheet.light),this.sky=new Qi(this.stylesheet.sky),this.map.setTerrain((a=this.stylesheet.terrain)!==null&&a!==void 0?a:null),this.fire(new c.k("data",{dataType:"style"})),this.fire(new c.k("style.load"))}}_createLayers(){const t=c.aA(this.stylesheet.layers);this.dispatcher.broadcast("SL",t),this._order=t.map(n=>n.id),this._layers={},this._serializedLayers=null;for(const n of t){const o=c.aB(n);o.setEventedParent(this,{layer:{id:n.id}}),this._layers[n.id]=o}}_loadSprite(t,n=!1,o=void 0){let a;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(h,g,y,b){return c._(this,void 0,void 0,function*(){const w=bi(h),C=y>1?"@2x":"",E={},R={};for(const{id:F,url:$}of w){const H=g.transformRequest(Nr($,C,".json"),"SpriteJSON");E[F]=c.h(H,b);const U=g.transformRequest(Nr($,C,".png"),"SpriteImage");R[F]=He.getImage(U,b)}return yield Promise.all([...Object.values(E),...Object.values(R)]),function(F,$){return c._(this,void 0,void 0,function*(){const H={};for(const U in F){H[U]={};const W=le.getImageCanvasContext((yield $[U]).data),Y=(yield F[U]).data;for(const j in Y){const{width:te,height:se,x:ce,y:ye,sdf:we,pixelRatio:De,stretchX:Re,stretchY:Se,content:Te,textFitWidth:Ne,textFitHeight:tt}=Y[j];H[U][j]={data:null,pixelRatio:De,sdf:we,stretchX:Re,stretchY:Se,content:Te,textFitWidth:Ne,textFitHeight:tt,spriteData:{width:te,height:se,x:ce,y:ye,context:W}}}}return H})}(E,R)})}(t,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(h=>{if(this._spriteRequest=null,h)for(const g in h){this._spritesImagesIds[g]=[];const y=this._spritesImagesIds[g]?this._spritesImagesIds[g].filter(b=>!(b in h)):[];for(const b of y)this.imageManager.removeImage(b),this._changedImages[b]=!0;for(const b in h[g]){const w=g==="default"?b:`${g}:${b}`;this._spritesImagesIds[g].push(w),w in this.imageManager.images?this.imageManager.updateImage(w,h[g][b],!1):this.imageManager.addImage(w,h[g][b]),n&&(this._changedImages[w]=!0)}}}).catch(h=>{this._spriteRequest=null,a=h,this.fire(new c.j(a))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),n&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new c.k("data",{dataType:"style"})),o&&o(a)})}_unloadSprite(){for(const t of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(t),this._changedImages[t]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new c.k("data",{dataType:"style"}))}_validateLayer(t){const n=this.sourceCaches[t.source];if(!n)return;const o=t.sourceLayer;if(!o)return;const a=n.getSource();(a.type==="geojson"||a.vectorLayerIds&&a.vectorLayerIds.indexOf(o)===-1)&&this.fire(new c.j(new Error(`Source layer "${o}" does not exist on source "${a.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 o=[];for(const a of t)n[a]&&o.push(n[a]);return o}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;t=this._serializedLayers={};const n=Object.keys(this._layers);for(const o of n){const a=this._layers[o];a.type!=="custom"&&(t[o]=a.serialize())}return t}hasTransitions(){if(this.light&&this.light.hasTransition()||this.sky&&this.sky.hasTransition())return!0;for(const t in this.sourceCaches)if(this.sourceCaches[t].hasTransition())return!0;for(const t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(t){if(!this._loaded)return;const n=this._changed;if(n){const a=Object.keys(this._updatedLayers),h=Object.keys(this._removedLayers);(a.length||h.length)&&this._updateWorkerLayers(a,h);for(const g in this._updatedSources){const y=this._updatedSources[g];if(y==="reload")this._reloadSource(g);else{if(y!=="clear")throw new Error(`Invalid action ${y}`);this._clearSource(g)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const g in this._updatedPaintProps)this._layers[g].updateTransitions(t);this.light.updateTransitions(t),this.sky.updateTransitions(t),this._resetUpdates()}const o={};for(const a in this.sourceCaches){const h=this.sourceCaches[a];o[a]=h.used,h.used=!1}for(const a of this._order){const h=this._layers[a];h.recalculate(t,this._availableImages),!h.isHidden(t.zoom)&&h.source&&(this.sourceCaches[h.source].used=!0)}for(const a in o){const h=this.sourceCaches[a];!!o[a]!=!!h.used&&h.fire(new c.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:a}))}this.light.recalculate(t),this.sky.recalculate(t),this.z=t.zoom,n&&this.fire(new c.k("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("UL",{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={}){var o;this._checkLoaded();const a=this.serialize();if(t=n.transformStyle?n.transformStyle(a,t):t,((o=n.validate)===null||o===void 0||o)&&us(this,c.x(t)))return!1;(t=c.aC(t)).layers=c.aA(t.layers);const h=c.aD(a,t),g=this._getOperationsToPerform(h);if(g.unimplemented.length>0)throw new Error(`Unimplemented: ${g.unimplemented.join(", ")}.`);if(g.operations.length===0)return!1;for(const y of g.operations)y();return this.stylesheet=t,this._serializedLayers=null,!0}_getOperationsToPerform(t){const n=[],o=[];for(const a of t)switch(a.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":n.push(()=>this.addLayer.apply(this,a.args));break;case"removeLayer":n.push(()=>this.removeLayer.apply(this,a.args));break;case"setPaintProperty":n.push(()=>this.setPaintProperty.apply(this,a.args));break;case"setLayoutProperty":n.push(()=>this.setLayoutProperty.apply(this,a.args));break;case"setFilter":n.push(()=>this.setFilter.apply(this,a.args));break;case"addSource":n.push(()=>this.addSource.apply(this,a.args));break;case"removeSource":n.push(()=>this.removeSource.apply(this,a.args));break;case"setLayerZoomRange":n.push(()=>this.setLayerZoomRange.apply(this,a.args));break;case"setLight":n.push(()=>this.setLight.apply(this,a.args));break;case"setGeoJSONSourceData":n.push(()=>this.setGeoJSONSourceData.apply(this,a.args));break;case"setGlyphs":n.push(()=>this.setGlyphs.apply(this,a.args));break;case"setSprite":n.push(()=>this.setSprite.apply(this,a.args));break;case"setSky":n.push(()=>this.setSky.apply(this,a.args));break;case"setTerrain":n.push(()=>this.map.setTerrain.apply(this,a.args));break;case"setTransition":n.push(()=>{});break;default:o.push(a.command)}return{operations:n,unimplemented:o}}addImage(t,n){if(this.getImage(t))return this.fire(new c.j(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 c.j(new Error(`An image named "${t}" does not exist.`)));this.imageManager.removeImage(t),this._afterImageUpdated(t)}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new c.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,n,o={}){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(c.x.source,`sources.${t}`,n,null,o))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);const a=this.sourceCaches[t]=new Ye(t,n,this.dispatcher);a.style=this,a.setEventedParent(this,()=>({isSourceLoaded:a.loaded(),source:a.serialize(),sourceId:t})),a.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 o in this._layers)if(this._layers[o].source===t)return this.fire(new c.j(new Error(`Source "${t}" cannot be removed while layer "${o}" is using it.`)));const n=this.sourceCaches[t];delete this.sourceCaches[t],delete this._updatedSources[t],n.fire(new c.k("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 o=this.sourceCaches[t].getSource();if(o.type!=="geojson")throw new Error(`geojsonSource.type is ${o.type}, which is !== 'geojson`);o.setData(n),this._changed=!0}getSource(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()}addLayer(t,n,o={}){this._checkLoaded();const a=t.id;if(this.getLayer(a))return void this.fire(new c.j(new Error(`Layer "${a}" already exists on this map.`)));let h;if(t.type==="custom"){if(us(this,c.aE(t)))return;h=c.aB(t)}else{if("source"in t&&typeof t.source=="object"&&(this.addSource(a,t.source),t=c.aC(t),t=c.e(t,{source:a})),this._validate(c.x.layer,`layers.${a}`,t,{arrayIndex:-1},o))return;h=c.aB(t),this._validateLayer(h),h.setEventedParent(this,{layer:{id:a}})}const g=n?this._order.indexOf(n):this._order.length;if(n&&g===-1)this.fire(new c.j(new Error(`Cannot add layer "${a}" before non-existing layer "${n}".`)));else{if(this._order.splice(g,0,a),this._layerOrderChanged=!0,this._layers[a]=h,this._removedLayers[a]&&h.source&&h.type!=="custom"){const y=this._removedLayers[a];delete this._removedLayers[a],y.type!==h.type?this._updatedSources[h.source]="clear":(this._updatedSources[h.source]="reload",this.sourceCaches[h.source].pause())}this._updateLayer(h),h.onAdd&&h.onAdd(this.map)}}moveLayer(t,n){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new c.j(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===n)return;const o=this._order.indexOf(t);this._order.splice(o,1);const a=n?this._order.indexOf(n):this._order.length;n&&a===-1?this.fire(new c.j(new Error(`Cannot move layer "${t}" before non-existing layer "${n}".`))):(this._order.splice(a,0,t),this._layerOrderChanged=!0)}removeLayer(t){this._checkLoaded();const n=this._layers[t];if(!n)return void this.fire(new c.j(new Error(`Cannot remove non-existing layer "${t}".`)));n.setEventedParent(null);const o=this._order.indexOf(t);this._order.splice(o,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]}getLayersOrder(){return[...this._order]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,n,o){this._checkLoaded();const a=this.getLayer(t);a?a.minzoom===n&&a.maxzoom===o||(n!=null&&(a.minzoom=n),o!=null&&(a.maxzoom=o),this._updateLayer(a)):this.fire(new c.j(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,n,o={}){this._checkLoaded();const a=this.getLayer(t);if(a){if(!c.aF(a.filter,n))return n==null?(a.filter=void 0,void this._updateLayer(a)):void(this._validate(c.x.filter,`layers.${a.id}.filter`,n,null,o)||(a.filter=c.aC(n),this._updateLayer(a)))}else this.fire(new c.j(new Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return c.aC(this.getLayer(t).filter)}setLayoutProperty(t,n,o,a={}){this._checkLoaded();const h=this.getLayer(t);h?c.aF(h.getLayoutProperty(n),o)||(h.setLayoutProperty(n,o,a),this._updateLayer(h)):this.fire(new c.j(new Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,n){const o=this.getLayer(t);if(o)return o.getLayoutProperty(n);this.fire(new c.j(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,n,o,a={}){this._checkLoaded();const h=this.getLayer(t);h?c.aF(h.getPaintProperty(n),o)||(h.setPaintProperty(n,o,a)&&this._updateLayer(h),this._changed=!0,this._updatedPaintProps[t]=!0,this._serializedLayers=null):this.fire(new c.j(new Error(`Cannot style non-existing layer "${t}".`)))}getPaintProperty(t,n){return this.getLayer(t).getPaintProperty(n)}setFeatureState(t,n){this._checkLoaded();const o=t.source,a=t.sourceLayer,h=this.sourceCaches[o];if(h===void 0)return void this.fire(new c.j(new Error(`The source '${o}' does not exist in the map's style.`)));const g=h.getSource().type;g==="geojson"&&a?this.fire(new c.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):g!=="vector"||a?(t.id===void 0&&this.fire(new c.j(new Error("The feature id parameter must be provided."))),h.setFeatureState(a,t.id,n)):this.fire(new c.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(t,n){this._checkLoaded();const o=t.source,a=this.sourceCaches[o];if(a===void 0)return void this.fire(new c.j(new Error(`The source '${o}' does not exist in the map's style.`)));const h=a.getSource().type,g=h==="vector"?t.sourceLayer:void 0;h!=="vector"||g?n&&typeof t.id!="string"&&typeof t.id!="number"?this.fire(new c.j(new Error("A feature id is required to remove its specific state property."))):a.removeFeatureState(g,t.id,n):this.fire(new c.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();const n=t.source,o=t.sourceLayer,a=this.sourceCaches[n];if(a!==void 0)return a.getSource().type!=="vector"||o?(t.id===void 0&&this.fire(new c.j(new Error("The feature id parameter must be provided."))),a.getFeatureState(o,t.id)):void this.fire(new c.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new c.j(new Error(`The source '${n}' does not exist in the map's style.`)))}getTransition(){return c.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const t=c.aG(this.sourceCaches,h=>h.serialize()),n=this._serializeByIds(this._order),o=this.map.getTerrain()||void 0,a=this.stylesheet;return c.aH({version:a.version,name:a.name,metadata:a.metadata,light:a.light,sky:a.sky,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,terrain:o},h=>h!==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=g=>this._layers[g].type==="fill-extrusion",o={},a=[];for(let g=this._order.length-1;g>=0;g--){const y=this._order[g];if(n(y)){o[y]=g;for(const b of t){const w=b[y];if(w)for(const C of w)a.push(C)}}}a.sort((g,y)=>y.intersectionZ-g.intersectionZ);const h=[];for(let g=this._order.length-1;g>=0;g--){const y=this._order[g];if(n(y))for(let b=a.length-1;b>=0;b--){const w=a[b].feature;if(o[w.layer.id]<g)break;h.push(w),a.pop()}else for(const b of t){const w=b[y];if(w)for(const C of w)h.push(C.feature)}}return h}queryRenderedFeatures(t,n,o){n&&n.filter&&this._validate(c.x.filter,"queryRenderedFeatures.filter",n.filter,null,n);const a={};if(n&&n.layers){if(!Array.isArray(n.layers))return this.fire(new c.j(new Error("parameters.layers must be an Array."))),[];for(const y of n.layers){const b=this._layers[y];if(!b)return this.fire(new c.j(new Error(`The layer '${y}' does not exist in the map's style and cannot be queried for features.`))),[];a[b.source]=!0}}const h=[];n.availableImages=this._availableImages;const g=this._serializedAllLayers();for(const y in this.sourceCaches)n.layers&&!a[y]||h.push(jr(this.sourceCaches[y],this._layers,g,t,n,o));return this.placement&&h.push(function(y,b,w,C,E,R,F){const $={},H=R.queryRenderedSymbols(C),U=[];for(const W of Object.keys(H).map(Number))U.push(F[W]);U.sort(Ur);for(const W of U){const Y=W.featureIndex.lookupSymbolFeatures(H[W.bucketInstanceId],b,W.bucketIndex,W.sourceLayerIndex,E.filter,E.layers,E.availableImages,y);for(const j in Y){const te=$[j]=$[j]||[],se=Y[j];se.sort((ce,ye)=>{const we=W.featureSortOrder;if(we){const De=we.indexOf(ce.featureIndex);return we.indexOf(ye.featureIndex)-De}return ye.featureIndex-ce.featureIndex});for(const ce of se)te.push(ce)}}for(const W in $)$[W].forEach(Y=>{const j=Y.feature,te=w[y[W].source].getFeatureState(j.layer["source-layer"],j.id);j.source=j.layer.source,j.layer["source-layer"]&&(j.sourceLayer=j.layer["source-layer"]),j.state=te});return $}(this._layers,g,this.sourceCaches,t,n,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(h)}querySourceFeatures(t,n){n&&n.filter&&this._validate(c.x.filter,"querySourceFeatures.filter",n.filter,null,n);const o=this.sourceCaches[t];return o?function(a,h){const g=a.getRenderableIds().map(w=>a.getTileByID(w)),y=[],b={};for(let w=0;w<g.length;w++){const C=g[w],E=C.tileID.canonical.key;b[E]||(b[E]=!0,C.querySourceFeatures(y,h))}return y}(o,n):[]}getLight(){return this.light.getLight()}setLight(t,n={}){this._checkLoaded();const o=this.light.getLight();let a=!1;for(const g in t)if(!c.aF(t[g],o[g])){a=!0;break}if(!a)return;const h={now:le.now(),transition:c.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(t,n),this.light.updateTransitions(h)}getSky(){var t;return(t=this.stylesheet)===null||t===void 0?void 0:t.sky}setSky(t,n={}){const o=this.sky.getSky();let a=!1;t||o&&(a=!0);for(const g in t)if(!c.aF(t[g],o[g])){a=!0;break}if(!a)return;const h={now:le.now(),transition:c.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=t,this.sky.setSky(t,n),this.sky.updateTransitions(h)}_validate(t,n,o,a,h={}){return(!h||h.validate!==!1)&&us(this,t.call(c.x,c.e({key:n,style:this.serialize(),value:o,styleSpec:c.v},a)))}_remove(t=!0){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null),mr().off(ke,this._rtlPluginLoaded);for(const n in this._layers)this._layers[n].setEventedParent(null);for(const n in this.sourceCaches){const o=this.sourceCaches[n];o.setEventedParent(null),o.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),t&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(t)}_clearSource(t){this.sourceCaches[t].clearTiles()}_reloadSource(t){this.sourceCaches[t].resume(),this.sourceCaches[t].reload()}_updateSources(t){for(const 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,o,a,h=!1){let g=!1,y=!1;const b={};for(const w of this._order){const C=this._layers[w];if(C.type!=="symbol")continue;if(!b[C.source]){const R=this.sourceCaches[C.source];b[C.source]=R.getRenderableIds(!0).map(F=>R.getTileByID(F)).sort((F,$)=>$.tileID.overscaledZ-F.tileID.overscaledZ||(F.tileID.isLessThan($.tileID)?-1:1))}const E=this.crossTileSymbolIndex.addLayer(C,b[C.source],t.center.lng);g=g||E}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((h=h||this._layerOrderChanged||o===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(le.now(),t.zoom))&&(this.pauseablePlacement=new Yt(t,this.map.terrain,this._order,h,n,o,a,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,b),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(le.now()),y=!0),g&&this.pauseablePlacement.placement.setStale()),y||g)for(const w of this._order){const C=this._layers[w];C.type==="symbol"&&this.placement.updateLayerOpacities(C,b[C.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(le.now())}_releaseSymbolFadeTiles(){for(const t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()}getImages(t,n){return c._(this,void 0,void 0,function*(){const o=yield this.imageManager.getImages(n.icons);this._updateTilesForChangedImages();const a=this.sourceCaches[n.source];return a&&a.setDependencies(n.tileID.key,n.type,n.icons),o})}getGlyphs(t,n){return c._(this,void 0,void 0,function*(){const o=yield this.glyphManager.getGlyphs(n.stacks),a=this.sourceCaches[n.source];return a&&a.setDependencies(n.tileID.key,n.type,[""]),o})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(t,n={}){this._checkLoaded(),t&&this._validate(c.x.glyphs,"glyphs",t,null,n)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=t,this.glyphManager.entries={},this.glyphManager.setURL(t))}addSprite(t,n,o={},a){this._checkLoaded();const h=[{id:t,url:n}],g=[...bi(this.stylesheet.sprite),...h];this._validate(c.x.sprite,"sprite",g,null,o)||(this.stylesheet.sprite=g,this._loadSprite(h,!0,a))}removeSprite(t){this._checkLoaded();const n=bi(this.stylesheet.sprite);if(n.find(o=>o.id===t)){if(this._spritesImagesIds[t])for(const o of this._spritesImagesIds[t])this.imageManager.removeImage(o),this._changedImages[o]=!0;n.splice(n.findIndex(o=>o.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("SI",this._availableImages),this.fire(new c.k("data",{dataType:"style"}))}else this.fire(new c.j(new Error(`Sprite "${t}" doesn't exists on this map.`)))}getSprite(){return bi(this.stylesheet.sprite)}setSprite(t,n={},o){this._checkLoaded(),t&&this._validate(c.x.sprite,"sprite",t,null,n)||(this.stylesheet.sprite=t,t?this._loadSprite(t,!0,o):(this._unloadSprite(),o&&o(null)))}}var ds=c.Y([{name:"a_pos",type:"Int16",components:2}]);const Xr={prelude:xt(`#ifdef GL_ES
|
6
6
|
precision mediump float;
|
7
7
|
#else
|
8
8
|
#if !defined(lowp)
|
@@ -582,4 +582,4 @@ uniform ${C} ${E} u_${R};
|
|
582
582
|
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(v){return v instanceof this?v:new this(v)}static concat(v,...k){const P=new this(v);return k.forEach(L=>P.set(L)),P}static accessor(v){const P=(this[xu]=this[xu]={accessors:{}}).accessors,L=this.prototype;function Z(T){const c=jo(T);P[c]||(Wf(L,T),P[c]=!0)}return ge.isArray(v)?v.forEach(Z):Z(v),this}}Hi.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),ge.reduceDescriptors(Hi.prototype,({value:f},v)=>{let k=v[0].toUpperCase()+v.slice(1);return{get:()=>f,set(P){this[k]=P}}}),ge.freezeMethods(Hi);function Pc(f,v){const k=this||$o,P=v||k,L=Hi.from(P.headers);let Z=P.data;return ge.forEach(f,function(c){Z=c.call(k,Z,L.normalize(),v?v.status:void 0)}),L.normalize(),Z}function vu(f){return!!(f&&f.__CANCEL__)}function $s(f,v,k){ct.call(this,f??"canceled",ct.ERR_CANCELED,v,k),this.name="CanceledError"}ge.inherits($s,ct,{__CANCEL__:!0});function bu(f,v,k){const P=k.config.validateStatus;!k.status||!P||P(k.status)?f(k):v(new ct("Request failed with status code "+k.status,[ct.ERR_BAD_REQUEST,ct.ERR_BAD_RESPONSE][Math.floor(k.status/100)-4],k.config,k.request,k))}function Jf(f){const v=/^([-+\w]{1,25})(:?\/\/|:)/.exec(f);return v&&v[1]||""}function Kf(f,v){f=f||10;const k=new Array(f),P=new Array(f);let L=0,Z=0,T;return v=v!==void 0?v:1e3,function(fe){const me=Date.now(),ve=P[Z];T||(T=me),k[L]=fe,P[L]=me;let le=Z,oe=0;for(;le!==L;)oe+=k[le++],le=le%f;if(L=(L+1)%f,L===Z&&(Z=(Z+1)%f),me-T<v)return;const ht=ve&&me-ve;return ht?Math.round(oe*1e3/ht):void 0}}function Yf(f,v){let k=0,P=1e3/v,L,Z;const T=(me,ve=Date.now())=>{k=ve,L=null,Z&&(clearTimeout(Z),Z=null),f.apply(null,me)};return[(...me)=>{const ve=Date.now(),le=ve-k;le>=P?T(me,ve):(L=me,Z||(Z=setTimeout(()=>{Z=null,T(L)},P-le)))},()=>L&&T(L)]}const ul=(f,v,k=3)=>{let P=0;const L=Kf(50,250);return Yf(Z=>{const T=Z.loaded,c=Z.lengthComputable?Z.total:void 0,fe=T-P,me=L(fe),ve=T<=c;P=T;const le={loaded:T,total:c,progress:c?T/c:void 0,bytes:fe,rate:me||void 0,estimated:me&&c&&ve?(c-T)/me:void 0,event:Z,lengthComputable:c!=null,[v?"download":"upload"]:!0};f(le)},k)},wu=(f,v)=>{const k=f!=null;return[P=>v[0]({lengthComputable:k,total:f,loaded:P}),v[1]]},Su=f=>(...v)=>ge.asap(()=>f(...v)),Qf=Ir.hasStandardBrowserEnv?function(){const v=/(msie|trident)/i.test(navigator.userAgent),k=document.createElement("a");let P;function L(Z){let T=Z;return v&&(k.setAttribute("href",T),T=k.href),k.setAttribute("href",T),{href:k.href,protocol:k.protocol?k.protocol.replace(/:$/,""):"",host:k.host,search:k.search?k.search.replace(/^\?/,""):"",hash:k.hash?k.hash.replace(/^#/,""):"",hostname:k.hostname,port:k.port,pathname:k.pathname.charAt(0)==="/"?k.pathname:"/"+k.pathname}}return P=L(window.location.href),function(T){const c=ge.isString(T)?L(T):T;return c.protocol===P.protocol&&c.host===P.host}}():function(){return function(){return!0}}(),em=Ir.hasStandardBrowserEnv?{write(f,v,k,P,L,Z){const T=[f+"="+encodeURIComponent(v)];ge.isNumber(k)&&T.push("expires="+new Date(k).toGMTString()),ge.isString(P)&&T.push("path="+P),ge.isString(L)&&T.push("domain="+L),Z===!0&&T.push("secure"),document.cookie=T.join("; ")},read(f){const v=document.cookie.match(new RegExp("(^|;\\s*)("+f+")=([^;]*)"));return v?decodeURIComponent(v[3]):null},remove(f){this.write(f,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function tm(f){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(f)}function im(f,v){return v?f.replace(/\/?\/$/,"")+"/"+v.replace(/^\/+/,""):f}function Tu(f,v){return f&&!tm(v)?im(f,v):v}const ku=f=>f instanceof Hi?{...f}:f;function is(f,v){v=v||{};const k={};function P(me,ve,le){return ge.isPlainObject(me)&&ge.isPlainObject(ve)?ge.merge.call({caseless:le},me,ve):ge.isPlainObject(ve)?ge.merge({},ve):ge.isArray(ve)?ve.slice():ve}function L(me,ve,le){if(ge.isUndefined(ve)){if(!ge.isUndefined(me))return P(void 0,me,le)}else return P(me,ve,le)}function Z(me,ve){if(!ge.isUndefined(ve))return P(void 0,ve)}function T(me,ve){if(ge.isUndefined(ve)){if(!ge.isUndefined(me))return P(void 0,me)}else return P(void 0,ve)}function c(me,ve,le){if(le in v)return P(me,ve);if(le in f)return P(void 0,me)}const fe={url:Z,method:Z,data:Z,baseURL:T,transformRequest:T,transformResponse:T,paramsSerializer:T,timeout:T,timeoutMessage:T,withCredentials:T,withXSRFToken:T,adapter:T,responseType:T,xsrfCookieName:T,xsrfHeaderName:T,onUploadProgress:T,onDownloadProgress:T,decompress:T,maxContentLength:T,maxBodyLength:T,beforeRedirect:T,transport:T,httpAgent:T,httpsAgent:T,cancelToken:T,socketPath:T,responseEncoding:T,validateStatus:c,headers:(me,ve)=>L(ku(me),ku(ve),!0)};return ge.forEach(Object.keys(Object.assign({},f,v)),function(ve){const le=fe[ve]||L,oe=le(f[ve],v[ve],ve);ge.isUndefined(oe)&&le!==c||(k[ve]=oe)}),k}const Iu=f=>{const v=is({},f);let{data:k,withXSRFToken:P,xsrfHeaderName:L,xsrfCookieName:Z,headers:T,auth:c}=v;v.headers=T=Hi.from(T),v.url=mu(Tu(v.baseURL,v.url),f.params,f.paramsSerializer),c&&T.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):"")));let fe;if(ge.isFormData(k)){if(Ir.hasStandardBrowserEnv||Ir.hasStandardBrowserWebWorkerEnv)T.setContentType(void 0);else if((fe=T.getContentType())!==!1){const[me,...ve]=fe?fe.split(";").map(le=>le.trim()).filter(Boolean):[];T.setContentType([me||"multipart/form-data",...ve].join("; "))}}if(Ir.hasStandardBrowserEnv&&(P&&ge.isFunction(P)&&(P=P(v)),P||P!==!1&&Qf(v.url))){const me=L&&Z&&em.read(Z);me&&T.set(L,me)}return v},rm=typeof XMLHttpRequest<"u"&&function(f){return new Promise(function(k,P){const L=Iu(f);let Z=L.data;const T=Hi.from(L.headers).normalize();let{responseType:c,onUploadProgress:fe,onDownloadProgress:me}=L,ve,le,oe,ht,je;function Ke(){ht&&ht(),je&&je(),L.cancelToken&&L.cancelToken.unsubscribe(ve),L.signal&&L.signal.removeEventListener("abort",ve)}let Oe=new XMLHttpRequest;Oe.open(L.method.toUpperCase(),L.url,!0),Oe.timeout=L.timeout;function ft(){if(!Oe)return;const He=Hi.from("getAllResponseHeaders"in Oe&&Oe.getAllResponseHeaders()),wt={data:!c||c==="text"||c==="json"?Oe.responseText:Oe.response,status:Oe.status,statusText:Oe.statusText,headers:He,config:f,request:Oe};bu(function($t){k($t),Ke()},function($t){P($t),Ke()},wt),Oe=null}"onloadend"in Oe?Oe.onloadend=ft:Oe.onreadystatechange=function(){!Oe||Oe.readyState!==4||Oe.status===0&&!(Oe.responseURL&&Oe.responseURL.indexOf("file:")===0)||setTimeout(ft)},Oe.onabort=function(){Oe&&(P(new ct("Request aborted",ct.ECONNABORTED,f,Oe)),Oe=null)},Oe.onerror=function(){P(new ct("Network Error",ct.ERR_NETWORK,f,Oe)),Oe=null},Oe.ontimeout=function(){let Ft=L.timeout?"timeout of "+L.timeout+"ms exceeded":"timeout exceeded";const wt=L.transitional||_u;L.timeoutErrorMessage&&(Ft=L.timeoutErrorMessage),P(new ct(Ft,wt.clarifyTimeoutError?ct.ETIMEDOUT:ct.ECONNABORTED,f,Oe)),Oe=null},Z===void 0&&T.setContentType(null),"setRequestHeader"in Oe&&ge.forEach(T.toJSON(),function(Ft,wt){Oe.setRequestHeader(wt,Ft)}),ge.isUndefined(L.withCredentials)||(Oe.withCredentials=!!L.withCredentials),c&&c!=="json"&&(Oe.responseType=L.responseType),me&&([oe,je]=ul(me,!0),Oe.addEventListener("progress",oe)),fe&&Oe.upload&&([le,ht]=ul(fe),Oe.upload.addEventListener("progress",le),Oe.upload.addEventListener("loadend",ht)),(L.cancelToken||L.signal)&&(ve=He=>{Oe&&(P(!He||He.type?new $s(null,f,Oe):He),Oe.abort(),Oe=null)},L.cancelToken&&L.cancelToken.subscribe(ve),L.signal&&(L.signal.aborted?ve():L.signal.addEventListener("abort",ve)));const st=Jf(L.url);if(st&&Ir.protocols.indexOf(st)===-1){P(new ct("Unsupported protocol "+st+":",ct.ERR_BAD_REQUEST,f));return}Oe.send(Z||null)})},nm=(f,v)=>{let k=new AbortController,P;const L=function(fe){if(!P){P=!0,T();const me=fe instanceof Error?fe:this.reason;k.abort(me instanceof ct?me:new $s(me instanceof Error?me.message:me))}};let Z=v&&setTimeout(()=>{L(new ct(`timeout ${v} of ms exceeded`,ct.ETIMEDOUT))},v);const T=()=>{f&&(Z&&clearTimeout(Z),Z=null,f.forEach(fe=>{fe&&(fe.removeEventListener?fe.removeEventListener("abort",L):fe.unsubscribe(L))}),f=null)};f.forEach(fe=>fe&&fe.addEventListener&&fe.addEventListener("abort",L));const{signal:c}=k;return c.unsubscribe=T,[c,()=>{Z&&clearTimeout(Z),Z=null}]},sm=function*(f,v){let k=f.byteLength;if(!v||k<v){yield f;return}let P=0,L;for(;P<k;)L=P+v,yield f.slice(P,L),P=L},om=async function*(f,v,k){for await(const P of f)yield*sm(ArrayBuffer.isView(P)?P:await k(String(P)),v)},Cu=(f,v,k,P,L)=>{const Z=om(f,v,L);let T=0,c,fe=me=>{c||(c=!0,P&&P(me))};return new ReadableStream({async pull(me){try{const{done:ve,value:le}=await Z.next();if(ve){fe(),me.close();return}let oe=le.byteLength;if(k){let ht=T+=oe;k(ht)}me.enqueue(new Uint8Array(le))}catch(ve){throw fe(ve),ve}},cancel(me){return fe(me),Z.return()}},{highWaterMark:2})},dl=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Eu=dl&&typeof ReadableStream=="function",Ac=dl&&(typeof TextEncoder=="function"?(f=>v=>f.encode(v))(new TextEncoder):async f=>new Uint8Array(await new Response(f).arrayBuffer())),Pu=(f,...v)=>{try{return!!f(...v)}catch{return!1}},am=Eu&&Pu(()=>{let f=!1;const v=new Request(Ir.origin,{body:new ReadableStream,method:"POST",get duplex(){return f=!0,"half"}}).headers.has("Content-Type");return f&&!v}),Au=64*1024,Mc=Eu&&Pu(()=>ge.isReadableStream(new Response("").body)),pl={stream:Mc&&(f=>f.body)};dl&&(f=>{["text","arrayBuffer","blob","formData","stream"].forEach(v=>{!pl[v]&&(pl[v]=ge.isFunction(f[v])?k=>k[v]():(k,P)=>{throw new ct(`Response type '${v}' is not supported`,ct.ERR_NOT_SUPPORT,P)})})})(new Response);const lm=async f=>{if(f==null)return 0;if(ge.isBlob(f))return f.size;if(ge.isSpecCompliantForm(f))return(await new Request(f).arrayBuffer()).byteLength;if(ge.isArrayBufferView(f)||ge.isArrayBuffer(f))return f.byteLength;if(ge.isURLSearchParams(f)&&(f=f+""),ge.isString(f))return(await Ac(f)).byteLength},cm=async(f,v)=>{const k=ge.toFiniteNumber(f.getContentLength());return k??lm(v)},zc={http:zf,xhr:rm,fetch:dl&&(async f=>{let{url:v,method:k,data:P,signal:L,cancelToken:Z,timeout:T,onDownloadProgress:c,onUploadProgress:fe,responseType:me,headers:ve,withCredentials:le="same-origin",fetchOptions:oe}=Iu(f);me=me?(me+"").toLowerCase():"text";let[ht,je]=L||Z||T?nm([L,Z],T):[],Ke,Oe;const ft=()=>{!Ke&&setTimeout(()=>{ht&&ht.unsubscribe()}),Ke=!0};let st;try{if(fe&&am&&k!=="get"&&k!=="head"&&(st=await cm(ve,P))!==0){let Xt=new Request(v,{method:"POST",body:P,duplex:"half"}),$t;if(ge.isFormData(P)&&($t=Xt.headers.get("content-type"))&&ve.setContentType($t),Xt.body){const[Vr,bi]=wu(st,ul(Su(fe)));P=Cu(Xt.body,Au,Vr,bi,Ac)}}ge.isString(le)||(le=le?"include":"omit"),Oe=new Request(v,{...oe,signal:ht,method:k.toUpperCase(),headers:ve.normalize().toJSON(),body:P,duplex:"half",credentials:le});let He=await fetch(Oe);const Ft=Mc&&(me==="stream"||me==="response");if(Mc&&(c||Ft)){const Xt={};["status","statusText","headers"].forEach(Nr=>{Xt[Nr]=He[Nr]});const $t=ge.toFiniteNumber(He.headers.get("content-length")),[Vr,bi]=c&&wu($t,ul(Su(c),!0))||[];He=new Response(Cu(He.body,Au,Vr,()=>{bi&&bi(),Ft&&ft()},Ac),Xt)}me=me||"text";let wt=await pl[ge.findKey(pl,me)||"text"](He,f);return!Ft&&ft(),je&&je(),await new Promise((Xt,$t)=>{bu(Xt,$t,{data:wt,headers:Hi.from(He.headers),status:He.status,statusText:He.statusText,config:f,request:Oe})})}catch(He){throw ft(),He&&He.name==="TypeError"&&/fetch/i.test(He.message)?Object.assign(new ct("Network Error",ct.ERR_NETWORK,f,Oe),{cause:He.cause||He}):ct.from(He,He&&He.code,f,Oe)}})};ge.forEach(zc,(f,v)=>{if(f){try{Object.defineProperty(f,"name",{value:v})}catch{}Object.defineProperty(f,"adapterName",{value:v})}});const Mu=f=>`- ${f}`,hm=f=>ge.isFunction(f)||f===null||f===!1,zu={getAdapter:f=>{f=ge.isArray(f)?f:[f];const{length:v}=f;let k,P;const L={};for(let Z=0;Z<v;Z++){k=f[Z];let T;if(P=k,!hm(k)&&(P=zc[(T=String(k)).toLowerCase()],P===void 0))throw new ct(`Unknown adapter '${T}'`);if(P)break;L[T||"#"+Z]=P}if(!P){const Z=Object.entries(L).map(([c,fe])=>`adapter ${c} `+(fe===!1?"is not supported by the environment":"is not available in the build"));let T=v?Z.length>1?`since :
|
583
583
|
`+Z.map(Mu).join(`
|
584
584
|
`):" "+Mu(Z[0]):"as no adapter specified";throw new ct("There is no suitable adapter to dispatch the request "+T,"ERR_NOT_SUPPORT")}return P},adapters:zc};function Dc(f){if(f.cancelToken&&f.cancelToken.throwIfRequested(),f.signal&&f.signal.aborted)throw new $s(null,f)}function Du(f){return Dc(f),f.headers=Hi.from(f.headers),f.data=Pc.call(f,f.transformRequest),["post","put","patch"].indexOf(f.method)!==-1&&f.headers.setContentType("application/x-www-form-urlencoded",!1),zu.getAdapter(f.adapter||$o.adapter)(f).then(function(P){return Dc(f),P.data=Pc.call(f,f.transformResponse,P),P.headers=Hi.from(P.headers),P},function(P){return vu(P)||(Dc(f),P&&P.response&&(P.response.data=Pc.call(f,f.transformResponse,P.response),P.response.headers=Hi.from(P.response.headers))),Promise.reject(P)})}const Lu="1.7.4",Lc={};["object","boolean","number","function","string","symbol"].forEach((f,v)=>{Lc[f]=function(P){return typeof P===f||"a"+(v<1?"n ":" ")+f}});const Ru={};Lc.transitional=function(v,k,P){function L(Z,T){return"[Axios v"+Lu+"] Transitional option '"+Z+"'"+T+(P?". "+P:"")}return(Z,T,c)=>{if(v===!1)throw new ct(L(T," has been removed"+(k?" in "+k:"")),ct.ERR_DEPRECATED);return k&&!Ru[T]&&(Ru[T]=!0,console.warn(L(T," has been deprecated since v"+k+" and will be removed in the near future"))),v?v(Z,T,c):!0}};function um(f,v,k){if(typeof f!="object")throw new ct("options must be an object",ct.ERR_BAD_OPTION_VALUE);const P=Object.keys(f);let L=P.length;for(;L-- >0;){const Z=P[L],T=v[Z];if(T){const c=f[Z],fe=c===void 0||T(c,Z,f);if(fe!==!0)throw new ct("option "+Z+" must be "+fe,ct.ERR_BAD_OPTION_VALUE);continue}if(k!==!0)throw new ct("Unknown option "+Z,ct.ERR_BAD_OPTION)}}const Rc={assertOptions:um,validators:Lc},Cn=Rc.validators;class rs{constructor(v){this.defaults=v,this.interceptors={request:new gu,response:new gu}}async request(v,k){try{return await this._request(v,k)}catch(P){if(P instanceof Error){let L;Error.captureStackTrace?Error.captureStackTrace(L={}):L=new Error;const Z=L.stack?L.stack.replace(/^.+\n/,""):"";try{P.stack?Z&&!String(P.stack).endsWith(Z.replace(/^.+\n.+\n/,""))&&(P.stack+=`
|
585
|
-
`+Z):P.stack=Z}catch{}}throw P}}_request(v,k){typeof v=="string"?(k=k||{},k.url=v):k=v||{},k=is(this.defaults,k);const{transitional:P,paramsSerializer:L,headers:Z}=k;P!==void 0&&Rc.assertOptions(P,{silentJSONParsing:Cn.transitional(Cn.boolean),forcedJSONParsing:Cn.transitional(Cn.boolean),clarifyTimeoutError:Cn.transitional(Cn.boolean)},!1),L!=null&&(ge.isFunction(L)?k.paramsSerializer={serialize:L}:Rc.assertOptions(L,{encode:Cn.function,serialize:Cn.function},!0)),k.method=(k.method||this.defaults.method||"get").toLowerCase();let T=Z&&ge.merge(Z.common,Z[k.method]);Z&&ge.forEach(["delete","get","head","post","put","patch","common"],je=>{delete Z[je]}),k.headers=Hi.concat(T,Z);const c=[];let fe=!0;this.interceptors.request.forEach(function(Ke){typeof Ke.runWhen=="function"&&Ke.runWhen(k)===!1||(fe=fe&&Ke.synchronous,c.unshift(Ke.fulfilled,Ke.rejected))});const me=[];this.interceptors.response.forEach(function(Ke){me.push(Ke.fulfilled,Ke.rejected)});let ve,le=0,oe;if(!fe){const je=[Du.bind(this),void 0];for(je.unshift.apply(je,c),je.push.apply(je,me),oe=je.length,ve=Promise.resolve(k);le<oe;)ve=ve.then(je[le++],je[le++]);return ve}oe=c.length;let ht=k;for(le=0;le<oe;){const je=c[le++],Ke=c[le++];try{ht=je(ht)}catch(Oe){Ke.call(this,Oe);break}}try{ve=Du.call(this,ht)}catch(je){return Promise.reject(je)}for(le=0,oe=me.length;le<oe;)ve=ve.then(me[le++],me[le++]);return ve}getUri(v){v=is(this.defaults,v);const k=Tu(v.baseURL,v.url);return mu(k,v.params,v.paramsSerializer)}}ge.forEach(["delete","get","head","options"],function(v){rs.prototype[v]=function(k,P){return this.request(is(P||{},{method:v,url:k,data:(P||{}).data}))}}),ge.forEach(["post","put","patch"],function(v){function k(P){return function(Z,T,c){return this.request(is(c||{},{method:v,headers:P?{"Content-Type":"multipart/form-data"}:{},url:Z,data:T}))}}rs.prototype[v]=k(),rs.prototype[v+"Form"]=k(!0)});class Bc{constructor(v){if(typeof v!="function")throw new TypeError("executor must be a function.");let k;this.promise=new Promise(function(Z){k=Z});const P=this;this.promise.then(L=>{if(!P._listeners)return;let Z=P._listeners.length;for(;Z-- >0;)P._listeners[Z](L);P._listeners=null}),this.promise.then=L=>{let Z;const T=new Promise(c=>{P.subscribe(c),Z=c}).then(L);return T.cancel=function(){P.unsubscribe(Z)},T},v(function(Z,T,c){P.reason||(P.reason=new $s(Z,T,c),k(P.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(v){if(this.reason){v(this.reason);return}this._listeners?this._listeners.push(v):this._listeners=[v]}unsubscribe(v){if(!this._listeners)return;const k=this._listeners.indexOf(v);k!==-1&&this._listeners.splice(k,1)}static source(){let v;return{token:new Bc(function(L){v=L}),cancel:v}}}function dm(f){return function(k){return f.apply(null,k)}}function pm(f){return ge.isObject(f)&&f.isAxiosError===!0}const Fc={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Fc).forEach(([f,v])=>{Fc[v]=f});function Bu(f){const v=new rs(f),k=Qh(rs.prototype.request,v);return ge.extend(k,rs.prototype,v,{allOwnKeys:!0}),ge.extend(k,v,null,{allOwnKeys:!0}),k.create=function(L){return Bu(is(f,L))},k}const Zt=Bu($o);Zt.Axios=rs,Zt.CanceledError=$s,Zt.CancelToken=Bc,Zt.isCancel=vu,Zt.VERSION=Lu,Zt.toFormData=cl,Zt.AxiosError=ct,Zt.Cancel=Zt.CanceledError,Zt.all=function(v){return Promise.all(v)},Zt.spread=dm,Zt.isAxiosError=pm,Zt.mergeConfig=is,Zt.AxiosHeaders=Hi,Zt.formToJSON=f=>yu(ge.isHTMLForm(f)?new FormData(f):f),Zt.getAdapter=zu.getAdapter,Zt.HttpStatusCode=Fc,Zt.default=Zt;const fm=(f,v=300)=>{let k;return function(...L){clearTimeout(k),k=setTimeout(()=>{f.apply(this,L)},v)}};function fl(f,v,k={}){const P={type:"Feature"};return(k.id===0||k.id)&&(P.id=k.id),k.bbox&&(P.bbox=k.bbox),P.properties=v||{},P.geometry=f,P}function Fu(f,v,k={}){if(!f)throw new Error("coordinates is required");if(!Array.isArray(f))throw new Error("coordinates must be an Array");if(f.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!$u(f[0])||!$u(f[1]))throw new Error("coordinates must contain numbers");return fl({type:"Point",coordinates:f},v,k)}function Ou(f,v,k={}){for(const L of f){if(L.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(L[L.length-1].length!==L[0].length)throw new Error("First and last Position are not equivalent.");for(let Z=0;Z<L[L.length-1].length;Z++)if(L[L.length-1][Z]!==L[0][Z])throw new Error("First and last Position are not equivalent.")}return fl({type:"Polygon",coordinates:f},v,k)}function Vu(f,v,k={}){return fl({type:"MultiPoint",coordinates:f},v,k)}function Nu(f,v,k={}){return fl({type:"MultiPolygon",coordinates:f},v,k)}function $u(f){return!isNaN(f)&&f!==null&&!Array.isArray(f)}function Oc(f,v,k){if(f!==null)for(var P,L,Z,T,c,fe,me,ve=0,le=0,oe,ht=f.type,je=ht==="FeatureCollection",Ke=ht==="Feature",Oe=je?f.features.length:1,ft=0;ft<Oe;ft++){me=je?f.features[ft].geometry:Ke?f.geometry:f,oe=me?me.type==="GeometryCollection":!1,c=oe?me.geometries.length:1;for(var st=0;st<c;st++){var He=0,Ft=0;if(T=oe?me.geometries[st]:me,T!==null){fe=T.coordinates;var wt=T.type;switch(ve=k&&(wt==="Polygon"||wt==="MultiPolygon")?1:0,wt){case null:break;case"Point":if(v(fe,le,ft,He,Ft)===!1)return!1;le++,He++;break;case"LineString":case"MultiPoint":for(P=0;P<fe.length;P++){if(v(fe[P],le,ft,He,Ft)===!1)return!1;le++,wt==="MultiPoint"&&He++}wt==="LineString"&&He++;break;case"Polygon":case"MultiLineString":for(P=0;P<fe.length;P++){for(L=0;L<fe[P].length-ve;L++){if(v(fe[P][L],le,ft,He,Ft)===!1)return!1;le++}wt==="MultiLineString"&&He++,wt==="Polygon"&&Ft++}wt==="Polygon"&&He++;break;case"MultiPolygon":for(P=0;P<fe.length;P++){for(Ft=0,L=0;L<fe[P].length;L++){for(Z=0;Z<fe[P][L].length-ve;Z++){if(v(fe[P][L][Z],le,ft,He,Ft)===!1)return!1;le++}Ft++}He++}break;case"GeometryCollection":for(P=0;P<T.geometries.length;P++)if(Oc(T.geometries[P],v,k)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function ju(f,v={}){if(f.bbox!=null&&v.recompute!==!0)return f.bbox;const k=[1/0,1/0,-1/0,-1/0];return Oc(f,P=>{k[0]>P[0]&&(k[0]=P[0]),k[1]>P[1]&&(k[1]=P[1]),k[2]<P[0]&&(k[2]=P[0]),k[3]<P[1]&&(k[3]=P[1])}),k}function Uu(f,v={}){const k=ju(f),P=(k[0]+k[2])/2,L=(k[1]+k[3])/2;return Fu([P,L],v.properties,v)}function mm(f,v={}){let k=0,P=0,L=0;return Oc(f,function(Z){k+=Z[0],P+=Z[1],L++},!0),Fu([k/L,P/L],v.properties)}const gm={mixins:[Oo],props:{map:{type:Object},baseLayers:{type:Array,default:[{id:"orto10",name:"Ortophoto 1:10К",url:"https://data.gki.com.ua/api-user/rtile/orto10/ua/{z}/{x}/{y}.png",service:"TMS",category:"Національна інфраструктура геопросторових даних",scale:1e4,year:2020,bounds:"ua",maxzoom:18,owner:"НДІГК (Інститут геодезії та картографії)",image:"https://data.gki.com.ua/api-user/rtile/orto10/ua/13/4954/2876.png",basemap:!0},{id:"graymap",name:"Сіра карта",url:"https://basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png",service:"TMS",category:"Базові карти",attribution:"© <a href='http://www.openstreetmap.org/copyright'>OpenStreetMap</a>, © <a href='https://carto.com/attributions'>CARTO</a>",bounds1:"ua",image:"https://basemaps.cartocdn.com/light_all/10/601/348.png",position:0,owner:"OSM",basemap:!0},{id:"darkmap_carto",name:"Темна карта України",image:"https://basemaps.cartocdn.com/dark_all/13/4791/2762.png?ver=2023-04-14",url:"https://basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png",service:"TMS",category:"Базові карти",active:!1}]},selectedLayer:{type:String,required:!0}},watch:{map(f){f&&f.on("load",this.handleMapLoad)}},methods:{handleMapLoad(){var f;this.baseLayers.forEach(v=>{this.layerList.push(v)}),this.toggleLayerVisibility((f=this.baseLayers[0])==null?void 0:f.id)},toggleLayerVisibility(f){this.$emit("update:selectedLayer",f),this.changeBaseLayer(f)}}},_m={class:"vs-map-slot-layers z-10 select-none"},ym=["onClick"],xm=["src"];function vm(f,v,k,P,L,Z){return N.openBlock(),N.createElementBlock("div",_m,[(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(k.baseLayers,(T,c)=>(N.openBlock(),N.createElementBlock("div",{key:T.id,class:N.normalizeClass(["vs-map-slot-layers__layer relative",{focused:T.id==k.selectedLayer}]),onClick:fe=>Z.toggleLayerVisibility(T.id)},[N.createElementVNode("img",{src:T.image,class:"vs-map-slot-layers__image"},null,8,xm),N.createElementVNode("div",{class:N.normalizeClass(["absolute py-2 px-4 text-sm text-stone-800 bg-white shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-lg top-[-46px] text-nowrap p-2 hidden whitespace-nowrap",[c===0?"left-[-10px]":"left-[50%] translate-x-[-50%]"]])},N.toDisplayString(T==null?void 0:T.name),3)],10,ym))),128))])}const bm=Fi(gm,[["render",vm],["__scopeId","data-v-8959e540"]]),wm={},Sm={class:"shrink-0 size-3",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},Tm=[N.createElementVNode("path",{d:"M18 6 6 18"},null,-1),N.createElementVNode("path",{d:"m6 6 12 12"},null,-1)];function km(f,v){return N.openBlock(),N.createElementBlock("svg",Sm,Tm)}const ml=Fi(wm,[["render",km]]),Im={},Cm={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Em=[N.createElementVNode("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),N.createElementVNode("path",{d:"M2 17L12 22L22 17",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),N.createElementVNode("path",{d:"M2 12L12 17L22 12",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)];function Pm(f,v){return N.openBlock(),N.createElementBlock("svg",Cm,Em)}const Am={components:{closeIcon:ml,layersIcon:Fi(Im,[["render",Pm]])},mixins:[Oo],props:{layers:{type:Array,default:()=>[]},map:{type:Object,default:null},basemapIds:{type:Array,default:()=>[]}},data(){return{isOpen:!1,selectedLayers:[],mounted:!1}},mounted(){this.mounted=!0},methods:{async handleLayerChange(f,v){await this.setVisible(f,v),v&&this.map.getStyle().layers.filter(L=>!this.basemapIds.includes(L.id)&&L.id!==f.id).map(L=>L.id).forEach(L=>{this.map.getLayer(L)&&this.map.moveLayer(L)})}}},Mm=f=>(N.pushScopeId("data-v-4c33eaa0"),f=f(),N.popScopeId(),f),zm={class:"p-[10px]"},Dm={class:"select-none absolute left-[20px] top-[10px] border bg-white max-w-[250px] p-[10px] rounded-lg z-10"},Lm={class:"flex justify-between items-center border-b pb-[8px] text-[16px]"},Rm=Mm(()=>N.createElementVNode("span",null,"Додаткові шари",-1)),Bm={class:"mt-2 max-h-[300px] overflow-auto [&::-webkit-scrollbar]:h-1.5 [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-gray-300 [&::-webkit-scrollbar-track]:bg-transparent"},Fm=["id","value","onChange"],Om=["for"];function Vm(f,v,k,P,L,Z){const T=N.resolveComponent("layersIcon"),c=N.resolveComponent("VsPopover"),fe=N.resolveComponent("closeIcon");return N.openBlock(),N.createElementBlock(N.Fragment,null,[!L.isOpen&&L.mounted?(N.openBlock(),N.createBlock(c,{key:0,teleport:"body",trigger:"hover",placement:"right",class:"select-none flex absolute left-[20px] top-[10px] border bg-white max-w-[250px] rounded-lg cursor-pointer z-10",onClick:v[0]||(v[0]=me=>L.isOpen=!L.isOpen)},{reference:N.withCtx(()=>[N.createElementVNode("div",zm,[N.createVNode(T,{class:"h-5 w-5"})])]),default:N.withCtx(()=>[N.createTextVNode(" Додаткові шари ")]),_:1})):N.createCommentVNode("",!0),N.withDirectives(N.createElementVNode("div",Dm,[N.createElementVNode("div",Lm,[Rm,L.mounted?(N.openBlock(),N.createBlock(c,{key:0,teleport:"body",trigger:"hover",placement:"bottom",class:"flex"},{reference:N.withCtx(()=>[N.createElementVNode("button",{type:"button",class:"size-6 inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:text-neutral-400 dark:focus:bg-neutral-600",onClick:v[1]||(v[1]=me=>L.isOpen=!L.isOpen)},[N.createVNode(fe)])]),default:N.withCtx(()=>[N.createTextVNode(" Приховати панель ")]),_:1})):N.createCommentVNode("",!0)]),N.withDirectives(N.createElementVNode("div",Bm,[(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(k.layers,me=>(N.openBlock(),N.createElementBlock("div",{key:me.id,class:"flex items-center gap-2 text-sm"},[N.createElementVNode("input",{type:"checkbox",id:`layer-${me.id}`,value:me.id,class:"cursor-pointer",onChange:ve=>Z.handleLayerChange(me,ve.target.checked)},null,40,Fm),N.createElementVNode("label",{for:`layer-${me.id}`,class:"cursor-pointer"},N.toDisplayString(me.name),9,Om)]))),128))],512),[[N.vShow,L.isOpen]])],512),[[N.vShow,L.isOpen]])],64)}const Nm=Fi(Am,[["render",Vm],["__scopeId","data-v-4c33eaa0"]]),$m={mixins:[Oo],components:{closeIcon:ml},props:{map:{type:Object,required:!0},compareLayers:{type:Array,default:()=>[]},table:{type:String,default:""}},mounted(){var f,v;this.currentLayer=((v=(f=this.compareLayers)==null?void 0:f[0])==null?void 0:v.id)||null,this.mounted=!0},data(){return{mounted:!1,currentLayer:null}},watch:{async currentLayer(f,v){const k=this.compareLayers.find(L=>L.id===v),P=this.compareLayers.find(L=>L.id===f);k&&await this.setVisible(k,!1,this.map),P&&await this.setVisible(P,!0,this.map),this.map.getStyle().layers.forEach(L=>{L.source===this.table&&this.map.getLayer(L.id)&&this.map.moveLayer(L.id)})}}},jm={class:"absolute w-full top-[10px] right-[50px] shadow-sm bg-white max-w-[250px] p-[10px] rounded-lg z-10 select-none border"},Um={class:"flex items-start justify-between pb-1 border-b"},qm=N.createElementVNode("div",{class:"text-[16px] max-w-[180px]"}," Базові шари порівняльної карти ",-1),Zm={class:"pt-1 max-h-[300px] overflow-auto [&::-webkit-scrollbar]:h-1.5 [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-gray-300 [&::-webkit-scrollbar-track]:bg-transparent"},Gm=["id","name","value"],Hm=["for"];function Xm(f,v,k,P,L,Z){const T=N.resolveComponent("closeIcon"),c=N.resolveComponent("VsPopover");return N.openBlock(),N.createElementBlock("div",jm,[N.createElementVNode("div",Um,[qm,L.mounted?(N.openBlock(),N.createBlock(c,{key:0,trigger:"hover",placement:"bottom",teleport:"body"},{reference:N.withCtx(()=>[N.createElementVNode("button",{type:"button",class:"size-6 inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:text-neutral-400 dark:focus:bg-neutral-600",onClick:v[0]||(v[0]=fe=>f.$emit("close"))},[N.createVNode(T,{class:"cursor-pointer"})])]),default:N.withCtx(()=>[N.createTextVNode(" Приховати панель ")]),_:1})):N.createCommentVNode("",!0)]),N.createElementVNode("div",Zm,[(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(k.compareLayers,fe=>(N.openBlock(),N.createElementBlock("div",{key:fe.id,class:"flex items-center py-1"},[N.withDirectives(N.createElementVNode("input",{type:"radio",id:fe.id,name:fe.id,value:fe.id,"onUpdate:modelValue":v[1]||(v[1]=me=>L.currentLayer=me),class:"shrink-0 border-gray-200 rounded-full text-blue-600 focus:ring-blue-500 checked:border-blue-500 dark:bg-neutral-800 dark:border-neutral-700 dark:checked:bg-blue-500 dark:checked:border-blue-500 dark:focus:ring-offset-gray-800"},null,8,Gm),[[N.vModelRadio,L.currentLayer]]),N.createElementVNode("label",{for:fe.id,class:"text-[14px] ml-2 cursor-pointer"},N.toDisplayString(fe.name),9,Hm)]))),128))])])}const Wm=Fi($m,[["render",Xm]]),Jm={},Km={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Ym=[N.createElementVNode("path",{d:"M18 8L22 12L18 16",stroke:"#333333","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),N.createElementVNode("path",{d:"M6 8L2 12L6 16",stroke:"#333333","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),N.createElementVNode("path",{d:"M2 12H22",stroke:"#333333","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)];function Qm(f,v,k,P,L,Z){return N.openBlock(),N.createElementBlock("svg",Km,Ym)}const eg={components:{closeIcon:ml,compareIcon:Fi(Jm,[["render",Qm]]),CompareBaseLayers:Wm},props:{map:{type:Object},compareLayers:{type:Array},table:{type:String}},data(){return{isOpen:!1,mounted:!1,afterMap:null,compare:null,isOpen:!1,afterMapLoaded:!1}},mounted(){this.mounted=!0,window.maplibregl=In,this.loadScripts()},computed:{modalButtonClasses(){return{"!bg-[#F2F2F2]":this.isOpen,"bg-white":!this.isOpen}}},methods:{loadScripts(){const f=document.createElement("link");f.setAttribute("rel","stylesheet"),f.setAttribute("href","https://cdn.jsdelivr.net/npm/@maplibre/maplibre-gl-compare@0.5.0/dist/maplibre-gl-compare.min.css"),document.head.appendChild(f);const v=document.createElement("script");v.setAttribute("src","https://cdn.jsdelivr.net/npm/@maplibre/maplibre-gl-compare@0.5.0/dist/maplibre-gl-compare.min.js"),document.head.appendChild(v)},initCompare(){const f=this.map,v={version:8,glyphs:"https://fonts.openmaptiles.org/{fontstack}/{range}.pbf",sources:{},layers:[]},k=new In.Map({container:"after",style:v,center:f.getCenter(),zoom:f.getZoom(),minZoom:f.getMinZoom()});if(k.addControl(new In.NavigationControl({visualizePitch:!0})),k.on("load",()=>{this.afterMapLoaded=!0,this.syncLayers()}),this.afterMap=k,window.maplibregl&&window.maplibregl.Compare){const P="#comparison-container";this.compare=new window.maplibregl.Compare(f,k,P,{mousemove:!1})}else console.error("Compare is not available on window.maplibregl")},destroyCompare(){this.compare&&(this.compare.remove(),this.compare=null),this.afterMap&&(this.afterMap.remove(),this.afterMap=null),this.isOpen=!1,this.afterMapLoaded=!1},toggleCompare(){this.isOpen=!this.isOpen,this.isOpen?this.$nextTick(()=>{this.initCompare(),this.resizeMaps()}):this.destroyCompare()},resizeMaps(){this.map.resize(),this.afterMap&&this.afterMap.resize()},syncLayers(){if(!this.map||!this.afterMap)return;const f=this.map,v=this.afterMap;f.getSource(this.table)&&(v.getSource(this.table)||v.addSource(this.table,f.getStyle().sources[this.table]));const P=f.getStyle().layers.filter(L=>L.source===this.table);P.length&&P.forEach(L=>{v.getLayer(L.id)||v.addLayer(L)})}}},tg={class:"w-[29px] h-[29px] flex items-center justify-center"},ig={key:2,id:"comparison-container",class:"absolute top-0 right-0 w-full h-full"},rg=[N.createElementVNode("div",{id:"after",class:"map-compare"},null,-1)];function ng(f,v,k,P,L,Z){const T=N.resolveComponent("compareIcon"),c=N.resolveComponent("VsPopover"),fe=N.resolveComponent("CompareBaseLayers");return N.openBlock(),N.createElementBlock(N.Fragment,null,[L.mounted?(N.openBlock(),N.createBlock(c,{key:0,teleport:"body",trigger:"hover",placement:"left",class:N.normalizeClass(["flex absolute right-[10px] top-[120px] bg-white max-w-[250px] rounded-lg cursor-pointer z-10",Z.modalButtonClasses]),onClick:Z.toggleCompare,style:{"box-shadow":"0 0 0 2px rgba(0, 0, 0, 0.2)"}},{reference:N.withCtx(()=>[N.createElementVNode("div",tg,[N.createVNode(T,{class:"w-4 h-4"})])]),default:N.withCtx(()=>[N.createTextVNode(" Порівняти шари ")]),_:1},8,["class","onClick"])):N.createCommentVNode("",!0),L.isOpen&&L.afterMapLoaded?(N.openBlock(),N.createBlock(fe,{key:1,table:k.table,map:L.afterMap,compareLayers:k.compareLayers,onClose:Z.destroyCompare},null,8,["table","map","compareLayers","onClose"])):N.createCommentVNode("",!0),L.isOpen?(N.openBlock(),N.createElementBlock("div",ig,rg)):N.createCommentVNode("",!0)],64)}const sg=Fi(eg,[["render",ng]]),og={props:["colors","strokes","title"],methods:{capitalizeFirstLetter(f){return f?f.charAt(0).toUpperCase()+f.slice(1):""}}},ag={class:"absolute left-[20px] bottom-[74px] bg-white max-w-[250px] p-[10px] rounded-lg z-10 border"},lg={key:0,class:"mb-[10px] text-[1rem]"},cg={key:1},hg={class:"legend-item flex items-center gap-2"},ug={class:"ml-1 text-[0.875rem]"},dg={class:"legend-item"},pg={key:0,class:"flex justify-start items-center gap-2"},fg={class:"ml-1 text-[0.875rem]"};function mg(f,v,k,P,L,Z){var T;return N.openBlock(),N.createElementBlock("div",ag,[k.title?(N.openBlock(),N.createElementBlock("div",lg,N.toDisplayString(k.title),1)):N.createCommentVNode("",!0),(T=k.strokes)!=null&&T.length?(N.openBlock(),N.createElementBlock("div",cg,[(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(k.strokes,c=>(N.openBlock(),N.createElementBlock("div",hg,[N.createElementVNode("div",{class:"w-[15px] h-[4px]",style:N.normalizeStyle({background:`repeating-linear-gradient(to right, ${c.color}, ${c.color} 5px, transparent 5px, transparent 8px)`})},null,4),N.createElementVNode("div",ug,N.toDisplayString(Z.capitalizeFirstLetter(c.text)),1)]))),256))])):N.createCommentVNode("",!0),(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(k.colors,c=>(N.openBlock(),N.createElementBlock("div",dg,[c.id>0?(N.openBlock(),N.createElementBlock("div",pg,[N.createElementVNode("div",{class:"w-[15px] h-[15px] rounded-[50%] min-w-[15px]",style:N.normalizeStyle({backgroundColor:c.color})},null,4),N.createElementVNode("div",fg,N.toDisplayString(Z.capitalizeFirstLetter(c.text)),1)])):N.createCommentVNode("",!0)]))),256))])}const gg={components:{MapSlotLayers:bm,MapLegend:Fi(og,[["render",mg]]),AdditionalLayers:Nm,MapCompare:sg},props:{colorAttr:null,strokeAttr:null,zoom:{type:Array,default:()=>8},defaultColor:{type:String,default:"blue"},selectedBaseLayer:{type:String,required:!0},legendname:{type:String,default:()=>""},height:{type:String,default:()=>"100vh"},width:{type:String,default:"100vw"},center:{type:Array,default:[32,49]},maxBounds:{type:Array,default:[[22,44],[40,52]]},table:{type:String,default:""},zoom:{type:[String,Number],default:13},minZoom:{type:[String,Number],default:1},basemap:Array,additionalLayers:Array,filtersParam:{type:String,default:""},row:{type:Object,default:{}},pointZoom:{type:String,default:"12"},legend:{type:Boolean,default:()=>!0},compareLayers:{type:Array,default:()=>[]}},mixins:[Oo],data(){return{map:null,hoverObject:null,popup:null,colors:[]}},async mounted(){var f,v,k,P;try{if(await this.createMap(),(f=this.row)!=null&&f.geom){const{type:L,coordinates:Z}=this.row.geom;let T;switch(L){case"Polygon":T=Ou(Z);break;case"MultiPolygon":T=Nu(Z);break;case"MultiPoint":T=Vu(Z);break;default:(v=this.map)==null||v.fitBounds([Z,Z],{maxZoom:this.zoom,padding:30}),this.isSelectObj=!0;return}const c=Uu(T).geometry.coordinates;(k=this.map)==null||k.fitBounds([c,c],{maxZoom:this.zoom,padding:30})}(P=this.map)==null||P.fitBounds(this.center)}catch{}},watch:{filtersParam(f){this.setFilter(this.table,f)},selectedBaseLayer(f){this.$emit("update:selectedBaseLayer",f)}},computed:{basemapIds(){return this.basemap.map(f=>f==null?void 0:f.id)},allLayers(){return[...this.basemap||[],...this.additionalLayers||[],...this.compareLayers||[]]}},methods:{async getColorStyle(){var f=[["#69D2E7","#A7DBD8","#E0E4CC","#F38630","#FA6900"],["#FE4365","#FC9D9A","#F9CDAD","#C8C8A9","#83AF9B"],["#ECD078","#D95B43","#C02942","#542437","#53777A"]];if(!this.colorAttr)return this.defaultColor;try{const{data:{rows:v}}=await Zt.get(`/api/data/${this.table}/${this.colorAttr}`),k=v.reduce((P,L,Z)=>L!=null&&L.id?[...P,L.id.toString(),L.color||f[0][Z%5]]:P,["match",["get",this.colorAttr]]);return this.colors=[...v],k.push("gray"),k}catch(v){console.log(v)}},async getStrokeStyle(){if(!this.strokeAttr)return"transparent";try{const{data:{rows:f}}=await Zt.get(`/api/data/${this.table}/${this.strokeAttr}`),v=f.reduce((k,P,L)=>P!=null&&P.id?[...k,{id:P.id.toString(),color:P.color||"#000000",dash:P.dash||[2,2],text:P.text||P.id.toString()}]:k,[]);return this.strokes=[...v],["match",["get",this.strokeAttr],...v.flatMap(({id:k,color:P})=>[k,P]),"transparent"]}catch(f){return console.log(f),"transparent"}},async handleMapLoad(){var P,L;this.$emit("map",this.map);const f=await this.getStrokeStyle(),v=await this.getColorStyle(),k=((L=(P=location.search.split("&").find(Z=>Z.includes("filter=")))==null?void 0:P.split("filter="))==null?void 0:L[1])||"";await this.addLayer({id:this.table,service:"vector",url:`/api/vtile/${this.table}/ua/{z}/{x}/{y}.vmt?pointZoom=${this.pointZoom}&dt=${new Date().toISOString()}&filter=${k}`,layers:[{type:"fill","source-layer":this.table,paint:{"fill-color":v,"fill-opacity":.3,"fill-outline-color":["case",["==",["feature-state","hover"],!0],"red","#000000"]},filter:["all",["==",["geometry-type"],"Polygon"]]},{type:"circle","source-layer":this.table,filter:["all",["==",["geometry-type"],"Point"]],paint:{"circle-radius":{base:1.75,stops:[[10,5],[12,6],[18,12]]},"circle-stroke-color":["case",["==",["feature-state","hover"],!0],"red","#ccc"],"circle-stroke-width":["case",["==",["feature-state","hover"],!0],2,1],"circle-color":v}},{id:`${this.table}-stroke`,type:"line","source-layer":this.table,filter:["all",["==",["geometry-type"],"Polygon"]],paint:{"line-color":f,"line-width":2.5,"line-dasharray":[2,2]}}]})},async createMap(){const f={version:8,glyphs:"https://cdn.softpro.ua/data/fonts/{fontstack}/{range}.pbf",sources:{},layers:[]};this.map=await new In.Map({container:"maplibre-map",style:f,zoom:this.zoom,center:this.center,minZoom:this.minZoom}),this.$parent.map=this.map,this.map.addControl(new In.NavigationControl({visualizePitch:!0})),this.map.on("load",this.handleMapLoad)}}},_g={class:"vs-map-portal relative z-1 mt-2",id:"mapwrapper"};function yg(f,v,k,P,L,Z){var ve;const T=N.resolveComponent("MapLegend"),c=N.resolveComponent("MapSlotLayers"),fe=N.resolveComponent("MapCompare"),me=N.resolveComponent("AdditionalLayers");return N.openBlock(),N.createElementBlock("div",_g,[N.createElementVNode("div",{id:"maplibre-map",ref:"maplibreMap",class:"w-full",style:N.normalizeStyle({height:k.height})},null,4),N.withDirectives(N.createVNode(T,{colors:L.colors,title:k.legendname},null,8,["colors","title"]),[[N.vShow,k.legend]]),N.createVNode(c,{map:L.map,baseLayers:k.basemap,selectedLayer:k.selectedBaseLayer,"onUpdate:selectedLayer":v[0]||(v[0]=le=>f.$emit("update:selectedBaseLayer",le))},null,8,["map","baseLayers","selectedLayer"]),N.createVNode(fe,{map:L.map,compareLayers:Z.allLayers,table:k.table},null,8,["map","compareLayers","table"]),(ve=k.additionalLayers)!=null&&ve.length?(N.openBlock(),N.createBlock(me,{key:0,map:L.map,layers:k.additionalLayers,basemapIds:Z.basemapIds},null,8,["map","layers","basemapIds"])):N.createCommentVNode("",!0)])}const xg=Fi(gg,[["render",yg]]),vg={},bg={class:"flex-shrink-0 size-3.5",xmlns:"http://www.w3.org/2000/svg",width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},wg=[N.createStaticVNode('<line x1="21" x2="14" y1="4" y2="4"></line><line x1="10" x2="3" y1="4" y2="4"></line><line x1="21" x2="12" y1="12" y2="12"></line><line x1="8" x2="3" y1="12" y2="12"></line><line x1="21" x2="16" y1="20" y2="20"></line><line x1="12" x2="3" y1="20" y2="20"></line><line x1="14" x2="14" y1="2" y2="6"></line><line x1="8" x2="8" y1="10" y2="14"></line><line x1="16" x2="16" y1="18" y2="22"></line>',9)];function Sg(f,v){return N.openBlock(),N.createElementBlock("svg",bg,wg)}const Tg=Fi(vg,[["render",Sg]]),kg={},Ig={xmlns:"http://www.w3.org/2000/svg",width:"21",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-layout-sidebar-right-collapse"},Cg=[N.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),N.createElementVNode("path",{d:"M4 4m0 2a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2z"},null,-1),N.createElementVNode("path",{d:"M15 4v16"},null,-1),N.createElementVNode("path",{d:"M9 10l2 2l-2 2"},null,-1)];function Eg(f,v){return N.openBlock(),N.createElementBlock("svg",Ig,Cg)}const Pg=Fi(kg,[["render",Eg]]),Ag={},Mg={xmlns:"http://www.w3.org/2000/svg",width:"21",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-layout-sidebar-right-expand"},zg=[N.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),N.createElementVNode("path",{d:"M4 4m0 2a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2z"},null,-1),N.createElementVNode("path",{d:"M15 4v16"},null,-1),N.createElementVNode("path",{d:"M10 10l-2 2l2 2"},null,-1)];function Dg(f,v){return N.openBlock(),N.createElementBlock("svg",Mg,zg)}const Lg=Fi(Ag,[["render",Dg]]),Rg={props:{visible:{type:Boolean,default:()=>!1},title:{type:String,default:()=>""},size:{type:String,default:()=>""}},emits:["update:visible","onClose"],name:"vs-dialog",mounted(){window.addEventListener("keydown",this.checkKey)},unmounted(){window.removeEventListener("keydown",this.checkKey)},computed:{hasSlot(){var f;return!!((f=this.$slots)!=null&&f.footer)},checkSize(){return this.size==="small"?"w-5/12":this.size==="medium"?"w-6/12":"lg:w-7/12 w-11/12"}},methods:{checkKey({key:f}){f==="Escape"&&this.handleClose()},handleClose(){this.$emit("update:visible",!1),this.$emit("onClose")}}},qu=f=>(N.pushScopeId("data-v-37405773"),f=f(),N.popScopeId(),f),Bg={class:"vsTailwind ui-dialog__wrapper"},Fg={class:"w-full h-full fixed top-0 start-0 z-[80] bg-black bg-opacity-50"},Og={class:"py-2.5 px-4 flex justify-between items-center border-b"},Vg={class:"font-medium text-gray-800"},Ng=[qu(()=>N.createElementVNode("span",{class:"sr-only"},"Close",-1)),qu(()=>N.createElementVNode("svg",{class:"flex-shrink-0 w-4 h-4",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[N.createElementVNode("path",{d:"M18 6 6 18"}),N.createElementVNode("path",{d:"m6 6 12 12"})],-1))],$g={class:"ui-dialog__content p-4"},jg={key:0,class:"flex justify-end gap-x-2"};function Ug(f,v,k,P,L,Z){return N.openBlock(),N.createBlock(N.Teleport,{to:"#modal"},[N.createVNode(N.Transition,{name:"fade"},{default:N.withCtx(()=>[N.withDirectives(N.createElementVNode("div",Bg,[N.createElementVNode("div",Fg,[N.createVNode(N.Transition,{name:"content",appear:""},{default:N.withCtx(()=>[N.createElementVNode("div",{class:N.normalizeClass(["ui-dialog__modal opacity-1 transition-all flex flex-col bg-white border pointer-events-auto shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-xl",[Z.checkSize]])},[N.createElementVNode("div",Og,[N.createElementVNode("h3",Vg,N.toDisplayString(k.title),1),N.createElementVNode("button",{type:"button",class:"size-8 inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:text-neutral-400 dark:focus:bg-neutral-600",onClick:v[0]||(v[0]=(...T)=>Z.handleClose&&Z.handleClose(...T))},Ng)]),N.createElementVNode("div",$g,[N.renderSlot(f.$slots,"default",{},void 0,!0)]),Z.hasSlot?(N.openBlock(),N.createElementBlock("div",jg,[N.renderSlot(f.$slots,"footer",{},void 0,!0)])):N.createCommentVNode("",!0)],2)]),_:3})])],512),[[N.vShow,k.visible]])]),_:3})])}const qg=Fi(Rg,[["render",Ug],["__scopeId","data-v-37405773"]]),Zg=N.defineComponent({props:{title:{type:String,default:()=>""},table:{type:String,default:()=>""},rows:{type:Object,default:()=>null},initTotal:{type:[Number,String],default:()=>""},colorAttr:{type:String,default:()=>""},strokeAttr:{type:String,default:()=>""},legendname:{type:String,default:()=>""},center:{type:Array},maxBounds:{type:Array,default:()=>[[22,44.4],[40,52.5]]},id:{type:String,default:()=>""},isAutocomplete:{type:Boolean,default:()=>!1},isAddressAutocomplete:{type:Boolean,default:()=>!1},zoom:{type:[Number,String],default:()=>"13"},minZoom:{type:[Number,String],default:()=>"1"},maskForSearch:{type:String,default:()=>null},searchShow:{type:Boolean,default:()=>!0},basemap:{type:Array},additionalLayers:{type:Array},pointZoom:{type:String,default:()=>"12"},legend:{type:Boolean,default:()=>!0},defaultColor:{type:String,default:()=>"blue"},compareLayers:{type:Array,default:()=>[]}},mixins:[Oo],components:{MapPortal:xg,NoData:Zp,FilterIcon:Tg,VisibleMapIcon:Pg,HiddenMapIcon:Lg,CloseIcon:ml,VsDialog:qg},data(){return{filters:"",search:"",limit:20,polyline:null,filtersParam:"",isSelectObj:!1,selectedId:"",searchRegion:"",searchAddress:"",map:null,selectedBaseLayer:"",marker:null,selectedRow:null,activeFilters:"",isMapVisible:!0,tabsIsVisible:!1,filterUrl:"",currentPage:1,regionOptionGeneral:null,isFilterVisible:!1,tableData:null,hoverData:null,atuData:[],map:null,legendName:null,total:null,filtered:null,filterValues:"",activeFiltersCount:"",visibleTrue:!0,regionSelectValue:null,addressSelectValue:null,currentBbox:null,mountedFilter:{},optionRowsCount:[{value:10,label:"10"},{value:20,label:"20"},{value:30,label:"30"}],handleDebouncedUpdateValue:fm(f=>{this.handleSearchValue(f)},300)}},watch:{map(){this.map.on("mousemove",this.handleMapHover),this.map.on("click",this.handleMapClick),this.$emit("update:map",this.map)},activeFiltersCount(){var f,v;return(v=(f=this.$refs)==null?void 0:f.filter)==null?void 0:v.filteredActiveFiltersLength},activeFilters(){var f,v;return this.isSelectObj&&this.moveToDefaultPage(),(v=(f=this.$refs)==null?void 0:f.filter)==null?void 0:v.activeFilters},isFilterVisible(f){f||this.getData()},async regionSelectValue(f,v){var L,Z;if(!this.regionSelectValue){this.map.removeSource("region-search-id");return}f&&this.selectedId&&this.closeObjCard(),this.polyline=this.regionSelectValue.encoded_geom,this.getData();const k=((L=this.regionSelectValue)==null?void 0:L.geom)||Tr.toGeoJSON(this.regionSelectValue.encoded_geom),P=this.map.getSource("region-search-id");if(this.currentBbox=ju(k),P)P.setData({type:"Feature",geometry:k});else{this.map.addSource("region-search-id",{type:"geojson",data:{type:"Feature",geometry:k}});const T={id:"region-search-id",type:"line",source:"region-search-id",paint:{"line-color":"blue","line-opacity":1}};await this.map.addLayer(T)}this.moveLayer("site.prc.parcel_object.table"),(Z=this.map)==null||Z.fitBounds(this.currentBbox,{zoom:this.setAtuZoom,padding:20}),this.getData()},async addressSelectValue(f,v){this.addressSelectValue&&(f&&this.selectedId&&this.closeObjCard(),this.getData())}},created(){this.legendName,this.tableData=this.rows,this.total=this.initTotal,this.id&&(this.selectedRow=this.rows[0],this.selectedId=this.id,this.isSelectObj=!0)},mounted(){this.rows||this.getData();const v=new URLSearchParams(window.location.search).get("filter"),k=v==null?void 0:v.split("|");k==null||k.forEach(L=>{const[Z,T]=L.split("=");T!=null&&T.includes(",")?this.mountedFilter[Z]=T==null?void 0:T.split(","):this.mountedFilter[Z]=T});const P=new URLSearchParams(window.location.search);this.currentPage=P.get("page")||1,this.getFilter()},updated(){this.checkFilterLength()},computed:{setAtuZoom(){var f,v,k;return((f=this.regionSelectValue)==null?void 0:f.id)==="UA80000000000093317"||((v=this.regionSelectValue)==null?void 0:v.id)==="UA85000000000065278"?10:((k=this.regionSelectValue)==null?void 0:k.region)===""?7.5:11}},methods:{async getData(){try{const f={search:this.search||null,limit:this.limit,page:this.currentPage,polyline:this.polyline};f.filter=this.filtersParam;const{data:v}=await Zt.get(`/api/data/${this.table}`,{params:f});this.tableData=v==null?void 0:v.rows,this.total=v.filtered,this.filtered=v.filtered}catch(f){console.error(f.message)}},moveToDefaultPage(){var P;const f=new URLSearchParams(window.location.search);f.delete("id");const k=`${window.location.pathname}?${f.toString()}`;(P=this.map)==null||P.fitBounds(this.maxBounds,{}),window.history.pushState({},"",k),this.isSelectObj=!1},regionFullName(f){return f.region?`${f.text} / ${f.region}`:f.text},getLabelById(f){const v=this.filters.find(k=>k.id===f);return v?v.label:f},getOptionsLabelById(f,v){if(Array.isArray(v)){const k=this.filters.find(P=>P.id===f);return k!=null&&k.options?k==null?void 0:k.options.filter(P=>v.includes(P.id)).map(P=>P.text).join(", "):v==null?void 0:v.length}else return v},async clearFilter(f){var v,k;(k=(v=this.$refs)==null?void 0:v.filter)==null||k.clearFilter(f),await this.updateTableAndMap(),await this.getData()},handlePageChange(f){this.currentPage=f;const v=new URL(window.location.href),k=new URLSearchParams(window.location.search);k.set("page",f),v.search=decodeURI(k.toString()),window.history.pushState({},"",v),this.getData()},async getFilter(){var f;try{const{data:v}=await Zt.get(`/api/filter/${this.table}`);this.filters=(f=v==null?void 0:v.list)==null?void 0:f.map(k=>({...k,label:(k==null?void 0:k.label)||(k==null?void 0:k.ua),id:(k==null?void 0:k.id)||(k==null?void 0:k.name)}))}catch(v){console.error(v.message)}},async handleSearchValue(f){this.search=f,await this.getData()},closeObjCard(){var P;const f=new URLSearchParams(window.location.search);f.delete("id"),this.deletePulsePoint(),this.deleteHighlighPolygon();const k=`${window.location.pathname}?${f.toString()}`;(this.currentBbox||this.center)&&((P=this.map)==null||P.fitBounds(this.currentBbox||[this.center,this.center],{maxZoom:this.zoom})),window.history.pushState({},"",k),this.isSelectObj=!1,this.selectedRow=null,this.getData()},async handleSearchRegionValue(f){var k;const v=this.map.getLayer("region-search-id");this.searchRegion=f,f===""&&v?((k=this.map)==null||k.fitBounds(this.maxBounds,{}),this.currentBbox=null,this.polyline=null,this.map.removeLayer("region-search-id"),this.getData()):f===""&&this.getData()},async handleSearchAddressValue(f){var k;const v=this.map.getLayer("address-search-id");this.searchAddress=f,f===""&&v?((k=this.map)==null||k.fitBounds(this.maxBounds,{}),this.currentBbox=null,this.polyline=null,this.map.removeLayer("address-search-id"),this.getData()):f===""&&this.getData()},handleFilterChange(f){this.$emit("update:filterState",f),this.currentPage=f.state.page||1,this.filterUrl=f.url==="no-url"?null:f.url.split("|").filter(v=>!v.includes("page=")).join("|")},async updateTableAndMap(){var f,v;this.selectedRow||(this.filtersParam=this.filterUrl,this.activeFilters=(v=(f=this.$refs)==null?void 0:f.filter)==null?void 0:v.activeFilters,this.isFilterVisible=!1,this.getData())},handleFilterSubmit(){var f;this.isSelectObj="",this.selectedId="",this.selectedId=!1,(f=this.map)==null||f.fitBounds(this.maxBounds,{}),this.isFilterVisible=!1},toggleMapVisible(){this.isMapVisible=!this.isMapVisible},checkUrl(f=!0){const v=new URLSearchParams(window.location.search);v.has("id")?(this.isSelectObj=!0,this.isMapVisible=f,this.selectedId=v.get("id")):(this.isSelectObj=!1,this.selectedId="")},changeLimit(f){this.limit=f,this.currentPage=1,this.getData()},filterModalClose(){this.isFilterVisible=!1},resetFilters(){this.$refs.filter&&(this.$refs.filter.clearAll(),this.search="",this.isFilterVisible=!1,this.filtersParam="",this.polyline=null,this.regionSelectValue=null,this.addressSelectValue=null,this.currentBbox=null,this.activeFilters=null,this.tabsIsVisible=!1,this.handleSearchRegionValue(""),this.handleSearchAddressValue(""))},checkFilterLength(){var v,k;const f=(k=(v=this.$refs)==null?void 0:v.filter)==null?void 0:k.filteredActiveFiltersLength;f!==this.previousLength&&(this.previousLength=f,this.activeFiltersCount=f)},async handleMapClick(f){var Z,T,c,fe,me,ve,le,oe;const v=this.map.queryRenderedFeatures(f.point);if((v==null?void 0:v.length)<1)return;const k=window.location.pathname,P=new URLSearchParams(window.location.search);P.set("id",`${(Z=v[0])==null?void 0:Z.properties.id}`),this.getObjectData((c=(T=v[0])==null?void 0:T.properties)==null?void 0:c.id);const L=`${k}?${P.toString()}`;window.history.pushState({},"",L),this.isSelectObj=!0,f.lngLat&&((oe=this.map)==null||oe.fitBounds([[(fe=f.lngLat)==null?void 0:fe.lng,(me=f.lngLat)==null?void 0:me.lat],[(ve=f.lngLat)==null?void 0:ve.lng,(le=f.lngLat)==null?void 0:le.lat]],{padding:30})),this.checkUrl()},async getObjectData(f){var v,k;try{const{data:P}=await Zt.get(`/api/data/${this.table}/${f}`);this.selectRow((v=P==null?void 0:P.rows)==null?void 0:v[0]),((k=P==null?void 0:P.rows)==null?void 0:k.lenght)<1&&this.deletePulsePoint()}catch(P){console.error(P.message)}},async selectRow(f,v=!0){var c,fe,me;this.isMapVisible=v;const P=await(await fetch(`/api/data/${this.table}/${f.id}`)).json();this.selectedRow=((c=P==null?void 0:P.rows)==null?void 0:c[0])||f;const L=window.location.pathname,Z=new URLSearchParams(window.location.search);Z.set("id",`${f.id}`);const T=`${L}?${Z.toString()}`;if(window.history.pushState({},"",T),this.checkUrl(v),f!=null&&f.geom){const{type:ve,coordinates:le}=f.geom;let oe;switch(ve){case"Polygon":oe=Ou(le);break;case"MultiPolygon":oe=Nu(le);break;case"MultiPoint":oe=Vu(le);break;default:(fe=this.map)==null||fe.fitBounds([le,le],{maxZoom:15,padding:30}),this.isSelectObj=!0;return}const ht=Uu(oe).geometry.coordinates;(me=this.map)==null||me.fitBounds([ht,ht],{maxZoom:15,padding:30})}this.isSelectObj=!0},deletePulsePoint(){this.marker&&this.marker.remove()},addPulsePoint(f){this.deletePulsePoint();const v=document.createElement("div");v.className="gps-marker",v.style.width="10px",v.style.height="10px",v.style.position="relative";const k=document.createElement("div");k.className="gps-wave",v.appendChild(k),this.marker=new In.Marker({element:v,anchor:"center"}).setLngLat(f).addTo(this.map)},deleteHighlighPolygon(){var f,v,k;(f=this.map)!=null&&f.getLayer("highlighted-polygon")&&((v=this.map)==null||v.removeLayer("highlighted-polygon"),(k=this.map)==null||k.removeSource("highlighted-polygon"))},highlightPolygon(f){var v,k,P,L,Z,T;this.deletePulsePoint(),this.deleteHighlighPolygon(),(L=this.map)==null||L.addSource("highlighted-polygon",{type:"geojson",data:{geometry:{type:(v=f==null?void 0:f.geom)==null?void 0:v.type,coordinates:(k=f==null?void 0:f.geom)==null?void 0:k.coordinates},type:"Feature",properties:{id:f==null?void 0:f.id,name:f==null?void 0:f.name,category:f==null?void 0:f.id},id:f==null?void 0:f.id,layer:{id:"site.rest_zone.table-0",type:"fill",source:"site.rest_zone.table",sourceLayer:"site.rest_zone.table",filter:["all",["==",["geometry-type"],(P=f==null?void 0:f.geom)==null?void 0:P.type]],paint:{"fill-color":"orange","fill-opacity":.5},layout:{}},source:"site.rest_zone.table",sourceLayer:"site.rest_zone.table",state:{hover:!0},table:"site.rest_zone.table"}}),(Z=this.map)==null||Z.addLayer({id:"highlighted-polygon",type:"fill",source:"highlighted-polygon",layout:{},minzoom:12,maxzoom:0,paint:{"fill-color":"orange","fill-opacity":.6}}),(T=this.map)==null||T.moveLayer("highlighted-polygon")},async handleMapHover(f){var L,Z,T;this.hoverObject&&(this.map.setFeatureState(this.hoverObject,{hover:!1}),this.hoverObject=null),this.popup||(this.popup=new In.Popup({maxWidth:"400px",closeButton:!1,closeOnClick:!1}));const v=this.map.queryRenderedFeatures(f.point);if(this.map.getCanvas().style.cursor="pointer",!(v!=null&&v.length)||((L=v==null?void 0:v[0])==null?void 0:L.source)==="region-search-id"){this.map.getCanvas().style.cursor="",this.popup.remove();return}const k=v[0].geometry.coordinates.slice();v[0].source==="highlighted-polygon"&&v[1]?this.hoverData=(Z=v[1])==null?void 0:Z.properties:this.hoverData=(T=v[0])==null?void 0:T.properties;const P={source:v[0].source,sourceLayer:v[0].sourceLayer,id:v[0].id};if(P.source!=="region-search-id"){for(this.map.setFeatureState(P,{hover:!0}),this.hoverObject=P;Math.abs(f.lngLat.lng-k[0])>180;)k[0]+=f.lngLat.lng>k[0]?360:-360;this.popup.setLngLat(f.lngLat).setHTML(this.$refs.popup.innerHTML).addTo(this.map)}},removeSelectedBaseLayer(){this.selectedBaseLayer=""},addGeomMarker(f){if(!this.map){console.error("Map instance is not available");return}this.marker&&this.marker.remove();let v;f.type==="Point"?v=f.coordinates:v=mm(f).geometry.coordinates,this.marker=new In.Marker({color:"red"}).setLngLat(v).addTo(this.map)}}}),Gg={class:"ml-3 pt-[20px]"},Hg={class:"w-full gap-5 flex justify-between mb-[6px] pr-3"},Xg={class:"flex items-center gap-2 max-h-[38px] pt-[4px]"},Wg={class:"custom-filter-list"},Jg={key:0,class:"font-medium text-[10px] min-w-[16px] py-0.5 px-[5px] bg-gray-800 text-white leading-3 rounded-full"},Kg=["title"],Yg=N.createElementVNode("span",{class:"sr-only"},"Відкрити мапу",-1),Qg={class:"flex"},e_={class:"py-[15px] pb-[24px] pl-2"},t_={class:"font-bold text-2xl mr-[10px]"},i_={class:"text-sm text-stone-500 font-medium"},r_=N.createElementVNode("span",{class:"text-sm text-stone-500 font-medium"}," об'єктів",-1),n_={class:"wrapperTable flex flex-col",style:{height:"calc(100vh - 302px)"}},s_={key:0,class:"flex gap-x-2 flex-wrap"},o_={class:"font-medium"},a_=N.createElementVNode("span",{class:"h-3 mx-2 border-s border-gray-200"},null,-1),l_={class:"text-gray-500"},c_=["onClick"],h_={key:0,class:"mb-[10px] py-1 ps-3 pe-1 inline-flex items-center bg-white border border-gray-200 text-gray-800 text-xs rounded-full"},u_=N.createElementVNode("span",{class:"font-medium"}," Очистити ",-1),d_={key:2,class:"text-center py-28"},p_=N.createElementVNode("h2",{class:"font-medium text-base text-gray-500 rounded-xl"}," За вашим запитом даних не знайдено! ",-1),f_=N.createElementVNode("p",{class:"font-normal text-sm text-gray-500 rounded-xl"}," Введіть, будь ласка, інші значення для пошуку. ",-1),m_={key:0},g_={key:1,class:"my-5 pr-2"},__={class:"flex justify-between"},y_={class:"w-2/4"},x_={class:"map-section relative"},v_={ref:"popup",style:{display:"none"}};function b_(f,v,k,P,L,Z){var Oe,ft;const T=N.resolveComponent("VsTextMask"),c=N.resolveComponent("vs-text"),fe=N.resolveComponent("FilterIcon"),me=N.resolveComponent("VsFilterList"),ve=N.resolveComponent("VisibleMapIcon"),le=N.resolveComponent("HiddenMapIcon"),oe=N.resolveComponent("CloseIcon"),ht=N.resolveComponent("NoData"),je=N.resolveComponent("VsPagination"),Ke=N.resolveComponent("MapPortal");return N.openBlock(),N.createElementBlock("section",Gg,[N.createElementVNode("div",null,[N.createElementVNode("div",Hg,[N.createElementVNode("div",Xg,[f.maskForSearch?(N.openBlock(),N.createBlock(T,{key:0,"model-value":f.search,"onUpdate:modelValue":f.handleDebouncedUpdateValue,class:"w-full table-interface-search",placeholder:"Пошук",mask:f.maskForSearch,icon:"search",iconPosition:"left",clearable:"",style:{height:"38px","min-width":"300px","max-width":"300px"},ref:"searchInput"},null,8,["model-value","onUpdate:modelValue","mask"])):f.searchShow?(N.openBlock(),N.createBlock(c,{key:1,"model-value":f.search,"onUpdate:modelValue":f.handleDebouncedUpdateValue,class:"[&>input]:py-[7px] [&>input]:max-h-[38px] [&>input]:w-[220px] [&>input]:ps-10 [&>input]:pe-8 [&>input]:block [&>input]:w-full [&>input]:bg-gray-100 [&>input]:border-transparent [&>input]:rounded-lg [&>input]:text-sm [&>input]:focus:bg-white [&>input]:focus:border-blue-500 [&>input]:focus:ring-blue-500 [&>input]:disabled:opacity-50 [&>input]:disabled:pointer-events-none [&>input]:dark:bg-neutral-700 [&>input]:dark:border-transparent [&>input]:dark:text-neutral-400 [&>input]:dark:placeholder:text-neutral-400 dark:focus:bg-neutral-800 dark:focus:ring-neutral-600",placeholder:"Пошук",icon:"search","icon-position":"left",clearable:"",style:{height:"38px"},ref:"searchInput"},null,8,["model-value","onUpdate:modelValue"])):N.createCommentVNode("",!0),N.createElementVNode("div",Wg,[f.filters?(N.openBlock(),N.createBlock(me,{key:0,ref:"filter",modelValue:f.mountedFilter,"onUpdate:modelValue":v[0]||(v[0]=st=>f.mountedFilter=st),scheme:f.filters,isDialog:(Oe=f.filters)==null?void 0:Oe.some(st=>!(st!=null&&st.inline)),"apply-vue-router":"",history:"",view:"plain",clearable:!1,name:"filter",onFilterChange:v[1]||(v[1]=async st=>{await f.handleFilterChange(st),await f.updateTableAndMap()})},{button:N.withCtx(({visible:st})=>[N.createElementVNode("button",{type:"button",class:N.normalizeClass(["py-2 px-2.5 h-[40px] inline-flex items-center gap-x-1.5 text-sm font-medium rounded-lg bg-white text-gray-800 hover:bg-gray-50 focus:outline-none focus:bg-gray-50",[st?"border border-blue-600 border-2":"border border-gray-200"]])},[N.createVNode(fe),N.createTextVNode(" Фільтри "),f.activeFiltersCount>=1?(N.openBlock(),N.createElementBlock("span",Jg,N.toDisplayString(f.activeFiltersCount),1)):N.createCommentVNode("",!0)],2)]),_:1},8,["modelValue","scheme","isDialog"])):N.createCommentVNode("",!0)])]),N.createElementVNode("button",{type:"button",class:"py-2 px-2 inline-flex items-center gap-x-1.5 text-sm rounded-lg border border-gray-200 bg-white text-gray-600 shadow-sm hover:bg-stone-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-100",title:f.isMapVisible?"Приховати карту":"Показати карту",onClick:v[2]||(v[2]=(...st)=>f.toggleMapVisible&&f.toggleMapVisible(...st))},[f.isMapVisible?(N.openBlock(),N.createBlock(ve,{key:0})):(N.openBlock(),N.createBlock(le,{key:1})),Yg],8,Kg)]),N.createElementVNode("div",Qg,[N.createElementVNode("div",{class:N.normalizeClass(["relative overflow-hidden",f.isMapVisible?"w-2/4 mr-0":"w-full mr-3",f.isSelectObj?"hidden":""])},[N.createElementVNode("h1",e_,[N.createElementVNode("span",t_,N.toDisplayString(f.title),1),N.createElementVNode("span",i_,N.toDisplayString(f.total),1),r_]),N.createElementVNode("div",n_,[f.activeFilters?(N.openBlock(),N.createElementBlock("div",s_,[(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(f.activeFilters,(st,He,Ft)=>(N.openBlock(),N.createElementBlock("span",{class:"mb-[10px] py-1 ps-3 pe-1 inline-flex items-center bg-white border border-gray-200 text-gray-800 text-xs rounded-full",key:Ft},[N.createElementVNode("span",o_,N.toDisplayString(f.getLabelById(He)),1),a_,N.createElementVNode("span",l_,N.toDisplayString(f.getOptionsLabelById(He,st)),1),N.createElementVNode("button",{type:"button",class:"inline-flex shrink-0 justify-center items-center size-5 ms-1 rounded-full text-gray-600 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 text-sm",onClick:wt=>f.clearFilter(He)},[N.createVNode(oe)],8,c_)]))),128)),((ft=Object.keys(f.activeFilters))==null?void 0:ft.length)>=2?(N.openBlock(),N.createElementBlock("span",h_,[u_,N.createElementVNode("button",{type:"button",class:"inline-flex shrink-0 justify-center items-center size-5 ms-1 rounded-full text-gray-600 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 text-sm",onClick:v[3]||(v[3]=st=>f.mountedFilter={})},[N.createVNode(oe)])])):N.createCommentVNode("",!0)])):N.createCommentVNode("",!0),f.total>=1?N.renderSlot(f.$slots,"table",{key:1,rows:f.tableData,map:f.map,marker:f.marker,selectRow:f.selectRow,getData:f.getData,addGeomMarker:f.addGeomMarker,isMapVisible:f.isMapVisible}):(N.openBlock(),N.createElementBlock("div",d_,[N.createVNode(ht),p_,f_,N.createElementVNode("button",{type:"button",class:"mt-[10px] py-2 px-2.5 inline-flex items-center gap-x-1.5 text-xs rounded-lg border border-stone-200 bg-white text-stone-800 shadow-sm hover:bg-stone-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-stone-100",onClick:v[4]||(v[4]=(...st)=>f.resetFilters&&f.resetFilters(...st))}," Очистити дані пошуку ")]))]),f.total>=1?(N.openBlock(),N.createElementBlock("hr",m_)):N.createCommentVNode("",!0),f.total>=1?(N.openBlock(),N.createElementBlock("div",g_,[N.createElementVNode("div",__,[N.createVNode(je,{total:f.total,maxPages:7,defaultPage:f.currentPage,pageSize:f.limit,goTo:!1,size:"medium",onPageChange:f.handlePageChange,backgroundColor:"#e5e7eb",borderedCellSelected:!0,pageSizes:[10,20,30],onPageSizeChange:f.changeLimit},null,8,["total","defaultPage","pageSize","onPageChange","onPageSizeChange"])])])):N.createCommentVNode("",!0)],2),f.isSelectObj?(N.openBlock(),N.createElementBlock("div",{key:0,class:N.normalizeClass(f.isMapVisible?"w-2/4 mr-0 pb-5":"w-full pb-5 mr-3"),style:{height:"calc(100vh - 152px)"}},[N.renderSlot(f.$slots,"details",{table:f.table,selectedId:f.selectedId,selectedRow:f.selectedRow,map:f.map,closeObjCard:f.closeObjCard,isMapVisible:f.isMapVisible})],2)):N.createCommentVNode("",!0),N.withDirectives(N.createElementVNode("div",y_,[N.createElementVNode("section",x_,[N.renderSlot(f.$slots,"default",{map:f.map,removeSelectedBaseLayer:f.removeSelectedBaseLayer,selectedBaseLayer:f.selectedBaseLayer}),N.createVNode(Ke,{height:"calc(100vh - 152px)",width:"w-2/4",table:f.table,filtersParam:f.filtersParam,row:f.selectedRow,legendname:f.legendname,legend:f.legend,compareLayers:f.compareLayers,colorAttr:f.colorAttr,strokeAttr:f.strokeAttr,maxBounds:f.maxBounds,center:f.center,zoom:f.zoom,minZoom:f.minZoom,basemap:f.basemap,additionalLayers:f.additionalLayers,pointZoom:f.pointZoom,defaultColor:f.defaultColor,onMap:v[5]||(v[5]=st=>f.map=st),selectedBaseLayer:f.selectedBaseLayer,"onUpdate:selectedBaseLayer":v[6]||(v[6]=st=>f.selectedBaseLayer=st)},null,8,["table","filtersParam","row","legendname","legend","compareLayers","colorAttr","strokeAttr","maxBounds","center","zoom","minZoom","basemap","additionalLayers","pointZoom","defaultColor","selectedBaseLayer"])])],512),[[N.vShow,f.isMapVisible]])]),N.createElementVNode("div",v_,[N.renderSlot(f.$slots,"popup",{data:f.hoverData})],512)])])}const Zu=Fi(Zg,[["render",b_]]),Gu={install:f=>{f.component("VsPartsMap",Zu)},components:{VsPartsMap:Zu}};return typeof window<"u"&&(window.PartsMap=Gu),Gu});
|
585
|
+
`+Z):P.stack=Z}catch{}}throw P}}_request(v,k){typeof v=="string"?(k=k||{},k.url=v):k=v||{},k=is(this.defaults,k);const{transitional:P,paramsSerializer:L,headers:Z}=k;P!==void 0&&Rc.assertOptions(P,{silentJSONParsing:Cn.transitional(Cn.boolean),forcedJSONParsing:Cn.transitional(Cn.boolean),clarifyTimeoutError:Cn.transitional(Cn.boolean)},!1),L!=null&&(ge.isFunction(L)?k.paramsSerializer={serialize:L}:Rc.assertOptions(L,{encode:Cn.function,serialize:Cn.function},!0)),k.method=(k.method||this.defaults.method||"get").toLowerCase();let T=Z&&ge.merge(Z.common,Z[k.method]);Z&&ge.forEach(["delete","get","head","post","put","patch","common"],je=>{delete Z[je]}),k.headers=Hi.concat(T,Z);const c=[];let fe=!0;this.interceptors.request.forEach(function(Ke){typeof Ke.runWhen=="function"&&Ke.runWhen(k)===!1||(fe=fe&&Ke.synchronous,c.unshift(Ke.fulfilled,Ke.rejected))});const me=[];this.interceptors.response.forEach(function(Ke){me.push(Ke.fulfilled,Ke.rejected)});let ve,le=0,oe;if(!fe){const je=[Du.bind(this),void 0];for(je.unshift.apply(je,c),je.push.apply(je,me),oe=je.length,ve=Promise.resolve(k);le<oe;)ve=ve.then(je[le++],je[le++]);return ve}oe=c.length;let ht=k;for(le=0;le<oe;){const je=c[le++],Ke=c[le++];try{ht=je(ht)}catch(Oe){Ke.call(this,Oe);break}}try{ve=Du.call(this,ht)}catch(je){return Promise.reject(je)}for(le=0,oe=me.length;le<oe;)ve=ve.then(me[le++],me[le++]);return ve}getUri(v){v=is(this.defaults,v);const k=Tu(v.baseURL,v.url);return mu(k,v.params,v.paramsSerializer)}}ge.forEach(["delete","get","head","options"],function(v){rs.prototype[v]=function(k,P){return this.request(is(P||{},{method:v,url:k,data:(P||{}).data}))}}),ge.forEach(["post","put","patch"],function(v){function k(P){return function(Z,T,c){return this.request(is(c||{},{method:v,headers:P?{"Content-Type":"multipart/form-data"}:{},url:Z,data:T}))}}rs.prototype[v]=k(),rs.prototype[v+"Form"]=k(!0)});class Bc{constructor(v){if(typeof v!="function")throw new TypeError("executor must be a function.");let k;this.promise=new Promise(function(Z){k=Z});const P=this;this.promise.then(L=>{if(!P._listeners)return;let Z=P._listeners.length;for(;Z-- >0;)P._listeners[Z](L);P._listeners=null}),this.promise.then=L=>{let Z;const T=new Promise(c=>{P.subscribe(c),Z=c}).then(L);return T.cancel=function(){P.unsubscribe(Z)},T},v(function(Z,T,c){P.reason||(P.reason=new $s(Z,T,c),k(P.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(v){if(this.reason){v(this.reason);return}this._listeners?this._listeners.push(v):this._listeners=[v]}unsubscribe(v){if(!this._listeners)return;const k=this._listeners.indexOf(v);k!==-1&&this._listeners.splice(k,1)}static source(){let v;return{token:new Bc(function(L){v=L}),cancel:v}}}function dm(f){return function(k){return f.apply(null,k)}}function pm(f){return ge.isObject(f)&&f.isAxiosError===!0}const Fc={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Fc).forEach(([f,v])=>{Fc[v]=f});function Bu(f){const v=new rs(f),k=Qh(rs.prototype.request,v);return ge.extend(k,rs.prototype,v,{allOwnKeys:!0}),ge.extend(k,v,null,{allOwnKeys:!0}),k.create=function(L){return Bu(is(f,L))},k}const Zt=Bu($o);Zt.Axios=rs,Zt.CanceledError=$s,Zt.CancelToken=Bc,Zt.isCancel=vu,Zt.VERSION=Lu,Zt.toFormData=cl,Zt.AxiosError=ct,Zt.Cancel=Zt.CanceledError,Zt.all=function(v){return Promise.all(v)},Zt.spread=dm,Zt.isAxiosError=pm,Zt.mergeConfig=is,Zt.AxiosHeaders=Hi,Zt.formToJSON=f=>yu(ge.isHTMLForm(f)?new FormData(f):f),Zt.getAdapter=zu.getAdapter,Zt.HttpStatusCode=Fc,Zt.default=Zt;const fm=(f,v=300)=>{let k;return function(...L){clearTimeout(k),k=setTimeout(()=>{f.apply(this,L)},v)}};function fl(f,v,k={}){const P={type:"Feature"};return(k.id===0||k.id)&&(P.id=k.id),k.bbox&&(P.bbox=k.bbox),P.properties=v||{},P.geometry=f,P}function Fu(f,v,k={}){if(!f)throw new Error("coordinates is required");if(!Array.isArray(f))throw new Error("coordinates must be an Array");if(f.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!$u(f[0])||!$u(f[1]))throw new Error("coordinates must contain numbers");return fl({type:"Point",coordinates:f},v,k)}function Ou(f,v,k={}){for(const L of f){if(L.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(L[L.length-1].length!==L[0].length)throw new Error("First and last Position are not equivalent.");for(let Z=0;Z<L[L.length-1].length;Z++)if(L[L.length-1][Z]!==L[0][Z])throw new Error("First and last Position are not equivalent.")}return fl({type:"Polygon",coordinates:f},v,k)}function Vu(f,v,k={}){return fl({type:"MultiPoint",coordinates:f},v,k)}function Nu(f,v,k={}){return fl({type:"MultiPolygon",coordinates:f},v,k)}function $u(f){return!isNaN(f)&&f!==null&&!Array.isArray(f)}function Oc(f,v,k){if(f!==null)for(var P,L,Z,T,c,fe,me,ve=0,le=0,oe,ht=f.type,je=ht==="FeatureCollection",Ke=ht==="Feature",Oe=je?f.features.length:1,ft=0;ft<Oe;ft++){me=je?f.features[ft].geometry:Ke?f.geometry:f,oe=me?me.type==="GeometryCollection":!1,c=oe?me.geometries.length:1;for(var st=0;st<c;st++){var He=0,Ft=0;if(T=oe?me.geometries[st]:me,T!==null){fe=T.coordinates;var wt=T.type;switch(ve=k&&(wt==="Polygon"||wt==="MultiPolygon")?1:0,wt){case null:break;case"Point":if(v(fe,le,ft,He,Ft)===!1)return!1;le++,He++;break;case"LineString":case"MultiPoint":for(P=0;P<fe.length;P++){if(v(fe[P],le,ft,He,Ft)===!1)return!1;le++,wt==="MultiPoint"&&He++}wt==="LineString"&&He++;break;case"Polygon":case"MultiLineString":for(P=0;P<fe.length;P++){for(L=0;L<fe[P].length-ve;L++){if(v(fe[P][L],le,ft,He,Ft)===!1)return!1;le++}wt==="MultiLineString"&&He++,wt==="Polygon"&&Ft++}wt==="Polygon"&&He++;break;case"MultiPolygon":for(P=0;P<fe.length;P++){for(Ft=0,L=0;L<fe[P].length;L++){for(Z=0;Z<fe[P][L].length-ve;Z++){if(v(fe[P][L][Z],le,ft,He,Ft)===!1)return!1;le++}Ft++}He++}break;case"GeometryCollection":for(P=0;P<T.geometries.length;P++)if(Oc(T.geometries[P],v,k)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function ju(f,v={}){if(f.bbox!=null&&v.recompute!==!0)return f.bbox;const k=[1/0,1/0,-1/0,-1/0];return Oc(f,P=>{k[0]>P[0]&&(k[0]=P[0]),k[1]>P[1]&&(k[1]=P[1]),k[2]<P[0]&&(k[2]=P[0]),k[3]<P[1]&&(k[3]=P[1])}),k}function Uu(f,v={}){const k=ju(f),P=(k[0]+k[2])/2,L=(k[1]+k[3])/2;return Fu([P,L],v.properties,v)}function mm(f,v={}){let k=0,P=0,L=0;return Oc(f,function(Z){k+=Z[0],P+=Z[1],L++},!0),Fu([k/L,P/L],v.properties)}const gm={mixins:[Oo],props:{map:{type:Object},baseLayers:{type:Array,default:[{id:"orto10",name:"Ortophoto 1:10К",url:"https://data.gki.com.ua/api-user/rtile/orto10/ua/{z}/{x}/{y}.png",service:"TMS",category:"Національна інфраструктура геопросторових даних",scale:1e4,year:2020,bounds:"ua",maxzoom:18,owner:"НДІГК (Інститут геодезії та картографії)",image:"https://data.gki.com.ua/api-user/rtile/orto10/ua/13/4954/2876.png",basemap:!0},{id:"graymap",name:"Сіра карта",url:"https://basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png",service:"TMS",category:"Базові карти",attribution:"© <a href='http://www.openstreetmap.org/copyright'>OpenStreetMap</a>, © <a href='https://carto.com/attributions'>CARTO</a>",bounds1:"ua",image:"https://basemaps.cartocdn.com/light_all/10/601/348.png",position:0,owner:"OSM",basemap:!0},{id:"darkmap_carto",name:"Темна карта України",image:"https://basemaps.cartocdn.com/dark_all/13/4791/2762.png?ver=2023-04-14",url:"https://basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png",service:"TMS",category:"Базові карти",active:!1}]},selectedLayer:{type:String,required:!0}},watch:{map(f){f&&f.on("load",this.handleMapLoad)}},methods:{handleMapLoad(){var f;this.baseLayers.forEach(v=>{this.layerList.push(v)}),this.toggleLayerVisibility((f=this.baseLayers[0])==null?void 0:f.id)},toggleLayerVisibility(f){this.$emit("update:selectedLayer",f),this.changeBaseLayer(f)}}},_m={class:"vs-map-slot-layers z-10 select-none"},ym=["onClick"],xm=["src"];function vm(f,v,k,P,L,Z){return N.openBlock(),N.createElementBlock("div",_m,[(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(k.baseLayers,(T,c)=>(N.openBlock(),N.createElementBlock("div",{key:T.id,class:N.normalizeClass(["vs-map-slot-layers__layer relative",{focused:T.id==k.selectedLayer}]),onClick:fe=>Z.toggleLayerVisibility(T.id)},[N.createElementVNode("img",{src:T.image,class:"vs-map-slot-layers__image"},null,8,xm),N.createElementVNode("div",{class:N.normalizeClass(["absolute py-2 px-4 text-sm text-stone-800 bg-white shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-lg top-[-46px] text-nowrap p-2 hidden whitespace-nowrap",[c===0?"left-[-10px]":"left-[50%] translate-x-[-50%]"]])},N.toDisplayString(T==null?void 0:T.name),3)],10,ym))),128))])}const bm=Fi(gm,[["render",vm],["__scopeId","data-v-8959e540"]]),wm={},Sm={class:"shrink-0 size-3",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},Tm=[N.createElementVNode("path",{d:"M18 6 6 18"},null,-1),N.createElementVNode("path",{d:"m6 6 12 12"},null,-1)];function km(f,v){return N.openBlock(),N.createElementBlock("svg",Sm,Tm)}const ml=Fi(wm,[["render",km]]),Im={},Cm={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Em=[N.createElementVNode("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),N.createElementVNode("path",{d:"M2 17L12 22L22 17",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),N.createElementVNode("path",{d:"M2 12L12 17L22 12",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)];function Pm(f,v){return N.openBlock(),N.createElementBlock("svg",Cm,Em)}const Am={components:{closeIcon:ml,layersIcon:Fi(Im,[["render",Pm]])},mixins:[Oo],props:{layers:{type:Array,default:()=>[]},map:{type:Object,default:null},basemapIds:{type:Array,default:()=>[]}},data(){return{isOpen:!1,selectedLayers:[],mounted:!1}},mounted(){this.mounted=!0},methods:{async handleLayerChange(f,v){await this.setVisible(f,v),v&&this.map.getStyle().layers.filter(L=>!this.basemapIds.includes(L.id)&&L.id!==f.id).map(L=>L.id).forEach(L=>{this.map.getLayer(L)&&this.map.moveLayer(L)})}}},Mm=f=>(N.pushScopeId("data-v-4c33eaa0"),f=f(),N.popScopeId(),f),zm={class:"p-[10px]"},Dm={class:"select-none absolute left-[20px] top-[10px] border bg-white max-w-[250px] p-[10px] rounded-lg z-10"},Lm={class:"flex justify-between items-center border-b pb-[8px] text-[16px]"},Rm=Mm(()=>N.createElementVNode("span",null,"Додаткові шари",-1)),Bm={class:"mt-2 max-h-[300px] overflow-auto [&::-webkit-scrollbar]:h-1.5 [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-gray-300 [&::-webkit-scrollbar-track]:bg-transparent"},Fm=["id","value","onChange"],Om=["for"];function Vm(f,v,k,P,L,Z){const T=N.resolveComponent("layersIcon"),c=N.resolveComponent("VsPopover"),fe=N.resolveComponent("closeIcon");return N.openBlock(),N.createElementBlock(N.Fragment,null,[!L.isOpen&&L.mounted?(N.openBlock(),N.createBlock(c,{key:0,teleport:"body",trigger:"hover",placement:"right",class:"select-none flex absolute left-[20px] top-[10px] border bg-white max-w-[250px] rounded-lg cursor-pointer z-10",onClick:v[0]||(v[0]=me=>L.isOpen=!L.isOpen)},{reference:N.withCtx(()=>[N.createElementVNode("div",zm,[N.createVNode(T,{class:"h-5 w-5"})])]),default:N.withCtx(()=>[N.createTextVNode(" Додаткові шари ")]),_:1})):N.createCommentVNode("",!0),N.withDirectives(N.createElementVNode("div",Dm,[N.createElementVNode("div",Lm,[Rm,L.mounted?(N.openBlock(),N.createBlock(c,{key:0,teleport:"body",trigger:"hover",placement:"bottom",class:"flex"},{reference:N.withCtx(()=>[N.createElementVNode("button",{type:"button",class:"size-6 inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:text-neutral-400 dark:focus:bg-neutral-600",onClick:v[1]||(v[1]=me=>L.isOpen=!L.isOpen)},[N.createVNode(fe)])]),default:N.withCtx(()=>[N.createTextVNode(" Приховати панель ")]),_:1})):N.createCommentVNode("",!0)]),N.withDirectives(N.createElementVNode("div",Bm,[(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(k.layers,me=>(N.openBlock(),N.createElementBlock("div",{key:me.id,class:"flex items-center gap-2 text-sm"},[N.createElementVNode("input",{type:"checkbox",id:`layer-${me.id}`,value:me.id,class:"cursor-pointer",onChange:ve=>Z.handleLayerChange(me,ve.target.checked)},null,40,Fm),N.createElementVNode("label",{for:`layer-${me.id}`,class:"cursor-pointer"},N.toDisplayString(me.name),9,Om)]))),128))],512),[[N.vShow,L.isOpen]])],512),[[N.vShow,L.isOpen]])],64)}const Nm=Fi(Am,[["render",Vm],["__scopeId","data-v-4c33eaa0"]]),$m={mixins:[Oo],components:{closeIcon:ml},props:{map:{type:Object,required:!0},compareLayers:{type:Array,default:()=>[]},table:{type:String,default:""},collapsed:{type:Boolean,default:!1}},data(){return{mounted:!1,currentLayer:null}},mounted(){var f,v;this.currentLayer=((v=(f=this.compareLayers)==null?void 0:f[0])==null?void 0:v.id)||null,this.mounted=!0},watch:{async currentLayer(f,v){const k=this.compareLayers.find(L=>L.id===v),P=this.compareLayers.find(L=>L.id===f);k&&await this.setVisible(k,!1,this.map),P&&await this.setVisible(P,!0,this.map),this.map.getStyle().layers.forEach(L=>{L.source===this.table&&this.map.getLayer(L.id)&&this.map.moveLayer(L.id)})}}},jm={class:"absolute w-full top-[10px] right-[50px] shadow-sm bg-white max-w-[250px] p-[10px] rounded-lg z-10 select-none border"},Um={class:"flex items-start justify-between pb-1 border-b"},qm=N.createElementVNode("div",{class:"text-[16px] max-w-[180px]"}," Базові шари порівняльної карти ",-1),Zm={class:"flex gap-2"},Gm=N.createElementVNode("button",{type:"button",class:"size-6 inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:text-neutral-400 dark:focus:bg-neutral-600"}," - ",-1),Hm={class:"pt-1 max-h-[300px] overflow-auto [&::-webkit-scrollbar]:h-1.5 [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-gray-300 [&::-webkit-scrollbar-track]:bg-transparent"},Xm=["id","name","value"],Wm=["for"];function Jm(f,v,k,P,L,Z){const T=N.resolveComponent("VsPopover"),c=N.resolveComponent("closeIcon");return N.withDirectives((N.openBlock(),N.createElementBlock("div",jm,[N.createElementVNode("div",Um,[qm,N.createElementVNode("div",Zm,[L.mounted?(N.openBlock(),N.createBlock(T,{key:0,trigger:"hover",placement:"bottom",teleport:"body",onClick:v[0]||(v[0]=fe=>f.$emit("update:collapsed",!0))},{reference:N.withCtx(()=>[Gm]),default:N.withCtx(()=>[N.createTextVNode(" Згорнути панель ")]),_:1})):N.createCommentVNode("",!0),L.mounted?(N.openBlock(),N.createBlock(T,{key:1,trigger:"hover",placement:"bottom",teleport:"body"},{reference:N.withCtx(()=>[N.createElementVNode("button",{type:"button",class:"size-6 inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:text-neutral-400 dark:focus:bg-neutral-600",onClick:v[1]||(v[1]=fe=>f.$emit("close"))},[N.createVNode(c,{class:"cursor-pointer"})])]),default:N.withCtx(()=>[N.createTextVNode(" Приховати панель ")]),_:1})):N.createCommentVNode("",!0)])]),N.createElementVNode("div",Hm,[(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(k.compareLayers,fe=>(N.openBlock(),N.createElementBlock("div",{key:fe.id,class:"flex items-center py-1"},[N.withDirectives(N.createElementVNode("input",{type:"radio",id:fe.id,name:fe.id,value:fe.id,"onUpdate:modelValue":v[2]||(v[2]=me=>L.currentLayer=me),class:"shrink-0 border-gray-200 rounded-full text-blue-600 focus:ring-blue-500 checked:border-blue-500 dark:bg-neutral-800 dark:border-neutral-700 dark:checked:bg-blue-500 dark:checked:border-blue-500 dark:focus:ring-offset-gray-800"},null,8,Xm),[[N.vModelRadio,L.currentLayer]]),N.createElementVNode("label",{for:fe.id,class:"text-[14px] ml-2 cursor-pointer"},N.toDisplayString(fe.name),9,Wm)]))),128))])],512)),[[N.vShow,!k.collapsed]])}const Km=Fi($m,[["render",Jm]]),Ym={},Qm={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},eg=[N.createElementVNode("path",{d:"M18 8L22 12L18 16",stroke:"#333333","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),N.createElementVNode("path",{d:"M6 8L2 12L6 16",stroke:"#333333","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),N.createElementVNode("path",{d:"M2 12H22",stroke:"#333333","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)];function tg(f,v,k,P,L,Z){return N.openBlock(),N.createElementBlock("svg",Qm,eg)}const ig={components:{closeIcon:ml,compareIcon:Fi(Ym,[["render",tg]]),CompareBaseLayers:Km},props:{map:{type:Object},compareLayers:{type:Array},table:{type:String}},data(){return{isOpen:!1,mounted:!1,afterMap:null,compare:null,isOpen:!1,afterMapLoaded:!1,collapsed:!1}},mounted(){this.mounted=!0,window.maplibregl=In,this.loadScripts()},computed:{modalButtonClasses(){return{"!bg-[#F2F2F2]":this.isOpen,"bg-white":!this.isOpen}}},methods:{loadScripts(){const f=document.createElement("link");f.setAttribute("rel","stylesheet"),f.setAttribute("href","https://cdn.jsdelivr.net/npm/@maplibre/maplibre-gl-compare@0.5.0/dist/maplibre-gl-compare.min.css"),document.head.appendChild(f);const v=document.createElement("script");v.setAttribute("src","https://cdn.jsdelivr.net/npm/@maplibre/maplibre-gl-compare@0.5.0/dist/maplibre-gl-compare.min.js"),document.head.appendChild(v)},initCompare(){const f=this.map,v={version:8,glyphs:"https://fonts.openmaptiles.org/{fontstack}/{range}.pbf",sources:{},layers:[]},k=new In.Map({container:"after",style:v,center:f.getCenter(),zoom:f.getZoom(),minZoom:f.getMinZoom()});if(k.addControl(new In.NavigationControl({visualizePitch:!0})),k.on("load",()=>{this.afterMapLoaded=!0,this.syncLayers()}),this.afterMap=k,window.maplibregl&&window.maplibregl.Compare){const P="#comparison-container";this.compare=new window.maplibregl.Compare(f,k,P,{mousemove:!1})}else console.error("Compare is not available on window.maplibregl")},destroyCompare(){this.compare&&(this.compare.remove(),this.compare=null),this.afterMap&&(this.afterMap.remove(),this.afterMap=null),this.isOpen=!1,this.afterMapLoaded=!1},toggleCompare(){if(this.collapsed){this.collapsed=!1;return}this.isOpen=!this.isOpen,this.isOpen?this.$nextTick(()=>{this.initCompare(),this.resizeMaps()}):this.destroyCompare()},resizeMaps(){this.map.resize(),this.afterMap&&this.afterMap.resize()},syncLayers(){if(!this.map||!this.afterMap)return;const f=this.map,v=this.afterMap;f.getSource(this.table)&&(v.getSource(this.table)||v.addSource(this.table,f.getStyle().sources[this.table]));const P=f.getStyle().layers.filter(L=>L.source===this.table);P.length&&P.forEach(L=>{v.getLayer(L.id)||v.addLayer(L)})}}},rg={class:"w-[29px] h-[29px] flex items-center justify-center"},ng={key:2,id:"comparison-container",class:"absolute top-0 right-0 w-full h-full"},sg=[N.createElementVNode("div",{id:"after",class:"map-compare"},null,-1)];function og(f,v,k,P,L,Z){const T=N.resolveComponent("compareIcon"),c=N.resolveComponent("VsPopover"),fe=N.resolveComponent("CompareBaseLayers");return N.openBlock(),N.createElementBlock(N.Fragment,null,[L.mounted?(N.openBlock(),N.createBlock(c,{key:0,teleport:"body",trigger:"hover",placement:"left",class:N.normalizeClass(["flex absolute right-[10px] top-[120px] bg-white max-w-[250px] rounded-lg cursor-pointer z-10",Z.modalButtonClasses]),onClick:Z.toggleCompare,style:{"box-shadow":"0 0 0 2px rgba(0, 0, 0, 0.2)"}},{reference:N.withCtx(()=>[N.createElementVNode("div",rg,[N.createVNode(T,{class:"w-4 h-4"})])]),default:N.withCtx(()=>[N.createTextVNode(" Порівняти шари ")]),_:1},8,["class","onClick"])):N.createCommentVNode("",!0),L.isOpen&&L.afterMapLoaded?(N.openBlock(),N.createBlock(fe,{key:1,table:k.table,map:L.afterMap,compareLayers:k.compareLayers,onClose:Z.destroyCompare,collapsed:L.collapsed,"onUpdate:collapsed":v[0]||(v[0]=me=>L.collapsed=me)},null,8,["table","map","compareLayers","onClose","collapsed"])):N.createCommentVNode("",!0),L.isOpen?(N.openBlock(),N.createElementBlock("div",ng,sg)):N.createCommentVNode("",!0)],64)}const ag=Fi(ig,[["render",og]]),lg={props:["colors","strokes","title"],methods:{capitalizeFirstLetter(f){return f?f.charAt(0).toUpperCase()+f.slice(1):""}}},cg={class:"absolute left-[20px] bottom-[74px] bg-white max-w-[250px] p-[10px] rounded-lg z-10 border"},hg={key:0,class:"mb-[10px] text-[1rem]"},ug={key:1},dg={class:"legend-item flex items-center gap-2"},pg={class:"ml-1 text-[0.875rem]"},fg={class:"legend-item"},mg={key:0,class:"flex justify-start items-center gap-2"},gg={class:"ml-1 text-[0.875rem]"};function _g(f,v,k,P,L,Z){var T;return N.openBlock(),N.createElementBlock("div",cg,[k.title?(N.openBlock(),N.createElementBlock("div",hg,N.toDisplayString(k.title),1)):N.createCommentVNode("",!0),(T=k.strokes)!=null&&T.length?(N.openBlock(),N.createElementBlock("div",ug,[(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(k.strokes,c=>(N.openBlock(),N.createElementBlock("div",dg,[N.createElementVNode("div",{class:"w-[15px] h-[4px]",style:N.normalizeStyle({background:`repeating-linear-gradient(to right, ${c.color}, ${c.color} 5px, transparent 5px, transparent 8px)`})},null,4),N.createElementVNode("div",pg,N.toDisplayString(Z.capitalizeFirstLetter(c.text)),1)]))),256))])):N.createCommentVNode("",!0),(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(k.colors,c=>(N.openBlock(),N.createElementBlock("div",fg,[c.id>0?(N.openBlock(),N.createElementBlock("div",mg,[N.createElementVNode("div",{class:"w-[15px] h-[15px] rounded-[50%] min-w-[15px]",style:N.normalizeStyle({backgroundColor:c.color})},null,4),N.createElementVNode("div",gg,N.toDisplayString(Z.capitalizeFirstLetter(c.text)),1)])):N.createCommentVNode("",!0)]))),256))])}const yg={components:{MapSlotLayers:bm,MapLegend:Fi(lg,[["render",_g]]),AdditionalLayers:Nm,MapCompare:ag},props:{colorAttr:null,strokeAttr:null,zoom:{type:Array,default:()=>8},defaultColor:{type:String,default:"blue"},selectedBaseLayer:{type:String,required:!0},legendname:{type:String,default:()=>""},height:{type:String,default:()=>"100vh"},width:{type:String,default:"100vw"},center:{type:Array,default:[32,49]},maxBounds:{type:Array,default:[[22,44],[40,52]]},table:{type:String,default:""},zoom:{type:[String,Number],default:13},minZoom:{type:[String,Number],default:1},basemap:Array,additionalLayers:Array,filtersParam:{type:String,default:""},row:{type:Object,default:{}},pointZoom:{type:String,default:"12"},legend:{type:Boolean,default:()=>!0},compareLayers:{type:Array,default:()=>[]}},mixins:[Oo],data(){return{map:null,hoverObject:null,popup:null,colors:[]}},async mounted(){var f,v,k,P;try{if(await this.createMap(),(f=this.row)!=null&&f.geom){const{type:L,coordinates:Z}=this.row.geom;let T;switch(L){case"Polygon":T=Ou(Z);break;case"MultiPolygon":T=Nu(Z);break;case"MultiPoint":T=Vu(Z);break;default:(v=this.map)==null||v.fitBounds([Z,Z],{maxZoom:this.zoom,padding:30}),this.isSelectObj=!0;return}const c=Uu(T).geometry.coordinates;(k=this.map)==null||k.fitBounds([c,c],{maxZoom:this.zoom,padding:30})}(P=this.map)==null||P.fitBounds(this.center)}catch{}},watch:{filtersParam(f){this.setFilter(this.table,f)},selectedBaseLayer(f){this.$emit("update:selectedBaseLayer",f)}},computed:{basemapIds(){return this.basemap.map(f=>f==null?void 0:f.id)},allLayers(){return[...this.basemap||[],...this.additionalLayers||[],...this.compareLayers||[]]}},methods:{async getColorStyle(){var f=[["#69D2E7","#A7DBD8","#E0E4CC","#F38630","#FA6900"],["#FE4365","#FC9D9A","#F9CDAD","#C8C8A9","#83AF9B"],["#ECD078","#D95B43","#C02942","#542437","#53777A"]];if(!this.colorAttr)return this.defaultColor;try{const{data:{rows:v}}=await Zt.get(`/api/data/${this.table}/${this.colorAttr}`),k=v.reduce((P,L,Z)=>L!=null&&L.id?[...P,L.id.toString(),L.color||f[0][Z%5]]:P,["match",["get",this.colorAttr]]);return this.colors=[...v],k.push("gray"),k}catch(v){console.log(v)}},async getStrokeStyle(){if(!this.strokeAttr)return"transparent";try{const{data:{rows:f}}=await Zt.get(`/api/data/${this.table}/${this.strokeAttr}`),v=f.reduce((k,P,L)=>P!=null&&P.id?[...k,{id:P.id.toString(),color:P.color||"#000000",dash:P.dash||[2,2],text:P.text||P.id.toString()}]:k,[]);return this.strokes=[...v],["match",["get",this.strokeAttr],...v.flatMap(({id:k,color:P})=>[k,P]),"transparent"]}catch(f){return console.log(f),"transparent"}},async handleMapLoad(){var P,L;this.$emit("map",this.map);const f=await this.getStrokeStyle(),v=await this.getColorStyle(),k=((L=(P=location.search.split("&").find(Z=>Z.includes("filter=")))==null?void 0:P.split("filter="))==null?void 0:L[1])||"";await this.addLayer({id:this.table,service:"vector",url:`/api/vtile/${this.table}/ua/{z}/{x}/{y}.vmt?pointZoom=${this.pointZoom}&dt=${new Date().toISOString()}&filter=${k}`,layers:[{type:"fill","source-layer":this.table,paint:{"fill-color":v,"fill-opacity":.3,"fill-outline-color":["case",["==",["feature-state","hover"],!0],"red","#000000"]},filter:["all",["==",["geometry-type"],"Polygon"]]},{type:"circle","source-layer":this.table,filter:["all",["==",["geometry-type"],"Point"]],paint:{"circle-radius":{base:1.75,stops:[[10,5],[12,6],[18,12]]},"circle-stroke-color":["case",["==",["feature-state","hover"],!0],"red","#ccc"],"circle-stroke-width":["case",["==",["feature-state","hover"],!0],2,1],"circle-color":v}},{id:`${this.table}-stroke`,type:"line","source-layer":this.table,filter:["all",["==",["geometry-type"],"Polygon"]],paint:{"line-color":f,"line-width":2.5,"line-dasharray":[2,2]}}]})},async createMap(){const f={version:8,glyphs:"https://cdn.softpro.ua/data/fonts/{fontstack}/{range}.pbf",sources:{},layers:[]};this.map=await new In.Map({container:"maplibre-map",style:f,zoom:this.zoom,center:this.center,minZoom:this.minZoom}),this.$parent.map=this.map,this.map.addControl(new In.NavigationControl({visualizePitch:!0})),this.map.on("load",this.handleMapLoad)}}},xg={class:"vs-map-portal relative z-1 mt-2",id:"mapwrapper"};function vg(f,v,k,P,L,Z){var ve;const T=N.resolveComponent("MapLegend"),c=N.resolveComponent("MapSlotLayers"),fe=N.resolveComponent("MapCompare"),me=N.resolveComponent("AdditionalLayers");return N.openBlock(),N.createElementBlock("div",xg,[N.createElementVNode("div",{id:"maplibre-map",ref:"maplibreMap",class:"w-full",style:N.normalizeStyle({height:k.height})},null,4),N.withDirectives(N.createVNode(T,{colors:L.colors,title:k.legendname},null,8,["colors","title"]),[[N.vShow,k.legend]]),N.createVNode(c,{map:L.map,baseLayers:k.basemap,selectedLayer:k.selectedBaseLayer,"onUpdate:selectedLayer":v[0]||(v[0]=le=>f.$emit("update:selectedBaseLayer",le))},null,8,["map","baseLayers","selectedLayer"]),N.createVNode(fe,{map:L.map,compareLayers:Z.allLayers,table:k.table},null,8,["map","compareLayers","table"]),(ve=k.additionalLayers)!=null&&ve.length?(N.openBlock(),N.createBlock(me,{key:0,map:L.map,layers:k.additionalLayers,basemapIds:Z.basemapIds},null,8,["map","layers","basemapIds"])):N.createCommentVNode("",!0)])}const bg=Fi(yg,[["render",vg]]),wg={},Sg={class:"flex-shrink-0 size-3.5",xmlns:"http://www.w3.org/2000/svg",width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},Tg=[N.createStaticVNode('<line x1="21" x2="14" y1="4" y2="4"></line><line x1="10" x2="3" y1="4" y2="4"></line><line x1="21" x2="12" y1="12" y2="12"></line><line x1="8" x2="3" y1="12" y2="12"></line><line x1="21" x2="16" y1="20" y2="20"></line><line x1="12" x2="3" y1="20" y2="20"></line><line x1="14" x2="14" y1="2" y2="6"></line><line x1="8" x2="8" y1="10" y2="14"></line><line x1="16" x2="16" y1="18" y2="22"></line>',9)];function kg(f,v){return N.openBlock(),N.createElementBlock("svg",Sg,Tg)}const Ig=Fi(wg,[["render",kg]]),Cg={},Eg={xmlns:"http://www.w3.org/2000/svg",width:"21",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-layout-sidebar-right-collapse"},Pg=[N.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),N.createElementVNode("path",{d:"M4 4m0 2a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2z"},null,-1),N.createElementVNode("path",{d:"M15 4v16"},null,-1),N.createElementVNode("path",{d:"M9 10l2 2l-2 2"},null,-1)];function Ag(f,v){return N.openBlock(),N.createElementBlock("svg",Eg,Pg)}const Mg=Fi(Cg,[["render",Ag]]),zg={},Dg={xmlns:"http://www.w3.org/2000/svg",width:"21",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-layout-sidebar-right-expand"},Lg=[N.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),N.createElementVNode("path",{d:"M4 4m0 2a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2z"},null,-1),N.createElementVNode("path",{d:"M15 4v16"},null,-1),N.createElementVNode("path",{d:"M10 10l-2 2l2 2"},null,-1)];function Rg(f,v){return N.openBlock(),N.createElementBlock("svg",Dg,Lg)}const Bg=Fi(zg,[["render",Rg]]),Fg={props:{visible:{type:Boolean,default:()=>!1},title:{type:String,default:()=>""},size:{type:String,default:()=>""}},emits:["update:visible","onClose"],name:"vs-dialog",mounted(){window.addEventListener("keydown",this.checkKey)},unmounted(){window.removeEventListener("keydown",this.checkKey)},computed:{hasSlot(){var f;return!!((f=this.$slots)!=null&&f.footer)},checkSize(){return this.size==="small"?"w-5/12":this.size==="medium"?"w-6/12":"lg:w-7/12 w-11/12"}},methods:{checkKey({key:f}){f==="Escape"&&this.handleClose()},handleClose(){this.$emit("update:visible",!1),this.$emit("onClose")}}},qu=f=>(N.pushScopeId("data-v-37405773"),f=f(),N.popScopeId(),f),Og={class:"vsTailwind ui-dialog__wrapper"},Vg={class:"w-full h-full fixed top-0 start-0 z-[80] bg-black bg-opacity-50"},Ng={class:"py-2.5 px-4 flex justify-between items-center border-b"},$g={class:"font-medium text-gray-800"},jg=[qu(()=>N.createElementVNode("span",{class:"sr-only"},"Close",-1)),qu(()=>N.createElementVNode("svg",{class:"flex-shrink-0 w-4 h-4",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[N.createElementVNode("path",{d:"M18 6 6 18"}),N.createElementVNode("path",{d:"m6 6 12 12"})],-1))],Ug={class:"ui-dialog__content p-4"},qg={key:0,class:"flex justify-end gap-x-2"};function Zg(f,v,k,P,L,Z){return N.openBlock(),N.createBlock(N.Teleport,{to:"#modal"},[N.createVNode(N.Transition,{name:"fade"},{default:N.withCtx(()=>[N.withDirectives(N.createElementVNode("div",Og,[N.createElementVNode("div",Vg,[N.createVNode(N.Transition,{name:"content",appear:""},{default:N.withCtx(()=>[N.createElementVNode("div",{class:N.normalizeClass(["ui-dialog__modal opacity-1 transition-all flex flex-col bg-white border pointer-events-auto shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-xl",[Z.checkSize]])},[N.createElementVNode("div",Ng,[N.createElementVNode("h3",$g,N.toDisplayString(k.title),1),N.createElementVNode("button",{type:"button",class:"size-8 inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:text-neutral-400 dark:focus:bg-neutral-600",onClick:v[0]||(v[0]=(...T)=>Z.handleClose&&Z.handleClose(...T))},jg)]),N.createElementVNode("div",Ug,[N.renderSlot(f.$slots,"default",{},void 0,!0)]),Z.hasSlot?(N.openBlock(),N.createElementBlock("div",qg,[N.renderSlot(f.$slots,"footer",{},void 0,!0)])):N.createCommentVNode("",!0)],2)]),_:3})])],512),[[N.vShow,k.visible]])]),_:3})])}const Gg=Fi(Fg,[["render",Zg],["__scopeId","data-v-37405773"]]),Hg=N.defineComponent({props:{title:{type:String,default:()=>""},table:{type:String,default:()=>""},rows:{type:Object,default:()=>null},initTotal:{type:[Number,String],default:()=>""},colorAttr:{type:String,default:()=>""},strokeAttr:{type:String,default:()=>""},legendname:{type:String,default:()=>""},center:{type:Array},maxBounds:{type:Array,default:()=>[[22,44.4],[40,52.5]]},id:{type:String,default:()=>""},isAutocomplete:{type:Boolean,default:()=>!1},isAddressAutocomplete:{type:Boolean,default:()=>!1},zoom:{type:[Number,String],default:()=>"13"},minZoom:{type:[Number,String],default:()=>"1"},maskForSearch:{type:String,default:()=>null},searchShow:{type:Boolean,default:()=>!0},basemap:{type:Array},additionalLayers:{type:Array},pointZoom:{type:String,default:()=>"12"},legend:{type:Boolean,default:()=>!0},defaultColor:{type:String,default:()=>"blue"},compareLayers:{type:Array,default:()=>[]}},mixins:[Oo],components:{MapPortal:bg,NoData:Zp,FilterIcon:Ig,VisibleMapIcon:Mg,HiddenMapIcon:Bg,CloseIcon:ml,VsDialog:Gg},data(){return{filters:"",search:"",limit:20,polyline:null,filtersParam:"",isSelectObj:!1,selectedId:"",searchRegion:"",searchAddress:"",map:null,selectedBaseLayer:"",marker:null,selectedRow:null,activeFilters:"",isMapVisible:!0,tabsIsVisible:!1,filterUrl:"",currentPage:1,regionOptionGeneral:null,isFilterVisible:!1,tableData:null,hoverData:null,atuData:[],map:null,legendName:null,total:null,filtered:null,filterValues:"",activeFiltersCount:"",visibleTrue:!0,regionSelectValue:null,addressSelectValue:null,currentBbox:null,mountedFilter:{},optionRowsCount:[{value:10,label:"10"},{value:20,label:"20"},{value:30,label:"30"}],handleDebouncedUpdateValue:fm(f=>{this.handleSearchValue(f)},300)}},watch:{map(){this.map.on("mousemove",this.handleMapHover),this.map.on("click",this.handleMapClick),this.$emit("update:map",this.map)},activeFiltersCount(){var f,v;return(v=(f=this.$refs)==null?void 0:f.filter)==null?void 0:v.filteredActiveFiltersLength},activeFilters(){var f,v;return this.isSelectObj&&this.moveToDefaultPage(),(v=(f=this.$refs)==null?void 0:f.filter)==null?void 0:v.activeFilters},isFilterVisible(f){f||this.getData()},async regionSelectValue(f,v){var L,Z;if(!this.regionSelectValue){this.map.removeSource("region-search-id");return}f&&this.selectedId&&this.closeObjCard(),this.polyline=this.regionSelectValue.encoded_geom,this.getData();const k=((L=this.regionSelectValue)==null?void 0:L.geom)||Tr.toGeoJSON(this.regionSelectValue.encoded_geom),P=this.map.getSource("region-search-id");if(this.currentBbox=ju(k),P)P.setData({type:"Feature",geometry:k});else{this.map.addSource("region-search-id",{type:"geojson",data:{type:"Feature",geometry:k}});const T={id:"region-search-id",type:"line",source:"region-search-id",paint:{"line-color":"blue","line-opacity":1}};await this.map.addLayer(T)}this.moveLayer("site.prc.parcel_object.table"),(Z=this.map)==null||Z.fitBounds(this.currentBbox,{zoom:this.setAtuZoom,padding:20}),this.getData()},async addressSelectValue(f,v){this.addressSelectValue&&(f&&this.selectedId&&this.closeObjCard(),this.getData())}},created(){this.legendName,this.tableData=this.rows,this.total=this.initTotal,this.id&&(this.selectedRow=this.rows[0],this.selectedId=this.id,this.isSelectObj=!0)},mounted(){this.rows||this.getData();const v=new URLSearchParams(window.location.search).get("filter"),k=v==null?void 0:v.split("|");k==null||k.forEach(L=>{const[Z,T]=L.split("=");T!=null&&T.includes(",")?this.mountedFilter[Z]=T==null?void 0:T.split(","):this.mountedFilter[Z]=T});const P=new URLSearchParams(window.location.search);this.currentPage=P.get("page")||1,this.getFilter()},updated(){this.checkFilterLength()},computed:{setAtuZoom(){var f,v,k;return((f=this.regionSelectValue)==null?void 0:f.id)==="UA80000000000093317"||((v=this.regionSelectValue)==null?void 0:v.id)==="UA85000000000065278"?10:((k=this.regionSelectValue)==null?void 0:k.region)===""?7.5:11}},methods:{async getData(){try{const f={search:this.search||null,limit:this.limit,page:this.currentPage,polyline:this.polyline};f.filter=this.filtersParam;const{data:v}=await Zt.get(`/api/data/${this.table}`,{params:f});this.tableData=v==null?void 0:v.rows,this.total=v.filtered,this.filtered=v.filtered}catch(f){console.error(f.message)}},moveToDefaultPage(){var P;const f=new URLSearchParams(window.location.search);f.delete("id");const k=`${window.location.pathname}?${f.toString()}`;(P=this.map)==null||P.fitBounds(this.maxBounds,{}),window.history.pushState({},"",k),this.isSelectObj=!1},regionFullName(f){return f.region?`${f.text} / ${f.region}`:f.text},getLabelById(f){const v=this.filters.find(k=>k.id===f);return v?v.label:f},getOptionsLabelById(f,v){if(Array.isArray(v)){const k=this.filters.find(P=>P.id===f);return k!=null&&k.options?k==null?void 0:k.options.filter(P=>v.includes(P.id)).map(P=>P.text).join(", "):v==null?void 0:v.length}else return v},async clearFilter(f){var v,k;(k=(v=this.$refs)==null?void 0:v.filter)==null||k.clearFilter(f),await this.updateTableAndMap(),await this.getData()},handlePageChange(f){this.currentPage=f;const v=new URL(window.location.href),k=new URLSearchParams(window.location.search);k.set("page",f),v.search=decodeURI(k.toString()),window.history.pushState({},"",v),this.getData()},async getFilter(){var f;try{const{data:v}=await Zt.get(`/api/filter/${this.table}`);this.filters=(f=v==null?void 0:v.list)==null?void 0:f.map(k=>({...k,label:(k==null?void 0:k.label)||(k==null?void 0:k.ua),id:(k==null?void 0:k.id)||(k==null?void 0:k.name)}))}catch(v){console.error(v.message)}},async handleSearchValue(f){this.search=f,await this.getData()},closeObjCard(){var P;const f=new URLSearchParams(window.location.search);f.delete("id"),this.deletePulsePoint(),this.deleteHighlighPolygon();const k=`${window.location.pathname}?${f.toString()}`;(this.currentBbox||this.center)&&((P=this.map)==null||P.fitBounds(this.currentBbox||[this.center,this.center],{maxZoom:this.zoom})),window.history.pushState({},"",k),this.isSelectObj=!1,this.selectedRow=null,this.getData()},async handleSearchRegionValue(f){var k;const v=this.map.getLayer("region-search-id");this.searchRegion=f,f===""&&v?((k=this.map)==null||k.fitBounds(this.maxBounds,{}),this.currentBbox=null,this.polyline=null,this.map.removeLayer("region-search-id"),this.getData()):f===""&&this.getData()},async handleSearchAddressValue(f){var k;const v=this.map.getLayer("address-search-id");this.searchAddress=f,f===""&&v?((k=this.map)==null||k.fitBounds(this.maxBounds,{}),this.currentBbox=null,this.polyline=null,this.map.removeLayer("address-search-id"),this.getData()):f===""&&this.getData()},handleFilterChange(f){this.$emit("update:filterState",f),this.currentPage=f.state.page||1,this.filterUrl=f.url==="no-url"?null:f.url.split("|").filter(v=>!v.includes("page=")).join("|")},async updateTableAndMap(){var f,v;this.selectedRow||(this.filtersParam=this.filterUrl,this.activeFilters=(v=(f=this.$refs)==null?void 0:f.filter)==null?void 0:v.activeFilters,this.isFilterVisible=!1,this.getData())},handleFilterSubmit(){var f;this.isSelectObj="",this.selectedId="",this.selectedId=!1,(f=this.map)==null||f.fitBounds(this.maxBounds,{}),this.isFilterVisible=!1},toggleMapVisible(){this.isMapVisible=!this.isMapVisible},checkUrl(f=!0){const v=new URLSearchParams(window.location.search);v.has("id")?(this.isSelectObj=!0,this.isMapVisible=f,this.selectedId=v.get("id")):(this.isSelectObj=!1,this.selectedId="")},changeLimit(f){this.limit=f,this.currentPage=1,this.getData()},filterModalClose(){this.isFilterVisible=!1},resetFilters(){this.$refs.filter&&(this.$refs.filter.clearAll(),this.search="",this.isFilterVisible=!1,this.filtersParam="",this.polyline=null,this.regionSelectValue=null,this.addressSelectValue=null,this.currentBbox=null,this.activeFilters=null,this.tabsIsVisible=!1,this.handleSearchRegionValue(""),this.handleSearchAddressValue(""))},checkFilterLength(){var v,k;const f=(k=(v=this.$refs)==null?void 0:v.filter)==null?void 0:k.filteredActiveFiltersLength;f!==this.previousLength&&(this.previousLength=f,this.activeFiltersCount=f)},async handleMapClick(f){var Z,T,c,fe,me,ve,le,oe;const v=this.map.queryRenderedFeatures(f.point);if((v==null?void 0:v.length)<1)return;const k=window.location.pathname,P=new URLSearchParams(window.location.search);P.set("id",`${(Z=v[0])==null?void 0:Z.properties.id}`),this.getObjectData((c=(T=v[0])==null?void 0:T.properties)==null?void 0:c.id);const L=`${k}?${P.toString()}`;window.history.pushState({},"",L),this.isSelectObj=!0,f.lngLat&&((oe=this.map)==null||oe.fitBounds([[(fe=f.lngLat)==null?void 0:fe.lng,(me=f.lngLat)==null?void 0:me.lat],[(ve=f.lngLat)==null?void 0:ve.lng,(le=f.lngLat)==null?void 0:le.lat]],{padding:30})),this.checkUrl()},async getObjectData(f){var v,k;try{const{data:P}=await Zt.get(`/api/data/${this.table}/${f}`);this.selectRow((v=P==null?void 0:P.rows)==null?void 0:v[0]),((k=P==null?void 0:P.rows)==null?void 0:k.lenght)<1&&this.deletePulsePoint()}catch(P){console.error(P.message)}},async selectRow(f,v=!0){var c,fe,me;this.isMapVisible=v;const P=await(await fetch(`/api/data/${this.table}/${f.id}`)).json();this.selectedRow=((c=P==null?void 0:P.rows)==null?void 0:c[0])||f;const L=window.location.pathname,Z=new URLSearchParams(window.location.search);Z.set("id",`${f.id}`);const T=`${L}?${Z.toString()}`;if(window.history.pushState({},"",T),this.checkUrl(v),f!=null&&f.geom){const{type:ve,coordinates:le}=f.geom;let oe;switch(ve){case"Polygon":oe=Ou(le);break;case"MultiPolygon":oe=Nu(le);break;case"MultiPoint":oe=Vu(le);break;default:(fe=this.map)==null||fe.fitBounds([le,le],{maxZoom:15,padding:30}),this.isSelectObj=!0;return}const ht=Uu(oe).geometry.coordinates;(me=this.map)==null||me.fitBounds([ht,ht],{maxZoom:15,padding:30})}this.isSelectObj=!0},deletePulsePoint(){this.marker&&this.marker.remove()},addPulsePoint(f){this.deletePulsePoint();const v=document.createElement("div");v.className="gps-marker",v.style.width="10px",v.style.height="10px",v.style.position="relative";const k=document.createElement("div");k.className="gps-wave",v.appendChild(k),this.marker=new In.Marker({element:v,anchor:"center"}).setLngLat(f).addTo(this.map)},deleteHighlighPolygon(){var f,v,k;(f=this.map)!=null&&f.getLayer("highlighted-polygon")&&((v=this.map)==null||v.removeLayer("highlighted-polygon"),(k=this.map)==null||k.removeSource("highlighted-polygon"))},highlightPolygon(f){var v,k,P,L,Z,T;this.deletePulsePoint(),this.deleteHighlighPolygon(),(L=this.map)==null||L.addSource("highlighted-polygon",{type:"geojson",data:{geometry:{type:(v=f==null?void 0:f.geom)==null?void 0:v.type,coordinates:(k=f==null?void 0:f.geom)==null?void 0:k.coordinates},type:"Feature",properties:{id:f==null?void 0:f.id,name:f==null?void 0:f.name,category:f==null?void 0:f.id},id:f==null?void 0:f.id,layer:{id:"site.rest_zone.table-0",type:"fill",source:"site.rest_zone.table",sourceLayer:"site.rest_zone.table",filter:["all",["==",["geometry-type"],(P=f==null?void 0:f.geom)==null?void 0:P.type]],paint:{"fill-color":"orange","fill-opacity":.5},layout:{}},source:"site.rest_zone.table",sourceLayer:"site.rest_zone.table",state:{hover:!0},table:"site.rest_zone.table"}}),(Z=this.map)==null||Z.addLayer({id:"highlighted-polygon",type:"fill",source:"highlighted-polygon",layout:{},minzoom:12,maxzoom:0,paint:{"fill-color":"orange","fill-opacity":.6}}),(T=this.map)==null||T.moveLayer("highlighted-polygon")},async handleMapHover(f){var L,Z,T;this.hoverObject&&(this.map.setFeatureState(this.hoverObject,{hover:!1}),this.hoverObject=null),this.popup||(this.popup=new In.Popup({maxWidth:"400px",closeButton:!1,closeOnClick:!1}));const v=this.map.queryRenderedFeatures(f.point);if(this.map.getCanvas().style.cursor="pointer",!(v!=null&&v.length)||((L=v==null?void 0:v[0])==null?void 0:L.source)==="region-search-id"){this.map.getCanvas().style.cursor="",this.popup.remove();return}const k=v[0].geometry.coordinates.slice();v[0].source==="highlighted-polygon"&&v[1]?this.hoverData=(Z=v[1])==null?void 0:Z.properties:this.hoverData=(T=v[0])==null?void 0:T.properties;const P={source:v[0].source,sourceLayer:v[0].sourceLayer,id:v[0].id};if(P.source!=="region-search-id"){for(this.map.setFeatureState(P,{hover:!0}),this.hoverObject=P;Math.abs(f.lngLat.lng-k[0])>180;)k[0]+=f.lngLat.lng>k[0]?360:-360;this.popup.setLngLat(f.lngLat).setHTML(this.$refs.popup.innerHTML).addTo(this.map)}},removeSelectedBaseLayer(){this.selectedBaseLayer=""},addGeomMarker(f){if(!this.map||!f)return;this.marker&&this.marker.remove();let v;(f==null?void 0:f.type)==="Point"?v=f.coordinates:v=mm(f).geometry.coordinates,this.marker=new In.Marker({color:"green"}).setLngLat(v).addTo(this.map),this.map.setCenter(v)}}}),Xg={class:"ml-3 pt-[20px]"},Wg={class:"w-full gap-5 flex justify-between mb-[6px] pr-3"},Jg={class:"flex items-center gap-2 max-h-[38px] pt-[4px]"},Kg={class:"custom-filter-list"},Yg={key:0,class:"font-medium text-[10px] min-w-[16px] py-0.5 px-[5px] bg-gray-800 text-white leading-3 rounded-full"},Qg=["title"],e_=N.createElementVNode("span",{class:"sr-only"},"Відкрити мапу",-1),t_={class:"flex"},i_={class:"py-[15px] pb-[24px] pl-2"},r_={class:"font-bold text-2xl mr-[10px]"},n_={class:"text-sm text-stone-500 font-medium"},s_=N.createElementVNode("span",{class:"text-sm text-stone-500 font-medium"}," об'єктів",-1),o_={class:"wrapperTable flex flex-col",style:{height:"calc(100vh - 302px)"}},a_={key:0,class:"flex gap-x-2 flex-wrap"},l_={class:"font-medium"},c_=N.createElementVNode("span",{class:"h-3 mx-2 border-s border-gray-200"},null,-1),h_={class:"text-gray-500"},u_=["onClick"],d_={key:0,class:"mb-[10px] py-1 ps-3 pe-1 inline-flex items-center bg-white border border-gray-200 text-gray-800 text-xs rounded-full"},p_=N.createElementVNode("span",{class:"font-medium"}," Очистити ",-1),f_={key:2,class:"text-center py-28"},m_=N.createElementVNode("h2",{class:"font-medium text-base text-gray-500 rounded-xl"}," За вашим запитом даних не знайдено! ",-1),g_=N.createElementVNode("p",{class:"font-normal text-sm text-gray-500 rounded-xl"}," Введіть, будь ласка, інші значення для пошуку. ",-1),__={key:0},y_={key:1,class:"my-5 pr-2"},x_={class:"flex justify-between"},v_={class:"w-2/4"},b_={class:"map-section relative"},w_={ref:"popup",style:{display:"none"}};function S_(f,v,k,P,L,Z){var Oe,ft;const T=N.resolveComponent("VsTextMask"),c=N.resolveComponent("vs-text"),fe=N.resolveComponent("FilterIcon"),me=N.resolveComponent("VsFilterList"),ve=N.resolveComponent("VisibleMapIcon"),le=N.resolveComponent("HiddenMapIcon"),oe=N.resolveComponent("CloseIcon"),ht=N.resolveComponent("NoData"),je=N.resolveComponent("VsPagination"),Ke=N.resolveComponent("MapPortal");return N.openBlock(),N.createElementBlock("section",Xg,[N.createElementVNode("div",null,[N.createElementVNode("div",Wg,[N.createElementVNode("div",Jg,[f.maskForSearch?(N.openBlock(),N.createBlock(T,{key:0,"model-value":f.search,"onUpdate:modelValue":f.handleDebouncedUpdateValue,class:"w-full table-interface-search",placeholder:"Пошук",mask:f.maskForSearch,icon:"search",iconPosition:"left",clearable:"",style:{height:"38px","min-width":"300px","max-width":"300px"},ref:"searchInput"},null,8,["model-value","onUpdate:modelValue","mask"])):f.searchShow?(N.openBlock(),N.createBlock(c,{key:1,"model-value":f.search,"onUpdate:modelValue":f.handleDebouncedUpdateValue,class:"[&>input]:py-[7px] [&>input]:max-h-[38px] [&>input]:w-[220px] [&>input]:ps-10 [&>input]:pe-8 [&>input]:block [&>input]:w-full [&>input]:bg-gray-100 [&>input]:border-transparent [&>input]:rounded-lg [&>input]:text-sm [&>input]:focus:bg-white [&>input]:focus:border-blue-500 [&>input]:focus:ring-blue-500 [&>input]:disabled:opacity-50 [&>input]:disabled:pointer-events-none [&>input]:dark:bg-neutral-700 [&>input]:dark:border-transparent [&>input]:dark:text-neutral-400 [&>input]:dark:placeholder:text-neutral-400 dark:focus:bg-neutral-800 dark:focus:ring-neutral-600",placeholder:"Пошук",icon:"search","icon-position":"left",clearable:"",style:{height:"38px"},ref:"searchInput"},null,8,["model-value","onUpdate:modelValue"])):N.createCommentVNode("",!0),N.createElementVNode("div",Kg,[f.filters?(N.openBlock(),N.createBlock(me,{key:0,ref:"filter",modelValue:f.mountedFilter,"onUpdate:modelValue":v[0]||(v[0]=st=>f.mountedFilter=st),scheme:f.filters,isDialog:(Oe=f.filters)==null?void 0:Oe.some(st=>!(st!=null&&st.inline)),"apply-vue-router":"",history:"",view:"plain",clearable:!1,name:"filter",onFilterChange:v[1]||(v[1]=async st=>{await f.handleFilterChange(st),await f.updateTableAndMap()})},{button:N.withCtx(({visible:st})=>[N.createElementVNode("button",{type:"button",class:N.normalizeClass(["py-2 px-2.5 h-[40px] inline-flex items-center gap-x-1.5 text-sm font-medium rounded-lg bg-white text-gray-800 hover:bg-gray-50 focus:outline-none focus:bg-gray-50",[st?"border border-blue-600 border-2":"border border-gray-200"]])},[N.createVNode(fe),N.createTextVNode(" Фільтри "),f.activeFiltersCount>=1?(N.openBlock(),N.createElementBlock("span",Yg,N.toDisplayString(f.activeFiltersCount),1)):N.createCommentVNode("",!0)],2)]),_:1},8,["modelValue","scheme","isDialog"])):N.createCommentVNode("",!0)])]),N.createElementVNode("button",{type:"button",class:"py-2 px-2 inline-flex items-center gap-x-1.5 text-sm rounded-lg border border-gray-200 bg-white text-gray-600 shadow-sm hover:bg-stone-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-100",title:f.isMapVisible?"Приховати карту":"Показати карту",onClick:v[2]||(v[2]=(...st)=>f.toggleMapVisible&&f.toggleMapVisible(...st))},[f.isMapVisible?(N.openBlock(),N.createBlock(ve,{key:0})):(N.openBlock(),N.createBlock(le,{key:1})),e_],8,Qg)]),N.createElementVNode("div",t_,[N.createElementVNode("div",{class:N.normalizeClass(["relative overflow-hidden",f.isMapVisible?"w-2/4 mr-0":"w-full mr-3",f.isSelectObj?"hidden":""])},[N.createElementVNode("h1",i_,[N.createElementVNode("span",r_,N.toDisplayString(f.title),1),N.createElementVNode("span",n_,N.toDisplayString(f.total),1),s_]),N.createElementVNode("div",o_,[f.activeFilters?(N.openBlock(),N.createElementBlock("div",a_,[(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(f.activeFilters,(st,He,Ft)=>(N.openBlock(),N.createElementBlock("span",{class:"mb-[10px] py-1 ps-3 pe-1 inline-flex items-center bg-white border border-gray-200 text-gray-800 text-xs rounded-full",key:Ft},[N.createElementVNode("span",l_,N.toDisplayString(f.getLabelById(He)),1),c_,N.createElementVNode("span",h_,N.toDisplayString(f.getOptionsLabelById(He,st)),1),N.createElementVNode("button",{type:"button",class:"inline-flex shrink-0 justify-center items-center size-5 ms-1 rounded-full text-gray-600 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 text-sm",onClick:wt=>f.clearFilter(He)},[N.createVNode(oe)],8,u_)]))),128)),((ft=Object.keys(f.activeFilters))==null?void 0:ft.length)>=2?(N.openBlock(),N.createElementBlock("span",d_,[p_,N.createElementVNode("button",{type:"button",class:"inline-flex shrink-0 justify-center items-center size-5 ms-1 rounded-full text-gray-600 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 text-sm",onClick:v[3]||(v[3]=st=>f.mountedFilter={})},[N.createVNode(oe)])])):N.createCommentVNode("",!0)])):N.createCommentVNode("",!0),f.total>=1?N.renderSlot(f.$slots,"table",{key:1,rows:f.tableData,map:f.map,marker:f.marker,selectRow:f.selectRow,getData:f.getData,addGeomMarker:f.addGeomMarker,isMapVisible:f.isMapVisible}):(N.openBlock(),N.createElementBlock("div",f_,[N.createVNode(ht),m_,g_,N.createElementVNode("button",{type:"button",class:"mt-[10px] py-2 px-2.5 inline-flex items-center gap-x-1.5 text-xs rounded-lg border border-stone-200 bg-white text-stone-800 shadow-sm hover:bg-stone-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-stone-100",onClick:v[4]||(v[4]=(...st)=>f.resetFilters&&f.resetFilters(...st))}," Очистити дані пошуку ")]))]),f.total>=1?(N.openBlock(),N.createElementBlock("hr",__)):N.createCommentVNode("",!0),f.total>=1?(N.openBlock(),N.createElementBlock("div",y_,[N.createElementVNode("div",x_,[N.createVNode(je,{total:f.total,maxPages:7,defaultPage:f.currentPage,pageSize:f.limit,goTo:!1,size:"medium",onPageChange:f.handlePageChange,backgroundColor:"#e5e7eb",borderedCellSelected:!0,pageSizes:[10,20,30],onPageSizeChange:f.changeLimit},null,8,["total","defaultPage","pageSize","onPageChange","onPageSizeChange"])])])):N.createCommentVNode("",!0)],2),f.isSelectObj?(N.openBlock(),N.createElementBlock("div",{key:0,class:N.normalizeClass(f.isMapVisible?"w-2/4 mr-0 pb-5":"w-full pb-5 mr-3"),style:{height:"calc(100vh - 152px)"}},[N.renderSlot(f.$slots,"details",{table:f.table,selectedId:f.selectedId,selectedRow:f.selectedRow,map:f.map,closeObjCard:f.closeObjCard,isMapVisible:f.isMapVisible})],2)):N.createCommentVNode("",!0),N.withDirectives(N.createElementVNode("div",v_,[N.createElementVNode("section",b_,[N.renderSlot(f.$slots,"default",{map:f.map,removeSelectedBaseLayer:f.removeSelectedBaseLayer,selectedBaseLayer:f.selectedBaseLayer}),N.createVNode(Ke,{height:"calc(100vh - 152px)",width:"w-2/4",table:f.table,filtersParam:f.filtersParam,row:f.selectedRow,legendname:f.legendname,legend:f.legend,compareLayers:f.compareLayers,colorAttr:f.colorAttr,strokeAttr:f.strokeAttr,maxBounds:f.maxBounds,center:f.center,zoom:f.zoom,minZoom:f.minZoom,basemap:f.basemap,additionalLayers:f.additionalLayers,pointZoom:f.pointZoom,defaultColor:f.defaultColor,onMap:v[5]||(v[5]=st=>f.map=st),selectedBaseLayer:f.selectedBaseLayer,"onUpdate:selectedBaseLayer":v[6]||(v[6]=st=>f.selectedBaseLayer=st)},null,8,["table","filtersParam","row","legendname","legend","compareLayers","colorAttr","strokeAttr","maxBounds","center","zoom","minZoom","basemap","additionalLayers","pointZoom","defaultColor","selectedBaseLayer"])])],512),[[N.vShow,f.isMapVisible]])]),N.createElementVNode("div",w_,[N.renderSlot(f.$slots,"popup",{data:f.hoverData})],512)])])}const Zu=Fi(Hg,[["render",S_]]),Gu={install:f=>{f.component("VsPartsMap",Zu)},components:{VsPartsMap:Zu}};return typeof window<"u"&&(window.PartsMap=Gu),Gu});
|