Skip to content

fix: Upgrade MapLibre to v6 to address CVE - #8035

Merged
camdecoster merged 13 commits into
mainfrom
cam/8031/upgrade-maplibre-v6
Sep 13, 2026
Merged

fix: Upgrade MapLibre to v6 to address CVE#8035
camdecoster merged 13 commits into
mainfrom
cam/8031/upgrade-maplibre-v6

Conversation

@camdecoster

@camdecoster camdecoster commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Description

Upgrade maplibre-gl dependency to v6.9.0 to address CVE.

Closes #8031.
Closes #8038.

Changes

  • Upgrade maplibre-gl
  • Extract maplibre worker to be used in our bundle
  • Update maplibre function calls for v6 compatibility
  • Add maplibre worker diff check to CI
  • Update map selection logic to handle bearing, pitch
  • Remove map_angles mock from disallow list and update baseline image

Notes

  • v5 used to export a UMD bundle that included the worker. v6 went ESM only, so we have to extract the worker ourselves now (following what v5 did as an example). This will unfortunately add about 500KiB to the library size. v5 did a soft of deduping on the worker code, but that's not possible when we bundle it in.
  • It's worth noting that this solution (mostly) follows the example that is shown in the installation docs (here and here)
  • This worker code file will need to be updated any time maplibre-gl is updated
  • The selection logic update fixes a bug that I discovered during this update. Without it, using the select tool would break for non-standard projections. Update: this has been filed in [BUG]: Select in scattermap doesn't work for non-primary world copies when bearing/pitch are set #8038.
  • The map_angles mock is the only one that uses a different angle than the default, so I added it back in. 🤞 that it doesn't behave flaky.

@camdecoster
camdecoster marked this pull request as draft September 10, 2026 20:59
@archmoj

archmoj commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Hi @camdecoster
Thanks for the PR.
Wondering if npm postinstall could be used to update the code after every npm i or npm ci?

Comment thread build/maplibre_worker.js Outdated
'use strict';

