@blogmcp/sdk 0.3.2 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/client-types.d.ts +7 -1
- package/dist/core/client.d.ts +25 -1
- package/dist/core/client.js +38 -34
- package/dist/core/consultation-adapter.d.ts +90 -0
- package/dist/core/consultation-adapter.js +200 -0
- package/dist/core/consultations.d.ts +108 -0
- package/dist/core/consultations.js +95 -0
- package/dist/core/errors.d.ts +52 -0
- package/dist/core/errors.js +73 -0
- package/dist/core/index.d.ts +7 -1
- package/dist/core/index.js +80 -64
- package/dist/core/queries.d.ts +16 -1
- package/dist/core/queries.js +198 -61
- package/dist/core/review/format.d.ts +30 -0
- package/dist/core/review/format.js +78 -0
- package/dist/core/review/index.d.ts +6 -0
- package/dist/core/review/index.js +9 -0
- package/dist/core/review/types.d.ts +176 -0
- package/dist/core/review/types.js +9 -0
- package/dist/core/server-only.d.ts +12 -0
- package/dist/core/server-only.js +11 -0
- package/dist/core/types.d.ts +295 -0
- package/dist/packages/mdx-schema/dist/metadata/index.js +3 -3
- package/dist/packages/mdx-schema/dist/styles/index.js +7 -1
- package/dist/packages/mdx-schema/dist/tripmap.js +64 -51
- package/dist/packages/tripmap-core/dist/attribution.js +121 -6
- package/dist/packages/tripmap-core/dist/css.js +68 -16
- package/dist/packages/tripmap-core/dist/detail.js +10 -9
- package/dist/packages/tripmap-core/dist/engine.js +285 -247
- package/dist/packages/tripmap-core/dist/export.js +48 -46
- package/dist/packages/tripmap-core/dist/filmstrip.js +30 -17
- package/dist/packages/tripmap-core/dist/framing.js +30 -30
- package/dist/packages/tripmap-core/dist/generated/maplibre-worker.bundle.js +1 -1
- package/dist/packages/tripmap-core/dist/heading.js +8 -0
- package/dist/packages/tripmap-core/dist/href.js +18 -0
- package/dist/packages/tripmap-core/dist/index.js +32 -24
- package/dist/packages/tripmap-core/dist/lightbox.js +31 -29
- package/dist/packages/tripmap-core/dist/line.js +6 -6
- package/dist/packages/tripmap-core/dist/markers.js +47 -43
- package/dist/packages/tripmap-core/dist/nodes.js +56 -43
- package/dist/packages/tripmap-core/dist/playback.js +17 -17
- package/dist/packages/tripmap-core/dist/preload.js +14 -14
- package/dist/packages/tripmap-core/dist/theme.js +21 -21
- package/dist/{node_modules → packages/tripmap-core/node_modules}/maplibre-gl/dist/maplibre-gl.js +1890 -1720
- package/dist/{node_modules → packages/tripmap-core/node_modules}/pmtiles/dist/esm/index.js +1 -1
- package/package.json +8 -3
- package/src/core/client-types.ts +13 -2
- package/src/core/client.ts +40 -5
- package/src/core/consultation-adapter.ts +408 -0
- package/src/core/consultations.ts +224 -0
- package/src/core/errors.ts +145 -0
- package/src/core/index.ts +68 -0
- package/src/core/queries.ts +167 -3
- package/src/core/review/format.ts +138 -0
- package/src/core/review/index.ts +22 -0
- package/src/core/review/types.ts +168 -0
- package/src/core/server-only.ts +20 -0
- package/src/core/types.ts +337 -0
- /package/dist/{node_modules → packages/tripmap-core/node_modules}/maplibre-gl/dist/maplibre-gl-shared.js +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e = '(()=>{/**\n* MapLibre GL JS\n* @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v6.7.0/LICENSE.txt\n*/var Pf=Object.create,Xu=Object.defineProperty,zf=Object.getOwnPropertyDescriptor,Lf=Object.getOwnPropertyNames,Vf=Object.getPrototypeOf,Zu=Object.prototype.hasOwnProperty,Is=(t,e)=>()=>(e||(t((e={exports:{}}).exports,e),t=null),e.exports),Of=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(var n=Lf(e),a=0,s=n.length,o;a<s;a++)o=n[a],!Zu.call(t,o)&&o!==r&&Xu(t,o,{get:(l=>e[l]).bind(null,o),enumerable:!(i=zf(e,o))||i.enumerable});return t},Rf=(t,e,r)=>(r=t==null?{}:Pf(Vf(t)),Of(e||!t||!t.__esModule||!Zu.call(t,"default")?Xu(r,"default",{value:t,enumerable:!0}):r,t));function M(t,e){this.x=t,this.y=e}M.prototype={clone(){return new M(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:M},M.convert=function(t){if(t instanceof M)return t;if(Array.isArray(t))return new M(+t[0],+t[1]);if(t.x!==void 0&&t.y!==void 0)return new M(+t.x,+t.y);throw Error("Expected [x, y] or {x, y} point format")};function $f(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 Wo;function Nf(){return Wo??=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function",Wo}var Ti;function Uf(){if(Ti==null&&(Ti=!1,Nf())){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){Ti=!0;break}}}return Ti||!1}var qt=typeof Float32Array<"u"?Float32Array:Array;Math.PI/180,180/Math.PI;function qf(){var t=new qt(9);return qt!=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 Wu(){var t=new qt(3);return qt!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function Gf(t){var e=t[0],r=t[1],i=t[2];return Math.sqrt(e*e+r*r+i*i)}function Ho(t,e,r){var i=new qt(3);return i[0]=t,i[1]=e,i[2]=r,i}function jf(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 Yf(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function Xn(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 Xf=Gf;(function(){var t=Wu();return function(e,r,i,n,a,s){var o,l;for(r||=3,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 Zf(){var t=new qt(4);return qt!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function Wf(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 Hf(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=Zf();return function(e,r,i,n,a,s){var o,l;for(r||=4,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 Ko(){var t=new qt(4);return qt!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function Kf(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 Zn(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 Jf(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 Jo=Wf;(function(){var t=Wu(),e=Ho(1,0,0),r=Ho(0,1,0);return function(i,n,a){var s=Yf(n,a);return s<-.999999?(Xn(t,e,n),Xf(t)<1e-6&&Xn(t,r,n),jf(t,t),Kf(i,t,Math.PI),i):s>.999999?(i[0]=0,i[1]=0,i[2]=0,i[3]=1,i):(Xn(t,n,a),i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=1+s,Jo(i,i))}})(),function(){var t=Ko(),e=Ko();return function(r,i,n,a,s,o){return Zn(t,i,s,o),Zn(e,n,a,o),Zn(r,t,e,2*o*(1-o)),r}}(),function(){var t=qf();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],Jo(e,Jf(e,t))}}();function Qf(){var t=new qt(2);return qt!=Float32Array&&(t[0]=0,t[1]=0),t}(function(){var t=Qf();return function(e,r,i,n,a,s){var o,l;for(r||=2,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 it=8192;var Hu="__$json__:";function Wr(t){return t instanceof Error?t:Error(typeof t=="string"?t:String(t))}function td(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 ed(t,e,r,i){return $f(t,e,r,i)}var mw=ed(.25,.1,.25,1);function Hr(t,e,r){return Math.min(r,Math.max(e,t))}function rd(t,e,r){let i=r-e,n=((t-e)%i+i)%i+e;return n===e?r:n}function Tt(t,...e){for(let r of e)for(let i in r)t[i]=r[i];return t}function id(t){return Math.log(t)/Math.LN2%1==0}function dn(t,e,r){let i={};for(let n in t)i[n]=e.call(r||this,t[n],n,t);return i}function nd(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 de(t){return Array.isArray(t)?t.map(de):typeof t=="object"&&t?dn(t,de):t}var Qo={};function gt(t){Qo[t]||(typeof console<"u"&&console.warn(t),Qo[t]=!0)}function ye(t,e,r){return(r.y-t.y)*(e.x-t.x)>(e.y-t.y)*(r.x-t.x)}function Be(t){return typeof WorkerGlobalScope<"u"&&t!==void 0&&t instanceof WorkerGlobalScope}function yn(t){return typeof ImageBitmap<"u"&&t instanceof ImageBitmap}function ad(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 sd(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,ad(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 Ar,Dr;function od(t,e,r,i,n){let a=t.width,s=t.height;(!Ar||!Dr)&&(Ar=new OffscreenCanvas(a,s),Dr=Ar.getContext("2d",{willReadFrequently:!0})),Ar.width=a,Ar.height=s,Dr.drawImage(t,0,0,a,s);let o=Dr.getImageData(e,r,i,n);return Dr.clearRect(0,0,a,s),o.data}async function Ku(t,e,r,i,n){if(Uf())try{return await sd(t,e,r,i,n)}catch{}return od(t,e,r,i,n)}function tl(t,e,r,i){return t.addEventListener(e,r,i),{unsubscribe:()=>{t.removeEventListener(e,r,i)}}}function el(t){return t*Math.PI/180}var rl="AbortError",Ms=class extends Error{constructor(t=rl){super(t instanceof Error?t.message:t),this.name=rl,t instanceof Error&&t.stack&&(this.stack=t.stack)}};function Cs(t){return t instanceof Error&&t.name==="AbortError"}function ld(t){if(t.aborted)throw new Ms(t.reason)}var Bs={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function ud(t){return Bs.REGISTERED_PROTOCOLS[t.substring(0,t.indexOf("://"))]}function Ju(t,e){Bs.REGISTERED_PROTOCOLS[t]=e}function Qu(t){delete Bs.REGISTERED_PROTOCOLS[t]}var il="global-dispatcher",Ji=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 th(){if(Be(self))return self.worker?.referrer;if(window.location.protocol==="blob:")try{return window.parent.location.href}catch{}return window.location.href}var hd=t=>t.startsWith("file:")||th()?.startsWith("file:")&&!/^\\w+:/.test(t);async function cd(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:th(),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 Cs(s)?s:new Ji(0,Wr(s).message,t.url,new Blob)}if(!i.ok){let s=await i.blob();throw new Ji(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 ld(e.signal),{data:a,cacheControl:i.headers.get("Cache-Control"),expires:i.headers.get("Expires"),etag:i.headers.get("ETag")}}function pd(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 Ji(n.status,n.statusText,t.url,a))}},e.signal.addEventListener("abort",()=>{n.abort(),i(new Ms(e.signal.reason))}),n.send(t.body)})}var mn=async function(t,e){if(t.url.includes("://")&&!/^https?:|^file:/.test(t.url)){let r=ud(t.url);if(r){let i=await r(t,e);return!i.data&&t.type==="arrayBuffer"?Tt(i,{data:new ArrayBuffer(0)}):i}if(Be(self)&&self.worker?.actor)return self.worker.actor.sendAsync({type:"GR",data:t,targetMapId:il},e)}if(!hd(t.url)){if(fetch&&Request&&AbortController&&Object.hasOwn(Request.prototype,"signal"))return cd(t,e);if(Be(self)&&self.worker?.actor)return self.worker.actor.sendAsync({type:"GR",data:t,mustQueue:!0,targetMapId:il},e)}return pd(t,e)},eh=(t,e)=>mn(Tt(t,{type:"json"}),e),rh=(t,e)=>mn(Tt(t,{type:"arrayBuffer"}),e);function nl(t,e,r){r[t]?.includes(e)||(r[t]||=[],r[t].push(e))}function Wn(t,e,r){if(r?.[t]){let i=r[t].indexOf(e);i!==-1&&r[t].splice(i,1)}}var ih=class{constructor(t,e={}){Tt(this,e),this.type=t}},Qi=class extends ih{constructor(t,e={}){super("error",Tt({error:t},e))}},fd=class{on(t,e){return this._listeners||={},nl(t,e,this._listeners),{unsubscribe:()=>{this.off(t,e)}}}off(t,e){return Wn(t,e,this._listeners),Wn(t,e,this._oneTimeListeners),this}once(t,e){return e?(this._oneTimeListeners||={},nl(t,e,this._oneTimeListeners),this):new Promise(r=>this.once(t,r))}fire(t,e){let r=typeof t=="string"?new ih(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)Wn(i,o,this._oneTimeListeners),o.call(this,r);let s=this._eventedParent;s&&(Tt(r,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),s.fire(r))}else r instanceof Qi&&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}},nh={$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,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-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"}]}}}}},_=nh,ah=["type","source","source-layer","minzoom","maxzoom","filter","layout"],T=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__)}},ci={kind:"null"},k={kind:"number"},N={kind:"string"},Y={kind:"boolean"},Ut={kind:"color"},gn={kind:"projectionDefinition"},Ie={kind:"object"},q={kind:"value"},dd={kind:"error"},xn={kind:"collator"},pi={kind:"formatted"},vn={kind:"padding"},Kr={kind:"colorArray"},bn={kind:"numberArray"},fi={kind:"resolvedImage"},wn={kind:"variableAnchorOffsetCollection"};function St(t,e){return{kind:"array",itemType:t,N:e}}function rt(t){if(t.kind==="array"){let e=rt(t.itemType);return typeof t.N=="number"?`array<${e}, ${t.N}>`:t.itemType.kind==="value"?"array":`array<${e}>`}return t.kind}var yd=[ci,k,N,Y,Ut,gn,pi,Ie,St(q),vn,bn,Kr,fi,wn];function Jr(t,e){if(e.kind==="error")return null;if(t.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!Jr(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 yd)if(!Jr(r,e))return null}}return`Expected ${rt(t)} but found ${rt(e)} instead.`}function Ps(t,e){return e.some(r=>r.kind===t.kind)}function Me(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 sh=.96422,oh=.82521,lh=4/29,ga=6/29,uh=3*ga*ga,md=Math.PI/180,gd=180/Math.PI;function hh(t){return t%=360,t<0&&(t+=360),t}function ch([t,e,r,i]){t=Hn(t),e=Hn(e),r=Hn(r);let n,a,s=Kn((.2225045*t+.7168786*e+.0606169*r)/1);t===e&&e===r?n=a=s:(n=Kn((.4360747*t+.3850649*e+.1430804*r)/sh),a=Kn((.0139322*t+.0971045*e+.7141733*r)/oh));let o=116*s-16;return[o<0?0:o,500*(n-s),200*(s-a),i]}function Hn(t){return t<=.04045?t/12.92:((t+.055)/1.055)**2.4}function Kn(t){return t>.008856451679035631?t**(1/3):t/uh+lh}function ph([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*Qn(n),a=sh*Qn(a),s=oh*Qn(s),[Jn(3.1338561*a-1.6168667*n-.4906146*s),Jn(-.9787684*a+1.9161415*n+.033454*s),Jn(.0719453*a-.2289914*n+1.4052427*s),i]}function Jn(t){return t=t<=.00304?12.92*t:1.055*t**(1/2.4)-.055,t<0?0:t>1?1:t}function Qn(t){return t>ga?t*t*t:uh*(t-lh)}function xd(t){let[e,r,i,n]=ch(t),a=Math.sqrt(r*r+i*i);return[Math.round(a*1e4)?hh(Math.atan2(i,r)*gd):NaN,a,e,n]}function vd([t,e,r,i]){return t=isNaN(t)?0:t*md,ph([r,Math.cos(t)*e,Math.sin(t)*e,i])}function bd([t,e,r,i]){t=hh(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 wd=Object.hasOwn||function(t,e){return Object.prototype.hasOwnProperty.call(t,e)};function Ur(t,e){return wd(t,e)?t[e]:void 0}function _d(t){if(t=t.toLowerCase().trim(),t==="transparent")return[0,0,0,0];let e=Ur(Sd,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[Fi(t.slice(n,n+=i)),Fi(t.slice(n,n+=i)),Fi(t.slice(n,n+=i)),Fi(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=[We(+a/x,0,1),We(+l/x,0,1),We(+c/x,0,1),d?al(+d,y):1];if(sl(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,We(+s,0,100),We(+l,0,100),h?al(+h,c):1];if(sl(f))return bd(f)}}}function Fi(t){return parseInt(t.padEnd(2,t),16)/255}function al(t,e){return We(e?t/100:t,0,1)}function We(t,e,r){return Math.min(Math.max(e,t),r)}function sl(t){return!t.some(Number.isNaN)}var Sd={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 me(t,e,r){return t+r*(e-t)}function hr(t,e,r){return t.map((i,n)=>me(i,e[n],r))}function Ad(t){return t==="rgb"||t==="hcl"||t==="lab"}var nt=class Yt{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{this.black=new Yt(0,0,0,1)}static{this.white=new Yt(1,1,1,1)}static{this.transparent=new Yt(0,0,0,0)}static{this.red=new Yt(1,0,0,1)}static parse(e){if(e instanceof Yt)return e;if(typeof e!="string")return;let r=_d(e);if(r)return new Yt(...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",xd(this.rgb))}get lab(){return this.overwriteGetter("lab",ch(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]=hr(e.rgb,r.rgb,i);return new Yt(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]=vd([f,d??me(s,h,i),me(o,c,i),me(l,p,i)]);return new Yt(y,m,g,x,!1)}case"lab":{let[a,s,o,l]=ph(hr(e.lab,r.lab,i));return new Yt(a,s,o,l,!1)}}}},Dd=["bottom","center","top"],xa=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}},oe=class Gi{constructor(e){this.sections=e}static fromString(e){return new Gi([new xa(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 Gi?e:Gi.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}},Qt=class Pr{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Pr)return e;if(typeof e=="number")return new Pr([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 Pr(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,r,i){return new Pr(hr(e.values,r.values,i))}},te=class zr{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof zr)return e;if(typeof e=="number")return new zr([e]);if(Array.isArray(e)){for(let r of e)if(typeof r!="number")return;return new zr(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,r,i){return new zr(hr(e.values,r.values,i))}},Ot=class Lr{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Lr)return e;if(typeof e=="string"){let i=nt.parse(e);return i?new Lr([i]):void 0}if(!Array.isArray(e))return;let r=[];for(let i of e){if(typeof i!="string")return;let n=nt.parse(i);if(!n)return;r.push(n)}return new Lr(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(nt.interpolate(e.values[s],r.values[s],i,n));return new Lr(a)}},Q=class extends Error{constructor(t,e){super(t),this.name="RuntimeError",this.path=e}toJSON(){return this.message}},Ed=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]),Ht=class ji{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof ji)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"||!Ed.has(i)||!Array.isArray(n)||n.length!==2||typeof n[0]!="number"||typeof n[1]!="number")return}return new ji(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 Q(`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 Q(`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([me(u,c,i),me(h,p,i)])}return new ji(o)}},Kt=class fh{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new fh({name:e,available:!1}):null}},Oe=class He{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 He(e,r,i)}static parse(e){if(e instanceof He)return e;if(Array.isArray(e)&&e.length===3&&typeof e[0]=="string"&&typeof e[1]=="string"&&typeof e[2]=="number")return new He(e[0],e[1],e[2]);if(typeof e=="object"&&typeof e.from=="string"&&typeof e.to=="string"&&typeof e.transition=="number")return new He(e.from,e.to,e.transition);if(typeof e=="string")return new He(e,e,1)}},zs=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 dh(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 cr(t){if(t===null||typeof t=="string"||typeof t=="boolean"||typeof t=="number"||t instanceof Oe||t instanceof nt||t instanceof zs||t instanceof oe||t instanceof Qt||t instanceof te||t instanceof Ot||t instanceof Ht||t instanceof Kt)return!0;if(Array.isArray(t)){for(let e of t)if(!cr(e))return!1;return!0}if(typeof t=="object"){for(let e in t)if(!cr(t[e]))return!1;return!0}return!1}function lt(t){if(t===null)return ci;if(typeof t=="string")return N;if(typeof t=="boolean")return Y;if(typeof t=="number")return k;if(t instanceof nt)return Ut;if(t instanceof Oe)return gn;if(t instanceof zs)return xn;if(t instanceof oe)return pi;if(t instanceof Qt)return vn;if(t instanceof te)return bn;if(t instanceof Ot)return Kr;if(t instanceof Ht)return wn;if(t instanceof Kt)return fi;if(Array.isArray(t)){let e=t.length,r;for(let i of t){let n=lt(i);if(!r)r=n;else{if(r===n)continue;r=q;break}}return St(r||q,e)}return Ie}function qr(t){let e=typeof t;return t===null?"":e==="string"||e==="number"||e==="boolean"?String(t):t instanceof nt||t instanceof Oe||t instanceof oe||t instanceof Qt||t instanceof te||t instanceof Ot||t instanceof Ht||t instanceof Kt?t.toString():JSON.stringify(t)}var pr=class yh{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(!cr(e[1]))return r.error(`invalid value of type "${typeof e[1]}"`);let i=e[1],n=lt(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 yh(n,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}},Td=["Unknown","Point","LineString","Polygon"],mh=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"?Td[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=nt.parse(t),this._parseColorCache.set(t,e)),e}};function _n(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 Q("Input is not a number.",r);return 0}var Ls=class gh{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,k);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||=c.type,n.push([o,c])}return new gh(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[_n(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 Fd(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 Zt=class va{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=ta(r,e.base,i,n);else if(e.name==="linear")a=ta(r,1,i,n);else if(e.name==="cubic-bezier"){let s=e.controlPoints;a=Fd(s[0],s[1],s[2],s[3])(ta(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,k),!a)return null;let o=[],l=null;(i==="interpolate-hcl"||i==="interpolate-lab")&&r.expectedType!=Kr?l=Ut: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||=d.type,o.push([h,d])}return!ue(l,k)&&!ue(l,gn)&&!ue(l,Ut)&&!ue(l,vn)&&!ue(l,bn)&&!ue(l,Kr)&&!ue(l,wn)&&!ue(l,St(k))?r.error(`Type ${rt(l)} is not interpolatable.`):new va(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=_n(r,n,this.key),o=r[s],l=r[s+1],u=va.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 me(h,c,u);case"color":return nt.interpolate(h,c,u);case"padding":return Qt.interpolate(h,c,u);case"colorArray":return Ot.interpolate(h,c,u);case"numberArray":return te.interpolate(h,c,u);case"variableAnchorOffsetCollection":return Ht.interpolate(h,c,u,this.key);case"array":return hr(h,c,u);case"projectionDefinition":return Oe.interpolate(h,c,u)}case"interpolate-hcl":switch(this.type.kind){case"color":return nt.interpolate(h,c,u,"hcl");case"colorArray":return Ot.interpolate(h,c,u,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return nt.interpolate(h,c,u,"lab");case"colorArray":return Ot.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 ta(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 Pe={color:nt.interpolate,number:me,padding:Qt.interpolate,numberArray:te.interpolate,colorArray:Ot.interpolate,variableAnchorOffsetCollection:Ht.interpolate,array:hr},xh=class vh{constructor(e){this.type=pi,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,k),!l))return null;let u=null;if(o["text-font"]&&(u=r.parse(o["text-font"],1,St(N)),!u))return null;let h=null;if(o["text-color"]&&(h=r.parse(o["text-color"],1,Ut),!h))return null;let c=null;if(o["vertical-align"]){if(typeof o["vertical-align"]=="string"&&!Dd.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,N),!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,q);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 vh(n)}evaluate(e){return new oe(this.sections.map(r=>{let i=r.content.evaluate(e);return lt(i)===fi?new xa("",i,null,null,null,r.verticalAlign?r.verticalAlign.evaluate(e):null):new xa(qr(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 bh(t,e,r=0,i=t.length-1,n=kd){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);bh(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(Er(t,r,e),n(t[i],a)>0&&Er(t,r,i);s<o;){for(Er(t,s,o),s++,o--;n(t[s],a)<0;)s++;for(;n(t[o],a)>0;)o--}n(t[r],a)===0?Er(t,r,o):(o++,Er(t,o,i)),o<=e&&(r=o+1),e<=o&&(i=o-1)}}function Er(t,e,r){let i=t[e];t[e]=t[r],t[r]=i}function kd(t,e){return t<e?-1:+(t>e)}function Sn(t,e){if(t.length<=1)return[t];let r=[],i,n;for(let a of t){let s=Md(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||(bh(r[a],e,1,r[a].length-1,Id),r[a]=r[a].slice(0,e));return r}function Id(t,e){return e.area-t.area}function Md(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 ki={string:N,number:k,boolean:Y,object:Ie},ie=class wh{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 ki)||u==="object")return r.error(\'The item type argument of "array" must be one of string, number, boolean\',1);o=ki[u],i++}else o=q;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=St(o,l)}else{if(!ki[a])throw Error(`Types doesn\'t contain name = ${a}`);n=ki[a]}let s=[];for(;i<e.length;i++){let o=r.parse(e[i],i,q);if(!o)return null;s.push(o)}return new wh(n,s,r.key)}evaluate(e){for(let r=0;r<this.args.length;r++){let i=this.args[r].evaluate(e);if(!Jr(this.type,lt(i)))return i;if(r===this.args.length-1)throw new Q(`Expected value to be of type ${rt(this.type)}, but found ${rt(lt(i))} instead.`,this.key)}throw Error()}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}},ol={"to-boolean":Y,"to-color":Ut,"to-number":k,"to-string":N},tr=class _h{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(!ol[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=ol[i],a=[];for(let s=1;s<e.length;s++){let o=r.parse(e[s],s,q);if(!o)return null;a.push(o)}return new _h(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 nt)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.`:dh(r[0],r[1],r[2],r[3]),!i))return new nt(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new Q(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=Qt.parse(r);if(n)return n}throw new Q(`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=te.parse(r);if(n)return n}throw new Q(`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=Ot.parse(r);if(n)return n}throw new Q(`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=Ht.parse(r);if(n)return n}throw new Q(`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 Q(`Could not convert ${JSON.stringify(r)} to number.`,this.key)}case"formatted":return oe.fromString(qr(this.args[0].evaluate(e)));case"resolvedImage":return Kt.fromString(qr(this.args[0].evaluate(e)));case"projectionDefinition":{let r=this.args[0].evaluate(e);if(Oe.parse(r))return r;throw new Q(`Could not parse projectionDefinition from value \'${typeof r=="string"?r:JSON.stringify(r)}\'`,this.key)}default:return qr(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}},Sh=class Ah{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 Ah(i,n):null}outputDefined(){return this.result.outputDefined()}},Dh=class Eh{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 Eh(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}},Cd=class Th{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,k),n=r.parse(e[2],2,St(r.expectedType||q));if(!i||!n)return null;let a=n.type;return new Th(a.itemType,i,n,r.key)}evaluate(e){let r=this.index.evaluate(e),i=this.input.evaluate(e);if(r<0)throw new Q(`Array index out of bounds: ${r} < 0.`,this.key);if(r>=i.length)throw new Q(`Array index out of bounds: ${r} > ${i.length-1}.`,this.key);if(r!==Math.floor(r))throw new Q(`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}},Bd=class Fh{constructor(e,r,i){this.needle=e,this.haystack=r,this.key=i,this.type=Y}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,q),n=r.parse(e[2],2,q);return!i||!n?null:Ps(i.type,[Y,N,k,ci,q])?new Fh(i,n,r.key):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${rt(i.type)} instead`)}evaluate(e){let r=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(!i)return!1;if(!Me(r,["boolean","string","number","null"]))throw new Q(`Expected first argument to be of type boolean, string, number or null, but found ${rt(lt(r))} instead.`,this.key);if(!Me(i,["string","array"]))throw new Q(`Expected second argument to be of type array or string, but found ${rt(lt(i))} instead.`,this.key);return i.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}},Pd=class ba{constructor(e,r,i,n){this.needle=e,this.haystack=r,this.key=i,this.fromIndex=n,this.type=k}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,q),n=r.parse(e[2],2,q);if(!i||!n)return null;if(!Ps(i.type,[Y,N,k,ci,q]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${rt(i.type)} instead`);if(e.length===4){let a=r.parse(e[3],3,k);return a?new ba(i,n,r.key,a):null}return new ba(i,n,r.key)}evaluate(e){let r=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(!Me(r,["boolean","string","number","null"]))throw new Q(`Expected first argument to be of type boolean, string, number or null, but found ${rt(lt(r))} instead.`,this.key);let n;if(this.fromIndex&&(n=this.fromIndex.evaluate(e)),Me(i,["string"])){let a=i.indexOf(r,n);return a===-1?-1:[...i.slice(0,a)].length}if(Me(i,["array"]))return i.indexOf(r,n);throw new Q(`Expected second argument to be of type array or string, but found ${rt(lt(i))} instead.`,this.key)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}},zd=class kh{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=lt(d);else if(p.checkSubtype(i,lt(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||=f.type,s.push(f)}let o=r.parse(e[1],1,q);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 kh(i,n,o,a,s,l)}evaluate(e){let r=this.input.evaluate(e);return(lt(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}},Ld=class Ih{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,Y);if(!o)return null;let l=r.parse(e[s+1],s+1,i);if(!l)return null;n.push([o,l]),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 Ih(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()}},Vd=class wa{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,q),n=r.parse(e[2],2,k);if(!i||!n)return null;if(!Ps(i.type,[St(q),N,q]))return r.error(`Expected first argument to be of type array or string, but found ${rt(i.type)} instead`);if(e.length===4){let a=r.parse(e[3],3,k);return a?new wa(i.type,i,n,r.key,a):null}return new wa(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)),Me(r,["string"]))return[...r].slice(i,n).join("");if(Me(r,["array"]))return r.slice(i,n);throw new Q(`Expected first argument to be of type array or string, but found ${rt(lt(r))} instead.`,this.key)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}},Mh=class _a{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||=o.type,a.push(o)}if(!i)throw Error("No output type");return n&&a.some(s=>Jr(n,s.type))?new _a(q,a):new _a(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 Kt&&!r.available&&(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 ll(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 Od(t,e,r){return e===r}function Rd(t,e,r){return e!==r}function $d(t,e,r){return e<r}function Nd(t,e,r){return e>r}function Ud(t,e,r){return e<=r}function qd(t,e,r){return e>=r}function Ch(t,e,r,i){return i.compare(e,r)===0}function Gd(t,e,r,i){return!Ch(t,e,r,i)}function jd(t,e,r,i){return i.compare(e,r)<0}function Yd(t,e,r,i){return i.compare(e,r)>0}function Xd(t,e,r,i){return i.compare(e,r)<=0}function Zd(t,e,r,i){return i.compare(e,r)>=0}function xr(t,e,r){let i=t!=="=="&&t!=="!=";return class Bh{constructor(a,s,o,l){this.lhs=a,this.rhs=s,this.key=o,this.collator=l,this.type=Y,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,q);if(!l)return null;if(!ll(o,l.type))return s.concat(1).error(`"${o}" comparisons are not supported for type \'${rt(l.type)}\'.`);let u=s.parse(a[2],2,q);if(!u)return null;if(!ll(o,u.type))return s.concat(2).error(`"${o}" comparisons are not supported for type \'${rt(u.type)}\'.`);if(l.type.kind!==u.type.kind&&l.type.kind!=="value"&&u.type.kind!=="value")return s.error(`Cannot compare types \'${rt(l.type)}\' and \'${rt(u.type)}\'.`);i&&(l.type.kind==="value"&&u.type.kind!=="value"?l=new ie(u.type,[l],s.key):l.type.kind!=="value"&&u.type.kind==="value"&&(u=new ie(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,xn),!h)return null}return new Bh(l,u,s.key,h)}evaluate(a){let s=this.lhs.evaluate(a),o=this.rhs.evaluate(a);if(i&&this.hasUntypedArgument){let l=lt(s),u=lt(o);if(l.kind!==u.kind||l.kind!=="string"&&l.kind!=="number")throw new Q(`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=lt(s),u=lt(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 Wd=xr("==",Od,Ch),Hd=xr("!=",Rd,Gd),Kd=xr("<",$d,jd),Jd=xr(">",Nd,Yd),Qd=xr("<=",Ud,Xd),ty=xr(">=",qd,Zd),Ph=class zh{constructor(e,r,i){this.type=xn,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,Y);if(!n)return null;let a=r.parse(i["diacritic-sensitive"]!==void 0&&i["diacritic-sensitive"],1,Y);if(!a)return null;let s=null;return i.locale&&(s=r.parse(i.locale,1,N),!s)?null:new zh(n,a,s)}evaluate(e){return new zs(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}},ey=class Lh{constructor(e,r,i,n,a,s){this.type=N,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,k);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,N),!a))return null;let s=null;if(n.currency&&(s=r.parse(n.currency,1,N),!s))return null;let o=null;if(n.unit&&(o=r.parse(n.unit,1,N),!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,k),!l))return null;let u=null;return n["max-fraction-digits"]&&(u=r.parse(n["max-fraction-digits"],1,k),!u)?null:new Lh(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}},ry=class Vh{constructor(e){this.type=fi,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected two arguments.");let i=r.parse(e[1],1,N);return i?new Vh(i):r.error("No image name provided.")}evaluate(e){let r=this.input.evaluate(e),i=Kt.fromString(r);return i&&e.availableImages&&(i.available=e.availableImages.indexOf(r)>-1),i}eachChild(e){e(this.input)}outputDefined(){return!1}},iy=class Oh{constructor(e,r){this.input=e,this.key=r,this.type=k}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 ${rt(i.type)} instead.`):new Oh(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 Q(`Expected value to be of type string or array, but found ${rt(lt(r))} instead.`,this.key)}eachChild(e){e(this.input)}outputDefined(){return!1}},Wt=8192;function ny(t,e){let r=ay(t[0]),i=oy(t[1]),n=2**e.z;return[Math.round(r*n*Wt),Math.round(i*n*Wt)]}function Vs(t,e){let r=2**e.z,i=(t[0]/Wt+e.x)/r,n=(t[1]/Wt+e.y)/r;return[sy(i),ly(n)]}function ay(t){return(180+t)/360}function sy(t){return t*360-180}function oy(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function ly(t){return 360/Math.PI*Math.atan(Math.exp((180-t*360)*Math.PI/180))-90}function di(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 Qr(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function uy(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 hy(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 An(t,e,r,i){let n=[e[0]-t[0],e[1]-t[1]];return dy([i[0]-r[0],i[1]-r[1]],n)!==0&&!!(ul(t,e,r,i)&&ul(r,i,t,e))}function cy(t,e,r){for(let i of r)for(let n=0;n<i.length-1;++n)if(An(t,e,i[n],i[n+1]))return!0;return!1}function vr(t,e,r=!1){let i=!1;for(let n of e)for(let a=0;a<n.length-1;a++){if(hy(t,n[a],n[a+1]))return r;uy(t,n[a],n[a+1])&&(i=!i)}return i}function py(t,e){for(let r of e)if(vr(t,r))return!0;return!1}function Rh(t,e){for(let r of t)if(!vr(r,e))return!1;for(let r=0;r<t.length-1;++r)if(cy(t[r],t[r+1],e))return!1;return!0}function fy(t,e){for(let r of e)if(Rh(t,r))return!0;return!1}function dy(t,e){return t[0]*e[1]-t[1]*e[0]}function ul(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 Os(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=ny(t[n][s],r);di(e,o),a.push(o)}i.push(a)}return i}function $h(t,e,r){let i=[];for(let n=0;n<t.length;n++){let a=Os(t[n],e,r);i.push(a)}return i}function Nh(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}di(e,t)}function yy(t){t[0]=t[1]=1/0,t[2]=t[3]=-1/0}function hl(t,e,r,i){let n=2**i.z*Wt,a=[i.x*Wt,i.y*Wt],s=[];for(let o of t)for(let l of o){let u=[l.x+a[0],l.y+a[1]];Nh(u,e,r,n),s.push(u)}return s}function cl(t,e,r,i){let n=2**i.z*Wt,a=[i.x*Wt,i.y*Wt],s=[];for(let o of t){let l=[];for(let u of o){let h=[u.x+a[0],u.y+a[1]];di(e,h),l.push(h)}s.push(l)}if(e[2]-e[0]<=n/2){yy(e);for(let o of s)for(let l of o)Nh(l,e,r,n)}return s}function my(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=Os(e.coordinates,i,n),s=hl(t.geometry(),r,i,n);if(!Qr(r,i))return!1;for(let o of s)if(!vr(o,a))return!1}if(e.type==="MultiPolygon"){let a=$h(e.coordinates,i,n),s=hl(t.geometry(),r,i,n);if(!Qr(r,i))return!1;for(let o of s)if(!py(o,a))return!1}return!0}function gy(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=Os(e.coordinates,i,n),s=cl(t.geometry(),r,i,n);if(!Qr(r,i))return!1;for(let o of s)if(!Rh(o,a))return!1}if(e.type==="MultiPolygon"){let a=$h(e.coordinates,i,n),s=cl(t.geometry(),r,i,n);if(!Qr(r,i))return!1;for(let o of s)if(!fy(o,a))return!1}return!0}var Rs=class Yi{constructor(e,r){this.type=Y,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(cr(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 Yi(i,{type:"MultiPolygon",coordinates:n})}else if(i.type==="Feature"){let n=i.geometry.type;if(n==="Polygon"||n==="MultiPolygon")return new Yi(i,i.geometry)}else if(i.type==="Polygon"||i.type==="MultiPolygon")return new Yi(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 my(e,this.geometries);if(e.geometryType()==="LineString")return gy(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}},Uh=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}},pl=Math.PI/180,$s=class{constructor(t){let e=pl*6378.137*1e3,r=Math.cos(t*pl),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 qh(t,e){return e[0]-t[0]}function tn(t){return t[1]-t[0]+1}function le(t,e){return t[1]>=t[0]&&t[1]<e}function Sa(t,e){if(t[0]>t[1])return[null,null];let r=tn(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 Aa(t,e){if(!le(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)di(r,t[i]);return r}function Da(t){let e=[1/0,1/0,-1/0,-1/0];for(let r of t)for(let i of r)di(e,i);return e}function fl(t){return t[0]!==-1/0&&t[1]!==-1/0&&t[2]!==1/0&&t[3]!==1/0}function Ns(t,e,r){if(!fl(t)||!fl(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 Te(t,e,r){let i=r.pointOnLine(e,t);return r.distance(t,i.point)}function Us(t,e,r,i,n){let a=Math.min(Te(t,[r,i],n),Te(e,[r,i],n)),s=Math.min(Te(r,[t,e],n),Te(i,[t,e],n));return Math.min(a,s)}function xy(t,e,r,i,n){if(!(le(e,t.length)&&le(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(An(o,l,h,c))return 0;a=Math.min(a,Us(o,l,h,c,n))}}return a}function vy(t,e,r,i,n){if(!(le(e,t.length)&&le(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 by(t,e,r){if(vr(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,Te(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 wy(t,e,r,i){if(!le(e,t.length))return NaN;for(let a=e[0];a<=e[1];++a)if(vr(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(An(s,o,p,f))return 0;n=Math.min(n,Us(s,o,p,f,i))}}return n}function dl(t,e){for(let r of t)for(let i of r)if(vr(i,e,!0))return!0;return!1}function _y(t,e,r,i=1/0){let n=Da(t),a=Da(e);if(i!==1/0&&Ns(n,a,r)>=i)return i;if(Qr(n,a)){if(dl(t,e))return 0}else if(dl(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(An(c,p,g,x))return 0;s=Math.min(s,Us(c,p,g,x,r))}}return s}function yl(t,e,r,i,n,a){if(!a)return;let s=Ns(Aa(i,a),n,r);s<e&&t.push([s,a,[0,0]])}function Ii(t,e,r,i,n,a,s){if(!a||!s)return;let o=Ns(Aa(i,a),Aa(n,s),r);o<e&&t.push([o,a,s])}function en(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 Uh([[0,[0,t.length-1],[0,0]]],qh),o=Da(r);for(;s.length>0;){let l=s.pop();if(l[0]>=a)continue;let u=l[1],h=e?50:100;if(tn(u)<=h){if(!le(u,t.length))return NaN;if(e){let c=wy(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=by(t[c],r,i);if(a=Math.min(a,p),a===0)return 0}}else{let c=Sa(u,e);yl(s,a,i,t,o,c[0]),yl(s,a,i,t,o,c[1])}}return a}function rn(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 Uh([[0,[0,t.length-1],[0,r.length-1]]],qh);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(tn(u)<=c&&tn(h)<=p){if(!le(u,t.length)&&le(h,r.length))return NaN;let f;if(e&&i)f=xy(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=Te(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=Te(t[y],d,n),s=Math.min(s,f),s===0)return s}else f=vy(t,u,r,h,n),s=Math.min(s,f)}else{let f=Sa(u,e),d=Sa(h,i);Ii(o,s,n,t,r,f[0],d[0]),Ii(o,s,n,t,r,f[0],d[1]),Ii(o,s,n,t,r,f[1],d[0]),Ii(o,s,n,t,r,f[1],d[1])}}return s}function Sy(t,e){let r=t.geometry(),i=r.flat().map(s=>Vs([s.x,s.y],t.canonical));if(r.length===0)return NaN;let n=new $s(i[0][1]),a=1/0;for(let s of e){switch(s.type){case"Point":a=Math.min(a,rn(i,!1,[s.coordinates],!1,n,a));break;case"LineString":a=Math.min(a,rn(i,!1,s.coordinates,!0,n,a));break;case"Polygon":a=Math.min(a,en(i,!1,s.coordinates,n,a))}if(a===0)return a}return a}function Ay(t,e){let r=t.geometry(),i=r.flat().map(s=>Vs([s.x,s.y],t.canonical));if(r.length===0)return NaN;let n=new $s(i[0][1]),a=1/0;for(let s of e){switch(s.type){case"Point":a=Math.min(a,rn(i,!0,[s.coordinates],!1,n,a));break;case"LineString":a=Math.min(a,rn(i,!0,s.coordinates,!0,n,a));break;case"Polygon":a=Math.min(a,en(i,!0,s.coordinates,n,a))}if(a===0)return a}return a}function Dy(t,e){let r=t.geometry();if(r.length===0||r[0].length===0)return NaN;let i=Sn(r,0).map(s=>s.map(o=>o.map(l=>Vs([l.x,l.y],t.canonical)))),n=new $s(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,en([s.coordinates],!1,o,n,a));break;case"LineString":a=Math.min(a,en(s.coordinates,!0,o,n,a));break;case"Polygon":a=Math.min(a,_y(o,s.coordinates,n,a))}if(a===0)return a}return a}function ea(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 qs=class Xi{constructor(e,r){this.type=k,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(cr(e[1])){let i=e[1];if(i.type==="FeatureCollection")return new Xi(i,i.features.map(n=>ea(n.geometry)).flat());if(i.type==="Feature")return new Xi(i,ea(i.geometry));if("type"in i&&"coordinates"in i)return new Xi(i,ea(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 Sy(e,this.geometries);if(e.geometryType()==="LineString")return Ay(e,this.geometries);if(e.geometryType()==="Polygon")return Dy(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}},Ey=class Gh{constructor(e){let r=null;for(let i of e)if(!r)r=i.type;else{if(r===i.type)continue;r=q;break}this.type=St(r??q,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(!cr(e[1]))return r.error(`invalid value of type "${typeof e[1]}"`);let i=e[1],n=lt(i);if(n.kind==="array"){let a=i.map(s=>r.parse(s,null,q));return new Gh(a)}return new pr(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())}},Gs=class jh{constructor(e){this.key=e,this.type=q}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 jh(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:Ur(r,this.key)??null}eachChild(){}outputDefined(){return!1}},ir={"==":Wd,"!=":Hd,">":Jd,"<":Kd,">=":ty,"<=":Qd,array:ie,at:Cd,boolean:ie,case:Ld,coalesce:Mh,collator:Ph,format:xh,image:ry,in:Bd,"index-of":Pd,interpolate:Zt,"interpolate-hcl":Zt,"interpolate-lab":Zt,length:iy,let:Sh,literal:pr,match:zd,number:ie,"number-format":ey,object:ie,semiliteral:Ey,slice:Vd,step:Ls,string:ie,"to-boolean":tr,"to-color":tr,"to-number":tr,"to-string":tr,var:Dh,within:Rs,distance:qs,"global-state":Gs},Xt=class extends Error{constructor(t,e){super(e),this.message=e,this.key=t}},Ty=class Yh{constructor(e,r=[]){this.parent=e,this.bindings={};for(let[i,n]of r)this.bindings[i]=n}concat(e){return new Yh(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}},Xh=class Zh{constructor(e,r,i=[],n,a=new Ty,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 ie(s,[a],i):o==="coerce"?new tr(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 pr)&&o.type.kind!=="resolvedImage"&&this._isConstant(o)){let l=new mh;try{o=new pr(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 Zh(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 Xt(i,e))}checkSubtype(e,r){let i=Jr(e,r);return i&&this.error(i),i}},Re=class Vr{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=Vr.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 Xh(r.registry,nn,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 Vr(i,a,h,c,r.key)}}if(o.length===1)r.errors.push(...l.errors);else{let u=(o.length?o:s).map(([c])=>ky(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(rt(p.type))}r.error(`Expected arguments of type ${u}, but found (${h.join(", ")}) instead.`)}return null}static register(e,r){Vr.definitions=r;for(let i in r)e[i]=Vr}};function ml(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=dh(e,r,i,s);if(o)throw new Q(o,a);return new nt(e/255,r/255,i/255,s,!1)}function gl(t,e){return t in e&&e[t]!==void 0}function ra(t,e){let r=e[t];return r===void 0?null:r}function Fy(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 Se(t){return{type:t}}Re.register(ir,{error:[dd,[N],(t,[e],r)=>{throw new Q(e.evaluate(t),r)}],typeof:[N,[q],(t,[e])=>rt(lt(e.evaluate(t)))],"to-rgba":[St(k,4),[Ut],(t,[e])=>{let[r,i,n,a]=e.evaluate(t).rgb;return[r*255,i*255,n*255,a]}],rgb:[Ut,[k,k,k],ml],rgba:[Ut,[k,k,k,k],ml],has:{type:Y,overloads:[[[N],(t,[e])=>gl(e.evaluate(t),t.properties())],[[N,Ie],(t,[e,r])=>gl(e.evaluate(t),r.evaluate(t))]]},get:{type:q,overloads:[[[N],(t,[e])=>ra(e.evaluate(t),t.properties())],[[N,Ie],(t,[e,r])=>ra(e.evaluate(t),r.evaluate(t))]]},"feature-state":[q,[N],(t,[e])=>ra(e.evaluate(t),t.featureState||{})],properties:[Ie,[],t=>t.properties()],"geometry-type":[N,[],t=>t.geometryType()],id:[q,[],t=>t.id()],zoom:[k,[],t=>t.globals.zoom],"heatmap-density":[k,[],t=>t.globals.heatmapDensity||0],elevation:[k,[],t=>t.globals.elevation||0],"line-progress":[k,[],t=>t.globals.lineProgress||0],accumulated:[q,[],t=>t.globals.accumulated===void 0?null:t.globals.accumulated],"+":[k,Se(k),(t,e)=>{let r=0;for(let i of e)r+=i.evaluate(t);return r}],"*":[k,Se(k),(t,e)=>{let r=1;for(let i of e)r*=i.evaluate(t);return r}],"-":{type:k,overloads:[[[k,k],(t,[e,r])=>e.evaluate(t)-r.evaluate(t)],[[k],(t,[e])=>-e.evaluate(t)]]},"/":[k,[k,k],(t,[e,r])=>e.evaluate(t)/r.evaluate(t)],"%":[k,[k,k],(t,[e,r])=>e.evaluate(t)%r.evaluate(t)],ln2:[k,[],()=>Math.LN2],pi:[k,[],()=>Math.PI],e:[k,[],()=>Math.E],"^":[k,[k,k],(t,[e,r])=>e.evaluate(t)**+r.evaluate(t)],sqrt:[k,[k],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[k,[k],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[k,[k],(t,[e])=>Math.log(e.evaluate(t))],log2:[k,[k],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[k,[k],(t,[e])=>Math.sin(e.evaluate(t))],cos:[k,[k],(t,[e])=>Math.cos(e.evaluate(t))],tan:[k,[k],(t,[e])=>Math.tan(e.evaluate(t))],asin:[k,[k],(t,[e])=>Math.asin(e.evaluate(t))],acos:[k,[k],(t,[e])=>Math.acos(e.evaluate(t))],atan:[k,[k],(t,[e])=>Math.atan(e.evaluate(t))],min:[k,Se(k),(t,e)=>Math.min(...e.map(r=>r.evaluate(t)))],max:[k,Se(k),(t,e)=>Math.max(...e.map(r=>r.evaluate(t)))],abs:[k,[k],(t,[e])=>Math.abs(e.evaluate(t))],round:[k,[k],(t,[e])=>{let r=e.evaluate(t);return r<0?-Math.round(-r):Math.round(r)}],floor:[k,[k],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[k,[k],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[Y,[N,q],(t,[e,r])=>t.properties()[e.value]===r.value],"filter-id-==":[Y,[q],(t,[e])=>t.id()===e.value],"filter-type-==":[Y,[N],(t,[e])=>t.geometryType()===e.value],"filter-<":[Y,[N,q],(t,[e,r])=>{let i=t.properties()[e.value],n=r.value;return typeof i==typeof n&&i<n}],"filter-id-<":[Y,[q],(t,[e])=>{let r=t.id(),i=e.value;return typeof r==typeof i&&r<i}],"filter->":[Y,[N,q],(t,[e,r])=>{let i=t.properties()[e.value],n=r.value;return typeof i==typeof n&&i>n}],"filter-id->":[Y,[q],(t,[e])=>{let r=t.id(),i=e.value;return typeof r==typeof i&&r>i}],"filter-<=":[Y,[N,q],(t,[e,r])=>{let i=t.properties()[e.value],n=r.value;return typeof i==typeof n&&i<=n}],"filter-id-<=":[Y,[q],(t,[e])=>{let r=t.id(),i=e.value;return typeof r==typeof i&&r<=i}],"filter->=":[Y,[N,q],(t,[e,r])=>{let i=t.properties()[e.value],n=r.value;return typeof i==typeof n&&i>=n}],"filter-id->=":[Y,[q],(t,[e])=>{let r=t.id(),i=e.value;return typeof r==typeof i&&r>=i}],"filter-has":[Y,[q],(t,[e])=>{let r=e.value,i=t.properties();return r in i&&i[r]!==void 0}],"filter-has-id":[Y,[],t=>t.id()!==null&&t.id()!==void 0],"filter-type-in":[Y,[St(N)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[Y,[St(q)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[Y,[N,St(q)],(t,[e,r])=>r.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[Y,[N,St(q)],(t,[e,r])=>Fy(t.properties()[e.value],r.value,0,r.value.length-1)],all:{type:Y,overloads:[[[Y,Y],(t,[e,r])=>e.evaluate(t)&&r.evaluate(t)],[Se(Y),(t,e)=>{for(let r of e)if(!r.evaluate(t))return!1;return!0}]]},any:{type:Y,overloads:[[[Y,Y],(t,[e,r])=>e.evaluate(t)||r.evaluate(t)],[Se(Y),(t,e)=>{for(let r of e)if(r.evaluate(t))return!0;return!1}]]},"!":[Y,[Y],(t,[e])=>!e.evaluate(t)],"is-supported-script":[Y,[N],(t,[e])=>{let r=t.globals&&t.globals.isSupportedScript;return!r||r(e.evaluate(t))}],upcase:[N,[N],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[N,[N],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[N,Se(q),(t,e)=>e.map(r=>qr(r.evaluate(t))).join("")],split:[St(N),[N,N],(t,[e,r])=>e.evaluate(t).split(r.evaluate(t))],join:[N,[St(N),N],(t,[e,r])=>e.evaluate(t).join(r.evaluate(t))],"resolved-locale":[N,[xn],(t,[e])=>e.evaluate(t).resolvedLocale()]});function ky(t){return Array.isArray(t)?`(${t.map(rt).join(", ")})`:`(${rt(t.type)}...)`}function nn(t){if(t instanceof Dh)return nn(t.boundExpression);if(t instanceof Re&&t.name==="error"||t instanceof Ph||t instanceof Rs||t instanceof qs||t instanceof Gs)return!1;let e=t instanceof tr||t instanceof ie,r=!0;return t.eachChild(i=>{r&&=e?nn(i):i instanceof pr}),r?Dn(t)&&En(t,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"]):!1}function Dn(t){if(t instanceof Re&&(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 Rs||t instanceof qs)return!1;let e=!0;return t.eachChild(r=>{e&&!Dn(r)&&(e=!1)}),e}function ti(t){if(t instanceof Re&&t.name==="feature-state")return!1;let e=!0;return t.eachChild(r=>{e&&!ti(r)&&(e=!1)}),e}function En(t,e){if(t instanceof Re&&e.indexOf(t.name)>=0)return!1;let r=!0;return t.eachChild(i=>{r&&!En(i,e)&&(r=!1)}),r}function fr(t){return t["property-type"]==="data-driven"||t["property-type"]==="cross-faded-data-driven"}function Wh(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function js(t){return!!t.expression&&t.expression.interpolated}function ei(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 Tn(t){return typeof t=="object"&&!!t&&!Array.isArray(t)&<(t)===Ie}function Iy(t){return t}function My(t){switch(t.type){case"color":return nt.parse;case"padding":return Qt.parse;case"numberArray":return te.parse;case"colorArray":return Ot.parse;default:return null}}function Cy(t){switch(t){case"exponential":return Kh;case"interval":return Py;case"categorical":return By;case"identity":return zy;default:throw Error(`Unknown function type "${t}"`)}}function Hh(t,e){let r=t.stops&&typeof t.stops[0][0]=="object",i=r||t.property!==void 0,n=r||!i,a=t.type||(js(e)?"exponential":"interval"),s=My(e);if(s&&(t=ei({},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&&!Ad(t.colorSpace))throw Error(`Unknown color space: "${t.colorSpace}"`);let o=Cy(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,Hh(h[d],e)]);let f={name:"linear"};return{kind:"composite",interpolationType:f,interpolationFactor:Zt.interpolationFactor.bind(void 0,f),zoomStops:p.map(d=>d[0]),evaluate({zoom:d},y){return Kh({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:Zt.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?yi(t.default,e.default):o(t,e,p,l,u)}}}function yi(t,e,r){if(t!==void 0)return t;if(e!==void 0)return e;if(r!==void 0)return r}function By(t,e,r,i,n){return yi(typeof r===n?i[r]:void 0,t.default,e.default)}function Py(t,e,r){if(j(r)!=="number")return yi(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=_n(t.stops.map(a=>a[0]),r,"");return t.stops[n][1]}function Kh(t,e,r){let i=t.base===void 0?1:t.base;if(j(r)!=="number")return yi(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=_n(t.stops.map(h=>h[0]),r,""),s=Ly(r,i,t.stops[a][0],t.stops[a+1][0]),o=t.stops[a][1],l=t.stops[a+1][1],u=Pe[e.type]||Iy;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 zy(t,e,r){switch(e.type){case"color":r=nt.parse(r);break;case"formatted":r=oe.fromString(r.toString());break;case"resolvedImage":r=Kt.fromString(r.toString());break;case"padding":r=Qt.parse(r);break;case"colorArray":r=Ot.parse(r);break;case"numberArray":r=te.parse(r);break;default:j(r)!==e.type&&(e.type!=="enum"||!e.values[r])&&(r=void 0)}return yi(r,t.default,e.default)}function Ly(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 Ea(t){return{result:"success",value:t}}function Ke(t){return{result:"error",value:t}}var Ys=class{constructor(t,e,r,i){this.expression=t,this._warningHistory={},this._evaluator=new mh,this._defaultValue=r?ic(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=dr(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=dr(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 Q(`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 Q?s.path:"",l=`${o}|${s.message}`;return this._warningHistory[l]||(this._warningHistory[l]=!0,typeof console<"u"&&console.warn(Jh(this._rootKey,o,s.message,this._defaultValue))),this._defaultValue}}};function Jh(t,e,r,i){return`${t}${e}: ${r}${i==null?"":` Falling back to ${String(i)}.`}`}function Qh(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 Fn(t){return Array.isArray(t)&&t.length>0&&typeof t[0]=="string"&&t[0]in ir}function ve(t,e,r,i){Qh(e);let n=new Xh(ir,nn,[],r?Ry(r):void 0),a=n.parse(t,void 0,void 0,void 0,r&&r.type==="string"?{typeAnnotation:"coerce"}:void 0);return a?Ea(new Ys(a,e,r,i)):Ke(n.errors)}var ri=class{constructor(t,e,r){this.kind=t,this._styleExpression=e,this.isStateDependent=t!=="constant"&&!ti(e.expression),this.globalStateRefs=mi(e.expression),this._globalState=r}evaluateWithoutErrorHandling(t,e,r,i,n,a){return this._globalState&&(t=dr(t,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t,e,r,i,n,a)}evaluate(t,e,r,i,n,a){return this._globalState&&(t=dr(t,this._globalState)),this._styleExpression.evaluate(t,e,r,i,n,a)}},an=class{constructor(t,e,r,i,n){this.kind=t,this.zoomStops=r,this._styleExpression=e,this.isStateDependent=t!=="camera"&&!ti(e.expression),this.globalStateRefs=mi(e.expression),this.interpolationType=i,this._globalState=n}evaluateWithoutErrorHandling(t,e,r,i,n,a){return this._globalState&&(t=dr(t,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t,e,r,i,n,a)}evaluate(t,e,r,i,n,a){return this._globalState&&(t=dr(t,this._globalState)),this._styleExpression.evaluate(t,e,r,i,n,a)}interpolationFactor(t,e,r){return this.interpolationType?Zt.interpolationFactor(this.interpolationType,t,e,r):0}};function Vy(t){return t._styleExpression!==void 0}function tc(t,e,r,i){let n=ve(t,e,r,i);if(n.result==="error")return n;let a=n.value.expression,s=Dn(a);if(!s&&!fr(r))return Ke([new Xt("","data expressions not supported")]);let o=En(a,["zoom"]);if(!o&&!Wh(r))return Ke([new Xt("","zoom expressions not supported")]);let l=Zi(a);if(!l&&!o)return Ke([new Xt("",\'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.\')]);if(l instanceof Xt)return Ke([l]);if(l instanceof Zt&&!js(r))return Ke([new Xt("",\'"interpolate" expressions cannot be used with this property\')]);if(!l)return Ea(s?new ri("constant",n.value,i):new ri("source",n.value,i));let u=l instanceof Zt?l.interpolation:void 0;return Ea(s?new an("camera",n.value,l.labels,u,i):new an("composite",n.value,l.labels,u,i))}var ec=class rc{constructor(e,r,i){this.isStateDependent=!1,this.globalStateRefs=new Set,this._globalState=null,Qh(r),this._parameters=e,this._specification=i,this._rootKey=r,this._defaultValue=ic(i),this._warningHistory={};let n=Hh(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(Jh(this._rootKey,"",n,this._defaultValue))),this._defaultValue}}static deserialize(e){return new rc(e._parameters,e._rootKey,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification,_rootKey:e._rootKey}}};function Oy(t,e,r,i){if(Tn(t))return new ec(t,e,r);if(Fn(t)){let n=tc(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=nt.parse(t):r.type==="padding"&&(typeof t=="number"||Array.isArray(t))?n=Qt.parse(t):r.type==="numberArray"&&(typeof t=="number"||Array.isArray(t))?n=te.parse(t):r.type==="colorArray"&&(typeof t=="string"||Array.isArray(t))?n=Ot.parse(t):r.type==="variableAnchorOffsetCollection"&&Array.isArray(t)?n=Ht.parse(t):r.type==="projectionDefinition"&&typeof t=="string"&&(n=Oe.parse(t)),{globalStateRefs:new Set,_globalState:null,kind:"constant",evaluate:()=>n}}}function Zi(t){let e=null;if(t instanceof Sh)e=Zi(t.result);else if(t instanceof Mh){for(let r of t.args)if(e=Zi(r),e)break}else(t instanceof Ls||t instanceof Zt)&&t.input instanceof Re&&t.input.name==="zoom"&&(e=t);return e instanceof Xt||t.eachChild(r=>{let i=Zi(r);i instanceof Xt?e=i:!e&&i?e=new Xt("",\'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.\'):e&&i&&e!==i&&(e=new Xt("",\'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.\'))}),e}function mi(t,e=new Set){return t instanceof Gs&&e.add(t.key),t.eachChild(r=>{mi(r,e)}),e}function Ry(t){let e={color:Ut,string:N,number:k,enum:N,boolean:Y,formatted:pi,padding:vn,numberArray:bn,colorArray:Kr,projectionDefinition:gn,resolvedImage:fi,variableAnchorOffsetCollection:wn};return t.type==="array"?St(e[t.value]||q,t.length):e[t.type]}function ic(t){if(t.type==="color"&&Tn(t.default))return new nt(0,0,0,0);switch(t.type){case"color":return nt.parse(t.default)||null;case"padding":return Qt.parse(t.default)||null;case"numberArray":return te.parse(t.default)||null;case"colorArray":return Ot.parse(t.default)||null;case"variableAnchorOffsetCollection":return Ht.parse(t.default)||null;case"projectionDefinition":return Oe.parse(t.default)||null;default:return t.default===void 0?null:t.default}}function dr(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 $y(t){let e=!1;for(let r of t){let i=nc(r);if(i==="expression")return"expression";i==="legacy"&&(e=!0)}return e?"legacy":"neutral"}function nc(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 $y(t.slice(1));default:return"expression"}}function Xs(t){return nc(t)!=="legacy"}function xl(t){return t==="$type"?["geometry-type"]:t==="$id"?["id"]:["get",t]}function Ny(t){switch(t[0]){case"==":case"!=":case"<":case"<=":case">":case">=":return t.length!==3||typeof t[1]!="string"?null:[t[0],xl(t[1]),t[2]];case"in":case"!in":{if(t.length<2||typeof t[1]!="string")return null;let e=["in",xl(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 ac(t){if((t[0]==="<"||t[0]==="<="||t[0]===">"||t[0]===">=")&&t[1]==="$type")return`"$type" cannot be use with operator "${t[0]}"`;let e=Ny(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 ia(t,e,r){let i=r[t];return Array.isArray(i)?Xs(i)?Zs(i,e.concat(t)):{path:e.concat(t),legacyFilter:i}:null}function Zs(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=ia(r,e,t);if(i)return i}break;case"!":{let r=ia(1,e,t);if(r)return r;break}case"case":for(let r=1;r<t.length-1;r+=2){let i=ia(r,e,t);if(i)return i}}return null}function Uy(t,e){let r=Zs(t);if(!r||typeof console>"u")return;let i=r.path.map(n=>`[${n}]`).join("");console.warn(`${e}${i}: ${ac(r.legacyFilter)}`)}var qy={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function yr(t,e,r){if(t==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};Xs(t)?Uy(t,e):t=sn(t);let i=ve(t,e,qy,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:sc(t),getGlobalStateRefs:()=>mi(i.value.expression)}}function Gy(t,e){return t<e?-1:+(t>e)}function sc(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(sc(t[e]))return!0;return!1}function sn(t){if(!t)return!0;let e=t[0];return t.length<=1?e!=="any":e==="=="?na(t[1],t[2],"=="):e==="!="?Mi(na(t[1],t[2],"==")):e==="<"||e===">"||e==="<="||e===">="?na(t[1],t[2],e):e==="any"?jy(t.slice(1)):e==="all"?["all"].concat(t.slice(1).map(sn)):e==="none"?["all"].concat(t.slice(1).map(sn).map(Mi)):e==="in"?vl(t[1],t.slice(2)):e==="!in"?Mi(vl(t[1],t.slice(2))):e==="has"?bl(t[1]):e!=="!has"||Mi(bl(t[1]))}function na(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 jy(t){return["any"].concat(t.map(sn))}function vl(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(Gy)]]:["filter-in-small",t,["literal",e]]}}function bl(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function Mi(t){return["!",t]}function oc(t){let e=t.key,r=t.value;return r?[new T(e,r,"constants have been deprecated as of v8")]:[]}function ot(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function ze(t){if(Array.isArray(t))return t.map(ze);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){let e={};for(let r in t)e[r]=ze(t[r]);return e}return ot(t)}function Mt(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 T(e,r,`object expected, ${u} found`)];for(let h in r){let c=h.split(".")[0],p=Ur(i,c)||i["*"],f;if(Ur(n,c))f=n[c];else if(Ur(i,c)){if(r[h]===void 0)continue;f=o}else if(n["*"])f=n["*"];else if(i["*"])f=o;else{l.push(new T(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 T(e,r,`missing required property "${h}"`));return l}function Ws(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 T(s,e,`array expected, ${j(e)} found`)];if(r.length&&e.length!==r.length)return[new T(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 kn(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 T(e,r,`${r} is less than the minimum value ${i.minimum}`)]:"maximum"in i&&r>i.maximum?[new T(e,r,`${r} is greater than the maximum value ${i.maximum}`)]:[]:[new T(e,r,`number expected, ${n} found`)]}function lc(t){let e=t.valueSpec,r=ot(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=Mt({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 T(t.key,t.value,\'missing required property "property"\')),r!=="identity"&&!t.value.stops&&h.push(new T(t.key,t.value,\'missing required property "stops"\')),r==="exponential"&&t.valueSpec.expression&&!js(t.valueSpec)&&h.push(new T(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!fr(t.valueSpec)?h.push(new T(t.key,t.value,"property functions not supported")):o&&!Wh(t.valueSpec)&&h.push(new T(t.key,t.value,"zoom functions not supported"))),(r==="categorical"||u)&&t.value.property===void 0&&h.push(new T(t.key,t.value,\'"property" property is required\')),h;function c(y){if(r==="identity")return[new T(y.key,y.value,\'identity function may not have a "stops" property\')];let m=[],g=y.value;return m=m.concat(Ws({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 T(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 T(x,g,`array expected, ${j(g)} found`)];if(g.length!==2)return[new T(x,g,`array length 2 expected, length ${g.length} found`)];if(u){if(j(g[0])!=="object")return[new T(x,g,`object expected, ${j(g[0])} found`)];if(g[0].zoom===void 0)return[new T(x,g,"object stop key must have zoom")];if(g[0].value===void 0)return[new T(x,g,"object stop key must have value")];if(s&&s>ot(g[0].zoom))return[new T(x,g[0].zoom,"stop zoom values must appear in ascending order")];ot(g[0].zoom)!==s&&(s=ot(g[0].zoom),a=void 0,n={}),m=m.concat(Mt({key:`${x}[0]`,value:g[0],valueSpec:{zoom:{}},validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec,objectElementValidators:{zoom:kn,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 Fn(ze(g[1]))?m.concat([new T(`${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=ot(y.value),b=y.value===null?m:y.value;if(!i)i=g;else if(g!==i)return[new T(y.key,b,`${g} stop domain type must match previous stop domain type ${i}`)];if(g!=="number"&&g!=="string"&&g!=="boolean")return[new T(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 fr(e)&&r===void 0&&(v+=\'\\nIf you intended to use a categorical function, specify `"type": "categorical"`.\'),[new T(y.key,b,v)]}return r==="categorical"&&g==="number"&&(!isFinite(x)||Math.floor(x)!==x)?[new T(y.key,b,`integer expected, found ${x}`)]:r!=="categorical"&&g==="number"&&a!==void 0&&x<a?[new T(y.key,b,"stop domain values must appear in ascending order")]:(a=x,r==="categorical"&&x in n?[new T(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 mr(t){let e=(t.expressionContext==="property"?tc:ve)(ze(t.value),t.key,t.valueSpec);if(e.result==="error")return e.value.map(i=>new T(`${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 T(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"&&!ti(r))return[new T(t.key,t.value,\'"feature-state" data expressions are not supported with layout properties.\')];if(t.expressionContext==="filter"&&!ti(r))return[new T(t.key,t.value,\'"feature-state" data expressions are not supported with filters.\')];if(t.expressionContext&&t.expressionContext.indexOf("cluster")===0){if(!En(r,["zoom","feature-state"]))return[new T(t.key,t.value,\'"zoom" and "feature-state" expressions are not supported with cluster properties.\')];if(t.expressionContext==="cluster-initial"&&!Dn(r))return[new T(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Yy(t){let e=t.value,r=t.key,i=j(e);return i==="boolean"?[]:[new T(r,e,`boolean expected, ${i} found`)]}function Ta(t){let e=t.key,r=t.value,i=j(r);return i==="string"?nt.parse(String(r))?[]:[new T(e,r,`color expected, "${r}" found`)]:[new T(e,r,`color expected, ${i} found`)]}function ii(t){let e=t.key,r=t.value,i=t.valueSpec,n=[];return Array.isArray(i.values)?i.values.indexOf(ot(r))===-1&&n.push(new T(e,r,`expected one of [${i.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(i.values).indexOf(ot(r))===-1&&n.push(new T(e,r,`expected one of [${Object.keys(i.values).join(", ")}], ${JSON.stringify(r)} found`)),n}function Xy(t,e){let r=t;for(let i of e)r=r[i];return r}function Zy(t,e){let r=Zs(e);return r?[new T(`${t.key}${r.path.map(i=>`[${i}]`).join("")}`,Xy(t.value,r.path),ac(r.legacyFilter),null,"warning")]:[]}function Hs(t){let e=ze(t.value);return Xs(e)?[...Zy(t,e),...mr(ei({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}}))]:uc(t)}function uc(t){let e=t.value,r=t.key;if(j(e)!=="array")return[new T(r,e,`array expected, ${j(e)} found`)];let i=t.styleSpec,n,a=[];if(e.length<1)return[new T(r,e,"filter array must have at least 1 element")];switch(a=a.concat(ii({key:`${r}[0]`,value:e[0],valueSpec:i.filter_operator,style:t.style,styleSpec:t.styleSpec})),ot(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&ot(e[1])==="$type"&&a.push(new T(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&a.push(new T(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 T(`${r}[1]`,e[1],`string expected, ${n} found`)));for(let s=2;s<e.length;s++)n=j(e[s]),ot(e[1])==="$type"?a=a.concat(ii({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 T(`${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(uc({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 T(`${r}[1]`,e[1],`string expected, ${n} found`)):a.push(new T(r,e,`filter array for "${e[0]}" operator must have 2 elements`))}return a}function hc(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(/^(.*)-transition$/);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 T(r,s,`unknown property "${o}"`)];let c;if(j(s)==="string"&&fr(h)&&!h.tokens&&(c=/^{([^}]+)}$/.exec(s)))return[new T(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"&&Tn(ze(s))&&ot(s.type)==="identity"&&p.push(new T(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 cc(t){return hc(t,"paint")}function pc(t){return hc(t,"layout")}function fc(t){let e=[],r=t.value,i=t.key,n=t.style,a=t.styleSpec;if(j(r)!=="object")return[new T(i,r,`object expected, ${j(r)} found`)];!r.type&&!r.ref&&e.push(new T(i,r,\'either "type" or "ref" is required\'));let s=ot(r.type),o=ot(r.ref);if(r.id){let l=ot(r.id);for(let u=0;u<t.arrayIndex;u++){let h=n.layers[u];ot(h.id)===l&&e.push(new T(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 T(i,r[u],`"${u}" is prohibited for ref layers`))});let l;n.layers.forEach(u=>{ot(u.id)===o&&(l=u)}),l?l.ref?e.push(new T(i,r.ref,"ref cannot reference another ref layer")):s=ot(l.type):e.push(new T(i,r.ref,`ref layer "${o}" not found`))}else if(s!=="background")if(!r.source)e.push(new T(i,r,\'missing required property "source"\'));else{let l=n.sources&&n.sources[r.source],u=l&&ot(l.type);l?u==="vector"&&s==="raster"?e.push(new T(i,r.source,`layer "${r.id}" requires a raster source`)):u!=="raster-dem"&&s==="hillshade"||u!=="raster-dem"&&s==="color-relief"?e.push(new T(i,r.source,`layer "${r.id}" requires a raster-dem source`)):u==="raster"&&s!=="raster"?e.push(new T(i,r.source,`layer "${r.id}" requires a vector source`)):u==="vector"&&!r["source-layer"]?e.push(new T(i,r,`layer "${r.id}" must specify a "source-layer"`)):u==="raster-dem"&&s!=="hillshade"&&s!=="color-relief"?e.push(new T(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 T(i,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \\`lineMetrics\\` enabled.`)):e.push(new T(i,r.source,`source "${r.source}" not found`))}return s==="raster"&&r.paint?.resampling&&r.paint?.["raster-resampling"]&&e.push(new T(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(Mt({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:Hs,layout(l){return Mt({layer:r,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*"(u){return pc(ei({layerType:s},u))}}})},paint(l){return Mt({layer:r,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*"(u){return cc(ei({layerType:s},u))}}})}}})),e}function xe(t){let e=t.value,r=t.key,i=j(e);return i==="string"?[]:[new T(r,e,`string expected, ${i} found`)]}function Wy(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 T("source_raster_dem",r,`object expected, ${o} found`)),s;let l=ot(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 T(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 T(c,r[c],`unknown property "${c}"`));return s}var wl={promoteId:Hy};function dc(t){let e=t.value,r=t.key,i=t.styleSpec,n=t.style,a=t.validateSpec;if(!e.type)return[new T(r,e,\'"type" is required\')];let s=ot(e.type),o;switch(s){case"vector":case"raster":return o=Mt({key:r,value:e,valueSpec:i[`source_${s.replace("-","_")}`],style:t.style,styleSpec:i,objectElementValidators:wl,validateSpec:a}),o;case"raster-dem":return o=Wy({sourceName:r,value:e,style:t.style,styleSpec:i,validateSpec:a}),o;case"geojson":if(o=Mt({key:r,value:e,valueSpec:i.source_geojson,style:n,styleSpec:i,validateSpec:a,objectElementValidators:wl}),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(...mr({key:`${r}.${l}.map`,value:h,validateSpec:a,expressionContext:"cluster-map"})),o.push(...mr({key:`${r}.${l}.reduce`,value:c,validateSpec:a,expressionContext:"cluster-reduce"}))}return o;case"video":return Mt({key:r,value:e,valueSpec:i.source_video,style:n,validateSpec:a,styleSpec:i});case"image":return Mt({key:r,value:e,valueSpec:i.source_image,style:n,validateSpec:a,styleSpec:i});case"canvas":return[new T(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return ii({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:n,validateSpec:a,styleSpec:i})}}function Hy({key:t,value:e}){if(j(e)==="string")return xe({key:t,value:e});{let r=[];for(let i in e)r.push(...xe({key:`${t}.${i}`,value:e[i]}));return r}}function yc(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 T("light",e,`object expected, ${s} found`)]),a;for(let o in e){let l=o.match(/^(.*)-transition$/);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 T(o,e[o],`unknown property "${o}"`)])}return a}function mc(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 T("sky",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 T(o,e[o],`unknown property "${o}"`)]);return s}function gc(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 T("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 T(o,e[o],`unknown property "${o}"`)]);return a}function Ky(t){return xe(t).length===0?[]:mr(t)}function Jy(t){return xe(t).length===0?[]:mr(t)}function Qy(t){let e=t.key,r=t.value;if(j(r)==="array"){if(r.length<1||r.length>4)return[new T(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 kn({key:e,value:r,valueSpec:{}})}function tm(t){let e=t.key,r=t.value;if(j(r)==="array"){let i={type:"number"};if(r.length<1)return[new T(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 kn({key:e,value:r,valueSpec:{}})}function em(t){let e=t.key,r=t.value;if(j(r)==="array"){if(r.length<1)return[new T(e,r,"array length at least 1 expected, length 0 found")];let i=[];for(let n=0;n<r.length;n++)i=i.concat(Ta({key:`${e}[${n}]`,value:r[n],valueSpec:{}}));return i}return Ta({key:e,value:r,valueSpec:{}})}function rm(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 T(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(ii({key:`${e}[${s}]`,value:r[s],valueSpec:n.layout_symbol["text-anchor"]})),a=a.concat(Ws({key:`${e}[${s+1}]`,value:r[s+1],valueSpec:{length:2,value:"number"},validateSpec:t.validateSpec,style:t.style,styleSpec:n}));return a}function xc(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 T(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 T(i,r,`all the sprites\' URLs must be unique, but ${r[s].url} is duplicated`)),a.push(r[s].url),e=e.concat(Mt({key:`${i}[${s}]`,value:r[s],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:t.validateSpec}));return e}return xe({key:i,value:r})}function im(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 T("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 T(o,e[o],`unknown property "${o}"`)]);return s}function nm(t){let e=t.key,r=t.value;r=r instanceof String?r.valueOf():r;let i=j(r);return i==="array"&&!sm(r)&&!am(r)?[new T(e,r,`projection expected, invalid array ${JSON.stringify(r)} found`)]:["array","string"].includes(i)?[]:[new T(e,r,`projection expected, invalid type "${i}" found`)]}function am(t){return!!["interpolate","step","literal"].includes(t[0])}function sm(t){return Array.isArray(t)&&t.length===3&&typeof t[0]=="string"&&typeof t[1]=="string"&&typeof t[2]=="number"}function Fa(t){return!!t&&t.constructor===Object}function vc(t){return Fa(t.value)?[]:[new T(t.key,t.value,`object expected, ${j(t.value)} found`)]}var _l=1114111,om=/^u\\+(?:([0-9a-f]{1,6})(?:-([0-9a-f]{1,6}))?|([0-9a-f]{0,5}\\?{1,6}))$/i;function lm(t,e){if(j(e)!=="string")return[];let r=`${e}`,i=()=>[new T(t,e,\'invalid unicode range, expected a value such as "U+26", "U+0-10FFFF" or "U+4??"\')],n=r.match(om);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>_l||u>_l?[new T(t,e,"unicode range is out of bounds, the maximum code point is U+10FFFF")]:l>u?[new T(t,e,`unicode range start must not be greater than its end, but ${r} is`)]:[]}function bc(t){let e=t.key??"font-faces",r=t.value,i=t.validateSpec,n=t.styleSpec??nh,a=t.style;if(!Fa(r))return[new T(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(...xe({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(...Mt({key:f,value:p,valueSpec:h,styleSpec:n,style:a,validateSpec:i}));let d=Fa(p)?p["unicode-range"]:void 0;if(j(d)==="array")for(let[y,m]of d.entries())s.push(...lm(`${f}.unicode-range[${y}]`,m))}}else s.push(new T(`${e}.${o}`,l,`string or array expected, ${u} found`))}return s}var Sl={"*"(){return[]},array:Ws,boolean:Yy,number:kn,color:Ta,constants:oc,enum:ii,filter:Hs,function:lc,layer:fc,object:Mt,source:dc,light:yc,sky:mc,terrain:gc,projection:im,projectionDefinition:nm,string:xe,formatted:Ky,resolvedImage:Jy,padding:Qy,numberArray:tm,colorArray:em,variableAnchorOffsetCollection:rm,sprite:xc,state:vc,fontFaces:bc};function Gr(t){let e=t.value,r=t.valueSpec,i=t.styleSpec;return t.validateSpec=Gr,r.expression&&Tn(ot(e))?lc(t):r.expression&&Fn(ze(e))?mr(t):r.type&&Sl[r.type]?Sl[r.type](t):Mt(ei({},t,{valueSpec:r.type?i[r.type]:r}))}function wc(t){let e=t.value,r=t.key,i=xe(t);return i.length||(e.indexOf("{fontstack}")===-1&&i.push(new T(r,e,\'"glyphs" url must include a "{fontstack}" token\')),e.indexOf("{range}")===-1&&i.push(new T(r,e,\'"glyphs" url must include a "{range}" token\'))),i}function It(t,e=_){let r=[];return r=r.concat(Gr({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,validateSpec:Gr,objectElementValidators:{glyphs:wc,"*"(){return[]}}})),t.constants&&(r=r.concat(oc({key:"constants",value:t.constants,style:t,styleSpec:e,validateSpec:Gr}))),_c(r)}It.source=Pt(Bt(dc)),It.sprite=Pt(Bt(xc)),It.glyphs=Pt(Bt(wc)),It.fontFaces=Pt(Bt(bc)),It.light=Pt(Bt(yc)),It.sky=Pt(Bt(mc)),It.terrain=Pt(Bt(gc)),It.state=Pt(Bt(vc)),It.layer=Pt(Bt(fc)),It.filter=Pt(Bt(Hs)),It.paintProperty=Pt(Bt(cc)),It.layoutProperty=Pt(Bt(pc));function Bt(t){return function(e){return t(Object.assign({},e,{validateSpec:Gr}))}}function _c(t){return[].concat(t).sort((e,r)=>e.line-r.line)}function Pt(t){return function(...e){return _c(t.apply(this,e))}}var um={type:"enum","property-type":"data-constant",expression:{interpolated:!1,parameters:["global-state"]},values:{visible:{},none:{}},transition:!1,default:"visible"},hm=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=ve(t,this._rootKey,um,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=mi(e.value.expression)}getGlobalStateRefs(){return this._globalStateRefs}};function cm(t,e,r){return new hm(t,e,r)}var Al=It,gw=new Set(Object.keys(_).filter(t=>t.startsWith("source_")).map(t=>t.slice(7).replaceAll("_","-")));function pm(t,e){let r=!1;for(let i of e){if(i.severity==="warning"){gt(i.message);continue}t.fire(new Qi(Error(i.message))),r=!0}return r}function fm(t,e,r,i){return i?.validate!==!1&&pm(t,e({styleSpec:_,...r}))}var ka=class Sc{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 Sc(e.buffer)}},ne={};function I(t,e,r={}){if(ne[t])throw Error(`${t} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:t,writeable:!1}),ne[t]={klass:e,omit:r.omit||[],shallow:r.shallow||[]}}I("Object",Object),I("Set",Set),I("TransferableGridIndex",ka),I("Color",nt),I("Error",Error),I("AJAXError",Ji),I("ResolvedImage",Kt),I("StylePropertyFunction",ec),I("StyleExpression",Ys,{omit:["_evaluator"]}),I("ZoomDependentExpression",an),I("ZoomConstantExpression",ri),I("CompoundExpression",Re,{omit:["_evaluate"]});for(let t in ir)ir[t]._classRegistryKey||I(`Expression_${t}`,ir[t]);function Ac(t){return t&&typeof ArrayBuffer<"u"&&(t instanceof ArrayBuffer||t.constructor?.name==="ArrayBuffer")}function Ks(t){let e=t.constructor;return t.$name||e._classRegistryKey}function dm(t){if(typeof t!="object"||!t)return!1;let e=Ks(t);return e&&e!=="Object"}function Dc(t){return!dm(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||Ac(t)||yn(t)||ArrayBuffer.isView(t)||t instanceof ImageData)}function jr(t,e){if(Dc(t))return(Ac(t)||yn(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(jr(s,e));return a}if(typeof t!="object")throw Error(`can\'t serialize object of type ${typeof t}`);let r=Ks(t);if(!r)throw Error(`can\'t serialize object of unregistered class ${t.constructor.name}`);if(!ne[r])throw Error(`${r} is not registered.`);let{klass:i}=ne[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)||ne[r].omit.includes(a))continue;let s=t[a];s!==void 0&&(n[a]=ne[r].shallow.includes(a)?s:jr(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 Yr(t){if(Dc(t))return t;if(Array.isArray(t))return t.map(Yr);if(typeof t!="object")throw Error(`can\'t deserialize object of type ${typeof t}`);let e=Ks(t)||"Object";if(!ne[e])throw Error(`can\'t deserialize unregistered class ${e}`);let{klass:r}=ne[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]=ne[e].shallow.includes(n)?a:Yr(a)}return i}var Dl=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))}};function ym(t){return/[\\u02EA\\u02EB\\u2E80-\\u2FDF\\u2FF0-\\u303F\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FD-\\u30FF\\u3105-\\u312F\\u31A0-\\u4DBF\\u4E00-\\uA48C\\uA490-\\uA4C6\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFE10-\\uFE1F\\uFE30-\\uFE4F\\uFF00-\\uFFEF]|\\uD81B[\\uDFE0-\\uDFFF]|[\\uD81C-\\uD822\\uD840-\\uD868\\uD86A-\\uD86D\\uD86F-\\uD872\\uD874-\\uD879\\uD880-\\uD883\\uD885-\\uD88C][\\uDC00-\\uDFFF]|\\uD823[\\uDC00-\\uDCD5\\uDCFF-\\uDD1E\\uDD80-\\uDDF2]|\\uD82B[\\uDFF0-\\uDFFF]|\\uD82C[\\uDC00-\\uDEFB]|\\uD83C[\\uDE00-\\uDEFF]|\\uD869[\\uDC00-\\uDEDF\\uDF00-\\uDFFF]|\\uD86E[\\uDC00-\\uDC1D\\uDC20-\\uDFFF]|\\uD873[\\uDC00-\\uDEAD\\uDEB0-\\uDFFF]|\\uD87A[\\uDC00-\\uDFE0\\uDFF0-\\uDFFF]|\\uD87B[\\uDC00-\\uDE5D]|\\uD87E[\\uDC00-\\uDE1D]|\\uD884[\\uDC00-\\uDF4A\\uDF50-\\uDFFF]|\\uD88D[\\uDC00-\\uDC79]/gim.test(String.fromCodePoint(t))}function In(t){return/[\\u02EA\\u02EB\\u1100-\\u11FF\\u1400-\\u167F\\u18B0-\\u18F5\\u2E80-\\u2E99\\u2E9B-\\u2EF3\\u2F00-\\u2FD5\\u2FF0-\\u3007\\u3012\\u3013\\u3020-\\u302F\\u3031-\\u303F\\u3041-\\u3096\\u309D-\\u30FB\\u30FD-\\u30FF\\u3105-\\u312F\\u3131-\\u318E\\u3190-\\uA48C\\uA490-\\uA4C6\\uA960-\\uA97C\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFE10-\\uFE1F\\uFE30-\\uFE48\\uFE50-\\uFE57\\uFE5F-\\uFE62\\uFE67-\\uFE6F\\uFF00-\\uFF07\\uFF0A-\\uFF0C\\uFF0E-\\uFF19\\uFF1F-\\uFF3A\\uFF3C\\uFF3E\\uFF40-\\uFF5A\\uFFE0-\\uFFE2\\uFFE4-\\uFFE7]|\\uD802[\\uDD80-\\uDD9F]|\\uD805[\\uDD80-\\uDDFF]|\\uD806[\\uDE00-\\uDEBF]|\\uD811[\\uDC00-\\uDE7F]|\\uD81B[\\uDFE0-\\uDFE4\\uDFF0-\\uDFF6]|[\\uD81C-\\uD822\\uD83D\\uD840-\\uD868\\uD86A-\\uD86D\\uD86F-\\uD872\\uD874-\\uD879\\uD880-\\uD883\\uD885-\\uD88C][\\uDC00-\\uDFFF]|\\uD823[\\uDC00-\\uDCD5\\uDCFF-\\uDD1E\\uDD80-\\uDDF2]|\\uD82B[\\uDFF0-\\uDFF3\\uDFF5-\\uDFFB\\uDFFD\\uDFFE]|\\uD82C[\\uDC00-\\uDD22\\uDD30-\\uDEFB]|\\uD833[\\uDEC0-\\uDFCF]|\\uD834[\\uDC00-\\uDDFF\\uDEE0-\\uDF7F]|\\uD836[\\uDC00-\\uDEAF]|\\uD83C[\\uDC00-\\uDE00\\uDF00-\\uDFFF]|\\uD83E[\\uDD00-\\uDEFF]|\\uD869[\\uDC00-\\uDEDF\\uDF00-\\uDFFF]|\\uD86E[\\uDC00-\\uDC1D\\uDC20-\\uDFFF]|\\uD873[\\uDC00-\\uDEAD\\uDEB0-\\uDFFF]|\\uD87A[\\uDC00-\\uDFE0\\uDFF0-\\uDFFF]|\\uD87B[\\uDC00-\\uDE5D]|\\uD87E[\\uDC00-\\uDE1D]|\\uD884[\\uDC00-\\uDF4A\\uDF50-\\uDFFF]|\\uD88D[\\uDC00-\\uDC79]/gim.test(String.fromCodePoint(t))}function mm(t){return/[\\xA7\\xA9\\xAE\\xB1\\xBC-\\xBE\\xD7\\xF7\\u2016\\u2020\\u2021\\u2030\\u2031\\u203B\\u203C\\u2042\\u2047-\\u2049\\u2051\\u2100-\\u218F\\u221E\\u2234\\u2235\\u2300-\\u2307\\u230C-\\u231F\\u2324-\\u2328\\u232B\\u237D-\\u239A\\u23BE-\\u23CD\\u23CF\\u23D1-\\u23DB\\u23E2-\\u2422\\u2424-\\u24FF\\u25A0-\\u2619\\u2620-\\u2767\\u2776-\\u2793\\u2B12-\\u2B2F\\u2B50-\\u2B59\\u2BB8-\\u2BEB\\u3000-\\u303F\\u30A0-\\u30FF\\uE000-\\uF8FF\\uFE30-\\uFE6F\\uFF00-\\uFFEF\\uFFFC\\uFFFD]|[\\uDB80-\\uDBFF][\\uDC00-\\uDFFF]/gim.test(String.fromCodePoint(t))}function gm(t){return/[\\u0900-\\u0DFF\\u0F00-\\u109F\\u1780-\\u17FF]/gim.test(String.fromCodePoint(t))}function xm(t){return/[\\r\\u0300-\\u036F\\u0483-\\u0489\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u0600-\\u0605\\u0610-\\u061A\\u064B-\\u065F\\u0670\\u06D6-\\u06DD\\u06DF-\\u06E4\\u06E7\\u06E8\\u06EA-\\u06ED\\u070F\\u0711\\u0730-\\u074A\\u07A6-\\u07B0\\u07EB-\\u07F3\\u07FD\\u0816-\\u0819\\u081B-\\u0823\\u0825-\\u0827\\u0829-\\u082D\\u0859-\\u085B\\u0890\\u0891\\u0897-\\u089F\\u08CA-\\u0903\\u093A-\\u093C\\u093E-\\u094F\\u0951-\\u0957\\u0962\\u0963\\u0981-\\u0983\\u09BC\\u09BE-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CD\\u09D7\\u09E2\\u09E3\\u09FE\\u0A01-\\u0A03\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A70\\u0A71\\u0A75\\u0A81-\\u0A83\\u0ABC\\u0ABE-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AE2\\u0AE3\\u0AFA-\\u0AFF\\u0B01-\\u0B03\\u0B3C\\u0B3E-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B55-\\u0B57\\u0B62\\u0B63\\u0B82\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD7\\u0C00-\\u0C04\\u0C3C\\u0C3E-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C62\\u0C63\\u0C81-\\u0C83\\u0CBC\\u0CBE-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CE2\\u0CE3\\u0CF3\\u0D00-\\u0D03\\u0D3B\\u0D3C\\u0D3E-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D62\\u0D63\\u0D81-\\u0D83\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DF2\\u0DF3\\u0E31\\u0E33-\\u0E3A\\u0E47-\\u0E4E\\u0EB1\\u0EB3-\\u0EBC\\u0EC8-\\u0ECE\\u0F18\\u0F19\\u0F35\\u0F37\\u0F39\\u0F3E\\u0F3F\\u0F71-\\u0F84\\u0F86\\u0F87\\u0F8D-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u102D-\\u1037\\u1039-\\u103E\\u1056-\\u1059\\u105E-\\u1060\\u1071-\\u1074\\u1082\\u1084-\\u1086\\u108D\\u109D\\u1100-\\u11FF\\u135D-\\u135F\\u1712-\\u1715\\u1732-\\u1734\\u1752\\u1753\\u1772\\u1773\\u17B4-\\u17D3\\u17DD\\u180B-\\u180D\\u180F\\u1885\\u1886\\u18A9\\u1920-\\u192B\\u1930-\\u193B\\u1A17-\\u1A1B\\u1A55-\\u1A5E\\u1A60\\u1A62\\u1A65-\\u1A7C\\u1A7F\\u1AB0-\\u1ADD\\u1AE0-\\u1AEB\\u1B00-\\u1B04\\u1B34-\\u1B44\\u1B6B-\\u1B73\\u1B80-\\u1B82\\u1BA1-\\u1BAD\\u1BE6-\\u1BF3\\u1C24-\\u1C37\\u1CD0-\\u1CD2\\u1CD4-\\u1CE8\\u1CED\\u1CF4\\u1CF7-\\u1CF9\\u1DC0-\\u1DFF\\u200C\\u200D\\u20D0-\\u20F0\\u2CEF-\\u2CF1\\u2D7F\\u2DE0-\\u2DFF\\u302A-\\u302F\\u3099\\u309A\\uA66F-\\uA672\\uA674-\\uA67D\\uA69E\\uA69F\\uA6F0\\uA6F1\\uA802\\uA806\\uA80B\\uA823-\\uA827\\uA82C\\uA880\\uA881\\uA8B4-\\uA8C5\\uA8E0-\\uA8F1\\uA8FF\\uA926-\\uA92D\\uA947-\\uA953\\uA960-\\uA97C\\uA980-\\uA983\\uA9B3-\\uA9C0\\uA9E5\\uAA29-\\uAA36\\uAA43\\uAA4C\\uAA4D\\uAA7C\\uAAB0\\uAAB2-\\uAAB4\\uAAB7\\uAAB8\\uAABE\\uAABF\\uAAC1\\uAAEB-\\uAAEF\\uAAF5\\uAAF6\\uABE3-\\uABEA\\uABEC\\uABED\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uFB1E\\uFE00-\\uFE0F\\uFE20-\\uFE2F\\uFF9E\\uFF9F]|\\uD800[\\uDDFD\\uDEE0\\uDF76-\\uDF7A]|\\uD802[\\uDE01-\\uDE03\\uDE05\\uDE06\\uDE0C-\\uDE0F\\uDE38-\\uDE3A\\uDE3F\\uDEE5\\uDEE6]|\\uD803[\\uDD24-\\uDD27\\uDD69-\\uDD6D\\uDEAB\\uDEAC\\uDEFA-\\uDEFF\\uDF46-\\uDF50\\uDF82-\\uDF85]|\\uD804[\\uDC00-\\uDC02\\uDC38-\\uDC46\\uDC70\\uDC73\\uDC74\\uDC7F-\\uDC82\\uDCB0-\\uDCBA\\uDCBD\\uDCC2\\uDCCD\\uDD00-\\uDD02\\uDD27-\\uDD34\\uDD45\\uDD46\\uDD73\\uDD80-\\uDD82\\uDDB3-\\uDDC0\\uDDC2\\uDDC3\\uDDC9-\\uDDCC\\uDDCE\\uDDCF\\uDE2C-\\uDE37\\uDE3E\\uDE41\\uDEDF-\\uDEEA\\uDF00-\\uDF03\\uDF3B\\uDF3C\\uDF3E-\\uDF44\\uDF47\\uDF48\\uDF4B-\\uDF4D\\uDF57\\uDF62\\uDF63\\uDF66-\\uDF6C\\uDF70-\\uDF74\\uDFB8-\\uDFC0\\uDFC2\\uDFC5\\uDFC7-\\uDFCA\\uDFCC-\\uDFD2\\uDFE1\\uDFE2]|\\uD805[\\uDC35-\\uDC46\\uDC5E\\uDCB0-\\uDCC3\\uDDAF-\\uDDB5\\uDDB8-\\uDDC0\\uDDDC\\uDDDD\\uDE30-\\uDE40\\uDEAB-\\uDEB7\\uDF1D-\\uDF1F\\uDF22-\\uDF2B]|\\uD806[\\uDC2C-\\uDC3A\\uDD30-\\uDD35\\uDD37\\uDD38\\uDD3B-\\uDD43\\uDDD1-\\uDDD7\\uDDDA-\\uDDE0\\uDDE4\\uDE01-\\uDE0A\\uDE33-\\uDE39\\uDE3B-\\uDE3E\\uDE47\\uDE51-\\uDE5B\\uDE84-\\uDE99\\uDF60-\\uDF67]|\\uD807[\\uDC2F-\\uDC36\\uDC38-\\uDC3F\\uDC92-\\uDCA7\\uDCA9-\\uDCB6\\uDD31-\\uDD36\\uDD3A\\uDD3C\\uDD3D\\uDD3F-\\uDD47\\uDD8A-\\uDD8E\\uDD90\\uDD91\\uDD93-\\uDD97\\uDEF3-\\uDEF6\\uDF00-\\uDF03\\uDF34-\\uDF3A\\uDF3E-\\uDF42\\uDF5A]|\\uD80D[\\uDC40\\uDC47-\\uDC55]|\\uD818[\\uDD1E-\\uDD2F]|\\uD81A[\\uDEF0-\\uDEF4\\uDF30-\\uDF36]|\\uD81B[\\uDD63\\uDD67-\\uDD6A\\uDF4F\\uDF51-\\uDF87\\uDF8F-\\uDF92\\uDFE4\\uDFF0\\uDFF1]|\\uD82F[\\uDC9D\\uDC9E]|\\uD833[\\uDF00-\\uDF2D\\uDF30-\\uDF46]|\\uD834[\\uDD65-\\uDD69\\uDD6D-\\uDD72\\uDD7B-\\uDD82\\uDD85-\\uDD8B\\uDDAA-\\uDDAD\\uDE42-\\uDE44]|\\uD836[\\uDE00-\\uDE36\\uDE3B-\\uDE6C\\uDE75\\uDE84\\uDE9B-\\uDE9F\\uDEA1-\\uDEAF]|\\uD838[\\uDC00-\\uDC06\\uDC08-\\uDC18\\uDC1B-\\uDC21\\uDC23\\uDC24\\uDC26-\\uDC2A\\uDC8F\\uDD30-\\uDD36\\uDEAE\\uDEEC-\\uDEEF]|\\uD839[\\uDCEC-\\uDCEF\\uDDEE\\uDDEF\\uDEE3\\uDEE6\\uDEEE\\uDEEF\\uDEF5]|\\uD83A[\\uDCD0-\\uDCD6\\uDD44-\\uDD4A]|\\uD83C[\\uDDE6-\\uDDFF\\uDFFB-\\uDFFF]|\\uDB40[\\uDC20-\\uDC7F\\uDD00-\\uDDEF]/.test(t)}function El(t){return/[\\u0E01-\\u0E3A\\u0E40-\\u0E5B\\u0E81\\u0E82\\u0E84\\u0E86-\\u0E8A\\u0E8C-\\u0EA3\\u0EA5\\u0EA7-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECE\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F97\\u0F99-\\u0FBC\\u0FBE-\\u0FCC\\u0FCE-\\u0FD4\\u0FD9\\u0FDA\\u1000-\\u109F\\u1780-\\u17DD\\u17E0-\\u17E9\\u17F0-\\u17F9\\u19E0-\\u19FF\\u1B00-\\u1B4C\\u1B4E-\\u1B7F\\uA980-\\uA9CD\\uA9D0-\\uA9D9\\uA9DE-\\uA9FE\\uAA60-\\uAA7F]|\\uD805[\\uDED0-\\uDEE3]/gim.test(String.fromCodePoint(t))}function vm(t,e){return/(?:[\\u1039\\u17D2\\u1A60\\u1BAB\\u200D\\uAAF6]|\\uD802\\uDE3F|\\uD804[\\uDD33\\uDFD0]|\\uD806[\\uDD3E\\uDE47\\uDE99]|\\uD807[\\uDD45\\uDD97\\uDF42])$/.test(t)||/^\\p{gc=Mc}/u.test(e)}function Js(t){return/\\s/u.test(String.fromCodePoint(t))}function Ia(t){for(let e of t)if(In(e.codePointAt(0)))return!0;return!1}function bm(t){for(let e of t)if(!_m(e.codePointAt(0)))return!1;return!0}function Ec(t){let e=t.map(r=>{try{return RegExp(`\\\\p{sc=${r}}`,"u").source}catch{return null}}).filter(r=>r);return new RegExp(e.join("|"),"u")}var wm=Ec(["Arab","Dupl","Mong","Ougr","Syrc"]);function _m(t){return!wm.test(String.fromCodePoint(t))}function Tl(t){return!(In(t)||mm(t))}function Tc(t){return/\\p{sc=Arab}/u.test(String.fromCodePoint(t))}var Sm=Ec("Adlm.Arab.Armi.Avst.Chrs.Cprt.Egyp.Elym.Gara.Hatr.Hebr.Hung.Khar.Lydi.Mand.Mani.Mend.Merc.Mero.Narb.Nbat.Nkoo.Orkh.Palm.Phli.Phlp.Phnx.Prti.Rohg.Samr.Sarb.Sogo.Syrc.Thaa.Todr.Yezi".split("."));function Qs(t){return Sm.test(String.fromCodePoint(t))}function Am(t,e){return!e&&Qs(t)?!1:!gm(t)}function Dm(t){for(let e of t)if(Qs(e.codePointAt(0)))return!0;return!1}function Em(t,e){for(let r of t)if(!Am(r.codePointAt(0),e))return!1;return!0}var Jt=new class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(t){this.pluginStatus=t.pluginStatus,this.pluginURL=t.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(t){if(Jt.isParsed())throw Error("RTL text plugin already registered.");this.applyArabicShaping=t.applyArabicShaping,this.processBidirectionalText=t.processBidirectionalText,this.processStyledBidirectionalText=t.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getRTLTextPluginStatus(){return this.pluginStatus}async syncState(t,e){if(this.isParsed())return this.getState();if(t.pluginStatus!=="loading")return this.setState(t),t;let r=t.pluginURL,i=new Promise(a=>{this.loadScriptResolve=a}),n=new Promise(a=>setTimeout(()=>a(),this.TIMEOUT));if(await e(r),await Promise.race([i,n]),this.isParsed()){let a={pluginStatus:"loaded",pluginURL:r};return this.setState(a),a}throw this.setState({pluginStatus:"error",pluginURL:""}),Error(`RTL Text Plugin failed to import scripts from ${r}`)}},H=class{constructor(t,e){this.isSupportedScript=Tm,this.zoom=t,e?(this.now=e.now||0,this.fadeDuration=e.fadeDuration||0,this.zoomHistory=e.zoomHistory||new Dl,this.transition=e.transition||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Dl,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}}};function Tm(t){return Em(t,Jt.getRTLTextPluginStatus()==="loaded")}var Fm="-transition",Mn=class{constructor(t,e,r,i){this.property=t,this.value=e,this.expression=Oy(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)}},Ma=class{constructor(t,e,r){this.property=t,this.value=new Mn(t,void 0,e,r)}transitioned(t,e){return new Fl(this.property,this.value,e,Tt({},t.transition,this.transition),t.now)}untransitioned(){return new Fl(this.property,this.value,null,{},0)}},km=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 de(this._values[t].value.value)}setValue(t,e){Object.hasOwn(this._values,t)||(this._values[t]=new Ma(this._values[t].property,this._propertyRootKey(t),this._globalState)),this._values[t].value=new Mn(this._values[t].property,e===null?void 0:de(e),this._propertyRootKey(t),this._globalState)}getTransition(t){return de(this._values[t].transition)}setTransition(t,e){Object.hasOwn(this._values,t)||(this._values[t]=new Ma(this._values[t].property,this._propertyRootKey(t),this._globalState)),this._values[t].transition=de(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}${Fm}`]=i)}return t}transitioned(t,e){let r=new kl(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 kl(this._properties);for(let e of Object.keys(this._values))t._values[e]=this._values[e].untransitioned();return t}},Fl=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,td(s))}}},kl=class{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,e,r){let i=new Cn(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}},Im=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 de(this._values[t].value)}setValue(t,e){this._values[t]=new Mn(this._values[t].property,e===null?void 0:de(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 Cn(this._properties);for(let n of Object.keys(this._values))i._values[n]=this._values[n].possiblyEvaluate(t,e,r);return i}},Vt=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)}},Cn=class{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}};function Il(t){if(Array.isArray(t))return t.length;let e=t?.values;return Array.isArray(e)?e.length:void 0}function Fc(t,e){let r=Il(t),i=Il(e);return r!==void 0&&i!==void 0&&r!==i}var C=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(Fc(t,e))return gt(`Property "${this.name}" is trying to interpolate arrays of different lengths. Rendering may \'jump\'.`),e;let i=this.specification.type,n=Pe[i];return n?n(t,e,r):t}},O=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 Vt(this,{kind:"constant",value:t.expression.evaluate(e,null,{},r,i)},e):new Vt(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 Vt(this,{kind:"constant",value:void 0},t.parameters);if(Fc(t.value.value,e.value.value))return gt(`Property "${this.name}" is trying to interpolate arrays of different lengths. Rendering may \'jump\'.`),e;let i=this.specification.type,n=Pe[i];if(n){let a=n(t.value.value,e.value.value,r);return new Vt(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)}},ni=class extends O{possiblyEvaluate(t,e,r,i){if(t.value===void 0)return new Vt(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 Vt(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 Vt(this,{kind:"constant",value:n},e)}return new Vt(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}},kc=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 H(Math.floor(e.zoom-1),e)),t.expression.evaluate(new H(Math.floor(e.zoom),e)),t.expression.evaluate(new H(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}},Bn=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}},Ft=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 Mn(r,void 0,r.name,void 0),n=this.defaultTransitionablePropertyValues[e]=new Ma(r,r.name,void 0);this.defaultTransitioningPropertyValues[e]=n.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=i.possiblyEvaluate({})}}};I("DataDrivenProperty",O),I("DataConstantProperty",C),I("CrossFadedDataDrivenProperty",ni),I("CrossFadedProperty",kc),I("ColorRampProperty",Bn);var Ml=" is a PAINT property not a LAYOUT property. Use get/setPaintProperty instead?",aa=" is a LAYOUT property not a PAINT property. Use get/setLayoutProperty instead?",jt=class extends fd{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=cm(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=yr(t.filter,`layers[${this.id}].filter`,r)),e.layout&&(this._unevaluatedLayout=new Im(e.layout,`layers[${this.id}].layout`,r)),e.paint)){this._transitionablePaint=new km(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 Cn(e.paint)}}setFilter(t){this.filter=t,this._featureFilter=yr(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+Ml);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 Qi(Error(t+Ml)));return}e!=null&&this._validate(Al.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+aa);return this._transitionablePaint.getTransition(e)}if(t==="visibility"||this._unevaluatedLayout?.hasProperty(t))throw Error(t+aa);return this._transitionablePaint.getValue(t)}setPaintProperty(t,e,r={}){if(t==="visibility"||this._unevaluatedLayout?.hasProperty(t))return this.fire(new Qi(Error(t+aa))),!1;if(e!=null&&this._validate(Al.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.visibility=this.visibility),nd(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 fm(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 Vt)||!fr(e.property.specification))&&(e.value.kind==="source"||e.value.kind==="composite")&&e.value.isStateDependent)return!0}return!1}},Mm,Cm=()=>Mm||=new Ft({"raster-opacity":new C(_.paint_raster["raster-opacity"],"raster-opacity"),"raster-hue-rotate":new C(_.paint_raster["raster-hue-rotate"],"raster-hue-rotate"),"raster-brightness-min":new C(_.paint_raster["raster-brightness-min"],"raster-brightness-min"),"raster-brightness-max":new C(_.paint_raster["raster-brightness-max"],"raster-brightness-max"),"raster-saturation":new C(_.paint_raster["raster-saturation"],"raster-saturation"),"raster-contrast":new C(_.paint_raster["raster-contrast"],"raster-contrast"),resampling:new C(_.paint_raster.resampling,"resampling"),"raster-resampling":new C(_.paint_raster["raster-resampling"],"raster-resampling"),"raster-fade-duration":new C(_.paint_raster["raster-fade-duration"],"raster-fade-duration")}),Bm={get paint(){return Cm()}};var Pm=class extends jt{constructor(t,e){super(t,Bm,e)}},zm={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},gi=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}},at=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 ut(t,e=1){let r=0,i=0;return{members:t.map(n=>{let a=Lm(n.type),s=r=Cl(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:Cl(r,Math.max(i,e)),alignment:e}}function Lm(t){return zm[t].BYTES_PER_ELEMENT}function Cl(t,e){return Math.ceil(t/e)*e}var ai=class extends at{_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}};ai.prototype.bytesPerElement=4,I("StructArrayLayout2i4",ai);var Ca=class extends at{_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}};Ca.prototype.bytesPerElement=6,I("StructArrayLayout3i6",Ca);var Bl=class extends at{_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}};Bl.prototype.bytesPerElement=8,I("StructArrayLayout4i8",Bl);var Ba=class extends at{_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}};Ba.prototype.bytesPerElement=12,I("StructArrayLayout2i4i12",Ba);var Pa=class extends at{_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}};Pa.prototype.bytesPerElement=8,I("StructArrayLayout2i4ub8",Pa);var si=class extends at{_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}};si.prototype.bytesPerElement=8,I("StructArrayLayout2f8",si);var za=class extends at{_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}};za.prototype.bytesPerElement=20,I("StructArrayLayout10ui20",za);var La=class extends at{_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}};La.prototype.bytesPerElement=16,I("StructArrayLayout8ui16",La);var Va=class extends at{_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}};Va.prototype.bytesPerElement=28,I("StructArrayLayout4i4ui4i1f28",Va);var Oa=class extends at{_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}};Oa.prototype.bytesPerElement=12,I("StructArrayLayout3f12",Oa);var Ra=class extends at{_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}};Ra.prototype.bytesPerElement=4,I("StructArrayLayout1ul4",Ra);var $a=class extends at{_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}};$a.prototype.bytesPerElement=20,I("StructArrayLayout6i1ul2ui20",$a);var Na=class extends at{_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}};Na.prototype.bytesPerElement=12,I("StructArrayLayout2i2i2i12",Na);var Pl=class extends at{_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}};Pl.prototype.bytesPerElement=16,I("StructArrayLayout2f1f2i16",Pl);var Ua=class extends at{_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}};Ua.prototype.bytesPerElement=16,I("StructArrayLayout2ub2f2i16",Ua);var qa=class extends at{_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}};qa.prototype.bytesPerElement=6,I("StructArrayLayout3ui6",qa);var Ga=class extends at{_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}};Ga.prototype.bytesPerElement=52,I("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i1f52",Ga);var ja=class extends at{_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,D,E,L,$,P){let z=this.length;return this.resize(z+1),this.emplace(z,t,e,r,i,n,a,s,o,l,u,h,c,p,f,d,y,m,g,x,b,v,w,A,S,D,E,L,$,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,D,E,L,$,P,z){let F=t*34,V=t*17;return this.int16[F+0]=e,this.int16[F+1]=r,this.int16[F+2]=i,this.int16[F+3]=n,this.int16[F+4]=a,this.int16[F+5]=s,this.int16[F+6]=o,this.int16[F+7]=l,this.uint16[F+8]=u,this.uint16[F+9]=h,this.uint16[F+10]=c,this.uint16[F+11]=p,this.uint16[F+12]=f,this.uint16[F+13]=d,this.uint16[F+14]=y,this.uint16[F+15]=m,this.uint16[F+16]=g,this.uint16[F+17]=x,this.uint16[F+18]=b,this.uint16[F+19]=v,this.uint16[F+20]=w,this.uint16[F+21]=A,this.uint16[F+22]=S,this.uint32[V+12]=D,this.float32[V+13]=E,this.float32[V+14]=L,this.uint16[F+30]=$,this.uint16[F+31]=P,this.float32[V+16]=z,t}};ja.prototype.bytesPerElement=68,I("StructArrayLayout8i15ui1ul2f2ui1f68",ja);var on=class extends at{_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}};on.prototype.bytesPerElement=4,I("StructArrayLayout1f4",on);var Ya=class extends at{_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}};Ya.prototype.bytesPerElement=12,I("StructArrayLayout1ui2f12",Ya);var Xa=class extends at{_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}};Xa.prototype.bytesPerElement=8,I("StructArrayLayout1ul2ui8",Xa);var Za=class extends at{_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}};Za.prototype.bytesPerElement=4,I("StructArrayLayout2ui4",Za);var zl=class extends at{_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}};zl.prototype.bytesPerElement=2,I("StructArrayLayout1ui2",zl);var Wa=class extends at{_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}};Wa.prototype.bytesPerElement=16,I("StructArrayLayout4f16",Wa);var Ic=class extends gi{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 M(this.anchorPointX,this.anchorPointY)}};Ic.prototype.size=20;var to=class extends $a{get(t){return new Ic(this,t)}};I("CollisionBoxArray",to);var Mc=class extends gi{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]}};Mc.prototype.size=52;var Cc=class extends Ga{get(t){return new Mc(this,t)}};I("PlacedSymbolArray",Cc);var Bc=class extends gi{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]}};Bc.prototype.size=68;var Pc=class extends ja{get(t){return new Bc(this,t)}};I("SymbolInstanceArray",Pc);var zc=class extends on{getoffsetX(t){return this.float32[t*1+0]}};I("GlyphOffsetArray",zc);var Lc=class extends Ca{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",Lc);var Vc=class extends gi{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]}};Vc.prototype.size=12;var Oc=class extends Ya{get(t){return new Vc(this,t)}};I("TextAnchorOffsetArray",Oc);var Rc=class extends gi{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]}};Rc.prototype.size=8;var $c=class extends Xa{get(t){return new Rc(this,t)}};I("FeatureIndexArray",$c);var Vm=class extends ai{};var Om=class extends ai{},Rm=class extends ai{},$m=class extends Ba{},Nm=class extends Pa{},Um=class extends si{},Xe=class extends za{},Ll=class extends La{},qm=class extends Va{},Gm=class extends Oa{},jm=class extends Ra{},Vl=class extends Na{};var Ym=class extends Ua{};var xi=class extends qa{},Ha=class extends Za{};var Ka=ut([{name:"a_pos",components:2,type:"Int16"}],4),Xm=Ka.members;Ka.size,Ka.alignment;var Ct=class Je{constructor(e=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=e}prepareSegment(e,r,i,n){let a=this.segments[this.segments.length-1];return e>Je.MAX_VERTEX_ARRAY_LENGTH&>(`Max vertices per segment is ${Je.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}. Consider using the \\`fillLargeMeshArrays\\` function if you require meshes with more than ${Je.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!a||a.vertexLength+e>Je.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 Je([{vertexOffset:e,primitiveOffset:r,vertexLength:i,primitiveLength:n,vaos:{},sortKey:0}])}};Ct.MAX_VERTEX_ARRAY_LENGTH=2**16-1,I("SegmentVector",Ct);function Ol(t,e){return t=Hr(Math.floor(t),0,255),e=Hr(Math.floor(e),0,255),256*t+e}var Zm=ut([{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"}]),Wm=ut([{name:"a_dasharray_from",components:4,type:"Uint16"},{name:"a_dasharray_to",components:4,type:"Uint16"}]),Hm=Is((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)}),Km=Is((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}),Ja=Rf(Is((t,e)=>{var r=Hm(),i=Km();e.exports=r,e.exports.murmur3=r,e.exports.murmur2=i})(),1),Nc=class Uc{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,i,n){this.ids.push(Rl(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=Rl(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 Qa(i,n,0,i.length-1),r&&r.push(i.buffer,n.buffer),{ids:i,positions:n}}static deserialize(e){let r=new Uc;return r.ids=e.ids,r.positions=e.positions,r.indexed=!0,r}};function Rl(t){let e=+t;return!isNaN(e)&&e<=2**53-1?e:(0,Ja.default)(String(t))}function Qa(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;Ci(t,a,s),Ci(e,3*a,3*s),Ci(e,3*a+1,3*s+1),Ci(e,3*a+2,3*s+2)}s-r<i-s?(Qa(t,e,r,s),r=s+1):(Qa(t,e,s+1,i),i=s)}}function Ci(t,e,r){let i=t[e];t[e]=t[r],t[r]=i}I("FeaturePositionMap",Nc);var eo=class{constructor(t,e){this.gl=t.gl,this.location=e}};var ro=class extends eo{constructor(t,e){super(t,e),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}};var Jm=class extends eo{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]))}},Qm=class extends eo{constructor(t,e){super(t,e),this.current=nt.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 xw=new Float32Array(16);function ts(t){return[Ol(255*t.r,255*t.g),Ol(255*t.b,255*t.a)]}var Or=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 Qm(t,e):new ro(t,e)}},Ee=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 Jm(t,e):new ro(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 H(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 H(0,n),r,i);this._setPaintValue(t,e,a)}_setPaintValue(t,e,r){if(this.type==="color"){let i=ts(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()}},Nt=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 H(this.zoom,r),e,{},r.canonical,[],r.formattedSection),n=this.expression.evaluate(new H(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 H(this.zoom,n),r,i),s=this.expression.evaluate(new H(this.zoom+1,n),r,i);this._setPaintValue(t,e,a,s)}_setPaintValue(t,e,r,i){if(this.type==="color"){let n=ts(r),a=ts(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=Hr(this.expression.interpolationFactor(r,this.zoom,this.zoom+1),0,1);t.set(i)}getBinding(t,e,r){return new ro(t,e)}},ce=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()}},qc=class extends ce{getPositions(t){return t.imagePositions}getPositionIds(t){return t.patterns?.[this.layerId]}getVertexAttributes(){return Zm.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)}},Gc=class extends ce{getPositions(t){return t.dashPositions}getPositionIds(t){return t.dashes?.[this.layerId]}getVertexAttributes(){return Wm.members}emplace(t,e,r,i){t.emplace(e,0,r.y,r.height,r.width,0,i.y,i.height,i.width)}},jc=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 Vt)||!fr(a.property.specification))continue;let s=t0(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 Ee(o.value,s):new Or(o.value,s,l),i.push(`/u_${n}`);else if(o.kind==="source"||c){let p=$l(n,l,"source");this.binders[n]=c?n==="line-dasharray"?new Gc(o,l,u,e,p,t.id):new qc(o,l,u,e,p,t.id):new ee(o,s,l,p),i.push(`/a_${n}`)}else{let p=$l(n,l,"composite");this.binders[n]=new Nt(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 Nt?e.maxValue:0}populatePaintArrays(t,e,r){for(let i in this.binders){let n=this.binders[i];(n instanceof ee||n instanceof Nt||n instanceof ce)&&n.populatePaintArray(t,e,r)}}setConstantPatternPositions(t,e){for(let r in this.binders){let i=this.binders[r];i instanceof Ee&&i.setConstantPatternPositions(t,e)}}setConstantDashPositions(t,e){for(let r in this.binders){let i=this.binders[r];i instanceof Ee&&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 Nt||c instanceof ce)&&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 Or||r instanceof Ee)&&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 Nt)for(let i of r.paintVertexAttributes)t.push(i.name);else if(r instanceof ce){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 Or||r instanceof Ee||r instanceof Nt)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 Or||n instanceof Ee||n instanceof Nt){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 ce){let i=t.fromScale===2?r.zoomInPaintVertexBuffer:r.zoomOutPaintVertexBuffer;i&&this._buffers.push(i)}else(r instanceof ee||r instanceof Nt)&&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 Nt||r instanceof ce)&&r.upload(t)}this.updatePaintBuffers()}destroy(){for(let t in this.binders){let e=this.binders[t];(e instanceof ee||e instanceof Nt||e instanceof ce)&&e.destroy()}}},Le=class{constructor(t,e,r=()=>!0){this.programConfigurations={};for(let i of t)this.programConfigurations[i.id]=new jc(i,e,r);this.needsUpload=!1,this._featureMap=new Nc,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 t0(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 e0(t){return{"line-pattern":{source:Xe,composite:Xe},"fill-pattern":{source:Xe,composite:Xe},"fill-extrusion-pattern":{source:Xe,composite:Xe},"line-dasharray":{source:Ll,composite:Ll}}[t]}function $l(t,e,r){let i={color:{source:si,composite:Wa},number:{source:on,composite:si}};return e0(t)?.[r]||i[e][r]}I("ConstantBinder",Or),I("CrossFadedConstantBinder",Ee),I("SourceExpressionBinder",ee),I("CrossFadedPatternBinder",qc),I("CrossFadedDasharrayBinder",Gc),I("CompositeExpressionBinder",Nt),I("ProgramConfiguration",jc,{omit:["_buffers"]}),I("ProgramConfigurationSet",Le);var es=2**14-1,Nl=-es-1;function $e(t){let e=it/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=Hr(a,Nl,es),n.y=Hr(s,Nl,es),(a<n.x||a>n.x+1||s<n.y||s>n.y+1)&>("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return r}function br(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?$e(t):[]}}var Ul=-32768;function r0(t,e,r,i,n){t.emplaceBack(Ul+e*8+i,Ul+r*8+n)}var io=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 Om,this.indexArray=new xi,this.segments=new Ct,this.programConfigurations=new Le(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||=c.paint.get("circle-pitch-alignment")==="map"}let l=o?e.subdivisionGranularity.circle:1,u=new H(this.zoom),h=this.layers[0]._featureFilter.needGeometry;for(let{feature:c,id:p,index:f,sourceLayerIndex:d}of t){let y=br(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:$e(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})}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Xm),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++)r0(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",io,{omit:["layers"]});function i0(t,e){for(let r of t)if(gr(e,r))return!0;for(let r of e)if(gr(t,r))return!0;return no(t,e)}function Pn(t,e,r){return gr(t,e)?!0:rs(e,t,r)}function Yc(t,e){if(t.length===1)return ql(e,t[0]);for(let r of e)for(let i of r)if(gr(t,i))return!0;for(let r of t)if(ql(e,r))return!0;for(let r of e)if(no(t,r))return!0;return!1}function n0(t,e,r){for(let i of e){if(t.length>=3){for(let n of i)if(gr(t,n))return!0}if(a0(t,i,r))return!0}return!1}function a0(t,e,r){if(t.length>1){if(no(t,e))return!0;for(let i of e)if(rs(i,t,r))return!0}for(let i of t)if(rs(i,e,r))return!0;return!1}function no(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(s0(i,n,s,o))return!0}}return!1}function s0(t,e,r,i){return ye(t,r,i)!==ye(e,r,i)&&ye(t,e,r)!==ye(t,e,i)}function rs(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(Xc(t,a,s)<i)return!0}return!1}function Xc(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 ql(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 gr(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 o0(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 M(e,r),new M(e,n),new M(i,n),new M(i,r)];if(t.length>2){for(let s of a)if(gr(t,s))return!0}for(let s=0;s<t.length-1;s++){let o=t[s],l=t[s+1];if(l0(o,l,a))return!0}return!1}function l0(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=ye(t,e,r[0]);return a!==ye(t,e,r[1])||a!==ye(t,e,r[2])||a!==ye(t,e,r[3])}function nr(t,e,r){let i=e.paint.get(t).value;return i.kind==="constant"?i.value:r.programConfigurations.get(e.id).getMaxValue(t)}function zn(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Ln(t,e,r,i,n){if(!e[0]&&!e[1])return t;let a=M.convert(e)._mult(n);r==="viewport"&&a._rotate(-i);let s=[];for(let o of t)s.push(o.sub(a));return s}function u0(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 h0(t,e){let r=[];for(let i of t){let n=u0(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 M(0,0):o.sub(l)._unit()._perp(),c=s===n.length-1?new M(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 c0({queryGeometry:t,size:e},r){return Pn(t,r,e)}function p0({queryGeometry:t,size:e,transform:r,unwrappedTileID:i,getElevation:n},a){return Pn(t,a,e*(r.projectTileCoordinates(a.x,a.y,i,n?.(a.x,a.y)).signedDistanceFromCamera/r.cameraToCenterDistance))}function f0({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 Pn(t,ao(a,r,i,n),o)}function d0({queryGeometry:t,size:e,transform:r,unwrappedTileID:i,getElevation:n},a){return Pn(t,ao(a,r,i,n),e)}function Zc({queryGeometry:t,size:e,transform:r,unwrappedTileID:i,getElevation:n,pitchAlignment:a="map",pitchScale:s="map"},o){let l=a==="map"?s==="map"?c0:p0:s==="map"?f0:d0,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 ao(t,e,r,i){let n=e.projectTileCoordinates(t.x,t.y,r,i?.(t.x,t.y)).point;return new M((n.x*.5+.5)*e.width,(-n.y*.5+.5)*e.height)}function y0(t,e,r,i){return t.map(n=>ao(n,e,r,i))}var m0,g0=()=>m0||=new Ft({"circle-sort-key":new O(_.layout_circle["circle-sort-key"],"circle-sort-key")}),x0,v0=()=>x0||=new Ft({"circle-radius":new O(_.paint_circle["circle-radius"],"circle-radius"),"circle-color":new O(_.paint_circle["circle-color"],"circle-color"),"circle-blur":new O(_.paint_circle["circle-blur"],"circle-blur"),"circle-opacity":new O(_.paint_circle["circle-opacity"],"circle-opacity"),"circle-translate":new C(_.paint_circle["circle-translate"],"circle-translate"),"circle-translate-anchor":new C(_.paint_circle["circle-translate-anchor"],"circle-translate-anchor"),"circle-pitch-scale":new C(_.paint_circle["circle-pitch-scale"],"circle-pitch-scale"),"circle-pitch-alignment":new C(_.paint_circle["circle-pitch-alignment"],"circle-pitch-alignment"),"circle-stroke-width":new O(_.paint_circle["circle-stroke-width"],"circle-stroke-width"),"circle-stroke-color":new O(_.paint_circle["circle-stroke-color"],"circle-stroke-color"),"circle-stroke-opacity":new O(_.paint_circle["circle-stroke-opacity"],"circle-stroke-opacity")}),b0={get paint(){return v0()},get layout(){return g0()}};var w0=class extends jt{constructor(t,e){super(t,b0,e)}createBucket(t){return new io(t)}queryRadius(t){let e=t;return nr("circle-radius",this,e)+nr("circle-stroke-width",this,e)+zn(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:r,geometry:i,transform:n,pixelsToTileUnits:a,unwrappedTileID:s,getElevation:o}){let l=Ln(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=y0(l,n,s,o),f=u),Zc({queryGeometry:p,size:f,transform:n,unwrappedTileID:s,getElevation:o,pitchAlignment:c,pitchScale:h},i)}},Wc=class extends io{};I("HeatmapBucket",Wc,{omit:["layers"]});var _0,S0=()=>_0||=new Ft({"heatmap-radius":new O(_.paint_heatmap["heatmap-radius"],"heatmap-radius"),"heatmap-weight":new O(_.paint_heatmap["heatmap-weight"],"heatmap-weight"),"heatmap-intensity":new C(_.paint_heatmap["heatmap-intensity"],"heatmap-intensity"),"heatmap-color":new Bn(_.paint_heatmap["heatmap-color"],"heatmap-color"),"heatmap-opacity":new C(_.paint_heatmap["heatmap-opacity"],"heatmap-opacity")}),A0={get paint(){return S0()}};function so(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 Hc(t,{width:e,height:r},i){if(e===t.width&&r===t.height)return;let n=so({},{width:e,height:r},i);oo(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 oo(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 Vn=class Kc{constructor(e,r){so(this,e,1,r)}resize(e){Hc(this,e,1)}clone(){return new Kc({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,i,n,a){oo(e,r,i,n,a,1)}},kt=class Jc{constructor(e,r){so(this,e,4,r)}resize(e){Hc(this,e,4)}replace(e,r){r?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new Jc({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,i,n,a){oo(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 sa(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",Vn),I("RGBAImage",kt);function D0(t){let e={},r=t.resolution||256,i=t.clips?t.clips.length:1,n=t.image||new kt({width:r,height:i});if(!id(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 E0="big-fb";var T0=class extends jt{createBucket(t){return new Wc(t)}constructor(t,e){super(t,A0,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=D0({expression:t,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has("big-fb")&&this.heatmapFbos.delete(E0)}queryRadius(t){return nr("heatmap-radius",this,t)}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:r,geometry:i,transform:n,pixelsToTileUnits:a,unwrappedTileID:s,getElevation:o}){return Zc({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()}},F0,k0=()=>F0||=new Ft({"hillshade-illumination-direction":new C(_.paint_hillshade["hillshade-illumination-direction"],"hillshade-illumination-direction"),"hillshade-illumination-altitude":new C(_.paint_hillshade["hillshade-illumination-altitude"],"hillshade-illumination-altitude"),"hillshade-illumination-anchor":new C(_.paint_hillshade["hillshade-illumination-anchor"],"hillshade-illumination-anchor"),"hillshade-exaggeration":new C(_.paint_hillshade["hillshade-exaggeration"],"hillshade-exaggeration"),"hillshade-shadow-color":new C(_.paint_hillshade["hillshade-shadow-color"],"hillshade-shadow-color"),"hillshade-highlight-color":new C(_.paint_hillshade["hillshade-highlight-color"],"hillshade-highlight-color"),"hillshade-accent-color":new C(_.paint_hillshade["hillshade-accent-color"],"hillshade-accent-color"),"hillshade-method":new C(_.paint_hillshade["hillshade-method"],"hillshade-method"),resampling:new C(_.paint_hillshade.resampling,"resampling")}),I0={get paint(){return k0()}};var M0=class extends jt{constructor(t,e){super(t,I0,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(el);return{directionRadians:t.map(el),altitudeRadians:a,shadowColor:i,highlightColor:r}}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&!this.isHidden()}},C0,B0=()=>C0||=new Ft({"color-relief-opacity":new C(_["paint_color-relief"]["color-relief-opacity"],"color-relief-opacity"),"color-relief-color":new Bn(_["paint_color-relief"]["color-relief-color"],"color-relief-color"),resampling:new C(_["paint_color-relief"].resampling,"resampling")}),P0={get paint(){return B0()}};function oa(t){return"data"in t}var Gl=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.filter=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),oa(t)){s.pixelStoreUnpackPremultiplyAlpha.set(!1);let{data:h}=t;l&&h&&(h=sa(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 oa(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};oa(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&&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=sa(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=sa(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&&!this.useMipmap&&(r=n.LINEAR),t!==this.filter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,t),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,r||t),this.filter=t),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)}destroy(){let{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null,this._ownedHandle=null}},lo=class Wi{static{this.byteViewCache=new WeakMap}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)){gt(`"${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-2;switch(this.data=new Uint32Array(r.data.buffer),Wi.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=0;h<l;h++)this.data[this._idx(-1,h)]=this.data[this._idx(0,h)],this.data[this._idx(l,h)]=this.data[this._idx(l-1,h)],this.data[this._idx(h,-1)]=this.data[this._idx(h,0)],this.data[this._idx(h,l)]=this.data[this._idx(h,l-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(l,-1)]=this.data[this._idx(l-1,0)],this.data[this._idx(-1,l)]=this.data[this._idx(0,l-1)],this.data[this._idx(l,l)]=this.data[this._idx(l-1,l-1)];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+1)*this.stride+i+1)*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<-1||e>=this.dim+1||r<-1||r>=this.dim+1)throw RangeError(`Out of range source coordinates for DEM data. x: ${e}, y: ${r}, dim: ${this.dim}`);return(r+1)*this.stride+(e+1)}unpack(e,r,i){return e*this.redFactor+r*this.greenFactor+i*this.blueFactor-this.baseShift}pack(e){return Qc(e,this.getUnpackVector())}getPixels(){return new kt({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-1;break;case 1:a=n+1}switch(i){case-1:s=o-1;break;case 1:o=s+1}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=Wi.byteViewCache.get(this);return e?.buffer!==this.data.buffer&&(e=new Uint8Array(this.data.buffer),Wi.byteViewCache.set(this,e)),e}_unpackAtIndex(e,r){return this.unpack(e[r],e[r+1],e[r+2])}};function Qc(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",lo);var z0=class extends jt{constructor(t,e){super(t,P0,e)}_createColorRamp(t){let e={elevationStops:[],colorStops:[]},r=this._transitionablePaint._values["color-relief-color"].value.expression;if(r instanceof ri&&r._styleExpression.expression instanceof Zt){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=[nt.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 gt(`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 kt({width:i.colorStops.length,height:1}),a=new kt({width:i.colorStops.length,height:1});for(let s=0;s<i.elevationStops.length;s++){let o=Qc(i.elevationStops[s],r);a.setPixel(0,s,new nt(o.r/255,o.g/255,o.b/255,1)),n.setPixel(0,s,i.colorStops[s])}return this.colorRampTextures={elevationTexture:new Gl(t,a,t.gl.RGBA),colorTexture:new Gl(t,n,t.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return!this.isHidden()&&!!this.colorRampTextures}},is=ut([{name:"a_pos",components:2,type:"Int16"}],4),L0=is.members;is.size,is.alignment;function ln(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 uo(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 oi=new Set,ns=!1;function V0(t,e,r=2){let i=e&&e.length,n=i?e[0]*r:t.length;oi.size&&oi.clear();let a=tp(t,0,n,r,!0),s=[];if(!a||a.next===a.prev)return s;let o=0,l=0,u=0;if(i&&(a=U0(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 as(a,s,o,l,u),s}function tp(t,e,r,i,n){let a=null;if(n===e1(t,e,r,i)>0)for(let s=e;s<r;s+=i)a=Xl(s/i|0,t[s],t[s+1],a);else for(let s=r-i;s>=e;s-=i)a=Xl(s/i|0,t[s],t[s+1],a);return a&&li(a,a.next)&&(hi(a),a=a.next),a}function Ve(t,e=t){let r=e===t,i=t,n;do n=!1,i!==i.next&&(oi.size===0||!oi.has(i))&&(li(i,i.next)||pt(i.prev,i,i.next)===0)?((r||i===e)&&(e=i.prev),ns=!0,hi(i),i=i.prev,n=!0):(r||i!==e)&&(i=i.next,n=!r);while(n||i!==e);return e}function as(t,e,r,i,n){n&&W0(t,r,i,n);let a=t,s=!1;for(;t.prev!==t.next;){let o=t.prev,l=t.next;if(pt(o,t,l)<0&&(n?R0(t,r,i,n):O0(t))){e.push(o.i,t.i,l.i),hi(t),t=l,a=l;continue}if(t=l,t===a){if(ns=!1,t=Ve(t),ns){a=t;continue}if(!s){t=$0(t,e),a=t,s=!0;continue}N0(t,e,r,i,n);break}}}function O0(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)&&hn(n,o,a,l,s,u,d.x,d.y)&&pt(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function R0(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=us(f,d,e,r,i),x=us(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)&&hn(o,h,l,c,u,p,b.x,b.y)&&pt(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)&&hn(o,h,l,c,u,p,v.x,v.y)&&pt(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function $0(t,e){let r=t,i=!1;do{let n=r.prev,a=r.next.next;rp(n,r,r.next,a,!1)&&ui(n,a)&&ui(a,n)&&(e.push(n.i,r.i,a.i),hi(r),hi(r.next),r=t=a,i=!0),r=r.next}while(r!==t);return i?Ve(r):r}function N0(t,e,r,i,n){let a=t;do{let s=a.next.next;for(;s!==a.prev;){if(a.i!==s.i&&J0(a,s)){let o=ip(a,s);a=Ve(a,a.next),o=Ve(o,o.next),as(a,e,r,i,n),as(o,e,r,i,n);return}s=s.next}a=a.next}while(a!==t)}var ss=!1;function U0(t,e,r,i){let n=[];for(let a=0,s=e.length;a<s;a++){let o=tp(t,e[a]*i,a<s-1?e[a+1]*i:t.length,i,!1);o===o.next&&oi.add(o),n.push(K0(o))}n.sort(q0),j0(t.length/i,e.length),ep(r,r),ss=!0;for(let a=0;a<n.length;a++)r=G0(n[a],r);return ss=!1,Ve(r)}function q0(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 G0(t,e){let r=X0(t,e);if(!r)return e;let i=ip(r,t),n=i.next;return ep(r,n.next),Ve(i,i.next),Ve(r,r.next)}var st=new Float64Array,un=0,os=[],ls=[];function j0(t,e){let r=Math.ceil((t+2*e)/16)+e+2;st.length<r*4&&(st=new Float64Array(r*4)),un=0}function ep(t,e){let r=t;do{let i=un++;os[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);ls[i]=r;let u=i*4;st[u]=n,st[u+1]=a,st[u+2]=s,st[u+3]=o}while(r!==e)}function Y0(t,e){let r=t.z*4;e.x<st[r]&&(st[r]=e.x),e.y<st[r+1]&&(st[r+1]=e.y),e.x>st[r+2]&&(st[r+2]=e.x),e.y>st[r+3]&&(st[r+3]=e.y)}function jl(t){let e=ls[t];for(;e.prev.next!==e;)e=e.next;return ls[t]=e,e}function Yl(t){let e=os[t];for(;e.prev.next!==e;)e=e.next;return os[t]=e,e}function X0(t,e){let r=e,i=t.x,n=t.y,a=-1/0,s;if(li(t,r))return r;for(let p=0,f=0;p<un;p++,f+=4){if(n<st[f+1]||n>st[f+3]||st[f]>i||st[f+2]<=a)continue;let d=jl(p);r=Yl(p);do{if(r.prev.next===r){if(li(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<un;p++,f+=4){if(st[f+2]<o||st[f]>i||st[f+3]<u||st[f+1]>h)continue;let d=jl(p);r=Yl(p);do{if(r.prev.next===r&&i>=r.x&&r.x>=o&&i!==r.x&&hn(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);(ui(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&&Z0(s,r)))&&(s=r,c=y)}r=r.next}while(r!==d)}return s}function Z0(t,e){return pt(t.prev,t,e.prev)<0&&pt(e.next,t,t.next)<0}var Lt=[],Tr=[],Ae=new Uint32Array,Fr=new Uint32Array,kr=new Uint32Array(256);function W0(t,e,r,i){let n=t,a=0;do n.z=us(n.x,n.y,e,r,i),Lt[a++]=n,n=n.next;while(n!==t);H0(a);let s=null;for(let o=0;o<a;o++){let l=Lt[o];l.prevZ=s,s&&(s.nextZ=l),s=l}s.nextZ=null}function H0(t){if(t<=32){for(let e=1;e<t;e++){let r=Lt[e],i=r.z,n=e-1;for(;n>=0&&Lt[n].z>i;)Lt[n+1]=Lt[n],n--;Lt[n+1]=r}return}Ae.length<t&&(Ae=new Uint32Array(t),Fr=new Uint32Array(t),Tr=Array(t));for(let e=0;e<t;e++)Ae[e]=Lt[e].z;Bi(t,Lt,Ae,Tr,Fr,0),Bi(t,Tr,Fr,Lt,Ae,8),Bi(t,Lt,Ae,Tr,Fr,16),Bi(t,Tr,Fr,Lt,Ae,24)}function Bi(t,e,r,i,n,a){kr.fill(0);for(let o=0;o<t;o++)kr[r[o]>>>a&255]++;let s=0;for(let o=0;o<256;o++){let l=kr[o];kr[o]=s,s+=l}for(let o=0;o<t;o++){let l=r[o],u=kr[l>>>a&255]++;i[u]=e[o],n[u]=l}}function us(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 K0(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 hn(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 J0(t,e){let r=li(t,e)&&pt(t.prev,t,t.next)>0&&pt(e.prev,e,e.next)>0;return t.next.i!==e.i&&(r||ui(t,e)&&ui(e,t)&&(pt(t.prev,t,e.prev)!==0||pt(t,e.prev,e)!==0))&&!Q0(t,e)&&(r||t1(t,e))}function pt(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function li(t,e){return t.x===e.x&&t.y===e.y}function rp(t,e,r,i,n=!0){let a=pt(t,e,r),s=pt(t,e,i),o=pt(r,i,t),l=pt(r,i,e);return(a>0&&s<0||a<0&&s>0)&&(o>0&&l<0||o<0&&l>0)?!0:n?!!(a===0&&Pi(t,r,e)||s===0&&Pi(t,i,e)||o===0&&Pi(r,t,i)||l===0&&Pi(r,e,i)):!1}function Pi(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 Q0(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&&rp(s,o,t,e))return!0;s=o}while(s!==t);return!1}function ui(t,e){return pt(t.prev,t,t.next)<0?pt(t,e,t.next)>=0&&pt(t,t.prev,e)>=0:pt(t,e,t.prev)<0||pt(t,t.next,e)<0}function t1(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 ip(t,e){let r=hs(t.i,t.x,t.y),i=hs(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 Xl(t,e,r,i){let n=hs(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 hi(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),ss&&Y0(t.prev,t.next)}function hs(t,e,r){return{i:t,x:e,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null}}function e1(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 Rr=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)}},r1=class np{constructor(e){this.fill=e.fill,this.line=e.line,this.tile=e.tile,this.stencil=e.stencil,this.circle=e.circle}static{this.noSubdivision=new np({fill:new Rr(0,0),line:new Rr(0,0),tile:new Rr(0,0),stencil:new Rr(0,0),circle:1})}};I("SubdivisionGranularityExpression",Rr),I("SubdivisionGranularitySetting",r1);var la=-32768,ua=32767,i1=class{constructor(t,e){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=t,this._granularityCellSize=it/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 a1(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);s1(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 S=o+f*b,D=l+d*b;a.push(this._vertexToIndex(S,D))}let w=o+f*Math.max(b,0),A=o+f*Math.min(v,1);if(y||this._generateIntraEdgeVertices(a,o,l,u,h,w,A),!m&&v<1){let S=o+f*v,D=l+d*v;a.push(this._vertexToIndex(S,D))}(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,A,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 S=e-a,D=r-s,E=(l-s)/D,L=(u-s)/D,$=a+S*Math.min(E,L);x=Math.floor(Math.min($,o)/this._granularityCellSize)+1,b=Math.ceil(Math.max($,o)/this._granularityCellSize)-1,v=o<$}let A=h>0?u:l;if(v)for(let S=x;S<=b;S++){let D=S*this._granularityCellSize;t.push(this._vertexToIndex(D,A))}else for(let S=b;S>=x;S--){let D=S*this._granularityCellSize;t.push(this._vertexToIndex(D,A))}}_generateOutline(t){let e=[];for(let r of t){let i=Fe(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=it,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,la),f===0&&y===0&&this._generatePoleQuad(t,l,u,p,d,la),y===0&&c===0&&this._generatePoleQuad(t,u,o,d,h,la)),r&&(c===n&&f===n&&this._generatePoleQuad(t,o,l,h,p,ua),f===n&&y===n&&this._generatePoleQuad(t,l,u,p,d,ua),y===n&&c===n&&this._generatePoleQuad(t,u,o,d,h,ua))}}_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}=n1(t);this._initializeVertices(r);let n;try{let s=V0(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 ap(t,e,r,i=!0){return new i1(r,e).subdividePolygonInternal(t,i)}function Fe(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(it/e),o=[];o.push(new M(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),A=Math.abs(v),S=f,D=d;for(;;){let L=b>0?(Math.floor(S/s)+1)*s:(Math.ceil(S/s)-1)*s,$=v>0?(Math.floor(D/s)+1)*s:(Math.ceil(D/s)-1)*s,P=Math.abs(S-L),z=Math.abs(D-$),F=Math.abs(S-y),V=Math.abs(D-m),R=g?P/w:1/0,B=x?z/A:1/0;if((F<=P||!g)&&(V<=z||!x))break;if(R<B&&g||!x){S=L,D+=v*R;let G=new M(S,Math.round(D));(o[o.length-1].x!==G.x||o[o.length-1].y!==G.y)&&o.push(G)}else{S+=b*B,D=$;let G=new M(Math.round(S),D);(o[o.length-1].x!==G.x||o[o.length-1].y!==G.y)&&o.push(G)}}let E=new M(y,m);(o[o.length-1].x!==E.x||o[o.length-1].y!==E.y)&&o.push(E)}return o}function n1(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 a1(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 s1(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 sp(t,e,r,i,n,a,s,o,l){let u=n.length/2,h=s&&o&&l;if(u<Ct.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 o1(e,r,i,n,a,t),h&&l1(s,r,o,n,l,t),e.forceNewSegmentOnNextPrepare(),s?.forceNewSegmentOnNextPrepare()}function Xr(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 o1(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>Ct.MAX_VERTEX_ARRAY_LENGTH&&(u=t.createNewSegment(e,r),l=o.count,y=!0,m=!0,g=!0,h=0);let b=Xr(s,i,a,o,p,y,u),v=Xr(s,i,a,o,f,m,u),w=Xr(s,i,a,o,d,g,u);r.emplaceBack(h+b-l,h+v-l,h+w-l),u.primitiveLength++}}function l1(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>Ct.MAX_VERTEX_ARRAY_LENGTH&&(u=t.createNewSegment(e,r),l=o.count,y=!0,m=!0,h=0);let x=Xr(s,i,a,o,f,y,u),b=Xr(s,i,a,o,d,m,u);r.emplaceBack(h+x-l,h+b-l),u.primitiveLength++}}var On=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.patternFeatures=[],this.layoutVertexArray=new Rm,this.indexArray=new xi,this.indexArray2=new Ha,this.programConfigurations=new Le(t.layers,t.zoom),this.segments=new Ct,this.segments2=new Ct,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(t,e,r){this.hasDependencies=ln("fill",this.layers,e);let i=this.layers[0].layout.get("fill-sort-key"),n=!i.isConstant(),a=[],s=new H(this.zoom),o=this.layers[0]._featureFilter.needGeometry;for(let{feature:l,id:u,index:h,sourceLayerIndex:c}of t){let p=br(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:$e(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=uo("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(t,e,r){for(let i of this.patternFeatures)this.addFeature(i,i.geometry,i.index,e,r,t.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,L0),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 Sn(e,500)){let o=ap(s,i,a.fill.getGranularityForZoomLevel(i.z)),l=this.layoutVertexArray;sp((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",On,{omit:["layers","patternFeatures"]});var u1,h1=()=>u1||=new Ft({"fill-sort-key":new O(_.layout_fill["fill-sort-key"],"fill-sort-key")}),c1,p1=()=>c1||=new Ft({"fill-antialias":new C(_.paint_fill["fill-antialias"],"fill-antialias"),"fill-opacity":new O(_.paint_fill["fill-opacity"],"fill-opacity"),"fill-layer-opacity":new C(_.paint_fill["fill-layer-opacity"],"fill-layer-opacity"),"fill-color":new O(_.paint_fill["fill-color"],"fill-color"),"fill-outline-color":new O(_.paint_fill["fill-outline-color"],"fill-outline-color"),"fill-translate":new C(_.paint_fill["fill-translate"],"fill-translate"),"fill-translate-anchor":new C(_.paint_fill["fill-translate-anchor"],"fill-translate-anchor"),"fill-pattern":new ni(_.paint_fill["fill-pattern"],"fill-pattern")}),f1={get paint(){return p1()},get layout(){return h1()}};var d1=class extends jt{constructor(t,e){super(t,f1,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 On(t)}queryRadius(){return zn(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:t,geometry:e,transform:r,pixelsToTileUnits:i}){return Yc(Ln(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-r.bearingInRadians,i),e)}isTileClipped(){return!0}},cs=ut([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),y1=ut([{name:"a_centroid",components:2,type:"Int16"}],4),m1=cs.members;cs.size,cs.alignment;var cn=class ps{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 ps;return r.extend(e(new M(this.minX,this.minY))),r.extend(e(new M(this.maxX,this.minY))),r.extend(e(new M(this.minX,this.maxY))),r.extend(e(new M(this.maxX,this.maxY))),r}static fromPoints(e){let r=new ps;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}},vw=cn.fromPoints([new M(0,0),new M(it,it)]);function fs(t,e){return t.x===e.x&&(t.x<0||t.x>8192)||t.y===e.y&&(t.y<0||t.y>8192)}function Zl(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 vi=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 M(s,o)];else if(n===2)s+=t.readSVarint(),o+=t.readSVarint(),i&&i.push(new M(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 c=op(s),p=[];for(let f of c)p.push(f.map(l));u=p.length===1?{type:"Polygon",coordinates:p[0]}:{type:"MultiPolygon",coordinates:p}}else throw Error("unknown feature type");let h={type:"Feature",geometry:u,properties:this.properties};return this.id!=null&&(h.id=this.id),h}};vi.types=["Unknown","Point","LineString","Polygon"];function op(t){let e=t.length;if(e<=1)return[t];let r=[],i,n;for(let a=0;a<e;a++){let s=g1(t[a]);s!==0&&(n===void 0&&(n=s<0),n===s<0?(i&&r.push(i),i=[t[a]]):i&&i.push(t[a]))}return i&&r.push(i),r}function g1(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 x1=class{constructor(t,e){for(this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],e===void 0&&(e=t.length);t.pos<e;){let r=t.readVarint();r===10?this.name=t.readString():r===18?(this._features.push(t.pos),t.skip(r)):r===26?this._keys.push(t.readString()):r===34?this._values.push(v1(t)):r===40?this.extent=t.readVarint():r===120?this.version=t.readVarint():t.skip(r)}this.length=this._features.length}feature(t){if(t<0||t>=this._features.length)throw Error("feature index out of bounds");this._pbf.pos=this._features[t];let e=this._pbf.readVarint()+this._pbf.pos;return new vi(this._pbf,e,this.extent,this._keys,this._values)}};function v1(t){let e=null,r=t.readVarint()+t.pos;for(;t.pos<r;){let i=t.readVarint();e=i===10?t.readString():i===21?t.readFloat():i===25?t.readDouble():i===32?t.readVarint(!0):i===40?t.readVarint():i===48?t.readSVarint():i===56?t.readBoolean():(t.skip(i),null)}if(e==null)throw Error("unknown feature value");return e}var ho=class{constructor(t,e=t.length){let r=Object.create(null);for(;t.pos<e;){let i=t.readVarint();if(i===26){let n=new x1(t,t.readVarint()+t.pos);n.length&&(r[n.name]=n)}else t.skip(i)}this.layers=r}},lp=63710088e-1,Wl=class $r{constructor(e,r){if(isNaN(e)||isNaN(r))throw Error(`Invalid LngLat object: (${e}, ${r})`);if(this.lng=+e,this.lat=+r,this.lat>90||this.lat<-90)throw Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new $r(rd(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){let r=Math.PI/180,i=this.lat*r,n=e.lat*r,a=Math.sin(i)*Math.sin(n)+Math.cos(i)*Math.cos(n)*Math.cos((e.lng-this.lng)*r);return lp*Math.acos(Math.min(a,1))}static convert(e){if(e instanceof $r)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new $r(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e)return new $r(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}},up=2*Math.PI*lp;function hp(t){return up*Math.cos(t*Math.PI/180)}function b1(t){return(180+t)/360}function w1(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function _1(t,e){return t/hp(e)}function S1(t){return t*360-180}function ds(t){let e=180-t*360;return 360/Math.PI*Math.atan(Math.exp(e*Math.PI/180))-90}function A1(t,e){return t*hp(ds(e))}function D1(t){return 1/Math.cos(t*Math.PI/180)}var co=class cp{constructor(e,r,i=0){this.x=+e,this.y=+r,this.z=+i}static fromLngLat(e,r=0){let i=Wl.convert(e);return new cp(b1(i.lng),w1(i.lat),_1(r,i.lat))}toLngLat(){return new Wl(S1(this.x),ds(this.y))}toAltitude(){return A1(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/up*D1(ds(this.y))}};function E1(t,e,r){let i=1/(1<<r.z);return new co(t/it*i+r.x*i,e/it*i+r.y*i)}function T1(t,e,r){return E1(t,e,r).toLngLat()}function Hl(t,e,r){if(e<=0||!t||t.length===0)return t;let i=F1(e,r);return t.map(n=>k1(n,i))}function F1(t,e){let r=T1(it/2,it/2,e),i=co.fromLngLat(r).meterInMercatorCoordinateUnits(),n=(1<<e.z)*it;return t*i*n}function k1(t,e){if(!t||t.length<3)return t;let r=t[0].x===t[t.length-1].x&&t[0].y===t[t.length-1].y,i=r?t.length-1:t.length;if(i<3)return t;let n=[];for(let s=0;s<i;s++){let o=t[(s-1+i)%i],l=t[s],u=t[(s+1)%i];if(fs(o,l)||fs(l,u)){n.push(l.clone());continue}M1(n,o,l,u,e)}let a=I1(n);return a.length<3?t:(r&&a.push(a[0].clone()),a)}function I1(t){let e=[];for(let r of t){let i=r.round(),n=e[e.length-1];(n?.x!==i.x||n?.y!==i.y)&&e.push(i)}for(;e.length>1&&e[0].x===e[e.length-1].x&&e[0].y===e[e.length-1].y;)e.pop();return e}function M1(t,e,r,i,n){let a=e.sub(r),s=i.sub(r),o=a.mag(),l=s.mag();if(o<1e-6||l<1e-6){t.push(r.clone());return}a._div(o),s._div(l);let u=a.x*s.x+a.y*s.y;if(Math.abs(u)>Math.cos(5*Math.PI/180)){t.push(r.clone());return}let h=.2,c=Math.min(n,o*h,l*h),p=r.add(a.mult(c)),f=r.add(s.mult(c)),d=Math.sqrt((1+u)/2),y=r.add(a.add(s)._unit()._mult(c/d)),m=p.sub(y).angleWith(f.sub(y)),g=Math.max(2,Math.ceil(Math.abs(m)/(Math.PI/6)-1e-6));for(let x=0;x<=g;x++)t.push(p.rotateAround(x/g*m,y))}var ha=8192;function Ir(t,e,r,i,n,a,s,o){t.emplaceBack(e,r,Math.floor(i*ha)*2+s,n*ha*2,a*ha*2,Math.round(o))}var Rn=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.centroidVertexArray=new Vm,this.indexArray=new xi,this.programConfigurations=new Le(t.layers,t.zoom),this.segments=new Ct,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(t,e,r){this.features=[],this.hasDependencies=ln("fill-extrusion",this.layers,e);let i=new H(this.zoom),n=this.layers[0],a=n.layout.get("fill-extrusion-rounded-corner-distance"),s=n._featureFilter.needGeometry;for(let{feature:o,id:l,index:u,sourceLayerIndex:h}of t){let c=br(o,s);if(!n._featureFilter.filter(i,c,r))continue;let p=s?c.geometry:$e(o),f={id:l,sourceLayerIndex:h,index:u,geometry:a>0?Hl(p,a,r):p,properties:o.properties,type:o.type,patterns:{}};this.hasDependencies?this.features.push(uo("fill-extrusion",this.layers,f,{zoom:this.zoom},e)):this.addFeature(f,f.geometry,u,r,{},e.subdivisionGranularity),e.featureIndex.insert(o,f.geometry,u,h,this.index,!0)}}addFeatures(t,e,r){for(let i of this.features){let{geometry:n}=i;this.addFeature(i,n,i.index,e,r,t.subdivisionGranularity)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,{imagePositions:r})}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,m1),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,y1.members,!0),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(),this.centroidVertexBuffer.destroy())}addFeature(t,e,r,i,n,a){let s=this.layers[0],o=s.layout?s.layout.get("fill-extrusion-rounded-corner-distance"):0,l=o>0?Hl(e,o,i):e;for(let u of Sn(l,500)){let h={x:0,y:0,sampleCount:0},c=this.layoutVertexArray.length;this.processPolygon(h,i,t,u,a);let p=this.layoutVertexArray.length-c,f=Math.floor(h.x/h.sampleCount),d=Math.floor(h.y/h.sampleCount);for(let y=0;y<p;y++)this.centroidVertexArray.emplaceBack(f,d)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{imagePositions:n,canonical:i})}processPolygon(t,e,r,i,n){if(i.length<1||Zl(i[0]))return;for(let h of i)h.length!==0&&C1(t,h);let a={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},s=n.fill.getGranularityForZoomLevel(e.z),o=vi.types[r.type]==="Polygon";for(let h of i){if(h.length===0||Zl(h))continue;let c=Fe(h,s,o);this._generateSideFaces(c,a)}if(!o)return;let l=ap(i,e,s,!1),u=this.layoutVertexArray;sp((h,c)=>{Ir(u,h,c,0,0,1,1,0)},this.segments,this.layoutVertexArray,this.indexArray,l.verticesFlattened,l.indicesTriangles)}_generateSideFaces(t,e){let r=0;for(let i=1;i<t.length;i++){let n=t[i],a=t[i-1];if(fs(n,a))continue;e.segment.vertexLength+4>Ct.MAX_VERTEX_ARRAY_LENGTH&&(e.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let s=n.sub(a)._perp()._unit(),o=a.dist(n);r+o>32768&&(r=0),Ir(this.layoutVertexArray,n.x,n.y,s.x,s.y,0,0,r),Ir(this.layoutVertexArray,n.x,n.y,s.x,s.y,0,1,r),r+=o,Ir(this.layoutVertexArray,a.x,a.y,s.x,s.y,0,0,r),Ir(this.layoutVertexArray,a.x,a.y,s.x,s.y,0,1,r);let l=e.segment.vertexLength;this.indexArray.emplaceBack(l,l+2,l+1),this.indexArray.emplaceBack(l+1,l+2,l+3),e.segment.vertexLength+=4,e.segment.primitiveLength+=2}}};function C1(t,e){for(let r=0;r<e.length;r++){let i=e[r];(r!==e.length-1||e[0].x!==i.x||e[0].y!==i.y)&&(t.x+=i.x,t.y+=i.y,t.sampleCount++)}}I("FillExtrusionBucket",Rn,{omit:["layers","features"]});var B1,P1=()=>B1||=new Ft({"fill-extrusion-rounded-corner-distance":new C(_["layout_fill-extrusion"]["fill-extrusion-rounded-corner-distance"],"fill-extrusion-rounded-corner-distance")}),z1,L1=()=>z1||=new Ft({"fill-extrusion-opacity":new C(_["paint_fill-extrusion"]["fill-extrusion-opacity"],"fill-extrusion-opacity"),"fill-extrusion-color":new O(_["paint_fill-extrusion"]["fill-extrusion-color"],"fill-extrusion-color"),"fill-extrusion-translate":new C(_["paint_fill-extrusion"]["fill-extrusion-translate"],"fill-extrusion-translate"),"fill-extrusion-translate-anchor":new C(_["paint_fill-extrusion"]["fill-extrusion-translate-anchor"],"fill-extrusion-translate-anchor"),"fill-extrusion-pattern":new ni(_["paint_fill-extrusion"]["fill-extrusion-pattern"],"fill-extrusion-pattern"),"fill-extrusion-height":new O(_["paint_fill-extrusion"]["fill-extrusion-height"],"fill-extrusion-height"),"fill-extrusion-base":new O(_["paint_fill-extrusion"]["fill-extrusion-base"],"fill-extrusion-base"),"fill-extrusion-vertical-gradient":new C(_["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"],"fill-extrusion-vertical-gradient")}),V1={get paint(){return L1()},get layout(){return P1()}};var O1=class extends jt{constructor(t,e){super(t,V1,e)}createBucket(t){return new Rn(t)}queryRadius(){return zn(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:r,geometry:i,transform:n,pixelsToTileUnits:a,pixelPosMatrix:s}){let o=Ln(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-n.bearingInRadians,a),l=this.paint.get("fill-extrusion-height").evaluate(e,r),u=this.paint.get("fill-extrusion-base").evaluate(e,r),h=N1(o,s,0),c=$1(i,u,l,s),p=c[0],f=c[1];return R1(p,f,h)}};function Mr(t,e){return t.x*e.x+t.y*e.y}function Kl(t,e){if(t.length===1){let r=0,i=e[r++],n;for(;!n||i.equals(n);)if(n=e[r++],!n)return 1/0;for(;r<e.length;r++){let a=e[r],s=t[0],o=n.sub(i),l=a.sub(i),u=s.sub(i),h=Mr(o,o),c=Mr(o,l),p=Mr(l,l),f=Mr(u,o),d=Mr(u,l),y=h*p-c*c,m=(p*f-c*d)/y,g=(h*d-c*f)/y,x=1-m-g,b=i.z*x+n.z*m+a.z*g;if(isFinite(b))return b}return 1/0}{let r=1/0;for(let i of e)r=Math.min(r,i.z);return r}}function R1(t,e,r){let i=1/0;Yc(r,e)&&(i=Kl(r,e[0]));for(let n=0;n<e.length;n++){let a=e[n],s=t[n];for(let o=0;o<a.length-1;o++){let l=a[o],u=a[o+1],h=s[o],c=[l,u,s[o+1],h,l];i0(r,c)&&(i=Math.min(i,Kl(r,c)))}}return i!==1/0&&i}function $1(t,e,r,i){let n=[],a=[],s=i[8]*e,o=i[9]*e,l=i[10]*e,u=i[11]*e,h=i[8]*r,c=i[9]*r,p=i[10]*r,f=i[11]*r;for(let d of t){let y=[],m=[];for(let g of d){let x=g.x,b=g.y,v=i[0]*x+i[4]*b+i[12],w=i[1]*x+i[5]*b+i[13],A=i[2]*x+i[6]*b+i[14],S=i[3]*x+i[7]*b+i[15],D=v+s,E=w+o,L=A+l,$=S+u,P=v+h,z=w+c,F=A+p,V=S+f,R=new M(D/$,E/$);R.z=L/$,y.push(R);let B=new M(P/V,z/V);B.z=F/V,m.push(B)}n.push(y),a.push(m)}return[n,a]}function N1(t,e,r){let i=[];for(let n of t){let a=[n.x,n.y,r,1];Hf(a,a,e),i.push(new M(a[0]/a[3],a[1]/a[3]))}return i}function ys(t,e,r,i){let n=i,a=e+(r-e>>1),s=r-e,o,l=t[e],u=t[e+1],h=t[r],c=t[r+1];for(let p=e+3;p<r;p+=3){let f=U1(t[p],t[p+1],l,u,h,c);if(f>n){o=p,n=f;continue}if(f===n){let d=Math.abs(p-a);d<s&&(o=p,s=d)}}n>i&&(o-e>3&&ys(t,e,o,i),t[o+2]=n,r-o>3&&ys(t,o,r,i))}function U1(t,e,r,i,n,a){let s=n-r,o=a-i;if(s!==0||o!==0){let l=((t-r)*s+(e-i)*o)/(s*s+o*o);l>1?(r=n,i=a):l>0&&(r+=s*l,i+=o*l)}return s=t-r,o=e-i,s*s+o*o}function mt(t,e,r,i){let n={type:e,geom:r},a={id:t??null,type:n.type,geometry:n.geom,tags:i,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};switch(n.type){case"Point":case"MultiPoint":Cr(a,n.geom);break;case"LineString":Cr(a,n.geom.points);break;case"Polygon":Cr(a,n.geom[0].points);break;case"MultiLineString":for(let s of n.geom)Cr(a,s.points);break;case"MultiPolygon":for(let s of n.geom)Cr(a,s[0].points)}return a}function po(t){let e=t;t.points.length>64&&(e.points=new Float64Array(t.points))}function Cr(t,e){for(let r=0;r<e.length;r+=3)t.minX=Math.min(t.minX,e[r]),t.minY=Math.min(t.minY,e[r+1]),t.maxX=Math.max(t.maxX,e[r]),t.maxY=Math.max(t.maxY,e[r+1])}function fo(t,e){let r=[];switch(t.type){case"FeatureCollection":for(let i=0;i<t.features.length;i++)Hi(r,t.features[i],e,i);break;case"Feature":Hi(r,t,e);break;default:Hi(r,{type:"Feature",geometry:t,properties:void 0},e)}return r}function Hi(t,e,r,i,n=0){if(!e.geometry)return;if(n>1024)throw Error("GeometryCollection nesting exceeds supported depth: 1024");if(e.geometry.type==="GeometryCollection"){G1(t,e,e.geometry,r,i,n+1);return}if(!e.geometry.coordinates?.length)return;let a=q1(e,r,i),s=(r.tolerance/((1<<r.maxZoom)*r.extent))**2;switch(e.geometry.type){case"Point":j1(t,a,e.geometry,e.properties);return;case"MultiPoint":Y1(t,a,e.geometry,e.properties);return;case"LineString":X1(t,a,e.geometry,s,e.properties);return;case"MultiLineString":Z1(t,a,e.geometry,s,r,e.properties);return;case"Polygon":W1(t,a,e.geometry,s,e.properties);return;case"MultiPolygon":H1(t,a,e.geometry,s,e.properties);return;default:throw Error("Input data is not a valid GeoJSON object.")}}function q1(t,e,r){return e.promoteId?t.properties?.[e.promoteId]:e.generateId?r||0:t.id}function G1(t,e,r,i,n,a=0){for(let s of r.geometries)Hi(t,{id:e.id,type:"Feature",geometry:s,properties:e.properties},i,n,a)}function j1(t,e,r,i){let n=[];n.push(ar(r.coordinates[0]),sr(r.coordinates[1]),0),t.push(mt(e,"Point",n,i))}function Y1(t,e,r,i){let n=[];for(let a of r.coordinates)n.push(ar(a[0]),sr(a[1]),0);t.push(mt(e,"MultiPoint",n,i))}function X1(t,e,r,i,n){let a={points:[]};yo(r.coordinates,a,i,!1),t.push(mt(e,"LineString",a,n))}function Z1(t,e,r,i,n,a){if(n.lineMetrics)for(let s of r.coordinates){let o={points:[]};yo(s,o,i,!1),t.push(mt(e,"LineString",o,a))}else{let s=[];mo(r.coordinates,s,i,!1),t.push(mt(e,"MultiLineString",s,a))}}function W1(t,e,r,i,n){let a=[];mo(r.coordinates,a,i,!0),t.push(mt(e,"Polygon",a,n))}function H1(t,e,r,i,n){let a=[];for(let s of r.coordinates){let o=[];mo(s,o,i,!0),a.push(o)}t.push(mt(e,"MultiPolygon",a,n))}function yo(t,e,r,i){let n,a,s=0;for(let l=0;l<t.length;l++){let u=ar(t[l][0]),h=sr(t[l][1]);e.points.push(u,h,0),l>0&&(s+=i?(n*h-u*a)/2:Math.sqrt((u-n)**2+(h-a)**2)),n=u,a=h}let o=e.points.length-3;e.points[2]=1,r>0&&ys(e.points,0,o,r),e.points[o+2]=1,po(e),e.size=Math.abs(s),e.start=0,e.end=e.size}function mo(t,e,r,i){for(let n=0;n<t.length;n++){let a={points:[]};yo(t[n],a,r,i),e.push(a)}}function ar(t){return t/360+.5}function sr(t){let e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function K1(t){return{type:"FeatureCollection",features:t.map(e=>pn(e))}}function pn(t){let e={type:"Feature",geometry:J1(t),properties:t.tags};return t.id!=null&&(e.id=t.id),e}function J1(t){let{type:e,geometry:r}=t;switch(e){case"Point":return{type:e,coordinates:pp(r[0],r[1])};case"MultiPoint":return{type:e,coordinates:zi(r)};case"LineString":return{type:e,coordinates:zi(r.points)};case"MultiLineString":case"Polygon":return{type:e,coordinates:r.map(i=>zi(i.points))};case"MultiPolygon":return{type:e,coordinates:r.map(i=>i.map(n=>zi(n.points)))}}}function zi(t){let e=[];for(let r=0;r<t.length;r+=3)e.push(pp(t[r],t[r+1]));return e}function pp(t,e){return[fp(t),dp(e)]}function fp(t){return(t-.5)*360}function dp(t){let e=(180-t*360)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function re(t,e,r,i,n,a,s,o){if(r/=e,i/=e,a>=r&&s<i)return t;if(s<r||a>=i)return null;let l=[];for(let u of t){let h=n===0?u.minX:u.minY,c=n===0?u.maxX:u.maxY;if(h>=r&&c<i){l.push(u);continue}if(!(c<r||h>=i))switch(u.type){case"Point":case"MultiPoint":Q1(u,l,r,i,n);continue;case"LineString":tg(u,l,r,i,n,o);continue;case"MultiLineString":eg(u,l,r,i,n);continue;case"Polygon":rg(u,l,r,i,n);continue;case"MultiPolygon":ig(u,l,r,i,n);continue}}return l.length?l:null}function Q1(t,e,r,i,n){let a=[];if(ng(t.geometry,a,r,i,n),!a.length)return;let s=a.length===3?"Point":"MultiPoint";e.push(mt(t.id,s,a,t.tags))}function tg(t,e,r,i,n,a){let s=[];if(yp(t.geometry,s,r,i,n,!1,a.lineMetrics),s.length){if(a.lineMetrics){for(let o of s)e.push(mt(t.id,"LineString",o,t.tags));return}if(s.length>1){e.push(mt(t.id,"MultiLineString",s,t.tags));return}e.push(mt(t.id,"LineString",s[0],t.tags))}}function eg(t,e,r,i,n){let a=[];if(go(t.geometry,a,r,i,n,!1),a.length){if(a.length===1){e.push(mt(t.id,"LineString",a[0],t.tags));return}e.push(mt(t.id,"MultiLineString",a,t.tags))}}function rg(t,e,r,i,n){let a=[];go(t.geometry,a,r,i,n,!0),a.length&&e.push(mt(t.id,"Polygon",a,t.tags))}function ig(t,e,r,i,n){let a=[];for(let s of t.geometry){let o=[];go(s,o,r,i,n,!0),o.length&&a.push(o)}a.length&&e.push(mt(t.id,"MultiPolygon",a,t.tags))}function ng(t,e,r,i,n){for(let a=0;a<t.length;a+=3){let s=t[a+n];s>=r&&s<=i&&or(e,t[a],t[a+1],t[a+2])}}function yp(t,e,r,i,n,a,s){let o=Jl(t),l=n===0?ag:sg,u=t.start,h,c;for(let g=0;g<t.points.length-3;g+=3){let x=t.points[g],b=t.points[g+1],v=t.points[g+2],w=t.points[g+3],A=t.points[g+4],S=n===0?x:b,D=n===0?w:A,E=!1;s&&(h=Math.sqrt((x-w)**2+(b-A)**2)),S<r?D>r&&(c=l(o,x,b,w,A,r),s&&(o.start=u+h*c)):S>i?D<i&&(c=l(o,x,b,w,A,i),s&&(o.start=u+h*c)):or(o.points,x,b,v),D<r&&S>=r&&(c=l(o,x,b,w,A,r),E=!0),D>i&&S<=i&&(c=l(o,x,b,w,A,i),E=!0),!a&&E&&(s&&(o.end=u+h*c),e.push(o),o=Jl(t)),s&&(u+=h)}let p=t.points.length-3,f=t.points[p],d=t.points[p+1],y=t.points[p+2],m=n===0?f:d;m>=r&&m<=i&&or(o.points,f,d,y),p=o.points.length-3,a&&p>=3&&(o.points[p]!==o.points[0]||o.points[p+1]!==o.points[1])&&or(o.points,o.points[0],o.points[1],o.points[2]),o.points.length&&(po(o),e.push(o))}function Jl(t){return{points:[],size:t.size,start:t.start,end:t.end}}function go(t,e,r,i,n,a){for(let s of t)yp(s,e,r,i,n,a,!1)}function or(t,e,r,i){t.push(e,r,i)}function ag(t,e,r,i,n,a){let s=(a-e)/(i-e);return or(t.points,a,r+(n-r)*s,1),s}function sg(t,e,r,i,n,a){let s=(a-r)/(n-r);return or(t.points,e+(i-e)*s,a,1),s}function xo(t,e){let r=e.buffer/e.extent,i=t,n=re(t,1,-1-r,r,0,-1,2,e),a=re(t,1,1-r,2+r,0,-1,2,e);return!n&&!a||(i=re(t,1,-r,1+r,0,-1,2,e)||[],n&&(i=Ql(n,1).concat(i)),a&&(i=i.concat(Ql(a,-1)))),i}function Ql(t,e){let r=[];for(let i of t)switch(i.type){case"Point":case"MultiPoint":{let n=og(i.geometry,e);r.push(mt(i.id,i.type,n,i.tags));continue}case"LineString":{let n=ca(i.geometry,e);r.push(mt(i.id,i.type,n,i.tags));continue}case"MultiLineString":case"Polygon":{let n=[];for(let a of i.geometry)n.push(ca(a,e));r.push(mt(i.id,i.type,n,i.tags));continue}case"MultiPolygon":{let n=[];for(let a of i.geometry){let s=[];for(let o of a)s.push(ca(o,e));n.push(s)}r.push(mt(i.id,i.type,n,i.tags));continue}}return r}function og(t,e){let r=[];for(let i=0;i<t.length;i+=3)r.push(t[i]+e,t[i+1],t[i+2]);return r}function ca(t,e){let r={points:[],size:t.size};t.start!==void 0&&(r.start=t.start,r.end=t.end);for(let i=0;i<t.points.length;i+=3)r.points.push(t.points[i]+e,t.points[i+1],t.points[i+2]);return po(r),r}function lg(t,e,r){let i=hg(e,r),n=[];if(i.removeAll&&(n=t,t=[]),i.remove.size||i.add.size){let a=[];for(let s of t)(i.remove.has(s.id)||i.add.has(s.id))&&a.push(s);if(a.length){n=n.concat(a);let s=new Set(a.map(o=>o.id));t=t.filter(o=>!s.has(o.id))}if(i.add.size){let s=fo({type:"FeatureCollection",features:Array.from(i.add.values())},r);s=xo(s,r),n=n.concat(s),t=t.concat(s)}}if(i.update.size){let a=new Map,s=[];for(let o of t)i.update.has(o.id)?a.set(o.id,[...a.get(o.id)||[],o]):s.push(o);for(let[o,l]of i.update){let u=a.get(o);if(!u||u.length===0)continue;let h=ug(u,l,r);n=n.concat(u,h),s=s.concat(h)}t=s}return{affected:n,source:t}}function ug(t,e,r){let i=!!e.newGeometry,n=e.removeAllProperties||e.removeProperties?.length>0||e.addOrUpdateProperties?.length>0;if(i){let a=t[0],s=fo({type:"FeatureCollection",features:[{type:"Feature",id:a.id,geometry:e.newGeometry,properties:n?tu(a.tags,e):a.tags}]},r);return s=xo(s,r),s}if(n){let a=[];for(let s of t){let o={...s};o.tags=tu(o.tags,e),a.push(o)}return a}return t}function tu(t,e){if(e.removeAllProperties)return{};let r={...t||{}};if(e.removeProperties)for(let i of e.removeProperties)delete r[i];if(e.addOrUpdateProperties)for(let{key:i,value:n}of e.addOrUpdateProperties)r[i]=n;return r}function hg(t,e){return t?{removeAll:t.removeAll,remove:new Set(t.remove||[]),add:new Map(t.add?.map(r=>[e.promoteId?r.properties[e.promoteId]:r.id,r])),update:new Map(t.update?.map(r=>[r.id,r]))}:{remove:new Set,add:new Map,update:new Map}}var eu=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],et=new Uint32Array(96),cg=class mp{static from(e){if(!e||e.byteLength===void 0||e.buffer)throw Error("Data must be an instance of ArrayBuffer or SharedArrayBuffer.");let[r,i]=new Uint8Array(e,0,2);if(r!==219)throw Error("Data does not appear to be in a KDBush format.");let n=i>>4;if(n!==1)throw Error(`Got v${n} data when expected v1.`);let a=eu[i&15];if(!a)throw Error("Unrecognized array type.");let[s]=new Uint16Array(e,2,1),[o]=new Uint32Array(e,4,1);return new mp(o,s,a,void 0,e)}constructor(e,r=64,i=Float64Array,n=ArrayBuffer,a){if(isNaN(e)||e<0)throw Error(`Unexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=i,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;let s=eu.indexOf(this.ArrayType),o=e*2*this.ArrayType.BYTES_PER_ELEMENT,l=e*this.IndexArrayType.BYTES_PER_ELEMENT,u=(8-l%8)%8;if(s<0)throw Error(`Unexpected typed array class: ${i}.`);if(a)this.data=a,this.ids=new this.IndexArrayType(a,8,e),this.coords=new i(a,8+l+u,e*2),this._pos=e*2,this._finished=!0;else{let h=this.data=new n(8+o+l+u);this.ids=new this.IndexArrayType(h,8,e),this.coords=new i(h,8+l+u,e*2),this._pos=0,this._finished=!1,new Uint8Array(h,0,2).set([219,16+s]),new Uint16Array(h,2,1)[0]=r,new Uint32Array(h,4,1)[0]=e}}add(e,r){let i=this._pos>>1;return this.ids[i]=i,this.coords[this._pos++]=e,this.coords[this._pos++]=r,i}finish(){let e=this._pos>>1;if(e!==this.numItems)throw Error(`Added ${e} items when expected ${this.numItems}.`);return ms(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,r,i,n){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:a,coords:s,nodeSize:o}=this;et[0]=0,et[1]=a.length-1,et[2]=0;let l=3,u=[];for(;l>0;){let h=et[--l],c=et[--l],p=et[--l];if(c-p<=o){for(let m=p;m<=c;m++){let g=s[2*m],x=s[2*m+1];g>=e&&g<=i&&x>=r&&x<=n&&u.push(a[m])}continue}let f=p+c>>1,d=s[2*f],y=s[2*f+1];d>=e&&d<=i&&y>=r&&y<=n&&u.push(a[f]),(h===0?e<=d:r<=y)&&(et[l++]=p,et[l++]=f-1,et[l++]=1-h),(h===0?i>=d:n>=y)&&(et[l++]=f+1,et[l++]=c,et[l++]=1-h)}return u}within(e,r,i){let n=[];return this.withinInto(e,r,i,n),n}withinInto(e,r,i,n){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:a,coords:s,nodeSize:o}=this;et[0]=0,et[1]=a.length-1,et[2]=0;let l=3,u=0,h=i*i;for(;l>0;){let c=et[--l],p=et[--l],f=et[--l];if(p-f<=o){for(let g=f;g<=p;g++)ru(s[2*g],s[2*g+1],e,r)<=h&&(n[u++]=a[g]);continue}let d=f+p>>1,y=s[2*d],m=s[2*d+1];ru(y,m,e,r)<=h&&(n[u++]=a[d]),(c===0?e-i<=y:r-i<=m)&&(et[l++]=f,et[l++]=d-1,et[l++]=1-c),(c===0?e+i>=y:r+i>=m)&&(et[l++]=d+1,et[l++]=p,et[l++]=1-c)}return u}};function ms(t,e,r,i,n,a){if(n-i<=r)return;let s=i+n>>1;gp(t,e,s,i,n,a),ms(t,e,r,i,s-1,1-a),ms(t,e,r,s+1,n,1-a)}function gp(t,e,r,i,n,a){for(;n>i;){if(n-i>600){let u=n-i+1,h=r-i+1,c=Math.log(u),p=.5*Math.exp(2*c/3),f=.5*Math.sqrt(c*p*(u-p)/u)*(h-u/2<0?-1:1);gp(t,e,r,Math.max(i,Math.floor(r-h*p/u+f)),Math.min(n,Math.floor(r+(u-h)*p/u+f)),a)}let s=e[2*r+a],o=i,l=n;for(Br(t,e,i,r),e[2*n+a]>s&&Br(t,e,i,n);o<l;){for(Br(t,e,o,l),o++,l--;e[2*o+a]<s;)o++;for(;e[2*l+a]>s;)l--}e[2*i+a]===s?Br(t,e,i,l):(l++,Br(t,e,l,n)),l<=r&&(i=l+1),r<=l&&(n=l-1)}}function Br(t,e,r,i){pa(t,r,i),pa(e,2*r,2*i),pa(e,2*r+1,2*i+1)}function pa(t,e,r){let i=t[e];t[e]=t[r],t[r]=i}function ru(t,e,r,i){let n=t-r,a=e-i;return n*n+a*a}var gs={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:t=>t},pg=class{constructor(t){this.options=Object.assign(Object.create(gs),t),this.trees=Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[],this.points=[]}load(t){let e=[];for(let r of t){if(!r.geometry)continue;let[i,n]=r.geometry.coordinates,[a,s]=[ar(i),sr(n)],o={id:r.id,type:"Point",geometry:[a,s],tags:r.properties};e.push(o)}this.createIndex(e)}initialize(t){let e=[];for(let r of t)r.type==="Point"&&e.push(r);this.createIndex(e)}updateIndex(t,e,r){this.options=Object.assign(Object.create(gs),r.clusterOptions),this.initialize(t)}createIndex(t){let{log:e,minZoom:r,maxZoom:i}=this.options;e&&console.time("total time");let n=`prepare ${t.length} points`;e&&console.time(n),this.points=t;let a=[];for(let o=0;o<t.length;o++){let l=t[o];if(!l?.geometry)continue;let[u,h]=l.geometry;u=Math.fround(u),h=Math.fround(h),a.push(u,h,1/0,o,-1,1),this.options.reduce&&a.push(0)}let s=this.trees[i+1]=this.createTree(a);e&&console.timeEnd(n);for(let o=i;o>=r;o--){let l=Date.now();s=this.trees[o]=this.createTree(this.cluster(s,o)),e&&console.log("z%d: %d clusters in %dms",o,s.numItems,Date.now()-l)}e&&console.timeEnd("total time")}getClusters(t,e){return this.getClustersInternal(t,e).map(r=>pn(r))}getClustersInternal(t,e){let r=((t[0]+180)%360+360)%360-180,i=Math.max(-90,Math.min(90,t[1])),n=t[2]===180?180:((t[2]+180)%360+360)%360-180,a=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)r=-180,n=180;else if(r>n){let h=this.getClustersInternal([r,i,180,a],e),c=this.getClustersInternal([-180,i,n,a],e);return h.concat(c)}let s=this.trees[this.limitZoom(e)],o=s.range(ar(r),sr(a),ar(n),sr(i)),l=s.flatData,u=[];for(let h of o){let c=this.stride*h;u.push(l[c+5]>1?fg(l,c,this.clusterProps):this.points[l[c+3]])}return u}getChildren(t){let e=this.getOriginId(t),r=this.getOriginZoom(t),i=Error("No cluster with the specified id: "+t),n=this.trees[r];if(!n)throw i;let a=n.flatData;if(e*this.stride>=a.length)throw i;let s=this.options.radius/(this.options.extent*2**(r-1)),o=a[e*this.stride],l=a[e*this.stride+1],u=n.within(o,l,s),h=[];for(let c of u){let p=c*this.stride;a[p+4]===t&&h.push(a[p+5]>1?dg(a,p,this.clusterProps):pn(this.points[a[p+3]]))}if(h.length===0)throw i;return h}getLeaves(t,e,r){e||=10,r||=0;let i=[];return this.appendLeaves(i,t,e,r,0),i}getTile(t,e,r){let i=this.trees[this.limitZoom(t)];if(!i)return null;let n=2**t,{extent:a,radius:s}=this.options,o=s/a,l=(r-o)/n,u=(r+1+o)/n,h={transformed:!0,features:[],source:null,x:e,y:r,z:t};return this.addTileFeatures(i.range((e-o)/n,l,(e+1+o)/n,u),i.flatData,e,r,n,h),e===0&&this.addTileFeatures(i.range(1-o/n,l,1,u),i.flatData,n,r,n,h),e===n-1&&this.addTileFeatures(i.range(0,l,o/n,u),i.flatData,-1,r,n,h),h}getClusterExpansionZoom(t){return this.getOriginZoom(t)}appendLeaves(t,e,r,i,n){let a=this.getChildren(e);for(let s of a){let o=s.properties;if(o?.cluster?n+o.point_count<=i?n+=o.point_count:n=this.appendLeaves(t,o.cluster_id,r,i,n):n<i?n++:t.push(s),t.length===r)break}return n}createTree(t){let e=new cg(t.length/this.stride|0,this.options.nodeSize,Float32Array);for(let r=0;r<t.length;r+=this.stride)e.add(t[r],t[r+1]);return e.finish(),e.flatData=t,e.data=null,e}addTileFeatures(t,e,r,i,n,a){for(let s of t){let o=s*this.stride,l=e[o+5]>1,u,h,c;if(l)u=vo(e,o,this.clusterProps),h=e[o],c=e[o+1];else{let d=this.points[e[o+3]];u=d.tags,[h,c]=d.geometry}let p={type:1,geometry:[[Math.round(this.options.extent*(h*n-r)),Math.round(this.options.extent*(c*n-i))]],tags:u},f;f=l||this.options.generateId?e[o+3]:this.points[e[o+3]].id,f!==void 0&&(p.id=f),a.features.push(p)}}limitZoom(t){return Math.max(this.options.minZoom,Math.min(Math.floor(+t),this.options.maxZoom+1))}cluster(t,e){let{radius:r,extent:i,reduce:n,minPoints:a}=this.options,s=r/(i*2**e),o=t.flatData,l=[],u=this.stride;for(let h=0;h<o.length;h+=u){if(o[h+2]<=e)continue;o[h+2]=e;let c=o[h],p=o[h+1],f=t.within(o[h],o[h+1],s),d=o[h+5],y=d;for(let m of f){let g=m*u;o[g+2]>e&&(y+=o[g+5])}if(y>d&&y>=a){let m=c*d,g=p*d,x,b=-1,v=((h/u|0)<<5)+(e+1)+this.points.length;for(let w of f){let A=w*u;if(o[A+2]<=e)continue;o[A+2]=e;let S=o[A+5];m+=o[A]*S,g+=o[A+1]*S,o[A+4]=v,n&&(x||(x=this.map(o,h,!0),b=this.clusterProps.length,this.clusterProps.push(x)),n(x,this.map(o,A)))}o[h+4]=v,l.push(m/y,g/y,1/0,v,-1,y),n&&l.push(b)}else{for(let m=0;m<u;m++)l.push(o[h+m]);if(y>1)for(let m of f){let g=m*u;if(!(o[g+2]<=e)){o[g+2]=e;for(let x=0;x<u;x++)l.push(o[g+x])}}}}return l}getOriginId(t){return t-this.points.length>>5}getOriginZoom(t){return(t-this.points.length)%32}map(t,e,r){if(t[e+5]>1){let a=this.clusterProps[t[e+6]];return r?Object.assign({},a):a}let i=this.points[t[e+3]].tags,n=this.options.map(i);return r&&n===i?Object.assign({},n):n}};function fg(t,e,r){return{id:t[e+3],type:"Point",tags:vo(t,e,r),geometry:[t[e],t[e+1]]}}function dg(t,e,r){return{type:"Feature",id:t[e+3],properties:vo(t,e,r),geometry:{type:"Point",coordinates:[fp(t[e]),dp(t[e+1])]}}}function vo(t,e,r){let i=t[e+5],n=i>=1e4?`${Math.round(i/1e3)}k`:i>=1e3?`${Math.round(i/100)/10}k`:i,a=t[e+6],s=a===-1?{}:Object.assign({},r[a]);return Object.assign(s,{cluster:!0,cluster_id:t[e+3],point_count:i,point_count_abbreviated:n})}var xp="geojsonvt_clip_start",vp="geojsonvt_clip_end";function iu(t,e,r,i,n){let a=e===n.maxZoom?0:n.tolerance/((1<<e)*n.extent),s={transformed:!1,features:[],source:null,x:r,y:i,z:e,minX:2,minY:1,maxX:-1,maxY:0,numPoints:0,numSimplified:0,numFeatures:t.length};for(let o of t)yg(s,o,a,n);return s}function yg(t,e,r,i){switch(t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),e.type){case"Point":case"MultiPoint":mg(t,e);return;case"LineString":gg(t,e,r,i);return;case"MultiLineString":case"Polygon":xg(t,e,r);return;case"MultiPolygon":vg(t,e,r);return}}function mg(t,e){let r=[];for(let n=0;n<e.geometry.length;n+=3)r.push(e.geometry[n],e.geometry[n+1]),t.numPoints++,t.numSimplified++;if(!r.length)return;let i={type:1,tags:e.tags||null,geometry:r};e.id!==null&&(i.id=e.id),t.features.push(i)}function gg(t,e,r,i){let n=[];if(bo(n,e.geometry,t,r,!1,!1),!n.length)return;let a=e.tags||null;if(i.lineMetrics){a={};for(let o in e.tags)a[o]=e.tags[o];a[xp]=e.geometry.start/e.geometry.size,a[vp]=e.geometry.end/e.geometry.size}let s={type:2,tags:a,geometry:n};e.id!==null&&(s.id=e.id),t.features.push(s)}function xg(t,e,r){let i=[];for(let a=0;a<e.geometry.length;a++)bo(i,e.geometry[a],t,r,e.type==="Polygon",a===0);if(!i.length)return;let n={type:e.type==="Polygon"?3:2,tags:e.tags||null,geometry:i};e.id!==null&&(n.id=e.id),t.features.push(n)}function vg(t,e,r){let i=[];for(let a=0;a<e.geometry.length;a++){let s=e.geometry[a];for(let o=0;o<s.length;o++)bo(i,s[o],t,r,!0,o===0)}if(!i.length)return;let n={type:3,tags:e.tags||null,geometry:i};e.id!==null&&(n.id=e.id),t.features.push(n)}function bo(t,e,r,i,n,a){let s=i*i;if(i>0&&e.size<(n?s:i)){r.numPoints+=e.points.length/3;return}let o=[];for(let l=0;l<e.points.length;l+=3)(i===0||e.points[l+2]>s)&&(r.numSimplified++,o.push(e.points[l],e.points[l+1])),r.numPoints++;n&&bg(o,a),t.push(o)}function bg(t,e){let r=0;for(let i=0,n=t.length,a=n-2;i<n;a=i,i+=2)r+=(t[i]-t[a])*(t[i+1]+t[a+1]);if(r>0===e)for(let i=0,n=t.length;i<n/2;i+=2){let a=t[i],s=t[i+1];t[i]=t[n-2-i],t[i+1]=t[n-1-i],t[n-2-i]=a,t[n-1-i]=s}}function nu(t,e){if(t.transformed)return t;let r=1<<t.z,i=t.x,n=t.y;for(let a of t.features)a.type===1?wg(a,e,r,i,n):_g(a,e,r,i,n);return t.transformed=!0,t}function wg(t,e,r,i,n){let a=t,s=t.geometry,o=[];for(let l=0;l<s.length;l+=2)o.push(bp(s[l],s[l+1],e,r,i,n));return a.geometry=o,a}function _g(t,e,r,i,n){let a=t,s=t.geometry,o=[];for(let l of s){let u=[];for(let h=0;h<l.length;h+=2)u.push(bp(l[h],l[h+1],e,r,i,n));o.push(u)}return a.geometry=o,a}function bp(t,e,r,i,n,a){return[Math.round(r*(t*i-n)),Math.round(r*(e*i-a))]}var Sg=class{constructor(t){this.options=t,this.total=0,this.stats={},this.tiles={},this.tileCoords=[],this.stats={},this.total=0}initialize(t){this.splitTile(t,0,0,0),this.options.debug&&(t.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}updateIndex(t,e,r){r.debug>1&&(console.log("invalidating tiles"),console.time("invalidating")),this.invalidateTiles(e),r.debug>1&&console.timeEnd("invalidating");let[i,n,a]=[0,0,0],s=iu(t,i,n,a,r);s.source=t;let o=Li(i,n,a);if(this.tiles[o]=s,this.tileCoords.push({z:i,x:n,y:a,id:o}),r.debug){let l=`z${i}`;this.stats[l]=(this.stats[l]||0)+1,this.total++}}getClusterExpansionZoom(t){return null}getChildren(t){return null}getLeaves(t,e,r){return null}getTile(t,e,r){let{extent:i,debug:n}=this.options,a=1<<t;e=e+a&a-1;let s=Li(t,e,r);if(this.tiles[s])return nu(this.tiles[s],i);n>1&&console.log("drilling down to z%d-%d-%d",t,e,r);let o=t,l=e,u=r,h;for(;!h&&o>0;)o--,l>>=1,u>>=1,h=this.tiles[Li(o,l,u)];return!h?.source||(n>1&&(console.log("found parent tile z%d-%d-%d",o,l,u),console.time("drilling down")),this.splitTile(h.source,o,l,u,t,e,r),n>1&&console.timeEnd("drilling down"),!this.tiles[s])?null:nu(this.tiles[s],i)}splitTile(t,e,r,i,n,a,s){let o=[t,e,r,i],l=this.options,u=l.debug;for(;o.length;){i=o.pop(),r=o.pop(),e=o.pop(),t=o.pop();let h=1<<e,c=Li(e,r,i),p=this.tiles[c];if(!p&&(u>1&&console.time("creation"),p=this.tiles[c]=iu(t,e,r,i,l),this.tileCoords.push({z:e,x:r,y:i,id:c}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,r,i,p.numFeatures,p.numPoints,p.numSimplified),console.timeEnd("creation"));let S=`z${e}`;this.stats[S]=(this.stats[S]||0)+1,this.total++}if(p.source=t,n==null){if(e===l.indexMaxZoom||p.numPoints<=l.indexMaxPoints)continue}else{if(e===l.maxZoom||e===n)continue;if(n!=null){let S=n-e;if(r!==a>>S||i!==s>>S)continue}}if(p.source=null,!t.length)continue;u>1&&console.time("clipping");let f=.5*l.buffer/l.extent,d=.5-f,y=.5+f,m=1+f,g=null,x=null,b=null,v=null,w=re(t,h,r-f,r+y,0,p.minX,p.maxX,l),A=re(t,h,r+d,r+m,0,p.minX,p.maxX,l);w&&(g=re(w,h,i-f,i+y,1,p.minY,p.maxY,l),x=re(w,h,i+d,i+m,1,p.minY,p.maxY,l)),A&&(b=re(A,h,i-f,i+y,1,p.minY,p.maxY,l),v=re(A,h,i+d,i+m,1,p.minY,p.maxY,l)),u>1&&console.timeEnd("clipping"),o.push(g||[],e+1,r*2,i*2),o.push(x||[],e+1,r*2,i*2+1),o.push(b||[],e+1,r*2+1,i*2),o.push(v||[],e+1,r*2+1,i*2+1)}}invalidateTiles(t){if(!t.length)return;let e=this.options,{debug:r}=e,i=1/0,n=-1/0,a=1/0,s=-1/0;for(let u of t)i=Math.min(i,u.minX),n=Math.max(n,u.maxX),a=Math.min(a,u.minY),s=Math.max(s,u.maxY);let o=e.buffer/e.extent,l=new Set;for(let u in this.tiles){let h=this.tiles[u],c=1<<h.z,p=(h.x-o)/c,f=(h.x+1+o)/c,d=(h.y-o)/c,y=(h.y+1+o)/c;if(n<p||i>=f||s<d||a>=y)continue;let m=!1;for(let g of t)if(g.maxX>=p&&g.minX<f&&g.maxY>=d&&g.minY<y){m=!0;break}if(m){if(r){r>1&&console.log("invalidate tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",h.z,h.x,h.y,h.numFeatures,h.numPoints,h.numSimplified);let g=`z${h.z}`;this.stats[g]=(this.stats[g]||0)-1,this.total--}delete this.tiles[u],l.add(u)}}l.size&&(this.tileCoords=this.tileCoords.filter(u=>!l.has(u.id)))}};function Li(t,e,r){return((1<<t)*r+e)*32+t}var Ag={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,updateable:!1,cluster:!1,clusterOptions:gs,debug:0},wp=class{constructor(t,e){e=this.options=Object.assign({},Ag,e);let r=e.debug;if(r&&console.time("preprocess data"),e.maxZoom<0||e.maxZoom>24)throw Error("maxZoom should be in the 0-24 range");if(e.promoteId&&e.generateId)throw Error("promoteId and generateId cannot be used together.");let i=fo(t,e);r&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",e.indexMaxZoom,e.indexMaxPoints),console.time("generate tiles")),i=xo(i,e),e.updateable&&(this.source=i),this.initializeIndex(i,e)}initializeIndex(t,e){this.tileIndex=e.cluster?new pg(e.clusterOptions):new Sg(e),t.length&&this.tileIndex.initialize(t)}getTile(t,e,r){return t=+t,e=+e,r=+r,t<0||t>24?null:this.tileIndex.getTile(t,e,r)}updateData(t,e){let r=this.options;if(!r.updateable)throw Error("to update tile geojson `updateable` option must be set to true");let{affected:i,source:n}=lg(this.source,t,r);e&&({affected:i,source:n}=this.filterUpdate(n,i,e)),i.length&&(this.source=n,this.tileIndex.updateIndex(n,i,r))}filterUpdate(t,e,r){let i=new Set;for(let n of t)n.id!=null&&(r(pn(n))||(e.push(n),i.add(n.id)));return t=t.filter(n=>!i.has(n.id)),{affected:e,source:t}}getData(){if(!this.options.updateable)throw Error("to retrieve data the `updateable` option must be set to true");return K1(this.source)}updateClusterOptions(t,e){let r=this.options.cluster;if(this.options.cluster=t,this.options.clusterOptions=e,r==t){this.tileIndex.updateIndex(this.source,[],this.options);return}this.initializeIndex(this.source,this.options)}getClusterExpansionZoom(t){return this.tileIndex.getClusterExpansionZoom(t)}getClusterChildren(t){return this.tileIndex.getChildren(t)}getClusterLeaves(t,e,r){return this.tileIndex.getLeaves(t,e,r)}},xs=ut([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),Dg=xs.members;xs.size,xs.alignment;var vs=ut([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),Eg=vs.members;vs.size,vs.alignment;var Tg=Math.cos(75/2*(Math.PI/180)),_p=1/2,au=2**14/_p,$n=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.patternFeatures=[],this.lineClipsArray=[],this.gradients={};for(let e of this.layers)this.gradients[e.id]={};this.layoutVertexArray=new Nm,this.layoutVertexArray2=new Um,this.indexArray=new xi,this.programConfigurations=new Le(t.layers,t.zoom),this.segments=new Ct,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(t,e,r){this.hasDependencies=ln("line",this.layers,e)||this.hasLineDasharray(this.layers);let i=this.layers[0].layout.get("line-sort-key"),n=!i.isConstant(),a=[],s=new H(this.zoom),o=this.layers[0]._featureFilter.needGeometry;for(let{feature:l,id:u,index:h,sourceLayerIndex:c}of t){let p=br(l,o);if(!this.layers[0]._featureFilter.filter(s,p,r))continue;let f=n?i.evaluate(p,{},r):void 0,d={id:u,properties:l.properties,type:l.type,sourceLayerIndex:c,index:h,geometry:o?p.geometry:$e(l),patterns:{},dashes:{},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;this.hasDependencies?(ln("line",this.layers,e)?uo("line",this.layers,l,{zoom:this.zoom},e):this.hasLineDasharray(this.layers)&&this.addLineDashDependencies(this.layers,l,this.zoom,e),this.patternFeatures.push(l)):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,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,{imagePositions:r,dashPositions:i})}addFeatures(t,e,r,i){for(let n of this.patternFeatures)this.addFeature(n,n.geometry,n.index,e,r,i,t.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,Eg)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Dg),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())}lineFeatureClips(t){if(t.properties&&Object.hasOwn(t.properties,"geojsonvt_clip_start")&&Object.hasOwn(t.properties,"geojsonvt_clip_end"))return{start:+t.properties[xp],end:+t.properties[vp]}}addFeature(t,e,r,i,n,a,s){let o=this.layers[0].layout,l=o.get("line-join").evaluate(t,{}),u=o.get("line-cap").evaluate(t,{}),h=o.get("line-miter-limit").evaluate(t,{}),c=o.get("line-round-limit").evaluate(t,{});this.lineClips=this.lineFeatureClips(t);for(let p of e)this.addLine(p,t,l,u,h,c,i,s);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{imagePositions:n,dashPositions:a,canonical:i})}addLine(t,e,r,i,n,a,s,o){this.distance=0,this.scaledDistance=0,this.totalDistance=0;let l=s?o.line.getGranularityForZoomLevel(s.z):1;if(t=Fe(t,l),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let b=0;b<t.length-1;b++)this.totalDistance+=t[b].dist(t[b+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let u=vi.types[e.type]==="Polygon",h=t.length;for(;h>=2&&t[h-1].equals(t[h-2]);)h--;let c=0;for(;c<h-1&&t[c].equals(t[c+1]);)c++;if(h-c<(u?3:2))return;r==="bevel"&&(n=1.05);let p=this.overscaling<=16?15*it/(512*this.overscaling):0,f=this.segments.prepareSegment(h*10,this.layoutVertexArray,this.indexArray),d,y,m,g,x;this.e1=this.e2=-1,u&&(d=t[h-2],x=t[c].sub(d)._unit()._perp());for(let b=c;b<h;b++){if(m=b===h-1?u?t[c+1]:void 0:t[b+1],m&&t[b].equals(m))continue;x&&(g=x),d&&(y=d),d=t[b],x=m?m.sub(d)._unit()._perp():g,g||=x;let v=g.add(x);(v.x!==0||v.y!==0)&&v._unit();let w=g.x*x.x+g.y*x.y,A=v.x*x.x+v.y*x.y,S=A===0?1/0:1/A,D=2*Math.sqrt(2-2*A),E=A<Tg&&y&&m,L=g.x*x.y-g.y*x.x>0;if(E&&b>c){let z=d.dist(y);if(z>2*p){let F=d.sub(d.sub(y)._mult(p/z)._round());this.updateDistance(y,F),this.addCurrentVertex(F,g,0,0,f),y=F}}let $=y&&m,P=$?r:u?"butt":i;if($&&P==="round"&&(S<a?P="miter":S<=2&&(P="fakeround")),P==="miter"&&S>n&&(P="bevel"),P==="bevel"&&(S>2&&(P="flipbevel"),S<n&&(P="miter")),y&&this.updateDistance(y,d),P==="miter")v._mult(S),this.addCurrentVertex(d,v,0,0,f);else if(P==="flipbevel"){if(S>100)v=x.mult(-1);else{let z=S*g.add(x).mag()/g.sub(x).mag();v._perp()._mult(z*(L?-1:1))}this.addCurrentVertex(d,v,0,0,f),this.addCurrentVertex(d,v.mult(-1),0,0,f)}else if(P==="bevel"||P==="fakeround"){let z=-Math.sqrt(S*S-1),F=L?z:0,V=L?0:z;if(y&&this.addCurrentVertex(d,g,F,V,f),P==="fakeround"){let R=Math.round(D*180/Math.PI/20);for(let B=1;B<R;B++){let G=B/R;if(G!==.5){let ft=G-.5,tt=1.0904+w*(-3.2452+w*(3.55645-w*1.43519)),ct=.848013+w*(-1.06021+w*.215638);G+=G*ft*(G-1)*(tt*ft*ft+ct)}let W=x.sub(g)._mult(G)._add(g)._unit()._mult(L?-1:1);this.addHalfVertex(d,W.x,W.y,!1,L,0,f)}}m&&this.addCurrentVertex(d,x,-F,-V,f)}else if(P==="butt")this.addCurrentVertex(d,v,0,0,f);else if(P==="square"){let z=y?1:-1;this.addCurrentVertex(d,v,z,z,f)}else P==="round"&&(y&&(this.addCurrentVertex(d,g,0,0,f),this.addCurrentVertex(d,g,1,1,f,!0)),m&&(this.addCurrentVertex(d,x,-1,-1,f,!0),this.addCurrentVertex(d,x,0,0,f)));if(E&&b<h-1){let z=d.dist(m);if(z>2*p){let F=d.add(m.sub(d)._mult(p/z)._round());this.updateDistance(d,F),this.addCurrentVertex(F,x,0,0,f),d=F}}}}addCurrentVertex(t,e,r,i,n,a=!1){let s=e.x+e.y*r,o=e.y-e.x*r,l=-e.x+e.y*i,u=-e.y-e.x*i;this.addHalfVertex(t,s,o,a,!1,r,n),this.addHalfVertex(t,l,u,a,!0,-i,n),this.distance>au/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,e,r,i,n,a))}addHalfVertex({x:t,y:e},r,i,n,a,s,o){let l=(this.lineClips?this.scaledDistance*(au-1):this.scaledDistance)*_p;if(this.layoutVertexArray.emplaceBack((t<<1)+ +!!n,(e<<1)+ +!!a,Math.round(63*r)+128,Math.round(63*i)+128,(s===0?0:s<0?-1:1)+1|(l&63)<<2,l>>6),this.lineClips){let h=(this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start);this.layoutVertexArray2.emplaceBack(h,this.lineClipsArray.length)}let u=o.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,u,this.e2),o.primitiveLength++),a?this.e2=u:this.e1=u}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,e){this.distance+=t.dist(e),this.updateScaledDistance()}hasLineDasharray(t){for(let e of t){let r=e.paint.get("line-dasharray");if(r&&!r.isConstant())return!0}return!1}addLineDashDependencies(t,e,r,i){for(let n of t){let a=n.paint.get("line-dasharray");if(!a||a.value.kind==="constant")continue;let s=n.layout.get("line-cap").evaluate(e,{})==="round",o={dasharray:a.value.evaluate({zoom:r-1},e,{}),round:s},l={dasharray:a.value.evaluate({zoom:r},e,{}),round:s},u={dasharray:a.value.evaluate({zoom:r+1},e,{}),round:s},h=`${o.dasharray.join(",")},${o.round}`,c=`${l.dasharray.join(",")},${l.round}`,p=`${u.dasharray.join(",")},${u.round}`;i.dashDependencies[h]=o,i.dashDependencies[c]=l,i.dashDependencies[p]=u,e.dashes[n.id]={min:h,mid:c,max:p}}}};I("LineBucket",$n,{omit:["layers","patternFeatures"]});var Fg,kg=()=>Fg||=new Ft({"line-cap":new O(_.layout_line["line-cap"],"line-cap"),"line-join":new O(_.layout_line["line-join"],"line-join"),"line-miter-limit":new O(_.layout_line["line-miter-limit"],"line-miter-limit"),"line-round-limit":new O(_.layout_line["line-round-limit"],"line-round-limit"),"line-sort-key":new O(_.layout_line["line-sort-key"],"line-sort-key")}),Ig,Mg=()=>Ig||=new Ft({"line-opacity":new O(_.paint_line["line-opacity"],"line-opacity"),"line-layer-opacity":new C(_.paint_line["line-layer-opacity"],"line-layer-opacity"),"line-color":new O(_.paint_line["line-color"],"line-color"),"line-translate":new C(_.paint_line["line-translate"],"line-translate"),"line-translate-anchor":new C(_.paint_line["line-translate-anchor"],"line-translate-anchor"),"line-width":new O(_.paint_line["line-width"],"line-width"),"line-gap-width":new O(_.paint_line["line-gap-width"],"line-gap-width"),"line-offset":new O(_.paint_line["line-offset"],"line-offset"),"line-blur":new O(_.paint_line["line-blur"],"line-blur"),"line-dasharray":new ni(_.paint_line["line-dasharray"],"line-dasharray"),"line-pattern":new ni(_.paint_line["line-pattern"],"line-pattern"),"line-gradient":new Bn(_.paint_line["line-gradient"],"line-gradient")}),su={get paint(){return Mg()},get layout(){return kg()}},Cg=class extends O{possiblyEvaluate(t,e){return e=new H(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,zoomHistory:e.zoomHistory,transition:e.transition}),super.possiblyEvaluate(t,e)}evaluate(t,e,r,i){return e=Tt({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(t,e,r,i)}},Vi;var Bg=class extends jt{constructor(t,e){super(t,su,e),this.gradientVersion=0,Vi||(Vi=new Cg(su.paint.properties["line-width"].specification,"line-floorwidth"),Vi.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(t){if(t==="line-gradient"){let e=this.gradientExpression();this.stepInterpolant=Vy(e)?e._styleExpression.expression instanceof Ls:!1,this.gradientVersion=(this.gradientVersion+1)%(2**53-1)}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(t,e){super.recalculate(t,e),this.paint._values["line-floorwidth"]=Vi.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new $n(t)}queryRadius(t){let e=t,r=ou(nr("line-width",this,e),nr("line-gap-width",this,e)),i=nr("line-offset",this,e);return r/2+Math.abs(i)+zn(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:r,geometry:i,transform:n,pixelsToTileUnits:a}){let s=Ln(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-n.bearingInRadians,a),o=a/2*ou(this.paint.get("line-width").evaluate(e,r),this.paint.get("line-gap-width").evaluate(e,r)),l=this.paint.get("line-offset").evaluate(e,r);return l&&(i=h0(i,l*a)),n0(s,i,o)}isTileClipped(){return!0}};function ou(t,e){return e>0?e+2*t:t}var Pg=ut([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"},{name:"a_height_offset",components:1,type:"Float32"}],4),zg=ut([{name:"a_projected_pos",components:3,type:"Float32"}],4);ut([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);var Lg=ut([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);ut([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);var lu=ut([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),bw=ut([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);ut([{name:"triangle",components:3,type:"Uint16"}]),ut([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"},{type:"Float32",name:"heightOffset"}]),ut([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"},{type:"Float32",name:"heightOffset"}]),ut([{type:"Float32",name:"offsetX"}]),ut([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),ut([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);function Vg(t,e,r){let i=e.layout.get("text-transform").evaluate(r,{});return i==="uppercase"?t=t.toLocaleUpperCase():i==="lowercase"&&(t=t.toLocaleLowerCase()),Jt.applyArabicShaping&&(t=Jt.applyArabicShaping(t)),t}function Og(t,e,r){for(let i of t.sections)i.text=Vg(i.text,e,r);return t}function Rg(t){let e={},r={},i=[],n=0;function a(u){i.push(t[u]),n++}function s(u,h,c){let p=r[u];return delete r[u],r[h]=p,i[p].geometry[0].pop(),i[p].geometry[0]=i[p].geometry[0].concat(c[0]),p}function o(u,h,c){let p=e[h];return delete e[h],e[u]=p,i[p].geometry[0].shift(),i[p].geometry[0]=c[0].concat(i[p].geometry[0]),p}function l(u,h,c){let p=c?h[0][h[0].length-1]:h[0][0];return`${u}:${p.x}:${p.y}`}for(let u=0;u<t.length;u++){let h=t[u],c=h.geometry,p=h.text?h.text.toString():null;if(!p){a(u);continue}let f=l(p,c),d=l(p,c,!0);if(f in r&&d in e&&r[f]!==e[d]){let y=o(f,d,c),m=s(f,d,i[y].geometry);delete e[f],delete r[d],r[l(p,i[m].geometry,!0)]=m,i[y].geometry=null}else f in r?s(f,d,c):d in e?o(f,d,c):(a(u),e[f]=n-1,r[d]=n-1)}return i.filter(u=>u.geometry)}var Sp=typeof Intl<"u"&&"Segmenter"in Intl,uu=Sp?new Intl.Segmenter(void 0,{granularity:"grapheme"}):null,hu=Sp?new Intl.Segmenter(void 0,{granularity:"word"}):null;function cu(t){if(!uu||!xm(t))return[...t];let e=[];for(let{segment:r}of uu.segment(t)){let i=e.length-1;i>=0&&vm(e[i],r)?e[i]+=r:e.push(r)}return e}function $g(t){let e=new Set;if(hu){for(let{index:i}of hu.segment(t))e.add(i);return e}let r=0;for(let i of t.split(/\\b|(?=\\p{Ideo})/u))e.add(r),r+=i.length;return e}function Ap(t){let e=t.codePointAt(0);return t.length>(e>65535?2:1)}var er={"!":"\\uFE15","#":"\\uFF03",$:"\\uFF04","%":"\\uFF05","&":"\\uFF06","(":"\\uFE35",")":"\\uFE36","*":"\\uFF0A","+":"\\uFF0B",",":"\\uFE10","-":"\\uFE32",".":"\\u30FB","/":"\\uFF0F",":":"\\uFE13",";":"\\uFE14","<":"\\uFE3F","=":"\\uFF1D",">":"\\uFE40","?":"\\uFE16","@":"\\uFF20","[":"\\uFE47","\\\\":"\\uFF3C","]":"\\uFE48","^":"\\uFF3E",_:"\\uFE33","`":"\\uFF40","{":"\\uFE37","|":"\\u2015","}":"\\uFE38","~":"\\uFF5E","\\xA2":"\\uFFE0","\\xA3":"\\uFFE1","\\xA5":"\\uFFE5","\\xA6":"\\uFFE4","\\xAC":"\\uFFE2","\\xAF":"\\uFFE3","\\u2013":"\\uFE32","\\u2014":"\\uFE31","\\u2018":"\\uFE43","\\u2019":"\\uFE44","\\u201C":"\\uFE41","\\u201D":"\\uFE42","\\u2026":"\\uFE19","\\u22EF":"\\uFE19","\\u2027":"\\u30FB","\\u20A9":"\\uFFE6","\\u3001":"\\uFE11","\\u3002":"\\uFE12","\\u3008":"\\uFE3F","\\u3009":"\\uFE40","\\u300A":"\\uFE3D","\\u300B":"\\uFE3E","\\u300C":"\\uFE41","\\u300D":"\\uFE42","\\u300E":"\\uFE43","\\u300F":"\\uFE44","\\u3010":"\\uFE3B","\\u3011":"\\uFE3C","\\u3014":"\\uFE39","\\u3015":"\\uFE3A","\\u3016":"\\uFE17","\\u3017":"\\uFE18","\\uFF01":"\\uFE15","\\uFF08":"\\uFE35","\\uFF09":"\\uFE36","\\uFF0C":"\\uFE10","\\uFF0D":"\\uFE32","\\uFF0E":"\\u30FB","\\uFF1A":"\\uFE13","\\uFF1B":"\\uFE14","\\uFF1C":"\\uFE3F","\\uFF1E":"\\uFE40","\\uFF1F":"\\uFE16","\\uFF3B":"\\uFE47","\\uFF3D":"\\uFE48","\\uFF3F":"\\uFE33","\\uFF5B":"\\uFE37","\\uFF5C":"\\u2015","\\uFF5D":"\\uFE38","\\uFF5F":"\\uFE35","\\uFF60":"\\uFE36","\\uFF61":"\\uFE12","\\uFF62":"\\uFE41","\\uFF63":"\\uFE42"};function Ng(t){let e="",r={premature:!0,value:void 0},i=t[Symbol.iterator](),n=i.next(),a=t[Symbol.iterator]();a.next();let s=a.next();for(;!n.done;)(s.done||!Tl(s.value.codePointAt(0))||er[s.value])&&(r.premature||!Tl(r.value.codePointAt(0))||er[r.value])&&er[n.value]?e+=er[n.value]:e+=n.value,r={value:n.value,premature:!1},n=i.next(),s=a.next();return e}var Ug={10:!0,13:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},qg={40:!0};function pu(t,e,r,i,n,a){if("fontStack"in e){let s=r[e.fontStack],o=s?.[t];if(o)return o.metrics.advance*e.scale+n;let l=0;for(let u of t){let h=s?.[u];h&&(l+=h.metrics.advance*e.scale+n)}return l}{let s=i[e.imageName];return s?s.displaySize[0]*e.scale*24/a+n:0}}function fu(t,e,r,i){let n=(t-e)**2;return i?t<e?n/2:n*2:n+Math.abs(r)*r}function du(t){return/^\\s+$/u.test(t)}function Gg(t,e,r){let i=0;return(t===10||t===13)&&(i-=1e4),r&&(i+=150),(t===40||t===65288)&&(i+=50),(e===41||e===65289)&&(i+=50),i}function yu(t,e,r,i,n,a){let s=null,o=fu(e,r,n,a);for(let l of i){let u=fu(e-l.x,r,n,a)+l.badness;u<=o&&(s=l,o=u)}return{index:t,x:e,priorBreak:s,badness:o}}function Dp(t){return t?Dp(t.priorBreak).concat(t.index):[]}var wo=class bs{constructor(e="",r=[],i=[]){this.text=e,this.sections=r,this.sectionIndex=i,this.imageSectionID=null,this._graphemes=null}graphemes(){return this._graphemes??=cu(this.text),this._graphemes}static fromFeature(e,r){let i=new bs;for(let n of e.sections)n.image?i.addImageSection(n):i.addTextSection(n,r);return i}length(){return this.graphemes().length}getSection(e){return this.sections[this.sectionIndex[e]]}getSectionIndex(e){return this.sectionIndex[e]}verticalizePunctuation(){this.text=Ng(this.text),this._graphemes=null}hasZeroWidthSpaces(){return this.text.includes("\\u200B")}trim(){let e=this.graphemes(),r=0;for(;r<e.length&&du(e[r]);)r++;let i=e.length;for(;i>r&&du(e[i-1]);)i--;this.text=e.slice(r,i).join(""),this.sectionIndex=this.sectionIndex.slice(r,i),this._graphemes=null}substring(e,r){let i=this.graphemes().slice(e,r).join(""),n=this.sectionIndex.slice(e,r);return new bs(i,this.sections,n)}toCodeUnitIndex(e){return this.graphemes().slice(0,e).join("").length}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,r)=>Math.max(e,this.sections[r].scale),0)}getMaxImageSize(e){let r=0,i=0;for(let n=0;n<this.length();n++){let a=this.getSection(n);if("imageName"in a){let s=e[a.imageName];if(!s)continue;let o=s.displaySize;r=Math.max(r,o[0]),i=Math.max(i,o[1])}}return{maxImageWidth:r,maxImageHeight:i}}_appendSection(e,r){let i=this.graphemes(),n=i.length>0?i[i.length-1]:"",a=cu(n+e);this.text+=e,this._graphemes=i.slice(0,n?-1:void 0).concat(a);let s=a.length-+!!n;for(let o=0;o<s;o++)this.sectionIndex.push(r)}addTextSection(e,r){this.sections.push({scale:e.scale||1,verticalAlign:e.verticalAlign||"bottom",fontStack:e.fontStack||r}),this._appendSection(e.text,this.sections.length-1)}addImageSection(e){let r=e.image?e.image.name:"";if(r.length===0){gt("Can\'t add FormattedSection with an empty image.");return}let i=this.getNextImageSectionCharCode();if(!i){gt("Reached maximum number of images 6401");return}this.sections.push({scale:1,verticalAlign:e.verticalAlign||"bottom",imageName:r}),this._appendSection(String.fromCharCode(i),this.sections.length-1)}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}determineLineBreaks(e,r,i,n,a){let s=[],o=this.determineAverageLineWidth(e,r,i,n,a),l=this.hasZeroWidthSpaces(),u=this.graphemes(),h=null,c=0,p=0;for(let f=0;f<u.length;f++){let d=u[f];if(f>0){let y=u[f-1].codePointAt(0),m=d.codePointAt(0),g=ym(y),x=El(y)&&El(m);(Ug[y]||g||"imageName"in this.getSection(f-1)||u[f+1]!==void 0&&qg[m]||x&&(h??=$g(this.text)).has(p))&&s.push(yu(f,c,o,s,Gg(y,m,g&&l),!1))}Js(d.codePointAt(0))||(c+=pu(d,this.getSection(f),i,n,e,a)),p+=d.length}return Dp(yu(this.length(),c,o,s,0,!0))}determineAverageLineWidth(e,r,i,n,a){let s=0,o=0;for(let u of this.graphemes()){let h=this.getSection(o);s+=pu(u,h,i,n,e,a),o++}let l=Math.max(1,Math.ceil(s/r));return s/l}},ws=4294967296,mu=1/ws,gu=typeof TextDecoder>"u"?null:new TextDecoder("utf-8"),_o=class{constructor(t){this.buf=ArrayBuffer.isView(t)?t:new Uint8Array(t),this.dataView=new DataView(this.buf.buffer,this.buf.byteOffset,this.buf.byteLength),this.pos=0,this.type=0,this._valueStart=-1,this.length=this.buf.length}readFields(t,e,r=this.length){let i;for(;i=this.nextField(r);)t(i,e,this);return e}readMessage(t,e){return this.readFields(t,e,this.readVarint()+this.pos)}readFixed32(){let t=this.dataView.getUint32(this.pos,!0);return this.pos+=4,t}readSFixed32(){let t=this.dataView.getInt32(this.pos,!0);return this.pos+=4,t}readFixed64(){let t=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*ws;return this.pos+=8,t}readSFixed64(){let t=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*ws;return this.pos+=8,t}readFloat(){let t=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,t}readDouble(){let t=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,t}readVarint(t){let e=this.buf,r=e[this.pos++];if(r<128)return r;let i=r&127,n;return n=e[this.pos++],i|=(n&127)<<7,n<128||(n=e[this.pos++],i|=(n&127)<<14,n<128)||(n=e[this.pos++],i|=(n&127)<<21,n<128)?i:(n=e[this.pos],i|=(n&15)<<28,Yg(i,t,this))}readSVarint(){let t=this.readVarint();return t%2==1?(t+1)/-2:t/2}readBoolean(){return!!this.readVarint()}readString(){let t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&gu?gu.decode(this.buf.subarray(e,t)):sx(this.buf,e,t)}readBytes(){let t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e}readPackedVarint(t=[],e){let r=this.readPackedEnd();for(;this.pos<r;)t.push(this.readVarint(e));return t}readPackedSVarint(t=[]){let e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSVarint());return t}readPackedBoolean(t=[]){let e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readBoolean());return t}readPackedFloat(t=[]){let e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFloat());return t}readPackedDouble(t=[]){let e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readDouble());return t}readPackedFixed32(t=[]){let e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFixed32());return t}readPackedSFixed32(t=[]){let e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSFixed32());return t}readPackedFixed64(t=[]){let e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFixed64());return t}readPackedSFixed64(t=[]){let e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSFixed64());return t}readPackedEnd(){return this.type===2?this.readVarint()+this.pos:this.pos+1}nextField(t=this.length){if(this.pos===this._valueStart&&this.skip(this.type),this.pos>=t)return 0;let e=this.readVarint();return this.type=e&7,this._valueStart=this.pos,e>>>3}skip(t){let e=t&7;if(e===0)for(;this.buf[this.pos++]>127;);else if(e===2)this.pos=this.readVarint()+this.pos;else if(e===5)this.pos+=4;else if(e===1)this.pos+=8;else throw Error(`Unimplemented type: ${e}`)}},jg=class{constructor(t=new Uint8Array(16)){this.buf=ArrayBuffer.isView(t)?t:new Uint8Array(t),this.dataView=new DataView(this.buf.buffer,this.buf.byteOffset,this.buf.byteLength),this.pos=0,this.length=this.buf.length}writeTag(t,e){this.writeVarint(t<<3|e)}realloc(t){let e=this.length||16;for(;e<this.pos+t;)e*=2;if(e!==this.length){let r=new Uint8Array(e);r.set(this.buf),this.buf=r,this.dataView=new DataView(r.buffer),this.length=e}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(t){this.realloc(4),this.dataView.setInt32(this.pos,t,!0),this.pos+=4}writeSFixed32(t){this.realloc(4),this.dataView.setInt32(this.pos,t,!0),this.pos+=4}writeFixed64(t){this.realloc(8),this.dataView.setInt32(this.pos,t&-1,!0),this.dataView.setInt32(this.pos+4,Math.floor(t*mu),!0),this.pos+=8}writeSFixed64(t){this.realloc(8),this.dataView.setInt32(this.pos,t&-1,!0),this.dataView.setInt32(this.pos+4,Math.floor(t*mu),!0),this.pos+=8}writeVarint(t){if(t=+t||0,t>=0&&t<128){this.pos>=this.length&&this.realloc(1),this.buf[this.pos++]=t;return}if(t>268435455||t<0){Zg(t,this);return}this.realloc(4),this.buf[this.pos++]=t&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=(t>>>=7)&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=(t>>>=7)&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=t>>>7&127)))}writeSVarint(t){this.writeVarint(t<0?-t*2-1:t*2)}writeBoolean(t){this.writeVarint(+t)}writeString(t){t=String(t),this.realloc(t.length*4),this.pos++;let e=this.pos;this.pos=ox(this.buf,t,this.pos);let r=this.pos-e;r>=128&&xu(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r}writeFloat(t){this.realloc(4),this.dataView.setFloat32(this.pos,t,!0),this.pos+=4}writeDouble(t){this.realloc(8),this.dataView.setFloat64(this.pos,t,!0),this.pos+=8}writeBytes(t){let e=t.length;this.writeVarint(e),this.realloc(e),this.buf.set(t,this.pos),this.pos+=e}writeRawMessage(t,e){this.pos++;let r=this.pos;t(e,this);let i=this.pos-r;i>=128&&xu(r,i,this),this.pos=r-1,this.writeVarint(i),this.pos+=i}writeMessage(t,e,r){this.writeTag(t,2),this.writeRawMessage(e,r)}writePackedVarint(t,e){e.length&&this.writeMessage(t,Kg,e)}writePackedSVarint(t,e){e.length&&this.writeMessage(t,Jg,e)}writePackedBoolean(t,e){e.length&&this.writeMessage(t,ex,e)}writePackedFloat(t,e){e.length&&this.writeMessage(t,Qg,e)}writePackedDouble(t,e){e.length&&this.writeMessage(t,tx,e)}writePackedFixed32(t,e){e.length&&this.writeMessage(t,rx,e)}writePackedSFixed32(t,e){e.length&&this.writeMessage(t,ix,e)}writePackedFixed64(t,e){e.length&&this.writeMessage(t,nx,e)}writePackedSFixed64(t,e){e.length&&this.writeMessage(t,ax,e)}writeBytesField(t,e){this.writeTag(t,2),this.writeBytes(e)}writeFixed32Field(t,e){this.writeTag(t,5),this.writeFixed32(e)}writeSFixed32Field(t,e){this.writeTag(t,5),this.writeSFixed32(e)}writeFixed64Field(t,e){this.writeTag(t,1),this.writeFixed64(e)}writeSFixed64Field(t,e){this.writeTag(t,1),this.writeSFixed64(e)}writeVarintField(t,e){this.writeTag(t,0),this.writeVarint(e)}writeSVarintField(t,e){this.writeTag(t,0),this.writeSVarint(e)}writeStringField(t,e){this.writeTag(t,2),this.writeString(e)}writeFloatField(t,e){this.writeTag(t,5),this.writeFloat(e)}writeDoubleField(t,e){this.writeTag(t,1),this.writeDouble(e)}writeBooleanField(t,e){this.writeVarintField(t,+e)}};function Yg(t,e,r){let i=r.buf,n,a;if(a=i[r.pos++],n=(a&112)>>4,a<128||(a=i[r.pos++],n|=(a&127)<<3,a<128)||(a=i[r.pos++],n|=(a&127)<<10,a<128)||(a=i[r.pos++],n|=(a&127)<<17,a<128)||(a=i[r.pos++],n|=(a&127)<<24,a<128)||(a=i[r.pos++],n|=(a&1)<<31,a<128))return Xg(t,n,e);throw Error("Expected varint not more than 10 bytes")}function Xg(t,e,r){return r?e*4294967296+(t>>>0):(e>>>0)*4294967296+(t>>>0)}function Zg(t,e){let r,i;if(t>=0?(r=t%4294967296|0,i=t/4294967296|0):(r=~(-t%4294967296),i=~(-t/4294967296),r^4294967295?r=r+1|0:(r=0,i=i+1|0)),t>=18446744073709552e3||t<-18446744073709552e3)throw Error("Given varint doesn\'t fit into 10 bytes");e.realloc(10),Wg(r,i,e),Hg(i,e)}function Wg(t,e,r){r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos]=t&127}function Hg(t,e){let r=(t&7)<<4;e.buf[e.pos++]|=r|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127)))))}function xu(t,e,r){let i=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(Math.LN2*7));r.realloc(i),r.buf.copyWithin(t+i,t,r.pos)}function Kg(t,e){let r=t.length,i=e.buf,n=e.pos,a=e.length;for(let s=0;s<r;s++){let o=t[s];if(o<0||n+10>a){e.pos=n,e.writeVarint(o),i=e.buf,n=e.pos,a=e.length;continue}for(;o>127;)i[n++]=o%128|128,o=Math.floor(o/128);i[n++]=o}e.pos=n}function Jg(t,e){for(let r=0;r<t.length;r++)e.writeSVarint(t[r])}function Qg(t,e){for(let r=0;r<t.length;r++)e.writeFloat(t[r])}function tx(t,e){for(let r=0;r<t.length;r++)e.writeDouble(t[r])}function ex(t,e){for(let r=0;r<t.length;r++)e.writeBoolean(t[r])}function rx(t,e){for(let r=0;r<t.length;r++)e.writeFixed32(t[r])}function ix(t,e){for(let r=0;r<t.length;r++)e.writeSFixed32(t[r])}function nx(t,e){for(let r=0;r<t.length;r++)e.writeFixed64(t[r])}function ax(t,e){for(let r=0;r<t.length;r++)e.writeSFixed64(t[r])}function sx(t,e,r){let i="",n=e;for(;n<r;){let a=t[n],s=null,o=a>239?4:a>223?3:a>191?2:1;if(n+o>r)break;let l,u,h;o===1?a<128&&(s=a):o===2?(l=t[n+1],(l&192)==128&&(s=(a&31)<<6|l&63,s<=127&&(s=null))):o===3?(l=t[n+1],u=t[n+2],(l&192)==128&&(u&192)==128&&(s=(a&15)<<12|(l&63)<<6|u&63,(s<=2047||s>=55296&&s<=57343)&&(s=null))):o===4&&(l=t[n+1],u=t[n+2],h=t[n+3],(l&192)==128&&(u&192)==128&&(h&192)==128&&(s=(a&15)<<18|(l&63)<<12|(u&63)<<6|h&63,(s<=65535||s>=1114112)&&(s=null))),s===null?(s=65533,o=1):s>65535&&(s-=65536,i+=String.fromCharCode(s>>>10&1023|55296),s=56320|s&1023),i+=String.fromCharCode(s),n+=o}return i}function ox(t,e,r){for(let i=0,n,a;i<e.length;i++){if(n=e.charCodeAt(i),n>55295&&n<57344)if(a){if(n<56320){t[r++]=239,t[r++]=191,t[r++]=189,a=n;continue}n=a-55296<<10|n-56320|65536,a=null}else{n>56319||i+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):a=n;continue}else a&&=(t[r++]=239,t[r++]=191,t[r++]=189,null);n<128?t[r++]=n:(n<2048?t[r++]=n>>6|192:(n<65536?t[r++]=n>>12|224:(t[r++]=n>>18|240,t[r++]=n>>12&63|128),t[r++]=n>>6&63|128),t[r++]=n&63|128)}return r}function lx(t){return typeof t?.renderWithWebGL=="function"}function So(t){let e=0,r=0;for(let s of t)e+=s.w*s.h,r=Math.max(r,s.w);t.sort((s,o)=>o.h-s.h);let i=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}],n=0,a=0;for(let s of t)for(let o=i.length-1;o>=0;o--){let l=i[o];if(!(s.w>l.w||s.h>l.h)){if(s.x=l.x,s.y=l.y,a=Math.max(a,s.y+s.h),n=Math.max(n,s.x+s.w),s.w===l.w&&s.h===l.h){let u=i.pop();u&&o<i.length&&(i[o]=u)}else s.h===l.h?(l.x+=s.w,l.w-=s.w):s.w===l.w?(l.y+=s.h,l.h-=s.h):(i.push({x:l.x+s.w,y:l.y,w:l.w-s.w,h:s.h}),l.y+=s.h,l.h-=s.h);break}}return{w:n,h:a,fill:e/(n*a)||0}}var Ep=class{constructor(t,{pixelRatio:e,version:r,isWebGLImage:i=!1,stretchX:n,stretchY:a,content:s,textFitWidth:o,textFitHeight:l}){this.paddedRect=t,this.pixelRatio=e,this.stretchX=n,this.stretchY=a,this.content=s,this.version=r,this.needsFirstWebGLRender=i,this.textFitWidth=o,this.textFitHeight=l}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}},Ao=class{constructor(t,e){let r={},i={};this.haveRenderCallbacks=[],this.patchedUpdateVersion=-1;let n=[];this.addImages(t,r,n),this.addImages(e,i,n);let{w:a,h:s}=So(n),o=new kt({width:a||1,height:s||1});for(let l in t){let u=t[l];if(u.isWebGLImage)continue;let h=r[l].paddedRect;kt.copy(u.data,o,{x:0,y:0},{x:h.x+1,y:h.y+1},u.data)}for(let l in e){let u=e[l],h=i[l].paddedRect,c=h.x+1,p=h.y+1,f=u.data.width,d=u.data.height;kt.copy(u.data,o,{x:0,y:0},{x:c,y:p},u.data),kt.copy(u.data,o,{x:0,y:d-1},{x:c,y:p-1},{width:f,height:1}),kt.copy(u.data,o,{x:0,y:0},{x:c,y:p+d},{width:f,height:1}),kt.copy(u.data,o,{x:f-1,y:0},{x:c-1,y:p},{width:1,height:d}),kt.copy(u.data,o,{x:0,y:0},{x:c+f,y:p},{width:1,height:d})}this.image=o,this.iconPositions=r,this.patternPositions=i}addImages(t,e,r){for(let i in t){let n=t[i],a={x:0,y:0,w:n.data.width+2,h:n.data.height+2};r.push(a),e[i]=new Ep(a,n),n.hasRenderCallback&&this.haveRenderCallbacks.push(i)}}patchUpdatedImages(t,e){if(t.dispatchRenderCallbacks(this.haveRenderCallbacks),this.patchedUpdateVersion!==t.updateVersion){this.patchedUpdateVersion=t.updateVersion;for(let r in this.iconPositions)this.patchUpdatedImage(this.iconPositions[r],t.getImage(r),e);for(let r in this.patternPositions)this.patchUpdatedImage(this.patternPositions[r],t.getImage(r),e)}}patchUpdatedImage(t,e,r){if(!t||!e||!t.needsFirstWebGLRender&&t.version===e.version)return;t.needsFirstWebGLRender=!1,t.version=e.version;let[i,n]=t.tl,a=e.userImage?.data;if(!lx(a)){r.update(e.data,void 0,{x:i,y:n});return}let{width:s,height:o}=e.data;r.context.setCustomLayerDefaults(),a.renderWithWebGL({gl:r.context.gl,texture:r.texture,x:i,y:n,width:s,height:o}),r.context.setDirty()}};I("ImagePosition",Ep),I("ImageAtlas",Ao);var Tp=function(t){return t[t.none=0]="none",t[t.horizontal=1]="horizontal",t[t.vertical=2]="vertical",t[t.horizontalOnly=3]="horizontalOnly",t}(Tp||{});function ux(t){for(let e of t)if(e.positionedGlyphs.length!==0)return!1;return!0}function hx(t,e){let r=[],i=0;for(let n of e)r.push(t.substring(i,n)),i=n;return i<t.length()&&r.push(t.substring(i,t.length())),r}var vu=/^\\p{gc=M}$/u;function cx(t){let e=[],r=0;for(;r<t.length;){if(!vu.test(t[r])){e.push(r),r++;continue}let i=r;for(;i<t.length&&vu.test(t[i]);)i++;let n=t[i];if(n!==void 0&&Qs(n.codePointAt(0))){e.push(i);for(let a=i-1;a>=r;a--)e.push(a);r=i+1}else{for(let a=r;a<i;a++)e.push(a);r=i}}return e}function px(t){let e=[],r=0;for(let i of t.graphemes())e.push(...Array(i.length).fill(t.sectionIndex[r])),r++;return e}function bu(t,e,r){let i=[...t],n=[],a=0;for(let h of i)n.push(a),a+=h.length;let s=cx(i),o=new wo(s.map(h=>i[h]).join(""),e,[]),l=s.map(h=>r[n[h]]??0),u=0;for(let h of o.graphemes())o.sectionIndex.push(l[u]??0),u+=[...h].length;return o}function Oi(t,e,r,i,n,a,s,o,l,u,h,c,p,f,d){let y=wo.fromFeature(t,n);c===2&&y.verticalizePunctuation();let m,g=y.determineLineBreaks(u,a,e,i,f),{processBidirectionalText:x,processStyledBidirectionalText:b}=Jt;if(x&&y.sections.length===1){m=[],g=g.map(S=>y.toCodeUnitIndex(S));let A=x(y.toString(),g);for(let S of A)m.push(bu(S,y.sections,[...S].map(()=>0)))}else if(b){m=[],g=g.map(D=>y.toCodeUnitIndex(D));let A=px(y),S=b(y.text,A,g);for(let D of S)m.push(bu(D[0],y.sections,D[1]))}else m=hx(y,g);let v=[],w={positionedLines:v,text:y.toString(),top:h[1],bottom:h[1],left:h[0],right:h[0],writingMode:c,iconsInText:!1,verticalizable:!1};return wx(w,e,r,i,m,s,o,l,c,u,p,d),!ux(v)&&w}function Fp(t){let e=.5,r=.5;switch(t){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(t){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:e,verticalAlign:r}}function fx(t,e,r){let i=e.getMaxScale()*24,{maxImageWidth:n,maxImageHeight:a}=e.getMaxImageSize(t),s=Math.max(i,a*r);return{verticalLineContentWidth:Math.max(i,n*r),horizontalLineContentHeight:s}}function kp(t){switch(t){case"top":return 0;case"center":return .5;default:return 1}}function dx(t,e,r,i){if(t?.rect)return t;let n=e[r.fontStack]?.[i];return n?{rect:null,metrics:n.metrics}:null}function yx(t,e,r){return!(t===1||!e&&!In(r)||e&&(Js(r)||Tc(r)))}function Ki(t){return/\\p{Nd}/u.test(String.fromCodePoint(t))}function Ip(t){return/\\p{Lu}/u.test(String.fromCodePoint(t))}function mx(t){return/[\\p{P}\\p{S}]/u.test(String.fromCodePoint(t))}function gx(t){let e=t.some(Ki)&&t.every(i=>Ki(i)||mx(i)),r=t.length<=3&&t.every(i=>Ip(i)||Ki(i));return e||r}function xx(t){return(Ki(t)||Ip(t))&&!Tc(t)}function vx(t,e){let r=!1;for(let i=0;i<t.length;i++){if(e[i])continue;let n=er[t[i]];n&&(i===0||e[i-1])&&(i===t.length-1||e[i+1])&&(t[i]=n,e[i]=!0,r=!0)}return r}function bx(t){let e=t.graphemes().slice(),r=e.map(a=>a.codePointAt(0)),i=r.map(In),n=a=>!i[a]&&!Js(r[a])&&!("imageName"in t.getSection(a));for(let a=0;a<r.length;a++){if(!n(a))continue;let s=a;for(;s+1<r.length&&n(s+1);)s++;if(gx(r.slice(a,s+1)))for(let o=a;o<=s;o++)i[o]=xx(r[o]);a=s}return vx(e,i)&&(t.text=e.join(""),t._graphemes=null),i}function wx(t,e,r,i,n,a,s,o,l,u,h,c){let p=0,f=0,d=0,y=0,m=o==="right"?1:o==="left"?0:.5,g=24/c,x=0;for(let w of n){w.trim();let A=w.getMaxScale(),S={positionedGlyphs:[],lineOffset:0};t.positionedLines[x]=S;let D=S.positionedGlyphs,E=0;if(!w.length()){f+=a,++x;continue}let L=fx(i,w,g),$=l===2&&!h?bx(w):null,P=w.graphemes();for(let V=0;V<P.length;V++){let R=w.getSection(V),B=P[V],G=B.codePointAt(0),W=$?$[V]:yx(l,h,G),ft="fontStack"in R&&Ap(B)&&!e[R.fontStack]?.[B]?[...B]:[B];for(let tt of ft){let ct={glyph:tt.codePointAt(0),grapheme:tt,imageName:null,x:p,y:f+-17,vertical:W,scale:1,fontStack:"",sectionIndex:w.getSectionIndex(V),metrics:null,rect:null},$t;if("fontStack"in R){if($t=_x(R,tt,W,L,e,r),!$t)continue;ct.fontStack=R.fontStack}else{if(t.iconsInText=!0,R.scale*=g,$t=Sx(R,W,A,L,i),!$t)continue;E=Math.max(E,$t.imageOffset),ct.imageName=R.imageName}let{rect:Ge,metrics:be,baselineOffset:je}=$t;if(ct.y+=je,ct.scale=R.scale,ct.metrics=be,ct.rect=Ge,D.push(ct),!W)p+=be.advance*R.scale+u;else{t.verticalizable=!0;let Ye="imageName"in R?be.advance:24;p+=Ye*R.scale+u}}}if(D.length!==0){let V=p-u;d=Math.max(V,d),Ax(D,0,D.length-1,m)}p=0;let z=(A-1)*24;S.lineOffset=Math.max(E,z);let F=a*A+E;f+=F,y=Math.max(F,y),++x}let{horizontalAlign:b,verticalAlign:v}=Fp(s);Dx(t.positionedLines,m,b,v,d,y,a,f,n.length),t.top+=-v*f,t.bottom=t.top+f,t.left+=-b*d,t.right=t.left+d}function _x(t,e,r,i,n,a){let s=a[t.fontStack]?.[e],o=dx(s,n,t,e);if(o===null)return null;let l;if(r)l=i.verticalLineContentWidth-t.scale*24;else{let u=kp(t.verticalAlign);l=(i.horizontalLineContentHeight-t.scale*24)*u}return{rect:o.rect,metrics:o.metrics,baselineOffset:l}}function Sx(t,e,r,i,n){let a=n[t.imageName];if(!a)return null;let s=a.paddedRect,o=a.displaySize,l={width:o[0],height:o[1],left:1,top:-3,advance:e?o[1]:o[0]},u;if(e)u=i.verticalLineContentWidth-o[1]*t.scale;else{let c=kp(t.verticalAlign);u=(i.horizontalLineContentHeight-o[1]*t.scale)*c}let h=(e?o[0]:o[1])*t.scale-24*r;return{rect:s,metrics:l,baselineOffset:u,imageOffset:h}}function Ax(t,e,r,i){if(i===0)return;let n=t[r],a=n.metrics.advance*n.scale,s=(t[r].x+a)*i;for(let o=e;o<=r;o++)t[o].x-=s}function Dx(t,e,r,i,n,a,s,o,l){let u=(e-r)*n,h=0;h=a===s?-i*l*s+.5*s:-o*i- -17;for(let c of t)for(let p of c.positionedGlyphs)p.x+=u,p.y+=h}function Ex(t,e,r){let{horizontalAlign:i,verticalAlign:n}=Fp(r),a=e[0],s=e[1],o=a-t.displaySize[0]*i,l=o+t.displaySize[0],u=s-t.displaySize[1]*n;return{image:t,top:u,bottom:u+t.displaySize[1],left:o,right:l}}function Mp(t){let e=t.left,r=t.top,i=t.right-e,n=t.bottom-r,a=t.image.content[2]-t.image.content[0],s=t.image.content[3]-t.image.content[1],o=t.image.textFitWidth??"stretchOrShrink",l=t.image.textFitHeight??"stretchOrShrink",u=a/s;if(l==="proportional"){if(o==="stretchOnly"&&i/n<u||o==="proportional"){let h=Math.ceil(n*u);e*=h/i,i=h}}else if(o==="proportional"&&l==="stretchOnly"&&u!==0&&i/n>u){let h=Math.ceil(i/u);r*=h/n,n=h}return{x1:e,y1:r,x2:e+i,y2:r+n}}function wu(t,e,r,i,n,a){let s=t.image,o;if(s.content){let m=s.content,g=s.pixelRatio||1;o=[m[0]/g,m[1]/g,s.displaySize[0]-m[2]/g,s.displaySize[1]-m[3]/g]}let l=e.left*a,u=e.right*a,h,c,p,f;r==="width"||r==="both"?(f=n[0]+l-i[3],c=n[0]+u+i[1]):(f=n[0]+(l+u-s.displaySize[0])/2,c=f+s.displaySize[0]);let d=e.top*a,y=e.bottom*a;return r==="height"||r==="both"?(h=n[1]+d-i[0],p=n[1]+y+i[2]):(h=n[1]+(d+y-s.displaySize[1])/2,p=h+s.displaySize[1]),{image:s,top:h,right:c,bottom:p,left:f,collisionPadding:o}}var _u=32640;function Su(t,e){let{expression:r}=e;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new H(t+1))};if(r.kind==="source")return{kind:"source"};if(r.kind==="composite"){let{minZoom:i,maxZoom:n}=Tx(r.zoomStops,t);return{kind:"composite",minZoom:i,maxZoom:n,interpolationType:r.interpolationType}}{let i=Fx(r),n=r.evaluate(new H(t+1));return{kind:"camera",zoomStops:r.zoomStops,sizes:i,layoutSize:n,interpolationType:r.interpolationType}}}function Tx(t,e){let r=0;for(;r<t.length&&t[r]<=e;)r++;r=Math.max(0,r-1);let i=r;for(;i<t.length&&t[i]<e+1;)i++;return i=Math.min(t.length-1,i),{minZoom:t[r],maxZoom:t[i]}}function Fx(t){return t.zoomStops.map(e=>t.evaluate(new H(e===-1/0?t.zoomStops[1]-1:e)))}function Au(t,e,r){let i="never",n=t.get(e);return n?i=n:t.get(r)&&(i="always"),i}var kx=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Ri(t,e,r,i,n,a,s,o,l,u,h,c,p,f){let d=o?Math.min(_u,Math.round(o[0])):0,y=o?Math.min(_u,Math.round(o[1])):0;t.emplaceBack(e,r,Math.round(i*32),Math.round(n*32),a,s,(d<<1)+ +!!l,y,u*16,h*16,c*256,p*256,f)}function Cp(t,e,r){t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r)}function Ix(t){for(let e of t.sections)if(Dm(e.text))return!0;return!1}var _s=class{constructor(t){this.layoutVertexArray=new qm,this.indexArray=new xi,this.programConfigurations=t,this.segments=new Ct,this.dynamicLayoutVertexArray=new Gm,this.opacityVertexArray=new jm,this.hasVisibleVertices=!1,this.placedSymbolArray=new Cc}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(t,e,r,i){this.isEmpty()||(r&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Pg.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,e),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,zg.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,kx,!0),this.opacityVertexBuffer.itemSize=1),(r||i)&&this.programConfigurations.upload(t))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}};I("SymbolBuffers",_s);var Ss=class{constructor(t,e,r){this.layoutVertexArray=new t,this.layoutAttributes=e,this.indexArray=new r,this.segments=new Ct,this.collisionVertexArray=new Ym}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,Lg.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}};I("CollisionBuffers",Ss);var Ce=class{constructor(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(s=>s.id),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasDependencies=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];let e=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Su(this.zoom,e["text-size"]),this.iconSizeData=Su(this.zoom,e["icon-size"]);let r=this.layers[0].layout,i=r.get("symbol-sort-key"),n=r.get("symbol-z-order");this.canOverlap=Au(r,"text-overlap","text-allow-overlap")!=="never"||Au(r,"icon-overlap","icon-allow-overlap")!=="never"||r.get("text-ignore-placement")||r.get("icon-ignore-placement"),this.sortFeaturesByKey=n!=="viewport-y"&&!i.isConstant();let a=n==="viewport-y"||n==="auto"&&!this.sortFeaturesByKey;this.sortFeaturesByY=a&&this.canOverlap,r.get("symbol-placement")==="point"&&(this.writingModes=r.get("text-writing-mode").map(s=>Tp[s])),this.stateDependentLayerIds=this.layers.filter(s=>s.isStateDependent()).map(s=>s.id),this.sourceID=t.sourceID}createArrays(){this.text=new _s(new Le(this.layers,this.zoom,t=>t.startsWith("text"))),this.icon=new _s(new Le(this.layers,this.zoom,t=>t.startsWith("icon"))),this.glyphOffsetArray=new zc,this.lineVertexArray=new Lc,this.symbolInstances=new Pc,this.textAnchorOffsets=new Oc}calculateGlyphDependencies(t,e,r,i,n){let a=(i||this.allowVerticalPlacement)&&n,s=wo.fromFeature(t,r),o=s.graphemes();for(let l=0;l<o.length;l++){let u=s.getSection(l);if("imageName"in u)continue;let h=e[u.fontStack]||={},c=o[l];Ap(c)&&(h[c]=!0);for(let p of c){if(h[p]=!0,!a)continue;let f=er[p];f&&(h[f]=!0)}}}populate(t,e,r){let i=this.layers[0],n=i.layout,a=n.get("text-font"),s=n.get("text-field"),o=n.get("icon-image"),l=(s.value.kind!=="constant"||s.value.value instanceof oe&&!s.value.value.isEmpty()||s.value.value.toString().length>0)&&(a.value.kind!=="constant"||a.value.value.length>0),u=o.value.kind!=="constant"||!!o.value.value||Object.keys(o.parameters).length>0,h=n.get("symbol-sort-key");if(this.features=[],!l&&!u)return;let c=e.iconDependencies,p=e.glyphDependencies,f=e.availableImages,d=new H(this.zoom);for(let{feature:y,id:m,index:g,sourceLayerIndex:x}of t){let b=i._featureFilter.needGeometry,v=br(y,b);if(!i._featureFilter.filter(d,v,r))continue;b||(v.geometry=$e(y));let w;if(l){let E=i.getValueAndResolveTokens("text-field",v,r,f),L=oe.factory(E);this.hasRTLText||=Ix(L),(!this.hasRTLText||Jt.getRTLTextPluginStatus()==="unavailable"||this.hasRTLText&&Jt.isParsed())&&(w=Og(L,i,v))}let A;if(u){let E=i.getValueAndResolveTokens("icon-image",v,r,f);A=E instanceof Kt?E:Kt.fromString(E)}if(!w&&!A)continue;let S=this.sortFeaturesByKey?h.evaluate(v,{},r):void 0,D={id:m,text:w,icon:A,index:g,sourceLayerIndex:x,geometry:v.geometry,properties:y.properties,type:vi.types[y.type],sortKey:S};if(this.features.push(D),A&&(c[A.name]=!0),w){let E=a.evaluate(v,{},r).join(","),L=n.get("text-rotation-alignment")!=="viewport"&&n.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes?.includes(2);let $=Ia(w.toString());this.calculateGlyphDependencies(w,p,E,L,$);for(let P of w.sections)P.image&&(c[P.image.name]=!0)}}n.get("symbol-placement")==="line"&&(this.features=Rg(this.features)),this.sortFeaturesByKey&&this.features.sort((y,m)=>y.sortKey-m.sortKey)}update(t,e,r){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,e,this.layers,{imagePositions:r}),this.icon.programConfigurations.updatePaintArrays(t,e,this.layers,{imagePositions:r}))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(t,e){let r=this.lineVertexArray.length;if(t.segment!==void 0){let i=t.dist(e[t.segment+1]),n=t.dist(e[t.segment]),a={};for(let s=t.segment+1;s<e.length;s++)a[s]={x:e[s].x,y:e[s].y,tileUnitDistanceFromAnchor:i},s<e.length-1&&(i+=e[s+1].dist(e[s]));for(let s=t.segment||0;s>=0;s--)a[s]={x:e[s].x,y:e[s].y,tileUnitDistanceFromAnchor:n},s>0&&(n+=e[s-1].dist(e[s]));for(let s=0;s<e.length;s++){let o=a[s];this.lineVertexArray.emplaceBack(o.x,o.y,o.tileUnitDistanceFromAnchor)}}return{lineStartIndex:r,lineLength:this.lineVertexArray.length-r}}addSymbols(t,e,r,i,n,a,s,o,l,u,h,c,p){let f=t.indexArray,d=t.layoutVertexArray,y=t.segments.prepareSegment(4*e.length,d,f,this.canOverlap?a.sortKey:void 0),m=this.glyphOffsetArray.length,g=y.vertexLength,x=this.allowVerticalPlacement&&s===2?Math.PI/2:0,b=a.text&&a.text.sections;for(let v=0;v<e.length;v++){let{tl:w,tr:A,bl:S,br:D,tex:E,pixelOffsetTL:L,pixelOffsetBR:$,minFontScaleX:P,minFontScaleY:z,glyphOffset:F,isSDF:V,sectionIndex:R}=e[v],B=y.vertexLength,G=F[1];Ri(d,o.x,o.y,w.x,G+w.y,E.x,E.y,r,V,L.x,L.y,P,z,p),Ri(d,o.x,o.y,A.x,G+A.y,E.x+E.w,E.y,r,V,$.x,L.y,P,z,p),Ri(d,o.x,o.y,S.x,G+S.y,E.x,E.y+E.h,r,V,L.x,$.y,P,z,p),Ri(d,o.x,o.y,D.x,G+D.y,E.x+E.w,E.y+E.h,r,V,$.x,$.y,P,z,p),Cp(t.dynamicLayoutVertexArray,o,x),f.emplaceBack(B,B+2,B+1),f.emplaceBack(B+1,B+2,B+3),y.vertexLength+=4,y.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(F[0]),(v===e.length-1||R!==e[v+1].sectionIndex)&&t.programConfigurations.populatePaintArrays(d.length,a,a.index,{imagePositions:{},canonical:c,formattedSection:b?.[R]})}t.placedSymbolArray.emplaceBack(o.x,o.y,m,this.glyphOffsetArray.length-m,g,l,u,o.segment,r?r[0]:0,r?r[1]:0,i[0],i[1],s,0,!1,0,h,p)}_addCollisionDebugVertex(t,e,r,i,n,a){return e.emplaceBack(0,0),t.emplaceBack(r.x,r.y,i,n,Math.round(a.x),Math.round(a.y))}addCollisionDebugVertices(t,e,r,i,n,a,s){let o=n.segments.prepareSegment(4,n.layoutVertexArray,n.indexArray),l=o.vertexLength,u=n.layoutVertexArray,h=n.collisionVertexArray,c=s.anchorX,p=s.anchorY;this._addCollisionDebugVertex(u,h,a,c,p,new M(t,e)),this._addCollisionDebugVertex(u,h,a,c,p,new M(r,e)),this._addCollisionDebugVertex(u,h,a,c,p,new M(r,i)),this._addCollisionDebugVertex(u,h,a,c,p,new M(t,i)),o.vertexLength+=4;let f=n.indexArray;f.emplaceBack(l,l+1),f.emplaceBack(l+1,l+2),f.emplaceBack(l+2,l+3),f.emplaceBack(l+3,l),o.primitiveLength+=4}addDebugCollisionBoxes(t,e,r,i){for(let n=t;n<e;n++){let a=this.collisionBoxArray.get(n),s=a.x1,o=a.y1,l=a.x2,u=a.y2;this.addCollisionDebugVertices(s,o,l,u,i?this.textCollisionBox:this.iconCollisionBox,a.anchorPoint,r)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Ss(Vl,lu.members,Ha),this.iconCollisionBox=new Ss(Vl,lu.members,Ha);for(let t=0;t<this.symbolInstances.length;t++){let e=this.symbolInstances.get(t);this.addDebugCollisionBoxes(e.textBoxStartIndex,e.textBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.verticalTextBoxStartIndex,e.verticalTextBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.iconBoxStartIndex,e.iconBoxEndIndex,e,!1),this.addDebugCollisionBoxes(e.verticalIconBoxStartIndex,e.verticalIconBoxEndIndex,e,!1)}}_deserializeCollisionBoxesForSymbol(t,e,r,i,n,a,s,o,l){let u={};for(let h=e;h<r;h++){let c=t.get(h);u.textBox={x1:c.x1,y1:c.y1,x2:c.x2,y2:c.y2,anchorPointX:c.anchorPointX,anchorPointY:c.anchorPointY},u.textFeatureIndex=c.featureIndex;break}for(let h=i;h<n;h++){let c=t.get(h);u.verticalTextBox={x1:c.x1,y1:c.y1,x2:c.x2,y2:c.y2,anchorPointX:c.anchorPointX,anchorPointY:c.anchorPointY},u.verticalTextFeatureIndex=c.featureIndex;break}for(let h=a;h<s;h++){let c=t.get(h);u.iconBox={x1:c.x1,y1:c.y1,x2:c.x2,y2:c.y2,anchorPointX:c.anchorPointX,anchorPointY:c.anchorPointY},u.iconFeatureIndex=c.featureIndex;break}for(let h=o;h<l;h++){let c=t.get(h);u.verticalIconBox={x1:c.x1,y1:c.y1,x2:c.x2,y2:c.y2,anchorPointX:c.anchorPointX,anchorPointY:c.anchorPointY},u.verticalIconFeatureIndex=c.featureIndex;break}return u}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let e=0;e<this.symbolInstances.length;e++){let r=this.symbolInstances.get(e);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,r.textBoxStartIndex,r.textBoxEndIndex,r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r.iconBoxStartIndex,r.iconBoxEndIndex,r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(t,e){let r=t.placedSymbolArray.get(e),i=r.vertexStartIndex+r.numGlyphs*4;for(let n=r.vertexStartIndex;n<i;n+=4)t.indexArray.emplaceBack(n,n+2,n+1),t.indexArray.emplaceBack(n+1,n+2,n+3)}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;let e=Math.sin(t),r=Math.cos(t),i=[],n=[],a=[];for(let s=0;s<this.symbolInstances.length;++s){a.push(s);let o=this.symbolInstances.get(s);i.push(Math.round(e*o.anchorX+r*o.anchorY)|0),n.push(o.featureIndex)}return a.sort((s,o)=>i[s]-i[o]||n[o]-n[s]),a}addToSortKeyRanges(t,e){let r=this.sortKeyRanges[this.sortKeyRanges.length-1];r?.sortKey===e?r.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:e,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(let e of this.symbolInstanceIndexes){let r=this.symbolInstances.get(e);this.featureSortOrder.push(r.featureIndex);let i=[r.rightJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.leftJustifiedTextSymbolIndex];for(let n=0;n<i.length;n++){let a=i[n];a>=0&&i.indexOf(a)===n&&this.addIndicesForPlacedSymbol(this.text,a)}r.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,r.verticalPlacedTextSymbolIndex),r.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,r.placedIconSymbolIndex),r.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,r.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}};I("SymbolBucket",Ce,{omit:["layers","collisionBoxArray","features","compareText"]}),Ce.MAX_GLYPHS=65535,Ce.addDynamicAttributes=Cp;function Mx(t,e){return e.replace(/{([^{}]+)}/g,(r,i)=>t&&i in t?String(t[i]):"")}var Cx,Bx=()=>Cx||=new Ft({"symbol-placement":new C(_.layout_symbol["symbol-placement"],"symbol-placement"),"symbol-spacing":new C(_.layout_symbol["symbol-spacing"],"symbol-spacing"),"symbol-avoid-edges":new C(_.layout_symbol["symbol-avoid-edges"],"symbol-avoid-edges"),"symbol-sort-key":new O(_.layout_symbol["symbol-sort-key"],"symbol-sort-key"),"symbol-z-order":new C(_.layout_symbol["symbol-z-order"],"symbol-z-order"),"icon-allow-overlap":new C(_.layout_symbol["icon-allow-overlap"],"icon-allow-overlap"),"icon-overlap":new C(_.layout_symbol["icon-overlap"],"icon-overlap"),"icon-ignore-placement":new C(_.layout_symbol["icon-ignore-placement"],"icon-ignore-placement"),"icon-optional":new C(_.layout_symbol["icon-optional"],"icon-optional"),"icon-rotation-alignment":new O(_.layout_symbol["icon-rotation-alignment"],"icon-rotation-alignment"),"icon-size":new O(_.layout_symbol["icon-size"],"icon-size"),"icon-text-fit":new C(_.layout_symbol["icon-text-fit"],"icon-text-fit"),"icon-text-fit-padding":new C(_.layout_symbol["icon-text-fit-padding"],"icon-text-fit-padding"),"icon-image":new O(_.layout_symbol["icon-image"],"icon-image"),"icon-rotate":new O(_.layout_symbol["icon-rotate"],"icon-rotate"),"icon-padding":new O(_.layout_symbol["icon-padding"],"icon-padding"),"icon-keep-upright":new C(_.layout_symbol["icon-keep-upright"],"icon-keep-upright"),"icon-offset":new O(_.layout_symbol["icon-offset"],"icon-offset"),"icon-anchor":new O(_.layout_symbol["icon-anchor"],"icon-anchor"),"icon-pitch-alignment":new C(_.layout_symbol["icon-pitch-alignment"],"icon-pitch-alignment"),"text-pitch-alignment":new C(_.layout_symbol["text-pitch-alignment"],"text-pitch-alignment"),"text-rotation-alignment":new C(_.layout_symbol["text-rotation-alignment"],"text-rotation-alignment"),"text-field":new O(_.layout_symbol["text-field"],"text-field"),"text-font":new O(_.layout_symbol["text-font"],"text-font"),"text-size":new O(_.layout_symbol["text-size"],"text-size"),"text-max-width":new O(_.layout_symbol["text-max-width"],"text-max-width"),"text-line-height":new C(_.layout_symbol["text-line-height"],"text-line-height"),"text-letter-spacing":new O(_.layout_symbol["text-letter-spacing"],"text-letter-spacing"),"text-justify":new O(_.layout_symbol["text-justify"],"text-justify"),"text-radial-offset":new O(_.layout_symbol["text-radial-offset"],"text-radial-offset"),"text-variable-anchor":new C(_.layout_symbol["text-variable-anchor"],"text-variable-anchor"),"text-variable-anchor-offset":new O(_.layout_symbol["text-variable-anchor-offset"],"text-variable-anchor-offset"),"text-anchor":new O(_.layout_symbol["text-anchor"],"text-anchor"),"text-max-angle":new C(_.layout_symbol["text-max-angle"],"text-max-angle"),"text-writing-mode":new C(_.layout_symbol["text-writing-mode"],"text-writing-mode"),"text-rotate":new O(_.layout_symbol["text-rotate"],"text-rotate"),"text-padding":new C(_.layout_symbol["text-padding"],"text-padding"),"text-keep-upright":new C(_.layout_symbol["text-keep-upright"],"text-keep-upright"),"text-transform":new O(_.layout_symbol["text-transform"],"text-transform"),"text-offset":new O(_.layout_symbol["text-offset"],"text-offset"),"text-allow-overlap":new C(_.layout_symbol["text-allow-overlap"],"text-allow-overlap"),"text-overlap":new C(_.layout_symbol["text-overlap"],"text-overlap"),"text-ignore-placement":new C(_.layout_symbol["text-ignore-placement"],"text-ignore-placement"),"text-optional":new C(_.layout_symbol["text-optional"],"text-optional"),"symbol-height-offset":new O(_.layout_symbol["symbol-height-offset"],"symbol-height-offset"),"symbol-height-anchor":new C(_.layout_symbol["symbol-height-anchor"],"symbol-height-anchor")}),Px,zx=()=>Px||=new Ft({"icon-opacity":new O(_.paint_symbol["icon-opacity"],"icon-opacity"),"icon-color":new O(_.paint_symbol["icon-color"],"icon-color"),"icon-halo-color":new O(_.paint_symbol["icon-halo-color"],"icon-halo-color"),"icon-halo-width":new O(_.paint_symbol["icon-halo-width"],"icon-halo-width"),"icon-halo-blur":new O(_.paint_symbol["icon-halo-blur"],"icon-halo-blur"),"icon-translate":new C(_.paint_symbol["icon-translate"],"icon-translate"),"icon-translate-anchor":new C(_.paint_symbol["icon-translate-anchor"],"icon-translate-anchor"),"text-opacity":new O(_.paint_symbol["text-opacity"],"text-opacity"),"text-color":new O(_.paint_symbol["text-color"],"text-color",{runtimeType:Ut,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),"text-halo-color":new O(_.paint_symbol["text-halo-color"],"text-halo-color"),"text-halo-width":new O(_.paint_symbol["text-halo-width"],"text-halo-width"),"text-halo-blur":new O(_.paint_symbol["text-halo-blur"],"text-halo-blur"),"text-translate":new C(_.paint_symbol["text-translate"],"text-translate"),"text-translate-anchor":new C(_.paint_symbol["text-translate-anchor"],"text-translate-anchor")}),fa={get paint(){return zx()},get layout(){return Bx()}},Bp=class{constructor(t){if(t.property.overrides===void 0)throw Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=t.property.overrides?t.property.overrides.runtimeType:ci,this.defaultValue=t}evaluate(t){if(t.formattedSection){let e=this.defaultValue.property.overrides;if(e?.hasOverride(t.formattedSection))return e.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){if(!this.defaultValue.isConstant()){let e=this.defaultValue.value;t(e._styleExpression.expression)}}outputDefined(){return!1}serialize(){return null}};I("FormatSectionOverride",Bp,{omit:["defaultValue"]});var Lx=class As extends jt{constructor(e,r){super(e,fa,r)}recalculate(e,r){super.recalculate(e,r);let i=this.layout.get("icon-rotation-alignment");if((i.value.kind!=="constant"||i.value.value==="auto")&&(this.layout._values["icon-rotation-alignment"]=new Vt(i.property,{kind:"constant",value:this.layout.get("symbol-placement")==="point"?"viewport":"map"},i.parameters)),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout.get("symbol-placement")==="point"?this.layout._values["text-rotation-alignment"]="viewport":this.layout._values["text-rotation-alignment"]="map"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment").constantOr("viewport")),this.layout.get("symbol-placement")==="point"){let n=this.layout.get("text-writing-mode");if(n){let a=[];for(let s of n)a.includes(s)||a.push(s);this.layout._values["text-writing-mode"]=a}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,r,i,n){let a=this.layout.get(e).evaluate(r,{},i,n),s=this._unevaluatedLayout._values[e];return!s.isDataDriven()&&!Fn(s.value)&&a?Mx(r.properties,a):a}createBucket(e){return new Ce(e)}queryRadius(){return 0}queryIntersectsFeature(){throw Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let e of fa.paint.overridableProperties){if(!As.hasPaintOverride(this.layout,e))continue;let r=this.paint.get(e),i=new Ys(new Bp(r),`layers[${this.id}].paint.${r.property.name}`,r.property.specification),n=null;n=r.value.kind==="constant"||r.value.kind==="source"?new ri("source",i):new an("composite",i,r.value.zoomStops),this.paint._values[e]=new Vt(r.property,n,r.parameters)}}_handleOverridablePaintPropertyUpdate(e,r,i){return!this.layout||r.isDataDriven()||i.isDataDriven()?!1:As.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,r){let i=e.get("text-field"),n=fa.paint.properties[r],a=!1,s=o=>{for(let l of o)if(n.overrides?.hasOverride(l)){a=!0;return}};if(i.value.kind==="constant"&&i.value.value instanceof oe)s(i.value.value.sections);else if(i.value.kind==="source"||i.value.kind==="composite"){let o=u=>{if(!a)if(u instanceof pr&<(u.value)===pi){let h=u.value;s(h.sections)}else u instanceof xh?s(u.sections):u.eachChild(o)},l=i.value;l._styleExpression&&o(l._styleExpression.expression)}return a}};function Vx(t,e,r,i=1){let n=t.get("icon-padding").evaluate(e,{},r)?.values;return[n[0]*i,n[1]*i,n[2]*i,n[3]*i]}var Ox,Rx=()=>Ox||=new Ft({"background-color":new C(_.paint_background["background-color"],"background-color"),"background-pattern":new kc(_.paint_background["background-pattern"],"background-pattern"),"background-opacity":new C(_.paint_background["background-opacity"],"background-opacity")}),$x={get paint(){return Rx()}};var Nx=class extends jt{constructor(t,e){super(t,$x,e)}};var Ux=class extends jt{constructor(t,e){super(t,{},e),this.onAdd=r=>{this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)},this.onRemove=r=>{this.implementation.onRemove&&this.implementation.onRemove(r,r.painter.context.gl)},this.implementation=t}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw Error("Custom layers cannot be serialized")}};function Pp(t,e){if(t.type==="custom")return new Ux(t,e);switch(t.type){case"background":return new Nx(t,e);case"circle":return new w0(t,e);case"color-relief":return new z0(t,e);case"fill":return new d1(t,e);case"fill-extrusion":return new O1(t,e);case"heatmap":return new T0(t,e);case"hillshade":return new M0(t,e);case"line":return new Bg(t,e);case"raster":return new Pm(t,e);case"symbol":return new Lx(t,e)}}var qx=class{constructor(t){this._methodToThrottle=t,this._triggered=!1,this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()}}trigger(){this._triggered||(this._triggered=!0,this._channel?.port1.postMessage(!0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}},Gx={once:!0},zp=class{constructor(t,e){this.target=t,this.mapId=e,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new qx(()=>this.process()),this.subscription=tl(this.target,"message",r=>this.receive(r),!1),this.globalScope=Be(self)?t:window}registerMessageHandler(t,e){this.messageHandlers[t]=e}unregisterMessageHandler(t){delete this.messageHandlers[t]}sendAsync(t,e){return new Promise((r,i)=>{let n=Math.round(Math.random()*1e18).toString(36).substring(0,10),a=e?tl(e.signal,"abort",()=>{a?.unsubscribe(),delete this.resolveRejects[n];let l={id:n,type:"<cancel>",origin:location.origin,targetMapId:t.targetMapId,sourceMapId:this.mapId};this.target.postMessage(l),i(new Ms(e.signal.reason))},Gx):null;this.resolveRejects[n]={resolve:l=>{a?.unsubscribe(),r(l)},reject:l=>{a?.unsubscribe(),i(l)}};let s=[],o={...t,id:n,sourceMapId:this.mapId,origin:location.origin,data:jr(t.data,s)};this.target.postMessage(o,{transfer:s})})}receive(t){let e=t.data,r=e.id,i=["file://","resource://android","null"],n=[e.origin,location.origin],a=e.origin===location.origin,s=n.some(o=>i.includes(o));if(!(!a&&!s)&&!(e.targetMapId&&this.mapId!==e.targetMapId)){if(e.type==="<cancel>"){delete this.tasks[r];let o=this.abortControllers[r];delete this.abortControllers[r],o&&o.abort();return}if(Be(self)||e.mustQueue){this.tasks[r]=e,this.taskQueue.push(r),this.invoker.trigger();return}this.processTask(r,e)}}process(){if(this.taskQueue.length===0)return;let t=this.taskQueue.shift(),e=this.tasks[t];delete this.tasks[t],this.taskQueue.length>0&&this.invoker.trigger(),e&&this.processTask(t,e)}async processTask(t,e){if(e.type==="<response>"){let n=this.resolveRejects[t];if(delete this.resolveRejects[t],!n)return;e.error?n.reject(Wr(Yr(e.error))):n.resolve(Yr(e.data));return}if(!this.messageHandlers[e.type]){this.completeTask(t,null,null);return}let r=Yr(e.data),i=new AbortController;this.abortControllers[t]=i;try{let n=await this.messageHandlers[e.type](e.sourceMapId,r,i);this.completeTask(t,null,n)}catch(n){this.completeTask(t,Wr(n))}}completeTask(t,e,r){let i=[];delete this.abortControllers[t];let n={id:t,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:e?jr(e):null,data:jr(r,i)};this.target.postMessage(n,{transfer:i})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}};function jx(t,e,r){return!(t<0||t>25||r<0||r>=2**t||e<0||e>=2**t)}var Lp=class{constructor(t,e,r){if(!jx(t,e,r))throw Error(`x=${e}, y=${r}, z=${t} outside of bounds. 0<=x<${2**t}, 0<=y<${2**t} 0<=z<=25 `);this.z=t,this.x=e,this.y=r,this.key=Zr(0,t,t,e,r)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,e,r){let i=Xx(this.x,this.y,this.z),n=Zx(this.z,this.x,this.y);return t[(this.x+this.y)%t.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(r==="tms"?2**this.z-this.y-1:this.y)).replace(/{ratio}/g,e>1?"@2x":"").replace(/{quadkey}/g,n).replace(/{bbox-epsg-3857}/g,i)}isChildOf(t){let e=this.z-t.z;return e>0&&t.x===this.x>>e&&t.y===this.y>>e}getTilePoint(t){let e=2**this.z;return new M((t.x*e-this.x)*it,(t.y*e-this.y)*it)}toString(){return`${this.z}/${this.x}/${this.y}`}},Yx=class{constructor(t,e){this.wrap=t,this.canonical=e,this.key=Zr(t,e.z,e.z,e.x,e.y)}},Do=class zt{constructor(e,r,i,n,a){if(this.terrainRttPosMatrix32f=null,e<i)throw Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${i}`);this.overscaledZ=e,this.wrap=r,this.canonical=new Lp(i,+n,+a),this.key=Zr(r,e,i,n,a)}clone(){return new zt(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);let r=this.canonical.z-e;return e>this.canonical.z?new zt(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new zt(e,this.wrap,e,this.canonical.x>>r,this.canonical.y>>r)}isOverscaled(){return this.overscaledZ>this.canonical.z}calculateScaledKey(e,r){if(e>this.overscaledZ)throw Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);let i=this.canonical.z-e;return e>this.canonical.z?Zr(this.wrap*+r,e,this.canonical.z,this.canonical.x,this.canonical.y):Zr(this.wrap*+r,e,e,this.canonical.x>>i,this.canonical.y>>i)}isChildOf(e){if(e.wrap!==this.wrap||this.overscaledZ-e.overscaledZ<=0)return!1;if(e.overscaledZ===0)return this.overscaledZ>0;let r=this.canonical.z-e.canonical.z;return r<0?!1:e.canonical.x===this.canonical.x>>r&&e.canonical.y===this.canonical.y>>r}children(e){if(this.overscaledZ>=e)return[new zt(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let r=this.canonical.z+1,i=this.canonical.x*2,n=this.canonical.y*2;return[new zt(r,this.wrap,r,i,n),new zt(r,this.wrap,r,i+1,n),new zt(r,this.wrap,r,i,n+1),new zt(r,this.wrap,r,i+1,n+1)]}isLessThan(e){return this.wrap<e.wrap?!0:this.wrap>e.wrap?!1:this.overscaledZ<e.overscaledZ?!0:this.overscaledZ>e.overscaledZ?!1:this.canonical.x<e.canonical.x?!0:this.canonical.x>e.canonical.x?!1:this.canonical.y<e.canonical.y}wrapped(){return new zt(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new zt(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return 2**(this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Yx(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new co(e.x-this.wrap,e.y))}normalizeCoordinates(e,r,i=it){if(e>=0&&e<i&&r>=0&&r<i)return{tileID:this,x:e,y:r};let n=Math.floor(e/i),a=Math.floor(r/i),s=e-n*i,o=r-a*i,l=this.canonical.z,u=1<<l,h=this.canonical.y+a;if(h<0||h>=u)return null;let c=this.canonical.x+n,p=this.wrap;return c<0?(p-=Math.ceil(-c/u),c=(c%u+u)%u):c>=u&&(p+=Math.floor(c/u),c%=u),{tileID:new zt(this.overscaledZ,p,l,c,h),x:s,y:o}}};function Zr(t,e,r,i,n){t*=2,t<0&&(t=t*-1-1);let a=1<<r;return(a*a*t+a*n+i).toString(36)+r.toString(36)+e.toString(36)}var da=Math.PI*6378137;function Xx(t,e,r){e=2**r-e-1;let i=Du(t*256,e*256,r),n=Du((t+1)*256,(e+1)*256,r);return`${i[0]},${i[1]},${n[0]},${n[1]}`}function Du(t,e,r){let i=2*da/256/2**r;return[t*i-da,e*i-da]}function Zx(t,e,r){let i="";for(let n=t;n>0;n--){let a=1<<n-1;i+=(e&a?1:0)+(r&a?2:0)}return i}I("CanonicalTileID",Lp),I("OverscaledTileID",Do,{omit:["terrainRttPosMatrix32f"]});var Wx=class{constructor(t,e){this.feature=t,this.type=t.type,this.properties=t.tags?t.tags:{},this.extent=e,"id"in t&&(typeof t.id=="string"?this.id=parseInt(t.id,10):typeof t.id=="number"&&!isNaN(t.id)&&(this.id=t.id))}loadGeometry(){let t=[],e=this.feature.type===1?[this.feature.geometry]:this.feature.geometry;for(let r of e){let i=[];for(let n of r)i.push(new M(n[0],n[1]));t.push(i)}return t}},Ds="_geojsonTileLayer",Vp=class{constructor(t,e){this.layers={[Ds]:this},this.name=Ds,this.version=e?e.version:1,this.extent=e?e.extent:4096,this.length=t.length,this.features=t}feature(t){return new Wx(this.features[t],this.extent)}};function Eo(t,e=""){let r=new jg;return Hx(t,r,e),r.finish()}function Hx(t,e,r=""){for(let i in t.layers)e.writeMessage(3,(n,a)=>Kx(n,a,r),t.layers[i])}function Kx(t,e,r=""){e.writeVarintField(15,t.version||1),e.writeStringField(1,t.name||""),e.writeVarintField(5,t.extent||4096);let i={jsonPrefix:r,keys:[],values:[],keycache:{},valuecache:{}};for(let s=0;s<t.length;s++)i.feature=t.feature(s),e.writeMessage(2,Jx,i);let n=i.keys;for(let s of n)e.writeStringField(3,s);let a=i.values;for(let s of a)e.writeMessage(4,e2,s)}function Jx(t,e){if(!t.feature)return;let r=t.feature;r.id!==void 0&&e.writeVarintField(1,r.id),e.writeMessage(2,Qx,t),e.writeVarintField(3,r.type),e.writeMessage(4,t2,r)}function Qx(t,e){for(let r in t.feature?.properties){let i=t.feature.properties[r],n=t.keycache[r];if(i==null)continue;n===void 0&&(t.keys.push(r),n=t.keys.length-1,t.keycache[r]=n),e.writeVarint(n),typeof i!="string"&&typeof i!="boolean"&&typeof i!="number"&&(i=t.jsonPrefix+JSON.stringify(i));let a=typeof i+":"+i,s=t.valuecache[a];s===void 0&&(t.values.push(i),s=t.values.length-1,t.valuecache[a]=s),e.writeVarint(s)}}function ya(t,e){return(e<<3)+(t&7)}function Eu(t){return t<<1^t>>31}function t2(t,e){let r=t.loadGeometry(),i=t.type,n=0,a=0;for(let s of r){let o=1;i===1&&(o=s.length),e.writeVarint(ya(1,o));let l=i===3?s.length-1:s.length;for(let u=0;u<l;u++){u===1&&i!==1&&e.writeVarint(ya(2,l-1));let h=s[u].x-n,c=s[u].y-a;e.writeVarint(Eu(h)),e.writeVarint(Eu(c)),n+=h,a+=c}t.type===3&&e.writeVarint(ya(7,1))}}function e2(t,e){let r=typeof t;r==="string"?e.writeStringField(1,t):r==="boolean"?e.writeBooleanField(7,t):r==="number"&&(t%1==0?t<0?e.writeSVarintField(6,t):e.writeVarintField(5,t):e.writeDoubleField(3,t))}var To=class{constructor(t){this._stringToNumber={},this._numberToString=[];for(let e=0;e<t.length;e++){let r=t[e];this._stringToNumber[r]=e,this._numberToString[e]=r}}encode(t){return this._stringToNumber[t]}decode(t){if(t>=this._numberToString.length)throw Error(`Out of bounds. Index requested n=${t} can\'t be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[t]}},r2=class{constructor(t,e,r,i,n){this.type="Feature",this._vectorTileFeature=t,this._x=r,this._y=i,this._z=e;for(let a in t.properties)typeof t.properties[a]!="string"||!t.properties[a].startsWith("__$json__:")||(t.properties[a]=JSON.parse(t.properties[a].slice(10)));this.properties=t.properties,this.id=n}projectPoint(t,e,r,i){return[(t.x+e)*360/i-180,360/Math.PI*Math.atan(Math.exp((1-(t.y+r)*2/i)*Math.PI))-90]}projectLine(t,e,r,i){return t.map(n=>this.projectPoint(n,e,r,i))}get geometry(){if(this._geometry)return this._geometry;let t=this._vectorTileFeature,e=t.extent*2**this._z,r=t.extent*this._x,i=t.extent*this._y,n=t.loadGeometry();switch(t.type){case 1:{let a=[];for(let o of n)a.push(o[0]);let s=this.projectLine(a,r,i,e);this._geometry=a.length===1?{type:"Point",coordinates:s[0]}:{type:"MultiPoint",coordinates:s};break}case 2:{let a=n.map(s=>this.projectLine(s,r,i,e));this._geometry=a.length===1?{type:"LineString",coordinates:a[0]}:{type:"MultiLineString",coordinates:a};break}case 3:{let a=op(n),s=[];for(let o of a)s.push(o.map(l=>this.projectLine(l,r,i,e)));this._geometry=s.length===1?{type:"Polygon",coordinates:s[0]}:{type:"MultiPolygon",coordinates:s};break}default:throw Error(`unknown feature type: ${t.type}`)}return this._geometry}set geometry(t){this._geometry=t}toJSON(){let t={geometry:this.geometry};for(let e in this)e!=="_geometry"&&e!=="_vectorTileFeature"&&e!=="_x"&&e!=="_y"&&e!=="_z"&&(t[e]=this[e]);return t}},Ne=class{constructor(t,e,r){this._name=t,this.dataBuffer=e,typeof r=="number"?this._size=r:(this.nullabilityBuffer=r,this._size=r.size())}getValue(t){return this.nullabilityBuffer&&!this.nullabilityBuffer.get(t)?null:this.getValueFromBuffer(t)}has(t){return this.nullabilityBuffer?.get(t)||!this.nullabilityBuffer}get name(){return this._name}get size(){return this._size}},Nn=class extends Ne{},Fo=class extends Nn{getValueFromBuffer(t){return this.dataBuffer[t]}},ko=class extends Nn{getValueFromBuffer(t){return this.dataBuffer[t]}},Op=class extends Ne{constructor(t,e,r,i){super(t,e,i),this.delta=r}},Io=class extends Op{constructor(t,e,r,i,n){super(t,n?Int32Array.of(e):Uint32Array.of(e),r,i)}getValueFromBuffer(t){return this.dataBuffer[0]+t*this.delta}},Mo=class extends Ne{constructor(t,e,r,i){super(t,i?Int32Array.of(e):Uint32Array.of(e),r)}getValueFromBuffer(t){return this.dataBuffer[0]}},i2=class{constructor(t,e,r,i,n=4096){if(this._name=t,this._geometryVector=e,this._idVector=r,this._propertyVectors=i,this._extent=n,t.length===0)throw Error("Missing layer name")}get name(){return this._name}get idVector(){return this._idVector}get geometryVector(){return this._geometryVector}get propertyVectors(){return this._propertyVectors??[]}getPropertyVector(t){return this.propertyVectorsMap||=new Map(this.propertyVectors.map(e=>[e.name,e])),this.propertyVectorsMap.get(t)}get numFeatures(){return this.geometryVector.numGeometries}get extent(){return this._extent}getFeatures(){let t=[],e=this.geometryVector.getGeometries();for(let r=0;r<this.numFeatures;r++){let i;if(this.idVector){let s=this.idVector.getValue(r);s!==null&&(i=this.containsMaxSafeIntegerValues(this.idVector)?Number(s):s)}let n={coordinates:e[r],type:this.geometryVector.geometryType(r)},a={};for(let s of this.propertyVectors){if(!s)continue;let o=s.name,l=s.getValue(r);l!==null&&(a[o]=l)}t.push({id:i,geometry:n,properties:a})}return t}containsMaxSafeIntegerValues(t){return t instanceof Fo||t instanceof Mo||t instanceof Io||t instanceof ko}},Nr={FEATURE:0,VERTEX:1},Z={BOOLEAN:0,INT_8:1,UINT_8:2,INT_32:3,UINT_32:4,INT_64:5,UINT_64:6,FLOAT:7,DOUBLE:8,STRING:9},ge={GEOMETRY:0,STRUCT:1,MAP:2},Rp={ID:0},$p=class{constructor(t){this.value=t}get(){return this.value}set(t){this.value=t}increment(){return this.value++}add(t){this.value+=t}},U;(function(t){t.NONE="NONE",t.DELTA="DELTA",t.COMPONENTWISE_DELTA="COMPONENTWISE_DELTA",t.RLE="RLE",t.MORTON="MORTON",t.PDE="PDE"})(U||={});var Rt;(function(t){t.NONE="NONE",t.FAST_PFOR="FAST_PFOR",t.VARINT="VARINT"})(Rt||={});var Co=new Uint32Array(33);Co[0]=0;for(let t=1;t<=32;t++)Co[t]=t===32?4294967295:4294967295>>>32-t;var Es=Co,Np=65536;function Bo(t,e){return t-t%e}function n2(t){return Bo(t+31,32)}function a2(t){if(!Number.isFinite(t)||t<=0)return Np;let e=Bo(Math.floor(t),256);return e===0?256:e}function s2(t){let e=t>>>0;return((e&255)<<24|(e&65280)<<8|e>>>8&65280|e>>>24&255)>>>0}function o2(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0;r[n++]=a>>>0&3,r[n++]=a>>>2&3,r[n++]=a>>>4&3,r[n++]=a>>>6&3,r[n++]=a>>>8&3,r[n++]=a>>>10&3,r[n++]=a>>>12&3,r[n++]=a>>>14&3,r[n++]=a>>>16&3,r[n++]=a>>>18&3,r[n++]=a>>>20&3,r[n++]=a>>>22&3,r[n++]=a>>>24&3,r[n++]=a>>>26&3,r[n++]=a>>>28&3,r[n++]=a>>>30&3,r[n++]=s>>>0&3,r[n++]=s>>>2&3,r[n++]=s>>>4&3,r[n++]=s>>>6&3,r[n++]=s>>>8&3,r[n++]=s>>>10&3,r[n++]=s>>>12&3,r[n++]=s>>>14&3,r[n++]=s>>>16&3,r[n++]=s>>>18&3,r[n++]=s>>>20&3,r[n++]=s>>>22&3,r[n++]=s>>>24&3,r[n++]=s>>>26&3,r[n++]=s>>>28&3,r[n]=s>>>30&3}function l2(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0;r[n++]=a>>>0&7,r[n++]=a>>>3&7,r[n++]=a>>>6&7,r[n++]=a>>>9&7,r[n++]=a>>>12&7,r[n++]=a>>>15&7,r[n++]=a>>>18&7,r[n++]=a>>>21&7,r[n++]=a>>>24&7,r[n++]=a>>>27&7,r[n++]=(a>>>30|(s&1)<<2)&7,r[n++]=s>>>1&7,r[n++]=s>>>4&7,r[n++]=s>>>7&7,r[n++]=s>>>10&7,r[n++]=s>>>13&7,r[n++]=s>>>16&7,r[n++]=s>>>19&7,r[n++]=s>>>22&7,r[n++]=s>>>25&7,r[n++]=s>>>28&7,r[n++]=(s>>>31|(o&3)<<1)&7,r[n++]=o>>>2&7,r[n++]=o>>>5&7,r[n++]=o>>>8&7,r[n++]=o>>>11&7,r[n++]=o>>>14&7,r[n++]=o>>>17&7,r[n++]=o>>>20&7,r[n++]=o>>>23&7,r[n++]=o>>>26&7,r[n]=o>>>29&7}function u2(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0;r[n++]=a>>>0&15,r[n++]=a>>>4&15,r[n++]=a>>>8&15,r[n++]=a>>>12&15,r[n++]=a>>>16&15,r[n++]=a>>>20&15,r[n++]=a>>>24&15,r[n++]=a>>>28&15,r[n++]=s>>>0&15,r[n++]=s>>>4&15,r[n++]=s>>>8&15,r[n++]=s>>>12&15,r[n++]=s>>>16&15,r[n++]=s>>>20&15,r[n++]=s>>>24&15,r[n++]=s>>>28&15,r[n++]=o>>>0&15,r[n++]=o>>>4&15,r[n++]=o>>>8&15,r[n++]=o>>>12&15,r[n++]=o>>>16&15,r[n++]=o>>>20&15,r[n++]=o>>>24&15,r[n++]=o>>>28&15,r[n++]=l>>>0&15,r[n++]=l>>>4&15,r[n++]=l>>>8&15,r[n++]=l>>>12&15,r[n++]=l>>>16&15,r[n++]=l>>>20&15,r[n++]=l>>>24&15,r[n]=l>>>28&15}function h2(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0;r[n++]=a>>>0&31,r[n++]=a>>>5&31,r[n++]=a>>>10&31,r[n++]=a>>>15&31,r[n++]=a>>>20&31,r[n++]=a>>>25&31,r[n++]=(a>>>30|(s&7)<<2)&31,r[n++]=s>>>3&31,r[n++]=s>>>8&31,r[n++]=s>>>13&31,r[n++]=s>>>18&31,r[n++]=s>>>23&31,r[n++]=(s>>>28|(o&1)<<4)&31,r[n++]=o>>>1&31,r[n++]=o>>>6&31,r[n++]=o>>>11&31,r[n++]=o>>>16&31,r[n++]=o>>>21&31,r[n++]=o>>>26&31,r[n++]=(o>>>31|(l&15)<<1)&31,r[n++]=l>>>4&31,r[n++]=l>>>9&31,r[n++]=l>>>14&31,r[n++]=l>>>19&31,r[n++]=l>>>24&31,r[n++]=(l>>>29|(u&3)<<3)&31,r[n++]=u>>>2&31,r[n++]=u>>>7&31,r[n++]=u>>>12&31,r[n++]=u>>>17&31,r[n++]=u>>>22&31,r[n]=u>>>27&31}function c2(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0;r[n++]=a>>>0&63,r[n++]=a>>>6&63,r[n++]=a>>>12&63,r[n++]=a>>>18&63,r[n++]=a>>>24&63,r[n++]=(a>>>30|(s&15)<<2)&63,r[n++]=s>>>4&63,r[n++]=s>>>10&63,r[n++]=s>>>16&63,r[n++]=s>>>22&63,r[n++]=(s>>>28|(o&3)<<4)&63,r[n++]=o>>>2&63,r[n++]=o>>>8&63,r[n++]=o>>>14&63,r[n++]=o>>>20&63,r[n++]=o>>>26&63,r[n++]=l>>>0&63,r[n++]=l>>>6&63,r[n++]=l>>>12&63,r[n++]=l>>>18&63,r[n++]=l>>>24&63,r[n++]=(l>>>30|(u&15)<<2)&63,r[n++]=u>>>4&63,r[n++]=u>>>10&63,r[n++]=u>>>16&63,r[n++]=u>>>22&63,r[n++]=(u>>>28|(h&3)<<4)&63,r[n++]=h>>>2&63,r[n++]=h>>>8&63,r[n++]=h>>>14&63,r[n++]=h>>>20&63,r[n]=h>>>26&63}function p2(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0,c=t[e+6]>>>0;r[n++]=a>>>0&127,r[n++]=a>>>7&127,r[n++]=a>>>14&127,r[n++]=a>>>21&127,r[n++]=(a>>>28|(s&7)<<4)&127,r[n++]=s>>>3&127,r[n++]=s>>>10&127,r[n++]=s>>>17&127,r[n++]=s>>>24&127,r[n++]=(s>>>31|(o&63)<<1)&127,r[n++]=o>>>6&127,r[n++]=o>>>13&127,r[n++]=o>>>20&127,r[n++]=(o>>>27|(l&3)<<5)&127,r[n++]=l>>>2&127,r[n++]=l>>>9&127,r[n++]=l>>>16&127,r[n++]=l>>>23&127,r[n++]=(l>>>30|(u&31)<<2)&127,r[n++]=u>>>5&127,r[n++]=u>>>12&127,r[n++]=u>>>19&127,r[n++]=(u>>>26|(h&1)<<6)&127,r[n++]=h>>>1&127,r[n++]=h>>>8&127,r[n++]=h>>>15&127,r[n++]=h>>>22&127,r[n++]=(h>>>29|(c&15)<<3)&127,r[n++]=c>>>4&127,r[n++]=c>>>11&127,r[n++]=c>>>18&127,r[n]=c>>>25&127}function f2(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0,c=t[e+6]>>>0,p=t[e+7]>>>0;r[n++]=a>>>0&255,r[n++]=a>>>8&255,r[n++]=a>>>16&255,r[n++]=a>>>24&255,r[n++]=s>>>0&255,r[n++]=s>>>8&255,r[n++]=s>>>16&255,r[n++]=s>>>24&255,r[n++]=o>>>0&255,r[n++]=o>>>8&255,r[n++]=o>>>16&255,r[n++]=o>>>24&255,r[n++]=l>>>0&255,r[n++]=l>>>8&255,r[n++]=l>>>16&255,r[n++]=l>>>24&255,r[n++]=u>>>0&255,r[n++]=u>>>8&255,r[n++]=u>>>16&255,r[n++]=u>>>24&255,r[n++]=h>>>0&255,r[n++]=h>>>8&255,r[n++]=h>>>16&255,r[n++]=h>>>24&255,r[n++]=c>>>0&255,r[n++]=c>>>8&255,r[n++]=c>>>16&255,r[n++]=c>>>24&255,r[n++]=p>>>0&255,r[n++]=p>>>8&255,r[n++]=p>>>16&255,r[n]=p>>>24&255}function d2(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0,c=t[e+6]>>>0,p=t[e+7]>>>0,f=t[e+8]>>>0;r[n++]=a>>>0&511,r[n++]=a>>>9&511,r[n++]=a>>>18&511,r[n++]=(a>>>27|(s&15)<<5)&511,r[n++]=s>>>4&511,r[n++]=s>>>13&511,r[n++]=s>>>22&511,r[n++]=(s>>>31|(o&255)<<1)&511,r[n++]=o>>>8&511,r[n++]=o>>>17&511,r[n++]=(o>>>26|(l&7)<<6)&511,r[n++]=l>>>3&511,r[n++]=l>>>12&511,r[n++]=l>>>21&511,r[n++]=(l>>>30|(u&127)<<2)&511,r[n++]=u>>>7&511,r[n++]=u>>>16&511,r[n++]=(u>>>25|(h&3)<<7)&511,r[n++]=h>>>2&511,r[n++]=h>>>11&511,r[n++]=h>>>20&511,r[n++]=(h>>>29|(c&63)<<3)&511,r[n++]=c>>>6&511,r[n++]=c>>>15&511,r[n++]=(c>>>24|(p&1)<<8)&511,r[n++]=p>>>1&511,r[n++]=p>>>10&511,r[n++]=p>>>19&511,r[n++]=(p>>>28|(f&31)<<4)&511,r[n++]=f>>>5&511,r[n++]=f>>>14&511,r[n]=f>>>23&511}function y2(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0,c=t[e+6]>>>0,p=t[e+7]>>>0,f=t[e+8]>>>0,d=t[e+9]>>>0;r[n++]=a>>>0&1023,r[n++]=a>>>10&1023,r[n++]=a>>>20&1023,r[n++]=(a>>>30|(s&255)<<2)&1023,r[n++]=s>>>8&1023,r[n++]=s>>>18&1023,r[n++]=(s>>>28|(o&63)<<4)&1023,r[n++]=o>>>6&1023,r[n++]=o>>>16&1023,r[n++]=(o>>>26|(l&15)<<6)&1023,r[n++]=l>>>4&1023,r[n++]=l>>>14&1023,r[n++]=(l>>>24|(u&3)<<8)&1023,r[n++]=u>>>2&1023,r[n++]=u>>>12&1023,r[n++]=u>>>22&1023,r[n++]=h>>>0&1023,r[n++]=h>>>10&1023,r[n++]=h>>>20&1023,r[n++]=(h>>>30|(c&255)<<2)&1023,r[n++]=c>>>8&1023,r[n++]=c>>>18&1023,r[n++]=(c>>>28|(p&63)<<4)&1023,r[n++]=p>>>6&1023,r[n++]=p>>>16&1023,r[n++]=(p>>>26|(f&15)<<6)&1023,r[n++]=f>>>4&1023,r[n++]=f>>>14&1023,r[n++]=(f>>>24|(d&3)<<8)&1023,r[n++]=d>>>2&1023,r[n++]=d>>>12&1023,r[n]=d>>>22&1023}function m2(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0,c=t[e+6]>>>0,p=t[e+7]>>>0,f=t[e+8]>>>0,d=t[e+9]>>>0,y=t[e+10]>>>0;r[n++]=a>>>0&2047,r[n++]=a>>>11&2047,r[n++]=(a>>>22|(s&1)<<10)&2047,r[n++]=s>>>1&2047,r[n++]=s>>>12&2047,r[n++]=(s>>>23|(o&3)<<9)&2047,r[n++]=o>>>2&2047,r[n++]=o>>>13&2047,r[n++]=(o>>>24|(l&7)<<8)&2047,r[n++]=l>>>3&2047,r[n++]=l>>>14&2047,r[n++]=(l>>>25|(u&15)<<7)&2047,r[n++]=u>>>4&2047,r[n++]=u>>>15&2047,r[n++]=(u>>>26|(h&31)<<6)&2047,r[n++]=h>>>5&2047,r[n++]=h>>>16&2047,r[n++]=(h>>>27|(c&63)<<5)&2047,r[n++]=c>>>6&2047,r[n++]=c>>>17&2047,r[n++]=(c>>>28|(p&127)<<4)&2047,r[n++]=p>>>7&2047,r[n++]=p>>>18&2047,r[n++]=(p>>>29|(f&255)<<3)&2047,r[n++]=f>>>8&2047,r[n++]=f>>>19&2047,r[n++]=(f>>>30|(d&511)<<2)&2047,r[n++]=d>>>9&2047,r[n++]=d>>>20&2047,r[n++]=(d>>>31|(y&1023)<<1)&2047,r[n++]=y>>>10&2047,r[n]=y>>>21&2047}function g2(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0,c=t[e+6]>>>0,p=t[e+7]>>>0,f=t[e+8]>>>0,d=t[e+9]>>>0,y=t[e+10]>>>0,m=t[e+11]>>>0;r[n++]=a>>>0&4095,r[n++]=a>>>12&4095,r[n++]=(a>>>24|(s&15)<<8)&4095,r[n++]=s>>>4&4095,r[n++]=s>>>16&4095,r[n++]=(s>>>28|(o&255)<<4)&4095,r[n++]=o>>>8&4095,r[n++]=o>>>20&4095,r[n++]=l>>>0&4095,r[n++]=l>>>12&4095,r[n++]=(l>>>24|(u&15)<<8)&4095,r[n++]=u>>>4&4095,r[n++]=u>>>16&4095,r[n++]=(u>>>28|(h&255)<<4)&4095,r[n++]=h>>>8&4095,r[n++]=h>>>20&4095,r[n++]=c>>>0&4095,r[n++]=c>>>12&4095,r[n++]=(c>>>24|(p&15)<<8)&4095,r[n++]=p>>>4&4095,r[n++]=p>>>16&4095,r[n++]=(p>>>28|(f&255)<<4)&4095,r[n++]=f>>>8&4095,r[n++]=f>>>20&4095,r[n++]=d>>>0&4095,r[n++]=d>>>12&4095,r[n++]=(d>>>24|(y&15)<<8)&4095,r[n++]=y>>>4&4095,r[n++]=y>>>16&4095,r[n++]=(y>>>28|(m&255)<<4)&4095,r[n++]=m>>>8&4095,r[n]=m>>>20&4095}function x2(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0,c=t[e+6]>>>0,p=t[e+7]>>>0,f=t[e+8]>>>0,d=t[e+9]>>>0,y=t[e+10]>>>0,m=t[e+11]>>>0,g=t[e+12]>>>0,x=t[e+13]>>>0,b=t[e+14]>>>0,v=t[e+15]>>>0;r[n++]=a>>>0&65535,r[n++]=a>>>16&65535,r[n++]=s>>>0&65535,r[n++]=s>>>16&65535,r[n++]=o>>>0&65535,r[n++]=o>>>16&65535,r[n++]=l>>>0&65535,r[n++]=l>>>16&65535,r[n++]=u>>>0&65535,r[n++]=u>>>16&65535,r[n++]=h>>>0&65535,r[n++]=h>>>16&65535,r[n++]=c>>>0&65535,r[n++]=c>>>16&65535,r[n++]=p>>>0&65535,r[n++]=p>>>16&65535,r[n++]=f>>>0&65535,r[n++]=f>>>16&65535,r[n++]=d>>>0&65535,r[n++]=d>>>16&65535,r[n++]=y>>>0&65535,r[n++]=y>>>16&65535,r[n++]=m>>>0&65535,r[n++]=m>>>16&65535,r[n++]=g>>>0&65535,r[n++]=g>>>16&65535,r[n++]=x>>>0&65535,r[n++]=x>>>16&65535,r[n++]=b>>>0&65535,r[n++]=b>>>16&65535,r[n++]=v>>>0&65535,r[n]=v>>>16&65535}function v2(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0;r[n++]=o>>>0&1,r[n++]=o>>>1&1,r[n++]=o>>>2&1,r[n++]=o>>>3&1,r[n++]=o>>>4&1,r[n++]=o>>>5&1,r[n++]=o>>>6&1,r[n++]=o>>>7&1,r[n++]=o>>>8&1,r[n++]=o>>>9&1,r[n++]=o>>>10&1,r[n++]=o>>>11&1,r[n++]=o>>>12&1,r[n++]=o>>>13&1,r[n++]=o>>>14&1,r[n++]=o>>>15&1,r[n++]=o>>>16&1,r[n++]=o>>>17&1,r[n++]=o>>>18&1,r[n++]=o>>>19&1,r[n++]=o>>>20&1,r[n++]=o>>>21&1,r[n++]=o>>>22&1,r[n++]=o>>>23&1,r[n++]=o>>>24&1,r[n++]=o>>>25&1,r[n++]=o>>>26&1,r[n++]=o>>>27&1,r[n++]=o>>>28&1,r[n++]=o>>>29&1,r[n++]=o>>>30&1,r[n++]=o>>>31&1}}function b2(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0,l=t[a++]>>>0;r[n++]=o>>>0&3,r[n++]=o>>>2&3,r[n++]=o>>>4&3,r[n++]=o>>>6&3,r[n++]=o>>>8&3,r[n++]=o>>>10&3,r[n++]=o>>>12&3,r[n++]=o>>>14&3,r[n++]=o>>>16&3,r[n++]=o>>>18&3,r[n++]=o>>>20&3,r[n++]=o>>>22&3,r[n++]=o>>>24&3,r[n++]=o>>>26&3,r[n++]=o>>>28&3,r[n++]=o>>>30&3,r[n++]=l>>>0&3,r[n++]=l>>>2&3,r[n++]=l>>>4&3,r[n++]=l>>>6&3,r[n++]=l>>>8&3,r[n++]=l>>>10&3,r[n++]=l>>>12&3,r[n++]=l>>>14&3,r[n++]=l>>>16&3,r[n++]=l>>>18&3,r[n++]=l>>>20&3,r[n++]=l>>>22&3,r[n++]=l>>>24&3,r[n++]=l>>>26&3,r[n++]=l>>>28&3,r[n++]=l>>>30&3}}function w2(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0,l=t[a++]>>>0,u=t[a++]>>>0;r[n++]=o>>>0&7,r[n++]=o>>>3&7,r[n++]=o>>>6&7,r[n++]=o>>>9&7,r[n++]=o>>>12&7,r[n++]=o>>>15&7,r[n++]=o>>>18&7,r[n++]=o>>>21&7,r[n++]=o>>>24&7,r[n++]=o>>>27&7,r[n++]=(o>>>30|(l&1)<<2)&7,r[n++]=l>>>1&7,r[n++]=l>>>4&7,r[n++]=l>>>7&7,r[n++]=l>>>10&7,r[n++]=l>>>13&7,r[n++]=l>>>16&7,r[n++]=l>>>19&7,r[n++]=l>>>22&7,r[n++]=l>>>25&7,r[n++]=l>>>28&7,r[n++]=(l>>>31|(u&3)<<1)&7,r[n++]=u>>>2&7,r[n++]=u>>>5&7,r[n++]=u>>>8&7,r[n++]=u>>>11&7,r[n++]=u>>>14&7,r[n++]=u>>>17&7,r[n++]=u>>>20&7,r[n++]=u>>>23&7,r[n++]=u>>>26&7,r[n++]=u>>>29&7}}function _2(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0,l=t[a++]>>>0,u=t[a++]>>>0,h=t[a++]>>>0;r[n++]=o>>>0&15,r[n++]=o>>>4&15,r[n++]=o>>>8&15,r[n++]=o>>>12&15,r[n++]=o>>>16&15,r[n++]=o>>>20&15,r[n++]=o>>>24&15,r[n++]=o>>>28&15,r[n++]=l>>>0&15,r[n++]=l>>>4&15,r[n++]=l>>>8&15,r[n++]=l>>>12&15,r[n++]=l>>>16&15,r[n++]=l>>>20&15,r[n++]=l>>>24&15,r[n++]=l>>>28&15,r[n++]=u>>>0&15,r[n++]=u>>>4&15,r[n++]=u>>>8&15,r[n++]=u>>>12&15,r[n++]=u>>>16&15,r[n++]=u>>>20&15,r[n++]=u>>>24&15,r[n++]=u>>>28&15,r[n++]=h>>>0&15,r[n++]=h>>>4&15,r[n++]=h>>>8&15,r[n++]=h>>>12&15,r[n++]=h>>>16&15,r[n++]=h>>>20&15,r[n++]=h>>>24&15,r[n++]=h>>>28&15}}function S2(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0,l=t[a++]>>>0,u=t[a++]>>>0,h=t[a++]>>>0,c=t[a++]>>>0;r[n++]=o>>>0&31,r[n++]=o>>>5&31,r[n++]=o>>>10&31,r[n++]=o>>>15&31,r[n++]=o>>>20&31,r[n++]=o>>>25&31,r[n++]=(o>>>30|(l&7)<<2)&31,r[n++]=l>>>3&31,r[n++]=l>>>8&31,r[n++]=l>>>13&31,r[n++]=l>>>18&31,r[n++]=l>>>23&31,r[n++]=(l>>>28|(u&1)<<4)&31,r[n++]=u>>>1&31,r[n++]=u>>>6&31,r[n++]=u>>>11&31,r[n++]=u>>>16&31,r[n++]=u>>>21&31,r[n++]=u>>>26&31,r[n++]=(u>>>31|(h&15)<<1)&31,r[n++]=h>>>4&31,r[n++]=h>>>9&31,r[n++]=h>>>14&31,r[n++]=h>>>19&31,r[n++]=h>>>24&31,r[n++]=(h>>>29|(c&3)<<3)&31,r[n++]=c>>>2&31,r[n++]=c>>>7&31,r[n++]=c>>>12&31,r[n++]=c>>>17&31,r[n++]=c>>>22&31,r[n++]=c>>>27&31}}function A2(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0,l=t[a++]>>>0,u=t[a++]>>>0,h=t[a++]>>>0,c=t[a++]>>>0,p=t[a++]>>>0;r[n++]=o>>>0&63,r[n++]=o>>>6&63,r[n++]=o>>>12&63,r[n++]=o>>>18&63,r[n++]=o>>>24&63,r[n++]=(o>>>30|(l&15)<<2)&63,r[n++]=l>>>4&63,r[n++]=l>>>10&63,r[n++]=l>>>16&63,r[n++]=l>>>22&63,r[n++]=(l>>>28|(u&3)<<4)&63,r[n++]=u>>>2&63,r[n++]=u>>>8&63,r[n++]=u>>>14&63,r[n++]=u>>>20&63,r[n++]=u>>>26&63,r[n++]=h>>>0&63,r[n++]=h>>>6&63,r[n++]=h>>>12&63,r[n++]=h>>>18&63,r[n++]=h>>>24&63,r[n++]=(h>>>30|(c&15)<<2)&63,r[n++]=c>>>4&63,r[n++]=c>>>10&63,r[n++]=c>>>16&63,r[n++]=c>>>22&63,r[n++]=(c>>>28|(p&3)<<4)&63,r[n++]=p>>>2&63,r[n++]=p>>>8&63,r[n++]=p>>>14&63,r[n++]=p>>>20&63,r[n++]=p>>>26&63}}function D2(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0,l=t[a++]>>>0,u=t[a++]>>>0,h=t[a++]>>>0,c=t[a++]>>>0,p=t[a++]>>>0,f=t[a++]>>>0;r[n++]=o>>>0&127,r[n++]=o>>>7&127,r[n++]=o>>>14&127,r[n++]=o>>>21&127,r[n++]=(o>>>28|(l&7)<<4)&127,r[n++]=l>>>3&127,r[n++]=l>>>10&127,r[n++]=l>>>17&127,r[n++]=l>>>24&127,r[n++]=(l>>>31|(u&63)<<1)&127,r[n++]=u>>>6&127,r[n++]=u>>>13&127,r[n++]=u>>>20&127,r[n++]=(u>>>27|(h&3)<<5)&127,r[n++]=h>>>2&127,r[n++]=h>>>9&127,r[n++]=h>>>16&127,r[n++]=h>>>23&127,r[n++]=(h>>>30|(c&31)<<2)&127,r[n++]=c>>>5&127,r[n++]=c>>>12&127,r[n++]=c>>>19&127,r[n++]=(c>>>26|(p&1)<<6)&127,r[n++]=p>>>1&127,r[n++]=p>>>8&127,r[n++]=p>>>15&127,r[n++]=p>>>22&127,r[n++]=(p>>>29|(f&15)<<3)&127,r[n++]=f>>>4&127,r[n++]=f>>>11&127,r[n++]=f>>>18&127,r[n++]=f>>>25&127}}function E2(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0,l=t[a++]>>>0,u=t[a++]>>>0,h=t[a++]>>>0,c=t[a++]>>>0,p=t[a++]>>>0,f=t[a++]>>>0,d=t[a++]>>>0;r[n++]=o>>>0&255,r[n++]=o>>>8&255,r[n++]=o>>>16&255,r[n++]=o>>>24&255,r[n++]=l>>>0&255,r[n++]=l>>>8&255,r[n++]=l>>>16&255,r[n++]=l>>>24&255,r[n++]=u>>>0&255,r[n++]=u>>>8&255,r[n++]=u>>>16&255,r[n++]=u>>>24&255,r[n++]=h>>>0&255,r[n++]=h>>>8&255,r[n++]=h>>>16&255,r[n++]=h>>>24&255,r[n++]=c>>>0&255,r[n++]=c>>>8&255,r[n++]=c>>>16&255,r[n++]=c>>>24&255,r[n++]=p>>>0&255,r[n++]=p>>>8&255,r[n++]=p>>>16&255,r[n++]=p>>>24&255,r[n++]=f>>>0&255,r[n++]=f>>>8&255,r[n++]=f>>>16&255,r[n++]=f>>>24&255,r[n++]=d>>>0&255,r[n++]=d>>>8&255,r[n++]=d>>>16&255,r[n++]=d>>>24&255}}function T2(t,e,r,i){let n=i,a=e;for(let s=0;s<128;s++){let o=t[a++]>>>0;r[n++]=o&65535,r[n++]=o>>>16&65535}}function F2(t,e,r,i,n){let a=Es[n]>>>0,s=e,o=0,l=t[s]>>>0,u=i;for(let h=0;h<8;h++){for(let c=0;c<32;c++)if(o+n<=32){let p=l>>>o&a;r[u+c]=p|0,o+=n,o===32&&(o=0,s++,c!==31&&(l=t[s]>>>0))}else{let p=32-o,f=l>>>o;s++,l=t[s]>>>0;let d=n-p,y=-1>>>32-d>>>0,m=(f|(l&y)<<p)&a;r[u+c]=m|0,o=d}u+=32,o=0,h<7&&(l=t[s]>>>0)}}var Ts=a2(Np),k2=3*Ts/256+Ts|0;function Up(){let t=new Uint8Array(k2);return{dataToBePacked:Array(33),dataPointers:new Int32Array(33),byteContainer:t,byteContainerI32:new Int32Array(t.buffer,t.byteOffset,t.byteLength>>>2),exceptionSizes:new Int32Array(33)}}function I2(t=16){if(t<0)throw RangeError(`initialEncodedWordCapacity must be >= 0, got ${t}`);let e=Math.max(16,t|0);return{encodedWords:new Uint32Array(e),decoderWorkspace:Up()}}function M2(t,e){if(e<=t.encodedWords.length)return t.encodedWords;let r=new Uint32Array(Math.max(16,e*2));return t.encodedWords=r,r}function C2(t,e,r,i){i.byteContainer.length<r&&(i.byteContainer=new Uint8Array(r*2),i.byteContainerI32=void 0);let n=i.byteContainer,a=r>>>2;if(n.byteOffset&3)for(let o=0;o<a;o=o+1|0){let l=t[e+o|0]|0,u=o<<2;n[u]=l&255,n[u+1|0]=l>>>8&255,n[u+2|0]=l>>>16&255,n[u+3|0]=l>>>24&255}else{let o=i.byteContainerI32;(!o||o.buffer!==n.buffer||o.byteOffset!==n.byteOffset||o.length<a)&&(o=i.byteContainerI32=new Int32Array(n.buffer,n.byteOffset,n.byteLength>>>2)),o.set(t.subarray(e,e+a))}let s=r&3;if(s>0){let o=t[e+a|0]|0,l=a<<2;for(let u=0;u<s;u=u+1|0)n[l+u|0]=o>>>(u<<3)&255}return n}function B2(t,e,r){let i=t[e++]|0,n=r.dataToBePacked;for(let a=2;a<=32;a=a+1|0){if(!(i>>>a-1&1))continue;if(e>=t.length)throw Error(`FastPFOR decode: truncated exception stream header (bitWidth=${a}, streamWordIndex=${e}, needWords=1, availableWords=${t.length-e}, encodedWords=${t.length})`);let s=t[e++]>>>0,o=n2(s),l=s*a+31>>>5;if(e+l>t.length)throw Error(`FastPFOR decode: truncated exception stream (bitWidth=${a}, size=${s}, streamWordIndex=${e}, needWords=${l}, availableWords=${t.length-e}, encodedWords=${t.length})`);let u=n[a];(!u||u.length<o)&&(u=n[a]=new Uint32Array(o));let h=0;for(;h<s;h=h+32|0)q2(t,e,u,h,a),e=e+a|0;let c=h-s|0;e=e-(c*a>>>5)|0,r.exceptionSizes[a]=s}return e}function P2(t,e,r,i,n){switch(n){case 1:v2(t,e,r,i);break;case 2:b2(t,e,r,i);break;case 3:w2(t,e,r,i);break;case 4:_2(t,e,r,i);break;case 5:S2(t,e,r,i);break;case 6:A2(t,e,r,i);break;case 7:D2(t,e,r,i);break;case 8:E2(t,e,r,i);break;case 16:T2(t,e,r,i);break;default:F2(t,e,r,i,n)}return e+(n<<3)|0}function z2(t,e,r,i){if(r+2>e)throw Error(`FastPFOR decode: byteContainer underflow at block=${i} (need 2 bytes for [bitWidth, exceptionCount], bytePos=${r}, byteSize=${e})`);let n=t[r++],a=t[r++];if(n>32)throw Error(`FastPFOR decode: invalid bitWidth=${n} at block=${i} (expected 0..32). This likely indicates corrupted or truncated input.`);return{bitWidth:n,exceptionCount:a,bytePosIn:r}}function L2(t,e,r,i,n,a){if(r+1>e)throw Error(`FastPFOR decode: exception header underflow at block=${a} (need 1 byte for maxBits, bytePos=${r}, byteSize=${e})`);let s=t[r++];if(s<i||s>32)throw Error(`FastPFOR decode: invalid maxBits=${s} at block=${a} (bitWidth=${i}, expected ${i}..32)`);let o=s-i|0;if(o<1||o>32)throw Error(`FastPFOR decode: invalid exceptionBitWidth=${o} at block=${a} (bitWidth=${i}, maxBits=${s})`);if(r+n>e)throw Error(`FastPFOR decode: exception positions underflow at block=${a} (need=${n}, have=${e-r})`);return{maxBits:s,exceptionBitWidth:o,bytePosIn:r}}function V2(t,e,r,i,n,a,s,o,l){let{maxBits:u,exceptionBitWidth:h,bytePosIn:c}=L2(n,a,s,r,i,l);if(s=c,h===1){let m=1<<r;for(let g=0;g<i;g=g+1|0){let x=n[s++];t[x+e|0]|=m}return s}let p=o.dataToBePacked[h];if(!p)throw Error(`FastPFOR decode: missing exception stream for exceptionBitWidth=${h} (bitWidth=${r}, maxBits=${u}) at block ${l}`);let f=o.dataPointers,d=f[h]|0,y=o.exceptionSizes[h]|0;if(d+i>y)throw Error(`FastPFOR decode: exception stream overflow for exceptionBitWidth=${h} (ptr=${d}, need ${i}, size=${y}) at block ${l}`);for(let m=0;m<i;m=m+1|0){let g=n[s++],x=p[d++]|0;t[g+e|0]|=x<<r}return f[h]=d,s}function O2(t,e,r,i,n,a,s,o,l,u){let h=r|0,c=0;for(let p=0;p<s;p=p+1|0){let f=z2(o,l,c,p);c=f.bytePosIn;let d=f.bitWidth,y=f.exceptionCount,m=a+p*256|0;switch(d){case 0:n.fill(0,m,m+256);break;case 32:for(let g=0;g<256;g=g+1|0)n[m+g|0]=t[h+g|0]|0;h=h+256|0;break;default:h=P2(t,h,n,m,d)}y>0&&(c=V2(n,m,d,y,o,l,c,u,p))}if(h!==i)throw Error(`FastPFOR decode: packed region mismatch (pageStart=${e}, packedStart=${r}, consumedPackedEnd=${h}, expectedPackedEnd=${i}, packedWords=${i-r}, encoded.length=${t.length})`)}function R2(t,e,r,i,n,a){let s=r|0,o=t[s]|0;if(o<=0||s+o>t.length-1)throw Error(`FastPFOR decode: invalid whereMeta=${o} at pageStart=${s} (expected > 0 and pageStart+whereMeta < encoded.length=${t.length})`);let l=s+1|0,u=s+o|0,h=t[u]>>>0,c=h+3>>>2,p=u+1,f=p+c;if(f>=t.length)throw Error(`FastPFOR decode: invalid byteSize=${h} (metaInts=${c}, pageStart=${s}, packedEnd=${u}, byteContainerStart=${p}) causes bitmapPos=${f} out of bounds (encoded.length=${t.length})`);let d=C2(t,p,h,a),y=h,m=B2(t,f,a);return a.dataPointers.fill(0),O2(t,s,l,u,e,i|0,n/256|0,d,y,a),m}function $2(t,e,r,i,n,a){let s=i+Bo(n,256),o=i,l=r;for(;o!==s;){let u=Math.min(Ts,s-o);l=R2(t,e,l,o,u,a),o=o+u|0}return l}function N2(t,e,r,i,n,a){if(a===0)return e;let s=0,o=e,l=e+r,u=n,h=n,c=n+a,p=0,f=0;for(;o<l&&h<c;){let d=t[o]>>>s&255;if(s+=8,o+=s>>>5,s&=31,p|=(d&127)<<f,d&128)i[h++]=p|0,p=0,f=0;else if(f+=7,f>28)throw Error(`FastPFOR VByte: unterminated value (expected MSB=1 terminator within 5 bytes; shift=${f}, partial=${p}, decoded=${h-u}/${a}, inPos=${o}, inEnd=${l})`)}if(h!==c)throw Error(`FastPFOR VByte: truncated stream (decoded=${h-u}, expected=${a}, consumedWords=${o-e}/${r}, vbyteStart=${e}, vbyteEnd=${l})`);return o}function U2(t,e,r){let i=0,n=0,a=new Uint32Array(e),s=r??Up();if(t.length>0){let u=t[i]|0;if(i=i+1|0,u&255)throw Error(`FastPFOR decode: invalid alignedLength=${u} (expected multiple of 256)`);if(n+u>a.length)throw Error(`FastPFOR decode: output buffer too small (outPos=${n}, alignedLength=${u}, out.length=${a.length})`);i=$2(t,a,i,n,u,s),n=n+u|0}let o=t.length-i|0,l=e-n|0;return N2(t,i,o,a,n,l),a}function q2(t,e,r,i,n){switch(n){case 2:o2(t,e,r,i);return;case 3:l2(t,e,r,i);return;case 4:u2(t,e,r,i);return;case 5:h2(t,e,r,i);return;case 6:c2(t,e,r,i);return;case 7:p2(t,e,r,i);return;case 8:f2(t,e,r,i);return;case 9:d2(t,e,r,i);return;case 10:y2(t,e,r,i);return;case 11:m2(t,e,r,i);return;case 12:g2(t,e,r,i);return;case 16:x2(t,e,r,i);return;case 32:for(let u=0;u<32;u=u+1|0)r[i+u|0]=t[e+u|0]|0;return}let a=Es[n]>>>0,s=e,o=0,l=t[s]>>>0;for(let u=0;u<32;u++)if(o+n<=32){let h=l>>>o&a;r[i+u]=h|0,o+=n,o===32&&(o=0,s++,u!==31&&(l=t[s]>>>0))}else{let h=32-o,c=l>>>o;s++,l=t[s]>>>0;let p=Es[n-h]>>>0,f=(c|(l&p)<<h)&a;r[i+u]=f|0,o=n-h}}function G2(t,e,r,i){if(e<0||r<0||e+r>t.length)throw RangeError(`decodeBigEndianInt32sInto: out of bounds (offset=${e}, byteLength=${r}, bytes.length=${t.length})`);let n=Math.floor(r/4),a=r%4!=0,s=a?n+1:n;if(i.length<s)throw RangeError(`decodeBigEndianInt32sInto: out.length=${i.length} < ${s}`);if(n>0){let o=t.byteOffset+e;if(o&3)for(let l=0;l<n;l++){let u=e+l*4;i[l]=t[u]<<24|t[u+1]<<16|t[u+2]<<8|t[u+3]|0}else{let l=new Uint32Array(t.buffer,o,n);for(let u=0;u<n;u++)i[u]=s2(l[u])|0}}if(a){let o=e+n*4,l=r-n*4,u=0;for(let h=0;h<l;h++)u|=t[o+h]<<24-h*8;i[n]=u|0}return s}function _t(t,e,r){let i=new Uint32Array(r),n=0,a=e.get();for(let s=0;s<i.length;s++){let o=t[a++],l=o&127;if(o<128){i[n++]=l;continue}if(o=t[a++],l|=(o&127)<<7,o<128){i[n++]=l;continue}if(o=t[a++],l|=(o&127)<<14,o<128){i[n++]=l;continue}if(o=t[a++],l|=(o&127)<<21,o<128){i[n++]=l;continue}o=t[a++],l|=(o&15)<<28,i[n++]=l}return e.set(a),i}function Po(t,e,r){let i=new BigUint64Array(r);for(let n=0;n<i.length;n++)i[n]=j2(t,e);return i}function j2(t,e){let r=0n,i=0,n=e.get();for(;n<t.length;){let a=t[n++];if(r|=BigInt(a&127)<<BigInt(i),!(a&128))break;if(i+=7,i>=64)throw Error("Varint too long")}return e.set(n),r}function Y2(t,e,r){let i=new Float64Array(r);for(let n=0;n<r;n++)i[n]=X2(t,e);return i}function X2(t,e){let r,i;return i=t[e.get()],e.increment(),r=i&127,i<128||(i=t[e.get()],e.increment(),r|=(i&127)<<7,i<128)||(i=t[e.get()],e.increment(),r|=(i&127)<<14,i<128)||(i=t[e.get()],e.increment(),r|=(i&127)<<21,i<128)?r:(i=t[e.get()],r|=(i&15)<<28,Z2(r,t,e))}function Z2(t,e,r){let i,n;if(n=e[r.get()],r.increment(),i=(n&112)>>4,n<128||(n=e[r.get()],r.increment(),i|=(n&127)<<3,n<128)||(n=e[r.get()],r.increment(),i|=(n&127)<<10,n<128)||(n=e[r.get()],r.increment(),i|=(n&127)<<17,n<128)||(n=e[r.get()],r.increment(),i|=(n&127)<<24,n<128)||(n=e[r.get()],r.increment(),i|=(n&1)<<31,n<128))return i*4294967296+(t>>>0);throw Error("Expected varint not more than 10 bytes")}function W2(t,e,r,i){return H2(t,e,r,i,I2(r>>>2))}function H2(t,e,r,i,n){let a=i.get();if(r&3)throw Error(`FastPFOR: invalid encodedByteLength=${r} at offset=${a} (encodedBytes.length=${t.length}; expected a multiple of 4 bytes for an int32 big-endian word stream)`);let s=r>>>2,o=M2(n,s);G2(t,a,r,o);let l=U2(o.subarray(0,s),e,n.decoderWorkspace);return i.add(r),l}function X(t){return t>>>1^-(t&1)}function bt(t){return t>>1n^-(t&1n)}function pe(t){return t%2==1?(t+1)/-2:t/2}function K2(t){let e=new Int32Array(t.length);for(let r=0;r<t.length;r++)e[r]=X(t[r]);return e}function J2(t){let e=new BigInt64Array(t.length);for(let r=0;r<t.length;r++)e[r]=bt(t[r]);return e}function Q2(t){for(let e=0;e<t.length;e++)t[e]=pe(t[e])}function Fs(t,e,r){if(r===void 0){r=0;for(let a=0;a<e;a++)r+=t[a]}let i=new Uint32Array(r),n=0;for(let a=0;a<e;a++){let s=t[a],o=t[a+e];i.fill(o,n,n+s),n+=s}return i}function ks(t,e,r){if(r===void 0){r=0;for(let a=0;a<e;a++)r+=Number(t[a])}let i=new BigUint64Array(r),n=0;for(let a=0;a<e;a++){let s=Number(t[a]),o=t[a+e];i.fill(o,n,n+s),n+=s}return i}function qp(t,e,r){let i=new Float64Array(r),n=0;for(let a=0;a<e;a++){let s=t[a],o=t[a+e];i.fill(o,n,n+s),n+=s}return i}function Tu(t){let e=new Int32Array(t.length);e[0]=X(t[0]);let r=t.length/4*4,i=1;if(r>=4)for(;i<r-4;i+=4){let n=t[i],a=t[i+1],s=t[i+2],o=t[i+3];e[i]=X(n)+e[i-1],e[i+1]=X(a)+e[i],e[i+2]=X(s)+e[i+1],e[i+3]=X(o)+e[i+2]}for(;i!==t.length;++i)e[i]=X(t[i])+e[i-1];return e}function Fu(t){let e=new BigInt64Array(t.length);e[0]=bt(t[0]);let r=t.length/4*4,i=1;if(r>=4)for(;i<r-4;i+=4){let n=t[i],a=t[i+1],s=t[i+2],o=t[i+3];e[i]=bt(n)+e[i-1],e[i+1]=bt(a)+e[i],e[i+2]=bt(s)+e[i+1],e[i+3]=bt(o)+e[i+2]}for(;i!==e.length;++i)e[i]=bt(t[i])+e[i-1];return e}function tv(t){t[0]=pe(t[0]);let e=t.length/4*4,r=1;if(e>=4)for(;r<e-4;r+=4){let i=t[r],n=t[r+1],a=t[r+2],s=t[r+3];t[r]=pe(i)+t[r-1],t[r+1]=pe(n)+t[r],t[r+2]=pe(a)+t[r+1],t[r+3]=pe(s)+t[r+2]}for(;r!==t.length;++r)t[r]=pe(t[r])+t[r-1]}function ev(t,e,r){if(r===void 0){r=0;for(let a=0;a<e;a++)r+=t[a]}let i=new Int32Array(r),n=0;for(let a=0;a<e;a++){let s=t[a],o=t[a+e];o=X(o),i.fill(o,n,n+s),n+=s}return i}function rv(t,e,r){if(r===void 0){r=0;for(let a=0;a<e;a++)r+=Number(t[a])}let i=new BigInt64Array(r),n=0;for(let a=0;a<e;a++){let s=Number(t[a]),o=t[a+e];o=bt(o),i.fill(o,n,n+s),n+=s}return i}function iv(t,e,r){let i=new Float64Array(r),n=0;for(let a=0;a<e;a++){let s=t[a],o=t[a+e];o=pe(o),i.fill(o,n,n+s),n+=s}return i}function zo(t){let e=t.length/4*4,r=1;if(e>=4)for(let i=t[0];r<e-4;r+=4)i=t[r]+=i,i=t[r+1]+=i,i=t[r+2]+=i,i=t[r+3]+=i;for(;r!==t.length;)t[r]+=t[r-1],++r}function nv(t){let e=0;for(let r=0;r<t.length;r++)t[r]+=e,e=t[r]}function av(t){if(t.length<2)return new Int32Array(t);let e=new Int32Array(t.length);e[0]=X(t[0]),e[1]=X(t[1]);let r=t.length/4*4,i=2;if(r>=4)for(;i<r-4;i+=4){let n=t[i],a=t[i+1],s=t[i+2],o=t[i+3];e[i]=X(n)+e[i-2],e[i+1]=X(a)+e[i-1],e[i+2]=X(s)+e[i],e[i+3]=X(o)+e[i+1]}for(;i!==t.length;i+=2)e[i]=X(t[i])+e[i-2],e[i+1]=X(t[i+1])+e[i-1];return e}function Gp(t,e,r,i){if(t.length<2)return new Int32Array(t);let n=new Int32Array(t.length),a=X(t[0]),s=X(t[1]);n[0]=he(Math.round(a*e),r,i),n[1]=he(Math.round(s*e),r,i);let o=t.length/16,l=2;if(o>=4)for(;l<o-4;l+=4){let u=t[l],h=t[l+1],c=X(u)+a,p=X(h)+s;n[l]=he(Math.round(c*e),r,i),n[l+1]=he(Math.round(p*e),r,i);let f=t[l+2],d=t[l+3];a=X(f)+c,s=X(d)+p,n[l+2]=he(Math.round(a*e),r,i),n[l+3]=he(Math.round(s*e),r,i)}for(;l!==t.length;l+=2)a+=X(t[l]),s+=X(t[l+1]),n[l]=he(Math.round(a*e),r,i),n[l+1]=he(Math.round(s*e),r,i);return n}function he(t,e,r){return Math.min(r,Math.max(e,t))}function sv(t){let e=new Int32Array(t.length+1);e[0]=0,e[1]=X(t[0]);let r=e[1];for(let i=2;i!==e.length;++i){let n=t[i-1],a=X(n);r+=a,e[i]=e[i-1]+r}return new Uint32Array(e)}function ov(t,e,r){let i=new Int32Array(r+1);i[0]=0;let n=1,a=i[0];for(let s=0;s<e;s++){let o=t[s],l=t[s+e];l=X(l);for(let u=n;u<n+o;u++)i[u]=l+a,a=i[u];n+=o}return i}function lv(t,e,r){let i=new Uint32Array(r+1);i[0]=0;let n=1,a=i[0];for(let s=0;s<e;s++){let o=t[s],l=t[s+e];for(let u=n;u<n+o;u++)i[u]=l+a,a=i[u];n+=o}return i}function uv(t,e,r){let i=new Int32Array(r),n=0,a=0;for(let s=0;s<e;s++){let o=t[s],l=t[s+e],u=X(l);for(let h=0;h<o;h++)a+=u,i[n++]=a}return i}function hv(t,e,r){let i=new BigInt64Array(r),n=0,a=0n;for(let s=0;s<e;s++){let o=Number(t[s]),l=t[s+e],u=bt(l);for(let h=0;h<o;h++)a+=u,i[n++]=a}return i}function ku(t){let e=new Uint32Array(t.length);e[0]=X(t[0])>>>0;for(let r=1;r<t.length;r++)e[r]=e[r-1]+X(t[r])>>>0;return e}function Iu(t){let e=new BigUint64Array(t.length);e[0]=BigInt.asUintN(64,bt(t[0]));for(let r=1;r<t.length;r++)e[r]=BigInt.asUintN(64,e[r-1]+bt(t[r]));return e}function cv(t){if(t.length<2)return new Uint32Array(t);let e=new Uint32Array(t.length);e[0]=X(t[0])>>>0,e[1]=X(t[1])>>>0;for(let r=2;r<t.length;r+=2)e[r]=e[r-2]+X(t[r])>>>0,e[r+1]=e[r-1]+X(t[r+1])>>>0;return e}function pv(t,e,r,i){let n=Gp(t,e,r,i);return new Uint32Array(n)}function fv(t){return t[1]}function dv(t){return X(t[1])}function yv(t){if(t.length===2){let e=X(t[1]);return[e,e]}return[X(t[2]),X(t[3])]}function mv(t){return t[1]}function gv(t){return bt(t[1])}function xv(t){if(t.length===2){let e=bt(t[1]);return[e,e]}return[bt(t[2]),bt(t[3])]}var ht;(function(t){t.PRESENT="PRESENT",t.DATA="DATA",t.OFFSET="OFFSET",t.LENGTH="LENGTH"})(ht||={});var Et;(function(t){t.NONE="NONE",t.SINGLE="SINGLE",t.SHARED="SHARED",t.VERTEX="VERTEX",t.MORTON="MORTON",t.FSST="FSST"})(Et||={});var ae;(function(t){t.VERTEX="VERTEX",t.INDEX="INDEX",t.STRING="STRING",t.KEY="KEY"})(ae||={});var yt;(function(t){t.VAR_BINARY="VAR_BINARY",t.GEOMETRIES="GEOMETRIES",t.PARTS="PARTS",t.RINGS="RINGS",t.TRIANGLES="TRIANGLES",t.SYMBOL="SYMBOL",t.DICTIONARY="DICTIONARY"})(yt||={});var vv=[ht.PRESENT,ht.DATA,ht.OFFSET,ht.LENGTH],Mu=[U.NONE,U.DELTA,U.COMPONENTWISE_DELTA,U.RLE,U.MORTON,U.PDE],bv=[Rt.NONE,Rt.FAST_PFOR,Rt.VARINT],wv=[Et.NONE,Et.SINGLE,Et.SHARED,Et.VERTEX,Et.MORTON,Et.FSST],_v=[ae.VERTEX,ae.INDEX,ae.STRING,ae.KEY],Sv=[yt.VAR_BINARY,yt.GEOMETRIES,yt.PARTS,yt.RINGS,yt.TRIANGLES,yt.SYMBOL,yt.DICTIONARY];function J(t,e){let r=Ev(t,e);return r.logicalLevelTechnique1===U.MORTON?Av(r,t,e):(U.RLE===r.logicalLevelTechnique1||U.RLE===r.logicalLevelTechnique2)&&Rt.NONE!==r.physicalLevelTechnique?Dv(r,t,e):r}function Av(t,e,r){let i=_t(e,r,2);return{physicalStreamType:t.physicalStreamType,logicalStreamType:t.logicalStreamType,logicalLevelTechnique1:t.logicalLevelTechnique1,logicalLevelTechnique2:t.logicalLevelTechnique2,physicalLevelTechnique:t.physicalLevelTechnique,numValues:t.numValues,byteLength:t.byteLength,decompressedCount:t.decompressedCount,numBits:i[0],coordinateShift:i[1]}}function Dv(t,e,r){let i=_t(e,r,2);return{physicalStreamType:t.physicalStreamType,logicalStreamType:t.logicalStreamType,logicalLevelTechnique1:t.logicalLevelTechnique1,logicalLevelTechnique2:t.logicalLevelTechnique2,physicalLevelTechnique:t.physicalLevelTechnique,numValues:t.numValues,byteLength:t.byteLength,decompressedCount:i[1],runs:i[0],numRleValues:i[1]}}function Ev(t,e){let r=t[e.get()],i=vv[r>>4],n={};switch(i){case ht.DATA:n={dictionaryType:wv[r&15]};break;case ht.OFFSET:n={offsetType:_v[r&15]};break;case ht.LENGTH:n={lengthType:Sv[r&15]}}e.increment();let a=t[e.get()],s=Mu[a>>5],o=Mu[a>>2&7],l=bv[a&3];e.increment();let u=_t(t,e,2),h=u[0],c=u[1];return{physicalStreamType:i,logicalStreamType:n,logicalLevelTechnique1:s,logicalLevelTechnique2:o,physicalLevelTechnique:l,numValues:h,byteLength:c,decompressedCount:h}}var K;(function(t){t[t.FLAT=0]="FLAT",t[t.CONST=1]="CONST",t[t.SEQUENCE=2]="SEQUENCE",t[t.DICTIONARY=3]="DICTIONARY",t[t.FSST_DICTIONARY=4]="FSST_DICTIONARY"})(K||={});var Gt=class{constructor(t,e){this.values=t,this._size=e}get(t){let e=Math.floor(t/8),r=t%8;return(this.values[e]>>r&1)==1}set(t,e){let r=Math.floor(t/8),i=t%8;this.values[r]=this.values[r]|+!!e<<i}getInt(t){let e=Math.floor(t/8),r=t%8;return this.values[e]>>r&1}size(){return this._size}getBuffer(){return this.values}};function Ue(t,e,r){if(!e)return t;let i=e.size(),n=t.constructor,a=new n(i),s=0;for(let o=0;o<i;o++)a[o]=e.get(o)?t[s++]:r;return a}function Tv(t,e,r){if(!r)return t;let i=r.size(),n=new Gt(t,e),a=new Gt(new Uint8Array(Math.ceil(i/8)),i),s=0;for(let o=0;o<i;o++){let l=r.get(o)?n.get(s++):!1;a.set(o,l)}return a.getBuffer()}function jp(t,e,r){for(let i=0;i<t;i++){let n=J(e,r);r.add(n.byteLength)}}function wr(t,e,r,i,n){let a=Fv(t,Math.ceil(e/8),r,i);return n?Tv(a,e,n):a}function Fv(t,e,r,i){let n=new Uint8Array(e),a=0,s=i.get()+r;for(;a<e&&!(i.get()>=s);){let o=t[i.increment()];if(o<=127){let l=o+3,u=t[i.increment()],h=Math.min(a+l,e);n.fill(u,a,h),a=h}else{let l=256-o;for(let u=0;u<l&&a<e;u++)n[a++]=t[i.increment()]}}return i.set(s),n}function Yp(t,e,r,i){let n=e.get(),a=n+r*Float32Array.BYTES_PER_ELEMENT,s=new Uint8Array(t.subarray(n,a)).buffer,o=new Float32Array(s);return e.set(a),i?Ue(o,i,0):o}function Xp(t,e,r,i){let n=e.get(),a=n+r*Float64Array.BYTES_PER_ELEMENT,s=new Uint8Array(t.subarray(n,a)).buffer,o=new Float64Array(s);return e.set(a),i?Ue(o,i,0):o}function kv(t,e,r){let i=e.get(),n=r*Uint32Array.BYTES_PER_ELEMENT,a=new DataView(t.buffer,t.byteOffset,t.byteLength),s=new Uint32Array(r);for(let o=0;o<r;o++)s[o]=a.getUint32(i+o*Uint32Array.BYTES_PER_ELEMENT,!0);return e.add(n),s}function Iv(t,e,r){let i=e.get(),n=r*BigUint64Array.BYTES_PER_ELEMENT,a=new DataView(t.buffer,t.byteOffset,t.byteLength),s=new BigUint64Array(r);for(let o=0;o<r;o++)s[o]=a.getBigUint64(i+o*BigUint64Array.BYTES_PER_ELEMENT,!0);return e.add(n),s}var Mv=new TextDecoder;function Lo(t,e,r){return r-e>=12?Mv.decode(t.subarray(e,r)):Cv(t,e,r)}function Cv(t,e,r){let i="",n=e;for(;n<r;){let a=t[n],s=null,o=a>239?4:a>223?3:a>191?2:1;if(n+o>r)break;let l,u,h;o===1?a<128&&(s=a):o===2?(l=t[n+1],(l&192)==128&&(s=(a&31)<<6|l&63,s<=127&&(s=null))):o===3?(l=t[n+1],u=t[n+2],(l&192)==128&&(u&192)==128&&(s=(a&15)<<12|(l&63)<<6|u&63,(s<=2047||s>=55296&&s<=57343)&&(s=null))):o===4&&(l=t[n+1],u=t[n+2],h=t[n+3],(l&192)==128&&(u&192)==128&&(h&192)==128&&(s=(a&15)<<18|(l&63)<<12|(u&63)<<6|h&63,(s<=65535||s>=1114112)&&(s=null))),s===null?(s=65533,o=1):s>65535&&(s-=65536,i+=String.fromCharCode(s>>>10&1023|55296),s=56320|s&1023),i+=String.fromCharCode(s),n+=o}return i}function fn(t,e,r,i,n){return Vv(_r(t,e,r),r,i,n)}function vt(t,e,r,i,n){return Ov(_r(t,e,r),r,i,n)}function fe(t,e,r){return $v(_r(t,e,r),r)}function _r(t,e,r){let i=r.physicalLevelTechnique;switch(i){case Rt.FAST_PFOR:return W2(t,r.numValues,r.byteLength,e);case Rt.VARINT:return _t(t,e,r.numValues);case Rt.NONE:return kv(t,e,r.numValues);default:throw Error(`Specified physicalLevelTechnique ${i} is not supported (yet).`)}}function bi(t,e,r){let i=r.physicalLevelTechnique;switch(i){case Rt.VARINT:return Po(t,e,r.numValues);case Rt.NONE:return Iv(t,e,r.numValues);default:throw Error(`Specified physicalLevelTechnique ${i} is not supported (yet).`)}}function Bv(t,e,r){let i=_r(t,e,r);return i.length===1?X(i[0]):dv(i)}function Vo(t,e,r){let i=_r(t,e,r);return i.length===1?r.logicalLevelTechnique1===U.DELTA?X(i[0]):i[0]:fv(i)}function Zp(t,e,r){return yv(_r(t,e,r))}function Wp(t,e,r){return xv(Po(t,e,r.numValues))}function Hp(t,e,r,i){return Jp(bi(t,e,r),r,i)}function Oo(t,e,r,i){return Qp(bi(t,e,r),r,i)}function Pv(t,e,r,i){let n=zv(t,e,r,!1);return i?Ue(n,i,0):n}function zv(t,e,r,i){if(r.physicalLevelTechnique===Rt.VARINT)return Rv(Y2(t,e,r.numValues),r,i);let n=bi(t,e,r),a=i?Jp(n,r):Qp(n,r);return Float64Array.from(a,Number)}function Lv(t,e,r){let i=bi(t,e,r);return i.length===1?bt(i[0]):gv(i)}function Kp(t,e,r){let i=bi(t,e,r);return i.length===1?r.logicalLevelTechnique1===U.DELTA?bt(i[0]):i[0]:mv(i)}function Vv(t,e,r,i){let n;switch(e.logicalLevelTechnique1){case U.DELTA:if(e.logicalLevelTechnique2===U.RLE){let a=e;if(!i)return uv(t,a.runs,a.numRleValues);t=Fs(t,a.runs,a.numRleValues),n=Tu(t)}else n=Tu(t);break;case U.RLE:n=ev(t,e.runs,e.numRleValues);break;case U.MORTON:zo(t),n=new Int32Array(t);break;case U.COMPONENTWISE_DELTA:if(r&&!i)return Gp(t,r.scale,r.min,r.max);n=av(t);break;case U.NONE:n=K2(t);break;default:throw Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}return i?Ue(n,i,0):n}function Ov(t,e,r,i){let n;switch(e.logicalLevelTechnique1){case U.DELTA:if(e.logicalLevelTechnique2===U.RLE){let a=e;n=ku(Fs(t,a.runs,a.numRleValues))}else n=ku(t);break;case U.RLE:n=Fs(t,e.runs,e.numRleValues);break;case U.MORTON:zo(t),n=t;break;case U.COMPONENTWISE_DELTA:n=r&&!i?pv(t,r.scale,r.min,r.max):cv(t);break;case U.NONE:n=t;break;default:throw Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}return i?Ue(n,i,0):n}function Jp(t,e,r){let i;switch(e.logicalLevelTechnique1){case U.DELTA:if(e.logicalLevelTechnique2===U.RLE){let n=e;if(!r)return hv(t,n.runs,n.numRleValues);t=ks(t,n.runs,n.numRleValues),i=Fu(t)}else i=Fu(t);break;case U.RLE:i=rv(t,e.runs,e.numRleValues);break;case U.NONE:i=J2(t);break;default:throw Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}return r?Ue(i,r,0n):i}function Qp(t,e,r){let i;switch(e.logicalLevelTechnique1){case U.DELTA:if(e.logicalLevelTechnique2===U.RLE){let n=e;i=Iu(ks(t,n.runs,n.numRleValues))}else i=Iu(t);break;case U.RLE:i=ks(t,e.runs,e.numRleValues);break;case U.NONE:i=t;break;default:throw Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}return r?Ue(i,r,0n):i}function Rv(t,e,r){switch(e.logicalLevelTechnique1){case U.DELTA:if(e.logicalLevelTechnique2===U.RLE){let i=e;t=qp(t,i.runs,i.numRleValues)}return tv(t),t;case U.RLE:return Uv(t,e,r);case U.NONE:return r&&Q2(t),t;default:throw Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}}function $v(t,e){if(e.logicalLevelTechnique1===U.DELTA&&e.logicalLevelTechnique2===U.NONE)return sv(t);if(e.logicalLevelTechnique1===U.RLE&&e.logicalLevelTechnique2===U.NONE){let r=e;return lv(t,r.runs,r.numRleValues)}if(e.logicalLevelTechnique1===U.NONE&&e.logicalLevelTechnique2===U.NONE){nv(t);let r=new Uint32Array(e.numValues+1);return r[0]=0,r.set(t,1),r}if(e.logicalLevelTechnique1===U.DELTA&&e.logicalLevelTechnique2===U.RLE){let r=e,i=ov(t,r.runs,r.numRleValues);return zo(i),new Uint32Array(i)}throw Error("Only delta encoding is supported for transforming length to offset streams yet.")}function Un(t,e,r,i,n="int32"){let a=t.logicalLevelTechnique1;if(a===U.RLE)return t.runs===1?K.CONST:K.FLAT;if(a!==U.DELTA||t.logicalLevelTechnique2!==U.RLE)return t.numValues===1?K.CONST:K.FLAT;let s=e instanceof Gt?e.size():e,o=t;if(o.numRleValues!==s)return K.FLAT;if(o.runs===1)return K.SEQUENCE;if(o.runs!==2)return t.numValues===1?K.CONST:K.FLAT;let l=i.get();if(t.physicalLevelTechnique===Rt.VARINT)return Nv(r,i,n)?K.SEQUENCE:t.numValues===1?K.CONST:K.FLAT;let u=i.get(),h=new Int32Array(r.buffer,r.byteOffset+u,4);return i.set(l),h[2]===2&&h[3]===2?K.SEQUENCE:t.numValues===1?K.CONST:K.FLAT}function Nv(t,e,r){let i=new $p(e.get());if(r==="int64"){let a=Po(t,i,4);return a[2]===2n&&a[3]===2n}let n=_t(t,i,4);return n[2]===2&&n[3]===2}function Uv(t,e,r){return r?iv(t,e.runs,e.numRleValues):qp(t,e.runs,e.numRleValues)}var tf=class extends Nn{getValueFromBuffer(t){return this.dataBuffer[t]}},ef=class extends Op{constructor(t,e,r,i,n){super(t,n?BigInt64Array.of(e):BigUint64Array.of(e),r,i)}getValueFromBuffer(t){return this.dataBuffer[0]+BigInt(t)*this.delta}};function Ro(t,e,r){return{x:Cu(t,e)-r,y:Cu(t>>1,e)-r}}function Cu(t,e){let r=0;for(let i=0;i<e;i++)r|=(t&1<<2*i)>>i;return r}var wt;(function(t){t[t.POINT=0]="POINT",t[t.LINESTRING=1]="LINESTRING",t[t.POLYGON=2]="POLYGON",t[t.MULTIPOINT=3]="MULTIPOINT",t[t.MULTILINESTRING=4]="MULTILINESTRING",t[t.MULTIPOLYGON=5]="MULTIPOLYGON"})(wt||={});var qv;(function(t){t[t.POINT=0]="POINT",t[t.LINESTRING=1]="LINESTRING",t[t.POLYGON=2]="POLYGON"})(qv||={});var qe;(function(t){t[t.MORTON=0]="MORTON",t[t.VEC_2=1]="VEC_2",t[t.VEC_3=2]="VEC_3"})(qe||={});function Gv(t){let e=Array(t.numGeometries),r=1,i=1,n=1,a=0,s=0,o=0,l=t.mortonSettings,u=t.topologyVector,h=u.geometryOffsets,c=u.partOffsets,p=u.ringOffsets,f=t.vertexOffsets,d=!f||f.length===0,y=t.containsPolygonGeometry(),m=t.vertexBuffer;for(let g=0;g<t.numGeometries;g++){let x=t.geometryType(g);switch(x){case wt.POINT:{let b,v;if(d)b=m[s++],v=m[s++];else if(t.vertexBufferType===qe.MORTON){let w=m[f[o++]],A=Ro(w,l.numBits,l.coordinateShift);b=A.x,v=A.y}else{let w=f[o++]*2;b=m[w],v=m[w+1]}e[a++]=[[new M(b,v)]],h&&n++,c&&r++,p&&i++}break;case wt.MULTIPOINT:{let b=h[n]-h[n-1];n++;let v;if(d){v=Array(b);for(let w=0;w<b;w++){let A=m[s++],S=m[s++];v[w]=new M(A,S)}}else v=De(t.vertexBufferType,m,f,o,b,!1,l),o+=b;e[a++]=v.map(w=>[w]),r+=b,i+=b}break;case wt.LINESTRING:{let b;y?(b=p[i]-p[i-1],i++):b=c[r]-c[r-1],r++;let v;d?(v=Ze(m,s,b,!1),s+=b*2):(v=De(t.vertexBufferType,m,f,o,b,!1,l),o+=b),e[a++]=[v],h&&n++}break;case wt.POLYGON:{let b=c[r]-c[r-1];r++;let v=Array(b-1),w,A=p[i]-p[i-1];if(i++,d){w=Ze(m,s,A,!0),s+=A*2;for(let S=0;S<v.length;S++)A=p[i]-p[i-1],i++,v[S]=Ze(m,s,A,!0),s+=A*2}else{w=De(t.vertexBufferType,m,f,o,A,!0,l),o+=A;for(let S=0;S<v.length;S++)A=p[i]-p[i-1],i++,v[S]=De(t.vertexBufferType,m,f,o,A,!0,l),o+=A}e[a++]=[w].concat(v),h&&n++}break;case wt.MULTILINESTRING:{let b=h[n]-h[n-1];n++;let v=Array(b);for(let w=0;w<b;w++){let A;if(y?(A=p[i]-p[i-1],i++):A=c[r]-c[r-1],r++,d)v[w]=Ze(m,s,A,!1),s+=A*2;else{let S=De(t.vertexBufferType,m,f,o,A,!1,l);v[w]=S,o+=A}}e[a++]=v}break;case wt.MULTIPOLYGON:{let b=h[n]-h[n-1];n++;let v=Array(b);for(let w=0;w<b;w++){let A=c[r]-c[r-1];r++;let S,D=Array(A-1),E=p[i]-p[i-1];i++,d?(S=Ze(m,s,E,!0),s+=E*2):(S=De(t.vertexBufferType,m,f,o,E,!0,l),o+=E);for(let L=0;L<D.length;L++){let $=p[i]-p[i-1];i++,d?(D[L]=Ze(m,s,$,!0),s+=$*2):(D[L]=De(t.vertexBufferType,m,f,o,$,!0,l),o+=$)}v[w]=[S].concat(D)}e[a++]=v.flat()}break;default:throw Error(`The specified geometry type (${x}) is currently not supported.`)}}return e}function De(t,e,r,i,n,a,s){return t===qe.MORTON?Yv(e,r,i,n,a,s):jv(e,r,i,n,a)}function Ze(t,e,r,i){let n=Array(i?r+1:r);for(let a=0;a<r*2;a+=2){let s=t[e+a],o=t[e+a+1];n[a/2]=new M(s,o)}return i&&(n[n.length-1]=n[0]),n}function jv(t,e,r,i,n){let a=Array(n?i+1:i);for(let s=0;s<i*2;s+=2){let o=e[r+s/2]*2,l=t[o],u=t[o+1];a[s/2]=new M(l,u)}return n&&(a[a.length-1]=a[0]),a}function Yv(t,e,r,i,n,a){let s=Array(n?i+1:i);for(let o=0;o<i;o++){let l=t[e[r+o]],u=Ro(l,a.numBits,a.coordinateShift);s[o]=new M(u.x,u.y)}return n&&(s[s.length-1]=s[0]),s}var rf=class{constructor(t,e,r,i,n){this._vertexBufferType=t,this._topologyVector=e,this._vertexOffsets=r,this._vertexBuffer=i,this._mortonSettings=n}get vertexBufferType(){return this._vertexBufferType}get topologyVector(){return this._topologyVector}get vertexOffsets(){return this._vertexOffsets}get vertexBuffer(){return this._vertexBuffer}getSimpleEncodedVertex(t){let e=this.vertexOffsets?this.vertexOffsets[t]*2:t*2;return[this.vertexBuffer[e],this.vertexBuffer[e+1]]}getVertex(t){if(this.vertexOffsets&&this.mortonSettings){let r=this.vertexOffsets[t],i=this.vertexBuffer[r],n=Ro(i,this.mortonSettings.numBits,this.mortonSettings.coordinateShift);return[n.x,n.y]}let e=this.vertexOffsets?this.vertexOffsets[t]*2:t*2;return[this.vertexBuffer[e],this.vertexBuffer[e+1]]}getGeometries(){return Gv(this)}get mortonSettings(){return this._mortonSettings}};function Xv(t,e,r,i,n){return new nf(t,e,qe.VEC_2,r,i,n)}function Zv(t,e,r,i,n,a){return new nf(t,e,qe.MORTON,r,i,n,a)}var nf=class extends rf{constructor(t,e,r,i,n,a,s){super(r,i,n,a,s),this._numGeometries=t,this._geometryType=e}geometryType(t){return this._geometryType}get numGeometries(){return this._numGeometries}containsPolygonGeometry(){return this._geometryType===wt.POLYGON||this._geometryType===wt.MULTIPOLYGON}containsSingleGeometryType(){return!0}};function af(t,e,r,i){return new sf(qe.VEC_2,t,e,r,i)}function Wv(t,e,r,i,n){return new sf(qe.MORTON,t,e,r,i,n)}var sf=class extends rf{constructor(t,e,r,i,n,a){super(t,r,i,n,a),this._geometryTypes=e}geometryType(t){return this._geometryTypes[t]}get numGeometries(){return this._geometryTypes.length}containsPolygonGeometry(){for(let t=0;t<this.numGeometries;t++)if(this.geometryType(t)===wt.POLYGON||this.geometryType(t)===wt.MULTIPOLYGON)return!0;return!1}containsSingleGeometryType(){return!1}},of=class{constructor(t,e,r,i){this._triangleOffsets=t,this._indexBuffer=e,this._vertexBuffer=r,this._topologyVector=i}get triangleOffsets(){return this._triangleOffsets}get indexBuffer(){return this._indexBuffer}get vertexBuffer(){return this._vertexBuffer}get topologyVector(){return this._topologyVector}getGeometries(){if(!this._topologyVector)throw Error("Cannot convert GpuVector to coordinates without topology information");let t=new Uint32Array(this.numGeometries);for(let e=0;e<this.numGeometries;e++)t[e]=this.geometryType(e);return af(t,this._topologyVector,void 0,this._vertexBuffer).getGeometries()}[Symbol.iterator](){return null}};function Bu(t,e,r,i,n,a){return new Hv(t,e,r,i,n,a)}var Hv=class extends of{constructor(t,e,r,i,n,a){super(r,i,n,a),this._numGeometries=t,this._geometryType=e}geometryType(t){return this._geometryType}get numGeometries(){return this._numGeometries}containsSingleGeometryType(){return!0}};function Pu(t,e,r,i,n){return new Kv(t,e,r,i,n)}var Kv=class extends of{constructor(t,e,r,i,n){super(e,r,i,n),this._geometryTypes=t}geometryType(t){return this._geometryTypes[t]}get numGeometries(){return this._geometryTypes.length}containsSingleGeometryType(){return!1}};function Jv(t,e,r,i,n){let a=J(t,r),s=Un(a,i,t,r),o,l,u,h;if(s===K.CONST){let b=Vo(t,r,a),v,w,A,S;for(let D=0;D<e-1;D++){let E=J(t,r);switch(E.physicalStreamType){case ht.LENGTH:switch(E.logicalStreamType.lengthType){case yt.GEOMETRIES:v=fe(t,r,E);break;case yt.PARTS:w=fe(t,r,E);break;case yt.RINGS:A=fe(t,r,E);break;case yt.TRIANGLES:S=fe(t,r,E)}break;case ht.OFFSET:switch(E.logicalStreamType.offsetType){case ae.VERTEX:o=vt(t,r,E);break;case ae.INDEX:h=vt(t,r,E)}break;case ht.DATA:if(Et.VERTEX===E.logicalStreamType.dictionaryType)l=fn(t,r,E,n);else{let L=E;u={numBits:L.numBits,coordinateShift:L.coordinateShift},l=vt(t,r,E,n)}}}return h?v!==void 0||w!==void 0?Bu(i,b,S,h,l,{geometryOffsets:v,partOffsets:w,ringOffsets:A}):Bu(i,b,S,h,l):u===void 0?Xv(i,b,{geometryOffsets:v,partOffsets:w,ringOffsets:A},o,l):Zv(i,b,{geometryOffsets:v,partOffsets:w,ringOffsets:A},o,l,u)}let c=vt(t,r,a),p,f,d,y;for(let b=0;b<e-1;b++){let v=J(t,r);switch(v.physicalStreamType){case ht.LENGTH:switch(v.logicalStreamType.lengthType){case yt.GEOMETRIES:p=vt(t,r,v);break;case yt.PARTS:f=vt(t,r,v);break;case yt.RINGS:d=vt(t,r,v);break;case yt.TRIANGLES:y=fe(t,r,v)}break;case ht.OFFSET:switch(v.logicalStreamType.offsetType){case ae.VERTEX:o=vt(t,r,v);break;case ae.INDEX:h=vt(t,r,v)}break;case ht.DATA:if(Et.VERTEX===v.logicalStreamType.dictionaryType)l=fn(t,r,v,n);else{let w=v;u={numBits:w.numBits,coordinateShift:w.coordinateShift},l=vt(t,r,v,n)}}}let m,g,x;return p?(m=ma(c,p,2),f&&d?(g=zu(c,m,f,!1),x=tb(c,m,g,d)):f&&(g=Qv(c,m,f))):f&&d?(g=ma(c,f,1),x=zu(c,g,d,!0)):f&&(g=ma(c,f,0)),h&&!g?Pu(c,y,h,l):h?Pu(c,y,h,l,{geometryOffsets:m,partOffsets:g,ringOffsets:x}):u===void 0?af(c,{geometryOffsets:m,partOffsets:g,ringOffsets:x},o,l):Wv(c,{geometryOffsets:m,partOffsets:g,ringOffsets:x},o,l,u)}function ma(t,e,r){let i=new Uint32Array(t.length+1),n=0;i[0]=n;let a=0;for(let s=0;s<t.length;s++)n=i[s+1]=n+(t[s]>r?e[a++]:1);return i}function zu(t,e,r,i){let n=new Uint32Array(e[e.length-1]+1),a=0;n[0]=a;let s=1,o=0;for(let l=0;l<t.length;l++){let u=t[l],h=e[l+1]-e[l];if(u===5||u===2||i&&(u===4||u===1))for(let c=0;c<h;c++)a=n[s++]=a+r[o++];else for(let c=0;c<h;c++)n[s++]=++a}return n}function Qv(t,e,r){let i=new Uint32Array(e[e.length-1]+1),n=0;i[0]=n;let a=1,s=0;for(let o=0;o<t.length;o++){let l=t[o],u=e[o+1]-e[o];if(l===4||l===1)for(let h=0;h<u;h++)n=i[a++]=n+r[s++];else for(let h=0;h<u;h++)i[a++]=++n}return i}function tb(t,e,r,i){let n=new Uint32Array(r[r.length-1]+1),a=0;n[0]=a;let s=1,o=1,l=0;for(let u=0;u<t.length;u++){let h=t[u],c=e[u+1]-e[u];if(h!==0&&h!==3)for(let p=0;p<c;p++){let f=r[s]-r[s-1];s++;for(let d=0;d<f;d++)a=n[o++]=a+i[l++]}else for(let p=0;p<c;p++)n[o++]=++a,s++}return n}var eb=class extends Ne{constructor(t,e,r){super(t,e.getBuffer(),r),this.dataVector=e}getValueFromBuffer(t){return this.dataVector.get(t)}},rb=class extends Nn{getValueFromBuffer(t){return this.dataBuffer[t]}},lf=class extends Ne{constructor(t,e,r,i){super(t,i?BigInt64Array.of(e):BigUint64Array.of(e),r)}getValueFromBuffer(t){return this.dataBuffer[0]}},$o=class extends Ne{constructor(t,e,r,i){super(t,r,i),this.offsetBuffer=e}},Lu=class extends $o{constructor(t,e,r,i){super(t,e,r,i??e.length-1)}getValueFromBuffer(t){let e=this.offsetBuffer[t],r=this.offsetBuffer[t+1];return Lo(this.dataBuffer,e,r)}},lr=class extends $o{constructor(t,e,r,i,n){super(t,r,i,n??e.length),this.indexBuffer=e,this.indexBuffer=e}getValueFromBuffer(t){let e=this.indexBuffer[t],r=this.offsetBuffer[e],i=this.offsetBuffer[e+1];return Lo(this.dataBuffer,r,i)}};function ib(t,e){let r=0;for(let i=0;i<e.length;i++){let n=e[i];n===255?(r++,i++):r+=t[n]}return r}function nb(t,e,r){let i=new Uint32Array(e.length);for(let s=1;s<e.length;s++)i[s]=i[s-1]+e[s-1];let n=new Uint8Array(ib(e,r)),a=0;for(let s=0;s<r.length;s++){let o=r[s];if(o===255)s++,n[a++]=r[s];else{let l=e[o],u=i[o];for(;l-- >0;)n[a++]=t[u++]}}return n}var uf=class extends $o{constructor(t,e,r,i,n,a,s,o){super(t,r,i,s??e.length),this.indexBuffer=e,this.symbolOffsetBuffer=n,this.symbolTableBuffer=a,this.sharedDictionaryCache=o}getValueFromBuffer(t){this.decodedDictionary??(this.decodedDictionary=this.sharedDictionaryCache?.decodedDictionary,this.decodedDictionary??(this.decodedDictionary=this.decodeDictionary(),this.sharedDictionaryCache&&(this.sharedDictionaryCache.decodedDictionary=this.decodedDictionary)));let e=this.indexBuffer[t],r=this.offsetBuffer[e],i=this.offsetBuffer[e+1];return Lo(this.decodedDictionary,r,i)}decodeDictionary(){return this.symbolLengthBuffer??=this.offsetToLengthBuffer(this.symbolOffsetBuffer),nb(this.symbolTableBuffer,this.symbolLengthBuffer,this.dataBuffer)}offsetToLengthBuffer(t){let e=new Uint32Array(t.length-1),r=t[0];for(let i=1;i<t.length;i++){let n=t[i];e[i-1]=n-r,r=n}return e}};function hf(t,e,r,i,n){let a,s,o,l,u,h=n,c,p;for(let f=0;f<i;f++){let d=J(e,r);switch(d.physicalStreamType){case ht.PRESENT:{let y=new Gt(wr(e,d.numValues,d.byteLength,r),d.numValues);h=n??y;break}case ht.OFFSET:s=vt(e,r,d,void 0,h);break;case ht.LENGTH:{let y=fe(e,r,d);yt.DICTIONARY===d.logicalStreamType.lengthType?a=y:yt.SYMBOL===d.logicalStreamType.lengthType?l=y:c=y;break}case ht.DATA:{let y=e.subarray(r.get(),r.get()+d.byteLength);r.add(d.byteLength);let m=d.logicalStreamType.dictionaryType;Et.FSST===m?u=y:Et.SINGLE===m||Et.SHARED===m?o=y:Et.NONE===m&&(p=y);break}}}return ab(t,u,s,a,o,l,h)??sb(t,o,s,a,h)??ob(t,c,p,s,h)}function ab(t,e,r,i,n,a,s){if(e){if(!r||!i||!n||!a)throw Error(`Incomplete FSST dictionary string column "${t}"`);return new uf(t,r,i,n,a,e,s)}}function sb(t,e,r,i,n){if(e){if(!r||!i)throw Error(`Incomplete dictionary string column "${t}"`);return n?new lr(t,r,i,e,n):new lr(t,r,i,e)}}function ob(t,e,r,i,n){if(!(!e||!r)){if(i)return n?new lr(t,i,e,r,n):new lr(t,i,e,r);if(n&&n.size()!==e.length-1){let a=new Uint32Array(n.size()),s=0;for(let o=0;o<n.size();o++)n.get(o)?a[o]=s++:a[o]=0;return new lr(t,a,e,r,n)}return n?new Lu(t,e,r,n):new Lu(t,e,r)}}function lb(t,e,r,i){let n,a,s,o,l=!1;for(;!l;){let f=J(t,e);switch(f.physicalStreamType){case ht.LENGTH:yt.DICTIONARY===f.logicalStreamType.lengthType?n=fe(t,e,f):s=fe(t,e,f);break;case ht.DATA:Et.SINGLE===f.logicalStreamType.dictionaryType||Et.SHARED===f.logicalStreamType.dictionaryType?(a=t.subarray(e.get(),e.get()+f.byteLength),l=!0):o=t.subarray(e.get(),e.get()+f.byteLength),e.add(f.byteLength)}}if(r.type!=="complexType")throw Error(`Shared dictionary column ${r.name} must be a complex (struct) column.`);if(!n||!a)throw Error(`Incomplete shared dictionary for column "${r.name}"`);let u=r.complexType.children,h=[],c=o?{}:void 0,p=0;for(let f of u){let d=_t(t,e,1)[0];if(d===0)continue;let y=f.name?`${r.name}${f.name}`:r.name;if(i&&!i.has(y)){jp(d,t,e);continue}if(f.type!=="scalarField"||f.scalarField.physicalType!==Z.STRING)throw Error("Currently only scalar string fields are implemented for a struct.");if(d>1&&!f.nullable||d===1&&f.nullable)throw Error(`The number of streams for the child field ${f.name} does not match its nullability. nullibilty: ${f.nullable}, numStreams: ${d}`);let m;if(f.nullable){let x=J(t,e);m=new Gt(wr(t,x.numValues,x.byteLength,e),x.numValues)}let g=vt(t,e,J(t,e),void 0,m);if(o){if(!s)throw Error(`Incomplete shared FSST dictionary for column "${y}"`);h[p++]=new uf(y,g,n,a,s,o,m,c)}else h[p++]=new lr(y,g,n,a,m)}return h}var Vu=class extends Ne{constructor(t,e,r){super(t,new Uint8Array,r??e.length),this.values=e}getValueFromBuffer(t){return this.values[t]}},se;(function(t){t[t.STRING=1]="STRING",t[t.INT32=2]="INT32",t[t.UINT32=4]="UINT32",t[t.INT64=8]="INT64",t[t.UINT64=16]="UINT64",t[t.FLOAT=32]="FLOAT",t[t.DOUBLE=64]="DOUBLE",t[t.PRESENCE=128]="PRESENCE"})(se||={});var ke;(function(t){t[t.FALSE=0]="FALSE",t[t.TRUE=1]="TRUE",t[t.START_MAP=2]="START_MAP",t[t.START_LIST=3]="START_LIST",t[t.COUNT=4]="COUNT"})(ke||={});function ub(t,e,r,i){let n=hb(r);if(i===0)return n.map(h=>new Vu(h,[]));let a=cb(t,e,i),s=(a.presentStream?a.presentCount:a.lengthStream.length)/n.length,o=[],l=0,u=0;for(let h=0;h<n.length;h++){let c=mb(a,h,s,l,u);o.push(new Vu(n[h],c.value,c.nullabilityBuffer)),l=c.countsEnd,u=c.valuesEnd}return o}function hb(t){let e=t.type==="complexType"?t.complexType.children:void 0;return!e||e.length===0?[t.name]:e.map(r=>t.name+(r.name??""))}function cb(t,e,r){let i=t[e.get()];e.add(1);let n=vt(t,e,J(t,e)),a=r-1,s=[];i&se.STRING&&(a-=pb(t,e,s)),a-=fb(t,e,i,s),a-=db(t,e,i,s);let o,l=0;if(i&se.PRESENCE){let h=yb(t,e);o=h.value,l=h.count,a--}let u=new Uint32Array;if(a>0&&(u=vt(t,e,J(t,e)),a--),a!==0)throw Error(`Unexpected number of remaining streams while decoding map column: ${a}`);return{lengthStream:n,dictionary:s,presentStream:o,presentCount:l,flattenedValues:u}}function pb(t,e,r){let i=t[e.get()];e.add(1);let n=hf("",t,e,i);if(n)for(let a=0;a<n.size;a++)r.push(n.getValue(a));return i}function fb(t,e,r,i){let n=0;return r&se.INT32?(rr(i,fn(t,e,J(t,e))),n++):r&se.INT64&&(rr(i,Hp(t,e,J(t,e))),n++),r&se.UINT32?(rr(i,vt(t,e,J(t,e))),n++):r&se.UINT64&&(rr(i,Oo(t,e,J(t,e))),n++),n}function db(t,e,r,i){let n=0;return r&se.FLOAT&&(rr(i,Yp(t,e,J(t,e).numValues)),n++),r&se.DOUBLE&&(rr(i,Xp(t,e,J(t,e).numValues)),n++),n}function yb(t,e){let r=J(t,e);if(r.physicalStreamType!==ht.PRESENT)throw Error(`Expected PRESENT stream for map column but found: ${r.physicalStreamType}`);let i=r.numValues,n=e.get(),a=new Gt(wr(t,i,r.byteLength,e),i);return e.set(n+r.byteLength),{value:a,count:i}}function mb(t,e,r,i,n){let{lengthStream:a,flattenedValues:s,presentStream:o,dictionary:l}=t,u=e*r,h=r,c;if(o){c=new Gt(new Uint8Array(Math.ceil(r/8)),r),h=0;for(let x=0;x<r;x++)o.get(u+x)&&(c.set(x,!0),h++)}let p=i+h;if(p>a.length)throw Error("Merged map counts underflow while decoding child streams");let f=Array(r),d=i,y=n;for(let x=0;x<r;x++){if(o&&!o.get(u+x)){f[x]=null;continue}let b=y+a[d++];if(b>s.length)throw Error("Map value stream underflow while decoding feature payload");let v=gb(s,y,b,l);f[x]=v.value,y=v.nextIndex}let m=0;for(let x=i;x<p;x++)m+=a[x];let g=n+m;if(y!==g)throw Error("Unused flattened map values remain after decode");return{value:f,nullabilityBuffer:c,countsEnd:p,valuesEnd:g}}function gb(t,e,r,i){return r-e===1||t[e]===ke.START_LIST?No(t,e,r,i):cf(t,e,r,i)}function cf(t,e,r,i){let n=Object.create(null),a=e;for(;a<r;){let s=pf(t[a++],i);if(typeof s!="string")throw Error(`Map key dictionary index does not resolve to a string: ${s}`);let o=No(t,a,r,i);n[s]=o.value,a=o.nextIndex}return{value:n,nextIndex:a}}function No(t,e,r,i){if(e>=r)throw Error("Unexpected end of map value stream");let n=t[e];if(n===ke.FALSE)return{value:!1,nextIndex:e+1};if(n===ke.TRUE)return{value:!0,nextIndex:e+1};if(n===ke.START_MAP){let a=Ou(t,e,r);return{value:cf(t,e+2,a,i).value,nextIndex:a}}if(n===ke.START_LIST){let a=Ou(t,e,r),s=[],o=e+2;for(;o<a;){let l=No(t,o,a,i);s.push(l.value),o=l.nextIndex}return{value:s,nextIndex:a}}return{value:pf(n,i),nextIndex:e+1}}function Ou(t,e,r){if(e+1>=r)throw Error("Missing length for nested map/list payload");let i=t[e+1];if(i<2)throw Error(`Invalid nested payload length: ${i}`);let n=e+i;if(n>r)throw Error("Nested payload exceeds containing payload bounds");return n}function pf(t,e){let r=t-ke.COUNT;if(r<0||r>=e.length)throw Error(`Scalar dictionary index out of range: ${t}`);return e[r]}function rr(t,e){for(let r of e)t.push(r)}function xb(t,e,r,i,n,a){return r.type==="scalarType"?a&&!a.has(r.name)?(jp(i,t,e),null):vb(i,t,e,n,r.scalarType,r):r.complexType?.physicalType===ge.MAP?ub(t,e,r,i):i===0?null:lb(t,e,r,a)}function vb(t,e,r,i,n,a){let s;if(t===0)return null;if(a.nullable){let l=J(e,r),u=l.numValues,h=r.get(),c=wr(e,u,l.byteLength,r);r.set(h+l.byteLength),s=new Gt(c,l.numValues)}let o=s??i;switch(n.physicalType){case Z.UINT_32:case Z.INT_32:return Ab(e,r,a,n,o);case Z.STRING:{let l=a.nullable?t-1:t;return hf(a.name,e,r,l,s)??null}case Z.BOOLEAN:return bb(e,r,a,i,o);case Z.UINT_64:case Z.INT_64:return Sb(e,r,a,o,n);case Z.FLOAT:return wb(e,r,a,o);case Z.DOUBLE:return _b(e,r,a,o);default:throw Error(`The specified data type for the field is currently not supported: ${n}`)}}function bb(t,e,r,i,n){let a=J(t,e),s=a.numValues,o=e.get(),l=wi(n)?n:void 0,u=wr(t,s,a.byteLength,e,l);e.set(o+a.byteLength);let h=new Gt(u,s);return new eb(r.name,h,n)}function wb(t,e,r,i){let n=J(t,e),a=wi(i)?i:void 0,s=Yp(t,e,n.numValues,a);return new rb(r.name,s,i)}function _b(t,e,r,i){let n=J(t,e),a=wi(i)?i:void 0,s=Xp(t,e,n.numValues,a);return new ko(r.name,s,i)}function Sb(t,e,r,i,n){let a=J(t,e),s=Un(a,i,t,e,"int64"),o=n.physicalType===Z.INT_64;if(s===K.FLAT){let u=wi(i)?i:void 0,h=o?Hp(t,e,a,u):Oo(t,e,a,u);return new tf(r.name,h,i)}if(s===K.SEQUENCE){let u=Wp(t,e,a);return new ef(r.name,u[0],u[1],a.numRleValues,o)}let l=o?Lv(t,e,a):Kp(t,e,a);return new lf(r.name,l,i,o)}function Ab(t,e,r,i,n){let a=J(t,e),s=Un(a,n,t,e),o=i.physicalType===Z.INT_32;if(s===K.FLAT){let u=wi(n)?n:void 0,h=o?fn(t,e,a,void 0,u):vt(t,e,a,void 0,u);return new Fo(r.name,h,n)}if(s===K.SEQUENCE){let u=Zp(t,e,a);return new Io(r.name,u[0],u[1],a.numRleValues,o)}let l=o?Bv(t,e,a):Vo(t,e,a);return new Mo(r.name,l,n,o)}function wi(t){return t instanceof Gt}var dt={ID:0,ID_NULLABLE:1,ID_LONG:2,GEOMETRY:4,SCALAR_BASE:10,STRUCT:30,MAP:31};function ff(t){switch(t){case dt.ID:case dt.ID|dt.ID_NULLABLE:case dt.ID|dt.ID_LONG:case dt.ID|dt.ID_LONG|dt.ID_NULLABLE:return{nullable:(t&dt.ID_NULLABLE)!==0,columnScope:Nr.FEATURE,type:"scalarType",scalarType:{longID:(t&dt.ID_LONG)!==0,type:"logicalType",logicalType:Rp.ID}};case dt.GEOMETRY:return{nullable:!1,columnScope:Nr.FEATURE,type:"complexType",complexType:{type:"physicalType",physicalType:ge.GEOMETRY,children:[]}};case dt.STRUCT:return{nullable:!1,columnScope:Nr.FEATURE,type:"complexType",complexType:{type:"physicalType",physicalType:ge.STRUCT,children:[]}};case dt.MAP:return{nullable:!0,columnScope:Nr.FEATURE,type:"complexType",complexType:{type:"physicalType",physicalType:ge.MAP,children:[]}};default:return kb(t)}}function Db(t){return t>=dt.SCALAR_BASE}function df(t){return t===dt.STRUCT||t===dt.MAP}function Eb(t){if(t.type==="scalarType"){let e=t.scalarType;if(e.type==="physicalType")switch(e.physicalType){case Z.BOOLEAN:case Z.INT_8:case Z.UINT_8:case Z.INT_32:case Z.UINT_32:case Z.INT_64:case Z.UINT_64:case Z.FLOAT:case Z.DOUBLE:return!1;case Z.STRING:return!0;default:return!1}if(e.type==="logicalType")return!1}else if(t.type==="complexType"){let e=t.complexType;if(e.type==="physicalType")switch(e.physicalType){case ge.GEOMETRY:case ge.STRUCT:case ge.MAP:return!0;default:return!1}}return console.warn("Unexpected column type in hasStreamCount",t),!1}function Tb(t){return t.type==="scalarType"&&t.scalarType?.type==="logicalType"&&t.scalarType.logicalType===Rp.ID}function Fb(t){return t.type==="complexType"&&t.complexType?.type==="physicalType"&&t.complexType.physicalType===ge.GEOMETRY}function kb(t){let e;switch(t){case 10:case 11:e=Z.BOOLEAN;break;case 12:case 13:e=Z.INT_8;break;case 14:case 15:e=Z.UINT_8;break;case 16:case 17:e=Z.INT_32;break;case 18:case 19:e=Z.UINT_32;break;case 20:case 21:e=Z.INT_64;break;case 22:case 23:e=Z.UINT_64;break;case 24:case 25:e=Z.FLOAT;break;case 26:case 27:e=Z.DOUBLE;break;case 28:case 29:e=Z.STRING;break;default:return null}return{nullable:!!(t&1),columnScope:Nr.FEATURE,type:"scalarType",scalarType:{longID:!1,type:"physicalType",physicalType:e}}}var Ib=new TextDecoder,Ru="0-3(ID), 4(GEOMETRY), 10-29(scalars), 30(STRUCT), 31(MAP)";function Uo(t,e){let r=_t(t,e,1)[0];if(r===0)return"";let i=e.get(),n=i+r,a=t.subarray(i,n);return e.add(r),Ib.decode(a)}function Mb(t){let e=t.name,r=t.nullable;return t.type==="scalarType"?{type:"scalarField",scalarField:t.scalarType,name:e,nullable:r}:{type:"complexField",complexField:t.complexType,name:e,nullable:r}}function yf(t,e){let r=_t(t,e,1)[0]>>>0,i=r>=dt.SCALAR_BASE?ff(r):null;if(!i)throw Error(`Unsupported field type code ${r}. Supported: 10-29(scalars), 30(STRUCT), 31(MAP)`);let n={...i,name:Uo(t,e)};if(n.type==="complexType"&&df(r)){let a=n.complexType,s=_t(t,e,1)[0]>>>0;a.children=Array(s);for(let o=0;o<s;o++)a.children[o]=yf(t,e)}return Mb(n)}function Cb(t,e){let r=_t(t,e,1)[0]>>>0,i=ff(r);if(!i)throw Error(`Unsupported column type code ${r}. Supported: ${Ru}`);let n;if(Db(r))n=Uo(t,e);else if(r<dt.GEOMETRY)n="id";else if(r===dt.GEOMETRY)n="geometry";else throw Error(`Unsupported column type code ${r}. Supported: ${Ru}`);let a={...i,name:n};if(a.type==="complexType"&&df(r)){let s=_t(t,e,1)[0]>>>0,o=a.complexType;o.children=Array(s);for(let l=0;l<s;l++)o.children[l]=yf(t,e)}return a}function Bb(t,e){let r={};r.featureTables=[];let i={};if(i.name=Uo(t,e),i.name.length===0)throw Error("Missing layer name");let n=_t(t,e,1)[0]>>>0,a=_t(t,e,1)[0]>>>0;i.columns=Array(a);for(let s=0;s<a;s++)i.columns[s]=Cb(t,e);return r.featureTables.push(i),[r,n]}function Pb(t,e,r=!0){let i=new $p(0),n=[];for(;i.get()<t.length;){let a=_t(t,i,1)[0]>>>0,s=i.get()+a;if(s>t.length)throw Error(`Block overruns tile: ${s} > ${t.length}`);let o=_t(t,i,1)[0]>>>0;if(o!==1&&o!==2){i.set(s);continue}let[l,u]=Bb(t,i),h=l.featureTables[0],c=null,p=null,f=[],d=0;for(let m of h.columns){let g=m.name;if(Tb(m)){let x=null;if(m.nullable){let v=J(t,i),w=i.get(),A=wr(t,v.numValues,v.byteLength,i);i.set(w+v.byteLength),x=new Gt(A,v.numValues)}let b=J(t,i);d=x?x.size():b.decompressedCount,c=zb(t,m,i,g,b,x??d,r)}else if(Fb(m)){let x=_t(t,i,1)[0];if(d===0){let b=i.get();d=J(t,i).decompressedCount,i.set(b)}e&&(e.scale=e.extent/u),p=Jv(t,x,i,d,e)}else{let x=Eb(m)?_t(t,i,1)[0]:1;if(x===0)continue;let b=xb(t,i,m,x,d,void 0);if(b)if(Array.isArray(b))for(let v of b)f.push(v);else f.push(b)}}let y=new i2(h.name,p,c,f,u);n.push(y),i.set(s)}return n}function zb(t,e,r,i,n,a,s=!1){let o=e.scalarType?.longID?Z.UINT_64:Z.UINT_32,l=typeof a=="number"?void 0:a,u=Un(n,a,t,r,o===Z.UINT_64?"int64":"int32");if(o===Z.UINT_32)switch(u){case K.FLAT:return new Fo(i,vt(t,r,n,void 0,l),a);case K.SEQUENCE:{let h=Zp(t,r,n);return new Io(i,h[0],h[1],n.numRleValues,!1)}case K.CONST:return new Mo(i,Vo(t,r,n),a,!1)}switch(u){case K.FLAT:return s?new ko(i,Pv(t,r,n,l),a):new tf(i,Oo(t,r,n,l),a);case K.SEQUENCE:{let h=Wp(t,r,n);return new ef(i,h[0],h[1],n.numRleValues,!1)}case K.CONST:return new lf(i,Kp(t,r,n),a,!1)}throw Error("Vector type not supported for id column.")}var Lb=class{constructor(t,e){switch(this._featureData=t,this.properties=this._featureData.properties||{},this._featureData.geometry?.type){case wt.POINT:case wt.MULTIPOINT:this.type=1;break;case wt.LINESTRING:case wt.MULTILINESTRING:this.type=2;break;case wt.POLYGON:case wt.MULTIPOLYGON:this.type=3;break;default:this.type=0}this.extent=e,this.id=Number(this._featureData.id)}loadGeometry(){let t=[];for(let e of this._featureData.geometry.coordinates){let r=[];for(let i of e)r.push(new M(i.x,i.y));t.push(r)}return t}},Vb=class{constructor(t){this.features=[],this.featureTable=t,this.name=t.name,this.extent=t.extent,this.version=2,this.features=t.getFeatures(),this.length=this.features.length}feature(t){return new Lb(this.features[t],this.extent)}},qo=class{constructor(t){this.layers={};let e=Pb(new Uint8Array(t));this.layers=e.reduce((r,i)=>({...r,[i.name]:new Vb(i)}),{})}},Go=class{constructor(t,e){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new ka(it,16,0),this.grid3D=new ka(it,16,0),this.featureIndexArray=new $c,this.promoteId=e}insert(t,e,r,i,n,a){let s=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(r,i,n);let o=a?this.grid3D:this.grid;for(let l of e){let u=[1/0,1/0,-1/0,-1/0];for(let h of l)u[0]=Math.min(u[0],h.x),u[1]=Math.min(u[1],h.y),u[2]=Math.max(u[2],h.x),u[3]=Math.max(u[3],h.y);u[0]<8192&&u[1]<8192&&u[2]>=0&&u[3]>=0&&o.insert(s,u[0],u[1],u[2],u[3])}}loadVTLayers(){if(!this.vtLayers){switch(this.encoding){case"mlt":this.vtLayers=new qo(this.rawTileData).layers;break;default:this.vtLayers=new ho(new _o(this.rawTileData)).layers}this.sourceLayerCoder=new To(this.vtLayers?Object.keys(this.vtLayers).sort():[Ds])}return this.vtLayers}query(t,e,r,i){this.loadVTLayers();let n=t.params,a=it/t.tileSize/t.scale,s=yr(n.filter,"queryRenderedFeatures filter",n.globalState),o=t.queryGeometry,l=t.queryPadding*a,u=cn.fromPoints(o),h=this.grid.query(u.minX-l,u.minY-l,u.maxX+l,u.maxY+l),c=cn.fromPoints(t.cameraQueryGeometry).expandBy(l),p=this.grid3D.query(c.minX,c.minY,c.maxX,c.maxY,(y,m,g,x)=>o0(t.cameraQueryGeometry,y-l,m-l,g+l,x+l));for(let y of p)h.push(y);h.sort(Rb);let f={},d;for(let y of h){if(y===d)continue;d=y;let m=this.featureIndexArray.get(y),g=null;this.loadMatchingFeature(f,m.bucketIndex,m.sourceLayerIndex,m.featureIndex,s,n.layers,n.availableImages,e,r,i,(x,b,v)=>(g||=$e(x),b.queryIntersectsFeature({queryGeometry:o,feature:x,featureState:v,geometry:g,zoom:this.z,transform:t.transform,pixelsToTileUnits:a,pixelPosMatrix:t.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:t.getElevation})))}return f}loadMatchingFeature(t,e,r,i,n,a,s,o,l,u,h){let c=this.bucketLayerIDs[e];if(a&&!c.some(y=>a.has(y)))return;let p=this.sourceLayerCoder.decode(r),f=this.vtLayers[p].feature(i);if(n.needGeometry){let y=br(f,!0);if(!n.filter(new H(this.tileID.overscaledZ),y,this.tileID.canonical))return}else if(!n.filter(new H(this.tileID.overscaledZ),f))return;let d=this.getId(f,p);for(let y of c){if(a&&!a.has(y))continue;let m=o[y];if(!m)continue;let g={};d&&u&&(g=u.getState(m.sourceLayer||"_geojsonTileLayer",d));let x=Tt({},l[y]);x.paint=$u(x.paint,m.paint,f,g,s),x.layout=$u(x.layout,m.layout,f,g,s);let b=!h||h(f,m,g);if(!b)continue;let v=new r2(f,this.z,this.x,this.y,d);v.layer=x;let w=t[y];w===void 0&&(w=t[y]=[]),w.push({featureIndex:i,feature:v,intersectionZ:b})}}lookupSymbolFeatures(t,e,r,i,n,a,s,o){let l={};this.loadVTLayers();let u=yr(n.filterSpec,"queryRenderedFeatures symbol filter",n.globalState);for(let h of t)this.loadMatchingFeature(l,r,i,h,u,a,s,o,e);return l}hasLayer(t){for(let e of this.bucketLayerIDs)for(let r of e)if(t===r)return!0;return!1}getId(t,e){let r=t.id;if(this.promoteId){let i=typeof this.promoteId=="string"?this.promoteId:this.promoteId[e];r=t.properties[i],typeof r=="boolean"&&(r=Number(r)),r===void 0&&t.properties?.cluster&&this.promoteId&&(r=Number(t.properties.cluster_id))}return r}};I("FeatureIndex",Go,{omit:["rawTileData","sourceLayerCoder"]});function Ob(t){return typeof t=="object"&&!!t&&"evaluate"in t}function $u(t,e,r,i,n){return dn(t,(a,s)=>{let o=e instanceof Cn?e.get(s):null;return Ob(o)?o.evaluate(r,i,void 0,n):o})}function Rb(t,e){return e-t}var mf=class{constructor(t){this.maxEntries=t,this.map=new Map}get(t){let e=this.map.get(t);return e!==void 0&&(this.map.delete(t),this.map.set(t,e)),e}set(t,e){if(this.map.has(t))this.map.delete(t);else if(this.map.size>=this.maxEntries){let r=this.map.keys().next().value;this.map.delete(r)}this.map.set(t,e)}clear(){this.map.clear()}};function $b(t,e,r,i,n){let a=[];for(let s of t){let o;for(let l=0;l<s.length-1;l++){let u=s[l],h=s[l+1];u.x<e&&h.x<e||(u.x<e?u=new M(e,u.y+(h.y-u.y)*((e-u.x)/(h.x-u.x)))._round():h.x<e&&(h=new M(e,u.y+(h.y-u.y)*((e-u.x)/(h.x-u.x)))._round()),!(u.y<r&&h.y<r)&&(u.y<r?u=new M(u.x+(h.x-u.x)*((r-u.y)/(h.y-u.y)),r)._round():h.y<r&&(h=new M(u.x+(h.x-u.x)*((r-u.y)/(h.y-u.y)),r)._round()),!(u.x>=i&&h.x>=i)&&(u.x>=i?u=new M(i,u.y+(h.y-u.y)*((i-u.x)/(h.x-u.x)))._round():h.x>=i&&(h=new M(i,u.y+(h.y-u.y)*((i-u.x)/(h.x-u.x)))._round()),!(u.y>=n&&h.y>=n)&&(u.y>=n?u=new M(u.x+(h.x-u.x)*((n-u.y)/(h.y-u.y)),n)._round():h.y>=n&&(h=new M(u.x+(h.x-u.x)*((n-u.y)/(h.y-u.y)),n)._round()),(!o||!u.equals(o[o.length-1]))&&(o=[u],a.push(o)),o.push(h)))))}}return a}function gf(t,e,r,i,n,a){let s=Nu(t,e,r,n,0);return s=Nu(s,e,i,a,1),s}function Nu(t,e,r,i,n){switch(e){case 1:return Nb(t,r,i,n);case 2:return Uu(t,r,i,n,!1);case 3:return Uu(t,r,i,n,!0)}return[]}function Nb(t,e,r,i){let n=[];for(let a of t)for(let s of a){let o=i===0?s.x:s.y;o>=e&&o<=r&&n.push([s])}return n}function Ub(t,e,r,i,n){let a=i===0?qb:Gb,s=[],o=[];for(let h=0;h<t.length-1;h++){let c=t[h],p=t[h+1],f=i===0?c.x:c.y,d=i===0?p.x:p.y,y=!1;f<e?d>e&&s.push(a(c,p,e)):f>r?d<r&&s.push(a(c,p,r)):s.push(c),d<e&&f>=e&&(s.push(a(c,p,e)),y=!0),d>r&&f<=r&&(s.push(a(c,p,r)),y=!0),!n&&y&&(o.push(s),s=[])}let l=t.length-1,u=i===0?t[l].x:t[l].y;return u>=e&&u<=r&&s.push(t[l]),n&&s.length>0&&!s[0].equals(s[s.length-1])&&s.push(new M(s[0].x,s[0].y)),s.length>0&&o.push(s),o}function Uu(t,e,r,i,n){let a=[];for(let s of t){let o=Ub(s,e,r,i,n);o.length>0&&a.push(...o)}return a}function qb(t,e,r){let i=(r-t.x)/(e.x-t.x);return new M(r,t.y+(e.y-t.y)*i)}function Gb(t,e,r){let i=(r-t.y)/(e.y-t.y);return new M(t.x+(e.x-t.x)*i,r)}var ur=class xf extends M{constructor(e,r,i,n){super(e,r),this.angle=i,n!==void 0&&(this.segment=n)}clone(){return new xf(this.x,this.y,this.angle,this.segment)}};I("Anchor",ur);function vf(t,e,r,i,n){if(e.segment===void 0||r===0)return!0;let a=e,s=e.segment+1,o=0;for(;o>-r/2;){if(s--,s<0)return!1;o-=t[s].dist(a),a=t[s]}o+=t[s].dist(t[s+1]),s++;let l=[],u=0;for(;o<r/2;){let h=t[s-1],c=t[s],p=t[s+1];if(!p)return!1;let f=h.angleTo(c)-c.angleTo(p);for(f=Math.abs((f+3*Math.PI)%(Math.PI*2)-Math.PI),l.push({distance:o,angleDelta:f}),u+=f;o-l[0].distance>i;)u-=l.shift().angleDelta;if(u>n)return!1;s++,o+=c.dist(p)}return!0}function bf(t){let e=0;for(let r=0;r<t.length-1;r++)e+=t[r].dist(t[r+1]);return e}function wf(t,e,r){return t?3/5*e*r:0}function _f(t,e){return Math.max(t?t.right-t.left:0,e?e.right-e.left:0)}function jb(t,e,r,i,n,a){let s=wf(r,n,a),o=_f(r,i)*a,l=0,u=bf(t)/2;for(let h=0;h<t.length-1;h++){let c=t[h],p=t[h+1],f=c.dist(p);if(l+f>u){let d=(u-l)/f,y=new ur(Pe.number(c.x,p.x,d),Pe.number(c.y,p.y,d),p.angleTo(c),h);return y._round(),!s||vf(t,y,o,s,e)?y:void 0}l+=f}}function Yb(t,e,r,i,n,a,s,o,l){let u=wf(i,a,s),h=_f(i,n),c=h*s,p=t[0].x===0||t[0].x===l||t[0].y===0||t[0].y===l;e-c<e/4&&(e=c+e/4);let f=a*2;return Sf(t,p?e/2*o%e:(h/2+f)*s*o%e,e,u,r,c,p,!1,l)}function Sf(t,e,r,i,n,a,s,o,l){let u=a/2,h=bf(t),c=0,p=e-r,f=[];for(let d=0;d<t.length-1;d++){let y=t[d],m=t[d+1],g=y.dist(m),x=m.angleTo(y);for(;p+r<c+g;){p+=r;let b=(p-c)/g,v=Pe.number(y.x,m.x,b),w=Pe.number(y.y,m.y,b);if(v>=0&&v<l&&w>=0&&w<l&&p-u>=0&&p+u<=h){let A=new ur(v,w,x,d);A._round(),(!i||vf(t,A,a,i,n))&&f.push(A)}}c+=g}return!o&&!f.length&&!s&&(f=Sf(t,c/2,r,i,n,a,s,!0,l)),f}function qu(t,e,r,i){let n=[],a=t.image,s=a.pixelRatio,o=a.paddedRect.w-2,l=a.paddedRect.h-2,u={x1:t.left,y1:t.top,x2:t.right,y2:t.bottom},h=a.stretchX||[[0,o]],c=a.stretchY||[[0,l]],p=(F,V)=>F+V[1]-V[0],f=h.reduce(p,0),d=c.reduce(p,0),y=o-f,m=l-d,g=0,x=f,b=0,v=d,w=0,A=y,S=0,D=m;if(a.content&&i){let F=a.content,V=F[2]-F[0],R=F[3]-F[1];(a.textFitWidth||a.textFitHeight)&&(u=Mp(t)),g=$i(h,0,F[0]),b=$i(c,0,F[1]),x=$i(h,F[0],F[2]),v=$i(c,F[1],F[3]),w=F[0]-g,S=F[1]-b,A=V-x,D=R-v}let E=u.x1,L=u.y1,$=u.x2-E,P=u.y2-L,z=(F,V,R,B)=>{let G=Ni(F.stretch-g,x,$,E),W=Ui(F.fixed-w,A,F.stretch,f),ft=Ni(V.stretch-b,v,P,L),tt=Ui(V.fixed-S,D,V.stretch,d),ct=Ni(R.stretch-g,x,$,E),$t=Ui(R.fixed-w,A,R.stretch,f),Ge=Ni(B.stretch-b,v,P,L),be=Ui(B.fixed-S,D,B.stretch,d),je=new M(G,ft),Ye=new M(ct,ft),_i=new M(ct,Ge),Si=new M(G,Ge),qn=new M(W/s,tt/s),Gn=new M($t/s,be/s),At=e*Math.PI/180;if(At){let Ei=Math.sin(At),Dt=Math.cos(At),xt=[Dt,-Ei,Ei,Dt];je._matMult(xt),Ye._matMult(xt),Si._matMult(xt),_i._matMult(xt)}let we=F.stretch+F.fixed,Ai=R.stretch+R.fixed,Di=V.stretch+V.fixed,jn=B.stretch+B.fixed;return{tl:je,tr:Ye,bl:Si,br:_i,tex:{x:a.paddedRect.x+1+we,y:a.paddedRect.y+1+Di,w:Ai-we,h:jn-Di},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:qn,pixelOffsetBR:Gn,minFontScaleX:A/s/$,minFontScaleY:D/s/P,isSDF:r}};if(!i||!a.stretchX&&!a.stretchY)n.push(z({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:o+1},{fixed:0,stretch:l+1}));else{let F=Gu(h,y,f),V=Gu(c,m,d);for(let R=0;R<F.length-1;R++){let B=F[R],G=F[R+1];for(let W=0;W<V.length-1;W++){let ft=V[W],tt=V[W+1];n.push(z(B,ft,G,tt))}}}return n}function $i(t,e,r){let i=0;for(let n of t)i+=Math.max(e,Math.min(r,n[1]))-Math.max(e,Math.min(r,n[0]));return i}function Gu(t,e,r){let i=[{fixed:-1,stretch:0}];for(let[n,a]of t){let s=i[i.length-1];i.push({fixed:n-s.stretch,stretch:s.stretch}),i.push({fixed:n-s.stretch,stretch:s.stretch+(a-n)})}return i.push({fixed:e+1,stretch:r}),i}function Ni(t,e,r,i){return t/e*r+i}function Ui(t,e,r,i){return t-e*r/i}function Xb(t,e,r,i,n,a,s,o){let l=i.layout.get("text-rotate").evaluate(a,{})*Math.PI/180,u=[];for(let h of e.positionedLines)for(let c of h.positionedGlyphs){if(!c.rect)continue;let p=c.rect||{},f=4,d=!0,y=1,m=0,g=(n||o)&&c.vertical,x=c.metrics.advance*c.scale/2;if(o&&e.verticalizable){let B=(c.scale-1)*24,G=(24-c.metrics.width*c.scale)/2;m=h.lineOffset/2-(c.imageName?-G:B)}if(c.imageName){let B=s[c.imageName];d=B.sdf,y=B.pixelRatio,f=1/y}let b=n?[c.x+x,c.y]:[0,0],v=n?[0,0]:[c.x+x+r[0],c.y+r[1]-m],w=[0,0];g&&(w=v,v=[0,0]);let A=c.metrics.isDoubleResolution?2:1,S=(c.metrics.left-f)*c.scale-x+v[0],D=(-c.metrics.top-f)*c.scale+v[1],E=S+p.w/A*c.scale/y,L=D+p.h/A*c.scale/y,$=new M(S,D),P=new M(E,D),z=new M(S,L),F=new M(E,L);if(g){let B=new M(-x,x- -17),G=-Math.PI/2,W=12-x,ft=c.imageName?W:0,tt=new M(22-W,-ft),ct=new M(...w);$._rotateAround(G,B)._add(tt)._add(ct),P._rotateAround(G,B)._add(tt)._add(ct),z._rotateAround(G,B)._add(tt)._add(ct),F._rotateAround(G,B)._add(tt)._add(ct)}if(l){let B=Math.sin(l),G=Math.cos(l),W=[G,-B,B,G];$._matMult(W),P._matMult(W),z._matMult(W),F._matMult(W)}let V=new M(0,0),R=new M(0,0);u.push({tl:$,tr:P,bl:z,br:F,tex:p,writingMode:e.writingMode,glyphOffset:b,sectionIndex:c.sectionIndex,isSDF:d,pixelOffsetTL:V,pixelOffsetBR:R,minFontScaleX:0,minFontScaleY:0})}return u}var qi=class{constructor(t,e,r,i,n,a,s,o,l,u){if(this.boxStartIndex=t.length,l){let h=a.top,c=a.bottom,p=a.collisionPadding;p&&(h-=p[1],c+=p[3]);let f=c-h;f>0&&(f=Math.max(10,f),this.circleDiameter=f)}else{let h=a.image?.content&&(a.image.textFitWidth||a.image.textFitHeight)?Mp(a):{x1:a.left,y1:a.top,x2:a.right,y2:a.bottom};h.y1=h.y1*s-o[0],h.y2=h.y2*s+o[2],h.x1=h.x1*s-o[3],h.x2=h.x2*s+o[1];let c=a.collisionPadding;if(c&&(h.x1-=c[0]*s,h.y1-=c[1]*s,h.x2+=c[2]*s,h.y2+=c[3]*s),u){let p=new M(h.x1,h.y1),f=new M(h.x2,h.y1),d=new M(h.x1,h.y2),y=new M(h.x2,h.y2),m=u*Math.PI/180;p._rotate(m),f._rotate(m),d._rotate(m),y._rotate(m),h.x1=Math.min(p.x,f.x,d.x,y.x),h.x2=Math.max(p.x,f.x,d.x,y.x),h.y1=Math.min(p.y,f.y,d.y,y.y),h.y2=Math.max(p.y,f.y,d.y,y.y)}t.emplaceBack(e.x,e.y,h.x1,h.y1,h.x2,h.y2,r,i,n)}this.boxEndIndex=t.length}},Zb=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}};function Wb(t,e=1){let r=cn.fromPoints(t[0]),i=Math.min(r.width(),r.height()),n=i/2,a=new Zb([],Hb),{minX:s,minY:o,maxX:l,maxY:u}=r;if(i===0)return new M(s,o);for(let p=s;p<l;p+=i)for(let f=o;f<u;f+=i)a.push(new Qe(p+n,f+n,n,t));let h=Jb(t),c=h;for(;a.length;){let p=a.pop();(p.d>c.d||!c.d)&&(c=p),!(p.max-c.d<=e)&&(n=p.h/2,a.push(new Qe(p.p.x-n,p.p.y-n,n,t)),a.push(new Qe(p.p.x+n,p.p.y-n,n,t)),a.push(new Qe(p.p.x-n,p.p.y+n,n,t)),a.push(new Qe(p.p.x+n,p.p.y+n,n,t)))}return h.d>0&&c.d-h.d<=e?h.p:c.p}function Hb(t,e){return e.max-t.max}var Qe=class{constructor(t,e,r,i){this.p=new M(t,e),this.h=r,this.d=Kb(this.p,i),this.max=this.d+this.h*Math.SQRT2}};function Kb(t,e){let r=!1,i=1/0;for(let n of e)for(let a=0,s=n.length,o=s-1;a<s;o=a++){let l=n[a],u=n[o];l.y>t.y!=u.y>t.y&&t.x<(u.x-l.x)*(t.y-l.y)/(u.y-l.y)+l.x&&(r=!r),i=Math.min(i,Xc(t,l,u))}return(r?1:-1)*Math.sqrt(i)}function Jb(t){let e=0,r=0,i=0,n=t[0];for(let a=0,s=n.length,o=s-1;a<s;o=a++){let l=n[a],u=n[o],h=l.x*u.y-u.x*l.y;r+=(l.x+u.x)*h,i+=(l.y+u.y)*h,e+=h*3}return new Qe(r/e,i/e,0,t)}var Qb=function(t){return t[t.center=1]="center",t[t.left=2]="left",t[t.right=3]="right",t[t.top=4]="top",t[t.bottom=5]="bottom",t[t["top-left"]=6]="top-left",t[t["top-right"]=7]="top-right",t[t["bottom-left"]=8]="bottom-left",t[t["bottom-right"]=9]="bottom-right",t}({}),jo=1/0;function Af(t,e){function r(n,a){let s=0,o=0;a<0&&(a=0);let l=a/Math.SQRT2;switch(n){case"top-right":case"top-left":o=l-7;break;case"bottom-right":case"bottom-left":o=-l+7;break;case"bottom":o=-a+7;break;case"top":o=a-7}switch(n){case"top-right":case"bottom-right":s=-l;break;case"top-left":case"bottom-left":s=l;break;case"left":s=a;break;case"right":s=-a}return[s,o]}function i(n,a,s){let o=0,l=0;switch(a=Math.abs(a),s=Math.abs(s),n){case"top-right":case"top-left":case"top":l=s-7;break;case"bottom-right":case"bottom-left":case"bottom":l=-s+7}switch(n){case"top-right":case"bottom-right":case"right":o=-a;break;case"top-left":case"bottom-left":case"left":o=a}return[o,l]}return e[1]===jo?r(t,e[0]):i(t,e[0],e[1])}function Df(t,e,r){let i=t.layout,n=i.get("text-variable-anchor-offset")?.evaluate(e,{},r);if(n){let s=n.values,o=[];for(let l=0;l<s.length;l+=2){let u=o[l]=s[l],h=s[l+1].map(c=>c*24);u.startsWith("top")?h[1]-=7:u.startsWith("bottom")&&(h[1]+=7),o[l+1]=h}return new Ht(o)}let a=i.get("text-variable-anchor");if(a){let s;s=t._unevaluatedLayout.getValue("text-radial-offset")===void 0?i.get("text-offset").evaluate(e,{},r).map(l=>l*24):[i.get("text-radial-offset").evaluate(e,{},r)*24,jo];let o=[];for(let l of a)o.push(l,Af(l,s));return new Ht(o)}return null}function Ef(t){t.bucket.createArrays();let e=512*t.bucket.overscaling;t.bucket.tilePixelRatio=it/e,t.bucket.compareText={},t.bucket.iconsNeedLinear=!1;let r=t.bucket.layers[0],i=r.layout,n=r._unevaluatedLayout._values,a={layoutIconSize:n["icon-size"].possiblyEvaluate(new H(t.bucket.zoom+1),t.canonical),layoutTextSize:n["text-size"].possiblyEvaluate(new H(t.bucket.zoom+1),t.canonical),textMaxSize:n["text-size"].possiblyEvaluate(new H(18))};if(t.bucket.textSizeData.kind==="composite"){let{minZoom:h,maxZoom:c}=t.bucket.textSizeData;a.compositeTextSizes=[n["text-size"].possiblyEvaluate(new H(h),t.canonical),n["text-size"].possiblyEvaluate(new H(c),t.canonical)]}if(t.bucket.iconSizeData.kind==="composite"){let{minZoom:h,maxZoom:c}=t.bucket.iconSizeData;a.compositeIconSizes=[n["icon-size"].possiblyEvaluate(new H(h),t.canonical),n["icon-size"].possiblyEvaluate(new H(c),t.canonical)]}let s=i.get("text-line-height")*24,o=i.get("text-rotation-alignment")!=="viewport"&&i.get("symbol-placement")!=="point",l=i.get("text-keep-upright"),u=i.get("text-size");for(let h of t.bucket.features){let c=i.get("text-font").evaluate(h,{},t.canonical).join(","),p=u.evaluate(h,{},t.canonical),f=a.layoutTextSize.evaluate(h,{},t.canonical),d=a.layoutIconSize.evaluate(h,{},t.canonical),y={horizontal:{},vertical:void 0},m=h.text,g=[0,0];if(m){let w=m.toString(),A=i.get("text-letter-spacing").evaluate(h,{},t.canonical)*24,S=bm(w)?A:0,D=i.get("text-anchor").evaluate(h,{},t.canonical),E=Df(r,h,t.canonical);if(!E){let z=i.get("text-radial-offset").evaluate(h,{},t.canonical);g=z?Af(D,[z*24,jo]):i.get("text-offset").evaluate(h,{},t.canonical).map(F=>F*24)}let L=o?"center":i.get("text-justify").evaluate(h,{},t.canonical),$=i.get("symbol-placement")==="point"?i.get("text-max-width").evaluate(h,{},t.canonical)*24:1/0,P=()=>{t.bucket.allowVerticalPlacement&&Ia(w)&&(y.vertical=Oi(m,t.glyphMap,t.glyphPositions,t.imagePositions,c,$,s,D,"left",S,g,2,!0,f,p))};if(!o&&E){let z=new Set;if(L==="auto")for(let V=0;V<E.values.length;V+=2)z.add(ju(E.values[V]));else z.add(L);let F=!1;for(let V of z)if(!y.horizontal[V])if(F)y.horizontal[V]=y.horizontal[0];else{let R=Oi(m,t.glyphMap,t.glyphPositions,t.imagePositions,c,$,s,"center",V,S,g,1,!1,f,p);R&&(y.horizontal[V]=R,F=R.positionedLines.length===1)}P()}else{L==="auto"&&(L=ju(D));let z=Oi(m,t.glyphMap,t.glyphPositions,t.imagePositions,c,$,s,D,L,S,g,1,!1,f,p);z&&(y.horizontal[L]=z),P(),Ia(w)&&o&&l&&(y.vertical=Oi(m,t.glyphMap,t.glyphPositions,t.imagePositions,c,$,s,D,L,S,g,2,!1,f,p))}}let x,b=!1;if(h.icon?.name){let w=t.imageMap[h.icon.name];w&&(x=Ex(t.imagePositions[h.icon.name],i.get("icon-offset").evaluate(h,{},t.canonical),i.get("icon-anchor").evaluate(h,{},t.canonical)),b=!!w.sdf,t.bucket.sdfIcons===void 0?t.bucket.sdfIcons=b:t.bucket.sdfIcons!==b&>("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),w.pixelRatio===t.bucket.pixelRatio?i.get("icon-rotate").constantOr(1)!==0&&(t.bucket.iconsNeedLinear=!0):t.bucket.iconsNeedLinear=!0)}let v=Tf(y.horizontal)||y.vertical;t.bucket.iconsInText||=v?v.iconsInText:!1,(v||x)&&tw(t.bucket,h,y,x,t.imageMap,a,f,d,g,b,t.canonical,t.subdivisionGranularity)}t.showCollisionBoxes&&t.bucket.generateCollisionDebugBuffers()}function ju(t){switch(t){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function tw(t,e,r,i,n,a,s,o,l,u,h,c){let p=a.textMaxSize.evaluate(e,{});p===void 0&&(p=s);let f=t.layers[0].layout,d=f.get("icon-offset").evaluate(e,{},h),y=Tf(r.horizontal),m=s/24,g=t.tilePixelRatio*m,x=t.tilePixelRatio*p/24,b=t.tilePixelRatio*o,v=t.tilePixelRatio*f.get("symbol-spacing"),w=f.get("text-padding")*t.tilePixelRatio,A=Vx(f,e,h,t.tilePixelRatio),S=f.get("text-max-angle")/180*Math.PI,D=f.get("text-rotation-alignment")!=="viewport"&&f.get("symbol-placement")!=="point",E=f.get("icon-rotation-alignment").constantOr("viewport")==="map"&&f.get("symbol-placement")!=="point",L=f.get("symbol-placement"),$=v/2,P=f.get("icon-text-fit"),z;i&&P!=="none"&&(t.allowVerticalPlacement&&r.vertical&&(z=wu(i,r.vertical,P,f.get("icon-text-fit-padding"),d,m)),y&&(i=wu(i,y,P,f.get("icon-text-fit-padding"),d,m)));let F=h?c.line.getGranularityForZoomLevel(h.z):1,V=(R,B)=>{B.x<0||B.x>=8192||B.y<0||B.y>=8192||rw(t,B,R,r,i,n,z,t.layers[0],t.collisionBoxArray,e.index,e.sourceLayerIndex,t.index,g,[w,w,w,w],D,l,b,A,E,d,e,a,u,h,s)};if(L==="line")for(let R of $b(e.geometry,0,0,it,it)){let B=Fe(R,F),G=Yb(B,v,S,r.vertical||y,i,24,x,t.overscaling,it);for(let W of G){let ft=y;(!ft||!iw(t,ft.text,$,W))&&V(B,W)}}else if(L==="line-center"){for(let R of e.geometry)if(R.length>1){let B=Fe(R,F),G=jb(B,S,r.vertical||y,i,24,x);G&&V(B,G)}}else if(e.type==="Polygon")for(let R of Sn(e.geometry,0)){let B=Wb(R,16);V(Fe(R[0],F,!0),new ur(B.x,B.y,0))}else if(e.type==="LineString")for(let R of e.geometry){let B=Fe(R,F);V(B,new ur(B[0].x,B[0].y,0))}else if(e.type==="Point")for(let R of e.geometry)for(let B of R)V([B],new ur(B.x,B.y,0))}function ew(t,e){let r=t.length,i=e?.values;if(i?.length>0)for(let n=0;n<i.length;n+=2){let a=Qb[i[n]],s=i[n+1];t.emplaceBack(a,s[0],s[1])}return[r,t.length]}function Yu(t,e,r,i,n,a,s,o,l,u,h,c,p,f,d,y){let m=Xb(e,r,o,n,a,s,i,t.allowVerticalPlacement),g=t.textSizeData,x=null;g.kind==="source"?(x=[128*n.layout.get("text-size").evaluate(s,{})],x[0]>32640&>(`${t.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):g.kind==="composite"&&(x=[128*d.compositeTextSizes[0].evaluate(s,{},y),128*d.compositeTextSizes[1].evaluate(s,{},y)],(x[0]>32640||x[1]>32640)&>(`${t.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),t.addSymbols(t.text,m,x,o,a,s,h,e,u.lineStartIndex,u.lineLength,f,y,l);for(let b of c)p[b]=t.text.placedSymbolArray.length-1;return m.length*4}function Tf(t){for(let e in t)return t[e];return null}function rw(t,e,r,i,n,a,s,o,l,u,h,c,p,f,d,y,m,g,x,b,v,w,A,S,D){let E=t.addToLineVertexArray(e,r),L=o.layout.get("symbol-height-offset").evaluate(v,{},S),$,P,z,F,V=0,R=0,B=0,G=0,W=-1,ft=-1,tt={},ct=(0,Ja.default)("");if(t.allowVerticalPlacement&&i.vertical){let Dt=o.layout.get("text-rotate").evaluate(v,{},S)+90,xt=i.vertical;z=new qi(l,e,u,h,c,xt,p,f,d,Dt),s&&(F=new qi(l,e,u,h,c,s,m,g,d,Dt))}if(n){let Dt=o.layout.get("icon-rotate").evaluate(v,{}),xt=o.layout.get("icon-text-fit")!=="none",Sr=qu(n,Dt,A,xt),Yn=s?qu(s,Dt,A,xt):void 0;P=new qi(l,e,u,h,c,n,m,g,!1,Dt),V=Sr.length*4;let Zo=t.iconSizeData,_e=null;Zo.kind==="source"?(_e=[128*o.layout.get("icon-size").evaluate(v,{})],_e[0]>32640&>(`${t.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):Zo.kind==="composite"&&(_e=[128*w.compositeIconSizes[0].evaluate(v,{},S),128*w.compositeIconSizes[1].evaluate(v,{},S)],(_e[0]>32640||_e[1]>32640)&>(`${t.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),t.addSymbols(t.icon,Sr,_e,b,x,v,0,e,E.lineStartIndex,E.lineLength,-1,S,L),W=t.icon.placedSymbolArray.length-1,Yn&&(R=Yn.length*4,t.addSymbols(t.icon,Yn,_e,b,x,v,2,e,E.lineStartIndex,E.lineLength,-1,S,L),ft=t.icon.placedSymbolArray.length-1)}let $t=Object.keys(i.horizontal);for(let Dt of $t){let xt=i.horizontal[Dt];$||=(ct=(0,Ja.default)(xt.text),new qi(l,e,u,h,c,xt,p,f,d,o.layout.get("text-rotate").evaluate(v,{},S)));let Sr=xt.positionedLines.length===1;if(B+=Yu(t,e,xt,a,o,d,v,y,L,E,i.vertical?1:3,Sr?$t:[Dt],tt,W,w,S),Sr)break}i.vertical&&(G+=Yu(t,e,i.vertical,a,o,d,v,y,L,E,2,["vertical"],tt,ft,w,S));let Ge=$?$.boxStartIndex:t.collisionBoxArray.length,be=$?$.boxEndIndex:t.collisionBoxArray.length,je=z?z.boxStartIndex:t.collisionBoxArray.length,Ye=z?z.boxEndIndex:t.collisionBoxArray.length,_i=P?P.boxStartIndex:t.collisionBoxArray.length,Si=P?P.boxEndIndex:t.collisionBoxArray.length,qn=F?F.boxStartIndex:t.collisionBoxArray.length,Gn=F?F.boxEndIndex:t.collisionBoxArray.length,At=-1,we=(Dt,xt)=>Dt?.circleDiameter?Math.max(Dt.circleDiameter,xt):xt;At=we($,At),At=we(z,At),At=we(P,At),At=we(F,At);let Ai=+(At>-1);Ai&&(At*=D/24),t.glyphOffsetArray.length>=Ce.MAX_GLYPHS&>("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),v.sortKey!==void 0&&t.addToSortKeyRanges(t.symbolInstances.length,v.sortKey);let Di=Df(o,v,S),[jn,Ei]=ew(t.textAnchorOffsets,Di);t.symbolInstances.emplaceBack(e.x,e.y,tt.right>=0?tt.right:-1,tt.center>=0?tt.center:-1,tt.left>=0?tt.left:-1,tt.vertical||-1,W,ft,ct,Ge,be,je,Ye,_i,Si,qn,Gn,u,B,G,V,R,Ai,0,p,At,jn,Ei,L)}function iw(t,e,r,i){let n=t.compareText;if(!(e in n))n[e]=[];else{let a=n[e];for(let s=a.length-1;s>=0;s--)if(i.dist(a[s])<r)return!0}return n[e].push(i),!1}/**\n* MapLibre GL JS\n* @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v6.7.0/LICENSE.txt\n*/function Xo(t){let e=typeof t;if(e==="number"||e==="boolean"||e==="string"||t==null)return JSON.stringify(t);if(Array.isArray(t)){let n="[";for(let a of t)n+=`${Xo(a)},`;return`${n}]`}let r=Object.keys(t).sort(),i="{";for(let n=0;n<r.length;n++)i+=`${JSON.stringify(r[n])}:${Xo(t[r[n]])},`;return`${i}}`}function nw(t){let e="";for(let r of ah)e+=`/${Xo(t[r])}`;return e}function aw(t,e){let r={};for(let n=0;n<t.length;n++){let a=e&&e[t[n].id]||nw(t[n]);e&&(e[t[n].id]=a);let s=r[a];s||=r[a]=[],s.push(t[n])}let i=[];for(let n in r)i.push(r[n]);return i}var sw=class{constructor(t,e){this.keyCache={},t&&this.replace(t,e)}replace(t,e){this._layerConfigs={},this._layers={},this.update(t,[],e)}update(t,e,r){for(let n of t){this._layerConfigs[n.id]=n;let a=this._layers[n.id]=Pp(n,r);a._featureFilter=yr(a.filter,`layers[${n.id}].filter`,r),this.keyCache[n.id]&&delete this.keyCache[n.id]}for(let n of e)delete this.keyCache[n],delete this._layerConfigs[n],delete this._layers[n];this.familiesBySource={};let i=aw(Object.values(this._layerConfigs),this.keyCache);for(let n of i){let a=n.map(c=>this._layers[c.id]),s=a[0];if(s.isHidden())continue;let o=s.source||"",l=this.familiesBySource[o];l||=this.familiesBySource[o]={};let u=s.sourceLayer||"_geojsonTileLayer",h=l[u];h||=l[u]=[],h.push(a)}}},kf=class{constructor(t){let e={},r=[];for(let s in t){let o=t[s],l=e[s]={};for(let u in o){let h=o[u];if(!h||h.bitmap.width===0||h.bitmap.height===0)continue;let c={x:0,y:0,w:h.bitmap.width+2,h:h.bitmap.height+2};r.push(c),l[u]={rect:c,metrics:h.metrics}}}let{w:i,h:n}=So(r),a=new Vn({width:i||1,height:n||1});for(let s in t){let o=t[s];for(let l in o){let u=o[l];if(!u||u.bitmap.width===0||u.bitmap.height===0)continue;let h=e[s][l].rect;Vn.copy(u.bitmap,a,{x:0,y:0},{x:h.x+1,y:h.y+1},u.bitmap)}}this.image=a,this.positions=e}};I("GlyphAtlas",kf);var If=class{constructor(t){this.tileID=new Do(t.tileID.overscaledZ,t.tileID.wrap,t.tileID.canonical.z,t.tileID.canonical.x,t.tileID.canonical.y),this.uid=t.uid,this.zoom=t.zoom,this.pixelRatio=t.pixelRatio,this.tileSize=t.tileSize,this.source=t.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=t.showCollisionBoxes,this.collectResourceTiming=!!t.collectResourceTiming,this.returnDependencies=!!t.returnDependencies,this.promoteId=t.promoteId,this.inFlightDependencies=[]}async parse(t,e,r,i,n){this.data=t,this.collisionBoxArray=new to;let a=new To(Object.keys(t.layers).sort()),s=new Go(this.tileID,this.promoteId);s.bucketLayerIDs=[];let o={},l={featureIndex:s,iconDependencies:{},patternDependencies:{},glyphDependencies:{},dashDependencies:{},availableImages:r,subdivisionGranularity:n},u=e.familiesBySource[this.source];for(let D in u){let E=t.layers[D];if(!E)continue;E.version===1&>(`Vector tile source "${this.source}" layer "${D}" does not use vector tile spec v2 and therefore may have some rendering errors.`);let L=a.encode(D),$=[];for(let P=0;P<E.length;P++){let z=E.feature(P),F=s.getId(z,D);$.push({feature:z,id:F,index:P,sourceLayerIndex:L})}for(let P of u[D]){let z=P[0];z.source!==this.source&>(`layer.source = ${z.source} does not equal this.source = ${this.source}`),!z.isHidden(this.zoom,!0)&&(Yo(P,this.zoom,r),(o[z.id]=z.createBucket({index:s.bucketLayerIDs.length,layers:P,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:L,sourceID:this.source})).populate($,l,this.tileID.canonical),s.bucketLayerIDs.push(P.map(F=>F.id)))}}let h=dn(l.glyphDependencies,D=>Object.keys(D));for(let D of this.inFlightDependencies)D?.abort();this.inFlightDependencies=[];let c=Promise.resolve({});if(Object.keys(h).length){let D=new AbortController;this.inFlightDependencies.push(D),c=i.sendAsync({type:"GG",data:{stacks:h,source:this.source,tileID:this.tileID,type:"glyphs"}},D)}let p=Object.keys(l.iconDependencies),f=Promise.resolve({});if(p.length){let D=new AbortController;this.inFlightDependencies.push(D),f=i.sendAsync({type:"GI",data:{icons:p,source:this.source,tileID:this.tileID,type:"icons"}},D)}let d=Object.keys(l.patternDependencies),y=Promise.resolve({});if(d.length){let D=new AbortController;this.inFlightDependencies.push(D),y=i.sendAsync({type:"GI",data:{icons:d,source:this.source,tileID:this.tileID,type:"patterns"}},D)}let m=l.dashDependencies,g=Promise.resolve({});if(Object.keys(m).length){let D=new AbortController;this.inFlightDependencies.push(D),g=i.sendAsync({type:"GDA",data:{dashes:m}},D)}let[x,b,v,w]=await Promise.all([c,f,y,g]),A=new kf(x),S=new Ao(b,v);for(let D in o){let E=o[D];E instanceof Ce?(Yo(E.layers,this.zoom,r),Ef({bucket:E,glyphMap:x,glyphPositions:A.positions,imageMap:b,imagePositions:S.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:l.subdivisionGranularity})):E.hasDependencies&&(E instanceof On||E instanceof Rn||E instanceof $n)&&(Yo(E.layers,this.zoom,r),E.addFeatures(l,this.tileID.canonical,S.patternPositions,w))}return{buckets:Object.values(o).filter(D=>!D.isEmpty()),featureIndex:s,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:A.image,imageAtlas:S,dashPositions:w,glyphMap:this.returnDependencies?x:null,iconMap:this.returnDependencies?b:null,glyphPositions:this.returnDependencies?A.positions:null}}};function Yo(t,e,r){let i=new H(e);for(let n of t)n.recalculate(i,r)}var Mf=class{constructor(){this.loading={},this.loaded={},this.parsing={}}startLoading(t,e){this.loading[t]=e}finishLoading(t){delete this.loading[t]}abort(t){let e=this.loading[t];e?.abort&&(e.abort.abort(),delete this.loading[t])}getParsing(t){return this.parsing[t]}setParsing(t,e){this.parsing[t]=e}removeParsing(t){delete this.parsing[t]}markLoaded(t,e){this.loaded[t]=e}getLoaded(t){let e=this.loaded[t];if(e)return e}removeLoaded(t){delete this.loaded[t]}clearLoaded(){this.loaded={}}},Cf=class{constructor(t){this.start=`${t}#start`,this.end=`${t}#end`,this.measure=t,performance.mark(this.start)}finish(){performance.mark(this.end);let t=performance.getEntriesByName(this.measure);return t.length===0&&(performance.measure(this.measure,this.start,this.end),t=performance.getEntriesByName(this.measure),performance.clearMarks(this.start),performance.clearMarks(this.end),performance.clearMeasures(this.measure)),t}},ow=class{constructor(t,e,r,i,n){this.type=t,this.properties=r||{},this.extent=n,this.pointsArray=e,this.id=i}loadGeometry(){return this.pointsArray.map(t=>t.map(e=>new M(e.x,e.y)))}},lw=class{constructor(t,e,r){this.version=2,this._myFeatures=t,this.name=e,this.length=t.length,this.extent=r}feature(t){return this._myFeatures[t]}},uw=class{constructor(){this.layers={}}addLayer(t){this.layers[t.name]=t}};function hw(t,e,r){let{extent:i}=t,n=2**(r.z-e.z),a=(r.x-e.x*n)*i,s=(r.y-e.y*n)*i,o=[];for(let l=0;l<t.length;l++){let u=t.feature(l),h=u.loadGeometry();for(let c of h)for(let p of c)p.x=p.x*n-a,p.y=p.y*n-s;h=gf(h,u.type,-128,-128,i+128,i+128),h.length!==0&&o.push(new ow(u.type,h,u.properties,u.id,i))}return new lw(o,t.name,i)}var cw=class{constructor(t,e,r){this.actor=t,this.layerIndex=e,this.availableImages=r,this.tileState=new Mf,this.overzoomedTileResultCache=new mf(1e3)}loadVectorTile(t,e){try{return{vectorTile:t.encoding==="mlt"?new qo(e):new ho(new _o(e)),rawData:e}}catch(r){let i=new Uint8Array(e),n=i[0]===31&&i[1]===139,a=`Unable to parse the tile at ${t.request.url}, `;throw a+=n?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${Wr(r).message}`,Error(a)}}async loadTile(t){let{uid:e,overzoomParameters:r}=t;r&&(t.request=r.overzoomRequest);let i=this._startRequestTiming(t),n=new If(t);this.tileState.startLoading(e,n);let a=new AbortController;n.abort=a;try{let s=await rh(t.request,a);if(t.etag&&t.etag===s.etag)return this.tileState.finishLoading(e),this._getEtagUnmodifiedResult(s,i);let o=this.loadVectorTile(t,s.data);if(this.tileState.finishLoading(e),!o)return null;let{vectorTile:l,rawData:u}=o;r&&({vectorTile:l,rawData:u}=this._getOverzoomTile(t,l));let h=this._getExpiryData(s),c=this._finishRequestTiming(i);n.vectorTile=l,n.etag=s.etag,this.tileState.markLoaded(e,n);let p={rawData:u,cacheControl:h,resourceTiming:c};return this.tileState.setParsing(e,p),await this._parseWorkerTile(n,t)}catch(s){throw this.tileState.finishLoading(e),this.tileState.markLoaded(e,n),s}}_getEtagUnmodifiedResult(t,e){let r=this._getExpiryData(t),i=this._finishRequestTiming(e);return Tt({etagUnmodified:!0},r,i)}async _parseWorkerTile(t,e){let r=this.tileState.getParsing(t.uid),i=await t.parse(t.vectorTile,this.layerIndex,this.availableImages,this.actor,e.subdivisionGranularity);if(r){let{rawData:n,cacheControl:a,resourceTiming:s}=r,o=e.overzoomParameters?"mvt":e.encoding;i=Tt({rawTileData:n.slice(0),encoding:o},i,a,s),this.tileState.removeParsing(t.uid)}else t.etag&&(i=Tt(i,{etag:t.etag}));return i}_getExpiryData({expires:t,cacheControl:e,etag:r}){let i={};return t&&(i.expires=t),e&&(i.cacheControl=e),r&&(i.etag=r),i}_startRequestTiming(t){if(t.request?.collectResourceTiming)return new Cf(t.request.url)}_finishRequestTiming(t){let e=t?.finish();return e?{resourceTiming:JSON.parse(JSON.stringify(e))}:{}}_getOverzoomTile(t,e){let{tileID:r,source:i,overzoomParameters:n}=t,{maxZoomTileID:a}=n,s=`${a.key}_${r.key}_${t.request?.url}`,o=this.overzoomedTileResultCache.get(s);if(o)return o;let l=new uw,u=this.layerIndex.familiesBySource[i];for(let c in u){let p=e.layers[c];if(!p)continue;let f=hw(p,a,r.canonical);f.length>0&&l.addLayer(f)}let h={vectorTile:l,rawData:Eo(l).buffer};return this.overzoomedTileResultCache.set(s,h),h}async reloadTile(t){let e=t.uid,r=this.tileState.getLoaded(e);if(!r)throw Error("Should not be trying to reload a tile that was never loaded or has been removed");if(r.vectorTile)return r.showCollisionBoxes=t.showCollisionBoxes,await this._parseWorkerTile(r,t)}async abortTile(t){this.tileState.abort(t.uid)}async removeTile(t){this.tileState.removeLoaded(t.uid)}},pw=class{constructor(){this.loaded={}}async loadTile(t){let{uid:e,encoding:r,rawImageData:i,redFactor:n,greenFactor:a,blueFactor:s,baseShift:o}=t,l=i.width+2,u=i.height+2,h=yn(i)?new kt({width:l,height:u},await Ku(i,-1,-1,l,u)):i,c=new lo(e,h,r,n,a,s,o);return this.loaded||={},this.loaded[e]=c,c}removeTile(t){let e=this.loaded,r=t.uid;e?.[r]&&delete e[r]}},fw=class{constructor(t,e,r,i=dw){this.actor=t,this.layerIndex=e,this.availableImages=r,this.tileState=new Mf,this._createGeoJSONIndex=i}loadVectorTile(t){if(!this._geoJSONIndex)throw Error("Unable to parse the data into a cluster or geojson");let{z:e,x:r,y:i}=t.tileID.canonical,n=this._geoJSONIndex.getTile(e,r,i);if(!n)return null;let a=new Vp(n.features,{version:2,extent:it});return{vectorTile:a,rawData:Eo(a,Hu).buffer}}async loadTile(t){let{uid:e}=t,r=new If(t);r.abort=new AbortController;try{let i=this.loadVectorTile(t);if(!i)return null;let{vectorTile:n,rawData:a}=i;r.vectorTile=n,this.tileState.markLoaded(e,r);let s={rawData:a};return this.tileState.setParsing(e,s),await this._parseWorkerTile(r,t)}catch(i){throw this.tileState.markLoaded(e,r),i}}async _parseWorkerTile(t,e){let r=this.tileState.getParsing(t.uid),i=await t.parse(t.vectorTile,this.layerIndex,this.availableImages,this.actor,e.subdivisionGranularity);if(r){let{rawData:n}=r;i=Tt({rawTileData:n.slice(0),encoding:"mvt"},i),this.tileState.removeParsing(t.uid)}return i}async abortTile(t){this.tileState.abort(t.uid)}async removeTile(t){this.tileState.removeLoaded(t.uid)}async loadData(t){this._pendingRequest?.abort();let e=this._startRequestTiming(t);this._pendingRequest=new AbortController;try{await this.loadAndProcessGeoJSON(t,this._pendingRequest),delete this._pendingRequest,this.tileState.clearLoaded();let r={};return t.request&&(r.data=t.data),this._finishRequestTiming(e,t,r),r}catch(r){if(delete this._pendingRequest,!Cs(r))throw r;return{abandoned:!0}}}_startRequestTiming(t){if(t.request?.collectResourceTiming)return new Cf(t.request.url)}_finishRequestTiming(t,e,r){let i=t?.finish();i&&(r.resourceTiming={[e.source]:JSON.parse(JSON.stringify(i))})}async reloadTile(t){let e=t.uid,r=this.tileState.getLoaded(e);if(!r)return await this.loadTile(t);if(r.vectorTile)return r.showCollisionBoxes=t.showCollisionBoxes,await this._parseWorkerTile(r,t)}async loadAndProcessGeoJSON(t,e){if(t.request&&(t.data=(await eh(t.request,e)).data),t.data){t.data=this._filterGeoJSON(t.data,t.filter,t.source),this._geoJSONIndex=this._createGeoJSONIndex(t.data,t);return}if(t.dataDiff){this._geoJSONIndex??=this._createGeoJSONIndex({type:"FeatureCollection",features:[]},t),this._geoJSONIndex.updateData(t.dataDiff,this._getFilterPredicate(t.filter,t.source));return}if(t.updateCluster&&this._geoJSONIndex.updateClusterOptions(t.geojsonVtOptions.cluster,Bf(t)),this._geoJSONIndex==null)throw Error(`Input data given to \'${t.source}\' is not a valid GeoJSON object.`)}_filterGeoJSON(t,e,r){if(t.type!=="FeatureCollection")return t;let i=this._getFilterPredicate(e,r);return i?{type:"FeatureCollection",features:t.features.filter(n=>i(n))}:t}_getFilterPredicate(t,e){if(typeof t!="boolean"&&!t?.length)return;let r=ve(t,`sources.${e}.filter`,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(r.result==="error")throw Error(r.value.map(i=>`${i.key}: ${i.message}`).join(", "));return i=>r.value.evaluate({zoom:0},i)}async removeSource(t){this._pendingRequest?.abort()}getClusterExpansionZoom(t){return this._geoJSONIndex.getClusterExpansionZoom(t.clusterId)}getClusterChildren(t){return this._geoJSONIndex.getClusterChildren(t.clusterId)}getClusterLeaves(t){return this._geoJSONIndex.getClusterLeaves(t.clusterId,t.limit,t.offset)}};function dw(t,e){let r=Tt(e.geojsonVtOptions||{},{updateable:!0,clusterOptions:Bf(e)});return new wp(t,r)}function Bf({geojsonVtOptions:t,clusterProperties:e,source:r}){if(!e||!t.clusterOptions)return t.clusterOptions;let i={},n={},a={accumulated:null,zoom:0},s={properties:null},o=Object.keys(e);for(let l of o){let[u,h]=e[l],c=ve(h,`sources.${r}.clusterProperties.${l}[1]`),p=ve(typeof u=="string"?[u,["accumulated"],["get",l]]:u,`sources.${r}.clusterProperties.${l}[0]`);i[l]=c.value,n[l]=p.value}return t.clusterOptions.map=l=>{s.properties=l;let u={};for(let h of o)u[h]=i[h].evaluate(a,s);return u},t.clusterOptions.reduce=(l,u)=>{s.properties=u;for(let h of o)a.accumulated=l[h],l[h]=n[h].evaluate(a,s)},t.clusterOptions}async function Ff(t){if(t.endsWith(".mjs")){await import(t);return}let e=await fetch(t,{credentials:"same-origin"});if(!e.ok)throw Error(`Failed to load ${t}: ${e.status}`);let r=await e.text();if(/^[ \\t]*(import|export)\\s/m.test(r)){let i=URL.createObjectURL(new Blob([r],{type:"text/javascript"}));try{await import(i)}finally{URL.revokeObjectURL(i)}return}globalThis.eval(r)}var yw=class{constructor(t){this.self=t,this.actor=new zp(t),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.globalStates=new Map,this.self.registerWorkerSource=(e,r)=>{if(this.externalWorkerSourceTypes[e])throw Error(`Worker source with name "${e}" already registered.`);this.externalWorkerSourceTypes[e]=r},this.self.addProtocol=Ju,this.self.removeProtocol=Qu,this.self.registerRTLTextPlugin=e=>{Jt.setMethods(e)},this.self.makeRequest=mn,this.actor.registerMessageHandler("LDT",(e,r)=>this._getDEMWorkerSource(e,r.source).loadTile(r)),this.actor.registerMessageHandler("RDT",async(e,r)=>{this._getDEMWorkerSource(e,r.source).removeTile(r)}),this.actor.registerMessageHandler("GCEZ",async(e,r)=>this._getWorkerSource(e,r.type,r.source).getClusterExpansionZoom(r)),this.actor.registerMessageHandler("GCC",async(e,r)=>this._getWorkerSource(e,r.type,r.source).getClusterChildren(r)),this.actor.registerMessageHandler("GCL",async(e,r)=>this._getWorkerSource(e,r.type,r.source).getClusterLeaves(r)),this.actor.registerMessageHandler("LD",(e,r)=>this._getWorkerSource(e,r.type,r.source).loadData(r)),this.actor.registerMessageHandler("LT",(e,r)=>this._getWorkerSource(e,r.type,r.source).loadTile(r)),this.actor.registerMessageHandler("RT",(e,r)=>this._getWorkerSource(e,r.type,r.source).reloadTile(r)),this.actor.registerMessageHandler("AT",(e,r)=>this._getWorkerSource(e,r.type,r.source).abortTile(r)),this.actor.registerMessageHandler("RMT",(e,r)=>this._getWorkerSource(e,r.type,r.source).removeTile(r)),this.actor.registerMessageHandler("RS",async(e,r)=>{if(!this.workerSources[e]?.[r.type]?.[r.source])return;let i=this.workerSources[e][r.type][r.source];delete this.workerSources[e][r.type][r.source],i.removeSource!==void 0&&i.removeSource(r)}),this.actor.registerMessageHandler("RM",async e=>{delete this.layerIndexes[e],delete this.availableImages[e],delete this.workerSources[e],delete this.demWorkerSources[e],this.globalStates.delete(e)}),this.actor.registerMessageHandler("SR",async(e,r)=>{this.referrer=r}),this.actor.registerMessageHandler("SRPS",(e,r)=>this._syncRTLPluginState(e,r)),this.actor.registerMessageHandler("IS",async(e,r)=>{await Ff(r)}),this.actor.registerMessageHandler("SI",(e,r)=>this._setImages(e,r)),this.actor.registerMessageHandler("UL",async(e,r)=>{this._getLayerIndex(e).update(r.layers,r.removedIds,this._getGlobalState(e))}),this.actor.registerMessageHandler("UGS",async(e,r)=>{let i=this._getGlobalState(e);for(let n in r)i[n]=r[n]}),this.actor.registerMessageHandler("SL",async(e,r)=>{this._getLayerIndex(e).replace(r,this._getGlobalState(e))})}_getGlobalState(t){let e=this.globalStates.get(t);return e||(e={},this.globalStates.set(t,e)),e}async _setImages(t,e){this.availableImages[t]=e;for(let r in this.workerSources[t]){let i=this.workerSources[t][r];for(let n in i)i[n].availableImages=e}}async _syncRTLPluginState(t,e){return await Jt.syncState(e,Ff)}_getAvailableImages(t){let e=this.availableImages[t];return e||=[],e}_getLayerIndex(t){let e=this.layerIndexes[t];return e||=this.layerIndexes[t]=new sw,e}_getWorkerSource(t,e,r){if(this.workerSources[t]||={},this.workerSources[t][e]||={},!this.workerSources[t][e][r]){let i={sendAsync:(n,a)=>(n.targetMapId=t,this.actor.sendAsync(n,a))};switch(e){case"vector":this.workerSources[t][e][r]=new cw(i,this._getLayerIndex(t),this._getAvailableImages(t));break;case"geojson":this.workerSources[t][e][r]=new fw(i,this._getLayerIndex(t),this._getAvailableImages(t));break;default:this.workerSources[t][e][r]=new this.externalWorkerSourceTypes[e](i,this._getLayerIndex(t),this._getAvailableImages(t))}}return this.workerSources[t][e][r]}_getDEMWorkerSource(t,e){return this.demWorkerSources[t]||={},this.demWorkerSources[t][e]||=new pw,this.demWorkerSources[t][e]}};Be(self)&&(self.worker=new yw(self));})();\n';
|
|
1
|
+
const e = '(()=>{/**\n* MapLibre GL JS\n* @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v6.7.0/LICENSE.txt\n*/var Pf=Object.create,Xu=Object.defineProperty,zf=Object.getOwnPropertyDescriptor,Lf=Object.getOwnPropertyNames,Vf=Object.getPrototypeOf,Zu=Object.prototype.hasOwnProperty,Is=(t,e)=>()=>(e||(t((e={exports:{}}).exports,e),t=null),e.exports),Of=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(var n=Lf(e),a=0,s=n.length,o;a<s;a++)o=n[a],!Zu.call(t,o)&&o!==r&&Xu(t,o,{get:(l=>e[l]).bind(null,o),enumerable:!(i=zf(e,o))||i.enumerable});return t},Rf=(t,e,r)=>(r=t==null?{}:Pf(Vf(t)),Of(e||!t||!t.__esModule||!Zu.call(t,"default")?Xu(r,"default",{value:t,enumerable:!0}):r,t));function M(t,e){this.x=t,this.y=e}M.prototype={clone(){return new M(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:M},M.convert=function(t){if(t instanceof M)return t;if(Array.isArray(t))return new M(+t[0],+t[1]);if(t.x!==void 0&&t.y!==void 0)return new M(+t.x,+t.y);throw Error("Expected [x, y] or {x, y} point format")};function $f(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 Wo;function Nf(){return Wo??=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function",Wo}var Ti;function Uf(){if(Ti==null&&(Ti=!1,Nf())){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){Ti=!0;break}}}return Ti||!1}var qt=typeof Float32Array<"u"?Float32Array:Array;Math.PI/180,180/Math.PI;function qf(){var t=new qt(9);return qt!=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 Wu(){var t=new qt(3);return qt!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function Gf(t){var e=t[0],r=t[1],i=t[2];return Math.sqrt(e*e+r*r+i*i)}function Ho(t,e,r){var i=new qt(3);return i[0]=t,i[1]=e,i[2]=r,i}function jf(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 Yf(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function Xn(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 Xf=Gf;(function(){var t=Wu();return function(e,r,i,n,a,s){var o,l;for(r||=3,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 Zf(){var t=new qt(4);return qt!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function Wf(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 Hf(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=Zf();return function(e,r,i,n,a,s){var o,l;for(r||=4,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 Ko(){var t=new qt(4);return qt!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function Kf(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 Zn(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 Jf(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 Jo=Wf;(function(){var t=Wu(),e=Ho(1,0,0),r=Ho(0,1,0);return function(i,n,a){var s=Yf(n,a);return s<-.999999?(Xn(t,e,n),Xf(t)<1e-6&&Xn(t,r,n),jf(t,t),Kf(i,t,Math.PI),i):s>.999999?(i[0]=0,i[1]=0,i[2]=0,i[3]=1,i):(Xn(t,n,a),i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=1+s,Jo(i,i))}})(),(function(){var t=Ko(),e=Ko();return function(r,i,n,a,s,o){return Zn(t,i,s,o),Zn(e,n,a,o),Zn(r,t,e,2*o*(1-o)),r}})(),(function(){var t=qf();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],Jo(e,Jf(e,t))}})();function Qf(){var t=new qt(2);return qt!=Float32Array&&(t[0]=0,t[1]=0),t}(function(){var t=Qf();return function(e,r,i,n,a,s){var o,l;for(r||=2,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 it=8192;var Hu="__$json__:";function Wr(t){return t instanceof Error?t:Error(typeof t=="string"?t:String(t))}function td(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 ed(t,e,r,i){return $f(t,e,r,i)}var mw=ed(.25,.1,.25,1);function Hr(t,e,r){return Math.min(r,Math.max(e,t))}function rd(t,e,r){let i=r-e,n=((t-e)%i+i)%i+e;return n===e?r:n}function Tt(t,...e){for(let r of e)for(let i in r)t[i]=r[i];return t}function id(t){return Math.log(t)/Math.LN2%1==0}function dn(t,e,r){let i={};for(let n in t)i[n]=e.call(r||this,t[n],n,t);return i}function nd(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 de(t){return Array.isArray(t)?t.map(de):typeof t=="object"&&t?dn(t,de):t}var Qo={};function gt(t){Qo[t]||(typeof console<"u"&&console.warn(t),Qo[t]=!0)}function ye(t,e,r){return(r.y-t.y)*(e.x-t.x)>(e.y-t.y)*(r.x-t.x)}function Be(t){return typeof WorkerGlobalScope<"u"&&t!==void 0&&t instanceof WorkerGlobalScope}function yn(t){return typeof ImageBitmap<"u"&&t instanceof ImageBitmap}function ad(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 sd(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,ad(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 Ar,Dr;function od(t,e,r,i,n){let a=t.width,s=t.height;(!Ar||!Dr)&&(Ar=new OffscreenCanvas(a,s),Dr=Ar.getContext("2d",{willReadFrequently:!0})),Ar.width=a,Ar.height=s,Dr.drawImage(t,0,0,a,s);let o=Dr.getImageData(e,r,i,n);return Dr.clearRect(0,0,a,s),o.data}async function Ku(t,e,r,i,n){if(Uf())try{return await sd(t,e,r,i,n)}catch{}return od(t,e,r,i,n)}function tl(t,e,r,i){return t.addEventListener(e,r,i),{unsubscribe:()=>{t.removeEventListener(e,r,i)}}}function el(t){return t*Math.PI/180}var rl="AbortError",Ms=class extends Error{constructor(t=rl){super(t instanceof Error?t.message:t),this.name=rl,t instanceof Error&&t.stack&&(this.stack=t.stack)}};function Cs(t){return t instanceof Error&&t.name==="AbortError"}function ld(t){if(t.aborted)throw new Ms(t.reason)}var Bs={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function ud(t){return Bs.REGISTERED_PROTOCOLS[t.substring(0,t.indexOf("://"))]}function Ju(t,e){Bs.REGISTERED_PROTOCOLS[t]=e}function Qu(t){delete Bs.REGISTERED_PROTOCOLS[t]}var il="global-dispatcher",Ji=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 th(){if(Be(self))return self.worker?.referrer;if(window.location.protocol==="blob:")try{return window.parent.location.href}catch{}return window.location.href}var hd=t=>t.startsWith("file:")||th()?.startsWith("file:")&&!/^\\w+:/.test(t);async function cd(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:th(),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 Cs(s)?s:new Ji(0,Wr(s).message,t.url,new Blob)}if(!i.ok){let s=await i.blob();throw new Ji(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 ld(e.signal),{data:a,cacheControl:i.headers.get("Cache-Control"),expires:i.headers.get("Expires"),etag:i.headers.get("ETag")}}function pd(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 Ji(n.status,n.statusText,t.url,a))}},e.signal.addEventListener("abort",()=>{n.abort(),i(new Ms(e.signal.reason))}),n.send(t.body)})}var mn=async function(t,e){if(t.url.includes("://")&&!/^https?:|^file:/.test(t.url)){let r=ud(t.url);if(r){let i=await r(t,e);return!i.data&&t.type==="arrayBuffer"?Tt(i,{data:new ArrayBuffer(0)}):i}if(Be(self)&&self.worker?.actor)return self.worker.actor.sendAsync({type:"GR",data:t,targetMapId:il},e)}if(!hd(t.url)){if(fetch&&Request&&AbortController&&Object.hasOwn(Request.prototype,"signal"))return cd(t,e);if(Be(self)&&self.worker?.actor)return self.worker.actor.sendAsync({type:"GR",data:t,mustQueue:!0,targetMapId:il},e)}return pd(t,e)},eh=(t,e)=>mn(Tt(t,{type:"json"}),e),rh=(t,e)=>mn(Tt(t,{type:"arrayBuffer"}),e);function nl(t,e,r){r[t]?.includes(e)||(r[t]||=[],r[t].push(e))}function Wn(t,e,r){if(r?.[t]){let i=r[t].indexOf(e);i!==-1&&r[t].splice(i,1)}}var ih=class{constructor(t,e={}){Tt(this,e),this.type=t}},Qi=class extends ih{constructor(t,e={}){super("error",Tt({error:t},e))}},fd=class{on(t,e){return this._listeners||={},nl(t,e,this._listeners),{unsubscribe:()=>{this.off(t,e)}}}off(t,e){return Wn(t,e,this._listeners),Wn(t,e,this._oneTimeListeners),this}once(t,e){return e?(this._oneTimeListeners||={},nl(t,e,this._oneTimeListeners),this):new Promise(r=>this.once(t,r))}fire(t,e){let r=typeof t=="string"?new ih(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)Wn(i,o,this._oneTimeListeners),o.call(this,r);let s=this._eventedParent;s&&(Tt(r,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),s.fire(r))}else r instanceof Qi&&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}},nh={$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,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-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"}]}}}}},_=nh,ah=["type","source","source-layer","minzoom","maxzoom","filter","layout"],T=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__)}},ci={kind:"null"},k={kind:"number"},N={kind:"string"},Y={kind:"boolean"},Ut={kind:"color"},gn={kind:"projectionDefinition"},Ie={kind:"object"},q={kind:"value"},dd={kind:"error"},xn={kind:"collator"},pi={kind:"formatted"},vn={kind:"padding"},Kr={kind:"colorArray"},bn={kind:"numberArray"},fi={kind:"resolvedImage"},wn={kind:"variableAnchorOffsetCollection"};function St(t,e){return{kind:"array",itemType:t,N:e}}function rt(t){if(t.kind==="array"){let e=rt(t.itemType);return typeof t.N=="number"?`array<${e}, ${t.N}>`:t.itemType.kind==="value"?"array":`array<${e}>`}return t.kind}var yd=[ci,k,N,Y,Ut,gn,pi,Ie,St(q),vn,bn,Kr,fi,wn];function Jr(t,e){if(e.kind==="error")return null;if(t.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!Jr(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 yd)if(!Jr(r,e))return null}}return`Expected ${rt(t)} but found ${rt(e)} instead.`}function Ps(t,e){return e.some(r=>r.kind===t.kind)}function Me(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 sh=.96422,oh=.82521,lh=4/29,ga=6/29,uh=3*ga*ga,md=Math.PI/180,gd=180/Math.PI;function hh(t){return t%=360,t<0&&(t+=360),t}function ch([t,e,r,i]){t=Hn(t),e=Hn(e),r=Hn(r);let n,a,s=Kn((.2225045*t+.7168786*e+.0606169*r)/1);t===e&&e===r?n=a=s:(n=Kn((.4360747*t+.3850649*e+.1430804*r)/sh),a=Kn((.0139322*t+.0971045*e+.7141733*r)/oh));let o=116*s-16;return[o<0?0:o,500*(n-s),200*(s-a),i]}function Hn(t){return t<=.04045?t/12.92:((t+.055)/1.055)**2.4}function Kn(t){return t>.008856451679035631?t**(1/3):t/uh+lh}function ph([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*Qn(n),a=sh*Qn(a),s=oh*Qn(s),[Jn(3.1338561*a-1.6168667*n-.4906146*s),Jn(-.9787684*a+1.9161415*n+.033454*s),Jn(.0719453*a-.2289914*n+1.4052427*s),i]}function Jn(t){return t=t<=.00304?12.92*t:1.055*t**(1/2.4)-.055,t<0?0:t>1?1:t}function Qn(t){return t>ga?t*t*t:uh*(t-lh)}function xd(t){let[e,r,i,n]=ch(t),a=Math.sqrt(r*r+i*i);return[Math.round(a*1e4)?hh(Math.atan2(i,r)*gd):NaN,a,e,n]}function vd([t,e,r,i]){return t=isNaN(t)?0:t*md,ph([r,Math.cos(t)*e,Math.sin(t)*e,i])}function bd([t,e,r,i]){t=hh(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 wd=Object.hasOwn||function(t,e){return Object.prototype.hasOwnProperty.call(t,e)};function Ur(t,e){return wd(t,e)?t[e]:void 0}function _d(t){if(t=t.toLowerCase().trim(),t==="transparent")return[0,0,0,0];let e=Ur(Sd,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[Fi(t.slice(n,n+=i)),Fi(t.slice(n,n+=i)),Fi(t.slice(n,n+=i)),Fi(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=[We(+a/x,0,1),We(+l/x,0,1),We(+c/x,0,1),d?al(+d,y):1];if(sl(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,We(+s,0,100),We(+l,0,100),h?al(+h,c):1];if(sl(f))return bd(f)}}}function Fi(t){return parseInt(t.padEnd(2,t),16)/255}function al(t,e){return We(e?t/100:t,0,1)}function We(t,e,r){return Math.min(Math.max(e,t),r)}function sl(t){return!t.some(Number.isNaN)}var Sd={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 me(t,e,r){return t+r*(e-t)}function hr(t,e,r){return t.map((i,n)=>me(i,e[n],r))}function Ad(t){return t==="rgb"||t==="hcl"||t==="lab"}var nt=class Yt{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{this.black=new Yt(0,0,0,1)}static{this.white=new Yt(1,1,1,1)}static{this.transparent=new Yt(0,0,0,0)}static{this.red=new Yt(1,0,0,1)}static parse(e){if(e instanceof Yt)return e;if(typeof e!="string")return;let r=_d(e);if(r)return new Yt(...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",xd(this.rgb))}get lab(){return this.overwriteGetter("lab",ch(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]=hr(e.rgb,r.rgb,i);return new Yt(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]=vd([f,d??me(s,h,i),me(o,c,i),me(l,p,i)]);return new Yt(y,m,g,x,!1)}case"lab":{let[a,s,o,l]=ph(hr(e.lab,r.lab,i));return new Yt(a,s,o,l,!1)}}}},Dd=["bottom","center","top"],xa=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}},oe=class Gi{constructor(e){this.sections=e}static fromString(e){return new Gi([new xa(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 Gi?e:Gi.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}},Qt=class Pr{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Pr)return e;if(typeof e=="number")return new Pr([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 Pr(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,r,i){return new Pr(hr(e.values,r.values,i))}},te=class zr{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof zr)return e;if(typeof e=="number")return new zr([e]);if(Array.isArray(e)){for(let r of e)if(typeof r!="number")return;return new zr(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,r,i){return new zr(hr(e.values,r.values,i))}},Ot=class Lr{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Lr)return e;if(typeof e=="string"){let i=nt.parse(e);return i?new Lr([i]):void 0}if(!Array.isArray(e))return;let r=[];for(let i of e){if(typeof i!="string")return;let n=nt.parse(i);if(!n)return;r.push(n)}return new Lr(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(nt.interpolate(e.values[s],r.values[s],i,n));return new Lr(a)}},Q=class extends Error{constructor(t,e){super(t),this.name="RuntimeError",this.path=e}toJSON(){return this.message}},Ed=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]),Ht=class ji{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof ji)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"||!Ed.has(i)||!Array.isArray(n)||n.length!==2||typeof n[0]!="number"||typeof n[1]!="number")return}return new ji(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 Q(`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 Q(`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([me(u,c,i),me(h,p,i)])}return new ji(o)}},Kt=class fh{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new fh({name:e,available:!1}):null}},Oe=class He{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 He(e,r,i)}static parse(e){if(e instanceof He)return e;if(Array.isArray(e)&&e.length===3&&typeof e[0]=="string"&&typeof e[1]=="string"&&typeof e[2]=="number")return new He(e[0],e[1],e[2]);if(typeof e=="object"&&typeof e.from=="string"&&typeof e.to=="string"&&typeof e.transition=="number")return new He(e.from,e.to,e.transition);if(typeof e=="string")return new He(e,e,1)}},zs=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 dh(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 cr(t){if(t===null||typeof t=="string"||typeof t=="boolean"||typeof t=="number"||t instanceof Oe||t instanceof nt||t instanceof zs||t instanceof oe||t instanceof Qt||t instanceof te||t instanceof Ot||t instanceof Ht||t instanceof Kt)return!0;if(Array.isArray(t)){for(let e of t)if(!cr(e))return!1;return!0}if(typeof t=="object"){for(let e in t)if(!cr(t[e]))return!1;return!0}return!1}function lt(t){if(t===null)return ci;if(typeof t=="string")return N;if(typeof t=="boolean")return Y;if(typeof t=="number")return k;if(t instanceof nt)return Ut;if(t instanceof Oe)return gn;if(t instanceof zs)return xn;if(t instanceof oe)return pi;if(t instanceof Qt)return vn;if(t instanceof te)return bn;if(t instanceof Ot)return Kr;if(t instanceof Ht)return wn;if(t instanceof Kt)return fi;if(Array.isArray(t)){let e=t.length,r;for(let i of t){let n=lt(i);if(!r)r=n;else{if(r===n)continue;r=q;break}}return St(r||q,e)}return Ie}function qr(t){let e=typeof t;return t===null?"":e==="string"||e==="number"||e==="boolean"?String(t):t instanceof nt||t instanceof Oe||t instanceof oe||t instanceof Qt||t instanceof te||t instanceof Ot||t instanceof Ht||t instanceof Kt?t.toString():JSON.stringify(t)}var pr=class yh{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(!cr(e[1]))return r.error(`invalid value of type "${typeof e[1]}"`);let i=e[1],n=lt(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 yh(n,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}},Td=["Unknown","Point","LineString","Polygon"],mh=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"?Td[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=nt.parse(t),this._parseColorCache.set(t,e)),e}};function _n(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 Q("Input is not a number.",r);return 0}var Ls=class gh{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,k);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||=c.type,n.push([o,c])}return new gh(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[_n(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 Fd(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 Zt=class va{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=ta(r,e.base,i,n);else if(e.name==="linear")a=ta(r,1,i,n);else if(e.name==="cubic-bezier"){let s=e.controlPoints;a=Fd(s[0],s[1],s[2],s[3])(ta(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,k),!a)return null;let o=[],l=null;(i==="interpolate-hcl"||i==="interpolate-lab")&&r.expectedType!=Kr?l=Ut: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||=d.type,o.push([h,d])}return!ue(l,k)&&!ue(l,gn)&&!ue(l,Ut)&&!ue(l,vn)&&!ue(l,bn)&&!ue(l,Kr)&&!ue(l,wn)&&!ue(l,St(k))?r.error(`Type ${rt(l)} is not interpolatable.`):new va(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=_n(r,n,this.key),o=r[s],l=r[s+1],u=va.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 me(h,c,u);case"color":return nt.interpolate(h,c,u);case"padding":return Qt.interpolate(h,c,u);case"colorArray":return Ot.interpolate(h,c,u);case"numberArray":return te.interpolate(h,c,u);case"variableAnchorOffsetCollection":return Ht.interpolate(h,c,u,this.key);case"array":return hr(h,c,u);case"projectionDefinition":return Oe.interpolate(h,c,u)}case"interpolate-hcl":switch(this.type.kind){case"color":return nt.interpolate(h,c,u,"hcl");case"colorArray":return Ot.interpolate(h,c,u,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return nt.interpolate(h,c,u,"lab");case"colorArray":return Ot.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 ta(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 Pe={color:nt.interpolate,number:me,padding:Qt.interpolate,numberArray:te.interpolate,colorArray:Ot.interpolate,variableAnchorOffsetCollection:Ht.interpolate,array:hr},xh=class vh{constructor(e){this.type=pi,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,k),!l))return null;let u=null;if(o["text-font"]&&(u=r.parse(o["text-font"],1,St(N)),!u))return null;let h=null;if(o["text-color"]&&(h=r.parse(o["text-color"],1,Ut),!h))return null;let c=null;if(o["vertical-align"]){if(typeof o["vertical-align"]=="string"&&!Dd.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,N),!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,q);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 vh(n)}evaluate(e){return new oe(this.sections.map(r=>{let i=r.content.evaluate(e);return lt(i)===fi?new xa("",i,null,null,null,r.verticalAlign?r.verticalAlign.evaluate(e):null):new xa(qr(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 bh(t,e,r=0,i=t.length-1,n=kd){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);bh(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(Er(t,r,e),n(t[i],a)>0&&Er(t,r,i);s<o;){for(Er(t,s,o),s++,o--;n(t[s],a)<0;)s++;for(;n(t[o],a)>0;)o--}n(t[r],a)===0?Er(t,r,o):(o++,Er(t,o,i)),o<=e&&(r=o+1),e<=o&&(i=o-1)}}function Er(t,e,r){let i=t[e];t[e]=t[r],t[r]=i}function kd(t,e){return t<e?-1:+(t>e)}function Sn(t,e){if(t.length<=1)return[t];let r=[],i,n;for(let a of t){let s=Md(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||(bh(r[a],e,1,r[a].length-1,Id),r[a]=r[a].slice(0,e));return r}function Id(t,e){return e.area-t.area}function Md(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 ki={string:N,number:k,boolean:Y,object:Ie},ie=class wh{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 ki)||u==="object")return r.error(\'The item type argument of "array" must be one of string, number, boolean\',1);o=ki[u],i++}else o=q;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=St(o,l)}else{if(!ki[a])throw Error(`Types doesn\'t contain name = ${a}`);n=ki[a]}let s=[];for(;i<e.length;i++){let o=r.parse(e[i],i,q);if(!o)return null;s.push(o)}return new wh(n,s,r.key)}evaluate(e){for(let r=0;r<this.args.length;r++){let i=this.args[r].evaluate(e);if(!Jr(this.type,lt(i)))return i;if(r===this.args.length-1)throw new Q(`Expected value to be of type ${rt(this.type)}, but found ${rt(lt(i))} instead.`,this.key)}throw Error()}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}},ol={"to-boolean":Y,"to-color":Ut,"to-number":k,"to-string":N},tr=class _h{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(!ol[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=ol[i],a=[];for(let s=1;s<e.length;s++){let o=r.parse(e[s],s,q);if(!o)return null;a.push(o)}return new _h(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 nt)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.`:dh(r[0],r[1],r[2],r[3]),!i))return new nt(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new Q(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=Qt.parse(r);if(n)return n}throw new Q(`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=te.parse(r);if(n)return n}throw new Q(`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=Ot.parse(r);if(n)return n}throw new Q(`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=Ht.parse(r);if(n)return n}throw new Q(`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 Q(`Could not convert ${JSON.stringify(r)} to number.`,this.key)}case"formatted":return oe.fromString(qr(this.args[0].evaluate(e)));case"resolvedImage":return Kt.fromString(qr(this.args[0].evaluate(e)));case"projectionDefinition":{let r=this.args[0].evaluate(e);if(Oe.parse(r))return r;throw new Q(`Could not parse projectionDefinition from value \'${typeof r=="string"?r:JSON.stringify(r)}\'`,this.key)}default:return qr(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}},Sh=class Ah{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 Ah(i,n):null}outputDefined(){return this.result.outputDefined()}},Dh=class Eh{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 Eh(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}},Cd=class Th{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,k),n=r.parse(e[2],2,St(r.expectedType||q));if(!i||!n)return null;let a=n.type;return new Th(a.itemType,i,n,r.key)}evaluate(e){let r=this.index.evaluate(e),i=this.input.evaluate(e);if(r<0)throw new Q(`Array index out of bounds: ${r} < 0.`,this.key);if(r>=i.length)throw new Q(`Array index out of bounds: ${r} > ${i.length-1}.`,this.key);if(r!==Math.floor(r))throw new Q(`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}},Bd=class Fh{constructor(e,r,i){this.needle=e,this.haystack=r,this.key=i,this.type=Y}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,q),n=r.parse(e[2],2,q);return!i||!n?null:Ps(i.type,[Y,N,k,ci,q])?new Fh(i,n,r.key):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${rt(i.type)} instead`)}evaluate(e){let r=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(!i)return!1;if(!Me(r,["boolean","string","number","null"]))throw new Q(`Expected first argument to be of type boolean, string, number or null, but found ${rt(lt(r))} instead.`,this.key);if(!Me(i,["string","array"]))throw new Q(`Expected second argument to be of type array or string, but found ${rt(lt(i))} instead.`,this.key);return i.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}},Pd=class ba{constructor(e,r,i,n){this.needle=e,this.haystack=r,this.key=i,this.fromIndex=n,this.type=k}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,q),n=r.parse(e[2],2,q);if(!i||!n)return null;if(!Ps(i.type,[Y,N,k,ci,q]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${rt(i.type)} instead`);if(e.length===4){let a=r.parse(e[3],3,k);return a?new ba(i,n,r.key,a):null}return new ba(i,n,r.key)}evaluate(e){let r=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(!Me(r,["boolean","string","number","null"]))throw new Q(`Expected first argument to be of type boolean, string, number or null, but found ${rt(lt(r))} instead.`,this.key);let n;if(this.fromIndex&&(n=this.fromIndex.evaluate(e)),Me(i,["string"])){let a=i.indexOf(r,n);return a===-1?-1:[...i.slice(0,a)].length}if(Me(i,["array"]))return i.indexOf(r,n);throw new Q(`Expected second argument to be of type array or string, but found ${rt(lt(i))} instead.`,this.key)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}},zd=class kh{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=lt(d);else if(p.checkSubtype(i,lt(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||=f.type,s.push(f)}let o=r.parse(e[1],1,q);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 kh(i,n,o,a,s,l)}evaluate(e){let r=this.input.evaluate(e);return(lt(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}},Ld=class Ih{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,Y);if(!o)return null;let l=r.parse(e[s+1],s+1,i);if(!l)return null;n.push([o,l]),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 Ih(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()}},Vd=class wa{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,q),n=r.parse(e[2],2,k);if(!i||!n)return null;if(!Ps(i.type,[St(q),N,q]))return r.error(`Expected first argument to be of type array or string, but found ${rt(i.type)} instead`);if(e.length===4){let a=r.parse(e[3],3,k);return a?new wa(i.type,i,n,r.key,a):null}return new wa(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)),Me(r,["string"]))return[...r].slice(i,n).join("");if(Me(r,["array"]))return r.slice(i,n);throw new Q(`Expected first argument to be of type array or string, but found ${rt(lt(r))} instead.`,this.key)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}},Mh=class _a{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||=o.type,a.push(o)}if(!i)throw Error("No output type");return n&&a.some(s=>Jr(n,s.type))?new _a(q,a):new _a(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 Kt&&!r.available&&(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 ll(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 Od(t,e,r){return e===r}function Rd(t,e,r){return e!==r}function $d(t,e,r){return e<r}function Nd(t,e,r){return e>r}function Ud(t,e,r){return e<=r}function qd(t,e,r){return e>=r}function Ch(t,e,r,i){return i.compare(e,r)===0}function Gd(t,e,r,i){return!Ch(t,e,r,i)}function jd(t,e,r,i){return i.compare(e,r)<0}function Yd(t,e,r,i){return i.compare(e,r)>0}function Xd(t,e,r,i){return i.compare(e,r)<=0}function Zd(t,e,r,i){return i.compare(e,r)>=0}function xr(t,e,r){let i=t!=="=="&&t!=="!=";return class Bh{constructor(a,s,o,l){this.lhs=a,this.rhs=s,this.key=o,this.collator=l,this.type=Y,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,q);if(!l)return null;if(!ll(o,l.type))return s.concat(1).error(`"${o}" comparisons are not supported for type \'${rt(l.type)}\'.`);let u=s.parse(a[2],2,q);if(!u)return null;if(!ll(o,u.type))return s.concat(2).error(`"${o}" comparisons are not supported for type \'${rt(u.type)}\'.`);if(l.type.kind!==u.type.kind&&l.type.kind!=="value"&&u.type.kind!=="value")return s.error(`Cannot compare types \'${rt(l.type)}\' and \'${rt(u.type)}\'.`);i&&(l.type.kind==="value"&&u.type.kind!=="value"?l=new ie(u.type,[l],s.key):l.type.kind!=="value"&&u.type.kind==="value"&&(u=new ie(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,xn),!h)return null}return new Bh(l,u,s.key,h)}evaluate(a){let s=this.lhs.evaluate(a),o=this.rhs.evaluate(a);if(i&&this.hasUntypedArgument){let l=lt(s),u=lt(o);if(l.kind!==u.kind||l.kind!=="string"&&l.kind!=="number")throw new Q(`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=lt(s),u=lt(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 Wd=xr("==",Od,Ch),Hd=xr("!=",Rd,Gd),Kd=xr("<",$d,jd),Jd=xr(">",Nd,Yd),Qd=xr("<=",Ud,Xd),ty=xr(">=",qd,Zd),Ph=class zh{constructor(e,r,i){this.type=xn,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,Y);if(!n)return null;let a=r.parse(i["diacritic-sensitive"]!==void 0&&i["diacritic-sensitive"],1,Y);if(!a)return null;let s=null;return i.locale&&(s=r.parse(i.locale,1,N),!s)?null:new zh(n,a,s)}evaluate(e){return new zs(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}},ey=class Lh{constructor(e,r,i,n,a,s){this.type=N,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,k);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,N),!a))return null;let s=null;if(n.currency&&(s=r.parse(n.currency,1,N),!s))return null;let o=null;if(n.unit&&(o=r.parse(n.unit,1,N),!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,k),!l))return null;let u=null;return n["max-fraction-digits"]&&(u=r.parse(n["max-fraction-digits"],1,k),!u)?null:new Lh(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}},ry=class Vh{constructor(e){this.type=fi,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected two arguments.");let i=r.parse(e[1],1,N);return i?new Vh(i):r.error("No image name provided.")}evaluate(e){let r=this.input.evaluate(e),i=Kt.fromString(r);return i&&e.availableImages&&(i.available=e.availableImages.indexOf(r)>-1),i}eachChild(e){e(this.input)}outputDefined(){return!1}},iy=class Oh{constructor(e,r){this.input=e,this.key=r,this.type=k}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 ${rt(i.type)} instead.`):new Oh(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 Q(`Expected value to be of type string or array, but found ${rt(lt(r))} instead.`,this.key)}eachChild(e){e(this.input)}outputDefined(){return!1}},Wt=8192;function ny(t,e){let r=ay(t[0]),i=oy(t[1]),n=2**e.z;return[Math.round(r*n*Wt),Math.round(i*n*Wt)]}function Vs(t,e){let r=2**e.z,i=(t[0]/Wt+e.x)/r,n=(t[1]/Wt+e.y)/r;return[sy(i),ly(n)]}function ay(t){return(180+t)/360}function sy(t){return t*360-180}function oy(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function ly(t){return 360/Math.PI*Math.atan(Math.exp((180-t*360)*Math.PI/180))-90}function di(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 Qr(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function uy(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 hy(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 An(t,e,r,i){let n=[e[0]-t[0],e[1]-t[1]];return dy([i[0]-r[0],i[1]-r[1]],n)!==0&&!!(ul(t,e,r,i)&&ul(r,i,t,e))}function cy(t,e,r){for(let i of r)for(let n=0;n<i.length-1;++n)if(An(t,e,i[n],i[n+1]))return!0;return!1}function vr(t,e,r=!1){let i=!1;for(let n of e)for(let a=0;a<n.length-1;a++){if(hy(t,n[a],n[a+1]))return r;uy(t,n[a],n[a+1])&&(i=!i)}return i}function py(t,e){for(let r of e)if(vr(t,r))return!0;return!1}function Rh(t,e){for(let r of t)if(!vr(r,e))return!1;for(let r=0;r<t.length-1;++r)if(cy(t[r],t[r+1],e))return!1;return!0}function fy(t,e){for(let r of e)if(Rh(t,r))return!0;return!1}function dy(t,e){return t[0]*e[1]-t[1]*e[0]}function ul(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 Os(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=ny(t[n][s],r);di(e,o),a.push(o)}i.push(a)}return i}function $h(t,e,r){let i=[];for(let n=0;n<t.length;n++){let a=Os(t[n],e,r);i.push(a)}return i}function Nh(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}di(e,t)}function yy(t){t[0]=t[1]=1/0,t[2]=t[3]=-1/0}function hl(t,e,r,i){let n=2**i.z*Wt,a=[i.x*Wt,i.y*Wt],s=[];for(let o of t)for(let l of o){let u=[l.x+a[0],l.y+a[1]];Nh(u,e,r,n),s.push(u)}return s}function cl(t,e,r,i){let n=2**i.z*Wt,a=[i.x*Wt,i.y*Wt],s=[];for(let o of t){let l=[];for(let u of o){let h=[u.x+a[0],u.y+a[1]];di(e,h),l.push(h)}s.push(l)}if(e[2]-e[0]<=n/2){yy(e);for(let o of s)for(let l of o)Nh(l,e,r,n)}return s}function my(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=Os(e.coordinates,i,n),s=hl(t.geometry(),r,i,n);if(!Qr(r,i))return!1;for(let o of s)if(!vr(o,a))return!1}if(e.type==="MultiPolygon"){let a=$h(e.coordinates,i,n),s=hl(t.geometry(),r,i,n);if(!Qr(r,i))return!1;for(let o of s)if(!py(o,a))return!1}return!0}function gy(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=Os(e.coordinates,i,n),s=cl(t.geometry(),r,i,n);if(!Qr(r,i))return!1;for(let o of s)if(!Rh(o,a))return!1}if(e.type==="MultiPolygon"){let a=$h(e.coordinates,i,n),s=cl(t.geometry(),r,i,n);if(!Qr(r,i))return!1;for(let o of s)if(!fy(o,a))return!1}return!0}var Rs=class Yi{constructor(e,r){this.type=Y,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(cr(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 Yi(i,{type:"MultiPolygon",coordinates:n})}else if(i.type==="Feature"){let n=i.geometry.type;if(n==="Polygon"||n==="MultiPolygon")return new Yi(i,i.geometry)}else if(i.type==="Polygon"||i.type==="MultiPolygon")return new Yi(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 my(e,this.geometries);if(e.geometryType()==="LineString")return gy(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}},Uh=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}},pl=Math.PI/180,$s=class{constructor(t){let e=pl*6378.137*1e3,r=Math.cos(t*pl),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 qh(t,e){return e[0]-t[0]}function tn(t){return t[1]-t[0]+1}function le(t,e){return t[1]>=t[0]&&t[1]<e}function Sa(t,e){if(t[0]>t[1])return[null,null];let r=tn(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 Aa(t,e){if(!le(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)di(r,t[i]);return r}function Da(t){let e=[1/0,1/0,-1/0,-1/0];for(let r of t)for(let i of r)di(e,i);return e}function fl(t){return t[0]!==-1/0&&t[1]!==-1/0&&t[2]!==1/0&&t[3]!==1/0}function Ns(t,e,r){if(!fl(t)||!fl(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 Te(t,e,r){let i=r.pointOnLine(e,t);return r.distance(t,i.point)}function Us(t,e,r,i,n){let a=Math.min(Te(t,[r,i],n),Te(e,[r,i],n)),s=Math.min(Te(r,[t,e],n),Te(i,[t,e],n));return Math.min(a,s)}function xy(t,e,r,i,n){if(!(le(e,t.length)&&le(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(An(o,l,h,c))return 0;a=Math.min(a,Us(o,l,h,c,n))}}return a}function vy(t,e,r,i,n){if(!(le(e,t.length)&&le(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 by(t,e,r){if(vr(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,Te(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 wy(t,e,r,i){if(!le(e,t.length))return NaN;for(let a=e[0];a<=e[1];++a)if(vr(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(An(s,o,p,f))return 0;n=Math.min(n,Us(s,o,p,f,i))}}return n}function dl(t,e){for(let r of t)for(let i of r)if(vr(i,e,!0))return!0;return!1}function _y(t,e,r,i=1/0){let n=Da(t),a=Da(e);if(i!==1/0&&Ns(n,a,r)>=i)return i;if(Qr(n,a)){if(dl(t,e))return 0}else if(dl(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(An(c,p,g,x))return 0;s=Math.min(s,Us(c,p,g,x,r))}}return s}function yl(t,e,r,i,n,a){if(!a)return;let s=Ns(Aa(i,a),n,r);s<e&&t.push([s,a,[0,0]])}function Ii(t,e,r,i,n,a,s){if(!a||!s)return;let o=Ns(Aa(i,a),Aa(n,s),r);o<e&&t.push([o,a,s])}function en(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 Uh([[0,[0,t.length-1],[0,0]]],qh),o=Da(r);for(;s.length>0;){let l=s.pop();if(l[0]>=a)continue;let u=l[1],h=e?50:100;if(tn(u)<=h){if(!le(u,t.length))return NaN;if(e){let c=wy(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=by(t[c],r,i);if(a=Math.min(a,p),a===0)return 0}}else{let c=Sa(u,e);yl(s,a,i,t,o,c[0]),yl(s,a,i,t,o,c[1])}}return a}function rn(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 Uh([[0,[0,t.length-1],[0,r.length-1]]],qh);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(tn(u)<=c&&tn(h)<=p){if(!le(u,t.length)&&le(h,r.length))return NaN;let f;if(e&&i)f=xy(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=Te(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=Te(t[y],d,n),s=Math.min(s,f),s===0)return s}else f=vy(t,u,r,h,n),s=Math.min(s,f)}else{let f=Sa(u,e),d=Sa(h,i);Ii(o,s,n,t,r,f[0],d[0]),Ii(o,s,n,t,r,f[0],d[1]),Ii(o,s,n,t,r,f[1],d[0]),Ii(o,s,n,t,r,f[1],d[1])}}return s}function Sy(t,e){let r=t.geometry(),i=r.flat().map(s=>Vs([s.x,s.y],t.canonical));if(r.length===0)return NaN;let n=new $s(i[0][1]),a=1/0;for(let s of e){switch(s.type){case"Point":a=Math.min(a,rn(i,!1,[s.coordinates],!1,n,a));break;case"LineString":a=Math.min(a,rn(i,!1,s.coordinates,!0,n,a));break;case"Polygon":a=Math.min(a,en(i,!1,s.coordinates,n,a))}if(a===0)return a}return a}function Ay(t,e){let r=t.geometry(),i=r.flat().map(s=>Vs([s.x,s.y],t.canonical));if(r.length===0)return NaN;let n=new $s(i[0][1]),a=1/0;for(let s of e){switch(s.type){case"Point":a=Math.min(a,rn(i,!0,[s.coordinates],!1,n,a));break;case"LineString":a=Math.min(a,rn(i,!0,s.coordinates,!0,n,a));break;case"Polygon":a=Math.min(a,en(i,!0,s.coordinates,n,a))}if(a===0)return a}return a}function Dy(t,e){let r=t.geometry();if(r.length===0||r[0].length===0)return NaN;let i=Sn(r,0).map(s=>s.map(o=>o.map(l=>Vs([l.x,l.y],t.canonical)))),n=new $s(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,en([s.coordinates],!1,o,n,a));break;case"LineString":a=Math.min(a,en(s.coordinates,!0,o,n,a));break;case"Polygon":a=Math.min(a,_y(o,s.coordinates,n,a))}if(a===0)return a}return a}function ea(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 qs=class Xi{constructor(e,r){this.type=k,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(cr(e[1])){let i=e[1];if(i.type==="FeatureCollection")return new Xi(i,i.features.map(n=>ea(n.geometry)).flat());if(i.type==="Feature")return new Xi(i,ea(i.geometry));if("type"in i&&"coordinates"in i)return new Xi(i,ea(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 Sy(e,this.geometries);if(e.geometryType()==="LineString")return Ay(e,this.geometries);if(e.geometryType()==="Polygon")return Dy(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}},Ey=class Gh{constructor(e){let r=null;for(let i of e)if(!r)r=i.type;else{if(r===i.type)continue;r=q;break}this.type=St(r??q,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(!cr(e[1]))return r.error(`invalid value of type "${typeof e[1]}"`);let i=e[1],n=lt(i);if(n.kind==="array"){let a=i.map(s=>r.parse(s,null,q));return new Gh(a)}return new pr(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())}},Gs=class jh{constructor(e){this.key=e,this.type=q}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 jh(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:Ur(r,this.key)??null}eachChild(){}outputDefined(){return!1}},ir={"==":Wd,"!=":Hd,">":Jd,"<":Kd,">=":ty,"<=":Qd,array:ie,at:Cd,boolean:ie,case:Ld,coalesce:Mh,collator:Ph,format:xh,image:ry,in:Bd,"index-of":Pd,interpolate:Zt,"interpolate-hcl":Zt,"interpolate-lab":Zt,length:iy,let:Sh,literal:pr,match:zd,number:ie,"number-format":ey,object:ie,semiliteral:Ey,slice:Vd,step:Ls,string:ie,"to-boolean":tr,"to-color":tr,"to-number":tr,"to-string":tr,var:Dh,within:Rs,distance:qs,"global-state":Gs},Xt=class extends Error{constructor(t,e){super(e),this.message=e,this.key=t}},Ty=class Yh{constructor(e,r=[]){this.parent=e,this.bindings={};for(let[i,n]of r)this.bindings[i]=n}concat(e){return new Yh(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}},Xh=class Zh{constructor(e,r,i=[],n,a=new Ty,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 ie(s,[a],i):o==="coerce"?new tr(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 pr)&&o.type.kind!=="resolvedImage"&&this._isConstant(o)){let l=new mh;try{o=new pr(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 Zh(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 Xt(i,e))}checkSubtype(e,r){let i=Jr(e,r);return i&&this.error(i),i}},Re=class Vr{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=Vr.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 Xh(r.registry,nn,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 Vr(i,a,h,c,r.key)}}if(o.length===1)r.errors.push(...l.errors);else{let u=(o.length?o:s).map(([c])=>ky(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(rt(p.type))}r.error(`Expected arguments of type ${u}, but found (${h.join(", ")}) instead.`)}return null}static register(e,r){Vr.definitions=r;for(let i in r)e[i]=Vr}};function ml(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=dh(e,r,i,s);if(o)throw new Q(o,a);return new nt(e/255,r/255,i/255,s,!1)}function gl(t,e){return t in e&&e[t]!==void 0}function ra(t,e){let r=e[t];return r===void 0?null:r}function Fy(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 Se(t){return{type:t}}Re.register(ir,{error:[dd,[N],(t,[e],r)=>{throw new Q(e.evaluate(t),r)}],typeof:[N,[q],(t,[e])=>rt(lt(e.evaluate(t)))],"to-rgba":[St(k,4),[Ut],(t,[e])=>{let[r,i,n,a]=e.evaluate(t).rgb;return[r*255,i*255,n*255,a]}],rgb:[Ut,[k,k,k],ml],rgba:[Ut,[k,k,k,k],ml],has:{type:Y,overloads:[[[N],(t,[e])=>gl(e.evaluate(t),t.properties())],[[N,Ie],(t,[e,r])=>gl(e.evaluate(t),r.evaluate(t))]]},get:{type:q,overloads:[[[N],(t,[e])=>ra(e.evaluate(t),t.properties())],[[N,Ie],(t,[e,r])=>ra(e.evaluate(t),r.evaluate(t))]]},"feature-state":[q,[N],(t,[e])=>ra(e.evaluate(t),t.featureState||{})],properties:[Ie,[],t=>t.properties()],"geometry-type":[N,[],t=>t.geometryType()],id:[q,[],t=>t.id()],zoom:[k,[],t=>t.globals.zoom],"heatmap-density":[k,[],t=>t.globals.heatmapDensity||0],elevation:[k,[],t=>t.globals.elevation||0],"line-progress":[k,[],t=>t.globals.lineProgress||0],accumulated:[q,[],t=>t.globals.accumulated===void 0?null:t.globals.accumulated],"+":[k,Se(k),(t,e)=>{let r=0;for(let i of e)r+=i.evaluate(t);return r}],"*":[k,Se(k),(t,e)=>{let r=1;for(let i of e)r*=i.evaluate(t);return r}],"-":{type:k,overloads:[[[k,k],(t,[e,r])=>e.evaluate(t)-r.evaluate(t)],[[k],(t,[e])=>-e.evaluate(t)]]},"/":[k,[k,k],(t,[e,r])=>e.evaluate(t)/r.evaluate(t)],"%":[k,[k,k],(t,[e,r])=>e.evaluate(t)%r.evaluate(t)],ln2:[k,[],()=>Math.LN2],pi:[k,[],()=>Math.PI],e:[k,[],()=>Math.E],"^":[k,[k,k],(t,[e,r])=>e.evaluate(t)**+r.evaluate(t)],sqrt:[k,[k],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[k,[k],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[k,[k],(t,[e])=>Math.log(e.evaluate(t))],log2:[k,[k],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[k,[k],(t,[e])=>Math.sin(e.evaluate(t))],cos:[k,[k],(t,[e])=>Math.cos(e.evaluate(t))],tan:[k,[k],(t,[e])=>Math.tan(e.evaluate(t))],asin:[k,[k],(t,[e])=>Math.asin(e.evaluate(t))],acos:[k,[k],(t,[e])=>Math.acos(e.evaluate(t))],atan:[k,[k],(t,[e])=>Math.atan(e.evaluate(t))],min:[k,Se(k),(t,e)=>Math.min(...e.map(r=>r.evaluate(t)))],max:[k,Se(k),(t,e)=>Math.max(...e.map(r=>r.evaluate(t)))],abs:[k,[k],(t,[e])=>Math.abs(e.evaluate(t))],round:[k,[k],(t,[e])=>{let r=e.evaluate(t);return r<0?-Math.round(-r):Math.round(r)}],floor:[k,[k],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[k,[k],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[Y,[N,q],(t,[e,r])=>t.properties()[e.value]===r.value],"filter-id-==":[Y,[q],(t,[e])=>t.id()===e.value],"filter-type-==":[Y,[N],(t,[e])=>t.geometryType()===e.value],"filter-<":[Y,[N,q],(t,[e,r])=>{let i=t.properties()[e.value],n=r.value;return typeof i==typeof n&&i<n}],"filter-id-<":[Y,[q],(t,[e])=>{let r=t.id(),i=e.value;return typeof r==typeof i&&r<i}],"filter->":[Y,[N,q],(t,[e,r])=>{let i=t.properties()[e.value],n=r.value;return typeof i==typeof n&&i>n}],"filter-id->":[Y,[q],(t,[e])=>{let r=t.id(),i=e.value;return typeof r==typeof i&&r>i}],"filter-<=":[Y,[N,q],(t,[e,r])=>{let i=t.properties()[e.value],n=r.value;return typeof i==typeof n&&i<=n}],"filter-id-<=":[Y,[q],(t,[e])=>{let r=t.id(),i=e.value;return typeof r==typeof i&&r<=i}],"filter->=":[Y,[N,q],(t,[e,r])=>{let i=t.properties()[e.value],n=r.value;return typeof i==typeof n&&i>=n}],"filter-id->=":[Y,[q],(t,[e])=>{let r=t.id(),i=e.value;return typeof r==typeof i&&r>=i}],"filter-has":[Y,[q],(t,[e])=>{let r=e.value,i=t.properties();return r in i&&i[r]!==void 0}],"filter-has-id":[Y,[],t=>t.id()!==null&&t.id()!==void 0],"filter-type-in":[Y,[St(N)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[Y,[St(q)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[Y,[N,St(q)],(t,[e,r])=>r.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[Y,[N,St(q)],(t,[e,r])=>Fy(t.properties()[e.value],r.value,0,r.value.length-1)],all:{type:Y,overloads:[[[Y,Y],(t,[e,r])=>e.evaluate(t)&&r.evaluate(t)],[Se(Y),(t,e)=>{for(let r of e)if(!r.evaluate(t))return!1;return!0}]]},any:{type:Y,overloads:[[[Y,Y],(t,[e,r])=>e.evaluate(t)||r.evaluate(t)],[Se(Y),(t,e)=>{for(let r of e)if(r.evaluate(t))return!0;return!1}]]},"!":[Y,[Y],(t,[e])=>!e.evaluate(t)],"is-supported-script":[Y,[N],(t,[e])=>{let r=t.globals&&t.globals.isSupportedScript;return!r||r(e.evaluate(t))}],upcase:[N,[N],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[N,[N],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[N,Se(q),(t,e)=>e.map(r=>qr(r.evaluate(t))).join("")],split:[St(N),[N,N],(t,[e,r])=>e.evaluate(t).split(r.evaluate(t))],join:[N,[St(N),N],(t,[e,r])=>e.evaluate(t).join(r.evaluate(t))],"resolved-locale":[N,[xn],(t,[e])=>e.evaluate(t).resolvedLocale()]});function ky(t){return Array.isArray(t)?`(${t.map(rt).join(", ")})`:`(${rt(t.type)}...)`}function nn(t){if(t instanceof Dh)return nn(t.boundExpression);if(t instanceof Re&&t.name==="error"||t instanceof Ph||t instanceof Rs||t instanceof qs||t instanceof Gs)return!1;let e=t instanceof tr||t instanceof ie,r=!0;return t.eachChild(i=>{r&&=e?nn(i):i instanceof pr}),r?Dn(t)&&En(t,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"]):!1}function Dn(t){if(t instanceof Re&&(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 Rs||t instanceof qs)return!1;let e=!0;return t.eachChild(r=>{e&&!Dn(r)&&(e=!1)}),e}function ti(t){if(t instanceof Re&&t.name==="feature-state")return!1;let e=!0;return t.eachChild(r=>{e&&!ti(r)&&(e=!1)}),e}function En(t,e){if(t instanceof Re&&e.indexOf(t.name)>=0)return!1;let r=!0;return t.eachChild(i=>{r&&!En(i,e)&&(r=!1)}),r}function fr(t){return t["property-type"]==="data-driven"||t["property-type"]==="cross-faded-data-driven"}function Wh(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function js(t){return!!t.expression&&t.expression.interpolated}function ei(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 Tn(t){return typeof t=="object"&&!!t&&!Array.isArray(t)&<(t)===Ie}function Iy(t){return t}function My(t){switch(t.type){case"color":return nt.parse;case"padding":return Qt.parse;case"numberArray":return te.parse;case"colorArray":return Ot.parse;default:return null}}function Cy(t){switch(t){case"exponential":return Kh;case"interval":return Py;case"categorical":return By;case"identity":return zy;default:throw Error(`Unknown function type "${t}"`)}}function Hh(t,e){let r=t.stops&&typeof t.stops[0][0]=="object",i=r||t.property!==void 0,n=r||!i,a=t.type||(js(e)?"exponential":"interval"),s=My(e);if(s&&(t=ei({},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&&!Ad(t.colorSpace))throw Error(`Unknown color space: "${t.colorSpace}"`);let o=Cy(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,Hh(h[d],e)]);let f={name:"linear"};return{kind:"composite",interpolationType:f,interpolationFactor:Zt.interpolationFactor.bind(void 0,f),zoomStops:p.map(d=>d[0]),evaluate({zoom:d},y){return Kh({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:Zt.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?yi(t.default,e.default):o(t,e,p,l,u)}}}function yi(t,e,r){if(t!==void 0)return t;if(e!==void 0)return e;if(r!==void 0)return r}function By(t,e,r,i,n){return yi(typeof r===n?i[r]:void 0,t.default,e.default)}function Py(t,e,r){if(j(r)!=="number")return yi(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=_n(t.stops.map(a=>a[0]),r,"");return t.stops[n][1]}function Kh(t,e,r){let i=t.base===void 0?1:t.base;if(j(r)!=="number")return yi(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=_n(t.stops.map(h=>h[0]),r,""),s=Ly(r,i,t.stops[a][0],t.stops[a+1][0]),o=t.stops[a][1],l=t.stops[a+1][1],u=Pe[e.type]||Iy;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 zy(t,e,r){switch(e.type){case"color":r=nt.parse(r);break;case"formatted":r=oe.fromString(r.toString());break;case"resolvedImage":r=Kt.fromString(r.toString());break;case"padding":r=Qt.parse(r);break;case"colorArray":r=Ot.parse(r);break;case"numberArray":r=te.parse(r);break;default:j(r)!==e.type&&(e.type!=="enum"||!e.values[r])&&(r=void 0)}return yi(r,t.default,e.default)}function Ly(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 Ea(t){return{result:"success",value:t}}function Ke(t){return{result:"error",value:t}}var Ys=class{constructor(t,e,r,i){this.expression=t,this._warningHistory={},this._evaluator=new mh,this._defaultValue=r?ic(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=dr(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=dr(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 Q(`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 Q?s.path:"",l=`${o}|${s.message}`;return this._warningHistory[l]||(this._warningHistory[l]=!0,typeof console<"u"&&console.warn(Jh(this._rootKey,o,s.message,this._defaultValue))),this._defaultValue}}};function Jh(t,e,r,i){return`${t}${e}: ${r}${i==null?"":` Falling back to ${String(i)}.`}`}function Qh(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 Fn(t){return Array.isArray(t)&&t.length>0&&typeof t[0]=="string"&&t[0]in ir}function ve(t,e,r,i){Qh(e);let n=new Xh(ir,nn,[],r?Ry(r):void 0),a=n.parse(t,void 0,void 0,void 0,r&&r.type==="string"?{typeAnnotation:"coerce"}:void 0);return a?Ea(new Ys(a,e,r,i)):Ke(n.errors)}var ri=class{constructor(t,e,r){this.kind=t,this._styleExpression=e,this.isStateDependent=t!=="constant"&&!ti(e.expression),this.globalStateRefs=mi(e.expression),this._globalState=r}evaluateWithoutErrorHandling(t,e,r,i,n,a){return this._globalState&&(t=dr(t,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t,e,r,i,n,a)}evaluate(t,e,r,i,n,a){return this._globalState&&(t=dr(t,this._globalState)),this._styleExpression.evaluate(t,e,r,i,n,a)}},an=class{constructor(t,e,r,i,n){this.kind=t,this.zoomStops=r,this._styleExpression=e,this.isStateDependent=t!=="camera"&&!ti(e.expression),this.globalStateRefs=mi(e.expression),this.interpolationType=i,this._globalState=n}evaluateWithoutErrorHandling(t,e,r,i,n,a){return this._globalState&&(t=dr(t,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t,e,r,i,n,a)}evaluate(t,e,r,i,n,a){return this._globalState&&(t=dr(t,this._globalState)),this._styleExpression.evaluate(t,e,r,i,n,a)}interpolationFactor(t,e,r){return this.interpolationType?Zt.interpolationFactor(this.interpolationType,t,e,r):0}};function Vy(t){return t._styleExpression!==void 0}function tc(t,e,r,i){let n=ve(t,e,r,i);if(n.result==="error")return n;let a=n.value.expression,s=Dn(a);if(!s&&!fr(r))return Ke([new Xt("","data expressions not supported")]);let o=En(a,["zoom"]);if(!o&&!Wh(r))return Ke([new Xt("","zoom expressions not supported")]);let l=Zi(a);if(!l&&!o)return Ke([new Xt("",\'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.\')]);if(l instanceof Xt)return Ke([l]);if(l instanceof Zt&&!js(r))return Ke([new Xt("",\'"interpolate" expressions cannot be used with this property\')]);if(!l)return Ea(s?new ri("constant",n.value,i):new ri("source",n.value,i));let u=l instanceof Zt?l.interpolation:void 0;return Ea(s?new an("camera",n.value,l.labels,u,i):new an("composite",n.value,l.labels,u,i))}var ec=class rc{constructor(e,r,i){this.isStateDependent=!1,this.globalStateRefs=new Set,this._globalState=null,Qh(r),this._parameters=e,this._specification=i,this._rootKey=r,this._defaultValue=ic(i),this._warningHistory={};let n=Hh(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(Jh(this._rootKey,"",n,this._defaultValue))),this._defaultValue}}static deserialize(e){return new rc(e._parameters,e._rootKey,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification,_rootKey:e._rootKey}}};function Oy(t,e,r,i){if(Tn(t))return new ec(t,e,r);if(Fn(t)){let n=tc(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=nt.parse(t):r.type==="padding"&&(typeof t=="number"||Array.isArray(t))?n=Qt.parse(t):r.type==="numberArray"&&(typeof t=="number"||Array.isArray(t))?n=te.parse(t):r.type==="colorArray"&&(typeof t=="string"||Array.isArray(t))?n=Ot.parse(t):r.type==="variableAnchorOffsetCollection"&&Array.isArray(t)?n=Ht.parse(t):r.type==="projectionDefinition"&&typeof t=="string"&&(n=Oe.parse(t)),{globalStateRefs:new Set,_globalState:null,kind:"constant",evaluate:()=>n}}}function Zi(t){let e=null;if(t instanceof Sh)e=Zi(t.result);else if(t instanceof Mh){for(let r of t.args)if(e=Zi(r),e)break}else(t instanceof Ls||t instanceof Zt)&&t.input instanceof Re&&t.input.name==="zoom"&&(e=t);return e instanceof Xt||t.eachChild(r=>{let i=Zi(r);i instanceof Xt?e=i:!e&&i?e=new Xt("",\'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.\'):e&&i&&e!==i&&(e=new Xt("",\'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.\'))}),e}function mi(t,e=new Set){return t instanceof Gs&&e.add(t.key),t.eachChild(r=>{mi(r,e)}),e}function Ry(t){let e={color:Ut,string:N,number:k,enum:N,boolean:Y,formatted:pi,padding:vn,numberArray:bn,colorArray:Kr,projectionDefinition:gn,resolvedImage:fi,variableAnchorOffsetCollection:wn};return t.type==="array"?St(e[t.value]||q,t.length):e[t.type]}function ic(t){if(t.type==="color"&&Tn(t.default))return new nt(0,0,0,0);switch(t.type){case"color":return nt.parse(t.default)||null;case"padding":return Qt.parse(t.default)||null;case"numberArray":return te.parse(t.default)||null;case"colorArray":return Ot.parse(t.default)||null;case"variableAnchorOffsetCollection":return Ht.parse(t.default)||null;case"projectionDefinition":return Oe.parse(t.default)||null;default:return t.default===void 0?null:t.default}}function dr(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 $y(t){let e=!1;for(let r of t){let i=nc(r);if(i==="expression")return"expression";i==="legacy"&&(e=!0)}return e?"legacy":"neutral"}function nc(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 $y(t.slice(1));default:return"expression"}}function Xs(t){return nc(t)!=="legacy"}function xl(t){return t==="$type"?["geometry-type"]:t==="$id"?["id"]:["get",t]}function Ny(t){switch(t[0]){case"==":case"!=":case"<":case"<=":case">":case">=":return t.length!==3||typeof t[1]!="string"?null:[t[0],xl(t[1]),t[2]];case"in":case"!in":{if(t.length<2||typeof t[1]!="string")return null;let e=["in",xl(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 ac(t){if((t[0]==="<"||t[0]==="<="||t[0]===">"||t[0]===">=")&&t[1]==="$type")return`"$type" cannot be use with operator "${t[0]}"`;let e=Ny(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 ia(t,e,r){let i=r[t];return Array.isArray(i)?Xs(i)?Zs(i,e.concat(t)):{path:e.concat(t),legacyFilter:i}:null}function Zs(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=ia(r,e,t);if(i)return i}break;case"!":{let r=ia(1,e,t);if(r)return r;break}case"case":for(let r=1;r<t.length-1;r+=2){let i=ia(r,e,t);if(i)return i}}return null}function Uy(t,e){let r=Zs(t);if(!r||typeof console>"u")return;let i=r.path.map(n=>`[${n}]`).join("");console.warn(`${e}${i}: ${ac(r.legacyFilter)}`)}var qy={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function yr(t,e,r){if(t==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};Xs(t)?Uy(t,e):t=sn(t);let i=ve(t,e,qy,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:sc(t),getGlobalStateRefs:()=>mi(i.value.expression)}}function Gy(t,e){return t<e?-1:+(t>e)}function sc(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(sc(t[e]))return!0;return!1}function sn(t){if(!t)return!0;let e=t[0];return t.length<=1?e!=="any":e==="=="?na(t[1],t[2],"=="):e==="!="?Mi(na(t[1],t[2],"==")):e==="<"||e===">"||e==="<="||e===">="?na(t[1],t[2],e):e==="any"?jy(t.slice(1)):e==="all"?["all"].concat(t.slice(1).map(sn)):e==="none"?["all"].concat(t.slice(1).map(sn).map(Mi)):e==="in"?vl(t[1],t.slice(2)):e==="!in"?Mi(vl(t[1],t.slice(2))):e==="has"?bl(t[1]):e!=="!has"||Mi(bl(t[1]))}function na(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 jy(t){return["any"].concat(t.map(sn))}function vl(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(Gy)]]:["filter-in-small",t,["literal",e]]}}function bl(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function Mi(t){return["!",t]}function oc(t){let e=t.key,r=t.value;return r?[new T(e,r,"constants have been deprecated as of v8")]:[]}function ot(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function ze(t){if(Array.isArray(t))return t.map(ze);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){let e={};for(let r in t)e[r]=ze(t[r]);return e}return ot(t)}function Mt(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 T(e,r,`object expected, ${u} found`)];for(let h in r){let c=h.split(".")[0],p=Ur(i,c)||i["*"],f;if(Ur(n,c))f=n[c];else if(Ur(i,c)){if(r[h]===void 0)continue;f=o}else if(n["*"])f=n["*"];else if(i["*"])f=o;else{l.push(new T(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 T(e,r,`missing required property "${h}"`));return l}function Ws(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 T(s,e,`array expected, ${j(e)} found`)];if(r.length&&e.length!==r.length)return[new T(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 kn(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 T(e,r,`${r} is less than the minimum value ${i.minimum}`)]:"maximum"in i&&r>i.maximum?[new T(e,r,`${r} is greater than the maximum value ${i.maximum}`)]:[]:[new T(e,r,`number expected, ${n} found`)]}function lc(t){let e=t.valueSpec,r=ot(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=Mt({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 T(t.key,t.value,\'missing required property "property"\')),r!=="identity"&&!t.value.stops&&h.push(new T(t.key,t.value,\'missing required property "stops"\')),r==="exponential"&&t.valueSpec.expression&&!js(t.valueSpec)&&h.push(new T(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!fr(t.valueSpec)?h.push(new T(t.key,t.value,"property functions not supported")):o&&!Wh(t.valueSpec)&&h.push(new T(t.key,t.value,"zoom functions not supported"))),(r==="categorical"||u)&&t.value.property===void 0&&h.push(new T(t.key,t.value,\'"property" property is required\')),h;function c(y){if(r==="identity")return[new T(y.key,y.value,\'identity function may not have a "stops" property\')];let m=[],g=y.value;return m=m.concat(Ws({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 T(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 T(x,g,`array expected, ${j(g)} found`)];if(g.length!==2)return[new T(x,g,`array length 2 expected, length ${g.length} found`)];if(u){if(j(g[0])!=="object")return[new T(x,g,`object expected, ${j(g[0])} found`)];if(g[0].zoom===void 0)return[new T(x,g,"object stop key must have zoom")];if(g[0].value===void 0)return[new T(x,g,"object stop key must have value")];if(s&&s>ot(g[0].zoom))return[new T(x,g[0].zoom,"stop zoom values must appear in ascending order")];ot(g[0].zoom)!==s&&(s=ot(g[0].zoom),a=void 0,n={}),m=m.concat(Mt({key:`${x}[0]`,value:g[0],valueSpec:{zoom:{}},validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec,objectElementValidators:{zoom:kn,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 Fn(ze(g[1]))?m.concat([new T(`${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=ot(y.value),b=y.value===null?m:y.value;if(!i)i=g;else if(g!==i)return[new T(y.key,b,`${g} stop domain type must match previous stop domain type ${i}`)];if(g!=="number"&&g!=="string"&&g!=="boolean")return[new T(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 fr(e)&&r===void 0&&(v+=\'\\nIf you intended to use a categorical function, specify `"type": "categorical"`.\'),[new T(y.key,b,v)]}return r==="categorical"&&g==="number"&&(!isFinite(x)||Math.floor(x)!==x)?[new T(y.key,b,`integer expected, found ${x}`)]:r!=="categorical"&&g==="number"&&a!==void 0&&x<a?[new T(y.key,b,"stop domain values must appear in ascending order")]:(a=x,r==="categorical"&&x in n?[new T(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 mr(t){let e=(t.expressionContext==="property"?tc:ve)(ze(t.value),t.key,t.valueSpec);if(e.result==="error")return e.value.map(i=>new T(`${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 T(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"&&!ti(r))return[new T(t.key,t.value,\'"feature-state" data expressions are not supported with layout properties.\')];if(t.expressionContext==="filter"&&!ti(r))return[new T(t.key,t.value,\'"feature-state" data expressions are not supported with filters.\')];if(t.expressionContext&&t.expressionContext.indexOf("cluster")===0){if(!En(r,["zoom","feature-state"]))return[new T(t.key,t.value,\'"zoom" and "feature-state" expressions are not supported with cluster properties.\')];if(t.expressionContext==="cluster-initial"&&!Dn(r))return[new T(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Yy(t){let e=t.value,r=t.key,i=j(e);return i==="boolean"?[]:[new T(r,e,`boolean expected, ${i} found`)]}function Ta(t){let e=t.key,r=t.value,i=j(r);return i==="string"?nt.parse(String(r))?[]:[new T(e,r,`color expected, "${r}" found`)]:[new T(e,r,`color expected, ${i} found`)]}function ii(t){let e=t.key,r=t.value,i=t.valueSpec,n=[];return Array.isArray(i.values)?i.values.indexOf(ot(r))===-1&&n.push(new T(e,r,`expected one of [${i.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(i.values).indexOf(ot(r))===-1&&n.push(new T(e,r,`expected one of [${Object.keys(i.values).join(", ")}], ${JSON.stringify(r)} found`)),n}function Xy(t,e){let r=t;for(let i of e)r=r[i];return r}function Zy(t,e){let r=Zs(e);return r?[new T(`${t.key}${r.path.map(i=>`[${i}]`).join("")}`,Xy(t.value,r.path),ac(r.legacyFilter),null,"warning")]:[]}function Hs(t){let e=ze(t.value);return Xs(e)?[...Zy(t,e),...mr(ei({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}}))]:uc(t)}function uc(t){let e=t.value,r=t.key;if(j(e)!=="array")return[new T(r,e,`array expected, ${j(e)} found`)];let i=t.styleSpec,n,a=[];if(e.length<1)return[new T(r,e,"filter array must have at least 1 element")];switch(a=a.concat(ii({key:`${r}[0]`,value:e[0],valueSpec:i.filter_operator,style:t.style,styleSpec:t.styleSpec})),ot(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&ot(e[1])==="$type"&&a.push(new T(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&a.push(new T(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 T(`${r}[1]`,e[1],`string expected, ${n} found`)));for(let s=2;s<e.length;s++)n=j(e[s]),ot(e[1])==="$type"?a=a.concat(ii({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 T(`${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(uc({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 T(`${r}[1]`,e[1],`string expected, ${n} found`)):a.push(new T(r,e,`filter array for "${e[0]}" operator must have 2 elements`))}return a}function hc(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(/^(.*)-transition$/);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 T(r,s,`unknown property "${o}"`)];let c;if(j(s)==="string"&&fr(h)&&!h.tokens&&(c=/^{([^}]+)}$/.exec(s)))return[new T(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"&&Tn(ze(s))&&ot(s.type)==="identity"&&p.push(new T(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 cc(t){return hc(t,"paint")}function pc(t){return hc(t,"layout")}function fc(t){let e=[],r=t.value,i=t.key,n=t.style,a=t.styleSpec;if(j(r)!=="object")return[new T(i,r,`object expected, ${j(r)} found`)];!r.type&&!r.ref&&e.push(new T(i,r,\'either "type" or "ref" is required\'));let s=ot(r.type),o=ot(r.ref);if(r.id){let l=ot(r.id);for(let u=0;u<t.arrayIndex;u++){let h=n.layers[u];ot(h.id)===l&&e.push(new T(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 T(i,r[u],`"${u}" is prohibited for ref layers`))});let l;n.layers.forEach(u=>{ot(u.id)===o&&(l=u)}),l?l.ref?e.push(new T(i,r.ref,"ref cannot reference another ref layer")):s=ot(l.type):e.push(new T(i,r.ref,`ref layer "${o}" not found`))}else if(s!=="background")if(!r.source)e.push(new T(i,r,\'missing required property "source"\'));else{let l=n.sources&&n.sources[r.source],u=l&&ot(l.type);l?u==="vector"&&s==="raster"?e.push(new T(i,r.source,`layer "${r.id}" requires a raster source`)):u!=="raster-dem"&&s==="hillshade"||u!=="raster-dem"&&s==="color-relief"?e.push(new T(i,r.source,`layer "${r.id}" requires a raster-dem source`)):u==="raster"&&s!=="raster"?e.push(new T(i,r.source,`layer "${r.id}" requires a vector source`)):u==="vector"&&!r["source-layer"]?e.push(new T(i,r,`layer "${r.id}" must specify a "source-layer"`)):u==="raster-dem"&&s!=="hillshade"&&s!=="color-relief"?e.push(new T(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 T(i,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \\`lineMetrics\\` enabled.`)):e.push(new T(i,r.source,`source "${r.source}" not found`))}return s==="raster"&&r.paint?.resampling&&r.paint?.["raster-resampling"]&&e.push(new T(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(Mt({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:Hs,layout(l){return Mt({layer:r,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*"(u){return pc(ei({layerType:s},u))}}})},paint(l){return Mt({layer:r,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*"(u){return cc(ei({layerType:s},u))}}})}}})),e}function xe(t){let e=t.value,r=t.key,i=j(e);return i==="string"?[]:[new T(r,e,`string expected, ${i} found`)]}function Wy(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 T("source_raster_dem",r,`object expected, ${o} found`)),s;let l=ot(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 T(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 T(c,r[c],`unknown property "${c}"`));return s}var wl={promoteId:Hy};function dc(t){let e=t.value,r=t.key,i=t.styleSpec,n=t.style,a=t.validateSpec;if(!e.type)return[new T(r,e,\'"type" is required\')];let s=ot(e.type),o;switch(s){case"vector":case"raster":return o=Mt({key:r,value:e,valueSpec:i[`source_${s.replace("-","_")}`],style:t.style,styleSpec:i,objectElementValidators:wl,validateSpec:a}),o;case"raster-dem":return o=Wy({sourceName:r,value:e,style:t.style,styleSpec:i,validateSpec:a}),o;case"geojson":if(o=Mt({key:r,value:e,valueSpec:i.source_geojson,style:n,styleSpec:i,validateSpec:a,objectElementValidators:wl}),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(...mr({key:`${r}.${l}.map`,value:h,validateSpec:a,expressionContext:"cluster-map"})),o.push(...mr({key:`${r}.${l}.reduce`,value:c,validateSpec:a,expressionContext:"cluster-reduce"}))}return o;case"video":return Mt({key:r,value:e,valueSpec:i.source_video,style:n,validateSpec:a,styleSpec:i});case"image":return Mt({key:r,value:e,valueSpec:i.source_image,style:n,validateSpec:a,styleSpec:i});case"canvas":return[new T(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return ii({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:n,validateSpec:a,styleSpec:i})}}function Hy({key:t,value:e}){if(j(e)==="string")return xe({key:t,value:e});{let r=[];for(let i in e)r.push(...xe({key:`${t}.${i}`,value:e[i]}));return r}}function yc(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 T("light",e,`object expected, ${s} found`)]),a;for(let o in e){let l=o.match(/^(.*)-transition$/);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 T(o,e[o],`unknown property "${o}"`)])}return a}function mc(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 T("sky",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 T(o,e[o],`unknown property "${o}"`)]);return s}function gc(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 T("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 T(o,e[o],`unknown property "${o}"`)]);return a}function Ky(t){return xe(t).length===0?[]:mr(t)}function Jy(t){return xe(t).length===0?[]:mr(t)}function Qy(t){let e=t.key,r=t.value;if(j(r)==="array"){if(r.length<1||r.length>4)return[new T(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 kn({key:e,value:r,valueSpec:{}})}function tm(t){let e=t.key,r=t.value;if(j(r)==="array"){let i={type:"number"};if(r.length<1)return[new T(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 kn({key:e,value:r,valueSpec:{}})}function em(t){let e=t.key,r=t.value;if(j(r)==="array"){if(r.length<1)return[new T(e,r,"array length at least 1 expected, length 0 found")];let i=[];for(let n=0;n<r.length;n++)i=i.concat(Ta({key:`${e}[${n}]`,value:r[n],valueSpec:{}}));return i}return Ta({key:e,value:r,valueSpec:{}})}function rm(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 T(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(ii({key:`${e}[${s}]`,value:r[s],valueSpec:n.layout_symbol["text-anchor"]})),a=a.concat(Ws({key:`${e}[${s+1}]`,value:r[s+1],valueSpec:{length:2,value:"number"},validateSpec:t.validateSpec,style:t.style,styleSpec:n}));return a}function xc(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 T(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 T(i,r,`all the sprites\' URLs must be unique, but ${r[s].url} is duplicated`)),a.push(r[s].url),e=e.concat(Mt({key:`${i}[${s}]`,value:r[s],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:t.validateSpec}));return e}return xe({key:i,value:r})}function im(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 T("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 T(o,e[o],`unknown property "${o}"`)]);return s}function nm(t){let e=t.key,r=t.value;r=r instanceof String?r.valueOf():r;let i=j(r);return i==="array"&&!sm(r)&&!am(r)?[new T(e,r,`projection expected, invalid array ${JSON.stringify(r)} found`)]:["array","string"].includes(i)?[]:[new T(e,r,`projection expected, invalid type "${i}" found`)]}function am(t){return!!["interpolate","step","literal"].includes(t[0])}function sm(t){return Array.isArray(t)&&t.length===3&&typeof t[0]=="string"&&typeof t[1]=="string"&&typeof t[2]=="number"}function Fa(t){return!!t&&t.constructor===Object}function vc(t){return Fa(t.value)?[]:[new T(t.key,t.value,`object expected, ${j(t.value)} found`)]}var _l=1114111,om=/^u\\+(?:([0-9a-f]{1,6})(?:-([0-9a-f]{1,6}))?|([0-9a-f]{0,5}\\?{1,6}))$/i;function lm(t,e){if(j(e)!=="string")return[];let r=`${e}`,i=()=>[new T(t,e,\'invalid unicode range, expected a value such as "U+26", "U+0-10FFFF" or "U+4??"\')],n=r.match(om);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>_l||u>_l?[new T(t,e,"unicode range is out of bounds, the maximum code point is U+10FFFF")]:l>u?[new T(t,e,`unicode range start must not be greater than its end, but ${r} is`)]:[]}function bc(t){let e=t.key??"font-faces",r=t.value,i=t.validateSpec,n=t.styleSpec??nh,a=t.style;if(!Fa(r))return[new T(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(...xe({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(...Mt({key:f,value:p,valueSpec:h,styleSpec:n,style:a,validateSpec:i}));let d=Fa(p)?p["unicode-range"]:void 0;if(j(d)==="array")for(let[y,m]of d.entries())s.push(...lm(`${f}.unicode-range[${y}]`,m))}}else s.push(new T(`${e}.${o}`,l,`string or array expected, ${u} found`))}return s}var Sl={"*"(){return[]},array:Ws,boolean:Yy,number:kn,color:Ta,constants:oc,enum:ii,filter:Hs,function:lc,layer:fc,object:Mt,source:dc,light:yc,sky:mc,terrain:gc,projection:im,projectionDefinition:nm,string:xe,formatted:Ky,resolvedImage:Jy,padding:Qy,numberArray:tm,colorArray:em,variableAnchorOffsetCollection:rm,sprite:xc,state:vc,fontFaces:bc};function Gr(t){let e=t.value,r=t.valueSpec,i=t.styleSpec;return t.validateSpec=Gr,r.expression&&Tn(ot(e))?lc(t):r.expression&&Fn(ze(e))?mr(t):r.type&&Sl[r.type]?Sl[r.type](t):Mt(ei({},t,{valueSpec:r.type?i[r.type]:r}))}function wc(t){let e=t.value,r=t.key,i=xe(t);return i.length||(e.indexOf("{fontstack}")===-1&&i.push(new T(r,e,\'"glyphs" url must include a "{fontstack}" token\')),e.indexOf("{range}")===-1&&i.push(new T(r,e,\'"glyphs" url must include a "{range}" token\'))),i}function It(t,e=_){let r=[];return r=r.concat(Gr({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,validateSpec:Gr,objectElementValidators:{glyphs:wc,"*"(){return[]}}})),t.constants&&(r=r.concat(oc({key:"constants",value:t.constants,style:t,styleSpec:e,validateSpec:Gr}))),_c(r)}It.source=Pt(Bt(dc)),It.sprite=Pt(Bt(xc)),It.glyphs=Pt(Bt(wc)),It.fontFaces=Pt(Bt(bc)),It.light=Pt(Bt(yc)),It.sky=Pt(Bt(mc)),It.terrain=Pt(Bt(gc)),It.state=Pt(Bt(vc)),It.layer=Pt(Bt(fc)),It.filter=Pt(Bt(Hs)),It.paintProperty=Pt(Bt(cc)),It.layoutProperty=Pt(Bt(pc));function Bt(t){return function(e){return t(Object.assign({},e,{validateSpec:Gr}))}}function _c(t){return[].concat(t).sort((e,r)=>e.line-r.line)}function Pt(t){return function(...e){return _c(t.apply(this,e))}}var um={type:"enum","property-type":"data-constant",expression:{interpolated:!1,parameters:["global-state"]},values:{visible:{},none:{}},transition:!1,default:"visible"},hm=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=ve(t,this._rootKey,um,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=mi(e.value.expression)}getGlobalStateRefs(){return this._globalStateRefs}};function cm(t,e,r){return new hm(t,e,r)}var Al=It,gw=new Set(Object.keys(_).filter(t=>t.startsWith("source_")).map(t=>t.slice(7).replaceAll("_","-")));function pm(t,e){let r=!1;for(let i of e){if(i.severity==="warning"){gt(i.message);continue}t.fire(new Qi(Error(i.message))),r=!0}return r}function fm(t,e,r,i){return i?.validate!==!1&&pm(t,e({styleSpec:_,...r}))}var ka=class Sc{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 Sc(e.buffer)}},ne={};function I(t,e,r={}){if(ne[t])throw Error(`${t} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:t,writeable:!1}),ne[t]={klass:e,omit:r.omit||[],shallow:r.shallow||[]}}I("Object",Object),I("Set",Set),I("TransferableGridIndex",ka),I("Color",nt),I("Error",Error),I("AJAXError",Ji),I("ResolvedImage",Kt),I("StylePropertyFunction",ec),I("StyleExpression",Ys,{omit:["_evaluator"]}),I("ZoomDependentExpression",an),I("ZoomConstantExpression",ri),I("CompoundExpression",Re,{omit:["_evaluate"]});for(let t in ir)ir[t]._classRegistryKey||I(`Expression_${t}`,ir[t]);function Ac(t){return t&&typeof ArrayBuffer<"u"&&(t instanceof ArrayBuffer||t.constructor?.name==="ArrayBuffer")}function Ks(t){let e=t.constructor;return t.$name||e._classRegistryKey}function dm(t){if(typeof t!="object"||!t)return!1;let e=Ks(t);return e&&e!=="Object"}function Dc(t){return!dm(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||Ac(t)||yn(t)||ArrayBuffer.isView(t)||t instanceof ImageData)}function jr(t,e){if(Dc(t))return(Ac(t)||yn(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(jr(s,e));return a}if(typeof t!="object")throw Error(`can\'t serialize object of type ${typeof t}`);let r=Ks(t);if(!r)throw Error(`can\'t serialize object of unregistered class ${t.constructor.name}`);if(!ne[r])throw Error(`${r} is not registered.`);let{klass:i}=ne[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)||ne[r].omit.includes(a))continue;let s=t[a];s!==void 0&&(n[a]=ne[r].shallow.includes(a)?s:jr(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 Yr(t){if(Dc(t))return t;if(Array.isArray(t))return t.map(Yr);if(typeof t!="object")throw Error(`can\'t deserialize object of type ${typeof t}`);let e=Ks(t)||"Object";if(!ne[e])throw Error(`can\'t deserialize unregistered class ${e}`);let{klass:r}=ne[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]=ne[e].shallow.includes(n)?a:Yr(a)}return i}var Dl=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))}};function ym(t){return/[\\u02EA\\u02EB\\u2E80-\\u2FDF\\u2FF0-\\u303F\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FD-\\u30FF\\u3105-\\u312F\\u31A0-\\u4DBF\\u4E00-\\uA48C\\uA490-\\uA4C6\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFE10-\\uFE1F\\uFE30-\\uFE4F\\uFF00-\\uFFEF]|\\uD81B[\\uDFE0-\\uDFFF]|[\\uD81C-\\uD822\\uD840-\\uD868\\uD86A-\\uD86D\\uD86F-\\uD872\\uD874-\\uD879\\uD880-\\uD883\\uD885-\\uD88C][\\uDC00-\\uDFFF]|\\uD823[\\uDC00-\\uDCD5\\uDCFF-\\uDD1E\\uDD80-\\uDDF2]|\\uD82B[\\uDFF0-\\uDFFF]|\\uD82C[\\uDC00-\\uDEFB]|\\uD83C[\\uDE00-\\uDEFF]|\\uD869[\\uDC00-\\uDEDF\\uDF00-\\uDFFF]|\\uD86E[\\uDC00-\\uDC1D\\uDC20-\\uDFFF]|\\uD873[\\uDC00-\\uDEAD\\uDEB0-\\uDFFF]|\\uD87A[\\uDC00-\\uDFE0\\uDFF0-\\uDFFF]|\\uD87B[\\uDC00-\\uDE5D]|\\uD87E[\\uDC00-\\uDE1D]|\\uD884[\\uDC00-\\uDF4A\\uDF50-\\uDFFF]|\\uD88D[\\uDC00-\\uDC79]/gim.test(String.fromCodePoint(t))}function In(t){return/[\\u02EA\\u02EB\\u1100-\\u11FF\\u1400-\\u167F\\u18B0-\\u18F5\\u2E80-\\u2E99\\u2E9B-\\u2EF3\\u2F00-\\u2FD5\\u2FF0-\\u3007\\u3012\\u3013\\u3020-\\u302F\\u3031-\\u303F\\u3041-\\u3096\\u309D-\\u30FB\\u30FD-\\u30FF\\u3105-\\u312F\\u3131-\\u318E\\u3190-\\uA48C\\uA490-\\uA4C6\\uA960-\\uA97C\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFE10-\\uFE1F\\uFE30-\\uFE48\\uFE50-\\uFE57\\uFE5F-\\uFE62\\uFE67-\\uFE6F\\uFF00-\\uFF07\\uFF0A-\\uFF0C\\uFF0E-\\uFF19\\uFF1F-\\uFF3A\\uFF3C\\uFF3E\\uFF40-\\uFF5A\\uFFE0-\\uFFE2\\uFFE4-\\uFFE7]|\\uD802[\\uDD80-\\uDD9F]|\\uD805[\\uDD80-\\uDDFF]|\\uD806[\\uDE00-\\uDEBF]|\\uD811[\\uDC00-\\uDE7F]|\\uD81B[\\uDFE0-\\uDFE4\\uDFF0-\\uDFF6]|[\\uD81C-\\uD822\\uD83D\\uD840-\\uD868\\uD86A-\\uD86D\\uD86F-\\uD872\\uD874-\\uD879\\uD880-\\uD883\\uD885-\\uD88C][\\uDC00-\\uDFFF]|\\uD823[\\uDC00-\\uDCD5\\uDCFF-\\uDD1E\\uDD80-\\uDDF2]|\\uD82B[\\uDFF0-\\uDFF3\\uDFF5-\\uDFFB\\uDFFD\\uDFFE]|\\uD82C[\\uDC00-\\uDD22\\uDD30-\\uDEFB]|\\uD833[\\uDEC0-\\uDFCF]|\\uD834[\\uDC00-\\uDDFF\\uDEE0-\\uDF7F]|\\uD836[\\uDC00-\\uDEAF]|\\uD83C[\\uDC00-\\uDE00\\uDF00-\\uDFFF]|\\uD83E[\\uDD00-\\uDEFF]|\\uD869[\\uDC00-\\uDEDF\\uDF00-\\uDFFF]|\\uD86E[\\uDC00-\\uDC1D\\uDC20-\\uDFFF]|\\uD873[\\uDC00-\\uDEAD\\uDEB0-\\uDFFF]|\\uD87A[\\uDC00-\\uDFE0\\uDFF0-\\uDFFF]|\\uD87B[\\uDC00-\\uDE5D]|\\uD87E[\\uDC00-\\uDE1D]|\\uD884[\\uDC00-\\uDF4A\\uDF50-\\uDFFF]|\\uD88D[\\uDC00-\\uDC79]/gim.test(String.fromCodePoint(t))}function mm(t){return/[\\xA7\\xA9\\xAE\\xB1\\xBC-\\xBE\\xD7\\xF7\\u2016\\u2020\\u2021\\u2030\\u2031\\u203B\\u203C\\u2042\\u2047-\\u2049\\u2051\\u2100-\\u218F\\u221E\\u2234\\u2235\\u2300-\\u2307\\u230C-\\u231F\\u2324-\\u2328\\u232B\\u237D-\\u239A\\u23BE-\\u23CD\\u23CF\\u23D1-\\u23DB\\u23E2-\\u2422\\u2424-\\u24FF\\u25A0-\\u2619\\u2620-\\u2767\\u2776-\\u2793\\u2B12-\\u2B2F\\u2B50-\\u2B59\\u2BB8-\\u2BEB\\u3000-\\u303F\\u30A0-\\u30FF\\uE000-\\uF8FF\\uFE30-\\uFE6F\\uFF00-\\uFFEF\\uFFFC\\uFFFD]|[\\uDB80-\\uDBFF][\\uDC00-\\uDFFF]/gim.test(String.fromCodePoint(t))}function gm(t){return/[\\u0900-\\u0DFF\\u0F00-\\u109F\\u1780-\\u17FF]/gim.test(String.fromCodePoint(t))}function xm(t){return/[\\r\\u0300-\\u036F\\u0483-\\u0489\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u0600-\\u0605\\u0610-\\u061A\\u064B-\\u065F\\u0670\\u06D6-\\u06DD\\u06DF-\\u06E4\\u06E7\\u06E8\\u06EA-\\u06ED\\u070F\\u0711\\u0730-\\u074A\\u07A6-\\u07B0\\u07EB-\\u07F3\\u07FD\\u0816-\\u0819\\u081B-\\u0823\\u0825-\\u0827\\u0829-\\u082D\\u0859-\\u085B\\u0890\\u0891\\u0897-\\u089F\\u08CA-\\u0903\\u093A-\\u093C\\u093E-\\u094F\\u0951-\\u0957\\u0962\\u0963\\u0981-\\u0983\\u09BC\\u09BE-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CD\\u09D7\\u09E2\\u09E3\\u09FE\\u0A01-\\u0A03\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A70\\u0A71\\u0A75\\u0A81-\\u0A83\\u0ABC\\u0ABE-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AE2\\u0AE3\\u0AFA-\\u0AFF\\u0B01-\\u0B03\\u0B3C\\u0B3E-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B55-\\u0B57\\u0B62\\u0B63\\u0B82\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD7\\u0C00-\\u0C04\\u0C3C\\u0C3E-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C62\\u0C63\\u0C81-\\u0C83\\u0CBC\\u0CBE-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CE2\\u0CE3\\u0CF3\\u0D00-\\u0D03\\u0D3B\\u0D3C\\u0D3E-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D62\\u0D63\\u0D81-\\u0D83\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DF2\\u0DF3\\u0E31\\u0E33-\\u0E3A\\u0E47-\\u0E4E\\u0EB1\\u0EB3-\\u0EBC\\u0EC8-\\u0ECE\\u0F18\\u0F19\\u0F35\\u0F37\\u0F39\\u0F3E\\u0F3F\\u0F71-\\u0F84\\u0F86\\u0F87\\u0F8D-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u102D-\\u1037\\u1039-\\u103E\\u1056-\\u1059\\u105E-\\u1060\\u1071-\\u1074\\u1082\\u1084-\\u1086\\u108D\\u109D\\u1100-\\u11FF\\u135D-\\u135F\\u1712-\\u1715\\u1732-\\u1734\\u1752\\u1753\\u1772\\u1773\\u17B4-\\u17D3\\u17DD\\u180B-\\u180D\\u180F\\u1885\\u1886\\u18A9\\u1920-\\u192B\\u1930-\\u193B\\u1A17-\\u1A1B\\u1A55-\\u1A5E\\u1A60\\u1A62\\u1A65-\\u1A7C\\u1A7F\\u1AB0-\\u1ADD\\u1AE0-\\u1AEB\\u1B00-\\u1B04\\u1B34-\\u1B44\\u1B6B-\\u1B73\\u1B80-\\u1B82\\u1BA1-\\u1BAD\\u1BE6-\\u1BF3\\u1C24-\\u1C37\\u1CD0-\\u1CD2\\u1CD4-\\u1CE8\\u1CED\\u1CF4\\u1CF7-\\u1CF9\\u1DC0-\\u1DFF\\u200C\\u200D\\u20D0-\\u20F0\\u2CEF-\\u2CF1\\u2D7F\\u2DE0-\\u2DFF\\u302A-\\u302F\\u3099\\u309A\\uA66F-\\uA672\\uA674-\\uA67D\\uA69E\\uA69F\\uA6F0\\uA6F1\\uA802\\uA806\\uA80B\\uA823-\\uA827\\uA82C\\uA880\\uA881\\uA8B4-\\uA8C5\\uA8E0-\\uA8F1\\uA8FF\\uA926-\\uA92D\\uA947-\\uA953\\uA960-\\uA97C\\uA980-\\uA983\\uA9B3-\\uA9C0\\uA9E5\\uAA29-\\uAA36\\uAA43\\uAA4C\\uAA4D\\uAA7C\\uAAB0\\uAAB2-\\uAAB4\\uAAB7\\uAAB8\\uAABE\\uAABF\\uAAC1\\uAAEB-\\uAAEF\\uAAF5\\uAAF6\\uABE3-\\uABEA\\uABEC\\uABED\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uFB1E\\uFE00-\\uFE0F\\uFE20-\\uFE2F\\uFF9E\\uFF9F]|\\uD800[\\uDDFD\\uDEE0\\uDF76-\\uDF7A]|\\uD802[\\uDE01-\\uDE03\\uDE05\\uDE06\\uDE0C-\\uDE0F\\uDE38-\\uDE3A\\uDE3F\\uDEE5\\uDEE6]|\\uD803[\\uDD24-\\uDD27\\uDD69-\\uDD6D\\uDEAB\\uDEAC\\uDEFA-\\uDEFF\\uDF46-\\uDF50\\uDF82-\\uDF85]|\\uD804[\\uDC00-\\uDC02\\uDC38-\\uDC46\\uDC70\\uDC73\\uDC74\\uDC7F-\\uDC82\\uDCB0-\\uDCBA\\uDCBD\\uDCC2\\uDCCD\\uDD00-\\uDD02\\uDD27-\\uDD34\\uDD45\\uDD46\\uDD73\\uDD80-\\uDD82\\uDDB3-\\uDDC0\\uDDC2\\uDDC3\\uDDC9-\\uDDCC\\uDDCE\\uDDCF\\uDE2C-\\uDE37\\uDE3E\\uDE41\\uDEDF-\\uDEEA\\uDF00-\\uDF03\\uDF3B\\uDF3C\\uDF3E-\\uDF44\\uDF47\\uDF48\\uDF4B-\\uDF4D\\uDF57\\uDF62\\uDF63\\uDF66-\\uDF6C\\uDF70-\\uDF74\\uDFB8-\\uDFC0\\uDFC2\\uDFC5\\uDFC7-\\uDFCA\\uDFCC-\\uDFD2\\uDFE1\\uDFE2]|\\uD805[\\uDC35-\\uDC46\\uDC5E\\uDCB0-\\uDCC3\\uDDAF-\\uDDB5\\uDDB8-\\uDDC0\\uDDDC\\uDDDD\\uDE30-\\uDE40\\uDEAB-\\uDEB7\\uDF1D-\\uDF1F\\uDF22-\\uDF2B]|\\uD806[\\uDC2C-\\uDC3A\\uDD30-\\uDD35\\uDD37\\uDD38\\uDD3B-\\uDD43\\uDDD1-\\uDDD7\\uDDDA-\\uDDE0\\uDDE4\\uDE01-\\uDE0A\\uDE33-\\uDE39\\uDE3B-\\uDE3E\\uDE47\\uDE51-\\uDE5B\\uDE84-\\uDE99\\uDF60-\\uDF67]|\\uD807[\\uDC2F-\\uDC36\\uDC38-\\uDC3F\\uDC92-\\uDCA7\\uDCA9-\\uDCB6\\uDD31-\\uDD36\\uDD3A\\uDD3C\\uDD3D\\uDD3F-\\uDD47\\uDD8A-\\uDD8E\\uDD90\\uDD91\\uDD93-\\uDD97\\uDEF3-\\uDEF6\\uDF00-\\uDF03\\uDF34-\\uDF3A\\uDF3E-\\uDF42\\uDF5A]|\\uD80D[\\uDC40\\uDC47-\\uDC55]|\\uD818[\\uDD1E-\\uDD2F]|\\uD81A[\\uDEF0-\\uDEF4\\uDF30-\\uDF36]|\\uD81B[\\uDD63\\uDD67-\\uDD6A\\uDF4F\\uDF51-\\uDF87\\uDF8F-\\uDF92\\uDFE4\\uDFF0\\uDFF1]|\\uD82F[\\uDC9D\\uDC9E]|\\uD833[\\uDF00-\\uDF2D\\uDF30-\\uDF46]|\\uD834[\\uDD65-\\uDD69\\uDD6D-\\uDD72\\uDD7B-\\uDD82\\uDD85-\\uDD8B\\uDDAA-\\uDDAD\\uDE42-\\uDE44]|\\uD836[\\uDE00-\\uDE36\\uDE3B-\\uDE6C\\uDE75\\uDE84\\uDE9B-\\uDE9F\\uDEA1-\\uDEAF]|\\uD838[\\uDC00-\\uDC06\\uDC08-\\uDC18\\uDC1B-\\uDC21\\uDC23\\uDC24\\uDC26-\\uDC2A\\uDC8F\\uDD30-\\uDD36\\uDEAE\\uDEEC-\\uDEEF]|\\uD839[\\uDCEC-\\uDCEF\\uDDEE\\uDDEF\\uDEE3\\uDEE6\\uDEEE\\uDEEF\\uDEF5]|\\uD83A[\\uDCD0-\\uDCD6\\uDD44-\\uDD4A]|\\uD83C[\\uDDE6-\\uDDFF\\uDFFB-\\uDFFF]|\\uDB40[\\uDC20-\\uDC7F\\uDD00-\\uDDEF]/.test(t)}function El(t){return/[\\u0E01-\\u0E3A\\u0E40-\\u0E5B\\u0E81\\u0E82\\u0E84\\u0E86-\\u0E8A\\u0E8C-\\u0EA3\\u0EA5\\u0EA7-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECE\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F97\\u0F99-\\u0FBC\\u0FBE-\\u0FCC\\u0FCE-\\u0FD4\\u0FD9\\u0FDA\\u1000-\\u109F\\u1780-\\u17DD\\u17E0-\\u17E9\\u17F0-\\u17F9\\u19E0-\\u19FF\\u1B00-\\u1B4C\\u1B4E-\\u1B7F\\uA980-\\uA9CD\\uA9D0-\\uA9D9\\uA9DE-\\uA9FE\\uAA60-\\uAA7F]|\\uD805[\\uDED0-\\uDEE3]/gim.test(String.fromCodePoint(t))}function vm(t,e){return/(?:[\\u1039\\u17D2\\u1A60\\u1BAB\\u200D\\uAAF6]|\\uD802\\uDE3F|\\uD804[\\uDD33\\uDFD0]|\\uD806[\\uDD3E\\uDE47\\uDE99]|\\uD807[\\uDD45\\uDD97\\uDF42])$/.test(t)||/^\\p{gc=Mc}/u.test(e)}function Js(t){return/\\s/u.test(String.fromCodePoint(t))}function Ia(t){for(let e of t)if(In(e.codePointAt(0)))return!0;return!1}function bm(t){for(let e of t)if(!_m(e.codePointAt(0)))return!1;return!0}function Ec(t){let e=t.map(r=>{try{return RegExp(`\\\\p{sc=${r}}`,"u").source}catch{return null}}).filter(r=>r);return new RegExp(e.join("|"),"u")}var wm=Ec(["Arab","Dupl","Mong","Ougr","Syrc"]);function _m(t){return!wm.test(String.fromCodePoint(t))}function Tl(t){return!(In(t)||mm(t))}function Tc(t){return/\\p{sc=Arab}/u.test(String.fromCodePoint(t))}var Sm=Ec("Adlm.Arab.Armi.Avst.Chrs.Cprt.Egyp.Elym.Gara.Hatr.Hebr.Hung.Khar.Lydi.Mand.Mani.Mend.Merc.Mero.Narb.Nbat.Nkoo.Orkh.Palm.Phli.Phlp.Phnx.Prti.Rohg.Samr.Sarb.Sogo.Syrc.Thaa.Todr.Yezi".split("."));function Qs(t){return Sm.test(String.fromCodePoint(t))}function Am(t,e){return!e&&Qs(t)?!1:!gm(t)}function Dm(t){for(let e of t)if(Qs(e.codePointAt(0)))return!0;return!1}function Em(t,e){for(let r of t)if(!Am(r.codePointAt(0),e))return!1;return!0}var Jt=new class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(t){this.pluginStatus=t.pluginStatus,this.pluginURL=t.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(t){if(Jt.isParsed())throw Error("RTL text plugin already registered.");this.applyArabicShaping=t.applyArabicShaping,this.processBidirectionalText=t.processBidirectionalText,this.processStyledBidirectionalText=t.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getRTLTextPluginStatus(){return this.pluginStatus}async syncState(t,e){if(this.isParsed())return this.getState();if(t.pluginStatus!=="loading")return this.setState(t),t;let r=t.pluginURL,i=new Promise(a=>{this.loadScriptResolve=a}),n=new Promise(a=>setTimeout(()=>a(),this.TIMEOUT));if(await e(r),await Promise.race([i,n]),this.isParsed()){let a={pluginStatus:"loaded",pluginURL:r};return this.setState(a),a}throw this.setState({pluginStatus:"error",pluginURL:""}),Error(`RTL Text Plugin failed to import scripts from ${r}`)}},H=class{constructor(t,e){this.isSupportedScript=Tm,this.zoom=t,e?(this.now=e.now||0,this.fadeDuration=e.fadeDuration||0,this.zoomHistory=e.zoomHistory||new Dl,this.transition=e.transition||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Dl,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}}};function Tm(t){return Em(t,Jt.getRTLTextPluginStatus()==="loaded")}var Fm="-transition",Mn=class{constructor(t,e,r,i){this.property=t,this.value=e,this.expression=Oy(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)}},Ma=class{constructor(t,e,r){this.property=t,this.value=new Mn(t,void 0,e,r)}transitioned(t,e){return new Fl(this.property,this.value,e,Tt({},t.transition,this.transition),t.now)}untransitioned(){return new Fl(this.property,this.value,null,{},0)}},km=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 de(this._values[t].value.value)}setValue(t,e){Object.hasOwn(this._values,t)||(this._values[t]=new Ma(this._values[t].property,this._propertyRootKey(t),this._globalState)),this._values[t].value=new Mn(this._values[t].property,e===null?void 0:de(e),this._propertyRootKey(t),this._globalState)}getTransition(t){return de(this._values[t].transition)}setTransition(t,e){Object.hasOwn(this._values,t)||(this._values[t]=new Ma(this._values[t].property,this._propertyRootKey(t),this._globalState)),this._values[t].transition=de(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}${Fm}`]=i)}return t}transitioned(t,e){let r=new kl(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 kl(this._properties);for(let e of Object.keys(this._values))t._values[e]=this._values[e].untransitioned();return t}},Fl=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,td(s))}}},kl=class{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,e,r){let i=new Cn(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}},Im=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 de(this._values[t].value)}setValue(t,e){this._values[t]=new Mn(this._values[t].property,e===null?void 0:de(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 Cn(this._properties);for(let n of Object.keys(this._values))i._values[n]=this._values[n].possiblyEvaluate(t,e,r);return i}},Vt=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)}},Cn=class{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}};function Il(t){if(Array.isArray(t))return t.length;let e=t?.values;return Array.isArray(e)?e.length:void 0}function Fc(t,e){let r=Il(t),i=Il(e);return r!==void 0&&i!==void 0&&r!==i}var C=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(Fc(t,e))return gt(`Property "${this.name}" is trying to interpolate arrays of different lengths. Rendering may \'jump\'.`),e;let i=this.specification.type,n=Pe[i];return n?n(t,e,r):t}},O=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 Vt(this,{kind:"constant",value:t.expression.evaluate(e,null,{},r,i)},e):new Vt(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 Vt(this,{kind:"constant",value:void 0},t.parameters);if(Fc(t.value.value,e.value.value))return gt(`Property "${this.name}" is trying to interpolate arrays of different lengths. Rendering may \'jump\'.`),e;let i=this.specification.type,n=Pe[i];if(n){let a=n(t.value.value,e.value.value,r);return new Vt(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)}},ni=class extends O{possiblyEvaluate(t,e,r,i){if(t.value===void 0)return new Vt(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 Vt(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 Vt(this,{kind:"constant",value:n},e)}return new Vt(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}},kc=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 H(Math.floor(e.zoom-1),e)),t.expression.evaluate(new H(Math.floor(e.zoom),e)),t.expression.evaluate(new H(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}},Bn=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}},Ft=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 Mn(r,void 0,r.name,void 0),n=this.defaultTransitionablePropertyValues[e]=new Ma(r,r.name,void 0);this.defaultTransitioningPropertyValues[e]=n.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=i.possiblyEvaluate({})}}};I("DataDrivenProperty",O),I("DataConstantProperty",C),I("CrossFadedDataDrivenProperty",ni),I("CrossFadedProperty",kc),I("ColorRampProperty",Bn);var Ml=" is a PAINT property not a LAYOUT property. Use get/setPaintProperty instead?",aa=" is a LAYOUT property not a PAINT property. Use get/setLayoutProperty instead?",jt=class extends fd{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=cm(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=yr(t.filter,`layers[${this.id}].filter`,r)),e.layout&&(this._unevaluatedLayout=new Im(e.layout,`layers[${this.id}].layout`,r)),e.paint)){this._transitionablePaint=new km(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 Cn(e.paint)}}setFilter(t){this.filter=t,this._featureFilter=yr(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+Ml);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 Qi(Error(t+Ml)));return}e!=null&&this._validate(Al.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+aa);return this._transitionablePaint.getTransition(e)}if(t==="visibility"||this._unevaluatedLayout?.hasProperty(t))throw Error(t+aa);return this._transitionablePaint.getValue(t)}setPaintProperty(t,e,r={}){if(t==="visibility"||this._unevaluatedLayout?.hasProperty(t))return this.fire(new Qi(Error(t+aa))),!1;if(e!=null&&this._validate(Al.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.visibility=this.visibility),nd(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 fm(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 Vt)||!fr(e.property.specification))&&(e.value.kind==="source"||e.value.kind==="composite")&&e.value.isStateDependent)return!0}return!1}},Mm,Cm=()=>Mm||=new Ft({"raster-opacity":new C(_.paint_raster["raster-opacity"],"raster-opacity"),"raster-hue-rotate":new C(_.paint_raster["raster-hue-rotate"],"raster-hue-rotate"),"raster-brightness-min":new C(_.paint_raster["raster-brightness-min"],"raster-brightness-min"),"raster-brightness-max":new C(_.paint_raster["raster-brightness-max"],"raster-brightness-max"),"raster-saturation":new C(_.paint_raster["raster-saturation"],"raster-saturation"),"raster-contrast":new C(_.paint_raster["raster-contrast"],"raster-contrast"),resampling:new C(_.paint_raster.resampling,"resampling"),"raster-resampling":new C(_.paint_raster["raster-resampling"],"raster-resampling"),"raster-fade-duration":new C(_.paint_raster["raster-fade-duration"],"raster-fade-duration")}),Bm={get paint(){return Cm()}};var Pm=class extends jt{constructor(t,e){super(t,Bm,e)}},zm={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},gi=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}},at=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 ut(t,e=1){let r=0,i=0;return{members:t.map(n=>{let a=Lm(n.type),s=r=Cl(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:Cl(r,Math.max(i,e)),alignment:e}}function Lm(t){return zm[t].BYTES_PER_ELEMENT}function Cl(t,e){return Math.ceil(t/e)*e}var ai=class extends at{_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}};ai.prototype.bytesPerElement=4,I("StructArrayLayout2i4",ai);var Ca=class extends at{_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}};Ca.prototype.bytesPerElement=6,I("StructArrayLayout3i6",Ca);var Bl=class extends at{_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}};Bl.prototype.bytesPerElement=8,I("StructArrayLayout4i8",Bl);var Ba=class extends at{_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}};Ba.prototype.bytesPerElement=12,I("StructArrayLayout2i4i12",Ba);var Pa=class extends at{_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}};Pa.prototype.bytesPerElement=8,I("StructArrayLayout2i4ub8",Pa);var si=class extends at{_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}};si.prototype.bytesPerElement=8,I("StructArrayLayout2f8",si);var za=class extends at{_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}};za.prototype.bytesPerElement=20,I("StructArrayLayout10ui20",za);var La=class extends at{_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}};La.prototype.bytesPerElement=16,I("StructArrayLayout8ui16",La);var Va=class extends at{_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}};Va.prototype.bytesPerElement=28,I("StructArrayLayout4i4ui4i1f28",Va);var Oa=class extends at{_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}};Oa.prototype.bytesPerElement=12,I("StructArrayLayout3f12",Oa);var Ra=class extends at{_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}};Ra.prototype.bytesPerElement=4,I("StructArrayLayout1ul4",Ra);var $a=class extends at{_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}};$a.prototype.bytesPerElement=20,I("StructArrayLayout6i1ul2ui20",$a);var Na=class extends at{_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}};Na.prototype.bytesPerElement=12,I("StructArrayLayout2i2i2i12",Na);var Pl=class extends at{_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}};Pl.prototype.bytesPerElement=16,I("StructArrayLayout2f1f2i16",Pl);var Ua=class extends at{_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}};Ua.prototype.bytesPerElement=16,I("StructArrayLayout2ub2f2i16",Ua);var qa=class extends at{_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}};qa.prototype.bytesPerElement=6,I("StructArrayLayout3ui6",qa);var Ga=class extends at{_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}};Ga.prototype.bytesPerElement=52,I("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i1f52",Ga);var ja=class extends at{_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,D,E,L,$,P){let z=this.length;return this.resize(z+1),this.emplace(z,t,e,r,i,n,a,s,o,l,u,h,c,p,f,d,y,m,g,x,b,v,w,A,S,D,E,L,$,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,D,E,L,$,P,z){let F=t*34,V=t*17;return this.int16[F+0]=e,this.int16[F+1]=r,this.int16[F+2]=i,this.int16[F+3]=n,this.int16[F+4]=a,this.int16[F+5]=s,this.int16[F+6]=o,this.int16[F+7]=l,this.uint16[F+8]=u,this.uint16[F+9]=h,this.uint16[F+10]=c,this.uint16[F+11]=p,this.uint16[F+12]=f,this.uint16[F+13]=d,this.uint16[F+14]=y,this.uint16[F+15]=m,this.uint16[F+16]=g,this.uint16[F+17]=x,this.uint16[F+18]=b,this.uint16[F+19]=v,this.uint16[F+20]=w,this.uint16[F+21]=A,this.uint16[F+22]=S,this.uint32[V+12]=D,this.float32[V+13]=E,this.float32[V+14]=L,this.uint16[F+30]=$,this.uint16[F+31]=P,this.float32[V+16]=z,t}};ja.prototype.bytesPerElement=68,I("StructArrayLayout8i15ui1ul2f2ui1f68",ja);var on=class extends at{_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}};on.prototype.bytesPerElement=4,I("StructArrayLayout1f4",on);var Ya=class extends at{_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}};Ya.prototype.bytesPerElement=12,I("StructArrayLayout1ui2f12",Ya);var Xa=class extends at{_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}};Xa.prototype.bytesPerElement=8,I("StructArrayLayout1ul2ui8",Xa);var Za=class extends at{_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}};Za.prototype.bytesPerElement=4,I("StructArrayLayout2ui4",Za);var zl=class extends at{_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}};zl.prototype.bytesPerElement=2,I("StructArrayLayout1ui2",zl);var Wa=class extends at{_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}};Wa.prototype.bytesPerElement=16,I("StructArrayLayout4f16",Wa);var Ic=class extends gi{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 M(this.anchorPointX,this.anchorPointY)}};Ic.prototype.size=20;var to=class extends $a{get(t){return new Ic(this,t)}};I("CollisionBoxArray",to);var Mc=class extends gi{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]}};Mc.prototype.size=52;var Cc=class extends Ga{get(t){return new Mc(this,t)}};I("PlacedSymbolArray",Cc);var Bc=class extends gi{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]}};Bc.prototype.size=68;var Pc=class extends ja{get(t){return new Bc(this,t)}};I("SymbolInstanceArray",Pc);var zc=class extends on{getoffsetX(t){return this.float32[t*1+0]}};I("GlyphOffsetArray",zc);var Lc=class extends Ca{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",Lc);var Vc=class extends gi{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]}};Vc.prototype.size=12;var Oc=class extends Ya{get(t){return new Vc(this,t)}};I("TextAnchorOffsetArray",Oc);var Rc=class extends gi{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]}};Rc.prototype.size=8;var $c=class extends Xa{get(t){return new Rc(this,t)}};I("FeatureIndexArray",$c);var Vm=class extends ai{};var Om=class extends ai{},Rm=class extends ai{},$m=class extends Ba{},Nm=class extends Pa{},Um=class extends si{},Xe=class extends za{},Ll=class extends La{},qm=class extends Va{},Gm=class extends Oa{},jm=class extends Ra{},Vl=class extends Na{};var Ym=class extends Ua{};var xi=class extends qa{},Ha=class extends Za{};var Ka=ut([{name:"a_pos",components:2,type:"Int16"}],4),Xm=Ka.members;Ka.size,Ka.alignment;var Ct=class Je{constructor(e=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=e}prepareSegment(e,r,i,n){let a=this.segments[this.segments.length-1];return e>Je.MAX_VERTEX_ARRAY_LENGTH&>(`Max vertices per segment is ${Je.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}. Consider using the \\`fillLargeMeshArrays\\` function if you require meshes with more than ${Je.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!a||a.vertexLength+e>Je.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 Je([{vertexOffset:e,primitiveOffset:r,vertexLength:i,primitiveLength:n,vaos:{},sortKey:0}])}};Ct.MAX_VERTEX_ARRAY_LENGTH=2**16-1,I("SegmentVector",Ct);function Ol(t,e){return t=Hr(Math.floor(t),0,255),e=Hr(Math.floor(e),0,255),256*t+e}var Zm=ut([{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"}]),Wm=ut([{name:"a_dasharray_from",components:4,type:"Uint16"},{name:"a_dasharray_to",components:4,type:"Uint16"}]),Hm=Is(((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)})),Km=Is(((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})),Ja=Rf(Is(((t,e)=>{var r=Hm(),i=Km();e.exports=r,e.exports.murmur3=r,e.exports.murmur2=i}))(),1),Nc=class Uc{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,i,n){this.ids.push(Rl(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=Rl(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 Qa(i,n,0,i.length-1),r&&r.push(i.buffer,n.buffer),{ids:i,positions:n}}static deserialize(e){let r=new Uc;return r.ids=e.ids,r.positions=e.positions,r.indexed=!0,r}};function Rl(t){let e=+t;return!isNaN(e)&&e<=2**53-1?e:(0,Ja.default)(String(t))}function Qa(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;Ci(t,a,s),Ci(e,3*a,3*s),Ci(e,3*a+1,3*s+1),Ci(e,3*a+2,3*s+2)}s-r<i-s?(Qa(t,e,r,s),r=s+1):(Qa(t,e,s+1,i),i=s)}}function Ci(t,e,r){let i=t[e];t[e]=t[r],t[r]=i}I("FeaturePositionMap",Nc);var eo=class{constructor(t,e){this.gl=t.gl,this.location=e}};var ro=class extends eo{constructor(t,e){super(t,e),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}};var Jm=class extends eo{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]))}},Qm=class extends eo{constructor(t,e){super(t,e),this.current=nt.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 xw=new Float32Array(16);function ts(t){return[Ol(255*t.r,255*t.g),Ol(255*t.b,255*t.a)]}var Or=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 Qm(t,e):new ro(t,e)}},Ee=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 Jm(t,e):new ro(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 H(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 H(0,n),r,i);this._setPaintValue(t,e,a)}_setPaintValue(t,e,r){if(this.type==="color"){let i=ts(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()}},Nt=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 H(this.zoom,r),e,{},r.canonical,[],r.formattedSection),n=this.expression.evaluate(new H(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 H(this.zoom,n),r,i),s=this.expression.evaluate(new H(this.zoom+1,n),r,i);this._setPaintValue(t,e,a,s)}_setPaintValue(t,e,r,i){if(this.type==="color"){let n=ts(r),a=ts(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=Hr(this.expression.interpolationFactor(r,this.zoom,this.zoom+1),0,1);t.set(i)}getBinding(t,e,r){return new ro(t,e)}},ce=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()}},qc=class extends ce{getPositions(t){return t.imagePositions}getPositionIds(t){return t.patterns?.[this.layerId]}getVertexAttributes(){return Zm.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)}},Gc=class extends ce{getPositions(t){return t.dashPositions}getPositionIds(t){return t.dashes?.[this.layerId]}getVertexAttributes(){return Wm.members}emplace(t,e,r,i){t.emplace(e,0,r.y,r.height,r.width,0,i.y,i.height,i.width)}},jc=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 Vt)||!fr(a.property.specification))continue;let s=t0(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 Ee(o.value,s):new Or(o.value,s,l),i.push(`/u_${n}`);else if(o.kind==="source"||c){let p=$l(n,l,"source");this.binders[n]=c?n==="line-dasharray"?new Gc(o,l,u,e,p,t.id):new qc(o,l,u,e,p,t.id):new ee(o,s,l,p),i.push(`/a_${n}`)}else{let p=$l(n,l,"composite");this.binders[n]=new Nt(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 Nt?e.maxValue:0}populatePaintArrays(t,e,r){for(let i in this.binders){let n=this.binders[i];(n instanceof ee||n instanceof Nt||n instanceof ce)&&n.populatePaintArray(t,e,r)}}setConstantPatternPositions(t,e){for(let r in this.binders){let i=this.binders[r];i instanceof Ee&&i.setConstantPatternPositions(t,e)}}setConstantDashPositions(t,e){for(let r in this.binders){let i=this.binders[r];i instanceof Ee&&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 Nt||c instanceof ce)&&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 Or||r instanceof Ee)&&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 Nt)for(let i of r.paintVertexAttributes)t.push(i.name);else if(r instanceof ce){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 Or||r instanceof Ee||r instanceof Nt)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 Or||n instanceof Ee||n instanceof Nt){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 ce){let i=t.fromScale===2?r.zoomInPaintVertexBuffer:r.zoomOutPaintVertexBuffer;i&&this._buffers.push(i)}else(r instanceof ee||r instanceof Nt)&&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 Nt||r instanceof ce)&&r.upload(t)}this.updatePaintBuffers()}destroy(){for(let t in this.binders){let e=this.binders[t];(e instanceof ee||e instanceof Nt||e instanceof ce)&&e.destroy()}}},Le=class{constructor(t,e,r=()=>!0){this.programConfigurations={};for(let i of t)this.programConfigurations[i.id]=new jc(i,e,r);this.needsUpload=!1,this._featureMap=new Nc,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 t0(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 e0(t){return{"line-pattern":{source:Xe,composite:Xe},"fill-pattern":{source:Xe,composite:Xe},"fill-extrusion-pattern":{source:Xe,composite:Xe},"line-dasharray":{source:Ll,composite:Ll}}[t]}function $l(t,e,r){let i={color:{source:si,composite:Wa},number:{source:on,composite:si}};return e0(t)?.[r]||i[e][r]}I("ConstantBinder",Or),I("CrossFadedConstantBinder",Ee),I("SourceExpressionBinder",ee),I("CrossFadedPatternBinder",qc),I("CrossFadedDasharrayBinder",Gc),I("CompositeExpressionBinder",Nt),I("ProgramConfiguration",jc,{omit:["_buffers"]}),I("ProgramConfigurationSet",Le);var es=2**14-1,Nl=-es-1;function $e(t){let e=it/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=Hr(a,Nl,es),n.y=Hr(s,Nl,es),(a<n.x||a>n.x+1||s<n.y||s>n.y+1)&>("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return r}function br(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?$e(t):[]}}var Ul=-32768;function r0(t,e,r,i,n){t.emplaceBack(Ul+e*8+i,Ul+r*8+n)}var io=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 Om,this.indexArray=new xi,this.segments=new Ct,this.programConfigurations=new Le(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||=c.paint.get("circle-pitch-alignment")==="map"}let l=o?e.subdivisionGranularity.circle:1,u=new H(this.zoom),h=this.layers[0]._featureFilter.needGeometry;for(let{feature:c,id:p,index:f,sourceLayerIndex:d}of t){let y=br(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:$e(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})}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Xm),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++)r0(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",io,{omit:["layers"]});function i0(t,e){for(let r of t)if(gr(e,r))return!0;for(let r of e)if(gr(t,r))return!0;return no(t,e)}function Pn(t,e,r){return gr(t,e)?!0:rs(e,t,r)}function Yc(t,e){if(t.length===1)return ql(e,t[0]);for(let r of e)for(let i of r)if(gr(t,i))return!0;for(let r of t)if(ql(e,r))return!0;for(let r of e)if(no(t,r))return!0;return!1}function n0(t,e,r){for(let i of e){if(t.length>=3){for(let n of i)if(gr(t,n))return!0}if(a0(t,i,r))return!0}return!1}function a0(t,e,r){if(t.length>1){if(no(t,e))return!0;for(let i of e)if(rs(i,t,r))return!0}for(let i of t)if(rs(i,e,r))return!0;return!1}function no(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(s0(i,n,s,o))return!0}}return!1}function s0(t,e,r,i){return ye(t,r,i)!==ye(e,r,i)&&ye(t,e,r)!==ye(t,e,i)}function rs(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(Xc(t,a,s)<i)return!0}return!1}function Xc(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 ql(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 gr(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 o0(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 M(e,r),new M(e,n),new M(i,n),new M(i,r)];if(t.length>2){for(let s of a)if(gr(t,s))return!0}for(let s=0;s<t.length-1;s++){let o=t[s],l=t[s+1];if(l0(o,l,a))return!0}return!1}function l0(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=ye(t,e,r[0]);return a!==ye(t,e,r[1])||a!==ye(t,e,r[2])||a!==ye(t,e,r[3])}function nr(t,e,r){let i=e.paint.get(t).value;return i.kind==="constant"?i.value:r.programConfigurations.get(e.id).getMaxValue(t)}function zn(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Ln(t,e,r,i,n){if(!e[0]&&!e[1])return t;let a=M.convert(e)._mult(n);r==="viewport"&&a._rotate(-i);let s=[];for(let o of t)s.push(o.sub(a));return s}function u0(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 h0(t,e){let r=[];for(let i of t){let n=u0(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 M(0,0):o.sub(l)._unit()._perp(),c=s===n.length-1?new M(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 c0({queryGeometry:t,size:e},r){return Pn(t,r,e)}function p0({queryGeometry:t,size:e,transform:r,unwrappedTileID:i,getElevation:n},a){return Pn(t,a,e*(r.projectTileCoordinates(a.x,a.y,i,n?.(a.x,a.y)).signedDistanceFromCamera/r.cameraToCenterDistance))}function f0({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 Pn(t,ao(a,r,i,n),o)}function d0({queryGeometry:t,size:e,transform:r,unwrappedTileID:i,getElevation:n},a){return Pn(t,ao(a,r,i,n),e)}function Zc({queryGeometry:t,size:e,transform:r,unwrappedTileID:i,getElevation:n,pitchAlignment:a="map",pitchScale:s="map"},o){let l=a==="map"?s==="map"?c0:p0:s==="map"?f0:d0,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 ao(t,e,r,i){let n=e.projectTileCoordinates(t.x,t.y,r,i?.(t.x,t.y)).point;return new M((n.x*.5+.5)*e.width,(-n.y*.5+.5)*e.height)}function y0(t,e,r,i){return t.map(n=>ao(n,e,r,i))}var m0,g0=()=>m0||=new Ft({"circle-sort-key":new O(_.layout_circle["circle-sort-key"],"circle-sort-key")}),x0,v0=()=>x0||=new Ft({"circle-radius":new O(_.paint_circle["circle-radius"],"circle-radius"),"circle-color":new O(_.paint_circle["circle-color"],"circle-color"),"circle-blur":new O(_.paint_circle["circle-blur"],"circle-blur"),"circle-opacity":new O(_.paint_circle["circle-opacity"],"circle-opacity"),"circle-translate":new C(_.paint_circle["circle-translate"],"circle-translate"),"circle-translate-anchor":new C(_.paint_circle["circle-translate-anchor"],"circle-translate-anchor"),"circle-pitch-scale":new C(_.paint_circle["circle-pitch-scale"],"circle-pitch-scale"),"circle-pitch-alignment":new C(_.paint_circle["circle-pitch-alignment"],"circle-pitch-alignment"),"circle-stroke-width":new O(_.paint_circle["circle-stroke-width"],"circle-stroke-width"),"circle-stroke-color":new O(_.paint_circle["circle-stroke-color"],"circle-stroke-color"),"circle-stroke-opacity":new O(_.paint_circle["circle-stroke-opacity"],"circle-stroke-opacity")}),b0={get paint(){return v0()},get layout(){return g0()}};var w0=class extends jt{constructor(t,e){super(t,b0,e)}createBucket(t){return new io(t)}queryRadius(t){let e=t;return nr("circle-radius",this,e)+nr("circle-stroke-width",this,e)+zn(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:r,geometry:i,transform:n,pixelsToTileUnits:a,unwrappedTileID:s,getElevation:o}){let l=Ln(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=y0(l,n,s,o),f=u),Zc({queryGeometry:p,size:f,transform:n,unwrappedTileID:s,getElevation:o,pitchAlignment:c,pitchScale:h},i)}},Wc=class extends io{};I("HeatmapBucket",Wc,{omit:["layers"]});var _0,S0=()=>_0||=new Ft({"heatmap-radius":new O(_.paint_heatmap["heatmap-radius"],"heatmap-radius"),"heatmap-weight":new O(_.paint_heatmap["heatmap-weight"],"heatmap-weight"),"heatmap-intensity":new C(_.paint_heatmap["heatmap-intensity"],"heatmap-intensity"),"heatmap-color":new Bn(_.paint_heatmap["heatmap-color"],"heatmap-color"),"heatmap-opacity":new C(_.paint_heatmap["heatmap-opacity"],"heatmap-opacity")}),A0={get paint(){return S0()}};function so(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 Hc(t,{width:e,height:r},i){if(e===t.width&&r===t.height)return;let n=so({},{width:e,height:r},i);oo(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 oo(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 Vn=class Kc{constructor(e,r){so(this,e,1,r)}resize(e){Hc(this,e,1)}clone(){return new Kc({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,i,n,a){oo(e,r,i,n,a,1)}},kt=class Jc{constructor(e,r){so(this,e,4,r)}resize(e){Hc(this,e,4)}replace(e,r){r?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new Jc({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,i,n,a){oo(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 sa(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",Vn),I("RGBAImage",kt);function D0(t){let e={},r=t.resolution||256,i=t.clips?t.clips.length:1,n=t.image||new kt({width:r,height:i});if(!id(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 E0="big-fb";var T0=class extends jt{createBucket(t){return new Wc(t)}constructor(t,e){super(t,A0,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=D0({expression:t,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has("big-fb")&&this.heatmapFbos.delete(E0)}queryRadius(t){return nr("heatmap-radius",this,t)}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:r,geometry:i,transform:n,pixelsToTileUnits:a,unwrappedTileID:s,getElevation:o}){return Zc({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()}},F0,k0=()=>F0||=new Ft({"hillshade-illumination-direction":new C(_.paint_hillshade["hillshade-illumination-direction"],"hillshade-illumination-direction"),"hillshade-illumination-altitude":new C(_.paint_hillshade["hillshade-illumination-altitude"],"hillshade-illumination-altitude"),"hillshade-illumination-anchor":new C(_.paint_hillshade["hillshade-illumination-anchor"],"hillshade-illumination-anchor"),"hillshade-exaggeration":new C(_.paint_hillshade["hillshade-exaggeration"],"hillshade-exaggeration"),"hillshade-shadow-color":new C(_.paint_hillshade["hillshade-shadow-color"],"hillshade-shadow-color"),"hillshade-highlight-color":new C(_.paint_hillshade["hillshade-highlight-color"],"hillshade-highlight-color"),"hillshade-accent-color":new C(_.paint_hillshade["hillshade-accent-color"],"hillshade-accent-color"),"hillshade-method":new C(_.paint_hillshade["hillshade-method"],"hillshade-method"),resampling:new C(_.paint_hillshade.resampling,"resampling")}),I0={get paint(){return k0()}};var M0=class extends jt{constructor(t,e){super(t,I0,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(el);return{directionRadians:t.map(el),altitudeRadians:a,shadowColor:i,highlightColor:r}}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&!this.isHidden()}},C0,B0=()=>C0||=new Ft({"color-relief-opacity":new C(_["paint_color-relief"]["color-relief-opacity"],"color-relief-opacity"),"color-relief-color":new Bn(_["paint_color-relief"]["color-relief-color"],"color-relief-color"),resampling:new C(_["paint_color-relief"].resampling,"resampling")}),P0={get paint(){return B0()}};function oa(t){return"data"in t}var Gl=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.filter=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),oa(t)){s.pixelStoreUnpackPremultiplyAlpha.set(!1);let{data:h}=t;l&&h&&(h=sa(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 oa(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};oa(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&&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=sa(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=sa(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&&!this.useMipmap&&(r=n.LINEAR),t!==this.filter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,t),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,r||t),this.filter=t),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)}destroy(){let{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null,this._ownedHandle=null}},lo=class Wi{static{this.byteViewCache=new WeakMap}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)){gt(`"${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-2;switch(this.data=new Uint32Array(r.data.buffer),Wi.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=0;h<l;h++)this.data[this._idx(-1,h)]=this.data[this._idx(0,h)],this.data[this._idx(l,h)]=this.data[this._idx(l-1,h)],this.data[this._idx(h,-1)]=this.data[this._idx(h,0)],this.data[this._idx(h,l)]=this.data[this._idx(h,l-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(l,-1)]=this.data[this._idx(l-1,0)],this.data[this._idx(-1,l)]=this.data[this._idx(0,l-1)],this.data[this._idx(l,l)]=this.data[this._idx(l-1,l-1)];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+1)*this.stride+i+1)*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<-1||e>=this.dim+1||r<-1||r>=this.dim+1)throw RangeError(`Out of range source coordinates for DEM data. x: ${e}, y: ${r}, dim: ${this.dim}`);return(r+1)*this.stride+(e+1)}unpack(e,r,i){return e*this.redFactor+r*this.greenFactor+i*this.blueFactor-this.baseShift}pack(e){return Qc(e,this.getUnpackVector())}getPixels(){return new kt({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-1;break;case 1:a=n+1}switch(i){case-1:s=o-1;break;case 1:o=s+1}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=Wi.byteViewCache.get(this);return e?.buffer!==this.data.buffer&&(e=new Uint8Array(this.data.buffer),Wi.byteViewCache.set(this,e)),e}_unpackAtIndex(e,r){return this.unpack(e[r],e[r+1],e[r+2])}};function Qc(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",lo);var z0=class extends jt{constructor(t,e){super(t,P0,e)}_createColorRamp(t){let e={elevationStops:[],colorStops:[]},r=this._transitionablePaint._values["color-relief-color"].value.expression;if(r instanceof ri&&r._styleExpression.expression instanceof Zt){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=[nt.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 gt(`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 kt({width:i.colorStops.length,height:1}),a=new kt({width:i.colorStops.length,height:1});for(let s=0;s<i.elevationStops.length;s++){let o=Qc(i.elevationStops[s],r);a.setPixel(0,s,new nt(o.r/255,o.g/255,o.b/255,1)),n.setPixel(0,s,i.colorStops[s])}return this.colorRampTextures={elevationTexture:new Gl(t,a,t.gl.RGBA),colorTexture:new Gl(t,n,t.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return!this.isHidden()&&!!this.colorRampTextures}},is=ut([{name:"a_pos",components:2,type:"Int16"}],4),L0=is.members;is.size,is.alignment;function ln(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 uo(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 oi=new Set,ns=!1;function V0(t,e,r=2){let i=e&&e.length,n=i?e[0]*r:t.length;oi.size&&oi.clear();let a=tp(t,0,n,r,!0),s=[];if(!a||a.next===a.prev)return s;let o=0,l=0,u=0;if(i&&(a=U0(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 as(a,s,o,l,u),s}function tp(t,e,r,i,n){let a=null;if(n===e1(t,e,r,i)>0)for(let s=e;s<r;s+=i)a=Xl(s/i|0,t[s],t[s+1],a);else for(let s=r-i;s>=e;s-=i)a=Xl(s/i|0,t[s],t[s+1],a);return a&&li(a,a.next)&&(hi(a),a=a.next),a}function Ve(t,e=t){let r=e===t,i=t,n;do n=!1,i!==i.next&&(oi.size===0||!oi.has(i))&&(li(i,i.next)||pt(i.prev,i,i.next)===0)?((r||i===e)&&(e=i.prev),ns=!0,hi(i),i=i.prev,n=!0):(r||i!==e)&&(i=i.next,n=!r);while(n||i!==e);return e}function as(t,e,r,i,n){n&&W0(t,r,i,n);let a=t,s=!1;for(;t.prev!==t.next;){let o=t.prev,l=t.next;if(pt(o,t,l)<0&&(n?R0(t,r,i,n):O0(t))){e.push(o.i,t.i,l.i),hi(t),t=l,a=l;continue}if(t=l,t===a){if(ns=!1,t=Ve(t),ns){a=t;continue}if(!s){t=$0(t,e),a=t,s=!0;continue}N0(t,e,r,i,n);break}}}function O0(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)&&hn(n,o,a,l,s,u,d.x,d.y)&&pt(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function R0(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=us(f,d,e,r,i),x=us(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)&&hn(o,h,l,c,u,p,b.x,b.y)&&pt(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)&&hn(o,h,l,c,u,p,v.x,v.y)&&pt(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function $0(t,e){let r=t,i=!1;do{let n=r.prev,a=r.next.next;rp(n,r,r.next,a,!1)&&ui(n,a)&&ui(a,n)&&(e.push(n.i,r.i,a.i),hi(r),hi(r.next),r=t=a,i=!0),r=r.next}while(r!==t);return i?Ve(r):r}function N0(t,e,r,i,n){let a=t;do{let s=a.next.next;for(;s!==a.prev;){if(a.i!==s.i&&J0(a,s)){let o=ip(a,s);a=Ve(a,a.next),o=Ve(o,o.next),as(a,e,r,i,n),as(o,e,r,i,n);return}s=s.next}a=a.next}while(a!==t)}var ss=!1;function U0(t,e,r,i){let n=[];for(let a=0,s=e.length;a<s;a++){let o=tp(t,e[a]*i,a<s-1?e[a+1]*i:t.length,i,!1);o===o.next&&oi.add(o),n.push(K0(o))}n.sort(q0),j0(t.length/i,e.length),ep(r,r),ss=!0;for(let a=0;a<n.length;a++)r=G0(n[a],r);return ss=!1,Ve(r)}function q0(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 G0(t,e){let r=X0(t,e);if(!r)return e;let i=ip(r,t),n=i.next;return ep(r,n.next),Ve(i,i.next),Ve(r,r.next)}var st=new Float64Array,un=0,os=[],ls=[];function j0(t,e){let r=Math.ceil((t+2*e)/16)+e+2;st.length<r*4&&(st=new Float64Array(r*4)),un=0}function ep(t,e){let r=t;do{let i=un++;os[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);ls[i]=r;let u=i*4;st[u]=n,st[u+1]=a,st[u+2]=s,st[u+3]=o}while(r!==e)}function Y0(t,e){let r=t.z*4;e.x<st[r]&&(st[r]=e.x),e.y<st[r+1]&&(st[r+1]=e.y),e.x>st[r+2]&&(st[r+2]=e.x),e.y>st[r+3]&&(st[r+3]=e.y)}function jl(t){let e=ls[t];for(;e.prev.next!==e;)e=e.next;return ls[t]=e,e}function Yl(t){let e=os[t];for(;e.prev.next!==e;)e=e.next;return os[t]=e,e}function X0(t,e){let r=e,i=t.x,n=t.y,a=-1/0,s;if(li(t,r))return r;for(let p=0,f=0;p<un;p++,f+=4){if(n<st[f+1]||n>st[f+3]||st[f]>i||st[f+2]<=a)continue;let d=jl(p);r=Yl(p);do{if(r.prev.next===r){if(li(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<un;p++,f+=4){if(st[f+2]<o||st[f]>i||st[f+3]<u||st[f+1]>h)continue;let d=jl(p);r=Yl(p);do{if(r.prev.next===r&&i>=r.x&&r.x>=o&&i!==r.x&&hn(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);(ui(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&&Z0(s,r)))&&(s=r,c=y)}r=r.next}while(r!==d)}return s}function Z0(t,e){return pt(t.prev,t,e.prev)<0&&pt(e.next,t,t.next)<0}var Lt=[],Tr=[],Ae=new Uint32Array,Fr=new Uint32Array,kr=new Uint32Array(256);function W0(t,e,r,i){let n=t,a=0;do n.z=us(n.x,n.y,e,r,i),Lt[a++]=n,n=n.next;while(n!==t);H0(a);let s=null;for(let o=0;o<a;o++){let l=Lt[o];l.prevZ=s,s&&(s.nextZ=l),s=l}s.nextZ=null}function H0(t){if(t<=32){for(let e=1;e<t;e++){let r=Lt[e],i=r.z,n=e-1;for(;n>=0&&Lt[n].z>i;)Lt[n+1]=Lt[n],n--;Lt[n+1]=r}return}Ae.length<t&&(Ae=new Uint32Array(t),Fr=new Uint32Array(t),Tr=Array(t));for(let e=0;e<t;e++)Ae[e]=Lt[e].z;Bi(t,Lt,Ae,Tr,Fr,0),Bi(t,Tr,Fr,Lt,Ae,8),Bi(t,Lt,Ae,Tr,Fr,16),Bi(t,Tr,Fr,Lt,Ae,24)}function Bi(t,e,r,i,n,a){kr.fill(0);for(let o=0;o<t;o++)kr[r[o]>>>a&255]++;let s=0;for(let o=0;o<256;o++){let l=kr[o];kr[o]=s,s+=l}for(let o=0;o<t;o++){let l=r[o],u=kr[l>>>a&255]++;i[u]=e[o],n[u]=l}}function us(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 K0(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 hn(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 J0(t,e){let r=li(t,e)&&pt(t.prev,t,t.next)>0&&pt(e.prev,e,e.next)>0;return t.next.i!==e.i&&(r||ui(t,e)&&ui(e,t)&&(pt(t.prev,t,e.prev)!==0||pt(t,e.prev,e)!==0))&&!Q0(t,e)&&(r||t1(t,e))}function pt(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function li(t,e){return t.x===e.x&&t.y===e.y}function rp(t,e,r,i,n=!0){let a=pt(t,e,r),s=pt(t,e,i),o=pt(r,i,t),l=pt(r,i,e);return(a>0&&s<0||a<0&&s>0)&&(o>0&&l<0||o<0&&l>0)?!0:n?!!(a===0&&Pi(t,r,e)||s===0&&Pi(t,i,e)||o===0&&Pi(r,t,i)||l===0&&Pi(r,e,i)):!1}function Pi(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 Q0(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&&rp(s,o,t,e))return!0;s=o}while(s!==t);return!1}function ui(t,e){return pt(t.prev,t,t.next)<0?pt(t,e,t.next)>=0&&pt(t,t.prev,e)>=0:pt(t,e,t.prev)<0||pt(t,t.next,e)<0}function t1(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 ip(t,e){let r=hs(t.i,t.x,t.y),i=hs(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 Xl(t,e,r,i){let n=hs(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 hi(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),ss&&Y0(t.prev,t.next)}function hs(t,e,r){return{i:t,x:e,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null}}function e1(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 Rr=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)}},r1=class np{constructor(e){this.fill=e.fill,this.line=e.line,this.tile=e.tile,this.stencil=e.stencil,this.circle=e.circle}static{this.noSubdivision=new np({fill:new Rr(0,0),line:new Rr(0,0),tile:new Rr(0,0),stencil:new Rr(0,0),circle:1})}};I("SubdivisionGranularityExpression",Rr),I("SubdivisionGranularitySetting",r1);var la=-32768,ua=32767,i1=class{constructor(t,e){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=t,this._granularityCellSize=it/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 a1(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);s1(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 S=o+f*b,D=l+d*b;a.push(this._vertexToIndex(S,D))}let w=o+f*Math.max(b,0),A=o+f*Math.min(v,1);if(y||this._generateIntraEdgeVertices(a,o,l,u,h,w,A),!m&&v<1){let S=o+f*v,D=l+d*v;a.push(this._vertexToIndex(S,D))}(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,A,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 S=e-a,D=r-s,E=(l-s)/D,L=(u-s)/D,$=a+S*Math.min(E,L);x=Math.floor(Math.min($,o)/this._granularityCellSize)+1,b=Math.ceil(Math.max($,o)/this._granularityCellSize)-1,v=o<$}let A=h>0?u:l;if(v)for(let S=x;S<=b;S++){let D=S*this._granularityCellSize;t.push(this._vertexToIndex(D,A))}else for(let S=b;S>=x;S--){let D=S*this._granularityCellSize;t.push(this._vertexToIndex(D,A))}}_generateOutline(t){let e=[];for(let r of t){let i=Fe(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=it,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,la),f===0&&y===0&&this._generatePoleQuad(t,l,u,p,d,la),y===0&&c===0&&this._generatePoleQuad(t,u,o,d,h,la)),r&&(c===n&&f===n&&this._generatePoleQuad(t,o,l,h,p,ua),f===n&&y===n&&this._generatePoleQuad(t,l,u,p,d,ua),y===n&&c===n&&this._generatePoleQuad(t,u,o,d,h,ua))}}_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}=n1(t);this._initializeVertices(r);let n;try{let s=V0(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 ap(t,e,r,i=!0){return new i1(r,e).subdividePolygonInternal(t,i)}function Fe(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(it/e),o=[];o.push(new M(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),A=Math.abs(v),S=f,D=d;for(;;){let L=b>0?(Math.floor(S/s)+1)*s:(Math.ceil(S/s)-1)*s,$=v>0?(Math.floor(D/s)+1)*s:(Math.ceil(D/s)-1)*s,P=Math.abs(S-L),z=Math.abs(D-$),F=Math.abs(S-y),V=Math.abs(D-m),R=g?P/w:1/0,B=x?z/A:1/0;if((F<=P||!g)&&(V<=z||!x))break;if(R<B&&g||!x){S=L,D+=v*R;let G=new M(S,Math.round(D));(o[o.length-1].x!==G.x||o[o.length-1].y!==G.y)&&o.push(G)}else{S+=b*B,D=$;let G=new M(Math.round(S),D);(o[o.length-1].x!==G.x||o[o.length-1].y!==G.y)&&o.push(G)}}let E=new M(y,m);(o[o.length-1].x!==E.x||o[o.length-1].y!==E.y)&&o.push(E)}return o}function n1(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 a1(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 s1(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 sp(t,e,r,i,n,a,s,o,l){let u=n.length/2,h=s&&o&&l;if(u<Ct.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 o1(e,r,i,n,a,t),h&&l1(s,r,o,n,l,t),e.forceNewSegmentOnNextPrepare(),s?.forceNewSegmentOnNextPrepare()}function Xr(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 o1(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>Ct.MAX_VERTEX_ARRAY_LENGTH&&(u=t.createNewSegment(e,r),l=o.count,y=!0,m=!0,g=!0,h=0);let b=Xr(s,i,a,o,p,y,u),v=Xr(s,i,a,o,f,m,u),w=Xr(s,i,a,o,d,g,u);r.emplaceBack(h+b-l,h+v-l,h+w-l),u.primitiveLength++}}function l1(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>Ct.MAX_VERTEX_ARRAY_LENGTH&&(u=t.createNewSegment(e,r),l=o.count,y=!0,m=!0,h=0);let x=Xr(s,i,a,o,f,y,u),b=Xr(s,i,a,o,d,m,u);r.emplaceBack(h+x-l,h+b-l),u.primitiveLength++}}var On=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.patternFeatures=[],this.layoutVertexArray=new Rm,this.indexArray=new xi,this.indexArray2=new Ha,this.programConfigurations=new Le(t.layers,t.zoom),this.segments=new Ct,this.segments2=new Ct,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(t,e,r){this.hasDependencies=ln("fill",this.layers,e);let i=this.layers[0].layout.get("fill-sort-key"),n=!i.isConstant(),a=[],s=new H(this.zoom),o=this.layers[0]._featureFilter.needGeometry;for(let{feature:l,id:u,index:h,sourceLayerIndex:c}of t){let p=br(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:$e(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=uo("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(t,e,r){for(let i of this.patternFeatures)this.addFeature(i,i.geometry,i.index,e,r,t.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,L0),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 Sn(e,500)){let o=ap(s,i,a.fill.getGranularityForZoomLevel(i.z)),l=this.layoutVertexArray;sp((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",On,{omit:["layers","patternFeatures"]});var u1,h1=()=>u1||=new Ft({"fill-sort-key":new O(_.layout_fill["fill-sort-key"],"fill-sort-key")}),c1,p1=()=>c1||=new Ft({"fill-antialias":new C(_.paint_fill["fill-antialias"],"fill-antialias"),"fill-opacity":new O(_.paint_fill["fill-opacity"],"fill-opacity"),"fill-layer-opacity":new C(_.paint_fill["fill-layer-opacity"],"fill-layer-opacity"),"fill-color":new O(_.paint_fill["fill-color"],"fill-color"),"fill-outline-color":new O(_.paint_fill["fill-outline-color"],"fill-outline-color"),"fill-translate":new C(_.paint_fill["fill-translate"],"fill-translate"),"fill-translate-anchor":new C(_.paint_fill["fill-translate-anchor"],"fill-translate-anchor"),"fill-pattern":new ni(_.paint_fill["fill-pattern"],"fill-pattern")}),f1={get paint(){return p1()},get layout(){return h1()}};var d1=class extends jt{constructor(t,e){super(t,f1,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 On(t)}queryRadius(){return zn(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:t,geometry:e,transform:r,pixelsToTileUnits:i}){return Yc(Ln(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-r.bearingInRadians,i),e)}isTileClipped(){return!0}},cs=ut([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),y1=ut([{name:"a_centroid",components:2,type:"Int16"}],4),m1=cs.members;cs.size,cs.alignment;var cn=class ps{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 ps;return r.extend(e(new M(this.minX,this.minY))),r.extend(e(new M(this.maxX,this.minY))),r.extend(e(new M(this.minX,this.maxY))),r.extend(e(new M(this.maxX,this.maxY))),r}static fromPoints(e){let r=new ps;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}},vw=cn.fromPoints([new M(0,0),new M(it,it)]);function fs(t,e){return t.x===e.x&&(t.x<0||t.x>8192)||t.y===e.y&&(t.y<0||t.y>8192)}function Zl(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 vi=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 M(s,o)];else if(n===2)s+=t.readSVarint(),o+=t.readSVarint(),i&&i.push(new M(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 c=op(s),p=[];for(let f of c)p.push(f.map(l));u=p.length===1?{type:"Polygon",coordinates:p[0]}:{type:"MultiPolygon",coordinates:p}}else throw Error("unknown feature type");let h={type:"Feature",geometry:u,properties:this.properties};return this.id!=null&&(h.id=this.id),h}};vi.types=["Unknown","Point","LineString","Polygon"];function op(t){let e=t.length;if(e<=1)return[t];let r=[],i,n;for(let a=0;a<e;a++){let s=g1(t[a]);s!==0&&(n===void 0&&(n=s<0),n===s<0?(i&&r.push(i),i=[t[a]]):i&&i.push(t[a]))}return i&&r.push(i),r}function g1(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 x1=class{constructor(t,e){for(this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],e===void 0&&(e=t.length);t.pos<e;){let r=t.readVarint();r===10?this.name=t.readString():r===18?(this._features.push(t.pos),t.skip(r)):r===26?this._keys.push(t.readString()):r===34?this._values.push(v1(t)):r===40?this.extent=t.readVarint():r===120?this.version=t.readVarint():t.skip(r)}this.length=this._features.length}feature(t){if(t<0||t>=this._features.length)throw Error("feature index out of bounds");this._pbf.pos=this._features[t];let e=this._pbf.readVarint()+this._pbf.pos;return new vi(this._pbf,e,this.extent,this._keys,this._values)}};function v1(t){let e=null,r=t.readVarint()+t.pos;for(;t.pos<r;){let i=t.readVarint();e=i===10?t.readString():i===21?t.readFloat():i===25?t.readDouble():i===32?t.readVarint(!0):i===40?t.readVarint():i===48?t.readSVarint():i===56?t.readBoolean():(t.skip(i),null)}if(e==null)throw Error("unknown feature value");return e}var ho=class{constructor(t,e=t.length){let r=Object.create(null);for(;t.pos<e;){let i=t.readVarint();if(i===26){let n=new x1(t,t.readVarint()+t.pos);n.length&&(r[n.name]=n)}else t.skip(i)}this.layers=r}},lp=63710088e-1,Wl=class $r{constructor(e,r){if(isNaN(e)||isNaN(r))throw Error(`Invalid LngLat object: (${e}, ${r})`);if(this.lng=+e,this.lat=+r,this.lat>90||this.lat<-90)throw Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new $r(rd(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){let r=Math.PI/180,i=this.lat*r,n=e.lat*r,a=Math.sin(i)*Math.sin(n)+Math.cos(i)*Math.cos(n)*Math.cos((e.lng-this.lng)*r);return lp*Math.acos(Math.min(a,1))}static convert(e){if(e instanceof $r)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new $r(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e)return new $r(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}},up=2*Math.PI*lp;function hp(t){return up*Math.cos(t*Math.PI/180)}function b1(t){return(180+t)/360}function w1(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function _1(t,e){return t/hp(e)}function S1(t){return t*360-180}function ds(t){let e=180-t*360;return 360/Math.PI*Math.atan(Math.exp(e*Math.PI/180))-90}function A1(t,e){return t*hp(ds(e))}function D1(t){return 1/Math.cos(t*Math.PI/180)}var co=class cp{constructor(e,r,i=0){this.x=+e,this.y=+r,this.z=+i}static fromLngLat(e,r=0){let i=Wl.convert(e);return new cp(b1(i.lng),w1(i.lat),_1(r,i.lat))}toLngLat(){return new Wl(S1(this.x),ds(this.y))}toAltitude(){return A1(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/up*D1(ds(this.y))}};function E1(t,e,r){let i=1/(1<<r.z);return new co(t/it*i+r.x*i,e/it*i+r.y*i)}function T1(t,e,r){return E1(t,e,r).toLngLat()}function Hl(t,e,r){if(e<=0||!t||t.length===0)return t;let i=F1(e,r);return t.map(n=>k1(n,i))}function F1(t,e){let r=T1(it/2,it/2,e),i=co.fromLngLat(r).meterInMercatorCoordinateUnits(),n=(1<<e.z)*it;return t*i*n}function k1(t,e){if(!t||t.length<3)return t;let r=t[0].x===t[t.length-1].x&&t[0].y===t[t.length-1].y,i=r?t.length-1:t.length;if(i<3)return t;let n=[];for(let s=0;s<i;s++){let o=t[(s-1+i)%i],l=t[s],u=t[(s+1)%i];if(fs(o,l)||fs(l,u)){n.push(l.clone());continue}M1(n,o,l,u,e)}let a=I1(n);return a.length<3?t:(r&&a.push(a[0].clone()),a)}function I1(t){let e=[];for(let r of t){let i=r.round(),n=e[e.length-1];(n?.x!==i.x||n?.y!==i.y)&&e.push(i)}for(;e.length>1&&e[0].x===e[e.length-1].x&&e[0].y===e[e.length-1].y;)e.pop();return e}function M1(t,e,r,i,n){let a=e.sub(r),s=i.sub(r),o=a.mag(),l=s.mag();if(o<1e-6||l<1e-6){t.push(r.clone());return}a._div(o),s._div(l);let u=a.x*s.x+a.y*s.y;if(Math.abs(u)>Math.cos(5*Math.PI/180)){t.push(r.clone());return}let h=.2,c=Math.min(n,o*h,l*h),p=r.add(a.mult(c)),f=r.add(s.mult(c)),d=Math.sqrt((1+u)/2),y=r.add(a.add(s)._unit()._mult(c/d)),m=p.sub(y).angleWith(f.sub(y)),g=Math.max(2,Math.ceil(Math.abs(m)/(Math.PI/6)-1e-6));for(let x=0;x<=g;x++)t.push(p.rotateAround(x/g*m,y))}var ha=8192;function Ir(t,e,r,i,n,a,s,o){t.emplaceBack(e,r,Math.floor(i*ha)*2+s,n*ha*2,a*ha*2,Math.round(o))}var Rn=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.centroidVertexArray=new Vm,this.indexArray=new xi,this.programConfigurations=new Le(t.layers,t.zoom),this.segments=new Ct,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(t,e,r){this.features=[],this.hasDependencies=ln("fill-extrusion",this.layers,e);let i=new H(this.zoom),n=this.layers[0],a=n.layout.get("fill-extrusion-rounded-corner-distance"),s=n._featureFilter.needGeometry;for(let{feature:o,id:l,index:u,sourceLayerIndex:h}of t){let c=br(o,s);if(!n._featureFilter.filter(i,c,r))continue;let p=s?c.geometry:$e(o),f={id:l,sourceLayerIndex:h,index:u,geometry:a>0?Hl(p,a,r):p,properties:o.properties,type:o.type,patterns:{}};this.hasDependencies?this.features.push(uo("fill-extrusion",this.layers,f,{zoom:this.zoom},e)):this.addFeature(f,f.geometry,u,r,{},e.subdivisionGranularity),e.featureIndex.insert(o,f.geometry,u,h,this.index,!0)}}addFeatures(t,e,r){for(let i of this.features){let{geometry:n}=i;this.addFeature(i,n,i.index,e,r,t.subdivisionGranularity)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,{imagePositions:r})}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,m1),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,y1.members,!0),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(),this.centroidVertexBuffer.destroy())}addFeature(t,e,r,i,n,a){let s=this.layers[0],o=s.layout?s.layout.get("fill-extrusion-rounded-corner-distance"):0,l=o>0?Hl(e,o,i):e;for(let u of Sn(l,500)){let h={x:0,y:0,sampleCount:0},c=this.layoutVertexArray.length;this.processPolygon(h,i,t,u,a);let p=this.layoutVertexArray.length-c,f=Math.floor(h.x/h.sampleCount),d=Math.floor(h.y/h.sampleCount);for(let y=0;y<p;y++)this.centroidVertexArray.emplaceBack(f,d)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{imagePositions:n,canonical:i})}processPolygon(t,e,r,i,n){if(i.length<1||Zl(i[0]))return;for(let h of i)h.length!==0&&C1(t,h);let a={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},s=n.fill.getGranularityForZoomLevel(e.z),o=vi.types[r.type]==="Polygon";for(let h of i){if(h.length===0||Zl(h))continue;let c=Fe(h,s,o);this._generateSideFaces(c,a)}if(!o)return;let l=ap(i,e,s,!1),u=this.layoutVertexArray;sp((h,c)=>{Ir(u,h,c,0,0,1,1,0)},this.segments,this.layoutVertexArray,this.indexArray,l.verticesFlattened,l.indicesTriangles)}_generateSideFaces(t,e){let r=0;for(let i=1;i<t.length;i++){let n=t[i],a=t[i-1];if(fs(n,a))continue;e.segment.vertexLength+4>Ct.MAX_VERTEX_ARRAY_LENGTH&&(e.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let s=n.sub(a)._perp()._unit(),o=a.dist(n);r+o>32768&&(r=0),Ir(this.layoutVertexArray,n.x,n.y,s.x,s.y,0,0,r),Ir(this.layoutVertexArray,n.x,n.y,s.x,s.y,0,1,r),r+=o,Ir(this.layoutVertexArray,a.x,a.y,s.x,s.y,0,0,r),Ir(this.layoutVertexArray,a.x,a.y,s.x,s.y,0,1,r);let l=e.segment.vertexLength;this.indexArray.emplaceBack(l,l+2,l+1),this.indexArray.emplaceBack(l+1,l+2,l+3),e.segment.vertexLength+=4,e.segment.primitiveLength+=2}}};function C1(t,e){for(let r=0;r<e.length;r++){let i=e[r];(r!==e.length-1||e[0].x!==i.x||e[0].y!==i.y)&&(t.x+=i.x,t.y+=i.y,t.sampleCount++)}}I("FillExtrusionBucket",Rn,{omit:["layers","features"]});var B1,P1=()=>B1||=new Ft({"fill-extrusion-rounded-corner-distance":new C(_["layout_fill-extrusion"]["fill-extrusion-rounded-corner-distance"],"fill-extrusion-rounded-corner-distance")}),z1,L1=()=>z1||=new Ft({"fill-extrusion-opacity":new C(_["paint_fill-extrusion"]["fill-extrusion-opacity"],"fill-extrusion-opacity"),"fill-extrusion-color":new O(_["paint_fill-extrusion"]["fill-extrusion-color"],"fill-extrusion-color"),"fill-extrusion-translate":new C(_["paint_fill-extrusion"]["fill-extrusion-translate"],"fill-extrusion-translate"),"fill-extrusion-translate-anchor":new C(_["paint_fill-extrusion"]["fill-extrusion-translate-anchor"],"fill-extrusion-translate-anchor"),"fill-extrusion-pattern":new ni(_["paint_fill-extrusion"]["fill-extrusion-pattern"],"fill-extrusion-pattern"),"fill-extrusion-height":new O(_["paint_fill-extrusion"]["fill-extrusion-height"],"fill-extrusion-height"),"fill-extrusion-base":new O(_["paint_fill-extrusion"]["fill-extrusion-base"],"fill-extrusion-base"),"fill-extrusion-vertical-gradient":new C(_["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"],"fill-extrusion-vertical-gradient")}),V1={get paint(){return L1()},get layout(){return P1()}};var O1=class extends jt{constructor(t,e){super(t,V1,e)}createBucket(t){return new Rn(t)}queryRadius(){return zn(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:r,geometry:i,transform:n,pixelsToTileUnits:a,pixelPosMatrix:s}){let o=Ln(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-n.bearingInRadians,a),l=this.paint.get("fill-extrusion-height").evaluate(e,r),u=this.paint.get("fill-extrusion-base").evaluate(e,r),h=N1(o,s,0),c=$1(i,u,l,s),p=c[0],f=c[1];return R1(p,f,h)}};function Mr(t,e){return t.x*e.x+t.y*e.y}function Kl(t,e){if(t.length===1){let r=0,i=e[r++],n;for(;!n||i.equals(n);)if(n=e[r++],!n)return 1/0;for(;r<e.length;r++){let a=e[r],s=t[0],o=n.sub(i),l=a.sub(i),u=s.sub(i),h=Mr(o,o),c=Mr(o,l),p=Mr(l,l),f=Mr(u,o),d=Mr(u,l),y=h*p-c*c,m=(p*f-c*d)/y,g=(h*d-c*f)/y,x=1-m-g,b=i.z*x+n.z*m+a.z*g;if(isFinite(b))return b}return 1/0}{let r=1/0;for(let i of e)r=Math.min(r,i.z);return r}}function R1(t,e,r){let i=1/0;Yc(r,e)&&(i=Kl(r,e[0]));for(let n=0;n<e.length;n++){let a=e[n],s=t[n];for(let o=0;o<a.length-1;o++){let l=a[o],u=a[o+1],h=s[o],c=[l,u,s[o+1],h,l];i0(r,c)&&(i=Math.min(i,Kl(r,c)))}}return i!==1/0&&i}function $1(t,e,r,i){let n=[],a=[],s=i[8]*e,o=i[9]*e,l=i[10]*e,u=i[11]*e,h=i[8]*r,c=i[9]*r,p=i[10]*r,f=i[11]*r;for(let d of t){let y=[],m=[];for(let g of d){let x=g.x,b=g.y,v=i[0]*x+i[4]*b+i[12],w=i[1]*x+i[5]*b+i[13],A=i[2]*x+i[6]*b+i[14],S=i[3]*x+i[7]*b+i[15],D=v+s,E=w+o,L=A+l,$=S+u,P=v+h,z=w+c,F=A+p,V=S+f,R=new M(D/$,E/$);R.z=L/$,y.push(R);let B=new M(P/V,z/V);B.z=F/V,m.push(B)}n.push(y),a.push(m)}return[n,a]}function N1(t,e,r){let i=[];for(let n of t){let a=[n.x,n.y,r,1];Hf(a,a,e),i.push(new M(a[0]/a[3],a[1]/a[3]))}return i}function ys(t,e,r,i){let n=i,a=e+(r-e>>1),s=r-e,o,l=t[e],u=t[e+1],h=t[r],c=t[r+1];for(let p=e+3;p<r;p+=3){let f=U1(t[p],t[p+1],l,u,h,c);if(f>n){o=p,n=f;continue}if(f===n){let d=Math.abs(p-a);d<s&&(o=p,s=d)}}n>i&&(o-e>3&&ys(t,e,o,i),t[o+2]=n,r-o>3&&ys(t,o,r,i))}function U1(t,e,r,i,n,a){let s=n-r,o=a-i;if(s!==0||o!==0){let l=((t-r)*s+(e-i)*o)/(s*s+o*o);l>1?(r=n,i=a):l>0&&(r+=s*l,i+=o*l)}return s=t-r,o=e-i,s*s+o*o}function mt(t,e,r,i){let n={type:e,geom:r},a={id:t??null,type:n.type,geometry:n.geom,tags:i,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};switch(n.type){case"Point":case"MultiPoint":Cr(a,n.geom);break;case"LineString":Cr(a,n.geom.points);break;case"Polygon":Cr(a,n.geom[0].points);break;case"MultiLineString":for(let s of n.geom)Cr(a,s.points);break;case"MultiPolygon":for(let s of n.geom)Cr(a,s[0].points)}return a}function po(t){let e=t;t.points.length>64&&(e.points=new Float64Array(t.points))}function Cr(t,e){for(let r=0;r<e.length;r+=3)t.minX=Math.min(t.minX,e[r]),t.minY=Math.min(t.minY,e[r+1]),t.maxX=Math.max(t.maxX,e[r]),t.maxY=Math.max(t.maxY,e[r+1])}function fo(t,e){let r=[];switch(t.type){case"FeatureCollection":for(let i=0;i<t.features.length;i++)Hi(r,t.features[i],e,i);break;case"Feature":Hi(r,t,e);break;default:Hi(r,{type:"Feature",geometry:t,properties:void 0},e)}return r}function Hi(t,e,r,i,n=0){if(!e.geometry)return;if(n>1024)throw Error("GeometryCollection nesting exceeds supported depth: 1024");if(e.geometry.type==="GeometryCollection"){G1(t,e,e.geometry,r,i,n+1);return}if(!e.geometry.coordinates?.length)return;let a=q1(e,r,i),s=(r.tolerance/((1<<r.maxZoom)*r.extent))**2;switch(e.geometry.type){case"Point":j1(t,a,e.geometry,e.properties);return;case"MultiPoint":Y1(t,a,e.geometry,e.properties);return;case"LineString":X1(t,a,e.geometry,s,e.properties);return;case"MultiLineString":Z1(t,a,e.geometry,s,r,e.properties);return;case"Polygon":W1(t,a,e.geometry,s,e.properties);return;case"MultiPolygon":H1(t,a,e.geometry,s,e.properties);return;default:throw Error("Input data is not a valid GeoJSON object.")}}function q1(t,e,r){return e.promoteId?t.properties?.[e.promoteId]:e.generateId?r||0:t.id}function G1(t,e,r,i,n,a=0){for(let s of r.geometries)Hi(t,{id:e.id,type:"Feature",geometry:s,properties:e.properties},i,n,a)}function j1(t,e,r,i){let n=[];n.push(ar(r.coordinates[0]),sr(r.coordinates[1]),0),t.push(mt(e,"Point",n,i))}function Y1(t,e,r,i){let n=[];for(let a of r.coordinates)n.push(ar(a[0]),sr(a[1]),0);t.push(mt(e,"MultiPoint",n,i))}function X1(t,e,r,i,n){let a={points:[]};yo(r.coordinates,a,i,!1),t.push(mt(e,"LineString",a,n))}function Z1(t,e,r,i,n,a){if(n.lineMetrics)for(let s of r.coordinates){let o={points:[]};yo(s,o,i,!1),t.push(mt(e,"LineString",o,a))}else{let s=[];mo(r.coordinates,s,i,!1),t.push(mt(e,"MultiLineString",s,a))}}function W1(t,e,r,i,n){let a=[];mo(r.coordinates,a,i,!0),t.push(mt(e,"Polygon",a,n))}function H1(t,e,r,i,n){let a=[];for(let s of r.coordinates){let o=[];mo(s,o,i,!0),a.push(o)}t.push(mt(e,"MultiPolygon",a,n))}function yo(t,e,r,i){let n,a,s=0;for(let l=0;l<t.length;l++){let u=ar(t[l][0]),h=sr(t[l][1]);e.points.push(u,h,0),l>0&&(s+=i?(n*h-u*a)/2:Math.sqrt((u-n)**2+(h-a)**2)),n=u,a=h}let o=e.points.length-3;e.points[2]=1,r>0&&ys(e.points,0,o,r),e.points[o+2]=1,po(e),e.size=Math.abs(s),e.start=0,e.end=e.size}function mo(t,e,r,i){for(let n=0;n<t.length;n++){let a={points:[]};yo(t[n],a,r,i),e.push(a)}}function ar(t){return t/360+.5}function sr(t){let e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function K1(t){return{type:"FeatureCollection",features:t.map(e=>pn(e))}}function pn(t){let e={type:"Feature",geometry:J1(t),properties:t.tags};return t.id!=null&&(e.id=t.id),e}function J1(t){let{type:e,geometry:r}=t;switch(e){case"Point":return{type:e,coordinates:pp(r[0],r[1])};case"MultiPoint":return{type:e,coordinates:zi(r)};case"LineString":return{type:e,coordinates:zi(r.points)};case"MultiLineString":case"Polygon":return{type:e,coordinates:r.map(i=>zi(i.points))};case"MultiPolygon":return{type:e,coordinates:r.map(i=>i.map(n=>zi(n.points)))}}}function zi(t){let e=[];for(let r=0;r<t.length;r+=3)e.push(pp(t[r],t[r+1]));return e}function pp(t,e){return[fp(t),dp(e)]}function fp(t){return(t-.5)*360}function dp(t){let e=(180-t*360)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function re(t,e,r,i,n,a,s,o){if(r/=e,i/=e,a>=r&&s<i)return t;if(s<r||a>=i)return null;let l=[];for(let u of t){let h=n===0?u.minX:u.minY,c=n===0?u.maxX:u.maxY;if(h>=r&&c<i){l.push(u);continue}if(!(c<r||h>=i))switch(u.type){case"Point":case"MultiPoint":Q1(u,l,r,i,n);continue;case"LineString":tg(u,l,r,i,n,o);continue;case"MultiLineString":eg(u,l,r,i,n);continue;case"Polygon":rg(u,l,r,i,n);continue;case"MultiPolygon":ig(u,l,r,i,n);continue}}return l.length?l:null}function Q1(t,e,r,i,n){let a=[];if(ng(t.geometry,a,r,i,n),!a.length)return;let s=a.length===3?"Point":"MultiPoint";e.push(mt(t.id,s,a,t.tags))}function tg(t,e,r,i,n,a){let s=[];if(yp(t.geometry,s,r,i,n,!1,a.lineMetrics),s.length){if(a.lineMetrics){for(let o of s)e.push(mt(t.id,"LineString",o,t.tags));return}if(s.length>1){e.push(mt(t.id,"MultiLineString",s,t.tags));return}e.push(mt(t.id,"LineString",s[0],t.tags))}}function eg(t,e,r,i,n){let a=[];if(go(t.geometry,a,r,i,n,!1),a.length){if(a.length===1){e.push(mt(t.id,"LineString",a[0],t.tags));return}e.push(mt(t.id,"MultiLineString",a,t.tags))}}function rg(t,e,r,i,n){let a=[];go(t.geometry,a,r,i,n,!0),a.length&&e.push(mt(t.id,"Polygon",a,t.tags))}function ig(t,e,r,i,n){let a=[];for(let s of t.geometry){let o=[];go(s,o,r,i,n,!0),o.length&&a.push(o)}a.length&&e.push(mt(t.id,"MultiPolygon",a,t.tags))}function ng(t,e,r,i,n){for(let a=0;a<t.length;a+=3){let s=t[a+n];s>=r&&s<=i&&or(e,t[a],t[a+1],t[a+2])}}function yp(t,e,r,i,n,a,s){let o=Jl(t),l=n===0?ag:sg,u=t.start,h,c;for(let g=0;g<t.points.length-3;g+=3){let x=t.points[g],b=t.points[g+1],v=t.points[g+2],w=t.points[g+3],A=t.points[g+4],S=n===0?x:b,D=n===0?w:A,E=!1;s&&(h=Math.sqrt((x-w)**2+(b-A)**2)),S<r?D>r&&(c=l(o,x,b,w,A,r),s&&(o.start=u+h*c)):S>i?D<i&&(c=l(o,x,b,w,A,i),s&&(o.start=u+h*c)):or(o.points,x,b,v),D<r&&S>=r&&(c=l(o,x,b,w,A,r),E=!0),D>i&&S<=i&&(c=l(o,x,b,w,A,i),E=!0),!a&&E&&(s&&(o.end=u+h*c),e.push(o),o=Jl(t)),s&&(u+=h)}let p=t.points.length-3,f=t.points[p],d=t.points[p+1],y=t.points[p+2],m=n===0?f:d;m>=r&&m<=i&&or(o.points,f,d,y),p=o.points.length-3,a&&p>=3&&(o.points[p]!==o.points[0]||o.points[p+1]!==o.points[1])&&or(o.points,o.points[0],o.points[1],o.points[2]),o.points.length&&(po(o),e.push(o))}function Jl(t){return{points:[],size:t.size,start:t.start,end:t.end}}function go(t,e,r,i,n,a){for(let s of t)yp(s,e,r,i,n,a,!1)}function or(t,e,r,i){t.push(e,r,i)}function ag(t,e,r,i,n,a){let s=(a-e)/(i-e);return or(t.points,a,r+(n-r)*s,1),s}function sg(t,e,r,i,n,a){let s=(a-r)/(n-r);return or(t.points,e+(i-e)*s,a,1),s}function xo(t,e){let r=e.buffer/e.extent,i=t,n=re(t,1,-1-r,r,0,-1,2,e),a=re(t,1,1-r,2+r,0,-1,2,e);return!n&&!a||(i=re(t,1,-r,1+r,0,-1,2,e)||[],n&&(i=Ql(n,1).concat(i)),a&&(i=i.concat(Ql(a,-1)))),i}function Ql(t,e){let r=[];for(let i of t)switch(i.type){case"Point":case"MultiPoint":{let n=og(i.geometry,e);r.push(mt(i.id,i.type,n,i.tags));continue}case"LineString":{let n=ca(i.geometry,e);r.push(mt(i.id,i.type,n,i.tags));continue}case"MultiLineString":case"Polygon":{let n=[];for(let a of i.geometry)n.push(ca(a,e));r.push(mt(i.id,i.type,n,i.tags));continue}case"MultiPolygon":{let n=[];for(let a of i.geometry){let s=[];for(let o of a)s.push(ca(o,e));n.push(s)}r.push(mt(i.id,i.type,n,i.tags));continue}}return r}function og(t,e){let r=[];for(let i=0;i<t.length;i+=3)r.push(t[i]+e,t[i+1],t[i+2]);return r}function ca(t,e){let r={points:[],size:t.size};t.start!==void 0&&(r.start=t.start,r.end=t.end);for(let i=0;i<t.points.length;i+=3)r.points.push(t.points[i]+e,t.points[i+1],t.points[i+2]);return po(r),r}function lg(t,e,r){let i=hg(e,r),n=[];if(i.removeAll&&(n=t,t=[]),i.remove.size||i.add.size){let a=[];for(let s of t)(i.remove.has(s.id)||i.add.has(s.id))&&a.push(s);if(a.length){n=n.concat(a);let s=new Set(a.map(o=>o.id));t=t.filter(o=>!s.has(o.id))}if(i.add.size){let s=fo({type:"FeatureCollection",features:Array.from(i.add.values())},r);s=xo(s,r),n=n.concat(s),t=t.concat(s)}}if(i.update.size){let a=new Map,s=[];for(let o of t)i.update.has(o.id)?a.set(o.id,[...a.get(o.id)||[],o]):s.push(o);for(let[o,l]of i.update){let u=a.get(o);if(!u||u.length===0)continue;let h=ug(u,l,r);n=n.concat(u,h),s=s.concat(h)}t=s}return{affected:n,source:t}}function ug(t,e,r){let i=!!e.newGeometry,n=e.removeAllProperties||e.removeProperties?.length>0||e.addOrUpdateProperties?.length>0;if(i){let a=t[0],s=fo({type:"FeatureCollection",features:[{type:"Feature",id:a.id,geometry:e.newGeometry,properties:n?tu(a.tags,e):a.tags}]},r);return s=xo(s,r),s}if(n){let a=[];for(let s of t){let o={...s};o.tags=tu(o.tags,e),a.push(o)}return a}return t}function tu(t,e){if(e.removeAllProperties)return{};let r={...t||{}};if(e.removeProperties)for(let i of e.removeProperties)delete r[i];if(e.addOrUpdateProperties)for(let{key:i,value:n}of e.addOrUpdateProperties)r[i]=n;return r}function hg(t,e){return t?{removeAll:t.removeAll,remove:new Set(t.remove||[]),add:new Map(t.add?.map(r=>[e.promoteId?r.properties[e.promoteId]:r.id,r])),update:new Map(t.update?.map(r=>[r.id,r]))}:{remove:new Set,add:new Map,update:new Map}}var eu=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],et=new Uint32Array(96),cg=class mp{static from(e){if(!e||e.byteLength===void 0||e.buffer)throw Error("Data must be an instance of ArrayBuffer or SharedArrayBuffer.");let[r,i]=new Uint8Array(e,0,2);if(r!==219)throw Error("Data does not appear to be in a KDBush format.");let n=i>>4;if(n!==1)throw Error(`Got v${n} data when expected v1.`);let a=eu[i&15];if(!a)throw Error("Unrecognized array type.");let[s]=new Uint16Array(e,2,1),[o]=new Uint32Array(e,4,1);return new mp(o,s,a,void 0,e)}constructor(e,r=64,i=Float64Array,n=ArrayBuffer,a){if(isNaN(e)||e<0)throw Error(`Unexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=i,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;let s=eu.indexOf(this.ArrayType),o=e*2*this.ArrayType.BYTES_PER_ELEMENT,l=e*this.IndexArrayType.BYTES_PER_ELEMENT,u=(8-l%8)%8;if(s<0)throw Error(`Unexpected typed array class: ${i}.`);if(a)this.data=a,this.ids=new this.IndexArrayType(a,8,e),this.coords=new i(a,8+l+u,e*2),this._pos=e*2,this._finished=!0;else{let h=this.data=new n(8+o+l+u);this.ids=new this.IndexArrayType(h,8,e),this.coords=new i(h,8+l+u,e*2),this._pos=0,this._finished=!1,new Uint8Array(h,0,2).set([219,16+s]),new Uint16Array(h,2,1)[0]=r,new Uint32Array(h,4,1)[0]=e}}add(e,r){let i=this._pos>>1;return this.ids[i]=i,this.coords[this._pos++]=e,this.coords[this._pos++]=r,i}finish(){let e=this._pos>>1;if(e!==this.numItems)throw Error(`Added ${e} items when expected ${this.numItems}.`);return ms(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,r,i,n){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:a,coords:s,nodeSize:o}=this;et[0]=0,et[1]=a.length-1,et[2]=0;let l=3,u=[];for(;l>0;){let h=et[--l],c=et[--l],p=et[--l];if(c-p<=o){for(let m=p;m<=c;m++){let g=s[2*m],x=s[2*m+1];g>=e&&g<=i&&x>=r&&x<=n&&u.push(a[m])}continue}let f=p+c>>1,d=s[2*f],y=s[2*f+1];d>=e&&d<=i&&y>=r&&y<=n&&u.push(a[f]),(h===0?e<=d:r<=y)&&(et[l++]=p,et[l++]=f-1,et[l++]=1-h),(h===0?i>=d:n>=y)&&(et[l++]=f+1,et[l++]=c,et[l++]=1-h)}return u}within(e,r,i){let n=[];return this.withinInto(e,r,i,n),n}withinInto(e,r,i,n){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:a,coords:s,nodeSize:o}=this;et[0]=0,et[1]=a.length-1,et[2]=0;let l=3,u=0,h=i*i;for(;l>0;){let c=et[--l],p=et[--l],f=et[--l];if(p-f<=o){for(let g=f;g<=p;g++)ru(s[2*g],s[2*g+1],e,r)<=h&&(n[u++]=a[g]);continue}let d=f+p>>1,y=s[2*d],m=s[2*d+1];ru(y,m,e,r)<=h&&(n[u++]=a[d]),(c===0?e-i<=y:r-i<=m)&&(et[l++]=f,et[l++]=d-1,et[l++]=1-c),(c===0?e+i>=y:r+i>=m)&&(et[l++]=d+1,et[l++]=p,et[l++]=1-c)}return u}};function ms(t,e,r,i,n,a){if(n-i<=r)return;let s=i+n>>1;gp(t,e,s,i,n,a),ms(t,e,r,i,s-1,1-a),ms(t,e,r,s+1,n,1-a)}function gp(t,e,r,i,n,a){for(;n>i;){if(n-i>600){let u=n-i+1,h=r-i+1,c=Math.log(u),p=.5*Math.exp(2*c/3),f=.5*Math.sqrt(c*p*(u-p)/u)*(h-u/2<0?-1:1);gp(t,e,r,Math.max(i,Math.floor(r-h*p/u+f)),Math.min(n,Math.floor(r+(u-h)*p/u+f)),a)}let s=e[2*r+a],o=i,l=n;for(Br(t,e,i,r),e[2*n+a]>s&&Br(t,e,i,n);o<l;){for(Br(t,e,o,l),o++,l--;e[2*o+a]<s;)o++;for(;e[2*l+a]>s;)l--}e[2*i+a]===s?Br(t,e,i,l):(l++,Br(t,e,l,n)),l<=r&&(i=l+1),r<=l&&(n=l-1)}}function Br(t,e,r,i){pa(t,r,i),pa(e,2*r,2*i),pa(e,2*r+1,2*i+1)}function pa(t,e,r){let i=t[e];t[e]=t[r],t[r]=i}function ru(t,e,r,i){let n=t-r,a=e-i;return n*n+a*a}var gs={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:t=>t},pg=class{constructor(t){this.options=Object.assign(Object.create(gs),t),this.trees=Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[],this.points=[]}load(t){let e=[];for(let r of t){if(!r.geometry)continue;let[i,n]=r.geometry.coordinates,[a,s]=[ar(i),sr(n)],o={id:r.id,type:"Point",geometry:[a,s],tags:r.properties};e.push(o)}this.createIndex(e)}initialize(t){let e=[];for(let r of t)r.type==="Point"&&e.push(r);this.createIndex(e)}updateIndex(t,e,r){this.options=Object.assign(Object.create(gs),r.clusterOptions),this.initialize(t)}createIndex(t){let{log:e,minZoom:r,maxZoom:i}=this.options;e&&console.time("total time");let n=`prepare ${t.length} points`;e&&console.time(n),this.points=t;let a=[];for(let o=0;o<t.length;o++){let l=t[o];if(!l?.geometry)continue;let[u,h]=l.geometry;u=Math.fround(u),h=Math.fround(h),a.push(u,h,1/0,o,-1,1),this.options.reduce&&a.push(0)}let s=this.trees[i+1]=this.createTree(a);e&&console.timeEnd(n);for(let o=i;o>=r;o--){let l=Date.now();s=this.trees[o]=this.createTree(this.cluster(s,o)),e&&console.log("z%d: %d clusters in %dms",o,s.numItems,Date.now()-l)}e&&console.timeEnd("total time")}getClusters(t,e){return this.getClustersInternal(t,e).map(r=>pn(r))}getClustersInternal(t,e){let r=((t[0]+180)%360+360)%360-180,i=Math.max(-90,Math.min(90,t[1])),n=t[2]===180?180:((t[2]+180)%360+360)%360-180,a=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)r=-180,n=180;else if(r>n){let h=this.getClustersInternal([r,i,180,a],e),c=this.getClustersInternal([-180,i,n,a],e);return h.concat(c)}let s=this.trees[this.limitZoom(e)],o=s.range(ar(r),sr(a),ar(n),sr(i)),l=s.flatData,u=[];for(let h of o){let c=this.stride*h;u.push(l[c+5]>1?fg(l,c,this.clusterProps):this.points[l[c+3]])}return u}getChildren(t){let e=this.getOriginId(t),r=this.getOriginZoom(t),i=Error("No cluster with the specified id: "+t),n=this.trees[r];if(!n)throw i;let a=n.flatData;if(e*this.stride>=a.length)throw i;let s=this.options.radius/(this.options.extent*2**(r-1)),o=a[e*this.stride],l=a[e*this.stride+1],u=n.within(o,l,s),h=[];for(let c of u){let p=c*this.stride;a[p+4]===t&&h.push(a[p+5]>1?dg(a,p,this.clusterProps):pn(this.points[a[p+3]]))}if(h.length===0)throw i;return h}getLeaves(t,e,r){e||=10,r||=0;let i=[];return this.appendLeaves(i,t,e,r,0),i}getTile(t,e,r){let i=this.trees[this.limitZoom(t)];if(!i)return null;let n=2**t,{extent:a,radius:s}=this.options,o=s/a,l=(r-o)/n,u=(r+1+o)/n,h={transformed:!0,features:[],source:null,x:e,y:r,z:t};return this.addTileFeatures(i.range((e-o)/n,l,(e+1+o)/n,u),i.flatData,e,r,n,h),e===0&&this.addTileFeatures(i.range(1-o/n,l,1,u),i.flatData,n,r,n,h),e===n-1&&this.addTileFeatures(i.range(0,l,o/n,u),i.flatData,-1,r,n,h),h}getClusterExpansionZoom(t){return this.getOriginZoom(t)}appendLeaves(t,e,r,i,n){let a=this.getChildren(e);for(let s of a){let o=s.properties;if(o?.cluster?n+o.point_count<=i?n+=o.point_count:n=this.appendLeaves(t,o.cluster_id,r,i,n):n<i?n++:t.push(s),t.length===r)break}return n}createTree(t){let e=new cg(t.length/this.stride|0,this.options.nodeSize,Float32Array);for(let r=0;r<t.length;r+=this.stride)e.add(t[r],t[r+1]);return e.finish(),e.flatData=t,e.data=null,e}addTileFeatures(t,e,r,i,n,a){for(let s of t){let o=s*this.stride,l=e[o+5]>1,u,h,c;if(l)u=vo(e,o,this.clusterProps),h=e[o],c=e[o+1];else{let d=this.points[e[o+3]];u=d.tags,[h,c]=d.geometry}let p={type:1,geometry:[[Math.round(this.options.extent*(h*n-r)),Math.round(this.options.extent*(c*n-i))]],tags:u},f;f=l||this.options.generateId?e[o+3]:this.points[e[o+3]].id,f!==void 0&&(p.id=f),a.features.push(p)}}limitZoom(t){return Math.max(this.options.minZoom,Math.min(Math.floor(+t),this.options.maxZoom+1))}cluster(t,e){let{radius:r,extent:i,reduce:n,minPoints:a}=this.options,s=r/(i*2**e),o=t.flatData,l=[],u=this.stride;for(let h=0;h<o.length;h+=u){if(o[h+2]<=e)continue;o[h+2]=e;let c=o[h],p=o[h+1],f=t.within(o[h],o[h+1],s),d=o[h+5],y=d;for(let m of f){let g=m*u;o[g+2]>e&&(y+=o[g+5])}if(y>d&&y>=a){let m=c*d,g=p*d,x,b=-1,v=((h/u|0)<<5)+(e+1)+this.points.length;for(let w of f){let A=w*u;if(o[A+2]<=e)continue;o[A+2]=e;let S=o[A+5];m+=o[A]*S,g+=o[A+1]*S,o[A+4]=v,n&&(x||(x=this.map(o,h,!0),b=this.clusterProps.length,this.clusterProps.push(x)),n(x,this.map(o,A)))}o[h+4]=v,l.push(m/y,g/y,1/0,v,-1,y),n&&l.push(b)}else{for(let m=0;m<u;m++)l.push(o[h+m]);if(y>1)for(let m of f){let g=m*u;if(!(o[g+2]<=e)){o[g+2]=e;for(let x=0;x<u;x++)l.push(o[g+x])}}}}return l}getOriginId(t){return t-this.points.length>>5}getOriginZoom(t){return(t-this.points.length)%32}map(t,e,r){if(t[e+5]>1){let a=this.clusterProps[t[e+6]];return r?Object.assign({},a):a}let i=this.points[t[e+3]].tags,n=this.options.map(i);return r&&n===i?Object.assign({},n):n}};function fg(t,e,r){return{id:t[e+3],type:"Point",tags:vo(t,e,r),geometry:[t[e],t[e+1]]}}function dg(t,e,r){return{type:"Feature",id:t[e+3],properties:vo(t,e,r),geometry:{type:"Point",coordinates:[fp(t[e]),dp(t[e+1])]}}}function vo(t,e,r){let i=t[e+5],n=i>=1e4?`${Math.round(i/1e3)}k`:i>=1e3?`${Math.round(i/100)/10}k`:i,a=t[e+6],s=a===-1?{}:Object.assign({},r[a]);return Object.assign(s,{cluster:!0,cluster_id:t[e+3],point_count:i,point_count_abbreviated:n})}var xp="geojsonvt_clip_start",vp="geojsonvt_clip_end";function iu(t,e,r,i,n){let a=e===n.maxZoom?0:n.tolerance/((1<<e)*n.extent),s={transformed:!1,features:[],source:null,x:r,y:i,z:e,minX:2,minY:1,maxX:-1,maxY:0,numPoints:0,numSimplified:0,numFeatures:t.length};for(let o of t)yg(s,o,a,n);return s}function yg(t,e,r,i){switch(t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),e.type){case"Point":case"MultiPoint":mg(t,e);return;case"LineString":gg(t,e,r,i);return;case"MultiLineString":case"Polygon":xg(t,e,r);return;case"MultiPolygon":vg(t,e,r);return}}function mg(t,e){let r=[];for(let n=0;n<e.geometry.length;n+=3)r.push(e.geometry[n],e.geometry[n+1]),t.numPoints++,t.numSimplified++;if(!r.length)return;let i={type:1,tags:e.tags||null,geometry:r};e.id!==null&&(i.id=e.id),t.features.push(i)}function gg(t,e,r,i){let n=[];if(bo(n,e.geometry,t,r,!1,!1),!n.length)return;let a=e.tags||null;if(i.lineMetrics){a={};for(let o in e.tags)a[o]=e.tags[o];a[xp]=e.geometry.start/e.geometry.size,a[vp]=e.geometry.end/e.geometry.size}let s={type:2,tags:a,geometry:n};e.id!==null&&(s.id=e.id),t.features.push(s)}function xg(t,e,r){let i=[];for(let a=0;a<e.geometry.length;a++)bo(i,e.geometry[a],t,r,e.type==="Polygon",a===0);if(!i.length)return;let n={type:e.type==="Polygon"?3:2,tags:e.tags||null,geometry:i};e.id!==null&&(n.id=e.id),t.features.push(n)}function vg(t,e,r){let i=[];for(let a=0;a<e.geometry.length;a++){let s=e.geometry[a];for(let o=0;o<s.length;o++)bo(i,s[o],t,r,!0,o===0)}if(!i.length)return;let n={type:3,tags:e.tags||null,geometry:i};e.id!==null&&(n.id=e.id),t.features.push(n)}function bo(t,e,r,i,n,a){let s=i*i;if(i>0&&e.size<(n?s:i)){r.numPoints+=e.points.length/3;return}let o=[];for(let l=0;l<e.points.length;l+=3)(i===0||e.points[l+2]>s)&&(r.numSimplified++,o.push(e.points[l],e.points[l+1])),r.numPoints++;n&&bg(o,a),t.push(o)}function bg(t,e){let r=0;for(let i=0,n=t.length,a=n-2;i<n;a=i,i+=2)r+=(t[i]-t[a])*(t[i+1]+t[a+1]);if(r>0===e)for(let i=0,n=t.length;i<n/2;i+=2){let a=t[i],s=t[i+1];t[i]=t[n-2-i],t[i+1]=t[n-1-i],t[n-2-i]=a,t[n-1-i]=s}}function nu(t,e){if(t.transformed)return t;let r=1<<t.z,i=t.x,n=t.y;for(let a of t.features)a.type===1?wg(a,e,r,i,n):_g(a,e,r,i,n);return t.transformed=!0,t}function wg(t,e,r,i,n){let a=t,s=t.geometry,o=[];for(let l=0;l<s.length;l+=2)o.push(bp(s[l],s[l+1],e,r,i,n));return a.geometry=o,a}function _g(t,e,r,i,n){let a=t,s=t.geometry,o=[];for(let l of s){let u=[];for(let h=0;h<l.length;h+=2)u.push(bp(l[h],l[h+1],e,r,i,n));o.push(u)}return a.geometry=o,a}function bp(t,e,r,i,n,a){return[Math.round(r*(t*i-n)),Math.round(r*(e*i-a))]}var Sg=class{constructor(t){this.options=t,this.total=0,this.stats={},this.tiles={},this.tileCoords=[],this.stats={},this.total=0}initialize(t){this.splitTile(t,0,0,0),this.options.debug&&(t.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}updateIndex(t,e,r){r.debug>1&&(console.log("invalidating tiles"),console.time("invalidating")),this.invalidateTiles(e),r.debug>1&&console.timeEnd("invalidating");let[i,n,a]=[0,0,0],s=iu(t,i,n,a,r);s.source=t;let o=Li(i,n,a);if(this.tiles[o]=s,this.tileCoords.push({z:i,x:n,y:a,id:o}),r.debug){let l=`z${i}`;this.stats[l]=(this.stats[l]||0)+1,this.total++}}getClusterExpansionZoom(t){return null}getChildren(t){return null}getLeaves(t,e,r){return null}getTile(t,e,r){let{extent:i,debug:n}=this.options,a=1<<t;e=e+a&a-1;let s=Li(t,e,r);if(this.tiles[s])return nu(this.tiles[s],i);n>1&&console.log("drilling down to z%d-%d-%d",t,e,r);let o=t,l=e,u=r,h;for(;!h&&o>0;)o--,l>>=1,u>>=1,h=this.tiles[Li(o,l,u)];return!h?.source||(n>1&&(console.log("found parent tile z%d-%d-%d",o,l,u),console.time("drilling down")),this.splitTile(h.source,o,l,u,t,e,r),n>1&&console.timeEnd("drilling down"),!this.tiles[s])?null:nu(this.tiles[s],i)}splitTile(t,e,r,i,n,a,s){let o=[t,e,r,i],l=this.options,u=l.debug;for(;o.length;){i=o.pop(),r=o.pop(),e=o.pop(),t=o.pop();let h=1<<e,c=Li(e,r,i),p=this.tiles[c];if(!p&&(u>1&&console.time("creation"),p=this.tiles[c]=iu(t,e,r,i,l),this.tileCoords.push({z:e,x:r,y:i,id:c}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,r,i,p.numFeatures,p.numPoints,p.numSimplified),console.timeEnd("creation"));let S=`z${e}`;this.stats[S]=(this.stats[S]||0)+1,this.total++}if(p.source=t,n==null){if(e===l.indexMaxZoom||p.numPoints<=l.indexMaxPoints)continue}else{if(e===l.maxZoom||e===n)continue;if(n!=null){let S=n-e;if(r!==a>>S||i!==s>>S)continue}}if(p.source=null,!t.length)continue;u>1&&console.time("clipping");let f=.5*l.buffer/l.extent,d=.5-f,y=.5+f,m=1+f,g=null,x=null,b=null,v=null,w=re(t,h,r-f,r+y,0,p.minX,p.maxX,l),A=re(t,h,r+d,r+m,0,p.minX,p.maxX,l);w&&(g=re(w,h,i-f,i+y,1,p.minY,p.maxY,l),x=re(w,h,i+d,i+m,1,p.minY,p.maxY,l)),A&&(b=re(A,h,i-f,i+y,1,p.minY,p.maxY,l),v=re(A,h,i+d,i+m,1,p.minY,p.maxY,l)),u>1&&console.timeEnd("clipping"),o.push(g||[],e+1,r*2,i*2),o.push(x||[],e+1,r*2,i*2+1),o.push(b||[],e+1,r*2+1,i*2),o.push(v||[],e+1,r*2+1,i*2+1)}}invalidateTiles(t){if(!t.length)return;let e=this.options,{debug:r}=e,i=1/0,n=-1/0,a=1/0,s=-1/0;for(let u of t)i=Math.min(i,u.minX),n=Math.max(n,u.maxX),a=Math.min(a,u.minY),s=Math.max(s,u.maxY);let o=e.buffer/e.extent,l=new Set;for(let u in this.tiles){let h=this.tiles[u],c=1<<h.z,p=(h.x-o)/c,f=(h.x+1+o)/c,d=(h.y-o)/c,y=(h.y+1+o)/c;if(n<p||i>=f||s<d||a>=y)continue;let m=!1;for(let g of t)if(g.maxX>=p&&g.minX<f&&g.maxY>=d&&g.minY<y){m=!0;break}if(m){if(r){r>1&&console.log("invalidate tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",h.z,h.x,h.y,h.numFeatures,h.numPoints,h.numSimplified);let g=`z${h.z}`;this.stats[g]=(this.stats[g]||0)-1,this.total--}delete this.tiles[u],l.add(u)}}l.size&&(this.tileCoords=this.tileCoords.filter(u=>!l.has(u.id)))}};function Li(t,e,r){return((1<<t)*r+e)*32+t}var Ag={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,updateable:!1,cluster:!1,clusterOptions:gs,debug:0},wp=class{constructor(t,e){e=this.options=Object.assign({},Ag,e);let r=e.debug;if(r&&console.time("preprocess data"),e.maxZoom<0||e.maxZoom>24)throw Error("maxZoom should be in the 0-24 range");if(e.promoteId&&e.generateId)throw Error("promoteId and generateId cannot be used together.");let i=fo(t,e);r&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",e.indexMaxZoom,e.indexMaxPoints),console.time("generate tiles")),i=xo(i,e),e.updateable&&(this.source=i),this.initializeIndex(i,e)}initializeIndex(t,e){this.tileIndex=e.cluster?new pg(e.clusterOptions):new Sg(e),t.length&&this.tileIndex.initialize(t)}getTile(t,e,r){return t=+t,e=+e,r=+r,t<0||t>24?null:this.tileIndex.getTile(t,e,r)}updateData(t,e){let r=this.options;if(!r.updateable)throw Error("to update tile geojson `updateable` option must be set to true");let{affected:i,source:n}=lg(this.source,t,r);e&&({affected:i,source:n}=this.filterUpdate(n,i,e)),i.length&&(this.source=n,this.tileIndex.updateIndex(n,i,r))}filterUpdate(t,e,r){let i=new Set;for(let n of t)n.id!=null&&(r(pn(n))||(e.push(n),i.add(n.id)));return t=t.filter(n=>!i.has(n.id)),{affected:e,source:t}}getData(){if(!this.options.updateable)throw Error("to retrieve data the `updateable` option must be set to true");return K1(this.source)}updateClusterOptions(t,e){let r=this.options.cluster;if(this.options.cluster=t,this.options.clusterOptions=e,r==t){this.tileIndex.updateIndex(this.source,[],this.options);return}this.initializeIndex(this.source,this.options)}getClusterExpansionZoom(t){return this.tileIndex.getClusterExpansionZoom(t)}getClusterChildren(t){return this.tileIndex.getChildren(t)}getClusterLeaves(t,e,r){return this.tileIndex.getLeaves(t,e,r)}},xs=ut([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),Dg=xs.members;xs.size,xs.alignment;var vs=ut([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),Eg=vs.members;vs.size,vs.alignment;var Tg=Math.cos(75/2*(Math.PI/180)),_p=1/2,au=2**14/_p,$n=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.patternFeatures=[],this.lineClipsArray=[],this.gradients={};for(let e of this.layers)this.gradients[e.id]={};this.layoutVertexArray=new Nm,this.layoutVertexArray2=new Um,this.indexArray=new xi,this.programConfigurations=new Le(t.layers,t.zoom),this.segments=new Ct,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(t,e,r){this.hasDependencies=ln("line",this.layers,e)||this.hasLineDasharray(this.layers);let i=this.layers[0].layout.get("line-sort-key"),n=!i.isConstant(),a=[],s=new H(this.zoom),o=this.layers[0]._featureFilter.needGeometry;for(let{feature:l,id:u,index:h,sourceLayerIndex:c}of t){let p=br(l,o);if(!this.layers[0]._featureFilter.filter(s,p,r))continue;let f=n?i.evaluate(p,{},r):void 0,d={id:u,properties:l.properties,type:l.type,sourceLayerIndex:c,index:h,geometry:o?p.geometry:$e(l),patterns:{},dashes:{},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;this.hasDependencies?(ln("line",this.layers,e)?uo("line",this.layers,l,{zoom:this.zoom},e):this.hasLineDasharray(this.layers)&&this.addLineDashDependencies(this.layers,l,this.zoom,e),this.patternFeatures.push(l)):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,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,{imagePositions:r,dashPositions:i})}addFeatures(t,e,r,i){for(let n of this.patternFeatures)this.addFeature(n,n.geometry,n.index,e,r,i,t.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,Eg)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Dg),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())}lineFeatureClips(t){if(t.properties&&Object.hasOwn(t.properties,"geojsonvt_clip_start")&&Object.hasOwn(t.properties,"geojsonvt_clip_end"))return{start:+t.properties[xp],end:+t.properties[vp]}}addFeature(t,e,r,i,n,a,s){let o=this.layers[0].layout,l=o.get("line-join").evaluate(t,{}),u=o.get("line-cap").evaluate(t,{}),h=o.get("line-miter-limit").evaluate(t,{}),c=o.get("line-round-limit").evaluate(t,{});this.lineClips=this.lineFeatureClips(t);for(let p of e)this.addLine(p,t,l,u,h,c,i,s);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{imagePositions:n,dashPositions:a,canonical:i})}addLine(t,e,r,i,n,a,s,o){this.distance=0,this.scaledDistance=0,this.totalDistance=0;let l=s?o.line.getGranularityForZoomLevel(s.z):1;if(t=Fe(t,l),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let b=0;b<t.length-1;b++)this.totalDistance+=t[b].dist(t[b+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let u=vi.types[e.type]==="Polygon",h=t.length;for(;h>=2&&t[h-1].equals(t[h-2]);)h--;let c=0;for(;c<h-1&&t[c].equals(t[c+1]);)c++;if(h-c<(u?3:2))return;r==="bevel"&&(n=1.05);let p=this.overscaling<=16?15*it/(512*this.overscaling):0,f=this.segments.prepareSegment(h*10,this.layoutVertexArray,this.indexArray),d,y,m,g,x;this.e1=this.e2=-1,u&&(d=t[h-2],x=t[c].sub(d)._unit()._perp());for(let b=c;b<h;b++){if(m=b===h-1?u?t[c+1]:void 0:t[b+1],m&&t[b].equals(m))continue;x&&(g=x),d&&(y=d),d=t[b],x=m?m.sub(d)._unit()._perp():g,g||=x;let v=g.add(x);(v.x!==0||v.y!==0)&&v._unit();let w=g.x*x.x+g.y*x.y,A=v.x*x.x+v.y*x.y,S=A===0?1/0:1/A,D=2*Math.sqrt(2-2*A),E=A<Tg&&y&&m,L=g.x*x.y-g.y*x.x>0;if(E&&b>c){let z=d.dist(y);if(z>2*p){let F=d.sub(d.sub(y)._mult(p/z)._round());this.updateDistance(y,F),this.addCurrentVertex(F,g,0,0,f),y=F}}let $=y&&m,P=$?r:u?"butt":i;if($&&P==="round"&&(S<a?P="miter":S<=2&&(P="fakeround")),P==="miter"&&S>n&&(P="bevel"),P==="bevel"&&(S>2&&(P="flipbevel"),S<n&&(P="miter")),y&&this.updateDistance(y,d),P==="miter")v._mult(S),this.addCurrentVertex(d,v,0,0,f);else if(P==="flipbevel"){if(S>100)v=x.mult(-1);else{let z=S*g.add(x).mag()/g.sub(x).mag();v._perp()._mult(z*(L?-1:1))}this.addCurrentVertex(d,v,0,0,f),this.addCurrentVertex(d,v.mult(-1),0,0,f)}else if(P==="bevel"||P==="fakeround"){let z=-Math.sqrt(S*S-1),F=L?z:0,V=L?0:z;if(y&&this.addCurrentVertex(d,g,F,V,f),P==="fakeround"){let R=Math.round(D*180/Math.PI/20);for(let B=1;B<R;B++){let G=B/R;if(G!==.5){let ft=G-.5,tt=1.0904+w*(-3.2452+w*(3.55645-w*1.43519)),ct=.848013+w*(-1.06021+w*.215638);G+=G*ft*(G-1)*(tt*ft*ft+ct)}let W=x.sub(g)._mult(G)._add(g)._unit()._mult(L?-1:1);this.addHalfVertex(d,W.x,W.y,!1,L,0,f)}}m&&this.addCurrentVertex(d,x,-F,-V,f)}else if(P==="butt")this.addCurrentVertex(d,v,0,0,f);else if(P==="square"){let z=y?1:-1;this.addCurrentVertex(d,v,z,z,f)}else P==="round"&&(y&&(this.addCurrentVertex(d,g,0,0,f),this.addCurrentVertex(d,g,1,1,f,!0)),m&&(this.addCurrentVertex(d,x,-1,-1,f,!0),this.addCurrentVertex(d,x,0,0,f)));if(E&&b<h-1){let z=d.dist(m);if(z>2*p){let F=d.add(m.sub(d)._mult(p/z)._round());this.updateDistance(d,F),this.addCurrentVertex(F,x,0,0,f),d=F}}}}addCurrentVertex(t,e,r,i,n,a=!1){let s=e.x+e.y*r,o=e.y-e.x*r,l=-e.x+e.y*i,u=-e.y-e.x*i;this.addHalfVertex(t,s,o,a,!1,r,n),this.addHalfVertex(t,l,u,a,!0,-i,n),this.distance>au/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,e,r,i,n,a))}addHalfVertex({x:t,y:e},r,i,n,a,s,o){let l=(this.lineClips?this.scaledDistance*(au-1):this.scaledDistance)*_p;if(this.layoutVertexArray.emplaceBack((t<<1)+ +!!n,(e<<1)+ +!!a,Math.round(63*r)+128,Math.round(63*i)+128,(s===0?0:s<0?-1:1)+1|(l&63)<<2,l>>6),this.lineClips){let h=(this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start);this.layoutVertexArray2.emplaceBack(h,this.lineClipsArray.length)}let u=o.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,u,this.e2),o.primitiveLength++),a?this.e2=u:this.e1=u}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,e){this.distance+=t.dist(e),this.updateScaledDistance()}hasLineDasharray(t){for(let e of t){let r=e.paint.get("line-dasharray");if(r&&!r.isConstant())return!0}return!1}addLineDashDependencies(t,e,r,i){for(let n of t){let a=n.paint.get("line-dasharray");if(!a||a.value.kind==="constant")continue;let s=n.layout.get("line-cap").evaluate(e,{})==="round",o={dasharray:a.value.evaluate({zoom:r-1},e,{}),round:s},l={dasharray:a.value.evaluate({zoom:r},e,{}),round:s},u={dasharray:a.value.evaluate({zoom:r+1},e,{}),round:s},h=`${o.dasharray.join(",")},${o.round}`,c=`${l.dasharray.join(",")},${l.round}`,p=`${u.dasharray.join(",")},${u.round}`;i.dashDependencies[h]=o,i.dashDependencies[c]=l,i.dashDependencies[p]=u,e.dashes[n.id]={min:h,mid:c,max:p}}}};I("LineBucket",$n,{omit:["layers","patternFeatures"]});var Fg,kg=()=>Fg||=new Ft({"line-cap":new O(_.layout_line["line-cap"],"line-cap"),"line-join":new O(_.layout_line["line-join"],"line-join"),"line-miter-limit":new O(_.layout_line["line-miter-limit"],"line-miter-limit"),"line-round-limit":new O(_.layout_line["line-round-limit"],"line-round-limit"),"line-sort-key":new O(_.layout_line["line-sort-key"],"line-sort-key")}),Ig,Mg=()=>Ig||=new Ft({"line-opacity":new O(_.paint_line["line-opacity"],"line-opacity"),"line-layer-opacity":new C(_.paint_line["line-layer-opacity"],"line-layer-opacity"),"line-color":new O(_.paint_line["line-color"],"line-color"),"line-translate":new C(_.paint_line["line-translate"],"line-translate"),"line-translate-anchor":new C(_.paint_line["line-translate-anchor"],"line-translate-anchor"),"line-width":new O(_.paint_line["line-width"],"line-width"),"line-gap-width":new O(_.paint_line["line-gap-width"],"line-gap-width"),"line-offset":new O(_.paint_line["line-offset"],"line-offset"),"line-blur":new O(_.paint_line["line-blur"],"line-blur"),"line-dasharray":new ni(_.paint_line["line-dasharray"],"line-dasharray"),"line-pattern":new ni(_.paint_line["line-pattern"],"line-pattern"),"line-gradient":new Bn(_.paint_line["line-gradient"],"line-gradient")}),su={get paint(){return Mg()},get layout(){return kg()}},Cg=class extends O{possiblyEvaluate(t,e){return e=new H(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,zoomHistory:e.zoomHistory,transition:e.transition}),super.possiblyEvaluate(t,e)}evaluate(t,e,r,i){return e=Tt({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(t,e,r,i)}},Vi;var Bg=class extends jt{constructor(t,e){super(t,su,e),this.gradientVersion=0,Vi||(Vi=new Cg(su.paint.properties["line-width"].specification,"line-floorwidth"),Vi.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(t){if(t==="line-gradient"){let e=this.gradientExpression();this.stepInterpolant=Vy(e)?e._styleExpression.expression instanceof Ls:!1,this.gradientVersion=(this.gradientVersion+1)%(2**53-1)}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(t,e){super.recalculate(t,e),this.paint._values["line-floorwidth"]=Vi.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new $n(t)}queryRadius(t){let e=t,r=ou(nr("line-width",this,e),nr("line-gap-width",this,e)),i=nr("line-offset",this,e);return r/2+Math.abs(i)+zn(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:r,geometry:i,transform:n,pixelsToTileUnits:a}){let s=Ln(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-n.bearingInRadians,a),o=a/2*ou(this.paint.get("line-width").evaluate(e,r),this.paint.get("line-gap-width").evaluate(e,r)),l=this.paint.get("line-offset").evaluate(e,r);return l&&(i=h0(i,l*a)),n0(s,i,o)}isTileClipped(){return!0}};function ou(t,e){return e>0?e+2*t:t}var Pg=ut([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"},{name:"a_height_offset",components:1,type:"Float32"}],4),zg=ut([{name:"a_projected_pos",components:3,type:"Float32"}],4);ut([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);var Lg=ut([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);ut([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);var lu=ut([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),bw=ut([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);ut([{name:"triangle",components:3,type:"Uint16"}]),ut([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"},{type:"Float32",name:"heightOffset"}]),ut([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"},{type:"Float32",name:"heightOffset"}]),ut([{type:"Float32",name:"offsetX"}]),ut([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),ut([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);function Vg(t,e,r){let i=e.layout.get("text-transform").evaluate(r,{});return i==="uppercase"?t=t.toLocaleUpperCase():i==="lowercase"&&(t=t.toLocaleLowerCase()),Jt.applyArabicShaping&&(t=Jt.applyArabicShaping(t)),t}function Og(t,e,r){for(let i of t.sections)i.text=Vg(i.text,e,r);return t}function Rg(t){let e={},r={},i=[],n=0;function a(u){i.push(t[u]),n++}function s(u,h,c){let p=r[u];return delete r[u],r[h]=p,i[p].geometry[0].pop(),i[p].geometry[0]=i[p].geometry[0].concat(c[0]),p}function o(u,h,c){let p=e[h];return delete e[h],e[u]=p,i[p].geometry[0].shift(),i[p].geometry[0]=c[0].concat(i[p].geometry[0]),p}function l(u,h,c){let p=c?h[0][h[0].length-1]:h[0][0];return`${u}:${p.x}:${p.y}`}for(let u=0;u<t.length;u++){let h=t[u],c=h.geometry,p=h.text?h.text.toString():null;if(!p){a(u);continue}let f=l(p,c),d=l(p,c,!0);if(f in r&&d in e&&r[f]!==e[d]){let y=o(f,d,c),m=s(f,d,i[y].geometry);delete e[f],delete r[d],r[l(p,i[m].geometry,!0)]=m,i[y].geometry=null}else f in r?s(f,d,c):d in e?o(f,d,c):(a(u),e[f]=n-1,r[d]=n-1)}return i.filter(u=>u.geometry)}var Sp=typeof Intl<"u"&&"Segmenter"in Intl,uu=Sp?new Intl.Segmenter(void 0,{granularity:"grapheme"}):null,hu=Sp?new Intl.Segmenter(void 0,{granularity:"word"}):null;function cu(t){if(!uu||!xm(t))return[...t];let e=[];for(let{segment:r}of uu.segment(t)){let i=e.length-1;i>=0&&vm(e[i],r)?e[i]+=r:e.push(r)}return e}function $g(t){let e=new Set;if(hu){for(let{index:i}of hu.segment(t))e.add(i);return e}let r=0;for(let i of t.split(/\\b|(?=\\p{Ideo})/u))e.add(r),r+=i.length;return e}function Ap(t){let e=t.codePointAt(0);return t.length>(e>65535?2:1)}var er={"!":"\\uFE15","#":"\\uFF03",$:"\\uFF04","%":"\\uFF05","&":"\\uFF06","(":"\\uFE35",")":"\\uFE36","*":"\\uFF0A","+":"\\uFF0B",",":"\\uFE10","-":"\\uFE32",".":"\\u30FB","/":"\\uFF0F",":":"\\uFE13",";":"\\uFE14","<":"\\uFE3F","=":"\\uFF1D",">":"\\uFE40","?":"\\uFE16","@":"\\uFF20","[":"\\uFE47","\\\\":"\\uFF3C","]":"\\uFE48","^":"\\uFF3E",_:"\\uFE33","`":"\\uFF40","{":"\\uFE37","|":"\\u2015","}":"\\uFE38","~":"\\uFF5E","\\xA2":"\\uFFE0","\\xA3":"\\uFFE1","\\xA5":"\\uFFE5","\\xA6":"\\uFFE4","\\xAC":"\\uFFE2","\\xAF":"\\uFFE3","\\u2013":"\\uFE32","\\u2014":"\\uFE31","\\u2018":"\\uFE43","\\u2019":"\\uFE44","\\u201C":"\\uFE41","\\u201D":"\\uFE42","\\u2026":"\\uFE19","\\u22EF":"\\uFE19","\\u2027":"\\u30FB","\\u20A9":"\\uFFE6","\\u3001":"\\uFE11","\\u3002":"\\uFE12","\\u3008":"\\uFE3F","\\u3009":"\\uFE40","\\u300A":"\\uFE3D","\\u300B":"\\uFE3E","\\u300C":"\\uFE41","\\u300D":"\\uFE42","\\u300E":"\\uFE43","\\u300F":"\\uFE44","\\u3010":"\\uFE3B","\\u3011":"\\uFE3C","\\u3014":"\\uFE39","\\u3015":"\\uFE3A","\\u3016":"\\uFE17","\\u3017":"\\uFE18","\\uFF01":"\\uFE15","\\uFF08":"\\uFE35","\\uFF09":"\\uFE36","\\uFF0C":"\\uFE10","\\uFF0D":"\\uFE32","\\uFF0E":"\\u30FB","\\uFF1A":"\\uFE13","\\uFF1B":"\\uFE14","\\uFF1C":"\\uFE3F","\\uFF1E":"\\uFE40","\\uFF1F":"\\uFE16","\\uFF3B":"\\uFE47","\\uFF3D":"\\uFE48","\\uFF3F":"\\uFE33","\\uFF5B":"\\uFE37","\\uFF5C":"\\u2015","\\uFF5D":"\\uFE38","\\uFF5F":"\\uFE35","\\uFF60":"\\uFE36","\\uFF61":"\\uFE12","\\uFF62":"\\uFE41","\\uFF63":"\\uFE42"};function Ng(t){let e="",r={premature:!0,value:void 0},i=t[Symbol.iterator](),n=i.next(),a=t[Symbol.iterator]();a.next();let s=a.next();for(;!n.done;)(s.done||!Tl(s.value.codePointAt(0))||er[s.value])&&(r.premature||!Tl(r.value.codePointAt(0))||er[r.value])&&er[n.value]?e+=er[n.value]:e+=n.value,r={value:n.value,premature:!1},n=i.next(),s=a.next();return e}var Ug={10:!0,13:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},qg={40:!0};function pu(t,e,r,i,n,a){if("fontStack"in e){let s=r[e.fontStack],o=s?.[t];if(o)return o.metrics.advance*e.scale+n;let l=0;for(let u of t){let h=s?.[u];h&&(l+=h.metrics.advance*e.scale+n)}return l}{let s=i[e.imageName];return s?s.displaySize[0]*e.scale*24/a+n:0}}function fu(t,e,r,i){let n=(t-e)**2;return i?t<e?n/2:n*2:n+Math.abs(r)*r}function du(t){return/^\\s+$/u.test(t)}function Gg(t,e,r){let i=0;return(t===10||t===13)&&(i-=1e4),r&&(i+=150),(t===40||t===65288)&&(i+=50),(e===41||e===65289)&&(i+=50),i}function yu(t,e,r,i,n,a){let s=null,o=fu(e,r,n,a);for(let l of i){let u=fu(e-l.x,r,n,a)+l.badness;u<=o&&(s=l,o=u)}return{index:t,x:e,priorBreak:s,badness:o}}function Dp(t){return t?Dp(t.priorBreak).concat(t.index):[]}var wo=class bs{constructor(e="",r=[],i=[]){this.text=e,this.sections=r,this.sectionIndex=i,this.imageSectionID=null,this._graphemes=null}graphemes(){return this._graphemes??=cu(this.text),this._graphemes}static fromFeature(e,r){let i=new bs;for(let n of e.sections)n.image?i.addImageSection(n):i.addTextSection(n,r);return i}length(){return this.graphemes().length}getSection(e){return this.sections[this.sectionIndex[e]]}getSectionIndex(e){return this.sectionIndex[e]}verticalizePunctuation(){this.text=Ng(this.text),this._graphemes=null}hasZeroWidthSpaces(){return this.text.includes("\\u200B")}trim(){let e=this.graphemes(),r=0;for(;r<e.length&&du(e[r]);)r++;let i=e.length;for(;i>r&&du(e[i-1]);)i--;this.text=e.slice(r,i).join(""),this.sectionIndex=this.sectionIndex.slice(r,i),this._graphemes=null}substring(e,r){let i=this.graphemes().slice(e,r).join(""),n=this.sectionIndex.slice(e,r);return new bs(i,this.sections,n)}toCodeUnitIndex(e){return this.graphemes().slice(0,e).join("").length}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,r)=>Math.max(e,this.sections[r].scale),0)}getMaxImageSize(e){let r=0,i=0;for(let n=0;n<this.length();n++){let a=this.getSection(n);if("imageName"in a){let s=e[a.imageName];if(!s)continue;let o=s.displaySize;r=Math.max(r,o[0]),i=Math.max(i,o[1])}}return{maxImageWidth:r,maxImageHeight:i}}_appendSection(e,r){let i=this.graphemes(),n=i.length>0?i[i.length-1]:"",a=cu(n+e);this.text+=e,this._graphemes=i.slice(0,n?-1:void 0).concat(a);let s=a.length-+!!n;for(let o=0;o<s;o++)this.sectionIndex.push(r)}addTextSection(e,r){this.sections.push({scale:e.scale||1,verticalAlign:e.verticalAlign||"bottom",fontStack:e.fontStack||r}),this._appendSection(e.text,this.sections.length-1)}addImageSection(e){let r=e.image?e.image.name:"";if(r.length===0){gt("Can\'t add FormattedSection with an empty image.");return}let i=this.getNextImageSectionCharCode();if(!i){gt("Reached maximum number of images 6401");return}this.sections.push({scale:1,verticalAlign:e.verticalAlign||"bottom",imageName:r}),this._appendSection(String.fromCharCode(i),this.sections.length-1)}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}determineLineBreaks(e,r,i,n,a){let s=[],o=this.determineAverageLineWidth(e,r,i,n,a),l=this.hasZeroWidthSpaces(),u=this.graphemes(),h=null,c=0,p=0;for(let f=0;f<u.length;f++){let d=u[f];if(f>0){let y=u[f-1].codePointAt(0),m=d.codePointAt(0),g=ym(y),x=El(y)&&El(m);(Ug[y]||g||"imageName"in this.getSection(f-1)||u[f+1]!==void 0&&qg[m]||x&&(h??=$g(this.text)).has(p))&&s.push(yu(f,c,o,s,Gg(y,m,g&&l),!1))}Js(d.codePointAt(0))||(c+=pu(d,this.getSection(f),i,n,e,a)),p+=d.length}return Dp(yu(this.length(),c,o,s,0,!0))}determineAverageLineWidth(e,r,i,n,a){let s=0,o=0;for(let u of this.graphemes()){let h=this.getSection(o);s+=pu(u,h,i,n,e,a),o++}let l=Math.max(1,Math.ceil(s/r));return s/l}},ws=4294967296,mu=1/ws,gu=typeof TextDecoder>"u"?null:new TextDecoder("utf-8"),_o=class{constructor(t){this.buf=ArrayBuffer.isView(t)?t:new Uint8Array(t),this.dataView=new DataView(this.buf.buffer,this.buf.byteOffset,this.buf.byteLength),this.pos=0,this.type=0,this._valueStart=-1,this.length=this.buf.length}readFields(t,e,r=this.length){let i;for(;i=this.nextField(r);)t(i,e,this);return e}readMessage(t,e){return this.readFields(t,e,this.readVarint()+this.pos)}readFixed32(){let t=this.dataView.getUint32(this.pos,!0);return this.pos+=4,t}readSFixed32(){let t=this.dataView.getInt32(this.pos,!0);return this.pos+=4,t}readFixed64(){let t=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*ws;return this.pos+=8,t}readSFixed64(){let t=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*ws;return this.pos+=8,t}readFloat(){let t=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,t}readDouble(){let t=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,t}readVarint(t){let e=this.buf,r=e[this.pos++];if(r<128)return r;let i=r&127,n;return n=e[this.pos++],i|=(n&127)<<7,n<128||(n=e[this.pos++],i|=(n&127)<<14,n<128)||(n=e[this.pos++],i|=(n&127)<<21,n<128)?i:(n=e[this.pos],i|=(n&15)<<28,Yg(i,t,this))}readSVarint(){let t=this.readVarint();return t%2==1?(t+1)/-2:t/2}readBoolean(){return!!this.readVarint()}readString(){let t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&gu?gu.decode(this.buf.subarray(e,t)):sx(this.buf,e,t)}readBytes(){let t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e}readPackedVarint(t=[],e){let r=this.readPackedEnd();for(;this.pos<r;)t.push(this.readVarint(e));return t}readPackedSVarint(t=[]){let e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSVarint());return t}readPackedBoolean(t=[]){let e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readBoolean());return t}readPackedFloat(t=[]){let e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFloat());return t}readPackedDouble(t=[]){let e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readDouble());return t}readPackedFixed32(t=[]){let e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFixed32());return t}readPackedSFixed32(t=[]){let e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSFixed32());return t}readPackedFixed64(t=[]){let e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFixed64());return t}readPackedSFixed64(t=[]){let e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSFixed64());return t}readPackedEnd(){return this.type===2?this.readVarint()+this.pos:this.pos+1}nextField(t=this.length){if(this.pos===this._valueStart&&this.skip(this.type),this.pos>=t)return 0;let e=this.readVarint();return this.type=e&7,this._valueStart=this.pos,e>>>3}skip(t){let e=t&7;if(e===0)for(;this.buf[this.pos++]>127;);else if(e===2)this.pos=this.readVarint()+this.pos;else if(e===5)this.pos+=4;else if(e===1)this.pos+=8;else throw Error(`Unimplemented type: ${e}`)}},jg=class{constructor(t=new Uint8Array(16)){this.buf=ArrayBuffer.isView(t)?t:new Uint8Array(t),this.dataView=new DataView(this.buf.buffer,this.buf.byteOffset,this.buf.byteLength),this.pos=0,this.length=this.buf.length}writeTag(t,e){this.writeVarint(t<<3|e)}realloc(t){let e=this.length||16;for(;e<this.pos+t;)e*=2;if(e!==this.length){let r=new Uint8Array(e);r.set(this.buf),this.buf=r,this.dataView=new DataView(r.buffer),this.length=e}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(t){this.realloc(4),this.dataView.setInt32(this.pos,t,!0),this.pos+=4}writeSFixed32(t){this.realloc(4),this.dataView.setInt32(this.pos,t,!0),this.pos+=4}writeFixed64(t){this.realloc(8),this.dataView.setInt32(this.pos,t&-1,!0),this.dataView.setInt32(this.pos+4,Math.floor(t*mu),!0),this.pos+=8}writeSFixed64(t){this.realloc(8),this.dataView.setInt32(this.pos,t&-1,!0),this.dataView.setInt32(this.pos+4,Math.floor(t*mu),!0),this.pos+=8}writeVarint(t){if(t=+t||0,t>=0&&t<128){this.pos>=this.length&&this.realloc(1),this.buf[this.pos++]=t;return}if(t>268435455||t<0){Zg(t,this);return}this.realloc(4),this.buf[this.pos++]=t&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=(t>>>=7)&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=(t>>>=7)&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=t>>>7&127)))}writeSVarint(t){this.writeVarint(t<0?-t*2-1:t*2)}writeBoolean(t){this.writeVarint(+t)}writeString(t){t=String(t),this.realloc(t.length*4),this.pos++;let e=this.pos;this.pos=ox(this.buf,t,this.pos);let r=this.pos-e;r>=128&&xu(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r}writeFloat(t){this.realloc(4),this.dataView.setFloat32(this.pos,t,!0),this.pos+=4}writeDouble(t){this.realloc(8),this.dataView.setFloat64(this.pos,t,!0),this.pos+=8}writeBytes(t){let e=t.length;this.writeVarint(e),this.realloc(e),this.buf.set(t,this.pos),this.pos+=e}writeRawMessage(t,e){this.pos++;let r=this.pos;t(e,this);let i=this.pos-r;i>=128&&xu(r,i,this),this.pos=r-1,this.writeVarint(i),this.pos+=i}writeMessage(t,e,r){this.writeTag(t,2),this.writeRawMessage(e,r)}writePackedVarint(t,e){e.length&&this.writeMessage(t,Kg,e)}writePackedSVarint(t,e){e.length&&this.writeMessage(t,Jg,e)}writePackedBoolean(t,e){e.length&&this.writeMessage(t,ex,e)}writePackedFloat(t,e){e.length&&this.writeMessage(t,Qg,e)}writePackedDouble(t,e){e.length&&this.writeMessage(t,tx,e)}writePackedFixed32(t,e){e.length&&this.writeMessage(t,rx,e)}writePackedSFixed32(t,e){e.length&&this.writeMessage(t,ix,e)}writePackedFixed64(t,e){e.length&&this.writeMessage(t,nx,e)}writePackedSFixed64(t,e){e.length&&this.writeMessage(t,ax,e)}writeBytesField(t,e){this.writeTag(t,2),this.writeBytes(e)}writeFixed32Field(t,e){this.writeTag(t,5),this.writeFixed32(e)}writeSFixed32Field(t,e){this.writeTag(t,5),this.writeSFixed32(e)}writeFixed64Field(t,e){this.writeTag(t,1),this.writeFixed64(e)}writeSFixed64Field(t,e){this.writeTag(t,1),this.writeSFixed64(e)}writeVarintField(t,e){this.writeTag(t,0),this.writeVarint(e)}writeSVarintField(t,e){this.writeTag(t,0),this.writeSVarint(e)}writeStringField(t,e){this.writeTag(t,2),this.writeString(e)}writeFloatField(t,e){this.writeTag(t,5),this.writeFloat(e)}writeDoubleField(t,e){this.writeTag(t,1),this.writeDouble(e)}writeBooleanField(t,e){this.writeVarintField(t,+e)}};function Yg(t,e,r){let i=r.buf,n,a;if(a=i[r.pos++],n=(a&112)>>4,a<128||(a=i[r.pos++],n|=(a&127)<<3,a<128)||(a=i[r.pos++],n|=(a&127)<<10,a<128)||(a=i[r.pos++],n|=(a&127)<<17,a<128)||(a=i[r.pos++],n|=(a&127)<<24,a<128)||(a=i[r.pos++],n|=(a&1)<<31,a<128))return Xg(t,n,e);throw Error("Expected varint not more than 10 bytes")}function Xg(t,e,r){return r?e*4294967296+(t>>>0):(e>>>0)*4294967296+(t>>>0)}function Zg(t,e){let r,i;if(t>=0?(r=t%4294967296|0,i=t/4294967296|0):(r=~(-t%4294967296),i=~(-t/4294967296),r^4294967295?r=r+1|0:(r=0,i=i+1|0)),t>=18446744073709552e3||t<-18446744073709552e3)throw Error("Given varint doesn\'t fit into 10 bytes");e.realloc(10),Wg(r,i,e),Hg(i,e)}function Wg(t,e,r){r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos]=t&127}function Hg(t,e){let r=(t&7)<<4;e.buf[e.pos++]|=r|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127)))))}function xu(t,e,r){let i=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(Math.LN2*7));r.realloc(i),r.buf.copyWithin(t+i,t,r.pos)}function Kg(t,e){let r=t.length,i=e.buf,n=e.pos,a=e.length;for(let s=0;s<r;s++){let o=t[s];if(o<0||n+10>a){e.pos=n,e.writeVarint(o),i=e.buf,n=e.pos,a=e.length;continue}for(;o>127;)i[n++]=o%128|128,o=Math.floor(o/128);i[n++]=o}e.pos=n}function Jg(t,e){for(let r=0;r<t.length;r++)e.writeSVarint(t[r])}function Qg(t,e){for(let r=0;r<t.length;r++)e.writeFloat(t[r])}function tx(t,e){for(let r=0;r<t.length;r++)e.writeDouble(t[r])}function ex(t,e){for(let r=0;r<t.length;r++)e.writeBoolean(t[r])}function rx(t,e){for(let r=0;r<t.length;r++)e.writeFixed32(t[r])}function ix(t,e){for(let r=0;r<t.length;r++)e.writeSFixed32(t[r])}function nx(t,e){for(let r=0;r<t.length;r++)e.writeFixed64(t[r])}function ax(t,e){for(let r=0;r<t.length;r++)e.writeSFixed64(t[r])}function sx(t,e,r){let i="",n=e;for(;n<r;){let a=t[n],s=null,o=a>239?4:a>223?3:a>191?2:1;if(n+o>r)break;let l,u,h;o===1?a<128&&(s=a):o===2?(l=t[n+1],(l&192)==128&&(s=(a&31)<<6|l&63,s<=127&&(s=null))):o===3?(l=t[n+1],u=t[n+2],(l&192)==128&&(u&192)==128&&(s=(a&15)<<12|(l&63)<<6|u&63,(s<=2047||s>=55296&&s<=57343)&&(s=null))):o===4&&(l=t[n+1],u=t[n+2],h=t[n+3],(l&192)==128&&(u&192)==128&&(h&192)==128&&(s=(a&15)<<18|(l&63)<<12|(u&63)<<6|h&63,(s<=65535||s>=1114112)&&(s=null))),s===null?(s=65533,o=1):s>65535&&(s-=65536,i+=String.fromCharCode(s>>>10&1023|55296),s=56320|s&1023),i+=String.fromCharCode(s),n+=o}return i}function ox(t,e,r){for(let i=0,n,a;i<e.length;i++){if(n=e.charCodeAt(i),n>55295&&n<57344)if(a){if(n<56320){t[r++]=239,t[r++]=191,t[r++]=189,a=n;continue}n=a-55296<<10|n-56320|65536,a=null}else{n>56319||i+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):a=n;continue}else a&&=(t[r++]=239,t[r++]=191,t[r++]=189,null);n<128?t[r++]=n:(n<2048?t[r++]=n>>6|192:(n<65536?t[r++]=n>>12|224:(t[r++]=n>>18|240,t[r++]=n>>12&63|128),t[r++]=n>>6&63|128),t[r++]=n&63|128)}return r}function lx(t){return typeof t?.renderWithWebGL=="function"}function So(t){let e=0,r=0;for(let s of t)e+=s.w*s.h,r=Math.max(r,s.w);t.sort((s,o)=>o.h-s.h);let i=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}],n=0,a=0;for(let s of t)for(let o=i.length-1;o>=0;o--){let l=i[o];if(!(s.w>l.w||s.h>l.h)){if(s.x=l.x,s.y=l.y,a=Math.max(a,s.y+s.h),n=Math.max(n,s.x+s.w),s.w===l.w&&s.h===l.h){let u=i.pop();u&&o<i.length&&(i[o]=u)}else s.h===l.h?(l.x+=s.w,l.w-=s.w):s.w===l.w?(l.y+=s.h,l.h-=s.h):(i.push({x:l.x+s.w,y:l.y,w:l.w-s.w,h:s.h}),l.y+=s.h,l.h-=s.h);break}}return{w:n,h:a,fill:e/(n*a)||0}}var Ep=class{constructor(t,{pixelRatio:e,version:r,isWebGLImage:i=!1,stretchX:n,stretchY:a,content:s,textFitWidth:o,textFitHeight:l}){this.paddedRect=t,this.pixelRatio=e,this.stretchX=n,this.stretchY=a,this.content=s,this.version=r,this.needsFirstWebGLRender=i,this.textFitWidth=o,this.textFitHeight=l}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}},Ao=class{constructor(t,e){let r={},i={};this.haveRenderCallbacks=[],this.patchedUpdateVersion=-1;let n=[];this.addImages(t,r,n),this.addImages(e,i,n);let{w:a,h:s}=So(n),o=new kt({width:a||1,height:s||1});for(let l in t){let u=t[l];if(u.isWebGLImage)continue;let h=r[l].paddedRect;kt.copy(u.data,o,{x:0,y:0},{x:h.x+1,y:h.y+1},u.data)}for(let l in e){let u=e[l],h=i[l].paddedRect,c=h.x+1,p=h.y+1,f=u.data.width,d=u.data.height;kt.copy(u.data,o,{x:0,y:0},{x:c,y:p},u.data),kt.copy(u.data,o,{x:0,y:d-1},{x:c,y:p-1},{width:f,height:1}),kt.copy(u.data,o,{x:0,y:0},{x:c,y:p+d},{width:f,height:1}),kt.copy(u.data,o,{x:f-1,y:0},{x:c-1,y:p},{width:1,height:d}),kt.copy(u.data,o,{x:0,y:0},{x:c+f,y:p},{width:1,height:d})}this.image=o,this.iconPositions=r,this.patternPositions=i}addImages(t,e,r){for(let i in t){let n=t[i],a={x:0,y:0,w:n.data.width+2,h:n.data.height+2};r.push(a),e[i]=new Ep(a,n),n.hasRenderCallback&&this.haveRenderCallbacks.push(i)}}patchUpdatedImages(t,e){if(t.dispatchRenderCallbacks(this.haveRenderCallbacks),this.patchedUpdateVersion!==t.updateVersion){this.patchedUpdateVersion=t.updateVersion;for(let r in this.iconPositions)this.patchUpdatedImage(this.iconPositions[r],t.getImage(r),e);for(let r in this.patternPositions)this.patchUpdatedImage(this.patternPositions[r],t.getImage(r),e)}}patchUpdatedImage(t,e,r){if(!t||!e||!t.needsFirstWebGLRender&&t.version===e.version)return;t.needsFirstWebGLRender=!1,t.version=e.version;let[i,n]=t.tl,a=e.userImage?.data;if(!lx(a)){r.update(e.data,void 0,{x:i,y:n});return}let{width:s,height:o}=e.data;r.context.setCustomLayerDefaults(),a.renderWithWebGL({gl:r.context.gl,texture:r.texture,x:i,y:n,width:s,height:o}),r.context.setDirty()}};I("ImagePosition",Ep),I("ImageAtlas",Ao);var Tp=(function(t){return t[t.none=0]="none",t[t.horizontal=1]="horizontal",t[t.vertical=2]="vertical",t[t.horizontalOnly=3]="horizontalOnly",t})(Tp||{});function ux(t){for(let e of t)if(e.positionedGlyphs.length!==0)return!1;return!0}function hx(t,e){let r=[],i=0;for(let n of e)r.push(t.substring(i,n)),i=n;return i<t.length()&&r.push(t.substring(i,t.length())),r}var vu=/^\\p{gc=M}$/u;function cx(t){let e=[],r=0;for(;r<t.length;){if(!vu.test(t[r])){e.push(r),r++;continue}let i=r;for(;i<t.length&&vu.test(t[i]);)i++;let n=t[i];if(n!==void 0&&Qs(n.codePointAt(0))){e.push(i);for(let a=i-1;a>=r;a--)e.push(a);r=i+1}else{for(let a=r;a<i;a++)e.push(a);r=i}}return e}function px(t){let e=[],r=0;for(let i of t.graphemes())e.push(...Array(i.length).fill(t.sectionIndex[r])),r++;return e}function bu(t,e,r){let i=[...t],n=[],a=0;for(let h of i)n.push(a),a+=h.length;let s=cx(i),o=new wo(s.map(h=>i[h]).join(""),e,[]),l=s.map(h=>r[n[h]]??0),u=0;for(let h of o.graphemes())o.sectionIndex.push(l[u]??0),u+=[...h].length;return o}function Oi(t,e,r,i,n,a,s,o,l,u,h,c,p,f,d){let y=wo.fromFeature(t,n);c===2&&y.verticalizePunctuation();let m,g=y.determineLineBreaks(u,a,e,i,f),{processBidirectionalText:x,processStyledBidirectionalText:b}=Jt;if(x&&y.sections.length===1){m=[],g=g.map(S=>y.toCodeUnitIndex(S));let A=x(y.toString(),g);for(let S of A)m.push(bu(S,y.sections,[...S].map(()=>0)))}else if(b){m=[],g=g.map(D=>y.toCodeUnitIndex(D));let A=px(y),S=b(y.text,A,g);for(let D of S)m.push(bu(D[0],y.sections,D[1]))}else m=hx(y,g);let v=[],w={positionedLines:v,text:y.toString(),top:h[1],bottom:h[1],left:h[0],right:h[0],writingMode:c,iconsInText:!1,verticalizable:!1};return wx(w,e,r,i,m,s,o,l,c,u,p,d),!ux(v)&&w}function Fp(t){let e=.5,r=.5;switch(t){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(t){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:e,verticalAlign:r}}function fx(t,e,r){let i=e.getMaxScale()*24,{maxImageWidth:n,maxImageHeight:a}=e.getMaxImageSize(t),s=Math.max(i,a*r);return{verticalLineContentWidth:Math.max(i,n*r),horizontalLineContentHeight:s}}function kp(t){switch(t){case"top":return 0;case"center":return .5;default:return 1}}function dx(t,e,r,i){if(t?.rect)return t;let n=e[r.fontStack]?.[i];return n?{rect:null,metrics:n.metrics}:null}function yx(t,e,r){return!(t===1||!e&&!In(r)||e&&(Js(r)||Tc(r)))}function Ki(t){return/\\p{Nd}/u.test(String.fromCodePoint(t))}function Ip(t){return/\\p{Lu}/u.test(String.fromCodePoint(t))}function mx(t){return/[\\p{P}\\p{S}]/u.test(String.fromCodePoint(t))}function gx(t){let e=t.some(Ki)&&t.every(i=>Ki(i)||mx(i)),r=t.length<=3&&t.every(i=>Ip(i)||Ki(i));return e||r}function xx(t){return(Ki(t)||Ip(t))&&!Tc(t)}function vx(t,e){let r=!1;for(let i=0;i<t.length;i++){if(e[i])continue;let n=er[t[i]];n&&(i===0||e[i-1])&&(i===t.length-1||e[i+1])&&(t[i]=n,e[i]=!0,r=!0)}return r}function bx(t){let e=t.graphemes().slice(),r=e.map(a=>a.codePointAt(0)),i=r.map(In),n=a=>!i[a]&&!Js(r[a])&&!("imageName"in t.getSection(a));for(let a=0;a<r.length;a++){if(!n(a))continue;let s=a;for(;s+1<r.length&&n(s+1);)s++;if(gx(r.slice(a,s+1)))for(let o=a;o<=s;o++)i[o]=xx(r[o]);a=s}return vx(e,i)&&(t.text=e.join(""),t._graphemes=null),i}function wx(t,e,r,i,n,a,s,o,l,u,h,c){let p=0,f=0,d=0,y=0,m=o==="right"?1:o==="left"?0:.5,g=24/c,x=0;for(let w of n){w.trim();let A=w.getMaxScale(),S={positionedGlyphs:[],lineOffset:0};t.positionedLines[x]=S;let D=S.positionedGlyphs,E=0;if(!w.length()){f+=a,++x;continue}let L=fx(i,w,g),$=l===2&&!h?bx(w):null,P=w.graphemes();for(let V=0;V<P.length;V++){let R=w.getSection(V),B=P[V],G=B.codePointAt(0),W=$?$[V]:yx(l,h,G),ft="fontStack"in R&&Ap(B)&&!e[R.fontStack]?.[B]?[...B]:[B];for(let tt of ft){let ct={glyph:tt.codePointAt(0),grapheme:tt,imageName:null,x:p,y:f+-17,vertical:W,scale:1,fontStack:"",sectionIndex:w.getSectionIndex(V),metrics:null,rect:null},$t;if("fontStack"in R){if($t=_x(R,tt,W,L,e,r),!$t)continue;ct.fontStack=R.fontStack}else{if(t.iconsInText=!0,R.scale*=g,$t=Sx(R,W,A,L,i),!$t)continue;E=Math.max(E,$t.imageOffset),ct.imageName=R.imageName}let{rect:Ge,metrics:be,baselineOffset:je}=$t;if(ct.y+=je,ct.scale=R.scale,ct.metrics=be,ct.rect=Ge,D.push(ct),!W)p+=be.advance*R.scale+u;else{t.verticalizable=!0;let Ye="imageName"in R?be.advance:24;p+=Ye*R.scale+u}}}if(D.length!==0){let V=p-u;d=Math.max(V,d),Ax(D,0,D.length-1,m)}p=0;let z=(A-1)*24;S.lineOffset=Math.max(E,z);let F=a*A+E;f+=F,y=Math.max(F,y),++x}let{horizontalAlign:b,verticalAlign:v}=Fp(s);Dx(t.positionedLines,m,b,v,d,y,a,f,n.length),t.top+=-v*f,t.bottom=t.top+f,t.left+=-b*d,t.right=t.left+d}function _x(t,e,r,i,n,a){let s=a[t.fontStack]?.[e],o=dx(s,n,t,e);if(o===null)return null;let l;if(r)l=i.verticalLineContentWidth-t.scale*24;else{let u=kp(t.verticalAlign);l=(i.horizontalLineContentHeight-t.scale*24)*u}return{rect:o.rect,metrics:o.metrics,baselineOffset:l}}function Sx(t,e,r,i,n){let a=n[t.imageName];if(!a)return null;let s=a.paddedRect,o=a.displaySize,l={width:o[0],height:o[1],left:1,top:-3,advance:e?o[1]:o[0]},u;if(e)u=i.verticalLineContentWidth-o[1]*t.scale;else{let c=kp(t.verticalAlign);u=(i.horizontalLineContentHeight-o[1]*t.scale)*c}let h=(e?o[0]:o[1])*t.scale-24*r;return{rect:s,metrics:l,baselineOffset:u,imageOffset:h}}function Ax(t,e,r,i){if(i===0)return;let n=t[r],a=n.metrics.advance*n.scale,s=(t[r].x+a)*i;for(let o=e;o<=r;o++)t[o].x-=s}function Dx(t,e,r,i,n,a,s,o,l){let u=(e-r)*n,h=0;h=a===s?-i*l*s+.5*s:-o*i- -17;for(let c of t)for(let p of c.positionedGlyphs)p.x+=u,p.y+=h}function Ex(t,e,r){let{horizontalAlign:i,verticalAlign:n}=Fp(r),a=e[0],s=e[1],o=a-t.displaySize[0]*i,l=o+t.displaySize[0],u=s-t.displaySize[1]*n;return{image:t,top:u,bottom:u+t.displaySize[1],left:o,right:l}}function Mp(t){let e=t.left,r=t.top,i=t.right-e,n=t.bottom-r,a=t.image.content[2]-t.image.content[0],s=t.image.content[3]-t.image.content[1],o=t.image.textFitWidth??"stretchOrShrink",l=t.image.textFitHeight??"stretchOrShrink",u=a/s;if(l==="proportional"){if(o==="stretchOnly"&&i/n<u||o==="proportional"){let h=Math.ceil(n*u);e*=h/i,i=h}}else if(o==="proportional"&&l==="stretchOnly"&&u!==0&&i/n>u){let h=Math.ceil(i/u);r*=h/n,n=h}return{x1:e,y1:r,x2:e+i,y2:r+n}}function wu(t,e,r,i,n,a){let s=t.image,o;if(s.content){let m=s.content,g=s.pixelRatio||1;o=[m[0]/g,m[1]/g,s.displaySize[0]-m[2]/g,s.displaySize[1]-m[3]/g]}let l=e.left*a,u=e.right*a,h,c,p,f;r==="width"||r==="both"?(f=n[0]+l-i[3],c=n[0]+u+i[1]):(f=n[0]+(l+u-s.displaySize[0])/2,c=f+s.displaySize[0]);let d=e.top*a,y=e.bottom*a;return r==="height"||r==="both"?(h=n[1]+d-i[0],p=n[1]+y+i[2]):(h=n[1]+(d+y-s.displaySize[1])/2,p=h+s.displaySize[1]),{image:s,top:h,right:c,bottom:p,left:f,collisionPadding:o}}var _u=32640;function Su(t,e){let{expression:r}=e;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new H(t+1))};if(r.kind==="source")return{kind:"source"};if(r.kind==="composite"){let{minZoom:i,maxZoom:n}=Tx(r.zoomStops,t);return{kind:"composite",minZoom:i,maxZoom:n,interpolationType:r.interpolationType}}{let i=Fx(r),n=r.evaluate(new H(t+1));return{kind:"camera",zoomStops:r.zoomStops,sizes:i,layoutSize:n,interpolationType:r.interpolationType}}}function Tx(t,e){let r=0;for(;r<t.length&&t[r]<=e;)r++;r=Math.max(0,r-1);let i=r;for(;i<t.length&&t[i]<e+1;)i++;return i=Math.min(t.length-1,i),{minZoom:t[r],maxZoom:t[i]}}function Fx(t){return t.zoomStops.map(e=>t.evaluate(new H(e===-1/0?t.zoomStops[1]-1:e)))}function Au(t,e,r){let i="never",n=t.get(e);return n?i=n:t.get(r)&&(i="always"),i}var kx=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Ri(t,e,r,i,n,a,s,o,l,u,h,c,p,f){let d=o?Math.min(_u,Math.round(o[0])):0,y=o?Math.min(_u,Math.round(o[1])):0;t.emplaceBack(e,r,Math.round(i*32),Math.round(n*32),a,s,(d<<1)+ +!!l,y,u*16,h*16,c*256,p*256,f)}function Cp(t,e,r){t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r)}function Ix(t){for(let e of t.sections)if(Dm(e.text))return!0;return!1}var _s=class{constructor(t){this.layoutVertexArray=new qm,this.indexArray=new xi,this.programConfigurations=t,this.segments=new Ct,this.dynamicLayoutVertexArray=new Gm,this.opacityVertexArray=new jm,this.hasVisibleVertices=!1,this.placedSymbolArray=new Cc}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(t,e,r,i){this.isEmpty()||(r&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Pg.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,e),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,zg.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,kx,!0),this.opacityVertexBuffer.itemSize=1),(r||i)&&this.programConfigurations.upload(t))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}};I("SymbolBuffers",_s);var Ss=class{constructor(t,e,r){this.layoutVertexArray=new t,this.layoutAttributes=e,this.indexArray=new r,this.segments=new Ct,this.collisionVertexArray=new Ym}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,Lg.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}};I("CollisionBuffers",Ss);var Ce=class{constructor(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(s=>s.id),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasDependencies=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];let e=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Su(this.zoom,e["text-size"]),this.iconSizeData=Su(this.zoom,e["icon-size"]);let r=this.layers[0].layout,i=r.get("symbol-sort-key"),n=r.get("symbol-z-order");this.canOverlap=Au(r,"text-overlap","text-allow-overlap")!=="never"||Au(r,"icon-overlap","icon-allow-overlap")!=="never"||r.get("text-ignore-placement")||r.get("icon-ignore-placement"),this.sortFeaturesByKey=n!=="viewport-y"&&!i.isConstant();let a=n==="viewport-y"||n==="auto"&&!this.sortFeaturesByKey;this.sortFeaturesByY=a&&this.canOverlap,r.get("symbol-placement")==="point"&&(this.writingModes=r.get("text-writing-mode").map(s=>Tp[s])),this.stateDependentLayerIds=this.layers.filter(s=>s.isStateDependent()).map(s=>s.id),this.sourceID=t.sourceID}createArrays(){this.text=new _s(new Le(this.layers,this.zoom,t=>t.startsWith("text"))),this.icon=new _s(new Le(this.layers,this.zoom,t=>t.startsWith("icon"))),this.glyphOffsetArray=new zc,this.lineVertexArray=new Lc,this.symbolInstances=new Pc,this.textAnchorOffsets=new Oc}calculateGlyphDependencies(t,e,r,i,n){let a=(i||this.allowVerticalPlacement)&&n,s=wo.fromFeature(t,r),o=s.graphemes();for(let l=0;l<o.length;l++){let u=s.getSection(l);if("imageName"in u)continue;let h=e[u.fontStack]||={},c=o[l];Ap(c)&&(h[c]=!0);for(let p of c){if(h[p]=!0,!a)continue;let f=er[p];f&&(h[f]=!0)}}}populate(t,e,r){let i=this.layers[0],n=i.layout,a=n.get("text-font"),s=n.get("text-field"),o=n.get("icon-image"),l=(s.value.kind!=="constant"||s.value.value instanceof oe&&!s.value.value.isEmpty()||s.value.value.toString().length>0)&&(a.value.kind!=="constant"||a.value.value.length>0),u=o.value.kind!=="constant"||!!o.value.value||Object.keys(o.parameters).length>0,h=n.get("symbol-sort-key");if(this.features=[],!l&&!u)return;let c=e.iconDependencies,p=e.glyphDependencies,f=e.availableImages,d=new H(this.zoom);for(let{feature:y,id:m,index:g,sourceLayerIndex:x}of t){let b=i._featureFilter.needGeometry,v=br(y,b);if(!i._featureFilter.filter(d,v,r))continue;b||(v.geometry=$e(y));let w;if(l){let E=i.getValueAndResolveTokens("text-field",v,r,f),L=oe.factory(E);this.hasRTLText||=Ix(L),(!this.hasRTLText||Jt.getRTLTextPluginStatus()==="unavailable"||this.hasRTLText&&Jt.isParsed())&&(w=Og(L,i,v))}let A;if(u){let E=i.getValueAndResolveTokens("icon-image",v,r,f);A=E instanceof Kt?E:Kt.fromString(E)}if(!w&&!A)continue;let S=this.sortFeaturesByKey?h.evaluate(v,{},r):void 0,D={id:m,text:w,icon:A,index:g,sourceLayerIndex:x,geometry:v.geometry,properties:y.properties,type:vi.types[y.type],sortKey:S};if(this.features.push(D),A&&(c[A.name]=!0),w){let E=a.evaluate(v,{},r).join(","),L=n.get("text-rotation-alignment")!=="viewport"&&n.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes?.includes(2);let $=Ia(w.toString());this.calculateGlyphDependencies(w,p,E,L,$);for(let P of w.sections)P.image&&(c[P.image.name]=!0)}}n.get("symbol-placement")==="line"&&(this.features=Rg(this.features)),this.sortFeaturesByKey&&this.features.sort((y,m)=>y.sortKey-m.sortKey)}update(t,e,r){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,e,this.layers,{imagePositions:r}),this.icon.programConfigurations.updatePaintArrays(t,e,this.layers,{imagePositions:r}))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(t,e){let r=this.lineVertexArray.length;if(t.segment!==void 0){let i=t.dist(e[t.segment+1]),n=t.dist(e[t.segment]),a={};for(let s=t.segment+1;s<e.length;s++)a[s]={x:e[s].x,y:e[s].y,tileUnitDistanceFromAnchor:i},s<e.length-1&&(i+=e[s+1].dist(e[s]));for(let s=t.segment||0;s>=0;s--)a[s]={x:e[s].x,y:e[s].y,tileUnitDistanceFromAnchor:n},s>0&&(n+=e[s-1].dist(e[s]));for(let s=0;s<e.length;s++){let o=a[s];this.lineVertexArray.emplaceBack(o.x,o.y,o.tileUnitDistanceFromAnchor)}}return{lineStartIndex:r,lineLength:this.lineVertexArray.length-r}}addSymbols(t,e,r,i,n,a,s,o,l,u,h,c,p){let f=t.indexArray,d=t.layoutVertexArray,y=t.segments.prepareSegment(4*e.length,d,f,this.canOverlap?a.sortKey:void 0),m=this.glyphOffsetArray.length,g=y.vertexLength,x=this.allowVerticalPlacement&&s===2?Math.PI/2:0,b=a.text&&a.text.sections;for(let v=0;v<e.length;v++){let{tl:w,tr:A,bl:S,br:D,tex:E,pixelOffsetTL:L,pixelOffsetBR:$,minFontScaleX:P,minFontScaleY:z,glyphOffset:F,isSDF:V,sectionIndex:R}=e[v],B=y.vertexLength,G=F[1];Ri(d,o.x,o.y,w.x,G+w.y,E.x,E.y,r,V,L.x,L.y,P,z,p),Ri(d,o.x,o.y,A.x,G+A.y,E.x+E.w,E.y,r,V,$.x,L.y,P,z,p),Ri(d,o.x,o.y,S.x,G+S.y,E.x,E.y+E.h,r,V,L.x,$.y,P,z,p),Ri(d,o.x,o.y,D.x,G+D.y,E.x+E.w,E.y+E.h,r,V,$.x,$.y,P,z,p),Cp(t.dynamicLayoutVertexArray,o,x),f.emplaceBack(B,B+2,B+1),f.emplaceBack(B+1,B+2,B+3),y.vertexLength+=4,y.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(F[0]),(v===e.length-1||R!==e[v+1].sectionIndex)&&t.programConfigurations.populatePaintArrays(d.length,a,a.index,{imagePositions:{},canonical:c,formattedSection:b?.[R]})}t.placedSymbolArray.emplaceBack(o.x,o.y,m,this.glyphOffsetArray.length-m,g,l,u,o.segment,r?r[0]:0,r?r[1]:0,i[0],i[1],s,0,!1,0,h,p)}_addCollisionDebugVertex(t,e,r,i,n,a){return e.emplaceBack(0,0),t.emplaceBack(r.x,r.y,i,n,Math.round(a.x),Math.round(a.y))}addCollisionDebugVertices(t,e,r,i,n,a,s){let o=n.segments.prepareSegment(4,n.layoutVertexArray,n.indexArray),l=o.vertexLength,u=n.layoutVertexArray,h=n.collisionVertexArray,c=s.anchorX,p=s.anchorY;this._addCollisionDebugVertex(u,h,a,c,p,new M(t,e)),this._addCollisionDebugVertex(u,h,a,c,p,new M(r,e)),this._addCollisionDebugVertex(u,h,a,c,p,new M(r,i)),this._addCollisionDebugVertex(u,h,a,c,p,new M(t,i)),o.vertexLength+=4;let f=n.indexArray;f.emplaceBack(l,l+1),f.emplaceBack(l+1,l+2),f.emplaceBack(l+2,l+3),f.emplaceBack(l+3,l),o.primitiveLength+=4}addDebugCollisionBoxes(t,e,r,i){for(let n=t;n<e;n++){let a=this.collisionBoxArray.get(n),s=a.x1,o=a.y1,l=a.x2,u=a.y2;this.addCollisionDebugVertices(s,o,l,u,i?this.textCollisionBox:this.iconCollisionBox,a.anchorPoint,r)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Ss(Vl,lu.members,Ha),this.iconCollisionBox=new Ss(Vl,lu.members,Ha);for(let t=0;t<this.symbolInstances.length;t++){let e=this.symbolInstances.get(t);this.addDebugCollisionBoxes(e.textBoxStartIndex,e.textBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.verticalTextBoxStartIndex,e.verticalTextBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.iconBoxStartIndex,e.iconBoxEndIndex,e,!1),this.addDebugCollisionBoxes(e.verticalIconBoxStartIndex,e.verticalIconBoxEndIndex,e,!1)}}_deserializeCollisionBoxesForSymbol(t,e,r,i,n,a,s,o,l){let u={};for(let h=e;h<r;h++){let c=t.get(h);u.textBox={x1:c.x1,y1:c.y1,x2:c.x2,y2:c.y2,anchorPointX:c.anchorPointX,anchorPointY:c.anchorPointY},u.textFeatureIndex=c.featureIndex;break}for(let h=i;h<n;h++){let c=t.get(h);u.verticalTextBox={x1:c.x1,y1:c.y1,x2:c.x2,y2:c.y2,anchorPointX:c.anchorPointX,anchorPointY:c.anchorPointY},u.verticalTextFeatureIndex=c.featureIndex;break}for(let h=a;h<s;h++){let c=t.get(h);u.iconBox={x1:c.x1,y1:c.y1,x2:c.x2,y2:c.y2,anchorPointX:c.anchorPointX,anchorPointY:c.anchorPointY},u.iconFeatureIndex=c.featureIndex;break}for(let h=o;h<l;h++){let c=t.get(h);u.verticalIconBox={x1:c.x1,y1:c.y1,x2:c.x2,y2:c.y2,anchorPointX:c.anchorPointX,anchorPointY:c.anchorPointY},u.verticalIconFeatureIndex=c.featureIndex;break}return u}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let e=0;e<this.symbolInstances.length;e++){let r=this.symbolInstances.get(e);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,r.textBoxStartIndex,r.textBoxEndIndex,r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r.iconBoxStartIndex,r.iconBoxEndIndex,r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(t,e){let r=t.placedSymbolArray.get(e),i=r.vertexStartIndex+r.numGlyphs*4;for(let n=r.vertexStartIndex;n<i;n+=4)t.indexArray.emplaceBack(n,n+2,n+1),t.indexArray.emplaceBack(n+1,n+2,n+3)}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;let e=Math.sin(t),r=Math.cos(t),i=[],n=[],a=[];for(let s=0;s<this.symbolInstances.length;++s){a.push(s);let o=this.symbolInstances.get(s);i.push(Math.round(e*o.anchorX+r*o.anchorY)|0),n.push(o.featureIndex)}return a.sort((s,o)=>i[s]-i[o]||n[o]-n[s]),a}addToSortKeyRanges(t,e){let r=this.sortKeyRanges[this.sortKeyRanges.length-1];r?.sortKey===e?r.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:e,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(let e of this.symbolInstanceIndexes){let r=this.symbolInstances.get(e);this.featureSortOrder.push(r.featureIndex);let i=[r.rightJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.leftJustifiedTextSymbolIndex];for(let n=0;n<i.length;n++){let a=i[n];a>=0&&i.indexOf(a)===n&&this.addIndicesForPlacedSymbol(this.text,a)}r.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,r.verticalPlacedTextSymbolIndex),r.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,r.placedIconSymbolIndex),r.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,r.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}};I("SymbolBucket",Ce,{omit:["layers","collisionBoxArray","features","compareText"]}),Ce.MAX_GLYPHS=65535,Ce.addDynamicAttributes=Cp;function Mx(t,e){return e.replace(/{([^{}]+)}/g,(r,i)=>t&&i in t?String(t[i]):"")}var Cx,Bx=()=>Cx||=new Ft({"symbol-placement":new C(_.layout_symbol["symbol-placement"],"symbol-placement"),"symbol-spacing":new C(_.layout_symbol["symbol-spacing"],"symbol-spacing"),"symbol-avoid-edges":new C(_.layout_symbol["symbol-avoid-edges"],"symbol-avoid-edges"),"symbol-sort-key":new O(_.layout_symbol["symbol-sort-key"],"symbol-sort-key"),"symbol-z-order":new C(_.layout_symbol["symbol-z-order"],"symbol-z-order"),"icon-allow-overlap":new C(_.layout_symbol["icon-allow-overlap"],"icon-allow-overlap"),"icon-overlap":new C(_.layout_symbol["icon-overlap"],"icon-overlap"),"icon-ignore-placement":new C(_.layout_symbol["icon-ignore-placement"],"icon-ignore-placement"),"icon-optional":new C(_.layout_symbol["icon-optional"],"icon-optional"),"icon-rotation-alignment":new O(_.layout_symbol["icon-rotation-alignment"],"icon-rotation-alignment"),"icon-size":new O(_.layout_symbol["icon-size"],"icon-size"),"icon-text-fit":new C(_.layout_symbol["icon-text-fit"],"icon-text-fit"),"icon-text-fit-padding":new C(_.layout_symbol["icon-text-fit-padding"],"icon-text-fit-padding"),"icon-image":new O(_.layout_symbol["icon-image"],"icon-image"),"icon-rotate":new O(_.layout_symbol["icon-rotate"],"icon-rotate"),"icon-padding":new O(_.layout_symbol["icon-padding"],"icon-padding"),"icon-keep-upright":new C(_.layout_symbol["icon-keep-upright"],"icon-keep-upright"),"icon-offset":new O(_.layout_symbol["icon-offset"],"icon-offset"),"icon-anchor":new O(_.layout_symbol["icon-anchor"],"icon-anchor"),"icon-pitch-alignment":new C(_.layout_symbol["icon-pitch-alignment"],"icon-pitch-alignment"),"text-pitch-alignment":new C(_.layout_symbol["text-pitch-alignment"],"text-pitch-alignment"),"text-rotation-alignment":new C(_.layout_symbol["text-rotation-alignment"],"text-rotation-alignment"),"text-field":new O(_.layout_symbol["text-field"],"text-field"),"text-font":new O(_.layout_symbol["text-font"],"text-font"),"text-size":new O(_.layout_symbol["text-size"],"text-size"),"text-max-width":new O(_.layout_symbol["text-max-width"],"text-max-width"),"text-line-height":new C(_.layout_symbol["text-line-height"],"text-line-height"),"text-letter-spacing":new O(_.layout_symbol["text-letter-spacing"],"text-letter-spacing"),"text-justify":new O(_.layout_symbol["text-justify"],"text-justify"),"text-radial-offset":new O(_.layout_symbol["text-radial-offset"],"text-radial-offset"),"text-variable-anchor":new C(_.layout_symbol["text-variable-anchor"],"text-variable-anchor"),"text-variable-anchor-offset":new O(_.layout_symbol["text-variable-anchor-offset"],"text-variable-anchor-offset"),"text-anchor":new O(_.layout_symbol["text-anchor"],"text-anchor"),"text-max-angle":new C(_.layout_symbol["text-max-angle"],"text-max-angle"),"text-writing-mode":new C(_.layout_symbol["text-writing-mode"],"text-writing-mode"),"text-rotate":new O(_.layout_symbol["text-rotate"],"text-rotate"),"text-padding":new C(_.layout_symbol["text-padding"],"text-padding"),"text-keep-upright":new C(_.layout_symbol["text-keep-upright"],"text-keep-upright"),"text-transform":new O(_.layout_symbol["text-transform"],"text-transform"),"text-offset":new O(_.layout_symbol["text-offset"],"text-offset"),"text-allow-overlap":new C(_.layout_symbol["text-allow-overlap"],"text-allow-overlap"),"text-overlap":new C(_.layout_symbol["text-overlap"],"text-overlap"),"text-ignore-placement":new C(_.layout_symbol["text-ignore-placement"],"text-ignore-placement"),"text-optional":new C(_.layout_symbol["text-optional"],"text-optional"),"symbol-height-offset":new O(_.layout_symbol["symbol-height-offset"],"symbol-height-offset"),"symbol-height-anchor":new C(_.layout_symbol["symbol-height-anchor"],"symbol-height-anchor")}),Px,zx=()=>Px||=new Ft({"icon-opacity":new O(_.paint_symbol["icon-opacity"],"icon-opacity"),"icon-color":new O(_.paint_symbol["icon-color"],"icon-color"),"icon-halo-color":new O(_.paint_symbol["icon-halo-color"],"icon-halo-color"),"icon-halo-width":new O(_.paint_symbol["icon-halo-width"],"icon-halo-width"),"icon-halo-blur":new O(_.paint_symbol["icon-halo-blur"],"icon-halo-blur"),"icon-translate":new C(_.paint_symbol["icon-translate"],"icon-translate"),"icon-translate-anchor":new C(_.paint_symbol["icon-translate-anchor"],"icon-translate-anchor"),"text-opacity":new O(_.paint_symbol["text-opacity"],"text-opacity"),"text-color":new O(_.paint_symbol["text-color"],"text-color",{runtimeType:Ut,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),"text-halo-color":new O(_.paint_symbol["text-halo-color"],"text-halo-color"),"text-halo-width":new O(_.paint_symbol["text-halo-width"],"text-halo-width"),"text-halo-blur":new O(_.paint_symbol["text-halo-blur"],"text-halo-blur"),"text-translate":new C(_.paint_symbol["text-translate"],"text-translate"),"text-translate-anchor":new C(_.paint_symbol["text-translate-anchor"],"text-translate-anchor")}),fa={get paint(){return zx()},get layout(){return Bx()}},Bp=class{constructor(t){if(t.property.overrides===void 0)throw Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=t.property.overrides?t.property.overrides.runtimeType:ci,this.defaultValue=t}evaluate(t){if(t.formattedSection){let e=this.defaultValue.property.overrides;if(e?.hasOverride(t.formattedSection))return e.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){if(!this.defaultValue.isConstant()){let e=this.defaultValue.value;t(e._styleExpression.expression)}}outputDefined(){return!1}serialize(){return null}};I("FormatSectionOverride",Bp,{omit:["defaultValue"]});var Lx=class As extends jt{constructor(e,r){super(e,fa,r)}recalculate(e,r){super.recalculate(e,r);let i=this.layout.get("icon-rotation-alignment");if((i.value.kind!=="constant"||i.value.value==="auto")&&(this.layout._values["icon-rotation-alignment"]=new Vt(i.property,{kind:"constant",value:this.layout.get("symbol-placement")==="point"?"viewport":"map"},i.parameters)),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout.get("symbol-placement")==="point"?this.layout._values["text-rotation-alignment"]="viewport":this.layout._values["text-rotation-alignment"]="map"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment").constantOr("viewport")),this.layout.get("symbol-placement")==="point"){let n=this.layout.get("text-writing-mode");if(n){let a=[];for(let s of n)a.includes(s)||a.push(s);this.layout._values["text-writing-mode"]=a}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,r,i,n){let a=this.layout.get(e).evaluate(r,{},i,n),s=this._unevaluatedLayout._values[e];return!s.isDataDriven()&&!Fn(s.value)&&a?Mx(r.properties,a):a}createBucket(e){return new Ce(e)}queryRadius(){return 0}queryIntersectsFeature(){throw Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let e of fa.paint.overridableProperties){if(!As.hasPaintOverride(this.layout,e))continue;let r=this.paint.get(e),i=new Ys(new Bp(r),`layers[${this.id}].paint.${r.property.name}`,r.property.specification),n=null;n=r.value.kind==="constant"||r.value.kind==="source"?new ri("source",i):new an("composite",i,r.value.zoomStops),this.paint._values[e]=new Vt(r.property,n,r.parameters)}}_handleOverridablePaintPropertyUpdate(e,r,i){return!this.layout||r.isDataDriven()||i.isDataDriven()?!1:As.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,r){let i=e.get("text-field"),n=fa.paint.properties[r],a=!1,s=o=>{for(let l of o)if(n.overrides?.hasOverride(l)){a=!0;return}};if(i.value.kind==="constant"&&i.value.value instanceof oe)s(i.value.value.sections);else if(i.value.kind==="source"||i.value.kind==="composite"){let o=u=>{if(!a)if(u instanceof pr&<(u.value)===pi){let h=u.value;s(h.sections)}else u instanceof xh?s(u.sections):u.eachChild(o)},l=i.value;l._styleExpression&&o(l._styleExpression.expression)}return a}};function Vx(t,e,r,i=1){let n=t.get("icon-padding").evaluate(e,{},r)?.values;return[n[0]*i,n[1]*i,n[2]*i,n[3]*i]}var Ox,Rx=()=>Ox||=new Ft({"background-color":new C(_.paint_background["background-color"],"background-color"),"background-pattern":new kc(_.paint_background["background-pattern"],"background-pattern"),"background-opacity":new C(_.paint_background["background-opacity"],"background-opacity")}),$x={get paint(){return Rx()}};var Nx=class extends jt{constructor(t,e){super(t,$x,e)}};var Ux=class extends jt{constructor(t,e){super(t,{},e),this.onAdd=r=>{this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)},this.onRemove=r=>{this.implementation.onRemove&&this.implementation.onRemove(r,r.painter.context.gl)},this.implementation=t}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw Error("Custom layers cannot be serialized")}};function Pp(t,e){if(t.type==="custom")return new Ux(t,e);switch(t.type){case"background":return new Nx(t,e);case"circle":return new w0(t,e);case"color-relief":return new z0(t,e);case"fill":return new d1(t,e);case"fill-extrusion":return new O1(t,e);case"heatmap":return new T0(t,e);case"hillshade":return new M0(t,e);case"line":return new Bg(t,e);case"raster":return new Pm(t,e);case"symbol":return new Lx(t,e)}}var qx=class{constructor(t){this._methodToThrottle=t,this._triggered=!1,this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()}}trigger(){this._triggered||(this._triggered=!0,this._channel?.port1.postMessage(!0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}},Gx={once:!0},zp=class{constructor(t,e){this.target=t,this.mapId=e,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new qx(()=>this.process()),this.subscription=tl(this.target,"message",r=>this.receive(r),!1),this.globalScope=Be(self)?t:window}registerMessageHandler(t,e){this.messageHandlers[t]=e}unregisterMessageHandler(t){delete this.messageHandlers[t]}sendAsync(t,e){return new Promise((r,i)=>{let n=Math.round(Math.random()*1e18).toString(36).substring(0,10),a=e?tl(e.signal,"abort",()=>{a?.unsubscribe(),delete this.resolveRejects[n];let l={id:n,type:"<cancel>",origin:location.origin,targetMapId:t.targetMapId,sourceMapId:this.mapId};this.target.postMessage(l),i(new Ms(e.signal.reason))},Gx):null;this.resolveRejects[n]={resolve:l=>{a?.unsubscribe(),r(l)},reject:l=>{a?.unsubscribe(),i(l)}};let s=[],o={...t,id:n,sourceMapId:this.mapId,origin:location.origin,data:jr(t.data,s)};this.target.postMessage(o,{transfer:s})})}receive(t){let e=t.data,r=e.id,i=["file://","resource://android","null"],n=[e.origin,location.origin],a=e.origin===location.origin,s=n.some(o=>i.includes(o));if(!(!a&&!s)&&!(e.targetMapId&&this.mapId!==e.targetMapId)){if(e.type==="<cancel>"){delete this.tasks[r];let o=this.abortControllers[r];delete this.abortControllers[r],o&&o.abort();return}if(Be(self)||e.mustQueue){this.tasks[r]=e,this.taskQueue.push(r),this.invoker.trigger();return}this.processTask(r,e)}}process(){if(this.taskQueue.length===0)return;let t=this.taskQueue.shift(),e=this.tasks[t];delete this.tasks[t],this.taskQueue.length>0&&this.invoker.trigger(),e&&this.processTask(t,e)}async processTask(t,e){if(e.type==="<response>"){let n=this.resolveRejects[t];if(delete this.resolveRejects[t],!n)return;e.error?n.reject(Wr(Yr(e.error))):n.resolve(Yr(e.data));return}if(!this.messageHandlers[e.type]){this.completeTask(t,null,null);return}let r=Yr(e.data),i=new AbortController;this.abortControllers[t]=i;try{let n=await this.messageHandlers[e.type](e.sourceMapId,r,i);this.completeTask(t,null,n)}catch(n){this.completeTask(t,Wr(n))}}completeTask(t,e,r){let i=[];delete this.abortControllers[t];let n={id:t,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:e?jr(e):null,data:jr(r,i)};this.target.postMessage(n,{transfer:i})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}};function jx(t,e,r){return!(t<0||t>25||r<0||r>=2**t||e<0||e>=2**t)}var Lp=class{constructor(t,e,r){if(!jx(t,e,r))throw Error(`x=${e}, y=${r}, z=${t} outside of bounds. 0<=x<${2**t}, 0<=y<${2**t} 0<=z<=25 `);this.z=t,this.x=e,this.y=r,this.key=Zr(0,t,t,e,r)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,e,r){let i=Xx(this.x,this.y,this.z),n=Zx(this.z,this.x,this.y);return t[(this.x+this.y)%t.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(r==="tms"?2**this.z-this.y-1:this.y)).replace(/{ratio}/g,e>1?"@2x":"").replace(/{quadkey}/g,n).replace(/{bbox-epsg-3857}/g,i)}isChildOf(t){let e=this.z-t.z;return e>0&&t.x===this.x>>e&&t.y===this.y>>e}getTilePoint(t){let e=2**this.z;return new M((t.x*e-this.x)*it,(t.y*e-this.y)*it)}toString(){return`${this.z}/${this.x}/${this.y}`}},Yx=class{constructor(t,e){this.wrap=t,this.canonical=e,this.key=Zr(t,e.z,e.z,e.x,e.y)}},Do=class zt{constructor(e,r,i,n,a){if(this.terrainRttPosMatrix32f=null,e<i)throw Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${i}`);this.overscaledZ=e,this.wrap=r,this.canonical=new Lp(i,+n,+a),this.key=Zr(r,e,i,n,a)}clone(){return new zt(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);let r=this.canonical.z-e;return e>this.canonical.z?new zt(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new zt(e,this.wrap,e,this.canonical.x>>r,this.canonical.y>>r)}isOverscaled(){return this.overscaledZ>this.canonical.z}calculateScaledKey(e,r){if(e>this.overscaledZ)throw Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);let i=this.canonical.z-e;return e>this.canonical.z?Zr(this.wrap*+r,e,this.canonical.z,this.canonical.x,this.canonical.y):Zr(this.wrap*+r,e,e,this.canonical.x>>i,this.canonical.y>>i)}isChildOf(e){if(e.wrap!==this.wrap||this.overscaledZ-e.overscaledZ<=0)return!1;if(e.overscaledZ===0)return this.overscaledZ>0;let r=this.canonical.z-e.canonical.z;return r<0?!1:e.canonical.x===this.canonical.x>>r&&e.canonical.y===this.canonical.y>>r}children(e){if(this.overscaledZ>=e)return[new zt(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let r=this.canonical.z+1,i=this.canonical.x*2,n=this.canonical.y*2;return[new zt(r,this.wrap,r,i,n),new zt(r,this.wrap,r,i+1,n),new zt(r,this.wrap,r,i,n+1),new zt(r,this.wrap,r,i+1,n+1)]}isLessThan(e){return this.wrap<e.wrap?!0:this.wrap>e.wrap?!1:this.overscaledZ<e.overscaledZ?!0:this.overscaledZ>e.overscaledZ?!1:this.canonical.x<e.canonical.x?!0:this.canonical.x>e.canonical.x?!1:this.canonical.y<e.canonical.y}wrapped(){return new zt(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new zt(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return 2**(this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Yx(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new co(e.x-this.wrap,e.y))}normalizeCoordinates(e,r,i=it){if(e>=0&&e<i&&r>=0&&r<i)return{tileID:this,x:e,y:r};let n=Math.floor(e/i),a=Math.floor(r/i),s=e-n*i,o=r-a*i,l=this.canonical.z,u=1<<l,h=this.canonical.y+a;if(h<0||h>=u)return null;let c=this.canonical.x+n,p=this.wrap;return c<0?(p-=Math.ceil(-c/u),c=(c%u+u)%u):c>=u&&(p+=Math.floor(c/u),c%=u),{tileID:new zt(this.overscaledZ,p,l,c,h),x:s,y:o}}};function Zr(t,e,r,i,n){t*=2,t<0&&(t=t*-1-1);let a=1<<r;return(a*a*t+a*n+i).toString(36)+r.toString(36)+e.toString(36)}var da=Math.PI*6378137;function Xx(t,e,r){e=2**r-e-1;let i=Du(t*256,e*256,r),n=Du((t+1)*256,(e+1)*256,r);return`${i[0]},${i[1]},${n[0]},${n[1]}`}function Du(t,e,r){let i=2*da/256/2**r;return[t*i-da,e*i-da]}function Zx(t,e,r){let i="";for(let n=t;n>0;n--){let a=1<<n-1;i+=(e&a?1:0)+(r&a?2:0)}return i}I("CanonicalTileID",Lp),I("OverscaledTileID",Do,{omit:["terrainRttPosMatrix32f"]});var Wx=class{constructor(t,e){this.feature=t,this.type=t.type,this.properties=t.tags?t.tags:{},this.extent=e,"id"in t&&(typeof t.id=="string"?this.id=parseInt(t.id,10):typeof t.id=="number"&&!isNaN(t.id)&&(this.id=t.id))}loadGeometry(){let t=[],e=this.feature.type===1?[this.feature.geometry]:this.feature.geometry;for(let r of e){let i=[];for(let n of r)i.push(new M(n[0],n[1]));t.push(i)}return t}},Ds="_geojsonTileLayer",Vp=class{constructor(t,e){this.layers={[Ds]:this},this.name=Ds,this.version=e?e.version:1,this.extent=e?e.extent:4096,this.length=t.length,this.features=t}feature(t){return new Wx(this.features[t],this.extent)}};function Eo(t,e=""){let r=new jg;return Hx(t,r,e),r.finish()}function Hx(t,e,r=""){for(let i in t.layers)e.writeMessage(3,(n,a)=>Kx(n,a,r),t.layers[i])}function Kx(t,e,r=""){e.writeVarintField(15,t.version||1),e.writeStringField(1,t.name||""),e.writeVarintField(5,t.extent||4096);let i={jsonPrefix:r,keys:[],values:[],keycache:{},valuecache:{}};for(let s=0;s<t.length;s++)i.feature=t.feature(s),e.writeMessage(2,Jx,i);let n=i.keys;for(let s of n)e.writeStringField(3,s);let a=i.values;for(let s of a)e.writeMessage(4,e2,s)}function Jx(t,e){if(!t.feature)return;let r=t.feature;r.id!==void 0&&e.writeVarintField(1,r.id),e.writeMessage(2,Qx,t),e.writeVarintField(3,r.type),e.writeMessage(4,t2,r)}function Qx(t,e){for(let r in t.feature?.properties){let i=t.feature.properties[r],n=t.keycache[r];if(i==null)continue;n===void 0&&(t.keys.push(r),n=t.keys.length-1,t.keycache[r]=n),e.writeVarint(n),typeof i!="string"&&typeof i!="boolean"&&typeof i!="number"&&(i=t.jsonPrefix+JSON.stringify(i));let a=typeof i+":"+i,s=t.valuecache[a];s===void 0&&(t.values.push(i),s=t.values.length-1,t.valuecache[a]=s),e.writeVarint(s)}}function ya(t,e){return(e<<3)+(t&7)}function Eu(t){return t<<1^t>>31}function t2(t,e){let r=t.loadGeometry(),i=t.type,n=0,a=0;for(let s of r){let o=1;i===1&&(o=s.length),e.writeVarint(ya(1,o));let l=i===3?s.length-1:s.length;for(let u=0;u<l;u++){u===1&&i!==1&&e.writeVarint(ya(2,l-1));let h=s[u].x-n,c=s[u].y-a;e.writeVarint(Eu(h)),e.writeVarint(Eu(c)),n+=h,a+=c}t.type===3&&e.writeVarint(ya(7,1))}}function e2(t,e){let r=typeof t;r==="string"?e.writeStringField(1,t):r==="boolean"?e.writeBooleanField(7,t):r==="number"&&(t%1==0?t<0?e.writeSVarintField(6,t):e.writeVarintField(5,t):e.writeDoubleField(3,t))}var To=class{constructor(t){this._stringToNumber={},this._numberToString=[];for(let e=0;e<t.length;e++){let r=t[e];this._stringToNumber[r]=e,this._numberToString[e]=r}}encode(t){return this._stringToNumber[t]}decode(t){if(t>=this._numberToString.length)throw Error(`Out of bounds. Index requested n=${t} can\'t be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[t]}},r2=class{constructor(t,e,r,i,n){this.type="Feature",this._vectorTileFeature=t,this._x=r,this._y=i,this._z=e;for(let a in t.properties)typeof t.properties[a]!="string"||!t.properties[a].startsWith("__$json__:")||(t.properties[a]=JSON.parse(t.properties[a].slice(10)));this.properties=t.properties,this.id=n}projectPoint(t,e,r,i){return[(t.x+e)*360/i-180,360/Math.PI*Math.atan(Math.exp((1-(t.y+r)*2/i)*Math.PI))-90]}projectLine(t,e,r,i){return t.map(n=>this.projectPoint(n,e,r,i))}get geometry(){if(this._geometry)return this._geometry;let t=this._vectorTileFeature,e=t.extent*2**this._z,r=t.extent*this._x,i=t.extent*this._y,n=t.loadGeometry();switch(t.type){case 1:{let a=[];for(let o of n)a.push(o[0]);let s=this.projectLine(a,r,i,e);this._geometry=a.length===1?{type:"Point",coordinates:s[0]}:{type:"MultiPoint",coordinates:s};break}case 2:{let a=n.map(s=>this.projectLine(s,r,i,e));this._geometry=a.length===1?{type:"LineString",coordinates:a[0]}:{type:"MultiLineString",coordinates:a};break}case 3:{let a=op(n),s=[];for(let o of a)s.push(o.map(l=>this.projectLine(l,r,i,e)));this._geometry=s.length===1?{type:"Polygon",coordinates:s[0]}:{type:"MultiPolygon",coordinates:s};break}default:throw Error(`unknown feature type: ${t.type}`)}return this._geometry}set geometry(t){this._geometry=t}toJSON(){let t={geometry:this.geometry};for(let e in this)e!=="_geometry"&&e!=="_vectorTileFeature"&&e!=="_x"&&e!=="_y"&&e!=="_z"&&(t[e]=this[e]);return t}},Ne=class{constructor(t,e,r){this._name=t,this.dataBuffer=e,typeof r=="number"?this._size=r:(this.nullabilityBuffer=r,this._size=r.size())}getValue(t){return this.nullabilityBuffer&&!this.nullabilityBuffer.get(t)?null:this.getValueFromBuffer(t)}has(t){return this.nullabilityBuffer?.get(t)||!this.nullabilityBuffer}get name(){return this._name}get size(){return this._size}},Nn=class extends Ne{},Fo=class extends Nn{getValueFromBuffer(t){return this.dataBuffer[t]}},ko=class extends Nn{getValueFromBuffer(t){return this.dataBuffer[t]}},Op=class extends Ne{constructor(t,e,r,i){super(t,e,i),this.delta=r}},Io=class extends Op{constructor(t,e,r,i,n){super(t,n?Int32Array.of(e):Uint32Array.of(e),r,i)}getValueFromBuffer(t){return this.dataBuffer[0]+t*this.delta}},Mo=class extends Ne{constructor(t,e,r,i){super(t,i?Int32Array.of(e):Uint32Array.of(e),r)}getValueFromBuffer(t){return this.dataBuffer[0]}},i2=class{constructor(t,e,r,i,n=4096){if(this._name=t,this._geometryVector=e,this._idVector=r,this._propertyVectors=i,this._extent=n,t.length===0)throw Error("Missing layer name")}get name(){return this._name}get idVector(){return this._idVector}get geometryVector(){return this._geometryVector}get propertyVectors(){return this._propertyVectors??[]}getPropertyVector(t){return this.propertyVectorsMap||=new Map(this.propertyVectors.map(e=>[e.name,e])),this.propertyVectorsMap.get(t)}get numFeatures(){return this.geometryVector.numGeometries}get extent(){return this._extent}getFeatures(){let t=[],e=this.geometryVector.getGeometries();for(let r=0;r<this.numFeatures;r++){let i;if(this.idVector){let s=this.idVector.getValue(r);s!==null&&(i=this.containsMaxSafeIntegerValues(this.idVector)?Number(s):s)}let n={coordinates:e[r],type:this.geometryVector.geometryType(r)},a={};for(let s of this.propertyVectors){if(!s)continue;let o=s.name,l=s.getValue(r);l!==null&&(a[o]=l)}t.push({id:i,geometry:n,properties:a})}return t}containsMaxSafeIntegerValues(t){return t instanceof Fo||t instanceof Mo||t instanceof Io||t instanceof ko}},Nr={FEATURE:0,VERTEX:1},Z={BOOLEAN:0,INT_8:1,UINT_8:2,INT_32:3,UINT_32:4,INT_64:5,UINT_64:6,FLOAT:7,DOUBLE:8,STRING:9},ge={GEOMETRY:0,STRUCT:1,MAP:2},Rp={ID:0},$p=class{constructor(t){this.value=t}get(){return this.value}set(t){this.value=t}increment(){return this.value++}add(t){this.value+=t}},U;(function(t){t.NONE="NONE",t.DELTA="DELTA",t.COMPONENTWISE_DELTA="COMPONENTWISE_DELTA",t.RLE="RLE",t.MORTON="MORTON",t.PDE="PDE"})(U||={});var Rt;(function(t){t.NONE="NONE",t.FAST_PFOR="FAST_PFOR",t.VARINT="VARINT"})(Rt||={});var Co=new Uint32Array(33);Co[0]=0;for(let t=1;t<=32;t++)Co[t]=t===32?4294967295:4294967295>>>32-t;var Es=Co,Np=65536;function Bo(t,e){return t-t%e}function n2(t){return Bo(t+31,32)}function a2(t){if(!Number.isFinite(t)||t<=0)return Np;let e=Bo(Math.floor(t),256);return e===0?256:e}function s2(t){let e=t>>>0;return((e&255)<<24|(e&65280)<<8|e>>>8&65280|e>>>24&255)>>>0}function o2(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0;r[n++]=a>>>0&3,r[n++]=a>>>2&3,r[n++]=a>>>4&3,r[n++]=a>>>6&3,r[n++]=a>>>8&3,r[n++]=a>>>10&3,r[n++]=a>>>12&3,r[n++]=a>>>14&3,r[n++]=a>>>16&3,r[n++]=a>>>18&3,r[n++]=a>>>20&3,r[n++]=a>>>22&3,r[n++]=a>>>24&3,r[n++]=a>>>26&3,r[n++]=a>>>28&3,r[n++]=a>>>30&3,r[n++]=s>>>0&3,r[n++]=s>>>2&3,r[n++]=s>>>4&3,r[n++]=s>>>6&3,r[n++]=s>>>8&3,r[n++]=s>>>10&3,r[n++]=s>>>12&3,r[n++]=s>>>14&3,r[n++]=s>>>16&3,r[n++]=s>>>18&3,r[n++]=s>>>20&3,r[n++]=s>>>22&3,r[n++]=s>>>24&3,r[n++]=s>>>26&3,r[n++]=s>>>28&3,r[n]=s>>>30&3}function l2(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0;r[n++]=a>>>0&7,r[n++]=a>>>3&7,r[n++]=a>>>6&7,r[n++]=a>>>9&7,r[n++]=a>>>12&7,r[n++]=a>>>15&7,r[n++]=a>>>18&7,r[n++]=a>>>21&7,r[n++]=a>>>24&7,r[n++]=a>>>27&7,r[n++]=(a>>>30|(s&1)<<2)&7,r[n++]=s>>>1&7,r[n++]=s>>>4&7,r[n++]=s>>>7&7,r[n++]=s>>>10&7,r[n++]=s>>>13&7,r[n++]=s>>>16&7,r[n++]=s>>>19&7,r[n++]=s>>>22&7,r[n++]=s>>>25&7,r[n++]=s>>>28&7,r[n++]=(s>>>31|(o&3)<<1)&7,r[n++]=o>>>2&7,r[n++]=o>>>5&7,r[n++]=o>>>8&7,r[n++]=o>>>11&7,r[n++]=o>>>14&7,r[n++]=o>>>17&7,r[n++]=o>>>20&7,r[n++]=o>>>23&7,r[n++]=o>>>26&7,r[n]=o>>>29&7}function u2(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0;r[n++]=a>>>0&15,r[n++]=a>>>4&15,r[n++]=a>>>8&15,r[n++]=a>>>12&15,r[n++]=a>>>16&15,r[n++]=a>>>20&15,r[n++]=a>>>24&15,r[n++]=a>>>28&15,r[n++]=s>>>0&15,r[n++]=s>>>4&15,r[n++]=s>>>8&15,r[n++]=s>>>12&15,r[n++]=s>>>16&15,r[n++]=s>>>20&15,r[n++]=s>>>24&15,r[n++]=s>>>28&15,r[n++]=o>>>0&15,r[n++]=o>>>4&15,r[n++]=o>>>8&15,r[n++]=o>>>12&15,r[n++]=o>>>16&15,r[n++]=o>>>20&15,r[n++]=o>>>24&15,r[n++]=o>>>28&15,r[n++]=l>>>0&15,r[n++]=l>>>4&15,r[n++]=l>>>8&15,r[n++]=l>>>12&15,r[n++]=l>>>16&15,r[n++]=l>>>20&15,r[n++]=l>>>24&15,r[n]=l>>>28&15}function h2(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0;r[n++]=a>>>0&31,r[n++]=a>>>5&31,r[n++]=a>>>10&31,r[n++]=a>>>15&31,r[n++]=a>>>20&31,r[n++]=a>>>25&31,r[n++]=(a>>>30|(s&7)<<2)&31,r[n++]=s>>>3&31,r[n++]=s>>>8&31,r[n++]=s>>>13&31,r[n++]=s>>>18&31,r[n++]=s>>>23&31,r[n++]=(s>>>28|(o&1)<<4)&31,r[n++]=o>>>1&31,r[n++]=o>>>6&31,r[n++]=o>>>11&31,r[n++]=o>>>16&31,r[n++]=o>>>21&31,r[n++]=o>>>26&31,r[n++]=(o>>>31|(l&15)<<1)&31,r[n++]=l>>>4&31,r[n++]=l>>>9&31,r[n++]=l>>>14&31,r[n++]=l>>>19&31,r[n++]=l>>>24&31,r[n++]=(l>>>29|(u&3)<<3)&31,r[n++]=u>>>2&31,r[n++]=u>>>7&31,r[n++]=u>>>12&31,r[n++]=u>>>17&31,r[n++]=u>>>22&31,r[n]=u>>>27&31}function c2(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0;r[n++]=a>>>0&63,r[n++]=a>>>6&63,r[n++]=a>>>12&63,r[n++]=a>>>18&63,r[n++]=a>>>24&63,r[n++]=(a>>>30|(s&15)<<2)&63,r[n++]=s>>>4&63,r[n++]=s>>>10&63,r[n++]=s>>>16&63,r[n++]=s>>>22&63,r[n++]=(s>>>28|(o&3)<<4)&63,r[n++]=o>>>2&63,r[n++]=o>>>8&63,r[n++]=o>>>14&63,r[n++]=o>>>20&63,r[n++]=o>>>26&63,r[n++]=l>>>0&63,r[n++]=l>>>6&63,r[n++]=l>>>12&63,r[n++]=l>>>18&63,r[n++]=l>>>24&63,r[n++]=(l>>>30|(u&15)<<2)&63,r[n++]=u>>>4&63,r[n++]=u>>>10&63,r[n++]=u>>>16&63,r[n++]=u>>>22&63,r[n++]=(u>>>28|(h&3)<<4)&63,r[n++]=h>>>2&63,r[n++]=h>>>8&63,r[n++]=h>>>14&63,r[n++]=h>>>20&63,r[n]=h>>>26&63}function p2(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0,c=t[e+6]>>>0;r[n++]=a>>>0&127,r[n++]=a>>>7&127,r[n++]=a>>>14&127,r[n++]=a>>>21&127,r[n++]=(a>>>28|(s&7)<<4)&127,r[n++]=s>>>3&127,r[n++]=s>>>10&127,r[n++]=s>>>17&127,r[n++]=s>>>24&127,r[n++]=(s>>>31|(o&63)<<1)&127,r[n++]=o>>>6&127,r[n++]=o>>>13&127,r[n++]=o>>>20&127,r[n++]=(o>>>27|(l&3)<<5)&127,r[n++]=l>>>2&127,r[n++]=l>>>9&127,r[n++]=l>>>16&127,r[n++]=l>>>23&127,r[n++]=(l>>>30|(u&31)<<2)&127,r[n++]=u>>>5&127,r[n++]=u>>>12&127,r[n++]=u>>>19&127,r[n++]=(u>>>26|(h&1)<<6)&127,r[n++]=h>>>1&127,r[n++]=h>>>8&127,r[n++]=h>>>15&127,r[n++]=h>>>22&127,r[n++]=(h>>>29|(c&15)<<3)&127,r[n++]=c>>>4&127,r[n++]=c>>>11&127,r[n++]=c>>>18&127,r[n]=c>>>25&127}function f2(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0,c=t[e+6]>>>0,p=t[e+7]>>>0;r[n++]=a>>>0&255,r[n++]=a>>>8&255,r[n++]=a>>>16&255,r[n++]=a>>>24&255,r[n++]=s>>>0&255,r[n++]=s>>>8&255,r[n++]=s>>>16&255,r[n++]=s>>>24&255,r[n++]=o>>>0&255,r[n++]=o>>>8&255,r[n++]=o>>>16&255,r[n++]=o>>>24&255,r[n++]=l>>>0&255,r[n++]=l>>>8&255,r[n++]=l>>>16&255,r[n++]=l>>>24&255,r[n++]=u>>>0&255,r[n++]=u>>>8&255,r[n++]=u>>>16&255,r[n++]=u>>>24&255,r[n++]=h>>>0&255,r[n++]=h>>>8&255,r[n++]=h>>>16&255,r[n++]=h>>>24&255,r[n++]=c>>>0&255,r[n++]=c>>>8&255,r[n++]=c>>>16&255,r[n++]=c>>>24&255,r[n++]=p>>>0&255,r[n++]=p>>>8&255,r[n++]=p>>>16&255,r[n]=p>>>24&255}function d2(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0,c=t[e+6]>>>0,p=t[e+7]>>>0,f=t[e+8]>>>0;r[n++]=a>>>0&511,r[n++]=a>>>9&511,r[n++]=a>>>18&511,r[n++]=(a>>>27|(s&15)<<5)&511,r[n++]=s>>>4&511,r[n++]=s>>>13&511,r[n++]=s>>>22&511,r[n++]=(s>>>31|(o&255)<<1)&511,r[n++]=o>>>8&511,r[n++]=o>>>17&511,r[n++]=(o>>>26|(l&7)<<6)&511,r[n++]=l>>>3&511,r[n++]=l>>>12&511,r[n++]=l>>>21&511,r[n++]=(l>>>30|(u&127)<<2)&511,r[n++]=u>>>7&511,r[n++]=u>>>16&511,r[n++]=(u>>>25|(h&3)<<7)&511,r[n++]=h>>>2&511,r[n++]=h>>>11&511,r[n++]=h>>>20&511,r[n++]=(h>>>29|(c&63)<<3)&511,r[n++]=c>>>6&511,r[n++]=c>>>15&511,r[n++]=(c>>>24|(p&1)<<8)&511,r[n++]=p>>>1&511,r[n++]=p>>>10&511,r[n++]=p>>>19&511,r[n++]=(p>>>28|(f&31)<<4)&511,r[n++]=f>>>5&511,r[n++]=f>>>14&511,r[n]=f>>>23&511}function y2(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0,c=t[e+6]>>>0,p=t[e+7]>>>0,f=t[e+8]>>>0,d=t[e+9]>>>0;r[n++]=a>>>0&1023,r[n++]=a>>>10&1023,r[n++]=a>>>20&1023,r[n++]=(a>>>30|(s&255)<<2)&1023,r[n++]=s>>>8&1023,r[n++]=s>>>18&1023,r[n++]=(s>>>28|(o&63)<<4)&1023,r[n++]=o>>>6&1023,r[n++]=o>>>16&1023,r[n++]=(o>>>26|(l&15)<<6)&1023,r[n++]=l>>>4&1023,r[n++]=l>>>14&1023,r[n++]=(l>>>24|(u&3)<<8)&1023,r[n++]=u>>>2&1023,r[n++]=u>>>12&1023,r[n++]=u>>>22&1023,r[n++]=h>>>0&1023,r[n++]=h>>>10&1023,r[n++]=h>>>20&1023,r[n++]=(h>>>30|(c&255)<<2)&1023,r[n++]=c>>>8&1023,r[n++]=c>>>18&1023,r[n++]=(c>>>28|(p&63)<<4)&1023,r[n++]=p>>>6&1023,r[n++]=p>>>16&1023,r[n++]=(p>>>26|(f&15)<<6)&1023,r[n++]=f>>>4&1023,r[n++]=f>>>14&1023,r[n++]=(f>>>24|(d&3)<<8)&1023,r[n++]=d>>>2&1023,r[n++]=d>>>12&1023,r[n]=d>>>22&1023}function m2(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0,c=t[e+6]>>>0,p=t[e+7]>>>0,f=t[e+8]>>>0,d=t[e+9]>>>0,y=t[e+10]>>>0;r[n++]=a>>>0&2047,r[n++]=a>>>11&2047,r[n++]=(a>>>22|(s&1)<<10)&2047,r[n++]=s>>>1&2047,r[n++]=s>>>12&2047,r[n++]=(s>>>23|(o&3)<<9)&2047,r[n++]=o>>>2&2047,r[n++]=o>>>13&2047,r[n++]=(o>>>24|(l&7)<<8)&2047,r[n++]=l>>>3&2047,r[n++]=l>>>14&2047,r[n++]=(l>>>25|(u&15)<<7)&2047,r[n++]=u>>>4&2047,r[n++]=u>>>15&2047,r[n++]=(u>>>26|(h&31)<<6)&2047,r[n++]=h>>>5&2047,r[n++]=h>>>16&2047,r[n++]=(h>>>27|(c&63)<<5)&2047,r[n++]=c>>>6&2047,r[n++]=c>>>17&2047,r[n++]=(c>>>28|(p&127)<<4)&2047,r[n++]=p>>>7&2047,r[n++]=p>>>18&2047,r[n++]=(p>>>29|(f&255)<<3)&2047,r[n++]=f>>>8&2047,r[n++]=f>>>19&2047,r[n++]=(f>>>30|(d&511)<<2)&2047,r[n++]=d>>>9&2047,r[n++]=d>>>20&2047,r[n++]=(d>>>31|(y&1023)<<1)&2047,r[n++]=y>>>10&2047,r[n]=y>>>21&2047}function g2(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0,c=t[e+6]>>>0,p=t[e+7]>>>0,f=t[e+8]>>>0,d=t[e+9]>>>0,y=t[e+10]>>>0,m=t[e+11]>>>0;r[n++]=a>>>0&4095,r[n++]=a>>>12&4095,r[n++]=(a>>>24|(s&15)<<8)&4095,r[n++]=s>>>4&4095,r[n++]=s>>>16&4095,r[n++]=(s>>>28|(o&255)<<4)&4095,r[n++]=o>>>8&4095,r[n++]=o>>>20&4095,r[n++]=l>>>0&4095,r[n++]=l>>>12&4095,r[n++]=(l>>>24|(u&15)<<8)&4095,r[n++]=u>>>4&4095,r[n++]=u>>>16&4095,r[n++]=(u>>>28|(h&255)<<4)&4095,r[n++]=h>>>8&4095,r[n++]=h>>>20&4095,r[n++]=c>>>0&4095,r[n++]=c>>>12&4095,r[n++]=(c>>>24|(p&15)<<8)&4095,r[n++]=p>>>4&4095,r[n++]=p>>>16&4095,r[n++]=(p>>>28|(f&255)<<4)&4095,r[n++]=f>>>8&4095,r[n++]=f>>>20&4095,r[n++]=d>>>0&4095,r[n++]=d>>>12&4095,r[n++]=(d>>>24|(y&15)<<8)&4095,r[n++]=y>>>4&4095,r[n++]=y>>>16&4095,r[n++]=(y>>>28|(m&255)<<4)&4095,r[n++]=m>>>8&4095,r[n]=m>>>20&4095}function x2(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0,c=t[e+6]>>>0,p=t[e+7]>>>0,f=t[e+8]>>>0,d=t[e+9]>>>0,y=t[e+10]>>>0,m=t[e+11]>>>0,g=t[e+12]>>>0,x=t[e+13]>>>0,b=t[e+14]>>>0,v=t[e+15]>>>0;r[n++]=a>>>0&65535,r[n++]=a>>>16&65535,r[n++]=s>>>0&65535,r[n++]=s>>>16&65535,r[n++]=o>>>0&65535,r[n++]=o>>>16&65535,r[n++]=l>>>0&65535,r[n++]=l>>>16&65535,r[n++]=u>>>0&65535,r[n++]=u>>>16&65535,r[n++]=h>>>0&65535,r[n++]=h>>>16&65535,r[n++]=c>>>0&65535,r[n++]=c>>>16&65535,r[n++]=p>>>0&65535,r[n++]=p>>>16&65535,r[n++]=f>>>0&65535,r[n++]=f>>>16&65535,r[n++]=d>>>0&65535,r[n++]=d>>>16&65535,r[n++]=y>>>0&65535,r[n++]=y>>>16&65535,r[n++]=m>>>0&65535,r[n++]=m>>>16&65535,r[n++]=g>>>0&65535,r[n++]=g>>>16&65535,r[n++]=x>>>0&65535,r[n++]=x>>>16&65535,r[n++]=b>>>0&65535,r[n++]=b>>>16&65535,r[n++]=v>>>0&65535,r[n]=v>>>16&65535}function v2(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0;r[n++]=o>>>0&1,r[n++]=o>>>1&1,r[n++]=o>>>2&1,r[n++]=o>>>3&1,r[n++]=o>>>4&1,r[n++]=o>>>5&1,r[n++]=o>>>6&1,r[n++]=o>>>7&1,r[n++]=o>>>8&1,r[n++]=o>>>9&1,r[n++]=o>>>10&1,r[n++]=o>>>11&1,r[n++]=o>>>12&1,r[n++]=o>>>13&1,r[n++]=o>>>14&1,r[n++]=o>>>15&1,r[n++]=o>>>16&1,r[n++]=o>>>17&1,r[n++]=o>>>18&1,r[n++]=o>>>19&1,r[n++]=o>>>20&1,r[n++]=o>>>21&1,r[n++]=o>>>22&1,r[n++]=o>>>23&1,r[n++]=o>>>24&1,r[n++]=o>>>25&1,r[n++]=o>>>26&1,r[n++]=o>>>27&1,r[n++]=o>>>28&1,r[n++]=o>>>29&1,r[n++]=o>>>30&1,r[n++]=o>>>31&1}}function b2(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0,l=t[a++]>>>0;r[n++]=o>>>0&3,r[n++]=o>>>2&3,r[n++]=o>>>4&3,r[n++]=o>>>6&3,r[n++]=o>>>8&3,r[n++]=o>>>10&3,r[n++]=o>>>12&3,r[n++]=o>>>14&3,r[n++]=o>>>16&3,r[n++]=o>>>18&3,r[n++]=o>>>20&3,r[n++]=o>>>22&3,r[n++]=o>>>24&3,r[n++]=o>>>26&3,r[n++]=o>>>28&3,r[n++]=o>>>30&3,r[n++]=l>>>0&3,r[n++]=l>>>2&3,r[n++]=l>>>4&3,r[n++]=l>>>6&3,r[n++]=l>>>8&3,r[n++]=l>>>10&3,r[n++]=l>>>12&3,r[n++]=l>>>14&3,r[n++]=l>>>16&3,r[n++]=l>>>18&3,r[n++]=l>>>20&3,r[n++]=l>>>22&3,r[n++]=l>>>24&3,r[n++]=l>>>26&3,r[n++]=l>>>28&3,r[n++]=l>>>30&3}}function w2(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0,l=t[a++]>>>0,u=t[a++]>>>0;r[n++]=o>>>0&7,r[n++]=o>>>3&7,r[n++]=o>>>6&7,r[n++]=o>>>9&7,r[n++]=o>>>12&7,r[n++]=o>>>15&7,r[n++]=o>>>18&7,r[n++]=o>>>21&7,r[n++]=o>>>24&7,r[n++]=o>>>27&7,r[n++]=(o>>>30|(l&1)<<2)&7,r[n++]=l>>>1&7,r[n++]=l>>>4&7,r[n++]=l>>>7&7,r[n++]=l>>>10&7,r[n++]=l>>>13&7,r[n++]=l>>>16&7,r[n++]=l>>>19&7,r[n++]=l>>>22&7,r[n++]=l>>>25&7,r[n++]=l>>>28&7,r[n++]=(l>>>31|(u&3)<<1)&7,r[n++]=u>>>2&7,r[n++]=u>>>5&7,r[n++]=u>>>8&7,r[n++]=u>>>11&7,r[n++]=u>>>14&7,r[n++]=u>>>17&7,r[n++]=u>>>20&7,r[n++]=u>>>23&7,r[n++]=u>>>26&7,r[n++]=u>>>29&7}}function _2(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0,l=t[a++]>>>0,u=t[a++]>>>0,h=t[a++]>>>0;r[n++]=o>>>0&15,r[n++]=o>>>4&15,r[n++]=o>>>8&15,r[n++]=o>>>12&15,r[n++]=o>>>16&15,r[n++]=o>>>20&15,r[n++]=o>>>24&15,r[n++]=o>>>28&15,r[n++]=l>>>0&15,r[n++]=l>>>4&15,r[n++]=l>>>8&15,r[n++]=l>>>12&15,r[n++]=l>>>16&15,r[n++]=l>>>20&15,r[n++]=l>>>24&15,r[n++]=l>>>28&15,r[n++]=u>>>0&15,r[n++]=u>>>4&15,r[n++]=u>>>8&15,r[n++]=u>>>12&15,r[n++]=u>>>16&15,r[n++]=u>>>20&15,r[n++]=u>>>24&15,r[n++]=u>>>28&15,r[n++]=h>>>0&15,r[n++]=h>>>4&15,r[n++]=h>>>8&15,r[n++]=h>>>12&15,r[n++]=h>>>16&15,r[n++]=h>>>20&15,r[n++]=h>>>24&15,r[n++]=h>>>28&15}}function S2(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0,l=t[a++]>>>0,u=t[a++]>>>0,h=t[a++]>>>0,c=t[a++]>>>0;r[n++]=o>>>0&31,r[n++]=o>>>5&31,r[n++]=o>>>10&31,r[n++]=o>>>15&31,r[n++]=o>>>20&31,r[n++]=o>>>25&31,r[n++]=(o>>>30|(l&7)<<2)&31,r[n++]=l>>>3&31,r[n++]=l>>>8&31,r[n++]=l>>>13&31,r[n++]=l>>>18&31,r[n++]=l>>>23&31,r[n++]=(l>>>28|(u&1)<<4)&31,r[n++]=u>>>1&31,r[n++]=u>>>6&31,r[n++]=u>>>11&31,r[n++]=u>>>16&31,r[n++]=u>>>21&31,r[n++]=u>>>26&31,r[n++]=(u>>>31|(h&15)<<1)&31,r[n++]=h>>>4&31,r[n++]=h>>>9&31,r[n++]=h>>>14&31,r[n++]=h>>>19&31,r[n++]=h>>>24&31,r[n++]=(h>>>29|(c&3)<<3)&31,r[n++]=c>>>2&31,r[n++]=c>>>7&31,r[n++]=c>>>12&31,r[n++]=c>>>17&31,r[n++]=c>>>22&31,r[n++]=c>>>27&31}}function A2(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0,l=t[a++]>>>0,u=t[a++]>>>0,h=t[a++]>>>0,c=t[a++]>>>0,p=t[a++]>>>0;r[n++]=o>>>0&63,r[n++]=o>>>6&63,r[n++]=o>>>12&63,r[n++]=o>>>18&63,r[n++]=o>>>24&63,r[n++]=(o>>>30|(l&15)<<2)&63,r[n++]=l>>>4&63,r[n++]=l>>>10&63,r[n++]=l>>>16&63,r[n++]=l>>>22&63,r[n++]=(l>>>28|(u&3)<<4)&63,r[n++]=u>>>2&63,r[n++]=u>>>8&63,r[n++]=u>>>14&63,r[n++]=u>>>20&63,r[n++]=u>>>26&63,r[n++]=h>>>0&63,r[n++]=h>>>6&63,r[n++]=h>>>12&63,r[n++]=h>>>18&63,r[n++]=h>>>24&63,r[n++]=(h>>>30|(c&15)<<2)&63,r[n++]=c>>>4&63,r[n++]=c>>>10&63,r[n++]=c>>>16&63,r[n++]=c>>>22&63,r[n++]=(c>>>28|(p&3)<<4)&63,r[n++]=p>>>2&63,r[n++]=p>>>8&63,r[n++]=p>>>14&63,r[n++]=p>>>20&63,r[n++]=p>>>26&63}}function D2(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0,l=t[a++]>>>0,u=t[a++]>>>0,h=t[a++]>>>0,c=t[a++]>>>0,p=t[a++]>>>0,f=t[a++]>>>0;r[n++]=o>>>0&127,r[n++]=o>>>7&127,r[n++]=o>>>14&127,r[n++]=o>>>21&127,r[n++]=(o>>>28|(l&7)<<4)&127,r[n++]=l>>>3&127,r[n++]=l>>>10&127,r[n++]=l>>>17&127,r[n++]=l>>>24&127,r[n++]=(l>>>31|(u&63)<<1)&127,r[n++]=u>>>6&127,r[n++]=u>>>13&127,r[n++]=u>>>20&127,r[n++]=(u>>>27|(h&3)<<5)&127,r[n++]=h>>>2&127,r[n++]=h>>>9&127,r[n++]=h>>>16&127,r[n++]=h>>>23&127,r[n++]=(h>>>30|(c&31)<<2)&127,r[n++]=c>>>5&127,r[n++]=c>>>12&127,r[n++]=c>>>19&127,r[n++]=(c>>>26|(p&1)<<6)&127,r[n++]=p>>>1&127,r[n++]=p>>>8&127,r[n++]=p>>>15&127,r[n++]=p>>>22&127,r[n++]=(p>>>29|(f&15)<<3)&127,r[n++]=f>>>4&127,r[n++]=f>>>11&127,r[n++]=f>>>18&127,r[n++]=f>>>25&127}}function E2(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0,l=t[a++]>>>0,u=t[a++]>>>0,h=t[a++]>>>0,c=t[a++]>>>0,p=t[a++]>>>0,f=t[a++]>>>0,d=t[a++]>>>0;r[n++]=o>>>0&255,r[n++]=o>>>8&255,r[n++]=o>>>16&255,r[n++]=o>>>24&255,r[n++]=l>>>0&255,r[n++]=l>>>8&255,r[n++]=l>>>16&255,r[n++]=l>>>24&255,r[n++]=u>>>0&255,r[n++]=u>>>8&255,r[n++]=u>>>16&255,r[n++]=u>>>24&255,r[n++]=h>>>0&255,r[n++]=h>>>8&255,r[n++]=h>>>16&255,r[n++]=h>>>24&255,r[n++]=c>>>0&255,r[n++]=c>>>8&255,r[n++]=c>>>16&255,r[n++]=c>>>24&255,r[n++]=p>>>0&255,r[n++]=p>>>8&255,r[n++]=p>>>16&255,r[n++]=p>>>24&255,r[n++]=f>>>0&255,r[n++]=f>>>8&255,r[n++]=f>>>16&255,r[n++]=f>>>24&255,r[n++]=d>>>0&255,r[n++]=d>>>8&255,r[n++]=d>>>16&255,r[n++]=d>>>24&255}}function T2(t,e,r,i){let n=i,a=e;for(let s=0;s<128;s++){let o=t[a++]>>>0;r[n++]=o&65535,r[n++]=o>>>16&65535}}function F2(t,e,r,i,n){let a=Es[n]>>>0,s=e,o=0,l=t[s]>>>0,u=i;for(let h=0;h<8;h++){for(let c=0;c<32;c++)if(o+n<=32){let p=l>>>o&a;r[u+c]=p|0,o+=n,o===32&&(o=0,s++,c!==31&&(l=t[s]>>>0))}else{let p=32-o,f=l>>>o;s++,l=t[s]>>>0;let d=n-p,y=-1>>>32-d>>>0,m=(f|(l&y)<<p)&a;r[u+c]=m|0,o=d}u+=32,o=0,h<7&&(l=t[s]>>>0)}}var Ts=a2(Np),k2=3*Ts/256+Ts|0;function Up(){let t=new Uint8Array(k2);return{dataToBePacked:Array(33),dataPointers:new Int32Array(33),byteContainer:t,byteContainerI32:new Int32Array(t.buffer,t.byteOffset,t.byteLength>>>2),exceptionSizes:new Int32Array(33)}}function I2(t=16){if(t<0)throw RangeError(`initialEncodedWordCapacity must be >= 0, got ${t}`);let e=Math.max(16,t|0);return{encodedWords:new Uint32Array(e),decoderWorkspace:Up()}}function M2(t,e){if(e<=t.encodedWords.length)return t.encodedWords;let r=new Uint32Array(Math.max(16,e*2));return t.encodedWords=r,r}function C2(t,e,r,i){i.byteContainer.length<r&&(i.byteContainer=new Uint8Array(r*2),i.byteContainerI32=void 0);let n=i.byteContainer,a=r>>>2;if(n.byteOffset&3)for(let o=0;o<a;o=o+1|0){let l=t[e+o|0]|0,u=o<<2;n[u]=l&255,n[u+1|0]=l>>>8&255,n[u+2|0]=l>>>16&255,n[u+3|0]=l>>>24&255}else{let o=i.byteContainerI32;(!o||o.buffer!==n.buffer||o.byteOffset!==n.byteOffset||o.length<a)&&(o=i.byteContainerI32=new Int32Array(n.buffer,n.byteOffset,n.byteLength>>>2)),o.set(t.subarray(e,e+a))}let s=r&3;if(s>0){let o=t[e+a|0]|0,l=a<<2;for(let u=0;u<s;u=u+1|0)n[l+u|0]=o>>>(u<<3)&255}return n}function B2(t,e,r){let i=t[e++]|0,n=r.dataToBePacked;for(let a=2;a<=32;a=a+1|0){if(!(i>>>a-1&1))continue;if(e>=t.length)throw Error(`FastPFOR decode: truncated exception stream header (bitWidth=${a}, streamWordIndex=${e}, needWords=1, availableWords=${t.length-e}, encodedWords=${t.length})`);let s=t[e++]>>>0,o=n2(s),l=s*a+31>>>5;if(e+l>t.length)throw Error(`FastPFOR decode: truncated exception stream (bitWidth=${a}, size=${s}, streamWordIndex=${e}, needWords=${l}, availableWords=${t.length-e}, encodedWords=${t.length})`);let u=n[a];(!u||u.length<o)&&(u=n[a]=new Uint32Array(o));let h=0;for(;h<s;h=h+32|0)q2(t,e,u,h,a),e=e+a|0;let c=h-s|0;e=e-(c*a>>>5)|0,r.exceptionSizes[a]=s}return e}function P2(t,e,r,i,n){switch(n){case 1:v2(t,e,r,i);break;case 2:b2(t,e,r,i);break;case 3:w2(t,e,r,i);break;case 4:_2(t,e,r,i);break;case 5:S2(t,e,r,i);break;case 6:A2(t,e,r,i);break;case 7:D2(t,e,r,i);break;case 8:E2(t,e,r,i);break;case 16:T2(t,e,r,i);break;default:F2(t,e,r,i,n)}return e+(n<<3)|0}function z2(t,e,r,i){if(r+2>e)throw Error(`FastPFOR decode: byteContainer underflow at block=${i} (need 2 bytes for [bitWidth, exceptionCount], bytePos=${r}, byteSize=${e})`);let n=t[r++],a=t[r++];if(n>32)throw Error(`FastPFOR decode: invalid bitWidth=${n} at block=${i} (expected 0..32). This likely indicates corrupted or truncated input.`);return{bitWidth:n,exceptionCount:a,bytePosIn:r}}function L2(t,e,r,i,n,a){if(r+1>e)throw Error(`FastPFOR decode: exception header underflow at block=${a} (need 1 byte for maxBits, bytePos=${r}, byteSize=${e})`);let s=t[r++];if(s<i||s>32)throw Error(`FastPFOR decode: invalid maxBits=${s} at block=${a} (bitWidth=${i}, expected ${i}..32)`);let o=s-i|0;if(o<1||o>32)throw Error(`FastPFOR decode: invalid exceptionBitWidth=${o} at block=${a} (bitWidth=${i}, maxBits=${s})`);if(r+n>e)throw Error(`FastPFOR decode: exception positions underflow at block=${a} (need=${n}, have=${e-r})`);return{maxBits:s,exceptionBitWidth:o,bytePosIn:r}}function V2(t,e,r,i,n,a,s,o,l){let{maxBits:u,exceptionBitWidth:h,bytePosIn:c}=L2(n,a,s,r,i,l);if(s=c,h===1){let m=1<<r;for(let g=0;g<i;g=g+1|0){let x=n[s++];t[x+e|0]|=m}return s}let p=o.dataToBePacked[h];if(!p)throw Error(`FastPFOR decode: missing exception stream for exceptionBitWidth=${h} (bitWidth=${r}, maxBits=${u}) at block ${l}`);let f=o.dataPointers,d=f[h]|0,y=o.exceptionSizes[h]|0;if(d+i>y)throw Error(`FastPFOR decode: exception stream overflow for exceptionBitWidth=${h} (ptr=${d}, need ${i}, size=${y}) at block ${l}`);for(let m=0;m<i;m=m+1|0){let g=n[s++],x=p[d++]|0;t[g+e|0]|=x<<r}return f[h]=d,s}function O2(t,e,r,i,n,a,s,o,l,u){let h=r|0,c=0;for(let p=0;p<s;p=p+1|0){let f=z2(o,l,c,p);c=f.bytePosIn;let d=f.bitWidth,y=f.exceptionCount,m=a+p*256|0;switch(d){case 0:n.fill(0,m,m+256);break;case 32:for(let g=0;g<256;g=g+1|0)n[m+g|0]=t[h+g|0]|0;h=h+256|0;break;default:h=P2(t,h,n,m,d)}y>0&&(c=V2(n,m,d,y,o,l,c,u,p))}if(h!==i)throw Error(`FastPFOR decode: packed region mismatch (pageStart=${e}, packedStart=${r}, consumedPackedEnd=${h}, expectedPackedEnd=${i}, packedWords=${i-r}, encoded.length=${t.length})`)}function R2(t,e,r,i,n,a){let s=r|0,o=t[s]|0;if(o<=0||s+o>t.length-1)throw Error(`FastPFOR decode: invalid whereMeta=${o} at pageStart=${s} (expected > 0 and pageStart+whereMeta < encoded.length=${t.length})`);let l=s+1|0,u=s+o|0,h=t[u]>>>0,c=h+3>>>2,p=u+1,f=p+c;if(f>=t.length)throw Error(`FastPFOR decode: invalid byteSize=${h} (metaInts=${c}, pageStart=${s}, packedEnd=${u}, byteContainerStart=${p}) causes bitmapPos=${f} out of bounds (encoded.length=${t.length})`);let d=C2(t,p,h,a),y=h,m=B2(t,f,a);return a.dataPointers.fill(0),O2(t,s,l,u,e,i|0,n/256|0,d,y,a),m}function $2(t,e,r,i,n,a){let s=i+Bo(n,256),o=i,l=r;for(;o!==s;){let u=Math.min(Ts,s-o);l=R2(t,e,l,o,u,a),o=o+u|0}return l}function N2(t,e,r,i,n,a){if(a===0)return e;let s=0,o=e,l=e+r,u=n,h=n,c=n+a,p=0,f=0;for(;o<l&&h<c;){let d=t[o]>>>s&255;if(s+=8,o+=s>>>5,s&=31,p|=(d&127)<<f,d&128)i[h++]=p|0,p=0,f=0;else if(f+=7,f>28)throw Error(`FastPFOR VByte: unterminated value (expected MSB=1 terminator within 5 bytes; shift=${f}, partial=${p}, decoded=${h-u}/${a}, inPos=${o}, inEnd=${l})`)}if(h!==c)throw Error(`FastPFOR VByte: truncated stream (decoded=${h-u}, expected=${a}, consumedWords=${o-e}/${r}, vbyteStart=${e}, vbyteEnd=${l})`);return o}function U2(t,e,r){let i=0,n=0,a=new Uint32Array(e),s=r??Up();if(t.length>0){let u=t[i]|0;if(i=i+1|0,u&255)throw Error(`FastPFOR decode: invalid alignedLength=${u} (expected multiple of 256)`);if(n+u>a.length)throw Error(`FastPFOR decode: output buffer too small (outPos=${n}, alignedLength=${u}, out.length=${a.length})`);i=$2(t,a,i,n,u,s),n=n+u|0}let o=t.length-i|0,l=e-n|0;return N2(t,i,o,a,n,l),a}function q2(t,e,r,i,n){switch(n){case 2:o2(t,e,r,i);return;case 3:l2(t,e,r,i);return;case 4:u2(t,e,r,i);return;case 5:h2(t,e,r,i);return;case 6:c2(t,e,r,i);return;case 7:p2(t,e,r,i);return;case 8:f2(t,e,r,i);return;case 9:d2(t,e,r,i);return;case 10:y2(t,e,r,i);return;case 11:m2(t,e,r,i);return;case 12:g2(t,e,r,i);return;case 16:x2(t,e,r,i);return;case 32:for(let u=0;u<32;u=u+1|0)r[i+u|0]=t[e+u|0]|0;return}let a=Es[n]>>>0,s=e,o=0,l=t[s]>>>0;for(let u=0;u<32;u++)if(o+n<=32){let h=l>>>o&a;r[i+u]=h|0,o+=n,o===32&&(o=0,s++,u!==31&&(l=t[s]>>>0))}else{let h=32-o,c=l>>>o;s++,l=t[s]>>>0;let p=Es[n-h]>>>0,f=(c|(l&p)<<h)&a;r[i+u]=f|0,o=n-h}}function G2(t,e,r,i){if(e<0||r<0||e+r>t.length)throw RangeError(`decodeBigEndianInt32sInto: out of bounds (offset=${e}, byteLength=${r}, bytes.length=${t.length})`);let n=Math.floor(r/4),a=r%4!=0,s=a?n+1:n;if(i.length<s)throw RangeError(`decodeBigEndianInt32sInto: out.length=${i.length} < ${s}`);if(n>0){let o=t.byteOffset+e;if(o&3)for(let l=0;l<n;l++){let u=e+l*4;i[l]=t[u]<<24|t[u+1]<<16|t[u+2]<<8|t[u+3]|0}else{let l=new Uint32Array(t.buffer,o,n);for(let u=0;u<n;u++)i[u]=s2(l[u])|0}}if(a){let o=e+n*4,l=r-n*4,u=0;for(let h=0;h<l;h++)u|=t[o+h]<<24-h*8;i[n]=u|0}return s}function _t(t,e,r){let i=new Uint32Array(r),n=0,a=e.get();for(let s=0;s<i.length;s++){let o=t[a++],l=o&127;if(o<128){i[n++]=l;continue}if(o=t[a++],l|=(o&127)<<7,o<128){i[n++]=l;continue}if(o=t[a++],l|=(o&127)<<14,o<128){i[n++]=l;continue}if(o=t[a++],l|=(o&127)<<21,o<128){i[n++]=l;continue}o=t[a++],l|=(o&15)<<28,i[n++]=l}return e.set(a),i}function Po(t,e,r){let i=new BigUint64Array(r);for(let n=0;n<i.length;n++)i[n]=j2(t,e);return i}function j2(t,e){let r=0n,i=0,n=e.get();for(;n<t.length;){let a=t[n++];if(r|=BigInt(a&127)<<BigInt(i),!(a&128))break;if(i+=7,i>=64)throw Error("Varint too long")}return e.set(n),r}function Y2(t,e,r){let i=new Float64Array(r);for(let n=0;n<r;n++)i[n]=X2(t,e);return i}function X2(t,e){let r,i;return i=t[e.get()],e.increment(),r=i&127,i<128||(i=t[e.get()],e.increment(),r|=(i&127)<<7,i<128)||(i=t[e.get()],e.increment(),r|=(i&127)<<14,i<128)||(i=t[e.get()],e.increment(),r|=(i&127)<<21,i<128)?r:(i=t[e.get()],r|=(i&15)<<28,Z2(r,t,e))}function Z2(t,e,r){let i,n;if(n=e[r.get()],r.increment(),i=(n&112)>>4,n<128||(n=e[r.get()],r.increment(),i|=(n&127)<<3,n<128)||(n=e[r.get()],r.increment(),i|=(n&127)<<10,n<128)||(n=e[r.get()],r.increment(),i|=(n&127)<<17,n<128)||(n=e[r.get()],r.increment(),i|=(n&127)<<24,n<128)||(n=e[r.get()],r.increment(),i|=(n&1)<<31,n<128))return i*4294967296+(t>>>0);throw Error("Expected varint not more than 10 bytes")}function W2(t,e,r,i){return H2(t,e,r,i,I2(r>>>2))}function H2(t,e,r,i,n){let a=i.get();if(r&3)throw Error(`FastPFOR: invalid encodedByteLength=${r} at offset=${a} (encodedBytes.length=${t.length}; expected a multiple of 4 bytes for an int32 big-endian word stream)`);let s=r>>>2,o=M2(n,s);G2(t,a,r,o);let l=U2(o.subarray(0,s),e,n.decoderWorkspace);return i.add(r),l}function X(t){return t>>>1^-(t&1)}function bt(t){return t>>1n^-(t&1n)}function pe(t){return t%2==1?(t+1)/-2:t/2}function K2(t){let e=new Int32Array(t.length);for(let r=0;r<t.length;r++)e[r]=X(t[r]);return e}function J2(t){let e=new BigInt64Array(t.length);for(let r=0;r<t.length;r++)e[r]=bt(t[r]);return e}function Q2(t){for(let e=0;e<t.length;e++)t[e]=pe(t[e])}function Fs(t,e,r){if(r===void 0){r=0;for(let a=0;a<e;a++)r+=t[a]}let i=new Uint32Array(r),n=0;for(let a=0;a<e;a++){let s=t[a],o=t[a+e];i.fill(o,n,n+s),n+=s}return i}function ks(t,e,r){if(r===void 0){r=0;for(let a=0;a<e;a++)r+=Number(t[a])}let i=new BigUint64Array(r),n=0;for(let a=0;a<e;a++){let s=Number(t[a]),o=t[a+e];i.fill(o,n,n+s),n+=s}return i}function qp(t,e,r){let i=new Float64Array(r),n=0;for(let a=0;a<e;a++){let s=t[a],o=t[a+e];i.fill(o,n,n+s),n+=s}return i}function Tu(t){let e=new Int32Array(t.length);e[0]=X(t[0]);let r=t.length/4*4,i=1;if(r>=4)for(;i<r-4;i+=4){let n=t[i],a=t[i+1],s=t[i+2],o=t[i+3];e[i]=X(n)+e[i-1],e[i+1]=X(a)+e[i],e[i+2]=X(s)+e[i+1],e[i+3]=X(o)+e[i+2]}for(;i!==t.length;++i)e[i]=X(t[i])+e[i-1];return e}function Fu(t){let e=new BigInt64Array(t.length);e[0]=bt(t[0]);let r=t.length/4*4,i=1;if(r>=4)for(;i<r-4;i+=4){let n=t[i],a=t[i+1],s=t[i+2],o=t[i+3];e[i]=bt(n)+e[i-1],e[i+1]=bt(a)+e[i],e[i+2]=bt(s)+e[i+1],e[i+3]=bt(o)+e[i+2]}for(;i!==e.length;++i)e[i]=bt(t[i])+e[i-1];return e}function tv(t){t[0]=pe(t[0]);let e=t.length/4*4,r=1;if(e>=4)for(;r<e-4;r+=4){let i=t[r],n=t[r+1],a=t[r+2],s=t[r+3];t[r]=pe(i)+t[r-1],t[r+1]=pe(n)+t[r],t[r+2]=pe(a)+t[r+1],t[r+3]=pe(s)+t[r+2]}for(;r!==t.length;++r)t[r]=pe(t[r])+t[r-1]}function ev(t,e,r){if(r===void 0){r=0;for(let a=0;a<e;a++)r+=t[a]}let i=new Int32Array(r),n=0;for(let a=0;a<e;a++){let s=t[a],o=t[a+e];o=X(o),i.fill(o,n,n+s),n+=s}return i}function rv(t,e,r){if(r===void 0){r=0;for(let a=0;a<e;a++)r+=Number(t[a])}let i=new BigInt64Array(r),n=0;for(let a=0;a<e;a++){let s=Number(t[a]),o=t[a+e];o=bt(o),i.fill(o,n,n+s),n+=s}return i}function iv(t,e,r){let i=new Float64Array(r),n=0;for(let a=0;a<e;a++){let s=t[a],o=t[a+e];o=pe(o),i.fill(o,n,n+s),n+=s}return i}function zo(t){let e=t.length/4*4,r=1;if(e>=4)for(let i=t[0];r<e-4;r+=4)i=t[r]+=i,i=t[r+1]+=i,i=t[r+2]+=i,i=t[r+3]+=i;for(;r!==t.length;)t[r]+=t[r-1],++r}function nv(t){let e=0;for(let r=0;r<t.length;r++)t[r]+=e,e=t[r]}function av(t){if(t.length<2)return new Int32Array(t);let e=new Int32Array(t.length);e[0]=X(t[0]),e[1]=X(t[1]);let r=t.length/4*4,i=2;if(r>=4)for(;i<r-4;i+=4){let n=t[i],a=t[i+1],s=t[i+2],o=t[i+3];e[i]=X(n)+e[i-2],e[i+1]=X(a)+e[i-1],e[i+2]=X(s)+e[i],e[i+3]=X(o)+e[i+1]}for(;i!==t.length;i+=2)e[i]=X(t[i])+e[i-2],e[i+1]=X(t[i+1])+e[i-1];return e}function Gp(t,e,r,i){if(t.length<2)return new Int32Array(t);let n=new Int32Array(t.length),a=X(t[0]),s=X(t[1]);n[0]=he(Math.round(a*e),r,i),n[1]=he(Math.round(s*e),r,i);let o=t.length/16,l=2;if(o>=4)for(;l<o-4;l+=4){let u=t[l],h=t[l+1],c=X(u)+a,p=X(h)+s;n[l]=he(Math.round(c*e),r,i),n[l+1]=he(Math.round(p*e),r,i);let f=t[l+2],d=t[l+3];a=X(f)+c,s=X(d)+p,n[l+2]=he(Math.round(a*e),r,i),n[l+3]=he(Math.round(s*e),r,i)}for(;l!==t.length;l+=2)a+=X(t[l]),s+=X(t[l+1]),n[l]=he(Math.round(a*e),r,i),n[l+1]=he(Math.round(s*e),r,i);return n}function he(t,e,r){return Math.min(r,Math.max(e,t))}function sv(t){let e=new Int32Array(t.length+1);e[0]=0,e[1]=X(t[0]);let r=e[1];for(let i=2;i!==e.length;++i){let n=t[i-1],a=X(n);r+=a,e[i]=e[i-1]+r}return new Uint32Array(e)}function ov(t,e,r){let i=new Int32Array(r+1);i[0]=0;let n=1,a=i[0];for(let s=0;s<e;s++){let o=t[s],l=t[s+e];l=X(l);for(let u=n;u<n+o;u++)i[u]=l+a,a=i[u];n+=o}return i}function lv(t,e,r){let i=new Uint32Array(r+1);i[0]=0;let n=1,a=i[0];for(let s=0;s<e;s++){let o=t[s],l=t[s+e];for(let u=n;u<n+o;u++)i[u]=l+a,a=i[u];n+=o}return i}function uv(t,e,r){let i=new Int32Array(r),n=0,a=0;for(let s=0;s<e;s++){let o=t[s],l=t[s+e],u=X(l);for(let h=0;h<o;h++)a+=u,i[n++]=a}return i}function hv(t,e,r){let i=new BigInt64Array(r),n=0,a=0n;for(let s=0;s<e;s++){let o=Number(t[s]),l=t[s+e],u=bt(l);for(let h=0;h<o;h++)a+=u,i[n++]=a}return i}function ku(t){let e=new Uint32Array(t.length);e[0]=X(t[0])>>>0;for(let r=1;r<t.length;r++)e[r]=e[r-1]+X(t[r])>>>0;return e}function Iu(t){let e=new BigUint64Array(t.length);e[0]=BigInt.asUintN(64,bt(t[0]));for(let r=1;r<t.length;r++)e[r]=BigInt.asUintN(64,e[r-1]+bt(t[r]));return e}function cv(t){if(t.length<2)return new Uint32Array(t);let e=new Uint32Array(t.length);e[0]=X(t[0])>>>0,e[1]=X(t[1])>>>0;for(let r=2;r<t.length;r+=2)e[r]=e[r-2]+X(t[r])>>>0,e[r+1]=e[r-1]+X(t[r+1])>>>0;return e}function pv(t,e,r,i){let n=Gp(t,e,r,i);return new Uint32Array(n)}function fv(t){return t[1]}function dv(t){return X(t[1])}function yv(t){if(t.length===2){let e=X(t[1]);return[e,e]}return[X(t[2]),X(t[3])]}function mv(t){return t[1]}function gv(t){return bt(t[1])}function xv(t){if(t.length===2){let e=bt(t[1]);return[e,e]}return[bt(t[2]),bt(t[3])]}var ht;(function(t){t.PRESENT="PRESENT",t.DATA="DATA",t.OFFSET="OFFSET",t.LENGTH="LENGTH"})(ht||={});var Et;(function(t){t.NONE="NONE",t.SINGLE="SINGLE",t.SHARED="SHARED",t.VERTEX="VERTEX",t.MORTON="MORTON",t.FSST="FSST"})(Et||={});var ae;(function(t){t.VERTEX="VERTEX",t.INDEX="INDEX",t.STRING="STRING",t.KEY="KEY"})(ae||={});var yt;(function(t){t.VAR_BINARY="VAR_BINARY",t.GEOMETRIES="GEOMETRIES",t.PARTS="PARTS",t.RINGS="RINGS",t.TRIANGLES="TRIANGLES",t.SYMBOL="SYMBOL",t.DICTIONARY="DICTIONARY"})(yt||={});var vv=[ht.PRESENT,ht.DATA,ht.OFFSET,ht.LENGTH],Mu=[U.NONE,U.DELTA,U.COMPONENTWISE_DELTA,U.RLE,U.MORTON,U.PDE],bv=[Rt.NONE,Rt.FAST_PFOR,Rt.VARINT],wv=[Et.NONE,Et.SINGLE,Et.SHARED,Et.VERTEX,Et.MORTON,Et.FSST],_v=[ae.VERTEX,ae.INDEX,ae.STRING,ae.KEY],Sv=[yt.VAR_BINARY,yt.GEOMETRIES,yt.PARTS,yt.RINGS,yt.TRIANGLES,yt.SYMBOL,yt.DICTIONARY];function J(t,e){let r=Ev(t,e);return r.logicalLevelTechnique1===U.MORTON?Av(r,t,e):(U.RLE===r.logicalLevelTechnique1||U.RLE===r.logicalLevelTechnique2)&&Rt.NONE!==r.physicalLevelTechnique?Dv(r,t,e):r}function Av(t,e,r){let i=_t(e,r,2);return{physicalStreamType:t.physicalStreamType,logicalStreamType:t.logicalStreamType,logicalLevelTechnique1:t.logicalLevelTechnique1,logicalLevelTechnique2:t.logicalLevelTechnique2,physicalLevelTechnique:t.physicalLevelTechnique,numValues:t.numValues,byteLength:t.byteLength,decompressedCount:t.decompressedCount,numBits:i[0],coordinateShift:i[1]}}function Dv(t,e,r){let i=_t(e,r,2);return{physicalStreamType:t.physicalStreamType,logicalStreamType:t.logicalStreamType,logicalLevelTechnique1:t.logicalLevelTechnique1,logicalLevelTechnique2:t.logicalLevelTechnique2,physicalLevelTechnique:t.physicalLevelTechnique,numValues:t.numValues,byteLength:t.byteLength,decompressedCount:i[1],runs:i[0],numRleValues:i[1]}}function Ev(t,e){let r=t[e.get()],i=vv[r>>4],n={};switch(i){case ht.DATA:n={dictionaryType:wv[r&15]};break;case ht.OFFSET:n={offsetType:_v[r&15]};break;case ht.LENGTH:n={lengthType:Sv[r&15]}}e.increment();let a=t[e.get()],s=Mu[a>>5],o=Mu[a>>2&7],l=bv[a&3];e.increment();let u=_t(t,e,2),h=u[0],c=u[1];return{physicalStreamType:i,logicalStreamType:n,logicalLevelTechnique1:s,logicalLevelTechnique2:o,physicalLevelTechnique:l,numValues:h,byteLength:c,decompressedCount:h}}var K;(function(t){t[t.FLAT=0]="FLAT",t[t.CONST=1]="CONST",t[t.SEQUENCE=2]="SEQUENCE",t[t.DICTIONARY=3]="DICTIONARY",t[t.FSST_DICTIONARY=4]="FSST_DICTIONARY"})(K||={});var Gt=class{constructor(t,e){this.values=t,this._size=e}get(t){let e=Math.floor(t/8),r=t%8;return(this.values[e]>>r&1)==1}set(t,e){let r=Math.floor(t/8),i=t%8;this.values[r]=this.values[r]|+!!e<<i}getInt(t){let e=Math.floor(t/8),r=t%8;return this.values[e]>>r&1}size(){return this._size}getBuffer(){return this.values}};function Ue(t,e,r){if(!e)return t;let i=e.size(),n=t.constructor,a=new n(i),s=0;for(let o=0;o<i;o++)a[o]=e.get(o)?t[s++]:r;return a}function Tv(t,e,r){if(!r)return t;let i=r.size(),n=new Gt(t,e),a=new Gt(new Uint8Array(Math.ceil(i/8)),i),s=0;for(let o=0;o<i;o++){let l=r.get(o)?n.get(s++):!1;a.set(o,l)}return a.getBuffer()}function jp(t,e,r){for(let i=0;i<t;i++){let n=J(e,r);r.add(n.byteLength)}}function wr(t,e,r,i,n){let a=Fv(t,Math.ceil(e/8),r,i);return n?Tv(a,e,n):a}function Fv(t,e,r,i){let n=new Uint8Array(e),a=0,s=i.get()+r;for(;a<e&&!(i.get()>=s);){let o=t[i.increment()];if(o<=127){let l=o+3,u=t[i.increment()],h=Math.min(a+l,e);n.fill(u,a,h),a=h}else{let l=256-o;for(let u=0;u<l&&a<e;u++)n[a++]=t[i.increment()]}}return i.set(s),n}function Yp(t,e,r,i){let n=e.get(),a=n+r*Float32Array.BYTES_PER_ELEMENT,s=new Uint8Array(t.subarray(n,a)).buffer,o=new Float32Array(s);return e.set(a),i?Ue(o,i,0):o}function Xp(t,e,r,i){let n=e.get(),a=n+r*Float64Array.BYTES_PER_ELEMENT,s=new Uint8Array(t.subarray(n,a)).buffer,o=new Float64Array(s);return e.set(a),i?Ue(o,i,0):o}function kv(t,e,r){let i=e.get(),n=r*Uint32Array.BYTES_PER_ELEMENT,a=new DataView(t.buffer,t.byteOffset,t.byteLength),s=new Uint32Array(r);for(let o=0;o<r;o++)s[o]=a.getUint32(i+o*Uint32Array.BYTES_PER_ELEMENT,!0);return e.add(n),s}function Iv(t,e,r){let i=e.get(),n=r*BigUint64Array.BYTES_PER_ELEMENT,a=new DataView(t.buffer,t.byteOffset,t.byteLength),s=new BigUint64Array(r);for(let o=0;o<r;o++)s[o]=a.getBigUint64(i+o*BigUint64Array.BYTES_PER_ELEMENT,!0);return e.add(n),s}var Mv=new TextDecoder;function Lo(t,e,r){return r-e>=12?Mv.decode(t.subarray(e,r)):Cv(t,e,r)}function Cv(t,e,r){let i="",n=e;for(;n<r;){let a=t[n],s=null,o=a>239?4:a>223?3:a>191?2:1;if(n+o>r)break;let l,u,h;o===1?a<128&&(s=a):o===2?(l=t[n+1],(l&192)==128&&(s=(a&31)<<6|l&63,s<=127&&(s=null))):o===3?(l=t[n+1],u=t[n+2],(l&192)==128&&(u&192)==128&&(s=(a&15)<<12|(l&63)<<6|u&63,(s<=2047||s>=55296&&s<=57343)&&(s=null))):o===4&&(l=t[n+1],u=t[n+2],h=t[n+3],(l&192)==128&&(u&192)==128&&(h&192)==128&&(s=(a&15)<<18|(l&63)<<12|(u&63)<<6|h&63,(s<=65535||s>=1114112)&&(s=null))),s===null?(s=65533,o=1):s>65535&&(s-=65536,i+=String.fromCharCode(s>>>10&1023|55296),s=56320|s&1023),i+=String.fromCharCode(s),n+=o}return i}function fn(t,e,r,i,n){return Vv(_r(t,e,r),r,i,n)}function vt(t,e,r,i,n){return Ov(_r(t,e,r),r,i,n)}function fe(t,e,r){return $v(_r(t,e,r),r)}function _r(t,e,r){let i=r.physicalLevelTechnique;switch(i){case Rt.FAST_PFOR:return W2(t,r.numValues,r.byteLength,e);case Rt.VARINT:return _t(t,e,r.numValues);case Rt.NONE:return kv(t,e,r.numValues);default:throw Error(`Specified physicalLevelTechnique ${i} is not supported (yet).`)}}function bi(t,e,r){let i=r.physicalLevelTechnique;switch(i){case Rt.VARINT:return Po(t,e,r.numValues);case Rt.NONE:return Iv(t,e,r.numValues);default:throw Error(`Specified physicalLevelTechnique ${i} is not supported (yet).`)}}function Bv(t,e,r){let i=_r(t,e,r);return i.length===1?X(i[0]):dv(i)}function Vo(t,e,r){let i=_r(t,e,r);return i.length===1?r.logicalLevelTechnique1===U.DELTA?X(i[0]):i[0]:fv(i)}function Zp(t,e,r){return yv(_r(t,e,r))}function Wp(t,e,r){return xv(Po(t,e,r.numValues))}function Hp(t,e,r,i){return Jp(bi(t,e,r),r,i)}function Oo(t,e,r,i){return Qp(bi(t,e,r),r,i)}function Pv(t,e,r,i){let n=zv(t,e,r,!1);return i?Ue(n,i,0):n}function zv(t,e,r,i){if(r.physicalLevelTechnique===Rt.VARINT)return Rv(Y2(t,e,r.numValues),r,i);let n=bi(t,e,r),a=i?Jp(n,r):Qp(n,r);return Float64Array.from(a,Number)}function Lv(t,e,r){let i=bi(t,e,r);return i.length===1?bt(i[0]):gv(i)}function Kp(t,e,r){let i=bi(t,e,r);return i.length===1?r.logicalLevelTechnique1===U.DELTA?bt(i[0]):i[0]:mv(i)}function Vv(t,e,r,i){let n;switch(e.logicalLevelTechnique1){case U.DELTA:if(e.logicalLevelTechnique2===U.RLE){let a=e;if(!i)return uv(t,a.runs,a.numRleValues);t=Fs(t,a.runs,a.numRleValues),n=Tu(t)}else n=Tu(t);break;case U.RLE:n=ev(t,e.runs,e.numRleValues);break;case U.MORTON:zo(t),n=new Int32Array(t);break;case U.COMPONENTWISE_DELTA:if(r&&!i)return Gp(t,r.scale,r.min,r.max);n=av(t);break;case U.NONE:n=K2(t);break;default:throw Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}return i?Ue(n,i,0):n}function Ov(t,e,r,i){let n;switch(e.logicalLevelTechnique1){case U.DELTA:if(e.logicalLevelTechnique2===U.RLE){let a=e;n=ku(Fs(t,a.runs,a.numRleValues))}else n=ku(t);break;case U.RLE:n=Fs(t,e.runs,e.numRleValues);break;case U.MORTON:zo(t),n=t;break;case U.COMPONENTWISE_DELTA:n=r&&!i?pv(t,r.scale,r.min,r.max):cv(t);break;case U.NONE:n=t;break;default:throw Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}return i?Ue(n,i,0):n}function Jp(t,e,r){let i;switch(e.logicalLevelTechnique1){case U.DELTA:if(e.logicalLevelTechnique2===U.RLE){let n=e;if(!r)return hv(t,n.runs,n.numRleValues);t=ks(t,n.runs,n.numRleValues),i=Fu(t)}else i=Fu(t);break;case U.RLE:i=rv(t,e.runs,e.numRleValues);break;case U.NONE:i=J2(t);break;default:throw Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}return r?Ue(i,r,0n):i}function Qp(t,e,r){let i;switch(e.logicalLevelTechnique1){case U.DELTA:if(e.logicalLevelTechnique2===U.RLE){let n=e;i=Iu(ks(t,n.runs,n.numRleValues))}else i=Iu(t);break;case U.RLE:i=ks(t,e.runs,e.numRleValues);break;case U.NONE:i=t;break;default:throw Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}return r?Ue(i,r,0n):i}function Rv(t,e,r){switch(e.logicalLevelTechnique1){case U.DELTA:if(e.logicalLevelTechnique2===U.RLE){let i=e;t=qp(t,i.runs,i.numRleValues)}return tv(t),t;case U.RLE:return Uv(t,e,r);case U.NONE:return r&&Q2(t),t;default:throw Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}}function $v(t,e){if(e.logicalLevelTechnique1===U.DELTA&&e.logicalLevelTechnique2===U.NONE)return sv(t);if(e.logicalLevelTechnique1===U.RLE&&e.logicalLevelTechnique2===U.NONE){let r=e;return lv(t,r.runs,r.numRleValues)}if(e.logicalLevelTechnique1===U.NONE&&e.logicalLevelTechnique2===U.NONE){nv(t);let r=new Uint32Array(e.numValues+1);return r[0]=0,r.set(t,1),r}if(e.logicalLevelTechnique1===U.DELTA&&e.logicalLevelTechnique2===U.RLE){let r=e,i=ov(t,r.runs,r.numRleValues);return zo(i),new Uint32Array(i)}throw Error("Only delta encoding is supported for transforming length to offset streams yet.")}function Un(t,e,r,i,n="int32"){let a=t.logicalLevelTechnique1;if(a===U.RLE)return t.runs===1?K.CONST:K.FLAT;if(a!==U.DELTA||t.logicalLevelTechnique2!==U.RLE)return t.numValues===1?K.CONST:K.FLAT;let s=e instanceof Gt?e.size():e,o=t;if(o.numRleValues!==s)return K.FLAT;if(o.runs===1)return K.SEQUENCE;if(o.runs!==2)return t.numValues===1?K.CONST:K.FLAT;let l=i.get();if(t.physicalLevelTechnique===Rt.VARINT)return Nv(r,i,n)?K.SEQUENCE:t.numValues===1?K.CONST:K.FLAT;let u=i.get(),h=new Int32Array(r.buffer,r.byteOffset+u,4);return i.set(l),h[2]===2&&h[3]===2?K.SEQUENCE:t.numValues===1?K.CONST:K.FLAT}function Nv(t,e,r){let i=new $p(e.get());if(r==="int64"){let a=Po(t,i,4);return a[2]===2n&&a[3]===2n}let n=_t(t,i,4);return n[2]===2&&n[3]===2}function Uv(t,e,r){return r?iv(t,e.runs,e.numRleValues):qp(t,e.runs,e.numRleValues)}var tf=class extends Nn{getValueFromBuffer(t){return this.dataBuffer[t]}},ef=class extends Op{constructor(t,e,r,i,n){super(t,n?BigInt64Array.of(e):BigUint64Array.of(e),r,i)}getValueFromBuffer(t){return this.dataBuffer[0]+BigInt(t)*this.delta}};function Ro(t,e,r){return{x:Cu(t,e)-r,y:Cu(t>>1,e)-r}}function Cu(t,e){let r=0;for(let i=0;i<e;i++)r|=(t&1<<2*i)>>i;return r}var wt;(function(t){t[t.POINT=0]="POINT",t[t.LINESTRING=1]="LINESTRING",t[t.POLYGON=2]="POLYGON",t[t.MULTIPOINT=3]="MULTIPOINT",t[t.MULTILINESTRING=4]="MULTILINESTRING",t[t.MULTIPOLYGON=5]="MULTIPOLYGON"})(wt||={});var qv;(function(t){t[t.POINT=0]="POINT",t[t.LINESTRING=1]="LINESTRING",t[t.POLYGON=2]="POLYGON"})(qv||={});var qe;(function(t){t[t.MORTON=0]="MORTON",t[t.VEC_2=1]="VEC_2",t[t.VEC_3=2]="VEC_3"})(qe||={});function Gv(t){let e=Array(t.numGeometries),r=1,i=1,n=1,a=0,s=0,o=0,l=t.mortonSettings,u=t.topologyVector,h=u.geometryOffsets,c=u.partOffsets,p=u.ringOffsets,f=t.vertexOffsets,d=!f||f.length===0,y=t.containsPolygonGeometry(),m=t.vertexBuffer;for(let g=0;g<t.numGeometries;g++){let x=t.geometryType(g);switch(x){case wt.POINT:{let b,v;if(d)b=m[s++],v=m[s++];else if(t.vertexBufferType===qe.MORTON){let w=m[f[o++]],A=Ro(w,l.numBits,l.coordinateShift);b=A.x,v=A.y}else{let w=f[o++]*2;b=m[w],v=m[w+1]}e[a++]=[[new M(b,v)]],h&&n++,c&&r++,p&&i++}break;case wt.MULTIPOINT:{let b=h[n]-h[n-1];n++;let v;if(d){v=Array(b);for(let w=0;w<b;w++){let A=m[s++],S=m[s++];v[w]=new M(A,S)}}else v=De(t.vertexBufferType,m,f,o,b,!1,l),o+=b;e[a++]=v.map(w=>[w]),r+=b,i+=b}break;case wt.LINESTRING:{let b;y?(b=p[i]-p[i-1],i++):b=c[r]-c[r-1],r++;let v;d?(v=Ze(m,s,b,!1),s+=b*2):(v=De(t.vertexBufferType,m,f,o,b,!1,l),o+=b),e[a++]=[v],h&&n++}break;case wt.POLYGON:{let b=c[r]-c[r-1];r++;let v=Array(b-1),w,A=p[i]-p[i-1];if(i++,d){w=Ze(m,s,A,!0),s+=A*2;for(let S=0;S<v.length;S++)A=p[i]-p[i-1],i++,v[S]=Ze(m,s,A,!0),s+=A*2}else{w=De(t.vertexBufferType,m,f,o,A,!0,l),o+=A;for(let S=0;S<v.length;S++)A=p[i]-p[i-1],i++,v[S]=De(t.vertexBufferType,m,f,o,A,!0,l),o+=A}e[a++]=[w].concat(v),h&&n++}break;case wt.MULTILINESTRING:{let b=h[n]-h[n-1];n++;let v=Array(b);for(let w=0;w<b;w++){let A;if(y?(A=p[i]-p[i-1],i++):A=c[r]-c[r-1],r++,d)v[w]=Ze(m,s,A,!1),s+=A*2;else{let S=De(t.vertexBufferType,m,f,o,A,!1,l);v[w]=S,o+=A}}e[a++]=v}break;case wt.MULTIPOLYGON:{let b=h[n]-h[n-1];n++;let v=Array(b);for(let w=0;w<b;w++){let A=c[r]-c[r-1];r++;let S,D=Array(A-1),E=p[i]-p[i-1];i++,d?(S=Ze(m,s,E,!0),s+=E*2):(S=De(t.vertexBufferType,m,f,o,E,!0,l),o+=E);for(let L=0;L<D.length;L++){let $=p[i]-p[i-1];i++,d?(D[L]=Ze(m,s,$,!0),s+=$*2):(D[L]=De(t.vertexBufferType,m,f,o,$,!0,l),o+=$)}v[w]=[S].concat(D)}e[a++]=v.flat()}break;default:throw Error(`The specified geometry type (${x}) is currently not supported.`)}}return e}function De(t,e,r,i,n,a,s){return t===qe.MORTON?Yv(e,r,i,n,a,s):jv(e,r,i,n,a)}function Ze(t,e,r,i){let n=Array(i?r+1:r);for(let a=0;a<r*2;a+=2){let s=t[e+a],o=t[e+a+1];n[a/2]=new M(s,o)}return i&&(n[n.length-1]=n[0]),n}function jv(t,e,r,i,n){let a=Array(n?i+1:i);for(let s=0;s<i*2;s+=2){let o=e[r+s/2]*2,l=t[o],u=t[o+1];a[s/2]=new M(l,u)}return n&&(a[a.length-1]=a[0]),a}function Yv(t,e,r,i,n,a){let s=Array(n?i+1:i);for(let o=0;o<i;o++){let l=t[e[r+o]],u=Ro(l,a.numBits,a.coordinateShift);s[o]=new M(u.x,u.y)}return n&&(s[s.length-1]=s[0]),s}var rf=class{constructor(t,e,r,i,n){this._vertexBufferType=t,this._topologyVector=e,this._vertexOffsets=r,this._vertexBuffer=i,this._mortonSettings=n}get vertexBufferType(){return this._vertexBufferType}get topologyVector(){return this._topologyVector}get vertexOffsets(){return this._vertexOffsets}get vertexBuffer(){return this._vertexBuffer}getSimpleEncodedVertex(t){let e=this.vertexOffsets?this.vertexOffsets[t]*2:t*2;return[this.vertexBuffer[e],this.vertexBuffer[e+1]]}getVertex(t){if(this.vertexOffsets&&this.mortonSettings){let r=this.vertexOffsets[t],i=this.vertexBuffer[r],n=Ro(i,this.mortonSettings.numBits,this.mortonSettings.coordinateShift);return[n.x,n.y]}let e=this.vertexOffsets?this.vertexOffsets[t]*2:t*2;return[this.vertexBuffer[e],this.vertexBuffer[e+1]]}getGeometries(){return Gv(this)}get mortonSettings(){return this._mortonSettings}};function Xv(t,e,r,i,n){return new nf(t,e,qe.VEC_2,r,i,n)}function Zv(t,e,r,i,n,a){return new nf(t,e,qe.MORTON,r,i,n,a)}var nf=class extends rf{constructor(t,e,r,i,n,a,s){super(r,i,n,a,s),this._numGeometries=t,this._geometryType=e}geometryType(t){return this._geometryType}get numGeometries(){return this._numGeometries}containsPolygonGeometry(){return this._geometryType===wt.POLYGON||this._geometryType===wt.MULTIPOLYGON}containsSingleGeometryType(){return!0}};function af(t,e,r,i){return new sf(qe.VEC_2,t,e,r,i)}function Wv(t,e,r,i,n){return new sf(qe.MORTON,t,e,r,i,n)}var sf=class extends rf{constructor(t,e,r,i,n,a){super(t,r,i,n,a),this._geometryTypes=e}geometryType(t){return this._geometryTypes[t]}get numGeometries(){return this._geometryTypes.length}containsPolygonGeometry(){for(let t=0;t<this.numGeometries;t++)if(this.geometryType(t)===wt.POLYGON||this.geometryType(t)===wt.MULTIPOLYGON)return!0;return!1}containsSingleGeometryType(){return!1}},of=class{constructor(t,e,r,i){this._triangleOffsets=t,this._indexBuffer=e,this._vertexBuffer=r,this._topologyVector=i}get triangleOffsets(){return this._triangleOffsets}get indexBuffer(){return this._indexBuffer}get vertexBuffer(){return this._vertexBuffer}get topologyVector(){return this._topologyVector}getGeometries(){if(!this._topologyVector)throw Error("Cannot convert GpuVector to coordinates without topology information");let t=new Uint32Array(this.numGeometries);for(let e=0;e<this.numGeometries;e++)t[e]=this.geometryType(e);return af(t,this._topologyVector,void 0,this._vertexBuffer).getGeometries()}[Symbol.iterator](){return null}};function Bu(t,e,r,i,n,a){return new Hv(t,e,r,i,n,a)}var Hv=class extends of{constructor(t,e,r,i,n,a){super(r,i,n,a),this._numGeometries=t,this._geometryType=e}geometryType(t){return this._geometryType}get numGeometries(){return this._numGeometries}containsSingleGeometryType(){return!0}};function Pu(t,e,r,i,n){return new Kv(t,e,r,i,n)}var Kv=class extends of{constructor(t,e,r,i,n){super(e,r,i,n),this._geometryTypes=t}geometryType(t){return this._geometryTypes[t]}get numGeometries(){return this._geometryTypes.length}containsSingleGeometryType(){return!1}};function Jv(t,e,r,i,n){let a=J(t,r),s=Un(a,i,t,r),o,l,u,h;if(s===K.CONST){let b=Vo(t,r,a),v,w,A,S;for(let D=0;D<e-1;D++){let E=J(t,r);switch(E.physicalStreamType){case ht.LENGTH:switch(E.logicalStreamType.lengthType){case yt.GEOMETRIES:v=fe(t,r,E);break;case yt.PARTS:w=fe(t,r,E);break;case yt.RINGS:A=fe(t,r,E);break;case yt.TRIANGLES:S=fe(t,r,E)}break;case ht.OFFSET:switch(E.logicalStreamType.offsetType){case ae.VERTEX:o=vt(t,r,E);break;case ae.INDEX:h=vt(t,r,E)}break;case ht.DATA:if(Et.VERTEX===E.logicalStreamType.dictionaryType)l=fn(t,r,E,n);else{let L=E;u={numBits:L.numBits,coordinateShift:L.coordinateShift},l=vt(t,r,E,n)}}}return h?v!==void 0||w!==void 0?Bu(i,b,S,h,l,{geometryOffsets:v,partOffsets:w,ringOffsets:A}):Bu(i,b,S,h,l):u===void 0?Xv(i,b,{geometryOffsets:v,partOffsets:w,ringOffsets:A},o,l):Zv(i,b,{geometryOffsets:v,partOffsets:w,ringOffsets:A},o,l,u)}let c=vt(t,r,a),p,f,d,y;for(let b=0;b<e-1;b++){let v=J(t,r);switch(v.physicalStreamType){case ht.LENGTH:switch(v.logicalStreamType.lengthType){case yt.GEOMETRIES:p=vt(t,r,v);break;case yt.PARTS:f=vt(t,r,v);break;case yt.RINGS:d=vt(t,r,v);break;case yt.TRIANGLES:y=fe(t,r,v)}break;case ht.OFFSET:switch(v.logicalStreamType.offsetType){case ae.VERTEX:o=vt(t,r,v);break;case ae.INDEX:h=vt(t,r,v)}break;case ht.DATA:if(Et.VERTEX===v.logicalStreamType.dictionaryType)l=fn(t,r,v,n);else{let w=v;u={numBits:w.numBits,coordinateShift:w.coordinateShift},l=vt(t,r,v,n)}}}let m,g,x;return p?(m=ma(c,p,2),f&&d?(g=zu(c,m,f,!1),x=tb(c,m,g,d)):f&&(g=Qv(c,m,f))):f&&d?(g=ma(c,f,1),x=zu(c,g,d,!0)):f&&(g=ma(c,f,0)),h&&!g?Pu(c,y,h,l):h?Pu(c,y,h,l,{geometryOffsets:m,partOffsets:g,ringOffsets:x}):u===void 0?af(c,{geometryOffsets:m,partOffsets:g,ringOffsets:x},o,l):Wv(c,{geometryOffsets:m,partOffsets:g,ringOffsets:x},o,l,u)}function ma(t,e,r){let i=new Uint32Array(t.length+1),n=0;i[0]=n;let a=0;for(let s=0;s<t.length;s++)n=i[s+1]=n+(t[s]>r?e[a++]:1);return i}function zu(t,e,r,i){let n=new Uint32Array(e[e.length-1]+1),a=0;n[0]=a;let s=1,o=0;for(let l=0;l<t.length;l++){let u=t[l],h=e[l+1]-e[l];if(u===5||u===2||i&&(u===4||u===1))for(let c=0;c<h;c++)a=n[s++]=a+r[o++];else for(let c=0;c<h;c++)n[s++]=++a}return n}function Qv(t,e,r){let i=new Uint32Array(e[e.length-1]+1),n=0;i[0]=n;let a=1,s=0;for(let o=0;o<t.length;o++){let l=t[o],u=e[o+1]-e[o];if(l===4||l===1)for(let h=0;h<u;h++)n=i[a++]=n+r[s++];else for(let h=0;h<u;h++)i[a++]=++n}return i}function tb(t,e,r,i){let n=new Uint32Array(r[r.length-1]+1),a=0;n[0]=a;let s=1,o=1,l=0;for(let u=0;u<t.length;u++){let h=t[u],c=e[u+1]-e[u];if(h!==0&&h!==3)for(let p=0;p<c;p++){let f=r[s]-r[s-1];s++;for(let d=0;d<f;d++)a=n[o++]=a+i[l++]}else for(let p=0;p<c;p++)n[o++]=++a,s++}return n}var eb=class extends Ne{constructor(t,e,r){super(t,e.getBuffer(),r),this.dataVector=e}getValueFromBuffer(t){return this.dataVector.get(t)}},rb=class extends Nn{getValueFromBuffer(t){return this.dataBuffer[t]}},lf=class extends Ne{constructor(t,e,r,i){super(t,i?BigInt64Array.of(e):BigUint64Array.of(e),r)}getValueFromBuffer(t){return this.dataBuffer[0]}},$o=class extends Ne{constructor(t,e,r,i){super(t,r,i),this.offsetBuffer=e}},Lu=class extends $o{constructor(t,e,r,i){super(t,e,r,i??e.length-1)}getValueFromBuffer(t){let e=this.offsetBuffer[t],r=this.offsetBuffer[t+1];return Lo(this.dataBuffer,e,r)}},lr=class extends $o{constructor(t,e,r,i,n){super(t,r,i,n??e.length),this.indexBuffer=e,this.indexBuffer=e}getValueFromBuffer(t){let e=this.indexBuffer[t],r=this.offsetBuffer[e],i=this.offsetBuffer[e+1];return Lo(this.dataBuffer,r,i)}};function ib(t,e){let r=0;for(let i=0;i<e.length;i++){let n=e[i];n===255?(r++,i++):r+=t[n]}return r}function nb(t,e,r){let i=new Uint32Array(e.length);for(let s=1;s<e.length;s++)i[s]=i[s-1]+e[s-1];let n=new Uint8Array(ib(e,r)),a=0;for(let s=0;s<r.length;s++){let o=r[s];if(o===255)s++,n[a++]=r[s];else{let l=e[o],u=i[o];for(;l-- >0;)n[a++]=t[u++]}}return n}var uf=class extends $o{constructor(t,e,r,i,n,a,s,o){super(t,r,i,s??e.length),this.indexBuffer=e,this.symbolOffsetBuffer=n,this.symbolTableBuffer=a,this.sharedDictionaryCache=o}getValueFromBuffer(t){this.decodedDictionary??(this.decodedDictionary=this.sharedDictionaryCache?.decodedDictionary,this.decodedDictionary??(this.decodedDictionary=this.decodeDictionary(),this.sharedDictionaryCache&&(this.sharedDictionaryCache.decodedDictionary=this.decodedDictionary)));let e=this.indexBuffer[t],r=this.offsetBuffer[e],i=this.offsetBuffer[e+1];return Lo(this.decodedDictionary,r,i)}decodeDictionary(){return this.symbolLengthBuffer??=this.offsetToLengthBuffer(this.symbolOffsetBuffer),nb(this.symbolTableBuffer,this.symbolLengthBuffer,this.dataBuffer)}offsetToLengthBuffer(t){let e=new Uint32Array(t.length-1),r=t[0];for(let i=1;i<t.length;i++){let n=t[i];e[i-1]=n-r,r=n}return e}};function hf(t,e,r,i,n){let a,s,o,l,u,h=n,c,p;for(let f=0;f<i;f++){let d=J(e,r);switch(d.physicalStreamType){case ht.PRESENT:{let y=new Gt(wr(e,d.numValues,d.byteLength,r),d.numValues);h=n??y;break}case ht.OFFSET:s=vt(e,r,d,void 0,h);break;case ht.LENGTH:{let y=fe(e,r,d);yt.DICTIONARY===d.logicalStreamType.lengthType?a=y:yt.SYMBOL===d.logicalStreamType.lengthType?l=y:c=y;break}case ht.DATA:{let y=e.subarray(r.get(),r.get()+d.byteLength);r.add(d.byteLength);let m=d.logicalStreamType.dictionaryType;Et.FSST===m?u=y:Et.SINGLE===m||Et.SHARED===m?o=y:Et.NONE===m&&(p=y);break}}}return ab(t,u,s,a,o,l,h)??sb(t,o,s,a,h)??ob(t,c,p,s,h)}function ab(t,e,r,i,n,a,s){if(e){if(!r||!i||!n||!a)throw Error(`Incomplete FSST dictionary string column "${t}"`);return new uf(t,r,i,n,a,e,s)}}function sb(t,e,r,i,n){if(e){if(!r||!i)throw Error(`Incomplete dictionary string column "${t}"`);return n?new lr(t,r,i,e,n):new lr(t,r,i,e)}}function ob(t,e,r,i,n){if(!(!e||!r)){if(i)return n?new lr(t,i,e,r,n):new lr(t,i,e,r);if(n&&n.size()!==e.length-1){let a=new Uint32Array(n.size()),s=0;for(let o=0;o<n.size();o++)n.get(o)?a[o]=s++:a[o]=0;return new lr(t,a,e,r,n)}return n?new Lu(t,e,r,n):new Lu(t,e,r)}}function lb(t,e,r,i){let n,a,s,o,l=!1;for(;!l;){let f=J(t,e);switch(f.physicalStreamType){case ht.LENGTH:yt.DICTIONARY===f.logicalStreamType.lengthType?n=fe(t,e,f):s=fe(t,e,f);break;case ht.DATA:Et.SINGLE===f.logicalStreamType.dictionaryType||Et.SHARED===f.logicalStreamType.dictionaryType?(a=t.subarray(e.get(),e.get()+f.byteLength),l=!0):o=t.subarray(e.get(),e.get()+f.byteLength),e.add(f.byteLength)}}if(r.type!=="complexType")throw Error(`Shared dictionary column ${r.name} must be a complex (struct) column.`);if(!n||!a)throw Error(`Incomplete shared dictionary for column "${r.name}"`);let u=r.complexType.children,h=[],c=o?{}:void 0,p=0;for(let f of u){let d=_t(t,e,1)[0];if(d===0)continue;let y=f.name?`${r.name}${f.name}`:r.name;if(i&&!i.has(y)){jp(d,t,e);continue}if(f.type!=="scalarField"||f.scalarField.physicalType!==Z.STRING)throw Error("Currently only scalar string fields are implemented for a struct.");if(d>1&&!f.nullable||d===1&&f.nullable)throw Error(`The number of streams for the child field ${f.name} does not match its nullability. nullibilty: ${f.nullable}, numStreams: ${d}`);let m;if(f.nullable){let x=J(t,e);m=new Gt(wr(t,x.numValues,x.byteLength,e),x.numValues)}let g=vt(t,e,J(t,e),void 0,m);if(o){if(!s)throw Error(`Incomplete shared FSST dictionary for column "${y}"`);h[p++]=new uf(y,g,n,a,s,o,m,c)}else h[p++]=new lr(y,g,n,a,m)}return h}var Vu=class extends Ne{constructor(t,e,r){super(t,new Uint8Array,r??e.length),this.values=e}getValueFromBuffer(t){return this.values[t]}},se;(function(t){t[t.STRING=1]="STRING",t[t.INT32=2]="INT32",t[t.UINT32=4]="UINT32",t[t.INT64=8]="INT64",t[t.UINT64=16]="UINT64",t[t.FLOAT=32]="FLOAT",t[t.DOUBLE=64]="DOUBLE",t[t.PRESENCE=128]="PRESENCE"})(se||={});var ke;(function(t){t[t.FALSE=0]="FALSE",t[t.TRUE=1]="TRUE",t[t.START_MAP=2]="START_MAP",t[t.START_LIST=3]="START_LIST",t[t.COUNT=4]="COUNT"})(ke||={});function ub(t,e,r,i){let n=hb(r);if(i===0)return n.map(h=>new Vu(h,[]));let a=cb(t,e,i),s=(a.presentStream?a.presentCount:a.lengthStream.length)/n.length,o=[],l=0,u=0;for(let h=0;h<n.length;h++){let c=mb(a,h,s,l,u);o.push(new Vu(n[h],c.value,c.nullabilityBuffer)),l=c.countsEnd,u=c.valuesEnd}return o}function hb(t){let e=t.type==="complexType"?t.complexType.children:void 0;return!e||e.length===0?[t.name]:e.map(r=>t.name+(r.name??""))}function cb(t,e,r){let i=t[e.get()];e.add(1);let n=vt(t,e,J(t,e)),a=r-1,s=[];i&se.STRING&&(a-=pb(t,e,s)),a-=fb(t,e,i,s),a-=db(t,e,i,s);let o,l=0;if(i&se.PRESENCE){let h=yb(t,e);o=h.value,l=h.count,a--}let u=new Uint32Array;if(a>0&&(u=vt(t,e,J(t,e)),a--),a!==0)throw Error(`Unexpected number of remaining streams while decoding map column: ${a}`);return{lengthStream:n,dictionary:s,presentStream:o,presentCount:l,flattenedValues:u}}function pb(t,e,r){let i=t[e.get()];e.add(1);let n=hf("",t,e,i);if(n)for(let a=0;a<n.size;a++)r.push(n.getValue(a));return i}function fb(t,e,r,i){let n=0;return r&se.INT32?(rr(i,fn(t,e,J(t,e))),n++):r&se.INT64&&(rr(i,Hp(t,e,J(t,e))),n++),r&se.UINT32?(rr(i,vt(t,e,J(t,e))),n++):r&se.UINT64&&(rr(i,Oo(t,e,J(t,e))),n++),n}function db(t,e,r,i){let n=0;return r&se.FLOAT&&(rr(i,Yp(t,e,J(t,e).numValues)),n++),r&se.DOUBLE&&(rr(i,Xp(t,e,J(t,e).numValues)),n++),n}function yb(t,e){let r=J(t,e);if(r.physicalStreamType!==ht.PRESENT)throw Error(`Expected PRESENT stream for map column but found: ${r.physicalStreamType}`);let i=r.numValues,n=e.get(),a=new Gt(wr(t,i,r.byteLength,e),i);return e.set(n+r.byteLength),{value:a,count:i}}function mb(t,e,r,i,n){let{lengthStream:a,flattenedValues:s,presentStream:o,dictionary:l}=t,u=e*r,h=r,c;if(o){c=new Gt(new Uint8Array(Math.ceil(r/8)),r),h=0;for(let x=0;x<r;x++)o.get(u+x)&&(c.set(x,!0),h++)}let p=i+h;if(p>a.length)throw Error("Merged map counts underflow while decoding child streams");let f=Array(r),d=i,y=n;for(let x=0;x<r;x++){if(o&&!o.get(u+x)){f[x]=null;continue}let b=y+a[d++];if(b>s.length)throw Error("Map value stream underflow while decoding feature payload");let v=gb(s,y,b,l);f[x]=v.value,y=v.nextIndex}let m=0;for(let x=i;x<p;x++)m+=a[x];let g=n+m;if(y!==g)throw Error("Unused flattened map values remain after decode");return{value:f,nullabilityBuffer:c,countsEnd:p,valuesEnd:g}}function gb(t,e,r,i){return r-e===1||t[e]===ke.START_LIST?No(t,e,r,i):cf(t,e,r,i)}function cf(t,e,r,i){let n=Object.create(null),a=e;for(;a<r;){let s=pf(t[a++],i);if(typeof s!="string")throw Error(`Map key dictionary index does not resolve to a string: ${s}`);let o=No(t,a,r,i);n[s]=o.value,a=o.nextIndex}return{value:n,nextIndex:a}}function No(t,e,r,i){if(e>=r)throw Error("Unexpected end of map value stream");let n=t[e];if(n===ke.FALSE)return{value:!1,nextIndex:e+1};if(n===ke.TRUE)return{value:!0,nextIndex:e+1};if(n===ke.START_MAP){let a=Ou(t,e,r);return{value:cf(t,e+2,a,i).value,nextIndex:a}}if(n===ke.START_LIST){let a=Ou(t,e,r),s=[],o=e+2;for(;o<a;){let l=No(t,o,a,i);s.push(l.value),o=l.nextIndex}return{value:s,nextIndex:a}}return{value:pf(n,i),nextIndex:e+1}}function Ou(t,e,r){if(e+1>=r)throw Error("Missing length for nested map/list payload");let i=t[e+1];if(i<2)throw Error(`Invalid nested payload length: ${i}`);let n=e+i;if(n>r)throw Error("Nested payload exceeds containing payload bounds");return n}function pf(t,e){let r=t-ke.COUNT;if(r<0||r>=e.length)throw Error(`Scalar dictionary index out of range: ${t}`);return e[r]}function rr(t,e){for(let r of e)t.push(r)}function xb(t,e,r,i,n,a){return r.type==="scalarType"?a&&!a.has(r.name)?(jp(i,t,e),null):vb(i,t,e,n,r.scalarType,r):r.complexType?.physicalType===ge.MAP?ub(t,e,r,i):i===0?null:lb(t,e,r,a)}function vb(t,e,r,i,n,a){let s;if(t===0)return null;if(a.nullable){let l=J(e,r),u=l.numValues,h=r.get(),c=wr(e,u,l.byteLength,r);r.set(h+l.byteLength),s=new Gt(c,l.numValues)}let o=s??i;switch(n.physicalType){case Z.UINT_32:case Z.INT_32:return Ab(e,r,a,n,o);case Z.STRING:{let l=a.nullable?t-1:t;return hf(a.name,e,r,l,s)??null}case Z.BOOLEAN:return bb(e,r,a,i,o);case Z.UINT_64:case Z.INT_64:return Sb(e,r,a,o,n);case Z.FLOAT:return wb(e,r,a,o);case Z.DOUBLE:return _b(e,r,a,o);default:throw Error(`The specified data type for the field is currently not supported: ${n}`)}}function bb(t,e,r,i,n){let a=J(t,e),s=a.numValues,o=e.get(),l=wi(n)?n:void 0,u=wr(t,s,a.byteLength,e,l);e.set(o+a.byteLength);let h=new Gt(u,s);return new eb(r.name,h,n)}function wb(t,e,r,i){let n=J(t,e),a=wi(i)?i:void 0,s=Yp(t,e,n.numValues,a);return new rb(r.name,s,i)}function _b(t,e,r,i){let n=J(t,e),a=wi(i)?i:void 0,s=Xp(t,e,n.numValues,a);return new ko(r.name,s,i)}function Sb(t,e,r,i,n){let a=J(t,e),s=Un(a,i,t,e,"int64"),o=n.physicalType===Z.INT_64;if(s===K.FLAT){let u=wi(i)?i:void 0,h=o?Hp(t,e,a,u):Oo(t,e,a,u);return new tf(r.name,h,i)}if(s===K.SEQUENCE){let u=Wp(t,e,a);return new ef(r.name,u[0],u[1],a.numRleValues,o)}let l=o?Lv(t,e,a):Kp(t,e,a);return new lf(r.name,l,i,o)}function Ab(t,e,r,i,n){let a=J(t,e),s=Un(a,n,t,e),o=i.physicalType===Z.INT_32;if(s===K.FLAT){let u=wi(n)?n:void 0,h=o?fn(t,e,a,void 0,u):vt(t,e,a,void 0,u);return new Fo(r.name,h,n)}if(s===K.SEQUENCE){let u=Zp(t,e,a);return new Io(r.name,u[0],u[1],a.numRleValues,o)}let l=o?Bv(t,e,a):Vo(t,e,a);return new Mo(r.name,l,n,o)}function wi(t){return t instanceof Gt}var dt={ID:0,ID_NULLABLE:1,ID_LONG:2,GEOMETRY:4,SCALAR_BASE:10,STRUCT:30,MAP:31};function ff(t){switch(t){case dt.ID:case dt.ID|dt.ID_NULLABLE:case dt.ID|dt.ID_LONG:case dt.ID|dt.ID_LONG|dt.ID_NULLABLE:return{nullable:(t&dt.ID_NULLABLE)!==0,columnScope:Nr.FEATURE,type:"scalarType",scalarType:{longID:(t&dt.ID_LONG)!==0,type:"logicalType",logicalType:Rp.ID}};case dt.GEOMETRY:return{nullable:!1,columnScope:Nr.FEATURE,type:"complexType",complexType:{type:"physicalType",physicalType:ge.GEOMETRY,children:[]}};case dt.STRUCT:return{nullable:!1,columnScope:Nr.FEATURE,type:"complexType",complexType:{type:"physicalType",physicalType:ge.STRUCT,children:[]}};case dt.MAP:return{nullable:!0,columnScope:Nr.FEATURE,type:"complexType",complexType:{type:"physicalType",physicalType:ge.MAP,children:[]}};default:return kb(t)}}function Db(t){return t>=dt.SCALAR_BASE}function df(t){return t===dt.STRUCT||t===dt.MAP}function Eb(t){if(t.type==="scalarType"){let e=t.scalarType;if(e.type==="physicalType")switch(e.physicalType){case Z.BOOLEAN:case Z.INT_8:case Z.UINT_8:case Z.INT_32:case Z.UINT_32:case Z.INT_64:case Z.UINT_64:case Z.FLOAT:case Z.DOUBLE:return!1;case Z.STRING:return!0;default:return!1}if(e.type==="logicalType")return!1}else if(t.type==="complexType"){let e=t.complexType;if(e.type==="physicalType")switch(e.physicalType){case ge.GEOMETRY:case ge.STRUCT:case ge.MAP:return!0;default:return!1}}return console.warn("Unexpected column type in hasStreamCount",t),!1}function Tb(t){return t.type==="scalarType"&&t.scalarType?.type==="logicalType"&&t.scalarType.logicalType===Rp.ID}function Fb(t){return t.type==="complexType"&&t.complexType?.type==="physicalType"&&t.complexType.physicalType===ge.GEOMETRY}function kb(t){let e;switch(t){case 10:case 11:e=Z.BOOLEAN;break;case 12:case 13:e=Z.INT_8;break;case 14:case 15:e=Z.UINT_8;break;case 16:case 17:e=Z.INT_32;break;case 18:case 19:e=Z.UINT_32;break;case 20:case 21:e=Z.INT_64;break;case 22:case 23:e=Z.UINT_64;break;case 24:case 25:e=Z.FLOAT;break;case 26:case 27:e=Z.DOUBLE;break;case 28:case 29:e=Z.STRING;break;default:return null}return{nullable:!!(t&1),columnScope:Nr.FEATURE,type:"scalarType",scalarType:{longID:!1,type:"physicalType",physicalType:e}}}var Ib=new TextDecoder,Ru="0-3(ID), 4(GEOMETRY), 10-29(scalars), 30(STRUCT), 31(MAP)";function Uo(t,e){let r=_t(t,e,1)[0];if(r===0)return"";let i=e.get(),n=i+r,a=t.subarray(i,n);return e.add(r),Ib.decode(a)}function Mb(t){let e=t.name,r=t.nullable;return t.type==="scalarType"?{type:"scalarField",scalarField:t.scalarType,name:e,nullable:r}:{type:"complexField",complexField:t.complexType,name:e,nullable:r}}function yf(t,e){let r=_t(t,e,1)[0]>>>0,i=r>=dt.SCALAR_BASE?ff(r):null;if(!i)throw Error(`Unsupported field type code ${r}. Supported: 10-29(scalars), 30(STRUCT), 31(MAP)`);let n={...i,name:Uo(t,e)};if(n.type==="complexType"&&df(r)){let a=n.complexType,s=_t(t,e,1)[0]>>>0;a.children=Array(s);for(let o=0;o<s;o++)a.children[o]=yf(t,e)}return Mb(n)}function Cb(t,e){let r=_t(t,e,1)[0]>>>0,i=ff(r);if(!i)throw Error(`Unsupported column type code ${r}. Supported: ${Ru}`);let n;if(Db(r))n=Uo(t,e);else if(r<dt.GEOMETRY)n="id";else if(r===dt.GEOMETRY)n="geometry";else throw Error(`Unsupported column type code ${r}. Supported: ${Ru}`);let a={...i,name:n};if(a.type==="complexType"&&df(r)){let s=_t(t,e,1)[0]>>>0,o=a.complexType;o.children=Array(s);for(let l=0;l<s;l++)o.children[l]=yf(t,e)}return a}function Bb(t,e){let r={};r.featureTables=[];let i={};if(i.name=Uo(t,e),i.name.length===0)throw Error("Missing layer name");let n=_t(t,e,1)[0]>>>0,a=_t(t,e,1)[0]>>>0;i.columns=Array(a);for(let s=0;s<a;s++)i.columns[s]=Cb(t,e);return r.featureTables.push(i),[r,n]}function Pb(t,e,r=!0){let i=new $p(0),n=[];for(;i.get()<t.length;){let a=_t(t,i,1)[0]>>>0,s=i.get()+a;if(s>t.length)throw Error(`Block overruns tile: ${s} > ${t.length}`);let o=_t(t,i,1)[0]>>>0;if(o!==1&&o!==2){i.set(s);continue}let[l,u]=Bb(t,i),h=l.featureTables[0],c=null,p=null,f=[],d=0;for(let m of h.columns){let g=m.name;if(Tb(m)){let x=null;if(m.nullable){let v=J(t,i),w=i.get(),A=wr(t,v.numValues,v.byteLength,i);i.set(w+v.byteLength),x=new Gt(A,v.numValues)}let b=J(t,i);d=x?x.size():b.decompressedCount,c=zb(t,m,i,g,b,x??d,r)}else if(Fb(m)){let x=_t(t,i,1)[0];if(d===0){let b=i.get();d=J(t,i).decompressedCount,i.set(b)}e&&(e.scale=e.extent/u),p=Jv(t,x,i,d,e)}else{let x=Eb(m)?_t(t,i,1)[0]:1;if(x===0)continue;let b=xb(t,i,m,x,d,void 0);if(b)if(Array.isArray(b))for(let v of b)f.push(v);else f.push(b)}}let y=new i2(h.name,p,c,f,u);n.push(y),i.set(s)}return n}function zb(t,e,r,i,n,a,s=!1){let o=e.scalarType?.longID?Z.UINT_64:Z.UINT_32,l=typeof a=="number"?void 0:a,u=Un(n,a,t,r,o===Z.UINT_64?"int64":"int32");if(o===Z.UINT_32)switch(u){case K.FLAT:return new Fo(i,vt(t,r,n,void 0,l),a);case K.SEQUENCE:{let h=Zp(t,r,n);return new Io(i,h[0],h[1],n.numRleValues,!1)}case K.CONST:return new Mo(i,Vo(t,r,n),a,!1)}switch(u){case K.FLAT:return s?new ko(i,Pv(t,r,n,l),a):new tf(i,Oo(t,r,n,l),a);case K.SEQUENCE:{let h=Wp(t,r,n);return new ef(i,h[0],h[1],n.numRleValues,!1)}case K.CONST:return new lf(i,Kp(t,r,n),a,!1)}throw Error("Vector type not supported for id column.")}var Lb=class{constructor(t,e){switch(this._featureData=t,this.properties=this._featureData.properties||{},this._featureData.geometry?.type){case wt.POINT:case wt.MULTIPOINT:this.type=1;break;case wt.LINESTRING:case wt.MULTILINESTRING:this.type=2;break;case wt.POLYGON:case wt.MULTIPOLYGON:this.type=3;break;default:this.type=0}this.extent=e,this.id=Number(this._featureData.id)}loadGeometry(){let t=[];for(let e of this._featureData.geometry.coordinates){let r=[];for(let i of e)r.push(new M(i.x,i.y));t.push(r)}return t}},Vb=class{constructor(t){this.features=[],this.featureTable=t,this.name=t.name,this.extent=t.extent,this.version=2,this.features=t.getFeatures(),this.length=this.features.length}feature(t){return new Lb(this.features[t],this.extent)}},qo=class{constructor(t){this.layers={};let e=Pb(new Uint8Array(t));this.layers=e.reduce((r,i)=>({...r,[i.name]:new Vb(i)}),{})}},Go=class{constructor(t,e){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new ka(it,16,0),this.grid3D=new ka(it,16,0),this.featureIndexArray=new $c,this.promoteId=e}insert(t,e,r,i,n,a){let s=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(r,i,n);let o=a?this.grid3D:this.grid;for(let l of e){let u=[1/0,1/0,-1/0,-1/0];for(let h of l)u[0]=Math.min(u[0],h.x),u[1]=Math.min(u[1],h.y),u[2]=Math.max(u[2],h.x),u[3]=Math.max(u[3],h.y);u[0]<8192&&u[1]<8192&&u[2]>=0&&u[3]>=0&&o.insert(s,u[0],u[1],u[2],u[3])}}loadVTLayers(){if(!this.vtLayers){switch(this.encoding){case"mlt":this.vtLayers=new qo(this.rawTileData).layers;break;default:this.vtLayers=new ho(new _o(this.rawTileData)).layers}this.sourceLayerCoder=new To(this.vtLayers?Object.keys(this.vtLayers).sort():[Ds])}return this.vtLayers}query(t,e,r,i){this.loadVTLayers();let n=t.params,a=it/t.tileSize/t.scale,s=yr(n.filter,"queryRenderedFeatures filter",n.globalState),o=t.queryGeometry,l=t.queryPadding*a,u=cn.fromPoints(o),h=this.grid.query(u.minX-l,u.minY-l,u.maxX+l,u.maxY+l),c=cn.fromPoints(t.cameraQueryGeometry).expandBy(l),p=this.grid3D.query(c.minX,c.minY,c.maxX,c.maxY,(y,m,g,x)=>o0(t.cameraQueryGeometry,y-l,m-l,g+l,x+l));for(let y of p)h.push(y);h.sort(Rb);let f={},d;for(let y of h){if(y===d)continue;d=y;let m=this.featureIndexArray.get(y),g=null;this.loadMatchingFeature(f,m.bucketIndex,m.sourceLayerIndex,m.featureIndex,s,n.layers,n.availableImages,e,r,i,(x,b,v)=>(g||=$e(x),b.queryIntersectsFeature({queryGeometry:o,feature:x,featureState:v,geometry:g,zoom:this.z,transform:t.transform,pixelsToTileUnits:a,pixelPosMatrix:t.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:t.getElevation})))}return f}loadMatchingFeature(t,e,r,i,n,a,s,o,l,u,h){let c=this.bucketLayerIDs[e];if(a&&!c.some(y=>a.has(y)))return;let p=this.sourceLayerCoder.decode(r),f=this.vtLayers[p].feature(i);if(n.needGeometry){let y=br(f,!0);if(!n.filter(new H(this.tileID.overscaledZ),y,this.tileID.canonical))return}else if(!n.filter(new H(this.tileID.overscaledZ),f))return;let d=this.getId(f,p);for(let y of c){if(a&&!a.has(y))continue;let m=o[y];if(!m)continue;let g={};d&&u&&(g=u.getState(m.sourceLayer||"_geojsonTileLayer",d));let x=Tt({},l[y]);x.paint=$u(x.paint,m.paint,f,g,s),x.layout=$u(x.layout,m.layout,f,g,s);let b=!h||h(f,m,g);if(!b)continue;let v=new r2(f,this.z,this.x,this.y,d);v.layer=x;let w=t[y];w===void 0&&(w=t[y]=[]),w.push({featureIndex:i,feature:v,intersectionZ:b})}}lookupSymbolFeatures(t,e,r,i,n,a,s,o){let l={};this.loadVTLayers();let u=yr(n.filterSpec,"queryRenderedFeatures symbol filter",n.globalState);for(let h of t)this.loadMatchingFeature(l,r,i,h,u,a,s,o,e);return l}hasLayer(t){for(let e of this.bucketLayerIDs)for(let r of e)if(t===r)return!0;return!1}getId(t,e){let r=t.id;if(this.promoteId){let i=typeof this.promoteId=="string"?this.promoteId:this.promoteId[e];r=t.properties[i],typeof r=="boolean"&&(r=Number(r)),r===void 0&&t.properties?.cluster&&this.promoteId&&(r=Number(t.properties.cluster_id))}return r}};I("FeatureIndex",Go,{omit:["rawTileData","sourceLayerCoder"]});function Ob(t){return typeof t=="object"&&!!t&&"evaluate"in t}function $u(t,e,r,i,n){return dn(t,(a,s)=>{let o=e instanceof Cn?e.get(s):null;return Ob(o)?o.evaluate(r,i,void 0,n):o})}function Rb(t,e){return e-t}var mf=class{constructor(t){this.maxEntries=t,this.map=new Map}get(t){let e=this.map.get(t);return e!==void 0&&(this.map.delete(t),this.map.set(t,e)),e}set(t,e){if(this.map.has(t))this.map.delete(t);else if(this.map.size>=this.maxEntries){let r=this.map.keys().next().value;this.map.delete(r)}this.map.set(t,e)}clear(){this.map.clear()}};function $b(t,e,r,i,n){let a=[];for(let s of t){let o;for(let l=0;l<s.length-1;l++){let u=s[l],h=s[l+1];u.x<e&&h.x<e||(u.x<e?u=new M(e,u.y+(h.y-u.y)*((e-u.x)/(h.x-u.x)))._round():h.x<e&&(h=new M(e,u.y+(h.y-u.y)*((e-u.x)/(h.x-u.x)))._round()),!(u.y<r&&h.y<r)&&(u.y<r?u=new M(u.x+(h.x-u.x)*((r-u.y)/(h.y-u.y)),r)._round():h.y<r&&(h=new M(u.x+(h.x-u.x)*((r-u.y)/(h.y-u.y)),r)._round()),!(u.x>=i&&h.x>=i)&&(u.x>=i?u=new M(i,u.y+(h.y-u.y)*((i-u.x)/(h.x-u.x)))._round():h.x>=i&&(h=new M(i,u.y+(h.y-u.y)*((i-u.x)/(h.x-u.x)))._round()),!(u.y>=n&&h.y>=n)&&(u.y>=n?u=new M(u.x+(h.x-u.x)*((n-u.y)/(h.y-u.y)),n)._round():h.y>=n&&(h=new M(u.x+(h.x-u.x)*((n-u.y)/(h.y-u.y)),n)._round()),(!o||!u.equals(o[o.length-1]))&&(o=[u],a.push(o)),o.push(h)))))}}return a}function gf(t,e,r,i,n,a){let s=Nu(t,e,r,n,0);return s=Nu(s,e,i,a,1),s}function Nu(t,e,r,i,n){switch(e){case 1:return Nb(t,r,i,n);case 2:return Uu(t,r,i,n,!1);case 3:return Uu(t,r,i,n,!0)}return[]}function Nb(t,e,r,i){let n=[];for(let a of t)for(let s of a){let o=i===0?s.x:s.y;o>=e&&o<=r&&n.push([s])}return n}function Ub(t,e,r,i,n){let a=i===0?qb:Gb,s=[],o=[];for(let h=0;h<t.length-1;h++){let c=t[h],p=t[h+1],f=i===0?c.x:c.y,d=i===0?p.x:p.y,y=!1;f<e?d>e&&s.push(a(c,p,e)):f>r?d<r&&s.push(a(c,p,r)):s.push(c),d<e&&f>=e&&(s.push(a(c,p,e)),y=!0),d>r&&f<=r&&(s.push(a(c,p,r)),y=!0),!n&&y&&(o.push(s),s=[])}let l=t.length-1,u=i===0?t[l].x:t[l].y;return u>=e&&u<=r&&s.push(t[l]),n&&s.length>0&&!s[0].equals(s[s.length-1])&&s.push(new M(s[0].x,s[0].y)),s.length>0&&o.push(s),o}function Uu(t,e,r,i,n){let a=[];for(let s of t){let o=Ub(s,e,r,i,n);o.length>0&&a.push(...o)}return a}function qb(t,e,r){let i=(r-t.x)/(e.x-t.x);return new M(r,t.y+(e.y-t.y)*i)}function Gb(t,e,r){let i=(r-t.y)/(e.y-t.y);return new M(t.x+(e.x-t.x)*i,r)}var ur=class xf extends M{constructor(e,r,i,n){super(e,r),this.angle=i,n!==void 0&&(this.segment=n)}clone(){return new xf(this.x,this.y,this.angle,this.segment)}};I("Anchor",ur);function vf(t,e,r,i,n){if(e.segment===void 0||r===0)return!0;let a=e,s=e.segment+1,o=0;for(;o>-r/2;){if(s--,s<0)return!1;o-=t[s].dist(a),a=t[s]}o+=t[s].dist(t[s+1]),s++;let l=[],u=0;for(;o<r/2;){let h=t[s-1],c=t[s],p=t[s+1];if(!p)return!1;let f=h.angleTo(c)-c.angleTo(p);for(f=Math.abs((f+3*Math.PI)%(Math.PI*2)-Math.PI),l.push({distance:o,angleDelta:f}),u+=f;o-l[0].distance>i;)u-=l.shift().angleDelta;if(u>n)return!1;s++,o+=c.dist(p)}return!0}function bf(t){let e=0;for(let r=0;r<t.length-1;r++)e+=t[r].dist(t[r+1]);return e}function wf(t,e,r){return t?3/5*e*r:0}function _f(t,e){return Math.max(t?t.right-t.left:0,e?e.right-e.left:0)}function jb(t,e,r,i,n,a){let s=wf(r,n,a),o=_f(r,i)*a,l=0,u=bf(t)/2;for(let h=0;h<t.length-1;h++){let c=t[h],p=t[h+1],f=c.dist(p);if(l+f>u){let d=(u-l)/f,y=new ur(Pe.number(c.x,p.x,d),Pe.number(c.y,p.y,d),p.angleTo(c),h);return y._round(),!s||vf(t,y,o,s,e)?y:void 0}l+=f}}function Yb(t,e,r,i,n,a,s,o,l){let u=wf(i,a,s),h=_f(i,n),c=h*s,p=t[0].x===0||t[0].x===l||t[0].y===0||t[0].y===l;e-c<e/4&&(e=c+e/4);let f=a*2;return Sf(t,p?e/2*o%e:(h/2+f)*s*o%e,e,u,r,c,p,!1,l)}function Sf(t,e,r,i,n,a,s,o,l){let u=a/2,h=bf(t),c=0,p=e-r,f=[];for(let d=0;d<t.length-1;d++){let y=t[d],m=t[d+1],g=y.dist(m),x=m.angleTo(y);for(;p+r<c+g;){p+=r;let b=(p-c)/g,v=Pe.number(y.x,m.x,b),w=Pe.number(y.y,m.y,b);if(v>=0&&v<l&&w>=0&&w<l&&p-u>=0&&p+u<=h){let A=new ur(v,w,x,d);A._round(),(!i||vf(t,A,a,i,n))&&f.push(A)}}c+=g}return!o&&!f.length&&!s&&(f=Sf(t,c/2,r,i,n,a,s,!0,l)),f}function qu(t,e,r,i){let n=[],a=t.image,s=a.pixelRatio,o=a.paddedRect.w-2,l=a.paddedRect.h-2,u={x1:t.left,y1:t.top,x2:t.right,y2:t.bottom},h=a.stretchX||[[0,o]],c=a.stretchY||[[0,l]],p=(F,V)=>F+V[1]-V[0],f=h.reduce(p,0),d=c.reduce(p,0),y=o-f,m=l-d,g=0,x=f,b=0,v=d,w=0,A=y,S=0,D=m;if(a.content&&i){let F=a.content,V=F[2]-F[0],R=F[3]-F[1];(a.textFitWidth||a.textFitHeight)&&(u=Mp(t)),g=$i(h,0,F[0]),b=$i(c,0,F[1]),x=$i(h,F[0],F[2]),v=$i(c,F[1],F[3]),w=F[0]-g,S=F[1]-b,A=V-x,D=R-v}let E=u.x1,L=u.y1,$=u.x2-E,P=u.y2-L,z=(F,V,R,B)=>{let G=Ni(F.stretch-g,x,$,E),W=Ui(F.fixed-w,A,F.stretch,f),ft=Ni(V.stretch-b,v,P,L),tt=Ui(V.fixed-S,D,V.stretch,d),ct=Ni(R.stretch-g,x,$,E),$t=Ui(R.fixed-w,A,R.stretch,f),Ge=Ni(B.stretch-b,v,P,L),be=Ui(B.fixed-S,D,B.stretch,d),je=new M(G,ft),Ye=new M(ct,ft),_i=new M(ct,Ge),Si=new M(G,Ge),qn=new M(W/s,tt/s),Gn=new M($t/s,be/s),At=e*Math.PI/180;if(At){let Ei=Math.sin(At),Dt=Math.cos(At),xt=[Dt,-Ei,Ei,Dt];je._matMult(xt),Ye._matMult(xt),Si._matMult(xt),_i._matMult(xt)}let we=F.stretch+F.fixed,Ai=R.stretch+R.fixed,Di=V.stretch+V.fixed,jn=B.stretch+B.fixed;return{tl:je,tr:Ye,bl:Si,br:_i,tex:{x:a.paddedRect.x+1+we,y:a.paddedRect.y+1+Di,w:Ai-we,h:jn-Di},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:qn,pixelOffsetBR:Gn,minFontScaleX:A/s/$,minFontScaleY:D/s/P,isSDF:r}};if(!i||!a.stretchX&&!a.stretchY)n.push(z({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:o+1},{fixed:0,stretch:l+1}));else{let F=Gu(h,y,f),V=Gu(c,m,d);for(let R=0;R<F.length-1;R++){let B=F[R],G=F[R+1];for(let W=0;W<V.length-1;W++){let ft=V[W],tt=V[W+1];n.push(z(B,ft,G,tt))}}}return n}function $i(t,e,r){let i=0;for(let n of t)i+=Math.max(e,Math.min(r,n[1]))-Math.max(e,Math.min(r,n[0]));return i}function Gu(t,e,r){let i=[{fixed:-1,stretch:0}];for(let[n,a]of t){let s=i[i.length-1];i.push({fixed:n-s.stretch,stretch:s.stretch}),i.push({fixed:n-s.stretch,stretch:s.stretch+(a-n)})}return i.push({fixed:e+1,stretch:r}),i}function Ni(t,e,r,i){return t/e*r+i}function Ui(t,e,r,i){return t-e*r/i}function Xb(t,e,r,i,n,a,s,o){let l=i.layout.get("text-rotate").evaluate(a,{})*Math.PI/180,u=[];for(let h of e.positionedLines)for(let c of h.positionedGlyphs){if(!c.rect)continue;let p=c.rect||{},f=4,d=!0,y=1,m=0,g=(n||o)&&c.vertical,x=c.metrics.advance*c.scale/2;if(o&&e.verticalizable){let B=(c.scale-1)*24,G=(24-c.metrics.width*c.scale)/2;m=h.lineOffset/2-(c.imageName?-G:B)}if(c.imageName){let B=s[c.imageName];d=B.sdf,y=B.pixelRatio,f=1/y}let b=n?[c.x+x,c.y]:[0,0],v=n?[0,0]:[c.x+x+r[0],c.y+r[1]-m],w=[0,0];g&&(w=v,v=[0,0]);let A=c.metrics.isDoubleResolution?2:1,S=(c.metrics.left-f)*c.scale-x+v[0],D=(-c.metrics.top-f)*c.scale+v[1],E=S+p.w/A*c.scale/y,L=D+p.h/A*c.scale/y,$=new M(S,D),P=new M(E,D),z=new M(S,L),F=new M(E,L);if(g){let B=new M(-x,x- -17),G=-Math.PI/2,W=12-x,ft=c.imageName?W:0,tt=new M(22-W,-ft),ct=new M(...w);$._rotateAround(G,B)._add(tt)._add(ct),P._rotateAround(G,B)._add(tt)._add(ct),z._rotateAround(G,B)._add(tt)._add(ct),F._rotateAround(G,B)._add(tt)._add(ct)}if(l){let B=Math.sin(l),G=Math.cos(l),W=[G,-B,B,G];$._matMult(W),P._matMult(W),z._matMult(W),F._matMult(W)}let V=new M(0,0),R=new M(0,0);u.push({tl:$,tr:P,bl:z,br:F,tex:p,writingMode:e.writingMode,glyphOffset:b,sectionIndex:c.sectionIndex,isSDF:d,pixelOffsetTL:V,pixelOffsetBR:R,minFontScaleX:0,minFontScaleY:0})}return u}var qi=class{constructor(t,e,r,i,n,a,s,o,l,u){if(this.boxStartIndex=t.length,l){let h=a.top,c=a.bottom,p=a.collisionPadding;p&&(h-=p[1],c+=p[3]);let f=c-h;f>0&&(f=Math.max(10,f),this.circleDiameter=f)}else{let h=a.image?.content&&(a.image.textFitWidth||a.image.textFitHeight)?Mp(a):{x1:a.left,y1:a.top,x2:a.right,y2:a.bottom};h.y1=h.y1*s-o[0],h.y2=h.y2*s+o[2],h.x1=h.x1*s-o[3],h.x2=h.x2*s+o[1];let c=a.collisionPadding;if(c&&(h.x1-=c[0]*s,h.y1-=c[1]*s,h.x2+=c[2]*s,h.y2+=c[3]*s),u){let p=new M(h.x1,h.y1),f=new M(h.x2,h.y1),d=new M(h.x1,h.y2),y=new M(h.x2,h.y2),m=u*Math.PI/180;p._rotate(m),f._rotate(m),d._rotate(m),y._rotate(m),h.x1=Math.min(p.x,f.x,d.x,y.x),h.x2=Math.max(p.x,f.x,d.x,y.x),h.y1=Math.min(p.y,f.y,d.y,y.y),h.y2=Math.max(p.y,f.y,d.y,y.y)}t.emplaceBack(e.x,e.y,h.x1,h.y1,h.x2,h.y2,r,i,n)}this.boxEndIndex=t.length}},Zb=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}};function Wb(t,e=1){let r=cn.fromPoints(t[0]),i=Math.min(r.width(),r.height()),n=i/2,a=new Zb([],Hb),{minX:s,minY:o,maxX:l,maxY:u}=r;if(i===0)return new M(s,o);for(let p=s;p<l;p+=i)for(let f=o;f<u;f+=i)a.push(new Qe(p+n,f+n,n,t));let h=Jb(t),c=h;for(;a.length;){let p=a.pop();(p.d>c.d||!c.d)&&(c=p),!(p.max-c.d<=e)&&(n=p.h/2,a.push(new Qe(p.p.x-n,p.p.y-n,n,t)),a.push(new Qe(p.p.x+n,p.p.y-n,n,t)),a.push(new Qe(p.p.x-n,p.p.y+n,n,t)),a.push(new Qe(p.p.x+n,p.p.y+n,n,t)))}return h.d>0&&c.d-h.d<=e?h.p:c.p}function Hb(t,e){return e.max-t.max}var Qe=class{constructor(t,e,r,i){this.p=new M(t,e),this.h=r,this.d=Kb(this.p,i),this.max=this.d+this.h*Math.SQRT2}};function Kb(t,e){let r=!1,i=1/0;for(let n of e)for(let a=0,s=n.length,o=s-1;a<s;o=a++){let l=n[a],u=n[o];l.y>t.y!=u.y>t.y&&t.x<(u.x-l.x)*(t.y-l.y)/(u.y-l.y)+l.x&&(r=!r),i=Math.min(i,Xc(t,l,u))}return(r?1:-1)*Math.sqrt(i)}function Jb(t){let e=0,r=0,i=0,n=t[0];for(let a=0,s=n.length,o=s-1;a<s;o=a++){let l=n[a],u=n[o],h=l.x*u.y-u.x*l.y;r+=(l.x+u.x)*h,i+=(l.y+u.y)*h,e+=h*3}return new Qe(r/e,i/e,0,t)}var Qb=(function(t){return t[t.center=1]="center",t[t.left=2]="left",t[t.right=3]="right",t[t.top=4]="top",t[t.bottom=5]="bottom",t[t["top-left"]=6]="top-left",t[t["top-right"]=7]="top-right",t[t["bottom-left"]=8]="bottom-left",t[t["bottom-right"]=9]="bottom-right",t})({}),jo=1/0;function Af(t,e){function r(n,a){let s=0,o=0;a<0&&(a=0);let l=a/Math.SQRT2;switch(n){case"top-right":case"top-left":o=l-7;break;case"bottom-right":case"bottom-left":o=-l+7;break;case"bottom":o=-a+7;break;case"top":o=a-7}switch(n){case"top-right":case"bottom-right":s=-l;break;case"top-left":case"bottom-left":s=l;break;case"left":s=a;break;case"right":s=-a}return[s,o]}function i(n,a,s){let o=0,l=0;switch(a=Math.abs(a),s=Math.abs(s),n){case"top-right":case"top-left":case"top":l=s-7;break;case"bottom-right":case"bottom-left":case"bottom":l=-s+7}switch(n){case"top-right":case"bottom-right":case"right":o=-a;break;case"top-left":case"bottom-left":case"left":o=a}return[o,l]}return e[1]===jo?r(t,e[0]):i(t,e[0],e[1])}function Df(t,e,r){let i=t.layout,n=i.get("text-variable-anchor-offset")?.evaluate(e,{},r);if(n){let s=n.values,o=[];for(let l=0;l<s.length;l+=2){let u=o[l]=s[l],h=s[l+1].map(c=>c*24);u.startsWith("top")?h[1]-=7:u.startsWith("bottom")&&(h[1]+=7),o[l+1]=h}return new Ht(o)}let a=i.get("text-variable-anchor");if(a){let s;s=t._unevaluatedLayout.getValue("text-radial-offset")===void 0?i.get("text-offset").evaluate(e,{},r).map(l=>l*24):[i.get("text-radial-offset").evaluate(e,{},r)*24,jo];let o=[];for(let l of a)o.push(l,Af(l,s));return new Ht(o)}return null}function Ef(t){t.bucket.createArrays();let e=512*t.bucket.overscaling;t.bucket.tilePixelRatio=it/e,t.bucket.compareText={},t.bucket.iconsNeedLinear=!1;let r=t.bucket.layers[0],i=r.layout,n=r._unevaluatedLayout._values,a={layoutIconSize:n["icon-size"].possiblyEvaluate(new H(t.bucket.zoom+1),t.canonical),layoutTextSize:n["text-size"].possiblyEvaluate(new H(t.bucket.zoom+1),t.canonical),textMaxSize:n["text-size"].possiblyEvaluate(new H(18))};if(t.bucket.textSizeData.kind==="composite"){let{minZoom:h,maxZoom:c}=t.bucket.textSizeData;a.compositeTextSizes=[n["text-size"].possiblyEvaluate(new H(h),t.canonical),n["text-size"].possiblyEvaluate(new H(c),t.canonical)]}if(t.bucket.iconSizeData.kind==="composite"){let{minZoom:h,maxZoom:c}=t.bucket.iconSizeData;a.compositeIconSizes=[n["icon-size"].possiblyEvaluate(new H(h),t.canonical),n["icon-size"].possiblyEvaluate(new H(c),t.canonical)]}let s=i.get("text-line-height")*24,o=i.get("text-rotation-alignment")!=="viewport"&&i.get("symbol-placement")!=="point",l=i.get("text-keep-upright"),u=i.get("text-size");for(let h of t.bucket.features){let c=i.get("text-font").evaluate(h,{},t.canonical).join(","),p=u.evaluate(h,{},t.canonical),f=a.layoutTextSize.evaluate(h,{},t.canonical),d=a.layoutIconSize.evaluate(h,{},t.canonical),y={horizontal:{},vertical:void 0},m=h.text,g=[0,0];if(m){let w=m.toString(),A=i.get("text-letter-spacing").evaluate(h,{},t.canonical)*24,S=bm(w)?A:0,D=i.get("text-anchor").evaluate(h,{},t.canonical),E=Df(r,h,t.canonical);if(!E){let z=i.get("text-radial-offset").evaluate(h,{},t.canonical);g=z?Af(D,[z*24,jo]):i.get("text-offset").evaluate(h,{},t.canonical).map(F=>F*24)}let L=o?"center":i.get("text-justify").evaluate(h,{},t.canonical),$=i.get("symbol-placement")==="point"?i.get("text-max-width").evaluate(h,{},t.canonical)*24:1/0,P=()=>{t.bucket.allowVerticalPlacement&&Ia(w)&&(y.vertical=Oi(m,t.glyphMap,t.glyphPositions,t.imagePositions,c,$,s,D,"left",S,g,2,!0,f,p))};if(!o&&E){let z=new Set;if(L==="auto")for(let V=0;V<E.values.length;V+=2)z.add(ju(E.values[V]));else z.add(L);let F=!1;for(let V of z)if(!y.horizontal[V])if(F)y.horizontal[V]=y.horizontal[0];else{let R=Oi(m,t.glyphMap,t.glyphPositions,t.imagePositions,c,$,s,"center",V,S,g,1,!1,f,p);R&&(y.horizontal[V]=R,F=R.positionedLines.length===1)}P()}else{L==="auto"&&(L=ju(D));let z=Oi(m,t.glyphMap,t.glyphPositions,t.imagePositions,c,$,s,D,L,S,g,1,!1,f,p);z&&(y.horizontal[L]=z),P(),Ia(w)&&o&&l&&(y.vertical=Oi(m,t.glyphMap,t.glyphPositions,t.imagePositions,c,$,s,D,L,S,g,2,!1,f,p))}}let x,b=!1;if(h.icon?.name){let w=t.imageMap[h.icon.name];w&&(x=Ex(t.imagePositions[h.icon.name],i.get("icon-offset").evaluate(h,{},t.canonical),i.get("icon-anchor").evaluate(h,{},t.canonical)),b=!!w.sdf,t.bucket.sdfIcons===void 0?t.bucket.sdfIcons=b:t.bucket.sdfIcons!==b&>("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),w.pixelRatio===t.bucket.pixelRatio?i.get("icon-rotate").constantOr(1)!==0&&(t.bucket.iconsNeedLinear=!0):t.bucket.iconsNeedLinear=!0)}let v=Tf(y.horizontal)||y.vertical;t.bucket.iconsInText||=v?v.iconsInText:!1,(v||x)&&tw(t.bucket,h,y,x,t.imageMap,a,f,d,g,b,t.canonical,t.subdivisionGranularity)}t.showCollisionBoxes&&t.bucket.generateCollisionDebugBuffers()}function ju(t){switch(t){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function tw(t,e,r,i,n,a,s,o,l,u,h,c){let p=a.textMaxSize.evaluate(e,{});p===void 0&&(p=s);let f=t.layers[0].layout,d=f.get("icon-offset").evaluate(e,{},h),y=Tf(r.horizontal),m=s/24,g=t.tilePixelRatio*m,x=t.tilePixelRatio*p/24,b=t.tilePixelRatio*o,v=t.tilePixelRatio*f.get("symbol-spacing"),w=f.get("text-padding")*t.tilePixelRatio,A=Vx(f,e,h,t.tilePixelRatio),S=f.get("text-max-angle")/180*Math.PI,D=f.get("text-rotation-alignment")!=="viewport"&&f.get("symbol-placement")!=="point",E=f.get("icon-rotation-alignment").constantOr("viewport")==="map"&&f.get("symbol-placement")!=="point",L=f.get("symbol-placement"),$=v/2,P=f.get("icon-text-fit"),z;i&&P!=="none"&&(t.allowVerticalPlacement&&r.vertical&&(z=wu(i,r.vertical,P,f.get("icon-text-fit-padding"),d,m)),y&&(i=wu(i,y,P,f.get("icon-text-fit-padding"),d,m)));let F=h?c.line.getGranularityForZoomLevel(h.z):1,V=(R,B)=>{B.x<0||B.x>=8192||B.y<0||B.y>=8192||rw(t,B,R,r,i,n,z,t.layers[0],t.collisionBoxArray,e.index,e.sourceLayerIndex,t.index,g,[w,w,w,w],D,l,b,A,E,d,e,a,u,h,s)};if(L==="line")for(let R of $b(e.geometry,0,0,it,it)){let B=Fe(R,F),G=Yb(B,v,S,r.vertical||y,i,24,x,t.overscaling,it);for(let W of G){let ft=y;(!ft||!iw(t,ft.text,$,W))&&V(B,W)}}else if(L==="line-center"){for(let R of e.geometry)if(R.length>1){let B=Fe(R,F),G=jb(B,S,r.vertical||y,i,24,x);G&&V(B,G)}}else if(e.type==="Polygon")for(let R of Sn(e.geometry,0)){let B=Wb(R,16);V(Fe(R[0],F,!0),new ur(B.x,B.y,0))}else if(e.type==="LineString")for(let R of e.geometry){let B=Fe(R,F);V(B,new ur(B[0].x,B[0].y,0))}else if(e.type==="Point")for(let R of e.geometry)for(let B of R)V([B],new ur(B.x,B.y,0))}function ew(t,e){let r=t.length,i=e?.values;if(i?.length>0)for(let n=0;n<i.length;n+=2){let a=Qb[i[n]],s=i[n+1];t.emplaceBack(a,s[0],s[1])}return[r,t.length]}function Yu(t,e,r,i,n,a,s,o,l,u,h,c,p,f,d,y){let m=Xb(e,r,o,n,a,s,i,t.allowVerticalPlacement),g=t.textSizeData,x=null;g.kind==="source"?(x=[128*n.layout.get("text-size").evaluate(s,{})],x[0]>32640&>(`${t.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):g.kind==="composite"&&(x=[128*d.compositeTextSizes[0].evaluate(s,{},y),128*d.compositeTextSizes[1].evaluate(s,{},y)],(x[0]>32640||x[1]>32640)&>(`${t.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),t.addSymbols(t.text,m,x,o,a,s,h,e,u.lineStartIndex,u.lineLength,f,y,l);for(let b of c)p[b]=t.text.placedSymbolArray.length-1;return m.length*4}function Tf(t){for(let e in t)return t[e];return null}function rw(t,e,r,i,n,a,s,o,l,u,h,c,p,f,d,y,m,g,x,b,v,w,A,S,D){let E=t.addToLineVertexArray(e,r),L=o.layout.get("symbol-height-offset").evaluate(v,{},S),$,P,z,F,V=0,R=0,B=0,G=0,W=-1,ft=-1,tt={},ct=(0,Ja.default)("");if(t.allowVerticalPlacement&&i.vertical){let Dt=o.layout.get("text-rotate").evaluate(v,{},S)+90,xt=i.vertical;z=new qi(l,e,u,h,c,xt,p,f,d,Dt),s&&(F=new qi(l,e,u,h,c,s,m,g,d,Dt))}if(n){let Dt=o.layout.get("icon-rotate").evaluate(v,{}),xt=o.layout.get("icon-text-fit")!=="none",Sr=qu(n,Dt,A,xt),Yn=s?qu(s,Dt,A,xt):void 0;P=new qi(l,e,u,h,c,n,m,g,!1,Dt),V=Sr.length*4;let Zo=t.iconSizeData,_e=null;Zo.kind==="source"?(_e=[128*o.layout.get("icon-size").evaluate(v,{})],_e[0]>32640&>(`${t.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):Zo.kind==="composite"&&(_e=[128*w.compositeIconSizes[0].evaluate(v,{},S),128*w.compositeIconSizes[1].evaluate(v,{},S)],(_e[0]>32640||_e[1]>32640)&>(`${t.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),t.addSymbols(t.icon,Sr,_e,b,x,v,0,e,E.lineStartIndex,E.lineLength,-1,S,L),W=t.icon.placedSymbolArray.length-1,Yn&&(R=Yn.length*4,t.addSymbols(t.icon,Yn,_e,b,x,v,2,e,E.lineStartIndex,E.lineLength,-1,S,L),ft=t.icon.placedSymbolArray.length-1)}let $t=Object.keys(i.horizontal);for(let Dt of $t){let xt=i.horizontal[Dt];$||=(ct=(0,Ja.default)(xt.text),new qi(l,e,u,h,c,xt,p,f,d,o.layout.get("text-rotate").evaluate(v,{},S)));let Sr=xt.positionedLines.length===1;if(B+=Yu(t,e,xt,a,o,d,v,y,L,E,i.vertical?1:3,Sr?$t:[Dt],tt,W,w,S),Sr)break}i.vertical&&(G+=Yu(t,e,i.vertical,a,o,d,v,y,L,E,2,["vertical"],tt,ft,w,S));let Ge=$?$.boxStartIndex:t.collisionBoxArray.length,be=$?$.boxEndIndex:t.collisionBoxArray.length,je=z?z.boxStartIndex:t.collisionBoxArray.length,Ye=z?z.boxEndIndex:t.collisionBoxArray.length,_i=P?P.boxStartIndex:t.collisionBoxArray.length,Si=P?P.boxEndIndex:t.collisionBoxArray.length,qn=F?F.boxStartIndex:t.collisionBoxArray.length,Gn=F?F.boxEndIndex:t.collisionBoxArray.length,At=-1,we=(Dt,xt)=>Dt?.circleDiameter?Math.max(Dt.circleDiameter,xt):xt;At=we($,At),At=we(z,At),At=we(P,At),At=we(F,At);let Ai=+(At>-1);Ai&&(At*=D/24),t.glyphOffsetArray.length>=Ce.MAX_GLYPHS&>("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),v.sortKey!==void 0&&t.addToSortKeyRanges(t.symbolInstances.length,v.sortKey);let Di=Df(o,v,S),[jn,Ei]=ew(t.textAnchorOffsets,Di);t.symbolInstances.emplaceBack(e.x,e.y,tt.right>=0?tt.right:-1,tt.center>=0?tt.center:-1,tt.left>=0?tt.left:-1,tt.vertical||-1,W,ft,ct,Ge,be,je,Ye,_i,Si,qn,Gn,u,B,G,V,R,Ai,0,p,At,jn,Ei,L)}function iw(t,e,r,i){let n=t.compareText;if(!(e in n))n[e]=[];else{let a=n[e];for(let s=a.length-1;s>=0;s--)if(i.dist(a[s])<r)return!0}return n[e].push(i),!1}/**\n* MapLibre GL JS\n* @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v6.7.0/LICENSE.txt\n*/function Xo(t){let e=typeof t;if(e==="number"||e==="boolean"||e==="string"||t==null)return JSON.stringify(t);if(Array.isArray(t)){let n="[";for(let a of t)n+=`${Xo(a)},`;return`${n}]`}let r=Object.keys(t).sort(),i="{";for(let n=0;n<r.length;n++)i+=`${JSON.stringify(r[n])}:${Xo(t[r[n]])},`;return`${i}}`}function nw(t){let e="";for(let r of ah)e+=`/${Xo(t[r])}`;return e}function aw(t,e){let r={};for(let n=0;n<t.length;n++){let a=e&&e[t[n].id]||nw(t[n]);e&&(e[t[n].id]=a);let s=r[a];s||=r[a]=[],s.push(t[n])}let i=[];for(let n in r)i.push(r[n]);return i}var sw=class{constructor(t,e){this.keyCache={},t&&this.replace(t,e)}replace(t,e){this._layerConfigs={},this._layers={},this.update(t,[],e)}update(t,e,r){for(let n of t){this._layerConfigs[n.id]=n;let a=this._layers[n.id]=Pp(n,r);a._featureFilter=yr(a.filter,`layers[${n.id}].filter`,r),this.keyCache[n.id]&&delete this.keyCache[n.id]}for(let n of e)delete this.keyCache[n],delete this._layerConfigs[n],delete this._layers[n];this.familiesBySource={};let i=aw(Object.values(this._layerConfigs),this.keyCache);for(let n of i){let a=n.map(c=>this._layers[c.id]),s=a[0];if(s.isHidden())continue;let o=s.source||"",l=this.familiesBySource[o];l||=this.familiesBySource[o]={};let u=s.sourceLayer||"_geojsonTileLayer",h=l[u];h||=l[u]=[],h.push(a)}}},kf=class{constructor(t){let e={},r=[];for(let s in t){let o=t[s],l=e[s]={};for(let u in o){let h=o[u];if(!h||h.bitmap.width===0||h.bitmap.height===0)continue;let c={x:0,y:0,w:h.bitmap.width+2,h:h.bitmap.height+2};r.push(c),l[u]={rect:c,metrics:h.metrics}}}let{w:i,h:n}=So(r),a=new Vn({width:i||1,height:n||1});for(let s in t){let o=t[s];for(let l in o){let u=o[l];if(!u||u.bitmap.width===0||u.bitmap.height===0)continue;let h=e[s][l].rect;Vn.copy(u.bitmap,a,{x:0,y:0},{x:h.x+1,y:h.y+1},u.bitmap)}}this.image=a,this.positions=e}};I("GlyphAtlas",kf);var If=class{constructor(t){this.tileID=new Do(t.tileID.overscaledZ,t.tileID.wrap,t.tileID.canonical.z,t.tileID.canonical.x,t.tileID.canonical.y),this.uid=t.uid,this.zoom=t.zoom,this.pixelRatio=t.pixelRatio,this.tileSize=t.tileSize,this.source=t.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=t.showCollisionBoxes,this.collectResourceTiming=!!t.collectResourceTiming,this.returnDependencies=!!t.returnDependencies,this.promoteId=t.promoteId,this.inFlightDependencies=[]}async parse(t,e,r,i,n){this.data=t,this.collisionBoxArray=new to;let a=new To(Object.keys(t.layers).sort()),s=new Go(this.tileID,this.promoteId);s.bucketLayerIDs=[];let o={},l={featureIndex:s,iconDependencies:{},patternDependencies:{},glyphDependencies:{},dashDependencies:{},availableImages:r,subdivisionGranularity:n},u=e.familiesBySource[this.source];for(let D in u){let E=t.layers[D];if(!E)continue;E.version===1&>(`Vector tile source "${this.source}" layer "${D}" does not use vector tile spec v2 and therefore may have some rendering errors.`);let L=a.encode(D),$=[];for(let P=0;P<E.length;P++){let z=E.feature(P),F=s.getId(z,D);$.push({feature:z,id:F,index:P,sourceLayerIndex:L})}for(let P of u[D]){let z=P[0];z.source!==this.source&>(`layer.source = ${z.source} does not equal this.source = ${this.source}`),!z.isHidden(this.zoom,!0)&&(Yo(P,this.zoom,r),(o[z.id]=z.createBucket({index:s.bucketLayerIDs.length,layers:P,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:L,sourceID:this.source})).populate($,l,this.tileID.canonical),s.bucketLayerIDs.push(P.map(F=>F.id)))}}let h=dn(l.glyphDependencies,D=>Object.keys(D));for(let D of this.inFlightDependencies)D?.abort();this.inFlightDependencies=[];let c=Promise.resolve({});if(Object.keys(h).length){let D=new AbortController;this.inFlightDependencies.push(D),c=i.sendAsync({type:"GG",data:{stacks:h,source:this.source,tileID:this.tileID,type:"glyphs"}},D)}let p=Object.keys(l.iconDependencies),f=Promise.resolve({});if(p.length){let D=new AbortController;this.inFlightDependencies.push(D),f=i.sendAsync({type:"GI",data:{icons:p,source:this.source,tileID:this.tileID,type:"icons"}},D)}let d=Object.keys(l.patternDependencies),y=Promise.resolve({});if(d.length){let D=new AbortController;this.inFlightDependencies.push(D),y=i.sendAsync({type:"GI",data:{icons:d,source:this.source,tileID:this.tileID,type:"patterns"}},D)}let m=l.dashDependencies,g=Promise.resolve({});if(Object.keys(m).length){let D=new AbortController;this.inFlightDependencies.push(D),g=i.sendAsync({type:"GDA",data:{dashes:m}},D)}let[x,b,v,w]=await Promise.all([c,f,y,g]),A=new kf(x),S=new Ao(b,v);for(let D in o){let E=o[D];E instanceof Ce?(Yo(E.layers,this.zoom,r),Ef({bucket:E,glyphMap:x,glyphPositions:A.positions,imageMap:b,imagePositions:S.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:l.subdivisionGranularity})):E.hasDependencies&&(E instanceof On||E instanceof Rn||E instanceof $n)&&(Yo(E.layers,this.zoom,r),E.addFeatures(l,this.tileID.canonical,S.patternPositions,w))}return{buckets:Object.values(o).filter(D=>!D.isEmpty()),featureIndex:s,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:A.image,imageAtlas:S,dashPositions:w,glyphMap:this.returnDependencies?x:null,iconMap:this.returnDependencies?b:null,glyphPositions:this.returnDependencies?A.positions:null}}};function Yo(t,e,r){let i=new H(e);for(let n of t)n.recalculate(i,r)}var Mf=class{constructor(){this.loading={},this.loaded={},this.parsing={}}startLoading(t,e){this.loading[t]=e}finishLoading(t){delete this.loading[t]}abort(t){let e=this.loading[t];e?.abort&&(e.abort.abort(),delete this.loading[t])}getParsing(t){return this.parsing[t]}setParsing(t,e){this.parsing[t]=e}removeParsing(t){delete this.parsing[t]}markLoaded(t,e){this.loaded[t]=e}getLoaded(t){let e=this.loaded[t];if(e)return e}removeLoaded(t){delete this.loaded[t]}clearLoaded(){this.loaded={}}},Cf=class{constructor(t){this.start=`${t}#start`,this.end=`${t}#end`,this.measure=t,performance.mark(this.start)}finish(){performance.mark(this.end);let t=performance.getEntriesByName(this.measure);return t.length===0&&(performance.measure(this.measure,this.start,this.end),t=performance.getEntriesByName(this.measure),performance.clearMarks(this.start),performance.clearMarks(this.end),performance.clearMeasures(this.measure)),t}},ow=class{constructor(t,e,r,i,n){this.type=t,this.properties=r||{},this.extent=n,this.pointsArray=e,this.id=i}loadGeometry(){return this.pointsArray.map(t=>t.map(e=>new M(e.x,e.y)))}},lw=class{constructor(t,e,r){this.version=2,this._myFeatures=t,this.name=e,this.length=t.length,this.extent=r}feature(t){return this._myFeatures[t]}},uw=class{constructor(){this.layers={}}addLayer(t){this.layers[t.name]=t}};function hw(t,e,r){let{extent:i}=t,n=2**(r.z-e.z),a=(r.x-e.x*n)*i,s=(r.y-e.y*n)*i,o=[];for(let l=0;l<t.length;l++){let u=t.feature(l),h=u.loadGeometry();for(let c of h)for(let p of c)p.x=p.x*n-a,p.y=p.y*n-s;h=gf(h,u.type,-128,-128,i+128,i+128),h.length!==0&&o.push(new ow(u.type,h,u.properties,u.id,i))}return new lw(o,t.name,i)}var cw=class{constructor(t,e,r){this.actor=t,this.layerIndex=e,this.availableImages=r,this.tileState=new Mf,this.overzoomedTileResultCache=new mf(1e3)}loadVectorTile(t,e){try{return{vectorTile:t.encoding==="mlt"?new qo(e):new ho(new _o(e)),rawData:e}}catch(r){let i=new Uint8Array(e),n=i[0]===31&&i[1]===139,a=`Unable to parse the tile at ${t.request.url}, `;throw a+=n?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${Wr(r).message}`,Error(a)}}async loadTile(t){let{uid:e,overzoomParameters:r}=t;r&&(t.request=r.overzoomRequest);let i=this._startRequestTiming(t),n=new If(t);this.tileState.startLoading(e,n);let a=new AbortController;n.abort=a;try{let s=await rh(t.request,a);if(t.etag&&t.etag===s.etag)return this.tileState.finishLoading(e),this._getEtagUnmodifiedResult(s,i);let o=this.loadVectorTile(t,s.data);if(this.tileState.finishLoading(e),!o)return null;let{vectorTile:l,rawData:u}=o;r&&({vectorTile:l,rawData:u}=this._getOverzoomTile(t,l));let h=this._getExpiryData(s),c=this._finishRequestTiming(i);n.vectorTile=l,n.etag=s.etag,this.tileState.markLoaded(e,n);let p={rawData:u,cacheControl:h,resourceTiming:c};return this.tileState.setParsing(e,p),await this._parseWorkerTile(n,t)}catch(s){throw this.tileState.finishLoading(e),this.tileState.markLoaded(e,n),s}}_getEtagUnmodifiedResult(t,e){let r=this._getExpiryData(t),i=this._finishRequestTiming(e);return Tt({etagUnmodified:!0},r,i)}async _parseWorkerTile(t,e){let r=this.tileState.getParsing(t.uid),i=await t.parse(t.vectorTile,this.layerIndex,this.availableImages,this.actor,e.subdivisionGranularity);if(r){let{rawData:n,cacheControl:a,resourceTiming:s}=r,o=e.overzoomParameters?"mvt":e.encoding;i=Tt({rawTileData:n.slice(0),encoding:o},i,a,s),this.tileState.removeParsing(t.uid)}else t.etag&&(i=Tt(i,{etag:t.etag}));return i}_getExpiryData({expires:t,cacheControl:e,etag:r}){let i={};return t&&(i.expires=t),e&&(i.cacheControl=e),r&&(i.etag=r),i}_startRequestTiming(t){if(t.request?.collectResourceTiming)return new Cf(t.request.url)}_finishRequestTiming(t){let e=t?.finish();return e?{resourceTiming:JSON.parse(JSON.stringify(e))}:{}}_getOverzoomTile(t,e){let{tileID:r,source:i,overzoomParameters:n}=t,{maxZoomTileID:a}=n,s=`${a.key}_${r.key}_${t.request?.url}`,o=this.overzoomedTileResultCache.get(s);if(o)return o;let l=new uw,u=this.layerIndex.familiesBySource[i];for(let c in u){let p=e.layers[c];if(!p)continue;let f=hw(p,a,r.canonical);f.length>0&&l.addLayer(f)}let h={vectorTile:l,rawData:Eo(l).buffer};return this.overzoomedTileResultCache.set(s,h),h}async reloadTile(t){let e=t.uid,r=this.tileState.getLoaded(e);if(!r)throw Error("Should not be trying to reload a tile that was never loaded or has been removed");if(r.vectorTile)return r.showCollisionBoxes=t.showCollisionBoxes,await this._parseWorkerTile(r,t)}async abortTile(t){this.tileState.abort(t.uid)}async removeTile(t){this.tileState.removeLoaded(t.uid)}},pw=class{constructor(){this.loaded={}}async loadTile(t){let{uid:e,encoding:r,rawImageData:i,redFactor:n,greenFactor:a,blueFactor:s,baseShift:o}=t,l=i.width+2,u=i.height+2,h=yn(i)?new kt({width:l,height:u},await Ku(i,-1,-1,l,u)):i,c=new lo(e,h,r,n,a,s,o);return this.loaded||={},this.loaded[e]=c,c}removeTile(t){let e=this.loaded,r=t.uid;e?.[r]&&delete e[r]}},fw=class{constructor(t,e,r,i=dw){this.actor=t,this.layerIndex=e,this.availableImages=r,this.tileState=new Mf,this._createGeoJSONIndex=i}loadVectorTile(t){if(!this._geoJSONIndex)throw Error("Unable to parse the data into a cluster or geojson");let{z:e,x:r,y:i}=t.tileID.canonical,n=this._geoJSONIndex.getTile(e,r,i);if(!n)return null;let a=new Vp(n.features,{version:2,extent:it});return{vectorTile:a,rawData:Eo(a,Hu).buffer}}async loadTile(t){let{uid:e}=t,r=new If(t);r.abort=new AbortController;try{let i=this.loadVectorTile(t);if(!i)return null;let{vectorTile:n,rawData:a}=i;r.vectorTile=n,this.tileState.markLoaded(e,r);let s={rawData:a};return this.tileState.setParsing(e,s),await this._parseWorkerTile(r,t)}catch(i){throw this.tileState.markLoaded(e,r),i}}async _parseWorkerTile(t,e){let r=this.tileState.getParsing(t.uid),i=await t.parse(t.vectorTile,this.layerIndex,this.availableImages,this.actor,e.subdivisionGranularity);if(r){let{rawData:n}=r;i=Tt({rawTileData:n.slice(0),encoding:"mvt"},i),this.tileState.removeParsing(t.uid)}return i}async abortTile(t){this.tileState.abort(t.uid)}async removeTile(t){this.tileState.removeLoaded(t.uid)}async loadData(t){this._pendingRequest?.abort();let e=this._startRequestTiming(t);this._pendingRequest=new AbortController;try{await this.loadAndProcessGeoJSON(t,this._pendingRequest),delete this._pendingRequest,this.tileState.clearLoaded();let r={};return t.request&&(r.data=t.data),this._finishRequestTiming(e,t,r),r}catch(r){if(delete this._pendingRequest,!Cs(r))throw r;return{abandoned:!0}}}_startRequestTiming(t){if(t.request?.collectResourceTiming)return new Cf(t.request.url)}_finishRequestTiming(t,e,r){let i=t?.finish();i&&(r.resourceTiming={[e.source]:JSON.parse(JSON.stringify(i))})}async reloadTile(t){let e=t.uid,r=this.tileState.getLoaded(e);if(!r)return await this.loadTile(t);if(r.vectorTile)return r.showCollisionBoxes=t.showCollisionBoxes,await this._parseWorkerTile(r,t)}async loadAndProcessGeoJSON(t,e){if(t.request&&(t.data=(await eh(t.request,e)).data),t.data){t.data=this._filterGeoJSON(t.data,t.filter,t.source),this._geoJSONIndex=this._createGeoJSONIndex(t.data,t);return}if(t.dataDiff){this._geoJSONIndex??=this._createGeoJSONIndex({type:"FeatureCollection",features:[]},t),this._geoJSONIndex.updateData(t.dataDiff,this._getFilterPredicate(t.filter,t.source));return}if(t.updateCluster&&this._geoJSONIndex.updateClusterOptions(t.geojsonVtOptions.cluster,Bf(t)),this._geoJSONIndex==null)throw Error(`Input data given to \'${t.source}\' is not a valid GeoJSON object.`)}_filterGeoJSON(t,e,r){if(t.type!=="FeatureCollection")return t;let i=this._getFilterPredicate(e,r);return i?{type:"FeatureCollection",features:t.features.filter(n=>i(n))}:t}_getFilterPredicate(t,e){if(typeof t!="boolean"&&!t?.length)return;let r=ve(t,`sources.${e}.filter`,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(r.result==="error")throw Error(r.value.map(i=>`${i.key}: ${i.message}`).join(", "));return i=>r.value.evaluate({zoom:0},i)}async removeSource(t){this._pendingRequest?.abort()}getClusterExpansionZoom(t){return this._geoJSONIndex.getClusterExpansionZoom(t.clusterId)}getClusterChildren(t){return this._geoJSONIndex.getClusterChildren(t.clusterId)}getClusterLeaves(t){return this._geoJSONIndex.getClusterLeaves(t.clusterId,t.limit,t.offset)}};function dw(t,e){let r=Tt(e.geojsonVtOptions||{},{updateable:!0,clusterOptions:Bf(e)});return new wp(t,r)}function Bf({geojsonVtOptions:t,clusterProperties:e,source:r}){if(!e||!t.clusterOptions)return t.clusterOptions;let i={},n={},a={accumulated:null,zoom:0},s={properties:null},o=Object.keys(e);for(let l of o){let[u,h]=e[l],c=ve(h,`sources.${r}.clusterProperties.${l}[1]`),p=ve(typeof u=="string"?[u,["accumulated"],["get",l]]:u,`sources.${r}.clusterProperties.${l}[0]`);i[l]=c.value,n[l]=p.value}return t.clusterOptions.map=l=>{s.properties=l;let u={};for(let h of o)u[h]=i[h].evaluate(a,s);return u},t.clusterOptions.reduce=(l,u)=>{s.properties=u;for(let h of o)a.accumulated=l[h],l[h]=n[h].evaluate(a,s)},t.clusterOptions}async function Ff(t){if(t.endsWith(".mjs")){await import(t);return}let e=await fetch(t,{credentials:"same-origin"});if(!e.ok)throw Error(`Failed to load ${t}: ${e.status}`);let r=await e.text();if(/^[ \\t]*(import|export)\\s/m.test(r)){let i=URL.createObjectURL(new Blob([r],{type:"text/javascript"}));try{await import(i)}finally{URL.revokeObjectURL(i)}return}globalThis.eval(r)}var yw=class{constructor(t){this.self=t,this.actor=new zp(t),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.globalStates=new Map,this.self.registerWorkerSource=(e,r)=>{if(this.externalWorkerSourceTypes[e])throw Error(`Worker source with name "${e}" already registered.`);this.externalWorkerSourceTypes[e]=r},this.self.addProtocol=Ju,this.self.removeProtocol=Qu,this.self.registerRTLTextPlugin=e=>{Jt.setMethods(e)},this.self.makeRequest=mn,this.actor.registerMessageHandler("LDT",(e,r)=>this._getDEMWorkerSource(e,r.source).loadTile(r)),this.actor.registerMessageHandler("RDT",async(e,r)=>{this._getDEMWorkerSource(e,r.source).removeTile(r)}),this.actor.registerMessageHandler("GCEZ",async(e,r)=>this._getWorkerSource(e,r.type,r.source).getClusterExpansionZoom(r)),this.actor.registerMessageHandler("GCC",async(e,r)=>this._getWorkerSource(e,r.type,r.source).getClusterChildren(r)),this.actor.registerMessageHandler("GCL",async(e,r)=>this._getWorkerSource(e,r.type,r.source).getClusterLeaves(r)),this.actor.registerMessageHandler("LD",(e,r)=>this._getWorkerSource(e,r.type,r.source).loadData(r)),this.actor.registerMessageHandler("LT",(e,r)=>this._getWorkerSource(e,r.type,r.source).loadTile(r)),this.actor.registerMessageHandler("RT",(e,r)=>this._getWorkerSource(e,r.type,r.source).reloadTile(r)),this.actor.registerMessageHandler("AT",(e,r)=>this._getWorkerSource(e,r.type,r.source).abortTile(r)),this.actor.registerMessageHandler("RMT",(e,r)=>this._getWorkerSource(e,r.type,r.source).removeTile(r)),this.actor.registerMessageHandler("RS",async(e,r)=>{if(!this.workerSources[e]?.[r.type]?.[r.source])return;let i=this.workerSources[e][r.type][r.source];delete this.workerSources[e][r.type][r.source],i.removeSource!==void 0&&i.removeSource(r)}),this.actor.registerMessageHandler("RM",async e=>{delete this.layerIndexes[e],delete this.availableImages[e],delete this.workerSources[e],delete this.demWorkerSources[e],this.globalStates.delete(e)}),this.actor.registerMessageHandler("SR",async(e,r)=>{this.referrer=r}),this.actor.registerMessageHandler("SRPS",(e,r)=>this._syncRTLPluginState(e,r)),this.actor.registerMessageHandler("IS",async(e,r)=>{await Ff(r)}),this.actor.registerMessageHandler("SI",(e,r)=>this._setImages(e,r)),this.actor.registerMessageHandler("UL",async(e,r)=>{this._getLayerIndex(e).update(r.layers,r.removedIds,this._getGlobalState(e))}),this.actor.registerMessageHandler("UGS",async(e,r)=>{let i=this._getGlobalState(e);for(let n in r)i[n]=r[n]}),this.actor.registerMessageHandler("SL",async(e,r)=>{this._getLayerIndex(e).replace(r,this._getGlobalState(e))})}_getGlobalState(t){let e=this.globalStates.get(t);return e||(e={},this.globalStates.set(t,e)),e}async _setImages(t,e){this.availableImages[t]=e;for(let r in this.workerSources[t]){let i=this.workerSources[t][r];for(let n in i)i[n].availableImages=e}}async _syncRTLPluginState(t,e){return await Jt.syncState(e,Ff)}_getAvailableImages(t){let e=this.availableImages[t];return e||=[],e}_getLayerIndex(t){let e=this.layerIndexes[t];return e||=this.layerIndexes[t]=new sw,e}_getWorkerSource(t,e,r){if(this.workerSources[t]||={},this.workerSources[t][e]||={},!this.workerSources[t][e][r]){let i={sendAsync:(n,a)=>(n.targetMapId=t,this.actor.sendAsync(n,a))};switch(e){case"vector":this.workerSources[t][e][r]=new cw(i,this._getLayerIndex(t),this._getAvailableImages(t));break;case"geojson":this.workerSources[t][e][r]=new fw(i,this._getLayerIndex(t),this._getAvailableImages(t));break;default:this.workerSources[t][e][r]=new this.externalWorkerSourceTypes[e](i,this._getLayerIndex(t),this._getAvailableImages(t))}}return this.workerSources[t][e][r]}_getDEMWorkerSource(t,e){return this.demWorkerSources[t]||={},this.demWorkerSources[t][e]||=new pw,this.demWorkerSources[t][e]}};Be(self)&&(self.worker=new yw(self));})();\n';
|
|
2
2
|
export {
|
|
3
3
|
e as default
|
|
4
4
|
};
|