1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[972],{94455:function(e){e.exports=function(){"use strict";var e={},t={};function i(i,r,a){if(t[i]=a,"index"===i){var n="var sharedModule = {}; ("+t.shared+")(sharedModule); ("+t.worker+")(sharedModule);",s={};return t.shared(s),t.index(e,s),"u">typeof window&&e.setWorkerUrl(window.URL.createObjectURL(new Blob([n],{type:"text/javascript"}))),e}}return i("shared",["exports"],function(e){let t,i,r,a,n,s,o,l,h,u,c,d,p,f,m,_,g,y,x;function v(e,t,i,r){return new(i||(i=Promise))(function(a,n){function s(e){try{l(r.next(e))}catch(e){n(e)}}function o(e){try{l(r.throw(e))}catch(e){n(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof i?t:new i(function(e){e(t)})).then(s,o)}l((r=r.apply(e,t||[])).next())})}function b(e,t){this.x=e,this.y=t}function w(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}"function"==typeof SuppressedError&&SuppressedError,b.prototype={clone(){return new b(this.x,this.y)},add(e){return this.clone()._add(e)},sub(e){return this.clone()._sub(e)},multByPoint(e){return this.clone()._multByPoint(e)},divByPoint(e){return this.clone()._divByPoint(e)},mult(e){return this.clone()._mult(e)},div(e){return this.clone()._div(e)},rotate(e){return this.clone()._rotate(e)},rotateAround(e,t){return this.clone()._rotateAround(e,t)},matMult(e){return this.clone()._matMult(e)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(e){return this.x===e.x&&this.y===e.y},dist(e){return Math.sqrt(this.distSqr(e))},distSqr(e){let t=e.x-this.x,i=e.y-this.y;return t*t+i*i},angle(){return Math.atan2(this.y,this.x)},angleTo(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith(e){return this.angleWithSep(e.x,e.y)},angleWithSep(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult(e){let t=e[2]*this.x+e[3]*this.y;return this.x=e[0]*this.x+e[1]*this.y,this.y=t,this},_add(e){return this.x+=e.x,this.y+=e.y,this},_sub(e){return this.x-=e.x,this.y-=e.y,this},_mult(e){return this.x*=e,this.y*=e,this},_div(e){return this.x/=e,this.y/=e,this},_multByPoint(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint(e){return this.x/=e.x,this.y/=e.y,this},_unit(){return this._div(this.mag()),this},_perp(){let e=this.y;return this.y=this.x,this.x=-e,this},_rotate(e){let t=Math.cos(e),i=Math.sin(e),r=i*this.x+t*this.y;return this.x=t*this.x-i*this.y,this.y=r,this},_rotateAround(e,t){let i=Math.cos(e),r=Math.sin(e),a=t.y+r*(this.x-t.x)+i*(this.y-t.y);return this.x=t.x+i*(this.x-t.x)-r*(this.y-t.y),this.y=a,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:b},b.convert=function(e){if(e instanceof b)return e;if(Array.isArray(e))return new b(+e[0],+e[1]);if(void 0!==e.x&&void 0!==e.y)return new b(+e.x,+e.y);throw Error("Expected [x, y] or {x, y} point format")};var T,P,S,M=w(function(){if(t3)return t2;function e(e,t,i,r){this.cx=3*e,this.bx=3*(i-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(r-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=i,this.p2y=r}return t3=1,t2=e,e.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,t){if(void 0===t&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var i=e,r=0;r<8;r++){var a=this.sampleCurveX(i)-e;if(Math.abs(a)<t)return i;var n=this.sampleCurveDerivativeX(i);if(1e-6>Math.abs(n))break;i-=a/n}var s=0,o=1;for(i=e,r=0;r<20&&!(Math.abs((a=this.sampleCurveX(i))-e)<t);r++)e>a?s=i:o=i,i=.5*(o-s)+s;return i},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}},t2}());function C(){return null==t&&(t="u">typeof OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof createImageBitmap),t}function I(){if(null==i&&(i=!1,C())){let e=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(e){for(let t=0;t<25;t++){let i=4*t;e.fillStyle=`rgb(${i},${i+1},${i+2})`,e.fillRect(t%5,Math.floor(t/5),1,1)}let t=e.getImageData(0,0,5,5).data;for(let e=0;e<100;e++)if(e%4!=3&&t[e]!==e){i=!0;break}}}return i||!1}var A="u">typeof Float32Array?Float32Array:Array;function E(){var e=new A(9);return A!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function z(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10
1]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function k(){var e=new A(3);return A!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function D(e){return Math.hypot(e[0],e[1],e[2])}function R(e,t,i){var r=new A(3);return r[0]=e,r[1]=t,r[2]=i,r}function L(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e}function F(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e}function B(e,t,i){var r=t[0],a=t[1],n=t[2],s=i[0],o=i[1],l=i[2];return e[0]=a*l-n*o,e[1]=n*s-r*l,e[2]=r*o-a*s,e}function O(e,t,i){var r=t[0],a=t[1],n=t[2],s=t[3];return e[0]=i[0]*r+i[4]*a+i[8]*n+i[12]*s,e[1]=i[1]*r+i[5]*a+i[9]*n+i[13]*s,e[2]=i[2]*r+i[6]*a+i[10]*n+i[14]*s,e[3]=i[3]*r+i[7]*a+i[11]*n+i[15]*s,e}function j(){var e=new A(4);return A!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function V(e,t,i,r){var a=.5*Math.PI/180;t*=a,i*=a,r*=a;var n=Math.sin(t),s=Math.cos(t),o=Math.sin(i),l=Math.cos(i),h=Math.sin(r),u=Math.cos(r);return e[0]=n*l*u-s*o*h,e[1]=s*o*u+n*l*h,e[2]=s*l*h-n*o*u,e[3]=s*l*u+n*o*h,e}function U(){var e=new A(2);return A!=Float32Array&&(e[0]=0,e[1]=0),e}function N(e,t){var i=new A(2);return i[0]=e,i[1]=t,i}function $(e,t,i){return t*(8192/(e.tileSize*Math.pow(2,i-e.tileID.overscaledZ)))}function Z(e,t){return(e%t+t)%t}function G(e,t,i){return e*(1-i)+t*i}function q(e){if(e<=0)return 0;if(e>=1)return 1;let t=e*e,i=t*e;return 4*(e<.5?i:3*(e-t)+i-.75)}function W(e,t,i,r){let a=new M(e,t,i,r);return e=>a.solve(e)}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)}),k(),t5=new A(4),A!=Float32Array&&(t5[0]=0,t5[1]=0,t5[2]=0,t5[3]=0),k(),R(1,0,0),R(0,1,0),j(),j(),E(),U();let H=W(.25,.1,.25,1);function X(e,t,i){return Math.min(i,Math.max(t,e))}function Y(e,t,i){let r=i-t,a=((e-t)%r+r)%r+t;return a===t?i:a}function K(e,...t){for(let i of t)for(let t in i)e[t]=i[t];return e}let J=1;function Q(e,t,i){let r={};for(let i in e)r[i]=t.call(this,e[i],i,e);return r}function ee(e,t,i){let r={};for(let i in e)t.call(this,e[i],i,e)&&(r[i]=e[i]);return r}function et(e){return Array.isArray(e)?e.map(et):"object"==typeof e&&e?Q(e,et):e}let ei={};function er(e){ei[e]||("u">typeof console&&console.warn(e),ei[e]=!0)}function ea(e,t,i){return(i.y-e.y)*(t.x-e.x)>(t.y-e.y)*(i.x-e.x)}function en(e){return"u">typeof WorkerGlobalScope&&void 0!==e&&e instanceof WorkerGlobalScope}let es=null;function eo(e){return"u">typeof ImageBitmap&&e instanceof ImageBitmap}let el="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function eh(e,t,i,r,a){return v(this,void 0,void 0,function*(){if("u"<typeof VideoFrame)throw Error("VideoFrame not supported");let n=new VideoFrame(e,{timestamp:0});try{let s,o,l,h,u=null==n?void 0:n.format;if(!u||!u.startsWith("BGR")&&!u.startsWith("RGB"))throw Error(`Unrecognized format ${u}`);let c=u.startsWith("BGR"),d=new Uint8ClampedArray(r*a*4);if(yield n.copyTo(d,(s=4*Math.max(-t,0),o=(Math.max(0,i)-i)*r*4+s,l=Math.max(0,t),h=Math.max(0,i),{rect:{x:l,y:h,width:Math.min(e.width,t+r)-l,height:Math.min(e.height,i+a)-h},layout:[{offset:o,stride:4*r}]})),c)for(let e=0;e<d.length;e+=4){let t=d[e];d[e]=d[e+2],d[e+2]=t}return d}finally{n.close()}})}function eu(e,t,i,r){return e.addEventListener(t,i,r),{unsubscribe:()=>{e.removeEventListener(t,i,r)}}}function ec(e){return e*Math.PI/180}function ed(e){return e/Math.PI*180}let ep={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},ef={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0},em="AbortError";function e_(){return Error(em)}let eg={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function ey(e){return eg.REGISTERED_PROTOCOLS[e.substring(0,e.indexOf("://"))]}let ex="global-dispatcher";class ev extends Error{constructor(e,t,i,r){super(`AJAXError: ${t} (${e}): ${i}`),this.status=e,this.statusText=t,this.url=i,this.body=r}}let eb=()=>en(self)?self.worker&&self.worker.referrer:("blob:"===window.location.protocol?window.parent:window).location.href,ew=function(e,t){var i;if(/:\/\//.test(e.url)&&!/^https?:|^file:/.test(e.url)){let i=ey(e.url);if(i)return i(e,t);if(en(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:e,targetMapId:ex},t)}if(!(/^file:/.test(i=e.url)||/^file:/.test(eb())&&!/^\w+:/.test(i))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(e,t){return v(this,void 0,void 0,function*(){let i,r,a=new Request
1(e.url,{method:e.method||"GET",body:e.body,credentials:e.credentials,headers:e.headers,cache:e.cache,referrer:eb(),signal:t.signal});"json"!==e.type||a.headers.has("Accept")||a.headers.set("Accept","application/json");try{i=yield fetch(a)}catch(t){throw new ev(0,t.message,e.url,new Blob)}if(!i.ok){let t=yield i.blob();throw new ev(i.status,i.statusText,e.url,t)}r="arrayBuffer"===e.type||"image"===e.type?i.arrayBuffer():"json"===e.type?i.json():i.text();let n=yield r;if(t.signal.aborted)throw e_();return{data:n,cacheControl:i.headers.get("Cache-Control"),expires:i.headers.get("Expires")}})}(e,t);if(en(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:e,mustQueue:!0,targetMapId:ex},t)}return new Promise((i,r)=>{var a;let n=new XMLHttpRequest;for(let t in n.open(e.method||"GET",e.url,!0),"arrayBuffer"!==e.type&&"image"!==e.type||(n.responseType="arraybuffer"),e.headers)n.setRequestHeader(t,e.headers[t]);"json"===e.type&&(n.responseType="text",(null==(a=e.headers)?void 0:a.Accept)||n.setRequestHeader("Accept","application/json")),n.withCredentials="include"===e.credentials,n.onerror=()=>{r(Error(n.statusText))},n.onload=()=>{if(!t.signal.aborted)if((n.status>=200&&n.status<300||0===n.status)&&null!==n.response){let t=n.response;if("json"===e.type)try{t=JSON.parse(n.response)}catch(e){return void r(e)}i({data:t,cacheControl:n.getResponseHeader("Cache-Control"),expires:n.getResponseHeader("Expires")})}else{let t=new Blob([n.response],{type:n.getResponseHeader("Content-Type")});r(new ev(n.status,n.statusText,e.url,t))}},t.signal.addEventListener("abort",()=>{n.abort(),r(e_())}),n.send(e.body)})};function eT(e){if(!e||0>=e.indexOf("://")||0===e.indexOf("data:image/")||0===e.indexOf("blob:"))return!0;let t=new URL(e),i=window.location;return t.protocol===i.protocol&&t.host===i.host}function eP(e,t,i){i[e]&&-1!==i[e].indexOf(t)||(i[e]=i[e]||[],i[e].push(t))}function eS(e,t,i){if(i&&i[e]){let r=i[e].indexOf(t);-1!==r&&i[e].splice(r,1)}}class eM{constructor(e,t={}){K(this,t),this.type=e}}class eC extends eM{constructor(e,t={}){super("error",K({error:e},t))}}class eI{on(e,t){return this._listeners=this._listeners||{},eP(e,t,this._listeners),{unsubscribe:()=>{this.off(e,t)}}}off(e,t){return eS(e,t,this._listeners),eS(e,t,this._oneTimeListeners),this}once(e,t){return t?(this._oneTimeListeners=this._oneTimeListeners||{},eP(e,t,this._oneTimeListeners),this):new Promise(t=>this.once(e,t))}fire(e,t){"string"==typeof e&&(e=new eM(e,t||{}));let i=e.type;if(this.listens(i)){for(let t of(e.target=this,this._listeners&&this._listeners[i]?this._listeners[i].slice():[]))t.call(this,e);for(let t of this._oneTimeListeners&&this._oneTimeListeners[i]?this._oneTimeListeners[i].slice():[])eS(i,t,this._oneTimeListeners),t.call(this,e);let t=this._eventedParent;t&&(K(e,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),t.fire(e))}else e instanceof eC&&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,t){return this._eventedParent=e,this._eventedParentData=t,this}}var eA={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},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:{}}
vendor: 16,347 bytes, line 1
1,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:{},"color-relief":{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","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"}},"layout_color-relief":{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:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief
vendor: 12,079 bytes, line 1
1","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
1Array",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};let eE=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function ez(e,t){if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(!ez(e[i],t[i]))return!1;return!0}if("object"==typeof e&&null!==e&&null!==t){if("object"!=typeof t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let i in e)if(!ez(e[i],t[i]))return!1;return!0}return e===t}function ek(e,t){e.push(t)}function eD(e,t,i){ek(i,{command:"addSource",args:[e,t[e]]})}function eR(e,t,i){ek(t,{command:"removeSource",args:[e]}),i[e]=!0}function eL(e,t,i,r,a,n){for(let s in t=t||{},e=e||{})Object.prototype.hasOwnProperty.call(e,s)&&(ez(e[s],t[s])||i.push({command:n,args:[r,s,t[s],a]}));for(let s in t)Object.prototype.hasOwnProperty.call(t,s)&&!Object.prototype.hasOwnProperty.call(e,s)&&(ez(e[s],t[s])||i.push({command:n,args:[r,s,t[s],a]}))}function eF(e){return e.id}function eB(e,t){return e[t.id]=t,e}class eO{constructor(e,t,i,r){this.message=(e?`${e}: `:"")+i,r&&(this.identifier=r),null!=t&&t.__line__&&(this.line=t.__line__)}}function ej(e,...t){for(let i of t)for(let t in i)e[t]=i[t];return e}class eV extends Error{constructor(e,t){super(t),this.message=t,this.key=e}}class eU{constructor(e,t=[]){for(const[i,r]of(this.parent=e,this.bindings={},t))this.bindings[i]=r}concat(e){return new eU(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}let eN={kind:"null"},e$={kind:"number"},eZ={kind:"string"},eG={kind:"boolean"},eq={kind:"color"},eW={kind:"projectionDefinition"},eH={kind:"object"},eX={kind:"value"},eY={kind:"collator"},eK={kind:"formatted"},eJ={kind:"padding"},eQ={kind:"colorArray"},e0={kind:"numberArray"},e1={kind:"resolvedImage"},e2={kind:"variableAnchorOffsetCollection"};function e3(e,t){return{kind:"array",itemType:e,N:t}}function e5(e){if("array"===e.kind){let t=e5(e.itemType);return"number"==typeof e.N?`array<${t}, ${e.N}>`:"value"===e.itemType.kind?"array":`array<${t}>`}return e.kind}let e4=[eN,e$,eZ,eG,eq,eW,eK,eH,e3(eX),eJ,e0,eQ,e1,e2];function e6(e,t){if("error"===t.kind)return null;if("array"===e.kind){if("array"===t.kind&&(0===t.N&&"value"===t.itemType.kind||!e6(e.itemType,t.itemType))&&("number"!=typeof e.N||e.N===t.N))return null}else{if(e.kind===t.kind)return null;if("value"===e.kind){for(let e of e4)if(!e6(e,t))return null}}return`Expected ${e5(e)} but found ${e5(t)} instead.`}function e8(e,t){return t.some(t=>t.kind===e.kind)}function e9(e,t){return t.some(t=>"null"===t?null===e:"array"===t?Array.isArray(e):"object"===t?e&&!Array.isArray(e)&&"object"==typeof e:t===typeof e)}function e7(e,t){return"array"===e.kind&&"array"===t.kind?e.itemType.kind===t.itemType.kind&&"number"==typeof e.N:e.kind===t.kind}let te=4/29,tt=6/29,ti=6/29*3*(6/29),tr=6/29*(6/29)*(6/29),ta=Math.PI/180,tn=180/Math.PI;function ts(e){return(e%=360)<0&&(e+=360),e}function to([e,t,i,r]){let a,n,s=th((.2225045*(e=tl(e))+.7168786*(t=tl(t))+.0606169*(i=tl(i)))/1);
1e===t&&t===i?a=n=s:(a=th((.4360747*e+.3850649*t+.1430804*i)/.96422),n=th((.0139322*e+.0971045*t+.7141733*i)/.82521));let o=116*s-16;return[o<0?0:o,500*(a-s),200*(s-n),r]}function tl(e){return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function th(e){return e>tr?Math.pow(e,1/3):e/ti+te}function tu([e,t,i,r]){let a=(e+16)/116,n=isNaN(t)?a:a+t/500,s=isNaN(i)?a:a-i/200;return a=+td(a),[tc(3.1338561*(n=.96422*td(n))-1.6168667*a-.4906146*(s=.82521*td(s))),tc(-.9787684*n+1.9161415*a+.033454*s),tc(.0719453*n-.2289914*a+1.4052427*s),r]}function tc(e){return(e=e<=.00304?12.92*e:1.055*Math.pow(e,1/2.4)-.055)<0?0:e>1?1:e}function td(e){return e>tt?e*e*e:ti*(e-te)}let tp=Object.hasOwn||function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};function tf(e,t){return tp(e,t)?e[t]:void 0}function tm(e){return parseInt(e.padEnd(2,e),16)/255}function t_(e,t){return tg(t?e/100:e,0,1)}function tg(e,t,i){return Math.min(Math.max(t,e),i)}function ty(e){return!e.some(Number.isNaN)}let tx={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],ol
1ive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function tv(e,t,i){return e.map((e,r)=>e+i*(t[r]-e))}class tb{constructor(e,t,i,r=1,a=!0){this.r=e,this.g=t,this.b=i,this.a=r,a||(this.r*=r,this.g*=r,this.b*=r,r||this.overwriteGetter("rgb",[e,t,i,r]))}static parse(e){if(e instanceof tb)return e;if("string"!=typeof e)return;let t=function(e){if("transparent"===(e=e.toLowerCase().trim()))return[0,0,0,0];let t=tf(tx,e);if(t){let[e,i,r]=t;return[e/255,i/255,r/255,1]}if(e.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(e)){let t=e.length<6?1:2,i=1;return[tm(e.slice(i,i+=t)),tm(e.slice(i,i+=t)),tm(e.slice(i,i+=t)),tm(e.slice(i,i+t)||"ff")]}if(e.startsWith("rgb")){let t=e.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(t){let[e,i,r,a,n,s,o,l,h,u,c,d]=t,p=[a||" ",o||" ",u].join("");if(" "===p||" /"===p||",,"===p||",,,"===p){let e=[r,s,h].join(""),t="%%%"===e?100:255*(""===e);if(t){let e=[tg(i/t,0,1),tg(n/t,0,1),tg(l/t,0,1),c?t_(+c,d):1];if(ty(e))return e}}return}}let i=e.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(i){let[e,t,r,a,n,s,o,l,h]=i,u=[r||" ",n||" ",o].join("");if(" "===u||" /"===u||",,"===u||",,,"===u){let e=[+t,tg(+a,0,100),tg(+s,0,100),l?t_(+l,h):1];if(ty(e))return function([e,t,i,r]){function a(r){let a=(r+e/30)%12,n=t*Math.min(i,1-i);return i-n*Math.max(-1,Math.min(a-3,9-a,1))}return e=ts(e),t/=100,i/=100,[a(0),a(8),a(4),r]}(e)}}}(e);return t?new tb(...t,!1):void 0}get rgb(){let{r:e,g:t,b:i,a:r}=this,a=r||1/0;return this.overwriteGetter("rgb",[e/a,t/a,i/a,r])}get hcl(){return this.overwriteGetter("hcl",function(e){let[t,i,r,a]=to(e),n=Math.sqrt(i*i+r*r);return[Math.round(1e4*n)?ts(Math.atan2(r,i)*tn):NaN,n,t,a]}(this.rgb))}get lab(){return this.overwriteGetter("lab",to(this.rgb))}overwriteGetter(e,t){return Object.defineProperty(this,e,{value:t}),t}toString(){let[e,t,i,r]=this.rgb;return`rgba(${[e,t,i].map(e=>Math.round(255*e)).join(",")},${r})`}static interpolate(e,t,i,r="rgb"){switch(r){case"rgb":{let[r,a,n,s]=tv(e.rgb,t.rgb,i);return new tb(r,a,n,s,!1)}case"hcl":{let r,a,[n,s,o,l]=e.hcl,[h,u,c,d]=t.hcl;if(isNaN(n)||isNaN(h))isNaN(n)?isNaN(h)?r=NaN:(r=h,1!==o&&0!==o||(a=u)):(r=n,1!==c&&0!==c||(a=s));else{let e=h-n;h>n&&e>180?e-=360:h<n&&n-h>180&&(e+=360),r=n+i*e}let[p,f,m,_]=function([e,t,i,r]){return tu([i,Math.cos(e=isNaN(e)?0:e*ta)*t,Math.sin(e)*t,r])}([r,null!=a?a:s+i*(u-s),o+i*(c-o),l+i*(d-l)]);return new tb(p,f,m,_,!1)}case"lab":{let[r,a,n,s]=tu(tv(e.lab,t.lab,i));return new tb(r,a,n,s,!1)}}}}tb.black=new tb(0,0,0,1),tb.white=new tb(1,1,1,1),tb.transparent=new tb(0,0,0,0),tb.red=new tb(1,0,0,1);class tw{constructor(e,t,i){this.sensitivity=e?t?"variant":"case":t?"accent":"base",this.locale=i,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,t){return this.collator.compare(e,t)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}let tT=["bottom","center","top"];class tP{constructor(e,t,i,r,a,n){this.text=e,this.image=t,this.scale=i,this.fontStack=r,this.textColor=a,this.verticalAlign=n}}class tS{constructor(e){this.sections=e}static fromString(e){return new tS([new tP(e,null,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some(e=>0!==e.text.length||e.image&&0!==e.image.name.length)}static factory(e){return e instanceof tS?e:tS.fromString(e)}toString(){return 0===this.sections.length?"":this.sections.map(e=>e.text).join("")}}class tM{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof tM)return e;if("number"==typeof e)return new tM([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(let t of e)if("number"!=typeof t)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 tM(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,i){return new tM(tv(e.values,t.values,i))}}class tC{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof tC)return e;if("number"==typeof e)return new tC([e]);if(Array.isArray(e)){for(let t of e)if("number"!=typeof t)return;return new tC(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,i){return new tC(tv(e.values,t.values,i))}}class tI{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof tI)return e;if("string"==typeof e){let t=tb.parse(e);if(!t)return;return new tI([t])}if(!Array.isArray(e))return;let t=[];for(let i of e){if("string"!=typeof i)return;let e=tb.parse(i);if(!e)return;t.push(e)}return new tI(t)}toString(){return JSON.stringify(this.values)}static interpolate(e,t,i,r="rgb"){let a=[];if(e.values.length!=t.values.length)throw Error(`colorArray: Arrays have mismatched length (${e.values.length} vs. ${t.values.length}), cannot interpolate.`);for(let n=0;n<e.values.length;n++)a.push(tb.interpolate(e.values[n],t.values[n],i,r));return new tI(a)}}
1class tA extends Error{constructor(e){super(e),this.name="RuntimeError"}toJSON(){return this.message}}let tE=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class tz{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof tz)return e;if(Array.isArray(e)&&!(e.length<1)&&e.length%2==0){for(let t=0;t<e.length;t+=2){let i=e[t],r=e[t+1];if("string"!=typeof i||!tE.has(i)||!Array.isArray(r)||2!==r.length||"number"!=typeof r[0]||"number"!=typeof r[1])return}return new tz(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,i){let r=e.values,a=t.values;if(r.length!==a.length)throw new tA(`Cannot interpolate values of different length. from: ${e.toString()}, to: ${t.toString()}`);let n=[];for(let e=0;e<r.length;e+=2){if(r[e]!==a[e])throw new tA(`Cannot interpolate values containing mismatched anchors. from[${e}]: ${r[e]}, to[${e}]: ${a[e]}`);n.push(r[e]);let[t,s]=r[e+1],[o,l]=a[e+1];n.push([t+i*(o-t),s+i*(l-s)])}return new tz(n)}}class tk{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new tk({name:e,available:!1}):null}}class tD{constructor(e,t,i){this.from=e,this.to=t,this.transition=i}static interpolate(e,t,i){return new tD(e,t,i)}static parse(e){return e instanceof tD?e:Array.isArray(e)&&3===e.length&&"string"==typeof e[0]&&"string"==typeof e[1]&&"number"==typeof e[2]?new tD(e[0],e[1],e[2]):"object"==typeof e&&"string"==typeof e.from&&"string"==typeof e.to&&"number"==typeof e.transition?new tD(e.from,e.to,e.transition):"string"==typeof e?new tD(e,e,1):void 0}}function tR(e,t,i,r){return"number"==typeof e&&e>=0&&e<=255&&"number"==typeof t&&t>=0&&t<=255&&"number"==typeof i&&i>=0&&i<=255?void 0===r||"number"==typeof r&&r>=0&&r<=1?null:`Invalid rgba value [${[e,t,i,r].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof r?[e,t,i,r]:[e,t,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function tL(e){if(null===e||"string"==typeof e||"boolean"==typeof e||"number"==typeof e||e instanceof tD||e instanceof tb||e instanceof tw||e instanceof tS||e instanceof tM||e instanceof tC||e instanceof tI||e instanceof tz||e instanceof tk)return!0;if(Array.isArray(e)){for(let t of e)if(!tL(t))return!1;return!0}if("object"==typeof e){for(let t in e)if(!tL(e[t]))return!1;return!0}return!1}function tF(e){if(null===e)return eN;if("string"==typeof e)return eZ;if("boolean"==typeof e)return eG;if("number"==typeof e)return e$;if(e instanceof tb)return eq;if(e instanceof tD)return eW;if(e instanceof tw)return eY;if(e instanceof tS)return eK;if(e instanceof tM)return eJ;if(e instanceof tC)return e0;if(e instanceof tI)return eQ;if(e instanceof tz)return e2;if(e instanceof tk)return e1;if(Array.isArray(e)){let t,i=e.length;for(let i of e){let e=tF(i);if(t){if(t===e)continue;t=eX;break}t=e}return e3(t||eX,i)}return eH}function tB(e){let t=typeof e;return null===e?"":"string"===t||"number"===t||"boolean"===t?String(e):e instanceof tb||e instanceof tD||e instanceof tS||e instanceof tM||e instanceof tC||e instanceof tI||e instanceof tz||e instanceof tk?e.toString():JSON.stringify(e)}class tO{constructor(e,t){this.type=e,this.value=t}static parse(e,t){if(2!==e.length)return t.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!tL(e[1]))return t.error("invalid value");let i=e[1],r=tF(i),a=t.expectedType;return"array"===r.kind&&0===r.N&&a&&"array"===a.kind&&("number"!=typeof a.N||0===a.N)&&(r=a),new tO(r,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}let tj={string:eZ,number:e$,boolean:eG,object:eH};class tV{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let i,r=1,a=e[0];if("array"===a){let a,n;if(e.length>2){let i=e[1];if("string"!=typeof i||!(i in tj)||"object"===i)return t.error('The item type argument of "array" must be one of string, number, boolean',1);a=tj[i],r++}else a=eX;if(e.length>3){if(null!==e[2]&&("number"!=typeof e[2]||e[2]<0||e[2]!==Math.floor(e[2])))return t.error('The length argument to "array" must be a positive integer literal',2);n=e[2],r++}i=e3(a,n)}else{if(!tj[a])throw Error(`Types doesn't contain name = ${a}`);i=tj[a]}let n=[];for(;r<e.length;r++){let i=t.parse(e[r],r,eX);if(!i)return null;n.push(i)}return new tV(i,n)}evaluate(e){for(let t=0;t<this.args.length;t++){let i=this.args[t].evaluate(e);if(!e6(this.type,tF(i)))return i;if(t===this.args.length-1)throw new tA(`Expected value to be of type ${e5(this.type)}, but found ${e5(tF(i))} instead.`)}throw Error()}
1eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}let tU={"to-boolean":eG,"to-color":eq,"to-number":e$,"to-string":eZ};class tN{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let i=e[0];if(!tU[i])throw Error(`Can't parse ${i} as it is not part of the known types`);if(("to-boolean"===i||"to-string"===i)&&2!==e.length)return t.error("Expected one argument.");let r=tU[i],a=[];for(let i=1;i<e.length;i++){let r=t.parse(e[i],i,eX);if(!r)return null;a.push(r)}return new tN(r,a)}evaluate(e){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(e);case"color":{let t,i;for(let r of this.args){if(t=r.evaluate(e),i=null,t instanceof tb)return t;if("string"==typeof t){let i=e.parseColor(t);if(i)return i}else if(Array.isArray(t)&&!(i=t.length<3||t.length>4?`Invalid rgba value ${JSON.stringify(t)}: expected an array containing either three or four numeric values.`:tR(t[0],t[1],t[2],t[3])))return new tb(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new tA(i||`Could not parse color from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"padding":{let t;for(let i of this.args){t=i.evaluate(e);let r=tM.parse(t);if(r)return r}throw new tA(`Could not parse padding from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"numberArray":{let t;for(let i of this.args){t=i.evaluate(e);let r=tC.parse(t);if(r)return r}throw new tA(`Could not parse numberArray from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"colorArray":{let t;for(let i of this.args){t=i.evaluate(e);let r=tI.parse(t);if(r)return r}throw new tA(`Could not parse colorArray from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"variableAnchorOffsetCollection":{let t;for(let i of this.args){t=i.evaluate(e);let r=tz.parse(t);if(r)return r}throw new tA(`Could not parse variableAnchorOffsetCollection from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"number":{let t=null;for(let i of this.args){if(null===(t=i.evaluate(e)))return 0;let r=Number(t);if(!isNaN(r))return r}throw new tA(`Could not convert ${JSON.stringify(t)} to number.`)}case"formatted":return tS.fromString(tB(this.args[0].evaluate(e)));case"resolvedImage":return tk.fromString(tB(this.args[0].evaluate(e)));case"projectionDefinition":return this.args[0].evaluate(e);default:return tB(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}let t$=["Unknown","Point","LineString","Polygon"];class tZ{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?t$[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 t=this._parseColorCache.get(e);return t||(t=tb.parse(e),this._parseColorCache.set(e,t)),t}}class tG{constructor(e,t,i=[],r,a=new eU,n=[]){this.registry=e,this.path=i,this.key=i.map(e=>`[${e}]`).join(""),this.scope=a,this.errors=n,this.expectedType=r,this._isConstant=t}parse(e,t,i,r,a={}){return t?this.concat(t,i,r)._parse(e,a):this._parse(e,a)}_parse(e,t){function i(e,t,i){return"assert"===i?new tV(t,[e]):"coerce"===i?new tN(t,[e]):e}if(null!==e&&"string"!=typeof e&&"boolean"!=typeof e&&"number"!=typeof e||(e=["literal",e]),Array.isArray(e)){if(0===e.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');let r=e[0];if("string"!=typeof r)return this.error(`Expression name must be a string, but found ${typeof r} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;let a=this.registry[r];if(a){let r=a.parse(e,this);if(!r)return null;if(this.expectedType){let e=this.expectedType,a=r.type;if("string"!==e.kind&&"number"!==e.kind&&"boolean"!==e.kind&&"object"!==e.kind&&"array"!==e.kind||"value"!==a.kind){if("projectionDefinition"===e.kind&&["string","array"].includes(a.kind)||["color","formatted","resolvedImage"].includes(e.kind)&&["value","string"].includes(a.kind)||["padding","numberArray"].includes(e.kind)&&["value","number","array"].includes(a.kind)||"colorArray"===e.kind&&["value","string","array"].includes(a.kind)||"variableAnchorOffsetCollection"===e.kind&&["value","array"].includes(a.kind))r=i(r,e,t.typeAnnotation||"coerce");else if(this.checkSubtype(e,a))return null}else r=i(r,e,t.typeAnnotation||"assert")}if(!(r instanceof tO)&&"resolvedImage"!==r.type.kind&&this._isConstant(r)){let e=new tZ;try{r=new tO(r.type,r.evaluate(e))}catch(e){return this.error(e.message),null}}return r}return this.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(void 0===e?"'undefined' value invalid. Use null instead.":"object"==typeof e?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,t,i){let r="number"==typeof e?this.path.concat(e):this.path,a=i?this.scope.concat(i):this.scope;return new tG(this.registry,this._isConstant,r,t||null,a,this.errors)}error(e,...t){let i=`${this.key}${t.map(e=>`[${e}]`).join("")}`;this.errors.push(new eV(i,e))}checkSubtype(e,t){let i=e6(e,t);return i&&this.error(i),i}}class tq{constructor(e,t){this.type=t.type,this.bindings=[].concat(e),this.result=t}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(let t of this.bindings)e(t[1]);e(this.result)}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);let i=[];for(let r=1;r<e.length-1;r+=2){let a=e[r];if("string"!=typeof a)return t.error(`Expected string, but found ${typeof a} instead.`,r);if(/[^a-zA-Z0-9_]/.test(a))return t.error("Variable names must contain only alphanumeric characters or '_'.",r);let n=t.parse(e[r+1],r+1);if(!n)return null;i.push([a,n])}let r=t.parse(e[e.length-1],e.length-1,t.expectedType,i);return r?new tq(i,r):null}outputDefined(){return this.result.outputDefined()}}class tW{constructor(e,t){this.type=t.type,this.name=e,this.boundExpression=t}static parse(e,t){if(2!==e.length||"string"!=typeof e[1])return t.error("'var' expression requires exactly one string literal argument.");let i=e[1];return t.scope.has(i)?new tW(i,t.scope.get(i)):t.error(`Unknown variable "${i}". Make sure "${i}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}}class tH{constructor(e,t,i){this.type=e,this.index=t,this.input=i}static parse(e,t){if(3!==e.length)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let i=t.parse(e[1],1,e$),r=t.parse(e[2],2,e3(t.expectedType||eX));return i&&r?new tH(r.type.itemType,i,r):null}evaluate(e){let t=this.index.evaluate(e),i=this.input.evaluate(e);if(t<0)throw new tA(`Array index out of bounds: ${t} < 0.`);if(t>=i.length)throw new tA(`Array index out of bounds: ${t} > ${i.length-1}.`);if(t!==Math.floor(t))throw new tA(`Array index must be an integer, but found ${t} instead.`);return i[t]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class tX{constructor(e,t){this.type=eG,this.needle=e,this.haystack=t}static parse(e,t){if(3!==e.length)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);
1let i=t.parse(e[1],1,eX),r=t.parse(e[2],2,eX);return i&&r?e8(i.type,[eG,eZ,e$,eN,eX])?new tX(i,r):t.error(`Expected first argument to be of type boolean, string, number or null, but found ${e5(i.type)} instead`):null}evaluate(e){let t=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(!i)return!1;if(!e9(t,["boolean","string","number","null"]))throw new tA(`Expected first argument to be of type boolean, string, number or null, but found ${e5(tF(t))} instead.`);if(!e9(i,["string","array"]))throw new tA(`Expected second argument to be of type array or string, but found ${e5(tF(i))} instead.`);return i.indexOf(t)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class tY{constructor(e,t,i){this.type=e$,this.needle=e,this.haystack=t,this.fromIndex=i}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);let i=t.parse(e[1],1,eX),r=t.parse(e[2],2,eX);if(!i||!r)return null;if(!e8(i.type,[eG,eZ,e$,eN,eX]))return t.error(`Expected first argument to be of type boolean, string, number or null, but found ${e5(i.type)} instead`);if(4===e.length){let a=t.parse(e[3],3,e$);return a?new tY(i,r,a):null}return new tY(i,r)}evaluate(e){let t,i=this.needle.evaluate(e),r=this.haystack.evaluate(e);if(!e9(i,["boolean","string","number","null"]))throw new tA(`Expected first argument to be of type boolean, string, number or null, but found ${e5(tF(i))} instead.`);if(this.fromIndex&&(t=this.fromIndex.evaluate(e)),e9(r,["string"])){let e=r.indexOf(i,t);return -1===e?-1:[...r.slice(0,e)].length}if(e9(r,["array"]))return r.indexOf(i,t);throw new tA(`Expected second argument to be of type array or string, but found ${e5(tF(r))} instead.`)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class tK{constructor(e,t,i,r,a,n){this.inputType=e,this.type=t,this.input=i,this.cases=r,this.outputs=a,this.otherwise=n}static parse(e,t){let i,r;if(e.length<5)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return t.error("Expected an even number of arguments.");t.expectedType&&"value"!==t.expectedType.kind&&(r=t.expectedType);let a={},n=[];for(let s=2;s<e.length-1;s+=2){let o=e[s],l=e[s+1];Array.isArray(o)||(o=[o]);let h=t.concat(s);if(0===o.length)return h.error("Expected at least one branch label.");for(let e of o){if("number"!=typeof e&&"string"!=typeof e)return h.error("Branch labels must be numbers or strings.");if("number"==typeof e&&Math.abs(e)>Number.MAX_SAFE_INTEGER)return h.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof e&&Math.floor(e)!==e)return h.error("Numeric branch labels must be integer values.");if(i){if(h.checkSubtype(i,tF(e)))return null}else i=tF(e);if(void 0!==a[String(e)])return h.error("Branch labels must be unique.");a[String(e)]=n.length}let u=t.parse(l,s,r);if(!u)return null;r=r||u.type,n.push(u)}let s=t.parse(e[1],1,eX);if(!s)return null;let o=t.parse(e[e.length-1],e.length-1,r);return o?"value"!==s.type.kind&&t.concat(1).checkSubtype(i,s.type)?null:new tK(i,r,s,a,n,o):null}evaluate(e){let t=this.input.evaluate(e);return(tF(t)===this.inputType&&this.outputs[this.cases[t]]||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 tJ{constructor(e,t,i){this.type=e,this.branches=t,this.otherwise=i}static parse(e,t){let i;if(e.length<4)return t.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return t.error("Expected an odd number of arguments.");t.expectedType&&"value"!==t.expectedType.kind&&(i=t.expectedType);let r=[];for(let a=1;a<e.length-1;a+=2){let n=t.parse(e[a],a,eG);if(!n)return null;let s=t.parse(e[a+1],a+1,i);if(!s)return null;r.push([n,s]),i=i||s.type}let a=t.parse(e[e.length-1],e.length-1,i);if(!a)return null;if(!i)throw Error("Can't infer output type");return new tJ(i,r,a)}evaluate(e){for(let[t,i]of this.branches)if(t.evaluate(e))return i.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(let[t,i]of this.branches)e(t),e(i);e(this.otherwise)}outputDefined(){return this.branches.every(([e,t])=>t.outputDefined())&&this.otherwise.outputDefined()}}class tQ{constructor(e,t,i,r){this.type=e,this.input=t,this.beginIndex=i,this.endIndex=r}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);
1let i=t.parse(e[1],1,eX),r=t.parse(e[2],2,e$);if(!i||!r)return null;if(!e8(i.type,[e3(eX),eZ,eX]))return t.error(`Expected first argument to be of type array or string, but found ${e5(i.type)} instead`);if(4===e.length){let a=t.parse(e[3],3,e$);return a?new tQ(i.type,i,r,a):null}return new tQ(i.type,i,r)}evaluate(e){let t,i=this.input.evaluate(e),r=this.beginIndex.evaluate(e);if(this.endIndex&&(t=this.endIndex.evaluate(e)),e9(i,["string"]))return[...i].slice(r,t).join("");if(e9(i,["array"]))return i.slice(r,t);throw new tA(`Expected first argument to be of type array or string, but found ${e5(tF(i))} instead.`)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function t0(e,t){let i=e.length-1,r,a,n=0,s=i,o=0;for(;n<=s;)if(r=e[o=Math.floor((n+s)/2)],a=e[o+1],r<=t){if(o===i||t<a)return o;n=o+1}else{if(!(r>t))throw new tA("Input is not a number.");s=o-1}return 0}class t1{constructor(e,t,i){for(const[r,a]of(this.type=e,this.input=t,this.labels=[],this.outputs=[],i))this.labels.push(r),this.outputs.push(a)}static parse(e,t){if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return t.error("Expected an even number of arguments.");let i=t.parse(e[1],1,e$);if(!i)return null;let r=[],a=null;t.expectedType&&"value"!==t.expectedType.kind&&(a=t.expectedType);for(let i=1;i<e.length;i+=2){let n=1===i?-1/0:e[i],s=e[i+1],o=i,l=i+1;if("number"!=typeof n)return t.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',o);if(r.length&&r[r.length-1][0]>=n)return t.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',o);let h=t.parse(s,l,a);if(!h)return null;a=a||h.type,r.push([n,h])}return new t1(a,i,r)}evaluate(e){let t=this.labels,i=this.outputs;if(1===t.length)return i[0].evaluate(e);let r=this.input.evaluate(e);if(r<=t[0])return i[0].evaluate(e);let a=t.length;return r>=t[a-1]?i[a-1].evaluate(e):i[t0(t,r)].evaluate(e)}eachChild(e){for(let t of(e(this.input),this.outputs))e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}var t2,t3,t5,t4,t6,t8,t9=(t4=function(){if(t8)return t6;function e(e,t,i,r){this.cx=3*e,this.bx=3*(i-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(r-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=i,this.p2y=r}return t8=1,t6=e,e.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,t){if(void 0===t&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var i=e,r=0;r<8;r++){var a=this.sampleCurveX(i)-e;if(Math.abs(a)<t)return i;var n=this.sampleCurveDerivativeX(i);if(1e-6>Math.abs(n))break;i-=a/n}var s=0,o=1;for(i=e,r=0;r<20&&!(Math.abs((a=this.sampleCurveX(i))-e)<t);r++)e>a?s=i:o=i,i=.5*(o-s)+s;return i},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}},t6}())&&t4.__esModule&&Object.prototype.hasOwnProperty.call(t4,"default")?t4.default:t4;class t7{constructor(e,t,i,r,a){for(const[n,s]of(this.type=e,this.operator=t,this.interpolation=i,this.input=r,this.labels=[],this.outputs=[],a))this.labels.push(n),this.outputs.push(s)}static interpolationFactor(e,t,i,r){let a=0;if("exponential"===e.name)a=ie(t,e.base,i,r);else if("linear"===e.name)a=ie(t,1,i,r);else if("cubic-bezier"===e.name){let n=e.controlPoints;a=new t9(n[0],n[1],n[2],n[3]).solve(ie(t,1,i,r))}return a}static parse(e,t){let[i,r,a,...n]=e;if(!Array.isArray(r)||0===r.length)return t.error("Expected an interpolation type expression.",1);if("linear"===r[0])r={name:"linear"};else if("exponential"===r[0]){let e=r[1];if("number"!=typeof e)return t.error("Exponential interpolation requires a numeric base.",1,1);r={name:"exponential",base:e}}else{if("cubic-bezier"!==r[0])return t.error(`Unknown interpolation type ${String(r[0])}`,1,0);{let e=r.slice(1);if(4!==e.length||e.some(e=>"number"!=typeof e||e<0||e>1))return t.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);r={name:"cubic-bezier",controlPoints:e}}}if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return t.error("Expected an even number of arguments.");if(!(a=t.parse(a,2,e$)))return null;let s=[],o=null;"interpolate-hcl"!==i&&"interpolate-lab"!==i||t.expectedType==eQ?t.expectedType&&"value"!==t.expectedType.kind&&(o=t.expectedType):o=eq;
1for(let e=0;e<n.length;e+=2){let i=n[e],r=n[e+1],a=e+3,l=e+4;if("number"!=typeof i)return t.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',a);if(s.length&&s[s.length-1][0]>=i)return t.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',a);let h=t.parse(r,l,o);if(!h)return null;o=o||h.type,s.push([i,h])}return e7(o,e$)||e7(o,eW)||e7(o,eq)||e7(o,eJ)||e7(o,e0)||e7(o,eQ)||e7(o,e2)||e7(o,e3(e$))?new t7(o,i,r,a,s):t.error(`Type ${e5(o)} is not interpolatable.`)}evaluate(e){let t=this.labels,i=this.outputs;if(1===t.length)return i[0].evaluate(e);let r=this.input.evaluate(e);if(r<=t[0])return i[0].evaluate(e);let a=t.length;if(r>=t[a-1])return i[a-1].evaluate(e);let n=t0(t,r),s=t7.interpolationFactor(this.interpolation,r,t[n],t[n+1]),o=i[n].evaluate(e),l=i[n+1].evaluate(e);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return o+s*(l-o);case"color":return tb.interpolate(o,l,s);case"padding":return tM.interpolate(o,l,s);case"colorArray":return tI.interpolate(o,l,s);case"numberArray":return tC.interpolate(o,l,s);case"variableAnchorOffsetCollection":return tz.interpolate(o,l,s);case"array":return tv(o,l,s);case"projectionDefinition":return tD.interpolate(o,l,s)}case"interpolate-hcl":switch(this.type.kind){case"color":return tb.interpolate(o,l,s,"hcl");case"colorArray":return tI.interpolate(o,l,s,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return tb.interpolate(o,l,s,"lab");case"colorArray":return tI.interpolate(o,l,s,"lab")}}}eachChild(e){for(let t of(e(this.input),this.outputs))e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function ie(e,t,i,r){let a=r-i,n=e-i;return 0===a?0:1===t?n/a:(Math.pow(t,n)-1)/(Math.pow(t,a)-1)}let it={color:tb.interpolate,number:function(e,t,i){return e+i*(t-e)},padding:tM.interpolate,numberArray:tC.interpolate,colorArray:tI.interpolate,variableAnchorOffsetCollection:tz.interpolate,array:tv};class ii{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let i=null,r=t.expectedType;r&&"value"!==r.kind&&(i=r);let a=[];for(let r of e.slice(1)){let e=t.parse(r,1+a.length,i,void 0,{typeAnnotation:"omit"});if(!e)return null;i=i||e.type,a.push(e)}if(!i)throw Error("No output type");return new ii(r&&a.some(e=>e6(r,e.type))?eX:i,a)}evaluate(e){let t,i=null,r=0;for(let a of this.args)if(r++,(i=a.evaluate(e))&&i instanceof tk&&!i.available&&(t||(t=i.name),i=null,r===this.args.length&&(i=t)),null!==i)break;return i}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}function ir(e,t){return"=="===e||"!="===e?"boolean"===t.kind||"string"===t.kind||"number"===t.kind||"null"===t.kind||"value"===t.kind:"string"===t.kind||"number"===t.kind||"value"===t.kind}function ia(e,t,i,r){return 0===r.compare(t,i)}function is(e,t,i){let r="=="!==e&&"!="!==e;return class a{constructor(e,t,i){this.type=eG,this.lhs=e,this.rhs=t,this.collator=i,this.hasUntypedArgument="value"===e.type.kind||"value"===t.type.kind}static parse(e,t){if(3!==e.length&&4!==e.length)return t.error("Expected two or three arguments.");let i=e[0],n=t.parse(e[1],1,eX);if(!n)return null;if(!ir(i,n.type))return t.concat(1).error(`"${i}" comparisons are not supported for type '${e5(n.type)}'.`);let s=t.parse(e[2],2,eX);if(!s)return null;if(!ir(i,s.type))return t.concat(2).error(`"${i}" comparisons are not supported for type '${e5(s.type)}'.`);if(n.type.kind!==s.type.kind&&"value"!==n.type.kind&&"value"!==s.type.kind)return t.error(`Cannot compare types '${e5(n.type)}' and '${e5(s.type)}'.`);r&&("value"===n.type.kind&&"value"!==s.type.kind?n=new tV(s.type,[n]):"value"!==n.type.kind&&"value"===s.type.kind&&(s=new tV(n.type,[s])));let o=null;if(4===e.length){if("string"!==n.type.kind&&"string"!==s.type.kind&&"value"!==n.type.kind&&"value"!==s.type.kind)return t.error("Cannot use collator to compare non-string types.");if(!(o=t.parse(e[3],3,eY)))return null}return new a(n,s,o)}evaluate(a){let n=this.lhs.evaluate(a),s=this.rhs.evaluate(a);if(r&&this.hasUntypedArgument){let t=tF(n),i=tF(s);if(t.kind!==i.kind||"string"!==t.kind&&"number"!==t.kind)throw new tA(`Expected arguments for "${e}" to be (string, string) or (number, number), but found (${t.kind}, ${i.kind}) instead.`)}if(this.collator&&!r&&this.hasUntypedArgument){let e=tF(n),i=tF(s);if("string"!==e.kind||"string"!==i.kind)return t(a,n,s)}return this.collator?i(a,n,s,this.collator.evaluate(a)):t(a,n,s)}eachChild(e){e(this.lhs),e(this.rhs),this.collator&&e(this.collator)}outputDefined(){return!0}}}let io=is("==",function(e,t,i){return t===i},ia),il=is("!=",function(e,t,i){return t!==i},function(e,t,i,r){return!ia(0,t,i,r)}),ih=is("<",function(e,t,i){return t<i},function(e,t,i,r){return 0>r.compare(t,i)}),iu=is(">",function(e,t,i){return t>i},function(e,t,i,r){return r.compare(t,i)>0}
1),ic=is("<=",function(e,t,i){return t<=i},function(e,t,i,r){return 0>=r.compare(t,i)}),id=is(">=",function(e,t,i){return t>=i},function(e,t,i,r){return r.compare(t,i)>=0});class ip{constructor(e,t,i){this.type=eY,this.locale=i,this.caseSensitive=e,this.diacriticSensitive=t}static parse(e,t){if(2!==e.length)return t.error("Expected one argument.");let i=e[1];if("object"!=typeof i||Array.isArray(i))return t.error("Collator options argument must be an object.");let r=t.parse(void 0!==i["case-sensitive"]&&i["case-sensitive"],1,eG);if(!r)return null;let a=t.parse(void 0!==i["diacritic-sensitive"]&&i["diacritic-sensitive"],1,eG);if(!a)return null;let n=null;return!i.locale||(n=t.parse(i.locale,1,eZ))?new ip(r,a,n):null}evaluate(e){return new tw(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 im{constructor(e,t,i,r,a){this.type=eZ,this.number=e,this.locale=t,this.currency=i,this.minFractionDigits=r,this.maxFractionDigits=a}static parse(e,t){if(3!==e.length)return t.error("Expected two arguments.");let i=t.parse(e[1],1,e$);if(!i)return null;let r=e[2];if("object"!=typeof r||Array.isArray(r))return t.error("NumberFormat options argument must be an object.");let a=null;if(r.locale&&!(a=t.parse(r.locale,1,eZ)))return null;let n=null;if(r.currency&&!(n=t.parse(r.currency,1,eZ)))return null;let s=null;if(r["min-fraction-digits"]&&!(s=t.parse(r["min-fraction-digits"],1,e$)))return null;let o=null;return!r["max-fraction-digits"]||(o=t.parse(r["max-fraction-digits"],1,e$))?new im(i,a,n,s,o):null}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 i_{constructor(e){this.type=eK,this.sections=e}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let i=e[1];if(!Array.isArray(i)&&"object"==typeof i)return t.error("First argument must be an image or text section.");let r=[],a=!1;for(let i=1;i<=e.length-1;++i){let n=e[i];if(a&&"object"==typeof n&&!Array.isArray(n)){a=!1;let e=null;if(n["font-scale"]&&!(e=t.parse(n["font-scale"],1,e$)))return null;let i=null;if(n["text-font"]&&!(i=t.parse(n["text-font"],1,e3(eZ))))return null;let s=null;if(n["text-color"]&&!(s=t.parse(n["text-color"],1,eq)))return null;let o=null;if(n["vertical-align"]){if("string"==typeof n["vertical-align"]&&!tT.includes(n["vertical-align"]))return t.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${n["vertical-align"]}' instead.`);if(!(o=t.parse(n["vertical-align"],1,eZ)))return null}let l=r[r.length-1];l.scale=e,l.font=i,l.textColor=s,l.verticalAlign=o}else{let n=t.parse(e[i],1,eX);if(!n)return null;let s=n.type.kind;if("string"!==s&&"value"!==s&&"null"!==s&&"resolvedImage"!==s)return t.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");a=!0,r.push({content:n,scale:null,font:null,textColor:null,verticalAlign:null})}}return new i_(r)}evaluate(e){return new tS(this.sections.map(t=>{let i=t.content.evaluate(e);return tF(i)===e1?new tP("",i,null,null,null,t.verticalAlign?t.verticalAlign.evaluate(e):null):new tP(tB(i),null,t.scale?t.scale.evaluate(e):null,t.font?t.font.evaluate(e).join(","):null,t.textColor?t.textColor.evaluate(e):null,t.verticalAlign?t.verticalAlign.evaluate(e):null)}))}eachChild(e){for(let t of this.sections)e(t.content),t.scale&&e(t.scale),t.font&&e(t.font),t.textColor&&e(t.textColor),t.verticalAlign&&e(t.verticalAlign)}outputDefined(){return!1}}class ig{constructor(e){this.type=e1,this.input=e}static parse(e,t){if(2!==e.length)return t.error("Expected two arguments.");let i=t.parse(e[1],1,eZ);return i?new ig(i):t.error("No image name provided.")}evaluate(e){let t=this.input.evaluate(e),i=tk.fromString(t);return i&&e.availableImages&&(i.available=e.availableImages.indexOf(t)>-1),i}eachChild(e){e(this.input)}outputDefined(){return!1}}class iy{constructor(e){this.type=e$,this.input=e}static parse(e,t){if(2!==e.length)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);let i=t.parse(e[1],1);return i?"array"!==i.type.kind&&"string"!==i.type.kind&&"value"!==i.type.kind?t.error(`Expected argument of type string or array, but found ${e5(i.type)} instead.`):new iy(i):null}evaluate(e){let t=this.input.evaluate(e);if("string"==typeof t)return[...t].length;if(Array.isArray(t))return t.length;throw new tA(`Expected value to be of type string or array, but found ${e5(tF(t))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}function ix(e,t){let i=Math.pow(2,t.z);return[360*((e[0]/8192+t.x)/i)-180,360/Math.PI*Math.atan(Math.exp((180-360*((e[1]/8192+t.y)/i))*Math.PI/180)
1)-90]}function iv(e,t){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.max(e[2],t[0]),e[3]=Math.max(e[3],t[1])}function ib(e,t){return!(e[0]<=t[0]||e[2]>=t[2]||e[1]<=t[1]||e[3]>=t[3])}function iw(e,t,i,r){var a,n;return 0!=(a=[r[0]-i[0],r[1]-i[1]])[0]*(n=[t[0]-e[0],t[1]-e[1]])[1]-a[1]*n[0]&&!(!iS(e,t,i,r)||!iS(i,r,e,t))}function iT(e,t,i=!1){var r,a;let n=!1;for(let s of t)for(let t=0;t<s.length-1;t++){if(function(e,t,i){let r=e[0]-t[0],a=e[1]-t[1],n=e[0]-i[0],s=e[1]-i[1];return r*s-n*a==0&&r*n<=0&&a*s<=0}(e,s[t],s[t+1]))return i;(r=s[t])[1]>e[1]!=(a=s[t+1])[1]>e[1]&&e[0]<(a[0]-r[0])*(e[1]-r[1])/(a[1]-r[1])+r[0]&&(n=!n)}return n}function iP(e,t){for(let i of e)if(!iT(i,t))return!1;for(let i=0;i<e.length-1;++i)if(function(e,t,i){for(let r of i)for(let i=0;i<r.length-1;++i)if(iw(e,t,r[i],r[i+1]))return!0;return!1}(e[i],e[i+1],t))return!1;return!0}function iS(e,t,i,r){let a=r[0]-i[0],n=r[1]-i[1],s=(e[0]-i[0])*n-a*(e[1]-i[1]),o=(t[0]-i[0])*n-a*(t[1]-i[1]);return s>0&&o<0||s<0&&o>0}function iM(e,t,i){let r=[];for(let a=0;a<e.length;a++){let n=[];for(let r=0;r<e[a].length;r++){let s=function(e,t){let i=(180+e[0])/360,r=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e[1]*Math.PI/360)))/360,a=Math.pow(2,t.z);return[Math.round(i*a*8192),Math.round(r*a*8192)]}(e[a][r],i);iv(t,s),n.push(s)}r.push(n)}return r}function iC(e,t,i){let r=[];for(let a=0;a<e.length;a++){let n=iM(e[a],t,i);r.push(n)}return r}function iI(e,t,i,r){if(e[0]<i[0]||e[0]>i[2]){let t=.5*r,a=e[0]-i[0]>t?-r:i[0]-e[0]>t?r:0;0===a&&(a=e[0]-i[2]>t?-r:i[2]-e[0]>t?r:0),e[0]+=a}iv(t,e)}function iA(e,t,i,r){let a=8192*Math.pow(2,r.z),n=[8192*r.x,8192*r.y],s=[];for(let r of e)for(let e of r){let r=[e.x+n[0],e.y+n[1]];iI(r,t,i,a),s.push(r)}return s}function iE(e,t,i,r){let a=8192*Math.pow(2,r.z),n=[8192*r.x,8192*r.y],s=[];for(let i of e){let e=[];for(let r of i){let i=[r.x+n[0],r.y+n[1]];iv(t,i),e.push(i)}s.push(e)}if(t[2]-t[0]<=a/2)for(let e of(t[0]=t[1]=1/0,t[2]=t[3]=-1/0,s))for(let r of e)iI(r,t,i,a);return s}class iz{constructor(e,t){this.type=eG,this.geojson=e,this.geometries=t}static parse(e,t){if(2!==e.length)return t.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(tL(e[1])){let t=e[1];if("FeatureCollection"===t.type){let e=[];for(let i of t.features){let{type:t,coordinates:r}=i.geometry;"Polygon"===t&&e.push(r),"MultiPolygon"===t&&e.push(...r)}if(e.length)return new iz(t,{type:"MultiPolygon",coordinates:e})}else if("Feature"===t.type){let e=t.geometry.type;if("Polygon"===e||"MultiPolygon"===e)return new iz(t,t.geometry)}else if("Polygon"===t.type||"MultiPolygon"===t.type)return new iz(t,t)}return t.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(null!=e.geometry()&&null!=e.canonicalID()){if("Point"===e.geometryType())return function(e,t){let i=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],a=e.canonicalID();if("Polygon"===t.type){let n=iM(t.coordinates,r,a),s=iA(e.geometry(),i,r,a);if(!ib(i,r))return!1;for(let e of s)if(!iT(e,n))return!1}if("MultiPolygon"===t.type){let n=iC(t.coordinates,r,a),s=iA(e.geometry(),i,r,a);if(!ib(i,r))return!1;for(let e of s)if(!function(e,t){for(let i of t)if(iT(e,i))return!0;return!1}(e,n))return!1}return!0}(e,this.geometries);if("LineString"===e.geometryType())return function(e,t){let i=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],a=e.canonicalID();if("Polygon"===t.type){let n=iM(t.coordinates,r,a),s=iE(e.geometry(),i,r,a);if(!ib(i,r))return!1;for(let e of s)if(!iP(e,n))return!1}if("MultiPolygon"===t.type){let n=iC(t.coordinates,r,a),s=iE(e.geometry(),i,r,a);if(!ib(i,r))return!1;for(let e of s)if(!function(e,t){for(let i of t)if(iP(e,i))return!0;return!1}(e,n))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let ik=class{constructor(e=[],t=(e,t)=>e<t?-1:+(e>t)){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let e=(this.length>>1)-1;e>=0;e--)this._down(e)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(0===this.length)return;let e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){let{data:t,compare:i}=this,r=t[e];for(;e>0;){let a=e-1>>1,n=t[a];if(i(r,n)>=0)break;t[e]=n,e=a}t[e]=r}_down(e){let{data:t,compare:i}=this,r=this.length>>1,a=t[e];for(;e<r;){let r=1+(e<<1),n=r+1;if(n<this.length&&0>i(t[n],t[r])&&(r=n),i(t[r],a)>=0)break;t[e]=t[r],e=r}t[e]=a}};function iD(e,t,i){let r=e[t];e[t]=e[i],e[i]=r}function iR(e,t){let i,r;if(e.length<=1)return[e];let a=[];for(let t of e){let e=function(e){let t=0;for(let i,r,a=0,n=e.length,s=n-1;a<n;s=a++)i=e[a],t+=((r=e[s]).x-i.x)*(i.y+r.y);return t}(t);0!==e&&(t.area=Math.abs(e),void 0===r&&(r=e<0),r===e<0?(i&&a.push(i),i=[t]):i.push(t))}if(i&&a.push(i),t>1)for(let e=0;e<a.length;e++)a[e].length<=t||(function e(t,i,r=0,a=t.length-1,n=function(e,t){return e<t?-1:+(e>t)}){for(;a>r;){if(a-r>600){let s=a-r+1,o=i-r+1,l=Math.log(s),h=.5*Math.exp(2*l/3),u=.5*Math.sqrt(l*h*(s-h)/s)*(o-s/2<0?-1:1);e(t,i,Math.max(r,Math.floor(i-o*h/s+u)),Math.min(a,Math.floor(i+(s-o)*h/s+u)),n)}let s=t[i],o=r,l=a;for(iD(t,r,i),n(t[a],s)>0&&iD(t,r,a);o<l;){for(iD(t,o,l),o++,l--;0>n(t[o],s);)o++;for(;n(t[l],s)>0;)l--}0===n(t[r],s)?iD(t,r,l):iD(t,++l,a),l<=i&&(r=l+1),i<=l&&(a=l-1)}}(a[e],t,1,a[e].length-1,iL),a[e]=a[e].slice(0,t));return a}function iL(e,t){return t.area-e.area}let iF=1/298.257223563*(2-1/298.257223563),iB=Math.PI/180;class iO{constructor(e){const t=6378.137*iB*1e3,i=Math.cos(e*iB),r=1/(1-iF*(1-i*i)),a=Math.sqrt(r);this.kx=t*a*i,this.ky=t*a*r*(1-iF)}distance(e,t){let i=this.wrap(e[0]-t[0])*this.kx,r=(e[1]-t[1])*this.ky;return Math.sqrt(i*i+r*r)}pointOnLine(e,t){let i,r,a,n,s=1/0;for(let o=0;o<e.length-1;o++){let l=e[o][0],h=e[o][1],u=this.wrap(e[o+1][0]-l)*this.kx,c=(e[o+1][1]-h)*this.ky,d=0;
10===u&&0===c||((d=(this.wrap(t[0]-l)*this.kx*u+(t[1]-h)*this.ky*c)/(u*u+c*c))>1?(l=e[o+1][0],h=e[o+1][1]):d>0&&(l+=u/this.kx*d,h+=c/this.ky*d));let p=(u=this.wrap(t[0]-l)*this.kx)*u+(c=(t[1]-h)*this.ky)*c;p<s&&(s=p,i=l,r=h,a=o,n=d)}return{point:[i,r],index:a,t:Math.max(0,Math.min(1,n))}}wrap(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}}function ij(e,t){return t[0]-e[0]}function iV(e){return e[1]-e[0]+1}function iU(e,t){return e[1]>=e[0]&&e[1]<t}function iN(e,t){if(e[0]>e[1])return[null,null];let i=iV(e);if(t){if(2===i)return[e,null];let t=Math.floor(i/2);return[[e[0],e[0]+t],[e[0]+t,e[1]]]}if(1===i)return[e,null];let r=Math.floor(i/2)-1;return[[e[0],e[0]+r],[e[0]+r+1,e[1]]]}function i$(e,t){if(!iU(t,e.length))return[1/0,1/0,-1/0,-1/0];let i=[1/0,1/0,-1/0,-1/0];for(let r=t[0];r<=t[1];++r)iv(i,e[r]);return i}function iZ(e){let t=[1/0,1/0,-1/0,-1/0];for(let i of e)for(let e of i)iv(t,e);return t}function iG(e){return e[0]!==-1/0&&e[1]!==-1/0&&e[2]!==1/0&&e[3]!==1/0}function iq(e,t,i){if(!iG(e)||!iG(t))return NaN;let r=0,a=0;return e[2]<t[0]&&(r=t[0]-e[2]),e[0]>t[2]&&(r=e[0]-t[2]),e[1]>t[3]&&(a=e[1]-t[3]),e[3]<t[1]&&(a=t[1]-e[3]),i.distance([0,0],[r,a])}function iW(e,t,i){let r=i.pointOnLine(t,e);return i.distance(e,r.point)}function iH(e,t,i,r,a){return Math.min(Math.min(iW(e,[i,r],a),iW(t,[i,r],a)),Math.min(iW(i,[e,t],a),iW(r,[e,t],a)))}function iX(e,t){for(let i of e)for(let e of i)if(iT(e,t,!0))return!0;return!1}function iY(e,t,i,r,a,n){if(!n)return;let s=iq(i$(r,n),a,i);s<t&&e.push([s,n,[0,0]])}function iK(e,t,i,r,a,n,s){if(!n||!s)return;let o=iq(i$(r,n),i$(a,s),i);o<t&&e.push([o,n,s])}function iJ(e,t,i,r,a=1/0){let n=Math.min(r.distance(e[0],i[0][0]),a);if(0===n)return n;let s=new ik([[0,[0,e.length-1],[0,0]]],ij),o=iZ(i);for(;s.length>0;){let a=s.pop();if(a[0]>=n)continue;let l=a[1],h=t?50:100;if(iV(l)<=h){if(!iU(l,e.length))return NaN;if(t){let t=function(e,t,i,r){if(!iU(t,e.length))return NaN;for(let r=t[0];r<=t[1];++r)if(iT(e[r],i,!0))return 0;let a=1/0;for(let n=t[0];n<t[1];++n){let t=e[n],s=e[n+1];for(let e of i)for(let i=0,n=e.length,o=n-1;i<n;o=i++){let n=e[o],l=e[i];if(iw(t,s,n,l))return 0;a=Math.min(a,iH(t,s,n,l,r))}}return a}(e,l,i,r);if(isNaN(t)||0===t)return t;n=Math.min(n,t)}else for(let t=l[0];t<=l[1];++t)if(0===(n=Math.min(n,function(e,t,i){if(iT(e,t,!0))return 0;let r=1/0;for(let a of t){let t=a[0],n=a[a.length-1];if(t!==n&&0===(r=Math.min(r,iW(e,[n,t],i))))break;let s=i.pointOnLine(a,e);if(0===(r=Math.min(r,i.distance(e,s.point))))break}return r}(e[t],i,r))))return 0}else{let i=iN(l,t);iY(s,n,r,e,o,i[0]),iY(s,n,r,e,o,i[1])}}return n}function iQ(e,t,i,r,a,n=1/0){let s=Math.min(n,a.distance(e[0],i[0]));if(0===s)return s;let o=new ik([[0,[0,e.length-1],[0,i.length-1]]],ij);for(;o.length>0;){let n=o.pop();if(n[0]>=s)continue;let l=n[1],h=n[2],u=t?50:100,c=r?50:100;if(iV(l)<=u&&iV(h)<=c){if(!iU(l,e.length)&&iU(h,i.length))return NaN;if(t&&r)s=Math.min(s,function(e,t,i,r,a){if(!iU(t,e.length)||!iU(r,i.length))return 1/0;let n=1/0;for(let s=t[0];s<t[1];++s){let t=e[s],o=e[s+1];for(let e=r[0];e<r[1];++e){let r=i[e],s=i[e+1];if(iw(t,o,r,s))return 0;n=Math.min(n,iH(t,o,r,s,a))}}return n}(e,l,i,h,a));else if(t&&!r){let t=e.slice(l[0],l[1]+1);for(let e=h[0];e<=h[1];++e)if(0===(s=Math.min(s,iW(i[e],t,a))))return s}else if(!t&&r){let t=i.slice(h[0],h[1]+1);for(let i=l[0];i<=l[1];++i)if(0===(s=Math.min(s,iW(e[i],t,a))))return s}else s=Math.min(s,function(e,t,i,r,a){if(!iU(t,e.length)||!iU(r,i.length))return NaN;let n=1/0;for(let s=t[0];s<=t[1];++s)for(let t=r[0];t<=r[1];++t)if(0===(n=Math.min(n,a.distance(e[s],i[t]))))return n;return n}(e,l,i,h,a))}else{let n=iN(l,t),u=iN(h,r);iK(o,s,a,e,i,n[0],u[0]),iK(o,s,a,e,i,n[0],u[1]),iK(o,s,a,e,i,n[1],u[0]),iK(o,s,a,e,i,n[1],u[1])}}return s}function i0(e){return"MultiPolygon"===e.type?e.coordinates.map(e=>({type:"Polygon",coordinates:e})):"MultiLineString"===e.type?e.coordinates.map(e=>({type:"LineString",coordinates:e})):"MultiPoint"===e.type?e.coordinates.map(e=>({type:"Point",coordinates:e})):[e]}class i1{constructor(e,t){this.type=e$,this.geojson=e,this.geometries=t}static parse(e,t){if(2!==e.length)return t.error(`'distance' expression requires exactly one argument, but found ${e.length-1} instead.`);if(tL(e[1])){let t=e[1];if("FeatureCollection"===t.type)return new i1(t,t.features.map(e=>i0(e.geometry)).flat());if("Feature"===t.type)return new i1(t,i0(t.geometry));if("type"in t&&"coordinates"in t)return new i1(t,i0(t))}return t.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(null!=e.geometry()&&null!=e.canonicalID()){if("Point"===e.geometryType())return function(e,t){let i=e.geometry(),r=i.flat().map(t=>ix([t.x,t.y],e.canonical));if(0===i.length)return NaN;let a=new iO(r[0][1]),n=1/0;for(let e of t){switch(e.type){case"Point":n=Math.min(n,iQ(r,!1,[e.coordinates],!1,a,n));break;case"LineString":n=Math.min(n,iQ(r,!1,e.coordinates,!0,a,n));break;case"Polygon":n=Math.min(n,iJ(r,!1,e.coordinates,a,n))}if(0===n)break}return n}(e,this.geometries);if("LineString"===e.geometryType())return function(e,t){let i=e.geometry(),r=i.flat().map(t=>ix([t.x,t.y],e.canonical));if(0===i.length)return NaN;let a=new iO(r[0][1]),n=1/0;for(let e of t){switch(e.type){case"Point":n=Math.min(n,iQ(r,!0,[e.coordinates],!1,a,n));break;case"LineString":n=Math.min(n,iQ(r,!0,e.coordinates,!0,a,n));break;case"Polygon":n=Math.min(n,iJ(r,!0,e.coordinates,a,n))}if(0===n)break}return n}(e,this.geometries);if("Polygon"===e.geometryType())return function(e,t){let i=e.geometry();if(0===i.length||0===i[0].length)return NaN;let r=iR(i,0).map(t=>t.map(t=>t.map(t=>ix([t.x,t.y],e.canonical)))),a=new iO(r[0][0][0][1]),n=1/0;for(let e of t)for(let t of r){switch(e.type){case"Point":n=Math.min(n,iJ([e.coordinates],!1,t,a,n));break;case"LineString":n=Math.min(n,iJ(e.coordinates,!0,t,a,n));break;case"Polygon":n=Math.min(n,function(e,t,i,r=1/0){let a=iZ(e),n=iZ(t);if(r!==1/0&&iq(a,n,i)>=r)return r;if(ib(a,n)){if(iX(e,t))return 0}else if(iX(t,e))return 0;let s=1/0;for(let r of e)for(let e=0,a=r.length,n=a-1;e<a;n=e++){let a=r[n],o=r[e];for(let e of t)for(let t=0,r=e.length,n=r-1;t<r;n=t++){let r=e[n],l=e[t];if(iw(a,o,r,l))return 0;s=Math.min(s,iH(a,o,r,l,i))}}return s}(t,e.coordinates,a,n))}if(0===n)return n}return n}(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class i2{constructor(e){this.type=eX,this.key=e}static parse(e,t){if(2!==e.length)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);let i=e[1];return null==i?t.error("Global state property must be defined."):"str
1ing"!=typeof i?t.error(`Global state property must be string, but found ${typeof e[1]} instead.`):new i2(i)}evaluate(e){var t;let i=null==(t=e.globals)?void 0:t.globalState;return i&&0!==Object.keys(i).length?tf(i,this.key):null}eachChild(){}outputDefined(){return!1}}let i3={"==":io,"!=":il,">":iu,"<":ih,">=":id,"<=":ic,array:tV,at:tH,boolean:tV,case:tJ,coalesce:ii,collator:ip,format:i_,image:ig,in:tX,"index-of":tY,interpolate:t7,"interpolate-hcl":t7,"interpolate-lab":t7,length:iy,let:tq,literal:tO,match:tK,number:tV,"number-format":im,object:tV,slice:tQ,step:t1,string:tV,"to-boolean":tN,"to-color":tN,"to-number":tN,"to-string":tN,var:tW,within:iz,distance:i1,"global-state":i2};class i5{constructor(e,t,i,r){this.name=e,this.type=t,this._evaluate=i,this.args=r}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,t){let i=e[0],r=i5.definitions[i];if(!r)return t.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0);let a=Array.isArray(r)?r[0]:r.type,n=Array.isArray(r)?[[r[1],r[2]]]:r.overloads,s=n.filter(([t])=>!Array.isArray(t)||t.length===e.length-1),o=null;for(let[r,n]of s){o=new tG(t.registry,i9,t.path,null,t.scope);let s=[],l=!1;for(let t=1;t<e.length;t++){let i=e[t],a=Array.isArray(r)?r[t-1]:r.type,n=o.parse(i,1+s.length,a);if(!n){l=!0;break}s.push(n)}if(!l)if(Array.isArray(r)&&r.length!==s.length)o.error(`Expected ${r.length} arguments, but found ${s.length} instead.`);else{for(let e=0;e<s.length;e++){let t=Array.isArray(r)?r[e]:r.type,i=s[e];o.concat(e+1).checkSubtype(t,i.type)}if(0===o.errors.length)return new i5(i,a,n,s)}}if(1===s.length)t.errors.push(...o.errors);else{let i=(s.length?s:n).map(([e])=>Array.isArray(e)?`(${e.map(e5).join(", ")})`:`(${e5(e.type)}...)`).join(" | "),r=[];for(let i=1;i<e.length;i++){let a=t.parse(e[i],1+r.length);if(!a)return null;r.push(e5(a.type))}t.error(`Expected arguments of type ${i}, but found (${r.join(", ")}) instead.`)}return null}static register(e,t){for(let i in i5.definitions=t,t)e[i]=i5}}function i4(e,[t,i,r,a]){t=t.evaluate(e),i=i.evaluate(e),r=r.evaluate(e);let n=a?a.evaluate(e):1,s=tR(t,i,r,n);if(s)throw new tA(s);return new tb(t/255,i/255,r/255,n,!1)}function i6(e,t){let i=t[e];return void 0===i?null:i}function i8(e){return{type:e}}function i9(e){if(e instanceof tW)return i9(e.boundExpression);if(e instanceof i5&&"error"===e.name||e instanceof ip||e instanceof iz||e instanceof i1||e instanceof i2)return!1;let t=e instanceof tN||e instanceof tV,i=!0;return e.eachChild(e=>{i=t?i&&i9(e):i&&e instanceof tO}),!!i&&i7(e)&&rt(e,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"])}function i7(e){if(e instanceof i5&&("get"===e.name&&1===e.args.length||"feature-state"===e.name||"has"===e.name&&1===e.args.length||"properties"===e.name||"geometry-type"===e.name||"id"===e.name||/^filter-/.test(e.name))||e instanceof iz||e instanceof i1)return!1;let t=!0;return e.eachChild(e=>{t&&!i7(e)&&(t=!1)}),t}function re(e){if(e instanceof i5&&"feature-state"===e.name)return!1;let t=!0;return e.eachChild(e=>{t&&!re(e)&&(t=!1)}),t}function rt(e,t){if(e instanceof i5&&t.indexOf(e.name)>=0)return!1;let i=!0;return e.eachChild(e=>{i&&!rt(e,t)&&(i=!1)}),i}function ri(e){return{result:"success",value:e}}function rr(e){return{result:"error",value:e}}function ra(e){return"data-driven"===e["property-type"]||"cross-faded-data-driven"===e["property-type"]}function rn(e){return!!e.expression&&e.expression.parameters.indexOf("zoom")>-1}function rs(e){return!!e.expression&&e.expression.interpolated}function ro(e){return e instanceof Number?"number":e instanceof String?"string":e instanceof Boolean?"boolean":Array.isArray(e)?"array":null===e?"null":typeof e}function rl(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)&&tF(e)===eH}function rh(e){return e}function ru(e,t,i){return void 0!==e?e:void 0!==t?t:void 0!==i?i:void 0}function rc(e,t,i,r,a){return ru(typeof i===a?r[i]:void 0,e.default,t.default)}function rd(e,t,i){if("number"!==ro(i))return ru(e.default,t.default);let r=e.stops.length;if(1===r||i<=e.stops[0][0])return e.stops[0][1];if(i>=e.stops[r-1][0])return e.stops[r-1][1];let a=t0(e.stops.map(e=>e[0]),i);return e.stops[a][1]}function rp(e,t,i){var r;
1let a,n,s=void 0!==e.base?e.base:1;if("number"!==ro(i))return ru(e.default,t.default);let o=e.stops.length;if(1===o||i<=e.stops[0][0])return e.stops[0][1];if(i>=e.stops[o-1][0])return e.stops[o-1][1];let l=t0(e.stops.map(e=>e[0]),i),h=(r=e.stops[l][0],a=e.stops[l+1][0]-r,n=i-r,0===a?0:1===s?n/a:(Math.pow(s,n)-1)/(Math.pow(s,a)-1)),u=e.stops[l][1],c=e.stops[l+1][1],d=it[t.type]||rh;return"function"==typeof u.evaluate?{evaluate(...t){let i=u.evaluate.apply(void 0,t),r=c.evaluate.apply(void 0,t);if(void 0!==i&&void 0!==r)return d(i,r,h,e.colorSpace)}}:d(u,c,h,e.colorSpace)}function rf(e,t,i){switch(t.type){case"color":i=tb.parse(i);break;case"formatted":i=tS.fromString(i.toString());break;case"resolvedImage":i=tk.fromString(i.toString());break;case"padding":i=tM.parse(i);break;case"colorArray":i=tI.parse(i);break;case"numberArray":i=tC.parse(i);break;default:ro(i)===t.type||"enum"===t.type&&t.values[i]||(i=void 0)}return ru(i,e.default,t.default)}i5.register(i3,{error:[{kind:"error"},[eZ],(e,[t])=>{throw new tA(t.evaluate(e))}],typeof:[eZ,[eX],(e,[t])=>e5(tF(t.evaluate(e)))],"to-rgba":[e3(e$,4),[eq],(e,[t])=>{let[i,r,a,n]=t.evaluate(e).rgb;return[255*i,255*r,255*a,n]}],rgb:[eq,[e$,e$,e$],i4],rgba:[eq,[e$,e$,e$,e$],i4],has:{type:eG,overloads:[[[eZ],(e,[t])=>t.evaluate(e)in e.properties()],[[eZ,eH],(e,[t,i])=>t.evaluate(e)in i.evaluate(e)]]},get:{type:eX,overloads:[[[eZ],(e,[t])=>i6(t.evaluate(e),e.properties())],[[eZ,eH],(e,[t,i])=>i6(t.evaluate(e),i.evaluate(e))]]},"feature-state":[eX,[eZ],(e,[t])=>i6(t.evaluate(e),e.featureState||{})],properties:[eH,[],e=>e.properties()],"geometry-type":[eZ,[],e=>e.geometryType()],id:[eX,[],e=>e.id()],zoom:[e$,[],e=>e.globals.zoom],"heatmap-density":[e$,[],e=>e.globals.heatmapDensity||0],elevation:[e$,[],e=>e.globals.elevation||0],"line-progress":[e$,[],e=>e.globals.lineProgress||0],accumulated:[eX,[],e=>void 0===e.globals.accumulated?null:e.globals.accumulated],"+":[e$,i8(e$),(e,t)=>{let i=0;for(let r of t)i+=r.evaluate(e);return i}],"*":[e$,i8(e$),(e,t)=>{let i=1;for(let r of t)i*=r.evaluate(e);return i}],"-":{type:e$,overloads:[[[e$,e$],(e,[t,i])=>t.evaluate(e)-i.evaluate(e)],[[e$],(e,[t])=>-t.evaluate(e)]]},"/":[e$,[e$,e$],(e,[t,i])=>t.evaluate(e)/i.evaluate(e)],"%":[e$,[e$,e$],(e,[t,i])=>t.evaluate(e)%i.evaluate(e)],ln2:[e$,[],()=>Math.LN2],pi:[e$,[],()=>Math.PI],e:[e$,[],()=>Math.E],"^":[e$,[e$,e$],(e,[t,i])=>Math.pow(t.evaluate(e),i.evaluate(e))],sqrt:[e$,[e$],(e,[t])=>Math.sqrt(t.evaluate(e))],log10:[e$,[e$],(e,[t])=>Math.log(t.evaluate(e))/Math.LN10],ln:[e$,[e$],(e,[t])=>Math.log(t.evaluate(e))],log2:[e$,[e$],(e,[t])=>Math.log(t.evaluate(e))/Math.LN2],sin:[e$,[e$],(e,[t])=>Math.sin(t.evaluate(e))],cos:[e$,[e$],(e,[t])=>Math.cos(t.evaluate(e))],tan:[e$,[e$],(e,[t])=>Math.tan(t.evaluate(e))],asin:[e$,[e$],(e,[t])=>Math.asin(t.evaluate(e))],acos:[e$,[e$],(e,[t])=>Math.acos(t.evaluate(e))],atan:[e$,[e$],(e,[t])=>Math.atan(t.evaluate(e))],min:[e$,i8(e$),(e,t)=>Math.min(...t.map(t=>t.evaluate(e)))],max:[e$,i8(e$),(e,t)=>Math.max(...t.map(t=>t.evaluate(e)))],abs:[e$,[e$],(e,[t])=>Math.abs(t.evaluate(e))],round:[e$,[e$],(e,[t])=>{let i=t.evaluate(e);return i<0?-Math.round(-i):Math.round(i)}],floor:[e$,[e$],(e,[t])=>Math.floor(t.evaluate(e))],ceil:[e$,[e$],(e,[t])=>Math.ceil(t.evaluate(e))],"filter-==":[eG,[eZ,eX],(e,[t,i])=>e.properties()[t.value]===i.value],"filter-id-==":[eG,[eX],(e,[t])=>e.id()===t.value],"filter-type-==":[eG,[eZ],(e,[t])=>e.geometryType()===t.value],"filter-<":[eG,[eZ,eX],(e,[t,i])=>{let r=e.properties()[t.value],a=i.value;return typeof r==typeof a&&r<a}],"filter-id-<":[eG,[eX],(e,[t])=>{let i=e.id(),r=t.value;return typeof i==typeof r&&i<r}],"filter->":[eG,[eZ,eX],(e,[t,i])=>{let r=e.properties()[t.value],a=i.value;return typeof r==typeof a&&r>a}],"filter-id->":[eG,[eX],(e,[t])=>{let i=e.id(),r=t.value;return typeof i==typeof r&&i>r}],"filter-<=":[eG,[eZ,eX],(e,[t,i])=>{let r=e.properties()[t.value],a=i.value;return typeof r==typeof a&&r<=a}],"filter-id-<=":[eG,[eX],(e,[t])=>{let i=e.id(),r=t.value;return typeof i==typeof r&&i<=r}],"filter->=":[eG,[eZ,eX],(e,[t,i])=>{let r=e.properties()[t.value],a=i.value;return typeof r==typeof a&&r>=a}],"filter-id->=":[eG,[eX],(e,[t])=>{let i=e.id(),r=t.value;return typeof i==typeof r&&i>=r}],"filter-has":[eG,[eX],(e,[t])=>t.value in e.properties()],"filter-has-id":[eG,[],e=>null!==e.id()&&void 0!==e.id()],"filter-type-in":[eG,[e3(eZ)],(e,[t])=>t.value.indexOf(e.geometryType())>=0],"filter-id-in":[eG,[e3(eX)],(e,[t])=>t.value.indexOf(e.id())>=0],"filter-in-small":[eG,[eZ,e3(eX)],(e,[t,i])=>i.value.indexOf(e.properties()[t.value])>=0],"filter-in-large":[eG,[eZ,e3(eX)],(e,[t,i])=>(function(e,t,i,r){for(;i<=r;){let a=i+r>>1;if(t[a]===e)return!0;t[a]>e?r=a-1:i=a+1}return!1})(e.properties()[t.value],i.value,0,i.value.length-1)],all:{type:eG,overloads:[[[eG,eG],(e,[t,i])=>t.evaluate(e)&&i.evaluate(e)],[i8(eG),(e,t)=>{for(let i of t)if(!i.evaluate(e))return!1;return!0}]]},any:{type:eG,overloads:[[[eG,eG],(e,[t,i])=>t.evaluate(e)||i.evaluate(e)],[i8(eG),(e,t)=>{for(let i of t)if(i.evaluate(e))return!0;return!1}]]},"!":[eG,[eG],(e,[t])=>!t.evaluate(e)],"is-supported-script":[eG,[eZ],(e,[t])=>{let i=e.globals&&e.globals.isSupportedScript;return!i||i(t.evaluate(e))}],upcase:[eZ,[eZ],(e,[t])=>t.evaluate(e).toUpperCase()],downcase:[eZ,[eZ],(e,[t])=>t.evaluate(e).toLowerCase()],concat:[eZ,i8(eX),(e,t)=>t.map(t=>
1tB(t.evaluate(e))).join("")],"resolved-locale":[eZ,[eY],(e,[t])=>t.evaluate(e).resolvedLocale()]});class rm{constructor(e,t){this.expression=e,this._warningHistory={},this._evaluator=new tZ,this._defaultValue=t?function(e){if("color"===e.type&&rl(e.default))return new tb(0,0,0,0);switch(e.type){case"color":return tb.parse(e.default)||null;case"padding":return tM.parse(e.default)||null;case"numberArray":return tC.parse(e.default)||null;case"colorArray":return tI.parse(e.default)||null;case"variableAnchorOffsetCollection":return tz.parse(e.default)||null;case"projectionDefinition":return tD.parse(e.default)||null;default:return void 0===e.default?null:e.default}}(t):null,this._enumValues=t&&"enum"===t.type?t.values:null}evaluateWithoutErrorHandling(e,t,i,r,a,n){return this._evaluator.globals=e,this._evaluator.feature=t,this._evaluator.featureState=i,this._evaluator.canonical=r,this._evaluator.availableImages=a||null,this._evaluator.formattedSection=n,this.expression.evaluate(this._evaluator)}evaluate(e,t,i,r,a,n){this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=i||null,this._evaluator.canonical=r,this._evaluator.availableImages=a||null,this._evaluator.formattedSection=n||null;try{let e=this.expression.evaluate(this._evaluator);if(null==e||"number"==typeof e&&e!=e)return this._defaultValue;if(this._enumValues&&!(e in this._enumValues))throw new tA(`Expected value to be one of ${Object.keys(this._enumValues).map(e=>JSON.stringify(e)).join(", ")}, but found ${JSON.stringify(e)} instead.`);return e}catch(e){return this._warningHistory[e.message]||(this._warningHistory[e.message]=!0,"u">typeof console&&console.warn(e.message)),this._defaultValue}}}function r_(e){return Array.isArray(e)&&e.length>0&&"string"==typeof e[0]&&e[0]in i3}function rg(e,t){let i,r=new tG(i3,i9,[],t?(i={color:eq,string:eZ,number:e$,enum:eZ,boolean:eG,formatted:eK,padding:eJ,numberArray:e0,colorArray:eQ,projectionDefinition:eW,resolvedImage:e1,variableAnchorOffsetCollection:e2},"array"===t.type?e3(i[t.value]||eX,t.length):i[t.type]):void 0),a=r.parse(e,void 0,void 0,void 0,t&&"string"===t.type?{typeAnnotation:"coerce"}:void 0);return a?ri(new rm(a,t)):rr(r.errors)}class ry{constructor(e,t){this.kind=e,this._styleExpression=t,this.isStateDependent="constant"!==e&&!re(t.expression),this.globalStateRefs=rw(t.expression)}evaluateWithoutErrorHandling(e,t,i,r,a,n){return this._styleExpression.evaluateWithoutErrorHandling(e,t,i,r,a,n)}evaluate(e,t,i,r,a,n){return this._styleExpression.evaluate(e,t,i,r,a,n)}}class rx{constructor(e,t,i,r){this.kind=e,this.zoomStops=i,this._styleExpression=t,this.isStateDependent="camera"!==e&&!re(t.expression),this.globalStateRefs=rw(t.expression),this.interpolationType=r}evaluateWithoutErrorHandling(e,t,i,r,a,n){return this._styleExpression.evaluateWithoutErrorHandling(e,t,i,r,a,n)}evaluate(e,t,i,r,a,n){return this._styleExpression.evaluate(e,t,i,r,a,n)}interpolationFactor(e,t,i){return this.interpolationType?t7.interpolationFactor(this.interpolationType,e,t,i):0}}function rv(e,t){let i=rg(e,t);if("error"===i.result)return i;let r=i.value.expression,a=i7(r);if(!a&&!ra(t))return rr([new eV("","data expressions not supported")]);let n=rt(r,["zoom"]);if(!n&&!rn(t))return rr([new eV("","zoom expressions not supported")]);let s=function e(t){let i=null;if(t instanceof tq)i=e(t.result);else if(t instanceof ii){for(let r of t.args)if(i=e(r))break}else(t instanceof t1||t instanceof t7)&&t.input instanceof i5&&"zoom"===t.input.name&&(i=t);return i instanceof eV||t.eachChild(t=>{let r=e(t);r instanceof eV?i=r:!i&&r?i=new eV("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):i&&r&&i!==r&&(i=new eV("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),i}(r);return s||n?s instanceof eV?rr([s]):s instanceof t7&&!rs(t)?rr([new eV("",'"interpolate" expressions cannot be used with this property')]):ri(s?new rx(a?"camera":"composite",i.value,s.labels,s instanceof t7?s.interpolation:void 0):new ry(a?"constant":"source",i.value)):rr([new eV("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class rb{constructor(e,t){this._parameters=e,this._specification=t,ej(this,function e(t,i){var r;let a,n,s=t.stops&&"object"==typeof t.stops[0][0],o=s||!(s||void 0!==t.property),l=t.type||(rs(i)?"exponential":"interval"),h=function(e){switch(e.type){case"color":return tb.parse;case"padding":return tM.parse;case"numberArray":return tC.parse;case"colorArray":return tI.parse;default:return null}}(i);if(h&&((t=ej({},t)).stops&&(t.stops=t.stops.map(e=>[e[0],h(e[1])])),t.default=h(t.default?t.default:i.default)),t.colorSpace&&"rgb"!==(r=t.colorSpace)&&"hcl"!==r&&"lab"!==r)throw Error(`Unknown color space: "${t.colorSpace}"`);let u=function(e){switch(e){case"exponential":return rp;case"interval":return rd;case"categorical":return rc;case"identity":return rf;default:throw Error(`Unknown function type "${e}"`)}}(l);if("categorical"===l){for(let e of(a=Object.create(null),t.stops))a[e[0]]=e[1];n=typeof t.stops[0][0]}if(s){let r={},a=[];for(let e=0;e<t.stops.length;e++){let i=t.stops[e],n=i[0].zoom;
1void 0===r[n]&&(r[n]={zoom:n,type:t.type,property:t.property,default:t.default,stops:[]},a.push(n)),r[n].stops.push([i[0].value,i[1]])}let n=[];for(let t of a)n.push([r[t].zoom,e(r[t],i)]);let s={name:"linear"};return{kind:"composite",interpolationType:s,interpolationFactor:t7.interpolationFactor.bind(void 0,s),zoomStops:n.map(e=>e[0]),evaluate:({zoom:e},r)=>rp({stops:n,base:t.base},i,e).evaluate(e,r)}}if(o){let e="exponential"===l?{name:"exponential",base:void 0!==t.base?t.base:1}:null;return{kind:"camera",interpolationType:e,interpolationFactor:t7.interpolationFactor.bind(void 0,e),zoomStops:t.stops.map(e=>e[0]),evaluate:({zoom:e})=>u(t,i,e,a,n)}}return{kind:"source",evaluate(e,r){let s=r&&r.properties?r.properties[t.property]:void 0;return void 0===s?ru(t.default,i.default):u(t,i,s,a,n)}}}(this._parameters,this._specification))}static deserialize(e){return new rb(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function rw(e,t=new Set){return e instanceof i2&&t.add(e.key),e.eachChild(e=>{rw(e,t)}),t}function rT(e){if(!0===e||!1===e)return!0;if(!Array.isArray(e)||0===e.length)return!1;switch(e[0]){case"has":return e.length>=2&&"$id"!==e[1]&&"$type"!==e[1];case"in":return e.length>=3&&("string"!=typeof e[1]||Array.isArray(e[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==e.length||Array.isArray(e[1])||Array.isArray(e[2]);case"any":case"all":for(let t of e.slice(1))if(!rT(t)&&"boolean"!=typeof t)return!1;return!0;default:return!0}}let rP={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function rS(e){if(null==e)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};rT(e)||(e=function e(t){if(!t)return!0;let i=t[0];return t.length<=1?"any"!==i:"=="===i?rC(t[1],t[2],"=="):"!="===i?rE(rC(t[1],t[2],"==")):"<"===i||">"===i||"<="===i||">="===i?rC(t[1],t[2],i):"any"===i?["any"].concat(t.slice(1).map(e)):"all"===i?["all"].concat(t.slice(1).map(e)):"none"===i?["all"].concat(t.slice(1).map(e).map(rE)):"in"===i?rI(t[1],t.slice(2)):"!in"===i?rE(rI(t[1],t.slice(2))):"has"===i?rA(t[1]):"!has"!==i||rE(rA(t[1]))}(e));let t=rg(e,rP);if("error"===t.result)throw Error(t.value.map(e=>`${e.key}: ${e.message}`).join(", "));return{filter:(e,i,r)=>t.value.evaluate(e,i,{},r),needGeometry:function e(t){if(!Array.isArray(t))return!1;if("within"===t[0]||"distance"===t[0])return!0;for(let i=1;i<t.length;i++)if(e(t[i]))return!0;return!1}(e),getGlobalStateRefs:()=>rw(t.value.expression)}}function rM(e,t){return e<t?-1:+(e>t)}function rC(e,t,i){switch(e){case"$type":return[`filter-type-${i}`,t];case"$id":return[`filter-id-${i}`,t];default:return[`filter-${i}`,e,t]}}function rI(e,t){if(0===t.length)return!1;switch(e){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some(e=>typeof e!=typeof t[0])?["filter-in-large",e,["literal",t.sort(rM)]]:["filter-in-small",e,["literal",t]]}}function rA(e){switch(e){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function rE(e){return["!",e]}function rz(e){let t=e.value;return t?[new eO(e.key,t,"constants have been deprecated as of v8")]:[]}function rk(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function rD(e){if(Array.isArray(e))return e.map(rD);if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){let t={};for(let i in e)t[i]=rD(e[i]);return t}return rk(e)}function rR(e){let t=e.key,i=e.value,r=e.valueSpec||{},a=e.objectElementValidators||{},n=e.style,s=e.styleSpec,o=e.validateSpec,l=[],h=ro(i);if("object"!==h)return[new eO(t,i,`object expected, ${h} found`)];for(let e in i){let h,u=e.split(".")[0],c=tf(r,u)||r["*"];if(tf(a,u))h=a[u];else if(tf(r,u))h=o;else if(a["*"])h=a["*"];else{if(!r["*"]){l.push(new eO(t,i[e],`unknown property "${e}"`));continue}h=o}l=l.concat(h({key:(t?`${t}.`:t)+e,value:i[e],valueSpec:c,style:n,styleSpec:s,object:i,objectKey:e,validateSpec:o},i))}for(let e in r)a[e]||r[e].required&&void 0===r[e].default&&void 0===i[e]&&l.push(new eO(t,i,`missing required property "${e}"`));return l}function rL(e){let t=e.value,i=e.valueSpec,r=e.style,a=e.styleSpec,n=e.key,s=e.arrayElementValidator||e.validateSpec;if("array"!==ro(t))return[new eO(n,t,`array expected, ${ro(t)} found`)];if(i.length&&t.length!==i.length)return[new eO(n,t,`array length ${i.length} expected, length ${t.length} found`)];if(i["min-length"]&&t.length<i["min-length"])return[new eO(n,t,`array length at least ${i["min-length"]} expected, length ${t.length} found`)];let o={type:i.value,values:i.values};a.$version<7&&(o.function=i.function),"object"===ro(i.value)&&(o=i.value);let l=[];for(let i=0;i<t.length;i++)l=l.concat(s({array:t,arrayIndex:i,value:t[i],valueSpec:o,validateSpec:e.validateSpec,style:r,styleSpec:a,key:`${n}[${i}]`}));return l}function rF(e){let t=e.key,i=e.value,r=e.valueSpec,a=ro(i);return"number"===a&&i!=i&&(a="NaN"),"number"!==a?[new eO(t,i,`number expected, ${a} found`)]:"minimum"in r&&i<r.minimum?[new eO(t,i,`${i} is less than the minimum value ${r.minimum}`)]:"maximum"in r&&i>r.maximum?[new eO(t,i,`${i} is greater than the maximum value ${r.maximum}`)]:[]}function rB(e){let t=e.valueSpec,i=rk(e.value.type),r,a,n,s={},o="categorical"!==i&&void 0===e.value.property,l="array"===ro(e.value.stops)&&"array"===ro(e.value.stops[0])&&"object"===ro(e.value.stops[0][0]),h=rR({key:e.key,value:e.value,valueSpec:e.styleSpec.function,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{stops:function(e){if("identity"===i)return[new eO(e.key,e.value,'identity function may not have a "stops" property')];let t=[],r=e.value;return t=t.concat(rL({key:e.key,value:r,valueSpec:e.valueSpec,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,arrayElementValidator:u})),"array"===ro(r)&&0===r.length&&t.push(new eO(e.key,r,"array must have at least one stop")),t},default:function(e){return e.validateSpec({key:e.key,value:e.value,valueSpec:t,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec})}}});return"identity"===i&&o&&h.push(new eO(e.key,e.value,'missing required property "property"')),"identity"===i||e.value.stops||h.push(new eO(e.key,e.value,'missing required property "stops"')),"exponential"===i&&e.valueSpec.expression&&!rs(e.valueSpec)&&h.push(new eO(e.key,e.value,"exponential functions not supported")),e.styleSpec.$version>=8&&(o||ra(e.valueSpec)?o&&!rn(e.valueSpec)&&h.push(new eO(e.key,e.value,"zoom functions not supported")):h.push(new eO(e.key,e.value,"property functions not supported"))),("categorical"===i||l)&&void 0===e.value.property&&h.push(new eO(e.key,e.value,'"property" property is required')),h;
1function u(e){let i=[],r=e.value,o=e.key;if("array"!==ro(r))return[new eO(o,r,`array expected, ${ro(r)} found`)];if(2!==r.length)return[new eO(o,r,`array length 2 expected, length ${r.length} found`)];if(l){if("object"!==ro(r[0]))return[new eO(o,r,`object expected, ${ro(r[0])} found`)];if(void 0===r[0].zoom)return[new eO(o,r,"object stop key must have zoom")];if(void 0===r[0].value)return[new eO(o,r,"object stop key must have value")];if(n&&n>rk(r[0].zoom))return[new eO(o,r[0].zoom,"stop zoom values must appear in ascending order")];rk(r[0].zoom)!==n&&(n=rk(r[0].zoom),a=void 0,s={}),i=i.concat(rR({key:`${o}[0]`,value:r[0],valueSpec:{zoom:{}},validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{zoom:rF,value:c}}))}else i=i.concat(c({key:`${o}[0]`,value:r[0],validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec},r));return r_(rD(r[1]))?i.concat([new eO(`${o}[1]`,r[1],"expressions are not allowed in function stops.")]):i.concat(e.validateSpec({key:`${o}[1]`,value:r[1],valueSpec:t,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec}))}function c(e,n){let o=ro(e.value),l=rk(e.value),h=null!==e.value?e.value:n;if(r){if(o!==r)return[new eO(e.key,h,`${o} stop domain type must match previous stop domain type ${r}`)]}else r=o;if("number"!==o&&"string"!==o&&"boolean"!==o)return[new eO(e.key,h,"stop domain value must be a number, string, or boolean")];if("number"!==o&&"categorical"!==i){let r=`number expected, ${o} found`;return ra(t)&&void 0===i&&(r+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new eO(e.key,h,r)]}return"categorical"!==i||"number"!==o||isFinite(l)&&Math.floor(l)===l?"categorical"!==i&&"number"===o&&void 0!==a&&l<a?[new eO(e.key,h,"stop domain values must appear in ascending order")]:(a=l,"categorical"===i&&l in s?[new eO(e.key,h,"stop domain values must be unique")]:(s[l]=!0,[])):[new eO(e.key,h,`integer expected, found ${l}`)]}}function rO(e){let t=("property"===e.expressionContext?rv:rg)(rD(e.value),e.valueSpec);if("error"===t.result)return t.value.map(t=>new eO(`${e.key}${t.key}`,e.value,t.message));let i=t.value.expression||t.value._styleExpression.expression;if("property"===e.expressionContext&&"text-font"===e.propertyKey&&!i.outputDefined())return[new eO(e.key,e.value,`Invalid data expression for "${e.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===e.expressionContext&&"layout"===e.propertyType&&!re(i))return[new eO(e.key,e.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===e.expressionContext&&!re(i))return[new eO(e.key,e.value,'"feature-state" data expressions are not supported with filters.')];if(e.expressionContext&&0===e.expressionContext.indexOf("cluster")){if(!rt(i,["zoom","feature-state"]))return[new eO(e.key,e.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===e.expressionContext&&!i7(i))return[new eO(e.key,e.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function rj(e){let t=e.key,i=e.value,r=ro(i);return"string"!==r?[new eO(t,i,`color expected, ${r} found`)]:tb.parse(String(i))?[]:[new eO(t,i,`color expected, "${i}" found`)]}function rV(e){let t=e.key,i=e.value,r=e.valueSpec,a=[];return Array.isArray(r.values)?-1===r.values.indexOf(rk(i))&&a.push(new eO(t,i,`expected one of [${r.values.join(", ")}], ${JSON.stringify(i)} found`)):-1===Object.keys(r.values).indexOf(rk(i))&&a.push(new eO(t,i,`expected one of [${Object.keys(r.values).join(", ")}], ${JSON.stringify(i)} found`)),a}function rU(e){return rT(rD(e.value))?rO(ej({},e,{expressionContext:"filter",valueSpec:{value:"boolean"}})):function e(t){let i=t.value,r=t.key;if("array"!==ro(i))return[new eO(r,i,`array expected, ${ro(i)} found`)];let a=t.styleSpec,n,s=[];if(i.length<1)return[new eO(r,i,"filter array must have at least 1 element")];switch(s=s.concat(rV({key:`${r}[0]`,value:i[0],valueSpec:a.filter_operator,style:t.style,styleSpec:t.styleSpec})),rk(i[0])){case"<":case"<=":case">":case">=":i.length>=2&&"$type"===rk(i[1])&&s.push(new eO(r,i,`"$type" cannot be use with operator "${i[0]}"`));case"==":case"!=":3!==i.length&&s.push(new eO(r,i,`filter array for operator "${i[0]}" must have 3 elements`));case"in":case"!in":i.length>=2&&"string"!==(n=ro(i[1]))&&s.push(new eO(`${r}[1]`,i[1],`string expected, ${n} found`));for(let e=2;e<i.length;e++)n=ro(i[e]),"$type"===rk(i[1])?s=s.concat(rV({key:`${r}[${e}]`,value:i[e],valueSpec:a.geometry_type,style:t.style,styleSpec:t.styleSpec})):"string"!==n&&"number"!==n&&"boolean"!==n&&s.push(new eO(`${r}[${e}]`,i[e],`string, number, or boolean expected, ${n} found`));break;case"any":case"all":case"none":for(let a=1;a<i.length;a++)s=s.concat(e({key:`${r}[${a}]`,value:i[a],style:t.style,styleSpec:t.styleSpec}));break;case"has":case"!has":n=ro(i[1]),2!==i.length?s.push(new eO(r,i,`filter array for "${i[0]}" operator must have 2 elements`)):"string"!==n&&s.push(new eO(`${r}[1]`,i[1],`string expected, ${n} found`))}return s}(e)}function rN(e,t){let i,r=e.key,a=e.validateSpec,n=e.style,s=e.styleSpec,o=e.value,l=e.objectKey,h=s[`${t}_${e.layerType}`];if(!h)return[];let u=l.match(/^(.*)-transition$/);if("paint"===t&&u&&h[u[1]]&&h[u[1]].transition)return a({key:r,value:o,valueSpec:s.transition,style:n,styleSpec:s}
1);let c=e.valueSpec||h[l];if(!c)return[new eO(r,o,`unknown property "${l}"`)];if("string"===ro(o)&&ra(c)&&!c.tokens&&(i=/^{([^}]+)}$/.exec(o)))return[new eO(r,o,`"${l}" does not support interpolation syntax 2Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(i[1])} }\`.`)];let d=[];return"symbol"===e.layerType&&("text-field"===l&&n&&!n.glyphs&&d.push(new eO(r,o,'use of "text-field" requires a style "glyphs" property')),"text-font"===l&&rl(rD(o))&&"identity"===rk(o.type)&&d.push(new eO(r,o,'"text-font" does not support identity functions'))),d.concat(a({key:e.key,value:o,valueSpec:c,style:n,styleSpec:s,expressionContext:"property",propertyType:t,propertyKey:l}))}function r$(e){return rN(e,"paint")}function rZ(e){return rN(e,"layout")}function rG(e){let t=[],i=e.value,r=e.key,a=e.style,n=e.styleSpec;if("object"!==ro(i))return[new eO(r,i,`object expected, ${ro(i)} found`)];i.type||i.ref||t.push(new eO(r,i,'either "type" or "ref" is required'));let s=rk(i.type),o=rk(i.ref);if(i.id){let n=rk(i.id);for(let s=0;s<e.arrayIndex;s++){let e=a.layers[s];rk(e.id)===n&&t.push(new eO(r,i.id,`duplicate layer id "${i.id}", previously used at line ${e.id.__line__}`))}}if("ref"in i){let e;["type","source","source-layer","filter","layout"].forEach(e=>{e in i&&t.push(new eO(r,i[e],`"${e}" is prohibited for ref layers`))}),a.layers.forEach(t=>{rk(t.id)===o&&(e=t)}),e?e.ref?t.push(new eO(r,i.ref,"ref cannot reference another ref layer")):s=rk(e.type):t.push(new eO(r,i.ref,`ref layer "${o}" not found`))}else if("background"!==s)if(i.source){let e=a.sources&&a.sources[i.source],n=e&&rk(e.type);e?"vector"===n&&"raster"===s?t.push(new eO(r,i.source,`layer "${i.id}" requires a raster source`)):"raster-dem"!==n&&"hillshade"===s||"raster-dem"!==n&&"color-relief"===s?t.push(new eO(r,i.source,`layer "${i.id}" requires a raster-dem source`)):"raster"===n&&"raster"!==s?t.push(new eO(r,i.source,`layer "${i.id}" requires a vector source`)):"vector"!==n||i["source-layer"]?"raster-dem"===n&&"hillshade"!==s&&"color-relief"!==s?t.push(new eO(r,i.source,"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.")):"line"===s&&i.paint&&i.paint["line-gradient"]&&("geojson"!==n||!e.lineMetrics)&&t.push(new eO(r,i,`layer "${i.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new eO(r,i,`layer "${i.id}" must specify a "source-layer"`)):t.push(new eO(r,i.source,`source "${i.source}" not found`))}else t.push(new eO(r,i,'missing required property "source"'));return t=t.concat(rR({key:r,value:i,valueSpec:n.layer,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":()=>[],type:()=>e.validateSpec({key:`${r}.type`,value:i.type,valueSpec:n.layer.type,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,object:i,objectKey:"type"}),filter:rU,layout:e=>rR({layer:i,key:e.key,value:e.value,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":e=>rZ(ej({layerType:s},e))}}),paint:e=>rR({layer:i,key:e.key,value:e.value,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":e=>r$(ej({layerType:s},e))}})}}))}function rq(e){let t=e.value,i=e.key,r=ro(t);return"string"!==r?[new eO(i,t,`string expected, ${r} found`)]:[]}let rW={promoteId:function({key:e,value:t}){if("string"===ro(t))return rq({key:e,value:t});{let i=[];for(let r in t)i.push(...rq({key:`${e}.${r}`,value:t[r]}));return i}}};function rH(e){let t,i=e.value,r=e.key,a=e.styleSpec,n=e.style,s=e.validateSpec;if(!i.type)return[new eO(r,i,'"type" is required')];let o=rk(i.type);switch(o){case"vector":case"raster":return rR({key:r,value:i,valueSpec:a[`source_${o.replace("-","_")}`],style:e.style,styleSpec:a,objectElementValidators:rW,validateSpec:s});case"raster-dem":return function(e){var t;let i=null!=(t=e.sourceName)?t:"",r=e.value,a=e.styleSpec,n=a.source_raster_dem,s=e.style,o=[],l=ro(r);if(void 0===r)return o;if("object"!==l)return o.push(new eO("source_raster_dem",r,`object expected, ${l}
2 found`)),o;let h="custom"===rk(r.encoding),u=["redFactor","greenFactor","blueFactor","baseShift"],c=e.value.encoding?`"${e.value.encoding}"`:"Default";for(let t in r)!h&&u.includes(t)?o.push(new eO(t,r[t],`In "${i}": "${t}" is only valid when "encoding" is set to "custom". ${c} encoding found`)):n[t]?o=o.concat(e.validateSpec({key:t,value:r[t],valueSpec:n[t],validateSpec:e.validateSpec,style:s,styleSpec:a})):o.push(new eO(t,r[t],`unknown property "${t}"`));return o}({sourceName:r,value:i,style:e.style,styleSpec:a,validateSpec:s});case"geojson":if(t=rR({key:r,value:i,valueSpec:a.source_geojson,style:n,styleSpec:a,validateSpec:s,objectElementValidators:rW}),i.cluster)for(let e in i.clusterProperties){let[a,n]=i.clusterProperties[e],s="string"==typeof a?[a,["accumulated"],["get",e]]:a;t.push(...rO({key:`${r}.${e}.map`,value:n,expressionContext:"cluster-map"})),t.push(...rO({key:`${r}.${e}.reduce`,value:s,expressionContext:"cluster-reduce"}))}return t;case"video":return rR({key:r,value:i,valueSpec:a.source_video,style:n,validateSpec:s,styleSpec:a});case"image":return rR({key:r,value:i,valueSpec:a.source_image,style:n,validateSpec:s,styleSpec:a});case"canvas":return[new eO(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return rV({key:`${r}.type`,value:i.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function rX(e){let t=e.value,i=e.styleSpec,r=i.light,a=e.style,n=[],s=ro(t);if(void 0===t)return n;if("object"!==s)return n.concat([new eO("light",t,`object expected, ${s} found`)]);for(let s in t){let o=s.match(/^(.*)-transition$/);n=n.concat(o&&r[o[1]]&&r[o[1]].transition?e.validateSpec({key:s,value:t[s],valueSpec:i.transition,validateSpec:e.validateSpec,style:a,styleSpec:i}):r[s]?e.validateSpec({key:s,value:t[s],valueSpec:r[s],validateSpec:e.validateSpec,style:a,styleSpec:i}):[new eO(s,t[s],`unknown property "${s}"`)])}return n}function rY(e){let t=e.value,i=e.styleSpec,r=i.sky,a=e.style,n=ro(t);if(void 0===t)return[];if("object"!==n)return[new eO("sky",t,`object expected, ${n} found`)];let s=[];for(let n in t)s=s.concat(r[n]?e.validateSpec({key:n,value:t[n],valueSpec:r[n],style:a,styleSpec:i}):[new eO(n,t[n],`unknown property "${n}"`)]);return s}function rK(e){let t=e.value,i=e.styleSpec,r=i.terrain,a=e.style,n=[],s=ro(t);if(void 0===t)return n;if("object"!==s)return n.concat([new eO("terrain",t,`object expected, ${s} found`)]);for(let s in t)n=n.concat(r[s]?e.validateSpec({key:s,value:t[s],valueSpec:r[s],validateSpec:e.validateSpec,style:a,styleSpec:i}):[new eO(s,t[s],`unknown property "${s}"`)]);return n}function rJ(e){let t=[],i=e.value,r=e.key;if(Array.isArray(i)){let a=[],n=[];for(let s in i)i[s].id&&a.includes(i[s].id)&&t.push(new eO(r,i,`all the sprites' ids must be unique, but ${i[s].id} is duplicated`)),a.push(i[s].id),i[s].url&&n.includes(i[s].url)&&t.push(new eO(r,i,`all the sprites' URLs must be unique, but ${i[s].url} is duplicated`)),n.push(i[s].url),t=t.concat(rR({key:`${r}[${s}]`,value:i[s],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:e.validateSpec}));return t}return rq({key:r,value:i})}function rQ(e){var t;return(t=e.value)&&t.constructor===Object?[]:[new eO(e.key,e.value,`object expected, ${ro(e.value)} found`)]}let r0={"*":()=>[],array:rL,boolean:function(e){let t=e.value,i=e.key,r=ro(t);return"boolean"!==r?[new eO(i,t,`boolean expected, ${r} found`)]:[]},number:rF,color:rj,constants:rz,enum:rV,filter:rU,function:rB,layer:rG,object:rR,source:rH,light:rX,sky:rY,terrain:rK,projection:function(e){let t=e.value,i=e.styleSpec,r=i.projection,a=e.style,n=ro(t);if(void 0===t)return[];if("object"!==n)return[new eO("projection",t,`object expected, ${n} found`)];let s=[];for(let n in t)s=s.concat(r[n]?e.validateSpec({key:n,value:t[n],valueSpec:r[n],style:a,styleSpec:i}):[new eO(n,t[n],`unknown property "${n}"`)]);return s},projectionDefinition:function(e){var t;let i=e.key,r=e.value,a=ro(r=r instanceof String?r.valueOf():r);return"array"!==a||Array.isArray(t=r)&&3===t.length&&"string"==typeof t[0]&&"string"==typeof t[1]&&"number"==typeof t[2]||["interpolate","step","literal"].includes(r[0])?["array","string"].includes(a)?[]:[new eO(i,r,`projection expected, invalid type "${a}" found`)]:[new eO(i,r,`projection expected, invalid array ${JSON.stringify(r)} found`)]},string:rq,formatted:function(e){return 0===rq(e).length?[]:rO(e)},resolvedImage:function(e){return 0===rq(e).length?[]:rO(e)},padding:function(e){let t=e.key,i=e.value;if("array"===ro(i)){if(i.length<1||i.length>4)return[new eO(t,i,`padding requires 1 to 4 values; ${i.length} values found`)];let r={type:"number"},a=[];for(let n=0;n<i.length;n++)a=a.concat(e.validateSpec({key:`${t}[${n}]`,value:i[n],validateSpec:e.validateSpec,valueSpec:r}));return a}return rF({key:t,value:i,valueSpec:{}}
2)},numberArray:function(e){let t=e.key,i=e.value;if("array"===ro(i)){let r={type:"number"};if(i.length<1)return[new eO(t,i,"array length at least 1 expected, length 0 found")];let a=[];for(let n=0;n<i.length;n++)a=a.concat(e.validateSpec({key:`${t}[${n}]`,value:i[n],validateSpec:e.validateSpec,valueSpec:r}));return a}return rF({key:t,value:i,valueSpec:{}})},colorArray:function(e){let t=e.key,i=e.value;if("array"===ro(i)){if(i.length<1)return[new eO(t,i,"array length at least 1 expected, length 0 found")];let e=[];for(let r=0;r<i.length;r++)e=e.concat(rj({key:`${t}[${r}]`,value:i[r]}));return e}return rj({key:t,value:i})},variableAnchorOffsetCollection:function(e){let t=e.key,i=e.value,r=ro(i),a=e.styleSpec;if("array"!==r||i.length<1||i.length%2!=0)return[new eO(t,i,"variableAnchorOffsetCollection requires a non-empty array of even length")];let n=[];for(let r=0;r<i.length;r+=2)n=(n=n.concat(rV({key:`${t}[${r}]`,value:i[r],valueSpec:a.layout_symbol["text-anchor"]}))).concat(rL({key:`${t}[${r+1}]`,value:i[r+1],valueSpec:{length:2,value:"number"},validateSpec:e.validateSpec,style:e.style,styleSpec:a}));return n},sprite:rJ,state:rQ};function r1(e){let t=e.value,i=e.valueSpec,r=e.styleSpec;return e.validateSpec=r1,i.expression&&rl(rk(t))?rB(e):i.expression&&r_(rD(t))?rO(e):i.type&&r0[i.type]?r0[i.type](e):rR(ej({},e,{valueSpec:i.type?r[i.type]:i}))}function r2(e){let t=e.value,i=e.key,r=rq(e);return r.length||(-1===t.indexOf("{fontstack}")&&r.push(new eO(i,t,'"glyphs" url must include a "{fontstack}" token')),-1===t.indexOf("{range}")&&r.push(new eO(i,t,'"glyphs" url must include a "{range}" token'))),r}function r3(e,t=eA){let i=[];return i=i.concat(r1({key:"",value:e,valueSpec:t.$root,styleSpec:t,style:e,validateSpec:r1,objectElementValidators:{glyphs:r2,"*":()=>[]}})),e.constants&&(i=i.concat(rz({key:"constants",value:e.constants}))),r4(i)}function r5(e){return function(t){return e({...t,validateSpec:r1})}}function r4(e){return[].concat(e).sort((e,t)=>e.line-t.line)}function r6(e){return function(...t){return r4(e.apply(this,t))}}r3.source=r6(r5(rH)),r3.sprite=r6(r5(rJ)),r3.glyphs=r6(r5(r2)),r3.light=r6(r5(rX)),r3.sky=r6(r5(rY)),r3.terrain=r6(r5(rK)),r3.state=r6(r5(rQ)),r3.layer=r6(r5(rG)),r3.filter=r6(r5(rU)),r3.paintProperty=r6(r5(r$)),r3.layoutProperty=r6(r5(rZ));let r8=r3.light,r9=r3.sky,r7=r3.paintProperty,ae=r3.layoutProperty;function at(e,t){let i=!1;if(t&&t.length)for(let r of t)e.fire(new eC(Error(r.message))),i=!0;return i}class ai{constructor(e,t,i){const r=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const a=new Int32Array(this.arrayBuffer);e=a[0],this.d=(t=a[1])+2*(i=a[2]);for(let e=0;e<this.d*this.d;e++){const t=a[3+e],i=a[3+e+1];r.push(t===i?null:a.subarray(t,i))}const n=a[3+r.length+1];this.keys=a.subarray(a[3+r.length],n),this.bboxes=a.subarray(n),this.insert=this._insertReadonly}else{this.d=t+2*i;for(let e=0;e<this.d*this.d;e++)r.push([]);this.keys=[],this.bboxes=[]}this.n=t,this.extent=e,this.padding=i,this.scale=t/e,this.uid=0;const a=i/t*e;this.min=-a,this.max=e+a}insert(e,t,i,r,a){this._forEachCell(t,i,r,a,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(t),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(a)}_insertReadonly(){throw Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,t,i,r,a,n){this.cells[a].push(n)}query(e,t,i,r,a){let n=this.min,s=this.max;if(e<=n&&t<=n&&s<=i&&s<=r&&!a)return Array.prototype.slice.call(this.keys);{let n=[];return this._forEachCell(e,t,i,r,this._queryCell,n,{},a),n}}_queryCell(e,t,i,r,a,n,s,o){let l=this.cells[a];if(null!==l){let a=this.keys,h=this.bboxes;for(let u=0;u<l.length;u++){let c=l[u];if(void 0===s[c]){let l=4*c;(o?o(h[l+0],h[l+1],h[l+2],h[l+3]):e<=h[l+2]&&t<=h[l+3]&&i>=h[l+0]&&r>=h[l+1])?(s[c]=!0,n.push(a[c])):s[c]=!1}}}}_forEachCell(e,t,i,r,a,n,s,o){let l=this._convertToCellCoord(e),h=this._convertToCellCoord(t),u=this._convertToCellCoord(i),c=this._convertToCellCoord(r);for(let d=l;d<=u;d++)for(let l=h;l<=c;l++){let h=this.d*l+d;if((!o||o(this._convertFromCellCoord(d),this._convertFromCellCoord(l),this._convertFromCellCoord(d+1),this._convertFromCellCoord(l+1)))&&a.call(this,e,t,i,r,h,n,s,o))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;let e=this.cells,t=3+this.cells.length+1+1,i=0;for(let e=0;e<this.cells.length;e++)i+=this.cells[e].length;let r=new Int32Array(t+i+this.keys.length+this.bboxes.length);r[0]=this.extent,r[1]=this.n,r[2]=this.padding;let a=t;for(let t=0;t<e.length;t++){let i=e[t];r[3+t]=a,r.set(i,a),a+=i.length}return r[3+e.length]=a,r.set(this.keys,a),a+=this.keys.length,r[3+e.length+1]=a,r.set(this.bboxes,a),a+=this.bboxes.length,r.buffer}static serialize(e,t){let i=e.toArrayBuffer();return t&&t.push(i),{buffer:i}}static deserialize(e){return new ai(e.buffer)}}let ar={};function aa(e,t,i={}){if(ar[e])throw Error(`${e} is already registered.`);Object.defineProperty(t,"_classRegistryKey",{value:e,writeable:!1}
2),ar[e]={klass:t,omit:i.omit||[],shallow:i.shallow||[]}}for(let e in aa("Object",Object),aa("Set",Set),aa("TransferableGridIndex",ai),aa("Color",tb),aa("Error",Error),aa("AJAXError",ev),aa("ResolvedImage",tk),aa("StylePropertyFunction",rb),aa("StyleExpression",rm,{omit:["_evaluator"]}),aa("ZoomDependentExpression",rx),aa("ZoomConstantExpression",ry),aa("CompoundExpression",i5,{omit:["_evaluate"]}),i3)i3[e]._classRegistryKey||aa(`Expression_${e}`,i3[e]);function an(e){return e&&"u">typeof ArrayBuffer&&(e instanceof ArrayBuffer||e.constructor&&"ArrayBuffer"===e.constructor.name)}function as(e){return e.$name||e.constructor._classRegistryKey}function ao(e){return!function(e){if(null===e||"object"!=typeof e)return!1;let t=as(e);return!(!t||"Object"===t)}(e)&&(null==e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp||e instanceof Blob||e instanceof Error||an(e)||eo(e)||ArrayBuffer.isView(e)||e instanceof ImageData)}function al(e,t){if(ao(e))return(an(e)||eo(e))&&t&&t.push(e),ArrayBuffer.isView(e)&&t&&t.push(e.buffer),e instanceof ImageData&&t&&t.push(e.data.buffer),e;if(Array.isArray(e)){let i=[];for(let r of e)i.push(al(r,t));return i}if("object"!=typeof e)throw Error("can't serialize object of type "+typeof e);let i=as(e);if(!i)throw Error(`can't serialize object of unregistered class ${e.constructor.name}`);if(!ar[i])throw Error(`${i} is not registered.`);let{klass:r}=ar[i],a=r.serialize?r.serialize(e,t):{};if(r.serialize){if(t&&a===t[t.length-1])throw Error("statically serialized object won't survive transfer of $name property")}else{for(let r in e){if(!e.hasOwnProperty(r)||ar[i].omit.indexOf(r)>=0)continue;let n=e[r];a[r]=ar[i].shallow.indexOf(r)>=0?n:al(n,t)}e instanceof Error&&(a.message=e.message)}if(a.$name)throw Error("$name property is reserved for worker serialization logic.");return"Object"!==i&&(a.$name=i),a}function ah(e){if(ao(e))return e;if(Array.isArray(e))return e.map(ah);if("object"!=typeof e)throw Error("can't deserialize object of type "+typeof e);let t=as(e)||"Object";if(!ar[t])throw Error(`can't deserialize unregistered class ${t}`);let{klass:i}=ar[t];if(!i)throw Error(`can't deserialize unregistered class ${t}`);if(i.deserialize)return i.deserialize(e);let r=Object.create(i.prototype);for(let i of Object.keys(e)){if("$name"===i)continue;let a=e[i];r[i]=ar[t].shallow.indexOf(i)>=0?a:ah(a)}return r}class au{constructor(){this.first=!0}update(e,t){let i=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=i,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=i,!0):(this.lastFloorZoom>i?(this.lastIntegerZoom=i+1,this.lastIntegerZoomTime=t):this.lastFloorZoom<i&&(this.lastIntegerZoom=i,this.lastIntegerZoomTime=t),e!==this.lastZoom&&(this.lastZoom=e,this.lastFloorZoom=i,!0))}}let ac={"Latin-1 Supplement":e=>e>=128&&e<=255,"Hangul Jamo":e=>e>=4352&&e<=4607,Khmer:e=>e>=6016&&e<=6143,"General Punctuation":e=>e>=8192&&e<=8303,"Letterlike Symbols":e=>e>=8448&&e<=8527,"Number Forms":e=>e>=8528&&e<=8591,"Miscellaneous Technical":e=>e>=8960&&e<=9215,"Control Pictures":e=>e>=9216&&e<=9279,"Optical Character Recognition":e=>e>=9280&&e<=9311,"Enclosed Alphanumerics":e=>e>=9312&&e<=9471,"Geometric Shapes":e=>e>=9632&&e<=9727,"Miscellaneous Symbols":e=>e>=9728&&e<=9983,"Miscellaneous Symbols and Arrows":e=>e>=11008&&e<=11263,"Ideographic Description Characters":e=>e>=12272&&e<=12287,"CJK Symbols and Punctuation":e=>e>=12288&&e<=12351,Hiragana:e=>e>=12352&&e<=12447,Katakana:e=>e>=12448&&e<=12543,Kanbun:e=>e>=12688&&e<=12703,"CJK Strokes":e=>e>=12736&&e<=12783,"Enclosed CJK Letters and Months":e=>e>=12800&&e<=13055,"CJK Compatibility":e=>e>=13056&&e<=13311,"Yijing Hexagram Symbols":e=>e>=19904&&e<=19967,"CJK Unified Ideographs":e=>e>=19968&&e<=40959,"Hangul Syllables":e=>e>=44032&&e<=55215,"Private Use Area":e=>e>=57344&&e<=63743,"Vertical Forms":e=>e>=65040&&e<=65055,"CJK Compatibility Forms":e=>e>=65072&&e<=65103,"Small Form Variants":e=>e>=65104&&e<=65135,"Halfwidth and Fullwidth Forms":e=>e>=65280&&e<=65519};function ad(e){for(let t of e)if(a_(t.charCodeAt(0)))return!0;return!1}function ap(e){return RegExp(e.map(e=>{try{return RegExp(`\\p{sc=${e}}`,"u").source}catch(e){return null}}).filter(e=>e).join("|"),"u")}let af=ap(["Arab","Dupl","Mong","Ougr","Syrc"]),am=ap(["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"]);
2function a_(e){return!(746!==e&&747!==e&&(e<4352||!(ac["CJK Compatibility Forms"](e)&&!(e>=65097&&e<=65103)||ac["CJK Compatibility"](e)||ac["CJK Strokes"](e)||!(!ac["CJK Symbols and Punctuation"](e)||e>=12296&&e<=12305||e>=12308&&e<=12319||12336===e)||ac["Enclosed CJK Letters and Months"](e)||ac["Ideographic Description Characters"](e)||ac.Kanbun(e)||ac.Katakana(e)&&12540!==e||!(!ac["Halfwidth and Fullwidth Forms"](e)||65288===e||65289===e||65293===e||e>=65306&&e<=65310||65339===e||65341===e||65343===e||e>=65371&&e<=65503||65507===e||e>=65512&&e<=65519)||!(!ac["Small Form Variants"](e)||e>=65112&&e<=65118||e>=65123&&e<=65126)||ac["Vertical Forms"](e)||ac["Yijing Hexagram Symbols"](e)||/\p{sc=Cans}/u.test(String.fromCodePoint(e))||/\p{sc=Hang}/u.test(String.fromCodePoint(e))||am.test(String.fromCodePoint(e)))))}function ag(e){return!(a_(e)||ac["Latin-1 Supplement"](e)&&(167===e||169===e||174===e||177===e||188===e||189===e||190===e||215===e||247===e)||ac["General Punctuation"](e)&&(8214===e||8224===e||8225===e||8240===e||8241===e||8251===e||8252===e||8258===e||8263===e||8264===e||8265===e||8273===e)||ac["Letterlike Symbols"](e)||ac["Number Forms"](e)||ac["Miscellaneous Technical"](e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||9003===e||e>=9085&&e<=9114||e>=9150&&e<=9165||9167===e||e>=9169&&e<=9179||e>=9186&&e<=9215)||ac["Control Pictures"](e)&&9251!==e||ac["Optical Character Recognition"](e)||ac["Enclosed Alphanumerics"](e)||ac["Geometric Shapes"](e)||ac["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||ac["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||ac["CJK Symbols and Punctuation"](e)||ac.Katakana(e)||ac["Private Use Area"](e)||ac["CJK Compatibility Forms"](e)||ac["Small Form Variants"](e)||ac["Halfwidth and Fullwidth Forms"](e)||8734===e||8756===e||8757===e||e>=9984&&e<=10087||e>=10102&&e<=10131||65532===e||65533===e)}let ay=ap(["Adlm","Arab","Armi","Avst","Chrs","Cprt","Egyp","Elym","Gara","Hatr","Hebr","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogo","Syrc","Thaa","Todr","Yezi"]);function ax(e){return ay.test(String.fromCodePoint(e))}let av=new class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(e){this.pluginStatus=e.pluginStatus,this.pluginURL=e.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(e){if(av.isParsed())throw Error("RTL text plugin already registered.");this.applyArabicShaping=e.applyArabicShaping,this.processBidirectionalText=e.processBidirectionalText,this.processStyledBidirectionalText=e.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return null!=this.applyArabicShaping&&null!=this.processBidirectionalText&&null!=this.processStyledBidirectionalText}getRTLTextPluginStatus(){return this.pluginStatus}syncState(e,t){return v(this,void 0,void 0,function*(){if(this.isParsed())return this.getState();if("loading"!==e.pluginStatus)return this.setState(e),e;let i=e.pluginURL,r=new Promise(e=>{this.loadScriptResolve=e});t(i);let a=new Promise(e=>setTimeout(()=>e(),this.TIMEOUT));if(yield Promise.race([r,a]),this.isParsed()){let e={pluginStatus:"loaded",pluginURL:i};return this.setState(e),e}throw this.setState({pluginStatus:"error",pluginURL:""}),Error(`RTL Text Plugin failed to import scripts from ${i}`)})}};class ab{constructor(e,t){this.zoom=e,t?(this.now=t.now||0,this.fadeDuration=t.fadeDuration||0,this.zoomHistory=t.zoomHistory||new au,this.transition=t.transition||{},this.globalState=t.globalState||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new au,this.transition={},this.globalState={})}isSupportedScript(e){var t,i="loaded"===av.getRTLTextPluginStatus();for(let r of e)if(t=r.charCodeAt(0),!i&&ax(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||ac.Khmer(t))return!1;return!0}crossFadingFactor(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let e=this.zoom,t=e-Math.floor(e),i=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:t+(1-t)*i}:{fromScale:.5,toScale:1,t:1-(1-i)*t}}}class aw{constructor(e,t){this.property=e,this.value=t,this.expression=function(e,t){if(rl(e))return new rb(e,t);if(r_(e)){let i=rv(e,t);if("error"===i.result)throw Error(i.value.map(e=>`${e.key}: ${e.message}`).join(", "));return i.value}{let i=e;return"color"===t.type&&"string"==typeof e?i=tb.parse(e):"padding"===t.type&&("number"==typeof e||Array.isArray(e))?i=tM.parse(e):"numberArray"===t.type&&("number"==typeof e||Array.isArray(e))?i=tC.parse(e):"colorArray"===t.type&&("string"==typeof e||Array.isArray(e))?i=tI.parse(e):"variableAnchorOffsetCollection"===t.type&&Array.isArray(e)?i=tz.parse(e):"projectionDefinition"===t.type&&"string"==typeof e&&(i=tD.parse(e)),{globalStateRefs:new Set,kind:"constant",evaluate:()=>i}}}(void 0===t?e.specification.default:t,e.specification)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}
2possiblyEvaluate(e,t,i){return this.property.possiblyEvaluate(this,e,t,i)}}class aT{constructor(e){this.property=e,this.value=new aw(e,void 0)}transitioned(e,t){return new aS(this.property,this.value,t,K({},e.transition,this.transition),e.now)}untransitioned(){return new aS(this.property,this.value,null,{},0)}}class aP{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return et(this._values[e].value.value)}setValue(e,t){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new aT(this._values[e].property)),this._values[e].value=new aw(this._values[e].property,null===t?void 0:et(t))}getTransition(e){return et(this._values[e].transition)}setTransition(e,t){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new aT(this._values[e].property)),this._values[e].transition=et(t)||void 0}serialize(){let e={};for(let t of Object.keys(this._values)){let i=this.getValue(t);void 0!==i&&(e[t]=i);let r=this.getTransition(t);void 0!==r&&(e[`${t}-transition`]=r)}return e}transitioned(e,t){let i=new aM(this._properties);for(let r of Object.keys(this._values))i._values[r]=this._values[r].transitioned(e,t._values[r]);return i}untransitioned(){let e=new aM(this._properties);for(let t of Object.keys(this._values))e._values[t]=this._values[t].untransitioned();return e}}class aS{constructor(e,t,i,r,a){this.property=e,this.value=t,this.begin=a+r.delay||0,this.end=this.begin+r.duration||0,e.specification.transition&&(r.delay||r.duration)&&(this.prior=i)}possiblyEvaluate(e,t,i){let r=e.now||0,a=this.value.possiblyEvaluate(e,t,i),n=this.prior;if(n){if(r>this.end||this.value.isDataDriven())return this.prior=null,a;if(r<this.begin)return n.possiblyEvaluate(e,t,i);{let s=(r-this.begin)/(this.end-this.begin);return this.property.interpolate(n.possiblyEvaluate(e,t,i),a,q(s))}}return a}}class aM{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,t,i){let r=new aA(this._properties);for(let a of Object.keys(this._values))r._values[a]=this._values[a].possiblyEvaluate(e,t,i);return r}hasTransition(){for(let e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class aC{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}hasValue(e){return void 0!==this._values[e].value}getValue(e){return et(this._values[e].value)}setValue(e,t){this._values[e]=new aw(this._values[e].property,null===t?void 0:et(t))}serialize(){let e={};for(let t of Object.keys(this._values)){let i=this.getValue(t);void 0!==i&&(e[t]=i)}return e}possiblyEvaluate(e,t,i){let r=new aA(this._properties);for(let a of Object.keys(this._values))r._values[a]=this._values[a].possiblyEvaluate(e,t,i);return r}}class aI{constructor(e,t,i){this.property=e,this.value=t,this.parameters=i}isConstant(){return"constant"===this.value.kind}constantOr(e){return"constant"===this.value.kind?this.value.value:e}evaluate(e,t,i,r){return this.property.evaluate(this.value,this.parameters,e,t,i,r)}}class aA{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class aE{constructor(e){this.specification=e}possiblyEvaluate(e,t){if(e.isDataDriven())throw Error("Value should not be data driven");return e.expression.evaluate(t)}interpolate(e,t,i){let r=it[this.specification.type];return r?r(e,t,i):e}}class az{constructor(e,t){this.specification=e,this.overrides=t}possiblyEvaluate(e,t,i,r){return new aI(this,"constant"===e.expression.kind||"camera"===e.expression.kind?{kind:"constant",value:e.expression.evaluate(t,null,{},i,r)}:e.expression,t)}interpolate(e,t,i){if("constant"!==e.value.kind||"constant"!==t.value.kind)return e;if(void 0===e.value.value||void 0===t.value.value)return new aI(this,{kind:"constant",value:void 0},e.parameters);let r=it[this.specification.type];return r?new aI(this,{kind:"constant",value:r(e.value.value,t.value.value,i)},e.parameters):e}evaluate(e,t,i,r,a,n){return"constant"===e.kind?e.value:e.evaluate(t,i,r,a,n)}}class ak extends az{possiblyEvaluate(e,t,i,r){if(void 0===e.value)return new aI(this,{kind:"constant",value:void 0},t);
2if("constant"===e.expression.kind){let a=e.expression.evaluate(t,null,{},i,r),n="resolvedImage"===e.property.specification.type&&"string"!=typeof a?a.name:a;return new aI(this,{kind:"constant",value:this._calculate(n,n,n,t)},t)}return"camera"===e.expression.kind?new aI(this,{kind:"constant",value:this._calculate(e.expression.evaluate({zoom:t.zoom-1}),e.expression.evaluate({zoom:t.zoom}),e.expression.evaluate({zoom:t.zoom+1}),t)},t):new aI(this,e.expression,t)}evaluate(e,t,i,r,a,n){if("source"===e.kind){let s=e.evaluate(t,i,r,a,n);return this._calculate(s,s,s,t)}return"composite"===e.kind?this._calculate(e.evaluate({zoom:Math.floor(t.zoom)-1},i,r),e.evaluate({zoom:Math.floor(t.zoom)},i,r),e.evaluate({zoom:Math.floor(t.zoom)+1},i,r),t):e.value}_calculate(e,t,i,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:i,to:t}}interpolate(e){return e}}class aD{constructor(e){this.specification=e}possiblyEvaluate(e,t,i,r){if(void 0!==e.value){if("constant"===e.expression.kind){let a=e.expression.evaluate(t,null,{},i,r);return this._calculate(a,a,a,t)}return this._calculate(e.expression.evaluate(new ab(Math.floor(t.zoom-1),t)),e.expression.evaluate(new ab(Math.floor(t.zoom),t)),e.expression.evaluate(new ab(Math.floor(t.zoom+1),t)),t)}}_calculate(e,t,i,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:i,to:t}}interpolate(e){return e}}class aR{constructor(e){this.specification=e}possiblyEvaluate(e,t,i,r){return!!e.expression.evaluate(t,null,{},i,r)}interpolate(){return!1}}class aL{constructor(e){for(const t in this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[],e){const i=e[t];i.specification.overridable&&this.overridableProperties.push(t);const r=this.defaultPropertyValues[t]=new aw(i,void 0),a=this.defaultTransitionablePropertyValues[t]=new aT(i);this.defaultTransitioningPropertyValues[t]=a.untransitioned(),this.defaultPossiblyEvaluatedValues[t]=r.possiblyEvaluate({})}}}aa("DataDrivenProperty",az),aa("DataConstantProperty",aE),aa("CrossFadedDataDrivenProperty",ak),aa("CrossFadedProperty",aD),aa("ColorRampProperty",aR);let aF="-transition";class aB extends eI{constructor(e,t){if(super(),this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},"custom"!==e.type&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,"background"!==e.type&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter,this._featureFilter=rS(e.filter)),t.layout&&(this._unevaluatedLayout=new aC(t.layout)),t.paint)){for(const i in this._transitionablePaint=new aP(t.paint),e.paint)this.setPaintProperty(i,e.paint[i],{validate:!1});for(const t in e.layout)this.setLayoutProperty(t,e.layout[t],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new aA(t.paint)}}setFilter(e){this.filter=e,this._featureFilter=rS(e)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return"visibility"===e?this.visibility:this._unevaluatedLayout.getValue(e)}getLayoutAffectingGlobalStateRefs(){let e=new Set;if(this._unevaluatedLayout)for(let t in this._unevaluatedLayout._values)for(let i of this._unevaluatedLayout._values[t].getGlobalStateRefs())e.add(i);for(let t of this._featureFilter.getGlobalStateRefs())e.add(t);return e}setLayoutProperty(e,t,i={}){null!=t&&this._validate(ae,`layers.${this.id}.layout.${e}`,e,t,i)||("visibility"!==e?this._unevaluatedLayout.setValue(e,t):this.visibility=t)}getPaintProperty(e){return e.endsWith(aF)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,t,i={}){if(null!=t&&this._validate(r7,`layers.${this.id}.paint.${e}`,e,t,i))return!1;if(e.endsWith(aF))return this._transitionablePaint.setTransition(e.slice(0,-11),t||void 0),!1;{let i=this._transitionablePaint._values[e],r="cross-faded-data-driven"===i.property.specification["property-type"],a=i.value.isDataDriven(),n=i.value;this._transitionablePaint.setValue(e,t),this._handleSpecialPaintPropertyUpdate(e);let s=this._transitionablePaint._values[e].value;return s.isDataDriven()||a||r||this._handleOverridablePaintPropertyUpdate(e,n,s)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,t,i){return!1}
2isHidden(e){return!!(this.minzoom&&e<this.minzoom)||!!(this.maxzoom&&e>=this.maxzoom)||"none"===this.visibility}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,t){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,t)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,t)}serialize(){let 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),ee(e,(e,t)=>!(void 0===e||"layout"===t&&!Object.keys(e).length||"paint"===t&&!Object.keys(e).length))}_validate(e,t,i,r,a={}){return(!a||!1!==a.validate)&&at(this,e.call(r3,{key:t,layerType:this.type,objectKey:i,value:r,styleSpec:eA,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let e in this.paint._values){let t=this.paint.get(e);if(t instanceof aI&&ra(t.property.specification)&&("source"===t.value.kind||"composite"===t.value.kind)&&t.value.isStateDependent)return!0}return!1}}let aO={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class aj{constructor(e,t){this._structArray=e,this._pos1=t*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class aV{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,t){return e._trim(),t&&(e.isTransferred=!0,t.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){let t=Object.create(this.prototype);return t.arrayBuffer=e.arrayBuffer,t.length=e.length,t.capacity=e.arrayBuffer.byteLength/t.bytesPerElement,t._refreshViews(),t}_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);let t=this.uint8;this._refreshViews(),t&&this.uint8.set(t)}}_refreshViews(){throw Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function aU(e,t=1){let i=0,r=0;return{members:e.map(e=>{let a=aO[e.type].BYTES_PER_ELEMENT,n=i=aN(i,Math.max(t,a)),s=e.components||1;return r=Math.max(r,a),i+=a*s,{name:e.name,type:e.type,components:s,offset:n}}),size:aN(i,Math.max(r,t)),alignment:t}}function aN(e,t){return Math.ceil(e/t)*t}class a$ extends aV{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t){let i=this.length;return this.resize(i+1),this.emplace(i,e,t)}emplace(e,t,i){let r=2*e;return this.int16[r+0]=t,this.int16[r+1]=i,e}}a$.prototype.bytesPerElement=4,aa("StructArrayLayout2i4",a$);class aZ extends aV{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i){let r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){let a=3*e;return this.int16[a+0]=t,this.int16[a+1]=i,this.int16[a+2]=r,e}}aZ.prototype.bytesPerElement=6,aa("StructArrayLayout3i6",aZ);class aG extends aV{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r){let a=this.length;return this.resize(a+1),this.emplace(a,e,t,i,r)}emplace(e,t,i,r,a){let n=4*e;return this.int16[n+0]=t,this.int16[n+1]=i,this.int16[n+2]=r,this.int16[n+3]=a,e}}aG.prototype.bytesPerElement=8,aa("StructArrayLayout4i8",aG);class aq extends aV{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,a,n){let s=this.length;return this.resize(s+1),this.emplace(s,e,t,i,r,a,n)}emplace(e,t,i,r,a,n,s){let o=6*e;return this.int16[o+0]=t,this.int16[o+1]=i,this.int16[o+2]=r,this.int16[o+3]=a,this.int16[o+4]=n,this.int16[o+5]=s,e}}aq.prototype.bytesPerElement=12,aa("StructArrayLayout2i4i12",aq);class aW extends aV{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,a,n){let s=this.length;return this.resize(s+1),this.emplace(s,e,t,i,r,a,n)}emplace(e,t,i,r,a,n,s){let o=4*e,l=8*e;return this.int16[o+0]=t,this.int16[o+1]=i,this.uint8[l+4]=r,this.uint8[l+5]=a,this.uint8[l+6]=n,this.uint8[l+7]=s,e}}aW.prototype.bytesPerElement=8,aa("StructArrayLayout2i4ub8",aW);class aH extends aV{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t){let i=this.length;return this.resize(i+1),this.emplace(i,e,t)}emplace(e,t,i){let r=2*e;return this.float32[r+0]=t,this.float32[r+1]=i,e}}
2aH.prototype.bytesPerElement=8,aa("StructArrayLayout2f8",aH);class aX extends aV{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,a,n,s,o,l,h){let u=this.length;return this.resize(u+1),this.emplace(u,e,t,i,r,a,n,s,o,l,h)}emplace(e,t,i,r,a,n,s,o,l,h,u){let c=10*e;return this.uint16[c+0]=t,this.uint16[c+1]=i,this.uint16[c+2]=r,this.uint16[c+3]=a,this.uint16[c+4]=n,this.uint16[c+5]=s,this.uint16[c+6]=o,this.uint16[c+7]=l,this.uint16[c+8]=h,this.uint16[c+9]=u,e}}aX.prototype.bytesPerElement=20,aa("StructArrayLayout10ui20",aX);class aY extends aV{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,a,n,s,o,l,h,u,c){let d=this.length;return this.resize(d+1),this.emplace(d,e,t,i,r,a,n,s,o,l,h,u,c)}emplace(e,t,i,r,a,n,s,o,l,h,u,c,d){let p=12*e;return this.int16[p+0]=t,this.int16[p+1]=i,this.int16[p+2]=r,this.int16[p+3]=a,this.uint16[p+4]=n,this.uint16[p+5]=s,this.uint16[p+6]=o,this.uint16[p+7]=l,this.int16[p+8]=h,this.int16[p+9]=u,this.int16[p+10]=c,this.int16[p+11]=d,e}}aY.prototype.bytesPerElement=24,aa("StructArrayLayout4i4ui4i24",aY);class aK extends aV{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i){let r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){let a=3*e;return this.float32[a+0]=t,this.float32[a+1]=i,this.float32[a+2]=r,e}}aK.prototype.bytesPerElement=12,aa("StructArrayLayout3f12",aK);class aJ extends aV{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){let t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint32[+e+0]=t,e}}aJ.prototype.bytesPerElement=4,aa("StructArrayLayout1ul4",aJ);class aQ extends aV{_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,t,i,r,a,n,s,o,l){let h=this.length;return this.resize(h+1),this.emplace(h,e,t,i,r,a,n,s,o,l)}emplace(e,t,i,r,a,n,s,o,l,h){let u=10*e;return this.int16[u+0]=t,this.int16[u+1]=i,this.int16[u+2]=r,this.int16[u+3]=a,this.int16[u+4]=n,this.int16[u+5]=s,this.uint32[5*e+3]=o,this.uint16[u+8]=l,this.uint16[u+9]=h,e}}aQ.prototype.bytesPerElement=20,aa("StructArrayLayout6i1ul2ui20",aQ);class a0 extends aV{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,a,n){let s=this.length;return this.resize(s+1),this.emplace(s,e,t,i,r,a,n)}emplace(e,t,i,r,a,n,s){let o=6*e;return this.int16[o+0]=t,this.int16[o+1]=i,this.int16[o+2]=r,this.int16[o+3]=a,this.int16[o+4]=n,this.int16[o+5]=s,e}}a0.prototype.bytesPerElement=12,aa("StructArrayLayout2i2i2i12",a0);class a1 extends aV{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,a){let n=this.length;return this.resize(n+1),this.emplace(n,e,t,i,r,a)}emplace(e,t,i,r,a,n){let s=4*e,o=8*e;return this.float32[s+0]=t,this.float32[s+1]=i,this.float32[s+2]=r,this.int16[o+6]=a,this.int16[o+7]=n,e}}a1.prototype.bytesPerElement=16,aa("StructArrayLayout2f1f2i16",a1);class a2 extends aV{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,a,n){let s=this.length;return this.resize(s+1),this.emplace(s,e,t,i,r,a,n)}emplace(e,t,i,r,a,n,s){let o=16*e,l=4*e,h=8*e;return this.uint8[o+0]=t,this.uint8[o+1]=i,this.float32[l+1]=r,this.float32[l+2]=a,this.int16[h+6]=n,this.int16[h+7]=s,e}}a2.prototype.bytesPerElement=16,aa("StructArrayLayout2ub2f2i16",a2);class a3 extends aV{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i){let r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){let a=3*e;return this.uint16[a+0]=t,this.uint16[a+1]=i,this.uint16[a+2]=r,e}}a3.prototype.bytesPerElement=6,aa("StructArrayLayout3ui6",a3);class a5 extends aV{_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,t,i,r,a,n,s,o,l,h,u,c,d,p,f,m,_){let g=this.length;return this.resize(g+1),this.emplace(g,e,t,i,r,a,n,s,o,l,h,u,c,d,p,f,m,_)}emplace(e,t,i,r,a,n,s,o,l,h,u,c,d,p,f,m,_,g){let y=24*e,x=12*e,v=48*e;return this.int16[y+0]=t,this.int16[y+1]=i,this.uint16[y+2]=r,this.uint16[y+3]=a,this.uint32[x+2]=n,this.uint32[x+3]=s,this.uint32[x+4]=o,this.uint16[y+10]=l,this.uint16[y+11]=h,this.uint16[y+12]=u,this.float32[x+7]=c,this.float32[x+8]=d,this.uint8[v+36]=p,this.uint8[v+37]=f,this.uint8[v+38]=m,this.uint32[x+10]=_,this.int16[y+22]=g,e}}a5.prototype.bytesPerElement=48,aa("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",a5);class a4 extends aV{_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,t,i,r,a,n,s,o,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,P,S,M,C){let I=this.length;return this.resize(I+1),this.emplace(I,e,t,i,r,a,n,s,o,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,P,S,M,C)}emplace(e,t,i,r,a,n,s,o,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,P,S,M,C,I){let A=32*e,E=16*e;return this.int16[A+0]=t,this.int16[A+1]=i,this.int16[A+2]=r,this.int16[A+3]=a,this.int16[A+4]=n,this.int16[A+5]=s,this.int16[A+6]=o,this.int16[A+7]=l,this.uint16[A+8]=h,this.uint16[A+9]=u,this.uint16[A+10]=c,this.uint16[A+11]=d,this.uint16[A+12]=p,this.uint16[A+13]=f,this.uint16[A+14]=m,this.uint16[A+15]=_,this.uint16[A+16]=g,this.uint16[A+17]=y,this.uint16[A+18]=x,this.uint16[A+19]=v,this.uint16[A+20]=b,this.uint16[A+21]=w,this.uint16[A+22]=T,this.uint32[E+12]=P,this.float32[E+13]=S,this.float32[E+14]=M,this.uint16[A+30]=C,this.uint16[A+31]=I,e}}a4.prototype.bytesPerElement=64,aa("StructArrayLayout8i15ui1ul2f2ui64",a4);class a6 extends aV{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){let t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.float32[+e+0]=t,e}}a6.prototype.bytesPerElement=4,aa("StructArrayLayout1f4",a6);class a8 extends aV{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i){let r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){let a=3*e;return this.uint16[6*e+0]=t,this.float32[a+1]=i,this.float32[a+2]=r,e}}a8.prototype.bytesPerElement=12,aa("StructArrayLayout1ui2f12",a8);class a9 extends aV{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i){let r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){let a=4*e;return this.uint32[2*e+0]=t,this.uint16[a+2]=i,this.uint16[a+3]=r,e}}a9.prototype.bytesPerElement=8,aa("StructArrayLayout1ul2ui8",a9);class a7 extends aV{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t){let i=this.length;return this.resize(i+1),this.emplace(i,e,t)}emplace(e,t,i){let r=2*e;return this.uint16[r+0]=t,this.uint16[r+1]=i,e}}a7.prototype.bytesPerElement=4,aa("StructArrayLayout2ui4",a7);
2class ne extends aV{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){let t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint16[+e+0]=t,e}}ne.prototype.bytesPerElement=2,aa("StructArrayLayout1ui2",ne);class nt extends aV{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r){let a=this.length;return this.resize(a+1),this.emplace(a,e,t,i,r)}emplace(e,t,i,r,a){let n=4*e;return this.float32[n+0]=t,this.float32[n+1]=i,this.float32[n+2]=r,this.float32[n+3]=a,e}}nt.prototype.bytesPerElement=16,aa("StructArrayLayout4f16",nt);class ni extends aj{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 b(this.anchorPointX,this.anchorPointY)}}ni.prototype.size=20;class nr extends aQ{get(e){return new ni(this,e)}}aa("CollisionBoxArray",nr);class na extends aj{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]}}na.prototype.size=48;class nn extends a5{get(e){return new na(this,e)}}aa("PlacedSymbolArray",nn);class ns extends aj{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]}}ns.prototype.size=64;class no extends a4{get(e){return new ns(this,e)}}aa("SymbolInstanceArray",no);
2class nl extends a6{getoffsetX(e){return this.float32[+e+0]}}aa("GlyphOffsetArray",nl);class nh extends aZ{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}aa("SymbolLineVertexArray",nh);class nu extends aj{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]}}nu.prototype.size=12;class nc extends a8{get(e){return new nu(this,e)}}aa("TextAnchorOffsetArray",nc);class nd extends aj{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]}}nd.prototype.size=8;class np extends a9{get(e){return new nd(this,e)}}aa("FeatureIndexArray",np);class nf extends a${}class nm extends a${}class n_ extends a${}class ng extends aq{}class ny extends aW{}class nx extends aH{}class nv extends aX{}class nb extends aY{}class nw extends aK{}class nT extends aJ{}class nP extends a0{}class nS extends a2{}class nM extends a3{}class nC extends a7{}let{members:nI}=aU([{name:"a_pos",components:2,type:"Int16"}],4);class nA{constructor(e=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=e}prepareSegment(e,t,i,r){let a=this.segments[this.segments.length-1];return e>nA.MAX_VERTEX_ARRAY_LENGTH&&er(`Max vertices per segment is ${nA.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${nA.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!a||a.vertexLength+e>nA.MAX_VERTEX_ARRAY_LENGTH||a.sortKey!==r?this.createNewSegment(t,i,r):a}createNewSegment(e,t,i){let r={vertexOffset:e.length,primitiveOffset:t.length,vertexLength:0,primitiveLength:0,vaos:{}};return void 0!==i&&(r.sortKey=i),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(r),r}getOrCreateLatestSegment(e,t,i){return this.prepareSegment(0,e,t,i)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(let e of this.segments)for(let t in e.vaos)e.vaos[t].destroy()}static simpleSegment(e,t,i,r){return new nA([{vertexOffset:e,primitiveOffset:t,vertexLength:i,primitiveLength:r,vaos:{},sortKey:0}])}}function nE(e,t){return 256*(e=X(Math.floor(e),0,255))+X(Math.floor(t),0,255)}nA.MAX_VERTEX_ARRAY_LENGTH=65535,aa("SegmentVector",nA);let nz=aU([{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 nk,nD,nR,nL={exports:{}},nF={exports:{}},nB={exports:{}},nO=w(function(){if(nR)return nL.exports;nR=1;var e=(nk||(nk=1,nF.exports=function(e,t){var i,r,a,n,s,o;for(r=e.length-(i=3&e.length),a=t,o=0;o<r;)s=255&e.charCodeAt(o)|(255&e.charCodeAt(++o))<<8|(255&e.charCodeAt(++o))<<16|(255&e.charCodeAt(++o))<<24,++o,a=27492+(65535&(n=5*(65535&(a=(a^=s=(65535&(s=(s=(65535&s)*0xcc9e2d51+(((s>>>16)*0xcc9e2d51&65535)<<16)|0)<<15|s>>>17))*0x1b873593+(((s>>>16)*0x1b873593&65535)<<16)|0)<<13|a>>>19))+((5*(a>>>16)&65535)<<16)|0))+((58964+(n>>>16)&65535)<<16);switch(s=0,i){case 3:s^=(255&e.charCodeAt(o+2))<<16;case 2:s^=(255&e.charCodeAt(o+1))<<8;case 1:a^=s=(65535&(s=(s=(65535&(s^=255&e.charCodeAt(o)))*0xcc9e2d51+(((s>>>16)*0xcc9e2d51&65535)<<16)|0)<<15|s>>>17))*0x1b873593+(((s>>>16)*0x1b873593&65535)<<16)|0}return a^=e.length,a=0x85ebca6b*(65535&(a^=a>>>16))+((0x85ebca6b*(a>>>16)&65535)<<16)|0,a=0xc2b2ae35*(65535&(a^=a>>>13))+((0xc2b2ae35*(a>>>16)&65535)<<16)|0,(a^=a>>>16)>>>0}),nF.exports),t=(nD||(nD=1,nB.exports=function(e,t){for(var i,r=e.length,a=t^r,n=0;r>=4;)i=0x5bd1e995*(65535&(i=255&e.charCodeAt(n)|(255&e.charCodeAt(++n))<<8|(255&e.charCodeAt(++n))<<16|(255&e.charCodeAt(++n))<<24))+((0x5bd1e995*(i>>>16)&65535)<<16),a=0x5bd1e995*(65535&a)+((0x5bd1e995*(a>>>16)&65535)<<16)^(i=0x5bd1e995*(65535&(i^=i>>>24))+((0x5bd1e995*(i>>>16)&65535)<<16)),r-=4,++n;switch(r){case 3:a^=(255&e.charCodeAt(n+2))<<16;case 2:a^=(255&e.charCodeAt(n+1))<<8;case 1:a=0x5bd1e995*(65535&(a^=255&e.charCodeAt(n)))+((0x5bd1e995*(a>>>16)&65535)<<16)}return a=0x5bd1e995*(65535&(a^=a>>>13))+((0x5bd1e995*(a>>>16)&65535)<<16),(a^=a>>>15)>>>0}
2),nB.exports);return nL.exports=e,nL.exports.murmur3=e,nL.exports.murmur2=t,nL.exports}());class nj{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,t,i,r){this.ids.push(nV(e)),this.positions.push(t,i,r)}getPositions(e){if(!this.indexed)throw Error("Trying to get index, but feature positions are not indexed");let t=nV(e),i=0,r=this.ids.length-1;for(;i<r;){let e=i+r>>1;this.ids[e]>=t?r=e:i=e+1}let a=[];for(;this.ids[i]===t;)a.push({index:this.positions[3*i],start:this.positions[3*i+1],end:this.positions[3*i+2]}),i++;return a}static serialize(e,t){let i=new Float64Array(e.ids),r=new Uint32Array(e.positions);return function e(t,i,r,a){for(;r<a;){let n=t[r+a>>1],s=r-1,o=a+1;for(;;){do s++;while(t[s]<n);do o--;while(t[o]>n);if(s>=o)break;nU(t,s,o),nU(i,3*s,3*o),nU(i,3*s+1,3*o+1),nU(i,3*s+2,3*o+2)}o-r<a-o?(e(t,i,r,o),r=o+1):(e(t,i,o+1,a),a=o)}}(i,r,0,i.length-1),t&&t.push(i.buffer,r.buffer),{ids:i,positions:r}}static deserialize(e){let t=new nj;return t.ids=e.ids,t.positions=e.positions,t.indexed=!0,t}}function nV(e){let t=+e;return!isNaN(t)&&t<=Number.MAX_SAFE_INTEGER?t:nO(String(e))}function nU(e,t,i){let r=e[t];e[t]=e[i],e[i]=r}aa("FeaturePositionMap",nj);class nN{constructor(e,t){this.gl=e.gl,this.location=t}}class n$ extends nN{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}}class nZ extends nN{constructor(e,t){super(e,t),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 nG extends nN{constructor(e,t){super(e,t),this.current=tb.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))}}let nq=new Float32Array(16);function nW(e){return[nE(255*e.r,255*e.g),nE(255*e.b,255*e.a)]}class nH{constructor(e,t,i){this.value=e,this.uniformNames=t.map(e=>`u_${e}`),this.type=i}setUniform(e,t,i){e.set(i.constantOr(this.value))}getBinding(e,t,i){return"color"===this.type?new nG(e,t):new n$(e,t)}}class nX{constructor(e,t){this.uniformNames=t.map(e=>`u_${e}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,t){this.pixelRatioFrom=t.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=t.tlbr,this.patternTo=e.tlbr}setUniform(e,t,i,r){let a="u_pattern_to"===r?this.patternTo:"u_pattern_from"===r?this.patternFrom:"u_pixel_ratio_to"===r?this.pixelRatioTo:"u_pixel_ratio_from"===r?this.pixelRatioFrom:null;a&&e.set(a)}getBinding(e,t,i){return"u_pattern"===i.substr(0,9)?new nZ(e,t):new n$(e,t)}}class nY{constructor(e,t,i,r){this.expression=e,this.type=i,this.maxValue=0,this.paintVertexAttributes=t.map(e=>({name:`a_${e}`,type:"Float32",components:"color"===i?2:1,offset:0})),this.paintVertexArray=new r}populatePaintArray(e,t,i,r,a){let n=this.paintVertexArray.length,s=this.expression.evaluate(new ab(0),t,{},r,[],a);this.paintVertexArray.resize(e),this._setPaintValue(n,e,s)}updatePaintArray(e,t,i,r){let a=this.expression.evaluate({zoom:0},i,r);this._setPaintValue(e,t,a)}_setPaintValue(e,t,i){if("color"===this.type){let r=nW(i);for(let i=e;i<t;i++)this.paintVertexArray.emplace(i,r[0],r[1])}else{for(let r=e;r<t;r++)this.paintVertexArray.emplace(r,i);this.maxValue=Math.max(this.maxValue,Math.abs(i))}}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 nK{constructor(e,t,i,r,a,n){this.expression=e,this.uniformNames=t.map(e=>`u_${e}_t`),this.type=i,this.useIntegerZoom=r,this.zoom=a,this.maxValue=0,this.paintVertexAttributes=t.map(e=>({name:`a_${e}`,type:"Float32",components:"color"===i?4:2,offset:0})),this.paintVertexArray=new n}populatePaintArray(e,t,i,r,a){let n=this.expression.evaluate(new ab(this.zoom),t,{},r,[],a),s=this.expression.evaluate(new ab(this.zoom+1),t,{},r,[],a),o=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(o,e,n,s)}updatePaintArray(e,t,i,r){let a=this.expression.evaluate({zoom:this.zoom},i,r),n=this.expression.evaluate({zoom:this.zoom+1},i,r);this._setPaintValue(e,t,a,n)}_setPaintValue(e,t,i,r){if("color"===this.type){let a=nW(i),n=nW(r);for(let i=e;i<t;i++)this.paintVertexArray.emplace(i,a[0],a[1],n[0],n[1])}else{for(let a=e;a<t;a++)this.paintVertexArray.emplace(a,i,r);this.maxValue=Math.max(this.maxValue,Math.abs(i),Math.abs(r))}}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,t){let i=this.useIntegerZoom?Math.floor(t.zoom):t.zoom,r=X(this.expression.interpolationFactor(i,this.zoom,this.zoom+1),0,1);e.set(r)}getBinding(e,t,i){return new n$(e,t)}}class nJ{constructor(e,t,i,r,a,n){this.expression=e,this.type=t,this.useIntegerZoom=i,this.zoom=r,this.layerId=n,this.zoomInPaintVertexArray=new a,this.zoomOutPaintVertexArray=new a}populatePaintArray(e,t,i){let r=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(r,e,t.patterns&&t.patterns[this.layerId],i)}updatePaintArray(e,t,i,r,a){this._setPaintValues(e,t,i.patterns&&i.patterns[this.layerId],a)}_setPaintValues(e,t,i,r){if(!r||!i)return;let{min:a,mid:n,max:s}=i,o=r[a],l=r[n],h=r[s];if(o&&l&&h)for(let i=e;i<t;i++)this.zoomInPaintVertexArray.emplace(i,l.tl[0],l.tl[1],l.br[0],l.br[1],o.tl[0],o.tl[1],o.br[0],o.br[1],l.pixelRatio,o.pixelRatio),this.zoomOutPaintVertexArray.emplace(i,l.tl[0],l.tl[1],l.br[0],l.br[1],h.tl[0],h.tl[1],h.br[0],h.br[1],l.pixelRatio,h.pixelRatio)}upload(e){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,nz.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,nz.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class nQ{constructor(e,t,i){this.binders={},this._buffers=[];const r=[];for(const a in e.paint._values){if(!i(a))continue;const n=e.paint.get(a);if(!(n instanceof aI&&ra(n.property.specification)))continue;const s=function(e,t){return({"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["ga
2pwidth"],"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"]})[e]||[e.replace(`${t}-`,"").replace(/-/g,"_")]}(a,e.type),o=n.value,l=n.property.specification.type,h=n.property.useIntegerZoom,u=n.property.specification["property-type"],c="cross-faded"===u||"cross-faded-data-driven"===u;if("constant"===o.kind)this.binders[a]=c?new nX(o.value,s):new nH(o.value,s,l),r.push(`/u_${a}`);else if("source"===o.kind||c){const i=n1(a,l,"source");this.binders[a]=c?new nJ(o,l,h,t,i,e.id):new nY(o,s,l,i),r.push(`/a_${a}`)}else{const e=n1(a,l,"composite");this.binders[a]=new nK(o,s,l,h,t,e),r.push(`/z_${a}`)}}this.cacheKey=r.sort().join("")}getMaxValue(e){let t=this.binders[e];return t instanceof nY||t instanceof nK?t.maxValue:0}populatePaintArrays(e,t,i,r,a){for(let n in this.binders){let s=this.binders[n];(s instanceof nY||s instanceof nK||s instanceof nJ)&&s.populatePaintArray(e,t,i,r,a)}}setConstantPatternPositions(e,t){for(let i in this.binders){let r=this.binders[i];r instanceof nX&&r.setConstantPatternPositions(e,t)}}updatePaintArrays(e,t,i,r,a){let n=!1;for(let s in e)for(let o of t.getPositions(s)){let t=i.feature(o.index);for(let i in this.binders){let l=this.binders[i];(l instanceof nY||l instanceof nK||l instanceof nJ)&&!0===l.expression.isStateDependent&&(l.expression=r.paint.get(i).value,l.updatePaintArray(o.start,o.end,t,e[s],a),n=!0)}}return n}defines(){let e=[];for(let t in this.binders){let i=this.binders[t];(i instanceof nH||i instanceof nX)&&e.push(...i.uniformNames.map(e=>`#define HAS_UNIFORM_${e}`))}return e}getBinderAttributes(){let e=[];for(let t in this.binders){let i=this.binders[t];if(i instanceof nY||i instanceof nK)for(let t=0;t<i.paintVertexAttributes.length;t++)e.push(i.paintVertexAttributes[t].name);else if(i instanceof nJ)for(let t=0;t<nz.members.length;t++)e.push(nz.members[t].name)}return e}getBinderUniforms(){let e=[];for(let t in this.binders){let i=this.binders[t];if(i instanceof nH||i instanceof nX||i instanceof nK)for(let t of i.uniformNames)e.push(t)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,t){let i=[];for(let r in this.binders){let a=this.binders[r];if(a instanceof nH||a instanceof nX||a instanceof nK){for(let n of a.uniformNames)if(t[n]){let s=a.getBinding(e,t[n],n);i.push({name:n,property:r,binding:s})}}}return i}setUniforms(e,t,i,r){for(let{name:e,property:a,binding:n}of t)this.binders[a].setUniform(n,r,i.get(a),e)}updatePaintBuffers(e){for(let t in this._buffers=[],this.binders){let i=this.binders[t];if(e&&i instanceof nJ){let t=2===e.fromScale?i.zoomInPaintVertexBuffer:i.zoomOutPaintVertexBuffer;t&&this._buffers.push(t)}else(i instanceof nY||i instanceof nK)&&i.paintVertexBuffer&&this._buffers.push(i.paintVertexBuffer)}}upload(e){for(let t in this.binders){let i=this.binders[t];(i instanceof nY||i instanceof nK||i instanceof nJ)&&i.upload(e)}this.updatePaintBuffers()}destroy(){for(let e in this.binders){let t=this.binders[e];(t instanceof nY||t instanceof nK||t instanceof nJ)&&t.destroy()}}}class n0{constructor(e,t,i=()=>!0){for(const r of(this.programConfigurations={},e))this.programConfigurations[r.id]=new nQ(r,t,i);this.needsUpload=!1,this._featureMap=new nj,this._bufferOffset=0}populatePaintArrays(e,t,i,r,a,n){for(let i in this.programConfigurations)this.programConfigurations[i].populatePaintArrays(e,t,r,a,n);void 0!==t.id&&this._featureMap.add(t.id,i,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,t,i,r){for(let a of i)this.needsUpload=this.programConfigurations[a.id].updatePaintArrays(e,this._featureMap,t,a,r)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(let t in this.programConfigurations)this.programConfigurations[t].upload(e);this.needsUpload=!1}}destroy(){for(let e in this.programConfigurations)this.programConfigurations[e].destroy()}}function n1(e,t,i){let r={"line-pattern":{source:nv,composite:nv},"fill-pattern":{source:nv,composite:nv},"fill-extrusion-pattern":{source:nv,composite:nv}}[e];return r&&r[i]||({color:{source:aH,composite:nt},number:{source:a6,composite:aH}})[t][i]}aa("ConstantBinder",nH),aa("CrossFadedConstantBinder",nX),aa("SourceExpressionBinder",nY),aa("CrossFadedCompositeBinder",nJ),aa("CompositeExpressionBinder",nK),aa("ProgramConfiguration",nQ,{omit:["_buffers"]}),aa("ProgramConfigurationSet",n0);let n2=-16383-1;function n3(e){let t=8192/e.extent,i=e.loadGeometry();for(let e=0;e<i.length;e++){let r=i[e];for(let e=0;e<r.length;e++){let i=r[e],a=Math.round(i.x*t),n=Math.round(i.y*t);i.x=X(a,n2,16383),i.y=X(n,n2,16383),(a<i.x||a>i.x+1||n<i.y||n>i.y+1)&&er("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return i}function n5(e,t){return{type:e.type,id:e.id,properties:e.properties,geometry:t?n3(e):[]}}class n4{constructor(e){this.zoom=e.zoom,this.globalState=e.globalState,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new nm,this.indexArray=new nM,this.segments=new nA,this.programConfigurations=new n0(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(e,t,i){let r=this.layers[0],a=[],n=null,s=!1,o="heatmap"===r.type;
2"circle"===r.type&&(s=!(n=r.layout.get("circle-sort-key")).isConstant(),o=o||"map"===r.paint.get("circle-pitch-alignment"));let l=o?t.subdivisionGranularity.circle:1;for(let{feature:t,id:r,index:o,sourceLayerIndex:l}of e){let e=this.layers[0]._featureFilter.needGeometry,h=n5(t,e);if(!this.layers[0]._featureFilter.filter(new ab(this.zoom,{globalState:this.globalState}),h,i))continue;let u=s?n.evaluate(h,{},i):void 0,c={id:r,properties:t.properties,type:t.type,sourceLayerIndex:l,index:o,geometry:e?h.geometry:n3(t),patterns:{},sortKey:u};a.push(c)}for(let r of(s&&a.sort((e,t)=>e.sortKey-t.sortKey),a)){let{geometry:a,index:n,sourceLayerIndex:s}=r,o=e[n].feature;this.addFeature(r,a,n,i,l),t.featureIndex.insert(o,a,n,s,this.index)}}update(e,t,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,i)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,nI),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,t,i,r,a=1){let n;switch(a){case 1:n=[0,7];break;case 3:n=[0,2,5,7];break;case 5:n=[0,1,3,4,6,7];break;case 7:n=[0,1,2,3,4,5,6,7];break;default:throw Error(`Invalid circle bucket granularity: ${a}; valid values are 1, 3, 5, 7.`)}let s=n.length;for(let i of t)for(let t of i){let i=t.x,r=t.y;if(i<0||i>=8192||r<0||r>=8192)continue;let a=this.segments.prepareSegment(s*s,this.layoutVertexArray,this.indexArray,e.sortKey),u=a.vertexLength;for(let e=0;e<s;e++)for(let t=0;t<s;t++){var o,l,h;o=this.layoutVertexArray,l=n[t],h=n[e],o.emplaceBack(-32768+8*i+l,-32768+8*r+h)}for(let e=0;e<s-1;e++)for(let t=0;t<s-1;t++){let i=u+e*s+t,r=u+(e+1)*s+t;this.indexArray.emplaceBack(i,r+1,i+1),this.indexArray.emplaceBack(i,r,r+1)}a.vertexLength+=s*s,a.primitiveLength+=(s-1)*(s-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,{},r)}}function n6(e,t){for(let i=0;i<e.length;i++)if(si(t,e[i]))return!0;for(let i=0;i<t.length;i++)if(si(e,t[i]))return!0;return!!n9(e,t)}function n8(e,t){if(1===e.length)return st(t,e[0]);for(let i=0;i<t.length;i++){let r=t[i];for(let t=0;t<r.length;t++)if(si(e,r[t]))return!0}for(let i=0;i<e.length;i++)if(st(t,e[i]))return!0;for(let i=0;i<t.length;i++)if(n9(e,t[i]))return!0;return!1}function n9(e,t){if(0===e.length||0===t.length)return!1;for(let s=0;s<e.length-1;s++){let o=e[s],l=e[s+1];for(let e=0;e<t.length-1;e++){var i,r,a,n;if(i=o,r=l,a=t[e],ea(i,a,n=t[e+1])!==ea(r,a,n)&&ea(i,r,a)!==ea(i,r,n))return!0}}return!1}function n7(e,t,i){let r=i*i;if(1===t.length)return e.distSqr(t[0])<r;for(let i=1;i<t.length;i++)if(se(e,t[i-1],t[i])<r)return!0;return!1}function se(e,t,i){let r=t.distSqr(i);if(0===r)return e.distSqr(t);let a=((e.x-t.x)*(i.x-t.x)+(e.y-t.y)*(i.y-t.y))/r;return e.distSqr(a<0?t:a>1?i:i.sub(t)._mult(a)._add(t))}function st(e,t){let i,r,a,n=!1;for(let s=0;s<e.length;s++){i=e[s];for(let e=0,s=i.length-1;e<i.length;s=e++)r=i[e],a=i[s],r.y>t.y!=a.y>t.y&&t.x<(a.x-r.x)*(t.y-r.y)/(a.y-r.y)+r.x&&(n=!n)}return n}function si(e,t){let i=!1;for(let r=0,a=e.length-1;r<e.length;a=r++){let n=e[r],s=e[a];n.y>t.y!=s.y>t.y&&t.x<(s.x-n.x)*(t.y-n.y)/(s.y-n.y)+n.x&&(i=!i)}return i}function sr(e,t,i){let r=t.paint.get(e).value;return"constant"===r.kind?r.value:i.programConfigurations.get(t.id).getMaxValue(e)}function sa(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function sn(e,t,i,r,a){if(!t[0]&&!t[1])return e;let n=b.convert(t)._mult(a);"viewport"===i&&n._rotate(-r);let s=[];for(let t=0;t<e.length;t++)s.push(e[t].sub(n));return s}aa("CircleBucket",n4,{omit:["layers"]});var ss={get paint(){return s=s||new aL({"circle-radius":new az(eA.paint_circle["circle-radius"]),"circle-color":new az(eA.paint_circle["circle-color"]),"circle-blur":new az(eA.paint_circle["circle-blur"]),"circle-opacity":new az(eA.paint_circle["circle-opacity"]),"circle-translate":new aE(eA.paint_circle["circle-translate"]),"circle-translate-anchor":new aE(eA.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new aE(eA.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new aE(eA.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new az(eA.paint_circle["circle-stroke-width"]),"circle-stroke-color":new az(eA.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new az(eA.paint_circle["circle-stroke-opacity"])})},get layout(){return n=n||new aL({"circle-sort-key":new az(eA.layout_circle["circle-sort-key"])})}};class so extends aB{constructor(e){super(e,ss)}createBucket(e){return new n4(e)}queryRadius(e){return sr("circle-radius",this,e)+sr("circle-stroke-width",this,e)+sa(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:i,geometry:r,transform:a,pixelsToTileUnits:n,unwrappedTileID:s,getElevation:o}){var l;let h=sn(e,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-a.bearingInRadians,n),u=this.paint.get("circle-radius").evaluate(t,i)+this.paint.get("circle-stroke-width").evaluate(t,i),c="map"===this.paint.get("circle-pitch-alignment"),d=c?h:h.map(e=>sl(e,a,s,o)),p=c?u*n:u;for(let e of r)for(let t of e){let e=c?t:sl(t,a,s,o),i=p,r=a.projectTileCoordinates(t.x,t.y,s,o).signedDistanceFromCamera;if("viewport"===this.paint.get("circle-pitch-scale")&&"map"===this.paint.get("circle-pitch-alignment")?i*=r/a.cameraToCenterDistance:"map"===this.paint.get("circle-pitch-scale")&&"viewport"===this.paint.get("circle-pitch-alignment")&&(i*=a.cameraToCenterDistance/r),l=i,si(d,e)||n7(e,d,l))return!0}return!1}}function sl(e,t,i,r){let a=t.projectTileCoordinates(e.x,e.y,i,r).point;return new b((.5*a.x+.5)*t.width,(-(.5*a.y)+.5)*t.height)}class sh extends n4{}aa("HeatmapBucket",sh,{omit:["layers"]});var su={get paint(){return o=o||new aL({"heatmap-radius":new az(eA.paint_heatmap["heatmap-radius"]),"heatmap-weight":new az(eA.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new aE(eA.paint_heatmap["heatmap-intensity"]),"heatmap-color":new aR(eA.paint_heatmap["heatmap-color"]),"heatmap-opacity":new aE(eA.paint_heatmap["heatmap-opacity"])})}};function sc(e,{width:t,height:i},r,a){if(a){if(a instanceof Uint8ClampedArray)a=new Uint8Array(a.buffer);else if(a.length!==t*i*r)throw RangeError(`mismatched image size. expected: ${a.length} but got: ${t*i*r}`)}else a=new Uint8Array(t*i*r);return e.width=t,e.height=i,e.data=a,e}function sd(e,{width:t,height:i},r){if(t===e.width&&i===e.height)return;let a=sc({},{width:t,height:i},r);
2sp(e,a,{x:0,y:0},{x:0,y:0},{width:Math.min(e.width,t),height:Math.min(e.height,i)},r),e.width=t,e.height=i,e.data=a.data}function sp(e,t,i,r,a,n){if(0===a.width||0===a.height)return t;if(a.width>e.width||a.height>e.height||i.x>e.width-a.width||i.y>e.height-a.height)throw RangeError("out of range source coordinates for image copy");if(a.width>t.width||a.height>t.height||r.x>t.width-a.width||r.y>t.height-a.height)throw RangeError("out of range destination coordinates for image copy");let s=e.data,o=t.data;if(s===o)throw Error("srcData equals dstData, so image is already copied");for(let l=0;l<a.height;l++){let h=((i.y+l)*e.width+i.x)*n,u=((r.y+l)*t.width+r.x)*n;for(let e=0;e<a.width*n;e++)o[u+e]=s[h+e]}return t}class sf{constructor(e,t){sc(this,e,1,t)}resize(e){sd(this,e,1)}clone(){return new sf({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,i,r,a){sp(e,t,i,r,a,1)}}class sm{constructor(e,t){sc(this,e,4,t)}resize(e){sd(this,e,4)}replace(e,t){t?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new sm({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,i,r,a){sp(e,t,i,r,a,4)}setPixel(e,t,i){let r=4*(e*this.width+t);this.data[r+0]=Math.round(255*i.r/i.a),this.data[r+1]=Math.round(255*i.g/i.a),this.data[r+2]=Math.round(255*i.b/i.a),this.data[r+3]=Math.round(255*i.a)}}function s_(e){let t={},i=e.resolution||256,r=e.clips?e.clips.length:1,a=e.image||new sm({width:i,height:r});if(Math.log(i)/Math.LN2%1!=0)throw Error(`width is not a power of 2 - ${i}`);let n=(r,n,s)=>{t[e.evaluationKey]=s;let o=e.expression.evaluate(t);a.setPixel(r/4/i,n/4,o)};if(e.clips)for(let t=0,a=0;t<r;++t,a+=4*i)for(let r=0,s=0;r<i;r++,s+=4){let o=r/(i-1),{start:l,end:h}=e.clips[t];n(a,s,l*(1-o)+h*o)}else for(let e=0,t=0;e<i;e++,t+=4)n(0,t,e/(i-1));return a}aa("AlphaImage",sf),aa("RGBAImage",sm);let sg="big-fb";class sy extends aB{createBucket(e){return new sh(e)}constructor(e){super(e,su),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){"heatmap-color"===e&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=s_({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(sg)&&this.heatmapFbos.delete(sg)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}}var sx={get paint(){return l=l||new aL({"hillshade-illumination-direction":new aE(eA.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-altitude":new aE(eA.paint_hillshade["hillshade-illumination-altitude"]),"hillshade-illumination-anchor":new aE(eA.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new aE(eA.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new aE(eA.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new aE(eA.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new aE(eA.paint_hillshade["hillshade-accent-color"]),"hillshade-method":new aE(eA.paint_hillshade["hillshade-method"])})}};class sv extends aB{constructor(e){super(e,sx),this.recalculate({zoom:0,zoomHistory:{}},void 0)}getIlluminationProperties(){let e=this.paint.get("hillshade-illumination-direction").values,t=this.paint.get("hillshade-illumination-altitude").values,i=this.paint.get("hillshade-highlight-color").values,r=this.paint.get("hillshade-shadow-color").values,a=Math.max(e.length,t.length,i.length,r.length);e=e.concat(Array(a-e.length).fill(e.at(-1))),t=t.concat(Array(a-t.length).fill(t.at(-1))),i=i.concat(Array(a-i.length).fill(i.at(-1))),r=r.concat(Array(a-r.length).fill(r.at(-1)));let n=t.map(ec);return{directionRadians:e.map(ec),altitudeRadians:n,shadowColor:r,highlightColor:i}}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}}var sb={get paint(){return h=h||new aL({"color-relief-opacity":new aE(eA["paint_color-relief"]["color-relief-opacity"]),"color-relief-color":new aR(eA["paint_color-relief"]["color-relief-color"])})}};class sw{constructor(e,t,i,r){this.context=e,this.format=i,this.texture=e.gl.createTexture(),this.update(t,r)}update(e,t,i){let{width:r,height:a}
2=e,n=!(this.size&&this.size[0]===r&&this.size[1]===a||i),{context:s}=this,{gl:o}=s;if(this.useMipmap=!!(t&&t.useMipmap),o.bindTexture(o.TEXTURE_2D,this.texture),s.pixelStoreUnpackFlipY.set(!1),s.pixelStoreUnpack.set(1),s.pixelStoreUnpackPremultiplyAlpha.set(this.format===o.RGBA&&(!t||!1!==t.premultiply)),n)this.size=[r,a],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||eo(e)?o.texImage2D(o.TEXTURE_2D,0,this.format,this.format,o.UNSIGNED_BYTE,e):o.texImage2D(o.TEXTURE_2D,0,this.format,r,a,0,this.format,o.UNSIGNED_BYTE,e.data);else{let{x:t,y:n}=i||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||eo(e)?o.texSubImage2D(o.TEXTURE_2D,0,t,n,o.RGBA,o.UNSIGNED_BYTE,e):o.texSubImage2D(o.TEXTURE_2D,0,t,n,r,a,o.RGBA,o.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&o.generateMipmap(o.TEXTURE_2D),s.pixelStoreUnpackFlipY.setDefault(),s.pixelStoreUnpack.setDefault(),s.pixelStoreUnpackPremultiplyAlpha.setDefault()}bind(e,t,i){let{context:r}=this,{gl:a}=r;a.bindTexture(a.TEXTURE_2D,this.texture),i!==a.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(i=a.LINEAR),e!==this.filter&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,e),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,i||e),this.filter=e),t!==this.wrap&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,t),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,t),this.wrap=t)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){let{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}class sT{constructor(e,t,i,r=1,a=1,n=1,s=0){if(this.uid=e,t.height!==t.width)throw RangeError("DEM tiles must be square");if(i&&!["mapbox","terrarium","custom"].includes(i))return void er(`"${i}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=t.height;const o=this.dim=t.height-2;switch(this.data=new Uint32Array(t.data.buffer),i){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=r,this.greenFactor=a,this.blueFactor=n,this.baseShift=s;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let e=0;e<o;e++)this.data[this._idx(-1,e)]=this.data[this._idx(0,e)],this.data[this._idx(o,e)]=this.data[this._idx(o-1,e)],this.data[this._idx(e,-1)]=this.data[this._idx(e,0)],this.data[this._idx(e,o)]=this.data[this._idx(e,o-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(o,-1)]=this.data[this._idx(o-1,0)],this.data[this._idx(-1,o)]=this.data[this._idx(0,o-1)],this.data[this._idx(o,o)]=this.data[this._idx(o-1,o-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let e=0;e<o;e++)for(let t=0;t<o;t++){const i=this.get(e,t);i>this.max&&(this.max=i),i<this.min&&(this.min=i)}}get(e,t){let i=new Uint8Array(this.data.buffer),r=4*this._idx(e,t);return this.unpack(i[r],i[r+1],i[r+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(e,t){if(e<-1||e>=this.dim+1||t<-1||t>=this.dim+1)throw RangeError("out of range source coordinates for DEM data");return(t+1)*this.stride+(e+1)}unpack(e,t,i){return e*this.redFactor+t*this.greenFactor+i*this.blueFactor-this.baseShift}pack(e){return sP(e,this.getUnpackVector())}getPixels(){return new sm({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,t,i){if(this.dim!==e.dim)throw Error("dem dimension mismatch");let r=t*this.dim,a=t*this.dim+this.dim,n=i*this.dim,s=i*this.dim+this.dim;switch(t){case -1:r=a-1;break;case 1:a=r+1}switch(i){case -1:n=s-1;break;case 1:s=n+1}let o=-t*this.dim,l=-i*this.dim;for(let t=n;t<s;t++)for(let i=r;i<a;i++)this.data[this._idx(i,t)]=e.data[this._idx(i+o,t+l)]}}function sP(e,t){let i=t[0],r=t[1],a=t[2],n=t[3],s=Math.min(i,r,a),o=Math.round((e+n)/s);return{r:Math.floor(o*s/i)%256,g:Math.floor(o*s/r)%256,b:Math.floor(o*s/a)%256}}aa("DEMData",sT);class sS extends aB{constructor(e){super(e,sb)}_createColorRamp(e){let t={elevationStops:[],colorStops:[]},i=this._transitionablePaint._values["color-relief-color"].value.expression;if(i instanceof ry&&i._styleExpression.expression instanceof t7){this.colorRampExpression=i;let e=i._styleExpression.expression;for(let i of(t.elevationStops=e.labels,t.colorStops=[],t.elevationStops))t.colorStops.push(e.evaluate({globals:{elevation:i}}))}if(t.elevationStops.length<1&&(t.elevationStops=[0],t.colorStops=[tb.transparent]),t.elevationStops.length<2&&(t.elevationStops.push(t.elevationStops[0]+1),t.colorStops.push(t.colorStops[0])),t.elevationStops.length<=e)return t;let r={elevationStops:[],colorStops:[]},a=(t.elevationStops.length-1)/(e-1);for(let e=0;e<t.elevationStops.length-.5;e+=a)r.elevationStops.push(t.elevationStops[Math.round(e)]),r.colorStops.push(t.colorStops[Math.round(e)]);return er(`Too many colors in specification of ${this.id}
2 color-relief layer, may not render properly.`),r}_colorRampChanged(){return this.colorRampExpression!=this._transitionablePaint._values["color-relief-color"].value.expression}getColorRampTextures(e,t,i){if(this.colorRampTextures&&!this._colorRampChanged())return this.colorRampTextures;let r=this._createColorRamp(t),a=new sm({width:r.colorStops.length,height:1}),n=new sm({width:r.colorStops.length,height:1});for(let e=0;e<r.elevationStops.length;e++){let t=sP(r.elevationStops[e],i);n.setPixel(0,e,new tb(t.r/255,t.g/255,t.b/255,1)),a.setPixel(0,e,r.colorStops[e])}return this.colorRampTextures={elevationTexture:new sw(e,n,e.gl.RGBA),colorTexture:new sw(e,a,e.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return"none"!==this.visibility&&!!this.colorRampTextures}}let{members:sM}=aU([{name:"a_pos",components:2,type:"Int16"}],4);function sC(e,t,i){let r=i.patternDependencies,a=!1;for(let i of t){let t=i.paint.get(`${e}-pattern`);t.isConstant()||(a=!0);let n=t.constantOr(null);n&&(a=!0,r[n.to]=!0,r[n.from]=!0)}return a}function sI(e,t,i,r,a){let n=a.patternDependencies;for(let s of t){let t=s.paint.get(`${e}-pattern`).value;if("constant"!==t.kind){let e=t.evaluate({zoom:r-1},i,{},a.availableImages),o=t.evaluate({zoom:r},i,{},a.availableImages),l=t.evaluate({zoom:r+1},i,{},a.availableImages);e=e&&e.name?e.name:e,o=o&&o.name?o.name:o,l=l&&l.name?l.name:l,n[e]=!0,n[o]=!0,n[l]=!0,i.patterns[s.id]={min:e,mid:o,max:l}}}return i}function sA(e,t,i,r,a){let n;if(a===function(e,t,i,r){let a=0;for(let n=t,s=i-r;n<i;n+=r)a+=(e[s]-e[n])*(e[n+1]+e[s+1]),s=n;return a}(e,t,i,r)>0)for(let a=t;a<i;a+=r)n=sN(a/r|0,e[a],e[a+1],n);else for(let a=i-r;a>=t;a-=r)n=sN(a/r|0,e[a],e[a+1],n);return n&&sF(n,n.next)&&(s$(n),n=n.next),n}function sE(e,t){if(!e)return e;t||(t=e);let i,r=e;do if(i=!1,r.steiner||!sF(r,r.next)&&0!==sL(r.prev,r,r.next))r=r.next;else{if(s$(r),(r=t=r.prev)===r.next)break;i=!0}while(i||r!==t);return t}function sz(e,t){let i=e.x-t.x;return 0===i&&0==(i=e.y-t.y)&&(i=(e.next.y-e.y)/(e.next.x-e.x)-(t.next.y-t.y)/(t.next.x-t.x)),i}function sk(e,t,i,r,a){return(e=0x55555555&((e=0x33333333&((e=0xf0f0f0f&((e=0xff00ff&((e=(e-i)*a|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=0x55555555&((t=0x33333333&((t=0xf0f0f0f&((t=0xff00ff&((t=(t-r)*a|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function sD(e,t,i,r,a,n,s,o){return(a-s)*(t-o)>=(e-s)*(n-o)&&(e-s)*(r-o)>=(i-s)*(t-o)&&(i-s)*(n-o)>=(a-s)*(r-o)}function sR(e,t,i,r,a,n,s,o){return(e!==s||t!==o)&&sD(e,t,i,r,a,n,s,o)}function sL(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function sF(e,t){return e.x===t.x&&e.y===t.y}function sB(e,t,i,r){let a=sj(sL(e,t,i)),n=sj(sL(e,t,r)),s=sj(sL(i,r,e)),o=sj(sL(i,r,t));
2return a!==n&&s!==o||!(0!==a||!sO(e,i,t))||!(0!==n||!sO(e,r,t))||!(0!==s||!sO(i,e,r))||!(0!==o||!sO(i,t,r))}function sO(e,t,i){return t.x<=Math.max(e.x,i.x)&&t.x>=Math.min(e.x,i.x)&&t.y<=Math.max(e.y,i.y)&&t.y>=Math.min(e.y,i.y)}function sj(e){return e>0?1:e<0?-1:0}function sV(e,t){return 0>sL(e.prev,e,e.next)?sL(e,t,e.next)>=0&&sL(e,e.prev,t)>=0:0>sL(e,t,e.prev)||0>sL(e,e.next,t)}function sU(e,t){let i=sZ(e.i,e.x,e.y),r=sZ(t.i,t.x,t.y),a=e.next,n=t.prev;return e.next=t,t.prev=e,i.next=a,a.prev=i,r.next=i,i.prev=r,n.next=r,r.prev=n,r}function sN(e,t,i,r){let a=sZ(e,t,i);return r?(a.next=r.next,a.prev=r,r.next.prev=a,r.next=a):(a.prev=a,a.next=a),a}function s$(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function sZ(e,t,i){return{i:e,x:t,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class sG{constructor(e,t){if(t>e)throw Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=e,this._minGranularity=t}getGranularityForZoomLevel(e){return Math.max(Math.floor(this._baseZoomGranularity/(1<<e)),this._minGranularity,1)}}class sq{constructor(e){this.fill=e.fill,this.line=e.line,this.tile=e.tile,this.stencil=e.stencil,this.circle=e.circle}}sq.noSubdivision=new sq({fill:new sG(0,0),line:new sG(0,0),tile:new sG(0,0),stencil:new sG(0,0),circle:1}),aa("SubdivisionGranularityExpression",sG),aa("SubdivisionGranularitySetting",sq);class sW{constructor(e,t){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=e,this._granularityCellSize=8192/e,this._canonical=t}_getKey(e,t){return(e+=32768)<<16|t+32768}_vertexToIndex(e,t){if(e<-32768||t<-32768||e>32767||t>32767)throw Error("Vertex coordinates are out of signed 16 bit integer range.");let i=0|Math.round(e),r=0|Math.round(t),a=this._getKey(i,r);if(this._vertexDictionary.has(a))return this._vertexDictionary.get(a);let n=this._vertexBuffer.length/2;return this._vertexDictionary.set(a,n),this._vertexBuffer.push(i,r),n}_subdivideTrianglesScanline(e){if(this._granularity<2)return function(e,t){let i=[];for(let r=0;r<t.length;r+=3){let a=t[r],n=t[r+1],s=t[r+2],o=e[2*a],l=e[2*a+1];(e[2*n]-o)*(e[2*s+1]-l)-(e[2*n+1]-l)*(e[2*s]-o)>0?(i.push(a),i.push(s),i.push(n)):(i.push(a),i.push(n),i.push(s))}return i}(this._vertexBuffer,e);let t=[],i=e.length;for(let r=0;r<i;r+=3){let i=[e[r+0],e[r+1],e[r+2]],a=[this._vertexBuffer[2*e[r+0]+0],this._vertexBuffer[2*e[r+0]+1],this._vertexBuffer[2*e[r+1]+0],this._vertexBuffer[2*e[r+1]+1],this._vertexBuffer[2*e[r+2]+0],this._vertexBuffer[2*e[r+2]+1]],n=1/0,s=1/0,o=-1/0,l=-1/0;for(let e=0;e<3;e++){let t=a[2*e],i=a[2*e+1];n=Math.min(n,t),o=Math.max(o,t),s=Math.min(s,i),l=Math.max(l,i)}if(n===o||s===l)continue;let h=Math.floor(n/this._granularityCellSize),u=Math.ceil(o/this._granularityCellSize),c=Math.floor(s/this._granularityCellSize),d=Math.ceil(l/this._granularityCellSize);if(h!==u||c!==d)for(let e=c;e<d;e++){let r=this._scanlineGenerateVertexRingForCellRow(e,a,i);!function(e,t,i){if(0===t.length)throw Error("Subdivision vertex ring is empty.");let r=0,a=e[2*t[0]];for(let i=1;i<t.length;i++){let n=e[2*t[i]];n<a&&(a=n,r=i)}let n=t.length,s=r,o=(s+1)%n;for(;;){let r=s-1>=0?s-1:n-1,a=(o+1)%n,l=e[2*t[r]],h=e[2*t[a]],u=e[2*t[s]],c=e[2*t[s]+1],d=e[2*t[o]+1],p=!1;if(l<h)p=!0;else if(l>h)p=!1;else{let i=d-c,n=-(e[2*t[o]]-u),s=c<d?1:-1;((l-u)*i+(e[2*t[r]+1]-c)*n)*s>((h-u)*i+(e[2*t[a]+1]-c)*n)*s&&(p=!0)}if(p){let e=t[r],a=t[s],l=t[o];e!==a&&e!==l&&a!==l&&i.push(l,a,e),--s<0&&(s=n-1)}else{let e=t[a],r=t[s],l=t[o];e!==r&&e!==l&&r!==l&&i.push(l,r,e),++o>=n&&(o=0)}if(r===a)break}}(this._vertexBuffer,r,t)}else t.push(...i)}return t}_scanlineGenerateVertexRingForCellRow(e,t,i){let r=e*this._granularityCellSize,a=r+this._granularityCellSize,n=[];for(let e=0;e<3;e++){let s=t[2*e],o=t[2*e+1],l=t[2*(e+1)%6],h=t[(2*(e+1)+1)%6],u=t[2*(e+2)%6],c=t[(2*(e+2)+1)%6],d=l-s,p=h-o,f=0===d,m=0===p,_=(r-o)/p,g=(a-o)/p,y=Math.min(_,g),x=Math.max(_,g);if(!m&&(y>=1||x<=0)||m&&(o<r||o>a)){h>=r&&h<=a&&n.push(i[(e+1)%3]);continue}!m&&y>0&&n.push(this._vertexToIndex(s+d*y,o+p*y));let v=s+d*Math.max(y,0),b=s+d*Math.min(x,1);f||this._generateIntraEdgeVertices(n,s,o,l,h,v,b),!m&&x<1&&n.push(this._vertexToIndex(s+d*x,o+p*x)),(m||h>=r&&h<=a)&&n.push(i[(e+1)%3]),!m&&(h<=r||h>=a)&&this._generateInterEdgeVertices(n,s,o,l,h,u,c,b,r,a)}return n}_generateIntraEdgeVertices(e,t,i,r,a,n,s){let o=r-t,l=a-i,h=0===l,u=h?Math.min(t,r):Math.min(n,s),c=h?Math.max(t,r):Math.max(n,s),d=Math.floor(u/this._granularityCellSize)+1,p=Math.ceil(c/this._granularityCellSize)-1;
2if(h?t<r:n<s)for(let r=d;r<=p;r++){let a=r*this._granularityCellSize;e.push(this._vertexToIndex(a,i+l*(a-t)/o))}else for(let r=p;r>=d;r--){let a=r*this._granularityCellSize;e.push(this._vertexToIndex(a,i+l*(a-t)/o))}}_generateInterEdgeVertices(e,t,i,r,a,n,s,o,l,h){let u=s-a,c=(l-a)/u,d=(h-a)/u,p=Math.min(c,d),f=Math.max(c,d),m=r+(n-r)*p,_=Math.floor(Math.min(m,o)/this._granularityCellSize)+1,g=Math.ceil(Math.max(m,o)/this._granularityCellSize)-1,y=o<m,x=0===u;if(x&&(s===l||s===h))return;if(x||p>=1||f<=0){let e=i-s,r=n+(t-n)*Math.min((l-s)/e,(h-s)/e);_=Math.floor(Math.min(r,o)/this._granularityCellSize)+1,g=Math.ceil(Math.max(r,o)/this._granularityCellSize)-1,y=o<r}let v=a-i>0?h:l;if(y)for(let t=_;t<=g;t++)e.push(this._vertexToIndex(t*this._granularityCellSize,v));else for(let t=g;t>=_;t--)e.push(this._vertexToIndex(t*this._granularityCellSize,v))}_generateOutline(e){let t=[];for(let i of e){let e=sX(i,this._granularity,!0),r=this._pointArrayToIndices(e),a=[];for(let e=1;e<r.length;e++)a.push(r[e-1]),a.push(r[e]);t.push(a)}return t}_handlePoles(e){let t=!1,i=!1;this._canonical&&(0===this._canonical.y&&(t=!0),this._canonical.y===(1<<this._canonical.z)-1&&(i=!0)),(t||i)&&this._fillPoles(e,t,i)}_ensureNoPoleVertices(){let e=this._vertexBuffer;for(let t=0;t<e.length;t+=2){let i=e[t+1];-32768===i&&(e[t+1]=-32767),32767===i&&(e[t+1]=32766)}}_generatePoleQuad(e,t,i,r,a,n){r>a!=(-32768===n)?(e.push(t),e.push(i),e.push(this._vertexToIndex(r,n)),e.push(i),e.push(this._vertexToIndex(a,n))):(e.push(i),e.push(t),e.push(this._vertexToIndex(r,n)),e.push(this._vertexToIndex(a,n)),e.push(i)),e.push(this._vertexToIndex(r,n))}_fillPoles(e,t,i){let r=this._vertexBuffer,a=e.length;for(let n=2;n<a;n+=3){let a=e[n-2],s=e[n-1],o=e[n],l=r[2*a],h=r[2*a+1],u=r[2*s],c=r[2*s+1],d=r[2*o],p=r[2*o+1];t&&(0===h&&0===c&&this._generatePoleQuad(e,a,s,l,u,-32768),0===c&&0===p&&this._generatePoleQuad(e,s,o,u,d,-32768),0===p&&0===h&&this._generatePoleQuad(e,o,a,d,l,-32768)),i&&(8192===h&&8192===c&&this._generatePoleQuad(e,a,s,l,u,32767),8192===c&&8192===p&&this._generatePoleQuad(e,s,o,u,d,32767),8192===p&&8192===h&&this._generatePoleQuad(e,o,a,d,l,32767))}}_initializeVertices(e){for(let t=0;t<e.length;t+=2)this._vertexToIndex(e[t],e[t+1])}subdividePolygonInternal(e,t){let i;if(this._used)throw Error("Subdivision: multiple use not allowed.");this._used=!0;let{flattened:r,holeIndices:a}=function(e){let t=[],i=[];for(let r of e)if(0!==r.length){r!==e[0]&&t.push(i.length/2);for(let e=0;e<r.length;e++)i.push(r[e].x),i.push(r[e].y)}return{flattened:i,holeIndices:t}}(e);this._initializeVertices(r);try{let e=function(e,t,i=2){let r,a,n,s=t&&t.length,o=s?t[0]*i:e.length,l=sA(e,0,o,i,!0),h=[];if(!l||l.next===l.prev)return h;if(s&&(l=function(e,t,i,r){let a=[];for(let i=0,n=t.length;i<n;i++){let s=sA(e,t[i]*r,i<n-1?t[i+1]*r:e.length,r,!1);s===s.next&&(s.steiner=!0),a.push(function(e){let t=e,i=e;do(t.x<i.x||t.x===i.x&&t.y<i.y)&&(i=t),t=t.next;while(t!==e);return i}(s))}a.sort(sz);for(let e=0;e<a.length;e++)i=function(e,t){let i=function(e,t){let i=t,r=e.x,a=e.y,n,s=-1/0;if(sF(e,i))return i;do{if(sF(e,i.next))return i.next;if(a<=i.y&&a>=i.next.y&&i.next.y!==i.y){let e=i.x+(a-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(e<=r&&e>s&&(s=e,n=i.x<i.next.x?i:i.next,e===r))return n}i=i.next}while(i!==t);if(!n)return null;let o=n,l=n.x,h=n.y,u=1/0;i=n;do{if(r>=i.x&&i.x>=l&&r!==i.x&&sD(a<h?r:s,a,l,h,a<h?s:r,a,i.x,i.y)){var c,d;let t=Math.abs(a-i.y)/(r-i.x);sV(i,e)&&(t<u||t===u&&(i.x>n.x||i.x===n.x&&(c=n,d=i,0>sL(c.prev,c,d.prev)&&0>sL(d.next,c,c.next))))&&(n=i,u=t)}i=i.next}while(i!==o);return n}(e,t);if(!i)return t;let r=sU(i,e);return sE(r,r.next),sE(i,i.next)}(a[e],i);return i}(e,t,l,i)),e.length>80*i){r=e[0],a=e[1];let t=r,s=a;for(let n=i;n<o;n+=i){let i=e[n],o=e[n+1];i<r&&(r=i),o<a&&(a=o),i>t&&(t=i),o>s&&(s=o)}n=Math.max(t-r,s-a),n=0!==n?32767/n:0}return function e(t,i,r,a,n,s,o){if(!t)return;!o&&s&&function(e,t,i,r){let a=e;do 0===a.z&&(a.z=sk(a.x,a.y,t,i,r)),a.prevZ=a.prev,a.nextZ=a.next,a=a.next;while(a!==e);a.prevZ.nextZ=null,a.prevZ=null,function(e){let t,i=1;do{let r,a=e;e=null;let n=null;for(t=0;a;){t++;let s=a,o=0;for(let e=0;e<i&&(o++,s=s.nextZ);e++);let l=i;for(;o>0||l>0&&s;)0!==o&&(0===l||!s||a.z<=s.z)?(r=a,a=a.nextZ,o--):(r=s,s=s.nextZ,l--),n?n.nextZ=r:e=r,r.prevZ=n,n=r;a=s}n.nextZ=null,i*=2}while(t>1)}(a)}(t,a,n,s);let l=t;for(;t.prev!==t.next;){let h=t.prev,u=t.next;if(s?function(e,t,i,r){let a=e.prev,n=e.next;if(sL(a,e,n)>=0)return!1;let s=a.x,o=e.x,l=n.x,h=a.y,u=e.y,c=n.y,d=Math.min(s,o,l),p=Math.min(h,u,c),f=Math.max(s,o,l),m=Math.max(h,u,c),_=sk(d,p,t,i,r),g=sk(f,m,t,i,r),y=e.prevZ,x=e.nextZ;for(;y&&y.z>=_&&x&&x.z<=g;){if(y.x>=d&&y.x<=f&&y.y>=p&&y.y<=m&&y!==a&&y!==n&&sR(s,h,o,u,l,c,y.x,y.y)&&sL(y.prev,y,y.next)>=0||(y=y.prevZ,x.x>=d&&x.x<=f&&x.y>=p&&x.y<=m&&x!==a&&x!==n&&sR(s,h,o,u,l,c,x.x,x.y)&&sL(x.prev,x,x.next)>=0))return!1;x=x.nextZ}for(;y&&y.z>=_;){if(y.x>=d&&y.x<=f&&y.y>=p&&y.y<=m&&y!==a&&y!==n&&sR(s,h,o,u,l,c,y.x,y.y)&&sL(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;x&&x.z<=g;){if(x.x>=d&&x.x<=f&&x.y>=p&&x.y<=m&&x!==a&&x!==n&&sR(s,h,o,u,l,c,x.x,x.y)&&sL(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}(t,a,n,s):function(e){let t=e.prev,i=e.next;if(sL(t,e,i)>=0)return!1;let r=t.x,a=e.x,n=i.x,s=t.y,o=e.y,l=i.y,h=Math.min(r,a,n),u=Math.min(s,o,l),c=Math.max(r,a,n),d=Math.max(s,o,l),p=i.next;for(;p!==t;){if(p.x>=h&&p.x<=c&&p.y>=u&&p.y<=d&&sR(r,s,a,o,n,l,p.x,p.y)&&sL(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}(t))i.push(h.i,t.i,u.i),s$(t),t=u.next,l=u.next;else if((t=u)===l){o?1===o?e(t=function(e,t){let i=e;do{let r=i.prev,a=i.next.next;!sF(r,a)&&sB(r,i,i.next,a)&&sV(r,a)&&sV(a,r)&&(t.push(r.i,i.i,a.i),s$(i),s$(i.next),i=e=a),i=i.next}while(i!==e);return sE(i)}(sE(t),i),i,r,a,n,s,2):2===o&&function(t,i,r,a,n,s){let o=t;
2do{let t=o.next.next;for(;t!==o.prev;){var l,h;if(o.i!==t.i&&(l=o,h=t,l.next.i!==h.i&&l.prev.i!==h.i&&!function(e,t){let i=e;do{if(i.i!==e.i&&i.next.i!==e.i&&i.i!==t.i&&i.next.i!==t.i&&sB(i,i.next,e,t))return!0;i=i.next}while(i!==e);return!1}(l,h)&&(sV(l,h)&&sV(h,l)&&function(e,t){let i=e,r=!1,a=(e.x+t.x)/2,n=(e.y+t.y)/2;do i.y>n!=i.next.y>n&&i.next.y!==i.y&&a<(i.next.x-i.x)*(n-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next;while(i!==e);return r}(l,h)&&(sL(l.prev,l,h.prev)||sL(l,h.prev,h))||sF(l,h)&&sL(l.prev,l,l.next)>0&&sL(h.prev,h,h.next)>0))){let l=sU(o,t);return o=sE(o,o.next),l=sE(l,l.next),e(o,i,r,a,n,s,0),void e(l,i,r,a,n,s,0)}t=t.next}o=o.next}while(o!==t)}(t,i,r,a,n,s):e(sE(t),i,r,a,n,s,1);break}}}(l,h,i,r,a,n,0),h}(r,a),t=this._convertIndices(r,e);i=this._subdivideTrianglesScanline(t)}catch(e){console.error(e)}let n=[];return t&&(n=this._generateOutline(e)),this._ensureNoPoleVertices(),this._handlePoles(i),{verticesFlattened:this._vertexBuffer,indicesTriangles:i,indicesLineList:n}}_convertIndices(e,t){let i=[];for(let r=0;r<t.length;r++)i.push(this._vertexToIndex(e[2*t[r]],e[2*t[r]+1]));return i}_pointArrayToIndices(e){let t=[];for(let i=0;i<e.length;i++){let r=e[i];t.push(this._vertexToIndex(r.x,r.y))}return t}}function sH(e,t,i,r=!0){return new sW(i,t).subdividePolygonInternal(e,r)}function sX(e,t,i=!1){if(!e||e.length<1||e.length<2)return[];let r=e[0],a=e[e.length-1],n=i&&(r.x!==a.x||r.y!==a.y);if(t<2)return n?[...e,e[0]]:[...e];let s=Math.floor(8192/t),o=[];o.push(new b(e[0].x,e[0].y));let l=e.length,h=n?l:l-1;for(let t=0;t<h;t++){let i=e[t],r=t<l-1?e[t+1]:e[0],a=i.x,n=i.y,h=r.x,u=r.y,c=a!==h,d=n!==u;if(!c&&!d)continue;let p=h-a,f=u-n,m=Math.abs(p),_=Math.abs(f),g=a,y=n;for(;;){let e=p>0?(Math.floor(g/s)+1)*s:(Math.ceil(g/s)-1)*s,t=f>0?(Math.floor(y/s)+1)*s:(Math.ceil(y/s)-1)*s,i=Math.abs(g-e),r=Math.abs(y-t),a=Math.abs(y-u),n=c?i/m:1/0,l=d?r/_:1/0;if((Math.abs(g-h)<=i||!c)&&(a<=r||!d))break;if(n<l&&c||!d){let t=new b(g=e,Math.round(y+=f*n));o[o.length-1].x===t.x&&o[o.length-1].y===t.y||o.push(t)}else{let e=new b(Math.round(g+=p*l),y=t);o[o.length-1].x===e.x&&o[o.length-1].y===e.y||o.push(e)}}let x=new b(h,u);o[o.length-1].x===x.x&&o[o.length-1].y===x.y||o.push(x)}return o}function sY(e,t,i,r,a,n,s,o,l){let h=a.length/2,u=s&&o&&l;if(h<nA.MAX_VERTEX_ARRAY_LENGTH){let c,d,p=t.prepareSegment(h,i,r),f=p.vertexLength;for(let e=0;e<n.length;e+=3)r.emplaceBack(f+n[e],f+n[e+1],f+n[e+2]);p.vertexLength+=h,p.primitiveLength+=n.length/3,u&&(c=(d=s.prepareSegment(h,i,o)).vertexLength,d.vertexLength+=h);for(let t=0;t<a.length;t+=2)e(a[t],a[t+1]);if(u)for(let e=0;e<l.length;e++){let t=l[e];for(let e=1;e<t.length;e+=2)o.emplaceBack(c+t[e-1],c+t[e]);d.primitiveLength+=t.length/2}}else!function(e,t,i,r,a,n){let s=[];for(let e=0;e<r.length/2;e++)s.push(-1);let o={count:0},l=0,h=e.getOrCreateLatestSegment(t,i),u=h.vertexLength;for(let c=2;c<a.length;c+=3){let d=a[c-2],p=a[c-1],f=a[c],m=s[d]<l,_=s[p]<l,g=s[f]<l;h.vertexLength+(+!!m+ +!!_+ +!!g)>nA.MAX_VERTEX_ARRAY_LENGTH&&(h=e.createNewSegment(t,i),l=o.count,m=!0,_=!0,g=!0,u=0);let y=sK(s,r,n,o,d,m,h),x=sK(s,r,n,o,p,_,h),v=sK(s,r,n,o,f,g,h);i.emplaceBack(u+y-l,u+x-l,u+v-l),h.primitiveLength++}}(t,i,r,a,n,e),u&&function(e,t,i,r,a,n){let s=[];for(let e=0;e<r.length/2;e++)s.push(-1);let o={count:0},l=0,h=e.getOrCreateLatestSegment(t,i),u=h.vertexLength;for(let c=0;c<a.length;c++){let d=a[c];for(let p=1;p<a[c].length;p+=2){let a=d[p-1],c=d[p],f=s[a]<l,m=s[c]<l;h.vertexLength+(+!!f+ +!!m)>nA.MAX_VERTEX_ARRAY_LENGTH&&(h=e.createNewSegment(t,i),l=o.count,f=!0,m=!0,u=0);let _=sK(s,r,n,o,a,f,h),g=sK(s,r,n,o,c,m,h);i.emplaceBack(u+_-l,u+g-l),h.primitiveLength++}}}(s,i,o,a,l,e),t.forceNewSegmentOnNextPrepare(),null==s||s.forceNewSegmentOnNextPrepare()}function sK(e,t,i,r,a,n,s){if(n){let n=r.count;return i(t[2*a],t[2*a+1]),e[a]=r.count,r.count++,s.vertexLength++,n}return e[a]}class sJ{constructor(e){this.zoom=e.zoom,this.globalState=e.globalState,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new n_,this.indexArray=new nM,this.indexArray2=new nC,this.programConfigurations=new n0(e.layers,e.zoom),this.segments=new nA,this.segments2=new nA,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(e,t,i){this.hasPattern=sC("fill",this.layers,t);let r=this.layers[0].layout.get("fill-sort-key"),a=!r.isConstant(),n=[];for(let{feature:s,id:o,index:l,sourceLayerIndex:h}of e){let e=this.layers[0]._featureFilter.needGeometry,u=n5(s,e);if(!this.layers[0]._featureFilter.filter(new ab(this.zoom,{globalState:this.globalState}),u,i))continue;let c=a?r.evaluate(u,{},i,t.availableImages):void 0,d={id:o,properties:s.properties,type:s.type,sourceLayerIndex:h,index:l,geometry:e?u.geometry:n3(s),patterns:{},sortKey:c};n.push(d)}for(let r of(a&&n.sort((e,t)=>
2e.sortKey-t.sortKey),n)){let{geometry:a,index:n,sourceLayerIndex:s}=r;if(this.hasPattern){let e=sI("fill",this.layers,r,this.zoom,t);this.patternFeatures.push(e)}else this.addFeature(r,a,n,i,{},t.subdivisionGranularity);t.featureIndex.insert(e[n].feature,a,n,s,this.index)}}update(e,t,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,i)}addFeatures(e,t,i){for(let r of this.patternFeatures)this.addFeature(r,r.geometry,r.index,t,i,e.subdivisionGranularity)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,sM),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,t,i,r,a,n){for(let e of iR(t,500)){let t=sH(e,r,n.fill.getGranularityForZoomLevel(r.z)),i=this.layoutVertexArray;sY((e,t)=>{i.emplaceBack(e,t)},this.segments,this.layoutVertexArray,this.indexArray,t.verticesFlattened,t.indicesTriangles,this.segments2,this.indexArray2,t.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,a,r)}}aa("FillBucket",sJ,{omit:["layers","patternFeatures"]});var sQ={get paint(){return c=c||new aL({"fill-antialias":new aE(eA.paint_fill["fill-antialias"]),"fill-opacity":new az(eA.paint_fill["fill-opacity"]),"fill-color":new az(eA.paint_fill["fill-color"]),"fill-outline-color":new az(eA.paint_fill["fill-outline-color"]),"fill-translate":new aE(eA.paint_fill["fill-translate"]),"fill-translate-anchor":new aE(eA.paint_fill["fill-translate-anchor"]),"fill-pattern":new ak(eA.paint_fill["fill-pattern"])})},get layout(){return u=u||new aL({"fill-sort-key":new az(eA.layout_fill["fill-sort-key"])})}};class s0 extends aB{constructor(e){super(e,sQ)}recalculate(e,t){super.recalculate(e,t);let i=this.paint._values["fill-outline-color"];"constant"===i.value.kind&&void 0===i.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(e){return new sJ(e)}queryRadius(){return sa(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:e,geometry:t,transform:i,pixelsToTileUnits:r}){return n8(sn(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-i.bearingInRadians,r),t)}isTileClipped(){return!0}}let s1=aU([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),s2=aU([{name:"a_centroid",components:2,type:"Int16"}],4),{members:s3}=s1;class s5{constructor(e,t,i,r,a){this.properties={},this.extent=i,this.type=0,this.id=void 0,this._pbf=e,this._geometry=-1,this._keys=r,this._values=a,e.readFields(s4,this,t)}loadGeometry(){let e=this._pbf;e.pos=this._geometry;let t=e.readVarint()+e.pos,i=[],r,a=1,n=0,s=0,o=0;for(;e.pos<t;){if(n<=0){let t=e.readVarint();a=7&t,n=t>>3}if(n--,1===a||2===a)s+=e.readSVarint(),o+=e.readSVarint(),1===a&&(r&&i.push(r),r=[]),r&&r.push(new b(s,o));else{if(7!==a)throw Error(`unknown command ${a}`);r&&r.push(r[0].clone())}}return r&&i.push(r),i}bbox(){let e=this._pbf;e.pos=this._geometry;let t=e.readVarint()+e.pos,i=1,r=0,a=0,n=0,s=1/0,o=-1/0,l=1/0,h=-1/0;for(;e.pos<t;){if(r<=0){let t=e.readVarint();i=7&t,r=t>>3}if(r--,1===i||2===i)a+=e.readSVarint(),n+=e.readSVarint(),a<s&&(s=a),a>o&&(o=a),n<l&&(l=n),n>h&&(h=n);else if(7!==i)throw Error(`unknown command ${i}`)}return[s,l,o,h]}toGeoJSON(e,t,i){let r,a=this.extent*Math.pow(2,i),n=this.extent*e,s=this.extent*t,o=this.loadGeometry();function l(e){return[360*(e.x+n)/a-180,360/Math.PI*Math.atan(Math.exp((1-2*(e.y+s)/a)*Math.PI))-90]}function h(e){return e.map(l)}if(1===this.type){let e=[];for(let t of o)e.push(t[0]);let t=h(e);r=1===e.length?{type:"Point",coordinates:t[0]}:{type:"MultiPoint",coordinates:t}}else if(2===this.type){let e=o.map(h);r=1===e.length?{type:"LineString",coordinates:e[0]}:{type:"MultiLineString",coordinates:e}}else{if(3!==this.type)throw Error("unknown feature type");{let e=function(e){let t,i,r=e.length;if(r<=1)return[e];let a=[];for(let n=0;n<r;n++){let r=function(e){let t=0;for(let i,r,a=0,n=e.length,s=n-1;a<n;s=a++)i=e[a],t+=((r=e[s]).x-i.x)*(i.y+r.y);return t}(e[n]);0!==r&&(void 0===i&&(i=r<0),i===r<0?(t&&a.push(t),t=[e[n]]):t&&t.push(e[n]))}return t&&a.push(t),a}(o),t=[];for(let i of e)t.push(i.map(h));r=1===t.length?{type:"Polygon",coordinates:t[0]}:{type:"MultiPolygon",coordinates:t}}}let u={type:"Feature",geometry:r,properties:this.properties};return null!=this.id&&(u.id=this.id),u}}function s4(e,t,i){1===e?t.id=i.readVarint():2===e?function(e,t){let i=e.readVarint()+e.pos;for(;e.pos<i;){let i=t._keys[e.readVarint()],r=t._values[e.readVarint()];t.properties[i]=r}}(i,t):3===e?t.type=i.readVarint():4===e&&(t._geometry=i.pos)}s5.types=["Unknown","Point","LineString","Polygon"];class s6{constructor(e,t){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(s8,this,t),this.length=this._features.length}feature(e){if(e<0||e>=this._features.length)throw Error("feature index out of bounds");this._pbf.pos=this._features[e];let t=this._pbf.readVarint()+this._pbf.pos;return new s5(this._pbf,t,this.extent,this._keys,this._values)}}function s8(e,t,i){15===e?t.version=i.readVarint():1===e?t.name=i.readString():5===e?t.extent=i.readVarint():2===e?t._features.push(i.pos):3===e?t._keys.push(i.readString()):4===e&&t._values.push(function(e){let t=null,i=e.readVarint()+e.pos;for(;e.pos<i;){let i=e.readVarint()>>3;t=1===i?e.readString():2===i?e.readFloat():3===i?e.readDouble():4===i?e.readVarint64():5===i?e.readVarint():6===i?e.readSVarint():7===i?e.readBoolean():null}if(null==t)throw Error("unknown feature value");return t}(i))}class s9{constructor(e,t){this.layers=e.readFields(s7,{},t)}}function s7(e,t,i){if(3===e){let e=new s6(i,i.readVarint()+i.pos);e.length&&(t[e.name]=e)}}function oe(e,t,i,r,a,n,s,o){e.emplaceBack(t,i,2*Math.floor(8192*r)+s,8192*a*2,8192*n*2,Math.round(o))}
2class ot{constructor(e){this.zoom=e.zoom,this.globalState=e.globalState,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new ng,this.centroidVertexArray=new nf,this.indexArray=new nM,this.programConfigurations=new n0(e.layers,e.zoom),this.segments=new nA,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(e,t,i){for(let{feature:r,id:a,index:n,sourceLayerIndex:s}of(this.features=[],this.hasPattern=sC("fill-extrusion",this.layers,t),e)){let e=this.layers[0]._featureFilter.needGeometry,o=n5(r,e);if(!this.layers[0]._featureFilter.filter(new ab(this.zoom,{globalState:this.globalState}),o,i))continue;let l={id:a,sourceLayerIndex:s,index:n,geometry:e?o.geometry:n3(r),properties:r.properties,type:r.type,patterns:{}};this.hasPattern?this.features.push(sI("fill-extrusion",this.layers,l,this.zoom,t)):this.addFeature(l,l.geometry,n,i,{},t.subdivisionGranularity),t.featureIndex.insert(r,l.geometry,n,s,this.index,!0)}}addFeatures(e,t,i){for(let r of this.features){let{geometry:a}=r;this.addFeature(r,a,r.index,t,i,e.subdivisionGranularity)}}update(e,t,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,i)}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.centroidVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,s3),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,s2.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,t,i,r,a,n){for(let i of iR(t,500)){let t={x:0,y:0,sampleCount:0},a=this.layoutVertexArray.length;this.processPolygon(t,r,e,i,n);let s=this.layoutVertexArray.length-a,o=Math.floor(t.x/t.sampleCount),l=Math.floor(t.y/t.sampleCount);for(let e=0;e<s;e++)this.centroidVertexArray.emplaceBack(o,l)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,a,r)}processPolygon(e,t,i,r,a){if(r.length<1||oi(r[0]))return;for(let t of r)0!==t.length&&function(e,t){for(let i=0;i<t.length;i++){let r=t[i];i===t.length-1&&t[0].x===r.x&&t[0].y===r.y||(e.x+=r.x,e.y+=r.y,e.sampleC
2ount++)}}(e,t);let n={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},s=a.fill.getGranularityForZoomLevel(t.z),o="Polygon"===s5.types[i.type];for(let e of r){if(0===e.length||oi(e))continue;let t=sX(e,s,o);this._generateSideFaces(t,n)}if(!o)return;let l=sH(r,t,s,!1),h=this.layoutVertexArray;sY((e,t)=>{oe(h,e,t,0,0,1,1,0)},this.segments,this.layoutVertexArray,this.indexArray,l.verticesFlattened,l.indicesTriangles)}_generateSideFaces(e,t){let i=0;for(let n=1;n<e.length;n++){var r,a;let s=e[n],o=e[n-1];if(r=s,a=o,r.x===a.x&&(r.x<0||r.x>8192)||r.y===a.y&&(r.y<0||r.y>8192))continue;t.segment.vertexLength+4>nA.MAX_VERTEX_ARRAY_LENGTH&&(t.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let l=s.sub(o)._perp()._unit(),h=o.dist(s);i+h>32768&&(i=0),oe(this.layoutVertexArray,s.x,s.y,l.x,l.y,0,0,i),oe(this.layoutVertexArray,s.x,s.y,l.x,l.y,0,1,i),i+=h,oe(this.layoutVertexArray,o.x,o.y,l.x,l.y,0,0,i),oe(this.layoutVertexArray,o.x,o.y,l.x,l.y,0,1,i);let u=t.segment.vertexLength;this.indexArray.emplaceBack(u,u+2,u+1),this.indexArray.emplaceBack(u+1,u+2,u+3),t.segment.vertexLength+=4,t.segment.primitiveLength+=2}}}function oi(e){return e.every(e=>e.x<0)||e.every(e=>e.x>8192)||e.every(e=>e.y<0)||e.every(e=>e.y>8192)}aa("FillExtrusionBucket",ot,{omit:["layers","features"]});var or={get paint(){return d=d||new aL({"fill-extrusion-opacity":new aE(eA["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new az(eA["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new aE(eA["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new aE(eA["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new ak(eA["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new az(eA["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new az(eA["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new aE(eA["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class oa extends aB{constructor(e){super(e,or)}createBucket(e){return new ot(e)}queryRadius(){return sa(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:i,geometry:r,transform:a,pixelsToTileUnits:n,pixelPosMatrix:s}){let o=sn(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-a.bearingInRadians,n),l=this.paint.get("fill-extrusion-height").evaluate(t,i),h=this.paint.get("fill-extrusion-base").evaluate(t,i),u=function(e,t){let i=[];for(let r of e){let e=[r.x,r.y,0,1];O(e,e,t),i.push(new b(e[0]/e[3],e[1]/e[3]))}return i}(o,s),c=function(e,t,i,r){let a=[],n=[],s=r[8]*t,o=r[9]*t,l=r[10]*t,h=r[11]*t,u=r[8]*i,c=r[9]*i,d=r[10]*i,p=r[11]*i;for(let t of e){let e=[],i=[];for(let a of t){let t=a.x,n=a.y,f=r[0]*t+r[4]*n+r[12],m=r[1]*t+r[5]*n+r[13],_=r[2]*t+r[6]*n+r[14],g=r[3]*t+r[7]*n+r[15],y=_+l,x=g+h,v=f+u,w=m+c,T=_+d,P=g+p,S=new b((f+s)/x,(m+o)/x);S.z=y/x,e.push(S);let M=new b(v/P,w/P);M.z=T/P,i.push(M)}a.push(e),n.push(i)}return[a,n]}(r,h,l,s);return function(e,t,i){let r=1/0;n8(i,t)&&(r=os(i,t[0]));for(let a=0;a<t.length;a++){let n=t[a],s=e[a];for(let e=0;e<n.length-1;e++){let t=n[e],a=[t,n[e+1],s[e+1],s[e],t];n6(i,a)&&(r=Math.min(r,os(i,a)))}}return r!==1/0&&r}(c[0],c[1],u)}}function on(e,t){return e.x*t.x+e.y*t.y}function os(e,t){if(1===e.length){let i,r=0,a=t[r++];for(;!i||a.equals(i);)if(!(i=t[r++]))return 1/0;for(;r<t.length;r++){let n=t[r],s=e[0],o=i.sub(a),l=n.sub(a),h=s.sub(a),u=on(o,o),c=on(o,l),d=on(l,l),p=on(h,o),f=on(h,l),m=u*d-c*c,_=(d*p-c*f)/m,g=(u*f-c*p)/m,y=a.z*(1-_-g)+i.z*_+n.z*g;if(isFinite(y))return y}return 1/0}{let e=1/0;for(let i of t)e=Math.min(e,i.z);return e}}let{members:oo}=aU([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:ol}=aU([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),oh=Math.cos(Math.PI/180*37.5);class ou{constructor(e){this.zoom=e.zoom,this.globalState=e.globalState,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={}
2,this.layers.forEach(e=>{this.gradients[e.id]={}}),this.layoutVertexArray=new ny,this.layoutVertexArray2=new nx,this.indexArray=new nM,this.programConfigurations=new n0(e.layers,e.zoom),this.segments=new nA,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(e,t,i){this.hasPattern=sC("line",this.layers,t);let r=this.layers[0].layout.get("line-sort-key"),a=!r.isConstant(),n=[];for(let{feature:t,id:s,index:o,sourceLayerIndex:l}of e){let e=this.layers[0]._featureFilter.needGeometry,h=n5(t,e);if(!this.layers[0]._featureFilter.filter(new ab(this.zoom,{globalState:this.globalState}),h,i))continue;let u=a?r.evaluate(h,{},i):void 0,c={id:s,properties:t.properties,type:t.type,sourceLayerIndex:l,index:o,geometry:e?h.geometry:n3(t),patterns:{},sortKey:u};n.push(c)}for(let r of(a&&n.sort((e,t)=>e.sortKey-t.sortKey),n)){let{geometry:a,index:n,sourceLayerIndex:s}=r;if(this.hasPattern){let e=sI("line",this.layers,r,this.zoom,t);this.patternFeatures.push(e)}else this.addFeature(r,a,n,i,{},t.subdivisionGranularity);t.featureIndex.insert(e[n].feature,a,n,s,this.index)}}update(e,t,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,i)}addFeatures(e,t,i){for(let r of this.patternFeatures)this.addFeature(r,r.geometry,r.index,t,i,e.subdivisionGranularity)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,ol)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,oo),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,t,i,r,a,n){let s=this.layers[0].layout,o=s.get("line-join").evaluate(e,{}),l=s.get("line-cap"),h=s.get("line-miter-limit"),u=s.get("line-round-limit");for(let i of(this.lineClips=this.lineFeatureClips(e),t))this.addLine(i,e,o,l,h,u,r,n);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,a,r)}addLine(e,t,i,r,a,n,s,o){let l,h,u,c,d;if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,e=sX(e,s?o.line.getGranularityForZoomLevel(s.z):1),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let t=0;t<e.length-1;t++)this.totalDistance+=e[t].dist(e[t+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let p="Polygon"===s5.types[t.type],f=e.length;for(;f>=2&&e[f-1].equals(e[f-2]);)f--;let m=0;for(;m<f-1&&e[m].equals(e[m+1]);)m++;if(f<(p?3:2))return;"bevel"===i&&(a=1.05);let _=this.overscaling<=16?122880/(512*this.overscaling):0,g=this.segments.prepareSegment(10*f,this.layoutVertexArray,this.indexArray);this.e1=this.e2=-1,p&&(l=e[f-2],d=e[m].sub(l)._unit()._perp());for(let t=m;t<f;t++){if((u=t===f-1?p?e[m+1]:void 0:e[t+1])&&e[t].equals(u))continue;d&&(c=d),l&&(h=l),l=e[t],d=u?u.sub(l)._unit()._perp():c;let s=(c=c||d).add(d);0===s.x&&0===s.y||s._unit();let o=c.x*d.x+c.y*d.y,y=s.x*d.x+s.y*d.y,x=0!==y?1/y:1/0,v=2*Math.sqrt(2-2*y),b=y<oh&&h&&u,w=c.x*d.y-c.y*d.x>0;if(b&&t>m){let e=l.dist(h);if(e>2*_){let t=l.sub(l.sub(h)._mult(_/e)._round());this.updateDistance(h,t),this.addCurrentVertex(t,c,0,0,g),h=t}}let T=h&&u,P=T?i:p?"butt":r;if(T&&"round"===P&&(x<n?P="miter":x<=2&&(P="fakeround")),"miter"===P&&x>
2a&&(P="bevel"),"bevel"===P&&(x>2&&(P="flipbevel"),x<a&&(P="miter")),h&&this.updateDistance(h,l),"miter"===P)s._mult(x),this.addCurrentVertex(l,s,0,0,g);else if("flipbevel"===P){if(x>100)s=d.mult(-1);else{let e=x*c.add(d).mag()/c.sub(d).mag();s._perp()._mult(e*(w?-1:1))}this.addCurrentVertex(l,s,0,0,g),this.addCurrentVertex(l,s.mult(-1),0,0,g)}else if("bevel"===P||"fakeround"===P){let e=-Math.sqrt(x*x-1),t=w?e:0,i=w?0:e;if(h&&this.addCurrentVertex(l,c,t,i,g),"fakeround"===P){let e=Math.round(180*v/Math.PI/20);for(let t=1;t<e;t++){let i=t/e;if(.5!==i){let e=i-.5;i+=i*e*(i-1)*((1.0904+o*(o*(3.55645-1.43519*o)-3.2452))*e*e+(.848013+o*(.215638*o-1.06021)))}let r=d.sub(c)._mult(i)._add(c)._unit()._mult(w?-1:1);this.addHalfVertex(l,r.x,r.y,!1,w,0,g)}}u&&this.addCurrentVertex(l,d,-t,-i,g)}else if("butt"===P)this.addCurrentVertex(l,s,0,0,g);else if("square"===P){let e=h?1:-1;this.addCurrentVertex(l,s,e,e,g)}else"round"===P&&(h&&(this.addCurrentVertex(l,c,0,0,g),this.addCurrentVertex(l,c,1,1,g,!0)),u&&(this.addCurrentVertex(l,d,-1,-1,g,!0),this.addCurrentVertex(l,d,0,0,g)));if(b&&t<f-1){let e=l.dist(u);if(e>2*_){let t=l.add(u.sub(l)._mult(_/e)._round());this.updateDistance(l,t),this.addCurrentVertex(t,d,0,0,g),l=t}}}}addCurrentVertex(e,t,i,r,a,n=!1){let s=t.y*r-t.x,o=-t.y-t.x*r;this.addHalfVertex(e,t.x+t.y*i,t.y-t.x*i,n,!1,i,a),this.addHalfVertex(e,s,o,n,!0,-r,a),this.distance>16384&&0===this.totalDistance&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,t,i,r,a,n))}addHalfVertex({x:e,y:t},i,r,a,n,s,o){let l=.5*(this.lineClips?32767*this.scaledDistance:this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+ +!!a,(t<<1)+ +!!n,Math.round(63*i)+128,Math.round(63*r)+128,1+(0===s?0:s<0?-1:1)|(63&l)<<2,l>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);let h=o.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,h,this.e2),o.primitiveLength++),n?this.e2=h:this.e1=h}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,t){this.distance+=e.dist(t),this.updateScaledDistance()}}aa("LineBucket",ou,{omit:["layers","patternFeatures"]});var oc={get paint(){return f=f||new aL({"line-opacity":new az(eA.paint_line["line-opacity"]),"line-color":new az(eA.paint_line["line-color"]),"line-translate":new aE(eA.paint_line["line-translate"]),"line-translate-anchor":new aE(eA.paint_line["line-translate-anchor"]),"line-width":new az(eA.paint_line["line-width"]),"line-gap-width":new az(eA.paint_line["line-gap-width"]),"line-offset":new az(eA.paint_line["line-offset"]),"line-blur":new az(eA.paint_line["line-blur"]),"line-dasharray":new aD(eA.paint_line["line-dasharray"]),"line-pattern":new ak(eA.paint_line["line-pattern"]),"line-gradient":new aR(eA.paint_line["line-gradient"])})},get layout(){return p=p||new aL({"line-cap":new aE(eA.layout_line["line-cap"]),"line-join":new az(eA.layout_line["line-join"]),"line-miter-limit":new aE(eA.layout_line["line-miter-limit"]),"line-round-limit":new aE(eA.layout_line["line-round-limit"]),"line-sort-key":new az(eA.layout_line["line-sort-key"])})}};class od extends az{possiblyEvaluate(e,t){return t=new ab(Math.floor(t.zoom),{now:t.now,fadeDuration:t.fadeDuration,zoomHistory:t.zoomHistory,transition:t.transition}),super.possiblyEvaluate(e,t)}evaluate(e,t,i,r){return t=K({},t,{zoom:Math.floor(t.zoom)}),super.evaluate(e,t,i,r)}}class op extends aB{constructor(e){super(e,oc),this.gradientVersion=0,m||((m=new od(oc.paint.properties["line-width"].specification)).useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if("line-gradient"===e){let e=this.gradientExpression();this.stepInterpolant=void 0!==e._styleExpression&&e._styleExpression.expression instanceof t1,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(e,t){super.recalculate(e,t),this.paint._values["line-floorwidth"]=m.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new ou(e)}queryRadius(e){var t,i;return t=sr("line-width",this,e),((i=sr("line-gap-width",this,e))>0?i+2*t:t)/2+Math.abs(sr("line-offset",this,e))+sa(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:i,geometry:r,transform:a,pixelsToTileUnits:n}){var s,o;let l=sn(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-a.bearingInRadians,n),h=n/2*(s=this.paint.get("line-width").evaluate(t,i),(o=this.paint.get("line-gap-width").evaluate(t,i))>0?o+2*s:s),u=this.paint.get("line-offset").evaluate(t,i);return u&&(r=function(e,t){let i=[];for(let r=0;r<e.length;r++){let a=e[r],n=[];for(let e=0;e<a.length;e++){let i=a[e-1],r=a[e],s=a[e+1],o=0===e?new b(0,0):r.sub(i)._unit()._perp(),l=e===a.length-1?new b(0,0):s.sub(r)._unit()._perp(),h=o._add(l)._unit(),u=h.x*l.x+h.y*l.y;0!==u&&h._mult(1/u),n.push(h._mult(t)._add(r))}i.push(n)}return i}(r,u*n)),function(e,t,i){for(let r=0;r<t.length;r++){let a=t[r];if(e.length>=3){for(let t=0;t<a.length;t++)if(si(e,a[t]))return!0}if(function(e,t,i){if(e.length>1){if(n9(e,t))return!0;for(let r=0;r<t.length;r++)if(n7(t[r],e,i))return!0}for(let r=0;r<e.length;r++)if(n7(e[r],t,i))return!0;return!1}(e,a,i))return!0}return!1}(l,r,h)}isTileClipped(){return!0}}let of=aU([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),om=aU([{name:"a_projected_pos",components:3,type:"Float32"}],4);aU([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);let o_=aU([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);aU([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);let og=aU([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),oy=aU([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);aU([{name:"triangle",components:3,type:"Uint16"}]),aU([{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"}]),aU([{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"}]),aU([{type:"Float32",name:"offsetX"}]),aU([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),aU([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);let ox={"!":"ï¸","#":"ï¼",$:"ï¼","%":"ï¼
","&":"ï¼","(":"︵",")":"︶","*":"ï¼","+":"ï¼",",":"ï¸","-":"︲",".":"ã»","/":"ï¼",":":"ï¸",";":"ï¸","<":"︿","=":"ï¼",">":"ï¹","?":"ï¸","@":"ï¼ ","[":"ï¹","\\":"ï¼¼","]":"ï¹","^":"ï¼¾",_:"︳","`":"ï½","{":"︷","|":"â","}":"︸","~":"ï½","\xa2":"ï¿ ","\xa3":"ï¿¡","\xa5":"ï¿¥","\xa6":"¦","\xac":"ï¿¢","\xaf":"ï¿£","â":"︲","â":"︱","â":"ï¹","â":"ï¹","â":"ï¹","â":"ï¹","â¦":"ï¸","â§":"ã»","â©":"₩","ã":"ï¸","ã":"ï¸","ã":"︿","ã":"ï¹","ã":"︽","ã":"︾","ã":"ï¹","ã":"ï¹","ã":"ï¹","ã":"ï¹","ã":"︻","ã":"︼","ã":"︹","ã":"︺","ã":"ï¸","ã":"ï¸","ï¼":"ï¸","ï¼":"︵","ï¼":"︶","ï¼":"ï¸","ï¼":"︲","ï¼":"ã»","ï¼":"ï¸","ï¼":"ï¸","ï¼":"︿","ï¼":"ï¹","ï¼":"ï¸","ï¼»":"ï¹","ï¼½":"ï¹","_":"︳","ï½":"︷","ï½":"â","ï½":"︸","ï½":"︵","ï½ ":"︶","。":"ï¸","ï½¢":"ï¹","ï½£":"ï¹"},ov="u"<typeof TextDecoder?null:new TextDecoder("utf-8");class ob{constructor(e=new Uint8Array(16)){this.buf=ArrayBuffer.isView(e)?e:new Uint8Array(e),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(e,t,i=this.length){for(;this.pos<i;){let i=this.readVarint(),r=i>>3,a=this.pos;this.type=7&i,e(r,t,this),this.pos===a&&this.skip(i)}return t}readMessage(e,t){return this.readFields(e,t,this.readVarint()+this.pos)}readFixed32(){let e=this.dataView.getUint32(this.pos,!0);return this.pos+=4,e}readSFixed32(){let e=this.dataView.getInt32(this.pos,!0);return this.pos+=4,e}readFixed64(){let e=this.dataView.getUint32(this.pos,!0)+0x100000000*this.dataView.getUint32(this.pos+4,!0);return this.pos+=8,e}readSFixed64(){let e=this.dataView.getUint32(this.pos,!0)+0x100000000*this.dataView.getInt32(this.pos+4,!0);return this.pos+=8,e}readFloat(){let e=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,e}readDouble(){let e=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,e}readVarint(e){let t,i,r=this.buf;return t=127&(i=r[this.pos++]),i<128?t:(t|=(127&(i=r[this.pos++]))<<7,i<128?t:(t|=(127&(i=r[this.pos++]))<<14,i<128?t:(t|=(127&(i=r[this.pos++]))<<21,i<128?t:function(e,t,i){let r,a,n=i.buf;if(r=(112&(a=n[i.pos++]))>>4,a<128||(r|=(127&(a=n[i.pos++]))<<3,a<128)||(r|=(127&(a=n[i.pos++]))<<10,a<128)||(r|=(127&(a=n[i.pos++]))<<17,a<128)||(r|=(127&(a=n[i.pos++]))<<24,a<128)||(r|=(1&(a=n[i.pos++]))<<31,a<128))return function(e,t,i){return i?0x100000000*t+(e>>>0):0x100000000*(t>>>0)+(e>>>0)}(e,r,t);throw Error("Expected varint not more than 10 bytes")}(t|=(15&(i=r[this.pos]))<<28,e,this))))}readVarint64(){return this.readVarint(!0)}readSVarint(){let e=this.readVarint();return e%2==1?-((e+1)/2):e/2}readBoolean(){return!!this.readVarint()}readString(){let e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=12&&ov?ov.decode(this.buf.subarray(t,e)):function(e,t,i){let r="",a=t;for(;a<i;){let t=e[a],n,s,o,l=null,h=t>239?4:t>223?3:t>191?2:1;if(a+h>i)break;1===h?t<128&&(l=t):2===h?128==(192&(n=e[a+1]))&&(l=(31&t)<<6|63&n)<=127&&(l=null):3===h?(n=e[a+1],s=e[a+2],128==(192&n)&&128==(192&s)&&((l=(15&t)<<12|(63&n)<<6|63&s)<=2047||l>=55296&&l<=57343)&&(l=null)):4===h&&(n=e[a+1],s=e[a+2],o=e[a+3],128==(192&n)&&128==(192&s)&&128==(192&o)&&((l=(15&t)<<18|(63&n)<<12|(63&s)<<6|63&o)<=65535||l>=1114112)&&(l=null)),null===l?(l=65533,h=1):l>65535&&(l-=65536,r+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),r+=String.fromCharCode(l),a+=h}return r}(this.buf,t,e)}readBytes(){let e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t}readPackedVarint(e=[],t){let i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readVarint(t));return e}readPackedSVarint(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSVarint());return e}readPackedBoolean(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readBoolean());return e}readPackedFloat(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFloat());return e}readPackedDouble(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readDouble());return e}readPackedFixed32(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed32());return e}readPackedSFixed32(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed32());return e}readPackedFixed64(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed64());return e}readPackedSFixed64(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed64());return e}readPackedEnd(){return 2===this.type?this.readVarint()+this.pos:this.pos+1}skip(e){let t=7&e;if(0===t)for(;this.buf[this.pos++]>127;);else if(2===t)this.pos=this.readVarint()+this.pos;else if(5===t)this.pos+=4;else{if(1!==t)throw Error(`Unimplemented type: ${t}`);this.pos+=8}}writeTag(e,t){this.writeVarint(e<<3|t)}realloc(e){let t=this.length||16;for(;t<this.pos+e;)t*=2;if(t!==this.length){let e=new Uint8Array(t);e.set(this.buf),this.buf=e,this.dataView=new DataView(e.buffer),this.length=t}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeSFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}
2writeFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,-1&e,!0),this.dataView.setInt32(this.pos+4,Math.floor(23283064365386963e-26*e),!0),this.pos+=8}writeSFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,-1&e,!0),this.dataView.setInt32(this.pos+4,Math.floor(23283064365386963e-26*e),!0),this.pos+=8}writeVarint(e){(e=+e||0)>0xfffffff||e<0?function(e,t){var i,r;let a,n,s;if(e>=0?(a=e%0x100000000|0,n=e/0x100000000|0):(a=~(-e%0x100000000),n=~(-e/0x100000000),0xffffffff^a?a=a+1|0:(a=0,n=n+1|0)),e>=0xffffffffffffffff||e<-0xffffffffffffffff)throw Error("Given varint doesn't fit into 10 bytes");t.realloc(10),i=a,t.buf[t.pos++]=127&i|128,i>>>=7,t.buf[t.pos++]=127&i|128,i>>>=7,t.buf[t.pos++]=127&i|128,i>>>=7,t.buf[t.pos++]=127&i|128,t.buf[t.pos]=127&(i>>>=7),s=(7&(r=n))<<4,t.buf[t.pos++]|=s|128*!!(r>>>=3),r&&(t.buf[t.pos++]=127&r|128*!!(r>>>=7),r&&(t.buf[t.pos++]=127&r|128*!!(r>>>=7),r&&(t.buf[t.pos++]=127&r|128*!!(r>>>=7),r&&(t.buf[t.pos++]=127&r|128*!!(r>>>=7),r&&(t.buf[t.pos++]=127&r)))))}(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|128*(e>127),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|128*(e>127),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|128*(e>127),e<=127||(this.buf[this.pos++]=e>>>7&127))))}writeSVarint(e){this.writeVarint(e<0?-(2*e)-1:2*e)}writeBoolean(e){this.writeVarint(+e)}writeString(e){e=String(e),this.realloc(4*e.length),this.pos++;let t=this.pos;this.pos=function(e,t,i){for(let r,a,n=0;n<t.length;n++){if((r=t.charCodeAt(n))>55295&&r<57344){if(!a){r>56319||n+1===t.length?(e[i++]=239,e[i++]=191,e[i++]=189):a=r;continue}if(r<56320){e[i++]=239,e[i++]=191,e[i++]=189,a=r;continue}r=a-55296<<10|r-56320|65536,a=null}else a&&(e[i++]=239,e[i++]=191,e[i++]=189,a=null);r<128?e[i++]=r:(r<2048?e[i++]=r>>6|192:(r<65536?e[i++]=r>>12|224:(e[i++]=r>>18|240,e[i++]=r>>12&63|128),e[i++]=r>>6&63|128),e[i++]=63&r|128)}return i}(this.buf,e,this.pos);let i=this.pos-t;i>=128&&ow(t,i,this),this.pos=t-1,this.writeVarint(i),this.pos+=i}writeFloat(e){this.realloc(4),this.dataView.setFloat32(this.pos,e,!0),this.pos+=4}writeDouble(e){this.realloc(8),this.dataView.setFloat64(this.pos,e,!0),this.pos+=8}writeBytes(e){let t=e.length;this.writeVarint(t),this.realloc(t);for(let i=0;i<t;i++)this.buf[this.pos++]=e[i]}writeRawMessage(e,t){this.pos++;let i=this.pos;e(t,this);let r=this.pos-i;r>=128&&ow(i,r,this),this.pos=i-1,this.writeVarint(r),this.pos+=r}writeMessage(e,t,i){this.writeTag(e,2),this.writeRawMessage(t,i)}writePackedVarint(e,t){t.length&&this.writeMessage(e,oT,t)}writePackedSVarint(e,t){t.length&&this.writeMessage(e,oP,t)}writePackedBoolean(e,t){t.length&&this.writeMessage(e,oC,t)}writePackedFloat(e,t){t.length&&this.writeMessage(e,oS,t)}writePackedDouble(e,t){t.length&&this.writeMessage(e,oM,t)}writePackedFixed32(e,t){t.length&&this.writeMessage(e,oI,t)}writePackedSFixed32(e,t){t.length&&this.writeMessage(e,oA,t)}writePackedFixed64(e,t){t.length&&this.writeMessage(e,oE,t)}writePackedSFixed64(e,t){t.length&&this.writeMessage(e,oz,t)}writeBytesField(e,t){this.writeTag(e,2),this.writeBytes(t)}writeFixed32Field(e,t){this.writeTag(e,5),this.writeFixed32(t)}writeSFixed32Field(e,t){this.writeTag(e,5),this.writeSFixed32(t)}writeFixed64Field(e,t){this.writeTag(e,1),this.writeFixed64(t)}writeSFixed64Field(e,t){this.writeTag(e,1),this.writeSFixed64(t)}writeVarintField(e,t){this.writeTag(e,0),this.writeVarint(t)}writeSVarintField(e,t){this.writeTag(e,0),this.writeSVarint(t)}writeStringField(e,t){this.writeTag(e,2),this.writeString(t)}writeFloatField(e,t){this.writeTag(e,5),this.writeFloat(t)}writeDoubleField(e,t){this.writeTag(e,1),this.writeDouble(t)}writeBooleanField(e,t){this.writeVarintField(e,+t)}}function ow(e,t,i){let r=t<=16383?1:t<=2097151?2:t<=0xfffffff?3:Math.floor(Math.log(t)/(7*Math.LN2));i.realloc(r);for(let t=i.pos-1;t>=e;t--)i.buf[t+r]=i.buf[t]}function oT(e,t){for(let i=0;i<e.length;i++)t.writeVarint(e[i])}function oP(e,t){for(let i=0;i<e.length;i++)t.writeSVarint(e[i])}function oS(e,t){for(let i=0;i<e.length;i++)t.writeFloat(e[i])}function oM(e,t){for(let i=0;i<e.length;i++)t.writeDouble(e[i])}function oC(e,t){for(let i=0;i<e.length;i++)t.writeBoolean(e[i])}function oI(e,t){for(let i=0;i<e.length;i++)t.writeFixed32(e[i])}function oA(e,t){for(let i=0;i<e.length;i++)t.writeSFixed32(e[i])}function oE(e,t){for(let i=0;i<e.length;
2i++)t.writeFixed64(e[i])}function oz(e,t){for(let i=0;i<e.length;i++)t.writeSFixed64(e[i])}function ok(e,t,i){1===e&&i.readMessage(oD,t)}function oD(e,t,i){if(3===e){let{id:e,bitmap:r,width:a,height:n,left:s,top:o,advance:l}=i.readMessage(oR,{});t.push({id:e,bitmap:new sf({width:a+6,height:n+6},r),metrics:{width:a,height:n,left:s,top:o,advance:l}})}}function oR(e,t,i){1===e?t.id=i.readVarint():2===e?t.bitmap=i.readBytes():3===e?t.width=i.readVarint():4===e?t.height=i.readVarint():5===e?t.left=i.readSVarint():6===e?t.top=i.readSVarint():7===e&&(t.advance=i.readVarint())}function oL(e){let t=0,i=0;for(let r of e)t+=r.w*r.h,i=Math.max(i,r.w);e.sort((e,t)=>t.h-e.h);let r=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),i),h:1/0}],a=0,n=0;for(let t of e)for(let e=r.length-1;e>=0;e--){let i=r[e];if(!(t.w>i.w||t.h>i.h)){if(t.x=i.x,t.y=i.y,n=Math.max(n,t.y+t.h),a=Math.max(a,t.x+t.w),t.w===i.w&&t.h===i.h){let t=r.pop();t&&e<r.length&&(r[e]=t)}else t.h===i.h?(i.x+=t.w,i.w-=t.w):(t.w===i.w||r.push({x:i.x+t.w,y:i.y,w:i.w-t.w,h:t.h}),i.y+=t.h,i.h-=t.h);break}}return{w:a,h:n,fill:t/(a*n)||0}}class oF{constructor(e,{pixelRatio:t,version:i,stretchX:r,stretchY:a,content:n,textFitWidth:s,textFitHeight:o}){this.paddedRect=e,this.pixelRatio=t,this.stretchX=r,this.stretchY=a,this.content=n,this.version=i,this.textFitWidth=s,this.textFitHeight=o}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}class oB{constructor(e,t){const i={},r={};this.haveRenderCallbacks=[];const a=[];this.addImages(e,i,a),this.addImages(t,r,a);const{w:n,h:s}=oL(a),o=new sm({width:n||1,height:s||1});for(const t in e){const r=e[t],a=i[t].paddedRect;sm.copy(r.data,o,{x:0,y:0},{x:a.x+1,y:a.y+1},r.data)}for(const e in t){const i=t[e],a=r[e].paddedRect,n=a.x+1,s=a.y+1,l=i.data.width,h=i.data.height;sm.copy(i.data,o,{x:0,y:0},{x:n,y:s},i.data),sm.copy(i.data,o,{x:0,y:h-1},{x:n,y:s-1},{width:l,height:1}),sm.copy(i.data,o,{x:0,y:0},{x:n,y:s+h},{width:l,height:1}),sm.copy(i.data,o,{x:l-1,y:0},{x:n-1,y:s},{width:1,height:h}),sm.copy(i.data,o,{x:0,y:0},{x:n+l,y:s},{width:1,height:h})}this.image=o,this.iconPositions=i,this.patternPositions=r}addImages(e,t,i){for(let r in e){let a=e[r],n={x:0,y:0,w:a.data.width+2,h:a.data.height+2};i.push(n),t[r]=new oF(n,a),a.hasRenderCallback&&this.haveRenderCallbacks.push(r)}}patchUpdatedImages(e,t){for(let i in e.dispatchRenderCallbacks(this.haveRenderCallbacks),e.updatedImages)this.patchUpdatedImage(this.iconPositions[i],e.getImage(i),t),this.patchUpdatedImage(this.patternPositions[i],e.getImage(i),t)}patchUpdatedImage(e,t,i){if(!e||!t||e.version===t.version)return;e.version=t.version;let[r,a]=e.tl;i.update(t.data,void 0,{x:r,y:a})}}aa("ImagePosition",oF),aa("ImageAtlas",oB),e.ao=void 0,(T=e.ao||(e.ao={}))[T.none=0]="none",T[T.horizontal=1]="horizontal",T[T.vertical=2]="vertical",T[T.horizontalOnly=3]="horizontalOnly";class oO{constructor(){this.scale=1,this.fontStack="",this.imageName=null,this.verticalAlign="bottom"}static forText(e,t,i){let r=new oO;return r.scale=e||1,r.fontStack=t,r.verticalAlign=i||"bottom",r}static forImage(e,t){let i=new oO;return i.imageName=e,i.verticalAlign=t||"bottom",i}}class oj{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,t){let i=new oj;for(let r=0;r<e.sections.length;r++){let a=e.sections[r];a.image?i.addImageSection(a):i.addTextSection(a,t)}return i}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 t="";for(let i=0;i<e.length;i++){let r=e.charCodeAt(i+1)||null,a=e.charCodeAt(i-1)||null;t+=r&&ag(r)&&!ox[e[i+1]]||a&&ag(a)&&!ox[e[i-1]]||!ox[e[i]]?e[i]:ox[e[i]]}return t}(this.text)}trim(){let e=0;for(let t=0;t<this.text.length&&oU[this.text.charCodeAt(t)];t++)e++;let t=this.text.length;for(let i=this.text.length-1;i>=0&&i>=e&&oU[this.text.charCodeAt(i)];i--)t--;this.text=this.text.substring(e,t),this.sectionIndex=this.sectionIndex.slice(e,t)}substring(e,t){let i=new oj;return i.text=this.text.substring(e,t),i.sectionIndex=this.sectionIndex.slice(e,t),i.sections=this.sections,i}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,t)=>
2Math.max(e,this.sections[t].scale),0)}getMaxImageSize(e){let t=0,i=0;for(let r=0;r<this.length();r++){let a=this.getSection(r);if(a.imageName){let r=e[a.imageName];if(!r)continue;let n=r.displaySize;t=Math.max(t,n[0]),i=Math.max(i,n[1])}}return{maxImageWidth:t,maxImageHeight:i}}addTextSection(e,t){this.text+=e.text,this.sections.push(oO.forText(e.scale,e.fontStack||t,e.verticalAlign));let i=this.sections.length-1;for(let t=0;t<e.text.length;++t)this.sectionIndex.push(i)}addImageSection(e){let t=e.image?e.image.name:"";if(0===t.length)return void er("Can't add FormattedSection with an empty image.");let i=this.getNextImageSectionCharCode();i?(this.text+=String.fromCharCode(i),this.sections.push(oO.forImage(t,e.verticalAlign)),this.sectionIndex.push(this.sections.length-1)):er("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function oV(t,i,r,a,n,s,o,l,h,u,c,d,p,f,m){let _,g
2=oj.fromFeature(t,n);d===e.ao.vertical&&g.verticalizePunctuation();let{processBidirectionalText:y,processStyledBidirectionalText:x}=av;if(y&&1===g.sections.length)for(let e of(_=[],y(g.toString(),oW(g,u,s,i,a,f)))){let t=new oj;t.text=e,t.sections=g.sections;for(let i=0;i<e.length;i++)t.sectionIndex.push(0);_.push(t)}else if(x)for(let e of(_=[],x(g.text,g.sectionIndex,oW(g,u,s,i,a,f)))){let t=new oj;t.text=e[0],t.sectionIndex=e[1],t.sections=g.sections,_.push(t)}else _=function(e,t){let i=[],r=e.text,a=0;for(let r of t)i.push(e.substring(a,r)),a=r;return a<r.length&&i.push(e.substring(a,r.length)),i}(g,oW(g,u,s,i,a,f));let v=[],b={positionedLines:v,text:g.toString(),top:c[1],bottom:c[1],left:c[0],right:c[0],writingMode:d,iconsInText:!1,verticalizable:!1};return function(t,i,r,a,n,s,o,l,h,u,c,d){let p=0,f=0,m=0,_=0,g="right"===l?1:.5*("left"!==l),y=24/d,x=0;for(let o of n){o.trim();let n=o.getMaxScale(),l={positionedGlyphs:[],lineOffset:0};t.positionedLines[x]=l;let d=l.positionedGlyphs,T=0;if(!o.length()){f+=s,++x;continue}let P=function(e,t,i){let r=24*t.getMaxScale(),{maxImageWidth:a,maxImageHeight:n}=t.getMaxImageSize(e),s=Math.max(r,n*i);return{verticalLineContentWidth:Math.max(r,a*i),horizontalLineContentHeight:s}}(a,o,y);for(let s=0;s<o.length();s++){var v,b,w;let l,m=o.getSection(s),_=o.getSectionIndex(s),g=o.getCharCode(s),x=(v=h,b=c,w=g,!(v===e.ao.horizontal||!b&&!a_(w)||b&&(oU[w]||/\p{sc=Arab}/u.test(String.fromCodePoint(w)))));if(m.imageName){if(t.iconsInText=!0,m.scale=m.scale*y,!(l=function(e,t,i,r,a){let n,s=a[e.imageName];if(!s)return null;let o=s.paddedRect,l=s.displaySize,h={width:l[0],height:l[1],left:1,top:-3,advance:t?l[1]:l[0]};if(t)n=r.verticalLineContentWidth-l[1]*e.scale;else{let t=oX(e.verticalAlign);n=(r.horizontalLineContentHeight-l[1]*e.scale)*t}return{rect:o,metrics:h,baselineOffset:n,imageOffset:(t?l[0]:l[1])*e.scale-24*i}}(m,x,n,P,a)))continue;T=Math.max(T,l.imageOffset)}else if(!(l=function(e,t,i,r,a,n){let s,o=n[e.fontStack],l=function(e,t,i,r){if(e&&e.rect)return e;let a=t[i.fontStack],n=a&&a[r];return n?{rect:null,metrics:n.metrics}:null}(o&&o[t],a,e,t);if(null===l)return null;if(i)s=r.verticalLineContentWidth-24*e.scale;else{let t=oX(e.verticalAlign);s=(r.horizontalLineContentHeight-24*e.scale)*t}return{rect:l.rect,metrics:l.metrics,baselineOffset:s}}(m,g,x,P,i,r)))continue;let{rect:S,metrics:M,baselineOffset:C}=l;d.push({glyph:g,imageName:m.imageName,x:p,y:f+C+-17,vertical:x,scale:m.scale,fontStack:m.fontStack,sectionIndex:_,metrics:M,rect:S}),x?(t.verticalizable=!0,p+=(m.imageName?M.advance:24)*m.scale+u):p+=M.advance*m.scale+u}0!==d.length&&(m=Math.max(p-u,m),function(e,t,i){if(0===i)return;let r=e[t],a=(e[t].x+r.metrics.advance*r.scale)*i;for(let i=0;i<=t;i++)e[i].x-=a}(d,d.length-1,g)),p=0,l.lineOffset=Math.max(T,(n-1)*24);let S=s*n+T;f+=S,_=Math.max(S,_),++x}let{horizontalAlign:T,verticalAlign:P}=oH(o);(function(e,t,i,r,a,n,s,o,l){let h=(t-i)*a,u=0;for(let t of(u=n!==s?-o*r- -17:-r*l*s+.5*s,e))for(let e of t.positionedGlyphs)e.x+=h,e.y+=u})(t.positionedLines,g,T,P,m,_,s,f,n.length),t.top+=-P*f,t.bottom=t.top+f,t.left+=-T*m,t.right=t.left+m}(b,i,r,a,_,o,l,h,d,u,p,m),!function(e){for(let t of e)if(0!==t.positionedGlyphs.length)return!1;return!0}(v)&&b}let oU={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},oN={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},o$={40:!0};function oZ(e,t,i,r,a,n){if(t.imageName){let e=r[t.imageName];return e?e.displaySize[0]*t.scale*24/n+a:0}{let r=i[t.fontStack],n=r&&r[e];return n?n.metrics.advance*t.scale+a:0}}function oG(e,t,i,r){let a=Math.pow(e-t,2);return r?e<t?a/2:2*a:a+Math.abs(i)*i}function oq(e,t,i,r,a,n){let s=null,o=oG(t,i,a,n);for(let e of r){let r=oG(t-e.x,i,a,n)+e.badness;r<=o&&(s=e,o=r)}return{index:e,x:t,priorBreak:s,badness:o}}function oW(e,t,i,r,a,n){if(!e)return[];let s=[],o=function(e,t,i,r,a,n){let s=0;for(let i=0;i<e.length();i++){let o=e.getSection(i);s+=oZ(e.getCharCode(i),o,r,a,t,n)}return s/Math.max(1,Math.ceil(s/i))}(e,t,i,r,a,n),l=e.text.indexOf("â")>=0,h=0;for(let i=0;i<e.length();i++){let u=e.getSection(i),c=e.getCharCode(i);if(oU[c]||(h+=oZ(c,u,r,a,t,n)),i<e.length()-1){let t=!(c<11904)&&(!!ac["CJK Compatibility Forms"](c)||!!ac["CJ
2K Compatibility"](c)||!!ac["CJK Strokes"](c)||!!ac["CJK Symbols and Punctuation"](c)||!!ac["Enclosed CJK Letters and Months"](c)||!!ac["Halfwidth and Fullwidth Forms"](c)||!!ac["Ideographic Description Characters"](c)||!!ac["Vertical Forms"](c)||am.test(String.fromCodePoint(c)));(oN[c]||t||u.imageName||i!==e.length()-2&&o$[e.getCharCode(i+1)])&&s.push(oq(i+1,h,o,s,function(e,t,i){let r=0;return 10===e&&(r-=1e4),i&&(r+=150),40!==e&&65288!==e||(r+=50),41!==t&&65289!==t||(r+=50),r}(c,e.getCharCode(i+1),t&&l),!1))}}return function e(t){return t?e(t.priorBreak).concat(t.index):[]}(oq(e.length(),h,o,s,0,!0))}function oH(e){let t=.5,i=.5;switch(e){case"right":case"top-right":case"bottom-right":t=1;break;case"left":case"top-left":case"bottom-left":t=0}switch(e){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}return{horizontalAlign:t,verticalAlign:i}}function oX(e){switch(e){case"top":return 0;case"center":return .5;default:return 1}}function oY(e){var t,i;let r=e.left,a=e.top,n=e.right-r,s=e.bottom-a,o=null!=(t=e.image.textFitWidth)?t:"stretchOrShrink",l=null!=(i=e.image.textFitHeight)?i:"stretchOrShrink",h=(e.image.content[2]-e.image.content[0])/(e.image.content[3]-e.image.content[1]);if("proportional"===l){if("stretchOnly"===o&&n/s<h||"proportional"===o){let e=Math.ceil(s*h);r*=e/n,n=e}}else if("proportional"===o&&"stretchOnly"===l&&0!==h&&n/s>h){let e=Math.ceil(n/h);a*=e/s,s=e}return{x1:r,y1:a,x2:r+n,y2:a+s}}function oK(e,t,i,r,a,n){let s,o,l,h,u,c=e.image;if(c.content){let e=c.content,t=c.pixelRatio||1;s=[e[0]/t,e[1]/t,c.displaySize[0]-e[2]/t,c.displaySize[1]-e[3]/t]}let d=t.left*n,p=t.right*n;"width"===i||"both"===i?(u=a[0]+d-r[3],l=a[0]+p+r[1]):l=(u=a[0]+(d+p-c.displaySize[0])/2)+c.displaySize[0];let f=t.top*n,m=t.bottom*n;return"height"===i||"both"===i?(o=a[1]+f-r[0],h=a[1]+m+r[2]):h=(o=a[1]+(f+m-c.displaySize[1])/2)+c.displaySize[1],{image:c,top:o,right:l,bottom:h,left:u,collisionPadding:s}}function oJ(e,t){let{expression:i}=t;if("constant"===i.kind)return{kind:"constant",layoutSize:i.evaluate(new ab(e+1))};if("source"===i.kind)return{kind:"source"};{let{zoomStops:t,interpolationType:r}=i,a=0;for(;a<t.length&&t[a]<=e;)a++;let n=a=Math.max(0,a-1);for(;n<t.length&&t[n]<e+1;)n++;n=Math.min(t.length-1,n);let s=t[a],o=t[n];return"composite"===i.kind?{kind:"composite",minZoom:s,maxZoom:o,interpolationType:r}:{kind:"camera",minZoom:s,maxZoom:o,minSize:i.evaluate(new ab(s)),maxSize:i.evaluate(new ab(o)),interpolationType:r}}}function oQ(e,t,i){let r="never",a=e.get(t);return a?r=a:e.get(i)&&(r="always"),r}let o0=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function o1(e,t,i,r,a,n,s,o,l,h,u,c,d){let p=o?Math.min(32640,Math.round(o[0])):0,f=o?Math.min(32640,Math.round(o[1])):0;e.emplaceBack(t,i,Math.round(32*r),Math.round(32*a),n,s,(p<<1)+ +!!l,f,16*h,16*u,256*c,256*d)}function o2(e,t,i){e.emplaceBack(t.x,t.y,i),e.emplaceBack(t.x,t.y,i),e.emplaceBack(t.x,t.y,i),e.emplaceBack(t.x,t.y,i)}class o3{constructor(e){this.layoutVertexArray=new nb,this.indexArray=new nM,this.programConfigurations=e,this.segments=new nA,this.dynamicLayoutVertexArray=new nw,this.opacityVertexArray=new nT,this.hasVisibleVertices=!1,this.placedSymbolArray=new nn}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length}upload(e,t,i,r){this.isEmpty()||(i&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,of.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,t),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,om.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,o0,!0),this.opacityVertexBuffer.itemSize=1),(i||r)&&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())}}aa("SymbolBuffers",o3);class o5{constructor(e,t,i){this.layoutVertexArray=new e,this.layoutAttributes=t,this.indexArray=new i,this.segments=new nA,this.collisionVertexArray=new nS}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,o_.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}aa("CollisionBuffers",o5);class o4{constructor(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.globalState=t.globalState,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(e=>e.id),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];const i=this.layers[0]._unevaluatedLayout._values;this.textSizeData=oJ(this.zoom,i["text-size"]),this.iconSizeData=oJ(this.zoom,i["icon-size"]);const r=this.layers[0].layout,a=r.get("symbol-sort-key"),n=r.get("symbol-z-order");this.canOverlap="never"!==oQ(r,"text-overlap","text-allow-overlap")||"never"!==oQ(r,"icon-overlap","icon-allow-overlap")||r.get("text-ignore-placement")||r.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==n&&!a.isConstant(),this.sortFeaturesByY=("viewport-y"===n||"auto"===n&&!this.sortFeaturesByKey)&&this.canOverlap,"point"===r.get("symbol-placement")&&(this.writingModes=r.get("text-writing-mode").map(t=>e.ao[t])),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.sourceID=t.sourceID}createArrays(){this.text=new o3(new n0(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new o3(new n0(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new nl,this.lineVertexArray=new nh,this.symbolInstances=new no,this.textAnchorOffsets=new nc}calculateGlyphDependencies(e,t,i,r,a){for(let n=0;n<e.length;n++)if(t[e.charCodeAt(n)]=!0,(i||r)&&a){let i=ox[e.charAt(n)];
2i&&(t[i.charCodeAt(0)]=!0)}}populate(t,i,r){let a=this.layers[0],n=a.layout,s=n.get("text-font"),o=n.get("text-field"),l=n.get("icon-image"),h=("constant"!==o.value.kind||o.value.value instanceof tS&&!o.value.value.isEmpty()||o.value.value.toString().length>0)&&("constant"!==s.value.kind||s.value.value.length>0),u="constant"!==l.value.kind||!!l.value.value||Object.keys(l.parameters).length>0,c=n.get("symbol-sort-key");if(this.features=[],!h&&!u)return;let d=i.iconDependencies,p=i.glyphDependencies,f=i.availableImages,m=new ab(this.zoom,{globalState:this.globalState});for(let{feature:i,id:o,index:l,sourceLayerIndex:_}of t){let t,g,y=a._featureFilter.needGeometry,x=n5(i,y);if(!a._featureFilter.filter(m,x,r))continue;if(y||(x.geometry=n3(i)),h){let e=a.getValueAndResolveTokens("text-field",x,r,f),i=tS.factory(e),n=this.hasRTLText=this.hasRTLText||function(e){for(let t of e.sections)if(function(e){for(let t of e)if(ax(t.charCodeAt(0)))return!0;return!1}(t.text))return!0;return!1}(i);(!n||"unavailable"===av.getRTLTextPluginStatus()||n&&av.isParsed())&&(t=function(e,t,i){return e.sections.forEach(e=>{var r;let a;r=e.text,"uppercase"===(a=t.layout.get("text-transform").evaluate(i,{}))?r=r.toLocaleUpperCase():"lowercase"===a&&(r=r.toLocaleLowerCase()),av.applyArabicShaping&&(r=av.applyArabicShaping(r)),e.text=r}),e}(i,a,x))}if(u){let e=a.getValueAndResolveTokens("icon-image",x,r,f);g=e instanceof tk?e:tk.fromString(e)}if(!t&&!g)continue;let v=this.sortFeaturesByKey?c.evaluate(x,{},r):void 0;if(this.features.push({id:o,text:t,icon:g,index:l,sourceLayerIndex:_,geometry:x.geometry,properties:i.properties,type:s5.types[i.type],sortKey:v}),g&&(d[g.name]=!0),t){let i=s.evaluate(x,{},r).join(","),a="viewport"!==n.get("text-rotation-alignment")&&"point"!==n.get("symbol-placement");for(let r of(this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(e.ao.vertical)>=0,t.sections))if(r.image)d[r.image.name]=!0;else{let e=ad(t.toString()),n=r.fontStack||i,s=p[n]=p[n]||{};this.calculateGlyphDependencies(r.text,s,a,this.allowVerticalPlacement,e)}}}"line"===n.get("symbol-placement")&&(this.features=function(e){let t={},i={},r=[],a=0;function n(t){r.push(e[t]),a++}function s(e,t,a){let n=i[e];return delete i[e],i[t]=n,r[n].geometry[0].pop(),r[n].geometry[0]=r[n].geometry[0].concat(a[0]),n}function o(e,i,a){let n=t[i];return delete t[i],t[e]=n,r[n].geometry[0].shift(),r[n].geometry[0]=a[0].concat(r[n].geometry[0]),n}function l(e,t,i){let r=i?t[0][t[0].length-1]:t[0][0];return`${e}:${r.x}:${r.y}`}for(let h=0;h<e.length;h++){let u=e[h],c=u.geometry,d=u.text?u.text.toString():null;if(!d){n(h);continue}let p=l(d,c),f=l(d,c,!0);if(p in i&&f in t&&i[p]!==t[f]){let e=o(p,f,c),a=s(p,f,r[e].geometry);delete t[p],delete i[f],i[l(d,r[a].geometry,!0)]=a,r[e].geometry=null}else p in i?s(p,f,c):f in t?o(p,f,c):(n(h),t[p]=a-1,i[f]=a-1)}return r.filter(e=>e.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((e,t)=>
2e.sortKey-t.sortKey)}update(e,t,i){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,t,this.layers,i),this.icon.programConfigurations.updatePaintArrays(e,t,this.layers,i))}isEmpty(){return 0===this.symbolInstances.length&&!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,t){let i=this.lineVertexArray.length;if(void 0!==e.segment){let i=e.dist(t[e.segment+1]),r=e.dist(t[e.segment]),a={};for(let r=e.segment+1;r<t.length;r++)a[r]={x:t[r].x,y:t[r].y,tileUnitDistanceFromAnchor:i},r<t.length-1&&(i+=t[r+1].dist(t[r]));for(let i=e.segment||0;i>=0;i--)a[i]={x:t[i].x,y:t[i].y,tileUnitDistanceFromAnchor:r},i>0&&(r+=t[i-1].dist(t[i]));for(let e=0;e<t.length;e++){let t=a[e];this.lineVertexArray.emplaceBack(t.x,t.y,t.tileUnitDistanceFromAnchor)}}return{lineStartIndex:i,lineLength:this.lineVertexArray.length-i}}addSymbols(t,i,r,a,n,s,o,l,h,u,c,d){let p=t.indexArray,f=t.layoutVertexArray,m=t.segments.prepareSegment(4*i.length,f,p,this.canOverlap?s.sortKey:void 0),_=this.glyphOffsetArray.length,g=m.vertexLength,y=this.allowVerticalPlacement&&o===e.ao.vertical?Math.PI/2:0,x=s.text&&s.text.sections;for(let e=0;e<i.length;e++){let{tl:a,tr:n,bl:o,br:h,tex:u,pixelOffsetTL:c,pixelOffsetBR:_,minFontScaleX:g,minFontScaleY:v,glyphOffset:b,isSDF:w,sectionIndex:T}=i[e],P=m.vertexLength,S=b[1];o1(f,l.x,l.y,a.x,S+a.y,u.x,u.y,r,w,c.x,c.y,g,v),o1(f,l.x,l.y,n.x,S+n.y,u.x+u.w,u.y,r,w,_.x,c.y,g,v),o1(f,l.x,l.y,o.x,S+o.y,u.x,u.y+u.h,r,w,c.x,_.y,g,v),o1(f,l.x,l.y,h.x,S+h.y,u.x+u.w,u.y+u.h,r,w,_.x,_.y,g,v),o2(t.dynamicLayoutVertexArray,l,y),p.emplaceBack(P,P+2,P+1),p.emplaceBack(P+1,P+2,P+3),m.vertexLength+=4,m.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(b[0]),e!==i.length-1&&T===i[e+1].sectionIndex||t.programConfigurations.populatePaintArrays(f.length,s,s.index,{},d,x&&x[T])}t.placedSymbolArray.emplaceBack(l.x,l.y,_,this.glyphOffsetArray.length-_,g,h,u,l.segment,r?r[0]:0,r?r[1]:0,a[0],a[1],o,0,!1,0,c)}_addCollisionDebugVertex(e,t,i,r,a,n){return t.emplaceBack(0,0),e.emplaceBack(i.x,i.y,r,a,Math.round(n.x),Math.round(n.y))}addCollisionDebugVertices(e,t,i,r,a,n,s){let o=a.segments.prepareSegment(4,a.layoutVertexArray,a.indexArray),l=o.vertexLength,h=a.layoutVertexArray,u=a.collisionVertexArray,c=s.anchorX,d=s.anchorY;this._addCollisionDebugVertex(h,u,n,c,d,new b(e,t)),this._addCollisionDebugVertex(h,u,n,c,d,new b(i,t)),this._addCollisionDebugVertex(h,u,n,c,d,new b(i,r)),this._addCollisionDebugVertex(h,u,n,c,d,new b(e,r)),o.vertexLength+=4;let p=a.indexArray;p.emplaceBack(l,l+1),p.emplaceBack(l+1,l+2),p.emplaceBack(l+2,l+3),p.emplaceBack(l+3,l),o.primitiveLength+=4}addDebugCollisionBoxes(e,t,i,r){for(let a=e;a<t;a++){let e=this.collisionBoxArray.get(a);this.addCollisionDebugVertices(e.x1,e.y1,e.x2,e.y2,r?this.textCollisionBox:this.iconCollisionBox,e.anchorPoint,i)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new o5(nP,og.members,nC),this.iconCollisionBox=new o5(nP,og.members,nC);for(let e=0;e<this.symbolInstances.length;e++){let t=this.symbolInstances.get(e);this.addDebugCollisionBoxes(t.textBoxStartIndex,t.textBoxEndIndex,t,!0),this.addDebugCollisionBoxes(t.verticalTextBoxStartIndex,t.verticalTextBoxEndIndex,t,!0),this.addDebugCollisionBoxes(t.iconBoxStartIndex,t.iconBoxEndIndex,t,!1),this.addDebugCollisionBoxes(t.verticalIconBoxStartIndex,t.verticalIconBoxEndIndex,t,!1)}}_deserializeCollisionBoxesForSymbol(e,t,i,r,a,n,s,o,l){let h={};for(let r=t;r<i;r++){let t=e.get(r);h.textBox={x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,anchorPointX:t.anchorPointX,anchorPointY:t.anchorPointY},h.textFeatureIndex=t.featureIndex;break}for(let t=r;t<a;t++){let i=e.get(t);h.verticalTextBox={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,anchorPointX:i.anchorPointX,anchorPointY:i.anch
2orPointY},h.verticalTextFeatureIndex=i.featureIndex;break}for(let t=n;t<s;t++){let i=e.get(t);h.iconBox={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,anchorPointX:i.anchorPointX,anchorPointY:i.anchorPointY},h.iconFeatureIndex=i.featureIndex;break}for(let t=o;t<l;t++){let i=e.get(t);h.verticalIconBox={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,anchorPointX:i.anchorPointX,anchorPointY:i.anchorPointY},h.verticalIconFeatureIndex=i.featureIndex;break}return h}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let t=0;t<this.symbolInstances.length;t++){let i=this.symbolInstances.get(t);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,i.textBoxStartIndex,i.textBoxEndIndex,i.verticalTextBoxStartIndex,i.verticalTextBoxEndIndex,i.iconBoxStartIndex,i.iconBoxEndIndex,i.verticalIconBoxStartIndex,i.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(e,t){let i=e.placedSymbolArray.get(t),r=i.vertexStartIndex+4*i.numGlyphs;for(let t=i.vertexStartIndex;t<r;t+=4)e.indexArray.emplaceBack(t,t+2,t+1),e.indexArray.emplaceBack(t+1,t+2,t+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;let t=Math.sin(e),i=Math.cos(e),r=[],a=[],n=[];for(let e=0;e<this.symbolInstances.length;++e){n.push(e);let s=this.symbolInstances.get(e);r.push(0|Math.round(t*s.anchorX+i*s.anchorY)),a.push(s.featureIndex)}return n.sort((e,t)=>r[e]-r[t]||a[t]-a[e]),n}addToSortKeyRanges(e,t){let i=this.sortKeyRanges[this.sortKeyRanges.length-1];i&&i.sortKey===t?i.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:t,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)){for(let t of(this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[],this.symbolInstanceIndexes)){let e=this.symbolInstances.get(t);this.featureSortOrder.push(e.featureIndex),[e.rightJustifiedTextSymbolIndex,e.centerJustifiedTextSymbolIndex,e.leftJustifiedTextSymbolIndex].forEach((e,t,i)=>{e>=0&&i.indexOf(e)===t&&this.addIndicesForPlacedSymbol(this.text,e)}),e.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,e.verticalPlacedTextSymbolIndex),e.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.placedIconSymbolIndex),e.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}aa("SymbolBucket",o4,{omit:["layers","collisionBoxArray","features","compareText"]}),o4.MAX_GLYPHS=65535,o4.addDynamicAttributes=o2;var o6={get paint(){return g=g||new aL({"icon-opacity":new az(eA.paint_symbol["icon-opacity"]),"icon-color":new az(eA.paint_symbol["icon-color"]),"icon-halo-color":new az(eA.paint_symbol["icon-halo-color"]),"icon-halo-width":new az(eA.paint_symbol["icon-halo-width"]),"icon-halo-blur":new az(eA.paint_symbol["icon-halo-blur"]),"icon-translate":new aE(eA.paint_symbol["icon-translate"]),"icon-translate-anchor":new aE(eA.paint_symbol["icon-translate-anchor"]),"text-opacity":new az(eA.paint_symbol["text-opacity"]),"text-color":new az(eA.paint_symbol["text-color"],{runtimeType:eq,getOverride:e=>e.textColor,hasOverride:e=>!!e.textColor}),"text-halo-color":new az(eA.paint_symbol["text-halo-color"]),"text-halo-width":new az(eA.paint_symbol["text-halo-width"]),"text-halo-blur":new az(eA.paint_symbol["text-halo-blur"]),"text-translate":new aE(eA.paint_symbol["text-translate"]),"text-translate-anchor":new aE(eA.paint_symbol["text-translate-anchor"])})},get layout(){return _=_||new aL({"symbol-placement":new aE(eA.layout_symbol["symbol-placement"]),"symbol-spacing":new aE(eA.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new aE(eA.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new az(eA.layout_symbol["symbol-sort-key"]),"symbol-z-order":new aE(eA.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new aE(eA.layout_symbol["icon-allow-overlap"]),"icon-overlap":new aE(eA.layout_symbol["icon-overlap"]),"icon-ignore-placement":new aE(eA.layout_symbol["icon-ignore-placement"]),"icon-optional":new aE(eA.layout_symbol["icon-optional"]),"icon-rotation-alignment":new aE(eA.layout_symbol["icon-rotation-alignment"]),"icon-size":new az(eA.layout_symbol["icon-size"]),"icon-text-fit":new aE(eA.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new aE(eA.layout_symbol["icon-text-fit-padding"]),"icon-image":new az(eA.layout_symbol["icon-image"]),"icon-rotate":new az(eA.layout_symbol["icon-rotate"]),"icon-padding":new az(eA.layout_symbol["icon-padding"]),"icon-keep-upright":new aE(eA.layout_symbol["icon-keep-upright"]),"icon-offset":new az(eA.layout_symbol["icon-offset"]),"icon-anchor":new az(eA.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new aE(eA.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new aE(eA.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new aE(eA.layout_symbol["text-rotation-alignment"]),"text-field":new az(eA.layout_symbol["text-field"]),"text-font":new az(eA.layout_symbol["text-font"]),"text-size":new az(eA.layout_symbol["text-size"]),"text-max-width":new az(eA.layout_symbol["text-max-width"]),"text-line-height":new aE(eA.layout_symbol["text-line-height"]),"text-letter-spacing":new az(eA.layout_symbol["text-letter-spacing"]),"text-justify":new az(eA.layout_symbol["text-justify"]),"text-radial-offset":new az(eA.layout_symbol["text-radial-offset"]),"text-variable-anchor":new aE(eA.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new az(eA.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new az(eA.layout_symbol["text-anchor"]),"text-max-angle":new aE(eA.layout_symbol["text-max-angle"]),"text-writing-mode":new aE(eA.layout_symbol["text-writing-mode"]),"text-rotate":new az(eA.layout_symbol["text-rotate"]),"text-padding":new aE(eA.layout_symbol["text-padding"]),"text-keep-upright":new aE(eA.layout_symbol["text-keep-upright"]),"text-transform":new az(eA.layout_symbol["text-transform"]),"text-offset":new az(eA.layout_symbol["text-offset"]),"text-allow-overlap":new aE(eA.layout_symbol["text-allow-overlap"]),"text-overlap":new aE(eA.layout_symbol["text-overlap"]),"text-ignore-placement":new aE(eA.layout_symbol["text-ignore-placement"]),"text-optional":new aE(eA.layout_symbol["text-optional"])})}};class o8{constructor(e){if(void 0===e.property.overrides)throw Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:eN,this.defaultValue=e}evaluate(e){if(e.formattedSection){let t=this.defaultValue.property.overrides;if(t&&t.hasOverride(e.formattedSection))return t.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}}aa("FormatSectionOverride",o8,{omit:["defaultValue"]});class o9 extends aB{constructor(e){super(e,o6)}recalculate(e,t){if(super.recalculate(e,t),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]="map"===this.layout.get("text-rotation-alignment")?"map":"viewport"),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),"point"===this.layout.get("symbol-placement")){let e=this.layout.get("text-writing-mode");if(e){let t=[];for(let i of e)0>t.indexOf(i)&&t.push(i);this.layout._values["text-writing-mode"]=t}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,t,i,r){var a;let n=this.layout.get(e).evaluate(t,{},i,r),s=this._unevaluatedLayout._values[e];return s.isDataDriven()||r_(s.value)||!n?n:(a=t.properties,n.replace(/{([^{}]+)}/g,(e,t)=>a&&t in a?String(a[t]):""))}createBucket(e){return new o4(e)}queryRadius(){return 0}queryIntersectsFeature(){throw Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let e of o6.paint.overridableProperties){if(!o9.hasPaintOverride(this.layout,e))continue;let t=this.paint.get(e),i=new rm(new o8(t),t.property.specification),r=null;r="constant"===t.value.kind||"source"===t.value.kind?new ry("source",i):new rx("composite",i,t.value.zoomStops),this.paint._values[e]=new aI(t.property,r,t.parameters)}}_handleOverridablePaintPropertyUpdate(e,t,i){return!(!this.layout||t.isDataDriven()||i.isDataDriven())&&o9.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,t){let i=e.get("text-field"),r=o6.paint.properties[t],a=!1,n=e=>{for(let t of e)if(r.overrides&&r.overrides.hasOverride(t))return void(a=!0)};if("constant"===i.value.kind&&i.value.value instanceof tS)n(i.value.value.sections);else if("source"===i.value.kind){let e=t=>{a||(t instanceof tO&&tF(t.value)===eK?n(t.value.sections):t instanceof i_?n(t.sections):t.eachChild(e))},t=i.value;t._styleExpression&&e(t._styleExpression.expression)}return a}}var o7={get paint(){return y=y||new aL({"background-color":new aE(eA.paint_background["background-color"]),"background-pattern":new aD(eA.paint_background["background-pattern"]),"background-opacity":new aE(eA.paint_background["background-opacity"])})}};class le extends aB{constructor(e){super(e,o7)}}var lt={get paint(){return x=x||new aL({"raster-opacity":new aE(eA.paint_raster["raster-opacity"]),"raster-hue-rotate":new aE(eA.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new aE(eA.paint_raster["raster-brightness-min"]),"raster-brightness-max":new aE(eA.paint_raster["raster-brightness-max"]),"raster-saturation":new aE(eA.paint_raster["raster-saturation"]),"raster-contrast":new aE(eA.paint_raster["raster-contrast"]),"raster-resampling":new aE(eA.paint_raster["raster-resampling"]),"raster-fade-duration":new aE(eA.paint_raster["raster-fade-duration"])})}};class li extends aB{constructor(e){super(e,lt)}}class lr extends aB{constructor(e){super(e,{}),this.onAdd=e=>{this.implementation.onAdd&&this.implementation.onAdd(e,e.painter.context.gl)},this.onRemove=e=>{this.implementation.onRemove&&this.implementation.onRemove(e,e.painter.context.gl)},this.implementation=e}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw Error("Custom layers cannot be serialized")}}class la{constructor(e){this._methodToThrottle=e,this._triggered=!1,"u">typeof MessageChannel&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}let ln={once:!0};class ls{constructor(e,t){if(isNaN(e)||isNaN(t))throw Error(`Invalid LngLat object: (${e}, ${t})`);if(this.lng=+e,this.lat=+t,this.lat>90||this.lat<-90)throw Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new ls(Y(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){let t=Math.PI/180,i=this.lat*t,r=e.lat*t;return 6371008.8*Math.acos(Math.min(Math.sin(i)*Math.sin(r)+Math.cos(i)*Math.cos(r)*Math.cos((e.lng-this.lng)*t),1))}static convert(e){if(e instanceof ls)return e;if(Array.isArray(e)&&(2===e.length||3===e.length))return new ls(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&"object"==typeof e&&null!==e)return new ls(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}let lo=2*Math.PI*6371008.8;function ll(e){return lo*Math.cos(e*Math.PI/180)}function lh(e){return(180+e)/360}function lu(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function lc(e){return 360/Math.PI*Math.atan(Math.exp((180-360*e)*Math.PI/180)
2)-90}function ld(e,t){return e*ll(lc(t))}class lp{constructor(e,t,i=0){this.x=+e,this.y=+t,this.z=+i}static fromLngLat(e,t=0){let i=ls.convert(e);return new lp(lh(i.lng),lu(i.lat),t/ll(i.lat))}toLngLat(){return new ls(360*this.x-180,lc(this.y))}toAltitude(){return ld(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/lo*(1/Math.cos(lc(this.y)*Math.PI/180))}}function lf(e,t,i){var r=2*Math.PI*6378137/256/Math.pow(2,i);return[e*r-2*Math.PI*6378137/2,t*r-2*Math.PI*6378137/2]}class lm{constructor(e,t,i){if(!function(e,t,i){return!(e<0||e>25||i<0||i>=Math.pow(2,e)||t<0||t>=Math.pow(2,e))}(e,t,i))throw Error(`x=${t}, y=${i}, 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=t,this.y=i,this.key=ly(0,e,e,t,i)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,t,i){var r,a,n,s,o;let l=(a=this.y,n=this.z,s=lf(256*(r=this.x),256*(a=Math.pow(2,n)-a-1),n),o=lf(256*(r+1),256*(a+1),n),s[0]+","+s[1]+","+o[0]+","+o[1]),h=function(e,t,i){let r,a="";for(let n=e;n>0;n--)a+=(t&(r=1<<n-1)?1:0)+(i&r?2:0);return a}(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("tms"===i?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,t>1?"@2x":"").replace(/{quadkey}/g,h).replace(/{bbox-epsg-3857}/g,l)}isChildOf(e){let t=this.z-e.z;return t>0&&e.x===this.x>>t&&e.y===this.y>>t}getTilePoint(e){let t=Math.pow(2,this.z);return new b((e.x*t-this.x)*8192,(e.y*t-this.y)*8192)}toString(){return`${this.z}/${this.x}/${this.y}`}}class l_{constructor(e,t){this.wrap=e,this.canonical=t,this.key=ly(e,t.z,t.z,t.x,t.y)}}class lg{constructor(e,t,i,r,a){if(this.terrainRttPosMatrix32f=null,e<i)throw Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${i}`);this.overscaledZ=e,this.wrap=t,this.canonical=new lm(i,+r,+a),this.key=ly(t,e,i,r,a)}clone(){return new lg(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 Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);let t=this.canonical.z-e;return e>this.canonical.z?new lg(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new lg(e,this.wrap,e,this.canonical.x>>t,this.canonical.y>>t)}calculateScaledKey(e,t){if(e>this.overscaledZ)throw Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);let i=this.canonical.z-e;return e>this.canonical.z?ly(this.wrap*t,e,this.canonical.z,this.canonical.x,this.canonical.y):ly(this.wrap*t,e,e,this.canonical.x>>i,this.canonical.y>>i)}isChildOf(e){if(e.wrap!==this.wrap)return!1;let t=this.canonical.z-e.canonical.z;return 0===e.overscaledZ||e.overscaledZ<this.overscaledZ&&e.canonical.x===this.canonical.x>>t&&e.canonical.y===this.canonical.y>>t}children(e){if(this.overscaledZ>=e)return[new lg(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let t=this.canonical.z+1,i=2*this.canonical.x,r=2*this.canonical.y;return[new lg(t,this.wrap,t,i,r),new lg(t,this.wrap,t,i+1,r),new lg(t,this.wrap,t,i,r+1),new lg(t,this.wrap,t,i+1,r+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 lg(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new lg(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 l_(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new lp(e.x-this.wrap,e.y))}}function ly(e,t,i,r,a){(e*=2)<0&&(e=-1*e-1);let n=1<<i;return(n*n*e+n*a+r).toString(36)+i.toString(36)+t.toString(36)}function lx(e,t){return t?e.properties[t]:e.id}aa("CanonicalTileID",lm),aa("OverscaledTileID",lg,{omit:["terrainRttPosMatrix32f"]});class lv{constructor(){this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0}extend(e){return this.minX=Math.min(this.minX,e.x),this.minY=Math.min(this.minY,e.y),this.maxX=Math.max(this.maxX,e.x),this.maxY=Math.max(this.maxY,e.y),this}expandBy(e){return this.minX-=e,this.minY-=e,this.maxX+=e,this.maxY+=e,(this.minX>this.maxX||this.minY>this.maxY)&&(this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0),this}shrinkBy(e){return this.expandBy(-e)}map(e){let t=new lv;return t.extend(e(new b(this.minX,this.minY))),t.extend(e(new b(this.maxX,this.minY))),t.extend(e(new b(this.minX,this.maxY))),t.extend(e(new b(this.maxX,this.maxY))),t}static fromPoints(e){let t=new lv;for(let i of e)t.extend(i);return t}contains(e){return e.x>=this.minX&&e.x<=this.maxX&&e.y>=this.minY&&e.y<=this.maxY}empty(){return this.minX>this.maxX}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}covers(e){return!this.empty()&&!e.empty()&&e.minX>=this.minX&&e.maxX<=this.maxX&&e.minY>=this.minY&&e.maxY<=this.maxY}intersects(e){return!this.empty()&&!e.empty()&&e.minX<=this.maxX&&e.maxX>=this.minX&&e.minY<=this.maxY&&e.maxY>=this.minY}}class lb{constructor(e){this._stringToNumber={},this._numberToString=[];for(let t=0;t<e.length;t++){const i=e[t];this._stringToNumber[i]=t,this._numberToString[t]=i}}encode(e){return this._stringToNumber[e]}decode(e){if(e>=this._numberToString.length)throw Error(`Out of bounds. Index requested n=${e} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}}class lw{constructor(e,t,i,r,a){this.type="Feature",this._vectorTileFeature=e,e._z=t,e._x=i,e._y=r,this.properties=e.properties,this.id=a}get geometry(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){let e={geometry:this.geometry};for(let t in this)"_geometry"!==t&&"_vectorTileFeature"!==t&&(e[t]=this[t]);return e}}class lT{constructor(e,t){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new ai(8192,16,0),this.grid3D=new ai(8192,16,0),this.featureIndexArray=new np,this.promoteId=t}insert(e,t,i,r,a,n){let s=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(i,r,a);let o=n?this.grid3D:this.grid;for(let e=0;e<t.length;e++){let i=t[e],r=[1/0,1/0,-1/0,-1/0];for(let e=0;e<i.length;e++){let t=i[e];r[0]=Math.min(r[0],t.x),r[1]=Math.min(r[1],t.y),r[2]=Math.max(r[2],t.x),r[3]=Math.max(r[3],t.y)}r[0]<8192&&r[1]<8192&&r[2]>=0&&r[3]>=0&&o.insert(s,r[0],r[1],r[2],r[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new s9(new ob(this.rawTileData)).layers,this.sourceLayerCoder=new lb(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,t,i,r){let a;this.loadVTLayers();let n=e.params,s=8192/e.tileSize/e.scale,o=rS(n.filter),l=e.queryGeometry,h=e.queryPadding*s,u=lv.fromPoints(l),c=this.grid.query(u.minX-h,u.minY-h,u.maxX+h,u.maxY+h),d=lv.fromPoints(e.cameraQueryGeometry).expandBy(h);for(let t of this.grid3D.query(d.minX,d.minY,d.maxX,d.maxY,(t,i,r,a)=>(function(e,t,i,r,a){for(let n of e)if(t<=n.x&&i<=n.y&&r>=n.x&&a>=n.y)return!0;
2let n=[new b(t,i),new b(t,a),new b(r,a),new b(r,i)];if(e.length>2){for(let t of n)if(si(e,t))return!0}for(let t=0;t<e.length-1;t++)if(function(e,t,i){let r=i[0],a=i[2];if(e.x<r.x&&t.x<r.x||e.x>a.x&&t.x>a.x||e.y<r.y&&t.y<r.y||e.y>a.y&&t.y>a.y)return!1;let n=ea(e,t,i[0]);return n!==ea(e,t,i[1])||n!==ea(e,t,i[2])||n!==ea(e,t,i[3])}(e[t],e[t+1],n))return!0;return!1})(e.cameraQueryGeometry,t-h,i-h,r+h,a+h)))c.push(t);c.sort(lS);let p={};for(let h=0;h<c.length;h++){let u=c[h];if(u===a)continue;a=u;let d=this.featureIndexArray.get(u),f=null;this.loadMatchingFeature(p,d.bucketIndex,d.sourceLayerIndex,d.featureIndex,o,n.layers,n.availableImages,t,i,r,(t,i,r)=>(f||(f=n3(t)),i.queryIntersectsFeature({queryGeometry:l,feature:t,featureState:r,geometry:f,zoom:this.z,transform:e.transform,pixelsToTileUnits:s,pixelPosMatrix:e.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:e.getElevation})))}return p}loadMatchingFeature(e,t,i,r,a,n,s,o,l,h,u){let c=this.bucketLayerIDs[t];if(n&&!c.some(e=>n.has(e)))return;let d=this.sourceLayerCoder.decode(i),p=this.vtLayers[d].feature(r);if(a.needGeometry){let e=n5(p,!0);if(!a.filter(new ab(this.tileID.overscaledZ),e,this.tileID.canonical))return}else if(!a.filter(new ab(this.tileID.overscaledZ),p))return;let f=this.getId(p,d);for(let t=0;t<c.length;t++){let i=c[t];if(n&&!n.has(i))continue;let a=o[i];if(!a)continue;let d={};f&&h&&(d=h.getState(a.sourceLayer||"_geojsonTileLayer",f));let m=K({},l[i]);m.paint=lP(m.paint,a.paint,p,d,s),m.layout=lP(m.layout,a.layout,p,d,s);let _=!u||u(p,a,d);if(!_)continue;let g=new lw(p,this.z,this.x,this.y,f);g.layer=m;let y=e[i];void 0===y&&(y=e[i]=[]),y.push({featureIndex:r,feature:g,intersectionZ:_})}}lookupSymbolFeatures(e,t,i,r,a,n,s,o){let l={};this.loadVTLayers();let h=rS(a);for(let a of e)this.loadMatchingFeature(l,i,r,a,h,n,s,o,t);return l}hasLayer(e){for(let t of this.bucketLayerIDs)for(let i of t)if(e===i)return!0;return!1}getId(e,t){var i;let r=e.id;return this.promoteId&&("boolean"==typeof(r=e.properties["string"==typeof this.promoteId?this.promoteId:this.promoteId[t]]
2)&&(r=Number(r)),void 0===r&&(null==(i=e.properties)?void 0:i.cluster)&&this.promoteId&&(r=Number(e.properties.cluster_id))),r}}function lP(e,t,i,r,a){return Q(e,(e,n)=>{let s=t instanceof aA?t.get(n):null;return s&&s.evaluate?s.evaluate(i,r,a):s})}function lS(e,t){return t-e}function lM(e,t,i,r,a){let n=[];for(let s=0;s<e.length;s++){let o,l=e[s];for(let e=0;e<l.length-1;e++){let s=l[e],h=l[e+1];s.x<t&&h.x<t||(s.x<t?s=new b(t,s.y+(t-s.x)/(h.x-s.x)*(h.y-s.y))._round():h.x<t&&(h=new b(t,s.y+(t-s.x)/(h.x-s.x)*(h.y-s.y))._round()),s.y<i&&h.y<i||(s.y<i?s=new b(s.x+(i-s.y)/(h.y-s.y)*(h.x-s.x),i)._round():h.y<i&&(h=new b(s.x+(i-s.y)/(h.y-s.y)*(h.x-s.x),i)._round()),s.x>=r&&h.x>=r||(s.x>=r?s=new b(r,s.y+(r-s.x)/(h.x-s.x)*(h.y-s.y))._round():h.x>=r&&(h=new b(r,s.y+(r-s.x)/(h.x-s.x)*(h.y-s.y))._round()),s.y>=a&&h.y>=a||(s.y>=a?s=new b(s.x+(a-s.y)/(h.y-s.y)*(h.x-s.x),a)._round():h.y>=a&&(h=new b(s.x+(a-s.y)/(h.y-s.y)*(h.x-s.x),a)._round()),o&&s.equals(o[o.length-1])||(o=[s],n.push(o)),o.push(h)))))}}return n}aa("FeatureIndex",lT,{omit:["rawTileData","sourceLayerCoder"]});class lC extends b{constructor(e,t,i,r){super(e,t),this.angle=i,void 0!==r&&(this.segment=r)}clone(){return new lC(this.x,this.y,this.angle,this.segment)}}function lI(e,t,i,r,a){if(void 0===t.segment||0===i)return!0;let n=t,s=t.segment+1,o=0;for(;o>-i/2;){if(--s<0)return!1;o-=e[s].dist(n),n=e[s]}o+=e[s].dist(e[s+1]),s++;let l=[],h=0;for(;o<i/2;){let t=e[s],i=e[s+1];if(!i)return!1;let n=e[s-1].angleTo(t)-t.angleTo(i);for(n=Math.abs((n+3*Math.PI)%(2*Math.PI)-Math.PI),l.push({distance:o,angleDelta:n}),h+=n;o-l[0].distance>r;)h-=l.shift().angleDelta;if(h>a)return!1;s++,o+=t.dist(i)}return!0}function lA(e){let t=0;for(let i=0;i<e.length-1;i++)t+=e[i].dist(e[i+1]);return t}function lE(e,t){return Math.max(e?e.right-e.left:0,t?t.right-t.left:0)}function lz(e,t,i,r){let a=[],n=e.image,s=n.pixelRatio,o=n.paddedRect.w-2,l=n.paddedRect.h-2,h={x1:e.left,y1:e.top,x2:e.right,y2:e.bottom},u=n.stretchX||[[0,o]],c=n.stretchY||[[0,l]],d=(e,t)=>e+t[1]-t[0],p=u.reduce(d,0),f=c.reduce(d,0),m=o-p,_=l-f,g=0,y=p,x=0,v=f,w=0,T=m,P=0,S=_;if(n.content&&r){let t=n.content,i=t[2]-t[0],r=t[3]-t[1];(n.textFitWidth||n.textFitHeight)&&(h=oY(e)),g=lk(u,0,t[0]),x=lk(c,0,t[1]),y=lk(u,t[0],t[2]),v=lk(c,t[1],t[3]),w=t[0]-g,P=t[1]-x,T=i-y,S=r-v}let M=h.x1,C=h.y1,I=h.x2-M,A=h.y2-C,E=(e,r,a,o)=>{var l,h,u,c,d,m,_,E,z,k,D,R,L,F,B,O;let j=(l=e.stretch-g,l/y*I+M),V=(h=e.fixed-w,u=T,c=e.stretch,h-u*c/p),U=(d=r.stretch-x,d/v*A+C),N=(m=r.fixed-P,_=S,E=r.stretch,m-_*E/f),$=(z=a.stretch-g,z/y*I+M),Z=(k=a.fixed-w,D=T,R=a.stretch,k-D*R/p),G=(L=o.stretch-x,L/v*A+C),q=(F=o.fixed-P,B=S,O=o.stretch,F-B*O/f),W=new b(j,U),H=new b($,U),X=new b($,G),Y=new b(j,G),K=new b(V/s,N/s),J=new b(Z/s,q/s),Q=t*Math.PI/180;if(Q){let e=Math.sin(Q),t=Math.cos(Q),i=[t,-e,e,t];W._matMult(i),H._matMult(i),Y._matMult(i),X._matMult(i)}let ee=e.stretch+e.fixed,et=r.stretch+r.fixed;return{tl:W,tr:H,bl:Y,br:X,tex:{x:n.paddedRect.x+1+ee,y:n.paddedRect.y+1+et,w:a.stretch+a.fixed-ee,h:o.stretch+o.fixed-et},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:K,pixelOffsetBR:J,minFontScaleX:T/s/I,minFontScaleY:S/s/A,isSDF:i}};if(r&&(n.stretchX||n.stretchY)){let e=lD(u,m,p),t=lD(c,_,f);for(let i=0;i<e.length-1;i++){let r=e[i],n=e[i+1];for(let e=0;e<t.length-1;e++)a.push(E(r,t[e],n,t[e+1]))}}else a.push(E({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:o+1},{fixed:0,stretch:l+1}));return a}function lk(e,t,i){let r=0;for(let a of e)r+=Math.max(t,Math.min(i,a[1]))-Math.max(t,Math.min(i,a[0]));return r}function lD(e,t,i){let r=[{fixed:-1,stretch:0}];for(let[t,i]of e){let e=r[r.length-1];r.push({fixed:t-e.stretch,stretch:e.stretch}),r.push({fixed:t-e.stretch,stretch:e.stretch+(i-t)})}return r.push({fixed:t+1,stretch:i}),r}aa("Anchor",lC);class lR{constructor(e,t,i,r,a,n,s,o,l,h){var u;if(this.boxStartIndex=e.length,l){let e=n.top,t=n.bottom;const i=n.collisionPadding;i&&(e-=i[1],t+=i[3]);let r=t-e;r>0&&(r=Math.max(10,r),this.circleDiameter=r)}else{const l=(null==(u=n.image)?void 0:u.content)&&(n.image.textFitWidth||n.image.textFitHeight)?oY(n):{x1:n.left,y1:n.top,x2:n.right,y2:n.bottom};l.y1=l.y1*s-o[0],l.y2=l.y2*s+o[2],l.x1=l.x1*s-o[3],l.x2=l.x2*s+o[1];const c=n.collisionPadding;if(c&&(l.x1-=c[0]*s,l.y1-=c[1]*s,l.x2+=c[2]*s,l.y2+=c[3]*s),h){const e=new b(l.x1,l.y1),t=new b(l.x2,l.y1),i=new b(l.x1,l.y2),r=new b(l.x2,l.y2),a=h*Math.PI/180;e._rotate(a),t._rotate(a),i._rotate(a),r._rotate(a),l.x1=Math.min(e.x,t.x,i.x,r.x),l.x2=Math.max(e.x,t.x,i.x,r.x),l.y1=Math.min(e.y,t.y,i.y,r.y),l.y2=Math.max(e.y,t.y,i.y,r.y)}e.emplaceBack(t.x,t.y,l.x1,l.y1,l.x2,l.y2,i,r,a)}this.boxEndIndex=e.length}}class lL{constructor(e=[],t=(e,t)=>e<t?-1:+(e>t)){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let e=(this.length>>1)-1;e>=0;e--)this._down(e)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(0===this.length)return;let e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){let{data:t,compare:i}=this,r=t[e];for(;e>0;){let a=e-1>>1,n=t[a];if(i(r,n)>=0)break;t[e]=n,e=a}t[e]=r}_down(e){let{data:t,compare:i}=this,r=this.length>>1,a=t[e];for(;e<r;){let r=1+(e<<1),n=r+1;if(n<this.length&&0>i(t[n],t[r])&&(r=n),i(t[r],a)>=0)break;t[e]=t[r],e=r}t[e]=a}}function lF(e,t){return t.max-e.max}function lB(e,t,i,r){this.p=new b(e,t),this.h=i,this.d=function(e,t){let i=!1,r=1/0;for(let a=0;a<t.length;a++){let n=t[a];for(let t=0,a=n.length,s=a-1;t<a;s=t++){let a=n[t],o=n[s];a.y>e.y!=o.y>e.y&&e.x<(o.x-a.x)*(e.y-a.y)/(o.y-a.y)+a.x&&(i=!i),r=Math.min(r,se(e,a,o))}}return(i?1:-1)*Math.sqrt(r)}(this.p,r),this.max=this.d+this.h*Math.SQRT2}e.aE=void 0,(P=e.aE||(e.aE={}))[P.center=1]="center",P[P.left=2]="left",P[P.right=3]="right",P[P.top=4]="top",P[P.bottom=5]="bottom",P[P["top-left"]=6]="top-left",P[P["top-right"]=7]="top-right",P[P["bottom-left"]=8]="bottom-left",P[P["bottom-right"]=9]="bottom-right";let lO=1/0;function lj(e,t){return t[1]!==lO?function(e,t,i){let r=0,a=0;switch(t=Math.abs(t),i=Math.abs(i),e){case"top-right":case"top-left":case"top":a=i-7;break;case"bottom-right":case"bottom-left":case"bottom":a=7-i}switch(e){case"top-right":case"bottom-right":case"right":r=-t;break;case"top-left":case"bottom-left":case"left":r=t}return[r,a]}(e,t[0],t[1]):function(e,t){let i=0,r=0;t<0&&(t=0);let a=t/Math.SQRT2;switch(e){case"top-right":case"top-left":r=a-7;break;case"bottom-right":case"bottom-left":r=7-a;break;case"bottom":r=7-t;break;case"top":r=t-7}switch(e){case"top-right":case"bottom-right":i=-a;break;case"top-left":case"bottom-left":i=a;break;case"left":i=t;break;case"right":i=-t}return[i,r]}(e,t[0])}function lV(e,t,i){var r;let a=e.layout,n=null==(r=a.get("text-variable-anchor-offset"))?void 0:r.evaluate(t,{},i);if(n){let e=n.values,t=[];for(let i=0;i<e.length;i+=2){let r=t[i]=e[i],a=e[i+1].map(e=>24*e);r.startsWith("top")?a[1]-=7:r.startsWith("bottom")&&(a[1]+=7),t[i+1]=a}return new tz(t)}let s=a.get("text-variable-anchor");if(s){let r;r=void 0!==e._unevaluatedLayout.getValue("text-radial-offset")?[24*a.get("text-radial-offset").evaluate(t,{},i),lO]:a.get("text-offset").evaluate(t,{},i).map(e=>24*e);let n=[];for(let e of s)n.push(e,lj(e,r));return new tz(n)}return null}function lU(e){switch(e){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function lN(e,t,i,r,a,n,s,o,l,h,u,c,d,p,f){let m=function(e,t,i,r,a,n,s){let o=i.layout.get("text-rotate").evaluate(a,{})*Math.PI/180,l=[];for(let i of e.positionedLines)for(let a of i.positionedGlyphs){if(!a.rect)continue;let h=a.rect||{},u=4,c=!0,d=1,p=0,f=(r||s)&&a.vertical,m=a.metrics.advance*a.scale/2;if(s&&e.verticalizable&&(p=i.lineOffset/2-(a.imageName?-(24-a.metrics.width*a.scale)/2:(a.scale-1)*24)),a.imageName){let e=n[a.imageName];c=e.sdf,u=1/(d=e.pixelRatio)}let _=r?[a.x+m,a.y]:[0,0],g=r?[0,0]:[a.x+m+t[0],a.y+t[1]-p],y=[0,0];f&&(y=g,g=[0,0]);let x=a.metrics.isDoubleResolution?2:1,v=(a.metrics.left-u)*a.scale-m+g[0],w=(-a.metrics.top-u)*a.scale+g[1],T=v+h.w/x*a.scale/d,P=w+h.h/x*a.scale/d,S=new b(v,w),M=new b(T,w),C=new b(v,P),I=new b(T,P);if(f){let e=new b(-m,m- -17),t=-Math.PI/2,i=12-m,r=new b(22-i,-(a.imageName?i:0)),n=new b(...y);
2S._rotateAround(t,e)._add(r)._add(n),M._rotateAround(t,e)._add(r)._add(n),C._rotateAround(t,e)._add(r)._add(n),I._rotateAround(t,e)._add(r)._add(n)}if(o){let e=Math.sin(o),t=Math.cos(o),i=[t,-e,e,t];S._matMult(i),M._matMult(i),C._matMult(i),I._matMult(i)}let A=new b(0,0),E=new b(0,0);l.push({tl:S,tr:M,bl:C,br:I,tex:h,writingMode:e.writingMode,glyphOffset:_,sectionIndex:a.sectionIndex,isSDF:c,pixelOffsetTL:A,pixelOffsetBR:E,minFontScaleX:0,minFontScaleY:0})}return l}(i,o,a,n,s,r,e.allowVerticalPlacement),_=e.textSizeData,g=null;for(let i of("source"===_.kind?(g=[128*a.layout.get("text-size").evaluate(s,{})])[0]>32640&&er(`${e.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`):"composite"===_.kind&&((g=[128*p.compositeTextSizes[0].evaluate(s,{},f),128*p.compositeTextSizes[1].evaluate(s,{},f)])[0]>32640||g[1]>32640)&&er(`${e.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`),e.addSymbols(e.text,m,g,o,n,s,h,t,l.lineStartIndex,l.lineLength,d,f),u))c[i]=e.text.placedSymbolArray.length-1;return 4*m.length}function l$(e){for(let t in e)return e[t];return null}let lZ=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class lG{static from(e){if(!(e instanceof ArrayBuffer))throw Error("Data must be an instance of ArrayBuffer.");let[t,i]=new Uint8Array(e,0,2);if(219!==t)throw Error("Data does not appear to be in a KDBush format.");let r=i>>4;if(1!==r)throw Error(`Got v${r} data when expected v1.`);let a=lZ[15&i];if(!a)throw Error("Unrecognized array type.");
2let[n]=new Uint16Array(e,2,1),[s]=new Uint32Array(e,4,1);return new lG(s,n,a,e)}constructor(e,t=64,i=Float64Array,r){if(isNaN(e)||e<0)throw Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+t,2),65535),this.ArrayType=i,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const a=lZ.indexOf(this.ArrayType),n=2*e*this.ArrayType.BYTES_PER_ELEMENT,s=e*this.IndexArrayType.BYTES_PER_ELEMENT,o=(8-s%8)%8;if(a<0)throw Error(`Unexpected typed array class: ${i}.`);r&&r instanceof ArrayBuffer?(this.data=r,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+s+o,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+n+s+o),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+s+o,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+a]),new Uint16Array(this.data,2,1)[0]=t,new Uint32Array(this.data,4,1)[0]=e)}add(e,t){let i=this._pos>>1;return this.ids[i]=i,this.coords[this._pos++]=e,this.coords[this._pos++]=t,i}finish(){let e=this._pos>>1;if(e!==this.numItems)throw Error(`Added ${e} items when expected ${this.numItems}.`);return function e(t,i,r,a,n,s){if(n-a<=r)return;let o=a+n>>1;(function e(t,i,r,a,n,s){for(;n>a;){if(n-a>600){let o=n-a+1,l=r-a+1,h=Math.log(o),u=.5*Math.exp(2*h/3),c=.5*Math.sqrt(h*u*(o-u)/o)*(l-o/2<0?-1:1);e(t,i,r,Math.max(a,Math.floor(r-l*u/o+c)),Math.min(n,Math.floor(r+(o-l)*u/o+c)),s)}let o=i[2*r+s],l=a,h=n;for(lq(t,i,a,r),i[2*n+s]>o&&lq(t,i,a,n);l<h;){for(lq(t,i,l,h),l++,h--;i[2*l+s]<o;)l++;for(;i[2*h+s]>o;)h--}i[2*a+s]===o?lq(t,i,a,h):lq(t,i,++h,n),h<=r&&(a=h+1),r<=h&&(n=h-1)}})(t,i,o,a,n,s),e(t,i,r,a,o-1,1-s),e(t,i,r,o+1,n,1-s)}(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,i,r){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:a,coords:n,nodeSize:s}=this,o=[0,a.length-1,0],l=[];for(;o.length;){let h=o.pop()||0,u=o.pop()||0,c=o.pop()||0;if(u-c<=s){for(let s=c;s<=u;s++){let o=n[2*s],h=n[2*s+1];o>=e&&o<=i&&h>=t&&h<=r&&l.push(a[s])}continue}let d=c+u>>1,p=n[2*d],f=n[2*d+1];p>=e&&p<=i&&f>=t&&f<=r&&l.push(a[d]),(0===h?e<=p:t<=f)&&(o.push(c),o.push(d-1),o.push(1-h)),(0===h?i>=p:r>=f)&&(o.push(d+1),o.push(u),o.push(1-h))}return l}within(e,t,i){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:r,coords:a,nodeSize:n}=this,s=[0,r.length-1,0],o=[],l=i*i;for(;s.length;){let h=s.pop()||0,u=s.pop()||0,c=s.pop()||0;if(u-c<=n){for(let i=c;i<=u;i++)lH(a[2*i],a[2*i+1],e,t)<=l&&o.push(r[i]);continue}let d=c+u>>1,p=a[2*d],f=a[2*d+1];lH(p,f,e,t)<=l&&o.push(r[d]),(0===h?e-i<=p:t-i<=f)&&(s.push(c),s.push(d-1),s.push(1-h)),(0===h?e+i>=p:t+i>=f)&&(s.push(d+1),s.push(u),s.push(1-h))}return o}}function lq(e,t,i,r){lW(e,i,r),lW(t,2*i,2*r),lW(t,2*i+1,2*r+1)}function lW(e,t,i){let r=e[t];e[t]=e[i],e[i]=r}function lH(e,t,i,r){let a=e-i,n=t-r;return a*a+n*n}e.cx=void 0,(S=e.cx||(e.cx={})).create="create",S.load="load",S.fullLoad="fullLoad";let lX=null,lY=[],lK=1e3/60,lJ="loadTime",lQ="fullLoadTime";e.$=8192,e.A=A,e.B=function([e,t,i]){return t+=90,{x:e*Math.cos(t*=Math.PI/180)*Math.sin(i*=Math.PI/180),y:e*Math.sin(t)*Math.sin(i),z:e*Math.cos(i)}},e.C=it,e.D=aE,e.E=eI,e.F=ab,e.G=r9,e.H=function(e){if(null==es){let t=e.navigator?e.navigator.userAgent:null;es=!!e.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return es},e.I=oF,e.J=class{constructor(e,t){this.target=e,this.mapId=t,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new la(()=>this.process()),this.subscription=eu(this.target,"message",e=>this.receive(e),!1),this.globalScope=en(self)?e:window}registerMessageHandler(e,t){this.messageHandlers[e]=t}sendAsync(e,t){return new Promise((i,r)=>{let a=Math.round(1e18*Math.random()).toString(36).substring(0,10),n=t?eu(t.signal,"abort",()=>{null==n||n.unsubscribe(),delete this.resolveRejects[a];let t={id:a,type:"<cancel>",origin:location.origin,targetMapId:e.targetMapId,sourceMapId:this.mapId};this.target.postMessage(t)},ln):null;this.resolveRejects[a]={resolve:e=>{null==n||n.unsubscribe(),i(e)},reject:e=>{null==n||n.unsubscribe(),r(e)}};let s=[],o=Object.assign(Object.assign({},e),{id:a,sourceMapId:this.mapId,origin:location.origin,data:al(e.data,s)});this.target.postMessage(o,{transfer:s})})}receive(e){let t=e.data,i=t.id;if(!("file://"!==t.origin&&"file://"!==location.origin&&"resource://android"!==t.origin&&"resource://android"!==location.origin&&t.origin!==location.origin||t.targetMapId&&this.mapId!==t.targetMapId)){if("<cancel>"===t.type){delete this.tasks[i];let e=this.abortControllers[i];return delete this.abortControllers[i],void(e&&e.abort())}if(en(self)||t.mustQueue)return this.tasks[i]=t,this.taskQueue.push(i),void this.invoker.trigger();this.processTask(i,t)}}process(){if(0===this.taskQueue.length)return;let e=this.taskQueue.shift(),t=this.tasks[e];delete this.tasks[e],this.taskQueue.length>0&&this.invoker.trigger(),t&&this.processTask(e,t)}processTask(e,t){return v(this,void 0,void 0,function*(){if("<response>"===t.type){let i=this.resolveRejects[e];if(delete this.resolveRejects[e],!i)return;return void(t.error?i.reject(ah(t.error)):i.resolve(ah(t.data)))}if(!this.messageHandlers[t.type])return void this.completeTask(e,Error(`Could not find a registered handler for ${t.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));let i=ah(t.data),r=new AbortController;this.abortControllers[e]=r;try{let a=yield this.messageHandlers[t.type](t.sourceMapId,i,r);this.completeTask(e,null,a)}catch(t){this.completeTask(e,t)}})}completeTask(e,t,i){let r=[];delete this.abortControllers[e];let a={id:e,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:t?al(t):null,data:al(i,r)};
2this.target.postMessage(a,{transfer:r})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},e.K=ex,e.L=function(){var e=new A(16);return A!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e},e.M=function(e,t,i){var r,a,n,s,o,l,h,u,c,d,p,f,m=i[0],_=i[1],g=i[2];return t===e?(e[12]=t[0]*m+t[4]*_+t[8]*g+t[12],e[13]=t[1]*m+t[5]*_+t[9]*g+t[13],e[14]=t[2]*m+t[6]*_+t[10]*g+t[14],e[15]=t[3]*m+t[7]*_+t[11]*g+t[15]):(a=t[1],n=t[2],s=t[3],o=t[4],l=t[5],h=t[6],u=t[7],c=t[8],d=t[9],p=t[10],f=t[11],e[0]=r=t[0],e[1]=a,e[2]=n,e[3]=s,e[4]=o,e[5]=l,e[6]=h,e[7]=u,e[8]=c,e[9]=d,e[10]=p,e[11]=f,e[12]=r*m+o*_+c*g+t[12],e[13]=a*m+l*_+d*g+t[13],e[14]=n*m+h*_+p*g+t[14],e[15]=s*m+u*_+f*g+t[15]),e},e.N=function(e,t,i){var r=i[0],a=i[1],n=i[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*a,e[5]=t[5]*a,e[6]=t[6]*a,e[7]=t[7]*a,e[8]=t[8]*n,e[9]=t[9]*n,e[10]=t[10]*n,e[11]=t[11]*n,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},e.O=function(e,t,i){var r=t[0],a=t[1],n=t[2],s=t[3],o=t[4],l=t[5],h=t[6],u=t[7],c=t[8],d=t[9],p=t[10],f=t[11],m=t[12],_=t[13],g=t[14],y=t[15],x=i[0],v=i[1],b=i[2],w=i[3];return e[0]=x*r+v*o+b*c+w*m,e[1]=x*a+v*l+b*d+w*_,e[2]=x*n+v*h+b*p+w*g,e[3]=x*s+v*u+b*f+w*y,e[4]=(x=i[4])*r+(v=i[5])*o+(b=i[6])*c+(w=i[7])*m,e[5]=x*a+v*l+b*d+w*_,e[6]=x*n+v*h+b*p+w*g,e[7]=x*s+v*u+b*f+w*y,e[8]=(x=i[8])*r+(v=i[9])*o+(b=i[10])*c+(w=i[11])*m,e[9]=x*a+v*l+b*d+w*_,e[10]=x*n+v*h+b*p+w*g,e[11]=x*s+v*u+b*f+w*y,e[12]=(x=i[12])*r+(v=i[13])*o+(b=i[14])*c+(w=i[15])*m,e[13]=x*a+v*l+b*d+w*_,e[14]=x*n+v*h+b*p+w*g,e[15]=x*s+v*u+b*f+w*y,e},e.P=b,e.Q=function(e,t){let i={};for(let r=0;r<t.length;r++){let a=t[r];a in e&&(i[a]=e[a])}return i},e.R=sm,e.S=ls,e.T=sw,e.U=lu,e.V=lh,e.W=C,e.X=I,e.Y=eh,e.Z=lg,e._=v,e.a=eg,e.a$=D,e.a0=function(e,t){var i,r,a,n;if(!e)return null!=t?t:{};if(!t)return e;let s=Object.assign({},e);if(t.removeAll&&(s.removeAll=!0),t.remove){let e=new Set(s.remove?s.remove.concat(t.remove):t.remove);s.remove=Array.from(e.values())}if(t.add){let e=new Map((s.add?s.add.concat(t.add):t.add).map(e=>[e.id,e]));s.add=Array.from(e.values())}if(t.update){let e=new Map(null==(i=s.update)?void 0:i.map(e=>[e.id,e]));for(let i of t.update){let t=null!=(r=e.get(i.id))?r:{id:i.id};i.newGeometry&&(t.newGeometry=i.newGeometry),i.addOrUpdateProperties&&(t.addOrUpdateProperties=(null!=(a=t.addOrUpdateProperties)?a:[]).concat(i.addOrUpdateProperties)),i.removeProperties&&(t.removeProperties=(null!=(n=t.removeProperties)?n:[]).concat(i.removeProperties)),i.removeAllProperties&&(t.removeAllProperties=!0),e.set(i.id,t)}s.update=Array.from(e.values())}return s},e.a1=lp,e.a2=lv,e.a3=25,e.a4=lm,e.a5=e=>{let t=window.document.createElement("video");return t.muted=!0,new Promise(i=>{for(let r of(t.onloadstart=()=>{i(t)},e)){let e=window.document.createElement("source");eT(r)||(t.crossOrigin="Anonymous"),e.src=r,t.appendChild(e)}})},e.a6=eO,e.a7=function(){return J++},e.a8=nr,e.a9=o4,e.aA=function(e){let t=1/0,i=1/0,r=-1/0,a=-1/0;for(let n of e)t=Math.min(t,n.x),i=Math.min(i,n.y),r=Math.max(r,n.x),a=Math.max(a,n.y);return[t,i,r,a]},e.aB=24,e.aC=$,e.aD=function(e,t,i,r,a=!1){if(!i[0]&&!i[1])return[0,0];let n=a?"map"===r?-e.bearingInRadians:0:"viewport"===r?e.bearingInRadians:0;if(n){let e=Math.sin(n),t=Math.cos(n);i=[i[0]*t-i[1]*e,i[0]*e+i[1]*t]}return[a?i[0]:$(t,i[0],e.zoom),a?i[1]:$(t,i[1],e.zoom)]},e.aF=oQ,e.aG=lU,e.aH=oH,e.aI=lG,e.aJ=aU,e.aK=sq,e.aL=nf,e.aM=nA,e.aN=nM,e.aO=Y,e.aP=ed,e.aQ=ld,e.aR=F,e.aS=L,e.aT=function(e){var t=new A(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t},e.aU=function(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e[2]=t[2]-i[2],e},e.aV=function(e,t){var i=t[0],r=t[1],a=t[2],n=i*i+r*r+a*a;return n>0&&(n=1/Math.sqrt(n)),e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e},e.aW=B,e.aX=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]},e.aY=function(e,t,i){return e[0]=t[0]*i[0],e[1]=t[1]*i[1],e[2]=t[2]*i[2],e[3]=t[3]*i[3],e},e.aZ=D,e.a_=function(e,t,i){let r=t[0]*i[0]+t[1]*i[1]+t[2]*i[2];return 0===r?null:(-(e[0]*i[0]+e[1]*i[1]+e[2]*i[2])-i[3])/r},e.aa=rS,e.ab=n5,e.ac=lw,e.ad=function(e){let t={};if(e.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(e,i,r,a)=>{let n=r||a;return t[i]=!n||n.toLowerCase(),""}),t["max-age"]){let e=parseInt(t["max-age"],10);isNaN(e)?delete t["max-age"]:t["max-age"]=e}return t},e.ae=ec,e.af=function(e){return Math.pow(2,e)},e.ag=z,e.ah=X,e.ai=85.051129,e.aj=function(e,t){return e/ll(t)},e.ak=function(e){return Math.log(e)/Math.LN2},e.al=function(e){var t=e[0],i=e[1];return t*t+i*i},e.am=function(e,t){let i=[];for(let r in e)r in t||i.push(r);return i},e.an=function(e,t){let i=0,r=0;if("constant"===e.kind)r=e.layoutSize;else if("source"!==e.kind){let{interpolationType:a,minZoom:n,maxZoom:s}=e,o=a?X(t7.interpolationFactor(a,t,n,s),0,1):0;"camera"===e.kind?r=it.number(e.minSize,e.maxSize,o):i=o}return{uSizeT:i,uSize:r}},e.ap=function(e,{uSize:t,uSizeT:i},{lowerSize:r,upperSize:a}){return"source"===e.kind?r/128:"composite"===e.kind?it.number(r/128,a/128,i):t},e.aq=function(e,t){var i=t[0],r=t[1],a=t[2],n=t[3],s=t[4],o=t[5],l=t[6],h=t[7],u=t[8],c=t[9],d=t[10
2],p=t[11],f=t[12],m=t[13],_=t[14],g=t[15],y=i*o-r*s,x=i*l-a*s,v=i*h-n*s,b=r*l-a*o,w=r*h-n*o,T=a*h-n*l,P=u*m-c*f,S=u*_-d*f,M=u*g-p*f,C=c*_-d*m,I=c*g-p*m,A=d*g-p*_,E=y*A-x*I+v*C+b*M-w*S+T*P;return E?(e[0]=(o*A-l*I+h*C)*(E=1/E),e[1]=(a*I-r*A-n*C)*E,e[2]=(m*T-_*w+g*b)*E,e[3]=(d*w-c*T-p*b)*E,e[4]=(l*M-s*A-h*S)*E,e[5]=(i*A-a*M+n*S)*E,e[6]=(_*v-f*T-g*x)*E,e[7]=(u*T-d*v+p*x)*E,e[8]=(s*I-o*M+h*P)*E,e[9]=(r*M-i*I-n*P)*E,e[10]=(f*w-m*v+g*y)*E,e[11]=(c*v-u*w-p*y)*E,e[12]=(o*S-s*C-l*P)*E,e[13]=(i*C-r*S+a*P)*E,e[14]=(m*x-f*b-_*y)*E,e[15]=(u*b-c*x+d*y)*E,e):null},e.ar=U,e.as=function(e){return Math.hypot(e[0],e[1])},e.at=function(e){return e[0]=0,e[1]=0,e},e.au=function(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e},e.av=o2,e.aw=O,e.ax=function(e,t,i,r){let a=t.y-e.y,n=t.x-e.x,s=r.y-i.y,o=r.x-i.x,l=s*n-o*a;if(0===l)return null;let h=(o*(e.y-i.y)-s*(e.x-i.x))/l;return new b(e.x+h*n,e.y+h*a)},e.ay=lM,e.az=n6,e.b=eo,e.b$=class extends a1{},e.b0=function(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e},e.b1=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]},e.b2=l_,e.b3=ly,e.b4=function(e,t,i,r,a){var n,s=1/Math.tan(t/2);return e[0]=s/i,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=a&&a!==1/0?(e[10]=(a+r)*(n=1/(r-a)),e[14]=2*a*r*n):(e[10]=-1,e[14]=-2*r),e},e.b5=function(e){var t=new A(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},e.b6=function(e,t,i){var r=Math.sin(i),a=Math.cos(i),n=t[0],s=t[1],o=t[2],l=t[3],h=t[4],u=t[5],c=t[6],d=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=n*a+h*r,e[1]=s*a+u*r,e[2]=o*a+c*r,e[3]=l*a+d*r,e[4]=h*a-n*r,e[5]=u*a-s*r,e[6]=c*a-o*r,e[7]=d*a-l*r,e},e.b7=function(e,t,i){var r=Math.sin(i),a=Math.cos(i),n=t[4],s=t[5],o=t[6],l=t[7],h=t[8],u=t[9],c=t[10],d=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=n*a+h*r,e[5]=s*a+u*r,e[6]=o*a+c*r,e[7]=l*a+d*r,e[8]=h*a-n*r,e[9]=u*a-s*r,e[10]=c*a-o*r,e[11]=d*a-l*r,e},e.b8=function(){let e=new Float32Array(16);return z(e),e},e.b9=function(){let e=new Float64Array(16);return z(e),e},e.bA=function(e,t){let i=Z(e,360),r=Z(t,360),a=r-i,n=r>i?a-360:a+360;return Math.abs(a)<Math.abs(n)?a:n},e.bB=function(e){return e[0]=0,e[1]=0,e[2]=0,e},e.bC=function(e,t,i,r){let a=Math.sqrt(e*e+t*t),n=Math.sqrt(i*i+r*r);e/=a,t/=a;let s=Math.acos(e*(i/=n)+t*(r/=n));return-t*i+e*r>0?s:-s},e.bD=function(e,t){let i=Z(e,2*Math.PI),r=Z(t,2*Math.PI);return Math.min(Math.abs(i-r),Math.abs(i-r+2*Math.PI),Math.abs(i-r-2*Math.PI))},e.bE=function(){let e={},t=eA.$version;for(let i in eA.$root){let r=eA.$root[i];if(r.required){let a=null;null!=(a="version"===i?t:"array"===r.type?[]:{})&&(e[i]=a)}}return e},e.bF=au,e.bG=eb,e.bH=function e(t,i){if(Array.isArray(t)){if(!Array.isArray(i)||t.length!==i.length)return!1;for(let r=0;r<t.length;r++)if(!e(t[r],i[r]))return!1;return!0}if("object"==typeof t&&null!==t&&null!==i){if("object"!=typeof i||Object.keys(t).length!==Object.keys(i).length)return!1;for(let r in t)if(!e(t[r],i[r]))return!1;return!0}return t===i},e.bI=function(e){e=e.slice();let t=Object.create(null);for(let i=0;i<e.length;i++)t[e[i].id]=e[i];for(let i=0;i<e.length;i++)"ref"in e[i]&&(e[i]=function(e,t){let i={};for(let t in e)"ref"!==t&&(i[t]=e[t]);return eE.forEach(e=>{e in t&&(i[e]=t[e])}),i}(e[i],t[e[i].ref]));return e},e.bJ=function(e){if("custom"===e.type)return new lr(e);switch(e.type){case"background":return new le(e);case"circle":return new so(e);case"color-relief":return new sS(e);case"fill":return new s0(e);case"fill-extrusion":return new oa(e);case"heatmap":return new sy(e);case"hillshade":return new sv(e);case"line":return new op(e);case"raster":return new li(e);case"symbol":return new o9(e)}},e.bK=et,e.bL=function(e,t){if(!e)return[{command:"setStyle",args:[t]}];let i=[];try{if(!ez(e.version,t.version))return[{command:"setStyle",args:[t]}];ez(e.center,t.center)||i.push({command:"setCenter",args:[t.center]}),ez(e.state,t.state)||i.push({command:"setGlobalState",args:[t.state]}),ez(e.centerAltitude,t.centerAltitude)||i.push({command:"setCenterAltitude",args:[t.centerAltitude]}),ez(e.zoom,t.zoom)||i.push({command:"setZoom",args:[t.zoom]}),ez(e.bearing,t.bearing)||i.push({command:"setBearing",args:[t.bearing]}),ez(e.pitch,t.pitch)||i.push({command:"setPitch",args:[t.pitch]}),ez(e.roll,t.roll)||i.push({command:"setRoll",args:[t.roll]}
2),ez(e.sprite,t.sprite)||i.push({command:"setSprite",args:[t.sprite]}),ez(e.glyphs,t.glyphs)||i.push({command:"setGlyphs",args:[t.glyphs]}),ez(e.transition,t.transition)||i.push({command:"setTransition",args:[t.transition]}),ez(e.light,t.light)||i.push({command:"setLight",args:[t.light]}),ez(e.terrain,t.terrain)||i.push({command:"setTerrain",args:[t.terrain]}),ez(e.sky,t.sky)||i.push({command:"setSky",args:[t.sky]}),ez(e.projection,t.projection)||i.push({command:"setProjection",args:[t.projection]});let r={},a=[];!function(e,t,i,r){let a;for(a in t=t||{},e=e||{})Object.prototype.hasOwnProperty.call(e,a)&&(Object.prototype.hasOwnProperty.call(t,a)||eR(a,i,r));for(a in t){var n;Object.prototype.hasOwnProperty.call(t,a)&&(Object.prototype.hasOwnProperty.call(e,a)?ez(e[a],t[a])||("geojson"===e[a].type&&"geojson"===t[a].type&&function(e,t,i){let r;for(r in e[i])if(Object.prototype.hasOwnProperty.call(e[i],r)&&"data"!==r&&!ez(e[i][r],t[i][r]))return!1;for(r in t[i])if(Object.prototype.hasOwnProperty.call(t[i],r)&&"data"!==r&&!ez(e[i][r],t[i][r]))return!1;return!0}(e,t,a)?ek(i,{command:"setGeoJSONSourceData",args:[a,t[a].data]}):(n=t,eR(a,i,r),eD(a,n,i))):eD(a,t,i))}}(e.sources,t.sources,a,r);let n=[];e.layers&&e.layers.forEach(e=>{"source"in e&&r[e.source]?i.push({command:"removeLayer",args:[e.id]}):n.push(e)}),i=i.concat(a),function(e,t,i){let r,a,n,s,o;t=t||[];let l=(e=e||[]).map(eF),h=t.map(eF),u=e.reduce(eB,{}),c=t.reduce(eB,{}),d=l.slice(),p=Object.create(null);for(let e=0,t=0;e<l.length;e++)r=l[e],Object.prototype.hasOwnProperty.call(c,r)?t++:(ek(i,{command:"removeLayer",args:[r]}),d.splice(d.indexOf(r,t),1));for(let e=0,t=0;e<h.length;e++)r=h[h.length-1-e],d[d.length-1-e]!==r&&(Object.prototype.hasOwnProperty.call(u,r)?(ek(i,{command:"removeLayer",args:[r]}),d.splice(d.lastIndexOf(r,d.length-t),1)):t++,s=d[d.length-e],ek(i,{command:"addLayer",args:[c[r],s]}),d.splice(d.length-e,0,r),p[r]=!0);for(let e=0;e<h.length;e++)if(a=u[r=h[e]],n=c[r],!p[r]&&!ez(a,n))if(ez(a.source,n.source)&&ez(a["source-layer"],n["source-layer"])&&ez(a.type,n.type)){for(o in eL(a.layout,n.layout,i,r,null,"setLayoutProperty"),eL(a.paint,n.paint,i,r,null,"setPaintProperty"),ez(a.filter,n.filter)||ek(i,{command:"setFilter",args:[r,n.filter]}),ez(a.minzoom,n.minzoom)&&ez(a.maxzoom,n.maxzoom)||ek(i,{command:"setLayerZoomRange",args:[r,n.minzoom,n.maxzoom]}),a)Object.prototype.hasOwnProperty.call(a,o)&&"layout"!==o&&"paint"!==o&&"filter"!==o&&"metadata"!==o&&"minzoom"!==o&&"maxzoom"!==o&&(0===o.indexOf("paint.")?eL(a[o],n[o],i,r,o.slice(6),"setPaintProperty"):ez(a[o],n[o])||ek(i,{command:"setLayerProperty",args:[r,o,n[o]]}));for(o in n)Object.prototype.hasOwnProperty.call(n,o)&&!Object.prototype.hasOwnProperty.call(a,o)&&"layout"!==o&&"paint"!==o&&"filter"!==o&&"metadata"!==o&&"minzoom"!==o&&"maxzoom"!==o&&(0===o.indexOf("paint.")?eL(a[o],n[o],i,r,o.slice(6),"setPaintProperty"):ez(a[o],n[o])||ek(i,{command:"setLayerProperty",args:[r,o,n[o]]}))}else ek(i,{command:"removeLayer",args:[r]}),s=d[d.lastIndexOf(r)+1],ek(i,{command:"addLayer",args:[n,s]})}(n,t.layers,i)}catch(e){console.warn("Unable to compute style diff:",e),i=[{command:"setStyle",args:[t]}]}return i},e.bM=function(e){let t=[],i=e.id;return void 0===i&&t.push({message:`layers.${i}: missing required property "id"`}),void 0===e.render&&t.push({message:`layers.${i}: missing required method "render"`}),e.renderingMode&&"2d"!==e.renderingMode&&"3d"!==e.renderingMode&&t.push({message:`layers.${i}: property "renderingMode" must be either "2d" or "3d"`}),t},e.bN=Q,e.bO=ee,e.bP=class extends nN{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1i(this.location,e))}},e.bQ=nG,e.bR=class extends nN{constructor(e,t){super(e,t),this.current=nq}set(e){if(e[12]!==this.current[12]||e[0]!==this.current[0])return this.current=e,void this.gl.uniformMatrix4fv(this.location,!1,e);for(let t=1;t<16;t++)if(e[t]!==this.current[t]){this.current=e,this.gl.uniformMatrix4fv(this.location,!1,e);break}}},e.bS=nZ,e.bT=class extends nN{constructor(e,t){super(e,t),this.current=[0,0,0]}set(e){e[0]===this.current[0]&&e[1]===this.current[1]&&e[2]===this.current[2]||(this.current=e,this.gl.uniform3f(this.location,e[0],e[1],e[2]))}},e.bU=class extends nN{constructor(e,t){super(e,t),this.current=[0,0]}set(e){e[0]===this.current[0]&&e[1]===this.current[1]||(this.current=e,this.gl.uniform2f(this.location,e[0],e[1]))}},e.bV=E,e.bW=function(e,t){var i=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=i,e[2]=0,e[3]=-i,e[4]=r,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},e.bX=function(e,t,i){var r=t[0],a=t[1],n=t[2];return e[0]=r*i[0]+a*i[3]+n*i[6],e[1]=r*i[1]+a*i[4]+n*i[7],e[2]=r*i[2]+a*i[5]+n*i[8],e},e.bY=function(e,t,i,r,a,n,s){var o=1/(t-i),l=1/(r-a),h=1/(n-s);return e[0]=-2*o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10
2]=2*h,e[11]=0,e[12]=(t+i)*o,e[13]=(a+r)*l,e[14]=(s+n)*h,e[15]=1,e},e.bZ=class extends nN{constructor(e,t){super(e,t),this.current=[]}set(e){if(e!=this.current){this.current=e;let t=new Float32Array(4*e.length);for(let i=0;i<e.length;i++)t[4*i]=e[i].r,t[4*i+1]=e[i].g,t[4*i+2]=e[i].b,t[4*i+3]=e[i].a;this.gl.uniform4fv(this.location,t)}}},e.b_=class extends nN{constructor(e,t){super(e,t),this.current=[]}set(e){if(e!=this.current){this.current=e;let t=new Float32Array(e);this.gl.uniform1fv(this.location,t)}}},e.ba=function(){return new Float64Array(16)},e.bb=function(e,t,i){let r=new Float64Array(4);return V(r,e,t-90,i),r},e.bc=function(e,t,i,r){var a,n,s,o,l,h=t[0],u=t[1],c=t[2],d=t[3],p=i[0],f=i[1],m=i[2],_=i[3];return(n=h*p+u*f+c*m+d*_)<0&&(n=-n,p=-p,f=-f,m=-m,_=-_),1-n>1e-6?(s=Math.sin(a=Math.acos(n)),o=Math.sin((1-r)*a)/s,l=Math.sin(r*a)/s):(o=1-r,l=r),e[0]=o*h+l*p,e[1]=o*u+l*f,e[2]=o*c+l*m,e[3]=o*d+l*_,e},e.bd=function(e){var t,i,r,a,n,s,o,l,h,u,c,d,p,f,m,_;let g,y,x=new Float64Array(9);l=(t=e[0])*(n=t+t),h=(i=e[1])*n,c=(r=e[2])*n,d=r*(s=i+i),f=(a=e[3])*n,m=a*s,_=a*(o=r+r),x[0]=1-(u=i*s)-(p=r*o),x[3]=h-_,x[6]=c+m,x[1]=h+_,x[4]=1-l-p,x[7]=d-f,x[2]=c-m,x[5]=d+f,x[8]=1-l-u;let v=ed(-Math.asin(X(x[2],-1,1)));return .001>Math.hypot(x[5],x[8])?(g=0,y=-ed(Math.atan2(x[3],x[4]))):(g=ed(0===x[5]&&0===x[8]?0:Math.atan2(x[5],x[8])),y=ed(0===x[1]&&0===x[0]?0:Math.atan2(x[1],x[0]))),{roll:g,pitch:v+90,bearing:y}},e.be=function(e,t){return e.roll==t.roll&&e.pitch==t.pitch&&e.bearing==t.bearing},e.bf=tb,e.bg=n$,e.bh=-32768,e.bi=32767,e.bj=sG,e.bk=G,e.bl=q,e.bm=tD,e.bn=function(e,t,i,r,a){return G(r,a,X((e-t)/(i-t),0,1))},e.bo=Z,e.bp=function(){return new Float64Array(3)},e.bq=function(e,t,i,r){return e[0]=t[0]+i[0]*r,e[1]=t[1]+i[1]*r,e[2]=t[2]+i[2]*r,e},e.br=V,e.bs=function(e,t,i){var r=i[0],a=i[1],n=i[2],s=t[0],o=t[1],l=t[2],h=a*l-n*o,u=n*s-r*l,c=r*o-a*s,d=a*c-n*u,p=n*h-r*c,f=r*u-a*h,m=2*i[3];return u*=m,c*=m,p*=2,f*=2,e[0]=s+(h*=m)+(d*=2),e[1]=o+u+p,e[2]=l+c+f,e},e.bt=function(e,t,i){var r,a,n,s,o,l,h;let u=(r=[e[0],e[1],e[2],t[0],t[1],t[2],i[0],i[1],i[2]])[0]*((h=r[8])*(n=r[4])-(s=r[5])*(l=r[7]))+r[1]*(-h*(a=r[3])+s*(o=r[6]))+r[2]*(l*a-n*o);if(0===u)return null;let c=B([],[t[0],t[1],t[2]],[i[0],i[1],i[2]]),d=B([],[i[0],i[1],i[2]],[e[0],e[1],e[2]]),p=B([],[e[0],e[1],e[2]],[t[0],t[1],t[2]]),f=F([],c,-e[3]);return L(f,f,F([],d,-t[3])),L(f,f,F([],p,-i[3])),F(f,f,1/u),f},e.bu=6371008.8,e.bv=function(){return new Float64Array(4)},e.bw=function(e,t,i,r){var a=[],n=[];return a[0]=t[0]-i[0],a[1]=t[1]-i[1],a[2]=t[2]-i[2],n[0]=a[0]*Math.cos(r)-a[1]*Math.sin(r),n[1]=a[0]*Math.sin(r)+a[1]*Math.cos(r),n[2]=a[2],e[0]=n[0]+i[0],e[1]=n[1]+i[1],e[2]=n[2]+i[2],e},e.bx=function(e,t,i,r){var a=[],n=[];return a[0]=t[0]-i[0],a[1]=t[1]-i[1],a[2]=t[2]-i[2],n[0]=a[0],n[1]=a[1]*Math.cos(r)-a[2]*Math.sin(r),n[2]=a[1]*Math.sin(r)+a[2]*Math.cos(r),e[0]=n[0]+i[0],e[1]=n[1]+i[1],e[2]=n[2]+i[2],e},e.by=function(e,t,i,r){var a=[],n=[];return a[0]=t[0]-i[0],a[1]=t[1]-i[1],a[2]=t[2]-i[2],n[0]=a[2]*Math.sin(r)+a[0]*Math.cos(r),n[1]=a[1],n[2]=a[2]*Math.cos(r)-a[0]*Math.sin(r),e[0]=n[0]+i[0],e[1]=n[1]+i[1],e[2]=n[2]+i[2],e},e.bz=function(e,t,i){var r=Math.sin(i),a=Math.cos(i),n=t[0],s=t[1],o=t[2],l=t[3],h=t[8],u=t[9],c=t[10],d=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=n*a-h*r,e[1]=s*a-u*r,e[2]=o*a-c*r,e[3]=l*a-d*r,e[8]=n*r+h*a,e[9]=s*r+u*a,e[10]=o*r+c*a,e[11]=l*r+d*a,e},e.c=e_,e.c0=oy,e.c1=class extends a3{},e.c2=sg,e.c3=function(e){return e<=1?1:Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},e.c4=s_,e.c5=function(e,t,i){var r=t[0],a=t[1],n=t[2],s=i[3]*r+i[7]*a+i[11]*n+i[15];return e[0]=(i[0]*r+i[4]*a+i[8]*n+i[12])/(s=s||1),e[1]=(i[1]*r+i[5]*a+i[9]*n+i[13])/s,e[2]=(i[2]*r+i[6]*a+i[10]*n+i[14])/s,e},e.c6=class extends aG{},e.c7=class extends ne{},e.c8=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[11]===t[11]&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[15]===t[15]},e.c9=function(e,t){var i=e[0],r=e[1],a=e[2],n=e[3],s=e[4],o=e[5],l=e[6],h=e[7],u=e[8],c=e[9],d=e[10],p=e[11],f=e[12],m=e[13],_=e[14],g=e[15],y=t[0],x=t[1],v=t[2],b=t[3],w=t[4],T=t[5],P=t[6],S=t[7],M=t[8],C=t[9],I=t[10],A=t[11],E=t[12],z=t[13],k=t[14],D=t[15];return Math.abs(i-y)<=1e-6*Math.max(1,Math.abs(i),Math.abs(y))&&Math.abs(r-x)<=1e-6*Math.max(1,Math.abs(r),Math.abs(x))&&Math.abs(a-v)<=1e-6*Math.max(1,Math.abs(a),Math.abs(v))&&Math.abs(n-b)<=1e-6*Math.max(1,Math.abs(n),Math.abs(b))&&Math.abs(s-w)<=1e-6*Math.max(1,Math.abs(s),Math.abs(w))&&Math.abs(o-T)<=1e-6*Math.max(1,Math.abs(o),Math.abs(T))&&Math.abs(l-P)<=1e-6*Math.max(1,Math.abs(l),Math.abs(P))&&Math.abs(h-S)<=1e-6*Math.max(1,Math.abs(h),Math.abs(S))&&Math.abs(u-M)<=1e-6*Math.max(1,Math.abs(u),Math.abs(M))&&Math.abs(c-C)<=1e-6*Math.max(1,Math.abs(c),Math.abs(C))&&Math.abs(d-I)<=1e-6*Math.max(1,Math.abs(d),Math.abs(I))&&Math.abs(p-A)<=1e-6*Math.max(1,Math.abs(p),Math.abs(A))&&Math.abs(f-E)<=1e-6*Math.max(1,Math.abs(f),Math.abs(E))&&Math.abs(m-z)<=1e-6*Math.max(1,Math.abs(m),Math.abs(z))&&Math.abs(_-k)<=1e-6*Math.max(1,Math.abs(_),Math.abs(k))&&Math.abs(g-D)<=1e-6*Math.max(1,Math.abs(g),Math.abs(D))},e.cA=function(e,t){eg.REGISTERED_PROTOCOLS[e]=t},e.cB=function(e){delete eg.REGISTERED_PROTOCOLS[e]},e.cC=function(e,t){let i={};for(let r=0;r<e.length;r++){let a=t&&t[e[r].id]||function(e){let t="";for(let i of eE)t+=`/${function e(t){let i=typeof t;if("number"===i||"boolean"===i||"string"===i||null==t)return JSON.stringify(t);if(Array.isArray(t)){let i="[";for(let r of t)i+=`${e(r)},`;return`${i}]`}let r=Object.keys(t).sort(),a="{";for(let i=0;i<r.length;i++)a+=`${JSON.stringify(r[i])}:${e(t[r[i]])},`;return`${a}}`}(e[i])}`;return t}(e[r]);t&&(t[e[r].id]=a);let n=i[a];n||(n=i[a]=[]),n.push(e[r])}let r=[];for(let e in i)r.push(i[e]);return r},e.cD=aa,e.cE=lb,e.cF=lT,e.cG=oB,e.cH=function(t){t.bucket.createArrays(),t.bucket.tilePixelRatio=8192/(512*t.bucket.overscaling),t.bucket.compareText={},t.bucket.iconsNeedLinear=!1;let i=t.bucket.layers[0],r=i.layout,a=i._unevaluatedLayout._values,n={layoutIconSize:a["icon-size"].possiblyEvaluate(new ab(t.bu
2cket.zoom+1),t.canonical),layoutTextSize:a["text-size"].possiblyEvaluate(new ab(t.bucket.zoom+1),t.canonical),textMaxSize:a["text-size"].possiblyEvaluate(new ab(18))};if("composite"===t.bucket.textSizeData.kind){let{minZoom:e,maxZoom:i}=t.bucket.textSizeData;n.compositeTextSizes=[a["text-size"].possiblyEvaluate(new ab(e),t.canonical),a["text-size"].possiblyEvaluate(new ab(i),t.canonical)]}if("composite"===t.bucket.iconSizeData.kind){let{minZoom:e,maxZoom:i}=t.bucket.iconSizeData;n.compositeIconSizes=[a["icon-size"].possiblyEvaluate(new ab(e),t.canonical),a["icon-size"].possiblyEvaluate(new ab(i),t.canonical)]}let s=24*r.get("text-line-height"),o="viewport"!==r.get("text-rotation-alignment")&&"point"!==r.get("symbol-placement"),l=r.get("text-keep-upright"),h=r.get("text-size");for(let a of t.bucket.features){let u=r.get("text-font").evaluate(a,{},t.canonical).join(","),c=h.evaluate(a,{},t.canonical),d=n.layoutTextSize.evaluate(a,{},t.canonical),p=n.layoutIconSize.evaluate(a,{},t.canonical),f={horizontal:{},vertical:void 0},m=a.text,_,g=[0,0];if(m){let n=m.toString(),h=24*r.get("text-letter-spacing").evaluate(a,{},t.canonical),p=!function(e){for(let i of e){var t;if(t=i.charCodeAt(0),af.test(String.fromCodePoint(t)))return!1}return!0}(n)?0:h,_=r.get("text-anchor").evaluate(a,{},t.canonical),y=lV(i,a,t.canonical);if(!y){let e=r.get("text-radial-offset").evaluate(a,{},t.canonical);g=e?lj(_,[24*e,lO]):r.get("text-offset").evaluate(a,{},t.canonical).map(e=>24*e)}let x=o?"center":r.get("text-justify").evaluate(a,{},t.canonical),v="point"===r.get("symbol-placement")?24*r.get("text-max-width").evaluate(a,{},t.canonical):1/0,b=()=>{t.bucket.allowVerticalPlacement&&ad(n)&&(f.vertical=oV(m,t.glyphMap,t.glyphPositions,t.imagePositions,u,v,s,_,"left",p,g,e.ao.vertical,!0,d,c))};if(!o&&y){let i=new Set;if("auto"===x)for(let e=0;e<y.values.length;e+=2)i.add(lU(y.values[e]));else i.add(x);let r=!1;for(let a of i)if(!f.horizontal[a])if(r)f.horizontal[a]=f.horizontal[0];else{let i=oV(m,t.glyphMap,t.glyphPositions,t.imagePositions,u,v,s,"center",a,p,g,e.ao.horizontal,!1,d,c);i&&(f.horizontal[a]=i,r=1===i.positionedLines.length)}b()}else{"auto"===x&&(x=lU(_));let i=oV(m,t.glyphMap,t.glyphPositions,t.imagePositions,u,v,s,_,x,p,g,e.ao.horizontal,!1,d,c);i&&(f.horizontal[x]=i),b(),ad(n)&&o&&l&&(f.vertical=oV(m,t.glyphMap,t.glyphPositions,t.imagePositions,u,v,s,_,x,p,g,e.ao.vertical,!1,d,c))}}let y=!1;if(a.icon&&a.icon.name){let e=t.imageMap[a.icon.name];e&&(_=function(e,t,i){let{horizontalAlign:r,verticalAlign:a}=oH(i),n=t[0]-e.displaySize[0]*r,s=t[1]-e.displaySize[1]*a;return{image:e,top:s,bottom:s+e.displaySize[1],left:n,right:n+e.displaySize[0]}}(t.imagePositions[a.icon.name],r.get("icon-offset").evaluate(a,{},t.canonical),r.get("icon-anchor").evaluate(a,{},t.canonical)),y=!!e.sdf,void 0===t.bucket.sdfIcons?t.bucket.sdfIcons=y:t.bucket.sdfIcons!==y&&er("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(e.pixelRatio!==t.bucket.pixelRatio||0!==r.get("icon-rotate").constantOr(1))&&(t.bucket.iconsNeedLinear=!0))}let x=l$(f.horizontal)||f.vertical;t.bucket.iconsInText=!!x&&x.iconsInText,(x||_)&&function(t,i,r,a,n,s,o,l,h,u,c,d){let p,f=s.textMaxSize.evaluate(i,{});void 0===f&&(f=o);let m=t.layers[0].layout,_=m.get("icon-offset").evaluate(i,{},c),g=l$(r.horizontal),y=o/24,x=t.tilePixelRatio*y,v=t.tilePixelRatio*f/24,w=t.tilePixelRatio*l,T=t.tilePixelRatio*m.get("symbol-spacing"),P=m.get("text-padding")*t.tilePixelRatio,S=function(e,t,i,r=1){let a=e.get("icon-padding").evaluate(t,{},i),n=a&&a.values;return[n[0]*r,n[1]*r,n[2]*r,n[3]*r]}(m,i,c,t.tilePixelRatio),M=m.get("text-max-angle")/180*Math.PI,C="viewport"!==m.get("text-rotation-alignment")&&"point"!==m.get("symbol-placement"),I="map"===m.get("icon-rotation-alignment")&&"point"!==m.get("symbol-placement"),A=m.get("symbol-placement"),E=T/2,z=m.get("icon-text-fit");a&&"none"!==z&&(t.allowVerticalPlacement&&r.vertical&&(p=oK(a,r.vertical,z,m.get("icon-text-fit-padding"),_,y)),g&&(a=oK(a,g,z,m.get("icon-text-fit-padding"),_,y)));let k=c?d.line.getGranularityForZoomLevel(c.z):1,D=(l,d)=>{d.x<0||d.x>=8192||d.y<0||d.y>=8192||function(t,i,r,a,n,s,o,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,P,S){let M=t.addToLineVertexArray(i,r),C,I,A,E,z=0,k=0,D=0,R=0,L=-1,F=-1,B={},O=nO("");
2if(t.allowVerticalPlacement&&a.vertical){let e=l.layout.get("text-rotate").evaluate(b,{},P)+90;A=new lR(h,i,u,c,d,a.vertical,p,f,m,e),o&&(E=new lR(h,i,u,c,d,o,g,y,m,e))}if(n){let r=l.layout.get("icon-rotate").evaluate(b,{}),a="none"!==l.layout.get("icon-text-fit"),s=lz(n,r,T,a),p=o?lz(o,r,T,a):void 0;I=new lR(h,i,u,c,d,n,g,y,!1,r),z=4*s.length;let f=t.iconSizeData,m=null;"source"===f.kind?(m=[128*l.layout.get("icon-size").evaluate(b,{})])[0]>32640&&er(`${t.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`):"composite"===f.kind&&((m=[128*w.compositeIconSizes[0].evaluate(b,{},P),128*w.compositeIconSizes[1].evaluate(b,{},P)])[0]>32640||m[1]>32640)&&er(`${t.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`),t.addSymbols(t.icon,s,m,v,x,b,e.ao.none,i,M.lineStartIndex,M.lineLength,-1,P),L=t.icon.placedSymbolArray.length-1,p&&(k=4*p.length,t.addSymbols(t.icon,p,m,v,x,b,e.ao.vertical,i,M.lineStartIndex,M.lineLength,-1,P),F=t.icon.placedSymbolArray.length-1)}let j=Object.keys(a.horizontal);for(let r of j){let n=a.horizontal[r];C||(O=nO(n.text),C=new lR(h,i,u,c,d,n,p,f,m,l.layout.get("text-rotate").evaluate(b,{},P)));let o=1===n.positionedLines.length;if(D+=lN(t,i,n,s,l,m,b,_,M,a.vertical?e.ao.horizontal:e.ao.horizontalOnly,o?j:[r],B,L,w,P),o)break}a.vertical&&(R+=lN(t,i,a.vertical,s,l,m,b,_,M,e.ao.vertical,["vertical"],B,F,w,P));let V=C?C.boxStartIndex:t.collisionBoxArray.length,U=C?C.boxEndIndex:t.collisionBoxArray.length,N=A?A.boxStartIndex:t.collisionBoxArray.length,$=A?A.boxEndIndex:t.collisionBoxArray.length,Z=I?I.boxStartIndex:t.collisionBoxArray.length,G=I?I.boxEndIndex:t.collisionBoxArray.length,q=E?E.boxStartIndex:t.collisionBoxArray.length,W=E?E.boxEndIndex:t.collisionBoxArray.length,H=-1,X=(e,t)=>e&&e.circleDiameter?Math.max(e.circleDiameter,t):t;H=X(C,-1),H=X(A,H),H=X(I,H);let Y=+((H=X(E,H))>-1);Y&&(H*=S/24),t.glyphOffsetArray.length>=o4.MAX_GLYPHS&&er("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==b.sortKey&&t.addToSortKeyRanges(t.symbolInstances.length,b.sortKey);let K=lV(l,b,P),[J,Q]=function(t,i){let r=t.length,a=null==i?void 0:i.values;if((null==a?void 0:a.length)>0)for(let i=0;i<a.length;i+=2){let r=a[i+1];t.emplaceBack(e.aE[a[i]],r[0],r[1])}return[r,t.length]}(t.textAnchorOffsets,K);t.symbolInstances.emplaceBack(i.x,i.y,B.right>=0?B.right:-1,B.center>=0?B.center:-1,B.left>=0?B.left:-1,B.vertical||-1,L,F,O,V,U,N,$,Z,G,q,W,u,D,R,z,k,Y,0,p,H,J,Q)}(t,d,l,r,a,n,p,t.layers[0],t.collisionBoxArray,i.index,i.sourceLayerIndex,t.index,x,[P,P,P,P],C,h,w,S,I,_,i,s,u,c,o)};if("line"===A)for(let e of lM(i.geometry,0,0,8192,8192)){let i=sX(e,k);for(let e of function(e,t,i,r,a,n,s){let o=r?.6*24*n:0,l=lE(r,a),h=l*n,u=0===e[0].x||8192===e[0].x||0===e[0].y||8192===e[0].y;return t-h<t/4&&(t=h+t/4),function e(t,i,r,a,n,s,o,l,h){let u=s/2,c=lA(t),d=0,p=i-r,f=[];for(let e=0;e<t.length-1;e++){let i=t[e],o=t[e+1],l=i.dist(o),m=o.angleTo(i);for(;p+r<d+l;){let _=((p+=r)-d)/l,g=it.number(i.x,o.x,_),y=it.number(i.y,o.y,_);if(g>=0&&g<h&&y>=0&&y<h&&p-u>=0&&p+u<=c){let i=new lC(g,y,m,e);i._round(),a&&!lI(t,i,s,a,n)||f.push(i)}}d+=l}return l||f.length||o||(f=e(t,d/2,r,a,n,s,o,!0,h)),f}(e,u?t/2*s%t:(l/2+48)*n*s%t,t,o,i,h,u,!1,8192)}(i,T,M,r.vertical||g,a,v,t.overscaling))g&&function(e,t,i,r){let a=e.compareText;if(t in a){let e=a[t];for(let t=e.length-1;t>=0;t--)if(r.dist(e[t])<i)return!0}else a[t]=[];return a[t].push(r),!1}(t,g.text,E,e)||D(i,e)}else if("line-center"===A){for(let e of i.geometry)if(e.length>1){let t=sX(e,k),i=function(e,t,i,r,a){let n=i?.6*24*a:0,s=lE(i,r)*a,o=0,l=lA(e)/2;for(let i=0;i<e.length-1;i++){let r=e[i],a=e[i+1],h=r.dist(a);if(o+h>l){let u=(l-o)/h,c=new lC(it.number(r.x,a.x,u),it.number(r.y,a.y,u),a.angleTo(r),i);return c._round(),!n||lI(e,c,s,n,t)?c:void 0}o+=h}}(t,M,r.vertical||g,a,v);i&&D(t,i)}}else if("Polygon"===i.type)for(let e of iR(i.geometry,0)){let t=function(e,t=1,i=!1){let r=lv.fromPoints(e[0]),a=Math.min(r.width(),r.height()),n=a/2,s=new lL([],lF),{minX:o,minY:l,maxX:h,maxY:u}=r;if(0===a)return new b(o,l);for(let t=o;t<h;t+=a)for(let i=l;i<u;i+=a)s.push(new lB(t+n,i+n,n,e));let c=function(e){let t=0,i=0,r=0,a=e[0];for(let e=0,n=a.length,s=n-1;e<n;s=e++){let n=a[e],o=a[s],l=n.x*o.y-o.x*n.y;i+=(n.x+o.x)*l,r+=(n.y+o.y)*l,t+=3*l}return new lB(i/t,r/t,0,e)}(e),d=s.length;for(;s.length;){let r=s.pop();(r.d>c.d||!c.d)&&(c=r,i&&console.log("found best %d after %d probes",Math.round(1e4*r.d)/1e4,d)),r.max-c.d<=t||(n=r.h/2,s.push(new lB(r.p.x-n,r.p.y-n,n,e)),s.push(new lB(r.p.x+n,r.p.y-n,n,e)),s.push(new lB(r.p.x-n,r.p.y+n,n,e)),s.push(new lB(r.p.x+n,r.p.y+n,n,e)),d+=4)}return i&&(console.log(`num probes: ${d}`),console.log(`best distance: ${c.d}`)),c.p}(e,16);D(sX(e[0],k,!0),new lC(t.x,t.y,0))}else if("LineString"===i.type)for(let e of i.geometry){let t=sX(e,k);D(t,new lC(t[0].x,t[0].y,0))}else if("Point"===i.type)for(let e of i.geometry)for(let t of e)D([t],new lC(t.x,t.y,0))}(t.bucket,a,f,_,t.imageMap,n,d,p,g,y,t.canonical,t.subdivisionGranularity)}t.showCollisionBoxes&&t.bucket.generateCollisionDebugBuffers()},e.cI=ou,e.cJ=sJ,e.cK=ot,e.cL=s9,e.cM=ob,e.cN=class{constructor(e){this._marks={start:[e.url,"start"].join("#"),end:[e.url,"end"].join("#"),measure:e.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let e=performance.getEntriesByName(this._marks.measure);return 0===e.length&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),e=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),e}},e.cO=function(e,t,i,n,s){return v(this,void 0,void 0,function*(){let o,l,h;if(I())try{return yield eh(e,t,i,n,s)}catch(e){}return o=e.width,l=e.height,r&&a||(a=(r=new OffscreenCanvas(o,l)).getContext("2d",{willReadFrequently:!0})),r.width=o,r.height=l,a.drawImage(e,0,0,o,l),h=a.getImageData(t,i,n,s),a.clearRect(0,0,o,l),h.data})},e.cP=sT,e.cQ=w,e.cR=s6,e.cS=s5,e.cT=rg,e.cU=function(e,t){let i=new Map;if(null==e);else if("Feature"===e.type)i.set(lx(e,t),e);else for(let r of e.features)i.set(lx(r,t),r);return i},e.cV=function(e,t){if(null==e)return!0;
2if("Feature"===e.type)return null!=lx(e,t);if("FeatureCollection"===e.type){let i=new Set;for(let r of e.features){let e=lx(r,t);if(null==e||i.has(e))return!1;i.add(e)}return!0}return!1},e.cW=function(e,t,i){var r,a,n,s;if(t.removeAll&&e.clear(),t.remove)for(let i of t.remove)e.delete(i);if(t.add)for(let r of t.add){let t=lx(r,i);null!=t&&e.set(t,r)}if(t.update)for(let i of t.update){let t=e.get(i.id);if(null==t)continue;let o=!i.removeAllProperties&&((null==(r=i.removeProperties)?void 0:r.length)>0||(null==(a=i.addOrUpdateProperties)?void 0:a.length)>0);if((i.newGeometry||i.removeAllProperties||o)&&(t=Object.assign({},t),e.set(i.id,t),o&&(t.properties=Object.assign({},t.properties))),i.newGeometry&&(t.geometry=i.newGeometry),i.removeAllProperties)t.properties={};else if((null==(n=i.removeProperties)?void 0:n.length)>0)for(let e of i.removeProperties)Object.prototype.hasOwnProperty.call(t.properties,e)&&delete t.properties[e];if((null==(s=i.addOrUpdateProperties)?void 0:s.length)>0)for(let{key:e,value:r}of i.addOrUpdateProperties)t.properties[e]=r}},e.cX=av,e.ca=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},e.cb=e=>"symbol"===e.type,e.cc=e=>"circle"===e.type,e.cd=e=>"heatmap"===e.type,e.ce=e=>"line"===e.type,e.cf=e=>"fill"===e.type,e.cg=e=>"fill-extrusion"===e.type,e.ch=e=>"hillshade"===e.type,e.ci=e=>"color-relief"===e.type,e.cj=e=>"raster"===e.type,e.ck=e=>"background"===e.type,e.cl=e=>"custom"===e.type,e.cm=W,e.cn=function(e,t,i){let r=N(t.x-i.x,t.y-i.y),a=N(e.x-i.x,e.y-i.y);return ed(Math.atan2(r[0]*a[1]-r[1]*a[0],r[0]*a[0]+r[1]*a[1]))},e.co=H,e.cp=function(e,t){return ef[t]&&(e instanceof MouseEvent||e instanceof WheelEvent)},e.cq=function(e,t){return ep[t]&&"touches"in e},e.cr=function(e){return ep[e]||ef[e]},e.cs=function(e,t,i){var r=t[0],a=t[1];return e[0]=i[0]*r+i[4]*a+i[12],e[1]=i[1]*r+i[5]*a+i[13],e},e.ct=function(e,t){let{x:i,y:r}=lp.fromLngLat(t);return!(e<0||e>25||r<0||r>=1||i<0||i>=1)},e.cu=function(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},e.cv=class extends aZ{},e.cw={mark(e){performance.mark(e)},frame(e){null!=lX&&lY.push(e-lX),lX=e},clearMetrics(){for(let t in lX=null,lY=[],performance.clearMeasures(lJ),performance.clearMeasures(lQ),e.cx)performance.clearMarks(e.cx[t])},getPerformanceMetrics(){performance.measure(lJ,e.cx.create,e.cx.load),performance.measure(lQ,e.cx.create,e.cx.fullLoad);let t=performance.getEntriesByName(lJ)[0].duration,i=performance.getEntriesByName(lQ)[0].duration,r=lY.length,a=1/(lY.reduce((e,t)=>e+t,0)/r/1e3),n=lY.filter(e=>e>lK).reduce((e,t)=>e+(t-lK)/lK,0);return{loadTime:t,fullLoadTime:i,fps:a,percentDroppedFrames:n/(r+n)*100,totalFrames:r}}},e.cy=function(e){return e.message===em},e.cz=ev,e.d=eT,e.e=K,e.f=e=>v(void 0,void 0,void 0,function*(){if(0===e.byteLength)return createImageBitmap(new ImageData(1,1));let t=new Blob([new Uint8Array(e)],{type:"image/png"});try{return createImageBitmap(t)}catch(e){throw Error(`Could not load image because of ${e.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),e.g=ey,e.h=e=>new Promise((t,i)=>{let r=new Image;r.onload=()=>{t(r),URL.revokeObjectURL(r.src),r.onload=null,window.requestAnimationFrame(()=>{r.src=el})},r.onerror=()=>i(Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));let a=new Blob([new Uint8Array(e)],{type:"image/png"});r.src=e.byteLength?URL.createObjectURL(a):el}),e.i=en,e.j=(e,t)=>ew(K(e,{type:"json"}),t),e.k=eC,e.l=eM,e.m=ew,e.n=(e,t)=>ew(K(e,{type:"arrayBuffer"}),t),e.o=function(e){return new ob(e).readFields(ok,[])},e.p=oL,e.q=sf,e.r=aL,e.s=eu,e.t=aP,e.u=ac,e.v=eA,e.w=er,e.x=r8,e.y=at,e.z=r3}),i("worker",["./shared"],function(e){class t{constructor(e){this.keyCache={},e&&this.replace(e)}replace(e){this._layerConfigs={},this._layers={},this.update(e,[])}update(t,i){for(let i of t){this._layerConfigs[i.id]=i;let t=this._layers[i.id]=e.bJ(i);t._featureFilter=e.aa(t.filter),this.keyCache[i.id]&&delete this.keyCache[i.id]}for(let e of i)delete this.keyCache[e],delete this._layerConfigs[e],delete this._layers[e];for(let t of(this.familiesBySource={},e.cC(Object.values(this._layerConfigs),this.keyCache))){let e=t.map(e=>this._layers[e.id]),i=e[0];if("none"===i.visibility)continue;let r=i.source||"",a=this.familiesBySource[r];a||(a=this.familiesBySource[r]={});let n=i.sourceLayer||"_geojsonTileLayer",s=a[n];s||(s=a[n]=[]),s.push(e)}}}class i{constructor(t){const i={},r=[];for(const e in t){const a=t[e],n=i[e]={};for(const e in a){const t=a[+e];if(!t||0===t.bitmap.width||0===t.bitmap.height)continue;const i={x:0,y:0,w:t.bitmap.width+2,h:t.bitmap.height+2};r.push(i),n[e]={rect:i,metrics:t.metrics}}}const{w:a,h:n}=e.p(r),s=new e.q({width:a||1,height:n||1});for(const r in t){const a=t[r];for(const t in a){const n=a[+t];
2if(!n||0===n.bitmap.width||0===n.bitmap.height)continue;const o=i[r][t].rect;e.q.copy(n.bitmap,s,{x:0,y:0},{x:o.x+1,y:o.y+1},n.bitmap)}}this.image=s,this.positions=i}}e.cD("GlyphAtlas",i);class r{constructor(t){this.tileID=new e.Z(t.tileID.overscaledZ,t.tileID.wrap,t.tileID.canonical.z,t.tileID.canonical.x,t.tileID.canonical.y),this.uid=t.uid,this.zoom=t.zoom,this.pixelRatio=t.pixelRatio,this.tileSize=t.tileSize,this.source=t.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=t.showCollisionBoxes,this.collectResourceTiming=!!t.collectResourceTiming,this.returnDependencies=!!t.returnDependencies,this.promoteId=t.promoteId,this.inFlightDependencies=[],this.globalState=t.globalState}parse(t,r,n,s,o){return e._(this,void 0,void 0,function*(){this.status="parsing",this.data=t,this.collisionBoxArray=new e.a8;let l=new e.cE(Object.keys(t.layers).sort()),h=new e.cF(this.tileID,this.promoteId);h.bucketLayerIDs=[];let u={},c={featureIndex:h,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:n,subdivisionGranularity:o},d=r.familiesBySource[this.source];for(let i in d){let r=t.layers[i];if(!r)continue;1===r.version&&e.w(`Vector tile source "${this.source}" layer "${i}" does not use vector tile spec v2 and therefore may have some rendering errors.`);let s=l.encode(i),o=[];for(let e=0;e<r.length;e++){let t=r.feature(e),a=h.getId(t,i);o.push({feature:t,id:a,index:e,sourceLayerIndex:s})}for(let t of d[i]){let i=t[0];i.source!==this.source&&e.w(`layer.source = ${i.source} does not equal this.source = ${this.source}`),i.minzoom&&this.zoom<Math.floor(i.minzoom)||i.maxzoom&&this.zoom>=i.maxzoom||"none"!==i.visibility&&(a(t,this.zoom,n),(u[i.id]=i.createBucket({index:h.bucketLayerIDs.length,layers:t,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:s,sourceID:this.source,globalState:this.globalState})).populate(o,c,this.tileID.canonical),h.bucketLayerIDs.push(t.map(e=>e.id)))}}let p=e.bN(c.glyphDependencies,e=>Object.keys(e).map(Number));this.inFlightDependencies.forEach(e=>null==e?void 0:e.abort()),this.inFlightDependencies=[];let f=Promise.resolve({});if(Object.keys(p).length){let e=new AbortController;this.inFlightDependencies.push(e),f=s.sendAsync({type:"GG",data:{stacks:p,source:this.source,tileID:this.tileID,type:"glyphs"}},e)}let m=Object.keys(c.iconDependencies),_=Promise.resolve({});if(m.length){let e=new AbortController;this.inFlightDependencies.push(e),_=s.sendAsync({type:"GI",data:{icons:m,source:this.source,tileID:this.tileID,type:"icons"}},e)}let g=Object.keys(c.patternDependencies),y=Promise.resolve({});if(g.length){let e=new AbortController;this.inFlightDependencies.push(e),y=s.sendAsync({type:"GI",data:{icons:g,source:this.source,tileID:this.tileID,type:"patterns"}},e)}let[x,v,b]=yield Promise.all([f,_,y]),w=new i(x),T=new e.cG(v,b);for(let t in u){let i=u[t];i instanceof e.a9?(a(i.layers,this.zoom,n),e.cH({bucket:i,glyphMap:x,glyphPositions:w.positions,imageMap:v,imagePositions:T.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:c.subdivisionGranularity})):i.hasPattern&&(i instanceof e.cI||i instanceof e.cJ||i instanceof e.cK)&&(a(i.layers,this.zoom,n),i.addFeatures(c,this.tileID.canonical,T.patternPositions))}return this.status="done",{buckets:Object.values(u).filter(e=>!e.isEmpty()),featureIndex:h,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:w.image,imageAtlas:T,glyphMap:this.returnDependencies?x:null,iconMap:this.returnDependencies?v:null,glyphPositions:this.returnDependencies?w.positions:null}})}}function a(t,i,r){let a=new e.F(i);for(let e of t)e.recalculate(a,r)}class n{constructor(e,t,i){this.actor=e,this.layerIndex=t,this.availableImages=i,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(t,i){return e._(this,void 0,void 0,function*(){let r=yield e.n(t.request,i);try{return{vectorTile:new e.cL(new e.cM(r.data)),rawData:r.data,cacheControl:r.cacheControl,expires:r.expires}}catch(a){let e=new Uint8Array(r.data),i=`Unable to parse the tile at ${t.request.url}, `;throw Error(i+=31===e[0]&&139===e[1]?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${a.message}`)}})}loadTile(t){return e._(this,void 0,void 0,function*(){let i=t.uid,a=!!(t&&t.request&&t.request.collectResourceTiming)&&new e.cN(t.request),n=new r(t);this.loading[i]=n;let s=new AbortController;n.abort=s;try{let r=yield this.loadVectorTile(t,s);if(delete this.loading[i],!r)return null;let o=r.rawData,l={};r.expires&&(l.expires=r.expires),r.cacheControl&&(l.cacheControl=r.cacheControl);let h={};if(a){let e=a.finish();e&&(h.resourceTiming=JSON.parse(JSON.stringify(e)))}n.vectorTile=r.vectorTile;let u=n.parse(r.vectorTile,this.layerIndex,this.availableImages,this.actor,t.subdivisionGranularity);this.loaded[i]=n,this.fetching[i]={rawTileData:o,cacheControl:l,resourceTiming:h};try{let t=yield u;return e.e({rawTileData:o.slice(0)},t,l,h)}finally{delete this.fetching[i]}}catch(e){throw delete this.loading[i],n.status="done",this.loaded[i]=n,e}})}reloadTile(t){return e._(this,void 0,void 0,function*(){let i=t.uid;if(!this.loaded||!this.loaded[i])throw Error("Should not be trying to reload a tile that was never loaded or has been removed");let r=this.loaded[i];if(r.showCollisionBoxes=t.showCollisionBoxes,r.globalState=t.globalState,"parsing"===r.status){let a,n=yield r.parse(r.vectorTile,this.layerIndex,this.availableImages,this.actor,t.subdivisionGranularity);if(this.fetching[i]){let{rawTileData:t,cacheControl:r,resourceTiming:s}=this.fetching[i];delete this.fetching[i],a=e.e({rawTileData:t.slice(0)},n,r,s)}else a=n;return a}if("done"===r.status&&r.vectorTile)return r.parse(r.vectorTile,this.layerIndex,this.availableImages,this.actor,t.subdivisionGranularity)})}abortTile(t){return e._(this,void 0,void 0,function*(){let e=this.loading,i=t.uid;e&&e[i]&&e[i].abort&&(e[i].abort.abort(),delete e[i])})}removeTile(t){return e._(this,void 0,void 0,function*(){this.loaded&&this.loaded[t.uid]&&delete this.loaded[t.uid]})}}class s{constructor(){this.loaded={}}loadTile(t){return e._(this,void 0,void 0,function*(){let{uid:i,encoding:r,rawImageData:a,redFactor:n,greenFactor:s,blueFactor:o,baseShift:l}=t,h=a.width+2,u=a.height+2,c=e.b(a)?new e.R({width:h,height:u},(yield e.cO(a,-1,-1,h,u))):a,d=new e.cP(i,c,r,n,s,o,l);return this.loaded=this.loaded||{},this.loaded[i]=d,d})}removeTile(e){let t=this.loaded,i=e.uid;t&&t[i]&&delete t[i]}}var o,l,h,u=function(){if(h)return l;function e(e,i){if(0!==e.length){t(e[0],i);for(var r=1;r<e.length;r++)t(e[r],!i)}}function t(e,t){for(var i=0,r=0,a=0,n=e.length,s=n-1;a<n;
2s=a++){var o=(e[a][0]-e[s][0])*(e[s][1]+e[a][1]),l=i+o;r+=Math.abs(i)>=Math.abs(o)?i-l+o:o-l+i,i=l}i+r>=0!=!!t&&e.reverse()}return h=1,l=function t(i,r){var a,n=i&&i.type;if("FeatureCollection"===n)for(a=0;a<i.features.length;a++)t(i.features[a],r);else if("GeometryCollection"===n)for(a=0;a<i.geometries.length;a++)t(i.geometries[a],r);else if("Feature"===n)t(i.geometry,r);else if("Polygon"===n)e(i.coordinates,r);else if("MultiPolygon"===n)for(a=0;a<i.coordinates.length;a++)e(i.coordinates[a],r);return i}}(),c=e.cQ(u);class d extends e.cS{constructor(t,i){super(new e.cM,0,i,[],[]),this.feature=t,this.type=t.type,this.properties=t.tags?t.tags:{},"id"in t&&("string"==typeof t.id?this.id=parseInt(t.id,10):"number"!=typeof t.id||isNaN(t.id)||(this.id=t.id))}loadGeometry(){let t=[];for(let i of 1===this.feature.type?[this.feature.geometry]:this.feature.geometry){let r=[];for(let t of i)r.push(new e.P(t[0],t[1]));t.push(r)}return t}}class p extends e.cR{constructor(t,i){super(new e.cM),this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.version=i?i.version:1,this.extent=i?i.extent:4096,this.length=t.length,this.features=t}feature(e){return new d(this.features[e],this.extent)}}function f(e,t){t.writeVarintField(15,e.version||1),t.writeStringField(1,e.name||""),t.writeVarintField(5,e.extent||4096);let i={keys:[],values:[],keycache:{},valuecache:{}};for(let r=0;r<e.length;r++)i.feature=e.feature(r),t.writeMessage(2,m,i);for(let e of i.keys)t.writeStringField(3,e);for(let e of i.values)t.writeMessage(4,y,e)}function m(e,t){if(!e.feature)return;let i=e.feature;void 0!==i.id&&t.writeVarintField(1,i.id),t.writeMessage(2,_,e),t.writeVarintField(3,i.type),t.writeMessage(4,g,i)}function _(e,t){for(let i in e.feature?.properties){let r=e.feature.properties[i],a=e.keycache[i];if(null===r)continue;void 0===a&&(e.keys.push(i),a=e.keys.length-1,e.keycache[i]=a),t.writeVarint(a),"string"!=typeof r&&"boolean"!=typeof r&&"number"!=typeof r&&(r=JSON.stringify(r));let n=typeof r+":"+r,s=e.valuecache[n];void 0===s&&(e.values.push(r),s=e.values.length-1,e.valuecache[n]=s),t.writeVarint(s)}}function g(e,t){let i=e.loadGeometry(),r=e.type,a=0,n=0;for(let s of i){let i=1;1===r&&(i=s.length),t.writeVarint((i<<3)+1);let o=3===r?s.length-1:s.length;for(let e=0;e<o;e++){1===e&&1!==r&&t.writeVarint((o-1<<3)+2);let i=s[e].x-a,l=s[e].y-n;t.writeVarint(i<<1^i>>31),t.writeVarint(l<<1^l>>31),a+=i,n+=l}3===e.type&&t.writeVarint(15)}}function y(e,t){let i=typeof e;"string"===i?t.writeStringField(1,e):"boolean"===i?t.writeBooleanField(7,e):"number"===i&&(e%1!=0?t.writeDoubleField(3,e):e<0?t.writeSVarintField(6,e):t.writeVarintField(5,e))}let x={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:e=>e},v=Math.fround||(o=new Float32Array(1),e=>(o[0]=+e,o[0]));class b{constructor(e){this.options=Object.assign(Object.create(x),e),this.trees=Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(e){let{log:t,minZoom:i,maxZoom:r}=this.options;t&&console.time("total time");let a=`prepare ${e.length} points`;t&&console.time(a),this.points=e;let n=[];for(let t=0;t<e.length;t++){let i=e[t];if(!i.geometry)continue;let[r,a]=i.geometry.coordinates,s=v(P(r)),o=v(S(a));n.push(s,o,1/0,t,-1,1),this.options.reduce&&n.push(0)}let s=this.trees[r+1]=this._createTree(n);t&&console.timeEnd(a);for(let e=r;e>=i;e--){let i=+Date.now();s=this.trees[e]=this._createTree(this._cluster(s,e)),t&&console.log("z%d: %d clusters in %dms",e,s.numItems,Date.now()-i)}return t&&console.timeEnd("total time"),this}getClusters(e,t){let i=((e[0]+180)%360+360)%360-180,r=Math.max(-90,Math.min(90,e[1])),a=180===e[2]?180:((e[2]+180)%360+360)%360-180,n=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)i=-180,a=180;else if(i>a){let e=this.getClusters([i,r,180,n],t),s=this.getClusters([-180,r,a,n],t);return e.concat(s)}let s=this.trees[this._limitZoom(t)],o=s.range(P(i),S(n),P(a),S(r)),l=s.data,h=[];for(let e of o){let t=this.stride*e;h.push(l[t+5]>1?w(l,t,this.clusterProps):this.points[l[t+3]])}return h}getChildren(e){let t=this._getOriginId(e),i=this._getOriginZoom(e),r="No cluster with the specified id.",a=this.trees[i];if(!a)throw Error(r);let n=a.data;if(t*this.stride>=n.length)throw Error(r);let s=this.options.radius/(this.options.extent*Math.pow(2,i-1)),o=a.within(n[t*this.stride],n[t*this.stride+1],s),l=[];for(let t of o){let i=t*this.stride;n[i+4]===e&&l.push(n[i+5]>1?w(n,i,this.clusterProps):this.points[n[i+3]])}if(0===l.length)throw Error(r);return l}getLeaves(e,t,i){let r=[];return this._appendLeaves(r,e,t=t||10,i=i||0,0),r}getTile(e,t,i){let r=this.trees[this._limitZoom(e)],a=Math.pow(2,e),{extent:n,radius:s}=this.options,o=s/n,l=(i-o)/a,h=(i+1+o)/a,u={features:[]};return this._addTileFeatures(r.range((t-o)/a,l,(t+1+o)/a,h),r.data,t,i,a,u),0===t&&this._addTileFeatures(r.range(1-o/a,l,1,h),r.data,a,i,a,u),t===a-1&&this._addTileFeatures(r.range(0,l,o/a,h),r.data,-1,i,a,u),u.features.length?u:null}getClusterExpansionZoom(e){let t=this._getOriginZoom(e)-1;for(;t<=this.options.maxZoom;){let i=this.getChildren(e);if(t++,1!==i.length)break;e=i[0].properties.cluster_id}return t}_appendLeaves(e,t,i,r,a){for(let n of this.getChildren(t)){let t=n.properties;if(t&&t.cluster?a+t.point_count<=r?a+=t.point_count:a=this._appendLeaves(e,t.cluster_id,i,r,a):a<r?a++:e.push(n),e.length===i)break}return a}_createTree(t){let i=new e.aI(t.length/this.stride|0,this.options.nodeSize,Float32Array);for(let e=0;e<t.length;e+=this.stride)i.add(t[e],t[e+1]);return i.finish(),i.data=t,i}_addTileFeatures(e,t,i,r,a,n){for(let s of e){let e,o,l,h,u=s*this.stride,c=t[u+5]>1;if(c)e=T(t,u,this.clusterProps),o=t[u],l=t[u+1];else{let i=this.points[t[u+3]];e=i.properties;let[r,a]=i.geometry.coordinates;o=P(r),l=S(a)}let d={type:1,geometry:[[Math.round(this.options.extent*(o*a-i)),Math.round(this.options.extent*(l*a-r))]],tags:e};void 0!==(h=c||this.options.generateId?t[u+3]:this.points[t[u+3]].id)&&(d.id=h),n.features.push(d)}}_limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}_cluster(e,t){let{radius:i,extent:r,reduce:a,minPoints:n}=this.options,s=i/(r*Math.pow(2,t)),o=e.data,l=[],h=this.stride;for(let i=0;i<o.length;i+=h){if(o[i+2]<=t)continue;o[i+2]=t;let r=o[i],u=o[i+1],c=e.within(o[i],o[i+1],s),d=o[i+5],p=d;for(let e of c){let i=e*h;o[i+2]>t&&(p+=o[i+5])}if(p>d&&p>=n){let e,n=r*d,s=u*d,f=-1,m=(i/h<<5)+(t+1)+this.points.length;for(let r of c){let l=r*h;if(o[l+2]<=t)continue;o[l+2]=t;let u=o[l+5];n+=o[l]*u,s+=o[l+1]*u,o[l+4]=m,a&&(e||(e=this._map(o,i,!0),f=this.clusterProps.length,this.clusterProps.push(e)),a(e,this._map(o,l)))}o[i+4]=m,l.push(n/p,s/p,1/0,m,-1,p),a&&l.push(f)}else{for(let e=0;e<h;e++)l.push(o[i+e]);if(p>1)for(let e of c){let i=e*h;if(!(o[i+2]<=t)){o[i+2]=t;for(let e=0;e<h;e++)l.push(o[i+e])}}}}return l}_getOriginId(e){return e-this.points.length>>5}_getOriginZoom(e){return(e-this.points.length)%32}_map(e,t,i){if(e[t+5]>1){let r=this.clusterProps[e[t+6]];return i?Object.assign({},r):r}let r=this.points[e[t+3]].properties,a=this.options.map(r);return i&&a===r?Object.assign({},a):a}}function w(e,t,i){return{type:"Feature",id:e[t+3],properties:T(e,t,i),geometry:{type:"Point",coordinates:[360*(e[t]-.5),360*Math.atan(Math.exp((180-360*e[t+1])*Math.PI/180)
2)/Math.PI-90]}}}function T(e,t,i){let r=e[t+5],a=r>=1e4?`${Math.round(r/1e3)}k`:r>=1e3?Math.round(r/100)/10+"k":r,n=e[t+6];return Object.assign(-1===n?{}:Object.assign({},i[n]),{cluster:!0,cluster_id:e[t+3],point_count:r,point_count_abbreviated:a})}function P(e){return e/360+.5}function S(e){let t=Math.sin(e*Math.PI/180),i=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return i<0?0:i>1?1:i}function M(e,t,i,r){let a={id:null==e?null:e,type:t,geometry:i,tags:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if("Point"===t||"MultiPoint"===t||"LineString"===t)C(a,i);else if("Polygon"===t)C(a,i[0]);else if("MultiLineString"===t)for(let e of i)C(a,e);else if("MultiPolygon"===t)for(let e of i)C(a,e[0]);return a}function C(e,t){for(let i=0;i<t.length;i+=3)e.minX=Math.min(e.minX,t[i]),e.minY=Math.min(e.minY,t[i+1]),e.maxX=Math.max(e.maxX,t[i]),e.maxY=Math.max(e.maxY,t[i+1])}function I(e,t,i,r){if(!t.geometry)return;let a=t.geometry.coordinates;if(a&&0===a.length)return;let n=t.geometry.type,s=Math.pow(i.tolerance/((1<<i.maxZoom)*i.extent),2),o=[],l=t.id;if(i.promoteId?l=t.properties[i.promoteId]:i.generateId&&(l=r||0),"Point"===n)A(a,o);else if("MultiPoint"===n)for(let e of a)A(e,o);else if("LineString"===n)E(a,o,s,!1);else if("MultiLineString"===n){if(i.lineMetrics){for(let i of a)E(i,o=[],s,!1),e.push(M(l,"LineString",o,t.properties));return}z(a,o,s,!1)}else if("Polygon"===n)z(a,o,s,!0);else{if("MultiPolygon"!==n){if("GeometryCollection"===n){for(let a of t.geometry.geometries)I(e,{id:l,geometry:a,properties:t.properties},i,r);return}throw Error("Input data is not a valid GeoJSON object.")}for(let e of a){let t=[];z(e,t,s,!0),o.push(t)}}e.push(M(l,n,o,t.properties))}function A(e,t){t.push(e[0]/360+.5,k(e[1]),0)}function E(e,t,i,r){let a,n,s=0;for(let i=0;i<e.length;i++){let o=e[i][0]/360+.5,l=k(e[i][1]);t.push(o,l,0),i>0&&(s+=r?(a*l-o*n)/2:Math.sqrt(Math.pow(o-a,2)+Math.pow(l-n,2))),a=o,n=l}let o=t.length-3;t[2]=1,function e(t,i,r,a){let n=a,s=i+(r-i>>1),o,l=r-i,h=t[i],u=t[i+1],c=t[r],d=t[r+1];for(let e=i+3;e<r;e+=3){let i=function(e,t,i,r,a,n){let s=a-i,o=n-r;if(0!==s||0!==o){let l=((e-i)*s+(t-r)*o)/(s*s+o*o);l>1?(i=a,r=n):l>0&&(i+=s*l,r+=o*l)}return(s=e-i)*s+(o=t-r)*o}(t[e],t[e+1],h,u,c,d);if(i>n)o=e,n=i;else if(i===n){let t=Math.abs(e-s);t<l&&(o=e,l=t)}}n>a&&(o-i>3&&e(t,i,o,a),t[o+2]=n,r-o>3&&e(t,o,r,a))}(t,0,o,i),t[o+2]=1,t.size=Math.abs(s),t.start=0,t.end=t.size}function z(e,t,i,r){for(let a=0;a<e.length;a++){let n=[];E(e[a],n,i,r),t.push(n)}}function k(e){let t=Math.sin(e*Math.PI/180),i=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return i<0?0:i>1?1:i}function D(e,t,i,r,a,n,s,o){if(r/=t,n>=(i/=t)&&s<r)return e;if(s<i||n>=r)return null;let l=[];for(let t of e){let e=t.geometry,n=t.type,s=0===a?t.minX:t.minY,f=0===a?t.maxX:t.maxY;if(s>=i&&f<r){l.push(t);continue}if(f<i||s>=r)continue;let m=[];if("Point"===n||"MultiPoint"===n){var h=e,u=m,c=i,d=r,p=a;for(let e=0;e<h.length;e+=3){let t=h[e+p];t>=c&&t<=d&&B(u,h[e],h[e+1],h[e+2])}}else if("LineString"===n)R(e,m,i,r,a,!1,o.lineMetrics);else if("MultiLineString"===n)F(e,m,i,r,a,!1);else if("Polygon"===n)F(e,m,i,r,a,!0);else if("MultiPolygon"===n)for(let t of e){let e=[];F(t,e,i,r,a,!0),e.length&&m.push(e)}if(m.length){if(o.lineMetrics&&"LineString"===n){for(let e of m)l.push(M(t.id,n,e,t.tags));continue}"LineString"!==n&&"MultiLineString"!==n||(1===m.length?(n="LineString",m=m[0]):n="MultiLineString"),"Point"!==n&&"MultiPoint"!==n||(n=3===m.length?"Point":"MultiPoint"),l.push(M(t.id,n,m,t.tags))}}return l.length?l:null}function R(e,t,i,r,a,n,s){let o=L(e),l=0===a?O:j,h,u,c=e.start;for(let d=0;d<e.length-3;d+=3){let p=e[d],f=e[d+1],m=e[d+2],_=e[d+3],g=e[d+4],y=0===a?p:f,x=0===a?_:g,v=!1;s&&(h=Math.sqrt(Math.pow(p-_,2)+Math.pow(f-g,2))),y<i?x>i&&(u=l(o,p,f,_,g,i),s&&(o.start=c+h*u)):y>r?x<r&&(u=l(o,p,f,_,g,r),s&&(o.start=c+h*u)):B(o,p,f,m),x<i&&y>=i&&(u=l(o,p,f,_,g,i),v=!0),x>r&&y<=r&&(u=l(o,p,f,_,g,r),v=!0),!n&&v&&(s&&(o.end=c+h*u),t.push(o),o=L(e)),s&&(c+=h)}let d=e.length-3,p=e[d],f=e[d+1],m=0===a?p:f;m>=i&&m<=r&&B(o,p,f,e[d+2]),d=o.length-3,n&&d>=3&&(o[d]!==o[0]||o[d+1]!==o[1])&&B(o,o[0],o[1],o[2]),o.length&&t.push(o)}function L(e){let t=[];return t.size=e.size,t.start=e.start,t.end=e.end,t}function F(e,t,i,r,a,n){for(let s of e)R(s,t,i,r,a,n,!1)}function B(e,t,i,r){e.push(t,i,r)}function O(e,t,i,r,a,n){let s=(n-t)/(r-t);return B(e,n,i+(a-i)*s,1),s}function j(e,t,i,r,a,n){let s=(n-i)/(a-i);return B(e,t+(r-t)*s,n,1),s}function V(e,t){let i=[];for(let r=0;r<e.length;r++){let a,n=e[r],s=n.type;if("Point"===s||"MultiPoint"===s||"LineString"===s)a=U(n.geometry,t);else if("MultiLineString"===s||"Polygon"===s)for(let e of(a=[],n.geometry))a.push(U(e,t));else if("MultiPolygon"===s)for(let e of(a=[],n.geometry)){let i=[];for(let r of e)i.push(U(r,t));a.push(i)}
2i.push(M(n.id,s,a,n.tags))}return i}function U(e,t){let i=[];i.size=e.size,void 0!==e.start&&(i.start=e.start,i.end=e.end);for(let r=0;r<e.length;r+=3)i.push(e[r]+t,e[r+1],e[r+2]);return i}function N(e,t){if(e.transformed)return e;let i=1<<e.z,r=e.x,a=e.y;for(let n of e.features){let e=n.geometry,s=n.type;if(n.geometry=[],1===s)for(let s=0;s<e.length;s+=2)n.geometry.push($(e[s],e[s+1],t,i,r,a));else for(let s=0;s<e.length;s++){let o=[];for(let n=0;n<e[s].length;n+=2)o.push($(e[s][n],e[s][n+1],t,i,r,a));n.geometry.push(o)}}return e.transformed=!0,e}function $(e,t,i,r,a,n){return[Math.round(i*(e*r-a)),Math.round(i*(t*r-n))]}function Z(e,t,i,r,a,n){let s=r*r;if(r>0&&t.size<(a?s:r))return void(i.numPoints+=t.length/3);let o=[];for(let e=0;e<t.length;e+=3)(0===r||t[e+2]>s)&&(i.numSimplified++,o.push(t[e],t[e+1])),i.numPoints++;a&&function(e,t){let i=0;for(let t=0,r=e.length,a=r-2;t<r;a=t,t+=2)i+=(e[t]-e[a])*(e[t+1]+e[a+1]);if(i>0===t)for(let t=0,i=e.length;t<i/2;t+=2){let r=e[t],a=e[t+1];e[t]=e[i-2-t],e[t+1]=e[i-1-t],e[i-2-t]=r,e[i-1-t]=a}}(o,n),e.push(o)}let G={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class q{constructor(e,t){const i=(t=this.options=function(e,t){for(let i in t)e[i]=t[i];return e}(Object.create(G),t)).debug;if(i&&console.time("preprocess data"),t.maxZoom<0||t.maxZoom>24)throw Error("maxZoom should be in the 0-24 range");if(t.promoteId&&t.generateId)throw Error("promoteId and generateId cannot be used together.");let r=function(e,t){let i=[];if("FeatureCollection"===e.type)for(let r=0;r<e.features.length;r++)I(i,e.features[r],t,r);else I(i,"Feature"===e.type?e:{geometry:e},t);return i}(e,t);this.tiles={},this.tileCoords=[],i&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",t.indexMaxZoom,t.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),(r=function(e,t){let i=t.buffer/t.extent,r=e,a=D(e,1,-1-i,i,0,-1,2,t),n=D(e,1,1-i,2+i,0,-1,2,t);return(a||n)&&(r=D(e,1,-i,1+i,0,-1,2,t)||[],a&&(r=V(a,1).concat(r)),n&&(r=r.concat(V(n,-1)))),r}(r,t)).length&&this.splitTile(r,0,0,0),i&&(r.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(e,t,i,r,a,n,s){let o=[e,t,i,r],l=this.options,h=l.debug;for(;o.length;){r=o.pop(),i=o.pop(),t=o.pop(),e=o.pop();let u=1<<t,c=W(t,i,r),d=this.tiles[c];if(!d&&(h>1&&console.time("creation"),d=this.tiles[c]=function(e,t,i,r,a){let n=t===a.maxZoom?0:a.tolerance/((1<<t)*a.extent),s={features:[],numPoints:0,numSimplified:0,numFeatures:e.length,source:null,x:i,y:r,z:t,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(let t of e)!function(e,t,i,r){let a=t.geometry,n=t.type,s=[];if(e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),"Point"===n||"MultiPoint"===n)for(let t=0;t<a.length;t+=3)s.push(a[t],a[t+1]),e.numPoints++,e.numSimplified++;else if("LineString"===n)Z(s,a,e,i,!1,!1);else if("MultiLineString"===n||"Polygon"===n)for(let t=0;t<a.length;t++)Z(s,a[t],e,i,"Polygon"===n,0===t);else if("MultiPolygon"===n)for(let t=0;t<a.length;t++){let r=a[t];for(let t=0;t<r.length;t++)Z(s,r[t],e,i,!0,0===t)}if(s.length){let i=t.tags||null;if("LineString"===n&&r.lineMetrics){for(let e in i={},t.tags)i[e]=t.tags[e];i.mapbox_clip_start=a.start/a.size,i.mapbox_clip_end=a.end/a.size}let o={geometry:s,type:"Polygon"===n||"MultiPolygon"===n?3:"LineString"===n||"MultiLineString"===n?2:1,tags:i};null!==t.id&&(o.id=t.id),e.features.push(o)}}(s,t,n,a);return s}(e,t,i,r,l),this.tileCoords.push({z:t,x:i,y:r}),h)){h>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",t,i,r,d.numFeatures,d.numPoints,d.numSimplified),console.timeEnd("creation"));let e=`z${t}`;this.stats[e]=(this.stats[e]||0)+1,this.total++}if(d.source=e,null==a){if(t===l.indexMaxZoom||d.numPoints<=l.indexMaxPoints)continue}else{if(t===l.maxZoom||t===a)continue;if(null!=a){let e=a-t;if(i!==n>>e||r!==s>>e)continue}}if(d.source=null,0===e.length)continue;h>1&&console.time("clipping");let p=.5*l.buffer/l.extent,f=.5-p,m=.5+p,_=1+p,g=null,y=null,x=null,v=null,b=D(e,u,i-p,i+m,0,d.minX,d.maxX,l),w=D(e,u,i+f,i+_,0,d.minX,d.maxX,l);e=null,b&&(g=D(b,u,r-p,r+m,1,d.minY,d.maxY,l),y=D(b,u,r+f,r+_,1,d.minY,d.maxY,l),b=null),w&&(x=D(w,u,r-p,r+m,1,d.minY,d.maxY,l),v=D(w,u,r+f,r+_,1,d.minY,d.maxY,l),w=null),h>1&&console.timeEnd("clipping"),o.push(g||[],t+1,2*i,2*r),o.push(y||[],t+1,2*i,2*r+1),o.push(x||[],t+1,2*i+1,2*r),o.push(v||[],t+1,2*i+1,2*r+1)}}getTile(e,t,i){e*=1,t*=1,i*=1;let{extent:r,debug:a}=this.options;if(e<0||e>24)return null;let n=1<<e,s=W(e,t=t+n&n-1,i);if(this.tiles[s])return N(this.tiles[s],r);a>1&&console.log("drilling down to z%d-%d-%d",e,t,i);let o,l=e,h=t,u=i;for(;!o&&l>0;)l--,h>>=1,u>>=1,o=this.tiles[W(l,h,u)];return o&&o.source?(a>1&&(console.log("found parent tile z%d-%d-%d",l,h,u),console.time("drilling down")),this.splitTile(o.source,l,h,u,e,t,i),a>1&&console.timeEnd("drilling down"),this.tiles[s]?N(this.tiles[s],r):null):null}}function W(e,t,i){return 32*((1<<e)*i+t)+e}class H extends n{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(t,i){return e._(this,void 0,void 0,function*(){let i,r=t.tileID.canonical;if(!this._geoJSONIndex)throw Error("Unable to parse the data into a cluster or geojson");let a=this._geoJSONIndex.getTile(r.z,r.x,r.y);if(!a)return null;let n=new p(a.features,{version:2,extent:e.$}),s=(function(e,t){for(let i in e.layers)t.writeMessage(3,f,e.layers[i])}(n,i=new e.cM),i.finish());return 0===s.byteOffset&&s.byteLength===s.buffer.byteLength||(s=new Uint8Array(s)),{vectorTile:n,rawData:s.buffer}})}loadData(t){return e._(this,void 0,void 0,function*(){var i,r;
2null==(i=this._pendingRequest)||i.abort();let a=!!(t&&t.request&&t.request.collectResourceTiming)&&new e.cN(t.request);this._pendingRequest=new AbortController;try{this._pendingData=this.loadAndProcessGeoJSON(t,this._pendingRequest);let i=yield this._pendingData;this._geoJSONIndex=t.cluster?new b(function({superclusterOptions:t,clusterProperties:i}){if(!i||!t)return t;let r={},a={},n={accumulated:null,zoom:0},s={properties:null},o=Object.keys(i);for(let t of o){let[n,s]=i[t],o=e.cT(s),l=e.cT("string"==typeof n?[n,["accumulated"],["get",t]]:n);r[t]=o.value,a[t]=l.value}return t.map=e=>{s.properties=e;let t={};for(let e of o)t[e]=r[e].evaluate(n,s);return t},t.reduce=(e,t)=>{for(let i of(s.properties=t,o))n.accumulated=e[i],e[i]=a[i].evaluate(n,s)},t}(t)).load(i.features):(r=t.geojsonVtOptions,new q(i,r)),this.loaded={};let n={data:i};if(a){let e=a.finish();e&&(n.resourceTiming={},n.resourceTiming[t.source]=JSON.parse(JSON.stringify(e)))}return n}catch(t){if(delete this._pendingRequest,e.cy(t))return{abandoned:!0};throw t}})}getData(){return e._(this,void 0,void 0,function*(){return this._pendingData})}reloadTile(e){let t=this.loaded;return t&&t[e.uid]?super.reloadTile(e):this.loadTile(e)}loadAndProcessGeoJSON(t,i){return e._(this,void 0,void 0,function*(){let r=yield this.loadGeoJSON(t,i);if(delete this._pendingRequest,"object"!=typeof r)throw Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`);if(c(r,!0),t.filter){let i=e.cT(t.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===i.result)throw Error(i.value.map(e=>`${e.key}: ${e.message}`).join(", "));r={type:"FeatureCollection",features:r.features.filter(e=>i.value.evaluate({zoom:0},e))}}return r})}loadGeoJSON(t,i){return e._(this,void 0,void 0,function*(){let{promoteId:r}=t;if(t.request){let a=yield e.j(t.request,i);return this._dataUpdateable=e.cV(a.data,r)?e.cU(a.data,r):void 0,a.data}if("string"==typeof t.data)try{let i=JSON.parse(t.data);return this._dataUpdateable=e.cV(i,r)?e.cU(i,r):void 0,i}catch(e){throw Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`)}if(!t.dataDiff)throw Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw Error(`Cannot update existing geojson data in ${t.source}`);return e.cW(this._dataUpdateable,t.dataDiff,r),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(t){return e._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(e){return this._geoJSONIndex.getClusterExpansionZoom(e.clusterId)}getClusterChildren(e){return this._geoJSONIndex.getChildren(e.clusterId)}getClusterLeaves(e){return this._geoJSONIndex.getLeaves(e.clusterId,e.limit,e.offset)}}class X{constructor(t){this.self=t,this.actor=new e.J(t),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(e,t)=>{if(this.externalWorkerSourceTypes[e])throw Error(`Worker source with name "${e}" already registered.`);this.externalWorkerSourceTypes[e]=t},this.self.addProtocol=e.cA,this.self.removeProtocol=e.cB,this.self.registerRTLTextPlugin=t=>{e.cX.setMethods(t)},this.actor.registerMessageHandler("LDT",(e,t)=>this._getDEMWorkerSource(e,t.source).loadTile(t)),this.actor.registerMessageHandler("RDT",(t,i)=>e._(this,void 0,void 0,function*(){this._getDEMWorkerSource(t,i.source).removeTile(i)})),this.actor.registerMessageHandler("GCEZ",(t,i)=>e._(this,void 0,void 0,function*(){return this._getWorkerSource(t,i.type,i.source).getClusterExpansionZoom(i)})),this.actor.registerMessageHandler("GCC",(t,i)=>e._(this,void 0,void 0,function*(){return this._getWorkerSource(t,i.type,i.source).getClusterChildren(i)})),this.actor.registerMessageHandler("GCL",(t,i)=>e._(this,void 0,void 0,function*(){return this._getWorkerSource(t,i.type,i.source).getClusterLeaves(i)})),this.actor.registerMessageHandler("LD",(e,t)=>this._getWorkerSource(e,t.type,t.source).loadData(t)),this.actor.registerMessageHandler("GD",(e,t)=>this._getWorkerSource(e,t.type,t.source).getData()),this.actor.registerMessageHandler("LT",(e,t)=>this._getWorkerSource(e,t.type,t.source).loadTile(t)),this.actor.registerMessageHandler("RT",(e,t)=>this._getWorkerSource(e,t.type,t.source).reloadTile(t)),this.actor.registerMessageHandler("AT",(e,t)=>this._getWorkerSource(e,t.type,t.source).abortTile(t)),this.actor.registerMessageHandler("RMT",(e,t)=>this._getWorkerSource(e,t.type,t.source).removeTile(t)),this.actor.registerMessageHandler("RS",(t,i)=>e._(this,void 0,void 0,function*(){if(!this.workerSources[t]||!this.workerSources[t][i.type]||!this.workerSources[t][i.type][i.source])return;let e=this.workerSources[t][i.type][i.source];delete this.workerSources[t][i.type][i.source],void 0!==e.removeSource&&e.removeSource(i)})),this.actor.registerMessageHandler("RM",t=>e._(this,void 0,void 0,function*(){delete this.layerIndexes[t],delete this.availableImages[t],delete this.workerSources[t],delete this.demWorkerSources[t]})),this.actor.registerMessageHandler("SR",(t,i)=>e._(this,void 0,void 0,function*(){this.referrer=i})),this.actor.registerMessageHandler("SRPS",(e,t)=>this._syncRTLPluginState(e,t)),this.actor.registerMessageHandler("IS",(t,i)=>e._(this,void 0,void 0,function*(){this.self.importScripts(i)})),this.actor.registerMessageHandler("SI",(e,t)=>this._setImages(e,t)),this.actor.registerMessageHandler("UL",(t,i)=>e._(this,void 0,void 0,function*(){this._getLayerIndex(t).update(i.layers,i.removedIds)})),this.actor.registerMessageHandler("SL",(t,i)=>e._(this,void 0,void 0,function*(){this._getLayerIndex(t).replace(i)}))}_setImages(t,i){return e._(this,void 0,void 0,function*(){for(let e in this.availableImages[t]=i,this.workerSources[t]){let r=this.workerSources[t][e];for(let e in r)r[e].availableImages=i}})}_syncRTLPluginState(t,i){return e._(this,void 0,void 0,function*(){return yield e.cX.syncState(i,this.self.importScripts)})}_getAvailableImages(e){let t=this.availableImages[e];return t||(t=[]),t}_getLayerIndex(e){let i=this.layerIndexes[e];
2return i||(i=this.layerIndexes[e]=new t),i}_getWorkerSource(e,t,i){if(this.workerSources[e]||(this.workerSources[e]={}),this.workerSources[e][t]||(this.workerSources[e][t]={}),!this.workerSources[e][t][i]){let r={sendAsync:(t,i)=>(t.targetMapId=e,this.actor.sendAsync(t,i))};switch(t){case"vector":this.workerSources[e][t][i]=new n(r,this._getLayerIndex(e),this._getAvailableImages(e));break;case"geojson":this.workerSources[e][t][i]=new H(r,this._getLayerIndex(e),this._getAvailableImages(e));break;default:this.workerSources[e][t][i]=new this.externalWorkerSourceTypes[t](r,this._getLayerIndex(e),this._getAvailableImages(e))}}return this.workerSources[e][t][i]}_getDEMWorkerSource(e,t){return this.demWorkerSources[e]||(this.demWorkerSources[e]={}),this.demWorkerSources[e][t]||(this.demWorkerSources[e][t]=new s),this.demWorkerSources[e][t]}}return e.i(self)&&(self.worker=new X(self)),X}),i("index",["exports","./shared"],function(e,t){let i,r,a,n,s,o,l;var h,u="5.6.2";function c(){var e=new t.A(4);return t.A!=Float32Array&&(e[1]=0,e[2]=0),e[0]=1,e[3]=1,e}let d={now:"u">typeof performance&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frame(e,i,r){let a=requestAnimationFrame(e=>{n(),i(e)}),{unsubscribe:n}=t.s(e.signal,"abort",()=>{n(),cancelAnimationFrame(a),r(t.c())},!1)},frameAsync(e){return new Promise((t,i)=>{this.frame(e,t,i)})},getImageData(e,t=0){return this.getImageCanvasContext(e).getImageData(-t,-t,e.width+2*t,e.height+2*t)},getImageCanvasContext(e){let t=window.document.createElement("canvas"),i=t.getContext("2d",{willReadFrequently:!0});if(!i)throw Error("failed to create canvas 2d context");return t.width=e.width,t.height=e.height,i.drawImage(e,0,0,e.width,e.height),i},resolveURL:e=>(i||(i=document.createElement("a")),i.href=e,i.href),hardwareConcurrency:"u">typeof navigator&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(null==r&&(r=matchMedia("(prefers-reduced-motion: reduce)")),r.matches)}};class p{static testProp(e){if(!p.docStyle)return e[0];for(let t=0;t<e.length;t++)if(e[t]in p.docStyle)return e[t];return e[0]}static create(e,t,i){let r=window.document.createElement(e);return void 0!==t&&(r.className=t),i&&i.appendChild(r),r}static createNS(e,t){return window.document.createElementNS(e,t)}static disableDrag(){p.docStyle&&p.selectProp&&(p.userSelect=p.docStyle[p.selectProp],p.docStyle[p.selectProp]="none")}static enableDrag(){p.docStyle&&p.selectProp&&(p.docStyle[p.selectProp]=p.userSelect)}static setTransform(e,t){e.style[p.transformProp]=t}static addEventListener(e,t,i,r={}){e.addEventListener(t,i,"passive"in r?r:r.capture)}static removeEventListener(e,t,i,r={}){e.removeEventListener(t,i,"passive"in r?r:r.capture)}static suppressClickInternal(e){e.preventDefault(),e.stopPropagation(),window.removeEventListener("click",p.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",p.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",p.suppressClickInternal,!0)},0)}static getScale(e){let t=e.getBoundingClientRect();return{x:t.width/e.offsetWidth||1,y:t.height/e.offsetHeight||1,boundingClientRect:t}}static getPoint(e,i,r){let a=i.boundingClientRect;return new t.P((r.clientX-a.left)/i.x-e.clientLeft,(r.clientY-a.top)/i.y-e.clientTop)}static mousePos(e,t){let i=p.getScale(e);return p.getPoint(e,i,t)}static touchPos(e,t){let i=[],r=p.getScale(e);for(let a=0;a<t.length;a++)i.push(p.getPoint(e,r,t[a]));return i}static mouseButton(e){return e.button}static remove(e){e.parentNode&&e.parentNode.removeChild(e)}static sanitize(e){let t=(new DOMParser).parseFromString(e,"text/html").body||document.createElement("body");for(let e of t.querySelectorAll("script"))e.remove();return p.clean(t),t.innerHTML}static isPossiblyDangerous(e,t){let i=t.replace(/\s+/g,"").toLowerCase();return!(!["src","href","xlink:href"].includes(e)||!i.includes("javascript:")&&!i.includes("data:"))||!!e.startsWith("on")||void 0}static clean(e){for(let t of e.children)p.removeAttributes(t),p.clean(t)}static removeAttributes(e){for(let{name:t,value:i}of e.attributes)p.isPossiblyDangerous(t,i)&&e.removeAttribute(t)}}p.docStyle="u">typeof window&&window.document&&window.document.documentElement.style,p.selectProp=p.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),p.transformProp=p.testProp(["transform","WebkitTransform"]);
2let f={supported:!1,testSupport:function(e){!g&&_&&(y?x(e):m=e)}},m,_,g=!1,y=!1;function x(e){let t=e.createTexture();e.bindTexture(e.TEXTURE_2D,t);try{if(e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,_),e.isContextLost())return;f.supported=!0}catch(e){}e.deleteTexture(t),g=!0}"u">typeof document&&((_=document.createElement("img")).onload=()=>{m&&x(m),m=null,y=!0},_.onerror=()=>{g=!0,m=null},_.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(e){let i,r,a,n;e.resetRequestQueue=()=>{i=[],r=0,a=0,n={}},e.addThrottleControl=e=>{let t=a++;return n[t]=e,t},e.removeThrottleControl=e=>{delete n[e],o()},e.getImage=(e,r,a=!0)=>new Promise((n,s)=>{f.supported&&(e.headers||(e.headers={}),e.headers.accept="image/webp,*/*"),t.e(e,{type:"image"}),i.push({abortController:r,requestParameters:e,supportImageRefresh:a,state:"queued",onError:e=>{s(e)},onSuccess:e=>{n(e)}}),o()});let s=e=>t._(this,void 0,void 0,function*(){var i;e.state="running";let{requestParameters:a,supportImageRefresh:n,onError:s,onSuccess:h,abortController:u}=e,c=!1===n&&!t.i(self)&&!t.g(a.url)&&(!a.headers||Object.keys(a.headers).reduce((e,t)=>e&&"accept"===t,!0));r++;let d=c?l(a,u):t.m(a,u);try{let r=yield d;delete e.abortController,e.state="completed",r.data instanceof HTMLImageElement||t.b(r.data)?h(r):r.data&&h({data:yield(i=r.data,"function"==typeof createImageBitmap?t.f(i):t.h(i)),cacheControl:r.cacheControl,expires:r.expires})}catch(t){delete e.abortController,s(t)}finally{r--,o()}}),o=()=>{let e=(()=>{for(let e of Object.keys(n))if(n[e]())return!0;return!1})()?t.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:t.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let t=r;t<e&&i.length>0;t++){let e=i.shift();e.abortController.signal.aborted?t--:s(e)}},l=(e,i)=>new Promise((r,a)=>{let n=new Image,s=e.url,o=e.credentials;o&&"include"===o?n.crossOrigin="use-credentials":(o&&"same-origin"===o||!t.d(s))&&(n.crossOrigin="anonymous"),i.signal.addEventListener("abort",()=>{n.src="",a(t.c())}),n.fetchPriority="high",n.onload=()=>{n.onerror=n.onload=null,r({data:n})},n.onerror=()=>{n.onerror=n.onload=null,i.signal.aborted||a(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."))},n.src=s})}(h||(h={})),h.resetRequestQueue();class v{constructor(e){this._transformRequestFn=null!=e?e:null}transformRequest(e,t){return this._transformRequestFn&&this._transformRequestFn(e,t)||{url:e}}setTransformRequest(e){this._transformRequestFn=e}}function b(e){let t=[];if("string"==typeof e)t.push({id:"default",url:e});else if(e&&e.length>0){let i=[];for(let{id:r,url:a}of e){let e=`${r}${a}`;-1===i.indexOf(e)&&(i.push(e),t.push({id:r,url:a}))}}return t}function w(e,t,i){try{let r=new URL(e);return r.pathname+=`${t}${i}`,r.toString()}catch(t){throw Error(`Invalid sprite URL "${e}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}class T extends t.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new t.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(let{ids:e,promiseResolve:t}of this.requestors)t(this._getImagesForIds(e));this.requestors=[]}}getImage(e){let i=this.images[e];if(i&&!i.data&&i.spriteData){let e=i.spriteData;i.data=new t.R({width:e.width,height:e.height},e.context.getImageData(e.x,e.y,e.width,e.height).data),i.spriteData=null}return i}addImage(e,t){if(this.images[e])throw Error(`Image id ${e} already exist, use updateImage instead`);this._validate(e,t)&&(this.images[e]=t)}_validate(e,i){let r=!0,a=i.data||i.spriteData;return this._validateStretch(i.stretchX,a&&a.width)||(this.fire(new t.k(Error(`Image "${e}" has invalid "stretchX" value`))),r=!1),this._validateStretch(i.stretchY,a&&a.height)||(this.fire(new t.k(Error(`Image "${e}" has invalid "stretchY" value`))),r=!1),this._validateContent(i.content,i)||(this.fire(new t.k(Error(`Image "${e}
2" has invalid "content" value`))),r=!1),r}_validateStretch(e,t){if(!e)return!0;let i=0;for(let r of e){if(r[0]<i||r[1]<r[0]||t<r[1])return!1;i=r[1]}return!0}_validateContent(e,t){if(!e)return!0;if(4!==e.length)return!1;let i=t.spriteData,r=i&&i.width||t.data.width,a=i&&i.height||t.data.height;return!(e[0]<0||r<e[0]||e[1]<0||a<e[1]||e[2]<0||r<e[2]||e[3]<0||a<e[3]||e[2]<e[0]||e[3]<e[1])}updateImage(e,t,i=!0){let r=this.getImage(e);if(i&&(r.data.width!==t.data.width||r.data.height!==t.data.height))throw Error(`size mismatch between old image (${r.data.width}x${r.data.height}) and new image (${t.data.width}x${t.data.height}).`);t.version=r.version+1,this.images[e]=t,this.updatedImages[e]=!0}removeImage(e){let t=this.images[e];delete this.images[e],delete this.patterns[e],t.userImage&&t.userImage.onRemove&&t.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(e){return new Promise((t,i)=>{let r=!0;if(!this.isLoaded())for(let t of e)this.images[t]||(r=!1);this.isLoaded()||r?t(this._getImagesForIds(e)):this.requestors.push({ids:e,promiseResolve:t})})}_getImagesForIds(e){let i={};for(let r of e){let e=this.getImage(r);e||(this.fire(new t.l("styleimagemissing",{id:r})),e=this.getImage(r)),e?i[r]={data:e.data.clone(),pixelRatio:e.pixelRatio,sdf:e.sdf,version:e.version,stretchX:e.stretchX,stretchY:e.stretchY,content:e.content,textFitWidth:e.textFitWidth,textFitHeight:e.textFitHeight,hasRenderCallback:!!(e.userImage&&e.userImage.render)}:t.w(`Image "${r}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}return i}getPixelSize(){let{width:e,height:t}=this.atlasImage;return{width:e,height:t}}getPattern(e){let i=this.patterns[e],r=this.getImage(e);if(!r)return null;if(i&&i.position.version===r.version)return i.position;if(i)i.position.version=r.version;else{let i={w:r.data.width+2,h:r.data.height+2,x:0,y:0},a=new t.I(i,r);this.patterns[e]={bin:i,position:a}}return this._updatePatternAtlas(),this.patterns[e].position}bind(e){let i=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new t.T(e,this.atlasImage,i.RGBA),this.atlasTexture.bind(i.LINEAR,i.CLAMP_TO_EDGE)}_updatePatternAtlas(){let e=[];for(let t in this.patterns)e.push(this.patterns[t].bin);let{w:i,h:r}=t.p(e),a=this.atlasImage;for(let e in a.resize({width:i||1,height:r||1}),this.patterns){let{bin:i}=this.patterns[e],r=i.x+1,n=i.y+1,s=this.getImage(e).data,o=s.width,l=s.height;t.R.copy(s,a,{x:0,y:0},{x:r,y:n},{width:o,height:l}),t.R.copy(s,a,{x:0,y:l-1},{x:r,y:n-1},{width:o,height:1}),t.R.copy(s,a,{x:0,y:0},{x:r,y:n+l},{width:o,height:1}),t.R.copy(s,a,{x:o-1,y:0},{x:r-1,y:n},{width:1,height:l}),t.R.copy(s,a,{x:0,y:0},{x:r+o,y:n},{width:1,height:l})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(let i of e){if(this.callbackDispatchedThisFrame[i])continue;this.callbackDispatchedThisFrame[i]=!0;let e=this.getImage(i);e||t.w(`Image with ID: "${i}" was not found`),function(e){let{userImage:t}=e;return!!(t&&t.render&&t.render())&&(e.data.replace(new Uint8Array(t.data.buffer)),!0)}(e)&&this.updateImage(i,e)}}}function P(e,t,i,r,a,n,s,o,l){for(let h=t;h<t+r;h++)S(e,i*n+h,n,a,s,o,l);for(let h=i;h<i+a;h++)S(e,h*n+t,1,r,s,o,l)}function S(e,t,i,r,a,n,s){n[0]=0,s[0]=-1e20,s[1]=1e20,a[0]=e[t];for(let o=1,l=0,h=0;o<r;o++){a[o]=e[t+o*i];let r=o*o;do{let e=n[l];h=(a[o]-a[e]+r-e*e)/(o-e)/2}while(h<=s[l]&&--l>-1);n[++l]=o,s[l]=h,s[l+1]=1e20}for(let o=0,l=0;o<r;o++){for(;s[l+1]<o;)l++;let r=n[l],h=o-r;e[t+o*i]=a[r]+h*h}}class M{constructor(e,t){this.requestManager=e,this.localIdeographFontFamily=t,this.entries={}}setURL(e){this.url=e}getGlyphs(e){return t._(this,void 0,void 0,function*(){let t=[];for(let i in e)for(let r of e[i])t.push(this._getAndCacheGlyphsPromise(i,r));let i=yield Promise.all(t),r={};for(let{stack:e,id:t,glyph:a}of i)r[e]||(r[e]={}),r[e][t]=a&&{id:a.id,bitmap:a.bitmap.clone(),metrics:a.metrics};return r})}
2_getAndCacheGlyphsPromise(e,i){return t._(this,void 0,void 0,function*(){let t=this.entries[e];t||(t=this.entries[e]={glyphs:{},requests:{},ranges:{}});let r=t.glyphs[i];if(void 0!==r)return{stack:e,id:i,glyph:r};if(r=this._tinySDF(t,e,i))return t.glyphs[i]=r,{stack:e,id:i,glyph:r};let a=Math.floor(i/256);if(256*a>65535)throw Error("glyphs > 65535 not supported");if(t.ranges[a])return{stack:e,id:i,glyph:r};if(!this.url)throw Error("glyphsUrl is not set");if(!t.requests[a]){let i=M.loadGlyphRange(e,a,this.url,this.requestManager);t.requests[a]=i}let n=yield t.requests[a];for(let e in n)this._doesCharSupportLocalGlyph(+e)||(t.glyphs[+e]=n[+e]);return t.ranges[a]=!0,{stack:e,id:i,glyph:n[i]||null}})}_doesCharSupportLocalGlyph(e){return!!this.localIdeographFontFamily&&(/\p{Ideo}|\p{sc=Hang}|\p{sc=Hira}|\p{sc=Kana}/u.test(String.fromCodePoint(e))||t.u["CJK Unified Ideographs"](e)||t.u["Hangul Syllables"](e)||t.u.Hiragana(e)||t.u.Katakana(e)||t.u["CJK Symbols and Punctuation"](e)||t.u["Halfwidth and Fullwidth Forms"](e))}_tinySDF(e,i,r){let a=this.localIdeographFontFamily;if(!a||!this._doesCharSupportLocalGlyph(r))return;let n=e.tinySDF;if(!n){let t="400";/bold/i.test(i)?t="900":/medium/i.test(i)?t="500":/light/i.test(i)&&(t="200"),n=e.tinySDF=new M.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:a,fontWeight:t})}let s=n.draw(String.fromCharCode(r));return{id:r,bitmap:new t.q({width:s.width||60,height:s.height||60},s.data),metrics:{width:s.glyphWidth/2||24,height:s.glyphHeight/2||24,left:s.glyphLeft/2+.5||0,top:s.glyphTop/2-27.5||-8,advance:s.glyphAdvance/2||24,isDoubleResolution:!0}}}}M.loadGlyphRange=function(e,i,r,a){return t._(this,void 0,void 0,function*(){let n=256*i,s=n+255,o=a.transformRequest(r.replace("{fontstack}",e).replace("{range}",`${n}-${s}`),"Glyphs"),l=yield t.n(o,new AbortController);if(!l||!l.data)throw Error(`Could not load glyph range. range: ${i}, ${n}-${s}`);let h={};for(let e of t.o(l.data))h[e.id]=e;return h})},M.TinySDF=class{constructor({fontSize:e=24,buffer:t=3,radius:i=8,cutoff:r=.25,fontFamily:a="sans-serif",fontWeight:n="normal",fontStyle:s="normal",lang:o=null}={}){this.buffer=t,this.cutoff=r,this.radius=i,this.lang=o;const l=this.size=e+4*t,h=this._createCanvas(l),u=this.ctx=h.getContext("2d",{willReadFrequently:!0});u.font=`${s} ${n} ${e}px ${a}`,u.textBaseline="alphabetic",u.textAlign="left",u.fillStyle="black",this.gridOuter=new Float64Array(l*l),this.gridInner=new Float64Array(l*l),this.f=new Float64Array(l),this.z=new Float64Array(l+1),this.v=new Uint16Array(l)}_createCanvas(e){let t=document.createElement("canvas");return t.width=t.height=e,t}draw(e){let{width:t,actualBoundingBoxAscent:i,actualBoundingBoxDescent:r,actualBoundingBoxLeft:a,actualBoundingBoxRight:n}=this.ctx.measureText(e),s=Math.ceil(i),o=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(n-a))),l=Math.min(this.size-this.buffer,s+Math.ceil(r)),h=o+2*this.buffer,u=l+2*this.buffer,c=Math.max(h*u,0),d=new Uint8ClampedArray(c),p={data:d,width:h,height:u,glyphWidth:o,glyphHeight:l,glyphTop:s,glyphLeft:0,glyphAdvance:t};if(0===o||0===l)return p;let{ctx:f,buffer:m,gridInner:_,gridOuter:g}=this;this.lang&&(f.lang=this.lang),f.clearRect(m,m,o,l),f.fillText(e,m,m+s);let y=f.getImageData(m,m,o,l);g.fill(1e20,0,c),_.fill(0,0,c);for(let e=0;e<l;e++)for(let t=0;t<o;t++){let i=y.data[4*(e*o+t)+3]/255;if(0===i)continue;let r=(e+m)*h+t+m;if(1===i)g[r]=0,_[r]=1e20;else{let e=.5-i;g[r]=e>0?e*e:0,_[r]=e<0?e*e:0}}P(g,0,0,h,u,h,this.f,this.v,this.z),P(_,m,m,o,l,h,this.f,this.v,this.z);for(let e=0;e<c;e++){let t=Math.sqrt(g[e])-Math.sqrt(_[e]);d[e]=Math.round(255-255*(t/this.radius+this.cutoff))}return p}};class C{constructor(){this.specification=t.v.light.position}possiblyEvaluate(e,i){return t.B(e.expression.evaluate(i))}interpolate(e,i,r){return{x:t.C.number(e.x,i.x,r),y:t.C.number(e.y,i.y,r),z:t.C.number(e.z,i.z,r)}}}class I extends t.E{constructor(e){super(),a=a||new t.r({anchor:new t.D(t.v.light.anchor),position:new C,color:new t.D(t.v.light.color),intensity:new t.D(t.v.light.intensity)}),this._transitionable=new t.t(a),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,i={}
2){if(!this._validate(t.x,e,i))for(let t in e){let i=e[t];t.endsWith("-transition")?this._transitionable.setTransition(t.slice(0,-11),i):this._transitionable.setValue(t,i)}}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,i,r){return(!r||!1!==r.validate)&&t.y(this,e.call(t.z,{value:i,style:{glyphs:!0,sprite:!0},styleSpec:t.v}))}}let A=new t.r({"sky-color":new t.D(t.v.sky["sky-color"]),"horizon-color":new t.D(t.v.sky["horizon-color"]),"fog-color":new t.D(t.v.sky["fog-color"]),"fog-ground-blend":new t.D(t.v.sky["fog-ground-blend"]),"horizon-fog-blend":new t.D(t.v.sky["horizon-fog-blend"]),"sky-horizon-blend":new t.D(t.v.sky["sky-horizon-blend"]),"atmosphere-blend":new t.D(t.v.sky["atmosphere-blend"])});class E extends t.E{constructor(e){super(),this._transitionable=new t.t(A),this.setSky(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new t.F(0))}setSky(e,i={}){if(!this._validate(t.G,e,i))for(let t in e||(e={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0}),e){let i=e[t];t.endsWith("-transition")?this._transitionable.setTransition(t.slice(0,-11),i):this._transitionable.setValue(t,i)}}getSky(){return this._transitionable.serialize()}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,i,r={}){return!1!==(null==r?void 0:r.validate)&&t.y(this,e.call(t.z,t.e({value:i,style:{glyphs:!0,sprite:!0},styleSpec:t.v})))}calculateFogBlendOpacity(e){return e<60?0:e<70?(e-60)/10:1}}class z{constructor(e,t){this.width=e,this.height=t,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(e,t){let i=e.join(",")+String(t);return this.dashEntry[i]||(this.dashEntry[i]=this.addDash(e,t)),this.dashEntry[i]}getDashRanges(e,t,i){let r=[],a=e.length%2==1?-e[e.length-1]*i:0,n=e[0]*i,s=!0;r.push({left:a,right:n,isDash:s,zeroLength:0===e[0]});let o=e[0];for(let t=1;t<e.length;t++){s=!s;let l=e[t];a=o*i,o+=l,n=o*i,r.push({left:a,right:n,isDash:s,zeroLength:0===l})}return r}addRoundDash(e,t,i){let r=t/2;for(let t=-i;t<=i;t++){let a=this.width*(this.nextRow+i+t),n=0,s=e[0];for(let o=0;o<this.width;o++){let l;o/s.right>1&&(s=e[++n]);let h=Math.min(Math.abs(o-s.left),Math.abs(o-s.right)),u=t/i*(r+1);if(s.isDash){let e=r-Math.abs(u);l=Math.sqrt(h*h+e*e)}else l=r-Math.sqrt(h*h+u*u);this.data[a+o]=Math.max(0,Math.min(255,l+128))}}}addRegularDash(e){for(let t=e.length-1;t>=0;--t){let i=e[t],r=e[t+1];i.zeroLength?e.splice(t,1):r&&r.isDash===i.isDash&&(r.left=i.left,e.splice(t,1))}let t=e[0],i=e[e.length-1];t.isDash===i.isDash&&(t.left=i.left-this.width,i.right=t.right+this.width);let r=this.width*this.nextRow,a=0,n=e[0];for(let t=0;t<this.width;t++){t/n.right>1&&(n=e[++a]);let i=Math.min(Math.abs(t-n.left),Math.abs(t-n.right));this.data[r+t]=Math.max(0,Math.min(255,(n.isDash?i:-i)+128))}}addDash(e,i){let r=7*!!i,a=2*r+1;if(this.nextRow+a>this.height)return t.w("LineAtlas out of space"),null;let n=0;for(let t=0;t<e.length;t++)n+=e[t];if(0!==n){let t=this.width/n,a=this.getDashRanges(e,this.width,t);i?this.addRoundDash(a,t,r):this.addRegularDash(a)}let s={y:(this.nextRow+r+.5)/this.height,height:2*r/this.height,width:n};return this.nextRow+=a,this.dirty=!0,s}bind(e){let t=e.gl;this.texture?(t.bindTexture(t.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,t.texSubImage2D(t.TEXTURE_2D,0,0,0,this.width,this.height,t.ALPHA,t.UNSIGNED_BYTE,this.data))):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texImage2D(t.TEXTURE_2D,0,t.ALPHA,this.width,this.height,0,t.ALPHA,t.UNSIGNED_BYTE,this.data))}}let k="maplibre_preloaded_worker_pool";class D{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<D.workerCount;)this.workers.push(new Worker(t.a.WORKER_URL));return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],0===this.numActive()&&(this.workers.forEac
2h(e=>{e.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[k]}numActive(){return Object.keys(this.active).length}}let R=Math.floor(d.hardwareConcurrency/2);function L(){return n||(n=new D),n}D.workerCount=t.H(globalThis)?Math.max(Math.min(R,3),1):1;class F{constructor(e,i){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=i;const r=this.workerPool.acquire(i);for(let e=0;e<r.length;e++){const a=new t.J(r[e],i);a.name=`Worker ${e}`,this.actors.push(a)}if(!this.actors.length)throw Error("No actors found")}broadcast(e,t){let i=[];for(let r of this.actors)i.push(r.sendAsync({type:e,data:t}));return Promise.all(i)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(e=!0){this.actors.forEach(e=>{e.remove()}),this.actors=[],e&&this.workerPool.release(this.id)}registerMessageHandler(e,t){for(let i of this.actors)i.registerMessageHandler(e,t)}}function B(){return s||(s=new F(L(),t.K)).registerMessageHandler("GR",(e,i,r)=>t.m(i,r)),s}function O(e,t){let i=e.tileID,r=t.tileID;return i.overscaledZ-r.overscaledZ||i.canonical.y-r.canonical.y||i.wrap-r.wrap||i.canonical.x-r.canonical.x}function j(e,t){let i=e.feature,r=t.getFeatureState(i.layer["source-layer"],i.id);i.source=i.layer.source,i.layer["source-layer"]&&(i.sourceLayer=i.layer["source-layer"]),i.state=r}function V(e,i,r){return t._(this,void 0,void 0,function*(){let a=e;if(e.url?a=(yield t.j(i.transformRequest(e.url,"Source"),r)).data:yield d.frameAsync(r),!a)return null;let n=t.Q(t.e(a,e),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in a&&a.vector_layers&&(n.vectorLayerIds=a.vector_layers.map(e=>e.id)),n})}class U{constructor(e,t){e&&(t?this.setSouthWest(e).setNorthEast(t):Array.isArray(e)&&(4===e.length?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1])))}setNorthEast(e){return this._ne=e instanceof t.S?new t.S(e.lng,e.lat):t.S.convert(e),this}setSouthWest(e){return this._sw=e instanceof t.S?new t.S(e.lng,e.lat):t.S.convert(e),this}extend(e){let i,r,a=this._sw,n=this._ne;if(e instanceof t.S)i=e,r=e;else{if(!(e instanceof U))return Array.isArray(e)?4===e.length||e.every(Array.isArray)?this.extend(U.convert(e)):this.extend(t.S.convert(e)):e&&("lng"in e||"lon"in e)&&"lat"in e?this.extend(t.S.convert(e)):this;if(i=e._sw,r=e._ne,!i||!r)return this}return a||n?(a.lng=Math.min(i.lng,a.lng),a.lat=Math.min(i.lat,a.lat),n.lng=Math.max(r.lng,n.lng),n.lat=Math.max(r.lat,n.lat)):(this._sw=new t.S(i.lng,i.lat),this._ne=new t.S(r.lng,r.lat)),this}getCenter(){return new t.S((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 t.S(this.getWest(),this.getNorth())}getSouthEast(){return new t.S(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){let{lng:i,lat:r}=t.S.convert(e),a=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(a=this._sw.lng>=i&&i>=this._ne.lng),this._sw.lat<=r&&r<=this._ne.lat&&a}static convert(e){return e instanceof U?e:e?new U(e):e}static fromLngLat(e,i=0){let r=360*i/0x2637f09,a=r/Math.cos(Math.PI/180*e.lat);return new U(new t.S(e.lng-a,e.lat-r),new t.S(e.lng+a,e.lat+r))}adjustAntiMeridian(){let e=new t.S(this._sw.lng,this._sw.lat),i=new t.S(this._ne.lng,this._ne.lat);return new U(e,e.lng>i.lng?new t.S(i.lng+360,i.lat):i)}}class N{constructor(e,t,i){this.bounds=U.convert(this.validateBounds(e)),this.minzoom=t||0,this.maxzoom=i||24}validateBounds(e){return Array.isArray(e)&&4===e.length?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}contains(e){let i=Math.pow(2,e.z),r=Math.floor(t.V(this.bounds.getWest())*i),a=Math.floor(t.U(this.bounds.getNorth())*i),n=Math.ceil(t.V(this.bounds.getE
2ast())*i),s=Math.ceil(t.U(this.bounds.getSouth())*i);return e.x>=r&&e.x<n&&e.y>=a&&e.y<s}}class $ extends t.E{constructor(e,i,r,a){if(super(),this.id=e,this.dispatcher=r,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,t.e(this,t.Q(i,["url","scheme","tileSize","promoteId"])),this._options=t.e({type:"vector"},i),this._collectResourceTiming=i.collectResourceTiming,512!==this.tileSize)throw Error("vector tile sources must have a tileSize of 512");this.setEventedParent(a)}load(){return t._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new t.l("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{let e=yield V(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),e&&(t.e(this,e),e.bounds&&(this.tileBounds=new N(e.bounds,this.minzoom,this.maxzoom)),this.fire(new t.l("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new t.l("data",{dataType:"source",sourceDataType:"content"})))}catch(e){this._tileJSONRequest=null,this.fire(new t.k(e))}})}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}setSourceProperty(e){this._tileJSONRequest&&this._tileJSONRequest.abort(),e(),this.load()}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return t.e({},this._options)}loadTile(e){return t._(this,void 0,void 0,function*(){let t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),i={request:this.map._requestManager.transformRequest(t,"Tile"),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.t
2ype,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity,globalState:this.map.getGlobalState()};i.request.collectResourceTiming=this._collectResourceTiming;let r="RT";if(e.actor&&"expired"!==e.state){if("loading"===e.state)return new Promise((t,i)=>{e.reloadPromise={resolve:t,reject:i}})}else e.actor=this.dispatcher.getActor(),r="LT";e.abortController=new AbortController;try{let t=yield e.actor.sendAsync({type:r,data:i},e.abortController);if(delete e.abortController,e.aborted)return;this._afterTileLoadWorkerResponse(e,t)}catch(t){if(delete e.abortController,e.aborted)return;if(t&&404!==t.status)throw t;this._afterTileLoadWorkerResponse(e,null)}})}_afterTileLoadWorkerResponse(e,t){if(t&&t.resourceTiming&&(e.resourceTiming=t.resourceTiming),t&&this.map._refreshExpiredTiles&&e.setExpiryData(t),e.loadVectorData(t,this.map.painter),e.reloadPromise){let t=e.reloadPromise;e.reloadPromise=null,this.loadTile(e).then(t.resolve).catch(t.reject)}}abortTile(e){return t._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.actor&&(yield e.actor.sendAsync({type:"AT",data:{uid:e.uid,type:this.t
2ype,source:this.id}}))})}unloadTile(e){return t._(this,void 0,void 0,function*(){e.unloadVectorData(),e.actor&&(yield e.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class Z extends t.E{constructor(e,i,r,a){super(),this.id=e,this.dispatcher=r,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=t.e({type:"raster"},i),t.e(this,t.Q(i,["url","scheme","tileSize"]))}load(){return t._(this,arguments,void 0,function*(e=!1){this._loaded=!1,this.fire(new t.l("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{let i=yield V(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,i&&(t.e(this,i),i.bounds&&(this.tileBounds=new N(i.bounds,this.minzoom,this.maxzoom)),this.fire(new t.l("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new t.l("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:e})))}catch(e){this._tileJSONRequest=null,this.fire(new t.k(e))}})}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(e){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),e(),this.load(!0)}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}serialize(){return t.e({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(e){return t._(this,void 0,void 0,function*(){let i=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.abortController=new AbortController;try{let r=yield h.getImage(this.map._requestManager.transformRequest(i,"Tile"),e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(r&&r.data){this.map._refreshExpiredTiles&&(r.cacheControl||r.expires)&&e.setExpiryData({cacheControl:r.cacheControl,expires:r.expires});let i=this.map.painter.context,a=i.gl,n=r.data;e.texture=this.map.painter.getTileTexture(n.width),e.texture?e.texture.update(n,{useMipmap:!0}):(e.texture=new t.T(i,n,a.RGBA,{useMipmap:!0}),e.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE,a.LINEAR_MIPMAP_NEAREST)),e.state="loaded"}}catch(t){if(delete e.abortController,e.aborted)e.state="unloaded";else if(t)throw e.state="errored",t}})}abortTile(e){return t._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController)})}unloadTile(e){return t._(this,void 0,void 0,function*(){e.texture&&this.map.painter.saveTileTexture(e.texture)})}hasTransition(){return!1}}class G extends Z{constructor(e,i,r,a){super(e,i,r,a),this.type="raster-dem",this.maxzoom=22,this._options=t.e({type:"raster-dem"},i),this.encoding=i.encoding||"mapbox",this.redFactor=i.redFactor,this.greenFactor=i.greenFactor,this.blueFactor=i.blueFactor,this.baseShift=i.baseShift}loadTile(e){return t._(this,void 0,void 0,function*(){let i=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),r=this.map._requestManager.transformRequest(i,"Tile");e.neighboringTiles=this._getNeighboringTiles(e.tileID),e.abortController=new AbortController;try{let i=yield h.getImage(r,e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(i&&i.data){let r=i.data;this.map._refreshExpiredTiles&&(i.cacheControl||i.expires)&&e.setExpiryData({cacheControl:i.cacheControl,expires:i.expires});let a=t.b(r)&&t.W()?r:yield this.readImageNow(r),n={type:this.type,uid:e.uid,source:this.id,rawImageData:a,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!e.actor||"expired"===e.state){e.actor=this.dispatcher.getActor();let t=yield e.actor.sendAsync({type:"LDT",data:n});e.dem=t,e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state="loaded"}}}catch(t){if(delete e.abortController,e.aborted)e.state="unloaded";else if(t)throw e.state="errored",t}})}readImageNow(e){return t._(this,void 0,void 0,function*(){if("u">typeof VideoFrame&&t.X()){let i=e.width+2,r=e.height+2;try{return new t.R({width:i,height:r},(yield t.Y(e,-1,-1,i,r)))}catch(e){}}return d.getImageData(e,1)})}_getNeighboringTiles(e){let i=e.canonical,r=Math.pow(2,i.z),a=(i.x-1+r)%r,n=0===i.x?e.wrap-1:e.wrap,s=(i.x+1+r)%r,o=i.x+1===r?e.wrap+1:e.wrap,l={};return l[new t.Z(e.overscaledZ,n,i.z,a,i.y).key]={backfilled:!1},l[new t.Z(e.overscaledZ,o,i.z,s,i.y).key]={backfilled:!1},i.y>0&&(l[new t.Z(e.overscaledZ,n,i.z,a,i.y-1).key]={backfilled:!1},l[new t.Z(e.overscaledZ,e.wrap,i.z,i.x,i.y-1).key]={backfilled:!1},l[new t.Z(e.overscaledZ,o,i.z,s,i.y-1).key]={backfilled:!1}),i.y+1<r&&(l[new t.Z(e.overscaledZ,n,i.z,a,i.y+1).key]={backfilled:!1},l[new t.Z(e.overscaledZ,e.wrap,i.z,i.x,i.y+1).key]={backfilled:!1},l[new t.Z(e.overscaledZ,o,i.z,s,i.y+1).key]={backfilled:!1}),l}unloadTile(e){return t._(this,void 0,void 0,function*(){e.demTexture&&this.map.painter.saveTileTexture(e.demTexture),e.fbo&&(e.fbo.destroy(),delete e.fbo),e.dem&&delete e.dem,delete e.neighboringTiles,e.state="unloaded",e.actor&&(yield e.actor.sendAsync({type:"RDT",data:{type:this.t
2ype,uid:e.uid,source:this.id}}))})}}class q extends t.E{constructor(e,i,r,a){super(),this.id=e,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._isUpdatingWorker=!1,this._pendingWorkerUpdate={data:i.data},this.actor=r.getActor(),this.setEventedParent(a),this._data=i.data,this._options=t.e({},i),this._collectResourceTiming=i.collectResourceTiming,void 0!==i.maxzoom&&(this.maxzoom=i.maxzoom),i.type&&(this.type=i.type),i.attribution&&(this.attribution=i.attribution),this.promoteId=i.promoteId,void 0!==i.clusterMaxZoom&&this.maxzoom<=i.clusterMaxZoom&&t.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${i.clusterMaxZoom}".`),this.workerOptions=t.e({source:this.id,cluster:i.cluster||!1,geojsonVtOptions:{buffer:this._pixelsToTileUnits(void 0!==i.buffer?i.buffer:128),tolerance:this._pixelsToTileUnits(void 0!==i.tolerance?i.tolerance:.375),extent:t.$,maxZoom:this.maxzoom,lineMetrics:i.lineMetrics||!1,generateId:i.generateId||!1},superclusterOptions:{maxZoom:this._getClusterMaxZoom(i.clusterMaxZoom),minPoints:Math.max(2,i.clusterMinPoints||2),extent:t.$,radius:this._pixelsToTileUnits(i.clusterRadius||50),log:!1,generateId:i.generateId||!1},clusterProperties:i.clusterProperties,filter:i.filter},i.workerOptions),"string"==typeof this.promoteId&&(this.workerOptions.promoteId=this.promoteId)}_pixelsToTileUnits(e){return e*(t.$/this.tileSize)}_getClusterMaxZoom(e){let i=e?Math.round(e):this.maxzoom-1;return Number.isInteger(e)||void 0===e||t.w(`Integer expected for option 'clusterMaxZoom': provided value "${e}" rounded to "${i}"`),i}load(){return t._(this,void 0,void 0,function*(){yield this._updateWorkerData()})}onAdd(e){this.map=e,this.load()}setData(e){return this._data=e,this._pendingWorkerUpdate={data:e},this._updateWorkerData(),this}updateData(e){return this._pendingWorkerUpdate.diff=t.a0(this._pendingWorkerUpdate.diff,e),this._updateWorkerData(),this}getData(){return t._(this,void 0,void 0,function*(){let e=t.e({type:this.type},this.workerOptions);return this.actor.sendAsync({type:"GD",data:e})})}getCoordinatesFromGeometry(e){return"GeometryCollection"===e.type?e.geometries.map(e=>e.coordinates).flat(1/0):e.coordinates.flat(1/0)}getBounds(){return t._(this,void 0,void 0,function*(){let e,t=new U,i=yield this.getData();switch(i.type){case"FeatureCollection":e=i.features.map(e=>this.getCoordinatesFromGeometry(e.geometry)).flat(1/0);break;case"Feature":e=this.getCoordinatesFromGeometry(i.geometry);break;default:e=this.getCoordinatesFromGeometry(i)}if(0==e.length)return t;for(let i=0;i<e.length-1;i+=2)t.extend([e[i],e[i+1]]);return t})}setClusterOptions(e){return this.workerOptions.cluster=e.cluster,e&&(void 0!==e.clusterRadius&&(this.workerOptions.superclusterOptions.radius=this._pixelsToTileUnits(e.clusterRadius)),void 0!==e.clusterMaxZoom&&(this.workerOptions.superclusterOptions.maxZoom=this._getClusterMaxZoom(e.clusterMa
2xZoom))),this._updateWorkerData(),this}getClusterExpansionZoom(e){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:e,source:this.id}})}getClusterChildren(e){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:e,source:this.id}})}getClusterLeaves(e,t,i){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:e,limit:t,offset:i}})}_updateWorkerData(){return t._(this,void 0,void 0,function*(){if(this._isUpdatingWorker)return;let{data:e,diff:i}=this._pendingWorkerUpdate;if(!e&&!i)return void t.w(`No data or diff provided to GeoJSONSource ${this.id}.`);let r=t.e({type:this.type},this.workerOptions);e?("string"==typeof e?(r.request=this.map._requestManager.transformRequest(d.resolveURL(e),"Source"),r.request.collectResourceTiming=this._collectResourceTiming):r.data=JSON.stringify(e),this._pendingWorkerUpdate.data=void 0):i&&(r.dataDiff=i,this._pendingWorkerUpdate.diff=void 0),this._isUpdatingWorker=!0,this.fire(new t.l("dataloading",{dataType:"source"}));try{let e=yield this.actor.sendAsync({type:"LD",data:r});if(this._isUpdatingWorker=!1,this._removed||e.abandoned)return void this.fire(new t.l("dataabort",{dataType:"source"}));this._data=e.data;let i=null;e.resourceTiming&&e.resourceTiming[this.id]&&(i=e.resourceTiming[this.id].slice(0));let a={dataType:"source"};this._collectResourceTiming&&i&&i.length>0&&t.e(a,{resourceTiming:i}),this.fire(new t.l("data",Object.assign(Object.assign({},a),{sourceDataType:"metadata"}))),this.fire(new t.l("data",Object.assign(Object.assign({},a),{sourceDataType:"content"})))}catch(e){if(this._isUpdatingWorker=!1,this._removed)return void this.fire(new t.l("dataabort",{dataType:"source"}));this.fire(new t.k(e))}finally{(this._pendingWorkerUpdate.data||this._pendingWorkerUpdate.diff)&&this._updateWorkerData()}})}loaded(){return!this._isUpdatingWorker&&void 0===this._pendingWorkerUpdate.data&&void 0===this._pendingWorkerUpdate.diff}loadTile(e){return t._(this,void 0,void 0,function*(){let t=e.actor?"RT":"LT";e.actor=this.actor;let i={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity,globalState:this.map.getGlobalState()};e.abortController=new AbortController;let r=yield this.actor.sendAsync({type:t,data:i},e.abortController);delete e.abortController,e.unloadVectorData(),e.aborted||e.loadVectorData(r,this.map.painter,"RT"===t)})}abortTile(e){return t._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.aborted=!0})}unloadTile(e){return t._(this,void 0,void 0,function*(){e.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.t
2ype,source:this.id}})})}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return t.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}class W extends t.E{constructor(e,t,i,r){super(),this.flippedWindingOrder=!1,this.id=e,this.dispatcher=i,this.coordinates=t.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(r),this.options=t}load(e){return t._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new t.l("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{let t=yield h.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,t&&t.data&&(this.image=t.data,e&&(this.coordinates=e),this._finishLoading())}catch(e){this._request=null,this._loaded=!0,this.fire(new t.k(e))}})}loaded(){return this._loaded}updateImage(e){return e.url&&(this._request&&(this._request.abort(),this._request=null),this.options.url=e.url,this.load(e.coordinates).finally(()=>{this.texture=null})),this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new t.l("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(e){var i;let r,a,n;this.coordinates=e;let s=e.map(t.a1.fromLngLat);return this.tileID=(n=Math.pow(2,a=Math.max(0,Math.floor(-Math.log(Math.max((r=t.a2.fromPoints(s)).width(),r.height()))/Math.LN2))),new t.a4(a,Math.floor((r.minX+r.maxX)/2*n),Math.floor((r.minY+r.maxY)/2*n))),this.terrainTileRanges=this._getOverlappingTileRanges(s),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=s.map(e=>this.tileID.getTilePoint(e)._round()),this.flippedWindingOrder=((i=this.tileCoords)[1].x-i[0].x)*(i[2].y-i[0].y)-(i[1].y-i[0].y)*(i[2].x-i[0].x)<0,this.fire(new t.l("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(0===Object.keys(this.tiles).length||!this.image)return;let e=this.map.painter.context,i=e.gl;this.texture||(this.texture=new t.T(e,this.image,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let r=!1;for(let e in this.tiles){let t=this.tiles[e];"loaded"!==t.state&&(t.state="loaded",t.texture=this.texture,r=!0)}r&&this.fire(new t.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(e){return t._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={}):e.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}_getOverlappingTileRanges(e){let{minX:i,minY:r,maxX:a,maxY:n}=t.a2.fromPoints(e),s={};for(let e=0;e<=t.a3;e++){let t=Math.pow(2,e),o=Math.floor(i*t),l=Math.floor(r*t),h=Math.floor(a*t),u=Math.floor(n*t);s[e]={minTileX:o,minTileY:l,maxTileX:h,maxTileY:u}}return s}}class H extends W{constructor(e,t,i,r){super(e,t,i,r),this.roundZoom=!0,this.type="video",this.options=t}load(){return t._(this,void 0,void 0,function*(){this._loaded=!1;let e=this.options;for(let t of(this.urls=[],e.urls))this.urls.push(this.map._requestManager.transformRequest(t,"Source").url);try{let e=yield t.a5(this.urls);if(this._loaded=!0,!e)return;this.video=e,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(e){this.fire(new t.k(e))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){let i=this.video.seekable;e<i.start(0)||e>i.end(0)?this.fire(new t.k(new t.a6(`sources.${this.id}`,null,`Playback for this video can be set only between the ${i.start(0)} and ${i.end(0)}-second mark.`))):this.video.currentTime=e}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;let e=this.map.painter.context,i=e.gl;this.texture?this.video.paused||(this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE),i.texSubImage2D(i.TEXTURE_2D,0,0,0,i.RGBA,i.UNSIGNED_BYTE,this.video)):(this.texture=new t.T(e,this.video,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let r=!1;for(let e in this.tiles){let t=this.tiles[e];"loaded"!==t.state&&(t.state="loaded",t.texture=this.texture,r=!0)}r&&this.fire(new t.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class X extends W{constructor(e,i,r,a){super(e,i,r,a),i.coordinates?Array.isArray(i.coordinates)&&4===i.coordinates.length&&!i.coordinates.some(e=>!Array.isArray(e)||2!==e.length||e.some(e=>"number"!=typeof e))||this.fire(new t.k(new t.a6(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new t.k(new t.a6(`sources.${e}`,null,'missing required property "coordinates"'))),i.animate&&"boolean"!=typeof i.animate&&this.fire(new t.k(new t.a6(`sources.${e}
2`,null,'optional "animate" property must be a boolean value'))),i.canvas?"string"==typeof i.canvas||i.canvas instanceof HTMLCanvasElement||this.fire(new t.k(new t.a6(`sources.${e}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new t.k(new t.a6(`sources.${e}`,null,'missing required property "canvas"'))),this.options=i,this.animate=void 0===i.animate||i.animate}load(){return t._(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 t.k(Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())})}getCanvas(){return this.canvas}onAdd(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),this._hasInvalidDimensions()||0===Object.keys(this.tiles).length)return;let i=this.map.painter.context,r=i.gl;this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new t.T(i,this.canvas,r.RGBA,{premultiply:!0});let a=!1;for(let e in this.tiles){let t=this.tiles[e];"loaded"!==t.state&&(t.state="loaded",t.texture=this.texture,a=!0)}a&&this.fire(new t.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(let e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}}let Y={},K=e=>{switch(e){case"geojson":return q;case"image":return W;case"raster":return Z;case"raster-dem":return G;case"vector":return $;case"video":return H;case"canvas":return X}return Y[e]},J="RTLPluginLoaded";class Q extends t.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=B()}_syncState(e){return this.status=e,this.dispatcher.broadcast("SRPS",{pluginStatus:e,pluginURL:this.url}).catch(e=>{throw this.status="error",e})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(e){return t._(this,arguments,void 0,function*(e,t=!1){if(this.url)throw Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=d.resolveURL(e),!this.url)throw Error(`requested url ${e} is invalid`);if("unavailable"===this.status){if(!t)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if("requested"===this.status)return this._requestImport()})}_requestImport(){return t._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new t.l(J))})}lazyLoad(){"unavailable"===this.status?this.status="requested":"deferred"===this.status&&this._requestImport()}}let ee=null;function et(){return ee||(ee=new Q),ee}class ei{constructor(e,i){this.timeAdded=0,this.fadeEndTime=0,this.tileID=e,this.uid=t.a7(),this.uses=0,this.tileSize=i,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(e){let t=e+this.timeAdded;t<this.fadeEndTime||(this.fadeEndTime=t)}wasRequested(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state}clearTextures(e){this.demTexture&&e.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(e,i,r){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",e){for(let a in e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestFeatureIndex.rawTileData=e.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=function(e,t){let i={};if(!t)return i;for(let r of e){let e=r.layerIds.map(e=>
2t.getLayer(e)).filter(Boolean);if(0!==e.length)for(let t of(r.layers=e,r.stateDependentLayerIds&&(r.stateDependentLayers=r.stateDependentLayerIds.map(t=>e.filter(e=>e.id===t)[0])),e))i[t.id]=r}return i}(e.buckets,null==i?void 0:i.style),this.hasSymbolBuckets=!1,this.buckets){let e=this.buckets[a];if(e instanceof t.a9){if(this.hasSymbolBuckets=!0,!r)break;e.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let e in this.buckets){let i=this.buckets[e];if(i instanceof t.a9&&i.hasRTLText){this.hasRTLText=!0,et().lazyLoad();break}}for(let e in this.queryPadding=0,this.buckets){let t=this.buckets[e];this.queryPadding=Math.max(this.queryPadding,i.style.getLayer(e).queryRadius(t))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage)}else this.collisionBoxArray=new t.a8}unloadVectorData(){for(let e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(e){return this.buckets[e.id]}upload(e){for(let t in this.buckets){let i=this.buckets[t];i.uploadPending()&&i.upload(e)}let i=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new t.T(e,this.imageAtlas.image,i.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new t.T(e,this.glyphAtlasImage,i.ALPHA),this.glyphAtlasImage=null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,t,i,r,a,n,s,o,l,h,u){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:r,cameraQueryGeometry:a,scale:n,tileSize:this.tileSize,pixelPosMatrix:h,transform:o,params:s,queryPadding:this.queryPadding*l,getElevation:u},e,t,i):{}}querySourceFeatures(e,i){let r=this.latestFeatureIndex;if(!r||!r.rawTileData)return;let a=r.loadVTLayers(),n=i&&i.sourceLayer?i.sourceLayer:"",s=a._geojsonTileLayer||a[n];if(!s)return;let o=t.aa(i&&i.filter),{z:l,x:h,y:u}=this.tileID.canonical,c={z:l,x:h,y:u};for(let i=0;i<s.length;i++){let a=s.feature(i);if(o.needGeometry){let e=t.ab(a,!0);if(!o.filter(new t.F(this.tileID.overscaledZ),e,this.tileID.canonical))continue}else if(!o.filter(new t.F(this.tileID.overscaledZ),a))continue;let d=r.getId(a,n),p=new t.ac(a,l,h,u,d);p.tile=c,e.push(p)}}hasData(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(e){let i=this.expirationTime;if(e.cacheControl){let i=t.ad(e.cacheControl);i["max-age"]&&(this.expirationTime=Date.now()+1e3*i["max-age"])}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){let e=Date.now(),t=!1;if(this.expirationTime>e)t=!1;else if(i)if(this.expirationTime<i)t=!0;else{let r=this.expirationTime-i;r?this.expirationTime=e+Math.max(r,3e4):t=!0}else t=!0;t?(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(),0x7fffffff)}setFeatureState(e,t){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||0===Object.keys(e).length)return;let i=this.latestFeatureIndex.loadVTLayers();for(let r in this.buckets){if(!t.style.hasLayer(r))continue;let a=this.buckets[r],n=a.layers[0].sourceLayer||"_geojsonTileLayer",s=i[n],o=e[n];if(!s||!o||0===Object.keys(o).length)continue;a.update(o,s,this.imageAtlas&&this.imageAtlas.patternPositions||{});let l=t&&t.style&&t.style.getLayer(r);l&&(this.queryPadding=Math.max(this.queryPadding,l.queryRadius(a)))}}holdingForFade(){return void 0!==this.symbolFadeHoldUntil}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<d.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(e){this.symbolFadeHoldUntil=d.now()+e}
2setDependencies(e,t){let i={};for(let e of t)i[e]=!0;this.dependencies[e]=i}hasDependency(e,t){for(let i of e){let e=this.dependencies[i];if(e){for(let i of t)if(e[i])return!0}}return!1}}class er{constructor(e,t){this.max=e,this.onRemove=t,this.reset()}reset(){for(let e in this.data)for(let t of this.data[e])t.timeout&&clearTimeout(t.timeout),this.onRemove(t.value);return this.data={},this.order=[],this}add(e,t,i){let r=e.wrapped().key;void 0===this.data[r]&&(this.data[r]=[]);let a={value:t,timeout:void 0};if(void 0!==i&&(a.timeout=setTimeout(()=>{this.remove(e,a)},i)),this.data[r].push(a),this.order.push(r),this.order.length>this.max){let e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){let t=this.data[e].shift();return t.timeout&&clearTimeout(t.timeout),0===this.data[e].length&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),t.value}getByKey(e){let t=this.data[e];return t?t[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,t){if(!this.has(e))return this;let i=e.wrapped().key,r=void 0===t?0:this.data[i].indexOf(t),a=this.data[i][r];return this.data[i].splice(r,1),a.timeout&&clearTimeout(a.timeout),0===this.data[i].length&&delete this.data[i],this.onRemove(a.value),this.order.splice(this.order.indexOf(i),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){let e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}filter(e){let t=[];for(let i in this.data)for(let r of this.data[i])e(r.value)||t.push(r);for(let e of t)this.remove(e.value.tileID,e)}}class ea{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,i,r){let a=String(i);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][a]=this.stateChanges[e][a]||{},t.e(this.stateChanges[e][a],r),null===this.deletedStates[e])for(let t in this.deletedStates[e]={},this.state[e])t!==a&&(this.deletedStates[e][t]=null);else if(this.deletedStates[e]&&null===this.deletedStates[e][a])for(let t in this.deletedStates[e][a]={},this.state[e][a])r[t]||(this.deletedStates[e][a][t]=null);else for(let t in r)this.deletedStates[e]&&this.deletedStates[e][a]&&null===this.deletedStates[e][a][t]&&delete this.deletedStates[e][a][t]}removeFeatureState(e,t,i){if(null===this.deletedStates[e])return;let r=String(t);if(this.deletedStates[e]=this.deletedStates[e]||{},i&&void 0!==t)null!==this.deletedStates[e][r]&&(this.deletedStates[e][r]=this.deletedStates[e][r]||{},this.deletedStates[e][r][i]=null);else if(void 0!==t)if(this.stateChanges[e]&&this.stateChanges[e][r])for(i in this.deletedStates[e][r]={},this.stateChanges[e][r])this.deletedStates[e][r][i]=null;else this.deletedStates[e][r]=null;else this.deletedStates[e]=null}getState(e,i){let r=String(i),a=t.e({},(this.state[e]||{})[r],(this.stateChanges[e]||{})[r]);if(null===this.deletedStates[e])return{};if(this.deletedStates[e]){let t=this.deletedStates[e][i];if(null===t)return{};for(let e in t)delete a[e]}return a}initializeTileState(e,t){e.setFeatureState(this.state,t)}coalesceChanges(e,i){let r={};for(let e in this.stateChanges){this.state[e]=this.state[e]||{};let i={};for(let r in this.stateChanges[e])this.state[e][r]||(this.state[e][r]={}),t.e(this.state[e][r],this.stateChanges[e][r]),i[r]=this.state[e][r];r[e]=i}for(let e in this.deletedStates){this.state[e]=this.state[e]||{};let i={};if(null===this.deletedStates[e])for(let t in this.state[e])i[t]={},this.state[e][t]={};else for(let t in this.deletedStates[e]){if(null===this.deletedStates[e][t])this.state[e][t]={};else for(let i of Object.keys(this.deletedStates[e][t]))delete this.state[e][t][i];i[t]=this.state[e][t]}r[e]=r[e]||{},t.e(r[e],i)}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(r).length)for(let t in e)e[t].setFeatureState(r,i)}}function en(e,i){let r=t.ah(i.lat,-t.ai,t.ai);return new t.P(t.V(i.lng)*e,t.U(r)*e)}function es(e,i){return new t.a1(i.x/e,i.y/e).toLngLat()}function eo(e){return e.cameraToCenterDistance*Math.min(.85*Math.tan(t.ae(90-e.pitch)),Math.tan(t.ae(89.25-e.pitch)))}function el(e,i){let r=e.canonical,a=i/t.af(r.z),n=r.x+Math.pow(2,r.z)*e.wrap,s=t.ag(new Float64Array(16));return t.M(s,s,[n*a,r.y*a,0]),t.N(s,s,[a/t.$,a/t.$,1]),s}function eh(e,i,r,a,n){let s=t.a1.fromLngLat(e,i),o=n*t.aj(1,e.lat),l=o*Math.cos(t.ae(r)),h=Math.sqrt(o*o-l*l),u=h*Math.sin(t.ae(-a)),c=h*Math.cos(t.ae(-a));return new t.a1(s.x+u,s.y+c,s.z+l)}function eu(e,t,i){let r=0,a=(i-t)/10;for(let n=0;n<10;n++)r+=a*Math.pow(Math.cos(t+(n+.5)/10*(i-t)),e);return r}function ec(e,i){return function(r,a,n,s,o){let l=2*((e-1)/t.ak(Math.cos(t.ae(89.25-o))/Math.cos(t.ae(89.25)))-1),h=Math.acos(n/s),u=2*eu(l-1,0,t.ae(o/2)),c=Math.min(t.ae(89.25),h+t.ae(o/2)),d=eu(l-1,Math.min(c,h-t.ae(o/2)),c),p=Math.atan(a/n),f=Math.hypot(a,n),m=r;return m+=t.ak(s/f/Math.max(.5,Math.cos(t.ae(o/2)))),m+=l*t.ak(Math.cos(p))/2,m-=t.ak(Math.max(1,d/u/i))/2}}let ed=ec(9.314,3);function ep(e,i){return Math.max(0,(i.roundZoom?Math.round:Math.floor)(e.zoom+t.ak(e.tileSize/i.tileSize)))}function ef(e,i){let r=e.getCameraFrustum(),a=e.getClippingPlane(),n=e.screenPointToMercatorCoordinate(e.getCameraPoint()),s=t.a1.fromLngLat(e.center,e.elevation);n.z=s.z+Math.cos(e.pitchInRadians)*e.cameraToCenterDistance/e.worldSize;let o=e.getCoveringTilesDetailsProvider(),l=o.allowVariableZoom(e,i),h=ep(e,i),u=i.minzoom||0,c=void 0!==i.maxzoom?i.maxzoom:e.maxZoom,d=Math.min(Math.max(0,h),c),p=Math.pow(2,d),f=[p*n.x,p*n.y,0],m=[p*s.x,p*s.y,0],_=Math.hypot(s.x-n.x,s.y-n.y),g=Math.abs(s.z-n.z),y=Math.hypot(_,g),x=e=>({zoom:0,x:0,y:0,wrap:e,fullyVisible:!1}),v=[],b=[];if(e.renderWorldCopies&&o.allowWorldCopies())for(let e=1;e<=3;e++)v.push(x(-e)),v.push(x(e));for(v.push(x(0));v.length>0;){let p=v.pop(),_=p.x,x=p.y,w=p.fullyVisible,T={x:_,y:x,z:p.zoom},P=o.getTileBoundingVolume(T,p.wrap,e.elevation,i);if(!w){let e=function(e,t,i){let r=t.intersectsFrustum(e);if(!i||0===r)return r;let a=t.intersectsPlane(i);return 0===a?0:2===r&&2===a?2:1}(r,P,a);if(0===e)continue;w=2===e}let S=o.distanceToTile2d(n.x,n.y,T,P),M=h;l&&(M=(i.calculateTileZoom||ed)(e.zoom+t.ak(e.tileSize/i.tileSize),S,g,y,e.fov));let C=Math.min(M=Math.max(0,M=(i.roundZoom?Math.round:Math.floor)(M)),c);if(p.wrap=o.getWrap(s,T,p.wrap),p.zoom>=C){if(p.zoom<u)continue;let e=d-p.zoom,r=f[0]-.5-(_<<e),a=f[1]-.5-(x<<e),n=i.reparseOverscaled?Math.max(p.zoom,M):p.zoom;b.push({tileID:new t.Z(p.zoom===c?n:p.zoom,p.wrap,p.zoom,_,x),distanceSq:t.al([m[0]-.5-_,m[1]-.5-x]),tileDistanceToCamera:Math.sqrt(r*r+a*a)})}else for(let e=0;e<4;e++)v.push({zoom:p.zoom+1,x:(_<<1)+e%2,y:(x<<1)+(e>>1),wrap:p.wrap,fullyVisible:w})}return b.sort((e,t)=>
2e.distanceSq-t.distanceSq).map(e=>e.tileID)}let em=t.a2.fromPoints([new t.P(0,0),new t.P(t.$,t.$)]);class e_ extends t.E{constructor(e,t,i){super(),this.id=e,this.dispatcher=i,this.on("data",e=>this._dataHandler(e)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((e,t,i,r)=>{let a=new(K(t.type))(e,t,i,r);if(a.id!==e)throw Error(`Expected Source id to be ${e} instead of ${a.id}`);return a})(e,t,i,this),this._tiles={},this._cache=new er(0,e=>this._unloadTile(e)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new ea,this._didEmitContent=!1,this._updated=!1}onAdd(e){this.map=e,this._maxTileCacheSize=e?e._maxTileCacheSize:null,this._maxTileCacheZoomLevels=e?e._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(e)}onRemove(e){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(e)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(void 0===this.used&&void 0===this.usedForTerrain||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(let e in this._tiles){let t=this._tiles[e];if("loaded"!==t.state&&"errored"!==t.state)return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;let e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(e,i,r){return t._(this,void 0,void 0,function*(){try{yield this._source.loadTile(e),this._tileLoaded(e,i,r)}catch(i){e.state="errored",404!==i.status?this._source.fire(new t.k(i,{tile:e})):this.update(this.transform,this.terrain)}})}_unloadTile(e){this._source.unloadTile&&this._source.unloadTile(e)}_abortTile(e){this._source.abortTile&&this._source.abortTile(e),this._source.fire(new t.l("dataabort",{tile:e,coord:e.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(e){for(let t in this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null),this._tiles){let i=this._tiles[t];i.upload(e),i.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(e=>e.tileID).sort(eg).map(e=>e.key)}getRenderableIds(e){let i=[];for(let t in this._tiles)this._isIdRenderable(t,e)&&i.push(this._tiles[t]);return e?i.sort((e,i)=>{let r=e.tileID,a=i.tileID,n=new t.P(r.canonical.x,r.canonical.y)._rotate(-this.transform.bearingInRadians),s=new t.P(a.canonical.x,a.canonical.y)._rotate(-this.transform.bearingInRadians);return r.overscaledZ-a.overscaledZ||s.y-n.y||s.x-n.x}).map(e=>e.tileID.key):i.map(e=>e.tileID).sort(eg).map(e=>e.key)}hasRenderableParent(e){let t=this.findLoadedParent(e,0);return!!t&&this._isIdRenderable(t.tileID.key)}_isIdRenderable(e,t){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(t||!this._tiles[e].holdingForFade())}reload(e){if(this._paused)this._shouldReloadOnResume=!0;else for(let t in this._cache.reset(),this._tiles)e?this._reloadTile(t,"expired"):"errored"!==this._tiles[t].state&&this._reloadTile(t,"reloading")}_reloadTile(e,i){return t._(this,void 0,void 0,function*(){let t=this._tiles[e];t&&("loading"!==t.state&&(t.state=i),yield this._loadTile(t,e,i))})}_tileLoaded(e,i,r){e.timeAdded=d.now(),"expired"===r&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(i,e),"raster-dem"===this.getSource().type&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new t.l("data",{dataType:"source",tile:e,coord:e.tileID}))}_backfillDEM(e){let t=this.getRenderableIds();for(let r=0;r<t.length;r++){let a=t[r];if(e.neighboringTiles&&e.neighboringTiles[a]){let t=this.getTileByID(a);i(e,t),i(t,e)}}function i(e,t){e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0;let i=t.tileID.canonical.x-e.tileID.canonical.x,r=t.tileID.canonical.y-e.tileID.canonical.y,a=Math.pow(2,e.tileID.canonical.z),n=t.t
2ileID.key;0===i&&0===r||Math.abs(r)>1||(Math.abs(i)>1&&(1===Math.abs(i+a)?i+=a:1===Math.abs(i-a)&&(i-=a)),t.dem&&e.dem&&(e.dem.backfillBorder(t.dem,i,r),e.neighboringTiles&&e.neighboringTiles[n]&&(e.neighboringTiles[n].backfilled=!0)))}}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,t,i,r){for(let a in this._tiles){let n=this._tiles[a];if(r[a]||!n.hasData()||n.tileID.overscaledZ<=t||n.tileID.overscaledZ>i)continue;let s=n.tileID;for(;n&&n.tileID.overscaledZ>t+1;){let e=n.tileID.scaledTo(n.tileID.overscaledZ-1);(n=this._tiles[e.key])&&n.hasData()&&(s=e)}let o=s;for(;o.overscaledZ>t;)if(e[(o=o.scaledTo(o.overscaledZ-1)).key]||e[o.canonical.key]){r[s.key]=s;break}}}findLoadedParent(e,t){if(e.key in this._loadedParentTiles){let i=this._loadedParentTiles[e.key];return i&&i.tileID.overscaledZ>=t?i:null}for(let i=e.overscaledZ-1;i>=t;i--){let t=e.scaledTo(i),r=this._getLoadedTile(t);if(r)return r}}findLoadedSibling(e){return this._getLoadedTile(e)}_getLoadedTile(e){let t=this._tiles[e.key];return t&&t.hasData()?t:this._cache.getByKey(e.wrapped().key)}updateCacheSize(e){let i=Math.floor((Math.ceil(e.width/this._source.tileSize)+1)*(Math.ceil(e.height/this._source.tileSize)+1)*(null===this._maxTileCacheZoomLevels?t.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),r="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,i):i;this._cache.setMaxSize(r)}handleWrapJump(e){let t=Math.round((e-(void 0===this._prevLng?e:this._prevLng))/360);if(this._prevLng=e,t){let e={};for(let i in this._tiles){let r=this._tiles[i];r.tileID=r.tileID.unwrapTo(r.tileID.wrap+t),e[r.tileID.key]=r}for(let t in this._tiles=e,this._timers)clearTimeout(this._timers[t]),delete this._timers[t];for(let e in this._tiles)this._setTileReloadTimer(e,this._tiles[e])}}_updateCoveredAndRetainedTiles(e,t,i,r,a,n){let s={},o={},l=Object.keys(e),h=d.now();for(let i of l){let r=e[i],a=this._tiles[i];if(!a||0!==a.fadeEndTime&&a.fadeEndTime<=h)continue;let n=this.findLoadedParent(r,t),l=this.findLoadedSibling(r),u=n||l||null;u&&(this._addTile(u.tileID),s[u.tileID.key]=u.tileID),o[i]=r}for(let t in this._retainLoadedChildren(o,r,i,e),s)e[t]||(this._coveredTiles[t]=!0,e[t]=s[t]);if(n){let t={},i={};for(let e of a)this._tiles[e.key].hasData()?t[e.key]=e:i[e.key]=e;for(let r in i){let a=i[r].children(this._source.maxzoom);this._tiles[a[0].key]&&this._tiles[a[1].key]&&this._tiles[a[2].key]&&this._tiles[a[3].key]&&(t[a[0].key]=e[a[0].key]=a[0],t[a[1].key]=e[a[1].key]=a[1],t[a[2].key]=e[a[2].key]=a[2],t[a[3].key]=e[a[3].key]=a[3],delete i[r])}for(let r in i){let a=i[r],n=this.findLoadedParent(a,this._source.minzoom),s=this.findLoadedSibling(a),o=n||s||null;if(o)for(let i in t[o.tileID.key]=e[o.tileID.key]=o.tileID,t)t[i].isChildOf(o.tileID)&&delete t[i]}for(let e in this._tiles)t[e]||(this._coveredTiles[e]=!0)}}update(e,i){let r;if(!this._sourceLoaded||this._paused)return;this.transform=e,this.terrain=i,this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?r=e.getVisibleUnwrappedCoordinates(this._source.tileID).map(e=>new t.Z(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y)):(r=ef(e,{tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:i,calculateTileZoom:this._source.calculateTileZoom}),this._source.hasTile&&(r=r.filter(e=>this._source.hasTile(e)))):r=[];let a=ep(e,this._source),n=Math.max(a-e_.maxOverzooming,this._source.minzoom),s=Math.max(a+e_.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){let e={};for(let t of r)if(t.canonical.z>this._source.minzoom){let i=t.scaledTo(t.canonical.z-1);e[i.key]=i;let r=t.scaledTo(Math.max(this._source.minzoom,Math.min(t.canonical.z,5)));e[r.key]=r}r=r.concat(Object.values(e))}let o=0===r.length&&!this._updated&&this._didEmitContent;this._updated=!0,o&&this.fire(new t.l("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));let l=this._updateRetainedTiles(r,a);for(let e in ey(this._source.type)&&this._updateCoveredAndRetainedTiles(l,n,s,a,r,i),l)this._tiles[e].clearFadeHold();for(let e of t.am(this._tiles,l)){let t=this._tiles[e];t.hasSymbolBuckets&&!t.holdingForFade()?t.setHoldDuration(this.map._fadeDuration):t.hasSymbolBuckets&&!t.symbolFadeFinished()||this._removeTile(e)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(let e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(e)}_updateRetainedTiles(e,t){var i;let r={},a={},n=Math.max(t-e_.maxOverzooming,this._source.minzoom),s=Math.max(t+e_.maxUnderzooming,this._source.minzoom),o={};for(let i of e){let e=this._addTile(i);r[i.key]=i,e.hasData()||t<this._source.maxzoom&&(o[i.key]=i)}for(let l of(this._retainLoadedChildren(o,t,s,r),e)){let e=this._tiles[l.key];if(e.hasData())continue;if(t+1>
2this._source.maxzoom){let e=l.children(this._source.maxzoom)[0],t=this.getTile(e);if(t&&t.hasData()){r[e.key]=e;continue}}else{let e=l.children(this._source.maxzoom);if(r[e[0].key]&&r[e[1].key]&&r[e[2].key]&&r[e[3].key])continue}let s=e.wasRequested();for(let t=l.overscaledZ-1;t>=n;--t){let n=l.scaledTo(t);if(a[n.key])break;if(a[n.key]=!0,(e=this.getTile(n))||!s||(e=this._addTile(n)),e){let t=e.hasData();if((t||!(null==(i=this.map)?void 0:i.cancelPendingTileRequestsWhileZooming)||s)&&(r[n.key]=n),s=e.wasRequested(),t)break}}}return r}_updateLoadedParentTileCache(){for(let e in this._loadedParentTiles={},this._tiles){let t=[],i,r=this._tiles[e].tileID;for(;r.overscaledZ>0;){if(r.key in this._loadedParentTiles){i=this._loadedParentTiles[r.key];break}t.push(r.key);let e=r.scaledTo(r.overscaledZ-1);if(i=this._getLoadedTile(e))break;r=e}for(let e of t)this._loadedParentTiles[e]=i}}_updateLoadedSiblingTileCache(){for(let e in this._loadedSiblingTiles={},this._tiles){let t=this._tiles[e].tileID,i=this._getLoadedTile(t);this._loadedSiblingTiles[t.key]=i}}_addTile(e){let i=this._tiles[e.key];if(i)return i;(i=this._cache.getAndRemove(e))&&(this._setTileReloadTimer(e.key,i),i.tileID=e,this._state.initializeTileState(i,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,i)));let r=i;return i||(i=new ei(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(i,e.key,i.state)),i.uses++,this._tiles[e.key]=i,r||this._source.fire(new t.l("dataloading",{tile:i,coord:i.tileID,dataType:"source"})),i}_setTileReloadTimer(e,t){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);let i=t.getExpiryTimeout();i&&(this._timers[e]=setTimeout(()=>{this._reloadTile(e,"expired"),delete this._timers[e]},i))}refreshTiles(e){for(let t in this._tiles)(this._isIdRenderable(t)||"errored"==this._tiles[t].state)&&e.some(e=>e.equals(this._tiles[t].tileID.canonical))&&this._reloadTile(t,"expired")}_removeTile(e){let t=this._tiles[e];t&&(t.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),t.uses>0||(t.hasData()&&"reloading"!==t.state?this._cache.add(t.tileID,t,t.getExpiryTimeout()):(t.aborted=!0,this._abortTile(t),this._unloadTile(t))))}_dataHandler(e){let t=e.sourceDataType;"source"===e.dataType&&"metadata"===t&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&"source"===e.dataType&&"content"===t&&(this.reload(e.sourceDataChanged),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){for(let e in this._shouldReloadOnResume=!1,this._paused=!1,this._tiles)this._removeTile(e);this._cache.reset()}tilesIn(e,i,r){let a=[],n=this.transform;if(!n)return a;let s=n.getCoveringTilesDetailsProvider().allowWorldCopies(),o=r?n.getCameraQueryGeometry(e):e,l=e=>n.screenPointToMercatorCoordinate(e,this.terrain),h=this.transformBbox(e,l,!s),u=this.transformBbox(o,l,!s),c=this.getIds(),d=t.a2.fromPoints(u);for(let e=0;e<c.length;e++){let r=this._tiles[c[e]];if(r.holdingForFade())continue;let o=s?[r.tileID]:[r.tileID.unwrapTo(-1),r.tileID.unwrapTo(0)],l=Math.pow(2,n.zoom-r.tileID.overscaledZ),p=i*r.queryPadding*t.$/r.tileSize/l;for(let e of o){let i=d.map(i=>e.getTilePoint(new t.a1(i.x,i.y)));if(i.expandBy(p),i.intersects(em)){let t=h.map(t=>e.getTilePoint(t)),i=u.map(t=>e.getTilePoint(t));a.push({tile:r,tileID:s?e:e.unwrapTo(0),queryGeometry:t,cameraQueryGeometry:i,scale:l})}}}return a}transformBbox(e,i,r){let a=e.map(i);if(r){let r=t.a2.fromPoints(e);r.shrinkBy(.001*Math.min(r.width(),r.height()));let n=r.map(i);t.a2.fromPoints(a).covers(n)||(a=a.map(e=>e.x>.5?new t.a1(e.x-1,e.y,e.z):e))}return a}getVisibleCoordinates(e){let t=this.getRenderableIds(e).map(e=>this._tiles[e].tileID);return this.transform&&this.transform.populateCache(t),t}hasTransition(){if(this._source.hasTransition())return!0;if(ey(this._source.type)){let e=d.now();for(let t in this._tiles)if(this._tiles[t].fadeEndTime>=e)return!0}return!1}setFeatureState(e,t,i){this._state.updateState(e=e||"_geojsonTileLayer",t,i)}removeFeatureState(e,t,i){this._state.removeFeatureState(e=e||"_geojsonTileLayer",t,i)}getFeatureState(e,t){return this._state.getState(e=e||"_geojsonTileLayer",t)}
2setDependencies(e,t,i){let r=this._tiles[e];r&&r.setDependencies(t,i)}reloadTilesForDependencies(e,t){for(let i in this._tiles)this._tiles[i].hasDependency(e,t)&&this._reloadTile(i,"reloading");this._cache.filter(i=>!i.hasDependency(e,t))}}function eg(e,t){let i=Math.abs(2*e.wrap)-(e.wrap<0),r=Math.abs(2*t.wrap)-(t.wrap<0);return e.overscaledZ-t.overscaledZ||r-i||t.canonical.y-e.canonical.y||t.canonical.x-e.canonical.x}function ey(e){return"raster"===e||"image"===e||"video"===e}e_.maxOverzooming=10,e_.maxUnderzooming=3;class ex{constructor(e,t){this.reset(e,t)}reset(e,t){this.points=e||[],this._distances=[0];for(let e=1;e<this.points.length;e++)this._distances[e]=this._distances[e-1]+this.points[e].dist(this.points[e-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(t||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(e){if(1===this.points.length)return this.points[0];e=t.ah(e,0,1);let i=1,r=this._distances[i],a=e*this.paddedLength+this.padding;for(;r<a&&i<this._distances.length;)r=this._distances[++i];let n=i-1,s=this._distances[n],o=r-s,l=o>0?(a-s)/o:0;return this.points[n].mult(1-l).add(this.points[i].mult(l))}}function ev(e,t){let i=!0;return"always"===e||"never"!==e&&"never"!==t||(i=!1),i}class eb{constructor(e,t,i){const r=this.boxCells=[],a=this.circleCells=[];this.xCellCount=Math.ceil(e/i),this.yCellCount=Math.ceil(t/i);for(let e=0;e<this.xCellCount*this.yCellCount;e++)r.push([]),a.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=t,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/t,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,t,i,r,a){this._forEachCell(t,i,r,a,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(t),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(a)}insertCircle(e,t,i,r){this._forEachCell(t-r,i-r,t+r,i+r,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(t),this.circles.push(i),this.circles.push(r)}_insertBoxCell(e,t,i,r,a,n){this.boxCells[a].push(n)}_insertCircleCell(e,t,i,r,a,n){this.circleCells[a].push(n)}_query(e,t,i,r,a,n,s){if(i<0||e>this.width||r<0||t>this.height)return[];let o=[];if(e<=0&&t<=0&&this.width<=i&&this.height<=r){if(a)return[{key:null,x1:e,y1:t,x2:i,y2:r}];for(let e=0;e<this.boxKeys.length;e++)o.push({key:this.boxKeys[e],x1:this.bboxes[4*e],y1:this.bboxes[4*e+1],x2:this.bboxes[4*e+2],y2:this.bboxes[4*e+3]});for(let e=0;e<this.circleKeys.length;e++){let t=this.circles[3*e],i=this.circles[3*e+1],r=this.circles[3*e+2];o.push({key:this.circleKeys[e],x1:t-r,y1:i-r,x2:t+r,y2:i+r})}}else this._forEachCell(e,t,i,r,this._queryCell,o,{hitTest:a,overlapMode:n,seenUids:{box:{},circle:{}}},s);return o}query(e,t,i,r){return this._query(e,t,i,r,!1,null)}hitTest(e,t,i,r,a,n){return this._query(e,t,i,r,!0,a,n).length>0}hitTestCircle(e,t,i,r,a){let n=e-i,s=e+i,o=t-i,l=t+i;if(s<0||n>this.width||l<0||o>this.height)return!1;let h=[];return this._forEachCell(n,o,s,l,this._queryCellCircle,h,{hitTest:!0,overlapMode:r,circle:{x:e,y:t,radius:i},seenUids:{box:{},circle:{}}},a),h.length>0}_queryCell(e,t,i,r,a,n,s,o){let{seenUids:l,hitTest:h,overlapMode:u}=s,c=this.boxCells[a];if(null!==c){let a=this.bboxes;for(let s of c)if(!l.box[s]){l.box[s]=!0;let c=4*s,d=this.boxKeys[s];if(e<=a[c+2]&&t<=a[c+3]&&i>=a[c+0]&&r>=a[c+1]&&(!o||o(d))&&(!h||!ev(u,d.overlapMode))&&(n.push({key:d,x1:a[c],y1:a[c+1],x2:a[c+2],y2:a[
2c+3]}),h))return!0}}let d=this.circleCells[a];if(null!==d){let a=this.circles;for(let s of d)if(!l.circle[s]){l.circle[s]=!0;let c=3*s,d=this.circleKeys[s];if(this._circleAndRectCollide(a[c],a[c+1],a[c+2],e,t,i,r)&&(!o||o(d))&&(!h||!ev(u,d.overlapMode))){let e=a[c],t=a[c+1],i=a[c+2];if(n.push({key:d,x1:e-i,y1:t-i,x2:e+i,y2:t+i}),h)return!0}}}return!1}_queryCellCircle(e,t,i,r,a,n,s,o){let{circle:l,seenUids:h,overlapMode:u}=s,c=this.boxCells[a];if(null!==c){let e=this.bboxes;for(let t of c)if(!h.box[t]){h.box[t]=!0;let i=4*t,r=this.boxKeys[t];if(this._circleAndRectCollide(l.x,l.y,l.radius,e[i+0],e[i+1],e[i+2],e[i+3])&&(!o||o(r))&&!ev(u,r.overlapMode))return n.push(!0),!0}}let d=this.circleCells[a];if(null!==d){let e=this.circles;for(let t of d)if(!h.circle[t]){h.circle[t]=!0;let i=3*t,r=this.circleKeys[t];if(this._circlesCollide(e[i],e[i+1],e[i+2],l.x,l.y,l.radius)&&(!o||o(r))&&!ev(u,r.overlapMode))return n.push(!0),!0}}}_forEachCell(e,t,i,r,a,n,s,o){let l=this._convertToXCellCoord(e),h=this._convertToYCellCoord(t),u=this._convertToXCellCoord(i),c=this._convertToYCellCoord(r);for(let d=l;d<=u;d++)for(let l=h;l<=c;l++)if(a.call(this,e,t,i,r,this.xCellCount*l+d,n,s,o))return}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,t,i,r,a,n){let s=r-e,o=a-t,l=i+n;return l*l>s*s+o*o}_circleAndRectCollide(e,t,i,r,a,n,s){let o=(n-r)/2,l=Math.abs(e-(r+o));if(l>o+i)return!1;let h=(s-a)/2,u=Math.abs(t-(a+h));if(u>h+i)return!1;if(l<=o||u<=h)return!0;let c=l-o,d=u-h;return c*c+d*d<=i*i}}function ew(e,i,r){var a,n,s,o,l;let h=t.L();if(!e){let{vecSouth:e,vecEast:t}=eT(i),r=c();r[0]=t[0],r[1]=t[1],r[2]=e[0],r[3]=e[1],(l=(a=r[0])*(o=r[3])-(s=r[2])*(n=r[1])
2)&&(r[0]=o*(l=1/l),r[1]=-n*l,r[2]=-s*l,r[3]=a*l),h[0]=r[0],h[1]=r[1],h[4]=r[2],h[5]=r[3]}return t.N(h,h,[1/r,1/r,1]),h}function eT(e){let i=Math.cos(e.rollInRadians),r=Math.sin(e.rollInRadians),a=Math.cos(e.pitchInRadians),n=Math.cos(e.bearingInRadians),s=Math.sin(e.bearingInRadians),o=t.ar();o[0]=-n*a*r-s*i,o[1]=-s*a*r+n*i;let l=t.as(o);l<1e-9?t.at(o):t.au(o,o,1/l);let h=t.ar();h[0]=n*a*i-s*r,h[1]=s*a*i+n*r;let u=t.as(h);return u<1e-9?t.at(h):t.au(h,h,1/u),{vecEast:h,vecSouth:o}}function eP(e,i,r,a){let n;a?(n=[e,i,a(e,i),1],t.aw(n,n,r)):eB(n=[e,i,0,1],n,r);let s=n[3];return{point:new t.P(n[0]/s,n[1]/s),signedDistanceFromCamera:s,isOccluded:!1}}function eS(e,t,i,r,a,n,s,o){let l=n.glyphStartIndex+n.numGlyphs,h=n.lineStartIndex,u=n.lineStartIndex+n.lineLength,c=t.getoffsetX(n.glyphStartIndex),d=t.getoffsetX(l-1),p=eR(e*c,i,r,a,n.segment,h,u,o,s);if(!p)return null;let f=eR(e*d,i,r,a,n.segment,h,u,o,s);return f?o.projectionCache.anyProjectionOccluded?null:{first:p,last:f}:null}function eM(e,i,r,a){return e===t.ao.horizontal&&Math.abs(r.y-i.y)>Math.abs(r.x-i.x)*a?{useVertical:!0}:(e===t.ao.vertical?i.y<r.y:i.x>r.x)?{needsFlipping:!0}:null}function eC(e){let i,{projectionContext:r,pitchedLabelPlaneMatrixInverse:a,symbol:n,fontSize:s,flip:o,keepUpright:l,glyphOffsetArray:h,dynamicLayoutVertexArray:u,aspectRatio:c,rotateToLine:d}=e,p=s/24,f=n.lineOffsetX*p,m=n.lineOffsetY*p;if(n.numGlyphs>1){let e=n.glyphStartIndex+n.numGlyphs,t=n.lineStartIndex,s=n.lineStartIndex+n.lineLength,u=eS(p,h,f,m,o,n,d,r);if(!u)return{notEnoughRoom:!0};let _=ez(u.first.point.x,u.first.point.y,r,a),g=ez(u.last.point.x,u.last.point.y,r,a);if(l&&!o){let e=eM(n.writingMode,_,g,c);if(e)return e}i=[u.first];for(let a=n.glyphStartIndex+1;a<e-1;a++){let e=eR(p*h.getoffsetX(a),f,m,o,n.segment,t,s,r,d);if(!e)return{notEnoughRoom:!0};i.push(e)}i.push(u.last)}else{if(l&&!o){let e=eE(r.tileAnchorPoint.x,r.tileAnchorPoint.y,r).point,i=n.lineStartIndex+n.segment+1,s=new t.P(r.lineVertexArray.getx(i),r.lineVertexArray.gety(i)),o=eE(s.x,s.y,r),l=o.signedDistanceFromCamera>0?o.point:eI(r.tileAnchorPoint,s,e,1,r),h=ez(e.x,e.y,r,a),u=ez(l.x,l.y,r,a),d=eM(n.writingMode,h,u,c);if(d)return d}let e=eR(p*h.getoffsetX(n.glyphStartIndex),f,m,o,n.segment,n.lineStartIndex,n.lineStartIndex+n.lineLength,r,d);if(!e||r.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};i=[e]}for(let e of i)t.av(u,e.point,e.angle);return{}}function eI(e,t,i,r,a){let n=e.add(e.sub(t)._unit()),s=eE(n.x,n.y,a).point,o=i.sub(s);return i.add(o._mult(r/o.mag()))}function eA(e,i,r){let a=i.projectionCache;if(a.projections[e])return a.projections[e];let n=new t.P(i.lineVertexArray.getx(e),i.lineVertexArray.gety(e)),s=eE(n.x,n.y,i);if(s.signedDistanceFromCamera>0)return a.projections[e]=s.point,a.anyProjectionOccluded=a.anyProjectionOccluded||s.isOccluded,s.point;let o=e-r.direction;return eI(0===r.distanceFromAnchor?i.tileAnchorPoint:new t.P(i.lineVertexArray.getx(o),i.lineVertexArray.gety(o)),n,r.previousVertex,r.absOffsetX-r.distanceFromAnchor+1,i)}function eE(e,t,i){let r,a=e+i.translation[0],n=t+i.translation[1];return i.pitchWithMap?(r=eP(a,n,i.pitchedLabelPlaneMatrix,i.getElevation)).isOccluded=!1:((r=i.transform.projectTileCoordinates(a,n,i.unwrappedTileID,i.getElevation)).point.x=(.5*r.point.x+.5)*i.width,r.point.y=(-(.5*r.point.y)+.5)*i.height),r}function ez(e,i,r,a){if(r.pitchWithMap){let n=[e,i,0,1];return t.aw(n,n,a),r.transform.projectTileCoordinates(n[0]/n[3],n[1]/n[3],r.unwrappedTileID,r.getElevation).point}return{x:e/r.width*2-1,y:1-i/r.height*2}}function ek(e,t,i){return i.transform.projectTileCoordinates(e,t,i.unwrappedTileID,i.getElevation)}function eD(e,t,i){return e._unit()._perp()._mult(t*i)}function eR(e,i,r,a,n,s,o,l,h){let u,c=a?e-i:e+i,d=c>0?1:-1,p=0;a&&(d*=-1,p=Math.PI),d<0&&(p+=Math.PI);let f,m=d>0?s+n:s+n+1;l.projectionCache.cachedAnchorPoint?f=l.projectionCache.cachedAnchorPoint:(f=eE(l.tileAnchorPoint.x,l.tileAnchorPoint.y,l).point,l.projectionCache.cachedAnchorPoint=f);let _,g,y=f,x=f,v=0,b=0,w=Math.abs(c),T=[];for(;v+b<=w;){if((m+=d)<s||m>=o)return null;v+=b,x=y,g=_;let e={absOffsetX:w,direction:d,distanceFromAnchor:v,previousVertex:x};if(y=eA(m,l,e),0===r)T.push(x),u=y.sub(x);else{let i,a=y.sub(x);
2i=0===a.mag()?eD(eA(m+d,l,e).sub(y),r,d):eD(a,r,d),g||(g=x.add(i)),_=function(e,i,r,a,n,s,o,l,h){if(l.projectionCache.offsets[e])return l.projectionCache.offsets[e];let u=r.add(i);if(e+h.direction<a||e+h.direction>=n)return l.projectionCache.offsets[e]=u,u;let c=eA(e+h.direction,l,h),d=eD(c.sub(r),o,h.direction),p=r.add(d),f=c.add(d);return l.projectionCache.offsets[e]=t.ax(s,u,p,f)||u,l.projectionCache.offsets[e]}(m,i,y,s,o,g,r,l,e),T.push(g),u=_.sub(g)}b=u.mag()}let P=u._mult((w-v)/b)._add(g||x),S=p+Math.atan2(y.y-x.y,y.x-x.x);return T.push(P),{point:P,angle:h?S:0,path:T}}let eL=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function eF(e,t){for(let i=0;i<e;i++){let e=t.length;t.resize(e+4),t.float32.set(eL,3*e)}}function eB(e,t,i){let r=t[0],a=t[1];return e[0]=i[0]*r+i[4]*a+i[12],e[1]=i[1]*r+i[5]*a+i[13],e[3]=i[3]*r+i[7]*a+i[15],e}class eO{constructor(e,t=new eb(e.width+200,e.height+200,25),i=new eb(e.width+200,e.height+200,25)){this.transform=e,this.grid=t,this.ignoredGrid=i,this.pitchFactor=Math.cos(e.pitch*Math.PI/180)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+100,this.screenBottomBoundary=e.height+100,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(e,t,i,r,a,n,s,o,l,h,u,c){let d,p=this.projectAndGetPerspectiveRatio(e.anchorPointX+o[0],e.anchorPointY+o[1],a,h,c),f=i*p.perspectiveRatio;if(n||s)d=this._projectCollisionBox(e,f,r,a,n,s,o,p,h,u,c);else{let t=p.x+(u?u.x*f:0),i=p.y+(u?u.y*f:0);d={allPointsOccluded:!1,box:[t+e.x1*f,i+e.y1*f,t+e.x2*f,i+e.y2*f]}}let[m,_,g,y]=d.box,x=n?d.allPointsOccluded:p.isOccluded,v=x;return v||(v=p.perspectiveRatio<this.perspectiveRatioCutoff),v||(v=!this.isInsideGrid(m,_,g,y)),v||"always"!==t&&this.grid.hitTest(m,_,g,y,t,l)?{box:[m,_,g,y],placeable:!1,offscreen:!1,occluded:x}:{box:[m,_,g,y],placeable:!0,offscreen:this.isOffscreen(m,_,g,y),occluded:x}}placeCollisionCircles(e,i,r,a,n,s,o,l,h,u,c,d,p,f){let m=[],_=new t.P(i.anchorX,i.anchorY),g=this.getPerspectiveRatio(_.x,_.y,s,f),y=(h?n*this.transform.getPitchedTextCorrection(i.anchorX,i.anchorY,s)/g:n*g)/t.aB,x={getElevation:f,pitchedLabelPlaneMatrix:o,lineVertexArray:r,pitchWithMap:h,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:this.transform,tileAnchorPoint:_,unwrappedTileID:s,width:this.transform.width,height:this.transform.height,translation:p},v=eS(y,a,i.lineOffsetX*y,i.lineOffsetY*y,!1,i,!1,x),b=!1,w=!1,T=!0;if(v){let i=.5*c*g+d,r=new t.P(-100,-100),a=new t.P(this.screenRightBoundary,this.screenBottomBoundary),n=new ex,s=v.first,o=v.last,p=[];for(let e=s.path.length-1;e>=1;e--)p.push(s.path[e]);for(let e=1;e<o.path.length;e++)p.push(o.path[e]);let f=2.5*i;if(h){let e=this.projectPathToScreenSpace(p,x);p=e.some(e=>e.signedDistanceFromCamera<=0)?[]:e.map(e=>e.point)}let _=[];if(p.length>0){let e=p[0].clone(),i=p[0].clone();for(let t=1;t<p.length;t++)e.x=Math.min(e.x,p[t].x),e.y=Math.min(e.y,p[t].y),i.x=Math.max(i.x,p[t].x),i.y=Math.max(i.y,p[t].y);_=e.x>=r.x&&i.x<=a.x&&e.y>=r.y&&i.y<=a.y?[p]:i.x<r.x||e.x>a.x||i.y<r.y||e.y>a.y?[]:t.ay([p],r.x,r.y,a.x,a.y)}for(let t of _){n.reset(t,.25*i);let r=0;r=n.length<=.5*i?1:Math.ceil(n.paddedLength/f)+1;for(let t=0;t<r;t++){let a=t/Math.max(r-1,1),s=n.lerp(a),o=s.x+100,h=s.y+100;m.push(o,h,i,0);let c=o-i,d=h-i,p=o+i,f=h+i;if(T=T&&this.isOffscreen(c,d,p,f),w=w||this.isInsideGrid(c,d,p,f),"always"!==e&&this.grid.hitTestCircle(o,h,i,e,u)&&(b=!0,!l))return{circles:[],offscreen:!1,collisionDetected:b}}}}return{circles:!l&&b||!w||g<this.perspectiveRatioCutoff?[]:m,offscreen:T,collisionDetected:b}}projectPathToScreenSpace(e,i){let r;return function(e){let t=0,i=0,r=0,a=0;for(let n=0;n<e.length;n++)e[n].isOccluded?(r=n+1,a=0):++a>i&&(i=a,t=r);return e.slice(t,t+i)}((r=t.L(),t.aq(r,i.pitchedLabelPlaneMatrix),e.map(e=>{let t=eP(e.x,e.y,r,i.getElevation),a=i.transform.projectTileCoordinates(t.point.x,t.point.y,i.unwrappedTileID,i.getElevation);return a.point.x=(.5*a.point.x+.5)*i.width,a.point.y=(-(.5*a.point.y)+.5)*i.height,a})))}queryRenderedSymbols(e){if(0===e.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};let i=[],r=new t.a2;for(let a of e){let e=new t.P(a.x+100,a.y+100);r.extend(e),i.push(e)}let{minX:a,minY:n,maxX:s,maxY:o}=r,l=this.grid.query(a,n,s,o).concat(this.ignoredGrid.query(a,n,s,o)),h={},u={};for(let e of l){let r=e.key;if(void 0===h[r.bucketInstanceId]&&(h[r.bucketInstanceId]={}),h[r.bucketInstanceId][r.featureIndex])continue;let a=[new t.P(e.x1,e.y1),new t.P(e.x2,e.y1),new t.P(e.x2,e.y2),new t.P(e.x1,e.y2)];t.az(i,a)&&(h[r.bucketInstanceId][r.featureIndex]=!0,void 0===u[r.bucketInstanceId]&&(u[r.bucketInstanceId]=[]),u[r.bucketInstanceId].push(r.featureIndex))}return u}insertCollisionBox(e,t,i,r,a,n){(i?this.ignoredGrid:this.grid).insert({bucketInstanceId:r,featureIndex:a,collisionGroupID:n,overlapMode:t},e[0],e[1],e[2],e[3])}insertCollisionCircles(e,t,i,r,a,n){let s=i?this.ignoredGrid:this.grid,o={bucketInstanceId:r,featureIndex:a,collisionGroupID:n,overlapMode:t};for(let t=0;t<e.length;
2t+=4)s.insertCircle(o,e[t],e[t+1],e[t+2])}projectAndGetPerspectiveRatio(e,i,r,a,n){if(n){let r;a?(r=[e,i,a(e,i),1],t.aw(r,r,n)):eB(r=[e,i,0,1],r,n);let s=r[3];return{x:(r[0]/s+1)/2*this.transform.width+100,y:(-r[1]/s+1)/2*this.transform.height+100,perspectiveRatio:.5+this.transform.cameraToCenterDistance/s*.5,isOccluded:!1,signedDistanceFromCamera:s}}{let t=this.transform.projectTileCoordinates(e,i,r,a);return{x:(t.point.x+1)/2*this.transform.width+100,y:(1-t.point.y)/2*this.transform.height+100,perspectiveRatio:.5+this.transform.cameraToCenterDistance/t.signedDistanceFromCamera*.5,isOccluded:t.isOccluded,signedDistanceFromCamera:t.signedDistanceFromCamera}}}getPerspectiveRatio(e,t,i,r){let a=this.transform.projectTileCoordinates(e,t,i,r);return .5+this.transform.cameraToCenterDistance/a.signedDistanceFromCamera*.5}isOffscreen(e,t,i,r){return i<100||e>=this.screenRightBoundary||r<100||t>this.screenBottomBoundary}isInsideGrid(e,t,i,r){return i>=0&&e<this.gridRightBoundary&&r>=0&&t<this.gridBottomBoundary}getViewportMatrix(){let e=t.ag([]);return t.M(e,e,[-100,-100,0]),e}_projectCollisionBox(e,i,r,a,n,s,o,l,h,u,c){let d=1,p=0,f=0,m=1,_=e.anchorPointX+o[0],g=e.anchorPointY+o[1];if(s&&!n){let e=this.projectAndGetPerspectiveRatio(_+1,g,a,h,c),t=e.x-l.x,i=Math.atan((e.y-l.y)/t)+(t<0?Math.PI:0),r=Math.sin(i),n=Math.cos(i);d=n,p=r,f=-r,m=n}else if(!s&&n){let e=eT(this.transform);d=e.vecEast[0],p=e.vecEast[1],f=e.vecSouth[0],m=e.vecSouth[1]}let y=l.x,x=l.y,v=i;n&&(y=_,x=g,v=Math.pow(2,-(this.transform.zoom-r.overscaledZ))*this.transform.getPitchedTextCorrection(_,g,a),u||(v*=t.ah(.5+l.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))),u&&(y+=d*u.x*v+f*u.y*v,x+=p*u.x*v+m*u.y*v);let b=e.x1*v,w=e.x2*v,T=(b+w)/2,P=e.y1*v,S=e.y2*v,M=(P+S)/2,C=[];for(let{offsetX:e,offsetY:i}of[{offsetX:b,offsetY:P},{offsetX:T,offsetY:P},{offsetX:w,offsetY:P},{offsetX:w,offsetY:M},{offsetX:w,offsetY:S},{offsetX:T,offsetY:S},{offsetX:b,offsetY:S},{offsetX:b,offsetY:M}])C.push(new t.P(y+d*e+f*i,x+p*e+m*i));let I=!1;if(n){let e=C.map(e=>this.projectAndGetPerspectiveRatio(e.x,e.y,a,h,c));I=e.some(e=>!e.isOccluded),C=e.map(e=>new t.P(e.x,e.y))}else I=!0;return{box:t.aA(C),allPointsOccluded:!I}}}class ej{constructor(e,t,i,r){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?t:-t))):r&&i?1:0,this.placed=i}isHidden(){return 0===this.opacity&&!this.placed}}class eV{constructor(e,t,i,r,a){this.text=new ej(e?e.text:null,t,i,a),this.icon=new ej(e?e.icon:null,t,r,a)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class eU{constructor(e,t,i){this.text=e,this.icon=t,this.skipFade=i}}class eN{constructor(e,t,i,r,a){this.bucketInstanceId=e,this.featureIndex=t,this.sourceLayerIndex=i,this.bucketIndex=r,this.tileID=a}}class e${constructor(e){this.crossSourceCollisions=e,this.maxGroupID=0,this.collisionGroups={}}get(e){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[e]){let t=++this.maxGroupID;this.collisionGroups[e]={ID:t,predicate:e=>e.collisionGroupID===t}}return this.collisionGroups[e]}}function eZ(e,i,r,a,n){let{horizontalAlign:s,verticalAlign:o}=t.aH(e);return new t.P(-(s-.5)*i+a[0]*n,-(o-.5)*r+a[1]*n)}class eG{constructor(e,t,i,r,a){this.transform=e.clone(),this.terrain=t,this.collisionIndex=new eO(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=i,this.retainedQueryData={},this.collisionGroups=new e$(r),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=a,a&&(a.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(e){let t=this.terrain;return t?(i,r)=>t.getElevation(e,i,r):null}getBucketParts(e,i,r,a){let n=r.getBucket(i),s=r.latestFeatureIndex;if(!n||!s||i.id!==n.layerIds[0])return;let o=r.collisionBoxArray,l=n.layers[0].layout,h=n.layers[0].paint,u=Math.pow(2,this.transform.zoom-r.tileID.overscaledZ),c=r.tileSize/t.$,d=r.tileID.toUnwrapped(),p="map"===l.get("text-rotation-alignment"),f=t.aC(r,1,this.transform.zoom),m=t.aD(this.collisionIndex.transform,r,h.get("text-translate"),h.get("text-translate-anchor")),_=t.aD(this.collisionIndex.transform,r,h.get("icon-translate"),h.get("icon-translate-anchor")),g=ew(p,this.transform,f);this.retainedQueryData[n.bucketInstanceId]=new eN(n.bucketInstanceId,s,n.sourceLayerIndex,n.index,r.tileID);let y={bucket:n,layout:l,translationText:m,translationIcon:_,unwrappedTileID:d,pitchedLabelPlaneMatr
2ix:g,scale:u,textPixelRatio:c,holdingForFade:r.holdingForFade(),collisionBoxArray:o,partiallyEvaluatedTextSize:t.an(n.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(n.sourceID)};if(a)for(let t of n.sortKeyRanges){let{sortKey:i,symbolInstanceStart:r,symbolInstanceEnd:a}=t;e.push({sortKey:i,symbolInstanceStart:r,symbolInstanceEnd:a,parameters:y})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:n.symbolInstances.length,parameters:y})}attemptAnchorPlacement(e,i,r,a,n,s,o,l,h,u,c,d,p,f,m,_,g,y,x,v){let b=t.aE[e.textAnchor],w=[e.textOffset0,e.textOffset1],T=eZ(b,r,a,w,n),P=this.collisionIndex.placeCollisionBox(i,d,l,h,u,o,s,_,c.predicate,x,T,v);if((!y||this.collisionIndex.placeCollisionBox(y,d,l,h,u,o,s,g,c.predicate,x,T,v).placeable)&&P.placeable){let e;if(this.prevPlacement&&this.prevPlacement.variableOffsets[p.crossTileID]&&this.prevPlacement.placements[p.crossTileID]&&this.prevPlacement.placements[p.crossTileID].text&&(e=this.prevPlacement.variableOffsets[p.crossTileID].anchor),0===p.crossTileID)throw Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[p.crossTileID]={textOffset:w,width:r,height:a,anchor:b,textBoxScale:n,prevAnchor:e},this.markUsedJustification(f,b,p,m),f.allowVerticalPlacement&&(this.markUsedOrientation(f,m,p),this.placedOrientations[p.crossTileID]=m),{shift:T,placedGlyphBoxes:P}}}placeLayerBucketPart(e,i,r){let{bucket:a,layout:n,translationText:s,translationIcon:o,unwrappedTileID:l,pitchedLabelPlaneMatrix:h,textPixelRatio:u,holdingForFade:c,collisionBoxArray:d,partiallyEvaluatedTextSize:p,collisionGroup:f}=e.parameters,m=n.get("text-optional"),_=n.get("icon-optional"),g=t.aF(n,"text-overlap","text-allow-overlap"),y="always"===g,x=t.aF(n,"icon-overlap","icon-allow-overlap"),v="always"===x,b="map"===n.get("text-rotation-alignment"),w="map"===n.get("text-pitch-alignment"),T="none"!==n.get("icon-text-fit"),P="viewport-y"===n.get("symbol-z-order"),S=y&&(v||!a.hasIconData()||_),M=v&&(y||!a.hasTextData()||m);!a.collisionArrays&&d&&a.deserializeCollisionBoxes(d);let C=this.retainedQueryData[a.bucketInstanceId].tileID,I=this._getTerrainElevationFunc(C),A=this.transform.getFastPathSimpleProjectionMatrix(C),E=(e,d,v)=>{var P,E;if(i[e.crossTileID])return;if(c)return void(this.placements[e.crossTileID]=new eU(!1,!1,!1));let z=!1,k=!1,D=!0,R=null,L={box:null,placeable:!1,offscreen:null,occluded:!1},F={placeable:!1},B=null,O=null,j=null,V=0,U=0,N=0;d.textFeatureIndex?V=d.textFeatureIndex:e.useRuntimeCollisionCircles&&(V=e.featureIndex),d.verticalTextFeatureIndex&&(U=d.verticalTextFeatureIndex);let $=d.textBox;if($){let i=i=>{let r=t.ao.horizontal;if(a.allowVerticalPlacement&&!i&&this.prevPlacement){let t=this.prevPlacement.placedOrientations[e.crossTileID];t&&(this.placedOrientations[e.crossTileID]=t,r=t,this.markUsedOrientation(a,r,e))}return r},n=(i,r)=>{if(a.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&d.verticalTextBox){for(let e of a.writingModes)if(e===t.ao.vertical?F=L=r():L=i(),L&&L.placeable)break}else L=i()},h=e.textAnchorOffsetStartIndex,c=e.textAnchorOffsetEndIndex;if(c===h){let r=(t,i)=>{let r=this.collisionIndex.placeCollisionBox(t,g,u,C,l,w,b,s,f.predicate,I,void 0,A);return r&&r.placeable&&(this.markUsedOrientation(a,i,e),this.placedOrientations[e.crossTileID]=i),r};n(()=>r($,t.ao.horizontal),()=>{let i=d.verticalTextBox;return a.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&i?r(i,t.ao.vertical):{box:null,offscreen:null}}),i(L&&L.placeable)}else{let p=t.aE[null==(E=null==(P=this.prevPlacement)?void 0:P.variableOffsets[e.crossTileID])?void 0:E.anchor],m=(t,i,n)=>{let d=t.x2-t.x1,m=t.y2-t.y1,_=e.textBoxScale,y=T&&"never"===x?i:null,v=null,P="never"===g?1:2,S="never";p&&P++;for(let i=0;i<P;i++){for(let i=h;i<c;i++){let r=a.textAnchorOffsets.get(i);if(p&&r.textAnchor!==p)continue;let h=this.attemptAnchorPlacement(r,t,d,m,_,b,w,u,C,l,f,S,e,a,n,s,o,y,I);if(h&&(v=h.placedGlyphBoxes)&&v.placeable)return z=!0,R=h.shift,v}p?p=null:S=g}return r&&!v&&(v={box:this.collisionIndex.placeCollisionBox($,"always",u,C,l,w,b,s,f.predicate,I,void 0,A).box,offscreen:!1,placeable:!1,occluded:!1}),v};n(()=>m($,d.iconBox,t.ao.horizontal),()=>{let i=d.verticalTextBox;return a.allowVerticalPlacement&&(!L||!L.placeable)&&e.numVerticalGlyphVertices>0&&i?m(i,d.verticalIconBox,t.ao.vertical):{box:null,occluded:!0,offscreen:null}}),L&&(z=L.placeable,D=L.offscreen);let _=i(L&&L.placeable);if(!z&&this.prevPlacement){let t=this.prevPlacement.variableOffsets[e.crossTileID];t&&(this.variableOffsets[e.crossTileID]=t,this.markUsedJustification(a,t.anchor,e,_))}}}if(z=(B=L)&&B.placeable,D=B&&B.offscreen,e.useRuntimeCollisionCircles){let i=a.text.placedSymbolArray.get(e.centerJustifiedTextSymbolIndex),o=t.ap(a.textSizeData,p,i),u=n.get("text-padding");(O=this.collisionIndex.placeCollisionCircles(g,i,a.lineVertexArray,a.glyphOffsetArray,o,l,h,r,w,f.predicate,e.collisionCircleDiameter,u,s,I)).circles.length&&O.collisionDetected&&!r&&t.w("Collisions detected, but collision boxes are not shown"),z=y||O.circles.length>0&&!O.collisionDetected,D=D&&O.offscreen}if(d.iconFeatureIndex&&(N=d.iconFeatureIndex),d.iconBox){let e=e=>this.collisionIndex.placeCollisionBox(e,x,u,C,l,w,b,o,f.predicate,I,T&&R?R:void 0,A);k=F&&F.placeable&&d.verticalIconBox?(j=e(d.verticalIconBox)).placeable:(j=e(d.iconBox)).placeable,D=D&&j.offscreen}let Z=m||0===e.numHorizontalGlyphVertices&&0===e.numVerticalGlyphVertices,G=_||0===e.numIconVertices;Z||G?G?Z||(k=k&&z):z=k&&z:k=z=k&&z;let q=k&&j.placeable;if(z&&B.placeable&&this.collisionIndex.insertCollisionBox(B.box,g,n.get("text-ignore-placement"),a.bucketInstanceId,F&&F.placeable&&U?U:V,f.ID),q&&this.collisionIndex.insertCollisionBox(j.box,x,n.get("icon-ignore-placement"),a.bucketInstanceId,N,f.ID),O&&z&&this.collisionIndex.insertCollisionCircles(O.circles,g,n.get("text-ignore-placement"),a.bucketInstanceId,V,f.ID),r&&this.storeCollisionData(a.bucketInstanceId,v,d,B,j,O),0===e.crossTileID)throw Error("symbolInstance.crossTileID can't be 0");if(0===a.bucketInstanceId)throw Error("bucket.bucketInstanceId can't be 0");this.placements[e.crossTileID]=new eU((z||S)&&!(null==B?void 0:B.occluded),(k||M)&&!(null==j?void 0:j.occluded),D||a.justReloaded),i[e.crossTileID]=!0};if(P){if(0!==e.symbolInstanceStart)throw Error("bucket.bucketInstanceId should be 0");
2let t=a.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let e=t.length-1;e>=0;--e){let i=t[e];E(a.symbolInstances.get(i),a.collisionArrays[i],i)}}else for(let t=e.symbolInstanceStart;t<e.symbolInstanceEnd;t++)E(a.symbolInstances.get(t),a.collisionArrays[t],t);a.justReloaded=!1}storeCollisionData(e,t,i,r,a,n){if(i.textBox||i.iconBox){let n,s;this.collisionBoxArrays.has(e)?n=this.collisionBoxArrays.get(e):(n=new Map,this.collisionBoxArrays.set(e,n)),n.has(t)?s=n.get(t):(s={text:null,icon:null},n.set(t,s)),i.textBox&&(s.text=r.box),i.iconBox&&(s.icon=a.box)}if(n){let t=this.collisionCircleArrays[e];void 0===t&&(t=this.collisionCircleArrays[e]=[]);for(let e=0;e<n.circles.length;e+=4)t.push(n.circles[e+0]-100),t.push(n.circles[e+1]-100),t.push(n.circles[e+2]),t.push(+!!n.collisionDetected)}}markUsedJustification(e,i,r,a){let n;for(let s of(n=a===t.ao.vertical?r.verticalPlacedTextSymbolIndex:({left:r.leftJustifiedTextSymbolIndex,center:r.centerJustifiedTextSymbolIndex,right:r.rightJustifiedTextSymbolIndex})[t.aG(i)],[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex,r.verticalPlacedTextSymbolIndex]))s>=0&&(e.text.placedSymbolArray.get(s).crossTileID=n>=0&&s!==n?0:r.crossTileID)}markUsedOrientation(e,i,r){let a=i===t.ao.horizontal||i===t.ao.horizontalOnly?i:0,n=i===t.ao.vertical?i:0;for(let t of[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex])e.text.placedSymbolArray.get(t).placedOrientation=a;r.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(r.verticalPlacedTextSymbolIndex).placedOrientation=n)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;let t=this.prevPlacement,i=!1;this.prevZoomAdjustment=t?t.zoomAdjustment(this.transform.zoom):0;let r=t?t.symbolFadeChange(e):1,a=t?t.opacities:{},n=t?t.variableOffsets:{},s=t?t.placedOrientations:{};for(let e in this.placements){let t=this.placements[e],n=a[e];n?(this.opacities[e]=new eV(n,r,t.text,t.icon),i=i||t.text!==n.text.placed||t.icon!==n.icon.placed):(this.opacities[e]=new eV(null,r,t.text,t.icon,t.skipFade),i=i||t.text||t.icon)}for(let e in a){let t=a[e];if(!this.opacities[e]){let a=new eV(t,r,!1,!1);a.isHidden()||(this.opacities[e]=a,i=i||t.text.placed||t.icon.placed)}}for(let e in n)this.variableOffsets[e]||!this.opacities[e]||this.opacities[e].isHidden()||(this.variableOffsets[e]=n[e]);for(let e in s)this.placedOrientations[e]||!this.opacities[e]||this.opacities[e].isHidden()||(this.placedOrientations[e]=s[e]);if(t&&void 0===t.lastPlacementChangeTime)throw Error("Last placement time for previous placement is not defined");i?this.lastPlacementChangeTime=e:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=t?t.lastPlacementChangeTime:e)}updateLayerOpacities(e,t){let i={};for(let r of t){let t=r.getBucket(e);t&&r.latestFeatureIndex&&e.id===t.layerIds[0]&&this.updateBucketOpacities(t,r.tileID,i,r.collisionBoxArray)}}updateBucketOpacities(e,i,r,a){e.hasTextData()&&(e.text.opacityVertexArray.clear(),e.text.hasVisibleVertices=!1),e.hasIconData()&&(e.icon.opacityVertexArray.clear(),e.icon.hasVisibleVertices=!1),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();let n=e.layers[0],s=n.layout,o=new eV(null,0,!1,!1,!0),l=s.get("text-allow-overlap"),h=s.get("icon-allow-overlap"),u=n._unevaluatedLayout.hasValue("text-variable-anchor")||n._unevaluatedLayout.hasValue("text-variable-anchor-offset"),c="map"===s.get("text-rotation-alignment"),d="map"===s.get("text-pitch-alignment"),p="none"!==s.get("icon-text-fit"),f=new eV(null,0,l&&(h||!e.hasIconData()||s.get("icon-optional")),h&&(l||!e.hasTextData()||s.get("text-optional")),!0);!e.collisionArrays&&a&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(a);let m=(e,t,i)=>{for(let r=0;r<t/4;r++)e.opacityVertexArray.emplaceBack(i);e.hasVisibleVertices=e.hasVisibleVertices||i!==eH},_=this.collisionBoxArrays.get(e.bucketInstanceId);for(let i=0;i<e.symbolInstances.length;i++){let a=e.symbolInstances.get(i),{numHorizontalGlyphVertices:n,numVerticalGlyphVertices:s,crossTileID:l}=a,h=this.opacities[l];r[l]?h=o:h||(h=f,this.opacities[l]=h),r[l]=!0;let g=a.numIconVertices>0,y=this.placedOrientations[a.crossTileID],x=y===t.ao.vertical,v=y===t.ao.horizontal||y===t.ao.horizontalOnly;if(n>0||s>0){let t=eW(h.text);m(e.text,n,x?eH:t),m(e.text,s,v?eH:t);let i=h.text.isHidden();[a.rightJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.leftJustifiedTextSymbolIndex].forEac
2h(t=>{t>=0&&(e.text.placedSymbolArray.get(t).hidden=i||x?1:0)}),a.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(a.verticalPlacedTextSymbolIndex).hidden=i||v?1:0);let r=this.variableOffsets[a.crossTileID];r&&this.markUsedJustification(e,r.anchor,a,y);let o=this.placedOrientations[a.crossTileID];o&&(this.markUsedJustification(e,"left",a,o),this.markUsedOrientation(e,o,a))}if(g){let t=eW(h.icon),i=!(p&&a.verticalPlacedIconSymbolIndex&&x);a.placedIconSymbolIndex>=0&&(m(e.icon,a.numIconVertices,i?t:eH),e.icon.placedSymbolArray.get(a.placedIconSymbolIndex).hidden=h.icon.isHidden()),a.verticalPlacedIconSymbolIndex>=0&&(m(e.icon,a.numVerticalIconVertices,i?eH:t),e.icon.placedSymbolArray.get(a.verticalPlacedIconSymbolIndex).hidden=h.icon.isHidden())}let b=_&&_.has(i)?_.get(i):{text:null,icon:null};if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){let r=e.collisionArrays[i];if(r){let i=new t.P(0,0);if(r.textBox||r.verticalTextBox){let t=!0;if(u){let e=this.variableOffsets[l];e?(i=eZ(e.anchor,e.width,e.height,e.textOffset,e.textBoxScale),c&&i._rotate(d?-this.transform.bearingInRadians:this.transform.bearingInRadians)):t=!1}if(r.textBox||r.verticalTextBox){let a;r.textBox&&(a=x),r.verticalTextBox&&(a=v),eq(e.textCollisionBox.collisionVertexArray,h.text.placed,!t||a,b.text,i.x,i.y)}}if(r.iconBox||r.verticalIconBox){let t,a=!!(!v&&r.verticalIconBox);r.iconBox&&(t=a),r.verticalIconBox&&(t=!a),eq(e.iconCollisionBox.collisionVertexArray,h.icon.placed,t,b.icon,p?i.x:0,p?i.y:0)}}}}if(e.sortFeatures(-this.transform.bearingInRadians),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.text.opacityVertexArray.length!==e.text.layoutVertexArray.length/4)throw Error(`bucket.text.opacityVertexArray.length (= ${e.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${e.text.layoutVertexArray.length}) / 4`);if(e.icon.opacityVertexArray.length!==e.icon.layoutVertexArray.length/4)throw Error(`bucket.icon.opacityVertexArray.length (= ${e.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${e.icon.layoutVertexArray.length}) / 4`);e.bucketInstanceId in this.collisionCircleArrays&&(e.collisionCircleArray=this.collisionCircleArrays[e.bucketInstanceId],delete this.collisionCircleArrays[e.bucketInstanceId])}symbolFadeChange(e){return 0===this.fadeDuration?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(e,t){let i=this.zoomAtLastRecencyCheck===t?1-this.zoomAdjustment(t):1;return this.zoomAtLastRecencyCheck=t,this.commitTime+this.fadeDuration*i>e}setStale(){this.stale=!0}}function eq(e,t,i,r,a,n){r&&0!==r.length||(r=[0,0,0,0]);let s=r[0]-100,o=r[1]-100,l=r[2]-100,h=r[3]-100;e.emplaceBack(+!!t,+!!i,a||0,n||0,s,o),e.emplaceBack(+!!t,+!!i,a||0,n||0,l,o),e.emplaceBack(+!!t,+!!i,a||0,n||0,l,h),e.emplaceBack(+!!t,+!!i,a||0,n||0,s,h)}function eW(e){if(0===e.opacity&&!e.placed)return 0;if(1===e.opacity&&e.placed)return 0xffffffff;let t=+!!e.placed,i=Math.floor(127*e.opacity);return 0x2000000*i+0x1000000*t+131072*i+65536*t+512*i+256*t+2*i+t}let eH=0;class eX{constructor(e){this._sortAcrossTiles="viewport-y"!==e.layout.get("symbol-z-order")&&!e.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(e,t,i,r,a){let n=this._bucketParts;for(;this._currentTileIndex<e.length;)if(t.getBucketParts(n,r,e[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,a())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,n.sort((e,t)=>
2e.sortKey-t.sortKey));this._currentPartIndex<n.length;)if(t.placeLayerBucketPart(n[this._currentPartIndex],this._seenCrossTileIDs,i),this._currentPartIndex++,a())return!0;return!1}}class eY{constructor(e,t,i,r,a,n,s,o){this.placement=new eG(e,t,n,s,o),this._currentPlacementIndex=i.length-1,this._forceFullPlacement=r,this._showCollisionBoxes=a,this._done=!1}isDone(){return this._done}continuePlacement(e,t,i){let r=d.now(),a=()=>!this._forceFullPlacement&&d.now()-r>2;for(;this._currentPlacementIndex>=0;){let r=t[e[this._currentPlacementIndex]],n=this.placement.collisionIndex.transform.zoom;if("symbol"===r.type&&(!r.minzoom||r.minzoom<=n)&&(!r.maxzoom||r.maxzoom>n)){if(this._inProgressLayer||(this._inProgressLayer=new eX(r)),this._inProgressLayer.continuePlacement(i[r.source],this.placement,this._showCollisionBoxes,r,a))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}}let eK=512/t.$/2;class eJ{constructor(e,i,r){this.tileID=e,this.bucketInstanceId=r,this._symbolsByKey={};const a=new Map;for(let e=0;e<i.length;e++){const t=i.get(e),r=t.key,n=a.get(r);n?n.push(t):a.set(r,[t])}for(const[e,i]of a){const r={positions:i.map(e=>({x:Math.floor(e.anchorX*eK),y:Math.floor(e.anchorY*eK)})),crossTileIDs:i.map(e=>e.crossTileID)};if(r.positions.length>128){const e=new t.aI(r.positions.length,16,Uint16Array);for(const{x:t,y:i}of r.positions)e.add(t,i);e.finish(),delete r.positions,r.index=e}this._symbolsByKey[e]=r}}getScaledCoordinates(e,i){let{x:r,y:a,z:n}=this.tileID.canonical,{x:s,y:o,z:l}=i.canonical,h=eK/Math.pow(2,l-n),u=(o*t.$+e.anchorY)*h,c=a*t.$*eK;return{x:Math.floor((s*t.$+e.anchorX)*h-r*t.$*eK),y:Math.floor(u-c)}}findMatches(e,t,i){let r=this.tileID.canonical.z<t.canonical.z?1:Math.pow(2,this.tileID.canonical.z-t.canonical.z);for(let a=0;a<e.length;a++){let n=e.get(a);if(n.crossTileID)continue;let s=this._symbolsByKey[n.key];if(!s)continue;let o=this.getScaledCoordinates(n,t);if(s.index)for(let e of s.index.range(o.x-r,o.y-r,o.x+r,o.y+r).sort()){let t=s.crossTileIDs[e];if(!i[t]){i[t]=!0,n.crossTileID=t;break}}else if(s.positions)for(let e=0;e<s.positions.length;e++){let t=s.positions[e],a=s.crossTileIDs[e];if(Math.abs(t.x-o.x)<=r&&Math.abs(t.y-o.y)<=r&&!i[a]){i[a]=!0,n.crossTileID=a;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:e})=>e)}}class eQ{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class e0{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){let t=Math.round((e-this.lng)/360);if(0!==t)for(let e in this.indexes){let i=this.indexes[e],r={};for(let e in i){let a=i[e];a.tileID=a.tileID.unwrapTo(a.tileID.wrap+t),r[a.tileID.key]=a}this.indexes[e]=r}this.lng=e}addBucket(e,t,i){if(this.indexes[e.overscaledZ]&&this.indexes[e.overscaledZ][e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===t.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let e=0;e<t.symbolInstances.length;e++)t.symbolInstances.get(e).crossTileID=0;this.usedCrossTileIDs[e.overscaledZ]||(this.usedCrossTileIDs[e.overscaledZ]={});let r=this.usedCrossTileIDs[e.overscaledZ];for(let i in this.indexes){let a=this.indexes[i];if(Number(i)>e.overscaledZ)for(let i in a){let n=a[i];n.tileID.isChildOf(e)&&n.findMatches(t.symbolInstances,e,r)}else{let n=a[e.scaledTo(Number(i)).key];n&&n.findMatches(t.symbolInstances,e,r)}}for(let e=0;e<t.symbolInstances.length;e++){let a=t.symbolInstances.get(e);a.crossTileID||(a.crossTileID=i.generate(),r[a.crossTileID]=!0)}return void 0===this.indexes[e.overscaledZ]&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new eJ(e,t.symbolInstances,t.bucketInstanceId),!0}removeBucketCrossTileIDs(e,t){for(let i of t.getCrossTileIDsLists())for(let t of i)delete this.usedCrossTileIDs[e][t]}removeStaleBuckets(e){let t=!1;for(let i in this.indexes){let r=this.indexes[i];for(let a in r)e[r[a].bucketInstanceId]||(this.removeBucketCrossTileIDs(i,r[a]),delete r[a],t=!0)}return t}}class e1{constructor(){this.layerIndexes={},this.crossTileIDs=new eQ,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,t,i){let r=this.layerIndexes[e.id];void 0===r&&(r=this.layerIndexes[e.id]=new e0);let a=!1,n={};for(let s of(r.handleWrapJump(i),t)){let t=s.getBucket(e);t&&e.id===t.layerIds[0]&&(t.bucketInstanceId||(t.bucketInstanceId=++this.maxBucketInstanceId),r.addBucket(s.tileID,t,this.crossTileIDs)&&(a=!0),n[t.bucketInstanceId]=!0)}return r.removeStaleBuckets(n)&&(a=!0),a}pruneUnusedLayers(e){let t={};
2for(let i in e.forEach(e=>{t[e]=!0}),this.layerIndexes)t[i]||delete this.layerIndexes[i]}}var e2="void main() {fragColor=vec4(1.0);}";let e3={prelude:e5("#ifdef GL_ES\nprecision mediump float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nout highp vec4 fragColor;","#ifdef GL_ES\nprecision highp float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}mat3 rotationMatrixFromAxisAngle(vec3 u,float angle) {float c=cos(angle);float s=sin(angle);float c2=1.0-c;return mat3(u.x*u.x*c2+ c,u.x*u.y*c2-u.z*s,u.x*u.z*c2+u.y*s,u.y*u.x*c2+u.z*s,u.y*u.y*c2+ c,u.y*u.z*c2-u.x*s,u.z*u.x*c2-u.y*s,u.z*u.y*c2+u.x*s,u.z*u.z*c2+ c\n);}\n#ifdef TERRAIN3D\nuniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;\n#endif\nconst highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {\n#ifdef TERRAIN3D\nhighp float d=unpack(texture(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));\n#else\nreturn 1.0;\n#endif\n}float calculate_visibility(vec4 pos) {\n#ifdef TERRAIN3D\nvec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;\n#else\nreturn 1.0;\n#endif\n}float ele(vec2 pos) {\n#ifdef TERRAIN3D\nvec4 rgb=(texture(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;\n#else\nreturn 0.0;\n#endif\n}float get_elevation(vec2 pos) {\n#ifdef TERRAIN3D\n#ifdef GLOBE\nif ((pos.y <-32767.5) || (pos.y > 32766.5)) {return 0.0;}\n#endif\nvec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;\n#else\nreturn 0.0;\n#endif\n}const float PI=3.141592653589793;uniform mat4 u_projection_matrix;"),projectionMercator:e5("","float projectLineThickness(float tileY) {return 1.0;}float projectCircleRadius(float tileY) {return 1.0;}vec4 projectTile(vec2 p) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);return result;}vec4 projectTile(vec2 p,vec2 rawPos) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);if (rawPos.y <-32767.5 || rawPos.y > 32766.5) {result.z=-10000000.0;}return result;}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_projection_matrix*vec4(posInTile,elevation,1.0);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {return projectTileWithElevation(posInTile,elevation);}"),projectionGlobe:e5("","#define GLOBE_RADIUS 6371008.8\nuniform highp vec4 u_projection_tile_mercator_coords;uniform highp vec4 u_projection_clipping_plane;uniform highp float u_projection_transition;uniform mat4 u_projection_fallback_matrix;vec3 globeRotateVector(vec3 vec,vec2 angles) {vec3 axisRight=vec3(vec.z,0.0,-vec.x);vec3 axisUp=cross(axisRight,vec);axisRight=normalize(axisRight);axisUp=normalize(axisUp);vec2 t=tan(angles);return normalize(vec+axisRight*t.x+axisUp*t.y);}mat3 globeGetRotationMatrix(vec3 spherePos) {vec3 axisRight=vec3(spherePos.z,0.0,-spherePos.x);vec3 axisDown=cross(axisRight,spherePos);axisRight=normalize(axisRight);axisDown=normalize(axisDown);return mat3(axisRight,axisDown,spherePos\n);}float circumferenceRatioAtTileY(float tileY) {float mercator_pos_y=u_projection_tile_mercator_coords.y+u_projection_tile_mercator_coords.w*tileY;float spherical_y=2.0*atan(exp(PI-(mercator_pos_y*PI*2.0)))-PI*0.5;return cos(spherical_y);}float projectLineThickness(float tileY) {float thickness=1.0/circumferenceRatioAtTileY(tileY); \nif (u_projection_transition < 0.999) {return mix(1.0,thickness,u_projection_transition);} else {return thickness;}}vec3 projectToSphere(vec2 translatedPos,vec2 rawPos) {vec2 mercator_pos=u_projection_tile_mercator_coords.xy+u_projection_tile_mercator_coords.zw*translatedPos;vec2 spherical;spherical.x=mercator_pos.x*PI*2.0+PI;spherical.y=2.0*atan(exp(PI-(mercator_pos.y*PI*2.0)))-PI*0.5;float len=cos(spherical.y);vec3 pos=vec3(sin(spherical.x)*len,sin(spherical.y),cos(spherical.x)*len\n);if (rawPos.y <-32767.5) {pos=vec3(0.0,1.0,0.0);}if (rawPos.y > 32766.5) {pos=vec3(0.0,-1.0,0.0);}return pos;}vec3 projectToSphere(vec2 posInTile) {return projectToSphere(posInTile,vec2(0.0,0.0));}float globeComputeClippingZ(vec3 spherePos) {return (1.0-(dot(spherePos,u_projection_clipping_plane.xyz)+u_projection_clipping_plane.w));}vec4 interpolateProjection(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);globePosition.z=globeComputeClippingZ(elevatedPos)*globePosition.w;if (u_projection_transition > 0.999) {return globePosition;}vec4 flatPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);const float z_globeness_threshold=0.2;vec4 result=globePosition;result.z=mix(0.0,globePosition.z,clamp((u_projection_transition-z_globeness_threshold)/(1.0-z_globeness_threshold),0.0,1.0));result.xyw=mix(flatPosition.xyw,globePosition.xyw,u_projection_transition);if ((posInTile.y <-32767.5) || (posInTile.y > 32766.5)) {result=globePosition;const float poles_hidden_anim_percentage=0.02;result.z=mix(globePosition.z,100.0,pow(max((1.0-u_projection_transition)/poles_hidden_anim_percentage,0.0),8.0));}return result;}vec4 interpolateProjectionFor3D(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);if (u_projection_transition > 0.999) {return globePosition;}vec4 fallbackPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);return mix(fallbackPosition,globePosition,u_projection_transition);}vec4 projectTile(vec2 posInTile) {return interpolateProjection(posInTile,projectToSphere(posInTile),0.0);}vec4 projectTile(vec2 posInTile,vec2 rawPos) {return interpolateProjection(posInTile,projectToSphere(posInTile,rawPos),0.0);}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return interpolateProjection(posInTile,projectToSphere(posInTile),elevation);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {vec3 spherePos=projectToSphere(posInTile,posInTile);return interpolateProjectionFor3D(posInTile,spherePos,elevation);}"),background:e5("uniform vec4 u_color;uniform float u_opacity;void main() {fragColor=u_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),backgroundPattern:e5("uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;
2uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_mix)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;void main() {gl_Position=projectTile(a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:e5("in vec3 v_data;in float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);float antialiased_blur=v_data.z;float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));fragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);const float epsilon=0.5/255.0;if (fragColor.r < epsilon && fragColor.g < epsilon && fragColor.b < epsilon && fragColor.a < epsilon) {discard;}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform highp float u_globe_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;uniform vec2 u_translate;in vec2 a_pos;out vec3 v_data;out float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 pos_raw=a_pos+32768.0;vec2 extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);vec2 circle_center=floor(pos_raw/8.0)+u_translate;float ele=get_elevation(circle_center);v_visibility=calculate_visibility(projectTileWithElevation(circle_center,ele));if (u_pitch_with_map) {\n#ifdef GLOBE\nvec3 center_vector=projectToSphere(circle_center);\n#endif\nfloat angle_scale=u_globe_extrude_scale;vec2 corner_position=circle_center;if (u_scale_with_map) {angle_scale*=(radius+stroke_width);corner_position+=extrude*u_extrude_scale*(radius+stroke_width);} else {\n#ifdef GLOBE\nvec4 projected_center=interpolateProjection(circle_center,center_vector,ele);\n#else\nvec4 projected_center=projectTileWithElevation(circle_center,ele);\n#endif\ncorner_position+=extrude*u_extrude_scale*(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);angle_scale*=(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);}\n#ifdef GLOBE\nvec2 angles=extrude*angle_scale;vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(corner_position,corner_vector,ele);\n#else\ngl_Position=projectTileWithElevation(corner_position,ele);\n#endif\n} else {gl_Position=projectTileWithElevation(circle_center,ele);if (gl_Position.z/gl_Position.w > 1.0) {gl_Position.xy=vec2(10000.0);}if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}float antialiasblur=-max(1.0/u_device_pixel_ratio/(radius+stroke_width),blur);v_data=vec3(extrude.x,extrude.y,antialiasblur);}"),clippingMask:e5(e2,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),heatmap:e5("uniform highp float u_intensity;in vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);fragColor=vec4(val,1.0,1.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;uniform highp float u_globe_extrude_scale;in vec2 a_pos;out vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 pos_raw=a_pos+32768.0;vec2 unscaled_extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 circle_center=floor(pos_raw/8.0);\n#ifdef GLOBE\nvec2 angles=v_extrude*radius*u_globe_extrude_scale;vec3 center_vector=projectToSphere(circle_center);vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(circle_center+extrude,corner_vector,0.0);\n#else\ngl_Position=projectTileFor3D(circle_center+extrude,get_elevation(circle_center));\n#endif\n}"),heatmapTexture:e5("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));fragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(0.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:e5("in float v_placed;in float v_notUsed;void main() {float alpha=0.5;fragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {fragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {fragColor*=.1;}}","in vec2 a_anchor_pos;in vec2 a_placed;in vec2 a_box_real;uniform vec2 u_pixel_extrude_scale;out float v_placed;out float v_notUsed;void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:e5("in float v_radius;in vec2 v_extrude;in float v_collision;void main() {float alpha=0.5;float stroke_radius=0.9;float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);fragColor=color*alpha*opacity_t;}","in vec2 a_pos;in float a_radius;in vec2 a_flags;uniform vec2 u_viewport_size;out float v_radius;out vec2 v_extrude;out float v_collision;void main() {float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_collision=collision;gl_Position=vec4((a_pos/u_viewport_size*2.0-1.0)*vec2(1.0,-1.0),0.0,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),colorRelief:e5("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;uniform vec4 u_unpack;uniform sampler2D u_elevation_stops;uniform sampler2D u_color_stops;uniform int u_color_ramp_size;uniform float u_opacity;in vec2 v_pos;float getElevation(vec2 coord) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}float getElevationStop(int stop) {float x=(float(stop)+0.5)/float(u_color_ramp_size);vec4 data=texture(u_elevation_stops,vec2(x,0))*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {float el=getElevation(v_pos);int r=(u_color_ramp_size-1);int l=0;float el_l=getElevationStop(l);float el_r=getElevationStop(r);while(r-l > 1){int m=(r+l)/2;float el_m=getElevationStop(m);if(el < el_m){r=m;el_r=el_m;}else\n{l=m;el_l=el_m;}}float x=(float(l)+(el-el_l)/(el_r-el_l)+0.5)/float(u_color_ramp_size);fragColor=u_opacity*texture(u_color_stops,vec2(x,0));\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_dimension;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_pos/8192.0)*scale+epsilon;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),debug:e5("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);fragColor=mix(u_color,overlay_color,overlay_color.a);}","in vec2 a_pos;out vec2 v_uv;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=projectTileWithElevation(a_pos*u_overlay_scale,get_elevation(a_pos));}"),depth:e5(e2,"in vec2 a_pos;void main() {\n#ifdef GLOBE\ngl_Position=projectTileFor3D(a_pos,0.0);\n#else\ngl_Position=u_projection_matrix*vec4(a_pos,0.0,1.0);\n#endif\n}"),fill:e5("#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\nfragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_fill_translate;in vec2 a_pos;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=projectTile(a_pos+u_fill_translate,a_pos);}"),fillOutline:e5("in vec2 v_pos;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=outline_color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_world;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n}"),fillOutlinePattern:e5("uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;in vec2 v_pos_a;in vec2 v_pos_b;in vec2 v_pos;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=mix(color1,color2,u_fade)*alpha*opacity;\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;out vec2 v_pos;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n}"),fillPattern:e5("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_fade)*opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=patte
2rn_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}"),fillExtrusion:e5("in vec4 v_color;void main() {fragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;in vec2 a_pos;in vec4 a_normal_ed;\n#ifdef TERRAIN3D\nin vec2 a_centroid;\n#endif\nout vec4 v_color;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec3 normal=a_normal_ed.xyz;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;\n#ifdef GLOBE\nvec3 spherePos=projectToSphere(posInTile,a_pos);gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);\n#else\ngl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);\n#endif\nfloat colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;vec3 normalForLighting=normal/16384.0;float directional=clamp(dot(normalForLighting,u_lightpos),0.0,1.0);\n#ifdef GLOBE\nmat3 rotMatrix=globeGetRotationMatrix(spherePos);normalForLighting=rotMatrix*normalForLighting;directional=mix(directional,clamp(dot(normalForLighting,u_lightpos_globe),0.0,1.0),u_projection_transition);\n#endif\ndirectional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}"),fillExtrusionPattern:e5("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;in vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);fragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;in vec2 a_pos;in vec4 a_normal_ed;\n#ifdef TERRAIN3D\nin vec2 a_centroid;\n#endif\n#ifdef GLOBE\nout vec3 v_sphere_pos;\n#endif\nout vec2 v_pos_a;out vec2 v_pos_b;out vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;\n#ifdef GLOBE\nvec3 spherePos=projectToSphere(posInTile,a_pos);vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);v_sphere_pos=elevatedPos;gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);\n#else\ngl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);\n#endif\nvec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\n? a_pos\n: vec2(edgedistance,elevation*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}"),hillshadePrepare:e5("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {vec2 epsilon=1.0/u_dimension;float tileSize=u_dimension.x-2.0;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))*tileSize/p
2ow(2.0,exaggeration+(28.2562-u_zoom));fragColor=clamp(vec4(deriv.x/8.0+0.5,deriv.y/8.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:e5("uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform float u_exaggeration;uniform vec4 u_accent;uniform int u_method;uniform float u_altitudes[NUM_ILLUMINATION_SOURCES];uniform float u_azimuths[NUM_ILLUMINATION_SOURCES];uniform vec4 u_shadows[NUM_ILLUMINATION_SOURCES];uniform vec4 u_highlights[NUM_ILLUMINATION_SOURCES];\n#define PI 3.141592653589793\n#define STANDARD 0\n#define COMBINED 1\n#define IGOR 2\n#define MULTIDIRECTIONAL 3\n#define BASIC 4\nfloat get_aspect(vec2 deriv){return deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);}void igor_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float aspect=get_aspect(deriv);float azimuth=u_azimuths[0]+PI;float slope_stength=atan(length(deriv))*2.0/PI;float aspect_strength=1.0-abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);float shadow_strength=slope_stength*aspect_strength;float highlight_strength=slope_stength*(1.0-aspect_strength);fragColor=u_shadows[0]*shadow_strength+u_highlights[0]*highlight_strength;}void standard_hillshade(vec2 deriv){float azimuth=u_azimuths[0]+PI;float slope=atan(0.625*length(deriv));float aspect=get_aspect(deriv);float intensity=u_exaggeration;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadows[0],u_highlights[0],shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);fragColor=accent_color*(1.0-shade_color.a)+shade_color;}void basic_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor=u_highlights[0]*(2.0*shade-1.0);}else\n{fragColor=u_shadows[0]*(1.0-2.0*shade);}}void multidirectional_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;fragColor=vec4(0,0,0,0);for(int i=0; i < NUM_ILLUMINATION_SOURCES; i++){float cos_alt=cos(u_altitudes[i]);float sin_alt=sin(u_altitudes[i]);float cos_az=-cos(u_azimuths[i]);float sin_az=-sin(u_azimuths[i]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor+=u_highlights[i]*(2.0*shade-1.0)/float(NUM_ILLUMINATION_SOURCES);}else\n{fragColor+=u_shadows[i]*(1.0-2.0*shade)/float(NUM_ILLUMINATION_SOURCES);}}}void combined_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=acos((sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv)));cang=clamp(cang,0.0,PI/2.0);float shade=cang*atan(length(deriv))*4.0/PI/PI;float highlight=(PI/2.0-cang)*atan(length(deriv))*4.0/PI/PI;fragColor=u_shadows[0]*shade+u_highlights[0]*highlight;}void main() {vec4 pixel=texture(u_image,v_pos);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));vec2 deriv=((pixel.rg*8.0)-4.0)/scaleFactor;if (u_method==BASIC) {basic_hillshade(deriv);} else if (u_method==COMBINED) {combined_hillshade(deriv);} else if (u_method==IGOR) {igor_hillshade(deriv);} else if (u_method==MULTIDIRECTIONAL) {multidirectional_hillshade(deriv);} else if (u_method==STANDARD) {standard_hillshade(deriv);} else {standard_hillshade(deriv);}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);v_pos=a_pos/8192.0;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),line:e5("uniform lowp float u_device_pixel_ratio;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp float v_linesofar;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);
2float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}"),lineGradient:e5("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec2 v_uv;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture(u_image,v_uv);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;in float a_uv_x;in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}"),linePattern:e5("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;in vec2 v_normal;in vec2 v_width2;in float v_linesofar;in float v_gamma_scale;in float v_width;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture(u_image,pos_a),texture(u_image,pos_b),u_fade);fragColor=color*alpha*opacity;\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nin vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_linesofar;out float v_gamma_scale;out float v_width;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);
2float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}"),lineSDF:e5("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture(u_image,v_tex_a).a;float sdfdist_b=texture(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nin vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;out vec2 v_normal;out vec2 v_width2;out vec2 v_tex_a;out vec2 v_tex_b;out float v_gamma_scale;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}"),raster:e5("uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;in vec2 v_pos0;in vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture(u_image0,v_pos0);vec4 color1=texture(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);fragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;uniform vec4 u_coords_top;uniform vec4 u_coords_bottom;in vec2 a_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {vec2 fractionalPos=a_pos/8192.0;vec2 position=mix(mix(u_coords_top.xy,u_coords_top.zw,fractionalPos.x),mix(u_coords_bottom.xy,u_coords_bottom.zw,fractionalPos.x),fractionalPos.y);gl_Position=projectTile(position,position);v_pos0=((fractionalPos-0.5)/u_buffer_scale)+0.5;\n#ifdef GLOBE\nif (a_pos.y <-32767.5) {v_pos0.y=0.0;}if (a_pos.y > 32766.5) {v_pos0.y=1.0;}\n#endif\nv_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),symbolIcon:e5("uniform sampler2D u_texture;in vec2 v_tex;in float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;fragColor=texture(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_tex;out float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}"),symbolSDF:e5("#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;in vec2 v_data0;in vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);if (u_is_halo) {lowp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha=min(smoothstep(halo_edge-gamma_scaled,halo_edge+gamma_scaled,dist),1.0-alpha);}fragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_data0;out vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}"),symbolTextAndIcon:e5("#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;in vec4 v_data0;in vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: i
2nitialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;fragColor=texture(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);fragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","in vec4 a_pos_offset;in vec4 a_data;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec4 v_data0;out vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map && !u_is_along_line) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}"),terrain:e5("uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;uniform bool u_is_globe_mode;in vec2 v_texture_pos;in float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture(u_texture,vec2(v_texture_pos.x,1.0-v_texture_pos.y));if (!u_is_globe_mode && v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);
2float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);fragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {fragColor=surface_color;}}","in vec3 a_pos3d;uniform mat4 u_fog_matrix;uniform float u_ele_delta;out vec2 v_texture_pos;out float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}"),terrainDepth:e5("in float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {fragColor=pack(v_depth);}","in vec3 a_pos3d;uniform float u_ele_delta;out float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);v_depth=gl_Position.z/gl_Position.w;}"),terrainCoords:e5("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;in vec2 v_texture_pos;void main() {vec4 rgba=texture(u_texture,v_texture_pos);fragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}","in vec3 a_pos3d;uniform float u_ele_delta;out vec2 v_texture_pos;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);}"),projectionErrorMeasurement:e5("in vec4 v_output_error_encoded;void main() {fragColor=v_output_error_encoded;}","in vec2 a_pos;uniform highp float u_input;uniform highp float u_output_expected;out vec4 v_output_error_encoded;void main() {float real_output=2.0*atan(exp(PI-(u_input*PI*2.0)))-PI*0.5;float error=real_output-u_output_expected;float abs_error=abs(error)*128.0;v_output_error_encoded.x=min(floor(abs_error*256.0),255.0)/255.0;abs_error-=v_output_error_encoded.x;v_output_error_encoded.y=min(floor(abs_error*65536.0),255.0)/255.0;abs_error-=v_output_error_encoded.x/255.0;v_output_error_encoded.z=min(floor(abs_error*16777216.0),255.0)/255.0;v_output_error_encoded.w=error >=0.0 ? 1.0 : 0.0;gl_Position=vec4(a_pos,0.0,1.0);}"),atmosphere:e5("in vec3 view_direction;uniform vec3 u_sun_pos;uniform vec3 u_globe_position;uniform float u_globe_radius;uniform float u_atmosphere_blend;/**Shader use from https:*Made some change to adapt to MapLibre Globe geometry*/const float PI=3.141592653589793;const int iSteps=5;const int jSteps=3;/*radius of the planet*/const float EARTH_RADIUS=6371e3;/*radius of the atmosphere*/const float ATMOS_RADIUS=6471e3;vec2 rsi(vec3 r0,vec3 rd,float sr) {float a=dot(rd,rd);float b=2.0*dot(rd,r0);float c=dot(r0,r0)-(sr*sr);float d=(b*b)-4.0*a*c;if (d < 0.0) return vec2(1e5,-1e5);return vec2((-b-sqrt(d))/(2.0*a),(-b+sqrt(d))/(2.0*a));}vec4 atmosphere(vec3 r,vec3 r0,vec3 pSun,float iSun,float rPlanet,float rAtmos,vec3 kRlh,float kMie,float shRlh,float shMie,float g) {pSun=normalize(pSun);r=normalize(r);vec2 p=rsi(r0,r,rAtmos);if (p.x > p.y) {return vec4(0.0,0.0,0.0,1.0);}if (p.x < 0.0) {p.x=0.0;}vec3 pos=r0+r*p.x;vec2 p2=rsi(r0,r,rPlanet);if (p2.x <=p2.y && p2.x > 0.0) {p.y=min(p.y,p2.x);}float iStepSize=(p.y-p.x)/float(iSteps);float iTime=p.x+iStepSize*0.5;vec3 totalRlh=vec3(0,0,0);vec3 totalMie=vec3(0,0,0);float iOdRlh=0.0;float iOdMie=0.0;float mu=dot(r,pSun);float mumu=mu*mu;float gg=g*g;float pRlh=3.0/(16.0*PI)*(1.0+mumu);float pMie=3.0/(8.0*PI)*((1.0-gg)*(mumu+1.0))/(pow(1.0+gg-2.0*mu*g,1.5)*(2.0+gg));for (int i=0; i < iSteps; i++) {vec3 iPos=r0+r*iTime;float iHeight=length(iPos)-rPlanet;float odStepRlh=exp(-iHeight/shRlh)*iStepSize;float odStepMie=exp(-iHeight/shMie)*iStepSize;iOdRlh+=odStepRlh;iOdMie+=odStepMie;float jStepSize=rsi(iPos,pSun,rAtmos).y/float(jSteps);float jTime=jStepSize*0.5;float jOdRlh=0.0;float jOdMie=0.0;for (int j=0; j < jSteps; j++) {vec3 jPos=iPos+pSun*jTime;float jHeight=length(jPos)-rPlanet;jOdRlh+=exp(-jHeight/shRlh)*jStepSize;jOdMie+=exp(-jHeight/shMie)*jStepSize;jTime+=jStepSize;}vec3 attn=exp(-(kMie*(iOdMie+jOdMie)+kRlh*(iOdRlh+jOdRlh)));totalRlh+=odStepRlh*attn;totalMie+=odStepMie*attn;iTime+=iStepSize;}float opacity=exp(-(length(kRlh)*length(totalRlh)+kMie*length(totalMie)));vec3 color=iSun*(pRlh*kRlh*totalRlh+pMie*kMie*totalMie);return vec4(color,opacity);}void main() {vec3 scale_camera_pos=-u_globe_position*EARTH_RADIUS/u_globe_radius;vec4 color=atmosphere(normalize(view_direction),scale_camera_pos,u_sun_pos,22.0,EARTH_RADIUS,ATMOS_RADIUS,vec3(5.5e-6,13.0e-6,22.4e-6),21e-6,8e3,1.2e3,0.758\n);color.rgb=1.0-exp(-1.0*color.rgb);color=pow(color,vec4(1.0/2.2));fragColor=vec4(color.rgb,1.0-color.a)*u_atmosphere_blend;}","in vec2 a_pos;uniform mat4 u_inv_proj_matrix;out vec3 view_direction;void main() {view_direction=(u_inv_proj_matrix*vec4(a_pos,0.0,1.0)).xyz;gl_Position=vec4(a_pos,0.0,1.0);}"),sky:e5("uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform vec2 u_horizon;uniform vec2 u_horizon_normal;uniform float u_sky_horizon_blend;uniform float u_sky_blend;void main() {float x=gl_FragCoord.x;float y=gl_FragCoord.y;float blend=(y-u_horizon.y)*u_horizon_normal.y+(x-u_horizon.x)*u_horizon_normal.x;if (blend > 0.0) {if (blend < u_sky_horizon_blend) {fragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {fragColor=u_sky_color;}}fragColor=mix(fragColor,vec4(vec3(0.0),0.0),u_sky_blend);}","in vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}")};
2function e5(e,t){let i=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,r=t.match(/in ([\w]+) ([\w]+)/g),a=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),n=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),s=n?n.concat(a):a,o={};return{fragmentSource:e=e.replace(i,(e,t,i,r,a)=>(o[a]=!0,"define"===t?` 3#ifndef HAS_UNIFORM_u_${a} 4in ${i} ${r} ${a}; 5#else 6uniform ${i} ${r} u_${a}; 7#endif 8`:` 9#ifdef HAS_UNIFORM_u_${a} 10 ${i} ${r} ${a} = u_${a}; 11#endif 12`)),vertexSource:t=t.replace(i,(e,t,i,r,a)=>{let n="float"===r?"vec2":"vec4",s=a.match(/color/)?"color":n;return o[a]?"define"===t?` 13#ifndef HAS_UNIFORM_u_${a} 14uniform lowp float u_${a}_t; 15in ${i} ${n} a_${a}; 16out ${i} ${r} ${a}; 17#else 18uniform ${i} ${r} u_${a}; 19#endif 20`:"vec4"===s?` 21#ifndef HAS_UNIFORM_u_${a} 22 ${a} = a_${a}; 23#else 24 ${i} ${r} ${a} = u_${a}; 25#endif 26`:` 27#ifndef HAS_UNIFORM_u_${a} 28 ${a} = unpack_mix_${s}(a_${a}, u_${a}_t); 29#else 30 ${i} ${r} ${a} = u_${a}; 31#endif 32`:"define"===t?` 33#ifndef HAS_UNIFORM_u_${a} 34uniform lowp float u_${a}_t; 35in ${i} ${n} a_${a}; 36#else 37uniform ${i} ${r} u_${a}; 38#endif 39`:"vec4"===s?` 40#ifndef HAS_UNIFORM_u_${a} 41 ${i} ${r} ${a} = a_${a}; 42#else 43 ${i} ${r} ${a} = u_${a}; 44#endif 45`:` 46#ifndef HAS_UNIFORM_u_${a} 47 ${i} ${r} ${a} = unpack_mix_${s}(a_${a}, u_${a}_t); 48#else 49 ${i} ${r} ${a} = u_${a}; 50#endif 51`}),staticAttributes:r,staticUniforms:s}}class e4{constructor(e,t,i){this.vertexBuffer=e,this.indexBuffer=t,this.segments=i}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}var e6=t.aJ([{name:"a_pos",type:"Int16",components:2}]);let e8="#define PROJECTION_MERCATOR",e9="mercator";class e7{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return!1}get shaderVariantName(){return e9}get shaderDefine(){return e8}get shaderPreludeCode(){return e3.projectionMercator}get vertexShaderPreludeCode(){return e3.projectionMercator.vertexSource}get subdivisionGranularity(){return t.aK.noSubdivision}get useGlobeControls(){return!1}get transitionState(){return 0}get latitudeErrorCorrectionRadians(){return 0}destroy(){}updateGPUdependent(e){}getMeshFromTileID(e,i,r,a,n){if(this._cachedMesh)return this._cachedMesh;let s=new t.aL;s.emplaceBack(0,0),s.emplaceBack(t.$,0),s.emplaceBack(0,t.$),s.emplaceBack(t.$,t.$);let o=e.createVertexBuffer(s,e6.members),l=t.aM.simpleSegment(0,0,4,2),h=new t.aN;h.emplaceBack(1,0,2),h.emplaceBack(1,2,3);let u=e.createIndexBuffer(h);return this._cachedMesh=new e4(o,u,l),this._cachedMesh}recalculate(){}hasTransition(){return!1}setErrorQueryLatitudeDegrees(e){}}class te{constructor(e=0,t=0,i=0,r=0){if(isNaN(e)||e<0||isNaN(t)||t<0||isNaN(i)||i<0||isNaN(r)||r<0)throw Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=e,this.bottom=t,this.left=i,this.right=r}interpolate(e,i,r){return null!=i.top&&null!=e.top&&(this.top=t.C.number(e.top,i.top,r)),null!=i.bottom&&null!=e.bottom&&(this.bottom=t.C.number(e.bottom,i.bottom,r)),null!=i.left&&null!=e.left&&(this.left=t.C.number(e.left,i.left,r)),null!=i.right&&null!=e.right&&(this.right=t.C.number(e.right,i.right,r)),this}getCenter(e,i){let r=t.ah((this.left+e-this.right)/2,0,e),a=t.ah((this.top+i-this.bottom)/2,0,i);return new t.P(r,a)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new te(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function tt(e,t){if(!e.renderWorldCopies||e.lngRange)return;let i=t.lng-e.center.lng;t.lng+=i>180?-360:360*(i<-180)}function ti(e){return Math.max(0,Math.floor(e))}class tr{constructor(e,i,r,a,n,s){this._callbacks=e,this._tileSize=512,this._renderWorldCopies=void 0===s||!!s,this._minZoom=i||0,this._maxZoom=r||22,this._minPitch=null==a?0:a,this._maxPitch=null==n?60:n,this.setMaxBounds(),this._width=0,this._height=0,this._center=new t.S(0,0),this._elevation=0,this._zoom=0,this._tileZoom=ti(this._zoom),this._scale=t.af(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new te,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=!0}apply(e,i,r){this._latRange=e.latRange,this._lngRange=e.lngRange,this._width=e.width,this._height=e.height,this._center=e.center,this._elevation=e.elevation,this._minElevationForCurrentTile=e.minElevationForCurrentTile,this._zoom=e.zoom,this._tileZoom=ti(this._zoom),this._scale=t.af(this._zoom),this._bearingInRadians=e.bearingInRadians,this._fovInRadians=e.fovInRadians,this._pitchInRadians=e.pitchInRadians,this._rollInRadians=e.rollInRadians,this._unmodified=e.unmodified,this._edgeInsets=new te(e.padding.top,e.padding.bottom,e.padding.left,e.padding.right),this._minZoom=e.minZoom,this._maxZoom=e.maxZoom,this._minPitch=e.minPitch,this._maxPitch=e.maxPitch,this._renderWorldCopies=e.renderWorldCopies,this._cameraToCenterDistance=e.cameraToCenterDistance,this._nearZ=e.nearZ,this._farZ=e.farZ,this._autoCalculateNearFarZ=!r&&e.autoCalculateNearFarZ,i&&this._constrain(),this._calcMatrices()}
51get pixelsToClipSpaceMatrix(){return this._pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._clipSpaceToPixelsMatrix}get minElevationForCurrentTile(){return this._minElevationForCurrentTile}setMinElevationForCurrentTile(e){this._minElevationForCurrentTile=e}get tileSize(){return this._tileSize}get tileZoom(){return this._tileZoom}get scale(){return this._scale}get width(){return this._width}get height(){return this._height}get bearingInRadians(){return this._bearingInRadians}get lngRange(){return this._lngRange}get latRange(){return this._latRange}get pixelsToGLUnits(){return this._pixelsToGLUnits}get minZoom(){return this._minZoom}setMinZoom(e){this._minZoom!==e&&(this._minZoom=e,this.setZoom(this.getConstrained(this._center,this.zoom).zoom))}get maxZoom(){return this._maxZoom}setMaxZoom(e){this._maxZoom!==e&&(this._maxZoom=e,this.setZoom(this.getConstrained(this._center,this.zoom).zoom))}get minPitch(){return this._minPitch}setMinPitch(e){this._minPitch!==e&&(this._minPitch=e,this.setPitch(Math.max(this.pitch,e)))}get maxPitch(){return this._maxPitch}setMaxPitch(e){this._maxPitch!==e&&(this._maxPitch=e,this.setPitch(Math.min(this.pitch,e)))}get renderWorldCopies(){return this._renderWorldCopies}setRenderWorldCopies(e){void 0===e?e=!0:null===e&&(e=!1),this._renderWorldCopies=e}get worldSize(){return this._tileSize*this._scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new t.P(this._width,this._height)}get bearing(){return this._bearingInRadians/Math.PI*180}setBearing(e){var i,r,a,n,s,o,l,h,u;let d=t.aO(e,-180,180)*Math.PI/180;this._bearingInRadians!==d&&(this._unmodified=!1,this._bearingInRadians=d,this._calcMatrices(),this._rotationMatrix=c(),i=this._rotationMatrix,a=-this._bearingInRadians,n=(r=this._rotationMatrix)[0],s=r[1],o=r[2],l=r[3],h=Math.sin(a),u=Math.cos(a),i[0]=n*u+o*h,i[1]=s*u+l*h,i[2]=-(n*h)+o*u,i[3]=-(s*h)+l*u)}get rotationMatrix(){return this._rotationMatrix}get pitchInRadians(){return this._pitchInRadians}get pitch(){return this._pitchInRadians/Math.PI*180}setPitch(e){let i=t.ah(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitchInRadians!==i&&(this._unmodified=!1,this._pitchInRadians=i,this._calcMatrices())}get rollInRadians(){return this._rollInRadians}get roll(){return this._rollInRadians/Math.PI*180}setRoll(e){let t=e/180*Math.PI;this._rollInRadians!==t&&(this._unmodified=!1,this._rollInRadians=t,this._calcMatrices())}get fovInRadians(){return this._fovInRadians}get fov(){return t.aP(this._fovInRadians)}setFov(e){e=t.ah(e,.1,150),this.fov!==e&&(this._unmodified=!1,this._fovInRadians=t.ae(e),this._calcMatrices())}get zoom(){return this._zoom}setZoom(e){let i=this.getConstrained(this._center,e).zoom;this._zoom!==i&&(this._unmodified=!1,this._zoom=i,this._tileZoom=Math.max(0,Math.floor(i)),this._scale=t.af(i),this._constrain(),this._calcMatrices())}get center(){return this._center}setCenter(e){e.lat===this._center.lat&&e.lng===this._center.lng||(this._unmodified=!1,this._center=e,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}setElevation(e){e!==this._elevation&&(this._elevation=e,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}setPadding(e){this._edgeInsets.equals(e)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,e,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this._width,this._height)}get pixelsPerMeter(){return this._pixelPerMeter}get unmodified(){return this._unmodified}get cameraToCenterDistance(){return this._cameraToCenterDistance}get nearZ(){return this._nearZ}get farZ(){return this._farZ}get autoCalculateNearFarZ(){return this._autoCalculateNearFarZ}overrideNearFarZ(e,t){this._autoCalculateNearFarZ=!1,this._nearZ=e,this._farZ=t,this._calcMatrices()}clearNearFarZOverride(){this._autoCalculateNearFarZ=!0,this._calcMatrices()}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,t,i){this._unmodified=!1,this._edgeInsets.interpolate(e,t,i),this._constrain(),this._calcMatrices()}resize(e,t,i=!0){this._width=e,this._height=t,i&&this._constrain(),this._calcMatrices()}getMaxBounds(){return this._latRange&&2===this._latRange.length&&this._lngRange&&2===this._lngRange.length?new U([this._lngRange[0],this._latRange[0]],[this._lngRange[1],this._latRange[1]]):null}setMaxBounds(e){e?(this._lngRange=[e.getWest(),e.getEast()],this._latRange=[e.getSouth(),e.getNorth()],this._constrain()):(this._lngRange=null,this._latRange=[-t.ai,t.ai])}getConstrained(e,t){return this._callbacks.getConstrained(e,t)}getCameraQueryGeometry(e,i){if(1===i.length)return[i[0],e];{let{minX:r,minY:a,maxX:n,maxY:s}=t.a2.fromPoints(i).extend(e);return[new t.P(r,a),new t.P(n,a),new t.P(n,s),new t.P(r,s),new t.P(r,a)]}}_constrain(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=!0;let e=this._unmodified,{center:t,zoom:i}=this.getConstrained(this.center,this.zoom);this.setCenter(t),this.setZoom(i),this._unmodified=e,this._constraining=!1}
51_calcMatrices(){if(this._width&&this._height){this._pixelsToGLUnits=[2/this._width,-2/this._height];let e=t.ag(new Float64Array(16));t.N(e,e,[this._width/2,-this._height/2,1]),t.M(e,e,[1,-1,0]),this._clipSpaceToPixelsMatrix=e,e=t.ag(new Float64Array(16)),t.N(e,e,[1,-1,1]),t.M(e,e,[-1,-1,0]),t.N(e,e,[2/this._width,2/this._height,1]),this._pixelsToClipSpaceMatrix=e,this._cameraToCenterDistance=.5/Math.tan(this.fovInRadians/2)*this._height}this._callbacks.calcMatrices()}calculateCenterFromCameraLngLatAlt(e,i,r,a){let n,s=void 0!==r?r:this.bearing,o=a=void 0!==a?a:this.pitch,l=t.a1.fromLngLat(e,i),h=-Math.cos(t.ae(o)),u=Math.sin(t.ae(o)),c=u*Math.sin(t.ae(s)),d=-u*Math.cos(t.ae(s)),p=this.elevation,f=i-p;h*f>=0||.1>Math.abs(h)?p=i+(n=1e4)*h:n=-f/h;let m,_,g=t.aQ(1,l.y),y=0;do{if((y+=1)>10)break;_=n/g,g=1/(m=new t.a1(l.x+c*_,l.y+d*_)).meterInMercatorCoordinateUnits()}while(Math.abs(n-_*g)>1e-12);return{center:m.toLngLat(),elevation:p,zoom:t.ak(this.height/2/Math.tan(this.fovInRadians/2)/_/this.tileSize)}}recalculateZoomAndCenter(e){if(this.elevation-e==0)return;let i=t.aj(1,this.center.lat)*this.worldSize,r=this.cameraToCenterDistance/i,a=t.a1.fromLngLat(this.center,this.elevation),n=eh(this.center,this.elevation,this.pitch,this.bearing,r);this._elevation=e;let s=this.calculateCenterFromCameraLngLatAlt(n.toLngLat(),t.aQ(n.z,a.y),this.bearing,this.pitch);this._elevation=s.elevation,this._center=s.center,this.setZoom(s.zoom)}getCameraPoint(){let e=Math.tan(this.pitchInRadians)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new t.P(e*Math.sin(this.rollInRadians),e*Math.cos(this.rollInRadians)))}getCameraAltitude(){return Math.cos(this.pitchInRadians)*this._cameraToCenterDistance/this._pixelPerMeter+this.elevation}getCameraLngLat(){let e=t.aj(1,this.center.lat)*this.worldSize;return eh(this.center,this.elevation,this.pitch,this.bearing,this.cameraToCenterDistance/e).toLngLat()}getMercatorTileCoordinates(e){if(!e)return[0,0,1,1];let i=e.canonical.z>=0?1<<e.canonical.z:Math.pow(2,e.canonical.z);return[e.canonical.x/i,e.canonical.y/i,1/i/t.$,1/i/t.$]}}class ta{constructor(e,i){this.min=e,this.max=i,this.center=t.aR([],t.aS([],this.min,this.max),.5)}quadrant(e){let i=[e%2==0,e<2],r=t.aT(this.min),a=t.aT(this.max);for(let e=0;e<i.length;e++)r[e]=i[e]?this.min[e]:this.center[e],a[e]=i[e]?this.center[e]:this.max[e];return a[2]=this.max[2],new ta(r,a)}distanceX(e){return Math.max(Math.min(this.max[0],e[0]),this.min[0])-e[0]}distanceY(e){return Math.max(Math.min(this.max[1],e[1]),this.min[1])-e[1]}intersectsFrustum(e){let t=!0;for(let i=0;i<e.planes.length;i++){let r=this.intersectsPlane(e.planes[i]);if(0===r)return 0;1===r&&(t=!1)}return t?2:e.aabb.min[0]>this.max[0]||e.aabb.min[1]>this.max[1]||e.aabb.min[2]>this.max[2]||e.aabb.max[0]<this.min[0]||e.aabb.max[1]<this.min[1]||e.aabb.max[2]<this.min[2]?0:1}intersectsPlane(e){let t=e[3],i=e[3];for(let r=0;r<3;r++)e[r]>0?(t+=e[r]*this.min[r],i+=e[r]*this.max[r]):(i+=e[r]*this.min[r],t+=e[r]*this.max[r]);return t>=0?2:i<0?0:1}}class tn{distanceToTile2d(e,t,i,r){return Math.hypot(r.distanceX([e,t]),r.distanceY([e,t]))}getWrap(e,t,i){return i}getTileBoundingVolume(e,i,r,a){var n,s;let o=0,l=0;if(null==a?void 0:a.terrain){let h=new t.Z(e.z,i,e.z,e.x,e.y),u=a.terrain.getMinMaxElevation(h);o=null!=(n=u.minElevation)?n:Math.min(0,r),l=null!=(s=u.maxElevation)?s:Math.max(0,r)}let h=1<<e.z;return new ta([i+e.x/h,e.y/h,o],[i+(e.x+1)/h,(e.y+1)/h,l])}allowVariableZoom(e,i){let r=e.fov*(Math.abs(Math.cos(e.rollInRadians))*e.height+Math.abs(Math.sin(e.rollInRadians))*e.width)/e.height,a=t.ah(78.5-r/2,0,60);return!!i.terrain||e.pitch>a}allowWorldCopies(){return!0}prepareNextFrame(){}}class ts{constructor(e,t,i){this.points=e,this.planes=t,this.aabb=i}static fromInvProjectionMatrix(e,i=1,r=0,a,n){let s=n?[[6,5,4],[0,1,2],[0,3,7],[2,1,5],[3,2,6],[0,4,5]]:[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]],o=Math.pow(2,r),l=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(r=>{let a,n;return n=1/(a=t.aw([],r,e))[3]/i*o,t.aY(a,a,[n,n,1/a[3],n])});a&&function(e,i,r,a){let n,s,o,l=4*!!a,h=4*!a,u=0,c=[],d=[];for(let i=0;i<4;i++){let r=t.aU([],e[i+h],e[i+l]),a=t.aZ(r);t.aR(r,r,1/a),c.push(a),d.push(r)}for(let i=0;i<4;i++){let a=t.a_(e[i+l],d[i],r);u=null!==a&&a>=0?Math.max(u,a):Math.max(u,c[i])}let p=(n=t.aU([],e[i[0]],e[i[1]]),s=t.aU([],e[i[2]],e[i[1]]),o=[0,0,0,0],t.aV(o,t.aW([],n,s)),o[3]=-t.aX(o,e[i[0]]),o),f=function(e,i){let r=t.a$(e),a=t.b0([],e,1/r),n=t.aU([],i,t.aR([],a,t.aX(i,a))),s=t.a$(n);if(s>0){let e=Math.sqrt(1-a[3]*a[3]),r=t.aR([],a,-a[3]),o=t.aS([],r,t.aR([],n,e/s));return t.b1(i,o)}return null}(r,p);null!==f&&(u=Math.min(u,f/t.aX(d[0],p)));for(let t=0;t<4;t++){let i=Math.min(u,c[t]);e[t+h]=[e[t+l][0]+d[t][0]*i,e[t+l][1]+d[t][1]*i,e[t+l][2]+d[t][2]*i,1]}}(l,s[0],a,n);let h=s.map(e=>{let i=t.aU([],l[e[0]],l[e[1]]),r=t.aU([],l[e[2]],l[e[1]]),a=t.aV([],t.aW([],i,r)),n=-t.aX(a,l[e[1]]);return a.concat(n)}),u=[1/0,1/0,1/0],c=[-1/0,-1/0,-1/0];for(let e of l)for(let t=0;t<3;t++)u[t]=Math.min(u[t],e[t]),c[t]=Math.max(c[t],e[t]);return new ts(l,h,new ta(u,c))}}
51class to{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,t,i){return this._helper.interpolatePadding(e,t,i)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,t,i=!0){this._helper.resize(e,t,i)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}overrideNearFarZ(e,t){this._helper.overrideNearFarZ(e,t)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(e,t){}constructor(e,t,i,r,a){this._posMatrixCache=new Map,this._alignedPosMatrixCache=new Map,this._fogMatrixCacheF32=new Map,this._helper=new tr({calcMatrices:()=>{this._calcMatrices()},getConstrained:(e,t)=>this.getConstrained(e,t)},e,t,i,r,a),this._coveringTilesDetailsProvider=new tn}clone(){let e=new to;return e.apply(this),e}apply(e,t,i){this._helper.apply(e,t,i)}get cameraPosition(){return this._cameraPosition}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._viewProjMatrix}get inverseProjectionMatrix(){return this._invProjMatrix}get mercatorMatrix(){return this._mercatorMatrix}getVisibleUnwrappedCoordinates(e){let i=[new t.b2(0,e)];if(this._helper._renderWorldCopies){let r=this.screenPointToMercatorCoordinate(new t.P(0,0)),a=this.screenPointToMercatorCoordinate(new t.P(this._helper._width,0)),n=this.screenPointToMercatorCoordinate(new t.P(this._helper._width,this._helper._height)),s=this.screenPointToMercatorCoordinate(new t.P(0,this._helper._height)),o=Math.floor(Math.min(r.x,a.x,n.x,s.x)),l=Math.floor(Math.max(r.x,a.x,n.x,s.x));for(let r=o-1;r<=l+1;r++)0!==r&&i.push(new t.b2(r,e))}return i}getCameraFrustum(){return ts.fromInvProjectionMatrix(this._invViewProjMatrix,this.worldSize)}getClippingPlane(){return null}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(e){let t=this.screenPointToLocation(this.centerPoint,e),i=e?e.getElevationForLngLatZoom(t,this._helper._tileZoom):0;this._helper.recalculateZoomAndCenter(i)}setLocationAtPoint(e,i){let r=t.aj(this.elevation,this.center.lat),a=this.screenPointToMercatorCoordinateAtZ(i,r),n=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,r),s=t.a1.fromLngLat(e),o=new t.a1(s.x-(a.x-n.x),s.y-(a.y-n.y)
51);this.setCenter(null==o?void 0:o.toLngLat()),this._helper._renderWorldCopies&&this.setCenter(this.center.wrap())}locationToScreenPoint(e,i){return i?this.coordinatePoint(t.a1.fromLngLat(e),i.getElevationForLngLatZoom(e,this._helper._tileZoom),this._pixelMatrix3D):this.coordinatePoint(t.a1.fromLngLat(e))}screenPointToLocation(e,t){var i;return null==(i=this.screenPointToMercatorCoordinate(e,t))?void 0:i.toLngLat()}screenPointToMercatorCoordinate(e,t){if(t){let i=t.pointCoordinate(e);if(null!=i)return i}return this.screenPointToMercatorCoordinateAtZ(e)}screenPointToMercatorCoordinateAtZ(e,i){let r=i||0,a=[e.x,e.y,0,1],n=[e.x,e.y,1,1];t.aw(a,a,this._pixelMatrixInverse),t.aw(n,n,this._pixelMatrixInverse);let s=a[3],o=n[3],l=a[1]/s,h=n[1]/o,u=a[2]/s,c=n[2]/o,d=u===c?0:(r-u)/(c-u);return new t.a1(t.C.number(a[0]/s,n[0]/o,d)/this.worldSize,t.C.number(l,h,d)/this.worldSize,r)}coordinatePoint(e,i=0,r=this._pixelMatrix){let a=[e.x*this.worldSize,e.y*this.worldSize,i,1];return t.aw(a,a,r),new t.P(a[0]/a[3],a[1]/a[3])}getBounds(){let e=Math.max(0,this._helper._height/2-eo(this));return(new U).extend(this.screenPointToLocation(new t.P(0,e))).extend(this.screenPointToLocation(new t.P(this._helper._width,e))).extend(this.screenPointToLocation(new t.P(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new t.P(0,this._helper._height)))}isPointOnMapSurface(e,t){return t?null!=t.pointCoordinate(e):e.y>this.height/2-eo(this)}calculatePosMatrix(e,i=!1,r){var a;let n=null!=(a=e.key)?a:t.b3(e.wrap,e.canonical.z,e.canonical.z,e.canonical.x,e.canonical.y),s=i?this._alignedPosMatrixCache:this._posMatrixCache;if(s.has(n)){let e=s.get(n);return r?e.f32:e.f64}let o=el(e,this.worldSize);t.O(o,i?this._alignedProjMatrix:this._viewProjMatrix,o);let l={f64:o,f32:new Float32Array(o)};return s.set(n,l),r?l.f32:l.f64}calculateFogMatrix(e){let i=e.key,r=this._fogMatrixCacheF32;if(r.has(i))return r.get(i);let a=el(e,this.worldSize);return t.O(a,this._fogMatrix,a),r.set(i,new Float32Array(a)),r.get(i)}getConstrained(e,i){let r,a;i=t.ah(+i,this.minZoom,this.maxZoom);let n={center:new t.S(e.lng,e.lat),zoom:i},s=this._helper._lngRange;this._helper._renderWorldCopies||null!==s||(s=[-(180-1e-10),180-1e-10]);let o=this.tileSize*t.af(n.zoom),l=0,h=o,u=0,c=o,d=0,p=0,{x:f,y:m}=this.size;if(this._helper._latRange){let e=this._helper._latRange;l=t.U(e[1])*o,(h=t.U(e[0])*o)-l<m&&(d=m/(h-l))}s&&(u=t.aO(t.V(s[0])*o,0,o),(c=t.aO(t.V(s[1])*o,0,o))<u&&(c+=o),c-u<f&&(p=f/(c-u)));let{x:_,y:g}=en(o,e),y=Math.max(p||0,d||0);if(y)return n.center=es(o,new t.P(p?(c+u)/2:_,d?(h+l)/2:g)).wrap(),n.zoom+=t.ak(y),n;if(this._helper._latRange){let e=m/2;g-e<l&&(a=l+e),g+e>h&&(a=h-e)}if(s){let e=(u+c)/2,i=_;
51this._helper._renderWorldCopies&&(i=t.aO(_,e-o/2,e+o/2));let a=f/2;i-a<u&&(r=u+a),i+a>c&&(r=c-a)}return(void 0!==r||void 0!==a)&&(n.center=es(o,new t.P(null!=r?r:_,null!=a?a:g)).wrap()),n}calculateCenterFromCameraLngLatAlt(e,t,i,r){return this._helper.calculateCenterFromCameraLngLatAlt(e,t,i,r)}_calculateNearFarZIfNeeded(e,i,r){if(!this._helper.autoCalculateNearFarZ)return;let a=Math.min(this.elevation,this.minElevationForCurrentTile,this.getCameraAltitude()-100),n=e-a*this._helper._pixelPerMeter/Math.cos(i),s=a<0?n:e,o=Math.PI/2+this.pitchInRadians,l=t.ae(this.fov)*(Math.abs(Math.cos(t.ae(this.roll)))*this.height+Math.abs(Math.sin(t.ae(this.roll)))*this.width)/this.height*(.5+r.y/this.height),h=Math.sin(l)*s/Math.sin(t.ah(Math.PI-o-l,.01,Math.PI-.01)),u=eo(this),c=Math.atan(u/this._helper.cameraToCenterDistance),d=t.ae(.75),p=c>d?2*c*(.5+r.y/(2*u)):d,f=Math.min(h,Math.sin(p)*s/Math.sin(t.ah(Math.PI-o-p,.01,Math.PI-.01)));this._helper._farZ=1.01*(Math.cos(Math.PI/2-i)*f+s),this._helper._nearZ=this._helper._height/50}_calcMatrices(){let e;if(!this._helper._height)return;let i=this.centerOffset,r=en(this.worldSize,this.center),a=r.x,n=r.y;this._helper._pixelPerMeter=t.aj(1,this.center.lat)*this.worldSize;let s=t.ae(Math.min(this.pitch,89.25)),o=Math.max(this._helper.cameraToCenterDistance/2,this._helper.cameraToCenterDistance+this._helper._elevation*this._helper._pixelPerMeter/Math.cos(s));this._calculateNearFarZIfNeeded(o,s,i),e=new Float64Array(16),t.b4(e,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),t.aq(this._invProjMatrix,e),e[8]=-(2*i.x)/this._helper._width,e[9]=2*i.y/this._helper._height,this._projectionMatrix=t.b5(e),t.N(e,e,[1,-1,1]),t.M(e,e,[0,0,-this._helper.cameraToCenterDistance]),t.b6(e,e,-this.rollInRadians),t.b7(e,e,this.pitchInRadians),t.b6(e,e,-this.bearingInRadians),t.M(e,e,[-a,-n,0]),this._mercatorMatrix=t.N([],e,[this.worldSize,this.worldSize,this.worldSize]),t.N(e,e,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=t.O(new Float64Array(16),this.clipSpaceToPixelsMatrix,e),t.M(e,e,[0,0,-this.elevation]),this._viewProjMatrix=e,this._invViewProjMatrix=t.aq([],e);let l=[0,0,-1,1];t.aw(l,l,this._invViewProjMatrix),this._cameraPosition=[l[0]/l[3],l[1]/l[3],l[2]/l[3]],this._fogMatrix=new Float64Array(16),t.b4(this._fogMatrix,this.fovInRadians,this.width/this.height,o,this._helper._farZ),this._fogMatrix[8]=-(2*i.x)/this.width,this._fogMatrix[9]=2*i.y/this.height,t.N(this._fogMatrix,this._fogMatrix,[1,-1,1]),t.M(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),t.b6(this._fogMatrix,this._fogMatrix,-this.rollInRadians),t.b7(this._fogMatrix,this._fogMatrix,this.pitchInRadians),t.b6(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),t.M(this._fogMatrix,this._fogMatrix,[-a,-n,0]),t.N(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),t.M(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=t.O(new Float64Array(16),this.clipSpaceToPixelsMatrix,e);let h=this._helper._width%2/2,u=this._helper._height%2/2,c=Math.cos(this.bearingInRadians),d=Math.sin(-this.bearingInRadians),p=a-Math.round(a)+c*h+d*u,f=n-Math.round(n)+c*u+d*h,m=new Float64Array(e);if(t.M(m,m,[p>.5?p-1:p,f>.5?f-1:f,0]),this._alignedProjMatrix=m,!(e=t.aq(new Float64Array(16),this._pixelMatrix)))throw Error("failed to invert matrix");this._pixelMatrixInverse=e,this._clearMatrixCaches()}_clearMatrixCaches(){this._posMatrixCache.clear(),this._alignedPosMatrixCache.clear(),this._fogMatrixCacheF32.clear()}maxPitchScaleFactor(){if(!this._pixelMatrixInverse)return 1;let e=this.screenPointToMercatorCoordinate(new t.P(0,0)),i=[e.x*this.worldSize,e.y*this.worldSize,0,1];return t.aw(i,i,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){let e=t.aj(1,this.center.lat)*this.worldSize;return eh(this.center,this.elevation,this.pitch,this.bearing,this._helper.cameraToCenterDistance/e).toLngLat()}lngLatToCameraDepth(e,i){let r=t.a1.fromLngLat(e),a=[r.x*this.worldSize,r.y*this.worldSize,i,1];return t.aw(a,a,this._viewProjMatrix),a[2]/a[3]}getProjectionData(e){let i,{overscaledTileID:r,aligned:a,applyTerrainMatrix:n}=e,s=this._helper.getMercatorTileCoordinates(r),o=r?this.calculatePosMatrix(r,a,!0):null;return{mainMatrix:i=r&&r.terrainRttPosMatrix32f&&n?r.terrainRttPosMatrix32f:o||t.b8(),tileMercatorCoords:s,clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:i}}isLocationOccluded(e){return!1}getPixelScale(){return 1}getCircleRadiusCorrection(){return 1}getPitchedTextCorrection(e,t,i){return 1}transformLightDirection(e){return t.aT(e)}getRayDirectionFromPixel(e){throw Error("Not implemented.")}projectTileCoordinates(e,i,r,a){let n,s=this.calculatePosMatrix(r);a?(n=[e,i,a(e,i),1],t.aw(n,n,s)):eB(n=[e,i,0,1],n,s);let o=n[3];return{point:new t.P(n[0]/o,n[1]/o),signedDistanceFromCamera:o,isOccluded:!1}}populateCache(e){for(let t of e)this.calculatePosMatrix(t)}getMatrixForModel(e,i){let r=t.a1.fromLngLat(e,i),a=r.meterInMercatorCoordinateUnits(),n=t.b9();return t.M(n,n,[r.x,r.y,r.z]),t.b6(n,n,Math.PI),t.b7(n,n,Math.PI/2),t.N(n,n,[-a,a,a]),n}getProjectionDataForCustomLayer(e=!0){let i=new t.Z(0,0,0,0,0),r=this.getProjectionData({overscaledTileID:i,applyGlobeMatrix:e}),a=el(i,this.worldSize);t.O(a,this._viewProjMatrix,a),r.tileMercatorCoords=[0,0,1,1];let n=[t.$,t.$,this.worldSize/this._helper.pixelsPerMeter],s=t.ba();return t.N(s,a,n),r.fallbackMatrix=s,r.mainMatrix=s,r}getFastPathSimpleProjectionMatrix(e){return this.calculatePosMatrix(e)}}function tl(){t.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}function th(e){if(e.useSlerp)if(e.k<1){let i=t.bb(e.startEulerAngles.roll,e.startEulerAngles.pitch,e.startEulerAngles.bearing),r=t.bb(e.endEulerAngles.roll,e.endEulerAngles.pitch,e.endEulerAngles.bearing),a=new Float64Array(4);t.bc(a,i,r,e.k);let n=t.bd(a);e.tr.setRoll(n.roll),e.tr.setPitch(n.pitch),e.tr.setBearing(n.bearing)}else e.tr.setRoll(e.endEulerAngles.roll),e.tr.setPitch(e.endEulerAngles.pitch),e.tr.setBearing(e.endEulerAngles.bearing);else e.tr.setRoll(t.C.number(e.startEulerAngles.roll,e.endEulerAngles.roll,e.k)),e.tr.setPitch(t.C.number(e.startEulerAngles.pitch,e.endEulerAngles.pitch,e.k)),e.tr.setBearing(t.C.number(e.startEulerAngles.bearing,e.endEulerAngles.bearing,e.k))}function tu(e,i,r,a,n){let s=n.padding,o=en(n.worldSize,r.getNorthWest()),l=en(n.worldSize,r.getNorthEast()),h=en(n.worldSize,r.getSouthEast()),u=en(n.worldSize,r.getSouthWest
51()),c=t.ae(-a),d=o.rotate(c),p=l.rotate(c),f=h.rotate(c),m=u.rotate(c),_=new t.P(Math.max(d.x,p.x,m.x,f.x),Math.max(d.y,p.y,m.y,f.y)),g=new t.P(Math.min(d.x,p.x,m.x,f.x),Math.min(d.y,p.y,m.y,f.y)),y=_.sub(g),x=(n.width-(s.left+s.right+i.left+i.right))/y.x,v=(n.height-(s.top+s.bottom+i.top+i.bottom))/y.y;if(v<0||x<0)return void tl();let b=Math.min(t.ak(n.scale*Math.min(x,v)),e.maxZoom),w=t.P.convert(e.offset),T=new t.P((i.left-i.right)/2,(i.top-i.bottom)/2).rotate(t.ae(a)),P=w.add(T).mult(n.scale/t.af(b));return{center:es(n.worldSize,o.add(h).div(2).sub(P)),zoom:b,bearing:a}}class tc{get useGlobeControls(){return!1}handlePanInertia(e,t){return{easingOffset:e,easingCenter:t.center}}handleMapControlsRollPitchBearingZoom(e,t){e.bearingDelta&&t.setBearing(t.bearing+e.bearingDelta),e.pitchDelta&&t.setPitch(t.pitch+e.pitchDelta),e.rollDelta&&t.setRoll(t.roll+e.rollDelta),e.zoomDelta&&t.setZoom(t.zoom+e.zoomDelta)}handleMapControlsPan(e,t,i){.01>e.around.distSqr(t.centerPoint)||t.setLocationAtPoint(i,e.around)}cameraForBoxAndBearing(e,t,i,r,a){return tu(e,t,i,r,a)}handleJumpToCenterZoom(e,i){e.zoom!==(void 0!==i.zoom?+i.zoom:e.zoom)&&e.setZoom(+i.zoom),void 0!==i.center&&e.setCenter(t.S.convert(i.center))}handleEaseTo(e,i){let r=e.zoom,a=e.padding,n={roll:e.roll,pitch:e.pitch,bearing:e.bearing},s={roll:void 0===i.roll?e.roll:i.roll,pitch:void 0===i.pitch?e.pitch:i.pitch,bearing:void 0===i.bearing?e.bearing:i.bearing},o=void 0!==i.zoom,l=!e.isPaddingEqual(i.padding),h=!1,u=o?+i.zoom:e.zoom,c=e.centerPoint.add(i.offsetAsPoint),d=e.screenPointToLocation(c),{center:p,zoom:f}=e.getConstrained(t.S.convert(i.center||d),null!=u?u:r);tt(e,p);let m=en(e.worldSize,d),_=en(e.worldSize,p).sub(m),g=t.af(f-r);return{easeFunc:o=>{if(h&&e.setZoom(t.C.number(r,f,o)),t.be(n,s)||th({startEulerAngles:n,endEulerAngles:s,tr:e,k:o,useSlerp:n.roll!=s.roll}),l&&(e.interpolatePadding(a,i.padding,o),c=e.centerPoint.add(i.offsetAsPoint)),i.around)e.setLocationAtPoint(i.around,i.aroundPoint);else{let i=t.af(e.zoom-r),a=Math.pow(f>r?Math.min(2,g):Math.max(.5,g),1-o),n=es(e.worldSize,m.add(_.mult(o*a)).mult(i));e.setLocationAtPoint(e.renderWorldCopies?n.wrap():n,c)}},isZooming:h=f!==r,elevationCenter:p}}handleFlyTo(e,i){let r,a=void 0!==i.zoom,n=e.zoom,s=e.getConstrained(t.S.convert(i.center||i.locationAtOffset),a?+i.zoom:n),o=s.center,l=s.zoom;tt(e,o);let h=en(e.worldSize,i.locationAtOffset),u=en(e.worldSize,o).sub(h),c=u.mag(),d=t.af(l-n);if(void 0!==i.minZoom){let a=Math.min(+i.minZoom,n,l),s=e.getConstrained(o,a).zoom;r=t.af(s-n)}return{easeFunc:(i,r,a,s)=>{e.setZoom(1===i?l:n+t.ak(r));let c=1===i?o:es(e.worldSize,h.add(u.mult(a)).mult(r));e.setLocationAtPoint(e.renderWorldCopies?c.wrap():c,s)},scaleOfZoom:d,targetCenter:o,scaleOfMinZoom:r,pixelPathLength:c}}}class td{constructor(e,t,i){this.blendFunction=e,this.blendColor=t,this.mask=i}}td.Replace=[1,0],td.disabled=new td(td.Replace,t.bf.transparent,[!1,!1,!1,!1]),td.unblended=new td(td.Replace,t.bf.transparent,[!0,!0,!0,!0]),td.alphaBlended=new td([1,771],t.bf.transparent,[!0,!0,!0,!0]);class tp{constructor(e,t,i){this.enable=e,this.mode=t,this.frontFace=i}}tp.disabled=new tp(!1,1029,2305),tp.backCCW=new tp(!0,1029,2305),tp.frontCCW=new tp(!0,1028,2305);class tf{constructor(e,t,i){this.func=e,this.mask=t,this.range=i}}tf.ReadOnly=!1,tf.ReadWrite=!0,tf.disabled=new tf(519,tf.ReadOnly,[0,1]);class tm{constructor(e,t,i,r,a,n){this.test=e,this.ref=t,this.mask=i,this.fail=r,this.depthFail=a,this.pass=n}}tm.disabled=new tm({func:519,mask:0},0,0,7680,7680,7680);let t_=new WeakMap;function tg(e){var t;if(t_.has(e))return t_.get(e);{let i=null==(t=e.getParameter(e.VERSION))?void 0:t.startsWith("WebGL 2.0");return t_.set(e,i),i}}class ty{get awaitingQuery(){return!!this._readbackQueue}constructor(e){this._readbackWaitFrames=4,this._measureWaitFrames=6,this._texWidth=1,this._texHeight=1,this._measuredError=0,this._updateCount=0,this._lastReadbackFrame=-1e3,this._readbackQueue=null,this._cachedRenderContext=e;const i=e.context,r=i.gl;this._texFormat=r.RGBA,this._texType=r.UNSIGNED_BYTE;const a=new t.aL;a.emplaceBack(-1,-1),a.emplaceBack(2,-1),a.emplaceBack(-1,2);const n=new t.aN;n.emplaceBack(0,1,2),this._fullscreenTriangle=new e4(i.createVertexBuffer(a,e6.members),i.createIndexBuffer(n),t.aM.simpleSegment(0,0,a.length,n.length)),this._resultBuffer=new Uint8Array(4),i.activeTexture.set(r.TEXTURE1);const s=r.createTexture();r.bindTexture(r.TEXTURE_2D,s),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.NEAREST),r.texImage2D(r.TEXTURE_2D,0,this._texFormat,this._texWidth,this._texHeight,0,this._texFormat,this._texType,null),this._fbo=i.createFramebuffer(this._texWidth,this._texHeight,!1,!1),this._fbo.colorAttachment.set(s),tg(r)&&(this._pbo=r.createBuffer(),r.bindBuffer(r.PIXEL_PACK_BUFFER,this._pbo),r.bufferData(r.PIXEL_PACK_BUFFER,4,r.STREAM_READ),r.bindBuffer(r.PIXEL_PACK_BUFFER,null))}destroy(){let e=this._cachedRenderContext.context.gl;this._fullscreenTriangle.destroy(),this._fbo.destroy(),e.deleteBuffer(this._pbo),this._fullscreenTriangle=null,this._fbo=null,this._pbo=null,this._resultBuffer=null}updateErrorLoop(e,t){let i=this._updateCount;return this._readbackQueue?i>=this._readbackQueue.frameNumberIssued+this._readbackWaitFrames&&this._tryReadback():i>=this._lastReadbackFrame+this._measureWaitFrames&&this._renderErrorTexture(e,t),this._updateCount++,this._measuredError}_bindFramebuffer(){let e=this._cachedRenderContext.context,t=e.gl;e.activeTexture.set(t.TEXTURE1),t.bindTexture(t.TEXTURE_2D,this._fbo.colorAttachment.get()),e.bindFramebuffer.set(this._fbo.framebuffer)}_renderErrorTexture(e,i){let r=this._cachedRenderContext.context,a=r.gl;if(this._bindFramebuffer(),r.viewport.set([0,0,this._texWidth,this._texHeight]),r.clear({color:t.bf.transparent}),this._cachedRenderContext.useProgram("projectionErrorMeasurement").draw(r,a.TRIANGLES,tf.disabled,tm.disabled,td.unblended,tp.disabled,{u_input:e,u_output_expected:i},null,null,"$clipping",this._fullscreenTriangle.vertexBuffer,this._fullscreenTriangle.indexBuffer,this._fullscreenTriangle.segments),this._pbo&&tg(a)){a.bindBuffer(a.PIXEL_PACK_BUFFER,this._pbo),a.readBuffer(a.COLOR_ATTACHMENT0),a.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,0),a.bindBuffer(a.PIXEL_PACK_BUFFER,null);let e=a.fenceSync(a.SYNC_GPU_COMMANDS_COMPLETE,0);a.flush(),this._readbackQueue={frameNumberIssued:this._updateCount,sync:e}}else this._readbackQueue={frameNumberIssued:this._updateCount,sync:null}}_tryReadback(){let e=this._cachedRenderContext.context.gl;if(this._pbo&&this._readbackQueue&&tg(e)){let i=e.clientWaitSync(this._readbackQueue.sync,0,0);if(i===e.WAIT_FAILED)return t.w("WebGL2 clientWaitSync failed."),this._readbackQueue=null,void(this._lastReadbackFrame=this._updateCount);if(i===e.TIMEOUT_EXPIRED)return;e.bindBuffer(e.PIXEL_PACK_BUFFER,this._pbo),e.getBufferSubData(e.PIXEL_PACK_BUFFER,0,this._resultBuffer,0,4),e.bindBuffer(e.PIXEL_PACK_BUFFER,null)}else this._bindFramebuffer(),e.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,this._resultBuffer);this._readbackQueue=null,this._measuredError=ty._parseRGBA8float(this._resultBuffer),this._lastReadbackFrame=this._updateCount}static _parseRGBA8float(e){let t;return t=0+(e[0]/256+e[1]/65536+e[2]/0x1000000),e[3]<127&&(t=-t),t/128}}let tx=t.$/128;function tv(e,i){let r=void 0!==e.granularity?Math.max(e.granularity,1):1,a=r+2*!!e.generateBorders,n=r+(e.extendToNorthPole||e.generateBorders?1:0)+(e.extendToSouthPole||e.generateBorders?1:0),s=a+1,o=n+1,l=e.generateBorders?-1:0,h=e.generateBorders||e.extendToNorthPole?-1:0,u=r+ +!!e.generateBorders,c=r+(e.generateBorders||e.extendToSouthPole?1:0),d=a*n*6,p=s*o>65536;if(p&&"16bit"===i)throw Error("Granularity is too large and meshes would not fit inside 16 bit vertex indices.");let f=p||"32bit"===i,m=new Int16Array(s*o*2),_=0;for(let i=h;i<=c;i++)for(let a=l;a<=u;a++){let n=a/r*t.$;-1===a&&(n=-tx),a===r+1&&(n=t.$+tx);let s=i/r*t.$;-1===i&&(s=e.extendToNorthPole?t.bh:-tx),i===r+1&&(s=e.extendToSouthPole?t.bi:t.$+tx),m[_++]=n,m[_++]=s}let g=f?new Uint32Array(d):new Uint16Array(d),y=0;for(let e=0;e<n;e++)for(let t=0;t<a;t++){let i=t+1+e*s,r=t+(e+1)*s,a=t+1+(e+1)*s;g[y++]=t+e*s,g[y++]=r,g[y++]=i,g[y++]=i,g[y++]=r,g[y++]=a}return{vertices:m.buffer.slice(0),indices:g.buffer.slice(0),uses32bitIndices:f}}let tb=new t.aK({fill:new t.bj(128,2),line:new t.bj(512,0),tile:new t.bj(128,32),stencil:new t.bj(128,1),circle:3});class tw{constructor(){this._tileMeshCache={},this._errorCorrectionUsable=0,this._errorMeasurementLastValue=0,this._errorCorrectionPreviousValue=0,this._errorMeasurementLastChangeTime=-1e3}get name(){return"vertical-perspective"}get transitionState(){return 1}get useSubdivision(){return!0}get shaderVariantName(){return"globe"}get shaderDefine(){return"#define GLOBE"}get shaderPreludeCode(){return e3.projectionGlobe}get vertexShaderPreludeCode(){return e3.projectionMercator.vertexSource}get subdivisionGranularity(){return tb}get useGlobeControls(){return!0}get latitudeErrorCorrectionRadians(){return this._errorCorrectionUsable}destroy(){this._errorMeasurement&&this._errorMeasurement.destroy()}updateGPUdependent(e){this._errorMeasurement||(this._errorMeasurement=new ty(e));let i=t.U(this._errorQueryLatitudeDegrees),r=2*Math.atan(Math.exp(Math.PI-i*Math.PI*2))-.5*Math.PI,a=this._errorMeasurement.updateErrorLoop(i,r),n=d.now();a!==this._errorMeasurementLastValue&&(this._errorCorrectionPreviousValue=this._errorCorrectionUsable,this._errorMeasurementLastValue=a,this._errorMeasurementLastChangeTime=n);let s=Math.min(Math.max((n-this._errorMeasurementLastChangeTime)/1e3/.5,0),1);this._errorCorrectionUsable=t.bk(this._errorCorrectionPreviousValue,-this._errorMeasurementLastValue,t.bl(s))}_getMeshKey(e){return`${e.granularity.toString(36)}_${e.generateBorders?"b":""}${e.extendToNorthPole?"n":""}${e.extendToSouthPole?"s":""}`}getMeshFromTileID(e,t,i,r,a){let n=("stencil"===a?tb.stencil:tb.tile).getGranularityForZoomLevel(t.z);return this._getMesh(e,{granularity:n,generateBorders:i,extendToNorthPole:0===t.y&&r,extendToSouthPole:t.y===(1<<t.z)-1&&r})}_getMesh(e,i){let r,a,n,s=this._getMeshKey(i);if(s in this._tileMeshCache)return this._tileMeshCache[s];let o=(r=tv(i,"16bit"),a=t.aL.deserialize({arrayBuffer:r.vertices,length:r.vertices.byteLength/2/2}),n=t.aN.deserialize({arrayBuffer:r.indices,length:r.indices.byteLength/2/3}),new e4(e.createVertexBuffer(a,e6.members),e.createIndexBuffer(n),t.aM.simpleSegment(0,0,a.length,n.length)));return this._tileMeshCache[s]=o,o}recalculate(e){}hasTransition(){let e=d.now();return(e-this._errorMeasurementLastChangeTime)/1e3<.7||this._errorMeasurement&&this._errorMeasurement.awaitingQuery}setErrorQueryLatitudeDegrees(e){this._errorQueryLatitudeDegrees=e}}let tT=new t.r({type:new t.D(t.v.projection.type)});class tP extends t.E{constructor(e){super(),this._transitionable=new t.t(tT),this.setProjection(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new t.F(0)),this._mercatorProjection=new e7,this._verticalPerspectiveProjection=new tw}get transitionState(){let e=this.properties.get("type");if("string"==typeof e&&"mercator"===e)return 0;if("string"==typeof e&&"vertical-perspective"===e)return 1;if(e instanceof t.bm){if("vertical-perspective"===e.from&&"mercator"===e.to)return 1-e.transition;if("mercator"===e.from&&"vertical-perspective"===e.to)return e.transition}return 1}get useGlobeRendering(){return this.transitionState>0}get latitudeErrorCorrectionRadians(){return this._verticalPerspectiveProjection.latitudeErrorCorrectionRadians}get currentProjection(){return this.useGlobeRendering?this._verticalPerspectiveProjection:this._mercatorProjection}get name(){return"globe"}get useSubdivision(){return this.currentProjection.useSubdivision}get shaderVariantName(){return this.currentProjection.shaderVariantName}get shaderDefine(){return this.currentProjection.shaderDefine}get shaderPreludeCode(){return this.currentProjection.shaderPreludeCode}get vertexShaderPreludeCode(){return this.currentProjection.vertexShaderPreludeCode}get subdivisionGranularity(){return this.currentProjection.subdivisionGranularity}get useGlobeControls(){return this.transitionState>0}destroy(){this._mercatorProjection.destroy(),this._verticalPerspectiveProjection.destroy()}updateGPUdependent(e){this._mercatorProjection.updateGPUdependent(e),this._verticalPerspectiveProjection.updateGPUdependent(e)}getMeshFromTileID(e,t,i,r,a){return this.currentProjection.getMeshFromTileID(e,t,i,r,a)}setProjection(e){this._transitionable.setValue("type",(null==e?void 0:e.type)||"mercator")}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()||this.currentProjection.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}setErrorQueryLatitudeDegrees(e){this._verticalPerspectiveProjection.setErrorQueryLatitudeDegrees(e),this._mercatorProjection.setErrorQueryLatitudeDegrees(e)}}function tS(e){return 2*Math.PI*tI(e.worldSize,e.center.lat)}function tM(e,i,r,a,n){let s=1/(1<<n),o=i/t.$*s+a*s,l=t.bo((e/t.$*s+r*s)*Math.PI*2+Math.PI,2*Math.PI),h=2*Math.atan(Math.exp(Math.PI-o*Math.PI*2))-.5*Math.PI,u=Math.cos(h),c=new Float64Array(3);return c[0]=Math.sin(l)*u,c[1]=Math.sin(h),c[2]=Math.cos(l)*u,c}function tC(e){var t,i;let r,a;return t=e.lng*Math.PI/180,r=Math.cos(i=e.lat*Math.PI/180),(a=new Float64Array(3))[0]=Math.sin(t)*r,a[1]=Math.sin(i),a[2]=Math.cos(t)*r,a}function tI(e,t){return e/(2*Math.PI)/Math.cos(t*Math.PI/180)}function tA(e){let i=Math.asin(e[1])/Math.PI*180,r=Math.sqrt(e[0]*e[0]+e[2]*e[2]);if(r>1e-6){let a=e[0]/r,n=Math.acos(e[2]/r),s=(a>0?n:-n)/Math.PI*180;return new t.S(t.aO(s,-180,180),i)}return new t.S(0,i)}function tE(e){return Math.cos(e*Math.PI/180)}function tz(e,i){let r=tE(e),a=tE(i);return t.ak(a/r)}function tk(e,i){let r=e.rotate(i.bearingInRadians),a=i.zoom+tz(i.center.lat,0),n=t.bk(1/tE(i.center.lat),1/tE(Math.min(Math.abs(i.center.lat),60)),t.bn(a,7,3,0,1)),s=360/tS({worldSize:i.worldSize,center:{lat:i.center.lat}});return new t.S(i.center.lng-r.x*s*n,t.ah(i.center.lat+r.y*s,-t.ai,t.ai))}function tD(e){let t=.5*e,i=Math.sin(t),r=Math.cos(t);return Math.log(i+r)-Math.log(r-i)}function tR(e,i,r,a){let n=e.lat+r*a;if(Math.abs(r)>1){let s=(Math.sign(e.lat+r)!==Math.sign(e.lat)?-Math.abs(e.lat):Math.abs(e.lat))*Math.PI/180,o=Math.abs(e.lat+r)*Math.PI/180,l=tD(s+a*(o-s)),h=tD(s),u=tD(o);return new t.S(e.lng+(l-h)/(u-h)*i,n)}return new t.S(e.lng+i*a,n)}class tL{constructor(e){this._cachePrevious=new Map,this._cache=new Map,this._hadAnyChanges=!1,this._boundingVolumeFactory=e}swapBuffers(){if(!this._hadAnyChanges)return;let e=this._cachePrevious;this._cachePrevious=this._cache,this._cache=e,this._cache.clear(),this._hadAnyChanges=!1}getTileBoundingVolume(e,t,i,r){let a=`${e.z}_${e.x}_${e.y}_${(null==r?void 0:r.terrain)?"t":""}`,n=this._cache.get(a);if(n)return n;let s=this._cachePrevious.get(a);if(s)return this._cache.set(a,s),s;let o=this._boundingVolumeFactory(e,t,i,r);return this._cache.set(a,o),this._hadAnyChanges=!0,o}}class tF{constructor(e,t,i,r){this.min=i,this.max=r,this.points=e,this.planes=t}static fromAabb(e,t){let i=[];for(let r=0;r<8;r++)i.push([1&~r?e[0]:t[0],1==(r>>1&1)?t[1]:e[1],1==(r>>2&1)?t[2]:e[2]]);return new tF(i,[[-1,0,0,t[0]],[1,0,0,-e[0]],[0,-1,0,t[1]],[0,1,0,-e[1]],[0,0,-1,t[2]],[0,0,1,-e[2]]],e,t)}static fromCenterSizeAngles(e,i,r){let a=t.br([],r[0],r[1],r[2]),n=t.bs([],[i[0],0,0],a),s=t.bs([],[0,i[1],0],a),o=t.bs([],[0,0,i[2]],a),l=[...e],h=[...e];for(let t=0;t<8;t++)for(let i=0;i<3;i++){let r=e[i]+n[i]*(1&~t?-1:1)+s[i]*(1==(t>>1&1)?1:-1)+o[i]*(1==(t>>2&1)?1:-1);l[i]=Math.min(l[i],r),h[i]=Math.max(h[i],r)}let u=[];for(let i=0;i<8;i++){let r=[...e];t.aS(r,r,t.aR([],n,1&~i?-1:1)),t.aS(r,r,t.aR([],s,1==(i>>1&1)?1:-1)),t.aS(r,r,t.aR([],o,1==(i>>2&1)?1:-1)),u.push(r)}return new tF(u,[[...n,-t.aX(n,u[0])],[...s,-t.aX(s,u[0])],[...o,-t.aX(o,u[0])],[-n[0],-n[1],-n[2],-t.aX(n,u[7]
51)],[-s[0],-s[1],-s[2],-t.aX(s,u[7])],[-o[0],-o[1],-o[2],-t.aX(o,u[7])]],l,h)}intersectsFrustum(e){let t=!0,i=this.points.length,r=this.planes.length,a=e.planes.length,n=e.points.length;for(let r=0;r<a;r++){let a=e.planes[r],n=0;for(let e=0;e<i;e++){let t=this.points[e];a[0]*t[0]+a[1]*t[1]+a[2]*t[2]+a[3]>=0&&n++}if(0===n)return 0;n<i&&(t=!1)}if(t)return 2;for(let t=0;t<r;t++){let i=this.planes[t],r=0;for(let t=0;t<n;t++){let a=e.points[t];i[0]*a[0]+i[1]*a[1]+i[2]*a[2]+i[3]>=0&&r++}if(0===r)return 0}return 1}intersectsPlane(e){let t=this.points.length,i=0;for(let r=0;r<t;r++){let t=this.points[r];e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]>=0&&i++}return i===t?2:+(0!==i)}}function tB(e,t,i){let r=e-t;return r<0?-r:Math.max(0,r-i)}function tO(e,t,i,r,a){let n=e-i;return Math.max(n<0?Math.min(-n,1+n-a):n>1?Math.min(Math.max(n-a,0),1-n):0,tB(t,r,a))}class tj{constructor(){this._boundingVolumeCache=new tL(this._computeTileBoundingVolume)}prepareNextFrame(){this._boundingVolumeCache.swapBuffers()}distanceToTile2d(e,t,i,r){let a=1<<i.z,n=1/a,s=i.x/a,o=i.y/a;return Math.min(Math.min(Math.min(2,tO(e,t,s,o,n)),tO(e,t,s+.5,-o-n,n)),tO(e,t,s+.5,2-o-n,n))}getWrap(e,t,i){let r=1<<t.z,a=1/r,n=t.x/r,s=tB(e.x,n,a),o=tB(e.x,n-1,a),l=tB(e.x,n+1,a),h=Math.min(s,o,l);return h===l?1:h===o?-1:0}allowVariableZoom(e,t){return ep(e,t)>4}allowWorldCopies(){return!1}getTileBoundingVolume(e,t,i,r){return this._boundingVolumeCache.getTileBoundingVolume(e,t,i,r)}_computeTileBoundingVolume(e,i,r,a){var n,s;let o=0,l=0;if(null==a?void 0:a.terrain){let h=new t.Z(e.z,i,e.z,e.x,e.y),u=a.terrain.getMinMaxElevation(h);o=null!=(n=u.minElevation)?n:Math.min(0,r),l=null!=(s=u.maxElevation)?s:Math.max(0,r)}if(o/=t.bu,l/=t.bu,o+=1,l+=1,e.z<=0)return tF.fromAabb([-l,-l,-l],[l,l,l]);if(1===e.z)return tF.fromAabb([0===e.x?-l:0,0===e.y?0:-l,-l],[0===e.x?0:l,0===e.y?l:0,l]);{let i=[tM(0,0,e.x,e.y,e.z),tM(t.$,0,e.x,e.y,e.z),tM(t.$,t.$,e.x,e.y,e.z),tM(0,t.$,e.x,e.y,e.z)],r=[];for(let e of i)r.push(t.aR([],e,l));if(l!==o)for(let e of i)r.push(t.aR([],e,o));0===e.y&&r.push([0,1,0]),e.y===(1<<e.z)-1&&r.push([0,-1,0]);let a=[1,1,1],n=[-1,-1,-1];for(let e of r)for(let t=0;t<3;t++)a[t]=Math.min(a[t],e[t]),n[t]=Math.max(n[t],e[t]);let s=tM(t.$/2,t.$/2,e.x,e.y,e.z),h=t.aW([],[0,1,0],s);t.aV(h,h);let u=t.aW([],s,h);t.aV(u,u);let c=t.aW([],i[2],i[1]);t.aV(c,c);let d=t.aW([],i[0],i[3]);t.aV(d,d),r.push(t.aR([],s,l)),e.y>=(1<<e.z)/2&&r.push(t.aR([],tM(t.$/2,0,e.x,e.y,e.z),l)),e.y<(1<<e.z)/2&&r.push(t.aR([],tM(t.$/2,t.$,e.x,e.y,e.z),l));let p=tV(s,r),f=tV(u,r),m=[-s[0],-s[1],-s[2],p.max],_=[s[0],s[1],s[2],-p.min],g=[-u[0],-u[1],-u[2],f.max],y=[u[0],u[1],u[2],-f.min],x=[...c,0],v=[...d,0],b=[];return 0===e.y?b.push(t.bt(v,x,m),t.bt(v,x,_)):b.push(t.bt(g,x,m),t.bt(g,x,_),t.bt(g,v,m),t.bt(g,v,_)),e.y===(1<<e.z)-1?b.push(t.bt(v,x,m),t.bt(v,x,_)):b.push(t.bt(y,x,m),t.bt(y,x,_),t.bt(y,v,m),t.bt(y,v,_)),new tF(b,[m,_,g,y,x,v],a,n)}}}function tV(e,i){let r=1/0,a=-1/0;for(let n of i){let i=t.aX(e,n);r=Math.min(r,i),a=Math.max(a,i)}return{min:r,max:a}}class tU{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,t,i){return this._helper.interpolatePadding(e,t,i)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,t){this._helper.resize(e,t)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}
51overrideNearFarZ(e,t){this._helper.overrideNearFarZ(e,t)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(e){}constructor(){this._cachedClippingPlane=t.bv(),this._projectionMatrix=t.b9(),this._globeViewProjMatrix32f=t.b8(),this._globeViewProjMatrixNoCorrection=t.b9(),this._globeViewProjMatrixNoCorrectionInverted=t.b9(),this._globeProjMatrixInverted=t.b9(),this._cameraPosition=t.bp(),this._globeLatitudeErrorCorrectionRadians=0,this._helper=new tr({calcMatrices:()=>{this._calcMatrices()},getConstrained:(e,t)=>this.getConstrained(e,t)}),this._coveringTilesDetailsProvider=new tj}clone(){let e=new tU;return e.apply(this),e}apply(e,t){this._globeLatitudeErrorCorrectionRadians=t||0,this._helper.apply(e)}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._globeViewProjMatrixNoCorrection}get inverseProjectionMatrix(){return this._globeProjMatrixInverted}get cameraPosition(){let e=t.bp();return e[0]=this._cameraPosition[0],e[1]=this._cameraPosition[1],e[2]=this._cameraPosition[2],e}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}getProjectionData(e){let{overscaledTileID:t,applyGlobeMatrix:i}=e,r=this._helper.getMercatorTileCoordinates(t);return{mainMatrix:this._globeViewProjMatrix32f,tileMercatorCoords:r,clippingPlane:this._cachedClippingPlane,projectionTransition:+!!i,fallbackMatrix:this._globeViewProjMatrix32f}}_computeClippingPlane(e){let i=this.pitchInRadians,r=this.cameraToCenterDistance/e,a=Math.sin(i)*r,n=Math.cos(i)*r+1,s=1/Math.sqrt(a*a+n*n)*1,o=-a,l=n,h=Math.sqrt(o*o+l*l),u=[0,o/=h,l/=h];t.bw(u,u,[0,0,0],-this.bearingInRadians),t.bx(u,u,[0,0,0],-1*this.center.lat*Math.PI/180),t.by(u,u,[0,0,0],this.center.lng*Math.PI/180);let c=1/t.aZ(u);return t.aR(u,u,c),[...u,-s*c]}isLocationOccluded(e){return!this.isSurfacePointVisible(tC(e))}transformLightDirection(e){let i=this._helper._center.lng*Math.PI/180,r=this._helper._center.lat*Math.PI/180,a=Math.cos(r),n=[Math.sin(i)*a,Math.sin(r),Math.cos(i)*a],s=[n[2],0,-n[0]],o=[0,0,0];t.aW(o,s,n),t.aV(s,s),t.aV(o,o);let l=[0,0,0];return t.aV(l,[s[0]*e[0]+o[0]*e[1]+n[0]*e[2],s[1]*e[0]+o[1]*e[1]+n[1]*e[2],s[2]*e[0]+o[2]*e[1]+n[2]*e[2]]),l}getPixelScale(){return 1/Math.cos(this._helper._center.lat*Math.PI/180)}getCircleRadiusCorrection(){return Math.cos(this._helper._center.lat*Math.PI/180)}getPitchedTextCorrection(e,i,r){var a,n;let s,o=(s=1/(1<<(n=r.canonical).z),new t.a1(e/t.$*s+n.x*s,i/t.$*s+n.y*s)),l=(a=o.y,[t.bo(o.x*Math.PI*2+Math.PI,2*Math.PI),2*Math.atan(Math.exp(Math.PI-a*Math.PI*2))-.5*Math.PI]);return this.getCircleRadiusCorrection()/Math.cos(l[1])}projectTileCoordinates(e,i,r,a){let n=r.canonical,s=tM(e,i,n.x,n.y,n.z),o=1+(a?a(e,i):0)/t.bu,l=[s[0]*o,s[1]*o,s[2]*o,1];t.aw(l,l,this._globeViewProjMatrixNoCorrection);let h=this._cachedClippingPlane,u=h[0]*s[0]+h[1]*s[1]+h[2]*s[2]+h[3]<0;return{point:new t.P(l[0]/l[3],l[1]/l[3]),signedDistanceFromCamera:l[3],isOccluded:u}}
51_calcMatrices(){if(!this._helper._width||!this._helper._height)return;let e=tI(this.worldSize,this.center.lat),i=t.ba(),r=t.ba();this._helper.autoCalculateNearFarZ&&(this._helper._nearZ=.5,this._helper._farZ=this.cameraToCenterDistance+2*e),t.b4(i,this.fovInRadians,this.width/this.height,this._helper._nearZ,this._helper._farZ);let a=this.centerOffset;i[8]=-(2*a.x)/this._helper._width,i[9]=2*a.y/this._helper._height,this._projectionMatrix=t.b5(i),this._globeProjMatrixInverted=t.ba(),t.aq(this._globeProjMatrixInverted,i),t.M(i,i,[0,0,-this.cameraToCenterDistance]),t.b6(i,i,this.rollInRadians),t.b7(i,i,-this.pitchInRadians),t.b6(i,i,this.bearingInRadians),t.M(i,i,[0,0,-e]);let n=t.bp();n[0]=e,n[1]=e,n[2]=e,t.b7(r,i,this.center.lat*Math.PI/180),t.bz(r,r,-this.center.lng*Math.PI/180),t.N(r,r,n),this._globeViewProjMatrixNoCorrection=r,t.b7(i,i,this.center.lat*Math.PI/180-this._globeLatitudeErrorCorrectionRadians),t.bz(i,i,-this.center.lng*Math.PI/180),t.N(i,i,n),this._globeViewProjMatrix32f=new Float32Array(i),this._globeViewProjMatrixNoCorrectionInverted=t.ba(),t.aq(this._globeViewProjMatrixNoCorrectionInverted,r);let s=t.bp();this._cameraPosition=t.bp(),this._cameraPosition[2]=this.cameraToCenterDistance/e,t.bw(this._cameraPosition,this._cameraPosition,s,-this.rollInRadians),t.bx(this._cameraPosition,this._cameraPosition,s,this.pitchInRadians),t.bw(this._cameraPosition,this._cameraPosition,s,-this.bearingInRadians),t.aS(this._cameraPosition,this._cameraPosition,[0,0,1]),t.bx(this._cameraPosition,this._cameraPosition,s,-this.center.lat*Math.PI/180),t.by(this._cameraPosition,this._cameraPosition,s,this.center.lng*Math.PI/180),this._cachedClippingPlane=this._computeClippingPlane(e);let o=t.b5(this._globeViewProjMatrixNoCorrectionInverted);t.N(o,o,[1,1,-1]),this._cachedFrustum=ts.fromInvProjectionMatrix(o,1,0,this._cachedClippingPlane,!0)}calculateFogMatrix(e){t.w("calculateFogMatrix is not supported on globe projection.");let i=t.ba();return t.ag(i),i}getVisibleUnwrappedCoordinates(e){return[new t.b2(0,e)]}getCameraFrustum(){return this._cachedFrustum}getClippingPlane(){return this._cachedClippingPlane}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(e){e&&t.w("terrain is not fully supported on vertical perspective projection."),this._helper.recalculateZoomAndCenter(0)}maxPitchScaleFactor(){return 1}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(e,i){if(!this._globeViewProjMatrixNoCorrection)return 1;let r=tC(e);t.aR(r,r,1+i/t.bu);let a=t.bv();return t.aw(a,[r[0],r[1],r[2],1],this._globeViewProjMatrixNoCorrection),a[2]/a[3]}populateCache(e){}getBounds(){let e=.5*this.width,i=.5*this.height,r=[new t.P(0,0),new t.P(e,0),new t.P(this.width,0),new t.P(this.width,i),new t.P(this.width,this.height),new t.P(e,this.height),new t.P(0,this.height),new t.P(0,i)],a=[];for(let e of r)a.push(this.unprojectScreenPoint(e));let n=0,s=0,o=0,l=0,h=this.center;for(let e of a){let i=t.bA(h.lng,e.lng),r=t.bA(h.lat,e.lat);i<s&&(s=i),i>n&&(n=i),r<l&&(l=r),r>o&&(o=r)}let u=[h.lng+s,h.lat+l,h.lng+n,h.lat+o];return this.isSurfacePointOnScreen([0,1,0])&&(u[3]=90,u[0]=-180,u[2]=180),this.isSurfacePointOnScreen([0,-1,0])&&(u[1]=-90,u[0]=-180,u[2]=180),new U(u)}getConstrained(e,i){let r=t.ah(e.lat,-t.ai,t.ai),a=t.ah(+i,this.minZoom+tz(0,r),this.maxZoom);return{center:new t.S(e.lng,r),zoom:a}}calculateCenterFromCameraLngLatAlt(e,t,i,r){return this._helper.calculateCenterFromCameraLngLatAlt(e,t,i,r)}setLocationAtPoint(e,i){let r,a,n=tC(this.unprojectScreenPoint(i)),s=tC(e),o=t.bp();t.bB(o);let l=t.bp();t.by(l,n,o,-this.center.lng*Math.PI/180),t.bx(l,l,o,this.center.lat*Math.PI/180);let h=s[0]*s[0]+s[2]*s[2],u=l[0]*l[0];if(h<u)return;let c=Math.sqrt(h-u),d=t.bC(s[0],s[2],l[0],c),p=t.bC(s[0],s[2],l[0],-c),f=t.bp();t.by(f,s,o,-d);let m=t.bC(f[1],f[2],l[1],l[2]),_=t.bp();t.by(_,s,o,-p);let g=t.bC(_[1],_[2],l[1],l[2]),y=.5*Math.PI,x=m>=-y&&m<=y,v=g>=-y&&g<=y;if(x&&v){let e=this.center.lng*Math.PI/180,i=this.center.lat*Math.PI/180;t.bD(d,e)+t.bD(m,i)<t.bD(p,e)+t.bD(g,i)?(r=d,a=m):(r=p,a=g)}else if(x)r=d,a=m;else{if(!v)return;r=p,a=g}let b=r/Math.PI*180,w=a/Math.PI*180,T=this.center.lat;this.setCenter(new t.S(b,t.ah(w,-90,90))),this.setZoom(this.zoom+tz(T,this.center.lat))}locationToScreenPoint(e,i){let r=tC(e);if(i){let a=i.getElevationForLngLatZoom(e,this._helper._tileZoom);t.aR(r,r,1+a/t.bu)}return this._projectSurfacePointToScreen(r)}_projectSurfacePointToScreen(e){let i=t.bv();return t.aw(i,[...e,1],this._globeViewProjMatrixNoCorrection),i[0]/=i[3],i[1]/=i[3],new t.P((.5*i[0]+.5)*this.width,(-(.5*i[1])+.5)*this.height)}screenPointToMercatorCoordinate(e,i){if(i){let t=i.pointCoordinate(e);if(t)return t}return t.a1.fromLngLat(this.unprojectScreenPoint(e))}screenPointToLocation(e,t){var i;return null==(i=this.screenPointToMercatorCoordinate(e,t))?void 0:i.toLngLat()}
51isPointOnMapSurface(e,t){let i=this._cameraPosition,r=this.getRayDirectionFromPixel(e);return!!this.rayPlanetIntersection(i,r)}getRayDirectionFromPixel(e){let i=t.bv();i[0]=e.x/this.width*2-1,i[1]=-1*(e.y/this.height*2-1),i[2]=1,i[3]=1,t.aw(i,i,this._globeViewProjMatrixNoCorrectionInverted),i[0]/=i[3],i[1]/=i[3],i[2]/=i[3];let r=t.bp();r[0]=i[0]-this._cameraPosition[0],r[1]=i[1]-this._cameraPosition[1],r[2]=i[2]-this._cameraPosition[2];let a=t.bp();return t.aV(a,r),a}isSurfacePointVisible(e){let t=this._cachedClippingPlane;return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]>=0}isSurfacePointOnScreen(e){if(!this.isSurfacePointVisible(e))return!1;let i=t.bv();return t.aw(i,[...e,1],this._globeViewProjMatrixNoCorrection),i[0]/=i[3],i[1]/=i[3],i[2]/=i[3],i[0]>-1&&i[0]<1&&i[1]>-1&&i[1]<1&&i[2]>-1&&i[2]<1}rayPlanetIntersection(e,i){let r=t.aX(e,i),a=t.bp(),n=t.bp();t.aR(n,i,r),t.aU(a,e,n);let s=1-t.aX(a,a);if(s<0)return null;let o=t.aX(e,e)-1,l=-r+(r<0?1:-1)*Math.sqrt(s),h=o/l;return{tMin:Math.min(h,l),tMax:Math.max(h,l)}}unprojectScreenPoint(e){var i,r;let a,n,s,o=this._cameraPosition,l=this.getRayDirectionFromPixel(e),h=this.rayPlanetIntersection(o,l);if(h){let e=t.bp();t.aS(e,o,[l[0]*h.tMin,l[1]*h.tMin,l[2]*h.tMin]);let i=t.bp();return t.aV(i,e),tA(i)}let u=this._cachedClippingPlane,c=u[0]*l[0]+u[1]*l[1]+u[2]*l[2],d=-t.b1(u,o)/c,p=t.bp();if(d>0)t.aS(p,o,[l[0]*d,l[1]*d,l[2]*d]);else{let e=t.bp();t.aS(e,o,[2*l[0],2*l[1],2*l[2]]);let i=t.b1(this._cachedClippingPlane,e);t.aU(p,e,[this._cachedClippingPlane[0]*i,this._cachedClippingPlane[1]*i,this._cachedClippingPlane[2]*i])}let f=((a=t.bp())[0]=-(u[0]*u[3]),a[1]=-(u[1]*u[3]),a[2]=-(u[2]*u[3]),{center:a,radius:Math.sqrt(1-u[3]*u[3])});return tA((i=f.center,r=f.radius,n=t.bp(),t.aU(n,p,i),s=t.bp(),t.bq(s,i,n,r/t.a$(n)),s))}getMatrixForModel(e,i){let r=t.S.convert(e),a=1/t.bu,n=t.b9();return t.bz(n,n,r.lng/180*Math.PI),t.b7(n,n,-r.lat/180*Math.PI),t.M(n,n,[0,0,1+i/t.bu]),t.b7(n,n,.5*Math.PI),t.N(n,n,[a,a,a]),n}getProjectionDataForCustomLayer(e=!0){let i=this.getProjectionData({overscaledTileID:new t.Z(0,0,0,0,0),applyGlobeMatrix:e});return i.tileMercatorCoords=[0,0,1,1],i}getFastPathSimpleProjectionMatrix(e){}}class tN{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,t,i){return this._helper.interpolatePadding(e,t,i)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,t,i=!0){this._helper.resize(e,t,i)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}overrideNearFarZ(e,t){this._helper.overrideNearFarZ(e,t)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}get isGlobeRendering(){return this._globeness>0}setTransitionState(e,t){this._globeness=e,this._globeLatitudeErrorCorrectionRadians=t,this._calcMatrices(),this._verticalPerspectiveTransform.getCoveringTilesDetailsProvider().prepareNextFrame(),this._mercatorTransform.getCoveringTilesDetailsProvider().prepareNextFrame()}get currentTransform(){return this.isGlobeRendering?this._verticalPerspectiveTransform:this._mercatorTransform}constructor(){this._globeLatitudeErrorCorrectionRadians=0,this._globeness=1,this._helper=new tr({calcMatrices:()=>{this._calcMatrices()},getConstrained:(e,t)=>this.getConstrained(e,t)}),this._globeness=1,this._mercatorTransform=new to,this._verticalPerspectiveTransform=new tU}clone(){let e=new tN;return e._globeness=this._globeness,e._globeLatitudeErrorCorrectionRadians=this._globeLatitudeErrorCorrectionRadians,e.apply(this),e}apply(e){this._helper.apply(e),this._mercatorTransform.apply(this),this._verticalPerspectiveTransform.apply(this,this._globeLatitudeErrorCorrectionRadians)}get projectionMatrix(){return this.currentTransform.projectionMatrix}get modelViewProjectionMatrix(){return this.currentTransform.modelViewProjectionMatrix}get inverseProjectionMatrix(){return this.currentTransform.inverseProjectionMatrix}get cameraPosition(){return this.currentTransform.cameraPosition}getProjectionData(e){let t=this._mercatorTransform.getProjectionData(e),i=this._verticalPerspectiveTransform.getProjectionData(e);return{mainMatrix:this.isGlobeRendering?i.mainMatrix:t.mainMatrix,clippingPlane:i.clippingPlane,tileMercatorCoords:i.tileMercatorCoords,projectionTransition:e.applyGlobeMatrix?this._globeness:0,fallbackMatrix:t.fallbackMatrix}}isLocationOccluded(e){return this.currentTransform.isLocationOccluded(e)}transformLightDirection(e){return this.currentTransform.transformLightDirection(e)}getPixelScale(){return t.bk(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return t.bk(this._mercatorTransform.getCircleRadiusCorrection(),this._verticalPerspectiveTransform.getCircleRadiusCorrection(),this._globeness)}getPitchedTextCorrection(e,i,r){let a=this._mercatorTransform.getPitchedTextCorrection(e,i,r),n=this._verticalPerspectiveTransform.getPitchedTextCorrection(e,i,r);return t.bk(a,n,this._globeness)}projectTileCoordinates(e,t,i,r){return this.currentTransform.projectTileCoordinates(e,t,i,r)}_calcMatrices(){this._helper._width&&this._helper._height&&(this._verticalPerspectiveTransform.apply(this,this._globeLatitudeErrorCorrectionRadians),this._helper._nearZ=this._verticalPerspectiveTransform.nearZ,this._helper._farZ=this._verticalPerspectiveTransform.farZ,this._mercatorTransform.apply(this,!0,this.isGlobeRendering),this._helper._nearZ=this._mercatorTransform.nearZ,this._helper._farZ=this._mercatorTransform.farZ)}calculateFogMatrix(e){return this.currentTransform.calculateFogMatrix(e)}getVisibleUnwrappedCoordinates(e){return this.currentTransform.getVisibleUnwrappedCoordinates(e)}getCameraFrustum(){return this.currentTransform.getCameraFrustum()}getClippingPlane(){return this.currentTransform.getClippingPlane()}getCoveringTilesDetailsProvider(){return this.currentTransform.getCoveringTilesDetailsProvider()}recalculateZoomAndCenter(e){this._mercatorTransform.recalculateZoomAndCenter(e),this._verticalPerspectiveTransform.recalculateZoomAndCenter(e)}maxPitchScaleFactor(){return this._mercatorTransform.maxPitchScaleFactor()}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(e,t){return this.currentTransform.lngLatToCameraDepth(e,t)}populateCache(e){this._mercatorTransform.populateCache(e),this._verticalPerspectiveTransform.populateCache(e)}getBounds(){return this.currentTransform.getBounds()}getConstrained(e,t){return this.currentTransform.getConstrained(e,t)}calculateCenterFromCameraLngLatAlt(e,t,i,r){return this._helper.calculateCenterFromCameraLngLatAlt(e,t,i,r)}setLocationAtPoint(e,t){this.isGlobeRendering?(this._verticalPerspectiveTransform.setLocationAtPoint(e,t),this.apply(this._verticalPerspectiveTransform)):(this._mercatorTransform.setLocationAtPoint(e,t),this.apply(this._mercatorTransform))}locationToScreenPoint(e,t){return this.currentTransform.locationToScreenPoint(e,t)}screenPointToMercatorCoordinate(e,t){return this.currentTransform.screenPointToMercatorCoordinate(e,t)}screenPointToLocation(e,t){return this.currentTransform.screenPointToLocation(e,t)}
51isPointOnMapSurface(e,t){return this.currentTransform.isPointOnMapSurface(e,t)}getRayDirectionFromPixel(e){return this._verticalPerspectiveTransform.getRayDirectionFromPixel(e)}getMatrixForModel(e,t){return this.currentTransform.getMatrixForModel(e,t)}getProjectionDataForCustomLayer(e=!0){let t=this._mercatorTransform.getProjectionDataForCustomLayer(e);if(!this.isGlobeRendering)return t;let i=this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(e);return i.fallbackMatrix=t.mainMatrix,i}getFastPathSimpleProjectionMatrix(e){return this.currentTransform.getFastPathSimpleProjectionMatrix(e)}}class t${get useGlobeControls(){return!0}handlePanInertia(e,i){let r=tk(e,i);return Math.abs(r.lng-i.center.lng)>180&&(r.lng=i.center.lng+179.5*Math.sign(r.lng-i.center.lng)),{easingCenter:r,easingOffset:new t.P(0,0)}}handleMapControlsRollPitchBearingZoom(e,i){let r=e.around,a=i.screenPointToLocation(r);e.bearingDelta&&i.setBearing(i.bearing+e.bearingDelta),e.pitchDelta&&i.setPitch(i.pitch+e.pitchDelta),e.rollDelta&&i.setRoll(i.roll+e.rollDelta);let n=i.zoom;e.zoomDelta&&i.setZoom(i.zoom+e.zoomDelta);let s=i.zoom-n;if(0===s)return;let o=t.bA(i.center.lng,a.lng),l=o/(Math.abs(o/180)+1),h=t.bA(i.center.lat,a.lat),u=i.getRayDirectionFromPixel(r),c=i.cameraPosition,d=-1*t.aX(c,u),p=t.bp();t.aS(p,c,[u[0]*d,u[1]*d,u[2]*d]);let f=Math.exp(-(.5*Math.max(t.aZ(p)-1-.3,0))),m=tI(i.worldSize,i.center.lat)/Math.min(i.width,i.height),_=t.bn(m,.9,.5,1,.25),g=(1-t.af(-s))*Math.min(f,_),y=i.center.lat,x=i.zoom,v=new t.S(i.center.lng+l*g,t.ah(i.center.lat+h*g,-t.ai,t.ai));i.setLocationAtPoint(a,r);let b=i.center,w=Math.pow(Math.max(t.bn(Math.abs(o),45,85,0,1),t.bn(m,.75,.35,0,1)),.25),T=t.bA(b.lng,v.lng),P=t.bA(b.lat,v.lat);i.setCenter(new t.S(b.lng+T*w,b.lat+P*w).wrap()),i.setZoom(x+tz(y,i.center.lat))}handleMapControlsPan(e,t,i){if(!e.panDelta)return;let r=t.center.lat,a=t.zoom;t.setCenter(tk(e.panDelta,t).wrap()),t.setZoom(a+tz(r,t.center.lat))}cameraForBoxAndBearing(e,i,r,a,n){let s=tu(e,i,r,a,n),o=i.left/n.width*2-1,l=(n.width-i.right)/n.width*2-1,h=-(i.top/n.height*2)+1,u=-((n.height-i.bottom)/n.height*2)+1,c=0>t.bA(r.getWest(),r.getEast()),d=c?r.getEast():r.getWest(),p=c?r.getWest():r.getEast(),f=Math.max(r.getNorth(),r.getSouth()),m=Math.min(r.getNorth(),r.getSouth()),_=d+.5*t.bA(d,p),g=f+.5*t.bA(f,m),y=n.clone();y.setCenter(s.center),y.setBearing(s.bearing),y.setPitch(0),y.setRoll(0),y.setZoom(s.zoom);let x=y.modelViewProjectionMatrix,v=[tC(r.getNorthWest()),tC(r.getNorthEast()),tC(r.getSouthWest
51()),tC(r.getSouthEast()),tC(new t.S(p,g)),tC(new t.S(d,g)),tC(new t.S(_,f)),tC(new t.S(_,m))],b=tC(s.center),w=1/0;for(let e of v)o<0&&(w=t$.getLesserNonNegativeNonNull(w,t$.solveVectorScale(e,b,x,"x",o))),l>0&&(w=t$.getLesserNonNegativeNonNull(w,t$.solveVectorScale(e,b,x,"x",l))),h>0&&(w=t$.getLesserNonNegativeNonNull(w,t$.solveVectorScale(e,b,x,"y",h))),u<0&&(w=t$.getLesserNonNegativeNonNull(w,t$.solveVectorScale(e,b,x,"y",u)));if(Number.isFinite(w)&&0!==w)return s.zoom=y.zoom+t.ak(w),s;tl()}handleJumpToCenterZoom(e,i){let r=e.center.lat,a=e.getConstrained(i.center?t.S.convert(i.center):e.center,e.zoom).center;e.setCenter(a.wrap());let n=void 0!==i.zoom?+i.zoom:e.zoom+tz(r,a.lat);e.zoom!==n&&e.setZoom(n)}handleEaseTo(e,i){let r=e.zoom,a=e.center,n=e.padding,s={roll:e.roll,pitch:e.pitch,bearing:e.bearing},o={roll:void 0===i.roll?e.roll:i.roll,pitch:void 0===i.pitch?e.pitch:i.pitch,bearing:void 0===i.bearing?e.bearing:i.bearing},l=void 0!==i.zoom,h=!e.isPaddingEqual(i.padding),u=!1,c=i.center?t.S.convert(i.center):a,d=e.getConstrained(c,r).center;tt(e,d);let p=e.clone();p.setCenter(d),p.setZoom(l?+i.zoom:r+tz(a.lat,c.lat)),p.setBearing(i.bearing);let f=new t.P(t.ah(e.centerPoint.x+i.offsetAsPoint.x,0,e.width),t.ah(e.centerPoint.y+i.offsetAsPoint.y,0,e.height));p.setLocationAtPoint(d,f);let m=(i.offset&&i.offsetAsPoint.mag())>0?p.center:d,_=l?+i.zoom:r+tz(a.lat,m.lat),g=r+tz(a.lat,0),y=_+tz(m.lat,0),x=t.bA(a.lng,m.lng),v=t.bA(a.lat,m.lat),b=t.af(y-g);return{easeFunc:r=>{if(t.be(s,o)||th({startEulerAngles:s,endEulerAngles:o,tr:e,k:r,useSlerp:s.roll!=o.roll}),h&&e.interpolatePadding(n,i.padding,r),i.around)t.w("Easing around a point is not supported under globe projection."),e.setLocationAtPoint(i.around,i.aroundPoint);else{let t=Math.pow(y>g?Math.min(2,b):Math.max(.5,b),1-r),i=tR(a,x,v,r*t);e.setCenter(i.wrap())}if(u){let i=t.C.number(g,y,r)+tz(0,e.center.lat);e.setZoom(i)}},isZooming:u=_!==r,elevationCenter:m}}handleFlyTo(e,i){let r,a,n,s=void 0!==i.zoom,o=e.center,l=e.zoom,h=e.padding,u=!e.isPaddingEqual(i.padding),c=e.getConstrained(t.S.convert(i.center||i.locationAtOffset),l).center,d=s?+i.zoom:e.zoom+tz(e.center.lat,c.lat),p=e.clone();p.setCenter(c),p.setZoom(d),p.setBearing(i.bearing);let f=new t.P(t.ah(e.centerPoint.x+i.offsetAsPoint.x,0,e.width),t.ah(e.centerPoint.y+i.offsetAsPoint.y,0,e.height));p.setLocationAtPoint(c,f);let m=p.center;tt(e,m);let _=(a=tC(o),n=tC(m),Math.acos(t.aX(a,n))/(2*Math.PI)*tS(e)),g=l+tz(o.lat,0),y=d+tz(m.lat,0),x=t.af(y-g);if("number"==typeof i.minZoom){let a=Math.min(+i.minZoom+tz(m.lat,0),g,y)+tz(0,m.lat),n=e.getConstrained(m,a).zoom+tz(m.lat,0);r=t.af(n-g)}let v=t.bA(o.lng,m.lng),b=t.bA(o.lat,m.lat);return{easeFunc:(r,a,n,s)=>{let l=tR(o,v,b,n);u&&e.interpolatePadding(h,i.padding,r);let c=1===r?m:l;e.setCenter(c.wrap());let p=g+t.ak(a);e.setZoom(1===r?d:p+tz(0,c.lat))},scaleOfZoom:x,targetCenter:m,scaleOfMinZoom:r,pixelPathLength:_}}static solveVectorScale(e,t,i,r,a){let n="x"===r?[i[0],i[4],i[8],i[12]]:[i[1],i[5],i[9],i[13]],s=[i[3],i[7],i[11],i[15]],o=e[0]*n[0]+e[1]*n[1]+e[2]*n[2],l=e[0]*s[0]+e[1]*s[1]+e[2]*s[2],h=t[0]*n[0]+t[1]*n[1]+t[2]*n[2],u=t[0]*s[0]+t[1]*s[1]+t[2]*s[2];return h+a*l===o+a*u||s[3]*(o-h)+n[3]*(u-l)+o*u==h*l?null:(h+n[3]-a*u-a*s[3])/(h-o-a*u+a*l)}static getLesserNonNegativeNonNull(e,t){return null!==t&&t>=0&&t<e?t:e}}class tZ{constructor(e){this._globe=e,this._mercatorCameraHelper=new tc,this._verticalPerspectiveCameraHelper=new t$}get useGlobeControls(){return this._globe.useGlobeRendering}get currentHelper(){return this.useGlobeControls?this._verticalPerspectiveCameraHelper:this._mercatorCameraHelper}handlePanInertia(e,t){return this.currentHelper.handlePanInertia(e,t)}handleMapControlsRollPitchBearingZoom(e,t){return this.currentHelper.handleMapControlsRollPitchBearingZoom(e,t)}handleMapControlsPan(e,t,i){this.currentHelper.handleMapControlsPan(e,t,i)}cameraForBoxAndBearing(e,t,i,r,a){return this.currentHelper.cameraForBoxAndBearing(e,t,i,r,a)}handleJumpToCenterZoom(e,t){this.currentHelper.handleJumpToCenterZoom(e,t)}handleEaseTo(e,t){return this.currentHelper.handleEaseTo(e,t)}handleFlyTo(e,t){return this.currentHelper.handleFlyTo(e,t)}}
51let tG=(e,i)=>t.y(e,i&&i.filter(e=>"source.canvas"!==e.identifier)),tq=t.bE();class tW extends t.E{constructor(e,i={}){super(),this._rtlPluginLoaded=()=>{for(let e in this.sourceCaches){let t=this.sourceCaches[e].getSource().type;"vector"!==t&&"geojson"!==t||this.sourceCaches[e].reload()}},this.map=e,this.dispatcher=new F(L(),e._getMapId()),this.dispatcher.registerMessageHandler("GG",(e,t)=>this.getGlyphs(e,t)),this.dispatcher.registerMessageHandler("GI",(e,t)=>this.getImages(e,t)),this.imageManager=new T,this.imageManager.setEventedParent(this),this.glyphManager=new M(e._requestManager,i.localIdeographFontFamily),this.lineAtlas=new z(256,512),this.crossTileSymbolIndex=new e1,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new t.bF,this._loaded=!1,this._availableImages=[],this._globalState={},this._resetUpdates(),this.dispatcher.broadcast("SR",t.bG()),et().on(J,this._rtlPluginLoaded),this.on("data",e=>{if("source"!==e.dataType||"metadata"!==e.sourceDataType)return;let t=this.sourceCaches[e.sourceId];if(!t)return;let i=t.getSource();if(i&&i.vectorLayerIds)for(let e in this._layers){let t=this._layers[e];t.source===i.id&&this._validateLayer(t)}})}setGlobalStateProperty(e,i){var r,a,n;this._checkLoaded();let s=null===i?null!=(n=null==(a=null==(r=this.stylesheet.state)?void 0:r[e])?void 0:a.default)?n:null:i;if(t.bH(s,this._globalState[e]))return this;this._globalState[e]=s;let o=this._findGlobalStateAffectedSources([e]);for(let e in this.sourceCaches)o.has(e)&&(this._reloadSource(e),this._changed=!0)}getGlobalState(){return this._globalState}setGlobalState(e){this._checkLoaded();let i=[];for(let r in e)t.bH(this._globalState[r],e[r].default)||(i.push(r),this._globalState[r]=e[r].default);let r=this._findGlobalStateAffectedSources(i);for(let e in this.sourceCaches)r.has(e)&&(this._reloadSource(e),this._changed=!0)}_findGlobalStateAffectedSources(e){if(0===e.length)return new Set;let t=new Set;for(let i in this._layers){let r=this._layers[i],a=r.getLayoutAffectingGlobalStateRefs();for(let i of e)a.has(i)&&t.add(r.source)}return t}loadURL(e,i={},r){this.fire(new t.l("dataloading",{dataType:"style"})),i.validate="boolean"!=typeof i.validate||i.validate;let a=this.map._requestManager.transformRequest(e,"Style");this._loadStyleRequest=new AbortController;let n=this._loadStyleRequest;t.j(a,this._loadStyleRequest).then(e=>{this._loadStyleRequest=null,this._load(e.data,i,r)}).catch(e=>{this._loadStyleRequest=null,e&&!n.signal.aborted&&this.fire(new t.k(e))})}loadJSON(e,i={},r){this.fire(new t.l("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,d.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,i.validate=!1!==i.validate,this._load(e,i,r)}).catch(()=>{})}loadEmpty(){this.fire(new t.l("dataloading",{dataType:"style"})),this._load(tq,{validate:!1})}_load(e,i,r){var a,n,s;let o=i.transformStyle?i.transformStyle(r,e):e;if(!i.validate||!tG(this,t.z(o))){for(let e in this._loaded=!0,this.stylesheet=o,o.sources)this.addSource(e,o.sources[e],{validate:!1});o.sprite?this._loadSprite(o.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(o.glyphs),this._createLayers(),this.light=new I(this.stylesheet.light),this._setProjectionInternal((null==(a=this.stylesheet.projection)?void 0:a.type)||"mercator"),this.sky=new E(this.stylesheet.sky),this.map.setTerrain(null!=(n=this.stylesheet.terrain)?n:null),this.setGlobalState(null!=(s=this.stylesheet.state)?s:null),this.fire(new t.l("data",{dataType:"style"})),this.fire(new t.l("style.load"))}}_createLayers(){let e=t.bI(this.stylesheet.layers);for(let i of(this.dispatcher.broadcast("SL",e),this._order=e.map(e=>e.id),this._layers={},this._serializedLayers=null,e)){let e=t.bJ(i);e.setEventedParent(this,{layer:{id:i.id}}),this._layers[i.id]=e}}_loadSprite(e,i=!1,r){let a;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,(function(e,i,r,a){return t._(this,void 0,void 0,function*(){let n=b(e),s=r>1?"@2x":"",o={},l={};for(let{id:e,url:r}of n){let n=i.transformRequest(w(r,s,".json"),"SpriteJSON");o[e]=t.j(n,a);let u=i.transformRequest(w(r,s,".png"),"SpriteImage");l[e]=h.getImage(u,a)}return yield Promise.all([...Object.values(o),...Object.values(l)]),function(e,i){return t._(this,void 0,void 0,function*(){let t={};for(let r in e){t[r]={};let a=d.getImageCanvasContext((yield i[r]).data),n=(yield e[r]).data;for(let e in n){let{width:i,height:s,x:o,y:l,sdf:h,pixelRatio:u,stretchX:c,stretchY:d,content:p,textFitWidth:f,textFitHeight:m}=n[e];t[r][e]={data:null,pixelRatio:u,sdf:h,stretchX:c,stretchY:d,content:p,textFitWidth:f,textFitHeight:m,spriteData:{width:i,height:s,x:o,y:l,context:a}}}}return t})}(o,l)})})(e,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(e=>{if(this._spriteRequest=null,e)for(let t in e){for(let i of(this._spritesImagesIds[t]=[],this._spritesImagesIds[t]?this._spritesImagesIds[t].filter(t=>!(t in e)):[]))this.imageManager.removeImage(i),this._changedImages[i]=!0;for(let r in e[t]){let a="default"===t?r:`${t}:${r}`;this._spritesImagesIds[t].push(a),a in this.imageManager.images?this.imageManager.updateImage(a,e[t][r],!1):this.imageManager.addImage(a,e[t][r]),i&&(this._changedImages[a]=!0)}}}).catch(e=>{this._spriteRequest=null,a=e,this.fire(new t.k(a))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),i&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new t.l("data",{dataType:"style"})),r&&r(a)})}_unloadSprite(){for(let e of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(e),this._changedImages[e]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new t.l("data",{dataType:"style"}))}_validateLayer(e){let i=this.sourceCaches[e.source];if(!i)return;let r=e.sourceLayer;if(!r)return;let a=i.getSource();("geojson"===a.type||a.vectorLayerIds&&-1===a.vectorLayerIds.indexOf(r))&&this.fire(new t.k(Error(`Source layer "${r}" does not exist on source "${a.id}" as specified by style layer "${e.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(let e in this.sourceCaches)if(!this.sourceCaches[e].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(e,i=!1){let r=this._serializedAllLayers();if(!e||0===e.length)return Object.values(i?t.bK(r):r);let a=[];for(let n of e)if(r[n]){let e=i?t.bK(r[n]):r[n];a.push(e)}return a}_serializedAllLayers(){let e=this._serializedLayers;if(e)return e;for(let t of(e=this._serializedLayers={},Object.keys(this._layers))){let i=this._layers[t];
51"custom"!==i.type&&(e[t]=i.serialize())}return e}hasTransitions(){var e,t,i;if((null==(e=this.light)?void 0:e.hasTransition())||(null==(t=this.sky)?void 0:t.hasTransition())||(null==(i=this.projection)?void 0:i.hasTransition()))return!0;for(let e in this.sourceCaches)if(this.sourceCaches[e].hasTransition())return!0;for(let e in this._layers)if(this._layers[e].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw Error("Style is not done loading.")}update(e){if(!this._loaded)return;let i=this._changed;if(i){let t=Object.keys(this._updatedLayers),i=Object.keys(this._removedLayers);for(let e in(t.length||i.length)&&this._updateWorkerLayers(t,i),this._updatedSources){let t=this._updatedSources[e];if("reload"===t)this._reloadSource(e);else{if("clear"!==t)throw Error(`Invalid action ${t}`);this._clearSource(e)}}for(let t in this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs(),this._updatedPaintProps)this._layers[t].updateTransitions(e);this.light.updateTransitions(e),this.sky.updateTransitions(e),this._resetUpdates()}let r={};for(let e in this.sourceCaches){let t=this.sourceCaches[e];r[e]=t.used,t.used=!1}for(let t of this._order){let i=this._layers[t];i.recalculate(e,this._availableImages),!i.isHidden(e.zoom)&&i.source&&(this.sourceCaches[i.source].used=!0)}for(let e in r){let i=this.sourceCaches[e];!!r[e]!=!!i.used&&i.fire(new t.l("data",{sourceDataType:"visibility",dataType:"source",sourceId:e}))}this.light.recalculate(e),this.sky.recalculate(e),this.projection.recalculate(e),this.z=e.zoom,i&&this.fire(new t.l("data",{dataType:"style"}))}_updateTilesForChangedImages(){let e=Object.keys(this._changedImages);if(e.length){for(let t in this.sourceCaches)this.sourceCaches[t].reloadTilesForDependencies(["icons","patterns"],e);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(let e in this.sourceCaches)this.sourceCaches[e].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(e,t){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(e,!1),removedIds:t})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(e,i={}){var r;this._checkLoaded();let a=this.serialize();if(e=i.transformStyle?i.transformStyle(a,e):e,(null==(r=i.validate)||r)&&tG(this,t.z(e)))return!1;(e=t.bK(e)).layers=t.bI(e.layers);let n=t.bL(a,e),s=this._getOperationsToPerform(n);if(s.unimplemented.length>0)throw Error(`Unimplemented: ${s.unimplemented.join(", ")}.`);if(0===s.operations.length)return!1;for(let e of s.operations)e();return this.stylesheet=e,this._serializedLayers=null,!0}_getOperationsToPerform(e){let t=[],i=[];for(let r of e)switch(r.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":case"setRoll":continue;case"addLayer":t.push(()=>this.addLayer.apply(this,r.args));break;case"removeLayer":t.push(()=>this.removeLayer.apply(this,r.args));break;case"setPaintProperty":t.push(()=>this.setPaintProperty.apply(this,r.args));break;case"setLayoutProperty":t.push(()=>this.setLayoutProperty.apply(this,r.args));break;case"setFilter":t.push(()=>this.setFilter.apply(this,r.args));break;case"addSource":t.push(()=>this.addSource.apply(this,r.args));break;case"removeSource":t.push(()=>this.removeSource.apply(this,r.args));break;case"setLayerZoomRange":t.push(()=>this.setLayerZoomRange.apply(this,r.args));break;case"setLight":t.push(()=>this.setLight.apply(this,r.args));break;case"setGeoJSONSourceData":t.push(()=>this.setGeoJSONSourceData.apply(this,r.args));break;case"setGlyphs":t.push(()=>this.setGlyphs.apply(this,r.args));break;case"setSprite":t.push(()=>this.setSprite.apply(this,r.args));break;case"setTerrain":t.push(()=>this.map.setTerrain.apply(this,r.args));break;case"setSky":t.push(()=>this.setSky.apply(this,r.args));break;case"setProjection":this.setProjection.apply(this,r.args);break;case"setGlobalState":t.push(()=>this.setGlobalState.apply(this,r.args));break;case"setTransition":t.push(()=>{});break;default:i.push(r.command)}return{operations:t,unimplemented:i}}addImage(e,i){if(this.getImage(e))return this.fire(new t.k(Error(`An image named "${e}" already exists.`)));this.imageManager.addImage(e,i),this._afterImageUpdated(e)}updateImage(e,t){this.imageManager.updateImage(e,t)}getImage(e){return this.imageManager.getImage(e)}removeImage(e){if(!this.getImage(e))return this.fire(new t.k(Error(`An image named "${e}" does not exist.`)));this.imageManager.removeImage(e),this._afterImageUpdated(e)}_afterImageUpdated(e){this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new t.l("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,i,r={}){if(this._checkLoaded(),void 0!==this.sourceCaches[e])throw Error(`Source "${e}" already exists.`);if(!i.type)throw Error(`The type property must be defined, but only the following properties were given: ${Ob
51ject.keys(i).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(i.type)>=0&&this._validate(t.z.source,`sources.${e}`,i,null,r))return;this.map&&this.map._collectResourceTiming&&(i.collectResourceTiming=!0);let a=this.sourceCaches[e]=new e_(e,i,this.dispatcher);a.style=this,a.setEventedParent(this,()=>({isSourceLoaded:a.loaded(),source:a.serialize(),sourceId:e})),a.onAdd(this.map),this._changed=!0}removeSource(e){if(this._checkLoaded(),void 0===this.sourceCaches[e])throw Error("There is no source with this ID");for(let i in this._layers)if(this._layers[i].source===e)return this.fire(new t.k(Error(`Source "${e}" cannot be removed while layer "${i}" is using it.`)));let i=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],i.fire(new t.l("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),i.setEventedParent(null),i.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(e,t){if(this._checkLoaded(),void 0===this.sourceCaches[e])throw Error(`There is no source with this ID=${e}`);let i=this.sourceCaches[e].getSource();if("geojson"!==i.type)throw Error(`geojsonSource.type is ${i.type}, which is !== 'geojson`);i.setData(t),this._changed=!0}getSource(e){return this.sourceCaches[e]&&this.sourceCaches[e].getSource()}addLayer(e,i,r={}){let a;this._checkLoaded();let n=e.id;if(this.getLayer(n))return void this.fire(new t.k(Error(`Layer "${n}" already exists on this map.`)));if("custom"===e.type){if(tG(this,t.bM(e)))return;a=t.bJ(e)}else{if("source"in e&&"object"==typeof e.source&&(this.addSource(n,e.source),e=t.bK(e),e=t.e(e,{source:n})),this._validate(t.z.layer,`layers.${n}`,e,{arrayIndex:-1},r))return;a=t.bJ(e),this._validateLayer(a),a.setEventedParent(this,{layer:{id:n}})}let s=i?this._order.indexOf(i):this._order.length;if(i&&-1===s)this.fire(new t.k(Error(`Cannot add layer "${n}" before non-existing layer "${i}".`)));else{if(this._order.splice(s,0,n),this._layerOrderChanged=!0,this._layers[n]=a,this._removedLayers[n]&&a.source&&"custom"!==a.type){let e=this._removedLayers[n];delete this._removedLayers[n],e.type!==a.type?this._updatedSources[a.source]="clear":(this._updatedSources[a.source]="reload",this.sourceCaches[a.source].pause())}this._updateLayer(a),a.onAdd&&a.onAdd(this.map)}}moveLayer(e,i){if(this._checkLoaded(),this._changed=!0,!this._layers[e])return void this.fire(new t.k(Error(`The layer '${e}' does not exist in the map's style and cannot be moved.`)));if(e===i)return;let r=this._order.indexOf(e);this._order.splice(r,1);let a=i?this._order.indexOf(i):this._order.length;i&&-1===a?this.fire(new t.k(Error(`Cannot move layer "${e}" before non-existing layer "${i}".`))):(this._order.splice(a,0,e),this._layerOrderChanged=!0)}removeLayer(e){this._checkLoaded();let i=this._layers[e];if(!i)return void this.fire(new t.k(Error(`Cannot remove non-existing layer "${e}".`)));i.setEventedParent(null);let r=this._order.indexOf(e);this._order.splice(r,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=i,delete this._layers[e],this._serializedLayers&&delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],i.onRemove&&i.onRemove(this.map)}getLayer(e){return this._layers[e]}getLayersOrder(){return[...this._order]}hasLayer(e){return e in this._layers}setLayerZoomRange(e,i,r){this._checkLoaded();let a=this.getLayer(e);a?a.minzoom===i&&a.maxzoom===r||(null!=i&&(a.minzoom=i),null!=r&&(a.maxzoom=r),this._updateLayer(a)):this.fire(new t.k(Error(`Cannot set the zoom range of non-existing layer "${e}".`)))}setFilter(e,i,r={}){this._checkLoaded();let a=this.getLayer(e);if(a){if(!t.bH(a.filter,i))return null==i?(a.setFilter(void 0),void this._updateLayer(a)):void(this._validate(t.z.filter,`layers.${a.id}.filter`,i,null,r)||(a.setFilter(t.bK(i)),this._updateLayer(a)))}else this.fire(new t.k(Error(`Cannot filter non-existing layer "${e}".`)))}getFilter(e){return t.bK(this.getLayer(e).filter)}setLayoutProperty(e,i,r,a={}){this._checkLoaded();let n=this.getLayer(e);n?t.bH(n.getLayoutProperty(i),r)||(n.setLayoutProperty(i,r,a),this._updateLayer(n)):this.fire(new t.k(Error(`Cannot style non-existing layer "${e}".`)))}getLayoutProperty(e,i){let r=this.getLayer(e);if(r)return r.getLayoutProperty(i);this.fire(new t.k(Error(`Cannot get style of non-existing layer "${e}".`)))}setPaintProperty(e,i,r,a={}){this._checkLoaded();let n=this.getLayer(e);n?t.bH(n.getPaintProperty(i),r)||(n.setPaintProperty(i,r,a)&&this._updateLayer(n),this._changed=!0,this._updatedPaintProps[e]=!0,this._serializedLayers=null):this.fire(new t.k(Error(`Cannot style non-existing layer "${e}".`)))}getPaintProperty(e,t){return this.getLayer(e).getPaintProperty(t)}setFeatureState(e,i){this._checkLoaded();let r=e.source,a=e.sourceLayer,n=this.sourceCaches[r];if(void 0===n)return void this.fire(new t.k(Error(`The source '${r}' does not exist in the map's style.`)));let s=n.getSource().type;"geojson"===s&&a?this.fire(new t.k(Error("GeoJSON sources cannot have a sourceLayer parameter."))):"vector"!==s||a?(void 0===e.id&&this.fire(new t.k(Error("The feature id parameter must be provided."))),n.setFeatureState(a,e.id,i)):this.fire(new t.k(Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(e,i){this._checkLoaded();let r=e.source,a=this.sourceCaches[r];if(void 0===a)return void this.fire(new t.k(Error(`The source '${r}' does not exist in the map's style.`)));let n=a.getSource().type,s="vector"===n?e.sourceLayer:void 0;"vector"!==n||s?i&&"string"!=typeof e.id&&"number"!=typeof e.id?this.fire(new t.k(Error("A feature id is required to remove its specific state property."))):a.removeFeatureState(s,e.id,i):this.fire(new t.k(Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(e){this._checkLoaded();let i=e.source,r=e.sourceLayer,a=this.sourceCaches[i];if(void 0!==a)return"vector"!==a.getSource().type||r?(void 0===e.id&&this.fire(new t.k(Error("The feature id parameter must be provided."))),a.getFeatureState(r,e.id)):void this.fire(new t.k(Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new t.k(Error(`The source '${i}' does not exist in the map's style.`)))}getTransition(){return t.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;let e=t.bN(this.sourceCaches,e=>e.serialize()),i=this._serializeByIds(this._order,!0),r=this.map.getTerrain()||void 0,a=this.stylesheet;return t.bO({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,projection:a.projection,sources:e,layers:i,terrain:r},e=>void 0!==e)}_updateLayer(e){this._updatedLayers[e.id]=!0,e.source&&!this._updatedSources[e.source]&&"raster"!==this.sourceCaches[e.source].getSource().type&&(this._updatedSources[e.source]="reload",this.sourceCaches[e.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(e){let t=e=>"fill-extrusion"===this._layers[e].type,i={},r=[];for(let a=this._order.length-1;a>=0;a--){let n=this._order[a];if(t(n))for(let t of(i[n]=a,e)){let e=t[n];if(e)for(let t of e)r.push(t)}}r.sort((e,t)=>
51t.intersectionZ-e.intersectionZ);let a=[];for(let n=this._order.length-1;n>=0;n--){let s=this._order[n];if(t(s))for(let e=r.length-1;e>=0;e--){let t=r[e].feature;if(i[t.layer.id]<n)break;a.push(t),r.pop()}else for(let t of e){let e=t[s];if(e)for(let t of e)a.push(t.feature)}}return a}queryRenderedFeatures(e,i,r){i&&i.filter&&this._validate(t.z.filter,"queryRenderedFeatures.filter",i.filter,null,i);let a={};if(i&&i.layers){if(!(Array.isArray(i.layers)||i.layers instanceof Set))return this.fire(new t.k(Error("parameters.layers must be an Array or a Set of strings"))),[];for(let e of i.layers){let i=this._layers[e];if(!i)return this.fire(new t.k(Error(`The layer '${e}' does not exist in the map's style and cannot be queried for features.`))),[];a[i.source]=!0}}let n=[];i.availableImages=this._availableImages;let s=this._serializedAllLayers(),o=i.layers instanceof Set?i.layers:Array.isArray(i.layers)?new Set(i.layers):null,l=Object.assign(Object.assign({},i),{layers:o});for(let o in this.sourceCaches)i.layers&&!a[o]||n.push(function(e,i,r,a,n,s,o){let l=function(e,t,i){if(e)for(let r of e){let e=t[r];if(e&&e.source===i&&"fill-extrusion"===e.type)return!0}else for(let e in t){let r=t[e];if(r.source===i&&"fill-extrusion"===r.type)return!0}return!1}(null!=(d=null==n?void 0:n.layers)?d:null,i,e.id),h=s.maxPitchScaleFactor(),u=e.tilesIn(a,h,l);u.sort(O);let c=[];for(let a of u)c.push({wrappedTileID:a.tileID.wrapped().key,queryResults:a.tile.queryRenderedFeatures(i,r,e._state,a.queryGeometry,a.cameraQueryGeometry,a.scale,n,s,h,function(e,i){let r=t.L();return t.M(r,r,[1,1,0]),t.N(r,r,[.5*e.width,.5*e.height,1]),e.calculatePosMatrix?t.O(r,r,e.calculatePosMatrix(i.toUnwrapped())):r}(e.transform,a.tileID),o?(e,t)=>o(a.tileID,e,t):void 0)});var d,p=function(e){let t={},i={};for(let r of e){let e=r.queryResults,a=r.wrappedTileID,n=i[a]=i[a]||{};for(let i in e){let r=e[i],a=n[i]=n[i]||{},s=t[i]=t[i]||[];for(let e of r)a[e.featureIndex]||(a[e.featureIndex]=!0,s.push(e))}}return t}(c);for(let t in p)for(let i of p[t])j(i,e);return p}(this.sourceCaches[o],this._layers,s,e,l,r,this.map.terrain?(e,t,i)=>this.map.terrain.getElevation(e,t,i):void 0));return this.placement&&n.push(function(e,t,i,r,a,n,s){let o={},l=n.queryRenderedSymbols(r),h=[];for(let e of Object.keys(l).map(Number))h.push(s[e]);for(let i of(h.sort(O),h)){let r=i.featureIndex.lookupSymbolFeatures(l[i.bucketInstanceId],t,i.bucketIndex,i.sourceLayerIndex,a.filter,a.layers,a.availableImages,e);for(let e in r){let t=o[e]=o[e]||[],a=r[e];for(let e of(a.sort((e,t)=>{let r=i.featureSortOrder;if(r){let i=r.indexOf(e.featureIndex);return r.indexOf(t.featureIndex)-i}return t.featureIndex-e.featureIndex}),a))t.push(e)}}for(let t in o)for(let r of o[t])j(r,i[e[t].source]);return o}(this._layers,s,this.sourceCaches,e,l,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(n)}querySourceFeatures(e,i){i&&i.filter&&this._validate(t.z.filter,"querySourceFeatures.filter",i.filter,null,i);let r=this.sourceCaches[e];return r?function(e,t){let i=e.getRenderableIds().map(t=>e.getTileByID(t)),r=[],a={};for(let e=0;e<i.length;e++){let n=i[e],s=n.tileID.canonical.key;a[s]||(a[s]=!0,n.querySourceFeatures(r,t))}return r}(r,i):[]}getLight(){return this.light.getLight()}setLight(e,i={}){this._checkLoaded();let r=this.light.getLight(),a=!1;for(let i in e)if(!t.bH(e[i],r[i])){a=!0;break}if(!a)return;let n={now:d.now(),transition:t.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,i),this.light.updateTransitions(n)}getProjection(){var e;return null==(e=this.stylesheet)?void 0:e.projection}setProjection(e){if(this._checkLoaded(),this.projection){if(this.projection.name===e.type)return;this.projection.destroy(),delete this.projection}this.stylesheet.projection=e,this._setProjectionInternal(e.type)}getSky(){var e;return null==(e=this.stylesheet)?void 0:e.sky}setSky(e,i={}){this._checkLoaded();let r=this.getSky(),a=!1;if(!e&&!r)return;if(e&&!r)a=!0;else if(!e&&r)a=!0;else for(let i in e)if(!t.bH(e[i],r[i])){a=!0;break}if(!a)return;let n={now:d.now(),transition:t.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=e,this.sky.setSky(e,i),this.sky.updateTransitions(n)}_setProjectionInternal(e){let i=function(e){if(Array.isArray(e)){let t=new tP({type:e});return{projection:t,transform:new tN,cameraHelper:new tZ(t)}}switch(e){case"mercator":return{projection:new e7,transform:new to,cameraHelper:new tc};case"globe":{let e=new tP({type:["interpolate",["linear"],["zoom"],11,"vertical-perspective",12,"mercator"]});return{projection:e,transform:new tN,cameraHelper:new tZ(e)}}case"vertical-perspective":return{projection:new tw,transform:new tU,cameraHelper:new t$};default:return t.w(`Unknown projection name: ${e}. Falling back to mercator projection.`),{projection:new e7,transform:new to,cameraHelper:new tc}}}(e);for(let e in this.projection=i.projection,this.map.migrateProjection(i.transform,i.cameraHelper),this.sourceCaches)this.sourceCaches[e].reload()}_validate(e,i,r,a,n={}){return(!n||!1!==n.validate)&&tG(this,e.call(t.z,t.e({key:i,style:this.serialize(),value:r,styleSpec:t.v},a)))}_remove(e=!0){for(let e in this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null),et().off(J,this._rtlPluginLoaded),this._layers)this._layers[e].setEventedParent(null);for(let e in this.sourceCaches){let t=this.sourceCaches[e];t.setEventedParent(null),t.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),e&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(e)}_clearSource(e){this.sourceCaches[e].clearTiles()}_reloadSource(e){this.sourceCaches[e].resume(),this.sourceCaches[e].reload()}_updateSources(e){for(let t in this.sourceCaches)this.sourceCaches[t].update(e,this.map.terrain)}_generateCollisionBoxes(){for(let e in this.sourceCaches)this._reloadSource(e)}_updatePlacement(e,t,i,r,a=!1){let n=!1,s=!1,o={};for(let t of this._order){let i=this._layers[t];
51if("symbol"!==i.type)continue;if(!o[i.source]){let e=this.sourceCaches[i.source];o[i.source]=e.getRenderableIds(!0).map(t=>e.getTileByID(t)).sort((e,t)=>t.tileID.overscaledZ-e.tileID.overscaledZ||(e.tileID.isLessThan(t.tileID)?-1:1))}let r=this.crossTileSymbolIndex.addLayer(i,o[i.source],e.center.lng);n=n||r}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((a=a||this._layerOrderChanged||0===i)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(d.now(),e.zoom))&&(this.pauseablePlacement=new eY(e,this.map.terrain,this._order,a,t,i,r,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,o),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(d.now()),s=!0),n&&this.pauseablePlacement.placement.setStale()),s||n)for(let e of this._order){let t=this._layers[e];"symbol"===t.type&&this.placement.updateLayerOpacities(t,o[t.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(d.now())}_releaseSymbolFadeTiles(){for(let e in this.sourceCaches)this.sourceCaches[e].releaseSymbolFadeTiles()}getImages(e,i){return t._(this,void 0,void 0,function*(){let e=yield this.imageManager.getImages(i.icons);this._updateTilesForChangedImages();let t=this.sourceCaches[i.source];return t&&t.setDependencies(i.tileID.key,i.type,i.icons),e})}getGlyphs(e,i){return t._(this,void 0,void 0,function*(){let e=yield this.glyphManager.getGlyphs(i.stacks),t=this.sourceCaches[i.source];return t&&t.setDependencies(i.tileID.key,i.type,[""]),e})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(e,i={}){this._checkLoaded(),e&&this._validate(t.z.glyphs,"glyphs",e,null,i)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=e,this.glyphManager.entries={},this.glyphManager.setURL(e))}addSprite(e,i,r={},a){this._checkLoaded();let n=[{id:e,url:i}],s=[...b(this.stylesheet.sprite),...n];this._validate(t.z.sprite,"sprite",s,null,r)||(this.stylesheet.sprite=s,this._loadSprite(n,!0,a))}removeSprite(e){this._checkLoaded();let i=b(this.stylesheet.sprite);if(i.find(t=>t.id===e)){if(this._spritesImagesIds[e])for(let t of this._spritesImagesIds[e])this.imageManager.removeImage(t),this._changedImages[t]=!0;i.splice(i.findIndex(t=>t.id===e),1),this.stylesheet.sprite=i.length>0?i:void 0,delete this._spritesImagesIds[e],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new t.l("data",{dataType:"style"}))}else this.fire(new t.k(Error(`Sprite "${e}" doesn't exists on this map.`)))}getSprite(){return b(this.stylesheet.sprite)}setSprite(e,i={},r){this._checkLoaded(),e&&this._validate(t.z.sprite,"sprite",e,null,i)||(this.stylesheet.sprite=e,e?this._loadSprite(e,!0,r):(this._unloadSprite(),r&&r(null)))}}var tH=t.aJ([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class tX{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(e,t,i,r,a,n,s,o,l){this.context=e;let h=this.boundPaintVertexBuffers.length!==r.length;for(let e=0;!h&&e<r.length;e++)this.boundPaintVertexBuffers[e]!==r[e]&&(h=!0);!this.vao||this.boundProgram!==t||this.boundLayoutVertexBuffer!==i||h||this.boundIndexBuffer!==a||this.boundVertexOffset!==n||this.boundDynamicVertexBuffer!==s||this.boundDynamicVertexBuffer2!==o||this.boundDynamicVertexBuffer3!==l?this.freshBind(t,i,r,a,n,s,o,l):(e.bindVertexArray.set(this.vao),s&&s.bind(),a&&a.dynamicDraw&&a.bind(),o&&o.bind(),l&&l.bind())}freshBind(e,t,i,r,a,n,s,o){let l=e.numAttributes,h=this.context,u=h.gl;for(let l of(this.vao&&this.destroy(),this.vao=h.createVertexArray(),h.bindVertexArray.set(this.vao),this.boundProgram=e,this.boundLayoutVertexBuffer=t,this.boundPaintVertexBuffers=i,this.boundIndexBuffer=r,this.boundVertexOffset=a,this.boundDynamicVertexBuffer=n,this.boundDynamicVertexBuffer2=s,this.boundDynamicVertexBuffer3=o,t.enableAttributes(u,e),i))l.enableAttributes(u,e);for(let r of(n&&n.enableAttributes(u,e),s&&s.enableAttributes(u,e),o&&o.enableAttributes(u,e),t.bind(),t.setVertexAttribPointers(u,e,a),i))r.bind(),r.setVertexAttribPointers(u,e,a);n&&(n.bind(),n.setVertexAttribPointers(u,e,a)),r&&r.bind(),s&&(s.bind(),s.setVertexAttribPointers(u,e,a)),o&&(o.bind(),o.setVertexAttribPointers(u,e,a)),h.currentNumAttributes=l}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}let tY=(e,i,r,a,n)=>({u_texture:0,u_ele_delta:e,u_fog_matrix:i,u_fog_color:r?r.properties.get("fog-color"):t.bf.white,u_fog_ground_blend:r?r.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:n?0:r?r.calculateFogBlendOpacity(a):0,u_horizon_color:r?r.properties.get("horizon-color"):t.bf.white,u_horizon_fog_blend:r?r.properties.get("horizon-fog-blend"):1,u_is_globe_mode:+!!n}
51),tK={mainMatrix:"u_projection_matrix",tileMercatorCoords:"u_projection_tile_mercator_coords",clippingPlane:"u_projection_clipping_plane",projectionTransition:"u_projection_transition",fallbackMatrix:"u_projection_fallback_matrix"};function tJ(e){let t=[];for(let i=0;i<e.length;i++){if(null===e[i])continue;let r=e[i].split(" ");t.push(r.pop())}return t}class tQ{constructor(e,i,r,a,n,s,o,l,h=[]){const u=e.gl;this.program=u.createProgram();const c=tJ(i.staticAttributes),d=r?r.getBinderAttributes():[],p=c.concat(d),f=e3.prelude.staticUniforms?tJ(e3.prelude.staticUniforms):[],m=o.staticUniforms?tJ(o.staticUniforms):[],_=i.staticUniforms?tJ(i.staticUniforms):[],g=r?r.getBinderUniforms():[],y=f.concat(m).concat(_).concat(g),x=[];for(const e of y)0>x.indexOf(e)&&x.push(e);const v=r?r.defines():[];tg(u)&&v.unshift("#version 300 es"),n&&v.push("#define OVERDRAW_INSPECTOR;"),s&&v.push("#define TERRAIN3D;"),l&&v.push(l),h&&v.push(...h);let b=v.concat(e3.prelude.fragmentSource,o.fragmentSource,i.fragmentSource).join("\n"),w=v.concat(e3.prelude.vertexSource,o.vertexSource,i.vertexSource).join("\n");tg(u)||(b=function(e){return e.replace(/\bin\s/g,"varying ").replace("out highp vec4 fragColor;","").replace(/fragColor/g,"gl_FragColor").replace(/texture\(/g,"texture2D(")}(b),w=function(e){return e.replace(/\bin\s/g,"attribute ").replace(/\bout\s/g,"varying ").replace(/texture\(/g,"texture2D(")}(w));const T=u.createShader(u.FRAGMENT_SHADER);if(u.isContextLost())return void(this.failedToCreate=!0);if(u.shaderSource(T,b),u.compileShader(T),!u.getShaderParameter(T,u.COMPILE_STATUS))throw Error(`Could not compile fragment shader: ${u.getShaderInfoLog(T)}`);u.attachShader(this.program,T);const P=u.createShader(u.VERTEX_SHADER);if(u.isContextLost())return void(this.failedToCreate=!0);if(u.shaderSource(P,w),u.compileShader(P),!u.getShaderParameter(P,u.COMPILE_STATUS))throw Error(`Could not compile vertex shader: ${u.getShaderInfoLog(P)}`);u.attachShader(this.program,P),this.attributes={};const S={};this.numAttributes=p.length;for(let e=0;e<this.numAttributes;e++)p[e]&&(u.bindAttribLocation(this.program,e,p[e]),this.attributes[p[e]]=e);if(u.linkProgram(this.program),!u.getProgramParameter(this.program,u.LINK_STATUS))throw Error(`Program failed to link: ${u.getProgramInfoLog(this.program)}`);u.deleteShader(P),u.deleteShader(T);for(let e=0;e<x.length;e++){const t=x[e];if(t&&!S[t]){const e=u.getUniformLocation(this.program,t);e&&(S[t]=e)}}this.fixedUniforms=a(e,S),this.terrainUniforms=((e,i)=>({u_depth:new t.bP(e,i.u_depth),u_terrain:new t.bP(e,i.u_terrain),u_terrain_dim:new t.bg(e,i.u_terrain_dim),u_terrain_matrix:new t.bR(e,i.u_terrain_matrix),u_terrain_unpack:new t.bS(e,i.u_terrain_unpack),u_terrain_exaggeration:new t.bg(e,i.u_terrain_exaggeration)}))(e,S),this.projectionUniforms=((e,i)=>({u_projection_matrix:new t.bR(e,i.u_projection_matrix),u_projection_tile_mercator_coords:new t.bS(e,i.u_projection_tile_mercator_coords),u_projection_clipping_plane:new t.bS(e,i.u_projection_clipping_plane),u_projection_transition:new t.bg(e,i.u_projection_transition),u_projection_fallback_matrix:new t.bR(e,i.u_projection_fallback_matrix)}))(e,S),this.binderUniforms=r?r.getUniforms(e,S):[]}draw(e,t,i,r,a,n,s,o,l,h,u,c,d,p,f,m,_,g,y){let x=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.setDepthMode(i),e.setStencilMode(r),e.setColorMode(a),e.setCullFace(n),o)for(let t in e.activeTexture.set(x.TEXTURE2),x.bindTexture(x.TEXTURE_2D,o.depthTexture),e.activeTexture.set(x.TEXTURE3),x.bindTexture(x.TEXTURE_2D,o.texture),this.terrainUniforms)this.terrainUniforms[t].set(o[t]);if(l)for(let e in l)this.projectionUniforms[tK[e]].set(l[e]);if(s)for(let e in this.fixedUniforms)this.fixedUniforms[e].set(s[e]);m&&m.setUniforms(e,this.binderUniforms,p,{zoom:f});let v=0;switch(t){case x.LINES:v=2;break;case x.TRIANGLES:v=3;break;case x.LINE_STRIP:v=1}for(let i of d.get()){let r=i.vaos||(i.vaos={});(r[h]||(r[h]=new tX)).bind(e,this,u,m?m.getPaintVertexBuffers():[],c,i.vertexOffset,_,g,y),x.drawElements(t,i.primitiveLength*v,x.UNSIGNED_SHORT,i.primitiveOffset*v*2)}}}function t0(e,i,r){let a=1/t.aC(r,1,i.transform.tileZoom),n=Math.pow(2,r.tileID.overscaledZ
51),s=r.tileSize*Math.pow(2,i.transform.tileZoom)/n,o=s*(r.tileID.canonical.x+r.tileID.wrap*n),l=s*r.tileID.canonical.y;return{u_image:0,u_texsize:r.imageAtlasTexture.size,u_scale:[a,e.fromScale,e.toScale],u_fade:e.t,u_pixel_coord_upper:[o>>16,l>>16],u_pixel_coord_lower:[65535&o,65535&l]}}let t1=(e,i,r,a)=>{let n=e.style.light,s=n.properties.get("position"),o=[s.x,s.y,s.z],l=t.bV();"viewport"===n.properties.get("anchor")&&t.bW(l,e.transform.bearingInRadians),t.bX(o,o,l);let h=e.transform.transformLightDirection(o),u=n.properties.get("color");return{u_lightpos:o,u_lightpos_globe:h,u_lightintensity:n.properties.get("intensity"),u_lightcolor:[u.r,u.g,u.b],u_vertical_gradient:+i,u_opacity:r,u_fill_translate:a}},t2=(e,i,r,a,n,s,o)=>t.e(t1(e,i,r,a),t0(s,e,o),{u_height_factor:-Math.pow(2,n.overscaledZ)/o.tileSize/8}),t3=(e,i,r,a)=>t.e(t0(i,e,r),{u_fill_translate:a}),t5=(e,t)=>({u_world:e,u_fill_translate:t}),t4=(e,i,r,a,n)=>t.e(t3(e,i,r,n),{u_world:a}),t6=(e,i,r,a,n)=>{let s=e.transform,o,l,h=0;if("map"===r.paint.get("circle-pitch-alignment")){let e=t.aC(i,1,s.zoom);o=!0,l=[e,e],h=e/(t.$*Math.pow(2,i.tileID.overscaledZ))*2*Math.PI*n}else o=!1,l=s.pixelsToGLUnits;return{u_camera_to_center_distance:s.cameraToCenterDistance,u_scale_with_map:+("map"===r.paint.get("circle-pitch-scale")),u_pitch_with_map:+o,u_device_pixel_ratio:e.pixelRatio,u_extrude_scale:l,u_globe_extrude_scale:h,u_translate:a}},t8=e=>({u_pixel_extrude_scale:[1/e.width,1/e.height]}),t9=e=>({u_viewport_size:[e.width,e.height]}),t7=(e,t=1)=>({u_color:e,u_overlay:0,u_overlay_scale:t}),ie=(e,i,r,a)=>{let n=t.aC(e,1,i)/(t.$*Math.pow(2,e.tileID.overscaledZ))*2*Math.PI*a;return{u_extrude_scale:t.aC(e,1,i),u_intensity:r,u_globe_extrude_scale:n}},it=(e,i,r,a)=>{let n=t.L();t.bY(n,0,e.width,e.height,0,0,1);let s=e.context.gl;return{u_matrix:n,u_world:[s.drawingBufferWidth,s.drawingBufferHeight],u_image:r,u_color_ramp:a,u_opacity:i.paint.get("heatmap-opacity")}},ii=(e,i,r)=>{var a;let n,s,o,l=r.paint.get("hillshade-accent-color");switch(r.paint.get("hillshade-method")){case"basic":o=4;break;case"combined":o=1;break;case"igor":o=2;break;case"multidirectional":o=3;break;default:o=0}let h=r.getIlluminationProperties();for(let t=0;t<h.directionRadians.length;t++)"viewport"===r.paint.get("hillshade-illumination-anchor")&&(h.directionRadians[t]+=e.transform.bearingInRadians);return{u_image:0,u_latrange:(n=Math.pow(2,(a=i.tileID).canonical.z),s=a.canonical.y,[new t.a1(0,s/n).toLngLat().lat,new t.a1(0,(s+1)/n).toLngLat().lat]),u_exaggeration:r.paint.get("hillshade-exaggeration"),u_altitudes:h.altitudeRadians,u_azimuths:h.directionRadians,u_accent:l,u_method:o,u_highlights:h.highlightColor,u_shadows:h.shadowColor}},ir=(e,i)=>{let r=i.stride,a=t.L();return t.bY(a,0,t.$,-t.$,0,0,1),t.M(a,a,[0,-t.$,0]),{u_matrix:a,u_image:1,u_dimension:[r,r],u_zoom:e.overscaledZ,u_unpack:i.getUnpackVector()}},ia=(e,t,i=0)=>({u_image:0,u_unpack:t.getUnpackVector(),u_dimension:[t.stride,t.stride],u_elevation_stops:1,u_color_stops:4,u_color_ramp_size:i,u_opacity:e.paint.get("color-relief-opacity")}),is=(e,i,r,a)=>{let n=e.transform;return{u_translation:ic(e,i,r),u_ratio:a/t.aC(i,1,n.zoom),u_device_pixel_ratio:e.pixelRatio,u_units_to_pixels:[1/n.pixelsToGLUnits[0],1/n.pixelsToGLUnits[1]]}},io=(e,i,r,a,n)=>t.e(is(e,i,r,a),{u_image:0,u_image_height:n}),il=(e,i,r,a,n)=>{let s=e.transform,o=iu(i,s);return{u_translation:ic(e,i,r),u_texsize:i.imageAtlasTexture.size,u_ratio:a/t.aC(i,1,s.zoom),u_device_pixel_ratio:e.pixelRatio,u_image:0,u_scale:[o,n.fromScale,n.toScale],u_fade:n.t,u_units_to_pixels:[1/s.pixelsToGLUnits[0],1/s.pixelsToGLUnits[1]]}},ih=(e,i,r,a,n,s)=>{let o=e.lineAtlas,l=iu(i,e.transform),h="round"===r.layout.get("line-cap"),u=o.getDash(n.from,h),c=o.getDash(n.to,h),d=u.width*s.fromScale,p=c.width*s.toScale;return t.e(is(e,i,r,a),{u_patternscale_a:[l/d,-u.height/2],u_patternscale_b:[l/p,-c.height/2],u_sdfgamma:o.width/(256*Math.min(d,p)*e.pixelRatio)/2,u_image:0,u_tex_y_a:u.y,u_tex_y_b:c.y,u_mix:s.t})};function iu(e,i){return 1/t.aC(e,1,i.tileZoom)}function ic(e,i,r){return t.aD(e.transform,i,r.paint.get("line-translate"),r.paint.get("line-translate-anchor"))}let id=(e,t,i,r,a)=>{var n,s,o;let l,h;return{u_tl_parent:e,u_scale_parent:t,u_buffer_scale:1,u_fade_t:i.mix,u_opacity:i.opacity*r.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:r.paint.get("raster-brightness-min"),u_brightness_high:r.paint.get("raster-brightness-max"),u_saturation_factor:(s=r.paint.get("raster-saturation"))>0?1-1/(1.001-s):-s,u_contrast_factor:(n=r.paint.get("raster-contrast"))>0?1/(1-n):1+n,u_spin_weights:(l=Math.sin(o=r.paint.get("raster-hue-rotate")*(Math.PI/180)
51),[(2*(h=Math.cos(o))+1)/3,(-Math.sqrt(3)*l-h+1)/3,(Math.sqrt(3)*l-h+1)/3]),u_coords_top:[a[0].x,a[0].y,a[1].x,a[1].y],u_coords_bottom:[a[3].x,a[3].y,a[2].x,a[2].y]}},ip=(e,t,i,r,a,n,s,o,l,h,u,c,d)=>{let p=s.transform;return{u_is_size_zoom_constant:+("constant"===e||"source"===e),u_is_size_feature_constant:+("constant"===e||"camera"===e),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:p.cameraToCenterDistance,u_pitch:p.pitch/360*2*Math.PI,u_rotate_symbol:+i,u_aspect_ratio:p.width/p.height,u_fade_change:s.options.fadeDuration?s.symbolFadeChange:1,u_label_plane_matrix:o,u_coord_matrix:l,u_is_text:+u,u_pitch_with_map:+r,u_is_along_line:a,u_is_variable_anchor:n,u_texsize:c,u_texture:0,u_translation:h,u_pitched_scale:d}},im=(e,i,r,a,n,s,o,l,h,u,c,d,p,f)=>{let m=o.transform;return t.e(ip(e,i,r,a,n,s,o,l,h,u,c,d,f),{u_gamma_scale:a?Math.cos(m.pitch*Math.PI/180)*m.cameraToCenterDistance:1,u_device_pixel_ratio:o.pixelRatio,u_is_halo:1})},i_=(e,i,r,a,n,s,o,l,h,u,c,d,p)=>t.e(im(e,i,r,a,n,s,o,l,h,u,!0,c,0,p),{u_texsize_icon:d,u_texture_icon:1}),ig=(e,t)=>({u_opacity:e,u_color:t}),iy=(e,i,r,a,n)=>t.e(function(e,i,r,a){let n=r.imageManager.getPattern(e.from.toString()),s=r.imageManager.getPattern(e.to.toString()),{width:o,height:l}=r.imageManager.getPixelSize(),h=Math.pow(2,a.tileID.overscaledZ),u=a.tileSize*Math.pow(2,r.transform.tileZoom)/h,c=u*(a.tileID.canonical.x+a.tileID.wrap*h),d=u*a.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:n.tl,u_pattern_br_a:n.br,u_pattern_tl_b:s.tl,u_pattern_br_b:s.br,u_texsize:[o,l],u_mix:i.t,u_pattern_size_a:n.displaySize,u_pattern_size_b:s.displaySize,u_scale_a:i.fromScale,u_scale_b:i.toScale,u_tile_units_to_pixels:1/t.aC(a,1,r.transform.tileZoom),u_pixel_coord_upper:[c>>16,d>>16],u_pixel_coord_lower:[65535&c,65535&d]}}(r,n,i,a),{u_opacity:e}),ix=(e,t)=>{},iv={fillExtrusion:(e,i)=>({u_lightpos:new t.bT(e,i.u_lightpos),u_lightpos_globe:new t.bT(e,i.u_lightpos_globe),u_lightintensity:new t.bg(e,i.u_lightintensity),u_lightcolor:new t.bT(e,i.u_lightcolor),u_vertical_gradient:new t.bg(e,i.u_vertical_gradient),u_opacity:new t.bg(e,i.u_opacity),u_fill_translate:new t.bU(e,i.u_fill_translate)}),fillExtrusionPattern:(e,i)=>({u_lightpos:new t.bT(e,i.u_lightpos),u_lightpos_globe:new t.bT(e,i.u_lightpos_globe),u_lightintensity:new t.bg(e,i.u_lightintensity),u_lightcolor:new t.bT(e,i.u_lightcolor),u_vertical_gradient:new t.bg(e,i.u_vertical_gradient),u_height_factor:new t.bg(e,i.u_height_factor),u_opacity:new t.bg(e,i.u_opacity),u_fill_translate:new t.bU(e,i.u_fill_translate),u_image:new t.bP(e,i.u_image),u_texsize:new t.bU(e,i.u_texsize),u_pixel_coord_upper:new t.bU(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.bU(e,i.u_pixel_coord_lower),u_scale:new t.bT(e,i.u_scale),u_fade:new t.bg(e,i.u_fade)}),fill:(e,i)=>({u_fill_translate:new t.bU(e,i.u_fill_translate)}),fillPattern:(e,i)=>({u_image:new t.bP(e,i.u_image),u_texsize:new t.bU(e,i.u_texsize),u_pixel_coord_upper:new t.bU(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.bU(e,i.u_pixel_coord_lower),u_scale:new t.bT(e,i.u_scale),u_fade:new t.bg(e,i.u_fade),u_fill_translate:new t.bU(e,i.u_fill_translate)}),fillOutline:(e,i)=>({u_world:new t.bU(e,i.u_world),u_fill_translate:new t.bU(e,i.u_fill_translate)}),fillOutlinePattern:(e,i)=>({u_world:new t.bU(e,i.u_world),u_image:new t.bP(e,i.u_image),u_texsize:new t.bU(e,i.u_texsize),u_pixel_coord_upper:new t.bU(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.bU(e,i.u_pixel_coord_lower),u_scale:new t.bT(e,i.u_scale),u_fade:new t.bg(e,i.u_fade),u_fill_translate:new t.bU(e,i.u_fill_translate)}),circle:(e,i)=>({u_camera_to_center_distance:new t.bg(e,i.u_camera_to_center_distance),u_scale_with_map:new t.bP(e,i.u_scale_with_map),u_pitch_with_map:new t.bP(e,i.u_pitch_with_map),u_extrude_scale:new t.bU(e,i.u_extrude_scale),u_device_pixel_ratio:new t.bg(e,i.u_device_pixel_ratio),u_globe_extrude_scale:new t.bg(e,i.u_globe_extrude_scale),u_translate:new t.bU(e,i.u_translate)}),collisionBox:(e,i)=>({u_pixel_extrude_scale:new t.bU(e,i.u_pixel_extrude_scale)}),collisionCircle:(e,i)=>({u_viewport_size:new t.bU(e,i.u_viewport_size)}),debug:(e,i)=>({u_color:new t.bQ(e,i.u_color),u_overlay:new t.bP(e,i.u_overlay),u_overlay_scale:new t.bg(e,i.u_overlay_scale)}),depth:ix,clippingMask:ix,heatmap:(e,i)=>({u_extrude_scale:new t.bg(e,i.u_extrude_scale),u_intensity:new t.bg(e,i.u_intensity),u_globe_extrude_scale:new t.bg(e,i.u_globe_extrude_scale)}),heatmapTexture:(e,i)=>({u_matrix:new t.bR(e,i.u_matrix),u_world:new t.bU(e,i.u_world),u_image:new t.bP(e,i.u_image),u_color_ramp:new t.bP(e,i.u_color_ramp),u_opacity:new t.bg(e,i.u_opacity)}),hillshade:(e,i)=>({u_image:new t.bP(e,i.u_image),u_latrange:new t.bU(e,i.u_latrange),u_exaggeration:new t.bg(e,i.u_exaggeration),u_altitudes:new t.b_(e,i.u_altitudes),u_azimuths:new t.b_(e,i.u_azimuths),u_accent:new t.bQ(e,i.u_accent),u_method:new t.bP(e,i.u_method),u_shadows:new t.bZ(e,i.u_shadows),u_highlights:new t.bZ(e,i.u_highlights)}),hillshadePrepare:(e,i)=>({u_matrix:new t.bR(e,i.u_matrix),u_image:new t.bP(e,i.u_image),u_dimension:new t.bU(e,i.u_dimension),u_zoom:new t.bg(e,i.u_zoom),u_unpack:new t.bS(e,i.u_unpack)}),colorRelief:(e,i)=>({u_image:new t.bP(e,i.u_image),u_unpack:new t.bS(e,i.u_unpack),u_dimension:new t.bU(e,i.u_dimension),u_elevation_stops:new t.bP(e,i.u_elevation_stops),u_color_stops:new t.bP(e,i.u_color_stops),u_color_ramp_size:new t.bP(e,i.u_color_ramp_size),u_opacity:new t.bg(e,i.u_opacity)}),line:(e,i)=>({u_translation:new t.bU(e,i.u_translation),u_ratio:new t.bg(e,i.u_ratio),u_device_pixel_ratio:new t.bg(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.bU(e,i.u_units_to_pixels)}),lineGradient:(e,i)=>({u_translation:new t.bU(e,i.u_translation),u_ratio:new t.bg(e,i.u_ratio),u_device_pixel_ratio:new t.bg(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.bU(e,i.u_units_to_pixels),u_image:new t.bP(e,i.u_image),u_image_height:new t.bg(e,i.u_image_height)}),linePattern:(e,i)=>({u_translation:new t.bU(e,i.u_translation),u_texsize:new t.bU(e,i.u_texsize),u_ratio:new t.bg(e,i.u_ratio),u_device_pixel_ratio:new t.bg(e,i.u_device_pixel_ratio),u_image:new t.bP(e,i.u_image),u_units_to_pixels:new t.bU(e,i.u_units_to_pixels),u_scale:new t.bT(e,i.u_scale),u_fade:new t.bg(e,i.u_fade)}),lineSDF:(e,i)=>({u_translation:new t.bU(e,i.u_translation),u_ratio:new t.bg(e,i.u_ratio),u_device_pixel_ratio:new t.bg(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.bU(e,i.u_units_to_pixels),u_patternscale_a:new t.bU(e,i.u_patternscale_a),u_patternscale_b:new t.bU(e,i.u_patternscale_b),u_sdfgamma:new t.bg(e,i.u_sdfgamma),u_image:new t.bP(e,i.u_image),u_tex_y_a:new t.bg(e,i.u_tex_y_a),u_tex_y_b:new t.bg(e,i.u_tex_y_b),u_mix:new t.bg(e,i.u_mix)}),raster:(e,i)=>({u_tl_parent:new t.bU(e,i.u_tl_parent),u_scale_parent:new t.bg(e,i.u_scale_parent),u_buffer_scale:new t.bg(e,i.u_buffer_scale),u_fade_t:new t.bg(e,i.u_fade_t),u_opacity:new t.bg(e,i.u_opacity),u_image0:new t.bP(e,i.u_image0),u_image1:new t.bP(e,i.u_image1),u_brightness_low:new t.bg(e,i.u_brightness_low),u_brightness_high:new t.bg(e,i.u_brightness_high),u_saturation_factor:new t.bg(e,i.u_saturation_factor),u_contrast_factor:new t.bg(e,i.u_contrast_factor),u_spin_weights:new t.bT(e,i.u_spin_weights),u_coords_top:new t.bS(e,i.u_coords_top),u_coords_bottom:new t.bS(e,i.u_coords_bottom)}),symbolIcon:(e,i)=>({u_is_size_zoom_constant:new t.bP(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.bP(e,i.u_is_size_feature_constant),u_size_t:new t.bg(e,i.u_size_t),u_size:new t.bg(e,i.u_size),u_camera_to_center_distance:new t.bg(e,i.u_camera_to_center_distance),u_pitch:new t.bg(e,i.u_pitch),u_rotate_symbol:new t.bP(e,i.u_rotate_symbol),u_aspect_ratio:new t.bg(e,i.u_aspect_ratio),u_fade_change:new t.bg(e,i.u_fade_change),u_label_plane_matrix:new t.bR(e,i.u_label_plane_matrix
51),u_coord_matrix:new t.bR(e,i.u_coord_matrix),u_is_text:new t.bP(e,i.u_is_text),u_pitch_with_map:new t.bP(e,i.u_pitch_with_map),u_is_along_line:new t.bP(e,i.u_is_along_line),u_is_variable_anchor:new t.bP(e,i.u_is_variable_anchor),u_texsize:new t.bU(e,i.u_texsize),u_texture:new t.bP(e,i.u_texture),u_translation:new t.bU(e,i.u_translation),u_pitched_scale:new t.bg(e,i.u_pitched_scale)}),symbolSDF:(e,i)=>({u_is_size_zoom_constant:new t.bP(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.bP(e,i.u_is_size_feature_constant),u_size_t:new t.bg(e,i.u_size_t),u_size:new t.bg(e,i.u_size),u_camera_to_center_distance:new t.bg(e,i.u_camera_to_center_distance),u_pitch:new t.bg(e,i.u_pitch),u_rotate_symbol:new t.bP(e,i.u_rotate_symbol),u_aspect_ratio:new t.bg(e,i.u_aspect_ratio),u_fade_change:new t.bg(e,i.u_fade_change),u_label_plane_matrix:new t.bR(e,i.u_label_plane_matrix),u_coord_matrix:new t.bR(e,i.u_coord_matrix),u_is_text:new t.bP(e,i.u_is_text),u_pitch_with_map:new t.bP(e,i.u_pitch_with_map),u_is_along_line:new t.bP(e,i.u_is_along_line),u_is_variable_anchor:new t.bP(e,i.u_is_variable_anchor),u_texsize:new t.bU(e,i.u_texsize),u_texture:new t.bP(e,i.u_texture),u_gamma_scale:new t.bg(e,i.u_gamma_scale),u_device_pixel_ratio:new t.bg(e,i.u_device_pixel_ratio),u_is_halo:new t.bP(e,i.u_is_halo),u_translation:new t.bU(e,i.u_translation),u_pitched_scale:new t.bg(e,i.u_pitched_scale)}),symbolTextAndIcon:(e,i)=>({u_is_size_zoom_constant:new t.bP(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.bP(e,i.u_is_size_feature_constant),u_size_t:new t.bg(e,i.u_size_t),u_size:new t.bg(e,i.u_size),u_camera_to_center_distance:new t.bg(e,i.u_camera_to_center_distance),u_pitch:new t.bg(e,i.u_pitch),u_rotate_symbol:new t.bP(e,i.u_rotate_symbol),u_aspect_ratio:new t.bg(e,i.u_aspect_ratio),u_fade_change:new t.bg(e,i.u_fade_change),u_label_plane_matrix:new t.bR(e,i.u_label_plane_matrix),u_coord_matrix:new t.bR(e,i.u_coord_matrix),u_is_text:new t.bP(e,i.u_is_text),u_pitch_with_map:new t.bP(e,i.u_pitch_with_map),u_is_along_line:new t.bP(e,i.u_is_along_line),u_is_variable_anchor:new t.bP(e,i.u_is_variable_anchor),u_texsize:new t.bU(e,i.u_texsize),u_texsize_icon:new t.bU(e,i.u_texsize_icon),u_texture:new t.bP(e,i.u_texture),u_texture_icon:new t.bP(e,i.u_texture_icon),u_gamma_scale:new t.bg(e,i.u_gamma_scale),u_device_pixel_ratio:new t.bg(e,i.u_device_pixel_ratio),u_is_halo:new t.bP(e,i.u_is_halo),u_translation:new t.bU(e,i.u_translation),u_pitched_scale:new t.bg(e,i.u_pitched_scale)}),background:(e,i)=>({u_opacity:new t.bg(e,i.u_opacity),u_color:new t.bQ(e,i.u_color)}),backgroundPattern:(e,i)=>({u_opacity:new t.bg(e,i.u_opacity),u_image:new t.bP(e,i.u_image),u_pattern_tl_a:new t.bU(e,i.u_pattern_tl_a),u_pattern_br_a:new t.bU(e,i.u_pattern_br_a),u_pattern_tl_b:new t.bU(e,i.u_pattern_tl_b),u_pattern_br_b:new t.bU(e,i.u_pattern_br_b),u_texsize:new t.bU(e,i.u_texsize),u_mix:new t.bg(e,i.u_mix),u_pattern_size_a:new t.bU(e,i.u_pattern_size_a),u_pattern_size_b:new t.bU(e,i.u_pattern_size_b),u_scale_a:new t.bg(e,i.u_scale_a),u_scale_b:new t.bg(e,i.u_scale_b),u_pixel_coord_upper:new t.bU(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.bU(e,i.u_pixel_coord_lower),u_tile_units_to_pixels:new t.bg(e,i.u_tile_units_to_pixels)}),terrain:(e,i)=>({u_texture:new t.bP(e,i.u_texture),u_ele_delta:new t.bg(e,i.u_ele_delta),u_fog_matrix:new t.bR(e,i.u_fog_matrix),u_fog_color:new t.bQ(e,i.u_fog_color),u_fog_ground_blend:new t.bg(e,i.u_fog_ground_blend),u_fog_ground_blend_opacity:new t.bg(e,i.u_fog_ground_blend_opacity),u_horizon_color:new t.bQ(e,i.u_horizon_color),u_horizon_fog_blend:new t.bg(e,i.u_horizon_fog_blend),u_is_globe_mode:new t.bg(e,i.u_is_globe_mode)}),terrainDepth:(e,i)=>({u_ele_delta:new t.bg(e,i.u_ele_delta)}),terrainCoords:(e,i)=>({u_texture:new t.bP(e,i.u_texture),u_terrain_coords_id:new t.bg(e,i.u_terrain_coords_id),u_ele_delta:new t.bg(e,i.u_ele_delta)}),projectionErrorMeasurement:(e,i)=>({u_input:new t.bg(e,i.u_input),u_output_expected:new t.bg(e,i.u_output_expected)}),atmosphere:(e,i)=>({u_sun_pos:new t.bT(e,i.u_sun_pos),u_atmosphere_blend:new t.bg(e,i.u_atmosphere_blend),u_globe_position:new t.bT(e,i.u_globe_position),u_globe_radius:new t.bg(e,i.u_globe_radius),u_inv_proj_matrix:new t.bR(e,i.u_inv_proj_matrix)}),sky:(e,i)=>({u_sky_color:new t.bQ(e,i.u_sky_color),u_horizon_color:new t.bQ(e,i.u_horizon_color),u_horizon:new t.bU(e,i.u_horizon),u_horizon_normal:new t.bU(e,i.u_horizon_normal),u_sky_horizon_blend:new t.bg(e,i.u_sky_horizon_blend),u_sky_blend:new t.bg(e,i.u_sky_blend)})};class ib{constructor(e,t,i){this.context=e;const r=e.gl;this.buffer=r.createBuffer(),this.dynamicDraw=!!i,this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),r.bufferData(r.ELEMENT_ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?r.DYNAMIC_DRAW:r.STATIC_DRAW),this.dynamicDraw||delete t.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){let t=this.context.gl;if(!this.dynamicDraw)throw Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),t.bufferSubData(t.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}let iw={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class iT{constructor(e,t,i,r){this.length=t.length,this.attributes=i,this.itemSize=t.bytesPerElement,this.dynamicDraw=r,this.context=e;const a=e.gl;this.buffer=a.createBuffer(),e.bindVertexBuffer.set(this.buffer),a.bufferData(a.ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?a.DYNAMIC_DRAW:a.STATIC_DRAW),this.dynamicDraw||delete t.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){if(e.length!==this.length)throw Error(`Length of new data is ${e.length}, which doesn't match current length of ${this.length}`);let t=this.context.gl;this.bind(),t.bufferSubData(t.ARRAY_BUFFER,0,e.arrayBuffer)}
51enableAttributes(e,t){for(let i=0;i<this.attributes.length;i++){let r=t.attributes[this.attributes[i].name];void 0!==r&&e.enableVertexAttribArray(r)}}setVertexAttribPointers(e,t,i){for(let r=0;r<this.attributes.length;r++){let a=this.attributes[r],n=t.attributes[a.name];void 0!==n&&e.vertexAttribPointer(n,a.components,e[iw[a.type]],!1,this.itemSize,a.offset+this.itemSize*(i||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class iP{constructor(e){this.gl=e.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(e){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class iS extends iP{getDefault(){return t.bf.transparent}set(e){let t=this.current;(e.r!==t.r||e.g!==t.g||e.b!==t.b||e.a!==t.a||this.dirty)&&(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class iM extends iP{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}}class iC extends iP{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}}class iI extends iP{getDefault(){return[!0,!0,!0,!0]}set(e){let t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3]||this.dirty)&&(this.gl.colorMask(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class iA extends iP{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}}class iE extends iP{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}}class iz extends iP{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(e){let t=this.current;(e.func!==t.func||e.ref!==t.ref||e.mask!==t.mask||this.dirty)&&(this.gl.stencilFunc(e.func,e.ref,e.mask),this.current=e,this.dirty=!1)}}class ik extends iP{getDefault(){let e=this.gl;return[e.KEEP,e.KEEP,e.KEEP]}set(e){let t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||this.dirty)&&(this.gl.stencilOp(e[0],e[1],e[2]),this.current=e,this.dirty=!1)}}class iD extends iP{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.STENCIL_TEST):t.disable(t.STENCIL_TEST),this.current=e,this.dirty=!1}}class iR extends iP{getDefault(){return[0,1]}set(e){let t=this.current;(e[0]!==t[0]||e[1]!==t[1]||this.dirty)&&(this.gl.depthRange(e[0],e[1]),this.current=e,this.dirty=!1)}}class iL extends iP{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.DEPTH_TEST):t.disable(t.DEPTH_TEST),this.current=e,this.dirty=!1}}class iF extends iP{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}}class iB extends iP{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.BLEND):t.disable(t.BLEND),this.current=e,this.dirty=!1}}class iO extends iP{getDefault(){let e=this.gl;return[e.ONE,e.ZERO]}set(e){let t=this.current;(e[0]!==t[0]||e[1]!==t[1]||this.dirty)&&(this.gl.blendFunc(e[0],e[1]),this.current=e,this.dirty=!1)}}class ij extends iP{getDefault(){return t.bf.transparent}set(e){let t=this.current;(e.r!==t.r||e.g!==t.g||e.b!==t.b||e.a!==t.a||this.dirty)&&(this.gl.blendColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class iV extends iP{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}}class iU extends iP{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.CULL_FACE):t.disable(t.CULL_FACE),this.current=e,this.dirty=!1}}class iN extends iP{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}}class i$ extends iP{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}}class iZ extends iP{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}}class iG extends iP{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}}class iq extends iP{getDefault(){let e=this.gl;return[0,0,e.drawingBufferWidth,e.drawingBufferHeight]}set(e){let t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3]||this.dirty)&&(this.gl.viewport(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class iW extends iP{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,e),this.current=e,this.dirty=!1}}class iH extends iP{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindRenderbuffer(t.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class iX extends iP{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindTexture(t.TEXTURE_2D,e),this.current=e,this.dirty=!1}}class iY extends iP{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindBuffer(t.ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class iK extends iP{getDefault(){return null}set(e){let t=this.gl;t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class iJ extends iP{getDefault(){return null}set(e){var t;if(e===this.current&&!this.dirty)return;let i=this.gl;tg(i)?i.bindVertexArray(e):null==(t=i.getExtension("OES_vertex_array_object"))||t.bindVertexArrayOES(e),this.current=e,this.dirty=!1}}class iQ extends iP{getDefault(){return 4}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.pixelStorei(t.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=!1}}class i0 extends iP{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=!1}}class i1 extends iP{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=!1}}class i2 extends iP{constructor(e,t){super(e),this.context=e,this.parent=t}getDefault(){return null}}class i3 extends i2{setDirty(){this.dirty=!0}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let t=this.gl;t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}}class i5 extends i2{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let t=this.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class i4 extends i2{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let t=this.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,e),this.current=e,this.dirty=!1}}let i6="Framebuffer is not complete";class i8{constructor(e,t,i,r,a){this.context=e,this.width=t,this.height=i;const n=e.gl,s=this.framebuffer=n.createFramebuffer();
51if(this.colorAttachment=new i3(e,s),r)this.depthAttachment=a?new i4(e,s):new i5(e,s);else if(a)throw Error("Stencil cannot be set without depth");if(n.checkFramebufferStatus(n.FRAMEBUFFER)!==n.FRAMEBUFFER_COMPLETE)throw Error(i6)}destroy(){let e=this.context.gl,t=this.colorAttachment.get();if(t&&e.deleteTexture(t),this.depthAttachment){let t=this.depthAttachment.get();t&&e.deleteRenderbuffer(t)}e.deleteFramebuffer(this.framebuffer)}}class i9{constructor(e){var t,i;if(this.gl=e,this.clearColor=new iS(this),this.clearDepth=new iM(this),this.clearStencil=new iC(this),this.colorMask=new iI(this),this.depthMask=new iA(this),this.stencilMask=new iE(this),this.stencilFunc=new iz(this),this.stencilOp=new ik(this),this.stencilTest=new iD(this),this.depthRange=new iR(this),this.depthTest=new iL(this),this.depthFunc=new iF(this),this.blend=new iB(this),this.blendFunc=new iO(this),this.blendColor=new ij(this),this.blendEquation=new iV(this),this.cullFace=new iU(this),this.cullFaceSide=new iN(this),this.frontFace=new i$(this),this.program=new iZ(this),this.activeTexture=new iG(this),this.viewport=new iq(this),this.bindFramebuffer=new iW(this),this.bindRenderbuffer=new iH(this),this.bindTexture=new iX(this),this.bindVertexBuffer=new iY(this),this.bindElementBuffer=new iK(this),this.bindVertexArray=new iJ(this),this.pixelStoreUnpack=new iQ(this),this.pixelStoreUnpackPremultiplyAlpha=new i0(this),this.pixelStoreUnpackFlipY=new i1(this),this.extTextureFilterAnisotropic=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=e.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE),tg(e)){this.HALF_FLOAT=e.HALF_FLOAT;const r=e.getExtension("EXT_color_buffer_half_float");this.RGBA16F=null!=(t=e.RGBA16F)?t:null==r?void 0:r.RGBA16F_EXT,this.RGB16F=null!=(i=e.RGB16F)?i:null==r?void 0:r.RGB16F_EXT,e.getExtension("EXT_color_buffer_float")}else{e.getExtension("EXT_color_buffer_half_float"),e.getExtension("OES_texture_half_float_linear");const t=e.getExtension("OES_texture_half_float");this.HALF_FLOAT=null==t?void 0:t.HALF_FLOAT_OES}}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(e,t){return new ib(this,e,t)}createVertexBuffer(e,t,i){return new iT(this,e,t,i)}createRenderbuffer(e,t,i){let r=this.gl,a=r.createRenderbuffer();return this.bindRenderbuffer.set(a),r.renderbufferStorage(r.RENDERBUFFER,e,t,i),this.bindRenderbuffer.set(null),a}createFramebuffer(e,t,i,r){return new i8(this,e,t,i,r)}clear({color:e,depth:t,stencil:i}){let r=this.gl,a=0;e&&(a|=r.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),void 0!==t&&(a|=r.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(t),this.depthMask.set(!0)),void 0!==i&&(a|=r.STENCIL_BUFFER_BIT,this.clearStencil.set(i),this.stencilMask.set(255)),r.clear(a)}setCullFace(e){!1===e.enable?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(e.mode),this.frontFace.set(e.frontFace))}setDepthMode(e){e.func!==this.gl.ALWAYS||e.mask?(this.depthTest.set(!0),this.depthFunc.set(e.func),this.depthMask.set(e.mask),this.depthRange.set(e.range)):this.depthTest.set(!1)}setStencilMode(e){e.test.func!==this.gl.ALWAYS||e.mask?(this.stencilTest.set(!0),this.stencilMask.set(e.mask),this.stencilOp.set([e.fail,e.depthFail,e.pass]),this.stencilFunc.set({func:e.test.func,ref:e.ref,mask:e.test.mask})):this.stencilTest.set(!1)}setColorMode(e){t.bH(e.blendFunction,td.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor)),this.colorMask.set(e.mask)}createVertexArray(){var e;return tg(this.gl)?this.gl.createVertexArray():null==(e=this.gl.getExtension("OES_vertex_array_object"))?void 0:e.createVertexArrayOES()}deleteVertexArray(e){var t;return tg(this.gl)?this.gl.deleteVertexArray(e):null==(t=this.gl.getExtension("OES_vertex_array_object"))?void 0:t.deleteVertexArrayOES(e)}unbindVAO(){this.bindVertexArray.set(null)}}function i7(e,i,r,a,n){let s=e.context,l=e.transform,h=s.gl,u=e.useProgram("collisionBox"),c=[],d=0,p=0;for(let t=0;t<a.length;t++){let o=a[t],f=i.getTile(o).getBucket(r);
51if(!f)continue;let m=n?f.textCollisionBox:f.iconCollisionBox,_=f.collisionCircleArray;_.length>0&&(c.push({circleArray:_,circleOffset:p,coord:o}),d+=_.length/4,p=d),m&&u.draw(s,h.LINES,tf.disabled,tm.disabled,e.colorModeForRenderPass(),tp.disabled,t8(e.transform),e.style.map.terrain&&e.style.map.terrain.getTerrainData(o),l.getProjectionData({overscaledTileID:o,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),r.id,m.layoutVertexBuffer,m.indexBuffer,m.segments,null,e.transform.zoom,null,null,m.collisionVertexBuffer)}if(!n||!c.length)return;let f=e.useProgram("collisionCircle"),m=new t.b$;m.resize(4*d),m._trim();let _=0;for(let e of c)for(let t=0;t<e.circleArray.length/4;t++){let i=4*t,r=e.circleArray[i+0],a=e.circleArray[i+1],n=e.circleArray[i+2],s=e.circleArray[i+3];m.emplace(_++,r,a,n,s,0),m.emplace(_++,r,a,n,s,1),m.emplace(_++,r,a,n,s,2),m.emplace(_++,r,a,n,s,3)}(!o||o.length<2*d)&&(o=function(e){let i=2*e,r=new t.c1;r.resize(i),r._trim();for(let e=0;e<i;e++){let t=6*e;r.uint16[t+0]=4*e+0,r.uint16[t+1]=4*e+1,r.uint16[t+2]=4*e+2,r.uint16[t+3]=4*e+2,r.uint16[t+4]=4*e+3,r.uint16[t+5]=4*e+0}return r}(d));let g=s.createIndexBuffer(o,!0),y=s.createVertexBuffer(m,t.c0.members,!0);for(let i of c){let a=t9(e.transform);f.draw(s,h.TRIANGLES,tf.disabled,tm.disabled,e.colorModeForRenderPass(),tp.disabled,a,e.style.map.terrain&&e.style.map.terrain.getTerrainData(i.coord),null,r.id,y,g,t.aM.simpleSegment(0,2*i.circleOffset,i.circleArray.length,i.circleArray.length/2),null,e.transform.zoom,null,null,null)}y.destroy(),g.destroy()}let re=t.ag(new Float32Array(16));function rt(e,i,r,a,n,s,o,l,h,u,c,d,p){let f=e.context,m=f.gl,_=e.transform,g="map"===l,y="map"===h,x="viewport"!==l&&"point"!==r.layout.get("symbol-placement"),v=g&&!y&&!x,b=!r.layout.get("symbol-sort-key").isConstant(),w=!1,T=e.getDepthModeForSublayer(0,tf.ReadOnly),P=r._unevaluatedLayout.hasValue("text-variable-anchor")||r._unevaluatedLayout.hasValue("text-variable-anchor-offset"),S=[],M=_.getCircleRadiusCorrection();for(let l of a){let a=i.getTile(l),h=a.getBucket(r);if(!h)continue;let c=n?h.text:h.icon;if(!c||!c.segments.get().length||!c.hasVisibleVertices)continue;let d=c.programConfigurations.get(r.id),f=n||h.sdfIcons,T=n?h.textSizeData:h.iconSizeData,C=y||0!==_.pitch,I=e.useProgram(h.iconsInText&&n?"symbolTextAndIcon":f?"symbolSDF":"symbolIcon",d),A=t.an(T,_.zoom),E=e.style.map.terrain&&e.style.map.terrain.getTerrainData(l),z,k,D,R,L=[0,0],F=null;if(n)k=a.glyphAtlasTexture,D=m.LINEAR,z=a.glyphAtlasTexture.size,h.iconsInText&&(L=a.imageAtlasTexture.size,F=a.imageAtlasTexture,R=C||e.options.rotating||e.options.zooming||"composite"===T.kind||"camera"===T.kind?m.LINEAR:m.NEAREST);else{let t=1!==r.layout.get("icon-size").constantOr(0)||h.iconsNeedLinear;k=a.imageAtlasTexture,D=f||e.options.rotating||e.options.zooming||t||C?m.LINEAR:m.NEAREST,z=a.imageAtlasTexture.size}let B=t.aC(a,1,e.transform.zoom),O=ew(g,e.transform,B),j=t.L();t.aq(j,O);let V=function(e,i,r,a){if(e){let e=t.L();if(!i){let{vecSouth:t,vecEast:i}=eT(r);e[0]=i[0],e[1]=i[1],e[4]=t[0],e[5]=t[1]}return t.N(e,e,[a,a,1]),e}return r.pixelsToClipSpaceMatrix}(y,g,e.transform,B),U=t.aD(_,a,s,o),N=_.getProjectionData({overscaledTileID:l,applyGlobeMatrix:!p,applyTerrainMatrix:!0}),$=P&&h.hasTextData(),Z="none"!==r.layout.get("icon-text-fit")&&$&&h.hasIconData();if(x){let i=e.style.map.terrain?(t,i)=>e.style.map.terrain.getElevation(l,t,i):null;!function(e,i,r,a,n,s,o,l,h,u,c,d,p){let f=r?e.textSizeData:e.iconSizeData,m=t.an(f,i.transform.zoom),_=[256/i.width*2+1,256/i.height*2+1],g=r?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;g.clear();let y=e.lineVertexArray,x=r?e.text.placedSymbolArray:e.icon.placedSymbolArray,v=i.transform.width/i.transform.height,b=!1;for(let r=0;r<x.length;r++){var w;let T=x.get(r);if(T.hidden||T.writingMode===t.ao.vertical&&!b){eF(T.numGlyphs,g);continue}b=!1;let P=new t.P(T.anchorX,T.anchorY),S={getElevation:p,pitchedLabelPlaneMatrix:a,lineVertexArray:y,pitchWithMap:s,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:i.transform,tileAnchorPoint:P,unwrappedTileID:h,width:u,height:c,translation:d},M=ek(T.anchorX,T.anchorY,S);if(w=M.point,!(w.x>=-_[0]&&w.x<=_[0]&&w.y>=-_[1])||!(w.y<=_[1])){eF(T.numGlyphs,g);continue}let C=.5+i.transform.cameraToCenterDistance/M.signedDistanceFromCamera*.5,I=t.ap(f,m,T),A=s?I*i.transform.getPitchedTextCorrection(T.anchorX,T.anchorY,h)/C:I*C,E=eC({projectionContext:S,pitchedLabelPlaneMatr
51ixInverse:n,symbol:T,fontSize:A,flip:!1,keepUpright:o,glyphOffsetArray:e.glyphOffsetArray,dynamicLayoutVertexArray:g,aspectRatio:v,rotateToLine:l});b=E.useVertical,(E.notEnoughRoom||b||E.needsFlipping&&eC({projectionContext:S,pitchedLabelPlaneMatrixInverse:n,symbol:T,fontSize:A,flip:!0,keepUpright:o,glyphOffsetArray:e.glyphOffsetArray,dynamicLayoutVertexArray:g,aspectRatio:v,rotateToLine:l}).notEnoughRoom)&&eF(T.numGlyphs,g)}r?e.text.dynamicLayoutVertexBuffer.updateData(g):e.icon.dynamicLayoutVertexBuffer.updateData(g)}(h,e,n,O,j,y,u,"map"===r.layout.get("text-rotation-alignment"),l.toUnwrapped(),_.width,_.height,U,i)}let G=n&&P||Z,q=x||G?re:y?O:e.transform.clipSpaceToPixelsMatrix,W=f&&0!==r.paint.get(n?"text-halo-width":"icon-halo-width").constantOr(1),H={program:I,buffers:c,uniformValues:f?h.iconsInText?i_(T.kind,A,v,y,x,G,e,q,V,U,z,L,M):im(T.kind,A,v,y,x,G,e,q,V,U,n,z,0,M):ip(T.kind,A,v,y,x,G,e,q,V,U,n,z,M),projectionData:N,atlasTexture:k,atlasTextureIcon:F,atlasInterpolation:D,atlasInterpolationIcon:R,isSDF:f,hasHalo:W};
51if(b&&h.canOverlap)for(let e of(w=!0,c.segments.get()))S.push({segments:new t.aM([e]),sortKey:e.sortKey,state:H,terrainData:E});else S.push({segments:c.segments,sortKey:0,state:H,terrainData:E})}for(let t of(w&&S.sort((e,t)=>e.sortKey-t.sortKey),S)){let i=t.state;if(f.activeTexture.set(m.TEXTURE0),i.atlasTexture.bind(i.atlasInterpolation,m.CLAMP_TO_EDGE),i.atlasTextureIcon&&(f.activeTexture.set(m.TEXTURE1),i.atlasTextureIcon&&i.atlasTextureIcon.bind(i.atlasInterpolationIcon,m.CLAMP_TO_EDGE)),i.isSDF){let a=i.uniformValues;i.hasHalo&&(a.u_is_halo=1,ri(i.buffers,t.segments,r,e,i.program,T,c,d,a,i.projectionData,t.terrainData)),a.u_is_halo=0}ri(i.buffers,t.segments,r,e,i.program,T,c,d,i.uniformValues,i.projectionData,t.terrainData)}}function ri(e,t,i,r,a,n,s,o,l,h,u){let c=r.context;a.draw(c,c.gl.TRIANGLES,n,s,o,tp.backCCW,l,u,h,i.id,e.layoutVertexBuffer,e.indexBuffer,t,i.paint,r.transform.zoom,e.programConfigurations.get(i.id),e.dynamicLayoutVertexBuffer,e.opacityVertexBuffer)}function rr(e,t,i){var r,a;let n=e.gl,s=n.createTexture();n.bindTexture(n.TEXTURE_2D,s),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.L
51INEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR);let o=null!=(r=e.HALF_FLOAT)?r:n.UNSIGNED_BYTE,l=null!=(a=e.RGBA16F)?a:n.RGBA;n.texImage2D(n.TEXTURE_2D,0,l,t,i,0,n.RGBA,o,null);let h=e.createFramebuffer(t,i,!1,!1);return h.colorAttachment.set(s),h}function ra(e,i){return i.colorRampTexture||(i.colorRampTexture=new t.T(e,i.colorRamp,e.gl.RGBA)),i.colorRampTexture}function rn(e,t,i,r,a){if(!i||!r||!r.imageAtlas)return;let n=r.imageAtlas.patternPositions,s=n[i.to.toString()],o=n[i.from.toString()];if(!s&&o&&(s=o),!o&&s&&(o=s),!s||!o){let e=a.getPaintProperty(t);s=n[e],o=n[e]}s&&o&&e.setConstantPatternPositions(s,o)}function rs(e,i,r,a,n,s,o,l){let h,u,c,d,p,f=e.context.gl,m="fill-pattern",_=r.paint.get(m),g=_&&_.constantOr(1),y=r.getCrossfadeParameters(),x=e.transform,v=r.paint.get("fill-translate"),b=r.paint.get("fill-translate-anchor");o?(u=g&&!r.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",h=f.LINES):(u=g?"fillPattern":"fill",h=f.TRIANGLES);let w=_.constantOr(null);for(let _ of a){let a=i.getTile(_);if(g&&!a.patternsLoaded())continue;let T=a.getBucket(r);if(!T)continue;let P=T.programConfigurations.get(r.id),S=e.useProgram(u,P),M=e.style.map.terrain&&e.style.map.terrain.getTerrainData(_);g&&(e.context.activeTexture.set(f.TEXTURE0),a.imageAtlasTexture.bind(f.LINEAR,f.CLAMP_TO_EDGE),P.updatePaintBuffers(y)),rn(P,m,w,a,r);let C=x.getProjectionData({overscaledTileID:_,applyGlobeMatrix:!l,applyTerrainMatrix:!0}),I=t.aD(x,a,v,b);if(o){d=T.indexBuffer2,p=T.segments2;let t=[f.drawingBufferWidth,f.drawingBufferHeight];c="fillOutlinePattern"===u&&g?t4(e,y,a,t,I):t5(t,I)}else d=T.indexBuffer,p=T.segments,c=g?t3(e,y,a,I):{u_fill_translate:I};let A=e.stencilModeForClipping(_);S.draw(e.context,h,n,A,s,tp.backCCW,c,M,C,r.id,T.layoutVertexBuffer,d,p,r.paint,e.transform.zoom,P)}}function ro(e,i,r,a,n,s,o,l){let h=e.context,u=h.gl,c="fill-extrusion-pattern",d=r.paint.get(c),p=d.constantOr(1),f=r.getCrossfadeParameters(),m=r.paint.get("fill-extrusion-opacity"),_=d.constantOr(null),g=e.transform;for(let d of a){let a=i.getTile(d),y=a.getBucket(r);if(!y)continue;let x=e.style.map.terrain&&e.style.map.terrain.getTerrainData(d),v=y.programConfigurations.get(r.id),b=e.useProgram(p?"fillExtrusionPattern":"fillExtrusion",v);p&&(e.context.activeTexture.set(u.TEXTURE0),a.imageAtlasTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE),v.updatePaintBuffers(f));let w=g.getProjectionData({overscaledTileID:d,applyGlobeMatrix:!l,applyTerrainMatrix:!0});rn(v,c,_,a,r);let T=t.aD(g,a,r.paint.get("fill-extrusion-translate"),r.paint.get("fill-extrusion-translate-anchor")),P=r.paint.get("fill-extrusion-vertical-gradient"),S=p?t2(e,P,m,T,d,f,a):t1(e,P,m,T);b.draw(h,h.gl.TRIANGLES,n,s,o,tp.backCCW,S,x,w,r.id,y.layoutVertexBuffer,y.indexBuffer,y.segments,r.paint,e.transform.zoom,v,e.style.map.terrain&&y.centroidVertexBuffer)}}function rl(e,t,i,r,a,n,s,o,l){var h;let u=e.style.projection,c=e.context,d=e.transform,p=c.gl,f=[`#define NUM_ILLUMINATION_SOURCES ${i.paint.get("hillshade-highlight-color").values.length}`],m=e.useProgram("hillshade",null,!1,f),_=!e.options.moving;for(let f of r){let r=t.getTile(f),g=r.fbo;if(!g)continue;let y=u.getMeshFromTileID(c,f.canonical,o,!0,"raster"),x=null==(h=e.style.map.terrain)?void 0:h.getTerrainData(f);c.activeTexture.set(p.TEXTURE0),p.bindTexture(p.TEXTURE_2D,g.colorAttachment.get());let v=d.getProjectionData({overscaledTileID:f,aligned:_,applyGlobeMatrix:!l,applyTerrainMatrix:!0});m.draw(c,p.TRIANGLES,n,a[f.overscaledZ],s,tp.backCCW,ii(e,r,i),x,v,i.id,y.vertexBuffer,y.indexBuffer,y.segments)}}function rh(e,i,r,a,n,s,o,l,h){var u;let c=e.style.projection,d=e.context,p=e.transform,f=d.gl,m=e.useProgram("colorRelief"),_=!e.options.moving,g=!0,y=0;for(let x of a){let a=i.getTile(x),v=a.dem;if(g){let e=f.getParameter(f.MAX_TEXTURE_SIZE),{elevationTexture:t,colorTexture:i}=r.getColorRampTextures(d,e,v.getUnpackVector());d.activeTexture.set(f.TEXTURE1),t.bind(f.NEAREST,f.CLAMP_TO_EDGE),d.activeTexture.set(f.TEXTURE4),i.bind(f.LINEAR,f.CLAMP_TO_EDGE),g=!1,y=t.size[0]}if(!v||!v.data)continue;let b=v.stride,w=v.getPixels();if(d.activeTexture.set(f.TEXTURE0),d.pixelStoreUnpackPremultiplyAlpha.set(!1),a.demTexture=a.demTexture||e.getTileTexture(b),a.demTexture){let e=a.demTexture;e.update(w,{premultiply:!1}),e.bind(f.LINEAR,f.CLAMP_TO_EDGE)}else a.demTexture=new t.T(d,w,f.RGBA,{premultiply:!1}),a.demTexture.bind(f.LINEAR,f.CLAMP_TO_EDGE);let T=c.getMeshFromTileID(d,x.canonical,l,!0,"raster"),P=null==(u=e.style.map.terrain)?void 0:u.getTerrainData(x),S=p.getProjectionData({overscaledTileID:x,aligned:_,applyGlobeMatrix:!h,applyTerrainMatrix:!0});m.draw(d,f.TRIANGLES,s,n[x.overscaledZ],o,tp.backCCW,ia(r,a.dem,y),P,S,r.id,T.vertexBuffer,T.indexBuffer,T.segments)}}let ru=[new t.P(0,0),new t.P(t.$,0),new t.P(t.$,t.$),new t.P(0,t.$)];function rc(e,i,r,a,n,s,o,l,h=!1,u=!1){let c=a[a.length-1].overscaledZ,p=e.context,f
51=p.gl,m=e.useProgram("raster"),_=e.transform,g=e.style.projection,y=e.colorModeForRenderPass(),x=!e.options.moving;for(let v of a){let a,b,w=e.getDepthModeForSublayer(v.overscaledZ-c,1===r.paint.get("raster-opacity")?tf.ReadWrite:tf.ReadOnly,f.LESS),T=i.getTile(v);T.registerFadeDuration(r.paint.get("raster-fade-duration"));let P=i.findLoadedParent(v,0),S=i.findLoadedSibling(v),M=function(e,i,r,a,n,s){let o=a.paint.get("raster-fade-duration");if(!s&&o>0){let a=d.now(),s=(a-e.timeAdded)/o,l=i?(a-i.timeAdded)/o:-1,h=r.getSource(),u=ep(n,{tileSize:h.tileSize,roundZoom:h.roundZoom}),c=!i||Math.abs(i.tileID.overscaledZ-u)>Math.abs(e.tileID.overscaledZ-u),p=c&&e.refreshedUponExpiration?1:t.ah(c?s:1-l,0,1);return e.refreshedUponExpiration&&s>=1&&(e.refreshedUponExpiration=!1),i?{opacity:1,mix:1-p}:{opacity:p,mix:0}}return{opacity:1,mix:0}}(T,P||S||null,i,r,e.transform,e.style.map.terrain),C="nearest"===r.paint.get("raster-resampling")?f.NEAREST:f.LINEAR;p.activeTexture.set(f.TEXTURE0),T.texture.bind(C,f.CLAMP_TO_EDGE,f.LINEAR_MIPMAP_NEAREST),p.activeTexture.set(f.TEXTURE1),P?(P.texture.bind(C,f.CLAMP_TO_EDGE,f.LINEAR_MIPMAP_NEAREST),a=Math.pow(2,P.tileID.overscaledZ-T.tileID.overscaledZ),b=[T.tileID.canonical.x*a%1,T.tileID.canonical.y*a%1]):T.texture.bind(C,f.CLAMP_TO_EDGE,f.LINEAR_MIPMAP_NEAREST),T.texture.useMipmap&&p.extTextureFilterAnisotropic&&e.transform.pitch>20&&f.texParameterf(f.TEXTURE_2D,p.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,p.extTextureFilterAnisotropicMax);let I=e.style.map.terrain&&e.style.map.terrain.getTerrainData(v),A=_.getProjectionData({overscaledTileID:v,aligned:x,applyGlobeMatrix:!u,applyTerrainMatrix:!0}),E=id(b||[0,0],a||1,M,r,l),z=g.getMeshFromTileID(p,v.canonical,s,o,"raster");m.draw(p,f.TRIANGLES,w,n?n[v.overscaledZ]:tm.disabled,y,h?tp.frontCCW:tp.backCCW,E,I,A,r.id,z.vertexBuffer,z.indexBuffer,z.segments)}}let rd=new t.bf(1,0,0,1),rp=new t.bf(0,1,0,1),rf=new t.bf(0,0,1,1),rm=new t.bf(1,0,1,1),r_=new t.bf(0,1,1,1);function rg(e,t,i,r){rx(e,0,t+i/2,e.transform.width,i,r)}function ry(e,t,i,r){rx(e,t-i/2,0,i,e.transform.height,r)}function rx(e,t,i,r,a,n){let s=e.context,o=s.gl;o.enable(o.SCISSOR_TEST),o.scissor(t*e.pixelRatio,i*e.pixelRatio,r*e.pixelRatio,a*e.pixelRatio),s.clear({color:n}),o.disable(o.SCISSOR_TEST)}function rv(e,t,i,r){let{isRenderingGlobe:a}=r,n=e.context,s=n.gl,o=e.transform,l=e.colorModeForRenderPass(),h=e.getDepthModeFor3D(),u=e.useProgram("terrain");for(let r of(n.bindFramebuffer.set(null),n.viewport.set([0,0,e.width,e.height]),i)){let i=t.getTerrainMesh(r.tileID),c=e.renderToTexture.getTexture(r),d=t.getTerrainData(r.tileID);n.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,c.texture);let p=tY(t.getMeshFrameDelta(o.zoom),o.calculateFogMatrix(r.tileID.toUnwrapped()),e.style.sky,o.pitch,a),f=o.getProjectionData({overscaledTileID:r.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});u.draw(n,s.TRIANGLES,h,tm.disabled,l,tp.backCCW,p,d,f,"terrain",i.vertexBuffer,i.indexBuffer,i.segments)}}
51function rb(e,i){if(!i.mesh){let r=new t.aL;r.emplaceBack(-1,-1),r.emplaceBack(1,-1),r.emplaceBack(1,1),r.emplaceBack(-1,1);let a=new t.aN;a.emplaceBack(0,1,2),a.emplaceBack(0,2,3),i.mesh=new e4(e.createVertexBuffer(r,e6.members),e.createIndexBuffer(a),t.aM.simpleSegment(0,0,r.length,a.length))}return i.mesh}class rw{constructor(e,i){this.context=new i9(e),this.transform=i,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:t.ag(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=e_.maxUnderzooming+e_.maxOverzooming+1,this.depthEpsilon=1/65536,this.crossTileSymbolIndex=new e1}resize(e,t,i){if(this.width=Math.floor(e*i),this.height=Math.floor(t*i),this.pixelRatio=i,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let e of this.style._order)this.style._layers[e].resize()}setup(){let e=this.context,i=new t.aL;i.emplaceBack(0,0),i.emplaceBack(t.$,0),i.emplaceBack(0,t.$),i.emplaceBack(t.$,t.$),this.tileExtentBuffer=e.createVertexBuffer(i,e6.members),this.tileExtentSegments=t.aM.simpleSegment(0,0,4,2);let r=new t.aL;r.emplaceBack(0,0),r.emplaceBack(t.$,0),r.emplaceBack(0,t.$),r.emplaceBack(t.$,t.$),this.debugBuffer=e.createVertexBuffer(r,e6.members),this.debugSegments=t.aM.simpleSegment(0,0,4,5);let a=new t.c6;a.emplaceBack(0,0,0,0),a.emplaceBack(t.$,0,t.$,0),a.emplaceBack(0,t.$,0,t.$),a.emplaceBack(t.$,t.$,t.$,t.$),this.rasterBoundsBuffer=e.createVertexBuffer(a,tH.members),this.rasterBoundsSegments=t.aM.simpleSegment(0,0,4,2);let n=new t.aL;n.emplaceBack(0,0),n.emplaceBack(t.$,0),n.emplaceBack(0,t.$),n.emplaceBack(t.$,t.$),this.rasterBoundsBufferPosOnly=e.createVertexBuffer(n,e6.members),this.rasterBoundsSegmentsPosOnly=t.aM.simpleSegment(0,0,4,5);let s=new t.aL;s.emplaceBack(0,0),s.emplaceBack(1,0),s.emplaceBack(0,1),s.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(s,e6.members),this.viewportSegments=t.aM.simpleSegment(0,0,4,2);let o=new t.c7;o.emplaceBack(0),o.emplaceBack(1),o.emplaceBack(3),o.emplaceBack(2),o.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(o);let l=new t.aN;l.emplaceBack(1,0,2),l.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(l);let h=this.context.gl;this.stencilClearMode=new tm({func:h.ALWAYS,mask:0},0,255,h.ZERO,h.ZERO,h.ZERO),this.tileExtentMesh=new e4(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){let e=this.context,i=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let r=t.L();t.bY(r,0,this.width,this.height,0,0,1),t.N(r,r,[i.drawingBufferWidth,i.drawingBufferHeight,0]),this.useProgram("clippingMask",null,!0).draw(e,i.TRIANGLES,tf.disabled,this.stencilClearMode,td.disabled,tp.disabled,null,null,{mainMatrix:r,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:r},"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(e,t,i){if(this.currentStencilSource===e.source||!e.isTileClipped()||!t||!t.length)return;this.currentStencilSource=e.source,this.nextStencilID+t.length>256&&this.clearStencil();let r=this.context;r.setColorMode(td.disabled),r.setDepthMode(tf.disabled);let a={};for(let e of t)a[e.key]=this.nextStencilID++;this._renderTileMasks(a,t,i,!0),this._renderTileMasks(a,t,i,!1),this._tileClippingMaskIDs=a}_renderTileMasks(e,t,i,r){let a=this.context,n=a.gl,s=this.style.projection,o=this.transform,l=this.useProgram("clippingMask");for(let h of t){let t=e[h.key],u=this.style.map.terrain&&this.style.map.terrain.getTerrainData(h),c=s.getMeshFromTileID(this.context,h.canonical,r,!0,"stencil"),d=o.getProjectionData({overscaledTileID:h,applyGlobeMatrix:!i,applyTerrainMatrix:!0});l.draw(a,n.TRIANGLES,tf.disabled,new tm({func:n.ALWAYS,mask:0},t,255,n.KEEP,n.KEEP,n.REPLACE),td.disabled,i?tp.disabled:tp.backCCW,null,u,d,"$clipping",c.vertexBuffer,c.indexBuffer,c.segments)}}_renderTilesDepthBuffer(){let e=this.context,t=e.gl,i=this.style.projection,r=this.transform,a=this.useProgram("depth"),n=this.getDepthModeFor3D();for(let s of ef(r,{tileSize:r.tileSize})){let o=this.style.map.terrain&&this.style.map.terrain.getTerrainData(s),l=i.getMeshFromTileID(this.context,s.canonical,!0,!0,"raster"),h=r.getProjectionData({overscaledTileID:s,applyGlobeMatrix:!0,applyTerrainMatrix:!0});a.draw(e,t.TRIANGLES,n,tm.disabled,td.disabled,tp.backCCW,null,o,h,"$clipping",l.vertexBuffer,l.indexBuffer,l.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let e=this.nextStencilID++,t=this.context.gl;return new tm({func:t.NOTEQUAL,mask:255},e,255,t.KEEP,t.KEEP,t.REPLACE)}stencilModeForClipping(e){let t=this.context.gl;return new tm({func:t.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,t.KEEP,t.KEEP,t.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(e){let t=this.context.gl,i=e.sort((e,t)=>
51t.overscaledZ-e.overscaledZ),r=i[i.length-1].overscaledZ,a=i[0].overscaledZ-r+1;if(a>1){this.currentStencilSource=void 0,this.nextStencilID+a>256&&this.clearStencil();let e={};for(let i=0;i<a;i++)e[i+r]=new tm({func:t.GEQUAL,mask:255},i+this.nextStencilID,255,t.KEEP,t.KEEP,t.REPLACE);return this.nextStencilID+=a,[e,i]}return[{[r]:tm.disabled},i]}stencilConfigForOverlapTwoPass(e){let t=this.context.gl,i=e.sort((e,t)=>t.overscaledZ-e.overscaledZ),r=i[i.length-1].overscaledZ,a=i[0].overscaledZ-r+1;if(this.clearStencil(),a>1){let e={},n={};for(let i=0;i<a;i++)e[i+r]=new tm({func:t.GREATER,mask:255},a+1+i,255,t.KEEP,t.KEEP,t.REPLACE),n[i+r]=new tm({func:t.GREATER,mask:255},1+i,255,t.KEEP,t.KEEP,t.REPLACE);return this.nextStencilID=2*a+1,[e,n,i]}return this.nextStencilID=3,[{[r]:new tm({func:t.GREATER,mask:255},2,255,t.KEEP,t.KEEP,t.REPLACE)},{[r]:new tm({func:t.GREATER,mask:255},1,255,t.KEEP,t.KEEP,t.REPLACE)},i]}colorModeForRenderPass(){let e=this.context.gl;if(this._showOverdrawInspector){let i=1/8;return new td([e.CONSTANT_COLOR,e.ONE],new t.bf(i,i,i,0),[!0,!0,!0,!0])}return"opaque"===this.renderPass?td.unblended:td.alphaBlended}getDepthModeForSublayer(e,t,i){if(!this.opaquePassEnabledForLayer())return tf.disabled;let r=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new tf(i||this.context.gl.LEQUAL,t,[r,r])}getDepthModeFor3D(){return new tf(this.context.gl.LEQUAL,tf.ReadWrite,this.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(e,i){var r,a,n,s,o,l,h,u,c;let p,f,m,_,g,y,x,v,b,w,T,P,S,M;this.style=e,this.options=i,this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(d.now()),this.imageManager.beginFrame();let C=this.style._order,I=this.style.sourceCaches,A={},E={},z={},k={isRenderingToTexture:!1,isRenderingGlobe:(null==(r=e.projection)?void 0:r.transitionState)>0};for(let e in I){let t=I[e];t.used&&t.prepare(this.context),A[e]=t.getVisibleCoordinates(!1),E[e]=A[e].slice().reverse(),z[e]=t.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let e=0;e<C.length;e++)if(this.style._layers[C[e]].is3D()){this.opaquePassCutoff=e;break}for(let e of(this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen",C)){let t=this.style._layers[e];if(!t.hasOffscreenPass()||t.isHidden(this.transform.zoom))continue;let i=E[t.source];("custom"===t.type||i.length)&&this.renderLayer(this,I[t.source],t,i,k)}if(null==(a=this.style.projection)||a.updateGPUdependent({context:this.context,useProgram:e=>this.useProgram(e)}),this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:i.showOverdrawInspector?t.bf.black:t.bf.transparent,depth:1}),this.clearStencil(),this.style.sky&&(n=this.style.sky,y=(g=this.context).gl,s=this.style.map.transform,o=this.pixelRatio,p=Math.cos(s.rollInRadians),f=Math.sin(s.rollInRadians),m=eo(s),_=s.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition,x={u_sky_color:n.properties.get("sky-color"),u_horizon_color:n.properties.get("horizon-color"),u_horizon:[(s.width/2-m*f)*o,(s.height/2+m*p)*o],u_horizon_normal:[-f,p],u_sky_horizon_blend:n.properties.get("sky-horizon-blend")*s.height/2*o,u_sky_blend:_},v=new tf(y.LEQUAL,tf.ReadWrite,[0,1]),b=tm.disabled,w=this.colorModeForRenderPass(),T=this.useProgram("sky"),P=rb(g,n),T.draw(g,y.TRIANGLES,v,b,w,tp.disabled,x,null,void 0,"sky",P.vertexBuffer,P.indexBuffer,P.segments)),this._showOverdrawInspector=i.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=C.length-1;this.currentLayer>=0;this.currentLayer--){let e=this.style._layers[C[this.currentLayer]],t=I[e.source],i=A[e.source];this._renderTileClippingMasks(e,i,!1),this.renderLayer(this,t,e,i,k)}this.renderPass="translucent";let D=!1;for(this.currentLayer=0;this.currentLayer<C.length;this.currentLayer++){let e=this.style._layers[C[this.currentLayer]],t=I[e.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(e,k))continue;this.opaquePassEnabledForLayer()||D||(D=!0,k.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());let i=("symbol"===e.type?z:E)[e.source];this._renderTileClippingMasks(e,A[e.source],!!this.renderToTexture),this.renderLayer(this,t,e,i,k)}if(k.isRenderingGlobe&&function(e,i,r){var a;let n,s,o,l=e.context,h=l.gl,u=e.useProgram("atmosphere"),c=new tf(h.LEQUAL,tf.ReadOnly,[0,1]),d=e.transform,p=(a=e.transform,s=[-(n=r.properties.get("position")).x,-n.y,-n.z],o=t.ag(new Float64Array(16)),"map"===r.properties.get("anchor")&&(t.b6(o,o,a.rollInRadians),t.b7(o,o,-a.pitchInRadians),t.b6(o,o,a.bearingInRadians),t.b7(o,o,a.center.lat*Math.PI/180),t.bz(o,o,-a.center.lng*Math.PI/180)
51),t.c5(s,s,o),s),f=d.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),m=i.properties.get("atmosphere-blend")*f.projectionTransition;if(0===m)return;let _=tI(d.worldSize,d.center.lat),g=d.inverseProjectionMatrix,y=new Float64Array(4);y[3]=1,t.aw(y,y,d.modelViewProjectionMatrix),y[0]/=y[3],y[1]/=y[3],y[2]/=y[3],y[3]=1,t.aw(y,y,g),y[0]/=y[3],y[1]/=y[3],y[2]/=y[3],y[3]=1;let x={u_sun_pos:p,u_atmosphere_blend:m,u_globe_position:[y[0],y[1],y[2]],u_globe_radius:_,u_inv_proj_matrix:g},v=rb(l,i);u.draw(l,h.TRIANGLES,c,tm.disabled,td.alphaBlended,tp.disabled,x,null,null,"atmosphere",v.vertexBuffer,v.indexBuffer,v.segments)}(this,this.style.sky,this.style.light),this.options.showTileBoundaries){let e,i,r,a,n,s=(l=this.style,h=this.transform.zoom,e=null,r=(i=Object.values(l._layers).flatMap(e=>e.source&&!e.isHidden(h)?[l.sourceCaches[e.source]]:[])).filter(e=>"vector"===e.getSource().type),a=i.filter(e=>"vector"!==e.getSource().type),n=t=>{(!e||e.getSource().maxzoom<t.getSource().maxzoom)&&(e=t)},r.forEach(e=>n(e)),e||a.forEach(e=>n(e)),e);s&&function(e,i,r){for(let a=0;a<r.length;a++)!function(e,i,r){var a;let n,s,o,l=e.context,h=l.gl,u=e.useProgram("debug"),c=tf.disabled,d=tm.disabled,p=e.colorModeForRenderPass(),f="$debug",m=e.style.map.terrain&&e.style.map.terrain.getTerrainData(r);l.activeTexture.set(h.TEXTURE0);let _=i.getTileByID(r.key).latestRawTileData,g=Math.floor((_&&_.byteLength||0)/1024),y=512/Math.min(i.getTile(r).tileSize,512)*(r.overscaledZ/e.transform.zoom)*.5,x=r.canonical.toString();r.overscaledZ!==r.canonical.z&&(x+=` => ${r.overscaledZ}`),a=`${x} ${g}kB`,e.initDebugOverlayCanvas(),n=e.debugOverlayCanvas,s=e.context.gl,(o=e.debugOverlayCanvas.getContext("2d")).clearRect(0,0,n.width,n.height),o.shadowColor="white",o.shadowBlur=2,o.lineWidth=1.5,o.strokeStyle="white",o.textBaseline="top",o.font="bold 36px Open Sans, sans-serif",o.fillText(a,5,5),o.strokeText(a,5,5),e.debugOverlayTexture.update(n),e.debugOverlayTexture.bind(s.LINEAR,s.CLAMP_TO_EDGE);let v=e.transform.getProjectionData({overscaledTileID:r,applyGlobeMatrix:!0,applyTerrainMatrix:!0});u.draw(l,h.TRIANGLES,c,d,td.alphaBlended,tp.disabled,t7(t.bf.transparent,y),null,v,f,e.debugBuffer,e.quadTriangleIndexBuffer,e.debugSegments),u.draw(l,h.LINE_STRIP,c,d,p,tp.disabled,t7(t.bf.red),m,v,f,e.debugBuffer,e.tileBorderIndexBuffer,e.debugSegments)}(e,i,r[a])}(this,s,s.getVisibleCoordinates())}this.options.showPadding&&(S=this.transform.padding,rg(this,this.transform.height-(S.top||0),3,rd),rg(this,S.bottom||0,3,rp),ry(this,S.left||0,3,rf),ry(this,this.transform.width-(S.right||0),3,rm),M=this.transform.centerPoint,u=M.x,rx(this,u-1,(c=this.transform.height-M.y)-10,2,20,r_),rx(this,u-10,c-1,20,2,r_)),this.context.setDefault()}maybeDrawDepthAndCoords(e){if(!this.style||!this.style.map||!this.style.map.terrain)return;let i=this.terrainFacilitator.matrix,r=this.transform.modelViewProjectionMatrix,a=this.terrainFacilitator.dirty;a||(a=e?!t.c8(i,r):!t.c9(i,r)),a||(a=this.style.map.terrain.sourceCache.anyTilesAfterTime(this.terrainFacilitator.renderTime)),a&&(t.ca(i,r),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(e,i){let r=e.context,a=r.gl,n=e.transform,s=td.unblended,o=new tf(a.LEQUAL,tf.ReadWrite,[0,1]),l=i.sourceCache.getRenderableTiles(),h=e.useProgram("terrainDepth");for(let u of(r.bindFramebuffer.set(i.getFramebuffer("depth").framebuffer),r.viewport.set([0,0,e.width/devicePixelRatio,e.height/devicePixelRatio]),r.clear({color:t.bf.transparent,depth:1}),l)){let e=i.getTerrainMesh(u.tileID),t=i.getTerrainData(u.tileID),l=n.getProjectionData({overscaledTileID:u.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),c={u_ele_delta:i.getMeshFrameDelta(n.zoom)};h.draw(r,a.TRIANGLES,o,tm.disabled,s,tp.backCCW,c,t,l,"terrain",e.vertexBuffer,e.indexBuffer,e.segments)}r.bindFramebuffer.set(null),r.viewport.set([0,0,e.width,e.height])}(this,this.style.map.terrain),function(e,i){let r=e.context,a=r.gl,n=e.transform,s=td.unblended,o=new tf(a.LEQUAL,tf.ReadWrite,[0,1]),l=i.getCoordsTexture(),h=i.sourceCache.getRenderableTiles(),u=e.useProgram("terrainCoords");for(let c of(r.bindFramebuffer.set(i.getFramebuffer("coords").framebuffer),r.viewport.set([0,0,e.width/devicePixelRatio,e.height/devicePixelRatio]),r.clear({color:t.bf.transparent,depth:1}),i.coordsIndex=[],h)){let e=i.getTerrainMesh(c.tileID),t=i.getTerrainData(c.tileID);r.activeTexture.set(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,l.texture);let h={u_terrain_coords_id:(255-i.coordsIndex.length)/255,u_texture:0,u_ele_delta:i.getMeshFrameDelta(n.zoom)},d=n.getProjectionData({overscaledTileID:c.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});u.draw(r,a.TRIANGLES,o,tm.disabled,s,tp.backCCW,h,t,d,"terrain",e.vertexBuffer,e.indexBuffer,e.segments),i.coordsIndex.push(c.tileID.key)}r.bindFramebuffer.set(null),r.viewport.set([0,0,e.width,e.height])}(this,this.style.map.terrain))}renderLayer(e,i,r,a,n){r.isHidden(this.transform.zoom)||("background"===r.type||"custom"===r.type||(a||[]).length)&&(this.id=r.id,t.cb(r)?function(e,i,r,a,n,s){if("translucent"!==e.renderPass)return;let{isRenderingToTexture:o}=s,l=tm.disabled,h=e.colorModeForRenderPass();(r._unevaluatedLayout.hasValue("text-variable-anchor")||r._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(e,i,r,a,n,s,o,l,h){let u=i.transform,c=i.style.map.terrain,d="map"===n,p="map"===s;for(let n of e){let e=a.getTile(n),s=e.getBucket(r);
51if(!s||!s.text||!s.text.segments.get().length)continue;let f=t.an(s.textSizeData,u.zoom),m=t.aC(e,1,i.transform.zoom),_=ew(d,i.transform,m),g="none"!==r.layout.get("icon-text-fit")&&s.hasIconData();if(f){let i=Math.pow(2,u.zoom-e.tileID.overscaledZ),r=c?(e,t)=>c.getElevation(n,e,t):null;!function(e,i,r,a,n,s,o,l,h,u,c,d){let p=e.text.placedSymbolArray,f=e.text.dynamicLayoutVertexArray,m=e.icon.dynamicLayoutVertexArray,_={};f.clear();for(let m=0;m<p.length;m++){let g=p.get(m),y=g.hidden||!g.crossTileID||e.allowVerticalPlacement&&!g.placedOrientation?null:a[g.crossTileID];if(y){let a=new t.P(g.anchorX,g.anchorY),p={getElevation:d,width:n.width,height:n.height,pitchedLabelPlaneMatrix:s,pitchWithMap:r,transform:n,tileAnchorPoint:a,translation:u,unwrappedTileID:c},m=r?ek(a.x,a.y,p):eE(a.x,a.y,p),x=.5+n.cameraToCenterDistance/m.signedDistanceFromCamera*.5,v=t.ap(e.textSizeData,l,g)*x/t.aB;r&&(v*=e.tilePixelRatio/o);let{width:b,height:w,anchor:T,textOffset:P,textBoxScale:S}=y,M=function(e,i,r,a,n,s){let{horizontalAlign:o,verticalAlign:l}=t.aH(e);return new t.P((-(o-.5)*i/n+a[0])*s,(-(l-.5)*r/n+a[1])*s)}(T,b,w,P,S,v),C=n.getPitchedTextCorrection(a.x+u[0],a.y+u[1],c),I=function(e,i,r,a,n,s){let o=i.tileAnchorPoint.add(new t.P(i.translation[0],i.translation[1]));if(i.pitchWithMap){let e=a.mult(s);r||(e=e.rotate(-n));let t=o.add(e);return eP(t.x,t.y,i.pitchedLabelPlaneMatrix,i.getElevation).point}if(r){let t=eE(i.tileAnchorPoint.x+1,i.tileAnchorPoint.y,i).point.sub(e),r=Math.atan(t.y/t.x)+(t.x<0?Math.PI:0);return e.add(a.rotate(r))}return e.add(a)}(m.point,p,i,M,-n.bearingInRadians,C),A=e.allowVerticalPlacement&&g.placedOrientation===t.ao.vertical?Math.PI/2:0;for(let e=0;e<g.numGlyphs;e++)t.av(f,I,A);h&&g.associatedIconIndex>=0&&(_[g.associatedIconIndex]={shiftedAnchor:I,angle:A})}else eF(g.numGlyphs,f)}if(h){m.clear();let i=e.icon.placedSymbolArray;for(let e=0;e<i.length;e++){let r=i.get(e);if(r.hidden)eF(r.numGlyphs,m);else{let i=_[e];if(i)for(let e=0;e<r.numGlyphs;e++)t.av(m,i.shiftedAnchor,i.angle);else eF(r.numGlyphs,m)}}e.icon.dynamicLayoutVertexBuffer.updateData(m)}e.text.dynamicLayoutVertexBuffer.updateData(f)}(s,d,p,h,u,_,i,f,g,t.aD(u,e,o,l),n.toUnwrapped(),r)}}}(a,e,r,i,r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),n),0!==r.paint.get("icon-opacity").constantOr(1)&&rt(e,i,r,a,!1,r.paint.get("icon-translate"),r.paint.get("icon-translate-anchor"),r.layout.get("icon-rotation-alignment"),r.layout.get("icon-pitch-alignment"),r.layout.get("icon-keep-upright"),l,h,o),0!==r.paint.get("text-opacity").constantOr(1)&&rt(e,i,r,a,!0,r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),r.layout.get("text-keep-upright"),l,h,o),i.map.showCollisionBoxes&&(i7(e,i,r,a,!0),i7(e,i,r,a,!1))}(e,i,r,a,this.style.placement.variableOffsets,n):t.cc(r)?function(e,i,r,a,n){if("translucent"!==e.renderPass)return;let{isRenderingToTexture:s}=n,o=r.paint.get("circle-opacity"),l=r.paint.get("circle-stroke-width"),h=r.paint.get("circle-stroke-opacity"),u=!r.layout.get("circle-sort-key").isConstant();if(0===o.constantOr(1)&&(0===l.constantOr(1)||0===h.constantOr(1)))return;let c=e.context,d=c.gl,p=e.transform,f=e.getDepthModeForSublayer(0,tf.ReadOnly),m=tm.disabled,_=e.colorModeForRenderPass(),g=[],y=p.getCircleRadiusCorrection();for(let n=0;n<a.length;n++){let o=a[n],l=i.getTile(o),h=l.getBucket(r);if(!h)continue;let c=r.paint.get("circle-translate"),d=r.paint.get("circle-translate-anchor"),f=t.aD(p,l,c,d),m=h.programConfigurations.get(r.id),_=e.useProgram("circle",m),x=h.layoutVertexBuffer,v=h.indexBuffer,b=e.style.map.terrain&&e.style.map.terrain.getTerrainData(o),w={programConfiguration:m,program:_,layoutVertexBuffer:x,indexBuffer:v,uniformValues:t6(e,l,r,f,y),terrainData:b,projectionData:p.getProjectionData({overscaledTileID:o,applyGlobeMatrix:!s,applyTerrainMatrix:!0})};if(u)for(let e of h.segments.get())g.push({segments:new t.aM([e]),sortKey:e.sortKey,state:w});else g.push({segments:h.segments,sortKey:0,state:w})}for(let t of(u&&g.sort((e,t)=>
51e.sortKey-t.sortKey),g)){let{programConfiguration:i,program:a,layoutVertexBuffer:n,indexBuffer:s,uniformValues:o,terrainData:l,projectionData:h}=t.state;a.draw(c,d.TRIANGLES,f,m,_,tp.backCCW,o,l,h,r.id,n,s,t.segments,r.paint,e.transform.zoom,i)}}(e,i,r,a,n):t.cd(r)?function(e,i,r,a,n){if(0===r.paint.get("heatmap-opacity"))return;let s=e.context,{isRenderingToTexture:o,isRenderingGlobe:l}=n;if(e.style.map.terrain){for(let n of a){let a=i.getTile(n);i.hasRenderableParent(n)||("offscreen"===e.renderPass?function(e,i,r,a,n){let s=e.context,o=s.gl,l=tm.disabled,h=new td([o.ONE,o.ONE],t.bf.transparent,[!0,!0,!0,!0]),u=i.getBucket(r);if(!u)return;let c=a.key,d=r.heatmapFbos.get(c);d||(d=rr(s,i.tileSize,i.tileSize),r.heatmapFbos.set(c,d)),s.bindFramebuffer.set(d.framebuffer),s.viewport.set([0,0,i.tileSize,i.tileSize]),s.clear({color:t.bf.transparent});let p=u.programConfigurations.get(r.id),f=e.useProgram("heatmap",p,!n),m=e.transform.getProjectionData({overscaledTileID:i.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),_=e.style.map.terrain.getTerrainData(a);f.draw(s,o.TRIANGLES,tf.disabled,l,h,tp.disabled,ie(i,e.transform.zoom,r.paint.get("heatmap-intensity"),1),_,m,r.id,u.layoutVertexBuffer,u.indexBuffer,u.segments,r.paint,e.transform.zoom,p)}(e,a,r,n,l):"translucent"===e.renderPass&&function(e,t,i,r,a){let n=e.context,s=n.gl,o=e.transform;n.setColorMode(e.colorModeForRenderPass());let l=ra(n,t),h=i.key,u=t.heatmapFbos.get(h);if(!u)return;n.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,u.colorAttachment.get()),n.activeTexture.set(s.TEXTURE1),l.bind(s.LINEAR,s.CLAMP_TO_EDGE);let c=o.getProjectionData({overscaledTileID:i,applyTerrainMatrix:a,applyGlobeMatrix:!r});e.useProgram("heatmapTexture").draw(n,s.TRIANGLES,tf.disabled,tm.disabled,e.colorModeForRenderPass(),tp.disabled,it(e,t,0,1),null,c,t.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments,t.paint,o.zoom),u.destroy(),t.heatmapFbos.delete(h)}(e,r,n,o,l))}s.viewport.set([0,0,e.width,e.height])}else{let n,s,o;"offscreen"===e.renderPass?function(e,i,r,a){let n,s,o=e.context,l=o.gl,h=e.transform,u=tm.disabled,c=new td([l.ONE,l.ONE],t.bf.transparent,[!0,!0,!0,!0]);n=o.gl,o.activeTexture.set(n.TEXTURE1),o.viewport.set([0,0,e.width/4,e.height/4]),(s=r.heatmapFbos.get(t.c2))?(n.bindTexture(n.TEXTURE_2D,s.colorAttachment.get()),o.bindFramebuffer.set(s.framebuffer)):(s=rr(o,e.width/4,e.height/4),r.heatmapFbos.set(t.c2,s)),o.clear({color:t.bf.transparent});for(let t=0;t<a.length;t++){let n=a[t];if(i.hasRenderableParent(n))continue;let s=i.getTile(n),d=s.getBucket(r);if(!d)continue;let p=d.programConfigurations.get(r.id),f=e.useProgram("heatmap",p),m=h.getProjectionData({overscaledTileID:n,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),_=h.getCircleRadiusCorrection();f.draw(o,l.TRIANGLES,tf.disabled,u,c,tp.backCCW,ie(s,h.zoom,r.paint.get("heatmap-intensity"),_),null,m,r.id,d.layoutVertexBuffer,d.indexBuffer,d.segments,r.paint,h.zoom,p)}o.viewport.set([0,0,e.width,e.height])}(e,i,r,a):"translucent"===e.renderPass&&(s=(n=e.context).gl,n.setColorMode(e.colorModeForRenderPass()),(o=r.heatmapFbos.get(t.c2))&&(n.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,o.colorAttachment.get()),n.activeTexture.set(s.TEXTURE1),ra(n,r).bind(s.LINEAR,s.CLAMP_TO_EDGE),e.useProgram("heatmapTexture").draw(n,s.TRIANGLES,tf.disabled,tm.disabled,e.colorModeForRenderPass(),tp.disabled,it(e,r,0,1),null,null,r.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,r.paint,e.transform.zoom)))}}(e,i,r,a,n):t.ce(r)?function(e,i,r,a,n){if("translucent"!==e.renderPass)return;let{isRenderingToTexture:s}=n,o=r.paint.get("line-opacity"),l=r.paint.get("line-width");if(0===o.constantOr(1)||0===l.constantOr(1))return;let h=e.getDepthModeForSublayer(0,tf.ReadOnly),u=e.colorModeForRenderPass(),c=r.paint.get("line-dasharray"),d=r.paint.get("line-pattern"),p=d.constantOr(1),f=r.paint.get("line-gradient"),m=r.getCrossfadeParameters(),_=p?"linePattern":c?"lineSDF":f?"lineGradient":"line",g=e.context,y=g.gl,x=e.transform,v=!0;for(let n of a){let a=i.getTile(n);if(p&&!a.patternsLoaded())continue;let o=a.getBucket(r);
51if(!o)continue;let l=o.programConfigurations.get(r.id),b=e.context.program.get(),w=e.useProgram(_,l),T=v||w.program!==b,P=e.style.map.terrain&&e.style.map.terrain.getTerrainData(n),S=d.constantOr(null);if(S&&a.imageAtlas){let e=a.imageAtlas,t=e.patternPositions[S.to.toString()],i=e.patternPositions[S.from.toString()];t&&i&&l.setConstantPatternPositions(t,i)}let M=x.getProjectionData({overscaledTileID:n,applyGlobeMatrix:!s,applyTerrainMatrix:!0}),C=x.getPixelScale(),I=p?il(e,a,r,C,m):c?ih(e,a,r,C,c,m):f?io(e,a,r,C,o.lineClipsArray.length):is(e,a,r,C);if(p)g.activeTexture.set(y.TEXTURE0),a.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),l.updatePaintBuffers(m);else if(c&&(T||e.lineAtlas.dirty))g.activeTexture.set(y.TEXTURE0),e.lineAtlas.bind(g);else if(f){let a=o.gradients[r.id],s=a.texture;if(r.gradientVersion!==a.version){let l=256;if(r.stepInterpolant){let r=i.getSource().maxzoom,a=n.canonical.z===r?Math.ceil(1<<e.transform.maxZoom-n.canonical.z):1;l=t.ah(t.c3(o.maxLineLength/t.$*1024*a),256,g.maxTextureSize)}a.gradient=t.c4({expression:r.gradientExpression(),evaluationKey:"lineProgress",resolution:l,image:a.gradient||void 0,clips:o.lineClipsArray}),a.texture?a.texture.update(a.gradient):a.texture=new t.T(g,a.gradient,y.RGBA),a.version=r.gradientVersion,s=a.texture}g.activeTexture.set(y.TEXTURE0),s.bind(r.stepInterpolant?y.NEAREST:y.LINEAR,y.CLAMP_TO_EDGE)}let A=e.stencilModeForClipping(n);w.draw(g,y.TRIANGLES,h,A,u,tp.disabled,I,P,M,r.id,o.layoutVertexBuffer,o.indexBuffer,o.segments,r.paint,e.transform.zoom,l,o.layoutVertexBuffer2),v=!1}}(e,i,r,a,n):t.cf(r)?function(e,i,r,a,n){let s=r.paint.get("fill-color"),o=r.paint.get("fill-opacity");if(0===o.constantOr(1))return;let{isRenderingToTexture:l}=n,h=e.colorModeForRenderPass(),u=r.paint.get("fill-pattern"),c=e.opaquePassEnabledForLayer()&&!u.constantOr(1)&&1===s.constantOr(t.bf.transparent).a&&1===o.constantOr(0)?"opaque":"translucent";if(e.renderPass===c){let t=e.getDepthModeForSublayer(1,"opaque"===e.renderPass?tf.ReadWrite:tf.ReadOnly);rs(e,i,r,a,t,h,!1,l)}if("translucent"===e.renderPass&&r.paint.get("fill-antialias")){let t=e.getDepthModeForSublayer(2*!!r.getPaintProperty("fill-outline-color"),tf.ReadOnly);rs(e,i,r,a,t,h,!0,l)}}(e,i,r,a,n):t.cg(r)?function(e,t,i,r,a){let n=i.paint.get("fill-extrusion-opacity");if(0===n)return;let{isRenderingToTexture:s}=a;if("translucent"===e.renderPass){let a=new tf(e.context.gl.LEQUAL,tf.ReadWrite,e.depthRangeFor3D);if(1!==n||i.paint.get("fill-extrusion-pattern").constantOr(1))ro(e,t,i,r,a,tm.disabled,td.disabled,s),ro(e,t,i,r,a,e.stencilModeFor3D(),e.colorModeForRenderPass(),s);else{let n=e.colorModeForRenderPass();ro(e,t,i,r,a,tm.disabled,n,s)}}}(e,i,r,a,n):t.ch(r)?function(e,i,r,a,n){if("offscreen"!==e.renderPass&&"translucent"!==e.renderPass)return;let{isRenderingToTexture:s}=n,o=e.context,l=e.style.projection.useSubdivision,h=e.getDepthModeForSublayer(0,tf.ReadOnly),u=e.colorModeForRenderPass();if("offscreen"===e.renderPass)!function(e,i,r,a,n,s,o){let l=e.context,h=l.gl;for(let u of r){let r=i.getTile(u),c=r.dem;if(!c||!c.data||!r.needsHillshadePrepare)continue;let d=c.dim,p=c.stride,f=c.getPixels();if(l.activeTexture.set(h.TEXTURE1),l.pixelStoreUnpackPremultiplyAlpha.set(!1),r.demTexture=r.demTexture||e.getTileTexture(p),r.demTexture){let e=r.demTexture;e.update(f,{premultiply:!1}),e.bind(h.NEAREST,h.CLAMP_TO_EDGE)}else r.demTexture=new t.T(l,f,h.RGBA,{premultiply:!1}),r.demTexture.bind(h.NEAREST,h.CLAMP_TO_EDGE);l.activeTexture.set(h.TEXTURE0);let m=r.fbo;if(!m){let e=new t.T(l,{width:d,height:d,data:null},h.RGBA);e.bind(h.LINEAR,h.CLAMP_TO_EDGE),(m=r.fbo=l.createFramebuffer(d,d,!0,!1)).colorAttachment.set(e.texture)}l.bindFramebuffer.set(m.framebuffer),l.viewport.set([0,0,d,d]),e.useProgram("hillshadePrepare").draw(l,h.TRIANGLES,n,s,o,tp.disabled,ir(r.tileID,c),null,null,a.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments),r.needsHillshadePrepare=!1}}(e,i,a,r,h,tm.disabled,u),o.viewport.set([0,0,e.width,e.height]);else if("translucent"===e.renderPass)if(l){let[t,n,o]=e.stencilConfigForOverlapTwoPass(a);rl(e,i,r,o,t,h,u,!1,s),rl(e,i,r,o,n,h,u,!0,s)}else{let[t,n]=e.getStencilConfigForOverlapAndUpdateStencilID(a);rl(e,i,r,n,t,h,u,!1,s)}}(e,i,r,a,n):t.ci(r)?function(e,t,i,r,a){if("translucent"!==e.renderPass||!r.length)return;let{isRenderingToTexture:n}=a,s=e.style.projection.useSubdivision,o=e.getDepthModeForSublayer(0,tf.ReadOnly),l=e.colorModeForRenderPass();if(s){let[a,s,h]=e.stencilConfigForOverlapTwoPass(r);rh(e,t,i,h,a,o,l,!1,n),rh(e,t,i,h,s,o,l,!0,n)}else{let[a,s]=e.getStencilConfigForOverlapAndUpdateStencilID(r);rh(e,t,i,s,a,o,l,!1,n)}}(e,i,r,a,n):t.cj(r)?function(e,t,i,r,a){if("translucent"!==e.renderPass||0===i.paint.get("raster-opacity")||!r.length)return;let{isRenderingToTexture:n}=a,s=t.getSource(),o=e.style.projection.useSubdivision;if(s instanceof W)rc(e,t,i,r,null,!1,!1,s.tileCoords,s.flippedWindingOrder,n);else if(o){let[a,s,o]=e.stencilConfigForOverlapTwoPass(r);rc(e,t,i,o,a,!1,!0,ru,!1,n),rc(e,t,i,o,s,!0,!0,ru,!1,n)}else{let[a,s]=e.getStencilConfigForOverlapAndUpdateStencilID(r);rc(e,t,i,s,a,!1,!0,ru,!1,n)}}(e,i,r,a,n):t.ck(r)?function(e,t,i,r){let a=t.paint.get("background-color"),n=t.paint.get("background-opacity");if(0===n)return;let{isRenderingToTexture:s}=r,o=e.context,l=o.gl,h=e.style.projection,u=e.transform,c=u.tileSize,d=t.paint.get("background-pattern");if(e.isPatternMissing(d))return;let p=!d&&1===a.a&&1===n&&e.opaquePassEnabledForLayer()?"opaque":"translucent";if(e.renderPass!==p)return;let f=tm.disabled,m=e.getDepthModeForSublayer(0,"opaque"===p?tf.ReadWrite:tf.ReadOnly),_=e.colorModeForRenderPass(),g=e.useProgram(d?"backgroundPattern":"background"),y=i||ef(u,{tileSize:c,terrain:e.style.map.terrain});d&&(o.activeTexture.set(l.TEXTURE0),e.imageManager.bind(e.context));let x=t.getCrossfadeParameters();for(let i of y){let r=u.getProjectionData({overscaledTileID:i,applyGlobeMatrix:!s,applyTerrainMatrix:!0}),p=d?iy(n,e,d,{tileID:i,tileSize:c},x):ig(n,a),y=e.style.map.terrain&&e.style.map.terrain.getTerrainData(i),v=h.getMeshFromTileID(o,i.canonical,!1,!0,"raster");g.draw(o,l.TRIANGLES,m,f,_,tp.backCCW,p,y,r,t.id,v.vertexBuffer,v.indexBuffer,v.segments)}}(e,r,a,n):t.cl(r)&&function(e,t,i){let{isRenderingGlobe:r}
51=i,a=e.context,n=t.implementation,s=e.style.projection,o=e.transform,l=o.getProjectionDataForCustomLayer(r),h={farZ:o.farZ,nearZ:o.nearZ,fov:o.fov*Math.PI/180,modelViewProjectionMatrix:o.modelViewProjectionMatrix,projectionMatrix:o.projectionMatrix,shaderData:{variantName:s.shaderVariantName,vertexShaderPrelude:`const float PI = 3.141592653589793; 52uniform mat4 u_projection_matrix; 53${s.shaderPreludeCode.vertexSource}`,define:s.shaderDefine},defaultProjectionData:l},u=n.renderingMode?n.renderingMode:"2d";if("offscreen"===e.renderPass){let t=n.prerender;t&&(e.setCustomLayerDefaults(),a.setColorMode(e.colorModeForRenderPass()),t.call(n,a.gl,h),a.setDirty(),e.setBaseState())}else if("translucent"===e.renderPass){e.setCustomLayerDefaults(),a.setColorMode(e.colorModeForRenderPass()),a.setStencilMode(tm.disabled);let t="3d"===u?e.getDepthModeFor3D():e.getDepthModeForSublayer(0,tf.ReadOnly);a.setDepthMode(t),n.render(a.gl,h),a.setDirty(),e.setBaseState(),a.bindFramebuffer.set(null)}}(e,r,n))}saveTileTexture(e){let t=this._tileTextures[e.size[0]];t?t.push(e):this._tileTextures[e.size[0]]=[e]}getTileTexture(e){let t=this._tileTextures[e];return t&&t.length>0?t.pop():null}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;let t=this.imageManager.getPattern(e.from.toString()),i=this.imageManager.getPattern(e.to.toString());return!t||!i}useProgram(e,t,i=!1,r=[]){this.cache=this.cache||{};let a=!!this.style.map.terrain,n=this.style.projection,s=i?e3.projectionMercator:n.shaderPreludeCode,o=i?e8:n.shaderDefine,l=e+(t?t.cacheKey:"")+`/${i?e9:n.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(a?"/terrain":"")+(r?`/${r.join("/")}`:"");return this.cache[l]||(this.cache[l]=new tQ(this.context,e3[e],t,iv[e],this._showOverdrawInspector,a,s,o,r)),this.cache[l]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){let e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new t.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){let{drawingBufferWidth:e,drawingBufferHeight:t}=this.context.gl;return this.width!==e||this.height!==t}}function rT(e,t){let i,r=!1,a=null,n=null,s=()=>{a=null,r&&(e.apply(n,i),a=setTimeout(s,t),r=!1)};return(...e)=>(r=!0,n=this,i=e,a||s(),a)}class rP{constructor(e){this._getCurrentHash=()=>{let e=window.location.hash.replace("#","");if(this._hashName){let t;return e.split("&").map(e=>e.split("=")).forEach(e=>{e[0]===this._hashName&&(t=e)}),(t&&t[1]||"").split("/")}return e.split("/")},this._onHashChange=()=>{let e=this._getCurrentHash();if(!this._isValidHash(e))return!1;let t=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(e[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+e[2],+e[1]],zoom:+e[0],bearing:t,pitch:+(e[4]||0)}),!0},this._updateHashUnthrottled=()=>{let e=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,e)},this._removeHash=()=>{let e=this._getCurrentHash();if(0===e.length)return;let t=e.join("/"),i=t;i.split("&").length>0&&(i=i.split("&")[0]),this._hashName&&(i=`${this._hashName}=${t}`);let r=window.location.hash.replace(i,"");r.startsWith("#&")?r=r.slice(0,1)+r.slice(2):"#"===r&&(r="");let a=window.location.href.replace(/(#.+)?$/,r);a=a.replace("&&","&"),window.history.replaceState(window.history.state,null,a)},this._updateHash=rT(this._updateHashUnthrottled,300),this._hashName=e&&encodeURIComponent(e)}addTo(e){return this._map=e,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(e){let t=this._map.getCenter(),i=Math.round(100*this._map.getZoom())/100,r=Math.pow(10,Math.ceil((i*Math.LN2+Math.log(512/360/.5))/Math.LN10)),a=Math.round(t.lng*r)/r,n=Math.round(t.lat*r)/r,s=this._map.getBearing(),o=this._map.getPitch(),l="";if(l+=e?`/${a}/${n}/${i}`:`${i}/${n}/${a}`,(s||o)&&(l+="/"+Math.round(10*s)/10),o&&(l+=`/${Math.round(o)}`),this._hashName){let e=this._hashName,t=!1,i=window.location.hash.slice(1).split("&").map(i=>{let r=i.split("=")[0];return r===e?(t=!0,`${r}=${l}`):i}).filter(e=>e);return t||i.push(`${e}=${l}`),`#${i.join("&")}`}return`#${l}`}
53_isValidHash(e){if(e.length<3||e.some(isNaN))return!1;try{new t.S(+e[2],+e[1])}catch(e){return!1}let i=+e[0],r=+(e[3]||0),a=+(e[4]||0);return i>=this._map.getMinZoom()&&i<=this._map.getMaxZoom()&&r>=-180&&r<=180&&a>=this._map.getMinPitch()&&a<=this._map.getMaxPitch()}}let rS={linearity:.3,easing:t.cm(0,0,.3,1)},rM=t.e({deceleration:2500,maxSpeed:1400},rS),rC=t.e({deceleration:20,maxSpeed:1400},rS),rI=t.e({deceleration:1e3,maxSpeed:360},rS),rA=t.e({deceleration:1e3,maxSpeed:90},rS),rE=t.e({deceleration:1e3,maxSpeed:360},rS);class rz{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:d.now(),settings:e})}_drainInertiaBuffer(){let e=this._inertiaBuffer,t=d.now();for(;e.length>0&&t-e[0].time>160;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;let i={zoom:0,bearing:0,pitch:0,roll:0,pan:new t.P(0,0),pinchAround:void 0,around:void 0};for(let{settings:e}of this._inertiaBuffer)i.zoom+=e.zoomDelta||0,i.bearing+=e.bearingDelta||0,i.pitch+=e.pitchDelta||0,i.roll+=e.rollDelta||0,e.panDelta&&i.pan._add(e.panDelta),e.around&&(i.around=e.around),e.pinchAround&&(i.pinchAround=e.pinchAround);let r=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,a={};if(i.pan.mag()){let n=rD(i.pan.mag(),r,t.e({},rM,e||{})),s=i.pan.mult(n.amount/i.pan.mag()),o=this._map.cameraHelper.handlePanInertia(s,this._map.transform);a.center=o.easingCenter,a.offset=o.easingOffset,rk(a,n)}if(i.zoom){let e=rD(i.zoom,r,rC);a.zoom=this._map.transform.zoom+e.amount,rk(a,e)}if(i.bearing){let e=rD(i.bearing,r,rI);a.bearing=this._map.transform.bearing+t.ah(e.amount,-179,179),rk(a,e)}if(i.pitch){let e=rD(i.pitch,r,rA);a.pitch=this._map.transform.pitch+e.amount,rk(a,e)}if(i.roll){let e=rD(i.roll,r,rE);a.roll=this._map.transform.roll+t.ah(e.amount,-179,179),rk(a,e)}if(a.zoom||a.bearing){let e=void 0===i.pinchAround?i.around:i.pinchAround;a.around=e?this._map.unproject(e):this._map.getCenter()}return this.clear(),t.e(a,{noMoveStart:!0})}}function rk(e,t){(!e.duration||e.duration<t.duration)&&(e.duration=t.duration,e.easing=t.easing)}function rD(e,i,r){let{maxSpeed:a,linearity:n,deceleration:s}=r,o=t.ah(e*n/(i/1e3),-a,a),l=Math.abs(o)/(s*n);return{easing:r.easing,duration:1e3*l,amount:l/2*o}}class rR extends t.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,r,a={}){r=r instanceof MouseEvent?r:new MouseEvent(e,r);const n=p.mousePos(i.getCanvas(),r),s=i.unproject(n);super(e,t.e({point:n,lngLat:s,originalEvent:r},a)),this._defaultPrevented=!1,this.target=i}}class rL extends t.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,r){const a="touchend"===e?r.changedTouches:r.touches,n=p.touchPos(i.getCanvasContainer(),a),s=n.map(e=>i.unproject(e)),o=n.reduce((e,t,i,r)=>e.add(t.div(r.length)),new t.P(0,0));super(e,{points:n,point:o,lngLats:s,lngLat:i.unproject(o),originalEvent:r}),this._defaultPrevented=!1}}class rF extends t.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,i){super(e,{originalEvent:i}),this._defaultPrevented=!1}}class rB{constructor(e,t){this._map=e,this._clickTolerance=t.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new rF(e.type,this._map,e))}mousedown(e,t){return this._mousedownPos=t,this._firePreventable(new rR(e.type,this._map,e))}mouseup(e){this._map.fire(new rR(e.type,this._map,e))}click(e,t){this._mousedownPos&&this._mousedownPos.dist(t)>=this._clickTolerance||this._map.fire(new rR(e.type,this._map,e))}dblclick(e){return this._firePreventable(new rR(e.type,this._map,e))}mouseover(e){this._map.fire(new rR(e.type,this._map,e))}mouseout(e){this._map.fire(new rR(e.type,this._map,e))}touchstart(e){return this._firePreventable(new rL(e.type,this._map,e))}touchmove(e){this._map.fire(new rL(e.type,this._map,e))}touchend(e){this._map.fire(new rL(e.type,this._map,e))}touchcancel(e){this._map.fire(new rL(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class rO{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new rR(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new rR("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new rR(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class rj{constructor(e){this._map=e}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(e){return this.transform.screenPointToLocation(t.P.convert(e),this._map.terrain)}}class rV{constructor(e,t){this._map=e,this._tr=new rj(e),this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=t.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,t){this.isEnabled()&&e.shiftKey&&0===e.button&&(p.disableDrag(),this._startPos=this._lastPos=t,this._active=!0)}mousemoveWindow(e,t){if(!this._active||this._lastPos.equals(t)||!this._box&&t.dist(this._startPos)<this._clickTolerance)return;let i=this._startPos;this._lastPos=t,this._box||(this._box=p.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",e));let r=Math.min(i.x,t.x),a=Math.max(i.x,t.x),n=Math.min(i.y,t.y),s=Math.max(i.y,t.y);p.setTransform(this._box,`translate(${r}px,${n}px)`),this._box.style.width=a-r+"px",this._box.style.height=s-n+"px"}mouseupWindow(e,i){if(!this._active||0!==e.button)return;let r=this._startPos;if(this.reset(),p.suppressClick(),r.x!==i.x||r.y!==i.y)return this._map.fire(new t.l("boxzoomend",{originalEvent:e})),{cameraAnimation:e=>e.fitScreenCoordinates(r,i,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",e)}
53keydown(e){this._active&&27===e.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",e))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(p.remove(this._box),this._box=null),p.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,i){return this._map.fire(new t.l(e,{originalEvent:i}))}}function rU(e,t){if(e.length!==t.length)throw Error(`The number of touches and points are not equal - touches ${e.length}, points ${t.length}`);let i={};for(let r=0;r<e.length;r++)i[e[r].identifier]=t[r];return i}class rN{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,i,r){(this.centroid||r.length>this.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=e.timeStamp),r.length===this.numTouches&&(this.centroid=function(e){let i=new t.P(0,0);for(let t of e)i._add(t);return i.div(e.length)}(i),this.touches=rU(r,i)))}touchmove(e,t,i){if(this.aborted||!this.centroid)return;let r=rU(i,t);for(let e in this.touches){let t=r[e];(!t||t.dist(this.touches[e])>30)&&(this.aborted=!0)}}touchend(e,t,i){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),0===i.length){let e=!this.aborted&&this.centroid;if(this.reset(),e)return e}}}class r${constructor(e){this.singleTap=new rN(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,t,i){this.singleTap.touchstart(e,t,i)}touchmove(e,t,i){this.singleTap.touchmove(e,t,i)}touchend(e,t,i){let r=this.singleTap.touchend(e,t,i);if(r){let t=e.timeStamp-this.lastTime<500,i=!this.lastTap||30>this.lastTap.dist(r);if(t&&i||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=r,this.count===this.numTaps)return this.reset(),r}}}class rZ{constructor(e){this._tr=new rj(e),this._zoomIn=new r$({numTouches:1,numTaps:2}),this._zoomOut=new r$({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,t,i){this._zoomIn.touchstart(e,t,i),this._zoomOut.touchstart(e,t,i)}touchmove(e,t,i){this._zoomIn.touchmove(e,t,i),this._zoomOut.touchmove(e,t,i)}touchend(e,t,i){let r=this._zoomIn.touchend(e,t,i),a=this._zoomOut.touchend(e,t,i),n=this._tr;return r?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:t=>t.easeTo({duration:300,zoom:n.zoom+1,around:n.unproject(r)},{originalEvent:e})}):a?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:t=>t.easeTo({duration:300,zoom:n.zoom-1,around:n.unproject(a)},{originalEvent:e})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class rG{constructor(e){this._enabled=!!e.enable,this._moveStateManager=e.moveStateManager,this._clickTolerance=e.clickTolerance||1,this._moveFunction=e.move,this._activateOnStart=!!e.activateOnStart,e.assignEvents(this),this.reset()}reset(e){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(e)}_move(...e){let t=this._moveFunction(...e);if(t.bearingDelta||t.pitchDelta||t.rollDelta||t.around||t.panDelta)return this._active=!0,t}dragStart(e,t){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(e)&&(this._moveStateManager.startMove(e),this._lastPoint=Array.isArray(t)?t[0]:t,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(e,t){if(!this.isEnabled())return;let i=this._lastPoint;if(!i)return;if(e.preventDefault(),!this._moveStateManager.isValidMoveEvent(e))return void this.reset(e);let r=Array.isArray(t)?t[0]:t;return!this._moved&&r.dist(i)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=r,this._move(i,r))}dragEnd(e){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(e)&&(this._moved&&p.suppressClick(),this.reset(e))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}let rq={0:1,2:2};class rW{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){let t=p.mouseButton(e);this._eventButton=t}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){let t;return t=rq[this._eventButton],void 0!==e.buttons&&(e.buttons&t)===t}isValidEndEvent(e){return p.mouseButton(e)===this._eventButton}}class rH{constructor(){this._firstTouch=void 0}_isOneFingerTouch(e){return 1===e.targetTouches.length}_isSameTouchEvent(e){return e.targetTouches[0].identifier===this._firstTouch}startMove(e){this._firstTouch=e.targetTouches[0].identifier}endMove(e){delete this._firstTouch}isValidStartEvent(e){return this._isOneFingerTouch(e)}isValidMoveEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}isValidEndEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}}class rX{constructor(e=new rW({checkCorrectEvent:()=>!0}),t=new rH){this.mouseMoveStateManager=e,this.oneFingerTouchMoveStateManager=t}_executeRelevantHandler(e,t,i){return e instanceof MouseEvent?t(e):"u">typeof TouchEvent&&e instanceof TouchEvent?i(e):void 0}startMove(e){this._executeRelevantHandler(e,e=>this.mouseMoveStateManager.startMove(e),e=>this.oneFingerTouchMoveStateManager.startMove(e))}endMove(e){this._executeRelevantHandler(e,e=>this.mouseMoveStateManager.endMove(e),e=>this.oneFingerTouchMoveStateManager.endMove(e))}isValidStartEvent(e){return this._executeRelevantHandler(e,e=>this.mouseMoveStateManager.isValidStartEvent(e),e=>this.oneFingerTouchMoveStateManager.isValidStartEvent(e))}isValidMoveEvent(e){return this._executeRelevantHandler(e,e=>this.mouseMoveStateManager.isValidMoveEvent(e),e=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(e))}isValidEndEvent(e){return this._executeRelevantHandler(e,e=>this.mouseMoveStateManager.isValidEndEvent(e),e=>this.oneFingerTouchMoveStateManager.isValidEndEvent(e))}}let rY=e=>{e.mousedown=e.dragStart,e.mousemoveWindow=e.dragMove,e.mouseup=e.dragEnd,e.contextmenu=e=>{e.preventDefault()}};class rK{constructor(e,t){this._clickTolerance=e.clickTolerance||1,this._map=t,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new t.P(0,0)}_shouldBePrevented(e){return e<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(e,t,i){return this._calculateTransform(e,t,i)}touchmove(e,t,i){if(this._active){if(!this._shouldBePrevented(i.length))return e.preventDefault(),this._calculateTransform(e,t,i);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",e)}}touchend(e,t,i){this._calculateTransform(e,t,i),this._active&&this._shouldBePrevented(i.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,i,r){r.length>0&&(this._active=!0);let a=rU(r,i),n=new t.P(0,0),s=new t.P(0,0),o=0;for(let e in a){let t=a[e],i=this._touches[e];i&&(n._add(t),s._add(t.sub(i)),o++,a[e]=t)}if(this._touches=a,this._shouldBePrevented(o)||!s.mag())return;let l=s.div(o);return this._sum._add(l),this._sum.mag()<this._clickTolerance?void 0:{around:n.div(o),panDelta:l}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class rJ{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(e,t,i){this._firstTwoTouches||i.length<2||(this._firstTwoTouches=[i[0].identifier,i[1].identifier],this._start([t[0],t[1]]))}touchmove(e,t,i){if(!this._firstTwoTouches)return;e.preventDefault();let[r,a]=this._firstTwoTouches,n=rQ(i,t,r),s=rQ(i,t,a);if(!n||!s)return;let o=this._aroundCenter?null:n.add(s).div(2);return this._move([n,s],o,e)}touchend(e,t,i){if(!this._firstTwoTouches)return;let[r,a]=this._firstTwoTouches,n=rQ(i,t,r),s=rQ(i,t,a);n&&s||(this._active&&p.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&"center"===e.around}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function rQ(e,t,i){for(let r=0;r<e.length;r++)if(e[r].identifier===i)return t[r]}function r0(e,t){return Math.log(e/t)/Math.LN2}class r1 extends rJ{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,t){let i=this._distance;if(this._distance=e[0].dist(e[1]),this._active||!(.1>Math.abs(r0(this._distance,this._startDistance))))return this._active=!0,{zoomDelta:r0(this._distance,i),pinchAround:t}}}function r2(e,t){return 180*e.angleWith(t)/Math.PI}class r3 extends rJ{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(e){this._startVector=this._vector=e[0].sub(e[1]),this._minDiameter=e[0].dist(e[1])}_move(e,t,i){let r=this._vector;if(this._vector=e[0].sub(e[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:r2(this._vector,r),pinchAround:t}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());let t=25/(Math.PI*this._minDiameter)*360;return Math.abs(r2(e,this._startVector))<t}}function r5(e){return Math.abs(e.y)>Math.abs(e.x)}class r4 extends rJ{constructor(e){super(),this._currentTouchCount=0,this._map=e}
53reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(e,t,i){super.touchstart(e,t,i),this._currentTouchCount=i.length}_start(e){this._lastPoints=e,r5(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,t,i){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;let r=e[0].sub(this._lastPoints[0]),a=e[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(r,a,i.timeStamp),this._valid?(this._lastPoints=e,this._active=!0,{pitchDelta:-((r.y+a.y)/2*.5)}):void 0}gestureBeginsVertically(e,t,i){if(void 0!==this._valid)return this._valid;let r=e.mag()>=2,a=t.mag()>=2;if(!r&&!a)return;if(!r||!a)return void 0===this._firstMove&&(this._firstMove=i),i-this._firstMove<100&&void 0;let n=e.y>0==t.y>0;return r5(e)&&r5(t)&&n}}let r6=100,r8=15,r9=10;class r7{constructor(e){this._tr=new rj(e),this._panStep=r6,this._bearingStep=r8,this._pitchStep=r9,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let t=0,i=0,r=0,a=0,n=0;switch(e.keyCode){case 61:case 107:case 171:case 187:t=1;break;case 189:case 109:case 173:t=-1;break;case 37:e.shiftKey?i=-1:(e.preventDefault(),a=-1);break;case 39:e.shiftKey?i=1:(e.preventDefault(),a=1);break;case 38:e.shiftKey?r=1:(e.preventDefault(),n=-1);break;case 40:e.shiftKey?r=-1:(e.preventDefault(),n=1);break;default:return}return this._rotationDisabled&&(i=0,r=0),{cameraAnimation:s=>{let o=this._tr;s.easeTo({duration:300,easeId:"keyboardHandler",easing:ae,zoom:t?Math.round(o.zoom)+t*(e.shiftKey?2:1):o.zoom,bearing:o.bearing+i*this._bearingStep,pitch:o.pitch+r*this._pitchStep,offset:[-a*this._panStep,-n*this._panStep],center:o.center},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function ae(e){return e*(2-e)}let at=1/450;class ai{constructor(e,t){this._onTimeout=e=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(e)},this._map=e,this._tr=new rj(e),this._triggerRenderFrame=t,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=at}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return!!this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&"center"===e.around)}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(e){return!!this._map.cooperativeGestures.isEnabled()&&!(e.ctrlKey||this._map.cooperativeGestures.isBypassed(e))}wheel(e){if(!this.isEnabled())return;if(this._shouldBePrevented(e))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",e);let t=e.deltaMode===WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY,i=d.now(),r=i-(this._lastWheelEventTime||0);this._lastWheelEventTime=i,0!==t&&t%4.000244140625==0?this._type="wheel":0!==t&&4>Math.abs(t)?this._type="trackpad":r>400?(this._type=null,this._lastValue=t,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=200>Math.abs(r*t)?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,t+=this._lastValue)),e.shiftKey&&t&&(t/=4),this._type&&(this._lastWheelEvent=e,this._delta-=t,this._active||this._start(e)),e.preventDefault()}_start(e){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);let i=p.mousePos(this._map.getCanvas(),e),r=this._tr;this._aroundPoint=this._aroundCenter?r.transform.locationToScreenPoint(t.S.convert(r.center)):i,this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;let e=this._tr.transform;if("number"==typeof this._lastExpectedZoom){let t=e.zoom-this._lastExpectedZoom;"number"==typeof this._startZoom&&(this._startZoom+=t),"number"==typeof this._targetZoom&&(this._targetZoom+=t)}if(0!==this._delta){let i="wheel"===this._type&&Math.abs(this._delta)>4.000244140625?this._wheelZoomRate:this._defaultZoomRate,r=2/(1+Math.exp(-Math.abs(this._delta*i)));this._delta<0&&0!==r&&(r=1/r);let a="number"!=typeof this._targetZoom?e.scale:t.af(this._targetZoom);
53this._targetZoom=e.getConstrained(e.getCameraLngLat(),t.ak(a*r)).zoom,"wheel"===this._type&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}let i="number"!=typeof this._targetZoom?e.zoom:this._targetZoom,r=this._startZoom,a=this._easing,n,s=!1;if("wheel"===this._type&&r&&a){let e=Math.min((d.now()-this._lastWheelEventTime+5)/200,1),o=a(e);n=t.C.number(r,i,o),e<1?this._frameId||(this._frameId=!0):s=!0}else n=i,s=!0;return this._active=!0,s&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout},200)),this._lastExpectedZoom=n,{noInertia:!0,needsRenderFrame:!s,zoomDelta:n-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let i=t.co;if(this._prevEase){let e=this._prevEase,r=(d.now()-e.start)/e.duration,a=e.easing(r+.01)-e.easing(r),n=.27/Math.sqrt(a*a+1e-4)*.01,s=Math.sqrt(.0729-n*n);i=t.cm(n,s,.25,1)}return this._prevEase={start:d.now(),duration:e,easing:i},i}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class ar{constructor(e,t){this._clickZoom=e,this._tapZoom=t}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class aa{constructor(e){this._tr=new rj(e),this.reset()}reset(){this._active=!1}dblclick(e,t){return e.preventDefault(),{cameraAnimation:i=>{i.easeTo({duration:300,zoom:this._tr.zoom+(e.shiftKey?-1:1),around:this._tr.unproject(t)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class an{constructor(){this._tap=new r$({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(e,t,i){if(!this._swipePoint)if(this._tapTime){let r=t[0],a=e.timeStamp-this._tapTime<500,n=30>this._tapPoint.dist(r);a&&n?i.length>0&&(this._swipePoint=r,this._swipeTouch=i[0].identifier):this.reset()}else this._tap.touchstart(e,t,i)}touchmove(e,t,i){if(this._tapTime){if(this._swipePoint){if(i[0].identifier!==this._swipeTouch)return;let r=t[0],a=r.y-this._swipePoint.y;return this._swipePoint=r,e.preventDefault(),this._active=!0,{zoomDelta:a/128}}}else this._tap.touchmove(e,t,i)}touchend(e,t,i){if(this._tapTime)this._swipePoint&&0===i.length&&this.reset();else{let r=this._tap.touchend(e,t,i);r&&(this._tapTime=e.timeStamp,this._tapPoint=r)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class as{constructor(e,t,i){this._el=e,this._mousePan=t,this._touchPan=i}enable(e){this._inertiaOptions=e||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class ao{constructor(e,t,i,r){this._pitchWithRotate=e.pitchWithRotate,this._rollEnabled=e.rollEnabled,this._mouseRotate=t,this._mousePitch=i,this._mouseRoll=r}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable(),this._rollEnabled&&this._mouseRoll.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable(),this._mouseRoll.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())&&(!this._rollEnabled||this._mouseRoll.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()||this._mouseRoll.isActive()}}class al{constructor(e,t,i,r){this._el=e,this._touchZoom=t,this._touchRotate=i,this._tapDragZoom=r,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class ah{constructor(e,t){this._bypassKey=-1!==navigator.userAgent.indexOf("Mac")?"metaKey":"ctrlKey",this._map=e,this._options=t,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;let e=this._map.getCanvasContainer();e.classList.add("maplibregl-cooperative-gestures"),this._container=p.create("div","maplibregl-cooperative-gesture-screen",e);let t=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");"metaKey"===this._bypassKey&&(t=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));let i=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),r=document.createElement("div");r.className="maplibregl-desktop-message",r.textContent=t,this._container.appendChild(r);let a=document.createElement("div");a.className="maplibregl-mobile-message",a.textContent=i,this._container.appendChild(a),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(p.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(e){return e[this._bypassKey]}notifyGestureBlocked(e,i){this._enabled&&(this._map.fire(new t.l("cooperativegestureprevented",{gestureType:e,originalEvent:i})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}let au=e=>e.zoom||e.drag||e.roll||e.pitch||e.rotate;class ac extends t.l{}function ad(e){return e.panDelta&&e.panDelta.mag()||e.zoomDelta||e.bearingDelta||e.pitchDelta||e.rollDelta}class ap{constructor(e,i){this.handleWindowEvent=e=>{this.handleEvent(e,`${e.type}Window`)},this.handleEvent=(e,i)=>{if("blur"===e.type)return void this.stop(!0);this._updatingCamera=!0;let r="renderFrame"===e.type?void 0:e,a={needsRenderFrame:!1},n={},s={};for(let{handlerName:o,handler:l,allowed:h}of this._handlers){let u;
53if(l.isEnabled()){if(this._blockedByActive(s,h,o))l.reset();else if(l[i||e.type]){if(t.cp(e,i||e.type)){let t=p.mousePos(this._map.getCanvas(),e);u=l[i||e.type](e,t)}else if(t.cq(e,i||e.type)){let t=this._getMapTouches(e.touches),r=p.touchPos(this._map.getCanvas(),t);u=l[i||e.type](e,r,t)}else t.cr(i||e.type)||(u=l[i||e.type](e));this.mergeHandlerResult(a,n,u,o,r),u&&u.needsRenderFrame&&this._triggerRenderFrame()}(u||l.isActive())&&(s[o]=l)}}let o={};for(let e in this._previousActiveHandlers)s[e]||(o[e]=r);this._previousActiveHandlers=s,(Object.keys(o).length||ad(a))&&(this._changes.push([a,n,o]),this._triggerRenderFrame()),(Object.keys(s).length||ad(a))&&this._map._stop(!0),this._updatingCamera=!1;let{cameraAnimation:l}=a;l&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],l(this._map))},this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new rz(e),this._bearingSnap=i.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(i);const r=this._el;for(const[e,t,i]of(this._listeners=[[r,"touchstart",{passive:!0}],[r,"touchmove",{passive:!1}],[r,"touchend",void 0],[r,"touchcancel",void 0],[r,"mousedown",void 0],[r,"mousemove",void 0],[r,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[r,"mouseover",void 0],[r,"mouseout",void 0],[r,"dblclick",void 0],[r,"click",void 0],[r,"keydown",{capture:!1}],[r,"keyup",void 0],[r,"wheel",{passive:!1}],[r,"contextmenu",void 0],[window,"blur",void 0]],this._listeners))p.addEventListener(e,t,e===document?this.handleWindowEvent:this.handleEvent,i)}destroy(){for(let[e,t,i]of this._listeners)p.removeEventListener(e,t,e===document?this.handleWindowEvent:this.handleEvent,i)}_addDefaultHandlers(e){let i=this._map,r=i.getCanvasContainer();this._add("mapEvent",new rB(i,e));let a=i.boxZoom=new rV(i,e);this._add("boxZoom",a),e.interactive&&e.boxZoom&&a.enable();let n=i.cooperativeGestures=new ah(i,e.cooperativeGestures);this._add("cooperativeGestures",n),e.cooperativeGestures&&n.enable();let s=new rZ(i),o=new aa(i);i.doubleClickZoom=new ar(o,s),this._add("tapZoom",s),this._add("clickZoom",o),e.interactive&&e.doubleClickZoom&&i.doubleClickZoom.enable();let l=new an;this._add("tapDragZoom",l);let h=i.touchPitch=new r4(i);this._add("touchPitch",h),e.interactive&&e.touchPitch&&i.touchPitch.enable(e.touchPitch);let u=()=>i.project(i.getCenter()),c=function({enable:e,clickTolerance:i,aroundCenter:r=!0,minPixelCenterThreshold:a=100,rotateDegreesPerPixelMoved:n=.8},s){return new rG({clickTolerance:i,move:(e,i)=>{let o=s();if(r&&Math.abs(o.y-e.y)>a)return{bearingDelta:t.cn(new t.P(e.x,i.y),i,o)};let l=(i.x-e.x)*n;return r&&i.y<o.y&&(l=-l),{bearingDelta:l}},moveStateManager:new rW({checkCorrectEvent:e=>0===p.mouseButton(e)&&e.ctrlKey||2===p.mouseButton(e)&&!e.ctrlKey}),enable:e,assignEvents:rY})}(e,u),d=function({enable:e,clickTolerance:t,pitchDegreesPerPixelMoved:i=-.5}){return new rG({clickTolerance:t,move:(e,t)=>({pitchDelta:(t.y-e.y)*i}),moveStateManager:new rW({checkCorrectEvent:e=>0===p.mouseButton(e)&&e.ctrlKey||2===p.mouseButton(e)}),enable:e,assignEvents:rY})}(e),f=function({enable:e,clickTolerance:t,rollDegreesPerPixelMoved:i=.3},r){return new rG({clickTolerance:t,move:(e,t)=>{let a=r(),n=(t.x-e.x)*i;return t.y<a.y&&(n=-n),{rollDelta:n}},moveStateManager:new rW({checkCorrectEvent:e=>2===p.mouseButton(e)&&e.ctrlKey}),enable:e,assignEvents:rY})}(e,u);i.dragRotate=new ao(e,c,d,f),this._add("mouseRotate",c,["mousePitch"]),this._add("mousePitch",d,["mouseRotate","mouseRoll"]),this._add("mouseRoll",f,["mousePitch"]),e.interactive&&e.dragRotate&&i.dragRotate.enable();let m=function({enable:e,clickTolerance:t}){return new rG({clickTolerance:t,move:(e,t)=>({around:t,panDelta:t.sub(e)}),activateOnStart:!0,moveStateManager:new rW({checkCorrectEvent:e=>0===p.mouseButton(e)&&!e.ctrlKey}),enable:e,assignEvents:rY})}(e),_=new rK(e,i);i.dragPan=new as(r,m,_),this._add("mousePan",m),this._add("touchPan",_,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&i.dragPan.enable(e.dragPan);let g=new r3,y=new r1;i.touchZoomRotate=new al(r,y,g,l),this._add("touchRotate",g,["touchPan","touchZoom"]),this._add("touchZoom",y,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&i.touchZoomRotate.enable(e.touchZoomRotate);let x=i.scrollZoom=new ai(i,()=>
53this._triggerRenderFrame());this._add("scrollZoom",x,["mousePan"]),e.interactive&&e.scrollZoom&&i.scrollZoom.enable(e.scrollZoom);let v=i.keyboard=new r7(i);this._add("keyboard",v),e.interactive&&e.keyboard&&i.keyboard.enable(),this._add("blockableMapEvent",new rO(i))}_add(e,t,i){this._handlers.push({handlerName:e,handler:t,allowed:i}),this._handlersById[e]=t}stop(e){if(!this._updatingCamera){for(let{handler:e}of this._handlers)e.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}isActive(){for(let{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!au(this._eventsInProgress)||this.isZooming()}_blockedByActive(e,t,i){for(let r in e)if(r!==i&&(!t||0>t.indexOf(r)))return!0;return!1}_getMapTouches(e){let t=[];for(let i of e)this._el.contains(i.target)&&t.push(i);return t}mergeHandlerResult(e,i,r,a,n){if(!r)return;t.e(e,r);let s={handlerName:a,originalEvent:r.originalEvent||n};void 0!==r.zoomDelta&&(i.zoom=s),void 0!==r.panDelta&&(i.drag=s),void 0!==r.rollDelta&&(i.roll=s),void 0!==r.pitchDelta&&(i.pitch=s),void 0!==r.bearingDelta&&(i.rotate=s)}_applyChanges(){let e={},i={},r={};for(let[a,n,s]of this._changes)a.panDelta&&(e.panDelta=(e.panDelta||new t.P(0,0))._add(a.panDelta)),a.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+a.zoomDelta),a.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+a.bearingDelta),a.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+a.pitchDelta),a.rollDelta&&(e.rollDelta=(e.rollDelta||0)+a.rollDelta),void 0!==a.around&&(e.around=a.around),void 0!==a.pinchAround&&(e.pinchAround=a.pinchAround),a.noInertia&&(e.noInertia=a.noInertia),t.e(i,n),t.e(r,s);this._updateMapTransform(e,i,r),this._changes=[]}_updateMapTransform(e,t,i){let r=this._map,a=r._getTransformForUpdate(),n=r.terrain;if(!(ad(e)||n&&this._terrainMovement))return this._fireEvents(t,i,!0);r._stop(!0);let{panDelta:s,zoomDelta:o,bearingDelta:l,pitchDelta:h,rollDelta:u,around:c,pinchAround:d}=e;void 0!==d&&(c=d),c=c||r.transform.centerPoint,n&&!a.isPointOnMapSurface(c)&&(c=a.centerPoint);let p={panDelta:s,zoomDelta:o,rollDelta:u,pitchDelta:h,bearingDelta:l,around:c};this._map.cameraHelper.useGlobeControls&&!a.isPointOnMapSurface(c)&&(c=a.centerPoint);let f=.01>c.distSqr(a.centerPoint)?a.center:a.screenPointToLocation(s?c.sub(s):c);n?(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(p,a),!this._terrainMovement&&(t.drag||t.zoom)?(this._terrainMovement=!0,this._map._elevationFreeze=!0,this._map.cameraHelper.handleMapControlsPan(p,a,f)):t.drag&&this._terrainMovement?a.setCenter(a.screenPointToLocation(a.centerPoint.sub(s))):this._map.cameraHelper.handleMapControlsPan(p,a,f)):(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(p,a),this._map.cameraHelper.handleMapControlsPan(p,a,f)),r._applyUpdatedTransform(a),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(t,i,!0)}_fireEvents(e,i,r){let a,n=au(this._eventsInProgress),s=au(e),o={};for(let t in e){let{originalEvent:i}=e[t];this._eventsInProgress[t]||(o[`${t}start`]=i),this._eventsInProgress[t]=e[t]}for(let e in!n&&s&&this._fireEvent("movestart",s.originalEvent),o)this._fireEvent(e,o[e]);for(let t in s&&this._fireEvent("move",s.originalEvent),e){let{originalEvent:i}=e[t];this._fireEvent(t,i)}let l={};for(let e in this._eventsInProgress){let{handlerName:t,originalEvent:r}=this._eventsInProgress[e];this._handlersById[t].isActive()||(delete this._eventsInProgress[e],a=i[t]||r,l[`${e}end`]=a)}for(let e in l)this._fireEvent(e,l[e]);let h=au(this._eventsInProgress),u=(n||s)&&!h;if(u&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;let e=this._map._getTransformForUpdate();this._map.getCenterClampedToGround()&&e.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(e)}if(r&&u){this._updatingCamera=!0;let e=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),i=e=>0!==e&&-this._bearingSnap<e&&e<this._bearingSnap;e&&(e.essential||!d.prefersReducedMotion)?(i(e.bearing||this._map.getBearing())&&
53(e.bearing=0),e.freezeElevation=!0,this._map.easeTo(e,{originalEvent:a})):(this._map.fire(new t.l("moveend",{originalEvent:a})),i(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(e,i){this._map.fire(new t.l(e,i?{originalEvent:i}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(e=>{delete this._frameId,this.handleEvent(new ac("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}class af extends t.E{constructor(e,t,i){super(),this._renderFrameCallback=()=>{let e=Math.min((d.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(e)),e<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=i.bearingSnap,this.cameraHelper=t,this.on("moveend",()=>{delete this._requestedCameraState})}migrateProjection(e,t){e.apply(this.transform),this.transform=e,this.cameraHelper=t}getCenter(){return new t.S(this.transform.center.lng,this.transform.center.lat)}setCenter(e,t){return this.jumpTo({center:e},t)}getCenterElevation(){return this.transform.elevation}setCenterElevation(e,t){return this.jumpTo({elevation:e},t),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(e){this._centerClampedToGround=e}panBy(e,i,r){return e=t.P.convert(e).mult(-1),this.panTo(this.transform.center,t.e({offset:e},i),r)}panTo(e,i,r){return this.easeTo(t.e({center:e},i),r)}getZoom(){return this.transform.zoom}setZoom(e,t){return this.jumpTo({zoom:e},t),this}zoomTo(e,i,r){return this.easeTo(t.e({zoom:e},i),r)}zoomIn(e,t){return this.zoomTo(this.getZoom()+1,e,t),this}zoomOut(e,t){return this.zoomTo(this.getZoom()-1,e,t),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(e,i){return e!=this.transform.fov&&(this.transform.setFov(e),this.fire(new t.l("movestart",i)).fire(new t.l("move",i)).fire(new t.l("moveend",i))),this}getBearing(){return this.transform.bearing}setBearing(e,t){return this.jumpTo({bearing:e},t),this}getPadding(){return this.transform.padding}setPadding(e,t){return this.jumpTo({padding:e},t),this}rotateTo(e,i,r){return this.easeTo(t.e({bearing:e},i),r)}resetNorth(e,i){return this.rotateTo(0,t.e({duration:1e3},e),i),this}resetNorthPitch(e,i){return this.easeTo(t.e({bearing:0,pitch:0,roll:0,duration:1e3},e),i),this}snapToNorth(e,t){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,t):this}getPitch(){return this.transform.pitch}setPitch(e,t){return this.jumpTo({pitch:e},t),this}getRoll(){return this.transform.roll}setRoll(e,t){return this.jumpTo({roll:e},t),this}cameraForBounds(e,t){e=U.convert(e).adjustAntiMeridian();let i=t&&t.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),i,t)}_cameraForBoxAndBearing(e,i,r,a){let n={top:0,bottom:0,right:0,left:0};if("number"==typeof(a=t.e({padding:n,offset:[0,0],maxZoom:this.transform.maxZoom},a)).padding){let e=a.padding;a.padding={top:e,bottom:e,right:e,left:e}}let s=t.e(n,a.padding);a.padding=s;let o=this.transform,l=new U(e,i);return this.cameraHelper.cameraForBoxAndBearing(a,s,l,r,o)}fitBounds(e,t,i){return this._fitInternal(this.cameraForBounds(e,t),t,i)}fitScreenCoordinates(e,i,r,a,n){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(t.P.convert(e)),this.transform.screenPointToLocation(t.P.convert(i)),r,a),a,n)}_fitInternal(e,i,r){return e?(delete(i=t.e(e,i)).padding,i.linear?this.easeTo(i,r):this.flyTo(i,r)):this}jumpTo(e,i){this.stop();let r=this._getTransformForUpdate(),a=!1,n=!1,s=!1,o=r.zoom;this.cameraHelper.handleJumpToCenterZoom(r,e);let l=r.zoom!==o;return"elevation"in e&&r.elevation!==+e.elevation&&r.setElevation(+e.elevation),"bearing"in e&&r.bearing!==+e.bearing&&(a=!0,r.setBearing(+e.bearing)),"pitch"in e&&r.pitch!==+e.pitch&&(n=!0,r.setPitch(+e.pitch)),"roll"in e&&r.roll!==+e.roll&&(s=!0,r.setRoll(+e.roll)),null==e.padding||r.isPaddingEqual(e.padding)||r.setPadding(e.padding),this._applyUpdatedTransform(r),this.fire(new t.l("movestart",i)).fire(new t.l("move",i)),l&&this.fire(new t.l("zoomstart",i)).fire(new t.l("zoom",i)).fire(new t.l("zoomend",i)),a&&this.fire(new t.l("rotatestart",i)).fire(new t.l("rotate",i)).fire(new t.l("rotateend",i)),n&&this.fire(new t.l("pitchstart",i)).fire(new t.l("pitch",i)).fire(new t.l("pitchend",
53i)),s&&this.fire(new t.l("rollstart",i)).fire(new t.l("roll",i)).fire(new t.l("rollend",i)),this.fire(new t.l("moveend",i))}calculateCameraOptionsFromTo(e,i,r,a=0){let n=t.a1.fromLngLat(e,i),s=t.a1.fromLngLat(r,a),o=s.x-n.x,l=s.y-n.y,h=s.z-n.z,u=Math.hypot(o,l,h);if(0===u)throw Error("Can't calculate camera options with same From and To");let c=Math.hypot(o,l),d=t.ak(this.transform.cameraToCenterDistance/u/this.transform.tileSize),p=180*Math.atan2(o,-l)/Math.PI,f=180*Math.acos(c/u)/Math.PI;return f=h<0?90-f:90+f,{center:s.toLngLat(),elevation:a,zoom:d,pitch:f,bearing:p}}calculateCameraOptionsFromCameraLngLatAltRotation(e,t,i,r,a){let n=this.transform.calculateCenterFromCameraLngLatAlt(e,t,i,r);return{center:n.center,elevation:n.elevation,zoom:n.zoom,bearing:i,pitch:r,roll:a}}easeTo(e,i){let r,a;this._stop(!1,e.easeId),(!1===(e=t.e({offset:[0,0],duration:500,easing:t.co},e)).animate||!e.essential&&d.prefersReducedMotion)&&(e.duration=0);let n=this._getTransformForUpdate(),s=this.getBearing(),o=n.pitch,l=n.roll,h="bearing"in e?this._normalizeBearing(e.bearing,s):s,u="pitch"in e?+e.pitch:o,c="roll"in e?this._normalizeBearing(e.roll,l):l,p="padding"in e?e.padding:n.padding,f
53=t.P.convert(e.offset);e.around&&(r=t.S.convert(e.around),a=n.locationToScreenPoint(r));let m={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},_=this.cameraHelper.handleEaseTo(n,{bearing:h,pitch:u,roll:c,padding:p,around:r,aroundPoint:a,offsetAsPoint:f,offset:e.offset,zoom:e.zoom,center:e.center});return this._rotating=this._rotating||s!==h,this._pitching=this._pitching||u!==o,this._rolling=this._rolling||c!==l,this._padding=!n.isPaddingEqual(p),this._zooming=this._zooming||_.isZooming,this._easeId=e.easeId,this._prepareEase(i,e.noMoveStart,m),this.terrain&&this._prepareElevation(_.elevationCenter),this._ease(t=>{_.easeFunc(t),this.terrain&&!e.freezeElevation&&this._updateElevation(t),this._applyUpdatedTransform(n),this._fireMoveEvents(i)},t=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(i,t)},e),this}_prepareEase(e,i,r={}){this._moving=!0,i||r.moving||this.fire(new t.l("movestart",e)),this._zooming&&!r.zooming&&this.fire(new t.l("zoomstart",e)),this._rotating&&!r.rotating&&this.fire(new t.l("rotatestart",e)),this._pitching&&!r.pitching&&this.fire(new t.l("pitchstart",e)),this._rolling&&!r.rolling&&this.fire(new t.l("rollstart",e))}_prepareElevation(e){this._elevationCenter=e,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(e,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(e){this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));let i=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(e<1&&i!==this._elevationTarget){let t=this._elevationTarget-this._elevationStart;this._elevationStart+=e*(t-(i-(t*e+this._elevationStart))/(1-e)),this._elevationTarget=i}this.transform.setElevation(t.C.number(this._elevationStart,this._elevationTarget,e))}_finalizeElevation(){this._elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(e){if(!this.terrain&&e.elevation>=0&&e.pitch<=90)return{};let t=e.getCameraLngLat(),i=e.getCameraAltitude(),r=this.terrain?this.terrain.getElevationForLngLatZoom(t,e.zoom):0;if(i<r){let i=this.calculateCameraOptionsFromTo(t,r,e.center,e.elevation);return{pitch:i.pitch,zoom:i.zoom}}return{}}_applyUpdatedTransform(e){let t=[];if(t.push(e=>this._elevateCameraIfInsideTerrain(e)),this.transformCameraUpdate&&t.push(e=>this.transformCameraUpdate(e)),!t.length)return;let i=e.clone();for(let e of t){let t=i.clone(),{center:r,zoom:a,roll:n,pitch:s,bearing:o,elevation:l}=e(t);r&&t.setCenter(r),void 0!==l&&t.setElevation(l),void 0!==a&&t.setZoom(a),void 0!==n&&t.setRoll(n),void 0!==s&&t.setPitch(s),void 0!==o&&t.setBearing(o),i.apply(t)}this.transform.apply(i)}_fireMoveEvents(e){this.fire(new t.l("move",e)),this._zooming&&this.fire(new t.l("zoom",e)),this._rotating&&this.fire(new t.l("rotate",e)),this._pitching&&this.fire(new t.l("pitch",e)),this._rolling&&this.fire(new t.l("roll",e))}_afterEase(e,i){if(this._easeId&&i&&this._easeId===i)return;delete this._easeId;let r=this._zooming,a=this._rotating,n=this._pitching,s=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,r&&this.fire(new t.l("zoomend",e)),a&&this.fire(new t.l("rotateend",e)),n&&this.fire(new t.l("pitchend",e)),s&&this.fire(new t.l("rollend",e)),this.fire(new t.l("moveend",e))}flyTo(e,i){if(!e.essential&&d.prefersReducedMotion){let r=t.Q(e,["center","zoom","bearing","pitch","roll","elevation"]);return this.jumpTo(r,i)}this.stop(),e=t.e({offset:[0,0],speed:1.2,curve:1.42,easing:t.co},e);let r=this._getTransformForUpdate(),a=r.bearing,n=r.pitch,s=r.roll,o=r.padding,l="bearing"in e?this._normalizeBearing(e.bearing,a):a,h="pitch"in e?+e.pitch:n,u="roll"in e?this._normalizeBearing(e.roll,s):s,c="padding"in e?e.padding:r.padding,p=t.P.convert(e.offset),f=r.centerPoint.add(p),m=r.screenPointToLocation(f),_=this.cameraHelper.handleFlyTo(r,{bearing:l,pitch:h,roll:u,padding:c,locationAtOffset:m,offsetAsPoint:p,center:e.center,minZoom:e.minZoom,zoom:e.zoom}),g=e.curve,y=Math.max(r.width,r.height),x=y/_.scaleOfZoom,v=_.pixelPathLength;"number"==typeof _.scaleOfMinZoom&&(g=Math.sqrt(y/_.scaleOfMinZoom/v*2));let b=g*g;function w(e){let t=(x*x-y*y+(e?-1:1)*b*b*v*v)/(2*(e?x:y)*b*v);return Math.log(Math.sqrt(t*t+1)-t)}function T(e){return(Math.exp(e)-Math.exp(-e))/2}function P(e){return(Math.exp(e)+Math.exp(-e))/2}let S=w(!1),M=function(e){return P(S)/P(S+g*e)},C=function(e){var t;return y*((P(S)*(T(t=S+g*e)/P(t))-T(S))/b)/v},I=(w(!0)-S)/g;if(2e-6>Math.abs(v)||!isFinite(I)){if(1e-6>Math.abs(y-x))return this.easeTo(e,i);let t=x<y?-1:1;I=Math.abs(Math.log(x/y))/g,C=()=>0,M=e=>Math.exp(t*g*e)}return e.duration="duration"in e?+e.duration:1e3*I/("screenSpeed"in e?e.screenSpeed/g:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=a!==l,this._pitching=h!==n,this._rolling=u!==s,this._padding=!r.isPaddingEqual(c),this._prepareEase(i,!1),this.terrain&&this._prepareElevation(_.targetCenter),this._ease(d=>{let m=d*I,g=1/M(m),y=C(m);this._rotating&&r.setBearing(t.C.number(a,l,d)),this._pitching&&r.setPitch(t.C.number(n,h,d)),this._rolling&&r.setRoll(t.C.number(s,u,d)),this._padding&&(r.interpolatePadding(o,c,d),f=r.centerPoint.add(p)),_.easeFu
53nc(d,g,y,f),this.terrain&&!e.freezeElevation&&this._updateElevation(d),this._applyUpdatedTransform(r),this._fireMoveEvents(i)},()=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(i)},e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,t){var i;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){let e=this._onEaseEnd;delete this._onEaseEnd,e.call(this,t)}return e||null==(i=this.handlers)||i.stop(!1),this}_ease(e,t,i){!1===i.animate||0===i.duration?(e(1),t()):(this._easeStart=d.now(),this._easeOptions=i,this._onEaseFrame=e,this._onEaseEnd=t,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,i){let r=Math.abs((e=t.aO(e,-180,180))-i);return Math.abs(e-360-i)<r&&(e-=360),Math.abs(e+360-i)<r&&(e+=360),e}queryTerrainElevation(e){return this.terrain?this.terrain.getElevationForLngLatZoom(t.S.convert(e),this.transform.tileZoom):null}}let am={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class a_{constructor(e=am){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=e=>{e&&("metadata"===e.sourceDataType||"visibility"===e.sourceDataType||"style"===e.dataType||"terrain"===e.type)&&this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1===this._compact?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=e}getDefaultPosition(){return"bottom-right"}onAdd(e){return this._map=e,this._compact=this.options.compact,this._container=p.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=p.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=p.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){p.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(e,t){let i=this._map._getUIString(`AttributionControl.${t}`);e.title=i,e.setAttribute("aria-label",i)}_updateAttributions(){if(!this._map.style)return;let e=[];
53if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map(e=>"string"!=typeof e?"":e)):"string"==typeof this.options.customAttribution&&e.push(this.options.customAttribution)),this._map.style.stylesheet){let e=this._map.style.stylesheet;this.styleOwner=e.owner,this.styleId=e.id}let t=this._map.style.sourceCaches;for(let i in t){let r=t[i];if(r.used||r.usedForTerrain){let t=r.getSource();t.attribution&&0>e.indexOf(t.attribution)&&e.push(t.attribution)}}(e=e.filter(e=>String(e).trim())).sort((e,t)=>e.length-t.length);let i=(e=e.filter((t,i)=>{for(let r=i+1;r<e.length;r++)if(e[r].indexOf(t)>=0)return!1;return!0})).join(" | ");i!==this._attribHTML&&(this._attribHTML=i,e.length?(this._innerContainer.innerHTML=p.sanitize(i),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class ag{constructor(e={}){this._updateCompact=()=>{let e=this._container.children;if(e.length){let t=e[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1!==this._compact&&t.classList.add("maplibregl-compact"):t.classList.remove("maplibregl-compact")}},this.options=e}getDefaultPosition(){return"bottom-left"}onAdd(e){this._map=e,this._compact=this.options&&this.options.compact,this._container=p.create("div","maplibregl-ctrl");let t=p.create("a","maplibregl-ctrl-logo");return t.target="_blank",t.rel="noopener nofollow",t.href="https://maplibre.org/",t.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),t.setAttribute("rel","noopener nofollow"),this._container.appendChild(t),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){p.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class ay{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){let t=++this._id;return this._queue.push({callback:e,id:t,cancelled:!1}),t}remove(e){let t=this._currentlyRunning;for(let i of t?this._queue.concat(t):this._queue)if(i.id===e)return void(i.cancelled=!0)}run(e=0){if(this._currentlyRunning)throw Error("Attempting to run(), but is already running.");let t=this._currentlyRunning=this._queue;for(let i of(this._queue=[],t))if(!i.cancelled&&(i.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var ax=t.aJ([{name:"a_pos3d",type:"Int16",components:3}]);class av extends t.E{constructor(e){super(),this._lastTilesetChange=d.now(),this.sourceCache=e,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=e._source.tileSize*2**this.deltaZoom,e.usedForTerrain=!0,e.tileSize=this.tileSize}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(e,i){this.sourceCache.update(e,i),this._renderableTilesKeys=[];let r={};for(let a of ef(e,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:i,calculateTileZoom:this.sourceCache._source.calculateTileZoom}))r[a.key]=!0,this._renderableTilesKeys.push(a.key),this._tiles[a.key]||(a.terrainRttPosMatrix32f=new Float64Array(16),t.bY(a.terrainRttPosMatrix32f,0,t.$,t.$,0,0,1),this._tiles[a.key]=new ei(a,this.tileSize),this._lastTilesetChange=d.now());for(let e in this._tiles)r[e]||delete this._tiles[e]}freeRtt(e){for(let t in this._tiles){let i=this._tiles[t];(!e||i.tileID.equals(e)||i.tileID.isChildOf(e)||e.isChildOf(i.tileID))&&(i.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(e=>this.getTileByID(e))}getTileByID(e){return this._tiles[e]}getTerrainCoords(e,t){return t?this._getTerrainCoordsForTileRanges(e,t):this._getTerrainCoordsForRegularTile(e)}_getTerrainCoordsForRegularTile(e){let i={};for(let r of this._renderableTilesKeys){let a=this._tiles[r].tileID,n=e.clone(),s=t.ba();if(a.canonical.equals(e.canonical))t.bY(s,0,t.$,t.$,0,0,1);else if(a.canonical.isChildOf(e.canonical)){let i=a.canonical.z-e.canonical.z,r=a.canonical.x-(a.canonical.x>>i<<i),n=a.canonical.y-(a.canonical.y>>i<<i),o=t.$>>i;t.bY(s,0,o,o,0,0,1),t.M(s,s,[-r*o,-n*o,0])}else{if(!e.canonical.isChildOf(a.canonical))continue;{let i=e.canonical.z-a.canonical.z,r=e.canonical.x-(e.canonical.x>>i<<i),n=e.canonical.y-(e.canonical.y>>i<<i),o=t.$>>i;t.bY(s,0,t.$,t.$,0,0,1),t.M(s,s,[r*o,n*o,0]),t.N(s,s,[1/2**i,1/2**i,0])}}n.terrainRttPosMatrix32f=new Float32Array(s),i[r]=n}return i}_getTerrainCoordsForTileRanges(e,i){let r={};for(let a of this._renderableTilesKeys){let n=this._tiles[a].tileID;if(!this._isWithinTileRanges(n,i))continue;let s=e.clone(),o=t.ba();if(n.canonical.z===e.canonical.z){let i=e.canonical.x-n.canonical.x,r=e.canonical.y-n.canonical.y;t.bY(o,0,t.$,t.$,0,0,1),t.M(o,o,[i*t.$,r*t.$,0])}else if(n.canonical.z>e.canonical.z){let i=n.canonical.z-e.canonical.z,r=n.canonical.x-(n.canonical.x>>i<<i),a=n.canonical.y-(n.canonical.y>>i<<i),s=e.canonical.x-(n.canonical.x>>i),l=e.canonical.y-(n.canonical.y>>i),h=t.$>>i;t.bY(o,0,h,h,0,0,1),t.M(o,o,[-r*h+s*t.$,-a*h+l*t.$,0])}else{let i=e.canonical.z-n.canonical.z,r=e.canonical.x-(e.canonical.x>>i<<i),a=e.canonical.y-(e.canonical.y>>i<<i),s=(e.canonical.x>>i)-n.canonical.x,l=(e.canonical.y>>
53i)-n.canonical.y,h=t.$<<i;t.bY(o,0,h,h,0,0,1),t.M(o,o,[r*t.$+s*h,a*t.$+l*h,0])}s.terrainRttPosMatrix32f=new Float32Array(o),r[a]=s}return r}getSourceTile(e,t){let i=this.sourceCache._source,r=e.overscaledZ-this.deltaZoom;if(r>i.maxzoom&&(r=i.maxzoom),r<i.minzoom)return null;this._sourceTileCache[e.key]||(this._sourceTileCache[e.key]=e.scaledTo(r).key);let a=this.sourceCache.getTileByID(this._sourceTileCache[e.key]);if((!a||!a.dem)&&t)for(;r>=i.minzoom&&(!a||!a.dem);)a=this.sourceCache.getTileByID(e.scaledTo(r--).key);return a}anyTilesAfterTime(e=Date.now()){return this._lastTilesetChange>=e}_isWithinTileRanges(e,t){return t[e.canonical.z]&&e.canonical.x>=t[e.canonical.z].minTileX&&e.canonical.x<=t[e.canonical.z].maxTileX&&e.canonical.y>=t[e.canonical.z].minTileY&&e.canonical.y<=t[e.canonical.z].maxTileY}}class ab{constructor(e,t,i){this._meshCache={},this.painter=e,this.sourceCache=new av(t),this.options=i,this.exaggeration="number"==typeof i.exaggeration?i.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(e,i,r,a=t.$){var n;if(!(i>=0&&i<a&&r>=0&&r<a))return 0;let s=this.getTerrainData(e),o=null==(n=s.tile)?void 0:n.dem;if(!o)return 0;let l=t.cs([],[i/a*t.$,r/a*t.$],s.u_terrain_matrix),h=[l[0]*o.dim,l[1]*o.dim],u=Math.floor(h[0]),c=Math.floor(h[1]),d=h[0]-u,p=h[1]-c;return o.get(u,c)*(1-d)*(1-p)+o.get(u+1,c)*d*(1-p)+o.get(u,c+1)*(1-d)*p+o.get(u+1,c+1)*d*p}getElevationForLngLatZoom(e,i){if(!t.ct(i,e.wrap()))return 0;let{tileID:r,mercatorX:a,mercatorY:n}=this._getOverscaledTileIDFromLngLatZoom(e,i);return this.getElevation(r,a%t.$,n%t.$,t.$)}getElevation(e,i,r,a=t.$){return this.getDEMElevation(e,i,r,a)*this.exaggeration}getTerrainData(e){if(!this._emptyDemTexture){let e=this.painter.context,i=new t.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new t.T(e,i,e.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new t.T(e,new t.R({width:1,height:1}),e.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=t.ag([])}let i=this.sourceCache.getSourceTile(e,!0);if(i&&i.dem&&(!i.demTexture||i.needsTerrainPrepare)){let e=this.painter.context;i.demTexture=this.painter.getTileTexture(i.dem.stride),i.demTexture?i.demTexture.update(i.dem.getPixels(),{premultiply:!1}):i.demTexture=new t.T(e,i.dem.getPixels(),e.gl.RGBA,{premultiply:!1}),i.demTexture.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),i.needsTerrainPrepare=!1}let r=i&&i+i.tileID.key+e.key;if(r&&!this._demMatrixCache[r]){let r=this.sourceCache.sourceCache._source.maxzoom,a=e.canonical.z-i.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=r?a=e.canonical.z-r:t.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));let n=e.canonical.x-(e.canonical.x>>a<<a),s=e.canonical.y-(e.canonical.y>>a<<a),o=t.cu(new Float64Array(16),[1/(t.$<<a),1/(t.$<<a),0]);t.M(o,o,[n*t.$,s*t.$,0]),this._demMatrixCache[e.key]={matrix:o,coord:e}}return{u_depth:2,u_terrain:3,u_terrain_dim:i&&i.dem&&i.dem.dim||1,u_terrain_matrix:r?this._demMatrixCache[e.key].matrix:this._emptyDemMatrix,u_terrain_unpack:i&&i.dem&&i.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(i&&i.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:i}}getFramebuffer(e){let i=this.painter,r=i.width/devicePixelRatio,a=i.height/devicePixelRatio;return this._fbo&&(this._fbo.width!==r||this._fbo.height!==a)&&(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new t.T(i.context,{width:r,height:a,data:null},i.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(i.context.gl.NEAREST,i.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new t.T(i.context,{width:r,height:a,data:null},i.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(i.context.gl.NEAREST,i.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=i.context.createFramebuffer(r,a,!0,!1),this._fbo.depthAttachment.set(i.context.createRenderbuffer(i.context.gl.DEPTH_COMPONENT16,r,a))),this._fbo.colorAttachment.set("coords"===e?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){let e=this.painter.context;if(this._coordsTexture)return this._coordsTexture;let i=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let e=0,t=0;e<this._coordsTextureSize;e++)for(let r=0;r<this._coordsTextureSize;r++,t+=4)i[t+0]=255&r,i[t+1]=255&e,i[t+2]=r>>8<<4|e>>8,i[t+3]=0;let r=new t.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(i.buffer)),a=new t.T(e,r,e.gl.RGBA,{premultiply:!1});return a.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=a,a}
53pointCoordinate(e){this.painter.maybeDrawDepthAndCoords(!0);let i=new Uint8Array(4),r=this.painter.context,a=r.gl,n=Math.round(e.x*this.painter.pixelRatio/devicePixelRatio),s=Math.round(e.y*this.painter.pixelRatio/devicePixelRatio),o=Math.round(this.painter.height/devicePixelRatio);r.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),a.readPixels(n,o-s-1,1,1,a.RGBA,a.UNSIGNED_BYTE,i),r.bindFramebuffer.set(null);let l=i[0]+(i[2]>>4<<8),h=i[1]+((15&i[2])<<8),u=this.coordsIndex[255-i[3]],c=u&&this.sourceCache.getTileByID(u);if(!c)return null;let d=this._coordsTextureSize,p=(1<<c.tileID.canonical.z)*d;return new t.a1((c.tileID.canonical.x*d+l)/p+c.tileID.wrap,(c.tileID.canonical.y*d+h)/p,this.getElevation(c.tileID,l,h,d))}depthAtPoint(e){let t=new Uint8Array(4),i=this.painter.context,r=i.gl;return i.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),r.readPixels(e.x,this.painter.height/devicePixelRatio-e.y-1,1,1,r.RGBA,r.UNSIGNED_BYTE,t),i.bindFramebuffer.set(null),(t[0]/0x1000000+t[1]/65536+t[2]/256+t[3])/256}getTerrainMesh(e){var i;let r=(null==(i=this.painter.style.projection)?void 0:i.transitionState)>0,a=r&&0===e.canonical.y,n=r&&e.canonical.y===(1<<e.canonical.z)-1,s=`m_${a?"n":""}_${n?"s":""}`;if(this._meshCache[s])return this._meshCache[s];let o=this.painter.context,l=new t.cv,h=new t.aN,u=this.meshSize,c=t.$/u,d=u*u;for(let e=0;e<=u;e++)for(let t=0;t<=u;t++)l.emplaceBack(t*c,e*c,0);for(let e=0;e<d;e+=u+1)for(let t=0;t<u;t++)h.emplaceBack(t+e,u+t+e+1,u+t+e+2),h.emplaceBack(t+e,u+t+e+2,t+e+1);let p=l.length,f=p+(u+1),m=(u+1)*u,_=a?t.bh:0,g=+!a,y=n?t.bi:t.$,x=+!n;for(let e=0;e<=u;e++)l.emplaceBack(e*c,_,g);for(let e=0;e<=u;e++)l.emplaceBack(e*c,y,x);for(let e=0;e<u;e++)h.emplaceBack(m+e,f+e,f+e+1),h.emplaceBack(m+e,f+e+1,m+e+1),h.emplaceBack(0+e,p+e+1,p+e),h.emplaceBack(0+e,0+e+1,p+e+1);let v=l.length,b=v+2*(u+1);for(let e of[0,1])for(let i=0;i<=u;i++)for(let r of[0,1])l.emplaceBack(e*t.$,i*c,r);for(let e=0;e<2*u;e+=2)h.emplaceBack(v+e,v+e+1,v+e+3),h.emplaceBack(v+e,v+e+3,v+e+2),h.emplaceBack(b+e,b+e+3,b+e+1),h.emplaceBack(b+e,b+e+2,b+e+3);let w=new e4(o.createVertexBuffer(l,ax.members),o.createIndexBuffer(h),t.aM.simpleSegment(0,0,l.length,h.length));return this._meshCache[s]=w,w}getMeshFrameDelta(e){return 2*Math.PI*t.bu/Math.pow(2,Math.max(e,0))/5}getMinTileElevationForLngLatZoom(e,t){var i;let{tileID:r}=this._getOverscaledTileIDFromLngLatZoom(e,t);return null!=(i=this.getMinMaxElevation(r).minElevation)?i:0}getMinMaxElevation(e){let t=this.getTerrainData(e).tile,i={minElevation:null,maxElevation:null};return t&&t.dem&&(i.minElevation=t.dem.min*this.exaggeration,i.maxElevation=t.dem.max*this.exaggeration),i}_getOverscaledTileIDFromLngLatZoom(e,i){let r=t.a1.fromLngLat(e.wrap()),a=(1<<i)*t.$,n=r.x*a,s=r.y*a,o=Math.floor(n/t.$),l=Math.floor(s/t.$);return{tileID:new t.Z(i,0,i,o,l),mercatorX:n,mercatorY:s}}}class aw{constructor(e,t,i){this._context=e,this._size=t,this._tileSize=i,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(let e of this._objects)e.texture.destroy(),e.fbo.destroy()}_createObject(e){let i=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),r=new t.T(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return r.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),this._context.extTextureFilterAnisotropic&&this._context.gl.texParameterf(this._context.gl.TEXTURE_2D,this._context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this._context.extTextureFilterAnisotropicMax),i.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),i.colorAttachment.set(r.texture),{id:e,fbo:i,texture:r,stamp:-1,inUse:!1}}getObjectForId(e){return this._objects[e]}useObject(e){e.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(t=>e.id!==t),this._recentlyUsed.push(e.id)}stampObject(e){e.stamp=++this._stamp}getOrCreateFreeObject(){for(let e of this._recentlyUsed)if(!this._objects[e].inUse)return this._objects[e];if(this._objects.length>=this._size)throw Error("No free RenderPool available, call freeAllObjects() required!");let e=this._createObject(this._objects.length);return this._objects.push(e),e}freeObject(e){e.inUse=!1}freeAllObjects(){for(let e of this._objects)this.freeObject(e)}isFull(){return!(this._objects.length<this._size)&&!1===this._objects.some(e=>!e.inUse)}}let aT={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0};class aP{constructor(e,t){this.painter=e,this.terrain=t,this.pool=new aw(e.context,30,t.sourceCache.tileSize*t.qualityFactor)}destruct(){this.pool.destruct()}getTexture(e){return this.pool.getObjectForId(e.rtt[this._stacks.length-1].id).texture}
53prepareForRender(e,t){for(let i in this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=e._order.filter(i=>!e._layers[i].isHidden(t)),this._coordsAscending={},e.sourceCaches){this._coordsAscending[i]={};let t=e.sourceCaches[i].getVisibleCoordinates(),r=e.sourceCaches[i].getSource(),a=r instanceof W?r.terrainTileRanges:null;for(let e of t){let t=this.terrain.sourceCache.getTerrainCoords(e,a);for(let e in t)this._coordsAscending[i][e]||(this._coordsAscending[i][e]=[]),this._coordsAscending[i][e].push(t[e])}}for(let t of(this._coordsAscendingStr={},e._order)){let i=e._layers[t],r=i.source;if(aT[i.type]&&!this._coordsAscendingStr[r])for(let e in this._coordsAscendingStr[r]={},this._coordsAscending[r])this._coordsAscendingStr[r][e]=this._coordsAscending[r][e].map(e=>e.key).sort().join()}for(let e of this._renderableTiles)for(let t in this._coordsAscendingStr){let i=this._coordsAscendingStr[t][e.tileID.key];i&&i!==e.rttCoords[t]&&(e.rtt=[])}}renderLayer(e,i){if(e.isHidden(this.painter.transform.zoom))return!1;let r=Object.assign(Object.assign({},i),{isRenderingToTexture:!0}),a=e.type,n=this.painter,s=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(aT[a]&&(this._prevType&&aT[this._prevType]||this._stacks.push([]),this._prevType=a,this._stacks[this._stacks.length-1].push(e.id),!s))return!0;if(aT[this._prevType]||aT[a]&&s){this._prevType=a;let e=this._stacks.length-1,i=this._stacks[e]||[];for(let a of this._renderableTiles){if(this.pool.isFull()&&(rv(this.painter,this.terrain,this._rttTiles,r),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(a),a.rtt[e]){let t=this.pool.getObjectForId(a.rtt[e].id);if(t.stamp===a.rtt[e].stamp){this.pool.useObject(t);continue}}let s=this.pool.getOrCreateFreeObject();this.pool.useObject(s),this.pool.stampObject(s),a.rtt[e]={id:s.id,stamp:s.stamp},n.context.bindFramebuffer.set(s.fbo.framebuffer),n.context.clear({color:t.bf.transparent,stencil:0}),n.currentStencilSource=void 0;for(let e=0;e<i.length;e++){let t=n.style._layers[i[e]],o=t.source?this._coordsAscending[t.source][a.tileID.key]:[a.tileID];n.context.viewport.set([0,0,s.fbo.width,s.fbo.height]),n._renderTileClippingMasks(t,o,!0),n.renderLayer(n,n.style.sourceCaches[t.source],t,o,r),t.source&&(a.rttCoords[t.source]=this._coordsAscendingStr[t.source][a.tileID.key])}}return rv(this.painter,this.terrain,this._rttTiles,r),this._rttTiles=[],this.pool.freeAllObjects(),aT[a]}return!1}}let aS={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","GlobeControl.Enable":"Enable globe","GlobeControl.Disable":"Disable globe","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use â + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},aM={hash:!1,interactive:!0,bearingSnap:7,attributionControl:am,maplibreLogo:!1,refreshExpiredTiles:!0,canvasContextAttributes:{antialias:!1,preserveDrawingBuffer:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,desynchronized:!1,contextType:void 0},scrollZoom:!0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],elevation:0,zoom:0,bearing:0,pitch:0,roll:0,renderWorldCopies:!0,maxTileC
53acheSize:null,maxTileCacheZoomLevels:t.a.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0},aC={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};class aI{constructor(e,i,r=!1){this.mousedown=e=>{this.startMove(e,p.mousePos(this.element,e)),p.addEventListener(window,"mousemove",this.mousemove),p.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=e=>{this.move(e,p.mousePos(this.element,e))},this.mouseup=e=>{this._rotatePitchHandler.dragEnd(e),this.offTemp()},this.touchstart=e=>{1!==e.targetTouches.length?this.reset():(this._startPos=this._lastPos=p.touchPos(this.element,e.targetTouches)[0],this.startMove(e,this._startPos),p.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),p.addEventListener(window,"touchend",this.touchend))},this.touchmove=e=>{1!==e.targetTouches.length?this.reset():(this._lastPos=p.touchPos(this.element,e.targetTouches)[0],this.move(e,this._lastPos))},this.touchend=e=>{0===e.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()},this.reset=()=>{this._rotatePitchHandler.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10,this.element=i;const a=new rX;this._rotatePitchHandler=new rG({clickTolerance:3,move:(e,a)=>{let n=i.getBoundingClientRect(),s=new t.P((n.bottom-n.top)/2,(n.right-n.left)/2);return{bearingDelta:t.cn(new t.P(e.x,a.y),a,s),pitchDelta:r?-.5*(a.y-e.y):void 0}},moveStateManager:a,enable:!0,assignEvents:()=>{}}),this.map=e,p.addEventListener(i,"mousedown",this.mousedown),p.addEventListener(i,"touchstart",this.touchstart,{passive:!1}),p.addEventListener(i,"touchcancel",this.reset)}startMove(e,t){this._rotatePitchHandler.dragStart(e,t),p.disableDrag()}move(e,t){let i=this.map,{bearingDelta:r,pitchDelta:a}=this._rotatePitchHandler.dragMove(e,t)||{};r&&i.setBearing(i.getBearing()+r),a&&i.setPitch(i.getPitch()+a)}off(){let e=this.element;p.removeEventListener(e,"mousedown",this.mousedown),p.removeEventListener(e,"touchstart",this.touchstart,{passive:!1}),p.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),p.removeEventListener(window,"touchend",this.touchend),p.removeEventListener(e,"touchcancel",this.reset),this.offTemp()}offTemp(){p.enableDrag(),p.removeEventListener(window,"mousemove",this.mousemove),p.removeEventListener(window,"mouseup",this.mouseup),p.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),p.removeEventListener(window,"touchend",this.touchend)}}function aA(e,i,r,a=!1){if(a||!r.getCoveringTilesDetailsProvider().allowWorldCopies())return null==e?void 0:e.wrap();let n=new t.S(e.lng,e.lat);if(e=new t.S(e.lng,e.lat),i){let a=new t.S(e.lng-360,e.lat),n=new t.S(e.lng+360,e.lat),s=r.locationToScreenPoint(e).distSqr(i);r.locationToScreenPoint(a).distSqr(i)<s?e=a:r.locationToScreenPoint(n).distSqr(i)<s&&(e=n)}for(;Math.abs(e.lng-r.center.lng)>180;){let t=r.locationToScreenPoint(e);if(t.x>=0&&t.y>=0&&t.x<=r.width&&t.y<=r.height)break;e.lng>r.center.lng?e.lng-=360:e.lng+=360}return e.lng!==n.lng&&r.isPointOnMapSurface(r.locationToScreenPoint(e))?e:n}let aE={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function az(e,t,i){let r=e.classList;for(let e in aE)r.remove(`maplibregl-${i}-anchor-${e}`);r.add(`maplibregl-${i}-anchor-${t}`)}class ak extends t.E{constructor(e){if(super(),this._onKeyPress=e=>{let t=e.code,i=e.charCode||e.keyCode;"Space"!==t&&"Enter"!==t&&32!==i&&13!==i||this.togglePopup()},this._onMapClick=e=>{let t=e.originalEvent.target,i=this._element;this._popup&&(t===i||i.contains(t))&&this.togglePopup()},this._update=e=>{if(!this._map)return;let t=this._map.loaded()&&!this._map.isMoving();"terrain"!==(null==e?void 0:e.type)&&("render"!==(null==e?void 0:e.type)||t)||this._map.once("render",this._update),this._lngLat=aA(this._lngLat,this._flatPos,this._map.transform),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationToScreenPoint(this._lngLat)._add(this._offset));let i="";"viewport"===this._rotationAlignment||"auto"===this._rotationAlignment?i=`rotateZ(${this._rotation}deg)`:"map"===this._rotationAlignment&&(i=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let r="";"viewport"===this._pitchAlignment||"auto"===this._pitchAlignment?r="rotateX(0deg)":"map"===this._pitchAlignment&&(r=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||e&&"moveend"!==e.type||(this._pos=this._pos.round()),p.setTransform(this._element,`${aE[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${r} ${i}`),d.frameAsync(new AbortController).then(()=>{this._updateOpacity(e&&"moveend"===e.type)}).catch(()=>{})},this._onMove=e=>{if(!this._isDragging){let t=this._clickTolerance||this._map._clickTolerance;this._isDragging=e.point.dist(this._pointerdownPos)>=t}this._isDragging&&(this._pos=e.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new t.l("dragstart"))),this.fire(new t.l("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),"active"===this._state&&this.fire(new t.l("dragend")),this._state="inactive"},this._addDragHandler=e=>{this._element.contains(e.originalEvent.target)&&(e.preventDefault(),this._positionDelta=e.point.sub(this._pos).add(this._offset),this._pointerdownPos=e.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=e&&e.anchor||"center",this._color=e&&e.color||"#3FB1CE",this._scale=e&&e.scale||1,this._draggable=e&&e.draggable||!1,this._clickTolerance=e&&e.clickTolerance||0,this._subpixelPositioning=e&&e.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=e&&e.rotation||0,this._rotationAlignment=e&&e.rotationAlignment||"auto",this._pitchAlignment=e&&e.pitchAlignment&&"auto"!==e.pitchAlignment?e.pitchAlignment:this._rotationAlignment,this.setOpacity(null==e?void 0:e.opacity,null==e?void 0:e.opacityWhenCovered),e&&e.element)this._element=e.element,this._offset=t.P.convert(e&&e.offset||[0,0]);else{this._defaultMarker=!0,this._element=p.create("div");const i=p.createNS("http://www.w3.org/2000/svg","svg");i.setAttributeNS(null,"display","block"),i.setAttributeNS(null,"height","41px"),i.setAttributeNS(null,"width","27px"),i.setAttributeNS(null,"viewBox","0 0 27 41");const r=p.createNS("http://www.w3.org/2000/svg","g");
53r.setAttributeNS(null,"stroke","none"),r.setAttributeNS(null,"stroke-width","1"),r.setAttributeNS(null,"fill","none"),r.setAttributeNS(null,"fill-rule","evenodd");const a=p.createNS("http://www.w3.org/2000/svg","g");a.setAttributeNS(null,"fill-rule","nonzero");const n=p.createNS("http://www.w3.org/2000/svg","g");for(const e of(n.setAttributeNS(null,"transform","translate(3.0, 29.0)"),n.setAttributeNS(null,"fill","#000000"),[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}])){const t=p.createNS("http://www.w3.org/2000/svg","ellipse");t.setAttributeNS(null,"opacity","0.04"),t.setAttributeNS(null,"cx","10.5"),t.setAttributeNS(null,"cy","5.80029008"),t.setAttributeNS(null,"rx",e.rx),t.setAttributeNS(null,"ry",e.ry),n.appendChild(t)}const s=p.createNS("http://www.w3.org/2000/svg","g");s.setAttributeNS(null,"fill",this._color);const o=p.createNS("http://www.w3.org/2000/svg","path");o.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),s.appendChild(o);const l=p.createNS("http://www.w3.org/2000/svg","g");l.setAttributeNS(null,"opacity","0.25"),l.setAttributeNS(null,"fill","#000000");const h=p.createNS("http://www.w3.org/2000/svg","path");h.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),l.appendChild(h);const u=p.createNS("http://www.w3.org/2000/svg","g");u.setAttributeNS(null,"transform","translate(6.0, 7.0)"),u.setAttributeNS(null,"fill","#FFFFFF");const c=p.createNS("http://www.w3.org/2000/svg","g");c.setAttributeNS(null,"transform","translate(8.0, 8.0)");const d=p.createNS("http://www.w3.org/2000/svg","circle");d.setAttributeNS(null,"fill","#000000"),d.setAttributeNS(null,"opacity","0.25"),d.setAttributeNS(null,"cx","5.5"),d.setAttributeNS(null,"cy","5.5"),d.setAttributeNS(null,"r","5.4999962");const f=p.createNS("http://www.w3.org/2000/svg","circle");f.setAttributeNS(null,"fill","#FFFFFF"),f.setAttributeNS(null,"cx","5.5"),f.setAttributeNS(null,"cy","5.5"),f.setAttributeNS(null,"r","5.4999962"),c.appendChild(d),c.appendChild(f),a.appendChild(n),a.appendChild(s),a.appendChild(l),a.appendChild(u),a.appendChild(c),i.appendChild(a),i.setAttributeNS(null,"height",41*this._scale+"px"),i.setAttributeNS(null,"width",27*this._scale+"px"),this._element.appendChild(i),this._offset=t.P.convert(e&&e.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",e=>{e.preventDefault()}),this._element.addEventListener("mousedown",e=>{e.preventDefault()}),az(this._element,this._anchor,"marker"),e&&e.className)for(const t of e.className.split(" "))this._element.classList.add(t);this._popup=null}addTo(e){return this.remove(),this._map=e,this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label",e._getUIString("Marker.Title")),e.getCanvasContainer().appendChild(this._element),e.on("move",this._update),e.on("moveend",this._update),e.on("terrain",this._update),e.on("projectiontransition",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),p.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=t.S.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),e){if(!("offset"in e.options)){let t=Math.abs(13.5)/Math.SQRT2;e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[
530,-38.1],"bottom-left":[t,-1*(24.6+t)],"bottom-right":[-t,-1*(24.6+t)],left:[13.5,-24.6],right:[-13.5,-24.6]}:this._offset}this._popup=e,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(e){return this._subpixelPositioning=e,this}getPopup(){return this._popup}togglePopup(){let e=this._popup;return this._element.style.opacity===this._opacityWhenCovered||e&&(e.isOpen()?e.remove():(e.setLngLat(this._lngLat),e.addTo(this._map))),this}_updateOpacity(e=!1){var i,r;let a=null==(i=this._map)?void 0:i.terrain,n=this._map.transform.isLocationOccluded(this._lngLat);if(!a||n){let e=n?this._opacityWhenCovered:this._opacity;return void(this._element.style.opacity!==e&&(this._element.style.opacity=e))}if(e)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}let s=this._map,o=s.terrain.depthAtPoint(this._pos),l=s.terrain.getElevationForLngLatZoom(this._lngLat,s.transform.tileZoom);if(s.transform.lngLatToCameraDepth(this._lngLat,l)-o<.006)return void(this._element.style.opacity=this._opacity);let h=-this._offset.y/s.transform.pixelsPerMeter,u=Math.sin(s.getPitch()*Math.PI/180)*h,c=s.terrain.depthAtPoint(new t.P(this._pos.x,this._pos.y-this._offset.y)),d=s.transform.lngLatToCameraDepth(this._lngLat,l+u)-c>.006;(null==(r=this._popup)?void 0:r.isOpen())&&d&&this._popup.remove(),this._element.style.opacity=d?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(e){return this._offset=t.P.convert(e),this._update(),this}addClassName(e){this._element.classList.add(e)}removeClassName(e){this._element.classList.remove(e)}toggleClassName(e){return this._element.classList.toggle(e)}setDraggable(e){return this._draggable=!!e,this._map&&(e?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(e){return this._rotation=e||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e&&"auto"!==e?e:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(e,t){return(void 0===this._opacity||void 0===e&&void 0===t)&&(this._opacity="1",this._opacityWhenCovered="0.2"),void 0!==e&&(this._opacity=e),void 0!==t&&(this._opacityWhenCovered=t),this._map&&this._updateOpacity(!0),this}}let aD={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0},aR=0,aL=!1,aF={maxWidth:100,unit:"metric"};function aB(e,t,i){let r=i&&i.maxWidth||100,a=e._container.clientHeight/2,n=e._container.clientWidth/2,s=e.unproject([n-r/2,a]),o=e.unproject([n+r/2,a]),l=Math.min(r,Math.round(e.project(o).x-e.project(s).x),e._container.clientWidth),h=s.distanceTo(o);if(i&&"imperial"===i.unit){let i=3.2808*h;i>5280?aO(t,l,i/5280,e._getUIString("ScaleControl.Miles")):aO(t,l,i,e._getUIString("ScaleControl.Feet"))}else i&&"nautical"===i.unit?aO(t,l,h/1852,e._getUIString("ScaleControl.NauticalMiles")):h>=1e3?aO(t,l,h/1e3,e._getUIString("ScaleControl.Kilometers")):aO(t,l,h,e._getUIString("ScaleControl.Meters"))}function aO(e,t,i,r){var a;let n,s,o,l=(n=Math.pow(10,`${Math.floor(i)}`.length-1),s=i/n,n*(s=s>=10?10:s>=5?5:s>=3?3:s>=2?2:s>=1?1:(o=Math.pow(10,Math.ceil(-Math.log(a=s)/Math.LN10)),Math.round(a*o)/o)));e.style.width=l/i*t+"px",e.innerHTML=`${l} ${r}`}let aj={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0};e.AJAXError=t.cz,e.Event=t.l,e.Evented=t.E,e.LngLat=t.S,e.MercatorCoordinate=t.a1,e.Point=t.P,e.addProtocol=t.cA,e.config=t.a,e.removeProtocol=t.cB,e.AttributionControl
53=a_,e.BoxZoomHandler=rV,e.CanvasSource=X,e.CooperativeGesturesHandler=ah,e.DoubleClickZoomHandler=ar,e.DragPanHandler=as,e.DragRotateHandler=ao,e.EdgeInsets=te,e.FullscreenControl=class extends t.E{constructor(e={}){super(),this._onFullscreenChange=()=>{var e;let t=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;null==(e=null==t?void 0:t.shadowRoot)?void 0:e.fullscreenElement;)t=t.shadowRoot.fullscreenElement;t===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,e&&e.container&&(e.container instanceof HTMLElement?this._container=e.container:t.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(e){return this._map=e,this._container||(this._container=this._map.getContainer()),this._controlContainer=p.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){p.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){let e=this._fullscreenButton=p.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);p.create("span","maplibregl-ctrl-icon",e).setAttribute("aria-hidden","true"),e.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){let e=this._getTitle();this._fullscreenButton.setAttribute("aria-label",e),this._fullscreenButton.title=e}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new t.l("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new t.l("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},e.GeoJSONSource=q,e.GeolocateControl=class extends t.E{constructor(e){super(),this._onSuccess=e=>{if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new t.l("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(e),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new t.l("geolocate",e)),this._finish()}},this._updateCamera=e=>{let i=new t.S(e.coords.longitude,e.coords.latitude),r=e.coords.accuracy,a=this._map.getBearing(),n=t.e({bearing:a},this.options.fitBoundsOptions),s=U.fromLngLat(i,r);this._map.fitBounds(s,n,{geolocateSource:!0})},this._updateMarker=e=>{if(e){let i=new t.S(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(i).addTo(this._map),this._userLocationDotMarker.setLngLat(i).addTo(this._map),this._accuracy=e.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=e=>{if(this._map){if(1===e.code){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;let e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===e.code&&aL)return;this.options.trackUserLocation&&this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new t.l("error",e)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",e=>e.preventDefault()),this._geolocateButton=p.create("button","maplibregl-ctrl-geolocate",this._container),p.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=e=>{if(this._map){if(!1===e){t.w("Geolocation support is not available so the GeolocateControl will be disabled.");let e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e)}else{let e=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","fal
53se"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=p.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new ak({element:this._dotElement}),this._circleElement=p.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new ak({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",e=>{let i=(null==e?void 0:e[0])instanceof ResizeObserverEntry;e.geolocateSource||"ACTIVE_LOCK"!==this._watchState||i||this._map.isZooming()||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new t.l("trackuserlocationend")),this.fire(new t.l("userlocationlostfocus")))})}},this.options=t.e({},aD,e)}onAdd(e){return this._map=e,this._container=p.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),(function(){return t._(this,arguments,void 0,function*(e=!1){if(void 0!==l&&!e)return l;if(void 0===window.navigator.permissions)return l=!!window.navigator.geolocation;try{let e=yield window.navigator.permissions.query({name:"geolocation"});l="denied"!==e.state}catch(e){l=!!window.navigator.geolocation}return l})})().then(e=>this._finishSetupUI(e)),this._container}onRemove(){void 0!==this._geolocationWatchID&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),p.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,aR=0,aL=!1}_isOutOfMapMaxBounds(e){let t=this._map.getMaxBounds(),i=e.coords;return t&&(i.longitude<t.getWest()||i.longitude>t.getEast()||i.latitude<t.getSouth()||i.latitude>t.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){let e=this._map.getBounds(),t=e.getSouthEast(),i=e.getNorthEast(),r=t.distanceTo(i),a=Math.ceil(this._accuracy/(r/this._map._container.clientHeight)*2);this._circleElement.style.width=`${a}px`,this._circleElement.style.height=`${a}px`}trigger(){if(!this._setup)return t.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new t.l("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":aR--,aL=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new t.l("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new t.l("trackuserlocationstart")),this.fire(new t.l("userlocationfocus"));break;default:throw Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw Error(`Unexpected watchState ${this._watchState}`)}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let e;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),++aR>1?(e={maximumAge:6e5,timeout:0},aL=!0):(e=this.options.positionOptions,aL=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,e)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","fal
53se"),this.options.showUserLocation&&this._updateMarker(null)}},e.GlobeControl=class{constructor(){this._toggleProjection=()=>{var e;let t=null==(e=this._map.getProjection())?void 0:e.type;this._map.setProjection("mercator"!==t&&t?{type:"mercator"}:{type:"globe"}),this._updateGlobeIcon()},this._updateGlobeIcon=()=>{var e;this._globeButton.classList.remove("maplibregl-ctrl-globe"),this._globeButton.classList.remove("maplibregl-ctrl-globe-enabled"),"globe"===(null==(e=this._map.getProjection())?void 0:e.type)?(this._globeButton.classList.add("maplibregl-ctrl-globe-enabled"),this._globeButton.title=this._map._getUIString("GlobeControl.Disable")):(this._globeButton.classList.add("maplibregl-ctrl-globe"),this._globeButton.title=this._map._getUIString("GlobeControl.Enable"))}}onAdd(e){return this._map=e,this._container=p.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=p.create("button","maplibregl-ctrl-globe",this._container),p.create("span","maplibregl-ctrl-icon",this._globeButton).setAttribute("aria-hidden","true"),this._globeButton.type="button",this._globeButton.addEventListener("click",this._toggleProjection),this._updateGlobeIcon(),this._map.on("styledata",this._updateGlobeIcon),this._container}onRemove(){p.remove(this._container),this._map.off("styledata",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},e.Hash=rP,e.ImageSource=W,e.KeyboardHandler=r7,e.LngLatBounds=U,e.LogoControl=ag,e.Map=class extends af{constructor(e){var i,r;t.cw.mark(t.cx.create);const a=Object.assign(Object.assign(Object.assign({},aM),e),{canvasContextAttributes:Object.assign(Object.assign({},aM.canvasContextAttributes),e.canvasContextAttributes)});if(null!=a.minZoom&&null!=a.maxZoom&&a.minZoom>a.maxZoom)throw Error("maxZoom must be greater than or equal to minZoom");if(null!=a.minPitch&&null!=a.maxPitch&&a.minPitch>a.maxPitch)throw Error("maxPitch must be greater than or equal to minPitch");if(null!=a.minPitch&&a.minPitch<0)throw Error("minPitch must be greater than or equal to 0");if(null!=a.maxPitch&&a.maxPitch>180)throw Error("maxPitch must be less than or equal to 180");const n=new to,s=new tc;if(void 0!==a.minZoom&&n.setMinZoom(a.minZoom),void 0!==a.maxZoom&&n.setMaxZoom(a.maxZoom),void 0!==a.minPitch&&n.setMinPitch(a.minPitch),void 0!==a.maxPitch&&n.setMaxPitch(a.maxPitch),void 0!==a.renderWorldCopies&&n.setRenderWorldCopies(a.renderWorldCopies),super(n,s,{bearingSnap:a.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new ay,this._controls=[],this._mapId=t.a7(),this._contextLost=e=>{e.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new t.l("webglcontextlost",{originalEvent:e}))},this._contextRestored=e=>{this._setupPainter(),this.resize(),this._update(),this.fire(new t.l("webglcontextrestored",{originalEvent:e}))},this._onMapScroll=e=>{if(e.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=a.interactive,this._maxTileCacheSize=a.maxTileCacheSize,this._maxTileCacheZoomLevels=a.maxTileCacheZoomLevels,this._canvasContextAttributes=Object.assign({},a.canvasContextAttributes),this._trackResize=!0===a.trackResize,this._bearingSnap=a.bearingSnap,this._centerClampedToGround=a.centerClampedToGround,this._refreshExpiredTiles=!0===a.refreshExpiredTiles,this._fadeDuration=a.fadeDuration,this._crossSourceCollisions=!0===a.crossSourceCollisions,this._collectResourceTiming=!0===a.collectResourceTiming,this._locale=Object.assign(Object.assign({},aS),a.locale),this._clickTolerance=a.clickTolerance,this._overridePixelRatio=a.pixelRatio,this._maxCanvasSize=a.maxCanvasSize,this.transformCameraUpdate=a.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=!0===a.cancelPendingTileRequestsWhileZooming,this._imageQueueHandle=h.addThrottleControl(()=>this.isMoving()),this._requestManager=new v(a.transformRequest),"string"==typeof a.container){if(this._container=document.getElementById(a.container),!this._container)throw Error(`Container '${a.container}' not found.`)}else{if(!(a.container instanceof HTMLElement))throw Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=a.container}if(a.maxBounds&&this.setMaxBounds(a.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),this.once("idle",()=>{this._idleTriggered=!0}),"u">typeof window){addEventListener("online",this._onWindowOnline,!1);let e=!1;const t=rT(e=>{this._trackResize&&!this._removed&&(this.resize(e),this.redraw())},50);this._resizeObserver=new ResizeObserver(i=>{e?t(i):e=!0}),this._resizeObserver.observe(this._container)}this.handlers=new ap(this,a),this._hash=a.hash&&new rP("string"==typeof a.hash&&a.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:a.center,elevation:a.elevation,zoom:a.zoom,bearing:a.bearing,pitch:a.pitch,roll:a.roll}),a.bounds&&(this.resize(),this.fitBounds(a.bounds,t.e({},a.fitBoundsOptions,{duration:0}))));const o="string"==typeof a.style||"globe"!==(null==(r=null==(i=a.style)?void 0:i.projection)?void 0:r.type);this.resize(null,o),this._localIdeographFontFamily=a.localIdeographFontFamily,this._val
53idateStyle=a.validateStyle,a.style&&this.setStyle(a.style,{localIdeographFontFamily:a.localIdeographFontFamily}),a.attributionControl&&this.addControl(new a_("boolean"==typeof a.attributionControl?void 0:a.attributionControl)),a.maplibreLogo&&this.addControl(new ag,a.logoPosition),this.on("style.load",()=>{if(o||this._resizeTransform(),this.transform.unmodified){let e=t.Q(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(e)}}),this.on("data",e=>{this._update("style"===e.dataType),this.fire(new t.l(`${e.dataType}data`,e))}),this.on("dataloading",e=>{this.fire(new t.l(`${e.dataType}dataloading`,e))}),this.on("dataabort",e=>{this.fire(new t.l("sourcedataabort",e))})}_getMapId(){return this._mapId}setGlobalStateProperty(e,t){return this.style.setGlobalStateProperty(e,t),this._update(!0)}getGlobalState(){return this.style.getGlobalState()}addControl(e,i){if(void 0===i&&(i=e.getDefaultPosition?e.getDefaultPosition():"top-right"),!e||!e.onAdd)return this.fire(new t.k(Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));let r=e.onAdd(this);this._controls.push(e);let a=this._controlPositions[i];return -1!==i.indexOf("bottom")?a.insertBefore(r,a.firstChild):a.appendChild(r),this}removeControl(e){if(!e||!e.onRemove)return this.fire(new t.k(Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let i=this._controls.indexOf(e);return i>-1&&this._controls.splice(i,1),e.onRemove(this),this}hasControl(e){return this._controls.indexOf(e)>-1}calculateCameraOptionsFromTo(e,t,i,r){return null==r&&this.terrain&&(r=this.terrain.getElevationForLngLatZoom(i,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(e,t,i,r)}resize(e,i=!0){let[r,a]=this._containerDimensions(),n=this._getClampedPixelRatio(r,a);if(this._resizeCanvas(r,a,n),this.painter.resize(r,a,n),this.painter.overLimit()){let e=this.painter.context.gl;this._maxCanvasSize=[e.drawingBufferWidth,e.drawingBufferHeight];let t=this._getClampedPixelRatio(r,a);this._resizeCanvas(r,a,t),this.painter.resize(r,a,t)}this._resizeTransform(i);let s=!this._moving;return s&&(this.stop(),this.fire(new t.l("movestart",e)).fire(new t.l("move",e))),this.fire(new t.l("resize",e)),s&&this.fire(new t.l("moveend",e)),this}_resizeTransform(e=!0){var t;let[i,r]=this._containerDimensions();this.transform.resize(i,r,e),null==(t=this._requestedCameraState)||t.resize(i,r,e)}_getClampedPixelRatio(e,t){let{0:i,1:r}=this._maxCanvasSize,a=this.getPixelRatio(),n=e*a,s=t*a;return Math.min(n>i?i/n:1,s>r?r/s:1)*a}getPixelRatio(){var e;return null!=(e=this._overridePixelRatio)?e:devicePixelRatio}setPixelRatio(e){this._overridePixelRatio=e,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(e){return this.transform.setMaxBounds(U.convert(e)),this._update()}setMinZoom(e){if((e=null==e?-2:e)>=-2&&e<=this.transform.maxZoom)return this.transform.setMinZoom(e),this._update(),this.getZoom()<e&&this.setZoom(e),this;throw Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(e){if((e=null==e?22:e)>=this.transform.minZoom)return this.transform.setMaxZoom(e),this._update(),this.getZoom()>e&&this.setZoom(e),this;throw Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(e){if((e=null==e?0:e)<0)throw Error("minPitch must be greater than or equal to 0");if(e>=0&&e<=this.transform.maxPitch)return this.transform.setMinPitch(e),this._update(),this.getPitch()<e&&this.setPitch(e),this;throw Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(e){if((e=null==e?60:e)>180)throw Error("maxPitch must be less than or equal to 180");if(e>=this.transform.minPitch)return this.transform.setMaxPitch(e),this._update(),this.getPitch()>e&&this.setPitch(e),this;throw Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(e){return this.transform.setRenderWorldCopies(e),this._update()}project(e){return this.transform.locationToScreenPoint(t.S.convert(e),this.style&&this.terrain)}unproject(e){return this.transform.screenPointToLocation(t.P.convert(e),this.terrain)}isMoving(){var e;return this._moving||(null==(e=this.handlers)?void 0:e.isMoving())}isZooming(){var e;return this._zooming||(null==(e=this.handlers)?void 0:e.isZooming())}isRotating(){var e;return this._rotating||(null==(e=this.handlers)?void 0:e.isRotating())}
53_createDelegatedListener(e,t,i){if("mouseenter"===e||"mouseover"===e){let r=!1,a=a=>{let n=t.filter(e=>this.getLayer(e)),s=0!==n.length?this.queryRenderedFeatures(a.point,{layers:n}):[];s.length?r||(r=!0,i.call(this,new rR(e,this,a.originalEvent,{features:s}))):r=!1};return{layers:t,listener:i,delegates:{mousemove:a,mouseout:()=>{r=!1}}}}if("mouseleave"===e||"mouseout"===e){let r=!1,a=a=>{let n=t.filter(e=>this.getLayer(e));(0!==n.length?this.queryRenderedFeatures(a.point,{layers:n}):[]).length?r=!0:r&&(r=!1,i.call(this,new rR(e,this,a.originalEvent)))},n=t=>{r&&(r=!1,i.call(this,new rR(e,this,t.originalEvent)))};return{layers:t,listener:i,delegates:{mousemove:a,mouseout:n}}}{let r=e=>{let r=t.filter(e=>this.getLayer(e)),a=0!==r.length?this.queryRenderedFeatures(e.point,{layers:r}):[];a.length&&(e.features=a,i.call(this,e),delete e.features)};return{layers:t,listener:i,delegates:{[e]:r}}}}_saveDelegatedListener(e,t){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[e]=this._delegatedListeners[e]||[],this._delegatedListeners[e].push(t)}_removeDelegatedListener(e,t,i){if(!this._delegatedListeners||!this._delegatedListeners[e])return;let r=this._delegatedListeners[e];for(let e=0;e<r.length;e++){let a=r[e];if(a.listener===i&&a.layers.length===t.length&&a.layers.every(e=>t.includes(e))){for(let e in a.delegates)this.off(e,a.delegates[e]);return void r.splice(e,1)}}}on(e,t,i){if(void 0===i)return super.on(e,t);let r="string"==typeof t?[t]:t,a=this._createDelegatedListener(e,r,i);for(let t in this._saveDelegatedListener(e,a),a.delegates)this.on(t,a.delegates[t]);return{unsubscribe:()=>{this._removeDelegatedListener(e,r,i)}}}once(e,t,i){if(void 0===i)return super.once(e,t);let r="string"==typeof t?[t]:t,a=this._createDelegatedListener(e,r,i);for(let t in a.delegates){let n=a.delegates[t];a.delegates[t]=(...t)=>{this._removeDelegatedListener(e,r,i),n(...t)}}for(let t in this._saveDelegatedListener(e,a),a.delegates)this.once(t,a.delegates[t]);return this}off(e,t,i){return void 0===i?super.off(e,t):(this._removeDelegatedListener(e,"string"==typeof t?[t]:t,i),this)}queryRenderedFeatures(e,i){let r;if(!this.style)return[];let a=e instanceof t.P||Array.isArray(e),n=a?e:[[0,0],[this.transform.width,this.transform.height]];if(i=i||(a?{}:e)||{},n instanceof t.P||"number"==typeof n[0])r=[t.P.convert(n)];else{let e=t.P.convert(n[0]),i=t.P.convert(n[1]);r=[e,new t.P(i.x,e.y),i,new t.P(e.x,i.y),e]}return this.style.queryRenderedFeatures(r,i,this.transform)}querySourceFeatures(e,t){return this.style.querySourceFeatures(e,t)}setStyle(e,i){return!1!==(i=t.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._val
53idateStyle},i)).diff&&i.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&e?(this._diffStyle(e,i),this):(this._localIdeographFontFamily=i.localIdeographFontFamily,this._updateStyle(e,i))}setTransformRequest(e){return this._requestManager.setTransformRequest(e),this}_getUIString(e){let t=this._locale[e];if(null==t)throw Error(`Missing UI string '${e}'`);return t}_updateStyle(e,t){var i,r;if(t.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(e,t));let a=this.style&&t.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!e)),e?(this.style=new tW(this,t||{}),this.style.setEventedParent(this,{style:this.style}),"string"==typeof e?this.style.loadURL(e,t,a):this.style.loadJSON(e,t,a)):(null==(r=null==(i=this.style)?void 0:i.projection)||r.destroy(),delete this.style),this}_lazyInitEmptyStyle(){this.style||(this.style=new tW(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(e,i){if("string"==typeof e){let r=this._requestManager.transformRequest(e,"Style");t.j(r,new AbortController).then(e=>{this._updateDiff(e.data,i)}).catch(e=>{e&&this.fire(new t.k(e))})}else"object"==typeof e&&this._updateDiff(e,i)}_updateDiff(e,i){try{this.style.setState(e,i)&&this._update(!0)}catch(r){t.w(`Unable to perform style diff: ${r.message||r.error||r}. Rebuilding the style from scratch.`),this._updateStyle(e,i)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():t.w("There is no style added to the map.")}addSource(e,t){return this._lazyInitEmptyStyle(),this.style.addSource(e,t),this._update(!0)}isSourceLoaded(e){let i=this.style&&this.style.sourceCaches[e];if(void 0!==i)return i.loaded();this.fire(new t.k(Error(`There is no source with ID '${e}'`)))}setTerrain(e){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),e){let i=this.style.sourceCaches[e.source];if(!i)throw Error(`cannot load terrain, because there exists no source with ID: ${e.source}`);for(let r in null===this.terrain&&i.reload(),this.style._layers){let i=this.style._layers[r];"hillshade"===i.type&&i.source===e.source&&t.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality."),"color-relief"===i.type&&i.source===e.source&&t.w("You are using the same source for a color-relief layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new ab(this.painter,i,e),this.painter.renderToTexture=new aP(this.painter,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._terrainDataCallback=t=>{var i;"style"===t.dataType?this.terrain.sourceCache.freeRtt():"source"===t.dataType&&t.tile&&(t.sourceId!==e.source||this._elevationFreeze||(this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))),"image"===(null==(i=t.source)?void 0:i.type)?this.terrain.sourceCache.freeRtt():this.terrain.sourceCache.freeRtt(t.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0);return this.fire(new t.l("terrain",{terrain:e})),this}getTerrain(){var e,t;return null!=(t=null==(e=this.terrain)?void 0:e.options)?t:null}areTilesLoaded(){let e=this.style&&this.style.sourceCaches;for(let t in e){let i=e[t]._tiles;for(let e in i){let t=i[e];if("loaded"!==t.state&&"errored"!==t.state)return!1}}return!0}removeSource(e){return this.style.removeSource(e),this._update(!0)}getSource(e){return this.style.getSource(e)}setSourceTileLodParams(e,t,i){if(i){let r=this.getSource(i);if(!r)throw Error(`There is no source with ID "${i}", cannot set LOD parameters`);r.calculateTileZoom=ec(Math.max(1,e),Math.max(1,t))}else for(let i in this.style.sourceCaches)this.style.sourceCaches[i].getSource().calculateTileZoom=ec(Math.max(1,e),Math.max(1,t));return this._update(!0),this}refreshTiles(e,i){let r=this.style.sourceCaches[e];if(!r)throw Error(`There is no source cache with ID "${e}", cannot refresh tile`);void 0===i?r.reload(!0):r.refreshTiles(i.map(e=>new t.a4(e.z,e.x,e.y)))}addImage(e,i,r={}){let{pixelRatio:a=1,sdf:n=!1,stretchX:s,stretchY:o,content:l,textFitWidth:h,textFitHeight:u}=r;if(this._lazyInitEmptyStyle(),!(i instanceof HTMLImageElement||t.b(i))){if(void 0===i.width||void 0===i.height)return this.fire(new t.k(Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{let{width:r,height:c,data:d}=i;return this.style.addImage(e,{data:new t.R({width:r,height:c},new Uint8Array(d)),pixelRatio:a,stretchX:s,stretchY:o,content:l,textFitWidth:h,textFitHeight:u,sdf:n,version:0,userImage:i}),i.onAdd&&i.onAdd(this,e),this}}{let{width:r,height:c,data:p}=d.getImageData(i);this.style.addImage(e,{data:new t.R({width:r,height:c},p),pixelRatio:a,stretchX:s,stretchY:o,content:l,textFitWidth:h,textFitHeight:u,sdf:n,version:0})}}updateImage(e,i){let r=this.style.getImage(e);if(!r)return this.fire(new t.k(Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let{width:a,height:n,data:s}=i instanceof HTMLImageElement||t.b(i)?d.getImageData(i):i;if(void 0===a||void 0===n)return this.fire(new t.k(Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(a!==r.data.width||n!==r.data.height)return this.fire(new t.k(Error("The width and height of the updated image must be that same as the previous version of the image")));let o=!(i instanceof HTMLImageElement||t.b(i));return r.data.replace(s,o),this.style.updateImage(e,r),this}getImage(e){return this.style.getImage(e)}hasImage(e){return e?!!this.style.getImage(e):(this.fire(new t.k(Error("Missing required image id"))),!1)}removeImage(e){this.style.removeImage(e)}loadImage(e){return h.getImage(this._requestManager.transformRequest(e,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(e,t){return this._lazyInitEmptyStyle(),this.style.addLayer(e,t),this._update(!0)}moveLayer(e,t){return this.style.moveLayer(e,t),this._update(!0)}removeLayer(e){return this.style.removeLayer(e),this._update(!0)}getLayer(e){return this.style.getLayer(e)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(e,t,i){return this.style.setLayerZoomRange(e,t,i),this._update(!0)}setFilter(e,t,i={}){return this.style.setFilter(e,t,i),this._update(!0)}getFilter(e){return this.style.getFilter(e)}setPaintProperty(e,t,i,r={}){return this.style.setPaintProperty(e,t,i,r),this._update(!0)}getPaintProperty(e,t){return this.style.getPaintProperty(e,t)}setLayoutProperty(e,t,i,r={}){return this.style.setLayoutProperty(e,t,i,r),this._update(!0)}getLayoutProperty(e,t){return this.style.getLayoutProperty(e,t)}setGlyphs(e,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(e,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(e,t,i={}){return this._lazyInitEmptyStyle(),this.style.addSprite(e,t,i,e=>{e||this._update(!0)}),this}removeSprite(e){return this._lazyInitEmptyStyle(),this.style.removeSprite(e),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(e,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(e,t,e=>{e||this._update(!0)}),this}setLight(e,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(e,t),this._update(!0)}getLight(){return this.style.getLight()}setSky(e,t={}){return this._lazyInitEmptyStyle(),this.style.setSky(e,t),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(e,t){return this.style.setFeatureState(e,t),this._update()}removeFeatureState(e,t){return this.style.removeFeatureState(e,t),this._update()}getFeatureState(e){return this.style.getFeatureState(e)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let e=0,t=0;return this._container&&(e=this._container.clientWidth||400,t=this._container.clientHeight||300),[e,t]}_setupContainer(){let e=this._container;e.classList.add("maplibregl-map");let t=this._canvasContainer=p.create("div","maplibregl-canvas-container",e);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=p.create("canvas","maplibregl-canvas",t),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","regi
53on");let i=this._containerDimensions(),r=this._getClampedPixelRatio(i[0],i[1]);this._resizeCanvas(i[0],i[1],r);let a=this._controlContainer=p.create("div","maplibregl-control-container",e),n=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(e=>{n[e]=p.create("div",`maplibregl-ctrl-${e} `,a)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(e,t,i){this._canvas.width=Math.floor(i*e),this._canvas.height=Math.floor(i*t),this._canvas.style.width=`${e}px`,this._canvas.style.height=`${t}px`}_setupPainter(){let e=Object.assign(Object.assign({},this._canvasContextAttributes),{alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0}),t=null;this._canvas.addEventListener("webglcontextcreationerror",i=>{t={requestedAttributes:e},i&&(t.statusMessage=i.statusMessage,t.type=i.type)},{once:!0});let i=null;if(!(i=this._canvasContextAttributes.contextType?this._canvas.getContext(this._canvasContextAttributes.contextType,e):this._canvas.getContext("webgl2",e)||this._canvas.getContext("webgl",e))){let e="Failed to initialize WebGL";throw t?(t.message=e,Error(JSON.stringify(t))):Error(e)}this.painter=new rw(i,this.transform),f.testSupport(i)}migrateProjection(e,i){super.migrateProjection(e,i),this.painter.transform=e,this.fire(new t.l("projectiontransition",{newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(e){return this.style&&this.style._loaded&&(this._styleDirty=this._styleDirty||e,this._sourcesDirty=!0,this.triggerRepaint()),this}_requestRenderFrame(e){return this._update(),this._renderTaskQueue.add(e)}_cancelRenderFrame(e){this._renderTaskQueue.remove(e)}_render(e){var i,r,a,n,s;let o=this._idleTriggered?this._fadeDuration:0,l=(null==(i=this.style.projection)?void 0:i.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(e),this._removed)return;let h=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let e=this.transform.zoom,i=d.now();this.style.zoomHistory.update(e,i);let r=new t.F(e,{now:i,fadeDuration:o,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition(),globalState:this.style.getGlobalState()}),a=r.crossFadingFactor();1===a&&a===this._crossFadingFactor||(h=!0,this._crossFadingFactor=a),this.style.update(r)}let u=(null==(r=this.style.projection)?void 0:r.transitionState)>0!==l;null==(a=this.style.projection)||a.setErrorQueryLatitudeDegrees(this.transform.center.lat),this.transform.setTransitionState(null==(n=this.style.projection)?void 0:n.transitionState,null==(s=this.style.projection)?void 0:s.latitudeErrorCorrectionRadians),this.style&&(this._sourcesDirty||u)&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),!this._elevationFreeze&&this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0)),this._placementDirty=this.style&&this.style._updatePlacement(this.transform,this.showCollisionBoxes,o,this._crossSourceCollisions,u),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:o,showPadding:this.showPadding}),this.fire(new t.l("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,t.cw.mark(t.cx.load),this.fire(new t.l("load"))),this.style&&(this.style.hasTransitions()||h)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();let c=this._sourcesDirty||this._styleDirty||this._placementDirty;return c||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new t.l("idle")),!this._loaded||this._fullyLoaded||c||(this._fullyLoaded=!0,t.cw.mark(t.cx.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var e;
53for(let e of(this._hash&&this._hash.remove(),this._controls))e.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),"u">typeof window&&removeEventListener("online",this._onWindowOnline,!1),h.removeThrottleControl(this._imageQueueHandle),null==(e=this._resizeObserver)||e.disconnect();let i=this.painter.context.gl.getExtension("WEBGL_lose_context");(null==i?void 0:i.loseContext)&&i.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),p.remove(this._canvasContainer),p.remove(this._controlContainer),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),t.cw.clearMetrics(),this._removed=!0,this.fire(new t.l("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,d.frame(this._frameRequest,e=>{t.cw.frame(e),this._frameRequest=null;try{this._render(e)}catch(e){if(!t.cy(e)&&e.message!==i6)throw e}},()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(e){this._showTileBoundaries!==e&&(this._showTileBoundaries=e,this._update())}get showPadding(){return!!this._showPadding}set showPadding(e){this._showPadding!==e&&(this._showPadding=e,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(e){this._showCollisionBoxes!==e&&(this._showCollisionBoxes=e,e?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(e){this._showOverdrawInspector!==e&&(this._showOverdrawInspector=e,this._update())}get repaint(){return!!this._repaint}set repaint(e){this._repaint!==e&&(this._repaint=e,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(e){this._vertices=e,this._update()}get version(){return u}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(e){return this._lazyInitEmptyStyle(),this.style.setProjection(e),this._update(!0)}},e.MapMouseEvent=rR,e.MapTouchEvent=rL,e.MapWheelEvent=rF,e.Marker=ak,e.NavigationControl=class{constructor(e){this._updateZoomButtons=()=>{let e=this._map.getZoom(),t=e===this._map.getMaxZoom(),i=e===this._map.getMinZoom();this._zoomInButton.disabled=t,this._zoomOutButton.disabled=i,this._zoomInButton.setAttribute("aria-disabled",t.toString()),this._zoomOutButton.setAttribute("aria-disabled",i.toString())},this._rotateCompassArrow=()=>{this._compassIcon.style.transform=this.options.visualizePitch&&this.options.visualizeRoll?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateZ(${-this._map.transform.roll}deg) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizeRoll?`rotate(${-this._map.transform.bearing-this._map.transform.roll}deg)`:`rotate(${-this._map.transform.bearing}deg)`},this._setButtonTitle=(e,t)=>{let i=this._map._getUIString(`NavigationControl.${t}`);e.title=i,e.setAttribute("aria-label",i)},this.options=t.e({},aC,e),this._container=p.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",e=>e.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",e=>this._map.zoomIn({},{originalEvent:e})),p.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",e=>this._map.zoomOut({},{originalEvent:e})),p.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",e=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:e}):this._map.resetNorth({},{originalEvent:e})}),this._compassIcon=p.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(e){return this._map=e,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.on("roll",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new aI(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){p.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.off("roll",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(e,t){let i=p.create("button",e,this._container);return i.type="button",i.addEventListener("click",t),i}},e.Popup=class extends t.E{constructor(e){super(),this._updateOpacity=()=>{void 0!==this.options.locationOccludedOpacity&&(this._container.style.opacity=this._map.transform.isLocationOccluded(this.getLngLat())?`${this.options.locationOccludedOpacity}`:"")},this.remove=()=>(this._content&&p.remove(this._content),this._container&&(p.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new t.l("close"))),this),this._onMouseUp=e=>{this._update(e.point)},this._onMouseMove=e=>{this._update(e.point)},this._onDrag=e=>{this._update(e.point)},this._update=e=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=p.create("div","maplibregl-popup",this._map.getContainer()),this._tip=p.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(let e of this.options.className.split(" "))this._container.classList.add(e);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=aA(this._lngLat,this._flatPos,this._map.transform,this._trackPointer),this._trackPointer&&!e)return;let i=this._flatPos=this._pos=this._trackPointer&&e?e:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&e?e:this._map.transform.locationToScreenPoint(this._lngLat));let r=this.options.anchor,a=function e(i){if(i){if("number"==typeof i){let e=Math.round(Math.abs(i)/Math.SQRT2);return{center:new t.P(0,0),top:new t.P(0,i),"top-left":new t.P(e,e),"top-right":new t.P(-e,e),bottom:new t.P(0,-i),"bottom-left":new t.P(e,-e),"bottom-right":new t.P(-e,-e),left:new t.P(i,0),right:new t.P(-i,0)}}if(i instanceof t.P||Array.isArray(i)){let e=t.P.convert(i);return{center:e,top:e,"top-left":e,"top-right":e,bottom:e,"bottom-left":e,"bottom-right":e,left:e,right:e}}return{center:t.P.convert(i.center||[0,0]),top:t.P.convert(i.top||[0,0]),"top-left":t.P.convert(i["top-left"]||[0,0]),"top-right":t.P.convert(i["top-right"]||[0,0]),bottom:t.P.convert(i.bottom||[0,0]),"bottom-left":t.P.convert(i["bottom-left"]||[0,0]),"bottom-right":t.P.convert(i["bottom-right"]||[0,0]),left:t.P.convert(i.left||[0,0]),right:t.P.convert(i.right||[0,0])}}return e(new t.P(0,0))}(this.options.offset);if(!r){let e,t=this._container.offsetWidth,n=this._container.offsetHeight;e=i.y+a.bottom.y<n?["top"]:i.y>this._map.transform.height-n?["bottom"]:[],i.x<t/2?e.push("left"):i.x>this._map.transform.width-t/2&&e.push("right"),r=0===e.length?"bottom":e.join("-")}let n=i.add(a[r]);this.options.subpixelPositioning||(n=n.round()),p.setTransform(this._container,`${aE[r]} translate(${n.x}px,${n.y}px)`),az(this._container,r,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=t.e(Object.create(aj),e)}addTo(e){return this._map&&this.remove(),this._map=e,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new t.l("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=t.S.convert(e),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(e){return this.setDOMContent(document.createTextNode(e))}setHTML(e){let t,i=document.createDocumentFragment(),r=document.createElement("body");for(r.innerHTML=e;t=r.firstChild;)i.appendChild(t);return this.setDOMContent(i)}getMaxWidth(){var e;return null==(e=this._container)?void 0:e.style.maxWidth}setMaxWidth(e){return this.options.maxWidth=e,this._update(),this}setDOMContent(e){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=p.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(e),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(e){return this._container&&this._container.classList.add(e),this}removeClassName(e){return this._container&&this._container.classList.remove(e),this}setOffset(e){return this.options.offset=e,this._update(),this}toggleClassName(e){if(this._container)return this._container.classList.toggle(e)}setSubpixelPositioning(e){this.options.subpixelPositioning=e}_createCloseButton(){this.options.closeButton&&(this._closeButton=p.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;
53let e=this._container.querySelector("a[href], [tabindex]:not([tabindex='-1']), [contenteditable]:not([contenteditable='false']), button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])");e&&e.focus()}},e.RasterDEMTileSource=G,e.RasterTileSource=Z,e.ScaleControl=class{constructor(e){this._onMove=()=>{aB(this._map,this._container,this.options)},this.setUnit=e=>{this.options.unit=e,aB(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},aF),e)}getDefaultPosition(){return"bottom-left"}onAdd(e){return this._map=e,this._container=p.create("div","maplibregl-ctrl maplibregl-ctrl-scale",e.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){p.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},e.ScrollZoomHandler=ai,e.Style=tW,e.TerrainControl=class{constructor(e){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=e}onAdd(e){return this._map=e,this._container=p.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=p.create("button","maplibregl-ctrl-terrain",this._container),p.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){p.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},e.TwoFingersTouchPitchHandler=r4,e.TwoFingersTouchRotateHandler=r3,e.TwoFingersTouchZoomHandler=r1,e.TwoFingersTouchZoomRotateHandler=al,e.VectorTileSource=$,e.VideoSource=H,e.addSourceType=(e,i)=>t._(void 0,void 0,void 0,function*(){if(K(e))throw Error(`A source type called "${e}" already exists.`);Y[e]=i}),e.clearPrewarmedResources=function(){let e=n;e&&(e.isPreloaded()&&1===e.numActive()?(e.release(k),n=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},e.createTileMesh=tv,e.getMaxParallelImageRequests=function(){return t.a.MAX_PARALLEL_IMAGE_REQUESTS},e.getRTLTextPluginStatus=function(){return et().getRTLTextPluginStatus()},e.getVersion=function(){return u},e.getWorkerCount=function(){return D.workerCount},e.getWorkerUrl=function(){return t.a.WORKER_URL},e.importScriptInWorkers=function(e){return B().broadcast("IS",e)},e.prewarm=function(){L().acquire(k)},e.setMaxParallelImageRequests=function(e){t.a.MAX_PARALLEL_IMAGE_REQUESTS=e},e.setRTLTextPlugin=function(e,t){return et().setRTLTextPlugin(e,t)},e.setWorkerCount=function(e){D.workerCount=e},e.setWorkerUrl=function(e){t.a.WORKER_URL=e}}),e}()}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.