// Generated by tasks/util/bundle_maplibre_worker.js - do not edit.
module.exports = "var Zy=Object.create,Hc=Object.defineProperty,Hy=Object.getOwnPropertyDescriptor,Ky=Object.getOwnPropertyNames,Jy=Object.getPrototypeOf,Kc=Object.prototype.hasOwnProperty,ol=(t,e)=>()=>(e||(t((e={exports:{}}).exports,e),t=null),e.exports),Qy=(t,e,r,i)=>{if(e&&typeof e==\"object\"||typeof e==\"function\")for(var n=Ky(e),a=0,s=n.length,o;a<s;a++)o=n[a],!Kc.call(t,o)&&o!==r&&Hc(t,o,{get:(l=>e[l]).bind(null,o),enumerable:!(i=Hy(e,o))||i.enumerable});return t},t1=(t,e,r)=>(r=t==null?{}:Zy(Jy(t)),Qy(e||!t||!t.__esModule||!Kc.call(t,\"default\")?Hc(r,\"default\",{value:t,enumerable:!0}):r,t));function B(t,e){this.x=t,this.y=e}B.prototype={clone(){return new B(this.x,this.y)},add(t){return this.clone()._add(t)},sub(t){return this.clone()._sub(t)},multByPoint(t){return this.clone()._multByPoint(t)},divByPoint(t){return this.clone()._divByPoint(t)},mult(t){return this.clone()._mult(t)},div(t){return this.clone()._div(t)},rotate(t){return this.clone()._rotate(t)},rotateAround(t,e){return this.clone()._rotateAround(t,e)},matMult(t){return this.clone()._matMult(t)},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(t){return this.x===t.x&&this.y===t.y},dist(t){return Math.sqrt(this.distSqr(t))},distSqr(t){let e=t.x-this.x,r=t.y-this.y;return e*e+r*r},angle(){return Math.atan2(this.y,this.x)},angleTo(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith(t){return this.angleWithSep(t.x,t.y)},angleWithSep(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult(t){let e=t[0]*this.x+t[1]*this.y,r=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=r,this},_add(t){return this.x+=t.x,this.y+=t.y,this},_sub(t){return this.x-=t.x,this.y-=t.y,this},_mult(t){return this.x*=t,this.y*=t,this},_div(t){return this.x/=t,this.y/=t,this},_multByPoint(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint(t){return this.x/=t.x,this.y/=t.y,this},_unit(){return this._div(this.mag()),this},_perp(){let t=this.y;return this.y=this.x,this.x=-t,this},_rotate(t){let e=Math.cos(t),r=Math.sin(t),i=e*this.x-r*this.y,n=r*this.x+e*this.y;return this.x=i,this.y=n,this},_rotateAround(t,e){let r=Math.cos(t),i=Math.sin(t),n=e.x+r*(this.x-e.x)-i*(this.y-e.y),a=e.y+i*(this.x-e.x)+r*(this.y-e.y);return this.x=n,this.y=a,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:B},B.convert=function(t){if(t instanceof B)return t;if(Array.isArray(t))return new B(+t[0],+t[1]);if(t.x!==void 0&&t.y!==void 0)return new B(+t.x,+t.y);throw Error(\"Expected [x, y] or {x, y} point format\")};function e1(t,e,r,i){let n=3*t,a=3*(r-t)-n,s=1-n-a,o=3*e,l=3*(i-e)-o,u=1-o-l;return function(h,c=1e-6){if(h<=0)return 0;if(h>=1)return 1;let p=h;for(let y=0;y<8;y++){let m=((s*p+a)*p+n)*p-h;if(Math.abs(m)<c)return((u*p+l)*p+o)*p;let g=(3*s*p+2*a)*p+n;if(Math.abs(g)<1e-6)break;p-=m/g}let f=0,d=1;p=h;for(let y=0;y<20;y++){let m=((s*p+a)*p+n)*p;if(Math.abs(m-h)<c)break;h>m?f=p:d=p,p=(f+d)*.5}return((u*p+l)*p+o)*p}}var Ju;function r1(){return Ju??(Ju=typeof OffscreenCanvas<\"u\"&&!!new OffscreenCanvas(1,1).getContext(\"2d\")&&typeof createImageBitmap==\"function\"),Ju}var On;function i1(){if(On==null&&(On=!1,r1())){let t=new OffscreenCanvas(5,5).getContext(\"2d\",{willReadFrequently:!0});if(t){for(let r=0;r<25;r++){let i=r*4;t.fillStyle=`rgb(${i},${i+1},${i+2})`,t.fillRect(r%5,Math.floor(r/5),1,1)}let e=t.getImageData(0,0,5,5).data;for(let r=0;r<100;r++)if(r%4!=3&&e[r]!==r){On=!0;break}}}return On||!1}var he=typeof Float32Array<\"u\"?Float32Array:Array;Math.PI/180,180/Math.PI;function n1(){var t=new he(9);return he!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function Jc(){var t=new he(3);return he!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function a1(t){var e=t[0],r=t[1],i=t[2];return Math.sqrt(e*e+r*r+i*i)}function Qu(t,e,r){var i=new he(3);return i[0]=t,i[1]=e,i[2]=r,i}function s1(t,e){var r=e[0],i=e[1],n=e[2],a=r*r+i*i+n*n;return a>0&&(a=1/Math.sqrt(a)),t[0]=e[0]*a,t[1]=e[1]*a,t[2]=e[2]*a,t}function o1(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function Ds(t,e,r){var i=e[0],n=e[1],a=e[2],s=r[0],o=r[1],l=r[2];return t[0]=n*l-a*o,t[1]=a*s-i*l,t[2]=i*o-n*s,t}var l1=a1;(function(){var t=Jc();return function(e,r,i,n,a,s){var o,l;for(r||(r=3),i||(i=0),l=n?Math.min(n*r+i,e.length):e.length,o=i;o<l;o+=r)t[0]=e[o],t[1]=e[o+1],t[2]=e[o+2],a(t,t,s),e[o]=t[0],e[o+1]=t[1],e[o+2]=t[2];return e}})();function u1(){var t=new he(4);return he!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function h1(t,e){var r=e[0],i=e[1],n=e[2],a=e[3],s=r*r+i*i+n*n+a*a;return s>0&&(s=1/Math.sqrt(s)),t[0]=r*s,t[1]=i*s,t[2]=n*s,t[3]=a*s,t}function c1(t,e,r){var i=e[0],n=e[1],a=e[2],s=e[3];return t[0]=r[0]*i+r[4]*n+r[8]*a+r[12]*s,t[1]=r[1]*i+r[5]*n+r[9]*a+r[13]*s,t[2]=r[2]*i+r[6]*n+r[10]*a+r[14]*s,t[3]=r[3]*i+r[7]*n+r[11]*a+r[15]*s,t}(function(){var t=u1();return function(e,r,i,n,a,s){var o,l;for(r||(r=4),i||(i=0),l=n?Math.min(n*r+i,e.length):e.length,o=i;o<l;o+=r)t[0]=e[o],t[1]=e[o+1],t[2]=e[o+2],t[3]=e[o+3],a(t,t,s),e[o]=t[0],e[o+1]=t[1],e[o+2]=t[2],e[o+3]=t[3];return e}})();function th(){var t=new he(4);return he!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function p1(t,e,r){r*=.5;var i=Math.sin(r);return t[0]=i*e[0],t[1]=i*e[1],t[2]=i*e[2],t[3]=Math.cos(r),t}function _s(t,e,r,i){var n=e[0],a=e[1],s=e[2],o=e[3],l=r[0],u=r[1],h=r[2],c=r[3],p,f=n*l+a*u+s*h+o*c,d,y,m;return f<0&&(f=-f,l=-l,u=-u,h=-h,c=-c),1-f>1e-6?(p=Math.acos(f),d=Math.sin(p),y=Math.sin((1-i)*p)/d,m=Math.sin(i*p)/d):(y=1-i,m=i),t[0]=y*n+m*l,t[1]=y*a+m*u,t[2]=y*s+m*h,t[3]=y*o+m*c,t}function f1(t,e){var r=e[0]+e[4]+e[8],i;if(r>0)i=Math.sqrt(r+1),t[3]=.5*i,i=.5/i,t[0]=(e[5]-e[7])*i,t[1]=(e[6]-e[2])*i,t[2]=(e[1]-e[3])*i;else{var n=0;e[4]>e[0]&&(n=1),e[8]>e[n*3+n]&&(n=2);var a=(n+1)%3,s=(n+2)%3;i=Math.sqrt(e[n*3+n]-e[a*3+a]-e[s*3+s]+1),t[n]=.5*i,i=.5/i,t[3]=(e[a*3+s]-e[s*3+a])*i,t[a]=(e[a*3+n]+e[n*3+a])*i,t[s]=(e[s*3+n]+e[n*3+s])*i}return t}var eh=h1;(function(){var t=Jc(),e=Qu(1,0,0),r=Qu(0,1,0);return function(i,n,a){var s=o1(n,a);return s<-.999999?(Ds(t,e,n),l1(t)<1e-6&&Ds(t,r,n),s1(t,t),p1(i,t,Math.PI),i):s>.999999?(i[0]=0,i[1]=0,i[2]=0,i[3]=1,i):(Ds(t,n,a),i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=1+s,eh(i,i))}})(),(function(){var t=th(),e=th();return function(r,i,n,a,s,o){return _s(t,i,s,o),_s(e,n,a,o),_s(r,t,e,2*o*(1-o)),r}})(),(function(){var t=n1();return function(e,r,i,n){return t[0]=i[0],t[3]=i[1],t[6]=i[2],t[1]=n[0],t[4]=n[1],t[7]=n[2],t[2]=-r[0],t[5]=-r[1],t[8]=-r[2],eh(e,f1(e,t))}})();function d1(){var t=new he(2);return he!=Float32Array&&(t[0]=0,t[1]=0),t}(function(){var t=d1();return function(e,r,i,n,a,s){var o,l;for(r||(r=2),i||(i=0),l=n?Math.min(n*r+i,e.length):e.length,o=i;o<l;o+=r)t[0]=e[o],t[1]=e[o+1],a(t,t,s),e[o]=t[0],e[o+1]=t[1];return e}})();var mt=8192;var Qc=\"__$json__:\";function Wi(t){return t instanceof Error?t:Error(typeof t==\"string\"?t:String(t))}function y1(t){if(t<=0)return 0;if(t>=1)return 1;let e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}function m1(t,e,r,i){return e1(t,e,r,i)}var i5=m1(.25,.1,.25,1);function Zi(t,e,r){return Math.min(r,Math.max(e,t))}function g1(t,e,r){let i=r-e,n=((t-e)%i+i)%i+e;return n===e?r:n}function qt(t,...e){for(let r of e)for(let i in r)t[i]=r[i];return t}function x1(t){return Math.log(t)/Math.LN2%1==0}function Aa(t,e,r){let i={};for(let n in t)i[n]=e.call(r||this,t[n],n,t);return i}function v1(t,e,r){let i={};for(let n in t)e.call(r||this,t[n],n,t)&&(i[n]=t[n]);return i}function Ye(t){return Array.isArray(t)?t.map(Ye):typeof t==\"object\"&&t?Aa(t,Ye):t}var rh={};function Mt(t){rh[t]||(typeof console<\"u\"&&console.warn(t),rh[t]=!0)}function We(t,e,r){return(r.y-t.y)*(e.x-t.x)>(e.y-t.y)*(r.x-t.x)}function fr(t){return typeof WorkerGlobalScope<\"u\"&&t!==void 0&&t instanceof WorkerGlobalScope}function Sa(t){return typeof ImageBitmap<\"u\"&&t instanceof ImageBitmap}function b1(t,e,r,i,n){let a=Math.max(-e,0)*4,s=(Math.max(0,r)-r)*i*4+a,o=i*4,l=Math.max(0,e),u=Math.max(0,r),h=Math.min(t.width,e+i),c=Math.min(t.height,r+n);return{rect:{x:l,y:u,width:h-l,height:c-u},layout:[{offset:s,stride:o}]}}async function w1(t,e,r,i,n){if(typeof VideoFrame>\"u\")throw Error(\"VideoFrame not supported\");let a=new VideoFrame(t,{timestamp:0});try{let s=a?.format;if(!s||!(s.startsWith(\"BGR\")||s.startsWith(\"RGB\")))throw Error(`Unrecognized format ${s}`);let o=s.startsWith(\"BGR\"),l=new Uint8ClampedArray(i*n*4);if(await a.copyTo(l,b1(t,e,r,i,n)),o)for(let u=0;u<l.length;u+=4){let h=l[u];l[u]=l[u+2],l[u+2]=h}return l}finally{a.close()}}var _i,Ai;function D1(t,e,r,i,n){let a=t.width,s=t.height;(!_i||!Ai)&&(_i=new OffscreenCanvas(a,s),Ai=_i.getContext(\"2d\",{willReadFrequently:!0})),_i.width=a,_i.height=s,Ai.drawImage(t,0,0,a,s);let o=Ai.getImageData(e,r,i,n);return Ai.clearRect(0,0,a,s),o.data}async function tp(t,e,r,i,n){if(i1())try{return await w1(t,e,r,i,n)}catch{}return D1(t,e,r,i,n)}function ih(t,e,r,i){return t.addEventListener(e,r,i),{unsubscribe:()=>{t.removeEventListener(e,r,i)}}}function nh(t){return t*Math.PI/180}var ah=\"AbortError\",ll=class extends Error{constructor(t=ah){super(t instanceof Error?t.message:t),this.name=ah,t instanceof Error&&t.stack&&(this.stack=t.stack)}};function ul(t){return t instanceof Error&&t.name===\"AbortError\"}function _1(t){if(t.aborted)throw new ll(t.reason)}var hl={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:\"\"};function A1(t){return hl.REGISTERED_PROTOCOLS[t.substring(0,t.indexOf(\"://\"))]}function ep(t,e){hl.REGISTERED_PROTOCOLS[t]=e}function rp(t){delete hl.REGISTERED_PROTOCOLS[t]}var sh=\"global-dispatcher\",ua=class extends Error{constructor(t,e,r,i){super(`AJAXError: ${e} (${t}): ${r}`),this.status=t,this.statusText=e,this.url=r,this.body=i}};function ip(){if(fr(self))return self.worker?.referrer;if(window.location.protocol===\"blob:\")try{return window.parent.location.href}catch{}return window.location.href}var S1=t=>t.startsWith(\"file:\")||ip()?.startsWith(\"file:\")&&!/^\\w+:/.test(t);async function E1(t,e){let r=new Request(t.url,{method:t.method||\"GET\",body:t.body,credentials:t.credentials,headers:t.headers,cache:t.cache,referrer:ip(),referrerPolicy:t.referrerPolicy,signal:e.signal});t.type===\"json\"&&!r.headers.has(\"Accept\")&&r.headers.set(\"Accept\",\"application/json\");let i;try{i=await fetch(r)}catch(s){throw ul(s)?s:new ua(0,Wi(s).message,t.url,new Blob)}if(!i.ok){let s=await i.blob();throw new ua(i.status,i.statusText,t.url,s)}let n;n=t.type===\"arrayBuffer\"||t.type===\"image\"?i.arrayBuffer():t.type===\"json\"?i.json():i.text();let a=await n;return _1(e.signal),{data:a,cacheControl:i.headers.get(\"Cache-Control\"),expires:i.headers.get(\"Expires\"),etag:i.headers.get(\"ETag\")}}function F1(t,e){return new Promise((r,i)=>{let n=new XMLHttpRequest;n.open(t.method||\"GET\",t.url,!0),(t.type===\"arrayBuffer\"||t.type===\"image\")&&(n.responseType=\"arraybuffer\");for(let a in t.headers)n.setRequestHeader(a,t.headers[a]);t.type===\"json\"&&(n.responseType=\"text\",t.headers?.Accept||n.setRequestHeader(\"Accept\",\"application/json\")),n.withCredentials=t.credentials===\"include\",n.onerror=()=>{i(Error(n.statusText))},n.onload=()=>{if(!e.signal.aborted)if((n.status>=200&&n.status<300||n.status===0)&&n.response!==null){let a=n.response;if(t.type===\"json\")try{a=JSON.parse(n.response)}catch(s){i(s);return}r({data:a,cacheControl:n.getResponseHeader(\"Cache-Control\"),expires:n.getResponseHeader(\"Expires\"),etag:n.getResponseHeader(\"ETag\")})}else{let a=new Blob([n.response],{type:n.getResponseHeader(\"Content-Type\")});i(new ua(n.status,n.statusText,t.url,a))}},e.signal.addEventListener(\"abort\",()=>{n.abort(),i(new ll(e.signal.reason))}),n.send(t.body)})}var Ea=async function(t,e){if(t.url.includes(\"://\")&&!/^https?:|^file:/.test(t.url)){let r=A1(t.url);if(r){let i=await r(t,e);return!i.data&&t.type===\"arrayBuffer\"?qt(i,{data:new ArrayBuffer(0)}):i}if(fr(self)&&self.worker?.actor)return self.worker.actor.sendAsync({type:\"GR\",data:t,targetMapId:sh},e)}if(!S1(t.url)){if(fetch&&Request&&AbortController&&Object.hasOwn(Request.prototype,\"signal\"))return E1(t,e);if(fr(self)&&self.worker?.actor)return self.worker.actor.sendAsync({type:\"GR\",data:t,mustQueue:!0,targetMapId:sh},e)}return F1(t,e)},np=(t,e)=>Ea(qt(t,{type:\"json\"}),e),ap=(t,e)=>Ea(qt(t,{type:\"arrayBuffer\"}),e);function oh(t,e,r){r[t]?.includes(e)||(r[t]||(r[t]=[]),r[t].push(e))}function As(t,e,r){if(r?.[t]){let i=r[t].indexOf(e);i!==-1&&r[t].splice(i,1)}}var sp=class{constructor(t,e={}){qt(this,e),this.type=t}},ha=class extends sp{constructor(t,e={}){super(\"error\",qt({error:t},e))}},k1=class{on(t,e){return this._listeners||(this._listeners={}),oh(t,e,this._listeners),{unsubscribe:()=>{this.off(t,e)}}}off(t,e){return As(t,e,this._listeners),As(t,e,this._oneTimeListeners),this}once(t,e){return e?(this._oneTimeListeners||(this._oneTimeListeners={}),oh(t,e,this._oneTimeListeners),this):new Promise(r=>this.once(t,r))}fire(t,e){let r=typeof t==\"string\"?new sp(t,e||{}):t,i=r.type;if(this.listens(i)){r.target=this;let n=this._listeners?.[i]?.slice()??[];for(let o of n)o.call(this,r);let a=this._oneTimeListeners?.[i]?.slice()??[];for(let o of a)As(i,o,this._oneTimeListeners),o.call(this,r);let s=this._eventedParent;s&&(qt(r,typeof this._eventedParentData==\"function\"?this._eventedParentData():this._eventedParentData),s.fire(r))}else r instanceof ha&&console.error(r.error);return this}listens(t){return!!(this._listeners?.[t]?.length||this._oneTimeListeners?.[t]?.length||this._eventedParent?.listens(t))}setEventedParent(t,e){return this._eventedParent=t,this._eventedParentData=e,this}},op={$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\"},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:{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\"},\"fill-extrusion-rounded-corner-distance\":{type:\"number\",default:0,minimum:0,units:\"meters\",\"property-type\":\"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\",\"feature\"]},\"property-type\":\"data-driven\"},\"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\"},\"symbol-height-offset\":{type:\"number\",default:0,units:\"meters\",requires:[{\"symbol-placement\":[\"point\"]}],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"symbol-height-anchor\":{type:\"enum\",values:{ground:{},absolute:{}},default:\"ground\",requires:[\"symbol-height-offset\"],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-layer-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\",\"global-state\"]},\"property-type\":\"data-constant\"},\"fill-color\":{type:\"color\",default:\"#000000\",transition:!0,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,units:\"meters\",transition:!0,expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"fill-extrusion-base\":{type:\"number\",default:0,units:\"meters\",transition:!0,requires:[\"fill-extrusion-height\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"fill-extrusion-vertical-gradient\":{type:\"boolean\",default:!0,transition:!1,expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"}},paint_line:{\"line-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"line-layer-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\",\"global-state\"]},\"property-type\":\"data-constant\"},\"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\"}]}}}}},D=op,lp=[\"type\",\"source\",\"source-layer\",\"minzoom\",\"maxzoom\",\"filter\",\"layout\"],k=class{constructor(t,e,r,i,n=\"error\"){this.message=(t?`${t}: `:\"\")+r,i&&(this.identifier=i),this.severity=n,e!=null&&e.__line__&&(this.line=e.__line__)}},cn={kind:\"null\"},T={kind:\"number\"},Y={kind:\"string\"},tt={kind:\"boolean\"},ue={kind:\"color\"},Fa={kind:\"projectionDefinition\"},hr={kind:\"object\"},Z={kind:\"value\"},T1={kind:\"error\"},ka={kind:\"collator\"},pn={kind:\"formatted\"},Ta={kind:\"padding\"},Hi={kind:\"colorArray\"},Ia={kind:\"numberArray\"},fn={kind:\"resolvedImage\"},Ca={kind:\"variableAnchorOffsetCollection\"};function Nt(t,e){return{kind:\"array\",itemType:t,N:e}}function yt(t){if(t.kind===\"array\"){let e=yt(t.itemType);return typeof t.N==\"number\"?`array<${e}, ${t.N}>`:t.itemType.kind===\"value\"?\"array\":`array<${e}>`}return t.kind}var I1=[cn,T,Y,tt,ue,Fa,pn,hr,Nt(Z),Ta,Ia,Hi,fn,Ca];function Ki(t,e){if(e.kind===\"error\")return null;if(t.kind===\"array\"){if(e.kind===\"array\"&&(e.N===0&&e.itemType.kind===\"value\"||!Ki(t.itemType,e.itemType))&&(typeof t.N!=\"number\"||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if(t.kind===\"value\"){for(let r of I1)if(!Ki(r,e))return null}}return`Expected ${yt(t)} but found ${yt(e)} instead.`}function cl(t,e){return e.some(r=>r.kind===t.kind)}function cr(t,e){return e.some(r=>r===\"null\"?t===null:r===\"array\"?Array.isArray(t):r===\"object\"?t&&!Array.isArray(t)&&typeof t==\"object\":r===typeof t)}function Ue(t,e){return t.kind===\"array\"&&e.kind===\"array\"?t.itemType.kind===e.itemType.kind&&typeof t.N==\"number\":t.kind===e.kind}var up=.96422,hp=.82521,cp=4/29,Gs=6/29,pp=3*Gs*Gs,C1=Math.PI/180,M1=180/Math.PI;function fp(t){return t%=360,t<0&&(t+=360),t}function dp([t,e,r,i]){t=Ss(t),e=Ss(e),r=Ss(r);let n,a,s=Es((.2225045*t+.7168786*e+.0606169*r)/1);t===e&&e===r?n=a=s:(n=Es((.4360747*t+.3850649*e+.1430804*r)/up),a=Es((.0139322*t+.0971045*e+.7141733*r)/hp));let o=116*s-16;return[o<0?0:o,500*(n-s),200*(s-a),i]}function Ss(t){return t<=.04045?t/12.92:((t+.055)/1.055)**2.4}function Es(t){return t>.008856451679035631?t**(1/3):t/pp+cp}function yp([t,e,r,i]){let n=(t+16)/116,a=isNaN(e)?n:n+e/500,s=isNaN(r)?n:n-r/200;return n=1*ks(n),a=up*ks(a),s=hp*ks(s),[Fs(3.1338561*a-1.6168667*n-.4906146*s),Fs(-.9787684*a+1.9161415*n+.033454*s),Fs(.0719453*a-.2289914*n+1.4052427*s),i]}function Fs(t){return t=t<=.00304?12.92*t:1.055*t**(1/2.4)-.055,t<0?0:t>1?1:t}function ks(t){return t>Gs?t*t*t:pp*(t-cp)}function B1(t){let[e,r,i,n]=dp(t),a=Math.sqrt(r*r+i*i);return[Math.round(a*1e4)?fp(Math.atan2(i,r)*M1):NaN,a,e,n]}function P1([t,e,r,i]){return t=isNaN(t)?0:t*C1,yp([r,Math.cos(t)*e,Math.sin(t)*e,i])}function z1([t,e,r,i]){t=fp(t),e/=100,r/=100;function n(a){let s=(a+t/30)%12,o=e*Math.min(r,1-r);return r-o*Math.max(-1,Math.min(s-3,9-s,1))}return[n(0),n(8),n(4),i]}var L1=Object.hasOwn||function(t,e){return Object.prototype.hasOwnProperty.call(t,e)};function Ni(t,e){return L1(t,e)?t[e]:void 0}function V1(t){if(t=t.toLowerCase().trim(),t===\"transparent\")return[0,0,0,0];let e=Ni(O1,t);if(e){let[i,n,a]=e;return[i/255,n/255,a/255,1]}if(t.startsWith(\"#\")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(t)){let i=t.length<6?1:2,n=1;return[Rn(t.slice(n,n+=i)),Rn(t.slice(n,n+=i)),Rn(t.slice(n,n+=i)),Rn(t.slice(n,n+i)||\"ff\")]}if(t.startsWith(\"rgb\")){let i=t.match(/^rgba?\\(\\s*([\\de.+-]+)(%)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)(%)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)(%)?(?:\\s*([,\\/])\\s*([\\de.+-]+)(%)?)?\\s*\\)$/);if(i){let[n,a,s,o,l,u,h,c,p,f,d,y]=i,m=[o||\" \",h||\" \",f].join(\"\");if(m===\" \"||m===\" /\"||m===\",,\"||m===\",,,\"){let g=[s,u,p].join(\"\"),x=g===\"%%%\"?100:g===\"\"?255:0;if(x){let b=[Vr(+a/x,0,1),Vr(+l/x,0,1),Vr(+c/x,0,1),d?lh(+d,y):1];if(uh(b))return b}}return}}let r=t.match(/^hsla?\\(\\s*([\\de.+-]+)(?:deg)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)%(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)%(?:\\s*([,\\/])\\s*([\\de.+-]+)(%)?)?\\s*\\)$/);if(r){let[i,n,a,s,o,l,u,h,c]=r,p=[a||\" \",o||\" \",u].join(\"\");if(p===\" \"||p===\" /\"||p===\",,\"||p===\",,,\"){let f=[+n,Vr(+s,0,100),Vr(+l,0,100),h?lh(+h,c):1];if(uh(f))return z1(f)}}}function Rn(t){return parseInt(t.padEnd(2,t),16)/255}function lh(t,e){return Vr(e?t/100:t,0,1)}function Vr(t,e,r){return Math.min(Math.max(e,t),r)}function uh(t){return!t.some(Number.isNaN)}var O1={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function Ze(t,e,r){return t+r*(e-t)}function Jr(t,e,r){return t.map((i,n)=>Ze(i,e[n],r))}function R1(t){return t===\"rgb\"||t===\"hcl\"||t===\"lab\"}var Bt,gt=(Bt=class{constructor(e,r,i,n=1,a=!0){this.r=e,this.g=r,this.b=i,this.a=n,a||(this.r*=n,this.g*=n,this.b*=n,n||this.overwriteGetter(\"rgb\",[e,r,i,n]))}static parse(e){if(e instanceof Bt)return e;if(typeof e!=\"string\")return;let r=V1(e);if(r)return new Bt(...r,!1)}get rgb(){let{r:e,g:r,b:i,a:n}=this,a=n||1/0;return this.overwriteGetter(\"rgb\",[e/a,r/a,i/a,n])}get hcl(){return this.overwriteGetter(\"hcl\",B1(this.rgb))}get lab(){return this.overwriteGetter(\"lab\",dp(this.rgb))}overwriteGetter(e,r){return Object.defineProperty(this,e,{value:r}),r}toString(){let[e,r,i,n]=this.rgb;return`rgba(${[e,r,i].map(a=>Math.round(a*255)).join(\",\")},${n})`}static interpolate(e,r,i,n=\"rgb\"){switch(n){case\"rgb\":{let[a,s,o,l]=Jr(e.rgb,r.rgb,i);return new Bt(a,s,o,l,!1)}case\"hcl\":{let[a,s,o,l]=e.hcl,[u,h,c,p]=r.hcl,f,d;if(!isNaN(a)&&!isNaN(u)){let b=u-a;u>a&&b>180?b-=360:u<a&&a-u>180&&(b+=360),f=a+i*b}else isNaN(a)?isNaN(u)?f=NaN:(f=u,(o===1||o===0)&&(d=h)):(f=a,(c===1||c===0)&&(d=s));let[y,m,g,x]=P1([f,d??Ze(s,h,i),Ze(o,c,i),Ze(l,p,i)]);return new Bt(y,m,g,x,!1)}case\"lab\":{let[a,s,o,l]=yp(Jr(e.lab,r.lab,i));return new Bt(a,s,o,l,!1)}}}},Bt.black=new Bt(0,0,0,1),Bt.white=new Bt(1,1,1,1),Bt.transparent=new Bt(0,0,0,0),Bt.red=new Bt(1,0,0,1),Bt),$1=[\"bottom\",\"center\",\"top\"],Xs=class{constructor(t,e,r,i,n,a){this.text=t,this.image=e,this.scale=r,this.fontStack=i,this.textColor=n,this.verticalAlign=a}},Be=class ra{constructor(e){this.sections=e}static fromString(e){return new ra([new Xs(e,null,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(e=>e.text.length!==0||e.image&&e.image.name.length!==0)}static factory(e){return e instanceof ra?e:ra.fromString(e)}toString(){return this.sections.length===0?\"\":this.sections.map(e=>e.text).join(\"\")}},De=class Bi{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Bi)return e;if(typeof e==\"number\")return new Bi([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(let r of e)if(typeof r!=\"number\")return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new Bi(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,r,i){return new Bi(Jr(e.values,r.values,i))}},_e=class Pi{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Pi)return e;if(typeof e==\"number\")return new Pi([e]);if(Array.isArray(e)){for(let r of e)if(typeof r!=\"number\")return;return new Pi(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,r,i){return new Pi(Jr(e.values,r.values,i))}},ae=class zi{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof zi)return e;if(typeof e==\"string\"){let i=gt.parse(e);return i?new zi([i]):void 0}if(!Array.isArray(e))return;let r=[];for(let i of e){if(typeof i!=\"string\")return;let n=gt.parse(i);if(!n)return;r.push(n)}return new zi(r)}toString(){return JSON.stringify(this.values)}static interpolate(e,r,i,n=\"rgb\"){let a=[];if(e.values.length!=r.values.length)throw Error(`colorArray: Arrays have mismatched length (${e.values.length} vs. ${r.values.length}), cannot interpolate.`);for(let s=0;s<e.values.length;s++)a.push(gt.interpolate(e.values[s],r.values[s],i,n));return new zi(a)}},ct=class extends Error{constructor(t,e){super(t),this.name=\"RuntimeError\",this.path=e}toJSON(){return this.message}},N1=new Set([\"center\",\"left\",\"right\",\"top\",\"bottom\",\"top-left\",\"top-right\",\"bottom-left\",\"bottom-right\"]),be=class ia{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof ia)return e;if(!(!Array.isArray(e)||e.length<1||e.length%2!=0)){for(let r=0;r<e.length;r+=2){let i=e[r],n=e[r+1];if(typeof i!=\"string\"||!N1.has(i)||!Array.isArray(n)||n.length!==2||typeof n[0]!=\"number\"||typeof n[1]!=\"number\")return}return new ia(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,r,i,n){let a=e.values,s=r.values;if(a.length!==s.length)throw new ct(`Cannot interpolate values of different length. from: ${e.toString()}, to: ${r.toString()}`,n);let o=[];for(let l=0;l<a.length;l+=2){if(a[l]!==s[l])throw new ct(`Cannot interpolate values containing mismatched anchors. from[${l}]: ${a[l]}, to[${l}]: ${s[l]}`,n);o.push(a[l]);let[u,h]=a[l+1],[c,p]=s[l+1];o.push([Ze(u,c,i),Ze(h,p,i)])}return new ia(o)}},we=class mp{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new mp({name:e,available:!1}):null}},vr=class Or{constructor(e,r,i){this.from=e,this.to=r,this.transition=i}toString(){return this.from===this.to&&this.transition===1?this.from:JSON.stringify([this.from,this.to,this.transition])}static interpolate(e,r,i){return new Or(e,r,i)}static parse(e){if(e instanceof Or)return e;if(Array.isArray(e)&&e.length===3&&typeof e[0]==\"string\"&&typeof e[1]==\"string\"&&typeof e[2]==\"number\")return new Or(e[0],e[1],e[2]);if(typeof e==\"object\"&&typeof e.from==\"string\"&&typeof e.to==\"string\"&&typeof e.transition==\"number\")return new Or(e.from,e.to,e.transition);if(typeof e==\"string\")return new Or(e,e,1)}},pl=class{constructor(t,e,r){this.sensitivity=t?e?\"variant\":\"case\":e?\"accent\":\"base\",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:\"search\"})}compare(t,e){return this.collator.compare(t,e)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}};function gp(t,e,r,i){return typeof t==\"number\"&&t>=0&&t<=255&&typeof e==\"number\"&&e>=0&&e<=255&&typeof r==\"number\"&&r>=0&&r<=255?i===void 0||typeof i==\"number\"&&i>=0&&i<=1?null:`Invalid rgba value [${[t,e,r,i].join(\", \")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof i==\"number\"?[t,e,r,i]:[t,e,r]).join(\", \")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Qr(t){if(t===null||typeof t==\"string\"||typeof t==\"boolean\"||typeof t==\"number\"||t instanceof vr||t instanceof gt||t instanceof pl||t instanceof Be||t instanceof De||t instanceof _e||t instanceof ae||t instanceof be||t instanceof we)return!0;if(Array.isArray(t)){for(let e of t)if(!Qr(e))return!1;return!0}if(typeof t==\"object\"){for(let e in t)if(!Qr(t[e]))return!1;return!0}return!1}function _t(t){if(t===null)return cn;if(typeof t==\"string\")return Y;if(typeof t==\"boolean\")return tt;if(typeof t==\"number\")return T;if(t instanceof gt)return ue;if(t instanceof vr)return Fa;if(t instanceof pl)return ka;if(t instanceof Be)return pn;if(t instanceof De)return Ta;if(t instanceof _e)return Ia;if(t instanceof ae)return Hi;if(t instanceof be)return Ca;if(t instanceof we)return fn;if(Array.isArray(t)){let e=t.length,r;for(let i of t){let n=_t(i);if(!r)r=n;else{if(r===n)continue;r=Z;break}}return Nt(r||Z,e)}return hr}function Ui(t){let e=typeof t;return t===null?\"\":e===\"string\"||e===\"number\"||e===\"boolean\"?String(t):t instanceof gt||t instanceof vr||t instanceof Be||t instanceof De||t instanceof _e||t instanceof ae||t instanceof be||t instanceof we?t.toString():JSON.stringify(t)}var ti=class xp{constructor(e,r){this.type=e,this.value=r}static parse(e,r){if(e.length!==2)return r.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!Qr(e[1]))return r.error(`invalid value of type \"${typeof e[1]}\"`);let i=e[1],n=_t(i),a=r.expectedType;return n.kind===\"array\"&&n.N===0&&a&&a.kind===\"array\"&&(typeof a.N!=\"number\"||a.N===0)&&(n=a),new xp(n,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}},U1=[\"Unknown\",\"Point\",\"LineString\",\"Polygon\"],vp=class{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?typeof this.feature.type==\"number\"?U1[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&\"geometry\"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(t){let e=this._parseColorCache.get(t);return e||(e=gt.parse(t),this._parseColorCache.set(t,e)),e}};function Ma(t,e,r){let i=t.length-1,n=0,a=i,s=0,o,l;for(;n<=a;)if(s=Math.floor((n+a)/2),o=t[s],l=t[s+1],o<=e){if(s===i||e<l)return s;n=s+1}else if(o>e)a=s-1;else throw new ct(\"Input is not a number.\",r);return 0}var fl=class bp{constructor(e,r,i,n){this.type=e,this.input=r,this.key=n,this.labels=[],this.outputs=[];for(let[a,s]of i)this.labels.push(a),this.outputs.push(s)}static parse(e,r){if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error(\"Expected an even number of arguments.\");let i=r.parse(e[1],1,T);if(!i)return null;let n=[],a=null;r.expectedType&&r.expectedType.kind!==\"value\"&&(a=r.expectedType);for(let s=1;s<e.length;s+=2){let o=s===1?-1/0:e[s],l=e[s+1],u=s,h=s+1;if(typeof o!=\"number\")return r.error('Input/output pairs for \"step\" expressions must be defined using literal numeric values (not computed expressions) for the input values.',u);if(n.length&&n[n.length-1][0]>=o)return r.error('Input/output pairs for \"step\" expressions must be arranged with input values in strictly ascending order.',u);let c=r.parse(l,h,a);if(!c)return null;a||(a=c.type),n.push([o,c])}return new bp(a,i,n,r.key)}evaluate(e){let r=this.labels,i=this.outputs;if(r.length===1)return i[0].evaluate(e);let n=this.input.evaluate(e);if(n<=r[0])return i[0].evaluate(e);let a=r.length;return n>=r[a-1]?i[a-1].evaluate(e):i[Ma(r,n,this.key)].evaluate(e)}eachChild(e){e(this.input);for(let r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}};function q1(t,e,r,i){let n=3*t,a=3*(r-t)-n,s=1-n-a,o=3*e,l=3*(i-e)-o,u=1-o-l;return function(h,c=1e-6){if(h<=0)return 0;if(h>=1)return 1;let p=h;for(let y=0;y<8;y++){let m=((s*p+a)*p+n)*p-h;if(Math.abs(m)<c)return((u*p+l)*p+o)*p;let g=(3*s*p+2*a)*p+n;if(Math.abs(g)<1e-6)break;p-=m/g}let f=0,d=1;p=h;for(let y=0;y<20;y++){let m=((s*p+a)*p+n)*p;if(Math.abs(m-h)<c)break;h>m?f=p:d=p,p=(f+d)*.5}return((u*p+l)*p+o)*p}}var xe=class Ys{constructor(e,r,i,n,a,s){this.type=e,this.operator=r,this.interpolation=i,this.input=n,this.key=s,this.labels=[],this.outputs=[];for(let[o,l]of a)this.labels.push(o),this.outputs.push(l)}static interpolationFactor(e,r,i,n){let a=0;if(e.name===\"exponential\")a=Ts(r,e.base,i,n);else if(e.name===\"linear\")a=Ts(r,1,i,n);else if(e.name===\"cubic-bezier\"){let s=e.controlPoints;a=q1(s[0],s[1],s[2],s[3])(Ts(r,1,i,n))}return a}static parse(e,r){let[i,n,a,...s]=e;if(!Array.isArray(n)||n.length===0)return r.error(\"Expected an interpolation type expression.\",1);if(n[0]===\"linear\")n={name:\"linear\"};else if(n[0]===\"exponential\"){let u=n[1];if(typeof u!=\"number\")return r.error(\"Exponential interpolation requires a numeric base.\",1,1);n={name:\"exponential\",base:u}}else if(n[0]===\"cubic-bezier\"){let u=n.slice(1);if(u.length!==4||u.some(h=>typeof h!=\"number\"||h<0||h>1))return r.error(\"Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.\",1);n={name:\"cubic-bezier\",controlPoints:u}}else return r.error(`Unknown interpolation type ${String(n[0])}`,1,0);if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error(\"Expected an even number of arguments.\");if(a=r.parse(a,2,T),!a)return null;let o=[],l=null;(i===\"interpolate-hcl\"||i===\"interpolate-lab\")&&r.expectedType!=Hi?l=ue:r.expectedType&&r.expectedType.kind!==\"value\"&&(l=r.expectedType);for(let u=0;u<s.length;u+=2){let h=s[u],c=s[u+1],p=u+3,f=u+4;if(typeof h!=\"number\")return r.error('Input/output pairs for \"interpolate\" expressions must be defined using literal numeric values (not computed expressions) for the input values.',p);if(o.length&&o[o.length-1][0]>=h)return r.error('Input/output pairs for \"interpolate\" expressions must be arranged with input values in strictly ascending order.',p);let d=r.parse(c,f,l);if(!d)return null;l||(l=d.type),o.push([h,d])}return!Ue(l,T)&&!Ue(l,Fa)&&!Ue(l,ue)&&!Ue(l,Ta)&&!Ue(l,Ia)&&!Ue(l,Hi)&&!Ue(l,Ca)&&!Ue(l,Nt(T))?r.error(`Type ${yt(l)} is not interpolatable.`):new Ys(l,i,n,a,o,r.key)}evaluate(e){let r=this.labels,i=this.outputs;if(r.length===1)return i[0].evaluate(e);let n=this.input.evaluate(e);if(n<=r[0])return i[0].evaluate(e);let a=r.length;if(n>=r[a-1])return i[a-1].evaluate(e);let s=Ma(r,n,this.key),o=r[s],l=r[s+1],u=Ys.interpolationFactor(this.interpolation,n,o,l),h=i[s].evaluate(e),c=i[s+1].evaluate(e);switch(this.operator){case\"interpolate\":switch(this.type.kind){case\"number\":return Ze(h,c,u);case\"color\":return gt.interpolate(h,c,u);case\"padding\":return De.interpolate(h,c,u);case\"colorArray\":return ae.interpolate(h,c,u);case\"numberArray\":return _e.interpolate(h,c,u);case\"variableAnchorOffsetCollection\":return be.interpolate(h,c,u,this.key);case\"array\":return Jr(h,c,u);case\"projectionDefinition\":return vr.interpolate(h,c,u)}case\"interpolate-hcl\":switch(this.type.kind){case\"color\":return gt.interpolate(h,c,u,\"hcl\");case\"colorArray\":return ae.interpolate(h,c,u,\"hcl\")}case\"interpolate-lab\":switch(this.type.kind){case\"color\":return gt.interpolate(h,c,u,\"lab\");case\"colorArray\":return ae.interpolate(h,c,u,\"lab\")}}}eachChild(e){e(this.input);for(let r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}};function Ts(t,e,r,i){let n=i-r,a=t-r;return n===0?0:e===1?a/n:(e**+a-1)/(e**+n-1)}var dr={color:gt.interpolate,number:Ze,padding:De.interpolate,numberArray:_e.interpolate,colorArray:ae.interpolate,variableAnchorOffsetCollection:be.interpolate,array:Jr},wp=class Dp{constructor(e){this.type=pn,this.sections=e}static parse(e,r){if(e.length<2)return r.error(\"Expected at least one argument.\");let i=e[1];if(!Array.isArray(i)&&typeof i==\"object\")return r.error(\"First argument must be an image or text section.\");let n=[],a=!1;for(let s=1;s<=e.length-1;++s){let o=e[s];if(a&&typeof o==\"object\"&&!Array.isArray(o)){a=!1;let l=null;if(o[\"font-scale\"]&&(l=r.parse(o[\"font-scale\"],1,T),!l))return null;let u=null;if(o[\"text-font\"]&&(u=r.parse(o[\"text-font\"],1,Nt(Y)),!u))return null;let h=null;if(o[\"text-color\"]&&(h=r.parse(o[\"text-color\"],1,ue),!h))return null;let c=null;if(o[\"vertical-align\"]){if(typeof o[\"vertical-align\"]==\"string\"&&!$1.includes(o[\"vertical-align\"]))return r.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${o[\"vertical-align\"]}' instead.`);if(c=r.parse(o[\"vertical-align\"],1,Y),!c)return null}let p=n[n.length-1];p.scale=l,p.font=u,p.textColor=h,p.verticalAlign=c}else{let l=r.parse(e[s],1,Z);if(!l)return null;let u=l.type.kind;if(u!==\"string\"&&u!==\"value\"&&u!==\"null\"&&u!==\"resolvedImage\")return r.error(\"Formatted text type must be 'string', 'value', 'image' or 'null'.\");a=!0,n.push({content:l,scale:null,font:null,textColor:null,verticalAlign:null})}}return new Dp(n)}evaluate(e){return new Be(this.sections.map(r=>{let i=r.content.evaluate(e);return _t(i)===fn?new Xs(\"\",i,null,null,null,r.verticalAlign?r.verticalAlign.evaluate(e):null):new Xs(Ui(i),null,r.scale?r.scale.evaluate(e):null,r.font?r.font.evaluate(e).join(\",\"):null,r.textColor?r.textColor.evaluate(e):null,r.verticalAlign?r.verticalAlign.evaluate(e):null)}))}eachChild(e){for(let r of this.sections)e(r.content),r.scale&&e(r.scale),r.font&&e(r.font),r.textColor&&e(r.textColor),r.verticalAlign&&e(r.verticalAlign)}outputDefined(){return!1}};function _p(t,e,r=0,i=t.length-1,n=j1){for(;i>r;){if(i-r>600){let l=i-r+1,u=e-r+1,h=Math.log(l),c=.5*Math.exp(2*h/3),p=.5*Math.sqrt(h*c*(l-c)/l)*(u-l/2<0?-1:1);_p(t,e,Math.max(r,Math.floor(e-u*c/l+p)),Math.min(i,Math.floor(e+(l-u)*c/l+p)),n)}let a=t[e],s=r,o=i;for(Si(t,r,e),n(t[i],a)>0&&Si(t,r,i);s<o;){for(Si(t,s,o),s++,o--;n(t[s],a)<0;)s++;for(;n(t[o],a)>0;)o--}n(t[r],a)===0?Si(t,r,o):(o++,Si(t,o,i)),o<=e&&(r=o+1),e<=o&&(i=o-1)}}function Si(t,e,r){let i=t[e];t[e]=t[r],t[r]=i}function j1(t,e){return t<e?-1:+(t>e)}function Ba(t,e){if(t.length<=1)return[t];let r=[],i,n;for(let a of t){let s=X1(a);s!==0&&(a.area=Math.abs(s),n===void 0&&(n=s<0),n===s<0?(i&&r.push(i),i=[a]):i.push(a))}if(i&&r.push(i),e>1)for(let a=0;a<r.length;a++)r[a].length<=e||(_p(r[a],e,1,r[a].length-1,G1),r[a]=r[a].slice(0,e));return r}function G1(t,e){return e.area-t.area}function X1(t){let e=0;for(let r=0,i=t.length,n=i-1,a,s;r<i;n=r++)a=t[r],s=t[n],e+=(s.x-a.x)*(a.y+s.y);return e}var $n={string:Y,number:T,boolean:tt,object:hr},ke=class Ap{constructor(e,r,i){this.type=e,this.args=r,this.key=i}static parse(e,r){if(e.length<2)return r.error(\"Expected at least one argument.\");let i=1,n,a=e[0];if(a===\"array\"){let o;if(e.length>2){let u=e[1];if(typeof u!=\"string\"||!(u in $n)||u===\"object\")return r.error('The item type argument of \"array\" must be one of string, number, boolean',1);o=$n[u],i++}else o=Z;let l;if(e.length>3){if(e[2]!==null&&(typeof e[2]!=\"number\"||e[2]<0||e[2]!==Math.floor(e[2])))return r.error('The length argument to \"array\" must be a positive integer literal',2);l=e[2],i++}n=Nt(o,l)}else{if(!$n[a])throw Error(`Types doesn't contain name = ${a}`);n=$n[a]}let s=[];for(;i<e.length;i++){let o=r.parse(e[i],i,Z);if(!o)return null;s.push(o)}return new Ap(n,s,r.key)}evaluate(e){for(let r=0;r<this.args.length;r++){let i=this.args[r].evaluate(e);if(!Ki(this.type,_t(i)))return i;if(r===this.args.length-1)throw new ct(`Expected value to be of type ${yt(this.type)}, but found ${yt(_t(i))} instead.`,this.key)}throw Error()}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}},hh={\"to-boolean\":tt,\"to-color\":ue,\"to-number\":T,\"to-string\":Y},Ur=class Sp{constructor(e,r,i){this.type=e,this.args=r,this.key=i}static parse(e,r){if(e.length<2)return r.error(\"Expected at least one argument.\");let i=e[0];if(!hh[i])throw Error(`Can't parse ${i} as it is not part of the known types`);if((i===\"to-boolean\"||i===\"to-string\")&&e.length!==2)return r.error(\"Expected one argument.\");let n=hh[i],a=[];for(let s=1;s<e.length;s++){let o=r.parse(e[s],s,Z);if(!o)return null;a.push(o)}return new Sp(n,a,r.key)}evaluate(e){switch(this.type.kind){case\"boolean\":return!!this.args[0].evaluate(e);case\"color\":{let r,i;for(let n of this.args){if(r=n.evaluate(e),i=null,r instanceof gt)return r;if(typeof r==\"string\"){let a=e.parseColor(r);if(a)return a}else if(Array.isArray(r)&&(i=r.length<3||r.length>4?`Invalid rgba value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:gp(r[0],r[1],r[2],r[3]),!i))return new gt(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new ct(i||`Could not parse color from value '${typeof r==\"string\"?r:JSON.stringify(r)}'`,this.key)}case\"padding\":{let r;for(let i of this.args){r=i.evaluate(e);let n=De.parse(r);if(n)return n}throw new ct(`Could not parse padding from value '${typeof r==\"string\"?r:JSON.stringify(r)}'`,this.key)}case\"numberArray\":{let r;for(let i of this.args){r=i.evaluate(e);let n=_e.parse(r);if(n)return n}throw new ct(`Could not parse numberArray from value '${typeof r==\"string\"?r:JSON.stringify(r)}'`,this.key)}case\"colorArray\":{let r;for(let i of this.args){r=i.evaluate(e);let n=ae.parse(r);if(n)return n}throw new ct(`Could not parse colorArray from value '${typeof r==\"string\"?r:JSON.stringify(r)}'`,this.key)}case\"variableAnchorOffsetCollection\":{let r;for(let i of this.args){r=i.evaluate(e);let n=be.parse(r);if(n)return n}throw new ct(`Could not parse variableAnchorOffsetCollection from value '${typeof r==\"string\"?r:JSON.stringify(r)}'`,this.key)}case\"number\":{let r=null;for(let i of this.args){if(r=i.evaluate(e),r===null)return 0;let n=Number(r);if(!isNaN(n))return n}throw new ct(`Could not convert ${JSON.stringify(r)} to number.`,this.key)}case\"formatted\":return Be.fromString(Ui(this.args[0].evaluate(e)));case\"resolvedImage\":return we.fromString(Ui(this.args[0].evaluate(e)));case\"projectionDefinition\":{let r=this.args[0].evaluate(e);if(vr.parse(r))return r;throw new ct(`Could not parse projectionDefinition from value '${typeof r==\"string\"?r:JSON.stringify(r)}'`,this.key)}default:return Ui(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}},Ep=class Fp{constructor(e,r){this.type=r.type,this.bindings=[].concat(e),this.result=r}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(let r of this.bindings)e(r[1]);e(this.result)}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);let i=[];for(let a=1;a<e.length-1;a+=2){let s=e[a];if(typeof s!=\"string\")return r.error(`Expected string, but found ${typeof s} instead.`,a);if(/[^a-zA-Z0-9_]/.test(s))return r.error(\"Variable names must contain only alphanumeric characters or '_'.\",a);let o=r.parse(e[a+1],a+1);if(!o)return null;i.push([s,o])}let n=r.parse(e[e.length-1],e.length-1,r.expectedType,i);return n?new Fp(i,n):null}outputDefined(){return this.result.outputDefined()}},kp=class Tp{constructor(e,r){this.type=r.type,this.name=e,this.boundExpression=r}static parse(e,r){if(e.length!==2||typeof e[1]!=\"string\")return r.error(\"'var' expression requires exactly one string literal argument.\");let i=e[1];return r.scope.has(i)?new Tp(i,r.scope.get(i)):r.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}},Y1=class Ip{constructor(e,r,i,n){this.type=e,this.index=r,this.input=i,this.key=n}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let i=r.parse(e[1],1,T),n=r.parse(e[2],2,Nt(r.expectedType||Z));if(!i||!n)return null;let a=n.type;return new Ip(a.itemType,i,n,r.key)}evaluate(e){let r=this.index.evaluate(e),i=this.input.evaluate(e);if(r<0)throw new ct(`Array index out of bounds: ${r} < 0.`,this.key);if(r>=i.length)throw new ct(`Array index out of bounds: ${r} > ${i.length-1}.`,this.key);if(r!==Math.floor(r))throw new ct(`Array index must be an integer, but found ${r} instead.`,this.key);return i[r]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}},W1=class Cp{constructor(e,r,i){this.needle=e,this.haystack=r,this.key=i,this.type=tt}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let i=r.parse(e[1],1,Z),n=r.parse(e[2],2,Z);return!i||!n?null:cl(i.type,[tt,Y,T,cn,Z])?new Cp(i,n,r.key):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${yt(i.type)} instead`)}evaluate(e){let r=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(!i)return!1;if(!cr(r,[\"boolean\",\"string\",\"number\",\"null\"]))throw new ct(`Expected first argument to be of type boolean, string, number or null, but found ${yt(_t(r))} instead.`,this.key);if(!cr(i,[\"string\",\"array\"]))throw new ct(`Expected second argument to be of type array or string, but found ${yt(_t(i))} instead.`,this.key);return i.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}},Z1=class Ws{constructor(e,r,i,n){this.needle=e,this.haystack=r,this.key=i,this.fromIndex=n,this.type=T}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);let i=r.parse(e[1],1,Z),n=r.parse(e[2],2,Z);if(!i||!n)return null;if(!cl(i.type,[tt,Y,T,cn,Z]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${yt(i.type)} instead`);if(e.length===4){let a=r.parse(e[3],3,T);return a?new Ws(i,n,r.key,a):null}return new Ws(i,n,r.key)}evaluate(e){let r=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(!cr(r,[\"boolean\",\"string\",\"number\",\"null\"]))throw new ct(`Expected first argument to be of type boolean, string, number or null, but found ${yt(_t(r))} instead.`,this.key);let n;if(this.fromIndex&&(n=this.fromIndex.evaluate(e)),cr(i,[\"string\"])){let a=i.indexOf(r,n);return a===-1?-1:[...i.slice(0,a)].length}if(cr(i,[\"array\"]))return i.indexOf(r,n);throw new ct(`Expected second argument to be of type array or string, but found ${yt(_t(i))} instead.`,this.key)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}},H1=class Mp{constructor(e,r,i,n,a,s){this.inputType=e,this.type=r,this.input=i,this.cases=n,this.outputs=a,this.otherwise=s}static parse(e,r){if(e.length<5)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return r.error(\"Expected an even number of arguments.\");let i,n;r.expectedType&&r.expectedType.kind!==\"value\"&&(n=r.expectedType);let a={},s=[];for(let u=2;u<e.length-1;u+=2){let h=e[u],c=e[u+1];Array.isArray(h)||(h=[h]);let p=r.concat(u);if(h.length===0)return p.error(\"Expected at least one branch label.\");for(let d of h){if(typeof d!=\"number\"&&typeof d!=\"string\")return p.error(\"Branch labels must be numbers or strings.\");if(typeof d==\"number\"&&Math.abs(d)>2**53-1)return p.error(`Branch labels must be integers no larger than ${2**53-1}.`);if(typeof d==\"number\"&&Math.floor(d)!==d)return p.error(\"Numeric branch labels must be integer values.\");if(!i)i=_t(d);else if(p.checkSubtype(i,_t(d)))return null;if(a[String(d)]!==void 0)return p.error(\"Branch labels must be unique.\");a[String(d)]=s.length}let f=r.parse(c,u,n);if(!f)return null;n||(n=f.type),s.push(f)}let o=r.parse(e[1],1,Z);if(!o)return null;let l=r.parse(e[e.length-1],e.length-1,n);return!l||o.type.kind!==\"value\"&&r.concat(1).checkSubtype(i,o.type)?null:new Mp(i,n,o,a,s,l)}evaluate(e){let r=this.input.evaluate(e);return(_t(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}},K1=class Bp{constructor(e,r,i){this.type=e,this.branches=r,this.otherwise=i}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return r.error(\"Expected an odd number of arguments.\");let i;r.expectedType&&r.expectedType.kind!==\"value\"&&(i=r.expectedType);let n=[];for(let s=1;s<e.length-1;s+=2){let o=r.parse(e[s],s,tt);if(!o)return null;let l=r.parse(e[s+1],s+1,i);if(!l)return null;n.push([o,l]),i||(i=l.type)}let a=r.parse(e[e.length-1],e.length-1,i);if(!a)return null;if(!i)throw Error(\"Can't infer output type\");return new Bp(i,n,a)}evaluate(e){for(let[r,i]of this.branches)if(r.evaluate(e))return i.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(let[r,i]of this.branches)e(r),e(i);e(this.otherwise)}outputDefined(){return this.branches.every(([e,r])=>r.outputDefined())&&this.otherwise.outputDefined()}},J1=class Zs{constructor(e,r,i,n,a){this.type=e,this.input=r,this.beginIndex=i,this.key=n,this.endIndex=a}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);let i=r.parse(e[1],1,Z),n=r.parse(e[2],2,T);if(!i||!n)return null;if(!cl(i.type,[Nt(Z),Y,Z]))return r.error(`Expected first argument to be of type array or string, but found ${yt(i.type)} instead`);if(e.length===4){let a=r.parse(e[3],3,T);return a?new Zs(i.type,i,n,r.key,a):null}return new Zs(i.type,i,n,r.key)}evaluate(e){let r=this.input.evaluate(e),i=this.beginIndex.evaluate(e),n;if(this.endIndex&&(n=this.endIndex.evaluate(e)),cr(r,[\"string\"]))return[...r].slice(i,n).join(\"\");if(cr(r,[\"array\"]))return r.slice(i,n);throw new ct(`Expected first argument to be of type array or string, but found ${yt(_t(r))} instead.`,this.key)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}},Pp=class Hs{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error(\"Expected at least one argument.\");let i=null,n=r.expectedType;n&&n.kind!==\"value\"&&(i=n);let a=[];for(let s of e.slice(1)){let o=r.parse(s,1+a.length,i,void 0,{typeAnnotation:\"omit\"});if(!o)return null;i||(i=o.type),a.push(o)}if(!i)throw Error(\"No output type\");return n&&a.some(s=>Ki(n,s.type))?new Hs(Z,a):new Hs(i,a)}evaluate(e){let r=null,i=0,n;for(let a of this.args)if(i++,r=a.evaluate(e),r&&r instanceof we&&!r.available&&(n||(n=r.name),r=null,i===this.args.length&&(r=n)),r!==null)break;return r}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}};function ch(t,e){return t===\"==\"||t===\"!=\"?e.kind===\"boolean\"||e.kind===\"string\"||e.kind===\"number\"||e.kind===\"null\"||e.kind===\"value\":e.kind===\"string\"||e.kind===\"number\"||e.kind===\"value\"}function Q1(t,e,r){return e===r}function t0(t,e,r){return e!==r}function e0(t,e,r){return e<r}function r0(t,e,r){return e>r}function i0(t,e,r){return e<=r}function n0(t,e,r){return e>=r}function zp(t,e,r,i){return i.compare(e,r)===0}function a0(t,e,r,i){return!zp(t,e,r,i)}function s0(t,e,r,i){return i.compare(e,r)<0}function o0(t,e,r,i){return i.compare(e,r)>0}function l0(t,e,r,i){return i.compare(e,r)<=0}function u0(t,e,r,i){return i.compare(e,r)>=0}function si(t,e,r){let i=t!==\"==\"&&t!==\"!=\";return class Lp{constructor(a,s,o,l){this.lhs=a,this.rhs=s,this.key=o,this.collator=l,this.type=tt,this.hasUntypedArgument=a.type.kind===\"value\"||s.type.kind===\"value\"}static parse(a,s){if(a.length!==3&&a.length!==4)return s.error(\"Expected two or three arguments.\");let o=a[0],l=s.parse(a[1],1,Z);if(!l)return null;if(!ch(o,l.type))return s.concat(1).error(`\"${o}\" comparisons are not supported for type '${yt(l.type)}'.`);let u=s.parse(a[2],2,Z);if(!u)return null;if(!ch(o,u.type))return s.concat(2).error(`\"${o}\" comparisons are not supported for type '${yt(u.type)}'.`);if(l.type.kind!==u.type.kind&&l.type.kind!==\"value\"&&u.type.kind!==\"value\")return s.error(`Cannot compare types '${yt(l.type)}' and '${yt(u.type)}'.`);i&&(l.type.kind===\"value\"&&u.type.kind!==\"value\"?l=new ke(u.type,[l],s.key):l.type.kind!==\"value\"&&u.type.kind===\"value\"&&(u=new ke(l.type,[u],s.key)));let h=null;if(a.length===4){if(l.type.kind!==\"string\"&&u.type.kind!==\"string\"&&l.type.kind!==\"value\"&&u.type.kind!==\"value\")return s.error(\"Cannot use collator to compare non-string types.\");if(h=s.parse(a[3],3,ka),!h)return null}return new Lp(l,u,s.key,h)}evaluate(a){let s=this.lhs.evaluate(a),o=this.rhs.evaluate(a);if(i&&this.hasUntypedArgument){let l=_t(s),u=_t(o);if(l.kind!==u.kind||l.kind!==\"string\"&&l.kind!==\"number\")throw new ct(`Expected arguments for \"${t}\" to be (string, string) or (number, number), but found (${l.kind}, ${u.kind}) instead.`,this.key)}if(this.collator&&!i&&this.hasUntypedArgument){let l=_t(s),u=_t(o);if(l.kind!==\"string\"||u.kind!==\"string\")return e(a,s,o)}return this.collator?r(a,s,o,this.collator.evaluate(a)):e(a,s,o)}eachChild(a){a(this.lhs),a(this.rhs),this.collator&&a(this.collator)}outputDefined(){return!0}}}var h0=si(\"==\",Q1,zp),c0=si(\"!=\",t0,a0),p0=si(\"<\",e0,s0),f0=si(\">\",r0,o0),d0=si(\"<=\",i0,l0),y0=si(\">=\",n0,u0),Vp=class Op{constructor(e,r,i){this.type=ka,this.locale=i,this.caseSensitive=e,this.diacriticSensitive=r}static parse(e,r){if(e.length!==2)return r.error(\"Expected one argument.\");let i=e[1];if(typeof i!=\"object\"||Array.isArray(i))return r.error(\"Collator options argument must be an object.\");let n=r.parse(i[\"case-sensitive\"]!==void 0&&i[\"case-sensitive\"],1,tt);if(!n)return null;let a=r.parse(i[\"diacritic-sensitive\"]!==void 0&&i[\"diacritic-sensitive\"],1,tt);if(!a)return null;let s=null;return i.locale&&(s=r.parse(i.locale,1,Y),!s)?null:new Op(n,a,s)}evaluate(e){return new pl(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}},m0=class Rp{constructor(e,r,i,n,a,s){this.type=Y,this.number=e,this.locale=r,this.currency=i,this.unit=n,this.minFractionDigits=a,this.maxFractionDigits=s}static parse(e,r){if(e.length!==3)return r.error(\"Expected two arguments.\");let i=r.parse(e[1],1,T);if(!i)return null;let n=e[2];if(typeof n!=\"object\"||Array.isArray(n))return r.error(\"NumberFormat options argument must be an object.\");let a=null;if(n.locale&&(a=r.parse(n.locale,1,Y),!a))return null;let s=null;if(n.currency&&(s=r.parse(n.currency,1,Y),!s))return null;let o=null;if(n.unit&&(o=r.parse(n.unit,1,Y),!o))return null;if(s&&o)return r.error(\"NumberFormat options `currency` and `unit` are mutually exclusive\");let l=null;if(n[\"min-fraction-digits\"]&&(l=r.parse(n[\"min-fraction-digits\"],1,T),!l))return null;let u=null;return n[\"max-fraction-digits\"]&&(u=r.parse(n[\"max-fraction-digits\"],1,T),!u)?null:new Rp(i,a,s,o,l,u)}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}},g0=class $p{constructor(e){this.type=fn,this.input=e}static parse(e,r){if(e.length!==2)return r.error(\"Expected two arguments.\");let i=r.parse(e[1],1,Y);return i?new $p(i):r.error(\"No image name provided.\")}evaluate(e){let r=this.input.evaluate(e),i=we.fromString(r);return i&&e.availableImages&&(i.available=e.availableImages.indexOf(r)>-1),i}eachChild(e){e(this.input)}outputDefined(){return!1}},x0=class Np{constructor(e,r){this.input=e,this.key=r,this.type=T}static parse(e,r){if(e.length!==2)return r.error(`Expected 1 argument, but found ${e.length-1} instead.`);let i=r.parse(e[1],1);return i?i.type.kind!==\"array\"&&i.type.kind!==\"string\"&&i.type.kind!==\"value\"?r.error(`Expected argument of type string or array, but found ${yt(i.type)} instead.`):new Np(i,r.key):null}evaluate(e){let r=this.input.evaluate(e);if(typeof r==\"string\")return[...r].length;if(Array.isArray(r))return r.length;throw new ct(`Expected value to be of type string or array, but found ${yt(_t(r))} instead.`,this.key)}eachChild(e){e(this.input)}outputDefined(){return!1}},ve=8192;function v0(t,e){let r=b0(t[0]),i=D0(t[1]),n=2**e.z;return[Math.round(r*n*ve),Math.round(i*n*ve)]}function dl(t,e){let r=2**e.z,i=(t[0]/ve+e.x)/r,n=(t[1]/ve+e.y)/r;return[w0(i),_0(n)]}function b0(t){return(180+t)/360}function w0(t){return t*360-180}function D0(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function _0(t){return 360/Math.PI*Math.atan(Math.exp((180-t*360)*Math.PI/180))-90}function dn(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1])}function Ji(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function A0(t,e,r){return e[1]>t[1]!=r[1]>t[1]&&t[0]<(r[0]-e[0])*(t[1]-e[1])/(r[1]-e[1])+e[0]}function S0(t,e,r){let i=t[0]-e[0],n=t[1]-e[1],a=t[0]-r[0],s=t[1]-r[1];return i*s-a*n===0&&i*a<=0&&n*s<=0}function Pa(t,e,r,i){let n=[e[0]-t[0],e[1]-t[1]];return T0([i[0]-r[0],i[1]-r[1]],n)!==0&&!!(ph(t,e,r,i)&&ph(r,i,t,e))}function E0(t,e,r){for(let i of r)for(let n=0;n<i.length-1;++n)if(Pa(t,e,i[n],i[n+1]))return!0;return!1}function oi(t,e,r=!1){let i=!1;for(let n of e)for(let a=0;a<n.length-1;a++){if(S0(t,n[a],n[a+1]))return r;A0(t,n[a],n[a+1])&&(i=!i)}return i}function F0(t,e){for(let r of e)if(oi(t,r))return!0;return!1}function Up(t,e){for(let r of t)if(!oi(r,e))return!1;for(let r=0;r<t.length-1;++r)if(E0(t[r],t[r+1],e))return!1;return!0}function k0(t,e){for(let r of e)if(Up(t,r))return!0;return!1}function T0(t,e){return t[0]*e[1]-t[1]*e[0]}function ph(t,e,r,i){let n=t[0]-r[0],a=t[1]-r[1],s=e[0]-r[0],o=e[1]-r[1],l=i[0]-r[0],u=i[1]-r[1],h=n*u-l*a,c=s*u-l*o;return h>0&&c<0||h<0&&c>0}function yl(t,e,r){let i=[];for(let n=0;n<t.length;n++){let a=[];for(let s=0;s<t[n].length;s++){let o=v0(t[n][s],r);dn(e,o),a.push(o)}i.push(a)}return i}function qp(t,e,r){let i=[];for(let n=0;n<t.length;n++){let a=yl(t[n],e,r);i.push(a)}return i}function jp(t,e,r,i){if(t[0]<r[0]||t[0]>r[2]){let n=i*.5,a=t[0]-r[0]>n?-i:r[0]-t[0]>n?i:0;a===0&&(a=t[0]-r[2]>n?-i:r[2]-t[0]>n?i:0),t[0]+=a}dn(e,t)}function I0(t){t[0]=t[1]=1/0,t[2]=t[3]=-1/0}function fh(t,e,r,i){let n=2**i.z*ve,a=[i.x*ve,i.y*ve],s=[];for(let o of t)for(let l of o){let u=[l.x+a[0],l.y+a[1]];jp(u,e,r,n),s.push(u)}return s}function dh(t,e,r,i){let n=2**i.z*ve,a=[i.x*ve,i.y*ve],s=[];for(let o of t){let l=[];for(let u of o){let h=[u.x+a[0],u.y+a[1]];dn(e,h),l.push(h)}s.push(l)}if(e[2]-e[0]<=n/2){I0(e);for(let o of s)for(let l of o)jp(l,e,r,n)}return s}function C0(t,e){let r=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],n=t.canonicalID();if(e.type===\"Polygon\"){let a=yl(e.coordinates,i,n),s=fh(t.geometry(),r,i,n);if(!Ji(r,i))return!1;for(let o of s)if(!oi(o,a))return!1}if(e.type===\"MultiPolygon\"){let a=qp(e.coordinates,i,n),s=fh(t.geometry(),r,i,n);if(!Ji(r,i))return!1;for(let o of s)if(!F0(o,a))return!1}return!0}function M0(t,e){let r=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],n=t.canonicalID();if(e.type===\"Polygon\"){let a=yl(e.coordinates,i,n),s=dh(t.geometry(),r,i,n);if(!Ji(r,i))return!1;for(let o of s)if(!Up(o,a))return!1}if(e.type===\"MultiPolygon\"){let a=qp(e.coordinates,i,n),s=dh(t.geometry(),r,i,n);if(!Ji(r,i))return!1;for(let o of s)if(!k0(o,a))return!1}return!0}var ml=class na{constructor(e,r){this.type=tt,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Qr(e[1])){let i=e[1];if(i.type===\"FeatureCollection\"){let n=[];for(let a of i.features){let{type:s,coordinates:o}=a.geometry;s===\"Polygon\"&&n.push(o),s===\"MultiPolygon\"&&n.push(...o)}if(n.length)return new na(i,{type:\"MultiPolygon\",coordinates:n})}else if(i.type===\"Feature\"){let n=i.geometry.type;if(n===\"Polygon\"||n===\"MultiPolygon\")return new na(i,i.geometry)}else if(i.type===\"Polygon\"||i.type===\"MultiPolygon\")return new na(i,i)}return r.error(\"'within' expression requires valid geojson object that contains polygon geometry type.\")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()===\"Point\")return C0(e,this.geometries);if(e.geometryType()===\"LineString\")return M0(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}},Gp=class{constructor(t=[],e=(r,i)=>r<i?-1:+(r>i)){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let r=(this.length>>1)-1;r>=0;r--)this._down(r)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(this.length===0)return;let t=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){let{data:e,compare:r}=this,i=e[t];for(;t>0;){let n=t-1>>1,a=e[n];if(r(i,a)>=0)break;e[t]=a,t=n}e[t]=i}_down(t){let{data:e,compare:r}=this,i=this.length>>1,n=e[t];for(;t<i;){let a=(t<<1)+1,s=a+1;if(s<this.length&&r(e[s],e[a])<0&&(a=s),r(e[a],n)>=0)break;e[t]=e[a],t=a}e[t]=n}},yh=Math.PI/180,gl=class{constructor(t){let e=yh*6378.137*1e3,r=Math.cos(t*yh),i=1/(1-.0066943799901413165*(1-r*r)),n=Math.sqrt(i);this.kx=e*n*r,this.ky=e*n*i*.9933056200098587}distance(t,e){let r=this.wrap(t[0]-e[0])*this.kx,i=(t[1]-e[1])*this.ky;return Math.sqrt(r*r+i*i)}pointOnLine(t,e){let r=1/0,i,n,a,s;for(let o=0;o<t.length-1;o++){let l=t[o][0],u=t[o][1],h=this.wrap(t[o+1][0]-l)*this.kx,c=(t[o+1][1]-u)*this.ky,p=0;(h!==0||c!==0)&&(p=(this.wrap(e[0]-l)*this.kx*h+(e[1]-u)*this.ky*c)/(h*h+c*c),p>1?(l=t[o+1][0],u=t[o+1][1]):p>0&&(l+=h/this.kx*p,u+=c/this.ky*p)),h=this.wrap(e[0]-l)*this.kx,c=(e[1]-u)*this.ky;let f=h*h+c*c;f<r&&(r=f,i=l,n=u,a=o,s=p)}return{point:[i,n],index:a,t:Math.max(0,Math.min(1,s))}}wrap(t){for(;t<-180;)t+=360;for(;t>180;)t-=360;return t}};function Xp(t,e){return e[0]-t[0]}function ca(t){return t[1]-t[0]+1}function Pe(t,e){return t[1]>=t[0]&&t[1]<e}function Ks(t,e){if(t[0]>t[1])return[null,null];let r=ca(t);if(e){if(r===2)return[t,null];let n=Math.floor(r/2);return[[t[0],t[0]+n],[t[0]+n,t[1]]]}if(r===1)return[t,null];let i=Math.floor(r/2)-1;return[[t[0],t[0]+i],[t[0]+i+1,t[1]]]}function Js(t,e){if(!Pe(e,t.length))return[1/0,1/0,-1/0,-1/0];let r=[1/0,1/0,-1/0,-1/0];for(let i=e[0];i<=e[1];++i)dn(r,t[i]);return r}function Qs(t){let e=[1/0,1/0,-1/0,-1/0];for(let r of t)for(let i of r)dn(e,i);return e}function mh(t){return t[0]!==-1/0&&t[1]!==-1/0&&t[2]!==1/0&&t[3]!==1/0}function xl(t,e,r){if(!mh(t)||!mh(e))return NaN;let i=0,n=0;return t[2]<e[0]&&(i=e[0]-t[2]),t[0]>e[2]&&(i=t[0]-e[2]),t[1]>e[3]&&(n=t[1]-e[3]),t[3]<e[1]&&(n=e[1]-t[3]),r.distance([0,0],[i,n])}function or(t,e,r){let i=r.pointOnLine(e,t);return r.distance(t,i.point)}function vl(t,e,r,i,n){let a=Math.min(or(t,[r,i],n),or(e,[r,i],n)),s=Math.min(or(r,[t,e],n),or(i,[t,e],n));return Math.min(a,s)}function B0(t,e,r,i,n){if(!(Pe(e,t.length)&&Pe(i,r.length)))return 1/0;let a=1/0;for(let s=e[0];s<e[1];++s){let o=t[s],l=t[s+1];for(let u=i[0];u<i[1];++u){let h=r[u],c=r[u+1];if(Pa(o,l,h,c))return 0;a=Math.min(a,vl(o,l,h,c,n))}}return a}function P0(t,e,r,i,n){if(!(Pe(e,t.length)&&Pe(i,r.length)))return NaN;let a=1/0;for(let s=e[0];s<=e[1];++s)for(let o=i[0];o<=i[1];++o)if(a=Math.min(a,n.distance(t[s],r[o])),a===0)return a;return a}function z0(t,e,r){if(oi(t,e,!0))return 0;let i=1/0;for(let n of e){let a=n[0],s=n[n.length-1];if(a!==s&&(i=Math.min(i,or(t,[s,a],r)),i===0))return i;let o=r.pointOnLine(n,t);if(i=Math.min(i,r.distance(t,o.point)),i===0)return i}return i}function L0(t,e,r,i){if(!Pe(e,t.length))return NaN;for(let a=e[0];a<=e[1];++a)if(oi(t[a],r,!0))return 0;let n=1/0;for(let a=e[0];a<e[1];++a){let s=t[a],o=t[a+1];for(let l of r)for(let u=0,h=l.length,c=h-1;u<h;c=u++){let p=l[c],f=l[u];if(Pa(s,o,p,f))return 0;n=Math.min(n,vl(s,o,p,f,i))}}return n}function gh(t,e){for(let r of t)for(let i of r)if(oi(i,e,!0))return!0;return!1}function V0(t,e,r,i=1/0){let n=Qs(t),a=Qs(e);if(i!==1/0&&xl(n,a,r)>=i)return i;if(Ji(n,a)){if(gh(t,e))return 0}else if(gh(e,t))return 0;let s=1/0;for(let o of t)for(let l=0,u=o.length,h=u-1;l<u;h=l++){let c=o[h],p=o[l];for(let f of e)for(let d=0,y=f.length,m=y-1;d<y;m=d++){let g=f[m],x=f[d];if(Pa(c,p,g,x))return 0;s=Math.min(s,vl(c,p,g,x,r))}}return s}function xh(t,e,r,i,n,a){if(!a)return;let s=xl(Js(i,a),n,r);s<e&&t.push([s,a,[0,0]])}function Nn(t,e,r,i,n,a,s){if(!a||!s)return;let o=xl(Js(i,a),Js(n,s),r);o<e&&t.push([o,a,s])}function pa(t,e,r,i,n=1/0){let a=Math.min(i.distance(t[0],r[0][0]),n);if(a===0)return a;let s=new Gp([[0,[0,t.length-1],[0,0]]],Xp),o=Qs(r);for(;s.length>0;){let l=s.pop();if(l[0]>=a)continue;let u=l[1],h=e?50:100;if(ca(u)<=h){if(!Pe(u,t.length))return NaN;if(e){let c=L0(t,u,r,i);if(isNaN(c)||c===0)return c;a=Math.min(a,c)}else for(let c=u[0];c<=u[1];++c){let p=z0(t[c],r,i);if(a=Math.min(a,p),a===0)return 0}}else{let c=Ks(u,e);xh(s,a,i,t,o,c[0]),xh(s,a,i,t,o,c[1])}}return a}function fa(t,e,r,i,n,a=1/0){let s=Math.min(a,n.distance(t[0],r[0]));if(s===0)return s;let o=new Gp([[0,[0,t.length-1],[0,r.length-1]]],Xp);for(;o.length>0;){let l=o.pop();if(l[0]>=s)continue;let u=l[1],h=l[2],c=e?50:100,p=i?50:100;if(ca(u)<=c&&ca(h)<=p){if(!Pe(u,t.length)&&Pe(h,r.length))return NaN;let f;if(e&&i)f=B0(t,u,r,h,n),s=Math.min(s,f);else if(e&&!i){let d=t.slice(u[0],u[1]+1);for(let y=h[0];y<=h[1];++y)if(f=or(r[y],d,n),s=Math.min(s,f),s===0)return s}else if(!e&&i){let d=r.slice(h[0],h[1]+1);for(let y=u[0];y<=u[1];++y)if(f=or(t[y],d,n),s=Math.min(s,f),s===0)return s}else f=P0(t,u,r,h,n),s=Math.min(s,f)}else{let f=Ks(u,e),d=Ks(h,i);Nn(o,s,n,t,r,f[0],d[0]),Nn(o,s,n,t,r,f[0],d[1]),Nn(o,s,n,t,r,f[1],d[0]),Nn(o,s,n,t,r,f[1],d[1])}}return s}function O0(t,e){let r=t.geometry(),i=r.flat().map(s=>dl([s.x,s.y],t.canonical));if(r.length===0)return NaN;let n=new gl(i[0][1]),a=1/0;for(let s of e){switch(s.type){case\"Point\":a=Math.min(a,fa(i,!1,[s.coordinates],!1,n,a));break;case\"LineString\":a=Math.min(a,fa(i,!1,s.coordinates,!0,n,a));break;case\"Polygon\":a=Math.min(a,pa(i,!1,s.coordinates,n,a))}if(a===0)return a}return a}function R0(t,e){let r=t.geometry(),i=r.flat().map(s=>dl([s.x,s.y],t.canonical));if(r.length===0)return NaN;let n=new gl(i[0][1]),a=1/0;for(let s of e){switch(s.type){case\"Point\":a=Math.min(a,fa(i,!0,[s.coordinates],!1,n,a));break;case\"LineString\":a=Math.min(a,fa(i,!0,s.coordinates,!0,n,a));break;case\"Polygon\":a=Math.min(a,pa(i,!0,s.coordinates,n,a))}if(a===0)return a}return a}function $0(t,e){let r=t.geometry();if(r.length===0||r[0].length===0)return NaN;let i=Ba(r,0).map(s=>s.map(o=>o.map(l=>dl([l.x,l.y],t.canonical)))),n=new gl(i[0][0][0][1]),a=1/0;for(let s of e)for(let o of i){switch(s.type){case\"Point\":a=Math.min(a,pa([s.coordinates],!1,o,n,a));break;case\"LineString\":a=Math.min(a,pa(s.coordinates,!0,o,n,a));break;case\"Polygon\":a=Math.min(a,V0(o,s.coordinates,n,a))}if(a===0)return a}return a}function Is(t){return t.type===\"MultiPolygon\"?t.coordinates.map(e=>({type:\"Polygon\",coordinates:e})):t.type===\"MultiLineString\"?t.coordinates.map(e=>({type:\"LineString\",coordinates:e})):t.type===\"MultiPoint\"?t.coordinates.map(e=>({type:\"Point\",coordinates:e})):[t]}var bl=class aa{constructor(e,r){this.type=T,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error(`'distance' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Qr(e[1])){let i=e[1];if(i.type===\"FeatureCollection\")return new aa(i,i.features.map(n=>Is(n.geometry)).flat());if(i.type===\"Feature\")return new aa(i,Is(i.geometry));if(\"type\"in i&&\"coordinates\"in i)return new aa(i,Is(i))}return r.error(\"'distance' expression requires valid geojson object that contains polygon geometry type.\")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()===\"Point\")return O0(e,this.geometries);if(e.geometryType()===\"LineString\")return R0(e,this.geometries);if(e.geometryType()===\"Polygon\")return $0(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}},N0=class Yp{constructor(e){let r=null;for(let i of e)if(!r)r=i.type;else{if(r===i.type)continue;r=Z;break}this.type=Nt(r??Z,e.length),this.arr=e}static parse(e,r){if(e.length!==2)return r.error(`'semiliteral' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!Qr(e[1]))return r.error(`invalid value of type \"${typeof e[1]}\"`);let i=e[1],n=_t(i);if(n.kind===\"array\"){let a=i.map(s=>r.parse(s,null,Z));return new Yp(a)}return new ti(n,i)}evaluate(e){return this.arr.map(r=>r.evaluate(e))}eachChild(e){this.arr.forEach(e)}outputDefined(){return this.arr.every(e=>e.outputDefined())}},wl=class Wp{constructor(e){this.key=e,this.type=Z}static parse(e,r){if(e.length!==2)return r.error(`Expected 1 argument, but found ${e.length-1} instead.`);let i=e[1];return i==null?r.error(\"Global state property must be defined.\"):typeof i==\"string\"?new Wp(i):r.error(`Global state property must be string, but found ${typeof e[1]} instead.`)}evaluate(e){let r=e.globals?.globalState;return!r||Object.keys(r).length===0?null:Ni(r,this.key)??null}eachChild(){}outputDefined(){return!1}},Gr={\"==\":h0,\"!=\":c0,\">\":f0,\"<\":p0,\">=\":y0,\"<=\":d0,array:ke,at:Y1,boolean:ke,case:K1,coalesce:Pp,collator:Vp,format:wp,image:g0,in:W1,\"index-of\":Z1,interpolate:xe,\"interpolate-hcl\":xe,\"interpolate-lab\":xe,length:x0,let:Ep,literal:ti,match:H1,number:ke,\"number-format\":m0,object:ke,semiliteral:N0,slice:J1,step:fl,string:ke,\"to-boolean\":Ur,\"to-color\":Ur,\"to-number\":Ur,\"to-string\":Ur,var:kp,within:ml,distance:bl,\"global-state\":wl},ge=class extends Error{constructor(t,e){super(e),this.message=e,this.key=t}},U0=class Zp{constructor(e,r=[]){this.parent=e,this.bindings={};for(let[i,n]of r)this.bindings[i]=n}concat(e){return new Zp(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]?!0:this.parent?this.parent.has(e):!1}},Hp=class Kp{constructor(e,r,i=[],n,a=new U0,s=[]){this.registry=e,this.path=i,this.key=i.map(o=>`[${o}]`).join(\"\"),this.scope=a,this.errors=s,this.expectedType=n,this._isConstant=r}parse(e,r,i,n,a={}){return r?this.concat(r,i,n)._parse(e,a):this._parse(e,a)}_parse(e,r){(e===null||typeof e==\"string\"||typeof e==\"boolean\"||typeof e==\"number\")&&(e=[\"literal\",e]);let i=this.key;function n(a,s,o){return o===\"assert\"?new ke(s,[a],i):o===\"coerce\"?new Ur(s,[a],i):a}if(Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use [\"literal\", []].');let a=e[0];if(typeof a!=\"string\")return this.error(`Expression name must be a string, but found ${typeof a} instead. If you wanted a literal array, use [\"literal\", [...]].`,0),null;let s=this.registry[a];if(s){let o=s.parse(e,this);if(!o)return null;if(this.expectedType){let l=this.expectedType,u=o.type;if((l.kind===\"string\"||l.kind===\"number\"||l.kind===\"boolean\"||l.kind===\"object\"||l.kind===\"array\")&&u.kind===\"value\")o=n(o,l,r.typeAnnotation||\"assert\");else if(l.kind===\"projectionDefinition\"&&[\"string\",\"array\",\"value\"].includes(u.kind)||[\"color\",\"formatted\",\"resolvedImage\"].includes(l.kind)&&[\"value\",\"string\"].includes(u.kind)||[\"padding\",\"numberArray\"].includes(l.kind)&&[\"value\",\"number\",\"array\"].includes(u.kind)||l.kind===\"colorArray\"&&[\"value\",\"string\",\"array\"].includes(u.kind)||l.kind===\"variableAnchorOffsetCollection\"&&[\"value\",\"array\"].includes(u.kind))o=n(o,l,r.typeAnnotation||\"coerce\");else if(this.checkSubtype(l,u))return null}if(!(o instanceof ti)&&o.type.kind!==\"resolvedImage\"&&this._isConstant(o)){let l=new vp;try{o=new ti(o.type,o.evaluate(l))}catch(u){return this.error(u.message),null}}return o}return this.error(`Unknown expression \"${a}\". If you wanted a literal array, use [\"literal\", [...]].`,0)}return e===void 0?this.error(\"'undefined' value invalid. Use null instead.\"):typeof e==\"object\"?this.error('Bare objects invalid. Use [\"literal\", {...}] instead.'):this.error(`Expected an array, but found ${typeof e} instead.`)}concat(e,r,i){let n=typeof e==\"number\"?this.path.concat(e):this.path,a=i?this.scope.concat(i):this.scope;return new Kp(this.registry,this._isConstant,n,r||null,a,this.errors)}error(e,...r){let i=`${this.key}${r.map(n=>`[${n}]`).join(\"\")}`;this.errors.push(new ge(i,e))}checkSubtype(e,r){let i=Ki(e,r);return i&&this.error(i),i}},br=class Li{constructor(e,r,i,n,a){this.name=e,this.type=r,this._evaluate=i,this.args=n,this.key=a}evaluate(e){return this._evaluate(e,this.args,this.key)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,r){let i=e[0],n=Li.definitions[i];if(!n)return r.error(`Unknown expression \"${i}\". If you wanted a literal array, use [\"literal\", [...]].`,0);let a=Array.isArray(n)?n[0]:n.type,s=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,o=s.filter(([u])=>!Array.isArray(u)||u.length===e.length-1),l=null;for(let[u,h]of o){l=new Hp(r.registry,da,r.path,null,r.scope);let c=[],p=!1;for(let f=1;f<e.length;f++){let d=e[f],y=Array.isArray(u)?u[f-1]:u.type,m=l.parse(d,1+c.length,y);if(!m){p=!0;break}c.push(m)}if(!p){if(Array.isArray(u)&&u.length!==c.length){l.error(`Expected ${u.length} arguments, but found ${c.length} instead.`);continue}for(let f=0;f<c.length;f++){let d=Array.isArray(u)?u[f]:u.type,y=c[f];l.concat(f+1).checkSubtype(d,y.type)}if(l.errors.length===0)return new Li(i,a,h,c,r.key)}}if(o.length===1)r.errors.push(...l.errors);else{let u=(o.length?o:s).map(([c])=>j0(c)).join(\" | \"),h=[];for(let c=1;c<e.length;c++){let p=r.parse(e[c],1+h.length);if(!p)return null;h.push(yt(p.type))}r.error(`Expected arguments of type ${u}, but found (${h.join(\", \")}) instead.`)}return null}static register(e,r){Li.definitions=r;for(let i in r)e[i]=Li}};function vh(t,[e,r,i,n],a){e=e.evaluate(t),r=r.evaluate(t),i=i.evaluate(t);let s=n?n.evaluate(t):1,o=gp(e,r,i,s);if(o)throw new ct(o,a);return new gt(e/255,r/255,i/255,s,!1)}function bh(t,e){return t in e&&e[t]!==void 0}function Cs(t,e){let r=e[t];return r===void 0?null:r}function q0(t,e,r,i){for(;r<=i;){let n=r+i>>1;if(e[n]===t)return!0;e[n]>t?i=n-1:r=n+1}return!1}function ir(t){return{type:t}}br.register(Gr,{error:[T1,[Y],(t,[e],r)=>{throw new ct(e.evaluate(t),r)}],typeof:[Y,[Z],(t,[e])=>yt(_t(e.evaluate(t)))],\"to-rgba\":[Nt(T,4),[ue],(t,[e])=>{let[r,i,n,a]=e.evaluate(t).rgb;return[r*255,i*255,n*255,a]}],rgb:[ue,[T,T,T],vh],rgba:[ue,[T,T,T,T],vh],has:{type:tt,overloads:[[[Y],(t,[e])=>bh(e.evaluate(t),t.properties())],[[Y,hr],(t,[e,r])=>bh(e.evaluate(t),r.evaluate(t))]]},get:{type:Z,overloads:[[[Y],(t,[e])=>Cs(e.evaluate(t),t.properties())],[[Y,hr],(t,[e,r])=>Cs(e.evaluate(t),r.evaluate(t))]]},\"feature-state\":[Z,[Y],(t,[e])=>Cs(e.evaluate(t),t.featureState||{})],properties:[hr,[],t=>t.properties()],\"geometry-type\":[Y,[],t=>t.geometryType()],id:[Z,[],t=>t.id()],zoom:[T,[],t=>t.globals.zoom],\"heatmap-density\":[T,[],t=>t.globals.heatmapDensity||0],elevation:[T,[],t=>t.globals.elevation||0],\"line-progress\":[T,[],t=>t.globals.lineProgress||0],accumulated:[Z,[],t=>t.globals.accumulated===void 0?null:t.globals.accumulated],\"+\":[T,ir(T),(t,e)=>{let r=0;for(let i of e)r+=i.evaluate(t);return r}],\"*\":[T,ir(T),(t,e)=>{let r=1;for(let i of e)r*=i.evaluate(t);return r}],\"-\":{type:T,overloads:[[[T,T],(t,[e,r])=>e.evaluate(t)-r.evaluate(t)],[[T],(t,[e])=>-e.evaluate(t)]]},\"/\":[T,[T,T],(t,[e,r])=>e.evaluate(t)/r.evaluate(t)],\"%\":[T,[T,T],(t,[e,r])=>e.evaluate(t)%r.evaluate(t)],ln2:[T,[],()=>Math.LN2],pi:[T,[],()=>Math.PI],e:[T,[],()=>Math.E],\"^\":[T,[T,T],(t,[e,r])=>e.evaluate(t)**+r.evaluate(t)],sqrt:[T,[T],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[T,[T],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[T,[T],(t,[e])=>Math.log(e.evaluate(t))],log2:[T,[T],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[T,[T],(t,[e])=>Math.sin(e.evaluate(t))],cos:[T,[T],(t,[e])=>Math.cos(e.evaluate(t))],tan:[T,[T],(t,[e])=>Math.tan(e.evaluate(t))],asin:[T,[T],(t,[e])=>Math.asin(e.evaluate(t))],acos:[T,[T],(t,[e])=>Math.acos(e.evaluate(t))],atan:[T,[T],(t,[e])=>Math.atan(e.evaluate(t))],min:[T,ir(T),(t,e)=>Math.min(...e.map(r=>r.evaluate(t)))],max:[T,ir(T),(t,e)=>Math.max(...e.map(r=>r.evaluate(t)))],abs:[T,[T],(t,[e])=>Math.abs(e.evaluate(t))],round:[T,[T],(t,[e])=>{let r=e.evaluate(t);return r<0?-Math.round(-r):Math.round(r)}],floor:[T,[T],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[T,[T],(t,[e])=>Math.ceil(e.evaluate(t))],\"filter-==\":[tt,[Y,Z],(t,[e,r])=>t.properties()[e.value]===r.value],\"filter-id-==\":[tt,[Z],(t,[e])=>t.id()===e.value],\"filter-type-==\":[tt,[Y],(t,[e])=>t.geometryType()===e.value],\"filter-<\":[tt,[Y,Z],(t,[e,r])=>{let i=t.properties()[e.value],n=r.value;return typeof i==typeof n&&i<n}],\"filter-id-<\":[tt,[Z],(t,[e])=>{let r=t.id(),i=e.value;return typeof r==typeof i&&r<i}],\"filter->\":[tt,[Y,Z],(t,[e,r])=>{let i=t.properties()[e.value],n=r.value;return typeof i==typeof n&&i>n}],\"filter-id->\":[tt,[Z],(t,[e])=>{let r=t.id(),i=e.value;return typeof r==typeof i&&r>i}],\"filter-<=\":[tt,[Y,Z],(t,[e,r])=>{let i=t.properties()[e.value],n=r.value;return typeof i==typeof n&&i<=n}],\"filter-id-<=\":[tt,[Z],(t,[e])=>{let r=t.id(),i=e.value;return typeof r==typeof i&&r<=i}],\"filter->=\":[tt,[Y,Z],(t,[e,r])=>{let i=t.properties()[e.value],n=r.value;return typeof i==typeof n&&i>=n}],\"filter-id->=\":[tt,[Z],(t,[e])=>{let r=t.id(),i=e.value;return typeof r==typeof i&&r>=i}],\"filter-has\":[tt,[Z],(t,[e])=>{let r=e.value,i=t.properties();return r in i&&i[r]!==void 0}],\"filter-has-id\":[tt,[],t=>t.id()!==null&&t.id()!==void 0],\"filter-type-in\":[tt,[Nt(Y)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],\"filter-id-in\":[tt,[Nt(Z)],(t,[e])=>e.value.indexOf(t.id())>=0],\"filter-in-small\":[tt,[Y,Nt(Z)],(t,[e,r])=>r.value.indexOf(t.properties()[e.value])>=0],\"filter-in-large\":[tt,[Y,Nt(Z)],(t,[e,r])=>q0(t.properties()[e.value],r.value,0,r.value.length-1)],all:{type:tt,overloads:[[[tt,tt],(t,[e,r])=>e.evaluate(t)&&r.evaluate(t)],[ir(tt),(t,e)=>{for(let r of e)if(!r.evaluate(t))return!1;return!0}]]},any:{type:tt,overloads:[[[tt,tt],(t,[e,r])=>e.evaluate(t)||r.evaluate(t)],[ir(tt),(t,e)=>{for(let r of e)if(r.evaluate(t))return!0;return!1}]]},\"!\":[tt,[tt],(t,[e])=>!e.evaluate(t)],\"is-supported-script\":[tt,[Y],(t,[e])=>{let r=t.globals&&t.globals.isSupportedScript;return!r||r(e.evaluate(t))}],upcase:[Y,[Y],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[Y,[Y],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[Y,ir(Z),(t,e)=>e.map(r=>Ui(r.evaluate(t))).join(\"\")],split:[Nt(Y),[Y,Y],(t,[e,r])=>e.evaluate(t).split(r.evaluate(t))],join:[Y,[Nt(Y),Y],(t,[e,r])=>e.evaluate(t).join(r.evaluate(t))],\"resolved-locale\":[Y,[ka],(t,[e])=>e.evaluate(t).resolvedLocale()]});function j0(t){return Array.isArray(t)?`(${t.map(yt).join(\", \")})`:`(${yt(t.type)}...)`}function da(t){if(t instanceof kp)return da(t.boundExpression);if(t instanceof br&&t.name===\"error\"||t instanceof Vp||t instanceof ml||t instanceof bl||t instanceof wl)return!1;let e=t instanceof Ur||t instanceof ke,r=!0;return t.eachChild(i=>{r&&(r=e?da(i):i instanceof ti)}),r?za(t)&&La(t,[\"zoom\",\"heatmap-density\",\"elevation\",\"line-progress\",\"accumulated\",\"is-supported-script\"]):!1}function za(t){if(t instanceof br&&(t.name===\"get\"&&t.args.length===1||t.name===\"feature-state\"||t.name===\"has\"&&t.args.length===1||t.name===\"properties\"||t.name===\"geometry-type\"||t.name===\"id\"||/^filter-/.test(t.name))||t instanceof ml||t instanceof bl)return!1;let e=!0;return t.eachChild(r=>{e&&!za(r)&&(e=!1)}),e}function Qi(t){if(t instanceof br&&t.name===\"feature-state\")return!1;let e=!0;return t.eachChild(r=>{e&&!Qi(r)&&(e=!1)}),e}function La(t,e){if(t instanceof br&&e.indexOf(t.name)>=0)return!1;let r=!0;return t.eachChild(i=>{r&&!La(i,e)&&(r=!1)}),r}function ei(t){return t[\"property-type\"]===\"data-driven\"||t[\"property-type\"]===\"cross-faded-data-driven\"}function Jp(t){return!!t.expression&&t.expression.parameters.indexOf(\"zoom\")>-1}function Dl(t){return!!t.expression&&t.expression.interpolated}var _l=/^(.*)-transition$/;function tn(t,...e){for(let r of e)for(let i in r)t[i]=r[i];return t}function J(t){return t instanceof Number?\"number\":t instanceof String?\"string\":t instanceof Boolean?\"boolean\":Array.isArray(t)?\"array\":t===null?\"null\":typeof t}function Va(t){return typeof t==\"object\"&&!!t&&!Array.isArray(t)&&_t(t)===hr}function G0(t){return t}function X0(t){switch(t.type){case\"color\":return gt.parse;case\"padding\":return De.parse;case\"numberArray\":return _e.parse;case\"colorArray\":return ae.parse;default:return null}}function Y0(t){switch(t){case\"exponential\":return tf;case\"interval\":return Z0;case\"categorical\":return W0;case\"identity\":return H0;default:throw Error(`Unknown function type \"${t}\"`)}}function Qp(t,e){let r=t.stops&&typeof t.stops[0][0]==\"object\",i=r||t.property!==void 0,n=r||!i,a=t.type||(Dl(e)?\"exponential\":\"interval\"),s=X0(e);if(s&&(t=tn({},t),t.stops&&(t.stops=t.stops.map(h=>[h[0],s(h[1])])),t.default?t.default=s(t.default):t.default=s(e.default)),t.colorSpace&&!R1(t.colorSpace))throw Error(`Unknown color space: \"${t.colorSpace}\"`);let o=Y0(a),l,u;if(a===\"categorical\"){l=Object.create(null);for(let h of t.stops)l[h[0]]=h[1];u=typeof t.stops[0][0]}if(r){let h={},c=[];for(let d=0;d<t.stops.length;d++){let y=t.stops[d],m=y[0].zoom;h[m]===void 0&&(h[m]={zoom:m,type:t.type,property:t.property,default:t.default,stops:[]},c.push(m)),h[m].stops.push([y[0].value,y[1]])}let p=[];for(let d of c)p.push([h[d].zoom,Qp(h[d],e)]);let f={name:\"linear\"};return{kind:\"composite\",interpolationType:f,interpolationFactor:xe.interpolationFactor.bind(void 0,f),zoomStops:p.map(d=>d[0]),evaluate({zoom:d},y){return tf({stops:p,base:t.base},e,d).evaluate(d,y)}}}if(n){let h=a===\"exponential\"?{name:\"exponential\",base:t.base===void 0?1:t.base}:null;return{kind:\"camera\",interpolationType:h,interpolationFactor:xe.interpolationFactor.bind(void 0,h),zoomStops:t.stops.map(c=>c[0]),evaluate:({zoom:c})=>o(t,e,c,l,u)}}return{kind:\"source\",evaluate(h,c){let p=c&&c.properties?c.properties[t.property]:void 0;return p===void 0?yn(t.default,e.default):o(t,e,p,l,u)}}}function yn(t,e,r){if(t!==void 0)return t;if(e!==void 0)return e;if(r!==void 0)return r}function W0(t,e,r,i,n){return yn(typeof r===n?i[r]:void 0,t.default,e.default)}function Z0(t,e,r){if(J(r)!==\"number\")return yn(t.default,e.default);let i=t.stops.length;if(i===1||r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[i-1][0])return t.stops[i-1][1];let n=Ma(t.stops.map(a=>a[0]),r,\"\");return t.stops[n][1]}function tf(t,e,r){let i=t.base===void 0?1:t.base;if(J(r)!==\"number\")return yn(t.default,e.default);let n=t.stops.length;if(n===1||r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[n-1][0])return t.stops[n-1][1];let a=Ma(t.stops.map(h=>h[0]),r,\"\"),s=K0(r,i,t.stops[a][0],t.stops[a+1][0]),o=t.stops[a][1],l=t.stops[a+1][1],u=dr[e.type]||G0;return typeof o.evaluate==\"function\"?{evaluate(...h){let c=o.evaluate.apply(void 0,h),p=l.evaluate.apply(void 0,h);if(c!==void 0&&p!==void 0)return u(c,p,s,t.colorSpace)}}:u(o,l,s,t.colorSpace)}function H0(t,e,r){switch(e.type){case\"color\":r=gt.parse(r);break;case\"formatted\":r=Be.fromString(r.toString());break;case\"resolvedImage\":r=we.fromString(r.toString());break;case\"padding\":r=De.parse(r);break;case\"colorArray\":r=ae.parse(r);break;case\"numberArray\":r=_e.parse(r);break;default:J(r)!==e.type&&(e.type!==\"enum\"||!e.values[r])&&(r=void 0)}return yn(r,t.default,e.default)}function K0(t,e,r,i){let n=i-r,a=t-r;return n===0?0:e===1?a/n:(e**+a-1)/(e**+n-1)}function to(t){return{result:\"success\",value:t}}function Rr(t){return{result:\"error\",value:t}}var Al=class{constructor(t,e,r,i){this.expression=t,this._warningHistory={},this._evaluator=new vp,this._defaultValue=r?of(r):null,this._enumValues=r&&r.type===\"enum\"?r.values:null,this._globalState=i,this._rootKey=e}evaluateWithoutErrorHandling(t,e,r,i,n,a){return this._globalState&&(t=ri(t,this._globalState)),this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=r,this._evaluator.canonical=i,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=a,this.expression.evaluate(this._evaluator)}evaluate(t,e,r,i,n,a){this._globalState&&(t=ri(t,this._globalState)),this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=r||null,this._evaluator.canonical=i,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=a||null;try{let s=this.expression.evaluate(this._evaluator);if(s==null||typeof s==\"number\"&&s!==s)return this._defaultValue;if(this._enumValues&&!(s in this._enumValues))throw new ct(`Expected value to be one of ${Object.keys(this._enumValues).map(o=>JSON.stringify(o)).join(\", \")}, but found ${JSON.stringify(s)} instead.`,\"\");return s}catch(s){let o=s instanceof ct?s.path:\"\",l=`${o}|${s.message}`;return this._warningHistory[l]||(this._warningHistory[l]=!0,typeof console<\"u\"&&console.warn(ef(this._rootKey,o,s.message,this._defaultValue))),this._defaultValue}}};function ef(t,e,r,i){return`${t}${e}: ${r}${i==null?\"\":` Falling back to ${String(i)}.`}`}function rf(t){if(!t)throw Error('rootKey must identify the location of the expression in the style JSON, e.g. \"layers[3].paint.line-width\".')}function Oa(t){return Array.isArray(t)&&t.length>0&&typeof t[0]==\"string\"&&t[0]in Gr}function Je(t,e,r,i){rf(e);let n=new Hp(Gr,da,[],r?tm(r):void 0),a=n.parse(t,void 0,void 0,void 0,r&&r.type===\"string\"?{typeAnnotation:\"coerce\"}:void 0);return a?to(new Al(a,e,r,i)):Rr(n.errors)}var en=class{constructor(t,e,r){this.kind=t,this._styleExpression=e,this.isStateDependent=t!==\"constant\"&&!Qi(e.expression),this.globalStateRefs=mn(e.expression),this._globalState=r}evaluateWithoutErrorHandling(t,e,r,i,n,a){return this._globalState&&(t=ri(t,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t,e,r,i,n,a)}evaluate(t,e,r,i,n,a){return this._globalState&&(t=ri(t,this._globalState)),this._styleExpression.evaluate(t,e,r,i,n,a)}},ya=class{constructor(t,e,r,i,n){this.kind=t,this.zoomStops=r,this._styleExpression=e,this.isStateDependent=t!==\"camera\"&&!Qi(e.expression),this.globalStateRefs=mn(e.expression),this.interpolationType=i,this._globalState=n}evaluateWithoutErrorHandling(t,e,r,i,n,a){return this._globalState&&(t=ri(t,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t,e,r,i,n,a)}evaluate(t,e,r,i,n,a){return this._globalState&&(t=ri(t,this._globalState)),this._styleExpression.evaluate(t,e,r,i,n,a)}interpolationFactor(t,e,r){return this.interpolationType?xe.interpolationFactor(this.interpolationType,t,e,r):0}};function J0(t){return t._styleExpression!==void 0}function nf(t,e,r,i){let n=Je(t,e,r,i);if(n.result===\"error\")return n;let a=n.value.expression,s=za(a);if(!s&&!ei(r))return Rr([new ge(\"\",\"data expressions not supported\")]);let o=La(a,[\"zoom\"]);if(!o&&!Jp(r))return Rr([new ge(\"\",\"zoom expressions not supported\")]);let l=sa(a);if(!l&&!o)return Rr([new ge(\"\",'\"zoom\" expression may only be used as input to a top-level \"step\" or \"interpolate\" expression.')]);if(l instanceof ge)return Rr([l]);if(l instanceof xe&&!Dl(r))return Rr([new ge(\"\",'\"interpolate\" expressions cannot be used with this property')]);if(!l)return to(s?new en(\"constant\",n.value,i):new en(\"source\",n.value,i));let u=l instanceof xe?l.interpolation:void 0;return to(s?new ya(\"camera\",n.value,l.labels,u,i):new ya(\"composite\",n.value,l.labels,u,i))}var af=class sf{constructor(e,r,i){this.isStateDependent=!1,this.globalStateRefs=new Set,this._globalState=null,rf(r),this._parameters=e,this._specification=i,this._rootKey=r,this._defaultValue=of(i),this._warningHistory={};let n=Qp(this._parameters,this._specification);this.kind=n.kind,this.interpolationFactor=n.interpolationFactor,this.zoomStops=n.zoomStops,this.interpolationType=n.interpolationType,this._innerEvaluate=n.evaluate}evaluate(e,r){try{return this._innerEvaluate(e,r)}catch(i){let n=i instanceof Error?i.message:String(i),a=`|${n}`;return this._warningHistory[a]||(this._warningHistory[a]=!0,typeof console<\"u\"&&console.warn(ef(this._rootKey,\"\",n,this._defaultValue))),this._defaultValue}}static deserialize(e){return new sf(e._parameters,e._rootKey,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification,_rootKey:e._rootKey}}};function Q0(t,e,r,i){if(Va(t))return new af(t,e,r);if(Oa(t)){let n=nf(t,e,r,i);if(n.result===\"error\")throw Error(n.value.map(a=>`${a.key}: ${a.message}`).join(\", \"));return n.value}{let n=t;return r.type===\"color\"&&typeof t==\"string\"?n=gt.parse(t):r.type===\"padding\"&&(typeof t==\"number\"||Array.isArray(t))?n=De.parse(t):r.type===\"numberArray\"&&(typeof t==\"number\"||Array.isArray(t))?n=_e.parse(t):r.type===\"colorArray\"&&(typeof t==\"string\"||Array.isArray(t))?n=ae.parse(t):r.type===\"variableAnchorOffsetCollection\"&&Array.isArray(t)?n=be.parse(t):r.type===\"projectionDefinition\"&&typeof t==\"string\"&&(n=vr.parse(t)),{globalStateRefs:new Set,_globalState:null,kind:\"constant\",evaluate:()=>n}}}function sa(t){let e=null;if(t instanceof Ep)e=sa(t.result);else if(t instanceof Pp){for(let r of t.args)if(e=sa(r),e)break}else(t instanceof fl||t instanceof xe)&&t.input instanceof br&&t.input.name===\"zoom\"&&(e=t);return e instanceof ge||t.eachChild(r=>{let i=sa(r);i instanceof ge?e=i:!e&&i?e=new ge(\"\",'\"zoom\" expression may only be used as input to a top-level \"step\" or \"interpolate\" expression.'):e&&i&&e!==i&&(e=new ge(\"\",'Only one zoom-based \"step\" or \"interpolate\" subexpression may be used in an expression.'))}),e}function mn(t,e=new Set){return t instanceof wl&&e.add(t.key),t.eachChild(r=>{mn(r,e)}),e}function tm(t){let e={color:ue,string:Y,number:T,enum:Y,boolean:tt,formatted:pn,padding:Ta,numberArray:Ia,colorArray:Hi,projectionDefinition:Fa,resolvedImage:fn,variableAnchorOffsetCollection:Ca};return t.type===\"array\"?Nt(e[t.value]||Z,t.length):e[t.type]}function of(t){if(t.type===\"color\"&&Va(t.default))return new gt(0,0,0,0);switch(t.type){case\"color\":return gt.parse(t.default)||null;case\"padding\":return De.parse(t.default)||null;case\"numberArray\":return _e.parse(t.default)||null;case\"colorArray\":return ae.parse(t.default)||null;case\"variableAnchorOffsetCollection\":return be.parse(t.default)||null;case\"projectionDefinition\":return vr.parse(t.default)||null;default:return t.default===void 0?null:t.default}}function ri(t,e){let{zoom:r,heatmapDensity:i,elevation:n,lineProgress:a,isSupportedScript:s,accumulated:o}=t??{};return{zoom:r,heatmapDensity:i,elevation:n,lineProgress:a,isSupportedScript:s,accumulated:o,globalState:e}}function em(t){let e=!1;for(let r of t){let i=lf(r);if(i===\"expression\")return\"expression\";i===\"legacy\"&&(e=!0)}return e?\"legacy\":\"neutral\"}function lf(t){if(typeof t==\"boolean\")return\"neutral\";if(!Array.isArray(t)||t.length===0)return\"legacy\";switch(t[0]){case\"has\":return t.length<2||t[1]===\"$id\"||t[1]===\"$type\"?\"legacy\":t.length===2?\"neutral\":\"expression\";case\"in\":return t.length>=3&&(typeof t[1]!=\"string\"||Array.isArray(t[2]))?\"expression\":\"legacy\";case\"!in\":case\"!has\":return\"legacy\";case\"==\":case\"!=\":case\">\":case\">=\":case\"<\":case\"<=\":return t.length!==3||Array.isArray(t[1])||Array.isArray(t[2])?\"expression\":\"legacy\";case\"none\":return\"legacy\";case\"any\":case\"all\":return em(t.slice(1));default:return\"expression\"}}function Sl(t){return lf(t)!==\"legacy\"}function wh(t){return t===\"$type\"?[\"geometry-type\"]:t===\"$id\"?[\"id\"]:[\"get\",t]}function rm(t){switch(t[0]){case\"==\":case\"!=\":case\"<\":case\"<=\":case\">\":case\">=\":return t.length!==3||typeof t[1]!=\"string\"?null:[t[0],wh(t[1]),t[2]];case\"in\":case\"!in\":{if(t.length<2||typeof t[1]!=\"string\")return null;let e=[\"in\",wh(t[1]),[\"literal\",t.slice(2)]];return t[0]===\"!in\"?[\"!\",e]:e}case\"has\":case\"!has\":{if(t.length!==2||typeof t[1]!=\"string\"||t[1]===\"$type\"||t[1]===\"$id\")return null;let e=[\"has\",t[1]];return t[0]===\"!has\"?[\"!\",e]:e}default:return null}}function uf(t){if((t[0]===\"<\"||t[0]===\"<=\"||t[0]===\">\"||t[0]===\">=\")&&t[1]===\"$type\")return`\"$type\" cannot be use with operator \"${t[0]}\"`;let e=rm(t);return e?`Mixing deprecated filter syntax with expression syntax is not supported. Replace ${JSON.stringify(t)} with ${JSON.stringify(e)}.`:`Mixing deprecated filter syntax with expression syntax is not supported. Convert ${JSON.stringify(t)} to expression syntax.`}function Ms(t,e,r){let i=r[t];return Array.isArray(i)?Sl(i)?El(i,e.concat(t)):{path:e.concat(t),legacyFilter:i}:null}function El(t,e=[]){if(!Array.isArray(t)||t.length<1)return null;switch(t[0]){case\"all\":case\"any\":case\"none\":for(let r=1;r<t.length;r++){let i=Ms(r,e,t);if(i)return i}break;case\"!\":{let r=Ms(1,e,t);if(r)return r;break}case\"case\":for(let r=1;r<t.length-1;r+=2){let i=Ms(r,e,t);if(i)return i}}return null}function im(t,e){let r=El(t);if(!r||typeof console>\"u\")return;let i=r.path.map(n=>`[${n}]`).join(\"\");console.warn(`${e}${i}: ${uf(r.legacyFilter)}`)}var nm={type:\"boolean\",default:!1,transition:!1,\"property-type\":\"data-driven\",expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]}};function ii(t,e,r){if(t==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};Sl(t)?im(t,e):t=ma(t);let i=Je(t,e,nm,r);if(i.result===\"error\")throw Error(i.value.map(n=>`${n.key}: ${n.message}`).join(\", \"));return{filter:(n,a,s)=>i.value.evaluate(n,a,{},s),needGeometry:hf(t),getGlobalStateRefs:()=>mn(i.value.expression)}}function am(t,e){return t<e?-1:+(t>e)}function hf(t){if(!Array.isArray(t))return!1;if(t[0]===\"within\"||t[0]===\"distance\")return!0;for(let e=1;e<t.length;e++)if(hf(t[e]))return!0;return!1}function ma(t){if(!t)return!0;let e=t[0];return t.length<=1?e!==\"any\":e===\"==\"?Bs(t[1],t[2],\"==\"):e===\"!=\"?Un(Bs(t[1],t[2],\"==\")):e===\"<\"||e===\">\"||e===\"<=\"||e===\">=\"?Bs(t[1],t[2],e):e===\"any\"?sm(t.slice(1)):e===\"all\"?[\"all\"].concat(t.slice(1).map(ma)):e===\"none\"?[\"all\"].concat(t.slice(1).map(ma).map(Un)):e===\"in\"?Dh(t[1],t.slice(2)):e===\"!in\"?Un(Dh(t[1],t.slice(2))):e===\"has\"?_h(t[1]):e!==\"!has\"||Un(_h(t[1]))}function Bs(t,e,r){switch(t){case\"$type\":return[`filter-type-${r}`,e];case\"$id\":return[`filter-id-${r}`,e];default:return[`filter-${r}`,t,e]}}function sm(t){return[\"any\"].concat(t.map(ma))}function Dh(t,e){if(e.length===0)return!1;switch(t){case\"$type\":return[\"filter-type-in\",[\"literal\",e]];case\"$id\":return[\"filter-id-in\",[\"literal\",e]];default:return e.length>200&&!e.some(r=>typeof r!=typeof e[0])?[\"filter-in-large\",t,[\"literal\",e.sort(am)]]:[\"filter-in-small\",t,[\"literal\",e]]}}function _h(t){switch(t){case\"$type\":return!0;case\"$id\":return[\"filter-has-id\"];default:return[\"filter-has\",t]}}function Un(t){return[\"!\",t]}function cf(t){let e=t.key,r=t.value;return r?[new k(e,r,\"constants have been deprecated as of v8\")]:[]}function Dt(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function yr(t){if(Array.isArray(t))return t.map(yr);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){let e={};for(let r in t)e[r]=yr(t[r]);return e}return Dt(t)}function Jt(t){let e=t.key,r=t.value,i=t.valueSpec||{},n=t.objectElementValidators||{},a=t.style,s=t.styleSpec,o=t.validateSpec,l=[],u=J(r);if(u!==\"object\")return[new k(e,r,`object expected, ${u} found`)];for(let h in r){let c=h.split(\".\")[0],p=Ni(i,c)||i[\"*\"],f;if(Ni(n,c))f=n[c];else if(Ni(i,c)){if(r[h]===void 0)continue;f=o}else if(n[\"*\"])f=n[\"*\"];else if(i[\"*\"])f=o;else{l.push(new k(e,r[h],`unknown property \"${h}\"`));continue}l=l.concat(f({key:(e&&`${e}.`)+h,value:r[h],valueSpec:p,style:a,styleSpec:s,object:r,objectKey:h,validateSpec:o},r))}for(let h in i)n[h]||i[h].required&&i[h].default===void 0&&r[h]===void 0&&l.push(new k(e,r,`missing required property \"${h}\"`));return l}function Fl(t){let e=t.value,r=t.valueSpec,i=t.validateSpec,n=t.style,a=t.styleSpec,s=t.key,o=t.arrayElementValidator||i;if(J(e)!==\"array\")return[new k(s,e,`array expected, ${J(e)} found`)];if(r.length&&e.length!==r.length)return[new k(s,e,`array length ${r.length} expected, length ${e.length} found`)];let l={type:r.value,values:r.values};a.$version<7&&(l.function=r.function),J(r.value)===\"object\"&&(l=r.value);let u=[];for(let h=0;h<e.length;h++)u=u.concat(o({array:e,arrayIndex:h,value:e[h],valueSpec:l,validateSpec:t.validateSpec,style:n,styleSpec:a,key:`${s}[${h}]`}));return u}function Ra(t){let e=t.key,r=t.value,i=t.valueSpec,n=J(r);return n===\"number\"&&r!==r&&(n=\"NaN\"),n===\"number\"?\"minimum\"in i&&r<i.minimum?[new k(e,r,`${r} is less than the minimum value ${i.minimum}`)]:\"maximum\"in i&&r>i.maximum?[new k(e,r,`${r} is greater than the maximum value ${i.maximum}`)]:[]:[new k(e,r,`number expected, ${n} found`)]}function pf(t){let e=t.valueSpec,r=Dt(t.value.type),i,n={},a,s,o=r!==\"categorical\"&&t.value.property===void 0,l=!o,u=J(t.value.stops)===\"array\"&&J(t.value.stops[0])===\"array\"&&J(t.value.stops[0][0])===\"object\",h=Jt({key:t.key,value:t.value,valueSpec:t.styleSpec.function,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:c,default:d}});return r===\"identity\"&&o&&h.push(new k(t.key,t.value,'missing required property \"property\"')),r!==\"identity\"&&!t.value.stops&&h.push(new k(t.key,t.value,'missing required property \"stops\"')),r===\"exponential\"&&t.valueSpec.expression&&!Dl(t.valueSpec)&&h.push(new k(t.key,t.value,\"exponential functions not supported\")),t.styleSpec.$version>=8&&(l&&!ei(t.valueSpec)?h.push(new k(t.key,t.value,\"property functions not supported\")):o&&!Jp(t.valueSpec)&&h.push(new k(t.key,t.value,\"zoom functions not supported\"))),(r===\"categorical\"||u)&&t.value.property===void 0&&h.push(new k(t.key,t.value,'\"property\" property is required')),h;function c(y){if(r===\"identity\")return[new k(y.key,y.value,'identity function may not have a \"stops\" property')];let m=[],g=y.value;return m=m.concat(Fl({key:y.key,value:g,valueSpec:y.valueSpec,validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec,arrayElementValidator:p})),J(g)===\"array\"&&g.length===0&&m.push(new k(y.key,g,\"array must have at least one stop\")),m}function p(y){let m=[],g=y.value,x=y.key;if(J(g)!==\"array\")return[new k(x,g,`array expected, ${J(g)} found`)];if(g.length!==2)return[new k(x,g,`array length 2 expected, length ${g.length} found`)];if(u){if(J(g[0])!==\"object\")return[new k(x,g,`object expected, ${J(g[0])} found`)];if(g[0].zoom===void 0)return[new k(x,g,\"object stop key must have zoom\")];if(g[0].value===void 0)return[new k(x,g,\"object stop key must have value\")];if(s&&s>Dt(g[0].zoom))return[new k(x,g[0].zoom,\"stop zoom values must appear in ascending order\")];Dt(g[0].zoom)!==s&&(s=Dt(g[0].zoom),a=void 0,n={}),m=m.concat(Jt({key:`${x}[0]`,value:g[0],valueSpec:{zoom:{}},validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec,objectElementValidators:{zoom:Ra,value:f}}))}else m=m.concat(f({key:`${x}[0]`,value:g[0],valueSpec:{},validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec},g));return Oa(yr(g[1]))?m.concat([new k(`${x}[1]`,g[1],\"expressions are not allowed in function stops.\")]):m.concat(y.validateSpec({key:`${x}[1]`,value:g[1],valueSpec:e,validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec}))}function f(y,m){let g=J(y.value),x=Dt(y.value),b=y.value===null?m:y.value;if(!i)i=g;else if(g!==i)return[new k(y.key,b,`${g} stop domain type must match previous stop domain type ${i}`)];if(g!==\"number\"&&g!==\"string\"&&g!==\"boolean\")return[new k(y.key,b,\"stop domain value must be a number, string, or boolean\")];if(g!==\"number\"&&r!==\"categorical\"){let v=`number expected, ${g} found`;return ei(e)&&r===void 0&&(v+='\\nIf you intended to use a categorical function, specify `\"type\": \"categorical\"`.'),[new k(y.key,b,v)]}return r===\"categorical\"&&g===\"number\"&&(!isFinite(x)||Math.floor(x)!==x)?[new k(y.key,b,`integer expected, found ${x}`)]:r!==\"categorical\"&&g===\"number\"&&a!==void 0&&x<a?[new k(y.key,b,\"stop domain values must appear in ascending order\")]:(a=x,r===\"categorical\"&&x in n?[new k(y.key,b,\"stop domain values must be unique\")]:(n[x]=!0,[]))}function d(y){return y.validateSpec({key:y.key,value:y.value,valueSpec:e,validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec})}}function ni(t){let e=(t.expressionContext===\"property\"?nf:Je)(yr(t.value),t.key,t.valueSpec);if(e.result===\"error\")return e.value.map(i=>new k(`${t.key}${i.key}`,t.value,i.message));let r=e.value.expression||e.value._styleExpression.expression;if(t.expressionContext===\"property\"&&t.propertyKey===\"text-font\"&&!r.outputDefined())return[new k(t.key,t.value,`Invalid data expression for \"${t.propertyKey}\". Output values must be contained as literals within the expression.`)];if(t.expressionContext===\"property\"&&t.propertyType===\"layout\"&&!Qi(r))return[new k(t.key,t.value,'\"feature-state\" data expressions are not supported with layout properties.')];if(t.expressionContext===\"filter\"&&!Qi(r))return[new k(t.key,t.value,'\"feature-state\" data expressions are not supported with filters.')];if(t.expressionContext&&t.expressionContext.indexOf(\"cluster\")===0){if(!La(r,[\"zoom\",\"feature-state\"]))return[new k(t.key,t.value,'\"zoom\" and \"feature-state\" expressions are not supported with cluster properties.')];if(t.expressionContext===\"cluster-initial\"&&!za(r))return[new k(t.key,t.value,\"Feature data expressions are not supported with initial expression part of cluster properties.\")]}return[]}function om(t){let e=t.value,r=t.key,i=J(e);return i===\"boolean\"?[]:[new k(r,e,`boolean expected, ${i} found`)]}function eo(t){let e=t.key,r=t.value,i=J(r);return i===\"string\"?gt.parse(String(r))?[]:[new k(e,r,`color expected, \"${r}\" found`)]:[new k(e,r,`color expected, ${i} found`)]}function rn(t){let e=t.key,r=t.value,i=t.valueSpec,n=[];return Array.isArray(i.values)?i.values.indexOf(Dt(r))===-1&&n.push(new k(e,r,`expected one of [${i.values.join(\", \")}], ${JSON.stringify(r)} found`)):Object.keys(i.values).indexOf(Dt(r))===-1&&n.push(new k(e,r,`expected one of [${Object.keys(i.values).join(\", \")}], ${JSON.stringify(r)} found`)),n}function lm(t,e){let r=t;for(let i of e)r=r[i];return r}function um(t,e){let r=El(e);return r?[new k(`${t.key}${r.path.map(i=>`[${i}]`).join(\"\")}`,lm(t.value,r.path),uf(r.legacyFilter),null,\"warning\")]:[]}function kl(t){let e=yr(t.value);return Sl(e)?[...um(t,e),...ni(tn({},t,{expressionContext:\"filter\",valueSpec:{value:\"boolean\"}}))]:ff(t)}function ff(t){let e=t.value,r=t.key;if(J(e)!==\"array\")return[new k(r,e,`array expected, ${J(e)} found`)];let i=t.styleSpec,n,a=[];if(e.length<1)return[new k(r,e,\"filter array must have at least 1 element\")];switch(a=a.concat(rn({key:`${r}[0]`,value:e[0],valueSpec:i.filter_operator,style:t.style,styleSpec:t.styleSpec})),Dt(e[0])){case\"<\":case\"<=\":case\">\":case\">=\":e.length>=2&&Dt(e[1])===\"$type\"&&a.push(new k(r,e,`\"$type\" cannot be use with operator \"${e[0]}\"`));case\"==\":case\"!=\":e.length!==3&&a.push(new k(r,e,`filter array for operator \"${e[0]}\" must have 3 elements`));case\"in\":case\"!in\":e.length>=2&&(n=J(e[1]),n!==\"string\"&&a.push(new k(`${r}[1]`,e[1],`string expected, ${n} found`)));for(let s=2;s<e.length;s++)n=J(e[s]),Dt(e[1])===\"$type\"?a=a.concat(rn({key:`${r}[${s}]`,value:e[s],valueSpec:i.geometry_type,style:t.style,styleSpec:t.styleSpec})):n!==\"string\"&&n!==\"number\"&&n!==\"boolean\"&&a.push(new k(`${r}[${s}]`,e[s],`string, number, or boolean expected, ${n} found`));break;case\"any\":case\"all\":case\"none\":for(let s=1;s<e.length;s++)a=a.concat(ff({key:`${r}[${s}]`,value:e[s],style:t.style,styleSpec:t.styleSpec}));break;case\"has\":case\"!has\":n=J(e[1]),e.length===2?n!==\"string\"&&a.push(new k(`${r}[1]`,e[1],`string expected, ${n} found`)):a.push(new k(r,e,`filter array for \"${e[0]}\" operator must have 2 elements`))}return a}function df(t,e){let r=t.key,i=t.validateSpec,n=t.style,a=t.styleSpec,s=t.value,o=t.objectKey,l=a[`${e}_${t.layerType}`];if(!l)return[];let u=o.match(_l);if(e===\"paint\"&&u&&l[u[1]]&&l[u[1]].transition)return i({key:r,value:s,valueSpec:a.transition,style:n,styleSpec:a});let h=t.valueSpec||l[o];if(!h)return[new k(r,s,`unknown property \"${o}\"`)];let c;if(J(s)===\"string\"&&ei(h)&&!h.tokens&&(c=/^{([^}]+)}$/.exec(s)))return[new k(r,s,`\"${o}\" does not support interpolation syntax\nUse an identity property function instead: \\`{ \"type\": \"identity\", \"property\": ${JSON.stringify(c[1])} }\\`.`)];let p=[];return t.layerType===\"symbol\"&&o===\"text-font\"&&Va(yr(s))&&Dt(s.type)===\"identity\"&&p.push(new k(r,s,'\"text-font\" does not support identity functions')),p.concat(i({key:t.key,value:s,valueSpec:h,style:n,styleSpec:a,expressionContext:\"property\",propertyType:e,propertyKey:o}))}function yf(t){return df(t,\"paint\")}function mf(t){return df(t,\"layout\")}function gf(t){let e=[],r=t.value,i=t.key,n=t.style,a=t.styleSpec;if(J(r)!==\"object\")return[new k(i,r,`object expected, ${J(r)} found`)];!r.type&&!r.ref&&e.push(new k(i,r,'either \"type\" or \"ref\" is required'));let s=Dt(r.type),o=Dt(r.ref);if(r.id){let l=Dt(r.id);for(let u=0;u<t.arrayIndex;u++){let h=n.layers[u];Dt(h.id)===l&&e.push(new k(i,r.id,`duplicate layer id \"${r.id}\", previously used at line ${h.id.__line__}`))}}if(\"ref\"in r){[\"type\",\"source\",\"source-layer\",\"filter\",\"layout\"].forEach(u=>{u in r&&e.push(new k(i,r[u],`\"${u}\" is prohibited for ref layers`))});let l;n.layers.forEach(u=>{Dt(u.id)===o&&(l=u)}),l?l.ref?e.push(new k(i,r.ref,\"ref cannot reference another ref layer\")):s=Dt(l.type):e.push(new k(i,r.ref,`ref layer \"${o}\" not found`))}else if(s!==\"background\")if(!r.source)e.push(new k(i,r,'missing required property \"source\"'));else{let l=n.sources&&n.sources[r.source],u=l&&Dt(l.type);l?u===\"vector\"&&s===\"raster\"?e.push(new k(i,r.source,`layer \"${r.id}\" requires a raster source`)):u!==\"raster-dem\"&&s===\"hillshade\"||u!==\"raster-dem\"&&s===\"color-relief\"?e.push(new k(i,r.source,`layer \"${r.id}\" requires a raster-dem source`)):u===\"raster\"&&s!==\"raster\"?e.push(new k(i,r.source,`layer \"${r.id}\" requires a vector source`)):u===\"vector\"&&!r[\"source-layer\"]?e.push(new k(i,r,`layer \"${r.id}\" must specify a \"source-layer\"`)):u===\"raster-dem\"&&s!==\"hillshade\"&&s!==\"color-relief\"?e.push(new k(i,r.source,\"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.\")):s===\"line\"&&r.paint&&r.paint[\"line-gradient\"]&&(u!==\"geojson\"||!l.lineMetrics)&&e.push(new k(i,r,`layer \"${r.id}\" specifies a line-gradient, which requires a GeoJSON source with \\`lineMetrics\\` enabled.`)):e.push(new k(i,r.source,`source \"${r.source}\" not found`))}return s===\"raster\"&&r.paint?.resampling&&r.paint?.[\"raster-resampling\"]&&e.push(new k(i,r.paint,`layer \"${r.id}\" redundantly specifies \"resampling\" and \"raster-resampling\" paint properties, but only one is allowed. It is advised to use \"resampling\".`)),e=e.concat(Jt({key:i,value:r,valueSpec:a.layer,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{\"*\"(){return[]},type(){return t.validateSpec({key:`${i}.type`,value:r.type,valueSpec:a.layer.type,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,object:r,objectKey:\"type\"})},filter:kl,layout(l){return Jt({layer:r,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{\"*\"(u){return mf(tn({layerType:s},u))}}})},paint(l){return Jt({layer:r,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{\"*\"(u){return yf(tn({layerType:s},u))}}})}}})),e}function Ke(t){let e=t.value,r=t.key,i=J(e);return i===\"string\"?[]:[new k(r,e,`string expected, ${i} found`)]}function hm(t){let e=t.sourceName??\"\",r=t.value,i=t.styleSpec,n=i.source_raster_dem,a=t.style,s=[],o=J(r);if(r===void 0)return s;if(o!==\"object\")return s.push(new k(\"source_raster_dem\",r,`object expected, ${o} found`)),s;let l=Dt(r.encoding)===\"custom\",u=[\"redFactor\",\"greenFactor\",\"blueFactor\",\"baseShift\"],h=t.value.encoding?`\"${t.value.encoding}\"`:\"Default\";for(let c in r)!l&&u.includes(c)?s.push(new k(c,r[c],`In \"${e}\": \"${c}\" is only valid when \"encoding\" is set to \"custom\". ${h} encoding found`)):n[c]?s=s.concat(t.validateSpec({key:c,value:r[c],valueSpec:n[c],validateSpec:t.validateSpec,style:a,styleSpec:i})):s.push(new k(c,r[c],`unknown property \"${c}\"`));return s}var Ah={promoteId:cm};function xf(t){let e=t.value,r=t.key,i=t.styleSpec,n=t.style,a=t.validateSpec;if(!e.type)return[new k(r,e,'\"type\" is required')];let s=Dt(e.type),o;switch(s){case\"vector\":case\"raster\":return o=Jt({key:r,value:e,valueSpec:i[`source_${s.replace(\"-\",\"_\")}`],style:t.style,styleSpec:i,objectElementValidators:Ah,validateSpec:a}),o;case\"raster-dem\":return o=hm({sourceName:r,value:e,style:t.style,styleSpec:i,validateSpec:a}),o;case\"geojson\":if(o=Jt({key:r,value:e,valueSpec:i.source_geojson,style:n,styleSpec:i,validateSpec:a,objectElementValidators:Ah}),e.cluster)for(let l in e.clusterProperties){let[u,h]=e.clusterProperties[l],c=typeof u==\"string\"?[u,[\"accumulated\"],[\"get\",l]]:u;o.push(...ni({key:`${r}.${l}.map`,value:h,validateSpec:a,expressionContext:\"cluster-map\"})),o.push(...ni({key:`${r}.${l}.reduce`,value:c,validateSpec:a,expressionContext:\"cluster-reduce\"}))}return o;case\"video\":return Jt({key:r,value:e,valueSpec:i.source_video,style:n,validateSpec:a,styleSpec:i});case\"image\":return Jt({key:r,value:e,valueSpec:i.source_image,style:n,validateSpec:a,styleSpec:i});case\"canvas\":return[new k(r,null,\"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.\",\"source.canvas\")];default:return rn({key:`${r}.type`,value:e.type,valueSpec:{values:[\"vector\",\"raster\",\"raster-dem\",\"geojson\",\"video\",\"image\"]},style:n,validateSpec:a,styleSpec:i})}}function cm({key:t,value:e}){if(J(e)===\"string\")return Ke({key:t,value:e});{let r=[];for(let i in e)r.push(...Ke({key:`${t}.${i}`,value:e[i]}));return r}}function vf(t){let e=t.value,r=t.styleSpec,i=r.light,n=t.style,a=[],s=J(e);if(e===void 0)return a;if(s!==\"object\")return a=a.concat([new k(\"light\",e,`object expected, ${s} found`)]),a;for(let o in e){let l=o.match(_l);a=l&&i[l[1]]&&i[l[1]].transition?a.concat(t.validateSpec({key:o,value:e[o],valueSpec:r.transition,validateSpec:t.validateSpec,style:n,styleSpec:r})):i[o]?a.concat(t.validateSpec({key:o,value:e[o],valueSpec:i[o],validateSpec:t.validateSpec,style:n,styleSpec:r})):a.concat([new k(o,e[o],`unknown property \"${o}\"`)])}return a}function bf(t){let e=t.value,r=t.styleSpec,i=r.sky,n=t.style,a=J(e);if(e===void 0)return[];if(a!==\"object\")return[new k(\"sky\",e,`object expected, ${a} found`)];let s=[];for(let o in e){let l=o.match(_l);s=l&&i[l[1]]&&i[l[1]].transition?s.concat(t.validateSpec({key:o,value:e[o],valueSpec:r.transition,style:n,styleSpec:r})):i[o]?s.concat(t.validateSpec({key:o,value:e[o],valueSpec:i[o],style:n,styleSpec:r})):s.concat([new k(o,e[o],`unknown property \"${o}\"`)])}return s}function wf(t){let e=t.value,r=t.styleSpec,i=r.terrain,n=t.style,a=[],s=J(e);if(e===void 0)return a;if(s!==\"object\")return a=a.concat([new k(\"terrain\",e,`object expected, ${s} found`)]),a;for(let o in e)a=i[o]?a.concat(t.validateSpec({key:o,value:e[o],valueSpec:i[o],validateSpec:t.validateSpec,style:n,styleSpec:r})):a.concat([new k(o,e[o],`unknown property \"${o}\"`)]);return a}function pm(t){return Ke(t).length===0?[]:ni(t)}function fm(t){return Ke(t).length===0?[]:ni(t)}function dm(t){let e=t.key,r=t.value;if(J(r)===\"array\"){if(r.length<1||r.length>4)return[new k(e,r,`padding requires 1 to 4 values; ${r.length} values found`)];let i={type:\"number\"},n=[];for(let a=0;a<r.length;a++)n=n.concat(t.validateSpec({key:`${e}[${a}]`,value:r[a],validateSpec:t.validateSpec,valueSpec:i}));return n}return Ra({key:e,value:r,valueSpec:{}})}function ym(t){let e=t.key,r=t.value;if(J(r)===\"array\"){let i={type:\"number\"};if(r.length<1)return[new k(e,r,\"array length at least 1 expected, length 0 found\")];let n=[];for(let a=0;a<r.length;a++)n=n.concat(t.validateSpec({key:`${e}[${a}]`,value:r[a],validateSpec:t.validateSpec,valueSpec:i}));return n}return Ra({key:e,value:r,valueSpec:{}})}function mm(t){let e=t.key,r=t.value;if(J(r)===\"array\"){if(r.length<1)return[new k(e,r,\"array length at least 1 expected, length 0 found\")];let i=[];for(let n=0;n<r.length;n++)i=i.concat(eo({key:`${e}[${n}]`,value:r[n],valueSpec:{}}));return i}return eo({key:e,value:r,valueSpec:{}})}function gm(t){let e=t.key,r=t.value,i=J(r),n=t.styleSpec;if(i!==\"array\"||r.length<1||r.length%2!=0)return[new k(e,r,\"variableAnchorOffsetCollection requires a non-empty array of even length\")];let a=[];for(let s=0;s<r.length;s+=2)a=a.concat(rn({key:`${e}[${s}]`,value:r[s],valueSpec:n.layout_symbol[\"text-anchor\"]})),a=a.concat(Fl({key:`${e}[${s+1}]`,value:r[s+1],valueSpec:{length:2,value:\"number\"},validateSpec:t.validateSpec,style:t.style,styleSpec:n}));return a}function Df(t){let e=[],r=t.value,i=t.key;if(Array.isArray(r)){let n=[],a=[];for(let s in r)r[s].id&&n.includes(r[s].id)&&e.push(new k(i,r,`all the sprites' ids must be unique, but ${r[s].id} is duplicated`)),n.push(r[s].id),r[s].url&&a.includes(r[s].url)&&e.push(new k(i,r,`all the sprites' URLs must be unique, but ${r[s].url} is duplicated`)),a.push(r[s].url),e=e.concat(Jt({key:`${i}[${s}]`,value:r[s],valueSpec:{id:{type:\"string\",required:!0},url:{type:\"string\",required:!0}},validateSpec:t.validateSpec}));return e}return Ke({key:i,value:r})}function xm(t){let e=t.value,r=t.styleSpec,i=r.projection,n=t.style,a=J(e);if(e===void 0)return[];if(a!==\"object\")return[new k(\"projection\",e,`object expected, ${a} found`)];let s=[];for(let o in e)s=i[o]?s.concat(t.validateSpec({key:o,value:e[o],valueSpec:i[o],style:n,styleSpec:r})):s.concat([new k(o,e[o],`unknown property \"${o}\"`)]);return s}function vm(t){let e=t.key,r=t.value;r=r instanceof String?r.valueOf():r;let i=J(r);return i===\"array\"&&!wm(r)&&!bm(r)?[new k(e,r,`projection expected, invalid array ${JSON.stringify(r)} found`)]:[\"array\",\"string\"].includes(i)?[]:[new k(e,r,`projection expected, invalid type \"${i}\" found`)]}function bm(t){return!![\"interpolate\",\"step\",\"literal\"].includes(t[0])}function wm(t){return Array.isArray(t)&&t.length===3&&typeof t[0]==\"string\"&&typeof t[1]==\"string\"&&typeof t[2]==\"number\"}function ro(t){return!!t&&t.constructor===Object}function _f(t){return ro(t.value)?[]:[new k(t.key,t.value,`object expected, ${J(t.value)} found`)]}var Sh=1114111,Dm=/^u\\+(?:([0-9a-f]{1,6})(?:-([0-9a-f]{1,6}))?|([0-9a-f]{0,5}\\?{1,6}))$/i;function _m(t,e){if(J(e)!==\"string\")return[];let r=`${e}`,i=()=>[new k(t,e,'invalid unicode range, expected a value such as \"U+26\", \"U+0-10FFFF\" or \"U+4??\"')],n=r.match(Dm);if(!n)return i();let[,a,s,o]=n;if(o!==void 0)return o.length>6?i():[];let l=parseInt(a,16),u=s===void 0?l:parseInt(s,16);return l>Sh||u>Sh?[new k(t,e,\"unicode range is out of bounds, the maximum code point is U+10FFFF\")]:l>u?[new k(t,e,`unicode range start must not be greater than its end, but ${r} is`)]:[]}function Af(t){let e=t.key??\"font-faces\",r=t.value,i=t.validateSpec,n=t.styleSpec??op,a=t.style;if(!ro(r))return[new k(e,r,`object expected, ${J(r)} found`)];let s=[];for(let o in r){let l=r[o],u=J(l);if(u===\"string\")s.push(...Ke({key:`${e}.${o}`,value:l}));else if(u===\"array\"){let h={url:{type:\"string\",required:!0},\"unicode-range\":{type:\"array\",value:\"string\"}};for(let[c,p]of l.entries()){let f=`${e}.${o}[${c}]`;s.push(...Jt({key:f,value:p,valueSpec:h,styleSpec:n,style:a,validateSpec:i}));let d=ro(p)?p[\"unicode-range\"]:void 0;if(J(d)===\"array\")for(let[y,m]of d.entries())s.push(..._m(`${f}.unicode-range[${y}]`,m))}}else s.push(new k(`${e}.${o}`,l,`string or array expected, ${u} found`))}return s}var Eh={\"*\"(){return[]},array:Fl,boolean:om,number:Ra,color:eo,constants:cf,enum:rn,filter:kl,function:pf,layer:gf,object:Jt,source:xf,light:vf,sky:bf,terrain:wf,projection:xm,projectionDefinition:vm,string:Ke,formatted:pm,resolvedImage:fm,padding:dm,numberArray:ym,colorArray:mm,variableAnchorOffsetCollection:gm,sprite:Df,state:_f,fontFaces:Af};function qi(t){let e=t.value,r=t.valueSpec,i=t.styleSpec;return t.validateSpec=qi,r.expression&&Va(Dt(e))?pf(t):r.expression&&Oa(yr(e))?ni(t):r.type&&Eh[r.type]?Eh[r.type](t):Jt(tn({},t,{valueSpec:r.type?i[r.type]:r}))}function Sf(t){let e=t.value,r=t.key,i=Ke(t);return i.length||(e.indexOf(\"{fontstack}\")===-1&&i.push(new k(r,e,'\"glyphs\" url must include a \"{fontstack}\" token')),e.indexOf(\"{range}\")===-1&&i.push(new k(r,e,'\"glyphs\" url must include a \"{range}\" token'))),i}function Kt(t,e=D){let r=[];return r=r.concat(qi({key:\"\",value:t,valueSpec:e.$root,styleSpec:e,style:t,validateSpec:qi,objectElementValidators:{glyphs:Sf,\"*\"(){return[]}}})),t.constants&&(r=r.concat(cf({key:\"constants\",value:t.constants,style:t,styleSpec:e,validateSpec:qi}))),Ef(r)}Kt.source=ee(te(xf)),Kt.sprite=ee(te(Df)),Kt.glyphs=ee(te(Sf)),Kt.fontFaces=ee(te(Af)),Kt.light=ee(te(vf)),Kt.sky=ee(te(bf)),Kt.terrain=ee(te(wf)),Kt.state=ee(te(_f)),Kt.layer=ee(te(gf)),Kt.filter=ee(te(kl)),Kt.paintProperty=ee(te(yf)),Kt.layoutProperty=ee(te(mf));function te(t){return function(e){return t(Object.assign({},e,{validateSpec:qi}))}}function Ef(t){return[].concat(t).sort((e,r)=>e.line-r.line)}function ee(t){return function(...e){return Ef(t.apply(this,e))}}var Am={type:\"enum\",\"property-type\":\"data-constant\",expression:{interpolated:!1,parameters:[\"global-state\"]},values:{visible:{},none:{}},transition:!1,default:\"visible\"},Sm=class{constructor(t,e,r){this._rootKey=e,this._globalState=r,this.setValue(t)}evaluate(){return this._literalValue??this._compiledValue.evaluate({})}setValue(t){if(t==null||t===\"visible\"||t===\"none\"){this._literalValue=t===\"none\"?\"none\":\"visible\",this._compiledValue=void 0,this._globalStateRefs=new Set;return}let e=Je(t,this._rootKey,Am,this._globalState);if(e.result===\"error\")throw this._literalValue=\"visible\",this._compiledValue=void 0,Error(e.value.map(r=>`${r.key}: ${r.message}`).join(\", \"));this._literalValue=void 0,this._compiledValue=e.value,this._globalStateRefs=mn(e.value.expression)}getGlobalStateRefs(){return this._globalStateRefs}};function Em(t,e,r){return new Sm(t,e,r)}var Fh=Kt,n5=new Set(Object.keys(D).filter(t=>t.startsWith(\"source_\")).map(t=>t.slice(7).replaceAll(\"_\",\"-\")));function Fm(t,e){let r=!1;for(let i of e){if(i.severity===\"warning\"){Mt(i.message);continue}t.fire(new ha(Error(i.message))),r=!0}return r}function km(t,e,r,i){return i?.validate!==!1&&Fm(t,e({styleSpec:D,...r}))}var io=class Ff{constructor(e,r,i){let n=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;let s=new Int32Array(this.arrayBuffer);e=s[0],r=s[1],i=s[2],this.d=r+2*i;for(let u=0;u<this.d*this.d;u++){let h=s[3+u],c=s[3+u+1];n.push(h===c?null:s.subarray(h,c))}let o=s[3+n.length],l=s[3+n.length+1];this.keys=s.subarray(o,l),this.bboxes=s.subarray(l),this.insert=this._insertReadonly}else{this.d=r+2*i;for(let s=0;s<this.d*this.d;s++)n.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=e,this.padding=i,this.scale=r/e,this.uid=0;let a=i/r*e;this.min=-a,this.max=e+a}insert(e,r,i,n,a){this._forEachCell(r,i,n,a,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(r),this.bboxes.push(i),this.bboxes.push(n),this.bboxes.push(a)}_insertReadonly(){throw Error(\"Cannot insert into a GridIndex created from an ArrayBuffer.\")}_insertCell(e,r,i,n,a,s){this.cells[a].push(s)}query(e,r,i,n,a){let s=this.min,o=this.max;if(e<=s&&r<=s&&o<=i&&o<=n&&!a)return[...this.keys];{let l=[];return this._forEachCell(e,r,i,n,this._queryCell,l,{},a),l}}_queryCell(e,r,i,n,a,s,o,l){let u=this.cells[a];if(u!==null){let h=this.keys,c=this.bboxes;for(let p of u)if(o[p]===void 0){let f=p*4;(l?l(c[f+0],c[f+1],c[f+2],c[f+3]):e<=c[f+2]&&r<=c[f+3]&&i>=c[f+0]&&n>=c[f+1])?(o[p]=!0,s.push(h[p])):o[p]=!1}}}_forEachCell(e,r,i,n,a,s,o,l){let u=this._convertToCellCoord(e),h=this._convertToCellCoord(r),c=this._convertToCellCoord(i),p=this._convertToCellCoord(n);for(let f=u;f<=c;f++)for(let d=h;d<=p;d++){let y=this.d*d+f;if((!l||l(this._convertFromCellCoord(f),this._convertFromCellCoord(d),this._convertFromCellCoord(f+1),this._convertFromCellCoord(d+1)))&&a.call(this,e,r,i,n,y,s,o,l))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,r=3+this.cells.length+1+1,i=0;for(let s of this.cells)i+=s.length;let n=new Int32Array(r+i+this.keys.length+this.bboxes.length);n[0]=this.extent,n[1]=this.n,n[2]=this.padding;let a=r;for(let s=0;s<e.length;s++){let o=e[s];n[3+s]=a,n.set(o,a),a+=o.length}return n[3+e.length]=a,n.set(this.keys,a),a+=this.keys.length,n[3+e.length+1]=a,n.set(this.bboxes,a),a+=this.bboxes.length,n.buffer}static serialize(e,r){let i=e.toArrayBuffer();return r&&r.push(i),{buffer:i}}static deserialize(e){return new Ff(e.buffer)}},Te={};function I(t,e,r={}){if(Te[t])throw Error(`${t} is already registered.`);Object.defineProperty(e,\"_classRegistryKey\",{value:t,writeable:!1}),Te[t]={klass:e,omit:r.omit||[],shallow:r.shallow||[]}}I(\"Object\",Object),I(\"Set\",Set),I(\"TransferableGridIndex\",io),I(\"Color\",gt),I(\"Error\",Error),I(\"AJAXError\",ua),I(\"ResolvedImage\",we),I(\"StylePropertyFunction\",af),I(\"StyleExpression\",Al,{omit:[\"_evaluator\"]}),I(\"ZoomDependentExpression\",ya),I(\"ZoomConstantExpression\",en),I(\"CompoundExpression\",br,{omit:[\"_evaluate\"]});for(let t in Gr)Gr[t]._classRegistryKey||I(`Expression_${t}`,Gr[t]);function kf(t){return t&&typeof ArrayBuffer<\"u\"&&(t instanceof ArrayBuffer||t.constructor?.name===\"ArrayBuffer\")}function Tl(t){let e=t.constructor;return t.$name||e._classRegistryKey}function Tm(t){if(typeof t!=\"object\"||!t)return!1;let e=Tl(t);return e&&e!==\"Object\"}function Tf(t){return!Tm(t)&&(t==null||typeof t==\"boolean\"||typeof t==\"number\"||typeof t==\"string\"||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||t instanceof Blob||t instanceof Error||kf(t)||Sa(t)||ArrayBuffer.isView(t)||t instanceof ImageData)}function ji(t,e){if(Tf(t))return(kf(t)||Sa(t))&&e&&e.push(t),ArrayBuffer.isView(t)&&e&&e.push(t.buffer),t instanceof ImageData&&e&&e.push(t.data.buffer),t;if(Array.isArray(t)){let a=[];for(let s of t)a.push(ji(s,e));return a}if(typeof t!=\"object\")throw Error(`can't serialize object of type ${typeof t}`);let r=Tl(t);if(!r)throw Error(`can't serialize object of unregistered class ${t.constructor.name}`);if(!Te[r])throw Error(`${r} is not registered.`);let{klass:i}=Te[r],n=i.serialize?i.serialize(t,e):{};if(i.serialize){if(n===e?.[e.length-1])throw Error(\"statically serialized object won't survive transfer of $name property\")}else{for(let a in t){if(!t.hasOwnProperty(a)||Te[r].omit.includes(a))continue;let s=t[a];s!==void 0&&(n[a]=Te[r].shallow.includes(a)?s:ji(s,e))}t instanceof Error&&(n.message=t.message)}if(n.$name)throw Error(\"$name property is reserved for worker serialization logic.\");return r!==\"Object\"&&(n.$name=r),n}function Gi(t){if(Tf(t))return t;if(Array.isArray(t))return t.map(Gi);if(typeof t!=\"object\")throw Error(`can't deserialize object of type ${typeof t}`);let e=Tl(t)||\"Object\";if(!Te[e])throw Error(`can't deserialize unregistered class ${e}`);let{klass:r}=Te[e];if(!r)throw Error(`can't deserialize unregistered class ${e}`);if(r.deserialize)return r.deserialize(t);let i=Object.create(r.prototype);for(let n of Object.keys(t)){if(n===\"$name\")continue;let a=t[n];i[n]=Te[e].shallow.includes(n)?a:Gi(a)}return i}var kh=class{constructor(){this.first=!0}update(t,e){let r=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=r,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=r,!0):(this.lastFloorZoom>r?(this.lastIntegerZoom=r+1,this.lastIntegerZoomTime=e):this.lastFloorZoom<r&&(this.lastIntegerZoom=r,this.lastIntegerZoomTime=e),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=r,!0))}},at=class{constructor(t,e){this.zoom=t,e?(this.now=e.now||0,this.fadeDuration=e.fadeDuration||0,this.zoomHistory=e.zoomHistory||new kh,this.transition=e.transition||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new kh,this.transition={})}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let t=this.zoom,e=t-Math.floor(t),r=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:e+(1-e)*r}:{fromScale:.5,toScale:1,t:1-(1-r)*e}}},Im=\"-transition\",$a=class{constructor(t,e,r,i){this.property=t,this.value=e,this.expression=Q0(e===void 0?t.specification.default:e,r,t.specification,i)}isDataDriven(){return this.expression.kind===\"source\"||this.expression.kind===\"composite\"}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(t,e,r){return this.property.possiblyEvaluate(this,t,e,r)}},no=class{constructor(t,e,r){this.property=t,this.value=new $a(t,void 0,e,r)}transitioned(t,e){return new Th(this.property,this.value,e,qt({},t.transition,this.transition),t.now)}untransitioned(){return new Th(this.property,this.value,null,{},0)}},Cm=class{constructor(t,e,r){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues),this._globalState=r,this._rootKey=e}_propertyRootKey(t){return`${this._rootKey}.${String(t)}`}hasProperty(t){return t in this._properties.defaultTransitionablePropertyValues}getValue(t){return Ye(this._values[t].value.value)}setValue(t,e){Object.hasOwn(this._values,t)||(this._values[t]=new no(this._values[t].property,this._propertyRootKey(t),this._globalState)),this._values[t].value=new $a(this._values[t].property,e===null?void 0:Ye(e),this._propertyRootKey(t),this._globalState)}getTransition(t){return Ye(this._values[t].transition)}setTransition(t,e){Object.hasOwn(this._values,t)||(this._values[t]=new no(this._values[t].property,this._propertyRootKey(t),this._globalState)),this._values[t].transition=Ye(e)||void 0}serialize(){let t={};for(let e of Object.keys(this._values)){let r=this.getValue(e);r!==void 0&&(t[e]=r);let i=this.getTransition(e);i!==void 0&&(t[`${e}${Im}`]=i)}return t}transitioned(t,e){let r=new Ih(this._properties);for(let i of Object.keys(this._values))r._values[i]=this._values[i].transitioned(t,e._values[i]);return r}untransitioned(){let t=new Ih(this._properties);for(let e of Object.keys(this._values))t._values[e]=this._values[e].untransitioned();return t}},Th=class{constructor(t,e,r,i,n){this.property=t,this.value=e,this.begin=n+i.delay||0,this.end=this.begin+i.duration||0,t.specification.transition&&(i.delay||i.duration)&&(this.prior=r)}possiblyEvaluate(t,e,r){let i=t.now||0,n=this.value.possiblyEvaluate(t,e,r),a=this.prior;if(!a)return n;if(i>this.end||this.value.isDataDriven())return this.prior=null,n;if(i<this.begin)return a.possiblyEvaluate(t,e,r);{let s=(i-this.begin)/(this.end-this.begin);return this.property.interpolate(a.possiblyEvaluate(t,e,r),n,y1(s))}}},Ih=class{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,e,r){let i=new Na(this._properties);for(let n of Object.keys(this._values))i._values[n]=this._values[n].possiblyEvaluate(t,e,r);return i}hasTransition(){for(let t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}},Mm=class{constructor(t,e,r){this._properties=t,this._values=Object.create(t.defaultPropertyValues),this._globalState=r,this._rootKey=e}_propertyRootKey(t){return`${this._rootKey}.${String(t)}`}hasValue(t){return this._values[t].value!==void 0}hasProperty(t){return t in this._properties.defaultPropertyValues}getValue(t){return Ye(this._values[t].value)}setValue(t,e){this._values[t]=new $a(this._values[t].property,e===null?void 0:Ye(e),this._propertyRootKey(t),this._globalState)}serialize(){let t={};for(let e of Object.keys(this._values)){let r=this.getValue(e);r!==void 0&&(t[e]=r)}return t}possiblyEvaluate(t,e,r){let i=new Na(this._properties);for(let n of Object.keys(this._values))i._values[n]=this._values[n].possiblyEvaluate(t,e,r);return i}},ne=class{constructor(t,e,r){this.property=t,this.value=e,this.parameters=r}isConstant(){return this.value.kind===\"constant\"}constantOr(t){return this.value.kind===\"constant\"?this.value.value:t}evaluate(t,e,r,i){return this.property.evaluate(this.value,this.parameters,t,e,r,i)}},Na=class{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}};function Ch(t){if(Array.isArray(t))return t.length;let e=t?.values;return Array.isArray(e)?e.length:void 0}function If(t,e){let r=Ch(t),i=Ch(e);return r!==void 0&&i!==void 0&&r!==i}var z=class{constructor(t,e){this.specification=t,this.name=e}possiblyEvaluate(t,e){if(t.isDataDriven())throw Error(\"Value should not be data driven\");return t.expression.evaluate(e)}interpolate(t,e,r){if(If(t,e))return Mt(`Property \"${this.name}\" is trying to interpolate arrays of different lengths. Rendering may 'jump'.`),e;let i=this.specification.type,n=dr[i];return n?n(t,e,r):t}},U=class{constructor(t,e,r){this.specification=t,this.name=e,this.overrides=r}possiblyEvaluate(t,e,r,i){return t.expression.kind===\"constant\"||t.expression.kind===\"camera\"?new ne(this,{kind:\"constant\",value:t.expression.evaluate(e,null,{},r,i)},e):new ne(this,t.expression,e)}interpolate(t,e,r){if(t.value.kind!==\"constant\"||e.value.kind!==\"constant\")return t;if(t.value.value===void 0||e.value.value===void 0)return new ne(this,{kind:\"constant\",value:void 0},t.parameters);if(If(t.value.value,e.value.value))return Mt(`Property \"${this.name}\" is trying to interpolate arrays of different lengths. Rendering may 'jump'.`),e;let i=this.specification.type,n=dr[i];if(n){let a=n(t.value.value,e.value.value,r);return new ne(this,{kind:\"constant\",value:a},t.parameters)}return t}evaluate(t,e,r,i,n,a){return t.kind===\"constant\"?t.value:t.evaluate(e,r,i,n,a)}},nn=class extends U{possiblyEvaluate(t,e,r,i){if(t.value===void 0)return new ne(this,{kind:\"constant\",value:void 0},e);if(t.expression.kind===\"constant\"){let n=t.expression.evaluate(e,null,{},r,i),a=t.property.specification.type===\"resolvedImage\"&&typeof n!=\"string\"?n.name:n,s=this._calculate(a,a,a,e);return new ne(this,{kind:\"constant\",value:s},e)}if(t.expression.kind===\"camera\"){let n=this._calculate(t.expression.evaluate({zoom:e.zoom-1}),t.expression.evaluate({zoom:e.zoom}),t.expression.evaluate({zoom:e.zoom+1}),e);return new ne(this,{kind:\"constant\",value:n},e)}return new ne(this,t.expression,e)}evaluate(t,e,r,i,n,a){if(t.kind===\"source\"){let s=t.evaluate(e,r,i,n,a);return this._calculate(s,s,s,e)}return t.kind===\"composite\"?this._calculate(t.evaluate({zoom:Math.floor(e.zoom)-1},r,i),t.evaluate({zoom:Math.floor(e.zoom)},r,i),t.evaluate({zoom:Math.floor(e.zoom)+1},r,i),e):t.value}_calculate(t,e,r,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}}interpolate(t){return t}},Cf=class{constructor(t,e){this.specification=t,this.name=e}possiblyEvaluate(t,e,r,i){if(t.value!==void 0){if(t.expression.kind===\"constant\"){let n=t.expression.evaluate(e,null,{},r,i);return this._calculate(n,n,n,e)}return this._calculate(t.expression.evaluate(new at(Math.floor(e.zoom-1),e)),t.expression.evaluate(new at(Math.floor(e.zoom),e)),t.expression.evaluate(new at(Math.floor(e.zoom+1),e)),e)}}_calculate(t,e,r,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}}interpolate(t){return t}},Ua=class{constructor(t,e){this.specification=t,this.name=e}possiblyEvaluate(t,e,r,i){return!!t.expression.evaluate(e,null,{},r,i)}interpolate(){return!1}},jt=class{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let e in t){let r=t[e];r.specification.overridable&&this.overridableProperties.push(e);let i=this.defaultPropertyValues[e]=new $a(r,void 0,r.name,void 0),n=this.defaultTransitionablePropertyValues[e]=new no(r,r.name,void 0);this.defaultTransitioningPropertyValues[e]=n.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=i.possiblyEvaluate({})}}};I(\"DataDrivenProperty\",U),I(\"DataConstantProperty\",z),I(\"CrossFadedDataDrivenProperty\",nn),I(\"CrossFadedProperty\",Cf),I(\"ColorRampProperty\",Ua);var Mh=\" is a PAINT property not a LAYOUT property. Use get/setPaintProperty instead?\",Ps=\" is a LAYOUT property not a PAINT property. Use get/setLayoutProperty instead?\",pe=class extends k1{constructor(t,e,r){if(super(),this.id=t.id,this.type=t.type,this._globalState=r,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},this._visibilityExpression=Em(this.visibility,`layers[${this.id}].layout.visibility`,r),t.type!==\"custom\"&&(this.metadata=t.metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,t.type!==\"background\"&&(this.source=t.source,this.sourceLayer=t[\"source-layer\"],this.filter=t.filter,this._featureFilter=ii(t.filter,`layers[${this.id}].filter`,r)),e.layout&&(this._unevaluatedLayout=new Mm(e.layout,`layers[${this.id}].layout`,r)),e.paint)){this._transitionablePaint=new Cm(e.paint,`layers[${this.id}].paint`,r);for(let i in t.paint)this.setPaintProperty(i,t.paint[i],{validate:!1});for(let i in t.layout)this.setLayoutProperty(i,t.layout[i],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Na(e.paint)}}setFilter(t){this.filter=t,this._featureFilter=ii(t,`layers[${this.id}].filter`,this._globalState)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){if(t===\"visibility\")return this.visibility;if(this._transitionablePaint?.hasProperty(t))throw Error(t+Mh);if(!this._unevaluatedLayout)throw Error(`Cannot get layout property \"${t}\" on layer type \"${this.type}\" which has no layout properties.`);return this._unevaluatedLayout.getValue(t)}getLayoutAffectingGlobalStateRefs(){let t=new Set;for(let e of this._visibilityExpression.getGlobalStateRefs())t.add(e);if(this._unevaluatedLayout)for(let e in this._unevaluatedLayout._values){let r=this._unevaluatedLayout._values[e];for(let i of r.getGlobalStateRefs())t.add(i)}for(let e of this._featureFilter.getGlobalStateRefs())t.add(e);return t}getPaintAffectingGlobalStateRefs(){let t=new globalThis.Map;if(this._transitionablePaint)for(let e in this._transitionablePaint._values){let r=this._transitionablePaint._values[e].value;for(let i of r.getGlobalStateRefs()){let n=t.get(i)??[];n.push({name:e,value:r.value}),t.set(i,n)}}return t}getVisibilityAffectingGlobalStateRefs(){return this._visibilityExpression.getGlobalStateRefs()}setLayoutProperty(t,e,r={}){if(t===\"visibility\"){this.visibility=e,this._visibilityExpression.setValue(e),this.recalculateVisibility();return}if(this._transitionablePaint?.hasProperty(t)){this.fire(new ha(Error(t+Mh)));return}e!=null&&this._validate(Fh.layoutProperty,`layers.${this.id}.layout.${t}`,t,e,r)||this._unevaluatedLayout.setValue(t,e)}getPaintProperty(t){if(t.endsWith(\"-transition\")){let e=t.slice(0,-11);if(e===\"visibility\"||this._unevaluatedLayout?.hasProperty(e))throw Error(t+Ps);return this._transitionablePaint.getTransition(e)}if(t===\"visibility\"||this._unevaluatedLayout?.hasProperty(t))throw Error(t+Ps);return this._transitionablePaint.getValue(t)}setPaintProperty(t,e,r={}){if(t===\"visibility\"||this._unevaluatedLayout?.hasProperty(t))return this.fire(new ha(Error(t+Ps))),!1;if(e!=null&&this._validate(Fh.paintProperty,`layers.${this.id}.paint.${t}`,t,e,r))return!1;if(t.endsWith(\"-transition\"))return this._transitionablePaint.setTransition(t.slice(0,-11),e||void 0),!1;{let i=this._transitionablePaint._values[t],n=i.property.specification[\"property-type\"]===\"cross-faded-data-driven\",a=i.value.isDataDriven(),s=i.value;this._transitionablePaint.setValue(t,e),this._handleSpecialPaintPropertyUpdate(t);let o=this._transitionablePaint._values[t].value;return o.isDataDriven()||a||n||this._handleOverridablePaintPropertyUpdate(t,s,o)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,e,r){return!1}isHidden(t=this.minzoom,e=!1){return this.minzoom&&t<(e?Math.floor(this.minzoom):this.minzoom)||this.maxzoom&&t>=this.maxzoom?!0:this._evaluatedVisibility===\"none\"}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculateVisibility(){this._evaluatedVisibility=this._visibilityExpression.evaluate()}recalculate(t,e){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,e)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,e)}serialize(){let t={id:this.id,type:this.type,source:this.source,\"source-layer\":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout?.serialize(),paint:this._transitionablePaint?.serialize()};return this.visibility&&(t.layout||(t.layout={}),t.layout.visibility=this.visibility),v1(t,(e,r)=>e!==void 0&&!(r===\"layout\"&&!Object.keys(e).length)&&!(r===\"paint\"&&!Object.keys(e).length))}_validate(t,e,r,i,n={}){return km(this,t,{key:e,layerType:this.type,objectKey:r,value:i},n)}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let t in this.paint._values){let e=this.paint.get(t);if(e instanceof ne&&ei(e.property.specification)&&(e.value.kind===\"source\"||e.value.kind===\"composite\")&&e.value.isStateDependent)return!0}return!1}},Bm,Pm=()=>Bm||(Bm=new jt({\"raster-opacity\":new z(D.paint_raster[\"raster-opacity\"],\"raster-opacity\"),\"raster-hue-rotate\":new z(D.paint_raster[\"raster-hue-rotate\"],\"raster-hue-rotate\"),\"raster-brightness-min\":new z(D.paint_raster[\"raster-brightness-min\"],\"raster-brightness-min\"),\"raster-brightness-max\":new z(D.paint_raster[\"raster-brightness-max\"],\"raster-brightness-max\"),\"raster-saturation\":new z(D.paint_raster[\"raster-saturation\"],\"raster-saturation\"),\"raster-contrast\":new z(D.paint_raster[\"raster-contrast\"],\"raster-contrast\"),resampling:new z(D.paint_raster.resampling,\"resampling\"),\"raster-resampling\":new z(D.paint_raster[\"raster-resampling\"],\"raster-resampling\"),\"raster-fade-duration\":new z(D.paint_raster[\"raster-fade-duration\"],\"raster-fade-duration\")})),zm={get paint(){return Pm()}};var Lm=class extends pe{constructor(t,e){super(t,zm,e)}},Vm={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},gn=class{constructor(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}},xt=class{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){let e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(this.capacity*5),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}}_refreshViews(){throw Error(\"_refreshViews() must be implemented by each concrete StructArray layout\")}freeBufferAfterUpload(){this.arrayBuffer=new ArrayBuffer(0),this._refreshViews()}};function At(t,e=1){let r=0,i=0;return{members:t.map(n=>{let a=Om(n.type),s=r=Bh(r,Math.max(e,a)),o=n.components||1;return i=Math.max(i,a),r+=a*o,{name:n.name,type:n.type,components:o,offset:s}}),size:Bh(r,Math.max(i,e)),alignment:e}}function Om(t){return Vm[t].BYTES_PER_ELEMENT}function Bh(t,e){return Math.ceil(t/e)*e}var an=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e){let r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){let i=t*2;return this.int16[i+0]=e,this.int16[i+1]=r,t}};an.prototype.bytesPerElement=4,I(\"StructArrayLayout2i4\",an);var ao=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r){let i=this.length;return this.resize(i+1),this.emplace(i,t,e,r)}emplace(t,e,r,i){let n=t*3;return this.int16[n+0]=e,this.int16[n+1]=r,this.int16[n+2]=i,t}};ao.prototype.bytesPerElement=6,I(\"StructArrayLayout3i6\",ao);var Ph=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,i){let n=this.length;return this.resize(n+1),this.emplace(n,t,e,r,i)}emplace(t,e,r,i,n){let a=t*4;return this.int16[a+0]=e,this.int16[a+1]=r,this.int16[a+2]=i,this.int16[a+3]=n,t}};Ph.prototype.bytesPerElement=8,I(\"StructArrayLayout4i8\",Ph);var so=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a){let s=this.length;return this.resize(s+1),this.emplace(s,t,e,r,i,n,a)}emplace(t,e,r,i,n,a,s){let o=t*6;return this.int16[o+0]=e,this.int16[o+1]=r,this.int16[o+2]=i,this.int16[o+3]=n,this.int16[o+4]=a,this.int16[o+5]=s,t}};so.prototype.bytesPerElement=12,I(\"StructArrayLayout2i4i12\",so);var oo=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a){let s=this.length;return this.resize(s+1),this.emplace(s,t,e,r,i,n,a)}emplace(t,e,r,i,n,a,s){let o=t*4,l=t*8;return this.int16[o+0]=e,this.int16[o+1]=r,this.uint8[l+4]=i,this.uint8[l+5]=n,this.uint8[l+6]=a,this.uint8[l+7]=s,t}};oo.prototype.bytesPerElement=8,I(\"StructArrayLayout2i4ub8\",oo);var sn=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e){let r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){let i=t*2;return this.float32[i+0]=e,this.float32[i+1]=r,t}};sn.prototype.bytesPerElement=8,I(\"StructArrayLayout2f8\",sn);var lo=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a,s,o,l,u){let h=this.length;return this.resize(h+1),this.emplace(h,t,e,r,i,n,a,s,o,l,u)}emplace(t,e,r,i,n,a,s,o,l,u,h){let c=t*10;return this.uint16[c+0]=e,this.uint16[c+1]=r,this.uint16[c+2]=i,this.uint16[c+3]=n,this.uint16[c+4]=a,this.uint16[c+5]=s,this.uint16[c+6]=o,this.uint16[c+7]=l,this.uint16[c+8]=u,this.uint16[c+9]=h,t}};lo.prototype.bytesPerElement=20,I(\"StructArrayLayout10ui20\",lo);var uo=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a,s,o){let l=this.length;return this.resize(l+1),this.emplace(l,t,e,r,i,n,a,s,o)}emplace(t,e,r,i,n,a,s,o,l){let u=t*8;return this.uint16[u+0]=e,this.uint16[u+1]=r,this.uint16[u+2]=i,this.uint16[u+3]=n,this.uint16[u+4]=a,this.uint16[u+5]=s,this.uint16[u+6]=o,this.uint16[u+7]=l,t}};uo.prototype.bytesPerElement=16,I(\"StructArrayLayout8ui16\",uo);var ho=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a,s,o,l,u,h,c,p){let f=this.length;return this.resize(f+1),this.emplace(f,t,e,r,i,n,a,s,o,l,u,h,c,p)}emplace(t,e,r,i,n,a,s,o,l,u,h,c,p,f){let d=t*14,y=t*7;return this.int16[d+0]=e,this.int16[d+1]=r,this.int16[d+2]=i,this.int16[d+3]=n,this.uint16[d+4]=a,this.uint16[d+5]=s,this.uint16[d+6]=o,this.uint16[d+7]=l,this.int16[d+8]=u,this.int16[d+9]=h,this.int16[d+10]=c,this.int16[d+11]=p,this.float32[y+6]=f,t}};ho.prototype.bytesPerElement=28,I(\"StructArrayLayout4i4ui4i1f28\",ho);var co=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r){let i=this.length;return this.resize(i+1),this.emplace(i,t,e,r)}emplace(t,e,r,i){let n=t*3;return this.float32[n+0]=e,this.float32[n+1]=r,this.float32[n+2]=i,t}};co.prototype.bytesPerElement=12,I(\"StructArrayLayout3f12\",co);var po=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){let e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){let r=t*1;return this.uint32[r+0]=e,t}};po.prototype.bytesPerElement=4,I(\"StructArrayLayout1ul4\",po);var fo=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a,s,o,l){let u=this.length;return this.resize(u+1),this.emplace(u,t,e,r,i,n,a,s,o,l)}emplace(t,e,r,i,n,a,s,o,l,u){let h=t*10,c=t*5;return this.int16[h+0]=e,this.int16[h+1]=r,this.int16[h+2]=i,this.int16[h+3]=n,this.int16[h+4]=a,this.int16[h+5]=s,this.uint32[c+3]=o,this.uint16[h+8]=l,this.uint16[h+9]=u,t}};fo.prototype.bytesPerElement=20,I(\"StructArrayLayout6i1ul2ui20\",fo);var yo=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a){let s=this.length;return this.resize(s+1),this.emplace(s,t,e,r,i,n,a)}emplace(t,e,r,i,n,a,s){let o=t*6;return this.int16[o+0]=e,this.int16[o+1]=r,this.int16[o+2]=i,this.int16[o+3]=n,this.int16[o+4]=a,this.int16[o+5]=s,t}};yo.prototype.bytesPerElement=12,I(\"StructArrayLayout2i2i2i12\",yo);var zh=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n){let a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,i,n)}emplace(t,e,r,i,n,a){let s=t*4,o=t*8;return this.float32[s+0]=e,this.float32[s+1]=r,this.float32[s+2]=i,this.int16[o+6]=n,this.int16[o+7]=a,t}};zh.prototype.bytesPerElement=16,I(\"StructArrayLayout2f1f2i16\",zh);var mo=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a){let s=this.length;return this.resize(s+1),this.emplace(s,t,e,r,i,n,a)}emplace(t,e,r,i,n,a,s){let o=t*16,l=t*4,u=t*8;return this.uint8[o+0]=e,this.uint8[o+1]=r,this.float32[l+1]=i,this.float32[l+2]=n,this.int16[u+6]=a,this.int16[u+7]=s,t}};mo.prototype.bytesPerElement=16,I(\"StructArrayLayout2ub2f2i16\",mo);var go=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r){let i=this.length;return this.resize(i+1),this.emplace(i,t,e,r)}emplace(t,e,r,i){let n=t*3;return this.uint16[n+0]=e,this.uint16[n+1]=r,this.uint16[n+2]=i,t}};go.prototype.bytesPerElement=6,I(\"StructArrayLayout3ui6\",go);var xo=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a,s,o,l,u,h,c,p,f,d,y,m,g){let x=this.length;return this.resize(x+1),this.emplace(x,t,e,r,i,n,a,s,o,l,u,h,c,p,f,d,y,m,g)}emplace(t,e,r,i,n,a,s,o,l,u,h,c,p,f,d,y,m,g,x){let b=t*26,v=t*13,w=t*52;return this.int16[b+0]=e,this.int16[b+1]=r,this.uint16[b+2]=i,this.uint16[b+3]=n,this.uint32[v+2]=a,this.uint32[v+3]=s,this.uint32[v+4]=o,this.uint16[b+10]=l,this.uint16[b+11]=u,this.uint16[b+12]=h,this.float32[v+7]=c,this.float32[v+8]=p,this.uint8[w+36]=f,this.uint8[w+37]=d,this.uint8[w+38]=y,this.uint32[v+10]=m,this.int16[b+22]=g,this.float32[v+12]=x,t}};xo.prototype.bytesPerElement=52,I(\"StructArrayLayout2i2ui3ul3ui2f3ub1ul1i1f52\",xo);var vo=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a,s,o,l,u,h,c,p,f,d,y,m,g,x,b,v,w,_,A,S,F,L,O,P){let R=this.length;return this.resize(R+1),this.emplace(R,t,e,r,i,n,a,s,o,l,u,h,c,p,f,d,y,m,g,x,b,v,w,_,A,S,F,L,O,P)}emplace(t,e,r,i,n,a,s,o,l,u,h,c,p,f,d,y,m,g,x,b,v,w,_,A,S,F,L,O,P,R){let E=t*34,$=t*17;return this.int16[E+0]=e,this.int16[E+1]=r,this.int16[E+2]=i,this.int16[E+3]=n,this.int16[E+4]=a,this.int16[E+5]=s,this.int16[E+6]=o,this.int16[E+7]=l,this.uint16[E+8]=u,this.uint16[E+9]=h,this.uint16[E+10]=c,this.uint16[E+11]=p,this.uint16[E+12]=f,this.uint16[E+13]=d,this.uint16[E+14]=y,this.uint16[E+15]=m,this.uint16[E+16]=g,this.uint16[E+17]=x,this.uint16[E+18]=b,this.uint16[E+19]=v,this.uint16[E+20]=w,this.uint16[E+21]=_,this.uint16[E+22]=A,this.uint32[$+12]=S,this.float32[$+13]=F,this.float32[$+14]=L,this.uint16[E+30]=O,this.uint16[E+31]=P,this.float32[$+16]=R,t}};vo.prototype.bytesPerElement=68,I(\"StructArrayLayout8i15ui1ul2f2ui1f68\",vo);var ga=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){let e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){let r=t*1;return this.float32[r+0]=e,t}};ga.prototype.bytesPerElement=4,I(\"StructArrayLayout1f4\",ga);var bo=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r){let i=this.length;return this.resize(i+1),this.emplace(i,t,e,r)}emplace(t,e,r,i){let n=t*6,a=t*3;return this.uint16[n+0]=e,this.float32[a+1]=r,this.float32[a+2]=i,t}};bo.prototype.bytesPerElement=12,I(\"StructArrayLayout1ui2f12\",bo);var wo=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r){let i=this.length;return this.resize(i+1),this.emplace(i,t,e,r)}emplace(t,e,r,i){let n=t*2,a=t*4;return this.uint32[n+0]=e,this.uint16[a+2]=r,this.uint16[a+3]=i,t}};wo.prototype.bytesPerElement=8,I(\"StructArrayLayout1ul2ui8\",wo);var Do=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e){let r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){let i=t*2;return this.uint16[i+0]=e,this.uint16[i+1]=r,t}};Do.prototype.bytesPerElement=4,I(\"StructArrayLayout2ui4\",Do);var Lh=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){let e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){let r=t*1;return this.uint16[r+0]=e,t}};Lh.prototype.bytesPerElement=2,I(\"StructArrayLayout1ui2\",Lh);var _o=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,i){let n=this.length;return this.resize(n+1),this.emplace(n,t,e,r,i)}emplace(t,e,r,i,n){let a=t*4;return this.float32[a+0]=e,this.float32[a+1]=r,this.float32[a+2]=i,this.float32[a+3]=n,t}};_o.prototype.bytesPerElement=16,I(\"StructArrayLayout4f16\",_o);var Mf=class extends gn{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new B(this.anchorPointX,this.anchorPointY)}};Mf.prototype.size=20;var Il=class extends fo{get(t){return new Mf(this,t)}};I(\"CollisionBoxArray\",Il);var Bf=class extends gn{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(t){this._structArray.uint8[this._pos1+37]=t}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(t){this._structArray.uint8[this._pos1+38]=t}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(t){this._structArray.uint32[this._pos4+10]=t}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}get heightOffset(){return this._structArray.float32[this._pos4+12]}};Bf.prototype.size=52;var Pf=class extends xo{get(t){return new Bf(this,t)}};I(\"PlacedSymbolArray\",Pf);var zf=class extends gn{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(t){this._structArray.uint32[this._pos4+12]=t}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}get heightOffset(){return this._structArray.float32[this._pos4+16]}};zf.prototype.size=68;var Lf=class extends vo{get(t){return new zf(this,t)}};I(\"SymbolInstanceArray\",Lf);var Vf=class extends ga{getoffsetX(t){return this.float32[t*1+0]}};I(\"GlyphOffsetArray\",Vf);var Of=class extends ao{getx(t){return this.int16[t*3+0]}gety(t){return this.int16[t*3+1]}gettileUnitDistanceFromAnchor(t){return this.int16[t*3+2]}};I(\"SymbolLineVertexArray\",Of);var Rf=class extends gn{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]}};Rf.prototype.size=12;var $f=class extends bo{get(t){return new Rf(this,t)}};I(\"TextAnchorOffsetArray\",$f);var Nf=class extends gn{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]}};Nf.prototype.size=8;var Uf=class extends wo{get(t){return new Nf(this,t)}};I(\"FeatureIndexArray\",Uf);var Rm=class extends an{};var $m=class extends an{},Nm=class extends an{},Um=class extends so{},qm=class extends oo{},jm=class extends sn{},zr=class extends lo{},Vh=class extends uo{},Gm=class extends ho{},Xm=class extends co{},Ym=class extends po{},Oh=class extends yo{};var Wm=class extends mo{};var xn=class extends go{},Ao=class extends Do{};var So=At([{name:\"a_pos\",components:2,type:\"Int16\"}],4),Zm=So.members;So.size,So.alignment;var Qt=class $r{constructor(e=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=e}prepareSegment(e,r,i,n){let a=this.segments[this.segments.length-1];return e>$r.MAX_VERTEX_ARRAY_LENGTH&&Mt(`Max vertices per segment is ${$r.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}. Consider using the \\`fillLargeMeshArrays\\` function if you require meshes with more than ${$r.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!a||a.vertexLength+e>$r.MAX_VERTEX_ARRAY_LENGTH||a.sortKey!==n?this.createNewSegment(r,i,n):a}createNewSegment(e,r,i){let n={vertexOffset:e.length,primitiveOffset:r.length,vertexLength:0,primitiveLength:0,vaos:{}};return i!==void 0&&(n.sortKey=i),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(n),n}getOrCreateLatestSegment(e,r,i){return this.prepareSegment(0,e,r,i)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(let e of this.segments)for(let r in e.vaos)e.vaos[r].destroy()}static simpleSegment(e,r,i,n){return new $r([{vertexOffset:e,primitiveOffset:r,vertexLength:i,primitiveLength:n,vaos:{},sortKey:0}])}};Qt.MAX_VERTEX_ARRAY_LENGTH=2**16-1,I(\"SegmentVector\",Qt);function Rh(t,e){return t=Zi(Math.floor(t),0,255),e=Zi(Math.floor(e),0,255),256*t+e}var Hm=At([{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\"}]),Km=At([{name:\"a_dasharray_from\",components:4,type:\"Uint16\"},{name:\"a_dasharray_to\",components:4,type:\"Uint16\"}]),Jm=ol(((t,e)=>{function r(i,n){for(var a=i.length&3,s=i.length-a,o=n,l,u=3432918353,h=461845907,c,p=0;p<s;)c=i.charCodeAt(p)&255|(i.charCodeAt(++p)&255)<<8|(i.charCodeAt(++p)&255)<<16|(i.charCodeAt(++p)&255)<<24,++p,c=(c&65535)*u+(((c>>>16)*u&65535)<<16)&4294967295,c=c<<15|c>>>17,c=(c&65535)*h+(((c>>>16)*h&65535)<<16)&4294967295,o^=c,o=o<<13|o>>>19,l=(o&65535)*5+(((o>>>16)*5&65535)<<16)&4294967295,o=(l&65535)+27492+(((l>>>16)+58964&65535)<<16);switch(c=0,a){case 3:c^=(i.charCodeAt(p+2)&255)<<16;case 2:c^=(i.charCodeAt(p+1)&255)<<8;case 1:c^=i.charCodeAt(p)&255,c=(c&65535)*u+(((c>>>16)*u&65535)<<16)&4294967295,c=c<<15|c>>>17,c=(c&65535)*h+(((c>>>16)*h&65535)<<16)&4294967295,o^=c}return o^=i.length,o^=o>>>16,o=(o&65535)*2246822507+(((o>>>16)*2246822507&65535)<<16)&4294967295,o^=o>>>13,o=(o&65535)*3266489909+(((o>>>16)*3266489909&65535)<<16)&4294967295,o^=o>>>16,o>>>0}e!==void 0&&(e.exports=r)})),Qm=ol(((t,e)=>{function r(i,n){for(var a=i.length,s=n^a,o=0,l;a>=4;)l=i.charCodeAt(o)&255|(i.charCodeAt(++o)&255)<<8|(i.charCodeAt(++o)&255)<<16|(i.charCodeAt(++o)&255)<<24,l=(l&65535)*1540483477+(((l>>>16)*1540483477&65535)<<16),l^=l>>>24,l=(l&65535)*1540483477+(((l>>>16)*1540483477&65535)<<16),s=(s&65535)*1540483477+(((s>>>16)*1540483477&65535)<<16)^l,a-=4,++o;switch(a){case 3:s^=(i.charCodeAt(o+2)&255)<<16;case 2:s^=(i.charCodeAt(o+1)&255)<<8;case 1:s^=i.charCodeAt(o)&255,s=(s&65535)*1540483477+(((s>>>16)*1540483477&65535)<<16)}return s^=s>>>13,s=(s&65535)*1540483477+(((s>>>16)*1540483477&65535)<<16),s^=s>>>15,s>>>0}e.exports=r})),Eo=t1(ol(((t,e)=>{var r=Jm(),i=Qm();e.exports=r,e.exports.murmur3=r,e.exports.murmur2=i}))(),1),qf=class jf{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,i,n){this.ids.push($h(e)),this.positions.push(r,i,n)}getPositions(e){if(!this.indexed)throw Error(\"Trying to get index, but feature positions are not indexed\");let r=$h(e),i=0,n=this.ids.length-1;for(;i<n;){let s=i+n>>1;this.ids[s]>=r?n=s:i=s+1}let a=[];for(;this.ids[i]===r;){let s=this.positions[3*i],o=this.positions[3*i+1],l=this.positions[3*i+2];a.push({index:s,start:o,end:l}),i++}return a}static serialize(e,r){let i=new Float64Array(e.ids),n=new Uint32Array(e.positions);return Fo(i,n,0,i.length-1),r&&r.push(i.buffer,n.buffer),{ids:i,positions:n}}static deserialize(e){let r=new jf;return r.ids=e.ids,r.positions=e.positions,r.indexed=!0,r}};function $h(t){let e=+t;return!isNaN(e)&&e<=2**53-1?e:(0,Eo.default)(String(t))}function Fo(t,e,r,i){for(;r<i;){let n=t[r+i>>1],a=r-1,s=i+1;for(;;){do a++;while(t[a]<n);do s--;while(t[s]>n);if(a>=s)break;qn(t,a,s),qn(e,3*a,3*s),qn(e,3*a+1,3*s+1),qn(e,3*a+2,3*s+2)}s-r<i-s?(Fo(t,e,r,s),r=s+1):(Fo(t,e,s+1,i),i=s)}}function qn(t,e,r){let i=t[e];t[e]=t[r],t[r]=i}I(\"FeaturePositionMap\",qf);var Cl=class{constructor(t,e){this.gl=t.gl,this.location=e}};var Ml=class extends Cl{constructor(t,e){super(t,e),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}};var tg=class extends Cl{constructor(t,e){super(t,e),this.current=[0,0,0,0]}set(t){(t[0]!==this.current[0]||t[1]!==this.current[1]||t[2]!==this.current[2]||t[3]!==this.current[3])&&(this.current=t,this.gl.uniform4f(this.location,t[0],t[1],t[2],t[3]))}},eg=class extends Cl{constructor(t,e){super(t,e),this.current=gt.transparent}set(t){(t.r!==this.current.r||t.g!==this.current.g||t.b!==this.current.b||t.a!==this.current.a)&&(this.current=t,this.gl.uniform4f(this.location,t.r,t.g,t.b,t.a))}};var a5=new Float32Array(16);function ko(t){return[Rh(255*t.r,255*t.g),Rh(255*t.b,255*t.a)]}var Vi=class{constructor(t,e,r){this.value=t,this.uniformNames=e.map(i=>`u_${i}`),this.type=r}setUniform(t,e,r){t.set(r.constantOr(this.value))}getBinding(t,e,r){return this.type===\"color\"?new eg(t,e):new Ml(t,e)}},sr=class{constructor(t,e){this.uniformNames=e.map(r=>`u_${r}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,e){this.pixelRatioFrom=e.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=e.tlbr,this.patternTo=t.tlbr}setConstantDashPositions(t,e){this.dashTo=[0,t.y,t.height,t.width],this.dashFrom=[0,e.y,e.height,e.width]}setUniform(t,e,r,i){let n=null;i===\"u_pattern_to\"?n=this.patternTo:i===\"u_pattern_from\"?n=this.patternFrom:i===\"u_dasharray_to\"?n=this.dashTo:i===\"u_dasharray_from\"?n=this.dashFrom:i===\"u_pixel_ratio_to\"?n=this.pixelRatioTo:i===\"u_pixel_ratio_from\"&&(n=this.pixelRatioFrom),n!==null&&t.set(n)}getBinding(t,e,r){return r.startsWith(\"u_pattern\")||r.startsWith(\"u_dasharray_\")?new tg(t,e):new Ml(t,e)}},Ee=class{constructor(t,e,r,i){this.expression=t,this.type=r,this.maxValue=0,this.paintVertexAttributes=e.map(n=>({name:`a_${n}`,type:\"Float32\",components:r===\"color\"?2:1,offset:0})),this.paintVertexArray=new i}populatePaintArray(t,e,r){let i=this.paintVertexArray.length,n=this.expression.evaluate(new at(0,r),e,{},r.canonical,[],r.formattedSection);this.paintVertexArray.resize(t),this._setPaintValue(i,t,n)}updatePaintArray(t,e,r,i,n){let a=this.expression.evaluate(new at(0,n),r,i);this._setPaintValue(t,e,a)}_setPaintValue(t,e,r){if(this.type===\"color\"){let i=ko(r);for(let n=t;n<e;n++)this.paintVertexArray.emplace(n,i[0],i[1])}else{for(let i=t;i<e;i++)this.paintVertexArray.emplace(i,r);this.maxValue=Math.max(this.maxValue,Math.abs(r))}}upload(t){this.paintVertexArray?.arrayBuffer.byteLength&&(this.paintVertexBuffer?.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}},le=class{constructor(t,e,r,i,n,a){this.expression=t,this.uniformNames=e.map(s=>`u_${s}_t`),this.type=r,this.useIntegerZoom=i,this.zoom=n,this.maxValue=0,this.paintVertexAttributes=e.map(s=>({name:`a_${s}`,type:\"Float32\",components:r===\"color\"?4:2,offset:0})),this.paintVertexArray=new a}populatePaintArray(t,e,r){let i=this.expression.evaluate(new at(this.zoom,r),e,{},r.canonical,[],r.formattedSection),n=this.expression.evaluate(new at(this.zoom+1,r),e,{},r.canonical,[],r.formattedSection),a=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(a,t,i,n)}updatePaintArray(t,e,r,i,n){let a=this.expression.evaluate(new at(this.zoom,n),r,i),s=this.expression.evaluate(new at(this.zoom+1,n),r,i);this._setPaintValue(t,e,a,s)}_setPaintValue(t,e,r,i){if(this.type===\"color\"){let n=ko(r),a=ko(i);for(let s=t;s<e;s++)this.paintVertexArray.emplace(s,n[0],n[1],a[0],a[1])}else{for(let n=t;n<e;n++)this.paintVertexArray.emplace(n,r,i);this.maxValue=Math.max(this.maxValue,Math.abs(r),Math.abs(i))}}upload(t){this.paintVertexArray?.arrayBuffer.byteLength&&(this.paintVertexBuffer?.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(t,e){let r=this.useIntegerZoom?Math.floor(e.zoom):e.zoom,i=Zi(this.expression.interpolationFactor(r,this.zoom,this.zoom+1),0,1);t.set(i)}getBinding(t,e,r){return new Ml(t,e)}},je=class{constructor(t,e,r,i,n,a){this.expression=t,this.type=e,this.useIntegerZoom=r,this.zoom=i,this.layerId=a,this.zoomInPaintVertexArray=new n,this.zoomOutPaintVertexArray=new n}populatePaintArray(t,e,r){let i=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(i,t,this.getPositionIds(e),r)}updatePaintArray(t,e,r,i,n){this._setPaintValues(t,e,this.getPositionIds(r),n)}_setPaintValues(t,e,r,i){let n=this.getPositions(i);if(!n||!r)return;let a=n[r.min],s=n[r.mid],o=n[r.max];if(a&&s&&o)for(let l=t;l<e;l++)this.emplace(this.zoomInPaintVertexArray,l,a,s),this.emplace(this.zoomOutPaintVertexArray,l,o,s)}upload(t){if(this.zoomInPaintVertexArray?.arrayBuffer.byteLength&&this.zoomOutPaintVertexArray?.arrayBuffer.byteLength){let e=this.getVertexAttributes();this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,e,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,e,this.expression.isStateDependent)}}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}},Gf=class extends je{getPositions(t){return t.imagePositions}getPositionIds(t){return t.patterns?.[this.layerId]}getVertexAttributes(){return Hm.members}emplace(t,e,r,i){t.emplace(e,r.tlbr[0],r.tlbr[1],r.tlbr[2],r.tlbr[3],i.tlbr[0],i.tlbr[1],i.tlbr[2],i.tlbr[3],r.pixelRatio,i.pixelRatio)}},Xf=class extends je{getPositions(t){return t.dashPositions}getPositionIds(t){return t.dashes?.[this.layerId]}getVertexAttributes(){return Km.members}emplace(t,e,r,i){t.emplace(e,0,r.y,r.height,r.width,0,i.y,i.height,i.width)}},Yf=class{constructor(t,e,r){this.binders={},this._buffers=[];let i=[];for(let n in t.paint._values){if(!r(n))continue;let a=t.paint.get(n);if(!(a instanceof ne)||!ei(a.property.specification))continue;let s=rg(n,t.type),o=a.value,l=a.property.specification.type,u=a.property.useIntegerZoom,h=a.property.specification[\"property-type\"],c=h===\"cross-faded\"||h===\"cross-faded-data-driven\";if(o.kind===\"constant\")this.binders[n]=c?new sr(o.value,s):new Vi(o.value,s,l),i.push(`/u_${n}`);else if(o.kind===\"source\"||c){let p=Nh(n,l,\"source\");this.binders[n]=c?n===\"line-dasharray\"?new Xf(o,l,u,e,p,t.id):new Gf(o,l,u,e,p,t.id):new Ee(o,s,l,p),i.push(`/a_${n}`)}else{let p=Nh(n,l,\"composite\");this.binders[n]=new le(o,s,l,u,e,p),i.push(`/z_${n}`)}}this.cacheKey=i.sort().join(\"\")}getMaxValue(t){let e=this.binders[t];return e instanceof Ee||e instanceof le?e.maxValue:0}populatePaintArrays(t,e,r){for(let i in this.binders){let n=this.binders[i];(n instanceof Ee||n instanceof le||n instanceof je)&&n.populatePaintArray(t,e,r)}}setConstantPatternPositions(t,e){for(let r in this.binders){let i=this.binders[r];i instanceof sr&&i.setConstantPatternPositions(t,e)}}setConstantDashPositions(t,e){for(let r in this.binders){let i=this.binders[r];i instanceof sr&&i.setConstantDashPositions(t,e)}}updatePaintArrays(t,e,r,i,n){let a=!1;for(let s of t){let o=e.getPositions(s.id);for(let l of o){let u=r.feature(l.index);for(let h in this.binders){let c=this.binders[h];(c instanceof Ee||c instanceof le||c instanceof je)&&c.expression.isStateDependent===!0&&(c.expression=i.paint.get(h).value,c.updatePaintArray(l.start,l.end,u,s.state,n),a=!0)}}}return a}defines(){let t=[];for(let e in this.binders){let r=this.binders[e];(r instanceof Vi||r instanceof sr)&&t.push(...r.uniformNames.map(i=>`#define HAS_UNIFORM_${i}`))}return t}getBinderAttributes(){let t=[];for(let e in this.binders){let r=this.binders[e];if(r instanceof Ee||r instanceof le)for(let i of r.paintVertexAttributes)t.push(i.name);else if(r instanceof je){let i=r.getVertexAttributes();for(let n of i)t.push(n.name)}}return t}getBinderUniforms(){let t=[];for(let e in this.binders){let r=this.binders[e];if(r instanceof Vi||r instanceof sr||r instanceof le)for(let i of r.uniformNames)t.push(i)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,e){let r=[];for(let i in this.binders){let n=this.binders[i];if(n instanceof Vi||n instanceof sr||n instanceof le){for(let a of n.uniformNames)if(e[a]){let s=n.getBinding(t,e[a],a);r.push({name:a,property:i,binding:s})}}}return r}setUniforms(t,e,r,i){for(let{name:n,property:a,binding:s}of e)this.binders[a].setUniform(s,i,r.get(a),n)}updatePaintBuffers(t){this._buffers=[];for(let e in this.binders){let r=this.binders[e];if(t&&r instanceof je){let i=t.fromScale===2?r.zoomInPaintVertexBuffer:r.zoomOutPaintVertexBuffer;i&&this._buffers.push(i)}else(r instanceof Ee||r instanceof le)&&r.paintVertexBuffer&&this._buffers.push(r.paintVertexBuffer)}}upload(t){for(let e in this.binders){let r=this.binders[e];(r instanceof Ee||r instanceof le||r instanceof je)&&r.upload(t)}this.updatePaintBuffers()}destroy(){for(let t in this.binders){let e=this.binders[t];(e instanceof Ee||e instanceof le||e instanceof je)&&e.destroy()}}},mr=class{constructor(t,e,r=()=>!0){this.programConfigurations={};for(let i of t)this.programConfigurations[i.id]=new Yf(i,e,r);this.needsUpload=!1,this._featureMap=new qf,this._bufferOffset=0}populatePaintArrays(t,e,r,i){for(let n in this.programConfigurations)this.programConfigurations[n].populatePaintArrays(t,e,i);e.id!==void 0&&this._featureMap.add(e.id,r,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,e,r,i){for(let n of r)this.needsUpload=this.programConfigurations[n.id].updatePaintArrays(t,this._featureMap,e,n,i)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(let e in this.programConfigurations)this.programConfigurations[e].upload(t);this.needsUpload=!1}}destroy(){for(let t in this.programConfigurations)this.programConfigurations[t].destroy()}};function rg(t,e){return{\"text-opacity\":[\"opacity\"],\"icon-opacity\":[\"opacity\"],\"text-color\":[\"fill_color\"],\"icon-color\":[\"fill_color\"],\"text-halo-color\":[\"halo_color\"],\"icon-halo-color\":[\"halo_color\"],\"text-halo-blur\":[\"halo_blur\"],\"icon-halo-blur\":[\"halo_blur\"],\"text-halo-width\":[\"halo_width\"],\"icon-halo-width\":[\"halo_width\"],\"line-gap-width\":[\"gapwidth\"],\"line-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\"]}[t]||[t.replace(`${e}-`,\"\").replace(/-/g,\"_\")]}function ig(t){return{\"line-pattern\":{source:zr,composite:zr},\"fill-pattern\":{source:zr,composite:zr},\"fill-extrusion-pattern\":{source:zr,composite:zr},\"line-dasharray\":{source:Vh,composite:Vh}}[t]}function Nh(t,e,r){let i={color:{source:sn,composite:_o},number:{source:ga,composite:sn}};return ig(t)?.[r]||i[e][r]}I(\"ConstantBinder\",Vi),I(\"CrossFadedConstantBinder\",sr),I(\"SourceExpressionBinder\",Ee),I(\"CrossFadedPatternBinder\",Gf),I(\"CrossFadedDasharrayBinder\",Xf),I(\"CompositeExpressionBinder\",le),I(\"ProgramConfiguration\",Yf,{omit:[\"_buffers\"]}),I(\"ProgramConfigurationSet\",mr);var To=2**14-1,Uh=-To-1;function wr(t){let e=mt/t.extent,r=t.loadGeometry();for(let i of r)for(let n of i){let a=Math.round(n.x*e),s=Math.round(n.y*e);n.x=Zi(a,Uh,To),n.y=Zi(s,Uh,To),(a<n.x||a>n.x+1||s<n.y||s>n.y+1)&&Mt(\"Geometry exceeds allowed extent, reduce your vector tile buffer size\")}return r}function li(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?wr(t):[]}}var qh=-32768;function ng(t,e,r,i,n){t.emplaceBack(qh+e*8+i,qh+r*8+n)}var Bl=class{constructor(t){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.hasDependencies=!1,this.layoutVertexArray=new $m,this.indexArray=new xn,this.segments=new Qt,this.programConfigurations=new mr(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(t,e,r){let i=this.layers[0],n=[],a=null,s=!1,o=i.type===\"heatmap\";if(i.type===\"circle\"){let c=i;a=c.layout.get(\"circle-sort-key\"),s=!a.isConstant(),o||(o=c.paint.get(\"circle-pitch-alignment\")===\"map\")}let l=o?e.subdivisionGranularity.circle:1,u=new at(this.zoom),h=this.layers[0]._featureFilter.needGeometry;for(let{feature:c,id:p,index:f,sourceLayerIndex:d}of t){let y=li(c,h);if(!this.layers[0]._featureFilter.filter(u,y,r))continue;let m=s?a.evaluate(y,{},r):void 0,g={id:p,properties:c.properties,type:c.type,sourceLayerIndex:d,index:f,geometry:h?y.geometry:wr(c),patterns:{},sortKey:m};n.push(g)}s&&n.sort((c,p)=>c.sortKey-p.sortKey);for(let c of n){let{geometry:p,index:f,sourceLayerIndex:d}=c,y=t[f].feature;this.addFeature(c,p,f,r,l),e.featureIndex.insert(y,p,f,d,this.index)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,{imagePositions:r})}addFeatures(t){}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Zm),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,e,r,i,n=1){let a;switch(n){case 1:a=[0,7];break;case 3:a=[0,2,5,7];break;case 5:a=[0,1,3,4,6,7];break;case 7:a=[0,1,2,3,4,5,6,7];break;default:throw Error(`Invalid circle bucket granularity: ${n}; valid values are 1, 3, 5, 7.`)}let s=a.length;for(let o of e)for(let l of o){let u=l.x,h=l.y;if(u<0||u>=8192||h<0||h>=8192)continue;let c=this.segments.prepareSegment(s*s,this.layoutVertexArray,this.indexArray,t.sortKey),p=c.vertexLength;for(let f=0;f<s;f++)for(let d=0;d<s;d++)ng(this.layoutVertexArray,u,h,a[d],a[f]);for(let f=0;f<s-1;f++)for(let d=0;d<s-1;d++){let y=p+f*s+d,m=p+(f+1)*s+d;this.indexArray.emplaceBack(y,m+1,y+1),this.indexArray.emplaceBack(y,m,m+1)}c.vertexLength+=s*s,c.primitiveLength+=(s-1)*(s-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{imagePositions:{},canonical:i})}};I(\"CircleBucket\",Bl,{omit:[\"layers\"]});function ag(t,e){for(let r of t)if(ai(e,r))return!0;for(let r of e)if(ai(t,r))return!0;return Pl(t,e)}function qa(t,e,r){return ai(t,e)?!0:Io(e,t,r)}function Wf(t,e){if(t.length===1)return jh(e,t[0]);for(let r of e)for(let i of r)if(ai(t,i))return!0;for(let r of t)if(jh(e,r))return!0;for(let r of e)if(Pl(t,r))return!0;return!1}function sg(t,e,r){for(let i of e){if(t.length>=3){for(let n of i)if(ai(t,n))return!0}if(og(t,i,r))return!0}return!1}function og(t,e,r){if(t.length>1){if(Pl(t,e))return!0;for(let i of e)if(Io(i,t,r))return!0}for(let i of t)if(Io(i,e,r))return!0;return!1}function Pl(t,e){if(t.length===0||e.length===0)return!1;for(let r=0;r<t.length-1;r++){let i=t[r],n=t[r+1];for(let a=0;a<e.length-1;a++){let s=e[a],o=e[a+1];if(lg(i,n,s,o))return!0}}return!1}function lg(t,e,r,i){return We(t,r,i)!==We(e,r,i)&&We(t,e,r)!==We(t,e,i)}function Io(t,e,r){let i=r*r;if(e.length===1)return t.distSqr(e[0])<i;for(let n=1;n<e.length;n++){let a=e[n-1],s=e[n];if(Zf(t,a,s)<i)return!0}return!1}function Zf(t,e,r){let i=e.distSqr(r);if(i===0)return t.distSqr(e);let n=((t.x-e.x)*(r.x-e.x)+(t.y-e.y)*(r.y-e.y))/i;return n<0?t.distSqr(e):n>1?t.distSqr(r):t.distSqr(r.sub(e)._mult(n)._add(e))}function jh(t,e){let r=!1,i,n,a;for(let s of t){i=s;for(let o=0,l=i.length-1;o<i.length;l=o++)n=i[o],a=i[l],n.y>e.y!=a.y>e.y&&e.x<(a.x-n.x)*(e.y-n.y)/(a.y-n.y)+n.x&&(r=!r)}return r}function ai(t,e){let r=!1;for(let i=0,n=t.length-1;i<t.length;n=i++){let a=t[i],s=t[n];a.y>e.y!=s.y>e.y&&e.x<(s.x-a.x)*(e.y-a.y)/(s.y-a.y)+a.x&&(r=!r)}return r}function ug(t,e,r,i,n){for(let s of t)if(e<=s.x&&r<=s.y&&i>=s.x&&n>=s.y)return!0;let a=[new B(e,r),new B(e,n),new B(i,n),new B(i,r)];if(t.length>2){for(let s of a)if(ai(t,s))return!0}for(let s=0;s<t.length-1;s++){let o=t[s],l=t[s+1];if(hg(o,l,a))return!0}return!1}function hg(t,e,r){let i=r[0],n=r[2];if(t.x<i.x&&e.x<i.x||t.x>n.x&&e.x>n.x||t.y<i.y&&e.y<i.y||t.y>n.y&&e.y>n.y)return!1;let a=We(t,e,r[0]);return a!==We(t,e,r[1])||a!==We(t,e,r[2])||a!==We(t,e,r[3])}function Xr(t,e,r){let i=e.paint.get(t).value;return i.kind===\"constant\"?i.value:r.programConfigurations.get(e.id).getMaxValue(t)}function ja(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Ga(t,e,r,i,n){if(!e[0]&&!e[1])return t;let a=B.convert(e)._mult(n);r===\"viewport\"&&a._rotate(-i);let s=[];for(let o of t)s.push(o.sub(a));return s}function cg(t){let e=[];for(let r=0;r<t.length;r++){let i=t[r],n=e.at(-1);(r===0||n&&!i.equals(n))&&e.push(i)}return e}function pg(t,e){let r=[];for(let i of t){let n=cg(i),a=[];for(let s=0;s<n.length;s++){let o=n[s],l=n[s-1],u=n[s+1],h=s===0?new B(0,0):o.sub(l)._unit()._perp(),c=s===n.length-1?new B(0,0):u.sub(o)._unit()._perp(),p=h._add(c)._unit(),f=p.x*c.x+p.y*c.y;f!==0&&p._mult(1/f),a.push(p._mult(e)._add(o))}r.push(a)}return r}function fg({queryGeometry:t,size:e},r){return qa(t,r,e)}function dg({queryGeometry:t,size:e,transform:r,unwrappedTileID:i,getElevation:n},a){return qa(t,a,e*(r.projectTileCoordinates(a.x,a.y,i,n?.(a.x,a.y)).signedDistanceFromCamera/r.cameraToCenterDistance))}function yg({queryGeometry:t,size:e,transform:r,unwrappedTileID:i,getElevation:n},a){let s=r.projectTileCoordinates(a.x,a.y,i,n?.(a.x,a.y)).signedDistanceFromCamera,o=e*(r.cameraToCenterDistance/s);return qa(t,zl(a,r,i,n),o)}function mg({queryGeometry:t,size:e,transform:r,unwrappedTileID:i,getElevation:n},a){return qa(t,zl(a,r,i,n),e)}function Hf({queryGeometry:t,size:e,transform:r,unwrappedTileID:i,getElevation:n,pitchAlignment:a=\"map\",pitchScale:s=\"map\"},o){let l=a===\"map\"?s===\"map\"?fg:dg:s===\"map\"?yg:mg,u={queryGeometry:t,size:e,transform:r,unwrappedTileID:i,getElevation:n};for(let h of o)for(let c of h)if(l(u,c))return!0;return!1}function zl(t,e,r,i){let n=e.projectTileCoordinates(t.x,t.y,r,i?.(t.x,t.y)).point;return new B((n.x*.5+.5)*e.width,(-n.y*.5+.5)*e.height)}function gg(t,e,r,i){return t.map(n=>zl(n,e,r,i))}var xg,vg=()=>xg||(xg=new jt({\"circle-sort-key\":new U(D.layout_circle[\"circle-sort-key\"],\"circle-sort-key\")})),bg,wg=()=>bg||(bg=new jt({\"circle-radius\":new U(D.paint_circle[\"circle-radius\"],\"circle-radius\"),\"circle-color\":new U(D.paint_circle[\"circle-color\"],\"circle-color\"),\"circle-blur\":new U(D.paint_circle[\"circle-blur\"],\"circle-blur\"),\"circle-opacity\":new U(D.paint_circle[\"circle-opacity\"],\"circle-opacity\"),\"circle-translate\":new z(D.paint_circle[\"circle-translate\"],\"circle-translate\"),\"circle-translate-anchor\":new z(D.paint_circle[\"circle-translate-anchor\"],\"circle-translate-anchor\"),\"circle-pitch-scale\":new z(D.paint_circle[\"circle-pitch-scale\"],\"circle-pitch-scale\"),\"circle-pitch-alignment\":new z(D.paint_circle[\"circle-pitch-alignment\"],\"circle-pitch-alignment\"),\"circle-stroke-width\":new U(D.paint_circle[\"circle-stroke-width\"],\"circle-stroke-width\"),\"circle-stroke-color\":new U(D.paint_circle[\"circle-stroke-color\"],\"circle-stroke-color\"),\"circle-stroke-opacity\":new U(D.paint_circle[\"circle-stroke-opacity\"],\"circle-stroke-opacity\")})),Dg={get paint(){return wg()},get layout(){return vg()}};var _g=class extends pe{constructor(t,e){super(t,Dg,e)}createBucket(t){return new Bl(t)}queryRadius(t){let e=t;return Xr(\"circle-radius\",this,e)+Xr(\"circle-stroke-width\",this,e)+ja(this.paint.get(\"circle-translate\"))}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:r,geometry:i,transform:n,pixelsToTileUnits:a,unwrappedTileID:s,getElevation:o}){let l=Ga(t,this.paint.get(\"circle-translate\"),this.paint.get(\"circle-translate-anchor\"),-n.bearingInRadians,a),u=this.paint.get(\"circle-radius\").evaluate(e,r)+this.paint.get(\"circle-stroke-width\").evaluate(e,r),h=this.paint.get(\"circle-pitch-scale\"),c=this.paint.get(\"circle-pitch-alignment\"),p,f;return c===\"map\"?(p=l,f=u*a):(p=gg(l,n,s,o),f=u),Hf({queryGeometry:p,size:f,transform:n,unwrappedTileID:s,getElevation:o,pitchAlignment:c,pitchScale:h},i)}},Kf=class extends Bl{};I(\"HeatmapBucket\",Kf,{omit:[\"layers\"]});var Ag,Sg=()=>Ag||(Ag=new jt({\"heatmap-radius\":new U(D.paint_heatmap[\"heatmap-radius\"],\"heatmap-radius\"),\"heatmap-weight\":new U(D.paint_heatmap[\"heatmap-weight\"],\"heatmap-weight\"),\"heatmap-intensity\":new z(D.paint_heatmap[\"heatmap-intensity\"],\"heatmap-intensity\"),\"heatmap-color\":new Ua(D.paint_heatmap[\"heatmap-color\"],\"heatmap-color\"),\"heatmap-opacity\":new z(D.paint_heatmap[\"heatmap-opacity\"],\"heatmap-opacity\")})),Eg={get paint(){return Sg()}};function Ll(t,{width:e,height:r},i,n){if(!n)n=new Uint8Array(e*r*i);else if(n instanceof Uint8ClampedArray)n=new Uint8Array(n.buffer);else if(n.length!==e*r*i)throw RangeError(`mismatched image size. expected: ${n.length} but got: ${e*r*i}`);return t.width=e,t.height=r,t.data=n,t}function Jf(t,{width:e,height:r},i){if(e===t.width&&r===t.height)return;let n=Ll({},{width:e,height:r},i);Vl(t,n,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,e),height:Math.min(t.height,r)},i),t.width=e,t.height=r,t.data=n.data}function Vl(t,e,r,i,n,a){if(n.width===0||n.height===0)return e;if(n.width>t.width||n.height>t.height||r.x>t.width-n.width||r.y>t.height-n.height)throw RangeError(\"out of range source coordinates for image copy\");if(n.width>e.width||n.height>e.height||i.x>e.width-n.width||i.y>e.height-n.height)throw RangeError(\"out of range destination coordinates for image copy\");let s=t.data,o=e.data;if(s===o)throw Error(\"srcData equals dstData, so image is already copied\");for(let l=0;l<n.height;l++){let u=((r.y+l)*t.width+r.x)*a,h=((i.y+l)*e.width+i.x)*a;for(let c=0;c<n.width*a;c++)o[h+c]=s[u+c]}return e}var Xa=class Qf{constructor(e,r){Ll(this,e,1,r)}resize(e){Jf(this,e,1)}clone(){return new Qf({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,i,n,a){Vl(e,r,i,n,a,1)}},Wt=class td{constructor(e,r){Ll(this,e,4,r)}resize(e){Jf(this,e,4)}replace(e,r){r?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new td({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,i,n,a){Vl(e,r,i,n,a,4)}setPixel(e,r,i){let n=(e*this.width+r)*4;this.data[n+0]=Math.round(i.r*255/i.a),this.data[n+1]=Math.round(i.g*255/i.a),this.data[n+2]=Math.round(i.b*255/i.a),this.data[n+3]=Math.round(i.a*255)}};function zs(t){let e=new Uint8Array(t.length);for(let r=0;r<t.length;r+=4){let i=t[r+3];e[r+0]=Math.round(t[r+0]*i/255),e[r+1]=Math.round(t[r+1]*i/255),e[r+2]=Math.round(t[r+2]*i/255),e[r+3]=i}return e}I(\"AlphaImage\",Xa),I(\"RGBAImage\",Wt);function Fg(t){let e={},r=t.resolution||256,i=t.clips?t.clips.length:1,n=t.image||new Wt({width:r,height:i});if(!x1(r))throw Error(`width is not a power of 2 - ${r}`);let a=(s,o,l)=>{e[t.evaluationKey]=l;let u=t.expression.evaluate(e);n.setPixel(s/4/r,o/4,u)};if(t.clips)for(let s=0,o=0;s<i;++s,o+=r*4)for(let l=0,u=0;l<r;l++,u+=4){let h=l/(r-1),{start:c,end:p}=t.clips[s],f=c*(1-h)+p*h;a(o,u,f)}else for(let s=0,o=0;s<r;s++,o+=4){let l=s/(r-1);a(0,o,l)}return n}var kg=\"big-fb\";var Tg=class extends pe{createBucket(t){return new Kf(t)}constructor(t,e){super(t,Eg,e),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){t===\"heatmap-color\"&&this._updateColorRamp()}_updateColorRamp(){let t=this._transitionablePaint._values[\"heatmap-color\"].value.expression;this.colorRamp=Fg({expression:t,evaluationKey:\"heatmapDensity\",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(\"big-fb\")&&this.heatmapFbos.delete(kg)}queryRadius(t){return Xr(\"heatmap-radius\",this,t)}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:r,geometry:i,transform:n,pixelsToTileUnits:a,unwrappedTileID:s,getElevation:o}){return Hf({queryGeometry:t,size:this.paint.get(\"heatmap-radius\").evaluate(e,r)*a,transform:n,unwrappedTileID:s,getElevation:o},i)}hasOffscreenPass(){return this.paint.get(\"heatmap-opacity\")!==0&&!this.isHidden()}},Ig,Cg=()=>Ig||(Ig=new jt({\"hillshade-illumination-direction\":new z(D.paint_hillshade[\"hillshade-illumination-direction\"],\"hillshade-illumination-direction\"),\"hillshade-illumination-altitude\":new z(D.paint_hillshade[\"hillshade-illumination-altitude\"],\"hillshade-illumination-altitude\"),\"hillshade-illumination-anchor\":new z(D.paint_hillshade[\"hillshade-illumination-anchor\"],\"hillshade-illumination-anchor\"),\"hillshade-exaggeration\":new z(D.paint_hillshade[\"hillshade-exaggeration\"],\"hillshade-exaggeration\"),\"hillshade-shadow-color\":new z(D.paint_hillshade[\"hillshade-shadow-color\"],\"hillshade-shadow-color\"),\"hillshade-highlight-color\":new z(D.paint_hillshade[\"hillshade-highlight-color\"],\"hillshade-highlight-color\"),\"hillshade-accent-color\":new z(D.paint_hillshade[\"hillshade-accent-color\"],\"hillshade-accent-color\"),\"hillshade-method\":new z(D.paint_hillshade[\"hillshade-method\"],\"hillshade-method\"),resampling:new z(D.paint_hillshade.resampling,\"resampling\")})),Mg={get paint(){return Cg()}};var Bg=class extends pe{constructor(t,e){super(t,Mg,e),this.recalculate({zoom:0,zoomHistory:{}},void 0)}getIlluminationProperties(){let t=this.paint.get(\"hillshade-illumination-direction\").values,e=this.paint.get(\"hillshade-illumination-altitude\").values,r=this.paint.get(\"hillshade-highlight-color\").values,i=this.paint.get(\"hillshade-shadow-color\").values,n=Math.max(t.length,e.length,r.length,i.length);t=t.concat(Array(n-t.length).fill(t.at(-1))),e=e.concat(Array(n-e.length).fill(e.at(-1))),r=r.concat(Array(n-r.length).fill(r.at(-1))),i=i.concat(Array(n-i.length).fill(i.at(-1)));let a=e.map(nh);return{directionRadians:t.map(nh),altitudeRadians:a,shadowColor:i,highlightColor:r}}hasOffscreenPass(){return this.paint.get(\"hillshade-exaggeration\")!==0&&!this.isHidden()}},Pg,zg=()=>Pg||(Pg=new jt({\"color-relief-opacity\":new z(D[\"paint_color-relief\"][\"color-relief-opacity\"],\"color-relief-opacity\"),\"color-relief-color\":new Ua(D[\"paint_color-relief\"][\"color-relief-color\"],\"color-relief-color\"),resampling:new z(D[\"paint_color-relief\"].resampling,\"resampling\")})),Lg={get paint(){return zg()}};function jn(t){return\"data\"in t}var Gh=class{constructor(t,e,r,i){this.context=t,this.format=r,this.texture=t.gl.createTexture(),this._ownedHandle=this.texture,this.update(e,i)}update(t,e,r){let{width:i,height:n}=t,a=(this.size?.[0]!==i||this.size[1]!==n)&&!r,{context:s}=this,{gl:o}=s;this.useMipmap=!!e?.useMipmap,a&&this.size&&this.format===o.RGBA&&(o.deleteTexture(this.texture),this.texture=o.createTexture(),this._ownedHandle=this.texture,this.magFilter=void 0,this.minFilter=void 0,this.wrap=void 0),o.bindTexture(o.TEXTURE_2D,this.texture),s.pixelStoreUnpackFlipY.set(!1),s.pixelStoreUnpack.set(1);let l=this.format===o.RGBA&&e?.premultiply!==!1;if(a)if(this.size=[i,n],this.format===o.RGBA&&i>0&&n>0){let u=this.useMipmap?Math.floor(Math.log2(Math.max(i,n)))+1:1;if(o.texStorage2D(o.TEXTURE_2D,u,o.RGBA8,i,n),jn(t)){s.pixelStoreUnpackPremultiplyAlpha.set(!1);let{data:h}=t;l&&h&&(h=zs(h)),h&&o.texSubImage2D(o.TEXTURE_2D,0,0,0,i,n,o.RGBA,o.UNSIGNED_BYTE,h)}else s.pixelStoreUnpackPremultiplyAlpha.set(l),o.texSubImage2D(o.TEXTURE_2D,0,0,0,o.RGBA,o.UNSIGNED_BYTE,t)}else jn(t)?(s.pixelStoreUnpackPremultiplyAlpha.set(!1),this._uploadRawData(t,l,i,n,o)):(s.pixelStoreUnpackPremultiplyAlpha.set(l),this._uploadDomImage(t,o));else{let{x:u,y:h}=r||{x:0,y:0};jn(t)?(s.pixelStoreUnpackPremultiplyAlpha.set(!1),this._updateRawData(t,l,u,h,i,n,o)):(s.pixelStoreUnpackPremultiplyAlpha.set(l),this._updateDomImage(t,u,h,o))}this.useMipmap&&!(jn(t)&&t.data===null)&&o.generateMipmap(o.TEXTURE_2D),s.pixelStoreUnpackFlipY.setDefault(),s.pixelStoreUnpack.setDefault(),s.pixelStoreUnpackPremultiplyAlpha.setDefault()}_uploadDomImage(t,e){e.texImage2D(e.TEXTURE_2D,0,this.format,this.format,e.UNSIGNED_BYTE,t)}_uploadRawData(t,e,r,i,n){let{data:a}=t;e&&a&&(a=zs(a)),n.texImage2D(n.TEXTURE_2D,0,this.format,r,i,0,this.format,n.UNSIGNED_BYTE,a)}_updateDomImage(t,e,r,i){i.texSubImage2D(i.TEXTURE_2D,0,e,r,i.RGBA,i.UNSIGNED_BYTE,t)}_updateRawData(t,e,r,i,n,a,s){let{data:o}=t;e&&o&&(o=zs(o)),s.texSubImage2D(s.TEXTURE_2D,0,r,i,n,a,s.RGBA,s.UNSIGNED_BYTE,o)}bind(t,e,r){let{context:i}=this,{gl:n}=i;this.texture!==this._ownedHandle&&(this.texture=this._ownedHandle),n.bindTexture(n.TEXTURE_2D,this.texture),(r===n.LINEAR_MIPMAP_NEAREST||r===n.LINEAR_MIPMAP_LINEAR)&&!this.useMipmap&&(r=n.LINEAR);let a=r||t;t!==this.magFilter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,t),this.magFilter=t),a!==this.minFilter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,a),this.minFilter=a),e!==this.wrap&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,e),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,e),this.wrap=e)}generateMipmap(){if(!this.useMipmap)return;let{gl:t}=this.context;t.bindTexture(t.TEXTURE_2D,this.texture),t.generateMipmap(t.TEXTURE_2D)}destroy(){let{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null,this._ownedHandle=null}},Me,Ol=(Me=class{constructor(e,r,i,n=1,a=1,s=1,o=0){if(this.uid=e,r.height!==r.width)throw RangeError(\"DEM tiles must be square\");if(i&&![\"mapbox\",\"terrarium\",\"custom\"].includes(i)){Mt(`\"${i}\" is not a valid encoding type. Valid types include \"mapbox\", \"terrarium\" and \"custom\".`);return}this.stride=r.height;let l=this.dim=r.height-4;switch(this.data=new Uint32Array(r.data.buffer),Me.byteViewCache.set(this,new Uint8Array(this.data.buffer)),i){case\"terrarium\":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case\"custom\":this.redFactor=n,this.greenFactor=a,this.blueFactor=s,this.baseShift=o;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let h=-2;h<l+2;h++){let c=this._idx(0,Math.max(0,Math.min(l-1,h)));(h<0||h>=l)&&this.data.copyWithin(this._idx(0,h),c,c+l),this.data.fill(this.data[c],this._idx(-2,h),this._idx(0,h)),this.data.fill(this.data[c+l-1],this._idx(l,h),this._idx(l+1,h)+1)}let u=this._getByteView();this.min=2**53-1,this.max=-(2**53-1);for(let h=0;h<l;h++)for(let c=0;c<l;c++){let p=this._idx(h,c)*4,f=this._unpackAtIndex(u,p);f>this.max&&(this.max=f),f<this.min&&(this.min=f)}}get(e,r){let i=this._getByteView(),n=this._idx(e,r)*4;return this._unpackAtIndex(i,n)}sampleBilinear(e,r){let i=Math.floor(e),n=Math.floor(r);if(i<-1||i>=this.dim||n<-1||n>=this.dim)throw RangeError(`Out of range source coordinates for DEM data. x: ${e}, y: ${r}, dim: ${this.dim}`);let a=this._getByteView(),s=((n+2)*this.stride+i+2)*4,o=this.stride*4,l=e-i,u=r-n,h=this._unpackAtIndex(a,s),c=this._unpackAtIndex(a,s+4),p=this._unpackAtIndex(a,s+o),f=this._unpackAtIndex(a,s+o+4);return h*(1-l)*(1-u)+c*l*(1-u)+p*(1-l)*u+f*l*u}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(e,r){if(e<-2||e>=this.dim+2||r<-2||r>=this.dim+2)throw RangeError(`Out of range source coordinates for DEM data. x: ${e}, y: ${r}, dim: ${this.dim}`);return(r+2)*this.stride+(e+2)}unpack(e,r,i){return e*this.redFactor+r*this.greenFactor+i*this.blueFactor-this.baseShift}pack(e){return ed(e,this.getUnpackVector())}getPixels(){return new Wt({width:this.stride,height:this.stride},this._getByteView())}backfillBorder(e,r,i){if(this.dim!==e.dim)throw Error(\"dem dimension mismatch\");let n=r*this.dim,a=r*this.dim+this.dim,s=i*this.dim,o=i*this.dim+this.dim;switch(r){case-1:n=a-2;break;case 1:a=n+2}switch(i){case-1:s=o-2;break;case 1:o=s+2}let l=-r*this.dim,u=-i*this.dim;for(let h=s;h<o;h++)for(let c=n;c<a;c++)this.data[this._idx(c,h)]=e.data[this._idx(c+l,h+u)]}_getByteView(){let e=Me.byteViewCache.get(this);return e?.buffer!==this.data.buffer&&(e=new Uint8Array(this.data.buffer),Me.byteViewCache.set(this,e)),e}_unpackAtIndex(e,r){return this.unpack(e[r],e[r+1],e[r+2])}},Me.byteViewCache=new WeakMap,Me);function ed(t,e){let r=e[0],i=e[1],n=e[2],a=e[3],s=Math.min(r,i,n),o=Math.round((t+a)/s);return{r:Math.floor(o*s/r)%256,g:Math.floor(o*s/i)%256,b:Math.floor(o*s/n)%256}}I(\"DEMData\",Ol);var Vg=class extends pe{constructor(t,e){super(t,Lg,e)}_createColorRamp(t){let e={elevationStops:[],colorStops:[]},r=this._transitionablePaint._values[\"color-relief-color\"].value.expression;if(r instanceof en&&r._styleExpression.expression instanceof xe){this.colorRampExpression=r;let a=r._styleExpression.expression;e.elevationStops=a.labels,e.colorStops=[];for(let s of e.elevationStops)e.colorStops.push(a.evaluate({globals:{elevation:s}}))}if(e.elevationStops.length<1&&(e.elevationStops=[0],e.colorStops=[gt.transparent]),e.elevationStops.length<2&&(e.elevationStops.push(e.elevationStops[0]+1),e.colorStops.push(e.colorStops[0])),e.elevationStops.length<=t)return e;let i={elevationStops:[],colorStops:[]},n=(e.elevationStops.length-1)/(t-1);for(let a=0;a<e.elevationStops.length-.5;a+=n)i.elevationStops.push(e.elevationStops[Math.round(a)]),i.colorStops.push(e.colorStops[Math.round(a)]);return Mt(`Too many colors in specification of ${this.id} color-relief layer, may not render properly. Max possible colors: ${t}, provided: ${e.elevationStops.length}`),i}_colorRampChanged(){return this.colorRampExpression!=this._transitionablePaint._values[\"color-relief-color\"].value.expression}getColorRampTextures(t,e,r){if(this.colorRampTextures&&!this._colorRampChanged())return this.colorRampTextures;let i=this._createColorRamp(e),n=new Wt({width:i.colorStops.length,height:1}),a=new Wt({width:i.colorStops.length,height:1});for(let s=0;s<i.elevationStops.length;s++){let o=ed(i.elevationStops[s],r);a.setPixel(0,s,new gt(o.r/255,o.g/255,o.b/255,1)),n.setPixel(0,s,i.colorStops[s])}return this.colorRampTextures={elevationTexture:new Gh(t,a,t.gl.RGBA),colorTexture:new Gh(t,n,t.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return!this.isHidden()&&!!this.colorRampTextures}},Co=At([{name:\"a_pos\",components:2,type:\"Int16\"}],4),Og=Co.members;Co.size,Co.alignment;function xa(t,e,r){let i=r.patternDependencies,n=!1;for(let a of e){let s=a.paint.get(`${t}-pattern`);s.isConstant()||(n=!0);let o=s.constantOr(null);o&&(n=!0,i[o.to]=!0,i[o.from]=!0)}return n}function Rl(t,e,r,i,n){let{zoom:a}=i,s=n.patternDependencies;for(let o of e){let l=o.paint.get(`${t}-pattern`).value;if(l.kind!==\"constant\"){let u=l.evaluate({zoom:a-1},r,{},n.availableImages),h=l.evaluate({zoom:a},r,{},n.availableImages),c=l.evaluate({zoom:a+1},r,{},n.availableImages);u=u?.name?u.name:u,h=h?.name?h.name:h,c=c?.name?c.name:c,s[u]=!0,s[h]=!0,s[c]=!0,r.patterns[o.id]={min:u,mid:h,max:c}}}return r}var on=new Set,Mo=!1;function Rg(t,e,r=2){let i=e&&e.length,n=i?e[0]*r:t.length;on.size&&on.clear();let a=rd(t,0,n,r,!0),s=[];if(!a||a.next===a.prev)return s;let o=0,l=0,u=0;if(i&&(a=jg(t,e,a,r)),t.length>80*r){o=t[0],l=t[1];let h=o,c=l;for(let p=r;p<n;p+=r){let f=t[p],d=t[p+1];f<o&&(o=f),d<l&&(l=d),f>h&&(h=f),d>c&&(c=d)}u=Math.max(h-o,c-l),u=u===0?0:32767/u}return Bo(a,s,o,l,u),s}function rd(t,e,r,i,n){let a=null;if(n===ix(t,e,r,i)>0)for(let s=e;s<r;s+=i)a=Wh(s/i|0,t[s],t[s+1],a);else for(let s=r-i;s>=e;s-=i)a=Wh(s/i|0,t[s],t[s+1],a);return a&&ln(a,a.next)&&(hn(a),a=a.next),a}function gr(t,e=t){let r=e===t,i=t,n;do n=!1,i!==i.next&&(on.size===0||!on.has(i))&&(ln(i,i.next)||Et(i.prev,i,i.next)===0)?((r||i===e)&&(e=i.prev),Mo=!0,hn(i),i=i.prev,n=!0):(r||i!==e)&&(i=i.next,n=!r);while(n||i!==e);return e}function Bo(t,e,r,i,n){n&&Kg(t,r,i,n);let a=t,s=!1;for(;t.prev!==t.next;){let o=t.prev,l=t.next;if(Et(o,t,l)<0&&(n?Ng(t,r,i,n):$g(t))){e.push(o.i,t.i,l.i),hn(t),t=l,a=l;continue}if(t=l,t===a){if(Mo=!1,t=gr(t),Mo){a=t;continue}if(!s){t=Ug(t,e),a=t,s=!0;continue}qg(t,e,r,i,n);break}}}function $g(t){let e=t.prev,r=t,i=t.next,n=e.x,a=r.x,s=i.x,o=e.y,l=r.y,u=i.y,h=Math.min(n,a,s),c=Math.min(o,l,u),p=Math.max(n,a,s),f=Math.max(o,l,u),d=i.next;for(;d!==e;){if(d.x>=h&&d.x<=p&&d.y>=c&&d.y<=f&&(n!==d.x||o!==d.y)&&ba(n,o,a,l,s,u,d.x,d.y)&&Et(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function Ng(t,e,r,i){let n=t.prev,a=t,s=t.next,o=n.x,l=a.x,u=s.x,h=n.y,c=a.y,p=s.y,f=Math.min(o,l,u),d=Math.min(h,c,p),y=Math.max(o,l,u),m=Math.max(h,c,p),g=Vo(f,d,e,r,i),x=Vo(y,m,e,r,i),b=t.prevZ;for(;b&&b.z>=g;){if(b.x>=f&&b.x<=y&&b.y>=d&&b.y<=m&&b!==s&&(o!==b.x||h!==b.y)&&ba(o,h,l,c,u,p,b.x,b.y)&&Et(b.prev,b,b.next)>=0)return!1;b=b.prevZ}let v=t.nextZ;for(;v&&v.z<=x;){if(v.x>=f&&v.x<=y&&v.y>=d&&v.y<=m&&v!==s&&(o!==v.x||h!==v.y)&&ba(o,h,l,c,u,p,v.x,v.y)&&Et(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function Ug(t,e){let r=t,i=!1;do{let n=r.prev,a=r.next.next;nd(n,r,r.next,a,!1)&&un(n,a)&&un(a,n)&&(e.push(n.i,r.i,a.i),hn(r),hn(r.next),r=t=a,i=!0),r=r.next}while(r!==t);return i?gr(r):r}function qg(t,e,r,i,n){let a=t;do{let s=a.next.next;for(;s!==a.prev;){if(a.i!==s.i&&tx(a,s)){let o=ad(a,s);a=gr(a,a.next),o=gr(o,o.next),Bo(a,e,r,i,n),Bo(o,e,r,i,n);return}s=s.next}a=a.next}while(a!==t)}var Po=!1;function jg(t,e,r,i){let n=[];for(let a=0,s=e.length;a<s;a++){let o=rd(t,e[a]*i,a<s-1?e[a+1]*i:t.length,i,!1);o===o.next&&on.add(o),n.push(Qg(o))}n.sort(Gg),Yg(t.length/i,e.length),id(r,r),Po=!0;for(let a=0;a<n.length;a++)r=Xg(n[a],r);return Po=!1,gr(r)}function Gg(t,e){return t.x-e.x||t.y-e.y||(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)}function Xg(t,e){let r=Zg(t,e);if(!r)return e;let i=ad(r,t),n=i.next;return id(r,n.next),gr(i,i.next),gr(r,r.next)}var wt=new Float64Array,va=0,zo=[],Lo=[];function Yg(t,e){let r=Math.ceil((t+2*e)/16)+e+2;wt.length<r*4&&(wt=new Float64Array(r*4)),va=0}function id(t,e){let r=t;do{let i=va++;zo[i]=r;let n=1/0,a=1/0,s=-1/0,o=-1/0,l=0;do{let h=r.next;r.z=i,r.x<n&&(n=r.x),r.x>s&&(s=r.x),r.y<a&&(a=r.y),r.y>o&&(o=r.y),h.x<n&&(n=h.x),h.x>s&&(s=h.x),h.y<a&&(a=h.y),h.y>o&&(o=h.y),r=h}while(++l<16&&r!==e);Lo[i]=r;let u=i*4;wt[u]=n,wt[u+1]=a,wt[u+2]=s,wt[u+3]=o}while(r!==e)}function Wg(t,e){let r=t.z*4;e.x<wt[r]&&(wt[r]=e.x),e.y<wt[r+1]&&(wt[r+1]=e.y),e.x>wt[r+2]&&(wt[r+2]=e.x),e.y>wt[r+3]&&(wt[r+3]=e.y)}function Xh(t){let e=Lo[t];for(;e.prev.next!==e;)e=e.next;return Lo[t]=e,e}function Yh(t){let e=zo[t];for(;e.prev.next!==e;)e=e.next;return zo[t]=e,e}function Zg(t,e){let r=e,i=t.x,n=t.y,a=-1/0,s;if(ln(t,r))return r;for(let p=0,f=0;p<va;p++,f+=4){if(n<wt[f+1]||n>wt[f+3]||wt[f]>i||wt[f+2]<=a)continue;let d=Xh(p);r=Yh(p);do{if(r.prev.next===r){if(ln(t,r.next))return r.next;if(n<=r.y&&n>=r.next.y&&r.next.y!==r.y){let y=r.x+(n-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(y<=i&&y>a&&(a=y,s=r.x<r.next.x?r:r.next,y===i))return s}}r=r.next}while(r!==d)}if(!s)return null;let o=s.x,l=s.y,u=Math.min(n,l),h=Math.max(n,l),c=1/0;for(let p=0,f=0;p<va;p++,f+=4){if(wt[f+2]<o||wt[f]>i||wt[f+3]<u||wt[f+1]>h)continue;let d=Xh(p);r=Yh(p);do{if(r.prev.next===r&&i>=r.x&&r.x>=o&&i!==r.x&&ba(n<l?i:a,n,o,l,n<l?a:i,n,r.x,r.y)){let y=Math.abs(n-r.y)/(i-r.x);(un(r,t)||r.y===n&&r.next.y===n&&r.next.x>i)&&(y<c||y===c&&(r.x>s.x||r.x===s.x&&Hg(s,r)))&&(s=r,c=y)}r=r.next}while(r!==d)}return s}function Hg(t,e){return Et(t.prev,t,e.prev)<0&&Et(e.next,t,t.next)<0}var ie=[],Ei=[],nr=new Uint32Array,Fi=new Uint32Array,ki=new Uint32Array(256);function Kg(t,e,r,i){let n=t,a=0;do n.z=Vo(n.x,n.y,e,r,i),ie[a++]=n,n=n.next;while(n!==t);Jg(a);let s=null;for(let o=0;o<a;o++){let l=ie[o];l.prevZ=s,s&&(s.nextZ=l),s=l}s.nextZ=null}function Jg(t){if(t<=32){for(let e=1;e<t;e++){let r=ie[e],i=r.z,n=e-1;for(;n>=0&&ie[n].z>i;)ie[n+1]=ie[n],n--;ie[n+1]=r}return}nr.length<t&&(nr=new Uint32Array(t),Fi=new Uint32Array(t),Ei=Array(t));for(let e=0;e<t;e++)nr[e]=ie[e].z;Gn(t,ie,nr,Ei,Fi,0),Gn(t,Ei,Fi,ie,nr,8),Gn(t,ie,nr,Ei,Fi,16),Gn(t,Ei,Fi,ie,nr,24)}function Gn(t,e,r,i,n,a){ki.fill(0);for(let o=0;o<t;o++)ki[r[o]>>>a&255]++;let s=0;for(let o=0;o<256;o++){let l=ki[o];ki[o]=s,s+=l}for(let o=0;o<t;o++){let l=r[o],u=ki[l>>>a&255]++;i[u]=e[o],n[u]=l}}function Vo(t,e,r,i,n){return t=(t-r)*n|0,e=(e-i)*n|0,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t|e<<1}function Qg(t){let e=t,r=t;do(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next;while(e!==t);return r}function ba(t,e,r,i,n,a,s,o){return(n-s)*(e-o)>=(t-s)*(a-o)&&(t-s)*(i-o)>=(r-s)*(e-o)&&(r-s)*(a-o)>=(n-s)*(i-o)}function tx(t,e){let r=ln(t,e)&&Et(t.prev,t,t.next)>0&&Et(e.prev,e,e.next)>0;return t.next.i!==e.i&&(r||un(t,e)&&un(e,t)&&(Et(t.prev,t,e.prev)!==0||Et(t,e.prev,e)!==0))&&!ex(t,e)&&(r||rx(t,e))}function Et(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function ln(t,e){return t.x===e.x&&t.y===e.y}function nd(t,e,r,i,n=!0){let a=Et(t,e,r),s=Et(t,e,i),o=Et(r,i,t),l=Et(r,i,e);return(a>0&&s<0||a<0&&s>0)&&(o>0&&l<0||o<0&&l>0)?!0:n?!!(a===0&&Xn(t,r,e)||s===0&&Xn(t,i,e)||o===0&&Xn(r,t,i)||l===0&&Xn(r,e,i)):!1}function Xn(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function ex(t,e){let r=Math.min(t.x,e.x),i=Math.max(t.x,e.x),n=Math.min(t.y,e.y),a=Math.max(t.y,e.y),s=t;do{let o=s.next;if(s.x>i&&o.x>i||s.x<r&&o.x<r||s.y>a&&o.y>a||s.y<n&&o.y<n){s=o;continue}if(s.i!==t.i&&o.i!==t.i&&s.i!==e.i&&o.i!==e.i&&nd(s,o,t,e))return!0;s=o}while(s!==t);return!1}function un(t,e){return Et(t.prev,t,t.next)<0?Et(t,e,t.next)>=0&&Et(t,t.prev,e)>=0:Et(t,e,t.prev)<0||Et(t,t.next,e)<0}function rx(t,e){let r=t,i=!1,n=(t.x+e.x)/2,a=(t.y+e.y)/2;do{let s=r.next;r.y>a!=s.y>a&&n<(s.x-r.x)*(a-r.y)/(s.y-r.y)+r.x&&(i=!i),r=s}while(r!==t);return i}function ad(t,e){let r=Oo(t.i,t.x,t.y),i=Oo(e.i,e.x,e.y),n=t.next,a=e.prev;return t.next=e,e.prev=t,r.next=n,n.prev=r,i.next=r,r.prev=i,a.next=i,i.prev=a,i}function Wh(t,e,r,i){let n=Oo(t,e,r);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function hn(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ),Po&&Wg(t.prev,t.next)}function Oo(t,e,r){return{i:t,x:e,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null}}function ix(t,e,r,i){let n=0;for(let a=e,s=r-i;a<r;a+=i)n+=(t[s]-t[a])*(t[a+1]+t[s+1]),s=a;return n}var Oi=class{constructor(t,e){if(e>t)throw Error(\"Min granularity must not be greater than base granularity.\");this._baseZoomGranularity=t,this._minGranularity=e}getGranularityForZoomLevel(t){let e=1<<t;return Math.max(Math.floor(this._baseZoomGranularity/e),this._minGranularity,1)}},pr,nx=(pr=class{constructor(e){this.fill=e.fill,this.line=e.line,this.tile=e.tile,this.stencil=e.stencil,this.circle=e.circle}},pr.noSubdivision=new pr({fill:new Oi(0,0),line:new Oi(0,0),tile:new Oi(0,0),stencil:new Oi(0,0),circle:1}),pr);I(\"SubdivisionGranularityExpression\",Oi),I(\"SubdivisionGranularitySetting\",nx);var Ls=-32768,Vs=32767,ax=class{constructor(t,e){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=t,this._granularityCellSize=mt/t,this._canonical=e}_getKey(t,e){return t+=32768,e+=32768,t<<16|e<<0}_vertexToIndex(t,e){if(t<-32768||e<-32768||t>32767||e>32767)throw Error(\"Vertex coordinates are out of signed 16 bit integer range.\");let r=Math.round(t)|0,i=Math.round(e)|0,n=this._getKey(r,i);if(this._vertexDictionary.has(n))return this._vertexDictionary.get(n);let a=this._vertexBuffer.length/2;return this._vertexDictionary.set(n,a),this._vertexBuffer.push(r,i),a}_subdivideTrianglesScanline(t){if(this._granularity<2)return ox(this._vertexBuffer,t);let e=[],r=t.length;for(let i=0;i<r;i+=3){let n=[t[i+0],t[i+1],t[i+2]],a=[this._vertexBuffer[t[i+0]*2+0],this._vertexBuffer[t[i+0]*2+1],this._vertexBuffer[t[i+1]*2+0],this._vertexBuffer[t[i+1]*2+1],this._vertexBuffer[t[i+2]*2+0],this._vertexBuffer[t[i+2]*2+1]],s=1/0,o=1/0,l=-1/0,u=-1/0;for(let d=0;d<3;d++){let y=a[d*2],m=a[d*2+1];s=Math.min(s,y),l=Math.max(l,y),o=Math.min(o,m),u=Math.max(u,m)}if(s===l||o===u)continue;let h=Math.floor(s/this._granularityCellSize),c=Math.ceil(l/this._granularityCellSize),p=Math.floor(o/this._granularityCellSize),f=Math.ceil(u/this._granularityCellSize);if(h===c&&p===f){e.push(...n);continue}for(let d=p;d<f;d++){let y=this._scanlineGenerateVertexRingForCellRow(d,a,n);lx(this._vertexBuffer,y,e)}}return e}_scanlineGenerateVertexRingForCellRow(t,e,r){let i=t*this._granularityCellSize,n=i+this._granularityCellSize,a=[];for(let s=0;s<3;s++){let o=e[s*2],l=e[s*2+1],u=e[(s+1)*2%6],h=e[((s+1)*2+1)%6],c=e[(s+2)*2%6],p=e[((s+2)*2+1)%6],f=u-o,d=h-l,y=f===0,m=d===0,g=(i-l)/d,x=(n-l)/d,b=Math.min(g,x),v=Math.max(g,x);if(!m&&(b>=1||v<=0)||m&&(l<i||l>n)){h>=i&&h<=n&&a.push(r[(s+1)%3]);continue}if(!m&&b>0){let A=o+f*b,S=l+d*b;a.push(this._vertexToIndex(A,S))}let w=o+f*Math.max(b,0),_=o+f*Math.min(v,1);if(y||this._generateIntraEdgeVertices(a,o,l,u,h,w,_),!m&&v<1){let A=o+f*v,S=l+d*v;a.push(this._vertexToIndex(A,S))}(m||h>=i&&h<=n)&&a.push(r[(s+1)%3]),!m&&(h<=i||h>=n)&&this._generateInterEdgeVertices(a,o,l,u,h,c,p,_,i,n)}return a}_generateIntraEdgeVertices(t,e,r,i,n,a,s){let o=i-e,l=n-r,u=l===0,h=u?Math.min(e,i):Math.min(a,s),c=u?Math.max(e,i):Math.max(a,s),p=Math.floor(h/this._granularityCellSize)+1,f=Math.ceil(c/this._granularityCellSize)-1;if(u?e<i:a<s)for(let d=p;d<=f;d++){let y=d*this._granularityCellSize,m=r+l*(y-e)/o;t.push(this._vertexToIndex(y,m))}else for(let d=f;d>=p;d--){let y=d*this._granularityCellSize,m=r+l*(y-e)/o;t.push(this._vertexToIndex(y,m))}}_generateInterEdgeVertices(t,e,r,i,n,a,s,o,l,u){let h=n-r,c=a-i,p=s-n,f=(l-n)/p,d=(u-n)/p,y=Math.min(f,d),m=Math.max(f,d),g=i+c*y,x=Math.floor(Math.min(g,o)/this._granularityCellSize)+1,b=Math.ceil(Math.max(g,o)/this._granularityCellSize)-1,v=o<g,w=p===0;if(w&&(s===l||s===u))return;if(w||y>=1||m<=0){let A=e-a,S=r-s,F=(l-s)/S,L=(u-s)/S,O=a+A*Math.min(F,L);x=Math.floor(Math.min(O,o)/this._granularityCellSize)+1,b=Math.ceil(Math.max(O,o)/this._granularityCellSize)-1,v=o<O}let _=h>0?u:l;if(v)for(let A=x;A<=b;A++){let S=A*this._granularityCellSize;t.push(this._vertexToIndex(S,_))}else for(let A=b;A>=x;A--){let S=A*this._granularityCellSize;t.push(this._vertexToIndex(S,_))}}_generateOutline(t){let e=[];for(let r of t){let i=lr(r,this._granularity,!0),n=this._pointArrayToIndices(i),a=[];for(let s=1;s<n.length;s++)a.push(n[s-1]),a.push(n[s]);e.push(a)}return e}_handlePoles(t){let e=!1,r=!1;this._canonical&&(this._canonical.y===0&&(e=!0),this._canonical.y===(1<<this._canonical.z)-1&&(r=!0)),(e||r)&&this._fillPoles(t,e,r)}_ensureNoPoleVertices(){let t=this._vertexBuffer;for(let e=0;e<t.length;e+=2){let r=t[e+1];r===-32768&&(t[e+1]=-32767),r===32767&&(t[e+1]=32766)}}_generatePoleQuad(t,e,r,i,n,a){i>n==(a===-32768)?(t.push(r),t.push(e),t.push(this._vertexToIndex(i,a)),t.push(this._vertexToIndex(n,a)),t.push(r),t.push(this._vertexToIndex(i,a))):(t.push(e),t.push(r),t.push(this._vertexToIndex(i,a)),t.push(r),t.push(this._vertexToIndex(n,a)),t.push(this._vertexToIndex(i,a)))}_fillPoles(t,e,r){let i=this._vertexBuffer,n=mt,a=t.length;for(let s=2;s<a;s+=3){let o=t[s-2],l=t[s-1],u=t[s],h=i[o*2],c=i[o*2+1],p=i[l*2],f=i[l*2+1],d=i[u*2],y=i[u*2+1];e&&(c===0&&f===0&&this._generatePoleQuad(t,o,l,h,p,Ls),f===0&&y===0&&this._generatePoleQuad(t,l,u,p,d,Ls),y===0&&c===0&&this._generatePoleQuad(t,u,o,d,h,Ls)),r&&(c===n&&f===n&&this._generatePoleQuad(t,o,l,h,p,Vs),f===n&&y===n&&this._generatePoleQuad(t,l,u,p,d,Vs),y===n&&c===n&&this._generatePoleQuad(t,u,o,d,h,Vs))}}_initializeVertices(t){for(let e=0;e<t.length;e+=2)this._vertexToIndex(t[e],t[e+1])}subdividePolygonInternal(t,e){if(this._used)throw Error(\"Subdivision: multiple use not allowed.\");this._used=!0;let{flattened:r,holeIndices:i}=sx(t);this._initializeVertices(r);let n;try{let s=Rg(r,i),o=this._convertIndices(r,s);n=this._subdivideTrianglesScanline(o)}catch(s){console.error(s)}let a=[];return e&&(a=this._generateOutline(t)),this._ensureNoPoleVertices(),this._handlePoles(n),this._granularity>=2&&this._canonical?.z===0&&(n=this._removeTrianglesOutsideTileX(n),a=a.map(s=>this._removeLinesOutsideTileX(s))),{verticesFlattened:this._vertexBuffer,indicesTriangles:n,indicesLineList:a}}_vertexOutsideTileX(t){let e=this._vertexBuffer[t*2];return e<0||e>8192}_removeTrianglesOutsideTileX(t){let e=[];for(let r=0;r<t.length;r+=3)this._vertexOutsideTileX(t[r])||this._vertexOutsideTileX(t[r+1])||this._vertexOutsideTileX(t[r+2])||e.push(t[r],t[r+1],t[r+2]);return e}_removeLinesOutsideTileX(t){let e=[];for(let r=0;r<t.length;r+=2)this._vertexOutsideTileX(t[r])||this._vertexOutsideTileX(t[r+1])||e.push(t[r],t[r+1]);return e}_convertIndices(t,e){let r=[];for(let i of e){let n=t[i*2],a=t[i*2+1];r.push(this._vertexToIndex(n,a))}return r}_pointArrayToIndices(t){let e=[];for(let r of t)e.push(this._vertexToIndex(r.x,r.y));return e}};function sd(t,e,r,i=!0){return new ax(r,e).subdividePolygonInternal(t,i)}function lr(t,e,r=!1){if(!t||t.length<1||t.length<2)return[];let i=t[0],n=t[t.length-1],a=r&&(i.x!==n.x||i.y!==n.y);if(e<2)return a?[...t,t[0]]:[...t];let s=Math.floor(mt/e),o=[];o.push(new B(t[0].x,t[0].y));let l=t.length,u=a?l:l-1;for(let h=0;h<u;h++){let c=t[h],p=h<l-1?t[h+1]:t[0],f=c.x,d=c.y,y=p.x,m=p.y,g=f!==y,x=d!==m;if(!g&&!x)continue;let b=y-f,v=m-d,w=Math.abs(b),_=Math.abs(v),A=f,S=d;for(;;){let L=b>0?(Math.floor(A/s)+1)*s:(Math.ceil(A/s)-1)*s,O=v>0?(Math.floor(S/s)+1)*s:(Math.ceil(S/s)-1)*s,P=Math.abs(A-L),R=Math.abs(S-O),E=Math.abs(A-y),$=Math.abs(S-m),V=g?P/w:1/0,M=x?R/_:1/0;if((E<=P||!g)&&($<=R||!x))break;if(V<M&&g||!x){A=L,S+=v*V;let j=new B(A,Math.round(S));(o[o.length-1].x!==j.x||o[o.length-1].y!==j.y)&&o.push(j)}else{A+=b*M,S=O;let j=new B(Math.round(A),S);(o[o.length-1].x!==j.x||o[o.length-1].y!==j.y)&&o.push(j)}}let F=new B(y,m);(o[o.length-1].x!==F.x||o[o.length-1].y!==F.y)&&o.push(F)}return o}function sx(t){let e=[],r=[];for(let i of t)if(i.length!==0){i!==t[0]&&e.push(r.length/2);for(let n of i)r.push(n.x),r.push(n.y)}return{flattened:r,holeIndices:e}}function ox(t,e){let r=[];for(let i=0;i<e.length;i+=3){let n=e[i],a=e[i+1],s=e[i+2],o=t[n*2],l=t[n*2+1],u=t[a*2],h=t[a*2+1],c=t[s*2],p=t[s*2+1],f=u-o,d=h-l,y=c-o;f*(p-l)-d*y>0?(r.push(n),r.push(s),r.push(a)):(r.push(n),r.push(a),r.push(s))}return r}function lx(t,e,r){if(e.length===0)throw Error(\"Subdivision vertex ring is empty.\");let i=0,n=t[e[0]*2];for(let l=1;l<e.length;l++){let u=t[e[l]*2];u<n&&(n=u,i=l)}let a=e.length,s=i,o=(s+1)%a;for(;;){let l=s-1>=0?s-1:a-1,u=(o+1)%a,h=t[e[l]*2],c=t[e[l]*2+1],p=t[e[u]*2],f=t[e[u]*2+1],d=t[e[s]*2],y=t[e[s]*2+1],m=t[e[o]*2],g=t[e[o]*2+1],x=!1;if(h<p)x=!0;else if(h>p)x=!1;else{let b=g-y,v=-(m-d),w=y<g?1:-1;((h-d)*b+(c-y)*v)*w>((p-d)*b+(f-y)*v)*w&&(x=!0)}if(x){let b=e[l],v=e[s],w=e[o];b!==v&&b!==w&&v!==w&&r.push(w,v,b),s--,s<0&&(s=a-1)}else{let b=e[u],v=e[s],w=e[o];b!==v&&b!==w&&v!==w&&r.push(w,v,b),o++,o>=a&&(o=0)}if(l===u)break}}function od(t,e,r,i,n,a,s,o,l){let u=n.length/2,h=s&&o&&l;if(u<Qt.MAX_VERTEX_ARRAY_LENGTH){let c=e.prepareSegment(u,r,i),p=c.vertexLength;for(let y=0;y<a.length;y+=3)i.emplaceBack(p+a[y],p+a[y+1],p+a[y+2]);c.vertexLength+=u,c.primitiveLength+=a.length/3;let f,d;h&&(d=s.prepareSegment(u,r,o),f=d.vertexLength,d.vertexLength+=u);for(let y=0;y<n.length;y+=2)t(n[y],n[y+1]);if(h)for(let y of l){for(let m=1;m<y.length;m+=2)o.emplaceBack(f+y[m-1],f+y[m]);d.primitiveLength+=y.length/2}}else ux(e,r,i,n,a,t),h&&hx(s,r,o,n,l,t),e.forceNewSegmentOnNextPrepare(),s?.forceNewSegmentOnNextPrepare()}function Xi(t,e,r,i,n,a,s){if(a){let o=i.count;return r(e[n*2],e[n*2+1]),t[n]=i.count,i.count++,s.vertexLength++,o}return t[n]}function ux(t,e,r,i,n,a){let s=[];for(let c=0;c<i.length/2;c++)s.push(-1);let o={count:0},l=0,u=t.getOrCreateLatestSegment(e,r),h=u.vertexLength;for(let c=2;c<n.length;c+=3){let p=n[c-2],f=n[c-1],d=n[c],y=s[p]<l,m=s[f]<l,g=s[d]<l,x=+!!y+ +!!m+ +!!g;u.vertexLength+x>Qt.MAX_VERTEX_ARRAY_LENGTH&&(u=t.createNewSegment(e,r),l=o.count,y=!0,m=!0,g=!0,h=0);let b=Xi(s,i,a,o,p,y,u),v=Xi(s,i,a,o,f,m,u),w=Xi(s,i,a,o,d,g,u);r.emplaceBack(h+b-l,h+v-l,h+w-l),u.primitiveLength++}}function hx(t,e,r,i,n,a){let s=[];for(let c=0;c<i.length/2;c++)s.push(-1);let o={count:0},l=0,u=t.getOrCreateLatestSegment(e,r),h=u.vertexLength;for(let c of n)for(let p=1;p<c.length;p+=2){let f=c[p-1],d=c[p],y=s[f]<l,m=s[d]<l,g=+!!y+ +!!m;u.vertexLength+g>Qt.MAX_VERTEX_ARRAY_LENGTH&&(u=t.createNewSegment(e,r),l=o.count,y=!0,m=!0,h=0);let x=Xi(s,i,a,o,f,y,u),b=Xi(s,i,a,o,d,m,u);r.emplaceBack(h+x-l,h+b-l),u.primitiveLength++}}var ld=class{constructor(t){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.hasDependencies=!1,this.sdfPatterns={},this.patternFeatures=[],this.layoutVertexArray=new Nm,this.indexArray=new xn,this.indexArray2=new Ao,this.programConfigurations=new mr(t.layers,t.zoom),this.segments=new Qt,this.segments2=new Qt,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(t,e,r){this.hasDependencies=xa(\"fill\",this.layers,e);let i=this.layers[0].layout.get(\"fill-sort-key\"),n=!i.isConstant(),a=[],s=new at(this.zoom),o=this.layers[0]._featureFilter.needGeometry;for(let{feature:l,id:u,index:h,sourceLayerIndex:c}of t){let p=li(l,o);if(!this.layers[0]._featureFilter.filter(s,p,r))continue;let f=n?i.evaluate(p,{},r,e.availableImages):void 0,d={id:u,properties:l.properties,type:l.type,sourceLayerIndex:c,index:h,geometry:o?p.geometry:wr(l),patterns:{},sortKey:f};a.push(d)}n&&a.sort((l,u)=>l.sortKey-u.sortKey);for(let l of a){let{geometry:u,index:h,sourceLayerIndex:c}=l;if(this.hasDependencies){let f=Rl(\"fill\",this.layers,l,{zoom:this.zoom},e);this.patternFeatures.push(f)}else this.addFeature(l,u,h,r,{},e.subdivisionGranularity);let p=t[h].feature;e.featureIndex.insert(p,u,h,c,this.index)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,{imagePositions:r})}addFeatures({options:t,canonical:e,patternPositions:r,patternMap:i}){this.detectSdfPatterns(i);for(let n of this.patternFeatures)this.addFeature(n,n.geometry,n.index,e,r,t.subdivisionGranularity)}detectSdfPatterns(t){for(let e of this.patternFeatures)for(let r in e.patterns){let i=e.patterns[r];this.recordSdfPattern(r,t[i.min]),this.recordSdfPattern(r,t[i.mid]),this.recordSdfPattern(r,t[i.max])}for(let e of this.layers){let r=e.paint.get(\"fill-pattern\").constantOr(null);r&&(this.recordSdfPattern(e.id,t[r.from.toString()]),this.recordSdfPattern(e.id,t[r.to.toString()]))}}recordSdfPattern(t,e){if(!e)return;let r=e.sdf===!0,i=this.sdfPatterns[t];i===void 0?this.sdfPatterns[t]=r:i!==r&&Mt(`Style sheet warning: Cannot mix SDF and non-SDF fill patterns in layer \"${t}\"`)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Og),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(t,e,r,i,n,a){for(let s of Ba(e,500)){let o=sd(s,i,a.fill.getGranularityForZoomLevel(i.z)),l=this.layoutVertexArray;od((u,h)=>{l.emplaceBack(u,h)},this.segments,this.layoutVertexArray,this.indexArray,o.verticesFlattened,o.indicesTriangles,this.segments2,this.indexArray2,o.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{imagePositions:n,canonical:i})}};I(\"FillBucket\",ld,{omit:[\"layers\",\"patternFeatures\"]});var cx,px=()=>cx||(cx=new jt({\"fill-sort-key\":new U(D.layout_fill[\"fill-sort-key\"],\"fill-sort-key\")})),fx,dx=()=>fx||(fx=new jt({\"fill-antialias\":new z(D.paint_fill[\"fill-antialias\"],\"fill-antialias\"),\"fill-opacity\":new U(D.paint_fill[\"fill-opacity\"],\"fill-opacity\"),\"fill-layer-opacity\":new z(D.paint_fill[\"fill-layer-opacity\"],\"fill-layer-opacity\"),\"fill-color\":new U(D.paint_fill[\"fill-color\"],\"fill-color\"),\"fill-outline-color\":new U(D.paint_fill[\"fill-outline-color\"],\"fill-outline-color\"),\"fill-translate\":new z(D.paint_fill[\"fill-translate\"],\"fill-translate\"),\"fill-translate-anchor\":new z(D.paint_fill[\"fill-translate-anchor\"],\"fill-translate-anchor\"),\"fill-pattern\":new nn(D.paint_fill[\"fill-pattern\"],\"fill-pattern\")})),yx={get paint(){return dx()},get layout(){return px()}};var mx=class extends pe{constructor(t,e){super(t,yx,e)}recalculate(t,e){super.recalculate(t,e);let r=this.paint._values[\"fill-outline-color\"];r.value.kind===\"constant\"&&r.value.value===void 0&&(this.paint._values[\"fill-outline-color\"]=this.paint._values[\"fill-color\"])}createBucket(t){return new ld(t)}queryRadius(){return ja(this.paint.get(\"fill-translate\"))}queryIntersectsFeature({queryGeometry:t,geometry:e,transform:r,pixelsToTileUnits:i}){return Wf(Ga(t,this.paint.get(\"fill-translate\"),this.paint.get(\"fill-translate-anchor\"),-r.bearingInRadians,i),e)}isTileClipped(){return!0}},Ro=At([{name:\"a_pos\",components:2,type:\"Int16\"},{name:\"a_normal_ed\",components:4,type:\"Int16\"}],4),gx=At([{name:\"a_centroid\",components:2,type:\"Int16\"}],4),xx=Ro.members;Ro.size,Ro.alignment;var wa=class $o{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 r=new $o;return r.extend(e(new B(this.minX,this.minY))),r.extend(e(new B(this.maxX,this.minY))),r.extend(e(new B(this.minX,this.maxY))),r.extend(e(new B(this.maxX,this.maxY))),r}static fromPoints(e){let r=new $o;for(let i of e)r.extend(i);return r}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}},s5=wa.fromPoints([new B(0,0),new B(mt,mt)]);function No(t,e){return t.x===e.x&&(t.x<0||t.x>8192)||t.y===e.y&&(t.y<0||t.y>8192)}function Zh(t){return t.every(e=>e.x<0)||t.every(e=>e.x>8192)||t.every(e=>e.y<0)||t.every(e=>e.y>8192)}var vn=class{constructor(t,e,r,i,n){for(this.properties=Object.create(null),this.extent=r,this.type=0,this.id=void 0,this._pbf=t,this._geometry=-1,this._keys=i,this._values=n;t.pos<e;){let a=t.readVarint();if(a===8)this.id=t.readVarint();else if(a===18){let s=t.readVarint()+t.pos;for(;t.pos<s;){let o=i[t.readVarint()],l=n[t.readVarint()];this.properties[o]=l}}else a===24?this.type=t.readVarint():(a===34&&(this._geometry=t.pos),t.skip(a))}}loadGeometry(){if(this._geometry<0)throw Error(\"feature has no geometry\");let t=this._pbf;t.pos=this._geometry;let e=t.readVarint()+t.pos,r=[],i,n=1,a=0,s=0,o=0;for(;t.pos<e;){if(a<=0){let l=t.readVarint();if(n=l&7,a=l>>3,a===0)continue}if(a--,n===1)s+=t.readSVarint(),o+=t.readSVarint(),i&&r.push(i),i=[new B(s,o)];else if(n===2)s+=t.readSVarint(),o+=t.readSVarint(),i&&i.push(new B(s,o));else if(n===7)i&&i.push(i[0].clone());else throw Error(`unknown command ${n}`)}return i&&r.push(i),r}bbox(){if(this._geometry<0)throw Error(\"feature has no geometry\");let t=this._pbf;t.pos=this._geometry;let e=t.readVarint()+t.pos,r=1,i=0,n=0,a=0,s=1/0,o=-1/0,l=1/0,u=-1/0;for(;t.pos<e;){if(i<=0){let h=t.readVarint();if(r=h&7,i=h>>3,i===0)continue}if(i--,r===1||r===2)n+=t.readSVarint(),a+=t.readSVarint(),n<s&&(s=n),n>o&&(o=n),a<l&&(l=a),a>u&&(u=a);else if(r!==7)throw Error(`unknown command ${r}`)}return[s,l,o,u]}toGeoJSON(t,e,r){let i=this.extent*2**r,n=this.extent*t,a=this.extent*e,s=this.loadGeometry();function o(c){return[(c.x+n)*360/i-180,360/Math.PI*Math.atan(Math.exp((1-(c.y+a)*2/i)*Math.PI))-90]}function l(c){return c.map(o)}let u;if(this.type===1){let c=[];for(let f of s)c.push(f[0]);let p=l(c);u=c.length===1?{type:\"Point\",coordinates:p[0]}:{type:\"MultiPoint\",coordinates:p}}else if(this.type===2){let c=s.map(l);u=c.length===1?{type:\"LineString\",coordinates:c[0]}:{type:\"MultiLineString\",coordinates:c}}else if(this.type===3){let

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO this file should not be added to the repository if possible.
It's minified and the changes could grow the size of the repository.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not worried about repo size, since the repo is >200 MB and this file is ~500 KB.

I believe this file does need to be committed, because like plotcss.js, it must be included in the npm bundle (@camdecoster can confirm). IMO everything that goes into the npm bundle should be committed.

But the question of exactly where these files should live, and when they should be updated, is fair. Plausibly we could update the build/ files only on the release of a new version, the same way we do with dist/. I don't see a strong advanatage or disadvantage either way though.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the unminified file is added here, that would be fine. In that case only the changes to the dependency would be stored and reflected clearly.
But for the minified case like this, every small change would change the entire line number 4 which is a remarkable change for Git.
Also the version of maplibre-gl should be pinned down to avoid changes between patches e.g.
instead of

"maplibre-gl": "^6.9.0",

use

"maplibre-gl": "6.9.0",

in the package.json.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pinning the version is a good change and will keep this file from changing without our explicit effort. It's possible to build the file via npm script, but I think it's safer to keep this committed for now. We can always make a change if it's warranted in the future. Regarding the git history, the pin helps us there as well.

emilykl
emilykl previously approved these changes Sep 11, 2026

@emilykl emilykl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@camdecoster Looks good to me.

Could you open an issue for the selection bug? The code for the fix seems fine, but I'm not entirely clear on how to reproduce the bug.

Comment thread .github/workflows/ci.yml
- name: Verify entry point declarations are in sync
run: npm run entry-point-types-check

- name: Verify the inlined maplibre-gl worker is in sync

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@camdecoster Since this step has nothing to do with generated types, could you move it to a separate job?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant to do that before filing the PR. Thanks for the reminder.

Comment thread draftlogs/8035_fix.md Outdated
@@ -0,0 +1,3 @@
- Update `maplibre-gl` to v6 to address ([CVE-2026-85061](https://github.com/advisories/GHSA-jrc7-96c5-q579)) [[#8035](https://github.com/plotly/plotly.js/pull/8035)]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Update `maplibre-gl` to v6 to address ([CVE-2026-85061](https://github.com/advisories/GHSA-jrc7-96c5-q579)) [[#8035](https://github.com/plotly/plotly.js/pull/8035)]
- Update `maplibre-gl` to v6.9.0 to address ([CVE-2026-85061](https://github.com/advisories/GHSA-jrc7-96c5-q579)) [[#8035](https://github.com/plotly/plotly.js/pull/8035)]

Comment thread draftlogs/8035_fix.md Outdated
@@ -0,0 +1,3 @@
- Update `maplibre-gl` to v6 to address [CVE-2026-85061](https://github.com/advisories/GHSA-jrc7-96c5-q579) [[#8035](https://github.com/plotly/plotly.js/pull/8035)]
- `maplibre-gl` v6 dropped WebGL1 support, so some older browsers won't be able to use the map traces. Safari 15, Chrome 56, Firefox 51 and later are now required for the map traces.
- Box and lasso selection of `scattermap` points are now supported on a rotated or pitched map

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would put this as a separate bullet point (with a link to the same PR) since it's a related but entirely separate change

Comment thread build/README.md Outdated

There are exceptions for the files listed below. These files are used in the build process, but need to be generated prior to that.

- `plotcss.js`: The stylesheet compiled from `src/css/style.scss`. `src/core.js` requires it, so it must resolve.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- `plotcss.js`: The stylesheet compiled from `src/css/style.scss`. `src/core.js` requires it, so it must resolve.
- `plotcss.js`: The stylesheet compiled from `src/css/style.scss`. Required by `src/core.js`.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

Comment thread build/README.md

These files are committed and shipped in the npm package. Anyone who installs plotly.js and bundles it from `lib/` or `src/` resolves all of these, so leaving any out of the package breaks that build. These are specifically allowlisted in `.gitignore` and `.npmignore` for that reason.

`npm run preprocess` regenerates these files. Run that command and commit the result whenever the input changes.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`npm run preprocess` regenerates these files. Run that command and commit the result whenever the input changes.
`npm run preprocess` regenerates these files. Run that command and commit the result when required:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this change is necessary.

Comment thread src/plots/map/map.js
map.on('styleimagemissing', function (e) {
var id = e.id;
const requestedIcons = {};
map.setMissingStyleImageResolver((id) => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. Will this get rid of the console warnings that show up when using Maki icons?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It appears that this does get rid of the warnings. That wasn't the intention of this change, but let's take the win!

Comment thread CONTRIBUTING.md Outdated
- Tests are in `test/`; they are partitioned into `image` and `jasmine` tests
- Test dashboard and image viewer code is in `devtools/`
- Built files are in `build/` (the files in here are git-ignored, except for `plotcss.js`)
- Built files are in `build/` (mostly git-ignored; see `build/README.md`)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Built files are in `build/` (mostly git-ignored; see `build/README.md`)
- Built files are in `build/` (mostly git-ignored, with a few exceptions: see `build/README.md`)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

Comment thread tasks/util/bundle_maplibre_worker.js Outdated
write: false,
format: 'esm',
platform: 'browser',
target: 'es2020',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

esbuild-config.js uses target: 'es2016', is it a problem to target a different version here?

Would it make sense to pull this value (or any of the others) from our existing esbuild-config? I do realize that some of them need to be different.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! These should match.

Comment thread CONTRIBUTING.md Outdated
Comment on lines +223 to +226
- `npm run preprocess`: regenerates the sources that the build depends on, and
must be run manually when their inputs change. Commit the result.
`build/README.md` describes the committed files under `build/` and what
triggers each one.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- `npm run preprocess`: regenerates the sources that the build depends on, and
must be run manually when their inputs change. Commit the result.
`build/README.md` describes the committed files under `build/` and what
triggers each one.
- `npm run preprocess`: regenerates the sources that the build depends on, and
must be run manually when their inputs change. Commit the result.
`build/README.md` describes the committed files under `build/` and what
triggers each one. Note that the `preprocess` step is always run automatically
as part of `npm run build`.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

Comment thread draftlogs/8035_fix.md Outdated
@@ -0,0 +1,3 @@
- Update `maplibre-gl` to v6 to address [CVE-2026-85061](https://github.com/advisories/GHSA-jrc7-96c5-q579) [[#8035](https://github.com/plotly/plotly.js/pull/8035)]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be a change instead of a fix? I would tend to put a major version dependency bump as a change but since there's not much visible impact I don't feel strongly

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could be convinced of either direction. But I'll make this a change file and add a fix entry for the select update.

@camdecoster
camdecoster merged commit e8f6a7d into main Sep 13, 2026
87 checks passed
@camdecoster
camdecoster deleted the cam/8031/upgrade-maplibre-v6 branch September 13, 2026 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants