const Vg=function(){const u=document.createElement("link").relList;if(u&&u.supports&&u.supports("modulepreload"))return;for(const I of document.querySelectorAll('link[rel="modulepreload"]'))x(I);new MutationObserver(I=>{for(const z of I)if(z.type==="childList")for(const R of z.addedNodes)R.tagName==="LINK"&&R.rel==="modulepreload"&&x(R)}).observe(document,{childList:!0,subtree:!0});function g(I){const z={};return I.integrity&&(z.integrity=I.integrity),I.referrerpolicy&&(z.referrerPolicy=I.referrerpolicy),I.crossorigin==="use-credentials"?z.credentials="include":I.crossorigin==="anonymous"?z.credentials="omit":z.credentials="same-origin",z}function x(I){if(I.ep)return;I.ep=!0;const z=g(I);fetch(I.href,z)}};Vg();async function Gg(){return(await fetch("/api/v0/directory/wms/radar?timezone=Europe/Oslo")).json()}async function qg({localeCode:s,locationId:u}){return(await fetch(`/api/v0/locations/${u}?language=${s}`)).json()}const jg=["en","nb","nn","sme"];function Zg(s){return jg.includes(s)}const Wg=["imperial","metric"],Hg=["beaufort","kmh","knots","mph","mps"],Xg=["celsius","fahrenheit"];function Yg(s){return Wg.includes(s)}function Kg(s){return Hg.includes(s)}function Jg(s){return Xg.includes(s)}function Qg(){const s=new URLSearchParams(location.search),u=s.get("locationId");if(u==null)throw new Error("Missing locationId from params");const g=s.get("layer"),x=s.get("localeCode");let I=s.get("length");const z=s.get("distance");I==null&&z==="mi"&&(I="imperial");const R=s.get("wind"),o=s.get("temperature"),G=s.get("background")??void 0;return{locationId:u,visibleMapType:g!=null&&ey(g)?g:"weather",localeCode:x!=null&&Zg(x)?x:"nb",units:{distance:I!=null&&Yg(I)?I:"metric",temperature:o!=null&&Jg(o)?o:"celsius",wind:R!=null&&Kg(R)?R:"mps"},backgroundColor:G}}function ey(s){return["radar","weather"].includes(s)}function Up(s,u){if(!(s instanceof u))throw new TypeError("Cannot call a class as a function")}function Ad(s,u){for(var g=0;g<u.length;g++){var x=u[g];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(s,x.key,x)}}function $p(s,u,g){return u&&Ad(s.prototype,u),g&&Ad(s,g),Object.defineProperty(s,"prototype",{writable:!1}),s}function Dh(s,u){return Dh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(x,I){return x.__proto__=I,x},Dh(s,u)}function ty(s,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function");s.prototype=Object.create(u&&u.prototype,{constructor:{value:s,writable:!0,configurable:!0}}),Object.defineProperty(s,"prototype",{writable:!1}),u&&Dh(s,u)}function Rh(s){return Rh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(u){return typeof u}:function(u){return u&&typeof Symbol=="function"&&u.constructor===Symbol&&u!==Symbol.prototype?"symbol":typeof u},Rh(s)}function iy(s){if(s===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return s}function ry(s,u){if(u&&(Rh(u)==="object"||typeof u=="function"))return u;if(u!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return iy(s)}function Xl(s){return Xl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(g){return g.__proto__||Object.getPrototypeOf(g)},Xl(s)}function ny(s){if(Array.isArray(s))return s}function ay(s,u){var g=s==null?null:typeof Symbol<"u"&&s[Symbol.iterator]||s["@@iterator"];if(g!=null){var x=[],I=!0,z=!1,R,o;try{for(g=g.call(s);!(I=(R=g.next()).done)&&(x.push(R.value),!(u&&x.length===u));I=!0);}catch(G){z=!0,o=G}finally{try{!I&&g.return!=null&&g.return()}finally{if(z)throw o}}return x}}function Cd(s,u){(u==null||u>s.length)&&(u=s.length);for(var g=0,x=new Array(u);g<u;g++)x[g]=s[g];return x}function sy(s,u){if(!!s){if(typeof s=="string")return Cd(s,u);var g=Object.prototype.toString.call(s).slice(8,-1);if(g==="Object"&&s.constructor&&(g=s.constructor.name),g==="Map"||g==="Set")return Array.from(s);if(g==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(g))return Cd(s,u)}}function oy(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ly(s,u){return ny(s)||ay(s,u)||sy(s,u)||oy()}function cy(s,u){if(s==null)return{};var g={},x=Object.keys(s),I,z;for(z=0;z<x.length;z++)I=x[z],!(u.indexOf(I)>=0)&&(g[I]=s[I]);return g}function Md(s,u){if(s==null)return{};var g=cy(s,u),x,I;if(Object.getOwnPropertySymbols){var z=Object.getOwnPropertySymbols(s);for(I=0;I<z.length;I++)x=z[I],!(u.indexOf(x)>=0)&&(!Object.prototype.propertyIsEnumerable.call(s,x)||(g[x]=s[x]))}return g}var $r=function(s){return typeof s=="string"},Bh=function(s){return typeof s=="function"},Pd=new Map,zd=new Map;function Yh(s){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},g=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2];return function(x){if($r(x)&&(x=new Date(x)),g){var I=Np(s,u),z=zd.get(I);if(z)return z.format(x);var R=new Intl.DateTimeFormat(s,u);return zd.set(I,R),R.format(x)}var o=new Intl.DateTimeFormat(s,u);return o.format(x)}}function Yl(s){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},g=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2];return function(x){if(g){var I=Np(s,u),z=Pd.get(I);if(z)return z.format(x);var R=new Intl.NumberFormat(s,u);return Pd.set(I,R),R.format(x)}var o=new Intl.NumberFormat(s,u);return o.format(x)}}function Np(s){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},g=Array.isArray(s)?s.sort().join("-"):s;return"".concat(g,"-").concat(JSON.stringify(u))}Object.freeze({__proto__:null,date:Yh,number:Yl});var Vp=/\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/g;function hy(s){var u=s.locale,g=s.locales,x=s.values,I=s.formats,z=s.localeData,R=function(o,G){var K=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{plurals:void 0},ge=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};G=G||o;var ae=K.plurals,H=function(we){return $r(we)?ge[we]||{style:we}:we},ke=function(we,$e){return function(Ve){var je=Bh($e)?$e(Ve):$e,Ge=Array.isArray(je)?je:[je],We=Yl(G)(we);return Ge.map(function(At){return $r(At)?At.replace("#",We):At})}};return ae||console.error("Plurals for locale ".concat(o," aren't loaded. Use i18n.loadLocaleData method to load plurals for specific locale. Using other plural rule as a fallback.")),{plural:function(we,$e){var Ve=$e.offset,je=Ve===void 0?0:Ve,Ge=Md($e,["offset"]),We=Ge[we]||Ge[ae?.(we-je)]||Ge.other;return ke(we-je,We)},selectordinal:function(we,$e){var Ve=$e.offset,je=Ve===void 0?0:Ve,Ge=Md($e,["offset"]),We=Ge[we]||Ge[ae?.(we-je,!0)]||Ge.other;return ke(we-je,We)},select:function(we,$e){return $e[we]||$e.other},number:function(we,$e){return Yl(G,H($e))(we)},date:function(we,$e){return Yh(G,H($e))(we)},undefined:function(we){return we}}}(u,g,z,I);return function o(G,K,ge){var ae=x[G],H=R[K](ae,ge),ke=Bh(H)?H(o):H;return Array.isArray(ke)?ke.join(""):ke}}function uy(s,u,g,x){return function(I){var z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},R=hy({locale:u,locales:g,localeData:x,formats:z,values:I}),o=function K(ge){return Array.isArray(ge)?ge.reduce(function(ae,H){if($r(H))return ae+H;var ke=ly(H,3),we=ke[0],$e=ke[1],Ve=ke[2],je={};Ve==null||$r(Ve)?je=Ve:Object.keys(Ve).forEach(function(We){je[We]=K(Ve[We])});var Ge=R(we,$e,je);return Ge==null?ae:ae+Ge},""):ge},G=o(s);return $r(G)&&Vp.test(G)?JSON.parse('"'.concat(G.trim(),'"')):$r(G)?G.trim():G}}var dy=function(){function s(){Up(this,s),this._events={}}return $p(s,[{key:"on",value:function(u,g){var x=this;return this._hasEvent(u)||(this._events[u]=[]),this._events[u].push(g),function(){return x.removeListener(u,g)}}},{key:"removeListener",value:function(u,g){if(this._hasEvent(u)){var x=this._events[u].indexOf(g);~x&&this._events[u].splice(x,1)}}},{key:"emit",value:function(u){for(var g=this,x=arguments.length,I=new Array(x>1?x-1:0),z=1;z<x;z++)I[z-1]=arguments[z];this._hasEvent(u)&&this._events[u].map(function(R){return R.apply(g,I)})}},{key:"_hasEvent",value:function(u){return Array.isArray(this._events[u])}}]),s}();function py(s){var u=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}();return function(){var g,x=Xl(s);if(u){var I=Xl(this).constructor;g=Reflect.construct(x,arguments,I)}else g=x.apply(this,arguments);return ry(this,g)}}var my=function(s){ty(g,s);var u=py(g);function g(x){var I;return Up(this,g),I=u.call(this),I._messages={},I._localeData={},x.missing!=null&&(I._missing=x.missing),x.messages!=null&&I.load(x.messages),x.localeData!=null&&I.loadLocaleData(x.localeData),x.locale==null&&x.locales==null||I.activate(x.locale,x.locales),I}return $p(g,[{key:"_loadLocaleData",value:function(x,I){this._localeData[x]==null?this._localeData[x]=I:Object.assign(this._localeData[x],I)}},{key:"loadLocaleData",value:function(x,I){var z=this;I!=null?this._loadLocaleData(x,I):Object.keys(x).forEach(function(R){return z._loadLocaleData(R,x[R])}),this.emit("change")}},{key:"_load",value:function(x,I){this._messages[x]==null?this._messages[x]=I:Object.assign(this._messages[x],I)}},{key:"load",value:function(x,I){var z=this;I!=null?this._load(x,I):Object.keys(x).forEach(function(R){return z._load(R,x[R])}),this.emit("change")}},{key:"activate",value:function(x,I){this._locale=x,this._locales=I,this.emit("change")}},{key:"_",value:function(x){var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},z=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},R=z.message,o=z.formats,G=z.context;$r(x)||(I=x.values||I,R=x.message,G=x.context,x=x.id);var K,ge=!G&&!this.messages[x],ae=G&&!this.messages[G][x],H=ae||ge,ke=this._missing;return ke&&H?Bh(ke)?ke(this._locale,x,G):ke:(H&&this.emit("missing",{id:x,context:G,locale:this._locale}),K=G&&!ae?this.messages[G][x]||R||x:this.messages[x]||R||x,$r(K)&&Vp.test(K)?JSON.parse('"'.concat(K,'"')):$r(K)?K:uy(K,this._locale,this._locales,this.localeData)(I,o))}},{key:"date",value:function(x,I){return Yh(this._locales||this._locale,I)(x)}},{key:"number",value:function(x,I){return Yl(this._locales||this._locale,I)(x)}},{key:"locale",get:function(){return this._locale}},{key:"locales",get:function(){return this._locales}},{key:"messages",get:function(){var x;return(x=this._messages[this._locale])!==null&&x!==void 0?x:{}}},{key:"localeData",get:function(){var x;return(x=this._localeData[this._locale])!==null&&x!==void 0?x:{}}}]),g}(dy);function Gp(){var s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return new my(s)}Gp();var Mo=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};const fy=Gp;function qp(s,u){return u?"other":s==1?"one":"other"}function gy(s,u){return u?"other":s==1?"one":s==2?"two":"other"}function yy(s,u){var g=String(s).split("."),x=!g[1],I=Number(g[0])==s,z=I&&g[0].slice(-1),R=I&&g[0].slice(-2);return u?z==1&&R!=11?"one":z==2&&R!=12?"two":z==3&&R!=13?"few":"other":s==1&&x?"one":"other"}const _y=qp,xy=qp,vy=gy,jp={},by={nb:_y,nn:xy,en:yy,sme:vy},yh={nb:"nb",nn:"nn",en:"en",sme:"se"},Kh=(s,u)=>{const g=fy({});g.loadLocaleData(yh[s],{plurals:by[s]}),g.load(yh[s],u),g.activate(yh[s]),jp[s]={i18n:g,messages:u}};function wy(s){return(g,x)=>jp[s].i18n._(g,x)}function kd(s){var u=s.map,g=s.type,x=g===void 0?"metric":g,I=s.maxWidth,z=I===void 0?100:I,R=u.getContainer().clientHeight/2,o=u.unproject([0,R]),G=u.unproject([z,R]),K=o.distanceTo(G);if(x==="imperial"){var ge=3.2808*K;return ge>5280?Io(ge/5280,"miles"):Io(ge,"feet")}return x==="nautical"?Io(K/1852,"nautical-miles"):K>=1e3?Io(K/1e3,"kilometers"):Io(K,"meters")}function Io(s,u){var g,x,I,z=(g=s,(x=Math.pow(10,(""+Math.floor(g)).length-1))*(I=(I=g/x)>=10?10:I>=5?5:I>=3?3:I>=2?2:I>=1?1:function(R){var o=Math.pow(10,Math.ceil(-Math.log(R)/Math.LN10));return Math.round(R*o)/o}(I)));return{distance:z,ratio:z/s,unit:u}}var Gn={exports:{}};(function(s,u){(function(g,x){s.exports=x()})(Mo,function(){var g,x,I;function z(o,G){if(!g)g=G;else if(!x)x=G;else{var K="var sharedChunk = {}; ("+g+")(sharedChunk); ("+x+")(sharedChunk);",ge={};g(ge),I=G(ge),typeof window<"u"&&(I.workerUrl=window.URL.createObjectURL(new Blob([K],{type:"text/javascript"})))}}z(["exports"],function(o){var G=K;function K(i,e,r,a){this.cx=3*i,this.bx=3*(r-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(a-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=e,this.p2x=r,this.p2y=a}function ge(i,e,r,a){const c=new G(i,e,r,a);return function(p){return c.solve(p)}}K.prototype={sampleCurveX:function(i){return((this.ax*i+this.bx)*i+this.cx)*i},sampleCurveY:function(i){return((this.ay*i+this.by)*i+this.cy)*i},sampleCurveDerivativeX:function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},solveCurveX:function(i,e){if(e===void 0&&(e=1e-6),i<0)return 0;if(i>1)return 1;for(var r=i,a=0;a<8;a++){var c=this.sampleCurveX(r)-i;if(Math.abs(c)<e)return r;var p=this.sampleCurveDerivativeX(r);if(Math.abs(p)<1e-6)break;r-=c/p}var m=0,y=1;for(r=i,a=0;a<20&&(c=this.sampleCurveX(r),!(Math.abs(c-i)<e));a++)i>c?m=r:y=r,r=.5*(y-m)+m;return r},solve:function(i,e){return this.sampleCurveY(this.solveCurveX(i,e))}};const ae=ge(.25,.1,.25,1);function H(i,e,r){return Math.min(r,Math.max(e,i))}function ke(i,e,r){const a=r-e,c=((i-e)%a+a)%a+e;return c===e?r:c}function we(i,...e){for(const r of e)for(const a in r)i[a]=r[a];return i}let $e=1;function Ve(i,e){i.forEach(r=>{e[r]&&(e[r]=e[r].bind(e))})}function je(i,e,r){const a={};for(const c in i)a[c]=e.call(r||this,i[c],c,i);return a}function Ge(i,e,r){const a={};for(const c in i)e.call(r||this,i[c],c,i)&&(a[c]=i[c]);return a}function We(i){return Array.isArray(i)?i.map(We):typeof i=="object"&&i?je(i,We):i}const At={};function gt(i){At[i]||(typeof console<"u"&&console.warn(i),At[i]=!0)}function Qe(i,e,r){return(r.y-i.y)*(e.x-i.x)>(e.y-i.y)*(r.x-i.x)}function Dt(i){let e=0;for(let r,a,c=0,p=i.length,m=p-1;c<p;m=c++)r=i[c],a=i[m],e+=(a.x-r.x)*(r.y+a.y);return e}function $t(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}function Ui(i){const e={};if(i.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(r,a,c,p)=>{const m=c||p;return e[a]=!m||m.toLowerCase(),""}),e["max-age"]){const r=parseInt(e["max-age"],10);isNaN(r)?delete e["max-age"]:e["max-age"]=r}return e}let xn,Vr,zr=null;function Zn(i){if(zr==null){const e=i.navigator?i.navigator.userAgent:null;zr=!!i.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return zr}function yr(i){return typeof ImageBitmap<"u"&&i instanceof ImageBitmap}const Gr={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frame(i){const e=requestAnimationFrame(i);return{cancel:()=>cancelAnimationFrame(e)}},getImageData(i,e=0){const r=window.document.createElement("canvas"),a=r.getContext("2d");if(!a)throw new Error("failed to create canvas 2d context");return r.width=i.width,r.height=i.height,a.drawImage(i,0,0,i.width,i.height),a.getImageData(-e,-e,i.width+2*e,i.height+2*e)},resolveURL:i=>(xn||(xn=document.createElement("a")),xn.href=i,xn.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(Vr==null&&(Vr=matchMedia("(prefers-reduced-motion: reduce)")),Vr.matches)}};var Ke=_r;function _r(i,e){this.x=i,this.y=e}_r.prototype={clone:function(){return new _r(this.x,this.y)},add:function(i){return this.clone()._add(i)},sub:function(i){return this.clone()._sub(i)},multByPoint:function(i){return this.clone()._multByPoint(i)},divByPoint:function(i){return this.clone()._divByPoint(i)},mult:function(i){return this.clone()._mult(i)},div:function(i){return this.clone()._div(i)},rotate:function(i){return this.clone()._rotate(i)},rotateAround:function(i,e){return this.clone()._rotateAround(i,e)},matMult:function(i){return this.clone()._matMult(i)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(i){return this.x===i.x&&this.y===i.y},dist:function(i){return Math.sqrt(this.distSqr(i))},distSqr:function(i){var e=i.x-this.x,r=i.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(i){return Math.atan2(this.y-i.y,this.x-i.x)},angleWith:function(i){return this.angleWithSep(i.x,i.y)},angleWithSep:function(i,e){return Math.atan2(this.x*e-this.y*i,this.x*i+this.y*e)},_matMult:function(i){var e=i[2]*this.x+i[3]*this.y;return this.x=i[0]*this.x+i[1]*this.y,this.y=e,this},_add:function(i){return this.x+=i.x,this.y+=i.y,this},_sub:function(i){return this.x-=i.x,this.y-=i.y,this},_mult:function(i){return this.x*=i,this.y*=i,this},_div:function(i){return this.x/=i,this.y/=i,this},_multByPoint:function(i){return this.x*=i.x,this.y*=i.y,this},_divByPoint:function(i){return this.x/=i.x,this.y/=i.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var i=this.y;return this.y=this.x,this.x=-i,this},_rotate:function(i){var e=Math.cos(i),r=Math.sin(i),a=r*this.x+e*this.y;return this.x=e*this.x-r*this.y,this.y=a,this},_rotateAround:function(i,e){var r=Math.cos(i),a=Math.sin(i),c=e.y+a*(this.x-e.x)+r*(this.y-e.y);return this.x=e.x+r*(this.x-e.x)-a*(this.y-e.y),this.y=c,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},_r.convert=function(i){return i instanceof _r?i:Array.isArray(i)?new _r(i[0],i[1]):i};const kr={MAX_PARALLEL_IMAGE_REQUESTS:16,REGISTERED_PROTOCOLS:{}},Lr="mapbox-tiles";let Xi,qr,jr=500,xr=50;function Dr(){typeof caches>"u"||Xi||(Xi=caches.open(Lr))}let Zr=1/0;const Yi={supported:!1,testSupport:function(i){!vn&&br&&(Ta?Wn(i):vr=i)}};let vr,br,vn=!1,Ta=!1;function Wn(i){const e=i.createTexture();i.bindTexture(i.TEXTURE_2D,e);try{if(i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,br),i.isContextLost())return;Yi.supported=!0}catch{}i.deleteTexture(e),vn=!0}typeof document<"u"&&(br=document.createElement("img"),br.onload=function(){vr&&Wn(vr),vr=null,Ta=!0},br.onerror=function(){vn=!0,vr=null},br.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const Ia={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};typeof Object.freeze=="function"&&Object.freeze(Ia);class si extends Error{constructor(e,r,a,c){super(`AJAXError: ${r} (${e}): ${a}`),this.status=e,this.statusText=r,this.url=a,this.body=c}}const Rr=$t()?()=>self.worker&&self.worker.referrer:()=>(window.location.protocol==="blob:"?window.parent:window).location.href;function Hn(i,e){const r=new AbortController,a=new Request(i.url,{method:i.method||"GET",body:i.body,credentials:i.credentials,headers:i.headers,referrer:Rr(),signal:r.signal});let c=!1,p=!1;return i.type==="json"&&a.headers.set("Accept","application/json"),((m,y,v)=>{if(p)return;const S=Date.now();fetch(a).then(A=>A.ok?((M,k,D)=>{(i.type==="arrayBuffer"?M.arrayBuffer():i.type==="json"?M.json():M.text()).then(B=>{p||(k&&D&&function(Z,W,re){if(Dr(),!Xi)return;const oe={status:W.status,statusText:W.statusText,headers:new Headers};W.headers.forEach((pe,xe)=>oe.headers.set(xe,pe));const se=Ui(W.headers.get("Cache-Control")||"");se["no-store"]||(se["max-age"]&&oe.headers.set("Expires",new Date(re+1e3*se["max-age"]).toUTCString()),new Date(oe.headers.get("Expires")).getTime()-re<42e4||function(pe,xe){if(qr===void 0)try{new Response(new ReadableStream),qr=!0}catch{qr=!1}qr?xe(pe.body):pe.blob().then(xe)}(W,pe=>{const xe=new Response(pe,oe);Dr(),Xi&&Xi.then(ye=>ye.put(function(Be){const qe=Be.indexOf("?");return qe<0?Be:Be.slice(0,qe)}(Z.url),xe)).catch(ye=>gt(ye.message))}))}(a,k,D),c=!0,e(null,B,M.headers.get("Cache-Control"),M.headers.get("Expires")))}).catch(B=>{p||e(new Error(B.message))})})(A,null,S):A.blob().then(M=>e(new si(A.status,A.statusText,i.url,M)))).catch(A=>{A.code!==20&&e(new Error(A.message))})})(),{cancel:()=>{p=!0,c||r.abort()}}}const Wr=function(i,e){if(/:\/\//.test(i.url)&&!/^https?:|^file:/.test(i.url)){if($t()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,e);if(!$t()){const a=i.url.substring(0,i.url.indexOf("://"));return(kr.REGISTERED_PROTOCOLS[a]||Hn)(i,e)}}if(!(/^file:/.test(r=i.url)||/^file:/.test(Rr())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return Hn(i,e);if($t()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,e,void 0,!0)}var r;return function(a,c){const p=new XMLHttpRequest;p.open(a.method||"GET",a.url,!0),a.type==="arrayBuffer"&&(p.responseType="arraybuffer");for(const m in a.headers)p.setRequestHeader(m,a.headers[m]);return a.type==="json"&&(p.responseType="text",p.setRequestHeader("Accept","application/json")),p.withCredentials=a.credentials==="include",p.onerror=()=>{c(new Error(p.statusText))},p.onload=()=>{if((p.status>=200&&p.status<300||p.status===0)&&p.response!==null){let m=p.response;if(a.type==="json")try{m=JSON.parse(p.response)}catch(y){return c(y)}c(null,m,p.getResponseHeader("Cache-Control"),p.getResponseHeader("Expires"))}else{const m=new Blob([p.response],{type:p.getResponseHeader("Content-Type")});c(new si(p.status,p.statusText,a.url,m))}},p.send(a.body),{cancel:()=>p.abort()}}(i,e)},ar=function(i,e){return Wr(we(i,{type:"arrayBuffer"}),e)};function Ea(i){const e=window.document.createElement("a");return e.href=i,e.protocol===window.document.location.protocol&&e.host===window.document.location.host}const wr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let sr,or;sr=[],or=0;const Xn=function(i,e){if(Yi.supported&&(i.headers||(i.headers={}),i.headers.accept="image/webp,*/*"),or>=kr.MAX_PARALLEL_IMAGE_REQUESTS){const p={requestParameters:i,callback:e,cancelled:!1,cancel(){this.cancelled=!0}};return sr.push(p),p}or++;let r=!1;const a=()=>{if(!r)for(r=!0,or--;sr.length&&or<kr.MAX_PARALLEL_IMAGE_REQUESTS;){const p=sr.shift(),{requestParameters:m,callback:y,cancelled:v}=p;v||(p.cancel=Xn(m,y).cancel)}},c=ar(i,(p,m,y,v)=>{a(),p?e(p):m&&function(S,A){typeof createImageBitmap=="function"?function(M,k){const D=new Blob([new Uint8Array(M)],{type:"image/png"});createImageBitmap(D).then(B=>{k(null,B)}).catch(B=>{k(new Error(`Could not load image because of ${B.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(S,A):function(M,k){const D=new Image;D.onload=()=>{k(null,D),URL.revokeObjectURL(D.src),D.onload=null,window.requestAnimationFrame(()=>{D.src=wr})},D.onerror=()=>k(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const B=new Blob([new Uint8Array(M)],{type:"image/png"});D.src=M.byteLength?URL.createObjectURL(B):wr}(S,A)}(m,(S,A)=>{S!=null?e(S):A!=null&&e(null,A,{cacheControl:y,expires:v})})});return{cancel:()=>{c.cancel(),a()}}};function mt(i,e,r){r[i]&&r[i].indexOf(e)!==-1||(r[i]=r[i]||[],r[i].push(e))}function Hr(i,e,r){if(r&&r[i]){const a=r[i].indexOf(e);a!==-1&&r[i].splice(a,1)}}class Br{constructor(e,r={}){we(this,r),this.type=e}}class Xr extends Br{constructor(e,r={}){super("error",we({error:e},r))}}class Yn{on(e,r){return this._listeners=this._listeners||{},mt(e,r,this._listeners),this}off(e,r){return Hr(e,r,this._listeners),Hr(e,r,this._oneTimeListeners),this}once(e,r){return this._oneTimeListeners=this._oneTimeListeners||{},mt(e,r,this._oneTimeListeners),this}fire(e,r){typeof e=="string"&&(e=new Br(e,r||{}));const a=e.type;if(this.listens(a)){e.target=this;const c=this._listeners&&this._listeners[a]?this._listeners[a].slice():[];for(const y of c)y.call(this,e);const p=this._oneTimeListeners&&this._oneTimeListeners[a]?this._oneTimeListeners[a].slice():[];for(const y of p)Hr(a,y,this._oneTimeListeners),y.call(this,e);const m=this._eventedParent;m&&(we(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),m.fire(e))}else e instanceof Xr&&console.error(e.error);return this}listens(e){return this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)}setEventedParent(e,r){return this._eventedParent=e,this._eventedParentData=r,this}}var de={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},sources:{required:!0,type:"sources"},sprite:{type:"string"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{}},default:"mapbox"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"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-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};class Ae{constructor(e,r,a,c){this.message=(e?`${e}: `:"")+a,c&&(this.identifier=c),r!=null&&r.__line__&&(this.line=r.__line__)}}function Yr(i){const e=i.value;return e?[new Ae(i.key,e,"constants have been deprecated as of v8")]:[]}function Sr(i,...e){for(const r of e)for(const a in r)i[a]=r[a];return i}function Ct(i){return i instanceof Number||i instanceof String||i instanceof Boolean?i.valueOf():i}function $i(i){if(Array.isArray(i))return i.map($i);if(i instanceof Object&&!(i instanceof Number||i instanceof String||i instanceof Boolean)){const e={};for(const r in i)e[r]=$i(i[r]);return e}return Ct(i)}class yi extends Error{constructor(e,r){super(r),this.message=r,this.key=e}}class Kr{constructor(e,r=[]){this.parent=e,this.bindings={};for(const[a,c]of r)this.bindings[a]=c}concat(e){return new Kr(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}const kt={kind:"null"},Ie={kind:"number"},st={kind:"string"},rt={kind:"boolean"},_i={kind:"color"},Ki={kind:"object"},nt={kind:"value"},Jr={kind:"collator"},Ji={kind:"formatted"},Tr={kind:"resolvedImage"};function Yt(i,e){return{kind:"array",itemType:i,N:e}}function Mt(i){if(i.kind==="array"){const e=Mt(i.itemType);return typeof i.N=="number"?`array<${e}, ${i.N}>`:i.itemType.kind==="value"?"array":`array<${e}>`}return i.kind}const Ni=[kt,Ie,st,rt,_i,Ji,Ki,Yt(nt),Tr];function Qr(i,e){if(e.kind==="error")return null;if(i.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!Qr(i.itemType,e.itemType))&&(typeof i.N!="number"||i.N===e.N))return null}else{if(i.kind===e.kind)return null;if(i.kind==="value"){for(const r of Ni)if(!Qr(r,e))return null}}return`Expected ${Mt(i)} but found ${Mt(e)} instead.`}function ii(i,e){return e.some(r=>r.kind===i.kind)}function Qi(i,e){return e.some(r=>r==="null"?i===null:r==="array"?Array.isArray(i):r==="object"?i&&!Array.isArray(i)&&typeof i=="object":r===typeof i)}var er,Kn={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function bn(i){return(i=Math.round(i))<0?0:i>255?255:i}function wn(i){return bn(i[i.length-1]==="%"?parseFloat(i)/100*255:parseInt(i))}function $(i){return(e=i[i.length-1]==="%"?parseFloat(i)/100:parseFloat(i))<0?0:e>1?1:e;var e}function T(i,e,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?i+(e-i)*r*6:2*r<1?e:3*r<2?i+(e-i)*(2/3-r)*6:i}try{er={}.parseCSSColor=function(i){var e,r=i.replace(/ /g,"").toLowerCase();if(r in Kn)return Kn[r].slice();if(r[0]==="#")return r.length===4?(e=parseInt(r.substr(1),16))>=0&&e<=4095?[(3840&e)>>4|(3840&e)>>8,240&e|(240&e)>>4,15&e|(15&e)<<4,1]:null:r.length===7&&(e=parseInt(r.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var a=r.indexOf("("),c=r.indexOf(")");if(a!==-1&&c+1===r.length){var p=r.substr(0,a),m=r.substr(a+1,c-(a+1)).split(","),y=1;switch(p){case"rgba":if(m.length!==4)return null;y=$(m.pop());case"rgb":return m.length!==3?null:[wn(m[0]),wn(m[1]),wn(m[2]),y];case"hsla":if(m.length!==4)return null;y=$(m.pop());case"hsl":if(m.length!==3)return null;var v=(parseFloat(m[0])%360+360)%360/360,S=$(m[1]),A=$(m[2]),M=A<=.5?A*(S+1):A+S-A*S,k=2*A-M;return[bn(255*T(k,M,v+1/3)),bn(255*T(k,M,v)),bn(255*T(k,M,v-1/3)),y];default:return null}}return null}}catch{}class C{constructor(e,r,a,c=1){this.r=e,this.g=r,this.b=a,this.a=c}static parse(e){if(!e)return;if(e instanceof C)return e;if(typeof e!="string")return;const r=er(e);return r?new C(r[0]/255*r[3],r[1]/255*r[3],r[2]/255*r[3],r[3]):void 0}toString(){const[e,r,a,c]=this.toArray();return`rgba(${Math.round(e)},${Math.round(r)},${Math.round(a)},${c})`}toArray(){const{r:e,g:r,b:a,a:c}=this;return c===0?[0,0,0,0]:[255*e/c,255*r/c,255*a/c,c]}}C.black=new C(0,0,0,1),C.white=new C(1,1,1,1),C.transparent=new C(0,0,0,0),C.red=new C(1,0,0,1);class F{constructor(e,r,a){this.sensitivity=e?r?"variant":"case":r?"accent":"base",this.locale=a,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,r){return this.collator.compare(e,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class N{constructor(e,r,a,c,p){this.text=e,this.image=r,this.scale=a,this.fontStack=c,this.textColor=p}}class V{constructor(e){this.sections=e}static fromString(e){return new V([new N(e,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(e=>e.text.length!==0||e.image&&e.image.name.length!==0)}static factory(e){return e instanceof V?e:V.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}serialize(){const e=["format"];for(const r of this.sections){if(r.image){e.push(["image",r.image.name]);continue}e.push(r.text);const a={};r.fontStack&&(a["text-font"]=["literal",r.fontStack.split(",")]),r.scale&&(a["font-scale"]=r.scale),r.textColor&&(a["text-color"]=["rgba"].concat(r.textColor.toArray())),e.push(a)}return e}}class J{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new J({name:e,available:!1}):null}serialize(){return["image",this.name]}}function X(i,e,r,a){return typeof i=="number"&&i>=0&&i<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof r=="number"&&r>=0&&r<=255?a===void 0||typeof a=="number"&&a>=0&&a<=1?null:`Invalid rgba value [${[i,e,r,a].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof a=="number"?[i,e,r,a]:[i,e,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Y(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof C||i instanceof F||i instanceof V||i instanceof J)return!0;if(Array.isArray(i)){for(const e of i)if(!Y(e))return!1;return!0}if(typeof i=="object"){for(const e in i)if(!Y(i[e]))return!1;return!0}return!1}function Q(i){if(i===null)return kt;if(typeof i=="string")return st;if(typeof i=="boolean")return rt;if(typeof i=="number")return Ie;if(i instanceof C)return _i;if(i instanceof F)return Jr;if(i instanceof V)return Ji;if(i instanceof J)return Tr;if(Array.isArray(i)){const e=i.length;let r;for(const a of i){const c=Q(a);if(r){if(r===c)continue;r=nt;break}r=c}return Yt(r||nt,e)}return Ki}function he(i){const e=typeof i;return i===null?"":e==="string"||e==="number"||e==="boolean"?String(i):i instanceof C||i instanceof V||i instanceof J?i.toString():JSON.stringify(i)}class _e{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(!Y(e[1]))return r.error("invalid value");const a=e[1];let c=Q(a);const p=r.expectedType;return c.kind!=="array"||c.N!==0||!p||p.kind!=="array"||typeof p.N=="number"&&p.N!==0||(c=p),new _e(c,a)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return this.type.kind==="array"||this.type.kind==="object"?["literal",this.value]:this.value instanceof C?["rgba"].concat(this.value.toArray()):this.value instanceof V?this.value.serialize():this.value}}class le{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const Oe={string:st,number:Ie,boolean:rt,object:Ki};class Le{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 a,c=1;const p=e[0];if(p==="array"){let y,v;if(e.length>2){const S=e[1];if(typeof S!="string"||!(S in Oe)||S==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);y=Oe[S],c++}else y=nt;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);v=e[2],c++}a=Yt(y,v)}else a=Oe[p];const m=[];for(;c<e.length;c++){const y=r.parse(e[c],c,nt);if(!y)return null;m.push(y)}return new Le(a,m)}evaluate(e){for(let r=0;r<this.args.length;r++){const a=this.args[r].evaluate(e);if(!Qr(this.type,Q(a)))return a;if(r===this.args.length-1)throw new le(`Expected value to be of type ${Mt(this.type)}, but found ${Mt(Q(a))} instead.`)}return null}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){const e=this.type,r=[e.kind];if(e.kind==="array"){const a=e.itemType;if(a.kind==="string"||a.kind==="number"||a.kind==="boolean"){r.push(a.kind);const c=e.N;(typeof c=="number"||this.args.length>1)&&r.push(c)}}return r.concat(this.args.map(a=>a.serialize()))}}class Ne{constructor(e){this.type=Ji,this.sections=e}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");const a=e[1];if(!Array.isArray(a)&&typeof a=="object")return r.error("First argument must be an image or text section.");const c=[];let p=!1;for(let m=1;m<=e.length-1;++m){const y=e[m];if(p&&typeof y=="object"&&!Array.isArray(y)){p=!1;let v=null;if(y["font-scale"]&&(v=r.parse(y["font-scale"],1,Ie),!v))return null;let S=null;if(y["text-font"]&&(S=r.parse(y["text-font"],1,Yt(st)),!S))return null;let A=null;if(y["text-color"]&&(A=r.parse(y["text-color"],1,_i),!A))return null;const M=c[c.length-1];M.scale=v,M.font=S,M.textColor=A}else{const v=r.parse(e[m],1,nt);if(!v)return null;const S=v.type.kind;if(S!=="string"&&S!=="value"&&S!=="null"&&S!=="resolvedImage")return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");p=!0,c.push({content:v,scale:null,font:null,textColor:null})}}return new Ne(c)}evaluate(e){return new V(this.sections.map(r=>{const a=r.content.evaluate(e);return Q(a)===Tr?new N("",a,null,null,null):new N(he(a),null,r.scale?r.scale.evaluate(e):null,r.font?r.font.evaluate(e).join(","):null,r.textColor?r.textColor.evaluate(e):null)}))}eachChild(e){for(const r of this.sections)e(r.content),r.scale&&e(r.scale),r.font&&e(r.font),r.textColor&&e(r.textColor)}outputDefined(){return!1}serialize(){const e=["format"];for(const r of this.sections){e.push(r.content.serialize());const a={};r.scale&&(a["font-scale"]=r.scale.serialize()),r.font&&(a["text-font"]=r.font.serialize()),r.textColor&&(a["text-color"]=r.textColor.serialize()),e.push(a)}return e}}class He{constructor(e){this.type=Tr,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected two arguments.");const a=r.parse(e[1],1,st);return a?new He(a):r.error("No image name provided.")}evaluate(e){const r=this.input.evaluate(e),a=J.fromString(r);return a&&e.availableImages&&(a.available=e.availableImages.indexOf(r)>-1),a}eachChild(e){e(this.input)}outputDefined(){return!1}serialize(){return["image",this.input.serialize()]}}const yt={"to-boolean":rt,"to-color":_i,"to-number":Ie,"to-string":st};class ut{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");const a=e[0];if((a==="to-boolean"||a==="to-string")&&e.length!==2)return r.error("Expected one argument.");const c=yt[a],p=[];for(let m=1;m<e.length;m++){const y=r.parse(e[m],m,nt);if(!y)return null;p.push(y)}return new ut(c,p)}evaluate(e){if(this.type.kind==="boolean")return Boolean(this.args[0].evaluate(e));if(this.type.kind==="color"){let r,a;for(const c of this.args){if(r=c.evaluate(e),a=null,r instanceof C)return r;if(typeof r=="string"){const p=e.parseColor(r);if(p)return p}else if(Array.isArray(r)&&(a=r.length<3||r.length>4?`Invalid rbga value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:X(r[0],r[1],r[2],r[3]),!a))return new C(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new le(a||`Could not parse color from value '${typeof r=="string"?r:String(JSON.stringify(r))}'`)}if(this.type.kind==="number"){let r=null;for(const a of this.args){if(r=a.evaluate(e),r===null)return 0;const c=Number(r);if(!isNaN(c))return c}throw new le(`Could not convert ${JSON.stringify(r)} to number.`)}return this.type.kind==="formatted"?V.fromString(he(this.args[0].evaluate(e))):this.type.kind==="resolvedImage"?J.fromString(he(this.args[0].evaluate(e))):he(this.args[0].evaluate(e))}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){if(this.type.kind==="formatted")return new Ne([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if(this.type.kind==="resolvedImage")return new He(this.args[0]).serialize();const e=[`to-${this.type.kind}`];return this.eachChild(r=>{e.push(r.serialize())}),e}}const lt=["Unknown","Point","LineString","Polygon"];class at{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?lt[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(e){let r=this._parseColorCache[e];return r||(r=this._parseColorCache[e]=C.parse(e)),r}}class it{constructor(e,r,a,c){this.name=e,this.type=r,this._evaluate=a,this.args=c}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map(e=>e.serialize()))}static parse(e,r){const a=e[0],c=it.definitions[a];if(!c)return r.error(`Unknown expression "${a}". If you wanted a literal array, use ["literal", [...]].`,0);const p=Array.isArray(c)?c[0]:c.type,m=Array.isArray(c)?[[c[1],c[2]]]:c.overloads,y=m.filter(([S])=>!Array.isArray(S)||S.length===e.length-1);let v=null;for(const[S,A]of y){v=new Ma(r.registry,r.path,null,r.scope);const M=[];let k=!1;for(let D=1;D<e.length;D++){const B=e[D],Z=Array.isArray(S)?S[D-1]:S.type,W=v.parse(B,1+M.length,Z);if(!W){k=!0;break}M.push(W)}if(!k)if(Array.isArray(S)&&S.length!==M.length)v.error(`Expected ${S.length} arguments, but found ${M.length} instead.`);else{for(let D=0;D<M.length;D++){const B=Array.isArray(S)?S[D]:S.type,Z=M[D];v.concat(D+1).checkSubtype(B,Z.type)}if(v.errors.length===0)return new it(a,p,A,M)}}if(y.length===1)r.errors.push(...v.errors);else{const S=(y.length?y:m).map(([M])=>{return k=M,Array.isArray(k)?`(${k.map(Mt).join(", ")})`:`(${Mt(k.type)}...)`;var k}).join(" | "),A=[];for(let M=1;M<e.length;M++){const k=r.parse(e[M],1+A.length);if(!k)return null;A.push(Mt(k.type))}r.error(`Expected arguments of type ${S}, but found (${A.join(", ")}) instead.`)}return null}static register(e,r){it.definitions=r;for(const a in r)e[a]=it}}class Wt{constructor(e,r,a){this.type=Jr,this.locale=a,this.caseSensitive=e,this.diacriticSensitive=r}static parse(e,r){if(e.length!==2)return r.error("Expected one argument.");const a=e[1];if(typeof a!="object"||Array.isArray(a))return r.error("Collator options argument must be an object.");const c=r.parse(a["case-sensitive"]!==void 0&&a["case-sensitive"],1,rt);if(!c)return null;const p=r.parse(a["diacritic-sensitive"]!==void 0&&a["diacritic-sensitive"],1,rt);if(!p)return null;let m=null;return a.locale&&(m=r.parse(a.locale,1,st),!m)?null:new Wt(c,p,m)}evaluate(e){return new F(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}serialize(){const e={};return e["case-sensitive"]=this.caseSensitive.serialize(),e["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(e.locale=this.locale.serialize()),["collator",e]}}const qt=8192;function oi(i,e){i[0]=Math.min(i[0],e[0]),i[1]=Math.min(i[1],e[1]),i[2]=Math.max(i[2],e[0]),i[3]=Math.max(i[3],e[1])}function hi(i,e){return!(i[0]<=e[0]||i[2]>=e[2]||i[1]<=e[1]||i[3]>=e[3])}function Ss(i,e){const r=(180+i[0])/360,a=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i[1]*Math.PI/360)))/360,c=Math.pow(2,e.z);return[Math.round(r*c*qt),Math.round(a*c*qt)]}function Ts(i,e,r){const a=i[0]-e[0],c=i[1]-e[1],p=i[0]-r[0],m=i[1]-r[1];return a*m-p*c==0&&a*p<=0&&c*m<=0}function Pt(i,e){let r=!1;for(let m=0,y=e.length;m<y;m++){const v=e[m];for(let S=0,A=v.length;S<A-1;S++){if(Ts(i,v[S],v[S+1]))return!1;(c=v[S])[1]>(a=i)[1]!=(p=v[S+1])[1]>a[1]&&a[0]<(p[0]-c[0])*(a[1]-c[1])/(p[1]-c[1])+c[0]&&(r=!r)}}var a,c,p;return r}function dc(i,e){for(let r=0;r<e.length;r++)if(Pt(i,e[r]))return!0;return!1}function Is(i,e,r,a){const c=a[0]-r[0],p=a[1]-r[1],m=(i[0]-r[0])*p-c*(i[1]-r[1]),y=(e[0]-r[0])*p-c*(e[1]-r[1]);return m>0&&y<0||m<0&&y>0}function pc(i,e,r){for(const S of r)for(let A=0;A<S.length-1;++A)if((y=[(m=S[A+1])[0]-(p=S[A])[0],m[1]-p[1]])[0]*(v=[(c=e)[0]-(a=i)[0],c[1]-a[1]])[1]-y[1]*v[0]!=0&&Is(a,c,p,m)&&Is(p,m,a,c))return!0;var a,c,p,m,y,v;return!1}function Es(i,e){for(let r=0;r<i.length;++r)if(!Pt(i[r],e))return!1;for(let r=0;r<i.length-1;++r)if(pc(i[r],i[r+1],e))return!1;return!0}function $o(i,e){for(let r=0;r<e.length;r++)if(Es(i,e[r]))return!0;return!1}function As(i,e,r){const a=[];for(let c=0;c<i.length;c++){const p=[];for(let m=0;m<i[c].length;m++){const y=Ss(i[c][m],r);oi(e,y),p.push(y)}a.push(p)}return a}function Cs(i,e,r){const a=[];for(let c=0;c<i.length;c++){const p=As(i[c],e,r);a.push(p)}return a}function Ms(i,e,r,a){if(i[0]<r[0]||i[0]>r[2]){const c=.5*a;let p=i[0]-r[0]>c?-a:r[0]-i[0]>c?a:0;p===0&&(p=i[0]-r[2]>c?-a:r[2]-i[0]>c?a:0),i[0]+=p}oi(e,i)}function No(i,e,r,a){const c=Math.pow(2,a.z)*qt,p=[a.x*qt,a.y*qt],m=[];for(const y of i)for(const v of y){const S=[v.x+p[0],v.y+p[1]];Ms(S,e,r,c),m.push(S)}return m}function Vo(i,e,r,a){const c=Math.pow(2,a.z)*qt,p=[a.x*qt,a.y*qt],m=[];for(const v of i){const S=[];for(const A of v){const M=[A.x+p[0],A.y+p[1]];oi(e,M),S.push(M)}m.push(S)}if(e[2]-e[0]<=c/2){(y=e)[0]=y[1]=1/0,y[2]=y[3]=-1/0;for(const v of m)for(const S of v)Ms(S,e,r,c)}var y;return m}class en{constructor(e,r){this.type=rt,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(Y(e[1])){const a=e[1];if(a.type==="FeatureCollection")for(let c=0;c<a.features.length;++c){const p=a.features[c].geometry.type;if(p==="Polygon"||p==="MultiPolygon")return new en(a,a.features[c].geometry)}else if(a.type==="Feature"){const c=a.geometry.type;if(c==="Polygon"||c==="MultiPolygon")return new en(a,a.geometry)}else if(a.type==="Polygon"||a.type==="MultiPolygon")return new en(a,a)}return r.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return function(r,a){const c=[1/0,1/0,-1/0,-1/0],p=[1/0,1/0,-1/0,-1/0],m=r.canonicalID();if(a.type==="Polygon"){const y=As(a.coordinates,p,m),v=No(r.geometry(),c,p,m);if(!hi(c,p))return!1;for(const S of v)if(!Pt(S,y))return!1}if(a.type==="MultiPolygon"){const y=Cs(a.coordinates,p,m),v=No(r.geometry(),c,p,m);if(!hi(c,p))return!1;for(const S of v)if(!dc(S,y))return!1}return!0}(e,this.geometries);if(e.geometryType()==="LineString")return function(r,a){const c=[1/0,1/0,-1/0,-1/0],p=[1/0,1/0,-1/0,-1/0],m=r.canonicalID();if(a.type==="Polygon"){const y=As(a.coordinates,p,m),v=Vo(r.geometry(),c,p,m);if(!hi(c,p))return!1;for(const S of v)if(!Es(S,y))return!1}if(a.type==="MultiPolygon"){const y=Cs(a.coordinates,p,m),v=Vo(r.geometry(),c,p,m);if(!hi(c,p))return!1;for(const S of v)if(!$o(S,y))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}function Aa(i){if(i instanceof it&&(i.name==="get"&&i.args.length===1||i.name==="feature-state"||i.name==="has"&&i.args.length===1||i.name==="properties"||i.name==="geometry-type"||i.name==="id"||/^filter-/.test(i.name))||i instanceof en)return!1;let e=!0;return i.eachChild(r=>{e&&!Aa(r)&&(e=!1)}),e}function Sn(i){if(i instanceof it&&i.name==="feature-state")return!1;let e=!0;return i.eachChild(r=>{e&&!Sn(r)&&(e=!1)}),e}function Jn(i,e){if(i instanceof it&&e.indexOf(i.name)>=0)return!1;let r=!0;return i.eachChild(a=>{r&&!Jn(a,e)&&(r=!1)}),r}class Ca{constructor(e,r){this.type=r.type,this.name=e,this.boundExpression=r}static parse(e,r){if(e.length!==2||typeof e[1]!="string")return r.error("'var' expression requires exactly one string literal argument.");const a=e[1];return r.scope.has(a)?new Ca(a,r.scope.get(a)):r.error(`Unknown variable "${a}". Make sure "${a}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class Ma{constructor(e,r=[],a,c=new Kr,p=[]){this.registry=e,this.path=r,this.key=r.map(m=>`[${m}]`).join(""),this.scope=c,this.errors=p,this.expectedType=a}parse(e,r,a,c,p={}){return r?this.concat(r,a,c)._parse(e,p):this._parse(e,p)}_parse(e,r){function a(c,p,m){return m==="assert"?new Le(p,[c]):m==="coerce"?new ut(p,[c]):c}if(e!==null&&typeof e!="string"&&typeof e!="boolean"&&typeof e!="number"||(e=["literal",e]),Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const c=e[0];if(typeof c!="string")return this.error(`Expression name must be a string, but found ${typeof c} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const p=this.registry[c];if(p){let m=p.parse(e,this);if(!m)return null;if(this.expectedType){const y=this.expectedType,v=m.type;if(y.kind!=="string"&&y.kind!=="number"&&y.kind!=="boolean"&&y.kind!=="object"&&y.kind!=="array"||v.kind!=="value")if(y.kind!=="color"&&y.kind!=="formatted"&&y.kind!=="resolvedImage"||v.kind!=="value"&&v.kind!=="string"){if(this.checkSubtype(y,v))return null}else m=a(m,y,r.typeAnnotation||"coerce");else m=a(m,y,r.typeAnnotation||"assert")}if(!(m instanceof _e)&&m.type.kind!=="resolvedImage"&&Qn(m)){const y=new at;try{m=new _e(m.type,m.evaluate(y))}catch(v){return this.error(v.message),null}}return m}return this.error(`Unknown expression "${c}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(e===void 0?"'undefined' value invalid. Use null instead.":typeof e=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,r,a){const c=typeof e=="number"?this.path.concat(e):this.path,p=a?this.scope.concat(a):this.scope;return new Ma(this.registry,c,r||null,p,this.errors)}error(e,...r){const a=`${this.key}${r.map(c=>`[${c}]`).join("")}`;this.errors.push(new yi(a,e))}checkSubtype(e,r){const a=Qr(e,r);return a&&this.error(a),a}}function Qn(i){if(i instanceof Ca)return Qn(i.boundExpression);if(i instanceof it&&i.name==="error"||i instanceof Wt||i instanceof en)return!1;const e=i instanceof ut||i instanceof Le;let r=!0;return i.eachChild(a=>{r=e?r&&Qn(a):r&&a instanceof _e}),!!r&&Aa(i)&&Jn(i,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Pa(i,e){const r=i.length-1;let a,c,p=0,m=r,y=0;for(;p<=m;)if(y=Math.floor((p+m)/2),a=i[y],c=i[y+1],a<=e){if(y===r||e<c)return y;p=y+1}else{if(!(a>e))throw new le("Input is not a number.");m=y-1}return 0}class ea{constructor(e,r,a){this.type=e,this.input=r,this.labels=[],this.outputs=[];for(const[c,p]of a)this.labels.push(c),this.outputs.push(p)}static parse(e,r){if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");const a=r.parse(e[1],1,Ie);if(!a)return null;const c=[];let p=null;r.expectedType&&r.expectedType.kind!=="value"&&(p=r.expectedType);for(let m=1;m<e.length;m+=2){const y=m===1?-1/0:e[m],v=e[m+1],S=m,A=m+1;if(typeof y!="number")return r.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',S);if(c.length&&c[c.length-1][0]>=y)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',S);const M=r.parse(v,A,p);if(!M)return null;p=p||M.type,c.push([y,M])}return new ea(p,a,c)}evaluate(e){const r=this.labels,a=this.outputs;if(r.length===1)return a[0].evaluate(e);const c=this.input.evaluate(e);if(c<=r[0])return a[0].evaluate(e);const p=r.length;return c>=r[p-1]?a[p-1].evaluate(e):a[Pa(r,c)].evaluate(e)}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}serialize(){const e=["step",this.input.serialize()];for(let r=0;r<this.labels.length;r++)r>0&&e.push(this.labels[r]),e.push(this.outputs[r].serialize());return e}}function Kt(i,e,r){return i*(1-r)+e*r}var ta=Object.freeze({__proto__:null,number:Kt,color:function(i,e,r){return new C(Kt(i.r,e.r,r),Kt(i.g,e.g,r),Kt(i.b,e.b,r),Kt(i.a,e.a,r))},array:function(i,e,r){return i.map((a,c)=>Kt(a,e[c],r))}});const Ps=.95047,Go=1.08883,qo=4/29,za=6/29,zs=3*za*za,mc=Math.PI/180,fc=180/Math.PI;function ks(i){return i>.008856451679035631?Math.pow(i,1/3):i/zs+qo}function Ls(i){return i>za?i*i*i:zs*(i-qo)}function Ds(i){return 255*(i<=.0031308?12.92*i:1.055*Math.pow(i,1/2.4)-.055)}function Rs(i){return(i/=255)<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function jo(i){const e=Rs(i.r),r=Rs(i.g),a=Rs(i.b),c=ks((.4124564*e+.3575761*r+.1804375*a)/Ps),p=ks((.2126729*e+.7151522*r+.072175*a)/1);return{l:116*p-16,a:500*(c-p),b:200*(p-ks((.0193339*e+.119192*r+.9503041*a)/Go)),alpha:i.a}}function vt(i){let e=(i.l+16)/116,r=isNaN(i.a)?e:e+i.a/500,a=isNaN(i.b)?e:e-i.b/200;return e=1*Ls(e),r=Ps*Ls(r),a=Go*Ls(a),new C(Ds(3.2404542*r-1.5371385*e-.4985314*a),Ds(-.969266*r+1.8760108*e+.041556*a),Ds(.0556434*r-.2040259*e+1.0572252*a),i.alpha)}function gc(i,e,r){const a=e-i;return i+r*(a>180||a<-180?a-360*Math.round(a/360):a)}const ia={forward:jo,reverse:vt,interpolate:function(i,e,r){return{l:Kt(i.l,e.l,r),a:Kt(i.a,e.a,r),b:Kt(i.b,e.b,r),alpha:Kt(i.alpha,e.alpha,r)}}},ra={forward:function(i){const{l:e,a:r,b:a}=jo(i),c=Math.atan2(a,r)*fc;return{h:c<0?c+360:c,c:Math.sqrt(r*r+a*a),l:e,alpha:i.a}},reverse:function(i){const e=i.h*mc,r=i.c;return vt({l:i.l,a:Math.cos(e)*r,b:Math.sin(e)*r,alpha:i.alpha})},interpolate:function(i,e,r){return{h:gc(i.h,e.h,r),c:Kt(i.c,e.c,r),l:Kt(i.l,e.l,r),alpha:Kt(i.alpha,e.alpha,r)}}};var Zo=Object.freeze({__proto__:null,lab:ia,hcl:ra});class Pi{constructor(e,r,a,c,p){this.type=e,this.operator=r,this.interpolation=a,this.input=c,this.labels=[],this.outputs=[];for(const[m,y]of p)this.labels.push(m),this.outputs.push(y)}static interpolationFactor(e,r,a,c){let p=0;if(e.name==="exponential")p=Bs(r,e.base,a,c);else if(e.name==="linear")p=Bs(r,1,a,c);else if(e.name==="cubic-bezier"){const m=e.controlPoints;p=new G(m[0],m[1],m[2],m[3]).solve(Bs(r,1,a,c))}return p}static parse(e,r){let[a,c,p,...m]=e;if(!Array.isArray(c)||c.length===0)return r.error("Expected an interpolation type expression.",1);if(c[0]==="linear")c={name:"linear"};else if(c[0]==="exponential"){const S=c[1];if(typeof S!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);c={name:"exponential",base:S}}else{if(c[0]!=="cubic-bezier")return r.error(`Unknown interpolation type ${String(c[0])}`,1,0);{const S=c.slice(1);if(S.length!==4||S.some(A=>typeof A!="number"||A<0||A>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);c={name:"cubic-bezier",controlPoints:S}}}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(p=r.parse(p,2,Ie),!p)return null;const y=[];let v=null;a==="interpolate-hcl"||a==="interpolate-lab"?v=_i:r.expectedType&&r.expectedType.kind!=="value"&&(v=r.expectedType);for(let S=0;S<m.length;S+=2){const A=m[S],M=m[S+1],k=S+3,D=S+4;if(typeof A!="number")return r.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',k);if(y.length&&y[y.length-1][0]>=A)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',k);const B=r.parse(M,D,v);if(!B)return null;v=v||B.type,y.push([A,B])}return v.kind==="number"||v.kind==="color"||v.kind==="array"&&v.itemType.kind==="number"&&typeof v.N=="number"?new Pi(v,a,c,p,y):r.error(`Type ${Mt(v)} is not interpolatable.`)}evaluate(e){const r=this.labels,a=this.outputs;if(r.length===1)return a[0].evaluate(e);const c=this.input.evaluate(e);if(c<=r[0])return a[0].evaluate(e);const p=r.length;if(c>=r[p-1])return a[p-1].evaluate(e);const m=Pa(r,c),y=Pi.interpolationFactor(this.interpolation,c,r[m],r[m+1]),v=a[m].evaluate(e),S=a[m+1].evaluate(e);return this.operator==="interpolate"?ta[this.type.kind.toLowerCase()](v,S,y):this.operator==="interpolate-hcl"?ra.reverse(ra.interpolate(ra.forward(v),ra.forward(S),y)):ia.reverse(ia.interpolate(ia.forward(v),ia.forward(S),y))}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}serialize(){let e;e=this.interpolation.name==="linear"?["linear"]:this.interpolation.name==="exponential"?this.interpolation.base===1?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier"].concat(this.interpolation.controlPoints);const r=[this.operator,e,this.input.serialize()];for(let a=0;a<this.labels.length;a++)r.push(this.labels[a],this.outputs[a].serialize());return r}}function Bs(i,e,r,a){const c=a-r,p=i-r;return c===0?0:e===1?p/c:(Math.pow(e,p)-1)/(Math.pow(e,c)-1)}class ka{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expectected at least one argument.");let a=null;const c=r.expectedType;c&&c.kind!=="value"&&(a=c);const p=[];for(const y of e.slice(1)){const v=r.parse(y,1+p.length,a,void 0,{typeAnnotation:"omit"});if(!v)return null;a=a||v.type,p.push(v)}const m=c&&p.some(y=>Qr(c,y.type));return new ka(m?nt:a,p)}evaluate(e){let r,a=null,c=0;for(const p of this.args)if(c++,a=p.evaluate(e),a&&a instanceof J&&!a.available&&(r||(r=a.name),a=null,c===this.args.length&&(a=r)),a!==null)break;return a}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){const e=["coalesce"];return this.eachChild(r=>{e.push(r.serialize())}),e}}class La{constructor(e,r){this.type=r.type,this.bindings=[].concat(e),this.result=r}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const r of this.bindings)e(r[1]);e(this.result)}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const a=[];for(let p=1;p<e.length-1;p+=2){const m=e[p];if(typeof m!="string")return r.error(`Expected string, but found ${typeof m} instead.`,p);if(/[^a-zA-Z0-9_]/.test(m))return r.error("Variable names must contain only alphanumeric characters or '_'.",p);const y=r.parse(e[p+1],p+1);if(!y)return null;a.push([m,y])}const c=r.parse(e[e.length-1],e.length-1,r.expectedType,a);return c?new La(a,c):null}outputDefined(){return this.result.outputDefined()}serialize(){const e=["let"];for(const[r,a]of this.bindings)e.push(r,a.serialize());return e.push(this.result.serialize()),e}}class Fs{constructor(e,r,a){this.type=e,this.index=r,this.input=a}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const a=r.parse(e[1],1,Ie),c=r.parse(e[2],2,Yt(r.expectedType||nt));return a&&c?new Fs(c.type.itemType,a,c):null}evaluate(e){const r=this.index.evaluate(e),a=this.input.evaluate(e);if(r<0)throw new le(`Array index out of bounds: ${r} < 0.`);if(r>=a.length)throw new le(`Array index out of bounds: ${r} > ${a.length-1}.`);if(r!==Math.floor(r))throw new le(`Array index must be an integer, but found ${r} instead.`);return a[r]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class Os{constructor(e,r){this.type=rt,this.needle=e,this.haystack=r}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const a=r.parse(e[1],1,nt),c=r.parse(e[2],2,nt);return a&&c?ii(a.type,[rt,st,Ie,kt,nt])?new Os(a,c):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${Mt(a.type)} instead`):null}evaluate(e){const r=this.needle.evaluate(e),a=this.haystack.evaluate(e);if(!a)return!1;if(!Qi(r,["boolean","string","number","null"]))throw new le(`Expected first argument to be of type boolean, string, number or null, but found ${Mt(Q(r))} instead.`);if(!Qi(a,["string","array"]))throw new le(`Expected second argument to be of type array or string, but found ${Mt(Q(a))} instead.`);return a.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class Da{constructor(e,r,a){this.type=Ie,this.needle=e,this.haystack=r,this.fromIndex=a}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const a=r.parse(e[1],1,nt),c=r.parse(e[2],2,nt);if(!a||!c)return null;if(!ii(a.type,[rt,st,Ie,kt,nt]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${Mt(a.type)} instead`);if(e.length===4){const p=r.parse(e[3],3,Ie);return p?new Da(a,c,p):null}return new Da(a,c)}evaluate(e){const r=this.needle.evaluate(e),a=this.haystack.evaluate(e);if(!Qi(r,["boolean","string","number","null"]))throw new le(`Expected first argument to be of type boolean, string, number or null, but found ${Mt(Q(r))} instead.`);if(!Qi(a,["string","array"]))throw new le(`Expected second argument to be of type array or string, but found ${Mt(Q(a))} instead.`);if(this.fromIndex){const c=this.fromIndex.evaluate(e);return a.indexOf(r,c)}return a.indexOf(r)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}serialize(){if(this.fromIndex!=null&&this.fromIndex!==void 0){const e=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),e]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}class Us{constructor(e,r,a,c,p,m){this.inputType=e,this.type=r,this.input=a,this.cases=c,this.outputs=p,this.otherwise=m}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 a,c;r.expectedType&&r.expectedType.kind!=="value"&&(c=r.expectedType);const p={},m=[];for(let S=2;S<e.length-1;S+=2){let A=e[S];const M=e[S+1];Array.isArray(A)||(A=[A]);const k=r.concat(S);if(A.length===0)return k.error("Expected at least one branch label.");for(const B of A){if(typeof B!="number"&&typeof B!="string")return k.error("Branch labels must be numbers or strings.");if(typeof B=="number"&&Math.abs(B)>Number.MAX_SAFE_INTEGER)return k.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof B=="number"&&Math.floor(B)!==B)return k.error("Numeric branch labels must be integer values.");if(a){if(k.checkSubtype(a,Q(B)))return null}else a=Q(B);if(p[String(B)]!==void 0)return k.error("Branch labels must be unique.");p[String(B)]=m.length}const D=r.parse(M,S,c);if(!D)return null;c=c||D.type,m.push(D)}const y=r.parse(e[1],1,nt);if(!y)return null;const v=r.parse(e[e.length-1],e.length-1,c);return v?y.type.kind!=="value"&&r.concat(1).checkSubtype(a,y.type)?null:new Us(a,c,y,p,m,v):null}evaluate(e){const r=this.input.evaluate(e);return(Q(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()}serialize(){const e=["match",this.input.serialize()],r=Object.keys(this.cases).sort(),a=[],c={};for(const m of r){const y=c[this.cases[m]];y===void 0?(c[this.cases[m]]=a.length,a.push([this.cases[m],[m]])):a[y][1].push(m)}const p=m=>this.inputType.kind==="number"?Number(m):m;for(const[m,y]of a)e.push(y.length===1?p(y[0]):y.map(p)),e.push(this.outputs[m].serialize());return e.push(this.otherwise.serialize()),e}}class $s{constructor(e,r,a){this.type=e,this.branches=r,this.otherwise=a}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 a;r.expectedType&&r.expectedType.kind!=="value"&&(a=r.expectedType);const c=[];for(let m=1;m<e.length-1;m+=2){const y=r.parse(e[m],m,rt);if(!y)return null;const v=r.parse(e[m+1],m+1,a);if(!v)return null;c.push([y,v]),a=a||v.type}const p=r.parse(e[e.length-1],e.length-1,a);return p?new $s(a,c,p):null}evaluate(e){for(const[r,a]of this.branches)if(r.evaluate(e))return a.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[r,a]of this.branches)e(r),e(a);e(this.otherwise)}outputDefined(){return this.branches.every(([e,r])=>r.outputDefined())&&this.otherwise.outputDefined()}serialize(){const e=["case"];return this.eachChild(r=>{e.push(r.serialize())}),e}}class Ra{constructor(e,r,a,c){this.type=e,this.input=r,this.beginIndex=a,this.endIndex=c}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const a=r.parse(e[1],1,nt),c=r.parse(e[2],2,Ie);if(!a||!c)return null;if(!ii(a.type,[Yt(nt),st,nt]))return r.error(`Expected first argument to be of type array or string, but found ${Mt(a.type)} instead`);if(e.length===4){const p=r.parse(e[3],3,Ie);return p?new Ra(a.type,a,c,p):null}return new Ra(a.type,a,c)}evaluate(e){const r=this.input.evaluate(e),a=this.beginIndex.evaluate(e);if(!Qi(r,["string","array"]))throw new le(`Expected first argument to be of type array or string, but found ${Mt(Q(r))} instead.`);if(this.endIndex){const c=this.endIndex.evaluate(e);return r.slice(a,c)}return r.slice(a)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}serialize(){if(this.endIndex!=null&&this.endIndex!==void 0){const e=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),e]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}function Wo(i,e){return i==="=="||i==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function Ho(i,e,r,a){return a.compare(e,r)===0}function Tn(i,e,r){const a=i!=="=="&&i!=="!=";return class Zp{constructor(p,m,y){this.type=rt,this.lhs=p,this.rhs=m,this.collator=y,this.hasUntypedArgument=p.type.kind==="value"||m.type.kind==="value"}static parse(p,m){if(p.length!==3&&p.length!==4)return m.error("Expected two or three arguments.");const y=p[0];let v=m.parse(p[1],1,nt);if(!v)return null;if(!Wo(y,v.type))return m.concat(1).error(`"${y}" comparisons are not supported for type '${Mt(v.type)}'.`);let S=m.parse(p[2],2,nt);if(!S)return null;if(!Wo(y,S.type))return m.concat(2).error(`"${y}" comparisons are not supported for type '${Mt(S.type)}'.`);if(v.type.kind!==S.type.kind&&v.type.kind!=="value"&&S.type.kind!=="value")return m.error(`Cannot compare types '${Mt(v.type)}' and '${Mt(S.type)}'.`);a&&(v.type.kind==="value"&&S.type.kind!=="value"?v=new Le(S.type,[v]):v.type.kind!=="value"&&S.type.kind==="value"&&(S=new Le(v.type,[S])));let A=null;if(p.length===4){if(v.type.kind!=="string"&&S.type.kind!=="string"&&v.type.kind!=="value"&&S.type.kind!=="value")return m.error("Cannot use collator to compare non-string types.");if(A=m.parse(p[3],3,Jr),!A)return null}return new Zp(v,S,A)}evaluate(p){const m=this.lhs.evaluate(p),y=this.rhs.evaluate(p);if(a&&this.hasUntypedArgument){const v=Q(m),S=Q(y);if(v.kind!==S.kind||v.kind!=="string"&&v.kind!=="number")throw new le(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${v.kind}, ${S.kind}) instead.`)}if(this.collator&&!a&&this.hasUntypedArgument){const v=Q(m),S=Q(y);if(v.kind!=="string"||S.kind!=="string")return e(p,m,y)}return this.collator?r(p,m,y,this.collator.evaluate(p)):e(p,m,y)}eachChild(p){p(this.lhs),p(this.rhs),this.collator&&p(this.collator)}outputDefined(){return!0}serialize(){const p=[i];return this.eachChild(m=>{p.push(m.serialize())}),p}}}const yc=Tn("==",function(i,e,r){return e===r},Ho),_c=Tn("!=",function(i,e,r){return e!==r},function(i,e,r,a){return!Ho(0,e,r,a)}),xc=Tn("<",function(i,e,r){return e<r},function(i,e,r,a){return a.compare(e,r)<0}),vc=Tn(">",function(i,e,r){return e>r},function(i,e,r,a){return a.compare(e,r)>0}),bc=Tn("<=",function(i,e,r){return e<=r},function(i,e,r,a){return a.compare(e,r)<=0}),wc=Tn(">=",function(i,e,r){return e>=r},function(i,e,r,a){return a.compare(e,r)>=0});class Ns{constructor(e,r,a,c,p){this.type=st,this.number=e,this.locale=r,this.currency=a,this.minFractionDigits=c,this.maxFractionDigits=p}static parse(e,r){if(e.length!==3)return r.error("Expected two arguments.");const a=r.parse(e[1],1,Ie);if(!a)return null;const c=e[2];if(typeof c!="object"||Array.isArray(c))return r.error("NumberFormat options argument must be an object.");let p=null;if(c.locale&&(p=r.parse(c.locale,1,st),!p))return null;let m=null;if(c.currency&&(m=r.parse(c.currency,1,st),!m))return null;let y=null;if(c["min-fraction-digits"]&&(y=r.parse(c["min-fraction-digits"],1,Ie),!y))return null;let v=null;return c["max-fraction-digits"]&&(v=r.parse(c["max-fraction-digits"],1,Ie),!v)?null:new Ns(a,p,m,y,v)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const e={};return this.locale&&(e.locale=this.locale.serialize()),this.currency&&(e.currency=this.currency.serialize()),this.minFractionDigits&&(e["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(e["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),e]}}class Vs{constructor(e){this.type=Ie,this.input=e}static parse(e,r){if(e.length!==2)return r.error(`Expected 1 argument, but found ${e.length-1} instead.`);const a=r.parse(e[1],1);return a?a.type.kind!=="array"&&a.type.kind!=="string"&&a.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${Mt(a.type)} instead.`):new Vs(a):null}evaluate(e){const r=this.input.evaluate(e);if(typeof r=="string"||Array.isArray(r))return r.length;throw new le(`Expected value to be of type string or array, but found ${Mt(Q(r))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}serialize(){const e=["length"];return this.eachChild(r=>{e.push(r.serialize())}),e}}const In={"==":yc,"!=":_c,">":vc,"<":xc,">=":wc,"<=":bc,array:Le,at:Fs,boolean:Le,case:$s,coalesce:ka,collator:Wt,format:Ne,image:He,in:Os,"index-of":Da,interpolate:Pi,"interpolate-hcl":Pi,"interpolate-lab":Pi,length:Vs,let:La,literal:_e,match:Us,number:Le,"number-format":Ns,object:Le,slice:Ra,step:ea,string:Le,"to-boolean":ut,"to-color":ut,"to-number":ut,"to-string":ut,var:Ca,within:en};function Xo(i,[e,r,a,c]){e=e.evaluate(i),r=r.evaluate(i),a=a.evaluate(i);const p=c?c.evaluate(i):1,m=X(e,r,a,p);if(m)throw new le(m);return new C(e/255*p,r/255*p,a/255*p,p)}function Yo(i,e){return i in e}function Gs(i,e){const r=e[i];return r===void 0?null:r}function tn(i){return{type:i}}function Ko(i){return{result:"success",value:i}}function rn(i){return{result:"error",value:i}}function En(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function Jo(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function qs(i){return!!i.expression&&i.expression.interpolated}function tt(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":i===null?"null":typeof i}function Ba(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function Tt(i){return i}function Fa(i,e){const r=e.type==="color",a=i.stops&&typeof i.stops[0][0]=="object",c=a||!(a||i.property!==void 0),p=i.type||(qs(e)?"exponential":"interval");if(r&&((i=Sr({},i)).stops&&(i.stops=i.stops.map(S=>[S[0],C.parse(S[1])])),i.default=C.parse(i.default?i.default:e.default)),i.colorSpace&&i.colorSpace!=="rgb"&&!Zo[i.colorSpace])throw new Error(`Unknown color space: ${i.colorSpace}`);let m,y,v;if(p==="exponential")m=js;else if(p==="interval")m=Oa;else if(p==="categorical"){m=jt,y=Object.create(null);for(const S of i.stops)y[S[0]]=S[1];v=typeof i.stops[0][0]}else{if(p!=="identity")throw new Error(`Unknown function type "${p}"`);m=Sc}if(a){const S={},A=[];for(let D=0;D<i.stops.length;D++){const B=i.stops[D],Z=B[0].zoom;S[Z]===void 0&&(S[Z]={zoom:Z,type:i.type,property:i.property,default:i.default,stops:[]},A.push(Z)),S[Z].stops.push([B[0].value,B[1]])}const M=[];for(const D of A)M.push([S[D].zoom,Fa(S[D],e)]);const k={name:"linear"};return{kind:"composite",interpolationType:k,interpolationFactor:Pi.interpolationFactor.bind(void 0,k),zoomStops:M.map(D=>D[0]),evaluate:({zoom:D},B)=>js({stops:M,base:i.base},e,D).evaluate(D,B)}}if(c){const S=p==="exponential"?{name:"exponential",base:i.base!==void 0?i.base:1}:null;return{kind:"camera",interpolationType:S,interpolationFactor:Pi.interpolationFactor.bind(void 0,S),zoomStops:i.stops.map(A=>A[0]),evaluate:({zoom:A})=>m(i,e,A,y,v)}}return{kind:"source",evaluate(S,A){const M=A&&A.properties?A.properties[i.property]:void 0;return M===void 0?Rt(i.default,e.default):m(i,e,M,y,v)}}}function Rt(i,e,r){return i!==void 0?i:e!==void 0?e:r!==void 0?r:void 0}function jt(i,e,r,a,c){return Rt(typeof r===c?a[r]:void 0,i.default,e.default)}function Oa(i,e,r){if(tt(r)!=="number")return Rt(i.default,e.default);const a=i.stops.length;if(a===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[a-1][0])return i.stops[a-1][1];const c=Pa(i.stops.map(p=>p[0]),r);return i.stops[c][1]}function js(i,e,r){const a=i.base!==void 0?i.base:1;if(tt(r)!=="number")return Rt(i.default,e.default);const c=i.stops.length;if(c===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[c-1][0])return i.stops[c-1][1];const p=Pa(i.stops.map(A=>A[0]),r),m=function(A,M,k,D){const B=D-k,Z=A-k;return B===0?0:M===1?Z/B:(Math.pow(M,Z)-1)/(Math.pow(M,B)-1)}(r,a,i.stops[p][0],i.stops[p+1][0]),y=i.stops[p][1],v=i.stops[p+1][1];let S=ta[e.type]||Tt;if(i.colorSpace&&i.colorSpace!=="rgb"){const A=Zo[i.colorSpace];S=(M,k)=>A.reverse(A.interpolate(A.forward(M),A.forward(k),m))}return typeof y.evaluate=="function"?{evaluate(...A){const M=y.evaluate.apply(void 0,A),k=v.evaluate.apply(void 0,A);if(M!==void 0&&k!==void 0)return S(M,k,m)}}:S(y,v,m)}function Sc(i,e,r){return e.type==="color"?r=C.parse(r):e.type==="formatted"?r=V.fromString(r.toString()):e.type==="resolvedImage"?r=J.fromString(r.toString()):tt(r)===e.type||e.type==="enum"&&e.values[r]||(r=void 0),Rt(r,i.default,e.default)}it.register(In,{error:[{kind:"error"},[st],(i,[e])=>{throw new le(e.evaluate(i))}],typeof:[st,[nt],(i,[e])=>Mt(Q(e.evaluate(i)))],"to-rgba":[Yt(Ie,4),[_i],(i,[e])=>e.evaluate(i).toArray()],rgb:[_i,[Ie,Ie,Ie],Xo],rgba:[_i,[Ie,Ie,Ie,Ie],Xo],has:{type:rt,overloads:[[[st],(i,[e])=>Yo(e.evaluate(i),i.properties())],[[st,Ki],(i,[e,r])=>Yo(e.evaluate(i),r.evaluate(i))]]},get:{type:nt,overloads:[[[st],(i,[e])=>Gs(e.evaluate(i),i.properties())],[[st,Ki],(i,[e,r])=>Gs(e.evaluate(i),r.evaluate(i))]]},"feature-state":[nt,[st],(i,[e])=>Gs(e.evaluate(i),i.featureState||{})],properties:[Ki,[],i=>i.properties()],"geometry-type":[st,[],i=>i.geometryType()],id:[nt,[],i=>i.id()],zoom:[Ie,[],i=>i.globals.zoom],"heatmap-density":[Ie,[],i=>i.globals.heatmapDensity||0],"line-progress":[Ie,[],i=>i.globals.lineProgress||0],accumulated:[nt,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[Ie,tn(Ie),(i,e)=>{let r=0;for(const a of e)r+=a.evaluate(i);return r}],"*":[Ie,tn(Ie),(i,e)=>{let r=1;for(const a of e)r*=a.evaluate(i);return r}],"-":{type:Ie,overloads:[[[Ie,Ie],(i,[e,r])=>e.evaluate(i)-r.evaluate(i)],[[Ie],(i,[e])=>-e.evaluate(i)]]},"/":[Ie,[Ie,Ie],(i,[e,r])=>e.evaluate(i)/r.evaluate(i)],"%":[Ie,[Ie,Ie],(i,[e,r])=>e.evaluate(i)%r.evaluate(i)],ln2:[Ie,[],()=>Math.LN2],pi:[Ie,[],()=>Math.PI],e:[Ie,[],()=>Math.E],"^":[Ie,[Ie,Ie],(i,[e,r])=>Math.pow(e.evaluate(i),r.evaluate(i))],sqrt:[Ie,[Ie],(i,[e])=>Math.sqrt(e.evaluate(i))],log10:[Ie,[Ie],(i,[e])=>Math.log(e.evaluate(i))/Math.LN10],ln:[Ie,[Ie],(i,[e])=>Math.log(e.evaluate(i))],log2:[Ie,[Ie],(i,[e])=>Math.log(e.evaluate(i))/Math.LN2],sin:[Ie,[Ie],(i,[e])=>Math.sin(e.evaluate(i))],cos:[Ie,[Ie],(i,[e])=>Math.cos(e.evaluate(i))],tan:[Ie,[Ie],(i,[e])=>Math.tan(e.evaluate(i))],asin:[Ie,[Ie],(i,[e])=>Math.asin(e.evaluate(i))],acos:[Ie,[Ie],(i,[e])=>Math.acos(e.evaluate(i))],atan:[Ie,[Ie],(i,[e])=>Math.atan(e.evaluate(i))],min:[Ie,tn(Ie),(i,e)=>Math.min(...e.map(r=>r.evaluate(i)))],max:[Ie,tn(Ie),(i,e)=>Math.max(...e.map(r=>r.evaluate(i)))],abs:[Ie,[Ie],(i,[e])=>Math.abs(e.evaluate(i))],round:[Ie,[Ie],(i,[e])=>{const r=e.evaluate(i);return r<0?-Math.round(-r):Math.round(r)}],floor:[Ie,[Ie],(i,[e])=>Math.floor(e.evaluate(i))],ceil:[Ie,[Ie],(i,[e])=>Math.ceil(e.evaluate(i))],"filter-==":[rt,[st,nt],(i,[e,r])=>i.properties()[e.value]===r.value],"filter-id-==":[rt,[nt],(i,[e])=>i.id()===e.value],"filter-type-==":[rt,[st],(i,[e])=>i.geometryType()===e.value],"filter-<":[rt,[st,nt],(i,[e,r])=>{const a=i.properties()[e.value],c=r.value;return typeof a==typeof c&&a<c}],"filter-id-<":[rt,[nt],(i,[e])=>{const r=i.id(),a=e.value;return typeof r==typeof a&&r<a}],"filter->":[rt,[st,nt],(i,[e,r])=>{const a=i.properties()[e.value],c=r.value;return typeof a==typeof c&&a>c}],"filter-id->":[rt,[nt],(i,[e])=>{const r=i.id(),a=e.value;return typeof r==typeof a&&r>a}],"filter-<=":[rt,[st,nt],(i,[e,r])=>{const a=i.properties()[e.value],c=r.value;return typeof a==typeof c&&a<=c}],"filter-id-<=":[rt,[nt],(i,[e])=>{const r=i.id(),a=e.value;return typeof r==typeof a&&r<=a}],"filter->=":[rt,[st,nt],(i,[e,r])=>{const a=i.properties()[e.value],c=r.value;return typeof a==typeof c&&a>=c}],"filter-id->=":[rt,[nt],(i,[e])=>{const r=i.id(),a=e.value;return typeof r==typeof a&&r>=a}],"filter-has":[rt,[nt],(i,[e])=>e.value in i.properties()],"filter-has-id":[rt,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[rt,[Yt(st)],(i,[e])=>e.value.indexOf(i.geometryType())>=0],"filter-id-in":[rt,[Yt(nt)],(i,[e])=>e.value.indexOf(i.id())>=0],"filter-in-small":[rt,[st,Yt(nt)],(i,[e,r])=>r.value.indexOf(i.properties()[e.value])>=0],"filter-in-large":[rt,[st,Yt(nt)],(i,[e,r])=>function(a,c,p,m){for(;p<=m;){const y=p+m>>1;if(c[y]===a)return!0;c[y]>a?m=y-1:p=y+1}return!1}(i.properties()[e.value],r.value,0,r.value.length-1)],all:{type:rt,overloads:[[[rt,rt],(i,[e,r])=>e.evaluate(i)&&r.evaluate(i)],[tn(rt),(i,e)=>{for(const r of e)if(!r.evaluate(i))return!1;return!0}]]},any:{type:rt,overloads:[[[rt,rt],(i,[e,r])=>e.evaluate(i)||r.evaluate(i)],[tn(rt),(i,e)=>{for(const r of e)if(r.evaluate(i))return!0;return!1}]]},"!":[rt,[rt],(i,[e])=>!e.evaluate(i)],"is-supported-script":[rt,[st],(i,[e])=>{const r=i.globals&&i.globals.isSupportedScript;return!r||r(e.evaluate(i))}],upcase:[st,[st],(i,[e])=>e.evaluate(i).toUpperCase()],downcase:[st,[st],(i,[e])=>e.evaluate(i).toLowerCase()],concat:[st,tn(nt),(i,e)=>e.map(r=>he(r.evaluate(i))).join("")],"resolved-locale":[st,[Jr],(i,[e])=>e.evaluate(i).resolvedLocale()]});class Zs{constructor(e,r){this.expression=e,this._warningHistory={},this._evaluator=new at,this._defaultValue=r?function(a){return a.type==="color"&&Ba(a.default)?new C(0,0,0,0):a.type==="color"?C.parse(a.default)||null:a.default===void 0?null:a.default}(r):null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(e,r,a,c,p,m){return this._evaluator.globals=e,this._evaluator.feature=r,this._evaluator.featureState=a,this._evaluator.canonical=c,this._evaluator.availableImages=p||null,this._evaluator.formattedSection=m,this.expression.evaluate(this._evaluator)}evaluate(e,r,a,c,p,m){this._evaluator.globals=e,this._evaluator.feature=r||null,this._evaluator.featureState=a||null,this._evaluator.canonical=c,this._evaluator.availableImages=p||null,this._evaluator.formattedSection=m||null;try{const y=this.expression.evaluate(this._evaluator);if(y==null||typeof y=="number"&&y!=y)return this._defaultValue;if(this._enumValues&&!(y in this._enumValues))throw new le(`Expected value to be one of ${Object.keys(this._enumValues).map(v=>JSON.stringify(v)).join(", ")}, but found ${JSON.stringify(y)} instead.`);return y}catch(y){return this._warningHistory[y.message]||(this._warningHistory[y.message]=!0,typeof console<"u"&&console.warn(y.message)),this._defaultValue}}}function Ua(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in In}function $a(i,e){const r=new Ma(In,[],e?function(c){const p={color:_i,string:st,number:Ie,enum:st,boolean:rt,formatted:Ji,resolvedImage:Tr};return c.type==="array"?Yt(p[c.value]||nt,c.length):p[c.type]}(e):void 0),a=r.parse(i,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return a?Ko(new Zs(a,e)):rn(r.errors)}class Na{constructor(e,r){this.kind=e,this._styleExpression=r,this.isStateDependent=e!=="constant"&&!Sn(r.expression)}evaluateWithoutErrorHandling(e,r,a,c,p,m){return this._styleExpression.evaluateWithoutErrorHandling(e,r,a,c,p,m)}evaluate(e,r,a,c,p,m){return this._styleExpression.evaluate(e,r,a,c,p,m)}}class Va{constructor(e,r,a,c){this.kind=e,this.zoomStops=a,this._styleExpression=r,this.isStateDependent=e!=="camera"&&!Sn(r.expression),this.interpolationType=c}evaluateWithoutErrorHandling(e,r,a,c,p,m){return this._styleExpression.evaluateWithoutErrorHandling(e,r,a,c,p,m)}evaluate(e,r,a,c,p,m){return this._styleExpression.evaluate(e,r,a,c,p,m)}interpolationFactor(e,r,a){return this.interpolationType?Pi.interpolationFactor(this.interpolationType,e,r,a):0}}function Ws(i,e){const r=$a(i,e);if(r.result==="error")return r;const a=r.value.expression,c=Aa(a);if(!c&&!En(e))return rn([new yi("","data expressions not supported")]);const p=Jn(a,["zoom"]);if(!p&&!Jo(e))return rn([new yi("","zoom expressions not supported")]);const m=Ga(a);return m||p?m instanceof yi?rn([m]):m instanceof Pi&&!qs(e)?rn([new yi("",'"interpolate" expressions cannot be used with this property')]):Ko(m?new Va(c?"camera":"composite",r.value,m.labels,m instanceof Pi?m.interpolation:void 0):new Na(c?"constant":"source",r.value)):rn([new yi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class An{constructor(e,r){this._parameters=e,this._specification=r,Sr(this,Fa(this._parameters,this._specification))}static deserialize(e){return new An(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function Ga(i){let e=null;if(i instanceof La)e=Ga(i.result);else if(i instanceof ka){for(const r of i.args)if(e=Ga(r),e)break}else(i instanceof ea||i instanceof Pi)&&i.input instanceof it&&i.input.name==="zoom"&&(e=i);return e instanceof yi||i.eachChild(r=>{const a=Ga(r);a instanceof yi?e=a:!e&&a?e=new yi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&a&&e!==a&&(e=new yi("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function tr(i){const e=i.key,r=i.value,a=i.valueSpec||{},c=i.objectElementValidators||{},p=i.style,m=i.styleSpec;let y=[];const v=tt(r);if(v!=="object")return[new Ae(e,r,`object expected, ${v} found`)];for(const S in r){const A=S.split(".")[0],M=a[A]||a["*"];let k;if(c[A])k=c[A];else if(a[A])k=Ii;else if(c["*"])k=c["*"];else{if(!a["*"]){y.push(new Ae(e,r[S],`unknown property "${S}"`));continue}k=Ii}y=y.concat(k({key:(e&&`${e}.`)+S,value:r[S],valueSpec:M,style:p,styleSpec:m,object:r,objectKey:S},r))}for(const S in a)c[S]||a[S].required&&a[S].default===void 0&&r[S]===void 0&&y.push(new Ae(e,r,`missing required property "${S}"`));return y}function Qo(i){const e=i.value,r=i.valueSpec,a=i.style,c=i.styleSpec,p=i.key,m=i.arrayElementValidator||Ii;if(tt(e)!=="array")return[new Ae(p,e,`array expected, ${tt(e)} found`)];if(r.length&&e.length!==r.length)return[new Ae(p,e,`array length ${r.length} expected, length ${e.length} found`)];if(r["min-length"]&&e.length<r["min-length"])return[new Ae(p,e,`array length at least ${r["min-length"]} expected, length ${e.length} found`)];let y={type:r.value,values:r.values};c.$version<7&&(y.function=r.function),tt(r.value)==="object"&&(y=r.value);let v=[];for(let S=0;S<e.length;S++)v=v.concat(m({array:e,arrayIndex:S,value:e[S],valueSpec:y,style:a,styleSpec:c,key:`${p}[${S}]`}));return v}function el(i){const e=i.key,r=i.value,a=i.valueSpec;let c=tt(r);return c==="number"&&r!=r&&(c="NaN"),c!=="number"?[new Ae(e,r,`number expected, ${c} found`)]:"minimum"in a&&r<a.minimum?[new Ae(e,r,`${r} is less than the minimum value ${a.minimum}`)]:"maximum"in a&&r>a.maximum?[new Ae(e,r,`${r} is greater than the maximum value ${a.maximum}`)]:[]}function tl(i){const e=i.valueSpec,r=Ct(i.value.type);let a,c,p,m={};const y=r!=="categorical"&&i.value.property===void 0,v=!y,S=tt(i.value.stops)==="array"&&tt(i.value.stops[0])==="array"&&tt(i.value.stops[0][0])==="object",A=tr({key:i.key,value:i.value,valueSpec:i.styleSpec.function,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{stops:function(D){if(r==="identity")return[new Ae(D.key,D.value,'identity function may not have a "stops" property')];let B=[];const Z=D.value;return B=B.concat(Qo({key:D.key,value:Z,valueSpec:D.valueSpec,style:D.style,styleSpec:D.styleSpec,arrayElementValidator:M})),tt(Z)==="array"&&Z.length===0&&B.push(new Ae(D.key,Z,"array must have at least one stop")),B},default:function(D){return Ii({key:D.key,value:D.value,valueSpec:e,style:D.style,styleSpec:D.styleSpec})}}});return r==="identity"&&y&&A.push(new Ae(i.key,i.value,'missing required property "property"')),r==="identity"||i.value.stops||A.push(new Ae(i.key,i.value,'missing required property "stops"')),r==="exponential"&&i.valueSpec.expression&&!qs(i.valueSpec)&&A.push(new Ae(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(v&&!En(i.valueSpec)?A.push(new Ae(i.key,i.value,"property functions not supported")):y&&!Jo(i.valueSpec)&&A.push(new Ae(i.key,i.value,"zoom functions not supported"))),r!=="categorical"&&!S||i.value.property!==void 0||A.push(new Ae(i.key,i.value,'"property" property is required')),A;function M(D){let B=[];const Z=D.value,W=D.key;if(tt(Z)!=="array")return[new Ae(W,Z,`array expected, ${tt(Z)} found`)];if(Z.length!==2)return[new Ae(W,Z,`array length 2 expected, length ${Z.length} found`)];if(S){if(tt(Z[0])!=="object")return[new Ae(W,Z,`object expected, ${tt(Z[0])} found`)];if(Z[0].zoom===void 0)return[new Ae(W,Z,"object stop key must have zoom")];if(Z[0].value===void 0)return[new Ae(W,Z,"object stop key must have value")];if(p&&p>Ct(Z[0].zoom))return[new Ae(W,Z[0].zoom,"stop zoom values must appear in ascending order")];Ct(Z[0].zoom)!==p&&(p=Ct(Z[0].zoom),c=void 0,m={}),B=B.concat(tr({key:`${W}[0]`,value:Z[0],valueSpec:{zoom:{}},style:D.style,styleSpec:D.styleSpec,objectElementValidators:{zoom:el,value:k}}))}else B=B.concat(k({key:`${W}[0]`,value:Z[0],valueSpec:{},style:D.style,styleSpec:D.styleSpec},Z));return Ua($i(Z[1]))?B.concat([new Ae(`${W}[1]`,Z[1],"expressions are not allowed in function stops.")]):B.concat(Ii({key:`${W}[1]`,value:Z[1],valueSpec:e,style:D.style,styleSpec:D.styleSpec}))}function k(D,B){const Z=tt(D.value),W=Ct(D.value),re=D.value!==null?D.value:B;if(a){if(Z!==a)return[new Ae(D.key,re,`${Z} stop domain type must match previous stop domain type ${a}`)]}else a=Z;if(Z!=="number"&&Z!=="string"&&Z!=="boolean")return[new Ae(D.key,re,"stop domain value must be a number, string, or boolean")];if(Z!=="number"&&r!=="categorical"){let oe=`number expected, ${Z} found`;return En(e)&&r===void 0&&(oe+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Ae(D.key,re,oe)]}return r!=="categorical"||Z!=="number"||isFinite(W)&&Math.floor(W)===W?r!=="categorical"&&Z==="number"&&c!==void 0&&W<c?[new Ae(D.key,re,"stop domain values must appear in ascending order")]:(c=W,r==="categorical"&&W in m?[new Ae(D.key,re,"stop domain values must be unique")]:(m[W]=!0,[])):[new Ae(D.key,re,`integer expected, found ${W}`)]}}function Cn(i){const e=(i.expressionContext==="property"?Ws:$a)($i(i.value),i.valueSpec);if(e.result==="error")return e.value.map(a=>new Ae(`${i.key}${a.key}`,i.value,a.message));const r=e.value.expression||e.value._styleExpression.expression;if(i.expressionContext==="property"&&i.propertyKey==="text-font"&&!r.outputDefined())return[new Ae(i.key,i.value,`Invalid data expression for "${i.propertyKey}". Output values must be contained as literals within the expression.`)];if(i.expressionContext==="property"&&i.propertyType==="layout"&&!Sn(r))return[new Ae(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if(i.expressionContext==="filter"&&!Sn(r))return[new Ae(i.key,i.value,'"feature-state" data expressions are not supported with filters.')];if(i.expressionContext&&i.expressionContext.indexOf("cluster")===0){if(!Jn(r,["zoom","feature-state"]))return[new Ae(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(i.expressionContext==="cluster-initial"&&!Aa(r))return[new Ae(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function qa(i){const e=i.key,r=i.value,a=i.valueSpec,c=[];return Array.isArray(a.values)?a.values.indexOf(Ct(r))===-1&&c.push(new Ae(e,r,`expected one of [${a.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(a.values).indexOf(Ct(r))===-1&&c.push(new Ae(e,r,`expected one of [${Object.keys(a.values).join(", ")}], ${JSON.stringify(r)} found`)),c}function Hs(i){if(i===!0||i===!1)return!0;if(!Array.isArray(i)||i.length===0)return!1;switch(i[0]){case"has":return i.length>=2&&i[1]!=="$id"&&i[1]!=="$type";case"in":return i.length>=3&&(typeof i[1]!="string"||Array.isArray(i[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return i.length!==3||Array.isArray(i[1])||Array.isArray(i[2]);case"any":case"all":for(const e of i.slice(1))if(!Hs(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const il={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function ja(i){if(i==null)return{filter:()=>!0,needGeometry:!1};Hs(i)||(i=na(i));const e=$a(i,il);if(e.result==="error")throw new Error(e.value.map(r=>`${r.key}: ${r.message}`).join(", "));return{filter:(r,a,c)=>e.value.evaluate(r,a,{},c),needGeometry:rl(i)}}function Za(i,e){return i<e?-1:i>e?1:0}function rl(i){if(!Array.isArray(i))return!1;if(i[0]==="within")return!0;for(let e=1;e<i.length;e++)if(rl(i[e]))return!0;return!1}function na(i){if(!i)return!0;const e=i[0];return i.length<=1?e!=="any":e==="=="?Xs(i[1],i[2],"=="):e==="!="?Mn(Xs(i[1],i[2],"==")):e==="<"||e===">"||e==="<="||e===">="?Xs(i[1],i[2],e):e==="any"?(r=i.slice(1),["any"].concat(r.map(na))):e==="all"?["all"].concat(i.slice(1).map(na)):e==="none"?["all"].concat(i.slice(1).map(na).map(Mn)):e==="in"?Wa(i[1],i.slice(2)):e==="!in"?Mn(Wa(i[1],i.slice(2))):e==="has"?Ha(i[1]):e==="!has"?Mn(Ha(i[1])):e!=="within"||i;var r}function Xs(i,e,r){switch(i){case"$type":return[`filter-type-${r}`,e];case"$id":return[`filter-id-${r}`,e];default:return[`filter-${r}`,i,e]}}function Wa(i,e){if(e.length===0)return!1;switch(i){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(r=>typeof r!=typeof e[0])?["filter-in-large",i,["literal",e.sort(Za)]]:["filter-in-small",i,["literal",e]]}}function Ha(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function Mn(i){return["!",i]}function aa(i){return Hs($i(i.value))?Cn(Sr({},i,{expressionContext:"filter",valueSpec:{value:"boolean"}})):nl(i)}function nl(i){const e=i.value,r=i.key;if(tt(e)!=="array")return[new Ae(r,e,`array expected, ${tt(e)} found`)];const a=i.styleSpec;let c,p=[];if(e.length<1)return[new Ae(r,e,"filter array must have at least 1 element")];switch(p=p.concat(qa({key:`${r}[0]`,value:e[0],valueSpec:a.filter_operator,style:i.style,styleSpec:i.styleSpec})),Ct(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&Ct(e[1])==="$type"&&p.push(new Ae(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&p.push(new Ae(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(c=tt(e[1]),c!=="string"&&p.push(new Ae(`${r}[1]`,e[1],`string expected, ${c} found`)));for(let m=2;m<e.length;m++)c=tt(e[m]),Ct(e[1])==="$type"?p=p.concat(qa({key:`${r}[${m}]`,value:e[m],valueSpec:a.geometry_type,style:i.style,styleSpec:i.styleSpec})):c!=="string"&&c!=="number"&&c!=="boolean"&&p.push(new Ae(`${r}[${m}]`,e[m],`string, number, or boolean expected, ${c} found`));break;case"any":case"all":case"none":for(let m=1;m<e.length;m++)p=p.concat(nl({key:`${r}[${m}]`,value:e[m],style:i.style,styleSpec:i.styleSpec}));break;case"has":case"!has":c=tt(e[1]),e.length!==2?p.push(new Ae(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):c!=="string"&&p.push(new Ae(`${r}[1]`,e[1],`string expected, ${c} found`));break;case"within":c=tt(e[1]),e.length!==2?p.push(new Ae(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):c!=="object"&&p.push(new Ae(`${r}[1]`,e[1],`object expected, ${c} found`))}return p}function sa(i,e){const r=i.key,a=i.style,c=i.styleSpec,p=i.value,m=i.objectKey,y=c[`${e}_${i.layerType}`];if(!y)return[];const v=m.match(/^(.*)-transition$/);if(e==="paint"&&v&&y[v[1]]&&y[v[1]].transition)return Ii({key:r,value:p,valueSpec:c.transition,style:a,styleSpec:c});const S=i.valueSpec||y[m];if(!S)return[new Ae(r,p,`unknown property "${m}"`)];let A;if(tt(p)==="string"&&En(S)&&!S.tokens&&(A=/^{([^}]+)}$/.exec(p)))return[new Ae(r,p,`"${m}" does not support interpolation syntax
Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(A[1])} }\`.`)];const M=[];return i.layerType==="symbol"&&(m==="text-field"&&a&&!a.glyphs&&M.push(new Ae(r,p,'use of "text-field" requires a style "glyphs" property')),m==="text-font"&&Ba($i(p))&&Ct(p.type)==="identity"&&M.push(new Ae(r,p,'"text-font" does not support identity functions'))),M.concat(Ii({key:i.key,value:p,valueSpec:S,style:a,styleSpec:c,expressionContext:"property",propertyType:e,propertyKey:m}))}function al(i){return sa(i,"paint")}function sl(i){return sa(i,"layout")}function ol(i){let e=[];const r=i.value,a=i.key,c=i.style,p=i.styleSpec;r.type||r.ref||e.push(new Ae(a,r,'either "type" or "ref" is required'));let m=Ct(r.type);const y=Ct(r.ref);if(r.id){const v=Ct(r.id);for(let S=0;S<i.arrayIndex;S++){const A=c.layers[S];Ct(A.id)===v&&e.push(new Ae(a,r.id,`duplicate layer id "${r.id}", previously used at line ${A.id.__line__}`))}}if("ref"in r){let v;["type","source","source-layer","filter","layout"].forEach(S=>{S in r&&e.push(new Ae(a,r[S],`"${S}" is prohibited for ref layers`))}),c.layers.forEach(S=>{Ct(S.id)===y&&(v=S)}),v?v.ref?e.push(new Ae(a,r.ref,"ref cannot reference another ref layer")):m=Ct(v.type):e.push(new Ae(a,r.ref,`ref layer "${y}" not found`))}else if(m!=="background")if(r.source){const v=c.sources&&c.sources[r.source],S=v&&Ct(v.type);v?S==="vector"&&m==="raster"?e.push(new Ae(a,r.source,`layer "${r.id}" requires a raster source`)):S==="raster"&&m!=="raster"?e.push(new Ae(a,r.source,`layer "${r.id}" requires a vector source`)):S!=="vector"||r["source-layer"]?S==="raster-dem"&&m!=="hillshade"?e.push(new Ae(a,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):m!=="line"||!r.paint||!r.paint["line-gradient"]||S==="geojson"&&v.lineMetrics||e.push(new Ae(a,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new Ae(a,r,`layer "${r.id}" must specify a "source-layer"`)):e.push(new Ae(a,r.source,`source "${r.source}" not found`))}else e.push(new Ae(a,r,'missing required property "source"'));return e=e.concat(tr({key:a,value:r,valueSpec:p.layer,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":()=>[],type:()=>Ii({key:`${a}.type`,value:r.type,valueSpec:p.layer.type,style:i.style,styleSpec:i.styleSpec,object:r,objectKey:"type"}),filter:aa,layout:v=>tr({layer:r,key:v.key,value:v.value,style:v.style,styleSpec:v.styleSpec,objectElementValidators:{"*":S=>sl(Sr({layerType:m},S))}}),paint:v=>tr({layer:r,key:v.key,value:v.value,style:v.style,styleSpec:v.styleSpec,objectElementValidators:{"*":S=>al(Sr({layerType:m},S))}})}})),e}function Pn(i){const e=i.value,r=i.key,a=tt(e);return a!=="string"?[new Ae(r,e,`string expected, ${a} found`)]:[]}const ll={promoteId:function({key:i,value:e}){if(tt(e)==="string")return Pn({key:i,value:e});{const r=[];for(const a in e)r.push(...Pn({key:`${i}.${a}`,value:e[a]}));return r}}};function oa(i){const e=i.value,r=i.key,a=i.styleSpec,c=i.style;if(!e.type)return[new Ae(r,e,'"type" is required')];const p=Ct(e.type);let m;switch(p){case"vector":case"raster":case"raster-dem":return m=tr({key:r,value:e,valueSpec:a[`source_${p.replace("-","_")}`],style:i.style,styleSpec:a,objectElementValidators:ll}),m;case"geojson":if(m=tr({key:r,value:e,valueSpec:a.source_geojson,style:c,styleSpec:a,objectElementValidators:ll}),e.cluster)for(const y in e.clusterProperties){const[v,S]=e.clusterProperties[y],A=typeof v=="string"?[v,["accumulated"],["get",y]]:v;m.push(...Cn({key:`${r}.${y}.map`,value:S,expressionContext:"cluster-map"})),m.push(...Cn({key:`${r}.${y}.reduce`,value:A,expressionContext:"cluster-reduce"}))}return m;case"video":return tr({key:r,value:e,valueSpec:a.source_video,style:c,styleSpec:a});case"image":return tr({key:r,value:e,valueSpec:a.source_image,style:c,styleSpec:a});case"canvas":return[new Ae(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return qa({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:c,styleSpec:a})}}function la(i){const e=i.value,r=i.styleSpec,a=r.light,c=i.style;let p=[];const m=tt(e);if(e===void 0)return p;if(m!=="object")return p=p.concat([new Ae("light",e,`object expected, ${m} found`)]),p;for(const y in e){const v=y.match(/^(.*)-transition$/);p=p.concat(v&&a[v[1]]&&a[v[1]].transition?Ii({key:y,value:e[y],valueSpec:r.transition,style:c,styleSpec:r}):a[y]?Ii({key:y,value:e[y],valueSpec:a[y],style:c,styleSpec:r}):[new Ae(y,e[y],`unknown property "${y}"`)])}return p}const zi={"*":()=>[],array:Qo,boolean:function(i){const e=i.value,r=i.key,a=tt(e);return a!=="boolean"?[new Ae(r,e,`boolean expected, ${a} found`)]:[]},number:el,color:function(i){const e=i.key,r=i.value,a=tt(r);return a!=="string"?[new Ae(e,r,`color expected, ${a} found`)]:er(r)===null?[new Ae(e,r,`color expected, "${r}" found`)]:[]},constants:Yr,enum:qa,filter:aa,function:tl,layer:ol,object:tr,source:oa,light:la,string:Pn,formatted:function(i){return Pn(i).length===0?[]:Cn(i)},resolvedImage:function(i){return Pn(i).length===0?[]:Cn(i)}};function Ii(i){const e=i.value,r=i.valueSpec,a=i.styleSpec;return r.expression&&Ba(Ct(e))?tl(i):r.expression&&Ua($i(e))?Cn(i):r.type&&zi[r.type]?zi[r.type](i):tr(Sr({},i,{valueSpec:r.type?a[r.type]:r}))}function Tc(i){const e=i.value,r=i.key,a=Pn(i);return a.length||(e.indexOf("{fontstack}")===-1&&a.push(new Ae(r,e,'"glyphs" url must include a "{fontstack}" token')),e.indexOf("{range}")===-1&&a.push(new Ae(r,e,'"glyphs" url must include a "{range}" token'))),a}function nn(i,e=de){let r=[];return r=r.concat(Ii({key:"",value:i,valueSpec:e.$root,styleSpec:e,style:i,objectElementValidators:{glyphs:Tc,"*":()=>[]}})),i.constants&&(r=r.concat(Yr({key:"constants",value:i.constants,style:i,styleSpec:e}))),cl(r)}function cl(i){return[].concat(i).sort((e,r)=>e.line-r.line)}function zn(i){return function(...e){return cl(i.apply(this,e))}}nn.source=zn(oa),nn.light=zn(la),nn.layer=zn(ol),nn.filter=zn(aa),nn.paintProperty=zn(al),nn.layoutProperty=zn(sl);const an=nn,Ic=an.light,Ys=an.paintProperty,Ec=an.layoutProperty;function hl(i,e){let r=!1;if(e&&e.length)for(const a of e)i.fire(new Xr(new Error(a.message))),r=!0;return r}class sn{constructor(e,r,a){const c=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const m=new Int32Array(this.arrayBuffer);e=m[0],this.d=(r=m[1])+2*(a=m[2]);for(let v=0;v<this.d*this.d;v++){const S=m[3+v],A=m[3+v+1];c.push(S===A?null:m.subarray(S,A))}const y=m[3+c.length+1];this.keys=m.subarray(m[3+c.length],y),this.bboxes=m.subarray(y),this.insert=this._insertReadonly}else{this.d=r+2*a;for(let m=0;m<this.d*this.d;m++)c.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=e,this.padding=a,this.scale=r/e,this.uid=0;const p=a/r*e;this.min=-p,this.max=e+p}insert(e,r,a,c,p){this._forEachCell(r,a,c,p,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(r),this.bboxes.push(a),this.bboxes.push(c),this.bboxes.push(p)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,r,a,c,p,m){this.cells[p].push(m)}query(e,r,a,c,p){const m=this.min,y=this.max;if(e<=m&&r<=m&&y<=a&&y<=c&&!p)return Array.prototype.slice.call(this.keys);{const v=[];return this._forEachCell(e,r,a,c,this._queryCell,v,{},p),v}}_queryCell(e,r,a,c,p,m,y,v){const S=this.cells[p];if(S!==null){const A=this.keys,M=this.bboxes;for(let k=0;k<S.length;k++){const D=S[k];if(y[D]===void 0){const B=4*D;(v?v(M[B+0],M[B+1],M[B+2],M[B+3]):e<=M[B+2]&&r<=M[B+3]&&a>=M[B+0]&&c>=M[B+1])?(y[D]=!0,m.push(A[D])):y[D]=!1}}}}_forEachCell(e,r,a,c,p,m,y,v){const S=this._convertToCellCoord(e),A=this._convertToCellCoord(r),M=this._convertToCellCoord(a),k=this._convertToCellCoord(c);for(let D=S;D<=M;D++)for(let B=A;B<=k;B++){const Z=this.d*B+D;if((!v||v(this._convertFromCellCoord(D),this._convertFromCellCoord(B),this._convertFromCellCoord(D+1),this._convertFromCellCoord(B+1)))&&p.call(this,e,r,a,c,Z,m,y,v))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const e=this.cells,r=3+this.cells.length+1+1;let a=0;for(let m=0;m<this.cells.length;m++)a+=this.cells[m].length;const c=new Int32Array(r+a+this.keys.length+this.bboxes.length);c[0]=this.extent,c[1]=this.n,c[2]=this.padding;let p=r;for(let m=0;m<e.length;m++){const y=e[m];c[3+m]=p,c.set(y,p),p+=y.length}return c[3+e.length]=p,c.set(this.keys,p),p+=this.keys.length,c[3+e.length+1]=p,c.set(this.bboxes,p),p+=this.bboxes.length,c.buffer}static serialize(e,r){const a=e.toArrayBuffer();return r&&r.push(a),{buffer:a}}static deserialize(e){return new sn(e.buffer)}}const kn={};function Re(i,e,r={}){Object.defineProperty(e,"_classRegistryKey",{value:i,writeable:!1}),kn[i]={klass:e,omit:r.omit||[],shallow:r.shallow||[]}}Re("Object",Object),Re("TransferableGridIndex",sn),Re("Color",C),Re("Error",Error),Re("AJAXError",si),Re("ResolvedImage",J),Re("StylePropertyFunction",An),Re("StyleExpression",Zs,{omit:["_evaluator"]}),Re("ZoomDependentExpression",Va),Re("ZoomConstantExpression",Na),Re("CompoundExpression",it,{omit:["_evaluate"]});for(const i in In)In[i]._classRegistryKey||Re(`Expression_${i}`,In[i]);function Ks(i){return i&&typeof ArrayBuffer<"u"&&(i instanceof ArrayBuffer||i.constructor&&i.constructor.name==="ArrayBuffer")}function ca(i,e){if(i==null||typeof i=="boolean"||typeof i=="number"||typeof i=="string"||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp||i instanceof Blob)return i;if(Ks(i)||yr(i))return e&&e.push(i),i;if(ArrayBuffer.isView(i)){const r=i;return e&&e.push(r.buffer),r}if(i instanceof ImageData)return e&&e.push(i.data.buffer),i;if(Array.isArray(i)){const r=[];for(const a of i)r.push(ca(a,e));return r}if(typeof i=="object"){const r=i.constructor,a=r._classRegistryKey;if(!a)throw new Error("can't serialize object of unregistered class");const c=r.serialize?r.serialize(i,e):{};if(!r.serialize){for(const p in i){if(!i.hasOwnProperty(p)||kn[a].omit.indexOf(p)>=0)continue;const m=i[p];c[p]=kn[a].shallow.indexOf(p)>=0?m:ca(m,e)}i instanceof Error&&(c.message=i.message)}if(c.$name)throw new Error("$name property is reserved for worker serialization logic.");return a!=="Object"&&(c.$name=a),c}throw new Error("can't serialize object of type "+typeof i)}function on(i){if(i==null||typeof i=="boolean"||typeof i=="number"||typeof i=="string"||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp||i instanceof Blob||Ks(i)||yr(i)||ArrayBuffer.isView(i)||i instanceof ImageData)return i;if(Array.isArray(i))return i.map(on);if(typeof i=="object"){const e=i.$name||"Object";if(!kn[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:r}=kn[e];if(!r)throw new Error(`can't deserialize unregistered class ${e}`);if(r.deserialize)return r.deserialize(i);const a=Object.create(r.prototype);for(const c of Object.keys(i)){if(c==="$name")continue;const p=i[c];a[c]=kn[e].shallow.indexOf(c)>=0?p:on(p)}return a}throw new Error("can't deserialize object of type "+typeof i)}class ha{constructor(){this.first=!0}update(e,r){const a=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=a,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=a,!0):(this.lastFloorZoom>a?(this.lastIntegerZoom=a+1,this.lastIntegerZoomTime=r):this.lastFloorZoom<a&&(this.lastIntegerZoom=a,this.lastIntegerZoomTime=r),e!==this.lastZoom&&(this.lastZoom=e,this.lastFloorZoom=a,!0))}}const Ee={"Latin-1 Supplement":i=>i>=128&&i<=255,Arabic:i=>i>=1536&&i<=1791,"Arabic Supplement":i=>i>=1872&&i<=1919,"Arabic Extended-A":i=>i>=2208&&i<=2303,"Hangul Jamo":i=>i>=4352&&i<=4607,"Unified Canadian Aboriginal Syllabics":i=>i>=5120&&i<=5759,Khmer:i=>i>=6016&&i<=6143,"Unified Canadian Aboriginal Syllabics Extended":i=>i>=6320&&i<=6399,"General Punctuation":i=>i>=8192&&i<=8303,"Letterlike Symbols":i=>i>=8448&&i<=8527,"Number Forms":i=>i>=8528&&i<=8591,"Miscellaneous Technical":i=>i>=8960&&i<=9215,"Control Pictures":i=>i>=9216&&i<=9279,"Optical Character Recognition":i=>i>=9280&&i<=9311,"Enclosed Alphanumerics":i=>i>=9312&&i<=9471,"Geometric Shapes":i=>i>=9632&&i<=9727,"Miscellaneous Symbols":i=>i>=9728&&i<=9983,"Miscellaneous Symbols and Arrows":i=>i>=11008&&i<=11263,"CJK Radicals Supplement":i=>i>=11904&&i<=12031,"Kangxi Radicals":i=>i>=12032&&i<=12255,"Ideographic Description Characters":i=>i>=12272&&i<=12287,"CJK Symbols and Punctuation":i=>i>=12288&&i<=12351,Hiragana:i=>i>=12352&&i<=12447,Katakana:i=>i>=12448&&i<=12543,Bopomofo:i=>i>=12544&&i<=12591,"Hangul Compatibility Jamo":i=>i>=12592&&i<=12687,Kanbun:i=>i>=12688&&i<=12703,"Bopomofo Extended":i=>i>=12704&&i<=12735,"CJK Strokes":i=>i>=12736&&i<=12783,"Katakana Phonetic Extensions":i=>i>=12784&&i<=12799,"Enclosed CJK Letters and Months":i=>i>=12800&&i<=13055,"CJK Compatibility":i=>i>=13056&&i<=13311,"CJK Unified Ideographs Extension A":i=>i>=13312&&i<=19903,"Yijing Hexagram Symbols":i=>i>=19904&&i<=19967,"CJK Unified Ideographs":i=>i>=19968&&i<=40959,"Yi Syllables":i=>i>=40960&&i<=42127,"Yi Radicals":i=>i>=42128&&i<=42191,"Hangul Jamo Extended-A":i=>i>=43360&&i<=43391,"Hangul Syllables":i=>i>=44032&&i<=55215,"Hangul Jamo Extended-B":i=>i>=55216&&i<=55295,"Private Use Area":i=>i>=57344&&i<=63743,"CJK Compatibility Ideographs":i=>i>=63744&&i<=64255,"Arabic Presentation Forms-A":i=>i>=64336&&i<=65023,"Vertical Forms":i=>i>=65040&&i<=65055,"CJK Compatibility Forms":i=>i>=65072&&i<=65103,"Small Form Variants":i=>i>=65104&&i<=65135,"Arabic Presentation Forms-B":i=>i>=65136&&i<=65279,"Halfwidth and Fullwidth Forms":i=>i>=65280&&i<=65519};function Js(i){for(const e of i)if(ua(e.charCodeAt(0)))return!0;return!1}function ul(i){for(const e of i)if(!Ac(e.charCodeAt(0)))return!1;return!0}function Ac(i){return!(Ee.Arabic(i)||Ee["Arabic Supplement"](i)||Ee["Arabic Extended-A"](i)||Ee["Arabic Presentation Forms-A"](i)||Ee["Arabic Presentation Forms-B"](i))}function ua(i){return!(i!==746&&i!==747&&(i<4352||!(Ee["Bopomofo Extended"](i)||Ee.Bopomofo(i)||Ee["CJK Compatibility Forms"](i)&&!(i>=65097&&i<=65103)||Ee["CJK Compatibility Ideographs"](i)||Ee["CJK Compatibility"](i)||Ee["CJK Radicals Supplement"](i)||Ee["CJK Strokes"](i)||!(!Ee["CJK Symbols and Punctuation"](i)||i>=12296&&i<=12305||i>=12308&&i<=12319||i===12336)||Ee["CJK Unified Ideographs Extension A"](i)||Ee["CJK Unified Ideographs"](i)||Ee["Enclosed CJK Letters and Months"](i)||Ee["Hangul Compatibility Jamo"](i)||Ee["Hangul Jamo Extended-A"](i)||Ee["Hangul Jamo Extended-B"](i)||Ee["Hangul Jamo"](i)||Ee["Hangul Syllables"](i)||Ee.Hiragana(i)||Ee["Ideographic Description Characters"](i)||Ee.Kanbun(i)||Ee["Kangxi Radicals"](i)||Ee["Katakana Phonetic Extensions"](i)||Ee.Katakana(i)&&i!==12540||!(!Ee["Halfwidth and Fullwidth Forms"](i)||i===65288||i===65289||i===65293||i>=65306&&i<=65310||i===65339||i===65341||i===65343||i>=65371&&i<=65503||i===65507||i>=65512&&i<=65519)||!(!Ee["Small Form Variants"](i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||Ee["Unified Canadian Aboriginal Syllabics"](i)||Ee["Unified Canadian Aboriginal Syllabics Extended"](i)||Ee["Vertical Forms"](i)||Ee["Yijing Hexagram Symbols"](i)||Ee["Yi Syllables"](i)||Ee["Yi Radicals"](i))))}function dl(i){return!(ua(i)||function(e){return!!(Ee["Latin-1 Supplement"](e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||Ee["General Punctuation"](e)&&(e===8214||e===8224||e===8225||e===8240||e===8241||e===8251||e===8252||e===8258||e===8263||e===8264||e===8265||e===8273)||Ee["Letterlike Symbols"](e)||Ee["Number Forms"](e)||Ee["Miscellaneous Technical"](e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||e===9003||e>=9085&&e<=9114||e>=9150&&e<=9165||e===9167||e>=9169&&e<=9179||e>=9186&&e<=9215)||Ee["Control Pictures"](e)&&e!==9251||Ee["Optical Character Recognition"](e)||Ee["Enclosed Alphanumerics"](e)||Ee["Geometric Shapes"](e)||Ee["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||Ee["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||Ee["CJK Symbols and Punctuation"](e)||Ee.Katakana(e)||Ee["Private Use Area"](e)||Ee["CJK Compatibility Forms"](e)||Ee["Small Form Variants"](e)||Ee["Halfwidth and Fullwidth Forms"](e)||e===8734||e===8756||e===8757||e>=9984&&e<=10087||e>=10102&&e<=10131||e===65532||e===65533)}(i))}function pl(i){return i>=1424&&i<=2303||Ee["Arabic Presentation Forms-A"](i)||Ee["Arabic Presentation Forms-B"](i)}function Cc(i,e){return!(!e&&pl(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||Ee.Khmer(i))}function Mc(i){for(const e of i)if(pl(e.charCodeAt(0)))return!0;return!1}const Xa="deferred",Qs="loading",eo="loaded";let to=null,Ei="unavailable",Fr=null;const ml=function(i){i&&typeof i=="string"&&i.indexOf("NetworkError")>-1&&(Ei="error"),to&&to(i)};function io(){Ln.fire(new Br("pluginStateChange",{pluginStatus:Ei,pluginURL:Fr}))}const Ln=new Yn,ro=function(){return Ei},Ya=function(){if(Ei!==Xa||!Fr)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Ei=Qs,io(),Fr&&ar({url:Fr},i=>{i?ml(i):(Ei=eo,io())})},Vi={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Ei===eo||Vi.applyArabicShaping!=null,isLoading:()=>Ei===Qs,setState(i){Ei=i.pluginStatus,Fr=i.pluginURL},isParsed:()=>Vi.applyArabicShaping!=null&&Vi.processBidirectionalText!=null&&Vi.processStyledBidirectionalText!=null,getPluginURL:()=>Fr};class Bt{constructor(e,r){this.zoom=e,r?(this.now=r.now,this.fadeDuration=r.fadeDuration,this.zoomHistory=r.zoomHistory,this.transition=r.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new ha,this.transition={})}isSupportedScript(e){return function(r,a){for(const c of r)if(!Cc(c.charCodeAt(0),a))return!1;return!0}(e,Vi.isLoaded())}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const e=this.zoom,r=e-Math.floor(e),a=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*a}:{fromScale:.5,toScale:1,t:1-(1-a)*r}}}class Ka{constructor(e,r){this.property=e,this.value=r,this.expression=function(a,c){if(Ba(a))return new An(a,c);if(Ua(a)){const p=Ws(a,c);if(p.result==="error")throw new Error(p.value.map(m=>`${m.key}: ${m.message}`).join(", "));return p.value}{let p=a;return typeof a=="string"&&c.type==="color"&&(p=C.parse(a)),{kind:"constant",evaluate:()=>p}}}(r===void 0?e.specification.default:r,e.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,r,a){return this.property.possiblyEvaluate(this,e,r,a)}}class Ja{constructor(e){this.property=e,this.value=new Ka(e,void 0)}transitioned(e,r){return new fl(this.property,this.value,r,we({},e.transition,this.transition),e.now)}untransitioned(){return new fl(this.property,this.value,null,{},0)}}class no{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return We(this._values[e].value.value)}setValue(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Ja(this._values[e].property)),this._values[e].value=new Ka(this._values[e].property,r===null?void 0:We(r))}getTransition(e){return We(this._values[e].transition)}setTransition(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Ja(this._values[e].property)),this._values[e].transition=We(r)||void 0}serialize(){const e={};for(const r of Object.keys(this._values)){const a=this.getValue(r);a!==void 0&&(e[r]=a);const c=this.getTransition(r);c!==void 0&&(e[`${r}-transition`]=c)}return e}transitioned(e,r){const a=new gl(this._properties);for(const c of Object.keys(this._values))a._values[c]=this._values[c].transitioned(e,r._values[c]);return a}untransitioned(){const e=new gl(this._properties);for(const r of Object.keys(this._values))e._values[r]=this._values[r].untransitioned();return e}}class fl{constructor(e,r,a,c,p){this.property=e,this.value=r,this.begin=p+c.delay||0,this.end=this.begin+c.duration||0,e.specification.transition&&(c.delay||c.duration)&&(this.prior=a)}possiblyEvaluate(e,r,a){const c=e.now||0,p=this.value.possiblyEvaluate(e,r,a),m=this.prior;if(m){if(c>this.end)return this.prior=null,p;if(this.value.isDataDriven())return this.prior=null,p;if(c<this.begin)return m.possiblyEvaluate(e,r,a);{const y=(c-this.begin)/(this.end-this.begin);return this.property.interpolate(m.possiblyEvaluate(e,r,a),p,function(v){if(v<=0)return 0;if(v>=1)return 1;const S=v*v,A=S*v;return 4*(v<.5?A:3*(v-S)+A-.75)}(y))}}return p}}class gl{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,r,a){const c=new Qa(this._properties);for(const p of Object.keys(this._values))c._values[p]=this._values[p].possiblyEvaluate(e,r,a);return c}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class Pc{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}getValue(e){return We(this._values[e].value)}setValue(e,r){this._values[e]=new Ka(this._values[e].property,r===null?void 0:We(r))}serialize(){const e={};for(const r of Object.keys(this._values)){const a=this.getValue(r);a!==void 0&&(e[r]=a)}return e}possiblyEvaluate(e,r,a){const c=new Qa(this._properties);for(const p of Object.keys(this._values))c._values[p]=this._values[p].possiblyEvaluate(e,r,a);return c}}class lr{constructor(e,r,a){this.property=e,this.value=r,this.parameters=a}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,r,a,c){return this.property.evaluate(this.value,this.parameters,e,r,a,c)}}class Qa{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class Ue{constructor(e){this.specification=e}possiblyEvaluate(e,r){return e.expression.evaluate(r)}interpolate(e,r,a){const c=ta[this.specification.type];return c?c(e,r,a):e}}class Xe{constructor(e,r){this.specification=e,this.overrides=r}possiblyEvaluate(e,r,a,c){return new lr(this,e.expression.kind==="constant"||e.expression.kind==="camera"?{kind:"constant",value:e.expression.evaluate(r,null,{},a,c)}:e.expression,r)}interpolate(e,r,a){if(e.value.kind!=="constant"||r.value.kind!=="constant")return e;if(e.value.value===void 0||r.value.value===void 0)return new lr(this,{kind:"constant",value:void 0},e.parameters);const c=ta[this.specification.type];return c?new lr(this,{kind:"constant",value:c(e.value.value,r.value.value,a)},e.parameters):e}evaluate(e,r,a,c,p,m){return e.kind==="constant"?e.value:e.evaluate(r,a,c,p,m)}}class da extends Xe{possiblyEvaluate(e,r,a,c){if(e.value===void 0)return new lr(this,{kind:"constant",value:void 0},r);if(e.expression.kind==="constant"){const p=e.expression.evaluate(r,null,{},a,c),m=e.property.specification.type==="resolvedImage"&&typeof p!="string"?p.name:p,y=this._calculate(m,m,m,r);return new lr(this,{kind:"constant",value:y},r)}if(e.expression.kind==="camera"){const p=this._calculate(e.expression.evaluate({zoom:r.zoom-1}),e.expression.evaluate({zoom:r.zoom}),e.expression.evaluate({zoom:r.zoom+1}),r);return new lr(this,{kind:"constant",value:p},r)}return new lr(this,e.expression,r)}evaluate(e,r,a,c,p,m){if(e.kind==="source"){const y=e.evaluate(r,a,c,p,m);return this._calculate(y,y,y,r)}return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(r.zoom)-1},a,c),e.evaluate({zoom:Math.floor(r.zoom)},a,c),e.evaluate({zoom:Math.floor(r.zoom)+1},a,c),r):e.value}_calculate(e,r,a,c){return c.zoom>c.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:a,to:r}}interpolate(e){return e}}class pa{constructor(e){this.specification=e}possiblyEvaluate(e,r,a,c){if(e.value!==void 0){if(e.expression.kind==="constant"){const p=e.expression.evaluate(r,null,{},a,c);return this._calculate(p,p,p,r)}return this._calculate(e.expression.evaluate(new Bt(Math.floor(r.zoom-1),r)),e.expression.evaluate(new Bt(Math.floor(r.zoom),r)),e.expression.evaluate(new Bt(Math.floor(r.zoom+1),r)),r)}}_calculate(e,r,a,c){return c.zoom>c.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:a,to:r}}interpolate(e){return e}}class ao{constructor(e){this.specification=e}possiblyEvaluate(e,r,a,c){return!!e.expression.evaluate(r,null,{},a,c)}interpolate(){return!1}}class ri{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const r in e){const a=e[r];a.specification.overridable&&this.overridableProperties.push(r);const c=this.defaultPropertyValues[r]=new Ka(a,void 0),p=this.defaultTransitionablePropertyValues[r]=new Ja(a);this.defaultTransitioningPropertyValues[r]=p.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=c.possiblyEvaluate({})}}}Re("DataDrivenProperty",Xe),Re("DataConstantProperty",Ue),Re("CrossFadedDataDrivenProperty",da),Re("CrossFadedProperty",pa),Re("ColorRampProperty",ao);const ln="-transition";class Ai extends Yn{constructor(e,r){if(super(),this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1},e.type!=="custom"&&(this.metadata=(e=e).metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type!=="background"&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),r.layout&&(this._unevaluatedLayout=new Pc(r.layout)),r.paint)){this._transitionablePaint=new no(r.paint);for(const a in e.paint)this.setPaintProperty(a,e.paint[a],{validate:!1});for(const a in e.layout)this.setLayoutProperty(a,e.layout[a],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Qa(r.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,r,a={}){r!=null&&this._validate(Ec,`layers.${this.id}.layout.${e}`,e,r,a)||(e!=="visibility"?this._unevaluatedLayout.setValue(e,r):this.visibility=r)}getPaintProperty(e){return e.endsWith(ln)?this._transitionablePaint.getTransition(e.slice(0,-ln.length)):this._transitionablePaint.getValue(e)}setPaintProperty(e,r,a={}){if(r!=null&&this._validate(Ys,`layers.${this.id}.paint.${e}`,e,r,a))return!1;if(e.endsWith(ln))return this._transitionablePaint.setTransition(e.slice(0,-ln.length),r||void 0),!1;{const c=this._transitionablePaint._values[e],p=c.property.specification["property-type"]==="cross-faded-data-driven",m=c.value.isDataDriven(),y=c.value;this._transitionablePaint.setValue(e,r),this._handleSpecialPaintPropertyUpdate(e);const v=this._transitionablePaint._values[e].value;return v.isDataDriven()||m||p||this._handleOverridablePaintPropertyUpdate(e,y,v)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,r,a){return!1}isHidden(e){return!!(this.minzoom&&e<this.minzoom)||!!(this.maxzoom&&e>=this.maxzoom)||this.visibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,r){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,r)}serialize(){const e={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),Ge(e,(r,a)=>!(r===void 0||a==="layout"&&!Object.keys(r).length||a==="paint"&&!Object.keys(r).length))}_validate(e,r,a,c,p={}){return(!p||p.validate!==!1)&&hl(this,e.call(an,{key:r,layerType:this.type,objectKey:a,value:c,styleSpec:de,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const e in this.paint._values){const r=this.paint.get(e);if(r instanceof lr&&En(r.property.specification)&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}}const zc={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class ma{constructor(e,r){this._structArray=e,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Lt{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,r){return e._trim(),r&&(e.isTransferred=!0,r.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const r=Object.create(this.prototype);return r.arrayBuffer=e.arrayBuffer,r.length=e.length,r.capacity=e.arrayBuffer.byteLength/r.bytesPerElement,r._refreshViews(),r}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function ni(i,e=1){let r=0,a=0;return{members:i.map(c=>{const p=zc[c.type].BYTES_PER_ELEMENT,m=r=yl(r,Math.max(e,p)),y=c.components||1;return a=Math.max(a,p),r+=p*y,{name:c.name,type:c.type,components:y,offset:m}}),size:yl(r,Math.max(a,e)),alignment:e}}function yl(i,e){return Math.ceil(i/e)*e}class Dn extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r){const a=this.length;return this.resize(a+1),this.emplace(a,e,r)}emplace(e,r,a){const c=2*e;return this.int16[c+0]=r,this.int16[c+1]=a,e}}Dn.prototype.bytesPerElement=4,Re("StructArrayLayout2i4",Dn);class fa extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,a,c){const p=this.length;return this.resize(p+1),this.emplace(p,e,r,a,c)}emplace(e,r,a,c,p){const m=4*e;return this.int16[m+0]=r,this.int16[m+1]=a,this.int16[m+2]=c,this.int16[m+3]=p,e}}fa.prototype.bytesPerElement=8,Re("StructArrayLayout4i8",fa);class h extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,a,c,p,m){const y=this.length;return this.resize(y+1),this.emplace(y,e,r,a,c,p,m)}emplace(e,r,a,c,p,m,y){const v=6*e;return this.int16[v+0]=r,this.int16[v+1]=a,this.int16[v+2]=c,this.int16[v+3]=p,this.int16[v+4]=m,this.int16[v+5]=y,e}}h.prototype.bytesPerElement=12,Re("StructArrayLayout2i4i12",h);class t extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,a,c,p,m){const y=this.length;return this.resize(y+1),this.emplace(y,e,r,a,c,p,m)}emplace(e,r,a,c,p,m,y){const v=4*e,S=8*e;return this.int16[v+0]=r,this.int16[v+1]=a,this.uint8[S+4]=c,this.uint8[S+5]=p,this.uint8[S+6]=m,this.uint8[S+7]=y,e}}t.prototype.bytesPerElement=8,Re("StructArrayLayout2i4ub8",t);class n extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r){const a=this.length;return this.resize(a+1),this.emplace(a,e,r)}emplace(e,r,a){const c=2*e;return this.float32[c+0]=r,this.float32[c+1]=a,e}}n.prototype.bytesPerElement=8,Re("StructArrayLayout2f8",n);class l extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,a,c,p,m,y,v,S,A){const M=this.length;return this.resize(M+1),this.emplace(M,e,r,a,c,p,m,y,v,S,A)}emplace(e,r,a,c,p,m,y,v,S,A,M){const k=10*e;return this.uint16[k+0]=r,this.uint16[k+1]=a,this.uint16[k+2]=c,this.uint16[k+3]=p,this.uint16[k+4]=m,this.uint16[k+5]=y,this.uint16[k+6]=v,this.uint16[k+7]=S,this.uint16[k+8]=A,this.uint16[k+9]=M,e}}l.prototype.bytesPerElement=20,Re("StructArrayLayout10ui20",l);class d extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,a,c,p,m,y,v,S,A,M,k){const D=this.length;return this.resize(D+1),this.emplace(D,e,r,a,c,p,m,y,v,S,A,M,k)}emplace(e,r,a,c,p,m,y,v,S,A,M,k,D){const B=12*e;return this.int16[B+0]=r,this.int16[B+1]=a,this.int16[B+2]=c,this.int16[B+3]=p,this.uint16[B+4]=m,this.uint16[B+5]=y,this.uint16[B+6]=v,this.uint16[B+7]=S,this.int16[B+8]=A,this.int16[B+9]=M,this.int16[B+10]=k,this.int16[B+11]=D,e}}d.prototype.bytesPerElement=24,Re("StructArrayLayout4i4ui4i24",d);class f extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,a){const c=this.length;return this.resize(c+1),this.emplace(c,e,r,a)}emplace(e,r,a,c){const p=3*e;return this.float32[p+0]=r,this.float32[p+1]=a,this.float32[p+2]=c,e}}f.prototype.bytesPerElement=12,Re("StructArrayLayout3f12",f);class _ extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.uint32[1*e+0]=r,e}}_.prototype.bytesPerElement=4,Re("StructArrayLayout1ul4",_);class b extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,a,c,p,m,y,v,S){const A=this.length;return this.resize(A+1),this.emplace(A,e,r,a,c,p,m,y,v,S)}emplace(e,r,a,c,p,m,y,v,S,A){const M=10*e,k=5*e;return this.int16[M+0]=r,this.int16[M+1]=a,this.int16[M+2]=c,this.int16[M+3]=p,this.int16[M+4]=m,this.int16[M+5]=y,this.uint32[k+3]=v,this.uint16[M+8]=S,this.uint16[M+9]=A,e}}b.prototype.bytesPerElement=20,Re("StructArrayLayout6i1ul2ui20",b);class w extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,a,c,p,m){const y=this.length;return this.resize(y+1),this.emplace(y,e,r,a,c,p,m)}emplace(e,r,a,c,p,m,y){const v=6*e;return this.int16[v+0]=r,this.int16[v+1]=a,this.int16[v+2]=c,this.int16[v+3]=p,this.int16[v+4]=m,this.int16[v+5]=y,e}}w.prototype.bytesPerElement=12,Re("StructArrayLayout2i2i2i12",w);class E extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,a,c,p){const m=this.length;return this.resize(m+1),this.emplace(m,e,r,a,c,p)}emplace(e,r,a,c,p,m){const y=4*e,v=8*e;return this.float32[y+0]=r,this.float32[y+1]=a,this.float32[y+2]=c,this.int16[v+6]=p,this.int16[v+7]=m,e}}E.prototype.bytesPerElement=16,Re("StructArrayLayout2f1f2i16",E);class P extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,a,c){const p=this.length;return this.resize(p+1),this.emplace(p,e,r,a,c)}emplace(e,r,a,c,p){const m=12*e,y=3*e;return this.uint8[m+0]=r,this.uint8[m+1]=a,this.float32[y+1]=c,this.float32[y+2]=p,e}}P.prototype.bytesPerElement=12,Re("StructArrayLayout2ub2f12",P);class L extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,a){const c=this.length;return this.resize(c+1),this.emplace(c,e,r,a)}emplace(e,r,a,c){const p=3*e;return this.uint16[p+0]=r,this.uint16[p+1]=a,this.uint16[p+2]=c,e}}L.prototype.bytesPerElement=6,Re("StructArrayLayout3ui6",L);class O extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,a,c,p,m,y,v,S,A,M,k,D,B,Z,W,re){const oe=this.length;return this.resize(oe+1),this.emplace(oe,e,r,a,c,p,m,y,v,S,A,M,k,D,B,Z,W,re)}emplace(e,r,a,c,p,m,y,v,S,A,M,k,D,B,Z,W,re,oe){const se=24*e,pe=12*e,xe=48*e;return this.int16[se+0]=r,this.int16[se+1]=a,this.uint16[se+2]=c,this.uint16[se+3]=p,this.uint32[pe+2]=m,this.uint32[pe+3]=y,this.uint32[pe+4]=v,this.uint16[se+10]=S,this.uint16[se+11]=A,this.uint16[se+12]=M,this.float32[pe+7]=k,this.float32[pe+8]=D,this.uint8[xe+36]=B,this.uint8[xe+37]=Z,this.uint8[xe+38]=W,this.uint32[pe+10]=re,this.int16[se+22]=oe,e}}O.prototype.bytesPerElement=48,Re("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",O);class j extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,a,c,p,m,y,v,S,A,M,k,D,B,Z,W,re,oe,se,pe,xe,ye,Be,qe,Me,Pe,Te,De){const ze=this.length;return this.resize(ze+1),this.emplace(ze,e,r,a,c,p,m,y,v,S,A,M,k,D,B,Z,W,re,oe,se,pe,xe,ye,Be,qe,Me,Pe,Te,De)}emplace(e,r,a,c,p,m,y,v,S,A,M,k,D,B,Z,W,re,oe,se,pe,xe,ye,Be,qe,Me,Pe,Te,De,ze){const be=34*e,Ye=17*e;return this.int16[be+0]=r,this.int16[be+1]=a,this.int16[be+2]=c,this.int16[be+3]=p,this.int16[be+4]=m,this.int16[be+5]=y,this.int16[be+6]=v,this.int16[be+7]=S,this.uint16[be+8]=A,this.uint16[be+9]=M,this.uint16[be+10]=k,this.uint16[be+11]=D,this.uint16[be+12]=B,this.uint16[be+13]=Z,this.uint16[be+14]=W,this.uint16[be+15]=re,this.uint16[be+16]=oe,this.uint16[be+17]=se,this.uint16[be+18]=pe,this.uint16[be+19]=xe,this.uint16[be+20]=ye,this.uint16[be+21]=Be,this.uint16[be+22]=qe,this.uint32[Ye+12]=Me,this.float32[Ye+13]=Pe,this.float32[Ye+14]=Te,this.float32[Ye+15]=De,this.float32[Ye+16]=ze,e}}j.prototype.bytesPerElement=68,Re("StructArrayLayout8i15ui1ul4f68",j);class U extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.float32[1*e+0]=r,e}}U.prototype.bytesPerElement=4,Re("StructArrayLayout1f4",U);class q extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,a){const c=this.length;return this.resize(c+1),this.emplace(c,e,r,a)}emplace(e,r,a,c){const p=3*e;return this.int16[p+0]=r,this.int16[p+1]=a,this.int16[p+2]=c,e}}q.prototype.bytesPerElement=6,Re("StructArrayLayout3i6",q);class ee extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,a){const c=this.length;return this.resize(c+1),this.emplace(c,e,r,a)}emplace(e,r,a,c){const p=4*e;return this.uint32[2*e+0]=r,this.uint16[p+2]=a,this.uint16[p+3]=c,e}}ee.prototype.bytesPerElement=8,Re("StructArrayLayout1ul2ui8",ee);class te extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r){const a=this.length;return this.resize(a+1),this.emplace(a,e,r)}emplace(e,r,a){const c=2*e;return this.uint16[c+0]=r,this.uint16[c+1]=a,e}}te.prototype.bytesPerElement=4,Re("StructArrayLayout2ui4",te);class ne extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.uint16[1*e+0]=r,e}}ne.prototype.bytesPerElement=2,Re("StructArrayLayout1ui2",ne);class ie extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,a,c){const p=this.length;return this.resize(p+1),this.emplace(p,e,r,a,c)}emplace(e,r,a,c,p){const m=4*e;return this.float32[m+0]=r,this.float32[m+1]=a,this.float32[m+2]=c,this.float32[m+3]=p,e}}ie.prototype.bytesPerElement=16,Re("StructArrayLayout4f16",ie);class fe extends ma{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 Ke(this.anchorPointX,this.anchorPointY)}}fe.prototype.size=20;class ce extends b{get(e){return new fe(this,e)}}Re("CollisionBoxArray",ce);class ue extends ma{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}ue.prototype.size=48;class ve extends O{get(e){return new ue(this,e)}}Re("PlacedSymbolArray",ve);class Se extends ma{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(e){this._structArray.uint32[this._pos4+12]=e}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get textOffset0(){return this._structArray.float32[this._pos4+14]}get textOffset1(){return this._structArray.float32[this._pos4+15]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+16]}}Se.prototype.size=68;class me extends j{get(e){return new Se(this,e)}}Re("SymbolInstanceArray",me);class Fe extends U{getoffsetX(e){return this.float32[1*e+0]}}Re("GlyphOffsetArray",Fe);class Ce extends q{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}Re("SymbolLineVertexArray",Ce);class Je extends ma{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]}}Je.prototype.size=8;class ft extends ee{get(e){return new Je(this,e)}}Re("FeatureIndexArray",ft);class ct extends Dn{}class dt extends Dn{}class Vt extends h{}class et extends t{}class _t extends n{}class It extends l{}class ui extends d{}class ki extends f{}class Gi extends _{}class qi extends w{}class Or extends P{}class Ci extends L{}class cr extends te{}const cn=ni([{name:"a_pos",components:2,type:"Int16"}],4),{members:Li}=cn;class xt{constructor(e=[]){this.segments=e}prepareSegment(e,r,a,c){let p=this.segments[this.segments.length-1];return e>xt.MAX_VERTEX_ARRAY_LENGTH&&gt(`Max vertices per segment is ${xt.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!p||p.vertexLength+e>xt.MAX_VERTEX_ARRAY_LENGTH||p.sortKey!==c)&&(p={vertexOffset:r.length,primitiveOffset:a.length,vertexLength:0,primitiveLength:0},c!==void 0&&(p.sortKey=c),this.segments.push(p)),p}get(){return this.segments}destroy(){for(const e of this.segments)for(const r in e.vaos)e.vaos[r].destroy()}static simpleSegment(e,r,a,c){return new xt([{vertexOffset:e,primitiveOffset:r,vertexLength:a,primitiveLength:c,vaos:{},sortKey:0}])}}function bt(i,e){return 256*(i=H(Math.floor(i),0,255))+H(Math.floor(e),0,255)}xt.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Re("SegmentVector",xt);const Jt=ni([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var xi={exports:{}},Ft={exports:{}};Ft.exports=function(i,e){var r,a,c,p,m,y,v,S;for(a=i.length-(r=3&i.length),c=e,m=3432918353,y=461845907,S=0;S<a;)v=255&i.charCodeAt(S)|(255&i.charCodeAt(++S))<<8|(255&i.charCodeAt(++S))<<16|(255&i.charCodeAt(++S))<<24,++S,c=27492+(65535&(p=5*(65535&(c=(c^=v=(65535&(v=(v=(65535&v)*m+(((v>>>16)*m&65535)<<16)&4294967295)<<15|v>>>17))*y+(((v>>>16)*y&65535)<<16)&4294967295)<<13|c>>>19))+((5*(c>>>16)&65535)<<16)&4294967295))+((58964+(p>>>16)&65535)<<16);switch(v=0,r){case 3:v^=(255&i.charCodeAt(S+2))<<16;case 2:v^=(255&i.charCodeAt(S+1))<<8;case 1:c^=v=(65535&(v=(v=(65535&(v^=255&i.charCodeAt(S)))*m+(((v>>>16)*m&65535)<<16)&4294967295)<<15|v>>>17))*y+(((v>>>16)*y&65535)<<16)&4294967295}return c^=i.length,c=2246822507*(65535&(c^=c>>>16))+((2246822507*(c>>>16)&65535)<<16)&4294967295,c=3266489909*(65535&(c^=c>>>13))+((3266489909*(c>>>16)&65535)<<16)&4294967295,(c^=c>>>16)>>>0};var hn={exports:{}};hn.exports=function(i,e){for(var r,a=i.length,c=e^a,p=0;a>=4;)r=1540483477*(65535&(r=255&i.charCodeAt(p)|(255&i.charCodeAt(++p))<<8|(255&i.charCodeAt(++p))<<16|(255&i.charCodeAt(++p))<<24))+((1540483477*(r>>>16)&65535)<<16),c=1540483477*(65535&c)+((1540483477*(c>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),a-=4,++p;switch(a){case 3:c^=(255&i.charCodeAt(p+2))<<16;case 2:c^=(255&i.charCodeAt(p+1))<<8;case 1:c=1540483477*(65535&(c^=255&i.charCodeAt(p)))+((1540483477*(c>>>16)&65535)<<16)}return c=1540483477*(65535&(c^=c>>>13))+((1540483477*(c>>>16)&65535)<<16),(c^=c>>>15)>>>0};var hr=Ft.exports,es=hn.exports;xi.exports=hr,xi.exports.murmur3=hr,xi.exports.murmur2=es;var so=xi.exports;class ts{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,a,c){this.ids.push(_l(e)),this.positions.push(r,a,c)}getPositions(e){const r=_l(e);let a=0,c=this.ids.length-1;for(;a<c;){const m=a+c>>1;this.ids[m]>=r?c=m:a=m+1}const p=[];for(;this.ids[a]===r;)p.push({index:this.positions[3*a],start:this.positions[3*a+1],end:this.positions[3*a+2]}),a++;return p}static serialize(e,r){const a=new Float64Array(e.ids),c=new Uint32Array(e.positions);return un(a,c,0,a.length-1),r&&r.push(a.buffer,c.buffer),{ids:a,positions:c}}static deserialize(e){const r=new ts;return r.ids=e.ids,r.positions=e.positions,r.indexed=!0,r}}function _l(i){const e=+i;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:so(String(i))}function un(i,e,r,a){for(;r<a;){const c=i[r+a>>1];let p=r-1,m=a+1;for(;;){do p++;while(i[p]<c);do m--;while(i[m]>c);if(p>=m)break;is(i,p,m),is(e,3*p,3*m),is(e,3*p+1,3*m+1),is(e,3*p+2,3*m+2)}m-r<a-m?(un(i,e,r,m),r=m+1):(un(i,e,m+1,a),a=m)}}function is(i,e,r){const a=i[e];i[e]=i[r],i[r]=a}Re("FeaturePositionMap",ts);class ur{constructor(e,r){this.gl=e.gl,this.location=r}}class Rn extends ur{constructor(e,r){super(e,r),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}}class ou extends ur{constructor(e,r){super(e,r),this.current=[0,0,0,0]}set(e){e[0]===this.current[0]&&e[1]===this.current[1]&&e[2]===this.current[2]&&e[3]===this.current[3]||(this.current=e,this.gl.uniform4f(this.location,e[0],e[1],e[2],e[3]))}}class lu extends ur{constructor(e,r){super(e,r),this.current=C.transparent}set(e){e.r===this.current.r&&e.g===this.current.g&&e.b===this.current.b&&e.a===this.current.a||(this.current=e,this.gl.uniform4f(this.location,e.r,e.g,e.b,e.a))}}const ef=new Float32Array(16);function kc(i){return[bt(255*i.r,255*i.g),bt(255*i.b,255*i.a)]}class oo{constructor(e,r,a){this.value=e,this.uniformNames=r.map(c=>`u_${c}`),this.type=a}setUniform(e,r,a){e.set(a.constantOr(this.value))}getBinding(e,r,a){return this.type==="color"?new lu(e,r):new Rn(e,r)}}class rs{constructor(e,r){this.uniformNames=r.map(a=>`u_${a}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,r){this.pixelRatioFrom=r.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=r.tlbr,this.patternTo=e.tlbr}setUniform(e,r,a,c){const p=c==="u_pattern_to"?this.patternTo:c==="u_pattern_from"?this.patternFrom:c==="u_pixel_ratio_to"?this.pixelRatioTo:c==="u_pixel_ratio_from"?this.pixelRatioFrom:null;p&&e.set(p)}getBinding(e,r,a){return a.substr(0,9)==="u_pattern"?new ou(e,r):new Rn(e,r)}}class dn{constructor(e,r,a,c){this.expression=e,this.type=a,this.maxValue=0,this.paintVertexAttributes=r.map(p=>({name:`a_${p}`,type:"Float32",components:a==="color"?2:1,offset:0})),this.paintVertexArray=new c}populatePaintArray(e,r,a,c,p){const m=this.paintVertexArray.length,y=this.expression.evaluate(new Bt(0),r,{},c,[],p);this.paintVertexArray.resize(e),this._setPaintValue(m,e,y)}updatePaintArray(e,r,a,c){const p=this.expression.evaluate({zoom:0},a,c);this._setPaintValue(e,r,p)}_setPaintValue(e,r,a){if(this.type==="color"){const c=kc(a);for(let p=e;p<r;p++)this.paintVertexArray.emplace(p,c[0],c[1])}else{for(let c=e;c<r;c++)this.paintVertexArray.emplace(c,a);this.maxValue=Math.max(this.maxValue,Math.abs(a))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Ir{constructor(e,r,a,c,p,m){this.expression=e,this.uniformNames=r.map(y=>`u_${y}_t`),this.type=a,this.useIntegerZoom=c,this.zoom=p,this.maxValue=0,this.paintVertexAttributes=r.map(y=>({name:`a_${y}`,type:"Float32",components:a==="color"?4:2,offset:0})),this.paintVertexArray=new m}populatePaintArray(e,r,a,c,p){const m=this.expression.evaluate(new Bt(this.zoom),r,{},c,[],p),y=this.expression.evaluate(new Bt(this.zoom+1),r,{},c,[],p),v=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(v,e,m,y)}updatePaintArray(e,r,a,c){const p=this.expression.evaluate({zoom:this.zoom},a,c),m=this.expression.evaluate({zoom:this.zoom+1},a,c);this._setPaintValue(e,r,p,m)}_setPaintValue(e,r,a,c){if(this.type==="color"){const p=kc(a),m=kc(c);for(let y=e;y<r;y++)this.paintVertexArray.emplace(y,p[0],p[1],m[0],m[1])}else{for(let p=e;p<r;p++)this.paintVertexArray.emplace(p,a,c);this.maxValue=Math.max(this.maxValue,Math.abs(a),Math.abs(c))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,r){const a=this.useIntegerZoom?Math.floor(r.zoom):r.zoom,c=H(this.expression.interpolationFactor(a,this.zoom,this.zoom+1),0,1);e.set(c)}getBinding(e,r,a){return new Rn(e,r)}}class Bn{constructor(e,r,a,c,p,m){this.expression=e,this.type=r,this.useIntegerZoom=a,this.zoom=c,this.layerId=m,this.zoomInPaintVertexArray=new p,this.zoomOutPaintVertexArray=new p}populatePaintArray(e,r,a){const c=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(c,e,r.patterns&&r.patterns[this.layerId],a)}updatePaintArray(e,r,a,c,p){this._setPaintValues(e,r,a.patterns&&a.patterns[this.layerId],p)}_setPaintValues(e,r,a,c){if(!c||!a)return;const{min:p,mid:m,max:y}=a,v=c[p],S=c[m],A=c[y];if(v&&S&&A)for(let M=e;M<r;M++)this.zoomInPaintVertexArray.emplace(M,S.tl[0],S.tl[1],S.br[0],S.br[1],v.tl[0],v.tl[1],v.br[0],v.br[1],S.pixelRatio,v.pixelRatio),this.zoomOutPaintVertexArray.emplace(M,S.tl[0],S.tl[1],S.br[0],S.br[1],A.tl[0],A.tl[1],A.br[0],A.br[1],S.pixelRatio,A.pixelRatio)}upload(e){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,Jt.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,Jt.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class cu{constructor(e,r,a){this.binders={},this._buffers=[];const c=[];for(const p in e.paint._values){if(!a(p))continue;const m=e.paint.get(p);if(!(m instanceof lr&&En(m.property.specification)))continue;const y=tf(p,e.type),v=m.value,S=m.property.specification.type,A=m.property.useIntegerZoom,M=m.property.specification["property-type"],k=M==="cross-faded"||M==="cross-faded-data-driven";if(v.kind==="constant")this.binders[p]=k?new rs(v.value,y):new oo(v.value,y,S),c.push(`/u_${p}`);else if(v.kind==="source"||k){const D=hu(p,S,"source");this.binders[p]=k?new Bn(v,S,A,r,D,e.id):new dn(v,y,S,D),c.push(`/a_${p}`)}else{const D=hu(p,S,"composite");this.binders[p]=new Ir(v,y,S,A,r,D),c.push(`/z_${p}`)}}this.cacheKey=c.sort().join("")}getMaxValue(e){const r=this.binders[e];return r instanceof dn||r instanceof Ir?r.maxValue:0}populatePaintArrays(e,r,a,c,p){for(const m in this.binders){const y=this.binders[m];(y instanceof dn||y instanceof Ir||y instanceof Bn)&&y.populatePaintArray(e,r,a,c,p)}}setConstantPatternPositions(e,r){for(const a in this.binders){const c=this.binders[a];c instanceof rs&&c.setConstantPatternPositions(e,r)}}updatePaintArrays(e,r,a,c,p){let m=!1;for(const y in e){const v=r.getPositions(y);for(const S of v){const A=a.feature(S.index);for(const M in this.binders){const k=this.binders[M];if((k instanceof dn||k instanceof Ir||k instanceof Bn)&&k.expression.isStateDependent===!0){const D=c.paint.get(M);k.expression=D.value,k.updatePaintArray(S.start,S.end,A,e[y],p),m=!0}}}}return m}defines(){const e=[];for(const r in this.binders){const a=this.binders[r];(a instanceof oo||a instanceof rs)&&e.push(...a.uniformNames.map(c=>`#define HAS_UNIFORM_${c}`))}return e}getBinderAttributes(){const e=[];for(const r in this.binders){const a=this.binders[r];if(a instanceof dn||a instanceof Ir)for(let c=0;c<a.paintVertexAttributes.length;c++)e.push(a.paintVertexAttributes[c].name);else if(a instanceof Bn)for(let c=0;c<Jt.members.length;c++)e.push(Jt.members[c].name)}return e}getBinderUniforms(){const e=[];for(const r in this.binders){const a=this.binders[r];if(a instanceof oo||a instanceof rs||a instanceof Ir)for(const c of a.uniformNames)e.push(c)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,r){const a=[];for(const c in this.binders){const p=this.binders[c];if(p instanceof oo||p instanceof rs||p instanceof Ir){for(const m of p.uniformNames)if(r[m]){const y=p.getBinding(e,r[m],m);a.push({name:m,property:c,binding:y})}}}return a}setUniforms(e,r,a,c){for(const{name:p,property:m,binding:y}of r)this.binders[m].setUniform(y,c,a.get(m),p)}updatePaintBuffers(e){this._buffers=[];for(const r in this.binders){const a=this.binders[r];if(e&&a instanceof Bn){const c=e.fromScale===2?a.zoomInPaintVertexBuffer:a.zoomOutPaintVertexBuffer;c&&this._buffers.push(c)}else(a instanceof dn||a instanceof Ir)&&a.paintVertexBuffer&&this._buffers.push(a.paintVertexBuffer)}}upload(e){for(const r in this.binders){const a=this.binders[r];(a instanceof dn||a instanceof Ir||a instanceof Bn)&&a.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const r=this.binders[e];(r instanceof dn||r instanceof Ir||r instanceof Bn)&&r.destroy()}}}class ga{constructor(e,r,a=()=>!0){this.programConfigurations={};for(const c of e)this.programConfigurations[c.id]=new cu(c,r,a);this.needsUpload=!1,this._featureMap=new ts,this._bufferOffset=0}populatePaintArrays(e,r,a,c,p,m){for(const y in this.programConfigurations)this.programConfigurations[y].populatePaintArrays(e,r,c,p,m);r.id!==void 0&&this._featureMap.add(r.id,a,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,r,a,c){for(const p of a)this.needsUpload=this.programConfigurations[p.id].updatePaintArrays(e,this._featureMap,r,p,c)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const r in this.programConfigurations)this.programConfigurations[r].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}function tf(i,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[i]||[i.replace(`${e}-`,"").replace(/-/g,"_")]}function hu(i,e,r){const a={color:{source:n,composite:ie},number:{source:U,composite:n}},c=function(p){return{"line-pattern":{source:It,composite:It},"fill-pattern":{source:It,composite:It},"fill-extrusion-pattern":{source:It,composite:It}}[p]}(i);return c&&c[r]||a[e][r]}Re("ConstantBinder",oo),Re("CrossFadedConstantBinder",rs),Re("SourceExpressionBinder",dn),Re("CrossFadedCompositeBinder",Bn),Re("CompositeExpressionBinder",Ir),Re("ProgramConfiguration",cu,{omit:["_buffers"]}),Re("ProgramConfigurationSet",ga);var ai=8192;const Lc=Math.pow(2,14)-1,uu=-Lc-1;function ya(i){const e=ai/i.extent,r=i.loadGeometry();for(let a=0;a<r.length;a++){const c=r[a];for(let p=0;p<c.length;p++){const m=c[p],y=Math.round(m.x*e),v=Math.round(m.y*e);m.x=H(y,uu,Lc),m.y=H(v,uu,Lc),(y<m.x||y>m.x+1||v<m.y||v>m.y+1)&&gt("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function _a(i,e){return{type:i.type,id:i.id,properties:i.properties,geometry:e?ya(i):[]}}function xl(i,e,r,a,c){i.emplaceBack(2*e+(a+1)/2,2*r+(c+1)/2)}class Dc{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new ct,this.indexArray=new Ci,this.segments=new xt,this.programConfigurations=new ga(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,a){const c=this.layers[0],p=[];let m=null,y=!1;c.type==="circle"&&(m=c.layout.get("circle-sort-key"),y=!m.isConstant());for(const{feature:v,id:S,index:A,sourceLayerIndex:M}of e){const k=this.layers[0]._featureFilter.needGeometry,D=_a(v,k);if(!this.layers[0]._featureFilter.filter(new Bt(this.zoom),D,a))continue;const B=y?m.evaluate(D,{},a):void 0,Z={id:S,properties:v.properties,type:v.type,sourceLayerIndex:M,index:A,geometry:k?D.geometry:ya(v),patterns:{},sortKey:B};p.push(Z)}y&&p.sort((v,S)=>v.sortKey-S.sortKey);for(const v of p){const{geometry:S,index:A,sourceLayerIndex:M}=v,k=e[A].feature;this.addFeature(v,S,A,a),r.featureIndex.insert(k,S,A,M,this.index)}}update(e,r,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,a)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Li),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,r,a,c){for(const p of r)for(const m of p){const y=m.x,v=m.y;if(y<0||y>=ai||v<0||v>=ai)continue;const S=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),A=S.vertexLength;xl(this.layoutVertexArray,y,v,-1,-1),xl(this.layoutVertexArray,y,v,1,-1),xl(this.layoutVertexArray,y,v,1,1),xl(this.layoutVertexArray,y,v,-1,1),this.indexArray.emplaceBack(A,A+1,A+2),this.indexArray.emplaceBack(A,A+3,A+2),S.vertexLength+=4,S.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,a,{},c)}}function du(i,e){for(let r=0;r<i.length;r++)if(ns(e,i[r]))return!0;for(let r=0;r<e.length;r++)if(ns(i,e[r]))return!0;return!!Rc(i,e)}function rf(i,e,r){return!!ns(i,e)||!!Bc(e,i,r)}function pu(i,e){if(i.length===1)return fu(e,i[0]);for(let r=0;r<e.length;r++){const a=e[r];for(let c=0;c<a.length;c++)if(ns(i,a[c]))return!0}for(let r=0;r<i.length;r++)if(fu(e,i[r]))return!0;for(let r=0;r<e.length;r++)if(Rc(i,e[r]))return!0;return!1}function nf(i,e,r){if(i.length>1){if(Rc(i,e))return!0;for(let a=0;a<e.length;a++)if(Bc(e[a],i,r))return!0}for(let a=0;a<i.length;a++)if(Bc(i[a],e,r))return!0;return!1}function Rc(i,e){if(i.length===0||e.length===0)return!1;for(let r=0;r<i.length-1;r++){const a=i[r],c=i[r+1];for(let p=0;p<e.length-1;p++)if(af(a,c,e[p],e[p+1]))return!0}return!1}function af(i,e,r,a){return Qe(i,r,a)!==Qe(e,r,a)&&Qe(i,e,r)!==Qe(i,e,a)}function Bc(i,e,r){const a=r*r;if(e.length===1)return i.distSqr(e[0])<a;for(let c=1;c<e.length;c++)if(mu(i,e[c-1],e[c])<a)return!0;return!1}function mu(i,e,r){const a=e.distSqr(r);if(a===0)return i.distSqr(e);const c=((i.x-e.x)*(r.x-e.x)+(i.y-e.y)*(r.y-e.y))/a;return i.distSqr(c<0?e:c>1?r:r.sub(e)._mult(c)._add(e))}function fu(i,e){let r,a,c,p=!1;for(let m=0;m<i.length;m++){r=i[m];for(let y=0,v=r.length-1;y<r.length;v=y++)a=r[y],c=r[v],a.y>e.y!=c.y>e.y&&e.x<(c.x-a.x)*(e.y-a.y)/(c.y-a.y)+a.x&&(p=!p)}return p}function ns(i,e){let r=!1;for(let a=0,c=i.length-1;a<i.length;c=a++){const p=i[a],m=i[c];p.y>e.y!=m.y>e.y&&e.x<(m.x-p.x)*(e.y-p.y)/(m.y-p.y)+p.x&&(r=!r)}return r}function sf(i,e,r){const a=r[0],c=r[2];if(i.x<a.x&&e.x<a.x||i.x>c.x&&e.x>c.x||i.y<a.y&&e.y<a.y||i.y>c.y&&e.y>c.y)return!1;const p=Qe(i,e,r[0]);return p!==Qe(i,e,r[1])||p!==Qe(i,e,r[2])||p!==Qe(i,e,r[3])}function lo(i,e,r){const a=e.paint.get(i).value;return a.kind==="constant"?a.value:r.programConfigurations.get(e.id).getMaxValue(i)}function vl(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function bl(i,e,r,a,c){if(!e[0]&&!e[1])return i;const p=Ke.convert(e)._mult(c);r==="viewport"&&p._rotate(-a);const m=[];for(let y=0;y<i.length;y++)m.push(i[y].sub(p));return m}Re("CircleBucket",Dc,{omit:["layers"]});const of=new ri({"circle-sort-key":new Xe(de.layout_circle["circle-sort-key"])});var lf={paint:new ri({"circle-radius":new Xe(de.paint_circle["circle-radius"]),"circle-color":new Xe(de.paint_circle["circle-color"]),"circle-blur":new Xe(de.paint_circle["circle-blur"]),"circle-opacity":new Xe(de.paint_circle["circle-opacity"]),"circle-translate":new Ue(de.paint_circle["circle-translate"]),"circle-translate-anchor":new Ue(de.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Ue(de.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Ue(de.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Xe(de.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Xe(de.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Xe(de.paint_circle["circle-stroke-opacity"])}),layout:of},as=typeof Float32Array<"u"?Float32Array:Array;function Fc(i){return i[0]=1,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=1,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=1,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i}function gu(i,e,r){var a=e[0],c=e[1],p=e[2],m=e[3],y=e[4],v=e[5],S=e[6],A=e[7],M=e[8],k=e[9],D=e[10],B=e[11],Z=e[12],W=e[13],re=e[14],oe=e[15],se=r[0],pe=r[1],xe=r[2],ye=r[3];return i[0]=se*a+pe*y+xe*M+ye*Z,i[1]=se*c+pe*v+xe*k+ye*W,i[2]=se*p+pe*S+xe*D+ye*re,i[3]=se*m+pe*A+xe*B+ye*oe,i[4]=(se=r[4])*a+(pe=r[5])*y+(xe=r[6])*M+(ye=r[7])*Z,i[5]=se*c+pe*v+xe*k+ye*W,i[6]=se*p+pe*S+xe*D+ye*re,i[7]=se*m+pe*A+xe*B+ye*oe,i[8]=(se=r[8])*a+(pe=r[9])*y+(xe=r[10])*M+(ye=r[11])*Z,i[9]=se*c+pe*v+xe*k+ye*W,i[10]=se*p+pe*S+xe*D+ye*re,i[11]=se*m+pe*A+xe*B+ye*oe,i[12]=(se=r[12])*a+(pe=r[13])*y+(xe=r[14])*M+(ye=r[15])*Z,i[13]=se*c+pe*v+xe*k+ye*W,i[14]=se*p+pe*S+xe*D+ye*re,i[15]=se*m+pe*A+xe*B+ye*oe,i}Math.hypot||(Math.hypot=function(){for(var i=0,e=arguments.length;e--;)i+=arguments[e]*arguments[e];return Math.sqrt(i)});var co,cf=gu;function wl(i,e,r){var a=e[0],c=e[1],p=e[2],m=e[3];return i[0]=r[0]*a+r[4]*c+r[8]*p+r[12]*m,i[1]=r[1]*a+r[5]*c+r[9]*p+r[13]*m,i[2]=r[2]*a+r[6]*c+r[10]*p+r[14]*m,i[3]=r[3]*a+r[7]*c+r[11]*p+r[15]*m,i}function yu(i,e){const r=wl([],[i.x,i.y,0,1],e);return new Ke(r[0]/r[3],r[1]/r[3])}co=new as(4),as!=Float32Array&&(co[0]=0,co[1]=0,co[2]=0,co[3]=0);class _u extends Dc{}Re("HeatmapBucket",_u,{omit:["layers"]});var hf={paint:new ri({"heatmap-radius":new Xe(de.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Xe(de.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Ue(de.paint_heatmap["heatmap-intensity"]),"heatmap-color":new ao(de.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Ue(de.paint_heatmap["heatmap-opacity"])})};function Oc(i,{width:e,height:r},a,c){if(c){if(c instanceof Uint8ClampedArray)c=new Uint8Array(c.buffer);else if(c.length!==e*r*a)throw new RangeError(`mismatched image size. expected: ${c.length} but got: ${e*r*a}`)}else c=new Uint8Array(e*r*a);return i.width=e,i.height=r,i.data=c,i}function xu(i,{width:e,height:r},a){if(e===i.width&&r===i.height)return;const c=Oc({},{width:e,height:r},a);Uc(i,c,{x:0,y:0},{x:0,y:0},{width:Math.min(i.width,e),height:Math.min(i.height,r)},a),i.width=e,i.height=r,i.data=c.data}function Uc(i,e,r,a,c,p){if(c.width===0||c.height===0)return e;if(c.width>i.width||c.height>i.height||r.x>i.width-c.width||r.y>i.height-c.height)throw new RangeError("out of range source coordinates for image copy");if(c.width>e.width||c.height>e.height||a.x>e.width-c.width||a.y>e.height-c.height)throw new RangeError("out of range destination coordinates for image copy");const m=i.data,y=e.data;for(let v=0;v<c.height;v++){const S=((r.y+v)*i.width+r.x)*p,A=((a.y+v)*e.width+a.x)*p;for(let M=0;M<c.width*p;M++)y[A+M]=m[S+M]}return e}class ho{constructor(e,r){Oc(this,e,1,r)}resize(e){xu(this,e,1)}clone(){return new ho({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,a,c,p){Uc(e,r,a,c,p,1)}}class ir{constructor(e,r){Oc(this,e,4,r)}resize(e){xu(this,e,4)}replace(e,r){r?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new ir({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,a,c,p){Uc(e,r,a,c,p,4)}}function vu(i){const e={},r=i.resolution||256,a=i.clips?i.clips.length:1,c=i.image||new ir({width:r,height:a}),p=(m,y,v)=>{e[i.evaluationKey]=v;const S=i.expression.evaluate(e);c.data[m+y+0]=Math.floor(255*S.r/S.a),c.data[m+y+1]=Math.floor(255*S.g/S.a),c.data[m+y+2]=Math.floor(255*S.b/S.a),c.data[m+y+3]=Math.floor(255*S.a)};if(i.clips)for(let m=0,y=0;m<a;++m,y+=4*r)for(let v=0,S=0;v<r;v++,S+=4){const A=v/(r-1),{start:M,end:k}=i.clips[m];p(y,S,M*(1-A)+k*A)}else for(let m=0,y=0;m<r;m++,y+=4)p(0,y,m/(r-1));return c}Re("AlphaImage",ho),Re("RGBAImage",ir);var uf={paint:new ri({"hillshade-illumination-direction":new Ue(de.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Ue(de.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Ue(de.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Ue(de.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Ue(de.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Ue(de.paint_hillshade["hillshade-accent-color"])})};const df=ni([{name:"a_pos",components:2,type:"Int16"}],4),{members:pf}=df;var $c={exports:{}};function Sl(i,e,r){r=r||2;var a,c,p,m,y,v,S,A=e&&e.length,M=A?e[0]*r:i.length,k=bu(i,0,M,r,!0),D=[];if(!k||k.next===k.prev)return D;if(A&&(k=function(Z,W,re,oe){var se,pe,xe,ye=[];for(se=0,pe=W.length;se<pe;se++)(xe=bu(Z,W[se]*oe,se<pe-1?W[se+1]*oe:Z.length,oe,!1))===xe.next&&(xe.steiner=!0),ye.push(bf(xe));for(ye.sort(_f),se=0;se<ye.length;se++)re=Fn(re=xf(ye[se],re),re.next);return re}(i,e,k,r)),i.length>80*r){a=p=i[0],c=m=i[1];for(var B=r;B<M;B+=r)(y=i[B])<a&&(a=y),(v=i[B+1])<c&&(c=v),y>p&&(p=y),v>m&&(m=v);S=(S=Math.max(p-a,m-c))!==0?1/S:0}return uo(k,D,r,a,c,S),D}function bu(i,e,r,a,c){var p,m;if(c===Gc(i,e,r,a)>0)for(p=e;p<r;p+=a)m=Tu(p,i[p],i[p+1],m);else for(p=r-a;p>=e;p-=a)m=Tu(p,i[p],i[p+1],m);return m&&Tl(m,m.next)&&(mo(m),m=m.next),m}function Fn(i,e){if(!i)return i;e||(e=i);var r,a=i;do if(r=!1,a.steiner||!Tl(a,a.next)&&Ht(a.prev,a,a.next)!==0)a=a.next;else{if(mo(a),(a=e=a.prev)===a.next)break;r=!0}while(r||a!==e);return e}function uo(i,e,r,a,c,p,m){if(i){!m&&p&&function(A,M,k,D){var B=A;do B.z===null&&(B.z=Nc(B.x,B.y,M,k,D)),B.prevZ=B.prev,B.nextZ=B.next,B=B.next;while(B!==A);B.prevZ.nextZ=null,B.prevZ=null,function(Z){var W,re,oe,se,pe,xe,ye,Be,qe=1;do{for(re=Z,Z=null,pe=null,xe=0;re;){for(xe++,oe=re,ye=0,W=0;W<qe&&(ye++,oe=oe.nextZ);W++);for(Be=qe;ye>0||Be>0&&oe;)ye!==0&&(Be===0||!oe||re.z<=oe.z)?(se=re,re=re.nextZ,ye--):(se=oe,oe=oe.nextZ,Be--),pe?pe.nextZ=se:Z=se,se.prevZ=pe,pe=se;re=oe}pe.nextZ=null,qe*=2}while(xe>1)}(B)}(i,a,c,p);for(var y,v,S=i;i.prev!==i.next;)if(y=i.prev,v=i.next,p?ff(i,a,c,p):mf(i))e.push(y.i/r),e.push(i.i/r),e.push(v.i/r),mo(i),i=v.next,S=v.next;else if((i=v)===S){m?m===1?uo(i=gf(Fn(i),e,r),e,r,a,c,p,2):m===2&&yf(i,e,r,a,c,p):uo(Fn(i),e,r,a,c,p,1);break}}}function mf(i){var e=i.prev,r=i,a=i.next;if(Ht(e,r,a)>=0)return!1;for(var c=i.next.next;c!==i.prev;){if(ss(e.x,e.y,r.x,r.y,a.x,a.y,c.x,c.y)&&Ht(c.prev,c,c.next)>=0)return!1;c=c.next}return!0}function ff(i,e,r,a){var c=i.prev,p=i,m=i.next;if(Ht(c,p,m)>=0)return!1;for(var y=c.x>p.x?c.x>m.x?c.x:m.x:p.x>m.x?p.x:m.x,v=c.y>p.y?c.y>m.y?c.y:m.y:p.y>m.y?p.y:m.y,S=Nc(c.x<p.x?c.x<m.x?c.x:m.x:p.x<m.x?p.x:m.x,c.y<p.y?c.y<m.y?c.y:m.y:p.y<m.y?p.y:m.y,e,r,a),A=Nc(y,v,e,r,a),M=i.prevZ,k=i.nextZ;M&&M.z>=S&&k&&k.z<=A;){if(M!==i.prev&&M!==i.next&&ss(c.x,c.y,p.x,p.y,m.x,m.y,M.x,M.y)&&Ht(M.prev,M,M.next)>=0||(M=M.prevZ,k!==i.prev&&k!==i.next&&ss(c.x,c.y,p.x,p.y,m.x,m.y,k.x,k.y)&&Ht(k.prev,k,k.next)>=0))return!1;k=k.nextZ}for(;M&&M.z>=S;){if(M!==i.prev&&M!==i.next&&ss(c.x,c.y,p.x,p.y,m.x,m.y,M.x,M.y)&&Ht(M.prev,M,M.next)>=0)return!1;M=M.prevZ}for(;k&&k.z<=A;){if(k!==i.prev&&k!==i.next&&ss(c.x,c.y,p.x,p.y,m.x,m.y,k.x,k.y)&&Ht(k.prev,k,k.next)>=0)return!1;k=k.nextZ}return!0}function gf(i,e,r){var a=i;do{var c=a.prev,p=a.next.next;!Tl(c,p)&&wu(c,a,a.next,p)&&po(c,p)&&po(p,c)&&(e.push(c.i/r),e.push(a.i/r),e.push(p.i/r),mo(a),mo(a.next),a=i=p),a=a.next}while(a!==i);return Fn(a)}function yf(i,e,r,a,c,p){var m=i;do{for(var y=m.next.next;y!==m.prev;){if(m.i!==y.i&&wf(m,y)){var v=Su(m,y);return m=Fn(m,m.next),v=Fn(v,v.next),uo(m,e,r,a,c,p),void uo(v,e,r,a,c,p)}y=y.next}m=m.next}while(m!==i)}function _f(i,e){return i.x-e.x}function xf(i,e){var r=function(p,m){var y,v=m,S=p.x,A=p.y,M=-1/0;do{if(A<=v.y&&A>=v.next.y&&v.next.y!==v.y){var k=v.x+(A-v.y)*(v.next.x-v.x)/(v.next.y-v.y);if(k<=S&&k>M){if(M=k,k===S){if(A===v.y)return v;if(A===v.next.y)return v.next}y=v.x<v.next.x?v:v.next}}v=v.next}while(v!==m);if(!y)return null;if(S===M)return y;var D,B=y,Z=y.x,W=y.y,re=1/0;v=y;do S>=v.x&&v.x>=Z&&S!==v.x&&ss(A<W?S:M,A,Z,W,A<W?M:S,A,v.x,v.y)&&(D=Math.abs(A-v.y)/(S-v.x),po(v,p)&&(D<re||D===re&&(v.x>y.x||v.x===y.x&&vf(y,v)))&&(y=v,re=D)),v=v.next;while(v!==B);return y}(i,e);if(!r)return e;var a=Su(r,i),c=Fn(r,r.next);return Fn(a,a.next),e===r?c:e}function vf(i,e){return Ht(i.prev,i,e.prev)<0&&Ht(e.next,i,i.next)<0}function Nc(i,e,r,a,c){return(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=32767*(i-r)*c)|i<<8))|i<<4))|i<<2))|i<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-a)*c)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function bf(i){var e=i,r=i;do(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next;while(e!==i);return r}function ss(i,e,r,a,c,p,m,y){return(c-m)*(e-y)-(i-m)*(p-y)>=0&&(i-m)*(a-y)-(r-m)*(e-y)>=0&&(r-m)*(p-y)-(c-m)*(a-y)>=0}function wf(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!function(r,a){var c=r;do{if(c.i!==r.i&&c.next.i!==r.i&&c.i!==a.i&&c.next.i!==a.i&&wu(c,c.next,r,a))return!0;c=c.next}while(c!==r);return!1}(i,e)&&(po(i,e)&&po(e,i)&&function(r,a){var c=r,p=!1,m=(r.x+a.x)/2,y=(r.y+a.y)/2;do c.y>y!=c.next.y>y&&c.next.y!==c.y&&m<(c.next.x-c.x)*(y-c.y)/(c.next.y-c.y)+c.x&&(p=!p),c=c.next;while(c!==r);return p}(i,e)&&(Ht(i.prev,i,e.prev)||Ht(i,e.prev,e))||Tl(i,e)&&Ht(i.prev,i,i.next)>0&&Ht(e.prev,e,e.next)>0)}function Ht(i,e,r){return(e.y-i.y)*(r.x-e.x)-(e.x-i.x)*(r.y-e.y)}function Tl(i,e){return i.x===e.x&&i.y===e.y}function wu(i,e,r,a){var c=El(Ht(i,e,r)),p=El(Ht(i,e,a)),m=El(Ht(r,a,i)),y=El(Ht(r,a,e));return c!==p&&m!==y||!(c!==0||!Il(i,r,e))||!(p!==0||!Il(i,a,e))||!(m!==0||!Il(r,i,a))||!(y!==0||!Il(r,e,a))}function Il(i,e,r){return e.x<=Math.max(i.x,r.x)&&e.x>=Math.min(i.x,r.x)&&e.y<=Math.max(i.y,r.y)&&e.y>=Math.min(i.y,r.y)}function El(i){return i>0?1:i<0?-1:0}function po(i,e){return Ht(i.prev,i,i.next)<0?Ht(i,e,i.next)>=0&&Ht(i,i.prev,e)>=0:Ht(i,e,i.prev)<0||Ht(i,i.next,e)<0}function Su(i,e){var r=new Vc(i.i,i.x,i.y),a=new Vc(e.i,e.x,e.y),c=i.next,p=e.prev;return i.next=e,e.prev=i,r.next=c,c.prev=r,a.next=r,r.prev=a,p.next=a,a.prev=p,a}function Tu(i,e,r,a){var c=new Vc(i,e,r);return a?(c.next=a.next,c.prev=a,a.next.prev=c,a.next=c):(c.prev=c,c.next=c),c}function mo(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function Vc(i,e,r){this.i=i,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Gc(i,e,r,a){for(var c=0,p=e,m=r-a;p<r;p+=a)c+=(i[m]-i[p])*(i[p+1]+i[m+1]),m=p;return c}$c.exports=Sl,$c.exports.default=Sl,Sl.deviation=function(i,e,r,a){var c=e&&e.length,p=Math.abs(Gc(i,0,c?e[0]*r:i.length,r));if(c)for(var m=0,y=e.length;m<y;m++)p-=Math.abs(Gc(i,e[m]*r,m<y-1?e[m+1]*r:i.length,r));var v=0;for(m=0;m<a.length;m+=3){var S=a[m]*r,A=a[m+1]*r,M=a[m+2]*r;v+=Math.abs((i[S]-i[M])*(i[A+1]-i[S+1])-(i[S]-i[A])*(i[M+1]-i[S+1]))}return p===0&&v===0?0:Math.abs((v-p)/p)},Sl.flatten=function(i){for(var e=i[0][0].length,r={vertices:[],holes:[],dimensions:e},a=0,c=0;c<i.length;c++){for(var p=0;p<i[c].length;p++)for(var m=0;m<e;m++)r.vertices.push(i[c][p][m]);c>0&&r.holes.push(a+=i[c-1].length)}return r};var Iu=$c.exports;function Sf(i,e,r,a,c){Eu(i,e,r||0,a||i.length-1,c||Tf)}function Eu(i,e,r,a,c){for(;a>r;){if(a-r>600){var p=a-r+1,m=e-r+1,y=Math.log(p),v=.5*Math.exp(2*y/3),S=.5*Math.sqrt(y*v*(p-v)/p)*(m-p/2<0?-1:1);Eu(i,e,Math.max(r,Math.floor(e-m*v/p+S)),Math.min(a,Math.floor(e+(p-m)*v/p+S)),c)}var A=i[e],M=r,k=a;for(fo(i,r,e),c(i[a],A)>0&&fo(i,r,a);M<k;){for(fo(i,M,k),M++,k--;c(i[M],A)<0;)M++;for(;c(i[k],A)>0;)k--}c(i[r],A)===0?fo(i,r,k):fo(i,++k,a),k<=e&&(r=k+1),e<=k&&(a=k-1)}}function fo(i,e,r){var a=i[e];i[e]=i[r],i[r]=a}function Tf(i,e){return i<e?-1:i>e?1:0}function qc(i,e){const r=i.length;if(r<=1)return[i];const a=[];let c,p;for(let m=0;m<r;m++){const y=Dt(i[m]);y!==0&&(i[m].area=Math.abs(y),p===void 0&&(p=y<0),p===y<0?(c&&a.push(c),c=[i[m]]):c.push(i[m]))}if(c&&a.push(c),e>1)for(let m=0;m<a.length;m++)a[m].length<=e||(Sf(a[m],e,1,a[m].length-1,If),a[m]=a[m].slice(0,e));return a}function If(i,e){return e.area-i.area}function jc(i,e,r){const a=r.patternDependencies;let c=!1;for(const p of e){const m=p.paint.get(`${i}-pattern`);m.isConstant()||(c=!0);const y=m.constantOr(null);y&&(c=!0,a[y.to]=!0,a[y.from]=!0)}return c}function Zc(i,e,r,a,c){const p=c.patternDependencies;for(const m of e){const y=m.paint.get(`${i}-pattern`).value;if(y.kind!=="constant"){let v=y.evaluate({zoom:a-1},r,{},c.availableImages),S=y.evaluate({zoom:a},r,{},c.availableImages),A=y.evaluate({zoom:a+1},r,{},c.availableImages);v=v&&v.name?v.name:v,S=S&&S.name?S.name:S,A=A&&A.name?A.name:A,p[v]=!0,p[S]=!0,p[A]=!0,r.patterns[m.id]={min:v,mid:S,max:A}}}return r}class Wc{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new dt,this.indexArray=new Ci,this.indexArray2=new cr,this.programConfigurations=new ga(e.layers,e.zoom),this.segments=new xt,this.segments2=new xt,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,a){this.hasPattern=jc("fill",this.layers,r);const c=this.layers[0].layout.get("fill-sort-key"),p=!c.isConstant(),m=[];for(const{feature:y,id:v,index:S,sourceLayerIndex:A}of e){const M=this.layers[0]._featureFilter.needGeometry,k=_a(y,M);if(!this.layers[0]._featureFilter.filter(new Bt(this.zoom),k,a))continue;const D=p?c.evaluate(k,{},a,r.availableImages):void 0,B={id:v,properties:y.properties,type:y.type,sourceLayerIndex:A,index:S,geometry:M?k.geometry:ya(y),patterns:{},sortKey:D};m.push(B)}p&&m.sort((y,v)=>y.sortKey-v.sortKey);for(const y of m){const{geometry:v,index:S,sourceLayerIndex:A}=y;if(this.hasPattern){const M=Zc("fill",this.layers,y,this.zoom,r);this.patternFeatures.push(M)}else this.addFeature(y,v,S,a,{});r.featureIndex.insert(e[S].feature,v,S,A,this.index)}}update(e,r,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,a)}addFeatures(e,r,a){for(const c of this.patternFeatures)this.addFeature(c,c.geometry,c.index,r,a)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,pf),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(e,r,a,c,p){for(const m of qc(r,500)){let y=0;for(const D of m)y+=D.length;const v=this.segments.prepareSegment(y,this.layoutVertexArray,this.indexArray),S=v.vertexLength,A=[],M=[];for(const D of m){if(D.length===0)continue;D!==m[0]&&M.push(A.length/2);const B=this.segments2.prepareSegment(D.length,this.layoutVertexArray,this.indexArray2),Z=B.vertexLength;this.layoutVertexArray.emplaceBack(D[0].x,D[0].y),this.indexArray2.emplaceBack(Z+D.length-1,Z),A.push(D[0].x),A.push(D[0].y);for(let W=1;W<D.length;W++)this.layoutVertexArray.emplaceBack(D[W].x,D[W].y),this.indexArray2.emplaceBack(Z+W-1,Z+W),A.push(D[W].x),A.push(D[W].y);B.vertexLength+=D.length,B.primitiveLength+=D.length}const k=Iu(A,M);for(let D=0;D<k.length;D+=3)this.indexArray.emplaceBack(S+k[D],S+k[D+1],S+k[D+2]);v.vertexLength+=y,v.primitiveLength+=k.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,a,p,c)}}Re("FillBucket",Wc,{omit:["layers","patternFeatures"]});const Ef=new ri({"fill-sort-key":new Xe(de.layout_fill["fill-sort-key"])});var Af={paint:new ri({"fill-antialias":new Ue(de.paint_fill["fill-antialias"]),"fill-opacity":new Xe(de.paint_fill["fill-opacity"]),"fill-color":new Xe(de.paint_fill["fill-color"]),"fill-outline-color":new Xe(de.paint_fill["fill-outline-color"]),"fill-translate":new Ue(de.paint_fill["fill-translate"]),"fill-translate-anchor":new Ue(de.paint_fill["fill-translate-anchor"]),"fill-pattern":new da(de.paint_fill["fill-pattern"])}),layout:Ef};const Cf=ni([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),{members:Mf}=Cf;var On={},Pf=Ke,Au=os;function os(i,e,r,a,c){this.properties={},this.extent=r,this.type=0,this._pbf=i,this._geometry=-1,this._keys=a,this._values=c,i.readFields(zf,this,e)}function zf(i,e,r){i==1?e.id=r.readVarint():i==2?function(a,c){for(var p=a.readVarint()+a.pos;a.pos<p;){var m=c._keys[a.readVarint()],y=c._values[a.readVarint()];c.properties[m]=y}}(r,e):i==3?e.type=r.readVarint():i==4&&(e._geometry=r.pos)}function kf(i){for(var e,r,a=0,c=0,p=i.length,m=p-1;c<p;m=c++)a+=((r=i[m]).x-(e=i[c]).x)*(e.y+r.y);return a}os.types=["Unknown","Point","LineString","Polygon"],os.prototype.loadGeometry=function(){var i=this._pbf;i.pos=this._geometry;for(var e,r=i.readVarint()+i.pos,a=1,c=0,p=0,m=0,y=[];i.pos<r;){if(c<=0){var v=i.readVarint();a=7&v,c=v>>3}if(c--,a===1||a===2)p+=i.readSVarint(),m+=i.readSVarint(),a===1&&(e&&y.push(e),e=[]),e.push(new Pf(p,m));else{if(a!==7)throw new Error("unknown command "+a);e&&e.push(e[0].clone())}}return e&&y.push(e),y},os.prototype.bbox=function(){var i=this._pbf;i.pos=this._geometry;for(var e=i.readVarint()+i.pos,r=1,a=0,c=0,p=0,m=1/0,y=-1/0,v=1/0,S=-1/0;i.pos<e;){if(a<=0){var A=i.readVarint();r=7&A,a=A>>3}if(a--,r===1||r===2)(c+=i.readSVarint())<m&&(m=c),c>y&&(y=c),(p+=i.readSVarint())<v&&(v=p),p>S&&(S=p);else if(r!==7)throw new Error("unknown command "+r)}return[m,v,y,S]},os.prototype.toGeoJSON=function(i,e,r){var a,c,p=this.extent*Math.pow(2,r),m=this.extent*i,y=this.extent*e,v=this.loadGeometry(),S=os.types[this.type];function A(D){for(var B=0;B<D.length;B++){var Z=D[B];D[B]=[360*(Z.x+m)/p-180,360/Math.PI*Math.atan(Math.exp((180-360*(Z.y+y)/p)*Math.PI/180))-90]}}switch(this.type){case 1:var M=[];for(a=0;a<v.length;a++)M[a]=v[a][0];A(v=M);break;case 2:for(a=0;a<v.length;a++)A(v[a]);break;case 3:for(v=function(D){var B=D.length;if(B<=1)return[D];for(var Z,W,re=[],oe=0;oe<B;oe++){var se=kf(D[oe]);se!==0&&(W===void 0&&(W=se<0),W===se<0?(Z&&re.push(Z),Z=[D[oe]]):Z.push(D[oe]))}return Z&&re.push(Z),re}(v),a=0;a<v.length;a++)for(c=0;c<v[a].length;c++)A(v[a][c])}v.length===1?v=v[0]:S="Multi"+S;var k={type:"Feature",geometry:{type:S,coordinates:v},properties:this.properties};return"id"in this&&(k.id=this.id),k};var Lf=Au,Cu=Mu;function Mu(i,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=i,this._keys=[],this._values=[],this._features=[],i.readFields(Df,this,e),this.length=this._features.length}function Df(i,e,r){i===15?e.version=r.readVarint():i===1?e.name=r.readString():i===5?e.extent=r.readVarint():i===2?e._features.push(r.pos):i===3?e._keys.push(r.readString()):i===4&&e._values.push(function(a){for(var c=null,p=a.readVarint()+a.pos;a.pos<p;){var m=a.readVarint()>>3;c=m===1?a.readString():m===2?a.readFloat():m===3?a.readDouble():m===4?a.readVarint64():m===5?a.readVarint():m===6?a.readSVarint():m===7?a.readBoolean():null}return c}(r))}Mu.prototype.feature=function(i){if(i<0||i>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[i];var e=this._pbf.readVarint()+this._pbf.pos;return new Lf(this._pbf,e,this.extent,this._keys,this._values)};var Rf=Cu;function Bf(i,e,r){if(i===3){var a=new Rf(r,r.readVarint()+r.pos);a.length&&(e[a.name]=a)}}On.VectorTile=function(i,e){this.layers=i.readFields(Bf,{},e)},On.VectorTileFeature=Au,On.VectorTileLayer=Cu;const Ff=On.VectorTileFeature.types,Hc=Math.pow(2,13);function go(i,e,r,a,c,p,m,y){i.emplaceBack(e,r,2*Math.floor(a*Hc)+m,c*Hc*2,p*Hc*2,Math.round(y))}class Xc{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new Vt,this.indexArray=new Ci,this.programConfigurations=new ga(e.layers,e.zoom),this.segments=new xt,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,a){this.features=[],this.hasPattern=jc("fill-extrusion",this.layers,r);for(const{feature:c,id:p,index:m,sourceLayerIndex:y}of e){const v=this.layers[0]._featureFilter.needGeometry,S=_a(c,v);if(!this.layers[0]._featureFilter.filter(new Bt(this.zoom),S,a))continue;const A={id:p,sourceLayerIndex:y,index:m,geometry:v?S.geometry:ya(c),properties:c.properties,type:c.type,patterns:{}};this.hasPattern?this.features.push(Zc("fill-extrusion",this.layers,A,this.zoom,r)):this.addFeature(A,A.geometry,m,a,{}),r.featureIndex.insert(c,A.geometry,m,y,this.index,!0)}}addFeatures(e,r,a){for(const c of this.features){const{geometry:p}=c;this.addFeature(c,p,c.index,r,a)}}update(e,r,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,a)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Mf),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,r,a,c,p){for(const m of qc(r,500)){let y=0;for(const D of m)y+=D.length;let v=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const D of m){if(D.length===0||Uf(D))continue;let B=0;for(let Z=0;Z<D.length;Z++){const W=D[Z];if(Z>=1){const re=D[Z-1];if(!Of(W,re)){v.vertexLength+4>xt.MAX_VERTEX_ARRAY_LENGTH&&(v=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const oe=W.sub(re)._perp()._unit(),se=re.dist(W);B+se>32768&&(B=0),go(this.layoutVertexArray,W.x,W.y,oe.x,oe.y,0,0,B),go(this.layoutVertexArray,W.x,W.y,oe.x,oe.y,0,1,B),B+=se,go(this.layoutVertexArray,re.x,re.y,oe.x,oe.y,0,0,B),go(this.layoutVertexArray,re.x,re.y,oe.x,oe.y,0,1,B);const pe=v.vertexLength;this.indexArray.emplaceBack(pe,pe+2,pe+1),this.indexArray.emplaceBack(pe+1,pe+2,pe+3),v.vertexLength+=4,v.primitiveLength+=2}}}}if(v.vertexLength+y>xt.MAX_VERTEX_ARRAY_LENGTH&&(v=this.segments.prepareSegment(y,this.layoutVertexArray,this.indexArray)),Ff[e.type]!=="Polygon")continue;const S=[],A=[],M=v.vertexLength;for(const D of m)if(D.length!==0){D!==m[0]&&A.push(S.length/2);for(let B=0;B<D.length;B++){const Z=D[B];go(this.layoutVertexArray,Z.x,Z.y,0,0,1,1,0),S.push(Z.x),S.push(Z.y)}}const k=Iu(S,A);for(let D=0;D<k.length;D+=3)this.indexArray.emplaceBack(M+k[D],M+k[D+2],M+k[D+1]);v.primitiveLength+=k.length/3,v.vertexLength+=y}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,a,p,c)}}function Of(i,e){return i.x===e.x&&(i.x<0||i.x>ai)||i.y===e.y&&(i.y<0||i.y>ai)}function Uf(i){return i.every(e=>e.x<0)||i.every(e=>e.x>ai)||i.every(e=>e.y<0)||i.every(e=>e.y>ai)}Re("FillExtrusionBucket",Xc,{omit:["layers","features"]});var $f={paint:new ri({"fill-extrusion-opacity":new Ue(de["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Xe(de["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Ue(de["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Ue(de["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new da(de["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Xe(de["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Xe(de["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Ue(de["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})};function yo(i,e){return i.x*e.x+i.y*e.y}function Pu(i,e){if(i.length===1){let r=0;const a=e[r++];let c;for(;!c||a.equals(c);)if(c=e[r++],!c)return 1/0;for(;r<e.length;r++){const p=e[r],m=i[0],y=c.sub(a),v=p.sub(a),S=m.sub(a),A=yo(y,y),M=yo(y,v),k=yo(v,v),D=yo(S,y),B=yo(S,v),Z=A*k-M*M,W=(k*D-M*B)/Z,re=(A*B-M*D)/Z,oe=a.z*(1-W-re)+c.z*W+p.z*re;if(isFinite(oe))return oe}return 1/0}{let r=1/0;for(const a of e)r=Math.min(r,a.z);return r}}const Nf=ni([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:Vf}=Nf,Gf=ni([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:qf}=Gf,jf=On.VectorTileFeature.types,Zf=Math.cos(Math.PI/180*37.5),zu=Math.pow(2,14)/.5;class Yc{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(r=>{this.gradients[r.id]={}}),this.layoutVertexArray=new et,this.layoutVertexArray2=new _t,this.indexArray=new Ci,this.programConfigurations=new ga(e.layers,e.zoom),this.segments=new xt,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,a){this.hasPattern=jc("line",this.layers,r);const c=this.layers[0].layout.get("line-sort-key"),p=!c.isConstant(),m=[];for(const{feature:y,id:v,index:S,sourceLayerIndex:A}of e){const M=this.layers[0]._featureFilter.needGeometry,k=_a(y,M);if(!this.layers[0]._featureFilter.filter(new Bt(this.zoom),k,a))continue;const D=p?c.evaluate(k,{},a):void 0,B={id:v,properties:y.properties,type:y.type,sourceLayerIndex:A,index:S,geometry:M?k.geometry:ya(y),patterns:{},sortKey:D};m.push(B)}p&&m.sort((y,v)=>y.sortKey-v.sortKey);for(const y of m){const{geometry:v,index:S,sourceLayerIndex:A}=y;if(this.hasPattern){const M=Zc("line",this.layers,y,this.zoom,r);this.patternFeatures.push(M)}else this.addFeature(y,v,S,a,{});r.featureIndex.insert(e[S].feature,v,S,A,this.index)}}update(e,r,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,a)}addFeatures(e,r,a){for(const c of this.patternFeatures)this.addFeature(c,c.geometry,c.index,r,a)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,qf)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Vf),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,r,a,c,p){const m=this.layers[0].layout,y=m.get("line-join").evaluate(e,{}),v=m.get("line-cap"),S=m.get("line-miter-limit"),A=m.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const M of r)this.addLine(M,e,y,v,S,A);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,a,p,c)}addLine(e,r,a,c,p,m){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let re=0;re<e.length-1;re++)this.totalDistance+=e[re].dist(e[re+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const y=jf[r.type]==="Polygon";let v=e.length;for(;v>=2&&e[v-1].equals(e[v-2]);)v--;let S=0;for(;S<v-1&&e[S].equals(e[S+1]);)S++;if(v<(y?3:2))return;a==="bevel"&&(p=1.05);const A=this.overscaling<=16?122880/(512*this.overscaling):0,M=this.segments.prepareSegment(10*v,this.layoutVertexArray,this.indexArray);let k,D,B,Z,W;this.e1=this.e2=-1,y&&(k=e[v-2],W=e[S].sub(k)._unit()._perp());for(let re=S;re<v;re++){if(B=re===v-1?y?e[S+1]:void 0:e[re+1],B&&e[re].equals(B))continue;W&&(Z=W),k&&(D=k),k=e[re],W=B?B.sub(k)._unit()._perp():Z,Z=Z||W;let oe=Z.add(W);oe.x===0&&oe.y===0||oe._unit();const se=Z.x*W.x+Z.y*W.y,pe=oe.x*W.x+oe.y*W.y,xe=pe!==0?1/pe:1/0,ye=2*Math.sqrt(2-2*pe),Be=pe<Zf&&D&&B,qe=Z.x*W.y-Z.y*W.x>0;if(Be&&re>S){const Te=k.dist(D);if(Te>2*A){const De=k.sub(k.sub(D)._mult(A/Te)._round());this.updateDistance(D,De),this.addCurrentVertex(De,Z,0,0,M),D=De}}const Me=D&&B;let Pe=Me?a:y?"butt":c;if(Me&&Pe==="round"&&(xe<m?Pe="miter":xe<=2&&(Pe="fakeround")),Pe==="miter"&&xe>p&&(Pe="bevel"),Pe==="bevel"&&(xe>2&&(Pe="flipbevel"),xe<p&&(Pe="miter")),D&&this.updateDistance(D,k),Pe==="miter")oe._mult(xe),this.addCurrentVertex(k,oe,0,0,M);else if(Pe==="flipbevel"){if(xe>100)oe=W.mult(-1);else{const Te=xe*Z.add(W).mag()/Z.sub(W).mag();oe._perp()._mult(Te*(qe?-1:1))}this.addCurrentVertex(k,oe,0,0,M),this.addCurrentVertex(k,oe.mult(-1),0,0,M)}else if(Pe==="bevel"||Pe==="fakeround"){const Te=-Math.sqrt(xe*xe-1),De=qe?Te:0,ze=qe?0:Te;if(D&&this.addCurrentVertex(k,Z,De,ze,M),Pe==="fakeround"){const be=Math.round(180*ye/Math.PI/20);for(let Ye=1;Ye<be;Ye++){let Ze=Ye/be;if(Ze!==.5){const wt=Ze-.5;Ze+=Ze*wt*(Ze-1)*((1.0904+se*(se*(3.55645-1.43519*se)-3.2452))*wt*wt+(.848013+se*(.215638*se-1.06021)))}const pt=W.sub(Z)._mult(Ze)._add(Z)._unit()._mult(qe?-1:1);this.addHalfVertex(k,pt.x,pt.y,!1,qe,0,M)}}B&&this.addCurrentVertex(k,W,-De,-ze,M)}else if(Pe==="butt")this.addCurrentVertex(k,oe,0,0,M);else if(Pe==="square"){const Te=D?1:-1;this.addCurrentVertex(k,oe,Te,Te,M)}else Pe==="round"&&(D&&(this.addCurrentVertex(k,Z,0,0,M),this.addCurrentVertex(k,Z,1,1,M,!0)),B&&(this.addCurrentVertex(k,W,-1,-1,M,!0),this.addCurrentVertex(k,W,0,0,M)));if(Be&&re<v-1){const Te=k.dist(B);if(Te>2*A){const De=k.add(B.sub(k)._mult(A/Te)._round());this.updateDistance(k,De),this.addCurrentVertex(De,W,0,0,M),k=De}}}}addCurrentVertex(e,r,a,c,p,m=!1){const y=r.y*c-r.x,v=-r.y-r.x*c;this.addHalfVertex(e,r.x+r.y*a,r.y-r.x*a,m,!1,a,p),this.addHalfVertex(e,y,v,m,!0,-c,p),this.distance>zu/2&&this.totalDistance===0&&(this.distance=0,this.addCurrentVertex(e,r,a,c,p,m))}addHalfVertex({x:e,y:r},a,c,p,m,y,v){const S=.5*(this.lineClips?this.scaledDistance*(zu-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(p?1:0),(r<<1)+(m?1:0),Math.round(63*a)+128,Math.round(63*c)+128,1+(y===0?0:y<0?-1:1)|(63&S)<<2,S>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const A=v.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,A),v.primitiveLength++),m?this.e2=A:this.e1=A}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,r){this.distance+=e.dist(r),this.updateScaledDistance()}}Re("LineBucket",Yc,{omit:["layers","patternFeatures"]});const Wf=new ri({"line-cap":new Ue(de.layout_line["line-cap"]),"line-join":new Xe(de.layout_line["line-join"]),"line-miter-limit":new Ue(de.layout_line["line-miter-limit"]),"line-round-limit":new Ue(de.layout_line["line-round-limit"]),"line-sort-key":new Xe(de.layout_line["line-sort-key"])});var ku={paint:new ri({"line-opacity":new Xe(de.paint_line["line-opacity"]),"line-color":new Xe(de.paint_line["line-color"]),"line-translate":new Ue(de.paint_line["line-translate"]),"line-translate-anchor":new Ue(de.paint_line["line-translate-anchor"]),"line-width":new Xe(de.paint_line["line-width"]),"line-gap-width":new Xe(de.paint_line["line-gap-width"]),"line-offset":new Xe(de.paint_line["line-offset"]),"line-blur":new Xe(de.paint_line["line-blur"]),"line-dasharray":new pa(de.paint_line["line-dasharray"]),"line-pattern":new da(de.paint_line["line-pattern"]),"line-gradient":new ao(de.paint_line["line-gradient"])}),layout:Wf};const Lu=new class extends Xe{possiblyEvaluate(i,e){return e=new Bt(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,zoomHistory:e.zoomHistory,transition:e.transition}),super.possiblyEvaluate(i,e)}evaluate(i,e,r,a){return e=we({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(i,e,r,a)}}(ku.paint.properties["line-width"].specification);function Du(i,e){return e>0?e+2*i:i}Lu.useIntegerZoom=!0;const Hf=ni([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Xf=ni([{name:"a_projected_pos",components:3,type:"Float32"}],4);ni([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Yf=ni([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);ni([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const Ru=ni([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Kf=ni([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function Jf(i,e,r){return i.sections.forEach(a=>{a.text=function(c,p,m){const y=p.layout.get("text-transform").evaluate(m,{});return y==="uppercase"?c=c.toLocaleUpperCase():y==="lowercase"&&(c=c.toLocaleLowerCase()),Vi.applyArabicShaping&&(c=Vi.applyArabicShaping(c)),c}(a.text,e,r)}),i}ni([{name:"triangle",components:3,type:"Uint16"}]),ni([{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"}]),ni([{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",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),ni([{type:"Float32",name:"offsetX"}]),ni([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);const _o={"!":"\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","\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"};var di=24,Kc=Et,Bu=function(i,e,r,a,c){var p,m,y=8*c-a-1,v=(1<<y)-1,S=v>>1,A=-7,M=r?c-1:0,k=r?-1:1,D=i[e+M];for(M+=k,p=D&(1<<-A)-1,D>>=-A,A+=y;A>0;p=256*p+i[e+M],M+=k,A-=8);for(m=p&(1<<-A)-1,p>>=-A,A+=a;A>0;m=256*m+i[e+M],M+=k,A-=8);if(p===0)p=1-S;else{if(p===v)return m?NaN:1/0*(D?-1:1);m+=Math.pow(2,a),p-=S}return(D?-1:1)*m*Math.pow(2,p-a)},Fu=function(i,e,r,a,c,p){var m,y,v,S=8*p-c-1,A=(1<<S)-1,M=A>>1,k=c===23?Math.pow(2,-24)-Math.pow(2,-77):0,D=a?0:p-1,B=a?1:-1,Z=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(y=isNaN(e)?1:0,m=A):(m=Math.floor(Math.log(e)/Math.LN2),e*(v=Math.pow(2,-m))<1&&(m--,v*=2),(e+=m+M>=1?k/v:k*Math.pow(2,1-M))*v>=2&&(m++,v/=2),m+M>=A?(y=0,m=A):m+M>=1?(y=(e*v-1)*Math.pow(2,c),m+=M):(y=e*Math.pow(2,M-1)*Math.pow(2,c),m=0));c>=8;i[r+D]=255&y,D+=B,y/=256,c-=8);for(m=m<<c|y,S+=c;S>0;i[r+D]=255&m,D+=B,m/=256,S-=8);i[r+D-B]|=128*Z};function Et(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}Et.Varint=0,Et.Fixed64=1,Et.Bytes=2,Et.Fixed32=5;var Un,Jc=4294967296,Ou=1/Jc,Uu=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function pn(i){return i.type===Et.Bytes?i.readVarint()+i.pos:i.pos+1}function ls(i,e,r){return r?4294967296*e+(i>>>0):4294967296*(e>>>0)+(i>>>0)}function $u(i,e,r){var a=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(a);for(var c=r.pos-1;c>=i;c--)r.buf[c+a]=r.buf[c]}function Qf(i,e){for(var r=0;r<i.length;r++)e.writeVarint(i[r])}function eg(i,e){for(var r=0;r<i.length;r++)e.writeSVarint(i[r])}function tg(i,e){for(var r=0;r<i.length;r++)e.writeFloat(i[r])}function ig(i,e){for(var r=0;r<i.length;r++)e.writeDouble(i[r])}function rg(i,e){for(var r=0;r<i.length;r++)e.writeBoolean(i[r])}function ng(i,e){for(var r=0;r<i.length;r++)e.writeFixed32(i[r])}function ag(i,e){for(var r=0;r<i.length;r++)e.writeSFixed32(i[r])}function sg(i,e){for(var r=0;r<i.length;r++)e.writeFixed64(i[r])}function og(i,e){for(var r=0;r<i.length;r++)e.writeSFixed64(i[r])}function Al(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+16777216*i[e+3]}function cs(i,e,r){i[r]=e,i[r+1]=e>>>8,i[r+2]=e>>>16,i[r+3]=e>>>24}function Nu(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+(i[e+3]<<24)}function lg(i,e,r){i===1&&r.readMessage(cg,e)}function cg(i,e,r){if(i===3){const{id:a,bitmap:c,width:p,height:m,left:y,top:v,advance:S}=r.readMessage(hg,{});e.push({id:a,bitmap:new ho({width:p+6,height:m+6},c),metrics:{width:p,height:m,left:y,top:v,advance:S}})}}function hg(i,e,r){i===1?e.id=r.readVarint():i===2?e.bitmap=r.readBytes():i===3?e.width=r.readVarint():i===4?e.height=r.readVarint():i===5?e.left=r.readSVarint():i===6?e.top=r.readSVarint():i===7&&(e.advance=r.readVarint())}function Vu(i){let e=0,r=0;for(const m of i)e+=m.w*m.h,r=Math.max(r,m.w);i.sort((m,y)=>y.h-m.h);const a=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}];let c=0,p=0;for(const m of i)for(let y=a.length-1;y>=0;y--){const v=a[y];if(!(m.w>v.w||m.h>v.h)){if(m.x=v.x,m.y=v.y,p=Math.max(p,m.y+m.h),c=Math.max(c,m.x+m.w),m.w===v.w&&m.h===v.h){const S=a.pop();y<a.length&&(a[y]=S)}else m.h===v.h?(v.x+=m.w,v.w-=m.w):m.w===v.w?(v.y+=m.h,v.h-=m.h):(a.push({x:v.x+m.w,y:v.y,w:v.w-m.w,h:m.h}),v.y+=m.h,v.h-=m.h);break}}return{w:c,h:p,fill:e/(c*p)||0}}Et.prototype={destroy:function(){this.buf=null},readFields:function(i,e,r){for(r=r||this.length;this.pos<r;){var a=this.readVarint(),c=a>>3,p=this.pos;this.type=7&a,i(c,e,this),this.pos===p&&this.skip(a)}return e},readMessage:function(i,e){return this.readFields(i,e,this.readVarint()+this.pos)},readFixed32:function(){var i=Al(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=Nu(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=Al(this.buf,this.pos)+Al(this.buf,this.pos+4)*Jc;return this.pos+=8,i},readSFixed64:function(){var i=Al(this.buf,this.pos)+Nu(this.buf,this.pos+4)*Jc;return this.pos+=8,i},readFloat:function(){var i=Bu(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=Bu(this.buf,this.pos,!0,52,8);return this.pos+=8,i},readVarint:function(i){var e,r,a=this.buf;return e=127&(r=a[this.pos++]),r<128?e:(e|=(127&(r=a[this.pos++]))<<7,r<128?e:(e|=(127&(r=a[this.pos++]))<<14,r<128?e:(e|=(127&(r=a[this.pos++]))<<21,r<128?e:function(c,p,m){var y,v,S=m.buf;if(y=(112&(v=S[m.pos++]))>>4,v<128||(y|=(127&(v=S[m.pos++]))<<3,v<128)||(y|=(127&(v=S[m.pos++]))<<10,v<128)||(y|=(127&(v=S[m.pos++]))<<17,v<128)||(y|=(127&(v=S[m.pos++]))<<24,v<128)||(y|=(1&(v=S[m.pos++]))<<31,v<128))return ls(c,y,p);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=a[this.pos]))<<28,i,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var i=this.readVarint();return i%2==1?(i+1)/-2:i/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var i=this.readVarint()+this.pos,e=this.pos;return this.pos=i,i-e>=12&&Uu?function(r,a,c){return Uu.decode(r.subarray(a,c))}(this.buf,e,i):function(r,a,c){for(var p="",m=a;m<c;){var y,v,S,A=r[m],M=null,k=A>239?4:A>223?3:A>191?2:1;if(m+k>c)break;k===1?A<128&&(M=A):k===2?(192&(y=r[m+1]))==128&&(M=(31&A)<<6|63&y)<=127&&(M=null):k===3?(v=r[m+2],(192&(y=r[m+1]))==128&&(192&v)==128&&((M=(15&A)<<12|(63&y)<<6|63&v)<=2047||M>=55296&&M<=57343)&&(M=null)):k===4&&(v=r[m+2],S=r[m+3],(192&(y=r[m+1]))==128&&(192&v)==128&&(192&S)==128&&((M=(15&A)<<18|(63&y)<<12|(63&v)<<6|63&S)<=65535||M>=1114112)&&(M=null)),M===null?(M=65533,k=1):M>65535&&(M-=65536,p+=String.fromCharCode(M>>>10&1023|55296),M=56320|1023&M),p+=String.fromCharCode(M),m+=k}return p}(this.buf,e,i)},readBytes:function(){var i=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,i);return this.pos=i,e},readPackedVarint:function(i,e){if(this.type!==Et.Bytes)return i.push(this.readVarint(e));var r=pn(this);for(i=i||[];this.pos<r;)i.push(this.readVarint(e));return i},readPackedSVarint:function(i){if(this.type!==Et.Bytes)return i.push(this.readSVarint());var e=pn(this);for(i=i||[];this.pos<e;)i.push(this.readSVarint());return i},readPackedBoolean:function(i){if(this.type!==Et.Bytes)return i.push(this.readBoolean());var e=pn(this);for(i=i||[];this.pos<e;)i.push(this.readBoolean());return i},readPackedFloat:function(i){if(this.type!==Et.Bytes)return i.push(this.readFloat());var e=pn(this);for(i=i||[];this.pos<e;)i.push(this.readFloat());return i},readPackedDouble:function(i){if(this.type!==Et.Bytes)return i.push(this.readDouble());var e=pn(this);for(i=i||[];this.pos<e;)i.push(this.readDouble());return i},readPackedFixed32:function(i){if(this.type!==Et.Bytes)return i.push(this.readFixed32());var e=pn(this);for(i=i||[];this.pos<e;)i.push(this.readFixed32());return i},readPackedSFixed32:function(i){if(this.type!==Et.Bytes)return i.push(this.readSFixed32());var e=pn(this);for(i=i||[];this.pos<e;)i.push(this.readSFixed32());return i},readPackedFixed64:function(i){if(this.type!==Et.Bytes)return i.push(this.readFixed64());var e=pn(this);for(i=i||[];this.pos<e;)i.push(this.readFixed64());return i},readPackedSFixed64:function(i){if(this.type!==Et.Bytes)return i.push(this.readSFixed64());var e=pn(this);for(i=i||[];this.pos<e;)i.push(this.readSFixed64());return i},skip:function(i){var e=7&i;if(e===Et.Varint)for(;this.buf[this.pos++]>127;);else if(e===Et.Bytes)this.pos=this.readVarint()+this.pos;else if(e===Et.Fixed32)this.pos+=4;else{if(e!==Et.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(i,e){this.writeVarint(i<<3|e)},realloc:function(i){for(var e=this.length||16;e<this.pos+i;)e*=2;if(e!==this.length){var r=new Uint8Array(e);r.set(this.buf),this.buf=r,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(i){this.realloc(4),cs(this.buf,i,this.pos),this.pos+=4},writeSFixed32:function(i){this.realloc(4),cs(this.buf,i,this.pos),this.pos+=4},writeFixed64:function(i){this.realloc(8),cs(this.buf,-1&i,this.pos),cs(this.buf,Math.floor(i*Ou),this.pos+4),this.pos+=8},writeSFixed64:function(i){this.realloc(8),cs(this.buf,-1&i,this.pos),cs(this.buf,Math.floor(i*Ou),this.pos+4),this.pos+=8},writeVarint:function(i){(i=+i||0)>268435455||i<0?function(e,r){var a,c;if(e>=0?(a=e%4294967296|0,c=e/4294967296|0):(c=~(-e/4294967296),4294967295^(a=~(-e%4294967296))?a=a+1|0:(a=0,c=c+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");r.realloc(10),function(p,m,y){y.buf[y.pos++]=127&p|128,p>>>=7,y.buf[y.pos++]=127&p|128,p>>>=7,y.buf[y.pos++]=127&p|128,p>>>=7,y.buf[y.pos++]=127&p|128,y.buf[y.pos]=127&(p>>>=7)}(a,0,r),function(p,m){var y=(7&p)<<4;m.buf[m.pos++]|=y|((p>>>=3)?128:0),p&&(m.buf[m.pos++]=127&p|((p>>>=7)?128:0),p&&(m.buf[m.pos++]=127&p|((p>>>=7)?128:0),p&&(m.buf[m.pos++]=127&p|((p>>>=7)?128:0),p&&(m.buf[m.pos++]=127&p|((p>>>=7)?128:0),p&&(m.buf[m.pos++]=127&p)))))}(c,r)}(i,this):(this.realloc(4),this.buf[this.pos++]=127&i|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=i>>>7&127))))},writeSVarint:function(i){this.writeVarint(i<0?2*-i-1:2*i)},writeBoolean:function(i){this.writeVarint(Boolean(i))},writeString:function(i){i=String(i),this.realloc(4*i.length),this.pos++;var e=this.pos;this.pos=function(a,c,p){for(var m,y,v=0;v<c.length;v++){if((m=c.charCodeAt(v))>55295&&m<57344){if(!y){m>56319||v+1===c.length?(a[p++]=239,a[p++]=191,a[p++]=189):y=m;continue}if(m<56320){a[p++]=239,a[p++]=191,a[p++]=189,y=m;continue}m=y-55296<<10|m-56320|65536,y=null}else y&&(a[p++]=239,a[p++]=191,a[p++]=189,y=null);m<128?a[p++]=m:(m<2048?a[p++]=m>>6|192:(m<65536?a[p++]=m>>12|224:(a[p++]=m>>18|240,a[p++]=m>>12&63|128),a[p++]=m>>6&63|128),a[p++]=63&m|128)}return p}(this.buf,i,this.pos);var r=this.pos-e;r>=128&&$u(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(i){this.realloc(4),Fu(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),Fu(this.buf,i,this.pos,!0,52,8),this.pos+=8},writeBytes:function(i){var e=i.length;this.writeVarint(e),this.realloc(e);for(var r=0;r<e;r++)this.buf[this.pos++]=i[r]},writeRawMessage:function(i,e){this.pos++;var r=this.pos;i(e,this);var a=this.pos-r;a>=128&&$u(r,a,this),this.pos=r-1,this.writeVarint(a),this.pos+=a},writeMessage:function(i,e,r){this.writeTag(i,Et.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(i,e){e.length&&this.writeMessage(i,Qf,e)},writePackedSVarint:function(i,e){e.length&&this.writeMessage(i,eg,e)},writePackedBoolean:function(i,e){e.length&&this.writeMessage(i,rg,e)},writePackedFloat:function(i,e){e.length&&this.writeMessage(i,tg,e)},writePackedDouble:function(i,e){e.length&&this.writeMessage(i,ig,e)},writePackedFixed32:function(i,e){e.length&&this.writeMessage(i,ng,e)},writePackedSFixed32:function(i,e){e.length&&this.writeMessage(i,ag,e)},writePackedFixed64:function(i,e){e.length&&this.writeMessage(i,sg,e)},writePackedSFixed64:function(i,e){e.length&&this.writeMessage(i,og,e)},writeBytesField:function(i,e){this.writeTag(i,Et.Bytes),this.writeBytes(e)},writeFixed32Field:function(i,e){this.writeTag(i,Et.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(i,e){this.writeTag(i,Et.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(i,e){this.writeTag(i,Et.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(i,e){this.writeTag(i,Et.Fixed64),this.writeSFixed64(e)},writeVarintField:function(i,e){this.writeTag(i,Et.Varint),this.writeVarint(e)},writeSVarintField:function(i,e){this.writeTag(i,Et.Varint),this.writeSVarint(e)},writeStringField:function(i,e){this.writeTag(i,Et.Bytes),this.writeString(e)},writeFloatField:function(i,e){this.writeTag(i,Et.Fixed32),this.writeFloat(e)},writeDoubleField:function(i,e){this.writeTag(i,Et.Fixed64),this.writeDouble(e)},writeBooleanField:function(i,e){this.writeVarintField(i,Boolean(e))}};class Qc{constructor(e,{pixelRatio:r,version:a,stretchX:c,stretchY:p,content:m}){this.paddedRect=e,this.pixelRatio=r,this.stretchX=c,this.stretchY=p,this.content=m,this.version=a}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}class Gu{constructor(e,r){const a={},c={};this.haveRenderCallbacks=[];const p=[];this.addImages(e,a,p),this.addImages(r,c,p);const{w:m,h:y}=Vu(p),v=new ir({width:m||1,height:y||1});for(const S in e){const A=e[S],M=a[S].paddedRect;ir.copy(A.data,v,{x:0,y:0},{x:M.x+1,y:M.y+1},A.data)}for(const S in r){const A=r[S],M=c[S].paddedRect,k=M.x+1,D=M.y+1,B=A.data.width,Z=A.data.height;ir.copy(A.data,v,{x:0,y:0},{x:k,y:D},A.data),ir.copy(A.data,v,{x:0,y:Z-1},{x:k,y:D-1},{width:B,height:1}),ir.copy(A.data,v,{x:0,y:0},{x:k,y:D+Z},{width:B,height:1}),ir.copy(A.data,v,{x:B-1,y:0},{x:k-1,y:D},{width:1,height:Z}),ir.copy(A.data,v,{x:0,y:0},{x:k+B,y:D},{width:1,height:Z})}this.image=v,this.iconPositions=a,this.patternPositions=c}addImages(e,r,a){for(const c in e){const p=e[c],m={x:0,y:0,w:p.data.width+2,h:p.data.height+2};a.push(m),r[c]=new Qc(m,p),p.hasRenderCallback&&this.haveRenderCallbacks.push(c)}}patchUpdatedImages(e,r){e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const a in e.updatedImages)this.patchUpdatedImage(this.iconPositions[a],e.getImage(a),r),this.patchUpdatedImage(this.patternPositions[a],e.getImage(a),r)}patchUpdatedImage(e,r,a){if(!e||!r||e.version===r.version)return;e.version=r.version;const[c,p]=e.tl;a.update(r.data,void 0,{x:c,y:p})}}Re("ImagePosition",Qc),Re("ImageAtlas",Gu),o.WritingMode=void 0,(Un=o.WritingMode||(o.WritingMode={}))[Un.none=0]="none",Un[Un.horizontal=1]="horizontal",Un[Un.vertical=2]="vertical",Un[Un.horizontalOnly=3]="horizontalOnly";const Cl=-17;class xo{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(e,r){const a=new xo;return a.scale=e||1,a.fontStack=r,a}static forImage(e){const r=new xo;return r.imageName=e,r}}class hs{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,r){const a=new hs;for(let c=0;c<e.sections.length;c++){const p=e.sections[c];p.image?a.addImageSection(p):a.addTextSection(p,r)}return a}length(){return this.text.length}getSection(e){return this.sections[this.sectionIndex[e]]}getSectionIndex(e){return this.sectionIndex[e]}getCharCode(e){return this.text.charCodeAt(e)}verticalizePunctuation(){this.text=function(e){let r="";for(let a=0;a<e.length;a++){const c=e.charCodeAt(a+1)||null,p=e.charCodeAt(a-1)||null;r+=c&&dl(c)&&!_o[e[a+1]]||p&&dl(p)&&!_o[e[a-1]]||!_o[e[a]]?e[a]:_o[e[a]]}return r}(this.text)}trim(){let e=0;for(let a=0;a<this.text.length&&Pl[this.text.charCodeAt(a)];a++)e++;let r=this.text.length;for(let a=this.text.length-1;a>=0&&a>=e&&Pl[this.text.charCodeAt(a)];a--)r--;this.text=this.text.substring(e,r),this.sectionIndex=this.sectionIndex.slice(e,r)}substring(e,r){const a=new hs;return a.text=this.text.substring(e,r),a.sectionIndex=this.sectionIndex.slice(e,r),a.sections=this.sections,a}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,r)=>Math.max(e,this.sections[r].scale),0)}addTextSection(e,r){this.text+=e.text,this.sections.push(xo.forText(e.scale,e.fontStack||r));const a=this.sections.length-1;for(let c=0;c<e.text.length;++c)this.sectionIndex.push(a)}addImageSection(e){const r=e.image?e.image.name:"";if(r.length===0)return void gt("Can't add FormattedSection with an empty image.");const a=this.getNextImageSectionCharCode();a?(this.text+=String.fromCharCode(a),this.sections.push(xo.forImage(r)),this.sectionIndex.push(this.sections.length-1)):gt("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Ml(i,e,r,a,c,p,m,y,v,S,A,M,k,D,B,Z){const W=hs.fromFeature(i,c);let re;M===o.WritingMode.vertical&&W.verticalizePunctuation();const{processBidirectionalText:oe,processStyledBidirectionalText:se}=Vi;if(oe&&W.sections.length===1){re=[];const ye=oe(W.toString(),eh(W,S,p,e,a,D,B));for(const Be of ye){const qe=new hs;qe.text=Be,qe.sections=W.sections;for(let Me=0;Me<Be.length;Me++)qe.sectionIndex.push(0);re.push(qe)}}else if(se){re=[];const ye=se(W.text,W.sectionIndex,eh(W,S,p,e,a,D,B));for(const Be of ye){const qe=new hs;qe.text=Be[0],qe.sectionIndex=Be[1],qe.sections=W.sections,re.push(qe)}}else re=function(ye,Be){const qe=[],Me=ye.text;let Pe=0;for(const Te of Be)qe.push(ye.substring(Pe,Te)),Pe=Te;return Pe<Me.length&&qe.push(ye.substring(Pe,Me.length)),qe}(W,eh(W,S,p,e,a,D,B));const pe=[],xe={positionedLines:pe,text:W.toString(),top:A[1],bottom:A[1],left:A[0],right:A[0],writingMode:M,iconsInText:!1,verticalizable:!1};return function(ye,Be,qe,Me,Pe,Te,De,ze,be,Ye,Ze,pt){let wt=0,Ot=Cl,Ut=0,pi=0;const Qt=ze==="right"?1:ze==="left"?0:.5;let ei=0;for(const ti of Pe){ti.trim();const fi=ti.getMaxScale(),bi=(fi-1)*di,Mi={positionedGlyphs:[],lineOffset:0};ye.positionedLines[ei]=Mi;const Ri=Mi.positionedGlyphs;let Bi=0;if(!ti.length()){Ot+=Te,++ei;continue}for(let ci=0;ci<ti.length();ci++){const ht=ti.getSection(ci),ji=ti.getSectionIndex(ci),gi=ti.getCharCode(ci);let wi=0,pr=null,Er=null,Ar=null,fn=di;const mr=!(be===o.WritingMode.horizontal||!Ze&&!ua(gi)||Ze&&(Pl[gi]||(li=gi,Ee.Arabic(li)||Ee["Arabic Supplement"](li)||Ee["Arabic Extended-A"](li)||Ee["Arabic Presentation Forms-A"](li)||Ee["Arabic Presentation Forms-B"](li))));if(ht.imageName){const rr=Me[ht.imageName];if(!rr)continue;Ar=ht.imageName,ye.iconsInText=ye.iconsInText||!0,Er=rr.paddedRect;const Fi=rr.displaySize;ht.scale=ht.scale*di/pt,pr={width:Fi[0],height:Fi[1],left:1,top:-3,advance:mr?Fi[1]:Fi[0]},wi=bi+(di-Fi[1]*ht.scale),fn=pr.advance;const gn=mr?Fi[0]*ht.scale-di*fi:Fi[1]*ht.scale-di*fi;gn>0&&gn>Bi&&(Bi=gn)}else{const rr=qe[ht.fontStack],Fi=rr&&rr[gi];if(Fi&&Fi.rect)Er=Fi.rect,pr=Fi.metrics;else{const gn=Be[ht.fontStack],wo=gn&&gn[gi];if(!wo)continue;pr=wo.metrics}wi=(fi-ht.scale)*di}mr?(ye.verticalizable=!0,Ri.push({glyph:gi,imageName:Ar,x:wt,y:Ot+wi,vertical:mr,scale:ht.scale,fontStack:ht.fontStack,sectionIndex:ji,metrics:pr,rect:Er}),wt+=fn*ht.scale+Ye):(Ri.push({glyph:gi,imageName:Ar,x:wt,y:Ot+wi,vertical:mr,scale:ht.scale,fontStack:ht.fontStack,sectionIndex:ji,metrics:pr,rect:Er}),wt+=pr.advance*ht.scale+Ye)}Ri.length!==0&&(Ut=Math.max(wt-Ye,Ut),pg(Ri,0,Ri.length-1,Qt,Bi)),wt=0;const Nt=Te*fi+Bi;Mi.lineOffset=Math.max(Bi,bi),Ot+=Nt,pi=Math.max(Nt,pi),++ei}var li;const mi=Ot-Cl,{horizontalAlign:vi,verticalAlign:Di}=th(De);(function(ti,fi,bi,Mi,Ri,Bi,Nt,ci,ht){const ji=(fi-bi)*Ri;let gi=0;gi=Bi!==Nt?-ci*Mi-Cl:(-Mi*ht+.5)*Nt;for(const wi of ti)for(const pr of wi.positionedGlyphs)pr.x+=ji,pr.y+=gi})(ye.positionedLines,Qt,vi,Di,Ut,pi,Te,mi,Pe.length),ye.top+=-Di*mi,ye.bottom=ye.top+mi,ye.left+=-vi*Ut,ye.right=ye.left+Ut}(xe,e,r,a,re,m,y,v,M,S,k,Z),!function(ye){for(const Be of ye)if(Be.positionedGlyphs.length!==0)return!1;return!0}(pe)&&xe}const Pl={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},ug={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function qu(i,e,r,a,c,p){if(e.imageName){const m=a[e.imageName];return m?m.displaySize[0]*e.scale*di/p+c:0}{const m=r[e.fontStack],y=m&&m[i];return y?y.metrics.advance*e.scale+c:0}}function ju(i,e,r,a){const c=Math.pow(i-e,2);return a?i<e?c/2:2*c:c+Math.abs(r)*r}function dg(i,e,r){let a=0;return i===10&&(a-=1e4),r&&(a+=150),i!==40&&i!==65288||(a+=50),e!==41&&e!==65289||(a+=50),a}function Zu(i,e,r,a,c,p){let m=null,y=ju(e,r,c,p);for(const v of a){const S=ju(e-v.x,r,c,p)+v.badness;S<=y&&(m=v,y=S)}return{index:i,x:e,priorBreak:m,badness:y}}function Wu(i){return i?Wu(i.priorBreak).concat(i.index):[]}function eh(i,e,r,a,c,p,m){if(p!=="point")return[];if(!i)return[];const y=[],v=function(k,D,B,Z,W,re){let oe=0;for(let se=0;se<k.length();se++){const pe=k.getSection(se);oe+=qu(k.getCharCode(se),pe,Z,W,D,re)}return oe/Math.max(1,Math.ceil(oe/B))}(i,e,r,a,c,m),S=i.text.indexOf("\u200B")>=0;let A=0;for(let k=0;k<i.length();k++){const D=i.getSection(k),B=i.getCharCode(k);if(Pl[B]||(A+=qu(B,D,a,c,e,m)),k<i.length()-1){const Z=!((M=B)<11904||!(Ee["Bopomofo Extended"](M)||Ee.Bopomofo(M)||Ee["CJK Compatibility Forms"](M)||Ee["CJK Compatibility Ideographs"](M)||Ee["CJK Compatibility"](M)||Ee["CJK Radicals Supplement"](M)||Ee["CJK Strokes"](M)||Ee["CJK Symbols and Punctuation"](M)||Ee["CJK Unified Ideographs Extension A"](M)||Ee["CJK Unified Ideographs"](M)||Ee["Enclosed CJK Letters and Months"](M)||Ee["Halfwidth and Fullwidth Forms"](M)||Ee.Hiragana(M)||Ee["Ideographic Description Characters"](M)||Ee["Kangxi Radicals"](M)||Ee["Katakana Phonetic Extensions"](M)||Ee.Katakana(M)||Ee["Vertical Forms"](M)||Ee["Yi Radicals"](M)||Ee["Yi Syllables"](M)));(ug[B]||Z||D.imageName)&&y.push(Zu(k+1,A,v,y,dg(B,i.getCharCode(k+1),Z&&S),!1))}}var M;return Wu(Zu(i.length(),A,v,y,0,!0))}function th(i){let e=.5,r=.5;switch(i){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(i){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:e,verticalAlign:r}}function pg(i,e,r,a,c){if(!a&&!c)return;const p=i[r],m=(i[r].x+p.metrics.advance*p.scale)*a;for(let y=e;y<=r;y++)i[y].x-=m,i[y].y+=c}function mg(i,e,r){const{horizontalAlign:a,verticalAlign:c}=th(r),p=e[0]-i.displaySize[0]*a,m=e[1]-i.displaySize[1]*c;return{image:i,top:m,bottom:m+i.displaySize[1],left:p,right:p+i.displaySize[0]}}function Hu(i,e,r,a,c,p){const m=i.image;let y;if(m.content){const W=m.content,re=m.pixelRatio||1;y=[W[0]/re,W[1]/re,m.displaySize[0]-W[2]/re,m.displaySize[1]-W[3]/re]}const v=e.left*p,S=e.right*p;let A,M,k,D;r==="width"||r==="both"?(D=c[0]+v-a[3],M=c[0]+S+a[1]):(D=c[0]+(v+S-m.displaySize[0])/2,M=D+m.displaySize[0]);const B=e.top*p,Z=e.bottom*p;return r==="height"||r==="both"?(A=c[1]+B-a[0],k=c[1]+Z+a[2]):(A=c[1]+(B+Z-m.displaySize[1])/2,k=A+m.displaySize[1]),{image:m,top:A,right:M,bottom:k,left:D,collisionPadding:y}}const mn=128;function Xu(i,e){const{expression:r}=e;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new Bt(i+1))};if(r.kind==="source")return{kind:"source"};{const{zoomStops:a,interpolationType:c}=r;let p=0;for(;p<a.length&&a[p]<=i;)p++;p=Math.max(0,p-1);let m=p;for(;m<a.length&&a[m]<i+1;)m++;m=Math.min(a.length-1,m);const y=a[p],v=a[m];return r.kind==="composite"?{kind:"composite",minZoom:y,maxZoom:v,interpolationType:c}:{kind:"camera",minZoom:y,maxZoom:v,minSize:r.evaluate(new Bt(y)),maxSize:r.evaluate(new Bt(v)),interpolationType:c}}}class $n extends Ke{constructor(e,r,a,c){super(e,r),this.angle=a,c!==void 0&&(this.segment=c)}clone(){return new $n(this.x,this.y,this.angle,this.segment)}}function Yu(i,e,r,a,c){if(e.segment===void 0)return!0;let p=e,m=e.segment+1,y=0;for(;y>-r/2;){if(m--,m<0)return!1;y-=i[m].dist(p),p=i[m]}y+=i[m].dist(i[m+1]),m++;const v=[];let S=0;for(;y<r/2;){const A=i[m],M=i[m+1];if(!M)return!1;let k=i[m-1].angleTo(A)-A.angleTo(M);for(k=Math.abs((k+3*Math.PI)%(2*Math.PI)-Math.PI),v.push({distance:y,angleDelta:k}),S+=k;y-v[0].distance>a;)S-=v.shift().angleDelta;if(S>c)return!1;m++,y+=A.dist(M)}return!0}function Ku(i){let e=0;for(let r=0;r<i.length-1;r++)e+=i[r].dist(i[r+1]);return e}function Ju(i,e,r){return i?.6*e*r:0}function Qu(i,e){return Math.max(i?i.right-i.left:0,e?e.right-e.left:0)}function fg(i,e,r,a,c,p){const m=Ju(r,c,p),y=Qu(r,a)*p;let v=0;const S=Ku(i)/2;for(let A=0;A<i.length-1;A++){const M=i[A],k=i[A+1],D=M.dist(k);if(v+D>S){const B=(S-v)/D,Z=Kt(M.x,k.x,B),W=Kt(M.y,k.y,B),re=new $n(Z,W,k.angleTo(M),A);return re._round(),!m||Yu(i,re,y,m,e)?re:void 0}v+=D}}function gg(i,e,r,a,c,p,m,y,v){const S=Ju(a,p,m),A=Qu(a,c),M=A*m,k=i[0].x===0||i[0].x===v||i[0].y===0||i[0].y===v;return e-M<e/4&&(e=M+e/4),ed(i,k?e/2*y%e:(A/2+2*p)*m*y%e,e,S,r,M,k,!1,v)}function ed(i,e,r,a,c,p,m,y,v){const S=p/2,A=Ku(i);let M=0,k=e-r,D=[];for(let B=0;B<i.length-1;B++){const Z=i[B],W=i[B+1],re=Z.dist(W),oe=W.angleTo(Z);for(;k+r<M+re;){k+=r;const se=(k-M)/re,pe=Kt(Z.x,W.x,se),xe=Kt(Z.y,W.y,se);if(pe>=0&&pe<v&&xe>=0&&xe<v&&k-S>=0&&k+S<=A){const ye=new $n(pe,xe,oe,B);ye._round(),a&&!Yu(i,ye,p,a,c)||D.push(ye)}}M+=re}return y||D.length||m||(D=ed(i,M/2,r,a,c,p,m,!0,v)),D}function td(i,e,r,a,c){const p=[];for(let m=0;m<i.length;m++){const y=i[m];let v;for(let S=0;S<y.length-1;S++){let A=y[S],M=y[S+1];A.x<e&&M.x<e||(A.x<e?A=new Ke(e,A.y+(e-A.x)/(M.x-A.x)*(M.y-A.y))._round():M.x<e&&(M=new Ke(e,A.y+(e-A.x)/(M.x-A.x)*(M.y-A.y))._round()),A.y<r&&M.y<r||(A.y<r?A=new Ke(A.x+(r-A.y)/(M.y-A.y)*(M.x-A.x),r)._round():M.y<r&&(M=new Ke(A.x+(r-A.y)/(M.y-A.y)*(M.x-A.x),r)._round()),A.x>=a&&M.x>=a||(A.x>=a?A=new Ke(a,A.y+(a-A.x)/(M.x-A.x)*(M.y-A.y))._round():M.x>=a&&(M=new Ke(a,A.y+(a-A.x)/(M.x-A.x)*(M.y-A.y))._round()),A.y>=c&&M.y>=c||(A.y>=c?A=new Ke(A.x+(c-A.y)/(M.y-A.y)*(M.x-A.x),c)._round():M.y>=c&&(M=new Ke(A.x+(c-A.y)/(M.y-A.y)*(M.x-A.x),c)._round()),v&&A.equals(v[v.length-1])||(v=[A],p.push(v)),v.push(M)))))}}return p}function id(i,e,r,a){const c=[],p=i.image,m=p.pixelRatio,y=p.paddedRect.w-2,v=p.paddedRect.h-2,S=i.right-i.left,A=i.bottom-i.top,M=p.stretchX||[[0,y]],k=p.stretchY||[[0,v]],D=(Te,De)=>Te+De[1]-De[0],B=M.reduce(D,0),Z=k.reduce(D,0),W=y-B,re=v-Z;let oe=0,se=B,pe=0,xe=Z,ye=0,Be=W,qe=0,Me=re;if(p.content&&a){const Te=p.content;oe=zl(M,0,Te[0]),pe=zl(k,0,Te[1]),se=zl(M,Te[0],Te[2]),xe=zl(k,Te[1],Te[3]),ye=Te[0]-oe,qe=Te[1]-pe,Be=Te[2]-Te[0]-se,Me=Te[3]-Te[1]-xe}const Pe=(Te,De,ze,be)=>{const Ye=kl(Te.stretch-oe,se,S,i.left),Ze=Ll(Te.fixed-ye,Be,Te.stretch,B),pt=kl(De.stretch-pe,xe,A,i.top),wt=Ll(De.fixed-qe,Me,De.stretch,Z),Ot=kl(ze.stretch-oe,se,S,i.left),Ut=Ll(ze.fixed-ye,Be,ze.stretch,B),pi=kl(be.stretch-pe,xe,A,i.top),Qt=Ll(be.fixed-qe,Me,be.stretch,Z),ei=new Ke(Ye,pt),li=new Ke(Ot,pt),mi=new Ke(Ot,pi),vi=new Ke(Ye,pi),Di=new Ke(Ze/m,wt/m),ti=new Ke(Ut/m,Qt/m),fi=e*Math.PI/180;if(fi){const Ri=Math.sin(fi),Bi=Math.cos(fi),Nt=[Bi,-Ri,Ri,Bi];ei._matMult(Nt),li._matMult(Nt),vi._matMult(Nt),mi._matMult(Nt)}const bi=Te.stretch+Te.fixed,Mi=De.stretch+De.fixed;return{tl:ei,tr:li,bl:vi,br:mi,tex:{x:p.paddedRect.x+1+bi,y:p.paddedRect.y+1+Mi,w:ze.stretch+ze.fixed-bi,h:be.stretch+be.fixed-Mi},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Di,pixelOffsetBR:ti,minFontScaleX:Be/m/S,minFontScaleY:Me/m/A,isSDF:r}};if(a&&(p.stretchX||p.stretchY)){const Te=rd(M,W,B),De=rd(k,re,Z);for(let ze=0;ze<Te.length-1;ze++){const be=Te[ze],Ye=Te[ze+1];for(let Ze=0;Ze<De.length-1;Ze++)c.push(Pe(be,De[Ze],Ye,De[Ze+1]))}}else c.push(Pe({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:y+1},{fixed:0,stretch:v+1}));return c}function zl(i,e,r){let a=0;for(const c of i)a+=Math.max(e,Math.min(r,c[1]))-Math.max(e,Math.min(r,c[0]));return a}function rd(i,e,r){const a=[{fixed:-1,stretch:0}];for(const[c,p]of i){const m=a[a.length-1];a.push({fixed:c-m.stretch,stretch:m.stretch}),a.push({fixed:c-m.stretch,stretch:m.stretch+(p-c)})}return a.push({fixed:e+1,stretch:r}),a}function kl(i,e,r,a){return i/e*r+a}function Ll(i,e,r,a){return i-e*r/a}Re("Anchor",$n);class Dl{constructor(e,r,a,c,p,m,y,v,S,A){if(this.boxStartIndex=e.length,S){let M=m.top,k=m.bottom;const D=m.collisionPadding;D&&(M-=D[1],k+=D[3]);let B=k-M;B>0&&(B=Math.max(10,B),this.circleDiameter=B)}else{let M=m.top*y-v,k=m.bottom*y+v,D=m.left*y-v,B=m.right*y+v;const Z=m.collisionPadding;if(Z&&(D-=Z[0]*y,M-=Z[1]*y,B+=Z[2]*y,k+=Z[3]*y),A){const W=new Ke(D,M),re=new Ke(B,M),oe=new Ke(D,k),se=new Ke(B,k),pe=A*Math.PI/180;W._rotate(pe),re._rotate(pe),oe._rotate(pe),se._rotate(pe),D=Math.min(W.x,re.x,oe.x,se.x),B=Math.max(W.x,re.x,oe.x,se.x),M=Math.min(W.y,re.y,oe.y,se.y),k=Math.max(W.y,re.y,oe.y,se.y)}e.emplaceBack(r.x,r.y,D,M,B,k,a,c,p)}this.boxEndIndex=e.length}}class yg{constructor(e=[],r=_g){if(this.data=e,this.length=this.data.length,this.compare=r,this.length>0)for(let a=(this.length>>1)-1;a>=0;a--)this._down(a)}push(e){this.data.push(e),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const e=this.data[0],r=this.data.pop();return this.length--,this.length>0&&(this.data[0]=r,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:r,compare:a}=this,c=r[e];for(;e>0;){const p=e-1>>1,m=r[p];if(a(c,m)>=0)break;r[e]=m,e=p}r[e]=c}_down(e){const{data:r,compare:a}=this,c=this.length>>1,p=r[e];for(;e<c;){let m=1+(e<<1),y=r[m];const v=m+1;if(v<this.length&&a(r[v],y)<0&&(m=v,y=r[v]),a(y,p)>=0)break;r[e]=y,e=m}r[e]=p}}function _g(i,e){return i<e?-1:i>e?1:0}function xg(i,e=1,r=!1){let a=1/0,c=1/0,p=-1/0,m=-1/0;const y=i[0];for(let D=0;D<y.length;D++){const B=y[D];(!D||B.x<a)&&(a=B.x),(!D||B.y<c)&&(c=B.y),(!D||B.x>p)&&(p=B.x),(!D||B.y>m)&&(m=B.y)}const v=Math.min(p-a,m-c);let S=v/2;const A=new yg([],vg);if(v===0)return new Ke(a,c);for(let D=a;D<p;D+=v)for(let B=c;B<m;B+=v)A.push(new us(D+S,B+S,S,i));let M=function(D){let B=0,Z=0,W=0;const re=D[0];for(let oe=0,se=re.length,pe=se-1;oe<se;pe=oe++){const xe=re[oe],ye=re[pe],Be=xe.x*ye.y-ye.x*xe.y;Z+=(xe.x+ye.x)*Be,W+=(xe.y+ye.y)*Be,B+=3*Be}return new us(Z/B,W/B,0,D)}(i),k=A.length;for(;A.length;){const D=A.pop();(D.d>M.d||!M.d)&&(M=D,r&&console.log("found best %d after %d probes",Math.round(1e4*D.d)/1e4,k)),D.max-M.d<=e||(S=D.h/2,A.push(new us(D.p.x-S,D.p.y-S,S,i)),A.push(new us(D.p.x+S,D.p.y-S,S,i)),A.push(new us(D.p.x-S,D.p.y+S,S,i)),A.push(new us(D.p.x+S,D.p.y+S,S,i)),k+=4)}return r&&(console.log(`num probes: ${k}`),console.log(`best distance: ${M.d}`)),M.p}function vg(i,e){return e.max-i.max}function us(i,e,r,a){this.p=new Ke(i,e),this.h=r,this.d=function(c,p){let m=!1,y=1/0;for(let v=0;v<p.length;v++){const S=p[v];for(let A=0,M=S.length,k=M-1;A<M;k=A++){const D=S[A],B=S[k];D.y>c.y!=B.y>c.y&&c.x<(B.x-D.x)*(c.y-D.y)/(B.y-D.y)+D.x&&(m=!m),y=Math.min(y,mu(c,D,B))}}return(m?1:-1)*Math.sqrt(y)}(this.p,a),this.max=this.d+this.h*Math.SQRT2}const ih=Number.POSITIVE_INFINITY;function nd(i,e){return e[1]!==ih?function(r,a,c){let p=0,m=0;switch(a=Math.abs(a),c=Math.abs(c),r){case"top-right":case"top-left":case"top":m=c-7;break;case"bottom-right":case"bottom-left":case"bottom":m=7-c}switch(r){case"top-right":case"bottom-right":case"right":p=-a;break;case"top-left":case"bottom-left":case"left":p=a}return[p,m]}(i,e[0],e[1]):function(r,a){let c=0,p=0;a<0&&(a=0);const m=a/Math.sqrt(2);switch(r){case"top-right":case"top-left":p=m-7;break;case"bottom-right":case"bottom-left":p=7-m;break;case"bottom":p=7-a;break;case"top":p=a-7}switch(r){case"top-right":case"bottom-right":c=-m;break;case"top-left":case"bottom-left":c=m;break;case"left":c=a;break;case"right":c=-a}return[c,p]}(i,e[0])}function rh(i){switch(i){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function bg(i,e,r,a,c,p,m,y,v,S,A){let M=p.textMaxSize.evaluate(e,{});M===void 0&&(M=m);const k=i.layers[0].layout,D=k.get("icon-offset").evaluate(e,{},A),B=sd(r.horizontal),Z=m/24,W=i.tilePixelRatio*Z,re=i.tilePixelRatio*M/24,oe=i.tilePixelRatio*y,se=i.tilePixelRatio*k.get("symbol-spacing"),pe=k.get("text-padding")*i.tilePixelRatio,xe=k.get("icon-padding")*i.tilePixelRatio,ye=k.get("text-max-angle")/180*Math.PI,Be=k.get("text-rotation-alignment")!=="viewport"&&k.get("symbol-placement")!=="point",qe=k.get("icon-rotation-alignment")==="map"&&k.get("symbol-placement")!=="point",Me=k.get("symbol-placement"),Pe=se/2,Te=k.get("icon-text-fit");let De;a&&Te!=="none"&&(i.allowVerticalPlacement&&r.vertical&&(De=Hu(a,r.vertical,Te,k.get("icon-text-fit-padding"),D,Z)),B&&(a=Hu(a,B,Te,k.get("icon-text-fit-padding"),D,Z)));const ze=(be,Ye)=>{Ye.x<0||Ye.x>=ai||Ye.y<0||Ye.y>=ai||function(Ze,pt,wt,Ot,Ut,pi,Qt,ei,li,mi,vi,Di,ti,fi,bi,Mi,Ri,Bi,Nt,ci,ht,ji,gi,wi,pr){const Er=Ze.addToLineVertexArray(pt,wt);let Ar,fn,mr,rr,Fi=0,gn=0,wo=0,wd=0,ph=-1,mh=-1;const yn={};let Sd=so(""),fh=0,gh=0;if(ei._unevaluatedLayout.getValue("text-radial-offset")===void 0?[fh,gh]=ei.layout.get("text-offset").evaluate(ht,{},wi).map(Oi=>Oi*di):(fh=ei.layout.get("text-radial-offset").evaluate(ht,{},wi)*di,gh=ih),Ze.allowVerticalPlacement&&Ot.vertical){const Oi=ei.layout.get("text-rotate").evaluate(ht,{},wi)+90;mr=new Dl(li,pt,mi,vi,Di,Ot.vertical,ti,fi,bi,Oi),Qt&&(rr=new Dl(li,pt,mi,vi,Di,Qt,Ri,Bi,bi,Oi))}if(Ut){const Oi=ei.layout.get("icon-rotate").evaluate(ht,{}),Ur=ei.layout.get("icon-text-fit")!=="none",So=id(Ut,Oi,gi,Ur),To=Qt?id(Qt,Oi,gi,Ur):void 0;fn=new Dl(li,pt,mi,vi,Di,Ut,Ri,Bi,!1,Oi),Fi=4*So.length;const Ed=Ze.iconSizeData;let va=null;Ed.kind==="source"?(va=[mn*ei.layout.get("icon-size").evaluate(ht,{})],va[0]>Nn&&gt(`${Ze.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):Ed.kind==="composite"&&(va=[mn*ji.compositeIconSizes[0].evaluate(ht,{},wi),mn*ji.compositeIconSizes[1].evaluate(ht,{},wi)],(va[0]>Nn||va[1]>Nn)&&gt(`${Ze.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),Ze.addSymbols(Ze.icon,So,va,ci,Nt,ht,o.WritingMode.none,pt,Er.lineStartIndex,Er.lineLength,-1,wi),ph=Ze.icon.placedSymbolArray.length-1,To&&(gn=4*To.length,Ze.addSymbols(Ze.icon,To,va,ci,Nt,ht,o.WritingMode.vertical,pt,Er.lineStartIndex,Er.lineLength,-1,wi),mh=Ze.icon.placedSymbolArray.length-1)}const Td=Object.keys(Ot.horizontal);for(const Oi of Td){const Ur=Ot.horizontal[Oi];if(!Ar){Sd=so(Ur.text);const To=ei.layout.get("text-rotate").evaluate(ht,{},wi);Ar=new Dl(li,pt,mi,vi,Di,Ur,ti,fi,bi,To)}const So=Ur.positionedLines.length===1;if(wo+=ad(Ze,pt,Ur,pi,ei,bi,ht,Mi,Er,Ot.vertical?o.WritingMode.horizontal:o.WritingMode.horizontalOnly,So?Td:[Oi],yn,ph,ji,wi),So)break}Ot.vertical&&(wd+=ad(Ze,pt,Ot.vertical,pi,ei,bi,ht,Mi,Er,o.WritingMode.vertical,["vertical"],yn,mh,ji,wi));const Dg=Ar?Ar.boxStartIndex:Ze.collisionBoxArray.length,Rg=Ar?Ar.boxEndIndex:Ze.collisionBoxArray.length,Bg=mr?mr.boxStartIndex:Ze.collisionBoxArray.length,Fg=mr?mr.boxEndIndex:Ze.collisionBoxArray.length,Og=fn?fn.boxStartIndex:Ze.collisionBoxArray.length,Ug=fn?fn.boxEndIndex:Ze.collisionBoxArray.length,$g=rr?rr.boxStartIndex:Ze.collisionBoxArray.length,Ng=rr?rr.boxEndIndex:Ze.collisionBoxArray.length;let Cr=-1;const Ul=(Oi,Ur)=>Oi&&Oi.circleDiameter?Math.max(Oi.circleDiameter,Ur):Ur;Cr=Ul(Ar,Cr),Cr=Ul(mr,Cr),Cr=Ul(fn,Cr),Cr=Ul(rr,Cr);const Id=Cr>-1?1:0;Id&&(Cr*=pr/di),Ze.glyphOffsetArray.length>=ds.MAX_GLYPHS&&gt("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),ht.sortKey!==void 0&&Ze.addToSortKeyRanges(Ze.symbolInstances.length,ht.sortKey),Ze.symbolInstances.emplaceBack(pt.x,pt.y,yn.right>=0?yn.right:-1,yn.center>=0?yn.center:-1,yn.left>=0?yn.left:-1,yn.vertical||-1,ph,mh,Sd,Dg,Rg,Bg,Fg,Og,Ug,$g,Ng,mi,wo,wd,Fi,gn,Id,0,ti,fh,gh,Cr)}(i,Ye,be,r,a,c,De,i.layers[0],i.collisionBoxArray,e.index,e.sourceLayerIndex,i.index,W,pe,Be,v,oe,xe,qe,D,e,p,S,A,m)};if(Me==="line")for(const be of td(e.geometry,0,0,ai,ai)){const Ye=gg(be,se,ye,r.vertical||B,a,24,re,i.overscaling,ai);for(const Ze of Ye){const pt=B;pt&&wg(i,pt.text,Pe,Ze)||ze(be,Ze)}}else if(Me==="line-center"){for(const be of e.geometry)if(be.length>1){const Ye=fg(be,ye,r.vertical||B,a,24,re);Ye&&ze(be,Ye)}}else if(e.type==="Polygon")for(const be of qc(e.geometry,0)){const Ye=xg(be,16);ze(be[0],new $n(Ye.x,Ye.y,0))}else if(e.type==="LineString")for(const be of e.geometry)ze(be,new $n(be[0].x,be[0].y,0));else if(e.type==="Point")for(const be of e.geometry)for(const Ye of be)ze([Ye],new $n(Ye.x,Ye.y,0))}const Nn=32640;function ad(i,e,r,a,c,p,m,y,v,S,A,M,k,D,B){const Z=function(oe,se,pe,xe,ye,Be,qe,Me){const Pe=xe.layout.get("text-rotate").evaluate(Be,{})*Math.PI/180,Te=[];for(const De of se.positionedLines)for(const ze of De.positionedGlyphs){if(!ze.rect)continue;const be=ze.rect||{};let Ye=4,Ze=!0,pt=1,wt=0;const Ot=(ye||Me)&&ze.vertical,Ut=ze.metrics.advance*ze.scale/2;if(Me&&se.verticalizable){const Nt=(ze.scale-1)*di,ci=(di-ze.metrics.width*ze.scale)/2;wt=De.lineOffset/2-(ze.imageName?-ci:Nt)}if(ze.imageName){const Nt=qe[ze.imageName];Ze=Nt.sdf,pt=Nt.pixelRatio,Ye=1/pt}const pi=ye?[ze.x+Ut,ze.y]:[0,0];let Qt=ye?[0,0]:[ze.x+Ut+pe[0],ze.y+pe[1]-wt],ei=[0,0];Ot&&(ei=Qt,Qt=[0,0]);const li=(ze.metrics.left-Ye)*ze.scale-Ut+Qt[0],mi=(-ze.metrics.top-Ye)*ze.scale+Qt[1],vi=li+be.w*ze.scale/pt,Di=mi+be.h*ze.scale/pt,ti=new Ke(li,mi),fi=new Ke(vi,mi),bi=new Ke(li,Di),Mi=new Ke(vi,Di);if(Ot){const Nt=new Ke(-Ut,Ut-Cl),ci=-Math.PI/2,ht=12-Ut,ji=new Ke(22-ht,-(ze.imageName?ht:0)),gi=new Ke(...ei);ti._rotateAround(ci,Nt)._add(ji)._add(gi),fi._rotateAround(ci,Nt)._add(ji)._add(gi),bi._rotateAround(ci,Nt)._add(ji)._add(gi),Mi._rotateAround(ci,Nt)._add(ji)._add(gi)}if(Pe){const Nt=Math.sin(Pe),ci=Math.cos(Pe),ht=[ci,-Nt,Nt,ci];ti._matMult(ht),fi._matMult(ht),bi._matMult(ht),Mi._matMult(ht)}const Ri=new Ke(0,0),Bi=new Ke(0,0);Te.push({tl:ti,tr:fi,bl:bi,br:Mi,tex:be,writingMode:se.writingMode,glyphOffset:pi,sectionIndex:ze.sectionIndex,isSDF:Ze,pixelOffsetTL:Ri,pixelOffsetBR:Bi,minFontScaleX:0,minFontScaleY:0})}return Te}(0,r,y,c,p,m,a,i.allowVerticalPlacement),W=i.textSizeData;let re=null;W.kind==="source"?(re=[mn*c.layout.get("text-size").evaluate(m,{})],re[0]>Nn&&gt(`${i.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):W.kind==="composite"&&(re=[mn*D.compositeTextSizes[0].evaluate(m,{},B),mn*D.compositeTextSizes[1].evaluate(m,{},B)],(re[0]>Nn||re[1]>Nn)&&gt(`${i.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),i.addSymbols(i.text,Z,re,y,p,m,S,e,v.lineStartIndex,v.lineLength,k,B);for(const oe of A)M[oe]=i.text.placedSymbolArray.length-1;return 4*Z.length}function sd(i){for(const e in i)return i[e];return null}function wg(i,e,r,a){const c=i.compareText;if(e in c){const p=c[e];for(let m=p.length-1;m>=0;m--)if(a.dist(p[m])<r)return!0}else c[e]=[];return c[e].push(a),!1}const Sg=On.VectorTileFeature.types,Tg=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Rl(i,e,r,a,c,p,m,y,v,S,A,M,k){const D=y?Math.min(Nn,Math.round(y[0])):0,B=y?Math.min(Nn,Math.round(y[1])):0;i.emplaceBack(e,r,Math.round(32*a),Math.round(32*c),p,m,(D<<1)+(v?1:0),B,16*S,16*A,256*M,256*k)}function nh(i,e,r){i.emplaceBack(e.x,e.y,r),i.emplaceBack(e.x,e.y,r),i.emplaceBack(e.x,e.y,r),i.emplaceBack(e.x,e.y,r)}function Ig(i){for(const e of i.sections)if(Mc(e.text))return!0;return!1}class ah{constructor(e){this.layoutVertexArray=new ui,this.indexArray=new Ci,this.programConfigurations=e,this.segments=new xt,this.dynamicLayoutVertexArray=new ki,this.opacityVertexArray=new Gi,this.placedSymbolArray=new ve}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(e,r,a,c){this.isEmpty()||(a&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Hf.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,Xf.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,Tg,!0),this.opacityVertexBuffer.itemSize=1),(a||c)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}Re("SymbolBuffers",ah);class sh{constructor(e,r,a){this.layoutVertexArray=new e,this.layoutAttributes=r,this.indexArray=new a,this.segments=new xt,this.collisionVertexArray=new Or}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,Yf.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}Re("CollisionBuffers",sh);class ds{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(m=>m.id),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=Fc([]),this.placementViewportMatrix=Fc([]);const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Xu(this.zoom,r["text-size"]),this.iconSizeData=Xu(this.zoom,r["icon-size"]);const a=this.layers[0].layout,c=a.get("symbol-sort-key"),p=a.get("symbol-z-order");this.canOverlap=lh(a,"text-overlap","text-allow-overlap")!=="never"||lh(a,"icon-overlap","icon-allow-overlap")!=="never"||a.get("text-ignore-placement")||a.get("icon-ignore-placement"),this.sortFeaturesByKey=p!=="viewport-y"&&!c.isConstant(),this.sortFeaturesByY=(p==="viewport-y"||p==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,a.get("symbol-placement")==="point"&&(this.writingModes=a.get("text-writing-mode").map(m=>o.WritingMode[m])),this.stateDependentLayerIds=this.layers.filter(m=>m.isStateDependent()).map(m=>m.id),this.sourceID=e.sourceID}createArrays(){this.text=new ah(new ga(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new ah(new ga(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new Fe,this.lineVertexArray=new Ce,this.symbolInstances=new me}calculateGlyphDependencies(e,r,a,c,p){for(let m=0;m<e.length;m++)if(r[e.charCodeAt(m)]=!0,(a||c)&&p){const y=_o[e.charAt(m)];y&&(r[y.charCodeAt(0)]=!0)}}populate(e,r,a){const c=this.layers[0],p=c.layout,m=p.get("text-font"),y=p.get("text-field"),v=p.get("icon-image"),S=(y.value.kind!=="constant"||y.value.value instanceof V&&!y.value.value.isEmpty()||y.value.value.toString().length>0)&&(m.value.kind!=="constant"||m.value.value.length>0),A=v.value.kind!=="constant"||!!v.value.value||Object.keys(v.parameters).length>0,M=p.get("symbol-sort-key");if(this.features=[],!S&&!A)return;const k=r.iconDependencies,D=r.glyphDependencies,B=r.availableImages,Z=new Bt(this.zoom);for(const{feature:W,id:re,index:oe,sourceLayerIndex:se}of e){const pe=c._featureFilter.needGeometry,xe=_a(W,pe);if(!c._featureFilter.filter(Z,xe,a))continue;let ye,Be;if(pe||(xe.geometry=ya(W)),S){const Me=c.getValueAndResolveTokens("text-field",xe,a,B),Pe=V.factory(Me);Ig(Pe)&&(this.hasRTLText=!0),(!this.hasRTLText||ro()==="unavailable"||this.hasRTLText&&Vi.isParsed())&&(ye=Jf(Pe,c,xe))}if(A){const Me=c.getValueAndResolveTokens("icon-image",xe,a,B);Be=Me instanceof J?Me:J.fromString(Me)}if(!ye&&!Be)continue;const qe=this.sortFeaturesByKey?M.evaluate(xe,{},a):void 0;if(this.features.push({id:re,text:ye,icon:Be,index:oe,sourceLayerIndex:se,geometry:xe.geometry,properties:W.properties,type:Sg[W.type],sortKey:qe}),Be&&(k[Be.name]=!0),ye){const Me=m.evaluate(xe,{},a).join(","),Pe=p.get("text-rotation-alignment")!=="viewport"&&p.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(o.WritingMode.vertical)>=0;for(const Te of ye.sections)if(Te.image)k[Te.image.name]=!0;else{const De=Js(ye.toString()),ze=Te.fontStack||Me,be=D[ze]=D[ze]||{};this.calculateGlyphDependencies(Te.text,be,Pe,this.allowVerticalPlacement,De)}}}p.get("symbol-placement")==="line"&&(this.features=function(W){const re={},oe={},se=[];let pe=0;function xe(Me){se.push(W[Me]),pe++}function ye(Me,Pe,Te){const De=oe[Me];return delete oe[Me],oe[Pe]=De,se[De].geometry[0].pop(),se[De].geometry[0]=se[De].geometry[0].concat(Te[0]),De}function Be(Me,Pe,Te){const De=re[Pe];return delete re[Pe],re[Me]=De,se[De].geometry[0].shift(),se[De].geometry[0]=Te[0].concat(se[De].geometry[0]),De}function qe(Me,Pe,Te){const De=Te?Pe[0][Pe[0].length-1]:Pe[0][0];return`${Me}:${De.x}:${De.y}`}for(let Me=0;Me<W.length;Me++){const Pe=W[Me],Te=Pe.geometry,De=Pe.text?Pe.text.toString():null;if(!De){xe(Me);continue}const ze=qe(De,Te),be=qe(De,Te,!0);if(ze in oe&&be in re&&oe[ze]!==re[be]){const Ye=Be(ze,be,Te),Ze=ye(ze,be,se[Ye].geometry);delete re[ze],delete oe[be],oe[qe(De,se[Ze].geometry,!0)]=Ze,se[Ye].geometry=null}else ze in oe?ye(ze,be,Te):be in re?Be(ze,be,Te):(xe(Me),re[ze]=pe-1,oe[be]=pe-1)}return se.filter(Me=>Me.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((W,re)=>W.sortKey-re.sortKey)}update(e,r,a){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,r,this.layers,a),this.icon.programConfigurations.updatePaintArrays(e,r,this.layers,a))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,r){const a=this.lineVertexArray.length;if(e.segment!==void 0){let c=e.dist(r[e.segment+1]),p=e.dist(r[e.segment]);const m={};for(let y=e.segment+1;y<r.length;y++)m[y]={x:r[y].x,y:r[y].y,tileUnitDistanceFromAnchor:c},y<r.length-1&&(c+=r[y+1].dist(r[y]));for(let y=e.segment||0;y>=0;y--)m[y]={x:r[y].x,y:r[y].y,tileUnitDistanceFromAnchor:p},y>0&&(p+=r[y-1].dist(r[y]));for(let y=0;y<r.length;y++){const v=m[y];this.lineVertexArray.emplaceBack(v.x,v.y,v.tileUnitDistanceFromAnchor)}}return{lineStartIndex:a,lineLength:this.lineVertexArray.length-a}}addSymbols(e,r,a,c,p,m,y,v,S,A,M,k){const D=e.indexArray,B=e.layoutVertexArray,Z=e.segments.prepareSegment(4*r.length,B,D,this.canOverlap?m.sortKey:void 0),W=this.glyphOffsetArray.length,re=Z.vertexLength,oe=this.allowVerticalPlacement&&y===o.WritingMode.vertical?Math.PI/2:0,se=m.text&&m.text.sections;for(let pe=0;pe<r.length;pe++){const{tl:xe,tr:ye,bl:Be,br:qe,tex:Me,pixelOffsetTL:Pe,pixelOffsetBR:Te,minFontScaleX:De,minFontScaleY:ze,glyphOffset:be,isSDF:Ye,sectionIndex:Ze}=r[pe],pt=Z.vertexLength,wt=be[1];Rl(B,v.x,v.y,xe.x,wt+xe.y,Me.x,Me.y,a,Ye,Pe.x,Pe.y,De,ze),Rl(B,v.x,v.y,ye.x,wt+ye.y,Me.x+Me.w,Me.y,a,Ye,Te.x,Pe.y,De,ze),Rl(B,v.x,v.y,Be.x,wt+Be.y,Me.x,Me.y+Me.h,a,Ye,Pe.x,Te.y,De,ze),Rl(B,v.x,v.y,qe.x,wt+qe.y,Me.x+Me.w,Me.y+Me.h,a,Ye,Te.x,Te.y,De,ze),nh(e.dynamicLayoutVertexArray,v,oe),D.emplaceBack(pt,pt+1,pt+2),D.emplaceBack(pt+1,pt+2,pt+3),Z.vertexLength+=4,Z.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(be[0]),pe!==r.length-1&&Ze===r[pe+1].sectionIndex||e.programConfigurations.populatePaintArrays(B.length,m,m.index,{},k,se&&se[Ze])}e.placedSymbolArray.emplaceBack(v.x,v.y,W,this.glyphOffsetArray.length-W,re,S,A,v.segment,a?a[0]:0,a?a[1]:0,c[0],c[1],y,0,!1,0,M)}_addCollisionDebugVertex(e,r,a,c,p,m){return r.emplaceBack(0,0),e.emplaceBack(a.x,a.y,c,p,Math.round(m.x),Math.round(m.y))}addCollisionDebugVertices(e,r,a,c,p,m,y){const v=p.segments.prepareSegment(4,p.layoutVertexArray,p.indexArray),S=v.vertexLength,A=p.layoutVertexArray,M=p.collisionVertexArray,k=y.anchorX,D=y.anchorY;this._addCollisionDebugVertex(A,M,m,k,D,new Ke(e,r)),this._addCollisionDebugVertex(A,M,m,k,D,new Ke(a,r)),this._addCollisionDebugVertex(A,M,m,k,D,new Ke(a,c)),this._addCollisionDebugVertex(A,M,m,k,D,new Ke(e,c)),v.vertexLength+=4;const B=p.indexArray;B.emplaceBack(S,S+1),B.emplaceBack(S+1,S+2),B.emplaceBack(S+2,S+3),B.emplaceBack(S+3,S),v.primitiveLength+=4}addDebugCollisionBoxes(e,r,a,c){for(let p=e;p<r;p++){const m=this.collisionBoxArray.get(p);this.addCollisionDebugVertices(m.x1,m.y1,m.x2,m.y2,c?this.textCollisionBox:this.iconCollisionBox,m.anchorPoint,a)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new sh(qi,Ru.members,cr),this.iconCollisionBox=new sh(qi,Ru.members,cr);for(let e=0;e<this.symbolInstances.length;e++){const r=this.symbolInstances.get(e);this.addDebugCollisionBoxes(r.textBoxStartIndex,r.textBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.iconBoxStartIndex,r.iconBoxEndIndex,r,!1),this.addDebugCollisionBoxes(r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex,r,!1)}}_deserializeCollisionBoxesForSymbol(e,r,a,c,p,m,y,v,S){const A={};for(let M=r;M<a;M++){const k=e.get(M);A.textBox={x1:k.x1,y1:k.y1,x2:k.x2,y2:k.y2,anchorPointX:k.anchorPointX,anchorPointY:k.anchorPointY},A.textFeatureIndex=k.featureIndex;break}for(let M=c;M<p;M++){const k=e.get(M);A.verticalTextBox={x1:k.x1,y1:k.y1,x2:k.x2,y2:k.y2,anchorPointX:k.anchorPointX,anchorPointY:k.anchorPointY},A.verticalTextFeatureIndex=k.featureIndex;break}for(let M=m;M<y;M++){const k=e.get(M);A.iconBox={x1:k.x1,y1:k.y1,x2:k.x2,y2:k.y2,anchorPointX:k.anchorPointX,anchorPointY:k.anchorPointY},A.iconFeatureIndex=k.featureIndex;break}for(let M=v;M<S;M++){const k=e.get(M);A.verticalIconBox={x1:k.x1,y1:k.y1,x2:k.x2,y2:k.y2,anchorPointX:k.anchorPointX,anchorPointY:k.anchorPointY},A.verticalIconFeatureIndex=k.featureIndex;break}return A}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let r=0;r<this.symbolInstances.length;r++){const a=this.symbolInstances.get(r);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,a.textBoxStartIndex,a.textBoxEndIndex,a.verticalTextBoxStartIndex,a.verticalTextBoxEndIndex,a.iconBoxStartIndex,a.iconBoxEndIndex,a.verticalIconBoxStartIndex,a.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(e,r){const a=e.placedSymbolArray.get(r),c=a.vertexStartIndex+4*a.numGlyphs;for(let p=a.vertexStartIndex;p<c;p+=4)e.indexArray.emplaceBack(p,p+1,p+2),e.indexArray.emplaceBack(p+1,p+2,p+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const r=Math.sin(e),a=Math.cos(e),c=[],p=[],m=[];for(let y=0;y<this.symbolInstances.length;++y){m.push(y);const v=this.symbolInstances.get(y);c.push(0|Math.round(r*v.anchorX+a*v.anchorY)),p.push(v.featureIndex)}return m.sort((y,v)=>c[y]-c[v]||p[v]-p[y]),m}addToSortKeyRanges(e,r){const a=this.sortKeyRanges[this.sortKeyRanges.length-1];a&&a.sortKey===r?a.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:r,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const r of this.symbolInstanceIndexes){const a=this.symbolInstances.get(r);this.featureSortOrder.push(a.featureIndex),[a.rightJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.leftJustifiedTextSymbolIndex].forEach((c,p,m)=>{c>=0&&m.indexOf(c)===p&&this.addIndicesForPlacedSymbol(this.text,c)}),a.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,a.verticalPlacedTextSymbolIndex),a.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,a.placedIconSymbolIndex),a.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,a.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}Re("SymbolBucket",ds,{omit:["layers","collisionBoxArray","features","compareText"]}),ds.MAX_GLYPHS=65535,ds.addDynamicAttributes=nh;const Eg=new ri({"symbol-placement":new Ue(de.layout_symbol["symbol-placement"]),"symbol-spacing":new Ue(de.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Ue(de.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Xe(de.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Ue(de.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Ue(de.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Ue(de.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Ue(de.layout_symbol["icon-ignore-placement"]),"icon-optional":new Ue(de.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Ue(de.layout_symbol["icon-rotation-alignment"]),"icon-size":new Xe(de.layout_symbol["icon-size"]),"icon-text-fit":new Ue(de.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Ue(de.layout_symbol["icon-text-fit-padding"]),"icon-image":new Xe(de.layout_symbol["icon-image"]),"icon-rotate":new Xe(de.layout_symbol["icon-rotate"]),"icon-padding":new Ue(de.layout_symbol["icon-padding"]),"icon-keep-upright":new Ue(de.layout_symbol["icon-keep-upright"]),"icon-offset":new Xe(de.layout_symbol["icon-offset"]),"icon-anchor":new Xe(de.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Ue(de.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Ue(de.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Ue(de.layout_symbol["text-rotation-alignment"]),"text-field":new Xe(de.layout_symbol["text-field"]),"text-font":new Xe(de.layout_symbol["text-font"]),"text-size":new Xe(de.layout_symbol["text-size"]),"text-max-width":new Xe(de.layout_symbol["text-max-width"]),"text-line-height":new Ue(de.layout_symbol["text-line-height"]),"text-letter-spacing":new Xe(de.layout_symbol["text-letter-spacing"]),"text-justify":new Xe(de.layout_symbol["text-justify"]),"text-radial-offset":new Xe(de.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Ue(de.layout_symbol["text-variable-anchor"]),"text-anchor":new Xe(de.layout_symbol["text-anchor"]),"text-max-angle":new Ue(de.layout_symbol["text-max-angle"]),"text-writing-mode":new Ue(de.layout_symbol["text-writing-mode"]),"text-rotate":new Xe(de.layout_symbol["text-rotate"]),"text-padding":new Ue(de.layout_symbol["text-padding"]),"text-keep-upright":new Ue(de.layout_symbol["text-keep-upright"]),"text-transform":new Xe(de.layout_symbol["text-transform"]),"text-offset":new Xe(de.layout_symbol["text-offset"]),"text-allow-overlap":new Ue(de.layout_symbol["text-allow-overlap"]),"text-overlap":new Ue(de.layout_symbol["text-overlap"]),"text-ignore-placement":new Ue(de.layout_symbol["text-ignore-placement"]),"text-optional":new Ue(de.layout_symbol["text-optional"])});var oh={paint:new ri({"icon-opacity":new Xe(de.paint_symbol["icon-opacity"]),"icon-color":new Xe(de.paint_symbol["icon-color"]),"icon-halo-color":new Xe(de.paint_symbol["icon-halo-color"]),"icon-halo-width":new Xe(de.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Xe(de.paint_symbol["icon-halo-blur"]),"icon-translate":new Ue(de.paint_symbol["icon-translate"]),"icon-translate-anchor":new Ue(de.paint_symbol["icon-translate-anchor"]),"text-opacity":new Xe(de.paint_symbol["text-opacity"]),"text-color":new Xe(de.paint_symbol["text-color"],{runtimeType:_i,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new Xe(de.paint_symbol["text-halo-color"]),"text-halo-width":new Xe(de.paint_symbol["text-halo-width"]),"text-halo-blur":new Xe(de.paint_symbol["text-halo-blur"]),"text-translate":new Ue(de.paint_symbol["text-translate"]),"text-translate-anchor":new Ue(de.paint_symbol["text-translate-anchor"])}),layout:Eg};class od{constructor(e){this.type=e.property.overrides?e.property.overrides.runtimeType:kt,this.defaultValue=e}evaluate(e){if(e.formattedSection){const r=this.defaultValue.property.overrides;if(r&&r.hasOverride(e.formattedSection))return r.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Re("FormatSectionOverride",od,{omit:["defaultValue"]});class Bl extends Ai{constructor(e){super(e,oh)}recalculate(e,r){if(super.recalculate(e,r),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){const a=this.layout.get("text-writing-mode");if(a){const c=[];for(const p of a)c.indexOf(p)<0&&c.push(p);this.layout._values["text-writing-mode"]=c}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,r,a,c){const p=this.layout.get(e).evaluate(r,{},a,c),m=this._unevaluatedLayout._values[e];return m.isDataDriven()||Ua(m.value)||!p?p:function(y,v){return v.replace(/{([^{}]+)}/g,(S,A)=>A in y?String(y[A]):"")}(r.properties,p)}createBucket(e){return new ds(e)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const e of oh.paint.overridableProperties){if(!Bl.hasPaintOverride(this.layout,e))continue;const r=this.paint.get(e),a=new od(r),c=new Zs(a,r.property.specification);let p=null;p=r.value.kind==="constant"||r.value.kind==="source"?new Na("source",c):new Va("composite",c,r.value.zoomStops,r.value._interpolationType),this.paint._values[e]=new lr(r.property,p,r.parameters)}}_handleOverridablePaintPropertyUpdate(e,r,a){return!(!this.layout||r.isDataDriven()||a.isDataDriven())&&Bl.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,r){const a=e.get("text-field"),c=oh.paint.properties[r];let p=!1;const m=y=>{for(const v of y)if(c.overrides&&c.overrides.hasOverride(v))return void(p=!0)};if(a.value.kind==="constant"&&a.value.value instanceof V)m(a.value.value.sections);else if(a.value.kind==="source"){const y=S=>{p||(S instanceof _e&&Q(S.value)===Ji?m(S.value.sections):S instanceof Ne?m(S.sections):S.eachChild(y))},v=a.value;v._styleExpression&&y(v._styleExpression.expression)}return p}}function lh(i,e,r){let a="never";const c=i.get(e);return c?a=c:i.get(r)&&(a="always"),a}var Ag={paint:new ri({"background-color":new Ue(de.paint_background["background-color"]),"background-pattern":new pa(de.paint_background["background-pattern"]),"background-opacity":new Ue(de.paint_background["background-opacity"])})},Cg={paint:new ri({"raster-opacity":new Ue(de.paint_raster["raster-opacity"]),"raster-hue-rotate":new Ue(de.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Ue(de.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Ue(de.paint_raster["raster-brightness-max"]),"raster-saturation":new Ue(de.paint_raster["raster-saturation"]),"raster-contrast":new Ue(de.paint_raster["raster-contrast"]),"raster-resampling":new Ue(de.paint_raster["raster-resampling"]),"raster-fade-duration":new Ue(de.paint_raster["raster-fade-duration"])})};class Mg extends Ai{constructor(e){super(e,{}),this.onAdd=r=>{this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)},this.onRemove=r=>{this.implementation.onRemove&&this.implementation.onRemove(r,r.painter.context.gl)},this.implementation=e}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){}}const Pg={circle:class extends Ai{constructor(i){super(i,lf)}createBucket(i){return new Dc(i)}queryRadius(i){const e=i;return lo("circle-radius",this,e)+lo("circle-stroke-width",this,e)+vl(this.paint.get("circle-translate"))}queryIntersectsFeature(i,e,r,a,c,p,m,y){const v=bl(i,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),p.angle,m),S=this.paint.get("circle-radius").evaluate(e,r)+this.paint.get("circle-stroke-width").evaluate(e,r),A=this.paint.get("circle-pitch-alignment")==="map",M=A?v:function(D,B){return D.map(Z=>yu(Z,B))}(v,y),k=A?S*m:S;for(const D of a)for(const B of D){const Z=A?B:yu(B,y);let W=k;const re=wl([],[B.x,B.y,0,1],y);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?W*=re[3]/p.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(W*=p.cameraToCenterDistance/re[3]),rf(M,Z,W))return!0}return!1}},heatmap:class extends Ai{constructor(i){super(i,hf),this._updateColorRamp()}createBucket(i){return new _u(i)}_handleSpecialPaintPropertyUpdate(i){i==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=vu({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}},hillshade:class extends Ai{constructor(i){super(i,uf)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}},fill:class extends Ai{constructor(i){super(i,Af)}recalculate(i,e){super.recalculate(i,e);const 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(i){return new Wc(i)}queryRadius(){return vl(this.paint.get("fill-translate"))}queryIntersectsFeature(i,e,r,a,c,p,m){return pu(bl(i,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),p.angle,m),a)}isTileClipped(){return!0}},"fill-extrusion":class extends Ai{constructor(i){super(i,$f)}createBucket(i){return new Xc(i)}queryRadius(){return vl(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(i,e,r,a,c,p,m,y){const v=bl(i,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),p.angle,m),S=this.paint.get("fill-extrusion-height").evaluate(e,r),A=this.paint.get("fill-extrusion-base").evaluate(e,r),M=function(D,B,Z,W){const re=[];for(const oe of D){const se=[oe.x,oe.y,0,1];wl(se,se,B),re.push(new Ke(se[0]/se[3],se[1]/se[3]))}return re}(v,y),k=function(D,B,Z,W){const re=[],oe=[],se=W[8]*B,pe=W[9]*B,xe=W[10]*B,ye=W[11]*B,Be=W[8]*Z,qe=W[9]*Z,Me=W[10]*Z,Pe=W[11]*Z;for(const Te of D){const De=[],ze=[];for(const be of Te){const Ye=be.x,Ze=be.y,pt=W[0]*Ye+W[4]*Ze+W[12],wt=W[1]*Ye+W[5]*Ze+W[13],Ot=W[2]*Ye+W[6]*Ze+W[14],Ut=W[3]*Ye+W[7]*Ze+W[15],pi=Ot+xe,Qt=Ut+ye,ei=pt+Be,li=wt+qe,mi=Ot+Me,vi=Ut+Pe,Di=new Ke((pt+se)/Qt,(wt+pe)/Qt);Di.z=pi/Qt,De.push(Di);const ti=new Ke(ei/vi,li/vi);ti.z=mi/vi,ze.push(ti)}re.push(De),oe.push(ze)}return[re,oe]}(a,A,S,y);return function(D,B,Z){let W=1/0;pu(Z,B)&&(W=Pu(Z,B[0]));for(let re=0;re<B.length;re++){const oe=B[re],se=D[re];for(let pe=0;pe<oe.length-1;pe++){const xe=oe[pe],ye=[xe,oe[pe+1],se[pe+1],se[pe],xe];du(Z,ye)&&(W=Math.min(W,Pu(Z,ye)))}}return W!==1/0&&W}(k[0],k[1],M)}},line:class extends Ai{constructor(i){super(i,ku),this.gradientVersion=0}_handleSpecialPaintPropertyUpdate(i){i==="line-gradient"&&(this.stepInterpolant=this._transitionablePaint._values["line-gradient"].value.expression._styleExpression.expression instanceof ea,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER)}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(i,e){super.recalculate(i,e),this.paint._values["line-floorwidth"]=Lu.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,i)}createBucket(i){return new Yc(i)}queryRadius(i){const e=i,r=Du(lo("line-width",this,e),lo("line-gap-width",this,e)),a=lo("line-offset",this,e);return r/2+Math.abs(a)+vl(this.paint.get("line-translate"))}queryIntersectsFeature(i,e,r,a,c,p,m){const y=bl(i,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),p.angle,m),v=m/2*Du(this.paint.get("line-width").evaluate(e,r),this.paint.get("line-gap-width").evaluate(e,r)),S=this.paint.get("line-offset").evaluate(e,r);return S&&(a=function(A,M){const k=[];for(let D=0;D<A.length;D++){const B=A[D],Z=[];for(let W=0;W<B.length;W++){const re=B[W-1],oe=B[W],se=B[W+1],pe=W===0?new Ke(0,0):oe.sub(re)._unit()._perp(),xe=W===B.length-1?new Ke(0,0):se.sub(oe)._unit()._perp(),ye=pe._add(xe)._unit(),Be=ye.x*xe.x+ye.y*xe.y;Be!==0&&ye._mult(1/Be),Z.push(ye._mult(M)._add(oe))}k.push(Z)}return k}(a,S*m)),function(A,M,k){for(let D=0;D<M.length;D++){const B=M[D];if(A.length>=3){for(let Z=0;Z<B.length;Z++)if(ns(A,B[Z]))return!0}if(nf(A,B,k))return!0}return!1}(y,a,v)}isTileClipped(){return!0}},symbol:Bl,background:class extends Ai{constructor(i){super(i,Ag)}},raster:class extends Ai{constructor(i){super(i,Cg)}}};class zg{constructor(e){this._callback=e,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){delete this._channel,this._callback=()=>{}}}const ld=63710088e-1;class Zt{constructor(e,r){if(isNaN(e)||isNaN(r))throw new Error(`Invalid LngLat object: (${e}, ${r})`);if(this.lng=+e,this.lat=+r,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Zt(ke(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const r=Math.PI/180,a=this.lat*r,c=e.lat*r,p=Math.sin(a)*Math.sin(c)+Math.cos(a)*Math.cos(c)*Math.cos((e.lng-this.lng)*r);return ld*Math.acos(Math.min(p,1))}toBounds(e=0){const r=360*e/40075017,a=r/Math.cos(Math.PI/180*this.lat);return new xa(new Zt(this.lng-a,this.lat-r),new Zt(this.lng+a,this.lat+r))}static convert(e){if(e instanceof Zt)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new Zt(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new Zt(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}class xa{constructor(e,r){e&&(r?this.setSouthWest(e).setNorthEast(r):e.length===4?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1]))}setNorthEast(e){return this._ne=e instanceof Zt?new Zt(e.lng,e.lat):Zt.convert(e),this}setSouthWest(e){return this._sw=e instanceof Zt?new Zt(e.lng,e.lat):Zt.convert(e),this}extend(e){const r=this._sw,a=this._ne;let c,p;if(e instanceof Zt)c=e,p=e;else{if(!(e instanceof xa))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(xa.convert(e)):this.extend(Zt.convert(e)):this;if(c=e._sw,p=e._ne,!c||!p)return this}return r||a?(r.lng=Math.min(c.lng,r.lng),r.lat=Math.min(c.lat,r.lat),a.lng=Math.max(p.lng,a.lng),a.lat=Math.max(p.lat,a.lat)):(this._sw=new Zt(c.lng,c.lat),this._ne=new Zt(p.lng,p.lat)),this}getCenter(){return new Zt((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new Zt(this.getWest(),this.getNorth())}getSouthEast(){return new Zt(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){const{lng:r,lat:a}=Zt.convert(e);let c=this._sw.lng<=r&&r<=this._ne.lng;return this._sw.lng>this._ne.lng&&(c=this._sw.lng>=r&&r>=this._ne.lng),this._sw.lat<=a&&a<=this._ne.lat&&c}static convert(e){return e instanceof xa?e:e&&new xa(e)}}const cd=2*Math.PI*ld;function hd(i){return cd*Math.cos(i*Math.PI/180)}function ud(i){return(180+i)/360}function dd(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function pd(i,e){return i/hd(e)}function ch(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}class Fl{constructor(e,r,a=0){this.x=+e,this.y=+r,this.z=+a}static fromLngLat(e,r=0){const a=Zt.convert(e);return new Fl(ud(a.lng),dd(a.lat),pd(r,a.lat))}toLngLat(){return new Zt(360*this.x-180,ch(this.y))}toAltitude(){return this.z*hd(ch(this.y))}meterInMercatorCoordinateUnits(){return 1/cd*(e=ch(this.y),1/Math.cos(e*Math.PI/180));var e}}function md(i,e,r){var a=2*Math.PI*6378137/256/Math.pow(2,r);return[i*a-2*Math.PI*6378137/2,e*a-2*Math.PI*6378137/2]}class hh{constructor(e,r,a){this.z=e,this.x=r,this.y=a,this.key=vo(0,e,e,r,a)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,r,a){const c=(m=this.y,y=this.z,v=md(256*(p=this.x),256*(m=Math.pow(2,y)-m-1),y),S=md(256*(p+1),256*(m+1),y),v[0]+","+v[1]+","+S[0]+","+S[1]);var p,m,y,v,S;const A=function(M,k,D){let B,Z="";for(let W=M;W>0;W--)B=1<<W-1,Z+=(k&B?1:0)+(D&B?2:0);return Z}(this.z,this.x,this.y);return e[(this.x+this.y)%e.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(a==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,r>1?"@2x":"").replace(/{quadkey}/g,A).replace(/{bbox-epsg-3857}/g,c)}getTilePoint(e){const r=Math.pow(2,this.z);return new Ke((e.x*r-this.x)*ai,(e.y*r-this.y)*ai)}toString(){return`${this.z}/${this.x}/${this.y}`}}class fd{constructor(e,r){this.wrap=e,this.canonical=r,this.key=vo(e,r.z,r.z,r.x,r.y)}}class dr{constructor(e,r,a,c,p){this.overscaledZ=e,this.wrap=r,this.canonical=new hh(a,+c,+p),this.key=vo(r,e,a,c,p)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){const r=this.canonical.z-e;return e>this.canonical.z?new dr(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new dr(e,this.wrap,e,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(e,r){const a=this.canonical.z-e;return e>this.canonical.z?vo(this.wrap*+r,e,this.canonical.z,this.canonical.x,this.canonical.y):vo(this.wrap*+r,e,e,this.canonical.x>>a,this.canonical.y>>a)}isChildOf(e){if(e.wrap!==this.wrap)return!1;const r=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ<this.overscaledZ&&e.canonical.x===this.canonical.x>>r&&e.canonical.y===this.canonical.y>>r}children(e){if(this.overscaledZ>=e)return[new dr(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const r=this.canonical.z+1,a=2*this.canonical.x,c=2*this.canonical.y;return[new dr(r,this.wrap,r,a,c),new dr(r,this.wrap,r,a+1,c),new dr(r,this.wrap,r,a,c+1),new dr(r,this.wrap,r,a+1,c+1)]}isLessThan(e){return this.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}wrapped(){return new dr(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new dr(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new fd(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new Fl(e.x-this.wrap,e.y))}}function vo(i,e,r,a,c){(i*=2)<0&&(i=-1*i-1);const p=1<<r;return(p*p*i+p*c+a).toString(36)+r.toString(36)+e.toString(36)}Re("CanonicalTileID",hh),Re("OverscaledTileID",dr,{omit:["posMatrix"]});class gd{constructor(e,r,a){if(this.uid=e,r.height!==r.width)throw new RangeError("DEM tiles must be square");if(a&&a!=="mapbox"&&a!=="terrarium")return void gt(`"${a}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=r.height;const c=this.dim=r.height-2;this.data=new Uint32Array(r.data.buffer),this.encoding=a||"mapbox";for(let p=0;p<c;p++)this.data[this._idx(-1,p)]=this.data[this._idx(0,p)],this.data[this._idx(c,p)]=this.data[this._idx(c-1,p)],this.data[this._idx(p,-1)]=this.data[this._idx(p,0)],this.data[this._idx(p,c)]=this.data[this._idx(p,c-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(c,-1)]=this.data[this._idx(c-1,0)],this.data[this._idx(-1,c)]=this.data[this._idx(0,c-1)],this.data[this._idx(c,c)]=this.data[this._idx(c-1,c-1)]}get(e,r){const a=new Uint8Array(this.data.buffer),c=4*this._idx(e,r);return(this.encoding==="terrarium"?this._unpackTerrarium:this._unpackMapbox)(a[c],a[c+1],a[c+2])}getUnpackVector(){return this.encoding==="terrarium"?[256,1,1/256,32768]:[6553.6,25.6,.1,1e4]}_idx(e,r){if(e<-1||e>=this.dim+1||r<-1||r>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(r+1)*this.stride+(e+1)}_unpackMapbox(e,r,a){return(256*e*256+256*r+a)/10-1e4}_unpackTerrarium(e,r,a){return 256*e+r+a/256-32768}getPixels(){return new ir({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,r,a){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let c=r*this.dim,p=r*this.dim+this.dim,m=a*this.dim,y=a*this.dim+this.dim;switch(r){case-1:c=p-1;break;case 1:p=c+1}switch(a){case-1:m=y-1;break;case 1:y=m+1}const v=-r*this.dim,S=-a*this.dim;for(let A=m;A<y;A++)for(let M=c;M<p;M++)this.data[this._idx(M,A)]=e.data[this._idx(M+v,A+S)]}}Re("DEMData",gd);class yd{constructor(e){this._stringToNumber={},this._numberToString=[];for(let r=0;r<e.length;r++){const a=e[r];this._stringToNumber[a]=r,this._numberToString[r]=a}}encode(e){return this._stringToNumber[e]}decode(e){return this._numberToString[e]}}class _d{constructor(e,r,a,c,p){this.type="Feature",this._vectorTileFeature=e,e._z=r,e._x=a,e._y=c,this.properties=e.properties,this.id=p}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){const e={geometry:this.geometry};for(const r in this)r!=="_geometry"&&r!=="_vectorTileFeature"&&(e[r]=this[r]);return e}}class xd{constructor(e,r){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new sn(ai,16,0),this.grid3D=new sn(ai,16,0),this.featureIndexArray=new ft,this.promoteId=r}insert(e,r,a,c,p,m){const y=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(a,c,p);const v=m?this.grid3D:this.grid;for(let S=0;S<r.length;S++){const A=r[S],M=[1/0,1/0,-1/0,-1/0];for(let k=0;k<A.length;k++){const D=A[k];M[0]=Math.min(M[0],D.x),M[1]=Math.min(M[1],D.y),M[2]=Math.max(M[2],D.x),M[3]=Math.max(M[3],D.y)}M[0]<ai&&M[1]<ai&&M[2]>=0&&M[3]>=0&&v.insert(y,M[0],M[1],M[2],M[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new On.VectorTile(new Kc(this.rawTileData)).layers,this.sourceLayerCoder=new yd(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,r,a,c){this.loadVTLayers();const p=e.params||{},m=ai/e.tileSize/e.scale,y=ja(p.filter),v=e.queryGeometry,S=e.queryPadding*m,A=bd(v),M=this.grid.query(A.minX-S,A.minY-S,A.maxX+S,A.maxY+S),k=bd(e.cameraQueryGeometry),D=this.grid3D.query(k.minX-S,k.minY-S,k.maxX+S,k.maxY+S,(W,re,oe,se)=>function(pe,xe,ye,Be,qe){for(const Pe of pe)if(xe<=Pe.x&&ye<=Pe.y&&Be>=Pe.x&&qe>=Pe.y)return!0;const Me=[new Ke(xe,ye),new Ke(xe,qe),new Ke(Be,qe),new Ke(Be,ye)];if(pe.length>2){for(const Pe of Me)if(ns(pe,Pe))return!0}for(let Pe=0;Pe<pe.length-1;Pe++)if(sf(pe[Pe],pe[Pe+1],Me))return!0;return!1}(e.cameraQueryGeometry,W-S,re-S,oe+S,se+S));for(const W of D)M.push(W);M.sort(kg);const B={};let Z;for(let W=0;W<M.length;W++){const re=M[W];if(re===Z)continue;Z=re;const oe=this.featureIndexArray.get(re);let se=null;this.loadMatchingFeature(B,oe.bucketIndex,oe.sourceLayerIndex,oe.featureIndex,y,p.layers,p.availableImages,r,a,c,(pe,xe,ye)=>(se||(se=ya(pe)),xe.queryIntersectsFeature(v,pe,ye,se,this.z,e.transform,m,e.pixelPosMatrix)))}return B}loadMatchingFeature(e,r,a,c,p,m,y,v,S,A,M){const k=this.bucketLayerIDs[r];if(m&&!function(W,re){for(let oe=0;oe<W.length;oe++)if(re.indexOf(W[oe])>=0)return!0;return!1}(m,k))return;const D=this.sourceLayerCoder.decode(a),B=this.vtLayers[D].feature(c);if(p.needGeometry){const W=_a(B,!0);if(!p.filter(new Bt(this.tileID.overscaledZ),W,this.tileID.canonical))return}else if(!p.filter(new Bt(this.tileID.overscaledZ),B))return;const Z=this.getId(B,D);for(let W=0;W<k.length;W++){const re=k[W];if(m&&m.indexOf(re)<0)continue;const oe=v[re];if(!oe)continue;let se={};Z&&A&&(se=A.getState(oe.sourceLayer||"_geojsonTileLayer",Z));const pe=we({},S[re]);pe.paint=vd(pe.paint,oe.paint,B,se,y),pe.layout=vd(pe.layout,oe.layout,B,se,y);const xe=!M||M(B,oe,se);if(!xe)continue;const ye=new _d(B,this.z,this.x,this.y,Z);ye.layer=pe;let Be=e[re];Be===void 0&&(Be=e[re]=[]),Be.push({featureIndex:c,feature:ye,intersectionZ:xe})}}lookupSymbolFeatures(e,r,a,c,p,m,y,v){const S={};this.loadVTLayers();const A=ja(p);for(const M of e)this.loadMatchingFeature(S,a,c,M,A,m,y,v,r);return S}hasLayer(e){for(const r of this.bucketLayerIDs)for(const a of r)if(e===a)return!0;return!1}getId(e,r){let a=e.id;return this.promoteId&&(a=e.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[r]],typeof a=="boolean"&&(a=Number(a))),a}}function vd(i,e,r,a,c){return je(i,(p,m)=>{const y=e instanceof Qa?e.get(m):null;return y&&y.evaluate?y.evaluate(r,a,c):y})}function bd(i){let e=1/0,r=1/0,a=-1/0,c=-1/0;for(const p of i)e=Math.min(e,p.x),r=Math.min(r,p.y),a=Math.max(a,p.x),c=Math.max(c,p.y);return{minX:e,minY:r,maxX:a,maxY:c}}function kg(i,e){return e-i}var uh;Re("FeatureIndex",xd,{omit:["rawTileData","sourceLayerCoder"]}),o.PerformanceMarkers=void 0,(uh=o.PerformanceMarkers||(o.PerformanceMarkers={})).create="create",uh.load="load",uh.fullLoad="fullLoad";let Ol=null,bo=[];const dh=1e3/30,Lg={mark(i){performance.mark(i)},frame(i){const e=i;Ol!=null&&bo.push(e-Ol),Ol=e},clearMetrics(){Ol=null,bo=[],performance.clearMeasures("loadTime"),performance.clearMeasures("fullLoadTime");for(const i in o.PerformanceMarkers)performance.clearMarks(o.PerformanceMarkers[i])},getPerformanceMetrics(){performance.measure("loadTime",o.PerformanceMarkers.create,o.PerformanceMarkers.load),performance.measure("fullLoadTime",o.PerformanceMarkers.create,o.PerformanceMarkers.fullLoad);const i=performance.getEntriesByName("loadTime")[0].duration,e=performance.getEntriesByName("fullLoadTime")[0].duration,r=bo.length,a=1/(bo.reduce((p,m)=>p+m,0)/r/1e3),c=bo.filter(p=>p>dh).reduce((p,m)=>p+(m-dh)/dh,0);return{loadTime:i,fullLoadTime:e,fps:a,percentDroppedFrames:c/(r+c)*100}}};o.AJAXError=si,o.ARRAY_TYPE=as,o.Actor=class{constructor(i,e,r){this.target=i,this.parent=e,this.mapId=r,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},Ve(["receive","process"],this),this.invoker=new zg(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=$t()?i:window}send(i,e,r,a,c=!1){const p=Math.round(1e18*Math.random()).toString(36).substring(0,10);r&&(this.callbacks[p]=r);const m=Zn(this.globalScope)?void 0:[];return this.target.postMessage({id:p,type:i,hasCallback:!!r,targetMapId:a,mustQueue:c,sourceMapId:this.mapId,data:ca(e,m)},m),{cancel:()=>{r&&delete this.callbacks[p],this.target.postMessage({id:p,type:"<cancel>",targetMapId:a,sourceMapId:this.mapId})}}}receive(i){const e=i.data,r=e.id;if(r&&(!e.targetMapId||this.mapId===e.targetMapId))if(e.type==="<cancel>"){delete this.tasks[r];const a=this.cancelCallbacks[r];delete this.cancelCallbacks[r],a&&a()}else $t()||e.mustQueue?(this.tasks[r]=e,this.taskQueue.push(r),this.invoker.trigger()):this.processTask(r,e)}process(){if(!this.taskQueue.length)return;const i=this.taskQueue.shift(),e=this.tasks[i];delete this.tasks[i],this.taskQueue.length&&this.invoker.trigger(),e&&this.processTask(i,e)}processTask(i,e){if(e.type==="<response>"){const r=this.callbacks[i];delete this.callbacks[i],r&&(e.error?r(on(e.error)):r(null,on(e.data)))}else{let r=!1;const a=Zn(this.globalScope)?void 0:[],c=e.hasCallback?(y,v)=>{r=!0,delete this.cancelCallbacks[i],this.target.postMessage({id:i,type:"<response>",sourceMapId:this.mapId,error:y?ca(y):null,data:ca(v,a)},a)}:y=>{r=!0};let p=null;const m=on(e.data);if(this.parent[e.type])p=this.parent[e.type](e.sourceMapId,m,c);else if(this.parent.getWorkerSource){const y=e.type.split(".");p=this.parent.getWorkerSource(e.sourceMapId,y[0],m.source)[y[1]](m,c)}else c(new Error(`Could not find function ${e.type}`));!r&&p&&p.cancel&&(this.cancelCallbacks[i]=p.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}},o.AlphaImage=ho,o.CanonicalTileID=hh,o.CollisionBoxArray=ce,o.CollisionCircleLayoutArray=class extends E{},o.Color=C,o.DEMData=gd,o.DataConstantProperty=Ue,o.DictionaryCoder=yd,o.EXTENT=ai,o.ErrorEvent=Xr,o.EvaluationParameters=Bt,o.Event=Br,o.Evented=Yn,o.FeatureIndex=xd,o.FillBucket=Wc,o.FillExtrusionBucket=Xc,o.GeoJSONFeature=_d,o.ImageAtlas=Gu,o.ImagePosition=Qc,o.LineBucket=Yc,o.LineStripIndexArray=class extends ne{},o.LngLat=Zt,o.LngLatBounds=xa,o.MercatorCoordinate=Fl,o.ONE_EM=di,o.OverscaledTileID=dr,o.PerformanceUtils=Lg,o.PosArray=class extends Dn{},o.Properties=ri,o.QuadTriangleArray=class extends L{},o.RGBAImage=ir,o.RasterBoundsArray=class extends fa{},o.RequestPerformance=class{constructor(i){this._marks={start:[i.url,"start"].join("#"),end:[i.url,"end"].join("#"),measure:i.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let i=performance.getEntriesByName(this._marks.measure);return i.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),i=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),i}},o.ResourceType=Ia,o.SegmentVector=xt,o.SymbolBucket=ds,o.Transitionable=no,o.TriangleIndexArray=Ci,o.Uniform1f=Rn,o.Uniform1i=class extends ur{constructor(i,e){super(i,e),this.current=0}set(i){this.current!==i&&(this.current=i,this.gl.uniform1i(this.location,i))}},o.Uniform2f=class extends ur{constructor(i,e){super(i,e),this.current=[0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]||(this.current=i,this.gl.uniform2f(this.location,i[0],i[1]))}},o.Uniform3f=class extends ur{constructor(i,e){super(i,e),this.current=[0,0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]&&i[2]===this.current[2]||(this.current=i,this.gl.uniform3f(this.location,i[0],i[1],i[2]))}},o.Uniform4f=ou,o.UniformColor=lu,o.UniformMatrix4f=class extends ur{constructor(i,e){super(i,e),this.current=ef}set(i){if(i[12]!==this.current[12]||i[0]!==this.current[0])return this.current=i,void this.gl.uniformMatrix4fv(this.location,!1,i);for(let e=1;e<16;e++)if(i[e]!==this.current[e]){this.current=i,this.gl.uniformMatrix4fv(this.location,!1,i);break}}},o.UnwrappedTileID=fd,o.ValidationError=Ae,o.ZoomHistory=ha,o.addDynamicAttributes=nh,o.asyncAll=function(i,e,r){if(!i.length)return r(null,[]);let a=i.length;const c=new Array(i.length);let p=null;i.forEach((m,y)=>{e(m,(v,S)=>{v&&(p=v),c[y]=S,--a==0&&r(p,c)})})},o.bezier=ge,o.bindAll=Ve,o.cacheEntryPossiblyAdded=function(i){Zr++,Zr>xr&&(i.getActor().send("enforceCacheSizeLimit",jr),Zr=0)},o.clamp=H,o.clearTileCache=function(i){const e=caches.delete(Lr);i&&e.catch(i).then(()=>i())},o.clipLine=td,o.clone=function(i){var e=new as(16);return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],e},o.clone$1=We,o.collisionCircleLayout=Kf,o.config=kr,o.create=function(){var i=new as(16);return as!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=0,i[12]=0,i[13]=0,i[14]=0),i[0]=1,i[5]=1,i[10]=1,i[15]=1,i},o.createExpression=$a,o.createFilter=ja,o.createLayout=ni,o.createStyleLayer=function(i){return i.type==="custom"?new Mg(i):new Pg[i.type](i)},o.dot=function(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]+i[3]*e[3]},o.ease=ae,o.emitValidationErrors=hl,o.enforceCacheSizeLimit=function(i){Dr(),Xi&&Xi.then(e=>{e.keys().then(r=>{for(let a=0;a<r.length-i;a++)e.delete(r[a])})})},o.evaluateSizeForFeature=function(i,{uSize:e,uSizeT:r},{lowerSize:a,upperSize:c}){return i.kind==="source"?a/mn:i.kind==="composite"?Kt(a/mn,c/mn,r):e},o.evaluateSizeForZoom=function(i,e){let r=0,a=0;if(i.kind==="constant")a=i.layoutSize;else if(i.kind!=="source"){const{interpolationType:c,minZoom:p,maxZoom:m}=i,y=c?H(Pi.interpolationFactor(c,e,p,m),0,1):0;i.kind==="camera"?a=Kt(i.minSize,i.maxSize,y):r=y}return{uSizeT:r,uSize:a}},o.evaluateVariableOffset=nd,o.evented=Ln,o.exported=Gr,o.exported$1=Yi,o.extend=we,o.filterObject=Ge,o.getAnchorAlignment=th,o.getAnchorJustification=rh,o.getArrayBuffer=ar,o.getImage=Xn,o.getJSON=function(i,e){return Wr(we(i,{type:"json"}),e)},o.getOverlapMode=lh,o.getRTLTextPluginStatus=ro,o.getReferrer=Rr,o.getVideo=function(i,e){const r=window.document.createElement("video");r.muted=!0,r.onloadstart=function(){e(null,r)};for(let a=0;a<i.length;a++){const c=window.document.createElement("source");Ea(i[a])||(r.crossOrigin="Anonymous"),c.src=i[a],r.appendChild(c)}return{cancel:()=>{}}},o.identity=Fc,o.invert=function(i,e){var r=e[0],a=e[1],c=e[2],p=e[3],m=e[4],y=e[5],v=e[6],S=e[7],A=e[8],M=e[9],k=e[10],D=e[11],B=e[12],Z=e[13],W=e[14],re=e[15],oe=r*y-a*m,se=r*v-c*m,pe=r*S-p*m,xe=a*v-c*y,ye=a*S-p*y,Be=c*S-p*v,qe=A*Z-M*B,Me=A*W-k*B,Pe=A*re-D*B,Te=M*W-k*Z,De=M*re-D*Z,ze=k*re-D*W,be=oe*ze-se*De+pe*Te+xe*Pe-ye*Me+Be*qe;return be?(i[0]=(y*ze-v*De+S*Te)*(be=1/be),i[1]=(c*De-a*ze-p*Te)*be,i[2]=(Z*Be-W*ye+re*xe)*be,i[3]=(k*ye-M*Be-D*xe)*be,i[4]=(v*Pe-m*ze-S*Me)*be,i[5]=(r*ze-c*Pe+p*Me)*be,i[6]=(W*pe-B*Be-re*se)*be,i[7]=(A*Be-k*pe+D*se)*be,i[8]=(m*De-y*Pe+S*qe)*be,i[9]=(a*Pe-r*De-p*qe)*be,i[10]=(B*ye-Z*pe+re*oe)*be,i[11]=(M*pe-A*ye-D*oe)*be,i[12]=(y*Me-m*Te-v*qe)*be,i[13]=(r*Te-a*Me+c*qe)*be,i[14]=(Z*se-B*xe-W*oe)*be,i[15]=(A*xe-M*se+k*oe)*be,i):null},o.isImageBitmap=yr,o.isSafari=Zn,o.keysDifference=function(i,e){const r=[];for(const a in i)a in e||r.push(a);return r},o.lazyLoadRTLTextPlugin=function(){Vi.isLoading()||Vi.isLoaded()||ro()!=="deferred"||Ya()},o.makeRequest=Wr,o.mapObject=je,o.mercatorXfromLng=ud,o.mercatorYfromLat=dd,o.mercatorZfromAltitude=pd,o.mul=cf,o.multiply=gu,o.nextPowerOfTwo=function(i){return i<=1?1:Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))},o.number=Kt,o.ortho=function(i,e,r,a,c,p,m){var y=1/(e-r),v=1/(a-c),S=1/(p-m);return i[0]=-2*y,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=-2*v,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=2*S,i[11]=0,i[12]=(e+r)*y,i[13]=(c+a)*v,i[14]=(m+p)*S,i[15]=1,i},o.parseCacheControl=Ui,o.parseGlyphPBF=function(i){return new Kc(i).readFields(lg,[])},o.pbf=Kc,o.performSymbolLayout=function(i,e,r,a,c,p,m){i.createArrays(),i.tilePixelRatio=ai/(512*i.overscaling),i.compareText={},i.iconsNeedLinear=!1;const y=i.layers[0].layout,v=i.layers[0]._unevaluatedLayout._values,S={layoutIconSize:v["icon-size"].possiblyEvaluate(new Bt(i.zoom+1),m),layoutTextSize:v["text-size"].possiblyEvaluate(new Bt(i.zoom+1),m),textMaxSize:v["text-size"].possiblyEvaluate(new Bt(18))};if(i.textSizeData.kind==="composite"){const{minZoom:B,maxZoom:Z}=i.textSizeData;S.compositeTextSizes=[v["text-size"].possiblyEvaluate(new Bt(B),m),v["text-size"].possiblyEvaluate(new Bt(Z),m)]}if(i.iconSizeData.kind==="composite"){const{minZoom:B,maxZoom:Z}=i.iconSizeData;S.compositeIconSizes=[v["icon-size"].possiblyEvaluate(new Bt(B),m),v["icon-size"].possiblyEvaluate(new Bt(Z),m)]}const A=y.get("text-line-height")*di,M=y.get("text-rotation-alignment")!=="viewport"&&y.get("symbol-placement")!=="point",k=y.get("text-keep-upright"),D=y.get("text-size");for(const B of i.features){const Z=y.get("text-font").evaluate(B,{},m).join(","),W=D.evaluate(B,{},m),re=S.layoutTextSize.evaluate(B,{},m),oe=S.layoutIconSize.evaluate(B,{},m),se={horizontal:{},vertical:void 0},pe=B.text;let xe,ye=[0,0];if(pe){const Me=pe.toString(),Pe=y.get("text-letter-spacing").evaluate(B,{},m)*di,Te=ul(Me)?Pe:0,De=y.get("text-anchor").evaluate(B,{},m),ze=y.get("text-variable-anchor");if(!ze){const wt=y.get("text-radial-offset").evaluate(B,{},m);ye=wt?nd(De,[wt*di,ih]):y.get("text-offset").evaluate(B,{},m).map(Ot=>Ot*di)}let be=M?"center":y.get("text-justify").evaluate(B,{},m);const Ye=y.get("symbol-placement"),Ze=Ye==="point"?y.get("text-max-width").evaluate(B,{},m)*di:0,pt=()=>{i.allowVerticalPlacement&&Js(Me)&&(se.vertical=Ml(pe,e,r,c,Z,Ze,A,De,"left",Te,ye,o.WritingMode.vertical,!0,Ye,re,W))};if(!M&&ze){const wt=be==="auto"?ze.map(Ut=>rh(Ut)):[be];let Ot=!1;for(let Ut=0;Ut<wt.length;Ut++){const pi=wt[Ut];if(!se.horizontal[pi])if(Ot)se.horizontal[pi]=se.horizontal[0];else{const Qt=Ml(pe,e,r,c,Z,Ze,A,"center",pi,Te,ye,o.WritingMode.horizontal,!1,Ye,re,W);Qt&&(se.horizontal[pi]=Qt,Ot=Qt.positionedLines.length===1)}}pt()}else{be==="auto"&&(be=rh(De));const wt=Ml(pe,e,r,c,Z,Ze,A,De,be,Te,ye,o.WritingMode.horizontal,!1,Ye,re,W);wt&&(se.horizontal[be]=wt),pt(),Js(Me)&&M&&k&&(se.vertical=Ml(pe,e,r,c,Z,Ze,A,De,be,Te,ye,o.WritingMode.vertical,!1,Ye,re,W))}}let Be=!1;if(B.icon&&B.icon.name){const Me=a[B.icon.name];Me&&(xe=mg(c[B.icon.name],y.get("icon-offset").evaluate(B,{},m),y.get("icon-anchor").evaluate(B,{},m)),Be=!!Me.sdf,i.sdfIcons===void 0?i.sdfIcons=Be:i.sdfIcons!==Be&&gt("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(Me.pixelRatio!==i.pixelRatio||y.get("icon-rotate").constantOr(1)!==0)&&(i.iconsNeedLinear=!0))}const qe=sd(se.horizontal)||se.vertical;i.iconsInText=!!qe&&qe.iconsInText,(qe||xe)&&bg(i,B,se,xe,a,S,re,oe,ye,Be,m)}p&&i.generateCollisionDebugBuffers()},o.perspective=function(i,e,r,a,c){var p,m=1/Math.tan(e/2);return i[0]=m/r,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=m,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=-1,i[12]=0,i[13]=0,i[15]=0,c!=null&&c!==1/0?(i[10]=(c+a)*(p=1/(a-c)),i[14]=2*c*a*p):(i[10]=-1,i[14]=-2*a),i},o.pick=function(i,e){const r={};for(let a=0;a<e.length;a++){const c=e[a];c in i&&(r[c]=i[c])}return r},o.plugin=Vi,o.pointGeometry=Ke,o.polygonIntersectsPolygon=du,o.potpack=Vu,o.refProperties=["type","source","source-layer","minzoom","maxzoom","filter","layout"],o.register=Re,o.registerForPluginStateChange=function(i){return i({pluginStatus:Ei,pluginURL:Fr}),Ln.on("pluginStateChange",i),i},o.renderColorRamp=vu,o.rotateX=function(i,e,r){var a=Math.sin(r),c=Math.cos(r),p=e[4],m=e[5],y=e[6],v=e[7],S=e[8],A=e[9],M=e[10],k=e[11];return e!==i&&(i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15]),i[4]=p*c+S*a,i[5]=m*c+A*a,i[6]=y*c+M*a,i[7]=v*c+k*a,i[8]=S*c-p*a,i[9]=A*c-m*a,i[10]=M*c-y*a,i[11]=k*c-v*a,i},o.rotateZ=function(i,e,r){var a=Math.sin(r),c=Math.cos(r),p=e[0],m=e[1],y=e[2],v=e[3],S=e[4],A=e[5],M=e[6],k=e[7];return e!==i&&(i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15]),i[0]=p*c+S*a,i[1]=m*c+A*a,i[2]=y*c+M*a,i[3]=v*c+k*a,i[4]=S*c-p*a,i[5]=A*c-m*a,i[6]=M*c-y*a,i[7]=k*c-v*a,i},o.scale=function(i,e,r){var a=r[0],c=r[1],p=r[2];return i[0]=e[0]*a,i[1]=e[1]*a,i[2]=e[2]*a,i[3]=e[3]*a,i[4]=e[4]*c,i[5]=e[5]*c,i[6]=e[6]*c,i[7]=e[7]*c,i[8]=e[8]*p,i[9]=e[9]*p,i[10]=e[10]*p,i[11]=e[11]*p,i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i},o.scale$1=function(i,e,r){return i[0]=e[0]*r,i[1]=e[1]*r,i[2]=e[2]*r,i[3]=e[3]*r,i},o.setCacheLimits=function(i,e){jr=i,xr=e},o.setRTLTextPlugin=function(i,e,r=!1){if(Ei===Xa||Ei===Qs||Ei===eo)throw new Error("setRTLTextPlugin cannot be called multiple times.");Fr=Gr.resolveURL(i),Ei=Xa,to=e,io(),r||Ya()},o.spec=de,o.sphericalToCartesian=function([i,e,r]){return e+=90,e*=Math.PI/180,r*=Math.PI/180,{x:i*Math.cos(e)*Math.sin(r),y:i*Math.sin(e)*Math.sin(r),z:i*Math.cos(r)}},o.toEvaluationFeature=_a,o.transformMat4=wl,o.translate=function(i,e,r){var a,c,p,m,y,v,S,A,M,k,D,B,Z=r[0],W=r[1],re=r[2];return e===i?(i[12]=e[0]*Z+e[4]*W+e[8]*re+e[12],i[13]=e[1]*Z+e[5]*W+e[9]*re+e[13],i[14]=e[2]*Z+e[6]*W+e[10]*re+e[14],i[15]=e[3]*Z+e[7]*W+e[11]*re+e[15]):(c=e[1],p=e[2],m=e[3],y=e[4],v=e[5],S=e[6],A=e[7],M=e[8],k=e[9],D=e[10],B=e[11],i[0]=a=e[0],i[1]=c,i[2]=p,i[3]=m,i[4]=y,i[5]=v,i[6]=S,i[7]=A,i[8]=M,i[9]=k,i[10]=D,i[11]=B,i[12]=a*Z+y*W+M*re+e[12],i[13]=c*Z+v*W+k*re+e[13],i[14]=p*Z+S*W+D*re+e[14],i[15]=m*Z+A*W+B*re+e[15]),i},o.triggerPluginCompletionEvent=ml,o.unicodeBlockLookup=Ee,o.uniqueId=function(){return $e++},o.validateCustomStyleLayer=function(i){const e=[],r=i.id;return r===void 0&&e.push({message:`layers.${r}: missing required property "id"`}),i.render===void 0&&e.push({message:`layers.${r}: missing required method "render"`}),i.renderingMode&&i.renderingMode!=="2d"&&i.renderingMode!=="3d"&&e.push({message:`layers.${r}: property "renderingMode" must be either "2d" or "3d"`}),e},o.validateLight=Ic,o.validateStyle=an,o.vectorTile=On,o.warnOnce=gt,o.wrap=ke}),z(["./shared"],function(o){function G($){const T=typeof $;if(T==="number"||T==="boolean"||T==="string"||$==null)return JSON.stringify($);if(Array.isArray($)){let N="[";for(const V of $)N+=`${G(V)},`;return`${N}]`}const C=Object.keys($).sort();let F="{";for(let N=0;N<C.length;N++)F+=`${JSON.stringify(C[N])}:${G($[C[N]])},`;return`${F}}`}function K($){let T="";for(const C of o.refProperties)T+=`/${G($[C])}`;return T}class ge{constructor(T){this.keyCache={},T&&this.replace(T)}replace(T){this._layerConfigs={},this._layers={},this.update(T,[])}update(T,C){for(const N of T){this._layerConfigs[N.id]=N;const V=this._layers[N.id]=o.createStyleLayer(N);V._featureFilter=o.createFilter(V.filter),this.keyCache[N.id]&&delete this.keyCache[N.id]}for(const N of C)delete this.keyCache[N],delete this._layerConfigs[N],delete this._layers[N];this.familiesBySource={};const F=function(N,V){const J={};for(let Y=0;Y<N.length;Y++){const Q=V&&V[N[Y].id]||K(N[Y]);V&&(V[N[Y].id]=Q);let he=J[Q];he||(he=J[Q]=[]),he.push(N[Y])}const X=[];for(const Y in J)X.push(J[Y]);return X}(Object.values(this._layerConfigs),this.keyCache);for(const N of F){const V=N.map(_e=>this._layers[_e.id]),J=V[0];if(J.visibility==="none")continue;const X=J.source||"";let Y=this.familiesBySource[X];Y||(Y=this.familiesBySource[X]={});const Q=J.sourceLayer||"_geojsonTileLayer";let he=Y[Q];he||(he=Y[Q]=[]),he.push(V)}}}class ae{constructor(T){const C={},F=[];for(const X in T){const Y=T[X],Q=C[X]={};for(const he in Y){const _e=Y[+he];if(!_e||_e.bitmap.width===0||_e.bitmap.height===0)continue;const le={x:0,y:0,w:_e.bitmap.width+2,h:_e.bitmap.height+2};F.push(le),Q[he]={rect:le,metrics:_e.metrics}}}const{w:N,h:V}=o.potpack(F),J=new o.AlphaImage({width:N||1,height:V||1});for(const X in T){const Y=T[X];for(const Q in Y){const he=Y[+Q];if(!he||he.bitmap.width===0||he.bitmap.height===0)continue;const _e=C[X][Q].rect;o.AlphaImage.copy(he.bitmap,J,{x:0,y:0},{x:_e.x+1,y:_e.y+1},he.bitmap)}}this.image=J,this.positions=C}}o.register("GlyphAtlas",ae);class H{constructor(T){this.tileID=new o.OverscaledTileID(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}parse(T,C,F,N,V){this.status="parsing",this.data=T,this.collisionBoxArray=new o.CollisionBoxArray;const J=new o.DictionaryCoder(Object.keys(T.layers).sort()),X=new o.FeatureIndex(this.tileID,this.promoteId);X.bucketLayerIDs=[];const Y={},Q={featureIndex:X,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:F},he=C.familiesBySource[this.source];for(const lt in he){const at=T.layers[lt];if(!at)continue;at.version===1&&o.warnOnce(`Vector tile source "${this.source}" layer "${lt}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const it=J.encode(lt),Wt=[];for(let qt=0;qt<at.length;qt++){const oi=at.feature(qt),hi=X.getId(oi,lt);Wt.push({feature:oi,id:hi,index:qt,sourceLayerIndex:it})}for(const qt of he[lt]){const oi=qt[0];oi.minzoom&&this.zoom<Math.floor(oi.minzoom)||oi.maxzoom&&this.zoom>=oi.maxzoom||oi.visibility!=="none"&&(ke(qt,this.zoom,F),(Y[oi.id]=oi.createBucket({index:X.bucketLayerIDs.length,layers:qt,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:it,sourceID:this.source})).populate(Wt,Q,this.tileID.canonical),X.bucketLayerIDs.push(qt.map(hi=>hi.id)))}}let _e,le,Oe,Le;const Ne=o.mapObject(Q.glyphDependencies,lt=>Object.keys(lt).map(Number));Object.keys(Ne).length?N.send("getGlyphs",{uid:this.uid,stacks:Ne},(lt,at)=>{_e||(_e=lt,le=at,ut.call(this))}):le={};const He=Object.keys(Q.iconDependencies);He.length?N.send("getImages",{icons:He,source:this.source,tileID:this.tileID,type:"icons"},(lt,at)=>{_e||(_e=lt,Oe=at,ut.call(this))}):Oe={};const yt=Object.keys(Q.patternDependencies);function ut(){if(_e)return V(_e);if(le&&Oe&&Le){const lt=new ae(le),at=new o.ImageAtlas(Oe,Le);for(const it in Y){const Wt=Y[it];Wt instanceof o.SymbolBucket?(ke(Wt.layers,this.zoom,F),o.performSymbolLayout(Wt,le,lt.positions,Oe,at.iconPositions,this.showCollisionBoxes,this.tileID.canonical)):Wt.hasPattern&&(Wt instanceof o.LineBucket||Wt instanceof o.FillBucket||Wt instanceof o.FillExtrusionBucket)&&(ke(Wt.layers,this.zoom,F),Wt.addFeatures(Q,this.tileID.canonical,at.patternPositions))}this.status="done",V(null,{buckets:Object.values(Y).filter(it=>!it.isEmpty()),featureIndex:X,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:lt.image,imageAtlas:at,glyphMap:this.returnDependencies?le:null,iconMap:this.returnDependencies?Oe:null,glyphPositions:this.returnDependencies?lt.positions:null})}}yt.length?N.send("getImages",{icons:yt,source:this.source,tileID:this.tileID,type:"patterns"},(lt,at)=>{_e||(_e=lt,Le=at,ut.call(this))}):Le={},ut.call(this)}}function ke($,T,C){const F=new o.EvaluationParameters(T);for(const N of $)N.recalculate(F,C)}function we($,T){const C=o.getArrayBuffer($.request,(F,N,V,J)=>{F?T(F):N&&T(null,{vectorTile:new o.vectorTile.VectorTile(new o.pbf(N)),rawData:N,cacheControl:V,expires:J})});return()=>{C.cancel(),T()}}class $e{constructor(T,C,F,N){this.actor=T,this.layerIndex=C,this.availableImages=F,this.loadVectorData=N||we,this.loading={},this.loaded={}}loadTile(T,C){const F=T.uid;this.loading||(this.loading={});const N=!!(T&&T.request&&T.request.collectResourceTiming)&&new o.RequestPerformance(T.request),V=this.loading[F]=new H(T);V.abort=this.loadVectorData(T,(J,X)=>{if(delete this.loading[F],J||!X)return V.status="done",this.loaded[F]=V,C(J);const Y=X.rawData,Q={};X.expires&&(Q.expires=X.expires),X.cacheControl&&(Q.cacheControl=X.cacheControl);const he={};if(N){const _e=N.finish();_e&&(he.resourceTiming=JSON.parse(JSON.stringify(_e)))}V.vectorTile=X.vectorTile,V.parse(X.vectorTile,this.layerIndex,this.availableImages,this.actor,(_e,le)=>{if(_e||!le)return C(_e);C(null,o.extend({rawTileData:Y.slice(0)},le,Q,he))}),this.loaded=this.loaded||{},this.loaded[F]=V})}reloadTile(T,C){const F=this.loaded,N=T.uid,V=this;if(F&&F[N]){const J=F[N];J.showCollisionBoxes=T.showCollisionBoxes;const X=(Y,Q)=>{const he=J.reloadCallback;he&&(delete J.reloadCallback,J.parse(J.vectorTile,V.layerIndex,this.availableImages,V.actor,he)),C(Y,Q)};J.status==="parsing"?J.reloadCallback=X:J.status==="done"&&(J.vectorTile?J.parse(J.vectorTile,this.layerIndex,this.availableImages,this.actor,X):X())}}abortTile(T,C){const F=this.loading,N=T.uid;F&&F[N]&&F[N].abort&&(F[N].abort(),delete F[N]),C()}removeTile(T,C){const F=this.loaded,N=T.uid;F&&F[N]&&delete F[N],C()}}class Ve{constructor(){this.loaded={}}loadTile(T,C){const{uid:F,encoding:N,rawImageData:V}=T,J=o.isImageBitmap(V)?this.getImageData(V):V,X=new o.DEMData(F,J,N);this.loaded=this.loaded||{},this.loaded[F]=X,C(null,X)}getImageData(T){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(T.width,T.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d")),this.offscreenCanvas.width=T.width,this.offscreenCanvas.height=T.height,this.offscreenCanvasContext.drawImage(T,0,0,T.width,T.height);const C=this.offscreenCanvasContext.getImageData(-1,-1,T.width+2,T.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new o.RGBAImage({width:C.width,height:C.height},C.data)}removeTile(T){const C=this.loaded,F=T.uid;C&&C[F]&&delete C[F]}}var je=function $(T,C){var F,N=T&&T.type;if(N==="FeatureCollection")for(F=0;F<T.features.length;F++)$(T.features[F],C);else if(N==="GeometryCollection")for(F=0;F<T.geometries.length;F++)$(T.geometries[F],C);else if(N==="Feature")$(T.geometry,C);else if(N==="Polygon")Ge(T.coordinates,C);else if(N==="MultiPolygon")for(F=0;F<T.coordinates.length;F++)Ge(T.coordinates[F],C);return T};function Ge($,T){if($.length!==0){We($[0],T);for(var C=1;C<$.length;C++)We($[C],!T)}}function We($,T){for(var C=0,F=0,N=0,V=$.length,J=V-1;N<V;J=N++){var X=($[N][0]-$[J][0])*($[J][1]+$[N][1]),Y=C+X;F+=Math.abs(C)>=Math.abs(X)?C-Y+X:X-Y+C,C=Y}C+F>=0!=!!T&&$.reverse()}const At=o.vectorTile.VectorTileFeature.prototype.toGeoJSON;class gt{constructor(T){this._feature=T,this.extent=o.EXTENT,this.type=T.type,this.properties=T.tags,"id"in T&&!isNaN(T.id)&&(this.id=parseInt(T.id,10))}loadGeometry(){if(this._feature.type===1){const T=[];for(const C of this._feature.geometry)T.push([new o.pointGeometry(C[0],C[1])]);return T}{const T=[];for(const C of this._feature.geometry){const F=[];for(const N of C)F.push(new o.pointGeometry(N[0],N[1]));T.push(F)}return T}}toGeoJSON(T,C,F){return At.call(this,T,C,F)}}class Qe{constructor(T){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=o.EXTENT,this.length=T.length,this._features=T}feature(T){return new gt(this._features[T])}}var Dt={exports:{}},$t=o.pointGeometry,Ui=o.vectorTile.VectorTileFeature,xn=Vr;function Vr($,T){this.options=T||{},this.features=$,this.length=$.length}function zr($,T){this.id=typeof $.id=="number"?$.id:void 0,this.type=$.type,this.rawGeometry=$.type===1?[$.geometry]:$.geometry,this.properties=$.tags,this.extent=T||4096}Vr.prototype.feature=function($){return new zr(this.features[$],this.options.extent)},zr.prototype.loadGeometry=function(){var $=this.rawGeometry;this.geometry=[];for(var T=0;T<$.length;T++){for(var C=$[T],F=[],N=0;N<C.length;N++)F.push(new $t(C[N][0],C[N][1]));this.geometry.push(F)}return this.geometry},zr.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var $=this.geometry,T=1/0,C=-1/0,F=1/0,N=-1/0,V=0;V<$.length;V++)for(var J=$[V],X=0;X<J.length;X++){var Y=J[X];T=Math.min(T,Y.x),C=Math.max(C,Y.x),F=Math.min(F,Y.y),N=Math.max(N,Y.y)}return[T,F,C,N]},zr.prototype.toGeoJSON=Ui.prototype.toGeoJSON;var Zn=o.pbf,yr=xn;function Gr($){var T=new Zn;return function(C,F){for(var N in C.layers)F.writeMessage(3,Ke,C.layers[N])}($,T),T.finish()}function Ke($,T){var C;T.writeVarintField(15,$.version||1),T.writeStringField(1,$.name||""),T.writeVarintField(5,$.extent||4096);var F={keys:[],values:[],keycache:{},valuecache:{}};for(C=0;C<$.length;C++)F.feature=$.feature(C),T.writeMessage(2,_r,F);var N=F.keys;for(C=0;C<N.length;C++)T.writeStringField(3,N[C]);var V=F.values;for(C=0;C<V.length;C++)T.writeMessage(4,jr,V[C])}function _r($,T){var C=$.feature;C.id!==void 0&&T.writeVarintField(1,C.id),T.writeMessage(2,kr,$),T.writeVarintField(3,C.type),T.writeMessage(4,qr,C)}function kr($,T){var C=$.feature,F=$.keys,N=$.values,V=$.keycache,J=$.valuecache;for(var X in C.properties){var Y=C.properties[X],Q=V[X];if(Y!==null){Q===void 0&&(F.push(X),V[X]=Q=F.length-1),T.writeVarint(Q);var he=typeof Y;he!=="string"&&he!=="boolean"&&he!=="number"&&(Y=JSON.stringify(Y));var _e=he+":"+Y,le=J[_e];le===void 0&&(N.push(Y),J[_e]=le=N.length-1),T.writeVarint(le)}}}function Lr($,T){return(T<<3)+(7&$)}function Xi($){return $<<1^$>>31}function qr($,T){for(var C=$.loadGeometry(),F=$.type,N=0,V=0,J=C.length,X=0;X<J;X++){var Y=C[X],Q=1;F===1&&(Q=Y.length),T.writeVarint(Lr(1,Q));for(var he=F===3?Y.length-1:Y.length,_e=0;_e<he;_e++){_e===1&&F!==1&&T.writeVarint(Lr(2,he-1));var le=Y[_e].x-N,Oe=Y[_e].y-V;T.writeVarint(Xi(le)),T.writeVarint(Xi(Oe)),N+=le,V+=Oe}F===3&&T.writeVarint(Lr(7,1))}}function jr($,T){var C=typeof $;C==="string"?T.writeStringField(1,$):C==="boolean"?T.writeBooleanField(7,$):C==="number"&&($%1!=0?T.writeDoubleField(3,$):$<0?T.writeSVarintField(6,$):T.writeVarintField(5,$))}Dt.exports=Gr,Dt.exports.fromVectorTileJs=Gr,Dt.exports.fromGeojsonVt=function($,T){T=T||{};var C={};for(var F in $)C[F]=new yr($[F].features,T),C[F].name=F,C[F].version=T.version,C[F].extent=T.extent;return Gr({layers:C})},Dt.exports.GeoJSONWrapper=yr;var xr=Dt.exports;function Dr($,T,C,F,N,V){if(N-F<=C)return;const J=F+N>>1;Zr($,T,J,F,N,V%2),Dr($,T,C,F,J-1,V+1),Dr($,T,C,J+1,N,V+1)}function Zr($,T,C,F,N,V){for(;N>F;){if(N-F>600){const Q=N-F+1,he=C-F+1,_e=Math.log(Q),le=.5*Math.exp(2*_e/3),Oe=.5*Math.sqrt(_e*le*(Q-le)/Q)*(he-Q/2<0?-1:1);Zr($,T,C,Math.max(F,Math.floor(C-he*le/Q+Oe)),Math.min(N,Math.floor(C+(Q-he)*le/Q+Oe)),V)}const J=T[2*C+V];let X=F,Y=N;for(Yi($,T,F,C),T[2*N+V]>J&&Yi($,T,F,N);X<Y;){for(Yi($,T,X,Y),X++,Y--;T[2*X+V]<J;)X++;for(;T[2*Y+V]>J;)Y--}T[2*F+V]===J?Yi($,T,F,Y):(Y++,Yi($,T,Y,N)),Y<=C&&(F=Y+1),C<=Y&&(N=Y-1)}}function Yi($,T,C,F){vr($,C,F),vr(T,2*C,2*F),vr(T,2*C+1,2*F+1)}function vr($,T,C){const F=$[T];$[T]=$[C],$[C]=F}function br($,T,C,F){const N=$-C,V=T-F;return N*N+V*V}const vn=$=>$[0],Ta=$=>$[1];class Wn{constructor(T,C=vn,F=Ta,N=64,V=Float64Array){this.nodeSize=N,this.points=T;const J=T.length<65536?Uint16Array:Uint32Array,X=this.ids=new J(T.length),Y=this.coords=new V(2*T.length);for(let Q=0;Q<T.length;Q++)X[Q]=Q,Y[2*Q]=C(T[Q]),Y[2*Q+1]=F(T[Q]);Dr(X,Y,N,0,X.length-1,0)}range(T,C,F,N){return function(V,J,X,Y,Q,he,_e){const le=[0,V.length-1,0],Oe=[];let Le,Ne;for(;le.length;){const He=le.pop(),yt=le.pop(),ut=le.pop();if(yt-ut<=_e){for(let it=ut;it<=yt;it++)Le=J[2*it],Ne=J[2*it+1],Le>=X&&Le<=Q&&Ne>=Y&&Ne<=he&&Oe.push(V[it]);continue}const lt=Math.floor((ut+yt)/2);Le=J[2*lt],Ne=J[2*lt+1],Le>=X&&Le<=Q&&Ne>=Y&&Ne<=he&&Oe.push(V[lt]);const at=(He+1)%2;(He===0?X<=Le:Y<=Ne)&&(le.push(ut),le.push(lt-1),le.push(at)),(He===0?Q>=Le:he>=Ne)&&(le.push(lt+1),le.push(yt),le.push(at))}return Oe}(this.ids,this.coords,T,C,F,N,this.nodeSize)}within(T,C,F){return function(N,V,J,X,Y,Q){const he=[0,N.length-1,0],_e=[],le=Y*Y;for(;he.length;){const Oe=he.pop(),Le=he.pop(),Ne=he.pop();if(Le-Ne<=Q){for(let at=Ne;at<=Le;at++)br(V[2*at],V[2*at+1],J,X)<=le&&_e.push(N[at]);continue}const He=Math.floor((Ne+Le)/2),yt=V[2*He],ut=V[2*He+1];br(yt,ut,J,X)<=le&&_e.push(N[He]);const lt=(Oe+1)%2;(Oe===0?J-Y<=yt:X-Y<=ut)&&(he.push(Ne),he.push(He-1),he.push(lt)),(Oe===0?J+Y>=yt:X+Y>=ut)&&(he.push(He+1),he.push(Le),he.push(lt))}return _e}(this.ids,this.coords,T,C,F,this.nodeSize)}}const Ia={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:$=>$},si=Math.fround||(Rr=new Float32Array(1),$=>(Rr[0]=+$,Rr[0]));var Rr;class Hn{constructor(T){this.options=mt(Object.create(Ia),T),this.trees=new Array(this.options.maxZoom+1)}load(T){const{log:C,minZoom:F,maxZoom:N,nodeSize:V}=this.options;C&&console.time("total time");const J=`prepare ${T.length} points`;C&&console.time(J),this.points=T;let X=[];for(let Y=0;Y<T.length;Y++)T[Y].geometry&&X.push(ar(T[Y],Y));this.trees[N+1]=new Wn(X,Hr,Br,V,Float32Array),C&&console.timeEnd(J);for(let Y=N;Y>=F;Y--){const Q=+Date.now();X=this._cluster(X,Y),this.trees[Y]=new Wn(X,Hr,Br,V,Float32Array),C&&console.log("z%d: %d clusters in %dms",Y,X.length,+Date.now()-Q)}return C&&console.timeEnd("total time"),this}getClusters(T,C){let F=((T[0]+180)%360+360)%360-180;const N=Math.max(-90,Math.min(90,T[1]));let V=T[2]===180?180:((T[2]+180)%360+360)%360-180;const J=Math.max(-90,Math.min(90,T[3]));if(T[2]-T[0]>=360)F=-180,V=180;else if(F>V){const he=this.getClusters([F,N,180,J],C),_e=this.getClusters([-180,N,V,J],C);return he.concat(_e)}const X=this.trees[this._limitZoom(C)],Y=X.range(sr(F),or(J),sr(V),or(N)),Q=[];for(const he of Y){const _e=X.points[he];Q.push(_e.numPoints?Ea(_e):this.points[_e.index])}return Q}getChildren(T){const C=this._getOriginId(T),F=this._getOriginZoom(T),N="No cluster with the specified id.",V=this.trees[F];if(!V)throw new Error(N);const J=V.points[C];if(!J)throw new Error(N);const X=this.options.radius/(this.options.extent*Math.pow(2,F-1)),Y=V.within(J.x,J.y,X),Q=[];for(const he of Y){const _e=V.points[he];_e.parentId===T&&Q.push(_e.numPoints?Ea(_e):this.points[_e.index])}if(Q.length===0)throw new Error(N);return Q}getLeaves(T,C,F){const N=[];return this._appendLeaves(N,T,C=C||10,F=F||0,0),N}getTile(T,C,F){const N=this.trees[this._limitZoom(T)],V=Math.pow(2,T),{extent:J,radius:X}=this.options,Y=X/J,Q=(F-Y)/V,he=(F+1+Y)/V,_e={features:[]};return this._addTileFeatures(N.range((C-Y)/V,Q,(C+1+Y)/V,he),N.points,C,F,V,_e),C===0&&this._addTileFeatures(N.range(1-Y/V,Q,1,he),N.points,V,F,V,_e),C===V-1&&this._addTileFeatures(N.range(0,Q,Y/V,he),N.points,-1,F,V,_e),_e.features.length?_e:null}getClusterExpansionZoom(T){let C=this._getOriginZoom(T)-1;for(;C<=this.options.maxZoom;){const F=this.getChildren(T);if(C++,F.length!==1)break;T=F[0].properties.cluster_id}return C}_appendLeaves(T,C,F,N,V){const J=this.getChildren(C);for(const X of J){const Y=X.properties;if(Y&&Y.cluster?V+Y.point_count<=N?V+=Y.point_count:V=this._appendLeaves(T,Y.cluster_id,F,N,V):V<N?V++:T.push(X),T.length===F)break}return V}_addTileFeatures(T,C,F,N,V,J){for(const X of T){const Y=C[X],Q=Y.numPoints;let he,_e,le;if(Q)he=wr(Y),_e=Y.x,le=Y.y;else{const Ne=this.points[Y.index];he=Ne.properties,_e=sr(Ne.geometry.coordinates[0]),le=or(Ne.geometry.coordinates[1])}const Oe={type:1,geometry:[[Math.round(this.options.extent*(_e*V-F)),Math.round(this.options.extent*(le*V-N))]],tags:he};let Le;Q?Le=Y.id:this.options.generateId?Le=Y.index:this.points[Y.index].id&&(Le=this.points[Y.index].id),Le!==void 0&&(Oe.id=Le),J.features.push(Oe)}}_limitZoom(T){return Math.max(this.options.minZoom,Math.min(+T,this.options.maxZoom+1))}_cluster(T,C){const F=[],{radius:N,extent:V,reduce:J,minPoints:X}=this.options,Y=N/(V*Math.pow(2,C));for(let Q=0;Q<T.length;Q++){const he=T[Q];if(he.zoom<=C)continue;he.zoom=C;const _e=this.trees[C+1],le=_e.within(he.x,he.y,Y),Oe=he.numPoints||1;let Le=Oe;for(const Ne of le){const He=_e.points[Ne];He.zoom>C&&(Le+=He.numPoints||1)}if(Le>Oe&&Le>=X){let Ne=he.x*Oe,He=he.y*Oe,yt=J&&Oe>1?this._map(he,!0):null;const ut=(Q<<5)+(C+1)+this.points.length;for(const lt of le){const at=_e.points[lt];if(at.zoom<=C)continue;at.zoom=C;const it=at.numPoints||1;Ne+=at.x*it,He+=at.y*it,at.parentId=ut,J&&(yt||(yt=this._map(he,!0)),J(yt,this._map(at)))}he.parentId=ut,F.push(Wr(Ne/Le,He/Le,ut,Le,yt))}else if(F.push(he),Le>1)for(const Ne of le){const He=_e.points[Ne];He.zoom<=C||(He.zoom=C,F.push(He))}}return F}_getOriginId(T){return T-this.points.length>>5}_getOriginZoom(T){return(T-this.points.length)%32}_map(T,C){if(T.numPoints)return C?mt({},T.properties):T.properties;const F=this.points[T.index].properties,N=this.options.map(F);return C&&N===F?mt({},N):N}}function Wr($,T,C,F,N){return{x:si($),y:si(T),zoom:1/0,id:C,parentId:-1,numPoints:F,properties:N}}function ar($,T){const[C,F]=$.geometry.coordinates;return{x:si(sr(C)),y:si(or(F)),zoom:1/0,index:T,parentId:-1}}function Ea($){return{type:"Feature",id:$.id,properties:wr($),geometry:{type:"Point",coordinates:[(T=$.x,360*(T-.5)),Xn($.y)]}};var T}function wr($){const T=$.numPoints,C=T>=1e4?`${Math.round(T/1e3)}k`:T>=1e3?Math.round(T/100)/10+"k":T;return mt(mt({},$.properties),{cluster:!0,cluster_id:$.id,point_count:T,point_count_abbreviated:C})}function sr($){return $/360+.5}function or($){const T=Math.sin($*Math.PI/180),C=.5-.25*Math.log((1+T)/(1-T))/Math.PI;return C<0?0:C>1?1:C}function Xn($){const T=(180-360*$)*Math.PI/180;return 360*Math.atan(Math.exp(T))/Math.PI-90}function mt($,T){for(const C in T)$[C]=T[C];return $}function Hr($){return $.x}function Br($){return $.y}function Xr($,T,C,F){for(var N,V=F,J=C-T>>1,X=C-T,Y=$[T],Q=$[T+1],he=$[C],_e=$[C+1],le=T+3;le<C;le+=3){var Oe=Yn($[le],$[le+1],Y,Q,he,_e);if(Oe>V)N=le,V=Oe;else if(Oe===V){var Le=Math.abs(le-J);Le<X&&(N=le,X=Le)}}V>F&&(N-T>3&&Xr($,T,N,F),$[N+2]=V,C-N>3&&Xr($,N,C,F))}function Yn($,T,C,F,N,V){var J=N-C,X=V-F;if(J!==0||X!==0){var Y=(($-C)*J+(T-F)*X)/(J*J+X*X);Y>1?(C=N,F=V):Y>0&&(C+=J*Y,F+=X*Y)}return(J=$-C)*J+(X=T-F)*X}function de($,T,C,F){var N={id:$===void 0?null:$,type:T,geometry:C,tags:F,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(V){var J=V.geometry,X=V.type;if(X==="Point"||X==="MultiPoint"||X==="LineString")Ae(V,J);else if(X==="Polygon"||X==="MultiLineString")for(var Y=0;Y<J.length;Y++)Ae(V,J[Y]);else if(X==="MultiPolygon")for(Y=0;Y<J.length;Y++)for(var Q=0;Q<J[Y].length;Q++)Ae(V,J[Y][Q])}(N),N}function Ae($,T){for(var C=0;C<T.length;C+=3)$.minX=Math.min($.minX,T[C]),$.minY=Math.min($.minY,T[C+1]),$.maxX=Math.max($.maxX,T[C]),$.maxY=Math.max($.maxY,T[C+1])}function Yr($,T,C,F){if(T.geometry){var N=T.geometry.coordinates,V=T.geometry.type,J=Math.pow(C.tolerance/((1<<C.maxZoom)*C.extent),2),X=[],Y=T.id;if(C.promoteId?Y=T.properties[C.promoteId]:C.generateId&&(Y=F||0),V==="Point")Sr(N,X);else if(V==="MultiPoint")for(var Q=0;Q<N.length;Q++)Sr(N[Q],X);else if(V==="LineString")Ct(N,X,J,!1);else if(V==="MultiLineString"){if(C.lineMetrics){for(Q=0;Q<N.length;Q++)Ct(N[Q],X=[],J,!1),$.push(de(Y,"LineString",X,T.properties));return}$i(N,X,J,!1)}else if(V==="Polygon")$i(N,X,J,!0);else{if(V!=="MultiPolygon"){if(V==="GeometryCollection"){for(Q=0;Q<T.geometry.geometries.length;Q++)Yr($,{id:Y,geometry:T.geometry.geometries[Q],properties:T.properties},C,F);return}throw new Error("Input data is not a valid GeoJSON object.")}for(Q=0;Q<N.length;Q++){var he=[];$i(N[Q],he,J,!0),X.push(he)}}$.push(de(Y,V,X,T.properties))}}function Sr($,T){T.push(yi($[0])),T.push(Kr($[1])),T.push(0)}function Ct($,T,C,F){for(var N,V,J=0,X=0;X<$.length;X++){var Y=yi($[X][0]),Q=Kr($[X][1]);T.push(Y),T.push(Q),T.push(0),X>0&&(J+=F?(N*Q-Y*V)/2:Math.sqrt(Math.pow(Y-N,2)+Math.pow(Q-V,2))),N=Y,V=Q}var he=T.length-3;T[2]=1,Xr(T,0,he,C),T[he+2]=1,T.size=Math.abs(J),T.start=0,T.end=T.size}function $i($,T,C,F){for(var N=0;N<$.length;N++){var V=[];Ct($[N],V,C,F),T.push(V)}}function yi($){return $/360+.5}function Kr($){var T=Math.sin($*Math.PI/180),C=.5-.25*Math.log((1+T)/(1-T))/Math.PI;return C<0?0:C>1?1:C}function kt($,T,C,F,N,V,J,X){if(F/=T,V>=(C/=T)&&J<F)return $;if(J<C||V>=F)return null;for(var Y=[],Q=0;Q<$.length;Q++){var he=$[Q],_e=he.geometry,le=he.type,Oe=N===0?he.minX:he.minY,Le=N===0?he.maxX:he.maxY;if(Oe>=C&&Le<F)Y.push(he);else if(!(Le<C||Oe>=F)){var Ne=[];if(le==="Point"||le==="MultiPoint")Ie(_e,Ne,C,F,N);else if(le==="LineString")st(_e,Ne,C,F,N,!1,X.lineMetrics);else if(le==="MultiLineString")_i(_e,Ne,C,F,N,!1);else if(le==="Polygon")_i(_e,Ne,C,F,N,!0);else if(le==="MultiPolygon")for(var He=0;He<_e.length;He++){var yt=[];_i(_e[He],yt,C,F,N,!0),yt.length&&Ne.push(yt)}if(Ne.length){if(X.lineMetrics&&le==="LineString"){for(He=0;He<Ne.length;He++)Y.push(de(he.id,le,Ne[He],he.tags));continue}le!=="LineString"&&le!=="MultiLineString"||(Ne.length===1?(le="LineString",Ne=Ne[0]):le="MultiLineString"),le!=="Point"&&le!=="MultiPoint"||(le=Ne.length===3?"Point":"MultiPoint"),Y.push(de(he.id,le,Ne,he.tags))}}}return Y.length?Y:null}function Ie($,T,C,F,N){for(var V=0;V<$.length;V+=3){var J=$[V+N];J>=C&&J<=F&&(T.push($[V]),T.push($[V+1]),T.push($[V+2]))}}function st($,T,C,F,N,V,J){for(var X,Y,Q=rt($),he=N===0?nt:Jr,_e=$.start,le=0;le<$.length-3;le+=3){var Oe=$[le],Le=$[le+1],Ne=$[le+2],He=$[le+3],yt=$[le+4],ut=N===0?Oe:Le,lt=N===0?He:yt,at=!1;J&&(X=Math.sqrt(Math.pow(Oe-He,2)+Math.pow(Le-yt,2))),ut<C?lt>C&&(Y=he(Q,Oe,Le,He,yt,C),J&&(Q.start=_e+X*Y)):ut>F?lt<F&&(Y=he(Q,Oe,Le,He,yt,F),J&&(Q.start=_e+X*Y)):Ki(Q,Oe,Le,Ne),lt<C&&ut>=C&&(Y=he(Q,Oe,Le,He,yt,C),at=!0),lt>F&&ut<=F&&(Y=he(Q,Oe,Le,He,yt,F),at=!0),!V&&at&&(J&&(Q.end=_e+X*Y),T.push(Q),Q=rt($)),J&&(_e+=X)}var it=$.length-3;Oe=$[it],Le=$[it+1],Ne=$[it+2],(ut=N===0?Oe:Le)>=C&&ut<=F&&Ki(Q,Oe,Le,Ne),it=Q.length-3,V&&it>=3&&(Q[it]!==Q[0]||Q[it+1]!==Q[1])&&Ki(Q,Q[0],Q[1],Q[2]),Q.length&&T.push(Q)}function rt($){var T=[];return T.size=$.size,T.start=$.start,T.end=$.end,T}function _i($,T,C,F,N,V){for(var J=0;J<$.length;J++)st($[J],T,C,F,N,V,!1)}function Ki($,T,C,F){$.push(T),$.push(C),$.push(F)}function nt($,T,C,F,N,V){var J=(V-T)/(F-T);return $.push(V),$.push(C+(N-C)*J),$.push(1),J}function Jr($,T,C,F,N,V){var J=(V-C)/(N-C);return $.push(T+(F-T)*J),$.push(V),$.push(1),J}function Ji($,T){for(var C=[],F=0;F<$.length;F++){var N,V=$[F],J=V.type;if(J==="Point"||J==="MultiPoint"||J==="LineString")N=Tr(V.geometry,T);else if(J==="MultiLineString"||J==="Polygon"){N=[];for(var X=0;X<V.geometry.length;X++)N.push(Tr(V.geometry[X],T))}else if(J==="MultiPolygon")for(N=[],X=0;X<V.geometry.length;X++){for(var Y=[],Q=0;Q<V.geometry[X].length;Q++)Y.push(Tr(V.geometry[X][Q],T));N.push(Y)}C.push(de(V.id,J,N,V.tags))}return C}function Tr($,T){var C=[];C.size=$.size,$.start!==void 0&&(C.start=$.start,C.end=$.end);for(var F=0;F<$.length;F+=3)C.push($[F]+T,$[F+1],$[F+2]);return C}function Yt($,T){if($.transformed)return $;var C,F,N,V=1<<$.z,J=$.x,X=$.y;for(C=0;C<$.features.length;C++){var Y=$.features[C],Q=Y.geometry,he=Y.type;if(Y.geometry=[],he===1)for(F=0;F<Q.length;F+=2)Y.geometry.push(Mt(Q[F],Q[F+1],T,V,J,X));else for(F=0;F<Q.length;F++){var _e=[];for(N=0;N<Q[F].length;N+=2)_e.push(Mt(Q[F][N],Q[F][N+1],T,V,J,X));Y.geometry.push(_e)}}return $.transformed=!0,$}function Mt($,T,C,F,N,V){return[Math.round(C*($*F-N)),Math.round(C*(T*F-V))]}function Ni($,T,C,F,N){for(var V=T===N.maxZoom?0:N.tolerance/((1<<T)*N.extent),J={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:C,y:F,z:T,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},X=0;X<$.length;X++){J.numFeatures++,Qr(J,$[X],V,N);var Y=$[X].minX,Q=$[X].minY,he=$[X].maxX,_e=$[X].maxY;Y<J.minX&&(J.minX=Y),Q<J.minY&&(J.minY=Q),he>J.maxX&&(J.maxX=he),_e>J.maxY&&(J.maxY=_e)}return J}function Qr($,T,C,F){var N=T.geometry,V=T.type,J=[];if(V==="Point"||V==="MultiPoint")for(var X=0;X<N.length;X+=3)J.push(N[X]),J.push(N[X+1]),$.numPoints++,$.numSimplified++;else if(V==="LineString")ii(J,N,$,C,!1,!1);else if(V==="MultiLineString"||V==="Polygon")for(X=0;X<N.length;X++)ii(J,N[X],$,C,V==="Polygon",X===0);else if(V==="MultiPolygon")for(var Y=0;Y<N.length;Y++){var Q=N[Y];for(X=0;X<Q.length;X++)ii(J,Q[X],$,C,!0,X===0)}if(J.length){var he=T.tags||null;if(V==="LineString"&&F.lineMetrics){for(var _e in he={},T.tags)he[_e]=T.tags[_e];he.mapbox_clip_start=N.start/N.size,he.mapbox_clip_end=N.end/N.size}var le={geometry:J,type:V==="Polygon"||V==="MultiPolygon"?3:V==="LineString"||V==="MultiLineString"?2:1,tags:he};T.id!==null&&(le.id=T.id),$.features.push(le)}}function ii($,T,C,F,N,V){var J=F*F;if(F>0&&T.size<(N?J:F))C.numPoints+=T.length/3;else{for(var X=[],Y=0;Y<T.length;Y+=3)(F===0||T[Y+2]>J)&&(C.numSimplified++,X.push(T[Y]),X.push(T[Y+1])),C.numPoints++;N&&function(Q,he){for(var _e=0,le=0,Oe=Q.length,Le=Oe-2;le<Oe;Le=le,le+=2)_e+=(Q[le]-Q[Le])*(Q[le+1]+Q[Le+1]);if(_e>0===he)for(le=0,Oe=Q.length;le<Oe/2;le+=2){var Ne=Q[le],He=Q[le+1];Q[le]=Q[Oe-2-le],Q[le+1]=Q[Oe-1-le],Q[Oe-2-le]=Ne,Q[Oe-1-le]=He}}(X,V),$.push(X)}}function Qi($,T){var C=(T=this.options=function(N,V){for(var J in V)N[J]=V[J];return N}(Object.create(this.options),T)).debug;if(C&&console.time("preprocess data"),T.maxZoom<0||T.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(T.promoteId&&T.generateId)throw new Error("promoteId and generateId cannot be used together.");var F=function(N,V){var J=[];if(N.type==="FeatureCollection")for(var X=0;X<N.features.length;X++)Yr(J,N.features[X],V,X);else Yr(J,N.type==="Feature"?N:{geometry:N},V);return J}($,T);this.tiles={},this.tileCoords=[],C&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",T.indexMaxZoom,T.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),F=function(N,V){var J=V.buffer/V.extent,X=N,Y=kt(N,1,-1-J,J,0,-1,2,V),Q=kt(N,1,1-J,2+J,0,-1,2,V);return(Y||Q)&&(X=kt(N,1,-J,1+J,0,-1,2,V)||[],Y&&(X=Ji(Y,1).concat(X)),Q&&(X=X.concat(Ji(Q,-1)))),X}(F,T),F.length&&this.splitTile(F,0,0,0),C&&(F.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)))}function er($,T,C){return 32*((1<<$)*C+T)+$}function Kn($,T){const C=$.tileID.canonical;if(!this._geoJSONIndex)return T(null,null);const F=this._geoJSONIndex.getTile(C.z,C.x,C.y);if(!F)return T(null,null);const N=new Qe(F.features);let V=xr(N);V.byteOffset===0&&V.byteLength===V.buffer.byteLength||(V=new Uint8Array(V)),T(null,{vectorTile:N,rawData:V.buffer})}Qi.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},Qi.prototype.splitTile=function($,T,C,F,N,V,J){for(var X=[$,T,C,F],Y=this.options,Q=Y.debug;X.length;){F=X.pop(),C=X.pop(),T=X.pop(),$=X.pop();var he=1<<T,_e=er(T,C,F),le=this.tiles[_e];if(!le&&(Q>1&&console.time("creation"),le=this.tiles[_e]=Ni($,T,C,F,Y),this.tileCoords.push({z:T,x:C,y:F}),Q)){Q>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",T,C,F,le.numFeatures,le.numPoints,le.numSimplified),console.timeEnd("creation"));var Oe="z"+T;this.stats[Oe]=(this.stats[Oe]||0)+1,this.total++}if(le.source=$,N){if(T===Y.maxZoom||T===N)continue;var Le=1<<N-T;if(C!==Math.floor(V/Le)||F!==Math.floor(J/Le))continue}else if(T===Y.indexMaxZoom||le.numPoints<=Y.indexMaxPoints)continue;if(le.source=null,$.length!==0){Q>1&&console.time("clipping");var Ne,He,yt,ut,lt,at,it=.5*Y.buffer/Y.extent,Wt=.5-it,qt=.5+it,oi=1+it;Ne=He=yt=ut=null,lt=kt($,he,C-it,C+qt,0,le.minX,le.maxX,Y),at=kt($,he,C+Wt,C+oi,0,le.minX,le.maxX,Y),$=null,lt&&(Ne=kt(lt,he,F-it,F+qt,1,le.minY,le.maxY,Y),He=kt(lt,he,F+Wt,F+oi,1,le.minY,le.maxY,Y),lt=null),at&&(yt=kt(at,he,F-it,F+qt,1,le.minY,le.maxY,Y),ut=kt(at,he,F+Wt,F+oi,1,le.minY,le.maxY,Y),at=null),Q>1&&console.timeEnd("clipping"),X.push(Ne||[],T+1,2*C,2*F),X.push(He||[],T+1,2*C,2*F+1),X.push(yt||[],T+1,2*C+1,2*F),X.push(ut||[],T+1,2*C+1,2*F+1)}}},Qi.prototype.getTile=function($,T,C){var F=this.options,N=F.extent,V=F.debug;if($<0||$>24)return null;var J=1<<$,X=er($,T=(T%J+J)%J,C);if(this.tiles[X])return Yt(this.tiles[X],N);V>1&&console.log("drilling down to z%d-%d-%d",$,T,C);for(var Y,Q=$,he=T,_e=C;!Y&&Q>0;)Q--,he=Math.floor(he/2),_e=Math.floor(_e/2),Y=this.tiles[er(Q,he,_e)];return Y&&Y.source?(V>1&&console.log("found parent tile z%d-%d-%d",Q,he,_e),V>1&&console.time("drilling down"),this.splitTile(Y.source,Q,he,_e,$,T,C),V>1&&console.timeEnd("drilling down"),this.tiles[X]?Yt(this.tiles[X],N):null):null};class bn extends $e{constructor(T,C,F,N){super(T,C,F,Kn),N&&(this.loadGeoJSON=N)}loadData(T,C){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),this._pendingCallback=C,this._pendingLoadDataParams=T,this._state&&this._state!=="Idle"?this._state="NeedsLoadData":(this._state="Coalescing",this._loadData())}_loadData(){if(!this._pendingCallback||!this._pendingLoadDataParams)return;const T=this._pendingCallback,C=this._pendingLoadDataParams;delete this._pendingCallback,delete this._pendingLoadDataParams;const F=!!(C&&C.request&&C.request.collectResourceTiming)&&new o.RequestPerformance(C.request);this.loadGeoJSON(C,(N,V)=>{if(N||!V)return T(N);if(typeof V!="object")return T(new Error(`Input data given to '${C.source}' is not a valid GeoJSON object.`));{je(V,!0);try{if(C.filter){const X=o.createExpression(C.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(X.result==="error")throw new Error(X.value.map(Q=>`${Q.key}: ${Q.message}`).join(", "));const Y=V.features.filter(Q=>X.value.evaluate({zoom:0},Q));V={type:"FeatureCollection",features:Y}}this._geoJSONIndex=C.cluster?new Hn(function({superclusterOptions:X,clusterProperties:Y}){if(!Y||!X)return X;const Q={},he={},_e={accumulated:null,zoom:0},le={properties:null},Oe=Object.keys(Y);for(const Le of Oe){const[Ne,He]=Y[Le],yt=o.createExpression(He),ut=o.createExpression(typeof Ne=="string"?[Ne,["accumulated"],["get",Le]]:Ne);Q[Le]=yt.value,he[Le]=ut.value}return X.map=Le=>{le.properties=Le;const Ne={};for(const He of Oe)Ne[He]=Q[He].evaluate(_e,le);return Ne},X.reduce=(Le,Ne)=>{le.properties=Ne;for(const He of Oe)_e.accumulated=Le[He],Le[He]=he[He].evaluate(_e,le)},X}(C)).load(V.features):function(X,Y){return new Qi(X,Y)}(V,C.geojsonVtOptions)}catch(X){return T(X)}this.loaded={};const J={};if(F){const X=F.finish();X&&(J.resourceTiming={},J.resourceTiming[C.source]=JSON.parse(JSON.stringify(X)))}T(null,J)}})}coalesce(){this._state==="Coalescing"?this._state="Idle":this._state==="NeedsLoadData"&&(this._state="Coalescing",this._loadData())}reloadTile(T,C){const F=this.loaded;return F&&F[T.uid]?super.reloadTile(T,C):this.loadTile(T,C)}loadGeoJSON(T,C){if(T.request)o.getJSON(T.request,C);else{if(typeof T.data!="string")return C(new Error(`Input data given to '${T.source}' is not a valid GeoJSON object.`));try{return C(null,JSON.parse(T.data))}catch{return C(new Error(`Input data given to '${T.source}' is not a valid GeoJSON object.`))}}}removeSource(T,C){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),C()}getClusterExpansionZoom(T,C){try{C(null,this._geoJSONIndex.getClusterExpansionZoom(T.clusterId))}catch(F){C(F)}}getClusterChildren(T,C){try{C(null,this._geoJSONIndex.getChildren(T.clusterId))}catch(F){C(F)}}getClusterLeaves(T,C){try{C(null,this._geoJSONIndex.getLeaves(T.clusterId,T.limit,T.offset))}catch(F){C(F)}}}class wn{constructor(T){this.self=T,this.actor=new o.Actor(T,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:$e,geojson:bn},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(C,F)=>{if(this.workerSourceTypes[C])throw new Error(`Worker source with name "${C}" already registered.`);this.workerSourceTypes[C]=F},this.self.registerRTLTextPlugin=C=>{if(o.plugin.isParsed())throw new Error("RTL text plugin already registered.");o.plugin.applyArabicShaping=C.applyArabicShaping,o.plugin.processBidirectionalText=C.processBidirectionalText,o.plugin.processStyledBidirectionalText=C.processStyledBidirectionalText}}setReferrer(T,C){this.referrer=C}setImages(T,C,F){this.availableImages[T]=C;for(const N in this.workerSources[T]){const V=this.workerSources[T][N];for(const J in V)V[J].availableImages=C}F()}setLayers(T,C,F){this.getLayerIndex(T).replace(C),F()}updateLayers(T,C,F){this.getLayerIndex(T).update(C.layers,C.removedIds),F()}loadTile(T,C,F){this.getWorkerSource(T,C.type,C.source).loadTile(C,F)}loadDEMTile(T,C,F){this.getDEMWorkerSource(T,C.source).loadTile(C,F)}reloadTile(T,C,F){this.getWorkerSource(T,C.type,C.source).reloadTile(C,F)}abortTile(T,C,F){this.getWorkerSource(T,C.type,C.source).abortTile(C,F)}removeTile(T,C,F){this.getWorkerSource(T,C.type,C.source).removeTile(C,F)}removeDEMTile(T,C){this.getDEMWorkerSource(T,C.source).removeTile(C)}removeSource(T,C,F){if(!this.workerSources[T]||!this.workerSources[T][C.type]||!this.workerSources[T][C.type][C.source])return;const N=this.workerSources[T][C.type][C.source];delete this.workerSources[T][C.type][C.source],N.removeSource!==void 0?N.removeSource(C,F):F()}loadWorkerSource(T,C,F){try{this.self.importScripts(C.url),F()}catch(N){F(N.toString())}}syncRTLPluginState(T,C,F){try{o.plugin.setState(C);const N=o.plugin.getPluginURL();if(o.plugin.isLoaded()&&!o.plugin.isParsed()&&N!=null){this.self.importScripts(N);const V=o.plugin.isParsed();F(V?void 0:new Error(`RTL Text Plugin failed to import scripts from ${N}`),V)}}catch(N){F(N.toString())}}getAvailableImages(T){let C=this.availableImages[T];return C||(C=[]),C}getLayerIndex(T){let C=this.layerIndexes[T];return C||(C=this.layerIndexes[T]=new ge),C}getWorkerSource(T,C,F){if(this.workerSources[T]||(this.workerSources[T]={}),this.workerSources[T][C]||(this.workerSources[T][C]={}),!this.workerSources[T][C][F]){const N={send:(V,J,X)=>{this.actor.send(V,J,X,T)}};this.workerSources[T][C][F]=new this.workerSourceTypes[C](N,this.getLayerIndex(T),this.getAvailableImages(T))}return this.workerSources[T][C][F]}getDEMWorkerSource(T,C){return this.demWorkerSources[T]||(this.demWorkerSources[T]={}),this.demWorkerSources[T][C]||(this.demWorkerSources[T][C]=new Ve),this.demWorkerSources[T][C]}enforceCacheSizeLimit(T,C){o.enforceCacheSizeLimit(C)}}return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope&&(self.worker=new wn(self)),wn}),z(["./shared"],function(o){var G=K;function K(h){return!function(t){return typeof window>"u"||typeof document>"u"?"not a browser":Array.prototype&&Array.prototype.every&&Array.prototype.filter&&Array.prototype.forEach&&Array.prototype.indexOf&&Array.prototype.lastIndexOf&&Array.prototype.map&&Array.prototype.some&&Array.prototype.reduce&&Array.prototype.reduceRight&&Array.isArray?Function.prototype&&Function.prototype.bind?Object.keys&&Object.create&&Object.getPrototypeOf&&Object.getOwnPropertyNames&&Object.isSealed&&Object.isFrozen&&Object.isExtensible&&Object.getOwnPropertyDescriptor&&Object.defineProperty&&Object.defineProperties&&Object.seal&&Object.freeze&&Object.preventExtensions?"JSON"in window&&"parse"in JSON&&"stringify"in JSON?function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var l,d,f=new Blob([""],{type:"text/javascript"}),_=URL.createObjectURL(f);try{d=new Worker(_),l=!0}catch{l=!1}return d&&d.terminate(),URL.revokeObjectURL(_),l}()?"Uint8ClampedArray"in window?ArrayBuffer.isView?function(){var l=document.createElement("canvas");l.width=l.height=1;var d=l.getContext("2d");if(!d)return!1;var f=d.getImageData(0,0,1,1);return f&&f.width===l.width}()?(ge[n=t&&t.failIfMajorPerformanceCaveat]===void 0&&(ge[n]=function(l){var d,f=function(_){var b=document.createElement("canvas"),w=Object.create(K.webGLContextAttributes);return w.failIfMajorPerformanceCaveat=_,b.getContext("webgl",w)||b.getContext("experimental-webgl",w)}(l);if(!f)return!1;try{d=f.createShader(f.VERTEX_SHADER)}catch{return!1}return!(!d||f.isContextLost())&&(f.shaderSource(d,"void main() {}"),f.compileShader(d),f.getShaderParameter(d,f.COMPILE_STATUS)===!0)}(n)),ge[n]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL support"):"insufficient Canvas/getImageData support":"insufficient ArrayBuffer support":"insufficient Uint8ClampedArray support":"insufficient worker support":"insufficient JSON support":"insufficient Object support":"insufficient Function support":"insufficent Array support";var n}(h)}var ge={};function ae(h,t){if(Array.isArray(h)){if(!Array.isArray(t)||h.length!==t.length)return!1;for(let n=0;n<h.length;n++)if(!ae(h[n],t[n]))return!1;return!0}if(typeof h=="object"&&h!==null&&t!==null){if(typeof t!="object"||Object.keys(h).length!==Object.keys(t).length)return!1;for(const n in h)if(!ae(h[n],t[n]))return!1;return!0}return h===t}K.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0};class H{static testProp(t){if(!H.docStyle)return t[0];for(let n=0;n<t.length;n++)if(t[n]in H.docStyle)return t[n];return t[0]}static create(t,n,l){const d=window.document.createElement(t);return n!==void 0&&(d.className=n),l&&l.appendChild(d),d}static createNS(t,n){return window.document.createElementNS(t,n)}static disableDrag(){H.docStyle&&H.selectProp&&(H.userSelect=H.docStyle[H.selectProp],H.docStyle[H.selectProp]="none")}static enableDrag(){H.docStyle&&H.selectProp&&(H.docStyle[H.selectProp]=H.userSelect)}static setTransform(t,n){t.style[H.transformProp]=n}static addEventListener(t,n,l,d={}){t.addEventListener(n,l,"passive"in d?d:d.capture)}static removeEventListener(t,n,l,d={}){t.removeEventListener(n,l,"passive"in d?d:d.capture)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",H.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",H.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",H.suppressClickInternal,!0)},0)}static mousePos(t,n){const l=t.getBoundingClientRect();return new o.pointGeometry(n.clientX-l.left-t.clientLeft,n.clientY-l.top-t.clientTop)}static touchPos(t,n){const l=t.getBoundingClientRect(),d=[];for(let f=0;f<n.length;f++)d.push(new o.pointGeometry(n[f].clientX-l.left-t.clientLeft,n[f].clientY-l.top-t.clientTop));return d}static mouseButton(t){return t.button}static remove(t){t.parentNode&&t.parentNode.removeChild(t)}}H.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,H.selectProp=H.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),H.transformProp=H.testProp(["transform","WebkitTransform"]);class ke{constructor(t){this._transformRequestFn=t}transformRequest(t,n){return this._transformRequestFn&&this._transformRequestFn(t,n)||{url:t}}normalizeSpriteURL(t,n,l){const d=function(f){const _=f.match(we);if(!_)throw new Error(`Unable to parse URL "${f}"`);return{protocol:_[1],authority:_[2],path:_[3]||"/",params:_[4]?_[4].split("&"):[]}}(t);return d.path+=`${n}${l}`,function(f){const _=f.params.length?`?${f.params.join("&")}`:"";return`${f.protocol}://${f.authority}${f.path}${_}`}(d)}setTransformRequest(t){this._transformRequestFn=t}}const we=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function $e(h){var t=new o.ARRAY_TYPE(3);return t[0]=h[0],t[1]=h[1],t[2]=h[2],t}var Ve,je=function(h,t,n){return h[0]=t[0]-n[0],h[1]=t[1]-n[1],h[2]=t[2]-n[2],h};Ve=new o.ARRAY_TYPE(3),o.ARRAY_TYPE!=Float32Array&&(Ve[0]=0,Ve[1]=0,Ve[2]=0);var Ge=function(h){var t=h[0],n=h[1];return t*t+n*n};(function(){var h=new o.ARRAY_TYPE(2);o.ARRAY_TYPE!=Float32Array&&(h[0]=0,h[1]=0)})();class We{constructor(t,n,l,d){this.context=t,this.format=l,this.texture=t.gl.createTexture(),this.update(n,d)}update(t,n,l){const{width:d,height:f}=t,_=!(this.size&&this.size[0]===d&&this.size[1]===f||l),{context:b}=this,{gl:w}=b;if(this.useMipmap=Boolean(n&&n.useMipmap),w.bindTexture(w.TEXTURE_2D,this.texture),b.pixelStoreUnpackFlipY.set(!1),b.pixelStoreUnpack.set(1),b.pixelStoreUnpackPremultiplyAlpha.set(this.format===w.RGBA&&(!n||n.premultiply!==!1)),_)this.size=[d,f],t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||o.isImageBitmap(t)?w.texImage2D(w.TEXTURE_2D,0,this.format,this.format,w.UNSIGNED_BYTE,t):w.texImage2D(w.TEXTURE_2D,0,this.format,d,f,0,this.format,w.UNSIGNED_BYTE,t.data);else{const{x:E,y:P}=l||{x:0,y:0};t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||o.isImageBitmap(t)?w.texSubImage2D(w.TEXTURE_2D,0,E,P,w.RGBA,w.UNSIGNED_BYTE,t):w.texSubImage2D(w.TEXTURE_2D,0,E,P,d,f,w.RGBA,w.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&w.generateMipmap(w.TEXTURE_2D)}bind(t,n,l){const{context:d}=this,{gl:f}=d;f.bindTexture(f.TEXTURE_2D,this.texture),l!==f.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(l=f.LINEAR),t!==this.filter&&(f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MAG_FILTER,t),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MIN_FILTER,l||t),this.filter=t),n!==this.wrap&&(f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,n),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,n),this.wrap=n)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null}}function At(h){const{userImage:t}=h;return!!(t&&t.render&&t.render())&&(h.data.replace(new Uint8Array(t.data.buffer)),!0)}class gt extends o.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new o.RGBAImage({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(const{ids:n,callback:l}of this.requestors)this._notify(n,l);this.requestors=[]}}getImage(t){return this.images[t]}addImage(t,n){this._validate(t,n)&&(this.images[t]=n)}_validate(t,n){let l=!0;return this._validateStretch(n.stretchX,n.data&&n.data.width)||(this.fire(new o.ErrorEvent(new Error(`Image "${t}" has invalid "stretchX" value`))),l=!1),this._validateStretch(n.stretchY,n.data&&n.data.height)||(this.fire(new o.ErrorEvent(new Error(`Image "${t}" has invalid "stretchY" value`))),l=!1),this._validateContent(n.content,n)||(this.fire(new o.ErrorEvent(new Error(`Image "${t}" has invalid "content" value`))),l=!1),l}_validateStretch(t,n){if(!t)return!0;let l=0;for(const d of t){if(d[0]<l||d[1]<d[0]||n<d[1])return!1;l=d[1]}return!0}_validateContent(t,n){return!(t&&(t.length!==4||t[0]<0||n.data.width<t[0]||t[1]<0||n.data.height<t[1]||t[2]<0||n.data.width<t[2]||t[3]<0||n.data.height<t[3]||t[2]<t[0]||t[3]<t[1]))}updateImage(t,n){n.version=this.images[t].version+1,this.images[t]=n,this.updatedImages[t]=!0}removeImage(t){const n=this.images[t];delete this.images[t],delete this.patterns[t],n.userImage&&n.userImage.onRemove&&n.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(t,n){let l=!0;if(!this.isLoaded())for(const d of t)this.images[d]||(l=!1);this.isLoaded()||l?this._notify(t,n):this.requestors.push({ids:t,callback:n})}_notify(t,n){const l={};for(const d of t){this.images[d]||this.fire(new o.Event("styleimagemissing",{id:d}));const f=this.images[d];f?l[d]={data:f.data.clone(),pixelRatio:f.pixelRatio,sdf:f.sdf,version:f.version,stretchX:f.stretchX,stretchY:f.stretchY,content:f.content,hasRenderCallback:Boolean(f.userImage&&f.userImage.render)}:o.warnOnce(`Image "${d}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}n(null,l)}getPixelSize(){const{width:t,height:n}=this.atlasImage;return{width:t,height:n}}getPattern(t){const n=this.patterns[t],l=this.getImage(t);if(!l)return null;if(n&&n.position.version===l.version)return n.position;if(n)n.position.version=l.version;else{const d={w:l.data.width+2,h:l.data.height+2,x:0,y:0},f=new o.ImagePosition(d,l);this.patterns[t]={bin:d,position:f}}return this._updatePatternAtlas(),this.patterns[t].position}bind(t){const n=t.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new We(t,this.atlasImage,n.RGBA),this.atlasTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}_updatePatternAtlas(){const t=[];for(const f in this.patterns)t.push(this.patterns[f].bin);const{w:n,h:l}=o.potpack(t),d=this.atlasImage;d.resize({width:n||1,height:l||1});for(const f in this.patterns){const{bin:_}=this.patterns[f],b=_.x+1,w=_.y+1,E=this.images[f].data,P=E.width,L=E.height;o.RGBAImage.copy(E,d,{x:0,y:0},{x:b,y:w},{width:P,height:L}),o.RGBAImage.copy(E,d,{x:0,y:L-1},{x:b,y:w-1},{width:P,height:1}),o.RGBAImage.copy(E,d,{x:0,y:0},{x:b,y:w+L},{width:P,height:1}),o.RGBAImage.copy(E,d,{x:P-1,y:0},{x:b-1,y:w},{width:1,height:L}),o.RGBAImage.copy(E,d,{x:0,y:0},{x:b+P,y:w},{width:1,height:L})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(t){for(const n of t){if(this.callbackDispatchedThisFrame[n])continue;this.callbackDispatchedThisFrame[n]=!0;const l=this.images[n];At(l)&&this.updateImage(n,l)}}}const Qe=1e20;function Dt(h,t,n,l,d,f,_,b,w){for(let E=t;E<t+l;E++)$t(h,n*f+E,f,d,_,b,w);for(let E=n;E<n+d;E++)$t(h,E*f+t,1,l,_,b,w)}function $t(h,t,n,l,d,f,_){f[0]=0,_[0]=-Qe,_[1]=Qe,d[0]=h[t];for(let b=1,w=0,E=0;b<l;b++){d[b]=h[t+b*n];const P=b*b;do{const L=f[w];E=(d[b]-d[L]+P-L*L)/(b-L)/2}while(E<=_[w]&&--w>-1);w++,f[w]=b,_[w]=E,_[w+1]=Qe}for(let b=0,w=0;b<l;b++){for(;_[w+1]<b;)w++;const E=f[w],P=b-E;h[t+b*n]=d[E]+P*P}}class Ui{constructor(t,n){this.requestManager=t,this.localIdeographFontFamily=n,this.entries={}}setURL(t){this.url=t}getGlyphs(t,n){const l=[];for(const d in t)for(const f of t[d])l.push({stack:d,id:f});o.asyncAll(l,({stack:d,id:f},_)=>{let b=this.entries[d];b||(b=this.entries[d]={glyphs:{},requests:{},ranges:{}});let w=b.glyphs[f];if(w!==void 0)return void _(null,{stack:d,id:f,glyph:w});if(w=this._tinySDF(b,d,f),w)return b.glyphs[f]=w,void _(null,{stack:d,id:f,glyph:w});const E=Math.floor(f/256);if(256*E>65535)return void _(new Error("glyphs > 65535 not supported"));if(b.ranges[E])return void _(null,{stack:d,id:f,glyph:w});let P=b.requests[E];P||(P=b.requests[E]=[],Ui.loadGlyphRange(d,E,this.url,this.requestManager,(L,O)=>{if(O){for(const j in O)this._doesCharSupportLocalGlyph(+j)||(b.glyphs[+j]=O[+j]);b.ranges[E]=!0}for(const j of P)j(L,O);delete b.requests[E]})),P.push((L,O)=>{L?_(L):O&&_(null,{stack:d,id:f,glyph:O[f]||null})})},(d,f)=>{if(d)n(d);else if(f){const _={};for(const{stack:b,id:w,glyph:E}of f)(_[b]||(_[b]={}))[w]=E&&{id:E.id,bitmap:E.bitmap.clone(),metrics:E.metrics};n(null,_)}})}_doesCharSupportLocalGlyph(t){return!!this.localIdeographFontFamily&&(o.unicodeBlockLookup["CJK Unified Ideographs"](t)||o.unicodeBlockLookup["Hangul Syllables"](t)||o.unicodeBlockLookup.Hiragana(t)||o.unicodeBlockLookup.Katakana(t))}_tinySDF(t,n,l){const d=this.localIdeographFontFamily;if(!d||!this._doesCharSupportLocalGlyph(l))return;let f=t.tinySDF;if(!f){let b="400";/bold/i.test(n)?b="900":/medium/i.test(n)?b="500":/light/i.test(n)&&(b="200"),f=t.tinySDF=new Ui.TinySDF({fontSize:24,buffer:3,radius:8,cutoff:.25,fontFamily:d,fontWeight:b})}const _=f.draw(String.fromCharCode(l));return{id:l,bitmap:new o.AlphaImage({width:_.width||30,height:_.height||30},_.data),metrics:{width:_.glyphWidth||24,height:_.glyphHeight||24,left:_.glyphLeft||0,top:_.glyphTop-27||-8,advance:_.glyphAdvance||24}}}}Ui.loadGlyphRange=function(h,t,n,l,d){const f=256*t,_=f+255,b=l.transformRequest(n.replace("{fontstack}",h).replace("{range}",`${f}-${_}`),o.ResourceType.Glyphs);o.getArrayBuffer(b,(w,E)=>{if(w)d(w);else if(E){const P={};for(const L of o.parseGlyphPBF(E))P[L.id]=L;d(null,P)}})},Ui.TinySDF=class{constructor({fontSize:h=24,buffer:t=3,radius:n=8,cutoff:l=.25,fontFamily:d="sans-serif",fontWeight:f="normal",fontStyle:_="normal"}={}){this.buffer=t,this.cutoff=l,this.radius=n;const b=this.size=h+4*t,w=this._createCanvas(b),E=this.ctx=w.getContext("2d",{willReadFrequently:!0});E.font=`${_} ${f} ${h}px ${d}`,E.textBaseline="alphabetic",E.textAlign="left",E.fillStyle="black",this.gridOuter=new Float64Array(b*b),this.gridInner=new Float64Array(b*b),this.f=new Float64Array(b),this.z=new Float64Array(b+1),this.v=new Uint16Array(b)}_createCanvas(h){const t=document.createElement("canvas");return t.width=t.height=h,t}draw(h){const{width:t,actualBoundingBoxAscent:n,actualBoundingBoxDescent:l,actualBoundingBoxLeft:d,actualBoundingBoxRight:f}=this.ctx.measureText(h),_=Math.ceil(n),b=Math.min(this.size-this.buffer,Math.ceil(f-d)),w=Math.min(this.size-this.buffer,_+Math.ceil(l)),E=b+2*this.buffer,P=w+2*this.buffer,L=Math.max(E*P,0),O=new Uint8ClampedArray(L),j={data:O,width:E,height:P,glyphWidth:b,glyphHeight:w,glyphTop:_,glyphLeft:0,glyphAdvance:t};if(b===0||w===0)return j;const{ctx:U,buffer:q,gridInner:ee,gridOuter:te}=this;U.clearRect(q,q,b,w),U.fillText(h,q,q+_);const ne=U.getImageData(q,q,b,w);te.fill(Qe,0,L),ee.fill(0,0,L);for(let ie=0;ie<w;ie++)for(let fe=0;fe<b;fe++){const ce=ne.data[4*(ie*b+fe)+3]/255;if(ce===0)continue;const ue=(ie+q)*E+fe+q;if(ce===1)te[ue]=0,ee[ue]=Qe;else{const ve=.5-ce;te[ue]=ve>0?ve*ve:0,ee[ue]=ve<0?ve*ve:0}}Dt(te,0,0,E,P,E,this.f,this.v,this.z),Dt(ee,q,q,b,w,E,this.f,this.v,this.z);for(let ie=0;ie<L;ie++){const fe=Math.sqrt(te[ie])-Math.sqrt(ee[ie]);O[ie]=Math.round(255-255*(fe/this.radius+this.cutoff))}return j}};const xn=new o.Properties({anchor:new o.DataConstantProperty(o.spec.light.anchor),position:new class{constructor(){this.specification=o.spec.light.position}possiblyEvaluate(h,t){return o.sphericalToCartesian(h.expression.evaluate(t))}interpolate(h,t,n){return{x:o.number(h.x,t.x,n),y:o.number(h.y,t.y,n),z:o.number(h.z,t.z,n)}}},color:new o.DataConstantProperty(o.spec.light.color),intensity:new o.DataConstantProperty(o.spec.light.intensity)}),Vr="-transition";class zr extends o.Evented{constructor(t){super(),this._transitionable=new o.Transitionable(xn),this.setLight(t),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,n={}){if(!this._validate(o.validateLight,t,n))for(const l in t){const d=t[l];l.endsWith(Vr)?this._transitionable.setTransition(l.slice(0,-Vr.length),d):this._transitionable.setValue(l,d)}}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,n,l){return(!l||l.validate!==!1)&&o.emitValidationErrors(this,t.call(o.validateStyle,o.extend({value:n,style:{glyphs:!0,sprite:!0},styleSpec:o.spec})))}}class Zn{constructor(t,n){this.width=t,this.height=n,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(t,n){const l=t.join(",")+String(n);return this.dashEntry[l]||(this.dashEntry[l]=this.addDash(t,n)),this.dashEntry[l]}getDashRanges(t,n,l){const d=[];let f=t.length%2==1?-t[t.length-1]*l:0,_=t[0]*l,b=!0;d.push({left:f,right:_,isDash:b,zeroLength:t[0]===0});let w=t[0];for(let E=1;E<t.length;E++){b=!b;const P=t[E];f=w*l,w+=P,_=w*l,d.push({left:f,right:_,isDash:b,zeroLength:P===0})}return d}addRoundDash(t,n,l){const d=n/2;for(let f=-l;f<=l;f++){const _=this.width*(this.nextRow+l+f);let b=0,w=t[b];for(let E=0;E<this.width;E++){E/w.right>1&&(w=t[++b]);const P=Math.abs(E-w.left),L=Math.abs(E-w.right),O=Math.min(P,L);let j;const U=f/l*(d+1);if(w.isDash){const q=d-Math.abs(U);j=Math.sqrt(O*O+q*q)}else j=d-Math.sqrt(O*O+U*U);this.data[_+E]=Math.max(0,Math.min(255,j+128))}}}addRegularDash(t){for(let b=t.length-1;b>=0;--b){const w=t[b],E=t[b+1];w.zeroLength?t.splice(b,1):E&&E.isDash===w.isDash&&(E.left=w.left,t.splice(b,1))}const n=t[0],l=t[t.length-1];n.isDash===l.isDash&&(n.left=l.left-this.width,l.right=n.right+this.width);const d=this.width*this.nextRow;let f=0,_=t[f];for(let b=0;b<this.width;b++){b/_.right>1&&(_=t[++f]);const w=Math.abs(b-_.left),E=Math.abs(b-_.right),P=Math.min(w,E);this.data[d+b]=Math.max(0,Math.min(255,(_.isDash?P:-P)+128))}}addDash(t,n){const l=n?7:0,d=2*l+1;if(this.nextRow+d>this.height)return o.warnOnce("LineAtlas out of space"),null;let f=0;for(let b=0;b<t.length;b++)f+=t[b];if(f!==0){const b=this.width/f,w=this.getDashRanges(t,this.width,b);n?this.addRoundDash(w,b,l):this.addRegularDash(w)}const _={y:(this.nextRow+l+.5)/this.height,height:2*l/this.height,width:f};return this.nextRow+=d,this.dirty=!0,_}bind(t){const n=t.gl;this.texture?(n.bindTexture(n.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,n.texSubImage2D(n.TEXTURE_2D,0,0,0,this.width,this.height,n.ALPHA,n.UNSIGNED_BYTE,this.data))):(this.texture=n.createTexture(),n.bindTexture(n.TEXTURE_2D,this.texture),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.REPEAT),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.REPEAT),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),n.texImage2D(n.TEXTURE_2D,0,n.ALPHA,this.width,this.height,0,n.ALPHA,n.UNSIGNED_BYTE,this.data))}}class yr{constructor(t,n){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=o.uniqueId();const l=this.workerPool.acquire(this.id);for(let d=0;d<l.length;d++){const f=new yr.Actor(l[d],n,this.id);f.name=`Worker ${d}`,this.actors.push(f)}}broadcast(t,n,l){o.asyncAll(this.actors,(d,f)=>{d.send(t,n,f)},l=l||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(t=>{t.remove()}),this.actors=[],this.workerPool.release(this.id)}}function Gr(h,t,n){const l=function(d,f){if(d)return n(d);if(f){const _=o.pick(o.extend(f,h),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);f.vector_layers&&(_.vectorLayers=f.vector_layers,_.vectorLayerIds=_.vectorLayers.map(b=>b.id)),n(null,_)}};return h.url?o.getJSON(t.transformRequest(h.url,o.ResourceType.Source),l):o.exported.frame(()=>l(null,h))}yr.Actor=o.Actor;class Ke{constructor(t,n,l){this.bounds=o.LngLatBounds.convert(this.validateBounds(t)),this.minzoom=n||0,this.maxzoom=l||24}validateBounds(t){return Array.isArray(t)&&t.length===4?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}contains(t){const n=Math.pow(2,t.z),l=Math.floor(o.mercatorXfromLng(this.bounds.getWest())*n),d=Math.floor(o.mercatorYfromLat(this.bounds.getNorth())*n),f=Math.ceil(o.mercatorXfromLng(this.bounds.getEast())*n),_=Math.ceil(o.mercatorYfromLat(this.bounds.getSouth())*n);return t.x>=l&&t.x<f&&t.y>=d&&t.y<_}}class _r extends o.Evented{constructor(t,n,l,d){if(super(),this.id=t,this.dispatcher=l,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,o.extend(this,o.pick(n,["url","scheme","tileSize","promoteId"])),this._options=o.extend({type:"vector"},n),this._collectResourceTiming=n.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(d)}load(){this._loaded=!1,this.fire(new o.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=Gr(this._options,this.map._requestManager,(t,n)=>{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),t?this.fire(new o.ErrorEvent(t)):n&&(o.extend(this,n),n.bounds&&(this.tileBounds=new Ke(n.bounds,this.minzoom,this.maxzoom)),this.fire(new o.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new o.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.cancel(),t(),this.load()}setTiles(t){return this.setSourceProperty(()=>{this._options.tiles=t}),this}setUrl(t){return this.setSourceProperty(()=>{this.url=t,this._options.url=t}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return o.extend({},this._options)}loadTile(t,n){const l=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),d={request:this.map._requestManager.transformRequest(l,o.ResourceType.Tile),uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};function f(_,b){return delete t.request,t.aborted?n(null):_&&_.status!==404?n(_):(b&&b.resourceTiming&&(t.resourceTiming=b.resourceTiming),this.map._refreshExpiredTiles&&b&&t.setExpiryData(b),t.loadVectorData(b,this.map.painter),o.cacheEntryPossiblyAdded(this.dispatcher),n(null),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}d.request.collectResourceTiming=this._collectResourceTiming,t.actor&&t.state!=="expired"?t.state==="loading"?t.reloadCallback=n:t.request=t.actor.send("reloadTile",d,f.bind(this)):(t.actor=this.dispatcher.getActor(),t.request=t.actor.send("loadTile",d,f.bind(this)))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.type,source:this.id},void 0)}unloadTile(t){t.unloadVectorData(),t.actor&&t.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id},void 0)}hasTransition(){return!1}}class kr extends o.Evented{constructor(t,n,l,d){super(),this.id=t,this.dispatcher=l,this.setEventedParent(d),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=o.extend({type:"raster"},n),o.extend(this,o.pick(n,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new o.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=Gr(this._options,this.map._requestManager,(t,n)=>{this._tileJSONRequest=null,this._loaded=!0,t?this.fire(new o.ErrorEvent(t)):n&&(o.extend(this,n),n.bounds&&(this.tileBounds=new Ke(n.bounds,this.minzoom,this.maxzoom)),this.fire(new o.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new o.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return o.extend({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t,n){const l=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.request=o.getImage(this.map._requestManager.transformRequest(l,o.ResourceType.Tile),(d,f,_)=>{if(delete t.request,t.aborted)t.state="unloaded",n(null);else if(d)t.state="errored",n(d);else if(f){this.map._refreshExpiredTiles&&t.setExpiryData(_);const b=this.map.painter.context,w=b.gl;t.texture=this.map.painter.getTileTexture(f.width),t.texture?t.texture.update(f,{useMipmap:!0}):(t.texture=new We(b,f,w.RGBA,{useMipmap:!0}),t.texture.bind(w.LINEAR,w.CLAMP_TO_EDGE,w.LINEAR_MIPMAP_NEAREST),b.extTextureFilterAnisotropic&&w.texParameterf(w.TEXTURE_2D,b.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,b.extTextureFilterAnisotropicMax)),t.state="loaded",o.cacheEntryPossiblyAdded(this.dispatcher),n(null)}})}abortTile(t,n){t.request&&(t.request.cancel(),delete t.request),n()}unloadTile(t,n){t.texture&&this.map.painter.saveTileTexture(t.texture),n()}hasTransition(){return!1}}let Lr;class Xi extends kr{constructor(t,n,l,d){super(t,n,l,d),this.type="raster-dem",this.maxzoom=22,this._options=o.extend({type:"raster-dem"},n),this.encoding=n.encoding||"mapbox"}serialize(){return{type:"raster-dem",url:this.url,tileSize:this.tileSize,tiles:this.tiles,bounds:this.bounds,encoding:this.encoding}}loadTile(t,n){const l=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);function d(f,_){f&&(t.state="errored",n(f)),_&&(t.dem=_,t.needsHillshadePrepare=!0,t.state="loaded",n(null))}t.request=o.getImage(this.map._requestManager.transformRequest(l,o.ResourceType.Tile),function(f,_){if(delete t.request,t.aborted)t.state="unloaded",n(null);else if(f)t.state="errored",n(f);else if(_){this.map._refreshExpiredTiles&&t.setExpiryData(_),delete _.cacheControl,delete _.expires;const b=o.isImageBitmap(_)&&(Lr==null&&(Lr=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Lr)?_:o.exported.getImageData(_,1),w={uid:t.uid,coord:t.tileID,source:this.id,rawImageData:b,encoding:this.encoding};t.actor&&t.state!=="expired"||(t.actor=this.dispatcher.getActor(),t.actor.send("loadDEMTile",w,d.bind(this)))}}.bind(this)),t.neighboringTiles=this._getNeighboringTiles(t.tileID)}_getNeighboringTiles(t){const n=t.canonical,l=Math.pow(2,n.z),d=(n.x-1+l)%l,f=n.x===0?t.wrap-1:t.wrap,_=(n.x+1+l)%l,b=n.x+1===l?t.wrap+1:t.wrap,w={};return w[new o.OverscaledTileID(t.overscaledZ,f,n.z,d,n.y).key]={backfilled:!1},w[new o.OverscaledTileID(t.overscaledZ,b,n.z,_,n.y).key]={backfilled:!1},n.y>0&&(w[new o.OverscaledTileID(t.overscaledZ,f,n.z,d,n.y-1).key]={backfilled:!1},w[new o.OverscaledTileID(t.overscaledZ,t.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},w[new o.OverscaledTileID(t.overscaledZ,b,n.z,_,n.y-1).key]={backfilled:!1}),n.y+1<l&&(w[new o.OverscaledTileID(t.overscaledZ,f,n.z,d,n.y+1).key]={backfilled:!1},w[new o.OverscaledTileID(t.overscaledZ,t.wrap,n.z,n.x,n.y+1).key]={backfilled:!1},w[new o.OverscaledTileID(t.overscaledZ,b,n.z,_,n.y+1).key]={backfilled:!1}),w}unloadTile(t){t.demTexture&&this.map.painter.saveTileTexture(t.demTexture),t.fbo&&(t.fbo.destroy(),delete t.fbo),t.dem&&delete t.dem,delete t.neighboringTiles,t.state="unloaded",t.actor&&t.actor.send("removeDEMTile",{uid:t.uid,source:this.id})}}class qr extends o.Evented{constructor(t,n,l,d){super(),this.id=t,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=l.getActor(),this.setEventedParent(d),this._data=n.data,this._options=o.extend({},n),this._collectResourceTiming=n.collectResourceTiming,n.maxzoom!==void 0&&(this.maxzoom=n.maxzoom),n.type&&(this.type=n.type),n.attribution&&(this.attribution=n.attribution),this.promoteId=n.promoteId;const f=o.EXTENT/this.tileSize;this.workerOptions=o.extend({source:this.id,cluster:n.cluster||!1,geojsonVtOptions:{buffer:(n.buffer!==void 0?n.buffer:128)*f,tolerance:(n.tolerance!==void 0?n.tolerance:.375)*f,extent:o.EXTENT,maxZoom:this.maxzoom,lineMetrics:n.lineMetrics||!1,generateId:n.generateId||!1},superclusterOptions:{maxZoom:n.clusterMaxZoom!==void 0?n.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,n.clusterMinPoints||2),extent:o.EXTENT,radius:(n.clusterRadius||50)*f,log:!1,generateId:n.generateId||!1},clusterProperties:n.clusterProperties,filter:n.filter},n.workerOptions)}load(){this._updateWorkerData("metadata")}onAdd(t){this.map=t,this.load()}setData(t){return this._data=t,this._updateWorkerData("content"),this}getClusterExpansionZoom(t,n){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:t,source:this.id},n),this}getClusterChildren(t,n){return this.actor.send("geojson.getClusterChildren",{clusterId:t,source:this.id},n),this}getClusterLeaves(t,n,l,d){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:t,limit:n,offset:l},d),this}_updateWorkerData(t){const n=o.extend({},this.workerOptions),l=this._data;typeof l=="string"?(n.request=this.map._requestManager.transformRequest(o.exported.resolveURL(l),o.ResourceType.Source),n.request.collectResourceTiming=this._collectResourceTiming):n.data=JSON.stringify(l),this._pendingLoads++,this.fire(new o.Event("dataloading",{dataType:"source"})),this.actor.send(`${this.type}.loadData`,n,(d,f)=>{if(this._pendingLoads--,this._removed||f&&f.abandoned)return;let _=null;if(f&&f.resourceTiming&&f.resourceTiming[this.id]&&(_=f.resourceTiming[this.id].slice(0)),this.actor.send(`${this.type}.coalesce`,{source:n.source},null),d)return void this.fire(new o.ErrorEvent(d));const b={dataType:"source",sourceDataType:t};this._collectResourceTiming&&_&&_.length>0&&o.extend(b,{resourceTiming:_}),this.fire(new o.Event("data",b))})}loaded(){return this._pendingLoads===0}loadTile(t,n){const l=t.actor?"reloadTile":"loadTile";t.actor=this.actor;const d={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};t.request=this.actor.send(l,d,(f,_)=>(delete t.request,t.unloadVectorData(),t.aborted?n(null):f?n(f):(t.loadVectorData(_,this.map.painter,l==="reloadTile"),n(null))))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.aborted=!0}unloadTile(t){t.unloadVectorData(),this.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id})}onRemove(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})}serialize(){return o.extend({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var jr=o.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class xr extends o.Evented{constructor(t,n,l,d){super(),this.id=t,this.dispatcher=l,this.coordinates=n.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(d),this.options=n}load(t,n){this._loaded=!1,this.fire(new o.Event("dataloading",{dataType:"source"})),this.url=this.options.url,o.getImage(this.map._requestManager.transformRequest(this.url,o.ResourceType.Image),(l,d)=>{this._loaded=!0,l?this.fire(new o.ErrorEvent(l)):d&&(this.image=d,t&&(this.coordinates=t),n&&n(),this._finishLoading())})}loaded(){return this._loaded}updateImage(t){return this.image&&t.url?(this.options.url=t.url,this.load(t.coordinates,()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new o.Event("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}setCoordinates(t){this.coordinates=t;const n=t.map(o.MercatorCoordinate.fromLngLat);this.tileID=function(d){let f=1/0,_=1/0,b=-1/0,w=-1/0;for(const O of d)f=Math.min(f,O.x),_=Math.min(_,O.y),b=Math.max(b,O.x),w=Math.max(w,O.y);const E=Math.max(b-f,w-_),P=Math.max(0,Math.floor(-Math.log(E)/Math.LN2)),L=Math.pow(2,P);return new o.CanonicalTileID(P,Math.floor((f+b)/2*L),Math.floor((_+w)/2*L))}(n),this.minzoom=this.maxzoom=this.tileID.z;const l=n.map(d=>this.tileID.getTilePoint(d)._round());return this._boundsArray=new o.RasterBoundsArray,this._boundsArray.emplaceBack(l[0].x,l[0].y,0,0),this._boundsArray.emplaceBack(l[1].x,l[1].y,o.EXTENT,0),this._boundsArray.emplaceBack(l[3].x,l[3].y,0,o.EXTENT),this._boundsArray.emplaceBack(l[2].x,l[2].y,o.EXTENT,o.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new o.Event("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const t=this.map.painter.context,n=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,jr.members)),this.boundsSegments||(this.boundsSegments=o.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new We(t,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));for(const l in this.tiles){const d=this.tiles[l];d.state!=="loaded"&&(d.state="loaded",d.texture=this.texture)}}loadTile(t,n){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={},n(null)):(t.state="errored",n(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class Dr extends xr{constructor(t,n,l,d){super(t,n,l,d),this.roundZoom=!0,this.type="video",this.options=n}load(){this._loaded=!1;const t=this.options;this.urls=[];for(const n of t.urls)this.urls.push(this.map._requestManager.transformRequest(n,o.ResourceType.Source).url);o.getVideo(this.urls,(n,l)=>{this._loaded=!0,n?this.fire(new o.ErrorEvent(n)):l&&(this.video=l,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){const n=this.video.seekable;t<n.start(0)||t>n.end(0)?this.fire(new o.ErrorEvent(new o.ValidationError(`sources.${this.id}`,null,`Playback for this video can be set only between the ${n.start(0)} and ${n.end(0)}-second mark.`))):this.video.currentTime=t}}getVideo(){return this.video}onAdd(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const t=this.map.painter.context,n=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,jr.members)),this.boundsSegments||(this.boundsSegments=o.SegmentVector.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),n.texSubImage2D(n.TEXTURE_2D,0,0,0,n.RGBA,n.UNSIGNED_BYTE,this.video)):(this.texture=new We(t,this.video,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));for(const l in this.tiles){const d=this.tiles[l];d.state!=="loaded"&&(d.state="loaded",d.texture=this.texture)}}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class Zr extends xr{constructor(t,n,l,d){super(t,n,l,d),n.coordinates?Array.isArray(n.coordinates)&&n.coordinates.length===4&&!n.coordinates.some(f=>!Array.isArray(f)||f.length!==2||f.some(_=>typeof _!="number"))||this.fire(new o.ErrorEvent(new o.ValidationError(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new o.ErrorEvent(new o.ValidationError(`sources.${t}`,null,'missing required property "coordinates"'))),n.animate&&typeof n.animate!="boolean"&&this.fire(new o.ErrorEvent(new o.ValidationError(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),n.canvas?typeof n.canvas=="string"||n.canvas instanceof HTMLCanvasElement||this.fire(new o.ErrorEvent(new o.ValidationError(`sources.${t}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new o.ErrorEvent(new o.ValidationError(`sources.${t}`,null,'missing required property "canvas"'))),this.options=n,this.animate=n.animate===void 0||n.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new o.ErrorEvent(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let t=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const n=this.map.painter.context,l=n.gl;this.boundsBuffer||(this.boundsBuffer=n.createVertexBuffer(this._boundsArray,jr.members)),this.boundsSegments||(this.boundsSegments=o.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new We(n,this.canvas,l.RGBA,{premultiply:!0});for(const d in this.tiles){const f=this.tiles[d];f.state!=="loaded"&&(f.state="loaded",f.texture=this.texture)}}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}}const Yi={vector:_r,raster:kr,"raster-dem":Xi,geojson:qr,video:Dr,image:xr,canvas:Zr};function vr(h,t){const n=o.create();return o.translate(n,n,[1,1,0]),o.scale(n,n,[.5*h.width,.5*h.height,1]),o.multiply(n,n,h.calculatePosMatrix(t.toUnwrapped()))}function br(h,t,n,l,d,f){const _=function(L,O,j){if(L)for(const U of L){const q=O[U];if(q&&q.source===j&&q.type==="fill-extrusion")return!0}else for(const U in O){const q=O[U];if(q.source===j&&q.type==="fill-extrusion")return!0}return!1}(d&&d.layers,t,h.id),b=f.maxPitchScaleFactor(),w=h.tilesIn(l,b,_);w.sort(vn);const E=[];for(const L of w)E.push({wrappedTileID:L.tileID.wrapped().key,queryResults:L.tile.queryRenderedFeatures(t,n,h._state,L.queryGeometry,L.cameraQueryGeometry,L.scale,d,f,b,vr(h.transform,L.tileID))});const P=function(L){const O={},j={};for(const U of L){const q=U.queryResults,ee=U.wrappedTileID,te=j[ee]=j[ee]||{};for(const ne in q){const ie=q[ne],fe=te[ne]=te[ne]||{},ce=O[ne]=O[ne]||[];for(const ue of ie)fe[ue.featureIndex]||(fe[ue.featureIndex]=!0,ce.push(ue))}}return O}(E);for(const L in P)P[L].forEach(O=>{const j=O.feature,U=h.getFeatureState(j.layer["source-layer"],j.id);j.source=j.layer.source,j.layer["source-layer"]&&(j.sourceLayer=j.layer["source-layer"]),j.state=U});return P}function vn(h,t){const n=h.tileID,l=t.tileID;return n.overscaledZ-l.overscaledZ||n.canonical.y-l.canonical.y||n.wrap-l.wrap||n.canonical.x-l.canonical.x}class Ta{constructor(t,n){this.tileID=t,this.uid=o.uniqueId(),this.uses=0,this.tileSize=n,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(t){const n=t+this.timeAdded;n<o.exported.now()||this.fadeEndTime&&n<this.fadeEndTime||(this.fadeEndTime=n)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}loadVectorData(t,n,l){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",t){t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestFeatureIndex.rawTileData=t.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=function(d,f){const _={};if(!f)return _;for(const b of d){const w=b.layerIds.map(E=>f.getLayer(E)).filter(Boolean);if(w.length!==0){b.layers=w,b.stateDependentLayerIds&&(b.stateDependentLayers=b.stateDependentLayerIds.map(E=>w.filter(P=>P.id===E)[0]));for(const E of w)_[E.id]=b}}return _}(t.buckets,n.style),this.hasSymbolBuckets=!1;for(const d in this.buckets){const f=this.buckets[d];if(f instanceof o.SymbolBucket){if(this.hasSymbolBuckets=!0,!l)break;f.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const d in this.buckets){const f=this.buckets[d];if(f instanceof o.SymbolBucket&&f.hasRTLText){this.hasRTLText=!0,o.lazyLoadRTLTextPlugin();break}}this.queryPadding=0;for(const d in this.buckets){const f=this.buckets[d];this.queryPadding=Math.max(this.queryPadding,n.style.getLayer(d).queryRadius(f))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage)}else this.collisionBoxArray=new o.CollisionBoxArray}unloadVectorData(){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(t){return this.buckets[t.id]}upload(t){for(const l in this.buckets){const d=this.buckets[l];d.uploadPending()&&d.upload(t)}const n=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new We(t,this.imageAtlas.image,n.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new We(t,this.glyphAtlasImage,n.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,n,l,d,f,_,b,w,E,P){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:d,cameraQueryGeometry:f,scale:_,tileSize:this.tileSize,pixelPosMatrix:P,transform:w,params:b,queryPadding:this.queryPadding*E},t,n,l):{}}querySourceFeatures(t,n){const l=this.latestFeatureIndex;if(!l||!l.rawTileData)return;const d=l.loadVTLayers(),f=n?n.sourceLayer:"",_=d._geojsonTileLayer||d[f];if(!_)return;const b=o.createFilter(n&&n.filter),{z:w,x:E,y:P}=this.tileID.canonical,L={z:w,x:E,y:P};for(let O=0;O<_.length;O++){const j=_.feature(O);if(b.needGeometry){const ee=o.toEvaluationFeature(j,!0);if(!b.filter(new o.EvaluationParameters(this.tileID.overscaledZ),ee,this.tileID.canonical))continue}else if(!b.filter(new o.EvaluationParameters(this.tileID.overscaledZ),j))continue;const U=l.getId(j,f),q=new o.GeoJSONFeature(j,w,E,P,U);q.tile=L,t.push(q)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(t){const n=this.expirationTime;if(t.cacheControl){const l=o.parseCacheControl(t.cacheControl);l["max-age"]&&(this.expirationTime=Date.now()+1e3*l["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){const l=Date.now();let d=!1;if(this.expirationTime>l)d=!1;else if(n)if(this.expirationTime<n)d=!0;else{const f=this.expirationTime-n;f?this.expirationTime=l+Math.max(f,3e4):d=!0}else d=!0;d?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}setFeatureState(t,n){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(t).length===0)return;const l=this.latestFeatureIndex.loadVTLayers();for(const d in this.buckets){if(!n.style.hasLayer(d))continue;const f=this.buckets[d],_=f.layers[0].sourceLayer||"_geojsonTileLayer",b=l[_],w=t[_];if(!b||!w||Object.keys(w).length===0)continue;f.update(w,b,this.imageAtlas&&this.imageAtlas.patternPositions||{});const E=n&&n.style&&n.style.getLayer(d);E&&(this.queryPadding=Math.max(this.queryPadding,E.queryRadius(f)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<o.exported.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(t){this.symbolFadeHoldUntil=o.exported.now()+t}setDependencies(t,n){const l={};for(const d of n)l[d]=!0;this.dependencies[t]=l}hasDependency(t,n){for(const l of t){const d=this.dependencies[l];if(d){for(const f of n)if(d[f])return!0}}return!1}}class Wn{constructor(t,n){this.max=t,this.onRemove=n,this.reset()}reset(){for(const t in this.data)for(const n of this.data[t])n.timeout&&clearTimeout(n.timeout),this.onRemove(n.value);return this.data={},this.order=[],this}add(t,n,l){const d=t.wrapped().key;this.data[d]===void 0&&(this.data[d]=[]);const f={value:n,timeout:void 0};if(l!==void 0&&(f.timeout=setTimeout(()=>{this.remove(t,f)},l)),this.data[d].push(f),this.order.push(d),this.order.length>this.max){const _=this._getAndRemoveByKey(this.order[0]);_&&this.onRemove(_)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){const n=this.data[t].shift();return n.timeout&&clearTimeout(n.timeout),this.data[t].length===0&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),n.value}getByKey(t){const n=this.data[t];return n?n[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,n){if(!this.has(t))return this;const l=t.wrapped().key,d=n===void 0?0:this.data[l].indexOf(n),f=this.data[l][d];return this.data[l].splice(d,1),f.timeout&&clearTimeout(f.timeout),this.data[l].length===0&&delete this.data[l],this.onRemove(f.value),this.order.splice(this.order.indexOf(l),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const n=this._getAndRemoveByKey(this.order[0]);n&&this.onRemove(n)}return this}filter(t){const n=[];for(const l in this.data)for(const d of this.data[l])t(d.value)||n.push(d);for(const l of n)this.remove(l.value.tileID,l)}}class Ia{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,n,l){const d=String(n);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][d]=this.stateChanges[t][d]||{},o.extend(this.stateChanges[t][d],l),this.deletedStates[t]===null){this.deletedStates[t]={};for(const f in this.state[t])f!==d&&(this.deletedStates[t][f]=null)}else if(this.deletedStates[t]&&this.deletedStates[t][d]===null){this.deletedStates[t][d]={};for(const f in this.state[t][d])l[f]||(this.deletedStates[t][d][f]=null)}else for(const f in l)this.deletedStates[t]&&this.deletedStates[t][d]&&this.deletedStates[t][d][f]===null&&delete this.deletedStates[t][d][f]}removeFeatureState(t,n,l){if(this.deletedStates[t]===null)return;const d=String(n);if(this.deletedStates[t]=this.deletedStates[t]||{},l&&n!==void 0)this.deletedStates[t][d]!==null&&(this.deletedStates[t][d]=this.deletedStates[t][d]||{},this.deletedStates[t][d][l]=null);else if(n!==void 0)if(this.stateChanges[t]&&this.stateChanges[t][d])for(l in this.deletedStates[t][d]={},this.stateChanges[t][d])this.deletedStates[t][d][l]=null;else this.deletedStates[t][d]=null;else this.deletedStates[t]=null}getState(t,n){const l=String(n),d=o.extend({},(this.state[t]||{})[l],(this.stateChanges[t]||{})[l]);if(this.deletedStates[t]===null)return{};if(this.deletedStates[t]){const f=this.deletedStates[t][n];if(f===null)return{};for(const _ in f)delete d[_]}return d}initializeTileState(t,n){t.setFeatureState(this.state,n)}coalesceChanges(t,n){const l={};for(const d in this.stateChanges){this.state[d]=this.state[d]||{};const f={};for(const _ in this.stateChanges[d])this.state[d][_]||(this.state[d][_]={}),o.extend(this.state[d][_],this.stateChanges[d][_]),f[_]=this.state[d][_];l[d]=f}for(const d in this.deletedStates){this.state[d]=this.state[d]||{};const f={};if(this.deletedStates[d]===null)for(const _ in this.state[d])f[_]={},this.state[d][_]={};else for(const _ in this.deletedStates[d]){if(this.deletedStates[d][_]===null)this.state[d][_]={};else for(const b of Object.keys(this.deletedStates[d][_]))delete this.state[d][_][b];f[_]=this.state[d][_]}l[d]=l[d]||{},o.extend(l[d],f)}if(this.stateChanges={},this.deletedStates={},Object.keys(l).length!==0)for(const d in t)t[d].setFeatureState(l,n)}}class si extends o.Evented{constructor(t,n,l){super(),this.id=t,this.dispatcher=l,this.on("data",d=>{d.dataType==="source"&&d.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&d.dataType==="source"&&d.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform))}),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=function(d,f,_,b){const w=new Yi[f.type](d,f,_,b);if(w.id!==d)throw new Error(`Expected Source id to be ${d} instead of ${w.id}`);return o.bindAll(["load","abort","unload","serialize","prepare"],w),w}(t,n,l,this),this._tiles={},this._cache=new Wn(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Ia}onAdd(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._source&&this._source.onAdd&&this._source.onAdd(t)}onRemove(t){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(t)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(const t in this._tiles){const n=this._tiles[t];if(n.state!=="loaded"&&n.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(t,n){return this._source.loadTile(t,n)}_unloadTile(t){if(this._source.unloadTile)return this._source.unloadTile(t,()=>{})}_abortTile(t){this._source.abortTile&&this._source.abortTile(t,()=>{}),this._source.fire(new o.Event("dataabort",{tile:t,coord:t.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const n in this._tiles){const l=this._tiles[n];l.upload(t),l.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(t=>t.tileID).sort(Rr).map(t=>t.key)}getRenderableIds(t){const n=[];for(const l in this._tiles)this._isIdRenderable(l,t)&&n.push(this._tiles[l]);return t?n.sort((l,d)=>{const f=l.tileID,_=d.tileID,b=new o.pointGeometry(f.canonical.x,f.canonical.y)._rotate(this.transform.angle),w=new o.pointGeometry(_.canonical.x,_.canonical.y)._rotate(this.transform.angle);return f.overscaledZ-_.overscaledZ||w.y-b.y||w.x-b.x}).map(l=>l.tileID.key):n.map(l=>l.tileID).sort(Rr).map(l=>l.key)}hasRenderableParent(t){const n=this.findLoadedParent(t,0);return!!n&&this._isIdRenderable(n.tileID.key)}_isIdRenderable(t,n){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(n||!this._tiles[t].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const t in this._tiles)this._tiles[t].state!=="errored"&&this._reloadTile(t,"reloading")}}_reloadTile(t,n){const l=this._tiles[t];l&&(l.state!=="loading"&&(l.state=n),this._loadTile(l,this._tileLoaded.bind(this,l,t,n)))}_tileLoaded(t,n,l,d){if(d)return t.state="errored",void(d.status!==404?this._source.fire(new o.ErrorEvent(d,{tile:t})):this.update(this.transform));t.timeAdded=o.exported.now(),l==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(n,t),this.getSource().type==="raster-dem"&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new o.Event("data",{dataType:"source",tile:t,coord:t.tileID}))}_backfillDEM(t){const n=this.getRenderableIds();for(let d=0;d<n.length;d++){const f=n[d];if(t.neighboringTiles&&t.neighboringTiles[f]){const _=this.getTileByID(f);l(t,_),l(_,t)}}function l(d,f){d.needsHillshadePrepare=!0;let _=f.tileID.canonical.x-d.tileID.canonical.x;const b=f.tileID.canonical.y-d.tileID.canonical.y,w=Math.pow(2,d.tileID.canonical.z),E=f.tileID.key;_===0&&b===0||Math.abs(b)>1||(Math.abs(_)>1&&(Math.abs(_+w)===1?_+=w:Math.abs(_-w)===1&&(_-=w)),f.dem&&d.dem&&(d.dem.backfillBorder(f.dem,_,b),d.neighboringTiles&&d.neighboringTiles[E]&&(d.neighboringTiles[E].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,n,l,d){for(const f in this._tiles){let _=this._tiles[f];if(d[f]||!_.hasData()||_.tileID.overscaledZ<=n||_.tileID.overscaledZ>l)continue;let b=_.tileID;for(;_&&_.tileID.overscaledZ>n+1;){const E=_.tileID.scaledTo(_.tileID.overscaledZ-1);_=this._tiles[E.key],_&&_.hasData()&&(b=E)}let w=b;for(;w.overscaledZ>n;)if(w=w.scaledTo(w.overscaledZ-1),t[w.key]){d[b.key]=b;break}}}findLoadedParent(t,n){if(t.key in this._loadedParentTiles){const l=this._loadedParentTiles[t.key];return l&&l.tileID.overscaledZ>=n?l:null}for(let l=t.overscaledZ-1;l>=n;l--){const d=t.scaledTo(l),f=this._getLoadedTile(d);if(f)return f}}_getLoadedTile(t){const n=this._tiles[t.key];return n&&n.hasData()?n:this._cache.getByKey(t.wrapped().key)}updateCacheSize(t){const n=Math.ceil(t.width/this._source.tileSize)+1,l=Math.ceil(t.height/this._source.tileSize)+1,d=Math.floor(n*l*5),f=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,d):d;this._cache.setMaxSize(f)}handleWrapJump(t){const n=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);if(this._prevLng=t,n){const l={};for(const d in this._tiles){const f=this._tiles[d];f.tileID=f.tileID.unwrapTo(f.tileID.wrap+n),l[f.tileID.key]=f}this._tiles=l;for(const d in this._timers)clearTimeout(this._timers[d]),delete this._timers[d];for(const d in this._tiles)this._setTileReloadTimer(d,this._tiles[d])}}update(t){if(this.transform=t,!this._sourceLoaded||this._paused)return;let n;this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used?this._source.tileID?n=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(w=>new o.OverscaledTileID(w.canonical.z,w.wrap,w.canonical.z,w.canonical.x,w.canonical.y)):(n=t.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}),this._source.hasTile&&(n=n.filter(w=>this._source.hasTile(w)))):n=[];const l=t.coveringZoomLevel(this._source),d=Math.max(l-si.maxOverzooming,this._source.minzoom),f=Math.max(l+si.maxUnderzooming,this._source.minzoom),_=this._updateRetainedTiles(n,l);if(Hn(this._source.type)){const w={},E={},P=Object.keys(_);for(const L of P){const O=_[L],j=this._tiles[L];if(!j||j.fadeEndTime&&j.fadeEndTime<=o.exported.now())continue;const U=this.findLoadedParent(O,d);U&&(this._addTile(U.tileID),w[U.tileID.key]=U.tileID),E[L]=O}this._retainLoadedChildren(E,l,f,_);for(const L in w)_[L]||(this._coveredTiles[L]=!0,_[L]=w[L])}for(const w in _)this._tiles[w].clearFadeHold();const b=o.keysDifference(this._tiles,_);for(const w of b){const E=this._tiles[w];E.hasSymbolBuckets&&!E.holdingForFade()?E.setHoldDuration(this.map._fadeDuration):E.hasSymbolBuckets&&!E.symbolFadeFinished()||this._removeTile(w)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)}_updateRetainedTiles(t,n){const l={},d={},f=Math.max(n-si.maxOverzooming,this._source.minzoom),_=Math.max(n+si.maxUnderzooming,this._source.minzoom),b={};for(const w of t){const E=this._addTile(w);l[w.key]=w,E.hasData()||n<this._source.maxzoom&&(b[w.key]=w)}this._retainLoadedChildren(b,n,_,l);for(const w of t){let E=this._tiles[w.key];if(E.hasData())continue;if(n+1>this._source.maxzoom){const L=w.children(this._source.maxzoom)[0],O=this.getTile(L);if(O&&O.hasData()){l[L.key]=L;continue}}else{const L=w.children(this._source.maxzoom);if(l[L[0].key]&&l[L[1].key]&&l[L[2].key]&&l[L[3].key])continue}let P=E.wasRequested();for(let L=w.overscaledZ-1;L>=f;--L){const O=w.scaledTo(L);if(d[O.key]||(d[O.key]=!0,E=this.getTile(O),!E&&P&&(E=this._addTile(O)),E&&(l[O.key]=O,P=E.wasRequested(),E.hasData())))break}}return l}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const n=[];let l,d=this._tiles[t].tileID;for(;d.overscaledZ>0;){if(d.key in this._loadedParentTiles){l=this._loadedParentTiles[d.key];break}n.push(d.key);const f=d.scaledTo(d.overscaledZ-1);if(l=this._getLoadedTile(f),l)break;d=f}for(const f of n)this._loadedParentTiles[f]=l}}_addTile(t){let n=this._tiles[t.key];if(n)return n;n=this._cache.getAndRemove(t),n&&(this._setTileReloadTimer(t.key,n),n.tileID=t,this._state.initializeTileState(n,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,n)));const l=n;return n||(n=new Ta(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(n,this._tileLoaded.bind(this,n,t.key,n.state))),n.uses++,this._tiles[t.key]=n,l||this._source.fire(new o.Event("dataloading",{tile:n,coord:n.tileID,dataType:"source"})),n}_setTileReloadTimer(t,n){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const l=n.getExpiryTimeout();l&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},l))}_removeTile(t){const n=this._tiles[t];n&&(n.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),n.uses>0||(n.hasData()&&n.state!=="reloading"?this._cache.add(n.tileID,n,n.getExpiryTimeout()):(n.aborted=!0,this._abortTile(n),this._unloadTile(n))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(t);this._cache.reset()}tilesIn(t,n,l){const d=[],f=this.transform;if(!f)return d;const _=l?f.getCameraQueryGeometry(t):t,b=t.map(U=>f.pointCoordinate(U)),w=_.map(U=>f.pointCoordinate(U)),E=this.getIds();let P=1/0,L=1/0,O=-1/0,j=-1/0;for(const U of w)P=Math.min(P,U.x),L=Math.min(L,U.y),O=Math.max(O,U.x),j=Math.max(j,U.y);for(let U=0;U<E.length;U++){const q=this._tiles[E[U]];if(q.holdingForFade())continue;const ee=q.tileID,te=Math.pow(2,f.zoom-q.tileID.overscaledZ),ne=n*q.queryPadding*o.EXTENT/q.tileSize/te,ie=[ee.getTilePoint(new o.MercatorCoordinate(P,L)),ee.getTilePoint(new o.MercatorCoordinate(O,j))];if(ie[0].x-ne<o.EXTENT&&ie[0].y-ne<o.EXTENT&&ie[1].x+ne>=0&&ie[1].y+ne>=0){const fe=b.map(ue=>ee.getTilePoint(ue)),ce=w.map(ue=>ee.getTilePoint(ue));d.push({tile:q,tileID:ee,queryGeometry:fe,cameraQueryGeometry:ce,scale:te})}}return d}getVisibleCoordinates(t){const n=this.getRenderableIds(t).map(l=>this._tiles[l].tileID);for(const l of n)l.posMatrix=this.transform.calculatePosMatrix(l.toUnwrapped());return n}hasTransition(){if(this._source.hasTransition())return!0;if(Hn(this._source.type))for(const t in this._tiles){const n=this._tiles[t];if(n.fadeEndTime!==void 0&&n.fadeEndTime>=o.exported.now())return!0}return!1}setFeatureState(t,n,l){this._state.updateState(t=t||"_geojsonTileLayer",n,l)}removeFeatureState(t,n,l){this._state.removeFeatureState(t=t||"_geojsonTileLayer",n,l)}getFeatureState(t,n){return this._state.getState(t=t||"_geojsonTileLayer",n)}setDependencies(t,n,l){const d=this._tiles[t];d&&d.setDependencies(n,l)}reloadTilesForDependencies(t,n){for(const l in this._tiles)this._tiles[l].hasDependency(t,n)&&this._reloadTile(l,"reloading");this._cache.filter(l=>!l.hasDependency(t,n))}}function Rr(h,t){const n=Math.abs(2*h.wrap)-+(h.wrap<0),l=Math.abs(2*t.wrap)-+(t.wrap<0);return h.overscaledZ-t.overscaledZ||l-n||t.canonical.y-h.canonical.y||t.canonical.x-h.canonical.x}function Hn(h){return h==="raster"||h==="image"||h==="video"}si.maxOverzooming=10,si.maxUnderzooming=3;const Wr="mapboxgl_preloaded_worker_pool";class ar{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<ar.workerCount;)this.workers.push(new Worker(fa.workerUrl));return this.active[t]=!0,this.workers.slice()}release(t){delete this.active[t],this.numActive()===0&&(this.workers.forEach(n=>{n.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Wr]}numActive(){return Object.keys(this.active).length}}const Ea=Math.floor(o.exported.hardwareConcurrency/2);let wr;function sr(){return wr||(wr=new ar),wr}function or(h,t){const n={};for(const l in h)l!=="ref"&&(n[l]=h[l]);return o.refProperties.forEach(l=>{l in t&&(n[l]=t[l])}),n}function Xn(h){h=h.slice();const t=Object.create(null);for(let n=0;n<h.length;n++)t[h[n].id]=h[n];for(let n=0;n<h.length;n++)"ref"in h[n]&&(h[n]=or(h[n],t[h[n].ref]));return h}ar.workerCount=Math.max(Math.min(Ea,6),1);const mt={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight"};function Hr(h,t,n){n.push({command:mt.addSource,args:[h,t[h]]})}function Br(h,t,n){t.push({command:mt.removeSource,args:[h]}),n[h]=!0}function Xr(h,t,n,l){Br(h,n,l),Hr(h,t,n)}function Yn(h,t,n){let l;for(l in h[n])if(Object.prototype.hasOwnProperty.call(h[n],l)&&l!=="data"&&!ae(h[n][l],t[n][l]))return!1;for(l in t[n])if(Object.prototype.hasOwnProperty.call(t[n],l)&&l!=="data"&&!ae(h[n][l],t[n][l]))return!1;return!0}function de(h,t,n,l,d,f){let _;for(_ in t=t||{},h=h||{})Object.prototype.hasOwnProperty.call(h,_)&&(ae(h[_],t[_])||n.push({command:f,args:[l,_,t[_],d]}));for(_ in t)Object.prototype.hasOwnProperty.call(t,_)&&!Object.prototype.hasOwnProperty.call(h,_)&&(ae(h[_],t[_])||n.push({command:f,args:[l,_,t[_],d]}))}function Ae(h){return h.id}function Yr(h,t){return h[t.id]=t,h}class Sr{constructor(t,n){this.reset(t,n)}reset(t,n){this.points=t||[],this._distances=[0];for(let l=1;l<this.points.length;l++)this._distances[l]=this._distances[l-1]+this.points[l].dist(this.points[l-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(n||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(t){if(this.points.length===1)return this.points[0];t=o.clamp(t,0,1);let n=1,l=this._distances[n];const d=t*this.paddedLength+this.padding;for(;l<d&&n<this._distances.length;)l=this._distances[++n];const f=n-1,_=this._distances[f],b=l-_,w=b>0?(d-_)/b:0;return this.points[f].mult(1-w).add(this.points[n].mult(w))}}function Ct(h,t){let n=!0;return h==="always"||h!=="never"&&t!=="never"||(n=!1),n}class $i{constructor(t,n,l){const d=this.boxCells=[],f=this.circleCells=[];this.xCellCount=Math.ceil(t/l),this.yCellCount=Math.ceil(n/l);for(let _=0;_<this.xCellCount*this.yCellCount;_++)d.push([]),f.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=n,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/n,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(t,n,l,d,f){this._forEachCell(n,l,d,f,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(n),this.bboxes.push(l),this.bboxes.push(d),this.bboxes.push(f)}insertCircle(t,n,l,d){this._forEachCell(n-d,l-d,n+d,l+d,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(n),this.circles.push(l),this.circles.push(d)}_insertBoxCell(t,n,l,d,f,_){this.boxCells[f].push(_)}_insertCircleCell(t,n,l,d,f,_){this.circleCells[f].push(_)}_query(t,n,l,d,f,_,b){if(l<0||t>this.width||d<0||n>this.height)return[];const w=[];if(t<=0&&n<=0&&this.width<=l&&this.height<=d){if(f)return[{key:null,x1:t,y1:n,x2:l,y2:d}];for(let E=0;E<this.boxKeys.length;E++)w.push({key:this.boxKeys[E],x1:this.bboxes[4*E],y1:this.bboxes[4*E+1],x2:this.bboxes[4*E+2],y2:this.bboxes[4*E+3]});for(let E=0;E<this.circleKeys.length;E++){const P=this.circles[3*E],L=this.circles[3*E+1],O=this.circles[3*E+2];w.push({key:this.circleKeys[E],x1:P-O,y1:L-O,x2:P+O,y2:L+O})}}else this._forEachCell(t,n,l,d,this._queryCell,w,{hitTest:f,overlapMode:_,seenUids:{box:{},circle:{}}},b);return w}query(t,n,l,d){return this._query(t,n,l,d,!1,null)}hitTest(t,n,l,d,f,_){return this._query(t,n,l,d,!0,f,_).length>0}hitTestCircle(t,n,l,d,f){const _=t-l,b=t+l,w=n-l,E=n+l;if(b<0||_>this.width||E<0||w>this.height)return!1;const P=[];return this._forEachCell(_,w,b,E,this._queryCellCircle,P,{hitTest:!0,overlapMode:d,circle:{x:t,y:n,radius:l},seenUids:{box:{},circle:{}}},f),P.length>0}_queryCell(t,n,l,d,f,_,b,w){const{seenUids:E,hitTest:P,overlapMode:L}=b,O=this.boxCells[f];if(O!==null){const U=this.bboxes;for(const q of O)if(!E.box[q]){E.box[q]=!0;const ee=4*q,te=this.boxKeys[q];if(t<=U[ee+2]&&n<=U[ee+3]&&l>=U[ee+0]&&d>=U[ee+1]&&(!w||w(te))&&(!P||!Ct(L,te.overlapMode))&&(_.push({key:te,x1:U[ee],y1:U[ee+1],x2:U[ee+2],y2:U[ee+3]}),P))return!0}}const j=this.circleCells[f];if(j!==null){const U=this.circles;for(const q of j)if(!E.circle[q]){E.circle[q]=!0;const ee=3*q,te=this.circleKeys[q];if(this._circleAndRectCollide(U[ee],U[ee+1],U[ee+2],t,n,l,d)&&(!w||w(te))&&(!P||!Ct(L,te.overlapMode))){const ne=U[ee],ie=U[ee+1],fe=U[ee+2];if(_.push({key:te,x1:ne-fe,y1:ie-fe,x2:ne+fe,y2:ie+fe}),P)return!0}}}return!1}_queryCellCircle(t,n,l,d,f,_,b,w){const{circle:E,seenUids:P,overlapMode:L}=b,O=this.boxCells[f];if(O!==null){const U=this.bboxes;for(const q of O)if(!P.box[q]){P.box[q]=!0;const ee=4*q,te=this.boxKeys[q];if(this._circleAndRectCollide(E.x,E.y,E.radius,U[ee+0],U[ee+1],U[ee+2],U[ee+3])&&(!w||w(te))&&!Ct(L,te.overlapMode))return _.push(!0),!0}}const j=this.circleCells[f];if(j!==null){const U=this.circles;for(const q of j)if(!P.circle[q]){P.circle[q]=!0;const ee=3*q,te=this.circleKeys[q];if(this._circlesCollide(U[ee],U[ee+1],U[ee+2],E.x,E.y,E.radius)&&(!w||w(te))&&!Ct(L,te.overlapMode))return _.push(!0),!0}}}_forEachCell(t,n,l,d,f,_,b,w){const E=this._convertToXCellCoord(t),P=this._convertToYCellCoord(n),L=this._convertToXCellCoord(l),O=this._convertToYCellCoord(d);for(let j=E;j<=L;j++)for(let U=P;U<=O;U++)if(f.call(this,t,n,l,d,this.xCellCount*U+j,_,b,w))return}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,n,l,d,f,_){const b=d-t,w=f-n,E=l+_;return E*E>b*b+w*w}_circleAndRectCollide(t,n,l,d,f,_,b){const w=(_-d)/2,E=Math.abs(t-(d+w));if(E>w+l)return!1;const P=(b-f)/2,L=Math.abs(n-(f+P));if(L>P+l)return!1;if(E<=w||L<=P)return!0;const O=E-w,j=L-P;return O*O+j*j<=l*l}}function yi(h,t,n,l,d){const f=o.create();return t?(o.scale(f,f,[1/d,1/d,1]),n||o.rotateZ(f,f,l.angle)):o.multiply(f,l.labelPlaneMatrix,h),f}function Kr(h,t,n,l,d){if(t){const f=o.clone(h);return o.scale(f,f,[d,d,1]),n||o.rotateZ(f,f,-l.angle),f}return l.glCoordMatrix}function kt(h,t){const n=[h.x,h.y,0,1];Mt(n,n,t);const l=n[3];return{point:new o.pointGeometry(n[0]/l,n[1]/l),signedDistanceFromCamera:l}}function Ie(h,t){return .5+h/t*.5}function st(h,t){const n=h[0]/h[3],l=h[1]/h[3];return n>=-t[0]&&n<=t[0]&&l>=-t[1]&&l<=t[1]}function rt(h,t,n,l,d,f,_,b,w){const E=l?h.textSizeData:h.iconSizeData,P=o.evaluateSizeForZoom(E,n.transform.zoom),L=[256/n.width*2+1,256/n.height*2+1],O=l?h.text.dynamicLayoutVertexArray:h.icon.dynamicLayoutVertexArray;O.clear();const j=h.lineVertexArray,U=l?h.text.placedSymbolArray:h.icon.placedSymbolArray,q=n.transform.width/n.transform.height;let ee=!1;for(let te=0;te<U.length;te++){const ne=U.get(te);if(ne.hidden||ne.writingMode===o.WritingMode.vertical&&!ee){Yt(ne.numGlyphs,O);continue}ee=!1;const ie=[ne.anchorX,ne.anchorY,0,1];if(o.transformMat4(ie,ie,t),!st(ie,L)){Yt(ne.numGlyphs,O);continue}const fe=Ie(n.transform.cameraToCenterDistance,ie[3]),ce=o.evaluateSizeForFeature(E,P,ne),ue=_?ce/fe:ce*fe,ve=new o.pointGeometry(ne.anchorX,ne.anchorY),Se=kt(ve,d).point,me={},Fe=nt(ne,ue,!1,b,t,d,f,h.glyphOffsetArray,j,O,Se,ve,me,q,w);ee=Fe.useVertical,(Fe.notEnoughRoom||ee||Fe.needsFlipping&&nt(ne,ue,!0,b,t,d,f,h.glyphOffsetArray,j,O,Se,ve,me,q,w).notEnoughRoom)&&Yt(ne.numGlyphs,O)}l?h.text.dynamicLayoutVertexBuffer.updateData(O):h.icon.dynamicLayoutVertexBuffer.updateData(O)}function _i(h,t,n,l,d,f,_,b,w,E,P,L){const O=b.glyphStartIndex+b.numGlyphs,j=b.lineStartIndex,U=b.lineStartIndex+b.lineLength,q=t.getoffsetX(b.glyphStartIndex),ee=t.getoffsetX(O-1),te=Ji(h*q,n,l,d,f,_,b.segment,j,U,w,E,P,L);if(!te)return null;const ne=Ji(h*ee,n,l,d,f,_,b.segment,j,U,w,E,P,L);return ne?{first:te,last:ne}:null}function Ki(h,t,n,l){return h===o.WritingMode.horizontal&&Math.abs(n.y-t.y)>Math.abs(n.x-t.x)*l?{useVertical:!0}:(h===o.WritingMode.vertical?t.y<n.y:t.x>n.x)?{needsFlipping:!0}:null}function nt(h,t,n,l,d,f,_,b,w,E,P,L,O,j,U){const q=t/24,ee=h.lineOffsetX*q,te=h.lineOffsetY*q;let ne;if(h.numGlyphs>1){const ie=h.glyphStartIndex+h.numGlyphs,fe=h.lineStartIndex,ce=h.lineStartIndex+h.lineLength,ue=_i(q,b,ee,te,n,P,L,h,w,f,O,U);if(!ue)return{notEnoughRoom:!0};const ve=kt(ue.first.point,_).point,Se=kt(ue.last.point,_).point;if(l&&!n){const me=Ki(h.writingMode,ve,Se,j);if(me)return me}ne=[ue.first];for(let me=h.glyphStartIndex+1;me<ie-1;me++)ne.push(Ji(q*b.getoffsetX(me),ee,te,n,P,L,h.segment,fe,ce,w,f,O,U));ne.push(ue.last)}else{if(l&&!n){const fe=kt(L,d).point,ce=h.lineStartIndex+h.segment+1,ue=new o.pointGeometry(w.getx(ce),w.gety(ce)),ve=kt(ue,d),Se=ve.signedDistanceFromCamera>0?ve.point:Jr(L,ue,fe,1,d),me=Ki(h.writingMode,fe,Se,j);if(me)return me}const ie=Ji(q*b.getoffsetX(h.glyphStartIndex),ee,te,n,P,L,h.segment,h.lineStartIndex,h.lineStartIndex+h.lineLength,w,f,O,U);if(!ie)return{notEnoughRoom:!0};ne=[ie]}for(const ie of ne)o.addDynamicAttributes(E,ie.point,ie.angle);return{}}function Jr(h,t,n,l,d){const f=kt(h.add(h.sub(t)._unit()),d).point,_=n.sub(f);return n.add(_._mult(l/_.mag()))}function Ji(h,t,n,l,d,f,_,b,w,E,P,L,O){const j=l?h-t:h+t;let U=j>0?1:-1,q=0;l&&(U*=-1,q=Math.PI),U<0&&(q+=Math.PI);let ee=U>0?b+_:b+_+1,te=d,ne=d,ie=0,fe=0;const ce=Math.abs(j),ue=[];for(;ie+fe<=ce;){if(ee+=U,ee<b||ee>=w)return null;if(ne=te,ue.push(te),te=L[ee],te===void 0){const Ce=new o.pointGeometry(E.getx(ee),E.gety(ee)),Je=kt(Ce,P);if(Je.signedDistanceFromCamera>0)te=L[ee]=Je.point;else{const ft=ee-U;te=Jr(ie===0?f:new o.pointGeometry(E.getx(ft),E.gety(ft)),Ce,ne,ce-ie+1,P)}}ie+=fe,fe=ne.dist(te)}const ve=(ce-ie)/fe,Se=te.sub(ne),me=Se.mult(ve)._add(ne);me._add(Se._unit()._perp()._mult(n*U));const Fe=q+Math.atan2(te.y-ne.y,te.x-ne.x);return ue.push(me),{point:me,angle:O?Fe:0,path:ue}}const Tr=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Yt(h,t){for(let n=0;n<h;n++){const l=t.length;t.resize(l+4),t.float32.set(Tr,3*l)}}function Mt(h,t,n){const l=t[0],d=t[1];return h[0]=n[0]*l+n[4]*d+n[12],h[1]=n[1]*l+n[5]*d+n[13],h[3]=n[3]*l+n[7]*d+n[15],h}const Ni=100;class Qr{constructor(t,n=new $i(t.width+200,t.height+200,25),l=new $i(t.width+200,t.height+200,25)){this.transform=t,this.grid=n,this.ignoredGrid=l,this.pitchfactor=Math.cos(t._pitch)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+Ni,this.screenBottomBoundary=t.height+Ni,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200}placeCollisionBox(t,n,l,d,f){const _=this.projectAndGetPerspectiveRatio(d,t.anchorPointX,t.anchorPointY),b=l*_.perspectiveRatio,w=t.x1*b+_.point.x,E=t.y1*b+_.point.y,P=t.x2*b+_.point.x,L=t.y2*b+_.point.y;return!this.isInsideGrid(w,E,P,L)||n!=="always"&&this.grid.hitTest(w,E,P,L,n,f)?{box:[],offscreen:!1}:{box:[w,E,P,L],offscreen:this.isOffscreen(w,E,P,L)}}placeCollisionCircles(t,n,l,d,f,_,b,w,E,P,L,O,j){const U=[],q=new o.pointGeometry(n.anchorX,n.anchorY),ee=kt(q,_),te=Ie(this.transform.cameraToCenterDistance,ee.signedDistanceFromCamera),ne=(P?f/te:f*te)/o.ONE_EM,ie=kt(q,b).point,fe=_i(ne,d,n.lineOffsetX*ne,n.lineOffsetY*ne,!1,ie,q,n,l,b,{},!1);let ce=!1,ue=!1,ve=!0;if(fe){const Se=.5*O*te+j,me=new o.pointGeometry(-100,-100),Fe=new o.pointGeometry(this.screenRightBoundary,this.screenBottomBoundary),Ce=new Sr,Je=fe.first,ft=fe.last;let ct=[];for(let et=Je.path.length-1;et>=1;et--)ct.push(Je.path[et]);for(let et=1;et<ft.path.length;et++)ct.push(ft.path[et]);const dt=2.5*Se;if(w){const et=ct.map(_t=>kt(_t,w));ct=et.some(_t=>_t.signedDistanceFromCamera<=0)?[]:et.map(_t=>_t.point)}let Vt=[];if(ct.length>0){const et=ct[0].clone(),_t=ct[0].clone();for(let It=1;It<ct.length;It++)et.x=Math.min(et.x,ct[It].x),et.y=Math.min(et.y,ct[It].y),_t.x=Math.max(_t.x,ct[It].x),_t.y=Math.max(_t.y,ct[It].y);Vt=et.x>=me.x&&_t.x<=Fe.x&&et.y>=me.y&&_t.y<=Fe.y?[ct]:_t.x<me.x||et.x>Fe.x||_t.y<me.y||et.y>Fe.y?[]:o.clipLine([ct],me.x,me.y,Fe.x,Fe.y)}for(const et of Vt){Ce.reset(et,.25*Se);let _t=0;_t=Ce.length<=.5*Se?1:Math.ceil(Ce.paddedLength/dt)+1;for(let It=0;It<_t;It++){const ui=It/Math.max(_t-1,1),ki=Ce.lerp(ui),Gi=ki.x+Ni,qi=ki.y+Ni;U.push(Gi,qi,Se,0);const Or=Gi-Se,Ci=qi-Se,cr=Gi+Se,cn=qi+Se;if(ve=ve&&this.isOffscreen(Or,Ci,cr,cn),ue=ue||this.isInsideGrid(Or,Ci,cr,cn),t!=="always"&&this.grid.hitTestCircle(Gi,qi,Se,t,L)&&(ce=!0,!E))return{circles:[],offscreen:!1,collisionDetected:ce}}}}return{circles:!E&&ce||!ue?[]:U,offscreen:ve,collisionDetected:ce}}queryRenderedSymbols(t){if(t.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const n=[];let l=1/0,d=1/0,f=-1/0,_=-1/0;for(const P of t){const L=new o.pointGeometry(P.x+Ni,P.y+Ni);l=Math.min(l,L.x),d=Math.min(d,L.y),f=Math.max(f,L.x),_=Math.max(_,L.y),n.push(L)}const b=this.grid.query(l,d,f,_).concat(this.ignoredGrid.query(l,d,f,_)),w={},E={};for(const P of b){const L=P.key;if(w[L.bucketInstanceId]===void 0&&(w[L.bucketInstanceId]={}),w[L.bucketInstanceId][L.featureIndex])continue;const O=[new o.pointGeometry(P.x1,P.y1),new o.pointGeometry(P.x2,P.y1),new o.pointGeometry(P.x2,P.y2),new o.pointGeometry(P.x1,P.y2)];o.polygonIntersectsPolygon(n,O)&&(w[L.bucketInstanceId][L.featureIndex]=!0,E[L.bucketInstanceId]===void 0&&(E[L.bucketInstanceId]=[]),E[L.bucketInstanceId].push(L.featureIndex))}return E}insertCollisionBox(t,n,l,d,f,_){(l?this.ignoredGrid:this.grid).insert({bucketInstanceId:d,featureIndex:f,collisionGroupID:_,overlapMode:n},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,n,l,d,f,_){const b=l?this.ignoredGrid:this.grid,w={bucketInstanceId:d,featureIndex:f,collisionGroupID:_,overlapMode:n};for(let E=0;E<t.length;E+=4)b.insertCircle(w,t[E],t[E+1],t[E+2])}projectAndGetPerspectiveRatio(t,n,l){const d=[n,l,0,1];return Mt(d,d,t),{point:new o.pointGeometry((d[0]/d[3]+1)/2*this.transform.width+Ni,(-d[1]/d[3]+1)/2*this.transform.height+Ni),perspectiveRatio:.5+this.transform.cameraToCenterDistance/d[3]*.5}}isOffscreen(t,n,l,d){return l<Ni||t>=this.screenRightBoundary||d<Ni||n>this.screenBottomBoundary}isInsideGrid(t,n,l,d){return l>=0&&t<this.gridRightBoundary&&d>=0&&n<this.gridBottomBoundary}getViewportMatrix(){const t=o.identity([]);return o.translate(t,t,[-100,-100,0]),t}}function ii(h,t,n){return t*(o.EXTENT/(h.tileSize*Math.pow(2,n-h.tileID.overscaledZ)))}class Qi{constructor(t,n,l,d){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?n:-n))):d&&l?1:0,this.placed=l}isHidden(){return this.opacity===0&&!this.placed}}class er{constructor(t,n,l,d,f){this.text=new Qi(t?t.text:null,n,l,f),this.icon=new Qi(t?t.icon:null,n,d,f)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Kn{constructor(t,n,l){this.text=t,this.icon=n,this.skipFade=l}}class bn{constructor(){this.invProjMatrix=o.create(),this.viewportMatrix=o.create(),this.circles=[]}}class wn{constructor(t,n,l,d,f){this.bucketInstanceId=t,this.featureIndex=n,this.sourceLayerIndex=l,this.bucketIndex=d,this.tileID=f}}class ${constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}get(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){const n=++this.maxGroupID;this.collisionGroups[t]={ID:n,predicate:l=>l.collisionGroupID===n}}return this.collisionGroups[t]}}function T(h,t,n,l,d){const{horizontalAlign:f,verticalAlign:_}=o.getAnchorAlignment(h),b=-(f-.5)*t,w=-(_-.5)*n,E=o.evaluateVariableOffset(h,l);return new o.pointGeometry(b+E[0]*d,w+E[1]*d)}function C(h,t,n,l,d,f){const{x1:_,x2:b,y1:w,y2:E,anchorPointX:P,anchorPointY:L}=h,O=new o.pointGeometry(t,n);return l&&O._rotate(d?f:-f),{x1:_+O.x,y1:w+O.y,x2:b+O.x,y2:E+O.y,anchorPointX:P,anchorPointY:L}}class F{constructor(t,n,l,d){this.transform=t.clone(),this.collisionIndex=new Qr(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=n,this.retainedQueryData={},this.collisionGroups=new $(l),this.collisionCircleArrays={},this.prevPlacement=d,d&&(d.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(t,n,l,d){const f=l.getBucket(n),_=l.latestFeatureIndex;if(!f||!_||n.id!==f.layerIds[0])return;const b=l.collisionBoxArray,w=f.layers[0].layout,E=Math.pow(2,this.transform.zoom-l.tileID.overscaledZ),P=l.tileSize/o.EXTENT,L=this.transform.calculatePosMatrix(l.tileID.toUnwrapped()),O=w.get("text-pitch-alignment")==="map",j=w.get("text-rotation-alignment")==="map",U=ii(l,1,this.transform.zoom),q=yi(L,O,j,this.transform,U);let ee=null;if(O){const ne=Kr(L,O,j,this.transform,U);ee=o.multiply([],this.transform.labelPlaneMatrix,ne)}this.retainedQueryData[f.bucketInstanceId]=new wn(f.bucketInstanceId,_,f.sourceLayerIndex,f.index,l.tileID);const te={bucket:f,layout:w,posMatrix:L,textLabelPlaneMatrix:q,labelToScreenMatrix:ee,scale:E,textPixelRatio:P,holdingForFade:l.holdingForFade(),collisionBoxArray:b,partiallyEvaluatedTextSize:o.evaluateSizeForZoom(f.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(f.sourceID)};if(d)for(const ne of f.sortKeyRanges){const{sortKey:ie,symbolInstanceStart:fe,symbolInstanceEnd:ce}=ne;t.push({sortKey:ie,symbolInstanceStart:fe,symbolInstanceEnd:ce,parameters:te})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:f.symbolInstances.length,parameters:te})}attemptAnchorPlacement(t,n,l,d,f,_,b,w,E,P,L,O,j,U,q){const ee=[O.textOffset0,O.textOffset1],te=T(t,l,d,ee,f),ne=this.collisionIndex.placeCollisionBox(C(n,te.x,te.y,_,b,this.transform.angle),L,w,E,P.predicate);if((!q||this.collisionIndex.placeCollisionBox(C(q,te.x,te.y,_,b,this.transform.angle),L,w,E,P.predicate).box.length!==0)&&ne.box.length>0){let ie;return this.prevPlacement&&this.prevPlacement.variableOffsets[O.crossTileID]&&this.prevPlacement.placements[O.crossTileID]&&this.prevPlacement.placements[O.crossTileID].text&&(ie=this.prevPlacement.variableOffsets[O.crossTileID].anchor),this.variableOffsets[O.crossTileID]={textOffset:ee,width:l,height:d,anchor:t,textBoxScale:f,prevAnchor:ie},this.markUsedJustification(j,t,O,U),j.allowVerticalPlacement&&(this.markUsedOrientation(j,U,O),this.placedOrientations[O.crossTileID]=U),{shift:te,placedGlyphBoxes:ne}}}placeLayerBucketPart(t,n,l){const{bucket:d,layout:f,posMatrix:_,textLabelPlaneMatrix:b,labelToScreenMatrix:w,textPixelRatio:E,holdingForFade:P,collisionBoxArray:L,partiallyEvaluatedTextSize:O,collisionGroup:j}=t.parameters,U=f.get("text-optional"),q=f.get("icon-optional"),ee=o.getOverlapMode(f,"text-overlap","text-allow-overlap"),te=ee==="always",ne=o.getOverlapMode(f,"icon-overlap","icon-allow-overlap"),ie=ne==="always",fe=f.get("text-rotation-alignment")==="map",ce=f.get("text-pitch-alignment")==="map",ue=f.get("icon-text-fit")!=="none",ve=f.get("symbol-z-order")==="viewport-y",Se=te&&(ie||!d.hasIconData()||q),me=ie&&(te||!d.hasTextData()||U);!d.collisionArrays&&L&&d.deserializeCollisionBoxes(L);const Fe=(Ce,Je)=>{if(n[Ce.crossTileID])return;if(P)return void(this.placements[Ce.crossTileID]=new Kn(!1,!1,!1));let ft=!1,ct=!1,dt=!0,Vt=null,et={box:null,offscreen:null},_t={box:null,offscreen:null},It=null,ui=null,ki=null,Gi=0,qi=0,Or=0;Je.textFeatureIndex?Gi=Je.textFeatureIndex:Ce.useRuntimeCollisionCircles&&(Gi=Ce.featureIndex),Je.verticalTextFeatureIndex&&(qi=Je.verticalTextFeatureIndex);const Ci=Je.textBox;if(Ci){const Li=bt=>{let Jt=o.WritingMode.horizontal;if(d.allowVerticalPlacement&&!bt&&this.prevPlacement){const xi=this.prevPlacement.placedOrientations[Ce.crossTileID];xi&&(this.placedOrientations[Ce.crossTileID]=xi,Jt=xi,this.markUsedOrientation(d,Jt,Ce))}return Jt},xt=(bt,Jt)=>{if(d.allowVerticalPlacement&&Ce.numVerticalGlyphVertices>0&&Je.verticalTextBox){for(const xi of d.writingModes)if(xi===o.WritingMode.vertical?(et=Jt(),_t=et):et=bt(),et&&et.box&&et.box.length)break}else et=bt()};if(f.get("text-variable-anchor")){let bt=f.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[Ce.crossTileID]){const Ft=this.prevPlacement.variableOffsets[Ce.crossTileID];bt.indexOf(Ft.anchor)>0&&(bt=bt.filter(hn=>hn!==Ft.anchor),bt.unshift(Ft.anchor))}const Jt=(Ft,hn,hr)=>{const es=Ft.x2-Ft.x1,so=Ft.y2-Ft.y1,ts=Ce.textBoxScale,_l=ue&&ne==="never"?hn:null;let un={box:[],offscreen:!1};const is=ee!=="never"?2*bt.length:bt.length;for(let ur=0;ur<is;++ur){const Rn=this.attemptAnchorPlacement(bt[ur%bt.length],Ft,es,so,ts,fe,ce,E,_,j,ur>=bt.length?ee:"never",Ce,d,hr,_l);if(Rn&&(un=Rn.placedGlyphBoxes,un&&un.box&&un.box.length)){ft=!0,Vt=Rn.shift;break}}return un};xt(()=>Jt(Ci,Je.iconBox,o.WritingMode.horizontal),()=>{const Ft=Je.verticalTextBox;return d.allowVerticalPlacement&&!(et&&et.box&&et.box.length)&&Ce.numVerticalGlyphVertices>0&&Ft?Jt(Ft,Je.verticalIconBox,o.WritingMode.vertical):{box:null,offscreen:null}}),et&&(ft=et.box,dt=et.offscreen);const xi=Li(et&&et.box);if(!ft&&this.prevPlacement){const Ft=this.prevPlacement.variableOffsets[Ce.crossTileID];Ft&&(this.variableOffsets[Ce.crossTileID]=Ft,this.markUsedJustification(d,Ft.anchor,Ce,xi))}}else{const bt=(Jt,xi)=>{const Ft=this.collisionIndex.placeCollisionBox(Jt,ee,E,_,j.predicate);return Ft&&Ft.box&&Ft.box.length&&(this.markUsedOrientation(d,xi,Ce),this.placedOrientations[Ce.crossTileID]=xi),Ft};xt(()=>bt(Ci,o.WritingMode.horizontal),()=>{const Jt=Je.verticalTextBox;return d.allowVerticalPlacement&&Ce.numVerticalGlyphVertices>0&&Jt?bt(Jt,o.WritingMode.vertical):{box:null,offscreen:null}}),Li(et&&et.box&&et.box.length)}}if(It=et,ft=It&&It.box&&It.box.length>0,dt=It&&It.offscreen,Ce.useRuntimeCollisionCircles){const Li=d.text.placedSymbolArray.get(Ce.centerJustifiedTextSymbolIndex),xt=o.evaluateSizeForFeature(d.textSizeData,O,Li),bt=f.get("text-padding");ui=this.collisionIndex.placeCollisionCircles(ee,Li,d.lineVertexArray,d.glyphOffsetArray,xt,_,b,w,l,ce,j.predicate,Ce.collisionCircleDiameter,bt),ft=te||ui.circles.length>0&&!ui.collisionDetected,dt=dt&&ui.offscreen}if(Je.iconFeatureIndex&&(Or=Je.iconFeatureIndex),Je.iconBox){const Li=xt=>{const bt=ue&&Vt?C(xt,Vt.x,Vt.y,fe,ce,this.transform.angle):xt;return this.collisionIndex.placeCollisionBox(bt,ne,E,_,j.predicate)};_t&&_t.box&&_t.box.length&&Je.verticalIconBox?(ki=Li(Je.verticalIconBox),ct=ki.box.length>0):(ki=Li(Je.iconBox),ct=ki.box.length>0),dt=dt&&ki.offscreen}const cr=U||Ce.numHorizontalGlyphVertices===0&&Ce.numVerticalGlyphVertices===0,cn=q||Ce.numIconVertices===0;if(cr||cn?cn?cr||(ct=ct&&ft):ft=ct&&ft:ct=ft=ct&&ft,ft&&It&&It.box&&this.collisionIndex.insertCollisionBox(It.box,ee,f.get("text-ignore-placement"),d.bucketInstanceId,_t&&_t.box&&qi?qi:Gi,j.ID),ct&&ki&&this.collisionIndex.insertCollisionBox(ki.box,ne,f.get("icon-ignore-placement"),d.bucketInstanceId,Or,j.ID),ui&&(ft&&this.collisionIndex.insertCollisionCircles(ui.circles,ee,f.get("text-ignore-placement"),d.bucketInstanceId,Gi,j.ID),l)){const Li=d.bucketInstanceId;let xt=this.collisionCircleArrays[Li];xt===void 0&&(xt=this.collisionCircleArrays[Li]=new bn);for(let bt=0;bt<ui.circles.length;bt+=4)xt.circles.push(ui.circles[bt+0]),xt.circles.push(ui.circles[bt+1]),xt.circles.push(ui.circles[bt+2]),xt.circles.push(ui.collisionDetected?1:0)}this.placements[Ce.crossTileID]=new Kn(ft||Se,ct||me,dt||d.justReloaded),n[Ce.crossTileID]=!0};if(ve){const Ce=d.getSortedSymbolIndexes(this.transform.angle);for(let Je=Ce.length-1;Je>=0;--Je){const ft=Ce[Je];Fe(d.symbolInstances.get(ft),d.collisionArrays[ft])}}else for(let Ce=t.symbolInstanceStart;Ce<t.symbolInstanceEnd;Ce++)Fe(d.symbolInstances.get(Ce),d.collisionArrays[Ce]);if(l&&d.bucketInstanceId in this.collisionCircleArrays){const Ce=this.collisionCircleArrays[d.bucketInstanceId];o.invert(Ce.invProjMatrix,_),Ce.viewportMatrix=this.collisionIndex.getViewportMatrix()}d.justReloaded=!1}markUsedJustification(t,n,l,d){let f;f=d===o.WritingMode.vertical?l.verticalPlacedTextSymbolIndex:{left:l.leftJustifiedTextSymbolIndex,center:l.centerJustifiedTextSymbolIndex,right:l.rightJustifiedTextSymbolIndex}[o.getAnchorJustification(n)];const _=[l.leftJustifiedTextSymbolIndex,l.centerJustifiedTextSymbolIndex,l.rightJustifiedTextSymbolIndex,l.verticalPlacedTextSymbolIndex];for(const b of _)b>=0&&(t.text.placedSymbolArray.get(b).crossTileID=f>=0&&b!==f?0:l.crossTileID)}markUsedOrientation(t,n,l){const d=n===o.WritingMode.horizontal||n===o.WritingMode.horizontalOnly?n:0,f=n===o.WritingMode.vertical?n:0,_=[l.leftJustifiedTextSymbolIndex,l.centerJustifiedTextSymbolIndex,l.rightJustifiedTextSymbolIndex];for(const b of _)t.text.placedSymbolArray.get(b).placedOrientation=d;l.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(l.verticalPlacedTextSymbolIndex).placedOrientation=f)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const n=this.prevPlacement;let l=!1;this.prevZoomAdjustment=n?n.zoomAdjustment(this.transform.zoom):0;const d=n?n.symbolFadeChange(t):1,f=n?n.opacities:{},_=n?n.variableOffsets:{},b=n?n.placedOrientations:{};for(const w in this.placements){const E=this.placements[w],P=f[w];P?(this.opacities[w]=new er(P,d,E.text,E.icon),l=l||E.text!==P.text.placed||E.icon!==P.icon.placed):(this.opacities[w]=new er(null,d,E.text,E.icon,E.skipFade),l=l||E.text||E.icon)}for(const w in f){const E=f[w];if(!this.opacities[w]){const P=new er(E,d,!1,!1);P.isHidden()||(this.opacities[w]=P,l=l||E.text.placed||E.icon.placed)}}for(const w in _)this.variableOffsets[w]||!this.opacities[w]||this.opacities[w].isHidden()||(this.variableOffsets[w]=_[w]);for(const w in b)this.placedOrientations[w]||!this.opacities[w]||this.opacities[w].isHidden()||(this.placedOrientations[w]=b[w]);l?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=n?n.lastPlacementChangeTime:t)}updateLayerOpacities(t,n){const l={};for(const d of n){const f=d.getBucket(t);f&&d.latestFeatureIndex&&t.id===f.layerIds[0]&&this.updateBucketOpacities(f,l,d.collisionBoxArray)}}updateBucketOpacities(t,n,l){t.hasTextData()&&t.text.opacityVertexArray.clear(),t.hasIconData()&&t.icon.opacityVertexArray.clear(),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();const d=t.layers[0].layout,f=new er(null,0,!1,!1,!0),_=d.get("text-allow-overlap"),b=d.get("icon-allow-overlap"),w=d.get("text-variable-anchor"),E=d.get("text-rotation-alignment")==="map",P=d.get("text-pitch-alignment")==="map",L=d.get("icon-text-fit")!=="none",O=new er(null,0,_&&(b||!t.hasIconData()||d.get("icon-optional")),b&&(_||!t.hasTextData()||d.get("text-optional")),!0);!t.collisionArrays&&l&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(l);const j=(U,q,ee)=>{for(let te=0;te<q/4;te++)U.opacityVertexArray.emplaceBack(ee)};for(let U=0;U<t.symbolInstances.length;U++){const q=t.symbolInstances.get(U),{numHorizontalGlyphVertices:ee,numVerticalGlyphVertices:te,crossTileID:ne}=q;let ie=this.opacities[ne];n[ne]?ie=f:ie||(ie=O,this.opacities[ne]=ie),n[ne]=!0;const fe=q.numIconVertices>0,ce=this.placedOrientations[q.crossTileID],ue=ce===o.WritingMode.vertical,ve=ce===o.WritingMode.horizontal||ce===o.WritingMode.horizontalOnly;if(ee>0||te>0){const Se=le(ie.text);j(t.text,ee,ue?Oe:Se),j(t.text,te,ve?Oe:Se);const me=ie.text.isHidden();[q.rightJustifiedTextSymbolIndex,q.centerJustifiedTextSymbolIndex,q.leftJustifiedTextSymbolIndex].forEach(Je=>{Je>=0&&(t.text.placedSymbolArray.get(Je).hidden=me||ue?1:0)}),q.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(q.verticalPlacedTextSymbolIndex).hidden=me||ve?1:0);const Fe=this.variableOffsets[q.crossTileID];Fe&&this.markUsedJustification(t,Fe.anchor,q,ce);const Ce=this.placedOrientations[q.crossTileID];Ce&&(this.markUsedJustification(t,"left",q,Ce),this.markUsedOrientation(t,Ce,q))}if(fe){const Se=le(ie.icon),me=!(L&&q.verticalPlacedIconSymbolIndex&&ue);q.placedIconSymbolIndex>=0&&(j(t.icon,q.numIconVertices,me?Se:Oe),t.icon.placedSymbolArray.get(q.placedIconSymbolIndex).hidden=ie.icon.isHidden()),q.verticalPlacedIconSymbolIndex>=0&&(j(t.icon,q.numVerticalIconVertices,me?Oe:Se),t.icon.placedSymbolArray.get(q.verticalPlacedIconSymbolIndex).hidden=ie.icon.isHidden())}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const Se=t.collisionArrays[U];if(Se){let me=new o.pointGeometry(0,0);if(Se.textBox||Se.verticalTextBox){let Ce=!0;if(w){const Je=this.variableOffsets[ne];Je?(me=T(Je.anchor,Je.width,Je.height,Je.textOffset,Je.textBoxScale),E&&me._rotate(P?this.transform.angle:-this.transform.angle)):Ce=!1}Se.textBox&&N(t.textCollisionBox.collisionVertexArray,ie.text.placed,!Ce||ue,me.x,me.y),Se.verticalTextBox&&N(t.textCollisionBox.collisionVertexArray,ie.text.placed,!Ce||ve,me.x,me.y)}const Fe=Boolean(!ve&&Se.verticalIconBox);Se.iconBox&&N(t.iconCollisionBox.collisionVertexArray,ie.icon.placed,Fe,L?me.x:0,L?me.y:0),Se.verticalIconBox&&N(t.iconCollisionBox.collisionVertexArray,ie.icon.placed,!Fe,L?me.x:0,L?me.y:0)}}}if(t.sortFeatures(this.transform.angle),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.bucketInstanceId in this.collisionCircleArrays){const U=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=U.invProjMatrix,t.placementViewportMatrix=U.viewportMatrix,t.collisionCircleArray=U.circles,delete this.collisionCircleArrays[t.bucketInstanceId]}}symbolFadeChange(t){return this.fadeDuration===0?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(t,n){const l=this.zoomAtLastRecencyCheck===n?1-this.zoomAdjustment(n):1;return this.zoomAtLastRecencyCheck=n,this.commitTime+this.fadeDuration*l>t}setStale(){this.stale=!0}}function N(h,t,n,l,d){h.emplaceBack(t?1:0,n?1:0,l||0,d||0),h.emplaceBack(t?1:0,n?1:0,l||0,d||0),h.emplaceBack(t?1:0,n?1:0,l||0,d||0),h.emplaceBack(t?1:0,n?1:0,l||0,d||0)}const V=Math.pow(2,25),J=Math.pow(2,24),X=Math.pow(2,17),Y=Math.pow(2,16),Q=Math.pow(2,9),he=Math.pow(2,8),_e=Math.pow(2,1);function le(h){if(h.opacity===0&&!h.placed)return 0;if(h.opacity===1&&h.placed)return 4294967295;const t=h.placed?1:0,n=Math.floor(127*h.opacity);return n*V+t*J+n*X+t*Y+n*Q+t*he+n*_e+t}const Oe=0;class Le{constructor(t){this._sortAcrossTiles=t.layout.get("symbol-z-order")!=="viewport-y"&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,n,l,d,f){const _=this._bucketParts;for(;this._currentTileIndex<t.length;)if(n.getBucketParts(_,d,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,f())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,_.sort((b,w)=>b.sortKey-w.sortKey));this._currentPartIndex<_.length;)if(n.placeLayerBucketPart(_[this._currentPartIndex],this._seenCrossTileIDs,l),this._currentPartIndex++,f())return!0;return!1}}class Ne{constructor(t,n,l,d,f,_,b){this.placement=new F(t,f,_,b),this._currentPlacementIndex=n.length-1,this._forceFullPlacement=l,this._showCollisionBoxes=d,this._done=!1}isDone(){return this._done}continuePlacement(t,n,l){const d=o.exported.now(),f=()=>{const _=o.exported.now()-d;return!this._forceFullPlacement&&_>2};for(;this._currentPlacementIndex>=0;){const _=n[t[this._currentPlacementIndex]],b=this.placement.collisionIndex.transform.zoom;if(_.type==="symbol"&&(!_.minzoom||_.minzoom<=b)&&(!_.maxzoom||_.maxzoom>b)){if(this._inProgressLayer||(this._inProgressLayer=new Le(_)),this._inProgressLayer.continuePlacement(l[_.source],this.placement,this._showCollisionBoxes,_,f))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const He=512/o.EXTENT/2;class yt{constructor(t,n,l){this.tileID=t,this.indexedSymbolInstances={},this.bucketInstanceId=l;for(let d=0;d<n.length;d++){const f=n.get(d),_=f.key;this.indexedSymbolInstances[_]||(this.indexedSymbolInstances[_]=[]),this.indexedSymbolInstances[_].push({crossTileID:f.crossTileID,coord:this.getScaledCoordinates(f,t)})}}getScaledCoordinates(t,n){const l=He/Math.pow(2,n.canonical.z-this.tileID.canonical.z);return{x:Math.floor((n.canonical.x*o.EXTENT+t.anchorX)*l),y:Math.floor((n.canonical.y*o.EXTENT+t.anchorY)*l)}}findMatches(t,n,l){const d=this.tileID.canonical.z<n.canonical.z?1:Math.pow(2,this.tileID.canonical.z-n.canonical.z);for(let f=0;f<t.length;f++){const _=t.get(f);if(_.crossTileID)continue;const b=this.indexedSymbolInstances[_.key];if(!b)continue;const w=this.getScaledCoordinates(_,n);for(const E of b)if(Math.abs(E.coord.x-w.x)<=d&&Math.abs(E.coord.y-w.y)<=d&&!l[E.crossTileID]){l[E.crossTileID]=!0,_.crossTileID=E.crossTileID;break}}}}class ut{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class lt{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const n=Math.round((t-this.lng)/360);if(n!==0)for(const l in this.indexes){const d=this.indexes[l],f={};for(const _ in d){const b=d[_];b.tileID=b.tileID.unwrapTo(b.tileID.wrap+n),f[b.tileID.key]=b}this.indexes[l]=f}this.lng=t}addBucket(t,n,l){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===n.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let f=0;f<n.symbolInstances.length;f++)n.symbolInstances.get(f).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]={});const d=this.usedCrossTileIDs[t.overscaledZ];for(const f in this.indexes){const _=this.indexes[f];if(Number(f)>t.overscaledZ)for(const b in _){const w=_[b];w.tileID.isChildOf(t)&&w.findMatches(n.symbolInstances,t,d)}else{const b=_[t.scaledTo(Number(f)).key];b&&b.findMatches(n.symbolInstances,t,d)}}for(let f=0;f<n.symbolInstances.length;f++){const _=n.symbolInstances.get(f);_.crossTileID||(_.crossTileID=l.generate(),d[_.crossTileID]=!0)}return this.indexes[t.overscaledZ]===void 0&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new yt(t,n.symbolInstances,n.bucketInstanceId),!0}removeBucketCrossTileIDs(t,n){for(const l in n.indexedSymbolInstances)for(const d of n.indexedSymbolInstances[l])delete this.usedCrossTileIDs[t][d.crossTileID]}removeStaleBuckets(t){let n=!1;for(const l in this.indexes){const d=this.indexes[l];for(const f in d)t[d[f].bucketInstanceId]||(this.removeBucketCrossTileIDs(l,d[f]),delete d[f],n=!0)}return n}}class at{constructor(){this.layerIndexes={},this.crossTileIDs=new ut,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,n,l){let d=this.layerIndexes[t.id];d===void 0&&(d=this.layerIndexes[t.id]=new lt);let f=!1;const _={};d.handleWrapJump(l);for(const b of n){const w=b.getBucket(t);w&&t.id===w.layerIds[0]&&(w.bucketInstanceId||(w.bucketInstanceId=++this.maxBucketInstanceId),d.addBucket(b.tileID,w,this.crossTileIDs)&&(f=!0),_[w.bucketInstanceId]=!0)}return d.removeStaleBuckets(_)&&(f=!0),f}pruneUnusedLayers(t){const n={};t.forEach(l=>{n[l]=!0});for(const l in this.layerIndexes)n[l]||delete this.layerIndexes[l]}}const it=(h,t)=>o.emitValidationErrors(h,t&&t.filter(n=>n.identifier!=="source.canvas")),Wt=o.pick(mt,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData"]),qt=o.pick(mt,["setCenter","setZoom","setBearing","setPitch"]),oi=function(){const h={},t=o.spec.$version;for(const n in o.spec.$root){const l=o.spec.$root[n];if(l.required){let d=null;d=n==="version"?t:l.type==="array"?[]:{},d!=null&&(h[n]=d)}}return h}();class hi extends o.Evented{constructor(t,n={}){super(),this.map=t,this.dispatcher=new yr(sr(),this),this.imageManager=new gt,this.imageManager.setEventedParent(this),this.glyphManager=new Ui(t._requestManager,n.localIdeographFontFamily),this.lineAtlas=new Zn(256,512),this.crossTileSymbolIndex=new at,this._layers={},this._serializedLayers={},this._order=[],this.sourceCaches={},this.zoomHistory=new o.ZoomHistory,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",o.getReferrer());const l=this;this._rtlTextPluginCallback=hi.registerForPluginStateChange(d=>{l.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:d.pluginStatus,pluginURL:d.pluginURL},(f,_)=>{if(o.triggerPluginCompletionEvent(f),_&&_.every(b=>b))for(const b in l.sourceCaches)l.sourceCaches[b].reload()})}),this.on("data",d=>{if(d.dataType!=="source"||d.sourceDataType!=="metadata")return;const f=this.sourceCaches[d.sourceId];if(!f)return;const _=f.getSource();if(_&&_.vectorLayerIds)for(const b in this._layers){const w=this._layers[b];w.source===_.id&&this._validateLayer(w)}})}loadURL(t,n={}){this.fire(new o.Event("dataloading",{dataType:"style"}));const l=typeof n.validate!="boolean"||n.validate,d=this.map._requestManager.transformRequest(t,o.ResourceType.Style);this._request=o.getJSON(d,(f,_)=>{this._request=null,f?this.fire(new o.ErrorEvent(f)):_&&this._load(_,l)})}loadJSON(t,n={}){this.fire(new o.Event("dataloading",{dataType:"style"})),this._request=o.exported.frame(()=>{this._request=null,this._load(t,n.validate!==!1)})}loadEmpty(){this.fire(new o.Event("dataloading",{dataType:"style"})),this._load(oi,!1)}_load(t,n){if(n&&it(this,o.validateStyle(t)))return;this._loaded=!0,this.stylesheet=t;for(const d in t.sources)this.addSource(d,t.sources[d],{validate:!1});t.sprite?this._loadSprite(t.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(t.glyphs);const l=Xn(this.stylesheet.layers);this._order=l.map(d=>d.id),this._layers={},this._serializedLayers={};for(let d of l)d=o.createStyleLayer(d),d.setEventedParent(this,{layer:{id:d.id}}),this._layers[d.id]=d,this._serializedLayers[d.id]=d.serialize();this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new zr(this.stylesheet.light),this.fire(new o.Event("data",{dataType:"style"})),this.fire(new o.Event("style.load"))}_loadSprite(t){this._spriteRequest=function(n,l,d,f){let _,b,w;const E=d>1?"@2x":"";let P=o.getJSON(l.transformRequest(l.normalizeSpriteURL(n,E,".json"),o.ResourceType.SpriteJSON),(j,U)=>{P=null,w||(w=j,_=U,O())}),L=o.getImage(l.transformRequest(l.normalizeSpriteURL(n,E,".png"),o.ResourceType.SpriteImage),(j,U)=>{L=null,w||(w=j,b=U,O())});function O(){if(w)f(w);else if(_&&b){const j=o.exported.getImageData(b),U={};for(const q in _){const{width:ee,height:te,x:ne,y:ie,sdf:fe,pixelRatio:ce,stretchX:ue,stretchY:ve,content:Se}=_[q],me=new o.RGBAImage({width:ee,height:te});o.RGBAImage.copy(j,me,{x:ne,y:ie},{x:0,y:0},{width:ee,height:te}),U[q]={data:me,pixelRatio:ce,sdf:fe,stretchX:ue,stretchY:ve,content:Se}}f(null,U)}}return{cancel(){P&&(P.cancel(),P=null),L&&(L.cancel(),L=null)}}}(t,this.map._requestManager,this.map.getPixelRatio(),(n,l)=>{if(this._spriteRequest=null,n)this.fire(new o.ErrorEvent(n));else if(l)for(const d in l)this.imageManager.addImage(d,l[d]);this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new o.Event("data",{dataType:"style"}))})}_validateLayer(t){const n=this.sourceCaches[t.source];if(!n)return;const l=t.sourceLayer;if(!l)return;const d=n.getSource();(d.type==="geojson"||d.vectorLayerIds&&d.vectorLayerIds.indexOf(l)===-1)&&this.fire(new o.ErrorEvent(new Error(`Source layer "${l}" does not exist on source "${d.id}" as specified by style layer "${t.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeLayers(t){const n=[];for(const l of t){const d=this._layers[l];d.type!=="custom"&&n.push(d.serialize())}return n}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(const t in this.sourceCaches)if(this.sourceCaches[t].hasTransition())return!0;for(const t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(t){if(!this._loaded)return;const n=this._changed;if(this._changed){const d=Object.keys(this._updatedLayers),f=Object.keys(this._removedLayers);(d.length||f.length)&&this._updateWorkerLayers(d,f);for(const _ in this._updatedSources){const b=this._updatedSources[_];b==="reload"?this._reloadSource(_):b==="clear"&&this._clearSource(_)}this._updateTilesForChangedImages();for(const _ in this._updatedPaintProps)this._layers[_].updateTransitions(t);this.light.updateTransitions(t),this._resetUpdates()}const l={};for(const d in this.sourceCaches){const f=this.sourceCaches[d];l[d]=f.used,f.used=!1}for(const d of this._order){const f=this._layers[d];f.recalculate(t,this._availableImages),!f.isHidden(t.zoom)&&f.source&&(this.sourceCaches[f.source].used=!0)}for(const d in l){const f=this.sourceCaches[d];l[d]!==f.used&&f.fire(new o.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:d}))}this.light.recalculate(t),this.z=t.zoom,n&&this.fire(new o.Event("data",{dataType:"style"}))}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const n in this.sourceCaches)this.sourceCaches[n].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateWorkerLayers(t,n){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(t),removedIds:n})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={}}setState(t){if(this._checkLoaded(),it(this,o.validateStyle(t)))return!1;(t=o.clone$1(t)).layers=Xn(t.layers);const n=function(d,f){if(!d)return[{command:mt.setStyle,args:[f]}];let _=[];try{if(!ae(d.version,f.version))return[{command:mt.setStyle,args:[f]}];ae(d.center,f.center)||_.push({command:mt.setCenter,args:[f.center]}),ae(d.zoom,f.zoom)||_.push({command:mt.setZoom,args:[f.zoom]}),ae(d.bearing,f.bearing)||_.push({command:mt.setBearing,args:[f.bearing]}),ae(d.pitch,f.pitch)||_.push({command:mt.setPitch,args:[f.pitch]}),ae(d.sprite,f.sprite)||_.push({command:mt.setSprite,args:[f.sprite]}),ae(d.glyphs,f.glyphs)||_.push({command:mt.setGlyphs,args:[f.glyphs]}),ae(d.transition,f.transition)||_.push({command:mt.setTransition,args:[f.transition]}),ae(d.light,f.light)||_.push({command:mt.setLight,args:[f.light]});const b={},w=[];(function(P,L,O,j){let U;for(U in L=L||{},P=P||{})Object.prototype.hasOwnProperty.call(P,U)&&(Object.prototype.hasOwnProperty.call(L,U)||Br(U,O,j));for(U in L)Object.prototype.hasOwnProperty.call(L,U)&&(Object.prototype.hasOwnProperty.call(P,U)?ae(P[U],L[U])||(P[U].type==="geojson"&&L[U].type==="geojson"&&Yn(P,L,U)?O.push({command:mt.setGeoJSONSourceData,args:[U,L[U].data]}):Xr(U,L,O,j)):Hr(U,L,O))})(d.sources,f.sources,w,b);const E=[];d.layers&&d.layers.forEach(P=>{b[P.source]?_.push({command:mt.removeLayer,args:[P.id]}):E.push(P)}),_=_.concat(w),function(P,L,O){L=L||[];const j=(P=P||[]).map(Ae),U=L.map(Ae),q=P.reduce(Yr,{}),ee=L.reduce(Yr,{}),te=j.slice(),ne=Object.create(null);let ie,fe,ce,ue,ve,Se,me;for(ie=0,fe=0;ie<j.length;ie++)ce=j[ie],Object.prototype.hasOwnProperty.call(ee,ce)?fe++:(O.push({command:mt.removeLayer,args:[ce]}),te.splice(te.indexOf(ce,fe),1));for(ie=0,fe=0;ie<U.length;ie++)ce=U[U.length-1-ie],te[te.length-1-ie]!==ce&&(Object.prototype.hasOwnProperty.call(q,ce)?(O.push({command:mt.removeLayer,args:[ce]}),te.splice(te.lastIndexOf(ce,te.length-fe),1)):fe++,Se=te[te.length-ie],O.push({command:mt.addLayer,args:[ee[ce],Se]}),te.splice(te.length-ie,0,ce),ne[ce]=!0);for(ie=0;ie<U.length;ie++)if(ce=U[ie],ue=q[ce],ve=ee[ce],!ne[ce]&&!ae(ue,ve))if(ae(ue.source,ve.source)&&ae(ue["source-layer"],ve["source-layer"])&&ae(ue.type,ve.type)){for(me in de(ue.layout,ve.layout,O,ce,null,mt.setLayoutProperty),de(ue.paint,ve.paint,O,ce,null,mt.setPaintProperty),ae(ue.filter,ve.filter)||O.push({command:mt.setFilter,args:[ce,ve.filter]}),ae(ue.minzoom,ve.minzoom)&&ae(ue.maxzoom,ve.maxzoom)||O.push({command:mt.setLayerZoomRange,args:[ce,ve.minzoom,ve.maxzoom]}),ue)Object.prototype.hasOwnProperty.call(ue,me)&&me!=="layout"&&me!=="paint"&&me!=="filter"&&me!=="metadata"&&me!=="minzoom"&&me!=="maxzoom"&&(me.indexOf("paint.")===0?de(ue[me],ve[me],O,ce,me.slice(6),mt.setPaintProperty):ae(ue[me],ve[me])||O.push({command:mt.setLayerProperty,args:[ce,me,ve[me]]}));for(me in ve)Object.prototype.hasOwnProperty.call(ve,me)&&!Object.prototype.hasOwnProperty.call(ue,me)&&me!=="layout"&&me!=="paint"&&me!=="filter"&&me!=="metadata"&&me!=="minzoom"&&me!=="maxzoom"&&(me.indexOf("paint.")===0?de(ue[me],ve[me],O,ce,me.slice(6),mt.setPaintProperty):ae(ue[me],ve[me])||O.push({command:mt.setLayerProperty,args:[ce,me,ve[me]]}))}else O.push({command:mt.removeLayer,args:[ce]}),Se=te[te.lastIndexOf(ce)+1],O.push({command:mt.addLayer,args:[ve,Se]})}(E,f.layers,_)}catch(b){console.warn("Unable to compute style diff:",b),_=[{command:mt.setStyle,args:[f]}]}return _}(this.serialize(),t).filter(d=>!(d.command in qt));if(n.length===0)return!1;const l=n.filter(d=>!(d.command in Wt));if(l.length>0)throw new Error(`Unimplemented: ${l.map(d=>d.command).join(", ")}.`);return n.forEach(d=>{d.command!=="setTransition"&&this[d.command].apply(this,d.args)}),this.stylesheet=t,!0}addImage(t,n){if(this.getImage(t))return this.fire(new o.ErrorEvent(new Error(`An image named "${t}" already exists.`)));this.imageManager.addImage(t,n),this._afterImageUpdated(t)}updateImage(t,n){this.imageManager.updateImage(t,n)}getImage(t){return this.imageManager.getImage(t)}removeImage(t){if(!this.getImage(t))return this.fire(new o.ErrorEvent(new Error(`An image named "${t}" does not exist.`)));this.imageManager.removeImage(t),this._afterImageUpdated(t)}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new o.Event("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,n,l={}){if(this._checkLoaded(),this.sourceCaches[t]!==void 0)throw new Error(`Source "${t}" already exists.`);if(!n.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(n).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(n.type)>=0&&this._validate(o.validateStyle.source,`sources.${t}`,n,null,l))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);const d=this.sourceCaches[t]=new si(t,n,this.dispatcher);d.style=this,d.setEventedParent(this,()=>({isSourceLoaded:this.loaded(),source:d.serialize(),sourceId:t})),d.onAdd(this.map),this._changed=!0}removeSource(t){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error("There is no source with this ID");for(const l in this._layers)if(this._layers[l].source===t)return this.fire(new o.ErrorEvent(new Error(`Source "${t}" cannot be removed while layer "${l}" is using it.`)));const n=this.sourceCaches[t];delete this.sourceCaches[t],delete this._updatedSources[t],n.fire(new o.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:t})),n.setEventedParent(null),n.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,n){this._checkLoaded(),this.sourceCaches[t].getSource().setData(n),this._changed=!0}getSource(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()}addLayer(t,n,l={}){this._checkLoaded();const d=t.id;if(this.getLayer(d))return void this.fire(new o.ErrorEvent(new Error(`Layer "${d}" already exists on this map.`)));let f;if(t.type==="custom"){if(it(this,o.validateCustomStyleLayer(t)))return;f=o.createStyleLayer(t)}else{if(typeof t.source=="object"&&(this.addSource(d,t.source),t=o.clone$1(t),t=o.extend(t,{source:d})),this._validate(o.validateStyle.layer,`layers.${d}`,t,{arrayIndex:-1},l))return;f=o.createStyleLayer(t),this._validateLayer(f),f.setEventedParent(this,{layer:{id:d}}),this._serializedLayers[f.id]=f.serialize()}const _=n?this._order.indexOf(n):this._order.length;if(n&&_===-1)this.fire(new o.ErrorEvent(new Error(`Cannot add layer "${d}" before non-existing layer "${n}".`)));else{if(this._order.splice(_,0,d),this._layerOrderChanged=!0,this._layers[d]=f,this._removedLayers[d]&&f.source&&f.type!=="custom"){const b=this._removedLayers[d];delete this._removedLayers[d],b.type!==f.type?this._updatedSources[f.source]="clear":(this._updatedSources[f.source]="reload",this.sourceCaches[f.source].pause())}this._updateLayer(f),f.onAdd&&f.onAdd(this.map)}}moveLayer(t,n){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new o.ErrorEvent(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===n)return;const l=this._order.indexOf(t);this._order.splice(l,1);const d=n?this._order.indexOf(n):this._order.length;n&&d===-1?this.fire(new o.ErrorEvent(new Error(`Cannot move layer "${t}" before non-existing layer "${n}".`))):(this._order.splice(d,0,t),this._layerOrderChanged=!0)}removeLayer(t){this._checkLoaded();const n=this._layers[t];if(!n)return void this.fire(new o.ErrorEvent(new Error(`Cannot remove non-existing layer "${t}".`)));n.setEventedParent(null);const l=this._order.indexOf(t);this._order.splice(l,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=n,delete this._layers[t],delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],n.onRemove&&n.onRemove(this.map)}getLayer(t){return this._layers[t]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,n,l){this._checkLoaded();const d=this.getLayer(t);d?d.minzoom===n&&d.maxzoom===l||(n!=null&&(d.minzoom=n),l!=null&&(d.maxzoom=l),this._updateLayer(d)):this.fire(new o.ErrorEvent(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,n,l={}){this._checkLoaded();const d=this.getLayer(t);if(d){if(!ae(d.filter,n))return n==null?(d.filter=void 0,void this._updateLayer(d)):void(this._validate(o.validateStyle.filter,`layers.${d.id}.filter`,n,null,l)||(d.filter=o.clone$1(n),this._updateLayer(d)))}else this.fire(new o.ErrorEvent(new Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return o.clone$1(this.getLayer(t).filter)}setLayoutProperty(t,n,l,d={}){this._checkLoaded();const f=this.getLayer(t);f?ae(f.getLayoutProperty(n),l)||(f.setLayoutProperty(n,l,d),this._updateLayer(f)):this.fire(new o.ErrorEvent(new Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,n){const l=this.getLayer(t);if(l)return l.getLayoutProperty(n);this.fire(new o.ErrorEvent(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,n,l,d={}){this._checkLoaded();const f=this.getLayer(t);f?ae(f.getPaintProperty(n),l)||(f.setPaintProperty(n,l,d)&&this._updateLayer(f),this._changed=!0,this._updatedPaintProps[t]=!0):this.fire(new o.ErrorEvent(new Error(`Cannot style non-existing layer "${t}".`)))}getPaintProperty(t,n){return this.getLayer(t).getPaintProperty(n)}setFeatureState(t,n){this._checkLoaded();const l=t.source,d=t.sourceLayer,f=this.sourceCaches[l];if(f===void 0)return void this.fire(new o.ErrorEvent(new Error(`The source '${l}' does not exist in the map's style.`)));const _=f.getSource().type;_==="geojson"&&d?this.fire(new o.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):_!=="vector"||d?(t.id===void 0&&this.fire(new o.ErrorEvent(new Error("The feature id parameter must be provided."))),f.setFeatureState(d,t.id,n)):this.fire(new o.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(t,n){this._checkLoaded();const l=t.source,d=this.sourceCaches[l];if(d===void 0)return void this.fire(new o.ErrorEvent(new Error(`The source '${l}' does not exist in the map's style.`)));const f=d.getSource().type,_=f==="vector"?t.sourceLayer:void 0;f!=="vector"||_?n&&typeof t.id!="string"&&typeof t.id!="number"?this.fire(new o.ErrorEvent(new Error("A feature id is required to remove its specific state property."))):d.removeFeatureState(_,t.id,n):this.fire(new o.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();const n=t.source,l=t.sourceLayer,d=this.sourceCaches[n];if(d!==void 0)return d.getSource().type!=="vector"||l?(t.id===void 0&&this.fire(new o.ErrorEvent(new Error("The feature id parameter must be provided."))),d.getFeatureState(l,t.id)):void this.fire(new o.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new o.ErrorEvent(new Error(`The source '${n}' does not exist in the map's style.`)))}getTransition(){return o.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){return o.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,sources:o.mapObject(this.sourceCaches,t=>t.serialize()),layers:this._serializeLayers(this._order)},t=>t!==void 0)}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&this.sourceCaches[t.source].getSource().type!=="raster"&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._changed=!0}_flattenAndSortRenderedFeatures(t){const n=_=>this._layers[_].type==="fill-extrusion",l={},d=[];for(let _=this._order.length-1;_>=0;_--){const b=this._order[_];if(n(b)){l[b]=_;for(const w of t){const E=w[b];if(E)for(const P of E)d.push(P)}}}d.sort((_,b)=>b.intersectionZ-_.intersectionZ);const f=[];for(let _=this._order.length-1;_>=0;_--){const b=this._order[_];if(n(b))for(let w=d.length-1;w>=0;w--){const E=d[w].feature;if(l[E.layer.id]<_)break;f.push(E),d.pop()}else for(const w of t){const E=w[b];if(E)for(const P of E)f.push(P.feature)}}return f}queryRenderedFeatures(t,n,l){n&&n.filter&&this._validate(o.validateStyle.filter,"queryRenderedFeatures.filter",n.filter,null,n);const d={};if(n&&n.layers){if(!Array.isArray(n.layers))return this.fire(new o.ErrorEvent(new Error("parameters.layers must be an Array."))),[];for(const _ of n.layers){const b=this._layers[_];if(!b)return this.fire(new o.ErrorEvent(new Error(`The layer '${_}' does not exist in the map's style and cannot be queried for features.`))),[];d[b.source]=!0}}const f=[];n.availableImages=this._availableImages;for(const _ in this.sourceCaches)n.layers&&!d[_]||f.push(br(this.sourceCaches[_],this._layers,this._serializedLayers,t,n,l));return this.placement&&f.push(function(_,b,w,E,P,L,O){const j={},U=L.queryRenderedSymbols(E),q=[];for(const ee of Object.keys(U).map(Number))q.push(O[ee]);q.sort(vn);for(const ee of q){const te=ee.featureIndex.lookupSymbolFeatures(U[ee.bucketInstanceId],b,ee.bucketIndex,ee.sourceLayerIndex,P.filter,P.layers,P.availableImages,_);for(const ne in te){const ie=j[ne]=j[ne]||[],fe=te[ne];fe.sort((ce,ue)=>{const ve=ee.featureSortOrder;if(ve){const Se=ve.indexOf(ce.featureIndex);return ve.indexOf(ue.featureIndex)-Se}return ue.featureIndex-ce.featureIndex});for(const ce of fe)ie.push(ce)}}for(const ee in j)j[ee].forEach(te=>{const ne=te.feature,ie=w[_[ee].source].getFeatureState(ne.layer["source-layer"],ne.id);ne.source=ne.layer.source,ne.layer["source-layer"]&&(ne.sourceLayer=ne.layer["source-layer"]),ne.state=ie});return j}(this._layers,this._serializedLayers,this.sourceCaches,t,n,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(f)}querySourceFeatures(t,n){n&&n.filter&&this._validate(o.validateStyle.filter,"querySourceFeatures.filter",n.filter,null,n);const l=this.sourceCaches[t];return l?function(d,f){const _=d.getRenderableIds().map(E=>d.getTileByID(E)),b=[],w={};for(let E=0;E<_.length;E++){const P=_[E],L=P.tileID.canonical.key;w[L]||(w[L]=!0,P.querySourceFeatures(b,f))}return b}(l,n):[]}addSourceType(t,n,l){return hi.getSourceType(t)?l(new Error(`A source type called "${t}" already exists.`)):(hi.setSourceType(t,n),n.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:t,url:n.workerSourceURL},l):l(null,null))}getLight(){return this.light.getLight()}setLight(t,n={}){this._checkLoaded();const l=this.light.getLight();let d=!1;for(const _ in t)if(!ae(t[_],l[_])){d=!0;break}if(!d)return;const f={now:o.exported.now(),transition:o.extend({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(t,n),this.light.updateTransitions(f)}_validate(t,n,l,d,f={}){return(!f||f.validate!==!1)&&it(this,t.call(o.validateStyle,o.extend({key:n,style:this.serialize(),value:l,styleSpec:o.spec},d)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),o.evented.off("pluginStateChange",this._rtlTextPluginCallback);for(const t in this._layers)this._layers[t].setEventedParent(null);for(const t in this.sourceCaches){const n=this.sourceCaches[t];n.setEventedParent(null),n.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove()}_clearSource(t){this.sourceCaches[t].clearTiles()}_reloadSource(t){this.sourceCaches[t].resume(),this.sourceCaches[t].reload()}_updateSources(t){for(const n in this.sourceCaches)this.sourceCaches[n].update(t)}_generateCollisionBoxes(){for(const t in this.sourceCaches)this._reloadSource(t)}_updatePlacement(t,n,l,d,f=!1){let _=!1,b=!1;const w={};for(const E of this._order){const P=this._layers[E];if(P.type!=="symbol")continue;if(!w[P.source]){const O=this.sourceCaches[P.source];w[P.source]=O.getRenderableIds(!0).map(j=>O.getTileByID(j)).sort((j,U)=>U.tileID.overscaledZ-j.tileID.overscaledZ||(j.tileID.isLessThan(U.tileID)?-1:1))}const L=this.crossTileSymbolIndex.addLayer(P,w[P.source],t.center.lng);_=_||L}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((f=f||this._layerOrderChanged||l===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(o.exported.now(),t.zoom))&&(this.pauseablePlacement=new Ne(t,this._order,f,n,l,d,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,w),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(o.exported.now()),b=!0),_&&this.pauseablePlacement.placement.setStale()),b||_)for(const E of this._order){const P=this._layers[E];P.type==="symbol"&&this.placement.updateLayerOpacities(P,w[P.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(o.exported.now())}_releaseSymbolFadeTiles(){for(const t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()}getImages(t,n,l){this.imageManager.getImages(n.icons,l),this._updateTilesForChangedImages();const d=this.sourceCaches[n.source];d&&d.setDependencies(n.tileID.key,n.type,n.icons)}getGlyphs(t,n,l){this.glyphManager.getGlyphs(n.stacks,l)}getResource(t,n,l){return o.makeRequest(n,l)}}hi.getSourceType=function(h){return Yi[h]},hi.setSourceType=function(h,t){Yi[h]=t},hi.registerForPluginStateChange=o.registerForPluginStateChange;var Ss=o.createLayout([{name:"a_pos",type:"Int16",components:2}]),Ts={prelude:Pt(`#ifdef GL_ES
precision mediump float;
#else
#if !defined(lowp)
#define lowp
#endif
#if !defined(mediump)
#define mediump
#endif
#if !defined(highp)
#define highp
#endif
#endif`,`#ifdef GL_ES
precision highp float;
#else
#if !defined(lowp)
#define lowp
#endif
#if !defined(mediump)
#define mediump
#endif
#if !defined(highp)
#define highp
#endif
#endif
vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0
);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}`),background:Pt(`uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,"attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),backgroundPattern:Pt(`uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,"uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:Pt(`varying vec3 v_data;
#pragma mapbox: define highp vec4 color
#pragma mapbox: define mediump float radius
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
#pragma mapbox: define highp vec4 stroke_color
#pragma mapbox: define mediump float stroke_width
#pragma mapbox: define lowp float stroke_opacity
void main() {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize mediump float radius
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize highp vec4 stroke_color
#pragma mapbox: initialize mediump float stroke_width
#pragma mapbox: initialize lowp float stroke_opacity
vec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,`uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;
#pragma mapbox: define highp vec4 color
#pragma mapbox: define mediump float radius
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
#pragma mapbox: define highp vec4 stroke_color
#pragma mapbox: define mediump float stroke_width
#pragma mapbox: define lowp float stroke_opacity
void main(void) {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize mediump float radius
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize highp vec4 stroke_color
#pragma mapbox: initialize mediump float stroke_width
#pragma mapbox: initialize lowp float stroke_opacity
vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,0,1);} else {gl_Position=u_matrix*vec4(circle_center,0,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`),clippingMask:Pt("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:Pt(`uniform highp float u_intensity;varying vec2 v_extrude;
#pragma mapbox: define highp float weight
#define GAUSS_COEF 0.3989422804014327
void main() {
#pragma mapbox: initialize highp float weight
float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,`uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude;
#pragma mapbox: define highp float weight
#pragma mapbox: define mediump float radius
const highp float ZERO=1.0/255.0/16.0;
#define GAUSS_COEF 0.3989422804014327
void main(void) {
#pragma mapbox: initialize highp float weight
#pragma mapbox: initialize mediump float radius
vec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,0,1);gl_Position=u_matrix*pos;}`),heatmapTexture:Pt(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(0.0);
#endif
}`,"uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:Pt("varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}","attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,0.0,1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:Pt("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd  =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz  /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:Pt("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,0,1);}"),fill:Pt(`#pragma mapbox: define highp vec4 color
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize lowp float opacity
gl_FragColor=color*opacity;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,`attribute vec2 a_pos;uniform mat4 u_matrix;
#pragma mapbox: define highp vec4 color
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize lowp float opacity
gl_Position=u_matrix*vec4(a_pos,0,1);}`),fillOutline:Pt(`varying vec2 v_pos;
#pragma mapbox: define highp vec4 outline_color
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize highp vec4 outline_color
#pragma mapbox: initialize lowp float opacity
float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,`attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;
#pragma mapbox: define highp vec4 outline_color
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize highp vec4 outline_color
#pragma mapbox: initialize lowp float opacity
gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillOutlinePattern:Pt(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp vec4 pattern_from
#pragma mapbox: define lowp vec4 pattern_to
void main() {
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump vec4 pattern_from
#pragma mapbox: initialize mediump vec4 pattern_to
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,`uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp vec4 pattern_from
#pragma mapbox: define lowp vec4 pattern_to
#pragma mapbox: define lowp float pixel_ratio_from
#pragma mapbox: define lowp float pixel_ratio_to
void main() {
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump vec4 pattern_from
#pragma mapbox: initialize mediump vec4 pattern_to
#pragma mapbox: initialize lowp float pixel_ratio_from
#pragma mapbox: initialize lowp float pixel_ratio_to
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillPattern:Pt(`#ifdef GL_ES
precision highp float;
#endif
uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp vec4 pattern_from
#pragma mapbox: define lowp vec4 pattern_to
void main() {
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump vec4 pattern_from
#pragma mapbox: initialize mediump vec4 pattern_to
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp vec4 pattern_from
#pragma mapbox: define lowp vec4 pattern_to
#pragma mapbox: define lowp float pixel_ratio_from
#pragma mapbox: define lowp float pixel_ratio_to
void main() {
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump vec4 pattern_from
#pragma mapbox: initialize mediump vec4 pattern_to
#pragma mapbox: initialize lowp float pixel_ratio_from
#pragma mapbox: initialize lowp float pixel_ratio_to
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}`),fillExtrusion:Pt(`varying vec4 v_color;void main() {gl_FragColor=v_color;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,`uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed;varying vec4 v_color;
#pragma mapbox: define highp float base
#pragma mapbox: define highp float height
#pragma mapbox: define highp vec4 color
void main() {
#pragma mapbox: initialize highp float base
#pragma mapbox: initialize highp float height
#pragma mapbox: initialize highp vec4 color
vec3 normal=a_normal_ed.xyz;base=max(0.0,base);height=max(0.0,height);float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}`),fillExtrusionPattern:Pt(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;
#pragma mapbox: define lowp float base
#pragma mapbox: define lowp float height
#pragma mapbox: define lowp vec4 pattern_from
#pragma mapbox: define lowp vec4 pattern_to
#pragma mapbox: define lowp float pixel_ratio_from
#pragma mapbox: define lowp float pixel_ratio_to
void main() {
#pragma mapbox: initialize lowp float base
#pragma mapbox: initialize lowp float height
#pragma mapbox: initialize mediump vec4 pattern_from
#pragma mapbox: initialize mediump vec4 pattern_to
#pragma mapbox: initialize lowp float pixel_ratio_from
#pragma mapbox: initialize lowp float pixel_ratio_to
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;
#pragma mapbox: define lowp float base
#pragma mapbox: define lowp float height
#pragma mapbox: define lowp vec4 pattern_from
#pragma mapbox: define lowp vec4 pattern_to
#pragma mapbox: define lowp float pixel_ratio_from
#pragma mapbox: define lowp float pixel_ratio_to
void main() {
#pragma mapbox: initialize lowp float base
#pragma mapbox: initialize lowp float height
#pragma mapbox: initialize mediump vec4 pattern_from
#pragma mapbox: initialize mediump vec4 pattern_to
#pragma mapbox: initialize lowp float pixel_ratio_from
#pragma mapbox: initialize lowp float pixel_ratio_to
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;base=max(0.0,base);height=max(0.0,height);float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0
? a_pos
: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}`),hillshadePrepare:Pt(`#ifdef GL_ES
precision highp float;
#endif
uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,"uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:Pt(`uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;
#define PI 3.141592653589793
void main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,"uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"),line:Pt(`uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;
#pragma mapbox: define highp vec4 color
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,`
#define scale 0.015873016
attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;
#pragma mapbox: define highp vec4 color
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
#pragma mapbox: define mediump float gapwidth
#pragma mapbox: define lowp float offset
#pragma mapbox: define mediump float width
void main() {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump float gapwidth
#pragma mapbox: initialize lowp float offset
#pragma mapbox: initialize mediump float width
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_width2=vec2(outset,inset);}`),lineGradient:Pt(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,`
#define scale 0.015873016
attribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv;
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
#pragma mapbox: define mediump float gapwidth
#pragma mapbox: define lowp float offset
#pragma mapbox: define mediump float width
void main() {
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump float gapwidth
#pragma mapbox: initialize lowp float offset
#pragma mapbox: initialize mediump float width
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_width2=vec2(outset,inset);}`),linePattern:Pt(`#ifdef GL_ES
precision highp float;
#endif
uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;
#pragma mapbox: define lowp vec4 pattern_from
#pragma mapbox: define lowp vec4 pattern_to
#pragma mapbox: define lowp float pixel_ratio_from
#pragma mapbox: define lowp float pixel_ratio_to
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize mediump vec4 pattern_from
#pragma mapbox: initialize mediump vec4 pattern_to
#pragma mapbox: initialize lowp float pixel_ratio_from
#pragma mapbox: initialize lowp float pixel_ratio_to
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,`
#define scale 0.015873016
#define LINE_DISTANCE_SCALE 2.0
attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp float offset
#pragma mapbox: define mediump float gapwidth
#pragma mapbox: define mediump float width
#pragma mapbox: define lowp float floorwidth
#pragma mapbox: define lowp vec4 pattern_from
#pragma mapbox: define lowp vec4 pattern_to
#pragma mapbox: define lowp float pixel_ratio_from
#pragma mapbox: define lowp float pixel_ratio_to
void main() {
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize lowp float offset
#pragma mapbox: initialize mediump float gapwidth
#pragma mapbox: initialize mediump float width
#pragma mapbox: initialize lowp float floorwidth
#pragma mapbox: initialize mediump vec4 pattern_from
#pragma mapbox: initialize mediump vec4 pattern_to
#pragma mapbox: initialize lowp float pixel_ratio_from
#pragma mapbox: initialize lowp float pixel_ratio_to
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:Pt(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;
#pragma mapbox: define highp vec4 color
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
#pragma mapbox: define mediump float width
#pragma mapbox: define lowp float floorwidth
void main() {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump float width
#pragma mapbox: initialize lowp float floorwidth
float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,`
#define scale 0.015873016
#define LINE_DISTANCE_SCALE 2.0
attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;
#pragma mapbox: define highp vec4 color
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
#pragma mapbox: define mediump float gapwidth
#pragma mapbox: define lowp float offset
#pragma mapbox: define mediump float width
#pragma mapbox: define lowp float floorwidth
void main() {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump float gapwidth
#pragma mapbox: initialize lowp float offset
#pragma mapbox: initialize mediump float width
#pragma mapbox: initialize lowp float floorwidth
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}`),raster:Pt(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,"uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),symbolIcon:Pt(`uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize lowp float opacity
lowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity;
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize lowp float opacity
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
camera_to_anchor_distance/u_camera_to_center_distance :
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),0.0,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;v_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));}`),symbolSDF:Pt(`#define SDF_PX 8.0
uniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;
#pragma mapbox: define highp vec4 fill_color
#pragma mapbox: define highp vec4 halo_color
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp float halo_width
#pragma mapbox: define lowp float halo_blur
void main() {
#pragma mapbox: initialize highp vec4 fill_color
#pragma mapbox: initialize highp vec4 halo_color
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize lowp float halo_width
#pragma mapbox: initialize lowp float halo_blur
float EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;varying vec2 v_data0;varying vec3 v_data1;
#pragma mapbox: define highp vec4 fill_color
#pragma mapbox: define highp vec4 halo_color
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp float halo_width
#pragma mapbox: define lowp float halo_blur
void main() {
#pragma mapbox: initialize highp vec4 fill_color
#pragma mapbox: initialize highp vec4 halo_color
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize lowp float halo_width
#pragma mapbox: initialize lowp float halo_blur
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
camera_to_anchor_distance/u_camera_to_center_distance :
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),0.0,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}`),symbolTextAndIcon:Pt(`#define SDF_PX 8.0
#define SDF 1.0
#define ICON 0.0
uniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;
#pragma mapbox: define highp vec4 fill_color
#pragma mapbox: define highp vec4 halo_color
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp float halo_width
#pragma mapbox: define lowp float halo_blur
void main() {
#pragma mapbox: initialize highp vec4 fill_color
#pragma mapbox: initialize highp vec4 halo_color
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize lowp float halo_width
#pragma mapbox: initialize lowp float halo_blur
float fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
return;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;varying vec4 v_data0;varying vec4 v_data1;
#pragma mapbox: define highp vec4 fill_color
#pragma mapbox: define highp vec4 halo_color
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp float halo_width
#pragma mapbox: define lowp float halo_blur
void main() {
#pragma mapbox: initialize highp vec4 fill_color
#pragma mapbox: initialize highp vec4 halo_color
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize lowp float halo_width
#pragma mapbox: initialize lowp float halo_blur
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
camera_to_anchor_distance/u_camera_to_center_distance :
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),0.0,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`)};function Pt(h,t){const n=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,l=t.match(/attribute ([\w]+) ([\w]+)/g),d=h.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),f=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),_=f?f.concat(d):d,b={};return{fragmentSource:h=h.replace(n,(w,E,P,L,O)=>(b[O]=!0,E==="define"?`
#ifndef HAS_UNIFORM_u_${O}
varying ${P} ${L} ${O};
#else
uniform ${P} ${L} u_${O};
#endif
`:`
#ifdef HAS_UNIFORM_u_${O}
    ${P} ${L} ${O} = u_${O};
#endif
`)),vertexSource:t=t.replace(n,(w,E,P,L,O)=>{const j=L==="float"?"vec2":"vec4",U=O.match(/color/)?"color":j;return b[O]?E==="define"?`
#ifndef HAS_UNIFORM_u_${O}
uniform lowp float u_${O}_t;
attribute ${P} ${j} a_${O};
varying ${P} ${L} ${O};
#else
uniform ${P} ${L} u_${O};
#endif
`:U==="vec4"?`
#ifndef HAS_UNIFORM_u_${O}
    ${O} = a_${O};
#else
    ${P} ${L} ${O} = u_${O};
#endif
`:`
#ifndef HAS_UNIFORM_u_${O}
    ${O} = unpack_mix_${U}(a_${O}, u_${O}_t);
#else
    ${P} ${L} ${O} = u_${O};
#endif
`:E==="define"?`
#ifndef HAS_UNIFORM_u_${O}
uniform lowp float u_${O}_t;
attribute ${P} ${j} a_${O};
#else
uniform ${P} ${L} u_${O};
#endif
`:U==="vec4"?`
#ifndef HAS_UNIFORM_u_${O}
    ${P} ${L} ${O} = a_${O};
#else
    ${P} ${L} ${O} = u_${O};
#endif
`:`
#ifndef HAS_UNIFORM_u_${O}
    ${P} ${L} ${O} = unpack_mix_${U}(a_${O}, u_${O}_t);
#else
    ${P} ${L} ${O} = u_${O};
#endif
`}),staticAttributes:l,staticUniforms:_}}class dc{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,n,l,d,f,_,b,w){this.context=t;let E=this.boundPaintVertexBuffers.length!==d.length;for(let P=0;!E&&P<d.length;P++)this.boundPaintVertexBuffers[P]!==d[P]&&(E=!0);t.extVertexArrayObject&&this.vao&&this.boundProgram===n&&this.boundLayoutVertexBuffer===l&&!E&&this.boundIndexBuffer===f&&this.boundVertexOffset===_&&this.boundDynamicVertexBuffer===b&&this.boundDynamicVertexBuffer2===w?(t.bindVertexArrayOES.set(this.vao),b&&b.bind(),f&&f.dynamicDraw&&f.bind(),w&&w.bind()):this.freshBind(n,l,d,f,_,b,w)}freshBind(t,n,l,d,f,_,b){let w;const E=t.numAttributes,P=this.context,L=P.gl;if(P.extVertexArrayObject)this.vao&&this.destroy(),this.vao=P.extVertexArrayObject.createVertexArrayOES(),P.bindVertexArrayOES.set(this.vao),w=0,this.boundProgram=t,this.boundLayoutVertexBuffer=n,this.boundPaintVertexBuffers=l,this.boundIndexBuffer=d,this.boundVertexOffset=f,this.boundDynamicVertexBuffer=_,this.boundDynamicVertexBuffer2=b;else{w=P.currentNumAttributes||0;for(let O=E;O<w;O++)L.disableVertexAttribArray(O)}n.enableAttributes(L,t);for(const O of l)O.enableAttributes(L,t);_&&_.enableAttributes(L,t),b&&b.enableAttributes(L,t),n.bind(),n.setVertexAttribPointers(L,t,f);for(const O of l)O.bind(),O.setVertexAttribPointers(L,t,f);_&&(_.bind(),_.setVertexAttribPointers(L,t,f)),d&&d.bind(),b&&(b.bind(),b.setVertexAttribPointers(L,t,f)),P.currentNumAttributes=E}destroy(){this.vao&&(this.context.extVertexArrayObject.deleteVertexArrayOES(this.vao),this.vao=null)}}function Is(h){const t=[];for(let n=0;n<h.length;n++){if(h[n]===null)continue;const l=h[n].split(" ");t.push(l.pop())}return t}class pc{constructor(t,n,l,d,f,_){const b=t.gl;this.program=b.createProgram();const w=Is(l.staticAttributes),E=d?d.getBinderAttributes():[],P=w.concat(E),L=l.staticUniforms?Is(l.staticUniforms):[],O=d?d.getBinderUniforms():[],j=L.concat(O),U=[];for(const ce of j)U.indexOf(ce)<0&&U.push(ce);const q=d?d.defines():[];_&&q.push("#define OVERDRAW_INSPECTOR;");const ee=q.concat(Ts.prelude.fragmentSource,l.fragmentSource).join(`
`),te=q.concat(Ts.prelude.vertexSource,l.vertexSource).join(`
`),ne=b.createShader(b.FRAGMENT_SHADER);if(b.isContextLost())return void(this.failedToCreate=!0);b.shaderSource(ne,ee),b.compileShader(ne),b.attachShader(this.program,ne);const ie=b.createShader(b.VERTEX_SHADER);if(b.isContextLost())return void(this.failedToCreate=!0);b.shaderSource(ie,te),b.compileShader(ie),b.attachShader(this.program,ie),this.attributes={};const fe={};this.numAttributes=P.length;for(let ce=0;ce<this.numAttributes;ce++)P[ce]&&(b.bindAttribLocation(this.program,ce,P[ce]),this.attributes[P[ce]]=ce);b.linkProgram(this.program),b.deleteShader(ie),b.deleteShader(ne);for(let ce=0;ce<U.length;ce++){const ue=U[ce];if(ue&&!fe[ue]){const ve=b.getUniformLocation(this.program,ue);ve&&(fe[ue]=ve)}}this.fixedUniforms=f(t,fe),this.binderUniforms=d?d.getUniforms(t,fe):[]}draw(t,n,l,d,f,_,b,w,E,P,L,O,j,U,q,ee){const te=t.gl;if(this.failedToCreate)return;t.program.set(this.program),t.setDepthMode(l),t.setStencilMode(d),t.setColorMode(f),t.setCullFace(_);for(const ie in this.fixedUniforms)this.fixedUniforms[ie].set(b[ie]);U&&U.setUniforms(t,this.binderUniforms,O,{zoom:j});const ne={[te.LINES]:2,[te.TRIANGLES]:3,[te.LINE_STRIP]:1}[n];for(const ie of L.get()){const fe=ie.vaos||(ie.vaos={});(fe[w]||(fe[w]=new dc)).bind(t,this,E,U?U.getPaintVertexBuffers():[],P,ie.vertexOffset,q,ee),te.drawElements(n,ie.primitiveLength*ne,te.UNSIGNED_SHORT,ie.primitiveOffset*ne*2)}}}function Es(h,t,n){const l=1/ii(n,1,t.transform.tileZoom),d=Math.pow(2,n.tileID.overscaledZ),f=n.tileSize*Math.pow(2,t.transform.tileZoom)/d,_=f*(n.tileID.canonical.x+n.tileID.wrap*d),b=f*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture.size,u_scale:[l,h.fromScale,h.toScale],u_fade:h.t,u_pixel_coord_upper:[_>>16,b>>16],u_pixel_coord_lower:[65535&_,65535&b]}}const $o=(h,t,n,l)=>{const d=t.style.light,f=d.properties.get("position"),_=[f.x,f.y,f.z],b=function(){var E=new o.ARRAY_TYPE(9);return o.ARRAY_TYPE!=Float32Array&&(E[1]=0,E[2]=0,E[3]=0,E[5]=0,E[6]=0,E[7]=0),E[0]=1,E[4]=1,E[8]=1,E}();d.properties.get("anchor")==="viewport"&&function(E,P){var L=Math.sin(P),O=Math.cos(P);E[0]=O,E[1]=L,E[2]=0,E[3]=-L,E[4]=O,E[5]=0,E[6]=0,E[7]=0,E[8]=1}(b,-t.transform.angle),function(E,P,L){var O=P[0],j=P[1],U=P[2];E[0]=O*L[0]+j*L[3]+U*L[6],E[1]=O*L[1]+j*L[4]+U*L[7],E[2]=O*L[2]+j*L[5]+U*L[8]}(_,_,b);const w=d.properties.get("color");return{u_matrix:h,u_lightpos:_,u_lightintensity:d.properties.get("intensity"),u_lightcolor:[w.r,w.g,w.b],u_vertical_gradient:+n,u_opacity:l}},As=(h,t,n,l,d,f,_)=>o.extend($o(h,t,n,l),Es(f,t,_),{u_height_factor:-Math.pow(2,d.overscaledZ)/_.tileSize/8}),Cs=h=>({u_matrix:h}),Ms=(h,t,n,l)=>o.extend(Cs(h),Es(n,t,l)),No=(h,t)=>({u_matrix:h,u_world:t}),Vo=(h,t,n,l,d)=>o.extend(Ms(h,t,n,l),{u_world:d}),en=(h,t,n,l)=>{const d=h.transform;let f,_;if(l.paint.get("circle-pitch-alignment")==="map"){const b=ii(n,1,d.zoom);f=!0,_=[b,b]}else f=!1,_=d.pixelsToGLUnits;return{u_camera_to_center_distance:d.cameraToCenterDistance,u_scale_with_map:+(l.paint.get("circle-pitch-scale")==="map"),u_matrix:h.translatePosMatrix(t.posMatrix,n,l.paint.get("circle-translate"),l.paint.get("circle-translate-anchor")),u_pitch_with_map:+f,u_device_pixel_ratio:h.pixelRatio,u_extrude_scale:_}},Aa=(h,t,n)=>{const l=ii(n,1,t.zoom),d=Math.pow(2,t.zoom-n.tileID.overscaledZ),f=n.tileID.overscaleFactor();return{u_matrix:h,u_camera_to_center_distance:t.cameraToCenterDistance,u_pixels_to_tile_units:l,u_extrude_scale:[t.pixelsToGLUnits[0]/(l*d),t.pixelsToGLUnits[1]/(l*d)],u_overscale_factor:f}},Sn=(h,t,n=1)=>({u_matrix:h,u_color:t,u_overlay:0,u_overlay_scale:n}),Jn=h=>({u_matrix:h}),Ca=(h,t,n,l)=>({u_matrix:h,u_extrude_scale:ii(t,1,n),u_intensity:l});function Ma(h,t){const n=Math.pow(2,t.canonical.z),l=t.canonical.y;return[new o.MercatorCoordinate(0,l/n).toLngLat().lat,new o.MercatorCoordinate(0,(l+1)/n).toLngLat().lat]}const Qn=(h,t,n)=>{const l=h.transform;return{u_matrix:Ps(h,t,n),u_ratio:1/ii(t,1,l.zoom),u_device_pixel_ratio:h.pixelRatio,u_units_to_pixels:[1/l.pixelsToGLUnits[0],1/l.pixelsToGLUnits[1]]}},Pa=(h,t,n,l)=>o.extend(Qn(h,t,n),{u_image:0,u_image_height:l}),ea=(h,t,n,l)=>{const d=h.transform,f=ta(t,d);return{u_matrix:Ps(h,t,n),u_texsize:t.imageAtlasTexture.size,u_ratio:1/ii(t,1,d.zoom),u_device_pixel_ratio:h.pixelRatio,u_image:0,u_scale:[f,l.fromScale,l.toScale],u_fade:l.t,u_units_to_pixels:[1/d.pixelsToGLUnits[0],1/d.pixelsToGLUnits[1]]}},Kt=(h,t,n,l,d)=>{const f=h.lineAtlas,_=ta(t,h.transform),b=n.layout.get("line-cap")==="round",w=f.getDash(l.from,b),E=f.getDash(l.to,b),P=w.width*d.fromScale,L=E.width*d.toScale;return o.extend(Qn(h,t,n),{u_patternscale_a:[_/P,-w.height/2],u_patternscale_b:[_/L,-E.height/2],u_sdfgamma:f.width/(256*Math.min(P,L)*h.pixelRatio)/2,u_image:0,u_tex_y_a:w.y,u_tex_y_b:E.y,u_mix:d.t})};function ta(h,t){return 1/ii(h,1,t.tileZoom)}function Ps(h,t,n){return h.translatePosMatrix(t.tileID.posMatrix,t,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}const Go=(h,t,n,l,d)=>{return{u_matrix:h,u_tl_parent:t,u_scale_parent:n,u_buffer_scale:1,u_fade_t:l.mix,u_opacity:l.opacity*d.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:d.paint.get("raster-brightness-min"),u_brightness_high:d.paint.get("raster-brightness-max"),u_saturation_factor:(_=d.paint.get("raster-saturation"),_>0?1-1/(1.001-_):-_),u_contrast_factor:(f=d.paint.get("raster-contrast"),f>0?1/(1-f):1+f),u_spin_weights:qo(d.paint.get("raster-hue-rotate"))};var f,_};function qo(h){h*=Math.PI/180;const t=Math.sin(h),n=Math.cos(h);return[(2*n+1)/3,(-Math.sqrt(3)*t-n+1)/3,(Math.sqrt(3)*t-n+1)/3]}const za=(h,t,n,l,d,f,_,b,w,E)=>{const P=d.transform;return{u_is_size_zoom_constant:+(h==="constant"||h==="source"),u_is_size_feature_constant:+(h==="constant"||h==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:P.cameraToCenterDistance,u_pitch:P.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:P.width/P.height,u_fade_change:d.options.fadeDuration?d.symbolFadeChange:1,u_matrix:f,u_label_plane_matrix:_,u_coord_matrix:b,u_is_text:+w,u_pitch_with_map:+l,u_texsize:E,u_texture:0}},zs=(h,t,n,l,d,f,_,b,w,E,P)=>{const L=d.transform;return o.extend(za(h,t,n,l,d,f,_,b,w,E),{u_gamma_scale:l?Math.cos(L._pitch)*L.cameraToCenterDistance:1,u_device_pixel_ratio:d.pixelRatio,u_is_halo:+P})},mc=(h,t,n,l,d,f,_,b,w,E)=>o.extend(zs(h,t,n,l,d,f,_,b,!0,w,!0),{u_texsize_icon:E,u_texture_icon:1}),fc=(h,t,n)=>({u_matrix:h,u_opacity:t,u_color:n}),ks=(h,t,n,l,d,f)=>o.extend(function(_,b,w,E){const P=w.imageManager.getPattern(_.from.toString()),L=w.imageManager.getPattern(_.to.toString()),{width:O,height:j}=w.imageManager.getPixelSize(),U=Math.pow(2,E.tileID.overscaledZ),q=E.tileSize*Math.pow(2,w.transform.tileZoom)/U,ee=q*(E.tileID.canonical.x+E.tileID.wrap*U),te=q*E.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:P.tl,u_pattern_br_a:P.br,u_pattern_tl_b:L.tl,u_pattern_br_b:L.br,u_texsize:[O,j],u_mix:b.t,u_pattern_size_a:P.displaySize,u_pattern_size_b:L.displaySize,u_scale_a:b.fromScale,u_scale_b:b.toScale,u_tile_units_to_pixels:1/ii(E,1,w.transform.tileZoom),u_pixel_coord_upper:[ee>>16,te>>16],u_pixel_coord_lower:[65535&ee,65535&te]}}(l,f,n,d),{u_matrix:h,u_opacity:t}),Ls={fillExtrusion:(h,t)=>({u_matrix:new o.UniformMatrix4f(h,t.u_matrix),u_lightpos:new o.Uniform3f(h,t.u_lightpos),u_lightintensity:new o.Uniform1f(h,t.u_lightintensity),u_lightcolor:new o.Uniform3f(h,t.u_lightcolor),u_vertical_gradient:new o.Uniform1f(h,t.u_vertical_gradient),u_opacity:new o.Uniform1f(h,t.u_opacity)}),fillExtrusionPattern:(h,t)=>({u_matrix:new o.UniformMatrix4f(h,t.u_matrix),u_lightpos:new o.Uniform3f(h,t.u_lightpos),u_lightintensity:new o.Uniform1f(h,t.u_lightintensity),u_lightcolor:new o.Uniform3f(h,t.u_lightcolor),u_vertical_gradient:new o.Uniform1f(h,t.u_vertical_gradient),u_height_factor:new o.Uniform1f(h,t.u_height_factor),u_image:new o.Uniform1i(h,t.u_image),u_texsize:new o.Uniform2f(h,t.u_texsize),u_pixel_coord_upper:new o.Uniform2f(h,t.u_pixel_coord_upper),u_pixel_coord_lower:new o.Uniform2f(h,t.u_pixel_coord_lower),u_scale:new o.Uniform3f(h,t.u_scale),u_fade:new o.Uniform1f(h,t.u_fade),u_opacity:new o.Uniform1f(h,t.u_opacity)}),fill:(h,t)=>({u_matrix:new o.UniformMatrix4f(h,t.u_matrix)}),fillPattern:(h,t)=>({u_matrix:new o.UniformMatrix4f(h,t.u_matrix),u_image:new o.Uniform1i(h,t.u_image),u_texsize:new o.Uniform2f(h,t.u_texsize),u_pixel_coord_upper:new o.Uniform2f(h,t.u_pixel_coord_upper),u_pixel_coord_lower:new o.Uniform2f(h,t.u_pixel_coord_lower),u_scale:new o.Uniform3f(h,t.u_scale),u_fade:new o.Uniform1f(h,t.u_fade)}),fillOutline:(h,t)=>({u_matrix:new o.UniformMatrix4f(h,t.u_matrix),u_world:new o.Uniform2f(h,t.u_world)}),fillOutlinePattern:(h,t)=>({u_matrix:new o.UniformMatrix4f(h,t.u_matrix),u_world:new o.Uniform2f(h,t.u_world),u_image:new o.Uniform1i(h,t.u_image),u_texsize:new o.Uniform2f(h,t.u_texsize),u_pixel_coord_upper:new o.Uniform2f(h,t.u_pixel_coord_upper),u_pixel_coord_lower:new o.Uniform2f(h,t.u_pixel_coord_lower),u_scale:new o.Uniform3f(h,t.u_scale),u_fade:new o.Uniform1f(h,t.u_fade)}),circle:(h,t)=>({u_camera_to_center_distance:new o.Uniform1f(h,t.u_camera_to_center_distance),u_scale_with_map:new o.Uniform1i(h,t.u_scale_with_map),u_pitch_with_map:new o.Uniform1i(h,t.u_pitch_with_map),u_extrude_scale:new o.Uniform2f(h,t.u_extrude_scale),u_device_pixel_ratio:new o.Uniform1f(h,t.u_device_pixel_ratio),u_matrix:new o.UniformMatrix4f(h,t.u_matrix)}),collisionBox:(h,t)=>({u_matrix:new o.UniformMatrix4f(h,t.u_matrix),u_camera_to_center_distance:new o.Uniform1f(h,t.u_camera_to_center_distance),u_pixels_to_tile_units:new o.Uniform1f(h,t.u_pixels_to_tile_units),u_extrude_scale:new o.Uniform2f(h,t.u_extrude_scale),u_overscale_factor:new o.Uniform1f(h,t.u_overscale_factor)}),collisionCircle:(h,t)=>({u_matrix:new o.UniformMatrix4f(h,t.u_matrix),u_inv_matrix:new o.UniformMatrix4f(h,t.u_inv_matrix),u_camera_to_center_distance:new o.Uniform1f(h,t.u_camera_to_center_distance),u_viewport_size:new o.Uniform2f(h,t.u_viewport_size)}),debug:(h,t)=>({u_color:new o.UniformColor(h,t.u_color),u_matrix:new o.UniformMatrix4f(h,t.u_matrix),u_overlay:new o.Uniform1i(h,t.u_overlay),u_overlay_scale:new o.Uniform1f(h,t.u_overlay_scale)}),clippingMask:(h,t)=>({u_matrix:new o.UniformMatrix4f(h,t.u_matrix)}),heatmap:(h,t)=>({u_extrude_scale:new o.Uniform1f(h,t.u_extrude_scale),u_intensity:new o.Uniform1f(h,t.u_intensity),u_matrix:new o.UniformMatrix4f(h,t.u_matrix)}),heatmapTexture:(h,t)=>({u_matrix:new o.UniformMatrix4f(h,t.u_matrix),u_world:new o.Uniform2f(h,t.u_world),u_image:new o.Uniform1i(h,t.u_image),u_color_ramp:new o.Uniform1i(h,t.u_color_ramp),u_opacity:new o.Uniform1f(h,t.u_opacity)}),hillshade:(h,t)=>({u_matrix:new o.UniformMatrix4f(h,t.u_matrix),u_image:new o.Uniform1i(h,t.u_image),u_latrange:new o.Uniform2f(h,t.u_latrange),u_light:new o.Uniform2f(h,t.u_light),u_shadow:new o.UniformColor(h,t.u_shadow),u_highlight:new o.UniformColor(h,t.u_highlight),u_accent:new o.UniformColor(h,t.u_accent)}),hillshadePrepare:(h,t)=>({u_matrix:new o.UniformMatrix4f(h,t.u_matrix),u_image:new o.Uniform1i(h,t.u_image),u_dimension:new o.Uniform2f(h,t.u_dimension),u_zoom:new o.Uniform1f(h,t.u_zoom),u_unpack:new o.Uniform4f(h,t.u_unpack)}),line:(h,t)=>({u_matrix:new o.UniformMatrix4f(h,t.u_matrix),u_ratio:new o.Uniform1f(h,t.u_ratio),u_device_pixel_ratio:new o.Uniform1f(h,t.u_device_pixel_ratio),u_units_to_pixels:new o.Uniform2f(h,t.u_units_to_pixels)}),lineGradient:(h,t)=>({u_matrix:new o.UniformMatrix4f(h,t.u_matrix),u_ratio:new o.Uniform1f(h,t.u_ratio),u_device_pixel_ratio:new o.Uniform1f(h,t.u_device_pixel_ratio),u_units_to_pixels:new o.Uniform2f(h,t.u_units_to_pixels),u_image:new o.Uniform1i(h,t.u_image),u_image_height:new o.Uniform1f(h,t.u_image_height)}),linePattern:(h,t)=>({u_matrix:new o.UniformMatrix4f(h,t.u_matrix),u_texsize:new o.Uniform2f(h,t.u_texsize),u_ratio:new o.Uniform1f(h,t.u_ratio),u_device_pixel_ratio:new o.Uniform1f(h,t.u_device_pixel_ratio),u_image:new o.Uniform1i(h,t.u_image),u_units_to_pixels:new o.Uniform2f(h,t.u_units_to_pixels),u_scale:new o.Uniform3f(h,t.u_scale),u_fade:new o.Uniform1f(h,t.u_fade)}),lineSDF:(h,t)=>({u_matrix:new o.UniformMatrix4f(h,t.u_matrix),u_ratio:new o.Uniform1f(h,t.u_ratio),u_device_pixel_ratio:new o.Uniform1f(h,t.u_device_pixel_ratio),u_units_to_pixels:new o.Uniform2f(h,t.u_units_to_pixels),u_patternscale_a:new o.Uniform2f(h,t.u_patternscale_a),u_patternscale_b:new o.Uniform2f(h,t.u_patternscale_b),u_sdfgamma:new o.Uniform1f(h,t.u_sdfgamma),u_image:new o.Uniform1i(h,t.u_image),u_tex_y_a:new o.Uniform1f(h,t.u_tex_y_a),u_tex_y_b:new o.Uniform1f(h,t.u_tex_y_b),u_mix:new o.Uniform1f(h,t.u_mix)}),raster:(h,t)=>({u_matrix:new o.UniformMatrix4f(h,t.u_matrix),u_tl_parent:new o.Uniform2f(h,t.u_tl_parent),u_scale_parent:new o.Uniform1f(h,t.u_scale_parent),u_buffer_scale:new o.Uniform1f(h,t.u_buffer_scale),u_fade_t:new o.Uniform1f(h,t.u_fade_t),u_opacity:new o.Uniform1f(h,t.u_opacity),u_image0:new o.Uniform1i(h,t.u_image0),u_image1:new o.Uniform1i(h,t.u_image1),u_brightness_low:new o.Uniform1f(h,t.u_brightness_low),u_brightness_high:new o.Uniform1f(h,t.u_brightness_high),u_saturation_factor:new o.Uniform1f(h,t.u_saturation_factor),u_contrast_factor:new o.Uniform1f(h,t.u_contrast_factor),u_spin_weights:new o.Uniform3f(h,t.u_spin_weights)}),symbolIcon:(h,t)=>({u_is_size_zoom_constant:new o.Uniform1i(h,t.u_is_size_zoom_constant),u_is_size_feature_constant:new o.Uniform1i(h,t.u_is_size_feature_constant),u_size_t:new o.Uniform1f(h,t.u_size_t),u_size:new o.Uniform1f(h,t.u_size),u_camera_to_center_distance:new o.Uniform1f(h,t.u_camera_to_center_distance),u_pitch:new o.Uniform1f(h,t.u_pitch),u_rotate_symbol:new o.Uniform1i(h,t.u_rotate_symbol),u_aspect_ratio:new o.Uniform1f(h,t.u_aspect_ratio),u_fade_change:new o.Uniform1f(h,t.u_fade_change),u_matrix:new o.UniformMatrix4f(h,t.u_matrix),u_label_plane_matrix:new o.UniformMatrix4f(h,t.u_label_plane_matrix),u_coord_matrix:new o.UniformMatrix4f(h,t.u_coord_matrix),u_is_text:new o.Uniform1i(h,t.u_is_text),u_pitch_with_map:new o.Uniform1i(h,t.u_pitch_with_map),u_texsize:new o.Uniform2f(h,t.u_texsize),u_texture:new o.Uniform1i(h,t.u_texture)}),symbolSDF:(h,t)=>({u_is_size_zoom_constant:new o.Uniform1i(h,t.u_is_size_zoom_constant),u_is_size_feature_constant:new o.Uniform1i(h,t.u_is_size_feature_constant),u_size_t:new o.Uniform1f(h,t.u_size_t),u_size:new o.Uniform1f(h,t.u_size),u_camera_to_center_distance:new o.Uniform1f(h,t.u_camera_to_center_distance),u_pitch:new o.Uniform1f(h,t.u_pitch),u_rotate_symbol:new o.Uniform1i(h,t.u_rotate_symbol),u_aspect_ratio:new o.Uniform1f(h,t.u_aspect_ratio),u_fade_change:new o.Uniform1f(h,t.u_fade_change),u_matrix:new o.UniformMatrix4f(h,t.u_matrix),u_label_plane_matrix:new o.UniformMatrix4f(h,t.u_label_plane_matrix),u_coord_matrix:new o.UniformMatrix4f(h,t.u_coord_matrix),u_is_text:new o.Uniform1i(h,t.u_is_text),u_pitch_with_map:new o.Uniform1i(h,t.u_pitch_with_map),u_texsize:new o.Uniform2f(h,t.u_texsize),u_texture:new o.Uniform1i(h,t.u_texture),u_gamma_scale:new o.Uniform1f(h,t.u_gamma_scale),u_device_pixel_ratio:new o.Uniform1f(h,t.u_device_pixel_ratio),u_is_halo:new o.Uniform1i(h,t.u_is_halo)}),symbolTextAndIcon:(h,t)=>({u_is_size_zoom_constant:new o.Uniform1i(h,t.u_is_size_zoom_constant),u_is_size_feature_constant:new o.Uniform1i(h,t.u_is_size_feature_constant),u_size_t:new o.Uniform1f(h,t.u_size_t),u_size:new o.Uniform1f(h,t.u_size),u_camera_to_center_distance:new o.Uniform1f(h,t.u_camera_to_center_distance),u_pitch:new o.Uniform1f(h,t.u_pitch),u_rotate_symbol:new o.Uniform1i(h,t.u_rotate_symbol),u_aspect_ratio:new o.Uniform1f(h,t.u_aspect_ratio),u_fade_change:new o.Uniform1f(h,t.u_fade_change),u_matrix:new o.UniformMatrix4f(h,t.u_matrix),u_label_plane_matrix:new o.UniformMatrix4f(h,t.u_label_plane_matrix),u_coord_matrix:new o.UniformMatrix4f(h,t.u_coord_matrix),u_is_text:new o.Uniform1i(h,t.u_is_text),u_pitch_with_map:new o.Uniform1i(h,t.u_pitch_with_map),u_texsize:new o.Uniform2f(h,t.u_texsize),u_texsize_icon:new o.Uniform2f(h,t.u_texsize_icon),u_texture:new o.Uniform1i(h,t.u_texture),u_texture_icon:new o.Uniform1i(h,t.u_texture_icon),u_gamma_scale:new o.Uniform1f(h,t.u_gamma_scale),u_device_pixel_ratio:new o.Uniform1f(h,t.u_device_pixel_ratio),u_is_halo:new o.Uniform1i(h,t.u_is_halo)}),background:(h,t)=>({u_matrix:new o.UniformMatrix4f(h,t.u_matrix),u_opacity:new o.Uniform1f(h,t.u_opacity),u_color:new o.UniformColor(h,t.u_color)}),backgroundPattern:(h,t)=>({u_matrix:new o.UniformMatrix4f(h,t.u_matrix),u_opacity:new o.Uniform1f(h,t.u_opacity),u_image:new o.Uniform1i(h,t.u_image),u_pattern_tl_a:new o.Uniform2f(h,t.u_pattern_tl_a),u_pattern_br_a:new o.Uniform2f(h,t.u_pattern_br_a),u_pattern_tl_b:new o.Uniform2f(h,t.u_pattern_tl_b),u_pattern_br_b:new o.Uniform2f(h,t.u_pattern_br_b),u_texsize:new o.Uniform2f(h,t.u_texsize),u_mix:new o.Uniform1f(h,t.u_mix),u_pattern_size_a:new o.Uniform2f(h,t.u_pattern_size_a),u_pattern_size_b:new o.Uniform2f(h,t.u_pattern_size_b),u_scale_a:new o.Uniform1f(h,t.u_scale_a),u_scale_b:new o.Uniform1f(h,t.u_scale_b),u_pixel_coord_upper:new o.Uniform2f(h,t.u_pixel_coord_upper),u_pixel_coord_lower:new o.Uniform2f(h,t.u_pixel_coord_lower),u_tile_units_to_pixels:new o.Uniform1f(h,t.u_tile_units_to_pixels)})};class Ds{constructor(t,n,l){this.context=t;const d=t.gl;this.buffer=d.createBuffer(),this.dynamicDraw=Boolean(l),this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),d.bufferData(d.ELEMENT_ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?d.DYNAMIC_DRAW:d.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){const n=this.context.gl;this.context.unbindVAO(),this.bind(),n.bufferSubData(n.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Rs={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class jo{constructor(t,n,l,d){this.length=n.length,this.attributes=l,this.itemSize=n.bytesPerElement,this.dynamicDraw=d,this.context=t;const f=t.gl;this.buffer=f.createBuffer(),t.bindVertexBuffer.set(this.buffer),f.bufferData(f.ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?f.DYNAMIC_DRAW:f.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){const n=this.context.gl;this.bind(),n.bufferSubData(n.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,n){for(let l=0;l<this.attributes.length;l++){const d=n.attributes[this.attributes[l].name];d!==void 0&&t.enableVertexAttribArray(d)}}setVertexAttribPointers(t,n,l){for(let d=0;d<this.attributes.length;d++){const f=this.attributes[d],_=n.attributes[f.name];_!==void 0&&t.vertexAttribPointer(_,f.components,t[Rs[f.type]],!1,this.itemSize,f.offset+this.itemSize*(l||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class vt{constructor(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(t){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class gc extends vt{getDefault(){return o.Color.transparent}set(t){const n=this.current;(t.r!==n.r||t.g!==n.g||t.b!==n.b||t.a!==n.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class ia extends vt{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class ra extends vt{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class Zo extends vt{getDefault(){return[!0,!0,!0,!0]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||t[3]!==n[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class Pi extends vt{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class Bs extends vt{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class ka extends vt{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){const n=this.current;(t.func!==n.func||t.ref!==n.ref||t.mask!==n.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}}class La extends vt{getDefault(){const t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}}class Fs extends vt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.STENCIL_TEST):n.disable(n.STENCIL_TEST),this.current=t,this.dirty=!1}}class Os extends vt{getDefault(){return[0,1]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}}class Da extends vt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.DEPTH_TEST):n.disable(n.DEPTH_TEST),this.current=t,this.dirty=!1}}class Us extends vt{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class $s extends vt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.BLEND):n.disable(n.BLEND),this.current=t,this.dirty=!1}}class Ra extends vt{getDefault(){const t=this.gl;return[t.ONE,t.ZERO]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||this.dirty)&&(this.gl.blendFunc(t[0],t[1]),this.current=t,this.dirty=!1)}}class Wo extends vt{getDefault(){return o.Color.transparent}set(t){const n=this.current;(t.r!==n.r||t.g!==n.g||t.b!==n.b||t.a!==n.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class Ho extends vt{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}}class Tn extends vt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.CULL_FACE):n.disable(n.CULL_FACE),this.current=t,this.dirty=!1}}class yc extends vt{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class _c extends vt{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}class xc extends vt{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}}class vc extends vt{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class bc extends vt{getDefault(){const t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||t[3]!==n[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class wc extends vt{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindFramebuffer(n.FRAMEBUFFER,t),this.current=t,this.dirty=!1}}class Ns extends vt{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindRenderbuffer(n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Vs extends vt{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindTexture(n.TEXTURE_2D,t),this.current=t,this.dirty=!1}}class In extends vt{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindBuffer(n.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Xo extends vt{getDefault(){return null}set(t){const n=this.gl;n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Yo extends vt{constructor(t){super(t),this.vao=t.extVertexArrayObject}getDefault(){return null}set(t){this.vao&&(t!==this.current||this.dirty)&&(this.vao.bindVertexArrayOES(t),this.current=t,this.dirty=!1)}}class Gs extends vt{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}}class tn extends vt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}}class Ko extends vt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}}class rn extends vt{constructor(t,n){super(t),this.context=t,this.parent=n}getDefault(){return null}}class En extends rn{setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class Jo extends rn{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class qs{constructor(t,n,l,d){this.context=t,this.width=n,this.height=l;const f=this.framebuffer=t.gl.createFramebuffer();this.colorAttachment=new En(t,f),d&&(this.depthAttachment=new Jo(t,f))}destroy(){const t=this.context.gl,n=this.colorAttachment.get();if(n&&t.deleteTexture(n),this.depthAttachment){const l=this.depthAttachment.get();l&&t.deleteRenderbuffer(l)}t.deleteFramebuffer(this.framebuffer)}}class tt{constructor(t,n,l){this.blendFunction=t,this.blendColor=n,this.mask=l}}tt.Replace=[1,0],tt.disabled=new tt(tt.Replace,o.Color.transparent,[!1,!1,!1,!1]),tt.unblended=new tt(tt.Replace,o.Color.transparent,[!0,!0,!0,!0]),tt.alphaBlended=new tt([1,771],o.Color.transparent,[!0,!0,!0,!0]);class Ba{constructor(t){this.gl=t,this.extVertexArrayObject=this.gl.getExtension("OES_vertex_array_object"),this.clearColor=new gc(this),this.clearDepth=new ia(this),this.clearStencil=new ra(this),this.colorMask=new Zo(this),this.depthMask=new Pi(this),this.stencilMask=new Bs(this),this.stencilFunc=new ka(this),this.stencilOp=new La(this),this.stencilTest=new Fs(this),this.depthRange=new Os(this),this.depthTest=new Da(this),this.depthFunc=new Us(this),this.blend=new $s(this),this.blendFunc=new Ra(this),this.blendColor=new Wo(this),this.blendEquation=new Ho(this),this.cullFace=new Tn(this),this.cullFaceSide=new yc(this),this.frontFace=new _c(this),this.program=new xc(this),this.activeTexture=new vc(this),this.viewport=new bc(this),this.bindFramebuffer=new wc(this),this.bindRenderbuffer=new Ns(this),this.bindTexture=new Vs(this),this.bindVertexBuffer=new In(this),this.bindElementBuffer=new Xo(this),this.bindVertexArrayOES=this.extVertexArrayObject&&new Yo(this),this.pixelStoreUnpack=new Gs(this),this.pixelStoreUnpackPremultiplyAlpha=new tn(this),this.pixelStoreUnpackFlipY=new Ko(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.extTextureHalfFloat=t.getExtension("OES_texture_half_float"),this.extTextureHalfFloat&&(t.getExtension("OES_texture_half_float_linear"),this.extRenderToTextureHalfFloat=t.getExtension("EXT_color_buffer_half_float")),this.extTimerQuery=t.getExtension("EXT_disjoint_timer_query"),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE)}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.extVertexArrayObject&&(this.bindVertexArrayOES.dirty=!0),this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(t,n){return new Ds(this,t,n)}createVertexBuffer(t,n,l){return new jo(this,t,n,l)}createRenderbuffer(t,n,l){const d=this.gl,f=d.createRenderbuffer();return this.bindRenderbuffer.set(f),d.renderbufferStorage(d.RENDERBUFFER,t,n,l),this.bindRenderbuffer.set(null),f}createFramebuffer(t,n,l){return new qs(this,t,n,l)}clear({color:t,depth:n}){const l=this.gl;let d=0;t&&(d|=l.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),n!==void 0&&(d|=l.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(n),this.depthMask.set(!0)),l.clear(d)}setCullFace(t){t.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace))}setDepthMode(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1)}setStencilMode(t){t.test.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1)}setColorMode(t){ae(t.blendFunction,tt.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor)),this.colorMask.set(t.mask)}unbindVAO(){this.extVertexArrayObject&&this.bindVertexArrayOES.set(null)}}class Tt{constructor(t,n,l){this.func=t,this.mask=n,this.range=l}}Tt.ReadOnly=!1,Tt.ReadWrite=!0,Tt.disabled=new Tt(519,Tt.ReadOnly,[0,1]);const Fa=7680;class Rt{constructor(t,n,l,d,f,_){this.test=t,this.ref=n,this.mask=l,this.fail=d,this.depthFail=f,this.pass=_}}Rt.disabled=new Rt({func:519,mask:0},0,0,Fa,Fa,Fa);class jt{constructor(t,n,l){this.enable=t,this.mode=n,this.frontFace=l}}let Oa;function js(h,t,n,l,d,f,_){const b=h.context,w=b.gl,E=h.useProgram("collisionBox"),P=[];let L=0,O=0;for(let ie=0;ie<l.length;ie++){const fe=l[ie],ce=t.getTile(fe),ue=ce.getBucket(n);if(!ue)continue;let ve=fe.posMatrix;d[0]===0&&d[1]===0||(ve=h.translatePosMatrix(fe.posMatrix,ce,d,f));const Se=_?ue.textCollisionBox:ue.iconCollisionBox,me=ue.collisionCircleArray;if(me.length>0){const Fe=o.create(),Ce=ve;o.mul(Fe,ue.placementInvProjMatrix,h.transform.glCoordMatrix),o.mul(Fe,Fe,ue.placementViewportMatrix),P.push({circleArray:me,circleOffset:O,transform:Ce,invTransform:Fe}),L+=me.length/4,O=L}Se&&E.draw(b,w.LINES,Tt.disabled,Rt.disabled,h.colorModeForRenderPass(),jt.disabled,Aa(ve,h.transform,ce),n.id,Se.layoutVertexBuffer,Se.indexBuffer,Se.segments,null,h.transform.zoom,null,null,Se.collisionVertexBuffer)}if(!_||!P.length)return;const j=h.useProgram("collisionCircle"),U=new o.CollisionCircleLayoutArray;U.resize(4*L),U._trim();let q=0;for(const ie of P)for(let fe=0;fe<ie.circleArray.length/4;fe++){const ce=4*fe,ue=ie.circleArray[ce+0],ve=ie.circleArray[ce+1],Se=ie.circleArray[ce+2],me=ie.circleArray[ce+3];U.emplace(q++,ue,ve,Se,me,0),U.emplace(q++,ue,ve,Se,me,1),U.emplace(q++,ue,ve,Se,me,2),U.emplace(q++,ue,ve,Se,me,3)}(!Oa||Oa.length<2*L)&&(Oa=function(ie){const fe=2*ie,ce=new o.QuadTriangleArray;ce.resize(fe),ce._trim();for(let ue=0;ue<fe;ue++){const ve=6*ue;ce.uint16[ve+0]=4*ue+0,ce.uint16[ve+1]=4*ue+1,ce.uint16[ve+2]=4*ue+2,ce.uint16[ve+3]=4*ue+2,ce.uint16[ve+4]=4*ue+3,ce.uint16[ve+5]=4*ue+0}return ce}(L));const ee=b.createIndexBuffer(Oa,!0),te=b.createVertexBuffer(U,o.collisionCircleLayout.members,!0);for(const ie of P){const fe={u_matrix:ie.transform,u_inv_matrix:ie.invTransform,u_camera_to_center_distance:(ne=h.transform).cameraToCenterDistance,u_viewport_size:[ne.width,ne.height]};j.draw(b,w.TRIANGLES,Tt.disabled,Rt.disabled,h.colorModeForRenderPass(),jt.disabled,fe,n.id,te,ee,o.SegmentVector.simpleSegment(0,2*ie.circleOffset,ie.circleArray.length,ie.circleArray.length/2),null,h.transform.zoom,null,null,null)}var ne;te.destroy(),ee.destroy()}jt.disabled=new jt(!1,1029,2305),jt.backCCW=new jt(!0,1029,2305);const Sc=o.identity(new Float32Array(16));function Zs(h,t,n,l,d,f){const{horizontalAlign:_,verticalAlign:b}=o.getAnchorAlignment(h),w=-(_-.5)*t,E=-(b-.5)*n,P=o.evaluateVariableOffset(h,l);return new o.pointGeometry((w/d+P[0])*f,(E/d+P[1])*f)}function Ua(h,t,n,l,d,f,_,b,w,E){const P=h.text.placedSymbolArray,L=h.text.dynamicLayoutVertexArray,O=h.icon.dynamicLayoutVertexArray,j={};L.clear();for(let U=0;U<P.length;U++){const q=P.get(U),ee=h.allowVerticalPlacement&&!q.placedOrientation,te=q.hidden||!q.crossTileID||ee?null:l[q.crossTileID];if(te){const ne=new o.pointGeometry(q.anchorX,q.anchorY),ie=kt(ne,n?_:f),fe=Ie(d.cameraToCenterDistance,ie.signedDistanceFromCamera);let ce=o.evaluateSizeForFeature(h.textSizeData,w,q)*fe/o.ONE_EM;n&&(ce*=h.tilePixelRatio/b);const{width:ue,height:ve,anchor:Se,textOffset:me,textBoxScale:Fe}=te,Ce=Zs(Se,ue,ve,me,Fe,ce),Je=n?kt(ne.add(Ce),f).point:ie.point.add(t?Ce.rotate(-d.angle):Ce),ft=h.allowVerticalPlacement&&q.placedOrientation===o.WritingMode.vertical?Math.PI/2:0;for(let ct=0;ct<q.numGlyphs;ct++)o.addDynamicAttributes(L,Je,ft);E&&q.associatedIconIndex>=0&&(j[q.associatedIconIndex]={shiftedAnchor:Je,angle:ft})}else Yt(q.numGlyphs,L)}if(E){O.clear();const U=h.icon.placedSymbolArray;for(let q=0;q<U.length;q++){const ee=U.get(q);if(ee.hidden)Yt(ee.numGlyphs,O);else{const te=j[q];if(te)for(let ne=0;ne<ee.numGlyphs;ne++)o.addDynamicAttributes(O,te.shiftedAnchor,te.angle);else Yt(ee.numGlyphs,O)}}h.icon.dynamicLayoutVertexBuffer.updateData(O)}h.text.dynamicLayoutVertexBuffer.updateData(L)}function $a(h,t,n){return n.iconsInText&&t?"symbolTextAndIcon":h?"symbolSDF":"symbolIcon"}function Na(h,t,n,l,d,f,_,b,w,E,P,L){const O=h.context,j=O.gl,U=h.transform,q=b==="map",ee=w==="map",te=b!=="viewport"&&n.layout.get("symbol-placement")!=="point",ne=q&&!ee&&!te,ie=!n.layout.get("symbol-sort-key").isConstant();let fe=!1;const ce=h.depthModeForSublayer(0,Tt.ReadOnly),ue=n.layout.get("text-variable-anchor"),ve=[];for(const Se of l){const me=t.getTile(Se),Fe=me.getBucket(n);if(!Fe)continue;const Ce=d?Fe.text:Fe.icon;if(!Ce||!Ce.segments.get().length)continue;const Je=Ce.programConfigurations.get(n.id),ft=d||Fe.sdfIcons,ct=d?Fe.textSizeData:Fe.iconSizeData,dt=ee||U.pitch!==0,Vt=h.useProgram($a(ft,d,Fe),Je),et=o.evaluateSizeForZoom(ct,U.zoom);let _t,It,ui,ki,Gi=[0,0],qi=null;if(d){if(It=me.glyphAtlasTexture,ui=j.LINEAR,_t=me.glyphAtlasTexture.size,Fe.iconsInText){Gi=me.imageAtlasTexture.size,qi=me.imageAtlasTexture;const hr=ct.kind==="composite"||ct.kind==="camera";ki=dt||h.options.rotating||h.options.zooming||hr?j.LINEAR:j.NEAREST}}else{const hr=n.layout.get("icon-size").constantOr(0)!==1||Fe.iconsNeedLinear;It=me.imageAtlasTexture,ui=ft||h.options.rotating||h.options.zooming||hr||dt?j.LINEAR:j.NEAREST,_t=me.imageAtlasTexture.size}const Or=ii(me,1,h.transform.zoom),Ci=yi(Se.posMatrix,ee,q,h.transform,Or),cr=Kr(Se.posMatrix,ee,q,h.transform,Or),cn=ue&&Fe.hasTextData(),Li=n.layout.get("icon-text-fit")!=="none"&&cn&&Fe.hasIconData();if(te){const hr=n.layout.get("text-rotation-alignment")==="map";rt(Fe,Se.posMatrix,h,d,Ci,cr,ee,E,hr)}const xt=h.translatePosMatrix(Se.posMatrix,me,f,_),bt=te||d&&ue||Li?Sc:Ci,Jt=h.translatePosMatrix(cr,me,f,_,!0),xi=ft&&n.paint.get(d?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let Ft;Ft=ft?Fe.iconsInText?mc(ct.kind,et,ne,ee,h,xt,bt,Jt,_t,Gi):zs(ct.kind,et,ne,ee,h,xt,bt,Jt,d,_t,!0):za(ct.kind,et,ne,ee,h,xt,bt,Jt,d,_t);const hn={program:Vt,buffers:Ce,uniformValues:Ft,atlasTexture:It,atlasTextureIcon:qi,atlasInterpolation:ui,atlasInterpolationIcon:ki,isSDF:ft,hasHalo:xi};if(ie&&Fe.canOverlap){fe=!0;const hr=Ce.segments.get();for(const es of hr)ve.push({segments:new o.SegmentVector([es]),sortKey:es.sortKey,state:hn})}else ve.push({segments:Ce.segments,sortKey:0,state:hn})}fe&&ve.sort((Se,me)=>Se.sortKey-me.sortKey);for(const Se of ve){const me=Se.state;if(O.activeTexture.set(j.TEXTURE0),me.atlasTexture.bind(me.atlasInterpolation,j.CLAMP_TO_EDGE),me.atlasTextureIcon&&(O.activeTexture.set(j.TEXTURE1),me.atlasTextureIcon&&me.atlasTextureIcon.bind(me.atlasInterpolationIcon,j.CLAMP_TO_EDGE)),me.isSDF){const Fe=me.uniformValues;me.hasHalo&&(Fe.u_is_halo=1,Va(me.buffers,Se.segments,n,h,me.program,ce,P,L,Fe)),Fe.u_is_halo=0}Va(me.buffers,Se.segments,n,h,me.program,ce,P,L,me.uniformValues)}}function Va(h,t,n,l,d,f,_,b,w){const E=l.context;d.draw(E,E.gl.TRIANGLES,f,_,b,jt.disabled,w,n.id,h.layoutVertexBuffer,h.indexBuffer,t,n.paint,l.transform.zoom,h.programConfigurations.get(n.id),h.dynamicLayoutVertexBuffer,h.opacityVertexBuffer)}function Ws(h,t,n,l,d,f,_){const b=h.context.gl,w=n.paint.get("fill-pattern"),E=w&&w.constantOr(1),P=n.getCrossfadeParameters();let L,O,j,U,q;_?(O=E&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",L=b.LINES):(O=E?"fillPattern":"fill",L=b.TRIANGLES);for(const ee of l){const te=t.getTile(ee);if(E&&!te.patternsLoaded())continue;const ne=te.getBucket(n);if(!ne)continue;const ie=ne.programConfigurations.get(n.id),fe=h.useProgram(O,ie);E&&(h.context.activeTexture.set(b.TEXTURE0),te.imageAtlasTexture.bind(b.LINEAR,b.CLAMP_TO_EDGE),ie.updatePaintBuffers(P));const ce=w.constantOr(null);if(ce&&te.imageAtlas){const ve=te.imageAtlas,Se=ve.patternPositions[ce.to.toString()],me=ve.patternPositions[ce.from.toString()];Se&&me&&ie.setConstantPatternPositions(Se,me)}const ue=h.translatePosMatrix(ee.posMatrix,te,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));if(_){U=ne.indexBuffer2,q=ne.segments2;const ve=[b.drawingBufferWidth,b.drawingBufferHeight];j=O==="fillOutlinePattern"&&E?Vo(ue,h,P,te,ve):No(ue,ve)}else U=ne.indexBuffer,q=ne.segments,j=E?Ms(ue,h,P,te):Cs(ue);fe.draw(h.context,L,d,h.stencilModeForClipping(ee),f,jt.disabled,j,n.id,ne.layoutVertexBuffer,U,q,n.paint,h.transform.zoom,ie)}}function An(h,t,n,l,d,f,_){const b=h.context,w=b.gl,E=n.paint.get("fill-extrusion-pattern"),P=E.constantOr(1),L=n.getCrossfadeParameters(),O=n.paint.get("fill-extrusion-opacity");for(const j of l){const U=t.getTile(j),q=U.getBucket(n);if(!q)continue;const ee=q.programConfigurations.get(n.id),te=h.useProgram(P?"fillExtrusionPattern":"fillExtrusion",ee);P&&(h.context.activeTexture.set(w.TEXTURE0),U.imageAtlasTexture.bind(w.LINEAR,w.CLAMP_TO_EDGE),ee.updatePaintBuffers(L));const ne=E.constantOr(null);if(ne&&U.imageAtlas){const ue=U.imageAtlas,ve=ue.patternPositions[ne.to.toString()],Se=ue.patternPositions[ne.from.toString()];ve&&Se&&ee.setConstantPatternPositions(ve,Se)}const ie=h.translatePosMatrix(j.posMatrix,U,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),fe=n.paint.get("fill-extrusion-vertical-gradient"),ce=P?As(ie,h,fe,O,j,L,U):$o(ie,h,fe,O);te.draw(b,b.gl.TRIANGLES,d,f,_,jt.backCCW,ce,n.id,q.layoutVertexBuffer,q.indexBuffer,q.segments,n.paint,h.transform.zoom,ee)}}function Ga(h,t,n,l,d,f){const _=h.context,b=_.gl,w=t.fbo;if(!w)return;const E=h.useProgram("hillshade");_.activeTexture.set(b.TEXTURE0),b.bindTexture(b.TEXTURE_2D,w.colorAttachment.get());const P=((L,O,j)=>{const U=j.paint.get("hillshade-shadow-color"),q=j.paint.get("hillshade-highlight-color"),ee=j.paint.get("hillshade-accent-color");let te=j.paint.get("hillshade-illumination-direction")*(Math.PI/180);j.paint.get("hillshade-illumination-anchor")==="viewport"&&(te-=L.transform.angle);const ne=!L.options.moving;return{u_matrix:L.transform.calculatePosMatrix(O.tileID.toUnwrapped(),ne),u_image:0,u_latrange:Ma(0,O.tileID),u_light:[j.paint.get("hillshade-exaggeration"),te],u_shadow:U,u_highlight:q,u_accent:ee}})(h,t,n);E.draw(_,b.TRIANGLES,l,d,f,jt.disabled,P,n.id,h.rasterBoundsBuffer,h.quadTriangleIndexBuffer,h.rasterBoundsSegments)}function tr(h,t,n,l,d,f){const _=h.context,b=_.gl,w=t.dem;if(w&&w.data){const E=w.dim,P=w.stride,L=w.getPixels();if(_.activeTexture.set(b.TEXTURE1),_.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||h.getTileTexture(P),t.demTexture){const j=t.demTexture;j.update(L,{premultiply:!1}),j.bind(b.NEAREST,b.CLAMP_TO_EDGE)}else t.demTexture=new We(_,L,b.RGBA,{premultiply:!1}),t.demTexture.bind(b.NEAREST,b.CLAMP_TO_EDGE);_.activeTexture.set(b.TEXTURE0);let O=t.fbo;if(!O){const j=new We(_,{width:E,height:E,data:null},b.RGBA);j.bind(b.LINEAR,b.CLAMP_TO_EDGE),O=t.fbo=_.createFramebuffer(E,E,!0),O.colorAttachment.set(j.texture)}_.bindFramebuffer.set(O.framebuffer),_.viewport.set([0,0,E,E]),h.useProgram("hillshadePrepare").draw(_,b.TRIANGLES,l,d,f,jt.disabled,((j,U)=>{const q=U.stride,ee=o.create();return o.ortho(ee,0,o.EXTENT,-o.EXTENT,0,0,1),o.translate(ee,ee,[0,-o.EXTENT,0]),{u_matrix:ee,u_image:1,u_dimension:[q,q],u_zoom:j.overscaledZ,u_unpack:U.getUnpackVector()}})(t.tileID,w),n.id,h.rasterBoundsBuffer,h.quadTriangleIndexBuffer,h.rasterBoundsSegments),t.needsHillshadePrepare=!1}}function Qo(h,t,n,l,d){const f=l.paint.get("raster-fade-duration");if(f>0){const _=o.exported.now(),b=(_-h.timeAdded)/f,w=t?(_-t.timeAdded)/f:-1,E=n.getSource(),P=d.coveringZoomLevel({tileSize:E.tileSize,roundZoom:E.roundZoom}),L=!t||Math.abs(t.tileID.overscaledZ-P)>Math.abs(h.tileID.overscaledZ-P),O=L&&h.refreshedUponExpiration?1:o.clamp(L?b:1-w,0,1);return h.refreshedUponExpiration&&b>=1&&(h.refreshedUponExpiration=!1),t?{opacity:1,mix:1-O}:{opacity:O,mix:0}}return{opacity:1,mix:0}}const el=new o.Color(1,0,0,1),tl=new o.Color(0,1,0,1),Cn=new o.Color(0,0,1,1),qa=new o.Color(1,0,1,1),Hs=new o.Color(0,1,1,1);function il(h,t,n,l){Za(h,0,t+n/2,h.transform.width,n,l)}function ja(h,t,n,l){Za(h,t-n/2,0,n,h.transform.height,l)}function Za(h,t,n,l,d,f){const _=h.context,b=_.gl;b.enable(b.SCISSOR_TEST),b.scissor(t*h.pixelRatio,n*h.pixelRatio,l*h.pixelRatio,d*h.pixelRatio),_.clear({color:f}),b.disable(b.SCISSOR_TEST)}function rl(h,t,n){const l=h.context,d=l.gl,f=n.posMatrix,_=h.useProgram("debug"),b=Tt.disabled,w=Rt.disabled,E=h.colorModeForRenderPass(),P="$debug";l.activeTexture.set(d.TEXTURE0),h.emptyTexture.bind(d.LINEAR,d.CLAMP_TO_EDGE),_.draw(l,d.LINE_STRIP,b,w,E,jt.disabled,Sn(f,o.Color.red),P,h.debugBuffer,h.tileBorderIndexBuffer,h.debugSegments);const L=t.getTileByID(n.key).latestRawTileData,O=Math.floor((L&&L.byteLength||0)/1024),j=t.getTile(n).tileSize,U=512/Math.min(j,512)*(n.overscaledZ/h.transform.zoom)*.5;let q=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(q+=` => ${n.overscaledZ}`),function(ee,te){ee.initDebugOverlayCanvas();const ne=ee.debugOverlayCanvas,ie=ee.context.gl,fe=ee.debugOverlayCanvas.getContext("2d");fe.clearRect(0,0,ne.width,ne.height),fe.shadowColor="white",fe.shadowBlur=2,fe.lineWidth=1.5,fe.strokeStyle="white",fe.textBaseline="top",fe.font="bold 36px Open Sans, sans-serif",fe.fillText(te,5,5),fe.strokeText(te,5,5),ee.debugOverlayTexture.update(ne),ee.debugOverlayTexture.bind(ie.LINEAR,ie.CLAMP_TO_EDGE)}(h,`${q} ${O}kb`),_.draw(l,d.TRIANGLES,b,w,tt.alphaBlended,jt.disabled,Sn(f,o.Color.transparent,U),P,h.debugBuffer,h.quadTriangleIndexBuffer,h.debugSegments)}const na={symbol:function(h,t,n,l,d){if(h.renderPass!=="translucent")return;const f=Rt.disabled,_=h.colorModeForRenderPass();n.layout.get("text-variable-anchor")&&function(b,w,E,P,L,O,j){const U=w.transform,q=L==="map",ee=O==="map";for(const te of b){const ne=P.getTile(te),ie=ne.getBucket(E);if(!ie||!ie.text||!ie.text.segments.get().length)continue;const fe=o.evaluateSizeForZoom(ie.textSizeData,U.zoom),ce=ii(ne,1,w.transform.zoom),ue=yi(te.posMatrix,ee,q,w.transform,ce),ve=E.layout.get("icon-text-fit")!=="none"&&ie.hasIconData();if(fe){const Se=Math.pow(2,U.zoom-ne.tileID.overscaledZ);Ua(ie,q,ee,j,U,ue,te.posMatrix,Se,fe,ve)}}}(l,h,n,t,n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),d),n.paint.get("icon-opacity").constantOr(1)!==0&&Na(h,t,n,l,!1,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),n.layout.get("icon-rotation-alignment"),n.layout.get("icon-pitch-alignment"),n.layout.get("icon-keep-upright"),f,_),n.paint.get("text-opacity").constantOr(1)!==0&&Na(h,t,n,l,!0,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),n.layout.get("text-keep-upright"),f,_),t.map.showCollisionBoxes&&(js(h,t,n,l,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),!0),js(h,t,n,l,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),!1))},circle:function(h,t,n,l){if(h.renderPass!=="translucent")return;const d=n.paint.get("circle-opacity"),f=n.paint.get("circle-stroke-width"),_=n.paint.get("circle-stroke-opacity"),b=!n.layout.get("circle-sort-key").isConstant();if(d.constantOr(1)===0&&(f.constantOr(1)===0||_.constantOr(1)===0))return;const w=h.context,E=w.gl,P=h.depthModeForSublayer(0,Tt.ReadOnly),L=Rt.disabled,O=h.colorModeForRenderPass(),j=[];for(let U=0;U<l.length;U++){const q=l[U],ee=t.getTile(q),te=ee.getBucket(n);if(!te)continue;const ne=te.programConfigurations.get(n.id),ie={programConfiguration:ne,program:h.useProgram("circle",ne),layoutVertexBuffer:te.layoutVertexBuffer,indexBuffer:te.indexBuffer,uniformValues:en(h,q,ee,n)};if(b){const fe=te.segments.get();for(const ce of fe)j.push({segments:new o.SegmentVector([ce]),sortKey:ce.sortKey,state:ie})}else j.push({segments:te.segments,sortKey:0,state:ie})}b&&j.sort((U,q)=>U.sortKey-q.sortKey);for(const U of j){const{programConfiguration:q,program:ee,layoutVertexBuffer:te,indexBuffer:ne,uniformValues:ie}=U.state;ee.draw(w,E.TRIANGLES,P,L,O,jt.disabled,ie,n.id,te,ne,U.segments,n.paint,h.transform.zoom,q)}},heatmap:function(h,t,n,l){if(n.paint.get("heatmap-opacity")!==0)if(h.renderPass==="offscreen"){const d=h.context,f=d.gl,_=Rt.disabled,b=new tt([f.ONE,f.ONE],o.Color.transparent,[!0,!0,!0,!0]);(function(w,E,P){const L=w.gl;w.activeTexture.set(L.TEXTURE1),w.viewport.set([0,0,E.width/4,E.height/4]);let O=P.heatmapFbo;if(O)L.bindTexture(L.TEXTURE_2D,O.colorAttachment.get()),w.bindFramebuffer.set(O.framebuffer);else{const j=L.createTexture();L.bindTexture(L.TEXTURE_2D,j),L.texParameteri(L.TEXTURE_2D,L.TEXTURE_WRAP_S,L.CLAMP_TO_EDGE),L.texParameteri(L.TEXTURE_2D,L.TEXTURE_WRAP_T,L.CLAMP_TO_EDGE),L.texParameteri(L.TEXTURE_2D,L.TEXTURE_MIN_FILTER,L.LINEAR),L.texParameteri(L.TEXTURE_2D,L.TEXTURE_MAG_FILTER,L.LINEAR),O=P.heatmapFbo=w.createFramebuffer(E.width/4,E.height/4,!1),function(U,q,ee,te){const ne=U.gl;ne.texImage2D(ne.TEXTURE_2D,0,ne.RGBA,q.width/4,q.height/4,0,ne.RGBA,U.extRenderToTextureHalfFloat?U.extTextureHalfFloat.HALF_FLOAT_OES:ne.UNSIGNED_BYTE,null),te.colorAttachment.set(ee)}(w,E,j,O)}})(d,h,n),d.clear({color:o.Color.transparent});for(let w=0;w<l.length;w++){const E=l[w];if(t.hasRenderableParent(E))continue;const P=t.getTile(E),L=P.getBucket(n);if(!L)continue;const O=L.programConfigurations.get(n.id),j=h.useProgram("heatmap",O),{zoom:U}=h.transform;j.draw(d,f.TRIANGLES,Tt.disabled,_,b,jt.disabled,Ca(E.posMatrix,P,U,n.paint.get("heatmap-intensity")),n.id,L.layoutVertexBuffer,L.indexBuffer,L.segments,n.paint,h.transform.zoom,O)}d.viewport.set([0,0,h.width,h.height])}else h.renderPass==="translucent"&&(h.context.setColorMode(h.colorModeForRenderPass()),function(d,f){const _=d.context,b=_.gl,w=f.heatmapFbo;if(!w)return;_.activeTexture.set(b.TEXTURE0),b.bindTexture(b.TEXTURE_2D,w.colorAttachment.get()),_.activeTexture.set(b.TEXTURE1);let E=f.colorRampTexture;E||(E=f.colorRampTexture=new We(_,f.colorRamp,b.RGBA)),E.bind(b.LINEAR,b.CLAMP_TO_EDGE),d.useProgram("heatmapTexture").draw(_,b.TRIANGLES,Tt.disabled,Rt.disabled,d.colorModeForRenderPass(),jt.disabled,((P,L,O,j)=>{const U=o.create();o.ortho(U,0,P.width,P.height,0,0,1);const q=P.context.gl;return{u_matrix:U,u_world:[q.drawingBufferWidth,q.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:L.paint.get("heatmap-opacity")}})(d,f),f.id,d.viewportBuffer,d.quadTriangleIndexBuffer,d.viewportSegments,f.paint,d.transform.zoom)}(h,n))},line:function(h,t,n,l){if(h.renderPass!=="translucent")return;const d=n.paint.get("line-opacity"),f=n.paint.get("line-width");if(d.constantOr(1)===0||f.constantOr(1)===0)return;const _=h.depthModeForSublayer(0,Tt.ReadOnly),b=h.colorModeForRenderPass(),w=n.paint.get("line-dasharray"),E=n.paint.get("line-pattern"),P=E.constantOr(1),L=n.paint.get("line-gradient"),O=n.getCrossfadeParameters(),j=P?"linePattern":w?"lineSDF":L?"lineGradient":"line",U=h.context,q=U.gl;let ee=!0;for(const te of l){const ne=t.getTile(te);if(P&&!ne.patternsLoaded())continue;const ie=ne.getBucket(n);if(!ie)continue;const fe=ie.programConfigurations.get(n.id),ce=h.context.program.get(),ue=h.useProgram(j,fe),ve=ee||ue.program!==ce,Se=E.constantOr(null);if(Se&&ne.imageAtlas){const Fe=ne.imageAtlas,Ce=Fe.patternPositions[Se.to.toString()],Je=Fe.patternPositions[Se.from.toString()];Ce&&Je&&fe.setConstantPatternPositions(Ce,Je)}const me=P?ea(h,ne,n,O):w?Kt(h,ne,n,w,O):L?Pa(h,ne,n,ie.lineClipsArray.length):Qn(h,ne,n);if(P)U.activeTexture.set(q.TEXTURE0),ne.imageAtlasTexture.bind(q.LINEAR,q.CLAMP_TO_EDGE),fe.updatePaintBuffers(O);else if(w&&(ve||h.lineAtlas.dirty))U.activeTexture.set(q.TEXTURE0),h.lineAtlas.bind(U);else if(L){const Fe=ie.gradients[n.id];let Ce=Fe.texture;if(n.gradientVersion!==Fe.version){let Je=256;if(n.stepInterpolant){const ft=t.getSource().maxzoom,ct=te.canonical.z===ft?Math.ceil(1<<h.transform.maxZoom-te.canonical.z):1;Je=o.clamp(o.nextPowerOfTwo(ie.maxLineLength/o.EXTENT*1024*ct),256,U.maxTextureSize)}Fe.gradient=o.renderColorRamp({expression:n.gradientExpression(),evaluationKey:"lineProgress",resolution:Je,image:Fe.gradient||void 0,clips:ie.lineClipsArray}),Fe.texture?Fe.texture.update(Fe.gradient):Fe.texture=new We(U,Fe.gradient,q.RGBA),Fe.version=n.gradientVersion,Ce=Fe.texture}U.activeTexture.set(q.TEXTURE0),Ce.bind(n.stepInterpolant?q.NEAREST:q.LINEAR,q.CLAMP_TO_EDGE)}ue.draw(U,q.TRIANGLES,_,h.stencilModeForClipping(te),b,jt.disabled,me,n.id,ie.layoutVertexBuffer,ie.indexBuffer,ie.segments,n.paint,h.transform.zoom,fe,ie.layoutVertexBuffer2),ee=!1}},fill:function(h,t,n,l){const d=n.paint.get("fill-color"),f=n.paint.get("fill-opacity");if(f.constantOr(1)===0)return;const _=h.colorModeForRenderPass(),b=n.paint.get("fill-pattern"),w=h.opaquePassEnabledForLayer()&&!b.constantOr(1)&&d.constantOr(o.Color.transparent).a===1&&f.constantOr(0)===1?"opaque":"translucent";if(h.renderPass===w){const E=h.depthModeForSublayer(1,h.renderPass==="opaque"?Tt.ReadWrite:Tt.ReadOnly);Ws(h,t,n,l,E,_,!1)}if(h.renderPass==="translucent"&&n.paint.get("fill-antialias")){const E=h.depthModeForSublayer(n.getPaintProperty("fill-outline-color")?2:0,Tt.ReadOnly);Ws(h,t,n,l,E,_,!0)}},"fill-extrusion":function(h,t,n,l){const d=n.paint.get("fill-extrusion-opacity");if(d!==0&&h.renderPass==="translucent"){const f=new Tt(h.context.gl.LEQUAL,Tt.ReadWrite,h.depthRangeFor3D);if(d!==1||n.paint.get("fill-extrusion-pattern").constantOr(1))An(h,t,n,l,f,Rt.disabled,tt.disabled),An(h,t,n,l,f,h.stencilModeFor3D(),h.colorModeForRenderPass());else{const _=h.colorModeForRenderPass();An(h,t,n,l,f,Rt.disabled,_)}}},hillshade:function(h,t,n,l){if(h.renderPass!=="offscreen"&&h.renderPass!=="translucent")return;const d=h.context,f=h.depthModeForSublayer(0,Tt.ReadOnly),_=h.colorModeForRenderPass(),[b,w]=h.renderPass==="translucent"?h.stencilConfigForOverlap(l):[{},l];for(const E of w){const P=t.getTile(E);P.needsHillshadePrepare&&h.renderPass==="offscreen"?tr(h,P,n,f,Rt.disabled,_):h.renderPass==="translucent"&&Ga(h,P,n,f,b[E.overscaledZ],_)}d.viewport.set([0,0,h.width,h.height])},raster:function(h,t,n,l){if(h.renderPass!=="translucent"||n.paint.get("raster-opacity")===0||!l.length)return;const d=h.context,f=d.gl,_=t.getSource(),b=h.useProgram("raster"),w=h.colorModeForRenderPass(),[E,P]=_ instanceof xr?[{},l]:h.stencilConfigForOverlap(l),L=P[P.length-1].overscaledZ,O=!h.options.moving;for(const j of P){const U=h.depthModeForSublayer(j.overscaledZ-L,n.paint.get("raster-opacity")===1?Tt.ReadWrite:Tt.ReadOnly,f.LESS),q=t.getTile(j),ee=h.transform.calculatePosMatrix(j.toUnwrapped(),O);q.registerFadeDuration(n.paint.get("raster-fade-duration"));const te=t.findLoadedParent(j,0),ne=Qo(q,te,t,n,h.transform);let ie,fe;const ce=n.paint.get("raster-resampling")==="nearest"?f.NEAREST:f.LINEAR;d.activeTexture.set(f.TEXTURE0),q.texture.bind(ce,f.CLAMP_TO_EDGE,f.LINEAR_MIPMAP_NEAREST),d.activeTexture.set(f.TEXTURE1),te?(te.texture.bind(ce,f.CLAMP_TO_EDGE,f.LINEAR_MIPMAP_NEAREST),ie=Math.pow(2,te.tileID.overscaledZ-q.tileID.overscaledZ),fe=[q.tileID.canonical.x*ie%1,q.tileID.canonical.y*ie%1]):q.texture.bind(ce,f.CLAMP_TO_EDGE,f.LINEAR_MIPMAP_NEAREST);const ue=Go(ee,fe||[0,0],ie||1,ne,n);_ instanceof xr?b.draw(d,f.TRIANGLES,U,Rt.disabled,w,jt.disabled,ue,n.id,_.boundsBuffer,h.quadTriangleIndexBuffer,_.boundsSegments):b.draw(d,f.TRIANGLES,U,E[j.overscaledZ],w,jt.disabled,ue,n.id,h.rasterBoundsBuffer,h.quadTriangleIndexBuffer,h.rasterBoundsSegments)}},background:function(h,t,n){const l=n.paint.get("background-color"),d=n.paint.get("background-opacity");if(d===0)return;const f=h.context,_=f.gl,b=h.transform,w=b.tileSize,E=n.paint.get("background-pattern");if(h.isPatternMissing(E))return;const P=!E&&l.a===1&&d===1&&h.opaquePassEnabledForLayer()?"opaque":"translucent";if(h.renderPass!==P)return;const L=Rt.disabled,O=h.depthModeForSublayer(0,P==="opaque"?Tt.ReadWrite:Tt.ReadOnly),j=h.colorModeForRenderPass(),U=h.useProgram(E?"backgroundPattern":"background"),q=b.coveringTiles({tileSize:w});E&&(f.activeTexture.set(_.TEXTURE0),h.imageManager.bind(h.context));const ee=n.getCrossfadeParameters();for(const te of q){const ne=h.transform.calculatePosMatrix(te.toUnwrapped()),ie=E?ks(ne,d,h,E,{tileID:te,tileSize:w},ee):fc(ne,d,l);U.draw(f,_.TRIANGLES,O,L,j,jt.disabled,ie,n.id,h.tileExtentBuffer,h.quadTriangleIndexBuffer,h.tileExtentSegments)}},debug:function(h,t,n){for(let l=0;l<n.length;l++)rl(h,t,n[l])},custom:function(h,t,n){const l=h.context,d=n.implementation;if(h.renderPass==="offscreen"){const f=d.prerender;f&&(h.setCustomLayerDefaults(),l.setColorMode(h.colorModeForRenderPass()),f.call(d,l.gl,h.transform.customLayerMatrix()),l.setDirty(),h.setBaseState())}else if(h.renderPass==="translucent"){h.setCustomLayerDefaults(),l.setColorMode(h.colorModeForRenderPass()),l.setStencilMode(Rt.disabled);const f=d.renderingMode==="3d"?new Tt(h.context.gl.LEQUAL,Tt.ReadWrite,h.depthRangeFor3D):h.depthModeForSublayer(0,Tt.ReadOnly);l.setDepthMode(f),d.render(l.gl,h.transform.customLayerMatrix()),l.setDirty(),h.setBaseState(),l.bindFramebuffer.set(null)}}};class Xs{constructor(t,n){this.context=new Ba(t),this.transform=n,this._tileTextures={},this.setup(),this.numSublayers=si.maxUnderzooming+si.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new at,this.gpuTimers={}}resize(t,n,l){if(this.width=t*l,this.height=n*l,this.pixelRatio=l,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const d of this.style._order)this.style._layers[d].resize()}setup(){const t=this.context,n=new o.PosArray;n.emplaceBack(0,0),n.emplaceBack(o.EXTENT,0),n.emplaceBack(0,o.EXTENT),n.emplaceBack(o.EXTENT,o.EXTENT),this.tileExtentBuffer=t.createVertexBuffer(n,Ss.members),this.tileExtentSegments=o.SegmentVector.simpleSegment(0,0,4,2);const l=new o.PosArray;l.emplaceBack(0,0),l.emplaceBack(o.EXTENT,0),l.emplaceBack(0,o.EXTENT),l.emplaceBack(o.EXTENT,o.EXTENT),this.debugBuffer=t.createVertexBuffer(l,Ss.members),this.debugSegments=o.SegmentVector.simpleSegment(0,0,4,5);const d=new o.RasterBoundsArray;d.emplaceBack(0,0,0,0),d.emplaceBack(o.EXTENT,0,o.EXTENT,0),d.emplaceBack(0,o.EXTENT,0,o.EXTENT),d.emplaceBack(o.EXTENT,o.EXTENT,o.EXTENT,o.EXTENT),this.rasterBoundsBuffer=t.createVertexBuffer(d,jr.members),this.rasterBoundsSegments=o.SegmentVector.simpleSegment(0,0,4,2);const f=new o.PosArray;f.emplaceBack(0,0),f.emplaceBack(1,0),f.emplaceBack(0,1),f.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(f,Ss.members),this.viewportSegments=o.SegmentVector.simpleSegment(0,0,4,2);const _=new o.LineStripIndexArray;_.emplaceBack(0),_.emplaceBack(1),_.emplaceBack(3),_.emplaceBack(2),_.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(_);const b=new o.TriangleIndexArray;b.emplaceBack(0,1,2),b.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(b),this.emptyTexture=new We(t,{width:1,height:1,data:new Uint8Array([0,0,0,0])},t.gl.RGBA);const w=this.context.gl;this.stencilClearMode=new Rt({func:w.ALWAYS,mask:0},0,255,w.ZERO,w.ZERO,w.ZERO)}clearStencil(){const t=this.context,n=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const l=o.create();o.ortho(l,0,this.width,this.height,0,0,1),o.scale(l,l,[n.drawingBufferWidth,n.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(t,n.TRIANGLES,Tt.disabled,this.stencilClearMode,tt.disabled,jt.disabled,Jn(l),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,n){if(this.currentStencilSource===t.source||!t.isTileClipped()||!n||!n.length)return;this.currentStencilSource=t.source;const l=this.context,d=l.gl;this.nextStencilID+n.length>256&&this.clearStencil(),l.setColorMode(tt.disabled),l.setDepthMode(Tt.disabled);const f=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const _ of n){const b=this._tileClippingMaskIDs[_.key]=this.nextStencilID++;f.draw(l,d.TRIANGLES,Tt.disabled,new Rt({func:d.ALWAYS,mask:0},b,255,d.KEEP,d.KEEP,d.REPLACE),tt.disabled,jt.disabled,Jn(_.posMatrix),"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,n=this.context.gl;return new Rt({func:n.NOTEQUAL,mask:255},t,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(t){const n=this.context.gl;return new Rt({func:n.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,n.KEEP,n.KEEP,n.REPLACE)}stencilConfigForOverlap(t){const n=this.context.gl,l=t.sort((_,b)=>b.overscaledZ-_.overscaledZ),d=l[l.length-1].overscaledZ,f=l[0].overscaledZ-d+1;if(f>1){this.currentStencilSource=void 0,this.nextStencilID+f>256&&this.clearStencil();const _={};for(let b=0;b<f;b++)_[b+d]=new Rt({func:n.GEQUAL,mask:255},b+this.nextStencilID,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID+=f,[_,l]}return[{[d]:Rt.disabled},l]}colorModeForRenderPass(){const t=this.context.gl;return this._showOverdrawInspector?new tt([t.CONSTANT_COLOR,t.ONE],new o.Color(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?tt.unblended:tt.alphaBlended}depthModeForSublayer(t,n,l){if(!this.opaquePassEnabledForLayer())return Tt.disabled;const d=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new Tt(l||this.context.gl.LEQUAL,n,[d,d])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(t,n){this.style=t,this.options=n,this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(o.exported.now()),this.imageManager.beginFrame();const l=this.style._order,d=this.style.sourceCaches;for(const w in d){const E=d[w];E.used&&E.prepare(this.context)}const f={},_={},b={};for(const w in d){const E=d[w];f[w]=E.getVisibleCoordinates(),_[w]=f[w].slice().reverse(),b[w]=E.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let w=0;w<l.length;w++)if(this.style._layers[l[w]].is3D()){this.opaquePassCutoff=w;break}this.renderPass="offscreen";for(const w of l){const E=this.style._layers[w];if(!E.hasOffscreenPass()||E.isHidden(this.transform.zoom))continue;const P=_[E.source];(E.type==="custom"||P.length)&&this.renderLayer(this,d[E.source],E,P)}for(this.context.bindFramebuffer.set(null),this.context.clear({color:n.showOverdrawInspector?o.Color.black:o.Color.transparent,depth:1}),this.clearStencil(),this._showOverdrawInspector=n.showOverdrawInspector,this.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],this.renderPass="opaque",this.currentLayer=l.length-1;this.currentLayer>=0;this.currentLayer--){const w=this.style._layers[l[this.currentLayer]],E=d[w.source],P=f[w.source];this._renderTileClippingMasks(w,P),this.renderLayer(this,E,w,P)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<l.length;this.currentLayer++){const w=this.style._layers[l[this.currentLayer]],E=d[w.source],P=(w.type==="symbol"?b:_)[w.source];this._renderTileClippingMasks(w,f[w.source]),this.renderLayer(this,E,w,P)}if(this.options.showTileBoundaries){let w,E;Object.values(this.style._layers).forEach(P=>{P.source&&!P.isHidden(this.transform.zoom)&&(P.source!==(E&&E.id)&&(E=this.style.sourceCaches[P.source]),(!w||w.getSource().maxzoom<E.getSource().maxzoom)&&(w=E))}),w&&na.debug(this,w,w.getVisibleCoordinates())}this.options.showPadding&&function(w){const E=w.transform.padding;il(w,w.transform.height-(E.top||0),3,el),il(w,E.bottom||0,3,tl),ja(w,E.left||0,3,Cn),ja(w,w.transform.width-(E.right||0),3,qa);const P=w.transform.centerPoint;(function(L,O,j,U){Za(L,O-1,j-10,2,20,U),Za(L,O-10,j-1,20,2,U)})(w,P.x,w.transform.height-P.y,Hs)}(this),this.context.setDefault()}renderLayer(t,n,l,d){l.isHidden(this.transform.zoom)||(l.type==="background"||l.type==="custom"||d.length)&&(this.id=l.id,this.gpuTimingStart(l),na[l.type](t,n,l,d,this.style.placement.variableOffsets),this.gpuTimingEnd())}gpuTimingStart(t){if(!this.options.gpuTiming)return;const n=this.context.extTimerQuery;let l=this.gpuTimers[t.id];l||(l=this.gpuTimers[t.id]={calls:0,cpuTime:0,query:n.createQueryEXT()}),l.calls++,n.beginQueryEXT(n.TIME_ELAPSED_EXT,l.query)}gpuTimingEnd(){if(!this.options.gpuTiming)return;const t=this.context.extTimerQuery;t.endQueryEXT(t.TIME_ELAPSED_EXT)}collectGpuTimers(){const t=this.gpuTimers;return this.gpuTimers={},t}queryGpuTimers(t){const n={};for(const l in t){const d=t[l],f=this.context.extTimerQuery,_=f.getQueryObjectEXT(d.query,f.QUERY_RESULT_EXT)/1e6;f.deleteQueryEXT(d.query),n[l]=_}return n}translatePosMatrix(t,n,l,d,f){if(!l[0]&&!l[1])return t;const _=f?d==="map"?this.transform.angle:0:d==="viewport"?-this.transform.angle:0;if(_){const E=Math.sin(_),P=Math.cos(_);l=[l[0]*P-l[1]*E,l[0]*E+l[1]*P]}const b=[f?l[0]:ii(n,l[0],this.transform.zoom),f?l[1]:ii(n,l[1],this.transform.zoom),0],w=new Float32Array(16);return o.translate(w,t,b),w}saveTileTexture(t){const n=this._tileTextures[t.size[0]];n?n.push(t):this._tileTextures[t.size[0]]=[t]}getTileTexture(t){const n=this._tileTextures[t];return n&&n.length>0?n.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;const n=this.imageManager.getPattern(t.from.toString()),l=this.imageManager.getPattern(t.to.toString());return!n||!l}useProgram(t,n){this.cache=this.cache||{};const l=`${t}${n?n.cacheKey:""}${this._showOverdrawInspector?"/overdraw":""}`;return this.cache[l]||(this.cache[l]=new pc(this.context,t,Ts[t],n,Ls[t],this._showOverdrawInspector)),this.cache[l]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new We(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}}class Wa{constructor(t,n){this.points=t,this.planes=n}static fromInvProjectionMatrix(t,n,l){const d=Math.pow(2,l),f=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(b=>o.transformMat4([],b,t)).map(b=>o.scale$1([],b,1/b[3]/n*d)),_=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(b=>{const w=function(O,j){var U=j[0],q=j[1],ee=j[2],te=U*U+q*q+ee*ee;return te>0&&(te=1/Math.sqrt(te)),O[0]=j[0]*te,O[1]=j[1]*te,O[2]=j[2]*te,O}([],function(O,j,U){var q=j[0],ee=j[1],te=j[2],ne=U[0],ie=U[1],fe=U[2];return O[0]=ee*fe-te*ie,O[1]=te*ne-q*fe,O[2]=q*ie-ee*ne,O}([],je([],f[b[0]],f[b[1]]),je([],f[b[2]],f[b[1]]))),E=-((P=w)[0]*(L=f[b[1]])[0]+P[1]*L[1]+P[2]*L[2]);var P,L;return w.concat(E)});return new Wa(f,_)}}class Ha{constructor(t,n){this.min=t,this.max=n,this.center=function(l,d,f){return l[0]=.5*d[0],l[1]=.5*d[1],l[2]=.5*d[2],l}([],function(l,d,f){return l[0]=d[0]+f[0],l[1]=d[1]+f[1],l[2]=d[2]+f[2],l}([],this.min,this.max))}quadrant(t){const n=[t%2==0,t<2],l=$e(this.min),d=$e(this.max);for(let f=0;f<n.length;f++)l[f]=n[f]?this.min[f]:this.center[f],d[f]=n[f]?this.center[f]:this.max[f];return d[2]=this.max[2],new Ha(l,d)}distanceX(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]}distanceY(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]}intersects(t){const n=[[this.min[0],this.min[1],0,1],[this.max[0],this.min[1],0,1],[this.max[0],this.max[1],0,1],[this.min[0],this.max[1],0,1]];let l=!0;for(let d=0;d<t.planes.length;d++){const f=t.planes[d];let _=0;for(let b=0;b<n.length;b++)o.dot(f,n[b])>=0&&_++;if(_===0)return 0;_!==n.length&&(l=!1)}if(l)return 2;for(let d=0;d<3;d++){let f=Number.MAX_VALUE,_=-Number.MAX_VALUE;for(let b=0;b<t.points.length;b++){const w=t.points[b][d]-this.min[d];f=Math.min(f,w),_=Math.max(_,w)}if(_<0||f>this.max[d]-this.min[d])return 0}return 1}}class Mn{constructor(t=0,n=0,l=0,d=0){if(isNaN(t)||t<0||isNaN(n)||n<0||isNaN(l)||l<0||isNaN(d)||d<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=n,this.left=l,this.right=d}interpolate(t,n,l){return n.top!=null&&t.top!=null&&(this.top=o.number(t.top,n.top,l)),n.bottom!=null&&t.bottom!=null&&(this.bottom=o.number(t.bottom,n.bottom,l)),n.left!=null&&t.left!=null&&(this.left=o.number(t.left,n.left,l)),n.right!=null&&t.right!=null&&(this.right=o.number(t.right,n.right,l)),this}getCenter(t,n){const l=o.clamp((this.left+t-this.right)/2,0,t),d=o.clamp((this.top+n-this.bottom)/2,0,n);return new o.pointGeometry(l,d)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new Mn(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class aa{constructor(t,n,l,d,f){this.tileSize=512,this.maxValidLatitude=85.051129,this._renderWorldCopies=f===void 0||!!f,this._minZoom=t||0,this._maxZoom=n||22,this._minPitch=l??0,this._maxPitch=d??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new o.LngLat(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new Mn,this._posMatrixCache={},this._alignedPosMatrixCache={}}clone(){const t=new aa(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.tileSize=this.tileSize,t.latRange=this.latRange,t.width=this.width,t.height=this.height,t._center=this._center,t.zoom=this.zoom,t.angle=this.angle,t._fov=this._fov,t._pitch=this._pitch,t._unmodified=this._unmodified,t._edgeInsets=this._edgeInsets.clone(),t._calcMatrices(),t}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(t){t===void 0?t=!0:t===null&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new o.pointGeometry(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(t){const n=-o.wrap(t,-180,180)*Math.PI/180;this.angle!==n&&(this._unmodified=!1,this.angle=n,this._calcMatrices(),this.rotationMatrix=function(){var l=new o.ARRAY_TYPE(4);return o.ARRAY_TYPE!=Float32Array&&(l[1]=0,l[2]=0),l[0]=1,l[3]=1,l}(),function(l,d,f){var _=d[0],b=d[1],w=d[2],E=d[3],P=Math.sin(f),L=Math.cos(f);l[0]=_*L+w*P,l[1]=b*L+E*P,l[2]=_*-P+w*L,l[3]=b*-P+E*L}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const n=o.clamp(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==n&&(this._unmodified=!1,this._pitch=n,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(t){const n=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==n&&(this._unmodified=!1,this._zoom=n,this.scale=this.zoomScale(n),this.tileZoom=Math.floor(n),this.zoomFraction=n-this.tileZoom,this._constrain(),this._calcMatrices())}get center(){return this._center}set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,n,l){this._unmodified=!1,this._edgeInsets.interpolate(t,n,l),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const n=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,n)}getVisibleUnwrappedCoordinates(t){const n=[new o.UnwrappedTileID(0,t)];if(this._renderWorldCopies){const l=this.pointCoordinate(new o.pointGeometry(0,0)),d=this.pointCoordinate(new o.pointGeometry(this.width,0)),f=this.pointCoordinate(new o.pointGeometry(this.width,this.height)),_=this.pointCoordinate(new o.pointGeometry(0,this.height)),b=Math.floor(Math.min(l.x,d.x,f.x,_.x)),w=Math.floor(Math.max(l.x,d.x,f.x,_.x)),E=1;for(let P=b-E;P<=w+E;P++)P!==0&&n.push(new o.UnwrappedTileID(P,t))}return n}coveringTiles(t){let n=this.coveringZoomLevel(t);const l=n;if(t.minzoom!==void 0&&n<t.minzoom)return[];t.maxzoom!==void 0&&n>t.maxzoom&&(n=t.maxzoom);const d=o.MercatorCoordinate.fromLngLat(this.center),f=Math.pow(2,n),_=[f*d.x,f*d.y,0],b=Wa.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,n);let w=t.minzoom||0;this.pitch<=60&&this._edgeInsets.top<.1&&(w=n);const E=U=>({aabb:new Ha([U*f,0,0],[(U+1)*f,f,0]),zoom:0,x:0,y:0,wrap:U,fullyVisible:!1}),P=[],L=[],O=n,j=t.reparseOverscaled?l:n;if(this._renderWorldCopies)for(let U=1;U<=3;U++)P.push(E(-U)),P.push(E(U));for(P.push(E(0));P.length>0;){const U=P.pop(),q=U.x,ee=U.y;let te=U.fullyVisible;if(!te){const ue=U.aabb.intersects(b);if(ue===0)continue;te=ue===2}const ne=U.aabb.distanceX(_),ie=U.aabb.distanceY(_),fe=Math.max(Math.abs(ne),Math.abs(ie)),ce=3+(1<<O-U.zoom)-2;if(U.zoom===O||fe>ce&&U.zoom>=w)L.push({tileID:new o.OverscaledTileID(U.zoom===O?j:U.zoom,U.wrap,U.zoom,q,ee),distanceSq:Ge([_[0]-.5-q,_[1]-.5-ee])});else for(let ue=0;ue<4;ue++){const ve=(q<<1)+ue%2,Se=(ee<<1)+(ue>>1);P.push({aabb:U.aabb.quadrant(ue),zoom:U.zoom+1,x:ve,y:Se,wrap:U.wrap,fullyVisible:te})}}return L.sort((U,q)=>U.distanceSq-q.distanceSq).map(U=>U.tileID)}resize(t,n){this.width=t,this.height=n,this.pixelsToGLUnits=[2/t,-2/n],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log(t)/Math.LN2}project(t){const n=o.clamp(t.lat,-this.maxValidLatitude,this.maxValidLatitude);return new o.pointGeometry(o.mercatorXfromLng(t.lng)*this.worldSize,o.mercatorYfromLat(n)*this.worldSize)}unproject(t){return new o.MercatorCoordinate(t.x/this.worldSize,t.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}setLocationAtPoint(t,n){const l=this.pointCoordinate(n),d=this.pointCoordinate(this.centerPoint),f=this.locationCoordinate(t),_=new o.MercatorCoordinate(f.x-(l.x-d.x),f.y-(l.y-d.y));this.center=this.coordinateLocation(_),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(t){return this.coordinatePoint(this.locationCoordinate(t))}pointLocation(t){return this.coordinateLocation(this.pointCoordinate(t))}locationCoordinate(t){return o.MercatorCoordinate.fromLngLat(t)}coordinateLocation(t){return t.toLngLat()}pointCoordinate(t){const n=[t.x,t.y,0,1],l=[t.x,t.y,1,1];o.transformMat4(n,n,this.pixelMatrixInverse),o.transformMat4(l,l,this.pixelMatrixInverse);const d=n[3],f=l[3],_=n[1]/d,b=l[1]/f,w=n[2]/d,E=l[2]/f,P=w===E?0:(0-w)/(E-w);return new o.MercatorCoordinate(o.number(n[0]/d,l[0]/f,P)/this.worldSize,o.number(_,b,P)/this.worldSize)}coordinatePoint(t){const n=[t.x*this.worldSize,t.y*this.worldSize,0,1];return o.transformMat4(n,n,this.pixelMatrix),new o.pointGeometry(n[0]/n[3],n[1]/n[3])}getBounds(){return new o.LngLatBounds().extend(this.pointLocation(new o.pointGeometry(0,0))).extend(this.pointLocation(new o.pointGeometry(this.width,0))).extend(this.pointLocation(new o.pointGeometry(this.width,this.height))).extend(this.pointLocation(new o.pointGeometry(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new o.LngLatBounds([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}setMaxBounds(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])}calculatePosMatrix(t,n=!1){const l=t.key,d=n?this._alignedPosMatrixCache:this._posMatrixCache;if(d[l])return d[l];const f=t.canonical,_=this.worldSize/this.zoomScale(f.z),b=f.x+Math.pow(2,f.z)*t.wrap,w=o.identity(new Float64Array(16));return o.translate(w,w,[b*_,f.y*_,0]),o.scale(w,w,[_/o.EXTENT,_/o.EXTENT,1]),o.multiply(w,n?this.alignedProjMatrix:this.projMatrix,w),d[l]=new Float32Array(w),d[l]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let t,n,l,d,f=-90,_=90,b=-180,w=180;const E=this.size,P=this._unmodified;if(this.latRange){const j=this.latRange;f=o.mercatorYfromLat(j[1])*this.worldSize,_=o.mercatorYfromLat(j[0])*this.worldSize,t=_-f<E.y?E.y/(_-f):0}if(this.lngRange){const j=this.lngRange;b=o.mercatorXfromLng(j[0])*this.worldSize,w=o.mercatorXfromLng(j[1])*this.worldSize,n=w-b<E.x?E.x/(w-b):0}const L=this.point,O=Math.max(n||0,t||0);if(O)return this.center=this.unproject(new o.pointGeometry(n?(w+b)/2:L.x,t?(_+f)/2:L.y)),this.zoom+=this.scaleZoom(O),this._unmodified=P,void(this._constraining=!1);if(this.latRange){const j=L.y,U=E.y/2;j-U<f&&(d=f+U),j+U>_&&(d=_-U)}if(this.lngRange){const j=L.x,U=E.x/2;j-U<b&&(l=b+U),j+U>w&&(l=w-U)}l===void 0&&d===void 0||(this.center=this.unproject(new o.pointGeometry(l!==void 0?l:L.x,d!==void 0?d:L.y))),this._unmodified=P,this._constraining=!1}_calcMatrices(){if(!this.height)return;const t=this.centerOffset;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height;const n=Math.PI/2+this._pitch,l=this._fov*(.5+t.y/this.height),d=Math.sin(l)*this.cameraToCenterDistance/Math.sin(o.clamp(Math.PI-n-l,.01,Math.PI-.01)),f=this.point,_=f.x,b=f.y,w=1.01*(Math.cos(Math.PI/2-this._pitch)*d+this.cameraToCenterDistance),E=this.height/50;let P=new Float64Array(16);o.perspective(P,this._fov,this.width/this.height,E,w),P[8]=2*-t.x/this.width,P[9]=2*t.y/this.height,o.scale(P,P,[1,-1,1]),o.translate(P,P,[0,0,-this.cameraToCenterDistance]),o.rotateX(P,P,this._pitch),o.rotateZ(P,P,this.angle),o.translate(P,P,[-_,-b,0]),this.mercatorMatrix=o.scale([],P,[this.worldSize,this.worldSize,this.worldSize]),o.scale(P,P,[1,1,o.mercatorZfromAltitude(1,this.center.lat)*this.worldSize]),this.projMatrix=P,this.invProjMatrix=o.invert([],this.projMatrix);const L=this.width%2/2,O=this.height%2/2,j=Math.cos(this.angle),U=Math.sin(this.angle),q=_-Math.round(_)+j*L+U*O,ee=b-Math.round(b)+j*O+U*L,te=new Float64Array(P);if(o.translate(te,te,[q>.5?q-1:q,ee>.5?ee-1:ee,0]),this.alignedProjMatrix=te,P=o.create(),o.scale(P,P,[this.width/2,-this.height/2,1]),o.translate(P,P,[1,-1,0]),this.labelPlaneMatrix=P,P=o.create(),o.scale(P,P,[1,-1,1]),o.translate(P,P,[-1,-1,0]),o.scale(P,P,[2/this.width,2/this.height,1]),this.glCoordMatrix=P,this.pixelMatrix=o.multiply(new Float64Array(16),this.labelPlaneMatrix,this.projMatrix),P=o.invert(new Float64Array(16),this.pixelMatrix),!P)throw new Error("failed to invert matrix");this.pixelMatrixInverse=P,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const t=this.pointCoordinate(new o.pointGeometry(0,0)),n=[t.x*this.worldSize,t.y*this.worldSize,0,1];return o.transformMat4(n,n,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new o.pointGeometry(0,t))}getCameraQueryGeometry(t){const n=this.getCameraPoint();if(t.length===1)return[t[0],n];{let l=n.x,d=n.y,f=n.x,_=n.y;for(const b of t)l=Math.min(l,b.x),d=Math.min(d,b.y),f=Math.max(f,b.x),_=Math.max(_,b.y);return[new o.pointGeometry(l,d),new o.pointGeometry(f,d),new o.pointGeometry(f,_),new o.pointGeometry(l,_),new o.pointGeometry(l,d)]}}}class nl{constructor(t){this._hashName=t&&encodeURIComponent(t),o.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=function(n,l){let d=!1,f=null;const _=()=>{f=null,d&&(n(),f=setTimeout(_,300),d=!1)};return()=>(d=!0,f||_(),f)}(this._updateHashUnthrottled.bind(this))}addTo(t){return this._map=t,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(t){const n=this._map.getCenter(),l=Math.round(100*this._map.getZoom())/100,d=Math.ceil((l*Math.LN2+Math.log(512/360/.5))/Math.LN10),f=Math.pow(10,d),_=Math.round(n.lng*f)/f,b=Math.round(n.lat*f)/f,w=this._map.getBearing(),E=this._map.getPitch();let P="";if(P+=t?`/${_}/${b}/${l}`:`${l}/${b}/${_}`,(w||E)&&(P+="/"+Math.round(10*w)/10),E&&(P+=`/${Math.round(E)}`),this._hashName){const L=this._hashName;let O=!1;const j=window.location.hash.slice(1).split("&").map(U=>{const q=U.split("=")[0];return q===L?(O=!0,`${q}=${P}`):U}).filter(U=>U);return O||j.push(`${L}=${P}`),`#${j.join("&")}`}return`#${P}`}_getCurrentHash(){const t=window.location.hash.replace("#","");if(this._hashName){let n;return t.split("&").map(l=>l.split("=")).forEach(l=>{l[0]===this._hashName&&(n=l)}),(n&&n[1]||"").split("/")}return t.split("/")}_onHashChange(){const t=this._getCurrentHash();if(t.length>=3&&!t.some(n=>isNaN(n))){const n=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:n,pitch:+(t[4]||0)}),!0}return!1}_updateHashUnthrottled(){const t=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,t)}catch{}}}const sa={linearity:.3,easing:o.bezier(0,0,.3,1)},al=o.extend({deceleration:2500,maxSpeed:1400},sa),sl=o.extend({deceleration:20,maxSpeed:1400},sa),ol=o.extend({deceleration:1e3,maxSpeed:360},sa),Pn=o.extend({deceleration:1e3,maxSpeed:90},sa);class ll{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:o.exported.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,n=o.exported.now();for(;t.length>0&&n-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const n={zoom:0,bearing:0,pitch:0,pan:new o.pointGeometry(0,0),pinchAround:void 0,around:void 0};for(const{settings:f}of this._inertiaBuffer)n.zoom+=f.zoomDelta||0,n.bearing+=f.bearingDelta||0,n.pitch+=f.pitchDelta||0,f.panDelta&&n.pan._add(f.panDelta),f.around&&(n.around=f.around),f.pinchAround&&(n.pinchAround=f.pinchAround);const l=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,d={};if(n.pan.mag()){const f=la(n.pan.mag(),l,o.extend({},al,t||{}));d.offset=n.pan.mult(f.amount/n.pan.mag()),d.center=this._map.transform.center,oa(d,f)}if(n.zoom){const f=la(n.zoom,l,sl);d.zoom=this._map.transform.zoom+f.amount,oa(d,f)}if(n.bearing){const f=la(n.bearing,l,ol);d.bearing=this._map.transform.bearing+o.clamp(f.amount,-179,179),oa(d,f)}if(n.pitch){const f=la(n.pitch,l,Pn);d.pitch=this._map.transform.pitch+f.amount,oa(d,f)}if(d.zoom||d.bearing){const f=n.pinchAround===void 0?n.around:n.pinchAround;d.around=f?this._map.unproject(f):this._map.getCenter()}return this.clear(),o.extend(d,{noMoveStart:!0})}}function oa(h,t){(!h.duration||h.duration<t.duration)&&(h.duration=t.duration,h.easing=t.easing)}function la(h,t,n){const{maxSpeed:l,linearity:d,deceleration:f}=n,_=o.clamp(h*d/(t/1e3),-l,l),b=Math.abs(_)/(f*d);return{easing:n.easing,duration:1e3*b,amount:_*(b/2)}}class zi extends o.Event{constructor(t,n,l,d={}){const f=H.mousePos(n.getCanvasContainer(),l),_=n.unproject(f);super(t,o.extend({point:f,lngLat:_,originalEvent:l},d)),this._defaultPrevented=!1,this.target=n}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class Ii extends o.Event{constructor(t,n,l){const d=t==="touchend"?l.changedTouches:l.touches,f=H.touchPos(n.getCanvasContainer(),d),_=f.map(w=>n.unproject(w)),b=f.reduce((w,E,P,L)=>w.add(E.div(L.length)),new o.pointGeometry(0,0));super(t,{points:f,point:b,lngLats:_,lngLat:n.unproject(b),originalEvent:l}),this._defaultPrevented=!1}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class Tc extends o.Event{constructor(t,n,l){super(t,{originalEvent:l}),this._defaultPrevented=!1}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class nn{constructor(t,n){this._map=t,this._clickTolerance=n.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new Tc(t.type,this._map,t))}mousedown(t,n){return this._mousedownPos=n,this._firePreventable(new zi(t.type,this._map,t))}mouseup(t){this._map.fire(new zi(t.type,this._map,t))}click(t,n){this._mousedownPos&&this._mousedownPos.dist(n)>=this._clickTolerance||this._map.fire(new zi(t.type,this._map,t))}dblclick(t){return this._firePreventable(new zi(t.type,this._map,t))}mouseover(t){this._map.fire(new zi(t.type,this._map,t))}mouseout(t){this._map.fire(new zi(t.type,this._map,t))}touchstart(t){return this._firePreventable(new Ii(t.type,this._map,t))}touchmove(t){this._map.fire(new Ii(t.type,this._map,t))}touchend(t){this._map.fire(new Ii(t.type,this._map,t))}touchcancel(t){this._map.fire(new Ii(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class cl{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,delete this._contextMenuEvent}mousemove(t){this._map.fire(new zi(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new zi("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._map.fire(new zi(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class zn{constructor(t,n){this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=n.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,n){this.isEnabled()&&t.shiftKey&&t.button===0&&(H.disableDrag(),this._startPos=this._lastPos=n,this._active=!0)}mousemoveWindow(t,n){if(!this._active)return;const l=n;if(this._lastPos.equals(l)||!this._box&&l.dist(this._startPos)<this._clickTolerance)return;const d=this._startPos;this._lastPos=l,this._box||(this._box=H.create("div","maplibregl-boxzoom mapboxgl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair","mapboxgl-crosshair"),this._fireEvent("boxzoomstart",t));const f=Math.min(d.x,l.x),_=Math.max(d.x,l.x),b=Math.min(d.y,l.y),w=Math.max(d.y,l.y);H.setTransform(this._box,`translate(${f}px,${b}px)`),this._box.style.width=_-f+"px",this._box.style.height=w-b+"px"}mouseupWindow(t,n){if(!this._active||t.button!==0)return;const l=this._startPos,d=n;if(this.reset(),H.suppressClick(),l.x!==d.x||l.y!==d.y)return this._map.fire(new o.Event("boxzoomend",{originalEvent:t})),{cameraAnimation:f=>f.fitScreenCoordinates(l,d,this._map.getBearing(),{linear:!0})};this._fireEvent("boxzoomcancel",t)}keydown(t){this._active&&t.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair","mapboxgl-crosshair"),this._box&&(H.remove(this._box),this._box=null),H.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,n){return this._map.fire(new o.Event(t,{originalEvent:n}))}}function an(h,t){const n={};for(let l=0;l<h.length;l++)n[h[l].identifier]=t[l];return n}class Ic{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(t,n,l){(this.centroid||l.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=t.timeStamp),l.length===this.numTouches&&(this.centroid=function(d){const f=new o.pointGeometry(0,0);for(const _ of d)f._add(_);return f.div(d.length)}(n),this.touches=an(l,n)))}touchmove(t,n,l){if(this.aborted||!this.centroid)return;const d=an(l,n);for(const f in this.touches){const _=this.touches[f],b=d[f];(!b||b.dist(_)>30)&&(this.aborted=!0)}}touchend(t,n,l){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),l.length===0){const d=!this.aborted&&this.centroid;if(this.reset(),d)return d}}}class Ys{constructor(t){this.singleTap=new Ic(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,n,l){this.singleTap.touchstart(t,n,l)}touchmove(t,n,l){this.singleTap.touchmove(t,n,l)}touchend(t,n,l){const d=this.singleTap.touchend(t,n,l);if(d){const f=t.timeStamp-this.lastTime<500,_=!this.lastTap||this.lastTap.dist(d)<30;if(f&&_||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=d,this.count===this.numTaps)return this.reset(),d}}}class Ec{constructor(){this._zoomIn=new Ys({numTouches:1,numTaps:2}),this._zoomOut=new Ys({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,n,l){this._zoomIn.touchstart(t,n,l),this._zoomOut.touchstart(t,n,l)}touchmove(t,n,l){this._zoomIn.touchmove(t,n,l),this._zoomOut.touchmove(t,n,l)}touchend(t,n,l){const d=this._zoomIn.touchend(t,n,l),f=this._zoomOut.touchend(t,n,l);return d?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:_.getZoom()+1,around:_.unproject(d)},{originalEvent:t})}):f?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:_.getZoom()-1,around:_.unproject(f)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const hl={0:1,2:2};class sn{constructor(t){this.reset(),this._clickTolerance=t.clickTolerance||1}reset(){this._active=!1,this._moved=!1,delete this._lastPoint,delete this._eventButton}_correctButton(t,n){return!1}_move(t,n){return{}}mousedown(t,n){if(this._lastPoint)return;const l=H.mouseButton(t);this._correctButton(t,l)&&(this._lastPoint=n,this._eventButton=l)}mousemoveWindow(t,n){const l=this._lastPoint;if(l){if(t.preventDefault(),function(d,f){const _=hl[f];return d.buttons===void 0||(d.buttons&_)!==_}(t,this._eventButton))this.reset();else if(this._moved||!(n.dist(l)<this._clickTolerance))return this._moved=!0,this._lastPoint=n,this._move(l,n)}}mouseupWindow(t){this._lastPoint&&H.mouseButton(t)===this._eventButton&&(this._moved&&H.suppressClick(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class kn extends sn{mousedown(t,n){super.mousedown(t,n),this._lastPoint&&(this._active=!0)}_correctButton(t,n){return n===0&&!t.ctrlKey}_move(t,n){return{around:n,panDelta:n.sub(t)}}}class Re extends sn{_correctButton(t,n){return n===0&&t.ctrlKey||n===2}_move(t,n){const l=.8*(n.x-t.x);if(l)return this._active=!0,{bearingDelta:l}}contextmenu(t){t.preventDefault()}}class Ks extends sn{_correctButton(t,n){return n===0&&t.ctrlKey||n===2}_move(t,n){const l=-.5*(n.y-t.y);if(l)return this._active=!0,{pitchDelta:l}}contextmenu(t){t.preventDefault()}}class ca{constructor(t){this._minTouches=1,this._clickTolerance=t.clickTolerance||1,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new o.pointGeometry(0,0)}touchstart(t,n,l){return this._calculateTransform(t,n,l)}touchmove(t,n,l){if(this._active&&!(l.length<this._minTouches))return t.preventDefault(),this._calculateTransform(t,n,l)}touchend(t,n,l){this._calculateTransform(t,n,l),this._active&&l.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,n,l){l.length>0&&(this._active=!0);const d=an(l,n),f=new o.pointGeometry(0,0),_=new o.pointGeometry(0,0);let b=0;for(const E in d){const P=d[E],L=this._touches[E];L&&(f._add(P),_._add(P.sub(L)),b++,d[E]=P)}if(this._touches=d,b<this._minTouches||!_.mag())return;const w=_.div(b);return this._sum._add(w),this._sum.mag()<this._clickTolerance?void 0:{around:f.div(b),panDelta:w}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class on{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}_start(t){}_move(t,n,l){return{}}touchstart(t,n,l){this._firstTwoTouches||l.length<2||(this._firstTwoTouches=[l[0].identifier,l[1].identifier],this._start([n[0],n[1]]))}touchmove(t,n,l){if(!this._firstTwoTouches)return;t.preventDefault();const[d,f]=this._firstTwoTouches,_=ha(l,n,d),b=ha(l,n,f);if(!_||!b)return;const w=this._aroundCenter?null:_.add(b).div(2);return this._move([_,b],w,t)}touchend(t,n,l){if(!this._firstTwoTouches)return;const[d,f]=this._firstTwoTouches,_=ha(l,n,d),b=ha(l,n,f);_&&b||(this._active&&H.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(t){this._enabled=!0,this._aroundCenter=!!t&&t.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function ha(h,t,n){for(let l=0;l<h.length;l++)if(h[l].identifier===n)return t[l]}function Ee(h,t){return Math.log(h/t)/Math.LN2}class Js extends on{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,n){const l=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(Ee(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Ee(this._distance,l),pinchAround:n}}}function ul(h,t){return 180*h.angleWith(t)/Math.PI}class Ac extends on{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(t){this._startVector=this._vector=t[0].sub(t[1]),this._minDiameter=t[0].dist(t[1])}_move(t,n){const l=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:ul(this._vector,l),pinchAround:n}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const n=25/(Math.PI*this._minDiameter)*360,l=ul(t,this._startVector);return Math.abs(l)<n}}function ua(h){return Math.abs(h.y)>Math.abs(h.x)}class dl extends on{reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}_start(t){this._lastPoints=t,ua(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,n,l){const d=t[0].sub(this._lastPoints[0]),f=t[1].sub(this._lastPoints[1]);if(this._valid=this.gestureBeginsVertically(d,f,l.timeStamp),this._valid)return this._lastPoints=t,this._active=!0,{pitchDelta:(d.y+f.y)/2*-.5}}gestureBeginsVertically(t,n,l){if(this._valid!==void 0)return this._valid;const d=t.mag()>=2,f=n.mag()>=2;if(!d&&!f)return;if(!d||!f)return this._firstMove===void 0&&(this._firstMove=l),l-this._firstMove<100&&void 0;const _=t.y>0==n.y>0;return ua(t)&&ua(n)&&_}}const pl={panStep:100,bearingStep:15,pitchStep:10};class Cc{constructor(){const t=pl;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let n=0,l=0,d=0,f=0,_=0;switch(t.keyCode){case 61:case 107:case 171:case 187:n=1;break;case 189:case 109:case 173:n=-1;break;case 37:t.shiftKey?l=-1:(t.preventDefault(),f=-1);break;case 39:t.shiftKey?l=1:(t.preventDefault(),f=1);break;case 38:t.shiftKey?d=1:(t.preventDefault(),_=-1);break;case 40:t.shiftKey?d=-1:(t.preventDefault(),_=1);break;default:return}return this._rotationDisabled&&(l=0,d=0),{cameraAnimation:b=>{const w=b.getZoom();b.easeTo({duration:300,easeId:"keyboardHandler",easing:Mc,zoom:n?Math.round(w)+n*(t.shiftKey?2:1):w,bearing:b.getBearing()+l*this._bearingStep,pitch:b.getPitch()+d*this._pitchStep,offset:[-f*this._panStep,-_*this._panStep],center:b.getCenter()},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function Mc(h){return h*(2-h)}const Xa=4.000244140625;class Qs{constructor(t,n){this._map=t,this._el=t.getCanvasContainer(),this._handler=n,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,o.bindAll(["_onTimeout"],this)}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=t&&t.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(t){if(!this.isEnabled())return;let n=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const l=o.exported.now(),d=l-(this._lastWheelEventTime||0);this._lastWheelEventTime=l,n!==0&&n%Xa==0?this._type="wheel":n!==0&&Math.abs(n)<4?this._type="trackpad":d>400?(this._type=null,this._lastValue=n,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(d*n)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,n+=this._lastValue)),t.shiftKey&&n&&(n/=4),this._type&&(this._lastWheelEvent=t,this._delta-=n,this._active||this._start(t)),t.preventDefault()}_onTimeout(t){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)}_start(t){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const n=H.mousePos(this._el,t);this._around=o.LngLat.convert(this._aroundCenter?this._map.getCenter():this._map.unproject(n)),this._aroundPoint=this._map.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const t=this._map.transform;if(this._delta!==0){const b=this._type==="wheel"&&Math.abs(this._delta)>Xa?this._wheelZoomRate:this._defaultZoomRate;let w=2/(1+Math.exp(-Math.abs(this._delta*b)));this._delta<0&&w!==0&&(w=1/w);const E=typeof this._targetZoom=="number"?t.zoomScale(this._targetZoom):t.scale;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(E*w))),this._type==="wheel"&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const n=typeof this._targetZoom=="number"?this._targetZoom:t.zoom,l=this._startZoom,d=this._easing;let f,_=!1;if(this._type==="wheel"&&l&&d){const b=Math.min((o.exported.now()-this._lastWheelEventTime)/200,1),w=d(b);f=o.number(l,n,w),b<1?this._frameId||(this._frameId=!0):_=!0}else f=n,_=!0;return this._active=!0,_&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!_,zoomDelta:f-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let n=o.ease;if(this._prevEase){const l=this._prevEase,d=(o.exported.now()-l.start)/l.duration,f=l.easing(d+.01)-l.easing(d),_=.27/Math.sqrt(f*f+1e-4)*.01,b=Math.sqrt(.0729-_*_);n=o.bezier(_,b,.25,1)}return this._prevEase={start:o.exported.now(),duration:t,easing:n},n}reset(){this._active=!1}}class eo{constructor(t,n){this._clickZoom=t,this._tapZoom=n}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class to{constructor(){this.reset()}reset(){this._active=!1}dblclick(t,n){return t.preventDefault(),{cameraAnimation:l=>{l.easeTo({duration:300,zoom:l.getZoom()+(t.shiftKey?-1:1),around:l.unproject(n)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ei{constructor(){this._tap=new Ys({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()}touchstart(t,n,l){this._swipePoint||(this._tapTime&&t.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?l.length>0&&(this._swipePoint=n[0],this._swipeTouch=l[0].identifier):this._tap.touchstart(t,n,l))}touchmove(t,n,l){if(this._tapTime){if(this._swipePoint){if(l[0].identifier!==this._swipeTouch)return;const d=n[0],f=d.y-this._swipePoint.y;return this._swipePoint=d,t.preventDefault(),this._active=!0,{zoomDelta:f/128}}}else this._tap.touchmove(t,n,l)}touchend(t,n,l){this._tapTime?this._swipePoint&&l.length===0&&this.reset():this._tap.touchend(t,n,l)&&(this._tapTime=t.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Fr{constructor(t,n,l){this._el=t,this._mousePan=n,this._touchPan=l}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan","mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan","mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class ml{constructor(t,n,l){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=n,this._mousePitch=l}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class io{constructor(t,n,l,d){this._el=t,this._touchZoom=n,this._touchRotate=l,this._tapDragZoom=d,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate","mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate","mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const Ln=h=>h.zoom||h.drag||h.pitch||h.rotate;class ro extends o.Event{}function Ya(h){return h.panDelta&&h.panDelta.mag()||h.zoomDelta||h.bearingDelta||h.pitchDelta}class Vi{constructor(t,n){this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new ll(t),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n),o.bindAll(["handleEvent","handleWindowEvent"],this);const l=this._el;this._listeners=[[l,"touchstart",{passive:!0}],[l,"touchmove",{passive:!1}],[l,"touchend",void 0],[l,"touchcancel",void 0],[l,"mousedown",void 0],[l,"mousemove",void 0],[l,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[l,"mouseover",void 0],[l,"mouseout",void 0],[l,"dblclick",void 0],[l,"click",void 0],[l,"keydown",{capture:!1}],[l,"keyup",void 0],[l,"wheel",{passive:!1}],[l,"contextmenu",void 0],[window,"blur",void 0]];for(const[d,f,_]of this._listeners)H.addEventListener(d,f,d===document?this.handleWindowEvent:this.handleEvent,_)}destroy(){for(const[t,n,l]of this._listeners)H.removeEventListener(t,n,t===document?this.handleWindowEvent:this.handleEvent,l)}_addDefaultHandlers(t){const n=this._map,l=n.getCanvasContainer();this._add("mapEvent",new nn(n,t));const d=n.boxZoom=new zn(n,t);this._add("boxZoom",d);const f=new Ec,_=new to;n.doubleClickZoom=new eo(_,f),this._add("tapZoom",f),this._add("clickZoom",_);const b=new Ei;this._add("tapDragZoom",b);const w=n.touchPitch=new dl;this._add("touchPitch",w);const E=new Re(t),P=new Ks(t);n.dragRotate=new ml(t,E,P),this._add("mouseRotate",E,["mousePitch"]),this._add("mousePitch",P,["mouseRotate"]);const L=new kn(t),O=new ca(t);n.dragPan=new Fr(l,L,O),this._add("mousePan",L),this._add("touchPan",O,["touchZoom","touchRotate"]);const j=new Ac,U=new Js;n.touchZoomRotate=new io(l,U,j,b),this._add("touchRotate",j,["touchPan","touchZoom"]),this._add("touchZoom",U,["touchPan","touchRotate"]);const q=n.scrollZoom=new Qs(n,this);this._add("scrollZoom",q,["mousePan"]);const ee=n.keyboard=new Cc;this._add("keyboard",ee),this._add("blockableMapEvent",new cl(n));for(const te of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])t.interactive&&t[te]&&n[te].enable(t[te])}_add(t,n,l){this._handlers.push({handlerName:t,handler:n,allowed:l}),this._handlersById[t]=n}stop(t){if(!this._updatingCamera){for(const{handler:n}of this._handlers)n.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(const{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return Boolean(Ln(this._eventsInProgress))||this.isZooming()}_blockedByActive(t,n,l){for(const d in t)if(d!==l&&(!n||n.indexOf(d)<0))return!0;return!1}handleWindowEvent(t){this.handleEvent(t,`${t.type}Window`)}_getMapTouches(t){const n=[];for(const l of t)this._el.contains(l.target)&&n.push(l);return n}handleEvent(t,n){if(t.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const l=t.type==="renderFrame"?void 0:t,d={needsRenderFrame:!1},f={},_={},b=t.touches,w=b?this._getMapTouches(b):void 0,E=w?H.touchPos(this._el,w):H.mousePos(this._el,t);for(const{handlerName:O,handler:j,allowed:U}of this._handlers){if(!j.isEnabled())continue;let q;this._blockedByActive(_,U,O)?j.reset():j[n||t.type]&&(q=j[n||t.type](t,E,w),this.mergeHandlerResult(d,f,q,O,l),q&&q.needsRenderFrame&&this._triggerRenderFrame()),(q||j.isActive())&&(_[O]=j)}const P={};for(const O in this._previousActiveHandlers)_[O]||(P[O]=l);this._previousActiveHandlers=_,(Object.keys(P).length||Ya(d))&&(this._changes.push([d,f,P]),this._triggerRenderFrame()),(Object.keys(_).length||Ya(d))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:L}=d;L&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],L(this._map))}mergeHandlerResult(t,n,l,d,f){if(!l)return;o.extend(t,l);const _={handlerName:d,originalEvent:l.originalEvent||f};l.zoomDelta!==void 0&&(n.zoom=_),l.panDelta!==void 0&&(n.drag=_),l.pitchDelta!==void 0&&(n.pitch=_),l.bearingDelta!==void 0&&(n.rotate=_)}_applyChanges(){const t={},n={},l={};for(const[d,f,_]of this._changes)d.panDelta&&(t.panDelta=(t.panDelta||new o.pointGeometry(0,0))._add(d.panDelta)),d.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+d.zoomDelta),d.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+d.bearingDelta),d.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+d.pitchDelta),d.around!==void 0&&(t.around=d.around),d.pinchAround!==void 0&&(t.pinchAround=d.pinchAround),d.noInertia&&(t.noInertia=d.noInertia),o.extend(n,f),o.extend(l,_);this._updateMapTransform(t,n,l),this._changes=[]}_updateMapTransform(t,n,l){const d=this._map,f=d.transform;if(!Ya(t))return this._fireEvents(n,l,!0);let{panDelta:_,zoomDelta:b,bearingDelta:w,pitchDelta:E,around:P,pinchAround:L}=t;L!==void 0&&(P=L),d._stop(!0),P=P||d.transform.centerPoint;const O=f.pointLocation(_?P.sub(_):P);w&&(f.bearing+=w),E&&(f.pitch+=E),b&&(f.zoom+=b),f.setLocationAtPoint(O,P),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(n,l,!0)}_fireEvents(t,n,l){const d=Ln(this._eventsInProgress),f=Ln(t),_={};for(const P in t){const{originalEvent:L}=t[P];this._eventsInProgress[P]||(_[`${P}start`]=L),this._eventsInProgress[P]=t[P]}!d&&f&&this._fireEvent("movestart",f.originalEvent);for(const P in _)this._fireEvent(P,_[P]);f&&this._fireEvent("move",f.originalEvent);for(const P in t){const{originalEvent:L}=t[P];this._fireEvent(P,L)}const b={};let w;for(const P in this._eventsInProgress){const{handlerName:L,originalEvent:O}=this._eventsInProgress[P];this._handlersById[L].isActive()||(delete this._eventsInProgress[P],w=n[L]||O,b[`${P}end`]=w)}for(const P in b)this._fireEvent(P,b[P]);const E=Ln(this._eventsInProgress);if(l&&(d||f)&&!E){this._updatingCamera=!0;const P=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),L=O=>O!==0&&-this._bearingSnap<O&&O<this._bearingSnap;P?(L(P.bearing||this._map.getBearing())&&(P.bearing=0),this._map.easeTo(P,{originalEvent:w})):(this._map.fire(new o.Event("moveend",{originalEvent:w})),L(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(t,n){this._map.fire(new o.Event(t,n?{originalEvent:n}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(t=>{delete this._frameId,this.handleEvent(new ro("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const Bt={extend:(h,...t)=>o.extend(h,...t),run(h){h()},logToElement(h,t=!1,n="log"){const l=window.document.getElementById(n);l&&(t&&(l.innerHTML=""),l.innerHTML+=`<br>${h}`)}};class Ka extends o.Evented{constructor(t,n){super(),this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=n.bearingSnap,o.bindAll(["_renderFrameCallback"],this)}getCenter(){return new o.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(t,n){return this.jumpTo({center:t},n)}panBy(t,n,l){return t=o.pointGeometry.convert(t).mult(-1),this.panTo(this.transform.center,o.extend({offset:t},n),l)}panTo(t,n,l){return this.easeTo(o.extend({center:t},n),l)}getZoom(){return this.transform.zoom}setZoom(t,n){return this.jumpTo({zoom:t},n),this}zoomTo(t,n,l){return this.easeTo(o.extend({zoom:t},n),l)}zoomIn(t,n){return this.zoomTo(this.getZoom()+1,t,n),this}zoomOut(t,n){return this.zoomTo(this.getZoom()-1,t,n),this}getBearing(){return this.transform.bearing}setBearing(t,n){return this.jumpTo({bearing:t},n),this}getPadding(){return this.transform.padding}setPadding(t,n){return this.jumpTo({padding:t},n),this}rotateTo(t,n,l){return this.easeTo(o.extend({bearing:t},n),l)}resetNorth(t,n){return this.rotateTo(0,o.extend({duration:1e3},t),n),this}resetNorthPitch(t,n){return this.easeTo(o.extend({bearing:0,pitch:0,duration:1e3},t),n),this}snapToNorth(t,n){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,n):this}getPitch(){return this.transform.pitch}setPitch(t,n){return this.jumpTo({pitch:t},n),this}cameraForBounds(t,n){t=o.LngLatBounds.convert(t);const l=n&&n.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),l,n)}_cameraForBoxAndBearing(t,n,l,d){const f={top:0,bottom:0,right:0,left:0};if(typeof(d=o.extend({padding:f,offset:[0,0],maxZoom:this.transform.maxZoom},d)).padding=="number"){const ce=d.padding;d.padding={top:ce,bottom:ce,right:ce,left:ce}}d.padding=o.extend(f,d.padding);const _=this.transform,b=_.padding,w=_.project(o.LngLat.convert(t)),E=_.project(o.LngLat.convert(n)),P=w.rotate(-l*Math.PI/180),L=E.rotate(-l*Math.PI/180),O=new o.pointGeometry(Math.max(P.x,L.x),Math.max(P.y,L.y)),j=new o.pointGeometry(Math.min(P.x,L.x),Math.min(P.y,L.y)),U=O.sub(j),q=(_.width-(b.left+b.right+d.padding.left+d.padding.right))/U.x,ee=(_.height-(b.top+b.bottom+d.padding.top+d.padding.bottom))/U.y;if(ee<0||q<0)return void o.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const te=Math.min(_.scaleZoom(_.scale*Math.min(q,ee)),d.maxZoom),ne=o.pointGeometry.convert(d.offset),ie=new o.pointGeometry((d.padding.left-d.padding.right)/2,(d.padding.top-d.padding.bottom)/2).rotate(l*Math.PI/180),fe=ne.add(ie).mult(_.scale/_.zoomScale(te));return{center:_.unproject(w.add(E).div(2).sub(fe)),zoom:te,bearing:l}}fitBounds(t,n,l){return this._fitInternal(this.cameraForBounds(t,n),n,l)}fitScreenCoordinates(t,n,l,d,f){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(o.pointGeometry.convert(t)),this.transform.pointLocation(o.pointGeometry.convert(n)),l,d),d,f)}_fitInternal(t,n,l){return t?(delete(n=o.extend(t,n)).padding,n.linear?this.easeTo(n,l):this.flyTo(n,l)):this}jumpTo(t,n){this.stop();const l=this.transform;let d=!1,f=!1,_=!1;return"zoom"in t&&l.zoom!==+t.zoom&&(d=!0,l.zoom=+t.zoom),t.center!==void 0&&(l.center=o.LngLat.convert(t.center)),"bearing"in t&&l.bearing!==+t.bearing&&(f=!0,l.bearing=+t.bearing),"pitch"in t&&l.pitch!==+t.pitch&&(_=!0,l.pitch=+t.pitch),t.padding==null||l.isPaddingEqual(t.padding)||(l.padding=t.padding),this.fire(new o.Event("movestart",n)).fire(new o.Event("move",n)),d&&this.fire(new o.Event("zoomstart",n)).fire(new o.Event("zoom",n)).fire(new o.Event("zoomend",n)),f&&this.fire(new o.Event("rotatestart",n)).fire(new o.Event("rotate",n)).fire(new o.Event("rotateend",n)),_&&this.fire(new o.Event("pitchstart",n)).fire(new o.Event("pitch",n)).fire(new o.Event("pitchend",n)),this.fire(new o.Event("moveend",n))}easeTo(t,n){this._stop(!1,t.easeId),((t=o.extend({offset:[0,0],duration:500,easing:o.ease},t)).animate===!1||!t.essential&&o.exported.prefersReducedMotion)&&(t.duration=0);const l=this.transform,d=this.getZoom(),f=this.getBearing(),_=this.getPitch(),b=this.getPadding(),w="zoom"in t?+t.zoom:d,E="bearing"in t?this._normalizeBearing(t.bearing,f):f,P="pitch"in t?+t.pitch:_,L="padding"in t?t.padding:l.padding,O=o.pointGeometry.convert(t.offset);let j=l.centerPoint.add(O);const U=l.pointLocation(j),q=o.LngLat.convert(t.center||U);this._normalizeCenter(q);const ee=l.project(U),te=l.project(q).sub(ee),ne=l.zoomScale(w-d);let ie,fe;t.around&&(ie=o.LngLat.convert(t.around),fe=l.locationPoint(ie));const ce={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||w!==d,this._rotating=this._rotating||f!==E,this._pitching=this._pitching||P!==_,this._padding=!l.isPaddingEqual(L),this._easeId=t.easeId,this._prepareEase(n,t.noMoveStart,ce),this._ease(ue=>{if(this._zooming&&(l.zoom=o.number(d,w,ue)),this._rotating&&(l.bearing=o.number(f,E,ue)),this._pitching&&(l.pitch=o.number(_,P,ue)),this._padding&&(l.interpolatePadding(b,L,ue),j=l.centerPoint.add(O)),ie)l.setLocationAtPoint(ie,fe);else{const ve=l.zoomScale(l.zoom-d),Se=w>d?Math.min(2,ne):Math.max(.5,ne),me=Math.pow(Se,1-ue),Fe=l.unproject(ee.add(te.mult(ue*me)).mult(ve));l.setLocationAtPoint(l.renderWorldCopies?Fe.wrap():Fe,j)}this._fireMoveEvents(n)},ue=>{this._afterEase(n,ue)},t),this}_prepareEase(t,n,l={}){this._moving=!0,n||l.moving||this.fire(new o.Event("movestart",t)),this._zooming&&!l.zooming&&this.fire(new o.Event("zoomstart",t)),this._rotating&&!l.rotating&&this.fire(new o.Event("rotatestart",t)),this._pitching&&!l.pitching&&this.fire(new o.Event("pitchstart",t))}_fireMoveEvents(t){this.fire(new o.Event("move",t)),this._zooming&&this.fire(new o.Event("zoom",t)),this._rotating&&this.fire(new o.Event("rotate",t)),this._pitching&&this.fire(new o.Event("pitch",t))}_afterEase(t,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId;const l=this._zooming,d=this._rotating,f=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,l&&this.fire(new o.Event("zoomend",t)),d&&this.fire(new o.Event("rotateend",t)),f&&this.fire(new o.Event("pitchend",t)),this.fire(new o.Event("moveend",t))}flyTo(t,n){if(!t.essential&&o.exported.prefersReducedMotion){const dt=o.pick(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(dt,n)}this.stop(),t=o.extend({offset:[0,0],speed:1.2,curve:1.42,easing:o.ease},t);const l=this.transform,d=this.getZoom(),f=this.getBearing(),_=this.getPitch(),b=this.getPadding(),w="zoom"in t?o.clamp(+t.zoom,l.minZoom,l.maxZoom):d,E="bearing"in t?this._normalizeBearing(t.bearing,f):f,P="pitch"in t?+t.pitch:_,L="padding"in t?t.padding:l.padding,O=l.zoomScale(w-d),j=o.pointGeometry.convert(t.offset);let U=l.centerPoint.add(j);const q=l.pointLocation(U),ee=o.LngLat.convert(t.center||q);this._normalizeCenter(ee);const te=l.project(q),ne=l.project(ee).sub(te);let ie=t.curve;const fe=Math.max(l.width,l.height),ce=fe/O,ue=ne.mag();if("minZoom"in t){const dt=o.clamp(Math.min(t.minZoom,d,w),l.minZoom,l.maxZoom),Vt=fe/l.zoomScale(dt-d);ie=Math.sqrt(Vt/ue*2)}const ve=ie*ie;function Se(dt){const Vt=(ce*ce-fe*fe+(dt?-1:1)*ve*ve*ue*ue)/(2*(dt?ce:fe)*ve*ue);return Math.log(Math.sqrt(Vt*Vt+1)-Vt)}function me(dt){return(Math.exp(dt)-Math.exp(-dt))/2}function Fe(dt){return(Math.exp(dt)+Math.exp(-dt))/2}const Ce=Se(0);let Je=function(dt){return Fe(Ce)/Fe(Ce+ie*dt)},ft=function(dt){return fe*((Fe(Ce)*(me(Vt=Ce+ie*dt)/Fe(Vt))-me(Ce))/ve)/ue;var Vt},ct=(Se(1)-Ce)/ie;if(Math.abs(ue)<1e-6||!isFinite(ct)){if(Math.abs(fe-ce)<1e-6)return this.easeTo(t,n);const dt=ce<fe?-1:1;ct=Math.abs(Math.log(ce/fe))/ie,ft=function(){return 0},Je=function(Vt){return Math.exp(dt*ie*Vt)}}return t.duration="duration"in t?+t.duration:1e3*ct/("screenSpeed"in t?+t.screenSpeed/ie:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=f!==E,this._pitching=P!==_,this._padding=!l.isPaddingEqual(L),this._prepareEase(n,!1),this._ease(dt=>{const Vt=dt*ct,et=1/Je(Vt);l.zoom=dt===1?w:d+l.scaleZoom(et),this._rotating&&(l.bearing=o.number(f,E,dt)),this._pitching&&(l.pitch=o.number(_,P,dt)),this._padding&&(l.interpolatePadding(b,L,dt),U=l.centerPoint.add(j));const _t=dt===1?ee:l.unproject(te.add(ne.mult(ft(Vt))).mult(et));l.setLocationAtPoint(l.renderWorldCopies?_t.wrap():_t,U),this._fireMoveEvents(n)},()=>this._afterEase(n),t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,n){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const l=this._onEaseEnd;delete this._onEaseEnd,l.call(this,n)}if(!t){const l=this.handlers;l&&l.stop(!1)}return this}_ease(t,n,l){l.animate===!1||l.duration===0?(t(1),n()):(this._easeStart=o.exported.now(),this._easeOptions=l,this._onEaseFrame=t,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const t=Math.min((o.exported.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(t)),t<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(t,n){t=o.wrap(t,-180,180);const l=Math.abs(t-n);return Math.abs(t-360-n)<l&&(t-=360),Math.abs(t+360-n)<l&&(t+=360),t}_normalizeCenter(t){const n=this.transform;if(!n.renderWorldCopies||n.lngRange)return;const l=t.lng-n.center.lng;t.lng+=l>180?-360:l<-180?360:0}}class Ja{constructor(t={}){this.options=t,o.bindAll(["_toggleAttribution","_updateData","_updateCompact","_updateCompactMinimize"],this)}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options&&this.options.compact,this._container=H.create("details","maplibregl-ctrl maplibregl-ctrl-attrib mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=H.create("summary","maplibregl-ctrl-attrib-button mapboxgl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=H.create("div","maplibregl-ctrl-attrib-inner mapboxgl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){H.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(t,n){const l=this._map._getUIString(`AttributionControl.${n}`);t.title=l,t.setAttribute("aria-label",l)}_toggleAttribution(){this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show","mapboxgl-compact-show")):(this._container.classList.add("maplibregl-compact-show","mapboxgl-compact-show"),this._container.removeAttribute("open")))}_updateData(t){!t||t.sourceDataType!=="metadata"&&t.sourceDataType!=="visibility"&&t.dataType!=="style"||this._updateAttributions()}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map(d=>typeof d!="string"?"":d)):typeof this.options.customAttribution=="string"&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const d=this._map.style.stylesheet;this.styleOwner=d.owner,this.styleId=d.id}const n=this._map.style.sourceCaches;for(const d in n){const f=n[d];if(f.used){const _=f.getSource();_.attribution&&t.indexOf(_.attribution)<0&&t.push(_.attribution)}}t=t.filter(d=>String(d).trim()),t.sort((d,f)=>d.length-f.length),t=t.filter((d,f)=>{for(let _=f+1;_<t.length;_++)if(t[_].indexOf(d)>=0)return!1;return!0});const l=t.join(" | ");l!==this._attribHTML&&(this._attribHTML=l,t.length?(this._innerContainer.innerHTML=l,this._container.classList.remove("maplibregl-attrib-empty","mapboxgl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty","mapboxgl-attrib-empty"),this._updateCompact(),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","mapboxgl-compact","maplibregl-compact-show","mapboxgl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show","mapboxgl-compact","mapboxgl-compact-show"))}_updateCompactMinimize(){this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show","mapboxgl-compact-show")}}class no{constructor(t={}){this.options=t,o.bindAll(["_updateCompact"],this)}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=H.create("div","maplibregl-ctrl mapboxgl-ctrl");const n=H.create("a","maplibregl-ctrl-logo mapboxgl-ctrl-logo");return n.target="_blank",n.rel="noopener nofollow",n.href="https://maplibre.org/",n.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),n.setAttribute("rel","noopener nofollow"),this._container.appendChild(n),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){H.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}_updateCompact(){const t=this._container.children;if(t.length){const n=t[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&n.classList.add("maplibregl-compact","mapboxgl-compact"):n.classList.remove("maplibregl-compact","mapboxgl-compact")}}}class fl{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const n=++this._id;return this._queue.push({callback:t,id:n,cancelled:!1}),n}remove(t){const n=this._currentlyRunning,l=n?this._queue.concat(n):this._queue;for(const d of l)if(d.id===t)return void(d.cancelled=!0)}run(t=0){const n=this._currentlyRunning=this._queue;this._queue=[];for(const l of n)if(!l.cancelled&&(l.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}const gl={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm"},Pc={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,maplibreLogo:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",transformRequest:null,fadeDuration:300,crossSourceCollisions:!0},lr={showCompass:!0,showZoom:!0,visualizePitch:!1};class Qa{constructor(t,n,l=!1){this._clickTolerance=10,this.element=n,this.mouseRotate=new Re({clickTolerance:t.dragRotate._mouseRotate._clickTolerance}),this.map=t,l&&(this.mousePitch=new Ks({clickTolerance:t.dragRotate._mousePitch._clickTolerance})),o.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),H.addEventListener(n,"mousedown",this.mousedown),H.addEventListener(n,"touchstart",this.touchstart,{passive:!1}),H.addEventListener(n,"touchmove",this.touchmove),H.addEventListener(n,"touchend",this.touchend),H.addEventListener(n,"touchcancel",this.reset)}down(t,n){this.mouseRotate.mousedown(t,n),this.mousePitch&&this.mousePitch.mousedown(t,n),H.disableDrag()}move(t,n){const l=this.map,d=this.mouseRotate.mousemoveWindow(t,n);if(d&&d.bearingDelta&&l.setBearing(l.getBearing()+d.bearingDelta),this.mousePitch){const f=this.mousePitch.mousemoveWindow(t,n);f&&f.pitchDelta&&l.setPitch(l.getPitch()+f.pitchDelta)}}off(){const t=this.element;H.removeEventListener(t,"mousedown",this.mousedown),H.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),H.removeEventListener(t,"touchmove",this.touchmove),H.removeEventListener(t,"touchend",this.touchend),H.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){H.enableDrag(),H.removeEventListener(window,"mousemove",this.mousemove),H.removeEventListener(window,"mouseup",this.mouseup)}mousedown(t){this.down(o.extend({},t,{ctrlKey:!0,preventDefault:()=>t.preventDefault()}),H.mousePos(this.element,t)),H.addEventListener(window,"mousemove",this.mousemove),H.addEventListener(window,"mouseup",this.mouseup)}mousemove(t){this.move(t,H.mousePos(this.element,t))}mouseup(t){this.mouseRotate.mouseupWindow(t),this.mousePitch&&this.mousePitch.mouseupWindow(t),this.offTemp()}touchstart(t){t.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=H.touchPos(this.element,t.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>t.preventDefault()},this._startPos))}touchmove(t){t.targetTouches.length!==1?this.reset():(this._lastPos=H.touchPos(this.element,t.targetTouches)[0],this.move({preventDefault:()=>t.preventDefault()},this._lastPos))}touchend(t){t.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),this.reset()}reset(){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()}}function Ue(h,t,n){if(h=new o.LngLat(h.lng,h.lat),t){const l=new o.LngLat(h.lng-360,h.lat),d=new o.LngLat(h.lng+360,h.lat),f=n.locationPoint(h).distSqr(t);n.locationPoint(l).distSqr(t)<f?h=l:n.locationPoint(d).distSqr(t)<f&&(h=d)}for(;Math.abs(h.lng-n.center.lng)>180;){const l=n.locationPoint(h);if(l.x>=0&&l.y>=0&&l.x<=n.width&&l.y<=n.height)break;h.lng>n.center.lng?h.lng-=360:h.lng+=360}return h}const Xe={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function da(h,t,n){const l=h.classList;for(const d in Xe)l.remove(`maplibregl-${n}-anchor-${d}`,`mapboxgl-${n}-anchor-${d}`);l.add(`maplibregl-${n}-anchor-${t}`,`mapboxgl-${n}-anchor-${t}`)}class pa extends o.Evented{constructor(t,n){if(super(),(t instanceof HTMLElement||n)&&(t=o.extend({element:t},n)),o.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress"],this),this._anchor=t&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&t.pitchAlignment!=="auto"?t.pitchAlignment:this._rotationAlignment,t&&t.element)this._element=t.element,this._offset=o.pointGeometry.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=H.create("div"),this._element.setAttribute("aria-label","Map marker");const l=H.createNS("http://www.w3.org/2000/svg","svg"),d=41,f=27;l.setAttributeNS(null,"display","block"),l.setAttributeNS(null,"height",`${d}px`),l.setAttributeNS(null,"width",`${f}px`),l.setAttributeNS(null,"viewBox",`0 0 ${f} ${d}`);const _=H.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"stroke","none"),_.setAttributeNS(null,"stroke-width","1"),_.setAttributeNS(null,"fill","none"),_.setAttributeNS(null,"fill-rule","evenodd");const b=H.createNS("http://www.w3.org/2000/svg","g");b.setAttributeNS(null,"fill-rule","nonzero");const w=H.createNS("http://www.w3.org/2000/svg","g");w.setAttributeNS(null,"transform","translate(3.0, 29.0)"),w.setAttributeNS(null,"fill","#000000");const E=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const ne of E){const ie=H.createNS("http://www.w3.org/2000/svg","ellipse");ie.setAttributeNS(null,"opacity","0.04"),ie.setAttributeNS(null,"cx","10.5"),ie.setAttributeNS(null,"cy","5.80029008"),ie.setAttributeNS(null,"rx",ne.rx),ie.setAttributeNS(null,"ry",ne.ry),w.appendChild(ie)}const P=H.createNS("http://www.w3.org/2000/svg","g");P.setAttributeNS(null,"fill",this._color);const L=H.createNS("http://www.w3.org/2000/svg","path");L.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),P.appendChild(L);const O=H.createNS("http://www.w3.org/2000/svg","g");O.setAttributeNS(null,"opacity","0.25"),O.setAttributeNS(null,"fill","#000000");const j=H.createNS("http://www.w3.org/2000/svg","path");j.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),O.appendChild(j);const U=H.createNS("http://www.w3.org/2000/svg","g");U.setAttributeNS(null,"transform","translate(6.0, 7.0)"),U.setAttributeNS(null,"fill","#FFFFFF");const q=H.createNS("http://www.w3.org/2000/svg","g");q.setAttributeNS(null,"transform","translate(8.0, 8.0)");const ee=H.createNS("http://www.w3.org/2000/svg","circle");ee.setAttributeNS(null,"fill","#000000"),ee.setAttributeNS(null,"opacity","0.25"),ee.setAttributeNS(null,"cx","5.5"),ee.setAttributeNS(null,"cy","5.5"),ee.setAttributeNS(null,"r","5.4999962");const te=H.createNS("http://www.w3.org/2000/svg","circle");te.setAttributeNS(null,"fill","#FFFFFF"),te.setAttributeNS(null,"cx","5.5"),te.setAttributeNS(null,"cy","5.5"),te.setAttributeNS(null,"r","5.4999962"),q.appendChild(ee),q.appendChild(te),b.appendChild(w),b.appendChild(P),b.appendChild(O),b.appendChild(U),b.appendChild(q),l.appendChild(b),l.setAttributeNS(null,"height",d*this._scale+"px"),l.setAttributeNS(null,"width",f*this._scale+"px"),this._element.appendChild(l),this._offset=o.pointGeometry.convert(t&&t.offset||[0,-14])}this._element.classList.add("maplibregl-marker","mapboxgl-marker"),this._element.addEventListener("dragstart",l=>{l.preventDefault()}),this._element.addEventListener("mousedown",l=>{l.preventDefault()}),da(this._element,this._anchor,"marker"),this._popup=null}addTo(t){return this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),H.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=o.LngLat.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const d=Math.sqrt(Math.pow(13.5,2)/2);t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[d,-1*(38.1-13.5+d)],"bottom-right":[-d,-1*(38.1-13.5+d)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=t,this._lngLat&&this._popup.setLngLat(this._lngLat),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}_onKeyPress(t){const n=t.code,l=t.charCode||t.keyCode;n!=="Space"&&n!=="Enter"&&l!==32&&l!==13||this.togglePopup()}_onMapClick(t){const n=t.originalEvent.target,l=this._element;this._popup&&(n===l||l.contains(n))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const t=this._popup;return t?(t.isOpen()?t.remove():t.addTo(this._map),this):this}_update(t){if(!this._map)return;this._map.transform.renderWorldCopies&&(this._lngLat=Ue(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);let n="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?n=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(n=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let l="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?l="rotateX(0deg)":this._pitchAlignment==="map"&&(l=`rotateX(${this._map.getPitch()}deg)`),t&&t.type!=="moveend"||(this._pos=this._pos.round()),H.setTransform(this._element,`${Xe[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${l} ${n}`)}getOffset(){return this._offset}setOffset(t){return this._offset=o.pointGeometry.convert(t),this._update(),this}_onMove(t){if(!this._isDragging){const n=this._clickTolerance||this._map._clickTolerance;this._isDragging=t.point.dist(this._pointerdownPos)>=n}this._isDragging&&(this._pos=t.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new o.Event("dragstart"))),this.fire(new o.Event("drag")))}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new o.Event("dragend")),this._state="inactive"}_addDragHandler(t){this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(this._pos).add(this._offset),this._pointerdownPos=t.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))}setDraggable(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&t!=="auto"?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}}const ao={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let ri,ln=0,Ai=!1;const zc={maxWidth:100,unit:"metric"};function ma(h,t,n){const l=n&&n.maxWidth||100,d=h._container.clientHeight/2,f=h.unproject([0,d]),_=h.unproject([l,d]),b=f.distanceTo(_);if(n&&n.unit==="imperial"){const w=3.2808*b;w>5280?Lt(t,l,w/5280,h._getUIString("ScaleControl.Miles")):Lt(t,l,w,h._getUIString("ScaleControl.Feet"))}else n&&n.unit==="nautical"?Lt(t,l,b/1852,h._getUIString("ScaleControl.NauticalMiles")):b>=1e3?Lt(t,l,b/1e3,h._getUIString("ScaleControl.Kilometers")):Lt(t,l,b,h._getUIString("ScaleControl.Meters"))}function Lt(h,t,n,l){const d=function(f){const _=Math.pow(10,`${Math.floor(f)}`.length-1);let b=f/_;return b=b>=10?10:b>=5?5:b>=3?3:b>=2?2:b>=1?1:function(w){const E=Math.pow(10,Math.ceil(-Math.log(w)/Math.LN10));return Math.round(w*E)/E}(b),_*b}(n);h.style.width=t*(d/n)+"px",h.innerHTML=`${d}&nbsp;${l}`}const ni={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},yl=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Dn(h){if(h){if(typeof h=="number"){const t=Math.round(Math.sqrt(.5*Math.pow(h,2)));return{center:new o.pointGeometry(0,0),top:new o.pointGeometry(0,h),"top-left":new o.pointGeometry(t,t),"top-right":new o.pointGeometry(-t,t),bottom:new o.pointGeometry(0,-h),"bottom-left":new o.pointGeometry(t,-t),"bottom-right":new o.pointGeometry(-t,-t),left:new o.pointGeometry(h,0),right:new o.pointGeometry(-h,0)}}if(h instanceof o.pointGeometry||Array.isArray(h)){const t=o.pointGeometry.convert(h);return{center:t,top:t,"top-left":t,"top-right":t,bottom:t,"bottom-left":t,"bottom-right":t,left:t,right:t}}return{center:o.pointGeometry.convert(h.center||[0,0]),top:o.pointGeometry.convert(h.top||[0,0]),"top-left":o.pointGeometry.convert(h["top-left"]||[0,0]),"top-right":o.pointGeometry.convert(h["top-right"]||[0,0]),bottom:o.pointGeometry.convert(h.bottom||[0,0]),"bottom-left":o.pointGeometry.convert(h["bottom-left"]||[0,0]),"bottom-right":o.pointGeometry.convert(h["bottom-right"]||[0,0]),left:o.pointGeometry.convert(h.left||[0,0]),right:o.pointGeometry.convert(h.right||[0,0])}}return Dn(new o.pointGeometry(0,0))}const fa={supported:G,setRTLTextPlugin:o.setRTLTextPlugin,getRTLTextPluginStatus:o.getRTLTextPluginStatus,Map:class extends Ka{constructor(h){var t;if(o.PerformanceUtils.mark(o.PerformanceMarkers.create),(h=o.extend({},Pc,h)).minZoom!=null&&h.maxZoom!=null&&h.minZoom>h.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(h.minPitch!=null&&h.maxPitch!=null&&h.minPitch>h.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(h.minPitch!=null&&h.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(h.maxPitch!=null&&h.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new aa(h.minZoom,h.maxZoom,h.minPitch,h.maxPitch,h.renderWorldCopies),{bearingSnap:h.bearingSnap}),this._interactive=h.interactive,this._maxTileCacheSize=h.maxTileCacheSize,this._failIfMajorPerformanceCaveat=h.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=h.preserveDrawingBuffer,this._antialias=h.antialias,this._trackResize=h.trackResize,this._bearingSnap=h.bearingSnap,this._refreshExpiredTiles=h.refreshExpiredTiles,this._fadeDuration=h.fadeDuration,this._crossSourceCollisions=h.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=h.collectResourceTiming,this._renderTaskQueue=new fl,this._controls=[],this._mapId=o.uniqueId(),this._locale=o.extend({},gl,h.locale),this._clickTolerance=h.clickTolerance,this._pixelRatio=(t=h.pixelRatio)!==null&&t!==void 0?t:devicePixelRatio,this._requestManager=new ke(h.transformRequest),typeof h.container=="string"){if(this._container=document.getElementById(h.container),!this._container)throw new Error(`Container '${h.container}' not found.`)}else{if(!(h.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=h.container}if(h.maxBounds&&this.setMaxBounds(h.maxBounds),o.bindAll(["_onWindowOnline","_onWindowResize","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),this.painter===void 0)throw new Error("Failed to initialize WebGL.");this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),typeof window<"u"&&(addEventListener("online",this._onWindowOnline,!1),addEventListener("resize",this._onWindowResize,!1),addEventListener("orientationchange",this._onWindowResize,!1)),this.handlers=new Vi(this,h),this._hash=h.hash&&new nl(typeof h.hash=="string"&&h.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:h.center,zoom:h.zoom,bearing:h.bearing,pitch:h.pitch}),h.bounds&&(this.resize(),this.fitBounds(h.bounds,o.extend({},h.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=h.localIdeographFontFamily,h.style&&this.setStyle(h.style,{localIdeographFontFamily:h.localIdeographFontFamily}),h.attributionControl&&this.addControl(new Ja({customAttribution:h.customAttribution})),h.maplibreLogo&&this.addControl(new no,h.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",n=>{this._update(n.dataType==="style"),this.fire(new o.Event(`${n.dataType}data`,n))}),this.on("dataloading",n=>{this.fire(new o.Event(`${n.dataType}dataloading`,n))}),this.on("dataabort",n=>{this.fire(new o.Event("sourcedataabort",n))})}_getMapId(){return this._mapId}addControl(h,t){if(t===void 0&&(t=h.getDefaultPosition?h.getDefaultPosition():"top-right"),!h||!h.onAdd)return this.fire(new o.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const n=h.onAdd(this);this._controls.push(h);const l=this._controlPositions[t];return t.indexOf("bottom")!==-1?l.insertBefore(n,l.firstChild):l.appendChild(n),this}removeControl(h){if(!h||!h.onRemove)return this.fire(new o.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(h);return t>-1&&this._controls.splice(t,1),h.onRemove(this),this}hasControl(h){return this._controls.indexOf(h)>-1}resize(h){const t=this._containerDimensions(),n=t[0],l=t[1];this._resizeCanvas(n,l,this.getPixelRatio()),this.transform.resize(n,l),this.painter.resize(n,l,this.getPixelRatio());const d=!this._moving;return d&&(this.stop(),this.fire(new o.Event("movestart",h)).fire(new o.Event("move",h))),this.fire(new o.Event("resize",h)),d&&this.fire(new o.Event("moveend",h)),this}getPixelRatio(){return this._pixelRatio}setPixelRatio(h){const[t,n]=this._containerDimensions();this._pixelRatio=h,this._resizeCanvas(t,n,h),this.painter.resize(t,n,h)}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(h){return this.transform.setMaxBounds(o.LngLatBounds.convert(h)),this._update()}setMinZoom(h){if((h=h??-2)>=-2&&h<=this.transform.maxZoom)return this.transform.minZoom=h,this._update(),this.getZoom()<h&&this.setZoom(h),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(h){if((h=h??22)>=this.transform.minZoom)return this.transform.maxZoom=h,this._update(),this.getZoom()>h&&this.setZoom(h),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(h){if((h=h??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(h>=0&&h<=this.transform.maxPitch)return this.transform.minPitch=h,this._update(),this.getPitch()<h&&this.setPitch(h),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(h){if((h=h??60)>85)throw new Error("maxPitch must be less than or equal to 85");if(h>=this.transform.minPitch)return this.transform.maxPitch=h,this._update(),this.getPitch()>h&&this.setPitch(h),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(h){return this.transform.renderWorldCopies=h,this._update()}project(h){return this.transform.locationPoint(o.LngLat.convert(h))}unproject(h){return this.transform.pointLocation(o.pointGeometry.convert(h))}isMoving(){return this._moving||this.handlers.isMoving()}isZooming(){return this._zooming||this.handlers.isZooming()}isRotating(){return this._rotating||this.handlers.isRotating()}_createDelegatedListener(h,t,n){if(h==="mouseenter"||h==="mouseover"){let l=!1;return{layer:t,listener:n,delegates:{mousemove:f=>{const _=this.getLayer(t)?this.queryRenderedFeatures(f.point,{layers:[t]}):[];_.length?l||(l=!0,n.call(this,new zi(h,this,f.originalEvent,{features:_}))):l=!1},mouseout:()=>{l=!1}}}}if(h==="mouseleave"||h==="mouseout"){let l=!1;return{layer:t,listener:n,delegates:{mousemove:_=>{(this.getLayer(t)?this.queryRenderedFeatures(_.point,{layers:[t]}):[]).length?l=!0:l&&(l=!1,n.call(this,new zi(h,this,_.originalEvent)))},mouseout:_=>{l&&(l=!1,n.call(this,new zi(h,this,_.originalEvent)))}}}}{const l=d=>{const f=this.getLayer(t)?this.queryRenderedFeatures(d.point,{layers:[t]}):[];f.length&&(d.features=f,n.call(this,d),delete d.features)};return{layer:t,listener:n,delegates:{[h]:l}}}}on(h,t,n){if(n===void 0)return super.on(h,t);const l=this._createDelegatedListener(h,t,n);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[h]=this._delegatedListeners[h]||[],this._delegatedListeners[h].push(l);for(const d in l.delegates)this.on(d,l.delegates[d]);return this}once(h,t,n){if(n===void 0)return super.once(h,t);const l=this._createDelegatedListener(h,t,n);for(const d in l.delegates)this.once(d,l.delegates[d]);return this}off(h,t,n){return n===void 0?super.off(h,t):(this._delegatedListeners&&this._delegatedListeners[h]&&(l=>{const d=this._delegatedListeners[h];for(let f=0;f<d.length;f++){const _=d[f];if(_.layer===t&&_.listener===n){for(const b in _.delegates)this.off(b,_.delegates[b]);return d.splice(f,1),this}}})(),this)}queryRenderedFeatures(h,t){if(!this.style)return[];let n;if(t!==void 0||h===void 0||h instanceof o.pointGeometry||Array.isArray(h)||(t=h,h=void 0),t=t||{},(h=h||[[0,0],[this.transform.width,this.transform.height]])instanceof o.pointGeometry||typeof h[0]=="number")n=[o.pointGeometry.convert(h)];else{const l=o.pointGeometry.convert(h[0]),d=o.pointGeometry.convert(h[1]);n=[l,new o.pointGeometry(d.x,l.y),d,new o.pointGeometry(l.x,d.y),l]}return this.style.queryRenderedFeatures(n,t,this.transform)}querySourceFeatures(h,t){return this.style.querySourceFeatures(h,t)}setStyle(h,t){return(t=o.extend({},{localIdeographFontFamily:this._localIdeographFontFamily},t)).diff!==!1&&t.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&h?(this._diffStyle(h,t),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._updateStyle(h,t))}setTransformRequest(h){return this._requestManager.setTransformRequest(h),this}_getUIString(h){const t=this._locale[h];if(t==null)throw new Error(`Missing UI string '${h}'`);return t}_updateStyle(h,t){return this.style&&(this.style.setEventedParent(null),this.style._remove()),h?(this.style=new hi(this,t||{}),this.style.setEventedParent(this,{style:this.style}),typeof h=="string"?this.style.loadURL(h):this.style.loadJSON(h),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new hi(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(h,t){if(typeof h=="string"){const n=this._requestManager.transformRequest(h,o.ResourceType.Style);o.getJSON(n,(l,d)=>{l?this.fire(new o.ErrorEvent(l)):d&&this._updateDiff(d,t)})}else typeof h=="object"&&this._updateDiff(h,t)}_updateDiff(h,t){try{this.style.setState(h)&&this._update(!0)}catch(n){o.warnOnce(`Unable to perform style diff: ${n.message||n.error||n}.  Rebuilding the style from scratch.`),this._updateStyle(h,t)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():o.warnOnce("There is no style added to the map.")}addSource(h,t){return this._lazyInitEmptyStyle(),this.style.addSource(h,t),this._update(!0)}isSourceLoaded(h){const t=this.style&&this.style.sourceCaches[h];if(t!==void 0)return t.loaded();this.fire(new o.ErrorEvent(new Error(`There is no source with ID '${h}'`)))}areTilesLoaded(){const h=this.style&&this.style.sourceCaches;for(const t in h){const n=h[t]._tiles;for(const l in n){const d=n[l];if(d.state!=="loaded"&&d.state!=="errored")return!1}}return!0}addSourceType(h,t,n){return this._lazyInitEmptyStyle(),this.style.addSourceType(h,t,n)}removeSource(h){return this.style.removeSource(h),this._update(!0)}getSource(h){return this.style.getSource(h)}addImage(h,t,{pixelRatio:n=1,sdf:l=!1,stretchX:d,stretchY:f,content:_}={}){if(this._lazyInitEmptyStyle(),t instanceof HTMLImageElement||o.isImageBitmap(t)){const{width:b,height:w,data:E}=o.exported.getImageData(t);this.style.addImage(h,{data:new o.RGBAImage({width:b,height:w},E),pixelRatio:n,stretchX:d,stretchY:f,content:_,sdf:l,version:0})}else{if(t.width===void 0||t.height===void 0)return this.fire(new o.ErrorEvent(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:b,height:w,data:E}=t,P=t;this.style.addImage(h,{data:new o.RGBAImage({width:b,height:w},new Uint8Array(E)),pixelRatio:n,stretchX:d,stretchY:f,content:_,sdf:l,version:0,userImage:P}),P.onAdd&&P.onAdd(this,h)}}}updateImage(h,t){const n=this.style.getImage(h);if(!n)return this.fire(new o.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const l=t instanceof HTMLImageElement||o.isImageBitmap(t)?o.exported.getImageData(t):t,{width:d,height:f,data:_}=l;if(d===void 0||f===void 0)return this.fire(new o.ErrorEvent(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(d!==n.data.width||f!==n.data.height)return this.fire(new o.ErrorEvent(new Error("The width and height of the updated image must be that same as the previous version of the image")));const b=!(t instanceof HTMLImageElement||o.isImageBitmap(t));n.data.replace(_,b),this.style.updateImage(h,n)}hasImage(h){return h?!!this.style.getImage(h):(this.fire(new o.ErrorEvent(new Error("Missing required image id"))),!1)}removeImage(h){this.style.removeImage(h)}loadImage(h,t){o.getImage(this._requestManager.transformRequest(h,o.ResourceType.Image),t)}listImages(){return this.style.listImages()}addLayer(h,t){return this._lazyInitEmptyStyle(),this.style.addLayer(h,t),this._update(!0)}moveLayer(h,t){return this.style.moveLayer(h,t),this._update(!0)}removeLayer(h){return this.style.removeLayer(h),this._update(!0)}getLayer(h){return this.style.getLayer(h)}setLayerZoomRange(h,t,n){return this.style.setLayerZoomRange(h,t,n),this._update(!0)}setFilter(h,t,n={}){return this.style.setFilter(h,t,n),this._update(!0)}getFilter(h){return this.style.getFilter(h)}setPaintProperty(h,t,n,l={}){return this.style.setPaintProperty(h,t,n,l),this._update(!0)}getPaintProperty(h,t){return this.style.getPaintProperty(h,t)}setLayoutProperty(h,t,n,l={}){return this.style.setLayoutProperty(h,t,n,l),this._update(!0)}getLayoutProperty(h,t){return this.style.getLayoutProperty(h,t)}setLight(h,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(h,t),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(h,t){return this.style.setFeatureState(h,t),this._update()}removeFeatureState(h,t){return this.style.removeFeatureState(h,t),this._update()}getFeatureState(h){return this.style.getFeatureState(h)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let h=0,t=0;return this._container&&(h=this._container.clientWidth||400,t=this._container.clientHeight||300),[h,t]}_setupContainer(){const h=this._container;h.classList.add("maplibregl-map","mapboxgl-map");const t=this._canvasContainer=H.create("div","maplibregl-canvas-container mapboxgl-canvas-container",h);this._interactive&&t.classList.add("maplibregl-interactive","mapboxgl-interactive"),this._canvas=H.create("canvas","maplibregl-canvas mapboxgl-canvas",t),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");const n=this._containerDimensions();this._resizeCanvas(n[0],n[1],this.getPixelRatio());const l=this._controlContainer=H.create("div","maplibregl-control-container mapboxgl-control-container",h),d=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(f=>{d[f]=H.create("div",`maplibregl-ctrl-${f} mapboxgl-ctrl-${f}`,l)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(h,t,n){this._canvas.width=n*h,this._canvas.height=n*t,this._canvas.style.width=`${h}px`,this._canvas.style.height=`${t}px`}_setupPainter(){const h=o.extend({},G.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),t=this._canvas.getContext("webgl",h)||this._canvas.getContext("experimental-webgl",h);t?(this.painter=new Xs(t,this.transform),o.exported$1.testSupport(t)):this.fire(new o.ErrorEvent(new Error("Failed to initialize WebGL")))}_contextLost(h){h.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new o.Event("webglcontextlost",{originalEvent:h}))}_contextRestored(h){this._setupPainter(),this.resize(),this._update(),this.fire(new o.Event("webglcontextrestored",{originalEvent:h}))}_onMapScroll(h){if(h.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(h){return this.style?(this._styleDirty=this._styleDirty||h,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(h){return this._update(),this._renderTaskQueue.add(h)}_cancelRenderFrame(h){this._renderTaskQueue.remove(h)}_render(h){let t,n=0;const l=this.painter.context.extTimerQuery;if(this.listens("gpu-timing-frame")&&(t=l.createQueryEXT(),l.beginQueryEXT(l.TIME_ELAPSED_EXT,t),n=o.exported.now()),this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(h),this._removed)return;let d=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const _=this.transform.zoom,b=o.exported.now();this.style.zoomHistory.update(_,b);const w=new o.EvaluationParameters(_,{now:b,fadeDuration:this._fadeDuration,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),E=w.crossFadingFactor();E===1&&E===this._crossFadingFactor||(d=!0,this._crossFadingFactor=E),this.style.update(w)}if(this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,this._fadeDuration,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:this._fadeDuration,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer")}),this.fire(new o.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,o.PerformanceUtils.mark(o.PerformanceMarkers.load),this.fire(new o.Event("load"))),this.style&&(this.style.hasTransitions()||d)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),this.listens("gpu-timing-frame")){const _=o.exported.now()-n;l.endQueryEXT(l.TIME_ELAPSED_EXT,t),setTimeout(()=>{const b=l.getQueryObjectEXT(t,l.QUERY_RESULT_EXT)/1e6;l.deleteQueryEXT(t),this.fire(new o.Event("gpu-timing-frame",{cpuTime:_,gpuTime:b}))},50)}if(this.listens("gpu-timing-layer")){const _=this.painter.collectGpuTimers();setTimeout(()=>{const b=this.painter.queryGpuTimers(_);this.fire(new o.Event("gpu-timing-layer",{layerTimes:b}))},50)}const f=this._sourcesDirty||this._styleDirty||this._placementDirty;return f||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new o.Event("idle")),!this._loaded||this._fullyLoaded||f||(this._fullyLoaded=!0,o.PerformanceUtils.mark(o.PerformanceMarkers.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){this._hash&&this._hash.remove();for(const t of this._controls)t.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&(removeEventListener("resize",this._onWindowResize,!1),removeEventListener("orientationchange",this._onWindowResize,!1),removeEventListener("online",this._onWindowOnline,!1));const h=this.painter.context.gl.getExtension("WEBGL_lose_context");h&&h.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),H.remove(this._canvasContainer),H.remove(this._controlContainer),this._container.classList.remove("maplibregl-map","mapboxgl-map"),o.PerformanceUtils.clearMetrics(),this._removed=!0,this.fire(new o.Event("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=o.exported.frame(h=>{o.PerformanceUtils.frame(h),this._frame=null,this._render(h)}))}_onWindowOnline(){this._update()}_onWindowResize(h){this._trackResize&&this.resize({originalEvent:h})._update()}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(h){this._showTileBoundaries!==h&&(this._showTileBoundaries=h,this._update())}get showPadding(){return!!this._showPadding}set showPadding(h){this._showPadding!==h&&(this._showPadding=h,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(h){this._showCollisionBoxes!==h&&(this._showCollisionBoxes=h,h?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(h){this._showOverdrawInspector!==h&&(this._showOverdrawInspector=h,this._update())}get repaint(){return!!this._repaint}set repaint(h){this._repaint!==h&&(this._repaint=h,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(h){this._vertices=h,this._update()}_setCacheLimits(h,t){o.setCacheLimits(h,t)}},NavigationControl:class{constructor(h){this.options=o.extend({},lr,h),this._container=H.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(o.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in mapboxgl-ctrl-zoom-in",t=>this._map.zoomIn({},{originalEvent:t})),H.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out mapboxgl-ctrl-zoom-out",t=>this._map.zoomOut({},{originalEvent:t})),H.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(o.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("maplibregl-ctrl-compass mapboxgl-ctrl-compass",t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})}),this._compassIcon=H.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const h=this._map.getZoom(),t=h===this._map.getMaxZoom(),n=h===this._map.getMinZoom();this._zoomInButton.disabled=t,this._zoomOutButton.disabled=n,this._zoomInButton.setAttribute("aria-disabled",t.toString()),this._zoomOutButton.setAttribute("aria-disabled",n.toString())}_rotateCompassArrow(){const h=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=h}onAdd(h){return this._map=h,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Qa(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){H.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(h,t){const n=H.create("button",h,this._container);return n.type="button",n.addEventListener("click",t),n}_setButtonTitle(h,t){const n=this._map._getUIString(`NavigationControl.${t}`);h.title=n,h.setAttribute("aria-label",n)}},GeolocateControl:class extends o.Evented{constructor(h){super(),this.options=o.extend({},ao,h),o.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker"],this)}onAdd(h){var t;return this._map=h,this._container=H.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),t=this._setupUI,ri!==void 0?t(ri):window.navigator.permissions!==void 0?window.navigator.permissions.query({name:"geolocation"}).then(n=>{ri=n.state!=="denied",t(ri)}):(ri=!!window.navigator.geolocation,t(ri)),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),H.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,ln=0,Ai=!1}_isOutOfMapMaxBounds(h){const t=this._map.getMaxBounds(),n=h.coords;return t&&(n.longitude<t.getWest()||n.longitude>t.getEast()||n.latitude<t.getSouth()||n.latitude>t.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting")}}_onSuccess(h){if(this._map){if(this._isOutOfMapMaxBounds(h))return this._setErrorState(),this.fire(new o.Event("outofmaxbounds",h)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=h,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(h),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(h),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new o.Event("geolocate",h)),this._finish()}}_updateCamera(h){const t=new o.LngLat(h.coords.longitude,h.coords.latitude),n=h.coords.accuracy,l=this._map.getBearing(),d=o.extend({bearing:l},this.options.fitBoundsOptions);this._map.fitBounds(t.toBounds(n),d,{geolocateSource:!0})}_updateMarker(h){if(h){const t=new o.LngLat(h.coords.longitude,h.coords.latitude);this._accuracyCircleMarker.setLngLat(t).addTo(this._map),this._userLocationDotMarker.setLngLat(t).addTo(this._map),this._accuracy=h.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const h=this._map._container.clientHeight/2,t=this._map.unproject([0,h]),n=this._map.unproject([1,h]),l=t.distanceTo(n),d=Math.ceil(2*this._accuracy/l);this._circleElement.style.width=`${d}px`,this._circleElement.style.height=`${d}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_onError(h){if(this._map){if(this.options.trackUserLocation)if(h.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(h.code===3&&Ai)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new o.Event("error",h)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(h){if(this._container.addEventListener("contextmenu",t=>t.preventDefault()),this._geolocateButton=H.create("button","maplibregl-ctrl-geolocate mapboxgl-ctrl-geolocate",this._container),H.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",h===!1){o.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}else{const t=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=H.create("div","maplibregl-user-location-dot mapboxgl-user-location-dot"),this._userLocationDotMarker=new pa(this._dotElement),this._circleElement=H.create("div","maplibregl-user-location-accuracy-circle mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new pa({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",t=>{t.geolocateSource||this._watchState!=="ACTIVE_LOCK"||t.originalEvent&&t.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this.fire(new o.Event("trackuserlocationend")))})}trigger(){if(!this._setup)return o.warnOnce("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new o.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":ln--,Ai=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this.fire(new o.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new o.Event("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active")}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let h;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),ln++,ln>1?(h={maximumAge:6e5,timeout:0},Ai=!0):(h=this.options.positionOptions,Ai=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,h)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:Ja,LogoControl:no,ScaleControl:class{constructor(h){this.options=o.extend({},zc,h),o.bindAll(["_onMove","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_onMove(){ma(this._map,this._container,this.options)}onAdd(h){return this._map=h,this._container=H.create("div","maplibregl-ctrl maplibregl-ctrl-scale mapboxgl-ctrl mapboxgl-ctrl-scale",h.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){H.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}setUnit(h){this.options.unit=h,ma(this._map,this._container,this.options)}},FullscreenControl:class{constructor(h){this._fullscreen=!1,h&&h.container&&(h.container instanceof HTMLElement?this._container=h.container:o.warnOnce("Full screen control 'container' must be a DOM element.")),o.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(h){return this._map=h,this._container||(this._container=this._map.getContainer()),this._controlContainer=H.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",o.warnOnce("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){H.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!!(document.fullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled||document.webkitFullscreenEnabled)}_setupUI(){const h=this._fullscreenButton=H.create("button","maplibregl-ctrl-fullscreen mapboxgl-ctrl-fullscreen",this._controlContainer);H.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",h).setAttribute("aria-hidden","true"),h.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const h=this._getTitle();this._fullscreenButton.setAttribute("aria-label",h),this._fullscreenButton.title=h}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen&&window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},Popup:class extends o.Evented{constructor(h){super(),this.options=o.extend(Object.create(ni),h),o.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this)}addTo(h){return this._map&&this.remove(),this._map=h,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-track-pointer")):this._map.on("move",this._update),this.fire(new o.Event("open")),this}isOpen(){return!!this._map}remove(){return this._content&&H.remove(this._content),this._container&&(H.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new o.Event("close")),this}getLngLat(){return this._lngLat}setLngLat(h){return this._lngLat=o.LngLat.convert(h),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer","mapboxgl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-track-pointer")),this}getElement(){return this._container}setText(h){return this.setDOMContent(document.createTextNode(h))}setHTML(h){const t=document.createDocumentFragment(),n=document.createElement("body");let l;for(n.innerHTML=h;l=n.firstChild,l;)t.appendChild(l);return this.setDOMContent(t)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(h){return this.options.maxWidth=h,this._update(),this}setDOMContent(h){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=H.create("div","maplibregl-popup-content mapboxgl-popup-content",this._container);return this._content.appendChild(h),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(h){this._container&&this._container.classList.add(h)}removeClassName(h){this._container&&this._container.classList.remove(h)}setOffset(h){return this.options.offset=h,this._update(),this}toggleClassName(h){if(this._container)return this._container.classList.toggle(h)}_createCloseButton(){this.options.closeButton&&(this._closeButton=H.create("button","maplibregl-popup-close-button mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_onMouseUp(h){this._update(h.point)}_onMouseMove(h){this._update(h.point)}_onDrag(h){this._update(h.point)}_update(h){if(!this._map||!this._lngLat&&!this._trackPointer||!this._content||(this._container||(this._container=H.create("div","maplibregl-popup mapboxgl-popup",this._map.getContainer()),this._tip=H.create("div","maplibregl-popup-tip mapboxgl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach(f=>this._container.classList.add(f)),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer")),this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=Ue(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!h))return;const t=this._pos=this._trackPointer&&h?h:this._map.project(this._lngLat);let n=this.options.anchor;const l=Dn(this.options.offset);if(!n){const f=this._container.offsetWidth,_=this._container.offsetHeight;let b;b=t.y+l.bottom.y<_?["top"]:t.y>this._map.transform.height-_?["bottom"]:[],t.x<f/2?b.push("left"):t.x>this._map.transform.width-f/2&&b.push("right"),n=b.length===0?"bottom":b.join("-")}const d=t.add(l[n]).round();H.setTransform(this._container,`${Xe[n]} translate(${d.x}px,${d.y}px)`),da(this._container,n,"popup")}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const h=this._container.querySelector(yl);h&&h.focus()}_onClose(){this.remove()}},Marker:pa,Style:hi,LngLat:o.LngLat,LngLatBounds:o.LngLatBounds,Point:o.pointGeometry,MercatorCoordinate:o.MercatorCoordinate,Evented:o.Evented,AJAXError:o.AJAXError,config:o.config,CanvasSource:Zr,GeoJSONSource:qr,ImageSource:xr,RasterDEMTileSource:Xi,RasterTileSource:kr,VectorTileSource:_r,VideoSource:Dr,prewarm:function(){sr().acquire(Wr)},clearPrewarmedResources:function(){const h=wr;h&&(h.isPreloaded()&&h.numActive()===1?(h.release(Wr),wr=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},get workerCount(){return ar.workerCount},set workerCount(h){ar.workerCount=h},get maxParallelImageRequests(){return o.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(h){o.config.MAX_PARALLEL_IMAGE_REQUESTS=h},clearStorage(h){o.clearTileCache(h)},workerUrl:"",addProtocol(h,t){o.config.REGISTERED_PROTOCOLS[h]=t},removeProtocol(h){delete o.config.REGISTERED_PROTOCOLS[h]}};return Bt.extend(fa,{isSafari:o.isSafari,getPerformanceMetrics:o.PerformanceUtils.getPerformanceMetrics}),fa});var R=I;return R})})(Gn);var Sy=Gn.exports;const Ld=150;function Ty({position:s,assets:u,classNames:g}){const x=document.createElement("div");x.innerHTML=`
    <div class="${g.parent}">
      <img class="${g.pin}" src="${u.pin.iconUrl}" />
      <img class="${g.shadow}" src="${u.pin.shadowUrl}" />
    </div>
  `;const I=new Gn.exports.Marker({element:x,anchor:"bottom"});return s!=null&&I.setLngLat(s),I}class Iy{constructor({center:u,bounds:g,mapElement:x,theme:I,units:z,assets:R,classNames:o}){this.eventListeners=[],this.styles={},this.layers={},this.handleWebGlContextLost=()=>{this.dispatchEvent({type:"map:webgl-context-lost"})},this.handleZoom=()=>{this.dispatchEvent({type:"map:zoom",currentZoom:this.maplibregl.getZoom(),minZoom:this.maplibregl.getMinZoom(),maxZoom:this.maplibregl.getMaxZoom()})},this.handleLoad=()=>{this.dispatchEvent(Object.assign({type:"map:scale"},kd({map:this.maplibregl,maxWidth:Ld,type:this.units.distance})))},this.checkIsStyleLoaded=()=>{this.activeLayerId!=null&&(this.maplibregl.isStyleLoaded()!==!1?this.showLayer(this.activeLayerId):setTimeout(this.checkIsStyleLoaded))},this.handleMove=()=>{this.dispatchEvent(Object.assign({type:"map:scale"},kd({map:this.maplibregl,maxWidth:Ld,type:this.units.distance})))},this.center=u,this.theme=I,this.units=z,this.assets=R,this.maplibregl=new Sy.Map({container:x,style:{version:8,sources:{},layers:[]},zoom:0,minZoom:0,maxZoom:0,center:this.center,bounds:g!=null?[g.west,g.south,g.east,g.north]:void 0}),this.pin=Ty({position:this.center,assets:R,classNames:o}),this.maplibregl.dragRotate.disable(),this.maplibregl.touchZoomRotate.disableRotation(),this.maplibregl.on("zoom",this.handleZoom),this.maplibregl.on("load",this.handleLoad),this.maplibregl.on("move",this.handleMove),this.maplibregl.on("webglcontextlost",this.handleWebGlContextLost)}zoomIn(){this.maplibregl.zoomIn()}zoomOut(){this.maplibregl.zoomOut()}addEventListener(u){this.eventListeners.push(u)}removeEventListener(u){this.eventListeners=this.eventListeners.filter(g=>g!==u)}dispatchEvent(u){for(const g of this.eventListeners)g(u)}addStyle({id:u,style:g}){if(u in this.styles)throw new Error(`Style "${u}" already exists`);this.styles[u]=g}addLayer(u){if(u.layer.id in this.layers)throw new Error(`Layer "${u.layer.id}" already exists`);if(!(u.styleId in this.styles))throw new Error(`Style "${u.styleId}" does not exist`);this.layers[u.layer.id]=u}getLayer(u){return this.layers[u]}showLayer(u){const g=this.layers[u];if(g==null)throw new Error(`Layer "${u}" does not exist`);if(this.activeLayerId=u,this.maplibregl.getLayer(u)==null){for(const x of Object.keys(this.layers))this.hideLayer(x);this.maplibregl.setMinZoom(g.zoomLevels.min),this.maplibregl.setMaxZoom(g.zoomLevels.max),this.maplibregl.setZoom(g.zoomLevels.initial),this.center&&this.maplibregl.setCenter(this.center),g.showPin&&this.center!=null?this.showPin(this.center):this.hidePin(),this.activeStyleId===g.styleId?this.maplibregl.addLayer(g.layer,g.renderBeforeId):this.setStyle(g.styleId)}}hideLayer(u){if(this.layers[u]==null)throw new Error(`Layer "${u}" does not exist`);this.maplibregl.getLayer(u)!=null&&this.maplibregl.removeLayer(u)}setStyle(u){const g=this.styles[u];if(g==null)throw new Error(`Style "${u}" does not exist`);this.activeStyleId=u,this.maplibregl.setStyle(g),this.checkIsStyleLoaded()}setUnits(u){this.units=u,this.dispatchEvent({type:"map:units",units:u}),this.maplibregl.triggerRepaint()}showPin(u){this.pin.setLngLat(u),this.pin.addTo(this.maplibregl)}hidePin(){this.pin.remove()}getPin(){return this.pin}}function qn(s,u,g,x){return new(g||(g=Promise))(function(I,z){function R(K){try{G(x.next(K))}catch(ge){z(ge)}}function o(K){try{G(x.throw(K))}catch(ge){z(ge)}}function G(K){var ge;K.done?I(K.value):(ge=K.value,ge instanceof g?ge:new g(function(ae){ae(ge)})).then(R,o)}G((x=x.apply(s,u||[])).next())})}function Ey(s){var u=typeof s;return s!=null&&(u=="object"||u=="function")}var Ro=Ey,Ay=typeof Mo=="object"&&Mo&&Mo.Object===Object&&Mo,Wp=Ay,Cy=Wp,My=typeof self=="object"&&self&&self.Object===Object&&self,Py=Cy||My||Function("return this")(),Nr=Py,zy=Nr,ky=function(){return zy.Date.now()},Ly=ky,Dy=/\s/;function Ry(s){for(var u=s.length;u--&&Dy.test(s.charAt(u)););return u}var By=Ry,Fy=By,Oy=/^\s+/;function Uy(s){return s&&s.slice(0,Fy(s)+1).replace(Oy,"")}var $y=Uy,Ny=Nr,Vy=Ny.Symbol,Jh=Vy,Dd=Jh,Hp=Object.prototype,Gy=Hp.hasOwnProperty,qy=Hp.toString,Eo=Dd?Dd.toStringTag:void 0;function jy(s){var u=Gy.call(s,Eo),g=s[Eo];try{s[Eo]=void 0;var x=!0}catch{}var I=qy.call(s);return x&&(u?s[Eo]=g:delete s[Eo]),I}var Zy=jy,Wy=Object.prototype,Hy=Wy.toString;function Xy(s){return Hy.call(s)}var Yy=Xy,Rd=Jh,Ky=Zy,Jy=Yy,Qy="[object Null]",e_="[object Undefined]",Bd=Rd?Rd.toStringTag:void 0;function t_(s){return s==null?s===void 0?e_:Qy:Bd&&Bd in Object(s)?Ky(s):Jy(s)}var Bo=t_;function i_(s){return s!=null&&typeof s=="object"}var Fo=i_,r_=Bo,n_=Fo,a_="[object Symbol]";function s_(s){return typeof s=="symbol"||n_(s)&&r_(s)==a_}var o_=s_,l_=$y,Fd=Ro,c_=o_,Od=0/0,h_=/^[-+]0x[0-9a-f]+$/i,u_=/^0b[01]+$/i,d_=/^0o[0-7]+$/i,p_=parseInt;function m_(s){if(typeof s=="number")return s;if(c_(s))return Od;if(Fd(s)){var u=typeof s.valueOf=="function"?s.valueOf():s;s=Fd(u)?u+"":u}if(typeof s!="string")return s===0?s:+s;s=l_(s);var g=u_.test(s);return g||d_.test(s)?p_(s.slice(2),g?2:8):h_.test(s)?Od:+s}var Xp=m_,f_=Ro,_h=Ly,Ud=Xp,g_="Expected a function",y_=Math.max,__=Math.min;function x_(s,u,g){var x,I,z,R,o,G,K=0,ge=!1,ae=!1,H=!0;if(typeof s!="function")throw new TypeError(g_);u=Ud(u)||0,f_(g)&&(ge=!!g.leading,ae="maxWait"in g,z=ae?y_(Ud(g.maxWait)||0,u):z,H="trailing"in g?!!g.trailing:H);function ke(Qe){var Dt=x,$t=I;return x=I=void 0,K=Qe,R=s.apply($t,Dt),R}function we(Qe){return K=Qe,o=setTimeout(je,u),ge?ke(Qe):R}function $e(Qe){var Dt=Qe-G,$t=Qe-K,Ui=u-Dt;return ae?__(Ui,z-$t):Ui}function Ve(Qe){var Dt=Qe-G,$t=Qe-K;return G===void 0||Dt>=u||Dt<0||ae&&$t>=z}function je(){var Qe=_h();if(Ve(Qe))return Ge(Qe);o=setTimeout(je,$e(Qe))}function Ge(Qe){return o=void 0,H&&x?ke(Qe):(x=I=void 0,R)}function We(){o!==void 0&&clearTimeout(o),K=0,x=G=I=o=void 0}function At(){return o===void 0?R:Ge(_h())}function gt(){var Qe=_h(),Dt=Ve(Qe);if(x=arguments,I=this,G=Qe,Dt){if(o===void 0)return we(G);if(ae)return clearTimeout(o),o=setTimeout(je,u),ke(G)}return o===void 0&&(o=setTimeout(je,u)),R}return gt.cancel=We,gt.flush=At,gt}var Yp=x_;function v_(){const s=window.matchMedia("(prefers-reduced-motion: reduce)");return s==null||s.matches}function Kp(s){return qn(this,void 0,void 0,function*(){return new Promise((u,g)=>{const x=new Image;x.crossOrigin="anonymous",x.onload=()=>{u(x)},x.onerror=g,x.src=s})})}function b_({north:s,south:u,east:g,west:x}){const I=Gn.exports.MercatorCoordinate.fromLngLat({lat:u,lon:g}),z=Gn.exports.MercatorCoordinate.fromLngLat({lat:s,lon:g}),R=Gn.exports.MercatorCoordinate.fromLngLat({lat:s,lon:x}),o=Gn.exports.MercatorCoordinate.fromLngLat({lat:u,lon:x});return new Float32Array([o.x,o.y,R.x,R.y,z.x,z.y,o.x,o.y,z.x,z.y,I.x,I.y])}function w_({map:s,withPixelRatio:u=!0}){const{width:g,height:x}=s.getCanvas();if(u)return{width:g,height:x};const I=s.getPixelRatio();return{width:Math.round(g/I),height:Math.round(x/I)}}function S_(s,u,g){const x=s.createProgram();if(x==null)throw new Error("Could not create program");const I=$d(s,s.VERTEX_SHADER,u),z=$d(s,s.FRAGMENT_SHADER,g);if(s.getShaderParameter(I,s.COMPILE_STATUS)||console.log(s.getShaderInfoLog(I)),s.getShaderParameter(z,s.COMPILE_STATUS)||console.log(s.getShaderInfoLog(z)),s.attachShader(x,I),s.attachShader(x,z),s.linkProgram(x),s.validateProgram(x),!s.getProgramParameter(x,s.LINK_STATUS))throw`Could not compile WebGL program. 

${s.getProgramInfoLog(x)}`;return x}function $d(s,u,g){const x=s.createShader(u);if(x==null)throw new Error("Could not create shader");return s.shaderSource(x,g),s.compileShader(x),x}function Jp({gl:s,size:u,flipY:g=!1,premultiplyAlpha:x=!1,wrapS:I="CLAMP_TO_EDGE",wrapT:z="CLAMP_TO_EDGE",filter:R="NEAREST"}){s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,g),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,x);const o=s.createTexture();if(o==null)throw new Error("Could not create texture");return s.bindTexture(s.TEXTURE_2D,o),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s[I]),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s[z]),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s[R]),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s[R]),u!=null&&s.texImage2D(s.TEXTURE_2D,0,s.RGBA,u.width,u.height,0,s.RGBA,s.UNSIGNED_BYTE,null),o}function T_({gl:s,texture:u,size:g}){s.bindTexture(s.TEXTURE_2D,u),s.texImage2D(s.TEXTURE_2D,0,s.RGBA,g.width,g.height,0,s.RGBA,s.UNSIGNED_BYTE,null)}function Qp({gl:s,source:u,flipY:g=!1,premultiplyAlpha:x=!1,wrapS:I="CLAMP_TO_EDGE",wrapT:z="CLAMP_TO_EDGE",filter:R="NEAREST"}){const o=Jp({gl:s,flipY:g,premultiplyAlpha:x,wrapS:I,wrapT:z,filter:R});return s.texImage2D(s.TEXTURE_2D,0,s.RGBA,s.RGBA,s.UNSIGNED_BYTE,u),o}function em({gl:s,texture:u,source:g,flipY:x=!1,premultiplyAlpha:I=!1}){s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,x),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,I),s.bindTexture(s.TEXTURE_2D,u),s.texImage2D(s.TEXTURE_2D,0,s.RGBA,s.RGBA,s.UNSIGNED_BYTE,g)}function I_(s,u){const g={},x=s.getProgramParameter(u,s.ACTIVE_ATTRIBUTES);for(let I=0;I<x;I++){const z=s.getActiveAttrib(u,I);if(z==null)continue;const R=s.getAttribLocation(u,z.name);g[z.name]=R}return g}function E_(s,u){const g={},x=s.getProgramParameter(u,s.ACTIVE_UNIFORMS);for(let I=0;I<x;I++){const z=s.getActiveUniform(u,I);if(z==null)continue;const R=s.getUniformLocation(u,z.name);R!=null&&(g[z.name]=R)}return g}function ko(s){const u=s.createBuffer();if(u==null)throw new Error("Unable to create buffer");return u}function A_({width:s,height:u,offsetX:g=0,offsetY:x=0,viewport:I}){const z=s/I.width*2,R=u/I.height*2,o=g/I.width*2,G=-x/I.height*2;return{topLeft:{x:-z/2+o,y:R/2+G},topRight:{x:z/2+o,y:R/2+G},bottomRight:{x:z/2+o,y:-R/2+G},bottomLeft:{x:-z/2+o,y:-R/2+G}}}function C_(s){s.useProgram(null),s.enable(s.BLEND),s.blendEquation(s.FUNC_ADD),s.blendFunc(s.ONE,s.ONE_MINUS_SRC_ALPHA),s.blendEquation(s.FUNC_ADD)}class tm{constructor(u,g,x){this.attributeLocations={},this.uniformLocations={},this.program=S_(u,g,x),u.useProgram(this.program),this.attributeLocations=I_(u,this.program),this.uniformLocations=E_(u,this.program),u.useProgram(null)}getAttribute(u){if(!(u in this.attributeLocations))throw new Error(`Attribute "${u}" not found`);return this.attributeLocations[u]}getUniform(u){if(!(u in this.uniformLocations))throw new Error(`Uniform "${u}" not found`);return this.uniformLocations[u]}}var M_=`#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif
uniform sampler2D uTexture;varying vec2 vTexCoords;void main(){gl_FragColor=texture2D(uTexture,vec2(vTexCoords.x,vTexCoords.y));}`,P_="uniform mat4 uMatrix;attribute vec2 aPosition;attribute vec2 aTexCoords;varying vec2 vTexCoords;void main(){gl_Position=uMatrix*vec4(aPosition,0.0,1.0);vTexCoords=aTexCoords;}";class z_ extends tm{constructor({gl:u}){super(u,P_,M_),this.vertexBuffer=ko(u),this.textureCoordinates=new Float32Array([0,0,0,1,1,1,0,0,1,1,1,0]),this.textureCoordinateBuffer=ko(u)}render({gl:u,matrix:g,mapSize:x,bounds:I,texture:z,premultiplied:R=!0}){u.useProgram(this.program),u.viewport(0,0,x.width,x.height),z.bind(),u.enable(u.BLEND),R?u.blendFunc(u.ONE,u.ONE_MINUS_SRC_ALPHA):u.blendFuncSeparate(u.SRC_ALPHA,u.ONE_MINUS_SRC_ALPHA,u.ONE,u.ONE_MINUS_SRC_ALPHA),u.uniform1i(this.getUniform("uTexture"),z.index),u.uniformMatrix4fv(u.getUniformLocation(this.program,"uMatrix"),!1,g),u.bindBuffer(u.ARRAY_BUFFER,this.vertexBuffer),u.bufferData(u.ARRAY_BUFFER,b_(I),u.STATIC_DRAW),u.vertexAttribPointer(this.getAttribute("aPosition"),2,u.FLOAT,!1,0,0),u.enableVertexAttribArray(this.getAttribute("aPosition")),u.bindBuffer(u.ARRAY_BUFFER,this.textureCoordinateBuffer),u.bufferData(u.ARRAY_BUFFER,this.textureCoordinates,u.STATIC_DRAW),u.vertexAttribPointer(this.getAttribute("aTexCoords"),2,u.FLOAT,!1,0,0),u.enableVertexAttribArray(this.getAttribute("aTexCoords")),u.drawArrays(u.TRIANGLES,0,6),C_(u)}}class k_{constructor(u){const{gl:g,textureIndex:x,flipY:I,premultiplyAlpha:z,wrapS:R,wrapT:o,filter:G}=u;if(this.gl=g,this.size="size"in u?u.size:{width:u.source.width,height:u.source.height},this.index=x,this.unit=g.TEXTURE0+x,"size"in u){const{size:K}=u;this.texture=Jp({gl:g,size:K,flipY:I,premultiplyAlpha:z,wrapS:R,wrapT:o,filter:G})}else{const{source:K}=u;this.texture=Qp({gl:this.gl,source:K,flipY:I,premultiplyAlpha:z,wrapS:R,wrapT:o,filter:G})}}setSize(u){this.size.width===u.width&&this.size.height===u.height||(this.size=u,T_({gl:this.gl,texture:this.texture,size:u}))}bind(){this.gl.activeTexture(this.unit),this.gl.bindTexture(this.gl.TEXTURE_2D,this.texture)}unbind(){this.gl.activeTexture(this.unit),this.gl.bindTexture(this.gl.TEXTURE_2D,null)}updateFromSource({source:u,flipY:g=!1,premultiplyAlpha:x=!1}){this.size={width:u.width,height:u.height},em({gl:this.gl,texture:this.texture,source:u,flipY:g,premultiplyAlpha:x})}}class im{constructor(){this.eventListeners=[]}addEventListener(u){this.eventListeners.push(u)}removeEventListener(u){this.eventListeners=this.eventListeners.filter(g=>g!==u)}dispatchEvent(u){for(const g of this.eventListeners)g(u)}}var Xt={Y:1,M:2,D:4,H:8,m:16,s:32,S:64},L_={Y:Xt.S|Xt.s|Xt.m|Xt.H|Xt.D|Xt.M,M:Xt.S|Xt.s|Xt.m|Xt.H|Xt.D,D:Xt.S|Xt.s|Xt.m|Xt.H,H:Xt.S|Xt.s|Xt.m,m:Xt.S|Xt.s,s:Xt.S},D_=/^(\d{2,4})-?(\d{1,2})?-?(\d{1,2})?T?(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?\.?(\d{3})?(?:Z|(([+-])(\d{2}):?(\d{2})))?$/,R_=/(Y{4}|Y{2}|M{1,4}|L{3,4}|D{1,2}|d{3}r|d{2}r|d{1,4}|c{3,4}|H{1,2}r?|m{1,2}|s{1,2}|S{1,3}|ZZ)/g,B_=/(\[[^\]]+\])/g,F_=/(\$\d\d?)/g,ql=0,rm=18,Fh={isTime:Nd,init:function(s){s===void 0&&(s={}),ql=s.dayStartsAt||0,rm=s.nightStartsAt||18},create:function(s){return s&&typeof s!="string"&&Nd(s)?s:new St(s)},now:function(){return this.create().utc()}},St=function(s){if(s&&typeof s!="string")return s;if(this._date="Invalid Date",this._locale=null,this._offset=0,this._offsetString="+00:00",this.isValid=!1,this.timeString="Invalid Date",s==null&&(s=function(){var ge=new Date,ae=-1*ge.getTimezoneOffset();return ge.setUTCMinutes(ge.getUTCMinutes()+ae),ge.toISOString().replace("Z",am(ae))}()),!(s.length>30)){var u=s.match(D_);if(u){var g=parseInt(u[1],10),x=u[2]==null?1:parseInt(u[2],10),I=u[3]==null?1:parseInt(u[3],10),z=u[4]==null?0:parseInt(u[4],10),R=u[5]==null?0:parseInt(u[5],10),o=u[6]==null?0:parseInt(u[6],10),G=u[7]==null?0:parseInt(u[7],10),K=u[8]==null?"":u[8];K&&K!="+00:00"&&(this._offset=(u[9]=="+"?1:-1)*(60*+u[10]+ +u[11]),this._offsetString=K),this._date=new Date(Date.UTC(g,x-1,I,z,R,o,G)),this.isValid=nm(this._date),this.timeString=this.toString()}}};function Ao(s){return s.isValid=nm(s._date),s.timeString=s.toString(),s}function ba(s){switch(s){case"year":case"years":case"Y":case"y":return"Y";case"month":case"months":case"M":return"M";case"day":case"days":case"date":case"dates":case"D":case"d":return"D";case"hour":case"hours":case"H":case"h":return"H";case"minute":case"minutes":case"m":return"m";case"second":case"seconds":case"s":return"s";case"millisecond":case"milliseconds":case"ms":case"S":return"S"}return s}function nm(s){return Object.prototype.toString.call(s)=="[object Date]"&&!isNaN(s.getTime())}function Nd(s){return s!=null&&s._manipulate!=null&&s._date!=null}function Sa(s,u){for(s=String(s),u=u||2;s.length<u;)s="0"+s;return s}function am(s){var u=String(Math.abs(s/60)).split(".");return(s<0?"-":"+")+Sa(u[0])+":"+Sa(u[1]?.6*parseInt(u[1],10):0)}St.prototype.offset=function(s){if(s==null)return this._offset;if(s==this._offset)return this;var u=this.utc()._manipulate(s,"minutes");return u._offset=s,u._offsetString=am(s),Ao(u),u},St.prototype.add=function(s,u){return this._manipulate(s,u)},St.prototype.subtract=function(s,u){return this._manipulate(-1*s,u)},St.prototype.diff=function(s,u,g){if(!this.isValid)return NaN;if(!s.isValid)return NaN;var x,I=0,z=this,R=s;if((u=ba(u))=="Y"||u=="M")I=z._monthDiff(R),u=="Y"&&(I/=12);else{u!="D"||g||(z=z.startOf("D"),R=R.startOf("D"));var o=z-R;switch(u){case"D":I=(o+6e4*(z._offset-R._offset))/864e5;break;case"H":I=o/36e5;break;case"m":I=o/6e4;break;case"s":I=o/1e3;break;default:I=o}}return g?I:(x=I)<0?Math.ceil(x):Math.floor(x)},St.prototype.startOf=function(s){if(this.isValid){s=ba(s);var u=L_[s],g=this.clone(),x=g._date;for(var I in Xt)if(u&Xt[I])switch(I){case"M":x.setUTCMonth(0);break;case"D":x.setUTCDate(1);break;case"H":s=="D"&&ql>x.getUTCHours()&&x.setUTCDate(x.getUTCDate()-1),x.setUTCHours(ql);break;case"m":x.setUTCMinutes(0);break;case"s":x.setUTCSeconds(0);break;case"S":x.setUTCMilliseconds(0)}return Ao(g)}return this},St.prototype.endOf=function(s){return(s=ba(s===void 0?"S":s))==="S"?this.clone():this.startOf(s).add(1,s).subtract(1,"S")},St.prototype.year=function(s){return s!=null?this._set(s,"setUTCFullYear"):this._date.getUTCFullYear()},St.prototype.month=function(s){return s!=null?this._set(s,"setUTCMonth"):this._date.getUTCMonth()},St.prototype.date=function(s){return s!=null?this._set(s,"setUTCDate"):this._date.getUTCDate()},St.prototype.day=function(s){var u=this._date.getUTCDay();return s!=null?this._set(this.date()+s-u,"setUTCDate"):u},St.prototype.hour=function(s){return s!=null?this._set(s,"setUTCHours"):this._date.getUTCHours()},St.prototype.minute=function(s){return s!=null?this._set(s,"setUTCMinutes"):this._date.getUTCMinutes()},St.prototype.second=function(s){return s!=null?this._set(s,"setUTCSeconds"):this._date.getUTCSeconds()},St.prototype.millisecond=function(s){return s!=null?this._set(s,"setUTCMilliseconds"):this._date.getUTCMilliseconds()},St.prototype.isSame=function(s,u){if(!this.isValid||!s.isValid)return!1;if(!(u=ba(u))||u=="S")return+this._date==+s._date;var g=this,x=s;switch(u=="D"&&(g=g.startOf(u),x=x.startOf(u)),u){case"Y":return g.year()==x.year();case"M":return g.year()==x.year()&&g.month()==x.month();case"D":return g.year()==x.year()&&g.month()==x.month()&&g.date()==x.date();case"H":return g.year()==x.year()&&g.month()==x.month()&&g.date()==x.date()&&g.hour()==x.hour();case"m":return g.year()==x.year()&&g.month()==x.month()&&g.date()==x.date()&&g.hour()==x.hour()&&g.minute()==x.minute();case"s":return g.year()==x.year()&&g.month()==x.month()&&g.date()==x.date()&&g.hour()==x.hour()&&g.minute()==x.minute()&&g.second()==x.second()}},St.prototype.isBefore=function(s,u){return!(!this.isValid||!s.isValid)&&((u=ba(u))=="S"?this:this.endOf(u)).valueOf()<s.valueOf()},St.prototype.isAfter=function(s,u){if(!this.isValid||!s.isValid)return!1;var g=(u=ba(u))=="S"?s:s.endOf(u);return this.valueOf()>g.valueOf()},St.prototype.locale=function(s){var u=this.clone();return u._locale=s,u},St.prototype.format=function(s,u){var g=this;if(!s)return this.timeString;if(s.length>100)return"";var x=u!=null?this._getRelativeDay(u):"",I=[],z=0;return s=(s=s.replace(B_,function(R){return I.push(R.slice(1,-1)),"$"+z++})).replace(R_,function(R){switch(R){case"YY":return String(g.year()).slice(-2);case"YYYY":return g.year();case"M":return g.month()+1;case"MM":return Sa(g.month()+1);case"MMM":return g._localeHasProperty("monthsShort")?g._locale.monthsShort[g.month()]:"[missing locale]";case"MMMM":return g._localeHasProperty("months")?g._locale.months[g.month()]:"[missing locale]";case"LLL":return g._localeHasProperty("monthsShortStandalone")?g._locale.monthsShortStandalone[g.month()]:g._localeHasProperty("monthsShort")?g._locale.monthsShort[g.month()]:"[missing locale]";case"LLLL":return g._localeHasProperty("monthsStandalone")?g._locale.monthsStandalone[g.month()]:g._localeHasProperty("months")?g._locale.months[g.month()]:"[missing locale]";case"D":return g.date();case"DD":return Sa(g.date());case"ddr":return x?g._localeHasProperty(x)?g._locale[x]:"[missing locale]":g._localeHasProperty("daysShort")?g._locale.daysShort[g.day()]:"[missing locale]";case"dddr":return x?g._localeHasProperty(x)?g._locale[x]:"[missing locale]":g._localeHasProperty("days")?g._locale.days[g.day()]:"[missing locale]";case"d":return g.day();case"ddd":return g._localeHasProperty("daysShort")?g._locale.daysShort[g.day()]:"[missing locale]";case"dddd":return g._localeHasProperty("days")?g._locale.days[g.day()]:"[missing locale]";case"ccc":return g._localeHasProperty("daysShortStandalone")?g._locale.daysShortStandalone[g.day()]:g._localeHasProperty("daysShort")?g._locale.daysShort[g.day()]:"[missing locale]";case"cccc":return g._localeHasProperty("daysStandalone")?g._locale.daysStandalone[g.day()]:g._localeHasProperty("days")?g._locale.days[g.day()]:"[missing locale]";case"Hr":var o=g._getTimeOfDay();return g._localeHasProperty("daySlots")?g._locale.daySlots[o]:"[missing locale]";case"H":return g.hour();case"HH":return Sa(g.hour());case"m":return g.minute();case"mm":return Sa(g.minute());case"s":return g.second();case"ss":return Sa(g.second());case"S":return Math.floor(g.millisecond()/100);case"SS":return Math.floor(g.millisecond()/10);case"SSS":return g.millisecond();case"ZZ":return g._offsetString;default:return""}}),I.length&&(s=s.replace(F_,function(R){return I[R.slice(1)]})),s},St.prototype.now=function(){var s=new St().offset(this._offset);return s._locale=this._locale,s},St.prototype.utc=function(){if(!this._offset)return this.clone();var s=this.subtract(this._offset,"minutes");return s._offset=0,s._offsetString="+00:00",Ao(s)},St.prototype.clone=function(){var s=new St(this.timeString);return s._locale=this._locale,s},St.prototype._set=function(s,u){var g=this.clone();return g._date[u](s),Ao(g)},St.prototype._getRelativeDay=function(s){if(s!=null&&s<2){var u=this.hour();return s==1?"tomorrow":u>=rm||u<ql?"tonight":"today"}return""},St.prototype._getTimeOfDay=function(){var s=this.hour();return s>=0&&s<6?"night":s>=6&&s<12?"morning":s>=12&&s<18?"afternoon":"evening"},St.prototype._localeHasProperty=function(s,u){return u?this._locale&&this._locale[s]&&this._locale[s][u]:this._locale&&this._locale[s]},St.prototype._manipulate=function(s,u){if(this.isValid){var g=this.clone(),x=g._date;switch(ba(u)){case"Y":x.setUTCFullYear(x.getUTCFullYear()+s);break;case"M":x.setUTCMonth(x.getUTCMonth()+s);break;case"D":case"d":x.setUTCDate(x.getUTCDate()+s);break;case"H":x.setUTCHours(x.getUTCHours()+s);break;case"m":x.setUTCMinutes(x.getUTCMinutes()+s);break;case"s":x.setUTCSeconds(x.getUTCSeconds()+s);break;case"S":x.setUTCMilliseconds(x.getUTCMilliseconds()+s)}return Ao(g)}return this},St.prototype._monthDiff=function(s){var u,g=12*(s._date.getUTCFullYear()-this._date.getUTCFullYear())+(s._date.getUTCMonth()-this._date.getUTCMonth()),x=this._manipulate(g,"M");if(s._date-x._date<0){var I=this._manipulate(g-1,"M");u=(s._date-x._date)/(x._date-I._date)}else{var z=this._manipulate(g+1,"M");u=(s._date-x._date)/(z._date-x._date)}return-(g+u)},St.prototype.toString=function(){return this.isValid?this._date.toISOString().replace("Z",this._offsetString):"Invalid Date"},St.prototype.toJSON=function(){return this.timeString},St.prototype.valueOf=function(){return this.isValid?+this._date-6e4*(this._offset||0):NaN};function O_(s){if(s.radar_precipitation_intensity_nordic==null)return{bounds:{north:0,east:0,south:0,west:0},nowIndex:-1,times:[]};const{geographicBoundingBox:u}=s.radar_precipitation_intensity_nordic,g={bounds:{north:u.northBoundLatitude,east:u.eastBoundLongitude,south:u.southBoundLatitude,west:u.westBoundLongitude},nowIndex:s.radar_precipitation_intensity_nordic.times.length-1,times:[]};for(const R of s.radar_precipitation_intensity_nordic.times)g.times.push({diffFromNow:0,modelTime:s.radar_precipitation_intensity_nordic.modelTime,time:R,type:"radar_precipitation_intensity_nordic"});if(s.radar_nowcast&&s.radar_nowcast.times.length>0){g.nowIndex=s.radar_precipitation_intensity_nordic.times.length;for(const R of s.radar_nowcast.times)g.times.push({diffFromNow:0,modelTime:s.radar_nowcast.modelTime,time:R,type:"radar_nowcast"})}if(g.times.length===0)return g;const x=Fh.create(g.times[g.nowIndex].time);for(const R of g.times)R.diffFromNow=Fh.create(R.time).diff(x,"minutes");let I=0;for(let R=0;R<g.times.length;R++)g.times[R].diffFromNow<=-90&&(I=R);let z=g.times.length-1;for(let R=g.times.length-1;R>=0;R--)g.times[R].diffFromNow>=90&&(z=R);return g.times=g.times.slice(I,z+1),g.nowIndex=g.nowIndex-I,g}function U_(s){const u=[];for(let g=0;g<s.times.length;g++){const x=s.times[g],I=x.type==="radar_precipitation_intensity_nordic"?"https://public-wms.met.no/verportal/verportal.map":"https://public-wms.met.no/verportal/radar_nowcast.map",z=Fh.create(x.time).utc().format("YYYY-MM-DDTHH:mm:ssZ"),R=x.modelTime,o=`${I}?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&FORMAT=image/png&TRANSPARENT=true&LAYERS=${x.type}&dim_modeltime=${R}&CRS=EPSG:3857&TIME=${z}&BBOX=-900055.9315651978,7008787.773578533,4533642.109212088,1.2146170895805646E7&WIDTH=1200&HEIGHT=1269`;u.push({index:g,url:o,time:x.time})}return u}class $_ extends im{constructor({id:u,map:g,apiData:x}){super(),this.type="custom",this.enabled=!0,this.isPlaying=!1,this.shouldRerender=!1,this.handleRequestAnimationFrame=R=>{this.currentFrameStartTime==null&&(this.currentFrameStartTime=R);const o=R-this.currentFrameStartTime;if(this.isPlaying===!0&&o>500){const G=this.getNextFrame();G.status==="loaded"&&(this.setCurrentFrameIndex(G.index),this.currentFrameStartTime=R)}this.shouldRerender&&(this.shouldRerender=!1,this.map.maplibregl.triggerRepaint()),this.requestAnimationFrameId=requestAnimationFrame(this.handleRequestAnimationFrame)},this.handleWebGLContextLost=()=>{},this.loadCurrentFrame=()=>qn(this,void 0,void 0,function*(){yield this.currentFrame.loadImage(),this.shouldRerender=!0}),this.loadNextMissingFrame=()=>qn(this,void 0,void 0,function*(){const R=this.getNextMissingFrame();R!=null&&(yield R.loadImage(),this.shouldRerender=!0,this.loadNextMissingFrame())}),this.loadCurrentFrameDebounced=Yp(this.loadCurrentFrame,100);const I=O_(x),z=U_(I);this.id=u,this.type="custom",this.map=g,this.bounds=I.bounds,this.frames=z.map(R=>new N_({index:R.index,url:R.url,time:R.time})),this.nowFrameIndex=I.nowIndex,this.currentFrame=this.frames[I.nowIndex]}setCurrentFrameIndex(u){this.currentFrame=this.frames[u],this.loadCurrentFrameDebounced(),this.dispatchEvent({type:"radar-layer:current-frame",index:this.currentFrame.index,time:this.currentFrame.time}),this.shouldRerender=!0}getNextFrame(){let u=this.currentFrame.index+1;return u>this.frames.length-1&&(u=0),this.frames[u]}getNextMissingFrame(){for(let u=0;u<this.frames.length;u++){const g=(this.currentFrame.index+u)%this.frames.length;if(this.frames[g].status==="idle")return this.frames[g]}}play(){this.isPlaying!==!0&&(this.isPlaying=!0,this.currentFrameStartTime=void 0,this.dispatchEvent({type:"radar-layer:is-playing",value:this.isPlaying}))}pause(){this.isPlaying!==!1&&(this.isPlaying=!1,this.dispatchEvent({type:"radar-layer:is-playing",value:this.isPlaying}))}getIsPlaying(){return this.isPlaying}getCurrentFrameIndex(){return this.currentFrame.index}getNowIndex(){return this.nowFrameIndex}getFrames(){return this.frames.map(u=>u.time)}onAdd(u,g){this.canvasProgram=new z_({gl:g}),this.map.maplibregl.on("webglcontextlost",this.handleWebGLContextLost),this.dispatchEvent({type:"radar-layer:frames",initialFrameIndex:this.nowFrameIndex,times:this.frames.map(x=>x.time)}),this.setCurrentFrameIndex(this.currentFrame.index),this.loadNextMissingFrame(),v_()===!1&&this.enabled===!0&&this.play(),this.setCurrentFrameIndex(this.nowFrameIndex),this.play(),this.requestAnimationFrameId=requestAnimationFrame(this.handleRequestAnimationFrame)}onRemove(){this.map.maplibregl.off("webglcontextlost",this.handleWebGLContextLost),this.requestAnimationFrameId!=null&&window.cancelAnimationFrame(this.requestAnimationFrameId)}prerender(u,g){this.enabled!==!1&&this.currentFrame.texture==null&&this.currentFrame.createTexture(u)}render(u,g){if(this.enabled===!1||this.canvasProgram==null||this.currentFrame.texture==null)return;const x=w_({map:this.map.maplibregl});this.canvasProgram.render({gl:u,matrix:g,mapSize:x,bounds:this.bounds,texture:this.currentFrame.texture})}}class N_{constructor({index:u,time:g,url:x}){this.status="idle",this.index=u,this.time=g,this.url=x}loadImage(){return qn(this,void 0,void 0,function*(){this.status==="idle"&&(this.status="loading",this.image=yield Kp(this.url),this.status="loaded")})}createTexture(u){this.image!=null&&this.texture==null&&(this.texture=new k_({gl:u,textureIndex:0,source:this.image,flipY:!0,premultiplyAlpha:!0}),this.image=void 0)}}var V_=Yp,G_=Ro,q_="Expected a function";function j_(s,u,g){var x=!0,I=!0;if(typeof s!="function")throw new TypeError(q_);return G_(g)&&(x="leading"in g?!!g.leading:x,I="trailing"in g?!!g.trailing:I),V_(s,u,{leading:x,maxWait:u,trailing:I})}var sm=j_;const xh=100,vh=100,om=-15,Kl=140,Jl=110,lm=-15;var Z_=Math.PI/180,W_=180/Math.PI;function cm(s){var u=Vd(s[0]+1,s[2]),g=Vd(s[0],s[2]),x=Gd(s[1]+1,s[2]),I=Gd(s[1],s[2]);return[g,x,u,I]}function H_(s){var u=cm(s),g={type:"Polygon",coordinates:[[[u[0],u[3]],[u[0],u[1]],[u[2],u[1]],[u[2],u[3]],[u[0],u[3]]]]};return g}function Vd(s,u){return s/Math.pow(2,u)*360-180}function Gd(s,u){var g=Math.PI-2*Math.PI*s/Math.pow(2,u);return W_*Math.atan(.5*(Math.exp(g)-Math.exp(-g)))}function Oh(s,u,g){var x=fm(s,u,g);return x[0]=Math.floor(x[0]),x[1]=Math.floor(x[1]),x}function hm(s){return[[s[0]*2,s[1]*2,s[2]+1],[s[0]*2+1,s[1]*2,s[2]+1],[s[0]*2+1,s[1]*2+1,s[2]+1],[s[0]*2,s[1]*2+1,s[2]+1]]}function um(s){return[s[0]>>1,s[1]>>1,s[2]-1]}function dm(s){return hm(um(s))}function X_(s,u){for(var g=dm(s),x=0;x<g.length;x++)if(!pm(u,g[x]))return!1;return!0}function pm(s,u){for(var g=0;g<s.length;g++)if(mm(s[g],u))return!0;return!1}function mm(s,u){return s[0]===u[0]&&s[1]===u[1]&&s[2]===u[2]}function Y_(s){for(var u="",g=s[2];g>0;g--){var x=0,I=1<<g-1;(s[0]&I)!==0&&x++,(s[1]&I)!==0&&(x+=2),u+=x.toString()}return u}function K_(s){for(var u=0,g=0,x=s.length,I=x;I>0;I--){var z=1<<I-1,R=+s[x-I];R===1&&(u|=z),R===2&&(g|=z),R===3&&(u|=z,g|=z)}return[u,g,x]}function J_(s){var u=Oh(s[0],s[1],32),g=Oh(s[2],s[3],32),x=[u[0],u[1],g[0],g[1]],I=Q_(x);if(I===0)return[0,0,0];var z=x[0]>>>32-I,R=x[1]>>>32-I;return[z,R,I]}function Q_(s){for(var u=28,g=0;g<u;g++){var x=1<<32-(g+1);if((s[0]&x)!==(s[2]&x)||(s[1]&x)!==(s[3]&x))return g}return u}function fm(s,u,g){var x=Math.sin(u*Z_),I=Math.pow(2,g),z=I*(s/360+.5),R=I*(.5-.25*Math.log((1+x)/(1-x))/Math.PI);return z=z%I,z<0&&(z=z+I),[z,R,g]}var gm={tileToGeoJSON:H_,tileToBBOX:cm,getChildren:hm,getParent:um,getSiblings:dm,hasTile:pm,hasSiblings:X_,tilesEqual:mm,tileToQuadkey:Y_,quadkeyToTile:K_,pointToTile:Oh,bboxToTile:J_,pointToTileFraction:fm};function ex(s,u,g){return s===s&&(g!==void 0&&(s=s<=g?s:g),u!==void 0&&(s=s>=u?s:u)),s}var tx=ex,ix=tx,bh=Xp;function rx(s,u,g){return g===void 0&&(g=u,u=void 0),g!==void 0&&(g=bh(g),g=g===g?g:0),u!==void 0&&(u=bh(u),u=u===u?u:0),ix(bh(s),u,g)}var nx=rx;function ax({map:s,tileZ:u}){u==null&&(u=sx({map:s}));const g=Math.pow(2,u),{width:x}=s.getCanvas(),I=s.getBounds(),z=I.getNorthWest(),R=I.getSouthEast(),o=qd({position:wh(z),tileZ:u}),G=qd({position:wh(R),tileZ:u}),K=ox({position:wh(z),tileZ:u}),ge=s.project({lat:0,lon:-180}),ae=s.project({lat:0,lon:180}),H=Math.ceil(ae.x-ge.x)/g,ke=x-H*(1-(K.x-o.x)),we=Math.ceil(ke/H)+1;let $e=o.x,Ve=G.x;const je=o.y,Ge=G.y,We=o.x,At=We+Math.min(g-1,we-1),gt=[];for(let Qe=je;Qe<=Ge;Qe++)for(let Dt=0;Dt<=Math.abs(At-We);Dt++){const $t=lx(We+Dt,u);$t<$e&&($e=$t),$t>Ve&&(Ve=$t),gt.push({x:$t,y:Qe,z:u})}return{tiles:gt,minX:$e,maxX:Ve,minY:je,maxY:Ge,size:{width:Ve-$e+1,height:Ge-je+1},mercatorBounds:cx({minX:$e,maxX:Ve+1,minY:je,maxY:Ge+1,tileZ:u})}}function sx({map:s}){return Math.floor(s.getZoom())}function qd({position:s,tileZ:u}){const[g,x,I]=gm.pointToTile(s.lon,ym(s.lat),u);return{x:g,y:x,z:I}}function ox({position:s,tileZ:u}){const[g,x,I]=gm.pointToTileFraction(s.lon,ym(s.lat),u);return{x:g,y:x,z:I}}function lx(s,u){const g=Math.pow(2,u);return(s%=g)<0&&(s+=g),s}function cx({minX:s,maxX:u,minY:g,maxY:x,tileZ:I}){const z=Math.pow(2,I);return{top:g/z,bottom:x/z,left:s/z,right:u/z}}function hx(s){const u=s.getBounds(),g=u.getWest(),x=u.getEast(),I=g<-180?Math.abs(g)-180:0,z=x>180?x-180:0,R=Math.ceil(I/180),o=Math.ceil(z/180),G=[];for(let K=0-R;K<=o;K++)G.push(K);return G}function ym(s){return nx(s,-85.0511,85.0511)}function wh(s){return{lon:s.lng,lat:s.lat}}var Pr={};/**
 * A collection of Number utility functions
 * https://github.com/yr/number-utils
 * @copyright Yr
 * @license MIT
 */Pr.TWO_PI=Math.PI*2;Pr.HALF_PI=Math.PI*.5;Pr.degreesToRadians=function(s){return s*Math.PI/180};Pr.radiansToDegrees=function(s){return 180*s/Math.PI};var ux=Pr.normalize=function(s,u,g){return u===g?1:(s-u)/(g-u)},dx=Pr.interpolate=function(s,u,g){return u+(g-u)*s},px=Pr.map=function(s,u,g,x,I){return dx(ux(s,u,g),x,I)};Pr.limit=function(s,u,g){return Math.min(Math.max(u,s),g)};Pr.rangedRandom=function(s,u){return px(Math.random(),0,1,s,u)};Pr.round=function(s,u){if(s%1==0)return s;var g=s<0;if(s=Math.abs(s),!u)return Math.round(s)*(g?-1:1);var x=s.toString().split("."),I=x[0]+x[1].substr(0,u),z=x[1].slice(u),R=Math.round(z/Math.pow(10,z.length)),o=Math.pow(10,u||0);return x[1].length>u&&(s=(+I+R)/o),s*(g?-1:1)};/**
 * Simple geographic distance calculator
 * https://github.com/yr/geodist
 * @copyright Yr
 * @license MIT
 */var $l=Pr,jd={feet:20908800,yards:6969600,miles:3960,mi:3960,kilometers:6371,km:6371,meters:6371e3,m:6371e3},Uh="meters",mx=function(u,g,x){x=x||{};var I=fx(x.unit),z=$l.degreesToRadians(g.lat-u.lat),R=Math.sin(z*.5),o=$l.degreesToRadians(g.lon-u.lon),G=Math.sin(o*.5),K=$l.degreesToRadians(u.lat),ge=$l.degreesToRadians(g.lat),ae=R*R+G*G*Math.cos(K)*Math.cos(ge),H=2*Math.atan2(Math.sqrt(ae),Math.sqrt(1-ae)),ke=I*H;return x.exact||(ke=Math.floor(ke)),x.limit?x.limit>ke:(x.format&&(ke=ke+" "+(x.unit||Uh)),ke)};function fx(s){return s=s||Uh,s=s.toLowerCase(),jd[s]||(s=Uh),jd[s]}var gx=mx;const yx=s=>s*Math.PI/180,_x=s=>180*s/Math.PI;function _m(s){return(s%=360)<0&&(s=360-Math.abs(s)),s}function xx(s){return _m(-1*s+90)}var Sh,Ql=(function(s,u){u.TWO_PI=2*Math.PI,u.HALF_PI=.5*Math.PI,u.degreesToRadians=function(z){return z*Math.PI/180},u.radiansToDegrees=function(z){return 180*z/Math.PI};var g=u.normalize=function(z,R,o){return R===o?1:(z-R)/(o-R)},x=u.interpolate=function(z,R,o){return R+(o-R)*z},I=u.map=function(z,R,o,G,K){return x(g(z,R,o),G,K)};u.limit=function(z,R,o){return Math.min(Math.max(R,z),o)},u.rangedRandom=function(z,R){return I(Math.random(),0,1,z,R)},u.round=function(z,R){if(z%1==0)return z;var o=z<0;if(z=Math.abs(z),!R)return Math.round(z)*(o?-1:1);var G=z.toString().split("."),K=G[0]+G[1].substr(0,R),ge=G[1].slice(R),ae=Math.round(ge/Math.pow(10,ge.length)),H=Math.pow(10,R||0);return G[1].length>R&&(z=(+K+ae)/H),z*(o?-1:1)}}(Sh={exports:{}},Sh.exports),Sh.exports);function Qh({value:s,decimal:u=!0,unit:g}){return g==="fahrenheit"&&(s=bx({value:s})),u===!0?Ql.round(s,1):Ql.round(s)}function vx({value:s,decimal:u=!0,unit:g}){const x=Qh({value:s,decimal:u,unit:g});return g==="fahrenheit"?x>32:x>0}function bx({value:s}){return 1.8*s+32}function wx({value:s}){if(s<0)throw"Value can not be negative";return 1.94384*s}function Sx({value:s}){if(s<0)throw"Value can not be negative";return 3.6*s}function Tx({value:s}){if(s<0)throw"Value can not be negative";return 2.236936*s}function Ix({value:s}){if(s<0)throw"Value can not be negative";const u=[.3,1.6,3.4,5.5,8,10.8,13.9,17.2,20.8,24.5,28.5,32.7];for(let g=0;g<=11;g++)if(s<u[g])return g;return 12}const Th=[{value:.3,type:"calm"},{value:1.5,type:"light air"},{value:3.4,type:"light breeze"},{value:5.4,type:"gentle breeze"},{value:7.9,type:"moderate breeze"},{value:10.7,type:"fresh breeze"},{value:13.8,type:"strong breeze"},{value:17.1,type:"moderate gale"},{value:20.7,type:"fresh gale"},{value:24.4,type:"strong gale"},{value:28.4,type:"storm"},{value:32.6,type:"violent storm"},{value:1e3,type:"hurricane"}];function xm({value:s,decimal:u=!0,unit:g}){if(s<0)throw"Value can not be negative";return g==="kmh"?s=Sx({value:s}):g==="mph"?s=Tx({value:s}):g==="knots"?s=wx({value:s}):g==="beaufort"&&(s=Ix({value:s})),u===!0?Ql.round(s,1):Ql.round(s)}function Ex(s){for(let u=0,g=Th.length;u<g;u++)if(s<=Th[u].value)return Th[u].type}const Co=[{value:0,text:"n"},{value:45,text:"ne"},{value:90,text:"e"},{value:135,text:"se"},{value:180,text:"s"},{value:225,text:"sw"},{value:270,text:"w"},{value:315,text:"nw"}];function Zd(s){s=_m(s);const u=Co.length,g=360/u/2;for(let x=1;x<u;x++)if(s>Co[x].value-g&&s<=Co[x].value+g)return Co[x].text;return Co[0].text}function Ax(s){return s!=null}var Cx=function(s){s("EPSG:4326","+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees"),s("EPSG:4269","+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees"),s("EPSG:3857","+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs"),s.WGS84=s["EPSG:4326"],s["EPSG:3785"]=s["EPSG:3857"],s.GOOGLE=s["EPSG:3857"],s["EPSG:900913"]=s["EPSG:3857"],s["EPSG:102113"]=s["EPSG:3857"]},Hi={};Hi.greenwich=0;Hi.lisbon=-9.131906111111;Hi.paris=2.337229166667;Hi.bogota=-74.080916666667;Hi.madrid=-3.687938888889;Hi.rome=12.452333333333;Hi.bern=7.439583333333;Hi.jakarta=106.807719444444;Hi.ferro=-17.666666666667;Hi.brussels=4.367975;Hi.stockholm=18.058277777778;Hi.athens=23.7163375;Hi.oslo=10.722916666667;var vm={};(function(s){s.ft={to_meter:.3048},s["us-ft"]={to_meter:1200/3937}})(vm);var Mr=.017453292519943295,Wd=Hi,Hd=vm,bm=function(s){var u={},g={};s.split("+").map(function(o){return o.trim()}).filter(function(o){return o}).forEach(function(o){var G=o.split("=");G.push(!0),g[G[0].toLowerCase()]=G[1]});var x,I,z,R={proj:"projName",datum:"datumCode",rf:function(o){u.rf=parseFloat(o)},lat_0:function(o){u.lat0=o*Mr},lat_1:function(o){u.lat1=o*Mr},lat_2:function(o){u.lat2=o*Mr},lat_ts:function(o){u.lat_ts=o*Mr},lon_0:function(o){u.long0=o*Mr},lon_1:function(o){u.long1=o*Mr},lon_2:function(o){u.long2=o*Mr},alpha:function(o){u.alpha=parseFloat(o)*Mr},lonc:function(o){u.longc=o*Mr},x_0:function(o){u.x0=parseFloat(o)},y_0:function(o){u.y0=parseFloat(o)},k_0:function(o){u.k0=parseFloat(o)},k:function(o){u.k0=parseFloat(o)},a:function(o){u.a=parseFloat(o)},b:function(o){u.b=parseFloat(o)},r_a:function(){u.R_A=!0},zone:function(o){u.zone=parseInt(o,10)},south:function(){u.utmSouth=!0},towgs84:function(o){u.datum_params=o.split(",").map(function(G){return parseFloat(G)})},to_meter:function(o){u.to_meter=parseFloat(o)},units:function(o){u.units=o,Hd[o]&&(u.to_meter=Hd[o].to_meter)},from_greenwich:function(o){u.from_greenwich=o*Mr},pm:function(o){u.from_greenwich=(Wd[o]?Wd[o]:parseFloat(o))*Mr},nadgrids:function(o){o==="@null"?u.datumCode="none":u.nadgrids=o},axis:function(o){var G="ewnsud";o.length===3&&G.indexOf(o.substr(0,1))!==-1&&G.indexOf(o.substr(1,1))!==-1&&G.indexOf(o.substr(2,1))!==-1&&(u.axis=o)}};for(x in g)I=g[x],x in R?(z=R[x],typeof z=="function"?z(I):u[z]=I):u[x]=I;return typeof u.datumCode=="string"&&u.datumCode!=="WGS84"&&(u.datumCode=u.datumCode.toLowerCase()),u},eu=function(s,u){s=s||{};var g,x;if(!u)return s;for(x in u)g=u[x],g!==void 0&&(s[x]=g);return s},Mx=.017453292519943295,wm=eu;function Xd(s,u,g){s[u]=g.map(function(x){var I={};return ec(x,I),I}).reduce(function(x,I){return wm(x,I)},{})}function ec(s,u){var g;if(Array.isArray(s))g=s.shift(),g==="PARAMETER"&&(g=s.shift()),s.length===1?Array.isArray(s[0])?(u[g]={},ec(s[0],u[g])):u[g]=s[0]:s.length?g==="TOWGS84"?u[g]=s:(u[g]={},["UNIT","PRIMEM","VERT_DATUM"].indexOf(g)>-1?(u[g]={name:s[0].toLowerCase(),convert:s[1]},s.length===3&&(u[g].auth=s[2])):g==="SPHEROID"?(u[g]={name:s[0],a:s[1],rf:s[2]},s.length===4&&(u[g].auth=s[3])):["GEOGCS","GEOCCS","DATUM","VERT_CS","COMPD_CS","LOCAL_CS","FITTED_CS","LOCAL_DATUM"].indexOf(g)>-1?(s[0]=["name",s[0]],Xd(u,g,s)):s.every(function(x){return Array.isArray(x)})?Xd(u,g,s):ec(s,u[g])):u[g]=!0;else{u[s]=!0;return}}function Px(s,u){var g=u[0],x=u[1];!(g in s)&&x in s&&(s[g]=s[x],u.length===3&&(s[g]=u[2](s[g])))}function _n(s){return s*Mx}function zx(s){s.type==="GEOGCS"?s.projName="longlat":s.type==="LOCAL_CS"?(s.projName="identity",s.local=!0):typeof s.PROJECTION=="object"?s.projName=Object.keys(s.PROJECTION)[0]:s.projName=s.PROJECTION,s.UNIT&&(s.units=s.UNIT.name.toLowerCase(),s.units==="metre"&&(s.units="meter"),s.UNIT.convert&&(s.type==="GEOGCS"?s.DATUM&&s.DATUM.SPHEROID&&(s.to_meter=parseFloat(s.UNIT.convert,10)*s.DATUM.SPHEROID.a):s.to_meter=parseFloat(s.UNIT.convert,10))),s.GEOGCS&&(s.GEOGCS.DATUM?s.datumCode=s.GEOGCS.DATUM.name.toLowerCase():s.datumCode=s.GEOGCS.name.toLowerCase(),s.datumCode.slice(0,2)==="d_"&&(s.datumCode=s.datumCode.slice(2)),(s.datumCode==="new_zealand_geodetic_datum_1949"||s.datumCode==="new_zealand_1949")&&(s.datumCode="nzgd49"),s.datumCode==="wgs_1984"&&(s.PROJECTION==="Mercator_Auxiliary_Sphere"&&(s.sphere=!0),s.datumCode="wgs84"),s.datumCode.slice(-6)==="_ferro"&&(s.datumCode=s.datumCode.slice(0,-6)),s.datumCode.slice(-8)==="_jakarta"&&(s.datumCode=s.datumCode.slice(0,-8)),~s.datumCode.indexOf("belge")&&(s.datumCode="rnb72"),s.GEOGCS.DATUM&&s.GEOGCS.DATUM.SPHEROID&&(s.ellps=s.GEOGCS.DATUM.SPHEROID.name.replace("_19","").replace(/[Cc]larke\_18/,"clrk"),s.ellps.toLowerCase().slice(0,13)==="international"&&(s.ellps="intl"),s.a=s.GEOGCS.DATUM.SPHEROID.a,s.rf=parseFloat(s.GEOGCS.DATUM.SPHEROID.rf,10)),~s.datumCode.indexOf("osgb_1936")&&(s.datumCode="osgb36")),s.b&&!isFinite(s.b)&&(s.b=s.a);function u(I){var z=s.to_meter||1;return parseFloat(I,10)*z}var g=function(I){return Px(s,I)},x=[["standard_parallel_1","Standard_Parallel_1"],["standard_parallel_2","Standard_Parallel_2"],["false_easting","False_Easting"],["false_northing","False_Northing"],["central_meridian","Central_Meridian"],["latitude_of_origin","Latitude_Of_Origin"],["latitude_of_origin","Central_Parallel"],["scale_factor","Scale_Factor"],["k0","scale_factor"],["latitude_of_center","Latitude_of_center"],["lat0","latitude_of_center",_n],["longitude_of_center","Longitude_Of_Center"],["longc","longitude_of_center",_n],["x0","false_easting",u],["y0","false_northing",u],["long0","central_meridian",_n],["lat0","latitude_of_origin",_n],["lat0","standard_parallel_1",_n],["lat1","standard_parallel_1",_n],["lat2","standard_parallel_2",_n],["alpha","azimuth",_n],["srsCode","name"]];x.forEach(g),!s.long0&&s.longc&&(s.projName==="Albers_Conic_Equal_Area"||s.projName==="Lambert_Azimuthal_Equal_Area")&&(s.long0=s.longc),!s.lat_ts&&s.lat1&&(s.projName==="Stereographic_South_Pole"||s.projName==="Polar Stereographic (variant B)")&&(s.lat0=_n(s.lat1>0?90:-90),s.lat_ts=s.lat1)}var Sm=function(s,u){var g=JSON.parse((","+s).replace(/\s*\,\s*([A-Z_0-9]+?)(\[)/g,',["$1",').slice(1).replace(/\s*\,\s*([A-Z_0-9]+?)\]/g,',"$1"]').replace(/,\["VERTCS".+/,"")),x=g.shift(),I=g.shift();g.unshift(["name",I]),g.unshift(["type",x]),g.unshift("output");var z={};return ec(g,z),zx(z.output),wm(u,z.output)},kx=Cx,Lx=bm,Dx=Sm;function fr(s){var u=this;if(arguments.length===2){var g=arguments[1];typeof g=="string"?g.charAt(0)==="+"?fr[s]=Lx(arguments[1]):fr[s]=Dx(arguments[1]):fr[s]=g}else if(arguments.length===1){if(Array.isArray(s))return s.map(function(x){Array.isArray(x)?fr.apply(u,x):fr(x)});if(typeof s=="string"){if(s in fr)return fr[s]}else"EPSG"in s?fr["EPSG:"+s.EPSG]=s:"ESRI"in s?fr["ESRI:"+s.ESRI]=s:"IAU2000"in s?fr["IAU2000:"+s.IAU2000]=s:console.log(s);return}}kx(fr);var Tm=fr,Im=Tm,Rx=Sm,Bx=bm;function Fx(s){return typeof s=="string"}function Ox(s){return s in Im}function Ux(s){var u=["GEOGCS","GEOCCS","PROJCS","LOCAL_CS"];return u.reduce(function(g,x){return g+1+s.indexOf(x)},0)}function $x(s){return s[0]==="+"}function Nx(s){if(Fx(s)){if(Ox(s))return Im[s];if(Ux(s))return Rx(s);if($x(s))return Bx(s)}else return s}var Vx=Nx,sc={},gs={},Gx=function(s,u,g){var x=s*u;return g/Math.sqrt(1-x*x)},qx=function(s){return s<0?-1:1},jx=Math.PI*2,Zx=3.14159265359,Wx=qx,Em=function(s){return Math.abs(s)<=Zx?s:s-Wx(s)*jx},Hx=Math.PI/2,Xx=function(s,u,g){var x=s*g,I=.5*s;return x=Math.pow((1-x)/(1+x),I),Math.tan(.5*(Hx-u))/x},Yd=Math.PI/2,Yx=function(s,u){for(var g=.5*s,x,I,z=Yd-2*Math.atan(u),R=0;R<=15;R++)if(x=s*Math.sin(z),I=Yd-2*Math.atan(u*Math.pow((1-x)/(1+x),g))-z,z+=I,Math.abs(I)<=1e-10)return z;return-9999},Kx=Gx,Am=Math.PI/2,Jx=1e-10,Nl=57.29577951308232,$h=Em,Qx=Math.PI/4,e0=Xx,t0=Yx;gs.init=function(){var s=this.b/this.a;this.es=1-s*s,"x0"in this||(this.x0=0),"y0"in this||(this.y0=0),this.e=Math.sqrt(this.es),this.lat_ts?this.sphere?this.k0=Math.cos(this.lat_ts):this.k0=Kx(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||(this.k?this.k0=this.k:this.k0=1)};gs.forward=function(s){var u=s.x,g=s.y;if(g*Nl>90&&g*Nl<-90&&u*Nl>180&&u*Nl<-180)return null;var x,I;if(Math.abs(Math.abs(g)-Am)<=Jx)return null;if(this.sphere)x=this.x0+this.a*this.k0*$h(u-this.long0),I=this.y0+this.a*this.k0*Math.log(Math.tan(Qx+.5*g));else{var z=Math.sin(g),R=e0(this.e,g,z);x=this.x0+this.a*this.k0*$h(u-this.long0),I=this.y0-this.a*this.k0*Math.log(R)}return s.x=x,s.y=I,s};gs.inverse=function(s){var u=s.x-this.x0,g=s.y-this.y0,x,I;if(this.sphere)I=Am-2*Math.atan(Math.exp(-g/(this.a*this.k0)));else{var z=Math.exp(-g/(this.a*this.k0));if(I=t0(this.e,z),I===-9999)return null}return x=$h(this.long0+u/(this.a*this.k0)),s.x=x,s.y=I,s};gs.names=["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","merc"];var Oo={};Oo.init=function(){};function Cm(s){return s}Oo.forward=Cm;Oo.inverse=Cm;Oo.names=["longlat","identity"];var i0=[gs,Oo],jl={},tc=[];function Mm(s,u){var g=tc.length;return s.names?(tc[g]=s,s.names.forEach(function(x){jl[x.toLowerCase()]=g}),this):(console.log(u),!0)}sc.add=Mm;sc.get=function(s){if(!s)return!1;var u=s.toLowerCase();if(typeof jl[u]<"u"&&tc[jl[u]])return tc[jl[u]]};sc.start=function(){i0.forEach(Mm)};var Si={};Si.wgs84={towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"};Si.ch1903={towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"};Si.ggrs87={towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"};Si.nad83={towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"};Si.nad27={nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"};Si.potsdam={towgs84:"606.0,23.0,413.0",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"};Si.carthage={towgs84:"-263.0,6.0,431.0",ellipse:"clark80",datumName:"Carthage 1934 Tunisia"};Si.hermannskogel={towgs84:"653.0,-212.0,449.0",ellipse:"bessel",datumName:"Hermannskogel"};Si.ire65={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"};Si.rassadiran={towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"};Si.nzgd49={towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"};Si.osgb36={towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Airy 1830"};Si.s_jtsk={towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"};Si.beduaram={towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"};Si.gunung_segara={towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"};Si.rnb72={towgs84:"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",ellipse:"intl",datumName:"Reseau National Belge 1972"};var ot={};ot.MERIT={a:6378137,rf:298.257,ellipseName:"MERIT 1983"};ot.SGS85={a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"};ot.GRS80={a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"};ot.IAU76={a:6378140,rf:298.257,ellipseName:"IAU 1976"};ot.airy={a:6377563396e-3,b:635625691e-2,ellipseName:"Airy 1830"};ot.APL4={a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"};ot.NWL9D={a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"};ot.mod_airy={a:6377340189e-3,b:6356034446e-3,ellipseName:"Modified Airy"};ot.andrae={a:637710443e-2,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"};ot.aust_SA={a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"};ot.GRS67={a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"};ot.bessel={a:6377397155e-3,rf:299.1528128,ellipseName:"Bessel 1841"};ot.bess_nam={a:6377483865e-3,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"};ot.clrk66={a:63782064e-1,b:63565838e-1,ellipseName:"Clarke 1866"};ot.clrk80={a:6378249145e-3,rf:293.4663,ellipseName:"Clarke 1880 mod."};ot.clrk58={a:6378293645208759e-9,rf:294.2606763692654,ellipseName:"Clarke 1858"};ot.CPM={a:63757387e-1,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"};ot.delmbr={a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"};ot.engelis={a:637813605e-2,rf:298.2566,ellipseName:"Engelis 1985"};ot.evrst30={a:6377276345e-3,rf:300.8017,ellipseName:"Everest 1830"};ot.evrst48={a:6377304063e-3,rf:300.8017,ellipseName:"Everest 1948"};ot.evrst56={a:6377301243e-3,rf:300.8017,ellipseName:"Everest 1956"};ot.evrst69={a:6377295664e-3,rf:300.8017,ellipseName:"Everest 1969"};ot.evrstSS={a:6377298556e-3,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"};ot.fschr60={a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"};ot.fschr60m={a:6378155,rf:298.3,ellipseName:"Fischer 1960"};ot.fschr68={a:6378150,rf:298.3,ellipseName:"Fischer 1968"};ot.helmert={a:6378200,rf:298.3,ellipseName:"Helmert 1906"};ot.hough={a:6378270,rf:297,ellipseName:"Hough"};ot.intl={a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"};ot.kaula={a:6378163,rf:298.24,ellipseName:"Kaula 1961"};ot.lerch={a:6378139,rf:298.257,ellipseName:"Lerch 1979"};ot.mprts={a:6397300,rf:191,ellipseName:"Maupertius 1738"};ot.new_intl={a:63781575e-1,b:63567722e-1,ellipseName:"New International 1967"};ot.plessis={a:6376523,rf:6355863,ellipseName:"Plessis 1817 (France)"};ot.krass={a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"};ot.SEasia={a:6378155,b:63567733205e-4,ellipseName:"Southeast Asia"};ot.walbeck={a:6376896,b:63558348467e-4,ellipseName:"Walbeck"};ot.WGS60={a:6378165,rf:298.3,ellipseName:"WGS 60"};ot.WGS66={a:6378145,rf:298.25,ellipseName:"WGS 66"};ot.WGS7={a:6378135,rf:298.26,ellipseName:"WGS 72"};ot.WGS84={a:6378137,rf:298.257223563,ellipseName:"WGS 84"};ot.sphere={a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"};var Zi=Math.PI/2,Zl=1,Wl=2,ic=3,r0=4,n0=5,Ih=484813681109536e-20,a0=1.0026,Kd=.3826834323650898,rc=function(s){if(!(this instanceof rc))return new rc(s);this.datum_type=r0,s&&(s.datumCode&&s.datumCode==="none"&&(this.datum_type=n0),s.datum_params&&(this.datum_params=s.datum_params.map(parseFloat),(this.datum_params[0]!==0||this.datum_params[1]!==0||this.datum_params[2]!==0)&&(this.datum_type=Zl),this.datum_params.length>3&&(this.datum_params[3]!==0||this.datum_params[4]!==0||this.datum_params[5]!==0||this.datum_params[6]!==0)&&(this.datum_type=Wl,this.datum_params[3]*=Ih,this.datum_params[4]*=Ih,this.datum_params[5]*=Ih,this.datum_params[6]=this.datum_params[6]/1e6+1)),this.datum_type=s.grids?ic:this.datum_type,this.a=s.a,this.b=s.b,this.es=s.es,this.ep2=s.ep2,this.datum_type===ic&&(this.grids=s.grids))};rc.prototype={compare_datums:function(s){return this.datum_type!==s.datum_type||this.a!==s.a||Math.abs(this.es-s.es)>5e-11?!1:this.datum_type===Zl?this.datum_params[0]===s.datum_params[0]&&this.datum_params[1]===s.datum_params[1]&&this.datum_params[2]===s.datum_params[2]:this.datum_type===Wl?this.datum_params[0]===s.datum_params[0]&&this.datum_params[1]===s.datum_params[1]&&this.datum_params[2]===s.datum_params[2]&&this.datum_params[3]===s.datum_params[3]&&this.datum_params[4]===s.datum_params[4]&&this.datum_params[5]===s.datum_params[5]&&this.datum_params[6]===s.datum_params[6]:this.datum_type===ic||s.datum_type===ic?this.nadgrids===s.nadgrids:!0},geodetic_to_geocentric:function(s){var u=s.x,g=s.y,x=s.z?s.z:0,I,z,R,o=0,G,K,ge,ae;if(g<-Zi&&g>-1.001*Zi)g=-Zi;else if(g>Zi&&g<1.001*Zi)g=Zi;else if(g<-Zi||g>Zi)return null;return u>Math.PI&&(u-=2*Math.PI),K=Math.sin(g),ae=Math.cos(g),ge=K*K,G=this.a/Math.sqrt(1-this.es*ge),I=(G+x)*ae*Math.cos(u),z=(G+x)*ae*Math.sin(u),R=(G*(1-this.es)+x)*K,s.x=I,s.y=z,s.z=R,o},geocentric_to_geodetic:function(s){var u=1e-12,g=u*u,x=30,I,z,R,o,G,K,ge,ae,H,ke,we,$e,Ve,je=s.x,Ge=s.y,We=s.z?s.z:0,At,gt,Qe;if(I=Math.sqrt(je*je+Ge*Ge),z=Math.sqrt(je*je+Ge*Ge+We*We),I/this.a<u){if(At=0,z/this.a<u){gt=Zi,Qe=-this.b;return}}else At=Math.atan2(Ge,je);R=We/z,o=I/z,G=1/Math.sqrt(1-this.es*(2-this.es)*o*o),ae=o*(1-this.es)*G,H=R*G,Ve=0;do Ve++,ge=this.a/Math.sqrt(1-this.es*H*H),Qe=I*ae+We*H-ge*(1-this.es*H*H),K=this.es*ge/(ge+Qe),G=1/Math.sqrt(1-K*(2-K)*o*o),ke=o*(1-K)*G,we=R*G,$e=we*ae-ke*H,ae=ke,H=we;while($e*$e>g&&Ve<x);return gt=Math.atan(we/Math.abs(ke)),s.x=At,s.y=gt,s.z=Qe,s},geocentric_to_geodetic_noniter:function(s){var u=s.x,g=s.y,x=s.z?s.z:0,I,z,R,o,G,K,ge,ae,H,ke,we,$e,Ve,je,Ge,We,At;if(u=parseFloat(u),g=parseFloat(g),x=parseFloat(x),At=!1,u!==0)I=Math.atan2(g,u);else if(g>0)I=Zi;else if(g<0)I=-Zi;else if(At=!0,I=0,x>0)z=Zi;else if(x<0)z=-Zi;else{z=Zi,R=-this.b;return}return G=u*u+g*g,o=Math.sqrt(G),K=x*a0,ae=Math.sqrt(K*K+G),ke=K/ae,$e=o/ae,we=ke*ke*ke,ge=x+this.b*this.ep2*we,We=o-this.a*this.es*$e*$e*$e,H=Math.sqrt(ge*ge+We*We),Ve=ge/H,je=We/H,Ge=this.a/Math.sqrt(1-this.es*Ve*Ve),je>=Kd?R=o/je-Ge:je<=-Kd?R=o/-je-Ge:R=x/Ve+Ge*(this.es-1),At===!1&&(z=Math.atan(Ve/je)),s.x=I,s.y=z,s.z=R,s},geocentric_to_wgs84:function(s){if(this.datum_type===Zl)s.x+=this.datum_params[0],s.y+=this.datum_params[1],s.z+=this.datum_params[2];else if(this.datum_type===Wl){var u=this.datum_params[0],g=this.datum_params[1],x=this.datum_params[2],I=this.datum_params[3],z=this.datum_params[4],R=this.datum_params[5],o=this.datum_params[6],G=o*(s.x-R*s.y+z*s.z)+u,K=o*(R*s.x+s.y-I*s.z)+g,ge=o*(-z*s.x+I*s.y+s.z)+x;s.x=G,s.y=K,s.z=ge}},geocentric_from_wgs84:function(s){if(this.datum_type===Zl)s.x-=this.datum_params[0],s.y-=this.datum_params[1],s.z-=this.datum_params[2];else if(this.datum_type===Wl){var u=this.datum_params[0],g=this.datum_params[1],x=this.datum_params[2],I=this.datum_params[3],z=this.datum_params[4],R=this.datum_params[5],o=this.datum_params[6],G=(s.x-u)/o,K=(s.y-g)/o,ge=(s.z-x)/o;s.x=G+R*K-z*ge,s.y=-R*G+K+I*ge,s.z=z*G-I*K+ge}}};var s0=rc,o0=Si,Eh=ot,l0=eu,c0=s0,h0=1e-10,u0=.16666666666666666,d0=.04722222222222222,p0=.022156084656084655,m0=function(s){if(s.datumCode&&s.datumCode!=="none"){var u=o0[s.datumCode];u&&(s.datum_params=u.towgs84?u.towgs84.split(","):null,s.ellps=u.ellipse,s.datumName=u.datumName?u.datumName:s.datumCode)}if(!s.a){var g=Eh[s.ellps]?Eh[s.ellps]:Eh.WGS84;l0(s,g)}return s.rf&&!s.b&&(s.b=(1-1/s.rf)*s.a),(s.rf===0||Math.abs(s.a-s.b)<h0)&&(s.sphere=!0,s.b=s.a),s.a2=s.a*s.a,s.b2=s.b*s.b,s.es=(s.a2-s.b2)/s.a2,s.e=Math.sqrt(s.es),s.R_A&&(s.a*=1-s.es*(u0+s.es*(d0+s.es*p0)),s.a2=s.a*s.a,s.b2=s.b*s.b,s.es=0),s.ep2=(s.a2-s.b2)/s.b2,s.k0||(s.k0=1),s.axis||(s.axis="enu"),s.datum||(s.datum=c0(s)),s},f0=Vx,Jd=eu,g0=sc,y0=m0;function ms(s,u){if(!(this instanceof ms))return new ms(s);u=u||function(z){if(z)throw z};var g=f0(s);if(typeof g!="object"){u(s);return}var x=y0(g),I=ms.projections.get(x.projName);I?(Jd(this,x),Jd(this,I),this.init(),u(null,this)):u(s)}ms.projections=g0;ms.projections.start();var tu=ms,Qd=1,ep=2,Ah=3,tp=5,ip=6378137,rp=.006694379990141316,_0=function(s,u,g){var x,I,z;function R(H){return H===Qd||H===ep}if(s.compare_datums(u)||s.datum_type===tp||u.datum_type===tp)return g;var o=s.a,G=s.es,K=u.a,ge=u.es,ae=s.datum_type;if(ae===Ah)if(this.apply_gridshift(s,0,g)===0)s.a=ip,s.es=rp;else{if(!s.datum_params)return s.a=o,s.es=s.es,g;for(x=1,I=0,z=s.datum_params.length;I<z;I++)x*=s.datum_params[I];if(x===0)return s.a=o,s.es=s.es,g;s.datum_params.length>3?ae=ep:ae=Qd}return u.datum_type===Ah&&(u.a=ip,u.es=rp),(s.es!==u.es||s.a!==u.a||R(ae)||R(u.datum_type))&&(s.geodetic_to_geocentric(g),R(s.datum_type)&&s.geocentric_to_wgs84(g),R(u.datum_type)&&u.geocentric_from_wgs84(g),u.geocentric_to_geodetic(g)),u.datum_type===Ah&&this.apply_gridshift(u,1,g),s.a=o,s.es=G,u.a=K,u.es=ge,g},x0=function(s,u,g){var x=g.x,I=g.y,z=g.z||0,R,o,G;for(G=0;G<3;G++)if(!(u&&G===2&&g.z===void 0))switch(G===0?(R=x,o="x"):G===1?(R=I,o="y"):(R=z,o="z"),s.axis[G]){case"e":g[o]=R;break;case"w":g[o]=-R;break;case"n":g[o]=R;break;case"s":g[o]=-R;break;case"u":g[o]!==void 0&&(g.z=R);break;case"d":g[o]!==void 0&&(g.z=-R);break;default:return null}return g},Pm=function(s){var u={x:s[0],y:s[1]};return s.length>2&&(u.z=s[2]),s.length>3&&(u.m=s[3]),u},np=.017453292519943295,ap=57.29577951308232,v0=1,b0=2,w0=_0,sp=x0,S0=tu,T0=Pm,zm=function s(u,g,x){var I;Array.isArray(x)&&(x=T0(x));function z(R,o){return(R.datum.datum_type===v0||R.datum.datum_type===b0)&&o.datumCode!=="WGS84"}return u.datum&&g.datum&&(z(u,g)||z(g,u))&&(I=new S0("WGS84"),s(u,I,x),u=I),u.axis!=="enu"&&sp(u,!1,x),u.projName==="longlat"?(x.x*=np,x.y*=np):(u.to_meter&&(x.x*=u.to_meter,x.y*=u.to_meter),u.inverse(x)),u.from_greenwich&&(x.x+=u.from_greenwich),x=w0(u.datum,g.datum,x),g.from_greenwich&&(x.x-=g.from_greenwich),g.projName==="longlat"?(x.x*=ap,x.y*=ap):(g.forward(x),g.to_meter&&(x.x/=g.to_meter,x.y/=g.to_meter)),g.axis!=="enu"&&sp(g,!0,x),x},Nh=tu,op=zm,lp=Nh("WGS84");function Ch(s,u,g){var x;return Array.isArray(g)?(x=op(s,u,g),g.length===3?[x.x,x.y,x.z]:[x.x,x.y]):op(s,u,g)}function cp(s){return s instanceof Nh?s:s.oProj?s.oProj:Nh(s)}function I0(s,u,g){s=cp(s);var x=!1,I;return typeof u>"u"?(u=s,s=lp,x=!0):(typeof u.x<"u"||Array.isArray(u))&&(g=u,u=s,s=lp,x=!0),u=cp(u),g?Ch(s,u,g):(I={forward:function(z){return Ch(s,u,z)},inverse:function(z){return Ch(u,s,z)}},x&&(I.oProj=u),I)}var E0=I0,Uo={},hp=6,km="AJSAJS",Lm="AFAFAF",ps=65,Wi=73,gr=79,Po=86,zo=90;Uo.forward=function(s,u){return u=u||5,M0(A0({lat:s[1],lon:s[0]}),u)};Uo.inverse=function(s){var u=iu(Rm(s.toUpperCase()));return u.lat&&u.lon?[u.lon,u.lat,u.lon,u.lat]:[u.left,u.bottom,u.right,u.top]};Uo.toPoint=function(s){var u=iu(Rm(s.toUpperCase()));return u.lat&&u.lon?[u.lon,u.lat]:[(u.left+u.right)/2,(u.top+u.bottom)/2]};function Mh(s){return s*(Math.PI/180)}function up(s){return 180*(s/Math.PI)}function A0(s){var u=s.lat,g=s.lon,x=6378137,I=.00669438,z=.9996,R,o,G,K,ge,ae,H,ke=Mh(u),we=Mh(g),$e,Ve;Ve=Math.floor((g+180)/6)+1,g===180&&(Ve=60),u>=56&&u<64&&g>=3&&g<12&&(Ve=32),u>=72&&u<84&&(g>=0&&g<9?Ve=31:g>=9&&g<21?Ve=33:g>=21&&g<33?Ve=35:g>=33&&g<42&&(Ve=37)),R=(Ve-1)*6-180+3,$e=Mh(R),o=I/(1-I),G=x/Math.sqrt(1-I*Math.sin(ke)*Math.sin(ke)),K=Math.tan(ke)*Math.tan(ke),ge=o*Math.cos(ke)*Math.cos(ke),ae=Math.cos(ke)*(we-$e),H=x*((1-I/4-3*I*I/64-5*I*I*I/256)*ke-(3*I/8+3*I*I/32+45*I*I*I/1024)*Math.sin(2*ke)+(15*I*I/256+45*I*I*I/1024)*Math.sin(4*ke)-35*I*I*I/3072*Math.sin(6*ke));var je=z*G*(ae+(1-K+ge)*ae*ae*ae/6+(5-18*K+K*K+72*ge-58*o)*ae*ae*ae*ae*ae/120)+5e5,Ge=z*(H+G*Math.tan(ke)*(ae*ae/2+(5-K+9*ge+4*ge*ge)*ae*ae*ae*ae/24+(61-58*K+K*K+600*ge-330*o)*ae*ae*ae*ae*ae*ae/720));return u<0&&(Ge+=1e7),{northing:Math.round(Ge),easting:Math.round(je),zoneNumber:Ve,zoneLetter:C0(u)}}function iu(s){var u=s.northing,g=s.easting,x=s.zoneLetter,I=s.zoneNumber;if(I<0||I>60)return null;var z=.9996,R=6378137,o=.00669438,G,K=(1-Math.sqrt(1-o))/(1+Math.sqrt(1-o)),ge,ae,H,ke,we,$e,Ve,je,Ge,We=g-5e5,At=u;x<"N"&&(At-=1e7),Ve=(I-1)*6-180+3,G=o/(1-o),$e=At/z,je=$e/(R*(1-o/4-3*o*o/64-5*o*o*o/256)),Ge=je+(3*K/2-27*K*K*K/32)*Math.sin(2*je)+(21*K*K/16-55*K*K*K*K/32)*Math.sin(4*je)+151*K*K*K/96*Math.sin(6*je),ge=R/Math.sqrt(1-o*Math.sin(Ge)*Math.sin(Ge)),ae=Math.tan(Ge)*Math.tan(Ge),H=G*Math.cos(Ge)*Math.cos(Ge),ke=R*(1-o)/Math.pow(1-o*Math.sin(Ge)*Math.sin(Ge),1.5),we=We/(ge*z);var gt=Ge-ge*Math.tan(Ge)/ke*(we*we/2-(5+3*ae+10*H-4*H*H-9*G)*we*we*we*we/24+(61+90*ae+298*H+45*ae*ae-252*G-3*H*H)*we*we*we*we*we*we/720);gt=up(gt);var Qe=(we-(1+2*ae+H)*we*we*we/6+(5-2*H+28*ae-3*H*H+8*G+24*ae*ae)*we*we*we*we*we/120)/Math.cos(Ge);Qe=Ve+up(Qe);var Dt;if(s.accuracy){var $t=iu({northing:s.northing+s.accuracy,easting:s.easting+s.accuracy,zoneLetter:s.zoneLetter,zoneNumber:s.zoneNumber});Dt={top:$t.lat,right:$t.lon,bottom:gt,left:Qe}}else Dt={lat:gt,lon:Qe};return Dt}function C0(s){var u="Z";return 84>=s&&s>=72?u="X":72>s&&s>=64?u="W":64>s&&s>=56?u="V":56>s&&s>=48?u="U":48>s&&s>=40?u="T":40>s&&s>=32?u="S":32>s&&s>=24?u="R":24>s&&s>=16?u="Q":16>s&&s>=8?u="P":8>s&&s>=0?u="N":0>s&&s>=-8?u="M":-8>s&&s>=-16?u="L":-16>s&&s>=-24?u="K":-24>s&&s>=-32?u="J":-32>s&&s>=-40?u="H":-40>s&&s>=-48?u="G":-48>s&&s>=-56?u="F":-56>s&&s>=-64?u="E":-64>s&&s>=-72?u="D":-72>s&&s>=-80&&(u="C"),u}function M0(s,u){var g="00000"+s.easting,x="00000"+s.northing;return s.zoneNumber+s.zoneLetter+P0(s.easting,s.northing,s.zoneNumber)+g.substr(g.length-5,u)+x.substr(x.length-5,u)}function P0(s,u,g){var x=Dm(g),I=Math.floor(s/1e5),z=Math.floor(u/1e5)%20;return z0(I,z,x)}function Dm(s){var u=s%hp;return u===0&&(u=hp),u}function z0(s,u,g){var x=g-1,I=km.charCodeAt(x),z=Lm.charCodeAt(x),R=I+s-1,o=z+u,G=!1;R>zo&&(R=R-zo+ps-1,G=!0),(R===Wi||I<Wi&&R>Wi||(R>Wi||I<Wi)&&G)&&R++,(R===gr||I<gr&&R>gr||(R>gr||I<gr)&&G)&&(R++,R===Wi&&R++),R>zo&&(R=R-zo+ps-1),o>Po?(o=o-Po+ps-1,G=!0):G=!1,(o===Wi||z<Wi&&o>Wi||(o>Wi||z<Wi)&&G)&&o++,(o===gr||z<gr&&o>gr||(o>gr||z<gr)&&G)&&(o++,o===Wi&&o++),o>Po&&(o=o-Po+ps-1);var K=String.fromCharCode(R)+String.fromCharCode(o);return K}function Rm(s){if(s&&s.length===0)throw"MGRSPoint coverting from nothing";for(var u=s.length,g=null,x="",I,z=0;!/[A-Z]/.test(I=s.charAt(z));){if(z>=2)throw"MGRSPoint bad conversion from: "+s;x+=I,z++}var R=parseInt(x,10);if(z===0||z+3>u)throw"MGRSPoint bad conversion from: "+s;var o=s.charAt(z++);if(o<="A"||o==="B"||o==="Y"||o>="Z"||o==="I"||o==="O")throw"MGRSPoint zone letter "+o+" not handled: "+s;g=s.substring(z,z+=2);for(var G=Dm(R),K=k0(g.charAt(0),G),ge=L0(g.charAt(1),G);ge<D0(o);)ge+=2e6;var ae=u-z;if(ae%2!==0)throw`MGRSPoint has to have an even number 
of digits after the zone letter and two 100km letters - front 
half for easting meters, second half for 
northing meters`+s;var H=ae/2,ke=0,we=0,$e,Ve,je,Ge,We;return H>0&&($e=1e5/Math.pow(10,H),Ve=s.substring(z,z+H),ke=parseFloat(Ve)*$e,je=s.substring(z+H),we=parseFloat(je)*$e),Ge=ke+K,We=we+ge,{easting:Ge,northing:We,zoneLetter:o,zoneNumber:R,accuracy:$e}}function k0(s,u){for(var g=km.charCodeAt(u-1),x=1e5,I=!1;g!==s.charCodeAt(0);){if(g++,g===Wi&&g++,g===gr&&g++,g>zo){if(I)throw"Bad character: "+s;g=ps,I=!0}x+=1e5}return x}function L0(s,u){if(s>"V")throw"MGRSPoint given invalid Northing "+s;for(var g=Lm.charCodeAt(u-1),x=0,I=!1;g!==s.charCodeAt(0);){if(g++,g===Wi&&g++,g===gr&&g++,g>Po){if(I)throw"Bad character: "+s;g=ps,I=!0}x+=1e5}return x}function D0(s){var u;switch(s){case"C":u=11e5;break;case"D":u=2e6;break;case"E":u=28e5;break;case"F":u=37e5;break;case"G":u=46e5;break;case"H":u=55e5;break;case"J":u=64e5;break;case"K":u=73e5;break;case"L":u=82e5;break;case"M":u=91e5;break;case"N":u=0;break;case"P":u=8e5;break;case"Q":u=17e5;break;case"R":u=26e5;break;case"S":u=35e5;break;case"T":u=44e5;break;case"U":u=53e5;break;case"V":u=62e5;break;case"W":u=7e6;break;case"X":u=79e5;break;default:u=-1}if(u>=0)return u;throw"Invalid zone letter: "+s}var Bm=Uo;function fs(s,u,g){if(!(this instanceof fs))return new fs(s,u,g);if(Array.isArray(s))this.x=s[0],this.y=s[1],this.z=s[2]||0;else if(typeof s=="object")this.x=s.x,this.y=s.y,this.z=s.z||0;else if(typeof s=="string"&&typeof u>"u"){var x=s.split(",");this.x=parseFloat(x[0],10),this.y=parseFloat(x[1],10),this.z=parseFloat(x[2],10)||0}else this.x=s,this.y=u,this.z=g||0;console.warn("proj4.Point will be removed in version 3, use proj4.toPoint")}fs.fromMGRS=function(s){return new fs(Bm.toPoint(s))};fs.prototype.toMGRS=function(s){return Bm.forward([this.x,this.y],s)};var R0=fs,Ti={},B0=function(s,u){var g;return s>1e-7?(g=s*u,(1-s*s)*(u/(1-g*g)-.5/s*Math.log((1-g)/(1+g)))):2*u},Lo=Math.PI/2,F0=Math.PI/4,jn=1e-10,Vh=B0,Fm=Em;Ti.S_POLE=1;Ti.N_POLE=2;Ti.EQUIT=3;Ti.OBLIQ=4;Ti.init=function(){var s=Math.abs(this.lat0);if(Math.abs(s-Lo)<jn?this.mode=this.lat0<0?this.S_POLE:this.N_POLE:Math.abs(s)<jn?this.mode=this.EQUIT:this.mode=this.OBLIQ,this.es>0){var u;switch(this.qp=Vh(this.e,1),this.mmf=.5/(1-this.es),this.apa=this.authset(this.es),this.mode){case this.N_POLE:this.dd=1;break;case this.S_POLE:this.dd=1;break;case this.EQUIT:this.rq=Math.sqrt(.5*this.qp),this.dd=1/this.rq,this.xmf=1,this.ymf=.5*this.qp;break;case this.OBLIQ:this.rq=Math.sqrt(.5*this.qp),u=Math.sin(this.lat0),this.sinb1=Vh(this.e,u)/this.qp,this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1),this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*u*u)*this.rq*this.cosb1),this.ymf=(this.xmf=this.rq)/this.dd,this.xmf*=this.dd;break}}else this.mode===this.OBLIQ&&(this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0))};Ti.forward=function(s){var u,g,x,I,z,R,o,G,K,ge,ae=s.x,H=s.y;if(ae=Fm(ae-this.long0),this.sphere){if(z=Math.sin(H),ge=Math.cos(H),x=Math.cos(ae),this.mode===this.OBLIQ||this.mode===this.EQUIT){if(g=this.mode===this.EQUIT?1+ge*x:1+this.sinph0*z+this.cosph0*ge*x,g<=jn)return null;g=Math.sqrt(2/g),u=g*ge*Math.sin(ae),g*=this.mode===this.EQUIT?z:this.cosph0*z-this.sinph0*ge*x}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(x=-x),Math.abs(H+this.phi0)<jn)return null;g=F0-H*.5,g=2*(this.mode===this.S_POLE?Math.cos(g):Math.sin(g)),u=g*Math.sin(ae),g*=x}}else{switch(o=0,G=0,K=0,x=Math.cos(ae),I=Math.sin(ae),z=Math.sin(H),R=Vh(this.e,z),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(o=R/this.qp,G=Math.sqrt(1-o*o)),this.mode){case this.OBLIQ:K=1+this.sinb1*o+this.cosb1*G*x;break;case this.EQUIT:K=1+G*x;break;case this.N_POLE:K=Lo+H,R=this.qp-R;break;case this.S_POLE:K=H-Lo,R=this.qp+R;break}if(Math.abs(K)<jn)return null;switch(this.mode){case this.OBLIQ:case this.EQUIT:K=Math.sqrt(2/K),this.mode===this.OBLIQ?g=this.ymf*K*(this.cosb1*o-this.sinb1*G*x):g=(K=Math.sqrt(2/(1+G*x)))*o*this.ymf,u=this.xmf*K*G*I;break;case this.N_POLE:case this.S_POLE:R>=0?(u=(K=Math.sqrt(R))*I,g=x*(this.mode===this.S_POLE?K:-K)):u=g=0;break}}return s.x=this.a*u+this.x0,s.y=this.a*g+this.y0,s};Ti.inverse=function(s){s.x-=this.x0,s.y-=this.y0;var u=s.x/this.a,g=s.y/this.a,x,I,z,R,o,G,K;if(this.sphere){var ge=0,ae,H=0;if(ae=Math.sqrt(u*u+g*g),I=ae*.5,I>1)return null;switch(I=2*Math.asin(I),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(H=Math.sin(I),ge=Math.cos(I)),this.mode){case this.EQUIT:I=Math.abs(ae)<=jn?0:Math.asin(g*H/ae),u*=H,g=ge*ae;break;case this.OBLIQ:I=Math.abs(ae)<=jn?this.phi0:Math.asin(ge*this.sinph0+g*H*this.cosph0/ae),u*=H*this.cosph0,g=(ge-Math.sin(I)*this.sinph0)*ae;break;case this.N_POLE:g=-g,I=Lo-I;break;case this.S_POLE:I-=Lo;break}x=g===0&&(this.mode===this.EQUIT||this.mode===this.OBLIQ)?0:Math.atan2(u,g)}else{if(K=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(u/=this.dd,g*=this.dd,G=Math.sqrt(u*u+g*g),G<jn)return s.x=0,s.y=this.phi0,s;R=2*Math.asin(.5*G/this.rq),z=Math.cos(R),u*=R=Math.sin(R),this.mode===this.OBLIQ?(K=z*this.sinb1+g*R*this.cosb1/G,o=this.qp*K,g=G*this.cosb1*z-g*this.sinb1*R):(K=g*R/G,o=this.qp*K,g=G*z)}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(g=-g),o=u*u+g*g,!o)return s.x=0,s.y=this.phi0,s;K=1-o/this.qp,this.mode===this.S_POLE&&(K=-K)}x=Math.atan2(u,g),I=this.authlat(Math.asin(K),this.apa)}return s.x=Fm(this.long0+x),s.y=I,s};Ti.P00=.3333333333333333;Ti.P01=.17222222222222222;Ti.P02=.10257936507936508;Ti.P10=.06388888888888888;Ti.P11=.0664021164021164;Ti.P20=.016415012942191543;Ti.authset=function(s){var u,g=[];return g[0]=s*this.P00,u=s*s,g[0]+=u*this.P01,g[1]=u*this.P10,u*=s,g[0]+=u*this.P02,g[1]+=u*this.P11,g[2]=u*this.P20,g};Ti.authlat=function(s,u){var g=s+s;return s+u[0]*Math.sin(g)+u[1]*Math.sin(g+g)+u[2]*Math.sin(g+g+g)};Ti.names=["Lambert Azimuthal Equal Area","Lambert_Azimuthal_Equal_Area","laea"];var nr=E0;nr.defaultDatum="WGS84";nr.Proj=tu;nr.WGS84=new nr.Proj("WGS84");nr.Point=R0;nr.toPoint=Pm;nr.defs=Tm;nr.transform=zm;nr.mgrs=Uo;nr.version="2.3.12";nr.Proj.projections.add(Ti);nr.Proj.projections.add(gs);var O0=nr,dp=O0,ru={};(function(s){Object.defineProperty(s,"__esModule",{value:!0}),s.getWeatherSymbolId=s.convertSymbolKeyToId=s.weatherSymbolKeys=void 0,s.weatherSymbolKeys={clearsky_day:"01d",clearsky_night:"01n",clearsky_polartwilight:"01m",fair_day:"02d",fair_night:"02n",fair_polartwilight:"02m",partlycloudy_day:"03d",partlycloudy_night:"03n",partlycloudy_polartwilight:"03m",cloudy:"04",rainshowers_day:"05d",rainshowers_night:"05n",rainshowers_polartwilight:"05m",rainshowersandthunder_day:"06d",rainshowersandthunder_night:"06n",rainshowersandthunder_polartwilight:"06m",sleetshowers_day:"07d",sleetshowers_night:"07n",sleetshowers_polartwilight:"07m",snowshowers_day:"08d",snowshowers_night:"08n",snowshowers_polartwilight:"08m",rain:"09",heavyrain:"10",heavyrainandthunder:"11",sleet:"12",snow:"13",snowandthunder:"14",fog:"15",sleetshowersandthunder_day:"20d",sleetshowersandthunder_night:"20n",sleetshowersandthunder_polartwilight:"20m",snowshowersandthunder_day:"21d",snowshowersandthunder_night:"21n",snowshowersandthunder_polartwilight:"21m",rainandthunder:"22",sleetandthunder:"23",lightrainshowersandthunder_day:"24d",lightrainshowersandthunder_night:"24n",lightrainshowersandthunder_polartwilight:"24m",heavyrainshowersandthunder_day:"25d",heavyrainshowersandthunder_night:"25n",heavyrainshowersandthunder_polartwilight:"25m",lightssleetshowersandthunder_day:"26d",lightssleetshowersandthunder_night:"26n",lightssleetshowersandthunder_polartwilight:"26m",heavysleetshowersandthunder_day:"27d",heavysleetshowersandthunder_night:"27n",heavysleetshowersandthunder_polartwilight:"27m",lightssnowshowersandthunder_day:"28d",lightssnowshowersandthunder_night:"28n",lightssnowshowersandthunder_polartwilight:"28m",heavysnowshowersandthunder_day:"29d",heavysnowshowersandthunder_night:"29n",heavysnowshowersandthunder_polartwilight:"29m",lightrainandthunder:"30",lightsleetandthunder:"31",heavysleetandthunder:"32",lightsnowandthunder:"33",heavysnowandthunder:"34",lightrainshowers_day:"40d",lightrainshowers_night:"40n",lightrainshowers_polartwilight:"40m",heavyrainshowers_day:"41d",heavyrainshowers_night:"41n",heavyrainshowers_polartwilight:"41m",lightsleetshowers_day:"42d",lightsleetshowers_night:"42n",lightsleetshowers_polartwilight:"42m",heavysleetshowers_day:"43d",heavysleetshowers_night:"43n",heavysleetshowers_polartwilight:"43m",lightsnowshowers_day:"44d",lightsnowshowers_night:"44n",lightsnowshowers_polartwilight:"44m",heavysnowshowers_day:"45d",heavysnowshowers_night:"45n",heavysnowshowers_polartwilight:"45m",lightrain:"46",lightsleet:"47",heavysleet:"48",lightsnow:"49",heavysnow:"50"};function u(x){var I;return(I=s.weatherSymbolKeys[x])!==null&&I!==void 0?I:void 0}s.convertSymbolKeyToId=u;function g(x){if(!(x==null||x.n==null)){var I=String(x.n).padStart(2,"0");switch(x.var){case"Sun":I+="d";break;case"PolarNight":I+="m";break;case"Moon":I+="n";break}return I}}s.getWeatherSymbolId=g})(ru);const pp=[-2002637639e-2,-200489661e-1,2002637639e-2,200489661e-1];function U0({currentLocation:s,locations:u,activeIntervalIndex:g,units:x}){const I=pp[0],z=pp[2],R=Math.abs(I)+Math.abs(z),o=dp("EPSG:4326","EPSG:3857",{x:s.position.lon,y:s.position.lat});return Object.keys(u).map(G=>{var K;const ge=u[G],ae=ge.intervals[g];if(ge.isCurrentLocation===!0||ae.wind==null||ae.symbol==null||ae.temperature==null)return null;const H=ge.name,ke=gx(s.position,ge.position,{unit:x.distance==="metric"?"km":"mi"}),we=dp("EPSG:4326","EPSG:3857",{x:ge.position.lon,y:ge.position.lat}),$e=$0(o,we,R);return{name:H,distance:ke,direction:Zd($e),temperature:Qh({value:(K=ae.temperature)===null||K===void 0?void 0:K.value,unit:x.temperature,decimal:!1}),symbol:ru.getWeatherSymbolId(ae.symbol),wind:{speed:xm({value:ae.wind.speed,unit:x.wind,decimal:!1}),direction:Zd(ae.wind.direction),type:Ex(ae.wind.speed)},weight:ge.weight}}).filter(Ax).sort((G,K)=>K.weight-G.weight).slice(0,3)}function $0(s,u,g){let x=u.x-s.x;x=Math.abs(x)<g/2?x:x-Math.sign(x)*g;const I=Math.atan2(u.y-s.y,x),z=_x(I);return xx(z)}function N0(){this.__data__=[],this.size=0}var V0=N0;function G0(s,u){return s===u||s!==s&&u!==u}var Om=G0,q0=Om;function j0(s,u){for(var g=s.length;g--;)if(q0(s[g][0],u))return g;return-1}var oc=j0,Z0=oc,W0=Array.prototype,H0=W0.splice;function X0(s){var u=this.__data__,g=Z0(u,s);if(g<0)return!1;var x=u.length-1;return g==x?u.pop():H0.call(u,g,1),--this.size,!0}var Y0=X0,K0=oc;function J0(s){var u=this.__data__,g=K0(u,s);return g<0?void 0:u[g][1]}var Q0=J0,ev=oc;function tv(s){return ev(this.__data__,s)>-1}var iv=tv,rv=oc;function nv(s,u){var g=this.__data__,x=rv(g,s);return x<0?(++this.size,g.push([s,u])):g[x][1]=u,this}var av=nv,sv=V0,ov=Y0,lv=Q0,cv=iv,hv=av;function ys(s){var u=-1,g=s==null?0:s.length;for(this.clear();++u<g;){var x=s[u];this.set(x[0],x[1])}}ys.prototype.clear=sv;ys.prototype.delete=ov;ys.prototype.get=lv;ys.prototype.has=cv;ys.prototype.set=hv;var lc=ys,uv=lc;function dv(){this.__data__=new uv,this.size=0}var pv=dv;function mv(s){var u=this.__data__,g=u.delete(s);return this.size=u.size,g}var fv=mv;function gv(s){return this.__data__.get(s)}var yv=gv;function _v(s){return this.__data__.has(s)}var xv=_v,vv=Bo,bv=Ro,wv="[object AsyncFunction]",Sv="[object Function]",Tv="[object GeneratorFunction]",Iv="[object Proxy]";function Ev(s){if(!bv(s))return!1;var u=vv(s);return u==Sv||u==Tv||u==wv||u==Iv}var Um=Ev,Av=Nr,Cv=Av["__core-js_shared__"],Mv=Cv,Ph=Mv,mp=function(){var s=/[^.]+$/.exec(Ph&&Ph.keys&&Ph.keys.IE_PROTO||"");return s?"Symbol(src)_1."+s:""}();function Pv(s){return!!mp&&mp in s}var zv=Pv,kv=Function.prototype,Lv=kv.toString;function Dv(s){if(s!=null){try{return Lv.call(s)}catch{}try{return s+""}catch{}}return""}var $m=Dv,Rv=Um,Bv=zv,Fv=Ro,Ov=$m,Uv=/[\\^$.*+?()[\]{}|]/g,$v=/^\[object .+?Constructor\]$/,Nv=Function.prototype,Vv=Object.prototype,Gv=Nv.toString,qv=Vv.hasOwnProperty,jv=RegExp("^"+Gv.call(qv).replace(Uv,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Zv(s){if(!Fv(s)||Bv(s))return!1;var u=Rv(s)?jv:$v;return u.test(Ov(s))}var Wv=Zv;function Hv(s,u){return s?.[u]}var Xv=Hv,Yv=Wv,Kv=Xv;function Jv(s,u){var g=Kv(s,u);return Yv(g)?g:void 0}var _s=Jv,Qv=_s,e1=Nr,t1=Qv(e1,"Map"),nu=t1,i1=_s,r1=i1(Object,"create"),cc=r1,fp=cc;function n1(){this.__data__=fp?fp(null):{},this.size=0}var a1=n1;function s1(s){var u=this.has(s)&&delete this.__data__[s];return this.size-=u?1:0,u}var o1=s1,l1=cc,c1="__lodash_hash_undefined__",h1=Object.prototype,u1=h1.hasOwnProperty;function d1(s){var u=this.__data__;if(l1){var g=u[s];return g===c1?void 0:g}return u1.call(u,s)?u[s]:void 0}var p1=d1,m1=cc,f1=Object.prototype,g1=f1.hasOwnProperty;function y1(s){var u=this.__data__;return m1?u[s]!==void 0:g1.call(u,s)}var _1=y1,x1=cc,v1="__lodash_hash_undefined__";function b1(s,u){var g=this.__data__;return this.size+=this.has(s)?0:1,g[s]=x1&&u===void 0?v1:u,this}var w1=b1,S1=a1,T1=o1,I1=p1,E1=_1,A1=w1;function xs(s){var u=-1,g=s==null?0:s.length;for(this.clear();++u<g;){var x=s[u];this.set(x[0],x[1])}}xs.prototype.clear=S1;xs.prototype.delete=T1;xs.prototype.get=I1;xs.prototype.has=E1;xs.prototype.set=A1;var C1=xs,gp=C1,M1=lc,P1=nu;function z1(){this.size=0,this.__data__={hash:new gp,map:new(P1||M1),string:new gp}}var k1=z1;function L1(s){var u=typeof s;return u=="string"||u=="number"||u=="symbol"||u=="boolean"?s!=="__proto__":s===null}var D1=L1,R1=D1;function B1(s,u){var g=s.__data__;return R1(u)?g[typeof u=="string"?"string":"hash"]:g.map}var hc=B1,F1=hc;function O1(s){var u=F1(this,s).delete(s);return this.size-=u?1:0,u}var U1=O1,$1=hc;function N1(s){return $1(this,s).get(s)}var V1=N1,G1=hc;function q1(s){return G1(this,s).has(s)}var j1=q1,Z1=hc;function W1(s,u){var g=Z1(this,s),x=g.size;return g.set(s,u),this.size+=g.size==x?0:1,this}var H1=W1,X1=k1,Y1=U1,K1=V1,J1=j1,Q1=H1;function vs(s){var u=-1,g=s==null?0:s.length;for(this.clear();++u<g;){var x=s[u];this.set(x[0],x[1])}}vs.prototype.clear=X1;vs.prototype.delete=Y1;vs.prototype.get=K1;vs.prototype.has=J1;vs.prototype.set=Q1;var Nm=vs,eb=lc,tb=nu,ib=Nm,rb=200;function nb(s,u){var g=this.__data__;if(g instanceof eb){var x=g.__data__;if(!tb||x.length<rb-1)return x.push([s,u]),this.size=++g.size,this;g=this.__data__=new ib(x)}return g.set(s,u),this.size=g.size,this}var ab=nb,sb=lc,ob=pv,lb=fv,cb=yv,hb=xv,ub=ab;function bs(s){var u=this.__data__=new sb(s);this.size=u.size}bs.prototype.clear=ob;bs.prototype.delete=lb;bs.prototype.get=cb;bs.prototype.has=hb;bs.prototype.set=ub;var db=bs,pb="__lodash_hash_undefined__";function mb(s){return this.__data__.set(s,pb),this}var fb=mb;function gb(s){return this.__data__.has(s)}var yb=gb,_b=Nm,xb=fb,vb=yb;function nc(s){var u=-1,g=s==null?0:s.length;for(this.__data__=new _b;++u<g;)this.add(s[u])}nc.prototype.add=nc.prototype.push=xb;nc.prototype.has=vb;var bb=nc;function wb(s,u){for(var g=-1,x=s==null?0:s.length;++g<x;)if(u(s[g],g,s))return!0;return!1}var Sb=wb;function Tb(s,u){return s.has(u)}var Ib=Tb,Eb=bb,Ab=Sb,Cb=Ib,Mb=1,Pb=2;function zb(s,u,g,x,I,z){var R=g&Mb,o=s.length,G=u.length;if(o!=G&&!(R&&G>o))return!1;var K=z.get(s),ge=z.get(u);if(K&&ge)return K==u&&ge==s;var ae=-1,H=!0,ke=g&Pb?new Eb:void 0;for(z.set(s,u),z.set(u,s);++ae<o;){var we=s[ae],$e=u[ae];if(x)var Ve=R?x($e,we,ae,u,s,z):x(we,$e,ae,s,u,z);if(Ve!==void 0){if(Ve)continue;H=!1;break}if(ke){if(!Ab(u,function(je,Ge){if(!Cb(ke,Ge)&&(we===je||I(we,je,g,x,z)))return ke.push(Ge)})){H=!1;break}}else if(!(we===$e||I(we,$e,g,x,z))){H=!1;break}}return z.delete(s),z.delete(u),H}var Vm=zb,kb=Nr,Lb=kb.Uint8Array,Db=Lb;function Rb(s){var u=-1,g=Array(s.size);return s.forEach(function(x,I){g[++u]=[I,x]}),g}var Bb=Rb;function Fb(s){var u=-1,g=Array(s.size);return s.forEach(function(x){g[++u]=x}),g}var Ob=Fb,yp=Jh,_p=Db,Ub=Om,$b=Vm,Nb=Bb,Vb=Ob,Gb=1,qb=2,jb="[object Boolean]",Zb="[object Date]",Wb="[object Error]",Hb="[object Map]",Xb="[object Number]",Yb="[object RegExp]",Kb="[object Set]",Jb="[object String]",Qb="[object Symbol]",ew="[object ArrayBuffer]",tw="[object DataView]",xp=yp?yp.prototype:void 0,zh=xp?xp.valueOf:void 0;function iw(s,u,g,x,I,z,R){switch(g){case tw:if(s.byteLength!=u.byteLength||s.byteOffset!=u.byteOffset)return!1;s=s.buffer,u=u.buffer;case ew:return!(s.byteLength!=u.byteLength||!z(new _p(s),new _p(u)));case jb:case Zb:case Xb:return Ub(+s,+u);case Wb:return s.name==u.name&&s.message==u.message;case Yb:case Jb:return s==u+"";case Hb:var o=Nb;case Kb:var G=x&Gb;if(o||(o=Vb),s.size!=u.size&&!G)return!1;var K=R.get(s);if(K)return K==u;x|=qb,R.set(s,u);var ge=$b(o(s),o(u),x,I,z,R);return R.delete(s),ge;case Qb:if(zh)return zh.call(s)==zh.call(u)}return!1}var rw=iw;function nw(s,u){for(var g=-1,x=u.length,I=s.length;++g<x;)s[I+g]=u[g];return s}var aw=nw,sw=Array.isArray,au=sw,ow=aw,lw=au;function cw(s,u,g){var x=u(s);return lw(s)?x:ow(x,g(s))}var hw=cw;function uw(s,u){for(var g=-1,x=s==null?0:s.length,I=0,z=[];++g<x;){var R=s[g];u(R,g,s)&&(z[I++]=R)}return z}var dw=uw;function pw(){return[]}var mw=pw,fw=dw,gw=mw,yw=Object.prototype,_w=yw.propertyIsEnumerable,vp=Object.getOwnPropertySymbols,xw=vp?function(s){return s==null?[]:(s=Object(s),fw(vp(s),function(u){return _w.call(s,u)}))}:gw,vw=xw;function bw(s,u){for(var g=-1,x=Array(s);++g<s;)x[g]=u(g);return x}var ww=bw,Sw=Bo,Tw=Fo,Iw="[object Arguments]";function Ew(s){return Tw(s)&&Sw(s)==Iw}var Aw=Ew,bp=Aw,Cw=Fo,Gm=Object.prototype,Mw=Gm.hasOwnProperty,Pw=Gm.propertyIsEnumerable,zw=bp(function(){return arguments}())?bp:function(s){return Cw(s)&&Mw.call(s,"callee")&&!Pw.call(s,"callee")},kw=zw,ac={exports:{}};function Lw(){return!1}var Dw=Lw;(function(s,u){var g=Nr,x=Dw,I=u&&!u.nodeType&&u,z=I&&!0&&s&&!s.nodeType&&s,R=z&&z.exports===I,o=R?g.Buffer:void 0,G=o?o.isBuffer:void 0,K=G||x;s.exports=K})(ac,ac.exports);var Rw=9007199254740991,Bw=/^(?:0|[1-9]\d*)$/;function Fw(s,u){var g=typeof s;return u=u??Rw,!!u&&(g=="number"||g!="symbol"&&Bw.test(s))&&s>-1&&s%1==0&&s<u}var Ow=Fw,Uw=9007199254740991;function $w(s){return typeof s=="number"&&s>-1&&s%1==0&&s<=Uw}var qm=$w,Nw=Bo,Vw=qm,Gw=Fo,qw="[object Arguments]",jw="[object Array]",Zw="[object Boolean]",Ww="[object Date]",Hw="[object Error]",Xw="[object Function]",Yw="[object Map]",Kw="[object Number]",Jw="[object Object]",Qw="[object RegExp]",e2="[object Set]",t2="[object String]",i2="[object WeakMap]",r2="[object ArrayBuffer]",n2="[object DataView]",a2="[object Float32Array]",s2="[object Float64Array]",o2="[object Int8Array]",l2="[object Int16Array]",c2="[object Int32Array]",h2="[object Uint8Array]",u2="[object Uint8ClampedArray]",d2="[object Uint16Array]",p2="[object Uint32Array]",Gt={};Gt[a2]=Gt[s2]=Gt[o2]=Gt[l2]=Gt[c2]=Gt[h2]=Gt[u2]=Gt[d2]=Gt[p2]=!0;Gt[qw]=Gt[jw]=Gt[r2]=Gt[Zw]=Gt[n2]=Gt[Ww]=Gt[Hw]=Gt[Xw]=Gt[Yw]=Gt[Kw]=Gt[Jw]=Gt[Qw]=Gt[e2]=Gt[t2]=Gt[i2]=!1;function m2(s){return Gw(s)&&Vw(s.length)&&!!Gt[Nw(s)]}var f2=m2;function g2(s){return function(u){return s(u)}}var y2=g2,Gh={exports:{}};(function(s,u){var g=Wp,x=u&&!u.nodeType&&u,I=x&&!0&&s&&!s.nodeType&&s,z=I&&I.exports===x,R=z&&g.process,o=function(){try{var G=I&&I.require&&I.require("util").types;return G||R&&R.binding&&R.binding("util")}catch{}}();s.exports=o})(Gh,Gh.exports);var _2=f2,x2=y2,wp=Gh.exports,Sp=wp&&wp.isTypedArray,v2=Sp?x2(Sp):_2,jm=v2,b2=ww,w2=kw,S2=au,T2=ac.exports,I2=Ow,E2=jm,A2=Object.prototype,C2=A2.hasOwnProperty;function M2(s,u){var g=S2(s),x=!g&&w2(s),I=!g&&!x&&T2(s),z=!g&&!x&&!I&&E2(s),R=g||x||I||z,o=R?b2(s.length,String):[],G=o.length;for(var K in s)(u||C2.call(s,K))&&!(R&&(K=="length"||I&&(K=="offset"||K=="parent")||z&&(K=="buffer"||K=="byteLength"||K=="byteOffset")||I2(K,G)))&&o.push(K);return o}var P2=M2,z2=Object.prototype;function k2(s){var u=s&&s.constructor,g=typeof u=="function"&&u.prototype||z2;return s===g}var L2=k2;function D2(s,u){return function(g){return s(u(g))}}var R2=D2,B2=R2,F2=B2(Object.keys,Object),O2=F2,U2=L2,$2=O2,N2=Object.prototype,V2=N2.hasOwnProperty;function G2(s){if(!U2(s))return $2(s);var u=[];for(var g in Object(s))V2.call(s,g)&&g!="constructor"&&u.push(g);return u}var q2=G2,j2=Um,Z2=qm;function W2(s){return s!=null&&Z2(s.length)&&!j2(s)}var H2=W2,X2=P2,Y2=q2,K2=H2;function J2(s){return K2(s)?X2(s):Y2(s)}var Q2=J2,eS=hw,tS=vw,iS=Q2;function rS(s){return eS(s,iS,tS)}var nS=rS,Tp=nS,aS=1,sS=Object.prototype,oS=sS.hasOwnProperty;function lS(s,u,g,x,I,z){var R=g&aS,o=Tp(s),G=o.length,K=Tp(u),ge=K.length;if(G!=ge&&!R)return!1;for(var ae=G;ae--;){var H=o[ae];if(!(R?H in u:oS.call(u,H)))return!1}var ke=z.get(s),we=z.get(u);if(ke&&we)return ke==u&&we==s;var $e=!0;z.set(s,u),z.set(u,s);for(var Ve=R;++ae<G;){H=o[ae];var je=s[H],Ge=u[H];if(x)var We=R?x(Ge,je,H,u,s,z):x(je,Ge,H,s,u,z);if(!(We===void 0?je===Ge||I(je,Ge,g,x,z):We)){$e=!1;break}Ve||(Ve=H=="constructor")}if($e&&!Ve){var At=s.constructor,gt=u.constructor;At!=gt&&"constructor"in s&&"constructor"in u&&!(typeof At=="function"&&At instanceof At&&typeof gt=="function"&&gt instanceof gt)&&($e=!1)}return z.delete(s),z.delete(u),$e}var cS=lS,hS=_s,uS=Nr,dS=hS(uS,"DataView"),pS=dS,mS=_s,fS=Nr,gS=mS(fS,"Promise"),yS=gS,_S=_s,xS=Nr,vS=_S(xS,"Set"),bS=vS,wS=_s,SS=Nr,TS=wS(SS,"WeakMap"),IS=TS,qh=pS,jh=nu,Zh=yS,Wh=bS,Hh=IS,Zm=Bo,ws=$m,Ip="[object Map]",ES="[object Object]",Ep="[object Promise]",Ap="[object Set]",Cp="[object WeakMap]",Mp="[object DataView]",AS=ws(qh),CS=ws(jh),MS=ws(Zh),PS=ws(Wh),zS=ws(Hh),wa=Zm;(qh&&wa(new qh(new ArrayBuffer(1)))!=Mp||jh&&wa(new jh)!=Ip||Zh&&wa(Zh.resolve())!=Ep||Wh&&wa(new Wh)!=Ap||Hh&&wa(new Hh)!=Cp)&&(wa=function(s){var u=Zm(s),g=u==ES?s.constructor:void 0,x=g?ws(g):"";if(x)switch(x){case AS:return Mp;case CS:return Ip;case MS:return Ep;case PS:return Ap;case zS:return Cp}return u});var kS=wa,kh=db,LS=Vm,DS=rw,RS=cS,Pp=kS,zp=au,kp=ac.exports,BS=jm,FS=1,Lp="[object Arguments]",Dp="[object Array]",Vl="[object Object]",OS=Object.prototype,Rp=OS.hasOwnProperty;function US(s,u,g,x,I,z){var R=zp(s),o=zp(u),G=R?Dp:Pp(s),K=o?Dp:Pp(u);G=G==Lp?Vl:G,K=K==Lp?Vl:K;var ge=G==Vl,ae=K==Vl,H=G==K;if(H&&kp(s)){if(!kp(u))return!1;R=!0,ge=!1}if(H&&!ge)return z||(z=new kh),R||BS(s)?LS(s,u,g,x,I,z):DS(s,u,G,g,x,I,z);if(!(g&FS)){var ke=ge&&Rp.call(s,"__wrapped__"),we=ae&&Rp.call(u,"__wrapped__");if(ke||we){var $e=ke?s.value():s,Ve=we?u.value():u;return z||(z=new kh),I($e,Ve,g,x,z)}}return H?(z||(z=new kh),RS(s,u,g,x,I,z)):!1}var $S=US,NS=$S,Bp=Fo;function Wm(s,u,g,x,I){return s===u?!0:s==null||u==null||!Bp(s)&&!Bp(u)?s!==s&&u!==u:NS(s,u,g,x,Wm,I)}var VS=Wm,GS=VS;function qS(s,u){return GS(s,u)}var jS=qS;function Hm({width:s,height:u,scaleByDevicePixelRatio:g=!1}){const x=document.createElement("canvas");return Xm({canvas:x,width:s,height:u,scaleByDevicePixelRatio:g}),x}function Xm({canvas:s,width:u,height:g,scaleByDevicePixelRatio:x=!1}){const I=x?window.devicePixelRatio:1;s.width=u*I,s.height=g*I}function Xh({canvas:s,scaleByDevicePixelRatio:u=!1,willReadFrequently:g}){const x=s.getContext("2d",{willReadFrequently:g});if(x==null)throw new Error("Unable to get context");return x.restore(),x.save(),u===!0&&x.scale(window.devicePixelRatio,window.devicePixelRatio),x}function Gl({family:s,weight:u,size:g}){return`${u} ${g} ${s}`}function Lh({context:s,text:u,font:g}){return s.font=g,s.measureText(u).width}function ZS({canvas:s,backgroundColor:u="white",scale:g={min:.5,max:1}}){s.style.display="none",s.style.backgroundColor=u,s.style.transform=`translate(-50%, -50%) scale(${g.min})`,s.style.position="fixed",s.style.top="50%",s.style.left="50%";let x,I=!0,z=!1;function R(K){z=!0,x={x:s.offsetLeft,y:s.offsetTop,clientX:K.clientX,clientY:K.clientY}}function o(){x=void 0,z===!0&&(z=!1,I=!I,s.style.transform=I?`translate(-50%, -50%) scale(${g.min})`:`translate(-50%, -50%) scale(${g.max})`)}function G(K){if(z=!1,x!=null){const ge=K.clientX-x.clientX,ae=K.clientY-x.clientY;s.style.top=`${x.y+ae}px`,s.style.left=`${x.x+ge}px`}}return s.addEventListener("mousedown",R),document.body.addEventListener("mouseup",o),document.body.addEventListener("mousemove",G),document.body.appendChild(s),()=>{s.removeEventListener("mousedown",R),document.body.removeEventListener("mouseup",o),document.body.removeEventListener("mousemove",G),document.body.removeChild(s)}}class WS{constructor({timeoutDuration:u=500,onLoad:g}={}){this.cachedImages={},this.timeoutDuration=u,g!=null&&(this.onLoadThrottled=sm(g,300,{leading:!1,trailing:!0}))}getImage(u){return this.loadImage(u),this.cachedImages[u]}loadImage(u){return qn(this,void 0,void 0,function*(){if(this.cachedImages[u]!=null)return;const g={src:u,state:"loading"};this.cachedImages[u]=g;const x=setTimeout(()=>{g.state==="loading"&&(g.state="timeout")},this.timeoutDuration);try{const I=yield Kp(u);g.image=I,g.state="success"}catch{g.state="error"}clearTimeout(x),this.onLoadThrottled!=null&&this.onLoadThrottled()})}}function HS({name:s,maxLength:u=15}){if((s=s.trim()).length<=u)return[s];const g=s.split(" "),x=[];for(const z of g)if(x.push(z),x.join(" ").length>u){x.pop();break}const I=g.slice(x.length);if(x.length===0){const z=I.shift();if(z==null)throw new Error("Wrapping word not found");const R=z.slice(0,u),o=z.slice(u);x.push(R),I.unshift(o)}return[x.join(" "),KS({line:I.join(" "),maxLength:u})]}function XS(s){const u=Math.ceil(Math.sqrt(s)),g=Math.ceil(s/u);return{width:u*Kl,height:g*Jl,columns:u,rows:g}}function YS({sprite:s,spriteSheet:u}){const g=s.x/u.width,x=(s.x+s.width)/u.width,I=s.y/u.height,z=(s.y+s.height)/u.height;return{topLeft:{x:g,y:I},topRight:{x,y:I},bottomRight:{x,y:z},bottomLeft:{x:g,y:z}}}function KS({line:s,maxLength:u}){return s.length<=u?s:`${s.slice(0,u-1)}\u2026`}const zt={font:{currentLocation:{fontSize:"17px",lineHeight:20,maxWidth:14},default:{fontSize:"14px",lineHeight:17,maxWidth:16},city:{fontSize:"15px",lineHeight:18,maxWidth:16},mountain:{fontSize:"11px",lineHeight:14,maxWidth:16},details:{fontSize:"14px"},outline:{width:2,strokeStyle:"white"}},locationName:{offsetY:-10},weatherSymbol:{size:50,offsetY:-38},temperature:{offsetX:-20,offsetY:[10,30]},wind:{speed:{offsetX:-9,offsetY:[10,30]},direction:{offsetX:4,offsetY:[10,30],size:25}}},JS={mps:"m/s",kmh:"km/h",mph:"mph",knots:"kn",beaufort:"B"};class QS{constructor({theme:u,units:g,weatherSymbolsPath:x,onChange:I,activeIntervalIndex:z}){this.uvCoordinates=[],this.showWeight=!1,this.showSpriteOutline=!1,this.locations=[],this.theme=u,this.units=g,this.weatherSymbolsPath=x,this.activeIntervalIndex=z,this.onChange=I,this.canvas=Hm({width:0,height:0}),this.context=Xh({canvas:this.canvas,scaleByDevicePixelRatio:!0}),this.imageCache=new WS({onLoad:()=>{this.draw()}}),ZS({canvas:this.canvas})}toggleCanvasDebugView(u){this.canvas.style.display=u?"":"none"}setUnits(u){this.units=u,this.draw()}setShowWeight(u){this.showWeight=u,this.draw()}setShowSpriteOutline(u){this.showSpriteOutline=u,this.draw()}setLocations(u){this.locations=Object.values(u),this.draw()}setActiveIntervalIndex(u){u!==this.activeIntervalIndex&&(this.activeIntervalIndex=u,this.draw())}draw(){const{width:u,height:g,columns:x,rows:I}=XS(this.locations.length);Xm({canvas:this.canvas,width:u,height:g,scaleByDevicePixelRatio:!0}),this.context=Xh({canvas:this.canvas,scaleByDevicePixelRatio:!0}),this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.uvCoordinates=[];for(let z=0;z<I;z++)for(let R=0;R<x;R++){const o=z*x+R,G=this.locations[o];if(G==null)continue;const K={x:R*Kl,y:z*Jl,width:Kl,height:Jl};if(this.context.save(),this.context.beginPath(),this.context.rect(K.x,K.y,K.width,K.height),this.context.clip(),this.showSpriteOutline&&(this.context.beginPath(),this.context.strokeStyle="hotpink",this.context.lineWidth=2,this.context.rect(K.x,K.y,K.width,K.height),this.context.stroke()),this.activeIntervalIndex!=null){const ge=G.intervals[this.activeIntervalIndex];this.drawSprite({sprite:K,location:G,interval:ge})}this.uvCoordinates.push(YS({sprite:K,spriteSheet:{width:u,height:g}})),this.context.restore()}this.onChange()}drawSprite({sprite:u,location:g,interval:x}){const I={x:u.x+u.width/2,y:u.y+u.height/2-lm};g.category!=="mountain"&&g.category!=="mountain_peak"||(g.name=g.name.toUpperCase());const{maxWidth:z}=this.getLocationNameFont({category:g.category,isCurrentLocation:g.isCurrentLocation}),R=HS({name:g.name,maxLength:z});this.drawLocationName({center:I,locationNameLines:R,category:g.category,isCurrentLocation:g.isCurrentLocation}),this.drawTemperature({center:I,interval:x,linesOffset:R.length-1}),this.drawWind({center:I,interval:x,linesOffset:R.length-1}),this.drawWeatherSymbol({center:I,interval:x}),this.showWeight===!0&&this.drawWeight({center:I,weight:g.weight})}drawLocationName({center:u,locationNameLines:g,category:x,isCurrentLocation:I}){const{fontSize:z,lineHeight:R}=this.getLocationNameFont({category:x,isCurrentLocation:I}),o=Gl({family:this.theme.font.family,weight:this.theme.font.weight,size:z});for(let G=0;G<g.length;G++){const K=g[G],ge=u.x-Lh({context:this.context,text:K,font:o})/2,ae=u.y+zt.locationName.offsetY+R*G;this.context.font=o,this.context.textAlign="left",this.context.textBaseline="middle",this.context.lineWidth=zt.font.outline.width,this.context.strokeStyle=zt.font.outline.strokeStyle,this.context.fillStyle="black",this.context.lineJoin="round",this.context.strokeText(K,ge,ae),this.context.fillText(K,ge,ae)}}getLocationNameFont({category:u,isCurrentLocation:g}){return g?zt.font.currentLocation:u==="capital"||u==="regional_capital"||u==="city"||u==="medium_city"||u==="large_city"||u==="administration_centre"?zt.font.city:u==="mountain"||u==="mountain_peak"?zt.font.mountain:zt.font.default}drawTemperature({interval:u,center:g,linesOffset:x}){if(u.temperature==null)return;const I=`${Qh({value:u.temperature.value,decimal:!1,unit:this.units.temperature})}\xB0`,z=g.x+zt.temperature.offsetX,R=g.y+zt.temperature.offsetY[x];this.context.font=Gl({family:this.theme.font.family,weight:this.theme.font.weight,size:zt.font.details.fontSize}),this.context.textAlign="right",this.context.textBaseline="middle",this.context.lineWidth=zt.font.outline.width,this.context.strokeStyle=zt.font.outline.strokeStyle,this.context.fillStyle=vx({value:u.temperature.value,unit:this.units.temperature})?this.theme.colors.temperatureWarm:this.theme.colors.temperatureCold,this.context.strokeText(I,z,R),this.context.fillText(I,z,R)}drawWind({interval:u,center:g,linesOffset:x}){if(u.wind==null)return;const I=xm({value:u.wind.speed,decimal:!1,unit:this.units.wind}),z=Gl({family:this.theme.font.family,weight:this.theme.font.weight,size:zt.font.details.fontSize}),R=`${I.toString()} ${JS[this.units.wind]}`,o=Lh({context:this.context,text:R,font:z});this.drawWindLabel({label:R,center:g,linesOffset:x,font:z}),I>0&&this.drawWindArrow({center:g,labelWidth:o,direction:u.wind.direction,linesOffset:x,font:z})}drawWindLabel({label:u,center:g,linesOffset:x,font:I}){const z=g.x+zt.wind.speed.offsetX,R=g.y+zt.wind.speed.offsetY[x];this.context.font=I,this.context.textAlign="left",this.context.textBaseline="middle",this.context.lineWidth=zt.font.outline.width,this.context.strokeStyle=zt.font.outline.strokeStyle,this.context.fillStyle=this.theme.colors.wind,this.context.strokeText(u,z,R),this.context.fillText(u,z,R)}drawWindArrow({center:u,labelWidth:g,direction:x,linesOffset:I}){const{image:z}=this.imageCache.getImage("/assets/images/icons/png/4x/icon-arrow-outline.png");if(z==null)return;const R=u.x+zt.wind.direction.offsetX+g-zt.wind.direction.size/2,o=u.y+zt.wind.direction.offsetY[I]-zt.wind.direction.size/2,G=R+zt.wind.direction.size/2,K=o+zt.wind.direction.size/2;this.context.save(),this.context.translate(G,K),this.context.rotate(yx(x)),this.context.translate(-G,-K),this.context.drawImage(z,R,o,zt.wind.direction.size,zt.wind.direction.size),this.context.restore()}drawWeatherSymbol({center:u,interval:g}){if(g.symbol==null)return;const x=ru.getWeatherSymbolId(g.symbol),{image:I}=this.imageCache.getImage(`${this.weatherSymbolsPath}/${x}.svg`);if(I==null)return;const{size:z,offsetY:R}=zt.weatherSymbol,o=u.x-z/2,G=u.y+R-z/2;this.context.drawImage(I,o,G,z,z)}drawWeight({center:u,weight:g}){const x=Gl({family:this.theme.font.family,weight:this.theme.font.weight,size:zt.font.details.fontSize}),I=u.x+Lh({context:this.context,text:`${g}`,font:x})/2,z=u.y+-38;this.context.font=x,this.context.textAlign="right",this.context.textBaseline="middle",this.context.lineWidth=zt.font.outline.width,this.context.strokeStyle=zt.font.outline.strokeStyle,this.context.fillStyle="deeppink",this.context.strokeText(`${g}`,I,z),this.context.fillText(`${g}`,I,z)}}var eT=`#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif
uniform sampler2D uSpriteSheetTexture;varying vec2 vSpriteSheetCoordinate;void main(){gl_FragColor=texture2D(uSpriteSheetTexture,vSpriteSheetCoordinate);}`,tT="uniform mat4 uMatrix;uniform vec2 uViewport;uniform vec2 uWorldOffset;attribute vec2 aSpriteVertex;attribute vec2 aMercatorCoordinate;attribute vec2 aSpriteSheetCoordinate;varying vec2 vSpriteSheetCoordinate;vec2 round(vec2 values){return floor(values+0.5);}void main(){vec4 position=uMatrix*vec4(aMercatorCoordinate+uWorldOffset,0.0,1.0);position/=position.w;vec2 normalizedPosition=(position.xy+1.0)/2.0;vec2 positionInPixels=round(normalizedPosition*uViewport);position=vec4(positionInPixels/uViewport*2.0-1.0,0.0,1.0);gl_Position=position+vec4(aSpriteVertex,0.0,0.0);vSpriteSheetCoordinate=aSpriteSheetCoordinate;}";class iT extends tm{constructor({map:u,gl:g,mapSize:x,activeIntervalIndex:I}){super(g,tT,eT),this.locations={},this.spriteSheetTextureIndex=0,this.spriteSheetTextureCoordinates=new Float32Array,this.spriteVertices=new Float32Array,this.mercatorCoordinates=new Float32Array,this.update=()=>{const z=Object.values(this.locations),R=A_({width:Kl*window.devicePixelRatio,height:Jl*window.devicePixelRatio,offsetY:lm*window.devicePixelRatio,viewport:this.mapSize});this.spriteVertices=new Float32Array(6*z.length*2),this.mercatorCoordinates=new Float32Array(6*z.length*2),this.spriteSheetTextureCoordinates=new Float32Array(6*z.length*2);for(let o=0;o<z.length;o++){const G=6*o*2,K=Gn.exports.MercatorCoordinate.fromLngLat(z[o].position);this.spriteVertices[G+0]=R.topLeft.x,this.spriteVertices[G+1]=R.topLeft.y,this.spriteVertices[G+2]=R.bottomLeft.x,this.spriteVertices[G+3]=R.bottomLeft.y,this.spriteVertices[G+4]=R.topRight.x,this.spriteVertices[G+5]=R.topRight.y,this.spriteVertices[G+6]=R.topRight.x,this.spriteVertices[G+7]=R.topRight.y,this.spriteVertices[G+8]=R.bottomLeft.x,this.spriteVertices[G+9]=R.bottomLeft.y,this.spriteVertices[G+10]=R.bottomRight.x,this.spriteVertices[G+11]=R.bottomRight.y,this.mercatorCoordinates[G+0]=K.x,this.mercatorCoordinates[G+1]=K.y,this.mercatorCoordinates[G+2]=K.x,this.mercatorCoordinates[G+3]=K.y,this.mercatorCoordinates[G+4]=K.x,this.mercatorCoordinates[G+5]=K.y,this.mercatorCoordinates[G+6]=K.x,this.mercatorCoordinates[G+7]=K.y,this.mercatorCoordinates[G+8]=K.x,this.mercatorCoordinates[G+9]=K.y,this.mercatorCoordinates[G+10]=K.x,this.mercatorCoordinates[G+11]=K.y,this.spriteSheetTextureCoordinates[G+0]=this.spriteSheet.uvCoordinates[o].topLeft.x,this.spriteSheetTextureCoordinates[G+1]=this.spriteSheet.uvCoordinates[o].topLeft.y,this.spriteSheetTextureCoordinates[G+2]=this.spriteSheet.uvCoordinates[o].bottomLeft.x,this.spriteSheetTextureCoordinates[G+3]=this.spriteSheet.uvCoordinates[o].bottomLeft.y,this.spriteSheetTextureCoordinates[G+4]=this.spriteSheet.uvCoordinates[o].topRight.x,this.spriteSheetTextureCoordinates[G+5]=this.spriteSheet.uvCoordinates[o].topRight.y,this.spriteSheetTextureCoordinates[G+6]=this.spriteSheet.uvCoordinates[o].topRight.x,this.spriteSheetTextureCoordinates[G+7]=this.spriteSheet.uvCoordinates[o].topRight.y,this.spriteSheetTextureCoordinates[G+8]=this.spriteSheet.uvCoordinates[o].bottomLeft.x,this.spriteSheetTextureCoordinates[G+9]=this.spriteSheet.uvCoordinates[o].bottomLeft.y,this.spriteSheetTextureCoordinates[G+10]=this.spriteSheet.uvCoordinates[o].bottomRight.x,this.spriteSheetTextureCoordinates[G+11]=this.spriteSheet.uvCoordinates[o].bottomRight.y}this.map.maplibregl.triggerRepaint()},this.map=u,this.mapSize=x,this.spriteSheet=new QS({theme:this.map.theme,units:this.map.units,weatherSymbolsPath:this.map.assets.weatherSymbolsPath,onChange:this.update,activeIntervalIndex:I}),this.spriteVerticesBuffer=ko(g),this.mercatorCoordinatesBuffer=ko(g),this.spriteSheetTextureCoordinateBuffer=ko(g)}setSize(u){this.mapSize=u}setUnits(u){this.spriteSheet.setUnits(u)}setShowSpriteSheetCanvas(u){this.spriteSheet.toggleCanvasDebugView(u)}setShowWeight(u){this.spriteSheet.setShowWeight(u)}setShowSpriteOutline(u){this.spriteSheet.setShowSpriteOutline(u)}setLocations({locations:u}){jS(Object.keys(this.locations),Object.keys(u))||(this.locations=u,this.spriteSheet.setLocations(u))}setActiveIntervalIndex(u){this.spriteSheet.setActiveIntervalIndex(u)}prerender({gl:u}){this.spriteVertices.length!==0&&(this.spriteSheetTexture==null?this.spriteSheetTexture=Qp({gl:u,source:this.spriteSheet.canvas,premultiplyAlpha:!0}):em({gl:u,texture:this.spriteSheetTexture,source:this.spriteSheet.canvas,premultiplyAlpha:!0}))}render({gl:u,matrix:g}){if(this.spriteVertices.length===0||this.spriteSheetTexture==null)return;u.activeTexture(u.TEXTURE0+this.spriteSheetTextureIndex),u.bindTexture(u.TEXTURE_2D,this.spriteSheetTexture),u.enable(u.BLEND),u.useProgram(this.program),u.viewport(0,0,this.mapSize.width,this.mapSize.height),u.uniformMatrix4fv(u.getUniformLocation(this.program,"uMatrix"),!1,g),u.uniform2fv(u.getUniformLocation(this.program,"uViewport"),[this.mapSize.width,this.mapSize.height]),u.uniform1i(this.getUniform("uSpriteSheetTexture"),this.spriteSheetTextureIndex),u.bindBuffer(u.ARRAY_BUFFER,this.spriteVerticesBuffer),u.bufferData(u.ARRAY_BUFFER,this.spriteVertices,u.STATIC_DRAW),u.vertexAttribPointer(this.getAttribute("aSpriteVertex"),2,u.FLOAT,!1,0,0),u.enableVertexAttribArray(this.getAttribute("aSpriteVertex")),u.bindBuffer(u.ARRAY_BUFFER,this.mercatorCoordinatesBuffer),u.bufferData(u.ARRAY_BUFFER,this.mercatorCoordinates,u.STATIC_DRAW),u.vertexAttribPointer(this.getAttribute("aMercatorCoordinate"),2,u.FLOAT,!1,0,0),u.enableVertexAttribArray(this.getAttribute("aMercatorCoordinate")),u.bindBuffer(u.ARRAY_BUFFER,this.spriteSheetTextureCoordinateBuffer),u.bufferData(u.ARRAY_BUFFER,this.spriteSheetTextureCoordinates,u.STATIC_DRAW),u.vertexAttribPointer(this.getAttribute("aSpriteSheetCoordinate"),2,u.FLOAT,!1,0,0),u.enableVertexAttribArray(this.getAttribute("aSpriteSheetCoordinate"));const x=hx(this.map.maplibregl);for(const I of x)u.uniform2fv(this.getUniform("uWorldOffset"),[I,0]),u.drawArrays(u.TRIANGLES,0,this.spriteVertices.length/2);u.disable(u.BLEND)}}function Fp({fetchId:s,feature:u,isCurrentLocation:g,localeCode:x}){return{type:"Feature",geometry:u.geometry,properties:{fetchId:s,isCurrentLocation:g,locationId:u.properties.id,name:rT({names:u.properties.names,localeCode:x}),category:u.properties.category,priority:g?0:Number.MAX_SAFE_INTEGER-u.properties.weight,weight:u.properties.weight,intervals:JSON.stringify(u.properties.forecast)}}}function rT({names:s,localeCode:u}){if(typeof s[u]=="string")return s[u];const g=["nb","nn","en","iv","sm"];for(const x of g)if(typeof s[x]=="string")return s[x];return""}function nT(){let s=Hm({width:xh,height:vh});const u=Xh({canvas:s,willReadFrequently:!0}),g=u.getImageData(0,0,s.width,s.height);u.lineWidth=2,u.strokeRect(0,0,xh,vh);const x=xh/2,I=vh/2-om;u.beginPath(),u.moveTo(x-6,I-6),u.lineTo(x+6,I+6),u.moveTo(x-6,I+6),u.lineTo(x+6,I-6),u.lineWidth=1.5,u.strokeStyle="red",u.stroke();const z=u.getImageData(0,0,s.width,s.height);return s.width=0,s.height=0,s=null,{emptyImage:g,debugImage:z}}class aT extends im{constructor({id:u,map:g,locationId:x,localeCode:I}){super(),this.type="custom",this.isFetching=!1,this.currentFetchId=-1,this.isMoving=!1,this.currentLocationIntervalIndex=0,this.handleMapEvent=o=>{var G;o.type==="map:units"&&((G=this.program)===null||G===void 0||G.setUnits(o.units))},this.dispatchWeatherLayerDescriptionValues=o=>{this.dispatchEvent({type:"weather-layer:description-values",descriptionValues:o})},this.handleResize=()=>{if(this.program==null)return;const{width:o,height:G}=this.map.maplibregl.getCanvas();this.program.setSize({width:o,height:G})},this.handleMoveStart=()=>{this.isMoving=!0},this.handleMoveEnd=()=>{this.isMoving=!1,this.fetchSourceData()},this.id=u,this.map=g,this.locationId=x,this.localeCode=I;const{emptyImage:z,debugImage:R}=nT();this.emptyImage=z,this.debugImage=R,this.dispatchWeatherLayerDescriptionValuesThrottled=sm(this.dispatchWeatherLayerDescriptionValues,1e3)}getCurrentIndex(){return this.currentLocationIntervalIndex}getIntervals(){if(this.currentFeature==null)return;const{forecast:u}=this.currentFeature.properties;return u.map(g=>{const{start:x,end:I}=g;return{start:x,end:I}})}setShowBoundingBox(u){this.map.maplibregl.setLayoutProperty("weather-feature-layer-id","icon-image",u?"weather-feature-layer-debug-image":"weather-feature-layer-empty-image")}setShowWeight(u){var g;(g=this.program)===null||g===void 0||g.setShowWeight(u),this.map.maplibregl.triggerRepaint()}setShowSpriteSheet(u){var g;(g=this.program)===null||g===void 0||g.setShowSpriteSheetCanvas(u)}setShowSpriteOutline(u){var g;(g=this.program)===null||g===void 0||g.setShowSpriteOutline(u),this.map.maplibregl.triggerRepaint()}setShowOverlap(u){this.map.maplibregl.setLayoutProperty("weather-feature-layer-id","icon-allow-overlap",u)}setActiveIntervalIndex(u){this.setCurrentLocationIntervalIndex(u)}getLocations(){var u;if(this.map.maplibregl.getLayer("weather-feature-layer-id")==null)return{};const g=this.map.maplibregl.queryRenderedFeatures(void 0,{layers:["weather-feature-layer-id"]});if(g.length===0)return{};if(((u=g[0].properties)===null||u===void 0?void 0:u.fetchId)!==this.currentFetchId)return;const x={};for(const I of g){if(I.properties==null)continue;const z=I.properties,R=I.geometry;R.type==="Point"&&x[z.locationId]==null&&(x[z.locationId]={isCurrentLocation:z.isCurrentLocation,name:z.name,category:z.category,position:{lat:R.coordinates[1],lon:R.coordinates[0]},weight:z.weight,intervals:JSON.parse(z.intervals)},z.isCurrentLocation&&(this.currentLocation=x[z.locationId]))}return x}setCurrentLocationIntervalIndex(u){u!==this.currentLocationIntervalIndex&&(this.currentLocationIntervalIndex=u,this.program!=null&&this.program.setActiveIntervalIndex(this.currentLocationIntervalIndex),this.dispatchEvent({type:"weather-layer:active-interval-index",index:this.currentLocationIntervalIndex}))}fetchCurrentMapFeature({signal:u}){return qn(this,void 0,void 0,function*(){const g=`/api/v0/locations/${this.locationId}/mapfeature`,x=yield window.fetch(g,{signal:u});if(x.ok===!1)throw new Error("Unable to fetch current map feature");return yield x.json()})}fetchWeatherMapFeatureCollection({tile:u,signal:g}){return qn(this,void 0,void 0,function*(){const x=`/api/v0/areamap/mercator/${u.z}/${u.x}/${u.y}`;try{const I=yield window.fetch(x,{signal:g});return I.ok===!1?void 0:yield I.json()}catch{return}})}fetchSourceData(){return qn(this,void 0,void 0,function*(){try{this.abortController!=null&&this.abortController.abort(),this.isFetching=!0;const u=this.currentFetchId+1,g=new AbortController;this.abortController=g;const{tiles:x}=ax({map:this.map.maplibregl}),I=x.map(o=>this.fetchWeatherMapFeatureCollection({tile:o,signal:g.signal}));this.currentFeature=yield this.fetchCurrentMapFeature({signal:g.signal}),this.dispatchCurrentFeatureIntervals();const z=yield Promise.all(I);if(g.signal.aborted)return;const R=[Fp({fetchId:u,feature:this.currentFeature,isCurrentLocation:!0,localeCode:this.localeCode})];for(const o of z)if(o!=null)for(const G of o.features)R.push(Fp({fetchId:u,feature:G,isCurrentLocation:!1,localeCode:this.localeCode}));this.map.maplibregl.getSource("weather-feature-layer-source-id").setData({type:"FeatureCollection",features:R}),this.isFetching=!1,this.currentFetchId=u}catch{this.isFetching=!1}})}dispatchCurrentFeatureIntervals(){if(this.currentFeature==null)return;const{forecast:u}=this.currentFeature.properties;if(this.dispatchedIntervalStart!==u[0].start){const g=this.getIntervals();if(g==null)return;this.dispatchEvent({type:"weather-layer:intervals",intervals:g}),this.dispatchedIntervalStart=u[0].start}}onAdd(u,g){const{width:x,height:I}=u.getCanvas();this.map.maplibregl.hasImage("weather-feature-layer-empty-image")===!1&&this.map.maplibregl.addImage("weather-feature-layer-empty-image",this.emptyImage),this.map.maplibregl.hasImage("weather-feature-layer-debug-image")===!1&&this.map.maplibregl.addImage("weather-feature-layer-debug-image",this.debugImage),this.map.maplibregl.getSource("weather-feature-layer-source-id")==null&&this.map.maplibregl.addSource("weather-feature-layer-source-id",{type:"geojson",data:{type:"FeatureCollection",features:[]}}),this.map.maplibregl.getLayer("weather-feature-layer-id")==null&&this.map.maplibregl.addLayer({id:"weather-feature-layer-id",type:"symbol",source:"weather-feature-layer-source-id",layout:{"icon-image":"weather-feature-layer-empty-image","icon-padding":0,"symbol-sort-key":["get","priority"],"icon-offset":[0,om]}}),this.program==null&&(this.program=new iT({map:this.map,gl:g,mapSize:{width:x,height:I},activeIntervalIndex:this.currentLocationIntervalIndex})),this.fetchSourceData(),this.map.addEventListener(this.handleMapEvent),this.map.maplibregl.on("resize",this.handleResize),this.map.maplibregl.on("movestart",this.handleMoveStart),this.map.maplibregl.on("moveend",this.handleMoveEnd)}onRemove(){var u;(u=this.program)===null||u===void 0||u.setLocations({locations:{}}),this.map.maplibregl.getLayer("weather-feature-layer-id")!=null&&this.map.maplibregl.removeLayer("weather-feature-layer-id"),this.map.maplibregl.getSource("weather-feature-layer-source-id")!=null&&this.map.maplibregl.removeSource("weather-feature-layer-source-id"),this.map.maplibregl.hasImage("weather-feature-layer-empty-image")&&this.map.maplibregl.removeImage("weather-feature-layer-empty-image"),this.map.maplibregl.hasImage("weather-feature-layer-debug-image")&&this.map.maplibregl.removeImage("weather-feature-layer-debug-image"),this.map.removeEventListener(this.handleMapEvent),this.map.maplibregl.off("resize",this.handleResize),this.map.maplibregl.off("movestart",this.handleMoveStart),this.map.maplibregl.off("moveend",this.handleMoveEnd)}prerender(u,g){if(this.program!=null){if(this.isMoving===!1&&this.isFetching===!1){const x=this.getLocations();if(x!=null&&this.currentLocation!=null){const I=U0({currentLocation:this.currentLocation,locations:x,activeIntervalIndex:this.currentLocationIntervalIndex,units:this.map.units});this.dispatchWeatherLayerDescriptionValuesThrottled(I),this.program.setLocations({locations:x})}}this.program.prerender({gl:u})}}render(u,g){this.program!=null&&this.program.render({gl:u,matrix:g})}}function Do(s){window.webkit!=null&&window.webkit?.messageHandlers?.appInterface?.postMessage(s),window.apiInterface!=null&&window.apiInterface?.postMessage(s)}const sT="overlay-tiles-layer",oT={version:8,sources:{"basemap-tiles":{type:"raster",tiles:["https://a-kartcache.nrk.no/tiles/yr_basemap_mercator_2019_512/{z}/{x}/{y}.jpg"],tileSize:512,minzoom:0,maxzoom:10},"overlay-tiles":{type:"raster",tiles:["https://a-kartcache.nrk.no/tiles/yr_overlay_mercator_2019_512/{z}/{x}/{y}.png"],tileSize:512,minzoom:0,maxzoom:10}},layers:[{id:"basemap-tiles-layer",type:"raster",source:"basemap-tiles"},{id:"overlay-tiles-layer",type:"raster",source:"overlay-tiles"}]},lT="radar";function cT({map:s,apiData:u}){const g=new $_({id:lT,map:s,apiData:u});return g.addEventListener(x=>{Do(x),Do({...x,type:x.type.replace("radar-layer:","precipitation-layer:")})}),s.addLayer({layer:g,renderBeforeId:sT,zoomLevels:{initial:5,min:3,max:10},showPin:!0,styleId:"default"}),g}function hT({descriptionValues:s,units:u,translate:g}){const x={distance:g(`units/distance/${u.distance}`),temperature:g(`units/temperature/${u.temperature}`),wind:g(`units/wind/${u.wind}`)};return`${s.map(z=>{const{name:R,distance:o,direction:G,temperature:K,symbol:ge,wind:ae}=z,H=[];H.push(g("description/locationLabel",{name:R,unit:x.distance,distance:o,direction:g(`direction/${G}`)})),H.push(g("description/temperatureLabel",{temperature:K,unit:x.temperature})),ge!=null&&H.push(g(`symbols/s${ge.slice(0,2)}`));const ke=g(`wind/type/${ae.type}`);return H.push(g("description/windLabel",{speed:ae.speed,unit:x.wind,type:ke,direction:g(`direction/${ae.direction}`)})),H.join(", ")}).join(". ")}.`}const uT="weather";function dT({map:s,localeCode:u,translate:g,locationId:x,units:I}){const z=new aT({id:uT,map:s,locationId:x,localeCode:u});return z.addEventListener(R=>{if(R.type==="weather-layer:description-values"){const o=hT({descriptionValues:R.descriptionValues,units:I,translate:g});Do({type:"weather-layer:description",description:o});return}Do(R)}),s.addLayer({layer:z,zoomLevels:{initial:5,min:2,max:10},styleId:"default"}),z}const pT=150;class mT{constructor({localeCode:u}){this.localeCode=u;const g=document.createElement("div");g.className="scale-line",g.style.display="none";const x=document.createElement("div");x.className="scale-line__values",g.appendChild(x);const I=document.createElement("div");I.className="scale-line__min-value",I.textContent="0",x.appendChild(I);const z=document.createElement("div");z.className="scale-line__max-value",x.appendChild(z);const R=document.createElement("div");R.className="scale-line__line",g.appendChild(R),document.body.appendChild(g),this.rootElement=g,this.maxElement=z,this.lineElement=R}setScale({ratio:u,distance:g,unit:x,translate:I}){const z=I(`scaleLine/${x}`);this.maxElement.textContent=`${g} ${z}`,this.lineElement.style.width=`${u*pT}px`,this.rootElement.style.display=""}}function fT({element:s,localeCode:u,translate:g,position:x,units:I}){const z=new Iy({center:x,mapElement:s,theme:{font:{family:"-apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif",weight:"500"},colors:{temperatureCold:"#006edb",temperatureWarm:"#c60000",wind:"#21292b"}},classNames:{parent:"marker",pin:"marker__pin",shadow:"marker__shadow"},units:{distance:I.distance,wind:I.wind,temperature:I.temperature},assets:{weatherSymbolsPath:"../assets/images/map/weather-symbols",pin:{iconUrl:"../assets/images/map/pin.png",shadowUrl:"../assets/images/map/shadow.png"}}});z.addStyle({id:"default",style:oT});const R=new mT({localeCode:u});return z.addEventListener(o=>{o.type==="map:webgl-context-lost"&&(s.innerHTML=""),o.type==="map:scale"&&R.setScale({...o,translate:g}),Do(o)}),z.maplibregl.on("load",()=>{z.maplibregl.resize()}),z}const gT={"dailyWeatherList/headings/afternoon":"Afternoon","dailyWeatherList/headings/evening":"Evening","dailyWeatherList/headings/morning":"Morning","dailyWeatherList/headings/night":"Night","description/locationLabel":[["name"]," (",["distance"]," ",["unit"]," ",["direction"],")"],"description/temperatureLabel":[["temperature"],["unit"]],"description/windLabel":[["speed"]," ",["unit"]," ",["type"]," from ",["direction"]],"direction/e":"east","direction/label":"from","direction/n":"north","direction/ne":"north east","direction/nw":"north west","direction/s":"south","direction/se":"south east","direction/sw":"south west","direction/w":"west","mapPage/types/radar/name":"Precipitation map","mapPage/types/weather/name":"Weather map","print/table/headers/symbolSecondHalf":"12\u201300","scaleLine/feet":"ft","scaleLine/kilometers":"km","scaleLine/meters":"m","scaleLine/miles":"mi","scaleLine/nautical-miles":"nm","symbols/s01":"clear sky","symbols/s02":"fair","symbols/s03":"partly cloudy","symbols/s04":"cloudy","symbols/s05":"rain showers","symbols/s06":"rain showers and thunder","symbols/s07":"sleet showers","symbols/s08":"snow showers","symbols/s09":"rain","symbols/s10":"heavy rain","symbols/s11":"heavy rain and thunder","symbols/s12":"sleet","symbols/s13":"snow","symbols/s14":"snow and thunder","symbols/s15":"fog","symbols/s20":"sleet showers and thunder","symbols/s21":"snow showers and thunder","symbols/s22":"rain and thunder","symbols/s23":"sleet and thunder","symbols/s24":"light rain showers and thunder","symbols/s25":"heavy rain showers and thunder","symbols/s26":"light sleet showers and thunder","symbols/s27":"heavy sleet showers and thunder","symbols/s28":"light snow showers and thunder","symbols/s29":"heavy snow showers and thunder","symbols/s30":"light rain and thunder","symbols/s31":"light sleet and thunder","symbols/s32":"heavy sleet and thunder","symbols/s33":"light snow and thunder","symbols/s34":"heavy snow and thunder","symbols/s40":"light rain showers","symbols/s41":"heavy rain showers","symbols/s42":"light sleet showers","symbols/s43":"heavy sleet showers","symbols/s44":"light snow showers","symbols/s45":"heavy snow showers","symbols/s46":"light rain","symbols/s47":"light sleet","symbols/s48":"heavy sleet","symbols/s49":"light snow","symbols/s50":"heavy snow","units/distance/km":"km","units/distance/mi":"mi","units/temperature/celsius":"\xB0C","units/temperature/fahrenheit":"\xB0F","units/wind/beaufort":"bft","units/wind/kmh":"km/h","units/wind/knots":"kt","units/wind/mph":"mph","units/wind/mps":"m/s","wind/gustDescription":["with gusts at ",["gust"]," m/s"],"wind/type/calm":"calm","wind/type/fresh breeze":"fresh breeze","wind/type/fresh gale":"fresh gale","wind/type/gentle breeze":"gentle breeze","wind/type/hurricane":"hurricane","wind/type/light air":"light air","wind/type/light breeze":"light breeze","wind/type/moderate breeze":"moderate breeze","wind/type/moderate gale":"moderate gale","wind/type/storm":"storm","wind/type/strong breeze":"strong breeze","wind/type/strong gale":"strong gale","wind/type/violent storm":"violent storm"},yT={"dailyWeatherList/headings/afternoon":"Ettermiddag","dailyWeatherList/headings/evening":"Kveld","dailyWeatherList/headings/morning":"Morgen","dailyWeatherList/headings/night":"Natt","description/locationLabel":[["name"]," (",["distance"]," ",["unit"]," ",["direction"],")"],"description/temperatureLabel":[["temperature"],["unit"]],"description/windLabel":[["speed"]," ",["unit"]," ",["type"]," fra ",["direction"]],"direction/e":"\xF8st","direction/label":"fra","direction/n":"nord","direction/ne":"nord\xF8st","direction/nw":"nordvest","direction/s":"s\xF8r","direction/se":"s\xF8r\xF8st","direction/sw":"s\xF8rvest","direction/w":"vest","mapPage/types/radar/name":"Nedb\xF8rkart","mapPage/types/weather/name":"V\xE6rkart","print/table/headers/symbolSecondHalf":"Kl. 12\u201300","scaleLine/feet":"ft","scaleLine/kilometers":"km","scaleLine/meters":"m","scaleLine/miles":"mi","scaleLine/nautical-miles":"nm","symbols/s01":"klarv\xE6r","symbols/s02":"lettskyet","symbols/s03":"delvis skyet","symbols/s04":"skyet","symbols/s05":"regnbyger","symbols/s06":"regnbyger og torden","symbols/s07":"sluddbyger","symbols/s08":"sn\xF8byger","symbols/s09":"regn","symbols/s10":"kraftig regn","symbols/s11":"kraftig regn og torden","symbols/s12":"sludd","symbols/s13":"sn\xF8","symbols/s14":"sn\xF8 og torden","symbols/s15":"t\xE5ke","symbols/s20":"sluddbyger og torden","symbols/s21":"sn\xF8byger og torden","symbols/s22":"regn og torden","symbols/s23":"sludd og torden","symbols/s24":"lette regnbyger og torden","symbols/s25":"kraftige regnbyger og torden","symbols/s26":"lette sluddbyger og torden","symbols/s27":"kraftige sluddbyger og torden","symbols/s28":"lette sn\xF8byger og torden","symbols/s29":"kraftige sn\xF8byger og torden","symbols/s30":"lett regn og torden","symbols/s31":"lett sludd og torden","symbols/s32":"kraftig sludd og torden","symbols/s33":"lett sn\xF8 og torden","symbols/s34":"kraftig sn\xF8 og torden","symbols/s40":"lette regnbyger","symbols/s41":"kraftige regnbyger","symbols/s42":"lette sluddbyger","symbols/s43":"kraftige sluddbyger","symbols/s44":"lette sn\xF8byger","symbols/s45":"kraftige sn\xF8byger","symbols/s46":"lett regn","symbols/s47":"lett sludd","symbols/s48":"kraftig sludd","symbols/s49":"lett sn\xF8","symbols/s50":"kraftig sn\xF8","units/distance/km":"km","units/distance/mi":"mi","units/temperature/celsius":"\xB0C","units/temperature/fahrenheit":"\xB0F","units/wind/beaufort":"bft","units/wind/kmh":"km/t","units/wind/knots":"kn","units/wind/mph":"mph","units/wind/mps":"m/s","wind/gustDescription":["med vindkast p\xE5 ",["gust"]," m/s"],"wind/type/calm":"stille","wind/type/fresh breeze":"frisk bris","wind/type/fresh gale":"sterk kuling","wind/type/gentle breeze":"lett bris","wind/type/hurricane":"orkan","wind/type/light air":"flau vind","wind/type/light breeze":"svak vind","wind/type/moderate breeze":"laber bris","wind/type/moderate gale":"stiv kuling","wind/type/storm":"full storm","wind/type/strong breeze":"liten kuling","wind/type/strong gale":"liten storm","wind/type/violent storm":"sterk storm"},_T={"dailyWeatherList/headings/afternoon":"Ettermiddag","dailyWeatherList/headings/evening":"Kveld","dailyWeatherList/headings/morning":"Morgen","dailyWeatherList/headings/night":"Natt","description/locationLabel":[["name"]," (",["distance"]," ",["unit"]," ",["direction"],")"],"description/temperatureLabel":[["temperature"],["unit"]],"description/windLabel":[["speed"]," ",["unit"]," ",["type"]," fra ",["direction"]],"direction/e":"aust","direction/label":"fr\xE5","direction/n":"nord","direction/ne":"nordaust","direction/nw":"nordvest","direction/s":"s\xF8r","direction/se":"s\xF8raust","direction/sw":"s\xF8rvest","direction/w":"vest","mapPage/types/radar/name":"Nedb\xF8rkart","mapPage/types/weather/name":"V\xEArkart","print/table/headers/symbolSecondHalf":"Kl. 12\u201300","scaleLine/feet":"ft","scaleLine/kilometers":"km","scaleLine/meters":"m","scaleLine/miles":"mi","scaleLine/nautical-miles":"nm","symbols/s01":"kl\xE5rv\xEAr","symbols/s02":"lettskya","symbols/s03":"delvis skya","symbols/s04":"skya","symbols/s05":"regnbyer","symbols/s06":"regnbyer og torev\xEAr","symbols/s07":"sluddbyer","symbols/s08":"sn\xF8byer","symbols/s09":"regn","symbols/s10":"kraftig regn","symbols/s11":"kraftig regn og torev\xEAr","symbols/s12":"sludd","symbols/s13":"sn\xF8","symbols/s14":"sn\xF8 og torev\xEAr","symbols/s15":"skodde","symbols/s20":"sluddbyer og torev\xEAr","symbols/s21":"sn\xF8byer og torev\xEAr","symbols/s22":"regn og torev\xEAr","symbols/s23":"sludd og torev\xEAr","symbols/s24":"lette regnbyer og torev\xEAr","symbols/s25":"kraftige regnbyer og torev\xEAr","symbols/s26":"lette sluddbyer og torev\xEAr","symbols/s27":"kraftige sluddbyer og torev\xEAr","symbols/s28":"lette sn\xF8byer og torev\xEAr","symbols/s29":"kraftige sn\xF8byer og torev\xEAr","symbols/s30":"lett regn og torev\xEAr","symbols/s31":"lett sludd og torev\xEAr","symbols/s32":"kraftig sludd og torev\xEAr","symbols/s33":"lett sn\xF8 og torev\xEAr","symbols/s34":"kraftig sn\xF8 og torev\xEAr","symbols/s40":"lette regnbyer","symbols/s41":"kraftige regnbyer","symbols/s42":"lette sluddbyer","symbols/s43":"kraftige sluddbyer","symbols/s44":"lette sn\xF8byer","symbols/s45":"kraftige sn\xF8byer","symbols/s46":"lett regn","symbols/s47":"lett sludd","symbols/s48":"kraftig sludd","symbols/s49":"lett sn\xF8","symbols/s50":"kraftig sn\xF8","units/distance/km":"km","units/distance/mi":"mi","units/temperature/celsius":"\xB0C","units/temperature/fahrenheit":"\xB0F","units/wind/beaufort":"bft","units/wind/kmh":"km/t","units/wind/knots":"kn","units/wind/mph":"mph","units/wind/mps":"m/s","wind/gustDescription":["med vindkast p\xE5 ",["gust"]," m/s"],"wind/type/calm":"stille","wind/type/fresh breeze":"frisk bris","wind/type/fresh gale":"sterk kuling","wind/type/gentle breeze":"lett bris","wind/type/hurricane":"orkan","wind/type/light air":"flau vind","wind/type/light breeze":"svak vind","wind/type/moderate breeze":"laber bris","wind/type/moderate gale":"stiv kuling","wind/type/storm":"full storm","wind/type/strong breeze":"liten kuling","wind/type/strong gale":"liten storm","wind/type/violent storm":"sterk storm"};const su=document.querySelector("#app");if(su==null)throw new Error("#app not found");const{locationId:Ym,localeCode:uc,visibleMapType:xT,units:Km,backgroundColor:Op}=Qg();Op!=null&&(su.style.backgroundColor=`#${Op}`);Kh("nb",yT);Kh("nn",_T);Kh("en",gT);const Jm=wy(uc),vT=await Gg(),bT=await qg({localeCode:uc,locationId:Ym}),Vn=fT({element:su,localeCode:uc,translate:Jm,position:bT.position,units:Km}),Hl=cT({map:Vn,apiData:vT}),Qm=dT({map:Vn,localeCode:uc,translate:Jm,locationId:Ym,units:Km});Vn.showLayer(xT==="radar"?Hl.id:Qm.id);window.sendWebViewEvent=function(s){if(Vn==null)throw new Error("Map does not exist");switch(s.type){case"map:set-map-type":{Vn.showLayer(s.mapType);break}case"map:set-units":{Vn.setUnits(s.units);break}case"map:zoom-in":{Vn.zoomIn();break}case"map:zoom-out":{Vn.zoomOut();break}case"precipitation-layer:play":case"radar-layer:play":{Hl.play();break}case"precipitation-layer:pause":case"radar-layer:pause":{Hl.pause();break}case"precipitation-layer:set-current-frame":case"radar-layer:set-current-frame":{Hl.setCurrentFrameIndex(s.frameIndex);break}case"weather-layer:set-active-interval-index":{Qm.setActiveIntervalIndex(s.index);break}}};
