1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5288],{3582:(e,t,i)=>{i.r(t),i.d(t,{a:()=>o,m:()=>l});var r,a=i(4841),n={exports:{}},s=(n.exports,function(){return r||(r=1,n.exports=function(){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,p,f,m,_,g,y,x,v;function b(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 w(e,t){this.x=e,this.y=t}function T(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}"function"==typeof SuppressedError&&SuppressedError,w.prototype={clone(){return new w(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:w},w.convert=function(e){if(e instanceof w)return e;if(Array.isArray(e))return new w(+e[0],+e[1]);if(void 0!==e.x&&void 0!==e.y)return new w(+e.x,+e.y);throw Error("Expected [x, y] or {x, y} point format")};var S,P,M,I,E,C,A,D,z,k,R,L,F,B,O,V,j,N,U,G,$,Z,q,W,H=T(function(){if(iv)return ix;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 iv=1,ix=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))}},ix}());function X(){return null!=t||(t="u">typeof OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof createImageBitmap),t}function Y(){if(null==i&&(i=!1,X())){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 K="u">typeof Float32Array?Float32Array:Array;function J(){var e=new K(9);return K!=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 Q(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 ee(){var e=new K(3);return K!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function et(e){var t=e[0],i=e[1],r=e[2];return Math.sqrt(t*t+i*i+r*r)}function ei(e,t,i){var r=new K(3);return r[0]=e,r[1]=t,r[2]=i,r}function er(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e}function ea(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e}function en(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 es(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 eo(){var e=new K(4);return K!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function el(e,t,i,r){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"zyx",n=Math.PI/360;t*=n,r*=n,i*=n;var s=Math.sin(t),o=Math.cos(t),l=Math.sin(i),h=Math.cos(i),u=Math.sin(r),c=Math.cos(r);switch(a){case"xyz":e[0]=s*h*c+o*l*u,e[1]=o*l*c-s*h*u,e[2]=o*h*u+s*l*c,e[3]=o*h*c-s*l*u;break;case"xzy":e[0]=s*h*c-o*l*u,e[1]=o*l*c-s*h*u,e[2]=o*h*u+s*l*c,e[3]=o*h*c+s*l*u;break;case"yxz":e[0]=s*h*c+o*l*u,e[1]=o*l*c-s*h*u,e[2]=o*h*u-s*l*c,e[3]=o*h*c+s*l*u;break;case"yzx":e[0]=s*h*c+o*l*u,e[1]=o*l*c+s*h*u,e[2]=o*h*u-s*l*c,e[3]=o*h*c-s*l*u;break;case"zxy":e[0]=s*h*c-o*l*u,e[1]=o*l*c+s*h*u,e[2]=o*h*u+s*l*c,e[3]=o*h*c-s*l*u;break;case"zyx":e[0]=s*h*c-o*l*u,e[1]=o*l*c+s*h*u,e[2]=o*h*u-s*l*c,e[3]=o*h*c+s*l*u;break;default:throw Error("Unknown angle order "+a)}return e}function eh(){var e=new K(2);return K!=Float32Array&&(e[0]=0,e[1]=0),e}function eu(e,t){var i=new K(2);return i[0]=e,i[1]=t,i}function ec(e,t,i){return t*(8192/(e.tileSize*Math.pow(2,i-e.tileID.overscaledZ)))}function ed(e){return e instanceof Error?e:Error("string"==typeof e?e:String(e))}function ep(e,t){return(e%t+t)%t}function ef(e,t,i){return e*(1-i)+t*i}function em(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 e_(e,t,i,r){let a=new H(e,t,i,r);return e=>a.solve(e)}ee(),ib=new K(4),K!=Float32Array&&(ib[0]=0,ib[1]=0,ib[2]=0,ib[3]=0),ee(),ei(1,0,0),ei(0,1,0),eo(),eo(),J(),eh();let eg=e_(.25,.1,.25,1);function ey(e,t,i){return Math.min(i,Math.max(t,e))}function ex(e,t,i){let r=i-t,a=((e-t)%r+r)%r+t;return a===t?i:a}function ev(e,...t){for(let i of t)for(let t in i)e[t]=i[t];return e}let eb=1;function ew(e,t,i){let r={};for(let i in e)r[i]=t.call(this,e[i],i,e);return r}function eT(e,t,i){let r={};for(let i in e)t.call(this,e[i],i,e)&&(r[i]=e[i]);return r}function eS(e){return Array.isArray(e)?e.map(eS):"object"==typeof e&&e?ew(e,eS):e}let eP={};function eM(e){eP[e]||("u">typeof console&&console.warn(e),eP[e]=!0)}function eI(e,t,i){return(i.y-e.y)*(t.x-e.x)>(t.y-e.y)*(i.x-e.x)}function eE(e){return"u">typeof WorkerGlobalScope&&void 0!==e&&e instanceof WorkerGlobalScope}let eC=null;function eA(e){return"u">typeof ImageBitmap&&e instanceof ImageBitmap}let eD="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function ez(e,t,i,r,a){return b(this,void 0,void 0,function*(){if(typeof VideoFrame>"u")throw Error("VideoFrame not supported");let n=new VideoFrame(e,{timestamp:0});try{let s=null==n?void 0:n.format;if(!s||!s.startsWith("BGR")&&!s.startsWith("RGB"))throw Error(`Unrecognized format ${s}`);let o=s.startsWith("BGR"),l=new Uint8ClampedArray(r*a*4);if(yield n.copyTo(l,function(e,t,i,r,a){let n=4*Math.max(-t,0),s=(Math.max(0,i)-i)*r*4+n,o=Math.max(0,t),l=Math.max(0,i);return{rect:{x:o,y:l,width:Math.min(e.width,t+r)-o,height:Math.min(e.height,i+a)-l},layout:[{offset:s,stride:4*r}]}}(e,t,i,r,a)),o)for(let e=0;e<l.length;e+=4){let t=l[e];l[e]=l[e+2],l[e+2]=t}return l}finally{n.close()}})}function ek(e,t,i,r){return e.addEventListener(t,i,r),{unsubscribe:()=>{e.removeEventListener(t,i,r)}}}function eR(e){return e*Math.PI/180}function eL(e){return e/Math.PI*180}let eF={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0}
1,eB={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0},eO="AbortError";class eV extends Error{constructor(e=eO){super(e instanceof Error?e.message:e),this.name=eO,e instanceof Error&&e.stack&&(this.stack=e.stack)}}function ej(e){return e instanceof Error&&e.name===eO}function eN(e){if(e.aborted)throw new eV(e.reason)}let eU={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function eG(e){return eU.REGISTERED_PROTOCOLS[e.substring(0,e.indexOf("://"))]}let e$="global-dispatcher";class eZ 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 eq=()=>{var e;return eE(self)?null==(e=self.worker)?void 0:e.referrer:("blob:"===window.location.protocol?window.parent:window).location.href},eW=function(e,t){return b(this,void 0,void 0,function*(){var i,r,a,n;if(e.url.includes("://")&&!/^https?:|^file:/.test(e.url)){let r=eG(e.url);if(r){let i=yield r(e,t);return i.data||"arrayBuffer"!==e.type?i:ev(i,{data:new ArrayBuffer(0)})}if(eE(self)&&null!=(i=self.worker)&&i.actor)return self.worker.actor.sendAsync({type:"GR",data:e,targetMapId:e$},t)}if(!((a=e.url).startsWith("file:")||(null==(n=eq())?void 0:n.startsWith("file:"))&&!/^\w+:/.test(a))){if(fetch&&Request&&AbortController&&Object.hasOwn(Request.prototype,"signal"))return function(e,t){return b(this,void 0,void 0,function*(){let i,r,a=new Request(e.url,{method:e.method||"GET",body:e.body,credentials:e.credentials,headers:e.headers,cache:e.cache,referrer:eq(),referrerPolicy:e.referrerPolicy,signal:t.signal});"json"!==e.type||a.headers.has("Accept")||a.headers.set("Accept","application/json");try{i=yield fetch(a)}catch(t){throw ej(t)?t:new eZ(0,ed(t).message,e.url,new Blob)}if(!i.ok){let t=yield i.blob();throw new eZ(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;return eN(t.signal),{data:n,cacheControl:i.headers.get("Cache-Control"),expires:i.headers.get("Expires"),etag:i.headers.get("ETag")}})}(e,t);if(eE(self)&&null!=(r=self.worker)&&r.actor)return self.worker.actor.sendAsync({type:"GR",data:e,mustQueue:!0,targetMapId:e$},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)&&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"),etag:n.getResponseHeader("ETag")})}else{let t=new Blob([n.response],{type:n.getResponseHeader("Content-Type")});r(new eZ(n.status,n.statusText,e.url,t))}},t.signal.addEventListener("abort",()=>{n.abort(),r(new eV(t.signal.reason))}),n.send(e.body)})})};function eH(e){if(!e||0>=e.indexOf("://")||e.startsWith("data:image/")||e.startsWith("blob:"))return!0;let t=new URL(e),i=window.location;return t.protocol===i.protocol&&t.host===i.host}function eX(e,t,i){var r;null!=(r=i[e])&&r.includes(t)||(i[e]||(i[e]=[]),i[e].push(t))}function eY(e,t,i){if(null!=i&&i[e]){let r=i[e].indexOf(t);-1!==r&&i[e].splice(r,1)}}class eK{constructor(e,t={}){ev(this,t),this.type=e}}class eJ extends eK{constructor(e,t={}){super("error",ev({error:e},t))}}class eQ{on(e,t){return this._listeners||(this._listeners={}),eX(e,t,this._listeners),{unsubscribe:()=>{this.off(e,t)}}}off(e,t){return eY(e,t,this._listeners),eY(e,t,this._oneTimeListeners),this}once(e,t){return t?(this._oneTimeListeners||(this._oneTimeListeners={}),eX(e,t,this._oneTimeListeners),this):new Promise(t=>this.once(e,t))}fire(e,t){var i,r;"string"==typeof e&&(e=new eK(e,t||{}));let a=e.type;if(this.listens(a)){for(let t of(e.target=this,null!=(i=this._listeners)&&i[a]?this._listeners[a].slice():[]))t.call(this,e);for(let t of null!=(r=this._oneTimeListeners)&&r[a]?this._oneTimeListeners[a].slice():[])eY(a,t,this._oneTimeListeners),t.call(this,e);let t=this._eventedParent;t&&(ev(e,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),t.fire(e))}else e instanceof eJ&&console.error(e.error);return this}listens(e){var t,i,r,a,n;return(null==(i=null==(t=this._listeners)?void 0:t[e])?void 0:i.length)>0||(null==(a=null==(r=this._oneTimeListeners)?void 0:r[e])?void 0:a.length)>0||(null==(n=this._eventedParent)?void 0:n.listens(e))}setEventedParent(e,t){return this._eventedParent=e,this._eventedParentData=t,this}}var e0={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number",length:2},centerAltitude:{type:"number"},zoom:{type:"number"}
vendor: 21,023 bytes, line 1
1,bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},"font-faces":{type:"fontFaces"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},encoding:{type:"enum",values:{mvt:{},mlt:{}},default:"mvt"},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"filter"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},"color-relief":{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"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","feature"]},"property-type":"data-driven"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},filter:{type:"boolean",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"expression_name",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven
vendor: 12,722 bytes, line 1
1"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}},interpolation:{type:"array",value:"interpolation_name",minimum:1},interpolation_name:{type:"enum",values:{linear:{syntax:{overloads:[{parameters:[],"output-type":"interpolation"}],parameters:[]}},exponential:{syntax:{overloads:[{parameters:["base"],"output-type":"interpolation"}],parameters:[{name:"base",type:"number literal"}]}},"cubic-bezier":{syntax:{overloads:[{parameters:["x1","y1","x2","y2"],"output-type":"interpolation"}],parameters:[{name:"x1",type:"number literal"},{name:"y1",type:"number literal"},{name:"x2",type:"number literal"},{name:"y2",type:"number literal"}]}}}}}
1;let e1=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function e2(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(!e2(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(!e2(e[i],t[i]))return!1;return!0}return e===t}function e3(e,t){e.push(t)}function e5(e,t,i){e3(i,{command:"addSource",args:[e,t[e]]})}function e6(e,t,i){e3(t,{command:"removeSource",args:[e]}),i[e]=!0}function e4(e,t,i,r,a,n){for(let s in t=t||{},e=e||{})Object.prototype.hasOwnProperty.call(e,s)&&(e2(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)&&(e2(e[s],t[s])||i.push({command:n,args:[r,s,t[s],a]}))}function e8(e){return e.id}function e7(e,t){return e[t.id]=t,e}class e9{constructor(e,t,i,r){this.message=(e?`${e}: `:"")+i,r&&(this.identifier=r),null!=t&&t.__line__&&(this.line=t.__line__)}}function te(e,...t){for(let i of t)for(let t in i)e[t]=i[t];return e}
1class tt extends Error{constructor(e,t){super(t),this.message=t,this.key=e}}class ti{constructor(e,t=[]){for(let[i,r]of(this.parent=e,this.bindings={},t))this.bindings[i]=r}concat(e){return new ti(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 tr={kind:"null"},ta={kind:"number"},tn={kind:"string"},ts={kind:"boolean"},to={kind:"color"},tl={kind:"projectionDefinition"},th={kind:"object"},tu={kind:"value"},tc={kind:"collator"},td={kind:"formatted"},tp={kind:"padding"},tf={kind:"colorArray"},tm={kind:"numberArray"},t_={kind:"resolvedImage"},tg={kind:"variableAnchorOffsetCollection"};function ty(e,t){return{kind:"array",itemType:e,N:t}}function tx(e){if("array"===e.kind){let t=tx(e.itemType);return"number"==typeof e.N?`array<${t}, ${e.N}>`:"value"===e.itemType.kind?"array":`array<${t}>`}return e.kind}let tv=[tr,ta,tn,ts,to,tl,td,th,ty(tu),tp,tm,tf,t_,tg];function tb(e,t){if("error"===t.kind)return null;if("array"===e.kind){if("array"===t.kind&&(0===t.N&&"value"===t.itemType.kind||!tb(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 tv)if(!tb(e,t))return null}}return`Expected ${tx(e)} but found ${tx(t)} instead.`}function tw(e,t){return t.some(t=>t.kind===e.kind)}function tT(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 tS(e,t){return"array"===e.kind&&"array"===t.kind?e.itemType.kind===t.itemType.kind&&"number"==typeof e.N:e.kind===t.kind}let tP=4/29,tM=6/29,tI=6/29*3*(6/29),tE=6/29*(6/29)*(6/29),tC=Math.PI/180,tA=180/Math.PI;function tD(e){return(e%=360)<0&&(e+=360),e}function tz([e,t,i,r]){let a,n,s=tR((.2225045*(e=tk(e))+.7168786*(t=tk(t))+.0606169*(i=tk(i)))/1);e===t&&t===i?a=n=s:(a=tR((.4360747*e+.3850649*t+.1430804*i)/.96422),n=tR((.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 tk(e){return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function tR(e){return e>tE?Math.pow(e,1/3):e/tI+tP}function tL([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=+tB(a),[tF(3.1338561*(n=.96422*tB(n))-1.6168667*a-.4906146*(s=.82521*tB(s))),tF(-.9787684*n+1.9161415*a+.033454*s),tF(.0719453*n-.2289914*a+1.4052427*s),r]}function tF(e){return(e=e<=.00304?12.92*e:1.055*Math.pow(e,1/2.4)-.055)<0?0:e>1?1:e}function tB(e){return e>tM?e*e*e:tI*(e-tP)}let tO=Object.hasOwn||function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};function tV(e,t){return tO(e,t)?e[t]:void 0}function tj(e){return parseInt(e.padEnd(2,e),16)/255}function tN(e,t){return tU(t?e/100:e,0,1)}function tU(e,t,i){return Math.min(Math.max(t,e),i)}function tG(e){return!e.some(Number.isNaN)}let t$={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 tZ(e,t,i){return e.map((e,r)=>e+i*(t[r]-e))}class tq{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 tq)return e;if("string"!=typeof e)return;let t=function(e){if("transparent"===(e=e.toLowerCase().trim()))return[0,0,0,0];let t=tV(t$,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[tj(e.slice(i,i+=t)),tj(e.slice(i,i+=t)),tj(e.slice(i,i+=t)),tj(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,p]=t,f=[a||" ",o||" ",u].join("");if(" "===f||" /"===f||",,"===f||",,,"===f){let e=[r,s,h].join(""),t="%%%"===e?100:255*(""===e);if(t){let e=[tU(i/t,0,1),tU(n/t,0,1),tU(l/t,0,1),c?tN(+c,p):1];if(tG(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,tU(+a,0,100),tU(+s,0,100),l?tN(+l,h):1];if(tG(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=tD(e),t/=100,i/=100,[a(0),a(8),a(4),r]}(e)}}}(e);return t?new tq(...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]=tz(e),n=Math.sqrt(i*i+r*r);return[Math.round(1e4*n)?tD(Math.atan2(r,i)*tA):NaN,n,t,a]}(this.rgb))}get lab(){return this.overwriteGetter("lab",tz(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]=tZ(e.rgb,t.rgb,i);return new tq(r,a,n,s,!1)}case"hcl":{let r,a,[n,s,o,l]=e.hcl,[h,u,c,p]=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[f,m,_,g]=function([e,t,i,r]){return tL([i,Math.cos(e=isNaN(e)?0:e*tC)*t,Math.sin(e)*t,r])}([r,a??s+i*(u-s),o+i*(c-o),l+i*(p-l)]);return new tq(f,m,_,g,!1)}case"lab":{let[r,a,n,s]=tL(tZ(e.lab,t.lab,i));return new tq(r,a,n,s,!1)}}}}tq.black=new tq(0,0,0,1),tq.white=new tq(1,1,1,1),tq.transparent=new tq(0,0,0,0),tq.red=new tq(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 tH=["bottom","center","top"];class tX{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 tY{constructor(e){this.sections=e}static fromString(e){return new tY([new tX(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 tY?e:tY.fromString(e)}toString(){return 0===this.sections.length?"":this.sections.map(e=>e.text).join("")}}class tK{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof tK)return e;if("number"==typeof e)return new tK([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 tK(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,i){return new tK(tZ(e.values,t.values,i))}}class tJ{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof tJ)return e;if("number"==typeof e)return new tJ([e]);if(Array.isArray(e)){for(let t of e)if("number"!=typeof t)return;return new tJ(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,i){return new tJ(tZ(e.values,t.values,i))}}class tQ{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof tQ)return e;if("string"==typeof e){let t=tq.parse(e);return t?new tQ([t]):void 0}if(!Array.isArray(e))return;let t=[];for(let i of e){if("string"!=typeof i)return;let e=tq.parse(i);if(!e)return;t.push(e)}return new tQ(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(tq.interpolate(e.values[n],t.values[n],i,r));return new tQ(a)}}
1class t0 extends Error{constructor(e){super(e),this.name="RuntimeError"}toJSON(){return this.message}}let t1=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class t2{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof t2)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||!t1.has(i)||!Array.isArray(r)||2!==r.length||"number"!=typeof r[0]||"number"!=typeof r[1])return}return new t2(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 t0(`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 t0(`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 t2(n)}}class t3{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new t3({name:e,available:!1}):null}}class t5{constructor(e,t,i){this.from=e,this.to=t,this.transition=i}static interpolate(e,t,i){return new t5(e,t,i)}static parse(e){return e instanceof t5?e:Array.isArray(e)&&3===e.length&&"string"==typeof e[0]&&"string"==typeof e[1]&&"number"==typeof e[2]?new t5(e[0],e[1],e[2]):"object"==typeof e&&"string"==typeof e.from&&"string"==typeof e.to&&"number"==typeof e.transition?new t5(e.from,e.to,e.transition):"string"==typeof e?new t5(e,e,1):void 0}}function t6(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 t4(e){if(null===e||"string"==typeof e||"boolean"==typeof e||"number"==typeof e||e instanceof t5||e instanceof tq||e instanceof tW||e instanceof tY||e instanceof tK||e instanceof tJ||e instanceof tQ||e instanceof t2||e instanceof t3)return!0;if(Array.isArray(e)){for(let t of e)if(!t4(t))return!1;return!0}if("object"==typeof e){for(let t in e)if(!t4(e[t]))return!1;return!0}return!1}function t8(e){if(null===e)return tr;if("string"==typeof e)return tn;if("boolean"==typeof e)return ts;if("number"==typeof e)return ta;if(e instanceof tq)return to;if(e instanceof t5)return tl;if(e instanceof tW)return tc;if(e instanceof tY)return td;if(e instanceof tK)return tp;if(e instanceof tJ)return tm;if(e instanceof tQ)return tf;if(e instanceof t2)return tg;if(e instanceof t3)return t_;if(Array.isArray(e)){let t,i=e.length;for(let i of e){let e=t8(i);if(t){if(t===e)continue;t=tu;break}t=e}return ty(t||tu,i)}return th}function t7(e){let t=typeof e;return null===e?"":"string"===t||"number"===t||"boolean"===t?String(e):e instanceof tq||e instanceof t5||e instanceof tY||e instanceof tK||e instanceof tJ||e instanceof tQ||e instanceof t2||e instanceof t3?e.toString():JSON.stringify(e)}class t9{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(!t4(e[1]))return t.error("invalid value");let i=e[1],r=t8(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 t9(r,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}let ie={string:tn,number:ta,boolean:ts,object:th};class it{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 ie)||"object"===i)return t.error('The item type argument of "array" must be one of string, number, boolean',1);a=ie[i],r++}else a=tu;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=ty(a,n)}else{if(!ie[a])throw Error(`Types doesn't contain name = ${a}`);i=ie[a]}let n=[];for(;r<e.length;r++){let i=t.parse(e[r],r,tu);if(!i)return null;n.push(i)}return new it(i,n)}evaluate(e){for(let t=0;t<this.args.length;t++){let i=this.args[t].evaluate(e);if(!tb(this.type,t8(i)))return i;if(t===this.args.length-1)throw new t0(`Expected value to be of type ${tx(this.type)}, but found ${tx(t8(i))} instead.`)}throw Error()}
1eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}let ii={"to-boolean":ts,"to-color":to,"to-number":ta,"to-string":tn};class ir{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(!ii[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=ii[i],a=[];for(let i=1;i<e.length;i++){let r=t.parse(e[i],i,tu);if(!r)return null;a.push(r)}return new ir(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 tq)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.`:t6(t[0],t[1],t[2],t[3])))return new tq(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new t0(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=tK.parse(t);if(r)return r}throw new t0(`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=tJ.parse(t);if(r)return r}throw new t0(`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=tQ.parse(t);if(r)return r}throw new t0(`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=t2.parse(t);if(r)return r}throw new t0(`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 t0(`Could not convert ${JSON.stringify(t)} to number.`)}case"formatted":return tY.fromString(t7(this.args[0].evaluate(e)));case"resolvedImage":return t3.fromString(t7(this.args[0].evaluate(e)));case"projectionDefinition":return this.args[0].evaluate(e);default:return t7(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}let ia=["Unknown","Point","LineString","Polygon"];class is{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?ia[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=tq.parse(e),this._parseColorCache.set(e,t)),t}}class io{constructor(e,t,i=[],r,a=new ti,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 it(t,[e]):"coerce"===i?new ir(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 t9)&&"resolvedImage"!==r.type.kind&&this._isConstant(r)){let e=new is;try{r=new t9(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 io(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 tt(i,e))}checkSubtype(e,t){let i=tb(e,t);return i&&this.error(i),i}}class il{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 il(i,r):null}outputDefined(){return this.result.outputDefined()}}class ih{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 ih(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 iu{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,ta),r=t.parse(e[2],2,ty(t.expectedType||tu));return i&&r?new iu(r.type.itemType,i,r):null}evaluate(e){let t=this.index.evaluate(e),i=this.input.evaluate(e);if(t<0)throw new t0(`Array index out of bounds: ${t} < 0.`);if(t>=i.length)throw new t0(`Array index out of bounds: ${t} > ${i.length-1}.`);if(t!==Math.floor(t))throw new t0(`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 ic{constructor(e,t){this.type=ts,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.`);let i=t.parse(e[1],1,tu),r=t.parse(e[2],2,tu);return i&&r?tw(i.type,[ts,tn,ta,tr,tu])?new ic(i,r):t.error(`Expected first argument to be of type boolean, string, number or null, but found ${tx(i.type)} instead`):null}evaluate(e){let t=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(!i)return!1;if(!tT(t,["boolean","string","number","null"]))throw new t0(`Expected first argument to be of type boolean, string, number or null, but found ${tx(t8(t))} instead.`);if(!tT(i,["string","array"]))throw new t0(`Expected second argument to be of type array or string, but found ${tx(t8(i))} instead.`);return i.indexOf(t)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}
1class id{constructor(e,t,i){this.type=ta,this.needle=e,this.haystack=t,this.fromIndex=i}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);let i=t.parse(e[1],1,tu),r=t.parse(e[2],2,tu);if(!i||!r)return null;if(!tw(i.type,[ts,tn,ta,tr,tu]))return t.error(`Expected first argument to be of type boolean, string, number or null, but found ${tx(i.type)} instead`);if(4===e.length){let a=t.parse(e[3],3,ta);return a?new id(i,r,a):null}return new id(i,r)}evaluate(e){let t,i=this.needle.evaluate(e),r=this.haystack.evaluate(e);if(!tT(i,["boolean","string","number","null"]))throw new t0(`Expected first argument to be of type boolean, string, number or null, but found ${tx(t8(i))} instead.`);if(this.fromIndex&&(t=this.fromIndex.evaluate(e)),tT(r,["string"])){let e=r.indexOf(i,t);return -1===e?-1:[...r.slice(0,e)].length}if(tT(r,["array"]))return r.indexOf(i,t);throw new t0(`Expected second argument to be of type array or string, but found ${tx(t8(r))} instead.`)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class ip{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,t8(e)))return null}else i=t8(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,tu);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 ip(i,r,s,a,n,o):null}evaluate(e){let t=this.input.evaluate(e);return(t8(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 im{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,ts);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 im(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 i_{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 2 or 3 arguments, but found ${e.length-1} instead.`);let i=t.parse(e[1],1,tu),r=t.parse(e[2],2,ta);if(!i||!r)return null;if(!tw(i.type,[ty(tu),tn,tu]))return t.error(`Expected first argument to be of type array or string, but found ${tx(i.type)} instead`);if(4===e.length){let a=t.parse(e[3],3,ta);return a?new i_(i.type,i,r,a):null}return new i_(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)),tT(i,["string"]))return[...i].slice(r,t).join("");if(tT(i,["array"]))return i.slice(r,t);throw new t0(`Expected first argument to be of type array or string, but found ${tx(t8(i))} instead.`)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function ig(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 t0("Input is not a number.");s=o-1}return 0}
1class iy{constructor(e,t,i){for(let[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,ta);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 iy(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[ig(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 ix,iv,ib,iw,iT,iS,iP=(iw=function(){if(iS)return iT;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 iS=1,iT=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))}},iT}())&&iw.__esModule&&Object.prototype.hasOwnProperty.call(iw,"default")?iw.default:iw;class iM{constructor(e,t,i,r,a){for(let[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=iI(t,e.base,i,r);else if("linear"===e.name)a=iI(t,1,i,r);else if("cubic-bezier"===e.name){let n=e.controlPoints;a=new iP(n[0],n[1],n[2],n[3]).solve(iI(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,ta)))return null;let s=[],o=null;"interpolate-hcl"!==i&&"interpolate-lab"!==i||t.expectedType==tf?t.expectedType&&"value"!==t.expectedType.kind&&(o=t.expectedType):o=to;for(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 tS(o,ta)||tS(o,tl)||tS(o,to)||tS(o,tp)||tS(o,tm)||tS(o,tf)||tS(o,tg)||tS(o,ty(ta))?new iM(o,i,r,a,s):t.error(`Type ${tx(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=ig(t,r),s=iM.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-
1o);case"color":return tq.interpolate(o,l,s);case"padding":return tK.interpolate(o,l,s);case"colorArray":return tQ.interpolate(o,l,s);case"numberArray":return tJ.interpolate(o,l,s);case"variableAnchorOffsetCollection":return t2.interpolate(o,l,s);case"array":return tZ(o,l,s);case"projectionDefinition":return t5.interpolate(o,l,s)}case"interpolate-hcl":switch(this.type.kind){case"color":return tq.interpolate(o,l,s,"hcl");case"colorArray":return tQ.interpolate(o,l,s,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return tq.interpolate(o,l,s,"lab");case"colorArray":return tQ.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 iI(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 iE={color:tq.interpolate,number:function(e,t,i){return e+i*(t-e)},padding:tK.interpolate,numberArray:tJ.interpolate,colorArray:tQ.interpolate,variableAnchorOffsetCollection:t2.interpolate,array:tZ};class iC{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 iC(r&&a.some(e=>tb(r,e.type))?tu:i,a)}evaluate(e){let t,i=null,r=0;for(let a of this.args)if(r++,(i=a.evaluate(e))&&i instanceof t3&&!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 iA(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 iD(e,t,i,r){return 0===r.compare(t,i)}function iz(e,t,i){let r="=="!==e&&"!="!==e;return class a{constructor(e,t,i){this.type=ts,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,tu);if(!n)return null;if(!iA(i,n.type))return t.concat(1).error(`"${i}" comparisons are not supported for type '${tx(n.type)}'.`);let s=t.parse(e[2],2,tu);if(!s)return null;if(!iA(i,s.type))return t.concat(2).error(`"${i}" comparisons are not supported for type '${tx(s.type)}'.`);if(n.type.kind!==s.type.kind&&"value"!==n.type.kind&&"value"!==s.type.kind)return t.error(`Cannot compare types '${tx(n.type)}' and '${tx(s.type)}'.`);r&&("value"===n.type.kind&&"value"!==s.type.kind?n=new it(s.type,[n]):"value"!==n.type.kind&&"value"===s.type.kind&&(s=new it(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,tc)))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=t8(n),i=t8(s);if(t.kind!==i.kind||"string"!==t.kind&&"number"!==t.kind)throw new t0(`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=t8(n),i=t8(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 ik=iz("==",function(e,t,i){return t===i},iD),iR=iz("!=",function(e,t,i){return t!==i},function(e,t,i,r){return!iD(0,t,i,r)}),iL=iz("<",function(e,t,i){return t<i},function(e,t,i,r){return 0>r.compare(t,i)}),iF=iz(">",function(e,t,i){return t>i},function(e,t,i,r){return r.compare(t,i)>0}),iB=iz("<=",function(e,t,i){return t<=i},function(e,t,i,r){return 0>=r.compare(t,i)}),iO=iz(">=",function(e,t,i){return t>=i},function(e,t,i,r){return r.compare(t,i)>=0});class iV{constructor(e,t,i){this.type=tc,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,ts
1);if(!r)return null;let a=t.parse(void 0!==i["diacritic-sensitive"]&&i["diacritic-sensitive"],1,ts);if(!a)return null;let n=null;return!i.locale||(n=t.parse(i.locale,1,tn))?new iV(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 ij{constructor(e,t,i,r,a,n){this.type=tn,this.number=e,this.locale=t,this.currency=i,this.unit=r,this.minFractionDigits=a,this.maxFractionDigits=n}static parse(e,t){if(3!==e.length)return t.error("Expected two arguments.");let i=t.parse(e[1],1,ta);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,tn)))return null;let n=null;if(r.currency&&!(n=t.parse(r.currency,1,tn)))return null;let s=null;if(r.unit&&!(s=t.parse(r.unit,1,tn)))return null;if(n&&s)return t.error("NumberFormat options `currency` and `unit` are mutually exclusive");let o=null;if(r["min-fraction-digits"]&&!(o=t.parse(r["min-fraction-digits"],1,ta)))return null;let l=null;return!r["max-fraction-digits"]||(l=t.parse(r["max-fraction-digits"],1,ta))?new ij(i,a,n,s,o,l):null}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":this.unit?"unit":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,unit:this.unit?this.unit.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.unit&&e(this.unit),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class iN{constructor(e){this.type=td,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,ta)))return null;let i=null;if(n["text-font"]&&!(i=t.parse(n["text-font"],1,ty(tn))))return null;let s=null;if(n["text-color"]&&!(s=t.parse(n["text-color"],1,to)))return null;let o=null;if(n["vertical-align"]){if("string"==typeof n["vertical-align"]&&!tH.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,tn)))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,tu);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 iN(r)}evaluate(e){return new tY(this.sections.map(t=>{let i=t.content.evaluate(e);return t8(i)===t_?new tX("",i,null,null,null,t.verticalAlign?t.verticalAlign.evaluate(e):null):new tX(t7(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 iU{constructor(e){this.type=t_,this.input=e}static parse(e,t){if(2!==e.length)return t.error("Expected two arguments.");let i=t.parse(e[1],1,tn);return i?new iU(i):t.error("No image name provided.")}evaluate(e){let t=this.input.evaluate(e),i=t3.fromString(t);return i&&e.availableImages&&(i.available=e.availableImages.indexOf(t)>-1),i}eachChild(e){e(this.input)}outputDefined(){return!1}}class iG{constructor(e){this.type=ta,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 ${tx(i.type)} instead.`):new iG(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 t0(`Expected value to be of type string or array, but found ${tx(t8(t))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}function i$(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 iZ(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 iq(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(a=[r[0]-i[0],r[1]-i[1]])[0]*(n=[t[0]-e[0],t[1]-e[1]])[1]-a[1]*n[0]!=0&&!(!iY(e,t,i,r)||!iY(i,r,e,t))}function iH(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 iX(e,t){for(let i of e)if(!iH(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 iY(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 iK(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);iZ(t,s),n.push(s)}r.push(n)}return r}function iJ(e,t,i){let r=[];for(let a=0;a<e.length;a++){let n=iK(e[a],t,i);r.push(n)}return r}function iQ(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}iZ(t,e)}function i0(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]];iQ(r,t,i,a),s.push(r)}return s}function i1(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]];iZ(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)iQ(r,t,i,a);return s}class i2{constructor(e,t){this.type=ts,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(t4(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 i2(t,{type:"MultiPolygon",coordinates:e})}else if("Feature"===t.type){let e=t.geometry.type;if("Polygon"===e||"MultiPolygon"===e)return new i2(t,t.geometry)}else if("Polygon"===t.type||"MultiPolygon"===t.type)return new i2(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=iK(t.coordinates,r,a),s=i0(e.geometry(),i,r,a);if(!iq(i,r))return!1;for(let e of s)if(!iH(e,n))return!1}if("MultiPolygon"===t.type){let n=iJ(t.coordinates,r,a),s=i0(e.geometry(),i,r,a);if(!iq(i,r))return!1;for(let e of s)if(!function(e,t){for(let i of t)if(iH(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=iK(t.coordinates,r,a),s=i1(e.geometry(),i,r,a);if(!iq(i,r))return!1;for(let e of s)if(!iX(e,n))return!1}if("MultiPolygon"===t.type){let n=iJ(t.coordinates,r,a),s=i1(e.geometry(),i,r,a);if(!iq(i,r))return!1;for(let e of s)if(!function(e,t){for(let i of t)if(iX(e,i))return!0;return!1}(e,n))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let i3=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 i5(e,t,i){let r=e[t];e[t]=e[i],e[i]=r}function i6(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(i5(t,r,i),n(t[a],s)>0&&i5(t,r,a);o<l;){for(i5(t,o,l),o++,l--;0>n(t[o],s);)o++;for(;n(t[l],s)>0;)l--}0===n(t[r],s)?i5(t,r,l):i5(t,++l,a),l<=i&&(r=l+1),i<=l&&(a=l-1)}}(a[e],t,1,a[e].length-1,i4),a[e]=a[e].slice(0,t));return a}function i4(e,t){return t.area-e.area}let i8=1/298.257223563*(2-1/298.257223563),i7=Math.PI/180;class i9{constructor(e){let t=6378.137*i7*1e3,i=Math.cos(e*i7),r=1/(1-i8*(1-i*i)),a=Math.sqrt(r);this.kx=t*a*i,this.ky=t*a*r*(1-i8)}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,p=0;
10===u&&0===c||((p=(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]):p>0&&(l+=u/this.kx*p,h+=c/this.ky*p));let f=(u=this.wrap(t[0]-l)*this.kx)*u+(c=(t[1]-h)*this.ky)*c;f<s&&(s=f,i=l,r=h,a=o,n=p)}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 re(e,t){return t[0]-e[0]}function rt(e){return e[1]-e[0]+1}function ri(e,t){return e[1]>=e[0]&&e[1]<t}function rr(e,t){if(e[0]>e[1])return[null,null];let i=rt(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 ra(e,t){if(!ri(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)iZ(i,e[r]);return i}function rn(e){let t=[1/0,1/0,-1/0,-1/0];for(let i of e)for(let e of i)iZ(t,e);return t}function rs(e){return e[0]!==-1/0&&e[1]!==-1/0&&e[2]!==1/0&&e[3]!==1/0}function ro(e,t,i){if(!rs(e)||!rs(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 rl(e,t,i){let r=i.pointOnLine(t,e);return i.distance(e,r.point)}function rh(e,t,i,r,a){return Math.min(Math.min(rl(e,[i,r],a),rl(t,[i,r],a)),Math.min(rl(i,[e,t],a),rl(r,[e,t],a)))}function ru(e,t){for(let i of e)for(let e of i)if(iH(e,t,!0))return!0;return!1}function rc(e,t,i,r,a,n){if(!n)return;let s=ro(ra(r,n),a,i);s<t&&e.push([s,n,[0,0]])}function rd(e,t,i,r,a,n,s){if(!n||!s)return;let o=ro(ra(r,n),ra(a,s),i);o<t&&e.push([o,n,s])}function rp(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 i3([[0,[0,e.length-1],[0,0]]],re),o=rn(i);for(;s.length>0;){let a=s.pop();if(a[0]>=n)continue;let l=a[1],h=t?50:100;if(rt(l)<=h){if(!ri(l,e.length))return NaN;if(t){let t=function(e,t,i,r){if(!ri(t,e.length))return NaN;for(let r=t[0];r<=t[1];++r)if(iH(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,rh(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(iH(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,rl(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=rr(l,t);rc(s,n,r,e,o,i[0]),rc(s,n,r,e,o,i[1])}}return n}function rf(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 i3([[0,[0,e.length-1],[0,i.length-1]]],re);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(rt(l)<=u&&rt(h)<=c){if(!ri(l,e.length)&&ri(h,i.length))return NaN;if(t&&r)s=Math.min(s,function(e,t,i,r,a){if(!ri(t,e.length)||!ri(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,rh(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,rl(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,rl(e[i],t,a))))return s}else s=Math.min(s,function(e,t,i,r,a){if(!ri(t,e.length)||!ri(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=rr(l,t),u=rr(h,r);rd(o,s,a,e,i,n[0],u[0]),rd(o,s,a,e,i,n[0],u[1]),rd(o,s,a,e,i,n[1],u[0]),rd(o,s,a,e,i,n[1],u[1])}}return s}function rm(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 r_{constructor(e,t){this.type=ta,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(t4(e[1])){let t=e[1];if("FeatureCollection"===t.type)return new r_(t,t.features.map(e=>rm(e.geometry)).flat());if("Feature"===t.type)return new r_(t,rm(t.geometry));if("type"in t&&"coordinates"in t)return new r_(t,rm(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=>i$([t.x,t.y],e.canonical));if(0===i.length)return NaN;let a=new i9(r[0][1]),n=1/0;for(let e of t){switch(e.type){case"Point":n=Math.min(n,rf(r,!1,[e.coordinates],!1,a,n));break;case"LineString":n=Math.min(n,rf(r,!1,e.coordinates,!0,a,n));break;case"Polygon":n=Math.min(n,rp(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=>i$([t.x,t.y],e.canonical));if(0===i.length)return NaN;let a=new i9(r[0][1]),n=1/0;for(let e of t){switch(e.type){case"Point":n=Math.min(n,rf(r,!0,[e.coordinates],!1,a,n));break;case"LineString":n=Math.min(n,rf(r,!0,e.coordinates,!0,a,n));break;case"Polygon":n=Math.min(n,rp(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=i6(i,0).map(t=>t.map(t=>t.map(t=>i$([t.x,t.y],e.canonical)))),a=new i9(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,rp([e.coordinates],!1,t,a,n));break;case"LineString":n=Math.min(n,rp(e.coordinates,!0,t,a,n));break;case"Polygon":n=Math.min(n,function(e,t,i,r=1/0){let a=rn(e),n=rn(t);if(r!==1/0&&ro(a,n,i)>=r)return r;if(iq(a,n)){if(ru(e,t))return 0}else if(ru(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,rh(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 rg{constructor(e){this.type=tu,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 rg(i)}evaluate(e){var t;let i=null==(t=e.globals)?void 0:t.globalState;return i&&0!==Object.keys(i).length?tV(i,this.key):null}eachChild(){}outputDefined(){return!1}}let ry={"==":ik,"!=":iR,">":iF,"<":iL,">=":iO,"<=":iB,array:it,at:iu,boolean:it,case:im,coalesce:iC,collator:iV,format:iN,image:iU,in:ic,"index-of":id,interpolate:iM,"interpolate-hcl":iM,"interpolate-lab":iM,length:iG,let:il,literal:t9,match:ip,number:it,"number-format":ij,object:it,slice:i_,step:iy,string:it,"to-boolean":ir,"to-color":ir,"to-number":ir,"to-string":ir,var:ih,within:i2,distance:r_,"global-state":rg};class rx{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=rx.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 io(t.registry,rT,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 rx(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(tx).join(", ")})`:`(${tx(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(tx(a.type))}t.error(`Expected arguments of type ${i}, but found (${r.join(", ")}) instead.`)}return null}static register(e,t){for(let i in rx.definitions=t,t)e[i]=rx}}function rv(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=t6(t,i,r,n);if(s)throw new t0(s);return new tq(t/255,i/255,r/255,n,!1)}function rb(e,t){let i=t[e];return void 0===i?null:i}function rw(e){return{type:e}}function rT(e){if(e instanceof ih)return rT(e.boundExpression);if(e instanceof rx&&"error"===e.name||e instanceof iV||e instanceof i2||e instanceof r_||e instanceof rg)return!1;let t=e instanceof ir||e instanceof it,i=!0;return e.eachChild(e=>{i=t?i&&rT(e):i&&e instanceof t9}),!!i&&rS(e)&&rM(e,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"])}function rS(e){if(e instanceof rx&&("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 i2||e instanceof r_)return!1;let t=!0;return e.eachChild(e=>{t&&!rS(e)&&(t=!1)}),t}function rP(e){if(e instanceof rx&&"feature-state"===e.name)return!1;let t=!0;return e.eachChild(e=>{t&&!rP(e)&&(t=!1)}),t}function rM(e,t){if(e instanceof rx&&t.indexOf(e.name)>=0)return!1;let i=!0;return e.eachChild(e=>{i&&!rM(e,t)&&(i=!1)}),i}function rI(e){return{result:"success",value:e}}function rE(e){return{result:"error",value:e}}function rC(e){return"data-driven"===e["property-type"]||"cross-faded-data-driven"===e["property-type"]}function rA(e){return!!e.expression&&e.expression.parameters.indexOf("zoom")>-1}function rD(e){return!!e.expression&&e.expression.interpolated}function rz(e){return e instanceof Number?"number":e instanceof String?"string":e instanceof Boolean?"boolean":Array.isArray(e)?"array":null===e?"null":typeof e}function rk(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)&&t8(e)===th}function rR(e){return e}function rL(e,t,i){return void 0!==e?e:void 0!==t?t:void 0!==i?i:void 0}function rF(e,t,i,r,a){return rL(typeof i===a?r[i]:void 0,e.default,t.default)}function rB(e,t,i){if("number"!==rz(i))return rL(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=ig(e.stops.map(e=>e[0]),i);return e.stops[a][1]}
1function rO(e,t,i){let r=void 0!==e.base?e.base:1;if("number"!==rz(i))return rL(e.default,t.default);let a=e.stops.length;if(1===a||i<=e.stops[0][0])return e.stops[0][1];if(i>=e.stops[a-1][0])return e.stops[a-1][1];let n=ig(e.stops.map(e=>e[0]),i),s=function(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)}(i,r,e.stops[n][0],e.stops[n+1][0]),o=e.stops[n][1],l=e.stops[n+1][1],h=iE[t.type]||rR;return"function"==typeof o.evaluate?{evaluate(...t){let i=o.evaluate.apply(void 0,t),r=l.evaluate.apply(void 0,t);if(void 0!==i&&void 0!==r)return h(i,r,s,e.colorSpace)}}:h(o,l,s,e.colorSpace)}function rV(e,t,i){switch(t.type){case"color":i=tq.parse(i);break;case"formatted":i=tY.fromString(i.toString());break;case"resolvedImage":i=t3.fromString(i.toString());break;case"padding":i=tK.parse(i);break;case"colorArray":i=tQ.parse(i);break;case"numberArray":i=tJ.parse(i);break;default:rz(i)===t.type||"enum"===t.type&&t.values[i]||(i=void 0)}return rL(i,e.default,t.default)}rx.register(ry,{error:[{kind:"error"},[tn],(e,[t])=>{throw new t0(t.evaluate(e))}],typeof:[tn,[tu],(e,[t])=>tx(t8(t.evaluate(e)))],"to-rgba":[ty(ta,4),[to],(e,[t])=>{let[i,r,a,n]=t.evaluate(e).rgb;return[255*i,255*r,255*a,n]}],rgb:[to,[ta,ta,ta],rv],rgba:[to,[ta,ta,ta,ta],rv],has:{type:ts,overloads:[[[tn],(e,[t])=>t.evaluate(e)in e.properties()],[[tn,th],(e,[t,i])=>t.evaluate(e)in i.evaluate(e)]]},get:{type:tu,overloads:[[[tn],(e,[t])=>rb(t.evaluate(e),e.properties())],[[tn,th],(e,[t,i])=>rb(t.evaluate(e),i.evaluate(e))]]},"feature-state":[tu,[tn],(e,[t])=>rb(t.evaluate(e),e.featureState||{})],properties:[th,[],e=>e.properties()],"geometry-type":[tn,[],e=>e.geometryType()],id:[tu,[],e=>e.id()],zoom:[ta,[],e=>e.globals.zoom],"heatmap-density":[ta,[],e=>e.globals.heatmapDensity||0],elevation:[ta,[],e=>e.globals.elevation||0],"line-progress":[ta,[],e=>e.globals.lineProgress||0],accumulated:[tu,[],e=>void 0===e.globals.accumulated?null:e.globals.accumulated],"+":[ta,rw(ta),(e,t)=>{let i=0;for(let r of t)i+=r.evaluate(e);return i}],"*":[ta,rw(ta),(e,t)=>{let i=1;for(let r of t)i*=r.evaluate(e);return i}],"-":{type:ta,overloads:[[[ta,ta],(e,[t,i])=>t.evaluate(e)-i.evaluate(e)],[[ta],(e,[t])=>-t.evaluate(e)]]},"/":[ta,[ta,ta],(e,[t,i])=>t.evaluate(e)/i.evaluate(e)],"%":[ta,[ta,ta],(e,[t,i])=>t.evaluate(e)%i.evaluate(e)],ln2:[ta,[],()=>Math.LN2],pi:[ta,[],()=>Math.PI],e:[ta,[],()=>Math.E],"^":[ta,[ta,ta],(e,[t,i])=>Math.pow(t.evaluate(e),i.evaluate(e))],sqrt:[ta,[ta],(e,[t])=>Math.sqrt(t.evaluate(e))],log10:[ta,[ta],(e,[t])=>Math.log(t.evaluate(e))/Math.LN10],ln:[ta,[ta],(e,[t])=>Math.log(t.evaluate(e))],log2:[ta,[ta],(e,[t])=>Math.log(t.evaluate(e))/Math.LN2],sin:[ta,[ta],(e,[t])=>Math.sin(t.evaluate(e))],cos:[ta,[ta],(e,[t])=>Math.cos(t.evaluate(e))],tan:[ta,[ta],(e,[t])=>Math.tan(t.evaluate(e))],asin:[ta,[ta],(e,[t])=>Math.asin(t.evaluate(e))],acos:[ta,[ta],(e,[t])=>Math.acos(t.evaluate(e))],atan:[ta,[ta],(e,[t])=>Math.atan(t.evaluate(e))],min:[ta,rw(ta),(e,t)=>Math.min(...t.map(t=>t.evaluate(e)))],max:[ta,rw(ta),(e,t)=>Math.max(...t.map(t=>t.evaluate(e)))],abs:[ta,[ta],(e,[t])=>Math.abs(t.evaluate(e))],round:[ta,[ta],(e,[t])=>{let i=t.evaluate(e);return i<0?-Math.round(-i):Math.round(i)}],floor:[ta,[ta],(e,[t])=>Math.floor(t.evaluate(e))],ceil:[ta,[ta],(e,[t])=>Math.ceil(t.evaluate(e))],"filter-==":[ts,[tn,tu],(e,[t,i])=>e.properties()[t.value]===i.value],"filter-id-==":[ts,[tu],(e,[t])=>e.id()===t.value],"filter-type-==":[ts,[tn],(e,[t])=>e.geometryType()===t.value],"filter-<":[ts,[tn,tu],(e,[t,i])=>{let r=e.properties()[t.value],a=i.value;return typeof r==typeof a&&r<a}],"filter-id-<":[ts,[tu],(e,[t])=>{let i=e.id(),r=t.value;return typeof i==typeof r&&i<r}],"filter->":[ts,[tn,tu],(e,[t,i])=>{let r=e.properties()[t.value],a=i.value;return typeof r==typeof a&&r>a}],"filter-id->":[ts,[tu],(e,[t])=>{let i=e.id(),r=t.value;return typeof i==typeof r&&i>r}],"filter-<=":[ts,[tn,tu],(e,[t,i])=>{let r=e.properties()[t.value],a=i.value;return typeof r==typeof a&&r<=a}],"filter-id-<=":[ts,[tu],(e,[t])=>{let i=e.id(),r=t.value;return typeof i==typeof r&&i<=r}],"filter->=":[ts,[tn,tu],(e,[t,i])=>{let r=e.properties()[t.value],a=i.value;return typeof r==typeof a&&r>=a}],"filter-id->=":[ts,[tu],(e,[t])=>{let i=e.id(),r=t.value;return typeof i==typeof r&&i>=r}],"filter-has":[ts,[tu],(e,[t])=>t.value in e.properties()],"filter-has-id":[ts,[],e=>null!==e.id()&&void 0!==e.id()],"filter-type-in":[ts,[ty(tn)],(e,[t])=>t.value.indexOf(e.geometryType())>=0],"filter-id-in":[ts,[ty(tu)],(e,[t])=>t.value.indexOf(e.id())>=0],"filter-in-small":[ts,[tn,ty(tu)],(e,[t,i])=>i.value.indexOf(e.properties()[t.value])>=0],"filter-in-large":[ts,[tn,ty(tu)],(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:ts,overloads:[[[ts,ts],(e,[t,i])=>t.evaluate(e)&&i.evaluate(e)],[rw(ts),(e,t)=>{for(let i of t)if(!i.evaluate(e))return!1;return!0}]]},any:{type:ts,overloads:[[[ts,ts],(e,[t,i])=>t.evaluate(e)||i.evaluate(e)],[rw(ts),(e,t)=>{for(let i of t)if(i.evaluate(e))return!0;return!1}]]},"!":[ts,[ts],(e,[t])=>!t.evaluate(e)],"is-supported-script":[ts,[tn],(e,[t])=>{let i=e.globals&&e.globals.isSupportedScript;return!i||i(t.evaluate(e))}],upcase:[tn,[tn],(e,[t])=>t.evaluate(e).toUpperCase()],downcase:[tn,[tn],(e,[t])=>t.evaluate(e).toLowerCase()],concat:[tn,rw(tu),(e,t)=>t.map(t=>t7(t.evaluate(e))).join("")],split:[ty(tn),[tn,tn],(e,[t,i])=>t.evaluate(e).split(i.evaluate(e))],join:[tn,[ty(tn),tn],(e,[t,i])=>t.evaluate(e).join(i.evaluate(e))],"resolved-locale":[tn,[tc],(e,[t])=>t.evaluate(e).resolvedLocale()]});class rj{constructor(e,t,i){this.expression=e,this._warningHistory={},this._evaluator=new is,this._defaultValue=t?function(e){if("color"===e.type&&rk(e.default))return new tq(0,0,0,0);switch(e.type){case"color":return tq.parse(e.default)||null;case"padding":return tK.parse(e.default)||null;case"numberArray":return tJ.parse(e.default)||null;case"colorArray":return tQ.parse(e.default)||null;case"variableAnchorOffsetCollection":return t2.parse(e.default)||null;case"projectionDefinition":return t5.parse(e.default)||null;default:return void 0===e.default?null:e.default}}(t):null,this._enumValues=t&&"enum"===t.type?t.values:null,this._globalState=i}evaluateWithoutErrorHandling(e,t,i,r,a,n){return this._globalState&&(e=rH(e,this._globalState)),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._globalState&&(e=rH(e,this._globalState)),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 t0(`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 rN(e){return Array.isArray(e)&&e.length>0&&"string"==typeof e[0]&&e[0]in ry}function rU(e,t,i){let r=new io(ry,rT,[],t?function(e){let t={color:to,string:tn,number:ta,enum:tn,boolean:ts,formatted:td,padding:tp,numberArray:tm,colorArray:tf,projectionDefinition:tl,resolvedImage:t_,variableAnchorOffsetCollection:tg};
1return"array"===e.type?ty(t[e.value]||tu,e.length):t[e.type]}(t):void 0),a=r.parse(e,void 0,void 0,void 0,t&&"string"===t.type?{typeAnnotation:"coerce"}:void 0);return a?rI(new rj(a,t,i)):rE(r.errors)}class rG{constructor(e,t,i){this.kind=e,this._styleExpression=t,this.isStateDependent="constant"!==e&&!rP(t.expression),this.globalStateRefs=rW(t.expression),this._globalState=i}evaluateWithoutErrorHandling(e,t,i,r,a,n){return this._globalState&&(e=rH(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,t,i,r,a,n)}evaluate(e,t,i,r,a,n){return this._globalState&&(e=rH(e,this._globalState)),this._styleExpression.evaluate(e,t,i,r,a,n)}}class r${constructor(e,t,i,r,a){this.kind=e,this.zoomStops=i,this._styleExpression=t,this.isStateDependent="camera"!==e&&!rP(t.expression),this.globalStateRefs=rW(t.expression),this.interpolationType=r,this._globalState=a}evaluateWithoutErrorHandling(e,t,i,r,a,n){return this._globalState&&(e=rH(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,t,i,r,a,n)}evaluate(e,t,i,r,a,n){return this._globalState&&(e=rH(e,this._globalState)),this._styleExpression.evaluate(e,t,i,r,a,n)}interpolationFactor(e,t,i){return this.interpolationType?iM.interpolationFactor(this.interpolationType,e,t,i):0}}function rZ(e,t,i){let r=rU(e,t,i);if("error"===r.result)return r;let a=r.value.expression,n=rS(a);if(!n&&!rC(t))return rE([new tt("","data expressions not supported")]);let s=rM(a,["zoom"]);if(!s&&!rA(t))return rE([new tt("","zoom expressions not supported")]);let o=function e(t){let i=null;if(t instanceof il)i=e(t.result);else if(t instanceof iC){for(let r of t.args)if(i=e(r))break}else(t instanceof iy||t instanceof iM)&&t.input instanceof rx&&"zoom"===t.input.name&&(i=t);return i instanceof tt||t.eachChild(t=>{let r=e(t);r instanceof tt?i=r:!i&&r?i=new tt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):i&&r&&i!==r&&(i=new tt("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),i}(a);return o||s?o instanceof tt?rE([o]):o instanceof iM&&!rD(t)?rE([new tt("",'"interpolate" expressions cannot be used with this property')]):rI(o?new r$(n?"camera":"composite",r.value,o.labels,o instanceof iM?o.interpolation:void 0,i):new rG(n?"constant":"source",r.value,i)):rE([new tt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class rq{constructor(e,t){this._parameters=e,this._specification=t,te(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||(rD(i)?"exponential":"interval"),h=function(e){switch(e.type){case"color":return tq.parse;case"padding":return tK.parse;case"numberArray":return tJ.parse;case"colorArray":return tQ.parse;default:return null}}(i);if(h&&((t=te({},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 rO;case"interval":return rB;case"categorical":return rF;case"identity":return rV;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;void 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:iM.interpolationFactor.bind(void 0,s),zoomStops:n.map(e=>e[0]),evaluate:({zoom:e},r)=>rO({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:iM.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;
1return void 0===s?rL(t.default,i.default):u(t,i,s,a,n)}}}(this._parameters,this._specification))}static deserialize(e){return new rq(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function rW(e,t=new Set){return e instanceof rg&&t.add(e.key),e.eachChild(e=>{rW(e,t)}),t}function rH(e,t){let{zoom:i,heatmapDensity:r,elevation:a,lineProgress:n,isSupportedScript:s,accumulated:o}=e??{};return{zoom:i,heatmapDensity:r,elevation:a,lineProgress:n,isSupportedScript:s,accumulated:o,globalState:t}}function rX(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(!rX(t)&&"boolean"!=typeof t)return!1;return!0;default:return!0}}let rY={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function rK(e,t){if(null==e)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};rX(e)||(e=function e(t){if(!t)return!0;let i=t[0];return t.length<=1?"any"!==i:"=="===i?rQ(t[1],t[2],"=="):"!="===i?r2(rQ(t[1],t[2],"==")):"<"===i||">"===i||"<="===i||">="===i?rQ(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(r2)):"in"===i?r0(t[1],t.slice(2)):"!in"===i?r2(r0(t[1],t.slice(2))):"has"===i?r1(t[1]):"!has"!==i||r2(r1(t[1]))}(e));let i=rU(e,rY,t);if("error"===i.result)throw Error(i.value.map(e=>`${e.key}: ${e.message}`).join(", "));return{filter:(e,t,r)=>i.value.evaluate(e,t,{},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(i.value.expression)}}function rJ(e,t){return e<t?-1:+(e>t)}function rQ(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 r0(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(rJ)]]:["filter-in-small",e,["literal",t]]}}function r1(e){switch(e){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function r2(e){return["!",e]}function r3(e){let t=e.value;return t?[new e9(e.key,t,"constants have been deprecated as of v8")]:[]}function r5(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function r6(e){if(Array.isArray(e))return e.map(r6);if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){let t={};for(let i in e)t[i]=r6(e[i]);return t}return r5(e)}function r4(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=rz(i);if("object"!==h)return[new e9(t,i,`object expected, ${h} found`)];for(let e in i){let h,u=e.split(".")[0],c=tV(r,u)||r["*"];if(tV(a,u))h=a[u];else if(tV(r,u)){if(void 0===i[e])continue;h=o}else if(a["*"])h=a["*"];else{if(!r["*"]){l.push(new e9(t,i[e],`unknown property "${e}"`));continue}h=o}l=l.concat(h({key:(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 e9(t,i,`missing required property "${e}"`));return l}function r8(e){let t=e.value,i=e.valueSpec,r=e.style,a=e.styleSpec,n=e.key,s=e.arrayElementValidator||e.validateSpec;if("array"!==rz(t))return[new e9(n,t,`array expected, ${rz(t)} found`)];if(i.length&&t.length!==i.length)return[new e9(n,t,`array length ${i.length} expected, length ${t.length} found`)];let o={type:i.value,values:i.values};a.$version<7&&(o.function=i.function),"object"===rz(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 r7(e){let t=e.key,i=e.value,r=e.valueSpec,a=rz(i);return"number"===a&&i!=i&&(a="NaN"),"number"!==a?[new e9(t,i,`number expected, ${a} found`)]:"minimum"in r&&i<r.minimum?[new e9(t,i,`${i} is less than the minimum value ${r.minimum}`)]:"maximum"in r&&i>r.maximum?[new e9(t,i,`${i} is greater than the maximum value ${r.maximum}`)]:[]}function r9(e){let t=e.valueSpec,i=r5(e.value.type),r,a,n,s={},o="categorical"!==i&&void 0===e.value.property,l="array"===rz(e.value.stops)&&"array"===rz(e.value.stops[0])&&"object"===rz(e.value.stops[0][0]),h=r4({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 e9(e.key,e.value,'identity function may not have a "stops" property')];let t=[],r=e.value;return t=t.concat(r8({key:e.key,value:r,valueSpec:e.valueSpec,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,arrayElementValidator:u})),"array"===rz(r)&&0===r.length&&t.push(new e9(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 e9(e.key,e.value,'missing required property "property"')),"identity"===i||e.value.stops||h.push(new e9(e.key,e.value,'missing required property "stops"')),"exponential"===i&&e.valueSpec.expression&&!rD(e.valueSpec)&&h.push(new e9(e.key,e.value,"exponential functions not supported")),e.styleSpec.$version>=8&&(o||rC(e.valueSpec)?o&&!rA(e.valueSpec)&&h.push(new e9(e.key,e.value,"zoom functions not supported")):h.push(new e9(e.key,e.value,"property functions not supported"))),("categorical"===i||l)&&void 0===e.value.property&&h.push(new e9(e.key,e.value,'"property" property is required')),h;
1function u(e){let i=[],r=e.value,o=e.key;if("array"!==rz(r))return[new e9(o,r,`array expected, ${rz(r)} found`)];if(2!==r.length)return[new e9(o,r,`array length 2 expected, length ${r.length} found`)];if(l){if("object"!==rz(r[0]))return[new e9(o,r,`object expected, ${rz(r[0])} found`)];if(void 0===r[0].zoom)return[new e9(o,r,"object stop key must have zoom")];if(void 0===r[0].value)return[new e9(o,r,"object stop key must have value")];if(n&&n>r5(r[0].zoom))return[new e9(o,r[0].zoom,"stop zoom values must appear in ascending order")];r5(r[0].zoom)!==n&&(n=r5(r[0].zoom),a=void 0,s={}),i=i.concat(r4({key:`${o}[0]`,value:r[0],valueSpec:{zoom:{}},validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{zoom:r7,value:c}}))}else i=i.concat(c({key:`${o}[0]`,value:r[0],validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec},r));return rN(r6(r[1]))?i.concat([new e9(`${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=rz(e.value),l=r5(e.value),h=null!==e.value?e.value:n;if(r){if(o!==r)return[new e9(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 e9(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 rC(t)&&void 0===i&&(r+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new e9(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 e9(e.key,h,"stop domain values must appear in ascending order")]:(a=l,"categorical"===i&&l in s?[new e9(e.key,h,"stop domain values must be unique")]:(s[l]=!0,[])):[new e9(e.key,h,`integer expected, found ${l}`)]}}function ae(e){let t=("property"===e.expressionContext?rZ:rU)(r6(e.value),e.valueSpec);if("error"===t.result)return t.value.map(t=>new e9(`${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 e9(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&&!rP(i))return[new e9(e.key,e.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===e.expressionContext&&!rP(i))return[new e9(e.key,e.value,'"feature-state" data expressions are not supported with filters.')];if(e.expressionContext&&0===e.expressionContext.indexOf("cluster")){if(!rM(i,["zoom","feature-state"]))return[new e9(e.key,e.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===e.expressionContext&&!rS(i))return[new e9(e.key,e.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function at(e){let t=e.key,i=e.value,r=rz(i);return"string"!==r?[new e9(t,i,`color expected, ${r} found`)]:tq.parse(String(i))?[]:[new e9(t,i,`color expected, "${i}" found`)]}function ai(e){let t=e.key,i=e.value,r=e.valueSpec,a=[];return Array.isArray(r.values)?-1===r.values.indexOf(r5(i))&&a.push(new e9(t,i,`expected one of [${r.values.join(", ")}], ${JSON.stringify(i)} found`)):-1===Object.keys(r.values).indexOf(r5(i))&&a.push(new e9(t,i,`expected one of [${Object.keys(r.values).join(", ")}], ${JSON.stringify(i)} found`)),a}function ar(e){return rX(r6(e.value))?ae(te({},e,{expressionContext:"filter",valueSpec:{value:"boolean"}})):function e(t){let i=t.value,r=t.key;if("array"!==rz(i))return[new e9(r,i,`array expected, ${rz(i)} found`)];let a=t.styleSpec,n,s=[];if(i.length<1)return[new e9(r,i,"filter array must have at least 1 element")];switch(s=s.concat(ai({key:`${r}[0]`,value:i[0],valueSpec:a.filter_operator,style:t.style,styleSpec:t.styleSpec})),r5(i[0])){case"<":case"<=":case">":case">=":i.length>=2&&"$type"===r5(i[1])&&s.push(new e9(r,i,`"$type" cannot be use with operator "${i[0]}"`));case"==":case"!=":3!==i.length&&s.push(new e9(r,i,`filter array for operator "${i[0]}" must have 3 elements`));case"in":case"!in":i.length>=2&&"string"!==(n=rz(i[1]))&&s.push(new e9(`${r}[1]`,i[1],`string expected, ${n} found`));for(let e=2;e<i.length;e++)n=rz(i[e]),"$type"===r5(i[1])?s=s.concat(ai({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 e9(`${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=rz(i[1]),2!==i.length?s.push(new e9(r,i,`filter array for "${i[0]}" operator must have 2 elements`)):"string"!==n&&s.push(new e9(`${r}[1]`,i[1],`string expected, ${n} found`))}return s}(e)}function aa(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 e9(r,o,`unknown property "${l}"`)];if("string"===rz(o)&&rC(c)&&!c.tokens&&(i=/^{([^}]+)}$/.exec(o)))return[new e9(r,o,`"${l}" does not support interpolation syntax 2Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(i[1])} }\`.`)];let p=[];return"symbol"===e.layerType&&"text-font"===l&&rk(r6(o))&&"identity"===r5(o.type)&&p.push(new e9(r,o,'"text-font" does not support identity functions')),p.concat(a({key:e.key,value:o,valueSpec:c,style:n,styleSpec:s,expressionContext:"property",propertyType:t,propertyKey:l}))}function an(e){return aa(e,"paint")}function as(e){return aa(e,"layout")}function ao(e){var t,i;let r=[],a=e.value,n=e.key,s=e.style,o=e.styleSpec;if("object"!==rz(a))return[new e9(n,a,`object expected, ${rz(a)} found`)];a.type||a.ref||r.push(new e9(n,a,'either "type" or "ref" is required'));let l=r5(a.type),h=r5(a.ref);if(a.id){let t=r5(a.id);for(let i=0;i<e.arrayIndex;i++){let e=s.layers[i];r5(e.id)===t&&r.push(new e9(n,a.id,`duplicate layer id "${a.id}", previously used at line ${e.id.__line__}`))}}if("ref"in a){let e;["type","source","source-layer","filter","layout"].forEach(e=>{e in a&&r.push(new e9(n,a[e],`"${e}" is prohibited for ref layers`))}),s.layers.forEach(t=>{r5(t.id)===h&&(e=t)}),e?e.ref?r.push(new e9(n,a.ref,"ref cannot reference another ref layer")):l=r5(e.type):r.push(new e9(n,a.ref,`ref layer "${h}" not found`))}else if("background"!==l)if(a.source){let e=s.sources&&s.sources[a.source],t=e&&r5(e.type);e?"vector"===t&&"raster"===l?r.push(new e9(n,a.source,`layer "${a.id}" requires a raster source`)):"raster-dem"!==t&&"hillshade"===l||"raster-dem"!==t&&"color-relief"===l?r.push(new e9(n,a.source,`layer "${a.id}" requires a raster-dem source`)):"raster"===t&&"raster"!==l?r.push(new e9(n,a.source,`layer "${a.id}" requires a vector source`)):"vector"!==t||a["source-layer"]?"raster-dem"===t&&"hillshade"!==l&&"color-relief"!==l?r.push(new e9(n,a.source,"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.")):"line"===l&&a.paint&&a.paint["line-gradient"]&&("geojson"!==t||!e.lineMetrics)&&r.push(new e9(n,a,`layer "${a.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):r.push(new e9(n,a,`layer "${a.id}" must specify a "source-layer"`)):r.push(new e9(n,a.source,`source "${a.source}" not found`))}else r.push(new e9(n,a,'missing required property "source"'));return"raster"===l&&null!=(t=a.paint)&&t.resampling&&null!=(i=a.paint)&&i["raster-resampling"]&&r.push(new e9(n,a.paint,`layer "${a.id}" redundantly specifies "resampling" and "raster-resampling" paint properties, but only one is allowed. It is advised to use "resampling".`)),r=r.concat(r4({key:n,value:a,valueSpec:o.layer,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":()=>[],type:()=>e.validateSpec({key:`${n}.type`,value:a.type,valueSpec:o.layer.type,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,object:a,objectKey:"type"}),filter:ar,layout:e=>r4({layer:a,key:e.key,value:e.value,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":e=>as(te({layerType:l},e))}}),paint:e=>r4({layer:a,key:e.key,value:e.value,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":e=>an(te({layerType:l},e))}})}}))}function al(e){let t=e.value,i=e.key,r=rz(t);return"string"!==r?[new e9(i,t,`string expected, ${r} found`)]:[]}let ah={promoteId:function({key:e,value:t}){if("string"===rz(t))return al({key:e,value:t});{let i=[];for(let r in t)i.push(...al({key:`${e}.${r}`,value:t[r]}));return i}}};function au(e){let t,i=e.value,r=e.key,a=e.styleSpec,n=e.style,s=e.validateSpec;if(!i.type)return[new e9(r,i,'"type" is required')];let o=r5(i.type);switch(o){case"vector":case"raster":return r4({key:r,value:i,valueSpec:a[`source_${o.replace("-","_")}`],style:e.style,styleSpec:a,objectElementValidators:ah,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=rz(r);if(void 0===r)return o;if("object"!==l)return o.push(new e9("source_raster_dem",r,`object expected, ${l}
2 found`)),o;let h="custom"===r5(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 e9(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 e9(t,r[t],`unknown property "${t}"`));return o}({sourceName:r,value:i,style:e.style,styleSpec:a,validateSpec:s});case"geojson":if(t=r4({key:r,value:i,valueSpec:a.source_geojson,style:n,styleSpec:a,validateSpec:s,objectElementValidators:ah}),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(...ae({key:`${r}.${e}.map`,value:n,expressionContext:"cluster-map"})),t.push(...ae({key:`${r}.${e}.reduce`,value:s,expressionContext:"cluster-reduce"}))}return t;case"video":return r4({key:r,value:i,valueSpec:a.source_video,style:n,validateSpec:s,styleSpec:a});case"image":return r4({key:r,value:i,valueSpec:a.source_image,style:n,validateSpec:s,styleSpec:a});case"canvas":return[new e9(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return ai({key:`${r}.type`,value:i.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function ac(e){let t=e.value,i=e.styleSpec,r=i.light,a=e.style,n=[],s=rz(t);if(void 0===t)return n;if("object"!==s)return n.concat([new e9("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 e9(s,t[s],`unknown property "${s}"`)])}return n}function ad(e){let t=e.value,i=e.styleSpec,r=i.sky,a=e.style,n=rz(t);if(void 0===t)return[];if("object"!==n)return[new e9("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 e9(n,t[n],`unknown property "${n}"`)]);return s}function ap(e){let t=e.value,i=e.styleSpec,r=i.terrain,a=e.style,n=[],s=rz(t);if(void 0===t)return n;if("object"!==s)return n.concat([new e9("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 e9(s,t[s],`unknown property "${s}"`)]);return n}function af(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 e9(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 e9(r,i,`all the sprites' URLs must be unique, but ${i[s].url} is duplicated`)),n.push(i[s].url),t=t.concat(r4({key:`${r}[${s}]`,value:i[s],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:e.validateSpec}));return t}return al({key:r,value:i})}function am(e){return!!e&&e.constructor===Object}function a_(e){return am(e.value)?[]:[new e9(e.key,e.value,`object expected, ${rz(e.value)} found`)]}let ag={"*":()=>[],array:r8,boolean:function(e){let t=e.value,i=e.key,r=rz(t);return"boolean"!==r?[new e9(i,t,`boolean expected, ${r} found`)]:[]},number:r7,color:at,constants:r3,enum:ai,filter:ar,function:r9,layer:ao,object:r4,source:au,light:ac,sky:ad,terrain:ap,projection:function(e){let t=e.value,i=e.styleSpec,r=i.projection,a=e.style,n=rz(t);if(void 0===t)return[];if("object"!==n)return[new e9("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 e9(n,t[n],`unknown property "${n}"`)]);return s},projectionDefinition:function(e){var t;let i=e.key,r=e.value,a=rz(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 e9(i,r,`projection expected, invalid type "${a}" found`)]:[new e9(i,r,`projection expected, invalid array ${JSON.stringify(r)} found`)]},string:al,formatted:function(e){return 0===al(e).length?[]:ae(e)},resolvedImage:function(e){return 0===al(e).length?[]:ae(e)},padding:function(e){let t=e.key,i=e.value;if("array"===rz(i)){if(i.length<1||i.length>4)return[new e9(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 r7({key:t,value:i,valueSpec:{}}
2)},numberArray:function(e){let t=e.key,i=e.value;if("array"===rz(i)){let r={type:"number"};if(i.length<1)return[new e9(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 r7({key:t,value:i,valueSpec:{}})},colorArray:function(e){let t=e.key,i=e.value;if("array"===rz(i)){if(i.length<1)return[new e9(t,i,"array length at least 1 expected, length 0 found")];let e=[];for(let r=0;r<i.length;r++)e=e.concat(at({key:`${t}[${r}]`,value:i[r]}));return e}return at({key:t,value:i})},variableAnchorOffsetCollection:function(e){let t=e.key,i=e.value,r=rz(i),a=e.styleSpec;if("array"!==r||i.length<1||i.length%2!=0)return[new e9(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(ai({key:`${t}[${r}]`,value:i[r],valueSpec:a.layout_symbol["text-anchor"]}))).concat(r8({key:`${t}[${r+1}]`,value:i[r+1],valueSpec:{length:2,value:"number"},validateSpec:e.validateSpec,style:e.style,styleSpec:a}));return n},sprite:af,state:a_,fontFaces:function(e){let t=e.key,i=e.value,r=e.validateSpec,a=e.styleSpec,n=e.style;if(!am(i))return[new e9(t,i,`object expected, ${rz(i)} found`)];let s=[];for(let e in i){let o=i[e],l=rz(o);if("string"===l)s.push(...al({key:`${t}.${e}`,value:o}));else if("array"===l){let i={url:{type:"string",required:!0},"unicode-range":{type:"array",value:"string"}};for(let[l,h]of o.entries())s.push(...r4({key:`${t}.${e}[${l}]`,value:h,valueSpec:i,styleSpec:a,style:n,validateSpec:r}))}else s.push(new e9(`${t}.${e}`,o,`string or array expected, ${l} found`))}return s}};function ay(e){let t=e.value,i=e.valueSpec,r=e.styleSpec;return e.validateSpec=ay,i.expression&&rk(r5(t))?r9(e):i.expression&&rN(r6(t))?ae(e):i.type&&ag[i.type]?ag[i.type](e):r4(te({},e,{valueSpec:i.type?r[i.type]:i}))}function ax(e){let t=e.value,i=e.key,r=al(e);return r.length||(-1===t.indexOf("{fontstack}")&&r.push(new e9(i,t,'"glyphs" url must include a "{fontstack}" token')),-1===t.indexOf("{range}")&&r.push(new e9(i,t,'"glyphs" url must include a "{range}" token'))),r}function av(e,t=e0){let i=[];return i=i.concat(ay({key:"",value:e,valueSpec:t.$root,styleSpec:t,style:e,validateSpec:ay,objectElementValidators:{glyphs:ax,"*":()=>[]}})),e.constants&&(i=i.concat(r3({key:"constants",value:e.constants}))),aw(i)}function ab(e){return function(t){return e(Object.assign({},t,{validateSpec:ay}))}}function aw(e){return[].concat(e).sort((e,t)=>e.line-t.line)}function aT(e){return function(...t){return aw(e.apply(this,t))}}av.source=aT(ab(au)),av.sprite=aT(ab(af)),av.glyphs=aT(ab(ax)),av.light=aT(ab(ac)),av.sky=aT(ab(ad)),av.terrain=aT(ab(ap)),av.state=aT(ab(a_)),av.layer=aT(ab(ao)),av.filter=aT(ab(ar)),av.paintProperty=aT(ab(an)),av.layoutProperty=aT(ab(as));let aS={type:"enum","property-type":"data-constant",expression:{interpolated:!1,parameters:["global-state"]},values:{visible:{},none:{}},transition:!1,default:"visible"};class aP{constructor(e,t){this._globalState=t,this.setValue(e)}evaluate(){var e;return null!=(e=this._literalValue)?e:this._compiledValue.evaluate({})}setValue(e){if(null==e||"visible"===e||"none"===e)return this._literalValue="none"===e?"none":"visible",this._compiledValue=void 0,void(this._globalStateRefs=new Set);let t=rU(e,aS,this._globalState);if("error"===t.result)throw this._literalValue="visible",this._compiledValue=void 0,Error(t.value.map(e=>`${e.key}: ${e.message}`).join(", "));this._literalValue=void 0,this._compiledValue=t.value,this._globalStateRefs=rW(t.value.expression)}getGlobalStateRefs(){return this._globalStateRefs}}let aM=av.light,aI=av.sky,aE=av.paintProperty,aC=av.layoutProperty;function aA(e,t){let i=!1;if(null!=t&&t.length)for(let r of t)e.fire(new eJ(Error(r.message))),i=!0;return i}class aD{constructor(e,t,i){let r=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;let 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++){let t=a[3+e],i=a[3+e+1];r.push(t===i?null:a.subarray(t,i))}let 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;let a=i/t*e;this.min=-a,this.max=e+a}
2insert(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[...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 of l)if(void 0===s[u]){let l=4*u;(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[u]=!0,n.push(a[u])):s[u]=!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 p=l;p<=u;p++)for(let l=h;l<=c;l++){let h=this.d*l+p;if((!o||o(this._convertFromCellCoord(p),this._convertFromCellCoord(l),this._convertFromCellCoord(p+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 of this.cells)i+=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 aD(e.buffer)}}let az={};function ak(e,t,i={}){if(az[e])throw Error(`${e} is already registered.`);Object.defineProperty(t,"_classRegistryKey",{value:e,writeable:!1}),az[e]={klass:t,omit:i.omit||[],shallow:i.shallow||[]}}for(let e in ak("Object",Object),ak("Set",Set),ak("TransferableGridIndex",aD),ak("Color",tq),ak("Error",Error),ak("AJAXError",eZ),ak("ResolvedImage",t3),ak("StylePropertyFunction",rq),ak("StyleExpression",rj,{omit:["_evaluator"]}),ak("ZoomDependentExpression",r$),ak("ZoomConstantExpression",rG),ak("CompoundExpression",rx,{omit:["_evaluate"]}),ry)ry[e]._classRegistryKey||ak(`Expression_${e}`,ry[e]);function aR(e){var t;return e&&"u">typeof ArrayBuffer&&(e instanceof ArrayBuffer||(null==(t=e.constructor)?void 0:t.name)==="ArrayBuffer")}function aL(e){return e.$name||e.constructor._classRegistryKey}function aF(e){return!function(e){if(null===e||"object"!=typeof e)return!1;let t=aL(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||aR(e)||eA(e)||ArrayBuffer.isView(e)||e instanceof ImageData)}function aB(e,t){if(aF(e))return(aR(e)||eA(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(aB(r,t));return i}if("object"!=typeof e)throw Error("can't serialize object of type "+typeof e);let i=aL(e);if(!i)throw Error(`can't serialize object of unregistered class ${e.constructor.name}`);if(!az[i])throw Error(`${i} is not registered.`);let{klass:r}=az[i],a=r.serialize?r.serialize(e,t):{};if(r.serialize){if(a===(null==t?void 0: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)||az[i].omit.includes(r))continue;let n=e[r];a[r]=az[i].shallow.includes(r)?n:aB(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 aO(e){if(aF(e))return e;if(Array.isArray(e))return e.map(aO);if("object"!=typeof e)throw Error("can't deserialize object of type "+typeof e);let t=aL(e)||"Object";if(!az[t])throw Error(`can't deserialize unregistered class ${t}`);let{klass:i}=az[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]=az[t].shallow.includes(i)?a:aO(a)}return r}class aV{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))}}function aj(e){return/[\u02EA\u02EB\u1100-\u11FF\u1400-\u167F\u18B0-\u18F5\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u3007\u3012\u3013\u3020-\u302F\u3031-\u303F\u3041-\u3096\u309D-\u30FB\u30FD-\u30FF\u3105-\u312F\u3131-\u318E\u3190-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE48\uFE50-\uFE57\uFE5F-\uFE62\uFE67-\uFE6F\uFF00-\uFF07\uFF0A-\uFF0C\uFF0E-\uFF19\uFF1F-\uFF3A\uFF3C\uFF3E\uFF40-\uFF5A\uFFE0-\uFFE2\uFFE4-\uFFE7]|\uD802[\uDD80-\uDD9F]|\uD805[\uDD80-\uDDFF]|\uD806[\uDE00-\uDEBF]|\uD811[\uDC00-\uDE7F]|\uD81B[\uDFE0-\uDFE4\uDFF0-\uDFF6]|[\uD81C-\uD822\uD83D\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD30-\uDEFB]|\uD833[\uDEC0-\uDFCF]|\uD834[\uDC00-\uDDFF\uDEE0-\uDF7F]|\uD836[\uDC00-\uDEAF]|\uD83C[\uDC00-\uDE00\uDF00-\uDFFF]|\uD83E[\uDD00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(e))}function aN(e){return/\s/u.test(String.fromCodePoint(e))}function aU(e){for(let t of e)if(aj(t.codePointAt(0)))return!0;return!1}function aG(e){return RegExp(e.map(e=>{try{return RegExp(`\\p{sc=${e}}`,"u").source}catch{return null}}).filter(e=>e).join("|"),"u")}let a$=aG(["Arab","Dupl","Mong","Ougr","Syrc"]);function aZ(e){return!(aj(e)||/[\xA7\xA9\xAE\xB1\xBC-\xBE\xD7\xF7\u2016\u2020\u2021\u2030\u2031\u203B\u203C\u2042\u2047-\u2049\u2051\u2100-\u218F\u221E\u2234\u2235\u2300-\u2307\u230C-\u231F\u2324-\u2328\u232B\u237D-\u239A\u23BE-\u23CD\u23CF\u23D1-\u23DB\u23E2-\u2422\u2424-\u24FF\u25A0-\u2619\u2620-\u2767\u2776-\u2793\u2B12-\u2B2F\u2B50-\u2B59\u2BB8-\u2BEB\u3000-\u303F\u30A0-\u30FF\uE000-\uF8FF\uFE30-\uFE6F\uFF00-\uFFEF\uFFFC\uFFFD]|[\uDB80-\uDBFF][\uDC00-\uDFFF]/gim.test(String.fromCodePoint(e)))}
2let aq=aG(["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 aW(e){return aq.test(String.fromCodePoint(e))}let aH=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(aH.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 b(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 aX{constructor(e,t){this.isSupportedScript=aY,this.zoom=e,t?(this.now=t.now||0,this.fadeDuration=t.fadeDuration||0,this.zoomHistory=t.zoomHistory||new aV,this.transition=t.transition||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new aV,this.transition={})}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}}}function aY(e){var t,i="loaded"===aH.getRTLTextPluginStatus();for(let r of e)if(t=r.codePointAt(0),!i&&aW(t)||/[\u0900-\u0DFF\u0F00-\u109F\u1780-\u17FF]/gim.test(String.fromCodePoint(t)))return!1;return!0}let aK="-transition";class aJ{constructor(e,t,i){this.property=e,this.value=t,this.expression=function(e,t,i){if(rk(e))return new rq(e,t);if(rN(e)){let r=rZ(e,t,i);if("error"===r.result)throw Error(r.value.map(e=>`${e.key}: ${e.message}`).join(", "));return r.value}{let i=e;return"color"===t.type&&"string"==typeof e?i=tq.parse(e):"padding"===t.type&&("number"==typeof e||Array.isArray(e))?i=tK.parse(e):"numberArray"===t.type&&("number"==typeof e||Array.isArray(e))?i=tJ.parse(e):"colorArray"===t.type&&("string"==typeof e||Array.isArray(e))?i=tQ.parse(e):"variableAnchorOffsetCollection"===t.type&&Array.isArray(e)?i=t2.parse(e):"projectionDefinition"===t.type&&"string"==typeof e&&(i=t5.parse(e)),{globalStateRefs:new Set,_globalState:null,kind:"constant",evaluate:()=>i}}}(void 0===t?e.specification.default:t,e.specification,i)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(e,t,i){return this.property.possiblyEvaluate(this,e,t,i)}}class aQ{constructor(e,t){this.property=e,this.value=new aJ(e,void 0,t)}transitioned(e,t){return new a1(this.property,this.value,t,ev({},e.transition,this.transition),e.now)}untransitioned(){return new a1(this.property,this.value,null,{},0)}}class a0{constructor(e,t){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._globalState=t}hasProperty(e){return e in this._properties.defaultTransitionablePropertyValues}getValue(e){return eS(this._values[e].value.value)}setValue(e,t){Object.hasOwn(this._values,e)||(this._values[e]=new aQ(this._values[e].property,this._globalState)),this._values[e].value=new aJ(this._values[e].property,null===t?void 0:eS(t),this._globalState)}getTransition(e){return eS(this._values[e].transition)}setTransition(e,t){Object.hasOwn(this._values,e)||(this._values[e]=new aQ(this._values[e].property,this._globalState)),this._values[e].transition=eS(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}${aK}`]=r)}return e}transitioned(e,t){let i=new a2(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 a2(this._properties);for(let t of Object.keys(this._values))e._values[t]=this._values[t].untransitioned();return e}}class a1{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,em(s))}}return a}}class a2{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,t,i){let r=new a6(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 a3{constructor(e,t){this._properties=e,this._values=Object.create(e.defaultPropertyValues),this._globalState=t}hasValue(e){return void 0!==this._values[e].value}hasProperty(e){return e in this._properties.defaultPropertyValues}getValue(e){return eS(this._values[e].value)}setValue(e,t){this._values[e]=new aJ(this._values[e].property,null===t?void 0:eS(t),this._globalState)}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 a6(this._properties);for(let a of Object.keys(this._values))r._values[a]=this._values[a].possiblyEvaluate(e,t,i);return r}}class a5{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 a6{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class a4{constructor(e){this.specification=e}
2possiblyEvaluate(e,t){if(e.isDataDriven())throw Error("Value should not be data driven");return e.expression.evaluate(t)}interpolate(e,t,i){let r=iE[this.specification.type];return r?r(e,t,i):e}}class a8{constructor(e,t){this.specification=e,this.overrides=t}possiblyEvaluate(e,t,i,r){return new a5(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 a5(this,{kind:"constant",value:void 0},e.parameters);let r=iE[this.specification.type];return r?new a5(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 a7 extends a8{possiblyEvaluate(e,t,i,r){if(void 0===e.value)return new a5(this,{kind:"constant",value:void 0},t);if("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 a5(this,{kind:"constant",value:this._calculate(n,n,n,t)},t)}return"camera"===e.expression.kind?new a5(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 a5(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 a9{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 aX(Math.floor(t.zoom-1),t)),e.expression.evaluate(new aX(Math.floor(t.zoom),t)),e.expression.evaluate(new aX(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 ne{constructor(e){this.specification=e}possiblyEvaluate(e,t,i,r){return!!e.expression.evaluate(t,null,{},i,r)}interpolate(){return!1}}class nt{constructor(e){for(let t in this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[],e){let i=e[t];i.specification.overridable&&this.overridableProperties.push(t);let r=this.defaultPropertyValues[t]=new aJ(i,void 0,void 0),a=this.defaultTransitionablePropertyValues[t]=new aQ(i,void 0);this.defaultTransitioningPropertyValues[t]=a.untransitioned(),this.defaultPossiblyEvaluatedValues[t]=r.possiblyEvaluate({})}}}ak("DataDrivenProperty",a8),ak("DataConstantProperty",a4),ak("CrossFadedDataDrivenProperty",a7),ak("CrossFadedProperty",a9),ak("ColorRampProperty",ne);let ni=" is a PAINT property not a LAYOUT property. Use get/setPaintProperty instead?",nr=" is a LAYOUT property not a PAINT property. Use get/setLayoutProperty instead?";class na extends eQ{constructor(e,t,i){if(super(),this.id=e.id,this.type=e.type,this._globalState=i,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},this._visibilityExpression=new aP(this.visibility,i),"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=rK(e.filter,i)),t.layout&&(this._unevaluatedLayout=new a3(t.layout,i)),t.paint)){for(let r in this._transitionablePaint=new a0(t.paint,i),e.paint)this.setPaintProperty(r,e.paint[r],{validate:!1});for(let t in e.layout)this.setLayoutProperty(t,e.layout[t],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new a6(t.paint)}}setFilter(e){this.filter=e,this._featureFilter=rK(e,this._globalState)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){var t;if("visibility"===e)return this.visibility;if(null!=(t=this._transitionablePaint)&&t.hasProperty(e))throw Error(e+ni);if(!this._unevaluatedLayout)throw Error(`Cannot get layout property "${e}" on layer type "${this.type}" which has no layout properties.`);return this._unevaluatedLayout.getValue(e)}getLayoutAffectingGlobalStateRefs(){let e=new Set;for(let t of this._visibilityExpression.getGlobalStateRefs())e.add(t);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}getPaintAffectingGlobalStateRefs(){var e;let t=new globalThis.Map;if(this._transitionablePaint)for(let i in this._transitionablePaint._values){let r=this._transitionablePaint._values[i].value;for(let a of r.getGlobalStateRefs()){let n=null!=(e=t.get(a))?e:[];n.push({name:i,value:r.value}),t.set(a,n)}}return t}getVisibilityAffectingGlobalStateRefs(){return this._visibilityExpression.getGlobalStateRefs()}setLayoutProperty(e,t,i={}){var r;if("visibility"===e)return this.visibility=t,this._visibilityExpression.setValue(t),void this.recalculateVisibility();null!=(r=this._transitionablePaint)&&r.hasProperty(e)?this.fire(new eJ(Error(e+ni))):null!=t&&this._val
2idate(aC,`layers.${this.id}.layout.${e}`,e,t,i)||this._unevaluatedLayout.setValue(e,t)}getPaintProperty(e){var t,i;if(e.endsWith(aK)){let i=e.slice(0,-11);if("visibility"===i||null!=(t=this._unevaluatedLayout)&&t.hasProperty(i))throw Error(e+nr);return this._transitionablePaint.getTransition(i)}if("visibility"===e||null!=(i=this._unevaluatedLayout)&&i.hasProperty(e))throw Error(e+nr);return this._transitionablePaint.getValue(e)}setPaintProperty(e,t,i={}){var r;if("visibility"===e||null!=(r=this._unevaluatedLayout)&&r.hasProperty(e))return this.fire(new eJ(Error(e+nr))),!1;if(null!=t&&this._validate(aE,`layers.${this.id}.paint.${e}`,e,t,i))return!1;if(e.endsWith(aK))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}isHidden(e=this.minzoom,t=!1){return!!(this.minzoom&&e<(t?Math.floor(this.minzoom):this.minzoom))||!!(this.maxzoom&&e>=this.maxzoom)||"none"===this._evaluatedVisibility}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculateVisibility(){this._evaluatedVisibility=this._visibilityExpression.evaluate()}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(){var e,t;
2let i={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:null==(e=this._unevaluatedLayout)?void 0:e.serialize(),paint:null==(t=this._transitionablePaint)?void 0:t.serialize()};return this.visibility&&(i.layout||(i.layout={}),i.layout.visibility=this.visibility),eT(i,(e,t)=>!(void 0===e||"layout"===t&&!Object.keys(e).length||"paint"===t&&!Object.keys(e).length))}_validate(e,t,i,r,a={}){return(null==a?void 0:a.validate)!==!1&&aA(this,e.call(av,{key:t,layerType:this.type,objectKey:i,value:r,styleSpec:e0,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 a5&&rC(t.property.specification)&&("source"===t.value.kind||"composite"===t.value.kind)&&t.value.isStateDependent)return!0}return!1}}var nn={get paint(){return n=n||new nt({"raster-opacity":new a4(e0.paint_raster["raster-opacity"]),"raster-hue-rotate":new a4(e0.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new a4(e0.paint_raster["raster-brightness-min"]),"raster-brightness-max":new a4(e0.paint_raster["raster-brightness-max"]),"raster-saturation":new a4(e0.paint_raster["raster-saturation"]),"raster-contrast":new a4(e0.paint_raster["raster-contrast"]),resampling:new a4(e0.paint_raster.resampling),"raster-resampling":new a4(e0.paint_raster["raster-resampling"]),"raster-fade-duration":new a4(e0.paint_raster["raster-fade-duration"])})}};class ns extends na{constructor(e,t){super(e,nn,t)}}let no={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};
vendor: 4,291 bytes, line 2
2class nl{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 nh{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")}freeBufferAfterUpload(){this.arrayBuffer=new ArrayBuffer(0),this._refreshViews()}}function nu(e,t=1){let i=0,r=0;return{members:e.map(e=>{let a=no[e.type].BYTES_PER_ELEMENT,n=i=nc(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:nc(i,Math.max(r,t)),alignment:t}}function nc(e,t){return Math.ceil(e/t)*t}class nd extends nh{_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}}nd.prototype.bytesPerElement=4,ak("StructArrayLayout2i4",nd);class np extends nh{_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}}np.prototype.bytesPerElement=6,ak("StructArrayLayout3i6",np);class nf extends nh{_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}}nf.prototype.bytesPerElement=8,ak("StructArrayLayout4i8",nf);class nm extends nh{_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}}nm.prototype.bytesPerElement=12,ak("StructArrayLayout2i4i12",nm);class n_ extends nh{_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}}n_.prototype.bytesPerElement=8,ak("StructArrayLayout2i4ub8",n_);class ng extends nh{_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}}ng.prototype.bytesPerElement=8,ak("StructArrayLayout2f8",ng);class ny extends nh{_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}}ny.prototype.bytesPerElement=20,ak("StructArrayLayout10ui20",ny);
2class nx extends nh{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,a,n,s,o){let l=this.length;return this.resize(l+1),this.emplace(l,e,t,i,r,a,n,s,o)}emplace(e,t,i,r,a,n,s,o,l){let h=8*e;return this.uint16[h+0]=t,this.uint16[h+1]=i,this.uint16[h+2]=r,this.uint16[h+3]=a,this.uint16[h+4]=n,this.uint16[h+5]=s,this.uint16[h+6]=o,this.uint16[h+7]=l,e}}nx.prototype.bytesPerElement=16,ak("StructArrayLayout8ui16",nx);class nv extends nh{_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 p=this.length;return this.resize(p+1),this.emplace(p,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,p){let f=12*e;return this.int16[f+0]=t,this.int16[f+1]=i,this.int16[f+2]=r,this.int16[f+3]=a,this.uint16[f+4]=n,this.uint16[f+5]=s,this.uint16[f+6]=o,this.uint16[f+7]=l,this.int16[f+8]=h,this.int16[f+9]=u,this.int16[f+10]=c,this.int16[f+11]=p,e}}nv.prototype.bytesPerElement=24,ak("StructArrayLayout4i4ui4i24",nv);class nb extends nh{_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}}nb.prototype.bytesPerElement=12,ak("StructArrayLayout3f12",nb);class nw extends nh{_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}}nw.prototype.bytesPerElement=4,ak("StructArrayLayout1ul4",nw);class nT extends nh{_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}}nT.prototype.bytesPerElement=20,ak("StructArrayLayout6i1ul2ui20",nT);class nS extends nh{_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}}nS.prototype.bytesPerElement=12,ak("StructArrayLayout2i2i2i12",nS);class nP extends nh{_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}}nP.prototype.bytesPerElement=16,ak("StructArrayLayout2f1f2i16",nP);class nM extends nh{_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}}nM.prototype.bytesPerElement=16,ak("StructArrayLayout2ub2f2i16",nM);class nI extends nh{_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}}
vendor: 4,303 bytes, line 2
2nI.prototype.bytesPerElement=6,ak("StructArrayLayout3ui6",nI);class nE extends nh{_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,p,f,m,_,g){let y=this.length;return this.resize(y+1),this.emplace(y,e,t,i,r,a,n,s,o,l,h,u,c,p,f,m,_,g)}emplace(e,t,i,r,a,n,s,o,l,h,u,c,p,f,m,_,g,y){let x=24*e,v=12*e,b=48*e;return this.int16[x+0]=t,this.int16[x+1]=i,this.uint16[x+2]=r,this.uint16[x+3]=a,this.uint32[v+2]=n,this.uint32[v+3]=s,this.uint32[v+4]=o,this.uint16[x+10]=l,this.uint16[x+11]=h,this.uint16[x+12]=u,this.float32[v+7]=c,this.float32[v+8]=p,this.uint8[b+36]=f,this.uint8[b+37]=m,this.uint8[b+38]=_,this.uint32[v+10]=g,this.int16[x+22]=y,e}}nE.prototype.bytesPerElement=48,ak("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",nE);class nC extends nh{_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,p,f,m,_,g,y,x,v,b,w,T,S,P,M,I,E){let C=this.length;return this.resize(C+1),this.emplace(C,e,t,i,r,a,n,s,o,l,h,u,c,p,f,m,_,g,y,x,v,b,w,T,S,P,M,I,E)}emplace(e,t,i,r,a,n,s,o,l,h,u,c,p,f,m,_,g,y,x,v,b,w,T,S,P,M,I,E,C){let A=32*e,D=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]=p,this.uint16[A+12]=f,this.uint16[A+13]=m,this.uint16[A+14]=_,this.uint16[A+15]=g,this.uint16[A+16]=y,this.uint16[A+17]=x,this.uint16[A+18]=v,this.uint16[A+19]=b,this.uint16[A+20]=w,this.uint16[A+21]=T,this.uint16[A+22]=S,this.uint32[D+12]=P,this.float32[D+13]=M,this.float32[D+14]=I,this.uint16[A+30]=E,this.uint16[A+31]=C,e}}nC.prototype.bytesPerElement=64,ak("StructArrayLayout8i15ui1ul2f2ui64",nC);class nA extends nh{_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}}nA.prototype.bytesPerElement=4,ak("StructArrayLayout1f4",nA);class nD extends nh{_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}}nD.prototype.bytesPerElement=12,ak("StructArrayLayout1ui2f12",nD);class nz extends nh{_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}}nz.prototype.bytesPerElement=8,ak("StructArrayLayout1ul2ui8",nz);class nk extends nh{_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}}nk.prototype.bytesPerElement=4,ak("StructArrayLayout2ui4",nk);class nR extends nh{_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}}nR.prototype.bytesPerElement=2,ak("StructArrayLayout1ui2",nR);class nL extends nh{_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}}nL.prototype.bytesPerElement=16,ak("StructArrayLayout4f16",nL);
vendor: 4,367 bytes, line 2
2class nF extends nl{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 w(this.anchorPointX,this.anchorPointY)}}nF.prototype.size=20;class nB extends nT{get(e){return new nF(this,e)}}ak("CollisionBoxArray",nB);class nO extends nl{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]}}nO.prototype.size=48;class nV extends nE{get(e){return new nO(this,e)}}ak("PlacedSymbolArray",nV);class nj extends nl{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]}}nj.prototype.size=64;class nN extends nC{get(e){return new nj(this,e)}}ak("SymbolInstanceArray",nN);
2class nU extends nA{getoffsetX(e){return this.float32[+e+0]}}ak("GlyphOffsetArray",nU);class nG extends np{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}ak("SymbolLineVertexArray",nG);class n$ extends nl{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]}}n$.prototype.size=12;class nZ extends nD{get(e){return new n$(this,e)}}ak("TextAnchorOffsetArray",nZ);class nq extends nl{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]}}nq.prototype.size=8;class nW extends nz{get(e){return new nq(this,e)}}ak("FeatureIndexArray",nW);class nH extends nd{}class nX extends nd{}class nY extends nd{}class nK extends nm{}class nJ extends n_{}class nQ extends ng{}class n0 extends ny{}class n1 extends nx{}class n2 extends nv{}class n3 extends nb{}class n5 extends nw{}class n6 extends nS{}class n4 extends nM{}class n8 extends nI{}class n7 extends nk{}let{members:n9}=nu([{name:"a_pos",components:2,type:"Int16"}],4);class se{constructor(e=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=e}prepareSegment(e,t,i,r){let a=this.segments[this.segments.length-1];return e>se.MAX_VERTEX_ARRAY_LENGTH&&eM(`Max vertices per segment is ${se.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${se.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!a||a.vertexLength+e>se.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 se([{vertexOffset:e,primitiveOffset:t,vertexLength:i,primitiveLength:r,vaos:{},sortKey:0}])}}function st(e,t){return 256*(e=ey(Math.floor(e),0,255))+ey(Math.floor(t),0,255)}se.MAX_VERTEX_ARRAY_LENGTH=65535,ak("SegmentVector",se);let si=nu([{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"}]),sr=nu([{name:"a_dasharray_from",components:4,type:"Uint16"},{name:"a_dasharray_to",components:4,type:"Uint16"}]);var sa,sn,ss,so={exports:{}},sl={exports:{}},sh={exports:{}},su=T(function(){if(ss)return so.exports;ss=1;var e=(sa||(sa=1,sl.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}),sl.exports),t=(sn||(sn=1,sh.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),sh.exports);return so.exports=e,so.exports.murmur3=e,so.exports.murmur2=t,so.exports}());class sc{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,t,i,r){this.ids.push(sd(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=sd(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;sp(t,s,o),sp(i,3*s,3*o),sp(i,3*s+1,3*o+1),sp(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 sc;return t.ids=e.ids,t.positions=e.positions,t.indexed=!0,t}}function sd(e){let t=+e;return!isNaN(t)&&t<=Number.MAX_SAFE_INTEGER?t:su(String(e))}function sp(e,t,i){let r=e[t];e[t]=e[i],e[i]=r}ak("FeaturePositionMap",sc);class sf{constructor(e,t){this.gl=e.gl,this.location=t}}class sm extends sf{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}}class s_ extends sf{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 sg extends sf{constructor(e,t){super(e,t),this.current=tq.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 sy=new Float32Array(16);function sx(e){return[st(255*e.r,255*e.g),st(255*e.b,255*e.a)]}class sv{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 sg(e,t):new sm(e,t)}}class sb{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}setConstantDashPositions(e,t){this.dashTo=[0,e.y,e.height,e.width],this.dashFrom=[0,t.y,t.height,t.width]}setUniform(e,t,i,r){let a=null;"u_pattern_to"===r?a=this.patternTo:"u_pattern_from"===r?a=this.patternFrom:"u_dasharray_to"===r?a=this.dashTo:"u_dasharray_from"===r?a=this.dashFrom:"u_pixel_ratio_to"===r?a=this.pixelRatioTo:"u_pixel_ratio_from"===r&&(a=this.pixelRatioFrom),null!==a&&e.set(a)}getBinding(e,t,i){return i.startsWith("u_pattern")||i.startsWith("u_dasharray_")?new s_(e,t):new sm(e,t)}}class sw{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){let r=this.paintVertexArray.length,a=this.expression.evaluate(new aX(0,i),t,{},i.canonical,[],i.formattedSection);this.paintVertexArray.resize(e),this._setPaintValue(r,e,a)}updatePaintArray(e,t,i,r,a){let n=this.expression.evaluate(new aX(0,a),i,r);this._setPaintValue(e,t,n)}_setPaintValue(e,t,i){if("color"===this.type){let r=sx(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){var t,i;null!=(t=this.paintVertexArray)&&t.arrayBuffer.byteLength&&(null!=(i=this.paintVertexBuffer)&&i.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class sT{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){let r=this.expression.evaluate(new aX(this.zoom,i),t,{},i.canonical,[],i.formattedSection),a=this.expression.evaluate(new aX(this.zoom+1,i),t,{},i.canonical,[],i.formattedSection),n=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(n,e,r,a)}updatePaintArray(e,t,i,r,a){let n=this.expression.evaluate(new aX(this.zoom,a),i,r),s=this.expression.evaluate(new aX(this.zoom+1,a),i,r);this._setPaintValue(e,t,n,s)}_setPaintValue(e,t,i,r){if("color"===this.type){let a=sx(i),n=sx(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){var t,i;null!=(t=this.paintVertexArray)&&t.arrayBuffer.byteLength&&(null!=(i=this.paintVertexBuffer)&&i.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=ey(this.expression.interpolationFactor(i,this.zoom,this.zoom+1),0,1);e.set(r)}getBinding(e,t,i){return new sm(e,t)}}class sS{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,this.getPositionIds(t),i)}updatePaintArray(e,t,i,r,a){this._setPaintValues(e,t,this.getPositionIds(i),a)}_setPaintValues(e,t,i,r){let a=this.getPositions(r);if(!a||!i)return;let n=a[i.min],s=a[i.mid],o=a[i.max];if(n&&s&&o)for(let i=e;i<t;i++)this.emplace(this.zoomInPaintVertexArray,i,s,n),this.emplace(this.zoomOutPaintVertexArray,i,s,o)}upload(e){var t,i;if(null!=(t=this.zoomInPaintVertexArray)&&t.arrayBuffer.byteLength&&null!=(i=this.zoomOutPaintVertexArray)&&i.arrayBuffer.byteLength){let t=this.getVertexAttributes();this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,t,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,t,this.expression.isStateDependent)}}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class sP extends sS{getPositions(e){return e.imagePositions}getPositionIds(e){var t;return null==(t=e.patterns)?void 0:t[this.layerId]}getVertexAttributes(){return si.members}emplace(e,t,i,r){e.emplace(t,i.tlbr[0],i.tlbr[1],i.tlbr[2],i.tlbr[3],r.tlbr[0],r.tlbr[1],r.tlbr[2],r.tlbr[3],i.pixelRatio,r.pixelRatio)}}class sM extends sS{getPositions(e){return e.dashPositions}getPositionIds(e){var t;return null==(t=e.dashes)?void 0:t[this.layerId]}getVertexAttributes(){return sr.members}emplace(e,t,i,r){e.emplace(t,0,i.y,i.height,i.width,0,r.y,r.height,r.width)}}class sI{constructor(e,t,i){this.binders={},this._buffers=[];let r=[];for(let a in e.paint._values){if(!i(a))continue;let n=e.paint.get(a);if(!(n instanceof a5&&rC(n.property.specification)))continue;let 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-dasharray":["dasharray_to","dasharray_from"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]})[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 sb(o.value,s):new sv(o.value,s,l),r.push(`/u_${a}`);else if("source"===o.kind||c){let i=sC(a,l,"source");this.binders[a]=c?"line-dasharray"===a?new sM(o,l,h,t,i,e.id):new sP(o,l,h,t,i,e.id):new sw(o,s,l,i),r.push(`/a_${a}`)}else{let e=sC(a,l,"composite");this.binders[a]=new sT(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 sw||t instanceof sT?t.maxValue:0}populatePaintArrays(e,t,i){for(let r in this.binders){let a=this.binders[r];(a instanceof sw||a instanceof sT||a instanceof sS)&&a.populatePaintArray(e,t,i)}}setConstantPatternPositions(e,t){for(let i in this.binders){let r=this.binders[i];r instanceof sb&&r.setConstantPatternPositions(e,t)}}setConstantDashPositions(e,t){for(let i in this.binders){let r=this.binders[i];r instanceof sb&&r.setConstantDashPositions(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 sw||l instanceof sT||l instanceof sS)&&!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 sv||i instanceof sb)&&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 sw||i instanceof sT)for(let t of i.paintVertexAttributes)e.push(t.name);else if(i instanceof sS)for(let t of i.getVertexAttributes())e.push(t.name)}return e}getBinderUniforms(){let e=[];for(let t in this.binders){let i=this.binders[t];if(i instanceof sv||i instanceof sb||i instanceof sT)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 sv||a instanceof sb||a instanceof sT){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 sS){let t=2===e.fromScale?i.zoomInPaintVertexBuffer:i.zoomOutPaintVertexBuffer;t&&this._buffers.push(t)}else(i instanceof sw||i instanceof sT)&&i.paintVertexBuffer&&this._buffers.push(i.paintVertexBuffer)}}upload(e){for(let t in this.binders){let i=this.binders[t];(i instanceof sw||i instanceof sT||i instanceof sS)&&i.upload(e)}this.updatePaintBuffers()}destroy(){for(let e in this.binders){let t=this.binders[e];(t instanceof sw||t instanceof sT||t instanceof sS)&&t.destroy()}}}class sE{constructor(e,t,i=()=>!0){for(let r of(this.programConfigurations={},e))this.programConfigurations[r.id]=new sI(r,t,i);this.needsUpload=!1,this._featureMap=new sc,this._bufferOffset=0}populatePaintArrays(e,t,i,r){for(let i in this.programConfigurations)this.programConfigurations[i].populatePaintArrays(e,t,r);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 sC(e,t,i){let r={"line-pattern":{source:n0,composite:n0}
2,"fill-pattern":{source:n0,composite:n0},"fill-extrusion-pattern":{source:n0,composite:n0},"line-dasharray":{source:n1,composite:n1}}[e];return(null==r?void 0:r[i])||({color:{source:ng,composite:nL},number:{source:nA,composite:ng}})[t][i]}ak("ConstantBinder",sv),ak("CrossFadedConstantBinder",sb),ak("SourceExpressionBinder",sw),ak("CrossFadedPatternBinder",sP),ak("CrossFadedDasharrayBinder",sM),ak("CompositeExpressionBinder",sT),ak("ProgramConfiguration",sI,{omit:["_buffers"]}),ak("ProgramConfigurationSet",sE);let sA=-16383-1;function sD(e){let t=8192/e.extent,i=e.loadGeometry();for(let e of i)for(let i of e){let e=Math.round(i.x*t),r=Math.round(i.y*t);i.x=ey(e,sA,16383),i.y=ey(r,sA,16383),(e<i.x||e>i.x+1||r<i.y||r>i.y+1)&&eM("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return i}function sz(e,t){return{type:e.type,id:e.id,properties:e.properties,geometry:t?sD(e):[]}}class sk{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.id),this.index=e.index,this.hasDependencies=!1,this.layoutVertexArray=new nX,this.indexArray=new n8,this.segments=new se,this.programConfigurations=new sE(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;"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=sz(t,e);if(!this.layers[0]._featureFilter.filter(new aX(this.zoom),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:sD(t),patterns:{},sortKey:u};a.push(c)}for(let r of(s&&a.sort((e,t)=>
2e.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,{imagePositions:i})}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,n9),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,{imagePositions:{},canonical:r})}}function sR(e,t){for(let i of e)if(sN(t,i))return!0;for(let i of t)if(sN(e,i))return!0;return sB(e,t)}function sL(e,t,i){return!!sN(e,t)||sO(t,e,i)}function sF(e,t){if(1===e.length)return sj(t,e[0]);for(let i of t)for(let t of i)if(sN(e,t))return!0;for(let i of e)if(sj(t,i))return!0;for(let i of t)if(sB(e,i))return!0;return!1}function sB(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],eI(i,a,n=t[e+1])!==eI(r,a,n)&&eI(i,r,a)!==eI(i,r,n))return!0}}return!1}function sO(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(sV(e,t[i-1],t[i])<r)return!0;return!1}function sV(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 sj(e,t){let i,r,a=!1;for(let n of e)for(let e=0,s=n.length-1;e<n.length;s=e++)i=n[e],r=n[s],i.y>t.y!=r.y>t.y&&t.x<(r.x-i.x)*(t.y-i.y)/(r.y-i.y)+i.x&&(a=!a);return a}function sN(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 sU(e,t,i){let r=t.paint.get(e).value;return"constant"===r.kind?r.value:i.programConfigurations.get(t.id).getMaxValue(e)}function sG(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function s$(e,t,i,r,a){if(!t[0]&&!t[1])return e;let n=w.convert(t)._mult(a);"viewport"===i&&n._rotate(-r);let s=[];for(let t of e)s.push(t.sub(n));return s}function sZ({queryGeometry:e,size:t},i){return sL(e,i,t)}function sq({queryGeometry:e,size:t,transform:i,unwrappedTileID:r,getElevation:a},n){return sL(e,n,t*(i.projectTileCoordinates(n.x,n.y,r,a).signedDistanceFromCamera/i.cameraToCenterDistance))}function sW({queryGeometry:e,size:t,transform:i,unwrappedTileID:r,getElevation:a},n){let s=i.projectTileCoordinates(n.x,n.y,r,a).signedDistanceFromCamera,o=t*(i.cameraToCenterDistance/s);return sL(e,sY(n,i,r,a),o)}function sH({queryGeometry:e,size:t,transform:i,unwrappedTileID:r,getElevation:a},n){return sL(e,sY(n,i,r,a),t)}function sX({queryGeometry:e,size:t,transform:i,unwrappedTileID:r,getElevation:a,pitchAlignment:n="map",pitchScale:s="map"},o){let l="map"===n?"map"===s?sZ:sq:"map"===s?sW:sH,h={queryGeometry:e,size:t,transform:i,unwrappedTileID:r,getElevation:a};for(let e of o)for(let t of e)if(l(h,t))return!0;return!1}function sY(e,t,i,r){let a=t.projectTileCoordinates(e.x,e.y,i,r).point;return new w((.5*a.x+.5)*t.width,(-(.5*a.y)+.5)*t.height)}ak("CircleBucket",sk,{omit:["layers"]});var sK={get paint(){return o=o||new nt({"circle-radius":new a8(e0.paint_circle["circle-radius"]),"circle-color":new a8(e0.paint_circle["circle-color"]),"circle-blur":new a8(e0.paint_circle["circle-blur"]),"circle-opacity":new a8(e0.paint_circle["circle-opacity"]),"circle-translate":new a4(e0.paint_circle["circle-translate"]),"circle-translate-anchor":new a4(e0.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new a4(e0.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new a4(e0.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new a8(e0.paint_circle["circle-stroke-width"]),"circle-stroke-color":new a8(e0.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new a8(e0.paint_circle["circle-stroke-opacity"])})},get layout(){return s=s||new nt({"circle-sort-key":new a8(e0.layout_circle["circle-sort-key"])})}};class sJ extends na{constructor(e,t){super(e,sK,t)}createBucket(e){return new sk(e)}queryRadius(e){return sU("circle-radius",this,e)+sU("circle-stroke-width",this,e)+sG(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:i,geometry:r,transform:a,pixelsToTileUnits:n,unwrappedTileID:s,getElevation:o}){let l,h,u=s$(e,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-a.bearingInRadians,n),c=this.paint.get("circle-radius").evaluate(t,i)+this.paint.get("circle-stroke-width").evaluate(t,i),p=this.paint.get("circle-pitch-scale"),f=this.paint.get("circle-pitch-alignment");return"map"===f?(l=u,h=c*n):(l=u.map(e=>sY(e,a,s,o)),h=c),sX({queryGeometry:l,size:h,transform:a,unwrappedTileID:s,getElevation:o,pitchAlignment:f,pitchScale:p},r)}}class sQ extends sk{}ak("HeatmapBucket",sQ,{omit:["layers"]});var s0={get paint(){return l=l||new nt({"heatmap-radius":new a8(e0.paint_heatmap["heatmap-radius"]),"heatmap-weight":new a8(e0.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new a4(e0.paint_heatmap["heatmap-intensity"]),"heatmap-color":new ne(e0.paint_heatmap["heatmap-color"]),"heatmap-opacity":new a4(e0.paint_heatmap["heatmap-opacity"])})}};function s1(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 s2(e,{width:t,height:i},r){if(t===e.width&&i===e.height)return;let a=s1({},{width:t,height:i},r);
vendor: 12,345 bytes, line 2
2s3(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 s3(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 s5{constructor(e,t){s1(this,e,1,t)}resize(e){s2(this,e,1)}clone(){return new s5({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,i,r,a){s3(e,t,i,r,a,1)}}class s6{constructor(e,t){s1(this,e,4,t)}resize(e){s2(this,e,4)}replace(e,t){t?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new s6({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,i,r,a){s3(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 s4(e){let t=new Uint8Array(e.length);for(let i=0;i<e.length;i+=4){let r=e[i+3];t[i+0]=Math.round(e[i+0]*r/255),t[i+1]=Math.round(e[i+1]*r/255),t[i+2]=Math.round(e[i+2]*r/255),t[i+3]=r}return t}function s8(e){let t={},i=e.resolution||256,r=e.clips?e.clips.length:1,a=e.image||new s6({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}ak("AlphaImage",s5),ak("RGBAImage",s6);let s7="big-fb";class s9 extends na{createBucket(e){return new sQ(e)}constructor(e,t){super(e,s0,t),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){"heatmap-color"===e&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=s8({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(s7)&&this.heatmapFbos.delete(s7)}queryRadius(e){return sU("heatmap-radius",this,e)}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:i,geometry:r,transform:a,pixelsToTileUnits:n,unwrappedTileID:s,getElevation:o}){return sX({queryGeometry:e,size:this.paint.get("heatmap-radius").evaluate(t,i)*n,transform:a,unwrappedTileID:s,getElevation:o},r)}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&!this.isHidden()}}var oe={get paint(){return h=h||new nt({"hillshade-illumination-direction":new a4(e0.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-altitude":new a4(e0.paint_hillshade["hillshade-illumination-altitude"]),"hillshade-illumination-anchor":new a4(e0.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new a4(e0.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new a4(e0.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new a4(e0.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new a4(e0.paint_hillshade["hillshade-accent-color"]),"hillshade-method":new a4(e0.paint_hillshade["hillshade-method"]),resampling:new a4(e0.paint_hillshade.resampling)})}};class ot extends na{constructor(e,t){super(e,oe,t),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(eR);return{directionRadians:e.map(eR),altitudeRadians:n,shadowColor:r,highlightColor:i}}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&!this.isHidden()}}var oi={get paint(){return u=u||new nt({"color-relief-opacity":new a4(e0["paint_color-relief"]["color-relief-opacity"]),"color-relief-color":new ne(e0["paint_color-relief"]["color-relief-color"]),resampling:new a4(e0["paint_color-relief"].resampling)})}};class or{constructor(e,t,i,r){this.context=e,this.format=i,this.texture=e.gl.createTexture(),this._ownedHandle=this.texture,this.update(t,r)}update(e,t,i){var r;let{width:a,height:n}=e,s=((null==(r=this.size)?void 0:r[0])!==a||this.size[1]!==n)&&!i,{context:o}=this,{gl:l}=o;this.useMipmap=!!(null!=t&&t.useMipmap),l.bindTexture(l.TEXTURE_2D,this.texture),o.pixelStoreUnpackFlipY.set(!1),o.pixelStoreUnpack.set(1);let h=this.format===l.RGBA&&(null==t?void 0:t.premultiply)!==!1;if(s)this.size=[a,n],"data"in e?(o.pixelStoreUnpackPremultiplyAlpha.set(!1),this._uploadRawData(e,h,a,n,l)):(o.pixelStoreUnpackPremultiplyAlpha.set(h),this._uploadDomImage(e,l));else{let{x:t,y:r}=i||{x:0,y:0};"data"in e?(o.pixelStoreUnpackPremultiplyAlpha.set(!1),this._updateRawData(e,h,t,r,a,n,l)):(o.pixelStoreUnpackPremultiplyAlpha.set(h),this._updateDomImage(e,t,r,l))}this.useMipmap&&this.isSizePowerOfTwo()&&l.generateMipmap(l.TEXTURE_2D),o.pixelStoreUnpackFlipY.setDefault(),o.pixelStoreUnpack.setDefault(),o.pixelStoreUnpackPremultiplyAlpha.setDefault()}_uploadDomImage(e,t){t.texImage2D(t.TEXTURE_2D,0,this.format,this.format,t.UNSIGNED_BYTE,e)}_uploadRawData(e,t,i,r,a){let{data:n}=e;t&&n&&(n=s4(n)),a.texImage2D(a.TEXTURE_2D,0,this.format,i,r,0,this.format,a.UNSIGNED_BYTE,n)}_updateDomImage(e,t,i,r){r.texSubImage2D(r.TEXTURE_2D,0,t,i,r.RGBA,r.UNSIGNED_BYTE,e)}_updateRawData(e,t,i,r,a,n,s){let{data:o}=e;t&&o&&(o=s4(o)),s.texSubImage2D(s.TEXTURE_2D,0,i,r,a,n,s.RGBA,s.UNSIGNED_BYTE,o)}bind(e,t,i){let{context:r}=this,{gl:a}=r;this.texture!==this._ownedHandle&&(this.texture=this._ownedHandle),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,this._ownedHandle=null}}class oa{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 eM(`"${i}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=t.height;let 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++){let 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. x: ${e}, y: ${t}, dim: ${this.dim}`);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 on(e,this.getUnpackVector())}getPixels(){return new s6({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 on(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}}ak("DEMData",oa);class os extends na{constructor(e,t){super(e,oi,t)}_createColorRamp(e){let t={elevationStops:[],colorStops:[]},i=this._transitionablePaint._values["color-relief-color"].value.expression;if(i instanceof rG&&i._styleExpression.expression instanceof iM){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=[tq.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 eM(`Too many colors in specification of ${this.id} color-relief layer, may not render properly. Max possible colors: ${e}, provided: ${t.elevationStops.length}`),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 s6({width:r.colorStops.length,height:1}),n=new s6({width:r.colorStops.length,height:1});for(let e=0;e<r.elevationStops.length;e++){let t=on(r.elevationStops[e],i);n.setPixel(0,e,new tq(t.r/255,t.g/255,t.b/255,1)),a.setPixel(0,e,r.colorStops[e])}return this.colorRampTextures={elevationTexture:new or(e,n,e.gl.RGBA),colorTexture:new or(e,a,e.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return!this.isHidden()&&!!this.colorRampTextures}}let{members:oo}=nu([{name:"a_pos",components:2,type:"Int16"}],4);function ol(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 oh(e,t,i,r,a){let{zoom:n}=r,s=a.patternDependencies;for(let r of t){let t=r.paint.get(`${e}-pattern`).value;if("constant"!==t.kind){let e=t.evaluate({zoom:n-1},i,{},a.availableImages),o=t.evaluate({zoom:n},i,{},a.availableImages),l=t.evaluate({zoom:n+1},i,{},a.availableImages);e=null!=e&&e.name?e.name:e,o=null!=o&&o.name?o.name:o,l=null!=l&&l.name?l.name:l,s[e]=!0,s[o]=!0,s[l]=!0,i.patterns[r.id]={min:e,mid:o,max:l}}}return i}function ou(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=oT(a/r|0,e[a],e[a+1],n);else for(let a=i-r;a>=t;a-=r)n=oT(a/r|0,e[a],e[a+1],n);return n&&og(n,n.next)&&(oS(n),n=n.next),n}function oc(e,t){if(!e)return e;t||(t=e);let i,r=e;do if(i=!1,r.steiner||!og(r,r.next)&&0!==o_(r.prev,r,r.next))r=r.next;else{if(oS(r),(r=t=r.prev)===r.next)break;
2i=!0}while(i||r!==t);return t}function od(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 op(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 of(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 om(e,t,i,r,a,n,s,o){return(e!==s||t!==o)&&of(e,t,i,r,a,n,s,o)}function o_(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function og(e,t){return e.x===t.x&&e.y===t.y}function oy(e,t,i,r){let a=ov(o_(e,t,i)),n=ov(o_(e,t,r)),s=ov(o_(i,r,e)),o=ov(o_(i,r,t));return a!==n&&s!==o||!(0!==a||!ox(e,i,t))||!(0!==n||!ox(e,r,t))||!(0!==s||!ox(i,e,r))||!(0!==o||!ox(i,t,r))}function ox(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 ov(e){return e>0?1:e<0?-1:0}function ob(e,t){return 0>o_(e.prev,e,e.next)?o_(e,t,e.next)>=0&&o_(e,e.prev,t)>=0:0>o_(e,t,e.prev)||0>o_(e,e.next,t)}function ow(e,t){let i=oP(e.i,e.x,e.y),r=oP(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 oT(e,t,i,r){let a=oP(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 oS(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 oP(e,t,i){return{i:e,x:t,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class oM{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 oI{constructor(e){this.fill=e.fill,this.line=e.line,this.tile=e.tile,this.stencil=e.stencil,this.circle=e.circle}}oI.noSubdivision=new oI({fill:new oM(0,0),line:new oM(0,0),tile:new oM(0,0),stencil:new oM(0,0),circle:1}),ak("SubdivisionGranularityExpression",oM),ak("SubdivisionGranularitySetting",oI);class oE{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),p=Math.ceil(l/this._granularityCellSize);if(h!==u||c!==p)for(let e=c;e<p;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],p=e[2*t[o]+1],f=!1;if(l<h)f=!0;else if(l>h)f=!1;else{let i=p-c,n=-(e[2*t[o]]-u),s=c<p?1:-1;((l-u)*i+(e[2*t[r]+1]-c)*n)*s>((h-u)*i+(e[2*t[a]+1]-c)*n)*s&&(f=!0)}if(f){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],p=l-s,f=h-o,m=0===p,_=0===f,g=(r-o)/f,y=(a-o)/f,x=Math.min(g,y),v=Math.max(g,y);if(!_&&(x>=1||v<=0)||_&&(o<r||o>a)){h>=r&&h<=a&&n.push(i[(e+1)%3]);continue}!_&&x>0&&n.push(this._vertexToIndex(s+p*x,o+f*x));let b=s+p*Math.max(x,0),w=s+p*Math.min(v,1);m||this._generateIntraEdgeVertices(n,s,o,l,h,b,w),!_&&v<1&&n.push(this._vertexToIndex(s+p*v,o+f*v)),(_||h>=r&&h<=a)&&n.push(i[(e+1)%3]),!_&&(h<=r||h>=a)&&this._generateInterEdgeVertices(n,s,o,l,h,u,c,w,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),p=Math.floor(u/this._granularityCellSize)+1,f=Math.ceil(c/this._granularityCellSize)-1;
2if(h?t<r:n<s)for(let r=p;r<=f;r++){let a=r*this._granularityCellSize;e.push(this._vertexToIndex(a,i+l*(a-t)/o))}else for(let r=f;r>=p;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,p=(h-a)/u,f=Math.min(c,p),m=Math.max(c,p),_=r+(n-r)*f,g=Math.floor(Math.min(_,o)/this._granularityCellSize)+1,y=Math.ceil(Math.max(_,o)/this._granularityCellSize)-1,x=o<_,v=0===u;if(v&&(s===l||s===h))return;if(v||f>=1||m<=0){let e=i-s,r=n+(t-n)*Math.min((l-s)/e,(h-s)/e);g=Math.floor(Math.min(r,o)/this._granularityCellSize)+1,y=Math.ceil(Math.max(r,o)/this._granularityCellSize)-1,x=o<r}let b=a-i>0?h:l;if(x)for(let t=g;t<=y;t++)e.push(this._vertexToIndex(t*this._granularityCellSize,b));else for(let t=y;t>=g;t--)e.push(this._vertexToIndex(t*this._granularityCellSize,b))}_generateOutline(e){let t=[];for(let i of e){let e=oA(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],p=r[2*o],f=r[2*o+1];t&&(0===h&&0===c&&this._generatePoleQuad(e,a,s,l,u,-32768),0===c&&0===f&&this._generatePoleQuad(e,s,o,u,p,-32768),0===f&&0===h&&this._generatePoleQuad(e,o,a,p,l,-32768)),i&&(8192===h&&8192===c&&this._generatePoleQuad(e,a,s,l,u,32767),8192===c&&8192===f&&this._generatePoleQuad(e,s,o,u,p,32767),8192===f&&8192===h&&this._generatePoleQuad(e,o,a,p,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)for(let a of(r!==e[0]&&t.push(i.length/2),r))i.push(a.x),i.push(a.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=ou(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=ou(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(od);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(og(e,i))return i;do{if(og(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&&of(a<h?r:s,a,l,h,a<h?s:r,a,i.x,i.y)){var c,p;let t=Math.abs(a-i.y)/(r-i.x);ob(i,e)&&(t<u||t===u&&(i.x>n.x||i.x===n.x&&(c=n,p=i,0>o_(c.prev,c,p.prev)&&0>o_(p.next,c,c.next))))&&(n=i,u=t)}i=i.next}while(i!==o);return n}(e,t);if(!i)return t;let r=ow(i,e);return oc(r,r.next),oc(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=op(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(o_(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,p=Math.min(s,o,l),f=Math.min(h,u,c),m=
2Math.max(s,o,l),_=Math.max(h,u,c),g=op(p,f,t,i,r),y=op(m,_,t,i,r),x=e.prevZ,v=e.nextZ;for(;x&&x.z>=g&&v&&v.z<=y;){if(x.x>=p&&x.x<=m&&x.y>=f&&x.y<=_&&x!==a&&x!==n&&om(s,h,o,u,l,c,x.x,x.y)&&o_(x.prev,x,x.next)>=0||(x=x.prevZ,v.x>=p&&v.x<=m&&v.y>=f&&v.y<=_&&v!==a&&v!==n&&om(s,h,o,u,l,c,v.x,v.y)&&o_(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;x&&x.z>=g;){if(x.x>=p&&x.x<=m&&x.y>=f&&x.y<=_&&x!==a&&x!==n&&om(s,h,o,u,l,c,x.x,x.y)&&o_(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;v&&v.z<=y;){if(v.x>=p&&v.x<=m&&v.y>=f&&v.y<=_&&v!==a&&v!==n&&om(s,h,o,u,l,c,v.x,v.y)&&o_(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}(t,a,n,s):function(e){let t=e.prev,i=e.next;if(o_(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),p=Math.max(s,o,l),f=i.next;for(;f!==t;){if(f.x>=h&&f.x<=c&&f.y>=u&&f.y<=p&&om(r,s,a,o,n,l,f.x,f.y)&&o_(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}(t))i.push(h.i,t.i,u.i),oS(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;!og(r,a)&&oy(r,i,i.next,a)&&ob(r,a)&&ob(a,r)&&(t.push(r.i,i.i,a.i),oS(i),oS(i.next),i=e=a),i=i.next}while(i!==e);return oc(i)}(oc(t),i),i,r,a,n,s,2):2===o&&function(t,i,r,a,n,s){let o=t;do{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&&oy(i,i.next,e,t))return!0;i=i.next}while(i!==e);return!1}(l,h)&&(ob(l,h)&&ob(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)&&(o_(l.prev,l,h.prev)||o_(l,h.prev,h))||og(l,h)&&o_(l.prev,l,l.next)>0&&o_(h.prev,h,h.next)>0))){let l=ow(o,t);return o=oc(o,o.next),l=oc(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(oc(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 of t)i.push(this._vertexToIndex(e[2*r],e[2*r+1]));return i}_pointArrayToIndices(e){let t=[];for(let i of e)t.push(this._vertexToIndex(i.x,i.y));return t}}function oC(e,t,i,r=!0){return new oE(i,t).subdividePolygonInternal(e,r)}function oA(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 w(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,p=n!==u;if(!c&&!p)continue;let f=h-a,m=u-n,_=Math.abs(f),g=Math.abs(m),y=a,x=n;for(;;){let e=f>0?(Math.floor(y/s)+1)*s:(Math.ceil(y/s)-1)*s,t=m>0?(Math.floor(x/s)+1)*s:(Math.ceil(x/s)-1)*s,i=Math.abs(y-e),r=Math.abs(x-t),a=Math.abs(x-u),n=c?i/_:1/0,l=p?r/g:1/0;if((Math.abs(y-h)<=i||!c)&&(a<=r||!p))break;if(n<l&&c||!p){let t=new w(y=e,Math.round(x+=m*n));o[o.length-1].x===t.x&&o[o.length-1].y===t.y||o.push(t)}else{let e=new w(Math.round(y+=f*l),x=t);o[o.length-1].x===e.x&&o[o.length-1].y===e.y||o.push(e)}}let v=new w(h,u);o[o.length-1].x===v.x&&o[o.length-1].y===v.y||o.push(v)}return o}function oD(e,t,i,r,a,n,s,o,l){let h=a.length/2,u=s&&o&&l;if(h<se.MAX_VERTEX_ARRAY_LENGTH){let c,p,f=t.prepareSegment(h,i,r),m=f.vertexLength;for(let e=0;e<n.length;e+=3)r.emplaceBack(m+n[e],m+n[e+1],m+n[e+2]);f.vertexLength+=h,f.primitiveLength+=n.length/3,u&&(c=(p=s.prepareSegment(h,i,o)).vertexLength,p.vertexLength+=h);for(let t=0;t<a.length;t+=2)e(a[t],a[t+1]);if(u)for(let e of l){for(let t=1;t<e.length;t+=2)o.emplaceBack(c+e[t-1],c+e[t]);p.primitiveLength+=e.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 p=a[c-2],f=a[c-1],m=a[c],_=s[p]<l,g=s[f]<l,y=s[m]<l;h.vertexLength+(+!!_+ +!!g+ +!!y)>se.MAX_VERTEX_ARRAY_LENGTH&&(h=e.createNewSegment(t,i),l=o.count,_=!0,g=!0,y=!0,u=0);let x=oz(s,r,n,o,p,_,h),v=oz(s,r,n,o,f,g,h),b=oz(s,r,n,o,m,y,h);i.emplaceBack(u+x-l,u+v-l,u+b-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 of a)for(let a=1;a<c.length;a+=2){let p=c[a-1],f=c[a],m=s[p]<l,_=s[f]<l;h.vertexLength+(+!!m+ +!!_)>se.MAX_VERTEX_ARRAY_LENGTH&&(h=e.createNewSegment(t,i),l=o.count,m=!0,_=!0,u=0);let g=oz(s,r,n,o,p,m,h),y=oz(s,r,n,o,f,_,h);i.emplaceBack(u+g-l,u+y-l),h.primitiveLength++}}(s,i,o,a,l,e),t.forceNewSegmentOnNextPrepare(),null==s||s.forceNewSegmentOnNextPrepare()}function oz(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 ok{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.id),this.index=e.index,this.hasDependencies=!1,this.patternFeatures=[],this.layoutVertexArray=new nY,this.indexArray=new n8,this.indexArray2=new n7,this.programConfigurations=new sE(e.layers,e.zoom),this.segments=new se,this.segments2=new se,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(e,t,i){this.hasDependencies=ol("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=sz(s,e);if(!this.layers[0]._featureFilter.filter(new aX(this.zoom),u,i))continue;let c=a?r.evaluate(u,{},i,t.availableImages):void 0,p={id:o,properties:s.properties,type:s.type,sourceLayerIndex:h,index:l,geometry:e?u.geometry:sD(s),patterns:{},sortKey:c};n.push(p)}for(let r of(a&&n.sort((e,t)=>
vendor: 1,152 bytes, line 2
2e.sortKey-t.sortKey),n)){let{geometry:a,index:n,sourceLayerIndex:s}=r;if(this.hasDependencies){let e=oh("fill",this.layers,r,{zoom: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,{imagePositions: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,oo),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())}
2addFeature(e,t,i,r,a,n){for(let e of i6(t,500)){let t=oC(e,r,n.fill.getGranularityForZoomLevel(r.z)),i=this.layoutVertexArray;oD((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,{imagePositions:a,canonical:r})}}ak("FillBucket",ok,{omit:["layers","patternFeatures"]});var oR={get paint(){return p=p||new nt({"fill-antialias":new a4(e0.paint_fill["fill-antialias"]),"fill-opacity":new a8(e0.paint_fill["fill-opacity"]),"fill-color":new a8(e0.paint_fill["fill-color"]),"fill-outline-color":new a8(e0.paint_fill["fill-outline-color"]),"fill-translate":new a4(e0.paint_fill["fill-translate"]),"fill-translate-anchor":new a4(e0.paint_fill["fill-translate-anchor"]),"fill-pattern":new a7(e0.paint_fill["fill-pattern"])})},get layout(){return c=c||new nt({"fill-sort-key":new a8(e0.layout_fill["fill-sort-key"])})}};class oL extends na{constructor(e,t){super(e,oR,t)}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 ok(e)}queryRadius(){return sG(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:e,geometry:t,transform:i,pixelsToTileUnits:r}){return sF(s$(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-i.bearingInRadians,r),t)}isTileClipped(){return!0}}let oF=nu([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),oB=nu([{name:"a_centroid",components:2,type:"Int16"}],4),{members:oO}=oF;class oV{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(oj,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 w(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=oN(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 oj(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)}function oN(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}oV.types=["Unknown","Point","LineString","Polygon"];class oU{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(oG,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 oV(this._pbf,t,this.extent,this._keys,this._values)}}function oG(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 o${constructor(e,t){this.layers=e.readFields(oZ,{},t)}}function oZ(e,t,i){if(3===e){let e=new oU(i,i.readVarint()+i.pos);e.length&&(t[e.name]=e)}}function oq(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))}class oW{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.id),this.index=e.index,this.hasDependencies=!1,this.layoutVertexArray=new nK,this.centroidVertexArray=new nH,this.indexArray=new n8,this.programConfigurations=new sE(e.layers,e.zoom),this.segments=new se,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.hasDependencies=ol("fill-extrusion",this.layers,t),e)){let e=this.layers[0]._featureFilter.needGeometry,o=sz(r,e);if(!this.layers[0]._featureFilter.filter(new aX(this.zoom),o,i))continue;let l={id:a,sourceLayerIndex:s,index:n,geometry:e?o.geometry:sD(r),properties:r.properties,type:r.type,patterns:{}};this.hasDependencies?this.features.push(oh("fill-extrusion",this.layers,l,{zoom: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,{imagePositions: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,oO),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,oB.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 i6(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.sampleC
2ount),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,{imagePositions:a,canonical:r})}processPolygon(e,t,i,r,a){if(r.length<1||oH(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.sampleCount++)}}(e,t);let n={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},s=a.fill.getGranularityForZoomLevel(t.z),o="Polygon"===oV.types[i.type];for(let e of r){if(0===e.length||oH(e))continue;let t=oA(e,s,o);this._generateSideFaces(t,n)}if(!o)return;let l=oC(r,t,s,!1),h=this.layoutVertexArray;oD((e,t)=>{oq(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>se.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),oq(this.layoutVertexArray,s.x,s.y,l.x,l.y,0,0,i),oq(this.layoutVertexArray,s.x,s.y,l.x,l.y,0,1,i),i+=h,oq(this.layoutVertexArray,o.x,o.y,l.x,l.y,0,0,i),oq(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 oH(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)}ak("FillExtrusionBucket",oW,{omit:["layers","features"]});var oX={get paint(){return f=f||new nt({"fill-extrusion-opacity":new a4(e0["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new a8(e0["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new a4(e0["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new a4(e0["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new a7(e0["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new a8(e0["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new a8(e0["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new a4(e0["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class oY extends na{constructor(e,t){super(e,oX,t)}createBucket(e){return new oW(e)}queryRadius(){return sG(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=s$(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];es(e,e,t),i.push(new w(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,p=r[10]*i,f=r[11]*i;for(let t of e){let e=[],i=[];for(let a of t){let t=a.x,n=a.y,m=r[0]*t+r[4]*n+r[12],_=r[1]*t+r[5]*n+r[13],g=r[2]*t+r[6]*n+r[14],y=r[3]*t+r[7]*n+r[15],x=g+l,v=y+h,b=m+u,T=_+c,S=g+p,P=y+f,M=new w((m+s)/v,(_+o)/v);M.z=x/v,e.push(M);let I=new w(b/P,T/P);I.z=S/P,i.push(I)}a.push(e),n.push(i)}return[a,n]}(r,h,l,s);return function(e,t,i){let r=1/0;sF(i,t)&&(r=oJ(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];sR(i,a)&&(r=Math.min(r,oJ(i,a)))}}return r!==1/0&&r}(c[0],c[1],u)}}function oK(e,t){return e.x*t.x+e.y*t.y}function oJ(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=oK(o,o),c=oK(o,l),p=oK(l,l),f=oK(h,o),m=oK(h,l),_=u*p-c*c,g=(p*f-c*m)/_,y=(u*m-c*f)/_,x=a.z*(1-g-y)+i.z*g+n.z*y;if(isFinite(x))return x}return 1/0}{let e=1/0;for(let i of t)e=Math.min(e,i.z);return e}}let oQ=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array
2];class o0{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=oQ[15&i];if(!a)throw Error("Unrecognized array type.");let[n]=new Uint16Array(e,2,1),[s]=new Uint32Array(e,4,1);return new o0(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;let a=oQ.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(o1(t,i,a,r),i[2*n+s]>o&&o1(t,i,a,n);l<h;){for(o1(t,i,l,h),l++,h--;i[2*l+s]<o;)l++;for(;i[2*h+s]>o;)h--}i[2*a+s]===o?o1(t,i,a,h):o1(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 p=c+u>>1,f=n[2*p],m=n[2*p+1];f>=e&&f<=i&&m>=t&&m<=r&&l.push(a[p]),(0===h?e<=f:t<=m)&&(o.push(c),o.push(p-1),o.push(1-h)),(0===h?i>=f:r>=m)&&(o.push(p+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++)o3(a[2*i],a[2*i+1],e,t)<=l&&o.push(r[i]);continue}let p=c+u>>1,f=a[2*p],m=a[2*p+1];o3(f,m,e,t)<=l&&o.push(r[p]),(0===h?e-i<=f:t-i<=m)&&(s.push(c),s.push(p-1),s.push(1-h)),(0===h?e+i>=f:t+i>=m)&&(s.push(p+1),s.push(u),s.push(1-h))}return o}}function o1(e,t,i,r){o2(e,i,r),o2(t,2*i,2*r),o2(t,2*i+1,2*r+1)}function o2(e,t,i){let r=e[t];e[t]=e[i],e[i]=r}function o3(e,t,i,r){let a=e-i,n=t-r;return a*a+n*n}function o5(e,t,i,r){let a={id:e??null,type:t,geometry:i,tags:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};switch(t){case"Point":case"MultiPoint":o4(a,i);break;case"LineString":o4(a,i.points);break;case"Polygon":o4(a,i[0].points);break;case"MultiLineString":for(let e of i)o4(a,e.points);break;case"MultiPolygon":for(let e of i)o4(a,e[0].points)}return a}function o6(e){e.points.length>64&&(e.points=new Float64Array(e.points))}function o4(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 o8(e,t){let i=[];switch(e.type){case"FeatureCollection":for(let r=0;r<e.features.length;r++)o7(i,e.features[r],t,r);break;case"Feature":o7(i,e,t);break;default:o7(i,{geometry:e,properties:void 0},t)}return i}function o7(e,t,i,r){var a;if(!t.geometry)return;if("GeometryCollection"===t.geometry.type)return void function(e,t,i,r,a){for(let n of i.geometries)o7(e,{id:t.id,geometry:n,properties:t.properties},r,a)}(e,t,t.geometry,i,r);let n=t.geometry.coordinates;if(!(null!=n&&n.length))return;let s=i.promoteId?null==(a=t.properties)?void 0:a[i.promoteId]:i.generateId?r||0:t.id,o=Math.pow(i.tolerance/((1<<i.maxZoom)*i.extent),2);switch(t.geometry.type){case"Point":return void function(e,t,i,r){let a=[];a.push(lt(i.coordinates[0]),li(i.coordinates[1]),0),e.push(o5(t,"Point",a,r))}(e,s,t.geometry,t.properties);case"MultiPoint":return void function(e,t,i,r){let a=[];for(let e of i.coordinates)a.push(lt(e[0]),li(e[1]),0);e.push(o5(t,"MultiPoint",a,r))}(e,s,t.geometry,t.properties);case"LineString":return void function(e,t,i,r,a){let n={points:[]};o9(i.coordinates,n,r,!1),e.push(o5(t,"LineString",n,a))}(e,s,t.geometry,o,t.properties);case"MultiLineString":return void function(e,t,i,r,a,n){if(a.lineMetrics)for(let a of i.coordinates){let i={points:[]};o9(a,i,r,!1),e.push(o5(t,"LineString",i,n))}else{let a=[];le(i.coordinates,a,r,!1),e.push(o5(t,"MultiLineString",a,n))}}(e,s,t.geometry,o,i,t.properties);case"Polygon":return void function(e,t,i,r,a){let n=[];le(i.coordinates,n,r,!0),e.push(o5(t,"Polygon",n,a))}(e,s,t.geometry,o,t.properties);case"MultiPolygon":return void function(e,t,i,r,a){let n=[];for(let e of i.coordinates){let t=[];le(e,t,r,!0),n.push(t)}e.push(o5(t,"MultiPolygon",n,a))}(e,s,t.geometry,o,t.properties);default:throw Error("Input data is not a valid GeoJSON object.")}}function o9(e,t,i,r){let a,n,s=0;for(let i=0;i<e.length;i++){let o=lt(e[i][0]),l=li(e[i][1]);t.points.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.points.length-3;t.points[2]=1,i>0&&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],p=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,p);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.points,0,o,i),t.points[o+2]=1,o6(t),t.size=Math.abs(s),t.start=0,t.end=t.size}function le(e,t,i,r){for(let a=0;a<e.length;a++){let n={points:[]};o9(e[a],n,i,r),t.push(n)}}function lt(e){return e/360+.5}function li(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 lr(e){let t={type:"Feature",geometry:function(e){let{type:t,geometry:i}=e;switch(t){case"Point":var r,a;return{type:t,coordinates:(r=i[0],a=i[1],[ln(r),ls(a)])};case"MultiPoint":return{type:t,coordinates:la(i)};case"LineString":return{type:t,coordinates:la(i.points)};case"MultiLineString":case"Polygon":return{type:t,coordinates:i.map(e=>la(e.points))};case"MultiPolygon":return{type:t,coordinates:i.map(e=>e.map(e=>la(e.points)))}}}(e),properties:e.tags};
2return null!=e.id&&(t.id=e.id),t}function la(e){let t=[];for(let a=0;a<e.length;a+=3){var i,r;t.push((i=e[a],r=e[a+1],[ln(i),ls(r)]))}return t}function ln(e){return 360*(e-.5)}function ls(e){return 360*Math.atan(Math.exp((180-360*e)*Math.PI/180))/Math.PI-90}function lo(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=a===L.X?t.minX:t.minY,n=a===L.X?t.maxX:t.maxY;if(e>=i&&n<r)l.push(t);else if(!(n<i||e>=r))switch(t.type){case"Point":case"MultiPoint":var h=t,u=l,c=i,p=r,f=a;let s=[];(function(e,t,i,r,a){for(let n=0;n<e.length;n+=3){let s=e[n+a];s>=i&&s<=r&&lc(t,e[n],e[n+1],e[n+2])}})(h.geometry,s,c,p,f),s.length&&u.push(o5(h.id,3===s.length?"Point":"MultiPoint",s,h.tags));continue;case"LineString":var m=t,_=l,g=i,y=r,x=a,v=o;let B=[];if(ll(m.geometry,B,g,y,x,!1,v.lineMetrics),B.length)if(v.lineMetrics)for(let e of B)_.push(o5(m.id,"LineString",e,m.tags));else _.push(B.length>1?o5(m.id,"MultiLineString",B,m.tags):o5(m.id,"LineString",B[0],m.tags));continue;case"MultiLineString":var b=t,w=l,T=i,S=r,P=a;let O=[];lu(b.geometry,O,T,S,P,!1),O.length&&w.push(1!==O.length?o5(b.id,"MultiLineString",O,b.tags):o5(b.id,"LineString",O[0],b.tags));continue;case"Polygon":var M=t,I=l,E=i,C=r,A=a;let V=[];lu(M.geometry,V,E,C,A,!0),V.length&&I.push(o5(M.id,"Polygon",V,M.tags));continue;case"MultiPolygon":var D=t,z=l,k=i,R=r,F=a;let j=[];for(let e of D.geometry){let t=[];lu(e,t,k,R,F,!0),t.length&&j.push(t)}j.length&&z.push(o5(D.id,"MultiPolygon",j,D.tags));continue}}return l.length?l:null}function ll(e,t,i,r,a,n,s){let o=lh(e),l=a===L.X?ld:lp,h,u,c=e.start;for(let p=0;p<e.points.length-3;p+=3){let f=e.points[p],m=e.points[p+1],_=e.points[p+2],g=e.points[p+3],y=e.points[p+4],x=a===L.X?f:m,v=a===L.X?g:y,b=!1;s&&(h=Math.sqrt(Math.pow(f-g,2)+Math.pow(m-y,2))),x<i?v>i&&(u=l(o,f,m,g,y,i),s&&(o.start=c+h*u)):x>r?v<r&&(u=l(o,f,m,g,y,r),s&&(o.start=c+h*u)):lc(o.points,f,m,_),v<i&&x>=i&&(u=l(o,f,m,g,y,i),b=!0),v>r&&x<=r&&(u=l(o,f,m,g,y,r),b=!0),!n&&b&&(s&&(o.end=c+h*u),t.push(o),o=lh(e)),s&&(c+=h)}let p=e.points.length-3,f=e.points[p],m=e.points[p+1],_=a===L.X?f:m;_>=i&&_<=r&&lc(o.points,f,m,e.points[p+2]),p=o.points.length-3,n&&p>=3&&(o.points[p]!==o.points[0]||o.points[p+1]!==o.points[1])&&lc(o.points,o.points[0],o.points[1],o.points[2]),o.points.length&&(o6(o),t.push(o))}function lh(e){return{points:[],size:e.size,start:e.start,end:e.end}}function lu(e,t,i,r,a,n){for(let s of e)ll(s,t,i,r,a,n,!1)}function lc(e,t,i,r){e.push(t,i,r)}function ld(e,t,i,r,a,n){let s=(n-t)/(r-t);return lc(e.points,n,i+(a-i)*s,1),s}function lp(e,t,i,r,a,n){let s=(n-i)/(a-i);return lc(e.points,t+(r-t)*s,n,1),s}function lf(e,t){let i=t.buffer/t.extent,r=e,a=lo(e,1,-1-i,i,L.X,-1,2,t),n=lo(e,1,1-i,2+i,L.X,-1,2,t);return(a||n)&&(r=lo(e,1,-i,1+i,L.X,-1,2,t)||[],a&&(r=lm(a,1).concat(r)),n&&(r=r.concat(lm(n,-1)))),r}function lm(e,t){let i=[];for(let r of e)switch(r.type){case"Point":case"MultiPoint":{let e=function(e,t){let i=[];for(let r=0;r<e.length;r+=3)i.push(e[r]+t,e[r+1],e[r+2]);return i}(r.geometry,t);i.push(o5(r.id,r.type,e,r.tags));continue}case"LineString":{let e=l_(r.geometry,t);i.push(o5(r.id,r.type,e,r.tags));continue}case"MultiLineString":case"Polygon":{let e=[];for(let i of r.geometry)e.push(l_(i,t));i.push(o5(r.id,r.type,e,r.tags));continue}case"MultiPolygon":{let e=[];for(let i of r.geometry){let r=[];for(let e of i)r.push(l_(e,t));e.push(r)}i.push(o5(r.id,r.type,e,r.tags));continue}}return i}function l_(e,t){let i={points:[],size:e.size};void 0!==e.start&&(i.start=e.start,i.end=e.end);for(let r=0;r<e.points.length;r+=3)i.points.push(e.points[r]+t,e.points[r+1],e.points[r+2]);return o6(i),i}function lg(e,t){if(t.removeAllProperties)return{};let i={...e||{}};if(t.removeProperties)for(let e of t.removeProperties)delete i[e];if(t.addOrUpdateProperties)for(let{key:e,value:r}of t.addOrUpdateProperties)i[e]=r;return i}(S=L||(L={}))[S.X=0]="X",S[S.Y=1]="Y";let ly={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:e=>e};class lx{constructor(e){this.options=Object.assign(Object.create(ly),e),this.trees=Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[],this.points=[]}load(e){let t=[];for(let i of e){if(!i.geometry)continue;let[e,r]=i.geometry.coordinates,[a,n]=[lt(e),li(r)];t.push({id:i.id,type:"Point",geometry:[a,n],tags:i.properties})}this.createIndex(t)}initialize(e){let t=[];for(let i of e)"Point"===i.type&&t.push(i);this.createIndex(t)}updateIndex(e,t,i){this.options=Object.assign(Object.create(ly),i.clusterOptions),this.initialize(e)}createIndex(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(!(null!=i&&i.geometry))continue;let[r,a]=i.geometry;r=Math.fround(r),a=Math.fround(a),n.push(r,a,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)}
2t&&console.timeEnd("total time")}getClusters(e,t){return this.getClustersInternal(e,t).map(e=>lr(e))}getClustersInternal(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.getClustersInternal([i,r,180,n],t),s=this.getClustersInternal([-180,r,a,n],t);return e.concat(s)}let s=this.trees[this.limitZoom(t)],o=s.range(lt(i),li(n),lt(a),li(r)),l=s.flatData,h=[];for(let e of o){var u,c,p;let t=this.stride*e;h.push(l[t+5]>1?(u=l,c=t,p=this.clusterProps,{id:u[c+3],type:"Point",tags:lv(u,c,p),geometry:[u[c],u[c+1]]}):this.points[l[t+3]])}return h}getChildren(e){let t=this.getOriginId(e),i=this.getOriginZoom(e),r=Error("No cluster with the specified id: "+e),a=this.trees[i];if(!a)throw r;let n=a.flatData;if(t*this.stride>=n.length)throw 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){var h,u,c;let i=t*this.stride;n[i+4]===e&&l.push(n[i+5]>1?(h=n,u=i,c=this.clusterProps,{type:"Feature",id:h[u+3],properties:lv(h,u,c),geometry:{type:"Point",coordinates:[ln(h[u]),ls(h[u+1])]}}):lr(this.points[n[i+3]]))}if(0===l.length)throw 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)];if(!r)return null;let a=Math.pow(2,e),{extent:n,radius:s}=this.options,o=s/n,l=(i-o)/a,h=(i+1+o)/a,u={transformed:!0,features:[],source:null,x:t,y:i,z:e};return this.addTileFeatures(r.range((t-o)/a,l,(t+1+o)/a,h),r.flatData,t,i,a,u),0===t&&this.addTileFeatures(r.range(1-o/a,l,1,h),r.flatData,a,i,a,u),t===a-1&&this.addTileFeatures(r.range(0,l,o/a,h),r.flatData,-1,i,a,u),u}getClusterExpansionZoom(e){return this.getOriginZoom(e)}appendLeaves(e,t,i,r,a){for(let n of this.getChildren(t)){let t=n.properties;if(null!=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(e){let t=new o0(e.length/this.stride|0,this.options.nodeSize,Float32Array);for(let i=0;i<e.length;i+=this.stride)t.add(e[i],e[i+1]);return t.finish(),t.flatData=e,t.data=null,t}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=lv(t,u,this.clusterProps),o=t[u],l=t[u+1];else{let i=this.points[t[u+3]];e=i.tags,[o,l]=i.geometry}let p={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)&&(p.id=h),n.features.push(p)}}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.flatData,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),p=o[i+5],f=p;for(let e of c){let i=e*h;o[i+2]>t&&(f+=o[i+5])}if(f>p&&f>=n){let e,n=r*p,s=u*p,m=-1,_=(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]=_,a&&(e||(e=this.map(o,i,!0),m=this.clusterProps.length,this.clusterProps.push(e)),a(e,this.map(o,l)))}o[i+4]=_,l.push(n/f,s/f,1/0,_,-1,f),a&&l.push(m)}else{for(let e=0;e<h;e++)l.push(o[i+e]);if(f>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]].tags,a=this.options.map(r);return i&&a===r?Object.assign({},a):a}}function lv(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})}let lb="geojsonvt_clip_start",lw="geojsonvt_clip_end";function lT(e,t,i,r,a){let n=t===a.maxZoom?0:a.tolerance/((1<<t)*a.extent),s={transformed:!1,features:[],source:null,x:i,y:r,z:t,minX:2,minY:1,maxX:-1,maxY:0,numPoints:0,numSimplified:0,numFeatures:e.length};for(let t of e)!function(e,t,i,r){switch(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),t.type){case"Point":case"MultiPoint":var a=e,n=t;let s=[];for(let e=0;e<n.geometry.length;e+=3)s.push(n.geometry[e],n.geometry[e+1]),a.numPoints++,a.numSimplified++;if(!s.length)return;let o={type:1,tags:n.tags||null,geometry:s};null!==n.id&&(o.id=n.id),a.features.push(o);return;case"LineString":return function(e,t,i,r){let a=[];if(lS(a,t.geometry,e,i,!1,!1),!a.length)return;let n=t.tags||null;if(r.lineMetrics){for(let e in n={},t.tags)n[e]=t.tags[e];
2n[lb]=t.geometry.start/t.geometry.size,n[lw]=t.geometry.end/t.geometry.size}let s={type:2,tags:n,geometry:a};null!==t.id&&(s.id=t.id),e.features.push(s)}(e,t,i,r);case"MultiLineString":case"Polygon":var l=e,h=t,u=i;let c=[];for(let e=0;e<h.geometry.length;e++)lS(c,h.geometry[e],l,u,"Polygon"===h.type,0===e);if(!c.length)return;let p={type:"Polygon"===h.type?3:2,tags:h.tags||null,geometry:c};null!==h.id&&(p.id=h.id),l.features.push(p);return;case"MultiPolygon":return function(e,t,i){let r=[];for(let a=0;a<t.geometry.length;a++){let n=t.geometry[a];for(let t=0;t<n.length;t++)lS(r,n[t],e,i,!0,0===t)}if(!r.length)return;let a={type:3,tags:t.tags||null,geometry:r};null!==t.id&&(a.id=t.id),e.features.push(a)}(e,t,i)}}(s,t,n,a);return s}function lS(e,t,i,r,a,n){let s=r*r;if(r>0&&t.size<(a?s:r))return void(i.numPoints+=t.points.length/3);let o=[];for(let e=0;e<t.points.length;e+=3)(0===r||t.points[e+2]>s)&&(i.numSimplified++,o.push(t.points[e],t.points[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)}function lP(e,t){if(e.transformed)return e;let i=1<<e.z,r=e.x,a=e.y;for(let n of e.features)1===n.type?function(e,t,i,r,a){let n=e.geometry,s=[];for(let e=0;e<n.length;e+=2)s.push(lM(n[e],n[e+1],t,i,r,a));e.geometry=s}(n,t,i,r,a):function(e,t,i,r,a){let n=e.geometry,s=[];for(let e of n){let n=[];for(let s=0;s<e.length;s+=2)n.push(lM(e[s],e[s+1],t,i,r,a));s.push(n)}e.geometry=s}(n,t,i,r,a);return e.transformed=!0,e}function lM(e,t,i,r,a,n){return[Math.round(i*(e*r-a)),Math.round(i*(t*r-n))]}class lI{constructor(e){this.options=e,this.total=0,this.stats={},this.tiles={},this.tileCoords=[],this.stats={},this.total=0}initialize(e){this.splitTile(e,0,0,0),this.options.debug&&(e.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}updateIndex(e,t,i){i.debug>1&&(console.log("invalidating tiles"),console.time("invalidating")),this.invalidateTiles(t),i.debug>1&&console.timeEnd("invalidating");let[r,a,n]=[0,0,0],s=lT(e,r,a,n,i);s.source=e;let o=lE(r,a,n);if(this.tiles[o]=s,this.tileCoords.push({z:r,x:a,y:n,id:o}),i.debug){let e=`z${r}`;this.stats[e]=(this.stats[e]||0)+1,this.total++}}getClusterExpansionZoom(e){return null}getChildren(e){return null}getLeaves(e,t,i){return null}getTile(e,t,i){let{extent:r,debug:a}=this.options,n=1<<e,s=lE(e,t=t+n&n-1,i);if(this.tiles[s])return lP(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[lE(l,h,u)];return null!=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]?lP(this.tiles[s],r):null):null}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=lE(t,i,r),p=this.tiles[c];if(!p&&(h>1&&console.time("creation"),p=this.tiles[c]=lT(e,t,i,r,l),this.tileCoords.push({z:t,x:i,y:r,id:c}),h)){h>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",t,i,r,p.numFeatures,p.numPoints,p.numSimplified),console.timeEnd("creation"));let e=`z${t}`;this.stats[e]=(this.stats[e]||0)+1,this.total++}if(p.source=e,null==a){if(t===l.indexMaxZoom||p.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(p.source=null,!e.length)continue;h>1&&console.time("clipping");let f=.5*l.buffer/l.extent,m=.5-f,_=.5+f,g=1+f,y=null,x=null,v=null,b=null,w=lo(e,u,i-f,i+_,L.X,p.minX,p.maxX,l),T=lo(e,u,i+m,i+g,L.X,p.minX,p.maxX,l);w&&(y=lo(w,u,r-f,r+_,L.Y,p.minY,p.maxY,l),x=lo(w,u,r+m,r+g,L.Y,p.minY,p.maxY,l)),T&&(v=lo(T,u,r-f,r+_,L.Y,p.minY,p.maxY,l),b=lo(T,u,r+m,r+g,L.Y,p.minY,p.maxY,l)),h>1&&console.timeEnd("clipping"),o.push(y||[],t+1,2*i,2*r),o.push(x||[],t+1,2*i,2*r+1),o.push(v||[],t+1,2*i+1,2*r),o.push(b||[],t+1,2*i+1,2*r+1)}}invalidateTiles(e){if(!e.length)return;let t=this.options,{debug:i}=t,r=1/0,a=-1/0,n=1/0,s=-1/0;for(let t of e)r=Math.min(r,t.minX),a=Math.max(a,t.maxX),n=Math.min(n,t.minY),s=Math.max(s,t.maxY);let o=t.buffer/t.extent,l=new Set;for(let t in this.tiles){let h=this.tiles[t],u=1<<h.z,c=(h.x-o)/u,p=(h.x+1+o)/u,f=(h.y-o)/u,m=(h.y+1+o)/u;if(a<c||r>=p||s<f||n>=m)continue;let _=!1;for(let t of e)if(t.maxX>=c&&t.minX<p&&t.maxY>=f&&t.minY<m){_=!0;break}if(_){if(i){i>1&&console.log("invalidate tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",h.z,h.x,h.y,h.numFeatures,h.numPoints,h.numSimplified);let e=`z${h.z}`;this.stats[e]=(this.stats[e]||0)-1,this.total--}delete this.tiles[t],l.add(t)}}l.size&&(this.tileCoords=this.tileCoords.filter(e=>!l.has(e.id)))}}function lE(e,t,i){return 32*((1<<e)*i+t)+e}let lC={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,updateable:!1,
2cluster:!1,clusterOptions:ly,debug:0},{members:lA}=nu([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:lD}=nu([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),lz=Math.cos(Math.PI/180*37.5);class lk{constructor(e){for(let t of(this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.id),this.index=e.index,this.hasDependencies=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers))this.gradients[t.id]={};this.layoutVertexArray=new nJ,this.layoutVertexArray2=new nQ,this.indexArray=new n8,this.programConfigurations=new sE(e.layers,e.zoom),this.segments=new se,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(e,t,i){this.hasDependencies=ol("line",this.layers,t)||this.hasLineDasharray(this.layers);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=sz(t,e);if(!this.layers[0]._featureFilter.filter(new aX(this.zoom),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:sD(t),patterns:{},dashes:{},sortKey:u};n.push(c)}for(let r of(a&&n.sort((e,t)=>
2e.sortKey-t.sortKey),n)){let{geometry:a,index:n,sourceLayerIndex:s}=r;this.hasDependencies?(ol("line",this.layers,t)?oh("line",this.layers,r,{zoom:this.zoom},t):this.hasLineDasharray(this.layers)&&this.addLineDashDependencies(this.layers,r,this.zoom,t),this.patternFeatures.push(r)):this.addFeature(r,a,n,i,{},{},t.subdivisionGranularity),t.featureIndex.insert(e[n].feature,a,n,s,this.index)}}update(e,t,i,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,{imagePositions:i,dashPositions:r})}addFeatures(e,t,i,r){for(let a of this.patternFeatures)this.addFeature(a,a.geometry,a.index,t,i,r,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,lD)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,lA),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.hasOwn(e.properties,lb)&&Object.hasOwn(e.properties,lw))return{start:+e.properties[lb],end:+e.properties[lw]}}addFeature(e,t,i,r,a,n,s){let o=this.layers[0].layout,l=o.get("line-join").evaluate(e,{}),h=o.get("line-cap").evaluate(e,{}),u=o.get("line-miter-limit").evaluate(e,{}),c=o.get("line-round-limit").evaluate(e,{});for(let i of(this.lineClips=this.lineFeatureClips(e),t))this.addLine(i,e,l,h,u,c,r,s);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,{imagePositions:a,dashPositions:n,canonical:r})}addLine(e,t,i,r,a,n,s,o){let l,h,u,c,p;if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,e=oA(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 f="Polygon"===oV.types[t.type],m=e.length;for(;m>=2&&e[m-1].equals(e[m-2]);)m--;let _=0;for(;_<m-1&&e[_].equals(e[_+1]);)_++;if(m<(f?3:2))return;"bevel"===i&&(a=1.05);let g=this.overscaling<=16?122880/(512*this.overscaling):0,y=this.segments.prepareSegment(10*m,this.layoutVertexArray,this.indexArray);this.e1=this.e2=-1,f&&(l=e[m-2],p=e[_].sub(l)._unit()._perp());for(let t=_;t<m;t++){if((u=t===m-1?f?e[_+1]:void 0:e[t+1])&&e[t].equals(u))continue;p&&(c=p),l&&(h=l),l=e[t],p=u?u.sub(l)._unit()._perp():c,c||(c=p);let s=c.add(p);0===s.x&&0===s.y||s._unit();let o=c.x*p.x+c.y*p.y,x=s.x*p.x+s.y*p.y,v=0!==x?1/x:1/0,b=2*Math.sqrt(2-2*x),w=x<lz&&h&&u,T=c.x*p.y-c.y*p.x>0;if(w&&t>_){let e=l.dist(h);if(e>2*g){let t=l.sub(l.sub(h)._mult(g/e)._round());this.updateDistance(h,t),this.addCurrentVertex(t,c,0,0,y),h=t}}let S=h&&u,P=S?i:f?"butt":r;if(S&&"round"===P&&(v<n?P="miter":v<=2&&(P="fakeround")),"miter"===P&&v>a&&(P="bevel"),"bevel"===P&&(v>2&&(P="flipbevel"),v<a&&(P="miter")),h&&this.updateDistance(h,l),"miter"===P)s._mult(v),this.addCurrentVertex(l,s,0,0,y);else if("flipbevel"===P){if(v>100)s=p.mult(-1);else{let e=v*c.add(p).mag()/c.sub(p).mag();s._perp()._mult(e*(T?-1:1))}this.addCurrentVertex(l,s,0,0,y),this.addCurrentVertex(l,s.mult(-1),0,0,y)}else if("bevel"===P||"fakeround"===P){let e=-Math.sqrt(v*v-1),t=T?e:0,i=T?0:e;if(h&&this.addCurrentVertex(l,c,t,i,y),"fakeround"===P){let e=Math.round(180*b/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=p.sub(c)._mult(i)._add(c)._unit()._mult(T?-1:1);this.addHalfVertex(l,r.x,r.y,!1,T,0,y)}}u&&this.addCurrentVertex(l,p,-t,-i,y)}else if("butt"===P)this.addCurrentVertex(l,s,0,0,y);else if("square"===P){let e=h?1:-1;this.addCurrentVertex(l,s,e,e,y)}else"round"===P&&(h&&(this.addCurrentVertex(l,c,0,0,y),this.addCurrentVertex(l,c,1,1,y,!0)),u&&(this.addCurrentVertex(l,p,-1,-1,y,!0),this.addCurrentVertex(l,p,0,0,y)));if(w&&t<m-1){let e=l.dist(u);if(e>2*g){let t=l.add(u.sub(l)._mult(g/e)._round());this.updateDistance(l,t),this.addCurrentVertex(t,p,0,0,y),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()}hasLineDasharray(e){for(let t of e){let e=t.paint.get("line-dasharray");
2if(e&&!e.isConstant())return!0}return!1}addLineDashDependencies(e,t,i,r){for(let a of e){let e=a.paint.get("line-dasharray");if(!e||"constant"===e.value.kind)continue;let n="round"===a.layout.get("line-cap").evaluate(t,{}),s={dasharray:e.value.evaluate({zoom:i-1},t,{}),round:n},o={dasharray:e.value.evaluate({zoom:i},t,{}),round:n},l={dasharray:e.value.evaluate({zoom:i+1},t,{}),round:n},h=`${s.dasharray.join(",")},${s.round}`,u=`${o.dasharray.join(",")},${o.round}`,c=`${l.dasharray.join(",")},${l.round}`;r.dashDependencies[h]=s,r.dashDependencies[u]=o,r.dashDependencies[c]=l,t.dashes[a.id]={min:h,mid:u,max:c}}}}ak("LineBucket",lk,{omit:["layers","patternFeatures"]});var lR={get paint(){return _=_||new nt({"line-opacity":new a8(e0.paint_line["line-opacity"]),"line-color":new a8(e0.paint_line["line-color"]),"line-translate":new a4(e0.paint_line["line-translate"]),"line-translate-anchor":new a4(e0.paint_line["line-translate-anchor"]),"line-width":new a8(e0.paint_line["line-width"]),"line-gap-width":new a8(e0.paint_line["line-gap-width"]),"line-offset":new a8(e0.paint_line["line-offset"]),"line-blur":new a8(e0.paint_line["line-blur"]),"line-dasharray":new a7(e0.paint_line["line-dasharray"]),"line-pattern":new a7(e0.paint_line["line-pattern"]),"line-gradient":new ne(e0.paint_line["line-gradient"])})},get layout(){return m=m||new nt({"line-cap":new a8(e0.layout_line["line-cap"]),"line-join":new a8(e0.layout_line["line-join"]),"line-miter-limit":new a8(e0.layout_line["line-miter-limit"]),"line-round-limit":new a8(e0.layout_line["line-round-limit"]),"line-sort-key":new a8(e0.layout_line["line-sort-key"])})}};class lL extends a8{possiblyEvaluate(e,t){return t=new aX(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=ev({},t,{zoom:Math.floor(t.zoom)}),super.evaluate(e,t,i,r)}}class lF extends na{constructor(e,t){super(e,lR,t),this.gradientVersion=0,g||((g=new lL(lR.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 iy,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"]=g.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new lk(e)}queryRadius(e){var t,i;return t=sU("line-width",this,e),((i=sU("line-gap-width",this,e))>0?i+2*t:t)/2+Math.abs(sU("line-offset",this,e))+sG(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:i,geometry:r,transform:a,pixelsToTileUnits:n}){var s,o;let l=s$(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 of e){let e=function(e){let t=[];for(let i=0;i<e.length;i++){let r=e[i],a=t.at(-1);(0===i||a&&!r.equals(a))&&t.push(r)}return t}(r),a=[];for(let i=0;i<e.length;i++){let r=e[i],n=e[i-1],s=e[i+1],o=0===i?new w(0,0):r.sub(n)._unit()._perp(),l=i===e.length-1?new w(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),a.push(h._mult(t)._add(r))}i.push(a)}return i}(r,u*n)),function(e,t,i){for(let r of t){if(e.length>=3){for(let t of r)if(sN(e,t))return!0}if(function(e,t,i){if(e.length>1){if(sB(e,t))return!0;for(let r of t)if(sO(r,e,i))return!0}for(let r of e)if(sO(r,t,i))return!0;return!1}(e,r,i))return!0}return!1}(l,r,h)}isTileClipped(){return!0}}let lB=nu([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),lO=nu([{name:"a_projected_pos",components:3,type:"Float32"}],4);nu([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);let lV=nu([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);nu([{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 lj=nu([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),lN=nu([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);
2nu([{name:"triangle",components:3,type:"Uint16"}]),nu([{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"}]),nu([{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"}]),nu([{type:"Float32",name:"offsetX"}]),nu([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),nu([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);let lU={"!":"ï¸","#":"ï¼",$:"ï¼","%":"ï¼
","&":"ï¼","(":"︵",")":"︶","*":"ï¼","+":"ï¼",",":"ï¸","-":"︲",".":"ã»","/":"ï¼",":":"ï¸",";":"ï¸","<":"︿","=":"ï¼",">":"ï¹","?":"ï¸","@":"ï¼ ","[":"ï¹","\\":"ï¼¼","]":"ï¹","^":"ï¼¾",_:"︳","`":"ï½","{":"︷","|":"â","}":"︸","~":"ï½","\xa2":"ï¿ ","\xa3":"ï¿¡","\xa5":"ï¿¥","\xa6":"¦","\xac":"ï¿¢","\xaf":"ï¿£","â":"︲","â":"︱","â":"ï¹","â":"ï¹","â":"ï¹","â":"ï¹","â¦":"ï¸","â¯":"ï¸","â§":"ã»","â©":"₩","ã":"ï¸","ã":"ï¸","ã":"︿","ã":"ï¹","ã":"︽","ã":"︾","ã":"ï¹","ã":"ï¹","ã":"ï¹","ã":"ï¹","ã":"︻","ã":"︼","ã":"︹","ã":"︺","ã":"ï¸","ã":"ï¸","ï¼":"ï¸","ï¼":"︵","ï¼":"︶","ï¼":"ï¸","ï¼":"︲","ï¼":"ã»","ï¼":"ï¸","ï¼":"ï¸","ï¼":"︿","ï¼":"ï¹","ï¼":"ï¸","ï¼»":"ï¹","ï¼½":"ï¹","_":"︳","ï½":"︷","ï½":"â","ï½":"︸","ï½":"︵","ï½ ":"︶","。":"ï¸","ï½¢":"ï¹","ï½£":"ï¹"},lG={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},l$={40:!0};function lZ(e,t,i,r,a,n){if("fontStack"in t){let r=i[t.fontStack],n=null==r?void 0:r[e];return n?n.metrics.advance*t.scale+a:0}{let e=r[t.imageName];return e?e.displaySize[0]*t.scale*24/n+a:0}}function lq(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 lW(e,t,i,r,a,n){let s=null,o=lq(t,i,a,n);for(let e of r){let r=lq(t-e.x,i,a,n)+e.badness;r<=o&&(s=e,o=r)}return{index:e,x:t,priorBreak:s,badness:o}}class lH{constructor(e="",t=[],i=[]){this.text=e,this.sections=t,this.sectionIndex=i,this.imageSectionID=null}static fromFeature(e,t){let i=new lH;for(let r of e.sections)r.image?i.addImageSection(r):i.addTextSection(r,t);return i}length(){return[...this.text].length}getSection(e){return this.sections[this.sectionIndex[e]]}getSectionIndex(e){return this.sectionIndex[e]}verticalizePunctuation(){this.text=function(e){let t="",i={premature:!0,value:void 0},r=e[Symbol.iterator](),a=r.next(),n=e[Symbol.iterator]();n.next();let s=n.next();for(;!a.done;)t+=!s.done&&aZ(s.value.codePointAt(0))&&!lU[s.value]||!i.premature&&aZ(i.value.codePointAt(0))&&!lU[i.value]||!lU[a.value]?a.value:lU[a.value],i={value:a.value,premature:!1}
2,a=r.next(),s=n.next();return t}(this.text)}hasZeroWidthSpaces(){return this.text.includes("â")}trim(){let e=this.text.match(/^\s*/),t=e?e[0].length:0,i=this.text.match(/\S\s*$/),r=i?i[0].length-1:0;this.text=this.text.substring(t,this.text.length-r),this.sectionIndex=this.sectionIndex.slice(t,this.sectionIndex.length-r)}substring(e,t){let i=[...this.text].slice(e,t).join(""),r=this.sectionIndex.slice(e,t);return new lH(i,this.sections,r)}toCodeUnitIndex(e){return[...this.text].slice(0,e).join("").length}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,t)=>Math.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("imageName"in a){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({scale:e.scale||1,verticalAlign:e.verticalAlign||"bottom",fontStack:e.fontStack||t});let i=this.sections.length-1;this.sectionIndex.push(...[...e.text].map(()=>i))}addImageSection(e){let t=e.image?e.image.name:"";if(0===t.length)return void eM("Can't add FormattedSection with an empty image.");let i=this.getNextImageSectionCharCode();i?(this.text+=String.fromCharCode(i),this.sections.push({scale:1,verticalAlign:e.verticalAlign||"bottom",imageName:t}),this.sectionIndex.push(this.sections.length-1)):eM("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}determineLineBreaks(e,t,i,r,a){let n=[],s=this.determineAverageLineWidth(e,t,i,r,a),o=this.hasZeroWidthSpaces(),l=0,h=0,u=this.text[Symbol.iterator](),c=u.next(),p=this.text[Symbol.iterator]();p.next();let f=p.next(),m=this.text[Symbol.iterator]();m.next(),m.next();let _=m.next();for(;!c.done;){let t=this.getSection(h),g=c.value.codePointAt(0);if(aN(g)||(l+=lZ(g,t,i,r,e,a)),!f.done){let e=/[\u02EA\u02EB\u2E80-\u2FDF\u2FF0-\u303F\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FD-\u30FF\u3105-\u312F\u31A0-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE4F\uFF00-\uFFEF]|\uD81B[\uDFE0-\uDFFF]|[\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFFF]|\uD82C[\uDC00-\uDEFB]|\uD83C[\uDE00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(g)),i=f.value.codePointAt(0);(lG[g]||e||"imageName"in t||!_.done&&l$[i])&&n.push(lW(h+1,l,s,n,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}(g,i,e&&o),!1))}h++,c=u.next(),f=p.next(),_=m.next()}return function e(t){return t?e(t.priorBreak).concat(t.index):[]}(lW(this.length(),l,s,n,0,!0))}determineAverageLineWidth(e,t,i,r,a){let n=0,s=0;for(let t of this.text){let o=this.getSection(s);n+=lZ(t.codePointAt(0),o,i,r,e,a),s++}return n/Math.max(1,Math.ceil(n/t))}}let lX=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");class lY{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)){var s,o;return s=e,o=r,t?0x100000000*o+(s>>>0):0x100000000*(o>>>0)+(s>>>0)}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&&lX?lX.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?(192&(n=e[a+1]))==128&&(l=(31&t)<<6|63&n)<=127&&(l=null):3===h?(n=e[a+1],s=e[a+2],(192&n)==128&&(192&s)==128&&((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],(192&n)==128&&(192&s)==128&&(192&o)==128&&((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;let r,a;if(e>=0?(r=e%0x100000000|0,a=e/0x100000000|0):(r=~(-e%0x100000000),a=~(-e/0x100000000),0xffffffff^r?r=r+1|0:(r=0,a=a+1|0)),e>=0xffffffffffffffff||e<-0xffffffffffffffff)throw Error("Given varint doesn't fit into 10 bytes");t.realloc(10),i=r,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),function(e,t){let i=(7&e)<<4;t.buf[t.pos++]|=i|128*!!(e>>>=3),e&&(t.buf[t.pos++]=127&e|128*!!(e>>>=7),e&&(t.buf[t.pos++]=127&e|128*!!(e>>>=7),e&&(t.buf[t.pos++]=127&e|128*!!(e>>>=7),e&&(t.buf[t.pos++]=127&e|128*!!(e>>>=7),e&&(t.buf[t.pos++]=127&e)))))}(a,t)}(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&&lK(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&&lK(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,lJ,t)}writePackedSVarint(e,t){t.length&&this.writeMessage(e,lQ,t)}writePackedBoolean(e,t){t.length&&this.writeMessage(e,l2,t)}writePackedFloat(e,t){t.length&&this.writeMessage(e,l0,t)}writePackedDouble(e,t){t.length&&this.writeMessage(e,l1,t)}writePackedFixed32(e,t){t.length&&this.writeMessage(e,l3,t)}writePackedSFixed32(e,t){t.length&&this.writeMessage(e,l5,t)}writePackedFixed64(e,t){t.length&&this.writeMessage(e,l6,t)}writePackedSFixed64(e,t){t.length&&this.writeMessage(e,l4,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 lK(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 lJ(e,t){for(let i=0;i<e.length;i++)t.writeVarint(e[i])}function lQ(e,t){for(let i=0;i<e.length;i++)t.writeSVarint(e[i])}function l0(e,t){for(let i=0;i<e.length;i++)t.writeFloat(e[i])}function l1(e,t){for(let i=0;i<e.length;i++)t.writeDouble(e[i])}function l2(e,t){for(let i=0;i<e.length;i++)t.writeBoolean(e[i])}function l3(e,t){for(let i=0;i<e.length;i++)t.writeFixed32(e[i])}function l5(e,t){for(let i=0;i<e.length;i++)t.writeSFixed32(e[i])}function l6(e,t){for(let i=0;i<e.length;
2i++)t.writeFixed64(e[i])}function l4(e,t){for(let i=0;i<e.length;i++)t.writeSFixed64(e[i])}function l8(e,t,i){1===e&&i.readMessage(l7,t)}function l7(e,t,i){if(3===e){let{id:e,bitmap:r,width:a,height:n,left:s,top:o,advance:l}=i.readMessage(l9,{});t.push({id:e,bitmap:new s5({width:a+6,height:n+6},r),metrics:{width:a,height:n,left:s,top:o,advance:l}})}}function l9(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 he(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 ht{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 hi{constructor(e,t){let i={},r={};this.haveRenderCallbacks=[];let a=[];this.addImages(e,i,a),this.addImages(t,r,a);let{w:n,h:s}=he(a),o=new s6({width:n||1,height:s||1});for(let t in e){let r=e[t],a=i[t].paddedRect;s6.copy(r.data,o,{x:0,y:0},{x:a.x+1,y:a.y+1},r.data)}for(let e in t){let i=t[e],a=r[e].paddedRect,n=a.x+1,s=a.y+1,l=i.data.width,h=i.data.height;s6.copy(i.data,o,{x:0,y:0},{x:n,y:s},i.data),s6.copy(i.data,o,{x:0,y:h-1},{x:n,y:s-1},{width:l,height:1}),s6.copy(i.data,o,{x:0,y:0},{x:n,y:s+h},{width:l,height:1}),s6.copy(i.data,o,{x:l-1,y:0},{x:n-1,y:s},{width:1,height:h}),s6.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 ht(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})}}function hr(t,i,r,a,n,s,o,l,h,u,c,p,f,m,_){let g,y=lH.fromFeature(t,n);p===e.ax.vertical&&y.verticalizePunctuation();let x=y.determineLineBreaks(u,s,i,a,m),{processBidirectionalText:v,processStyledBidirectionalText:b}=aH;if(v&&1===y.sections.length)for(let e of(g=[],x=x.map(e=>y.toCodeUnitIndex(e)),v(y.toString(),x))){let t=[...e].map(()=>0);g.push(new lH(e,y.sections,t))}else if(b){g=[],x=x.map(e=>y.toCodeUnitIndex(e));let e=0,t=[];for(let i of y.text)t.push(...Array(i.length).fill(y.sectionIndex[e])),e++;for(let e of b(y.text,t,x)){let t=[],i="";for(let r of e[0])t.push(e[1][i.length]),i+=r;g.push(new lH(e[0],y.sections,t))}}else g=function(e,t){let i=[],r=0;for(let a of t)i.push(e.substring(r,a)),r=a;return r<e.length()&&i.push(e.substring(r,e.length())),i}(y,x);let w=[],T={positionedLines:w,text:y.toString(),top:c[1],bottom:c[1],left:c[0],right:c[0],writingMode:p,iconsInText:!1,verticalizable:!1};return function(t,i,r,a,n,s,o,l,h,u,c,p){let f=0,m=0,_=0,g=0,y="right"===l?1:.5*("left"!==l),x=24/p,v=0;for(let o of n){o.trim();let n=o.getMaxScale(),l={positionedGlyphs:[],lineOffset:0};t.positionedLines[v]=l;let p=l.positionedGlyphs,S=0;if(!o.length()){m+=s,++v;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,x),M=0;for(let s of o.text){var b,w,T;let l,_=o.getSection(M),g=s.codePointAt(0),y=(b=h,w=c,T=g,!(b===e.ax.horizontal||!w&&!aj(T)||w&&(aN(T)||RegExp("\\p{sc=Arab}","u").test(String.fromCodePoint(T))))),v={glyph:g,imageName:null,x:f,y:m+-17,vertical:y,scale:1,fontStack:"",sectionIndex:o.getSectionIndex(M),metrics:null,rect:null};if("fontStack"in _){if(!(l=function(e,t,i,r,a,n){let s,o=n[e.fontStack],l=function(e,t,i,r){if(null!=e&&e.rect)return e;let a=t[i.fontStack],n=null==a?void 0:a[r];return n?{rect:null,metrics:n.metrics}:null}(null==o?void 0:o[t],a,e,t);if(null===l)return null;if(i)s=r.verticalLineContentWidth-24*e.scale;else{let t=hn(e.verticalAlign);s=(r.horizontalLineContentHeight-24*e.scale)*t}return{rect:l.rect,metrics:l.metrics,baselineOffset:s}}(_,g,y,P,i,r)))continue;v.fontStack=_.fontStack}else{if(t.iconsInText=!0,_.scale*=x,!(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=hn(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}}(_,y,n,P,a)))continue;S=Math.max(S,l.imageOffset),v.imageName=_.imageName}let{rect:I,metrics:E,baselineOffset:C}=l;v.y+=C,v.scale=_.scale,v.metrics=E,v.rect=I,p.push(v),y?(t.verticalizable=!0,f+=("imageName"in _?E.advance:24)*_.scale+u):f+=E.advance*_.scale+u,M++}0!==p.length&&(_=Math.max(f-u,_),function(e,t,i,r){if(0===r)return;let a=e[i],n=(e[i].x+a.metrics.advance*a.scale)*r;
2for(let t=0;t<=i;t++)e[t].x-=n}(p,0,p.length-1,y)),f=0,l.lineOffset=Math.max(S,(n-1)*24);let I=s*n+S;m+=I,g=Math.max(I,g),++v}let{horizontalAlign:S,verticalAlign:P}=ha(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,y,S,P,_,g,s,m,n.length),t.top+=-P*m,t.bottom=t.top+m,t.left+=-S*_,t.right=t.left+_}(T,i,r,a,g,o,l,h,p,u,f,_),!function(e){for(let t of e)if(0!==t.positionedGlyphs.length)return!1;return!0}(w)&&T}function ha(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 hn(e){switch(e){case"top":return 0;case"center":return .5;default:return 1}}function hs(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 ho(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 p=t.left*n,f=t.right*n;"width"===i||"both"===i?(u=a[0]+p-r[3],l=a[0]+f+r[1]):l=(u=a[0]+(p+f-c.displaySize[0])/2)+c.displaySize[0];let m=t.top*n,_=t.bottom*n;return"height"===i||"both"===i?(o=a[1]+m-r[0],h=a[1]+_+r[2]):h=(o=a[1]+(m+_-c.displaySize[1])/2)+c.displaySize[1],{image:c,top:o,right:l,bottom:h,left:u,collisionPadding:s}}function hl(e,t){let{expression:i}=t;if("constant"===i.kind)return{kind:"constant",layoutSize:i.evaluate(new aX(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 aX(s)),maxSize:i.evaluate(new aX(o)),interpolationType:r}}}function hh(e,t,i){let r="never",a=e.get(t);return a?r=a:e.get(i)&&(r="always"),r}ak("ImagePosition",ht),ak("ImageAtlas",hi),e.ax=void 0,(F=e.ax||(e.ax={}))[F.none=0]="none",F[F.horizontal=1]="horizontal",F[F.vertical=2]="vertical",F[F.horizontalOnly=3]="horizontalOnly";let hu=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function hc(e,t,i,r,a,n,s,o,l,h,u,c,p){let f=o?Math.min(32640,Math.round(o[0])):0,m=o?Math.min(32640,Math.round(o[1])):0;e.emplaceBack(t,i,Math.round(32*r),Math.round(32*a),n,s,(f<<1)+ +!!l,m,16*h,16*u,256*c,256*p)}function hd(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 hp{constructor(e){this.layoutVertexArray=new n2,this.indexArray=new n8,this.programConfigurations=e,this.segments=new se,this.dynamicLayoutVertexArray=new n3,this.opacityVertexArray=new n5,this.hasVisibleVertices=!1,this.placedSymbolArray=new nV}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,lB.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,t),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,lO.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,hu,!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())}}
2ak("SymbolBuffers",hp);class hf{constructor(e,t,i){this.layoutVertexArray=new e,this.layoutAttributes=t,this.indexArray=new i,this.segments=new se,this.collisionVertexArray=new n4}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,lV.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}ak("CollisionBuffers",hf);class hm{constructor(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,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.hasDependencies=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];let i=this.layers[0]._unevaluatedLayout._values;this.textSizeData=hl(this.zoom,i["text-size"]),this.iconSizeData=hl(this.zoom,i["icon-size"]);let r=this.layers[0].layout,a=r.get("symbol-sort-key"),n=r.get("symbol-z-order");this.canOverlap="never"!==hh(r,"text-overlap","text-allow-overlap")||"never"!==hh(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.ax[t])),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.sourceID=t.sourceID}createArrays(){this.text=new hp(new sE(this.layers,this.zoom,e=>e.startsWith("text"))),this.icon=new hp(new sE(this.layers,this.zoom,e=>e.startsWith("icon"))),this.glyphOffsetArray=new nU,this.lineVertexArray=new nG,this.symbolInstances=new nN,this.textAnchorOffsets=new nZ}calculateGlyphDependencies(e,t,i,r,a){for(let n of e)if(t[n.codePointAt(0)]=!0,(i||r)&&a){let e=lU[n];e&&(t[e.codePointAt(0)]=!0)}}populate(t,i,r){var a;let n=this.layers[0],s=n.layout,o=s.get("text-font"),l=s.get("text-field"),h=s.get("icon-image"),u=("constant"!==l.value.kind||l.value.value instanceof tY&&!l.value.value.isEmpty()||l.value.value.toString().length>0)&&("constant"!==o.value.kind||o.value.value.length>0),c="constant"!==h.value.kind||!!h.value.value||Object.keys(h.parameters).length>0,p=s.get("symbol-sort-key");if(this.features=[],!u&&!c)return;let f=i.iconDependencies,m=i.glyphDependencies,_=i.availableImages,g=new aX(this.zoom);for(let{feature:i,id:l,index:h,sourceLayerIndex:y}of t){let t,x,v=n._featureFilter.needGeometry,b=sz(i,v);if(!n._featureFilter.filter(g,b,r))continue;if(v||(b.geometry=sD(i)),u){let e=n.getValueAndResolveTokens("text-field",b,r,_),i=tY.factory(e);this.hasRTLText||(this.hasRTLText=function(e){for(let t of e.sections)if(function(e){for(let t of e)if(aW(t.codePointAt(0)))return!0;return!1}(t.text))return!0;return!1}(i)),(!this.hasRTLText||"unavailable"===aH.getRTLTextPluginStatus()||this.hasRTLText&&aH.isParsed())&&(t=function(e,t,i){for(let r of e.sections)r.text=function(e,t,i){let r=t.layout.get("text-transform").evaluate(i,{});return"uppercase"===r?e=e.toLocaleUpperCase():"lowercase"===r&&(e=e.toLocaleLowerCase()),aH.applyArabicShaping&&(e=aH.applyArabicShaping(e)),e}(r.text,t,i);return e}(i,n,b))}if(c){let e=n.getValueAndResolveTokens("icon-image",b,r,_);x=e instanceof t3?e:t3.fromString(e)}if(!t&&!x)continue;let w=this.sortFeaturesByKey?p.evaluate(b,{},r):void 0;if(this.features.push({id:l,text:t,icon:x,index:h,sourceLayerIndex:y,geometry:b.geometry,properties:i.properties,type:oV.types[i.type],sortKey:w}),x&&(f[x.name]=!0),t){let i=o.evaluate(b,{},r).join(","),n="viewport"!==s.get("text-rotation-alignment")&&"point"!==s.get("symbol-placement");for(let r of(this.allowVerticalPlacement=null==(a=this.writingModes)?void 0:a.includes(e.ax.vertical),t.sections))if(r.image)f[r.image.name]=!0;else{let e=aU(t.toString()),a=r.fontStack||i;m[a]||(m[a]={}),this.calculateGlyphDependencies(r.text,m[a],n,this.allowVerticalPlacement,e)}}}"line"===s.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,p=u.text?u.text.toString():null;if(!p){n(h);continue}let f=l(p,c),m=l(p,c,!0);if(f in i&&m in t&&i[f]!==t[m]){let e=o(f,m,c),a=s(f,m,r[e].geometry);delete t[f],delete i[m],i[l(p,r[a].geometry,!0)]=a,r[e].geometry=null}
vendor: 4,644 bytes, line 2
2else f in i?s(f,m,c):m in t?o(f,m,c):(n(h),t[f]=a-1,i[m]=a-1)}return r.filter(e=>e.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((e,t)=>e.sortKey-t.sortKey)}update(e,t,i){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,t,this.layers,{imagePositions:i}),this.icon.programConfigurations.updatePaintArrays(e,t,this.layers,{imagePositions: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,p){let f=t.indexArray,m=t.layoutVertexArray,_=t.segments.prepareSegment(4*i.length,m,f,this.canOverlap?s.sortKey:void 0),g=this.glyphOffsetArray.length,y=_.vertexLength,x=this.allowVerticalPlacement&&o===e.ax.vertical?Math.PI/2:0,v=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:g,minFontScaleX:y,minFontScaleY:b,glyphOffset:w,isSDF:T,sectionIndex:S}=i[e],P=_.vertexLength,M=w[1];hc(m,l.x,l.y,a.x,M+a.y,u.x,u.y,r,T,c.x,c.y,y,b),hc(m,l.x,l.y,n.x,M+n.y,u.x+u.w,u.y,r,T,g.x,c.y,y,b),hc(m,l.x,l.y,o.x,M+o.y,u.x,u.y+u.h,r,T,c.x,g.y,y,b),hc(m,l.x,l.y,h.x,M+h.y,u.x+u.w,u.y+u.h,r,T,g.x,g.y,y,b),hd(t.dynamicLayoutVertexArray,l,x),f.emplaceBack(P,P+2,P+1),f.emplaceBack(P+1,P+2,P+3),_.vertexLength+=4,_.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(w[0]),e!==i.length-1&&S===i[e+1].sectionIndex||t.programConfigurations.populatePaintArrays(m.length,s,s.index,{imagePositions:{},canonical:p,formattedSection:null==v?void 0:v[S]})}t.placedSymbolArray.emplaceBack(l.x,l.y,g,this.glyphOffsetArray.length-g,y,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,p=s.anchorY;this._addCollisionDebugVertex(h,u,n,c,p,new w(e,t)),this._addCollisionDebugVertex(h,u,n,c,p,new w(i,t)),this._addCollisionDebugVertex(h,u,n,c,p,new w(i,r)),this._addCollisionDebugVertex(h,u,n,c,p,new w(e,r)),o.vertexLength+=4;let f=a.indexArray;f.emplaceBack(l,l+1),f.emplaceBack(l+1,l+2),f.emplaceBack(l+2,l+3),f.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 hf(n6,lj.members,n7),this.iconCollisionBox=new hf(n6,lj.members,n7);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];(null==i?void 0: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);let i=[e.rightJustifiedTextSymbolIndex,e.centerJustifiedTextSymbolIndex,e.leftJustifiedTextSymbolIndex];for(let e=0;e<i.length;e++){let t=i[e];t>=0&&i.indexOf(t)===e&&this.addIndicesForPlacedSymbol(this.text,t)}e.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,e.verticalPlacedTextSymbolIndex),e.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.placedIconSymbolIndex),e.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}ak("SymbolBucket",hm,{omit:["layers","collisionBoxArray","features","compareText"]}),hm.MAX_GLYPHS=65535,hm.addDynamicAttributes=hd;var h_={get paint(){return x=x||new nt({"icon-opacity":new a8(e0.paint_symbol["icon-opacity"]),"icon-color":new a8(e0.paint_symbol["icon-color"]),"icon-halo-color":new a8(e0.paint_symbol["icon-halo-color"]),"icon-halo-width":new a8(e0.paint_symbol["icon-halo-width"]),"icon-halo-blur":new a8(e0.paint_symbol["icon-halo-blur"]),"icon-translate":new a4(e0.paint_symbol["icon-translate"]),"icon-translate-anchor":new a4(e0.paint_symbol["icon-translate-anchor"]),"text-opacity":new a8(e0.paint_symbol["text-opacity"]),"text-color":new a8(e0.paint_symbol["text-color"],{runtimeType:to,getOverride:e=>e.textColor,hasOverride:e=>!!e.textColor}),"text-halo-color":new a8(e0.paint_symbol["text-halo-color"]),"text-halo-width":new a8(e0.paint_symbol["text-halo-width"]),"text-halo-blur":new a8(e0.paint_symbol["text-halo-blur"]),"text-translate":new a4(e0.paint_symbol["text-translate"]),"text-translate-anchor":new a4(e0.paint_symbol["text-translate-anchor"])})},get layout(){return y=y||new nt({"symbol-placement":new a4(e0.layout_symbol["symbol-placement"]),"symbol-spacing":new a4(e0.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new a4(e0.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new a8(e0.layout_symbol["symbol-sort-key"]),"symbol-z-order":new a4(e0.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new a4(e0.layout_symbol["icon-allow-overlap"]),"icon-overlap":new a4(e0.layout_symbol["icon-overlap"]),"icon-ignore-placement":new a4(e0.layout_symbol["icon-ignore-placement"]),"icon-optional":new a4(e0.layout_symbol["icon-optional"]),"icon-rotation-alignment":new a4(e0.layout_symbol["icon-rotation-alignment"]),"icon-size":new a8(e0.layout_symbol["icon-size"]),"icon-text-fit":new a4(e0.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new a4(e0.layout_symbol["icon-text-fit-padding"]),"icon-image":new a8(e0.layout_symbol["icon-image"]),"icon-rotate":new a8(e0.layout_symbol["icon-rotate"]),"icon-padding":new a8(e0.layout_symbol["icon-padding"]),"icon-keep-upright":new a4(e0.layout_symbol["icon-keep-upright"]),"icon-offset":new a8(e0.layout_symbol["icon-offset"]),"icon-anchor":new a8(e0.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new a4(e0.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new a4(e0.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new a4(e0.layout_symbol["text-rotation-alignment"]),"text-field":new a8(e0.layout_symbol["text-field"]),"text-font":new a8(e0.layout_symbol["text-font"]),"text-size":new a8(e0.layout_symbol["text-size"]),"text-max-width":new a8(e0.layout_symbol["text-max-width"]),"text-line-height":new a4(e0.layout_symbol["text-line-height"]),"text-letter-spacing":new a8(e0.layout_symbol["text-letter-spacing"]),"text-justify":new a8(e0.layout_symbol["text-justify"]),"text-radial-offset":new a8(e0.layout_symbol["text-radial-offset"]),"text-variable-anchor":new a4(e0.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new a8(e0.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new a8(e0.layout_symbol["text-anchor"]),"text-max-angle":new a4(e0.layout_symbol["text-max-angle"]),"text-writing-mode":new a4(e0.layout_symbol["text-writing-mode"]),"text-rotate":new a8(e0.layout_symbol["text-rotate"]),"text-padding":new a4(e0.layout_symbol["text-padding"]),"text-keep-upright":new a4(e0.layout_symbol["text-keep-upright"]),"text-transform":new a8(e0.layout_symbol["text-transform"]),"text-offset":new a8(e0.layout_symbol["text-offset"]),"text-allow-overlap":new a4(e0.layout_symbol["text-allow-overlap"]),"text-overlap":new a4(e0.layout_symbol["text-overlap"]),"text-ignore-placement":new a4(e0.layout_symbol["text-ignore-placement"]),"text-optional":new a4(e0.layout_symbol["text-optional"])})}};class hg{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:tr,this.defaultValue=e}evaluate(e){if(e.formattedSection){let t=this.defaultValue.property.overrides;if(null!=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}}ak("FormatSectionOverride",hg,{omit:["defaultValue"]});class hy extends na{constructor(e,t){super(e,h_,t)}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)t.includes(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()||rN(s.value)||!n?n:(a=t.properties,n.replace(/{([^{}]+)}/g,(e,t)=>a&&t in a?String(a[t]):""))}createBucket(e){return new hm(e)}queryRadius(){return 0}queryIntersectsFeature(){throw Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let e of h_.paint.overridableProperties){if(!hy.hasPaintOverride(this.layout,e))continue;let t=this.paint.get(e),i=new rj(new hg(t),t.property.specification),r=null;r="constant"===t.value.kind||"source"===t.value.kind?new rG("source",i):new r$("composite",i,t.value.zoomStops),this.paint._values[e]=new a5(t.property,r,t.parameters)}}_handleOverridablePaintPropertyUpdate(e,t,i){return!(!this.layout||t.isDataDriven()||i.isDataDriven())&&hy.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,t){let i=e.get("text-field"),r=h_.paint.properties[t],a=!1,n=e=>{var t;for(let i of e)if(null!=(t=r.overrides)&&t.hasOverride(i))return void(a=!0)};if("constant"===i.value.kind&&i.value.value instanceof tY)n(i.value.value.sections);else if("source"===i.value.kind||"composite"===i.value.kind){let e=t=>{a||(t instanceof t9&&t8(t.value)===td?n(t.value.sections):t instanceof iN?n(t.sections):t.eachChild(e))},t=i.value;t._styleExpression&&e(t._styleExpression.expression)}return a}}var hx={get paint(){return v=v||new nt({"background-color":new a4(e0.paint_background["background-color"]),"background-pattern":new a9(e0.paint_background["background-pattern"]),"background-opacity":new a4(e0.paint_background["background-opacity"])})}};class hv extends na{constructor(e,t){super(e,hx,t)}}class hb extends na{constructor(e,t){super(e,{},t),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 hw{constructor(e){this._methodToThrottle=e,this._triggered=!1,this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()}}trigger(){var e;this._triggered||(this._triggered=!0,null==(e=this._channel)||e.port1.postMessage(!0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}let hT={once:!0};class hS{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 hS(ex(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 hS)return e;if(Array.isArray(e)&&(2===e.length||3===e.length))return new hS(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&"object"==typeof e&&null!==e)return new hS(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 hP=2*Math.PI*6371008.8;function hM(e){return hP*Math.cos(e*Math.PI/180)}function hI(e){return(180+e)/360}function hE(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function hC(e){return 360*e-180}function hA(e){return 360/Math.PI*Math.atan(Math.exp((180-360*e)*Math.PI/180)
2)-90}function hD(e,t){return e*hM(hA(t))}class hz{constructor(e,t,i=0){this.x=+e,this.y=+t,this.z=+i}static fromLngLat(e,t=0){let i=hS.convert(e);return new hz(hI(i.lng),hE(i.lat),t/hM(i.lat))}toLngLat(){return new hS(hC(this.x),hA(this.y))}toAltitude(){return hD(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/hP*(1/Math.cos(hA(this.y)*Math.PI/180))}}function hk(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 hR{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=hB(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=hk(256*(r=this.x),256*(a=Math.pow(2,n)-a-1),n),o=hk(256*(r+1),256*(a+1),n),s[0]+","+s[1]+","+o[0]+","+o[1]),h=function(e,t,i){let r="";for(let a=e;a>0;a--){let e=1<<a-1;r+=(t&e?1:0)+(i&e?2:0)}return r}(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 w((e.x*t-this.x)*8192,(e.y*t-this.y)*8192)}toString(){return`${this.z}/${this.x}/${this.y}`}}class hL{constructor(e,t){this.wrap=e,this.canonical=t,this.key=hB(e,t.z,t.z,t.x,t.y)}}class hF{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 hR(i,+r,+a),this.key=hB(t,e,i,r,a)}clone(){return new hF(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 hF(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new hF(e,this.wrap,e,this.canonical.x>>t,this.canonical.y>>t)}isOverscaled(){return this.overscaledZ>this.canonical.z}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?hB(this.wrap*t,e,this.canonical.z,this.canonical.x,this.canonical.y):hB(this.wrap*t,e,e,this.canonical.x>>i,this.canonical.y>>i)}isChildOf(e){if(e.wrap!==this.wrap||this.overscaledZ-e.overscaledZ<=0)return!1;if(0===e.overscaledZ)return this.overscaledZ>0;let t=this.canonical.z-e.canonical.z;return!(t<0)&&e.canonical.x===this.canonical.x>>t&&e.canonical.y===this.canonical.y>>t}children(e){if(this.overscaledZ>=e)return[new hF(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 hF(t,this.wrap,t,i,r),new hF(t,this.wrap,t,i+1,r),new hF(t,this.wrap,t,i,r+1),new hF(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 hF(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new hF(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 hL(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new hz(e.x-this.wrap,e.y))}normalizeCoordinates(e,t,i=8192){if(e>=0&&e<i&&t>=0&&t<i)return{tileID:this,x:e,y:t};let r=Math.floor(e/i),a=Math.floor(t/i),n=this.canonical.z,s=1<<n,o=this.canonical.y+a;if(o<0||o>=s)return null;let l=this.canonical.x+r,h=this.wrap;return l<0?(h-=Math.ceil(-l/s),l=(l%s+s)%s):l>=s&&(h+=Math.floor(l/s),l%=s),{tileID:new hF(this.overscaledZ,h,n,l,o),x:e-r*i,y:t-a*i}}}function hB(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)}ak("CanonicalTileID",hR),ak("OverscaledTileID",hF,{omit:["terrainRttPosMatrix32f"]});class hO{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 hO;return t.extend(e(new w(this.minX,this.minY))),t.extend(e(new w(this.maxX,this.minY))),t.extend(e(new w(this.minX,this.maxY))),t.extend(e(new w(this.maxX,this.maxY))),t}static fromPoints(e){let t=new hO;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 hV{constructor(e){this._stringToNumber={},this._numberToString=[];for(let t=0;t<e.length;t++){let 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 hj{constructor(e,t,i,r,a){this.type="Feature",this._vectorTileFeature=e,this._x=i,this._y=r,this._z=t,this.properties=e.properties,this.id=a}projectPoint(e,t,i,r){return[360*(e.x+t)/r-180,360/Math.PI*Math.atan(Math.exp((1-2*(e.y+i)/r)*Math.PI))-90]}projectLine(e,t,i,r){return e.map(e=>this.projectPoint(e,t,i,r))}get geometry(){if(this._geometry)return this._geometry;let e=this._vectorTileFeature,t=e.extent*Math.pow(2,this._z),i=e.extent*this._x,r=e.extent*this._y,a=e.loadGeometry();switch(e.type){case 1:{let e=[];
2for(let t of a)e.push(t[0]);let n=this.projectLine(e,i,r,t);this._geometry=1===e.length?{type:"Point",coordinates:n[0]}:{type:"MultiPoint",coordinates:n};break}case 2:{let e=a.map(e=>this.projectLine(e,i,r,t));this._geometry=1===e.length?{type:"LineString",coordinates:e[0]}:{type:"MultiLineString",coordinates:e};break}case 3:{let e=oN(a),n=[];for(let a of e)n.push(a.map(e=>this.projectLine(e,i,r,t)));this._geometry=1===n.length?{type:"Polygon",coordinates:n[0]}:{type:"MultiPolygon",coordinates:n};break}default:throw Error(`unknown feature type: ${e.type}`)}return this._geometry}set geometry(e){this._geometry=e}toJSON(){let e={geometry:this.geometry};for(let t in this)"_geometry"!==t&&"_vectorTileFeature"!==t&&"_x"!==t&&"_y"!==t&&"_z"!==t&&(e[t]=this[t]);return e}}class hN{constructor(e,t,i){this._name=e,this.dataBuffer=t,"number"==typeof i?this._size=i:(this.nullabilityBuffer=i,this._size=i.size())}getValue(e){return this.nullabilityBuffer&&!this.nullabilityBuffer.get(e)?null:this.getValueFromBuffer(e)}has(e){var t;return(null==(t=this.nullabilityBuffer)?void 0:t.get(e))||!this.nullabilityBuffer}get name(){return this._name}get size(){return this._size}}class hU extends hN{}class hG extends hU{getValueFromBuffer(e){return this.dataBuffer[e]}}class h$ extends hU{getValueFromBuffer(e){return this.dataBuffer[e]}}class hZ extends hN{constructor(e,t,i,r){super(e,t,r),this.delta=i}}class hq extends hZ{constructor(e,t,i,r){super(e,Int32Array.of(t),i,r)}getValueFromBuffer(e){return this.dataBuffer[0]+e*this.delta}}class hW extends hN{constructor(e,t,i,r){super(e,r?Int32Array.of(t):Uint32Array.of(t),i)}getValueFromBuffer(e){return this.dataBuffer[0]}}class hH{constructor(e,t,i,r,a=4096){this._name=e,this._geometryVector=t,this._idVector=i,this._propertyVectors=r,this._extent=a}get name(){return this._name}get idVector(){return this._idVector}get geometryVector(){return this._geometryVector}get propertyVectors(){return this._propertyVectors}getPropertyVector(e){return this.propertyVectorsMap||(this.propertyVectorsMap=new Map(this._propertyVectors.map(e=>[e.name,e]))),this.propertyVectorsMap.get(e)}get numFeatures(){return this.geometryVector.numGeometries}get extent(){return this._extent}getFeatures(){let e=[],t=this.geometryVector.getGeometries();for(let i=0;i<this.numFeatures;i++){let r;if(this.idVector){let e=this.idVector.getValue(i);r=this.containsMaxSafeIntegerValues(this.idVector)&&null!==e?Number(e):e}let a={coordinates:t[i],type:this.geometryVector.geometryType(i)},n={};for(let e of this.propertyVectors){if(!e)continue;let t=e.name,r=e.getValue(i);null!==r&&(n[t]=r)}e.push({id:r,geometry:a,properties:n})}return e}containsMaxSafeIntegerValues(e){return e instanceof hG||e instanceof hW||e instanceof hq||e instanceof h$}}class hX{constructor(e){this.value=e}get(){return this.value}set(e){this.value=e}increment(){return this.value++}add(e){this.value+=e}}(P=B||(B={})).NONE="NONE",P.DELTA="DELTA",P.COMPONENTWISE_DELTA="COMPONENTWISE_DELTA",P.RLE="RLE",P.MORTON="MORTON",P.PDE="PDE",(M=O||(O={})).NONE="NONE",M.FAST_PFOR="FAST_PFOR",M.VARINT="VARINT",M.ALP="ALP";let hY=new Uint32Array(33);hY[0]=0;for(let e=1;e<=32;e++)hY[e]=32===e?0xffffffff:0xffffffff>>>32-e;let hK=function(){var e;if(!Number.isFinite(65536))return 65536;let t=(e=Math.floor(65536))-e%256;return 0===t?256:t}(),hJ=3*hK/256+hK|0;function hQ(){let e=new Uint8Array(hJ);return{dataToBePacked:Array(33),dataPointers:new Int32Array(33),byteContainer:e,byteContainerI32:new Int32Array(e.buffer,e.byteOffset,e.byteLength>>>2),exceptionSizes:new Int32Array(33)}}function h0(e,t,i){let r=new Uint32Array(i),a=0,n=t.get();for(let t=0;t<r.length;t++){let t=e[n++],i=127&t;t<128||(i|=(127&(t=e[n++]))<<7,t<128||(i|=(127&(t=e[n++]))<<14,t<128||(i|=(127&(t=e[n++]))<<21,t<128||(i|=(15&(t=e[n++]))<<28)))),r[a++]=i}return t.set(n),r}function h1(e,t,i){let r=new BigUint64Array(i);for(let i=0;i<r.length;i++)r[i]=function(e,t){let i=0n,r=0,a=t.get();for(;a<e.length;){let t=e[a++];if(i|=BigInt(127&t)<<BigInt(r),!(128&t))break;if((r+=7)>=64)throw Error("Varint too long")}return t.set(a),i}(e,t);return r}function h2(e){return e>>>1^-(1&e)}function h3(e){return e>>1n^-(1n&e)}function h5(e){return e%2==1?-((e+1)/2):e/2}function h6(e,t,i){if(void 0===i){i=0;for(let r=0;r<t;r++)i+=e[r]}let r=new Uint32Array(i),a=0;for(let i=0;i<t;i++){let n=e[i];r.fill(e[i+t],a,a+n),a+=n}return r}function h4(e,t,i){if(void 0===i){i=0;for(let r=0;r<t;r++)i+=Number(e[r])}let r=new BigUint64Array(i),a=0;for(let i=0;i<t;i++){let n=Number(e[i]);r.fill(e[i+t],a,a+n),a+=n}return r}function h8(e,t,i){let r=new Float64Array(i),a=0;for(let i=0;i<t;i++){let n=e[i];r.fill(e[i+t],a,a+n),a+=n}return r}function h7(e){let t=new Int32Array(e.length);t[0]=h2(e[0]);let i=e.length/4*4,r=1;if(i>=4)for(;r<i-4;r+=4){let i=e[r+1],a=e[r+2],n=e[r+3];t[r]=h2(e[r])+t[r-1],t[r+1]=h2(i)+t[r],t[r+2]=h2(a)+t[r+1],t[r+3]=h2(n)+t[r+2]}for(;r!==e.length;++r)t[r]=h2(e[r])+t[r-1];return t}function h9(e){let t=new BigInt64Array(e.length);t[0]=h3(e[0]);let i=e.length/4*4,r=1;if(i>=4)for(;r<i-4;r+=4){let i=e[r+1],a=e[r+2],n=e[r+3];t[r]=h3(e[r])+t[r-1],t[r+1]=h3(i)+t[r],t[r+2]=h3(a)+t[r+1],t[r+3]=h3(n)+t[r+2]}for(;r!==t.length;++r)t[r]=h3(e[r])+t[r-1];return t}function ue(e){let t=e.length/4*4,i=1;if(t>=4)for(let r=e[0];i<t-4;i+=4)r=e[i]+=r,r=e[i+1]+=r,r=e[i+2]+=r,r=e[i+3]+=r;for(;i!==e.length;)e[i]+=e[i-1],++i}function ut(e,t){let i=function(e,t){let i=e[t.get()],r=Object.values(V)[i>>4],a=null;switch(r){case V.DATA:a={dictionaryType:Object.values(j)[15&i]};break;case V.OFFSET:a={offsetType:Object.values(N)[15&i]};break;case V.LENGTH:a={lengthType:Object.values(U)[15&i]}}t.increment();let n=e[t.get()],s=Object.values(B)[n>>5],o=Object.values(B)[n>>2&7],l=Object.values(O)[3&n];t.increment();let h=h0(e,t,2),u=h[0];return{physicalStreamType:r,logicalStreamType:a,logicalLevelTechnique1:s,logicalLevelTechnique2:o,physicalLevelTechnique:l,numValues:u,byteLength:h[1],decompressedCount:u}}(e,t);return i.logicalLevelTechnique1===B.MORTON?function(e,t,i){let r=h0(t,i,2);return{physicalStreamType:e.physicalStreamType,logicalStreamType:e.logicalStreamType,logicalLevelTechnique1:e.logicalLevelTechnique1,logicalLevelTechnique2:e.logicalLevelTechnique2,physicalLevelTechnique:e.physicalLevelTechnique,numValues:e.numValues,byteLength:e.byteLength,decompressedCount:e.decompressedCount,numBits:r[0],coordinateShift:r[1]}}(i,e,t):B.RLE!==i.logicalLevelTechnique1&&B.RLE!==i.logicalLevelTechnique2||O.NONE===i.physicalLevelTechnique?i:function(e,t,i){let r=h0(t,i,2);return{physicalStreamType:e.physicalStreamType,logicalStreamType:e.logicalStreamType,logicalLevelTechnique1:e.logicalLevelTechnique1,logicalLevelTechnique2:e.logicalLevelTechnique2,physicalLevelTechnique:e.physicalLevelTechnique,numValues:e.numValues,byteLength:e.byteLength,decompressedCount:r[1],runs:r[0],numRleValues:r[1]}}(i,e,t)}(I=V||(V={})).PRESENT="PRESENT",I.DATA="DATA",I.OFFSET="OFFSET",I.LENGTH="LENGTH",(E=j||(j={})).NONE="NONE",E.SINGLE="SINGLE",E.SHARED="SHARED",E.VERTEX="VERTEX",E.MORTON="MORTON",E.FSST="FSST",(C=N||(N={})).VERTEX="VERTEX",C.INDEX="INDEX",C.STRING="STRING",C.KEY="KEY",(A=U||(U={})).VAR_BINARY="VAR_BINARY",A.GEOMETRIES="GEOMETRIES",A.PARTS="PARTS",A.RINGS="RINGS",A.TRIANGLES="TRIANGLES",A.SYMBOL="SYMBOL",A.DICTIONARY="DICTIONARY",(D=G||(G={}))[D.FLAT=0]="FLAT",D[D.CONST=1]="CONST",D[D.SEQUENCE=2]="SEQUENCE",D[D.DICTIONARY=3]="DICTIONARY",D[D.FSST_DICTIONARY=4]="FSST_DICTIONARY";class ui{constructor(e,t){this.values=e,this._size=t}get(e){let t=Math.floor(e/8);return(this.values[t]>>e%8&1)==1}set(e,t){let i=Math.floor(e/8);this.values[i]=this.values[i]|!!t<<e%8}getInt(e){let t=Math.floor(e/8);return this.values[t]>>e%8&1}size(){return this._size}getBuffer(){return this.values}}function ur(e,t,i){if(!t)return e;let r=t.size(),a=new e.constructor(r),n=0;for(let s=0;s<r;s++)a[s]=t.get(s)?e[n++]:i;return a}function ua(e,t,i,r,a){let n;var s=uo(e,t,i);switch(i.logicalLevelTechnique1){case B.DELTA:if(i.logicalLevelTechnique2===B.RLE){if(!a)return function(e,t,i){let r=new Int32Array(i),a=0,n=0;for(let i=0;i<t;i++){let s=e[i],o=h2(e[i+t]);for(let e=0;e<s;e++)n+=o,r[a++]=n}return r}(s,i.runs,i.numRleValues);n=h7(s=h6(s,i.runs,i.numRleValues))}else n=h7(s);break;case B.RLE:n=function(e,t,i){if(void 0===i){i=0;for(let r=0;r<t;r++)i+=e[r]}let r=new Int32Array(i),a=0;for(let i=0;i<t;i++){let n=e[i],s=e[i+t];s=h2(s),r.fill(s,a,a+n),a+=n}return r}(s,i.runs,i.numRleValues);break;case B.MORTON:ue(s),n=new Int32Array(s);break;case B.COMPONENTWISE_DELTA:n=function(e){if(e.length<2)return new Int32Array(e);let t=new Int32Array(e.length);t[0]=h2(e[0]),t[1]=h2(e[1]);let i=e.length/4*4,r=2;if(i>=4)for(;r<i-4;r+=4){let i=e[r+1],a=e[r+2],n=e[r+3];t[r]=h2(e[r])+t[r-2],t[r+1]=h2(i)+t[r-1],t[r+2]=h2(a)+t[r],t[r+3]=h2(n)+t[r+1]}for(;r!==e.length;r+=2)t[r]=h2(e[r])+t[r-2],t[r+1]=h2(e[r+1])+t[r-1];return t}(s);break;case B.NONE:n=function(e){let t=new Int32Array(e.length);for(let i=0;i<e.length;i++)t[i]=h2(e[i]);return t}(s);break;default:throw Error(`The specified Logical level technique is not supported: ${i.logicalLevelTechnique1}`)}return a?ur(n,a,0):n}function un(e,t,i,r,a){let n;var s=uo(e,t,i);switch(i.logicalLevelTechnique1){case B.DELTA:n=function(e){let t=new Uint32Array(e.length);t[0]=h2(e[0])>>>0;for(let i=1;i<e.length;i++)t[i]=t[i-1]+h2(e[i])>>>0;return t}(i.logicalLevelTechnique2===B.RLE?h6(s,i.runs,i.numRleValues):s);break;case B.RLE:n=h6(s,i.runs,i.numRleValues);break;case B.MORTON:ue(s),n=s;break;case B.COMPONENTWISE_DELTA:n=function(e){if(e.length<2)return new Uint32Array(e);let t=new Uint32Array(e.length);t[0]=h2(e[0])>>>0,t[1]=h2(e[1])>>>0;for(let i=2;i<e.length;i+=2)t[i]=t[i-2]+h2(e[i])>>>0,t[i+1]=t[i-1]+h2(e[i+1])>>>0;return t}(s);break;case B.NONE:n=s;break;default:throw Error(`The specified Logical level technique is not supported: ${i.logicalLevelTechnique1}`)}return a?ur(n,a,0):n}function us(e,t,i){return function(e,t){if(t.logicalLevelTechnique1===B.DELTA&&t.logicalLevelTechnique2===B.NONE){let t=new Int32Array(e.length+1);t[0]=0,t[1]=h2(e[0]);let i=t[1];for(let r=2;r!==t.length;++r)i+=h2(e[r-1]),t[r]=t[r-1]+i;return new Uint32Array(t)}if(t.logicalLevelTechnique1===B.RLE&&t.logicalLevelTechnique2===B.NONE)return function(e,t,i){let r=new Uint32Array(i+1);r[0]=0;let a=1,n=r[0];for(let i=0;i<t;i++){let s=e[i],o=e[i+t];for(let e=a;
2e<a+s;e++)r[e]=o+n,n=r[e];a+=s}return r}(e,t.runs,t.numRleValues);if(t.logicalLevelTechnique1===B.NONE&&t.logicalLevelTechnique2===B.NONE){let i=0;for(let t=0;t<e.length;t++)e[t]+=i,i=e[t];let r=new Uint32Array(t.numValues+1);return r[0]=0,r.set(e,1),r}if(t.logicalLevelTechnique1===B.DELTA&&t.logicalLevelTechnique2===B.RLE){let i=function(e,t,i){let r=new Int32Array(i+1);r[0]=0;let a=1,n=r[0];for(let i=0;i<t;i++){let s=e[i],o=e[i+t];o=h2(o);for(let e=a;e<a+s;e++)r[e]=o+n,n=r[e];a+=s}return r}(e,t.runs,t.numRleValues);return ue(i),new Uint32Array(i)}throw Error("Only delta encoding is supported for transforming length to offset streams yet.")}(uo(e,t,i),i)}function uo(e,t,i){let r=i.physicalLevelTechnique;switch(r){case O.FAST_PFOR:var a,n;return a=i.numValues,function(e,t,i,r,a){let n=r.get();if(3&i)throw Error(`FastPFOR: invalid encodedByteLength=${i} at offset=${n} (encodedBytes.length=${e.length}; expected a multiple of 4 bytes for an int32 big-endian word stream)`);let s=i>>>2,o=function(e,t){if(t<=e.encodedWords.length)return e.encodedWords;let i=new Uint32Array(Math.max(16,2*t));return e.encodedWords=i,i}(a,s);!function(e,t,i,r){if(t<0||i<0||t+i>e.length)throw RangeError(`decodeBigEndianInt32sInto: out of bounds (offset=${t}, byteLength=${i}, bytes.length=${e.length})`);let a=Math.floor(i/4),n=i%4!=0,s=n?a+1:a;if(r.length<s)throw RangeError(`decodeBigEndianInt32sInto: out.length=${r.length} < ${s}`);if(a>0){let i=e.byteOffset+t;if(3&i)for(let i=0;i<a;i++){let a=t+4*i;r[i]=e[a]<<24|e[a+1]<<16|e[a+2]<<8|e[a+3]}else{let t=new Uint32Array(e.buffer,i,a);for(let e=0;e<a;e++)r[e]=0|function(e){let t=e>>>0;return((255&t)<<24|(65280&t)<<8|t>>>8&65280|t>>>24&255)>>>0}(t[e])}}if(n){let n=t+4*a,s=i-4*a,o=0;for(let t=0;t<s;t++)o|=e[n+t]<<24-8*t;r[a]=0|o}}(e,n,i,o);let l=function(e,t,i){let r=0,a=0,n=new Uint32Array(t),s=i??hQ();if(e.length>0){let t=0|e[r];if(r=r+1|0,255&t)throw Error(`FastPFOR decode: invalid alignedLength=${t} (expected multiple of 256)`);if(a+t>n.length)throw Error(`FastPFOR decode: output buffer too small (outPos=${a}, alignedLength=${t}, out.length=${n.length})`);r=function(e,t,i,r,a,n){let s=r+(a-a%256),o=r,l=i;for(;o!==s;){let i=Math.min(hK,s-o);l=function(e,t,i,r,a,n){let s=0|i,o=0|e[s];if(o<=0||s+o>e.length-1)throw Error(`FastPFOR decode: invalid whereMeta=${o} at pageStart=${s} (expected > 0 and pageStart+whereMeta < encoded.length=${e.length})`);let l=s+o|0,h=e[l]>>>0,u=h+3>>>2,c=l+1,p=c+u;if(p>=e.length)throw Error(`FastPFOR decode: invalid byteSize=${h} (metaInts=${u}, pageStart=${s}, packedEnd=${l}, byteContainerStart=${c}) causes bitmapPos=${p} out of bounds (encoded.length=${e.length})`);let f=function(e,t,i,r){r.byteContainer.length<i&&(r.byteContainer=new Uint8Array(2*i),r.byteContainerI32=void 0);let a=r.byteContainer,n=i>>>2;if(3&a.byteOffset)for(let i=0;i<n;i=i+1|0){let r=0|e[t+i|0],n=i<<2;a[n]=255&r,a[n+1|0]=r>>>8&255,a[n+2|0]=r>>>16&255,a[n+3|0]=r>>>24&255}else{let i=r.byteContainerI32;(!i||i.buffer!==a.buffer||i.byteOffset!==a.byteOffset||i.length<n)&&(i=r.byteContainerI32=new Int32Array(a.buffer,a.byteOffset,a.byteLength>>>2)),i.set(e.subarray(t,t+n))}let s=3&i;if(s>0){let i=0|e[t+n|0],r=n<<2;for(let e=0;e<s;e=e+1|0)a[r+e|0]=i>>>(e<<3)&255}return a}(e,c,h,n),m=function(e,t,i){let r=0|e[t++],a=i.dataToBePacked;for(let s=2;s<=32;s=s+1|0){var n;if(!(r>>>s-1&1))continue;if(t>=e.length)throw Error(`FastPFOR decode: truncated exception stream header (bitWidth=${s}, streamWordIndex=${t}, needWords=1, availableWords=${e.length-t}, encodedWords=${e.length})`);let o=e[t++]>>>0,l=(n=o+31)-n%32,h=o*s+31>>>5;if(t+h>e.length)throw Error(`FastPFOR decode: truncated exception stream (bitWidth=${s}, size=${o}, streamWordIndex=${t}, needWords=${h}, availableWords=${e.length-t}, encodedWords=${e.length})`);let u=a[s];(!u||u.length<l)&&(u=a[s]=new Uint32Array(l));let c=0;for(;c<o;c=c+32|0)(function(e,t,i,r,a){switch(a){case 2:return function(e,t,i,r){let a=r,n=e[t]>>>0,s=e[t+1]>>>0;i[a++]=n>>>0&3,i[a++]=n>>>2&3,i[a++]=n>>>4&3,i[a++]=n>>>6&3,i[a++]=n>>>8&3,i[a++]=n>>>10&3,i[a++]=n>>>12&3,i[a++]=n>>>14&3,i[a++]=n>>>16&3,i[a++]=n>>>18&3,i[a++]=n>>>20&3,i[a++]=n>>>22&3,i[a++]=n>>>24&3,i[a++]=n>>>26&3,i[a++]=n>>>28&3,i[a++]=n>>>30&3,i[a++]=s>>>0&3,i[a++]=s>>>2&3,i[a++]=s>>>4&3,i[a++]=s>>>6&3,i[a++]=s>>>8&3,i[a++]=s>>>10&3,i[a++]=s>>>12&3,i[a++]=s>>>14&3,i[a++]=s>>>16&3,i[a++]=s>>>18&3,i[a++]=s>>>20&3,i[a++]=s>>>22&3,i[a++]=s>>>24&3,i[a++]=s>>>26&3,i[a++]=s>>>28&3,i[a]=s>>>30&3}(e,t,i,r);case 3:return function(e,t,i,r){let a=r,n=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0;i[a++]=n>>>0&7,i[a++]=n>>>3&7,i[a++]=n>>>6&7,i[a++]=n>>>9&7,i[a++]=n>>>12&7,i[a++]=n>>>15&7,i[a++]=n>>>18&7,i[a++]=n>>>21&7,i[a++]=n>>>24&7,i[a++]=n>>>27&7,i[a++]=7&(n>>>30|(1&s)<<2),i[a++]=s>>>1&7,i[a++]=s>>>4&7,i[a++]=s>>>7&7,i[a++]=s>>>10&7,i[a++]=s>>>13&7,i[a++]=s>>>16&7,i[a++]=s>>>19&7,i[a++]=s>>>22&7,i[a++]=s>>>25&7,i[a++]=s>>>28&7,i[a++]=7&(s>>>31|(3&o)<<1),i[a++]=o>>>2&7,i[a++]=o>>>5&7,i[a++]=o>>>8&7,i[a++]=o>>>11&7,i[a++]=o>>>14&7,i[a++]=o>>>17&7,i[a++]=o>>>20&7,i[a++]=o>>>23&7,i[a++]=o>>>
vendor: 8,644 bytes, line 2
226&7,i[a]=o>>>29&7}(e,t,i,r);case 4:return function(e,t,i,r){let a=r,n=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0;i[a++]=n>>>0&15,i[a++]=n>>>4&15,i[a++]=n>>>8&15,i[a++]=n>>>12&15,i[a++]=n>>>16&15,i[a++]=n>>>20&15,i[a++]=n>>>24&15,i[a++]=n>>>28&15,i[a++]=s>>>0&15,i[a++]=s>>>4&15,i[a++]=s>>>8&15,i[a++]=s>>>12&15,i[a++]=s>>>16&15,i[a++]=s>>>20&15,i[a++]=s>>>24&15,i[a++]=s>>>28&15,i[a++]=o>>>0&15,i[a++]=o>>>4&15,i[a++]=o>>>8&15,i[a++]=o>>>12&15,i[a++]=o>>>16&15,i[a++]=o>>>20&15,i[a++]=o>>>24&15,i[a++]=o>>>28&15,i[a++]=l>>>0&15,i[a++]=l>>>4&15,i[a++]=l>>>8&15,i[a++]=l>>>12&15,i[a++]=l>>>16&15,i[a++]=l>>>20&15,i[a++]=l>>>24&15,i[a]=l>>>28&15}(e,t,i,r);case 5:return function(e,t,i,r){let a=r,n=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,h=e[t+4]>>>0;i[a++]=n>>>0&31,i[a++]=n>>>5&31,i[a++]=n>>>10&31,i[a++]=n>>>15&31,i[a++]=n>>>20&31,i[a++]=n>>>25&31,i[a++]=31&(n>>>30|(7&s)<<2),i[a++]=s>>>3&31,i[a++]=s>>>8&31,i[a++]=s>>>13&31,i[a++]=s>>>18&31,i[a++]=s>>>23&31,i[a++]=31&(s>>>28|(1&o)<<4),i[a++]=o>>>1&31,i[a++]=o>>>6&31,i[a++]=o>>>11&31,i[a++]=o>>>16&31,i[a++]=o>>>21&31,i[a++]=o>>>26&31,i[a++]=31&(o>>>31|(15&l)<<1),i[a++]=l>>>4&31,i[a++]=l>>>9&31,i[a++]=l>>>14&31,i[a++]=l>>>19&31,i[a++]=l>>>24&31,i[a++]=31&(l>>>29|(3&h)<<3),i[a++]=h>>>2&31,i[a++]=h>>>7&31,i[a++]=h>>>12&31,i[a++]=h>>>17&31,i[a++]=h>>>22&31,i[a]=h>>>27&31}(e,t,i,r);case 6:return function(e,t,i,r){let a=r,n=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,h=e[t+4]>>>0,u=e[t+5]>>>0;i[a++]=n>>>0&63,i[a++]=n>>>6&63,i[a++]=n>>>12&63,i[a++]=n>>>18&63,i[a++]=n>>>24&63,i[a++]=63&(n>>>30|(15&s)<<2),i[a++]=s>>>4&63,i[a++]=s>>>10&63,i[a++]=s>>>16&63,i[a++]=s>>>22&63,i[a++]=63&(s>>>28|(3&o)<<4),i[a++]=o>>>2&63,i[a++]=o>>>8&63,i[a++]=o>>>14&63,i[a++]=o>>>20&63,i[a++]=o>>>26&63,i[a++]=l>>>0&63,i[a++]=l>>>6&63,i[a++]=l>>>12&63,i[a++]=l>>>18&63,i[a++]=l>>>24&63,i[a++]=63&(l>>>30|(15&h)<<2),i[a++]=h>>>4&63,i[a++]=h>>>10&63,i[a++]=h>>>16&63,i[a++]=h>>>22&63,i[a++]=63&(h>>>28|(3&u)<<4),i[a++]=u>>>2&63,i[a++]=u>>>8&63,i[a++]=u>>>14&63,i[a++]=u>>>20&63,i[a]=u>>>26&63}(e,t,i,r);case 7:return function(e,t,i,r){let a=r,n=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,h=e[t+4]>>>0,u=e[t+5]>>>0,c=e[t+6]>>>0;i[a++]=n>>>0&127,i[a++]=n>>>7&127,i[a++]=n>>>14&127,i[a++]=n>>>21&127,i[a++]=127&(n>>>28|(7&s)<<4),i[a++]=s>>>3&127,i[a++]=s>>>10&127,i[a++]=s>>>17&127,i[a++]=s>>>24&127,i[a++]=127&(s>>>31|(63&o)<<1),i[a++]=o>>>6&127,i[a++]=o>>>13&127,i[a++]=o>>>20&127,i[a++]=127&(o>>>27|(3&l)<<5),i[a++]=l>>>2&127,i[a++]=l>>>9&127,i[a++]=l>>>16&127,i[a++]=l>>>23&127,i[a++]=127&(l>>>30|(31&h)<<2),i[a++]=h>>>5&127,i[a++]=h>>>12&127,i[a++]=h>>>19&127,i[a++]=127&(h>>>26|(1&u)<<6),i[a++]=u>>>1&127,i[a++]=u>>>8&127,i[a++]=u>>>15&127,i[a++]=u>>>22&127,i[a++]=127&(u>>>29|(15&c)<<3),i[a++]=c>>>4&127,i[a++]=c>>>11&127,i[a++]=c>>>18&127,i[a]=c>>>25&127}(e,t,i,r);case 8:return function(e,t,i,r){let a=r,n=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,h=e[t+4]>>>0,u=e[t+5]>>>0,c=e[t+6]>>>0,p=e[t+7]>>>0;i[a++]=n>>>0&255,i[a++]=n>>>8&255,i[a++]=n>>>16&255,i[a++]=n>>>24&255,i[a++]=s>>>0&255,i[a++]=s>>>8&255,i[a++]=s>>>16&255,i[a++]=s>>>24&255,i[a++]=o>>>0&255,i[a++]=o>>>8&255,i[a++]=o>>>16&255,i[a++]=o>>>24&255,i[a++]=l>>>0&255,i[a++]=l>>>8&255,i[a++]=l>>>16&255,i[a++]=l>>>24&255,i[a++]=h>>>0&255,i[a++]=h>>>8&255,i[a++]=h>>>16&255,i[a++]=h>>>24&255,i[a++]=u>>>0&255,i[a++]=u>>>8&255,i[a++]=u>>>16&255,i[a++]=u>>>24&255,i[a++]=c>>>0&255,i[a++]=c>>>8&255,i[a++]=c>>>16&255,i[a++]=c>>>24&255,i[a++]=p>>>0&255,i[a++]=p>>>8&255,i[a++]=p>>>16&255,i[a]=p>>>24&255}(e,t,i,r);case 9:return function(e,t,i,r){let a=r,n=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,h=e[t+4]>>>0,u=e[t+5]>>>0,c=e[t+6]>>>0,p=e[t+7]>>>0,f=e[t+8]>>>0;i[a++]=n>>>0&511,i[a++]=n>>>9&511,i[a++]=n>>>18&511,i[a++]=511&(n>>>27|(15&s)<<5),i[a++]=s>>>4&511,i[a++]=s>>>13&511,i[a++]=s>>>22&511,i[a++]=511&(s>>>31|(255&o)<<1),i[a++]=o>>>8&511,i[a++]=o>>>17&511,i[a++]=511&(o>>>26|(7&l)<<6),i[a++]=l>>>3&511,i[a++]=l>>>12&511,i[a++]=l>>>21&511,i[a++]=511&(l>>>30|(127&h)<<2),i[a++]=h>>>7&511,i[a++]=h>>>16&511,i[a++]=511&(h>>>25|(3&u)<<7),i[a++]=u>>>2&511,i[a++]=u>>>11&511,i[a++]=u>>>20&511,i[a++]=511&(u>>>29|(63&c)<<3),i[a++]=c>>>6&511,i[a++]=c>>>15&511,i[a++]=511&(c>>>24|(1&p)<<8),i[a++]=p>>>1&511,i[a++]=p>>>10&511,i[a++]=p>>>19&511,i[a++]=511&(p>>>28|(31&f)<<4),i[a++]=f>>>5&511,i[a++]=f>>>14&511,i[a]=f>>>23&511}(e,t,i,r);case 10:return function(e,t,i,r){let a=r,n=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,h=e[t+4]>>>0,u=e[t+5]>>>0,c=e[t+6]>>>0,p=e[t+7]>>>0,f=e[t+8]>>>0,m=e[t+9]>>>0;i[a++]=n>>>0&1023,i[a++]=n>>>10&1023,i[a++]=n>>>20&1023,i[a++]=1023&(n>>>30|(255&s)<<2),i[a++]=s>>>8&1023,i[a++]=s>>>18&1023,i[a++]=1023&(s>>>28|(63&o)<<4),i[a++]=o>>>6&1023,i[a++]=o>>>16&1023,i[a++]=1023&(o>>>26|(15&l)<<6),i[a++]=l>>>4&1023,i[a++]=l>>>14&1023,i[a++]=1023&(l>>>24|(3&h)<<8),i[a++]=h>>>2&1023,i[a++]=h>>>12&1023,i[a++]=h>>>22&1023,i[a++]=u>>>0&1023,i[a++]=u>>>10&1023,i[a++]=u>>>20&1023,i[a++]=1023&(u>>>30|(255&c)<<2),i[a++]=c>>>8&1023,i[a++]=c>>>18&1023,i[a++]=1023&(c>>>28|(63&p)<<4),i[a++]=p>>>6&1023,i[a++]=p>>>16&1023,i[a++]=1023&(p>>>26|(15&f)<<6),i[a++]=f>>>4&1023,i[a++]=f>>>14&1023,i[a++]=1023&(f>>>24|(3&m)<<8),i[a++]=m>>>2&1023,i[a++]=m>>>12&1023,i[a]=m>>>22&1023}(e,t,i,r);case 11:return function(e,t,i,r){let a=r,n=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,h=e[t+4]>>>0,u=e[t+5]>>>0,c=e[t+6]>>>0,p=e[t+7]>>>0,f=e[t+8]>>>0,m=e[t+9]>>>0,_=e[t+10]>>>0;i[a++]=n>>>0&2047,i[a++]=n>>>11&2047,i[a++]=2047&(n>>>22|(1&s)<<10),i[a++]=s>>>1&2047,i[a++]=s>>>12&2047,i[a++]=2047&(s>>>23|(3&o)<<9),i[a++]=o>>>2&2047,i[a++]=o>>>13&2047,i[a++]=2047&(o>>>24|(7&l)<<8),i[a++]=l>>>3&2047,i[a++]=l>>>14&2047,i[a++]=2047&(l>>>25|(15&h)<<7),i[a++]=h>>>4&2047,i[a++]=h>>>15&2047,i[a++]=2047&(h>>>26|(31&u)<<6),i[a++]=u>>>5&2047,i[a++]=u>>>16&2047,i[a++]=2047&(u>>>27|(63&c)<<5),i[a++]=c>>>6&2047,i[a++]=c>>>17&2047,i[a++]=2047&(c>>>28|(127&p)<<4),i[a++]=p>>>7&2047,i[a++]=p>>>18&2047,i[a++]=2047&(p>>>29|(255&f)<<3),i[a++]=f>>>8&2047,i[a++]=f>>>19&2047,i[a++]=2047&(f>>>30|(511&m)<<2),i[a++]=m>>>9&2047,i[a++]=m>>>20&2047,i[a++]=2047&(m>>>31|(1023&_)<<1),i[a++]=_>>>10&2047,i[a]=_>>>21&2047}(e,t,i,r);case 12:return function(e,t,i,r){let a=r,n=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,h=e[t+4]>>>0,u=e[t+5]>>>0,c=e[t+6]>>>0,p=e[t+7]>>>0,f=e[t+8]>>>0,m=e[t+9]>>>0,_=e[t+10]>>>0,g=e[t+11]>>>0;i[a++]=n>>>0&4095,i[a++]=n>>>12&4095,i[a++]=4095&(n>>>24|(15&s)<<8),i[a++]=s>>>4&4095,i[a++]=s>>>16&4095,i[a++]=4095&(s>>>28|(255&o)<<4),i[a++]=o>>>8&4095,i[a++]=o>>>20&4095,i[a++]=l>>>0&4095,i[a++]=l>>>12&4095,i[a++]=4095&(l>>>24|(15&h)<<8),i[a++]=h>>>4&4095,i[a++]=h>>>16&4095,i[a++]=4095&(h>>>28|(255&u)<<4),i[a++]=u>>>8&4095,i[a++]=u>>>20&4095,i[a++]=c>>>0&4095,i[a++]=c>>>12&4095,i[a++]=4095&(c>>>24|(15&p)<<8),i[a++]=p>>>4&4095,i[a++]=p>>>16&4095,i[a++]=4095&(p>>>28|(255&f)<<4),i[a++]=f>>>8&4095,i[a++]=f>>>20&4095,i[a++]=m>>>0&4095,i[a++]=m>>>12&4095,i[a++]=4095&(m>>>24|(15&_)<<8),i[a++]=_>>>4&4095,i[a++]=_>>>16&4095,i[a++]=4095&(_>>>28|(255&g)<<4),i[a++]=g>>>8&4095,i[a]=g>>>20&4095}(e,t,i,r);case 16:return function(e,t,i,r){let a=r,n=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,h=e[t+4]>>>0,u=e[t+5]>>>0,c=e[t+6]>>>0,p=e[t+7]>>>0,f=e[t+8]>>>0,m=e[t+9]>>>0,_=e[t+10]>>>0,g=e[t+11]>>>0,y=e[t+12]>>>0,x=e[t+13]>>>0,v=e[t+14]>>>0,b=e[t+15]>>>0;i[a++]=n>>>0&65535,i[a++]=n>>>16&65535,i[a++]=s>>>0&65535,i[a++]=s>>>16&65535,i[a++]=o>>>0&65535,i[a++]=o>>>16&65535,i[a++]=l>>>0&65535,i[a++]=l>>>16&65535,i[a++]=h>>>0&65535,i[a++]=h>>>16&65535,i[a++]=u>>>0&65535,i[a++]=u>>>16&65535,i[a++]=c>>>0&65535,i[a++]=c>>>16&65535,i[a++]=p>>>0&65535,i[a++]=p>>>16&65535,i[a++]=f>>>0&65535,i[a++]=f>>>16&65535,i[a++]=m>>>0&65535,i[a++]=m>>>16&65535,i[a++]=_>>>0&65535,i[a++]=_>>>16&65535,i[a++]=g>>>0&65535,i[a++]=g>>>16&65535,i[a++]=y>>>0&65535,i[a++]=y>>>16&65535,i[a++]=x>>>0&65535,i[a++]=x>>>16&65535,i[a++]=v>>>0&65535,i[a++]=v>>>16&65535,i[a++]=b>>>0&65535,i[a]=b>>>16&65535}(e,t,i,r);case 32:for(let a=0;a<32;a=a+1|0)i[r+a|0]=0|e[t+a|0];return}let n=hY[a]>>>0,s=t,o=0,l=e[s]>>>0;for(let t=0;t<32;t++)if(o+a<=32)i[r+t]=l>>>o&n,32===(o+=a)&&(o=0,s++,31!==t&&(l=e[s]>>>0));else{let h=32-o,u=l>>>o;l=e[++s]>>>0,i[r+t]=(u|(l&hY[a-h]>>>0)<<h)&n,o=a-h}})(e,t,u,c,s),t=t+s|0;t=t-((c-o|0)*s>>>5)|0,i.exceptionSizes[s]=o}return t}(e,p,n);return n.dataPointers.fill(0),function(e,t,i,r,a,n,s,o,l,h){let u=0|i,c=0;for(let t=0;t<s;t=t+1|0){let i=function(e,t,i,r){if(i+2>t)throw Error(`FastPFOR decode: byteContainer underflow at block=${r} (need 2 bytes for [bitWidth, exceptionCount], bytePos=${i}, byteSize=${t})`);let a=e[i++],n=e[i++];if(a>32)throw Error(`FastPFOR decode: invalid bitWidth=${a} at block=${r}
2 (expected 0..32). This likely indicates corrupted or truncated input.`);return{bitWidth:a,exceptionCount:n,bytePosIn:i}}(o,l,c,t);c=i.bytePosIn;let r=i.bitWidth,s=i.exceptionCount,p=n+256*t|0;switch(r){case 0:a.fill(0,p,p+256);break;case 32:for(let t=0;t<256;t=t+1|0)a[p+t|0]=0|e[u+t|0];u=u+256|0;break;default:u=function(e,t,i,r,a){switch(a){case 1:let n=r,s=t;for(let t=0;t<8;t++){let t=e[s++]>>>0;i[n++]=t>>>0&1,i[n++]=t>>>1&1,i[n++]=t>>>2&1,i[n++]=t>>>3&1,i[n++]=t>>>4&1,i[n++]=t>>>5&1,i[n++]=t>>>6&1,i[n++]=t>>>7&1,i[n++]=t>>>8&1,i[n++]=t>>>9&1,i[n++]=t>>>10&1,i[n++]=t>>>11&1,i[n++]=t>>>12&1,i[n++]=t>>>13&1,i[n++]=t>>>14&1,i[n++]=t>>>15&1,i[n++]=t>>>16&1,i[n++]=t>>>17&1,i[n++]=t>>>18&1,i[n++]=t>>>19&1,i[n++]=t>>>20&1,i[n++]=t>>>21&1,i[n++]=t>>>22&1,i[n++]=t>>>23&1,i[n++]=t>>>24&1,i[n++]=t>>>25&1,i[n++]=t>>>26&1,i[n++]=t>>>27&1,i[n++]=t>>>28&1,i[n++]=t>>>29&1,i[n++]=t>>>30&1,i[n++]=t>>>31&1}break;case 2:!function(e,t,i,r){let a=r,n=t;for(let t=0;t<8;t++){let t=e[n++]>>>0,r=e[n++]>>>0;i[a++]=t>>>0&3,i[a++]=t>>>2&3,i[a++]=t>>>4&3,i[a++]=t>>>6&3,i[a++]=t>>>8&3,i[a++]=t>>>10&3,i[a++]=t>>>12&3,i[a++]=t>>>14&3,i[a++]=t>>>16&3,i[a++]=t>>>18&3,i[a++]=t>>>20&3,i[a++]=t>>>22&3,i[a++]=t>>>24&3,i[a++]=t>>>26&3,i[a++]=t>>>28&3,i[a++]=t>>>30&3,i[a++]=r>>>0&3,i[a++]=r>>>2&3,i[a++]=r>>>4&3,i[a++]=r>>>6&3,i[a++]=r>>>8&3,i[a++]=r>>>10&3,i[a++]=r>>>12&3,i[a++]=r>>>14&3,i[a++]=r>>>16&3,i[a++]=r>>>18&3,i[a++]=r>>>20&3,i[a++]=r>>>22&3,i[a++]=r>>>24&3,i[a++]=r>>>26&3,i[a++]=r>>>28&3,i[a++]=r>>>30&3}}(e,t,i,r);break;case 3:!function(e,t,i,r){let a=r,n=t;for(let t=0;t<8;t++){let t=e[n++]>>>0,r=e[n++]>>>0,s=e[n++]>>>0;i[a++]=t>>>0&7,i[a++]=t>>>3&7,i[a++]=t>>>6&7,i[a++]=t>>>9&7,i[a++]=t>>>12&7,i[a++]=t>>>15&7,i[a++]=t>>>18&7,i[a++]=t>>>21&7,i[a++]=t>>>24&7,i[a++]=t>>>27&7,i[a++]=7&(t>>>30|(1&r)<<2),i[a++]=r>>>1&7,i[a++]=r>>>4&7,i[a++]=r>>>7&7,i[a++]=r>>>10&7,i[a++]=r>>>13&7,i[a++]=r>>>16&7,i[a++]=r>>>19&7,i[a++]=r>>>22&7,i[a++]=r>>>25&7,i[a++]=r>>>28&7,i[a++]=7&(r>>>31|(3&s)<<1),i[a++]=s>>>2&7,i[a++]=s>>>5&7,i[a++]=s>>>8&7,i[a++]=s>>>11&7,i[a++]=s>>>14&7,i[a++]=s>>>17&7,i[a++]=s>>>20&7,i[a++]=s>>>23&7,i[a++]=s>>>26&7,i[a++]=s>>>29&7}}(e,t,i,r);break;case 4:!function(e,t,i,r){let a=r,n=t;for(let t=0;t<8;t++){let t=e[n++]>>>0,r=e[n++]>>>0,s=e[n++]>>>0,o=e[n++]>>>0;i[a++]=t>>>0&15,i[a++]=t>>>4&15,i[a++]=t>>>8&15,i[a++]=t>>>12&15,i[a++]=t>>>16&15,i[a++]=t>>>20&15,i[a++]=t>>>24&15,i[a++]=t>>>28&15,i[a++]=r>>>0&15,i[a++]=r>>>4&15,i[a++]=r>>>8&15,i[a++]=r>>>12&15,i[a++]=r>>>16&15,i[a++]=r>>>20&15,i[a++]=r>>>24&15,i[a++]=r>>>28&15,i[a++]=s>>>0&15,i[a++]=s>>>4&15,i[a++]=s>>>8&15,i[a++]=s>>>12&15,i[a++]=s>>>16&15,i[a++]=s>>>20&15,i[a++]=s>>>24&15,i[a++]=s>>>28&15,i[a++]=o>>>0&15,i[a++]=o>>>4&15,i[a++]=o>>>8&15,i[a++]=o>>>12&15,i[a++]=o>>>16&15,i[a++]=o>>>20&15,i[a++]=o>>>24&15,i[a++]=o>>>28&15}}(e,t,i,r);break;case 5:!function(e,t,i,r){let a=r,n=t;for(let t=0;t<8;t++){let t=e[n++]>>>0,r=e[n++]>>>0,s=e[n++]>>>0,o=e[n++]>>>0,l=e[n++]>>>0;i[a++]=t>>>0&31,i[a++]=t>>>5&31,i[a++]=t>>>10&31,i[a++]=t>>>15&31,i[a++]=t>>>20&31,i[a++]=t>>>25&31,i[a++]=31&(t>>>30|(7&r)<<2),i[a++]=r>>>3&31,i[a++]=r>>>8&31,i[a++]=r>>>13&31,i[a++]=r>>>18&31,i[a++]=r>>>23&31,i[a++]=31&(r>>>28|(1&s)<<4),i[a++]=s>>>1&31,i[a++]=s>>>6&31,i[a++]=s>>>11&31,i[a++]=s>>>16&31,i[a++]=s>>>21&31,i[a++]=s>>>26&31,i[a++]=31&(s>>>31|(15&o)<<1),i[a++]=o>>>4&31,i[a++]=o>>>9&31,i[a++]=o>>>14&31,i[a++]=o>>>19&31,i[a++]=o>>>24&31,i[a++]=31&(o>>>29|(3&l)<<3),i[a++]=l>>>2&31,i[a++]=l>>>7&31,i[a++]=l>>>12&31,i[a++]=l>>>17&31,i[a++]=l>>>22&31,i[a++]=l>>>27&31}}(e,t,i,r);break;case 6:!function(e,t,i,r){let a=r,n=t;for(let t=0;t<8;t++){let t=e[n++]>>>0,r=e[n++]>>>0,s=e[n++]>>>0,o=e[n++]>>>0,l=e[n++]>>>0,h=e[n++]>>>0;i[a++]=t>>>0&63,i[a++]=t>>>6&63,i[a++]=t>>>12&63,i[a++]=t>>>18&63,i[a++]=t>>>24&63,i[a++]=63&(t>>>30|(15&r)<<2),i[a++]=r>>>4&63,i[a++]=r>>>10&63,i[a++]=r>>>16&63,i[a++]=r>>>22&63,i[a++]=63&(r>>>28|(3&s)<<4),i[a++]=s>>>2&63,i[a++]=s>>>8&63,i[a++]=s>>>14&63,i[a++]=s>>>20&63,i[a++]=s>>>26&63,i[a++]=o>>>0&63,i[a++]=o>>>6&63,i[a++]=o>>>12&63,i[a++]=o>>>18&63,i[a++]=o>>>24&63,i[a++]=63&(o>>>30|(15&l)<<2),i[a++]=l>>>4&63,i[a++]=l>>>10&63,i[a++]=l>>>16&63,i[a++]=l>>>22&63,i[a++]=63&(l>>>28|(3&h)<<4),i[a++]=h>>>2&63,i[a++]=h>>>8&63,i[a++]=h>>>14&63,i[a++]=h>>>20&63,i[a++]=h>>>26&63}}(e,t,i,r);break;case 7:!function(e,t,i,r){let a=r,n=t;
2for(let t=0;t<8;t++){let t=e[n++]>>>0,r=e[n++]>>>0,s=e[n++]>>>0,o=e[n++]>>>0,l=e[n++]>>>0,h=e[n++]>>>0,u=e[n++]>>>0;i[a++]=t>>>0&127,i[a++]=t>>>7&127,i[a++]=t>>>14&127,i[a++]=t>>>21&127,i[a++]=127&(t>>>28|(7&r)<<4),i[a++]=r>>>3&127,i[a++]=r>>>10&127,i[a++]=r>>>17&127,i[a++]=r>>>24&127,i[a++]=127&(r>>>31|(63&s)<<1),i[a++]=s>>>6&127,i[a++]=s>>>13&127,i[a++]=s>>>20&127,i[a++]=127&(s>>>27|(3&o)<<5),i[a++]=o>>>2&127,i[a++]=o>>>9&127,i[a++]=o>>>16&127,i[a++]=o>>>23&127,i[a++]=127&(o>>>30|(31&l)<<2),i[a++]=l>>>5&127,i[a++]=l>>>12&127,i[a++]=l>>>19&127,i[a++]=127&(l>>>26|(1&h)<<6),i[a++]=h>>>1&127,i[a++]=h>>>8&127,i[a++]=h>>>15&127,i[a++]=h>>>22&127,i[a++]=127&(h>>>29|(15&u)<<3),i[a++]=u>>>4&127,i[a++]=u>>>11&127,i[a++]=u>>>18&127,i[a++]=u>>>25&127}}(e,t,i,r);break;case 8:!function(e,t,i,r){let a=r,n=t;for(let t=0;t<8;t++){let t=e[n++]>>>0,r=e[n++]>>>0,s=e[n++]>>>0,o=e[n++]>>>0,l=e[n++]>>>0,h=e[n++]>>>0,u=e[n++]>>>0,c=e[n++]>>>0;i[a++]=t>>>0&255,i[a++]=t>>>8&255,i[a++]=t>>>16&255,i[a++]=t>>>24&255,i[a++]=r>>>0&255,i[a++]=r>>>8&255,i[a++]=r>>>16&255,i[a++]=r>>>24&255,i[a++]=s>>>0&255,i[a++]=s>>>8&255,i[a++]=s>>>16&255,i[a++]=s>>>24&255,i[a++]=o>>>0&255,i[a++]=o>>>8&255,i[a++]=o>>>16&255,i[a++]=o>>>24&255,i[a++]=l>>>0&255,i[a++]=l>>>8&255,i[a++]=l>>>16&255,i[a++]=l>>>24&255,i[a++]=h>>>0&255,i[a++]=h>>>8&255,i[a++]=h>>>16&255,i[a++]=h>>>24&255,i[a++]=u>>>0&255,i[a++]=u>>>8&255,i[a++]=u>>>16&255,i[a++]=u>>>24&255,i[a++]=c>>>0&255,i[a++]=c>>>8&255,i[a++]=c>>>16&255,i[a++]=c>>>24&255}}(e,t,i,r);break;case 16:let o=r,l=t;for(let t=0;t<128;t++){let t=e[l++]>>>0;i[o++]=65535&t,i[o++]=t>>>16&65535}break;default:!function(e,t,i,r,a){let n=hY[a]>>>0,s=t,o=0,l=e[s]>>>0,h=r;for(let t=0;t<8;t++){for(let t=0;t<32;t++)if(o+a<=32)i[h+t]=l>>>o&n,32===(o+=a)&&(o=0,s++,31!==t&&(l=e[s]>>>0));else{let r=32-o,u=l>>>o;l=e[++s]>>>0;let c=a-r;i[h+t]=(u|(l&-1>>>32-c>>>0)<<r)&n,o=c}h+=32,o=0,t<7&&(l=e[s]>>>0)}}(e,t,i,r,a)}return t+(a<<3)|0}(e,u,a,p,r)}s>0&&(c=function(e,t,i,r,a,n,s,o,l){let{maxBits:h,exceptionBitWidth:u,bytePosIn:c}=function(e,t,i,r,a,n){if(i+1>t)throw Error(`FastPFOR decode: exception header underflow at block=${n} (need 1 byte for maxBits, bytePos=${i}, byteSize=${t})`);let s=e[i++];if(s<r||s>32)throw Error(`FastPFOR decode: invalid maxBits=${s} at block=${n} (bitWidth=${r}, expected ${r}..32)`);let o=s-r|0;if(o<1||o>32)throw Error(`FastPFOR decode: invalid exceptionBitWidth=${o} at block=${n} (bitWidth=${r}, maxBits=${s})`);if(i+a>t)throw Error(`FastPFOR decode: exception positions underflow at block=${n} (need=${a}, have=${t-i})`);return{maxBits:s,exceptionBitWidth:o,bytePosIn:i}}(a,n,s,i,r,l);if(s=c,1===u){let n=1<<i;for(let i=0;i<r;i=i+1|0)e[a[s++]+t|0]|=n;return s}let p=o.dataToBePacked[u];if(!p)throw Error(`FastPFOR decode: missing exception stream for exceptionBitWidth=${u} (bitWidth=${i}, maxBits=${h}) at block ${l}`);let f=o.dataPointers,m=0|f[u],_=0|o.exceptionSizes[u];if(m+r>_)throw Error(`FastPFOR decode: exception stream overflow for exceptionBitWidth=${u} (ptr=${m}, need ${r}, size=${_}) at block ${l}`);for(let n=0;n<r;n=n+1|0){let r=a[s++],n=0|p[m++];e[r+t|0]|=n<<i}return f[u]=m,s}(a,p,r,s,o,l,c,h,t))}if(u!==r)throw Error(`FastPFOR decode: packed region mismatch (pageStart=${t}, packedStart=${i}, consumedPackedEnd=${u}, expectedPackedEnd=${r}, packedWords=${r-i}, encoded.length=${e.length})`)}(e,s,s+1|0,l,t,0|r,a/256|0,f,h,n),m}(e,t,l,o,i,n),o=o+i|0}return l}(e,n,r,a,t,s),a=a+t|0}return function(e,t,i,r,a,n){if(0===n)return;let s=0,o=t,l=t+i,h=a,u=a+n,c=0,p=0;for(;o<l&&h<u;){let t=e[o]>>>s&255;if(s+=8,o+=s>>>5,s&=31,c|=(127&t)<<p,128&t)r[h++]=0|c,c=0,p=0;else if((p+=7)>28)throw Error(`FastPFOR VByte: unterminated value (expected MSB=1 terminator within 5 bytes; shift=${p}, partial=${c}, decoded=${h-a}/${n}, inPos=${o}, inEnd=${l})`)}if(h!==u)throw Error(`FastPFOR VByte: truncated stream (decoded=${h-a}, expected=${n}, consumedWords=${o-t}/${i}, vbyteStart=${t}, vbyteEnd=${l})`)}(e,r,e.length-r|0,n,a,t-a|0),n}(o.subarray(0,s),t,a.decoderWorkspace);return r.add(i),l}(e,a,n=i.byteLength,t,function(e=16){if(e<0)throw RangeError(`initialEncodedWordCapacity must be >= 0, got ${e}`);return{encodedWords:new Uint32Array(Math.max(16,0|e)),decoderWorkspace:hQ()}}(n>>>2));case O.VARINT:return h0(e,t,i.numValues);case O.NONE:{let r=t.get();return t.add(i.byteLength),new Uint32Array(e.subarray(r,t.get()))}default:throw Error(`Specified physicalLevelTechnique ${r} is not supported (yet).`)}}function ul(e,t,i){let r=uo(e,t,i);return 1===r.length?r[0]:r[1]}function uh(e,t,i){var r=uo(e,t,i);if(2===r.length){let e=h2(r[1]);return[e,e]}return[h2(r[2]),h2(r[3])]}function uu(e,t,i){var r=h1(e,t,i.numValues);if(2===r.length){let e=h3(r[1]);return[e,e]}return[h3(r[2]),h3(r[3])]}function uc(e,t,i,r){let a;var n=h1(e,t,i.numValues);switch(i.logicalLevelTechnique1){case B.DELTA:a=function(e){let t=new BigUint64Array(e.length);t[0]=BigInt.asUintN(64,h3(e[0]));for(let i=1;i<e.length;i++)t[i]=BigInt.asUintN(64,t[i-1]+h3(e[i]));return t}(i.logicalLevelTechnique2===B.RLE?h4(n,i.runs,i.numRleValues):n);break;case B.RLE:a=h4(n,i.runs,i.numRleValues);break;case B.NONE:a=n;break;default:throw Error(`The specified Logical level technique is not supported: ${i.logicalLevelTechnique1}`)}return r?ur(a,r,0n):a}function ud(e,t,i){let r=h1(e,t,i.numValues);return 1===r.length?r[0]:r[1]}function up(e,t,i,r,a="int32"){let n=e.logicalLevelTechnique1;if(n===B.RLE)return 1===e.runs?G.CONST:G.FLAT;if(n!==B.DELTA||e.logicalLevelTechnique2!==B.RLE)return 1===e.numValues?G.CONST:G.FLAT;let s=t instanceof ui?t.size():t;if(e.numRleValues!==s)return G.FLAT;if(1===e.runs)return G.SEQUENCE;
2if(2!==e.runs)return 1===e.numValues?G.CONST:G.FLAT;let o=r.get();if(e.physicalLevelTechnique===O.VARINT)return!function(e,t,i){let r=new hX(t.get());if("int64"===i){let t=h1(e,r,4);return 2n===t[2]&&2n===t[3]}let a=h0(e,r,4);return 2===a[2]&&2===a[3]}(i,r,a)?1===e.numValues?G.CONST:G.FLAT:G.SEQUENCE;let l=r.get(),h=new Int32Array(i.buffer,i.byteOffset+l,4);return r.set(o),2===h[2]&&2===h[3]?G.SEQUENCE:1===e.numValues?G.CONST:G.FLAT}class uf extends hU{getValueFromBuffer(e){return this.dataBuffer[e]}}class um extends hZ{constructor(e,t,i,r){super(e,BigInt64Array.of(t),i,r)}getValueFromBuffer(e){return this.dataBuffer[0]+BigInt(e)*this.delta}}function u_(e,t,i){return{x:ug(e,t)-i,y:ug(e>>1,t)-i}}function ug(e,t){let i=0;for(let r=0;r<t;r++)i|=(e&1<<2*r)>>r;return i}function uy(e,t,i,r,a,n,s){return e===q.MORTON?function(e,t,i,r,a,n){let s=Array(a?r+1:r);for(let a=0;a<r;a++){let r=u_(e[t[i+a]],n.numBits,n.coordinateShift);s[a]=new w(r.x,r.y)}return a&&(s[s.length-1]=s[0]),s}(t,i,r,a,n,s):function(e,t,i,r,a){let n=Array(a?r+1:r);for(let a=0;a<2*r;a+=2){let r=2*t[i+a/2];n[a/2]=new w(e[r],e[r+1])}return a&&(n[n.length-1]=n[0]),n}(t,i,r,a,n)}function ux(e,t,i,r){let a=Array(r?i+1:i);for(let r=0;r<2*i;r+=2)a[r/2]=new w(e[t+r],e[t+r+1]);return r&&(a[a.length-1]=a[0]),a}(z=$||($={}))[z.POINT=0]="POINT",z[z.LINESTRING=1]="LINESTRING",z[z.POLYGON=2]="POLYGON",z[z.MULTIPOINT=3]="MULTIPOINT",z[z.MULTILINESTRING=4]="MULTILINESTRING",z[z.MULTIPOLYGON=5]="MULTIPOLYGON",(k=Z||(Z={}))[k.POINT=0]="POINT",k[k.LINESTRING=1]="LINESTRING",k[k.POLYGON=2]="POLYGON",(R=q||(q={}))[R.MORTON=0]="MORTON",R[R.VEC_2=1]="VEC_2",R[R.VEC_3=2]="VEC_3";class uv{constructor(e,t,i,r,a){this._vertexBufferType=e,this._topologyVector=t,this._vertexOffsets=i,this._vertexBuffer=r,this._mortonSettings=a}get vertexBufferType(){return this._vertexBufferType}get topologyVector(){return this._topologyVector}get vertexOffsets(){return this._vertexOffsets}get vertexBuffer(){return this._vertexBuffer}getSimpleEncodedVertex(e){let t=this.vertexOffsets?2*this.vertexOffsets[e]:2*e;return[this.vertexBuffer[t],this.vertexBuffer[t+1]]}getVertex(e){if(this.vertexOffsets&&this.mortonSettings){let t=u_(this.vertexBuffer[this.vertexOffsets[e]],this.mortonSettings.numBits,this.mortonSettings.coordinateShift);return[t.x,t.y]}let t=this.vertexOffsets?2*this.vertexOffsets[e]:2*e;return[this.vertexBuffer[t],this.vertexBuffer[t+1]]}getGeometries(){return function(e){let t=Array(e.numGeometries),i=1,r=1,a=1,n=0,s=0,o=0,l=e.mortonSettings,h=e.topologyVector,u=h.geometryOffsets,c=h.partOffsets,p=h.ringOffsets,f=e.vertexOffsets,m=!f||0===f.length,_=e.containsPolygonGeometry(),g=e.vertexBuffer;for(let h=0;h<e.numGeometries;h++)switch(e.geometryType(h)){case $.POINT:{let h,_;if(m)h=g[s++],_=g[s++];else if(e.vertexBufferType===q.MORTON){let e=u_(g[f[o++]],l.numBits,l.coordinateShift);h=e.x,_=e.y}else{let e=2*f[o++];h=g[e],_=g[e+1]}t[n++]=[[new w(h,_)]],u&&a++,c&&i++,p&&r++}break;case $.MULTIPOINT:{let e=u[a]-u[a-1];a++;let l=Array(e);if(m)for(let t=0;t<e;t++){let e=g[s++],i=g[s++];l[t]=new w(e,i)}else for(let t=0;t<e;t++){let e=2*f[o++];l[t]=new w(g[e],g[e+1])}t[n++]=l.map(e=>[e]),i+=e,r+=e}break;case $.LINESTRING:{let h,y;_?(h=p[r]-p[r-1],r++):h=c[i]-c[i-1],i++,m?(y=ux(g,s,h,!1),s+=2*h):(y=uy(e.vertexBufferType,g,f,o,h,!1,l),o+=h),t[n++]=[y],u&&a++}break;case $.POLYGON:{let h=c[i]-c[i-1];i++;let _=Array(h-1),y,x=p[r]-p[r-1];if(r++,m){y=ux(g,s,x,!0),s+=2*x;for(let e=0;e<_.length;e++)x=p[r]-p[r-1],r++,_[e]=ux(g,s,x,!0),s+=2*x}else{y=uy(e.vertexBufferType,g,f,o,x,!0,l),o+=x;for(let t=0;t<_.length;t++)x=p[r]-p[r-1],r++,_[t]=uy(e.vertexBufferType,g,f,o,x,!0,l),o+=x}t[n++]=[y].concat(_),u&&a++}break;case $.MULTILINESTRING:{let h=u[a]-u[a-1];a++;let y=Array(h);for(let t=0;t<h;t++){let a;if(_?(a=p[r]-p[r-1],r++):a=c[i]-c[i-1],i++,m)y[t]=ux(g,s,a,!1),s+=2*a;else{let i=uy(e.vertexBufferType,g,f,o,a,!1,l);y[t]=i,o+=a}}t[n++]=y}break;case $.MULTIPOLYGON:{let h=u[a]-u[a-1];a++;let _=Array(h);for(let t=0;t<h;t++){let a,n=c[i]-c[i-1];i++;let h=Array(n-1),u=p[r]-p[r-1];r++,m?(a=ux(g,s,u,!0),s+=2*u):(a=uy(e.vertexBufferType,g,f,o,u,!0,l),o+=u);for(let t=0;t<h.length;t++){let i=p[r]-p[r-1];r++,m?(h[t]=ux(g,s,i,!0),s+=2*i):(h[t]=uy(e.vertexBufferType,g,f,o,i,!0,l),o+=i)}_[t]=[a].concat(h)}t[n++]=_.flat()}break;default:throw Error("The specified geometry type is currently not supported.")}return t}(this)}get mortonSettings(){return this._mortonSettings}}class ub extends uv{constructor(e,t,i,r,a,n,s){super(i,r,a,n,s),this._numGeometries=e,this._geometryType=t}geometryType(e){return this._geometryType}get numGeometries(){return this._numGeometries}containsPolygonGeometry(){return this._geometryType===$.POLYGON||this._geometryType===$.MULTIPOLYGON}containsSingleGeometryType(){return!0}}class uw extends uv{constructor(e,t,i,r,a,n){super(e,i,r,a,n),this._geometryTypes=t}geometryType(e){return this._geometryTypes[e]}get numGeometries(){return this._geometryTypes.length}containsPolygonGeometry(){for(let e=0;e<this.numGeometries;e++)if(this.geometryType(e)===$.POLYGON||this.geometryType(e)===$.MULTIPOLYGON)return!0;return!1}containsSingleGeometryType(){return!1}}class uT{constructor(e,t,i,r){this._triangleOffsets=e,this._indexBuffer=t,this._vertexBuffer=i,this._topologyVector=r}get triangleOffsets(){return this._triangleOffsets}get indexBuffer(){return this._indexBuffer}get vertexBuffer(){return this._vertexBuffer}get topologyVector(){return this._topologyVector}getGeometries(){if(!this._topologyVector)throw Error("Cannot convert GpuVector to coordinates without topology information");let e=Array(this.numGeometries),t=this._topologyVector,i=t.partOffsets,r=t.ringOffsets,a=t.geometryOffsets,n=0,s=1,o=1,l=1;for(let t=0;t<this.numGeometries;t++)switch(this.geometryType(t)){case $.POLYGON:{let h=i[s]-i[s-1];s++;let u=[];for(let e=0;e<h;e++){let e=r[o]-r[o-1];o++;let t=[];for(let i=0;i<e;i++){let e=this._vertexBuffer[n++],i=this._vertexBuffer[n++];t.push(new w(e,i))}t.length>0&&t.push(t[0]),u.push(t)}e[t]=u,a&&l++}break;case $.MULTIPOLYGON:{let h=a[l]-a[l-1];l++;let u=[];for(let e=0;e<h;e++){let e=i[s]-i[s-1];s++;for(let t=0;t<e;t++){let e=r[o]-r[o-1];o++;let t=[];for(let i=0;i<e;i++){let e=this._vertexBuffer[n++],i=this._vertexBuffer[n++];t.push(new w(e,i))}t.length>0&&t.push(t[0]),u.push(t)}}e[t]=u}}return e}[Symbol.iterator](){return null}}class uS extends uT{constructor(e,t,i,r,a,n){super(i,r,a,n),this._numGeometries=e,this._geometryType=t}geometryType(e){return this._geometryType}get numGeometries(){return this._numGeometries}containsSingleGeometryType(){return!0}}class uP extends uT{constructor(e,t,i,r,a){super(t,i,r,a),this._geometryTypes=e}geometryType(e){return this._geometryTypes[e]}get numGeometries(){return this._geometryTypes.length}containsSingleGeometryType(){return!1}}function uM(e,t,i){let r=new Uint32Array(e.length+1),a=0;r[0]=a;let n=0;for(let s=0;s<e.length;s++)a=r[s+1]=a+(e[s]>i?t[n++]:1);return r}function uI(e,t,i,r){let a=new Uint32Array(t[t.length-1]+1),n=0;a[0]=n;let s=1,o=0;for(let l=0;l<e.length;l++){let h=e[l],u=t[l+1]-t[l];if(5===h||2===h||r&&(4===h||1===h))for(let e=0;e<u;e++)n=a[s++]=n+i[o++];else for(let e=0;e<u;e++)a[s++]=++n}return a}class uE extends hN{constructor(e,t,i){super(e,t.getBuffer(),i),this.dataVector=t}getValueFromBuffer(e){return this.dataVector.get(e)}}class uC extends hU{getValueFromBuffer(e){return this.dataBuffer[e]}}class uA extends hN{constructor(e,t,i,r){super(e,r?BigInt64Array.of(t):BigUint64Array.of(t),i)}getValueFromBuffer(e){return this.dataBuffer[0]}}function uD(e,t,i,r,a){let n=function(e,t,i,r){let a=new Uint8Array(t),n=0,s=r.get()+i;for(;n<t&&!(r.get()>=s);){let i=e[r.increment()];if(i<=127){let s=i+3,o=e[r.increment()],l=Math.min(n+s,t);a.fill(o,n,l),n=l}else{let s=256-i;for(let i=0;i<s&&n<t;i++)a[n++]=e[r.increment()]}}return r.set(s),a}(e,Math.ceil(t/8),i,r);return a?function(e,t,i){if(!i)return e;let r=i.size(),a=new ui(e,t),n=new ui(new Uint8Array(Math.ceil(r/8)),r),s=0;for(let e=0;e<r;e++){let t=!!i.get(e)&&a.get(s++);n.set(e,t)}return n.getBuffer()}(n,t,a):n}let uz=new TextDecoder;function uk(e,t,i){return i-t>=12?uz.decode(e.subarray(t,i)):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?(192&(n=e[a+1]))==128&&(l=(31&t)<<6|63&n)<=127&&(l=null):3===h?(n=e[a+1],s=e[a+2],(192&n)==128&&(192&s)==128&&((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],(192&n)==128&&(192&s)==128&&(192&o)==128&&((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}(e,t,i)}class uR extends hN{constructor(e,t,i,r){super(e,i,r),this.offsetBuffer=t}}class uL extends uR{constructor(e,t,i,r){super(e,t,i,r??t.length-1)}getValueFromBuffer(e){return uk(this.dataBuffer,this.offsetBuffer[e],this.offsetBuffer[e+1])}}class uF extends uR{constructor(e,t,i,r,a){super(e,i,r,a??t.length),this.indexBuffer=t,this.indexBuffer=t}getValueFromBuffer(e){let t=this.indexBuffer[e];return uk(this.dataBuffer,this.offsetBuffer[t],this.offsetBuffer[t+1])}}
2class uB extends uR{constructor(e,t,i,r,a,n,s){super(e,i,r,s),this.indexBuffer=t,this.symbolOffsetBuffer=a,this.symbolTableBuffer=n}getValueFromBuffer(e){null==this.decodedDictionary&&(null==this.symbolLengthBuffer&&(this.symbolLengthBuffer=this.offsetToLengthBuffer(this.symbolOffsetBuffer)),this.decodedDictionary=function(e,t,i){let r=[],a=Array(t.length).fill(0);for(let e=1;e<t.length;e++)a[e]=a[e-1]+t[e-1];for(let n=0;n<i.length;n++)if(255===i[n])r.push(i[++n]);else{let s=t[i[n]],o=a[i[n]];for(let t=0;t<s;t++)r.push(e[o+t])}return new Uint8Array(r)}(this.symbolTableBuffer,this.symbolLengthBuffer,this.dataBuffer));let t=this.indexBuffer[e];return uk(this.decodedDictionary,this.offsetBuffer[t],this.offsetBuffer[t+1])}offsetToLengthBuffer(e){let t=new Uint32Array(e.length-1),i=e[0];for(let r=1;r<e.length;r++){let a=e[r];t[r-1]=a-i,i=a}return t}}function uO(e){return e instanceof ui}function uV(e){switch(e){case 0:case 1:case 2:case 3:{let t={};t.nullable=!!(1&e),t.columnScope=0;let i={type:"logicalType",logicalType:0};return i.longID=!!(2&e),t.scalarType=i,t.type="scalarType",t}case 4:{let e={nullable:!1,columnScope:0};return e.type="complexType",e.complexType={type:"physicalType",physicalType:0},e}case 30:{let e={nullable:!1,columnScope:0};return e.type="complexType",e.complexType={type:"physicalType",physicalType:1},e}default:let t;switch(e){case 10:case 11:t=0;break;case 12:case 13:t=1;break;case 14:case 15:t=2;break;case 16:case 17:t=3;break;case 18:case 19:t=4;break;case 20:case 21:t=5;break;case 22:case 23:t=6;break;case 24:case 25:t=7;break;case 26:case 27:t=8;break;case 28:case 29:t=9;break;default:return null}let i={};i.nullable=!!(1&e),i.columnScope=0;let r={type:"physicalType"};return r.physicalType=t,i.type="scalarType",i.scalarType=r,i}}let uj=new TextDecoder;function uN(e,t){let i=h0(e,t,1)[0];if(0===i)return"";let r=t.get(),a=e.subarray(r,r+i);return t.add(i),uj.decode(a)}class uU{constructor(e,t){var i;switch(this._featureData=e,this.properties=this._featureData.properties||{},null==(i=this._featureData.geometry)?void 0:i.type){case $.POINT:case $.MULTIPOINT:this.type=1;break;case $.LINESTRING:case $.MULTILINESTRING:this.type=2;break;case $.POLYGON:case $.MULTIPOLYGON:this.type=3;break;default:this.type=0}this.extent=t,this.id=Number(this._featureData.id)}loadGeometry(){let e=[];for(let t of this._featureData.geometry.coordinates){let i=[];for(let e of t)i.push(new w(e.x,e.y));e.push(i)}return e}}class uG{constructor(e){this.features=[],this.featureTable=e,this.name=e.name,this.extent=e.extent,this.version=2,this.features=e.getFeatures(),this.length=this.features.length}feature(e){return new uU(this.features[e],this.extent)}}class u${constructor(e){this.layers={};let t=function(e,t,i=!0){var r,a;let n=new hX(0),s=[];for(;n.get()<e.length;){let t=h0(e,n,1)[0]>>>0,o=n.get()+t;if(o>e.length)throw Error(`Block overruns tile: ${o} > ${e.length}`);if(h0(e,n,1)[0]>>>0!=1){n.set(o);continue}let[l,h]=function(e,t){let i={featureTables:[]},r={};r.name=uN(e,t);let a=h0(e,t,1)[0]>>>0,n=h0(e,t,1)[0]>>>0;r.columns=Array(n);for(let i=0;i<n;i++)r.columns[i]=function(e,t){let i=h0(e,t,1)[0]>>>0,r=uV(i);if(!r)throw Error(`Unsupported column type code ${i}. Supported: 0-3(ID), 4(GEOMETRY), 10-29(scalars), 30(STRUCT)`);if(i>=10?r.name=uN(e,t):i>=0&&i<=3?r.name="id":4===i&&(r.name="geometry"),30===i){let i=h0(e,t,1)[0]>>>0,a=r.complexType;a.children=Array(i);for(let r=0;r<i;r++)a.children[r]=function e(t,i){let r=h0(t,i,1)[0]>>>0;if(r<10||r>30)throw Error(`Unsupported field type code ${r}. Supported: 10-29(scalars), 30(STRUCT)`);let a=uV(r);if(r>=10&&(a.name=uN(t,i)),30===r){let r=h0(t,i,1)[0]>>>0;a.complexType.children=Array(r);for(let n=0;n<r;n++)a.complexType.children[n]=e(t,i)}return{name:a.name,nullable:a.nullable,scalarField:a.scalarType,complexField:a.complexType,type:"scalarType"===a.type?"scalarField":"complexField"}}(e,t)}return r}(e,t);return i.featureTables.push(r),[i,a]}(e,n),u=l.featureTables[0],c=null,p=null,f=[],m=0;for(let t of u.columns){let s=t.name;if("scalarType"===t.type&&(null==(r=t.scalarType)?void 0:r.type)==="logicalType"&&0===t.scalarType.logicalType){let r=null;if(t.nullable){let t=ut(e,n),i=n.get(),a=uD(e,t.numValues,t.byteLength,n);n.set(i+t.byteLength),r=new ui(a,t.numValues)}let a=ut(e,n);m=r?r.size():a.decompressedCount,c=function(e,t,i,r,a,n,s=!1){let o=t.scalarType;if(!o||"logicalType"!==o.type||0!==o.logicalType)throw Error(`ID column must be a logical ID scalar type: ${r}`);let l=o.longID?6:4,h="number"==typeof n?void 0:n,u=up(a,n,e,i,6===l?"int64":"int32");if(4===l)switch(u){case G.FLAT:return new hG(r,un(e,i,a,0,h),n);case G.SEQUENCE:{let t=uh(e,i,a);return new hq(r,t[0],t[1],a.numRleValues)}case G.CONST:return new hW(r,ul(e,i,a),n,!1)}switch(u){case G.FLAT:if(s)return new h$(r,function(e,t,i){var r=function(e,t,i){let r=new Float64Array(i);for(let a=0;a<i;a++)r[a]=function(e,t){let i,r;return r=e[t.get()],t.increment(),i=127&r,r<128?i:(r=e[t.get()],t.increment(),i|=(127&r)<<7,r<128?i:(r=e[t.get()],t.increment(),i|=(127&r)<<14,r<128?i:(r=e[t.get()],t.increment(),i|=(127&r)<<21,r<128?i:function(e,t,i){let r,a;
2if(a=t[i.get()],i.increment(),r=(112&a)>>4,a<128||(a=t[i.get()],i.increment(),r|=(127&a)<<3,a<128)||(a=t[i.get()],i.increment(),r|=(127&a)<<10,a<128)||(a=t[i.get()],i.increment(),r|=(127&a)<<17,a<128)||(a=t[i.get()],i.increment(),r|=(127&a)<<24,a<128)||(a=t[i.get()],i.increment(),r|=(1&a)<<31,a<128))return 0x100000000*r+(e>>>0);throw Error("Expected varint not more than 10 bytes")}(i|=(15&(r=e[t.get()]))<<28,e,t))))}(e,t);return r}(e,t,i.numValues);switch(i.logicalLevelTechnique1){case B.DELTA:return i.logicalLevelTechnique2===B.RLE&&(r=h8(r,i.runs,i.numRleValues)),function(e){e[0]=h5(e[0]);let t=e.length/4*4,i=1;if(t>=4)for(;i<t-4;i+=4){let t=e[i+1],r=e[i+2],a=e[i+3];e[i]=h5(e[i])+e[i-1],e[i+1]=h5(t)+e[i],e[i+2]=h5(r)+e[i+1],e[i+3]=h5(a)+e[i+2]}for(;i!==e.length;++i)e[i]=h5(e[i])+e[i-1]}(r),r;case B.RLE:return h8(r,i.runs,i.numRleValues);case B.NONE:return r;default:throw Error(`The specified Logical level technique is not supported: ${i.logicalLevelTechnique1}`)}}(e,i,a),n);return new uf(r,uc(e,i,a,h),n);case G.SEQUENCE:{let t=uu(e,i,a);return new um(r,t[0],t[1],a.numRleValues)}case G.CONST:return new uA(r,ud(e,i,a),n,!1)}throw Error("Vector type not supported for id column.")}(e,t,n,s,a,r??m,i)}else if(function(e){var t;return"complexType"===e.type&&(null==(t=e.complexType)?void 0:t.type)==="physicalType"&&0===e.complexType.physicalType}(t)){let t=h0(e,n,1)[0];if(0===m){let t=n.get();m=ut(e,n).decompressedCount,n.set(t)}p=function(e,t,i,r,a){var n,s,o,l,h,u,c,p,f,m,_,g,y,x;let v,b,w,T,S,P,M,I,E,C,A,D=ut(e,i);if(up(D,r,e,i)===G.CONST){let a,p,f,m,_=ul(e,i,D);for(let r=0;r<t-1;r++){let t=ut(e,i);switch(t.physicalStreamType){case V.LENGTH:switch(t.logicalStreamType.lengthType){case U.GEOMETRIES:a=us(e,i,t);break;case U.PARTS:p=us(e,i,t);break;case U.RINGS:f=us(e,i,t);break;case U.TRIANGLES:m=us(e,i,t)}break;case V.OFFSET:switch(t.logicalStreamType.offsetType){case N.VERTEX:v=un(e,i,t);break;case N.INDEX:T=un(e,i,t)}break;case V.DATA:j.VERTEX===t.logicalStreamType.dictionaryType?b=ua(e,i,t):(w={numBits:t.numBits,coordinateShift:t.coordinateShift},b=un(e,i,t))}}return T?void 0!==a||void 0!==p?new uS(r,_,m,T,b,{geometryOffsets:a,partOffsets:p,ringOffsets:f}):new uS(r,_,m,T,b,void 0):void 0===w?(n={geometryOffsets:a,partOffsets:p,ringOffsets:f},s=v,o=b,new ub(r,_,q.VEC_2,n,s,o)):(l={geometryOffsets:a,partOffsets:p,ringOffsets:f},h=v,u=b,c=w,new ub(r,_,q.MORTON,l,h,u,c))}let z=un(e,i,D);for(let r=0;r<t-1;r++){let t=ut(e,i);switch(t.physicalStreamType){case V.LENGTH:switch(t.logicalStreamType.lengthType){case U.GEOMETRIES:S=un(e,i,t);break;case U.PARTS:P=un(e,i,t);break;case U.RINGS:M=un(e,i,t);break;case U.TRIANGLES:I=us(e,i,t)}break;case V.OFFSET:switch(t.logicalStreamType.offsetType){case N.VERTEX:v=un(e,i,t);break;case N.INDEX:T=un(e,i,t)}break;case V.DATA:j.VERTEX===t.logicalStreamType.dictionaryType?b=ua(e,i,t):(w={numBits:t.numBits,coordinateShift:t.coordinateShift},b=un(e,i,t))}}return S?(E=uM(z,S,2),P&&M?(C=uI(z,E,P,!1),A=function(e,t,i,r){let a=new Uint32Array(i[i.length-1]+1),n=0;a[0]=n;let s=1,o=1,l=0;for(let h=0;h<e.length;h++){let u=e[h],c=t[h+1]-t[h];if(0!==u&&3!==u)for(let e=0;e<c;e++){let e=i[s]-i[s-1];s++;for(let t=0;t<e;t++)n=a[o++]=n+r[l++]}else for(let e=0;e<c;e++)a[o++]=++n,s++}return a}(z,E,C,M)):P&&(C=function(e,t,i){let r=new Uint32Array(t[t.length-1]+1),a=0;r[0]=a;let n=1,s=0;for(let o=0;o<e.length;o++){let l=e[o],h=t[o+1]-t[o];if(4===l||1===l)for(let e=0;e<h;e++)a=r[n++]=a+i[s++];else for(let e=0;e<h;e++)r[n++]=++a}return r}(z,E,P))):P&&M?(C=uM(z,P,1),A=uI(z,C,M,!0)):P&&(C=uM(z,P,0)),T&&!C?new uP(z,I,T,b,void 0):T?new uP(z,I,T,b,{geometryOffsets:E,partOffsets:C,ringOffsets:A}):void 0===w?(p={geometryOffsets:E,partOffsets:C,ringOffsets:A},f=v,m=b,new uw(q.VEC_2,z,p,f,m)):(_={geometryOffsets:E,partOffsets:C,ringOffsets:A},g=v,y=b,x=w,new uw(q.MORTON,z,_,g,y,x))}(e,t,n,m)}else{let i=!function(e){if("scalarType"===e.type){let t=e.scalarType;if("physicalType"===t.type)switch(t.physicalType){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:default:return!1;case 9:return!0}if("logicalType"===t.type)return!1}else if("complexType"===e.type){let t=e.complexType;if("physicalType"===t.type)switch(t.physicalType){case 0:case 1:return!0;default:return!1}}return console.warn("Unexpected column type in hasStreamCount",e),!1}(t)?1:h0(e,n,1)[0];if(0===i)continue;let r=(a=m,"scalarType"===t.type?function(e,t,i,r,a,n){let s=null;if(0===e)return null;if(n.nullable){let e=ut(t,i),r=e.numValues,a=i.get(),n=uD(t,r,e.byteLength,i);i.set(a+e.byteLength),s=new ui(n,e.numValues)}let o=s??r;switch(a.physicalType){case 4:case 3:return function(e,t,i,r,a){let n=ut(e,t),s=up(n,a,e,t),o=3===r.physicalType;if(s===G.FLAT){let r=uO(a)?a:void 0,s=o?ua(e,t,n,0,r):un(e,t,n,0,r);return new hG(i.name,s,a)}if(s===G.SEQUENCE){let r=uh(e,t,n);return new hq(i.name,r[0],r[1],n.numRleValues)}let l=o?function(e,t,i){let r=uo(e,t,i);return 1===r.length?h2(r[0]):h2(r[1])}
2(e,t,n):ul(e,t,n);return new hW(i.name,l,a,o)}(t,i,n,a,o);case 9:return function(e,t,i,r,a){var n,s,o,l,h,u,c,p,f,m;let _=null,g=null,y=null,x=null,v=null,b=a??null,w=null,T=null;for(let e=0;e<r;e++){let e=ut(t,i);switch(e.physicalStreamType){case V.PRESENT:{let r=new ui(uD(t,e.numValues,e.byteLength,i),e.numValues);b=a??r;break}case V.OFFSET:g=un(t,i,e,0,b);break;case V.LENGTH:{let r=us(t,i,e);U.DICTIONARY===e.logicalStreamType.lengthType?_=r:U.SYMBOL===e.logicalStreamType.lengthType?x=r:w=r;break}case V.DATA:{let r=t.subarray(i.get(),i.get()+e.byteLength);i.add(e.byteLength);let a=e.logicalStreamType.dictionaryType;j.FSST===a?v=r:j.SINGLE===a||j.SHARED===a?y=r:j.NONE===a&&(T=r)}}}return n=v,s=g,o=_,l=y,h=x,u=b,(n?new uB(e,s,o,l,h,n,u):null)??(c=y,p=g,f=_,m=b,c?m?new uF(e,p,f,c,m):new uF(e,p,f,c):null)??function(e,t,i,r,a){if(!t||!i)return null;if(r)return a?new uF(e,r,t,i,a):new uF(e,r,t,i);if(a&&a.size()!==t.length-1){let r=new Uint32Array(a.size()),n=0;for(let e=0;e<a.size();e++)r[e]=a.get(e)?n++:0;return new uF(e,r,t,i,a)}return a?new uL(e,t,i,a):new uL(e,t,i)}(e,w,T,g,b)}(n.name,t,i,n.nullable?e-1:e,s);case 0:return function(e,t,i,r,a){let n=ut(e,t),s=n.numValues,o=t.get(),l=uO(a)?a:void 0,h=uD(e,s,n.byteLength,t,l);t.set(o+n.byteLength);let u=new ui(h,s);return new uE(i.name,u,a)}(t,i,n,0,o);case 6:case 5:return function(e,t,i,r,a){let n=ut(e,t),s=up(n,r,e,t,"int64"),o=5===a.physicalType;if(s===G.FLAT){let a=uO(r)?r:void 0,s=o?function(e,t,i,r){let a;var n=h1(e,t,i.numValues);switch(i.logicalLevelTechnique1){case B.DELTA:if(i.logicalLevelTechnique2===B.RLE){if(!r)return function(e,t,i){let r=new BigInt64Array(i),a=0,n=0n;for(let i=0;i<t;i++){let s=Number(e[i]),o=h3(e[i+t]);for(let e=0;e<s;e++)n+=o,r[a++]=n}return r}(n,i.runs,i.numRleValues);a=h9(n=h4(n,i.runs,i.numRleValues))}else a=h9(n);break;case B.RLE:a=function(e,t,i){if(void 0===i){i=0;for(let r=0;r<t;r++)i+=Number(e[r])}let r=new BigInt64Array(i),a=0;for(let i=0;i<t;i++){let n=Number(e[i]),s=e[i+t];s=h3(s),r.fill(s,a,a+n),a+=n}return r}(n,i.runs,i.numRleValues);break;case B.NONE:a=function(e){let t=new BigInt64Array(e.length);for(let i=0;i<e.length;i++)t[i]=h3(e[i]);return t}(n);break;default:throw Error(`The specified Logical level technique is not supported: ${i.logicalLevelTechnique1}`)}return r?ur(a,r,0n):a}(e,t,n,a):uc(e,t,n,a);return new uf(i.name,s,r)}if(s===G.SEQUENCE){let r=uu(e,t,n);return new um(i.name,r[0],r[1],n.numRleValues)}let l=o?function(e,t,i){let r=h1(e,t,i.numValues);return 1===r.length?h3(r[0]):h3(r[1])}(e,t,n):ud(e,t,n);return new uA(i.name,l,r,o)}(t,i,n,o,a);case 7:let l=ut(t,i),h=uO(o)?o:void 0,u=function(e,t,i,r){let a=t.get(),n=a+i*Float32Array.BYTES_PER_ELEMENT,s=new Float32Array(new Uint8Array(e.subarray(a,n)).buffer);return t.set(n),r?ur(s,r,0):s}(t,i,l.numValues,h);return new uC(n.name,u,o);case 8:let c=ut(t,i),p=uO(o)?o:void 0,f=function(e,t,i,r){let a=t.get(),n=a+i*Float64Array.BYTES_PER_ELEMENT,s=new Float64Array(new Uint8Array(e.subarray(a,n)).buffer);return t.set(n),r?ur(s,r,0):s}(t,i,c.numValues,p);return new h$(n.name,f,o);default:throw Error(`The specified data type for the field is currently not supported: ${a}`)}}(i,e,n,a,t.scalarType,t):0===i?null:function(e,t,i,r){let a=null,n=null,s=null,o=null,l=!1;for(;!l;){let i=ut(e,t);switch(i.physicalStreamType){case V.LENGTH:U.DICTIONARY===i.logicalStreamType.lengthType?a=us(e,t,i):s=us(e,t,i);break;case V.DATA:j.SINGLE===i.logicalStreamType.dictionaryType||j.SHARED===i.logicalStreamType.dictionaryType?(n=e.subarray(t.get(),t.get()+i.byteLength),l=!0):o=e.subarray(t.get(),t.get()+i.byteLength),t.add(i.byteLength)}}let h=i.complexType.children,u=[],c=0;for(let l of h){let h=h0(e,t,1)[0];if(0===h)continue;let p=l.name?`${i.name}${l.name}`:i.name;if(2!==h||"scalarField"!==l.type||9!==l.scalarField.physicalType)throw Error("Currently only optional string fields are implemented for a struct.");let f=ut(e,t),m=uD(e,f.numValues,f.byteLength,t),_=ut(e,t),g=un(e,t,_,0,_.decompressedCount!==r?new ui(m,f.numValues):void 0);u[c++]=o?new uB(p,g,a,n,s,o,new ui(m,f.numValues)):new uF(p,g,a,n,new ui(m,f.numValues))}return u}(e,n,t,a));if(r)if(Array.isArray(r))for(let e of r)f.push(e);else f.push(r)}}let _=new hH(u.name,p,c,f,h);s.push(_),n.set(o)}return s}(new Uint8Array(e));this.layers=t.reduce((e,t)=>
2Object.assign(Object.assign({},e),{[t.name]:new uG(t)}),{})}}class uZ{constructor(e,t){this.feature=e,this.type=e.type,this.properties=e.tags?e.tags:{},this.extent=t,"id"in e&&("string"==typeof e.id?this.id=parseInt(e.id,10):"number"!=typeof e.id||isNaN(e.id)||(this.id=e.id))}loadGeometry(){let e=[];for(let t of 1===this.feature.type?[this.feature.geometry]:this.feature.geometry){let i=[];for(let e of t)i.push(new w(e[0],e[1]));e.push(i)}return e}}let uq="_geojsonTileLayer";function uW(e,t){if(!e.feature)return;let i=e.feature;void 0!==i.id&&t.writeVarintField(1,i.id),t.writeMessage(2,uH,e),t.writeVarintField(3,i.type),t.writeMessage(4,uX,i)}function uH(e,t){var i;for(let r in null==(i=e.feature)?void 0:i.properties){let i=e.feature.properties[r],a=e.keycache[r];if(null==i)continue;void 0===a&&(e.keys.push(r),a=e.keys.length-1,e.keycache[r]=a),t.writeVarint(a),"string"!=typeof i&&"boolean"!=typeof i&&"number"!=typeof i&&(i=e.jsonPrefix+JSON.stringify(i));let n=typeof i+":"+i,s=e.valuecache[n];void 0===s&&(e.values.push(i),s=e.values.length-1,e.valuecache[n]=s),t.writeVarint(s)}}function uX(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 uY(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))}class uK{constructor(e,t){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new aD(8192,16,0),this.grid3D=new aD(8192,16,0),this.featureIndexArray=new nW,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 of t){let t=[1/0,1/0,-1/0,-1/0];for(let i of e)t[0]=Math.min(t[0],i.x),t[1]=Math.min(t[1],i.y),t[2]=Math.max(t[2],i.x),t[3]=Math.max(t[3],i.y);t[0]<8192&&t[1]<8192&&t[2]>=0&&t[3]>=0&&o.insert(s,t[0],t[1],t[2],t[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers="mlt"!==this.encoding?new o$(new lY(this.rawTileData)).layers:new u$(this.rawTileData).layers,this.sourceLayerCoder=new hV(this.vtLayers?Object.keys(this.vtLayers).sort():[uq])),this.vtLayers}query(e,t,i,r){let a;this.loadVTLayers();let n=e.params,s=8192/e.tileSize/e.scale,o=rK(n.filter,n.globalState),l=e.queryGeometry,h=e.queryPadding*s,u=hO.fromPoints(l),c=this.grid.query(u.minX-h,u.minY-h,u.maxX+h,u.maxY+h),p=hO.fromPoints(e.cameraQueryGeometry).expandBy(h);for(let t of this.grid3D.query(p.minX,p.minY,p.maxX,p.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;let n=[new w(t,i),new w(t,a),new w(r,a),new w(r,i)];if(e.length>2){for(let t of n)if(sN(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=eI(e,t,i[0]);return n!==eI(e,t,i[1])||n!==eI(e,t,i[2])||n!==eI(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(uQ);let f={};for(let h of c){if(h===a)continue;a=h;let u=this.featureIndexArray.get(h),c=null;this.loadMatchingFeature(f,u.bucketIndex,u.sourceLayerIndex,u.featureIndex,o,n.layers,n.availableImages,t,i,r,(t,i,r)=>(c||(c=sD(t)),i.queryIntersectsFeature({queryGeometry:l,feature:t,featureState:r,geometry:c,zoom:this.z,transform:e.transform,pixelsToTileUnits:s,pixelPosMatrix:e.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:e.getElevation})))}return f}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 p=this.sourceLayerCoder.decode(i),f=this.vtLayers[p].feature(r);if(a.needGeometry){let e=sz(f,!0);if(!a.filter(new aX(this.tileID.overscaledZ),e,this.tileID.canonical))return}
2else if(!a.filter(new aX(this.tileID.overscaledZ),f))return;let m=this.getId(f,p);for(let t of c){if(n&&!n.has(t))continue;let i=o[t];if(!i)continue;let a={};m&&h&&(a=h.getState(i.sourceLayer||uq,m));let c=ev({},l[t]);c.paint=uJ(c.paint,i.paint,f,a,s),c.layout=uJ(c.layout,i.layout,f,a,s);let p=!u||u(f,i,a);if(!p)continue;let _=new hj(f,this.z,this.x,this.y,m);_.layer=c;let g=e[t];void 0===g&&(g=e[t]=[]),g.push({featureIndex:r,feature:_,intersectionZ:p})}}lookupSymbolFeatures(e,t,i,r,a,n,s,o){let l={};this.loadVTLayers();let h=rK(a.filterSpec,a.globalState);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]])&&(r=Number(r)),void 0===r&&null!=(i=e.properties)&&i.cluster&&this.promoteId&&(r=Number(e.properties.cluster_id))),r}}function uJ(e,t,i,r,a){return ew(e,(e,n)=>{let s=t instanceof a6?t.get(n):null;return null!=s&&s.evaluate?s.evaluate(i,r,a):s})}function uQ(e,t){return t-e}function u0(e,t,i,r,a){let n=[];for(let s of e){let e;for(let o=0;o<s.length-1;o++){let l=s[o],h=s[o+1];l.x<t&&h.x<t||(l.x<t?l=new w(t,l.y+(t-l.x)/(h.x-l.x)*(h.y-l.y))._round():h.x<t&&(h=new w(t,l.y+(t-l.x)/(h.x-l.x)*(h.y-l.y))._round()),l.y<i&&h.y<i||(l.y<i?l=new w(l.x+(i-l.y)/(h.y-l.y)*(h.x-l.x),i)._round():h.y<i&&(h=new w(l.x+(i-l.y)/(h.y-l.y)*(h.x-l.x),i)._round()),l.x>=r&&h.x>=r||(l.x>=r?l=new w(r,l.y+(r-l.x)/(h.x-l.x)*(h.y-l.y))._round():h.x>=r&&(h=new w(r,l.y+(r-l.x)/(h.x-l.x)*(h.y-l.y))._round()),l.y>=a&&h.y>=a||(l.y>=a?l=new w(l.x+(a-l.y)/(h.y-l.y)*(h.x-l.x),a)._round():h.y>=a&&(h=new w(l.x+(a-l.y)/(h.y-l.y)*(h.x-l.x),a)._round()),e&&l.equals(e[e.length-1])||(e=[l],n.push(e)),e.push(h)))))}}return n}function u1(e,t,i,r,a){switch(t){case 1:let n=[];for(let t of e)for(let e of t){let t=0===a?e.x:e.y;t>=i&&t<=r&&n.push([e])}return n;case 2:return u2(e,i,r,a,!1);case 3:return u2(e,i,r,a,!0)}return[]}function u2(e,t,i,r,a){let n=[];for(let s of e){let e=function(e,t,i,r,a){let n=0===r?u3:u5,s=[],o=[];for(let l=0;l<e.length-1;l++){let h=e[l],u=e[l+1],c=0===r?h.x:h.y,p=0===r?u.x:u.y,f=!1;c<t?p>t&&s.push(n(h,u,t)):c>i?p<i&&s.push(n(h,u,i)):s.push(h),p<t&&c>=t&&(s.push(n(h,u,t)),f=!0),p>i&&c<=i&&(s.push(n(h,u,i)),f=!0),!a&&f&&(o.push(s),s=[])}let l=e.length-1,h=0===r?e[l].x:e[l].y;return h>=t&&h<=i&&s.push(e[l]),a&&s.length>0&&!s[0].equals(s[s.length-1])&&s.push(new w(s[0].x,s[0].y)),s.length>0&&o.push(s),o}(s,t,i,r,a);e.length>0&&n.push(...e)}return n}function u3(e,t,i){return new w(i,e.y+(i-e.x)/(t.x-e.x)*(t.y-e.y))}function u5(e,t,i){return new w(e.x+(i-e.y)/(t.y-e.y)*(t.x-e.x),i)}ak("FeatureIndex",uK,{omit:["rawTileData","sourceLayerCoder"]});class u6 extends w{constructor(e,t,i,r){super(e,t),this.angle=i,void 0!==r&&(this.segment=r)}clone(){return new u6(this.x,this.y,this.angle,this.segment)}}function u4(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 u8(e){let t=0;for(let i=0;i<e.length-1;i++)t+=e[i].dist(e[i+1]);return t}function u7(e,t){return Math.max(e?e.right-e.left:0,t?t.right-t.left:0)}function u9(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]],p=(e,t)=>e+t[1]-t[0],f=u.reduce(p,0),m=c.reduce(p,0),_=o-f,g=l-m,y=0,x=f,v=0,b=m,T=0,S=_,P=0,M=g;if(n.content&&r){let t=n.content,i=t[2]-t[0],r=t[3]-t[1];(n.textFitWidth||n.textFitHeight)&&(h=hs(e)),y=ce(u,0,t[0]),v=ce(c,0,t[1]),x=ce(u,t[0],t[2]),b=ce(c,t[1],t[3]),T=t[0]-y,P=t[1]-v,S=i-x,M=r-b}let I=h.x1,E=h.y1,C=h.x2-I,A=h.y2-E,D=(e,r,a,o)=>{var l,h,u,c,p,_,g,D,z,k,R,L,F,B,O,V;
2let j=(l=e.stretch-y,l/x*C+I),N=(h=e.fixed-T,u=S,c=e.stretch,h-u*c/f),U=(p=r.stretch-v,p/b*A+E),G=(_=r.fixed-P,g=M,D=r.stretch,_-g*D/m),$=(z=a.stretch-y,z/x*C+I),Z=(k=a.fixed-T,R=S,L=a.stretch,k-R*L/f),q=(F=o.stretch-v,F/b*A+E),W=(B=o.fixed-P,O=M,V=o.stretch,B-O*V/m),H=new w(j,U),X=new w($,U),Y=new w($,q),K=new w(j,q),J=new w(N/s,G/s),Q=new w(Z/s,W/s),ee=t*Math.PI/180;if(ee){let e=Math.sin(ee),t=Math.cos(ee),i=[t,-e,e,t];H._matMult(i),X._matMult(i),K._matMult(i),Y._matMult(i)}let et=e.stretch+e.fixed,ei=r.stretch+r.fixed;return{tl:H,tr:X,bl:K,br:Y,tex:{x:n.paddedRect.x+1+et,y:n.paddedRect.y+1+ei,w:a.stretch+a.fixed-et,h:o.stretch+o.fixed-ei},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:J,pixelOffsetBR:Q,minFontScaleX:S/s/C,minFontScaleY:M/s/A,isSDF:i}};if(r&&(n.stretchX||n.stretchY)){let e=ct(u,_,f),t=ct(c,g,m);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(D(r,t[e],n,t[e+1]))}}else a.push(D({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:o+1},{fixed:0,stretch:l+1}));return a}function ce(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 ct(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}ak("Anchor",u6);class ci{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,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{let l=null!=(u=n.image)&&u.content&&(n.image.textFitWidth||n.image.textFitHeight)?hs(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];let 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){let e=new w(l.x1,l.y1),t=new w(l.x2,l.y1),i=new w(l.x1,l.y2),r=new w(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 cr{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 ca(e,t){return t.max-e.max}class cn{constructor(e,t,i,r){this.p=new w(e,t),this.h=i,this.d=function(e,t){let i=!1,r=1/0;for(let a of t)for(let t=0,n=a.length,s=n-1;t<n;s=t++){let n=a[t],o=a[s];n.y>e.y!=o.y>e.y&&e.x<(o.x-n.x)*(e.y-n.y)/(o.y-n.y)+n.x&&(i=!i),r=Math.min(r,sV(e,n,o))}return(i?1:-1)*Math.sqrt(r)}(this.p,r),this.max=this.d+this.h*Math.SQRT2}}e.aM=void 0,(W=e.aM||(e.aM={}))[W.center=1]="center",W[W.left=2]="left",W[W.right=3]="right",W[W.top=4]="top",W[W.bottom=5]="bottom",W[W["top-left"]=6]="top-left",W[W["top-right"]=7]="top-right",W[W["bottom-left"]=8]="bottom-left",W[W["bottom-right"]=9]="bottom-right";let cs=1/0;function co(e,t){return t[1]!==cs?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 cl(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 t2(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),cs]:a.get("text-offset").evaluate(t,{},i).map(e=>24*e);let n=[];for(let e of s)n.push(e,co(e,r));return new t2(n)}return null}function ch(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 cu(e,t,i,r,a,n,s,o,l,h,u,c,p,f,m){let _=function(e,t,i,r,a,n,s,o){let l=r.layout.get("text-rotate").evaluate(n,{})*Math.PI/180,h=[];for(let e of t.positionedLines)for(let r of e.positionedGlyphs){if(!r.rect)continue;let n=r.rect||{},u=4,c=!0,p=1,f=0,m=(a||o)&&r.vertical,_=r.metrics.advance*r.scale/2;if(o&&t.verticalizable&&(f=e.lineOffset/2-(r.imageName?-(24-r.metrics.width*r.scale)/2:(r.scale-1)*24)),r.imageName){let e=s[r.imageName];c=e.sdf,u=1/(p=e.pixelRatio)}let g=a?[r.x+_,r.y]:[0,0],y=a?[0,0]:[r.x+_+i[0],r.y+i[1]-f],x=[0,0];m&&(x=y,y=[0,0]);let v=r.metrics.isDoubleResolution?2:1,b=(r.metrics.left-u)*r.scale-_+y[0],T=(-r.metrics.top-u)*r.scale+y[1],S=b+n.w/v*r.
2scale/p,P=T+n.h/v*r.scale/p,M=new w(b,T),I=new w(S,T),E=new w(b,P),C=new w(S,P);if(m){let e=new w(-_,_- -17),t=-Math.PI/2,i=12-_,a=new w(22-i,-(r.imageName?i:0)),n=new w(...x);M._rotateAround(t,e)._add(a)._add(n),I._rotateAround(t,e)._add(a)._add(n),E._rotateAround(t,e)._add(a)._add(n),C._rotateAround(t,e)._add(a)._add(n)}if(l){let e=Math.sin(l),t=Math.cos(l),i=[t,-e,e,t];M._matMult(i),I._matMult(i),E._matMult(i),C._matMult(i)}let A=new w(0,0),D=new w(0,0);h.push({tl:M,tr:I,bl:E,br:C,tex:n,writingMode:t.writingMode,glyphOffset:g,sectionIndex:r.sectionIndex,isSDF:c,pixelOffsetTL:A,pixelOffsetBR:D,minFontScaleX:0,minFontScaleY:0})}return h}(0,i,o,a,n,s,r,e.allowVerticalPlacement),g=e.textSizeData,y=null;for(let i of("source"===g.kind?(y=[128*a.layout.get("text-size").evaluate(s,{})])[0]>32640&&eM(`${e.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`):"composite"===g.kind&&((y=[128*f.compositeTextSizes[0].evaluate(s,{},m),128*f.compositeTextSizes[1].evaluate(s,{},m)])[0]>32640||y[1]>32640)&&eM(`${e.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`),e.addSymbols(e.text,_,y,o,n,s,h,t,l.lineStartIndex,l.lineLength,p,m),u))c[i]=e.text.placedSymbolArray.length-1;return 4*_.length}function cc(e){for(let t in e)return e[t];return null}e.$=ej,e.A=K,e.B=aK,e.C=aA,e.D=a4,e.E=eQ,e.F=av,e.G=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.H=iE,e.I=ht,e.J=aX,e.K=aI,e.L=function(e){if(null==eC){let t=e.navigator?e.navigator.userAgent:null;eC=!!e.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return eC},e.M=e$,e.N=class{constructor(e,t){this.target=e,this.mapId=t,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new hw(()=>this.process()),this.subscription=ek(this.target,"message",e=>this.receive(e),!1),this.globalScope=eE(self)?e:window}registerMessageHandler(e,t){this.messageHandlers[e]=t}unregisterMessageHandler(e){delete this.messageHandlers[e]}sendAsync(e,t){return new Promise((i,r)=>{let a=Math.round(1e18*Math.random()).toString(36).substring(0,10),n=t?ek(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)},hT):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:aB(e.data,s)});this.target.postMessage(o,{transfer:s})})}receive(e){let t=e.data,i=t.id,r=["file://","resource://android","null"],a=[t.origin,location.origin],n=t.origin===location.origin,s=a.some(e=>r.includes(e));if((n||s)&&(!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(eE(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 b(this,void 0,void 0,function*(){if("<response>"===t.type){let i=this.resolveRejects[e];return delete this.resolveRejects[e],i?void(t.error?i.reject(ed(aO(t.error))):i.resolve(aO(t.data))):void 0}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=aO(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,ed(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?aB(t):null,data:aB(i,r)};
2this.target.postMessage(a,{transfer:r})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},e.O=function(){var e=new K(16);return K!=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.P=w,e.Q=function(e,t,i){var r,a,n,s,o,l,h,u,c,p,f,m,_=i[0],g=i[1],y=i[2];return t===e?(e[12]=t[0]*_+t[4]*g+t[8]*y+t[12],e[13]=t[1]*_+t[5]*g+t[9]*y+t[13],e[14]=t[2]*_+t[6]*g+t[10]*y+t[14],e[15]=t[3]*_+t[7]*g+t[11]*y+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],p=t[9],f=t[10],m=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]=p,e[10]=f,e[11]=m,e[12]=r*_+o*g+c*y+t[12],e[13]=a*_+l*g+p*y+t[13],e[14]=n*_+h*g+f*y+t[14],e[15]=s*_+u*g+m*y+t[15]),e},e.R=s6,e.S=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.T=or,e.U=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],p=t[9],f=t[10],m=t[11],_=t[12],g=t[13],y=t[14],x=t[15],v=i[0],b=i[1],w=i[2],T=i[3];return e[0]=v*r+b*o+w*c+T*_,e[1]=v*a+b*l+w*p+T*g,e[2]=v*n+b*h+w*f+T*y,e[3]=v*s+b*u+w*m+T*x,e[4]=(v=i[4])*r+(b=i[5])*o+(w=i[6])*c+(T=i[7])*_,e[5]=v*a+b*l+w*p+T*g,e[6]=v*n+b*h+w*f+T*y,e[7]=v*s+b*u+w*m+T*x,e[8]=(v=i[8])*r+(b=i[9])*o+(w=i[10])*c+(T=i[11])*_,e[9]=v*a+b*l+w*p+T*g,e[10]=v*n+b*h+w*f+T*y,e[11]=v*s+b*u+w*m+T*x,e[12]=(v=i[12])*r+(b=i[13])*o+(w=i[14])*c+(T=i[15])*_,e[13]=v*a+b*l+w*p+T*g,e[14]=v*n+b*h+w*f+T*y,e[15]=v*s+b*u+w*m+T*x,e},e.V=function(e,t){let i={};for(let r of t)r in e&&(i[r]=e[r]);return i},e.W=hS,e.X=ex,e.Y=hE,e.Z=hI,e._=b,e.a=eV,e.a$=function(e){var t=new K(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t},e.a0=X,e.a1=Y,e.a2=ez,e.a3=hF,e.a4=hC,e.a5=hA,e.a6=8192,e.a7=hz,e.a8=hO,e.a9=25,e.aA=function(e){var t=e[0],i=e[1];return Math.sqrt(t*t+i*i)},e.aB=function(e){return e[0]=0,e[1]=0,e},e.aC=function(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e},e.aD=hd,e.aE=es,e.aF=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 w(e.x+h*n,e.y+h*a)},e.aG=u0,e.aH=sR,e.aI=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.aJ=24,e.aK=ec,e.aL=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]:ec(t,i[0],e.zoom),a?i[1]:ec(t,i[1],e.zoom)]},e.aN=hh,e.aO=ch,e.aP=ha,e.aQ=e=>"symbol"===e.type,e.aR=o0,e.aS=nu,e.aT=oI,e.aU=nH,e.aV=se,e.aW=n8,e.aX=eL,e.aY=hD,e.aZ=ea,e.a_=er,e.aa=hR,e.ab=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");eH(r)||(t.crossOrigin="Anonymous"),e.src=r,t.appendChild(e)}})},e.ac=e9,e.ad=function(){return eb++},e.ae=nB,e.af=hm,e.ag=uq,e.ah=rK,e.ai=sz,e.aj=hj,e.ak=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.al=ey,e.am=85.051129,e.an=eR,e.ao=function(e){return Math.pow(2,e)},e.ap=Q,e.aq=function(e,t){return e/hM(t)},e.ar=function(e){return Math.log(e)/Math.LN2},e.as=function(e){var t=e[0],i=e[1];return t*t+i*i},e.at=function(e){if(!e.length)return new Set;let t=Math.max(...e.map(e=>e.canonical.z)),i=1/0,r=-1/0,a=1/0,n=-1/0,s=[];for(let o of e){let{x:e,y:l,z:h}=o.canonical,u=Math.pow(2,t-h),c=e*u,p=l*u;s.push({id:o,x:c,y:p}),c<i&&(i=c),c>r&&(r=c),p<a&&(a=p),p>n&&(n=p)}let o=new Set;for(let e of s)e.x!==i&&e.x!==r&&e.y!==a&&e.y!==n||o.add(e.id);return o}
2,e.au=function(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},e.av=class{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)}},e.aw=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?ey(iM.interpolationFactor(a,t,n,s),0,1):0;"camera"===e.kind?r=iE.number(e.minSize,e.maxSize,o):i=o}return{uSizeT:i,uSize:r}},e.ay=function(e,{uSize:t,uSizeT:i},{lowerSize:r,upperSize:a}){return"source"===e.kind?r/128:"composite"===e.kind?iE.number(r/128,a/128,i):t},e.az=eh,e.b=eA,e.b$=sg,e.b0=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.b1=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.b2=en,e.b3=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]},e.b4=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.b5=et,e.b6=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.b7=et,e.b8=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.b9=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]},e.bA=el,e.bB=function(e,t,i){var r=i[0],a=i[1],n=i[2],s=i[3],o=t[0],l=t[1],h=t[2],u=a*h-n*l,c=n*o-r*h,p=r*l-a*o;return e[0]=o+s*(u+=u)+a*(p+=p)-n*(c+=c),e[1]=l+s*c+n*u-r*p,e[2]=h+s*p+r*c-a*u,e},e.bC=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=en([],[t[0],t[1],t[2]],[i[0],i[1],i[2]]),p=en([],[i[0],i[1],i[2]],[e[0],e[1],e[2]]),f=en([],[e[0],e[1],e[2]],[t[0],t[1],t[2]]),m=ea([],c,-e[3]);return er(m,m,ea([],p,-t[3])),er(m,m,ea([],f,-i[3])),ea(m,m,1/u),m},e.bD=6371008.8,e.bE=function(){return new Float64Array(4)},e.bF=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.bG=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.bH=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.bI=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],p=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-p*r,e[8]=n*r+h*a,e[9]=s*r
2+u*a,e[10]=o*r+c*a,e[11]=l*r+p*a,e},e.bJ=function(e,t){let i=ep(e,360),r=ep(t,360),a=r-i,n=r>i?a-360:a+360;return Math.abs(a)<Math.abs(n)?a:n},e.bK=function(e){return e[0]=0,e[1]=0,e[2]=0,e},e.bL=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.bM=function(e,t){let i=ep(e,2*Math.PI),r=ep(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.bN=function(){let e={},t=e0.$version;for(let i in e0.$root){let r=e0.$root[i];if(r.required){let a=null;null!=(a="version"===i?t:"array"===r.type?[]:{})&&(e[i]=a)}}return e},e.bO=eq,e.bP=aV,e.bQ=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.bR=eN,e.bS=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 e1.forEach(e=>{e in t&&(i[e]=t[e])}),i}(e[i],t[e[i].ref]));return e},e.bT=function(e,t){if("custom"===e.type)return new hb(e,t);switch(e.type){case"background":return new hv(e,t);case"circle":return new sJ(e,t);case"color-relief":return new os(e,t);case"fill":return new oL(e,t);case"fill-extrusion":return new oY(e,t);case"heatmap":return new s9(e,t);case"hillshade":return new ot(e,t);case"line":return new lF(e,t);case"raster":return new ns(e,t);case"symbol":return new hy(e,t)}},e.bU=e=>"raster"===e.type,e.bV=eS,e.bW=function(e,t){if(!e)return[{command:"setStyle",args:[t]}];let i=[];try{if(!e2(e.version,t.version))return[{command:"setStyle",args:[t]}];e2(e.center,t.center)||i.push({command:"setCenter",args:[t.center]}),e2(e.state,t.state)||i.push({command:"setGlobalState",args:[t.state]}),e2(e.centerAltitude,t.centerAltitude)||i.push({command:"setCenterAltitude",args:[t.centerAltitude]}),e2(e.zoom,t.zoom)||i.push({command:"setZoom",args:[t.zoom]}),e2(e.bearing,t.bearing)||i.push({command:"setBearing",args:[t.bearing]}),e2(e.pitch,t.pitch)||i.push({command:"setPitch",args:[t.pitch]}),e2(e.roll,t.roll)||i.push({command:"setRoll",args:[t.roll]}),e2(e.sprite,t.sprite)||i.push({command:"setSprite",args:[t.sprite]}),e2(e.glyphs,t.glyphs)||i.push({command:"setGlyphs",args:[t.glyphs]}),e2(e.transition,t.transition)||i.push({command:"setTransition",args:[t.transition]}),e2(e.light,t.light)||i.push({command:"setLight",args:[t.light]}),e2(e.terrain,t.terrain)||i.push({command:"setTerrain",args:[t.terrain]}),e2(e.sky,t.sky)||i.push({command:"setSky",args:[t.sky]}),e2(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)||e6(a,i,r));for(a in t){var n;Object.prototype.hasOwnProperty.call(t,a)&&(Object.prototype.hasOwnProperty.call(e,a)?e2(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&&!e2(e[i][r],t[i][r]))return!1;for(r in t[i])if(Object.prototype.hasOwnProperty.call(t[i],r)&&"data"!==r&&!e2(e[i][r],t[i][r]))return!1;return!0}(e,t,a)?e3(i,{command:"setGeoJSONSourceData",args:[a,t[a].data]}):(n=t,e6(a,i,r),e5(a,n,i))):e5(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(e8),h=t.map(e8),u=e.reduce(e7,{}),c=t.reduce(e7,{}),p=l.slice(),f=Object.create(null);for(let e=0,t=0;e<l.length;e++)r=l[e],Object.prototype.hasOwnProperty.call(c,r)?t++:(e3(i,{command:"removeLayer",args:[r]}),p.splice(p.indexOf(r,t),1));for(let e=0,t=0;e<h.length;e++)r=h[h.length-1-e],p[p.length-1-e]!==r&&(Object.prototype.hasOwnProperty.call(u,r)?(e3(i,{command:"removeLayer",args:[r]}),p.splice(p.lastIndexOf(r,p.length-t),1)):t++,s=p[p.length-e],e3(i,{command:"addLayer",args:[c[r],s]}),p.splice(p.length-e,0,r),f[r]=!0);for(let e=0;e<h.length;e++)if(a=u[r=h[e]],n=c[r],!f[r]&&!e2(a,n))if(e2(a.source,n.source)&&e2(a["source-layer"],n["source-layer"])&&e2(a.type,n.type)){for(o in e4(a.layout,n.layout,i,r,null,"setLayoutProperty"),e4(a.paint,n.paint,i,r,null,"setPaintProperty"),e2(a.filter,n.filter)||e3(i,{command:"setFilter",args:[r,n.filter]}),e2(a.minzoom,n.minzoom)&&e2(a.maxzoom,n.maxzoom)||e3(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.")?e4(a[o],n[o],i,r,o.slice(6),"setPaintProperty"):e2(a[o],n[o])||e3(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.")?e4(a[o],n[o],i,r,o.slice(6),"setPaintProperty"):e2(a[o],n[o])||e3(i,{command:"setLayerProperty",args:[r,o,n[o]]}))}else e3(i,{command:"removeLayer",args:[r]}),s=p[p.lastIndexOf(r)+1],e3(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.bX=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.bY=ew,e.bZ=eT,e.b_=class extends sf{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1i(this.location,e))}},e.ba=hL,e.bb=hB,e.bc=function(e,t,i,r,a){var n=1/Math.tan(t/2);
2if(e[0]=n/i,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=n,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){var s=1/(r-a);e[10]=(a+r)*s,e[14]=2*a*r*s}else e[10]=-1,e[14]=-2*r;return e},e.bd=function(e){var t=new K(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.be=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],p=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+p*r,e[4]=h*a-n*r,e[5]=u*a-s*r,e[6]=c*a-o*r,e[7]=p*a-l*r,e},e.bf=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],p=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+p*r,e[8]=h*a-n*r,e[9]=u*a-s*r,e[10]=c*a-o*r,e[11]=p*a-l*r,e},e.bg=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],p=t[10],f=t[11],m=t[12],_=t[13],g=t[14],y=t[15],x=i*o-r*s,v=i*l-a*s,b=i*h-n*s,w=r*l-a*o,T=r*h-n*o,S=a*h-n*l,P=u*_-c*m,M=u*g-p*m,I=u*y-f*m,E=c*g-p*_,C=c*y-f*_,A=p*y-f*g,D=x*A-v*C+b*E+w*I-T*M+S*P;return D?(e[0]=(o*A-l*C+h*E)*(D=1/D),e[1]=(a*C-r*A-n*E)*D,e[2]=(_*S-g*T+y*w)*D,e[3]=(p*T-c*S-f*w)*D,e[4]=(l*I-s*A-h*M)*D,e[5]=(i*A-a*I+n*M)*D,e[6]=(g*b-m*S-y*v)*D,e[7]=(u*S-p*b+f*v)*D,e[8]=(s*C-o*I+h*P)*D,e[9]=(r*I-i*C-n*P)*D,e[10]=(m*T-_*b+y*x)*D,e[11]=(c*b-u*T-f*x)*D,e[12]=(o*M-s*E-l*P)*D,e[13]=(i*E-r*M+a*P)*D,e[14]=(_*v-m*w-g*x)*D,e[15]=(u*w-c*v+p*x)*D,e):null},e.bh=function(){let e=new Float32Array(16);return Q(e),e},e.bi=function(){let e=new Float64Array(16);return Q(e),e},e.bj=function(){return new Float64Array(16)},e.bk=function(e,t,i){let r=new Float64Array(4);return el(r,e,t-90,i),r},e.bl=function(e,t,i,r){var a,n,s,o,l,h=t[0],u=t[1],c=t[2],p=t[3],f=i[0],m=i[1],_=i[2],g=i[3];return(n=h*f+u*m+c*_+p*g)<0&&(n=-n,f=-f,m=-m,_=-_,g=-g),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*f,e[1]=o*u+l*m,e[2]=o*c+l*_,e[3]=o*p+l*g,e},e.bm=function(e){var t,i,r,a,n,s,o,l,h,u,c,p,f,m,_,g;let y,x,v=new Float64Array(9);l=(t=e[0])*(n=t+t),h=(i=e[1])*n,c=(r=e[2])*n,p=r*(s=i+i),m=(a=e[3])*n,_=a*s,g=a*(o=r+r),v[0]=1-(u=i*s)-(f=r*o),v[3]=h-g,v[6]=c+_,v[1]=h+g,v[4]=1-l-f,v[7]=p-m,v[2]=c-_,v[5]=p+m,v[8]=1-l-u;let b=eL(-Math.asin(ey(v[2],-1,1)));return .001>Math.hypot(v[5],v[8])?(y=0,x=-eL(Math.atan2(v[3],v[4]))):(y=eL(0===v[5]&&0===v[8]?0:Math.atan2(v[5],v[8])),x=eL(0===v[1]&&0===v[0]?0:Math.atan2(v[1],v[0]))),{roll:y,pitch:b+90,bearing:x}},e.bn=function(e,t){return e.roll==t.roll&&e.pitch==t.pitch&&e.bearing==t.bearing},e.bo=tq,e.bp=sm,e.bq=-32768,e.br=32767,e.bs=oM,e.bt=ef,e.bu=em,e.bv=t5,e.bw=function(e,t,i,r,a){return ef(r,a,ey((e-t)/(i-t),0,1))},e.bx=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.by=ep,e.bz=function(){return new Float64Array(3)},e.c=eU,e.c$=rU,e.c0=class extends sf{constructor(e,t){super(e,t),this.current=sy}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.c1=s_,e.c2=class extends sf{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.c3=class extends sf{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.c4=J,e.c5=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.c6=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.c7=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.c8=class extends sf{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.c9=class extends sf{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.cA=function(e,t){return eF[t]&&"touches"in e},e.cB=function(e){return eF[e]||eB[e]},e.cC=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.cD=function(e,t){let{x:i,y:r}=hz.fromLngLat(t);return!(e<0||e>25||r<0||r>=1||i<0||i>=1)},e.cE=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.cF=class extends np{},e.cG=eZ,e.cH=function(e,t){eU.REGISTERED_PROTOCOLS[e]=t},e.cI=function(e){delete eU.REGISTERED_PROTOCOLS[e]},e.cJ=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 e1)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.cK=ak,e.cL=hV,e.cM=uK,e.cN=hi,e.cO=function(t){var i,r;t.bucket.createArrays(),t.bucket.tilePixelRatio=8192/(512*t.bucket.overscaling),t.bucket.compareText={},t.bucket.iconsNeedLinear=!1;let a=t.bucket.layers[0],n=a.layout,s=a._unevaluatedLayout._values,o={layoutIconSize:s["icon-size"].possiblyEvaluate(new aX(t.bucket.zoom+1),t.canonical),layoutTextSize:s["text-size"].possiblyEvaluate(new aX(t.bucket.zoom+1),t.canonical),textMaxSize:s["text-size"].possiblyEvaluate(new aX(18))};if("composite"===t.bucket.textSizeData.kind){let{minZoom:e,maxZoom:i}=t.bucket.textSizeData;o.compositeTextSizes=[s["text-size"].possiblyEvaluate(new aX(e),t.canonical),s["text-size"].possiblyEvaluate(new aX(i),t.canonical)]}if("composite"===t.bucket.iconSizeData.kind){let{minZoom:e,maxZoom:i}=t.bucket.iconSizeData;o.compositeIconSizes=[s["icon-size"].possiblyEvaluate(new aX(e),t.canonical),s["icon-size"].possiblyEvaluate(new aX(i),t.canonical)]}let l=24*n.get("text-line-height"),h="viewport"!==n.get("text-rotation-alignment")&&"point"!==n.get("symbol-placement"),u=n.get("text-keep-upright"),c=n.get("text-size");for(let s of t.bucket.features){let p=n.get("text-font").evaluate(s,{},t.canonical).join(","),f=c.evaluate(s,{},t.canonical),m=o.layoutTextSize.evaluate(s,{},t.canonical),_=o.layoutIconSize.evaluate(s,{},t.canonical),g={horizontal:{},vertical:void 0},y=s.text,x,v=[0,0];if(y){let i=y.toString(),r=24*n.get("text-letter-spacing").evaluate(s,{},t.canonical),o=!function(e){for(let i of e){var t;if(t=i.codePointAt(0),a$.test(String.fromCodePoint(t)))return!1}return!0}(i)?0:r,c=n.get("text-anchor").evaluate(s,{},t.canonical),_=cl(a,s,t.canonical);if(!_){let e=n.get("text-radial-offset").evaluate(s,{},t.canonical);v=e?co(c,[24*e,cs]):n.get("text-offset").evaluate(s,{},t.canonical).map(e=>24*e)}let x=h?"center":n.get("text-justify").evaluate(s,{},t.canonical),b="point"===n.get("symbol-placement")?24*n.get("text-max-width").evaluate(s,{},t.canonical):1/0,w=()=>{t.bucket.allowVerticalPlacement&&aU(i)&&(g.vertical=hr(y,t.glyphMap,t.glyphPositions,t.imagePositions,p,b,l,c,"left",o,v,e.ax.vertical,!0,m,f))};if(!h&&_){let i=new Set;if("auto"===x)for(let e=0;e<_.values.length;e+=2)i.add(ch(_.values[e]));else i.add(x);let r=!1;for(let a of i)if(!g.horizontal[a])if(r)g.horizontal[a]=g.horizontal[0];else{let i=hr(y,t.glyphMap,t.glyphPositions,t.imagePositions,p,b,l,"center",a,o,v,e.ax.horizontal,!1,m,f);i&&(g.horizontal[a]=i,r=1===i.positionedLines.length)}w()}else{"auto"===x&&(x=ch(c));let r=hr(y,t.glyphMap,t.glyphPositions,t.imagePositions,p,b,l,c,x,o,v,e.ax.horizontal,!1,m,f);r&&(g.horizontal[x]=r),w(),aU(i)&&h&&u&&(g.vertical=hr(y,t.glyphMap,t.glyphPositions,t.imagePositions,p,b,l,c,x,o,v,e.ax.vertical,!1,m,f))}}let b=!1;if(null!=(i=s.icon)&&i.name){let e=t.imageMap[s.icon.name];e&&(x=function(e,t,i){let{horizontalAlign:r,verticalAlign:a}=ha(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[s.icon.name],n.get("icon-offset").evaluate(s,{},t.canonical),n.get("icon-anchor").evaluate(s,{},t.canonical)),b=!!e.sdf,void 0===t.bucket.sdfIcons?t.bucket.sdfIcons=b:t.bucket.sdfIcons!==b&&eM("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(e.pixelRatio!==t.bucket.pixelRatio||0!==n.get("icon-rotate").constantOr(1))&&(t.bucket.iconsNeedLinear=!0))}let T=cc(g.horizontal)||g.vertical;(r=t.bucket).iconsInText||(r.iconsInText=!!T&&T.iconsInText),(T||x)&&function(t,i,r,a,n,s,o,l,h,u,c,p){let f,m=s.textMaxSize.evaluate(i,{});void 0===m&&(m=o);let _=t.layers[0].layout,g=_.get("icon-offset").evaluate(i,{},c),y=cc(r.horizontal),x=o/24,v=t.tilePixelRatio*x,b=t.tilePixelRatio*m/24,T=t.tilePixelRatio*l,S=t.tilePixelRatio*_.get("symbol-spacing"),P=_.get("text-padding")*t.tilePixelRatio,M=function(e,t,i,r=1){let a=e.get("icon-padding").evaluate(t,{},i),n=null==a?void 0:a.values;
2return[n[0]*r,n[1]*r,n[2]*r,n[3]*r]}(_,i,c,t.tilePixelRatio),I=_.get("text-max-angle")/180*Math.PI,E="viewport"!==_.get("text-rotation-alignment")&&"point"!==_.get("symbol-placement"),C="map"===_.get("icon-rotation-alignment")&&"point"!==_.get("symbol-placement"),A=_.get("symbol-placement"),D=S/2,z=_.get("icon-text-fit");a&&"none"!==z&&(t.allowVerticalPlacement&&r.vertical&&(f=ho(a,r.vertical,z,_.get("icon-text-fit-padding"),g,x)),y&&(a=ho(a,y,z,_.get("icon-text-fit-padding"),g,x)));let k=c?p.line.getGranularityForZoomLevel(c.z):1,R=(l,p)=>{p.x<0||p.x>=8192||p.y<0||p.y>=8192||function(t,i,r,a,n,s,o,l,h,u,c,p,f,m,_,g,y,x,v,b,w,T,S,P,M){let I=t.addToLineVertexArray(i,r),E,C,A,D,z=0,k=0,R=0,L=0,F=-1,B=-1,O={},V=su("");if(t.allowVerticalPlacement&&a.vertical){let e=l.layout.get("text-rotate").evaluate(w,{},P)+90;A=new ci(h,i,u,c,p,a.vertical,f,m,_,e),o&&(D=new ci(h,i,u,c,p,o,y,x,_,e))}if(n){let r=l.layout.get("icon-rotate").evaluate(w,{}),a="none"!==l.layout.get("icon-text-fit"),s=u9(n,r,S,a),f=o?u9(o,r,S,a):void 0;C=new ci(h,i,u,c,p,n,y,x,!1,r),z=4*s.length;let m=t.iconSizeData,_=null;"source"===m.kind?(_=[128*l.layout.get("icon-size").evaluate(w,{})])[0]>32640&&eM(`${t.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`):"composite"===m.kind&&((_=[128*T.compositeIconSizes[0].evaluate(w,{},P),128*T.compositeIconSizes[1].evaluate(w,{},P)])[0]>32640||_[1]>32640)&&eM(`${t.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`),t.addSymbols(t.icon,s,_,b,v,w,e.ax.none,i,I.lineStartIndex,I.lineLength,-1,P),F=t.icon.placedSymbolArray.length-1,f&&(k=4*f.length,t.addSymbols(t.icon,f,_,b,v,w,e.ax.vertical,i,I.lineStartIndex,I.lineLength,-1,P),B=t.icon.placedSymbolArray.length-1)}let j=Object.keys(a.horizontal);for(let r of j){let n=a.horizontal[r];if(!E){V=su(n.text);E=new ci(h,i,u,c,p,n,f,m,_,l.layout.get("text-rotate").evaluate(w,{},P))}let o=1===n.positionedLines.length;if(R+=cu(t,i,n,s,l,_,w,g,I,a.vertical?e.ax.horizontal:e.ax.horizontalOnly,o?j:[r],O,F,T,P),o)break}a.vertical&&(L+=cu(t,i,a.vertical,s,l,_,w,g,I,e.ax.vertical,["vertical"],O,B,T,P));let N=E?E.boxStartIndex:t.collisionBoxArray.length,U=E?E.boxEndIndex:t.collisionBoxArray.length,G=A?A.boxStartIndex:t.collisionBoxArray.length,$=A?A.boxEndIndex:t.collisionBoxArray.length,Z=C?C.boxStartIndex:t.collisionBoxArray.length,q=C?C.boxEndIndex:t.collisionBoxArray.length,W=D?D.boxStartIndex:t.collisionBoxArray.length,H=D?D.boxEndIndex:t.collisionBoxArray.length,X=-1,Y=(e,t)=>null!=e&&e.circleDiameter?Math.max(e.circleDiameter,t):t;X=Y(E,-1),X=Y(A,X),X=Y(C,X);let K=+((X=Y(D,X))>-1);K&&(X*=M/24),t.glyphOffsetArray.length>=hm.MAX_GLYPHS&&eM("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==w.sortKey&&t.addToSortKeyRanges(t.symbolInstances.length,w.sortKey);let J=cl(l,w,P),[Q,ee]=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.aM[a[i]],r[0],r[1])}return[r,t.length]}(t.textAnchorOffsets,J);t.symbolInstances.emplaceBack(i.x,i.y,O.right>=0?O.right:-1,O.center>=0?O.center:-1,O.left>=0?O.left:-1,O.vertical||-1,F,B,V,N,U,G,$,Z,q,W,H,u,R,L,z,k,K,0,f,X,Q,ee)}(t,p,l,r,a,n,f,t.layers[0],t.collisionBoxArray,i.index,i.sourceLayerIndex,t.index,v,[P,P,P,P],E,h,T,M,C,g,i,s,u,c,o)};if("line"===A)for(let e of u0(i.geometry,0,0,8192,8192)){let i=oA(e,k);for(let e of function(e,t,i,r,a,n,s,o,l){let h=r?.6*24*s:0,u=u7(r,a),c=u*s,p=0===e[0].x||8192===e[0].x||0===e[0].y||8192===e[0].y;return t-c<t/4&&(t=c+t/4),function e(t,i,r,a,n,s,o,l,h){let u=s/2,c=u8(t),p=0,f=i-r,m=[];for(let e=0;e<t.length-1;e++){let i=t[e],o=t[e+1],l=i.dist(o),_=o.angleTo(i);for(;f+r<p+l;){let g=((f+=r)-p)/l,y=iE.number(i.x,o.x,g),x=iE.number(i.y,o.y,g);if(y>=0&&y<h&&x>=0&&x<h&&f-u>=0&&f+u<=c){let i=new u6(y,x,_,e);i._round(),a&&!u4(t,i,s,a,n)||m.push(i)}}p+=l}return l||m.length||o||(m=e(t,p/2,r,a,n,s,o,!0,h)),m}(e,p?t/2*o%t:(u/2+48)*s*o%t,t,h,i,c,p,!1,l)}(i,S,I,r.vertical||y,a,24,b,t.overscaling,8192))y&&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,y.text,D,e)||R(i,e)}else if("line-center"===A){for(let e of i.geometry)if(e.length>
21){let t=oA(e,k),i=function(e,t,i,r,a,n){let s=i?.6*24*n:0,o=u7(i,r)*n,l=0,h=u8(e)/2;for(let i=0;i<e.length-1;i++){let r=e[i],a=e[i+1],n=r.dist(a);if(l+n>h){let u=(h-l)/n,c=new u6(iE.number(r.x,a.x,u),iE.number(r.y,a.y,u),a.angleTo(r),i);return c._round(),!s||u4(e,c,o,s,t)?c:void 0}l+=n}}(t,I,r.vertical||y,a,0,b);i&&R(t,i)}}else if("Polygon"===i.type)for(let e of i6(i.geometry,0)){let t=function(e,t=1){let i=hO.fromPoints(e[0]),r=Math.min(i.width(),i.height()),a=r/2,n=new cr([],ca),{minX:s,minY:o,maxX:l,maxY:h}=i;if(0===r)return new w(s,o);for(let t=s;t<l;t+=r)for(let i=o;i<h;i+=r)n.push(new cn(t+a,i+a,a,e));let u=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 cn(i/t,r/t,0,e)}(e),c=u;for(;n.length;){let i=n.pop();(i.d>c.d||!c.d)&&(c=i),i.max-c.d<=t||(a=i.h/2,n.push(new cn(i.p.x-a,i.p.y-a,a,e)),n.push(new cn(i.p.x+a,i.p.y-a,a,e)),n.push(new cn(i.p.x-a,i.p.y+a,a,e)),n.push(new cn(i.p.x+a,i.p.y+a,a,e)))}return u.d>0&&c.d-u.d<=t?u.p:c.p}(e,16);R(oA(e[0],k,!0),new u6(t.x,t.y,0))}else if("LineString"===i.type)for(let e of i.geometry){let t=oA(e,k);R(t,new u6(t[0].x,t[0].y,0))}else if("Point"===i.type)for(let e of i.geometry)for(let t of e)R([t],new u6(t.x,t.y,0))}(t.bucket,s,g,x,t.imageMap,o,m,_,v,b,t.canonical,t.subdivisionGranularity)}t.showCollisionBoxes&&t.bucket.generateCollisionDebugBuffers()},e.cP=ok,e.cQ=oW,e.cR=lk,e.cS=function(e,t=""){let i=new lY;return function(e,t,i=""){for(let r in e.layers)t.writeMessage(3,(e,t)=>(function(e,t,i=""){t.writeVarintField(15,e.version||1),t.writeStringField(1,e.name||""),t.writeVarintField(5,e.extent||4096);let r={jsonPrefix:i,keys:[],values:[],keycache:{},valuecache:{}};for(let i=0;i<e.length;i++)r.feature=e.feature(i),t.writeMessage(2,uW,r);for(let e of r.keys)t.writeStringField(3,e);for(let e of r.values)t.writeMessage(4,uY,e)})(e,t,i),e.layers[r])}(e,i,t),i.finish()},e.cT=function(e,t,i,r,a,n){let s=u1(e,t,i,a,0);return u1(s,t,r,n,1)},e.cU=class{constructor(e){this.maxEntries=e,this.map=new Map}get(e){let t=this.map.get(e);return void 0!==t&&(this.map.delete(e),this.map.set(e,t)),t}set(e,t){if(this.map.has(e))this.map.delete(e);else if(this.map.size>=this.maxEntries){let e=this.map.keys().next().value;this.map.delete(e)}this.map.set(e,t)}clear(){this.map.clear()}},e.cV=o$,e.cW=lY,e.cX=u$,e.cY=function(e,t,i,n,s){return b(this,void 0,void 0,function*(){if(Y())try{return yield ez(e,t,i,n,s)}catch{}let 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);let h=a.getImageData(t,i,n,s);return a.clearRect(0,0,o,l),h.data})},e.cZ=oa,e.c_=class{constructor(e,t){this.layers={[uq]:this},this.name=uq,this.version=t?t.version:1,this.extent=t?t.extent:4096,this.length=e.length,this.features=e}feature(e){return new uZ(this.features[e],this.extent)}},e.ca=class extends nP{},e.cb=lN,e.cc=class extends nI{},e.cd=s7,e.ce=function(e){return e<=1?1:Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},e.cf=s8,e.cg=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.ch=class extends nf{},e.ci=class extends nR{},e.cj=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.ck=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],p=e[10],f=e[11],m=e[12],_=e[13],g=e[14],y=e[15],x=t[0],v=t[1],b=t[2],w=t[3],T=t[4],S=t[5],P=t[6],M=t[7],I=t[8],E=t[9],C=t[10],A=t[11],D=t[12],z=t[13],k=t[14],R=t[15];return Math.abs(i-x)<=1e-6*Math.max(1,Math.abs(i),Math.abs(x))&&Math.abs(r-v)<=1e-6*Math.max(1,Math.abs(r),Math.abs(v))&&Math.abs(a-b)<=1e-6*Math.max(1,Math.abs(a),Math.abs(b))&&Math.abs(n-w)<=1e-6*Math.max(1,Math.abs(n),Math.abs(w))&&Math.abs(s-T)<=1e-6*Math.max(1,Math.abs(s),Math.abs(T))&&Math.abs(o-S)<=1e-6*Math.max(1,Math.abs(o),Math.abs(S))&&Math.abs(l-P)<=1e-6*Math.max(1,Math.abs(l),Math.abs(P))&&Math.abs(h-M)<=1e-6*Math.max(1,Math.abs(h),Math.abs(M))&&Math.abs(u-I)<=1e-6*Math.max(1,Math.abs(u),Math.abs(I))&&Math.abs(c-E)<=1e-6*Math.max(1,Math.abs(c),Math.abs(E))&&Math.abs(p-C)<=1e-6*Math.max(1,Math.abs(p),Math.abs(C))&&Math.abs(f-A)<=1e-6*Math.max(1,Math.abs(f),Math.abs(A))&&Math.abs(m-D)<=1e-6*Math.max(1,Math.abs(m),Math.abs(D))&&Math.abs(_-z)<=1e-6*Math.max(1,Math.abs(_),Math.abs(z))&&Math.abs(g-k)<=1e-6*Math.max(1,Math.abs(g),Math.abs(k))&&Math.abs(y-R)<=1e-6*Math.max(1,Math.abs(y),Math.abs(R))},e.cl=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.cm=e=>"circle"===e.type,e.cn=e=>"heatmap"===e.type,e.co=e=>"line"===e.type,e.cp=e=>"fill"===e.type,e.cq=e=>"fill-extrusion"===e.type,e.cr=e=>"hillshade"===e.type,e.cs=e=>"color-relief"===e.type,e.ct=e=>"background"===e.type,e.cu=e=>"custom"===e.type,e.cv=e_,e.cw=function(e,t,i){if(t<=0)return e;let r=1/t;return void 0===i||1e-10>Math.abs(i)?Math.round(e*r)/r:(i>0?Math.ceil(e*r-1e-9):Math.floor(e*r+1e-10))/r},e.cx=function(e,t,i){let r=eu(t.x-i.x,t.y-i.y),a=eu(e.x-i.x,e.y-i.y);return eL(Math.atan2(r[0]*a[1]-r[1]*a[0],r[0]*a[0]+r[1]*a[1]))},e.cy=eg,e.cz=function(e,t){var i;if(!eB[t])return!1;let r=null==e?void 0:e.target,a=(null==(i=null==r?void 0:r.ownerDocument)?void 0:i.defaultView)||window;return e instanceof a.MouseEvent||e instanceof a.WheelEvent},e.d=ed,e.d0=class{constructor(e,t){let i=(t=this.options=Object.assign({},lC,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=o8(e,t);i&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",t.indexMaxZoom,t.indexMaxPoints),console.time("generate tiles")),r=lf(r,t),t.updateable&&(this.source=r),this.initializeIndex(r,t)}initializeIndex(e,t){this.tileIndex=t.cluster?new lx(t.clusterOptions):new lI(t),e.length&&this.tileIndex.initialize(e)}getTile(e,t,i){return t*=1,i*=1,(e*=1)<0||e>24?null:this.tileIndex.getTile(e,t,i)}updateData(e,t){let i=this.options;if(!i.updateable)throw Error("to update tile geojson `updateable` option must be set to true");let{affected:r,source:a}=function(e,t,i){var r,a;
2let n=t?{removeAll:t.removeAll,remove:new Set(t.remove||[]),add:new Map(null==(r=t.add)?void 0:r.map(e=>[i.promoteId?e.properties[i.promoteId]:e.id,e])),update:new Map(null==(a=t.update)?void 0:a.map(e=>[e.id,e]))}:{remove:new Set,add:new Map,update:new Map},s=[];if(n.removeAll&&(s=e,e=[]),n.remove.size||n.add.size){let t=[];for(let i of e)(n.remove.has(i.id)||n.add.has(i.id))&&t.push(i);if(t.length){s.push(...t);let i=new Set(t.map(e=>e.id));e=e.filter(e=>!i.has(e.id))}if(n.add.size){let t=o8({type:"FeatureCollection",features:Array.from(n.add.values())},i);t=lf(t,i),s.push(...t),e.push(...t)}}if(n.update.size){let t=new Map,r=[];for(let i of e)n.update.has(i.id)?t.set(i.id,[...t.get(i.id)||[],i]):r.push(i);for(let[e,a]of n.update){let n=t.get(e);if(!n||0===n.length)continue;let o=function(e,t,i){var r,a;let n=!!t.newGeometry,s=t.removeAllProperties||(null==(r=t.removeProperties)?void 0:r.length)>0||(null==(a=t.addOrUpdateProperties)?void 0:a.length)>0;if(n){let r=e[0];return lf(o8({type:"FeatureCollection",features:[{type:"Feature",id:r.id,geometry:t.newGeometry,properties:s?lg(r.tags,t):r.tags}]},i),i)}if(s){let i=[];for(let r of e){let e={...r};e.tags=lg(e.tags,t),i.push(e)}return i}return e}(n,a,i);s.push(...n,...o),r.push(...o)}e=r}return{affected:s,source:e}}(this.source,e,i);t&&({affected:r,source:a}=this.filterUpdate(a,r,t)),r.length&&(this.source=a,this.tileIndex.updateIndex(a,r,i))}filterUpdate(e,t,i){let r=new Set;for(let a of e)null!=a.id&&(i(lr(a))||(t.push(a),r.add(a.id)));return{affected:t,source:e=e.filter(e=>!r.has(e.id))}}getData(){if(!this.options.updateable)throw Error("to retrieve data the `updateable` option must be set to true");return{type:"FeatureCollection",features:this.source.map(e=>lr(e))}}updateClusterOptions(e,t){let i=this.options.cluster;this.options.cluster=e,this.options.clusterOptions=t,i!=e?this.initializeIndex(this.source,this.options):this.tileIndex.updateIndex(this.source,[],this.options)}getClusterExpansionZoom(e){return this.tileIndex.getClusterExpansionZoom(e)}getClusterChildren(e){return this.tileIndex.getChildren(e)}getClusterLeaves(e,t,i){return this.tileIndex.getLeaves(e,t,i)}},e.d1=aH,e.e=ev,e.f=eH,e.g=eG,e.h=e=>b(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 ${ed(e).message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),e.i=eE,e.j=e=>new Promise((t,i)=>{let r=new Image;r.onload=()=>{t(r),URL.revokeObjectURL(r.src),r.onload=null,window.requestAnimationFrame(()=>r.src=eD)},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):eD}),e.k=(e,t)=>eW(ev(e,{type:"json"}),t),e.l=eJ,e.m=eW,e.n=eK,e.o=(e,t)=>eW(ev(e,{type:"arrayBuffer"}),t),e.p=he,e.q=function(e){return new lY(e).readFields(l8,[])},e.r=function(e){return/[\u02EA\u02EB\u1100-\u11FF\u2E80-\u2FDF\u3000-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE4F\uFF00-\uFFEF]|\uD81B[\uDFE0-\uDFFF]|[\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFFF]|\uD82C[\uDC00-\uDEFB]|\uD83C[\uDE00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(e))},e.s=ek,e.t=s5,e.u=nt,e.v=e0,e.w=eM,e.x=e0,e.y=a0,e.z=aM}),i("worker",["./shared"],function(e){class t{constructor(e,t){this.keyCache={},e&&this.replace(e,t)}replace(e,t){this._layerConfigs={},this._layers={},this.update(e,[],t)}update(t,i,r){for(let i of t){this._layerConfigs[i.id]=i;let t=this._layers[i.id]=e.bT(i,r);t._featureFilter=e.ah(t.filter,r),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.cJ(Object.values(this._layerConfigs),this.keyCache))){let i=t.map(e=>
2this._layers[e.id]),r=i[0];if(r.isHidden())continue;let a=r.source||"",n=this.familiesBySource[a];n||(n=this.familiesBySource[a]={});let s=r.sourceLayer||e.ag,o=n[s];o||(o=n[s]=[]),o.push(i)}}}class i{constructor(t){let i={},r=[];for(let e in t){let a=t[e],n=i[e]={};for(let e in a){let t=a[+e];if(!t||0===t.bitmap.width||0===t.bitmap.height)continue;let 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}}}let{w:a,h:n}=e.p(r),s=new e.t({width:a||1,height:n||1});for(let r in t){let a=t[r];for(let t in a){let n=a[+t];if(!n||0===n.bitmap.width||0===n.bitmap.height)continue;let o=i[r][t].rect;e.t.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.cK("GlyphAtlas",i);class r{constructor(t){this.tileID=new e.a3(t.tileID.overscaledZ,t.tileID.wrap,t.tileID.canonical.z,t.tileID.canonical.x,t.tileID.canonical.y),this.uid=t.uid,this.zoom=t.zoom,this.pixelRatio=t.pixelRatio,this.tileSize=t.tileSize,this.source=t.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=t.showCollisionBoxes,this.collectResourceTiming=!!t.collectResourceTiming,this.returnDependencies=!!t.returnDependencies,this.promoteId=t.promoteId,this.inFlightDependencies=[]}parse(t,r,n,s,o){return e._(this,void 0,void 0,function*(){this.status="parsing",this.data=t,this.collisionBoxArray=new e.ae;let l=new e.cL(Object.keys(t.layers).sort()),h=new e.cM(this.tileID,this.promoteId);h.bucketLayerIDs=[];let u={},c={featureIndex:h,iconDependencies:{},patternDependencies:{},glyphDependencies:{},dashDependencies:{},availableImages:n,subdivisionGranularity:o},p=r.familiesBySource[this.source];for(let i in p){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 p[i]){let i=t[0];i.source!==this.source&&e.w(`layer.source = ${i.source} does not equal this.source = ${this.source}`),i.isHidden(this.zoom,!0)||(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})).populate(o,c,this.tileID.canonical),h.bucketLayerIDs.push(t.map(e=>e.id)))}}let f=e.bY(c.glyphDependencies,e=>Object.keys(e).map(Number));for(let e of this.inFlightDependencies)null==e||e.abort();this.inFlightDependencies=[];let m=Promise.resolve({});if(Object.keys(f).length){let e=new AbortController;this.inFlightDependencies.push(e),m=s.sendAsync({type:"GG",data:{stacks:f,source:this.source,tileID:this.tileID,type:"glyphs"}},e)}let _=Object.keys(c.iconDependencies),g=Promise.resolve({});if(_.length){let e=new AbortController;this.inFlightDependencies.push(e),g=s.sendAsync({type:"GI",data:{icons:_,source:this.source,tileID:this.tileID,type:"icons"}},e)}let y=Object.keys(c.patternDependencies),x=Promise.resolve({});if(y.length){let e=new AbortController;this.inFlightDependencies.push(e),x=s.sendAsync({type:"GI",data:{icons:y,source:this.source,tileID:this.tileID,type:"patterns"}},e)}let v=c.dashDependencies,b=Promise.resolve({});if(Object.keys(v).length){let e=new AbortController;this.inFlightDependencies.push(e),b=s.sendAsync({type:"GDA",data:{dashes:v}},e)}let[w,T,S,P]=yield Promise.all([m,g,x,b]),M=new i(w),I=new e.cN(T,S);for(let t in u){let i=u[t];i instanceof e.af?(a(i.layers,this.zoom,n),e.cO({bucket:i,glyphMap:w,glyphPositions:M.positions,imageMap:T,imagePositions:I.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:c.subdivisionGranularity})):i.hasDependencies&&(i instanceof e.cP||i instanceof e.cQ||i instanceof e.cR)&&(a(i.layers,this.zoom,n),i.addFeatures(c,this.tileID.canonical,I.patternPositions,P))}return this.status="done",{buckets:Object.values(u).filter(e=>!e.isEmpty()),featureIndex:h,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:M.image,imageAtlas:I,dashPositions:P,glyphMap:this.returnDependencies?w:null,iconMap:this.returnDependencies?T:null,glyphPositions:this.returnDependencies?M.positions:null}})}}function a(t,i,r){let a=new e.J(i);for(let e of t)e.recalculate(a,r)}class n{constructor(){this.loading={},this.loaded={},this.parsing={}}startLoading(e,t){this.loading[e]=t}finishLoading(e){delete this.loading[e]}abort(e){let t=this.loading[e];null!=t&&t.abort&&(t.abort.abort(),delete this.loading[e])}setParsing(e,t){this.parsing[e]=t}consumeParsing(e){let t=this.parsing[e];if(t)return delete this.parsing[e],t}clearParsing(e){delete this.parsing[e]}markLoaded(e,t){this.loaded[e]=t}getLoaded(e){let t=this.loaded[e];if(t)return t}removeLoaded(e){delete this.loaded[e]}clearLoaded(){this.loaded={}}}class s{constructor(e){this.start=`${e}#start`,this.end=`${e}#end`,this.measure=e,performance.mark(this.start)}finish(){performance.mark(this.end);let e=performance.getEntriesByName(this.measure);return 0===e.length&&(performance.measure(this.measure,this.start,this.end),e=performance.getEntriesByName(this.measure),performance.clearMarks(this.start),performance.clearMarks(this.end),performance.clearMeasures(this.measure)),e}}class o{constructor(e,t,i,r,a){this.type=e,this.properties=i||{},this.extent=a,this.pointsArray=t,this.id=r}loadGeometry(){return this.pointsArray.map(t=>t.map(t=>new e.P(t.x,t.y)))}}class l{constructor(e,t,i){this.version=2,this._myFeatures=e,this.name=t,this.length=e.length,this.extent=i}feature(e){return this._myFeatures[e]}}class h{constructor(){this.layers={}}addLayer(e){this.layers[e.name]=e}}function u(t){let i=e.cS(t);return 0===i.byteOffset&&i.byteLength===i.buffer.byteLength||(i=new Uint8Array(i)),{vectorTile:t,rawData:i.buffer}}class c{constructor(t,i,r){this.actor=t,this.layerIndex=i,this.availableImages=r,this.tileState=new n,this.overzoomedTileResultCache=new e.cU(1e3)}loadVectorTile(t,i){try{return{vectorTile:"mlt"!==t.encoding?new e.cV(new e.cW(i)):new e.cX(i),rawData:i}}catch(n){let r=new Uint8Array(i),a=`Unable to parse the tile at ${t.request.url}, `;throw Error(a+=31===r[0]&&139===r[1]?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${e.d(n).message}`)}}loadTile(t){return e._(this,void 0,void 0,function*(){let{uid:i,overzoomParameters:a}=t;a&&(t.request=a.overzoomRequest);let n=this._startRequestTiming(t),s=new r(t);this.tileState.startLoading(i,s);let o=new AbortController;s.abort=o;try{let r=yield e.o(t.request,o);if(t.etag&&t.etag===r.etag)return this.tileState.finishLoading(i),this._getEtagUnmodifiedResult(r,n);let l=this.loadVectorTile(t,r.data);if(this.tileState.finishLoading(i),!l)return null;let{vectorTile:h,rawData:u}=l;a&&({vectorTile:h,rawData:u}=this._getOverzoomTile(t,h));let c=this._getExpiryData(r),p=this._finishRequestTiming(n);s.vectorTile=h,this.tileState.markLoaded(i,s);
2let f={rawData:u,cacheControl:c,resourceTiming:p};this.tileState.setParsing(i,f);try{return yield this._parseWorkerTile(s,t,f)}finally{this.tileState.clearParsing(i)}}catch(e){throw this.tileState.finishLoading(i),s.status="done",this.tileState.markLoaded(i,s),e}})}_getEtagUnmodifiedResult(t,i){let r=this._getExpiryData(t),a=this._finishRequestTiming(i);return e.e({etagUnmodified:!0},r,a)}_parseWorkerTile(t,i,r){return e._(this,void 0,void 0,function*(){let a=yield t.parse(t.vectorTile,this.layerIndex,this.availableImages,this.actor,i.subdivisionGranularity);if(r){let{rawData:t,cacheControl:n,resourceTiming:s}=r;a=e.e({rawTileData:t.slice(0),encoding:i.encoding},a,n,s)}return a})}_getExpiryData({expires:e,cacheControl:t,etag:i}){let r={};return e&&(r.expires=e),t&&(r.cacheControl=t),i&&(r.etag=i),r}_startRequestTiming(e){var t;if(null!=(t=e.request)&&t.collectResourceTiming)return new s(e.request.url)}_finishRequestTiming(e){let t=null==e?void 0:e.finish();return t?{resourceTiming:JSON.parse(JSON.stringify(t))}:{}}_getOverzoomTile(t,i){var r;let{tileID:a,source:n,overzoomParameters:s}=t,{maxZoomTileID:c}=s,p=`${c.key}_${a.key}_${null==(r=t.request)?void 0:r.url}`,f=this.overzoomedTileResultCache.get(p);if(f)return f;let m=new h,_=this.layerIndex.familiesBySource[n];for(let t in _){let r=i.layers[t];if(!r)continue;let n=function(t,i,r){let{extent:a}
2=t,n=Math.pow(2,r.z-i.z),s=(r.x-i.x*n)*a,h=(r.y-i.y*n)*a,u=[];for(let i=0;i<t.length;i++){let r=t.feature(i),l=r.loadGeometry();for(let e of l)for(let t of e)t.x=t.x*n-s,t.y=t.y*n-h;0!==(l=e.cT(l,r.type,-128,-128,a+128,a+128)).length&&u.push(new o(r.type,l,r.properties,r.id,a))}return new l(u,t.name,a)}(r,c,a.canonical);n.length>0&&m.addLayer(n)}let g=u(m);return this.overzoomedTileResultCache.set(p,g),g}reloadTile(t){return e._(this,void 0,void 0,function*(){let e=t.uid,i=this.tileState.getLoaded(e);if(!i)throw Error("Should not be trying to reload a tile that was never loaded or has been removed");if(i.showCollisionBoxes=t.showCollisionBoxes,"parsing"===i.status){let r=this.tileState.consumeParsing(e);return yield this._parseWorkerTile(i,t,r)}if("done"===i.status&&i.vectorTile)return yield this._parseWorkerTile(i,t)})}abortTile(t){return e._(this,void 0,void 0,function*(){this.tileState.abort(t.uid)})}removeTile(t){return e._(this,void 0,void 0,function*(){this.tileState.removeLoaded(t.uid)})}}class p{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.cY(a,-1,-1,h,u))):a,p=new e.cZ(i,c,r,n,s,o,l);return this.loaded||(this.loaded={}),this.loaded[i]=p,p})}removeTile(e){let t=this.loaded,i=e.uid;null!=t&&t[i]&&delete t[i]}}class f{constructor(e,t,i,r=m){this.actor=e,this.layerIndex=t,this.availableImages=i,this.tileState=new n,this._createGeoJSONIndex=r}loadVectorTile(t){if(!this._geoJSONIndex)throw Error("Unable to parse the data into a cluster or geojson");let{z:i,x:r,y:a}=t.tileID.canonical,n=this._geoJSONIndex.getTile(i,r,a);return n?u(new e.c_(n.features,{version:2,extent:e.a6})):null}loadTile(t){return e._(this,void 0,void 0,function*(){let{uid:e}=t,i=new r(t);i.abort=new AbortController;try{let r=this.loadVectorTile(t);if(!r)return null;let{vectorTile:a,rawData:n}=r;i.vectorTile=a,this.tileState.markLoaded(e,i);let s={rawData:n};this.tileState.setParsing(e,s);try{return yield this._parseWorkerTile(i,t,s)}finally{this.tileState.clearParsing(e)}}catch(t){throw i.status="done",this.tileState.markLoaded(e,i),t}})}_reloadLoadedTile(t){return e._(this,void 0,void 0,function*(){let e=t.uid,i=this.tileState.getLoaded(e);if(!i)throw Error("Should not be trying to reload a tile that was never loaded or has been removed");if(i.showCollisionBoxes=t.showCollisionBoxes,"parsing"===i.status){let r=this.tileState.consumeParsing(e);return yield this._parseWorkerTile(i,t,r)}if("done"===i.status&&i.vectorTile)return yield this._parseWorkerTile(i,t)})}_parseWorkerTile(t,i,r){return e._(this,void 0,void 0,function*(){let a=yield t.parse(t.vectorTile,this.layerIndex,this.availableImages,this.actor,i.subdivisionGranularity);if(r){let{rawData:t}=r;a=e.e({rawTileData:t.slice(0),encoding:"mvt"},a)}return a})}abortTile(t){return e._(this,void 0,void 0,function*(){this.tileState.abort(t.uid)})}removeTile(t){return e._(this,void 0,void 0,function*(){this.tileState.removeLoaded(t.uid)})}loadData(t){return e._(this,void 0,void 0,function*(){var i;null==(i=this._pendingRequest)||i.abort();let r=this._startRequestTiming(t);this._pendingRequest=new AbortController;try{yield this.loadAndProcessGeoJSON(t,this._pendingRequest),delete this._pendingRequest,this.tileState.clearLoaded();let e={};return t.request&&(e.data=t.data),this._finishRequestTiming(r,t,e),e}catch(t){if(delete this._pendingRequest,!e.$(t))throw t;return{abandoned:!0}}})}_startRequestTiming(e){var t;if(null!=(t=e.request)&&t.collectResourceTiming)return new s(e.request.url)}_finishRequestTiming(e,t,i){let r=null==e?void 0:e.finish();r&&(i.resourceTiming={[t.source]:JSON.parse(JSON.stringify(r))})}reloadTile(e){return this.tileState.getLoaded(e.uid)?this._reloadLoadedTile(e):this.loadTile(e)}loadAndProcessGeoJSON(t,i){return e._(this,void 0,void 0,function*(){if(t.request&&(t.data=(yield e.k(t.request,i)).data),t.data)return t.data=this._filterGeoJSON(t.data,t.filter),void(this._geoJSONIndex=this._createGeoJSONIndex(t.data,t));if(t.dataDiff)return null!=this._geoJSONIndex||(this._geoJSONIndex=this._createGeoJSONIndex({type:"FeatureCollection",features:[]},t)),void this._geoJSONIndex.updateData(t.dataDiff,this._getFilterPredicate(t.filter));if(t.updateCluster&&this._geoJSONIndex.updateClusterOptions(t.geojsonVtOptions.cluster,_(t)),null==this._geoJSONIndex)throw Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`)})}_filterGeoJSON(e,t){if("FeatureCollection"!==e.type)return e;let i=this._getFilterPredicate(t);return i?{type:"FeatureCollection",features:e.features.filter(e=>i(e))}:e}_getFilterPredicate(t){if("boolean"!=typeof t&&!(null!=t&&t.length))return;let i=e.c$(t,{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(", "));return e=>i.value.evaluate({zoom:0},e)}removeSource(t){return e._(this,void 0,void 0,function*(){var e;
2null==(e=this._pendingRequest)||e.abort()})}getClusterExpansionZoom(e){return this._geoJSONIndex.getClusterExpansionZoom(e.clusterId)}getClusterChildren(e){return this._geoJSONIndex.getClusterChildren(e.clusterId)}getClusterLeaves(e){return this._geoJSONIndex.getClusterLeaves(e.clusterId,e.limit,e.offset)}}function m(t,i){let r=e.e(i.geojsonVtOptions||{},{updateable:!0,clusterOptions:_(i)});return new e.d0(t,r)}function _({geojsonVtOptions:t,clusterProperties:i}){if(!i||!t.clusterOptions)return t.clusterOptions;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.c$(s),l=e.c$("string"==typeof n?[n,["accumulated"],["get",t]]:n);r[t]=o.value,a[t]=l.value}return t.clusterOptions.map=e=>{s.properties=e;let t={};for(let e of o)t[e]=r[e].evaluate(n,s);return t},t.clusterOptions.reduce=(e,t)=>{for(let i of(s.properties=t,o))n.accumulated=e[i],e[i]=a[i].evaluate(n,s)},t.clusterOptions}class g{constructor(t){this.self=t,this.actor=new e.N(t),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.globalStates=new Map,this.self.registerWorkerSource=(e,t)=>{if(this.externalWorkerSourceTypes[e])throw Error(`Worker source with name "${e}" already registered.`);this.externalWorkerSourceTypes[e]=t},this.self.addProtocol=e.cH,this.self.removeProtocol=e.cI,this.self.registerRTLTextPlugin=t=>{e.d1.setMethods(t)},this.self.makeRequest=e.m,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("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*(){var e,r;if(!(null!=(r=null==(e=this.workerSources[t])?void 0:e[i.type])&&r[i.source]))return;let a=this.workerSources[t][i.type][i.source];delete this.workerSources[t][i.type][i.source],void 0!==a.removeSource&&a.removeSource(i)})),this.actor.registerMessageHandler("RM",t=>e._(this,void 0,void 0,function*(){delete this.layerIndexes[t],delete this.availableImages[t],delete this.workerSources[t],delete this.demWorkerSources[t],this.globalStates.delete(t)})),this.actor.registerMessageHandler("SR",(t,i)=>e._(this,void 0,void 0,function*(){this.referrer=i})),this.actor.registerMessageHandler("SRPS",(e,t)=>this._syncRTLPluginState(e,t)),this.actor.registerMessageHandler("IS",(t,i)=>e._(this,void 0,void 0,function*(){this.self.importScripts(i)})),this.actor.registerMessageHandler("SI",(e,t)=>this._setImages(e,t)),this.actor.registerMessageHandler("UL",(t,i)=>e._(this,void 0,void 0,function*(){this._getLayerIndex(t).update(i.layers,i.removedIds,this._getGlobalState(t))})),this.actor.registerMessageHandler("UGS",(t,i)=>e._(this,void 0,void 0,function*(){let e=this._getGlobalState(t);for(let t in i)e[t]=i[t]})),this.actor.registerMessageHandler("SL",(t,i)=>e._(this,void 0,void 0,function*(){this._getLayerIndex(t).replace(i,this._getGlobalState(t))}))}_getGlobalState(e){let t=this.globalStates.get(e);return t||(t={},this.globalStates.set(e,t)),t}_setImages(t,i){return e._(this,void 0,void 0,function*(){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.d1.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){var r,a;if((r=this.workerSources)[e]||(r[e]={}),(a=this.workerSources[e])[t]||(a[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 c(r,this._getLayerIndex(e),this._getAvailableImages(e));break;case"geojson":this.workerSources[e][t][i]=new f(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){var i,r;return(i=this.demWorkerSources)[e]||(i[e]={}),(r=this.demWorkerSources[e])[t]||(r[t]=new p),this.demWorkerSources[e][t]}}return e.i(self)&&(self.worker=new g(self)),g}),i("index",["exports","./shared"],function(e,t){let i,r,a,n,s,o,l,h;var u,c,p,f,m,_,g="5.24.0";function y(){var e=new t.A(4);return t.A!=Float32Array&&(e[1]=0,e[2]=0),e[0]=1,e[3]=1,e}let x={frame(e,i,r,a){let n=a||window,s=n.requestAnimationFrame(e=>{o(),i(e)}),{unsubscribe:o}=t.s(e.signal,"abort",()=>{o(),n.cancelAnimationFrame(s),r(new t.a(e.signal.reason))},!1)},frameAsync(e,t){return new Promise((i,r)=>{this.frame(e,i,r,t)})},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 void 0!==a?a:!!matchMedia&&(null!=r||(r=matchMedia("(prefers-reduced-motion: reduce)")),r.matches)},set prefersReducedMotion(d){a=d}},v=new class{constructor(){this._frozenAt=null}getCurrentTime(){return null!==this._frozenAt?this._frozenAt:performance.now()}setNow(e){this._frozenAt=e}restoreNow(){this._frozenAt=null}isFrozen(){return null!==this._frozenAt}};function b(){return v.getCurrentTime()}class w{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(){w.docStyle&&w.selectProp&&(w.userSelect=w.docStyle[w.selectProp],w.docStyle[w.selectProp]="none")}static enableDrag(){w.docStyle&&w.selectProp&&(w.docStyle[w.selectProp]=w.userSelect)}static suppressClickInternal(e){e.preventDefault(),e.stopPropagation(),window.removeEventListener("click",w.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",w.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",w.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=w.getScale(e);return w.getPoint(e,i,t)}static touchPos(e,t){let i=[],r=w.getScale(e);for(let a of t)i.push(w.getPoint(e,r,a));return i}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 w.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)w.removeAttributes(t),w.clean(t)}static removeAttributes(e){for(let{name:t,value:i}of e.attributes)w.isPossiblyDangerous(t,i)&&e.removeAttribute(t)}}w.docStyle="u">typeof window&&(null==(p=window.document)?void 0:p.documentElement.style),w.selectProp=!w.docStyle||"userSelect"in w.docStyle?"userSelect":"webkitUserSelect",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)=>{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=>
2t._(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 p=c?l(a,u):t.m(a,u);try{let r=yield p;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.h(i):t.j(i)),cacheControl:r.cacheControl,expires:r.expires})}catch(i){delete e.abortController,s(t.d(i))}finally{r--,o()}}),o=()=>{let e=(()=>{for(let e of Object.keys(n))if(n[e]())return!0;return!1})()?t.c.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:t.c.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.f(s))&&(n.crossOrigin="anonymous"),i.signal.addEventListener("abort",()=>{n.src="",a(new t.a(i.signal.reason))}),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})}(f||(f={})),f.resetRequestQueue();class T{constructor(e){this._transformRequestFn=e??null}transformRequest(e,t){return this._transformRequestFn&&this._transformRequestFn(e,t)||{url:e}}setTransformRequest(e){this._transformRequestFn=e}}function S(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}`;i.includes(e)||(i.push(e),t.push({id:r,url:a}))}}return t}function P(e,t,i){try{let r=new URL(e);return r.pathname+=`${t}${i}`,r.toString()}catch{throw Error(`Invalid sprite URL "${e}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}class M 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}destroy(){for(let e of(this.atlasTexture&&(this.atlasTexture.destroy(),this.atlasTexture=null),Object.keys(this.images)))this.removeImage(e);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,null==a?void 0:a.width)||(this.fire(new t.l(Error(`Image "${e}" has invalid "stretchX" value`))),r=!1),this._validateStretch(i.stretchY,null==a?void 0:a.height)||(this.fire(new t.l(Error(`Image "${e}" has invalid "stretchY" value`))),r=!1),this._validateContent(i.content,i)||(this.fire(new t.l(Error(`Image "${e}" 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=(null==i?void 0:i.width)||t.data.width,a=(null==i?void 0: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){var t;let i=this.images[e];delete this.images[e],delete this.patterns[e],null!=(t=i.userImage)&&t.onRemove&&i.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){var i;let r={};for(let a of e){let e=this.getImage(a);e||(this.fire(new t.n("styleimagemissing",{id:a})),e=this.getImage(a)),e?r[a]={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:!!(null!=(i=e.userImage)&&i.render)}:t.w(`Image "${a}" 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 r}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={}}
2dispatchRenderCallbacks(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!(!(null!=t&&t.render)||!t.render()||(e.data.replace(new Uint8Array(t.data.buffer)),0))}(e)&&this.updateImage(i,e)}}cloneImages(){let e={};for(let t in this.images){let i=this.images[t];e[t]=Object.assign(Object.assign({},i),{data:i.data?i.data.clone():null})}return e}}let I=new Float64Array(256);for(let e=0;e<256;e++){let t=.5-Math.pow(e/255,.45454545454545453);I[e]=t*Math.abs(t)}function E(e,t,i,r,a,n,s,o,l){for(let h=t;h<t+r;h++)C(e,i*n+h,n,a,s,o,l);for(let h=i;h<i+a;h++)C(e,h*n+t,1,r,s,o,l)}function C(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}}I[255]=-1e20;let A=t.v.layout_symbol["text-font"].default.join(",");class D{constructor(e,t,i){this.requestManager=e,this.localIdeographFontFamily=t,this.entries={},this.lang=i}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})}_getAndCacheGlyphsPromise(e,i){return t._(this,void 0,void 0,function*(){var t;null!=(t=this.entries)[e]||(t[e]={glyphs:{},requests:{},ranges:{}});let r=this.entries[e],a=r.glyphs[i];return void 0!==a?{stack:e,id:i,glyph:a}:!this.url||this._charUsesLocalIdeographFontFamily(i)?(a=r.glyphs[i]=this._drawGlyph(r,e,i),{stack:e,id:i,glyph:a}):yield this._downloadAndCacheRangePromise(e,i)})}_downloadAndCacheRangePromise(e,i){return t._(this,void 0,void 0,function*(){var r;let a=this.entries[e],n=Math.floor(i/256);if(a.ranges[n])return{stack:e,id:i,glyph:null};(r=a.requests)[n]||(r[n]=D.loadGlyphRange(e,n,this.url,this.requestManager));try{let t=yield a.requests[n];for(let e in t)a.glyphs[+e]=t[+e];return a.ranges[n]=!0,{stack:e,id:i,glyph:t[i]||null}}catch(s){let r=a.glyphs[i]=this._drawGlyph(a,e,i);return this._warnOnMissingGlyphRange(r,n,i,t.d(s)),{stack:e,id:i,glyph:r}}})}_warnOnMissingGlyphRange(e,i,r,a){let n=256*i,s=r.toString(16).padStart(4,"0").toUpperCase();t.w(`Unable to load glyph range ${i}, ${n}-${n+255}. Rendering codepoint U+${s} locally instead. ${a}`)}_charUsesLocalIdeographFontFamily(e){return!!this.localIdeographFontFamily&&t.r(e)}_drawGlyph(e,i,r){let a=i===A&&""!==this.localIdeographFontFamily&&this._charUsesLocalIdeographFontFamily(r),n=a?"ideographTinySDF":"tinySDF";e[n]||(e[n]=this._createTinySDF(a?this.localIdeographFontFamily:i));let s=e[n].draw(String.fromCodePoint(r)),o=RegExp("^\\p{gc=Cf}+$","u").test(String.fromCodePoint(r));return{id:r,bitmap:new t.t({width:s.width||60,height:s.height||60},s.data),metrics:{width:o?0:s.glyphWidth/2||24,height:s.glyphHeight/2||24,left:s.glyphLeft/2+.5||0,top:s.glyphTop/2-27.5||-8,advance:o?0:s.glyphAdvance/2||24,isDoubleResolution:!0}}}_createTinySDF(e){let t=e?e.split(","):[];t.push("sans-serif");let i=t.map(e=>/[-\w]+/.test(e)?e:`'${CSS.escape(e)}'`).join(",");return new D.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:i,fontWeight:this._fontWeight(t[0]),fontStyle:this._fontStyle(t[0]),lang:this.lang})}_fontStyle(e){return/italic/i.test(e)?"italic":/oblique/i.test(e)?"oblique":"normal"}_fontWeight(e){let t;for(let[i,r]of Object.entries({thin:100,hairline:100,"extra light":200,"ultra light":200,light:300,normal:400,regular:400,medium:500,semibold:600,demibold:600,bold:700,"extra bold":800,"ultra bold":800,black:900,heavy:900,"extra black":950,"ultra black":950}))RegExp(`\\b${i}\\b`,"i").test(e)&&(t=`${r}`);return t}destroy(){for(let e in this.entries){let t=this.entries[e];t.tinySDF=null,t.ideographTinySDF=null,t.glyphs={},t.requests={},t.ranges={}}this.entries={}}}D.loadGlyphRange=function(e,i,r,a){return t._(this,void 0,void 0,function*(){let n=256*i,s=n+255,o=yield a.transformRequest(r.replace("{fontstack}",e).replace("{range}",`${n}-${s}`),"Glyphs"),l=yield t.o(o,new AbortController);if(!(null!=l&&l.data))throw Error(`Could not load glyph range. range: ${i}, ${n}-${s}`);let h={};for(let e of t.q(l.data))h[e.id]=e;return h})},D.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.radius=i,this.cutoff=r,this.lang=o;let 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){if("u">typeof OffscreenCanvas)return new OffscreenCanvas(e,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.floor(a),l=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(n)-o)),h=Math.max(0,Math.min(this.size-this.buffer,s+Math.ceil(r))),u=l+2*this.buffer,c=h+2*this.buffer,p=Math.max(u*c,0),f=new Uint8ClampedArray(p),m={data:f,width:u,height:c,glyphWidth:l,glyphHeight:h,glyphTop:s,glyphLeft:o,glyphAdvance:t};if(0===l||0===h)return m;let{ctx:_,buffer:g,gridInner:y,gridOuter:x}=this;this.lang&&(_.lang=this.lang),_.clearRect(g,g,l,h),_.fillText(e,g-o,g+s);let v=_.getImageData(g,g,l,h);x.fill(1e20,0,p),y.fill(0,0,p);let b=3;for(let e=0;e<h;e++){let t=(e+g)*u+g;for(let e=0;e<l;e++,b+=4,t++){let e=v.data[b];if(0===e)continue;let i=I[e];x[t]=Math.max(0,i),y[t]=Math.max(0,-i)}}E(x,0,0,u,c,u,this.f,this.v,this.z),E(y,g,g,l,h,u,this.f,this.v,this.z);let w=255/this.radius,T=255*(1-this.cutoff);for(let e=0;e<p;e++){let t=Math.sqrt(x[e])-Math.sqrt(y[e]);f[e]=Math.round(T-w*t)}return m}};class z{constructor(){this.specification=t.x.light.position}possiblyEvaluate(e,i){return t.G(e.expression.evaluate(i))}interpolate(e,i,r){return{x:t.H.number(e.x,i.x,r),y:t.H.number(e.y,i.y,r),z:t.H.number(e.z,i.z,r)}}}class k extends t.E{constructor(e){super(),n||(n=new t.u({anchor:new t.D(t.x.light.anchor),position:new z,color:new t.D(t.x.light.color),intensity:new t.D(t.x.light.intensity)}
2)),this._transitionable=new t.y(n,void 0),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,i={}){if(!this._validate(t.z,e,i))for(let i in e){let r=e[i];i.endsWith(t.B)?this._transitionable.setTransition(i.slice(0,-t.B.length),r):this._transitionable.setValue(i,r)}}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(null==r?void 0:r.validate)!==!1&&t.C(this,e.call(t.F,{value:i,style:{glyphs:!0,sprite:!0},styleSpec:t.x}))}}let R=new t.u({"sky-color":new t.D(t.x.sky["sky-color"]),"horizon-color":new t.D(t.x.sky["horizon-color"]),"fog-color":new t.D(t.x.sky["fog-color"]),"fog-ground-blend":new t.D(t.x.sky["fog-ground-blend"]),"horizon-fog-blend":new t.D(t.x.sky["horizon-fog-blend"]),"sky-horizon-blend":new t.D(t.x.sky["sky-horizon-blend"]),"atmosphere-blend":new t.D(t.x.sky["atmosphere-blend"])});class L extends t.E{constructor(e){super(),this._transitionable=new t.y(R,void 0),this.setSky(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new t.J(0))}setSky(e,i={}){if(!this._validate(t.K,e,i))for(let i in e||(e={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0}),e){let r=e[i];i.endsWith(t.B)?this._transitionable.setTransition(i.slice(0,-t.B.length),r):this._transitionable.setValue(i,r)}}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(null==r?void 0:r.validate)!==!1&&t.C(this,e.call(t.F,t.e({value:i,style:{glyphs:!0,sprite:!0},styleSpec:t.x})))}calculateFogBlendOpacity(e){return e<60?0:e<70?(e-60)/10:1}}class F{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){var i;let r=e.join(",")+String(t);return(i=this.dashEntry)[r]||(i[r]=this.addDash(e,t)),this.dashEntry[r]}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 of e)n+=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,height:2*r,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 B="maplibre_preloaded_worker_pool";class O{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<O.workerCount;)this.workers.push(new Worker(t.c.WORKER_URL));return this.active[e]=!0,this.workers.slice()}release(e){if(delete this.active[e],0===this.numActive()){for(let e of this.workers)e.terminate();this.workers=null}}isPreloaded(){return!!this.active[B]}numActive(){return Object.keys(this.active).length}}let V=Math.floor(x.hardwareConcurrency/2);function j(){return s||(s=new O),s}
2O.workerCount=t.L(globalThis)?Math.max(Math.min(V,3),1):1;class N{constructor(e,i){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=i;let r=this.workerPool.acquire(i);for(let e=0;e<r.length;e++){let a=new t.N(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){for(let e of this.actors)e.remove();this.actors=[],e&&this.workerPool.release(this.id)}registerMessageHandler(e,t){for(let i of this.actors)i.registerMessageHandler(e,t)}unregisterMessageHandler(e){for(let t of this.actors)t.unregisterMessageHandler(e)}}function U(){return o||(o=new N(j(),t.M)).registerMessageHandler("GR",(e,i,r)=>t.m(i,r)),o}function G(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 $(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 Z(e,i,r,a){return t._(this,void 0,void 0,function*(){let n=e;if(e.url?n=(yield t.k((yield i.transformRequest(e.url,"Source")),r)).data:yield x.frameAsync(r,a),!n)return null;let s=t.V(t.e(n,e),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in n&&n.vector_layers&&(s.vectorLayerIds=n.vector_layers.map(e=>e.id)),s})}class q{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.W?new t.W(e.lng,e.lat):t.W.convert(e),this}setSouthWest(e){return this._sw=e instanceof t.W?new t.W(e.lng,e.lat):t.W.convert(e),this}extend(e){let i,r,a=this._sw,n=this._ne;if(e instanceof t.W)i=e,r=e;else{if(!(e instanceof q))return Array.isArray(e)?4===e.length||e.every(Array.isArray)?this.extend(q.convert(e)):this.extend(t.W.convert(e)):e&&("lng"in e||"lon"in e)&&"lat"in e?this.extend(t.W.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.W(i.lng,i.lat),this._ne=new t.W(r.lng,r.lat)),this}getCenter(){return new t.W((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.W(this.getWest(),this.getNorth())}getSouthEast(){return new t.W(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.W.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}intersects(e){if(!((e=q.convert(e)).getNorth()>=this.getSouth()&&e.getSouth()<=this.getNorth()))return!1;let i=Math.abs(this.getEast()-this.getWest()),r=Math.abs(e.getEast()-e.getWest());if(i>=360||r>=360)return!0;let a=t.X(this.getWest(),-180,180),n=t.X(this.getEast(),-180,180),s=t.X(e.getWest(),-180,180),o=t.X(e.getEast(),-180,180),l=a>n,h=s>o;return!(!l||!h)||(l?o>=a||s<=n:h?n>=s||a<=o:s<=n&&o>=a)}static convert(e){return e instanceof q?e:e&&new q(e)}static fromLngLat(e,i=0){let r=360*i/0x2637f09,a=r/Math.cos(Math.PI/180*e.lat);return new q(new t.W(e.lng-a,e.lat-r),new t.W(e.lng+a,e.lat+r))}adjustAntiMeridian(){let e=new t.W(this._sw.lng,this._sw.lat),i=new t.W(this._ne.lng,this._ne.lat);return new q(e,e.lng>i.lng?new t.W(i.lng+360,i.lat):i)}}class W{constructor(e,t,i){this.bounds=q.convert(this.validateBounds(e)),this.minzoom=t||0,this.maxzoom=i||24}
2validateBounds(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.Z(this.bounds.getWest())*i),a=Math.floor(t.Y(this.bounds.getNorth())*i),n=Math.ceil(t.Z(this.bounds.getEast())*i),s=Math.ceil(t.Y(this.bounds.getSouth())*i);return e.x>=r&&e.x<n&&e.y>=a&&e.y<s}}class H 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.V(i,["url","scheme","tileSize","promoteId","encoding"])),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,arguments,void 0,function*(e=!1){this._loaded=!1,this.fire(new t.n("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{let i=yield Z(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,i&&(t.e(this,i),i.bounds&&(this.tileBounds=new W(i.bounds,this.minzoom,this.maxzoom)),this.fire(new t.n("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new t.n("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:e})))}catch(e){this._tileJSONRequest=null,this._loaded=!0,t.$(e)||this.fire(new t.l(t.d(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(!0)}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:yield 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,encoding:this.encoding,overzoomParameters:yield this._getOverzoomParameters(e),etag:e.etag};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);let a={};return null!=t&&t.etagUnmodified&&(a.unmodified=!0),a}catch(t){if(delete e.abortController,e.aborted)return;if(t&&404!==t.status)throw t;this._afterTileLoadWorkerResponse(e,null)}})}_getOverzoomParameters(e){return t._(this,void 0,void 0,function*(){if(e.tileID.canonical.z<=this.maxzoom||void 0===this.map._zoomLevelsToOverscale)return;let t=e.tileID.scaledTo(this.maxzoom).canonical,i=t.url(this.tiles,this.map.getPixelRatio(),this.scheme);return{maxZoomTileID:t,overzoomRequest:yield this.map._requestManager.transformRequest(i,"Tile")}})}_afterTileLoadWorkerResponse(e,t){if(null!=t&&t.resourceTiming&&(e.resourceTiming=t.resourceTiming),t&&this.map._refreshExpiredTiles&&e.setExpiryData(t),e.etag=null==t?void 0:t.etag,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 X 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.V(i,["url","scheme","tileSize"]))}load(){return t._(this,arguments,void 0,function*(e=!1){this._loaded=!1,this.fire(new t.n("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{let i=yield Z(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,i&&(t.e(this,i),i.bounds&&(this.tileBounds=new W(i.bounds,this.minzoom,this.maxzoom)),this.fire(new t.n("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new t.n("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:e})))}catch(e){this._tileJSONRequest=null,this._loaded=!0,t.$(e)||this.fire(new t.l(t.d(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 f.getImage((yield this.map._requestManager.transformRequest(i,"Tile")),e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(null!=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 Y extends X{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=yield this.map._requestManager.transformRequest(i,"Tile");e.neighboringTiles=this._getNeighboringTiles(e.tileID),e.abortController=new AbortController;try{let i=yield f.getImage(r,e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(null!=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.a0()?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&&"reloading"!==e.state)return;e.actor&&"expired"!==e.state||(e.actor=this.dispatcher.getActor()),e.dem=yield e.actor.sendAsync({type:"LDT",data:n}),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.a1()){let i=e.width+2,r=e.height+2;try{return new t.R({width:i,height:r},(yield t.a2(e,-1,-1,i,r)))}catch{}}return x.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.a3(e.overscaledZ,n,i.z,a,i.y).key]={backfilled:!1},l[new t.a3(e.overscaledZ,o,i.z,s,i.y).key]={backfilled:!1},i.y>0&&(l[new t.a3(e.overscaledZ,n,i.z,a,i.y-1).key]={backfilled:!1},l[new t.a3(e.overscaledZ,e.wrap,i.z,i.x,i.y-1).key]={backfilled:!1},l[new t.a3(e.overscaledZ,o,i.z,s,i.y-1).key]={backfilled:!1}),i.y+1<r&&(l[new t.a3(e.overscaledZ,n,i.z,a,i.y+1).key]={backfilled:!1},l[new t.a3(e.overscaledZ,e.wrap,i.z,i.x,i.y+1).key]={backfilled:!1},l[new t.a3(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}}))})}}function K(e,t){return t?e.properties[t]:e.id}function J(e){var t,i;if(!e)return{};let r={};return r.removeAll=e.removeAll,r.remove=new Set(e.remove||[]),r.add=new Map(null==(t=e.add)?void 0:t.map(e=>[e.id,e])),r.update=new Map(null==(i=e.update)?void 0:i.map(e=>[e.id,e])),r}function Q(e){return"GeometryCollection"===e.type?e.geometries.flatMap(e=>Q(e)):function e(t){return t&&0!==t.length?"number"==typeof t[0]?[t]:t.flatMap(t=>e(t)):[]}(e.coordinates)}function ee(e){let t,i=new q;switch(e.type){case"FeatureCollection":t=e.features.flatMap(e=>Q(e.geometry));break;case"Feature":t=Q(e.geometry);break;default:t=Q(e)}if(0===t.length)return i;for(let e of t){let[t,r]=e;i.extend([t,r])}return i}class et 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="string"==typeof i.data?{url:i.data}:{geojson: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,geojsonVtOptions:{buffer:this._pixelsToTileUnits(void 0!==i.buffer?i.buffer:128),tolerance:this._pixelsToTileUnits(void 0!==i.tolerance?i.tolerance:.375),extent:t.a6,maxZoom:this.maxzoom,lineMetrics:i.lineMetrics||!1,generateId:i.generateId||!1,promoteId:"string"==typeof i.promoteId?i.promoteId:void 0,cluster:i.cluster||!1,clusterOptions:{maxZoom:this._getClusterMaxZoom(i.clusterMaxZoom),minPoints:Math.max(2,i.clusterMinPoints||2),extent:t.a6,radius:this._pixelsToTileUnits(i.clusterRadius||50),log:!1,generateId:i.generateId||!1}},clusterProperties:i.clusterProperties,filter:i.filter},i.workerOptions)}_hasPendingWorkerUpdate(){return void 0!==this._pendingWorkerUpdate.data||void 0!==this._pendingWorkerUpdate.diff||this._pendingWorkerUpdate.updateCluster}_pixelsToTileUnits(e){return e*(t.a6/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,t){this._data="string"==typeof e?{url:e}:{geojson:e},this._pendingWorkerUpdate={data:e};let i=this._updateWorkerData();return t?i:this}updateData(e,t){this._pendingWorkerUpdate.diff=function(e,t){if(!e)return t||{};if(!t)return e||{};let i=J(e),r=J(t);for(let e of(r.removeAll&&(i.add.clear(),i.update.clear(),i.remove.clear(),r.remove.clear()),r.remove))i.add.delete(e),i.update.delete(e);for(let[e,t]of r.update){let a=i.update.get(e);a&&(r.update.set(e,function(e,t){let i={id:e.id};if(t.removeAllProperties&&(delete e.removeProperties,delete e.addOrUpdateProperties,delete t.removeProperties),t.removeProperties)for(let i of t.removeProperties){let t=e.addOrUpdateProperties.findIndex(e=>e.key===i);t>-1&&e.addOrUpdateProperties.splice(t,1)}return(e.removeAllProperties||t.removeAllProperties)&&(i.removeAllProperties=!0),(e.removeProperties||t.removeProperties)&&(i.removeProperties=[...e.removeProperties||[],...t.removeProperties||[]]),(e.addOrUpdateProperties||t.addOrUpdateProperties)&&(i.addOrUpdateProperties=[...e.addOrUpdateProperties||[],...t.addOrUpdateProperties||[]]),(e.newGeometry||t.newGeometry)&&(i.newGeometry=t.newGeometry||e.newGeometry),i}(a,t)),i.update.delete(e))}let a={};if((i.removeAll||r.removeAll)&&(a.removeAll=!0),a.remove=new Set([...i.remove,...r.remove]),a.add=new Map([...i.add,...r.add]),a.update=new Map([...i.update,...r.update]),a.remove.size&&a.add.size)for(let e of a.add.keys())a.remove.delete(e);let n={};return a.removeAll&&(n.removeAll=a.removeAll),a.remove&&(n.remove=Array.from(a.remove)),a.add&&(n.add=Array.from(a.add.values())
2),a.update&&(n.update=Array.from(a.update.values())),n}(this._pendingWorkerUpdate.diff,e);let i=this._updateWorkerData();return t?i:this}getData(){return t._(this,void 0,void 0,function*(){return this._data.url&&(yield this.once("data")),this._data.geojson?this._data.geojson:{type:"FeatureCollection",features:Array.from(this._data.updateable.values())}})}getBounds(){return t._(this,void 0,void 0,function*(){return ee((yield this.getData()))})}setClusterOptions(e){return this.workerOptions.geojsonVtOptions.cluster=e.cluster,void 0!==e.clusterRadius&&(this.workerOptions.geojsonVtOptions.clusterOptions.radius=this._pixelsToTileUnits(e.clusterRadius)),void 0!==e.clusterMaxZoom&&(this.workerOptions.geojsonVtOptions.clusterOptions.maxZoom=this._getClusterMaxZoom(e.clusterMaxZoom)),this._pendingWorkerUpdate.updateCluster=!0,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;if(!this._hasPendingWorkerUpdate())return void t.w(`No pending worker updates for GeoJSONSource ${this.id}.`);let{data:e,diff:i,updateCluster:r}=this._pendingWorkerUpdate,a=this._getLoadGeoJSONParameters(e,i,r);void 0!==e?this._pendingWorkerUpdate.data=void 0:i?this._pendingWorkerUpdate.diff=void 0:r&&(this._pendingWorkerUpdate.updateCluster=void 0),yield this._dispatchWorkerUpdate(a)})}_getLoadGeoJSONParameters(e,i,r){return t._(this,void 0,void 0,function*(){let a=t.e({type:this.type},this.workerOptions);return"string"==typeof e?(a.request=yield this.map._requestManager.transformRequest(x.resolveURL(e),"Source"),a.request.collectResourceTiming=this._collectResourceTiming,a):void 0!==e?(a.data=e,a):i?(a.dataDiff=i,a):r?(a.updateCluster=!0,a):void 0})}_dispatchWorkerUpdate(e){return t._(this,void 0,void 0,function*(){this._isUpdatingWorker=!0,this.fire(new t.n("dataloading",{dataType:"source"}));try{let i=yield e,r=yield this.actor.sendAsync({type:"LD",data:i});if(this._isUpdatingWorker=!1,this._removed||r.abandoned)return void this.fire(new t.n("dataabort",{dataType:"source"}));r.data&&(this._data={geojson:r.data});let a=this._applyDiffToSource(i.dataDiff),n=this._getShouldReloadTileOptions(a),s={dataType:"source"};this._applyResourceTiming(s,r),this.fire(new t.n("data",Object.assign(Object.assign({},s),{sourceDataType:"metadata"}))),this.fire(new t.n("data",Object.assign(Object.assign({},s),{sourceDataType:"content",shouldReloadTileOptions:n})))}catch(e){if(this._isUpdatingWorker=!1,this._removed)return void this.fire(new t.n("dataabort",{dataType:"source"}));this.fire(new t.l(t.d(e)))}finally{this._hasPendingWorkerUpdate()&&this._updateWorkerData()}})}_applyResourceTiming(e,i){var r;if(!this._collectResourceTiming)return;let a=null==(r=i.resourceTiming)?void 0:r[this.id];if(!a)return;let n=a.slice(0);null!=n&&n.length&&t.e(e,{resourceTiming:n})}_applyDiffToSource(e){if(!e)return;let t="string"==typeof this.promoteId?this.promoteId:void 0;if(!this._data.url&&!this._data.updateable){let e=function(e,t){let i=new Map;if(null==e||null==e.type)return i;if("Feature"===e.type){let r=K(e,t);return null==r?void 0:(i.set(r,e),i)}if("FeatureCollection"===e.type){let r=new Set;for(let a of e.features){let e=K(a,t);if(null==e||r.has(e))return;r.add(e),i.set(e,a)}return i}}(this._data.geojson,t);if(!e)throw Error(`GeoJSONSource "${this.id}": GeoJSON data is not compatible with updateData`);this._data={updateable:e}}if(!this._data.updateable)return;let i=function(e,t,i){var r,a;let n=[];if(t.removeAll)e.clear();else if(t.remove)for(let i of t.remove){let t=e.get(i);t&&(n.push(t.geometry),e.delete(i))}if(t.add)for(let r of t.add){let t=K(r,i);if(null==t)continue;let a=e.get(t);a&&n.push(a.geometry),n.push(r.geometry),e.set(t,r)}if(t.update)for(let i of t.update){let t=e.get(i.id);if(!t)continue;let s=!!i.newGeometry,o=i.removeAllProperties||(null==(r=i.removeProperties)?void 0:r.length)>0||(null==(a=i.addOrUpdateProperties)?void 0:a.length)>0;if(!s&&!o)continue;n.push(t.geometry);let l=Object.assign({},t);if(e.set(i.id,l),s&&(n.push(i.newGeometry),l.geometry=i.newGeometry),o){if(l.properties=i.removeAllProperties?{}:Object.assign({},l.properties||{}),i.removeProperties)for(let e of i.removeProperties)delete l.properties[e];if(i.addOrUpdateProperties)for(let{key:e,value:t}of i.addOrUpdateProperties)l.properties[e]=t}}return n}(this._data.updateable,e,t);return e.removeAll||this._options.cluster?void 0:i}_getShouldReloadTileOptions(e){if(e)return{affectedBounds:e.filter(Boolean).map(e=>ee(e))}}shouldReloadTile(e,{affectedBounds:i}){if("loading"===e.state)return!0;
2if("unloaded"===e.state)return!1;let{buffer:r,extent:a}=this.workerOptions.geojsonVtOptions,n=function({x:e,y:i,z:r},a=0){let n=t.a4((e-a)/Math.pow(2,r)),s=t.a5((i+1+a)/Math.pow(2,r));return new q([n,s],[t.a4((e+1+a)/Math.pow(2,r)),t.a5((i-a)/Math.pow(2,r))])}(e.tileID.canonical,r/a);for(let e of i)if(n.intersects(e))return!0;return!1}loaded(){return!this._isUpdatingWorker&&!this._hasPendingWorkerUpdate()}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};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.updateable?{type:"FeatureCollection",features:Array.from(this._data.updateable.values())}:this._data.url||this._data.geojson})}hasTransition(){return!1}}class ei 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.n("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{let t=yield f.getImage((yield this.map._requestManager.transformRequest(this.url,"Image")),this._request);this._request=null,this._loaded=!0,null!=t&&t.data&&(this.image=t.data,e&&(this.coordinates=e),this._finishLoading())}catch(e){this._request=null,this._loaded=!0,t.$(e)||this.fire(new t.l(t.d(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.n("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;this.coordinates=e;let r=e.map(t.a7.fromLngLat);return this.tileID=function(e){let i=t.a8.fromPoints(e),r=Math.max(0,Math.floor(-Math.log(Math.max(i.width(),i.height()))/Math.LN2)),a=Math.pow(2,r);return new t.aa(r,Math.floor((i.minX+i.maxX)/2*a),Math.floor((i.minY+i.maxY)/2*a))}(r),this.terrainTileRanges=this._getOverlappingTileRanges(r),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=r.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.n("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.n("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(e){return t._(this,void 0,void 0,function*(){var t;null!=(t=this.tileID)&&t.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.a8.fromPoints(e),s={};for(let e=0;e<=t.a9;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),c=(o%t+t)%t,p=h%t,f=Math.floor(o/t),m=Math.floor(h/t);s[e]={minWrap:f,maxWrap:m,minTileXWrapped:c,maxTileXWrapped:p,minTileY:l,maxTileY:u}}return s}}class er extends ei{constructor(e,t,i,r){super(e,t,i,r),this._onPlayingHandler=()=>{var e;null==(e=this.map)||e.triggerRepaint()},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((yield this.map._requestManager.transformRequest(t,"Source")).url);try{let e=yield t.ab(this.urls);if(this._loaded=!0,!e)return;this.video=e,this.video.loop=!0,this.video.addEventListener("playing",this._onPlayingHandler),this.map&&this.video.play(),this._finishLoading()}catch(e){this.fire(new t.l(t.d(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.l(new t.ac(`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}
2onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}onRemove(){super.onRemove(),this.video&&(this.video.removeEventListener("playing",this._onPlayingHandler),this.video.pause())}prepare(){if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;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.n("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 ea extends ei{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.l(new t.ac(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new t.l(new t.ac(`sources.${e}`,null,'missing required property "coordinates"'))),i.animate&&"boolean"!=typeof i.animate&&this.fire(new t.l(new t.ac(`sources.${e}`,null,'optional "animate" property must be a boolean value'))),i.canvas?"string"==typeof i.canvas||i.canvas instanceof HTMLCanvasElement||this.fire(new t.l(new t.ac(`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.l(new t.ac(`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.l(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}),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE));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.n("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",animate:this.animate,canvas:this.options.canvas,coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(let e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}}let en={},es=e=>{switch(e){case"geojson":return et;case"image":return ei;case"raster":return X;case"raster-dem":return Y;case"vector":return H;case"video":return er;case"canvas":return ea}return en[e]},eo="RTLPluginLoaded";class el extends t.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=U()}_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=x.resolveURL(e),!this.url)throw Error(`requested url ${e}
2 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.n(eo))})}lazyLoad(){"unavailable"===this.status?this.status="requested":"deferred"===this.status&&this._requestImport()}}let eh=null;function eu(){return eh||(eh=new el),eh}(u=m||(m={}))[u.Base=0]="Base",u[u.Parent=1]="Parent",(c=_||(_={}))[c.Departing=0]="Departing",c[c.Incoming=1]="Incoming";class ec{constructor(e,i){this.timeAdded=0,this.fadeEndTime=0,this.fadeOpacity=1,this.tileID=e,this.uid=t.ad(),this.uses=0,this.tileSize=i,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttFingerprint={},this.expiredRequestCount=0,this.state="loading"}isRenderable(e){return this.hasData()&&(!this.fadeEndTime||this.fadeOpacity>0)&&(e||!this.holdingForSymbolFade())}setCrossFadeLogic({fadingRole:e,fadingDirection:t,fadingParentID:i,fadeEndTime:r}){this.resetFadeLogic(),this.fadingRole=e,this.fadingDirection=t,this.fadingParentID=i,this.fadeEndTime=r}setSelfFadeLogic(e){this.resetFadeLogic(),this.selfFading=!0,this.fadeEndTime=e}resetFadeLogic(){this.fadingRole=null,this.fadingDirection=null,this.fadingParentID=null,this.selfFading=!1,this.timeAdded=b(),this.fadeEndTime=0,this.fadeOpacity=1}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((null==e?void 0:e.etagUnmodified)!==!0)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.latestEncoding=e.encoding,this.latestFeatureIndex.rawTileData=e.rawTileData,this.latestFeatureIndex.encoding=e.encoding):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData,this.latestFeatureIndex.encoding=this.latestEncoding)),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=>t.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.af){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.af&&i.hasRTLText){this.hasRTLText=!0,eu().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),this.dashPositions=e.dashPositions}else this.collisionBoxArray=new t.ae;else this.state="loaded"}unloadVectorData(){for(let e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.imageAtlas=null,this.dashPositions=null,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){var c;return null!=(c=this.latestFeatureIndex)&&c.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(!(null!=r&&r.rawTileData))return;let a=r.loadVTLayers(),n=null!=i&&i.sourceLayer?i.sourceLayer:"",s=a[t.ag]||a[n];if(!s)return;let o=t.ah(null==i?void 0:i.filter,null==i?void 0:i.globalState),{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.ai(a,!0);
2if(!o.filter(new t.J(this.tileID.overscaledZ),e,this.tileID.canonical))continue}else if(!o.filter(new t.J(this.tileID.overscaledZ),a))continue;let p=r.getId(a,n),f=new t.aj(a,l,h,u,p);f.tile=c,e.push(f)}}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.ak(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,i){var r,a,n;if(!(null!=(r=this.latestFeatureIndex)&&r.rawTileData)||0===Object.keys(e).length)return;let s=this.latestFeatureIndex.loadVTLayers();for(let r in this.buckets){if(!i.style.hasLayer(r))continue;let o=this.buckets[r],l=o.layers[0].sourceLayer||t.ag,h=s[l],u=e[l];if(!h||!u||0===Object.keys(u).length)continue;o.update(u,h,(null==(a=this.imageAtlas)?void 0:a.patternPositions)||{},this.dashPositions||{});let c=null==(n=null==i?void 0:i.style)?void 0:n.getLayer(r);c&&(this.queryPadding=Math.max(this.queryPadding,c.queryRadius(o)))}}holdingForSymbolFade(){return void 0!==this.symbolFadeHoldUntil}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<b()}clearSymbolFadeHold(){this.symbolFadeHoldUntil=void 0}setSymbolHoldDuration(e){this.symbolFadeHoldUntil=b()+e}setDependencies(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 ed{constructor(){this.state={},this.stateChanges={},this.deletedStates={},this.revision=0}updateState(e,i,r){var a,n,s,o,l;let h=String(i);if((o=this.stateChanges)[e]||(o[e]={}),(l=this.stateChanges[e])[h]||(l[h]={}),t.e(this.stateChanges[e][h],r),null===this.deletedStates[e])for(let t in this.deletedStates[e]={},this.state[e])t!==h&&(this.deletedStates[e][t]=null);else if((null==(a=this.deletedStates[e])?void 0:a[h])===null)for(let t in this.deletedStates[e][h]={},this.state[e][h])r[t]||(this.deletedStates[e][h][t]=null);else for(let t in r)(null==(s=null==(n=this.deletedStates[e])?void 0:n[h])?void 0:s[t])===null&&delete this.deletedStates[e][h][t]}removeFeatureState(e,t,i){var r,a,n;if(null===this.deletedStates[e])return;let s=String(t);if((a=this.deletedStates)[e]||(a[e]={}),i&&void 0!==t)null!==this.deletedStates[e][s]&&((n=this.deletedStates[e])[s]||(n[s]={}),this.deletedStates[e][s][i]=null);else if(void 0!==t)if(null!=(r=this.stateChanges[e])&&r[s])for(i in this.deletedStates[e][s]={},this.stateChanges[e][s])this.deletedStates[e][s][i]=null;else this.deletedStates[e][s]=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){var r,a,n;let s={};for(let e in this.stateChanges){(r=this.state)[e]||(r[e]={});let i={};for(let r in this.stateChanges[e])(a=this.state[e])[r]||(a[r]={}),t.e(this.state[e][r],this.stateChanges[e][r]),i[r]=this.state[e][r];s[e]=i}for(let e in this.deletedStates){(n=this.state)[e]||(n[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]}s[e]||(s[e]={}),t.e(s[e],i)}this.stateChanges={},this.deletedStates={},0!==Object.keys(s).length&&(this.revision++,e.setFeatureState(s,i))}}function ep(e,i){let r=t.al(i.lat,-t.am,t.am);return new t.P(t.Z(i.lng)*e,t.Y(r)*e)}function ef(e,i){return new t.a7(i.x/e,i.y/e).toLngLat()}function em(e){return e.cameraToCenterDistance*Math.min(.85*Math.tan(t.an(90-e.pitch)),Math.tan(t.an(89.25-e.pitch)))}function e_(e,i){let r=e.canonical,a=i/t.ao(r.z),n=r.x+Math.pow(2,r.z)*e.wrap,s=t.ap(new Float64Array(16));return t.Q(s,s,[n*a,r.y*a,0]),t.S(s,s,[a/t.a6,a/t.a6,1]),s}function eg(e,i,r,a,n){let s=t.a7.fromLngLat(e,i),o=n*t.aq(1,e.lat),{x:l,y:h,z:u}=ey(r,a);return new t.a7(s.x+-(o*l),s.y+-(o*h),s.z+-(o*u))}function ey(e,i){let r=t.an(e),a=t.an(i),n=Math.cos(-r),s=Math.sin(r);return{x:s*Math.sin(a),y:-s*Math.cos(a),z:n}}function ex(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 ev(e,i){return function(r,a,n,s,o){let l=2*((e-1)/t.ar(Math.cos(t.an(89.25-o))/Math.cos(t.an(89.25)))-1),h=Math.acos(n/s),u=2*ex(l-1,0,t.an(o/2)),c=Math.min(t.an(89.25),h+t.an(o/2)),p=ex(l-1,Math.min(c,h-t.an(o/2)),c),f=Math.atan(a/n),m=Math.hypot(a,n),_=r;return _+=t.ar(s/m/Math.max(.5,Math.cos(t.an(o/2)))),_+=l*t.ar(Math.cos(f))/2,_-=t.ar(M
2ath.max(1,p/u/i))/2}}let eb=ev(9.314,3);function ew(e,i){return Math.max(0,(i.roundZoom?Math.round:Math.floor)(e.zoom+t.ar(e.tileSize/i.tileSize)))}function eT(e,i){let r=e.getCameraFrustum(),a=e.getClippingPlane(),n=e.screenPointToMercatorCoordinate(e.getCameraPoint()),s=t.a7.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=ew(e,i),u=i.minzoom||0,c=void 0!==i.maxzoom?i.maxzoom:e.maxZoom,p=Math.min(Math.max(0,h),c),f=Math.pow(2,p),m=[f*n.x,f*n.y,0],_=[f*s.x,f*s.y,0],g=Math.hypot(s.x-n.x,s.y-n.y),y=Math.abs(s.z-n.z),x=Math.hypot(g,y),v=e=>({zoom:0,x:0,y:0,wrap:e,fullyVisible:!1}),b=[],w=[];if(e.renderWorldCopies&&o.allowWorldCopies())for(let e=1;e<=3;e++)b.push(v(-e)),b.push(v(e));for(b.push(v(0));b.length>0;){let f=b.pop(),g=f.x,v=f.y,T=f.fullyVisible,S={x:g,y:v,z:f.zoom},P=o.getTileBoundingVolume(S,f.wrap,e.elevation,i);if(!T){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;T=2===e}let M=o.distanceToTile2d(n.x,n.y,S,P),I=h;l&&(I=(i.calculateTileZoom||eb)(e.zoom+t.ar(e.tileSize/i.tileSize),M,y,x,e.fov));let E=Math.min(I=Math.max(0,I=(i.roundZoom?Math.round:Math.floor)(I)),c);if(f.wrap=o.getWrap(s,S,f.wrap),f.zoom>=E){if(f.zoom<u)continue;let e=p-f.zoom,r=m[0]-.5-(g<<e),a=m[1]-.5-(v<<e),n=i.reparseOverscaled?Math.max(f.zoom,I):f.zoom;w.push({tileID:new t.a3(f.zoom===c?n:f.zoom,f.wrap,f.zoom,g,v),distanceSq:t.as([_[0]-.5-g,_[1]-.5-v]),tileDistanceToCamera:Math.sqrt(r*r+a*a)})}else for(let e=0;e<4;e++)b.push({zoom:f.zoom+1,x:(g<<1)+e%2,y:(v<<1)+(e>>1),wrap:f.wrap,fullyVisible:T})}return w.sort((e,t)=>e.distanceSq-t.distanceSq).map(e=>e.tileID)}let eS=t.a8.fromPoints([new t.P(0,0),new t.P(t.a6,t.a6)]);function eP(e){return"raster"===e||"image"===e||"video"===e}function eM(e,t,i,r,a,n,s){if(i[0].overscaledZ>=n)return!1;let o=!1;for(let n of i){let i=e.getLoadedTile(n);if(!i)continue;let{fadingRole:l,fadingDirection:h,fadingParentID:u}=i;l===m.Base&&h===_.Departing&&u||(i.setCrossFadeLogic({fadingRole:m.Base,fadingDirection:_.Departing,fadingParentID:t.tileID,fadeEndTime:a+s}),t.setCrossFadeLogic({fadingRole:m.Parent,fadingDirection:_.Incoming,fadeEndTime:a+s})),r[n.key]=n,o=!0}return o}function eI(e,t){var i;e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0;let r=t.tileID.canonical.x-e.tileID.canonical.x,a=t.tileID.canonical.y-e.tileID.canonical.y,n=Math.pow(2,e.tileID.canonical.z),s=t.tileID.key;0===r&&0===a||Math.abs(a)>1||(Math.abs(r)>1&&(1===Math.abs(r+n)?r+=n:1===Math.abs(r-n)&&(r-=n)),t.dem&&e.dem&&(e.dem.backfillBorder(t.dem,r,a),null!=(i=e.neighboringTiles)&&i[s]&&(e.neighboringTiles[s].backfilled=!0)))}class eE{constructor(){this._tiles={}}handleWrapJump(e){let t={};for(let i in this._tiles){let r=this._tiles[i];r.tileID=r.tileID.unwrapTo(r.tileID.wrap+e),t[r.tileID.key]=r}this._tiles=t}setFeatureState(e,t){for(let i in this._tiles)this._tiles[i].setFeatureState(e,t)}getAllTiles(){return Object.values(this._tiles)}getAllIds(e=!1){return e?Object.values(this._tiles).map(e=>e.tileID).sort(t.au).map(e=>e.key):Object.keys(this._tiles)}getTileById(e){return this._tiles[e]}setTile(e,t){this._tiles[e]=t}deleteTileById(e){delete this._tiles[e]}getLoadedTile(e){let t=this.getTileById(e.key);return null!=t&&t.hasData()?t:null}isIdRenderable(e,t=!1){var i;return null==(i=this.getTileById(e))?void 0:i.isRenderable(t)}getRenderableIds(e=0,i){let r=[];for(let e of this.getAllIds())this.isIdRenderable(e,i)&&r.push(this.getTileById(e));return i?r.sort((i,r)=>{let a=i.tileID,n=r.tileID,s=new t.P(a.canonical.x,a.canonical.y)._rotate(-e),o=new t.P(n.canonical.x,n.canonical.y)._rotate(-e);return a.overscaledZ-n.overscaledZ||o.y-s.y||o.x-s.x}).map(e=>e.tileID.key):r.map(e=>e.tileID).sort(t.au).map(e=>e.key)}}class eC extends t.E{constructor(e,i,r){super(),this.id=e,this.dispatcher=r,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(es(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,i,r,this),this._inViewTiles=new eE,this._outOfViewCache=new t.av(0,e=>this._unloadTile(e)),this._timers={}
2,this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._rasterFadeDuration=0,this._maxFadingAncestorLevels=5,this._state=new ed,this._didEmitContent=!1,this._updated=!1}onAdd(e){var t;this.map=e,this._maxTileCacheSize=e?e._maxTileCacheSize:null,this._maxTileCacheZoomLevels=e?e._maxTileCacheZoomLevels:null,null!=(t=this._source)&&t.onAdd&&this._source.onAdd(e)}onRemove(e){var t;for(let e of this._inViewTiles.getAllTiles())e.unloadVectorData();this.clearTiles(),null!=(t=this._source)&&t.onRemove&&this._source.onRemove(e),this._inViewTiles=new eE}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 of this._inViewTiles.getAllTiles())if("loaded"!==e.state&&"errored"!==e.state)return!1;return!0}getSource(){return this._source}getState(){return this._state}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{let t=yield this._source.loadTile(e);this._tileLoaded(e,i,r,t)}catch(i){e.state="errored",404!==i.status?this._source.fire(new t.l(t.d(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.n("dataabort",{tile:e,coord:e.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(e){for(let t of(this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._inViewTiles,this.map?this.map.painter:null),this._inViewTiles.getAllTiles()))t.upload(e),t.prepare(this.map.style.imageManager)}getIds(){return this._inViewTiles.getAllIds(!0)}getRenderableIds(e){var t;return this._inViewTiles.getRenderableIds(null==(t=this.transform)?void 0:t.bearingInRadians,e)}hasRenderableParent(e){let t=e.overscaledZ-1;if(t>=this._source.minzoom){let i=this.getLoadedTile(e.scaledTo(t));if(i)return this._inViewTiles.isIdRenderable(i.tileID.key)}return!1}reload(e,t){if(this._paused)this._shouldReloadOnResume=!0;else for(let i of(this._outOfViewCache.reset(),this._inViewTiles.getAllIds())){let r=this._inViewTiles.getTileById(i);t&&!this._source.shouldReloadTile(r,t)||(e?this._reloadTile(i,"expired"):"errored"!==r.state&&this._reloadTile(i,"reloading"))}}_reloadTile(e,i){return t._(this,void 0,void 0,function*(){let t=this._inViewTiles.getTileById(e);t&&("loading"!==t.state&&(t.state=i),yield this._loadTile(t,e,i))})}_tileLoaded(e,i,r,a){e.timeAdded=b(),e.selfFading&&(e.fadeEndTime=e.timeAdded+this._rasterFadeDuration),"expired"===r&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(i,e),null!=a&&a.unmodified||("raster-dem"===this.getSource().type&&e.dem&&function(e,t){var i,r,a;for(let n of t.getRenderableIds()){if(!(null!=(i=e.neighboringTiles)&&i[n]))continue;let s=t.getTileById(n);e.neighboringTiles[n].backfilled||eI(e,s),null!=(a=null==(r=s.neighboringTiles)?void 0:r[e.tileID.key])&&a.backfilled||eI(s,e)}}(e,this._inViewTiles),this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new t.n("data",{dataType:"source",tile:e,coord:e.tileID})))}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._inViewTiles.getTileById(e)}_retainLoadedChildren(e,t){let i=this._getLoadedDescendents(t),r=new Set;for(let a of t){let t=i[a.key];if(!(null!=t&&t.length)){r.add(a);continue}let n=a.overscaledZ+eC.maxOverzooming,s=t.filter(e=>e.tileID.overscaledZ<=n);if(!s.length){r.add(a);continue}let o=Math.min(...s.map(e=>e.tileID.overscaledZ)),l=s.filter(e=>e.tileID.overscaledZ===o).map(e=>e.tileID);for(let t of l)e[t.key]=t;this._areDescendentsComplete(l,o,a.overscaledZ)||r.add(a)}return r}_getLoadedDescendents(e){var t;let i={};for(let r of this._inViewTiles.getAllTiles().filter(e=>e.hasData()))for(let a of e)r.tileID.isChildOf(a)&&(i[t=a.key]||(i[t]=[]),i[a.key].push(r));return i}_areDescendentsComplete(e,t,i){return 1===e.length&&e[0].isOverscaled()?e[0].overscaledZ===t:Math.pow(4,t-i)===e.length}getLoadedTile(e){return this._inViewTiles.getLoadedTile(e)}updateCacheSize(e){let i=Math.floor((Math.ceil(e.width/this._source.tileSize)+1)*(Math.ceil(e.height/this._source.tileSize)+1)*(null===this._maxTileC
2acheZoomLevels?t.c.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),r="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,i):i;this._outOfViewCache.setMaxSize(r)}handleWrapJump(e){let t=Math.round((e-(void 0===this._prevLng?e:this._prevLng))/360);this._prevLng=e,t&&(this._inViewTiles.handleWrapJump(t),this._resetTileReloadTimers())}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.used||this.usedForTerrain?this._source.tileID?r=e.getVisibleUnwrappedCoordinates(this._source.tileID).map(e=>new t.a3(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y)):(r=eT(e,{tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:"vector"===this._source.type&&void 0!==this.map._zoomLevelsToOverscale?e.maxZoom-this.map._zoomLevelsToOverscale:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:i,calculateTileZoom:this._source.calculateTileZoom}),this._source.hasTile&&(r=r.filter(e=>this._source.hasTile(e)))):r=[],this.usedForTerrain&&(r=this._addTerrainIdealTiles(r));let a=0===r.length&&!this._updated&&this._didEmitContent;this._updated=!0,a&&this.fire(new t.n("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));let n=ew(e,this._source),s=this._updateRetainedTiles(r,n),o=eP(this._source.type);o&&this._rasterFadeDuration>0&&!i&&function(e,i,r,a,n,s,o){let l=b(),h=t.at(i);for(let t of i){let i=e.getTileById(t.key);i.fadingDirection!==_.Departing&&0!==i.fadeOpacity||i.resetFadeLogic(),function(e,t,i,r,a,n,s){if(!t.hasData())return!1;let{tileID:o,fadingRole:l,fadingDirection:h,fadingParentID:u}=t;if(l===m.Base&&h===_.Incoming&&u)return i[u.key]=u,!0;let c=Math.max(o.overscaledZ-a,n);for(let a=o.overscaledZ-1;a>=c;a--){let n=o.scaledTo(a),l=e.getLoadedTile(n);if(l)return t.setCrossFadeLogic({fadingRole:m.Base,fadingDirection:_.Incoming,fadingParentID:l.tileID,fadeEndTime:r+s}),l.setCrossFadeLogic({fadingRole:m.Parent,fadingDirection:_.Departing,fadeEndTime:r+s}),i[n.key]=n,!0}return!1}(e,i,r,l,a,n,o)||function(e,t,i,r,a,n){if(!t.hasData())return!1;let s=t.tileID.children(a),o=eM(e,t,s,i,r,a,n);if(o)return!0;for(let l of s)eM(e,t,l.children(a),i,r,a,n)&&(o=!0);return o}(e,i,r,l,s,o)||function(e,t,i,r){let a=e.tileID;return!!e.selfFading||!e.hasData()&&!!t.has(a)&&(e.setSelfFadeLogic(i+r),!0)}(i,h,l,o)||i.resetFadeLogic()}}(this._inViewTiles,r,s,this._maxFadingAncestorLevels,this._source.minzoom,this._source.maxzoom,this._rasterFadeDuration),o?this._cleanUpRasterTiles(s):this._cleanUpVectorTiles(s)}_cleanUpRasterTiles(e){for(let t of this._inViewTiles.getAllIds())e[t]||this._removeTile(t)}_cleanUpVectorTiles(e){for(let t of this._inViewTiles.getAllIds()){let i=this._inViewTiles.getTileById(t);e[t]?i.clearSymbolFadeHold():i.hasSymbolBuckets?i.holdingForSymbolFade()?i.symbolFadeFinished()&&this._removeTile(t):i.setSymbolHoldDuration(this.map._fadeDuration):this._removeTile(t)}}_addTerrainIdealTiles(e){let t=[];for(let i of e)if(i.canonical.z>this._source.minzoom){let e=i.scaledTo(i.canonical.z-1);t.push(e);let r=i.scaledTo(Math.max(this._source.minzoom,Math.min(i.canonical.z,5)));t.push(r)}return e.concat(t)}releaseSymbolFadeTiles(){for(let e of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(e).holdingForSymbolFade()&&this._removeTile(e)}_updateRetainedTiles(e,t){var i;let r=new Set;for(let t of e)this._addTile(t).hasData()||r.add(t);let a=e.reduce((e,t)=>(e[t.key]=t,e),{}),n=this._retainLoadedChildren(a,r),s={},o=Math.max(t-eC.maxUnderzooming,this._source.minzoom);for(let e of n){let t=this._inViewTiles.getTileById(e.key),r=null==t?void 0:t.wasRequested();for(let n=e.overscaledZ-1;n>=o;--n){let o=e.scaledTo(n);if(s[o.key])break;if(s[o.key]=!0,(t=this.getTile(o))||!r||(t=this._addTile(o)),t){let e=t.hasData();if((e||!(null!=(i=this.map)&&i.cancelPendingTileRequestsWhileZooming)||r)&&(a[o.key]=o),r=t.wasRequested(),e)break}}}return a}_addTile(e){let i=this._inViewTiles.getTileById(e.key);if(i)return i;(i=this._outOfViewCache.getAndRemove(e))&&(i.resetFadeLogic(),this._setTileReloadTimer(e.key,i),i.tileID=e,this._state.initializeTileState(i,this.map?this.map.painter:null));let r=i;
2return i||(i=new ec(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(i,e.key,i.state)),i.uses++,this._inViewTiles.setTile(e.key,i),r||this._source.fire(new t.n("dataloading",{tile:i,coord:i.tileID,dataType:"source"})),i}_setTileReloadTimer(e,t){this._clearTileReloadTimer(e);let i=t.getExpiryTimeout();i&&(this._timers[e]=setTimeout(()=>{this._reloadTile(e,"expired"),delete this._timers[e]},i))}_clearTileReloadTimer(e){let t=this._timers[e];t&&(clearTimeout(t),delete this._timers[e])}_resetTileReloadTimers(){for(let e in this._timers)clearTimeout(this._timers[e]),delete this._timers[e];for(let e of this._inViewTiles.getAllIds()){let t=this._inViewTiles.getTileById(e);this._setTileReloadTimer(e,t)}}refreshTiles(e){for(let t of this._inViewTiles.getAllIds()){let i=this._inViewTiles.getTileById(t);(this._inViewTiles.isIdRenderable(t)||"errored"==i.state)&&e.some(e=>e.equals(i.tileID.canonical))&&this._reloadTile(t,"expired")}}_removeTile(e){let t=this._inViewTiles.getTileById(e);t&&(t.uses--,this._inViewTiles.deleteTileById(e),this._clearTileReloadTimer(e),t.uses>0||(t.hasData()&&"reloading"!==t.state?this._outOfViewCache.add(t.tileID,t,t.getExpiryTimeout()):(t.aborted=!0,this._abortTile(t),this._unloadTile(t))))}_dataHandler(e){"source"===e.dataType&&("metadata"!==e.sourceDataType?"content"===e.sourceDataType&&this._sourceLoaded&&!this._paused&&(this.reload(e.sourceDataChanged,e.shouldReloadTileOptions),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0):this._sourceLoaded=!0)}clearTiles(){for(let e of(this._shouldReloadOnResume=!1,this._paused=!1,this._inViewTiles.getAllIds()))this._removeTile(e);this._outOfViewCache.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(),p=t.a8.fromPoints(u);for(let e of c){let r=this._inViewTiles.getTileById(e);if(r.holdingForSymbolFade())continue;let o=s?[r.tileID]:[r.tileID.unwrapTo(-1),r.tileID.unwrapTo(0)],l=Math.pow(2,n.zoom-r.tileID.overscaledZ),c=i*r.queryPadding*t.a6/r.t
vendor: 4,115 bytes, line 2
2ileSize/l;for(let e of o){let i=p.map(i=>e.getTilePoint(new t.a7(i.x,i.y)));if(i.expandBy(c),i.intersects(eS)){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.a8.fromPoints(e);r.shrinkBy(.001*Math.min(r.width(),r.height()));let n=r.map(i);t.a8.fromPoints(a).covers(n)||(a=a.map(e=>e.x>.5?new t.a7(e.x-1,e.y,e.z):e))}return a}getVisibleCoordinates(e){let t=this.getRenderableIds(e).map(e=>this._inViewTiles.getTileById(e).tileID);return this.transform&&this.transform.populateCache(t),t}hasTransition(){return!!this._source.hasTransition()||eP(this._source.type)&&function(e,t){if(t<=0)return!1;let i=b();for(let t of e.getAllTiles())if(t.fadeEndTime>=i)return!0;return!1}(this._inViewTiles,this._rasterFadeDuration)}setRasterFadeDuration(e){this._rasterFadeDuration=e}setFeatureState(e,i,r){e||(e=t.ag),this._state.updateState(e,i,r)}removeFeatureState(e,i,r){e||(e=t.ag),this._state.removeFeatureState(e,i,r)}getFeatureState(e,i){return e||(e=t.ag),this._state.getState(e,i)}setDependencies(e,t,i){let r=this._inViewTiles.getTileById(e);r&&r.setDependencies(t,i)}reloadTilesForDependencies(e,t){for(let i of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(i).hasDependency(e,t)&&this._reloadTile(i,"reloading");this._outOfViewCache.filter(i=>!i.hasDependency(e,t))}areTilesLoaded(){for(let e of this._inViewTiles.getAllTiles())if("loaded"!==e.state&&"errored"!==e.state)return!1;return!0}}eC.maxUnderzooming=10,eC.maxOverzooming=3;class eA{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.al(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 eD(e,t){let i=!0;return"always"===e||"never"!==e&&"never"!==t||(i=!1),i}class ez{constructor(e,t,i){let 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=[];
2return 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,p=this.boxKeys[s];if(e<=a[c+2]+1e-6&&t<=a[c+3]+1e-6&&i>=a[c+0]-1e-6&&r>=a[c+1]-1e-6&&(!o||o(p))&&(!h||!eD(u,p.overlapMode))&&(n.push({key:p,x1:a[c],y1:a[c+1],x2:a[c+2],y2:a[c+3]}),h))return!0}}let p=this.circleCells[a];if(null!==p){let a=this.circles;for(let s of p)if(!l.circle[s]){l.circle[s]=!0;let c=3*s,p=this.circleKeys[s];if(this._circleAndRectCollide(a[c],a[c+1],a[c+2],e,t,i,r)&&(!o||o(p))&&(!h||!eD(u,p.overlapMode))){let e=a[c],t=a[c+1],i=a[c+2];if(n.push({key:p,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))&&!eD(u,r.overlapMode))return n.push(!0),!0}}let p=this.circleCells[a];if(null!==p){let e=this.circles;for(let t of p)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))&&!eD(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 p=l;p<=u;p++)for(let l=h;l<=c;l++)if(a.call(this,e,t,i,r,this.xCellCount*l+p,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,p=u-h;return c*c+p*p<=i*i}}let ek=t.O();function eR(e,i,r){var a,n,s,o,l;let h=t.O();if(!e){let{vecSouth:e,vecEast:t}=eL(i),r=y();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.S(h,h,[1/r,1/r,1]),h}function eL(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.az();o[0]=-n*a*r-s*i,o[1]=-s*a*r+n*i;let l=t.aA(o);l<1e-9?t.aB(o):t.aC(o,o,1/l);let h=t.az();h[0]=n*a*i-s*r,h[1]=s*a*i+n*r;let u=t.aA(h);return u<1e-9?t.aB(h):t.aC(h,h,1/u),{vecEast:h,vecSouth:o}}function eF(e,i,r,a){let n;a?(n=[e,i,a(e,i),1],t.aE(n,n,r)):eX(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 eB(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),p=t.getoffsetX(l-1),f=eq(e*c,i,r,a,n.segment,h,u,o,s);if(!f)return null;let m=eq(e*p,i,r,a,n.segment,h,u,o,s);return m?o.projectionCache.anyProjectionOccluded?null:{first:f,last:m}:null}function eO(e,i,r,a){return e===t.ax.horizontal&&Math.abs(r.y-i.y)>Math.abs(r.x-i.x)*a?{useVertical:!0}:(e===t.ax.vertical?i.y<r.y:i.x>r.x)?{needsFlipping:!0}:null}function eV(e){let i,{projectionContext:r,pitchedLabelPlaneMatrixInverse:a,symbol:n,fontSize:s,flip:o,keepUpright:l,glyphOffsetArray:h,dynamicLayoutVertexArray:u,aspectRatio:c,rotateToLine:p}=e,f=s/24,m=n.lineOffsetX*f,_=n.lineOffsetY*f;if(n.numGlyphs>1){let e=n.glyphStartIndex+n.numGlyphs,t=n.lineStartIndex,s=n.lineStartIndex+n.lineLength,u=eB(f,h,m,_,o,n,p,r);if(!u)return{notEnoughRoom:!0};let g=eG(u.first.point.x,u.first.point.y,r,a),y=eG(u.last.point.x,u.last.point.y,r,a);if(l&&!o){let e=eO(n.writingMode,g,y,c);if(e)return e}i=[u.first];for(let a=n.glyphStartIndex+1;a<e-1;a++){let e=eq(f*h.getoffsetX(a),m,_,o,n.segment,t,s,r,p);if(!e)return{notEnoughRoom:!0};i.push(e)}i.push(u.last)}else{if(l&&!o){let e=eU(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=eU(s.x,s.y,r),l=o.signedDistanceFromCamera>0?o.point:ej(r.tileAnchorPoint,s,e,1,r),h=eG(e.x,e.y,r,a),u=eG(l.x,l.y,r,a),p=eO(n.writingMode,h,u,c);if(p)return p}let e=eq(f*h.getoffsetX(n.glyphStartIndex),m,_,o,n.segment,n.lineStartIndex,n.lineStartIndex+n.lineLength,r,p);if(!e||r.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};i=[e]}for(let e of i)t.aD(u,e.point,e.angle);return{}}function ej(e,t,i,r,a){let n=e.add(e.sub(t)._unit()),s=eU(n.x,n.y,a).point,o=i.sub(s);return i.add(o._mult(r/o.mag()))}function eN(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=eU(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 ej(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 eU(e,t,i){let r,a=e+i.translation[0],n=t+i.translation[1];return i.pitchWithMap?(r=eF(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 eG(e,i,r,a){if(r.pitchWithMap){let n=[e,i,0,1];return t.aE(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 e$(e,t,i){return i.transform.projectTileCoordinates(e,t,i.unwrappedTileID,i.getElevation)}function eZ(e,t,i){return e._unit()._perp()._mult(t*i)}function eq(e,i,r,a,n,s,o,l,h){let u,c=a?e-i:e+i,p=c>0?1:-1,f=0;a&&(p*=-1,f=Math.PI),p<0&&(f+=Math.PI);let m,_=p>0?s+n:s+n+1;l.projectionCache.cachedAnchorPoint?m=l.projectionCache.cachedAnchorPoint:(m=eU(l.tileAnchorPoint.x,l.tileAnchorPoint.y,l).point,l.projectionCache.cachedAnchorPoint=m);let g,y,x=m,v=m,b=0,w=0,T=Math.abs(c),S=[];for(;b+w<=T;){if((_+=p)<s||_>=o)return null;b+=w,v=x,y=g;let e={absOffsetX:T,direction:p,distanceFromAnchor:b,previousVertex:v};if(x=eN(_,l,e),0===r)S.push(v),u=x.sub(v);else{let i,a=x.sub(v);
2i=0===a.mag()?eZ(eN(_+p,l,e).sub(x),r,p):eZ(a,r,p),y||(y=v.add(i)),g=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=eN(e+h.direction,l,h),p=eZ(c.sub(r),o,h.direction),f=r.add(p),m=c.add(p);return l.projectionCache.offsets[e]=t.aF(s,u,f,m)||u,l.projectionCache.offsets[e]}(_,i,x,s,o,y,r,l,e),S.push(y),u=g.sub(y)}w=u.mag()}let P=u._mult((T-b)/w)._add(y||v),M=f+Math.atan2(x.y-v.y,x.x-v.x);return S.push(P),{point:P,angle:h?M:0,path:S}}let eW=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function eH(e,t){for(let i=0;i<e;i++){let e=t.length;t.resize(e+4),t.float32.set(eW,3*e)}}function eX(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 eY{constructor(e,t=new ez(e.width+200,e.height+200,25),i=new ez(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 p,f=this.projectAndGetPerspectiveRatio(e.anchorPointX+o[0],e.anchorPointY+o[1],a,h,c),m=i*f.perspectiveRatio;if(n||s)p=this._projectCollisionBox(e,m,r,a,n,s,o,f,h,u,c);else{let t=f.x+(u?u.x*m:0),i=f.y+(u?u.y*m:0);p={allPointsOccluded:!1,box:[t+e.x1*m,i+e.y1*m,t+e.x2*m,i+e.y2*m]}}let[_,g,y,x]=p.box,v=n?p.allPointsOccluded:f.isOccluded,b=v;return b||(b=f.perspectiveRatio<this.perspectiveRatioCutoff),b||(b=!this.isInsideGrid(_,g,y,x)),b||"always"!==t&&this.grid.hitTest(_,g,y,x,t,l)?{box:[_,g,y,x],placeable:!1,offscreen:!1,occluded:v}:{box:[_,g,y,x],placeable:!0,offscreen:this.isOffscreen(_,g,y,x),occluded:v}}placeCollisionCircles(e,i,r,a,n,s,o,l,h,u,c,p,f,m){let _=[],g=new t.P(i.anchorX,i.anchorY),y=this.getPerspectiveRatio(g.x,g.y,s,m),x=(h?n*this.transform.getPitchedTextCorrection(i.anchorX,i.anchorY,s)/y:n*y)/t.aJ,v={getElevation:m,pitchedLabelPlaneMatrix:o,lineVertexArray:r,pitchWithMap:h,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:this.transform,tileAnchorPoint:g,unwrappedTileID:s,width:this.transform.width,height:this.transform.height,translation:f},b=eB(x,a,i.lineOffsetX*x,i.lineOffsetY*x,!1,i,!1,v),w=!1,T=!1,S=!0;if(b){let i=.5*c*y+p,r=new t.P(-100,-100),a=new t.P(this.screenRightBoundary,this.screenBottomBoundary),n=new eA,s=b.first,o=b.last,f=[];for(let e=s.path.length-1;e>=1;e--)f.push(s.path[e]);for(let e=1;e<o.path.length;e++)f.push(o.path[e]);let m=2.5*i;if(h){let e=this.projectPathToScreenSpace(f,v);f=e.some(e=>e.signedDistanceFromCamera<=0)?[]:e.map(e=>e.point)}let g=[];if(f.length>0){let e=f[0].clone(),i=f[0].clone();for(let t=1;t<f.length;t++)e.x=Math.min(e.x,f[t].x),e.y=Math.min(e.y,f[t].y),i.x=Math.max(i.x,f[t].x),i.y=Math.max(i.y,f[t].y);g=e.x>=r.x&&i.x<=a.x&&e.y>=r.y&&i.y<=a.y?[f]:i.x<r.x||e.x>a.x||i.y<r.y||e.y>a.y?[]:t.aG([f],r.x,r.y,a.x,a.y)}for(let t of g){n.reset(t,.25*i);let r=0;r=n.length<=.5*i?1:Math.ceil(n.paddedLength/m)+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;_.push(o,h,i,0);let c=o-i,p=h-i,f=o+i,m=h+i;if(S&&(S=this.isOffscreen(c,p,f,m)),T||(T=this.isInsideGrid(c,p,f,m)),"always"!==e&&this.grid.hitTestCircle(o,h,i,e,u)&&(w=!0,!l))return{circles:[],offscreen:!1,collisionDetected:w}}}}return{circles:!l&&w||!T||y<this.perspectiveRatioCutoff?[]:_,offscreen:S,collisionDetected:w}}projectPathToScreenSpace(e,t){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)}((function(e,t){let i=1/(t[0]*t[5]-t[1]*t[4]);e[0]=t[5]*i,e[1]=-t[1]*i,e[2]=0,e[3]=0,e[4]=-t[4]*i,e[5]=t[0]*i,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1/t[10],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1/t[15]}(ek,t.pitchedLabelPlaneMatrix),e.map(e=>{let i=eF(e.x,e.y,ek,t.getElevation),r=t.transform.projectTileCoordinates(i.point.x,i.point.y,t.unwrappedTileID,t.getElevation);return r.point.x=(.5*r.point.x+.5)*t.width,r.point.y=(-(.5*r.point.y)+.5)*t.height,r})))}queryRenderedSymbols(e){if(0===e.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};let i=[],r=new t.a8;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.aH(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.aE(r,r,n)):eX(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.ap([]);return t.Q(e,e,[-100,-100,0]),e}_projectCollisionBox(e,i,r,a,n,s,o,l,h,u,c){let p=1,f=0,m=0,_=1,g=e.anchorPointX+o[0],y=e.anchorPointY+o[1];if(s&&!n){let e=this.projectAndGetPerspectiveRatio(g+1,y,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);p=n,f=r,m=-r,_=n}else if(!s&&n){let e=eL(this.transform);p=e.vecEast[0],f=e.vecEast[1],m=e.vecSouth[0],_=e.vecSouth[1]}let x=l.x,v=l.y,b=i;n&&(x=g,v=y,b=Math.pow(2,-(this.transform.zoom-r.overscaledZ))*this.transform.getPitchedTextCorrection(g,y,a),u||(b*=t.al(.5+l.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))),u&&(x+=p*u.x*b+m*u.y*b,v+=f*u.x*b+_*u.y*b);let w=e.x1*b,T=e.x2*b,S=(w+T)/2,P=e.y1*b,M=e.y2*b,I=(P+M)/2,E=[];for(let{offsetX:e,offsetY:i}of[{offsetX:w,offsetY:P},{offsetX:S,offsetY:P},{offsetX:T,offsetY:P},{offsetX:T,offsetY:I},{offsetX:T,offsetY:M},{offsetX:S,offsetY:M},{offsetX:w,offsetY:M},{offsetX:w,offsetY:I}])E.push(new t.P(x+p*e+m*i,v+f*e+_*i));let C=!1;if(n){let e=E.map(e=>this.projectAndGetPerspectiveRatio(e.x,e.y,a,h,c));C=e.some(e=>!e.isOccluded),E=e.map(e=>new t.P(e.x,e.y))}else C=!0;return{box:t.aI(E),allPointsOccluded:!C}}}class eK{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 eJ{constructor(e,t,i,r,a){this.text=new eK(e?e.text:null,t,i,a),this.icon=new eK(e?e.icon:null,t,r,a)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class eQ{constructor(e,t,i){this.text=e,this.icon=t,this.skipFade=i}}class e0{constructor(e,t,i,r,a){this.bucketInstanceId=e,this.featureIndex=t,this.sourceLayerIndex=i,this.bucketIndex=r,this.tileID=a}}class e1{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 e2(e,i,r,a,n){let{horizontalAlign:s,verticalAlign:o}=t.aP(e);return new t.P(-(s-.5)*i+a[0]*n,-(o-.5)*r+a[1]*n)}class e3{constructor(e,t,i,r,a){this.transform=e.clone(),this.terrain=t,this.collisionIndex=new eY(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=i,this.retainedQueryData={},this.collisionGroups=new e1(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.a6,p=r.tileID.toUnwrapped(),f="map"===l.get("text-rotation-alignment"),m=t.aK(r,1,this.transform.zoom),_=t.aL(this.collisionIndex.transform,r,h.get("text-translate"),h.get("text-translate-anchor")),g=t.aL(this.collisionIndex.transform,r,h.get("icon-translate"),h.get("icon-translate-anchor")),y=eR(f,this.transform,m);this.retainedQueryData[n.bucketInstanceId]=new e0(n.bucketInstanceId,s,n.sourceLayerIndex,n.index,r.tileID);let x={bucket:n,layout:l,translationText:_,translationIcon:g,unwrappedTileID:p,pitchedLabelPlaneMatr
2ix:y,scale:u,textPixelRatio:c,holdingForFade:r.holdingForSymbolFade(),collisionBoxArray:o,partiallyEvaluatedTextSize:t.aw(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:x})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:n.symbolInstances.length,parameters:x})}attemptAnchorPlacement(e,i,r,a,n,s,o,l,h,u,c,p,f,m,_,g,y,x,v,b){var w,T,S;let P=t.aM[e.textAnchor],M=[e.textOffset0,e.textOffset1],I=e2(P,r,a,M,n),E=this.collisionIndex.placeCollisionBox(i,p,l,h,u,o,s,g,c.predicate,v,I,b);if((!x||this.collisionIndex.placeCollisionBox(x,p,l,h,u,o,s,y,c.predicate,v,I,b).placeable)&&E.placeable){let e;if(null!=(w=this.prevPlacement)&&w.variableOffsets[f.crossTileID]&&null!=(S=null==(T=this.prevPlacement)?void 0:T.placements[f.crossTileID])&&S.text&&(e=this.prevPlacement.variableOffsets[f.crossTileID].anchor),0===f.crossTileID)throw Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[f.crossTileID]={textOffset:M,width:r,height:a,anchor:P,textBoxScale:n,prevAnchor:e},this.markUsedJustification(m,P,f,_),m.allowVerticalPlacement&&(this.markUsedOrientation(m,_,f),this.placedOrientations[f.crossTileID]=_),{shift:I,placedGlyphBoxes:E}}}placeLayerBucketPart(e,i,r){let{bucket:a,layout:n,translationText:s,translationIcon:o,unwrappedTileID:l,pitchedLabelPlaneMatrix:h,textPixelRatio:u,holdingForFade:c,collisionBoxArray:p,partiallyEvaluatedTextSize:f,collisionGroup:m}=e.parameters,_=n.get("text-optional"),g=n.get("icon-optional"),y=t.aN(n,"text-overlap","text-allow-overlap"),x="always"===y,v=t.aN(n,"icon-overlap","icon-allow-overlap"),b="always"===v,w="map"===n.get("text-rotation-alignment"),T="map"===n.get("text-pitch-alignment"),S="none"!==n.get("icon-text-fit"),P="viewport-y"===n.get("symbol-z-order"),M=x&&(b||!a.hasIconData()||g),I=b&&(x||!a.hasTextData()||_);!a.collisionArrays&&p&&a.deserializeCollisionBoxes(p);let E=this.retainedQueryData[a.bucketInstanceId].tileID,C=this._getTerrainElevationFunc(E),A=this.transform.getFastPathSimpleProjectionMatrix(E),D=(e,p,b)=>{var P,D;if(i[e.crossTileID])return;if(c)return void(this.placements[e.crossTileID]=new eQ(!1,!1,!1));let z=!1,k=!1,R=!0,L=null,F={box:null,placeable:!1,offscreen:null,occluded:!1},B={placeable:!1},O=null,V=null,j=null,N=0,U=0,G=0;p.textFeatureIndex?N=p.textFeatureIndex:e.useRuntimeCollisionCircles&&(N=e.featureIndex),p.verticalTextFeatureIndex&&(U=p.verticalTextFeatureIndex);let $=p.textBox;if($){let i=i=>{let r=t.ax.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&&p.verticalTextBox){for(let e of a.writingModes)if(e===t.ax.vertical?B=F=r():F=i(),null==F?void 0:F.placeable)break}else F=i()},h=e.textAnchorOffsetStartIndex,c=e.textAnchorOffsetEndIndex;if(c===h){let r=(t,i)=>{let r=this.collisionIndex.placeCollisionBox(t,y,u,E,l,T,w,s,m.predicate,C,void 0,A);return null!=r&&r.placeable&&(this.markUsedOrientation(a,i,e),this.placedOrientations[e.crossTileID]=i),r};n(()=>r($,t.ax.horizontal),()=>{let i=p.verticalTextBox;return a.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&i?r(i,t.ax.vertical):{box:null,offscreen:null}}),i(null==F?void 0:F.placeable)}else{let f=t.aM[null==(D=null==(P=this.prevPlacement)?void 0:P.variableOffsets[e.crossTileID])?void 0:D.anchor],_=(t,i,n)=>{let p=t.x2-t.x1,_=t.y2-t.y1,g=e.textBoxScale,x=S&&"never"===v?i:null,b=null,P="never"===y?1:2,M="never";f&&P++;for(let i=0;i<P;i++){for(let i=h;i<c;i++){let r=a.textAnchorOffsets.get(i);if(f&&r.textAnchor!==f)continue;let h=this.attemptAnchorPlacement(r,t,p,_,g,w,T,u,E,l,m,M,e,a,n,s,o,x,C);if(h&&(null==(b=h.placedGlyphBoxes)?void 0:b.placeable))return z=!0,L=h.shift,b}f?f=null:M=y}return r&&!b&&(b={box:this.collisionIndex.placeCollisionBox($,"always",u,E,l,T,w,s,m.predicate,C,void 0,A).box,offscreen:!1,placeable:!1,occluded:!1}),b};n(()=>_($,p.iconBox,t.ax.horizontal),()=>{let i=p.verticalTextBox;return a.allowVerticalPlacement&&!(null!=F&&F.placeable)&&e.numVerticalGlyphVertices>0&&i?_(i,p.verticalIconBox,t.ax.vertical):{box:null,occluded:!0,offscreen:null}}),F&&(z=F.placeable,R=F.offscreen);let g=i(null==F?void 0:F.placeable);if(!z&&this.prevPlacement){let t=this.prevPlacement.variableOffsets[e.crossTileID];t&&(this.variableOffsets[e.crossTileID]=t,this.markUsedJustification(a,t.anchor,e,g))}}}if(z=null==(O=F)?void 0:O.placeable,R=null==O?void 0:O.offscreen,e.useRuntimeCollisionCircles&&e.centerJustifiedTextSymbolIndex>=0){let i=a.text.placedSymbolArray.get(e.centerJustifiedTextSymbolIndex),o=t.ay(a.textSizeData,f,i),u=n.get("text-padding");(V=this.collisionIndex.placeCollisionCircles(y,i,a.lineVertexArray,a.glyphOffsetArray,o,l,h,r,T,m.predicate,e.collisionCircleDiameter,u,s,C)).circles.length&&V.collisionDetected&&!r&&t.w("Collisions detected, but collision boxes are not shown"),z=x||V.circles.length>0&&!V.collisionDetected,R&&(R=V.offscreen)}if(p.iconFeatureIndex&&(G=p.iconFeatureIndex),p.iconBox){let e=e=>this.collisionIndex.placeCollisionBox(e,v,u,E,l,T,w,o,m.predicate,C,S&&L?L:void 0,A);k=B&&B.placeable&&p.verticalIconBox?(j=e(p.verticalIconBox)).placeable:(j=e(p.iconBox)).placeable,R&&(R=j.offscreen)}let Z=_||0===e.numHorizontalGlyphVertices&&0===e.numVerticalGlyphVertices,q=g||0===e.numIconVertices;Z||q?q?Z||k&&(k=z):z=k&&z:k=z=k&&z;let W=k&&j.placeable;if(z&&O.placeable&&this.collisionIndex.insertCollisionBox(O.box,y,n.get("text-ignore-placement"),a.bucketInstanceId,B&&B.placeable&&U?U:N,m.ID),W&&this.collisionIndex.insertCollisionBox(j.box,v,n.get("icon-ignore-placement"),a.bucketInstanceId,G,m.ID),V&&z&&this.collisionIndex.insertCollisionCircles(V.circles,y,n.get("text-ignore-placement"),a.bucketInstanceId,N,m.ID),r&&this.storeCollisionData(a.bucketInstanceId,b,p,O,j,V),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 eQ((z||M)&&!(null!=O&&O.occluded),(k||I)&&!(null!=j&&j.occluded),R||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];D(a.symbolInstances.get(i),a.collisionArrays[i],i)}}else for(let t=e.symbolInstanceStart;t<e.symbolInstanceEnd;t++)D(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.ax.vertical?r.verticalPlacedTextSymbolIndex:({left:r.leftJustifiedTextSymbolIndex,center:r.centerJustifiedTextSymbolIndex,right:r.rightJustifiedTextSymbolIndex})[t.aO(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.ax.horizontal||i===t.ax.horizontalOnly?i:0,n=i===t.ax.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 eJ(n,r,t.text,t.icon),i||(i=t.text!==n.text.placed),i||(i=t.icon!==n.icon.placed)):(this.opacities[e]=new eJ(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 eJ(t,r,!1,!1);a.isHidden()||(this.opacities[e]=a,i||(i=t.text.placed),i||(i=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 eJ(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"),p="map"===s.get("text-pitch-alignment"),f="none"!==s.get("icon-text-fit"),m=new eJ(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 _=(e,t,i)=>{for(let r=0;r<t/4;r++)e.opacityVertexArray.emplaceBack(i);e.hasVisibleVertices||(e.hasVisibleVertices=i!==e4)},g=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=m,this.opacities[l]=h),r[l]=!0;let y=a.numIconVertices>
20,x=this.placedOrientations[a.crossTileID],v=x===t.ax.vertical,b=x===t.ax.horizontal||x===t.ax.horizontalOnly;if(n>0||s>0){let t=e6(h.text);_(e.text,n,v?e4:t),_(e.text,s,b?e4:t);let i=h.text.isHidden();for(let t of[a.rightJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.leftJustifiedTextSymbolIndex])t>=0&&(e.text.placedSymbolArray.get(t).hidden=i||v?1:0);a.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(a.verticalPlacedTextSymbolIndex).hidden=i||b?1:0);let r=this.variableOffsets[a.crossTileID];r&&this.markUsedJustification(e,r.anchor,a,x);let o=this.placedOrientations[a.crossTileID];o&&(this.markUsedJustification(e,"left",a,o),this.markUsedOrientation(e,o,a))}if(y){let t=e6(h.icon),i=!(f&&a.verticalPlacedIconSymbolIndex&&v);a.placedIconSymbolIndex>=0&&(_(e.icon,a.numIconVertices,i?t:e4),e.icon.placedSymbolArray.get(a.placedIconSymbolIndex).hidden=h.icon.isHidden()),a.verticalPlacedIconSymbolIndex>=0&&(_(e.icon,a.numVerticalIconVertices,i?e4:t),e.icon.placedSymbolArray.get(a.verticalPlacedIconSymbolIndex).hidden=h.icon.isHidden())}let w=null!=g&&g.has(i)?g.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=e2(e.anchor,e.width,e.height,e.textOffset,e.textBoxScale),c&&i._rotate(p?-this.transform.bearingInRadians:this.transform.bearingInRadians)):t=!1}if(r.textBox||r.verticalTextBox){let a;r.textBox&&(a=v),r.verticalTextBox&&(a=b),e5(e.textCollisionBox.collisionVertexArray,h.text.placed,!t||a,w.text,i.x,i.y)}}if(r.iconBox||r.verticalIconBox){let t,a=!!(!b&&r.verticalIconBox);r.iconBox&&(t=a),r.verticalIconBox&&(t=!a),e5(e.iconCollisionBox.collisionVertexArray,h.icon.placed,t,w.icon,f?i.x:0,f?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 e5(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 e6(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 e4=0;class e8{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 e7{constructor(e,t,i,r,a,n,s,o){this.placement=new e3(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,i,r){let a=b(),n=()=>!this._forceFullPlacement&&b()-a>2;for(;this._currentPlacementIndex>=0;){let a=i[e[this._currentPlacementIndex]],s=this.placement.collisionIndex.transform.zoom;if(t.aQ(a)&&a.layout&&(!a.minzoom||a.minzoom<=s)&&(!a.maxzoom||a.maxzoom>s)){if(this._inProgressLayer||(this._inProgressLayer=new e8(a)),this._inProgressLayer.continuePlacement(r[a.source],this.placement,this._showCollisionBoxes,a,n))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}}let e9=512/t.a6/2;class te{constructor(e,i,r){this.tileID=e,this.bucketInstanceId=r,this._symbolsByKey={};let a=new Map;for(let e=0;e<i.length;e++){let t=i.get(e),r=t.key,n=a.get(r);n?n.push(t):a.set(r,[t])}for(let[e,i]of a){let r={positions:i.map(e=>({x:Math.floor(e.anchorX*e9),y:Math.floor(e.anchorY*e9)})),crossTileIDs:i.map(e=>e.crossTileID)};if(r.positions.length>128){let e=new t.aR(r.positions.length,16,Uint16Array);for(let{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=e9/Math.pow(2,l-n),u=(o*t.a6+e.anchorY)*h,c=a*t.a6*e9;return{x:Math.floor((s*t.a6+e.anchorX)*h-r*t.a6*e9),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 tt{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class ti{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){var r,a,n;if(null!=(r=this.indexes[e.overscaledZ])&&r[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;(a=this.usedCrossTileIDs)[n=e.overscaledZ]||(a[n]={});let s=this.usedCrossTileIDs[e.overscaledZ];for(let i in this.indexes){let r=this.indexes[i];if(Number(i)>e.overscaledZ)for(let i in r){let a=r[i];a.tileID.isChildOf(e)&&a.findMatches(t.symbolInstances,e,s)}else{let a=r[e.scaledTo(Number(i)).key];a&&a.findMatches(t.symbolInstances,e,s)}}for(let e=0;e<t.symbolInstances.length;e++){let r=t.symbolInstances.get(e);r.crossTileID||(r.crossTileID=i.generate(),s[r.crossTileID]=!0)}return void 0===this.indexes[e.overscaledZ]&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new te(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 tr{constructor(){this.layerIndexes={},this.crossTileIDs=new tt,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,t,i){let r=this.layerIndexes[e.id];void 0===r&&(r=this.layerIndexes[e.id]=new ti);let a=!1,n={};for(let s of(r.handleWrapJump(i),t)){let t=s.getBucket(e);e.id===(null==t?void 0:t.layerIds[0])&&(t.bucketInstanceId||(this.maxBucketInstanceId+=1,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={};for(let i of e)t[i]=!0;for(let e in this.layerIndexes)t[e]||delete this.layerIndexes[e]}}var ta="void main() {fragColor=vec4(1.0);}";let tn={prelude:ts(`#ifdef GL_ES 3precision mediump float; 4#else 5#if !defined(lowp) 6#define lowp 7#endif 8#if !defined(mediump) 9#define mediump 10#endif 11#if !defined(highp) 12#define highp 13#endif 14#endif 15out highp vec4 fragColor;`,`#ifdef GL_ES 16precision highp float; 17#else 18#if !defined(lowp) 19#define lowp 20#endif 21#if !defined(mediump) 22#define mediump 23#endif 24#if !defined(highp) 25#define highp 26#endif 27#endif 28vec2 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 29);}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);
29return (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 30);} 31#ifdef TERRAIN3D 32uniform 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; 33#endif 34const 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) { 35#ifdef TERRAIN3D 36highp 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)); 37#else 38return 1.0; 39#endif 40}float calculate_visibility(vec4 pos) { 41#ifdef TERRAIN3D 42vec3 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; 43#else 44return 1.0; 45#endif 46}float ele(vec2 pos) { 47#ifdef TERRAIN3D 48vec4 rgb=(texture(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a; 49#else 50return 0.0; 51#endif 52}float get_elevation(vec2 pos) { 53#ifdef TERRAIN3D 54#ifdef GLOBE 55if ((pos.y <-32767.5) || (pos.y > 32766.5)) {return 0.0;} 56#endif 57vec2 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; 58#else 59return 0.0; 60#endif 61}const float PI=3.141592653589793;uniform mat4 u_projection_matrix;`),projectionMercator:ts("","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:ts("",`#define GLOBE_RADIUS 6371008.8 62uniform 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 63);}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); 64if (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 65);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:ts(`uniform vec4 u_color;uniform float u_opacity;void main() {fragColor=u_color*u_opacity; 66#ifdef OVERDRAW_INSPECTOR 67fragColor=vec4(1.0); 68#endif 69}`,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),backgroundPattern:ts(`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;
69uniform 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; 70#ifdef OVERDRAW_INSPECTOR 71fragColor=vec4(1.0); 72#endif 73}`,"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:ts(`in vec3 v_data;in float v_visibility; 74#pragma mapbox: define highp vec4 color 75#pragma mapbox: define mediump float radius 76#pragma mapbox: define lowp float blur 77#pragma mapbox: define lowp float opacity 78#pragma mapbox: define highp vec4 stroke_color 79#pragma mapbox: define mediump float stroke_width 80#pragma mapbox: define lowp float stroke_opacity 81void main() { 82#pragma mapbox: initialize highp vec4 color 83#pragma mapbox: initialize mediump float radius 84#pragma mapbox: initialize lowp float blur 85#pragma mapbox: initialize lowp float opacity 86#pragma mapbox: initialize highp vec4 stroke_color 87#pragma mapbox: initialize mediump float stroke_width 88#pragma mapbox: initialize lowp float stroke_opacity 89vec2 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;} 90#ifdef OVERDRAW_INSPECTOR 91fragColor=vec4(1.0); 92#endif 93}`,`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; 94#pragma mapbox: define highp vec4 color 95#pragma mapbox: define mediump float radius 96#pragma mapbox: define lowp float blur 97#pragma mapbox: define lowp float opacity 98#pragma mapbox: define highp vec4 stroke_color 99#pragma mapbox: define mediump float stroke_width 100#pragma mapbox: define lowp float stroke_opacity 101void main(void) { 102#pragma mapbox: initialize highp vec4 color 103#pragma mapbox: initialize mediump float radius 104#pragma mapbox: initialize lowp float blur 105#pragma mapbox: initialize lowp float opacity 106#pragma mapbox: initialize highp vec4 stroke_color 107#pragma mapbox: initialize mediump float stroke_width 108#pragma mapbox: initialize lowp float stroke_opacity 109vec2 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) { 110#ifdef GLOBE 111vec3 center_vector=projectToSphere(circle_center); 112#endif 113float 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 { 114#ifdef GLOBE 115vec4 projected_center=interpolateProjection(circle_center,center_vector,ele); 116#else 117vec4 projected_center=projectTileWithElevation(circle_center,ele); 118#endif 119corner_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);} 120#ifdef GLOBE 121vec2 angles=extrude*angle_scale;vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(corner_position,corner_vector,ele); 122#else 123gl_Position=projectTileWithElevation(corner_position,ele); 124#endif 125} 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:ts(ta,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),heatmap:ts(`uniform highp float u_intensity;in vec2 v_extrude; 126#pragma mapbox: define highp float weight 127#define GAUSS_COEF 0.3989422804014327 128void main() { 129#pragma mapbox: initialize highp float weight 130float 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); 131#ifdef OVERDRAW_INSPECTOR 132fragColor=vec4(1.0); 133#endif 134}`,`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; 135#pragma mapbox: define highp float weight 136#pragma mapbox: define mediump float radius 137const highp float ZERO=1.0/255.0/16.0; 138#define GAUSS_COEF 0.3989422804014327 139void main(void) { 140#pragma mapbox: initialize highp float weight 141#pragma mapbox: initialize mediump float radius 142vec2 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); 143#ifdef GLOBE 144vec2 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); 145#else 146gl_Position=projectTileFor3D(circle_center+extrude,get_elevation(circle_center)); 147#endif 148}`),heatmapTexture:ts(`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; 149#ifdef OVERDRAW_INSPECTOR 150fragColor=vec4(0.0); 151#endif 152}`,"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:ts("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:ts("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:ts(`#ifdef GL_ES 153precision highp float; 154#endif 155uniform 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 156{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)); 157#ifdef OVERDRAW_INSPECTOR 158fragColor=vec4(1.0); 159#endif 160}`,"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:ts("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:ts(ta,`in vec2 a_pos;void main() { 161#ifdef GLOBE 162gl_Position=projectTileFor3D(a_pos,0.0); 163#else 164gl_Position=u_projection_matrix*vec4(a_pos,0.0,1.0); 165#endif 166}`),fill:ts(`#pragma mapbox: define highp vec4 color 167#pragma mapbox: define lowp float opacity 168void main() { 169#pragma mapbox: initialize highp vec4 color 170#pragma mapbox: initialize lowp float opacity 171fragColor=color*opacity; 172#ifdef OVERDRAW_INSPECTOR 173fragColor=vec4(1.0); 174#endif 175}`,`uniform vec2 u_fill_translate;in vec2 a_pos; 176#pragma mapbox: define highp vec4 color 177#pragma mapbox: define lowp float opacity 178void main() { 179#pragma mapbox: initialize highp vec4 color 180#pragma mapbox: initialize lowp float opacity 181gl_Position=projectTile(a_pos+u_fill_translate,a_pos);}`),fillOutline:ts(`in vec2 v_pos; 182#ifdef GLOBE 183in float v_depth; 184#endif 185#pragma mapbox: define highp vec4 outline_color 186#pragma mapbox: define lowp float opacity 187void main() { 188#pragma mapbox: initialize highp vec4 outline_color 189#pragma mapbox: initialize lowp float opacity 190float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=outline_color*(alpha*opacity); 191#ifdef GLOBE 192if (v_depth > 1.0) {discard;} 193#endif 194#ifdef OVERDRAW_INSPECTOR 195fragColor=vec4(1.0); 196#endif 197}`,`uniform vec2 u_world;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos; 198#ifdef GLOBE 199out float v_depth; 200#endif 201#pragma mapbox: define highp vec4 outline_color 202#pragma mapbox: define lowp float opacity 203void main() { 204#pragma mapbox: initialize highp vec4 outline_color 205#pragma mapbox: initialize lowp float opacity 206gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world; 207#ifdef GLOBE 208v_depth=gl_Position.z/gl_Position.w; 209#endif 210}`),fillOutlinePattern:ts(`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; 211#ifdef GLOBE 212in float v_depth; 213#endif 214#pragma mapbox: define lowp float opacity 215#pragma mapbox: define lowp vec4 pattern_from 216#pragma mapbox: define lowp vec4 pattern_to 217void main() { 218#pragma mapbox: initialize lowp float opacity 219#pragma mapbox: initialize mediump vec4 pattern_from 220#pragma mapbox: initialize mediump vec4 pattern_to 221vec2 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; 222#ifdef GLOBE 223if (v_depth > 1.0) {discard;} 224#endif 225#ifdef OVERDRAW_INSPECTOR 226fragColor=vec4(1.0); 227#endif 228}`,`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; 229#ifdef GLOBE 230out float v_depth; 231#endif 232#pragma mapbox: define lowp float opacity 233#pragma mapbox: define lowp vec4 pattern_from 234#pragma mapbox: define lowp vec4 pattern_to 235#pragma mapbox: define lowp float pixel_ratio_from 236#pragma mapbox: define lowp float pixel_ratio_to 237void main() { 238#pragma mapbox: initialize lowp float opacity 239#pragma mapbox: initialize mediump vec4 pattern_from 240#pragma mapbox: initialize mediump vec4 pattern_to 241#pragma mapbox: initialize lowp float pixel_ratio_from 242#pragma mapbox: initialize lowp float pixel_ratio_to 243vec2 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; 244#ifdef GLOBE 245v_depth=gl_Position.z/gl_Position.w; 246#endif 247}`),fillPattern:ts(`#ifdef GL_ES 248precision highp float; 249#endif 250uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b; 251#pragma mapbox: define lowp float opacity 252#pragma mapbox: define lowp vec4 pattern_from 253#pragma mapbox: define lowp vec4 pattern_to 254void main() { 255#pragma mapbox: initialize lowp float opacity 256#pragma mapbox: initialize mediump vec4 pattern_from 257#pragma mapbox: initialize mediump vec4 pattern_to 258vec2 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; 259#ifdef OVERDRAW_INSPECTOR 260fragColor=vec4(1.0); 261#endif 262}`,`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; 263#pragma mapbox: define lowp float opacity 264#pragma mapbox: define lowp vec4 pattern_from 265#pragma mapbox: define lowp vec4 pattern_to 266#pragma mapbox: define lowp float pixel_ratio_from 267#pragma mapbox: define lowp float pixel_ratio_to 268void main() { 269#pragma mapbox: initialize lowp float opacity 270#pragma mapbox: initialize mediump vec4 pattern_from 271#pragma mapbox: initialize mediump vec4 pattern_to 272#pragma mapbox: initialize lowp float pixel_ratio_from 273#pragma mapbox: initialize lowp float pixel_ratio_to 274vec2 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_siz
274e_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:ts(`in vec4 v_color;void main() {fragColor=v_color; 275#ifdef OVERDRAW_INSPECTOR 276fragColor=vec4(1.0); 277#endif 278}`,`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; 279#ifdef TERRAIN3D 280in vec2 a_centroid; 281#endif 282out vec4 v_color; 283#pragma mapbox: define highp float base 284#pragma mapbox: define highp float height 285#pragma mapbox: define highp vec4 color 286void main() { 287#pragma mapbox: initialize highp float base 288#pragma mapbox: initialize highp float height 289#pragma mapbox: initialize highp vec4 color 290vec3 normal=a_normal_ed.xyz; 291#ifdef TERRAIN3D 292float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0); 293#else 294float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0; 295#endif 296base=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; 297#ifdef GLOBE 298vec3 spherePos=projectToSphere(posInTile,a_pos);gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation); 299#else 300gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0); 301#endif 302float 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); 303#ifdef GLOBE 304mat3 rotMatrix=globeGetRotationMatrix(spherePos);normalForLighting=rotMatrix*normalForLighting;directional=mix(directional,clamp(dot(normalForLighting,u_lightpos_globe),0.0,1.0),u_projection_transition); 305#endif 306directional=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:ts(`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; 307#pragma mapbox: define lowp float base 308#pragma mapbox: define lowp float height 309#pragma mapbox: define lowp vec4 pattern_from 310#pragma mapbox: define lowp vec4 pattern_to 311#pragma mapbox: define lowp float pixel_ratio_from 312#pragma mapbox: define lowp float pixel_ratio_to 313void main() { 314#pragma mapbox: initialize lowp float base 315#pragma mapbox: initialize lowp float height 316#pragma mapbox: initialize mediump vec4 pattern_from 317#pragma mapbox: initialize mediump vec4 pattern_to 318#pragma mapbox: initialize lowp float pixel_ratio_from 319#pragma mapbox: initialize lowp float pixel_ratio_to 320vec2 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; 321#ifdef OVERDRAW_INSPECTOR 322fragColor=vec4(1.0); 323#endif 324}`,`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; 325#ifdef TERRAIN3D 326in vec2 a_centroid; 327#endif 328#ifdef GLOBE 329out vec3 v_sphere_pos; 330#endif 331out vec2 v_pos_a;out vec2 v_pos_b;out vec4 v_lighting; 332#pragma mapbox: define lowp float base 333#pragma mapbox: define lowp float height 334#pragma mapbox: define lowp vec4 pattern_from 335#pragma mapbox: define lowp vec4 pattern_to 336#pragma mapbox: define lowp float pixel_ratio_from 337#pragma mapbox: define lowp float pixel_ratio_to 338void main() { 339#pragma mapbox: initialize lowp float base 340#pragma mapbox: initialize lowp float height 341#pragma mapbox: initialize mediump vec4 pattern_from 342#pragma mapbox: initialize mediump vec4 pattern_to 343#pragma mapbox: initialize lowp float pixel_ratio_from 344#pragma mapbox: initialize lowp float pixel_ratio_to 345vec2 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; 346#ifdef TERRAIN3D 347float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0); 348#else 349float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0; 350#endif 351base=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; 352#ifdef GLOBE 353vec3 spherePos=projectToSphere(posInTile,a_pos);vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);v_sphere_pos=elevatedPos;gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation); 354#else 355gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0); 356#endif 357vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0 358? a_pos 359: 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:ts(`#ifdef GL_ES 360precision highp float; 361#endif 362uniform 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
362ow(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); 363#ifdef OVERDRAW_INSPECTOR 364fragColor=vec4(1.0); 365#endif 366}`,"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:ts(`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]; 367#define PI 3.141592653589793 368#define STANDARD 0 369#define COMBINED 1 370#define IGOR 2 371#define MULTIDIRECTIONAL 3 372#define BASIC 4 373float 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 374{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 375{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);} 376#ifdef OVERDRAW_INSPECTOR 377fragColor=vec4(1.0); 378#endif 379}`,"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:ts(`uniform lowp float u_device_pixel_ratio;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale; 380#ifdef GLOBE 381in float v_depth; 382#endif 383#pragma mapbox: define highp vec4 color 384#pragma mapbox: define lowp float blur 385#pragma mapbox: define lowp float opacity 386void main() { 387#pragma mapbox: initialize highp vec4 color 388#pragma mapbox: initialize lowp float blur 389#pragma mapbox: initialize lowp float opacity 390float 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); 391#ifdef GLOBE 392if (v_depth > 1.0) {discard;} 393#endif 394#ifdef OVERDRAW_INSPECTOR 395fragColor=vec4(1.0); 396#endif 397}`,` 398#define scale 0.015873016 399in 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; 400#ifdef GLOBE 401out float v_depth; 402#endif 403#pragma mapbox: define highp vec4 color 404#pragma mapbox: define lowp float blur 405#pragma mapbox: define lowp float opacity 406#pragma mapbox: define mediump float gapwidth 407#pragma mapbox: define lowp float offset 408#pragma mapbox: define mediump float width 409void main() { 410#pragma mapbox: initialize highp vec4 color 411#pragma mapbox: initialize lowp float blur 412#pragma mapbox: initialize lowp float opacity 413#pragma mapbox: initialize mediump float gapwidth 414#pragma mapbox: initialize lowp float offset 415#pragma mapbox: initialize mediump float width 416float 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);
416float 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; 417#ifdef GLOBE 418v_depth=gl_Position.z/gl_Position.w; 419#endif 420#ifdef TERRAIN3D 421v_gamma_scale=1.0; 422#else 423float 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; 424#endif 425v_width2=vec2(outset,inset);}`),lineGradient:ts(`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; 426#ifdef GLOBE 427in float v_depth; 428#endif 429#pragma mapbox: define lowp float blur 430#pragma mapbox: define lowp float opacity 431void main() { 432#pragma mapbox: initialize lowp float blur 433#pragma mapbox: initialize lowp float opacity 434float 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); 435#ifdef GLOBE 436if (v_depth > 1.0) {discard;} 437#endif 438#ifdef OVERDRAW_INSPECTOR 439fragColor=vec4(1.0); 440#endif 441}`,` 442#define scale 0.015873016 443in 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; 444#ifdef GLOBE 445out float v_depth; 446#endif 447#pragma mapbox: define lowp float blur 448#pragma mapbox: define lowp float opacity 449#pragma mapbox: define mediump float gapwidth 450#pragma mapbox: define lowp float offset 451#pragma mapbox: define mediump float width 452void main() { 453#pragma mapbox: initialize lowp float blur 454#pragma mapbox: initialize lowp float opacity 455#pragma mapbox: initialize mediump float gapwidth 456#pragma mapbox: initialize lowp float offset 457#pragma mapbox: initialize mediump float width 458float 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; 459#ifdef GLOBE 460v_depth=gl_Position.z/gl_Position.w; 461#endif 462#ifdef TERRAIN3D 463v_gamma_scale=1.0; 464#else 465float 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; 466#endif 467v_width2=vec2(outset,inset);}`),linePattern:ts(`#ifdef GL_ES 468precision highp float; 469#endif 470uniform 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; 471#ifdef GLOBE 472in float v_depth; 473#endif 474#pragma mapbox: define lowp vec4 pattern_from 475#pragma mapbox: define lowp vec4 pattern_to 476#pragma mapbox: define lowp float pixel_ratio_from 477#pragma mapbox: define lowp float pixel_ratio_to 478#pragma mapbox: define lowp float blur 479#pragma mapbox: define lowp float opacity 480void main() { 481#pragma mapbox: initialize mediump vec4 pattern_from 482#pragma mapbox: initialize mediump vec4 pattern_to 483#pragma mapbox: initialize lowp float pixel_ratio_from 484#pragma mapbox: initialize lowp float pixel_ratio_to 485#pragma mapbox: initialize lowp float blur 486#pragma mapbox: initialize lowp float opacity 487vec2 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; 488#ifdef GLOBE 489if (v_depth > 1.0) {discard;} 490#endif 491#ifdef OVERDRAW_INSPECTOR 492fragColor=vec4(1.0); 493#endif 494}`,` 495#define scale 0.015873016 496#define LINE_DISTANCE_SCALE 2.0 497in 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; 498#ifdef GLOBE 499out float v_depth; 500#endif 501#pragma mapbox: define lowp float blur 502#pragma mapbox: define lowp float opacity 503#pragma mapbox: define lowp float offset 504#pragma mapbox: define mediump float gapwidth 505#pragma mapbox: define mediump float width 506#pragma mapbox: define lowp float floorwidth 507#pragma mapbox: define lowp vec4 pattern_from 508#pragma mapbox: define lowp vec4 pattern_to 509#pragma mapbox: define lowp float pixel_ratio_from 510#pragma mapbox: define lowp float pixel_ratio_to 511void main() { 512#pragma mapbox: initialize lowp float blur 513#pragma mapbox: initialize lowp float opacity 514#pragma mapbox: initialize lowp float offset 515#pragma mapbox: initialize mediump float gapwidth 516#pragma mapbox: initialize mediump float width 517#pragma mapbox: initialize lowp float floorwidth 518#pragma mapbox: initialize mediump vec4 pattern_from 519#pragma mapbox: initialize mediump vec4 pattern_to 520#pragma mapbox: initialize lowp float pixel_ratio_from 521#pragma mapbox: initialize lowp float pixel_ratio_to 522float 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);
522float 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; 523#ifdef GLOBE 524v_depth=gl_Position.z/gl_Position.w; 525#endif 526#ifdef TERRAIN3D 527v_gamma_scale=1.0; 528#else 529float 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; 530#endif 531v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:ts(`uniform lowp float u_device_pixel_ratio;uniform lowp float u_lineatlas_width;uniform sampler2D u_image;uniform float u_mix;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale; 532#ifdef GLOBE 533in float v_depth; 534#endif 535#pragma mapbox: define highp vec4 color 536#pragma mapbox: define lowp float blur 537#pragma mapbox: define lowp float opacity 538#pragma mapbox: define mediump float width 539#pragma mapbox: define lowp float floorwidth 540#pragma mapbox: define mediump vec4 dasharray_from 541#pragma mapbox: define mediump vec4 dasharray_to 542void main() { 543#pragma mapbox: initialize highp vec4 color 544#pragma mapbox: initialize lowp float blur 545#pragma mapbox: initialize lowp float opacity 546#pragma mapbox: initialize mediump float width 547#pragma mapbox: initialize lowp float floorwidth 548#pragma mapbox: initialize mediump vec4 dasharray_from 549#pragma mapbox: initialize mediump vec4 dasharray_to 550float 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);
550float sdfgamma=(u_lineatlas_width/256.0/u_device_pixel_ratio)/min(dasharray_from.w,dasharray_to.w);alpha*=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*opacity); 551#ifdef GLOBE 552if (v_depth > 1.0) {discard;} 553#endif 554#ifdef OVERDRAW_INSPECTOR 555fragColor=vec4(1.0); 556#endif 557}`,` 558#define scale 0.015873016 559#define LINE_DISTANCE_SCALE 2.0 560in vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;out vec2 v_width2;out vec2 v_tex_a;out vec2 v_tex_b;out float v_gamma_scale; 561#ifdef GLOBE 562out float v_depth; 563#endif 564#pragma mapbox: define highp vec4 color 565#pragma mapbox: define lowp float blur 566#pragma mapbox: define lowp float opacity 567#pragma mapbox: define mediump float gapwidth 568#pragma mapbox: define lowp float offset 569#pragma mapbox: define mediump float width 570#pragma mapbox: define lowp float floorwidth 571#pragma mapbox: define mediump vec4 dasharray_from 572#pragma mapbox: define mediump vec4 dasharray_to 573void main() { 574#pragma mapbox: initialize highp vec4 color 575#pragma mapbox: initialize lowp float blur 576#pragma mapbox: initialize lowp float opacity 577#pragma mapbox: initialize mediump float gapwidth 578#pragma mapbox: initialize lowp float offset 579#pragma mapbox: initialize mediump float width 580#pragma mapbox: initialize lowp float floorwidth 581#pragma mapbox: initialize mediump vec4 dasharray_from 582#pragma mapbox: initialize mediump vec4 dasharray_to 583float 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; 584#ifdef GLOBE 585v_depth=gl_Position.z/gl_Position.w; 586#endif 587#ifdef TERRAIN3D 588v_gamma_scale=1.0; 589#else 590float 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; 591#endif 592float u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}`),lineGradientSDF:ts(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform sampler2D u_image_dash;uniform float u_mix;uniform lowp float u_lineatlas_width;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;in highp vec2 v_uv; 593#ifdef GLOBE 594in float v_depth; 595#endif 596#pragma mapbox: define lowp float blur 597#pragma mapbox: define lowp float opacity 598#pragma mapbox: define mediump float width 599#pragma mapbox: define lowp float floorwidth 600#pragma mapbox: define mediump vec4 dasharray_from 601#pragma mapbox: define mediump vec4 dasharray_to 602void main() { 603#pragma mapbox: initialize lowp float blur 604#pragma mapbox: initialize lowp float opacity 605#pragma mapbox: initialize mediump float width 606#pragma mapbox: initialize lowp float floorwidth 607#pragma mapbox: initialize mediump vec4 dasharray_from 608#pragma mapbox: initialize mediump vec4 dasharray_to 609float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture(u_image,v_uv);float sdfdist_a=texture(u_image_dash,v_tex_a).a;float sdfdist_b=texture(u_image_dash,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);
609float sdfgamma=(u_lineatlas_width/256.0)/min(dasharray_from.w,dasharray_to.w);float dash_alpha=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*dash_alpha*opacity); 610#ifdef GLOBE 611if (v_depth > 1.0) {discard;} 612#endif 613#ifdef OVERDRAW_INSPECTOR 614fragColor=vec4(1.0); 615#endif 616}`,` 617#define scale 0.015873016 618#define LINE_DISTANCE_SCALE 2.0 619in vec2 a_pos_normal;in vec4 a_data;in float a_uv_x;in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;out vec2 v_tex_a;out vec2 v_tex_b; 620#ifdef GLOBE 621out float v_depth; 622#endif 623#pragma mapbox: define lowp float blur 624#pragma mapbox: define lowp float opacity 625#pragma mapbox: define mediump float gapwidth 626#pragma mapbox: define lowp float offset 627#pragma mapbox: define mediump float width 628#pragma mapbox: define lowp float floorwidth 629#pragma mapbox: define mediump vec4 dasharray_from 630#pragma mapbox: define mediump vec4 dasharray_to 631void main() { 632#pragma mapbox: initialize lowp float blur 633#pragma mapbox: initialize lowp float opacity 634#pragma mapbox: initialize mediump float gapwidth 635#pragma mapbox: initialize lowp float offset 636#pragma mapbox: initialize mediump float width 637#pragma mapbox: initialize lowp float floorwidth 638#pragma mapbox: initialize mediump vec4 dasharray_from 639#pragma mapbox: initialize mediump vec4 dasharray_to 640float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;float texel_height=1.0/u_image_height;float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude; 641#ifdef GLOBE 642v_depth=gl_Position.z/gl_Position.w; 643#endif 644#ifdef TERRAIN3D 645v_gamma_scale=1.0; 646#else 647float 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; 648#endif 649float u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}`),raster:ts(`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); 650#ifdef OVERDRAW_INSPECTOR 651fragColor=vec4(1.0); 652#endif 653}`,`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; 654#ifdef GLOBE 655if (a_pos.y <-32767.5) {v_pos0.y=0.0;}if (a_pos.y > 32766.5) {v_pos0.y=1.0;} 656#endif 657v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}`),symbolIcon:ts(`uniform sampler2D u_texture;in vec2 v_tex;in float v_total_opacity;void main() {fragColor=texture(u_texture,v_tex)*v_total_opacity; 658#ifdef OVERDRAW_INSPECTOR 659fragColor=vec4(1.0); 660#endif 661}`,`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_total_opacity; 662#pragma mapbox: define lowp float opacity 663void main() { 664#pragma mapbox: initialize lowp float opacity 665vec2 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);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_total_opacity=opacity*max(0.0,min(visibility,fade_opacity[0]+fade_change));if (v_total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? 666camera_to_anchor_distance/u_camera_to_center_distance : 667u_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; 668#ifdef GLOBE 669if(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);} 670#endif 671vec4 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;}`),symbolSDF:ts(`#define SDF_PX 8.0 672uniform bool u_is_halo;uniform bool u_is_plain;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; 673#pragma mapbox: define highp vec4 fill_color 674#pragma mapbox: define highp vec4 halo_color 675#pragma mapbox: define lowp float halo_width 676#pragma mapbox: define lowp float halo_blur 677void main() { 678#pragma mapbox: initialize highp vec4 fill_color 679#pragma mapbox: initialize highp vec4 halo_color 680#pragma mapbox: initialize lowp float halo_width 681#pragma mapbox: initialize lowp float halo_blur 682float 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 total_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;lowp float dist=texture(u_texture,tex).a;lowp vec4 color_alpha_out_text,color_alpha_out_halo;if (u_is_plain){highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);color_alpha_out_text=total_opacity*alpha*fill_color;}if (u_is_halo) {float gamma_halo=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);float inner_edge_halo=inner_edge+gamma_halo*gamma_scale;highp float gamma_scaled_halo=gamma_halo*gamma_scale;highp float alpha_halo=smoothstep(inner_edge_halo-gamma_scaled_halo,inner_edge_halo+gamma_scaled_halo,dist);highp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha_halo= min(smoothstep(halo_edge-gamma_scaled_halo,halo_edge+gamma_scaled_halo,dist),1.0-alpha_halo);color_alpha_out_halo=total_opacity*alpha_halo*halo_color;}if (u_is_plain && u_is_halo) {fragColor=color_alpha_out_text+(1.-color_alpha_out_text.a)*color_alpha_out_halo;} else if (u_is_halo){fragColor=color_alpha_out_halo;} else {fragColor=color_alpha_out_text;} 683#ifdef OVERDRAW_INSPECTOR 684fragColor=vec4(1.0); 685#endif 686}`,`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; 687#pragma mapbox: define highp vec4 fill_color 688#pragma mapbox: define highp vec4 halo_color 689#pragma mapbox: define lowp float opacity 690#pragma mapbox: define lowp float halo_width 691#pragma mapbox: define lowp float halo_blur 692void main() { 693#pragma mapbox: initialize highp vec4 fill_color 694#pragma mapbox: initialize highp vec4 halo_color 695#pragma mapbox: initialize lowp float opacity 696#pragma mapbox: initialize lowp float halo_width 697#pragma mapbox: initialize lowp float halo_blur 698vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy/16.0;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);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));float total_opacity=opacity*interpolated_fade_opacity;if (total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? 699camera_to_anchor_distance/u_camera_to_center_distance : 700u_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; 701#ifdef GLOBE 702if(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);} 703#endif 704vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,total_opacity);}`),symbolTextAndIcon:ts(`#define SDF_PX 8.0 705#define SDF 1.0 706#define ICON 0.0 707uniform bool u_is_halo;uniform bool u_is_text;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; 708#pragma mapbox: define highp vec4 fill_color 709#pragma mapbox: define highp vec4 halo_color 710#pragma mapbox: define lowp float halo_width 711#pragma mapbox: define lowp float halo_blur 712void main() { 713#pragma mapbox: initialize highp vec4 fill_color 714#pragma mapbox: initialize highp vec4 halo_color 715#pragma mapbox: initialize lowp float halo_width 716#pragma mapbox: initialize lowp float halo_blur 717float total_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;
717fragColor=texture(u_texture_icon,tex_icon)*total_opacity; 718#ifdef OVERDRAW_INSPECTOR 719fragColor=vec4(1.0); 720#endif 721return;}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;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;lowp float dist=texture(u_texture,tex).a;lowp vec4 color_alpha_out,color_alpha_out_halo;if (u_is_text) {highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);color_alpha_out=fill_color*(alpha*total_opacity);}if (u_is_halo) {highp float gamma_halo=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);lowp float buff_halo=(6.0-halo_width/fontScale)/SDF_PX;highp float gamma_scaled_halo=gamma_halo*gamma_scale;highp float alpha_halo=smoothstep(buff_halo-gamma_scaled_halo,buff_halo+gamma_scaled_halo,dist);color_alpha_out_halo=halo_color*(alpha_halo*total_opacity);}if (u_is_text && u_is_halo) {fragColor=color_alpha_out+(1.-color_alpha_out.a)*color_alpha_out_halo;} else if (u_is_halo) {fragColor=color_alpha_out_halo;} else {fragColor=color_alpha_out;} 722#ifdef OVERDRAW_INSPECTOR 723fragColor=vec4(1.0); 724#endif 725}`,`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; 726#pragma mapbox: define highp vec4 fill_color 727#pragma mapbox: define highp vec4 halo_color 728#pragma mapbox: define lowp float opacity 729#pragma mapbox: define lowp float halo_width 730#pragma mapbox: define lowp float halo_blur 731void main() { 732#pragma mapbox: initialize highp vec4 fill_color 733#pragma mapbox: initialize highp vec4 halo_color 734#pragma mapbox: initialize lowp float opacity 735#pragma mapbox: initialize lowp float halo_width 736#pragma mapbox: initialize lowp float halo_blur 737vec2 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);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));float total_opacity=opacity*interpolated_fade_opacity;if (total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? 738camera_to_anchor_distance/u_camera_to_center_distance : 739u_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; 740#ifdef GLOBE 741if(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);} 742#endif 743vec4 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;v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,total_opacity,is_sdf);}`),terrain:ts("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 && u_fog_ground_blend_opacity > 0.0 && 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);
743float 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,ele-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:ts("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:ts("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:ts("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:ts(`#ifdef GL_ES 744precision highp float; 745#endif 746in 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 747);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:ts("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);}")};
747function ts(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?` 748#ifndef HAS_UNIFORM_u_${a} 749in ${i} ${r} ${a}; 750#else 751uniform ${i} ${r} u_${a}; 752#endif 753`:` 754#ifdef HAS_UNIFORM_u_${a} 755 ${i} ${r} ${a} = u_${a}; 756#endif 757`)),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?` 758#ifndef HAS_UNIFORM_u_${a} 759uniform lowp float u_${a}_t; 760in ${i} ${n} a_${a}; 761out ${i} ${r} ${a}; 762#else 763uniform ${i} ${r} u_${a}; 764#endif 765`:"vec4"===s?` 766#ifndef HAS_UNIFORM_u_${a} 767 ${a} = a_${a}; 768#else 769 ${i} ${r} ${a} = u_${a}; 770#endif 771`:` 772#ifndef HAS_UNIFORM_u_${a} 773 ${a} = unpack_mix_${s}(a_${a}, u_${a}_t); 774#else 775 ${i} ${r} ${a} = u_${a}; 776#endif 777`:"define"===t?` 778#ifndef HAS_UNIFORM_u_${a} 779uniform lowp float u_${a}_t; 780in ${i} ${n} a_${a}; 781#else 782uniform ${i} ${r} u_${a}; 783#endif 784`:"vec4"===s?` 785#ifndef HAS_UNIFORM_u_${a} 786 ${i} ${r} ${a} = a_${a}; 787#else 788 ${i} ${r} ${a} = u_${a}; 789#endif 790`:` 791#ifndef HAS_UNIFORM_u_${a} 792 ${i} ${r} ${a} = unpack_mix_${s}(a_${a}, u_${a}_t); 793#else 794 ${i} ${r} ${a} = u_${a}; 795#endif 796`}),staticAttributes:r,staticUniforms:s}}class to{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 tl=t.aS([{name:"a_pos",type:"Int16",components:2}]);let th="#define PROJECTION_MERCATOR",tu="mercator";class tc{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return!1}get shaderVariantName(){return tu}get shaderDefine(){return th}get shaderPreludeCode(){return tn.projectionMercator}get vertexShaderPreludeCode(){return tn.projectionMercator.vertexSource}get subdivisionGranularity(){return t.aT.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.aU;s.emplaceBack(0,0),s.emplaceBack(t.a6,0),s.emplaceBack(0,t.a6),s.emplaceBack(t.a6,t.a6);let o=e.createVertexBuffer(s,tl.members),l=t.aV.simpleSegment(0,0,4,2),h=new t.aW;h.emplaceBack(1,0,2),h.emplaceBack(1,2,3);let u=e.createIndexBuffer(h);return this._cachedMesh=new to(o,u,l),this._cachedMesh}recalculate(){}hasTransition(){return!1}setErrorQueryLatitudeDegrees(e){}}class td{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.H.number(e.top,i.top,r)),null!=i.bottom&&null!=e.bottom&&(this.bottom=t.H.number(e.bottom,i.bottom,r)),null!=i.left&&null!=e.left&&(this.left=t.H.number(e.left,i.left,r)),null!=i.right&&null!=e.right&&(this.right=t.H.number(e.right,i.right,r)),this}getCenter(e,i){let r=t.al((this.left+e-this.right)/2,0,e),a=t.al((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 td(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function tp(e,t){if(!e.renderWorldCopies||e.lngRange)return;let i=t.lng-e.center.lng;t.lng+=i>180?-360:360*(i<-180)}function tf(e){return Math.max(0,Math.floor(e))}class tm{constructor(e,i){var r;this.applyConstrain=(e,t)=>null!==this._constrainOverride?this._constrainOverride(e,t):this._callbacks.defaultConstrain(e,t),this._callbacks=e,this._tileSize=512,this._renderWorldCopies=(null==i?void 0:i.renderWorldCopies)===void 0||!!(null!=i&&i.renderWorldCopies),this._minZoom=(null==i?void 0:i.minZoom)||0,this._maxZoom=(null==i?void 0:i.maxZoom)||22,this._minPitch=(null==i?void 0:i.minPitch)==null?0:null==i?void 0:i.minPitch,this._maxPitch=(null==i?void 0:i.maxPitch)==null?60:null==i?void 0:i.maxPitch,this._constrainOverride=null!=(r=null==i?void 0:i.constrainOverride)?r:null,this.setMaxBounds(),this._width=0,this._height=0,this._center=new t.W(0,0),this._elevation=0,this._zoom=0,this._tileZoom=tf(this._zoom),this._scale=t.ao(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new td,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=!0}apply(e,i,r){this._constrainOverride=e.constrainOverride,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=tf(this._zoom),this._scale=t.ao(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 td(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.constrainInternal(),this._calcMatrices()}
796get 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.applyConstrain(this._center,this.zoom).zoom))}get maxZoom(){return this._maxZoom}setMaxZoom(e){this._maxZoom!==e&&(this._maxZoom=e,this.setZoom(this.applyConstrain(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 constrainOverride(){return this._constrainOverride}setConstrainOverride(e){void 0===e&&(e=null),this._constrainOverride!==e&&(this._constrainOverride=e,this.constrainInternal(),this._calcMatrices())}get worldSize(){return this._tileSize*this._scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new 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 c=t.X(e,-180,180)*Math.PI/180;this._bearingInRadians!==c&&(this._unmodified=!1,this._bearingInRadians=c,this._calcMatrices(),this._rotationMatrix=y(),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.al(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.aX(this._fovInRadians)}setFov(e){e=t.al(e,.1,150),this.fov!==e&&(this._unmodified=!1,this._fovInRadians=t.an(e),this._calcMatrices())}get zoom(){return this._zoom}setZoom(e){let i=this.applyConstrain(this._center,e).zoom;this._zoom!==i&&(this._unmodified=!1,this._zoom=i,this._tileZoom=Math.max(0,Math.floor(i)),this._scale=t.ao(i),this.constrainInternal(),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.constrainInternal(),this._calcMatrices())}get elevation(){return this._elevation}setElevation(e){e!==this._elevation&&(this._elevation=e,this.constrainInternal(),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.constrainInternal(),this._calcMatrices()}resize(e,t,i=!0){this._width=e,this._height=t,i&&this.constrainInternal(),this._calcMatrices()}getMaxBounds(){var e,t;return(null==(e=this._latRange)?void 0:e.length)!==2||(null==(t=this._lngRange)?void 0:t.length)!==2?null:new q([this._lngRange[0],this._latRange[0]],[this._lngRange[1],this._latRange[1]])}setMaxBounds(e){e?(this._lngRange=[e.getWest(),e.getEast()],this._latRange=[e.getSouth(),e.getNorth()],this.constrainInternal()):(this._lngRange=null,this._latRange=[-t.am,t.am])}getCameraQueryGeometry(e,i){if(1===i.length)return[i[0],e];{let{minX:r,minY:a,maxX:n,maxY:s}=t.a8.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)]}}constrainInternal(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=!0;let e=this._unmodified,{center:t,zoom:i}=this.applyConstrain(this.center,this.zoom);this.setCenter(t),this.setZoom(i),this._unmodified=e,this._constraining=!1}
796_calcMatrices(){if(this._width&&this._height){this._pixelsToGLUnits=[2/this._width,-2/this._height];let e=t.ap(new Float64Array(16));t.S(e,e,[this._width/2,-this._height/2,1]),t.Q(e,e,[1,-1,0]),this._clipSpaceToPixelsMatrix=e,e=t.ap(new Float64Array(16)),t.S(e,e,[1,-1,1]),t.Q(e,e,[-1,-1,0]),t.S(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=void 0!==r?r:this.bearing,s=a=void 0!==a?a:this.pitch,{distanceToCenter:o,clampedElevation:l}=this._distanceToCenterFromAltElevationPitch(i,this.elevation,s),{x:h,y:u}=ey(s,n),c=t.a7.fromLngLat(e,i),p,f,m=t.aY(1,c.y),_=0;do{if((_+=1)>10)break;f=o/m,m=1/(p=new t.a7(c.x+h*f,c.y+u*f)).meterInMercatorCoordinateUnits()}while(Math.abs(o-f*m)>1e-12);return{center:p.toLngLat(),elevation:l,zoom:t.ar(this.height/2/Math.tan(this.fovInRadians/2)/f/this.tileSize)}}recalculateZoomAndCenter(e){if(this.elevation-e==0)return;let i=1/this.worldSize,r=t.aq(1,this.center.lat)*this.worldSize,a=t.a7.fromLngLat(this.center,this.elevation),n=a.x/i,s=a.y/i,o=a.z/i,l=this.pitch,{x:h,y:u,z:c}=ey(l,this.bearing),p=this.cameraToCenterDistance,{distanceToCenter:f,clampedElevation:m}=this._distanceToCenterFromAltElevationPitch((o+p*c)/r,e,l),_=f*r,g=new t.a7((n+-(p*h)+h*_)*i,(s+-(p*u)+u*_)*i,0).toLngLat(),y=t.aq(1,g.lat),x=t.ar(this.height/2/Math.tan(this.fovInRadians/2)/f/y/this.tileSize);this._elevation=m,this._center=g,this.setZoom(x)}_distanceToCenterFromAltElevationPitch(e,i,r){let a=-Math.cos(t.an(r)),n=e-i,s,o=i;return a*n>=0||.1>Math.abs(a)?o=e+(s=1e4)*a:s=-n/a,{distanceToCenter:s,clampedElevation:o}}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.aq(1,this.center.lat)*this.worldSize;return eg(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.a6,1/i/t.a6]}}class t_{constructor(e,i){this.min=e,this.max=i,this.center=t.aZ([],t.a_([],this.min,this.max),.5)}quadrant(e){let i=[e%2==0,e<2],r=t.a$(this.min),a=t.a$(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 t_(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 of e.planes){let e=this.intersectsPlane(i);if(0===e)return 0;1===e&&(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 tg{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&&a.terrain){let h=new t.a3(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 t_([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.al(78.5-r/2,0,60);return!!i.terrain||e.pitch>a}allowWorldCopies(){return!0}prepareNextFrame(){}}class ty{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=>(function(e,i,r,a){let n=t.aE([],e,i),s=1/n[3]/r*a;return t.b4(n,n,[s,s,1/n[3],s])})(r,e,i,o));a&&function(e,i,r,a){let n=4*!!a,s=4*!a,o=0,l=[],h=[];for(let i=0;i<4;i++){let r=t.b0([],e[i+s],e[i+n]),a=t.b5(r);t.aZ(r,r,1/a),l.push(a),h.push(r)}for(let i=0;i<4;i++){let a=t.b6(e[i+n],h[i],r);o=null!==a&&a>=0?Math.max(o,a):Math.max(o,l[i])}let u=function(e,i){let r=t.b0([],e[i[0]],e[i[1]]),a=t.b0([],e[i[2]],e[i[1]]),n=[0,0,0,0];return t.b1(n,t.b2([],r,a)),n[3]=-t.b3(n,e[i[0]]),n}(e,i),c=function(e,i){let r=t.b7(e),a=t.b8([],e,1/r),n=t.b0([],i,t.aZ([],a,t.b3(i,a))),s=t.b7(n);if(s>0){let e=Math.sqrt(1-a[3]*a[3]),r=t.aZ([],a,-a[3]),o=t.a_([],r,t.aZ([],n,e/s));return t.b9(i,o)}return null}(r,u);null!==c&&(o=Math.min(o,c/t.b3(h[0],u)));for(let t=0;t<4;t++){let i=Math.min(o,l[t]);e[t+s]=[e[t+n][0]+h[t][0]*i,e[t+n][1]+h[t][1]*i,e[t+n][2]+h[t][2]*i,1]}}(l,s[0],a,n);let h=s.map(e=>{let i=t.b0([],l[e[0]],l[e[1]]),r=t.b0([],l[e[2]],l[e[1]]),a=t.b1([],t.b2([],i,r)),n=-t.b3(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 ty(l,h,new t_(u,c))}}
796class tx{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){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)}setConstrainOverride(e){this._helper.setConstrainOverride(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 constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(e,t){}constructor(e){this._posMatrixCache=new Map,this._alignedPosMatrixCache=new Map,this._fogMatrixCacheF32=new Map,this.defaultConstrain=(e,i)=>{let r,a;i=t.al(+i,this.minZoom,this.maxZoom);let n={center:new t.W(e.lng,e.lat),zoom:i},s=this._helper._lngRange;this._helper._renderWorldCopies||null!==s||(s=[-179.9999999999,179.9999999999]);let o=this.tileSize*t.ao(n.zoom),l=0,h=o,u=0,c=o,p=0,f=0,{x:m,y:_}=this.size;if(this._helper._latRange){let e=this._helper._latRange;l=t.Y(e[1])*o,(h=t.Y(e[0])*o)-l<_&&(p=_/(h-l))}s&&(u=t.X(t.Z(s[0])*o,0,o),(c=t.X(t.Z(s[1])*o,0,o))<u&&(c+=o),c-u<m&&(f=m/(c-u)));let{x:g,y:y}=ep(o,e),x=Math.max(f||0,p||0);if(x)return n.center=ef(o,new t.P(f?(c+u)/2:g,p?(h+l)/2:y)).wrap(),n.zoom+=t.ar(x),n;if(this._helper._latRange){let e=_/2;y-e<l&&(a=l+e),y+e>h&&(a=h-e)}if(s){let e=(u+c)/2,i=g;
796this._helper._renderWorldCopies&&(i=t.X(g,e-o/2,e+o/2));let a=m/2;i-a<u&&(r=u+a),i+a>c&&(r=c-a)}return(void 0!==r||void 0!==a)&&(n.center=ef(o,new t.P(r??g,a??y)).wrap()),n},this.applyConstrain=(e,t)=>this._helper.applyConstrain(e,t),this._helper=new tm({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(e,t)=>this.defaultConstrain(e,t)},e),this._coveringTilesDetailsProvider=new tg}clone(){let e=new tx;return e.apply(this,!1),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.ba(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.ba(r,e))}return i}getCameraFrustum(){return ty.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.aq(this.elevation,this.center.lat),a=this.screenPointToMercatorCoordinateAtZ(i,r),n=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,r),s=t.a7.fromLngLat(e),o=new t.a7(s.x-(a.x-n.x),s.y-(a.y-n.y));this.setCenter(null==o?void 0:o.toLngLat()),this._helper._renderWorldCopies&&this.setCenter(this.center.wrap())}locationToScreenPoint(e,i){return i?this.coordinatePoint(t.a7.fromLngLat(e),i.getElevationForLngLat(e,this),this._pixelMatrix3D):this.coordinatePoint(t.a7.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.aE(a,a,this._pixelMatrixInverse),t.aE(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,p=u===c?0:(r-u)/(c-u);return new t.a7(t.H.number(a[0]/s,n[0]/o,p)/this.worldSize,t.H.number(l,h,p)/this.worldSize,r)}coordinatePoint(e,i=0,r=this._pixelMatrix){let a=[e.x*this.worldSize,e.y*this.worldSize,i,1];return t.aE(a,a,r),new t.P(a[0]/a[3],a[1]/a[3])}getBounds(){let e=Math.max(0,this._helper._height/2-em(this));return new q().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-em(this)}calculatePosMatrix(e,i=!1,r){var a;let n=null!=(a=e.key)?a:t.bb(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=e_(e,this.worldSize);t.U(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=e_(e,this.worldSize);return t.U(a,this._fogMatrix,a),r.set(i,new Float32Array(a)),r.get(i)}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.an(this.fov)*(Math.abs(Math.cos(t.an(this.roll)))*this.height+Math.abs(Math.sin(t.an(this.roll)))*this.width)/this.height*(.5+r.y/this.height),h=Math.sin(l)*s/Math.sin(t.al(Math.PI-o-l,.01,Math.PI-.01)),u=em(this),c=Math.atan(u/this._helper.cameraToCenterDistance),p=t.an(.75),f=c>p?2*c*(.5+r.y/(2*u)):p,m=Math.min(h,Math.sin(f)*s/Math.sin(t.al(Math.PI-o-f,.01,Math.PI-.01)));this._helper._farZ=1.01*(Math.cos(Math.PI/2-i)*m+s),this._helper._nearZ=this._helper._height/50}_calcMatrices(){var e,i;let r;if(!this._helper._height)return;let a=this.centerOffset,n=ep(this.worldSize,this.center),s=n.x,o=n.y;this._helper._pixelPerMeter=t.aq(1,this.center.lat)*this.worldSize;let l=t.an(Math.min(this.pitch,89.25)),h=Math.max(this._helper.cameraToCenterDistance/2,this._helper.cameraToCenterDistance+this._helper._elevation*this._helper._pixelPerMeter/Math.cos(l));this._calculateNearFarZIfNeeded(h,l,a),r=new Float64Array(16),t.bc(r,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),(e=this._invProjMatrix)[0]=1/(i=r)[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1/i[5],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10
796]=0,e[11]=1/i[14],e[12]=0,e[13]=0,e[14]=-1,e[15]=i[10]/i[14],r[8]=-(2*a.x)/this._helper._width,r[9]=2*a.y/this._helper._height,this._projectionMatrix=t.bd(r),t.S(r,r,[1,-1,1]),t.Q(r,r,[0,0,-this._helper.cameraToCenterDistance]),t.be(r,r,-this.rollInRadians),t.bf(r,r,this.pitchInRadians),t.be(r,r,-this.bearingInRadians),t.Q(r,r,[-s,-o,0]),this._mercatorMatrix=t.S([],r,[this.worldSize,this.worldSize,this.worldSize]),t.S(r,r,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=t.U(new Float64Array(16),this.clipSpaceToPixelsMatrix,r),t.Q(r,r,[0,0,-this.elevation]),this._viewProjMatrix=r,this._invViewProjMatrix=t.bg([],r);let u=[0,0,-1,1];t.aE(u,u,this._invViewProjMatrix),this._cameraPosition=[u[0]/u[3],u[1]/u[3],u[2]/u[3]],this._fogMatrix=new Float64Array(16),t.bc(this._fogMatrix,this.fovInRadians,this.width/this.height,h,this._helper._farZ),this._fogMatrix[8]=-(2*a.x)/this.width,this._fogMatrix[9]=2*a.y/this.height,t.S(this._fogMatrix,this._fogMatrix,[1,-1,1]),t.Q(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),t.be(this._fogMatrix,this._fogMatrix,-this.rollInRadians),t.bf(this._fogMatrix,this._fogMatrix,this.pitchInRadians),t.be(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),t.Q(this._fogMatrix,this._fogMatrix,[-s,-o,0]),t.S(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),t.Q(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=t.U(new Float64Array(16),this.clipSpaceToPixelsMatrix,r);let c=this._helper._width%2/2,p=this._helper._height%2/2,f=Math.cos(this.bearingInRadians),m=Math.sin(-this.bearingInRadians),_=s-Math.round(s)+f*c+m*p,g=o-Math.round(o)+f*p+m*c,y=new Float64Array(r);if(t.Q(y,y,[_>.5?_-1:_,g>.5?g-1:g,0]),this._alignedProjMatrix=y,!(r=t.bg(new Float64Array(16),this._pixelMatrix)))throw Error("failed to invert matrix");this._pixelMatrixInverse=r,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.aE(i,i,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){let e=t.aq(1,this.center.lat)*this.worldSize;return eg(this.center,this.elevation,this.pitch,this.bearing,this._helper.cameraToCenterDistance/e).toLngLat()}lngLatToCameraDepth(e,i){let r=t.a7.fromLngLat(e),a=[r.x*this.worldSize,r.y*this.worldSize,i,1];return t.aE(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=null!=r&&r.terrainRttPosMatrix32f&&n?r.terrainRttPosMatrix32f:o||t.bh(),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.a$(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.aE(n,n,s)):eX(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.a7.fromLngLat(e,i),a=r.meterInMercatorCoordinateUnits(),n=t.bi();return t.Q(n,n,[r.x,r.y,r.z]),t.be(n,n,Math.PI),t.bf(n,n,Math.PI/2),t.S(n,n,[-a,a,a]),n}getProjectionDataForCustomLayer(e=!0){let i=new t.a3(0,0,0,0,0),r=this.getProjectionData({overscaledTileID:i,applyGlobeMatrix:e}),a=e_(i,this.worldSize);t.U(a,this._viewProjMatrix,a),r.tileMercatorCoords=[0,0,1,1];let n=[t.a6,t.a6,this.worldSize/this._helper.pixelsPerMeter],s=t.bj();return t.S(s,a,n),r.fallbackMatrix=s,r.mainMatrix=s,r}getFastPathSimpleProjectionMatrix(e){return this.calculatePosMatrix(e)}}function tv(){t.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}function tb(e){if(e.useSlerp)if(e.k<1){let i=t.bk(e.startEulerAngles.roll,e.startEulerAngles.pitch,e.startEulerAngles.bearing),r=t.bk(e.endEulerAngles.roll,e.endEulerAngles.pitch,e.endEulerAngles.bearing),a=new Float64Array(4);t.bl(a,i,r,e.k);let n=t.bm(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.H.number(e.startEulerAngles.roll,e.endEulerAngles.roll,e.k)),e.tr.setPitch(t.H.number(e.startEulerAngles.pitch,e.endEulerAngles.pitch,e.k)),e.tr.setBearing(t.H.number(e.startEulerAngles.bearing,e.endEulerAngles.bearing,e.k))}function tw(e,i,r,a,n){let s=n.padding,o=ep(n.worldSize,r.getNorthWest()),l=ep(n.worldSize,r.getNorthEast()),h=ep(n.worldSize,r.getSouthEast()),u=ep(n.worldSize,r.getSouthWest
796()),c=t.an(-a),p=o.rotate(c),f=l.rotate(c),m=h.rotate(c),_=u.rotate(c),g=new t.P(Math.max(p.x,f.x,_.x,m.x),Math.max(p.y,f.y,_.y,m.y)),y=new t.P(Math.min(p.x,f.x,_.x,m.x),Math.min(p.y,f.y,_.y,m.y)),x=g.sub(y),v=(n.width-(s.left+s.right+i.left+i.right))/x.x,b=(n.height-(s.top+s.bottom+i.top+i.bottom))/x.y;if(b<0||v<0)return void tv();let w=Math.min(t.ar(n.scale*Math.min(v,b)),e.maxZoom),T=t.P.convert(e.offset),S=new t.P((i.left-i.right)/2,(i.top-i.bottom)/2).rotate(t.an(a)),P=T.add(S).mult(n.scale/t.ao(w));return{center:ef(n.worldSize,o.add(h).div(2).sub(P)),zoom:w,bearing:a}}class tT{get useGlobeControls(){return!1}handlePanInertia(e,t){let i=e.mag(),r=Math.abs(em(t));return{easingOffset:e.mult(Math.min(.75*r/i,1)),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 tw(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.W.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),p=e.screenPointToLocation(c),{center:f,zoom:m}=e.applyConstrain(t.W.convert(i.center||p),u??r);tp(e,f);let _=ep(e.worldSize,p),g=ep(e.worldSize,f).sub(_),y=t.ao(m-r);return{easeFunc:o=>{if(h&&e.setZoom(t.H.number(r,m,o)),t.bn(n,s)||tb({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.ao(e.zoom-r),a=Math.pow(m>r?Math.min(2,y):Math.max(.5,y),1-o),n=ef(e.worldSize,_.add(g.mult(o*a)).mult(i));e.setLocationAtPoint(e.renderWorldCopies?n.wrap():n,c)}},isZooming:h=m!==r,elevationCenter:f}}handleFlyTo(e,i){let r,a=void 0!==i.zoom,n=e.zoom,s=e.applyConstrain(t.W.convert(i.center||i.locationAtOffset),a?+i.zoom:n),o=s.center,l=s.zoom;tp(e,o);let h=ep(e.worldSize,i.locationAtOffset),u=ep(e.worldSize,o).sub(h),c=u.mag(),p=t.ao(l-n);if(void 0!==i.minZoom){let a=Math.min(+i.minZoom,n,l),s=e.applyConstrain(o,a).zoom;r=t.ao(s-n)}return{easeFunc:(i,r,a,s)=>{e.setZoom(1===i?l:n+t.ar(r));let c=1===i?o:ef(e.worldSize,h.add(u.mult(a)).mult(r));e.setLocationAtPoint(e.renderWorldCopies?c.wrap():c,s)},scaleOfZoom:p,targetCenter:o,scaleOfMinZoom:r,pixelPathLength:c}}}class tS{constructor(e,t,i){this.blendFunction=e,this.blendColor=t,this.mask=i}}tS.Replace=[1,0],tS.disabled=new tS(tS.Replace,t.bo.transparent,[!1,!1,!1,!1]),tS.unblended=new tS(tS.Replace,t.bo.transparent,[!0,!0,!0,!0]),tS.alphaBlended=new tS([1,771],t.bo.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 tM{constructor(e,t,i){this.func=e,this.mask=t,this.range=i}}tM.ReadOnly=!1,tM.ReadWrite=!0,tM.disabled=new tM(519,tM.ReadOnly,[0,1]);class tI{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}}function tE(e){return"u">typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext}tI.disabled=new tI({func:519,mask:0},0,0,7680,7680,7680);class tC{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;let i=e.context,r=i.gl;this._texFormat=r.RGBA,this._texType=r.UNSIGNED_BYTE;let a=new t.aU;a.emplaceBack(-1,-1),a.emplaceBack(2,-1),a.emplaceBack(-1,2);let n=new t.aW;n.emplaceBack(0,1,2),this._fullscreenTriangle=new to(i.createVertexBuffer(a,tl.members),i.createIndexBuffer(n),t.aV.simpleSegment(0,0,a.length,n.length)),this._resultBuffer=new Uint8Array(4),i.activeTexture.set(r.TEXTURE1);let 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),tE(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.bo.transparent}),this._cachedRenderContext.useProgram("projectionErrorMeasurement").draw(r,a.TRIANGLES,tM.disabled,tI.disabled,tS.unblended,tP.disabled,{u_input:e,u_output_expected:i},null,null,"$clipping",this._fullscreenTriangle.vertexBuffer,this._fullscreenTriangle.indexBuffer,this._fullscreenTriangle.segments),this._pbo&&tE(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&&tE(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=tC._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 tA=t.a6/128;function tD(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),p=a*n*6,f=s*o>65536;if(f&&"16bit"===i)throw Error("Granularity is too large and meshes would not fit inside 16 bit vertex indices.");let m=f||"32bit"===i,_=new Int16Array(s*o*2),g=0;for(let i=h;i<=c;i++)for(let a=l;a<=u;a++){let n=a/r*t.a6;-1===a&&(n=-tA),a===r+1&&(n=t.a6+tA);let s=i/r*t.a6;-1===i&&(s=e.extendToNorthPole?t.bq:-tA),i===r+1&&(s=e.extendToSouthPole?t.br:t.a6+tA),_[g++]=n,_[g++]=s}let y=m?new Uint32Array(p):new Uint16Array(p),x=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;y[x++]=t+e*s,y[x++]=r,y[x++]=i,y[x++]=i,y[x++]=r,y[x++]=a}return{vertices:_.buffer.slice(0),indices:y.buffer.slice(0),uses32bitIndices:m}}let tz=new t.aT({fill:new t.bs(128,2),line:new t.bs(512,0),tile:new t.bs(128,32),stencil:new t.bs(128,1),circle:3});class tk{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 tn.projectionGlobe}get vertexShaderPreludeCode(){return tn.projectionMercator.vertexSource}get subdivisionGranularity(){return tz}get useGlobeControls(){return!0}get latitudeErrorCorrectionRadians(){return this._errorCorrectionUsable}destroy(){this._errorMeasurement&&this._errorMeasurement.destroy()}updateGPUdependent(e){this._errorMeasurement||(this._errorMeasurement=new tC(e));let i=t.Y(this._errorQueryLatitudeDegrees),r=2*Math.atan(Math.exp(Math.PI-i*Math.PI*2))-.5*Math.PI,a=this._errorMeasurement.updateErrorLoop(i,r),n=b();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.bt(this._errorCorrectionPreviousValue,-this._errorMeasurementLastValue,t.bu(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?tz.stencil:tz.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=this._getMeshKey(i);if(r in this._tileMeshCache)return this._tileMeshCache[r];let a=function(e,i){let r=tD(i,"16bit"),a=t.aU.deserialize({arrayBuffer:r.vertices,length:r.vertices.byteLength/2/2}),n=t.aW.deserialize({arrayBuffer:r.indices,length:r.indices.byteLength/2/3});return new to(e.createVertexBuffer(a,tl.members),e.createIndexBuffer(n),t.aV.simpleSegment(0,0,a.length,n.length))}(e,i);return this._tileMeshCache[r]=a,a}recalculate(e){}hasTransition(){var e;let t=b(),i=!1;return(i=(t-this._errorMeasurementLastChangeTime)/1e3<.7)||(i=null==(e=this._errorMeasurement)?void 0:e.awaitingQuery),i}setErrorQueryLatitudeDegrees(e){this._errorQueryLatitudeDegrees=e}}let tR=new t.u({type:new t.D(t.x.projection.type)});class tL extends t.E{constructor(e){super(),this._transitionable=new t.
vendor: 5,148 bytes, line 796
796y(tR,void 0),this.setProjection(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new t.J(0)),this._mercatorProjection=new tc,this._verticalPerspectiveProjection=new tk}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.bv){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 tF(e){return 2*Math.PI*tV(e.worldSize,e.center.lat)}function tB(e,i,r,a,n){let s=1/(1<<n),o=i/t.a6*s+a*s,l=t.by((e/t.a6*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 tO(e){return function(e,t){let i=Math.cos(t),r=new Float64Array(3);return r[0]=Math.sin(e)*i,r[1]=Math.sin(t),r[2]=Math.cos(e)*i,r}(e.lng*Math.PI/180,e.lat*Math.PI/180)}function tV(e,t){return e/(2*Math.PI)/Math.cos(t*Math.PI/180)}function tj(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.W(t.X(s,-180,180),i)}return new t.W(0,i)}function tN(e){return Math.cos(e*Math.PI/180)}function tU(e,i){let r=tN(e),a=tN(i);return t.ar(a/r)}function tG(e,i){let r=e.rotate(i.bearingInRadians),a=i.zoom+tU(i.center.lat,0),n=t.bt(1/tN(i.center.lat),1/tN(Math.min(Math.abs(i.center.lat),60)),t.bw(a,7,3,0,1)),s=360/tF({worldSize:i.worldSize,center:{lat:i.center.lat}});return new t.W(i.center.lng-r.x*s*n,t.al(i.center.lat+r.y*s,-t.am,t.am))}function t$(e){let t=.5*e,i=Math.sin(t),r=Math.cos(t);return Math.log(i+r)-Math.log(r-i)}function tZ(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=t$(s+a*(o-s)),h=t$(s),u=t$(o);return new t.W(e.lng+(l-h)/(u-h)*i,n)}return new t.W(e.lng+i*a,n)}class tq{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&&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 tW{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],(r>>1&1)==1?t[1]:e[1],(r>>2&1)==1?t[2]:e[2]]);return new tW(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.bA([],r[0],r[1],r[2]),n=t.bB([],[i[0],0,0],a),s=t.bB([],[0,i[1],0],a),o=t.bB([],[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]*((t>>1&1)==1?1:-1)+o[i]*((t>>2&1)==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.a_(r,r,t.aZ([],n,1&~i?-1:1)),t.a_(r,r,t.aZ([],s,(i>>1&1)==1?1:-1)),t.a_(r,r,t.aZ([],o,(i>>2&1)==1?1:-1)),u.push(r)}return new tW(u,[[...n,-t.b3(n,u[0])],[...s,-t.b3(s,u[0])],[...o,-t.b3(o,u[0])],[-n[0],-n[1],-n[2],-t.b3
796(n,u[7])],[-s[0],-s[1],-s[2],-t.b3(s,u[7])],[-o[0],-o[1],-o[2],-t.b3(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 tH(e,t,i){let r=e-t;return r<0?-r:Math.max(0,r-i)}function tX(e,t,i,r,a){let n=e-i;return Math.max(n<0?Math.min(-n,1+n-a):n>a?Math.min(Math.max(n-a,0),1-n):0,tH(t,r,a))}class tY{constructor(){this._boundingVolumeCache=new tq(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,tX(e,t,s,o,n)),tX(e,t,s+.5,-o-n,n)),tX(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=tH(e.x,n,a),o=tH(e.x,n-1,a),l=tH(e.x,n+1,a),h=Math.min(s,o,l);return h===l?1:h===o?-1:0}allowVariableZoom(e,t){return ew(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&&a.terrain){let h=new t.a3(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.bD,l/=t.bD,o+=1,l+=1,e.z<=0)return tW.fromAabb([-l,-l,-l],[l,l,l]);if(1===e.z)return tW.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=[tB(0,0,e.x,e.y,e.z),tB(t.a6,0,e.x,e.y,e.z),tB(t.a6,t.a6,e.x,e.y,e.z),tB(0,t.a6,e.x,e.y,e.z)],r=[];for(let e of i)r.push(t.aZ([],e,l));if(l!==o)for(let e of i)r.push(t.aZ([],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=tB(t.a6/2,t.a6/2,e.x,e.y,e.z),h=t.b2([],[0,1,0],s);t.b1(h,h);let u=t.b2([],s,h);t.b1(u,u);let c=t.b2([],i[2],i[1]);t.b1(c,c);let p=t.b2([],i[0],i[3]);t.b1(p,p),r.push(t.aZ([],s,l)),e.y>=(1<<e.z)/2&&r.push(t.aZ([],tB(t.a6/2,0,e.x,e.y,e.z),l)),e.y<(1<<e.z)/2&&r.push(t.aZ([],tB(t.a6/2,t.a6,e.x,e.y,e.z),l));let f=tK(s,r),m=tK(u,r),_=[-s[0],-s[1],-s[2],f.max],g=[s[0],s[1],s[2],-f.min],y=[-u[0],-u[1],-u[2],m.max],x=[u[0],u[1],u[2],-m.min],v=[...c,0],b=[...p,0],w=[];return 0===e.y?w.push(t.bC(b,v,_),t.bC(b,v,g)):w.push(t.bC(y,v,_),t.bC(y,v,g),t.bC(y,b,_),t.bC(y,b,g)),e.y===(1<<e.z)-1?w.push(t.bC(b,v,_),t.bC(b,v,g)):w.push(t.bC(x,v,_),t.bC(x,v,g),t.bC(x,b,_),t.bC(x,b,g)),new tW(w,[_,g,y,x,v,b],a,n)}}}function tK(e,i){let r=1/0,a=-1/0;for(let n of i){let i=t.b3(e,n);r=Math.min(r,i),a=Math.max(a,i)}return{min:r,max:a}}class tJ{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){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)}setConstrainOverride(e){this._helper.setConstrainOverride(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 constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(e){}constructor(e){this._cachedClippingPlane=t.bE(),this._projectionMatrix=t.bi(),this._globeViewProjMatrix32f=t.bh(),this._globeViewProjMatrixNoCorrection=t.bi(),this._globeViewProjMatrixNoCorrectionInverted=t.bi(),this._globeProjMatrixInverted=t.bi(),this._cameraPosition=t.bz(),this._globeLatitudeErrorCorrectionRadians=0,this.defaultConstrain=(e,i)=>{let r=t.al(e.lat,-t.am,t.am),a=t.al(+i,this.minZoom+tU(0,r),this.maxZoom);return{center:new t.W(e.lng,r),zoom:a}},this.applyConstrain=(e,t)=>this._helper.applyConstrain(e,t),this._helper=new tm({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(e,t)=>this.defaultConstrain(e,t)},e),this._coveringTilesDetailsProvider=new tY}clone(){let e=new tJ;return e.apply(this,!1),e}apply(e,t,i){this._globeLatitudeErrorCorrectionRadians=i||0,this._helper.apply(e,t)}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._globeViewProjMatrixNoCorrection}get inverseProjectionMatrix(){return this._globeProjMatrixInverted}get cameraPosition(){let e=t.bz();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.bF(u,u,[0,0,0],-this.bearingInRadians),t.bG(u,u,[0,0,0],-1*this.center.lat*Math.PI/180),t.bH(u,u,[0,0,0],this.center.lng*Math.PI/180);let c=1/t.b5(u);return t.aZ(u,u,c),[...u,-s*c]}isLocationOccluded(e){return!this.isSurfacePointVisible(tO(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.b2(o,s,n),t.b1(s,s),t.b1(o,o);let l=[0,0,0];return t.b1(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;let n=function(e,i,r){let a=1/(1<<r.z);return new t.a7(e/t.a6*a+r.x*a,i/t.a6*a+r.y*a)}(e,i,r.canonical),s=(a=n.y,[t.by(n.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(s[1])}projectTileCoordinates(e,i,r,a){let n=r.canonical,s=tB(e,i,n.x,n.y,n.z),o=1+(a?a(e,i):0)/t.bD,l=[s[0]*o,s[1]*o,s[2]*o,1];t.aE(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}}
vendor: 14,900 bytes, line 796
796_calcMatrices(){if(!this._helper._width||!this._helper._height)return;let e=tV(this.worldSize,this.center.lat),i=t.bj(),r=t.bj();this._helper.autoCalculateNearFarZ&&(this._helper._nearZ=.5,this._helper._farZ=this.cameraToCenterDistance+2*e),t.bc(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.bd(i),this._globeProjMatrixInverted=t.bj(),t.bg(this._globeProjMatrixInverted,i),t.Q(i,i,[0,0,-this.cameraToCenterDistance]),t.be(i,i,this.rollInRadians),t.bf(i,i,-this.pitchInRadians),t.be(i,i,this.bearingInRadians),t.Q(i,i,[0,0,-e]);let n=t.bz();n[0]=e,n[1]=e,n[2]=e,t.bf(r,i,this.center.lat*Math.PI/180),t.bI(r,r,-this.center.lng*Math.PI/180),t.S(r,r,n),this._globeViewProjMatrixNoCorrection=r,t.bf(i,i,this.center.lat*Math.PI/180-this._globeLatitudeErrorCorrectionRadians),t.bI(i,i,-this.center.lng*Math.PI/180),t.S(i,i,n),this._globeViewProjMatrix32f=new Float32Array(i),this._globeViewProjMatrixNoCorrectionInverted=t.bj(),t.bg(this._globeViewProjMatrixNoCorrectionInverted,r);let s=t.bz();this._cameraPosition=t.bz(),this._cameraPosition[2]=this.cameraToCenterDistance/e,t.bF(this._cameraPosition,this._cameraPosition,s,-this.rollInRadians),t.bG(this._cameraPosition,this._cameraPosition,s,this.pitchInRadians),t.bF(this._cameraPosition,this._cameraPosition,s,-this.bearingInRadians),t.a_(this._cameraPosition,this._cameraPosition,[0,0,1]),t.bG(this._cameraPosition,this._cameraPosition,s,-this.center.lat*Math.PI/180),t.bH(this._cameraPosition,this._cameraPosition,s,this.center.lng*Math.PI/180),this._cachedClippingPlane=this._computeClippingPlane(e);let o=t.bd(this._globeViewProjMatrixNoCorrectionInverted);t.S(o,o,[1,1,-1]),this._cachedFrustum=ty.fromInvProjectionMatrix(o,1,0,this._cachedClippingPlane,!0)}calculateFogMatrix(e){t.w("calculateFogMatrix is not supported on globe projection.");let i=t.bj();return t.ap(i),i}getVisibleUnwrappedCoordinates(e){return[new t.ba(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=tO(e);t.aZ(r,r,1+i/t.bD);let a=t.bE();return t.aE(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.bJ(h.lng,e.lng),r=t.bJ(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 q(u)}calculateCenterFromCameraLngLatAlt(e,t,i,r){return this._helper.calculateCenterFromCameraLngLatAlt(e,t,i,r)}setLocationAtPoint(e,i){let r,a,n=tO(this.unprojectScreenPoint(i)),s=tO(e),o=t.bz();t.bK(o);let l=t.bz();t.bH(l,n,o,-this.center.lng*Math.PI/180),t.bG(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),p=t.bL(s[0],s[2],l[0],c),f=t.bL(s[0],s[2],l[0],-c),m=t.bz();t.bH(m,s,o,-p);let _=t.bL(m[1],m[2],l[1],l[2]),g=t.bz();t.bH(g,s,o,-f);let y=t.bL(g[1],g[2],l[1],l[2]),x=.5*Math.PI,v=_>=-x&&_<=x,b=y>=-x&&y<=x;if(v&&b){let e=this.center.lng*Math.PI/180,i=this.center.lat*Math.PI/180;t.bM(p,e)+t.bM(_,i)<t.bM(f,e)+t.bM(y,i)?(r=p,a=_):(r=f,a=y)}else if(v)r=p,a=_;else{if(!b)return;r=f,a=y}let w=r/Math.PI*180,T=a/Math.PI*180,S=this.center.lat;this.setCenter(new t.W(w,t.al(T,-90,90))),this.setZoom(this.zoom+tU(S,this.center.lat))}locationToScreenPoint(e,i){let r=tO(e);if(i){let a=i.getElevationForLngLatZoom(e,this._helper._tileZoom);t.aZ(r,r,1+a/t.bD)}return this._projectSurfacePointToScreen(r)}_projectSurfacePointToScreen(e){let i=t.bE();return t.aE(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.a7.fromLngLat(this.unprojectScreenPoint(e))}screenPointToLocation(e,t){var i;return null==(i=this.screenPointToMercatorCoordinate(e,t))?void 0:i.toLngLat()}isPointOnMapSurface(e,t){let i=this._cameraPosition,r=this.getRayDirectionFromPixel(e);return!!this.rayPlanetIntersection(i,r)}getRayDirectionFromPixel(e){let i=t.bE();i[0]=e.x/this.width*2-1,i[1]=-1*(e.y/this.height*2-1),i[2]=1,i[3]=1,t.aE(i,i,this._globeViewProjMatrixNoCorrectionInverted),i[0]/=i[3],i[1]/=i[3],i[2]/=i[3];let r=t.bz();r[0]=i[0]-this._cameraPosition[0],r[1]=i[1]-this._cameraPosition[1],r[2]=i[2]-this._cameraPosition[2];let a=t.bz();return t.b1(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.bE();return t.aE(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.b3(e,i),a=t.bz(),n=t.bz();t.aZ(n,i,r),t.b0(a,e,n);let s=1-t.b3(a,a);if(s<0)return null;let o=t.b3(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){let i=this._cameraPosition,r=this.getRayDirectionFromPixel(e),a=this.rayPlanetIntersection(i,r);if(a){let e=t.bz();t.a_(e,i,[r[0]*a.tMin,r[1]*a.tMin,r[2]*a.tMin]);let n=t.bz();return t.b1(n,e),tj(n)}let n=this._cachedClippingPlane,s=n[0]*r[0]+n[1]*r[1]+n[2]*r[2],o=-t.b9(n,i)/s,l=t.bz();if(o>0)t.a_(l,i,[r[0]*o,r[1]*o,r[2]*o]);else{let e=t.bz();t.a_(e,i,[2*r[0],2*r[1],2*r[2]]);let a=t.b9(this._cachedClippingPlane,e);t.b0(l,e,[this._cachedClippingPlane[0]*a,this._cachedClippingPlane[1]*a,this._cachedClippingPlane[2]*a])}let h=function(e){let i=t.bz();return i[0]=-(e[0]*e[3]),i[1]=-(e[1]*e[3]),i[2]=-(e[2]*e[3]),{center:i,radius:Math.sqrt(1-e[3]*e[3])}}(n);return tj(function(e,i,r){let a=t.bz();t.b0(a,r,e);let n=t.bz();return t.bx(n,e,a,i/t.b7(a)),n}(h.center,h.radius,l))}getMatrixForModel(e,i){let r=t.W.convert(e),a=1/t.bD,n=t.bi();return t.bI(n,n,r.lng/180*Math.PI),t.bf(n,n,-r.lat/180*Math.PI),t.Q(n,n,[0,0,1+i/t.bD]),t.bf(n,n,.5*Math.PI),t.S(n,n,[a,a,a]),n}getProjectionDataForCustomLayer(e=!0){let i=this.getProjectionData({overscaledTileID:new t.a3(0,0,0,0,0),applyGlobeMatrix:e});return i.tileMercatorCoords=[0,0,1,1],i}getFastPathSimpleProjectionMatrix(e){}}class tQ{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){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)}setConstrainOverride(e){this._helper.setConstrainOverride(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 constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}get isGlobeRendering(){return this._globeness>0}setTransitionState(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(e){this._globeLatitudeErrorCorrectionRadians=0,this._globeness=1,this.defaultConstrain=(e,t)=>this.currentTransform.defaultConstrain(e,t),this.applyConstrain=(e,t)=>this._helper.applyConstrain(e,t),this._helper=new tm({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(e,t)=>this.defaultConstrain(e,t)},e),this._globeness=1,this._mercatorTransform=new tx,this._verticalPerspectiveTransform=new tJ}clone(){let e=new tQ;return e._globeness=this._globeness,e._globeLatitudeErrorCorrectionRadians=this._globeLatitudeErrorCorrectionRadians,e.apply(this,!1),e}apply(e,t){this._helper.apply(e,t),this._mercatorTransform.apply(this,!1),this._verticalPerspectiveTransform.apply(this,!1,this._globeLatitudeErrorCorrectionRadians)}get projectionMatrix(){return this.currentTransform.projectionMatrix}get modelViewProjectionMatrix(){return this.currentTransform.modelViewProjectionMatrix}get inverseProjectionMatrix(){return this.currentTransform.inverseProjectionMatrix}get cameraPosition(){return this.currentTransform.cameraPosition}getProjectionData(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.bt(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return t.bt(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.bt(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,!1,this._globeLatitudeErrorCorrectionRadians),this._helper._nearZ=this._verticalPerspectiveTransform.nearZ,this._helper._farZ=this._verticalPerspectiveTransform.farZ,this._mercatorTransform.apply(this,!0,this.isGlobeRendering),this._helper._nearZ=this._mercatorTransform.nearZ,this._helper._farZ=this._mercatorTransform.farZ)}calculateFogMatrix(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()}calculateCenterFromCameraLngLatAlt(e,t,i,r){return this._helper.calculateCenterFromCameraLngLatAlt(e,t,i,r)}setLocationAtPoint(e,t){if(!this.isGlobeRendering)return this._mercatorTransform.setLocationAtPoint(e,t),void this.apply(this._mercatorTransform,!1);this._verticalPerspectiveTransform.setLocationAtPoint(e,t),this.apply(this._verticalPerspectiveTransform,!1)}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)}
796isPointOnMapSurface(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 t0{get useGlobeControls(){return!0}handlePanInertia(e,i){let r=tG(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.bJ(i.center.lng,a.lng),l=o/(Math.abs(o/180)+1),h=t.bJ(i.center.lat,a.lat),u=i.getRayDirectionFromPixel(r),c=i.cameraPosition,p=-1*t.b3(c,u),f=t.bz();t.a_(f,c,[u[0]*p,u[1]*p,u[2]*p]);let m=Math.exp(-(.5*Math.max(t.b5(f)-1-.3,0))),_=tV(i.worldSize,i.center.lat)/Math.min(i.width,i.height),g=t.bw(_,.9,.5,1,.25),y=(1-t.ao(-s))*Math.min(m,g),x=i.center.lat,v=i.zoom,b=new t.W(i.center.lng+l*y,t.al(i.center.lat+h*y,-t.am,t.am));i.setLocationAtPoint(a,r);let w=i.center,T=Math.pow(Math.max(t.bw(Math.abs(o),45,85,0,1),t.bw(_,.75,.35,0,1)),.25),S=t.bJ(w.lng,b.lng),P=t.bJ(w.lat,b.lat);i.setCenter(new t.W(w.lng+S*T,w.lat+P*T).wrap()),i.setZoom(v+tU(x,i.center.lat))}handleMapControlsPan(e,t,i){if(!e.panDelta)return;let r=t.center.lat,a=t.zoom;t.setCenter(tG(e.panDelta,t).wrap()),t.setZoom(a+tU(r,t.center.lat))}cameraForBoxAndBearing(e,i,r,a,n){let s=tw(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.bJ(r.getWest(),r.getEast()),p=c?r.getEast():r.getWest(),f=c?r.getWest():r.getEast(),m=Math.max(r.getNorth(),r.getSouth()),_=Math.min(r.getNorth(),r.getSouth()),g=p+.5*t.bJ(p,f),y=m+.5*t.bJ(m,_),x=n.clone();x.setCenter(s.center),x.setBearing(s.bearing),x.setPitch(0),x.setRoll(0),x.setZoom(s.zoom);let v=x.modelViewProjectionMatrix,b=[tO(r.getNorthWest()),tO(r.getNorthEast()),tO(r.getSouthWest
796()),tO(r.getSouthEast()),tO(new t.W(f,y)),tO(new t.W(p,y)),tO(new t.W(g,m)),tO(new t.W(g,_))],w=tO(s.center),T=1/0;for(let e of b)o<0&&(T=t0.getLesserNonNegativeNonNull(T,t0.solveVectorScale(e,w,v,"x",o))),l>0&&(T=t0.getLesserNonNegativeNonNull(T,t0.solveVectorScale(e,w,v,"x",l))),h>0&&(T=t0.getLesserNonNegativeNonNull(T,t0.solveVectorScale(e,w,v,"y",h))),u<0&&(T=t0.getLesserNonNegativeNonNull(T,t0.solveVectorScale(e,w,v,"y",u)));if(Number.isFinite(T)&&0!==T)return s.zoom=Math.min(x.zoom+t.ar(T),e.maxZoom),s;tv()}handleJumpToCenterZoom(e,i){let r=e.center.lat,a=e.applyConstrain(i.center?t.W.convert(i.center):e.center,e.zoom).center;e.setCenter(a.wrap());let n=void 0!==i.zoom?+i.zoom:e.zoom+tU(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.W.convert(i.center):a,p=e.applyConstrain(c,r).center;tp(e,p);let f=e.clone();f.setCenter(p),f.setZoom(l?+i.zoom:r+tU(a.lat,c.lat)),f.setBearing(i.bearing);let m=new t.P(t.al(e.centerPoint.x+i.offsetAsPoint.x,0,e.width),t.al(e.centerPoint.y+i.offsetAsPoint.y,0,e.height));f.setLocationAtPoint(p,m);let _=(i.offset&&i.offsetAsPoint.mag())>0?f.center:p,g=l?+i.zoom:r+tU(a.lat,_.lat),y=r+tU(a.lat,0),x=g+tU(_.lat,0),v=t.bJ(a.lng,_.lng),b=t.bJ(a.lat,_.lat),w=t.ao(x-y);return{easeFunc:r=>{if(t.bn(s,o)||tb({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(x>y?Math.min(2,w):Math.max(.5,w),1-r),i=tZ(a,v,b,r*t);e.setCenter(i.wrap())}if(u){let i=t.H.number(y,x,r)+tU(0,e.center.lat);e.setZoom(i)}},isZooming:u=g!==r,elevationCenter:_}}handleFlyTo(e,i){let r,a=void 0!==i.zoom,n=e.center,s=e.zoom,o=e.padding,l=!e.isPaddingEqual(i.padding),h=e.applyConstrain(t.W.convert(i.center||i.locationAtOffset),s).center,u=a?+i.zoom:e.zoom+tU(e.center.lat,h.lat),c=e.clone();c.setCenter(h),c.setZoom(u),c.setBearing(i.bearing);let p=new t.P(t.al(e.centerPoint.x+i.offsetAsPoint.x,0,e.width),t.al(e.centerPoint.y+i.offsetAsPoint.y,0,e.height));c.setLocationAtPoint(h,p);let f=c.center;tp(e,f);let m=function(e,i,r){let a=tO(i),n=tO(r);return Math.acos(t.b3(a,n))/(2*Math.PI)*tF(e)}(e,n,f),_=s+tU(n.lat,0),g=u+tU(f.lat,0),y=t.ao(g-_);if("number"==typeof i.minZoom){let a=Math.min(+i.minZoom+tU(f.lat,0),_,g)+tU(0,f.lat),n=e.applyConstrain(f,a).zoom+tU(f.lat,0);r=t.ao(n-_)}let x=t.bJ(n.lng,f.lng),v=t.bJ(n.lat,f.lat);return{easeFunc:(r,a,s,h)=>{let c=tZ(n,x,v,s);l&&e.interpolatePadding(o,i.padding,r);let p=1===r?f:c;e.setCenter(p.wrap());let m=_+t.ar(a);e.setZoom(1===r?u:m+tU(0,p.lat))},scaleOfZoom:y,targetCenter:f,scaleOfMinZoom:r,pixelPathLength:m}}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 t1{constructor(e){this._globe=e,this._mercatorCameraHelper=new tT,this._verticalPerspectiveCameraHelper=new t0}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){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)}}let t2=(e,i)=>t.C(e,null==i?void 0:i.filter(e=>"source.canvas"!==e.identifier)),t3=t.bN();class t5 extends t.E{constructor(e,i={}){var r,a;super(),this._rtlPluginLoaded=()=>{for(let e in this.tileManagers){let t=this.tileManagers[e].getSource().type;"vector"!==t&&"geojson"!==t||this.tileManagers[e].reload()}},this.map=e,this.dispatcher=new N(j(),e._getMapId()),this.dispatcher.registerMessageHandler("GG",(e,t)=>this.getGlyphs(e,t)),this.dispatcher.registerMessageHandler("GI",(e,t)=>this.getImages(e,t)),this.dispatcher.registerMessageHandler("GDA",(e,t)=>this.getDashes(e,t)),this.imageManager=new M,this.imageManager.setEventedParent(this);let n=(null==(r=e._container)?void 0:r.lang)||"u">typeof document&&(null==(a=document.documentElement)?void 0:a.lang)||void 0;this.glyphManager=new D(e._requestManager,i.localIdeographFontFamily,n),this.lineAtlas=new F(256,512),this.crossTileSymbolIndex=new tr,this._setInitialValues(),this._resetUpdates(),this.dispatcher.broadcast("SR",t.bO()),eu().on(eo,this._rtlPluginLoaded),this.on("data",e=>{if("source"!==e.dataType||"metadata"!==e.sourceDataType)return;let t=this.tileManagers[e.sourceId];if(!t)return;let i=t.getSource();if(null!=i&&i.vectorLayerIds)for(let e in this._layers){let t=this._layers[e];
796t.source===i.id&&this._validateLayer(t)}})}_setInitialValues(){var e;this._spritesImagesIds={},this._layers={},this._order=[],this.tileManagers={},this.zoomHistory=new t.bP,this._availableImages=[],this._globalState={},this._serializedLayers={},this.stylesheet=null,this.light=null,this.sky=null,this.projection&&(this.projection.destroy(),delete this.projection),this._loaded=!1,this._changed=!1,this._updatedLayers={},this._updatedSources={},this._changedImages={},this._glyphsDidChange=!1,this._updatedPaintProps={},this._layerOrderChanged=!1,this.crossTileSymbolIndex=new((null==(e=this.crossTileSymbolIndex)?void 0:e.constructor)||Object),this.pauseablePlacement=void 0,this.placement=void 0,this.z=0}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.bQ(s,this._globalState[e]))return this;this._globalState[e]=s,this._applyGlobalStateChanges([e])}getGlobalState(){return this._globalState}setGlobalState(e){this._checkLoaded();let i=[];for(let r in e)t.bQ(this._globalState[r],e[r].default)||(i.push(r),this._globalState[r]=e[r].default);this._applyGlobalStateChanges(i)}_applyGlobalStateChanges(e){if(0===e.length)return;let t=new Set,i={};for(let r of e)for(let e in i[r]=this._globalState[r],this._layers){let i=this._layers[e],a=i.getLayoutAffectingGlobalStateRefs(),n=i.getPaintAffectingGlobalStateRefs(),s=i.getVisibilityAffectingGlobalStateRefs();if(a.has(r)&&t.add(i.source),n.has(r))for(let{name:e,value:t}of n.get(r))this._updatePaintProperty(i,e,t);null!=s&&s.has(r)&&(i.recalculateVisibility(),this._updateLayer(i))}for(let e in this.dispatcher.broadcast("UGS",i),this.tileManagers)t.has(e)&&(this._reloadSource(e),this._changed=!0)}loadURL(e){return t._(this,arguments,void 0,function*(e,i={},r){this.fire(new t.n("dataloading",{dataType:"style"})),i.validate="boolean"!=typeof i.validate||i.validate,this._loadStyleRequest=new AbortController;let a=this._loadStyleRequest;try{let n=yield this.map._requestManager.transformRequest(e,"Style");t.bR(a.signal);let s=yield t.k(n,a);this._loadStyleRequest===a&&(this._loadStyleRequest=null),this._load(s.data,i,r)}catch(e){this._loadStyleRequest===a&&(this._loadStyleRequest=null),e&&!a.signal.aborted&&this.fire(new t.l(t.d(e)))}})}loadJSON(e,i={},r){this.fire(new t.n("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,x.frameAsync(this._frameRequest,this.map._ownerWindow).then(()=>{this._frameRequest=null,i.validate=!1!==i.validate,this._load(e,i,r)}).catch(()=>{})}loadEmpty(){this.fire(new t.n("dataloading",{dataType:"style"})),this._load(t3,{validate:!1})}_load(e,i,r){var a,n;let s=i.transformStyle?i.transformStyle(r,e):e;if(!i.validate||!t2(this,t.F(s))){for(let e in s=Object.assign({},s),this._loaded=!0,this.stylesheet=s,s.sources)this.addSource(e,s.sources[e],{validate:!1});s.sprite?this._loadSprite(s.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(s.glyphs),this._createLayers(),this.light=new k(this.stylesheet.light),this._setProjectionInternal((null==(a=this.stylesheet.projection)?void 0:a.type)||"mercator"),this.sky=new L(this.stylesheet.sky),this.map.setTerrain(null!=(n=this.stylesheet.terrain)?n:null),this.fire(new t.n("data",{dataType:"style"})),this.fire(new t.n("style.load"))}}_createLayers(){var e,i,r;let a=t.bS(this.stylesheet.layers);for(let n of(this.setGlobalState(null!=(e=this.stylesheet.state)?e:null),this.dispatcher.broadcast("SL",a),this._order=a.map(e=>e.id),this._layers={},this._serializedLayers=null,a)){let e=t.bT(n,this._globalState);if(e.setEventedParent(this,{layer:{id:n.id}}),this._layers[n.id]=e,t.bU(e)&&this.tileManagers[e.source]){let t=null!=(r=null==(i=n.paint)?void 0:i["raster-fade-duration"])?r:e.paint.get("raster-fade-duration");this.tileManagers[e.source].setRasterFadeDuration(t)}}}_loadSprite(e,i=!1,r){let a;this.imageManager.setLoaded(!1);let n=new AbortController;this._spriteRequest=n,(function(e,i,r,a){return t._(this,void 0,void 0,function*(){let n=S(e),s=r>1?"@2x":"",o={},l={};for(let{id:e,url:r}of n){let n=yield i.transformRequest(P(r,s,".json"),"SpriteJSON");o[e]=t.k(n,a);let h=yield i.transformRequest(P(r,s,".png"),"SpriteImage");l[e]=f.getImage(h,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=x.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:p,content:f,textFitWidth:m,textFitHeight:_}=n[e];t[r][e]={data:null,pixelRatio:u,sdf:h,stretchX:c,stretchY:p,content:f,textFitWidth:m,textFitHeight:_,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,n.signal.aborted||this.fire(new t.l(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.n("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.n("data",{dataType:"style"}))}_validateLayer(e){let i=this.tileManagers[e.source];if(!i)return;let r=e.sourceLayer;if(!r)return;let a=i.getSource();("geojson"===a.type||a.vectorLayerIds&&!a.vectorLayerIds.includes(r))&&this.fire(new t.l(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.tileManagers)if(!this.tileManagers[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.bV(r):r);let a=[];for(let n of e)if(r[n]){let e=i?t.bV(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];
796"custom"!==i.type&&(e[t]=i.serialize())}return e}hasTransitions(){var e,t,i;if(null!=(e=this.light)&&e.hasTransition()||null!=(t=this.sky)&&t.hasTransition()||null!=(i=this.projection)&&i.hasTransition())return!0;for(let e in this.tileManagers)if(this.tileManagers[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.tileManagers){let t=this.tileManagers[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.tileManagers[i.source].used=!0)}for(let e in r){let i=this.tileManagers[e];!!r[e]!=!!i.used&&i.fire(new t.n("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.n("data",{dataType:"style"}))}_updateTilesForChangedImages(){let e=Object.keys(this._changedImages);if(e.length){for(let t in this.tileManagers)this.tileManagers[t].reloadTilesForDependencies(["icons","patterns"],e);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(let e in this.tileManagers)this.tileManagers[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)&&t2(this,t.F(e)))return!1;(e=t.bV(e)).layers=t.bS(e.layers);let n=t.bW(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,this.fire(new t.n("style.load",{style:this})),!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.l(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.l(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.n("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,i,r={}){var a;if(this._checkLoaded(),void 0!==this.tileManagers[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
796ject.keys(i).join(", ")}.`);if(["vector","raster","geojson","video","image"].includes(i.type)&&this._validate(t.F.source,`sources.${e}`,i,null,r))return;null!=(a=this.map)&&a._collectResourceTiming&&(i.collectResourceTiming=!0);let n=this.tileManagers[e]=new eC(e,i,this.dispatcher);n.style=this,n.setEventedParent(this,()=>({isSourceLoaded:n.loaded(),source:n.serialize(),sourceId:e})),n.onAdd(this.map),this._changed=!0}removeSource(e){if(this._checkLoaded(),void 0===this.tileManagers[e])throw Error(`There is no source with this ID=${e}`);for(let i in this._layers)if(this._layers[i].source===e)return this.fire(new t.l(Error(`Source "${e}" cannot be removed while layer "${i}" is using it.`)));let i=this.tileManagers[e];delete this.tileManagers[e],delete this._updatedSources[e],i.fire(new t.n("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.tileManagers[e])throw Error(`There is no source with this ID=${e}`);let i=this.tileManagers[e].getSource();if("geojson"!==i.type)throw Error(`geojsonSource.type is ${i.type}, which is !== 'geojson`);i.setData(t),this._changed=!0}getSource(e){var t;return null==(t=this.tileManagers[e])?void 0:t.getSource()}addLayer(e,i,r={}){let a;this._checkLoaded();let n=e.id;if(this.getLayer(n))return void this.fire(new t.l(Error(`Layer "${n}" already exists on this map.`)));if("custom"===e.type){if(t2(this,t.bX(e)))return;a=t.bT(e,this._globalState)}else{if("source"in e&&"object"==typeof e.source&&(this.addSource(n,e.source),e=t.bV(e),e=t.e(e,{source:n})),this._validate(t.F.layer,`layers.${n}`,e,{arrayIndex:-1},r))return;a=t.bT(e,this._globalState),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.l(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.tileManagers[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.l(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.l(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.l(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.l(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.bQ(a.filter,i))return null==i?(a.setFilter(void 0),void this._updateLayer(a)):void(this._validate(t.F.filter,`layers.${a.id}.filter`,i,null,r)||(a.setFilter(t.bV(i)),this._updateLayer(a)))}else this.fire(new t.l(Error(`Cannot filter non-existing layer "${e}".`)))}getFilter(e){return t.bV(this.getLayer(e).filter)}setLayoutProperty(e,i,r,a={}){this._checkLoaded();let n=this.getLayer(e);n?t.bQ(n.getLayoutProperty(i),r)||(n.setLayoutProperty(i,r,a),this._updateLayer(n)):this.fire(new t.l(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.l(Error(`Cannot get style of non-existing layer "${e}".`)))}setPaintProperty(e,i,r,a={}){this._checkLoaded();let n=this.getLayer(e);n?t.bQ(n.getPaintProperty(i),r)||this._updatePaintProperty(n,i,r,a):this.fire(new t.l(Error(`Cannot style non-existing layer "${e}".`)))}_updatePaintProperty(e,i,r,a={}){e.setPaintProperty(i,r,a)&&this._updateLayer(e),t.bU(e)&&"raster-fade-duration"===i&&this.tileManagers[e.source].setRasterFadeDuration(r),this._changed=!0,this._updatedPaintProps[e.id]=!0,this._serializedLayers=null}getPaintProperty(e,t){return this.getLayer(e).getPaintProperty(t)}setFeatureState(e,i){this._checkLoaded();let r=e.source,a=e.sourceLayer,n=this.tileManagers[r];if(void 0===n)return void this.fire(new t.l(Error(`The source '${r}' does not exist in the map's style.`)));let s=n.getSource().type;"geojson"===s&&a?this.fire(new t.l(Error("GeoJSON sources cannot have a sourceLayer parameter."))):"vector"!==s||a?(void 0===e.id&&this.fire(new t.l(Error("The feature id parameter must be provided."))),n.setFeatureState(a,e.id,i)):this.fire(new t.l(Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(e,i){this._checkLoaded();let r=e.source,a=this.tileManagers[r];if(void 0===a)return void this.fire(new t.l(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.l(Error("A feature id is required to remove its specific state property."))):a.removeFeatureState(s,e.id,i):this.fire(new t.l(Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(e){this._checkLoaded();let i=e.source,r=e.sourceLayer,a=this.tileManagers[i];if(void 0!==a)return"vector"!==a.getSource().type||r?(void 0===e.id&&this.fire(new t.l(Error("The feature id parameter must be provided."))),a.getFeatureState(r,e.id)):void this.fire(new t.l(Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new t.l(Error(`The source '${i}' does not exist in the map's style.`)))}getTransition(){var e;return t.e({duration:300,delay:0},null==(e=this.stylesheet)?void 0:e.transition)}serialize(){if(!this._loaded)return;let e=t.bY(this.tileManagers,e=>e.serialize()),i=this._serializeByIds(this._order,!0),r=this.map.getTerrain()||void 0,a=this.stylesheet;return t.bZ({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.tileManagers[e.source].getSource().type&&(this._updatedSources[e.source]="reload",this.tileManagers[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)=>
796t.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){null!=i&&i.filter&&this._validate(t.F.filter,"queryRenderedFeatures.filter",i.filter,null,i);let a={};if(null!=i&&i.layers){if(!(Array.isArray(i.layers)||i.layers instanceof Set))return this.fire(new t.l(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.l(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,globalState:this._globalState});for(let o in this.tileManagers)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((null==e?void 0: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!=(p=null==n?void 0:n.layers)?p:null,i,e.id),h=s.maxPitchScaleFactor(),u=e.tilesIn(a,h,l);u.sort(G);let c=[];for(let a of u)c.push({wrappedTileID:a.tileID.wrapped().key,queryResults:a.tile.queryRenderedFeatures(i,r,e.getState(),a.queryGeometry,a.cameraQueryGeometry,a.scale,n,s,h,function(e,i){let r=t.O();return t.Q(r,r,[1,1,0]),t.S(r,r,[.5*e.width,.5*e.height,1]),e.calculatePosMatrix?t.U(r,r,e.calculatePosMatrix(i.toUnwrapped())):r}(s,a.tileID),o?(e,t)=>o(a.tileID,e,t):void 0)});var p,f=function(e){let t={},i={};for(let{queryResults:r,wrappedTileID:a}of e){i[a]||(i[a]={});let e=i[a];for(let i in r){let a=r[i];e[i]||(e[i]={});let n=e[i];for(let e of(t[i]||(t[i]=[]),a))n[e.featureIndex]||(n[e.featureIndex]=!0,t[i].push(e))}}return t}(c);for(let t in f)for(let i of f[t])$(i,e);return f}(this.tileManagers[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(G),h)){let r=i.featureIndex.lookupSymbolFeatures(l[i.bucketInstanceId],t,i.bucketIndex,i.sourceLayerIndex,{filterSpec:a.filter,globalState:a.globalState},a.layers,a.availableImages,e);for(let e in r){o[e]||(o[e]=[]);let t=r[e];for(let r of(t.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}),t))o[e].push(r)}}for(let t in o)for(let r of o[t])$(r,i[e[t].source]);return o}(this._layers,s,this.tileManagers,e,l,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(n)}querySourceFeatures(e,i){null!=i&&i.filter&&this._validate(t.F.filter,"querySourceFeatures.filter",i.filter,null,i);let r=this.tileManagers[e];return r?function(e,t){let i=e.getRenderableIds().map(t=>e.getTileByID(t)),r=[],a={};for(let e of i){let i=e.tileID.canonical.key;a[i]||(a[i]=!0,e.querySourceFeatures(r,t))}return r}(r,i?Object.assign(Object.assign({},i),{globalState:this._globalState}):{globalState:this._globalState}):[]}getLight(){return this.light.getLight()}setLight(e,i={}){this._checkLoaded();let r=this.light.getLight(),a=!1;for(let i in e)if(!t.bQ(e[i],r[i])){a=!0;break}if(!a)return;let n={now:b(),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){this._checkLoaded();let t=e??{type:"mercator"};if(this.stylesheet.projection=e,this.projection){if(this.projection.name===t.type)return;this.projection.destroy(),delete this.projection}this._setProjectionInternal(t.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.bQ(e[i],r[i])){a=!0;break}if(!a)return;let n={now:b(),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,i){let r={constrainOverride:i};if(Array.isArray(e)){let t=new tL({type:e});return{projection:t,transform:new tQ(r),cameraHelper:new t1(t)}}switch(e){case"mercator":return{projection:new tc,transform:new tx(r),cameraHelper:new tT};case"globe":{let e=new tL({type:["interpolate",["linear"],["zoom"],11,"vertical-perspective",12,"mercator"]});return{projection:e,transform:new tQ(r),cameraHelper:new t1(e)}}case"vertical-perspective":return{projection:new tk,transform:new tJ(r),cameraHelper:new t0};default:return t.w(`Unknown projection name: ${e}. Falling back to mercator projection.`),{projection:new tc,transform:new tx(r),cameraHelper:new tT}}}(e,this.map.transformConstrain);for(let e in this.projection=i.projection,this.map.migrateProjection(i.transform,i.cameraHelper),this.tileManagers)this.tileManagers[e].reload()}_validate(e,i,r,a,n={}){return(null==n?void 0:n.validate)!==!1&&t2(this,e.call(t.F,t.e({key:i,style:this.serialize(),value:r,styleSpec:t.x},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),eu().off(eo,this._rtlPluginLoaded),this._layers)this._layers[e].setEventedParent(null);for(let e in this.tileManagers){let t=this.tileManagers[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.tileManagers[e].clearTiles()}_reloadSource(e){this.tileManagers[e].resume(),this.tileManagers[e].reload()}_updateSources(e){for(let t in this.tileManagers)this.tileManagers[t].update(e,this.map.terrain)}_generateCollisionBoxes(){for(let e in this.tileManagers)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];
796if("symbol"!==i.type)continue;if(!o[i.source]){let e=this.tileManagers[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),(a||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(b(),e.zoom))&&(this.pauseablePlacement=new e7(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(b()),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(b())}_releaseSymbolFadeTiles(){for(let e in this.tileManagers)this.tileManagers[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.tileManagers[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.tileManagers[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.F.glyphs,"glyphs",e,null,i)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=e,this.glyphManager.entries={},this.glyphManager.setURL(e))}getDashes(e,i){return t._(this,void 0,void 0,function*(){let e={};for(let[t,r]of Object.entries(i.dashes))e[t]=this.lineAtlas.getDash(r.dasharray,r.round);return e})}addSprite(e,i,r={},a){this._checkLoaded();let n=[{id:e,url:i}],s=[...S(this.stylesheet.sprite),...n];this._validate(t.F.sprite,"sprite",s,null,r)||(this.stylesheet.sprite=s,this._loadSprite(n,!0,a))}removeSprite(e){this._checkLoaded();let i=S(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.n("data",{dataType:"style"}))}else this.fire(new t.l(Error(`Sprite "${e}" doesn't exists on this map.`)))}getSprite(){return S(this.stylesheet.sprite)}setSprite(e,i={},r){this._checkLoaded(),e&&this._validate(t.F.sprite,"sprite",e,null,i)||(this.stylesheet.sprite=e,e?this._loadSprite(e,!0,r):(this._unloadSprite(),r&&r(null)))}destroy(){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),this.tileManagers){let t=this.tileManagers[e];t.setEventedParent(null),t.onRemove(this.map)}for(let e in this.tileManagers={},this.imageManager&&(this.imageManager.setEventedParent(null),this.imageManager.destroy(),this._availableImages=[],this._spritesImagesIds={}),this.glyphManager&&this.glyphManager.destroy(),this._layers){let t=this._layers[e];t.setEventedParent(null),t.onRemove&&t.onRemove(this.map)}this._setInitialValues(),this.setEventedParent(null),this.dispatcher.unregisterMessageHandler("GG"),this.dispatcher.unregisterMessageHandler("GI"),this.dispatcher.unregisterMessageHandler("GDA"),this.dispatcher.remove(!0),this._listeners={},this._oneTimeListeners={}}}var t6=t.aS([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class t4{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(),null!=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 t8=(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.bo.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.bo.white,u_horizon_fog_blend:r?r.properties.get("horizon-fog-blend"):1,u_is_globe_mode:+!!n}),t7={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 t9(e){let t=[];for(let i of e){if(null===i)continue;let e=i.split(" ");t.push(e.pop())}return t}class ie{constructor(e,i,r,a,n,s,o,l,h=[]){let u=e.gl;this.program=u.createProgram();let c=t9(i.staticAttributes),p=r?r.getBinderAttributes():[],f=c.concat(p),m=tn.prelude.staticUniforms?t9(tn.prelude.staticUniforms):[],_=o.staticUniforms?t9(o.staticUniforms):[],g=i.staticUniforms?t9(i.staticUniforms):[],y=r?r.getBinderUniforms():[],x=m.concat(_).concat(g).concat(y),v=[];for(let e of x)v.includes(e)||v.push(e);let b=r?r.defines():[];
796tE(u)&&b.unshift("#version 300 es"),n&&b.push("#define OVERDRAW_INSPECTOR;"),s&&b.push("#define TERRAIN3D;"),l&&b.push(l),h&&b.push(...h);let w=b.concat(tn.prelude.fragmentSource,o.fragmentSource,i.fragmentSource).join(` 797`),T=b.concat(tn.prelude.vertexSource,o.vertexSource,i.vertexSource).join(` 798`);tE(u)||(w=w.replace(/\bin\s/g,"varying ").replace("out highp vec4 fragColor;","").replace(/fragColor/g,"gl_FragColor").replace(/texture\(/g,"texture2D("),T=T.replace(/\bin\s/g,"attribute ").replace(/\bout\s/g,"varying ").replace(/texture\(/g,"texture2D("));let S=u.createShader(u.FRAGMENT_SHADER);if(u.isContextLost())return void(this.failedToCreate=!0);if(u.shaderSource(S,w),u.compileShader(S),!u.getShaderParameter(S,u.COMPILE_STATUS))throw Error(`Could not compile fragment shader: ${u.getShaderInfoLog(S)}`);u.attachShader(this.program,S);let P=u.createShader(u.VERTEX_SHADER);if(u.isContextLost())return void(this.failedToCreate=!0);if(u.shaderSource(P,T),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={};let M={};this.numAttributes=f.length;for(let e=0;e<this.numAttributes;e++)f[e]&&(u.bindAttribLocation(this.program,e,f[e]),this.attributes[f[e]]=e);if(u.linkProgram(this.program),!u.getProgramParameter(this.program,u.LINK_STATUS))throw Error(`Program failed to link: ${u.getProgramInfoLog(this.program)}`);for(let e of(u.deleteShader(P),u.deleteShader(S),v))if(e&&!M[e]){let t=u.getUniformLocation(this.program,e);t&&(M[e]=t)}this.fixedUniforms=a(e,M),this.terrainUniforms=((e,i)=>({u_depth:new t.b_(e,i.u_depth),u_terrain:new t.b_(e,i.u_terrain),u_terrain_dim:new t.bp(e,i.u_terrain_dim),u_terrain_matrix:new t.c0(e,i.u_terrain_matrix),u_terrain_unpack:new t.c1(e,i.u_terrain_unpack),u_terrain_exaggeration:new t.bp(e,i.u_terrain_exaggeration)}))(e,M),this.projectionUniforms=((e,i)=>({u_projection_matrix:new t.c0(e,i.u_projection_matrix),u_projection_tile_mercator_coords:new t.c1(e,i.u_projection_tile_mercator_coords),u_projection_clipping_plane:new t.c1(e,i.u_projection_clipping_plane),u_projection_transition:new t.bp(e,i.u_projection_transition),u_projection_fallback_matrix:new t.c0(e,i.u_projection_fallback_matrix)}))(e,M),this.binderUniforms=r?r.getUniforms(e,M):[]}draw(e,t,i,r,a,n,s,o,l,h,u,c,p,f,m,_,g,y,x){var v;let b=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(b.TEXTURE2),b.bindTexture(b.TEXTURE_2D,o.depthTexture),e.activeTexture.set(b.TEXTURE3),b.bindTexture(b.TEXTURE_2D,o.texture),this.terrainUniforms)this.terrainUniforms[t].set(o[t]);if(l)for(let e in l)this.projectionUniforms[t7[e]].set(l[e]);if(s)for(let e in this.fixedUniforms)this.fixedUniforms[e].set(s[e]);_&&_.setUniforms(e,this.binderUniforms,f,{zoom:m});let w=0;switch(t){case b.LINES:w=2;break;case b.TRIANGLES:w=3;break;case b.LINE_STRIP:w=1}for(let i of p.get())i.vaos||(i.vaos={}),(v=i.vaos)[h]||(v[h]=new t4),i.vaos[h].bind(e,this,u,_?_.getPaintVertexBuffers():[],c,i.vertexOffset,g,y,x),b.drawElements(t,i.primitiveLength*w,b.UNSIGNED_SHORT,i.primitiveOffset*w*2)}}function it(e,i,r){let a=1/t.aK(r,1,i.transform.tileZoom),n=Math.pow(2,r.tileID.overscaledZ),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 ii=(e,i,r,a)=>{let n=e.style.light,s=n.properties.get("position"),o=[s.x,s.y,s.z],l=t.c4();"viewport"===n.properties.get("anchor")&&t.c5(l,e.transform.bearingInRadians),t.c6(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}},ir=(e,i,r,a,n,s,o)=>t.e(ii(e,i,r,a),it(s,e,o),{u_height_factor:-Math.pow(2,n.overscaledZ
798)/o.tileSize/8}),ia=(e,i,r,a)=>t.e(it(i,e,r),{u_fill_translate:a}),is=(e,t)=>({u_world:e,u_fill_translate:t}),io=(e,i,r,a,n)=>t.e(ia(e,i,r,n),{u_world:a}),il=(e,i,r,a,n)=>{let s=e.transform,o,l,h=0;if("map"===r.paint.get("circle-pitch-alignment")){let e=t.aK(i,1,s.zoom);o=!0,l=[e,e],h=e/(t.a6*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}},ih=e=>({u_pixel_extrude_scale:[1/e.width,1/e.height]}),iu=e=>({u_viewport_size:[e.width,e.height]}),ic=(e,t=1)=>({u_color:e,u_overlay:0,u_overlay_scale:t}),id=(e,i,r,a)=>{let n=t.aK(e,1,i)/(t.a6*Math.pow(2,e.tileID.overscaledZ))*2*Math.PI*a;return{u_extrude_scale:t.aK(e,1,i),u_intensity:r,u_globe_extrude_scale:n}},ip=(e,i,r,a)=>{let n=t.O();t.c7(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")}},im=(e,i,r)=>{let a,n=r.paint.get("hillshade-accent-color");switch(r.paint.get("hillshade-method")){case"basic":a=4;break;case"combined":a=1;break;case"igor":a=2;break;case"multidirectional":a=3;break;default:a=0}let s=r.getIlluminationProperties();for(let t=0;t<s.directionRadians.length;t++)"viewport"===r.paint.get("hillshade-illumination-anchor")&&(s.directionRadians[t]+=e.transform.bearingInRadians);return{u_image:0,u_latrange:function(e,i){let r=Math.pow(2,i.canonical.z),a=i.canonical.y;return[new t.a7(0,a/r).toLngLat().lat,new t.a7(0,(a+1)/r).toLngLat().lat]}(0,i.tileID),u_exaggeration:r.paint.get("hillshade-exaggeration"),u_altitudes:s.altitudeRadians,u_azimuths:s.directionRadians,u_accent:n,u_method:a,u_highlights:s.highlightColor,u_shadows:s.shadowColor}},i_=(e,i)=>{let r=i.stride,a=t.O();return t.c7(a,0,t.a6,-t.a6,0,0,1),t.Q(a,a,[0,-t.a6,0]),{u_matrix:a,u_image:1,u_dimension:[r,r],u_zoom:e.overscaledZ,u_unpack:i.getUnpackVector()}},ig=(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")}),iy=(e,i,r,a)=>{let n=e.transform;return{u_translation:iS(e,i,r),u_ratio:a/t.aK(i,1,n.zoom),u_device_pixel_ratio:e.pixelRatio,u_units_to_pixels:[1/n.pixelsToGLUnits[0],1/n.pixelsToGLUnits[1]]}},ix=(e,i,r,a,n)=>t.e(iy(e,i,r,a),{u_image:0,u_image_height:n}),iv=(e,i,r,a,n)=>{let s=e.transform,o=iT(i,s);return{u_translation:iS(e,i,r),u_texsize:i.imageAtlasTexture.size,u_ratio:a/t.aK(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]]}},ib=(e,i,r,a,n)=>{let s=iT(i,e.transform);return t.e(iy(e,i,r,a),{u_tileratio:s,u_crossfade_from:n.fromScale,u_crossfade_to:n.toScale,u_image:0,u_mix:n.t,u_lineatlas_width:e.lineAtlas.width,u_lineatlas_height:e.lineAtlas.height})},iw=(e,i,r,a,n,s)=>{let o=iT(i,e.transform);return t.e(iy(e,i,r,a),{u_image:0,u_image_height:s,u_tileratio:o,u_crossfade_from:n.fromScale,u_crossfade_to:n.toScale,u_image_dash:1,u_mix:n.t,u_lineatlas_width:e.lineAtlas.width,u_lineatlas_height:e.lineAtlas.height})};function iT(e,i){return 1/t.aK(e,1,i.tileZoom)}function iS(e,i,r){return t.aL(e.transform,i,r.paint.get("line-translate"),r.paint.get("line-translate-anchor"))}let iP=(e,t,i,r,a)=>{var n,s;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:function(e){let t=Math.sin(e*=Math.PI/180),i=Math.cos(e);return[(2*i+1)/3,(-Math.sqrt(3)*t-i+1)/3,(Math.sqrt(3)*t-i+1)/3]}(r.paint.get("raster-hue-rotate")),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]}},iM=(e,t,i,r,a,n,s,o,l,h,u,c,p)=>{let f=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:f.cameraToCenterDistance,u_pitch:f.pitch/360*2*Math.PI,u_rotate_symbol:+i,u_aspect_ratio:f.width/f.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:p}},iI=(e,i,r,a,n,s,o,l,h,u,c,p,f,m)=>{let _=o.transform;return t.e(iM(e,i,r,a,n,s,o,l,h,u,c,p,m),{u_gamma_scale:a?Math.cos(_.pitch
vendor: 20,635 bytes, line 798
798*Math.PI/180)*_.cameraToCenterDistance:1,u_device_pixel_ratio:o.pixelRatio,u_is_halo:+!!f,u_is_plain:1})},iE=(e,i,r,a,n,s,o,l,h,u,c,p,f)=>t.e(iI(e,i,r,a,n,s,o,l,h,u,!0,c,!0,f),{u_texsize_icon:p,u_texture_icon:1}),iC=(e,t)=>({u_opacity:e,u_color:t}),iA=(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),p=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.aK(a,1,r.transform.tileZoom),u_pixel_coord_upper:[c>>16,p>>16],u_pixel_coord_lower:[65535&c,65535&p]}}(r,n,i,a),{u_opacity:e}),iD=(e,t)=>{},iz={fillExtrusion:(e,i)=>({u_lightpos:new t.c2(e,i.u_lightpos),u_lightpos_globe:new t.c2(e,i.u_lightpos_globe),u_lightintensity:new t.bp(e,i.u_lightintensity),u_lightcolor:new t.c2(e,i.u_lightcolor),u_vertical_gradient:new t.bp(e,i.u_vertical_gradient),u_opacity:new t.bp(e,i.u_opacity),u_fill_translate:new t.c3(e,i.u_fill_translate)}),fillExtrusionPattern:(e,i)=>({u_lightpos:new t.c2(e,i.u_lightpos),u_lightpos_globe:new t.c2(e,i.u_lightpos_globe),u_lightintensity:new t.bp(e,i.u_lightintensity),u_lightcolor:new t.c2(e,i.u_lightcolor),u_vertical_gradient:new t.bp(e,i.u_vertical_gradient),u_height_factor:new t.bp(e,i.u_height_factor),u_opacity:new t.bp(e,i.u_opacity),u_fill_translate:new t.c3(e,i.u_fill_translate),u_image:new t.b_(e,i.u_image),u_texsize:new t.c3(e,i.u_texsize),u_pixel_coord_upper:new t.c3(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.c3(e,i.u_pixel_coord_lower),u_scale:new t.c2(e,i.u_scale),u_fade:new t.bp(e,i.u_fade)}),fill:(e,i)=>({u_fill_translate:new t.c3(e,i.u_fill_translate)}),fillPattern:(e,i)=>({u_image:new t.b_(e,i.u_image),u_texsize:new t.c3(e,i.u_texsize),u_pixel_coord_upper:new t.c3(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.c3(e,i.u_pixel_coord_lower),u_scale:new t.c2(e,i.u_scale),u_fade:new t.bp(e,i.u_fade),u_fill_translate:new t.c3(e,i.u_fill_translate)}),fillOutline:(e,i)=>({u_world:new t.c3(e,i.u_world),u_fill_translate:new t.c3(e,i.u_fill_translate)}),fillOutlinePattern:(e,i)=>({u_world:new t.c3(e,i.u_world),u_image:new t.b_(e,i.u_image),u_texsize:new t.c3(e,i.u_texsize),u_pixel_coord_upper:new t.c3(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.c3(e,i.u_pixel_coord_lower),u_scale:new t.c2(e,i.u_scale),u_fade:new t.bp(e,i.u_fade),u_fill_translate:new t.c3(e,i.u_fill_translate)}),circle:(e,i)=>({u_camera_to_center_distance:new t.bp(e,i.u_camera_to_center_distance),u_scale_with_map:new t.b_(e,i.u_scale_with_map),u_pitch_with_map:new t.b_(e,i.u_pitch_with_map),u_extrude_scale:new t.c3(e,i.u_extrude_scale),u_device_pixel_ratio:new t.bp(e,i.u_device_pixel_ratio),u_globe_extrude_scale:new t.bp(e,i.u_globe_extrude_scale),u_translate:new t.c3(e,i.u_translate)}),collisionBox:(e,i)=>({u_pixel_extrude_scale:new t.c3(e,i.u_pixel_extrude_scale)}),collisionCircle:(e,i)=>({u_viewport_size:new t.c3(e,i.u_viewport_size)}),debug:(e,i)=>({u_color:new t.b$(e,i.u_color),u_overlay:new t.b_(e,i.u_overlay),u_overlay_scale:new t.bp(e,i.u_overlay_scale)}),depth:iD,clippingMask:iD,heatmap:(e,i)=>({u_extrude_scale:new t.bp(e,i.u_extrude_scale),u_intensity:new t.bp(e,i.u_intensity),u_globe_extrude_scale:new t.bp(e,i.u_globe_extrude_scale)}),heatmapTexture:(e,i)=>({u_matrix:new t.c0(e,i.u_matrix),u_world:new t.c3(e,i.u_world),u_image:new t.b_(e,i.u_image),u_color_ramp:new t.b_(e,i.u_color_ramp),u_opacity:new t.bp(e,i.u_opacity)}),hillshade:(e,i)=>({u_image:new t.b_(e,i.u_image),u_latrange:new t.c3(e,i.u_latrange),u_exaggeration:new t.bp(e,i.u_exaggeration),u_altitudes:new t.c9(e,i.u_altitudes),u_azimuths:new t.c9(e,i.u_azimuths),u_accent:new t.b$(e,i.u_accent),u_method:new t.b_(e,i.u_method),u_shadows:new t.c8(e,i.u_shadows),u_highlights:new t.c8(e,i.u_highlights)}),hillshadePrepare:(e,i)=>({u_matrix:new t.c0(e,i.u_matrix),u_image:new t.b_(e,i.u_image),u_dimension:new t.c3(e,i.u_dimension),u_zoom:new t.bp(e,i.u_zoom),u_unpack:new t.c1(e,i.u_unpack)}),colorRelief:(e,i)=>({u_image:new t.b_(e,i.u_image),u_unpack:new t.c1(e,i.u_unpack),u_dimension:new t.c3(e,i.u_dimension),u_elevation_stops:new t.b_(e,i.u_elevation_stops),u_color_stops:new t.b_(e,i.u_color_stops),u_color_ramp_size:new t.b_(e,i.u_color_ramp_size),u_opacity:new t.bp(e,i.u_opacity)}),line:(e,i)=>({u_translation:new t.c3(e,i.u_translation),u_ratio:new t.bp(e,i.u_ratio),u_device_pixel_ratio:new t.bp(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.c3(e,i.u_units_to_pixels)}),lineGradient:(e,i)=>({u_translation:new t.c3(e,i.u_translation),u_ratio:new t.bp(e,i.u_ratio),u_device_pixel_ratio:new t.bp(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.c3(e,i.u_units_to_pixels),u_image:new t.b_(e,i.u_image),u_image_height:new t.bp(e,i.u_image_height)}),linePattern:(e,i)=>({u_translation:new t.c3(e,i.u_translation),u_texsize:new t.c3(e,i.u_texsize),u_ratio:new t.bp(e,i.u_ratio),u_device_pixel_ratio:new t.bp(e,i.u_device_pixel_ratio),u_image:new t.b_(e,i.u_image),u_units_to_pixels:new t.c3(e,i.u_units_to_pixels),u_scale:new t.c2(e,i.u_scale),u_fade:new t.bp(e,i.u_fade)}),lineSDF:(e,i)=>({u_translation:new t.c3(e,i.u_translation),u_ratio:new t.bp(e,i.u_ratio),u_device_pixel_ratio:new t.bp(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.c3(e,i.u_units_to_pixels),u_image:new t.b_(e,i.u_image),u_mix:new t.bp(e,i.u_mix),u_tileratio:new t.bp(e,i.u_tileratio),u_crossfade_from:new t.bp(e,i.u_crossfade_from),u_crossfade_to:new t.bp(e,i.u_crossfade_to),u_lineatlas_width:new t.bp(e,i.u_lineatlas_width),u_lineatlas_height:new t.bp(e,i.u_lineatlas_height)}),lineGradientSDF:(e,i)=>({u_translation:new t.c3(e,i.u_translation),u_ratio:new t.bp(e,i.u_ratio),u_device_pixel_ratio:new t.bp(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.c3(e,i.u_units_to_pixels),u_image:new t.b_(e,i.u_image),u_image_height:new t.bp(e,i.u_image_height),u_tileratio:new t.bp(e,i.u_tileratio),u_crossfade_from:new t.bp(e,i.u_crossfade_from),u_crossfade_to:new t.bp(e,i.u_crossfade_to),u_image_dash:new t.b_(e,i.u_image_dash),u_mix:new t.bp(e,i.u_mix),u_lineatlas_width:new t.bp(e,i.u_lineatlas_width),u_lineatlas_height:new t.bp(e,i.u_lineatlas_height)}),raster:(e,i)=>({u_tl_parent:new t.c3(e,i.u_tl_parent),u_scale_parent:new t.bp(e,i.u_scale_parent),u_buffer_scale:new t.bp(e,i.u_buffer_scale),u_fade_t:new t.bp(e,i.u_fade_t),u_opacity:new t.bp(e,i.u_opacity),u_image0:new t.b_(e,i.u_image0),u_image1:new t.b_(e,i.u_image1),u_brightness_low:new t.bp(e,i.u_brightness_low),u_brightness_high:new t.bp(e,i.u_brightness_high),u_saturation_factor:new t.bp(e,i.u_saturation_factor),u_contrast_factor:new t.bp(e,i.u_contrast_factor),u_spin_weights:new t.c2(e,i.u_spin_weights),u_coords_top:new t.c1(e,i.u_coords_top),u_coords_bottom:new t.c1(e,i.u_coords_bottom)}),symbolIcon:(e,i)=>({u_is_size_zoom_constant:new t.b_(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.b_(e,i.u_is_size_feature_constant),u_size_t:new t.bp(e,i.u_size_t),u_size:new t.bp(e,i.u_size),u_camera_to_center_distance:new t.bp(e,i.u_camera_to_center_distance),u_pitch:new t.bp(e,i.u_pitch),u_rotate_symbol:new t.b_(e,i.u_rotate_symbol),u_aspect_ratio:new t.bp(e,i.u_aspect_ratio),u_fade_change:new t.bp(e,i.u_fade_change),u_label_plane_matrix:new t.c0(e,i.u_label_plane_matrix),u_coord_matrix:new t.c0(e,i.u_coord_matrix),u_is_text:new t.b_(e,i.u_is_text),u_pitch_with_map:new t.b_(e,i.u_pitch_with_map),u_is_along_line:new t.b_(e,i.u_is_along_line),u_is_variable_anchor:new t.b_(e,i.u_is_variable_anchor),u_texsize:new t.c3(e,i.u_texsize),u_texture:new t.b_(e,i.u_texture),u_translation:new t.c3(e,i.u_translation),u_pitched_scale:new t.bp(e,i.u_pitched_scale)}),symbolSDF:(e,i)=>({u_is_size_zoom_constant:new t.b_(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.b_(e,i.u_is_size_feature_constant),u_size_t:new t.bp(e,i.u_size_t),u_size:new t.bp(e,i.u_size),u_camera_to_center_distance:new t.bp(e,i.u_camera_to_center_distance),u_pitch:new t.bp(e,i.u_pitch),u_rotate_symbol:new t.b_(e,i.u_rotate_symbol),u_aspect_ratio:new t.bp(e,i.u_aspect_ratio),u_fade_change:new t.bp(e,i.u_fade_change),u_label_plane_matrix:new t.c0(e,i.u_label_plane_matrix),u_coord_matrix:new t.c0(e,i.u_coord_matrix),u_is_text:new t.b_(e,i.u_is_text),u_pitch_with_map:new t.b_(e,i.u_pitch_with_map),u_is_along_line:new t.b_(e,i.u_is_along_line),u_is_variable_anchor:new t.b_(e,i.u_is_variable_anchor),u_texsize:new t.c3(e,i.u_texsize),u_texture:new t.b_(e,i.u_texture),u_gamma_scale:new t.bp(e,i.u_gamma_scale),u_device_pixel_ratio:new t.bp(e,i.u_device_pixel_ratio),u_is_halo:new t.b_(e,i.u_is_halo),u_is_plain:new t.b_(e,i.u_is_plain),u_translation:new t.c3(e,i.u_translation),u_pitched_scale:new t.bp(e,i.u_pitched_scale)}),symbolTextAndIcon:(e,i)=>({u_is_size_zoom_constant:new t.b_(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.b_(e,i.u_is_size_feature_constant),u_size_t:new t.bp(e,i.u_size_t),u_size:new t.bp(e,i.u_size),u_camera_to_center_distance:new t.bp(e,i.u_camera_to_center_distance),u_pitch:new t.bp(e,i.u_pitch),u_rotate_symbol:new t.b_(e,i.u_rotate_symbol),u_aspect_ratio:new t.bp(e,i.u_aspect_ratio),u_fade_change:new t.bp(e,i.u_fade_change),u_label_plane_matrix:new t.c0(e,i.u_label_plane_matrix),u_coord_matrix:new t.c0(e,i.u_coord_matrix),u_is_text:new t.b_(e,i.u_is_text),u_pitch_with_map:new t.b_(e,i.u_pitch_with_map),u_is_along_line:new t.b_(e,i.u_is_along_line),u_is_variable_anchor:new t.b_(e,i.u_is_variable_anchor),u_texsize:new t.c3(e,i.u_texsize),u_texsize_icon:new t.c3(e,i.u_texsize_icon),u_texture:new t.b_(e,i.u_texture),u_texture_icon:new t.b_(e,i.u_texture_icon),u_gamma_scale:new t.bp(e,i.u_gamma_scale),u_device_pixel_ratio:new t.bp(e,i.u_device_pixel_ratio),u_is_halo:new t.b_(e,i.u_is_halo),u_translation:new t.c3(e,i.u_translation),u_pitched_scale:new t.bp(e,i.u_pitched_scale)}),background:(e,i)=>({u_opacity:new t.bp(e,i.u_opacity),u_color:new t.b$(e,i.u_color)}),backgroundPattern:(e,i)=>({u_opacity:new t.bp(e,i.u_opacity),u_image:new t.b_(e,i.u_image),u_pattern_tl_a:new t.c3(e,i.u_pattern_tl_a),u_pattern_br_a:new t.c3(e,i.u_pattern_br_a),u_pattern_tl_b:new t.c3(e,i.u_pattern_tl_b),u_pattern_br_b:new t.c3(e,i.u_pattern_br_b),u_texsize:new t.c3(e,i.u_texsize),u_mix:new t.bp(e,i.u_mix),u_pattern_size_a:new t.c3(e,i.u_pattern_size_a),u_pattern_size_b:new t.c3(e,i.u_pattern_size_b),u_scale_a:new t.bp(e,i.u_scale_a),u_scale_b:new t.bp(e,i.u_scale_b),u_pixel_coord_upper:new t.c3(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.c3(e,i.u_pixel_coord_lower),u_tile_units_to_pixels:new t.bp(e,i.u_tile_units_to_pixels)}),terrain:(e,i)=>({u_texture:new t.b_(e,i.u_texture),u_ele_delta:new t.bp(e,i.u_ele_delta),u_fog_matrix:new t.c0(e,i.u_fog_matrix),u_fog_color:new t.b$(e,i.u_fog_color),u_fog_ground_blend:new t.bp(e,i.u_fog_ground_blend),u_fog_ground_blend_opacity:new t.bp(e,i.u_fog_ground_blend_opacity),u_horizon_color:new t.b$(e,i.u_horizon_color),u_horizon_fog_blend:new t.bp(e,i.u_horizon_fog_blend),u_is_globe_mode:new t.bp(e,i.u_is_globe_mode)}),terrainDepth:(e,i)=>({u_ele_delta:new t.bp(e,i.u_ele_delta)}),terrainCoords:(e,i)=>({u_texture:new t.b_(e,i.u_texture),u_terrain_coords_id:new t.bp(e,i.u_terrain_coords_id),u_ele_delta:new t.bp(e,i.u_ele_delta)}),projectionErrorMeasurement:(e,i)=>({u_input:new t.bp(e,i.u_input),u_output_expected:new t.bp(e,i.u_output_expected)}),atmosphere:(e,i)=>({u_sun_pos:new t.c2(e,i.u_sun_pos),u_atmosphere_blend:new t.bp(e,i.u_atmosphere_blend),u_globe_position:new t.c2(e,i.u_globe_position),u_globe_radius:new t.bp(e,i.u_globe_radius),u_inv_proj_matrix:new t.c0(e,i.u_inv_proj_matrix)}),sky:(e,i)=>({u_sky_color:new t.b$(e,i.u_sky_color),u_horizon_color:new t.b$(e,i.u_horizon_color),u_horizon:new t.c3(e,i.u_horizon),u_horizon_normal:new t.c3(e,i.u_horizon_normal),u_sky_horizon_blend:new t.bp(e,i.u_sky_horizon_blend),u_sky_blend:new t.bp(e,i.u_sky_blend)})};class ik{constructor(e,t,i){this.context=e;let 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||t.freeBufferAfterUpload()}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 iR={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class iL{constructor(e,t,i,r){this.length=t.length,this.attributes=i,this.itemSize=t.bytesPerElement,this.dynamicDraw=r,this.context=e;let 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||t.freeBufferAfterUpload()}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)}enableAttributes(e,t){for(let i of this.attributes){let r=t.attributes[i.name];void 0!==r&&e.enableVertexAttribArray(r)}}setVertexAttribPointers(e,t,i){for(let r of this.attributes){let a=t.attributes[r.name];void 0!==a&&e.vertexAttribPointer(a,r.components,e[iR[r.type]],!1,this.itemSize,r.offset+this.itemSize*(i||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class iF{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 iB extends iF{getDefault(){return t.bo.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 iO extends iF{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}}class iV extends iF{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}}class ij extends iF{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 iN extends iF{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}}class iU extends iF{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}}class iG extends iF{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 i$ extends iF{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 iZ extends iF{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 iq extends iF{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 iW extends iF{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 iH extends iF{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}}class iX extends iF{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 iY extends iF{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 iK extends iF{getDefault(){return t.bo.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 iJ extends iF{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}}class iQ extends iF{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 i0 extends iF{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}}class i1 extends iF{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}}class i2 extends iF{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}}class i3 extends iF{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}}class i5 extends iF{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 i6 extends iF{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 i4 extends iF{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 i8 extends iF{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 i7 extends iF{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 i9 extends iF{getDefault(){return null}set(e){let t=this.gl;t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class re extends iF{getDefault(){return null}set(e){var t;if(e===this.current&&!this.dirty)return;let i=this.gl;tE(i)?i.bindVertexArray(e):null==(t=i.getExtension("OES_vertex_array_object"))||t.bindVertexArrayOES(e),this.current=e,this.dirty=!1}}class rt extends iF{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 ri extends iF{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 rr extends iF{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 ra extends iF{constructor(e,t){super(e),this.context=e,this.parent=t}getDefault(){return null}}class rn extends ra{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 rs extends ra{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 ro extends ra{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 rl="Framebuffer is not complete";class rh{constructor(e,t,i,r,a){this.context=e,this.width=t,this.height=i;let n=e.gl,s=this.framebuffer=n.createFramebuffer();
798if(this.colorAttachment=new rn(e,s),r)this.depthAttachment=a?new ro(e,s):new rs(e,s);else if(a)throw Error("Stencil cannot be set without depth");if(n.checkFramebufferStatus(n.FRAMEBUFFER)!==n.FRAMEBUFFER_COMPLETE)throw Error(rl)}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 ru{constructor(e){var t,i;if(this.gl=e,this.clearColor=new iB(this),this.clearDepth=new iO(this),this.clearStencil=new iV(this),this.colorMask=new ij(this),this.depthMask=new iN(this),this.stencilMask=new iU(this),this.stencilFunc=new iG(this),this.stencilOp=new i$(this),this.stencilTest=new iZ(this),this.depthRange=new iq(this),this.depthTest=new iW(this),this.depthFunc=new iH(this),this.blend=new iX(this),this.blendFunc=new iY(this),this.blendColor=new iK(this),this.blendEquation=new iJ(this),this.cullFace=new iQ(this),this.cullFaceSide=new i0(this),this.frontFace=new i1(this),this.program=new i2(this),this.activeTexture=new i3(this),this.viewport=new i5(this),this.bindFramebuffer=new i6(this),this.bindRenderbuffer=new i4(this),this.bindTexture=new i8(this),this.bindVertexBuffer=new i7(this),this.bindElementBuffer=new i9(this),this.bindVertexArray=new re(this),this.pixelStoreUnpack=new rt(this),this.pixelStoreUnpackPremultiplyAlpha=new ri(this),this.pixelStoreUnpackFlipY=new rr(this),this.extTextureFilterAnisotropic=e.getExtension("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),tE(e)){this.HALF_FLOAT=e.HALF_FLOAT;let 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");let 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 ik(this,e,t)}createVertexBuffer(e,t,i){return new iL(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 rh(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.bQ(e.blendFunction,tS.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 tE(this.gl)?this.gl.createVertexArray():null==(e=this.gl.getExtension("OES_vertex_array_object"))?void 0:e.createVertexArrayOES()}deleteVertexArray(e){var t;tE(this.gl)?this.gl.deleteVertexArray(e):null==(t=this.gl.getExtension("OES_vertex_array_object"))||t.deleteVertexArrayOES(e)}unbindVAO(){this.bindVertexArray.set(null)}}function rc(e,i,r,a,n){var s,o;let h=e.context,u=e.transform,c=h.gl,p=e.useProgram("collisionBox"),f=[],m=0,_=0;for(let t of a){let a=i.getTile(t).getBucket(r);
798if(!a)continue;let o=n?a.textCollisionBox:a.iconCollisionBox,l=a.collisionCircleArray;l.length>0&&(f.push({circleArray:l,circleOffset:_,coord:t}),m+=l.length/4,_=m),o&&p.draw(h,c.LINES,tM.disabled,tI.disabled,e.colorModeForRenderPass(),tP.disabled,ih(e.transform),null==(s=e.style.map.terrain)?void 0:s.getTerrainData(t),u.getProjectionData({overscaledTileID:t,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),r.id,o.layoutVertexBuffer,o.indexBuffer,o.segments,null,e.transform.zoom,null,null,o.collisionVertexBuffer)}if(!n||!f.length)return;let g=e.useProgram("collisionCircle"),y=new t.ca;y.resize(4*m),y._trim();let x=0;for(let e of f)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];y.emplace(x++,r,a,n,s,0),y.emplace(x++,r,a,n,s,1),y.emplace(x++,r,a,n,s,2),y.emplace(x++,r,a,n,s,3)}(!l||l.length<2*m)&&(l=function(e){let i=2*e,r=new t.cc;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}(m));let v=h.createIndexBuffer(l,!0),b=h.createVertexBuffer(y,t.cb.members,!0);for(let i of f){let a=iu(e.transform);g.draw(h,c.TRIANGLES,tM.disabled,tI.disabled,e.colorModeForRenderPass(),tP.disabled,a,null==(o=e.style.map.terrain)?void 0:o.getTerrainData(i.coord),null,r.id,b,v,t.aV.simpleSegment(0,2*i.circleOffset,i.circleArray.length,i.circleArray.length/2),null,e.transform.zoom,null,null,null)}b.destroy(),v.destroy()}let rd=t.ap(new Float32Array(16));function rp(e,i,r,a,n,s,o,l,h,u,c,p,f){var m,_;let g=e.context,y=g.gl,x=e.transform,v="map"===l,b="map"===h,w="viewport"!==l&&"point"!==r.layout.get("symbol-placement"),T=v&&!b&&!w,S=!r.layout.get("symbol-sort-key").isConstant(),P=!1,M=e.getDepthModeForSublayer(0,tM.ReadOnly),I=r._unevaluatedLayout.hasValue("text-variable-anchor")||r._unevaluatedLayout.hasValue("text-variable-anchor-offset"),E=[],C=x.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(!(null!=c&&c.segments.get().length)||!c.hasVisibleVertices)continue;let p=c.programConfigurations.get(r.id),_=n||h.sdfIcons,g=n?h.textSizeData:h.iconSizeData,M=b||0!==x.pitch,A=e.useProgram(h.iconsInText&&n?"symbolTextAndIcon":_?"symbolSDF":"symbolIcon",p),D=t.aw(g,x.zoom),z=null==(m=e.style.map.terrain)?void 0:m.getTerrainData(l),k,R,L,F,B=[0,0],O=null;if(n)R=a.glyphAtlasTexture,L=y.LINEAR,k=a.glyphAtlasTexture.size,h.iconsInText&&(B=a.imageAtlasTexture.size,O=a.imageAtlasTexture,F=M||e.options.rotating||e.options.zooming||"composite"===g.kind||"camera"===g.kind?y.LINEAR:y.NEAREST);else{let t=1!==r.layout.get("icon-size").constantOr(0)||h.iconsNeedLinear;R=a.imageAtlasTexture,L=_||e.options.rotating||e.options.zooming||t||M?y.LINEAR:y.NEAREST,k=a.imageAtlasTexture.size}let V=t.aK(a,1,e.transform.zoom),j=eR(v,e.transform,V),N=function(e,i,r,a){if(e){let e=t.O();if(!i){let{vecSouth:t,vecEast:i}=eL(r);e[0]=i[0],e[1]=i[1],e[4]=t[0],e[5]=t[1]}return t.S(e,e,[a,a,1]),e}return r.pixelsToClipSpaceMatrix}(b,v,e.transform,V),U=t.aL(x,a,s,o),G=x.getProjectionData({overscaledTileID:l,applyGlobeMatrix:!f,applyTerrainMatrix:!0}),$=I&&h.hasTextData(),Z="none"!==r.layout.get("icon-text-fit")&&$&&h.hasIconData();if(w){let i=t.O();!function(e,t){let i=1/(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]),r=1/(t[8]*t[8]+t[9]*t[9]+t[10]*t[10]),a=t[0]*i,n=t[4]*i,s=t[8]*r,o=t[1]*i,l=t[5]*i,h=t[9]*r,u=t[2]*i,c=t[6]*i,p=t[10]*r;e[0]=a,e[1]=n,e[2]=s,e[4]=o,e[5]=l,e[6]=h,e[8]=u,e[9]=c,e[10]=p;let f=t[12],m=t[13],_=t[14];e[12]=-a*f-o*m-u*_,e[13]=-n*f-l*m-c*_,e[14]=-s*f-h*m-p*_,e[3]=0,e[7]=0,e[11]=0,e[15]=1}(i,j);let a=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,p,f){let m=r?e.textSizeData:e.iconSizeData,_=t.aw(m,i.transform.zoom),g=[256/i.width*2+1,256/i.height*2+1],y=r?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;y.clear();let x=e.lineVertexArray,v=r?e.text.placedSymbolArray:e.icon.placedSymbolArray,b=i.transform.width/i.transform.height,w=!1;for(let r=0;r<v.length;r++){var T;let S=v.get(r);if(S.hidden||S.writingMode===t.ax.vertical&&!w){eH(S.numGlyphs,y);continue}w=!1;let P=new t.P(S.anchorX,S.anchorY),M={getElevation:f,pitchedLabelPlaneMatr
798ix:a,lineVertexArray:x,pitchWithMap:s,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:i.transform,tileAnchorPoint:P,unwrappedTileID:h,width:u,height:c,translation:p},I=e$(S.anchorX,S.anchorY,M);if(T=I.point,!(T.x>=-g[0]&&T.x<=g[0]&&T.y>=-g[1])||!(T.y<=g[1])){eH(S.numGlyphs,y);continue}let E=.5+i.transform.cameraToCenterDistance/I.signedDistanceFromCamera*.5,C=t.ay(m,_,S),A=s?C*i.transform.getPitchedTextCorrection(S.anchorX,S.anchorY,h)/E:C*E,D=eV({projectionContext:M,pitchedLabelPlaneMatrixInverse:n,symbol:S,fontSize:A,flip:!1,keepUpright:o,glyphOffsetArray:e.glyphOffsetArray,dynamicLayoutVertexArray:y,aspectRatio:b,rotateToLine:l});w=D.useVertical,(D.notEnoughRoom||w||D.needsFlipping&&eV({projectionContext:M,pitchedLabelPlaneMatrixInverse:n,symbol:S,fontSize:A,flip:!0,keepUpright:o,glyphOffsetArray:e.glyphOffsetArray,dynamicLayoutVertexArray:y,aspectRatio:b,rotateToLine:l}).notEnoughRoom)&&eH(S.numGlyphs,y)}r?e.text.dynamicLayoutVertexBuffer.updateData(y):e.icon.dynamicLayoutVertexBuffer.updateData(y)}(h,e,n,j,i,b,u,"map"===r.layout.get("text-rotation-alignment"),l.toUnwrapped(),x.width,x.height,U,a)}let q=n&&I||Z,W=w||q?rd:b?j:e.transform.clipSpaceToPixelsMatrix,H=_&&0!==r.paint.get(n?"text-halo-width":"icon-halo-width").constantOr(1),X={program:A,buffers:c,uniformValues:_?h.iconsInText?iE(g.kind,D,T,b,w,q,e,W,N,U,k,B,C):iI(g.kind,D,T,b,w,q,e,W,N,U,n,k,H,C):iM(g.kind,D,T,b,w,q,e,W,N,U,n,k,C),projectionData:G,atlasTexture:R,atlasTextureIcon:O,atlasInterpolation:L,atlasInterpolationIcon:F,isSDF:_,hasHalo:H};if(S&&h.canOverlap)for(let e of(P=!0,c.segments.get()))E.push({segments:new t.aV([e]),sortKey:e.sortKey,state:X,terrainData:z});else E.push({segments:c.segments,sortKey:0,state:X,terrainData:z})}P&&E.sort((e,t)=>
798e.sortKey-t.sortKey);let A=null!=(_=r.paint.get(n?"text-halo-width":"icon-halo-width").constantOr(null))?_:1/0,D=r.layout.get("text-letter-spacing").constantOr(0)*t.aJ<0||A>1;for(let t of E){let i=t.state;g.activeTexture.set(y.TEXTURE0),i.atlasTexture.bind(i.atlasInterpolation,y.CLAMP_TO_EDGE),i.atlasTextureIcon&&(g.activeTexture.set(y.TEXTURE1),i.atlasTextureIcon&&i.atlasTextureIcon.bind(i.atlasInterpolationIcon,y.CLAMP_TO_EDGE));let a=i.isSDF&&i.hasHalo;if(a){let a=i.uniformValues;a.u_is_halo=1,D&&(a.u_is_plain=0,rf(i.buffers,t.segments,r,e,i.program,M,c,p,a,i.projectionData,t.terrainData),a.u_is_halo=0,a.u_is_plain=1)}rf(i.buffers,t.segments,r,e,i.program,M,c,p,i.uniformValues,i.projectionData,t.terrainData),a&&!D&&(i.uniformValues.u_is_halo=0)}}function rf(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 rm(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
798INEAR),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 r_(e,i){return i.colorRampTexture||(i.colorRampTexture=new t.T(e,i.colorRamp,e.gl.RGBA)),i.colorRampTexture}function rg(e,i,r,a,n,s,o,l){let h=256;if(n.stepInterpolant){let a=i.getSource().maxzoom,n=o.canonical.z===a?Math.ceil(1<<e.transform.maxZoom-o.canonical.z):1;h=t.al(t.ce(s.maxLineLength/t.a6*1024*n),256,r.maxTextureSize)}return l.gradient=t.cf({expression:n.gradientExpression(),evaluationKey:"lineProgress",resolution:h,image:l.gradient||void 0,clips:s.lineClipsArray}),l.texture?l.texture.update(l.gradient):l.texture=new t.T(r,l.gradient,a.RGBA),l.version=n.gradientVersion,l.texture}function ry(e,t,i,r,a){if(!i||!(null!=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 rx(e,i,r,a,n,s,o,l){var h;let u,c,p,f,m,_=e.context.gl,g="fill-pattern",y=r.paint.get(g),x=null==y?void 0:y.constantOr(1),v=r.getCrossfadeParameters(),b=e.transform,w=r.paint.get("fill-translate"),T=r.paint.get("fill-translate-anchor");o?(c=x&&!r.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",u=_.LINES):(c=x?"fillPattern":"fill",u=_.TRIANGLES);let S=y.constantOr(null);for(let y of a){let a=i.getTile(y);if(x&&!a.patternsLoaded())continue;let P=a.getBucket(r);if(!P)continue;let M=P.programConfigurations.get(r.id),I=e.useProgram(c,M),E=null==(h=e.style.map.terrain)?void 0:h.getTerrainData(y);x&&(e.context.activeTexture.set(_.TEXTURE0),a.imageAtlasTexture.bind(_.LINEAR,_.CLAMP_TO_EDGE),M.updatePaintBuffers(v)),ry(M,g,S,a,r);let C=b.getProjectionData({overscaledTileID:y,applyGlobeMatrix:!l,applyTerrainMatrix:!0}),A=t.aL(b,a,w,T);if(o){f=P.indexBuffer2,m=P.segments2;let t=[_.drawingBufferWidth,_.drawingBufferHeight];p="fillOutlinePattern"===c&&x?io(e,v,a,t,A):is(t,A)}else f=P.indexBuffer,m=P.segments,p=x?ia(e,v,a,A):{u_fill_translate:A};let D=e.stencilModeForClipping(y);I.draw(e.context,u,n,D,s,tP.backCCW,p,E,C,r.id,P.layoutVertexBuffer,f,m,r.paint,e.transform.zoom,M)}}function rv(e,i,r,a,n,s,o,l){var h;let u=e.context,c=u.gl,p="fill-extrusion-pattern",f=r.paint.get(p),m=f.constantOr(1),_=r.getCrossfadeParameters(),g=r.paint.get("fill-extrusion-opacity"),y=f.constantOr(null),x=e.transform;for(let f of a){let a=i.getTile(f),v=a.getBucket(r);if(!v)continue;let b=null==(h=e.style.map.terrain)?void 0:h.getTerrainData(f),w=v.programConfigurations.get(r.id),T=e.useProgram(m?"fillExtrusionPattern":"fillExtrusion",w);m&&(e.context.activeTexture.set(c.TEXTURE0),a.imageAtlasTexture.bind(c.LINEAR,c.CLAMP_TO_EDGE),w.updatePaintBuffers(_));let S=x.getProjectionData({overscaledTileID:f,applyGlobeMatrix:!l,applyTerrainMatrix:!0});ry(w,p,y,a,r);let P=t.aL(x,a,r.paint.get("fill-extrusion-translate"),r.paint.get("fill-extrusion-translate-anchor")),M=r.paint.get("fill-extrusion-vertical-gradient"),I=m?ir(e,M,g,P,f,_,a):ii(e,M,g,P);T.draw(u,u.gl.TRIANGLES,n,s,o,tP.backCCW,I,b,S,r.id,v.layoutVertexBuffer,v.indexBuffer,v.segments,r.paint,e.transform.zoom,w,e.style.map.terrain&&v.centroidVertexBuffer)}}function rb(e,t,i,r,a,n,s,o,l){var h;let u=e.style.projection,c=e.context,p=e.transform,f=c.gl,m=[`#define NUM_ILLUMINATION_SOURCES ${i.paint.get("hillshade-highlight-color").values.length}`],_=e.useProgram("hillshade",null,!1,m),g=!e.options.moving;for(let m of r){let r=t.getTile(m),y=r.fbo;if(!y)continue;let x=u.getMeshFromTileID(c,m.canonical,o,!0,"raster"),v=null==(h=e.style.map.terrain)?void 0:h.getTerrainData(m);c.activeTexture.set(f.TEXTURE0),f.bindTexture(f.TEXTURE_2D,y.colorAttachment.get());let b=p.getProjectionData({overscaledTileID:m,aligned:g,applyGlobeMatrix:!l,applyTerrainMatrix:!0});_.draw(c,f.TRIANGLES,n,a[m.overscaledZ],s,tP.backCCW,im(e,r,i),v,b,i.id,x.vertexBuffer,x.indexBuffer,x.segments)}}let rw=0;function rT(e,i,r,a,n,s,o,l,h){var u;
798let c=e.style.projection,p=e.context,f=e.transform,m=p.gl,_=e.useProgram("colorRelief"),g=!e.options.moving,y="nearest"===r.paint.get("resampling")?m.NEAREST:m.LINEAR,x=!0,v=0;for(let b of a){let a=i.getTile(b),w=a.dem;if(x){rw||(rw=m.getParameter(m.MAX_TEXTURE_SIZE));let e=rw,{elevationTexture:t,colorTexture:i}=r.getColorRampTextures(p,e,w.getUnpackVector());p.activeTexture.set(m.TEXTURE1),t.bind(m.NEAREST,m.CLAMP_TO_EDGE),p.activeTexture.set(m.TEXTURE4),i.bind(m.LINEAR,m.CLAMP_TO_EDGE),x=!1,v=t.size[0]}if(!(null!=w&&w.data))continue;let T=w.stride,S=w.getPixels();if(p.activeTexture.set(m.TEXTURE0),p.pixelStoreUnpackPremultiplyAlpha.set(!1),a.demTexture||(a.demTexture=e.getTileTexture(T)),a.demTexture){let e=a.demTexture;e.update(S,{premultiply:!1}),e.bind(y,m.CLAMP_TO_EDGE)}else a.demTexture=new t.T(p,S,m.RGBA,{premultiply:!1}),a.demTexture.bind(y,m.CLAMP_TO_EDGE);let P=c.getMeshFromTileID(p,b.canonical,l,!0,"raster"),M=null==(u=e.style.map.terrain)?void 0:u.getTerrainData(b),I=f.getProjectionData({overscaledTileID:b,aligned:g,applyGlobeMatrix:!h,applyTerrainMatrix:!0});_.draw(p,m.TRIANGLES,s,n[b.overscaledZ],o,tP.backCCW,ig(r,a.dem,v),M,I,r.id,P.vertexBuffer,P.indexBuffer,P.segments)}}let rS=[new t.P(0,0),new t.P(t.a6,0),new t.P(t.a6,t.a6),new t.P(0,t.a6)];function rP(e,i,r,a,n,s,o,l,h=!1,u=!1){var c;let p=a[a.length-1].overscaledZ,f=e.context,m=f.gl,g=e.useProgram("raster"),y=e.transform,x=e.style.projection,v=e.colorModeForRenderPass(),w=!e.options.moving,T=r.paint.get("raster-opacity"),S="nearest"===r.paint.get("resampling")||"nearest"===r.paint.get("raster-resampling")?m.NEAREST:m.LINEAR,P=r.paint.get("raster-fade-duration"),M=!!e.style.map.terrain;for(let I of a){let a=e.getDepthModeForSublayer(I.overscaledZ-p,1===T?tM.ReadWrite:tM.ReadOnly,m.LESS),E=i.getTile(I);f.activeTexture.set(m.TEXTURE0),E.texture.bind(S,m.CLAMP_TO_EDGE,m.LINEAR_MIPMAP_NEAREST),f.activeTexture.set(m.TEXTURE1);let{parentTile:C,parentScaleBy:A,parentTopLeft:D,fadeValues:z}=function(e,i,r,a){let n={parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:{tileOpacity:1,parentTileOpacity:1,fadeMix:{opacity:1,mix:0}}};if(0===r||a)return n;if(e.fadingParentID){let a=i.getLoadedTile(e.fadingParentID);if(!a)return n;let s=Math.pow(2,a.tileID.overscaledZ-e.tileID.overscaledZ),o=[e.tileID.canonical.x*s%1,e.tileID.canonical.y*s%1],l=function(e,i,r){let a=b(),n=(a-i.timeAdded)/r,s=e.fadingDirection===_.Incoming,o=t.al((a-e.timeAdded)/r,0,1),l=t.al(1-n,0,1),h=s?o:l;return{tileOpacity:h,parentTileOpacity:s?l:o,fadeMix:{opacity:1,mix:1-h}}}(e,a,r);return{parentTile:a,parentScaleBy:s,parentTopLeft:o,fadeValues:l}}return e.selfFading?{parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:function(e,i){let r=(b()-e.timeAdded)/i,a=t.al(r,0,1);return{tileOpacity:a,fadeMix:{opacity:a,mix:0}}}(e,r)}:n}(E,i,P,M);E.fadeOpacity=z.tileOpacity,C?(C.fadeOpacity=z.parentTileOpacity,C.texture.bind(S,m.CLAMP_TO_EDGE,m.LINEAR_MIPMAP_NEAREST)):E.texture.bind(S,m.CLAMP_TO_EDGE,m.LINEAR_MIPMAP_NEAREST),E.texture.useMipmap&&f.extTextureFilterAnisotropic&&e.transform.pitch>e.options.anisotropicFilterPitch&&m.texParameterf(m.TEXTURE_2D,f.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,f.extTextureFilterAnisotropicMax);let k=null==(c=e.style.map.terrain)?void 0:c.getTerrainData(I),R=y.getProjectionData({overscaledTileID:I,aligned:w,applyGlobeMatrix:!u,applyTerrainMatrix:!0}),L=iP(D,A,z.fadeMix,r,l),F=x.getMeshFromTileID(f,I.canonical,s,o,"raster");g.draw(f,m.TRIANGLES,a,n?n[I.overscaledZ]:tI.disabled,v,h?tP.frontCCW:tP.backCCW,L,k,R,r.id,F.vertexBuffer,F.indexBuffer,F.segments)}}let rM=new t.bo(1,0,0,1),rI=new t.bo(0,1,0,1),rE=new t.bo(0,0,1,1),rC=new t.bo(1,0,1,1),rA=new t.bo(0,1,1,1);function rD(e,t,i,r){rk(e,0,t+i/2,e.transform.width,i,r)}function rz(e,t,i,r){rk(e,t-i/2,0,i,e.transform.height,r)}function rk(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 rR(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),p=t.getTerrainData(r.tileID);n.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,c.texture);let f=t8(t.getMeshFrameDelta(o.zoom),o.calculateFogMatrix(r.tileID.toUnwrapped()),e.style.sky,o.pitch,a),m=o.getProjectionData({overscaledTileID:r.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});u.draw(n,s.TRIANGLES,h,tI.disabled,l,tP.backCCW,f,p,m,"terrain",i.vertexBuffer,i.indexBuffer,i.segments)}}function rL(e,i){if(!i.mesh){let r=new t.aU;r.emplaceBack(-1,-1),r.emplaceBack(1,-1),r.emplaceBack(1,1),r.emplaceBack(-1,1);let a=new t.aW;a.emplaceBack(0,1,2),a.emplaceBack(0,2,3),i.mesh=new to(e.createVertexBuffer(r,tl.members),e.createIndexBuffer(a),t.aV.simpleSegment(0,0,r.length,a.length))}return i.mesh}
798let rF={symbol:function(e,i,r,a,n,s){if("translucent"!==e.renderPass)return;let{isRenderingToTexture:o}=s,l=tI.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){var u;let c=i.transform,p=i.style.map.terrain,f="map"===n,m="map"===s;for(let n of e){let e=a.getTile(n),s=e.getBucket(r);if(!(null!=(u=null==s?void 0:s.text)&&u.segments.get().length))continue;let _=t.aw(s.textSizeData,c.zoom),g=t.aK(e,1,i.transform.zoom),y=eR(f,i.transform,g),x="none"!==r.layout.get("icon-text-fit")&&s.hasIconData();if(_){let i=Math.pow(2,c.zoom-e.tileID.overscaledZ),r=p?(e,t)=>p.getElevation(n,e,t):null;!function(e,i,r,a,n,s,o,l,h,u,c,p){let f=e.text.placedSymbolArray,m=e.text.dynamicLayoutVertexArray,_=e.icon.dynamicLayoutVertexArray,g={};m.clear();for(let _=0;_<f.length;_++){let y=f.get(_),x=y.hidden||!y.crossTileID||e.allowVerticalPlacement&&!y.placedOrientation?null:a[y.crossTileID];if(x){let a=new t.P(y.anchorX,y.anchorY),f={getElevation:p,width:n.width,height:n.height,pitchedLabelPlaneMatrix:s,pitchWithMap:r,transform:n,tileAnchorPoint:a,translation:u,unwrappedTileID:c},_=r?e$(a.x,a.y,f):eU(a.x,a.y,f),v=.5+n.cameraToCenterDistance/_.signedDistanceFromCamera*.5,b=t.ay(e.textSizeData,l,y)*v/t.aJ;r&&(b*=e.tilePixelRatio/o);let{width:w,height:T,anchor:S,textOffset:P,textBoxScale:M}=x,I=function(e,i,r,a,n,s){let{horizontalAlign:o,verticalAlign:l}=t.aP(e);return new t.P((-(o-.5)*i/n+a[0])*s,(-(l-.5)*r/n+a[1])*s)}(S,w,T,P,M,b),E=n.getPitchedTextCorrection(a.x+u[0],a.y+u[1],c),C=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 eF(t.x,t.y,i.pitchedLabelPlaneMatrix,i.getElevation).point}if(r){let t=eU(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)}(_.point,f,i,I,-n.bearingInRadians,E),A=e.allowVerticalPlacement&&y.placedOrientation===t.ax.vertical?Math.PI/2:0;for(let e=0;e<y.numGlyphs;e++)t.aD(m,C,A);h&&y.associatedIconIndex>=0&&(g[y.associatedIconIndex]={shiftedAnchor:C,angle:A})}else eH(y.numGlyphs,m)}if(h){_.clear();let i=e.icon.placedSymbolArray;for(let e=0;e<i.length;e++){let r=i.get(e);if(r.hidden)eH(r.numGlyphs,_);else{let i=g[e];if(i)for(let e=0;e<r.numGlyphs;e++)t.aD(_,i.shiftedAnchor,i.angle);else eH(r.numGlyphs,_)}}e.icon.dynamicLayoutVertexBuffer.updateData(_)}e.text.dynamicLayoutVertexBuffer.updateData(m)}(s,f,m,h,c,y,i,_,x,t.aL(c,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)&&rp(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)&&rp(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&&(rc(e,i,r,a,!0),rc(e,i,r,a,!1))},circle:function(e,i,r,a,n){var s;if("translucent"!==e.renderPass)return;let{isRenderingToTexture:o}=n,l=r.paint.get("circle-opacity"),h=r.paint.get("circle-stroke-width"),u=r.paint.get("circle-stroke-opacity"),c=!r.layout.get("circle-sort-key").isConstant();if(0===l.constantOr(1)&&(0===h.constantOr(1)||0===u.constantOr(1)))return;let p=e.context,f=p.gl,m=e.transform,_=e.getDepthModeForSublayer(0,tM.ReadOnly),g=tI.disabled,y=e.colorModeForRenderPass(),x=[],v=m.getCircleRadiusCorrection();for(let n of a){let a=i.getTile(n),l=a.getBucket(r);if(!l)continue;let h=r.paint.get("circle-translate"),u=r.paint.get("circle-translate-anchor"),p=t.aL(m,a,h,u),f=l.programConfigurations.get(r.id),_=e.useProgram("circle",f),g=l.layoutVertexBuffer,y=l.indexBuffer,b=null==(s=e.style.map.terrain)?void 0:s.getTerrainData(n),w={programConfiguration:f,program:_,layoutVertexBuffer:g,indexBuffer:y,uniformValues:il(e,a,r,p,v),terrainData:b,projectionData:m.getProjectionData({overscaledTileID:n,applyGlobeMatrix:!o,applyTerrainMatrix:!0})};if(c)for(let e of l.segments.get())x.push({segments:new t.aV([e]),sortKey:e.sortKey,state:w});else x.push({segments:l.segments,sortKey:0,state:w})}for(let t of(c&&x.sort((e,t)=>
798e.sortKey-t.sortKey),x)){let{programConfiguration:i,program:a,layoutVertexBuffer:n,indexBuffer:s,uniformValues:o,terrainData:l,projectionData:h}=t.state;a.draw(p,f.TRIANGLES,_,g,y,tP.backCCW,o,l,h,r.id,n,s,t.segments,r.paint,e.transform.zoom,i)}},heatmap: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=tI.disabled,h=new tS([o.ONE,o.ONE],t.bo.transparent,[!0,!0,!0,!0]),u=i.getBucket(r);if(!u)return;let c=a.key,p=r.heatmapFbos.get(c);p||(p=rm(s,i.tileSize,i.tileSize),r.heatmapFbos.set(c,p)),s.bindFramebuffer.set(p.framebuffer),s.viewport.set([0,0,i.tileSize,i.tileSize]),s.clear({color:t.bo.transparent});let f=u.programConfigurations.get(r.id),m=e.useProgram("heatmap",f,!n),_=e.transform.getProjectionData({overscaledTileID:i.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),g=e.style.map.terrain.getTerrainData(a);m.draw(s,o.TRIANGLES,tM.disabled,l,h,tP.disabled,id(i,e.transform.zoom,r.paint.get("heatmap-intensity"),1),g,_,r.id,u.layoutVertexBuffer,u.indexBuffer,u.segments,r.paint,e.transform.zoom,f)}(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=r_(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,tM.disabled,tI.disabled,e.colorModeForRenderPass(),tP.disabled,ip(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"offscreen"===e.renderPass?function(e,i,r,a){let n=e.context,s=n.gl,o=e.transform,l=tI.disabled,h=new tS([s.ONE,s.ONE],t.bo.transparent,[!0,!0,!0,!0]);for(let u of(function(e,i,r){let a=e.gl;e.activeTexture.set(a.TEXTURE1),e.viewport.set([0,0,i.width/4,i.height/4]);let n=r.heatmapFbos.get(t.cd);n?(a.bindTexture(a.TEXTURE_2D,n.colorAttachment.get()),e.bindFramebuffer.set(n.framebuffer)):(n=rm(e,i.width/4,i.height/4),r.heatmapFbos.set(t.cd,n))}(n,e,r),n.clear({color:t.bo.transparent}),a)){if(i.hasRenderableParent(u))continue;let t=i.getTile(u),a=t.getBucket(r);if(!a)continue;let c=a.programConfigurations.get(r.id),p=e.useProgram("heatmap",c),f=o.getProjectionData({overscaledTileID:u,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),m=o.getCircleRadiusCorrection();p.draw(n,s.TRIANGLES,tM.disabled,l,h,tP.backCCW,id(t,o.zoom,r.paint.get("heatmap-intensity"),m),null,f,r.id,a.layoutVertexBuffer,a.indexBuffer,a.segments,r.paint,o.zoom,c)}n.viewport.set([0,0,e.width,e.height])}(e,i,r,a):"translucent"===e.renderPass&&function(e,i){let r=e.context,a=r.gl;r.setColorMode(e.colorModeForRenderPass());let n=i.heatmapFbos.get(t.cd);n&&(r.activeTexture.set(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,n.colorAttachment.get()),r.activeTexture.set(a.TEXTURE1),r_(r,i).bind(a.LINEAR,a.CLAMP_TO_EDGE),e.useProgram("heatmapTexture").draw(r,a.TRIANGLES,tM.disabled,tI.disabled,e.colorModeForRenderPass(),tP.disabled,ip(e,i,0,1),null,null,i.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,i.paint,e.transform.zoom))}(e,r)},line:function(e,t,i,r,a){var n;let s;if("translucent"!==e.renderPass)return;let{isRenderingToTexture:o}=a,l=i.paint.get("line-opacity"),h=i.paint.get("line-width");if(0===l.constantOr(1)||0===h.constantOr(1))return;let u=e.getDepthModeForSublayer(0,tM.ReadOnly),c=e.colorModeForRenderPass(),p=i.paint.get("line-dasharray"),f=p.constantOr(1),m=i.paint.get("line-pattern"),_=m.constantOr(1),g=i.paint.get("line-gradient"),y=i.getCrossfadeParameters();s=_?"linePattern":f&&g?"lineGradientSDF":f?"lineSDF":g?"lineGradient":"line";let x=e.context,v=x.gl,b=e.transform,w=!0;for(let a of r){let r,l=t.getTile(a);if(_&&!l.patternsLoaded())continue;let h=l.getBucket(i);if(!h)continue;let T=h.programConfigurations.get(i.id),S=e.context.program.get(),P=e.useProgram(s,T),M=w||P.program!==S,I=null==(n=e.style.map.terrain)?void 0:n.getTerrainData(a),E=m.constantOr(null),C=null==p?void 0:p.constantOr(null);if(E&&l.imageAtlas){let e=l.imageAtlas,t=e.patternPositions[E.to.toString()],i=e.patternPositions[E.from.toString()];t&&i&&T.setConstantPatternPositions(t,i)}else if(C){let t="round"===i.layout.get("line-cap").constantOr(null),r=e.lineAtlas.getDash(C.to,t),a=e.lineAtlas.getDash(C.from,t);T.setConstantDashPositions(r,a)}let A=b.getProjectionData({overscaledTileID:a,applyGlobeMatrix:!o,applyTerrainMatrix:!0}),D=b.getPixelScale();_?(r=iv(e,l,i,D,y),x.activeTexture.set(v.TEXTURE0),l.imageAtlasTexture.bind(v.LINEAR,v.CLAMP_TO_EDGE),T.updatePaintBuffers(y)):f&&g?(r=iw(e,l,i,D,y,h.lineClipsArray.length),function(e,t,i,r,a,n,s,o,l){let h=n.gradients[a.id],u=h.texture;a.gradientVersion!==h.version&&(u=rg(e,t,i,r,a,n,s,h)),i.activeTexture.set(r.TEXTURE0),u.bind(a.stepInterpolant?r.NEAREST:r.LINEAR,r.CLAMP_TO_EDGE),i.activeTexture.set(r.TEXTURE1),e.lineAtlas.bind(i),o.updatePaintBuffers(l)}
798(e,t,x,v,i,h,a,T,y)):f?(r=ib(e,l,i,D,y),(M||e.lineAtlas.dirty)&&(x.activeTexture.set(v.TEXTURE0),e.lineAtlas.bind(x)),T.updatePaintBuffers(y)):g?(r=ix(e,l,i,D,h.lineClipsArray.length),function(e,t,i,r,a,n,s){let o=n.gradients[a.id],l=o.texture;a.gradientVersion!==o.version&&(l=rg(e,t,i,r,a,n,s,o)),i.activeTexture.set(r.TEXTURE0),l.bind(a.stepInterpolant?r.NEAREST:r.LINEAR,r.CLAMP_TO_EDGE)}(e,t,x,v,i,h,a)):r=iy(e,l,i,D);let z=e.stencilModeForClipping(a);P.draw(x,v.TRIANGLES,u,z,c,tP.disabled,r,I,A,i.id,h.layoutVertexBuffer,h.indexBuffer,h.segments,i.paint,e.transform.zoom,T,h.layoutVertexBuffer2),w=!1}},fill: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.bo.transparent).a&&1===o.constantOr(0)?"opaque":"translucent";if(e.renderPass===c){let t=e.getDepthModeForSublayer(1,"opaque"===e.renderPass?tM.ReadWrite:tM.ReadOnly);rx(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"),tM.ReadOnly);rx(e,i,r,a,t,h,!0,l)}},fillExtrusion: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 tM(e.context.gl.LEQUAL,tM.ReadWrite,e.depthRangeFor3D);if(1!==n||i.paint.get("fill-extrusion-pattern").constantOr(1))rv(e,t,i,r,a,tI.disabled,tS.disabled,s),rv(e,t,i,r,a,e.stencilModeFor3D(),e.colorModeForRenderPass(),s);else{let n=e.colorModeForRenderPass();rv(e,t,i,r,a,tI.disabled,n,s)}}},hillshade: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,tM.ReadOnly),u=e.colorModeForRenderPass();if("offscreen"===e.renderPass)(function(e,i,r,a,n,s,o){let l=e.context,h=l.gl,u="nearest"===a.paint.get("resampling")?h.NEAREST:h.LINEAR;for(let c of r){let r=i.getTile(c),p=r.dem;if(!(null!=p&&p.data)||!r.needsHillshadePrepare)continue;let f=p.dim,m=p.stride,_=p.getPixels();if(l.activeTexture.set(h.TEXTURE1),l.pixelStoreUnpackPremultiplyAlpha.set(!1),r.demTexture||(r.demTexture=e.getTileTexture(m)),r.demTexture){let e=r.demTexture;e.update(_,{premultiply:!1}),e.bind(h.NEAREST,h.CLAMP_TO_EDGE)}else r.demTexture=new t.T(l,_,h.RGBA,{premultiply:!1}),r.demTexture.bind(h.NEAREST,h.CLAMP_TO_EDGE);l.activeTexture.set(h.TEXTURE0);let g=r.fbo;if(!g){let e=new t.T(l,{width:f,height:f,data:null},h.RGBA);e.bind(u,h.CLAMP_TO_EDGE),(g=r.fbo=l.createFramebuffer(f,f,!0,!1)).colorAttachment.set(e.texture)}l.bindFramebuffer.set(g.framebuffer),l.viewport.set([0,0,f,f]),e.useProgram("hillshadePrepare").draw(l,h.TRIANGLES,n,s,o,tP.disabled,i_(r.tileID,p),null,null,a.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments),r.needsHillshadePrepare=!1}})(e,i,a,r,h,tI.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);rb(e,i,r,o,t,h,u,!1,s),rb(e,i,r,o,n,h,u,!0,s)}else{let[t,n]=e.getStencilConfigForOverlapAndUpdateStencilID(a);rb(e,i,r,n,t,h,u,!1,s)}},colorRelief: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,tM.ReadOnly),l=e.colorModeForRenderPass();if(s){let[a,s,h]=e.stencilConfigForOverlapTwoPass(r);rT(e,t,i,h,a,o,l,!1,n),rT(e,t,i,h,s,o,l,!0,n)}else{let[a,s]=e.getStencilConfigForOverlapAndUpdateStencilID(r);rT(e,t,i,s,a,o,l,!1,n)}},raster: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 ei)rP(e,t,i,r,null,!1,!1,s.tileCoords,s.flippedWindingOrder,n);else if(o){let[a,s,o]=e.stencilConfigForOverlapTwoPass(r);rP(e,t,i,o,a,!1,!0,rS,!1,n),rP(e,t,i,o,s,!0,!0,rS,!1,n)}else{let[a,s]=e.getStencilConfigForOverlapAndUpdateStencilID(r);rP(e,t,i,s,a,!1,!0,rS,!1,n)}},background:function(e,t,i,r,a){var n;let s=i.paint.get("background-color"),o=i.paint.get("background-opacity");if(0===o)return;let{isRenderingToTexture:l}=a,h=e.context,u=h.gl,c=e.style.projection,p=e.transform,f=p.tileSize,m=i.paint.get("background-pattern");if(e.isPatternMissing(m))return;let _=!m&&1===s.a&&1===o&&e.opaquePassEnabledForLayer()?"opaque":"translucent";if(e.renderPass!==_)return;let g=tI.disabled,y=e.getDepthModeForSublayer(0,"opaque"===_?tM.ReadWrite:tM.ReadOnly),x=e.colorModeForRenderPass(),v=e.useProgram(m?"backgroundPattern":"background"),b=r||eT(p,{tileSize:f,terrain:e.style.map.terrain});m&&(h.activeTexture.set(u.TEXTURE0),e.imageManager.bind(e.context));let w=i.getCrossfadeParameters();for(let t of b){let r=p.getProjectionData({overscaledTileID:t,applyGlobeMatrix:!l,applyTerrainMatrix:!0}),a=m?iA(o,e,m,{tileID:t,tileSize:f},w):iC(o,s),_=null==(n=e.style.map.terrain)?void 0:n.getTerrainData(t),b=c.getMeshFromTileID(h,t.canonical,!1,!0,"raster");v.draw(h,u.TRIANGLES,y,g,x,tP.backCCW,a,_,r,i.id,b.vertexBuffer,b.indexBuffer,b.segments)}},sky:function(e,t){let i=e.context,r=i.gl,a=((e,t,i)=>{let r=Math.cos(t.rollInRadians),a=Math.sin(t.rollInRadians),n=em(t),s=t.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:e.properties.get("sky-color"),u_horizon_color:e.properties.get("horizon-color"),u_horizon:[(t.width/2-n*a)*i,(t.height/2+n*r)*i],u_horizon_normal:[-a,r],u_sky_horizon_blend:e.properties.get("sky-horizon-blend")*t.height/2*i,u_sky_blend:s}})(t,e.style.map.transform,e.pixelRatio),n=new tM(r.LEQUAL,tM.ReadWrite,[0,1]),s=tI.disabled,o=e.colorModeForRenderPass(),l=e.useProgram("sky"),h=rL(i,t);l.draw(i,r.TRIANGLES,n,s,o,tP.disabled,a,null,void 0,"sky",h.vertexBuffer,h.indexBuffer,h.segments)},atmosphere:function(e,i,r){let a=e.context,n=a.gl,s=e.useProgram("atmosphere"),o=new tM(n.LEQUAL,tM.ReadOnly,[0,1]),l=e.transform,h=function(e,i){let r=e.properties.get("position"),a=[-r.x,-r.y,-r.z],n=t.ap(new Float64Array(16));return"map"===e.properties.get("anchor")&&(t.be(n,n,i.rollInRadians),t.bf(n,n,-i.pitchInRadians),t.be(n,n,i.bearingInRadians),t.bf(n,n,i.center.lat*Math.PI/180),t.bI(n,n,-i.center.lng*Math.PI/180)
798),t.cg(a,a,n),a}(r,e.transform),u=l.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),c=i.properties.get("atmosphere-blend")*u.projectionTransition;if(0===c)return;let p=tV(l.worldSize,l.center.lat),f=l.inverseProjectionMatrix,m=new Float64Array(4);m[3]=1,t.aE(m,m,l.modelViewProjectionMatrix),m[0]/=m[3],m[1]/=m[3],m[2]/=m[3],m[3]=1,t.aE(m,m,f),m[0]/=m[3],m[1]/=m[3],m[2]/=m[3],m[3]=1;let _={u_sun_pos:h,u_atmosphere_blend:c,u_globe_position:[m[0],m[1],m[2]],u_globe_radius:p,u_inv_proj_matrix:f},g=rL(a,i);s.draw(a,n.TRIANGLES,o,tI.disabled,tS.alphaBlended,tP.disabled,_,null,null,"atmosphere",g.vertexBuffer,g.indexBuffer,g.segments)},custom:function(e,t,i,r){let{isRenderingGlobe:a}=r,n=e.context,s=i.implementation,o=e.style.projection,l=e.transform,h=l.getProjectionDataForCustomLayer(a),u={farZ:l.farZ,nearZ:l.nearZ,fov:l.fov*Math.PI/180,modelViewProjectionMatrix:l.modelViewProjectionMatrix,projectionMatrix:l.projectionMatrix,shaderData:{variantName:o.shaderVariantName,vertexShaderPrelude:`const float PI = 3.141592653589793; 799uniform mat4 u_projection_matrix; 800${o.shaderPreludeCode.vertexSource}`,define:o.shaderDefine},defaultProjectionData:h},c=s.renderingMode?s.renderingMode:"2d";if("offscreen"===e.renderPass){let t=s.prerender;t&&(e.setCustomLayerDefaults(),n.setColorMode(e.colorModeForRenderPass()),t.call(s,n.gl,u),n.setDirty(),e.setBaseState())}else if("translucent"===e.renderPass){e.setCustomLayerDefaults(),n.setColorMode(e.colorModeForRenderPass()),n.setStencilMode(tI.disabled);let t="3d"===c?e.getDepthModeFor3D():e.getDepthModeForSublayer(0,tM.ReadOnly);n.setDepthMode(t),s.render(n.gl,u),n.setDirty(),e.setBaseState(),n.bindFramebuffer.set(null)}},debug:function(e,i,r){for(let a of r)!function(e,i,r){var a;let n=e.context,s=n.gl,o=e.useProgram("debug"),l=tM.disabled,h=tI.disabled,u=e.colorModeForRenderPass(),c="$debug",p=null==(a=e.style.map.terrain)?void 0:a.getTerrainData(r);n.activeTexture.set(s.TEXTURE0);let f=i.getTileByID(r.key).latestRawTileData,m=Math.floor(((null==f?void 0:f.byteLength)||0)/1024),_=512/Math.min(i.getTile(r).tileSize,512)*(r.overscaledZ/e.transform.zoom)*.5,g=r.canonical.toString();r.overscaledZ!==r.canonical.z&&(g+=` => ${r.overscaledZ}`),function(e,t){e.initDebugOverlayCanvas();let i=e.debugOverlayCanvas,r=e.context.gl,a=e.debugOverlayCanvas.getContext("2d");a.clearRect(0,0,i.width,i.height),a.shadowColor="white",a.shadowBlur=2,a.lineWidth=1.5,a.strokeStyle="white",a.textBaseline="top",a.font="bold 36px Open Sans, sans-serif",a.fillText(t,5,5),a.strokeText(t,5,5),e.debugOverlayTexture.update(i),e.debugOverlayTexture.bind(r.LINEAR,r.CLAMP_TO_EDGE)}(e,`${g} ${m}kB`);let y=e.transform.getProjectionData({overscaledTileID:r,applyGlobeMatrix:!0,applyTerrainMatrix:!0});o.draw(n,s.TRIANGLES,l,h,tS.alphaBlended,tP.disabled,ic(t.bo.transparent,_),null,y,c,e.debugBuffer,e.quadTriangleIndexBuffer,e.debugSegments),o.draw(n,s.LINE_STRIP,l,h,u,tP.disabled,ic(t.bo.red),p,y,c,e.debugBuffer,e.tileBorderIndexBuffer,e.debugSegments)}(e,i,a)},debugPadding:function(e){var t,i;let r=e.transform.padding;rD(e,e.transform.height-(r.top||0),3,rM),rD(e,r.bottom||0,3,rI),rz(e,r.left||0,3,rE),rz(e,e.transform.width-(r.right||0),3,rC);let a=e.transform.centerPoint;t=a.x,i=e.transform.height-a.y,rk(e,t-1,i-10,2,20,rA),rk(e,t-10,i-1,20,2,rA)},terrainDepth:function(e,i){let r=e.context,a=r.gl,n=e.transform,s=tS.unblended,o=new tM(a.LEQUAL,tM.ReadWrite,[0,1]),l=i.tileManager.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.bo.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,tI.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])},terrainCoords:function(e,i){let r=e.context,a=r.gl,n=e.transform,s=tS.unblended,o=new tM(a.LEQUAL,tM.ReadWrite,[0,1]),l=i.getCoordsTexture(),h=i.tileManager.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.bo.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)},p=n.getProjectionData({overscaledTileID:c.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});u.draw(r,a.TRIANGLES,o,tI.disabled,s,tP.backCCW,h,t,p,"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])}};class rB{constructor(e,i){this.drawFunctions=rF,this.context=new ru(e),this.transform=i,this._tileTextures={},this.terrainFacilitator={depthDirty:!0,coordsDirty:!1,matrix:t.ap(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=eC.maxOverzooming+eC.maxUnderzooming+1,this.depthEpsilon=1/65536,this.crossTileSymbolIndex=new tr}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.aU;i.emplaceBack(0,0),i.emplaceBack(t.a6,0),i.emplaceBack(0,t.a6),i.emplaceBack(t.a6,t.a6),this.tileExtentBuffer=e.createVertexBuffer(i,tl.members),this.tileExtentSegments=t.aV.simpleSegment(0,0,4,2);let r=new t.aU;r.emplaceBack(0,0),r.emplaceBack(t.a6,0),r.emplaceBack(0,t.a6),r.emplaceBack(t.a6,t.a6),this.debugBuffer=e.createVertexBuffer(r,tl.members),this.debugSegments=t.aV.simpleSegment(0,0,4,5);let a=new t.ch;a.emplaceBack(0,0,0,0),a.emplaceBack(t.a6,0,t.a6,0),a.emplaceBack(0,t.a6,0,t.a6),a.emplaceBack(t.a6,t.a6,t.a6,t.a6),this.rasterBoundsBuffer=e.createVertexBuffer(a,t6.members),this.rasterBoundsSegments=t.aV.simpleSegment(0,0,4,2);let n=new t.aU;n.emplaceBack(0,0),n.emplaceBack(t.a6,0),n.emplaceBack(0,t.a6),n.emplaceBack(t.a6,t.a6),this.rasterBoundsBufferPosOnly=e.createVertexBuffer(n,tl.members),this.rasterBoundsSegmentsPosOnly=t.aV.simpleSegment(0,0,4,5);let s=new t.aU;
800s.emplaceBack(0,0),s.emplaceBack(1,0),s.emplaceBack(0,1),s.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(s,tl.members),this.viewportSegments=t.aV.simpleSegment(0,0,4,2);let o=new t.ci;o.emplaceBack(0),o.emplaceBack(1),o.emplaceBack(3),o.emplaceBack(2),o.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(o);let l=new t.aW;l.emplaceBack(1,0,2),l.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(l);let h=this.context.gl;this.stencilClearMode=new tI({func:h.ALWAYS,mask:0},0,255,h.ZERO,h.ZERO,h.ZERO),this.tileExtentMesh=new to(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){let e=this.context,i=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let r=t.O();t.c7(r,0,this.width,this.height,0,0,1),t.S(r,r,[i.drawingBufferWidth,i.drawingBufferHeight,0]),this.useProgram("clippingMask",null,!0).draw(e,i.TRIANGLES,tM.disabled,this.stencilClearMode,tS.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()||!(null!=t&&t.length))return;this.currentStencilSource=e.source,this.nextStencilID+t.length>256&&this.clearStencil();let r=this.context;r.setColorMode(tS.disabled),r.setDepthMode(tM.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){var a;let n=this.context,s=n.gl,o=this.style.projection,l=this.transform,h=this.useProgram("clippingMask");for(let u of t){let t=e[u.key],c=null==(a=this.style.map.terrain)?void 0:a.getTerrainData(u),p=o.getMeshFromTileID(this.context,u.canonical,r,!0,"stencil"),f=l.getProjectionData({overscaledTileID:u,applyGlobeMatrix:!i,applyTerrainMatrix:!0});h.draw(n,s.TRIANGLES,tM.disabled,new tI({func:s.ALWAYS,mask:0},t,255,s.KEEP,s.KEEP,s.REPLACE),tS.disabled,i?tP.disabled:tP.backCCW,null,c,f,"$clipping",p.vertexBuffer,p.indexBuffer,p.segments)}}_renderTilesDepthBuffer(){var e;let t=this.context,i=t.gl,r=this.style.projection,a=this.transform,n=this.useProgram("depth"),s=this.getDepthModeFor3D();for(let o of eT(a,{tileSize:a.tileSize})){let l=null==(e=this.style.map.terrain)?void 0:e.getTerrainData(o),h=r.getMeshFromTileID(this.context,o.canonical,!0,!0,"raster"),u=a.getProjectionData({overscaledTileID:o,applyGlobeMatrix:!0,applyTerrainMatrix:!0});n.draw(t,i.TRIANGLES,s,tI.disabled,tS.disabled,tP.backCCW,null,l,u,"$clipping",h.vertexBuffer,h.indexBuffer,h.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let e=this.nextStencilID++,t=this.context.gl;return new tI({func:t.NOTEQUAL,mask:255},e,255,t.KEEP,t.KEEP,t.REPLACE)}stencilModeForClipping(e){let t=this.context.gl;return new tI({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)=>t.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 tI({func:t.GEQUAL,mask:255},i+this.nextStencilID,255,t.KEEP,t.KEEP,t.REPLACE);return this.nextStencilID+=a,[e,i]}return[{[r]:tI.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 tI({func:t.GREATER,mask:255},a+1+i,255,t.KEEP,t.KEEP,t.REPLACE),n[i+r]=new tI({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 tI({func:t.GREATER,mask:255},2,255,t.KEEP,t.KEEP,t.REPLACE)},{[r]:new tI({func:t.GREATER,mask:255},1,255,t.KEEP,t.KEEP,t.REPLACE)},i]}colorModeForRenderPass(){let e=this.context.gl;return this._showOverdrawInspector?new tS([e.CONSTANT_COLOR,e.ONE],new t.bo(.125,.125,.125,0),[!0,!0,!0,!0]):"opaque"===this.renderPass?tS.unblended:tS.alphaBlended}getDepthModeForSublayer(e,t,i){if(!this.opaquePassEnabledForLayer())return tM.disabled;let r=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new tM(i||this.context.gl.LEQUAL,t,[r,r])}getDepthModeFor3D(){return new tM(this.context.gl.LEQUAL,tM.ReadWrite,this.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(e,i){var r,a,n;this.style=e,this.options=i,this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(b()),this.imageManager.beginFrame();let s=this.style._order,o=this.style.tileManagers,l={},h={},u={},c={isRenderingToTexture:!1,isRenderingGlobe:(null==(r=e.projection)?void 0:r.transitionState)>0};
800for(let e in o){let t=o[e];t.used&&t.prepare(this.context),l[e]=t.getVisibleCoordinates(!1),h[e]=l[e].slice().reverse(),u[e]=t.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let e=0;e<s.length;e++)if(this.style._layers[s[e]].is3D()){this.opaquePassCutoff=e;break}for(let e of(this.maybeDrawDepth(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen",s)){let t=this.style._layers[e];if(!t.hasOffscreenPass()||t.isHidden(this.transform.zoom))continue;let i=h[t.source];("custom"===t.type||i.length)&&this.renderLayer(this,o[t.source],t,i,c)}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.bo.black:t.bo.transparent,depth:1}),this.clearStencil(),this.style.sky&&this.drawFunctions.sky(this,this.style.sky),this._showOverdrawInspector=i.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=s.length-1;this.currentLayer>=0;this.currentLayer--){let e=this.style._layers[s[this.currentLayer]],t=o[e.source],i=l[e.source];this._renderTileClippingMasks(e,i,!1),this.renderLayer(this,t,e,i,c)}this.renderPass="translucent";let p=!1;for(this.currentLayer=0;this.currentLayer<s.length;this.currentLayer++){let e=this.style._layers[s[this.currentLayer]],t=o[e.source];if(null!=(n=this.renderToTexture)&&n.renderLayer(e,c))continue;this.opaquePassEnabledForLayer()||p||(p=!0,c.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());let i=("symbol"===e.type?u:h)[e.source];this._renderTileClippingMasks(e,l[e.source],!!this.renderToTexture),this.renderLayer(this,t,e,i,c)}if(c.isRenderingGlobe&&this.drawFunctions.atmosphere(this,this.style.sky,this.style.light),this.options.showTileBoundaries){let e=function(e,t){let i=null,r=Object.values(e._layers).flatMap(i=>i.source&&!i.isHidden(t)?[e.tileManagers[i.source]]:[]),a=r.filter(e=>"vector"===e.getSource().type),n=r.filter(e=>"vector"!==e.getSource().type),s=e=>{(!i||i.getSource().maxzoom<e.getSource().maxzoom)&&(i=e)};for(let e of a)s(e);if(!i)for(let e of n)s(e);return i}(this.style,this.transform.zoom);e&&this.drawFunctions.debug(this,e,e.getVisibleCoordinates())}this.options.showPadding&&this.drawFunctions.debugPadding(this),this.context.setDefault()}maybeDrawDepth(e){var i,r;if(!(null!=(r=null==(i=this.style)?void 0:i.map)&&r.terrain))return;let a=this.terrainFacilitator.matrix,n=this.transform.modelViewProjectionMatrix,s=this.terrainFacilitator.depthDirty;s||(s=e?!t.cj(a,n):!t.ck(a,n)),s||(s=this.style.map.terrain.tileManager.anyTilesAfterTime(this.terrainFacilitator.renderTime)),s&&(t.cl(a,n),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.depthDirty=!1,this.terrainFacilitator.coordsDirty=!0,this.drawFunctions.terrainDepth(this,this.style.map.terrain))}maybeDrawCoords(){var e,t;null!=(t=null==(e=this.style)?void 0:e.map)&&t.terrain&&this.terrainFacilitator.coordsDirty&&(this.terrainFacilitator.coordsDirty=!1,this.drawFunctions.terrainCoords(this,this.style.map.terrain))}renderLayer(e,i,r,a,n){if(r.isHidden(this.transform.zoom)||"background"!==r.type&&"custom"!==r.type&&!(a||[]).length)return;this.id=r.id;let s=this.drawFunctions;t.aQ(r)?s.symbol(e,i,r,a,this.style.placement.variableOffsets,n):t.cm(r)?s.circle(e,i,r,a,n):t.cn(r)?s.heatmap(e,i,r,a,n):t.co(r)?s.line(e,i,r,a,n):t.cp(r)?s.fill(e,i,r,a,n):t.cq(r)?s.fillExtrusion(e,i,r,a,n):t.cr(r)?s.hillshade(e,i,r,a,n):t.cs(r)?s.colorRelief(e,i,r,a,n):t.bU(r)?s.raster(e,i,r,a,n):t.ct(r)?s.background(e,i,r,a,n):t.cu(r)&&s.custom(e,i,r,n)}saveTileTexture(e){let t=this._tileTextures[e.size[0]];t?t.length<rB.MAX_TEXTURE_POOL_SIZE_PER_BUCKET?t.push(e):e.destroy():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=[]){var a;this.cache||(this.cache={});let n=!!this.style.map.terrain,s=this.style.projection,o=i?tn.projectionMercator:s.shaderPreludeCode,l=i?th:s.shaderDefine,h=e+(t?t.cac
800heKey:"")+`/${i?tu:s.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(n?"/terrain":"")+(r?`/${r.join("/")}`:"");return(a=this.cache)[h]||(a[h]=new ie(this.context,tn[e],t,iz[e],this._showOverdrawInspector,n,o,l,r)),this.cache[h]}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(){var e,t;if(this._tileTextures){for(let e in this._tileTextures){let t=this._tileTextures[e];if(t)for(let e of t)e.destroy()}this._tileTextures={}}if(this.tileExtentBuffer&&this.tileExtentBuffer.destroy(),this.debugBuffer&&this.debugBuffer.destroy(),this.rasterBoundsBuffer&&this.rasterBoundsBuffer.destroy(),this.rasterBoundsBufferPosOnly&&this.rasterBoundsBufferPosOnly.destroy(),this.viewportBuffer&&this.viewportBuffer.destroy(),this.tileBorderIndexBuffer&&this.tileBorderIndexBuffer.destroy(),this.quadTriangleIndexBuffer&&this.quadTriangleIndexBuffer.destroy(),this.tileExtentMesh&&(null==(e=this.tileExtentMesh.vertexBuffer)||e.destroy()),this.tileExtentMesh&&(null==(t=this.tileExtentMesh.indexBuffer)||t.destroy()),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this.cache){for(let e in this.cache){let t=this.cache[e];null!=t&&t.program&&this.context.gl.deleteProgram(t.program)}this.cache={}}this.context&&this.context.setDefault()}overLimit(){let{drawingBufferWidth:e,drawingBufferHeight:t}=this.context.gl;return this.width!==e||this.height!==t}}function rO(e,t){let i,r=!1,a=null,n=()=>{a=null,r&&(e(...i),a=setTimeout(n,t),r=!1)};return(...e)=>(r=!0,i=e,a||n(),a)}rB.MAX_TEXTURE_POOL_SIZE_PER_BUCKET=50;class rV{constructor(e){this._getCurrentHash=()=>{let e=window.location.hash.replace("#","");if(this._hashName){let t;for(let i of e.split("&").map(e=>e.split("=")))i[0]===this._hashName&&(t=i);return(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=rO(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}`}
vendor: 1,678 bytes, line 800
800_isValidHash(e){if(e.length<3||e.some(isNaN))return!1;try{new t.W(+e[2],+e[1])}catch{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 rj={linearity:.3,easing:t.cv(0,0,.3,1)},rN=t.e({deceleration:2500,maxSpeed:1400},rj),rU=t.e({deceleration:20,maxSpeed:1400},rj),rG=t.e({deceleration:1e3,maxSpeed:360},rj),r$=t.e({deceleration:1e3,maxSpeed:90},rj),rZ=t.e({deceleration:1e3,maxSpeed:360},rj);class rq{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:b(),settings:e})}_drainInertiaBuffer(){let e=this._inertiaBuffer,t=b();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=rH(i.pan.mag(),r,t.e({},rN,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,rW(a,n)}if(i.zoom){let e=rH(i.zoom,r,rU);a.zoom=t.cw(this._map.transform.zoom+e.amount,this._map.getZoomSnap(),e.amount),rW(a,e)}if(i.bearing){let e=rH(i.bearing,r,rG);
800a.bearing=this._map.transform.bearing+t.al(e.amount,-179,179),rW(a,e)}if(i.pitch){let e=rH(i.pitch,r,r$);a.pitch=this._map.transform.pitch+e.amount,rW(a,e)}if(i.roll){let e=rH(i.roll,r,rZ);a.roll=this._map.transform.roll+t.al(e.amount,-179,179),rW(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 rW(e,t){(!e.duration||e.duration<t.duration)&&(e.duration=t.duration,e.easing=t.easing)}function rH(e,i,r){let{maxSpeed:a,linearity:n,deceleration:s}=r,o=t.al(e*n/(i/1e3),-a,a),l=Math.abs(o)/(s*n);return{easing:r.easing,duration:1e3*l,amount:l/2*o}}class rX extends t.n{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,r,a={}){r=r instanceof MouseEvent?r:new MouseEvent(e,r);let n=w.mousePos(i.getCanvas(),r);super(e,t.e({point:n,lngLat:i.unproject(n),originalEvent:r},a)),this._defaultPrevented=!1,this.target=i}}class rY extends t.n{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,r){let a="touchend"===e?r.changedTouches:r.touches,n=w.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 rK extends t.n{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,i){super(e,{originalEvent:i}),this._defaultPrevented=!1}}class rJ{constructor(e,t){this._map=e,this._clickTolerance=t.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new rK(e.type,this._map,e))}mousedown(e,t){return this._mousedownPos=t,this._firePreventable(new rX(e.type,this._map,e))}mouseup(e){this._map.fire(new rX(e.type,this._map,e))}click(e,t){this._mousedownPos&&this._mousedownPos.dist(t)>=this._clickTolerance||this._map.fire(new rX(e.type,this._map,e))}dblclick(e){return this._firePreventable(new rX(e.type,this._map,e))}mouseover(e){this._map.fire(new rX(e.type,this._map,e))}mouseout(e){this._map.fire(new rX(e.type,this._map,e))}touchstart(e){return this._firePreventable(new rY(e.type,this._map,e))}touchmove(e){this._map.fire(new rY(e.type,this._map,e))}touchend(e){this._map.fire(new rY(e.type,this._map,e))}touchcancel(e){this._map.fire(new rY(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class rQ{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new rX(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new rX("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new rX(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class r0{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 r1{constructor(e,t){this._map=e,this._tr=new r0(e),this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=t.clickTolerance||1,t.boxZoom&&"object"==typeof t.boxZoom&&(this._boxZoomEnd=t.boxZoom.boxZoomEnd)}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&&(w.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=w.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);this._box.style.transform=`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(),w.suppressClick(),r.x!==i.x||r.y!==i.y)return this._map.fire(new t.n("boxzoomend",{originalEvent:e})),this._boxZoomEnd?void this._boxZoomEnd(this._map,r,i,e):{cameraAnimation:e=>e.fitScreenCoordinates(r,i,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",e)}
vendor: 9,572 bytes, line 800
800keydown(e){this._active&&27===e.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",e))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(this._box.remove(),this._box=null),w.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,i){return this._map.fire(new t.n(e,{originalEvent:i}))}}function r2(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 r3{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=r2(r,i)))}touchmove(e,t,i){if(this.aborted||!this.centroid)return;let r=r2(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 r5{constructor(e){this.singleTap=new r3(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 r6{constructor(e){this._tr=new r0(e),this._zoomIn=new r5({numTouches:1,numTaps:2}),this._zoomOut=new r5({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,i,r){let a=this._zoomIn.touchend(e,i,r),n=this._zoomOut.touchend(e,i,r),s=this._tr;return a?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:i=>i.easeTo({duration:300,zoom:t.cw(s.zoom+1,i.getZoomSnap()),around:s.unproject(a)},{originalEvent:e})}):n?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:i=>i.easeTo({duration:300,zoom:t.cw(s.zoom-1,i.getZoomSnap()),around:s.unproject(n)},{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 r4{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&&w.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 r8={0:1,2:2};class r7{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){this._eventButton=e.button}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!function(e,t){let i=r8[t];return void 0===e.buttons||(e.buttons&i)!==i}(e,this._eventButton)}isValidEndEvent(e){return e.button===this._eventButton}}class r9{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 ae{constructor(e=new r7({checkCorrectEvent:()=>!0}),t=new r9){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 at=e=>{e.mousedown=e.dragStart,e.mousemoveWindow=e.dragMove,e.mouseup=e.dragEnd,e.contextmenu=e=>{e.preventDefault()}};class ai{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=r2(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 ar{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=aa(i,t,r),s=aa(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=aa(i,t,r),s=aa(i,t,a);n&&s||(this._active&&w.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 aa(e,t,i){for(let r=0;r<e.length;r++)if(e[r].identifier===i)return t[r]}function an(e,t){return Math.log(e/t)/Math.LN2}class as extends ar{constructor(){super(),this._zoomRate=1,this._zoomThreshold=.1}setZoomRate(e){this._zoomRate=e??1}setZoomThreshold(e){this._zoomThreshold=e??.1}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||!(Math.abs(an(this._distance,this._startDistance))<this._zoomThreshold))return this._active=!0,{zoomDelta:an(this._distance,i)*this._zoomRate,pinchAround:t}}}function ao(e,t){return 180*e.angleWith(t)/Math.PI}class al extends ar{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:ao(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(ao(e,this._startVector))<t}}function ah(e){return Math.abs(e.y)>Math.abs(e.x)}class au extends ar{constructor(e){super(),this._currentTouchCount=0,this._map=e}
800reset(){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,ah(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 ah(e)&&ah(t)&&n}}let ac=100,ad=15,ap=10;class af{constructor(e){this._tr=new r0(e),this._panStep=ac,this._bearingStep=ad,this._pitchStep=ap,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let i=0,r=0,a=0,n=0,s=0;switch(e.keyCode){case 61:case 107:case 171:case 187:i=1;break;case 189:case 109:case 173:i=-1;break;case 37:e.shiftKey?r=-1:(e.preventDefault(),n=-1);break;case 39:e.shiftKey?r=1:(e.preventDefault(),n=1);break;case 38:e.shiftKey?a=1:(e.preventDefault(),s=-1);break;case 40:e.shiftKey?a=-1:(e.preventDefault(),s=1);break;default:return}return this._rotationDisabled&&(r=0,a=0),{cameraAnimation:o=>{let l=this._tr;o.easeTo({duration:300,easeId:"keyboardHandler",easing:am,zoom:i?t.cw(l.zoom+i*(e.shiftKey?2:1),o.getZoomSnap()):l.zoom,bearing:l.bearing+r*this._bearingStep,pitch:l.pitch+a*this._pitchStep,offset:[-n*this._panStep,-s*this._panStep],center:l.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 am(e){return e*(2-e)}let a_=1/450;class ag{constructor(e,t){this._onTimeout=e=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(e)},this._map=e,this._tr=new r0(e),this._triggerRenderFrame=t,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=a_}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=b(),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._needsRerender=!1,this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);let i=w.mousePos(this._map.getCanvas(),e),r=this._tr;this._aroundPoint=this._aroundCenter?r.transform.locationToScreenPoint(t.W.convert(r.center)):i,this._needsRerender||(this._needsRerender=!0,this._triggerRenderFrame())}renderFrame(){if(!this._needsRerender||(this._needsRerender=!1,!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.ao(this._targetZoom),n=e.applyConstrain(e.getCameraLngLat(),t.ar(a*r)).zoom,s=this._map.getZoomSnap();if("wheel"===this._type&&s>0){let i=t.cw(e.zoom,s);this._targetZoom=t.cw(n,s,n-i)}else this._targetZoom=n;"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((b()-this._lastWheelEventTime+5)/200,1),o=a(e);n=t.H.number(r,i,o),e<1?this._needsRerender=!0:s=!0}else n=i,s=!0;return this._active=!0,s&&(this._active=!1,this._finishTimeout=setTimeout(()=>
800{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.cy;if(this._prevEase){let e=this._prevEase,r=(b()-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.cv(n,s,.25,1)}return this._prevEase={start:b(),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 ay{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 ax{constructor(e){this._tr=new r0(e),this.reset()}reset(){this._active=!1}dblclick(e,i){return e.preventDefault(),{cameraAnimation:r=>{r.easeTo({duration:300,zoom:t.cw(this._tr.zoom+(e.shiftKey?-1:1),r.getZoomSnap()),around:this._tr.unproject(i)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class av{constructor(){this._tap=new r5({numTouches:1,numTaps:1}),this._zoomRate=1,this.reset()}setZoomRate(e){this._zoomRate=e??1}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*this._zoomRate}}}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 ab{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 aw{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 aT{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()}setZoomRate(e){this._touchZoom.setZoomRate(e),this._tapDragZoom.setZoomRate(e)}setZoomThreshold(e){this._touchZoom.setZoomThreshold(e)}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class aS{constructor(e,t){this._bypassKey=navigator.userAgent.includes("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=w.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&&(this._container.remove(),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(e){return e[this._bypassKey]}notifyGestureBlocked(e,i){this._enabled&&(this._map.fire(new t.n("cooperativegestureprevented",{gestureType:e,originalEvent:i})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}let aP=e=>e.zoom||e.drag||e.roll||e.pitch||e.rotate;class aM extends t.n{}function aI(e){var t;return(null==(t=e.panDelta)?void 0:t.mag())||e.zoomDelta||e.bearingDelta||e.pitchDelta||e.rollDelta}class aE{get _ownerDocument(){var e;return(null==(e=this._el)?void 0:e.ownerDocument)||document}get _ownerWindow(){var e,t;return(null==(t=null==(e=this._el)?void 0:e.ownerDocument)?void 0:t.defaultView)||window}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;
800if(l.isEnabled()){if(this._blockedByActive(s,h,o))l.reset();else if(l[i||e.type]){if(t.cz(e,i||e.type)){let t=w.mousePos(this._map.getCanvas(),e);u=l[i||e.type](e,t)}else if(t.cA(e,i||e.type)){let t=this._getMapTouches(e.touches),r=w.touchPos(this._map.getCanvas(),t);u=l[i||e.type](e,r,t)}else t.cB(i||e.type)||(u=l[i||e.type](e));this.mergeHandlerResult(a,n,u,o,r),null!=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||aI(a))&&(this._changes.push([a,n,o]),this._triggerRenderFrame()),(Object.keys(s).length||aI(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 rq(e),this._bearingSnap=i.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(i);let r=this._el;for(let[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],[this._ownerDocument,"mousemove",{capture:!0}],[this._ownerDocument,"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],[this._ownerWindow,"blur",void 0]],this._listeners))e.addEventListener(t,e===this._ownerDocument?this.handleWindowEvent:this.handleEvent,i)}destroy(){for(let[e,t,i]of this._listeners)e.removeEventListener(t,e===this._ownerDocument?this.handleWindowEvent:this.handleEvent,i)}_addDefaultHandlers(e){let i=this._map,r=i.getCanvasContainer();this._add("mapEvent",new rJ(i,e));let a=i.boxZoom=new r1(i,e);this._add("boxZoom",a),e.interactive&&e.boxZoom&&a.enable();let n=i.cooperativeGestures=new aS(i,e.cooperativeGestures);this._add("cooperativeGestures",n),e.cooperativeGestures&&n.enable();let s=new r6(i),o=new ax(i);i.doubleClickZoom=new ay(o,s),this._add("tapZoom",s),this._add("clickZoom",o),e.interactive&&e.doubleClickZoom&&i.doubleClickZoom.enable();let l=new av;this._add("tapDragZoom",l);let h=i.touchPitch=new au(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 r4({clickTolerance:i,move:(e,i)=>{let o=s();if(r&&Math.abs(o.y-e.y)>a)return{bearingDelta:t.cx(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 r7({checkCorrectEvent:e=>0===e.button&&e.ctrlKey||2===e.button&&!e.ctrlKey}),enable:e,assignEvents:at})}(e,u),p=function({enable:e,clickTolerance:t,pitchDegreesPerPixelMoved:i=-.5}){return new r4({clickTolerance:t,move:(e,t)=>({pitchDelta:(t.y-e.y)*i}),moveStateManager:new r7({checkCorrectEvent:e=>0===e.button&&e.ctrlKey||2===e.button}),enable:e,assignEvents:at})}(e),f=function({enable:e,clickTolerance:t,rollDegreesPerPixelMoved:i=.3},r){return new r4({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 r7({checkCorrectEvent:e=>2===e.button&&e.ctrlKey}),enable:e,assignEvents:at})}(e,u);i.dragRotate=new aw(e,c,p,f),this._add("mouseRotate",c,["mousePitch"]),this._add("mousePitch",p,["mouseRotate","mouseRoll"]),this._add("mouseRoll",f,["mousePitch"]),e.interactive&&e.dragRotate&&i.dragRotate.enable();let m=function({enable:e,clickTolerance:t}){return new r4({clickTolerance:t,move:(e,t)=>({around:t,panDelta:t.sub(e)}),activateOnStart:!0,moveStateManager:new r7({checkCorrectEvent:e=>0===e.button&&!e.ctrlKey}),enable:e,assignEvents:at})}(e),_=new ai(e,i);i.dragPan=new ab(r,m,_),this._add("mousePan",m),this._add("touchPan",_,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&i.dragPan.enable(e.dragPan);let g=new al,y=new as;i.touchZoomRotate=new aT(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),this._add("blockableMapEvent",new rQ(i));let x=i.scrollZoom=new ag(i,()=>
800this._triggerRenderFrame());this._add("scrollZoom",x,["mousePan"]),e.interactive&&e.scrollZoom&&i.scrollZoom.enable(e.scrollZoom);let v=i.keyboard=new af(i);this._add("keyboard",v),e.interactive&&e.keyboard&&i.keyboard.enable()}_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!!aP(this._eventsInProgress)||this.isZooming()}_blockedByActive(e,t,i){for(let r in e)if(r!==i&&!(null!=t&&t.includes(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(!(aI(e)||n&&this._terrainMovement))return void this._fireEvents(t,i,!0);r._stop(!0);let{panDelta:s,zoomDelta:o,bearingDelta:l,pitchDelta:h,rollDelta:u,around:c,pinchAround:p}=e;void 0!==p&&(c=p),c||(c=r.transform.centerPoint),n&&!a.isPointOnMapSurface(c)&&(c=a.centerPoint);let f={panDelta:s,zoomDelta:o,rollDelta:u,pitchDelta:h,bearingDelta:l,around:c};this._map.cameraHelper.useGlobeControls&&!a.isPointOnMapSurface(c)&&(c=a.centerPoint);let m=.01>c.distSqr(a.centerPoint)?a.center:a.screenPointToLocation(s?c.sub(s):c);this._handleMapControls({terrain:n,tr:a,deltasForHelper:f,preZoomAroundLoc:m,combinedEventsInProgress:t,panDelta:s}),r._applyUpdatedTransform(a),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(t,i,!0)}_handleMapControls({terrain:e,tr:t,deltasForHelper:i,preZoomAroundLoc:r,combinedEventsInProgress:a,panDelta:n}){let s=this._map.cameraHelper;if(s.handleMapControlsRollPitchBearingZoom(i,t),e)return s.useGlobeControls?(!this._terrainMovement&&(a.drag||a.zoom)&&(this._terrainMovement=!0,this._map._elevationFreeze=!0),void s.handleMapControlsPan(i,t,r)):!this._terrainMovement&&(a.drag||a.zoom)?(this._terrainMovement=!0,this._map._elevationFreeze=!0,void s.handleMapControlsPan(i,t,r)):void(a.drag&&this._terrainMovement&&n?t.setCenter(t.screenPointToLocation(t.centerPoint.sub(n))):s.handleMapControlsPan(i,t,r));s.handleMapControlsPan(i,t,r)}_fireEvents(e,i,r){let a,n=aP(this._eventsInProgress),s=aP(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=aP(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||!x.prefersReducedMotion)?(i(e.bearing||this._map.getBearing())&&
800(e.bearing=0),e.freezeElevation=!0,this._map.easeTo(e,{originalEvent:a})):(this._map.fire(new t.n("moveend",{originalEvent:a})),i(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(e,i){this._map.fire(new t.n(e,i?{originalEvent:i}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(e=>{delete this._frameId,this.handleEvent(new aM("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}class aC extends t.E{constructor(e,t,i){super(),this._renderFrameCallback=()=>{let e=Math.min((b()-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._zoomSnap=i.zoomSnap,this.cameraHelper=t,this.on("moveend",()=>{delete this._requestedCameraState})}migrateProjection(e,t){e.apply(this.transform,!0),this.transform=e,this.cameraHelper=t}getCenter(){return new t.W(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,i){return this.zoomTo(t.cw(this.getZoom()+1,this._zoomSnap),e,i),this}zoomOut(e,i){return this.zoomTo(t.cw(this.getZoom()-1,this._zoomSnap),e,i),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(e,i){return e!=this.transform.fov&&(this.transform.setFov(e),this.fire(new t.n("movestart",i)).fire(new t.n("move",i)).fire(new t.n("moveend",i))),this}getBearing(){return this.transform.bearing}setZoomSnap(e){return this._zoomSnap=e,this}getZoomSnap(){return this._zoomSnap}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=q.convert(e).adjustAntiMeridian();let i=(null==t?void 0: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 q(e,i),h=this.cameraHelper.cameraForBoxAndBearing(a,s,l,r,o);return h&&this._zoomSnap&&(h.zoom=t.cw(h.zoom,this._zoomSnap,-1)),h}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(),"zoom"in e&&this._zoomSnap&&(e.zoom=t.cw(e.zoom,this._zoomSnap));let r=this._getTransformForUpdate(),a=!1,n=!1,s=!1,o=r.zoom;this.terrain&&r.setElevation(this.terrain.getElevationForLngLatZoom(e.center?t.W.convert(e.center):r.center,e.zoom||r.tileZoom)),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.n("movestart",i)).fire(new t.n("move",i)),l&&this.fire(new t.n("zoomstart",i)).fire(new t.n("zoom",i)).fire(new t.n("zoomend",i)),a&&this.fire(new t.n("rotatestart",i)).fire(new t.n("rotate",i)).fire(new t.n("rotateend",i)),n&&this.fire(new t.n("pitchstart",i)).fire(new t.n("pitch",i)).fire(new t.n("pitchend",
vendor: 1,253 bytes, line 800
800i)),s&&this.fire(new t.n("rollstart",i)).fire(new t.n("roll",i)).fire(new t.n("rollend",i)),this.fire(new t.n("moveend",i))}calculateCameraOptionsFromTo(e,i,r,a=0){let n=t.a7.fromLngLat(e,i),s=t.a7.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),p=t.ar(this.transform.cameraToCenterDistance/u/this.transform.tileSize),f=180*Math.atan2(o,-l)/Math.PI,m=180*Math.acos(c/u)/Math.PI;return m=h<0?90-m:90+m,{center:s.toLngLat(),elevation:a,zoom:p,pitch:m,bearing:f}}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),"zoom"in(e=t.e({offset:[0,0],duration:500,easing:t.cy},e))&&this._zoomSnap&&(e.zoom=t.cw(e.zoom,this._zoomSnap)),(!1===e.animate||!e.essential&&x.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
800=t.P.convert(e.offset);e.around&&(r=t.W.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.n("movestart",e)),this._zooming&&!r.zooming&&this.fire(new t.n("zoomstart",e)),this._rotating&&!r.rotating&&this.fire(new t.n("rotatestart",e)),this._pitching&&!r.pitching&&this.fire(new t.n("pitchstart",e)),this._rolling&&!r.rolling&&this.fire(new t.n("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){void 0!==this._elevationStart&&void 0!==this._elevationCenter||this._prepareElevation(this.transform.center),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.H.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,!1)}this.transform.apply(i,!1)}_fireMoveEvents(e){this.fire(new t.n("move",e)),this._zooming&&this.fire(new t.n("zoom",e)),this._rotating&&this.fire(new t.n("rotate",e)),this._pitching&&this.fire(new t.n("pitch",e)),this._rolling&&this.fire(new t.n("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.n("zoomend",e)),a&&this.fire(new t.n("rotateend",e)),n&&this.fire(new t.n("pitchend",e)),s&&this.fire(new t.n("rollend",e)),this.fire(new t.n("moveend",e))}flyTo(e,i){if(!e.essential&&x.prefersReducedMotion){let r=t.V(e,["center","zoom","bearing","pitch","roll","elevation","padding"]);return this.jumpTo(r,i)}this.stop(),"zoom"in(e=t.e({offset:[0,0],speed:1.2,curve:1.42,easing:t.cy},e))&&this._zoomSnap&&(e.zoom=t.cw(e.zoom,this._zoomSnap));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),v=y/_.scaleOfZoom,b=_.pixelPathLength;"number"==typeof _.scaleOfMinZoom&&(g=Math.sqrt(y/_.scaleOfMinZoom/b*2));let w=g*g;function T(e){let t=(v*v-y*y+(e?-1:1)*w*w*b*b)/(2*(e?v:y)*w*b);return Math.log(Math.sqrt(t*t+1)-t)}function S(e){return(Math.exp(e)-Math.exp(-e))/2}function P(e){return(Math.exp(e)+Math.exp(-e))/2}let M=T(!1),I=function(e){return P(M)/P(M+g*e)},E=function(e){var t;return y*((P(M)*(S(t=M+g*e)/P(t))-S(M))/w)/b},C=(T(!0)-M)/g;if(2e-6>Math.abs(b)||!isFinite(C)){if(1e-6>Math.abs(y-v))return this.easeTo(e,i);let t=v<y?-1:1;C=Math.abs(Math.log(v/y))/g,E=()=>0,I=e=>Math.exp(t*g*e)}return e.duration="duration"in e?+e.duration:1e3*C/("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(m=>{let g=m*C,y=1/I(g),x=E(g);this._rotating&&r.setBearing(t.H.number(a,l,m)),this._pitching&&r.setPitch(t.H.number(n,h,m)),this._rolling&&r.setRoll(t.H.number(s,u,m)),this._padding&&(r.interpolatePadding(o,c,m),f=r.centerPoint.add(p)),_.easeFu
800nc(m,y,x,f),this.terrain&&!e.freezeElevation&&this._updateElevation(m),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=b(),this._easeOptions=i,this._onEaseFrame=e,this._onEaseEnd=t,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,i){let r=Math.abs((e=t.X(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.getElevationForLngLat(t.W.convert(e),this.transform):null}}let aA={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class aD{constructor(e=aA){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=w.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=w.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=w.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(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=[];
vendor: 5,534 bytes, line 800
800if(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.tileManagers;for(let i in t){let r=t[i];if(r.used||r.usedForTerrain){let t=r.getSource();t.attribution&&!e.includes(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].includes(t))return!1;return!0})).join(" | ");i!==this._attribHTML&&(this._attribHTML=i,e.length?(this._innerContainer.innerHTML=w.sanitize(i),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class az{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){var t;this._map=e,this._compact=null==(t=this.options)?void 0:t.compact,this._container=w.create("div","maplibregl-ctrl");let i=w.create("a","maplibregl-ctrl-logo");return i.target="_blank",i.rel="noopener nofollow",i.href="https://maplibre.org/",i.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),i.setAttribute("rel","noopener nofollow"),this._container.appendChild(i),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class ak{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 aR=t.aS([{name:"a_pos3d",type:"Int16",components:3}]);class aL extends t.E{constructor(e){super(),this._lastTilesetChange=b(),this.tileManager=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.tileManager.usedForTerrain=!1,this.tileManager.tileSize=null}getSource(){return this.tileManager._source}update(e,i){this.tileManager.update(e,i),this._renderableTilesKeys=[];let r={};for(let a of eT(e,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:i,calculateTileZoom:this.tileManager._source.calculateTileZoom}))r[a.key]=!0,this._renderableTilesKeys.push(a.key),this._tiles[a.key]||(a.terrainRttPosMatrix32f=new Float64Array(16),t.c7(a.terrainRttPosMatrix32f,0,t.a6,t.a6,0,0,1),this._tiles[a.key]=new ec(a,this.tileSize),this._lastTilesetChange=b());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.bj();if(a.canonical.equals(e.canonical))t.c7(s,0,t.a6,t.a6,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.a6>>i;t.c7(s,0,o,o,0,0,1),t.Q(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.a6>>i;t.c7(s,0,t.a6,t.a6,0,0,1),t.Q(s,s,[r*o,n*o,0]),t.S(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.bj();if(n.canonical.z===e.canonical.z){let i=e.canonical.x-n.canonical.x+e.wrap*(1<<e.canonical.z),r=e.canonical.y-n.canonical.y;t.c7(o,0,t.a6,t.a6,0,0,1),t.Q(o,o,[i*t.a6,r*t.a6,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)+e.wrap*(1<<n.canonical.z),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.a6>>i;t.c7(o,0,h,h,0,0,1),t.Q(o,o,[-r*h+s*t.a6,-a*h+l*t.a6,0])}else{let i=e.canonical.z-n.canonical.z,r=e.canonical.x-(e.canonical.x>>i<<i)+e.wrap*(1<<e.canonical.z),a=e.canonical.y-(e.canonical.y>>i<<i),s=(e.canonical.x>>i)-n.canonical.x,l=(e.canonical.y>>
800i)-n.canonical.y,h=t.a6<<i;t.c7(o,0,h,h,0,0,1),t.Q(o,o,[r*t.a6+s*h,a*t.a6+l*h,0])}s.terrainRttPosMatrix32f=new Float32Array(o),r[a]=s}return r}getSourceTile(e,t){var i,r;let a=this.tileManager._source,n=e.overscaledZ-this.deltaZoom;if(n>a.maxzoom&&(n=a.maxzoom),n<a.minzoom)return;(i=this._sourceTileCache)[r=e.key]||(i[r]=e.scaledTo(n).key);let s=this.findTileInCaches(this._sourceTileCache[e.key]);if(!(null!=s&&s.dem)&&t)for(;n>=a.minzoom&&!(null!=s&&s.dem);)s=this.findTileInCaches(e.scaledTo(n--).key);return s}findTileInCaches(e){let t=this.tileManager.getTileByID(e);return t||(t=this.tileManager._outOfViewCache.getByKey(e))}anyTilesAfterTime(e=Date.now()){return this._lastTilesetChange>=e}_isWithinTileRanges(e,t){let i=t[e.canonical.z];return!!i&&(e.wrap>i.minWrap||e.wrap<i.maxWrap||e.canonical.x>=i.minTileXWrapped&&e.canonical.x<=i.maxTileXWrapped&&e.canonical.y>=i.minTileY&&e.canonical.y<=i.maxTileY)}}class aF{constructor(e,t,i){this._meshCache={},this.painter=e,this.tileManager=new aL(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}destroy(){for(let e in this._fbo&&(this._fbo.destroy(),this._fbo=null),this._fboCoordsTexture&&(this._fboCoordsTexture.destroy(),this._fboCoordsTexture=null),this._fboDepthTexture&&(this._fboDepthTexture.destroy(),this._fboDepthTexture=null),this._emptyDemTexture&&(this._emptyDemTexture.destroy(),this._emptyDemTexture=null),this._emptyDepthTexture&&(this._emptyDepthTexture.destroy(),this._emptyDepthTexture=null),this._coordsTexture&&(this._coordsTexture.destroy(),this._coordsTexture=null),this._meshCache)this._meshCache[e].destroy();this._meshCache={},this.tileManager.destruct()}getDEMElevation(e,i,r,a=t.a6){var n;let s=e.normalizeCoordinates(i,r,a);if(!s)return 0;let o=this.getTerrainData(s.tileID),l=null==(n=o.tile)?void 0:n.dem;if(!l)return 0;let h=t.cC([],[s.x/a*t.a6,s.y/a*t.a6],o.u_terrain_matrix),u=[h[0]*l.dim,h[1]*l.dim],c=Math.floor(u[0]),p=Math.floor(u[1]),f=u[0]-c,m=u[1]-p;return l.get(c,p)*(1-f)*(1-m)+l.get(c+1,p)*f*(1-m)+l.get(c,p+1)*(1-f)*m+l.get(c+1,p+1)*f*m}getElevationForLngLatZoom(e,i){if(!t.cD(i,e.wrap()))return 0;let{tileID:r,mercatorX:a,mercatorY:n}=this._getOverscaledTileIDFromLngLatZoom(e,i);return this.getElevation(r,a%t.a6,n%t.a6,t.a6)}getElevationForLngLat(e,t){let i=eT(t,{maxzoom:this.tileManager.maxzoom,minzoom:this.tileManager.minzoom,tileSize:512,terrain:this}),r=0;for(let e of i)e.canonical.z>r&&(r=Math.min(e.canonical.z,this.tileManager.maxzoom));return this.getElevationForLngLatZoom(e,r)}getElevation(e,i,r,a=t.a6){return this.getDEMElevation(e,i,r,a)*this.exaggeration}getTerrainData(e){var i,r;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.ap([])}let a=this.tileManager.getSourceTile(e,!0);if(null!=a&&a.dem&&(!a.demTexture||a.needsTerrainPrepare)){let e=this.painter.context;a.demTexture=this.painter.getTileTexture(a.dem.stride),a.demTexture?a.demTexture.update(a.dem.getPixels(),{premultiply:!1}):a.demTexture=new t.T(e,a.dem.getPixels(),e.gl.RGBA,{premultiply:!1}),a.demTexture.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),a.needsTerrainPrepare=!1}let n=a&&a.toString()+a.tileID.key+e.key;if(n&&!this._demMatrixCache[n]){let i=this.tileManager.getSource().maxzoom,r=e.canonical.z-a.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=i?r=e.canonical.z-i:t.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));let s=e.canonical.x-(e.canonical.x>>r<<r),o=e.canonical.y-(e.canonical.y>>r<<r),l=t.cE(new Float64Array(16),[1/(t.a6<<r),1/(t.a6<<r),0]);t.Q(l,l,[s*t.a6,o*t.a6,0]),this._demMatrixCache[n]={matrix:l,coord:e}}return{u_depth:2,u_terrain:3,u_terrain_dim:(null==(i=null==a?void 0:a.dem)?void 0:i.dim)||1,u_terrain_matrix:n?this._demMatrixCache[n].matrix:this._emptyDemMatrix,u_terrain_unpack:(null==(r=null==a?void 0:a.dem)?void 0:r.getUnpackVector())||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:((null==a?void 0:a.demTexture)||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:a}}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}
vendor: 4,813 bytes, line 800
800pointCoordinate(e){this.painter.maybeDrawDepth(!0),this.painter.maybeDrawCoords();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.tileManager.getTileByID(u);if(!c)return null;let p=this._coordsTextureSize,f=(1<<c.tileID.canonical.z)*p;return new t.a7((c.tileID.canonical.x*p+l)/f+c.tileID.wrap,(c.tileID.canonical.y*p+h)/f,this.getElevation(c.tileID,l,h,p))}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.cF,h=new t.aW,u=this.meshSize,c=t.a6/u,p=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<p;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 f=l.length,m=f+(u+1),_=(u+1)*u,g=a?t.bq:0,y=+!a,x=n?t.br:t.a6,v=+!n;for(let e=0;e<=u;e++)l.emplaceBack(e*c,g,y);for(let e=0;e<=u;e++)l.emplaceBack(e*c,x,v);for(let e=0;e<u;e++)h.emplaceBack(_+e,m+e,m+e+1),h.emplaceBack(_+e,m+e+1,_+e+1),h.emplaceBack(0+e,f+e+1,f+e),h.emplaceBack(0+e,0+e+1,f+e+1);let b=l.length,w=b+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.a6,i*c,r);for(let e=0;e<2*u;e+=2)h.emplaceBack(b+e,b+e+1,b+e+3),h.emplaceBack(b+e,b+e+3,b+e+2),h.emplaceBack(w+e,w+e+3,w+e+1),h.emplaceBack(w+e,w+e+2,w+e+3);let T=new to(o.createVertexBuffer(l,aR.members),o.createIndexBuffer(h),t.aV.simpleSegment(0,0,l.length,h.length));return this._meshCache[s]=T,T}getMeshFrameDelta(e){return 2*Math.PI*t.bD/Math.pow(2,Math.max(e,0))/5}getMinTileElevationForLngLatZoom(e,i){var r;if(!t.cD(i,e.wrap()))return 0;let{tileID:a}=this._getOverscaledTileIDFromLngLatZoom(e,i);return null!=(r=this.getMinMaxElevation(a).minElevation)?r:0}getMinMaxElevation(e){let t=this.getTerrainData(e).tile,i={minElevation:null,maxElevation:null};return null!=t&&t.dem&&(i.minElevation=t.dem.min*this.exaggeration,i.maxElevation=t.dem.max*this.exaggeration),i}_getOverscaledTileIDFromLngLatZoom(e,i){let r=t.a7.fromLngLat(e.wrap()),a=(1<<i)*t.a6,n=r.x*a,s=r.y*a,o=Math.floor(n/t.a6),l=Math.floor(s/t.a6);return{tileID:new t.a3(i,0,i,o,l),mercatorX:n,mercatorY:s}}}class aB{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 aO={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0};class aV{constructor(e,t){this.painter=e,this.terrain=t,this.pool=new aB(e.context,30,t.tileManager.tileSize*t.qualityFactor)}destruct(){this.pool.destruct()}getTexture(e){return this.pool.getObjectForId(e.rtt[this._stacks.length-1].id).texture}
800prepareForRender(e,t){var i,r,a;for(let i in this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.tileManager.getRenderableTiles(),this._renderableLayerIds=e._order.filter(i=>!e._layers[i].isHidden(t)),this._coordsAscending={},e.tileManagers){this._coordsAscending[i]={};let t=e.tileManagers[i].getVisibleCoordinates(),r=e.tileManagers[i].getSource(),n=r instanceof ei?r.terrainTileRanges:null;for(let e of t){let t=this.terrain.tileManager.getTerrainCoords(e,n);for(let e in t)(a=this._coordsAscending[i])[e]||(a[e]=[]),this._coordsAscending[i][e].push(t[e])}}for(let t of(this._rttFingerprints={},e._order)){let a=e._layers[t],n=a.source;if(aO[a.type]&&!this._rttFingerprints[n]){this._rttFingerprints[n]={};let t=null!=(r=null==(i=e.tileManagers[n])?void 0:i.getState().revision)?r:0;for(let e in this._coordsAscending[n])this._rttFingerprints[n][e]=`${this._coordsAscending[n][e].map(e=>e.key).sort().join()}#${t}`}}for(let e of this._renderableTiles)for(let t in this._rttFingerprints){let i=this._rttFingerprints[t][e.tileID.key];i&&i!==e.rttFingerprint[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(aO[a]&&(this._prevType&&aO[this._prevType]||this._stacks.push([]),this._prevType=a,this._stacks[this._stacks.length-1].push(e.id),!s))return!0;if(aO[this._prevType]||aO[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()&&(rR(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();for(let o of(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.bo.transparent,stencil:0}),n.currentStencilSource=void 0,i)){let e=n.style._layers[o],t=e.source?this._coordsAscending[e.source][a.tileID.key]:[a.tileID];n.context.viewport.set([0,0,s.fbo.width,s.fbo.height]),n._renderTileClippingMasks(e,t,!0),n.renderLayer(n,n.style.tileManagers[e.source],e,t,r),e.source&&(a.rttFingerprint[e.source]=this._rttFingerprints[e.source][a.tileID.key])}}return rR(this.painter,this.terrain,this._rttTiles,r),this._rttTiles=[],this.pool.freeAllObjects(),aO[a]}return!1}}let aj={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Drag to rotate map, click to reset north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","GlobeControl.Enable":"Enable globe","GlobeControl.Disable":"Disable globe","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use â + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},aN={hash:!1,interactive:!0,bearingSnap:7,zoomSnap:0,attributionControl:aA,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
800acheSize:null,maxTileCacheZoomLevels:t.c.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,transformConstrain:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,reduceMotion:void 0,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0,experimentalZoomLevelsToOverscale:void 0,anisotropicFilterPitch:20},aU=class extends aC{get _ownerWindow(){var e,t;return(null==(t=null==(e=this._container)?void 0:e.ownerDocument)?void 0:t.defaultView)||window}constructor(e){var i,r,a;let n=Object.assign(Object.assign(Object.assign({},aN),e),{canvasContextAttributes:Object.assign(Object.assign({},aN.canvasContextAttributes),e.canvasContextAttributes)});if(null!=n.minZoom&&null!=n.maxZoom&&n.minZoom>n.maxZoom)throw Error("maxZoom must be greater than or equal to minZoom");if(null!=n.minPitch&&null!=n.maxPitch&&n.minPitch>n.maxPitch)throw Error("maxPitch must be greater than or equal to minPitch");if(null!=n.minPitch&&n.minPitch<0)throw Error("minPitch must be greater than or equal to 0");if(null!=n.maxPitch&&n.maxPitch>180)throw Error("maxPitch must be less than or equal to 180");let s=new tx,o=new tT;void 0!==n.minZoom&&s.setMinZoom(n.minZoom),void 0!==n.maxZoom&&s.setMaxZoom(n.maxZoom),void 0!==n.minPitch&&s.setMinPitch(n.minPitch),void 0!==n.maxPitch&&s.setMaxPitch(n.maxPitch),void 0!==n.renderWorldCopies&&s.setRenderWorldCopies(n.renderWorldCopies),null!==n.transformConstrain&&s.setConstrainOverride(n.transformConstrain),super(s,o,{bearingSnap:n.bearingSnap,zoomSnap:n.zoomSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new ak,this._controls=[],this._mapId=t.ad(),this._lostContextStyle={style:null,images:null},this._contextLost=e=>{if(e.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.painter.destroy(),this._lostContextStyle=this._getStyleAndImages(),this.style){for(let e of Object.values(this.style._layers))if("custom"===e.type&&console.warn(`Custom layer with id '${e.id}' cannot be restored after WebGL context loss. You will need to re-add it manually after context restoration.`),e._listeners)for(let[t]of Object.entries(e._listeners))console.warn(`Custom layer with id '${e.id}' had event listeners for event '${t}' which cannot be restored after WebGL context loss. You will need to re-add them manually after context restoration.`);this.style.destroy(),this.style=null,this.fire(new t.n("webglcontextlost",{originalEvent:e}))}else this.fire(new t.n("webglcontextlost",{originalEvent:e}))},this._contextRestored=e=>{this._lostContextStyle.style&&this.setStyle(this._lostContextStyle.style,{diff:!1}),this._lostContextStyle.images&&this.style&&(this.style.imageManager.images=this._lostContextStyle.images),this._lostContextStyle={style:null,images:null},this._setupPainter(),this.resize(),this._update(),this._resizeInternal(),this.fire(new t.n("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=n.interactive,this._maxTileCacheSize=n.maxTileCacheSize,this._maxTileCacheZoomLevels=n.maxTileCacheZoomLevels,this._canvasContextAttributes=Object.assign({},n.canvasContextAttributes),this._trackResize=!0===n.trackResize,this._bearingSnap=n.bearingSnap,this._zoomSnap=n.zoomSnap,this._centerClampedToGround=n.centerClampedToGround,this._refreshExpiredTiles=!0===n.refreshExpiredTiles,this._fadeDuration=n.fadeDuration,this._crossSourceCollisions=!0===n.crossSourceCollisions,this._collectResourceTiming=!0===n.collectResourceTiming,this._locale=Object.assign(Object.assign({},aj),n.locale),this._clickTolerance=n.clickTolerance,this._overridePixelRatio=n.pixelRatio,this._maxCanvasSize=n.maxCanvasSize,this._zoomLevelsToOverscale=n.experimentalZoomLevelsToOverscale,this.transformCameraUpdate=n.transformCameraUpdate,this.transformConstrain=n.transformConstrain,this.cancelPendingTileRequestsWhileZooming=!0===n.cancelPendingTileRequestsWhileZooming,this.setAnisotropicFilterPitch(n.anisotropicFilterPitch),void 0!==n.reduceMotion&&(x.prefersReducedMotion=n.reduceMotion),this._imageQueueHandle=f.addThrottleControl(()=>this.isMoving()),this._requestManager=new T(n.transformRequest),this._container=this._resolveContainer(n.container),n.maxBounds&&this.setMaxBounds(n.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.depthDirty=!0,this._update(!0)}),this.once("idle",()=>this._idleTriggered=!0),"u">typeof window&&(this._ownerWindow.addEventListener("online",this._onWindowOnline,!1),this._setupResizeObserver()),this.handlers=new aE(this,n),this._hash=n.hash?new rV("string"==typeof n.hash&&n.hash||void 0).addTo(this):void 0,null!=(i=this._hash)&&i._onHashChange()||(this.jumpTo({center:n.center,elevation:n.elevation,zoom:n.zoom,bearing:n.bearing,pitch:n.pitch,roll:n.roll}),n.bounds&&(this.resize(),this.fitBounds(n.bounds,t.e({},n.fitBoundsOptions,{duration:0}))));let l="string"==typeof n.style||(null==(a=null==(r=n.style)?void 0:r.projection)?void 0:a.type)!=="globe";this.resize(null,l),this._localIdeographFontFamily=n.localIdeographFontFamily,this._val
800idateStyle=n.validateStyle,n.style&&this.setStyle(n.style,{localIdeographFontFamily:n.localIdeographFontFamily}),n.attributionControl&&this.addControl(new aD("boolean"==typeof n.attributionControl?void 0:n.attributionControl)),n.maplibreLogo&&this.addControl(new az,n.logoPosition),this.on("style.load",()=>{if(l||this._resizeTransform(),this.transform.unmodified){let e=t.V(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(e)}}),this.on("data",e=>{this._update("style"===e.dataType),this.fire(new t.n(`${e.dataType}data`,e))}),this.on("dataloading",e=>{this.fire(new t.n(`${e.dataType}dataloading`,e))}),this.on("dataabort",e=>{this.fire(new t.n("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"),!(null!=e&&e.onAdd))return this.fire(new t.l(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 i.includes("bottom")?a.insertBefore(r,a.firstChild):a.appendChild(r),this}removeControl(e){if(!(null!=e&&e.onRemove))return this.fire(new t.l(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.includes(e)}coveringTiles(e){return eT(this.transform,e)}calculateCameraOptionsFromTo(e,t,i,r){return null==r&&this.terrain&&(r=this.terrain.getElevationForLngLat(i,this.transform)),super.calculateCameraOptionsFromTo(e,t,i,r)}resize(e,i=!0){if(null!==this._lostContextStyle.style)return this;this._resizeInternal(i);let r=!this._moving;return r&&(this.stop(),this.fire(new t.n("movestart",e)).fire(new t.n("move",e))),this.fire(new t.n("resize",e)),r&&this.fire(new t.n("moveend",e)),this}_resizeInternal(e=!0){let[t,i]=this._containerDimensions(),r=this._getClampedPixelRatio(t,i);if(this._resizeCanvas(t,i,r),this.painter.resize(t,i,r),this.painter.overLimit()){let e=this.painter.context.gl;this._maxCanvasSize=[e.drawingBufferWidth,e.drawingBufferHeight];let r=this._getClampedPixelRatio(t,i);this._resizeCanvas(t,i,r),this.painter.resize(t,i,r)}this._resizeTransform(e)}_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(q.convert(e)),this._update()}setMinZoom(e){if((e=e??-2)>=-2&&e<=this.transform.maxZoom){let i=this.transform.zoom,r=this._getTransformForUpdate();return r.setMinZoom(e),this._applyUpdatedTransform(r),this._update(),i!==this.transform.zoom&&this.fire(new t.n("zoomstart")).fire(new t.n("zoom")).fire(new t.n("zoomend")).fire(new t.n("movestart")).fire(new t.n("move")).fire(new t.n("moveend")),this}throw Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(e){if((e=e??22)>=this.transform.minZoom){let i=this.transform.zoom,r=this._getTransformForUpdate();return r.setMaxZoom(e),this._applyUpdatedTransform(r),this._update(),i!==this.transform.zoom&&this.fire(new t.n("zoomstart")).fire(new t.n("zoom")).fire(new t.n("zoomend")).fire(new t.n("movestart")).fire(new t.n("move")).fire(new t.n("moveend")),this}throw Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(e){if((e=e??0)<0)throw Error("minPitch must be greater than or equal to 0");if(e>=0&&e<=this.transform.maxPitch){let i=this.transform.pitch,r=this._getTransformForUpdate();return r.setMinPitch(e),this._applyUpdatedTransform(r),this._update(),i!==this.transform.pitch&&this.fire(new t.n("pitchstart")).fire(new t.n("pitch")).fire(new t.n("pitchend")).fire(new t.n("movestart")).fire(new t.n("move")).fire(new t.n("moveend")),this}throw Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(e){if((e=e??60)>180)throw Error("maxPitch must be less than or equal to 180");if(e>=this.transform.minPitch){let i=this.transform.pitch,r=this._getTransformForUpdate();return r.setMaxPitch(e),this._applyUpdatedTransform(r),this._update(),i!==this.transform.pitch&&this.fire(new t.n("pitchstart")).fire(new t.n("pitch")).fire(new t.n("pitchend")).fire(new t.n("movestart")).fire(new t.n("move")).fire(new t.n("moveend")),this}throw Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getAnisotropicFilterPitch(){return this._anisotropicFilterPitch}setAnisotropicFilterPitch(e){if((e=e??20)>180)throw Error("anisotropicFilterPitch must be less than or equal to 180");if(e<0)throw Error("anisotropicFilterPitch must be greater than or equal to 0");return this._anisotropicFilterPitch=e,this._update()}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(e){return this.transform.setRenderWorldCopies(e),this._update()}setTransformConstrain(e){return this.transform.setConstrainOverride(e),this._update()}project(e){return this.transform.locationToScreenPoint(t.W.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())}
800_createDelegatedListener(e,t,i){if("mouseenter"===e||"mouseover"===e){let r=!1;return{layers:t,listener:i,delegates:{mousemove: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 rX(e,this,a.originalEvent,{features:s}))):r=!1},mouseout:()=>{r=!1}}}}if("mouseleave"===e||"mouseout"===e){let r=!1;return{layers:t,listener:i,delegates:{mousemove: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 rX(e,this,a.originalEvent)))},mouseout:t=>{r&&(r=!1,i.call(this,new rX(e,this,t.originalEvent)))}}}}{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){var i;this._delegatedListeners||(this._delegatedListeners={}),(i=this._delegatedListeners)[e]||(i[e]=[]),this._delegatedListeners[e].push(t)}_removeDelegatedListener(e,t,i){var r;if(!(null!=(r=this._delegatedListeners)&&r[e]))return;let a=this._delegatedListeners[e];for(let e=0;e<a.length;e++){let r=a[e];if(r.listener===i&&r.layers.length===t.length&&r.layers.every(e=>t.includes(e))){for(let e in r.delegates)this.off(e,r.delegates[e]);return void a.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
800idateStyle},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,a;if(null==(i=this._diffStyleRequest)||i.abort(),this._diffStyleRequest=null,t.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(e,t));let n=this.style&&t.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!e)),e?(this.style=new t5(this,t||{}),this.style.setEventedParent(this,{style:this.style}),"string"==typeof e?this.style.loadURL(e,t,n):this.style.loadJSON(e,t,n)):(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),null==(a=null==(r=this.style)?void 0:r.projection)||a.destroy(),delete this.style),this}_lazyInitEmptyStyle(){this.style||(this.style=new t5(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(e,i){return t._(this,void 0,void 0,function*(){var r;if(null==(r=this._diffStyleRequest)||r.abort(),"string"==typeof e){this._diffStyleRequest=new AbortController;let r=this._diffStyleRequest;try{let a=yield this._requestManager.transformRequest(e,"Style");if(r.signal.aborted)return void(this._diffStyleRequest=null);let n=yield t.k(a,r);this._diffStyleRequest=null,this._updateDiff(n.data,i)}catch(e){this._diffStyleRequest=null,t.$(e)||this.fire(new t.l(t.d(e)))}}else"object"==typeof e&&(this._diffStyleRequest=null,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: ${t.d(r).message}. Rebuilding the style from scratch.`),this._updateStyle(e,i)}}getStyle(){if(this.style)return this.style.serialize()}_getStyleAndImages(){return this.style?{style:this.style.serialize(),images:this.style.imageManager.cloneImages()}:{style:null,images:{}}}isStyleLoaded(){if(this.style)return 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){var i;let r=null==(i=this.style)?void 0:i.tileManagers[e];if(void 0!==r)return r.loaded();this.fire(new t.l(Error(`There is no tile manager with ID '${e}'`)))}setTerrain(e){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),e){let i=this.style.tileManagers[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 aF(this.painter,i,e),this.painter.renderToTexture=new aV(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.tileManager.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))),(null==(i=t.source)?void 0:i.type)==="image"?this.terrain.tileManager.freeRtt():this.terrain.tileManager.freeRtt(t.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.destroy(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGroun
800d&&this.transform.setElevation(0);return this.fire(new t.n("terrain",{terrain:e})),this}getTerrain(){var e,t;return null!=(t=null==(e=this.terrain)?void 0:e.options)?t:null}areTilesLoaded(){var e;for(let t of Object.values(null==(e=this.style)?void 0:e.tileManagers))if(!t.areTilesLoaded())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=ev(Math.max(1,e),Math.max(1,t))}else for(let i in this.style.tileManagers)this.style.tileManagers[i].getSource().calculateTileZoom=ev(Math.max(1,e),Math.max(1,t));return this._update(!0),this}refreshTiles(e,i){let r=this.style.tileManagers[e];if(!r)throw Error(`There is no tile manager with ID "${e}", cannot refresh tile`);void 0===i?r.reload(!0):r.refreshTiles(i.map(e=>new t.aa(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.l(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:p}=i;return this.style.addImage(e,{data:new t.R({width:r,height:c},new Uint8Array(p)),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}=x.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.l(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)?x.getImageData(i):i;if(void 0===a||void 0===n)return this.fire(new t.l(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.l(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.l(Error("Missing required image id"))),!1)}removeImage(e){this.style.removeImage(e)}loadImage(e){return t._(this,void 0,void 0,function*(){return f.getImage((yield 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]}_setupResizeObserver(){var e;let t=!1,i=rO(e=>{this._trackResize&&!this._removed&&(this.resize(e),this.redraw())},50),r=null!=(e=this._ownerWindow.ResizeObserver)?e:ResizeObserver;this._resizeObserver=new r(e=>{t?i(e):t=!0}),this._resizeObserver.observe(this._container)}
800_resolveContainer(e){if("string"==typeof e){let t=document.getElementById(e);if(!t)throw Error(`Container '${e}' not found.`);return t}if(e instanceof HTMLElement||e&&"object"==typeof e&&1===e.nodeType)return e;throw Error("Invalid type: 'container' must be a String or HTMLElement.")}_setupContainer(){let e=this._container;e.classList.add("maplibregl-map");let t=this._canvasContainer=w.create("div","maplibregl-canvas-container",e);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=w.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","region");let i=this._containerDimensions(),r=this._getClampedPixelRatio(i[0],i[1]);this._resizeCanvas(i[0],i[1],r);let a=this._controlContainer=w.create("div","maplibregl-control-container",e),n=this._controlPositions={};for(let e of["top-left","top-right","bottom-left","bottom-right"])n[e]=w.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 rB(i,this.transform)}migrateProjection(e,i){super.migrateProjection(e,i),this.painter.transform=e,this.fire(new t.n("projectiontransition",{newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(e){var t;return null!=(t=this.style)&&t._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,o;let l=this._idleTriggered?this._fadeDuration:0,h=(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 u=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let e=this.transform.zoom,i=b();this.style.zoomHistory.update(e,i);let r=new t.J(e,{now:i,fadeDuration:l,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),a=r.crossFadingFactor();1===a&&a===this._crossFadingFactor||(u=!0,this._crossFadingFactor=a),this.style.update(r)}let c=(null==(r=this.style.projection)?void 0:r.transitionState)>0!==h;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||c)&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.tileManager.update(this.transform,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),!this._elevationFreeze&&this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0)),this._placementDirty=null==(o=this.style)?void 0:o._updatePlacement(this.transform,this.showCollisionBoxes,l,this._crossSourceCollisions,c),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:l,showPadding:this.showPadding,anisotropicFilterPitch:this.getAnisotropicFilterPitch()}),this.fire(new t.n("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new t.n("load"))),this.style&&(this.style.hasTransitions()||u)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();let p=this._sourcesDirty||this._styleDirty||this._placementDirty;return p||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new t.n("idle")),!this._loaded||this._fullyLoaded||p||(this._fullyLoaded=!0),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var e,i;for(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(),null==(e=this._diffStyleRequest)||e.abort(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),"u">typeof window&&this._ownerWindow.removeEventListener("online",this._onWindowOnline,!1),f.removeThrottleControl(this._imageQueueHandle),null==(i=this._resizeObserver)||i.disconnect();let r=this.painter.context.gl.getExtension("WEBGL_lose_context");null!=r&&r.loseContext&&r.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),this._canvasContainer.remove(),this._controlContainer.remove(),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),this._removed=!0,this.fire(new t.n("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,x.frame(this._frameRequest,e=>{this._frameRequest=null;try{this._render(e)}catch(e){if(!t.$(e)&&e.message!==rl)throw e}},()=>{},this._ownerWindow))}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 g}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(e){return this._lazyInitEmptyStyle(),this.style.setProjection(e),this._update(!0)}},aG={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};class a${constructor(e,i,r=!1){this.mousedown=e=>{this.startMove(e,w.mousePos(this.element,e)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)},this.mousemove=e=>{this.move(e,w.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=w.touchPos(this.element,e.targetTouches)[0],this.startMove(e,this._startPos),window.addEventListener("touchmove",this.touchmove,{passive:!1}),window.addEventListener("touchend",this.touchend))},this.touchmove=e=>{1!==e.targetTouches.length?this.reset():(this._lastPos=w.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;let a=new ae;this._rotatePitchHandler=new r4({clickTolerance:3,move:(e,a)=>{let n=i.getBoundingClientRect(),s=new t.P((n.bottom-n.top)/2,(n.right-n.left)/2);
800return{bearingDelta:t.cx(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,i.addEventListener("mousedown",this.mousedown),i.addEventListener("touchstart",this.touchstart,{passive:!1}),i.addEventListener("touchcancel",this.reset)}startMove(e,t){this._rotatePitchHandler.dragStart(e,t),w.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;e.removeEventListener("mousedown",this.mousedown),e.removeEventListener("touchstart",this.touchstart),window.removeEventListener("touchmove",this.touchmove),window.removeEventListener("touchend",this.touchend),e.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){w.enableDrag(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup),window.removeEventListener("touchmove",this.touchmove),window.removeEventListener("touchend",this.touchend)}}function aZ(e,i,r,a=!1){if(a||!r.getCoveringTilesDetailsProvider().allowWorldCopies())return null==e?void 0:e.wrap();let n=new t.W(e.lng,e.lat);if(e=new t.W(e.lng,e.lat),i){let a=new t.W(e.lng-360,e.lat),n=new t.W(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 aq={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 aW(e,t,i){let r=e.classList;for(let e in aq)r.remove(`maplibregl-${i}-anchor-${e}`);r.add(`maplibregl-${i}-anchor-${t}`)}class aH extends t.E{constructor(e){if(super(),this._onClick=e=>{this.fire(new t.n("click",{originalEvent:e}))},this._onKeyPress=e=>{"Space"!==e.code&&"Enter"!==e.code||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();(null==e?void 0:e.type)!=="terrain"&&((null==e?void 0:e.type)!=="render"||t)||this._map.once("render",this._update),this._lngLat=aZ(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()),this._element.style.transform=`${aq[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${r} ${i}`,x.frameAsync(new AbortController,this._map._ownerWindow).then(()=>{this._updateOpacity((null==e?void 0:e.type)==="moveend")}).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.n("dragstart"))),this.fire(new t.n("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.n("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=(null==e?void 0:e.anchor)||"center",this._color=(null==e?void 0:e.color)||"#3FB1CE",this._scale=(null==e?void 0:e.scale)||1,this._draggable=(null==e?void 0:e.draggable)||!1,this._clickTolerance=(null==e?void 0:e.clickTolerance)||0,this._subpixelPositioning=(null==e?void 0:e.subpixelPositioning)||!1,this._isDragging=!1,this._state="inactive",this._rotation=(null==e?void 0:e.rotation)||0,this._rotationAlignment=(null==e?void 0:e.rotationAlignment)||"auto",this._pitchAlignment=null!=e&&e.pitchAlignment&&"auto"!==e.pitchAlignment?e.pitchAlignment:this._rotationAlignment,this.setOpacity(null==e?void 0:e.opacity,null==e?void 0:e.opacityWhenCovered),null==e?void 0:e.element)this._element=e.element,this._offset=t.P.convert((null==e?void 0:e.offset)||[0,0]);else{this._defaultMarker=!0,this._element=w.create("div");let i=w.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");let r=w.createNS("http://www.w3.org/2000/svg","g");
800r.setAttributeNS(null,"stroke","none"),r.setAttributeNS(null,"stroke-width","1"),r.setAttributeNS(null,"fill","none"),r.setAttributeNS(null,"fill-rule","evenodd");let a=w.createNS("http://www.w3.org/2000/svg","g");a.setAttributeNS(null,"fill-rule","nonzero");let n=w.createNS("http://www.w3.org/2000/svg","g");for(let 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"}])){let t=w.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)}let s=w.createNS("http://www.w3.org/2000/svg","g");s.setAttributeNS(null,"fill",this._color);let o=w.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);let l=w.createNS("http://www.w3.org/2000/svg","g");l.setAttributeNS(null,"opacity","0.25"),l.setAttributeNS(null,"fill","#000000");let h=w.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);let u=w.createNS("http://www.w3.org/2000/svg","g");u.setAttributeNS(null,"transform","translate(6.0, 7.0)"),u.setAttributeNS(null,"fill","#FFFFFF");let c=w.createNS("http://www.w3.org/2000/svg","g");c.setAttributeNS(null,"transform","translate(8.0, 8.0)");let p=w.createNS("http://www.w3.org/2000/svg","circle");p.setAttributeNS(null,"fill","#000000"),p.setAttributeNS(null,"opacity","0.25"),p.setAttributeNS(null,"cx","5.5"),p.setAttributeNS(null,"cy","5.5"),p.setAttributeNS(null,"r","5.4999962");let f=w.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(p),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((null==e?void 0: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()}),aW(this._element,this._anchor,"marker"),null==e?void 0:e.className)for(let 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")),this._element.hasAttribute("role")||this._element.setAttribute("role","button"),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._element.addEventListener("click",this._onClick),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),this._element.removeEventListener("click",this._onClick),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=t.W.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:[
8000,-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,this._element.classList.toggle("maplibregl-marker-covered",n)))}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.getElevationForLngLat(this._lngLat,s.transform);if(s.transform.lngLatToCameraDepth(this._lngLat,l)-o<.006)return this._element.style.opacity=this._opacity,void this._element.classList.remove("maplibregl-marker-covered");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)),p=s.transform.lngLatToCameraDepth(this._lngLat,l+u)-c>.006;null!=(r=this._popup)&&r.isOpen()&&p&&this._popup.remove(),this._element.style.opacity=p?this._opacityWhenCovered:this._opacity,this._element.classList.toggle("maplibregl-marker-covered",p)}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=String(e)),void 0!==t&&(this._opacityWhenCovered=String(t)),this._map&&this._updateOpacity(!0),this}}let aX={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0},aY=0,aK=!1,aJ={maxWidth:100,unit:"metric"};function aQ(e,t,i){let r=(null==i?void 0: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((null==i?void 0:i.unit)==="imperial"){let i=3.2808*h;i>5280?a0(t,l,i/5280,e._getUIString("ScaleControl.Miles")):a0(t,l,i,e._getUIString("ScaleControl.Feet"))}else(null==i?void 0:i.unit)==="nautical"?a0(t,l,h/1852,e._getUIString("ScaleControl.NauticalMiles")):h>=1e3?a0(t,l,h/1e3,e._getUIString("ScaleControl.Kilometers")):a0(t,l,h,e._getUIString("ScaleControl.Meters"))}function a0(e,t,i,r){let a=function(e){let t=Math.pow(10,`${Math.floor(e)}`.length-1),i=e/t;return t*(i=i>=10?10:i>=5?5:i>=3?3:i>=2?2:i>=1?1:function(e){let t=Math.pow(10,Math.ceil(-Math.log(e)/Math.LN10));return Math.round(e*t)/t}(i))}(i);e.style.width=a/i*t+"px",e.innerHTML=`${a} ${r}`}let a1={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0,padding:void 0};
800e.AJAXError=t.cG,e.EXTENT=t.a6,e.Event=t.n,e.Evented=t.E,e.LngLat=t.W,e.MercatorCoordinate=t.a7,e.Point=t.P,e.addProtocol=t.cH,e.config=t.c,e.removeProtocol=t.cI,e.AttributionControl=aD,e.BoxZoomHandler=r1,e.CanvasSource=ea,e.CooperativeGesturesHandler=aS,e.DoubleClickZoomHandler=ay,e.DragPanHandler=ab,e.DragRotateHandler=aw,e.EdgeInsets=td,e.FullscreenControl=class extends t.E{constructor(e={}){var i;super(),this._onFullscreenChange=()=>{var e;let t=window.document.fullscreenElement||window.document.webkitFullscreenElement;for(;null!=(e=null==t?void 0:t.shadowRoot)&&e.fullscreenElement;)t=t.shadowRoot.fullscreenElement;t===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,this._pseudo=null!=(i=e.pseudo)&&i,null!=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=w.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){let e=this._fullscreenButton=w.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);w.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.n("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new t.n("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){this._pseudo?this._togglePseudoFullScreen():window.document.exitFullscreen?window.document.exitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._pseudo?this._togglePseudoFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},e.GeoJSONSource=et,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.n("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.n("geolocate",e)),this._finish()}},this._updateCamera=e=>{let i=new t.W(e.coords.longitude,e.coords.latitude),r=e.coords.accuracy,a=this._map.getBearing(),n=t.e({bearing:a},this.options.fitBoundsOptions),s=q.fromLngLat(i,r);this._map.fitBounds(s,n,{geolocateSource:!0})},this._updateMarker=e=>{if(e){let i=new t.W(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._updateCircleRadiusIfNeeded()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onUpdate=()=>{this._updateCircleRadiusIfNeeded()},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&&aK)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new t.n("error",e)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._onMoveStart=e=>{if(!this._map)return;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.n("trackuserlocationend")),this.fire(new t.n("userlocationlostfocus")))},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",e=>{e.preventDefault()}),this._geolocateButton=w.create("button","maplibregl-ctrl-geolocate",this._container),w.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
800se"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=w.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new aH({element:this._dotElement}),this._circleElement=w.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new aH({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onUpdate),this._map.on("move",this._onUpdate),this._map.on("rotate",this._onUpdate),this._map.on("pitch",this._onUpdate)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",this._onMoveStart)}},this.options=t.e({},aX,e)}onAdd(e){return this._map=e,this._container=w.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),(function(){return t._(this,arguments,void 0,function*(e=!1){if(void 0!==h&&!e)return h;if(void 0===window.navigator.permissions)return h=!!window.navigator.geolocation;try{h="denied"!==(yield window.navigator.permissions.query({name:"geolocation"})).state}catch{h=!!window.navigator.geolocation}return h})})().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(),this._container.remove(),this._map.off("movestart",this._onMoveStart),this._map.off("zoom",this._onUpdate),this._map.off("move",this._onUpdate),this._map.off("rotate",this._onUpdate),this._map.off("pitch",this._onUpdate),this._map=void 0,aY=0,aK=!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":case"BACKGROUND_ERROR":case"OFF":case void 0:break;default:throw Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadiusIfNeeded(){let e=this._userLocationDotMarker.getLngLat();if(!(this.options.showUserLocation&&this.options.showAccuracyCircle&&this._accuracy&&e))return;let t=this._map.project(e),i=this._map.unproject([t.x+100,t.y]),r=e.distanceTo(i)/100,a=2*this._accuracy/r;this._circleElement.style.width=`${a.toFixed(2)}px`,this._circleElement.style.height=`${a.toFixed(2)}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.n("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":aY--,aK=!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.n("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.n("trackuserlocationstart")),this.fire(new t.n("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"),++aY>1?(e={maximumAge:6e5,timeout:0},aK=!0):(e=this.options.positionOptions,aK=!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
800se"),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"),(null==(e=this._map.getProjection())?void 0:e.type)==="globe"?(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=w.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=w.create("button","maplibregl-ctrl-globe",this._container),w.create("span","maplibregl-ctrl-icon",this._globeButton).setAttribute("aria-hidden","true"),this._globeButton.type="button",this._globeButton.addEventListener("click",this._toggleProjection),this._updateGlobeIcon(),this._map.on("styledata",this._updateGlobeIcon),this._map.on("projectiontransition",this._updateGlobeIcon),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateGlobeIcon),this._map.off("projectiontransition",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},e.Hash=rV,e.ImageSource=ei,e.KeyboardHandler=af,e.LngLatBounds=q,e.LogoControl=az,e.Map=aU,e.MapLibreMap=aU,e.MapMouseEvent=rX,e.MapTouchEvent=rY,e.MapWheelEvent=rK,e.Marker=aH,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({},aG,e),this._container=w.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})),w.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})),w.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=w.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 a$(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){this._container.remove(),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.off("roll",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(e,t){let i=w.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&&this._content.remove(),this._container&&(this._container.remove(),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("mousemove",this._update),this._map.off("mouseup",this._update),this._map.off("drag",this._update),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new t.n("close"))),this),this._update=e=>{let i;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=w.create("div","maplibregl-popup",this._map.getContainer()),this._tip=w.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=aZ(this._lngLat,this._flatPos,this._map.transform,this._trackPointer),e&&"point"in e&&e.point&&(i=e.point),this._trackPointer&&!i)return;let r=this._flatPos=this._pos=this._trackPointer&&i?i:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&i?i:this._map.transform.locationToScreenPoint(this._lngLat));
800let a=this.options.anchor,n=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(!a){let e,t=this._container.offsetWidth,i=this._container.offsetHeight,s=function(e){var t,i,r,a;return e?{top:null!=(t=e.top)?t:0,right:null!=(i=e.right)?i:0,bottom:null!=(r=e.bottom)?r:0,left:null!=(a=e.left)?a:0}:{top:0,right:0,bottom:0,left:0}}(this.options.padding);e=r.y+n.bottom.y<i+s.top?["top"]:r.y>this._map.transform.height-i-s.bottom?["bottom"]:[],r.x<t/2+s.left?e.push("left"):r.x>this._map.transform.width-t/2-s.right&&e.push("right"),a=0===e.length?"bottom":e.join("-")}let s=r.add(n[a]);this.options.subpixelPositioning||(s=s.round()),this._container.style.transform=`${aq[a]} translate(${s.x}px,${s.y}px)`,aW(this._container,a,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=t.e(Object.create(a1),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._map.on("terrain",this._update),this._map.on("projectiontransition",this._update),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._update),this._map.on("mouseup",this._update),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new t.n("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=t.W.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._update),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._update),this._map.on("drag",this._update),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(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=w.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}setPadding(e){this.options.padding=e,this._update()}_createCloseButton(){this.options.closeButton&&(this._closeButton=w.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;
800let 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=Y,e.RasterTileSource=X,e.ScaleControl=class{constructor(e){this._onMove=()=>{aQ(this._map,this._container,this.options)},this.setUnit=e=>{this.options.unit=e,aQ(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},aJ),e)}getDefaultPosition(){return"bottom-left"}onAdd(e){return this._map=e,this._container=w.create("div","maplibregl-ctrl maplibregl-ctrl-scale",e.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._onMove),this._map=void 0}},e.ScrollZoomHandler=ag,e.Style=t5,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=w.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=w.create("button","maplibregl-ctrl-terrain",this._container),w.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(){this._container.remove(),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},e.TwoFingersTouchPitchHandler=au,e.TwoFingersTouchRotateHandler=al,e.TwoFingersTouchZoomHandler=as,e.TwoFingersTouchZoomRotateHandler=aT,e.VectorTileSource=H,e.VideoSource=er,e.addSourceType=(e,i)=>t._(void 0,void 0,void 0,function*(){if(es(e))throw Error(`A source type called "${e}" already exists.`);en[e]=i}),e.clearPrewarmedResources=function(){let e=s;e&&(e.isPreloaded()&&1===e.numActive()?(e.release(B),s=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=tD,e.getGlobalDispatcher=U,e.getMaxParallelImageRequests=function(){return t.c.MAX_PARALLEL_IMAGE_REQUESTS},e.getRTLTextPluginStatus=function(){return eu().getRTLTextPluginStatus()},e.getVersion=function(){return g},e.getWorkerCount=function(){return O.workerCount},e.getWorkerUrl=function(){return t.c.WORKER_URL},e.importScriptInWorkers=function(e){return U().broadcast("IS",e)},e.isTimeFrozen=function(){return v.isFrozen()},e.now=b,e.prewarm=function(){j().acquire(B)},e.restoreNow=function(){v.restoreNow()},e.setMaxParallelImageRequests=function(e){t.c.MAX_PARALLEL_IMAGE_REQUESTS=e},e.setNow=function(e){v.setNow(e)},e.setRTLTextPlugin=function(e,t){return eu().setRTLTextPlugin(e,t)},e.setWorkerCount=function(e){O.workerCount=e},e.setWorkerUrl=function(e){t.c.WORKER_URL=e}}),e}()),n.exports}());let o=(0,a.b)(s),l=function(e,t){for(var i=0;i<t.length;i++){let r=t[i];if("string"!=typeof r&&!Array.isArray(r)){for(let t in r)if("default"!==t&&!(t in e)){let i=Object.getOwnPropertyDescriptor(r,t);i&&Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>r[t]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}({__proto__:null,default:o},[s])}}]);
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.