const m_=function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const _ of document.querySelectorAll('link[rel="modulepreload"]'))f(_);new MutationObserver(_=>{for(const w of _)if(w.type==="childList")for(const I of w.addedNodes)I.tagName==="LINK"&&I.rel==="modulepreload"&&f(I)}).observe(document,{childList:!0,subtree:!0});function c(_){const w={};return _.integrity&&(w.integrity=_.integrity),_.referrerpolicy&&(w.referrerPolicy=_.referrerpolicy),_.crossorigin==="use-credentials"?w.credentials="include":_.crossorigin==="anonymous"?w.credentials="omit":w.credentials="same-origin",w}function f(_){if(_.ep)return;_.ep=!0;const w=c(_);fetch(_.href,w)}};m_();const f_="https://prod.yr-maps.met.no/api/precipitation-nowcast/available.json",g_="https://prod.yr-maps.met.no/api/precipitation-observations/available.json";async function y_(){return(await fetch(g_)).json()}async function __(){return(await fetch("/api/v0/lightning-events")).json()}async function x_(){return(await fetch(f_)).json()}async function v_(){return(await fetch("https://tiles.yr.no/api/wind/available.json")).json()}async function b_(){return(await fetch("https://prod.yr-maps.met.no/api/air-temperature/")).json()}async function w_({localeCode:a,locationId:n}){return(await fetch(`/api/v0/locations/${n}?language=${a}`)).json()}function S_(){if(!("matchMedia"in window))return!1;const a=window.matchMedia("(prefers-color-scheme: dark)");return a==null?!1:a.matches}const T_=["en","nb","nn","sme"];function C_(a){return T_.includes(a)}const I_=["imperial","metric"],E_=["beaufort","kmh","knots","mph","mps"],A_=["celsius","fahrenheit"];function P_(a){return I_.includes(a)}function M_(a){return E_.includes(a)}function z_(a){return A_.includes(a)}function k_(){const a=new URLSearchParams(location.search),n=a.get("locationId");if(n==null)throw new Error("Missing locationId from params");const c=a.get("layer"),f=a.get("localeCode"),_=a.get("length"),w=a.get("wind"),I=a.get("temperature"),l=a.get("background")??void 0,D=a.get("mode");let B=D!=null&&D_(D)?D:"system";return B==="system"&&(B=S_()===!0?"dark":"light"),{locationId:n,visibleMapType:c!=null&&L_(c)?c:"weather",localeCode:f!=null&&C_(f)?f:"nb",units:{distance:_!=null&&P_(_)?_:"metric",temperature:I!=null&&z_(I)?I:"celsius",wind:w!=null&&M_(w)?w:"mps"},backgroundColor:l,mode:B}}function L_(a){return["radar","weather","wind","lightning","temperature"].includes(a)}function D_(a){return["light","dark","system"].includes(a)}function of(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function")}function Ap(a,n){for(var c=0;c<n.length;c++){var f=n[c];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(a,f.key,f)}}function af(a,n,c){return n&&Ap(a.prototype,n),c&&Ap(a,c),Object.defineProperty(a,"prototype",{writable:!1}),a}function Tu(a,n){return Tu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(f,_){return f.__proto__=_,f},Tu(a,n)}function R_(a,n){if(typeof n!="function"&&n!==null)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(n&&n.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),Object.defineProperty(a,"prototype",{writable:!1}),n&&Tu(a,n)}function Cu(a){return Cu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},Cu(a)}function F_(a){if(a===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function B_(a,n){if(n&&(Cu(n)==="object"||typeof n=="function"))return n;if(n!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return F_(a)}function Pc(a){return Pc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(c){return c.__proto__||Object.getPrototypeOf(c)},Pc(a)}function O_(a){if(Array.isArray(a))return a}function U_(a,n){var c=a==null?null:typeof Symbol<"u"&&a[Symbol.iterator]||a["@@iterator"];if(c!=null){var f=[],_=!0,w=!1,I,l;try{for(c=c.call(a);!(_=(I=c.next()).done)&&(f.push(I.value),!(n&&f.length===n));_=!0);}catch(D){w=!0,l=D}finally{try{!_&&c.return!=null&&c.return()}finally{if(w)throw l}}return f}}function Pp(a,n){(n==null||n>a.length)&&(n=a.length);for(var c=0,f=new Array(n);c<n;c++)f[c]=a[c];return f}function $_(a,n){if(!!a){if(typeof a=="string")return Pp(a,n);var c=Object.prototype.toString.call(a).slice(8,-1);if(c==="Object"&&a.constructor&&(c=a.constructor.name),c==="Map"||c==="Set")return Array.from(a);if(c==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c))return Pp(a,n)}}function N_(){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 V_(a,n){return O_(a)||U_(a,n)||$_(a,n)||N_()}function G_(a,n){if(a==null)return{};var c={},f=Object.keys(a),_,w;for(w=0;w<f.length;w++)_=f[w],!(n.indexOf(_)>=0)&&(c[_]=a[_]);return c}function Mp(a,n){if(a==null)return{};var c=G_(a,n),f,_;if(Object.getOwnPropertySymbols){var w=Object.getOwnPropertySymbols(a);for(_=0;_<w.length;_++)f=w[_],!(n.indexOf(f)>=0)&&(!Object.prototype.propertyIsEnumerable.call(a,f)||(c[f]=a[f]))}return c}var sn=function(a){return typeof a=="string"},Iu=function(a){return typeof a=="function"},zp=new Map,kp=new Map;function Nu(a){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},c=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2];return function(f){if(sn(f)&&(f=new Date(f)),c){var _=sf(a,n),w=kp.get(_);if(w)return w.format(f);var I=new Intl.DateTimeFormat(a,n);return kp.set(_,I),I.format(f)}var l=new Intl.DateTimeFormat(a,n);return l.format(f)}}function Mc(a){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},c=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2];return function(f){if(c){var _=sf(a,n),w=zp.get(_);if(w)return w.format(f);var I=new Intl.NumberFormat(a,n);return zp.set(_,I),I.format(f)}var l=new Intl.NumberFormat(a,n);return l.format(f)}}function sf(a){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},c=Array.isArray(a)?a.sort().join("-"):a;return"".concat(c,"-").concat(JSON.stringify(n))}Object.freeze({__proto__:null,date:Nu,number:Mc});var lf=/\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/g;function Z_(a){var n=a.locale,c=a.locales,f=a.values,_=a.formats,w=a.localeData,I=function(l,D){var B=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{plurals:void 0},J=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};D=D||l;var K=B.plurals,Z=function(be){return sn(be)?J[be]||{style:be}:be},we=function(be,Ae){return function(Fe){var $e=Iu(Ae)?Ae(Fe):Ae,Ve=Array.isArray($e)?$e:[$e],Ge=Mc(D)(be);return Ve.map(function(lt){return sn(lt)?lt.replace("#",Ge):lt})}};return K||console.error("Plurals for locale ".concat(l," aren't loaded. Use i18n.loadLocaleData method to load plurals for specific locale. Using other plural rule as a fallback.")),{plural:function(be,Ae){var Fe=Ae.offset,$e=Fe===void 0?0:Fe,Ve=Mp(Ae,["offset"]),Ge=Ve[be]||Ve[K?.(be-$e)]||Ve.other;return we(be-$e,Ge)},selectordinal:function(be,Ae){var Fe=Ae.offset,$e=Fe===void 0?0:Fe,Ve=Mp(Ae,["offset"]),Ge=Ve[be]||Ve[K?.(be-$e,!0)]||Ve.other;return we(be-$e,Ge)},select:function(be,Ae){return Ae[be]||Ae.other},number:function(be,Ae){return Mc(D,Z(Ae))(be)},date:function(be,Ae){return Nu(D,Z(Ae))(be)},undefined:function(be){return be}}}(n,c,w,_);return function l(D,B,J){var K=f[D],Z=I[B](K,J),we=Iu(Z)?Z(l):Z;return Array.isArray(we)?we.join(""):we}}function H_(a,n,c,f){return function(_){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},I=Z_({locale:n,locales:c,localeData:f,formats:w,values:_}),l=function B(J){return Array.isArray(J)?J.reduce(function(K,Z){if(sn(Z))return K+Z;var we=V_(Z,3),be=we[0],Ae=we[1],Fe=we[2],$e={};Fe==null||sn(Fe)?$e=Fe:Object.keys(Fe).forEach(function(Ge){$e[Ge]=B(Fe[Ge])});var Ve=I(be,Ae,$e);return Ve==null?K:K+Ve},""):J},D=l(a);return sn(D)&&lf.test(D)?JSON.parse('"'.concat(D.trim(),'"')):sn(D)?D.trim():D}}var j_=function(){function a(){of(this,a),this._events={}}return af(a,[{key:"on",value:function(n,c){var f=this;return this._hasEvent(n)||(this._events[n]=[]),this._events[n].push(c),function(){return f.removeListener(n,c)}}},{key:"removeListener",value:function(n,c){if(this._hasEvent(n)){var f=this._events[n].indexOf(c);~f&&this._events[n].splice(f,1)}}},{key:"emit",value:function(n){for(var c=this,f=arguments.length,_=new Array(f>1?f-1:0),w=1;w<f;w++)_[w-1]=arguments[w];this._hasEvent(n)&&this._events[n].map(function(I){return I.apply(c,_)})}},{key:"_hasEvent",value:function(n){return Array.isArray(this._events[n])}}]),a}();function q_(a){var n=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 c,f=Pc(a);if(n){var _=Pc(this).constructor;c=Reflect.construct(f,arguments,_)}else c=f.apply(this,arguments);return B_(this,c)}}var W_=function(a){R_(c,a);var n=q_(c);function c(f){var _;return of(this,c),_=n.call(this),_._messages={},_._localeData={},f.missing!=null&&(_._missing=f.missing),f.messages!=null&&_.load(f.messages),f.localeData!=null&&_.loadLocaleData(f.localeData),f.locale==null&&f.locales==null||_.activate(f.locale,f.locales),_}return af(c,[{key:"_loadLocaleData",value:function(f,_){this._localeData[f]==null?this._localeData[f]=_:Object.assign(this._localeData[f],_)}},{key:"loadLocaleData",value:function(f,_){var w=this;_!=null?this._loadLocaleData(f,_):Object.keys(f).forEach(function(I){return w._loadLocaleData(I,f[I])}),this.emit("change")}},{key:"_load",value:function(f,_){this._messages[f]==null?this._messages[f]=_:Object.assign(this._messages[f],_)}},{key:"load",value:function(f,_){var w=this;_!=null?this._load(f,_):Object.keys(f).forEach(function(I){return w._load(I,f[I])}),this.emit("change")}},{key:"activate",value:function(f,_){this._locale=f,this._locales=_,this.emit("change")}},{key:"_",value:function(f){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},w=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},I=w.message,l=w.formats,D=w.context;sn(f)||(_=f.values||_,I=f.message,D=f.context,f=f.id);var B,J=!D&&!this.messages[f],K=D&&!this.messages[D][f],Z=K||J,we=this._missing;return we&&Z?Iu(we)?we(this._locale,f,D):we:(Z&&this.emit("missing",{id:f,context:D,locale:this._locale}),B=D&&!K?this.messages[D][f]||I||f:this.messages[f]||I||f,sn(B)&&lf.test(B)?JSON.parse('"'.concat(B,'"')):sn(B)?B:H_(B,this._locale,this._locales,this.localeData)(_,l))}},{key:"date",value:function(f,_){return Nu(this._locales||this._locale,_)(f)}},{key:"number",value:function(f,_){return Mc(this._locales||this._locale,_)(f)}},{key:"locale",get:function(){return this._locale}},{key:"locales",get:function(){return this._locales}},{key:"messages",get:function(){var f;return(f=this._messages[this._locale])!==null&&f!==void 0?f:{}}},{key:"localeData",get:function(){var f;return(f=this._localeData[this._locale])!==null&&f!==void 0?f:{}}}]),c}(j_);function cf(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return new W_(a)}cf();var Qs=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};const X_=cf;function hf(a,n){return n?"other":a==1?"one":"other"}function Y_(a,n){return n?"other":a==1?"one":a==2?"two":"other"}function K_(a,n){var c=String(a).split("."),f=!c[1],_=Number(c[0])==a,w=_&&c[0].slice(-1),I=_&&c[0].slice(-2);return n?w==1&&I!=11?"one":w==2&&I!=12?"two":w==3&&I!=13?"few":"other":a==1&&f?"one":"other"}const J_=hf,Q_=hf,e0=Y_,uf={},t0={nb:J_,nn:Q_,en:K_,sme:e0},nu={nb:"nb",nn:"nn",en:"en",sme:"se"},Vu=(a,n)=>{const c=X_({});c.loadLocaleData(nu[a],{plurals:t0[a]}),c.load(nu[a],n),c.activate(nu[a]),uf[a]={i18n:c,messages:n}};function i0(a){return(c,f)=>uf[a].i18n._(c,f)}function di(a,n,c,f){return new(c||(c=Promise))(function(_,w){function I(B){try{D(f.next(B))}catch(J){w(J)}}function l(B){try{D(f.throw(B))}catch(J){w(J)}}function D(B){var J;B.done?_(B.value):(J=B.value,J instanceof c?J:new c(function(K){K(J)})).then(I,l)}D((f=f.apply(a,n||[])).next())})}var Jr={};/**
 * A collection of Number utility functions
 * https://github.com/yr/number-utils
 * @copyright Yr
 * @license MIT
 */Jr.TWO_PI=Math.PI*2;Jr.HALF_PI=Math.PI*.5;Jr.degreesToRadians=function(a){return a*Math.PI/180};Jr.radiansToDegrees=function(a){return 180*a/Math.PI};var r0=Jr.normalize=function(a,n,c){return n===c?1:(a-n)/(c-n)},n0=Jr.interpolate=function(a,n,c){return n+(c-n)*a},o0=Jr.map=function(a,n,c,f,_){return n0(r0(a,n,c),f,_)};Jr.limit=function(a,n,c){return Math.min(Math.max(n,a),c)};Jr.rangedRandom=function(a,n){return o0(Math.random(),0,1,a,n)};Jr.round=function(a,n){if(a%1==0)return a;var c=a<0;if(a=Math.abs(a),!n)return Math.round(a)*(c?-1:1);var f=a.toString().split("."),_=f[0]+f[1].substr(0,n),w=f[1].slice(n),I=Math.round(w/Math.pow(10,w.length)),l=Math.pow(10,n||0);return f[1].length>n&&(a=(+_+I)/l),a*(c?-1:1)};/**
 * Simple geographic distance calculator
 * https://github.com/yr/geodist
 * @copyright Yr
 * @license MIT
 */var mc=Jr,Lp={feet:20908800,yards:6969600,miles:3960,mi:3960,kilometers:6371,km:6371,meters:6371e3,m:6371e3},Eu="meters",df=function(n,c,f){f=f||{};var _=a0(f.unit),w=mc.degreesToRadians(c.lat-n.lat),I=Math.sin(w*.5),l=mc.degreesToRadians(c.lon-n.lon),D=Math.sin(l*.5),B=mc.degreesToRadians(n.lat),J=mc.degreesToRadians(c.lat),K=I*I+D*D*Math.cos(B)*Math.cos(J),Z=2*Math.atan2(Math.sqrt(K),Math.sqrt(1-K)),we=_*Z;return f.exact||(we=Math.floor(we)),f.limit?f.limit>we:(f.format&&(we=we+" "+(f.unit||Eu)),we)};function a0(a){return a=a||Eu,a=a.toLowerCase(),Lp[a]||(a=Eu),Lp[a]}function Dp(a){var n=a.map,c=a.type,f=c===void 0?"metric":c,_=a.maxWidth,w=_===void 0?100:_,I=n.getContainer().clientHeight/2,l=n.unproject([0,I]),D=n.unproject([w,I]),B=l.distanceTo(D);if(f==="imperial"){var J=3.2808*B;return J>5280?Ws(J/5280,"miles"):Ws(J,"feet")}return f==="nautical"?Ws(B/1852,"nautical-miles"):B>=1e3?Ws(B/1e3,"kilometers"):Ws(B,"meters")}function Ws(a,n){var c,f,_,w=(c=a,(f=Math.pow(10,(""+Math.floor(c)).length-1))*(_=(_=c/f)>=10?10:_>=5?5:_>=3?3:_>=2?2:_>=1?1:function(I){var l=Math.pow(10,Math.ceil(-Math.log(I)/Math.LN10));return Math.round(I*l)/l}(_)));return{distance:w,ratio:w/a,unit:n}}var Ur={exports:{}};(function(a,n){(function(c,f){a.exports=f()})(Qs,function(){var c,f,_;function w(l,D){if(!c)c=D;else if(!f)f=D;else{var B="var sharedChunk = {}; ("+c+")(sharedChunk); ("+f+")(sharedChunk);",J={};c(J),_=D(J),typeof window<"u"&&(_.workerUrl=window.URL.createObjectURL(new Blob([B],{type:"text/javascript"})))}}w(["exports"],function(l){var D=B;function B(i,e,r,s){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*(s-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=e,this.p2x=r,this.p2y=s}function J(i,e,r,s){const u=new D(i,e,r,s);return function(m){return u.solve(m)}}B.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,s=0;s<8;s++){var u=this.sampleCurveX(r)-i;if(Math.abs(u)<e)return r;var m=this.sampleCurveDerivativeX(r);if(Math.abs(m)<1e-6)break;r-=u/m}var g=0,x=1;for(r=i,s=0;s<20&&(u=this.sampleCurveX(r),!(Math.abs(u-i)<e));s++)i>u?g=r:x=r,r=.5*(x-g)+g;return r},solve:function(i,e){return this.sampleCurveY(this.solveCurveX(i,e))}};const K=J(.25,.1,.25,1);function Z(i,e,r){return Math.min(r,Math.max(e,i))}function we(i,e,r){const s=r-e,u=((i-e)%s+s)%s+e;return u===e?r:u}function be(i,...e){for(const r of e)for(const s in r)i[s]=r[s];return i}let Ae=1;function Fe(i,e){i.forEach(r=>{e[r]&&(e[r]=e[r].bind(e))})}function $e(i,e,r){const s={};for(const u in i)s[u]=e.call(r||this,i[u],u,i);return s}function Ve(i,e,r){const s={};for(const u in i)e.call(r||this,i[u],u,i)&&(s[u]=i[u]);return s}function Ge(i){return Array.isArray(i)?i.map(Ge):typeof i=="object"&&i?$e(i,Ge):i}const lt={};function rt(i){lt[i]||(typeof console<"u"&&console.warn(i),lt[i]=!0)}function Xe(i,e,r){return(r.y-i.y)*(e.x-i.x)>(e.y-i.y)*(r.x-i.x)}function xt(i){let e=0;for(let r,s,u=0,m=i.length,g=m-1;u<m;g=u++)r=i[u],s=i[g],e+=(s.x-r.x)*(r.y+s.y);return e}function At(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}function pi(i){const e={};if(i.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(r,s,u,m)=>{const g=u||m;return e[s]=!g||g.toLowerCase(),""}),e["max-age"]){const r=parseInt(e["max-age"],10);isNaN(r)?delete e["max-age"]:e["max-age"]=r}return e}let Bi,Oi,Wt=null;function Bt(i){if(Wt==null){const e=i.navigator?i.navigator.userAgent:null;Wt=!!i.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return Wt}function Ht(i){return typeof ImageBitmap<"u"&&i instanceof ImageBitmap}const Ui={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"),s=r.getContext("2d");if(!s)throw new Error("failed to create canvas 2d context");return r.width=i.width,r.height=i.height,s.drawImage(i,0,0,i.width,i.height),s.getImageData(-e,-e,i.width+2*e,i.height+2*e)},resolveURL:i=>(Bi||(Bi=document.createElement("a")),Bi.href=i,Bi.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(Oi==null&&(Oi=matchMedia("(prefers-reduced-motion: reduce)")),Oi.matches)}};var Ye=pr;function pr(i,e){this.x=i,this.y=e}pr.prototype={clone:function(){return new pr(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),s=r*this.x+e*this.y;return this.x=e*this.x-r*this.y,this.y=s,this},_rotateAround:function(i,e){var r=Math.cos(i),s=Math.sin(i),u=e.y+s*(this.x-e.x)+r*(this.y-e.y);return this.x=e.x+r*(this.x-e.x)-s*(this.y-e.y),this.y=u,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},pr.convert=function(i){return i instanceof pr?i:Array.isArray(i)?new pr(i[0],i[1]):i};const qi={MAX_PARALLEL_IMAGE_REQUESTS:16,REGISTERED_PROTOCOLS:{}},rr="mapbox-tiles";let mr,hn,un=500,$r=50;function en(){typeof caches>"u"||mr||(mr=caches.open(rr))}let dn=1/0;const fr={supported:!1,testSupport:function(i){!Nn&&Vr&&(jo?uo(i):Nr=i)}};let Nr,Vr,Nn=!1,jo=!1;function uo(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,Vr),i.isContextLost())return;fr.supported=!0}catch{}i.deleteTexture(e),Nn=!0}typeof document<"u"&&(Vr=document.createElement("img"),Vr.onload=function(){Nr&&uo(Nr),Nr=null,jo=!0},Vr.onerror=function(){Nn=!0,Nr=null},Vr.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const qo={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};typeof Object.freeze=="function"&&Object.freeze(qo);class mi extends Error{constructor(e,r,s,u){super(`AJAXError: ${r} (${e}): ${s}`),this.status=e,this.statusText=r,this.url=s,this.body=u}}const tn=At()?()=>self.worker&&self.worker.referrer:()=>(window.location.protocol==="blob:"?window.parent:window).location.href;function po(i,e){const r=new AbortController,s=new Request(i.url,{method:i.method||"GET",body:i.body,credentials:i.credentials,headers:i.headers,referrer:tn(),signal:r.signal});let u=!1,m=!1;return i.type==="json"&&s.headers.set("Accept","application/json"),((g,x,b)=>{if(m)return;const C=Date.now();fetch(s).then(P=>P.ok?((z,L,F)=>{(i.type==="arrayBuffer"?z.arrayBuffer():i.type==="json"?z.json():z.text()).then(O=>{m||(L&&F&&function(W,X,oe){if(en(),!mr)return;const le={status:X.status,statusText:X.statusText,headers:new Headers};X.headers.forEach((me,xe)=>le.headers.set(xe,me));const se=pi(X.headers.get("Cache-Control")||"");se["no-store"]||(se["max-age"]&&le.headers.set("Expires",new Date(oe+1e3*se["max-age"]).toUTCString()),new Date(le.headers.get("Expires")).getTime()-oe<42e4||function(me,xe){if(hn===void 0)try{new Response(new ReadableStream),hn=!0}catch{hn=!1}hn?xe(me.body):me.blob().then(xe)}(X,me=>{const xe=new Response(me,le);en(),mr&&mr.then(ye=>ye.put(function(Ue){const qe=Ue.indexOf("?");return qe<0?Ue:Ue.slice(0,qe)}(W.url),xe)).catch(ye=>rt(ye.message))}))}(s,L,F),u=!0,e(null,O,z.headers.get("Cache-Control"),z.headers.get("Expires")))}).catch(O=>{m||e(new Error(O.message))})})(P,null,C):P.blob().then(z=>e(new mi(P.status,P.statusText,i.url,z)))).catch(P=>{P.code!==20&&e(new Error(P.message))})})(),{cancel:()=>{m=!0,u||r.abort()}}}const pn=function(i,e){if(/:\/\//.test(i.url)&&!/^https?:|^file:/.test(i.url)){if(At()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,e);if(!At()){const s=i.url.substring(0,i.url.indexOf("://"));return(qi.REGISTERED_PROTOCOLS[s]||po)(i,e)}}if(!(/^file:/.test(r=i.url)||/^file:/.test(tn())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return po(i,e);if(At()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,e,void 0,!0)}var r;return function(s,u){const m=new XMLHttpRequest;m.open(s.method||"GET",s.url,!0),s.type==="arrayBuffer"&&(m.responseType="arraybuffer");for(const g in s.headers)m.setRequestHeader(g,s.headers[g]);return s.type==="json"&&(m.responseType="text",m.setRequestHeader("Accept","application/json")),m.withCredentials=s.credentials==="include",m.onerror=()=>{u(new Error(m.statusText))},m.onload=()=>{if((m.status>=200&&m.status<300||m.status===0)&&m.response!==null){let g=m.response;if(s.type==="json")try{g=JSON.parse(m.response)}catch(x){return u(x)}u(null,g,m.getResponseHeader("Cache-Control"),m.getResponseHeader("Expires"))}else{const g=new Blob([m.response],{type:m.getResponseHeader("Content-Type")});u(new mi(m.status,m.statusText,s.url,g))}},m.send(s.body),{cancel:()=>m.abort()}}(i,e)},Ir=function(i,e){return pn(be(i,{type:"arrayBuffer"}),e)};function Wo(i){const e=window.document.createElement("a");return e.href=i,e.protocol===window.document.location.protocol&&e.host===window.document.location.host}const Gr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let Er,Ar;Er=[],Ar=0;const mo=function(i,e){if(fr.supported&&(i.headers||(i.headers={}),i.headers.accept="image/webp,*/*"),Ar>=qi.MAX_PARALLEL_IMAGE_REQUESTS){const m={requestParameters:i,callback:e,cancelled:!1,cancel(){this.cancelled=!0}};return Er.push(m),m}Ar++;let r=!1;const s=()=>{if(!r)for(r=!0,Ar--;Er.length&&Ar<qi.MAX_PARALLEL_IMAGE_REQUESTS;){const m=Er.shift(),{requestParameters:g,callback:x,cancelled:b}=m;b||(m.cancel=mo(g,x).cancel)}},u=Ir(i,(m,g,x,b)=>{s(),m?e(m):g&&function(C,P){typeof createImageBitmap=="function"?function(z,L){const F=new Blob([new Uint8Array(z)],{type:"image/png"});createImageBitmap(F).then(O=>{L(null,O)}).catch(O=>{L(new Error(`Could not load image because of ${O.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(C,P):function(z,L){const F=new Image;F.onload=()=>{L(null,F),URL.revokeObjectURL(F.src),F.onload=null,window.requestAnimationFrame(()=>{F.src=Gr})},F.onerror=()=>L(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 O=new Blob([new Uint8Array(z)],{type:"image/png"});F.src=z.byteLength?URL.createObjectURL(O):Gr}(C,P)}(g,(C,P)=>{C!=null?e(C):P!=null&&e(null,P,{cacheControl:x,expires:b})})});return{cancel:()=>{u.cancel(),s()}}};function yt(i,e,r){r[i]&&r[i].indexOf(e)!==-1||(r[i]=r[i]||[],r[i].push(e))}function mn(i,e,r){if(r&&r[i]){const s=r[i].indexOf(e);s!==-1&&r[i].splice(s,1)}}class rn{constructor(e,r={}){be(this,r),this.type=e}}class fn extends rn{constructor(e,r={}){super("error",be({error:e},r))}}class fo{on(e,r){return this._listeners=this._listeners||{},yt(e,r,this._listeners),this}off(e,r){return mn(e,r,this._listeners),mn(e,r,this._oneTimeListeners),this}once(e,r){return this._oneTimeListeners=this._oneTimeListeners||{},yt(e,r,this._oneTimeListeners),this}fire(e,r){typeof e=="string"&&(e=new rn(e,r||{}));const s=e.type;if(this.listens(s)){e.target=this;const u=this._listeners&&this._listeners[s]?this._listeners[s].slice():[];for(const x of u)x.call(this,e);const m=this._oneTimeListeners&&this._oneTimeListeners[s]?this._oneTimeListeners[s].slice():[];for(const x of m)mn(s,x,this._oneTimeListeners),x.call(this,e);const g=this._eventedParent;g&&(be(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),g.fire(e))}else e instanceof fn&&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 pe={$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 Me{constructor(e,r,s,u){this.message=(e?`${e}: `:"")+s,u&&(this.identifier=u),r!=null&&r.__line__&&(this.line=r.__line__)}}function gn(i){const e=i.value;return e?[new Me(i.key,e,"constants have been deprecated as of v8")]:[]}function Zr(i,...e){for(const r of e)for(const s in r)i[s]=r[s];return i}function zt(i){return i instanceof Number||i instanceof String||i instanceof Boolean?i.valueOf():i}function nr(i){if(Array.isArray(i))return i.map(nr);if(i instanceof Object&&!(i instanceof Number||i instanceof String||i instanceof Boolean)){const e={};for(const r in i)e[r]=nr(i[r]);return e}return zt(i)}class Pi extends Error{constructor(e,r){super(r),this.message=r,this.key=e}}class yn{constructor(e,r=[]){this.parent=e,this.bindings={};for(const[s,u]of r)this.bindings[s]=u}concat(e){return new yn(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 Rt={kind:"null"},Ee={kind:"number"},ct={kind:"string"},ot={kind:"boolean"},Mi={kind:"color"},gr={kind:"object"},at={kind:"value"},_n={kind:"collator"},yr={kind:"formatted"},Hr={kind:"resolvedImage"};function ii(i,e){return{kind:"array",itemType:i,N:e}}function kt(i){if(i.kind==="array"){const e=kt(i.itemType);return typeof i.N=="number"?`array<${e}, ${i.N}>`:i.itemType.kind==="value"?"array":`array<${e}>`}return i.kind}const or=[Rt,Ee,ct,ot,Mi,yr,gr,ii(at),Hr];function xn(i,e){if(e.kind==="error")return null;if(i.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!xn(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 or)if(!xn(r,e))return null}}return`Expected ${kt(i)} but found ${kt(e)} instead.`}function li(i,e){return e.some(r=>r.kind===i.kind)}function _r(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 xr,go={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 Vn(i){return(i=Math.round(i))<0?0:i>255?255:i}function Gn(i){return Vn(i[i.length-1]==="%"?parseFloat(i)/100*255:parseInt(i))}function V(i){return(e=i[i.length-1]==="%"?parseFloat(i)/100:parseFloat(i))<0?0:e>1?1:e;var e}function E(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{xr={}.parseCSSColor=function(i){var e,r=i.replace(/ /g,"").toLowerCase();if(r in go)return go[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 s=r.indexOf("("),u=r.indexOf(")");if(s!==-1&&u+1===r.length){var m=r.substr(0,s),g=r.substr(s+1,u-(s+1)).split(","),x=1;switch(m){case"rgba":if(g.length!==4)return null;x=V(g.pop());case"rgb":return g.length!==3?null:[Gn(g[0]),Gn(g[1]),Gn(g[2]),x];case"hsla":if(g.length!==4)return null;x=V(g.pop());case"hsl":if(g.length!==3)return null;var b=(parseFloat(g[0])%360+360)%360/360,C=V(g[1]),P=V(g[2]),z=P<=.5?P*(C+1):P+C-P*C,L=2*P-z;return[Vn(255*E(L,z,b+1/3)),Vn(255*E(L,z,b)),Vn(255*E(L,z,b-1/3)),x];default:return null}}return null}}catch{}class M{constructor(e,r,s,u=1){this.r=e,this.g=r,this.b=s,this.a=u}static parse(e){if(!e)return;if(e instanceof M)return e;if(typeof e!="string")return;const r=xr(e);return r?new M(r[0]/255*r[3],r[1]/255*r[3],r[2]/255*r[3],r[3]):void 0}toString(){const[e,r,s,u]=this.toArray();return`rgba(${Math.round(e)},${Math.round(r)},${Math.round(s)},${u})`}toArray(){const{r:e,g:r,b:s,a:u}=this;return u===0?[0,0,0,0]:[255*e/u,255*r/u,255*s/u,u]}}M.black=new M(0,0,0,1),M.white=new M(1,1,1,1),M.transparent=new M(0,0,0,0),M.red=new M(1,0,0,1);class U{constructor(e,r,s){this.sensitivity=e?r?"variant":"case":r?"accent":"base",this.locale=s,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 G{constructor(e,r,s,u,m){this.text=e,this.image=r,this.scale=s,this.fontStack=u,this.textColor=m}}class H{constructor(e){this.sections=e}static fromString(e){return new H([new G(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 H?e:H.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 s={};r.fontStack&&(s["text-font"]=["literal",r.fontStack.split(",")]),r.scale&&(s["font-scale"]=r.scale),r.textColor&&(s["text-color"]=["rgba"].concat(r.textColor.toArray())),e.push(s)}return e}}class ee{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new ee({name:e,available:!1}):null}serialize(){return["image",this.name]}}function Y(i,e,r,s){return typeof i=="number"&&i>=0&&i<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof r=="number"&&r>=0&&r<=255?s===void 0||typeof s=="number"&&s>=0&&s<=1?null:`Invalid rgba value [${[i,e,r,s].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof s=="number"?[i,e,r,s]:[i,e,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Q(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof M||i instanceof U||i instanceof H||i instanceof ee)return!0;if(Array.isArray(i)){for(const e of i)if(!Q(e))return!1;return!0}if(typeof i=="object"){for(const e in i)if(!Q(i[e]))return!1;return!0}return!1}function te(i){if(i===null)return Rt;if(typeof i=="string")return ct;if(typeof i=="boolean")return ot;if(typeof i=="number")return Ee;if(i instanceof M)return Mi;if(i instanceof U)return _n;if(i instanceof H)return yr;if(i instanceof ee)return Hr;if(Array.isArray(i)){const e=i.length;let r;for(const s of i){const u=te(s);if(r){if(r===u)continue;r=at;break}r=u}return ii(r||at,e)}return gr}function ue(i){const e=typeof i;return i===null?"":e==="string"||e==="number"||e==="boolean"?String(i):i instanceof M||i instanceof H||i instanceof ee?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(!Q(e[1]))return r.error("invalid value");const s=e[1];let u=te(s);const m=r.expectedType;return u.kind!=="array"||u.N!==0||!m||m.kind!=="array"||typeof m.N=="number"&&m.N!==0||(u=m),new _e(u,s)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return this.type.kind==="array"||this.type.kind==="object"?["literal",this.value]:this.value instanceof M?["rgba"].concat(this.value.toArray()):this.value instanceof H?this.value.serialize():this.value}}class ce{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const Ze={string:ct,number:Ee,boolean:ot,object:gr};class Re{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 s,u=1;const m=e[0];if(m==="array"){let x,b;if(e.length>2){const C=e[1];if(typeof C!="string"||!(C in Ze)||C==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);x=Ze[C],u++}else x=at;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);b=e[2],u++}s=ii(x,b)}else s=Ze[m];const g=[];for(;u<e.length;u++){const x=r.parse(e[u],u,at);if(!x)return null;g.push(x)}return new Re(s,g)}evaluate(e){for(let r=0;r<this.args.length;r++){const s=this.args[r].evaluate(e);if(!xn(this.type,te(s)))return s;if(r===this.args.length-1)throw new ce(`Expected value to be of type ${kt(this.type)}, but found ${kt(te(s))} 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 s=e.itemType;if(s.kind==="string"||s.kind==="number"||s.kind==="boolean"){r.push(s.kind);const u=e.N;(typeof u=="number"||this.args.length>1)&&r.push(u)}}return r.concat(this.args.map(s=>s.serialize()))}}class je{constructor(e){this.type=yr,this.sections=e}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");const s=e[1];if(!Array.isArray(s)&&typeof s=="object")return r.error("First argument must be an image or text section.");const u=[];let m=!1;for(let g=1;g<=e.length-1;++g){const x=e[g];if(m&&typeof x=="object"&&!Array.isArray(x)){m=!1;let b=null;if(x["font-scale"]&&(b=r.parse(x["font-scale"],1,Ee),!b))return null;let C=null;if(x["text-font"]&&(C=r.parse(x["text-font"],1,ii(ct)),!C))return null;let P=null;if(x["text-color"]&&(P=r.parse(x["text-color"],1,Mi),!P))return null;const z=u[u.length-1];z.scale=b,z.font=C,z.textColor=P}else{const b=r.parse(e[g],1,at);if(!b)return null;const C=b.type.kind;if(C!=="string"&&C!=="value"&&C!=="null"&&C!=="resolvedImage")return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");m=!0,u.push({content:b,scale:null,font:null,textColor:null})}}return new je(u)}evaluate(e){return new H(this.sections.map(r=>{const s=r.content.evaluate(e);return te(s)===Hr?new G("",s,null,null,null):new G(ue(s),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 s={};r.scale&&(s["font-scale"]=r.scale.serialize()),r.font&&(s["text-font"]=r.font.serialize()),r.textColor&&(s["text-color"]=r.textColor.serialize()),e.push(s)}return e}}class Ke{constructor(e){this.type=Hr,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected two arguments.");const s=r.parse(e[1],1,ct);return s?new Ke(s):r.error("No image name provided.")}evaluate(e){const r=this.input.evaluate(e),s=ee.fromString(r);return s&&e.availableImages&&(s.available=e.availableImages.indexOf(r)>-1),s}eachChild(e){e(this.input)}outputDefined(){return!1}serialize(){return["image",this.input.serialize()]}}const vt={"to-boolean":ot,"to-color":Mi,"to-number":Ee,"to-string":ct};class mt{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 s=e[0];if((s==="to-boolean"||s==="to-string")&&e.length!==2)return r.error("Expected one argument.");const u=vt[s],m=[];for(let g=1;g<e.length;g++){const x=r.parse(e[g],g,at);if(!x)return null;m.push(x)}return new mt(u,m)}evaluate(e){if(this.type.kind==="boolean")return Boolean(this.args[0].evaluate(e));if(this.type.kind==="color"){let r,s;for(const u of this.args){if(r=u.evaluate(e),s=null,r instanceof M)return r;if(typeof r=="string"){const m=e.parseColor(r);if(m)return m}else if(Array.isArray(r)&&(s=r.length<3||r.length>4?`Invalid rbga value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:Y(r[0],r[1],r[2],r[3]),!s))return new M(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new ce(s||`Could not parse color from value '${typeof r=="string"?r:String(JSON.stringify(r))}'`)}if(this.type.kind==="number"){let r=null;for(const s of this.args){if(r=s.evaluate(e),r===null)return 0;const u=Number(r);if(!isNaN(u))return u}throw new ce(`Could not convert ${JSON.stringify(r)} to number.`)}return this.type.kind==="formatted"?H.fromString(ue(this.args[0].evaluate(e))):this.type.kind==="resolvedImage"?ee.fromString(ue(this.args[0].evaluate(e))):ue(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 je([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if(this.type.kind==="resolvedImage")return new Ke(this.args[0]).serialize();const e=[`to-${this.type.kind}`];return this.eachChild(r=>{e.push(r.serialize())}),e}}const ut=["Unknown","Point","LineString","Polygon"];class st{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"?ut[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]=M.parse(e)),r}}class nt{constructor(e,r,s,u){this.name=e,this.type=r,this._evaluate=s,this.args=u}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 s=e[0],u=nt.definitions[s];if(!u)return r.error(`Unknown expression "${s}". If you wanted a literal array, use ["literal", [...]].`,0);const m=Array.isArray(u)?u[0]:u.type,g=Array.isArray(u)?[[u[1],u[2]]]:u.overloads,x=g.filter(([C])=>!Array.isArray(C)||C.length===e.length-1);let b=null;for(const[C,P]of x){b=new Ko(r.registry,r.path,null,r.scope);const z=[];let L=!1;for(let F=1;F<e.length;F++){const O=e[F],W=Array.isArray(C)?C[F-1]:C.type,X=b.parse(O,1+z.length,W);if(!X){L=!0;break}z.push(X)}if(!L)if(Array.isArray(C)&&C.length!==z.length)b.error(`Expected ${C.length} arguments, but found ${z.length} instead.`);else{for(let F=0;F<z.length;F++){const O=Array.isArray(C)?C[F]:C.type,W=z[F];b.concat(F+1).checkSubtype(O,W.type)}if(b.errors.length===0)return new nt(s,m,P,z)}}if(x.length===1)r.errors.push(...b.errors);else{const C=(x.length?x:g).map(([z])=>{return L=z,Array.isArray(L)?`(${L.map(kt).join(", ")})`:`(${kt(L.type)}...)`;var L}).join(" | "),P=[];for(let z=1;z<e.length;z++){const L=r.parse(e[z],1+P.length);if(!L)return null;P.push(kt(L.type))}r.error(`Expected arguments of type ${C}, but found (${P.join(", ")}) instead.`)}return null}static register(e,r){nt.definitions=r;for(const s in r)e[s]=nt}}class Jt{constructor(e,r,s){this.type=_n,this.locale=s,this.caseSensitive=e,this.diacriticSensitive=r}static parse(e,r){if(e.length!==2)return r.error("Expected one argument.");const s=e[1];if(typeof s!="object"||Array.isArray(s))return r.error("Collator options argument must be an object.");const u=r.parse(s["case-sensitive"]!==void 0&&s["case-sensitive"],1,ot);if(!u)return null;const m=r.parse(s["diacritic-sensitive"]!==void 0&&s["diacritic-sensitive"],1,ot);if(!m)return null;let g=null;return s.locale&&(g=r.parse(s.locale,1,ct),!g)?null:new Jt(u,m,g)}evaluate(e){return new U(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 Xt=8192;function fi(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 _i(i,e){return!(i[0]<=e[0]||i[2]>=e[2]||i[1]<=e[1]||i[3]>=e[3])}function qa(i,e){const r=(180+i[0])/360,s=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i[1]*Math.PI/360)))/360,u=Math.pow(2,e.z);return[Math.round(r*u*Xt),Math.round(s*u*Xt)]}function Wa(i,e,r){const s=i[0]-e[0],u=i[1]-e[1],m=i[0]-r[0],g=i[1]-r[1];return s*g-m*u==0&&s*m<=0&&u*g<=0}function Lt(i,e){let r=!1;for(let g=0,x=e.length;g<x;g++){const b=e[g];for(let C=0,P=b.length;C<P-1;C++){if(Wa(i,b[C],b[C+1]))return!1;(u=b[C])[1]>(s=i)[1]!=(m=b[C+1])[1]>s[1]&&s[0]<(m[0]-u[0])*(s[1]-u[1])/(m[1]-u[1])+u[0]&&(r=!r)}}var s,u,m;return r}function Qc(i,e){for(let r=0;r<e.length;r++)if(Lt(i,e[r]))return!0;return!1}function Xa(i,e,r,s){const u=s[0]-r[0],m=s[1]-r[1],g=(i[0]-r[0])*m-u*(i[1]-r[1]),x=(e[0]-r[0])*m-u*(e[1]-r[1]);return g>0&&x<0||g<0&&x>0}function eh(i,e,r){for(const C of r)for(let P=0;P<C.length-1;++P)if((x=[(g=C[P+1])[0]-(m=C[P])[0],g[1]-m[1]])[0]*(b=[(u=e)[0]-(s=i)[0],u[1]-s[1]])[1]-x[1]*b[0]!=0&&Xa(s,u,m,g)&&Xa(m,g,s,u))return!0;var s,u,m,g,x,b;return!1}function Ya(i,e){for(let r=0;r<i.length;++r)if(!Lt(i[r],e))return!1;for(let r=0;r<i.length-1;++r)if(eh(i[r],i[r+1],e))return!1;return!0}function ml(i,e){for(let r=0;r<e.length;r++)if(Ya(i,e[r]))return!0;return!1}function Ka(i,e,r){const s=[];for(let u=0;u<i.length;u++){const m=[];for(let g=0;g<i[u].length;g++){const x=qa(i[u][g],r);fi(e,x),m.push(x)}s.push(m)}return s}function Ja(i,e,r){const s=[];for(let u=0;u<i.length;u++){const m=Ka(i[u],e,r);s.push(m)}return s}function Qa(i,e,r,s){if(i[0]<r[0]||i[0]>r[2]){const u=.5*s;let m=i[0]-r[0]>u?-s:r[0]-i[0]>u?s:0;m===0&&(m=i[0]-r[2]>u?-s:r[2]-i[0]>u?s:0),i[0]+=m}fi(e,i)}function fl(i,e,r,s){const u=Math.pow(2,s.z)*Xt,m=[s.x*Xt,s.y*Xt],g=[];for(const x of i)for(const b of x){const C=[b.x+m[0],b.y+m[1]];Qa(C,e,r,u),g.push(C)}return g}function gl(i,e,r,s){const u=Math.pow(2,s.z)*Xt,m=[s.x*Xt,s.y*Xt],g=[];for(const b of i){const C=[];for(const P of b){const z=[P.x+m[0],P.y+m[1]];fi(e,z),C.push(z)}g.push(C)}if(e[2]-e[0]<=u/2){(x=e)[0]=x[1]=1/0,x[2]=x[3]=-1/0;for(const b of g)for(const C of b)Qa(C,e,r,u)}var x;return g}class vn{constructor(e,r){this.type=ot,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(Q(e[1])){const s=e[1];if(s.type==="FeatureCollection")for(let u=0;u<s.features.length;++u){const m=s.features[u].geometry.type;if(m==="Polygon"||m==="MultiPolygon")return new vn(s,s.features[u].geometry)}else if(s.type==="Feature"){const u=s.geometry.type;if(u==="Polygon"||u==="MultiPolygon")return new vn(s,s.geometry)}else if(s.type==="Polygon"||s.type==="MultiPolygon")return new vn(s,s)}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,s){const u=[1/0,1/0,-1/0,-1/0],m=[1/0,1/0,-1/0,-1/0],g=r.canonicalID();if(s.type==="Polygon"){const x=Ka(s.coordinates,m,g),b=fl(r.geometry(),u,m,g);if(!_i(u,m))return!1;for(const C of b)if(!Lt(C,x))return!1}if(s.type==="MultiPolygon"){const x=Ja(s.coordinates,m,g),b=fl(r.geometry(),u,m,g);if(!_i(u,m))return!1;for(const C of b)if(!Qc(C,x))return!1}return!0}(e,this.geometries);if(e.geometryType()==="LineString")return function(r,s){const u=[1/0,1/0,-1/0,-1/0],m=[1/0,1/0,-1/0,-1/0],g=r.canonicalID();if(s.type==="Polygon"){const x=Ka(s.coordinates,m,g),b=gl(r.geometry(),u,m,g);if(!_i(u,m))return!1;for(const C of b)if(!Ya(C,x))return!1}if(s.type==="MultiPolygon"){const x=Ja(s.coordinates,m,g),b=gl(r.geometry(),u,m,g);if(!_i(u,m))return!1;for(const C of b)if(!ml(C,x))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}function Xo(i){if(i instanceof nt&&(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 vn)return!1;let e=!0;return i.eachChild(r=>{e&&!Xo(r)&&(e=!1)}),e}function Zn(i){if(i instanceof nt&&i.name==="feature-state")return!1;let e=!0;return i.eachChild(r=>{e&&!Zn(r)&&(e=!1)}),e}function yo(i,e){if(i instanceof nt&&e.indexOf(i.name)>=0)return!1;let r=!0;return i.eachChild(s=>{r&&!yo(s,e)&&(r=!1)}),r}class Yo{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 s=e[1];return r.scope.has(s)?new Yo(s,r.scope.get(s)):r.error(`Unknown variable "${s}". Make sure "${s}" 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 Ko{constructor(e,r=[],s,u=new yn,m=[]){this.registry=e,this.path=r,this.key=r.map(g=>`[${g}]`).join(""),this.scope=u,this.errors=m,this.expectedType=s}parse(e,r,s,u,m={}){return r?this.concat(r,s,u)._parse(e,m):this._parse(e,m)}_parse(e,r){function s(u,m,g){return g==="assert"?new Re(m,[u]):g==="coerce"?new mt(m,[u]):u}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 u=e[0];if(typeof u!="string")return this.error(`Expression name must be a string, but found ${typeof u} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const m=this.registry[u];if(m){let g=m.parse(e,this);if(!g)return null;if(this.expectedType){const x=this.expectedType,b=g.type;if(x.kind!=="string"&&x.kind!=="number"&&x.kind!=="boolean"&&x.kind!=="object"&&x.kind!=="array"||b.kind!=="value")if(x.kind!=="color"&&x.kind!=="formatted"&&x.kind!=="resolvedImage"||b.kind!=="value"&&b.kind!=="string"){if(this.checkSubtype(x,b))return null}else g=s(g,x,r.typeAnnotation||"coerce");else g=s(g,x,r.typeAnnotation||"assert")}if(!(g instanceof _e)&&g.type.kind!=="resolvedImage"&&_o(g)){const x=new st;try{g=new _e(g.type,g.evaluate(x))}catch(b){return this.error(b.message),null}}return g}return this.error(`Unknown expression "${u}". 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,s){const u=typeof e=="number"?this.path.concat(e):this.path,m=s?this.scope.concat(s):this.scope;return new Ko(this.registry,u,r||null,m,this.errors)}error(e,...r){const s=`${this.key}${r.map(u=>`[${u}]`).join("")}`;this.errors.push(new Pi(s,e))}checkSubtype(e,r){const s=xn(e,r);return s&&this.error(s),s}}function _o(i){if(i instanceof Yo)return _o(i.boundExpression);if(i instanceof nt&&i.name==="error"||i instanceof Jt||i instanceof vn)return!1;const e=i instanceof mt||i instanceof Re;let r=!0;return i.eachChild(s=>{r=e?r&&_o(s):r&&s instanceof _e}),!!r&&Xo(i)&&yo(i,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Jo(i,e){const r=i.length-1;let s,u,m=0,g=r,x=0;for(;m<=g;)if(x=Math.floor((m+g)/2),s=i[x],u=i[x+1],s<=e){if(x===r||e<u)return x;m=x+1}else{if(!(s>e))throw new ce("Input is not a number.");g=x-1}return 0}class xo{constructor(e,r,s){this.type=e,this.input=r,this.labels=[],this.outputs=[];for(const[u,m]of s)this.labels.push(u),this.outputs.push(m)}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 s=r.parse(e[1],1,Ee);if(!s)return null;const u=[];let m=null;r.expectedType&&r.expectedType.kind!=="value"&&(m=r.expectedType);for(let g=1;g<e.length;g+=2){const x=g===1?-1/0:e[g],b=e[g+1],C=g,P=g+1;if(typeof x!="number")return r.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',C);if(u.length&&u[u.length-1][0]>=x)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',C);const z=r.parse(b,P,m);if(!z)return null;m=m||z.type,u.push([x,z])}return new xo(m,s,u)}evaluate(e){const r=this.labels,s=this.outputs;if(r.length===1)return s[0].evaluate(e);const u=this.input.evaluate(e);if(u<=r[0])return s[0].evaluate(e);const m=r.length;return u>=r[m-1]?s[m-1].evaluate(e):s[Jo(r,u)].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 ri(i,e,r){return i*(1-r)+e*r}var vo=Object.freeze({__proto__:null,number:ri,color:function(i,e,r){return new M(ri(i.r,e.r,r),ri(i.g,e.g,r),ri(i.b,e.b,r),ri(i.a,e.a,r))},array:function(i,e,r){return i.map((s,u)=>ri(s,e[u],r))}});const es=.95047,yl=1.08883,_l=4/29,Qo=6/29,ts=3*Qo*Qo,th=Math.PI/180,ih=180/Math.PI;function is(i){return i>.008856451679035631?Math.pow(i,1/3):i/ts+_l}function rs(i){return i>Qo?i*i*i:ts*(i-_l)}function ns(i){return 255*(i<=.0031308?12.92*i:1.055*Math.pow(i,1/2.4)-.055)}function os(i){return(i/=255)<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function xl(i){const e=os(i.r),r=os(i.g),s=os(i.b),u=is((.4124564*e+.3575761*r+.1804375*s)/es),m=is((.2126729*e+.7151522*r+.072175*s)/1);return{l:116*m-16,a:500*(u-m),b:200*(m-is((.0193339*e+.119192*r+.9503041*s)/yl)),alpha:i.a}}function St(i){let e=(i.l+16)/116,r=isNaN(i.a)?e:e+i.a/500,s=isNaN(i.b)?e:e-i.b/200;return e=1*rs(e),r=es*rs(r),s=yl*rs(s),new M(ns(3.2404542*r-1.5371385*e-.4985314*s),ns(-.969266*r+1.8760108*e+.041556*s),ns(.0556434*r-.2040259*e+1.0572252*s),i.alpha)}function rh(i,e,r){const s=e-i;return i+r*(s>180||s<-180?s-360*Math.round(s/360):s)}const bo={forward:xl,reverse:St,interpolate:function(i,e,r){return{l:ri(i.l,e.l,r),a:ri(i.a,e.a,r),b:ri(i.b,e.b,r),alpha:ri(i.alpha,e.alpha,r)}}},wo={forward:function(i){const{l:e,a:r,b:s}=xl(i),u=Math.atan2(s,r)*ih;return{h:u<0?u+360:u,c:Math.sqrt(r*r+s*s),l:e,alpha:i.a}},reverse:function(i){const e=i.h*th,r=i.c;return St({l:i.l,a:Math.cos(e)*r,b:Math.sin(e)*r,alpha:i.alpha})},interpolate:function(i,e,r){return{h:rh(i.h,e.h,r),c:ri(i.c,e.c,r),l:ri(i.l,e.l,r),alpha:ri(i.alpha,e.alpha,r)}}};var vl=Object.freeze({__proto__:null,lab:bo,hcl:wo});class Wi{constructor(e,r,s,u,m){this.type=e,this.operator=r,this.interpolation=s,this.input=u,this.labels=[],this.outputs=[];for(const[g,x]of m)this.labels.push(g),this.outputs.push(x)}static interpolationFactor(e,r,s,u){let m=0;if(e.name==="exponential")m=as(r,e.base,s,u);else if(e.name==="linear")m=as(r,1,s,u);else if(e.name==="cubic-bezier"){const g=e.controlPoints;m=new D(g[0],g[1],g[2],g[3]).solve(as(r,1,s,u))}return m}static parse(e,r){let[s,u,m,...g]=e;if(!Array.isArray(u)||u.length===0)return r.error("Expected an interpolation type expression.",1);if(u[0]==="linear")u={name:"linear"};else if(u[0]==="exponential"){const C=u[1];if(typeof C!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);u={name:"exponential",base:C}}else{if(u[0]!=="cubic-bezier")return r.error(`Unknown interpolation type ${String(u[0])}`,1,0);{const C=u.slice(1);if(C.length!==4||C.some(P=>typeof P!="number"||P<0||P>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);u={name:"cubic-bezier",controlPoints:C}}}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(m=r.parse(m,2,Ee),!m)return null;const x=[];let b=null;s==="interpolate-hcl"||s==="interpolate-lab"?b=Mi:r.expectedType&&r.expectedType.kind!=="value"&&(b=r.expectedType);for(let C=0;C<g.length;C+=2){const P=g[C],z=g[C+1],L=C+3,F=C+4;if(typeof P!="number")return r.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',L);if(x.length&&x[x.length-1][0]>=P)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',L);const O=r.parse(z,F,b);if(!O)return null;b=b||O.type,x.push([P,O])}return b.kind==="number"||b.kind==="color"||b.kind==="array"&&b.itemType.kind==="number"&&typeof b.N=="number"?new Wi(b,s,u,m,x):r.error(`Type ${kt(b)} is not interpolatable.`)}evaluate(e){const r=this.labels,s=this.outputs;if(r.length===1)return s[0].evaluate(e);const u=this.input.evaluate(e);if(u<=r[0])return s[0].evaluate(e);const m=r.length;if(u>=r[m-1])return s[m-1].evaluate(e);const g=Jo(r,u),x=Wi.interpolationFactor(this.interpolation,u,r[g],r[g+1]),b=s[g].evaluate(e),C=s[g+1].evaluate(e);return this.operator==="interpolate"?vo[this.type.kind.toLowerCase()](b,C,x):this.operator==="interpolate-hcl"?wo.reverse(wo.interpolate(wo.forward(b),wo.forward(C),x)):bo.reverse(bo.interpolate(bo.forward(b),bo.forward(C),x))}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 s=0;s<this.labels.length;s++)r.push(this.labels[s],this.outputs[s].serialize());return r}}function as(i,e,r,s){const u=s-r,m=i-r;return u===0?0:e===1?m/u:(Math.pow(e,m)-1)/(Math.pow(e,u)-1)}class ea{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 s=null;const u=r.expectedType;u&&u.kind!=="value"&&(s=u);const m=[];for(const x of e.slice(1)){const b=r.parse(x,1+m.length,s,void 0,{typeAnnotation:"omit"});if(!b)return null;s=s||b.type,m.push(b)}const g=u&&m.some(x=>xn(u,x.type));return new ea(g?at:s,m)}evaluate(e){let r,s=null,u=0;for(const m of this.args)if(u++,s=m.evaluate(e),s&&s instanceof ee&&!s.available&&(r||(r=s.name),s=null,u===this.args.length&&(s=r)),s!==null)break;return s}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 ta{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 s=[];for(let m=1;m<e.length-1;m+=2){const g=e[m];if(typeof g!="string")return r.error(`Expected string, but found ${typeof g} instead.`,m);if(/[^a-zA-Z0-9_]/.test(g))return r.error("Variable names must contain only alphanumeric characters or '_'.",m);const x=r.parse(e[m+1],m+1);if(!x)return null;s.push([g,x])}const u=r.parse(e[e.length-1],e.length-1,r.expectedType,s);return u?new ta(s,u):null}outputDefined(){return this.result.outputDefined()}serialize(){const e=["let"];for(const[r,s]of this.bindings)e.push(r,s.serialize());return e.push(this.result.serialize()),e}}class ss{constructor(e,r,s){this.type=e,this.index=r,this.input=s}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const s=r.parse(e[1],1,Ee),u=r.parse(e[2],2,ii(r.expectedType||at));return s&&u?new ss(u.type.itemType,s,u):null}evaluate(e){const r=this.index.evaluate(e),s=this.input.evaluate(e);if(r<0)throw new ce(`Array index out of bounds: ${r} < 0.`);if(r>=s.length)throw new ce(`Array index out of bounds: ${r} > ${s.length-1}.`);if(r!==Math.floor(r))throw new ce(`Array index must be an integer, but found ${r} instead.`);return s[r]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class ls{constructor(e,r){this.type=ot,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 s=r.parse(e[1],1,at),u=r.parse(e[2],2,at);return s&&u?li(s.type,[ot,ct,Ee,Rt,at])?new ls(s,u):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${kt(s.type)} instead`):null}evaluate(e){const r=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(!s)return!1;if(!_r(r,["boolean","string","number","null"]))throw new ce(`Expected first argument to be of type boolean, string, number or null, but found ${kt(te(r))} instead.`);if(!_r(s,["string","array"]))throw new ce(`Expected second argument to be of type array or string, but found ${kt(te(s))} instead.`);return s.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class ia{constructor(e,r,s){this.type=Ee,this.needle=e,this.haystack=r,this.fromIndex=s}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 s=r.parse(e[1],1,at),u=r.parse(e[2],2,at);if(!s||!u)return null;if(!li(s.type,[ot,ct,Ee,Rt,at]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${kt(s.type)} instead`);if(e.length===4){const m=r.parse(e[3],3,Ee);return m?new ia(s,u,m):null}return new ia(s,u)}evaluate(e){const r=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(!_r(r,["boolean","string","number","null"]))throw new ce(`Expected first argument to be of type boolean, string, number or null, but found ${kt(te(r))} instead.`);if(!_r(s,["string","array"]))throw new ce(`Expected second argument to be of type array or string, but found ${kt(te(s))} instead.`);if(this.fromIndex){const u=this.fromIndex.evaluate(e);return s.indexOf(r,u)}return s.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 cs{constructor(e,r,s,u,m,g){this.inputType=e,this.type=r,this.input=s,this.cases=u,this.outputs=m,this.otherwise=g}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 s,u;r.expectedType&&r.expectedType.kind!=="value"&&(u=r.expectedType);const m={},g=[];for(let C=2;C<e.length-1;C+=2){let P=e[C];const z=e[C+1];Array.isArray(P)||(P=[P]);const L=r.concat(C);if(P.length===0)return L.error("Expected at least one branch label.");for(const O of P){if(typeof O!="number"&&typeof O!="string")return L.error("Branch labels must be numbers or strings.");if(typeof O=="number"&&Math.abs(O)>Number.MAX_SAFE_INTEGER)return L.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof O=="number"&&Math.floor(O)!==O)return L.error("Numeric branch labels must be integer values.");if(s){if(L.checkSubtype(s,te(O)))return null}else s=te(O);if(m[String(O)]!==void 0)return L.error("Branch labels must be unique.");m[String(O)]=g.length}const F=r.parse(z,C,u);if(!F)return null;u=u||F.type,g.push(F)}const x=r.parse(e[1],1,at);if(!x)return null;const b=r.parse(e[e.length-1],e.length-1,u);return b?x.type.kind!=="value"&&r.concat(1).checkSubtype(s,x.type)?null:new cs(s,u,x,m,g,b):null}evaluate(e){const r=this.input.evaluate(e);return(te(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(),s=[],u={};for(const g of r){const x=u[this.cases[g]];x===void 0?(u[this.cases[g]]=s.length,s.push([this.cases[g],[g]])):s[x][1].push(g)}const m=g=>this.inputType.kind==="number"?Number(g):g;for(const[g,x]of s)e.push(x.length===1?m(x[0]):x.map(m)),e.push(this.outputs[g].serialize());return e.push(this.otherwise.serialize()),e}}class hs{constructor(e,r,s){this.type=e,this.branches=r,this.otherwise=s}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 s;r.expectedType&&r.expectedType.kind!=="value"&&(s=r.expectedType);const u=[];for(let g=1;g<e.length-1;g+=2){const x=r.parse(e[g],g,ot);if(!x)return null;const b=r.parse(e[g+1],g+1,s);if(!b)return null;u.push([x,b]),s=s||b.type}const m=r.parse(e[e.length-1],e.length-1,s);return m?new hs(s,u,m):null}evaluate(e){for(const[r,s]of this.branches)if(r.evaluate(e))return s.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[r,s]of this.branches)e(r),e(s);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,s,u){this.type=e,this.input=r,this.beginIndex=s,this.endIndex=u}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 s=r.parse(e[1],1,at),u=r.parse(e[2],2,Ee);if(!s||!u)return null;if(!li(s.type,[ii(at),ct,at]))return r.error(`Expected first argument to be of type array or string, but found ${kt(s.type)} instead`);if(e.length===4){const m=r.parse(e[3],3,Ee);return m?new ra(s.type,s,u,m):null}return new ra(s.type,s,u)}evaluate(e){const r=this.input.evaluate(e),s=this.beginIndex.evaluate(e);if(!_r(r,["string","array"]))throw new ce(`Expected first argument to be of type array or string, but found ${kt(te(r))} instead.`);if(this.endIndex){const u=this.endIndex.evaluate(e);return r.slice(s,u)}return r.slice(s)}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 bl(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 wl(i,e,r,s){return s.compare(e,r)===0}function Hn(i,e,r){const s=i!=="=="&&i!=="!=";return class pf{constructor(m,g,x){this.type=ot,this.lhs=m,this.rhs=g,this.collator=x,this.hasUntypedArgument=m.type.kind==="value"||g.type.kind==="value"}static parse(m,g){if(m.length!==3&&m.length!==4)return g.error("Expected two or three arguments.");const x=m[0];let b=g.parse(m[1],1,at);if(!b)return null;if(!bl(x,b.type))return g.concat(1).error(`"${x}" comparisons are not supported for type '${kt(b.type)}'.`);let C=g.parse(m[2],2,at);if(!C)return null;if(!bl(x,C.type))return g.concat(2).error(`"${x}" comparisons are not supported for type '${kt(C.type)}'.`);if(b.type.kind!==C.type.kind&&b.type.kind!=="value"&&C.type.kind!=="value")return g.error(`Cannot compare types '${kt(b.type)}' and '${kt(C.type)}'.`);s&&(b.type.kind==="value"&&C.type.kind!=="value"?b=new Re(C.type,[b]):b.type.kind!=="value"&&C.type.kind==="value"&&(C=new Re(b.type,[C])));let P=null;if(m.length===4){if(b.type.kind!=="string"&&C.type.kind!=="string"&&b.type.kind!=="value"&&C.type.kind!=="value")return g.error("Cannot use collator to compare non-string types.");if(P=g.parse(m[3],3,_n),!P)return null}return new pf(b,C,P)}evaluate(m){const g=this.lhs.evaluate(m),x=this.rhs.evaluate(m);if(s&&this.hasUntypedArgument){const b=te(g),C=te(x);if(b.kind!==C.kind||b.kind!=="string"&&b.kind!=="number")throw new ce(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${b.kind}, ${C.kind}) instead.`)}if(this.collator&&!s&&this.hasUntypedArgument){const b=te(g),C=te(x);if(b.kind!=="string"||C.kind!=="string")return e(m,g,x)}return this.collator?r(m,g,x,this.collator.evaluate(m)):e(m,g,x)}eachChild(m){m(this.lhs),m(this.rhs),this.collator&&m(this.collator)}outputDefined(){return!0}serialize(){const m=[i];return this.eachChild(g=>{m.push(g.serialize())}),m}}}const nh=Hn("==",function(i,e,r){return e===r},wl),oh=Hn("!=",function(i,e,r){return e!==r},function(i,e,r,s){return!wl(0,e,r,s)}),ah=Hn("<",function(i,e,r){return e<r},function(i,e,r,s){return s.compare(e,r)<0}),sh=Hn(">",function(i,e,r){return e>r},function(i,e,r,s){return s.compare(e,r)>0}),lh=Hn("<=",function(i,e,r){return e<=r},function(i,e,r,s){return s.compare(e,r)<=0}),ch=Hn(">=",function(i,e,r){return e>=r},function(i,e,r,s){return s.compare(e,r)>=0});class us{constructor(e,r,s,u,m){this.type=ct,this.number=e,this.locale=r,this.currency=s,this.minFractionDigits=u,this.maxFractionDigits=m}static parse(e,r){if(e.length!==3)return r.error("Expected two arguments.");const s=r.parse(e[1],1,Ee);if(!s)return null;const u=e[2];if(typeof u!="object"||Array.isArray(u))return r.error("NumberFormat options argument must be an object.");let m=null;if(u.locale&&(m=r.parse(u.locale,1,ct),!m))return null;let g=null;if(u.currency&&(g=r.parse(u.currency,1,ct),!g))return null;let x=null;if(u["min-fraction-digits"]&&(x=r.parse(u["min-fraction-digits"],1,Ee),!x))return null;let b=null;return u["max-fraction-digits"]&&(b=r.parse(u["max-fraction-digits"],1,Ee),!b)?null:new us(s,m,g,x,b)}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 ds{constructor(e){this.type=Ee,this.input=e}static parse(e,r){if(e.length!==2)return r.error(`Expected 1 argument, but found ${e.length-1} instead.`);const s=r.parse(e[1],1);return s?s.type.kind!=="array"&&s.type.kind!=="string"&&s.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${kt(s.type)} instead.`):new ds(s):null}evaluate(e){const r=this.input.evaluate(e);if(typeof r=="string"||Array.isArray(r))return r.length;throw new ce(`Expected value to be of type string or array, but found ${kt(te(r))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}serialize(){const e=["length"];return this.eachChild(r=>{e.push(r.serialize())}),e}}const jn={"==":nh,"!=":oh,">":sh,"<":ah,">=":ch,"<=":lh,array:Re,at:ss,boolean:Re,case:hs,coalesce:ea,collator:Jt,format:je,image:Ke,in:ls,"index-of":ia,interpolate:Wi,"interpolate-hcl":Wi,"interpolate-lab":Wi,length:ds,let:ta,literal:_e,match:cs,number:Re,"number-format":us,object:Re,slice:ra,step:xo,string:Re,"to-boolean":mt,"to-color":mt,"to-number":mt,"to-string":mt,var:Yo,within:vn};function Sl(i,[e,r,s,u]){e=e.evaluate(i),r=r.evaluate(i),s=s.evaluate(i);const m=u?u.evaluate(i):1,g=Y(e,r,s,m);if(g)throw new ce(g);return new M(e/255*m,r/255*m,s/255*m,m)}function Tl(i,e){return i in e}function ps(i,e){const r=e[i];return r===void 0?null:r}function bn(i){return{type:i}}function Cl(i){return{result:"success",value:i}}function wn(i){return{result:"error",value:i}}function qn(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function Il(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function ms(i){return!!i.expression&&i.expression.interpolated}function it(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":i===null?"null":typeof i}function na(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function Et(i){return i}function oa(i,e){const r=e.type==="color",s=i.stops&&typeof i.stops[0][0]=="object",u=s||!(s||i.property!==void 0),m=i.type||(ms(e)?"exponential":"interval");if(r&&((i=Zr({},i)).stops&&(i.stops=i.stops.map(C=>[C[0],M.parse(C[1])])),i.default=M.parse(i.default?i.default:e.default)),i.colorSpace&&i.colorSpace!=="rgb"&&!vl[i.colorSpace])throw new Error(`Unknown color space: ${i.colorSpace}`);let g,x,b;if(m==="exponential")g=fs;else if(m==="interval")g=aa;else if(m==="categorical"){g=Yt,x=Object.create(null);for(const C of i.stops)x[C[0]]=C[1];b=typeof i.stops[0][0]}else{if(m!=="identity")throw new Error(`Unknown function type "${m}"`);g=hh}if(s){const C={},P=[];for(let F=0;F<i.stops.length;F++){const O=i.stops[F],W=O[0].zoom;C[W]===void 0&&(C[W]={zoom:W,type:i.type,property:i.property,default:i.default,stops:[]},P.push(W)),C[W].stops.push([O[0].value,O[1]])}const z=[];for(const F of P)z.push([C[F].zoom,oa(C[F],e)]);const L={name:"linear"};return{kind:"composite",interpolationType:L,interpolationFactor:Wi.interpolationFactor.bind(void 0,L),zoomStops:z.map(F=>F[0]),evaluate:({zoom:F},O)=>fs({stops:z,base:i.base},e,F).evaluate(F,O)}}if(u){const C=m==="exponential"?{name:"exponential",base:i.base!==void 0?i.base:1}:null;return{kind:"camera",interpolationType:C,interpolationFactor:Wi.interpolationFactor.bind(void 0,C),zoomStops:i.stops.map(P=>P[0]),evaluate:({zoom:P})=>g(i,e,P,x,b)}}return{kind:"source",evaluate(C,P){const z=P&&P.properties?P.properties[i.property]:void 0;return z===void 0?Ot(i.default,e.default):g(i,e,z,x,b)}}}function Ot(i,e,r){return i!==void 0?i:e!==void 0?e:r!==void 0?r:void 0}function Yt(i,e,r,s,u){return Ot(typeof r===u?s[r]:void 0,i.default,e.default)}function aa(i,e,r){if(it(r)!=="number")return Ot(i.default,e.default);const s=i.stops.length;if(s===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[s-1][0])return i.stops[s-1][1];const u=Jo(i.stops.map(m=>m[0]),r);return i.stops[u][1]}function fs(i,e,r){const s=i.base!==void 0?i.base:1;if(it(r)!=="number")return Ot(i.default,e.default);const u=i.stops.length;if(u===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[u-1][0])return i.stops[u-1][1];const m=Jo(i.stops.map(P=>P[0]),r),g=function(P,z,L,F){const O=F-L,W=P-L;return O===0?0:z===1?W/O:(Math.pow(z,W)-1)/(Math.pow(z,O)-1)}(r,s,i.stops[m][0],i.stops[m+1][0]),x=i.stops[m][1],b=i.stops[m+1][1];let C=vo[e.type]||Et;if(i.colorSpace&&i.colorSpace!=="rgb"){const P=vl[i.colorSpace];C=(z,L)=>P.reverse(P.interpolate(P.forward(z),P.forward(L),g))}return typeof x.evaluate=="function"?{evaluate(...P){const z=x.evaluate.apply(void 0,P),L=b.evaluate.apply(void 0,P);if(z!==void 0&&L!==void 0)return C(z,L,g)}}:C(x,b,g)}function hh(i,e,r){return e.type==="color"?r=M.parse(r):e.type==="formatted"?r=H.fromString(r.toString()):e.type==="resolvedImage"?r=ee.fromString(r.toString()):it(r)===e.type||e.type==="enum"&&e.values[r]||(r=void 0),Ot(r,i.default,e.default)}nt.register(jn,{error:[{kind:"error"},[ct],(i,[e])=>{throw new ce(e.evaluate(i))}],typeof:[ct,[at],(i,[e])=>kt(te(e.evaluate(i)))],"to-rgba":[ii(Ee,4),[Mi],(i,[e])=>e.evaluate(i).toArray()],rgb:[Mi,[Ee,Ee,Ee],Sl],rgba:[Mi,[Ee,Ee,Ee,Ee],Sl],has:{type:ot,overloads:[[[ct],(i,[e])=>Tl(e.evaluate(i),i.properties())],[[ct,gr],(i,[e,r])=>Tl(e.evaluate(i),r.evaluate(i))]]},get:{type:at,overloads:[[[ct],(i,[e])=>ps(e.evaluate(i),i.properties())],[[ct,gr],(i,[e,r])=>ps(e.evaluate(i),r.evaluate(i))]]},"feature-state":[at,[ct],(i,[e])=>ps(e.evaluate(i),i.featureState||{})],properties:[gr,[],i=>i.properties()],"geometry-type":[ct,[],i=>i.geometryType()],id:[at,[],i=>i.id()],zoom:[Ee,[],i=>i.globals.zoom],"heatmap-density":[Ee,[],i=>i.globals.heatmapDensity||0],"line-progress":[Ee,[],i=>i.globals.lineProgress||0],accumulated:[at,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[Ee,bn(Ee),(i,e)=>{let r=0;for(const s of e)r+=s.evaluate(i);return r}],"*":[Ee,bn(Ee),(i,e)=>{let r=1;for(const s of e)r*=s.evaluate(i);return r}],"-":{type:Ee,overloads:[[[Ee,Ee],(i,[e,r])=>e.evaluate(i)-r.evaluate(i)],[[Ee],(i,[e])=>-e.evaluate(i)]]},"/":[Ee,[Ee,Ee],(i,[e,r])=>e.evaluate(i)/r.evaluate(i)],"%":[Ee,[Ee,Ee],(i,[e,r])=>e.evaluate(i)%r.evaluate(i)],ln2:[Ee,[],()=>Math.LN2],pi:[Ee,[],()=>Math.PI],e:[Ee,[],()=>Math.E],"^":[Ee,[Ee,Ee],(i,[e,r])=>Math.pow(e.evaluate(i),r.evaluate(i))],sqrt:[Ee,[Ee],(i,[e])=>Math.sqrt(e.evaluate(i))],log10:[Ee,[Ee],(i,[e])=>Math.log(e.evaluate(i))/Math.LN10],ln:[Ee,[Ee],(i,[e])=>Math.log(e.evaluate(i))],log2:[Ee,[Ee],(i,[e])=>Math.log(e.evaluate(i))/Math.LN2],sin:[Ee,[Ee],(i,[e])=>Math.sin(e.evaluate(i))],cos:[Ee,[Ee],(i,[e])=>Math.cos(e.evaluate(i))],tan:[Ee,[Ee],(i,[e])=>Math.tan(e.evaluate(i))],asin:[Ee,[Ee],(i,[e])=>Math.asin(e.evaluate(i))],acos:[Ee,[Ee],(i,[e])=>Math.acos(e.evaluate(i))],atan:[Ee,[Ee],(i,[e])=>Math.atan(e.evaluate(i))],min:[Ee,bn(Ee),(i,e)=>Math.min(...e.map(r=>r.evaluate(i)))],max:[Ee,bn(Ee),(i,e)=>Math.max(...e.map(r=>r.evaluate(i)))],abs:[Ee,[Ee],(i,[e])=>Math.abs(e.evaluate(i))],round:[Ee,[Ee],(i,[e])=>{const r=e.evaluate(i);return r<0?-Math.round(-r):Math.round(r)}],floor:[Ee,[Ee],(i,[e])=>Math.floor(e.evaluate(i))],ceil:[Ee,[Ee],(i,[e])=>Math.ceil(e.evaluate(i))],"filter-==":[ot,[ct,at],(i,[e,r])=>i.properties()[e.value]===r.value],"filter-id-==":[ot,[at],(i,[e])=>i.id()===e.value],"filter-type-==":[ot,[ct],(i,[e])=>i.geometryType()===e.value],"filter-<":[ot,[ct,at],(i,[e,r])=>{const s=i.properties()[e.value],u=r.value;return typeof s==typeof u&&s<u}],"filter-id-<":[ot,[at],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r<s}],"filter->":[ot,[ct,at],(i,[e,r])=>{const s=i.properties()[e.value],u=r.value;return typeof s==typeof u&&s>u}],"filter-id->":[ot,[at],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r>s}],"filter-<=":[ot,[ct,at],(i,[e,r])=>{const s=i.properties()[e.value],u=r.value;return typeof s==typeof u&&s<=u}],"filter-id-<=":[ot,[at],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r<=s}],"filter->=":[ot,[ct,at],(i,[e,r])=>{const s=i.properties()[e.value],u=r.value;return typeof s==typeof u&&s>=u}],"filter-id->=":[ot,[at],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r>=s}],"filter-has":[ot,[at],(i,[e])=>e.value in i.properties()],"filter-has-id":[ot,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[ot,[ii(ct)],(i,[e])=>e.value.indexOf(i.geometryType())>=0],"filter-id-in":[ot,[ii(at)],(i,[e])=>e.value.indexOf(i.id())>=0],"filter-in-small":[ot,[ct,ii(at)],(i,[e,r])=>r.value.indexOf(i.properties()[e.value])>=0],"filter-in-large":[ot,[ct,ii(at)],(i,[e,r])=>function(s,u,m,g){for(;m<=g;){const x=m+g>>1;if(u[x]===s)return!0;u[x]>s?g=x-1:m=x+1}return!1}(i.properties()[e.value],r.value,0,r.value.length-1)],all:{type:ot,overloads:[[[ot,ot],(i,[e,r])=>e.evaluate(i)&&r.evaluate(i)],[bn(ot),(i,e)=>{for(const r of e)if(!r.evaluate(i))return!1;return!0}]]},any:{type:ot,overloads:[[[ot,ot],(i,[e,r])=>e.evaluate(i)||r.evaluate(i)],[bn(ot),(i,e)=>{for(const r of e)if(r.evaluate(i))return!0;return!1}]]},"!":[ot,[ot],(i,[e])=>!e.evaluate(i)],"is-supported-script":[ot,[ct],(i,[e])=>{const r=i.globals&&i.globals.isSupportedScript;return!r||r(e.evaluate(i))}],upcase:[ct,[ct],(i,[e])=>e.evaluate(i).toUpperCase()],downcase:[ct,[ct],(i,[e])=>e.evaluate(i).toLowerCase()],concat:[ct,bn(at),(i,e)=>e.map(r=>ue(r.evaluate(i))).join("")],"resolved-locale":[ct,[_n],(i,[e])=>e.evaluate(i).resolvedLocale()]});class gs{constructor(e,r){this.expression=e,this._warningHistory={},this._evaluator=new st,this._defaultValue=r?function(s){return s.type==="color"&&na(s.default)?new M(0,0,0,0):s.type==="color"?M.parse(s.default)||null:s.default===void 0?null:s.default}(r):null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(e,r,s,u,m,g){return this._evaluator.globals=e,this._evaluator.feature=r,this._evaluator.featureState=s,this._evaluator.canonical=u,this._evaluator.availableImages=m||null,this._evaluator.formattedSection=g,this.expression.evaluate(this._evaluator)}evaluate(e,r,s,u,m,g){this._evaluator.globals=e,this._evaluator.feature=r||null,this._evaluator.featureState=s||null,this._evaluator.canonical=u,this._evaluator.availableImages=m||null,this._evaluator.formattedSection=g||null;try{const x=this.expression.evaluate(this._evaluator);if(x==null||typeof x=="number"&&x!=x)return this._defaultValue;if(this._enumValues&&!(x in this._enumValues))throw new ce(`Expected value to be one of ${Object.keys(this._enumValues).map(b=>JSON.stringify(b)).join(", ")}, but found ${JSON.stringify(x)} instead.`);return x}catch(x){return this._warningHistory[x.message]||(this._warningHistory[x.message]=!0,typeof console<"u"&&console.warn(x.message)),this._defaultValue}}}function sa(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in jn}function la(i,e){const r=new Ko(jn,[],e?function(u){const m={color:Mi,string:ct,number:Ee,enum:ct,boolean:ot,formatted:yr,resolvedImage:Hr};return u.type==="array"?ii(m[u.value]||at,u.length):m[u.type]}(e):void 0),s=r.parse(i,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return s?Cl(new gs(s,e)):wn(r.errors)}class ca{constructor(e,r){this.kind=e,this._styleExpression=r,this.isStateDependent=e!=="constant"&&!Zn(r.expression)}evaluateWithoutErrorHandling(e,r,s,u,m,g){return this._styleExpression.evaluateWithoutErrorHandling(e,r,s,u,m,g)}evaluate(e,r,s,u,m,g){return this._styleExpression.evaluate(e,r,s,u,m,g)}}class ha{constructor(e,r,s,u){this.kind=e,this.zoomStops=s,this._styleExpression=r,this.isStateDependent=e!=="camera"&&!Zn(r.expression),this.interpolationType=u}evaluateWithoutErrorHandling(e,r,s,u,m,g){return this._styleExpression.evaluateWithoutErrorHandling(e,r,s,u,m,g)}evaluate(e,r,s,u,m,g){return this._styleExpression.evaluate(e,r,s,u,m,g)}interpolationFactor(e,r,s){return this.interpolationType?Wi.interpolationFactor(this.interpolationType,e,r,s):0}}function ys(i,e){const r=la(i,e);if(r.result==="error")return r;const s=r.value.expression,u=Xo(s);if(!u&&!qn(e))return wn([new Pi("","data expressions not supported")]);const m=yo(s,["zoom"]);if(!m&&!Il(e))return wn([new Pi("","zoom expressions not supported")]);const g=ua(s);return g||m?g instanceof Pi?wn([g]):g instanceof Wi&&!ms(e)?wn([new Pi("",'"interpolate" expressions cannot be used with this property')]):Cl(g?new ha(u?"camera":"composite",r.value,g.labels,g instanceof Wi?g.interpolation:void 0):new ca(u?"constant":"source",r.value)):wn([new Pi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Wn{constructor(e,r){this._parameters=e,this._specification=r,Zr(this,oa(this._parameters,this._specification))}static deserialize(e){return new Wn(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function ua(i){let e=null;if(i instanceof ta)e=ua(i.result);else if(i instanceof ea){for(const r of i.args)if(e=ua(r),e)break}else(i instanceof xo||i instanceof Wi)&&i.input instanceof nt&&i.input.name==="zoom"&&(e=i);return e instanceof Pi||i.eachChild(r=>{const s=ua(r);s instanceof Pi?e=s:!e&&s?e=new Pi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&s&&e!==s&&(e=new Pi("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function vr(i){const e=i.key,r=i.value,s=i.valueSpec||{},u=i.objectElementValidators||{},m=i.style,g=i.styleSpec;let x=[];const b=it(r);if(b!=="object")return[new Me(e,r,`object expected, ${b} found`)];for(const C in r){const P=C.split(".")[0],z=s[P]||s["*"];let L;if(u[P])L=u[P];else if(s[P])L=$i;else if(u["*"])L=u["*"];else{if(!s["*"]){x.push(new Me(e,r[C],`unknown property "${C}"`));continue}L=$i}x=x.concat(L({key:(e&&`${e}.`)+C,value:r[C],valueSpec:z,style:m,styleSpec:g,object:r,objectKey:C},r))}for(const C in s)u[C]||s[C].required&&s[C].default===void 0&&r[C]===void 0&&x.push(new Me(e,r,`missing required property "${C}"`));return x}function El(i){const e=i.value,r=i.valueSpec,s=i.style,u=i.styleSpec,m=i.key,g=i.arrayElementValidator||$i;if(it(e)!=="array")return[new Me(m,e,`array expected, ${it(e)} found`)];if(r.length&&e.length!==r.length)return[new Me(m,e,`array length ${r.length} expected, length ${e.length} found`)];if(r["min-length"]&&e.length<r["min-length"])return[new Me(m,e,`array length at least ${r["min-length"]} expected, length ${e.length} found`)];let x={type:r.value,values:r.values};u.$version<7&&(x.function=r.function),it(r.value)==="object"&&(x=r.value);let b=[];for(let C=0;C<e.length;C++)b=b.concat(g({array:e,arrayIndex:C,value:e[C],valueSpec:x,style:s,styleSpec:u,key:`${m}[${C}]`}));return b}function Al(i){const e=i.key,r=i.value,s=i.valueSpec;let u=it(r);return u==="number"&&r!=r&&(u="NaN"),u!=="number"?[new Me(e,r,`number expected, ${u} found`)]:"minimum"in s&&r<s.minimum?[new Me(e,r,`${r} is less than the minimum value ${s.minimum}`)]:"maximum"in s&&r>s.maximum?[new Me(e,r,`${r} is greater than the maximum value ${s.maximum}`)]:[]}function Pl(i){const e=i.valueSpec,r=zt(i.value.type);let s,u,m,g={};const x=r!=="categorical"&&i.value.property===void 0,b=!x,C=it(i.value.stops)==="array"&&it(i.value.stops[0])==="array"&&it(i.value.stops[0][0])==="object",P=vr({key:i.key,value:i.value,valueSpec:i.styleSpec.function,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{stops:function(F){if(r==="identity")return[new Me(F.key,F.value,'identity function may not have a "stops" property')];let O=[];const W=F.value;return O=O.concat(El({key:F.key,value:W,valueSpec:F.valueSpec,style:F.style,styleSpec:F.styleSpec,arrayElementValidator:z})),it(W)==="array"&&W.length===0&&O.push(new Me(F.key,W,"array must have at least one stop")),O},default:function(F){return $i({key:F.key,value:F.value,valueSpec:e,style:F.style,styleSpec:F.styleSpec})}}});return r==="identity"&&x&&P.push(new Me(i.key,i.value,'missing required property "property"')),r==="identity"||i.value.stops||P.push(new Me(i.key,i.value,'missing required property "stops"')),r==="exponential"&&i.valueSpec.expression&&!ms(i.valueSpec)&&P.push(new Me(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(b&&!qn(i.valueSpec)?P.push(new Me(i.key,i.value,"property functions not supported")):x&&!Il(i.valueSpec)&&P.push(new Me(i.key,i.value,"zoom functions not supported"))),r!=="categorical"&&!C||i.value.property!==void 0||P.push(new Me(i.key,i.value,'"property" property is required')),P;function z(F){let O=[];const W=F.value,X=F.key;if(it(W)!=="array")return[new Me(X,W,`array expected, ${it(W)} found`)];if(W.length!==2)return[new Me(X,W,`array length 2 expected, length ${W.length} found`)];if(C){if(it(W[0])!=="object")return[new Me(X,W,`object expected, ${it(W[0])} found`)];if(W[0].zoom===void 0)return[new Me(X,W,"object stop key must have zoom")];if(W[0].value===void 0)return[new Me(X,W,"object stop key must have value")];if(m&&m>zt(W[0].zoom))return[new Me(X,W[0].zoom,"stop zoom values must appear in ascending order")];zt(W[0].zoom)!==m&&(m=zt(W[0].zoom),u=void 0,g={}),O=O.concat(vr({key:`${X}[0]`,value:W[0],valueSpec:{zoom:{}},style:F.style,styleSpec:F.styleSpec,objectElementValidators:{zoom:Al,value:L}}))}else O=O.concat(L({key:`${X}[0]`,value:W[0],valueSpec:{},style:F.style,styleSpec:F.styleSpec},W));return sa(nr(W[1]))?O.concat([new Me(`${X}[1]`,W[1],"expressions are not allowed in function stops.")]):O.concat($i({key:`${X}[1]`,value:W[1],valueSpec:e,style:F.style,styleSpec:F.styleSpec}))}function L(F,O){const W=it(F.value),X=zt(F.value),oe=F.value!==null?F.value:O;if(s){if(W!==s)return[new Me(F.key,oe,`${W} stop domain type must match previous stop domain type ${s}`)]}else s=W;if(W!=="number"&&W!=="string"&&W!=="boolean")return[new Me(F.key,oe,"stop domain value must be a number, string, or boolean")];if(W!=="number"&&r!=="categorical"){let le=`number expected, ${W} found`;return qn(e)&&r===void 0&&(le+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Me(F.key,oe,le)]}return r!=="categorical"||W!=="number"||isFinite(X)&&Math.floor(X)===X?r!=="categorical"&&W==="number"&&u!==void 0&&X<u?[new Me(F.key,oe,"stop domain values must appear in ascending order")]:(u=X,r==="categorical"&&X in g?[new Me(F.key,oe,"stop domain values must be unique")]:(g[X]=!0,[])):[new Me(F.key,oe,`integer expected, found ${X}`)]}}function Xn(i){const e=(i.expressionContext==="property"?ys:la)(nr(i.value),i.valueSpec);if(e.result==="error")return e.value.map(s=>new Me(`${i.key}${s.key}`,i.value,s.message));const r=e.value.expression||e.value._styleExpression.expression;if(i.expressionContext==="property"&&i.propertyKey==="text-font"&&!r.outputDefined())return[new Me(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"&&!Zn(r))return[new Me(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if(i.expressionContext==="filter"&&!Zn(r))return[new Me(i.key,i.value,'"feature-state" data expressions are not supported with filters.')];if(i.expressionContext&&i.expressionContext.indexOf("cluster")===0){if(!yo(r,["zoom","feature-state"]))return[new Me(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(i.expressionContext==="cluster-initial"&&!Xo(r))return[new Me(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function da(i){const e=i.key,r=i.value,s=i.valueSpec,u=[];return Array.isArray(s.values)?s.values.indexOf(zt(r))===-1&&u.push(new Me(e,r,`expected one of [${s.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(s.values).indexOf(zt(r))===-1&&u.push(new Me(e,r,`expected one of [${Object.keys(s.values).join(", ")}], ${JSON.stringify(r)} found`)),u}function _s(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(!_s(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const Ml={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function pa(i){if(i==null)return{filter:()=>!0,needGeometry:!1};_s(i)||(i=So(i));const e=la(i,Ml);if(e.result==="error")throw new Error(e.value.map(r=>`${r.key}: ${r.message}`).join(", "));return{filter:(r,s,u)=>e.value.evaluate(r,s,{},u),needGeometry:zl(i)}}function ma(i,e){return i<e?-1:i>e?1:0}function zl(i){if(!Array.isArray(i))return!1;if(i[0]==="within")return!0;for(let e=1;e<i.length;e++)if(zl(i[e]))return!0;return!1}function So(i){if(!i)return!0;const e=i[0];return i.length<=1?e!=="any":e==="=="?xs(i[1],i[2],"=="):e==="!="?Yn(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(So))):e==="all"?["all"].concat(i.slice(1).map(So)):e==="none"?["all"].concat(i.slice(1).map(So).map(Yn)):e==="in"?fa(i[1],i.slice(2)):e==="!in"?Yn(fa(i[1],i.slice(2))):e==="has"?ga(i[1]):e==="!has"?Yn(ga(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 fa(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(ma)]]:["filter-in-small",i,["literal",e]]}}function ga(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function Yn(i){return["!",i]}function To(i){return _s(nr(i.value))?Xn(Zr({},i,{expressionContext:"filter",valueSpec:{value:"boolean"}})):kl(i)}function kl(i){const e=i.value,r=i.key;if(it(e)!=="array")return[new Me(r,e,`array expected, ${it(e)} found`)];const s=i.styleSpec;let u,m=[];if(e.length<1)return[new Me(r,e,"filter array must have at least 1 element")];switch(m=m.concat(da({key:`${r}[0]`,value:e[0],valueSpec:s.filter_operator,style:i.style,styleSpec:i.styleSpec})),zt(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&zt(e[1])==="$type"&&m.push(new Me(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&m.push(new Me(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(u=it(e[1]),u!=="string"&&m.push(new Me(`${r}[1]`,e[1],`string expected, ${u} found`)));for(let g=2;g<e.length;g++)u=it(e[g]),zt(e[1])==="$type"?m=m.concat(da({key:`${r}[${g}]`,value:e[g],valueSpec:s.geometry_type,style:i.style,styleSpec:i.styleSpec})):u!=="string"&&u!=="number"&&u!=="boolean"&&m.push(new Me(`${r}[${g}]`,e[g],`string, number, or boolean expected, ${u} found`));break;case"any":case"all":case"none":for(let g=1;g<e.length;g++)m=m.concat(kl({key:`${r}[${g}]`,value:e[g],style:i.style,styleSpec:i.styleSpec}));break;case"has":case"!has":u=it(e[1]),e.length!==2?m.push(new Me(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):u!=="string"&&m.push(new Me(`${r}[1]`,e[1],`string expected, ${u} found`));break;case"within":u=it(e[1]),e.length!==2?m.push(new Me(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):u!=="object"&&m.push(new Me(`${r}[1]`,e[1],`object expected, ${u} found`))}return m}function Co(i,e){const r=i.key,s=i.style,u=i.styleSpec,m=i.value,g=i.objectKey,x=u[`${e}_${i.layerType}`];if(!x)return[];const b=g.match(/^(.*)-transition$/);if(e==="paint"&&b&&x[b[1]]&&x[b[1]].transition)return $i({key:r,value:m,valueSpec:u.transition,style:s,styleSpec:u});const C=i.valueSpec||x[g];if(!C)return[new Me(r,m,`unknown property "${g}"`)];let P;if(it(m)==="string"&&qn(C)&&!C.tokens&&(P=/^{([^}]+)}$/.exec(m)))return[new Me(r,m,`"${g}" does not support interpolation syntax
Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(P[1])} }\`.`)];const z=[];return i.layerType==="symbol"&&(g==="text-field"&&s&&!s.glyphs&&z.push(new Me(r,m,'use of "text-field" requires a style "glyphs" property')),g==="text-font"&&na(nr(m))&&zt(m.type)==="identity"&&z.push(new Me(r,m,'"text-font" does not support identity functions'))),z.concat($i({key:i.key,value:m,valueSpec:C,style:s,styleSpec:u,expressionContext:"property",propertyType:e,propertyKey:g}))}function Ll(i){return Co(i,"paint")}function Dl(i){return Co(i,"layout")}function Rl(i){let e=[];const r=i.value,s=i.key,u=i.style,m=i.styleSpec;r.type||r.ref||e.push(new Me(s,r,'either "type" or "ref" is required'));let g=zt(r.type);const x=zt(r.ref);if(r.id){const b=zt(r.id);for(let C=0;C<i.arrayIndex;C++){const P=u.layers[C];zt(P.id)===b&&e.push(new Me(s,r.id,`duplicate layer id "${r.id}", previously used at line ${P.id.__line__}`))}}if("ref"in r){let b;["type","source","source-layer","filter","layout"].forEach(C=>{C in r&&e.push(new Me(s,r[C],`"${C}" is prohibited for ref layers`))}),u.layers.forEach(C=>{zt(C.id)===x&&(b=C)}),b?b.ref?e.push(new Me(s,r.ref,"ref cannot reference another ref layer")):g=zt(b.type):e.push(new Me(s,r.ref,`ref layer "${x}" not found`))}else if(g!=="background")if(r.source){const b=u.sources&&u.sources[r.source],C=b&&zt(b.type);b?C==="vector"&&g==="raster"?e.push(new Me(s,r.source,`layer "${r.id}" requires a raster source`)):C==="raster"&&g!=="raster"?e.push(new Me(s,r.source,`layer "${r.id}" requires a vector source`)):C!=="vector"||r["source-layer"]?C==="raster-dem"&&g!=="hillshade"?e.push(new Me(s,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):g!=="line"||!r.paint||!r.paint["line-gradient"]||C==="geojson"&&b.lineMetrics||e.push(new Me(s,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new Me(s,r,`layer "${r.id}" must specify a "source-layer"`)):e.push(new Me(s,r.source,`source "${r.source}" not found`))}else e.push(new Me(s,r,'missing required property "source"'));return e=e.concat(vr({key:s,value:r,valueSpec:m.layer,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":()=>[],type:()=>$i({key:`${s}.type`,value:r.type,valueSpec:m.layer.type,style:i.style,styleSpec:i.styleSpec,object:r,objectKey:"type"}),filter:To,layout:b=>vr({layer:r,key:b.key,value:b.value,style:b.style,styleSpec:b.styleSpec,objectElementValidators:{"*":C=>Dl(Zr({layerType:g},C))}}),paint:b=>vr({layer:r,key:b.key,value:b.value,style:b.style,styleSpec:b.styleSpec,objectElementValidators:{"*":C=>Ll(Zr({layerType:g},C))}})}})),e}function Kn(i){const e=i.value,r=i.key,s=it(e);return s!=="string"?[new Me(r,e,`string expected, ${s} found`)]:[]}const Fl={promoteId:function({key:i,value:e}){if(it(e)==="string")return Kn({key:i,value:e});{const r=[];for(const s in e)r.push(...Kn({key:`${i}.${s}`,value:e[s]}));return r}}};function Io(i){const e=i.value,r=i.key,s=i.styleSpec,u=i.style;if(!e.type)return[new Me(r,e,'"type" is required')];const m=zt(e.type);let g;switch(m){case"vector":case"raster":case"raster-dem":return g=vr({key:r,value:e,valueSpec:s[`source_${m.replace("-","_")}`],style:i.style,styleSpec:s,objectElementValidators:Fl}),g;case"geojson":if(g=vr({key:r,value:e,valueSpec:s.source_geojson,style:u,styleSpec:s,objectElementValidators:Fl}),e.cluster)for(const x in e.clusterProperties){const[b,C]=e.clusterProperties[x],P=typeof b=="string"?[b,["accumulated"],["get",x]]:b;g.push(...Xn({key:`${r}.${x}.map`,value:C,expressionContext:"cluster-map"})),g.push(...Xn({key:`${r}.${x}.reduce`,value:P,expressionContext:"cluster-reduce"}))}return g;case"video":return vr({key:r,value:e,valueSpec:s.source_video,style:u,styleSpec:s});case"image":return vr({key:r,value:e,valueSpec:s.source_image,style:u,styleSpec:s});case"canvas":return[new Me(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return da({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:u,styleSpec:s})}}function Eo(i){const e=i.value,r=i.styleSpec,s=r.light,u=i.style;let m=[];const g=it(e);if(e===void 0)return m;if(g!=="object")return m=m.concat([new Me("light",e,`object expected, ${g} found`)]),m;for(const x in e){const b=x.match(/^(.*)-transition$/);m=m.concat(b&&s[b[1]]&&s[b[1]].transition?$i({key:x,value:e[x],valueSpec:r.transition,style:u,styleSpec:r}):s[x]?$i({key:x,value:e[x],valueSpec:s[x],style:u,styleSpec:r}):[new Me(x,e[x],`unknown property "${x}"`)])}return m}const Xi={"*":()=>[],array:El,boolean:function(i){const e=i.value,r=i.key,s=it(e);return s!=="boolean"?[new Me(r,e,`boolean expected, ${s} found`)]:[]},number:Al,color:function(i){const e=i.key,r=i.value,s=it(r);return s!=="string"?[new Me(e,r,`color expected, ${s} found`)]:xr(r)===null?[new Me(e,r,`color expected, "${r}" found`)]:[]},constants:gn,enum:da,filter:To,function:Pl,layer:Rl,object:vr,source:Io,light:Eo,string:Kn,formatted:function(i){return Kn(i).length===0?[]:Xn(i)},resolvedImage:function(i){return Kn(i).length===0?[]:Xn(i)}};function $i(i){const e=i.value,r=i.valueSpec,s=i.styleSpec;return r.expression&&na(zt(e))?Pl(i):r.expression&&sa(nr(e))?Xn(i):r.type&&Xi[r.type]?Xi[r.type](i):vr(Zr({},i,{valueSpec:r.type?s[r.type]:r}))}function uh(i){const e=i.value,r=i.key,s=Kn(i);return s.length||(e.indexOf("{fontstack}")===-1&&s.push(new Me(r,e,'"glyphs" url must include a "{fontstack}" token')),e.indexOf("{range}")===-1&&s.push(new Me(r,e,'"glyphs" url must include a "{range}" token'))),s}function Sn(i,e=pe){let r=[];return r=r.concat($i({key:"",value:i,valueSpec:e.$root,styleSpec:e,style:i,objectElementValidators:{glyphs:uh,"*":()=>[]}})),i.constants&&(r=r.concat(gn({key:"constants",value:i.constants,style:i,styleSpec:e}))),Bl(r)}function Bl(i){return[].concat(i).sort((e,r)=>e.line-r.line)}function Jn(i){return function(...e){return Bl(i.apply(this,e))}}Sn.source=Jn(Io),Sn.light=Jn(Eo),Sn.layer=Jn(Rl),Sn.filter=Jn(To),Sn.paintProperty=Jn(Ll),Sn.layoutProperty=Jn(Dl);const Tn=Sn,dh=Tn.light,vs=Tn.paintProperty,ph=Tn.layoutProperty;function Ol(i,e){let r=!1;if(e&&e.length)for(const s of e)i.fire(new fn(new Error(s.message))),r=!0;return r}class Cn{constructor(e,r,s){const u=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const g=new Int32Array(this.arrayBuffer);e=g[0],this.d=(r=g[1])+2*(s=g[2]);for(let b=0;b<this.d*this.d;b++){const C=g[3+b],P=g[3+b+1];u.push(C===P?null:g.subarray(C,P))}const x=g[3+u.length+1];this.keys=g.subarray(g[3+u.length],x),this.bboxes=g.subarray(x),this.insert=this._insertReadonly}else{this.d=r+2*s;for(let g=0;g<this.d*this.d;g++)u.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=e,this.padding=s,this.scale=r/e,this.uid=0;const m=s/r*e;this.min=-m,this.max=e+m}insert(e,r,s,u,m){this._forEachCell(r,s,u,m,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(r),this.bboxes.push(s),this.bboxes.push(u),this.bboxes.push(m)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,r,s,u,m,g){this.cells[m].push(g)}query(e,r,s,u,m){const g=this.min,x=this.max;if(e<=g&&r<=g&&x<=s&&x<=u&&!m)return Array.prototype.slice.call(this.keys);{const b=[];return this._forEachCell(e,r,s,u,this._queryCell,b,{},m),b}}_queryCell(e,r,s,u,m,g,x,b){const C=this.cells[m];if(C!==null){const P=this.keys,z=this.bboxes;for(let L=0;L<C.length;L++){const F=C[L];if(x[F]===void 0){const O=4*F;(b?b(z[O+0],z[O+1],z[O+2],z[O+3]):e<=z[O+2]&&r<=z[O+3]&&s>=z[O+0]&&u>=z[O+1])?(x[F]=!0,g.push(P[F])):x[F]=!1}}}}_forEachCell(e,r,s,u,m,g,x,b){const C=this._convertToCellCoord(e),P=this._convertToCellCoord(r),z=this._convertToCellCoord(s),L=this._convertToCellCoord(u);for(let F=C;F<=z;F++)for(let O=P;O<=L;O++){const W=this.d*O+F;if((!b||b(this._convertFromCellCoord(F),this._convertFromCellCoord(O),this._convertFromCellCoord(F+1),this._convertFromCellCoord(O+1)))&&m.call(this,e,r,s,u,W,g,x,b))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 s=0;for(let g=0;g<this.cells.length;g++)s+=this.cells[g].length;const u=new Int32Array(r+s+this.keys.length+this.bboxes.length);u[0]=this.extent,u[1]=this.n,u[2]=this.padding;let m=r;for(let g=0;g<e.length;g++){const x=e[g];u[3+g]=m,u.set(x,m),m+=x.length}return u[3+e.length]=m,u.set(this.keys,m),m+=this.keys.length,u[3+e.length+1]=m,u.set(this.bboxes,m),m+=this.bboxes.length,u.buffer}static serialize(e,r){const s=e.toArrayBuffer();return r&&r.push(s),{buffer:s}}static deserialize(e){return new Cn(e.buffer)}}const Qn={};function Oe(i,e,r={}){Object.defineProperty(e,"_classRegistryKey",{value:i,writeable:!1}),Qn[i]={klass:e,omit:r.omit||[],shallow:r.shallow||[]}}Oe("Object",Object),Oe("TransferableGridIndex",Cn),Oe("Color",M),Oe("Error",Error),Oe("AJAXError",mi),Oe("ResolvedImage",ee),Oe("StylePropertyFunction",Wn),Oe("StyleExpression",gs,{omit:["_evaluator"]}),Oe("ZoomDependentExpression",ha),Oe("ZoomConstantExpression",ca),Oe("CompoundExpression",nt,{omit:["_evaluate"]});for(const i in jn)jn[i]._classRegistryKey||Oe(`Expression_${i}`,jn[i]);function bs(i){return i&&typeof ArrayBuffer<"u"&&(i instanceof ArrayBuffer||i.constructor&&i.constructor.name==="ArrayBuffer")}function Ao(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(bs(i)||Ht(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 s of i)r.push(Ao(s,e));return r}if(typeof i=="object"){const r=i.constructor,s=r._classRegistryKey;if(!s)throw new Error("can't serialize object of unregistered class");const u=r.serialize?r.serialize(i,e):{};if(!r.serialize){for(const m in i){if(!i.hasOwnProperty(m)||Qn[s].omit.indexOf(m)>=0)continue;const g=i[m];u[m]=Qn[s].shallow.indexOf(m)>=0?g:Ao(g,e)}i instanceof Error&&(u.message=i.message)}if(u.$name)throw new Error("$name property is reserved for worker serialization logic.");return s!=="Object"&&(u.$name=s),u}throw new Error("can't serialize object of type "+typeof i)}function In(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||bs(i)||Ht(i)||ArrayBuffer.isView(i)||i instanceof ImageData)return i;if(Array.isArray(i))return i.map(In);if(typeof i=="object"){const e=i.$name||"Object";if(!Qn[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:r}=Qn[e];if(!r)throw new Error(`can't deserialize unregistered class ${e}`);if(r.deserialize)return r.deserialize(i);const s=Object.create(r.prototype);for(const u of Object.keys(i)){if(u==="$name")continue;const m=i[u];s[u]=Qn[e].shallow.indexOf(u)>=0?m:In(m)}return s}throw new Error("can't deserialize object of type "+typeof i)}class Po{constructor(){this.first=!0}update(e,r){const s=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=s,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=s,!0):(this.lastFloorZoom>s?(this.lastIntegerZoom=s+1,this.lastIntegerZoomTime=r):this.lastFloorZoom<s&&(this.lastIntegerZoom=s,this.lastIntegerZoomTime=r),e!==this.lastZoom&&(this.lastZoom=e,this.lastFloorZoom=s,!0))}}const Pe={"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 ws(i){for(const e of i)if(Mo(e.charCodeAt(0)))return!0;return!1}function Ul(i){for(const e of i)if(!mh(e.charCodeAt(0)))return!1;return!0}function mh(i){return!(Pe.Arabic(i)||Pe["Arabic Supplement"](i)||Pe["Arabic Extended-A"](i)||Pe["Arabic Presentation Forms-A"](i)||Pe["Arabic Presentation Forms-B"](i))}function Mo(i){return!(i!==746&&i!==747&&(i<4352||!(Pe["Bopomofo Extended"](i)||Pe.Bopomofo(i)||Pe["CJK Compatibility Forms"](i)&&!(i>=65097&&i<=65103)||Pe["CJK Compatibility Ideographs"](i)||Pe["CJK Compatibility"](i)||Pe["CJK Radicals Supplement"](i)||Pe["CJK Strokes"](i)||!(!Pe["CJK Symbols and Punctuation"](i)||i>=12296&&i<=12305||i>=12308&&i<=12319||i===12336)||Pe["CJK Unified Ideographs Extension A"](i)||Pe["CJK Unified Ideographs"](i)||Pe["Enclosed CJK Letters and Months"](i)||Pe["Hangul Compatibility Jamo"](i)||Pe["Hangul Jamo Extended-A"](i)||Pe["Hangul Jamo Extended-B"](i)||Pe["Hangul Jamo"](i)||Pe["Hangul Syllables"](i)||Pe.Hiragana(i)||Pe["Ideographic Description Characters"](i)||Pe.Kanbun(i)||Pe["Kangxi Radicals"](i)||Pe["Katakana Phonetic Extensions"](i)||Pe.Katakana(i)&&i!==12540||!(!Pe["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)||!(!Pe["Small Form Variants"](i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||Pe["Unified Canadian Aboriginal Syllabics"](i)||Pe["Unified Canadian Aboriginal Syllabics Extended"](i)||Pe["Vertical Forms"](i)||Pe["Yijing Hexagram Symbols"](i)||Pe["Yi Syllables"](i)||Pe["Yi Radicals"](i))))}function $l(i){return!(Mo(i)||function(e){return!!(Pe["Latin-1 Supplement"](e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||Pe["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)||Pe["Letterlike Symbols"](e)||Pe["Number Forms"](e)||Pe["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)||Pe["Control Pictures"](e)&&e!==9251||Pe["Optical Character Recognition"](e)||Pe["Enclosed Alphanumerics"](e)||Pe["Geometric Shapes"](e)||Pe["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||Pe["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||Pe["CJK Symbols and Punctuation"](e)||Pe.Katakana(e)||Pe["Private Use Area"](e)||Pe["CJK Compatibility Forms"](e)||Pe["Small Form Variants"](e)||Pe["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 Nl(i){return i>=1424&&i<=2303||Pe["Arabic Presentation Forms-A"](i)||Pe["Arabic Presentation Forms-B"](i)}function fh(i,e){return!(!e&&Nl(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||Pe.Khmer(i))}function gh(i){for(const e of i)if(Nl(e.charCodeAt(0)))return!0;return!1}const ya="deferred",Ss="loading",Ts="loaded";let Cs=null,Ni="unavailable",nn=null;const Vl=function(i){i&&typeof i=="string"&&i.indexOf("NetworkError")>-1&&(Ni="error"),Cs&&Cs(i)};function Is(){eo.fire(new rn("pluginStateChange",{pluginStatus:Ni,pluginURL:nn}))}const eo=new fo,Es=function(){return Ni},_a=function(){if(Ni!==ya||!nn)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Ni=Ss,Is(),nn&&Ir({url:nn},i=>{i?Vl(i):(Ni=Ts,Is())})},ar={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Ni===Ts||ar.applyArabicShaping!=null,isLoading:()=>Ni===Ss,setState(i){Ni=i.pluginStatus,nn=i.pluginURL},isParsed:()=>ar.applyArabicShaping!=null&&ar.processBidirectionalText!=null&&ar.processStyledBidirectionalText!=null,getPluginURL:()=>nn};class Ut{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 Po,this.transition={})}isSupportedScript(e){return function(r,s){for(const u of r)if(!fh(u.charCodeAt(0),s))return!1;return!0}(e,ar.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),s=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*s}:{fromScale:.5,toScale:1,t:1-(1-s)*r}}}class xa{constructor(e,r){this.property=e,this.value=r,this.expression=function(s,u){if(na(s))return new Wn(s,u);if(sa(s)){const m=ys(s,u);if(m.result==="error")throw new Error(m.value.map(g=>`${g.key}: ${g.message}`).join(", "));return m.value}{let m=s;return typeof s=="string"&&u.type==="color"&&(m=M.parse(s)),{kind:"constant",evaluate:()=>m}}}(r===void 0?e.specification.default:r,e.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,r,s){return this.property.possiblyEvaluate(this,e,r,s)}}class va{constructor(e){this.property=e,this.value=new xa(e,void 0)}transitioned(e,r){return new Gl(this.property,this.value,r,be({},e.transition,this.transition),e.now)}untransitioned(){return new Gl(this.property,this.value,null,{},0)}}class As{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return Ge(this._values[e].value.value)}setValue(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new va(this._values[e].property)),this._values[e].value=new xa(this._values[e].property,r===null?void 0:Ge(r))}getTransition(e){return Ge(this._values[e].transition)}setTransition(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new va(this._values[e].property)),this._values[e].transition=Ge(r)||void 0}serialize(){const e={};for(const r of Object.keys(this._values)){const s=this.getValue(r);s!==void 0&&(e[r]=s);const u=this.getTransition(r);u!==void 0&&(e[`${r}-transition`]=u)}return e}transitioned(e,r){const s=new Zl(this._properties);for(const u of Object.keys(this._values))s._values[u]=this._values[u].transitioned(e,r._values[u]);return s}untransitioned(){const e=new Zl(this._properties);for(const r of Object.keys(this._values))e._values[r]=this._values[r].untransitioned();return e}}class Gl{constructor(e,r,s,u,m){this.property=e,this.value=r,this.begin=m+u.delay||0,this.end=this.begin+u.duration||0,e.specification.transition&&(u.delay||u.duration)&&(this.prior=s)}possiblyEvaluate(e,r,s){const u=e.now||0,m=this.value.possiblyEvaluate(e,r,s),g=this.prior;if(g){if(u>this.end)return this.prior=null,m;if(this.value.isDataDriven())return this.prior=null,m;if(u<this.begin)return g.possiblyEvaluate(e,r,s);{const x=(u-this.begin)/(this.end-this.begin);return this.property.interpolate(g.possiblyEvaluate(e,r,s),m,function(b){if(b<=0)return 0;if(b>=1)return 1;const C=b*b,P=C*b;return 4*(b<.5?P:3*(b-C)+P-.75)}(x))}}return m}}class Zl{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,r,s){const u=new ba(this._properties);for(const m of Object.keys(this._values))u._values[m]=this._values[m].possiblyEvaluate(e,r,s);return u}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class yh{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}getValue(e){return Ge(this._values[e].value)}setValue(e,r){this._values[e]=new xa(this._values[e].property,r===null?void 0:Ge(r))}serialize(){const e={};for(const r of Object.keys(this._values)){const s=this.getValue(r);s!==void 0&&(e[r]=s)}return e}possiblyEvaluate(e,r,s){const u=new ba(this._properties);for(const m of Object.keys(this._values))u._values[m]=this._values[m].possiblyEvaluate(e,r,s);return u}}class Pr{constructor(e,r,s){this.property=e,this.value=r,this.parameters=s}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,r,s,u){return this.property.evaluate(this.value,this.parameters,e,r,s,u)}}class ba{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class He{constructor(e){this.specification=e}possiblyEvaluate(e,r){return e.expression.evaluate(r)}interpolate(e,r,s){const u=vo[this.specification.type];return u?u(e,r,s):e}}class Je{constructor(e,r){this.specification=e,this.overrides=r}possiblyEvaluate(e,r,s,u){return new Pr(this,e.expression.kind==="constant"||e.expression.kind==="camera"?{kind:"constant",value:e.expression.evaluate(r,null,{},s,u)}:e.expression,r)}interpolate(e,r,s){if(e.value.kind!=="constant"||r.value.kind!=="constant")return e;if(e.value.value===void 0||r.value.value===void 0)return new Pr(this,{kind:"constant",value:void 0},e.parameters);const u=vo[this.specification.type];return u?new Pr(this,{kind:"constant",value:u(e.value.value,r.value.value,s)},e.parameters):e}evaluate(e,r,s,u,m,g){return e.kind==="constant"?e.value:e.evaluate(r,s,u,m,g)}}class zo extends Je{possiblyEvaluate(e,r,s,u){if(e.value===void 0)return new Pr(this,{kind:"constant",value:void 0},r);if(e.expression.kind==="constant"){const m=e.expression.evaluate(r,null,{},s,u),g=e.property.specification.type==="resolvedImage"&&typeof m!="string"?m.name:m,x=this._calculate(g,g,g,r);return new Pr(this,{kind:"constant",value:x},r)}if(e.expression.kind==="camera"){const m=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 Pr(this,{kind:"constant",value:m},r)}return new Pr(this,e.expression,r)}evaluate(e,r,s,u,m,g){if(e.kind==="source"){const x=e.evaluate(r,s,u,m,g);return this._calculate(x,x,x,r)}return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(r.zoom)-1},s,u),e.evaluate({zoom:Math.floor(r.zoom)},s,u),e.evaluate({zoom:Math.floor(r.zoom)+1},s,u),r):e.value}_calculate(e,r,s,u){return u.zoom>u.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:s,to:r}}interpolate(e){return e}}class ko{constructor(e){this.specification=e}possiblyEvaluate(e,r,s,u){if(e.value!==void 0){if(e.expression.kind==="constant"){const m=e.expression.evaluate(r,null,{},s,u);return this._calculate(m,m,m,r)}return this._calculate(e.expression.evaluate(new Ut(Math.floor(r.zoom-1),r)),e.expression.evaluate(new Ut(Math.floor(r.zoom),r)),e.expression.evaluate(new Ut(Math.floor(r.zoom+1),r)),r)}}_calculate(e,r,s,u){return u.zoom>u.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:s,to:r}}interpolate(e){return e}}class Ps{constructor(e){this.specification=e}possiblyEvaluate(e,r,s,u){return!!e.expression.evaluate(r,null,{},s,u)}interpolate(){return!1}}class ci{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const r in e){const s=e[r];s.specification.overridable&&this.overridableProperties.push(r);const u=this.defaultPropertyValues[r]=new xa(s,void 0),m=this.defaultTransitionablePropertyValues[r]=new va(s);this.defaultTransitioningPropertyValues[r]=m.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=u.possiblyEvaluate({})}}}Oe("DataDrivenProperty",Je),Oe("DataConstantProperty",He),Oe("CrossFadedDataDrivenProperty",zo),Oe("CrossFadedProperty",ko),Oe("ColorRampProperty",Ps);const En="-transition";class Vi extends fo{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 yh(r.layout)),r.paint)){this._transitionablePaint=new As(r.paint);for(const s in e.paint)this.setPaintProperty(s,e.paint[s],{validate:!1});for(const s in e.layout)this.setLayoutProperty(s,e.layout[s],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new ba(r.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,r,s={}){r!=null&&this._validate(ph,`layers.${this.id}.layout.${e}`,e,r,s)||(e!=="visibility"?this._unevaluatedLayout.setValue(e,r):this.visibility=r)}getPaintProperty(e){return e.endsWith(En)?this._transitionablePaint.getTransition(e.slice(0,-En.length)):this._transitionablePaint.getValue(e)}setPaintProperty(e,r,s={}){if(r!=null&&this._validate(vs,`layers.${this.id}.paint.${e}`,e,r,s))return!1;if(e.endsWith(En))return this._transitionablePaint.setTransition(e.slice(0,-En.length),r||void 0),!1;{const u=this._transitionablePaint._values[e],m=u.property.specification["property-type"]==="cross-faded-data-driven",g=u.value.isDataDriven(),x=u.value;this._transitionablePaint.setValue(e,r),this._handleSpecialPaintPropertyUpdate(e);const b=this._transitionablePaint._values[e].value;return b.isDataDriven()||g||m||this._handleOverridablePaintPropertyUpdate(e,x,b)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,r,s){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),Ve(e,(r,s)=>!(r===void 0||s==="layout"&&!Object.keys(r).length||s==="paint"&&!Object.keys(r).length))}_validate(e,r,s,u,m={}){return(!m||m.validate!==!1)&&Ol(this,e.call(Tn,{key:r,layerType:this.type,objectKey:s,value:u,styleSpec:pe,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 Pr&&qn(r.property.specification)&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}}const _h={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Lo{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 Ft{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 hi(i,e=1){let r=0,s=0;return{members:i.map(u=>{const m=_h[u.type].BYTES_PER_ELEMENT,g=r=Hl(r,Math.max(e,m)),x=u.components||1;return s=Math.max(s,m),r+=m*x,{name:u.name,type:u.type,components:x,offset:g}}),size:Hl(r,Math.max(s,e)),alignment:e}}function Hl(i,e){return Math.ceil(i/e)*e}class to extends Ft{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r){const s=this.length;return this.resize(s+1),this.emplace(s,e,r)}emplace(e,r,s){const u=2*e;return this.int16[u+0]=r,this.int16[u+1]=s,e}}to.prototype.bytesPerElement=4,Oe("StructArrayLayout2i4",to);class Do extends Ft{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,u){const m=this.length;return this.resize(m+1),this.emplace(m,e,r,s,u)}emplace(e,r,s,u,m){const g=4*e;return this.int16[g+0]=r,this.int16[g+1]=s,this.int16[g+2]=u,this.int16[g+3]=m,e}}Do.prototype.bytesPerElement=8,Oe("StructArrayLayout4i8",Do);class d extends Ft{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,u,m,g){const x=this.length;return this.resize(x+1),this.emplace(x,e,r,s,u,m,g)}emplace(e,r,s,u,m,g,x){const b=6*e;return this.int16[b+0]=r,this.int16[b+1]=s,this.int16[b+2]=u,this.int16[b+3]=m,this.int16[b+4]=g,this.int16[b+5]=x,e}}d.prototype.bytesPerElement=12,Oe("StructArrayLayout2i4i12",d);class t extends Ft{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,u,m,g){const x=this.length;return this.resize(x+1),this.emplace(x,e,r,s,u,m,g)}emplace(e,r,s,u,m,g,x){const b=4*e,C=8*e;return this.int16[b+0]=r,this.int16[b+1]=s,this.uint8[C+4]=u,this.uint8[C+5]=m,this.uint8[C+6]=g,this.uint8[C+7]=x,e}}t.prototype.bytesPerElement=8,Oe("StructArrayLayout2i4ub8",t);class o extends Ft{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r){const s=this.length;return this.resize(s+1),this.emplace(s,e,r)}emplace(e,r,s){const u=2*e;return this.float32[u+0]=r,this.float32[u+1]=s,e}}o.prototype.bytesPerElement=8,Oe("StructArrayLayout2f8",o);class h extends Ft{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,s,u,m,g,x,b,C,P){const z=this.length;return this.resize(z+1),this.emplace(z,e,r,s,u,m,g,x,b,C,P)}emplace(e,r,s,u,m,g,x,b,C,P,z){const L=10*e;return this.uint16[L+0]=r,this.uint16[L+1]=s,this.uint16[L+2]=u,this.uint16[L+3]=m,this.uint16[L+4]=g,this.uint16[L+5]=x,this.uint16[L+6]=b,this.uint16[L+7]=C,this.uint16[L+8]=P,this.uint16[L+9]=z,e}}h.prototype.bytesPerElement=20,Oe("StructArrayLayout10ui20",h);class p extends Ft{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,s,u,m,g,x,b,C,P,z,L){const F=this.length;return this.resize(F+1),this.emplace(F,e,r,s,u,m,g,x,b,C,P,z,L)}emplace(e,r,s,u,m,g,x,b,C,P,z,L,F){const O=12*e;return this.int16[O+0]=r,this.int16[O+1]=s,this.int16[O+2]=u,this.int16[O+3]=m,this.uint16[O+4]=g,this.uint16[O+5]=x,this.uint16[O+6]=b,this.uint16[O+7]=C,this.int16[O+8]=P,this.int16[O+9]=z,this.int16[O+10]=L,this.int16[O+11]=F,e}}p.prototype.bytesPerElement=24,Oe("StructArrayLayout4i4ui4i24",p);class y extends Ft{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,s){const u=this.length;return this.resize(u+1),this.emplace(u,e,r,s)}emplace(e,r,s,u){const m=3*e;return this.float32[m+0]=r,this.float32[m+1]=s,this.float32[m+2]=u,e}}y.prototype.bytesPerElement=12,Oe("StructArrayLayout3f12",y);class v extends Ft{_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}}v.prototype.bytesPerElement=4,Oe("StructArrayLayout1ul4",v);class S extends Ft{_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,s,u,m,g,x,b,C){const P=this.length;return this.resize(P+1),this.emplace(P,e,r,s,u,m,g,x,b,C)}emplace(e,r,s,u,m,g,x,b,C,P){const z=10*e,L=5*e;return this.int16[z+0]=r,this.int16[z+1]=s,this.int16[z+2]=u,this.int16[z+3]=m,this.int16[z+4]=g,this.int16[z+5]=x,this.uint32[L+3]=b,this.uint16[z+8]=C,this.uint16[z+9]=P,e}}S.prototype.bytesPerElement=20,Oe("StructArrayLayout6i1ul2ui20",S);class T extends Ft{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,u,m,g){const x=this.length;return this.resize(x+1),this.emplace(x,e,r,s,u,m,g)}emplace(e,r,s,u,m,g,x){const b=6*e;return this.int16[b+0]=r,this.int16[b+1]=s,this.int16[b+2]=u,this.int16[b+3]=m,this.int16[b+4]=g,this.int16[b+5]=x,e}}T.prototype.bytesPerElement=12,Oe("StructArrayLayout2i2i2i12",T);class A extends Ft{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,u,m){const g=this.length;return this.resize(g+1),this.emplace(g,e,r,s,u,m)}emplace(e,r,s,u,m,g){const x=4*e,b=8*e;return this.float32[x+0]=r,this.float32[x+1]=s,this.float32[x+2]=u,this.int16[b+6]=m,this.int16[b+7]=g,e}}A.prototype.bytesPerElement=16,Oe("StructArrayLayout2f1f2i16",A);class k extends Ft{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,s,u){const m=this.length;return this.resize(m+1),this.emplace(m,e,r,s,u)}emplace(e,r,s,u,m){const g=12*e,x=3*e;return this.uint8[g+0]=r,this.uint8[g+1]=s,this.float32[x+1]=u,this.float32[x+2]=m,e}}k.prototype.bytesPerElement=12,Oe("StructArrayLayout2ub2f12",k);class R extends Ft{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,s){const u=this.length;return this.resize(u+1),this.emplace(u,e,r,s)}emplace(e,r,s,u){const m=3*e;return this.uint16[m+0]=r,this.uint16[m+1]=s,this.uint16[m+2]=u,e}}R.prototype.bytesPerElement=6,Oe("StructArrayLayout3ui6",R);class $ extends Ft{_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,s,u,m,g,x,b,C,P,z,L,F,O,W,X,oe){const le=this.length;return this.resize(le+1),this.emplace(le,e,r,s,u,m,g,x,b,C,P,z,L,F,O,W,X,oe)}emplace(e,r,s,u,m,g,x,b,C,P,z,L,F,O,W,X,oe,le){const se=24*e,me=12*e,xe=48*e;return this.int16[se+0]=r,this.int16[se+1]=s,this.uint16[se+2]=u,this.uint16[se+3]=m,this.uint32[me+2]=g,this.uint32[me+3]=x,this.uint32[me+4]=b,this.uint16[se+10]=C,this.uint16[se+11]=P,this.uint16[se+12]=z,this.float32[me+7]=L,this.float32[me+8]=F,this.uint8[xe+36]=O,this.uint8[xe+37]=W,this.uint8[xe+38]=X,this.uint32[me+10]=oe,this.int16[se+22]=le,e}}$.prototype.bytesPerElement=48,Oe("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",$);class q extends Ft{_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,s,u,m,g,x,b,C,P,z,L,F,O,W,X,oe,le,se,me,xe,ye,Ue,qe,ke,Le,Ie,Be){const De=this.length;return this.resize(De+1),this.emplace(De,e,r,s,u,m,g,x,b,C,P,z,L,F,O,W,X,oe,le,se,me,xe,ye,Ue,qe,ke,Le,Ie,Be)}emplace(e,r,s,u,m,g,x,b,C,P,z,L,F,O,W,X,oe,le,se,me,xe,ye,Ue,qe,ke,Le,Ie,Be,De){const Te=34*e,Qe=17*e;return this.int16[Te+0]=r,this.int16[Te+1]=s,this.int16[Te+2]=u,this.int16[Te+3]=m,this.int16[Te+4]=g,this.int16[Te+5]=x,this.int16[Te+6]=b,this.int16[Te+7]=C,this.uint16[Te+8]=P,this.uint16[Te+9]=z,this.uint16[Te+10]=L,this.uint16[Te+11]=F,this.uint16[Te+12]=O,this.uint16[Te+13]=W,this.uint16[Te+14]=X,this.uint16[Te+15]=oe,this.uint16[Te+16]=le,this.uint16[Te+17]=se,this.uint16[Te+18]=me,this.uint16[Te+19]=xe,this.uint16[Te+20]=ye,this.uint16[Te+21]=Ue,this.uint16[Te+22]=qe,this.uint32[Qe+12]=ke,this.float32[Qe+13]=Le,this.float32[Qe+14]=Ie,this.float32[Qe+15]=Be,this.float32[Qe+16]=De,e}}q.prototype.bytesPerElement=68,Oe("StructArrayLayout8i15ui1ul4f68",q);class N extends Ft{_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}}N.prototype.bytesPerElement=4,Oe("StructArrayLayout1f4",N);class j extends Ft{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s){const u=this.length;return this.resize(u+1),this.emplace(u,e,r,s)}emplace(e,r,s,u){const m=3*e;return this.int16[m+0]=r,this.int16[m+1]=s,this.int16[m+2]=u,e}}j.prototype.bytesPerElement=6,Oe("StructArrayLayout3i6",j);class ie extends Ft{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,s){const u=this.length;return this.resize(u+1),this.emplace(u,e,r,s)}emplace(e,r,s,u){const m=4*e;return this.uint32[2*e+0]=r,this.uint16[m+2]=s,this.uint16[m+3]=u,e}}ie.prototype.bytesPerElement=8,Oe("StructArrayLayout1ul2ui8",ie);class re extends Ft{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r){const s=this.length;return this.resize(s+1),this.emplace(s,e,r)}emplace(e,r,s){const u=2*e;return this.uint16[u+0]=r,this.uint16[u+1]=s,e}}re.prototype.bytesPerElement=4,Oe("StructArrayLayout2ui4",re);class ae extends Ft{_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}}ae.prototype.bytesPerElement=2,Oe("StructArrayLayout1ui2",ae);class ne extends Ft{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,s,u){const m=this.length;return this.resize(m+1),this.emplace(m,e,r,s,u)}emplace(e,r,s,u,m){const g=4*e;return this.float32[g+0]=r,this.float32[g+1]=s,this.float32[g+2]=u,this.float32[g+3]=m,e}}ne.prototype.bytesPerElement=16,Oe("StructArrayLayout4f16",ne);class ge extends Lo{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 Ye(this.anchorPointX,this.anchorPointY)}}ge.prototype.size=20;class he extends S{get(e){return new ge(this,e)}}Oe("CollisionBoxArray",he);class de extends Lo{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]}}de.prototype.size=48;class Se extends ${get(e){return new de(this,e)}}Oe("PlacedSymbolArray",Se);class Ce extends Lo{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]}}Ce.prototype.size=68;class fe extends q{get(e){return new Ce(this,e)}}Oe("SymbolInstanceArray",fe);class Ne extends N{getoffsetX(e){return this.float32[1*e+0]}}Oe("GlyphOffsetArray",Ne);class ze extends j{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}Oe("SymbolLineVertexArray",ze);class et extends Lo{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]}}et.prototype.size=8;class _t extends ie{get(e){return new et(this,e)}}Oe("FeatureIndexArray",_t);class dt extends to{}class ft extends to{}class jt extends d{}class tt extends t{}class bt extends o{}class Pt extends h{}class xi extends p{}class Yi extends y{}class sr extends v{}class lr extends T{}class on extends k{}class Gi extends R{}class Mr extends re{}const An=hi([{name:"a_pos",components:2,type:"Int16"}],4),{members:Ki}=An;class wt{constructor(e=[]){this.segments=e}prepareSegment(e,r,s,u){let m=this.segments[this.segments.length-1];return e>wt.MAX_VERTEX_ARRAY_LENGTH&&rt(`Max vertices per segment is ${wt.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!m||m.vertexLength+e>wt.MAX_VERTEX_ARRAY_LENGTH||m.sortKey!==u)&&(m={vertexOffset:r.length,primitiveOffset:s.length,vertexLength:0,primitiveLength:0},u!==void 0&&(m.sortKey=u),this.segments.push(m)),m}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,s,u){return new wt([{vertexOffset:e,primitiveOffset:r,vertexLength:s,primitiveLength:u,vaos:{},sortKey:0}])}}function Tt(i,e){return 256*(i=Z(Math.floor(i),0,255))+Z(Math.floor(e),0,255)}wt.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Oe("SegmentVector",wt);const ni=hi([{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 zi={exports:{}},$t={exports:{}};$t.exports=function(i,e){var r,s,u,m,g,x,b,C;for(s=i.length-(r=3&i.length),u=e,g=3432918353,x=461845907,C=0;C<s;)b=255&i.charCodeAt(C)|(255&i.charCodeAt(++C))<<8|(255&i.charCodeAt(++C))<<16|(255&i.charCodeAt(++C))<<24,++C,u=27492+(65535&(m=5*(65535&(u=(u^=b=(65535&(b=(b=(65535&b)*g+(((b>>>16)*g&65535)<<16)&4294967295)<<15|b>>>17))*x+(((b>>>16)*x&65535)<<16)&4294967295)<<13|u>>>19))+((5*(u>>>16)&65535)<<16)&4294967295))+((58964+(m>>>16)&65535)<<16);switch(b=0,r){case 3:b^=(255&i.charCodeAt(C+2))<<16;case 2:b^=(255&i.charCodeAt(C+1))<<8;case 1:u^=b=(65535&(b=(b=(65535&(b^=255&i.charCodeAt(C)))*g+(((b>>>16)*g&65535)<<16)&4294967295)<<15|b>>>17))*x+(((b>>>16)*x&65535)<<16)&4294967295}return u^=i.length,u=2246822507*(65535&(u^=u>>>16))+((2246822507*(u>>>16)&65535)<<16)&4294967295,u=3266489909*(65535&(u^=u>>>13))+((3266489909*(u>>>16)&65535)<<16)&4294967295,(u^=u>>>16)>>>0};var Pn={exports:{}};Pn.exports=function(i,e){for(var r,s=i.length,u=e^s,m=0;s>=4;)r=1540483477*(65535&(r=255&i.charCodeAt(m)|(255&i.charCodeAt(++m))<<8|(255&i.charCodeAt(++m))<<16|(255&i.charCodeAt(++m))<<24))+((1540483477*(r>>>16)&65535)<<16),u=1540483477*(65535&u)+((1540483477*(u>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),s-=4,++m;switch(s){case 3:u^=(255&i.charCodeAt(m+2))<<16;case 2:u^=(255&i.charCodeAt(m+1))<<8;case 1:u=1540483477*(65535&(u^=255&i.charCodeAt(m)))+((1540483477*(u>>>16)&65535)<<16)}return u=1540483477*(65535&(u^=u>>>13))+((1540483477*(u>>>16)&65535)<<16),(u^=u>>>15)>>>0};var zr=$t.exports,wa=Pn.exports;zi.exports=zr,zi.exports.murmur3=zr,zi.exports.murmur2=wa;var Ms=zi.exports;class Sa{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,s,u){this.ids.push(jl(e)),this.positions.push(r,s,u)}getPositions(e){const r=jl(e);let s=0,u=this.ids.length-1;for(;s<u;){const g=s+u>>1;this.ids[g]>=r?u=g:s=g+1}const m=[];for(;this.ids[s]===r;)m.push({index:this.positions[3*s],start:this.positions[3*s+1],end:this.positions[3*s+2]}),s++;return m}static serialize(e,r){const s=new Float64Array(e.ids),u=new Uint32Array(e.positions);return Mn(s,u,0,s.length-1),r&&r.push(s.buffer,u.buffer),{ids:s,positions:u}}static deserialize(e){const r=new Sa;return r.ids=e.ids,r.positions=e.positions,r.indexed=!0,r}}function jl(i){const e=+i;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:Ms(String(i))}function Mn(i,e,r,s){for(;r<s;){const u=i[r+s>>1];let m=r-1,g=s+1;for(;;){do m++;while(i[m]<u);do g--;while(i[g]>u);if(m>=g)break;Ta(i,m,g),Ta(e,3*m,3*g),Ta(e,3*m+1,3*g+1),Ta(e,3*m+2,3*g+2)}g-r<s-g?(Mn(i,e,r,g),r=g+1):(Mn(i,e,g+1,s),s=g)}}function Ta(i,e,r){const s=i[e];i[e]=i[r],i[r]=s}Oe("FeaturePositionMap",Sa);class kr{constructor(e,r){this.gl=e.gl,this.location=r}}class io extends kr{constructor(e,r){super(e,r),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}}class ld extends kr{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 cd extends kr{constructor(e,r){super(e,r),this.current=M.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 Eg=new Float32Array(16);function xh(i){return[Tt(255*i.r,255*i.g),Tt(255*i.b,255*i.a)]}class zs{constructor(e,r,s){this.value=e,this.uniformNames=r.map(u=>`u_${u}`),this.type=s}setUniform(e,r,s){e.set(s.constantOr(this.value))}getBinding(e,r,s){return this.type==="color"?new cd(e,r):new io(e,r)}}class Ca{constructor(e,r){this.uniformNames=r.map(s=>`u_${s}`),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,s,u){const m=u==="u_pattern_to"?this.patternTo:u==="u_pattern_from"?this.patternFrom:u==="u_pixel_ratio_to"?this.pixelRatioTo:u==="u_pixel_ratio_from"?this.pixelRatioFrom:null;m&&e.set(m)}getBinding(e,r,s){return s.substr(0,9)==="u_pattern"?new ld(e,r):new io(e,r)}}class zn{constructor(e,r,s,u){this.expression=e,this.type=s,this.maxValue=0,this.paintVertexAttributes=r.map(m=>({name:`a_${m}`,type:"Float32",components:s==="color"?2:1,offset:0})),this.paintVertexArray=new u}populatePaintArray(e,r,s,u,m){const g=this.paintVertexArray.length,x=this.expression.evaluate(new Ut(0),r,{},u,[],m);this.paintVertexArray.resize(e),this._setPaintValue(g,e,x)}updatePaintArray(e,r,s,u){const m=this.expression.evaluate({zoom:0},s,u);this._setPaintValue(e,r,m)}_setPaintValue(e,r,s){if(this.type==="color"){const u=xh(s);for(let m=e;m<r;m++)this.paintVertexArray.emplace(m,u[0],u[1])}else{for(let u=e;u<r;u++)this.paintVertexArray.emplace(u,s);this.maxValue=Math.max(this.maxValue,Math.abs(s))}}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 jr{constructor(e,r,s,u,m,g){this.expression=e,this.uniformNames=r.map(x=>`u_${x}_t`),this.type=s,this.useIntegerZoom=u,this.zoom=m,this.maxValue=0,this.paintVertexAttributes=r.map(x=>({name:`a_${x}`,type:"Float32",components:s==="color"?4:2,offset:0})),this.paintVertexArray=new g}populatePaintArray(e,r,s,u,m){const g=this.expression.evaluate(new Ut(this.zoom),r,{},u,[],m),x=this.expression.evaluate(new Ut(this.zoom+1),r,{},u,[],m),b=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(b,e,g,x)}updatePaintArray(e,r,s,u){const m=this.expression.evaluate({zoom:this.zoom},s,u),g=this.expression.evaluate({zoom:this.zoom+1},s,u);this._setPaintValue(e,r,m,g)}_setPaintValue(e,r,s,u){if(this.type==="color"){const m=xh(s),g=xh(u);for(let x=e;x<r;x++)this.paintVertexArray.emplace(x,m[0],m[1],g[0],g[1])}else{for(let m=e;m<r;m++)this.paintVertexArray.emplace(m,s,u);this.maxValue=Math.max(this.maxValue,Math.abs(s),Math.abs(u))}}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 s=this.useIntegerZoom?Math.floor(r.zoom):r.zoom,u=Z(this.expression.interpolationFactor(s,this.zoom,this.zoom+1),0,1);e.set(u)}getBinding(e,r,s){return new io(e,r)}}class ro{constructor(e,r,s,u,m,g){this.expression=e,this.type=r,this.useIntegerZoom=s,this.zoom=u,this.layerId=g,this.zoomInPaintVertexArray=new m,this.zoomOutPaintVertexArray=new m}populatePaintArray(e,r,s){const u=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(u,e,r.patterns&&r.patterns[this.layerId],s)}updatePaintArray(e,r,s,u,m){this._setPaintValues(e,r,s.patterns&&s.patterns[this.layerId],m)}_setPaintValues(e,r,s,u){if(!u||!s)return;const{min:m,mid:g,max:x}=s,b=u[m],C=u[g],P=u[x];if(b&&C&&P)for(let z=e;z<r;z++)this.zoomInPaintVertexArray.emplace(z,C.tl[0],C.tl[1],C.br[0],C.br[1],b.tl[0],b.tl[1],b.br[0],b.br[1],C.pixelRatio,b.pixelRatio),this.zoomOutPaintVertexArray.emplace(z,C.tl[0],C.tl[1],C.br[0],C.br[1],P.tl[0],P.tl[1],P.br[0],P.br[1],C.pixelRatio,P.pixelRatio)}upload(e){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,ni.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,ni.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class hd{constructor(e,r,s){this.binders={},this._buffers=[];const u=[];for(const m in e.paint._values){if(!s(m))continue;const g=e.paint.get(m);if(!(g instanceof Pr&&qn(g.property.specification)))continue;const x=Ag(m,e.type),b=g.value,C=g.property.specification.type,P=g.property.useIntegerZoom,z=g.property.specification["property-type"],L=z==="cross-faded"||z==="cross-faded-data-driven";if(b.kind==="constant")this.binders[m]=L?new Ca(b.value,x):new zs(b.value,x,C),u.push(`/u_${m}`);else if(b.kind==="source"||L){const F=ud(m,C,"source");this.binders[m]=L?new ro(b,C,P,r,F,e.id):new zn(b,x,C,F),u.push(`/a_${m}`)}else{const F=ud(m,C,"composite");this.binders[m]=new jr(b,x,C,P,r,F),u.push(`/z_${m}`)}}this.cacheKey=u.sort().join("")}getMaxValue(e){const r=this.binders[e];return r instanceof zn||r instanceof jr?r.maxValue:0}populatePaintArrays(e,r,s,u,m){for(const g in this.binders){const x=this.binders[g];(x instanceof zn||x instanceof jr||x instanceof ro)&&x.populatePaintArray(e,r,s,u,m)}}setConstantPatternPositions(e,r){for(const s in this.binders){const u=this.binders[s];u instanceof Ca&&u.setConstantPatternPositions(e,r)}}updatePaintArrays(e,r,s,u,m){let g=!1;for(const x in e){const b=r.getPositions(x);for(const C of b){const P=s.feature(C.index);for(const z in this.binders){const L=this.binders[z];if((L instanceof zn||L instanceof jr||L instanceof ro)&&L.expression.isStateDependent===!0){const F=u.paint.get(z);L.expression=F.value,L.updatePaintArray(C.start,C.end,P,e[x],m),g=!0}}}}return g}defines(){const e=[];for(const r in this.binders){const s=this.binders[r];(s instanceof zs||s instanceof Ca)&&e.push(...s.uniformNames.map(u=>`#define HAS_UNIFORM_${u}`))}return e}getBinderAttributes(){const e=[];for(const r in this.binders){const s=this.binders[r];if(s instanceof zn||s instanceof jr)for(let u=0;u<s.paintVertexAttributes.length;u++)e.push(s.paintVertexAttributes[u].name);else if(s instanceof ro)for(let u=0;u<ni.members.length;u++)e.push(ni.members[u].name)}return e}getBinderUniforms(){const e=[];for(const r in this.binders){const s=this.binders[r];if(s instanceof zs||s instanceof Ca||s instanceof jr)for(const u of s.uniformNames)e.push(u)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,r){const s=[];for(const u in this.binders){const m=this.binders[u];if(m instanceof zs||m instanceof Ca||m instanceof jr){for(const g of m.uniformNames)if(r[g]){const x=m.getBinding(e,r[g],g);s.push({name:g,property:u,binding:x})}}}return s}setUniforms(e,r,s,u){for(const{name:m,property:g,binding:x}of r)this.binders[g].setUniform(x,u,s.get(g),m)}updatePaintBuffers(e){this._buffers=[];for(const r in this.binders){const s=this.binders[r];if(e&&s instanceof ro){const u=e.fromScale===2?s.zoomInPaintVertexBuffer:s.zoomOutPaintVertexBuffer;u&&this._buffers.push(u)}else(s instanceof zn||s instanceof jr)&&s.paintVertexBuffer&&this._buffers.push(s.paintVertexBuffer)}}upload(e){for(const r in this.binders){const s=this.binders[r];(s instanceof zn||s instanceof jr||s instanceof ro)&&s.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const r=this.binders[e];(r instanceof zn||r instanceof jr||r instanceof ro)&&r.destroy()}}}class Ro{constructor(e,r,s=()=>!0){this.programConfigurations={};for(const u of e)this.programConfigurations[u.id]=new hd(u,r,s);this.needsUpload=!1,this._featureMap=new Sa,this._bufferOffset=0}populatePaintArrays(e,r,s,u,m,g){for(const x in this.programConfigurations)this.programConfigurations[x].populatePaintArrays(e,r,u,m,g);r.id!==void 0&&this._featureMap.add(r.id,s,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,r,s,u){for(const m of s)this.needsUpload=this.programConfigurations[m.id].updatePaintArrays(e,this._featureMap,r,m,u)||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 Ag(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 ud(i,e,r){const s={color:{source:o,composite:ne},number:{source:N,composite:o}},u=function(m){return{"line-pattern":{source:Pt,composite:Pt},"fill-pattern":{source:Pt,composite:Pt},"fill-extrusion-pattern":{source:Pt,composite:Pt}}[m]}(i);return u&&u[r]||s[e][r]}Oe("ConstantBinder",zs),Oe("CrossFadedConstantBinder",Ca),Oe("SourceExpressionBinder",zn),Oe("CrossFadedCompositeBinder",ro),Oe("CompositeExpressionBinder",jr),Oe("ProgramConfiguration",hd,{omit:["_buffers"]}),Oe("ProgramConfigurationSet",Ro);var ui=8192;const vh=Math.pow(2,14)-1,dd=-vh-1;function Fo(i){const e=ui/i.extent,r=i.loadGeometry();for(let s=0;s<r.length;s++){const u=r[s];for(let m=0;m<u.length;m++){const g=u[m],x=Math.round(g.x*e),b=Math.round(g.y*e);g.x=Z(x,dd,vh),g.y=Z(b,dd,vh),(x<g.x||x>g.x+1||b<g.y||b>g.y+1)&&rt("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function Bo(i,e){return{type:i.type,id:i.id,properties:i.properties,geometry:e?Fo(i):[]}}function ql(i,e,r,s,u){i.emplaceBack(2*e+(s+1)/2,2*r+(u+1)/2)}class bh{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 dt,this.indexArray=new Gi,this.segments=new wt,this.programConfigurations=new Ro(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,s){const u=this.layers[0],m=[];let g=null,x=!1;u.type==="circle"&&(g=u.layout.get("circle-sort-key"),x=!g.isConstant());for(const{feature:b,id:C,index:P,sourceLayerIndex:z}of e){const L=this.layers[0]._featureFilter.needGeometry,F=Bo(b,L);if(!this.layers[0]._featureFilter.filter(new Ut(this.zoom),F,s))continue;const O=x?g.evaluate(F,{},s):void 0,W={id:C,properties:b.properties,type:b.type,sourceLayerIndex:z,index:P,geometry:L?F.geometry:Fo(b),patterns:{},sortKey:O};m.push(W)}x&&m.sort((b,C)=>b.sortKey-C.sortKey);for(const b of m){const{geometry:C,index:P,sourceLayerIndex:z}=b,L=e[P].feature;this.addFeature(b,C,P,s),r.featureIndex.insert(L,C,P,z,this.index)}}update(e,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,s)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Ki),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,s,u){for(const m of r)for(const g of m){const x=g.x,b=g.y;if(x<0||x>=ui||b<0||b>=ui)continue;const C=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),P=C.vertexLength;ql(this.layoutVertexArray,x,b,-1,-1),ql(this.layoutVertexArray,x,b,1,-1),ql(this.layoutVertexArray,x,b,1,1),ql(this.layoutVertexArray,x,b,-1,1),this.indexArray.emplaceBack(P,P+1,P+2),this.indexArray.emplaceBack(P,P+3,P+2),C.vertexLength+=4,C.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,{},u)}}function pd(i,e){for(let r=0;r<i.length;r++)if(Ia(e,i[r]))return!0;for(let r=0;r<e.length;r++)if(Ia(i,e[r]))return!0;return!!wh(i,e)}function Pg(i,e,r){return!!Ia(i,e)||!!Sh(e,i,r)}function md(i,e){if(i.length===1)return gd(e,i[0]);for(let r=0;r<e.length;r++){const s=e[r];for(let u=0;u<s.length;u++)if(Ia(i,s[u]))return!0}for(let r=0;r<i.length;r++)if(gd(e,i[r]))return!0;for(let r=0;r<e.length;r++)if(wh(i,e[r]))return!0;return!1}function Mg(i,e,r){if(i.length>1){if(wh(i,e))return!0;for(let s=0;s<e.length;s++)if(Sh(e[s],i,r))return!0}for(let s=0;s<i.length;s++)if(Sh(i[s],e,r))return!0;return!1}function wh(i,e){if(i.length===0||e.length===0)return!1;for(let r=0;r<i.length-1;r++){const s=i[r],u=i[r+1];for(let m=0;m<e.length-1;m++)if(zg(s,u,e[m],e[m+1]))return!0}return!1}function zg(i,e,r,s){return Xe(i,r,s)!==Xe(e,r,s)&&Xe(i,e,r)!==Xe(i,e,s)}function Sh(i,e,r){const s=r*r;if(e.length===1)return i.distSqr(e[0])<s;for(let u=1;u<e.length;u++)if(fd(i,e[u-1],e[u])<s)return!0;return!1}function fd(i,e,r){const s=e.distSqr(r);if(s===0)return i.distSqr(e);const u=((i.x-e.x)*(r.x-e.x)+(i.y-e.y)*(r.y-e.y))/s;return i.distSqr(u<0?e:u>1?r:r.sub(e)._mult(u)._add(e))}function gd(i,e){let r,s,u,m=!1;for(let g=0;g<i.length;g++){r=i[g];for(let x=0,b=r.length-1;x<r.length;b=x++)s=r[x],u=r[b],s.y>e.y!=u.y>e.y&&e.x<(u.x-s.x)*(e.y-s.y)/(u.y-s.y)+s.x&&(m=!m)}return m}function Ia(i,e){let r=!1;for(let s=0,u=i.length-1;s<i.length;u=s++){const m=i[s],g=i[u];m.y>e.y!=g.y>e.y&&e.x<(g.x-m.x)*(e.y-m.y)/(g.y-m.y)+m.x&&(r=!r)}return r}function kg(i,e,r){const s=r[0],u=r[2];if(i.x<s.x&&e.x<s.x||i.x>u.x&&e.x>u.x||i.y<s.y&&e.y<s.y||i.y>u.y&&e.y>u.y)return!1;const m=Xe(i,e,r[0]);return m!==Xe(i,e,r[1])||m!==Xe(i,e,r[2])||m!==Xe(i,e,r[3])}function ks(i,e,r){const s=e.paint.get(i).value;return s.kind==="constant"?s.value:r.programConfigurations.get(e.id).getMaxValue(i)}function Wl(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function Xl(i,e,r,s,u){if(!e[0]&&!e[1])return i;const m=Ye.convert(e)._mult(u);r==="viewport"&&m._rotate(-s);const g=[];for(let x=0;x<i.length;x++)g.push(i[x].sub(m));return g}Oe("CircleBucket",bh,{omit:["layers"]});const Lg=new ci({"circle-sort-key":new Je(pe.layout_circle["circle-sort-key"])});var Dg={paint:new ci({"circle-radius":new Je(pe.paint_circle["circle-radius"]),"circle-color":new Je(pe.paint_circle["circle-color"]),"circle-blur":new Je(pe.paint_circle["circle-blur"]),"circle-opacity":new Je(pe.paint_circle["circle-opacity"]),"circle-translate":new He(pe.paint_circle["circle-translate"]),"circle-translate-anchor":new He(pe.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new He(pe.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new He(pe.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Je(pe.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Je(pe.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Je(pe.paint_circle["circle-stroke-opacity"])}),layout:Lg},Ea=typeof Float32Array<"u"?Float32Array:Array;function Th(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 yd(i,e,r){var s=e[0],u=e[1],m=e[2],g=e[3],x=e[4],b=e[5],C=e[6],P=e[7],z=e[8],L=e[9],F=e[10],O=e[11],W=e[12],X=e[13],oe=e[14],le=e[15],se=r[0],me=r[1],xe=r[2],ye=r[3];return i[0]=se*s+me*x+xe*z+ye*W,i[1]=se*u+me*b+xe*L+ye*X,i[2]=se*m+me*C+xe*F+ye*oe,i[3]=se*g+me*P+xe*O+ye*le,i[4]=(se=r[4])*s+(me=r[5])*x+(xe=r[6])*z+(ye=r[7])*W,i[5]=se*u+me*b+xe*L+ye*X,i[6]=se*m+me*C+xe*F+ye*oe,i[7]=se*g+me*P+xe*O+ye*le,i[8]=(se=r[8])*s+(me=r[9])*x+(xe=r[10])*z+(ye=r[11])*W,i[9]=se*u+me*b+xe*L+ye*X,i[10]=se*m+me*C+xe*F+ye*oe,i[11]=se*g+me*P+xe*O+ye*le,i[12]=(se=r[12])*s+(me=r[13])*x+(xe=r[14])*z+(ye=r[15])*W,i[13]=se*u+me*b+xe*L+ye*X,i[14]=se*m+me*C+xe*F+ye*oe,i[15]=se*g+me*P+xe*O+ye*le,i}Math.hypot||(Math.hypot=function(){for(var i=0,e=arguments.length;e--;)i+=arguments[e]*arguments[e];return Math.sqrt(i)});var Ls,Rg=yd;function Yl(i,e,r){var s=e[0],u=e[1],m=e[2],g=e[3];return i[0]=r[0]*s+r[4]*u+r[8]*m+r[12]*g,i[1]=r[1]*s+r[5]*u+r[9]*m+r[13]*g,i[2]=r[2]*s+r[6]*u+r[10]*m+r[14]*g,i[3]=r[3]*s+r[7]*u+r[11]*m+r[15]*g,i}function _d(i,e){const r=Yl([],[i.x,i.y,0,1],e);return new Ye(r[0]/r[3],r[1]/r[3])}Ls=new Ea(4),Ea!=Float32Array&&(Ls[0]=0,Ls[1]=0,Ls[2]=0,Ls[3]=0);class xd extends bh{}Oe("HeatmapBucket",xd,{omit:["layers"]});var Fg={paint:new ci({"heatmap-radius":new Je(pe.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Je(pe.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new He(pe.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Ps(pe.paint_heatmap["heatmap-color"]),"heatmap-opacity":new He(pe.paint_heatmap["heatmap-opacity"])})};function Ch(i,{width:e,height:r},s,u){if(u){if(u instanceof Uint8ClampedArray)u=new Uint8Array(u.buffer);else if(u.length!==e*r*s)throw new RangeError(`mismatched image size. expected: ${u.length} but got: ${e*r*s}`)}else u=new Uint8Array(e*r*s);return i.width=e,i.height=r,i.data=u,i}function vd(i,{width:e,height:r},s){if(e===i.width&&r===i.height)return;const u=Ch({},{width:e,height:r},s);Ih(i,u,{x:0,y:0},{x:0,y:0},{width:Math.min(i.width,e),height:Math.min(i.height,r)},s),i.width=e,i.height=r,i.data=u.data}function Ih(i,e,r,s,u,m){if(u.width===0||u.height===0)return e;if(u.width>i.width||u.height>i.height||r.x>i.width-u.width||r.y>i.height-u.height)throw new RangeError("out of range source coordinates for image copy");if(u.width>e.width||u.height>e.height||s.x>e.width-u.width||s.y>e.height-u.height)throw new RangeError("out of range destination coordinates for image copy");const g=i.data,x=e.data;for(let b=0;b<u.height;b++){const C=((r.y+b)*i.width+r.x)*m,P=((s.y+b)*e.width+s.x)*m;for(let z=0;z<u.width*m;z++)x[P+z]=g[C+z]}return e}class Ds{constructor(e,r){Ch(this,e,1,r)}resize(e){vd(this,e,1)}clone(){return new Ds({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,s,u,m){Ih(e,r,s,u,m,1)}}class br{constructor(e,r){Ch(this,e,4,r)}resize(e){vd(this,e,4)}replace(e,r){r?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new br({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,s,u,m){Ih(e,r,s,u,m,4)}}function bd(i){const e={},r=i.resolution||256,s=i.clips?i.clips.length:1,u=i.image||new br({width:r,height:s}),m=(g,x,b)=>{e[i.evaluationKey]=b;const C=i.expression.evaluate(e);u.data[g+x+0]=Math.floor(255*C.r/C.a),u.data[g+x+1]=Math.floor(255*C.g/C.a),u.data[g+x+2]=Math.floor(255*C.b/C.a),u.data[g+x+3]=Math.floor(255*C.a)};if(i.clips)for(let g=0,x=0;g<s;++g,x+=4*r)for(let b=0,C=0;b<r;b++,C+=4){const P=b/(r-1),{start:z,end:L}=i.clips[g];m(x,C,z*(1-P)+L*P)}else for(let g=0,x=0;g<r;g++,x+=4)m(0,x,g/(r-1));return u}Oe("AlphaImage",Ds),Oe("RGBAImage",br);var Bg={paint:new ci({"hillshade-illumination-direction":new He(pe.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new He(pe.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new He(pe.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new He(pe.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new He(pe.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new He(pe.paint_hillshade["hillshade-accent-color"])})};const Og=hi([{name:"a_pos",components:2,type:"Int16"}],4),{members:Ug}=Og;var Eh={exports:{}};function Kl(i,e,r){r=r||2;var s,u,m,g,x,b,C,P=e&&e.length,z=P?e[0]*r:i.length,L=wd(i,0,z,r,!0),F=[];if(!L||L.next===L.prev)return F;if(P&&(L=function(W,X,oe,le){var se,me,xe,ye=[];for(se=0,me=X.length;se<me;se++)(xe=wd(W,X[se]*le,se<me-1?X[se+1]*le:W.length,le,!1))===xe.next&&(xe.steiner=!0),ye.push(qg(xe));for(ye.sort(Zg),se=0;se<ye.length;se++)oe=no(oe=Hg(ye[se],oe),oe.next);return oe}(i,e,L,r)),i.length>80*r){s=m=i[0],u=g=i[1];for(var O=r;O<z;O+=r)(x=i[O])<s&&(s=x),(b=i[O+1])<u&&(u=b),x>m&&(m=x),b>g&&(g=b);C=(C=Math.max(m-s,g-u))!==0?1/C:0}return Rs(L,F,r,s,u,C),F}function wd(i,e,r,s,u){var m,g;if(u===Mh(i,e,r,s)>0)for(m=e;m<r;m+=s)g=Cd(m,i[m],i[m+1],g);else for(m=r-s;m>=e;m-=s)g=Cd(m,i[m],i[m+1],g);return g&&Jl(g,g.next)&&(Bs(g),g=g.next),g}function no(i,e){if(!i)return i;e||(e=i);var r,s=i;do if(r=!1,s.steiner||!Jl(s,s.next)&&Qt(s.prev,s,s.next)!==0)s=s.next;else{if(Bs(s),(s=e=s.prev)===s.next)break;r=!0}while(r||s!==e);return e}function Rs(i,e,r,s,u,m,g){if(i){!g&&m&&function(P,z,L,F){var O=P;do O.z===null&&(O.z=Ah(O.x,O.y,z,L,F)),O.prevZ=O.prev,O.nextZ=O.next,O=O.next;while(O!==P);O.prevZ.nextZ=null,O.prevZ=null,function(W){var X,oe,le,se,me,xe,ye,Ue,qe=1;do{for(oe=W,W=null,me=null,xe=0;oe;){for(xe++,le=oe,ye=0,X=0;X<qe&&(ye++,le=le.nextZ);X++);for(Ue=qe;ye>0||Ue>0&&le;)ye!==0&&(Ue===0||!le||oe.z<=le.z)?(se=oe,oe=oe.nextZ,ye--):(se=le,le=le.nextZ,Ue--),me?me.nextZ=se:W=se,se.prevZ=me,me=se;oe=le}me.nextZ=null,qe*=2}while(xe>1)}(O)}(i,s,u,m);for(var x,b,C=i;i.prev!==i.next;)if(x=i.prev,b=i.next,m?Ng(i,s,u,m):$g(i))e.push(x.i/r),e.push(i.i/r),e.push(b.i/r),Bs(i),i=b.next,C=b.next;else if((i=b)===C){g?g===1?Rs(i=Vg(no(i),e,r),e,r,s,u,m,2):g===2&&Gg(i,e,r,s,u,m):Rs(no(i),e,r,s,u,m,1);break}}}function $g(i){var e=i.prev,r=i,s=i.next;if(Qt(e,r,s)>=0)return!1;for(var u=i.next.next;u!==i.prev;){if(Aa(e.x,e.y,r.x,r.y,s.x,s.y,u.x,u.y)&&Qt(u.prev,u,u.next)>=0)return!1;u=u.next}return!0}function Ng(i,e,r,s){var u=i.prev,m=i,g=i.next;if(Qt(u,m,g)>=0)return!1;for(var x=u.x>m.x?u.x>g.x?u.x:g.x:m.x>g.x?m.x:g.x,b=u.y>m.y?u.y>g.y?u.y:g.y:m.y>g.y?m.y:g.y,C=Ah(u.x<m.x?u.x<g.x?u.x:g.x:m.x<g.x?m.x:g.x,u.y<m.y?u.y<g.y?u.y:g.y:m.y<g.y?m.y:g.y,e,r,s),P=Ah(x,b,e,r,s),z=i.prevZ,L=i.nextZ;z&&z.z>=C&&L&&L.z<=P;){if(z!==i.prev&&z!==i.next&&Aa(u.x,u.y,m.x,m.y,g.x,g.y,z.x,z.y)&&Qt(z.prev,z,z.next)>=0||(z=z.prevZ,L!==i.prev&&L!==i.next&&Aa(u.x,u.y,m.x,m.y,g.x,g.y,L.x,L.y)&&Qt(L.prev,L,L.next)>=0))return!1;L=L.nextZ}for(;z&&z.z>=C;){if(z!==i.prev&&z!==i.next&&Aa(u.x,u.y,m.x,m.y,g.x,g.y,z.x,z.y)&&Qt(z.prev,z,z.next)>=0)return!1;z=z.prevZ}for(;L&&L.z<=P;){if(L!==i.prev&&L!==i.next&&Aa(u.x,u.y,m.x,m.y,g.x,g.y,L.x,L.y)&&Qt(L.prev,L,L.next)>=0)return!1;L=L.nextZ}return!0}function Vg(i,e,r){var s=i;do{var u=s.prev,m=s.next.next;!Jl(u,m)&&Sd(u,s,s.next,m)&&Fs(u,m)&&Fs(m,u)&&(e.push(u.i/r),e.push(s.i/r),e.push(m.i/r),Bs(s),Bs(s.next),s=i=m),s=s.next}while(s!==i);return no(s)}function Gg(i,e,r,s,u,m){var g=i;do{for(var x=g.next.next;x!==g.prev;){if(g.i!==x.i&&Wg(g,x)){var b=Td(g,x);return g=no(g,g.next),b=no(b,b.next),Rs(g,e,r,s,u,m),void Rs(b,e,r,s,u,m)}x=x.next}g=g.next}while(g!==i)}function Zg(i,e){return i.x-e.x}function Hg(i,e){var r=function(m,g){var x,b=g,C=m.x,P=m.y,z=-1/0;do{if(P<=b.y&&P>=b.next.y&&b.next.y!==b.y){var L=b.x+(P-b.y)*(b.next.x-b.x)/(b.next.y-b.y);if(L<=C&&L>z){if(z=L,L===C){if(P===b.y)return b;if(P===b.next.y)return b.next}x=b.x<b.next.x?b:b.next}}b=b.next}while(b!==g);if(!x)return null;if(C===z)return x;var F,O=x,W=x.x,X=x.y,oe=1/0;b=x;do C>=b.x&&b.x>=W&&C!==b.x&&Aa(P<X?C:z,P,W,X,P<X?z:C,P,b.x,b.y)&&(F=Math.abs(P-b.y)/(C-b.x),Fs(b,m)&&(F<oe||F===oe&&(b.x>x.x||b.x===x.x&&jg(x,b)))&&(x=b,oe=F)),b=b.next;while(b!==O);return x}(i,e);if(!r)return e;var s=Td(r,i),u=no(r,r.next);return no(s,s.next),e===r?u:e}function jg(i,e){return Qt(i.prev,i,e.prev)<0&&Qt(e.next,i,i.next)<0}function Ah(i,e,r,s,u){return(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=32767*(i-r)*u)|i<<8))|i<<4))|i<<2))|i<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-s)*u)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function qg(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 Aa(i,e,r,s,u,m,g,x){return(u-g)*(e-x)-(i-g)*(m-x)>=0&&(i-g)*(s-x)-(r-g)*(e-x)>=0&&(r-g)*(m-x)-(u-g)*(s-x)>=0}function Wg(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!function(r,s){var u=r;do{if(u.i!==r.i&&u.next.i!==r.i&&u.i!==s.i&&u.next.i!==s.i&&Sd(u,u.next,r,s))return!0;u=u.next}while(u!==r);return!1}(i,e)&&(Fs(i,e)&&Fs(e,i)&&function(r,s){var u=r,m=!1,g=(r.x+s.x)/2,x=(r.y+s.y)/2;do u.y>x!=u.next.y>x&&u.next.y!==u.y&&g<(u.next.x-u.x)*(x-u.y)/(u.next.y-u.y)+u.x&&(m=!m),u=u.next;while(u!==r);return m}(i,e)&&(Qt(i.prev,i,e.prev)||Qt(i,e.prev,e))||Jl(i,e)&&Qt(i.prev,i,i.next)>0&&Qt(e.prev,e,e.next)>0)}function Qt(i,e,r){return(e.y-i.y)*(r.x-e.x)-(e.x-i.x)*(r.y-e.y)}function Jl(i,e){return i.x===e.x&&i.y===e.y}function Sd(i,e,r,s){var u=ec(Qt(i,e,r)),m=ec(Qt(i,e,s)),g=ec(Qt(r,s,i)),x=ec(Qt(r,s,e));return u!==m&&g!==x||!(u!==0||!Ql(i,r,e))||!(m!==0||!Ql(i,s,e))||!(g!==0||!Ql(r,i,s))||!(x!==0||!Ql(r,e,s))}function Ql(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 ec(i){return i>0?1:i<0?-1:0}function Fs(i,e){return Qt(i.prev,i,i.next)<0?Qt(i,e,i.next)>=0&&Qt(i,i.prev,e)>=0:Qt(i,e,i.prev)<0||Qt(i,i.next,e)<0}function Td(i,e){var r=new Ph(i.i,i.x,i.y),s=new Ph(e.i,e.x,e.y),u=i.next,m=e.prev;return i.next=e,e.prev=i,r.next=u,u.prev=r,s.next=r,r.prev=s,m.next=s,s.prev=m,s}function Cd(i,e,r,s){var u=new Ph(i,e,r);return s?(u.next=s.next,u.prev=s,s.next.prev=u,s.next=u):(u.prev=u,u.next=u),u}function Bs(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 Ph(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 Mh(i,e,r,s){for(var u=0,m=e,g=r-s;m<r;m+=s)u+=(i[g]-i[m])*(i[m+1]+i[g+1]),g=m;return u}Eh.exports=Kl,Eh.exports.default=Kl,Kl.deviation=function(i,e,r,s){var u=e&&e.length,m=Math.abs(Mh(i,0,u?e[0]*r:i.length,r));if(u)for(var g=0,x=e.length;g<x;g++)m-=Math.abs(Mh(i,e[g]*r,g<x-1?e[g+1]*r:i.length,r));var b=0;for(g=0;g<s.length;g+=3){var C=s[g]*r,P=s[g+1]*r,z=s[g+2]*r;b+=Math.abs((i[C]-i[z])*(i[P+1]-i[C+1])-(i[C]-i[P])*(i[z+1]-i[C+1]))}return m===0&&b===0?0:Math.abs((b-m)/m)},Kl.flatten=function(i){for(var e=i[0][0].length,r={vertices:[],holes:[],dimensions:e},s=0,u=0;u<i.length;u++){for(var m=0;m<i[u].length;m++)for(var g=0;g<e;g++)r.vertices.push(i[u][m][g]);u>0&&r.holes.push(s+=i[u-1].length)}return r};var Id=Eh.exports;function Xg(i,e,r,s,u){Ed(i,e,r||0,s||i.length-1,u||Yg)}function Ed(i,e,r,s,u){for(;s>r;){if(s-r>600){var m=s-r+1,g=e-r+1,x=Math.log(m),b=.5*Math.exp(2*x/3),C=.5*Math.sqrt(x*b*(m-b)/m)*(g-m/2<0?-1:1);Ed(i,e,Math.max(r,Math.floor(e-g*b/m+C)),Math.min(s,Math.floor(e+(m-g)*b/m+C)),u)}var P=i[e],z=r,L=s;for(Os(i,r,e),u(i[s],P)>0&&Os(i,r,s);z<L;){for(Os(i,z,L),z++,L--;u(i[z],P)<0;)z++;for(;u(i[L],P)>0;)L--}u(i[r],P)===0?Os(i,r,L):Os(i,++L,s),L<=e&&(r=L+1),e<=L&&(s=L-1)}}function Os(i,e,r){var s=i[e];i[e]=i[r],i[r]=s}function Yg(i,e){return i<e?-1:i>e?1:0}function zh(i,e){const r=i.length;if(r<=1)return[i];const s=[];let u,m;for(let g=0;g<r;g++){const x=xt(i[g]);x!==0&&(i[g].area=Math.abs(x),m===void 0&&(m=x<0),m===x<0?(u&&s.push(u),u=[i[g]]):u.push(i[g]))}if(u&&s.push(u),e>1)for(let g=0;g<s.length;g++)s[g].length<=e||(Xg(s[g],e,1,s[g].length-1,Kg),s[g]=s[g].slice(0,e));return s}function Kg(i,e){return e.area-i.area}function kh(i,e,r){const s=r.patternDependencies;let u=!1;for(const m of e){const g=m.paint.get(`${i}-pattern`);g.isConstant()||(u=!0);const x=g.constantOr(null);x&&(u=!0,s[x.to]=!0,s[x.from]=!0)}return u}function Lh(i,e,r,s,u){const m=u.patternDependencies;for(const g of e){const x=g.paint.get(`${i}-pattern`).value;if(x.kind!=="constant"){let b=x.evaluate({zoom:s-1},r,{},u.availableImages),C=x.evaluate({zoom:s},r,{},u.availableImages),P=x.evaluate({zoom:s+1},r,{},u.availableImages);b=b&&b.name?b.name:b,C=C&&C.name?C.name:C,P=P&&P.name?P.name:P,m[b]=!0,m[C]=!0,m[P]=!0,r.patterns[g.id]={min:b,mid:C,max:P}}}return r}class Dh{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 ft,this.indexArray=new Gi,this.indexArray2=new Mr,this.programConfigurations=new Ro(e.layers,e.zoom),this.segments=new wt,this.segments2=new wt,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,s){this.hasPattern=kh("fill",this.layers,r);const u=this.layers[0].layout.get("fill-sort-key"),m=!u.isConstant(),g=[];for(const{feature:x,id:b,index:C,sourceLayerIndex:P}of e){const z=this.layers[0]._featureFilter.needGeometry,L=Bo(x,z);if(!this.layers[0]._featureFilter.filter(new Ut(this.zoom),L,s))continue;const F=m?u.evaluate(L,{},s,r.availableImages):void 0,O={id:b,properties:x.properties,type:x.type,sourceLayerIndex:P,index:C,geometry:z?L.geometry:Fo(x),patterns:{},sortKey:F};g.push(O)}m&&g.sort((x,b)=>x.sortKey-b.sortKey);for(const x of g){const{geometry:b,index:C,sourceLayerIndex:P}=x;if(this.hasPattern){const z=Lh("fill",this.layers,x,this.zoom,r);this.patternFeatures.push(z)}else this.addFeature(x,b,C,s,{});r.featureIndex.insert(e[C].feature,b,C,P,this.index)}}update(e,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,s)}addFeatures(e,r,s){for(const u of this.patternFeatures)this.addFeature(u,u.geometry,u.index,r,s)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Ug),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,s,u,m){for(const g of zh(r,500)){let x=0;for(const F of g)x+=F.length;const b=this.segments.prepareSegment(x,this.layoutVertexArray,this.indexArray),C=b.vertexLength,P=[],z=[];for(const F of g){if(F.length===0)continue;F!==g[0]&&z.push(P.length/2);const O=this.segments2.prepareSegment(F.length,this.layoutVertexArray,this.indexArray2),W=O.vertexLength;this.layoutVertexArray.emplaceBack(F[0].x,F[0].y),this.indexArray2.emplaceBack(W+F.length-1,W),P.push(F[0].x),P.push(F[0].y);for(let X=1;X<F.length;X++)this.layoutVertexArray.emplaceBack(F[X].x,F[X].y),this.indexArray2.emplaceBack(W+X-1,W+X),P.push(F[X].x),P.push(F[X].y);O.vertexLength+=F.length,O.primitiveLength+=F.length}const L=Id(P,z);for(let F=0;F<L.length;F+=3)this.indexArray.emplaceBack(C+L[F],C+L[F+1],C+L[F+2]);b.vertexLength+=x,b.primitiveLength+=L.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,m,u)}}Oe("FillBucket",Dh,{omit:["layers","patternFeatures"]});const Jg=new ci({"fill-sort-key":new Je(pe.layout_fill["fill-sort-key"])});var Qg={paint:new ci({"fill-antialias":new He(pe.paint_fill["fill-antialias"]),"fill-opacity":new Je(pe.paint_fill["fill-opacity"]),"fill-color":new Je(pe.paint_fill["fill-color"]),"fill-outline-color":new Je(pe.paint_fill["fill-outline-color"]),"fill-translate":new He(pe.paint_fill["fill-translate"]),"fill-translate-anchor":new He(pe.paint_fill["fill-translate-anchor"]),"fill-pattern":new zo(pe.paint_fill["fill-pattern"])}),layout:Jg};const ey=hi([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),{members:ty}=ey;var oo={},iy=Ye,Ad=Pa;function Pa(i,e,r,s,u){this.properties={},this.extent=r,this.type=0,this._pbf=i,this._geometry=-1,this._keys=s,this._values=u,i.readFields(ry,this,e)}function ry(i,e,r){i==1?e.id=r.readVarint():i==2?function(s,u){for(var m=s.readVarint()+s.pos;s.pos<m;){var g=u._keys[s.readVarint()],x=u._values[s.readVarint()];u.properties[g]=x}}(r,e):i==3?e.type=r.readVarint():i==4&&(e._geometry=r.pos)}function ny(i){for(var e,r,s=0,u=0,m=i.length,g=m-1;u<m;g=u++)s+=((r=i[g]).x-(e=i[u]).x)*(e.y+r.y);return s}Pa.types=["Unknown","Point","LineString","Polygon"],Pa.prototype.loadGeometry=function(){var i=this._pbf;i.pos=this._geometry;for(var e,r=i.readVarint()+i.pos,s=1,u=0,m=0,g=0,x=[];i.pos<r;){if(u<=0){var b=i.readVarint();s=7&b,u=b>>3}if(u--,s===1||s===2)m+=i.readSVarint(),g+=i.readSVarint(),s===1&&(e&&x.push(e),e=[]),e.push(new iy(m,g));else{if(s!==7)throw new Error("unknown command "+s);e&&e.push(e[0].clone())}}return e&&x.push(e),x},Pa.prototype.bbox=function(){var i=this._pbf;i.pos=this._geometry;for(var e=i.readVarint()+i.pos,r=1,s=0,u=0,m=0,g=1/0,x=-1/0,b=1/0,C=-1/0;i.pos<e;){if(s<=0){var P=i.readVarint();r=7&P,s=P>>3}if(s--,r===1||r===2)(u+=i.readSVarint())<g&&(g=u),u>x&&(x=u),(m+=i.readSVarint())<b&&(b=m),m>C&&(C=m);else if(r!==7)throw new Error("unknown command "+r)}return[g,b,x,C]},Pa.prototype.toGeoJSON=function(i,e,r){var s,u,m=this.extent*Math.pow(2,r),g=this.extent*i,x=this.extent*e,b=this.loadGeometry(),C=Pa.types[this.type];function P(F){for(var O=0;O<F.length;O++){var W=F[O];F[O]=[360*(W.x+g)/m-180,360/Math.PI*Math.atan(Math.exp((180-360*(W.y+x)/m)*Math.PI/180))-90]}}switch(this.type){case 1:var z=[];for(s=0;s<b.length;s++)z[s]=b[s][0];P(b=z);break;case 2:for(s=0;s<b.length;s++)P(b[s]);break;case 3:for(b=function(F){var O=F.length;if(O<=1)return[F];for(var W,X,oe=[],le=0;le<O;le++){var se=ny(F[le]);se!==0&&(X===void 0&&(X=se<0),X===se<0?(W&&oe.push(W),W=[F[le]]):W.push(F[le]))}return W&&oe.push(W),oe}(b),s=0;s<b.length;s++)for(u=0;u<b[s].length;u++)P(b[s][u])}b.length===1?b=b[0]:C="Multi"+C;var L={type:"Feature",geometry:{type:C,coordinates:b},properties:this.properties};return"id"in this&&(L.id=this.id),L};var oy=Ad,Pd=Md;function Md(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(ay,this,e),this.length=this._features.length}function ay(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(s){for(var u=null,m=s.readVarint()+s.pos;s.pos<m;){var g=s.readVarint()>>3;u=g===1?s.readString():g===2?s.readFloat():g===3?s.readDouble():g===4?s.readVarint64():g===5?s.readVarint():g===6?s.readSVarint():g===7?s.readBoolean():null}return u}(r))}Md.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 oy(this._pbf,e,this.extent,this._keys,this._values)};var sy=Pd;function ly(i,e,r){if(i===3){var s=new sy(r,r.readVarint()+r.pos);s.length&&(e[s.name]=s)}}oo.VectorTile=function(i,e){this.layers=i.readFields(ly,{},e)},oo.VectorTileFeature=Ad,oo.VectorTileLayer=Pd;const cy=oo.VectorTileFeature.types,Rh=Math.pow(2,13);function Us(i,e,r,s,u,m,g,x){i.emplaceBack(e,r,2*Math.floor(s*Rh)+g,u*Rh*2,m*Rh*2,Math.round(x))}class Fh{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 jt,this.indexArray=new Gi,this.programConfigurations=new Ro(e.layers,e.zoom),this.segments=new wt,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,s){this.features=[],this.hasPattern=kh("fill-extrusion",this.layers,r);for(const{feature:u,id:m,index:g,sourceLayerIndex:x}of e){const b=this.layers[0]._featureFilter.needGeometry,C=Bo(u,b);if(!this.layers[0]._featureFilter.filter(new Ut(this.zoom),C,s))continue;const P={id:m,sourceLayerIndex:x,index:g,geometry:b?C.geometry:Fo(u),properties:u.properties,type:u.type,patterns:{}};this.hasPattern?this.features.push(Lh("fill-extrusion",this.layers,P,this.zoom,r)):this.addFeature(P,P.geometry,g,s,{}),r.featureIndex.insert(u,P.geometry,g,x,this.index,!0)}}addFeatures(e,r,s){for(const u of this.features){const{geometry:m}=u;this.addFeature(u,m,u.index,r,s)}}update(e,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,s)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ty),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,s,u,m){for(const g of zh(r,500)){let x=0;for(const F of g)x+=F.length;let b=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const F of g){if(F.length===0||uy(F))continue;let O=0;for(let W=0;W<F.length;W++){const X=F[W];if(W>=1){const oe=F[W-1];if(!hy(X,oe)){b.vertexLength+4>wt.MAX_VERTEX_ARRAY_LENGTH&&(b=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const le=X.sub(oe)._perp()._unit(),se=oe.dist(X);O+se>32768&&(O=0),Us(this.layoutVertexArray,X.x,X.y,le.x,le.y,0,0,O),Us(this.layoutVertexArray,X.x,X.y,le.x,le.y,0,1,O),O+=se,Us(this.layoutVertexArray,oe.x,oe.y,le.x,le.y,0,0,O),Us(this.layoutVertexArray,oe.x,oe.y,le.x,le.y,0,1,O);const me=b.vertexLength;this.indexArray.emplaceBack(me,me+2,me+1),this.indexArray.emplaceBack(me+1,me+2,me+3),b.vertexLength+=4,b.primitiveLength+=2}}}}if(b.vertexLength+x>wt.MAX_VERTEX_ARRAY_LENGTH&&(b=this.segments.prepareSegment(x,this.layoutVertexArray,this.indexArray)),cy[e.type]!=="Polygon")continue;const C=[],P=[],z=b.vertexLength;for(const F of g)if(F.length!==0){F!==g[0]&&P.push(C.length/2);for(let O=0;O<F.length;O++){const W=F[O];Us(this.layoutVertexArray,W.x,W.y,0,0,1,1,0),C.push(W.x),C.push(W.y)}}const L=Id(C,P);for(let F=0;F<L.length;F+=3)this.indexArray.emplaceBack(z+L[F],z+L[F+2],z+L[F+1]);b.primitiveLength+=L.length/3,b.vertexLength+=x}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,m,u)}}function hy(i,e){return i.x===e.x&&(i.x<0||i.x>ui)||i.y===e.y&&(i.y<0||i.y>ui)}function uy(i){return i.every(e=>e.x<0)||i.every(e=>e.x>ui)||i.every(e=>e.y<0)||i.every(e=>e.y>ui)}Oe("FillExtrusionBucket",Fh,{omit:["layers","features"]});var dy={paint:new ci({"fill-extrusion-opacity":new He(pe["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Je(pe["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new He(pe["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new He(pe["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new zo(pe["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Je(pe["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Je(pe["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new He(pe["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})};function $s(i,e){return i.x*e.x+i.y*e.y}function zd(i,e){if(i.length===1){let r=0;const s=e[r++];let u;for(;!u||s.equals(u);)if(u=e[r++],!u)return 1/0;for(;r<e.length;r++){const m=e[r],g=i[0],x=u.sub(s),b=m.sub(s),C=g.sub(s),P=$s(x,x),z=$s(x,b),L=$s(b,b),F=$s(C,x),O=$s(C,b),W=P*L-z*z,X=(L*F-z*O)/W,oe=(P*O-z*F)/W,le=s.z*(1-X-oe)+u.z*X+m.z*oe;if(isFinite(le))return le}return 1/0}{let r=1/0;for(const s of e)r=Math.min(r,s.z);return r}}const py=hi([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:my}=py,fy=hi([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:gy}=fy,yy=oo.VectorTileFeature.types,_y=Math.cos(Math.PI/180*37.5),kd=Math.pow(2,14)/.5;class Bh{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 tt,this.layoutVertexArray2=new bt,this.indexArray=new Gi,this.programConfigurations=new Ro(e.layers,e.zoom),this.segments=new wt,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,s){this.hasPattern=kh("line",this.layers,r);const u=this.layers[0].layout.get("line-sort-key"),m=!u.isConstant(),g=[];for(const{feature:x,id:b,index:C,sourceLayerIndex:P}of e){const z=this.layers[0]._featureFilter.needGeometry,L=Bo(x,z);if(!this.layers[0]._featureFilter.filter(new Ut(this.zoom),L,s))continue;const F=m?u.evaluate(L,{},s):void 0,O={id:b,properties:x.properties,type:x.type,sourceLayerIndex:P,index:C,geometry:z?L.geometry:Fo(x),patterns:{},sortKey:F};g.push(O)}m&&g.sort((x,b)=>x.sortKey-b.sortKey);for(const x of g){const{geometry:b,index:C,sourceLayerIndex:P}=x;if(this.hasPattern){const z=Lh("line",this.layers,x,this.zoom,r);this.patternFeatures.push(z)}else this.addFeature(x,b,C,s,{});r.featureIndex.insert(e[C].feature,b,C,P,this.index)}}update(e,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,s)}addFeatures(e,r,s){for(const u of this.patternFeatures)this.addFeature(u,u.geometry,u.index,r,s)}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,gy)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,my),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,s,u,m){const g=this.layers[0].layout,x=g.get("line-join").evaluate(e,{}),b=g.get("line-cap"),C=g.get("line-miter-limit"),P=g.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const z of r)this.addLine(z,e,x,b,C,P);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,m,u)}addLine(e,r,s,u,m,g){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let oe=0;oe<e.length-1;oe++)this.totalDistance+=e[oe].dist(e[oe+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const x=yy[r.type]==="Polygon";let b=e.length;for(;b>=2&&e[b-1].equals(e[b-2]);)b--;let C=0;for(;C<b-1&&e[C].equals(e[C+1]);)C++;if(b<(x?3:2))return;s==="bevel"&&(m=1.05);const P=this.overscaling<=16?122880/(512*this.overscaling):0,z=this.segments.prepareSegment(10*b,this.layoutVertexArray,this.indexArray);let L,F,O,W,X;this.e1=this.e2=-1,x&&(L=e[b-2],X=e[C].sub(L)._unit()._perp());for(let oe=C;oe<b;oe++){if(O=oe===b-1?x?e[C+1]:void 0:e[oe+1],O&&e[oe].equals(O))continue;X&&(W=X),L&&(F=L),L=e[oe],X=O?O.sub(L)._unit()._perp():W,W=W||X;let le=W.add(X);le.x===0&&le.y===0||le._unit();const se=W.x*X.x+W.y*X.y,me=le.x*X.x+le.y*X.y,xe=me!==0?1/me:1/0,ye=2*Math.sqrt(2-2*me),Ue=me<_y&&F&&O,qe=W.x*X.y-W.y*X.x>0;if(Ue&&oe>C){const Ie=L.dist(F);if(Ie>2*P){const Be=L.sub(L.sub(F)._mult(P/Ie)._round());this.updateDistance(F,Be),this.addCurrentVertex(Be,W,0,0,z),F=Be}}const ke=F&&O;let Le=ke?s:x?"butt":u;if(ke&&Le==="round"&&(xe<g?Le="miter":xe<=2&&(Le="fakeround")),Le==="miter"&&xe>m&&(Le="bevel"),Le==="bevel"&&(xe>2&&(Le="flipbevel"),xe<m&&(Le="miter")),F&&this.updateDistance(F,L),Le==="miter")le._mult(xe),this.addCurrentVertex(L,le,0,0,z);else if(Le==="flipbevel"){if(xe>100)le=X.mult(-1);else{const Ie=xe*W.add(X).mag()/W.sub(X).mag();le._perp()._mult(Ie*(qe?-1:1))}this.addCurrentVertex(L,le,0,0,z),this.addCurrentVertex(L,le.mult(-1),0,0,z)}else if(Le==="bevel"||Le==="fakeround"){const Ie=-Math.sqrt(xe*xe-1),Be=qe?Ie:0,De=qe?0:Ie;if(F&&this.addCurrentVertex(L,W,Be,De,z),Le==="fakeround"){const Te=Math.round(180*ye/Math.PI/20);for(let Qe=1;Qe<Te;Qe++){let We=Qe/Te;if(We!==.5){const Ct=We-.5;We+=We*Ct*(We-1)*((1.0904+se*(se*(3.55645-1.43519*se)-3.2452))*Ct*Ct+(.848013+se*(.215638*se-1.06021)))}const gt=X.sub(W)._mult(We)._add(W)._unit()._mult(qe?-1:1);this.addHalfVertex(L,gt.x,gt.y,!1,qe,0,z)}}O&&this.addCurrentVertex(L,X,-Be,-De,z)}else if(Le==="butt")this.addCurrentVertex(L,le,0,0,z);else if(Le==="square"){const Ie=F?1:-1;this.addCurrentVertex(L,le,Ie,Ie,z)}else Le==="round"&&(F&&(this.addCurrentVertex(L,W,0,0,z),this.addCurrentVertex(L,W,1,1,z,!0)),O&&(this.addCurrentVertex(L,X,-1,-1,z,!0),this.addCurrentVertex(L,X,0,0,z)));if(Ue&&oe<b-1){const Ie=L.dist(O);if(Ie>2*P){const Be=L.add(O.sub(L)._mult(P/Ie)._round());this.updateDistance(L,Be),this.addCurrentVertex(Be,X,0,0,z),L=Be}}}}addCurrentVertex(e,r,s,u,m,g=!1){const x=r.y*u-r.x,b=-r.y-r.x*u;this.addHalfVertex(e,r.x+r.y*s,r.y-r.x*s,g,!1,s,m),this.addHalfVertex(e,x,b,g,!0,-u,m),this.distance>kd/2&&this.totalDistance===0&&(this.distance=0,this.addCurrentVertex(e,r,s,u,m,g))}addHalfVertex({x:e,y:r},s,u,m,g,x,b){const C=.5*(this.lineClips?this.scaledDistance*(kd-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(m?1:0),(r<<1)+(g?1:0),Math.round(63*s)+128,Math.round(63*u)+128,1+(x===0?0:x<0?-1:1)|(63&C)<<2,C>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const P=b.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,P),b.primitiveLength++),g?this.e2=P:this.e1=P}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()}}Oe("LineBucket",Bh,{omit:["layers","patternFeatures"]});const xy=new ci({"line-cap":new He(pe.layout_line["line-cap"]),"line-join":new Je(pe.layout_line["line-join"]),"line-miter-limit":new He(pe.layout_line["line-miter-limit"]),"line-round-limit":new He(pe.layout_line["line-round-limit"]),"line-sort-key":new Je(pe.layout_line["line-sort-key"])});var Ld={paint:new ci({"line-opacity":new Je(pe.paint_line["line-opacity"]),"line-color":new Je(pe.paint_line["line-color"]),"line-translate":new He(pe.paint_line["line-translate"]),"line-translate-anchor":new He(pe.paint_line["line-translate-anchor"]),"line-width":new Je(pe.paint_line["line-width"]),"line-gap-width":new Je(pe.paint_line["line-gap-width"]),"line-offset":new Je(pe.paint_line["line-offset"]),"line-blur":new Je(pe.paint_line["line-blur"]),"line-dasharray":new ko(pe.paint_line["line-dasharray"]),"line-pattern":new zo(pe.paint_line["line-pattern"]),"line-gradient":new Ps(pe.paint_line["line-gradient"])}),layout:xy};const Dd=new class extends Je{possiblyEvaluate(i,e){return e=new Ut(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,zoomHistory:e.zoomHistory,transition:e.transition}),super.possiblyEvaluate(i,e)}evaluate(i,e,r,s){return e=be({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(i,e,r,s)}}(Ld.paint.properties["line-width"].specification);function Rd(i,e){return e>0?e+2*i:i}Dd.useIntegerZoom=!0;const vy=hi([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),by=hi([{name:"a_projected_pos",components:3,type:"Float32"}],4);hi([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const wy=hi([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);hi([{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 Fd=hi([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Sy=hi([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function Ty(i,e,r){return i.sections.forEach(s=>{s.text=function(u,m,g){const x=m.layout.get("text-transform").evaluate(g,{});return x==="uppercase"?u=u.toLocaleUpperCase():x==="lowercase"&&(u=u.toLocaleLowerCase()),ar.applyArabicShaping&&(u=ar.applyArabicShaping(u)),u}(s.text,e,r)}),i}hi([{name:"triangle",components:3,type:"Uint16"}]),hi([{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"}]),hi([{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"}]),hi([{type:"Float32",name:"offsetX"}]),hi([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);const Ns={"!":"\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 vi=24,Oh=Mt,Bd=function(i,e,r,s,u){var m,g,x=8*u-s-1,b=(1<<x)-1,C=b>>1,P=-7,z=r?u-1:0,L=r?-1:1,F=i[e+z];for(z+=L,m=F&(1<<-P)-1,F>>=-P,P+=x;P>0;m=256*m+i[e+z],z+=L,P-=8);for(g=m&(1<<-P)-1,m>>=-P,P+=s;P>0;g=256*g+i[e+z],z+=L,P-=8);if(m===0)m=1-C;else{if(m===b)return g?NaN:1/0*(F?-1:1);g+=Math.pow(2,s),m-=C}return(F?-1:1)*g*Math.pow(2,m-s)},Od=function(i,e,r,s,u,m){var g,x,b,C=8*m-u-1,P=(1<<C)-1,z=P>>1,L=u===23?Math.pow(2,-24)-Math.pow(2,-77):0,F=s?0:m-1,O=s?1:-1,W=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(x=isNaN(e)?1:0,g=P):(g=Math.floor(Math.log(e)/Math.LN2),e*(b=Math.pow(2,-g))<1&&(g--,b*=2),(e+=g+z>=1?L/b:L*Math.pow(2,1-z))*b>=2&&(g++,b/=2),g+z>=P?(x=0,g=P):g+z>=1?(x=(e*b-1)*Math.pow(2,u),g+=z):(x=e*Math.pow(2,z-1)*Math.pow(2,u),g=0));u>=8;i[r+F]=255&x,F+=O,x/=256,u-=8);for(g=g<<u|x,C+=u;C>0;i[r+F]=255&g,F+=O,g/=256,C-=8);i[r+F-O]|=128*W};function Mt(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}Mt.Varint=0,Mt.Fixed64=1,Mt.Bytes=2,Mt.Fixed32=5;var ao,Uh=4294967296,Ud=1/Uh,$d=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function kn(i){return i.type===Mt.Bytes?i.readVarint()+i.pos:i.pos+1}function Ma(i,e,r){return r?4294967296*e+(i>>>0):4294967296*(e>>>0)+(i>>>0)}function Nd(i,e,r){var s=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(s);for(var u=r.pos-1;u>=i;u--)r.buf[u+s]=r.buf[u]}function Cy(i,e){for(var r=0;r<i.length;r++)e.writeVarint(i[r])}function Iy(i,e){for(var r=0;r<i.length;r++)e.writeSVarint(i[r])}function Ey(i,e){for(var r=0;r<i.length;r++)e.writeFloat(i[r])}function Ay(i,e){for(var r=0;r<i.length;r++)e.writeDouble(i[r])}function Py(i,e){for(var r=0;r<i.length;r++)e.writeBoolean(i[r])}function My(i,e){for(var r=0;r<i.length;r++)e.writeFixed32(i[r])}function zy(i,e){for(var r=0;r<i.length;r++)e.writeSFixed32(i[r])}function ky(i,e){for(var r=0;r<i.length;r++)e.writeFixed64(i[r])}function Ly(i,e){for(var r=0;r<i.length;r++)e.writeSFixed64(i[r])}function tc(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+16777216*i[e+3]}function za(i,e,r){i[r]=e,i[r+1]=e>>>8,i[r+2]=e>>>16,i[r+3]=e>>>24}function Vd(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+(i[e+3]<<24)}function Dy(i,e,r){i===1&&r.readMessage(Ry,e)}function Ry(i,e,r){if(i===3){const{id:s,bitmap:u,width:m,height:g,left:x,top:b,advance:C}=r.readMessage(Fy,{});e.push({id:s,bitmap:new Ds({width:m+6,height:g+6},u),metrics:{width:m,height:g,left:x,top:b,advance:C}})}}function Fy(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 Gd(i){let e=0,r=0;for(const g of i)e+=g.w*g.h,r=Math.max(r,g.w);i.sort((g,x)=>x.h-g.h);const s=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}];let u=0,m=0;for(const g of i)for(let x=s.length-1;x>=0;x--){const b=s[x];if(!(g.w>b.w||g.h>b.h)){if(g.x=b.x,g.y=b.y,m=Math.max(m,g.y+g.h),u=Math.max(u,g.x+g.w),g.w===b.w&&g.h===b.h){const C=s.pop();x<s.length&&(s[x]=C)}else g.h===b.h?(b.x+=g.w,b.w-=g.w):g.w===b.w?(b.y+=g.h,b.h-=g.h):(s.push({x:b.x+g.w,y:b.y,w:b.w-g.w,h:g.h}),b.y+=g.h,b.h-=g.h);break}}return{w:u,h:m,fill:e/(u*m)||0}}Mt.prototype={destroy:function(){this.buf=null},readFields:function(i,e,r){for(r=r||this.length;this.pos<r;){var s=this.readVarint(),u=s>>3,m=this.pos;this.type=7&s,i(u,e,this),this.pos===m&&this.skip(s)}return e},readMessage:function(i,e){return this.readFields(i,e,this.readVarint()+this.pos)},readFixed32:function(){var i=tc(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=Vd(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=tc(this.buf,this.pos)+tc(this.buf,this.pos+4)*Uh;return this.pos+=8,i},readSFixed64:function(){var i=tc(this.buf,this.pos)+Vd(this.buf,this.pos+4)*Uh;return this.pos+=8,i},readFloat:function(){var i=Bd(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=Bd(this.buf,this.pos,!0,52,8);return this.pos+=8,i},readVarint:function(i){var e,r,s=this.buf;return e=127&(r=s[this.pos++]),r<128?e:(e|=(127&(r=s[this.pos++]))<<7,r<128?e:(e|=(127&(r=s[this.pos++]))<<14,r<128?e:(e|=(127&(r=s[this.pos++]))<<21,r<128?e:function(u,m,g){var x,b,C=g.buf;if(x=(112&(b=C[g.pos++]))>>4,b<128||(x|=(127&(b=C[g.pos++]))<<3,b<128)||(x|=(127&(b=C[g.pos++]))<<10,b<128)||(x|=(127&(b=C[g.pos++]))<<17,b<128)||(x|=(127&(b=C[g.pos++]))<<24,b<128)||(x|=(1&(b=C[g.pos++]))<<31,b<128))return Ma(u,x,m);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=s[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&&$d?function(r,s,u){return $d.decode(r.subarray(s,u))}(this.buf,e,i):function(r,s,u){for(var m="",g=s;g<u;){var x,b,C,P=r[g],z=null,L=P>239?4:P>223?3:P>191?2:1;if(g+L>u)break;L===1?P<128&&(z=P):L===2?(192&(x=r[g+1]))==128&&(z=(31&P)<<6|63&x)<=127&&(z=null):L===3?(b=r[g+2],(192&(x=r[g+1]))==128&&(192&b)==128&&((z=(15&P)<<12|(63&x)<<6|63&b)<=2047||z>=55296&&z<=57343)&&(z=null)):L===4&&(b=r[g+2],C=r[g+3],(192&(x=r[g+1]))==128&&(192&b)==128&&(192&C)==128&&((z=(15&P)<<18|(63&x)<<12|(63&b)<<6|63&C)<=65535||z>=1114112)&&(z=null)),z===null?(z=65533,L=1):z>65535&&(z-=65536,m+=String.fromCharCode(z>>>10&1023|55296),z=56320|1023&z),m+=String.fromCharCode(z),g+=L}return m}(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!==Mt.Bytes)return i.push(this.readVarint(e));var r=kn(this);for(i=i||[];this.pos<r;)i.push(this.readVarint(e));return i},readPackedSVarint:function(i){if(this.type!==Mt.Bytes)return i.push(this.readSVarint());var e=kn(this);for(i=i||[];this.pos<e;)i.push(this.readSVarint());return i},readPackedBoolean:function(i){if(this.type!==Mt.Bytes)return i.push(this.readBoolean());var e=kn(this);for(i=i||[];this.pos<e;)i.push(this.readBoolean());return i},readPackedFloat:function(i){if(this.type!==Mt.Bytes)return i.push(this.readFloat());var e=kn(this);for(i=i||[];this.pos<e;)i.push(this.readFloat());return i},readPackedDouble:function(i){if(this.type!==Mt.Bytes)return i.push(this.readDouble());var e=kn(this);for(i=i||[];this.pos<e;)i.push(this.readDouble());return i},readPackedFixed32:function(i){if(this.type!==Mt.Bytes)return i.push(this.readFixed32());var e=kn(this);for(i=i||[];this.pos<e;)i.push(this.readFixed32());return i},readPackedSFixed32:function(i){if(this.type!==Mt.Bytes)return i.push(this.readSFixed32());var e=kn(this);for(i=i||[];this.pos<e;)i.push(this.readSFixed32());return i},readPackedFixed64:function(i){if(this.type!==Mt.Bytes)return i.push(this.readFixed64());var e=kn(this);for(i=i||[];this.pos<e;)i.push(this.readFixed64());return i},readPackedSFixed64:function(i){if(this.type!==Mt.Bytes)return i.push(this.readSFixed64());var e=kn(this);for(i=i||[];this.pos<e;)i.push(this.readSFixed64());return i},skip:function(i){var e=7&i;if(e===Mt.Varint)for(;this.buf[this.pos++]>127;);else if(e===Mt.Bytes)this.pos=this.readVarint()+this.pos;else if(e===Mt.Fixed32)this.pos+=4;else{if(e!==Mt.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),za(this.buf,i,this.pos),this.pos+=4},writeSFixed32:function(i){this.realloc(4),za(this.buf,i,this.pos),this.pos+=4},writeFixed64:function(i){this.realloc(8),za(this.buf,-1&i,this.pos),za(this.buf,Math.floor(i*Ud),this.pos+4),this.pos+=8},writeSFixed64:function(i){this.realloc(8),za(this.buf,-1&i,this.pos),za(this.buf,Math.floor(i*Ud),this.pos+4),this.pos+=8},writeVarint:function(i){(i=+i||0)>268435455||i<0?function(e,r){var s,u;if(e>=0?(s=e%4294967296|0,u=e/4294967296|0):(u=~(-e/4294967296),4294967295^(s=~(-e%4294967296))?s=s+1|0:(s=0,u=u+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");r.realloc(10),function(m,g,x){x.buf[x.pos++]=127&m|128,m>>>=7,x.buf[x.pos++]=127&m|128,m>>>=7,x.buf[x.pos++]=127&m|128,m>>>=7,x.buf[x.pos++]=127&m|128,x.buf[x.pos]=127&(m>>>=7)}(s,0,r),function(m,g){var x=(7&m)<<4;g.buf[g.pos++]|=x|((m>>>=3)?128:0),m&&(g.buf[g.pos++]=127&m|((m>>>=7)?128:0),m&&(g.buf[g.pos++]=127&m|((m>>>=7)?128:0),m&&(g.buf[g.pos++]=127&m|((m>>>=7)?128:0),m&&(g.buf[g.pos++]=127&m|((m>>>=7)?128:0),m&&(g.buf[g.pos++]=127&m)))))}(u,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(s,u,m){for(var g,x,b=0;b<u.length;b++){if((g=u.charCodeAt(b))>55295&&g<57344){if(!x){g>56319||b+1===u.length?(s[m++]=239,s[m++]=191,s[m++]=189):x=g;continue}if(g<56320){s[m++]=239,s[m++]=191,s[m++]=189,x=g;continue}g=x-55296<<10|g-56320|65536,x=null}else x&&(s[m++]=239,s[m++]=191,s[m++]=189,x=null);g<128?s[m++]=g:(g<2048?s[m++]=g>>6|192:(g<65536?s[m++]=g>>12|224:(s[m++]=g>>18|240,s[m++]=g>>12&63|128),s[m++]=g>>6&63|128),s[m++]=63&g|128)}return m}(this.buf,i,this.pos);var r=this.pos-e;r>=128&&Nd(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(i){this.realloc(4),Od(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),Od(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 s=this.pos-r;s>=128&&Nd(r,s,this),this.pos=r-1,this.writeVarint(s),this.pos+=s},writeMessage:function(i,e,r){this.writeTag(i,Mt.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(i,e){e.length&&this.writeMessage(i,Cy,e)},writePackedSVarint:function(i,e){e.length&&this.writeMessage(i,Iy,e)},writePackedBoolean:function(i,e){e.length&&this.writeMessage(i,Py,e)},writePackedFloat:function(i,e){e.length&&this.writeMessage(i,Ey,e)},writePackedDouble:function(i,e){e.length&&this.writeMessage(i,Ay,e)},writePackedFixed32:function(i,e){e.length&&this.writeMessage(i,My,e)},writePackedSFixed32:function(i,e){e.length&&this.writeMessage(i,zy,e)},writePackedFixed64:function(i,e){e.length&&this.writeMessage(i,ky,e)},writePackedSFixed64:function(i,e){e.length&&this.writeMessage(i,Ly,e)},writeBytesField:function(i,e){this.writeTag(i,Mt.Bytes),this.writeBytes(e)},writeFixed32Field:function(i,e){this.writeTag(i,Mt.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(i,e){this.writeTag(i,Mt.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(i,e){this.writeTag(i,Mt.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(i,e){this.writeTag(i,Mt.Fixed64),this.writeSFixed64(e)},writeVarintField:function(i,e){this.writeTag(i,Mt.Varint),this.writeVarint(e)},writeSVarintField:function(i,e){this.writeTag(i,Mt.Varint),this.writeSVarint(e)},writeStringField:function(i,e){this.writeTag(i,Mt.Bytes),this.writeString(e)},writeFloatField:function(i,e){this.writeTag(i,Mt.Fixed32),this.writeFloat(e)},writeDoubleField:function(i,e){this.writeTag(i,Mt.Fixed64),this.writeDouble(e)},writeBooleanField:function(i,e){this.writeVarintField(i,Boolean(e))}};class $h{constructor(e,{pixelRatio:r,version:s,stretchX:u,stretchY:m,content:g}){this.paddedRect=e,this.pixelRatio=r,this.stretchX=u,this.stretchY=m,this.content=g,this.version=s}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 Zd{constructor(e,r){const s={},u={};this.haveRenderCallbacks=[];const m=[];this.addImages(e,s,m),this.addImages(r,u,m);const{w:g,h:x}=Gd(m),b=new br({width:g||1,height:x||1});for(const C in e){const P=e[C],z=s[C].paddedRect;br.copy(P.data,b,{x:0,y:0},{x:z.x+1,y:z.y+1},P.data)}for(const C in r){const P=r[C],z=u[C].paddedRect,L=z.x+1,F=z.y+1,O=P.data.width,W=P.data.height;br.copy(P.data,b,{x:0,y:0},{x:L,y:F},P.data),br.copy(P.data,b,{x:0,y:W-1},{x:L,y:F-1},{width:O,height:1}),br.copy(P.data,b,{x:0,y:0},{x:L,y:F+W},{width:O,height:1}),br.copy(P.data,b,{x:O-1,y:0},{x:L-1,y:F},{width:1,height:W}),br.copy(P.data,b,{x:0,y:0},{x:L+O,y:F},{width:1,height:W})}this.image=b,this.iconPositions=s,this.patternPositions=u}addImages(e,r,s){for(const u in e){const m=e[u],g={x:0,y:0,w:m.data.width+2,h:m.data.height+2};s.push(g),r[u]=new $h(g,m),m.hasRenderCallback&&this.haveRenderCallbacks.push(u)}}patchUpdatedImages(e,r){e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const s in e.updatedImages)this.patchUpdatedImage(this.iconPositions[s],e.getImage(s),r),this.patchUpdatedImage(this.patternPositions[s],e.getImage(s),r)}patchUpdatedImage(e,r,s){if(!e||!r||e.version===r.version)return;e.version=r.version;const[u,m]=e.tl;s.update(r.data,void 0,{x:u,y:m})}}Oe("ImagePosition",$h),Oe("ImageAtlas",Zd),l.WritingMode=void 0,(ao=l.WritingMode||(l.WritingMode={}))[ao.none=0]="none",ao[ao.horizontal=1]="horizontal",ao[ao.vertical=2]="vertical",ao[ao.horizontalOnly=3]="horizontalOnly";const ic=-17;class Vs{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(e,r){const s=new Vs;return s.scale=e||1,s.fontStack=r,s}static forImage(e){const r=new Vs;return r.imageName=e,r}}class ka{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,r){const s=new ka;for(let u=0;u<e.sections.length;u++){const m=e.sections[u];m.image?s.addImageSection(m):s.addTextSection(m,r)}return s}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 s=0;s<e.length;s++){const u=e.charCodeAt(s+1)||null,m=e.charCodeAt(s-1)||null;r+=u&&$l(u)&&!Ns[e[s+1]]||m&&$l(m)&&!Ns[e[s-1]]||!Ns[e[s]]?e[s]:Ns[e[s]]}return r}(this.text)}trim(){let e=0;for(let s=0;s<this.text.length&&nc[this.text.charCodeAt(s)];s++)e++;let r=this.text.length;for(let s=this.text.length-1;s>=0&&s>=e&&nc[this.text.charCodeAt(s)];s--)r--;this.text=this.text.substring(e,r),this.sectionIndex=this.sectionIndex.slice(e,r)}substring(e,r){const s=new ka;return s.text=this.text.substring(e,r),s.sectionIndex=this.sectionIndex.slice(e,r),s.sections=this.sections,s}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(Vs.forText(e.scale,e.fontStack||r));const s=this.sections.length-1;for(let u=0;u<e.text.length;++u)this.sectionIndex.push(s)}addImageSection(e){const r=e.image?e.image.name:"";if(r.length===0)return void rt("Can't add FormattedSection with an empty image.");const s=this.getNextImageSectionCharCode();s?(this.text+=String.fromCharCode(s),this.sections.push(Vs.forImage(r)),this.sectionIndex.push(this.sections.length-1)):rt("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function rc(i,e,r,s,u,m,g,x,b,C,P,z,L,F,O,W){const X=ka.fromFeature(i,u);let oe;z===l.WritingMode.vertical&&X.verticalizePunctuation();const{processBidirectionalText:le,processStyledBidirectionalText:se}=ar;if(le&&X.sections.length===1){oe=[];const ye=le(X.toString(),Nh(X,C,m,e,s,F,O));for(const Ue of ye){const qe=new ka;qe.text=Ue,qe.sections=X.sections;for(let ke=0;ke<Ue.length;ke++)qe.sectionIndex.push(0);oe.push(qe)}}else if(se){oe=[];const ye=se(X.text,X.sectionIndex,Nh(X,C,m,e,s,F,O));for(const Ue of ye){const qe=new ka;qe.text=Ue[0],qe.sectionIndex=Ue[1],qe.sections=X.sections,oe.push(qe)}}else oe=function(ye,Ue){const qe=[],ke=ye.text;let Le=0;for(const Ie of Ue)qe.push(ye.substring(Le,Ie)),Le=Ie;return Le<ke.length&&qe.push(ye.substring(Le,ke.length)),qe}(X,Nh(X,C,m,e,s,F,O));const me=[],xe={positionedLines:me,text:X.toString(),top:P[1],bottom:P[1],left:P[0],right:P[0],writingMode:z,iconsInText:!1,verticalizable:!1};return function(ye,Ue,qe,ke,Le,Ie,Be,De,Te,Qe,We,gt){let Ct=0,Nt=ic,Vt=0,wi=0;const oi=De==="right"?1:De==="left"?0:.5;let ai=0;for(const si of Le){si.trim();const Ti=si.getMaxScale(),Li=(Ti-1)*vi,Zi={positionedGlyphs:[],lineOffset:0};ye.positionedLines[ai]=Zi;const Qi=Zi.positionedGlyphs;let er=0;if(!si.length()){Nt+=Ie,++ai;continue}for(let yi=0;yi<si.length();yi++){const pt=si.getSection(yi),cr=si.getSectionIndex(yi),Ci=si.getCharCode(yi);let Di=0,Dr=null,qr=null,Wr=null,Dn=vi;const Rr=!(Te===l.WritingMode.horizontal||!We&&!Mo(Ci)||We&&(nc[Ci]||(gi=Ci,Pe.Arabic(gi)||Pe["Arabic Supplement"](gi)||Pe["Arabic Extended-A"](gi)||Pe["Arabic Presentation Forms-A"](gi)||Pe["Arabic Presentation Forms-B"](gi))));if(pt.imageName){const wr=ke[pt.imageName];if(!wr)continue;Wr=pt.imageName,ye.iconsInText=ye.iconsInText||!0,qr=wr.paddedRect;const tr=wr.displaySize;pt.scale=pt.scale*vi/gt,Dr={width:tr[0],height:tr[1],left:1,top:-3,advance:Rr?tr[1]:tr[0]},Di=Li+(vi-tr[1]*pt.scale),Dn=Dr.advance;const Rn=Rr?tr[0]*pt.scale-vi*Ti:tr[1]*pt.scale-vi*Ti;Rn>0&&Rn>er&&(er=Rn)}else{const wr=qe[pt.fontStack],tr=wr&&wr[Ci];if(tr&&tr.rect)qr=tr.rect,Dr=tr.metrics;else{const Rn=Ue[pt.fontStack],Hs=Rn&&Rn[Ci];if(!Hs)continue;Dr=Hs.metrics}Di=(Ti-pt.scale)*vi}Rr?(ye.verticalizable=!0,Qi.push({glyph:Ci,imageName:Wr,x:Ct,y:Nt+Di,vertical:Rr,scale:pt.scale,fontStack:pt.fontStack,sectionIndex:cr,metrics:Dr,rect:qr}),Ct+=Dn*pt.scale+Qe):(Qi.push({glyph:Ci,imageName:Wr,x:Ct,y:Nt+Di,vertical:Rr,scale:pt.scale,fontStack:pt.fontStack,sectionIndex:cr,metrics:Dr,rect:qr}),Ct+=Dr.advance*pt.scale+Qe)}Qi.length!==0&&(Vt=Math.max(Ct-Qe,Vt),Uy(Qi,0,Qi.length-1,oi,er)),Ct=0;const Gt=Ie*Ti+er;Zi.lineOffset=Math.max(er,Li),Nt+=Gt,wi=Math.max(Gt,wi),++ai}var gi;const Si=Nt-ic,{horizontalAlign:ki,verticalAlign:Ji}=Vh(Be);(function(si,Ti,Li,Zi,Qi,er,Gt,yi,pt){const cr=(Ti-Li)*Qi;let Ci=0;Ci=er!==Gt?-yi*Zi-ic:(-Zi*pt+.5)*Gt;for(const Di of si)for(const Dr of Di.positionedGlyphs)Dr.x+=cr,Dr.y+=Ci})(ye.positionedLines,oi,ki,Ji,Vt,wi,Ie,Si,Le.length),ye.top+=-Ji*Si,ye.bottom=ye.top+Si,ye.left+=-ki*Vt,ye.right=ye.left+Vt}(xe,e,r,s,oe,g,x,b,z,C,L,W),!function(ye){for(const Ue of ye)if(Ue.positionedGlyphs.length!==0)return!1;return!0}(me)&&xe}const nc={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},By={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 Hd(i,e,r,s,u,m){if(e.imageName){const g=s[e.imageName];return g?g.displaySize[0]*e.scale*vi/m+u:0}{const g=r[e.fontStack],x=g&&g[i];return x?x.metrics.advance*e.scale+u:0}}function jd(i,e,r,s){const u=Math.pow(i-e,2);return s?i<e?u/2:2*u:u+Math.abs(r)*r}function Oy(i,e,r){let s=0;return i===10&&(s-=1e4),r&&(s+=150),i!==40&&i!==65288||(s+=50),e!==41&&e!==65289||(s+=50),s}function qd(i,e,r,s,u,m){let g=null,x=jd(e,r,u,m);for(const b of s){const C=jd(e-b.x,r,u,m)+b.badness;C<=x&&(g=b,x=C)}return{index:i,x:e,priorBreak:g,badness:x}}function Wd(i){return i?Wd(i.priorBreak).concat(i.index):[]}function Nh(i,e,r,s,u,m,g){if(m!=="point")return[];if(!i)return[];const x=[],b=function(L,F,O,W,X,oe){let le=0;for(let se=0;se<L.length();se++){const me=L.getSection(se);le+=Hd(L.getCharCode(se),me,W,X,F,oe)}return le/Math.max(1,Math.ceil(le/O))}(i,e,r,s,u,g),C=i.text.indexOf("\u200B")>=0;let P=0;for(let L=0;L<i.length();L++){const F=i.getSection(L),O=i.getCharCode(L);if(nc[O]||(P+=Hd(O,F,s,u,e,g)),L<i.length()-1){const W=!((z=O)<11904||!(Pe["Bopomofo Extended"](z)||Pe.Bopomofo(z)||Pe["CJK Compatibility Forms"](z)||Pe["CJK Compatibility Ideographs"](z)||Pe["CJK Compatibility"](z)||Pe["CJK Radicals Supplement"](z)||Pe["CJK Strokes"](z)||Pe["CJK Symbols and Punctuation"](z)||Pe["CJK Unified Ideographs Extension A"](z)||Pe["CJK Unified Ideographs"](z)||Pe["Enclosed CJK Letters and Months"](z)||Pe["Halfwidth and Fullwidth Forms"](z)||Pe.Hiragana(z)||Pe["Ideographic Description Characters"](z)||Pe["Kangxi Radicals"](z)||Pe["Katakana Phonetic Extensions"](z)||Pe.Katakana(z)||Pe["Vertical Forms"](z)||Pe["Yi Radicals"](z)||Pe["Yi Syllables"](z)));(By[O]||W||F.imageName)&&x.push(qd(L+1,P,b,x,Oy(O,i.getCharCode(L+1),W&&C),!1))}}var z;return Wd(qd(i.length(),P,b,x,0,!0))}function Vh(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 Uy(i,e,r,s,u){if(!s&&!u)return;const m=i[r],g=(i[r].x+m.metrics.advance*m.scale)*s;for(let x=e;x<=r;x++)i[x].x-=g,i[x].y+=u}function $y(i,e,r){const{horizontalAlign:s,verticalAlign:u}=Vh(r),m=e[0]-i.displaySize[0]*s,g=e[1]-i.displaySize[1]*u;return{image:i,top:g,bottom:g+i.displaySize[1],left:m,right:m+i.displaySize[0]}}function Xd(i,e,r,s,u,m){const g=i.image;let x;if(g.content){const X=g.content,oe=g.pixelRatio||1;x=[X[0]/oe,X[1]/oe,g.displaySize[0]-X[2]/oe,g.displaySize[1]-X[3]/oe]}const b=e.left*m,C=e.right*m;let P,z,L,F;r==="width"||r==="both"?(F=u[0]+b-s[3],z=u[0]+C+s[1]):(F=u[0]+(b+C-g.displaySize[0])/2,z=F+g.displaySize[0]);const O=e.top*m,W=e.bottom*m;return r==="height"||r==="both"?(P=u[1]+O-s[0],L=u[1]+W+s[2]):(P=u[1]+(O+W-g.displaySize[1])/2,L=P+g.displaySize[1]),{image:g,top:P,right:z,bottom:L,left:F,collisionPadding:x}}const Ln=128;function Yd(i,e){const{expression:r}=e;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new Ut(i+1))};if(r.kind==="source")return{kind:"source"};{const{zoomStops:s,interpolationType:u}=r;let m=0;for(;m<s.length&&s[m]<=i;)m++;m=Math.max(0,m-1);let g=m;for(;g<s.length&&s[g]<i+1;)g++;g=Math.min(s.length-1,g);const x=s[m],b=s[g];return r.kind==="composite"?{kind:"composite",minZoom:x,maxZoom:b,interpolationType:u}:{kind:"camera",minZoom:x,maxZoom:b,minSize:r.evaluate(new Ut(x)),maxSize:r.evaluate(new Ut(b)),interpolationType:u}}}class so extends Ye{constructor(e,r,s,u){super(e,r),this.angle=s,u!==void 0&&(this.segment=u)}clone(){return new so(this.x,this.y,this.angle,this.segment)}}function Kd(i,e,r,s,u){if(e.segment===void 0)return!0;let m=e,g=e.segment+1,x=0;for(;x>-r/2;){if(g--,g<0)return!1;x-=i[g].dist(m),m=i[g]}x+=i[g].dist(i[g+1]),g++;const b=[];let C=0;for(;x<r/2;){const P=i[g],z=i[g+1];if(!z)return!1;let L=i[g-1].angleTo(P)-P.angleTo(z);for(L=Math.abs((L+3*Math.PI)%(2*Math.PI)-Math.PI),b.push({distance:x,angleDelta:L}),C+=L;x-b[0].distance>s;)C-=b.shift().angleDelta;if(C>u)return!1;g++,x+=P.dist(z)}return!0}function Jd(i){let e=0;for(let r=0;r<i.length-1;r++)e+=i[r].dist(i[r+1]);return e}function Qd(i,e,r){return i?.6*e*r:0}function ep(i,e){return Math.max(i?i.right-i.left:0,e?e.right-e.left:0)}function Ny(i,e,r,s,u,m){const g=Qd(r,u,m),x=ep(r,s)*m;let b=0;const C=Jd(i)/2;for(let P=0;P<i.length-1;P++){const z=i[P],L=i[P+1],F=z.dist(L);if(b+F>C){const O=(C-b)/F,W=ri(z.x,L.x,O),X=ri(z.y,L.y,O),oe=new so(W,X,L.angleTo(z),P);return oe._round(),!g||Kd(i,oe,x,g,e)?oe:void 0}b+=F}}function Vy(i,e,r,s,u,m,g,x,b){const C=Qd(s,m,g),P=ep(s,u),z=P*g,L=i[0].x===0||i[0].x===b||i[0].y===0||i[0].y===b;return e-z<e/4&&(e=z+e/4),tp(i,L?e/2*x%e:(P/2+2*m)*g*x%e,e,C,r,z,L,!1,b)}function tp(i,e,r,s,u,m,g,x,b){const C=m/2,P=Jd(i);let z=0,L=e-r,F=[];for(let O=0;O<i.length-1;O++){const W=i[O],X=i[O+1],oe=W.dist(X),le=X.angleTo(W);for(;L+r<z+oe;){L+=r;const se=(L-z)/oe,me=ri(W.x,X.x,se),xe=ri(W.y,X.y,se);if(me>=0&&me<b&&xe>=0&&xe<b&&L-C>=0&&L+C<=P){const ye=new so(me,xe,le,O);ye._round(),s&&!Kd(i,ye,m,s,u)||F.push(ye)}}z+=oe}return x||F.length||g||(F=tp(i,z/2,r,s,u,m,g,!0,b)),F}function ip(i,e,r,s,u){const m=[];for(let g=0;g<i.length;g++){const x=i[g];let b;for(let C=0;C<x.length-1;C++){let P=x[C],z=x[C+1];P.x<e&&z.x<e||(P.x<e?P=new Ye(e,P.y+(e-P.x)/(z.x-P.x)*(z.y-P.y))._round():z.x<e&&(z=new Ye(e,P.y+(e-P.x)/(z.x-P.x)*(z.y-P.y))._round()),P.y<r&&z.y<r||(P.y<r?P=new Ye(P.x+(r-P.y)/(z.y-P.y)*(z.x-P.x),r)._round():z.y<r&&(z=new Ye(P.x+(r-P.y)/(z.y-P.y)*(z.x-P.x),r)._round()),P.x>=s&&z.x>=s||(P.x>=s?P=new Ye(s,P.y+(s-P.x)/(z.x-P.x)*(z.y-P.y))._round():z.x>=s&&(z=new Ye(s,P.y+(s-P.x)/(z.x-P.x)*(z.y-P.y))._round()),P.y>=u&&z.y>=u||(P.y>=u?P=new Ye(P.x+(u-P.y)/(z.y-P.y)*(z.x-P.x),u)._round():z.y>=u&&(z=new Ye(P.x+(u-P.y)/(z.y-P.y)*(z.x-P.x),u)._round()),b&&P.equals(b[b.length-1])||(b=[P],m.push(b)),b.push(z)))))}}return m}function rp(i,e,r,s){const u=[],m=i.image,g=m.pixelRatio,x=m.paddedRect.w-2,b=m.paddedRect.h-2,C=i.right-i.left,P=i.bottom-i.top,z=m.stretchX||[[0,x]],L=m.stretchY||[[0,b]],F=(Ie,Be)=>Ie+Be[1]-Be[0],O=z.reduce(F,0),W=L.reduce(F,0),X=x-O,oe=b-W;let le=0,se=O,me=0,xe=W,ye=0,Ue=X,qe=0,ke=oe;if(m.content&&s){const Ie=m.content;le=oc(z,0,Ie[0]),me=oc(L,0,Ie[1]),se=oc(z,Ie[0],Ie[2]),xe=oc(L,Ie[1],Ie[3]),ye=Ie[0]-le,qe=Ie[1]-me,Ue=Ie[2]-Ie[0]-se,ke=Ie[3]-Ie[1]-xe}const Le=(Ie,Be,De,Te)=>{const Qe=ac(Ie.stretch-le,se,C,i.left),We=sc(Ie.fixed-ye,Ue,Ie.stretch,O),gt=ac(Be.stretch-me,xe,P,i.top),Ct=sc(Be.fixed-qe,ke,Be.stretch,W),Nt=ac(De.stretch-le,se,C,i.left),Vt=sc(De.fixed-ye,Ue,De.stretch,O),wi=ac(Te.stretch-me,xe,P,i.top),oi=sc(Te.fixed-qe,ke,Te.stretch,W),ai=new Ye(Qe,gt),gi=new Ye(Nt,gt),Si=new Ye(Nt,wi),ki=new Ye(Qe,wi),Ji=new Ye(We/g,Ct/g),si=new Ye(Vt/g,oi/g),Ti=e*Math.PI/180;if(Ti){const Qi=Math.sin(Ti),er=Math.cos(Ti),Gt=[er,-Qi,Qi,er];ai._matMult(Gt),gi._matMult(Gt),ki._matMult(Gt),Si._matMult(Gt)}const Li=Ie.stretch+Ie.fixed,Zi=Be.stretch+Be.fixed;return{tl:ai,tr:gi,bl:ki,br:Si,tex:{x:m.paddedRect.x+1+Li,y:m.paddedRect.y+1+Zi,w:De.stretch+De.fixed-Li,h:Te.stretch+Te.fixed-Zi},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Ji,pixelOffsetBR:si,minFontScaleX:Ue/g/C,minFontScaleY:ke/g/P,isSDF:r}};if(s&&(m.stretchX||m.stretchY)){const Ie=np(z,X,O),Be=np(L,oe,W);for(let De=0;De<Ie.length-1;De++){const Te=Ie[De],Qe=Ie[De+1];for(let We=0;We<Be.length-1;We++)u.push(Le(Te,Be[We],Qe,Be[We+1]))}}else u.push(Le({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:x+1},{fixed:0,stretch:b+1}));return u}function oc(i,e,r){let s=0;for(const u of i)s+=Math.max(e,Math.min(r,u[1]))-Math.max(e,Math.min(r,u[0]));return s}function np(i,e,r){const s=[{fixed:-1,stretch:0}];for(const[u,m]of i){const g=s[s.length-1];s.push({fixed:u-g.stretch,stretch:g.stretch}),s.push({fixed:u-g.stretch,stretch:g.stretch+(m-u)})}return s.push({fixed:e+1,stretch:r}),s}function ac(i,e,r,s){return i/e*r+s}function sc(i,e,r,s){return i-e*r/s}Oe("Anchor",so);class lc{constructor(e,r,s,u,m,g,x,b,C,P){if(this.boxStartIndex=e.length,C){let z=g.top,L=g.bottom;const F=g.collisionPadding;F&&(z-=F[1],L+=F[3]);let O=L-z;O>0&&(O=Math.max(10,O),this.circleDiameter=O)}else{let z=g.top*x-b,L=g.bottom*x+b,F=g.left*x-b,O=g.right*x+b;const W=g.collisionPadding;if(W&&(F-=W[0]*x,z-=W[1]*x,O+=W[2]*x,L+=W[3]*x),P){const X=new Ye(F,z),oe=new Ye(O,z),le=new Ye(F,L),se=new Ye(O,L),me=P*Math.PI/180;X._rotate(me),oe._rotate(me),le._rotate(me),se._rotate(me),F=Math.min(X.x,oe.x,le.x,se.x),O=Math.max(X.x,oe.x,le.x,se.x),z=Math.min(X.y,oe.y,le.y,se.y),L=Math.max(X.y,oe.y,le.y,se.y)}e.emplaceBack(r.x,r.y,F,z,O,L,s,u,m)}this.boxEndIndex=e.length}}class Gy{constructor(e=[],r=Zy){if(this.data=e,this.length=this.data.length,this.compare=r,this.length>0)for(let s=(this.length>>1)-1;s>=0;s--)this._down(s)}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:s}=this,u=r[e];for(;e>0;){const m=e-1>>1,g=r[m];if(s(u,g)>=0)break;r[e]=g,e=m}r[e]=u}_down(e){const{data:r,compare:s}=this,u=this.length>>1,m=r[e];for(;e<u;){let g=1+(e<<1),x=r[g];const b=g+1;if(b<this.length&&s(r[b],x)<0&&(g=b,x=r[b]),s(x,m)>=0)break;r[e]=x,e=g}r[e]=m}}function Zy(i,e){return i<e?-1:i>e?1:0}function Hy(i,e=1,r=!1){let s=1/0,u=1/0,m=-1/0,g=-1/0;const x=i[0];for(let F=0;F<x.length;F++){const O=x[F];(!F||O.x<s)&&(s=O.x),(!F||O.y<u)&&(u=O.y),(!F||O.x>m)&&(m=O.x),(!F||O.y>g)&&(g=O.y)}const b=Math.min(m-s,g-u);let C=b/2;const P=new Gy([],jy);if(b===0)return new Ye(s,u);for(let F=s;F<m;F+=b)for(let O=u;O<g;O+=b)P.push(new La(F+C,O+C,C,i));let z=function(F){let O=0,W=0,X=0;const oe=F[0];for(let le=0,se=oe.length,me=se-1;le<se;me=le++){const xe=oe[le],ye=oe[me],Ue=xe.x*ye.y-ye.x*xe.y;W+=(xe.x+ye.x)*Ue,X+=(xe.y+ye.y)*Ue,O+=3*Ue}return new La(W/O,X/O,0,F)}(i),L=P.length;for(;P.length;){const F=P.pop();(F.d>z.d||!z.d)&&(z=F,r&&console.log("found best %d after %d probes",Math.round(1e4*F.d)/1e4,L)),F.max-z.d<=e||(C=F.h/2,P.push(new La(F.p.x-C,F.p.y-C,C,i)),P.push(new La(F.p.x+C,F.p.y-C,C,i)),P.push(new La(F.p.x-C,F.p.y+C,C,i)),P.push(new La(F.p.x+C,F.p.y+C,C,i)),L+=4)}return r&&(console.log(`num probes: ${L}`),console.log(`best distance: ${z.d}`)),z.p}function jy(i,e){return e.max-i.max}function La(i,e,r,s){this.p=new Ye(i,e),this.h=r,this.d=function(u,m){let g=!1,x=1/0;for(let b=0;b<m.length;b++){const C=m[b];for(let P=0,z=C.length,L=z-1;P<z;L=P++){const F=C[P],O=C[L];F.y>u.y!=O.y>u.y&&u.x<(O.x-F.x)*(u.y-F.y)/(O.y-F.y)+F.x&&(g=!g),x=Math.min(x,fd(u,F,O))}}return(g?1:-1)*Math.sqrt(x)}(this.p,s),this.max=this.d+this.h*Math.SQRT2}const Gh=Number.POSITIVE_INFINITY;function op(i,e){return e[1]!==Gh?function(r,s,u){let m=0,g=0;switch(s=Math.abs(s),u=Math.abs(u),r){case"top-right":case"top-left":case"top":g=u-7;break;case"bottom-right":case"bottom-left":case"bottom":g=7-u}switch(r){case"top-right":case"bottom-right":case"right":m=-s;break;case"top-left":case"bottom-left":case"left":m=s}return[m,g]}(i,e[0],e[1]):function(r,s){let u=0,m=0;s<0&&(s=0);const g=s/Math.sqrt(2);switch(r){case"top-right":case"top-left":m=g-7;break;case"bottom-right":case"bottom-left":m=7-g;break;case"bottom":m=7-s;break;case"top":m=s-7}switch(r){case"top-right":case"bottom-right":u=-g;break;case"top-left":case"bottom-left":u=g;break;case"left":u=s;break;case"right":u=-s}return[u,m]}(i,e[0])}function Zh(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 qy(i,e,r,s,u,m,g,x,b,C,P){let z=m.textMaxSize.evaluate(e,{});z===void 0&&(z=g);const L=i.layers[0].layout,F=L.get("icon-offset").evaluate(e,{},P),O=sp(r.horizontal),W=g/24,X=i.tilePixelRatio*W,oe=i.tilePixelRatio*z/24,le=i.tilePixelRatio*x,se=i.tilePixelRatio*L.get("symbol-spacing"),me=L.get("text-padding")*i.tilePixelRatio,xe=L.get("icon-padding")*i.tilePixelRatio,ye=L.get("text-max-angle")/180*Math.PI,Ue=L.get("text-rotation-alignment")!=="viewport"&&L.get("symbol-placement")!=="point",qe=L.get("icon-rotation-alignment")==="map"&&L.get("symbol-placement")!=="point",ke=L.get("symbol-placement"),Le=se/2,Ie=L.get("icon-text-fit");let Be;s&&Ie!=="none"&&(i.allowVerticalPlacement&&r.vertical&&(Be=Xd(s,r.vertical,Ie,L.get("icon-text-fit-padding"),F,W)),O&&(s=Xd(s,O,Ie,L.get("icon-text-fit-padding"),F,W)));const De=(Te,Qe)=>{Qe.x<0||Qe.x>=ui||Qe.y<0||Qe.y>=ui||function(We,gt,Ct,Nt,Vt,wi,oi,ai,gi,Si,ki,Ji,si,Ti,Li,Zi,Qi,er,Gt,yi,pt,cr,Ci,Di,Dr){const qr=We.addToLineVertexArray(gt,Ct);let Wr,Dn,Rr,wr,tr=0,Rn=0,Hs=0,Sp=0,eu=-1,tu=-1;const Fn={};let Tp=Ms(""),iu=0,ru=0;if(ai._unevaluatedLayout.getValue("text-radial-offset")===void 0?[iu,ru]=ai.layout.get("text-offset").evaluate(pt,{},Di).map(ir=>ir*vi):(iu=ai.layout.get("text-radial-offset").evaluate(pt,{},Di)*vi,ru=Gh),We.allowVerticalPlacement&&Nt.vertical){const ir=ai.layout.get("text-rotate").evaluate(pt,{},Di)+90;Rr=new lc(gi,gt,Si,ki,Ji,Nt.vertical,si,Ti,Li,ir),oi&&(wr=new lc(gi,gt,Si,ki,Ji,oi,Qi,er,Li,ir))}if(Vt){const ir=ai.layout.get("icon-rotate").evaluate(pt,{}),an=ai.layout.get("icon-text-fit")!=="none",js=rp(Vt,ir,Ci,an),qs=oi?rp(oi,ir,Ci,an):void 0;Dn=new lc(gi,gt,Si,ki,Ji,Vt,Qi,er,!1,ir),tr=4*js.length;const Ep=We.iconSizeData;let Uo=null;Ep.kind==="source"?(Uo=[Ln*ai.layout.get("icon-size").evaluate(pt,{})],Uo[0]>lo&&rt(`${We.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):Ep.kind==="composite"&&(Uo=[Ln*cr.compositeIconSizes[0].evaluate(pt,{},Di),Ln*cr.compositeIconSizes[1].evaluate(pt,{},Di)],(Uo[0]>lo||Uo[1]>lo)&&rt(`${We.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),We.addSymbols(We.icon,js,Uo,yi,Gt,pt,l.WritingMode.none,gt,qr.lineStartIndex,qr.lineLength,-1,Di),eu=We.icon.placedSymbolArray.length-1,qs&&(Rn=4*qs.length,We.addSymbols(We.icon,qs,Uo,yi,Gt,pt,l.WritingMode.vertical,gt,qr.lineStartIndex,qr.lineLength,-1,Di),tu=We.icon.placedSymbolArray.length-1)}const Cp=Object.keys(Nt.horizontal);for(const ir of Cp){const an=Nt.horizontal[ir];if(!Wr){Tp=Ms(an.text);const qs=ai.layout.get("text-rotate").evaluate(pt,{},Di);Wr=new lc(gi,gt,Si,ki,Ji,an,si,Ti,Li,qs)}const js=an.positionedLines.length===1;if(Hs+=ap(We,gt,an,wi,ai,Li,pt,Zi,qr,Nt.vertical?l.WritingMode.horizontal:l.WritingMode.horizontalOnly,js?Cp:[ir],Fn,eu,cr,Di),js)break}Nt.vertical&&(Sp+=ap(We,gt,Nt.vertical,wi,ai,Li,pt,Zi,qr,l.WritingMode.vertical,["vertical"],Fn,tu,cr,Di));const a_=Wr?Wr.boxStartIndex:We.collisionBoxArray.length,s_=Wr?Wr.boxEndIndex:We.collisionBoxArray.length,l_=Rr?Rr.boxStartIndex:We.collisionBoxArray.length,c_=Rr?Rr.boxEndIndex:We.collisionBoxArray.length,h_=Dn?Dn.boxStartIndex:We.collisionBoxArray.length,u_=Dn?Dn.boxEndIndex:We.collisionBoxArray.length,d_=wr?wr.boxStartIndex:We.collisionBoxArray.length,p_=wr?wr.boxEndIndex:We.collisionBoxArray.length;let Xr=-1;const pc=(ir,an)=>ir&&ir.circleDiameter?Math.max(ir.circleDiameter,an):an;Xr=pc(Wr,Xr),Xr=pc(Rr,Xr),Xr=pc(Dn,Xr),Xr=pc(wr,Xr);const Ip=Xr>-1?1:0;Ip&&(Xr*=Dr/vi),We.glyphOffsetArray.length>=Da.MAX_GLYPHS&&rt("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),pt.sortKey!==void 0&&We.addToSortKeyRanges(We.symbolInstances.length,pt.sortKey),We.symbolInstances.emplaceBack(gt.x,gt.y,Fn.right>=0?Fn.right:-1,Fn.center>=0?Fn.center:-1,Fn.left>=0?Fn.left:-1,Fn.vertical||-1,eu,tu,Tp,a_,s_,l_,c_,h_,u_,d_,p_,Si,Hs,Sp,tr,Rn,Ip,0,si,iu,ru,Xr)}(i,Qe,Te,r,s,u,Be,i.layers[0],i.collisionBoxArray,e.index,e.sourceLayerIndex,i.index,X,me,Ue,b,le,xe,qe,F,e,m,C,P,g)};if(ke==="line")for(const Te of ip(e.geometry,0,0,ui,ui)){const Qe=Vy(Te,se,ye,r.vertical||O,s,24,oe,i.overscaling,ui);for(const We of Qe){const gt=O;gt&&Wy(i,gt.text,Le,We)||De(Te,We)}}else if(ke==="line-center"){for(const Te of e.geometry)if(Te.length>1){const Qe=Ny(Te,ye,r.vertical||O,s,24,oe);Qe&&De(Te,Qe)}}else if(e.type==="Polygon")for(const Te of zh(e.geometry,0)){const Qe=Hy(Te,16);De(Te[0],new so(Qe.x,Qe.y,0))}else if(e.type==="LineString")for(const Te of e.geometry)De(Te,new so(Te[0].x,Te[0].y,0));else if(e.type==="Point")for(const Te of e.geometry)for(const Qe of Te)De([Qe],new so(Qe.x,Qe.y,0))}const lo=32640;function ap(i,e,r,s,u,m,g,x,b,C,P,z,L,F,O){const W=function(le,se,me,xe,ye,Ue,qe,ke){const Le=xe.layout.get("text-rotate").evaluate(Ue,{})*Math.PI/180,Ie=[];for(const Be of se.positionedLines)for(const De of Be.positionedGlyphs){if(!De.rect)continue;const Te=De.rect||{};let Qe=4,We=!0,gt=1,Ct=0;const Nt=(ye||ke)&&De.vertical,Vt=De.metrics.advance*De.scale/2;if(ke&&se.verticalizable){const Gt=(De.scale-1)*vi,yi=(vi-De.metrics.width*De.scale)/2;Ct=Be.lineOffset/2-(De.imageName?-yi:Gt)}if(De.imageName){const Gt=qe[De.imageName];We=Gt.sdf,gt=Gt.pixelRatio,Qe=1/gt}const wi=ye?[De.x+Vt,De.y]:[0,0];let oi=ye?[0,0]:[De.x+Vt+me[0],De.y+me[1]-Ct],ai=[0,0];Nt&&(ai=oi,oi=[0,0]);const gi=(De.metrics.left-Qe)*De.scale-Vt+oi[0],Si=(-De.metrics.top-Qe)*De.scale+oi[1],ki=gi+Te.w*De.scale/gt,Ji=Si+Te.h*De.scale/gt,si=new Ye(gi,Si),Ti=new Ye(ki,Si),Li=new Ye(gi,Ji),Zi=new Ye(ki,Ji);if(Nt){const Gt=new Ye(-Vt,Vt-ic),yi=-Math.PI/2,pt=12-Vt,cr=new Ye(22-pt,-(De.imageName?pt:0)),Ci=new Ye(...ai);si._rotateAround(yi,Gt)._add(cr)._add(Ci),Ti._rotateAround(yi,Gt)._add(cr)._add(Ci),Li._rotateAround(yi,Gt)._add(cr)._add(Ci),Zi._rotateAround(yi,Gt)._add(cr)._add(Ci)}if(Le){const Gt=Math.sin(Le),yi=Math.cos(Le),pt=[yi,-Gt,Gt,yi];si._matMult(pt),Ti._matMult(pt),Li._matMult(pt),Zi._matMult(pt)}const Qi=new Ye(0,0),er=new Ye(0,0);Ie.push({tl:si,tr:Ti,bl:Li,br:Zi,tex:Te,writingMode:se.writingMode,glyphOffset:wi,sectionIndex:De.sectionIndex,isSDF:We,pixelOffsetTL:Qi,pixelOffsetBR:er,minFontScaleX:0,minFontScaleY:0})}return Ie}(0,r,x,u,m,g,s,i.allowVerticalPlacement),X=i.textSizeData;let oe=null;X.kind==="source"?(oe=[Ln*u.layout.get("text-size").evaluate(g,{})],oe[0]>lo&&rt(`${i.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):X.kind==="composite"&&(oe=[Ln*F.compositeTextSizes[0].evaluate(g,{},O),Ln*F.compositeTextSizes[1].evaluate(g,{},O)],(oe[0]>lo||oe[1]>lo)&&rt(`${i.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),i.addSymbols(i.text,W,oe,x,m,g,C,e,b.lineStartIndex,b.lineLength,L,O);for(const le of P)z[le]=i.text.placedSymbolArray.length-1;return 4*W.length}function sp(i){for(const e in i)return i[e];return null}function Wy(i,e,r,s){const u=i.compareText;if(e in u){const m=u[e];for(let g=m.length-1;g>=0;g--)if(s.dist(m[g])<r)return!0}else u[e]=[];return u[e].push(s),!1}const Xy=oo.VectorTileFeature.types,Yy=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function cc(i,e,r,s,u,m,g,x,b,C,P,z,L){const F=x?Math.min(lo,Math.round(x[0])):0,O=x?Math.min(lo,Math.round(x[1])):0;i.emplaceBack(e,r,Math.round(32*s),Math.round(32*u),m,g,(F<<1)+(b?1:0),O,16*C,16*P,256*z,256*L)}function Hh(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 Ky(i){for(const e of i.sections)if(gh(e.text))return!0;return!1}class jh{constructor(e){this.layoutVertexArray=new xi,this.indexArray=new Gi,this.programConfigurations=e,this.segments=new wt,this.dynamicLayoutVertexArray=new Yi,this.opacityVertexArray=new sr,this.placedSymbolArray=new Se}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(e,r,s,u){this.isEmpty()||(s&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,vy.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,by.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,Yy,!0),this.opacityVertexBuffer.itemSize=1),(s||u)&&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())}}Oe("SymbolBuffers",jh);class qh{constructor(e,r,s){this.layoutVertexArray=new e,this.layoutAttributes=r,this.indexArray=new s,this.segments=new wt,this.collisionVertexArray=new on}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,wy.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}Oe("CollisionBuffers",qh);class Da{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(g=>g.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=Th([]),this.placementViewportMatrix=Th([]);const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Yd(this.zoom,r["text-size"]),this.iconSizeData=Yd(this.zoom,r["icon-size"]);const s=this.layers[0].layout,u=s.get("symbol-sort-key"),m=s.get("symbol-z-order");this.canOverlap=Xh(s,"text-overlap","text-allow-overlap")!=="never"||Xh(s,"icon-overlap","icon-allow-overlap")!=="never"||s.get("text-ignore-placement")||s.get("icon-ignore-placement"),this.sortFeaturesByKey=m!=="viewport-y"&&!u.isConstant(),this.sortFeaturesByY=(m==="viewport-y"||m==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,s.get("symbol-placement")==="point"&&(this.writingModes=s.get("text-writing-mode").map(g=>l.WritingMode[g])),this.stateDependentLayerIds=this.layers.filter(g=>g.isStateDependent()).map(g=>g.id),this.sourceID=e.sourceID}createArrays(){this.text=new jh(new Ro(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new jh(new Ro(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new Ne,this.lineVertexArray=new ze,this.symbolInstances=new fe}calculateGlyphDependencies(e,r,s,u,m){for(let g=0;g<e.length;g++)if(r[e.charCodeAt(g)]=!0,(s||u)&&m){const x=Ns[e.charAt(g)];x&&(r[x.charCodeAt(0)]=!0)}}populate(e,r,s){const u=this.layers[0],m=u.layout,g=m.get("text-font"),x=m.get("text-field"),b=m.get("icon-image"),C=(x.value.kind!=="constant"||x.value.value instanceof H&&!x.value.value.isEmpty()||x.value.value.toString().length>0)&&(g.value.kind!=="constant"||g.value.value.length>0),P=b.value.kind!=="constant"||!!b.value.value||Object.keys(b.parameters).length>0,z=m.get("symbol-sort-key");if(this.features=[],!C&&!P)return;const L=r.iconDependencies,F=r.glyphDependencies,O=r.availableImages,W=new Ut(this.zoom);for(const{feature:X,id:oe,index:le,sourceLayerIndex:se}of e){const me=u._featureFilter.needGeometry,xe=Bo(X,me);if(!u._featureFilter.filter(W,xe,s))continue;let ye,Ue;if(me||(xe.geometry=Fo(X)),C){const ke=u.getValueAndResolveTokens("text-field",xe,s,O),Le=H.factory(ke);Ky(Le)&&(this.hasRTLText=!0),(!this.hasRTLText||Es()==="unavailable"||this.hasRTLText&&ar.isParsed())&&(ye=Ty(Le,u,xe))}if(P){const ke=u.getValueAndResolveTokens("icon-image",xe,s,O);Ue=ke instanceof ee?ke:ee.fromString(ke)}if(!ye&&!Ue)continue;const qe=this.sortFeaturesByKey?z.evaluate(xe,{},s):void 0;if(this.features.push({id:oe,text:ye,icon:Ue,index:le,sourceLayerIndex:se,geometry:xe.geometry,properties:X.properties,type:Xy[X.type],sortKey:qe}),Ue&&(L[Ue.name]=!0),ye){const ke=g.evaluate(xe,{},s).join(","),Le=m.get("text-rotation-alignment")!=="viewport"&&m.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(l.WritingMode.vertical)>=0;for(const Ie of ye.sections)if(Ie.image)L[Ie.image.name]=!0;else{const Be=ws(ye.toString()),De=Ie.fontStack||ke,Te=F[De]=F[De]||{};this.calculateGlyphDependencies(Ie.text,Te,Le,this.allowVerticalPlacement,Be)}}}m.get("symbol-placement")==="line"&&(this.features=function(X){const oe={},le={},se=[];let me=0;function xe(ke){se.push(X[ke]),me++}function ye(ke,Le,Ie){const Be=le[ke];return delete le[ke],le[Le]=Be,se[Be].geometry[0].pop(),se[Be].geometry[0]=se[Be].geometry[0].concat(Ie[0]),Be}function Ue(ke,Le,Ie){const Be=oe[Le];return delete oe[Le],oe[ke]=Be,se[Be].geometry[0].shift(),se[Be].geometry[0]=Ie[0].concat(se[Be].geometry[0]),Be}function qe(ke,Le,Ie){const Be=Ie?Le[0][Le[0].length-1]:Le[0][0];return`${ke}:${Be.x}:${Be.y}`}for(let ke=0;ke<X.length;ke++){const Le=X[ke],Ie=Le.geometry,Be=Le.text?Le.text.toString():null;if(!Be){xe(ke);continue}const De=qe(Be,Ie),Te=qe(Be,Ie,!0);if(De in le&&Te in oe&&le[De]!==oe[Te]){const Qe=Ue(De,Te,Ie),We=ye(De,Te,se[Qe].geometry);delete oe[De],delete le[Te],le[qe(Be,se[We].geometry,!0)]=We,se[Qe].geometry=null}else De in le?ye(De,Te,Ie):Te in oe?Ue(De,Te,Ie):(xe(ke),oe[De]=me-1,le[Te]=me-1)}return se.filter(ke=>ke.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((X,oe)=>X.sortKey-oe.sortKey)}update(e,r,s){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,r,this.layers,s),this.icon.programConfigurations.updatePaintArrays(e,r,this.layers,s))}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 s=this.lineVertexArray.length;if(e.segment!==void 0){let u=e.dist(r[e.segment+1]),m=e.dist(r[e.segment]);const g={};for(let x=e.segment+1;x<r.length;x++)g[x]={x:r[x].x,y:r[x].y,tileUnitDistanceFromAnchor:u},x<r.length-1&&(u+=r[x+1].dist(r[x]));for(let x=e.segment||0;x>=0;x--)g[x]={x:r[x].x,y:r[x].y,tileUnitDistanceFromAnchor:m},x>0&&(m+=r[x-1].dist(r[x]));for(let x=0;x<r.length;x++){const b=g[x];this.lineVertexArray.emplaceBack(b.x,b.y,b.tileUnitDistanceFromAnchor)}}return{lineStartIndex:s,lineLength:this.lineVertexArray.length-s}}addSymbols(e,r,s,u,m,g,x,b,C,P,z,L){const F=e.indexArray,O=e.layoutVertexArray,W=e.segments.prepareSegment(4*r.length,O,F,this.canOverlap?g.sortKey:void 0),X=this.glyphOffsetArray.length,oe=W.vertexLength,le=this.allowVerticalPlacement&&x===l.WritingMode.vertical?Math.PI/2:0,se=g.text&&g.text.sections;for(let me=0;me<r.length;me++){const{tl:xe,tr:ye,bl:Ue,br:qe,tex:ke,pixelOffsetTL:Le,pixelOffsetBR:Ie,minFontScaleX:Be,minFontScaleY:De,glyphOffset:Te,isSDF:Qe,sectionIndex:We}=r[me],gt=W.vertexLength,Ct=Te[1];cc(O,b.x,b.y,xe.x,Ct+xe.y,ke.x,ke.y,s,Qe,Le.x,Le.y,Be,De),cc(O,b.x,b.y,ye.x,Ct+ye.y,ke.x+ke.w,ke.y,s,Qe,Ie.x,Le.y,Be,De),cc(O,b.x,b.y,Ue.x,Ct+Ue.y,ke.x,ke.y+ke.h,s,Qe,Le.x,Ie.y,Be,De),cc(O,b.x,b.y,qe.x,Ct+qe.y,ke.x+ke.w,ke.y+ke.h,s,Qe,Ie.x,Ie.y,Be,De),Hh(e.dynamicLayoutVertexArray,b,le),F.emplaceBack(gt,gt+1,gt+2),F.emplaceBack(gt+1,gt+2,gt+3),W.vertexLength+=4,W.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(Te[0]),me!==r.length-1&&We===r[me+1].sectionIndex||e.programConfigurations.populatePaintArrays(O.length,g,g.index,{},L,se&&se[We])}e.placedSymbolArray.emplaceBack(b.x,b.y,X,this.glyphOffsetArray.length-X,oe,C,P,b.segment,s?s[0]:0,s?s[1]:0,u[0],u[1],x,0,!1,0,z)}_addCollisionDebugVertex(e,r,s,u,m,g){return r.emplaceBack(0,0),e.emplaceBack(s.x,s.y,u,m,Math.round(g.x),Math.round(g.y))}addCollisionDebugVertices(e,r,s,u,m,g,x){const b=m.segments.prepareSegment(4,m.layoutVertexArray,m.indexArray),C=b.vertexLength,P=m.layoutVertexArray,z=m.collisionVertexArray,L=x.anchorX,F=x.anchorY;this._addCollisionDebugVertex(P,z,g,L,F,new Ye(e,r)),this._addCollisionDebugVertex(P,z,g,L,F,new Ye(s,r)),this._addCollisionDebugVertex(P,z,g,L,F,new Ye(s,u)),this._addCollisionDebugVertex(P,z,g,L,F,new Ye(e,u)),b.vertexLength+=4;const O=m.indexArray;O.emplaceBack(C,C+1),O.emplaceBack(C+1,C+2),O.emplaceBack(C+2,C+3),O.emplaceBack(C+3,C),b.primitiveLength+=4}addDebugCollisionBoxes(e,r,s,u){for(let m=e;m<r;m++){const g=this.collisionBoxArray.get(m);this.addCollisionDebugVertices(g.x1,g.y1,g.x2,g.y2,u?this.textCollisionBox:this.iconCollisionBox,g.anchorPoint,s)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new qh(lr,Fd.members,Mr),this.iconCollisionBox=new qh(lr,Fd.members,Mr);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,s,u,m,g,x,b,C){const P={};for(let z=r;z<s;z++){const L=e.get(z);P.textBox={x1:L.x1,y1:L.y1,x2:L.x2,y2:L.y2,anchorPointX:L.anchorPointX,anchorPointY:L.anchorPointY},P.textFeatureIndex=L.featureIndex;break}for(let z=u;z<m;z++){const L=e.get(z);P.verticalTextBox={x1:L.x1,y1:L.y1,x2:L.x2,y2:L.y2,anchorPointX:L.anchorPointX,anchorPointY:L.anchorPointY},P.verticalTextFeatureIndex=L.featureIndex;break}for(let z=g;z<x;z++){const L=e.get(z);P.iconBox={x1:L.x1,y1:L.y1,x2:L.x2,y2:L.y2,anchorPointX:L.anchorPointX,anchorPointY:L.anchorPointY},P.iconFeatureIndex=L.featureIndex;break}for(let z=b;z<C;z++){const L=e.get(z);P.verticalIconBox={x1:L.x1,y1:L.y1,x2:L.x2,y2:L.y2,anchorPointX:L.anchorPointX,anchorPointY:L.anchorPointY},P.verticalIconFeatureIndex=L.featureIndex;break}return P}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let r=0;r<this.symbolInstances.length;r++){const s=this.symbolInstances.get(r);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,s.textBoxStartIndex,s.textBoxEndIndex,s.verticalTextBoxStartIndex,s.verticalTextBoxEndIndex,s.iconBoxStartIndex,s.iconBoxEndIndex,s.verticalIconBoxStartIndex,s.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 s=e.placedSymbolArray.get(r),u=s.vertexStartIndex+4*s.numGlyphs;for(let m=s.vertexStartIndex;m<u;m+=4)e.indexArray.emplaceBack(m,m+1,m+2),e.indexArray.emplaceBack(m+1,m+2,m+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const r=Math.sin(e),s=Math.cos(e),u=[],m=[],g=[];for(let x=0;x<this.symbolInstances.length;++x){g.push(x);const b=this.symbolInstances.get(x);u.push(0|Math.round(r*b.anchorX+s*b.anchorY)),m.push(b.featureIndex)}return g.sort((x,b)=>u[x]-u[b]||m[b]-m[x]),g}addToSortKeyRanges(e,r){const s=this.sortKeyRanges[this.sortKeyRanges.length-1];s&&s.sortKey===r?s.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 s=this.symbolInstances.get(r);this.featureSortOrder.push(s.featureIndex),[s.rightJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.leftJustifiedTextSymbolIndex].forEach((u,m,g)=>{u>=0&&g.indexOf(u)===m&&this.addIndicesForPlacedSymbol(this.text,u)}),s.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,s.verticalPlacedTextSymbolIndex),s.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,s.placedIconSymbolIndex),s.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,s.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}Oe("SymbolBucket",Da,{omit:["layers","collisionBoxArray","features","compareText"]}),Da.MAX_GLYPHS=65535,Da.addDynamicAttributes=Hh;const Jy=new ci({"symbol-placement":new He(pe.layout_symbol["symbol-placement"]),"symbol-spacing":new He(pe.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new He(pe.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Je(pe.layout_symbol["symbol-sort-key"]),"symbol-z-order":new He(pe.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new He(pe.layout_symbol["icon-allow-overlap"]),"icon-overlap":new He(pe.layout_symbol["icon-overlap"]),"icon-ignore-placement":new He(pe.layout_symbol["icon-ignore-placement"]),"icon-optional":new He(pe.layout_symbol["icon-optional"]),"icon-rotation-alignment":new He(pe.layout_symbol["icon-rotation-alignment"]),"icon-size":new Je(pe.layout_symbol["icon-size"]),"icon-text-fit":new He(pe.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new He(pe.layout_symbol["icon-text-fit-padding"]),"icon-image":new Je(pe.layout_symbol["icon-image"]),"icon-rotate":new Je(pe.layout_symbol["icon-rotate"]),"icon-padding":new He(pe.layout_symbol["icon-padding"]),"icon-keep-upright":new He(pe.layout_symbol["icon-keep-upright"]),"icon-offset":new Je(pe.layout_symbol["icon-offset"]),"icon-anchor":new Je(pe.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new He(pe.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new He(pe.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new He(pe.layout_symbol["text-rotation-alignment"]),"text-field":new Je(pe.layout_symbol["text-field"]),"text-font":new Je(pe.layout_symbol["text-font"]),"text-size":new Je(pe.layout_symbol["text-size"]),"text-max-width":new Je(pe.layout_symbol["text-max-width"]),"text-line-height":new He(pe.layout_symbol["text-line-height"]),"text-letter-spacing":new Je(pe.layout_symbol["text-letter-spacing"]),"text-justify":new Je(pe.layout_symbol["text-justify"]),"text-radial-offset":new Je(pe.layout_symbol["text-radial-offset"]),"text-variable-anchor":new He(pe.layout_symbol["text-variable-anchor"]),"text-anchor":new Je(pe.layout_symbol["text-anchor"]),"text-max-angle":new He(pe.layout_symbol["text-max-angle"]),"text-writing-mode":new He(pe.layout_symbol["text-writing-mode"]),"text-rotate":new Je(pe.layout_symbol["text-rotate"]),"text-padding":new He(pe.layout_symbol["text-padding"]),"text-keep-upright":new He(pe.layout_symbol["text-keep-upright"]),"text-transform":new Je(pe.layout_symbol["text-transform"]),"text-offset":new Je(pe.layout_symbol["text-offset"]),"text-allow-overlap":new He(pe.layout_symbol["text-allow-overlap"]),"text-overlap":new He(pe.layout_symbol["text-overlap"]),"text-ignore-placement":new He(pe.layout_symbol["text-ignore-placement"]),"text-optional":new He(pe.layout_symbol["text-optional"])});var Wh={paint:new ci({"icon-opacity":new Je(pe.paint_symbol["icon-opacity"]),"icon-color":new Je(pe.paint_symbol["icon-color"]),"icon-halo-color":new Je(pe.paint_symbol["icon-halo-color"]),"icon-halo-width":new Je(pe.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Je(pe.paint_symbol["icon-halo-blur"]),"icon-translate":new He(pe.paint_symbol["icon-translate"]),"icon-translate-anchor":new He(pe.paint_symbol["icon-translate-anchor"]),"text-opacity":new Je(pe.paint_symbol["text-opacity"]),"text-color":new Je(pe.paint_symbol["text-color"],{runtimeType:Mi,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new Je(pe.paint_symbol["text-halo-color"]),"text-halo-width":new Je(pe.paint_symbol["text-halo-width"]),"text-halo-blur":new Je(pe.paint_symbol["text-halo-blur"]),"text-translate":new He(pe.paint_symbol["text-translate"]),"text-translate-anchor":new He(pe.paint_symbol["text-translate-anchor"])}),layout:Jy};class lp{constructor(e){this.type=e.property.overrides?e.property.overrides.runtimeType:Rt,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}}Oe("FormatSectionOverride",lp,{omit:["defaultValue"]});class hc extends Vi{constructor(e){super(e,Wh)}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 s=this.layout.get("text-writing-mode");if(s){const u=[];for(const m of s)u.indexOf(m)<0&&u.push(m);this.layout._values["text-writing-mode"]=u}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,r,s,u){const m=this.layout.get(e).evaluate(r,{},s,u),g=this._unevaluatedLayout._values[e];return g.isDataDriven()||sa(g.value)||!m?m:function(x,b){return b.replace(/{([^{}]+)}/g,(C,P)=>P in x?String(x[P]):"")}(r.properties,m)}createBucket(e){return new Da(e)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const e of Wh.paint.overridableProperties){if(!hc.hasPaintOverride(this.layout,e))continue;const r=this.paint.get(e),s=new lp(r),u=new gs(s,r.property.specification);let m=null;m=r.value.kind==="constant"||r.value.kind==="source"?new ca("source",u):new ha("composite",u,r.value.zoomStops,r.value._interpolationType),this.paint._values[e]=new Pr(r.property,m,r.parameters)}}_handleOverridablePaintPropertyUpdate(e,r,s){return!(!this.layout||r.isDataDriven()||s.isDataDriven())&&hc.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,r){const s=e.get("text-field"),u=Wh.paint.properties[r];let m=!1;const g=x=>{for(const b of x)if(u.overrides&&u.overrides.hasOverride(b))return void(m=!0)};if(s.value.kind==="constant"&&s.value.value instanceof H)g(s.value.value.sections);else if(s.value.kind==="source"){const x=C=>{m||(C instanceof _e&&te(C.value)===yr?g(C.value.sections):C instanceof je?g(C.sections):C.eachChild(x))},b=s.value;b._styleExpression&&x(b._styleExpression.expression)}return m}}function Xh(i,e,r){let s="never";const u=i.get(e);return u?s=u:i.get(r)&&(s="always"),s}var Qy={paint:new ci({"background-color":new He(pe.paint_background["background-color"]),"background-pattern":new ko(pe.paint_background["background-pattern"]),"background-opacity":new He(pe.paint_background["background-opacity"])})},e_={paint:new ci({"raster-opacity":new He(pe.paint_raster["raster-opacity"]),"raster-hue-rotate":new He(pe.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new He(pe.paint_raster["raster-brightness-min"]),"raster-brightness-max":new He(pe.paint_raster["raster-brightness-max"]),"raster-saturation":new He(pe.paint_raster["raster-saturation"]),"raster-contrast":new He(pe.paint_raster["raster-contrast"]),"raster-resampling":new He(pe.paint_raster["raster-resampling"]),"raster-fade-duration":new He(pe.paint_raster["raster-fade-duration"])})};class t_ extends Vi{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 i_={circle:class extends Vi{constructor(i){super(i,Dg)}createBucket(i){return new bh(i)}queryRadius(i){const e=i;return ks("circle-radius",this,e)+ks("circle-stroke-width",this,e)+Wl(this.paint.get("circle-translate"))}queryIntersectsFeature(i,e,r,s,u,m,g,x){const b=Xl(i,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),m.angle,g),C=this.paint.get("circle-radius").evaluate(e,r)+this.paint.get("circle-stroke-width").evaluate(e,r),P=this.paint.get("circle-pitch-alignment")==="map",z=P?b:function(F,O){return F.map(W=>_d(W,O))}(b,x),L=P?C*g:C;for(const F of s)for(const O of F){const W=P?O:_d(O,x);let X=L;const oe=Yl([],[O.x,O.y,0,1],x);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?X*=oe[3]/m.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(X*=m.cameraToCenterDistance/oe[3]),Pg(z,W,X))return!0}return!1}},heatmap:class extends Vi{constructor(i){super(i,Fg),this._updateColorRamp()}createBucket(i){return new xd(i)}_handleSpecialPaintPropertyUpdate(i){i==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=bd({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 Vi{constructor(i){super(i,Bg)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}},fill:class extends Vi{constructor(i){super(i,Qg)}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 Dh(i)}queryRadius(){return Wl(this.paint.get("fill-translate"))}queryIntersectsFeature(i,e,r,s,u,m,g){return md(Xl(i,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),m.angle,g),s)}isTileClipped(){return!0}},"fill-extrusion":class extends Vi{constructor(i){super(i,dy)}createBucket(i){return new Fh(i)}queryRadius(){return Wl(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(i,e,r,s,u,m,g,x){const b=Xl(i,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),m.angle,g),C=this.paint.get("fill-extrusion-height").evaluate(e,r),P=this.paint.get("fill-extrusion-base").evaluate(e,r),z=function(F,O,W,X){const oe=[];for(const le of F){const se=[le.x,le.y,0,1];Yl(se,se,O),oe.push(new Ye(se[0]/se[3],se[1]/se[3]))}return oe}(b,x),L=function(F,O,W,X){const oe=[],le=[],se=X[8]*O,me=X[9]*O,xe=X[10]*O,ye=X[11]*O,Ue=X[8]*W,qe=X[9]*W,ke=X[10]*W,Le=X[11]*W;for(const Ie of F){const Be=[],De=[];for(const Te of Ie){const Qe=Te.x,We=Te.y,gt=X[0]*Qe+X[4]*We+X[12],Ct=X[1]*Qe+X[5]*We+X[13],Nt=X[2]*Qe+X[6]*We+X[14],Vt=X[3]*Qe+X[7]*We+X[15],wi=Nt+xe,oi=Vt+ye,ai=gt+Ue,gi=Ct+qe,Si=Nt+ke,ki=Vt+Le,Ji=new Ye((gt+se)/oi,(Ct+me)/oi);Ji.z=wi/oi,Be.push(Ji);const si=new Ye(ai/ki,gi/ki);si.z=Si/ki,De.push(si)}oe.push(Be),le.push(De)}return[oe,le]}(s,P,C,x);return function(F,O,W){let X=1/0;md(W,O)&&(X=zd(W,O[0]));for(let oe=0;oe<O.length;oe++){const le=O[oe],se=F[oe];for(let me=0;me<le.length-1;me++){const xe=le[me],ye=[xe,le[me+1],se[me+1],se[me],xe];pd(W,ye)&&(X=Math.min(X,zd(W,ye)))}}return X!==1/0&&X}(L[0],L[1],z)}},line:class extends Vi{constructor(i){super(i,Ld),this.gradientVersion=0}_handleSpecialPaintPropertyUpdate(i){i==="line-gradient"&&(this.stepInterpolant=this._transitionablePaint._values["line-gradient"].value.expression._styleExpression.expression instanceof xo,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"]=Dd.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,i)}createBucket(i){return new Bh(i)}queryRadius(i){const e=i,r=Rd(ks("line-width",this,e),ks("line-gap-width",this,e)),s=ks("line-offset",this,e);return r/2+Math.abs(s)+Wl(this.paint.get("line-translate"))}queryIntersectsFeature(i,e,r,s,u,m,g){const x=Xl(i,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),m.angle,g),b=g/2*Rd(this.paint.get("line-width").evaluate(e,r),this.paint.get("line-gap-width").evaluate(e,r)),C=this.paint.get("line-offset").evaluate(e,r);return C&&(s=function(P,z){const L=[];for(let F=0;F<P.length;F++){const O=P[F],W=[];for(let X=0;X<O.length;X++){const oe=O[X-1],le=O[X],se=O[X+1],me=X===0?new Ye(0,0):le.sub(oe)._unit()._perp(),xe=X===O.length-1?new Ye(0,0):se.sub(le)._unit()._perp(),ye=me._add(xe)._unit(),Ue=ye.x*xe.x+ye.y*xe.y;Ue!==0&&ye._mult(1/Ue),W.push(ye._mult(z)._add(le))}L.push(W)}return L}(s,C*g)),function(P,z,L){for(let F=0;F<z.length;F++){const O=z[F];if(P.length>=3){for(let W=0;W<O.length;W++)if(Ia(P,O[W]))return!0}if(Mg(P,O,L))return!0}return!1}(x,s,b)}isTileClipped(){return!0}},symbol:hc,background:class extends Vi{constructor(i){super(i,Qy)}},raster:class extends Vi{constructor(i){super(i,e_)}}};class r_{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 cp=63710088e-1;class Kt{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 Kt(we(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,s=this.lat*r,u=e.lat*r,m=Math.sin(s)*Math.sin(u)+Math.cos(s)*Math.cos(u)*Math.cos((e.lng-this.lng)*r);return cp*Math.acos(Math.min(m,1))}toBounds(e=0){const r=360*e/40075017,s=r/Math.cos(Math.PI/180*this.lat);return new Oo(new Kt(this.lng-s,this.lat-r),new Kt(this.lng+s,this.lat+r))}static convert(e){if(e instanceof Kt)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new Kt(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new Kt(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 Oo{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 Kt?new Kt(e.lng,e.lat):Kt.convert(e),this}setSouthWest(e){return this._sw=e instanceof Kt?new Kt(e.lng,e.lat):Kt.convert(e),this}extend(e){const r=this._sw,s=this._ne;let u,m;if(e instanceof Kt)u=e,m=e;else{if(!(e instanceof Oo))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(Oo.convert(e)):this.extend(Kt.convert(e)):this;if(u=e._sw,m=e._ne,!u||!m)return this}return r||s?(r.lng=Math.min(u.lng,r.lng),r.lat=Math.min(u.lat,r.lat),s.lng=Math.max(m.lng,s.lng),s.lat=Math.max(m.lat,s.lat)):(this._sw=new Kt(u.lng,u.lat),this._ne=new Kt(m.lng,m.lat)),this}getCenter(){return new Kt((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 Kt(this.getWest(),this.getNorth())}getSouthEast(){return new Kt(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:s}=Kt.convert(e);let u=this._sw.lng<=r&&r<=this._ne.lng;return this._sw.lng>this._ne.lng&&(u=this._sw.lng>=r&&r>=this._ne.lng),this._sw.lat<=s&&s<=this._ne.lat&&u}static convert(e){return e instanceof Oo?e:e&&new Oo(e)}}const hp=2*Math.PI*cp;function up(i){return hp*Math.cos(i*Math.PI/180)}function dp(i){return(180+i)/360}function pp(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function mp(i,e){return i/up(e)}function Yh(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}class uc{constructor(e,r,s=0){this.x=+e,this.y=+r,this.z=+s}static fromLngLat(e,r=0){const s=Kt.convert(e);return new uc(dp(s.lng),pp(s.lat),mp(r,s.lat))}toLngLat(){return new Kt(360*this.x-180,Yh(this.y))}toAltitude(){return this.z*up(Yh(this.y))}meterInMercatorCoordinateUnits(){return 1/hp*(e=Yh(this.y),1/Math.cos(e*Math.PI/180));var e}}function fp(i,e,r){var s=2*Math.PI*6378137/256/Math.pow(2,r);return[i*s-2*Math.PI*6378137/2,e*s-2*Math.PI*6378137/2]}class Kh{constructor(e,r,s){this.z=e,this.x=r,this.y=s,this.key=Gs(0,e,e,r,s)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,r,s){const u=(g=this.y,x=this.z,b=fp(256*(m=this.x),256*(g=Math.pow(2,x)-g-1),x),C=fp(256*(m+1),256*(g+1),x),b[0]+","+b[1]+","+C[0]+","+C[1]);var m,g,x,b,C;const P=function(z,L,F){let O,W="";for(let X=z;X>0;X--)O=1<<X-1,W+=(L&O?1:0)+(F&O?2:0);return W}(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(s==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,r>1?"@2x":"").replace(/{quadkey}/g,P).replace(/{bbox-epsg-3857}/g,u)}getTilePoint(e){const r=Math.pow(2,this.z);return new Ye((e.x*r-this.x)*ui,(e.y*r-this.y)*ui)}toString(){return`${this.z}/${this.x}/${this.y}`}}class gp{constructor(e,r){this.wrap=e,this.canonical=r,this.key=Gs(e,r.z,r.z,r.x,r.y)}}class Lr{constructor(e,r,s,u,m){this.overscaledZ=e,this.wrap=r,this.canonical=new Kh(s,+u,+m),this.key=Gs(r,e,s,u,m)}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 Lr(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Lr(e,this.wrap,e,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(e,r){const s=this.canonical.z-e;return e>this.canonical.z?Gs(this.wrap*+r,e,this.canonical.z,this.canonical.x,this.canonical.y):Gs(this.wrap*+r,e,e,this.canonical.x>>s,this.canonical.y>>s)}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 Lr(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const r=this.canonical.z+1,s=2*this.canonical.x,u=2*this.canonical.y;return[new Lr(r,this.wrap,r,s,u),new Lr(r,this.wrap,r,s+1,u),new Lr(r,this.wrap,r,s,u+1),new Lr(r,this.wrap,r,s+1,u+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 Lr(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new Lr(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 gp(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new uc(e.x-this.wrap,e.y))}}function Gs(i,e,r,s,u){(i*=2)<0&&(i=-1*i-1);const m=1<<r;return(m*m*i+m*u+s).toString(36)+r.toString(36)+e.toString(36)}Oe("CanonicalTileID",Kh),Oe("OverscaledTileID",Lr,{omit:["posMatrix"]});class yp{constructor(e,r,s){if(this.uid=e,r.height!==r.width)throw new RangeError("DEM tiles must be square");if(s&&s!=="mapbox"&&s!=="terrarium")return void rt(`"${s}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=r.height;const u=this.dim=r.height-2;this.data=new Uint32Array(r.data.buffer),this.encoding=s||"mapbox";for(let m=0;m<u;m++)this.data[this._idx(-1,m)]=this.data[this._idx(0,m)],this.data[this._idx(u,m)]=this.data[this._idx(u-1,m)],this.data[this._idx(m,-1)]=this.data[this._idx(m,0)],this.data[this._idx(m,u)]=this.data[this._idx(m,u-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(u,-1)]=this.data[this._idx(u-1,0)],this.data[this._idx(-1,u)]=this.data[this._idx(0,u-1)],this.data[this._idx(u,u)]=this.data[this._idx(u-1,u-1)]}get(e,r){const s=new Uint8Array(this.data.buffer),u=4*this._idx(e,r);return(this.encoding==="terrarium"?this._unpackTerrarium:this._unpackMapbox)(s[u],s[u+1],s[u+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,s){return(256*e*256+256*r+s)/10-1e4}_unpackTerrarium(e,r,s){return 256*e+r+s/256-32768}getPixels(){return new br({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,r,s){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let u=r*this.dim,m=r*this.dim+this.dim,g=s*this.dim,x=s*this.dim+this.dim;switch(r){case-1:u=m-1;break;case 1:m=u+1}switch(s){case-1:g=x-1;break;case 1:x=g+1}const b=-r*this.dim,C=-s*this.dim;for(let P=g;P<x;P++)for(let z=u;z<m;z++)this.data[this._idx(z,P)]=e.data[this._idx(z+b,P+C)]}}Oe("DEMData",yp);class _p{constructor(e){this._stringToNumber={},this._numberToString=[];for(let r=0;r<e.length;r++){const s=e[r];this._stringToNumber[s]=r,this._numberToString[r]=s}}encode(e){return this._stringToNumber[e]}decode(e){return this._numberToString[e]}}class xp{constructor(e,r,s,u,m){this.type="Feature",this._vectorTileFeature=e,e._z=r,e._x=s,e._y=u,this.properties=e.properties,this.id=m}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 vp{constructor(e,r){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new Cn(ui,16,0),this.grid3D=new Cn(ui,16,0),this.featureIndexArray=new _t,this.promoteId=r}insert(e,r,s,u,m,g){const x=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(s,u,m);const b=g?this.grid3D:this.grid;for(let C=0;C<r.length;C++){const P=r[C],z=[1/0,1/0,-1/0,-1/0];for(let L=0;L<P.length;L++){const F=P[L];z[0]=Math.min(z[0],F.x),z[1]=Math.min(z[1],F.y),z[2]=Math.max(z[2],F.x),z[3]=Math.max(z[3],F.y)}z[0]<ui&&z[1]<ui&&z[2]>=0&&z[3]>=0&&b.insert(x,z[0],z[1],z[2],z[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new oo.VectorTile(new Oh(this.rawTileData)).layers,this.sourceLayerCoder=new _p(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,r,s,u){this.loadVTLayers();const m=e.params||{},g=ui/e.tileSize/e.scale,x=pa(m.filter),b=e.queryGeometry,C=e.queryPadding*g,P=wp(b),z=this.grid.query(P.minX-C,P.minY-C,P.maxX+C,P.maxY+C),L=wp(e.cameraQueryGeometry),F=this.grid3D.query(L.minX-C,L.minY-C,L.maxX+C,L.maxY+C,(X,oe,le,se)=>function(me,xe,ye,Ue,qe){for(const Le of me)if(xe<=Le.x&&ye<=Le.y&&Ue>=Le.x&&qe>=Le.y)return!0;const ke=[new Ye(xe,ye),new Ye(xe,qe),new Ye(Ue,qe),new Ye(Ue,ye)];if(me.length>2){for(const Le of ke)if(Ia(me,Le))return!0}for(let Le=0;Le<me.length-1;Le++)if(kg(me[Le],me[Le+1],ke))return!0;return!1}(e.cameraQueryGeometry,X-C,oe-C,le+C,se+C));for(const X of F)z.push(X);z.sort(n_);const O={};let W;for(let X=0;X<z.length;X++){const oe=z[X];if(oe===W)continue;W=oe;const le=this.featureIndexArray.get(oe);let se=null;this.loadMatchingFeature(O,le.bucketIndex,le.sourceLayerIndex,le.featureIndex,x,m.layers,m.availableImages,r,s,u,(me,xe,ye)=>(se||(se=Fo(me)),xe.queryIntersectsFeature(b,me,ye,se,this.z,e.transform,g,e.pixelPosMatrix)))}return O}loadMatchingFeature(e,r,s,u,m,g,x,b,C,P,z){const L=this.bucketLayerIDs[r];if(g&&!function(X,oe){for(let le=0;le<X.length;le++)if(oe.indexOf(X[le])>=0)return!0;return!1}(g,L))return;const F=this.sourceLayerCoder.decode(s),O=this.vtLayers[F].feature(u);if(m.needGeometry){const X=Bo(O,!0);if(!m.filter(new Ut(this.tileID.overscaledZ),X,this.tileID.canonical))return}else if(!m.filter(new Ut(this.tileID.overscaledZ),O))return;const W=this.getId(O,F);for(let X=0;X<L.length;X++){const oe=L[X];if(g&&g.indexOf(oe)<0)continue;const le=b[oe];if(!le)continue;let se={};W&&P&&(se=P.getState(le.sourceLayer||"_geojsonTileLayer",W));const me=be({},C[oe]);me.paint=bp(me.paint,le.paint,O,se,x),me.layout=bp(me.layout,le.layout,O,se,x);const xe=!z||z(O,le,se);if(!xe)continue;const ye=new xp(O,this.z,this.x,this.y,W);ye.layer=me;let Ue=e[oe];Ue===void 0&&(Ue=e[oe]=[]),Ue.push({featureIndex:u,feature:ye,intersectionZ:xe})}}lookupSymbolFeatures(e,r,s,u,m,g,x,b){const C={};this.loadVTLayers();const P=pa(m);for(const z of e)this.loadMatchingFeature(C,s,u,z,P,g,x,b,r);return C}hasLayer(e){for(const r of this.bucketLayerIDs)for(const s of r)if(e===s)return!0;return!1}getId(e,r){let s=e.id;return this.promoteId&&(s=e.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[r]],typeof s=="boolean"&&(s=Number(s))),s}}function bp(i,e,r,s,u){return $e(i,(m,g)=>{const x=e instanceof ba?e.get(g):null;return x&&x.evaluate?x.evaluate(r,s,u):x})}function wp(i){let e=1/0,r=1/0,s=-1/0,u=-1/0;for(const m of i)e=Math.min(e,m.x),r=Math.min(r,m.y),s=Math.max(s,m.x),u=Math.max(u,m.y);return{minX:e,minY:r,maxX:s,maxY:u}}function n_(i,e){return e-i}var Jh;Oe("FeatureIndex",vp,{omit:["rawTileData","sourceLayerCoder"]}),l.PerformanceMarkers=void 0,(Jh=l.PerformanceMarkers||(l.PerformanceMarkers={})).create="create",Jh.load="load",Jh.fullLoad="fullLoad";let dc=null,Zs=[];const Qh=1e3/30,o_={mark(i){performance.mark(i)},frame(i){const e=i;dc!=null&&Zs.push(e-dc),dc=e},clearMetrics(){dc=null,Zs=[],performance.clearMeasures("loadTime"),performance.clearMeasures("fullLoadTime");for(const i in l.PerformanceMarkers)performance.clearMarks(l.PerformanceMarkers[i])},getPerformanceMetrics(){performance.measure("loadTime",l.PerformanceMarkers.create,l.PerformanceMarkers.load),performance.measure("fullLoadTime",l.PerformanceMarkers.create,l.PerformanceMarkers.fullLoad);const i=performance.getEntriesByName("loadTime")[0].duration,e=performance.getEntriesByName("fullLoadTime")[0].duration,r=Zs.length,s=1/(Zs.reduce((m,g)=>m+g,0)/r/1e3),u=Zs.filter(m=>m>Qh).reduce((m,g)=>m+(g-Qh)/Qh,0);return{loadTime:i,fullLoadTime:e,fps:s,percentDroppedFrames:u/(r+u)*100}}};l.AJAXError=mi,l.ARRAY_TYPE=Ea,l.Actor=class{constructor(i,e,r){this.target=i,this.parent=e,this.mapId=r,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},Fe(["receive","process"],this),this.invoker=new r_(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=At()?i:window}send(i,e,r,s,u=!1){const m=Math.round(1e18*Math.random()).toString(36).substring(0,10);r&&(this.callbacks[m]=r);const g=Bt(this.globalScope)?void 0:[];return this.target.postMessage({id:m,type:i,hasCallback:!!r,targetMapId:s,mustQueue:u,sourceMapId:this.mapId,data:Ao(e,g)},g),{cancel:()=>{r&&delete this.callbacks[m],this.target.postMessage({id:m,type:"<cancel>",targetMapId:s,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 s=this.cancelCallbacks[r];delete this.cancelCallbacks[r],s&&s()}else At()||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(In(e.error)):r(null,In(e.data)))}else{let r=!1;const s=Bt(this.globalScope)?void 0:[],u=e.hasCallback?(x,b)=>{r=!0,delete this.cancelCallbacks[i],this.target.postMessage({id:i,type:"<response>",sourceMapId:this.mapId,error:x?Ao(x):null,data:Ao(b,s)},s)}:x=>{r=!0};let m=null;const g=In(e.data);if(this.parent[e.type])m=this.parent[e.type](e.sourceMapId,g,u);else if(this.parent.getWorkerSource){const x=e.type.split(".");m=this.parent.getWorkerSource(e.sourceMapId,x[0],g.source)[x[1]](g,u)}else u(new Error(`Could not find function ${e.type}`));!r&&m&&m.cancel&&(this.cancelCallbacks[i]=m.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}},l.AlphaImage=Ds,l.CanonicalTileID=Kh,l.CollisionBoxArray=he,l.CollisionCircleLayoutArray=class extends A{},l.Color=M,l.DEMData=yp,l.DataConstantProperty=He,l.DictionaryCoder=_p,l.EXTENT=ui,l.ErrorEvent=fn,l.EvaluationParameters=Ut,l.Event=rn,l.Evented=fo,l.FeatureIndex=vp,l.FillBucket=Dh,l.FillExtrusionBucket=Fh,l.GeoJSONFeature=xp,l.ImageAtlas=Zd,l.ImagePosition=$h,l.LineBucket=Bh,l.LineStripIndexArray=class extends ae{},l.LngLat=Kt,l.LngLatBounds=Oo,l.MercatorCoordinate=uc,l.ONE_EM=vi,l.OverscaledTileID=Lr,l.PerformanceUtils=o_,l.PosArray=class extends to{},l.Properties=ci,l.QuadTriangleArray=class extends R{},l.RGBAImage=br,l.RasterBoundsArray=class extends Do{},l.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}},l.ResourceType=qo,l.SegmentVector=wt,l.SymbolBucket=Da,l.Transitionable=As,l.TriangleIndexArray=Gi,l.Uniform1f=io,l.Uniform1i=class extends kr{constructor(i,e){super(i,e),this.current=0}set(i){this.current!==i&&(this.current=i,this.gl.uniform1i(this.location,i))}},l.Uniform2f=class extends kr{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]))}},l.Uniform3f=class extends kr{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]))}},l.Uniform4f=ld,l.UniformColor=cd,l.UniformMatrix4f=class extends kr{constructor(i,e){super(i,e),this.current=Eg}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}}},l.UnwrappedTileID=gp,l.ValidationError=Me,l.ZoomHistory=Po,l.addDynamicAttributes=Hh,l.asyncAll=function(i,e,r){if(!i.length)return r(null,[]);let s=i.length;const u=new Array(i.length);let m=null;i.forEach((g,x)=>{e(g,(b,C)=>{b&&(m=b),u[x]=C,--s==0&&r(m,u)})})},l.bezier=J,l.bindAll=Fe,l.cacheEntryPossiblyAdded=function(i){dn++,dn>$r&&(i.getActor().send("enforceCacheSizeLimit",un),dn=0)},l.clamp=Z,l.clearTileCache=function(i){const e=caches.delete(rr);i&&e.catch(i).then(()=>i())},l.clipLine=ip,l.clone=function(i){var e=new Ea(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},l.clone$1=Ge,l.collisionCircleLayout=Sy,l.config=qi,l.create=function(){var i=new Ea(16);return Ea!=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},l.createExpression=la,l.createFilter=pa,l.createLayout=hi,l.createStyleLayer=function(i){return i.type==="custom"?new t_(i):new i_[i.type](i)},l.dot=function(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]+i[3]*e[3]},l.ease=K,l.emitValidationErrors=Ol,l.enforceCacheSizeLimit=function(i){en(),mr&&mr.then(e=>{e.keys().then(r=>{for(let s=0;s<r.length-i;s++)e.delete(r[s])})})},l.evaluateSizeForFeature=function(i,{uSize:e,uSizeT:r},{lowerSize:s,upperSize:u}){return i.kind==="source"?s/Ln:i.kind==="composite"?ri(s/Ln,u/Ln,r):e},l.evaluateSizeForZoom=function(i,e){let r=0,s=0;if(i.kind==="constant")s=i.layoutSize;else if(i.kind!=="source"){const{interpolationType:u,minZoom:m,maxZoom:g}=i,x=u?Z(Wi.interpolationFactor(u,e,m,g),0,1):0;i.kind==="camera"?s=ri(i.minSize,i.maxSize,x):r=x}return{uSizeT:r,uSize:s}},l.evaluateVariableOffset=op,l.evented=eo,l.exported=Ui,l.exported$1=fr,l.extend=be,l.filterObject=Ve,l.getAnchorAlignment=Vh,l.getAnchorJustification=Zh,l.getArrayBuffer=Ir,l.getImage=mo,l.getJSON=function(i,e){return pn(be(i,{type:"json"}),e)},l.getOverlapMode=Xh,l.getRTLTextPluginStatus=Es,l.getReferrer=tn,l.getVideo=function(i,e){const r=window.document.createElement("video");r.muted=!0,r.onloadstart=function(){e(null,r)};for(let s=0;s<i.length;s++){const u=window.document.createElement("source");Wo(i[s])||(r.crossOrigin="Anonymous"),u.src=i[s],r.appendChild(u)}return{cancel:()=>{}}},l.identity=Th,l.invert=function(i,e){var r=e[0],s=e[1],u=e[2],m=e[3],g=e[4],x=e[5],b=e[6],C=e[7],P=e[8],z=e[9],L=e[10],F=e[11],O=e[12],W=e[13],X=e[14],oe=e[15],le=r*x-s*g,se=r*b-u*g,me=r*C-m*g,xe=s*b-u*x,ye=s*C-m*x,Ue=u*C-m*b,qe=P*W-z*O,ke=P*X-L*O,Le=P*oe-F*O,Ie=z*X-L*W,Be=z*oe-F*W,De=L*oe-F*X,Te=le*De-se*Be+me*Ie+xe*Le-ye*ke+Ue*qe;return Te?(i[0]=(x*De-b*Be+C*Ie)*(Te=1/Te),i[1]=(u*Be-s*De-m*Ie)*Te,i[2]=(W*Ue-X*ye+oe*xe)*Te,i[3]=(L*ye-z*Ue-F*xe)*Te,i[4]=(b*Le-g*De-C*ke)*Te,i[5]=(r*De-u*Le+m*ke)*Te,i[6]=(X*me-O*Ue-oe*se)*Te,i[7]=(P*Ue-L*me+F*se)*Te,i[8]=(g*Be-x*Le+C*qe)*Te,i[9]=(s*Le-r*Be-m*qe)*Te,i[10]=(O*ye-W*me+oe*le)*Te,i[11]=(z*me-P*ye-F*le)*Te,i[12]=(x*ke-g*Ie-b*qe)*Te,i[13]=(r*Ie-s*ke+u*qe)*Te,i[14]=(W*se-O*xe-X*le)*Te,i[15]=(P*xe-z*se+L*le)*Te,i):null},l.isImageBitmap=Ht,l.isSafari=Bt,l.keysDifference=function(i,e){const r=[];for(const s in i)s in e||r.push(s);return r},l.lazyLoadRTLTextPlugin=function(){ar.isLoading()||ar.isLoaded()||Es()!=="deferred"||_a()},l.makeRequest=pn,l.mapObject=$e,l.mercatorXfromLng=dp,l.mercatorYfromLat=pp,l.mercatorZfromAltitude=mp,l.mul=Rg,l.multiply=yd,l.nextPowerOfTwo=function(i){return i<=1?1:Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))},l.number=ri,l.ortho=function(i,e,r,s,u,m,g){var x=1/(e-r),b=1/(s-u),C=1/(m-g);return i[0]=-2*x,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=-2*b,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=2*C,i[11]=0,i[12]=(e+r)*x,i[13]=(u+s)*b,i[14]=(g+m)*C,i[15]=1,i},l.parseCacheControl=pi,l.parseGlyphPBF=function(i){return new Oh(i).readFields(Dy,[])},l.pbf=Oh,l.performSymbolLayout=function(i,e,r,s,u,m,g){i.createArrays(),i.tilePixelRatio=ui/(512*i.overscaling),i.compareText={},i.iconsNeedLinear=!1;const x=i.layers[0].layout,b=i.layers[0]._unevaluatedLayout._values,C={layoutIconSize:b["icon-size"].possiblyEvaluate(new Ut(i.zoom+1),g),layoutTextSize:b["text-size"].possiblyEvaluate(new Ut(i.zoom+1),g),textMaxSize:b["text-size"].possiblyEvaluate(new Ut(18))};if(i.textSizeData.kind==="composite"){const{minZoom:O,maxZoom:W}=i.textSizeData;C.compositeTextSizes=[b["text-size"].possiblyEvaluate(new Ut(O),g),b["text-size"].possiblyEvaluate(new Ut(W),g)]}if(i.iconSizeData.kind==="composite"){const{minZoom:O,maxZoom:W}=i.iconSizeData;C.compositeIconSizes=[b["icon-size"].possiblyEvaluate(new Ut(O),g),b["icon-size"].possiblyEvaluate(new Ut(W),g)]}const P=x.get("text-line-height")*vi,z=x.get("text-rotation-alignment")!=="viewport"&&x.get("symbol-placement")!=="point",L=x.get("text-keep-upright"),F=x.get("text-size");for(const O of i.features){const W=x.get("text-font").evaluate(O,{},g).join(","),X=F.evaluate(O,{},g),oe=C.layoutTextSize.evaluate(O,{},g),le=C.layoutIconSize.evaluate(O,{},g),se={horizontal:{},vertical:void 0},me=O.text;let xe,ye=[0,0];if(me){const ke=me.toString(),Le=x.get("text-letter-spacing").evaluate(O,{},g)*vi,Ie=Ul(ke)?Le:0,Be=x.get("text-anchor").evaluate(O,{},g),De=x.get("text-variable-anchor");if(!De){const Ct=x.get("text-radial-offset").evaluate(O,{},g);ye=Ct?op(Be,[Ct*vi,Gh]):x.get("text-offset").evaluate(O,{},g).map(Nt=>Nt*vi)}let Te=z?"center":x.get("text-justify").evaluate(O,{},g);const Qe=x.get("symbol-placement"),We=Qe==="point"?x.get("text-max-width").evaluate(O,{},g)*vi:0,gt=()=>{i.allowVerticalPlacement&&ws(ke)&&(se.vertical=rc(me,e,r,u,W,We,P,Be,"left",Ie,ye,l.WritingMode.vertical,!0,Qe,oe,X))};if(!z&&De){const Ct=Te==="auto"?De.map(Vt=>Zh(Vt)):[Te];let Nt=!1;for(let Vt=0;Vt<Ct.length;Vt++){const wi=Ct[Vt];if(!se.horizontal[wi])if(Nt)se.horizontal[wi]=se.horizontal[0];else{const oi=rc(me,e,r,u,W,We,P,"center",wi,Ie,ye,l.WritingMode.horizontal,!1,Qe,oe,X);oi&&(se.horizontal[wi]=oi,Nt=oi.positionedLines.length===1)}}gt()}else{Te==="auto"&&(Te=Zh(Be));const Ct=rc(me,e,r,u,W,We,P,Be,Te,Ie,ye,l.WritingMode.horizontal,!1,Qe,oe,X);Ct&&(se.horizontal[Te]=Ct),gt(),ws(ke)&&z&&L&&(se.vertical=rc(me,e,r,u,W,We,P,Be,Te,Ie,ye,l.WritingMode.vertical,!1,Qe,oe,X))}}let Ue=!1;if(O.icon&&O.icon.name){const ke=s[O.icon.name];ke&&(xe=$y(u[O.icon.name],x.get("icon-offset").evaluate(O,{},g),x.get("icon-anchor").evaluate(O,{},g)),Ue=!!ke.sdf,i.sdfIcons===void 0?i.sdfIcons=Ue:i.sdfIcons!==Ue&&rt("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(ke.pixelRatio!==i.pixelRatio||x.get("icon-rotate").constantOr(1)!==0)&&(i.iconsNeedLinear=!0))}const qe=sp(se.horizontal)||se.vertical;i.iconsInText=!!qe&&qe.iconsInText,(qe||xe)&&qy(i,O,se,xe,s,C,oe,le,ye,Ue,g)}m&&i.generateCollisionDebugBuffers()},l.perspective=function(i,e,r,s,u){var m,g=1/Math.tan(e/2);return i[0]=g/r,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=g,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=-1,i[12]=0,i[13]=0,i[15]=0,u!=null&&u!==1/0?(i[10]=(u+s)*(m=1/(s-u)),i[14]=2*u*s*m):(i[10]=-1,i[14]=-2*s),i},l.pick=function(i,e){const r={};for(let s=0;s<e.length;s++){const u=e[s];u in i&&(r[u]=i[u])}return r},l.plugin=ar,l.pointGeometry=Ye,l.polygonIntersectsPolygon=pd,l.potpack=Gd,l.refProperties=["type","source","source-layer","minzoom","maxzoom","filter","layout"],l.register=Oe,l.registerForPluginStateChange=function(i){return i({pluginStatus:Ni,pluginURL:nn}),eo.on("pluginStateChange",i),i},l.renderColorRamp=bd,l.rotateX=function(i,e,r){var s=Math.sin(r),u=Math.cos(r),m=e[4],g=e[5],x=e[6],b=e[7],C=e[8],P=e[9],z=e[10],L=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]=m*u+C*s,i[5]=g*u+P*s,i[6]=x*u+z*s,i[7]=b*u+L*s,i[8]=C*u-m*s,i[9]=P*u-g*s,i[10]=z*u-x*s,i[11]=L*u-b*s,i},l.rotateZ=function(i,e,r){var s=Math.sin(r),u=Math.cos(r),m=e[0],g=e[1],x=e[2],b=e[3],C=e[4],P=e[5],z=e[6],L=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]=m*u+C*s,i[1]=g*u+P*s,i[2]=x*u+z*s,i[3]=b*u+L*s,i[4]=C*u-m*s,i[5]=P*u-g*s,i[6]=z*u-x*s,i[7]=L*u-b*s,i},l.scale=function(i,e,r){var s=r[0],u=r[1],m=r[2];return i[0]=e[0]*s,i[1]=e[1]*s,i[2]=e[2]*s,i[3]=e[3]*s,i[4]=e[4]*u,i[5]=e[5]*u,i[6]=e[6]*u,i[7]=e[7]*u,i[8]=e[8]*m,i[9]=e[9]*m,i[10]=e[10]*m,i[11]=e[11]*m,i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i},l.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},l.setCacheLimits=function(i,e){un=i,$r=e},l.setRTLTextPlugin=function(i,e,r=!1){if(Ni===ya||Ni===Ss||Ni===Ts)throw new Error("setRTLTextPlugin cannot be called multiple times.");nn=Ui.resolveURL(i),Ni=ya,Cs=e,Is(),r||_a()},l.spec=pe,l.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)}},l.toEvaluationFeature=Bo,l.transformMat4=Yl,l.translate=function(i,e,r){var s,u,m,g,x,b,C,P,z,L,F,O,W=r[0],X=r[1],oe=r[2];return e===i?(i[12]=e[0]*W+e[4]*X+e[8]*oe+e[12],i[13]=e[1]*W+e[5]*X+e[9]*oe+e[13],i[14]=e[2]*W+e[6]*X+e[10]*oe+e[14],i[15]=e[3]*W+e[7]*X+e[11]*oe+e[15]):(u=e[1],m=e[2],g=e[3],x=e[4],b=e[5],C=e[6],P=e[7],z=e[8],L=e[9],F=e[10],O=e[11],i[0]=s=e[0],i[1]=u,i[2]=m,i[3]=g,i[4]=x,i[5]=b,i[6]=C,i[7]=P,i[8]=z,i[9]=L,i[10]=F,i[11]=O,i[12]=s*W+x*X+z*oe+e[12],i[13]=u*W+b*X+L*oe+e[13],i[14]=m*W+C*X+F*oe+e[14],i[15]=g*W+P*X+O*oe+e[15]),i},l.triggerPluginCompletionEvent=Vl,l.unicodeBlockLookup=Pe,l.uniqueId=function(){return Ae++},l.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},l.validateLight=dh,l.validateStyle=Tn,l.vectorTile=oo,l.warnOnce=rt,l.wrap=we}),w(["./shared"],function(l){function D(V){const E=typeof V;if(E==="number"||E==="boolean"||E==="string"||V==null)return JSON.stringify(V);if(Array.isArray(V)){let G="[";for(const H of V)G+=`${D(H)},`;return`${G}]`}const M=Object.keys(V).sort();let U="{";for(let G=0;G<M.length;G++)U+=`${JSON.stringify(M[G])}:${D(V[M[G]])},`;return`${U}}`}function B(V){let E="";for(const M of l.refProperties)E+=`/${D(V[M])}`;return E}class J{constructor(E){this.keyCache={},E&&this.replace(E)}replace(E){this._layerConfigs={},this._layers={},this.update(E,[])}update(E,M){for(const G of E){this._layerConfigs[G.id]=G;const H=this._layers[G.id]=l.createStyleLayer(G);H._featureFilter=l.createFilter(H.filter),this.keyCache[G.id]&&delete this.keyCache[G.id]}for(const G of M)delete this.keyCache[G],delete this._layerConfigs[G],delete this._layers[G];this.familiesBySource={};const U=function(G,H){const ee={};for(let Q=0;Q<G.length;Q++){const te=H&&H[G[Q].id]||B(G[Q]);H&&(H[G[Q].id]=te);let ue=ee[te];ue||(ue=ee[te]=[]),ue.push(G[Q])}const Y=[];for(const Q in ee)Y.push(ee[Q]);return Y}(Object.values(this._layerConfigs),this.keyCache);for(const G of U){const H=G.map(_e=>this._layers[_e.id]),ee=H[0];if(ee.visibility==="none")continue;const Y=ee.source||"";let Q=this.familiesBySource[Y];Q||(Q=this.familiesBySource[Y]={});const te=ee.sourceLayer||"_geojsonTileLayer";let ue=Q[te];ue||(ue=Q[te]=[]),ue.push(H)}}}class K{constructor(E){const M={},U=[];for(const Y in E){const Q=E[Y],te=M[Y]={};for(const ue in Q){const _e=Q[+ue];if(!_e||_e.bitmap.width===0||_e.bitmap.height===0)continue;const ce={x:0,y:0,w:_e.bitmap.width+2,h:_e.bitmap.height+2};U.push(ce),te[ue]={rect:ce,metrics:_e.metrics}}}const{w:G,h:H}=l.potpack(U),ee=new l.AlphaImage({width:G||1,height:H||1});for(const Y in E){const Q=E[Y];for(const te in Q){const ue=Q[+te];if(!ue||ue.bitmap.width===0||ue.bitmap.height===0)continue;const _e=M[Y][te].rect;l.AlphaImage.copy(ue.bitmap,ee,{x:0,y:0},{x:_e.x+1,y:_e.y+1},ue.bitmap)}}this.image=ee,this.positions=M}}l.register("GlyphAtlas",K);class Z{constructor(E){this.tileID=new l.OverscaledTileID(E.tileID.overscaledZ,E.tileID.wrap,E.tileID.canonical.z,E.tileID.canonical.x,E.tileID.canonical.y),this.uid=E.uid,this.zoom=E.zoom,this.pixelRatio=E.pixelRatio,this.tileSize=E.tileSize,this.source=E.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=E.showCollisionBoxes,this.collectResourceTiming=!!E.collectResourceTiming,this.returnDependencies=!!E.returnDependencies,this.promoteId=E.promoteId}parse(E,M,U,G,H){this.status="parsing",this.data=E,this.collisionBoxArray=new l.CollisionBoxArray;const ee=new l.DictionaryCoder(Object.keys(E.layers).sort()),Y=new l.FeatureIndex(this.tileID,this.promoteId);Y.bucketLayerIDs=[];const Q={},te={featureIndex:Y,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:U},ue=M.familiesBySource[this.source];for(const ut in ue){const st=E.layers[ut];if(!st)continue;st.version===1&&l.warnOnce(`Vector tile source "${this.source}" layer "${ut}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const nt=ee.encode(ut),Jt=[];for(let Xt=0;Xt<st.length;Xt++){const fi=st.feature(Xt),_i=Y.getId(fi,ut);Jt.push({feature:fi,id:_i,index:Xt,sourceLayerIndex:nt})}for(const Xt of ue[ut]){const fi=Xt[0];fi.minzoom&&this.zoom<Math.floor(fi.minzoom)||fi.maxzoom&&this.zoom>=fi.maxzoom||fi.visibility!=="none"&&(we(Xt,this.zoom,U),(Q[fi.id]=fi.createBucket({index:Y.bucketLayerIDs.length,layers:Xt,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:nt,sourceID:this.source})).populate(Jt,te,this.tileID.canonical),Y.bucketLayerIDs.push(Xt.map(_i=>_i.id)))}}let _e,ce,Ze,Re;const je=l.mapObject(te.glyphDependencies,ut=>Object.keys(ut).map(Number));Object.keys(je).length?G.send("getGlyphs",{uid:this.uid,stacks:je},(ut,st)=>{_e||(_e=ut,ce=st,mt.call(this))}):ce={};const Ke=Object.keys(te.iconDependencies);Ke.length?G.send("getImages",{icons:Ke,source:this.source,tileID:this.tileID,type:"icons"},(ut,st)=>{_e||(_e=ut,Ze=st,mt.call(this))}):Ze={};const vt=Object.keys(te.patternDependencies);function mt(){if(_e)return H(_e);if(ce&&Ze&&Re){const ut=new K(ce),st=new l.ImageAtlas(Ze,Re);for(const nt in Q){const Jt=Q[nt];Jt instanceof l.SymbolBucket?(we(Jt.layers,this.zoom,U),l.performSymbolLayout(Jt,ce,ut.positions,Ze,st.iconPositions,this.showCollisionBoxes,this.tileID.canonical)):Jt.hasPattern&&(Jt instanceof l.LineBucket||Jt instanceof l.FillBucket||Jt instanceof l.FillExtrusionBucket)&&(we(Jt.layers,this.zoom,U),Jt.addFeatures(te,this.tileID.canonical,st.patternPositions))}this.status="done",H(null,{buckets:Object.values(Q).filter(nt=>!nt.isEmpty()),featureIndex:Y,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:ut.image,imageAtlas:st,glyphMap:this.returnDependencies?ce:null,iconMap:this.returnDependencies?Ze:null,glyphPositions:this.returnDependencies?ut.positions:null})}}vt.length?G.send("getImages",{icons:vt,source:this.source,tileID:this.tileID,type:"patterns"},(ut,st)=>{_e||(_e=ut,Re=st,mt.call(this))}):Re={},mt.call(this)}}function we(V,E,M){const U=new l.EvaluationParameters(E);for(const G of V)G.recalculate(U,M)}function be(V,E){const M=l.getArrayBuffer(V.request,(U,G,H,ee)=>{U?E(U):G&&E(null,{vectorTile:new l.vectorTile.VectorTile(new l.pbf(G)),rawData:G,cacheControl:H,expires:ee})});return()=>{M.cancel(),E()}}class Ae{constructor(E,M,U,G){this.actor=E,this.layerIndex=M,this.availableImages=U,this.loadVectorData=G||be,this.loading={},this.loaded={}}loadTile(E,M){const U=E.uid;this.loading||(this.loading={});const G=!!(E&&E.request&&E.request.collectResourceTiming)&&new l.RequestPerformance(E.request),H=this.loading[U]=new Z(E);H.abort=this.loadVectorData(E,(ee,Y)=>{if(delete this.loading[U],ee||!Y)return H.status="done",this.loaded[U]=H,M(ee);const Q=Y.rawData,te={};Y.expires&&(te.expires=Y.expires),Y.cacheControl&&(te.cacheControl=Y.cacheControl);const ue={};if(G){const _e=G.finish();_e&&(ue.resourceTiming=JSON.parse(JSON.stringify(_e)))}H.vectorTile=Y.vectorTile,H.parse(Y.vectorTile,this.layerIndex,this.availableImages,this.actor,(_e,ce)=>{if(_e||!ce)return M(_e);M(null,l.extend({rawTileData:Q.slice(0)},ce,te,ue))}),this.loaded=this.loaded||{},this.loaded[U]=H})}reloadTile(E,M){const U=this.loaded,G=E.uid,H=this;if(U&&U[G]){const ee=U[G];ee.showCollisionBoxes=E.showCollisionBoxes;const Y=(Q,te)=>{const ue=ee.reloadCallback;ue&&(delete ee.reloadCallback,ee.parse(ee.vectorTile,H.layerIndex,this.availableImages,H.actor,ue)),M(Q,te)};ee.status==="parsing"?ee.reloadCallback=Y:ee.status==="done"&&(ee.vectorTile?ee.parse(ee.vectorTile,this.layerIndex,this.availableImages,this.actor,Y):Y())}}abortTile(E,M){const U=this.loading,G=E.uid;U&&U[G]&&U[G].abort&&(U[G].abort(),delete U[G]),M()}removeTile(E,M){const U=this.loaded,G=E.uid;U&&U[G]&&delete U[G],M()}}class Fe{constructor(){this.loaded={}}loadTile(E,M){const{uid:U,encoding:G,rawImageData:H}=E,ee=l.isImageBitmap(H)?this.getImageData(H):H,Y=new l.DEMData(U,ee,G);this.loaded=this.loaded||{},this.loaded[U]=Y,M(null,Y)}getImageData(E){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(E.width,E.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d")),this.offscreenCanvas.width=E.width,this.offscreenCanvas.height=E.height,this.offscreenCanvasContext.drawImage(E,0,0,E.width,E.height);const M=this.offscreenCanvasContext.getImageData(-1,-1,E.width+2,E.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new l.RGBAImage({width:M.width,height:M.height},M.data)}removeTile(E){const M=this.loaded,U=E.uid;M&&M[U]&&delete M[U]}}var $e=function V(E,M){var U,G=E&&E.type;if(G==="FeatureCollection")for(U=0;U<E.features.length;U++)V(E.features[U],M);else if(G==="GeometryCollection")for(U=0;U<E.geometries.length;U++)V(E.geometries[U],M);else if(G==="Feature")V(E.geometry,M);else if(G==="Polygon")Ve(E.coordinates,M);else if(G==="MultiPolygon")for(U=0;U<E.coordinates.length;U++)Ve(E.coordinates[U],M);return E};function Ve(V,E){if(V.length!==0){Ge(V[0],E);for(var M=1;M<V.length;M++)Ge(V[M],!E)}}function Ge(V,E){for(var M=0,U=0,G=0,H=V.length,ee=H-1;G<H;ee=G++){var Y=(V[G][0]-V[ee][0])*(V[ee][1]+V[G][1]),Q=M+Y;U+=Math.abs(M)>=Math.abs(Y)?M-Q+Y:Y-Q+M,M=Q}M+U>=0!=!!E&&V.reverse()}const lt=l.vectorTile.VectorTileFeature.prototype.toGeoJSON;class rt{constructor(E){this._feature=E,this.extent=l.EXTENT,this.type=E.type,this.properties=E.tags,"id"in E&&!isNaN(E.id)&&(this.id=parseInt(E.id,10))}loadGeometry(){if(this._feature.type===1){const E=[];for(const M of this._feature.geometry)E.push([new l.pointGeometry(M[0],M[1])]);return E}{const E=[];for(const M of this._feature.geometry){const U=[];for(const G of M)U.push(new l.pointGeometry(G[0],G[1]));E.push(U)}return E}}toGeoJSON(E,M,U){return lt.call(this,E,M,U)}}class Xe{constructor(E){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=l.EXTENT,this.length=E.length,this._features=E}feature(E){return new rt(this._features[E])}}var xt={exports:{}},At=l.pointGeometry,pi=l.vectorTile.VectorTileFeature,Bi=Oi;function Oi(V,E){this.options=E||{},this.features=V,this.length=V.length}function Wt(V,E){this.id=typeof V.id=="number"?V.id:void 0,this.type=V.type,this.rawGeometry=V.type===1?[V.geometry]:V.geometry,this.properties=V.tags,this.extent=E||4096}Oi.prototype.feature=function(V){return new Wt(this.features[V],this.options.extent)},Wt.prototype.loadGeometry=function(){var V=this.rawGeometry;this.geometry=[];for(var E=0;E<V.length;E++){for(var M=V[E],U=[],G=0;G<M.length;G++)U.push(new At(M[G][0],M[G][1]));this.geometry.push(U)}return this.geometry},Wt.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var V=this.geometry,E=1/0,M=-1/0,U=1/0,G=-1/0,H=0;H<V.length;H++)for(var ee=V[H],Y=0;Y<ee.length;Y++){var Q=ee[Y];E=Math.min(E,Q.x),M=Math.max(M,Q.x),U=Math.min(U,Q.y),G=Math.max(G,Q.y)}return[E,U,M,G]},Wt.prototype.toGeoJSON=pi.prototype.toGeoJSON;var Bt=l.pbf,Ht=Bi;function Ui(V){var E=new Bt;return function(M,U){for(var G in M.layers)U.writeMessage(3,Ye,M.layers[G])}(V,E),E.finish()}function Ye(V,E){var M;E.writeVarintField(15,V.version||1),E.writeStringField(1,V.name||""),E.writeVarintField(5,V.extent||4096);var U={keys:[],values:[],keycache:{},valuecache:{}};for(M=0;M<V.length;M++)U.feature=V.feature(M),E.writeMessage(2,pr,U);var G=U.keys;for(M=0;M<G.length;M++)E.writeStringField(3,G[M]);var H=U.values;for(M=0;M<H.length;M++)E.writeMessage(4,un,H[M])}function pr(V,E){var M=V.feature;M.id!==void 0&&E.writeVarintField(1,M.id),E.writeMessage(2,qi,V),E.writeVarintField(3,M.type),E.writeMessage(4,hn,M)}function qi(V,E){var M=V.feature,U=V.keys,G=V.values,H=V.keycache,ee=V.valuecache;for(var Y in M.properties){var Q=M.properties[Y],te=H[Y];if(Q!==null){te===void 0&&(U.push(Y),H[Y]=te=U.length-1),E.writeVarint(te);var ue=typeof Q;ue!=="string"&&ue!=="boolean"&&ue!=="number"&&(Q=JSON.stringify(Q));var _e=ue+":"+Q,ce=ee[_e];ce===void 0&&(G.push(Q),ee[_e]=ce=G.length-1),E.writeVarint(ce)}}}function rr(V,E){return(E<<3)+(7&V)}function mr(V){return V<<1^V>>31}function hn(V,E){for(var M=V.loadGeometry(),U=V.type,G=0,H=0,ee=M.length,Y=0;Y<ee;Y++){var Q=M[Y],te=1;U===1&&(te=Q.length),E.writeVarint(rr(1,te));for(var ue=U===3?Q.length-1:Q.length,_e=0;_e<ue;_e++){_e===1&&U!==1&&E.writeVarint(rr(2,ue-1));var ce=Q[_e].x-G,Ze=Q[_e].y-H;E.writeVarint(mr(ce)),E.writeVarint(mr(Ze)),G+=ce,H+=Ze}U===3&&E.writeVarint(rr(7,1))}}function un(V,E){var M=typeof V;M==="string"?E.writeStringField(1,V):M==="boolean"?E.writeBooleanField(7,V):M==="number"&&(V%1!=0?E.writeDoubleField(3,V):V<0?E.writeSVarintField(6,V):E.writeVarintField(5,V))}xt.exports=Ui,xt.exports.fromVectorTileJs=Ui,xt.exports.fromGeojsonVt=function(V,E){E=E||{};var M={};for(var U in V)M[U]=new Ht(V[U].features,E),M[U].name=U,M[U].version=E.version,M[U].extent=E.extent;return Ui({layers:M})},xt.exports.GeoJSONWrapper=Ht;var $r=xt.exports;function en(V,E,M,U,G,H){if(G-U<=M)return;const ee=U+G>>1;dn(V,E,ee,U,G,H%2),en(V,E,M,U,ee-1,H+1),en(V,E,M,ee+1,G,H+1)}function dn(V,E,M,U,G,H){for(;G>U;){if(G-U>600){const te=G-U+1,ue=M-U+1,_e=Math.log(te),ce=.5*Math.exp(2*_e/3),Ze=.5*Math.sqrt(_e*ce*(te-ce)/te)*(ue-te/2<0?-1:1);dn(V,E,M,Math.max(U,Math.floor(M-ue*ce/te+Ze)),Math.min(G,Math.floor(M+(te-ue)*ce/te+Ze)),H)}const ee=E[2*M+H];let Y=U,Q=G;for(fr(V,E,U,M),E[2*G+H]>ee&&fr(V,E,U,G);Y<Q;){for(fr(V,E,Y,Q),Y++,Q--;E[2*Y+H]<ee;)Y++;for(;E[2*Q+H]>ee;)Q--}E[2*U+H]===ee?fr(V,E,U,Q):(Q++,fr(V,E,Q,G)),Q<=M&&(U=Q+1),M<=Q&&(G=Q-1)}}function fr(V,E,M,U){Nr(V,M,U),Nr(E,2*M,2*U),Nr(E,2*M+1,2*U+1)}function Nr(V,E,M){const U=V[E];V[E]=V[M],V[M]=U}function Vr(V,E,M,U){const G=V-M,H=E-U;return G*G+H*H}const Nn=V=>V[0],jo=V=>V[1];class uo{constructor(E,M=Nn,U=jo,G=64,H=Float64Array){this.nodeSize=G,this.points=E;const ee=E.length<65536?Uint16Array:Uint32Array,Y=this.ids=new ee(E.length),Q=this.coords=new H(2*E.length);for(let te=0;te<E.length;te++)Y[te]=te,Q[2*te]=M(E[te]),Q[2*te+1]=U(E[te]);en(Y,Q,G,0,Y.length-1,0)}range(E,M,U,G){return function(H,ee,Y,Q,te,ue,_e){const ce=[0,H.length-1,0],Ze=[];let Re,je;for(;ce.length;){const Ke=ce.pop(),vt=ce.pop(),mt=ce.pop();if(vt-mt<=_e){for(let nt=mt;nt<=vt;nt++)Re=ee[2*nt],je=ee[2*nt+1],Re>=Y&&Re<=te&&je>=Q&&je<=ue&&Ze.push(H[nt]);continue}const ut=Math.floor((mt+vt)/2);Re=ee[2*ut],je=ee[2*ut+1],Re>=Y&&Re<=te&&je>=Q&&je<=ue&&Ze.push(H[ut]);const st=(Ke+1)%2;(Ke===0?Y<=Re:Q<=je)&&(ce.push(mt),ce.push(ut-1),ce.push(st)),(Ke===0?te>=Re:ue>=je)&&(ce.push(ut+1),ce.push(vt),ce.push(st))}return Ze}(this.ids,this.coords,E,M,U,G,this.nodeSize)}within(E,M,U){return function(G,H,ee,Y,Q,te){const ue=[0,G.length-1,0],_e=[],ce=Q*Q;for(;ue.length;){const Ze=ue.pop(),Re=ue.pop(),je=ue.pop();if(Re-je<=te){for(let st=je;st<=Re;st++)Vr(H[2*st],H[2*st+1],ee,Y)<=ce&&_e.push(G[st]);continue}const Ke=Math.floor((je+Re)/2),vt=H[2*Ke],mt=H[2*Ke+1];Vr(vt,mt,ee,Y)<=ce&&_e.push(G[Ke]);const ut=(Ze+1)%2;(Ze===0?ee-Q<=vt:Y-Q<=mt)&&(ue.push(je),ue.push(Ke-1),ue.push(ut)),(Ze===0?ee+Q>=vt:Y+Q>=mt)&&(ue.push(Ke+1),ue.push(Re),ue.push(ut))}return _e}(this.ids,this.coords,E,M,U,this.nodeSize)}}const qo={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:V=>V},mi=Math.fround||(tn=new Float32Array(1),V=>(tn[0]=+V,tn[0]));var tn;class po{constructor(E){this.options=yt(Object.create(qo),E),this.trees=new Array(this.options.maxZoom+1)}load(E){const{log:M,minZoom:U,maxZoom:G,nodeSize:H}=this.options;M&&console.time("total time");const ee=`prepare ${E.length} points`;M&&console.time(ee),this.points=E;let Y=[];for(let Q=0;Q<E.length;Q++)E[Q].geometry&&Y.push(Ir(E[Q],Q));this.trees[G+1]=new uo(Y,mn,rn,H,Float32Array),M&&console.timeEnd(ee);for(let Q=G;Q>=U;Q--){const te=+Date.now();Y=this._cluster(Y,Q),this.trees[Q]=new uo(Y,mn,rn,H,Float32Array),M&&console.log("z%d: %d clusters in %dms",Q,Y.length,+Date.now()-te)}return M&&console.timeEnd("total time"),this}getClusters(E,M){let U=((E[0]+180)%360+360)%360-180;const G=Math.max(-90,Math.min(90,E[1]));let H=E[2]===180?180:((E[2]+180)%360+360)%360-180;const ee=Math.max(-90,Math.min(90,E[3]));if(E[2]-E[0]>=360)U=-180,H=180;else if(U>H){const ue=this.getClusters([U,G,180,ee],M),_e=this.getClusters([-180,G,H,ee],M);return ue.concat(_e)}const Y=this.trees[this._limitZoom(M)],Q=Y.range(Er(U),Ar(ee),Er(H),Ar(G)),te=[];for(const ue of Q){const _e=Y.points[ue];te.push(_e.numPoints?Wo(_e):this.points[_e.index])}return te}getChildren(E){const M=this._getOriginId(E),U=this._getOriginZoom(E),G="No cluster with the specified id.",H=this.trees[U];if(!H)throw new Error(G);const ee=H.points[M];if(!ee)throw new Error(G);const Y=this.options.radius/(this.options.extent*Math.pow(2,U-1)),Q=H.within(ee.x,ee.y,Y),te=[];for(const ue of Q){const _e=H.points[ue];_e.parentId===E&&te.push(_e.numPoints?Wo(_e):this.points[_e.index])}if(te.length===0)throw new Error(G);return te}getLeaves(E,M,U){const G=[];return this._appendLeaves(G,E,M=M||10,U=U||0,0),G}getTile(E,M,U){const G=this.trees[this._limitZoom(E)],H=Math.pow(2,E),{extent:ee,radius:Y}=this.options,Q=Y/ee,te=(U-Q)/H,ue=(U+1+Q)/H,_e={features:[]};return this._addTileFeatures(G.range((M-Q)/H,te,(M+1+Q)/H,ue),G.points,M,U,H,_e),M===0&&this._addTileFeatures(G.range(1-Q/H,te,1,ue),G.points,H,U,H,_e),M===H-1&&this._addTileFeatures(G.range(0,te,Q/H,ue),G.points,-1,U,H,_e),_e.features.length?_e:null}getClusterExpansionZoom(E){let M=this._getOriginZoom(E)-1;for(;M<=this.options.maxZoom;){const U=this.getChildren(E);if(M++,U.length!==1)break;E=U[0].properties.cluster_id}return M}_appendLeaves(E,M,U,G,H){const ee=this.getChildren(M);for(const Y of ee){const Q=Y.properties;if(Q&&Q.cluster?H+Q.point_count<=G?H+=Q.point_count:H=this._appendLeaves(E,Q.cluster_id,U,G,H):H<G?H++:E.push(Y),E.length===U)break}return H}_addTileFeatures(E,M,U,G,H,ee){for(const Y of E){const Q=M[Y],te=Q.numPoints;let ue,_e,ce;if(te)ue=Gr(Q),_e=Q.x,ce=Q.y;else{const je=this.points[Q.index];ue=je.properties,_e=Er(je.geometry.coordinates[0]),ce=Ar(je.geometry.coordinates[1])}const Ze={type:1,geometry:[[Math.round(this.options.extent*(_e*H-U)),Math.round(this.options.extent*(ce*H-G))]],tags:ue};let Re;te?Re=Q.id:this.options.generateId?Re=Q.index:this.points[Q.index].id&&(Re=this.points[Q.index].id),Re!==void 0&&(Ze.id=Re),ee.features.push(Ze)}}_limitZoom(E){return Math.max(this.options.minZoom,Math.min(+E,this.options.maxZoom+1))}_cluster(E,M){const U=[],{radius:G,extent:H,reduce:ee,minPoints:Y}=this.options,Q=G/(H*Math.pow(2,M));for(let te=0;te<E.length;te++){const ue=E[te];if(ue.zoom<=M)continue;ue.zoom=M;const _e=this.trees[M+1],ce=_e.within(ue.x,ue.y,Q),Ze=ue.numPoints||1;let Re=Ze;for(const je of ce){const Ke=_e.points[je];Ke.zoom>M&&(Re+=Ke.numPoints||1)}if(Re>Ze&&Re>=Y){let je=ue.x*Ze,Ke=ue.y*Ze,vt=ee&&Ze>1?this._map(ue,!0):null;const mt=(te<<5)+(M+1)+this.points.length;for(const ut of ce){const st=_e.points[ut];if(st.zoom<=M)continue;st.zoom=M;const nt=st.numPoints||1;je+=st.x*nt,Ke+=st.y*nt,st.parentId=mt,ee&&(vt||(vt=this._map(ue,!0)),ee(vt,this._map(st)))}ue.parentId=mt,U.push(pn(je/Re,Ke/Re,mt,Re,vt))}else if(U.push(ue),Re>1)for(const je of ce){const Ke=_e.points[je];Ke.zoom<=M||(Ke.zoom=M,U.push(Ke))}}return U}_getOriginId(E){return E-this.points.length>>5}_getOriginZoom(E){return(E-this.points.length)%32}_map(E,M){if(E.numPoints)return M?yt({},E.properties):E.properties;const U=this.points[E.index].properties,G=this.options.map(U);return M&&G===U?yt({},G):G}}function pn(V,E,M,U,G){return{x:mi(V),y:mi(E),zoom:1/0,id:M,parentId:-1,numPoints:U,properties:G}}function Ir(V,E){const[M,U]=V.geometry.coordinates;return{x:mi(Er(M)),y:mi(Ar(U)),zoom:1/0,index:E,parentId:-1}}function Wo(V){return{type:"Feature",id:V.id,properties:Gr(V),geometry:{type:"Point",coordinates:[(E=V.x,360*(E-.5)),mo(V.y)]}};var E}function Gr(V){const E=V.numPoints,M=E>=1e4?`${Math.round(E/1e3)}k`:E>=1e3?Math.round(E/100)/10+"k":E;return yt(yt({},V.properties),{cluster:!0,cluster_id:V.id,point_count:E,point_count_abbreviated:M})}function Er(V){return V/360+.5}function Ar(V){const E=Math.sin(V*Math.PI/180),M=.5-.25*Math.log((1+E)/(1-E))/Math.PI;return M<0?0:M>1?1:M}function mo(V){const E=(180-360*V)*Math.PI/180;return 360*Math.atan(Math.exp(E))/Math.PI-90}function yt(V,E){for(const M in E)V[M]=E[M];return V}function mn(V){return V.x}function rn(V){return V.y}function fn(V,E,M,U){for(var G,H=U,ee=M-E>>1,Y=M-E,Q=V[E],te=V[E+1],ue=V[M],_e=V[M+1],ce=E+3;ce<M;ce+=3){var Ze=fo(V[ce],V[ce+1],Q,te,ue,_e);if(Ze>H)G=ce,H=Ze;else if(Ze===H){var Re=Math.abs(ce-ee);Re<Y&&(G=ce,Y=Re)}}H>U&&(G-E>3&&fn(V,E,G,U),V[G+2]=H,M-G>3&&fn(V,G,M,U))}function fo(V,E,M,U,G,H){var ee=G-M,Y=H-U;if(ee!==0||Y!==0){var Q=((V-M)*ee+(E-U)*Y)/(ee*ee+Y*Y);Q>1?(M=G,U=H):Q>0&&(M+=ee*Q,U+=Y*Q)}return(ee=V-M)*ee+(Y=E-U)*Y}function pe(V,E,M,U){var G={id:V===void 0?null:V,type:E,geometry:M,tags:U,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(H){var ee=H.geometry,Y=H.type;if(Y==="Point"||Y==="MultiPoint"||Y==="LineString")Me(H,ee);else if(Y==="Polygon"||Y==="MultiLineString")for(var Q=0;Q<ee.length;Q++)Me(H,ee[Q]);else if(Y==="MultiPolygon")for(Q=0;Q<ee.length;Q++)for(var te=0;te<ee[Q].length;te++)Me(H,ee[Q][te])}(G),G}function Me(V,E){for(var M=0;M<E.length;M+=3)V.minX=Math.min(V.minX,E[M]),V.minY=Math.min(V.minY,E[M+1]),V.maxX=Math.max(V.maxX,E[M]),V.maxY=Math.max(V.maxY,E[M+1])}function gn(V,E,M,U){if(E.geometry){var G=E.geometry.coordinates,H=E.geometry.type,ee=Math.pow(M.tolerance/((1<<M.maxZoom)*M.extent),2),Y=[],Q=E.id;if(M.promoteId?Q=E.properties[M.promoteId]:M.generateId&&(Q=U||0),H==="Point")Zr(G,Y);else if(H==="MultiPoint")for(var te=0;te<G.length;te++)Zr(G[te],Y);else if(H==="LineString")zt(G,Y,ee,!1);else if(H==="MultiLineString"){if(M.lineMetrics){for(te=0;te<G.length;te++)zt(G[te],Y=[],ee,!1),V.push(pe(Q,"LineString",Y,E.properties));return}nr(G,Y,ee,!1)}else if(H==="Polygon")nr(G,Y,ee,!0);else{if(H!=="MultiPolygon"){if(H==="GeometryCollection"){for(te=0;te<E.geometry.geometries.length;te++)gn(V,{id:Q,geometry:E.geometry.geometries[te],properties:E.properties},M,U);return}throw new Error("Input data is not a valid GeoJSON object.")}for(te=0;te<G.length;te++){var ue=[];nr(G[te],ue,ee,!0),Y.push(ue)}}V.push(pe(Q,H,Y,E.properties))}}function Zr(V,E){E.push(Pi(V[0])),E.push(yn(V[1])),E.push(0)}function zt(V,E,M,U){for(var G,H,ee=0,Y=0;Y<V.length;Y++){var Q=Pi(V[Y][0]),te=yn(V[Y][1]);E.push(Q),E.push(te),E.push(0),Y>0&&(ee+=U?(G*te-Q*H)/2:Math.sqrt(Math.pow(Q-G,2)+Math.pow(te-H,2))),G=Q,H=te}var ue=E.length-3;E[2]=1,fn(E,0,ue,M),E[ue+2]=1,E.size=Math.abs(ee),E.start=0,E.end=E.size}function nr(V,E,M,U){for(var G=0;G<V.length;G++){var H=[];zt(V[G],H,M,U),E.push(H)}}function Pi(V){return V/360+.5}function yn(V){var E=Math.sin(V*Math.PI/180),M=.5-.25*Math.log((1+E)/(1-E))/Math.PI;return M<0?0:M>1?1:M}function Rt(V,E,M,U,G,H,ee,Y){if(U/=E,H>=(M/=E)&&ee<U)return V;if(ee<M||H>=U)return null;for(var Q=[],te=0;te<V.length;te++){var ue=V[te],_e=ue.geometry,ce=ue.type,Ze=G===0?ue.minX:ue.minY,Re=G===0?ue.maxX:ue.maxY;if(Ze>=M&&Re<U)Q.push(ue);else if(!(Re<M||Ze>=U)){var je=[];if(ce==="Point"||ce==="MultiPoint")Ee(_e,je,M,U,G);else if(ce==="LineString")ct(_e,je,M,U,G,!1,Y.lineMetrics);else if(ce==="MultiLineString")Mi(_e,je,M,U,G,!1);else if(ce==="Polygon")Mi(_e,je,M,U,G,!0);else if(ce==="MultiPolygon")for(var Ke=0;Ke<_e.length;Ke++){var vt=[];Mi(_e[Ke],vt,M,U,G,!0),vt.length&&je.push(vt)}if(je.length){if(Y.lineMetrics&&ce==="LineString"){for(Ke=0;Ke<je.length;Ke++)Q.push(pe(ue.id,ce,je[Ke],ue.tags));continue}ce!=="LineString"&&ce!=="MultiLineString"||(je.length===1?(ce="LineString",je=je[0]):ce="MultiLineString"),ce!=="Point"&&ce!=="MultiPoint"||(ce=je.length===3?"Point":"MultiPoint"),Q.push(pe(ue.id,ce,je,ue.tags))}}}return Q.length?Q:null}function Ee(V,E,M,U,G){for(var H=0;H<V.length;H+=3){var ee=V[H+G];ee>=M&&ee<=U&&(E.push(V[H]),E.push(V[H+1]),E.push(V[H+2]))}}function ct(V,E,M,U,G,H,ee){for(var Y,Q,te=ot(V),ue=G===0?at:_n,_e=V.start,ce=0;ce<V.length-3;ce+=3){var Ze=V[ce],Re=V[ce+1],je=V[ce+2],Ke=V[ce+3],vt=V[ce+4],mt=G===0?Ze:Re,ut=G===0?Ke:vt,st=!1;ee&&(Y=Math.sqrt(Math.pow(Ze-Ke,2)+Math.pow(Re-vt,2))),mt<M?ut>M&&(Q=ue(te,Ze,Re,Ke,vt,M),ee&&(te.start=_e+Y*Q)):mt>U?ut<U&&(Q=ue(te,Ze,Re,Ke,vt,U),ee&&(te.start=_e+Y*Q)):gr(te,Ze,Re,je),ut<M&&mt>=M&&(Q=ue(te,Ze,Re,Ke,vt,M),st=!0),ut>U&&mt<=U&&(Q=ue(te,Ze,Re,Ke,vt,U),st=!0),!H&&st&&(ee&&(te.end=_e+Y*Q),E.push(te),te=ot(V)),ee&&(_e+=Y)}var nt=V.length-3;Ze=V[nt],Re=V[nt+1],je=V[nt+2],(mt=G===0?Ze:Re)>=M&&mt<=U&&gr(te,Ze,Re,je),nt=te.length-3,H&&nt>=3&&(te[nt]!==te[0]||te[nt+1]!==te[1])&&gr(te,te[0],te[1],te[2]),te.length&&E.push(te)}function ot(V){var E=[];return E.size=V.size,E.start=V.start,E.end=V.end,E}function Mi(V,E,M,U,G,H){for(var ee=0;ee<V.length;ee++)ct(V[ee],E,M,U,G,H,!1)}function gr(V,E,M,U){V.push(E),V.push(M),V.push(U)}function at(V,E,M,U,G,H){var ee=(H-E)/(U-E);return V.push(H),V.push(M+(G-M)*ee),V.push(1),ee}function _n(V,E,M,U,G,H){var ee=(H-M)/(G-M);return V.push(E+(U-E)*ee),V.push(H),V.push(1),ee}function yr(V,E){for(var M=[],U=0;U<V.length;U++){var G,H=V[U],ee=H.type;if(ee==="Point"||ee==="MultiPoint"||ee==="LineString")G=Hr(H.geometry,E);else if(ee==="MultiLineString"||ee==="Polygon"){G=[];for(var Y=0;Y<H.geometry.length;Y++)G.push(Hr(H.geometry[Y],E))}else if(ee==="MultiPolygon")for(G=[],Y=0;Y<H.geometry.length;Y++){for(var Q=[],te=0;te<H.geometry[Y].length;te++)Q.push(Hr(H.geometry[Y][te],E));G.push(Q)}M.push(pe(H.id,ee,G,H.tags))}return M}function Hr(V,E){var M=[];M.size=V.size,V.start!==void 0&&(M.start=V.start,M.end=V.end);for(var U=0;U<V.length;U+=3)M.push(V[U]+E,V[U+1],V[U+2]);return M}function ii(V,E){if(V.transformed)return V;var M,U,G,H=1<<V.z,ee=V.x,Y=V.y;for(M=0;M<V.features.length;M++){var Q=V.features[M],te=Q.geometry,ue=Q.type;if(Q.geometry=[],ue===1)for(U=0;U<te.length;U+=2)Q.geometry.push(kt(te[U],te[U+1],E,H,ee,Y));else for(U=0;U<te.length;U++){var _e=[];for(G=0;G<te[U].length;G+=2)_e.push(kt(te[U][G],te[U][G+1],E,H,ee,Y));Q.geometry.push(_e)}}return V.transformed=!0,V}function kt(V,E,M,U,G,H){return[Math.round(M*(V*U-G)),Math.round(M*(E*U-H))]}function or(V,E,M,U,G){for(var H=E===G.maxZoom?0:G.tolerance/((1<<E)*G.extent),ee={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:M,y:U,z:E,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},Y=0;Y<V.length;Y++){ee.numFeatures++,xn(ee,V[Y],H,G);var Q=V[Y].minX,te=V[Y].minY,ue=V[Y].maxX,_e=V[Y].maxY;Q<ee.minX&&(ee.minX=Q),te<ee.minY&&(ee.minY=te),ue>ee.maxX&&(ee.maxX=ue),_e>ee.maxY&&(ee.maxY=_e)}return ee}function xn(V,E,M,U){var G=E.geometry,H=E.type,ee=[];if(H==="Point"||H==="MultiPoint")for(var Y=0;Y<G.length;Y+=3)ee.push(G[Y]),ee.push(G[Y+1]),V.numPoints++,V.numSimplified++;else if(H==="LineString")li(ee,G,V,M,!1,!1);else if(H==="MultiLineString"||H==="Polygon")for(Y=0;Y<G.length;Y++)li(ee,G[Y],V,M,H==="Polygon",Y===0);else if(H==="MultiPolygon")for(var Q=0;Q<G.length;Q++){var te=G[Q];for(Y=0;Y<te.length;Y++)li(ee,te[Y],V,M,!0,Y===0)}if(ee.length){var ue=E.tags||null;if(H==="LineString"&&U.lineMetrics){for(var _e in ue={},E.tags)ue[_e]=E.tags[_e];ue.mapbox_clip_start=G.start/G.size,ue.mapbox_clip_end=G.end/G.size}var ce={geometry:ee,type:H==="Polygon"||H==="MultiPolygon"?3:H==="LineString"||H==="MultiLineString"?2:1,tags:ue};E.id!==null&&(ce.id=E.id),V.features.push(ce)}}function li(V,E,M,U,G,H){var ee=U*U;if(U>0&&E.size<(G?ee:U))M.numPoints+=E.length/3;else{for(var Y=[],Q=0;Q<E.length;Q+=3)(U===0||E[Q+2]>ee)&&(M.numSimplified++,Y.push(E[Q]),Y.push(E[Q+1])),M.numPoints++;G&&function(te,ue){for(var _e=0,ce=0,Ze=te.length,Re=Ze-2;ce<Ze;Re=ce,ce+=2)_e+=(te[ce]-te[Re])*(te[ce+1]+te[Re+1]);if(_e>0===ue)for(ce=0,Ze=te.length;ce<Ze/2;ce+=2){var je=te[ce],Ke=te[ce+1];te[ce]=te[Ze-2-ce],te[ce+1]=te[Ze-1-ce],te[Ze-2-ce]=je,te[Ze-1-ce]=Ke}}(Y,H),V.push(Y)}}function _r(V,E){var M=(E=this.options=function(G,H){for(var ee in H)G[ee]=H[ee];return G}(Object.create(this.options),E)).debug;if(M&&console.time("preprocess data"),E.maxZoom<0||E.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(E.promoteId&&E.generateId)throw new Error("promoteId and generateId cannot be used together.");var U=function(G,H){var ee=[];if(G.type==="FeatureCollection")for(var Y=0;Y<G.features.length;Y++)gn(ee,G.features[Y],H,Y);else gn(ee,G.type==="Feature"?G:{geometry:G},H);return ee}(V,E);this.tiles={},this.tileCoords=[],M&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",E.indexMaxZoom,E.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),U=function(G,H){var ee=H.buffer/H.extent,Y=G,Q=Rt(G,1,-1-ee,ee,0,-1,2,H),te=Rt(G,1,1-ee,2+ee,0,-1,2,H);return(Q||te)&&(Y=Rt(G,1,-ee,1+ee,0,-1,2,H)||[],Q&&(Y=yr(Q,1).concat(Y)),te&&(Y=Y.concat(yr(te,-1)))),Y}(U,E),U.length&&this.splitTile(U,0,0,0),M&&(U.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 xr(V,E,M){return 32*((1<<V)*M+E)+V}function go(V,E){const M=V.tileID.canonical;if(!this._geoJSONIndex)return E(null,null);const U=this._geoJSONIndex.getTile(M.z,M.x,M.y);if(!U)return E(null,null);const G=new Xe(U.features);let H=$r(G);H.byteOffset===0&&H.byteLength===H.buffer.byteLength||(H=new Uint8Array(H)),E(null,{vectorTile:G,rawData:H.buffer})}_r.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},_r.prototype.splitTile=function(V,E,M,U,G,H,ee){for(var Y=[V,E,M,U],Q=this.options,te=Q.debug;Y.length;){U=Y.pop(),M=Y.pop(),E=Y.pop(),V=Y.pop();var ue=1<<E,_e=xr(E,M,U),ce=this.tiles[_e];if(!ce&&(te>1&&console.time("creation"),ce=this.tiles[_e]=or(V,E,M,U,Q),this.tileCoords.push({z:E,x:M,y:U}),te)){te>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",E,M,U,ce.numFeatures,ce.numPoints,ce.numSimplified),console.timeEnd("creation"));var Ze="z"+E;this.stats[Ze]=(this.stats[Ze]||0)+1,this.total++}if(ce.source=V,G){if(E===Q.maxZoom||E===G)continue;var Re=1<<G-E;if(M!==Math.floor(H/Re)||U!==Math.floor(ee/Re))continue}else if(E===Q.indexMaxZoom||ce.numPoints<=Q.indexMaxPoints)continue;if(ce.source=null,V.length!==0){te>1&&console.time("clipping");var je,Ke,vt,mt,ut,st,nt=.5*Q.buffer/Q.extent,Jt=.5-nt,Xt=.5+nt,fi=1+nt;je=Ke=vt=mt=null,ut=Rt(V,ue,M-nt,M+Xt,0,ce.minX,ce.maxX,Q),st=Rt(V,ue,M+Jt,M+fi,0,ce.minX,ce.maxX,Q),V=null,ut&&(je=Rt(ut,ue,U-nt,U+Xt,1,ce.minY,ce.maxY,Q),Ke=Rt(ut,ue,U+Jt,U+fi,1,ce.minY,ce.maxY,Q),ut=null),st&&(vt=Rt(st,ue,U-nt,U+Xt,1,ce.minY,ce.maxY,Q),mt=Rt(st,ue,U+Jt,U+fi,1,ce.minY,ce.maxY,Q),st=null),te>1&&console.timeEnd("clipping"),Y.push(je||[],E+1,2*M,2*U),Y.push(Ke||[],E+1,2*M,2*U+1),Y.push(vt||[],E+1,2*M+1,2*U),Y.push(mt||[],E+1,2*M+1,2*U+1)}}},_r.prototype.getTile=function(V,E,M){var U=this.options,G=U.extent,H=U.debug;if(V<0||V>24)return null;var ee=1<<V,Y=xr(V,E=(E%ee+ee)%ee,M);if(this.tiles[Y])return ii(this.tiles[Y],G);H>1&&console.log("drilling down to z%d-%d-%d",V,E,M);for(var Q,te=V,ue=E,_e=M;!Q&&te>0;)te--,ue=Math.floor(ue/2),_e=Math.floor(_e/2),Q=this.tiles[xr(te,ue,_e)];return Q&&Q.source?(H>1&&console.log("found parent tile z%d-%d-%d",te,ue,_e),H>1&&console.time("drilling down"),this.splitTile(Q.source,te,ue,_e,V,E,M),H>1&&console.timeEnd("drilling down"),this.tiles[Y]?ii(this.tiles[Y],G):null):null};class Vn extends Ae{constructor(E,M,U,G){super(E,M,U,go),G&&(this.loadGeoJSON=G)}loadData(E,M){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),this._pendingCallback=M,this._pendingLoadDataParams=E,this._state&&this._state!=="Idle"?this._state="NeedsLoadData":(this._state="Coalescing",this._loadData())}_loadData(){if(!this._pendingCallback||!this._pendingLoadDataParams)return;const E=this._pendingCallback,M=this._pendingLoadDataParams;delete this._pendingCallback,delete this._pendingLoadDataParams;const U=!!(M&&M.request&&M.request.collectResourceTiming)&&new l.RequestPerformance(M.request);this.loadGeoJSON(M,(G,H)=>{if(G||!H)return E(G);if(typeof H!="object")return E(new Error(`Input data given to '${M.source}' is not a valid GeoJSON object.`));{$e(H,!0);try{if(M.filter){const Y=l.createExpression(M.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(Y.result==="error")throw new Error(Y.value.map(te=>`${te.key}: ${te.message}`).join(", "));const Q=H.features.filter(te=>Y.value.evaluate({zoom:0},te));H={type:"FeatureCollection",features:Q}}this._geoJSONIndex=M.cluster?new po(function({superclusterOptions:Y,clusterProperties:Q}){if(!Q||!Y)return Y;const te={},ue={},_e={accumulated:null,zoom:0},ce={properties:null},Ze=Object.keys(Q);for(const Re of Ze){const[je,Ke]=Q[Re],vt=l.createExpression(Ke),mt=l.createExpression(typeof je=="string"?[je,["accumulated"],["get",Re]]:je);te[Re]=vt.value,ue[Re]=mt.value}return Y.map=Re=>{ce.properties=Re;const je={};for(const Ke of Ze)je[Ke]=te[Ke].evaluate(_e,ce);return je},Y.reduce=(Re,je)=>{ce.properties=je;for(const Ke of Ze)_e.accumulated=Re[Ke],Re[Ke]=ue[Ke].evaluate(_e,ce)},Y}(M)).load(H.features):function(Y,Q){return new _r(Y,Q)}(H,M.geojsonVtOptions)}catch(Y){return E(Y)}this.loaded={};const ee={};if(U){const Y=U.finish();Y&&(ee.resourceTiming={},ee.resourceTiming[M.source]=JSON.parse(JSON.stringify(Y)))}E(null,ee)}})}coalesce(){this._state==="Coalescing"?this._state="Idle":this._state==="NeedsLoadData"&&(this._state="Coalescing",this._loadData())}reloadTile(E,M){const U=this.loaded;return U&&U[E.uid]?super.reloadTile(E,M):this.loadTile(E,M)}loadGeoJSON(E,M){if(E.request)l.getJSON(E.request,M);else{if(typeof E.data!="string")return M(new Error(`Input data given to '${E.source}' is not a valid GeoJSON object.`));try{return M(null,JSON.parse(E.data))}catch{return M(new Error(`Input data given to '${E.source}' is not a valid GeoJSON object.`))}}}removeSource(E,M){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),M()}getClusterExpansionZoom(E,M){try{M(null,this._geoJSONIndex.getClusterExpansionZoom(E.clusterId))}catch(U){M(U)}}getClusterChildren(E,M){try{M(null,this._geoJSONIndex.getChildren(E.clusterId))}catch(U){M(U)}}getClusterLeaves(E,M){try{M(null,this._geoJSONIndex.getLeaves(E.clusterId,E.limit,E.offset))}catch(U){M(U)}}}class Gn{constructor(E){this.self=E,this.actor=new l.Actor(E,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:Ae,geojson:Vn},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(M,U)=>{if(this.workerSourceTypes[M])throw new Error(`Worker source with name "${M}" already registered.`);this.workerSourceTypes[M]=U},this.self.registerRTLTextPlugin=M=>{if(l.plugin.isParsed())throw new Error("RTL text plugin already registered.");l.plugin.applyArabicShaping=M.applyArabicShaping,l.plugin.processBidirectionalText=M.processBidirectionalText,l.plugin.processStyledBidirectionalText=M.processStyledBidirectionalText}}setReferrer(E,M){this.referrer=M}setImages(E,M,U){this.availableImages[E]=M;for(const G in this.workerSources[E]){const H=this.workerSources[E][G];for(const ee in H)H[ee].availableImages=M}U()}setLayers(E,M,U){this.getLayerIndex(E).replace(M),U()}updateLayers(E,M,U){this.getLayerIndex(E).update(M.layers,M.removedIds),U()}loadTile(E,M,U){this.getWorkerSource(E,M.type,M.source).loadTile(M,U)}loadDEMTile(E,M,U){this.getDEMWorkerSource(E,M.source).loadTile(M,U)}reloadTile(E,M,U){this.getWorkerSource(E,M.type,M.source).reloadTile(M,U)}abortTile(E,M,U){this.getWorkerSource(E,M.type,M.source).abortTile(M,U)}removeTile(E,M,U){this.getWorkerSource(E,M.type,M.source).removeTile(M,U)}removeDEMTile(E,M){this.getDEMWorkerSource(E,M.source).removeTile(M)}removeSource(E,M,U){if(!this.workerSources[E]||!this.workerSources[E][M.type]||!this.workerSources[E][M.type][M.source])return;const G=this.workerSources[E][M.type][M.source];delete this.workerSources[E][M.type][M.source],G.removeSource!==void 0?G.removeSource(M,U):U()}loadWorkerSource(E,M,U){try{this.self.importScripts(M.url),U()}catch(G){U(G.toString())}}syncRTLPluginState(E,M,U){try{l.plugin.setState(M);const G=l.plugin.getPluginURL();if(l.plugin.isLoaded()&&!l.plugin.isParsed()&&G!=null){this.self.importScripts(G);const H=l.plugin.isParsed();U(H?void 0:new Error(`RTL Text Plugin failed to import scripts from ${G}`),H)}}catch(G){U(G.toString())}}getAvailableImages(E){let M=this.availableImages[E];return M||(M=[]),M}getLayerIndex(E){let M=this.layerIndexes[E];return M||(M=this.layerIndexes[E]=new J),M}getWorkerSource(E,M,U){if(this.workerSources[E]||(this.workerSources[E]={}),this.workerSources[E][M]||(this.workerSources[E][M]={}),!this.workerSources[E][M][U]){const G={send:(H,ee,Y)=>{this.actor.send(H,ee,Y,E)}};this.workerSources[E][M][U]=new this.workerSourceTypes[M](G,this.getLayerIndex(E),this.getAvailableImages(E))}return this.workerSources[E][M][U]}getDEMWorkerSource(E,M){return this.demWorkerSources[E]||(this.demWorkerSources[E]={}),this.demWorkerSources[E][M]||(this.demWorkerSources[E][M]=new Fe),this.demWorkerSources[E][M]}enforceCacheSizeLimit(E,M){l.enforceCacheSizeLimit(M)}}return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope&&(self.worker=new Gn(self)),Gn}),w(["./shared"],function(l){var D=B;function B(d){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 h,p,y=new Blob([""],{type:"text/javascript"}),v=URL.createObjectURL(y);try{p=new Worker(v),h=!0}catch{h=!1}return p&&p.terminate(),URL.revokeObjectURL(v),h}()?"Uint8ClampedArray"in window?ArrayBuffer.isView?function(){var h=document.createElement("canvas");h.width=h.height=1;var p=h.getContext("2d");if(!p)return!1;var y=p.getImageData(0,0,1,1);return y&&y.width===h.width}()?(J[o=t&&t.failIfMajorPerformanceCaveat]===void 0&&(J[o]=function(h){var p,y=function(v){var S=document.createElement("canvas"),T=Object.create(B.webGLContextAttributes);return T.failIfMajorPerformanceCaveat=v,S.getContext("webgl",T)||S.getContext("experimental-webgl",T)}(h);if(!y)return!1;try{p=y.createShader(y.VERTEX_SHADER)}catch{return!1}return!(!p||y.isContextLost())&&(y.shaderSource(p,"void main() {}"),y.compileShader(p),y.getShaderParameter(p,y.COMPILE_STATUS)===!0)}(o)),J[o]?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 o}(d)}var J={};function K(d,t){if(Array.isArray(d)){if(!Array.isArray(t)||d.length!==t.length)return!1;for(let o=0;o<d.length;o++)if(!K(d[o],t[o]))return!1;return!0}if(typeof d=="object"&&d!==null&&t!==null){if(typeof t!="object"||Object.keys(d).length!==Object.keys(t).length)return!1;for(const o in d)if(!K(d[o],t[o]))return!1;return!0}return d===t}B.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0};class Z{static testProp(t){if(!Z.docStyle)return t[0];for(let o=0;o<t.length;o++)if(t[o]in Z.docStyle)return t[o];return t[0]}static create(t,o,h){const p=window.document.createElement(t);return o!==void 0&&(p.className=o),h&&h.appendChild(p),p}static createNS(t,o){return window.document.createElementNS(t,o)}static disableDrag(){Z.docStyle&&Z.selectProp&&(Z.userSelect=Z.docStyle[Z.selectProp],Z.docStyle[Z.selectProp]="none")}static enableDrag(){Z.docStyle&&Z.selectProp&&(Z.docStyle[Z.selectProp]=Z.userSelect)}static setTransform(t,o){t.style[Z.transformProp]=o}static addEventListener(t,o,h,p={}){t.addEventListener(o,h,"passive"in p?p:p.capture)}static removeEventListener(t,o,h,p={}){t.removeEventListener(o,h,"passive"in p?p:p.capture)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",Z.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",Z.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",Z.suppressClickInternal,!0)},0)}static mousePos(t,o){const h=t.getBoundingClientRect();return new l.pointGeometry(o.clientX-h.left-t.clientLeft,o.clientY-h.top-t.clientTop)}static touchPos(t,o){const h=t.getBoundingClientRect(),p=[];for(let y=0;y<o.length;y++)p.push(new l.pointGeometry(o[y].clientX-h.left-t.clientLeft,o[y].clientY-h.top-t.clientTop));return p}static mouseButton(t){return t.button}static remove(t){t.parentNode&&t.parentNode.removeChild(t)}}Z.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,Z.selectProp=Z.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),Z.transformProp=Z.testProp(["transform","WebkitTransform"]);class we{constructor(t){this._transformRequestFn=t}transformRequest(t,o){return this._transformRequestFn&&this._transformRequestFn(t,o)||{url:t}}normalizeSpriteURL(t,o,h){const p=function(y){const v=y.match(be);if(!v)throw new Error(`Unable to parse URL "${y}"`);return{protocol:v[1],authority:v[2],path:v[3]||"/",params:v[4]?v[4].split("&"):[]}}(t);return p.path+=`${o}${h}`,function(y){const v=y.params.length?`?${y.params.join("&")}`:"";return`${y.protocol}://${y.authority}${y.path}${v}`}(p)}setTransformRequest(t){this._transformRequestFn=t}}const be=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function Ae(d){var t=new l.ARRAY_TYPE(3);return t[0]=d[0],t[1]=d[1],t[2]=d[2],t}var Fe,$e=function(d,t,o){return d[0]=t[0]-o[0],d[1]=t[1]-o[1],d[2]=t[2]-o[2],d};Fe=new l.ARRAY_TYPE(3),l.ARRAY_TYPE!=Float32Array&&(Fe[0]=0,Fe[1]=0,Fe[2]=0);var Ve=function(d){var t=d[0],o=d[1];return t*t+o*o};(function(){var d=new l.ARRAY_TYPE(2);l.ARRAY_TYPE!=Float32Array&&(d[0]=0,d[1]=0)})();class Ge{constructor(t,o,h,p){this.context=t,this.format=h,this.texture=t.gl.createTexture(),this.update(o,p)}update(t,o,h){const{width:p,height:y}=t,v=!(this.size&&this.size[0]===p&&this.size[1]===y||h),{context:S}=this,{gl:T}=S;if(this.useMipmap=Boolean(o&&o.useMipmap),T.bindTexture(T.TEXTURE_2D,this.texture),S.pixelStoreUnpackFlipY.set(!1),S.pixelStoreUnpack.set(1),S.pixelStoreUnpackPremultiplyAlpha.set(this.format===T.RGBA&&(!o||o.premultiply!==!1)),v)this.size=[p,y],t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||l.isImageBitmap(t)?T.texImage2D(T.TEXTURE_2D,0,this.format,this.format,T.UNSIGNED_BYTE,t):T.texImage2D(T.TEXTURE_2D,0,this.format,p,y,0,this.format,T.UNSIGNED_BYTE,t.data);else{const{x:A,y:k}=h||{x:0,y:0};t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||l.isImageBitmap(t)?T.texSubImage2D(T.TEXTURE_2D,0,A,k,T.RGBA,T.UNSIGNED_BYTE,t):T.texSubImage2D(T.TEXTURE_2D,0,A,k,p,y,T.RGBA,T.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&T.generateMipmap(T.TEXTURE_2D)}bind(t,o,h){const{context:p}=this,{gl:y}=p;y.bindTexture(y.TEXTURE_2D,this.texture),h!==y.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(h=y.LINEAR),t!==this.filter&&(y.texParameteri(y.TEXTURE_2D,y.TEXTURE_MAG_FILTER,t),y.texParameteri(y.TEXTURE_2D,y.TEXTURE_MIN_FILTER,h||t),this.filter=t),o!==this.wrap&&(y.texParameteri(y.TEXTURE_2D,y.TEXTURE_WRAP_S,o),y.texParameteri(y.TEXTURE_2D,y.TEXTURE_WRAP_T,o),this.wrap=o)}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 lt(d){const{userImage:t}=d;return!!(t&&t.render&&t.render())&&(d.data.replace(new Uint8Array(t.data.buffer)),!0)}class rt extends l.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new l.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:o,callback:h}of this.requestors)this._notify(o,h);this.requestors=[]}}getImage(t){return this.images[t]}addImage(t,o){this._validate(t,o)&&(this.images[t]=o)}_validate(t,o){let h=!0;return this._validateStretch(o.stretchX,o.data&&o.data.width)||(this.fire(new l.ErrorEvent(new Error(`Image "${t}" has invalid "stretchX" value`))),h=!1),this._validateStretch(o.stretchY,o.data&&o.data.height)||(this.fire(new l.ErrorEvent(new Error(`Image "${t}" has invalid "stretchY" value`))),h=!1),this._validateContent(o.content,o)||(this.fire(new l.ErrorEvent(new Error(`Image "${t}" has invalid "content" value`))),h=!1),h}_validateStretch(t,o){if(!t)return!0;let h=0;for(const p of t){if(p[0]<h||p[1]<p[0]||o<p[1])return!1;h=p[1]}return!0}_validateContent(t,o){return!(t&&(t.length!==4||t[0]<0||o.data.width<t[0]||t[1]<0||o.data.height<t[1]||t[2]<0||o.data.width<t[2]||t[3]<0||o.data.height<t[3]||t[2]<t[0]||t[3]<t[1]))}updateImage(t,o){o.version=this.images[t].version+1,this.images[t]=o,this.updatedImages[t]=!0}removeImage(t){const o=this.images[t];delete this.images[t],delete this.patterns[t],o.userImage&&o.userImage.onRemove&&o.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(t,o){let h=!0;if(!this.isLoaded())for(const p of t)this.images[p]||(h=!1);this.isLoaded()||h?this._notify(t,o):this.requestors.push({ids:t,callback:o})}_notify(t,o){const h={};for(const p of t){this.images[p]||this.fire(new l.Event("styleimagemissing",{id:p}));const y=this.images[p];y?h[p]={data:y.data.clone(),pixelRatio:y.pixelRatio,sdf:y.sdf,version:y.version,stretchX:y.stretchX,stretchY:y.stretchY,content:y.content,hasRenderCallback:Boolean(y.userImage&&y.userImage.render)}:l.warnOnce(`Image "${p}" 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.`)}o(null,h)}getPixelSize(){const{width:t,height:o}=this.atlasImage;return{width:t,height:o}}getPattern(t){const o=this.patterns[t],h=this.getImage(t);if(!h)return null;if(o&&o.position.version===h.version)return o.position;if(o)o.position.version=h.version;else{const p={w:h.data.width+2,h:h.data.height+2,x:0,y:0},y=new l.ImagePosition(p,h);this.patterns[t]={bin:p,position:y}}return this._updatePatternAtlas(),this.patterns[t].position}bind(t){const o=t.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new Ge(t,this.atlasImage,o.RGBA),this.atlasTexture.bind(o.LINEAR,o.CLAMP_TO_EDGE)}_updatePatternAtlas(){const t=[];for(const y in this.patterns)t.push(this.patterns[y].bin);const{w:o,h}=l.potpack(t),p=this.atlasImage;p.resize({width:o||1,height:h||1});for(const y in this.patterns){const{bin:v}=this.patterns[y],S=v.x+1,T=v.y+1,A=this.images[y].data,k=A.width,R=A.height;l.RGBAImage.copy(A,p,{x:0,y:0},{x:S,y:T},{width:k,height:R}),l.RGBAImage.copy(A,p,{x:0,y:R-1},{x:S,y:T-1},{width:k,height:1}),l.RGBAImage.copy(A,p,{x:0,y:0},{x:S,y:T+R},{width:k,height:1}),l.RGBAImage.copy(A,p,{x:k-1,y:0},{x:S-1,y:T},{width:1,height:R}),l.RGBAImage.copy(A,p,{x:0,y:0},{x:S+k,y:T},{width:1,height:R})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(t){for(const o of t){if(this.callbackDispatchedThisFrame[o])continue;this.callbackDispatchedThisFrame[o]=!0;const h=this.images[o];lt(h)&&this.updateImage(o,h)}}}const Xe=1e20;function xt(d,t,o,h,p,y,v,S,T){for(let A=t;A<t+h;A++)At(d,o*y+A,y,p,v,S,T);for(let A=o;A<o+p;A++)At(d,A*y+t,1,h,v,S,T)}function At(d,t,o,h,p,y,v){y[0]=0,v[0]=-Xe,v[1]=Xe,p[0]=d[t];for(let S=1,T=0,A=0;S<h;S++){p[S]=d[t+S*o];const k=S*S;do{const R=y[T];A=(p[S]-p[R]+k-R*R)/(S-R)/2}while(A<=v[T]&&--T>-1);T++,y[T]=S,v[T]=A,v[T+1]=Xe}for(let S=0,T=0;S<h;S++){for(;v[T+1]<S;)T++;const A=y[T],k=S-A;d[t+S*o]=p[A]+k*k}}class pi{constructor(t,o){this.requestManager=t,this.localIdeographFontFamily=o,this.entries={}}setURL(t){this.url=t}getGlyphs(t,o){const h=[];for(const p in t)for(const y of t[p])h.push({stack:p,id:y});l.asyncAll(h,({stack:p,id:y},v)=>{let S=this.entries[p];S||(S=this.entries[p]={glyphs:{},requests:{},ranges:{}});let T=S.glyphs[y];if(T!==void 0)return void v(null,{stack:p,id:y,glyph:T});if(T=this._tinySDF(S,p,y),T)return S.glyphs[y]=T,void v(null,{stack:p,id:y,glyph:T});const A=Math.floor(y/256);if(256*A>65535)return void v(new Error("glyphs > 65535 not supported"));if(S.ranges[A])return void v(null,{stack:p,id:y,glyph:T});let k=S.requests[A];k||(k=S.requests[A]=[],pi.loadGlyphRange(p,A,this.url,this.requestManager,(R,$)=>{if($){for(const q in $)this._doesCharSupportLocalGlyph(+q)||(S.glyphs[+q]=$[+q]);S.ranges[A]=!0}for(const q of k)q(R,$);delete S.requests[A]})),k.push((R,$)=>{R?v(R):$&&v(null,{stack:p,id:y,glyph:$[y]||null})})},(p,y)=>{if(p)o(p);else if(y){const v={};for(const{stack:S,id:T,glyph:A}of y)(v[S]||(v[S]={}))[T]=A&&{id:A.id,bitmap:A.bitmap.clone(),metrics:A.metrics};o(null,v)}})}_doesCharSupportLocalGlyph(t){return!!this.localIdeographFontFamily&&(l.unicodeBlockLookup["CJK Unified Ideographs"](t)||l.unicodeBlockLookup["Hangul Syllables"](t)||l.unicodeBlockLookup.Hiragana(t)||l.unicodeBlockLookup.Katakana(t))}_tinySDF(t,o,h){const p=this.localIdeographFontFamily;if(!p||!this._doesCharSupportLocalGlyph(h))return;let y=t.tinySDF;if(!y){let S="400";/bold/i.test(o)?S="900":/medium/i.test(o)?S="500":/light/i.test(o)&&(S="200"),y=t.tinySDF=new pi.TinySDF({fontSize:24,buffer:3,radius:8,cutoff:.25,fontFamily:p,fontWeight:S})}const v=y.draw(String.fromCharCode(h));return{id:h,bitmap:new l.AlphaImage({width:v.width||30,height:v.height||30},v.data),metrics:{width:v.glyphWidth||24,height:v.glyphHeight||24,left:v.glyphLeft||0,top:v.glyphTop-27||-8,advance:v.glyphAdvance||24}}}}pi.loadGlyphRange=function(d,t,o,h,p){const y=256*t,v=y+255,S=h.transformRequest(o.replace("{fontstack}",d).replace("{range}",`${y}-${v}`),l.ResourceType.Glyphs);l.getArrayBuffer(S,(T,A)=>{if(T)p(T);else if(A){const k={};for(const R of l.parseGlyphPBF(A))k[R.id]=R;p(null,k)}})},pi.TinySDF=class{constructor({fontSize:d=24,buffer:t=3,radius:o=8,cutoff:h=.25,fontFamily:p="sans-serif",fontWeight:y="normal",fontStyle:v="normal"}={}){this.buffer=t,this.cutoff=h,this.radius=o;const S=this.size=d+4*t,T=this._createCanvas(S),A=this.ctx=T.getContext("2d",{willReadFrequently:!0});A.font=`${v} ${y} ${d}px ${p}`,A.textBaseline="alphabetic",A.textAlign="left",A.fillStyle="black",this.gridOuter=new Float64Array(S*S),this.gridInner=new Float64Array(S*S),this.f=new Float64Array(S),this.z=new Float64Array(S+1),this.v=new Uint16Array(S)}_createCanvas(d){const t=document.createElement("canvas");return t.width=t.height=d,t}draw(d){const{width:t,actualBoundingBoxAscent:o,actualBoundingBoxDescent:h,actualBoundingBoxLeft:p,actualBoundingBoxRight:y}=this.ctx.measureText(d),v=Math.ceil(o),S=Math.min(this.size-this.buffer,Math.ceil(y-p)),T=Math.min(this.size-this.buffer,v+Math.ceil(h)),A=S+2*this.buffer,k=T+2*this.buffer,R=Math.max(A*k,0),$=new Uint8ClampedArray(R),q={data:$,width:A,height:k,glyphWidth:S,glyphHeight:T,glyphTop:v,glyphLeft:0,glyphAdvance:t};if(S===0||T===0)return q;const{ctx:N,buffer:j,gridInner:ie,gridOuter:re}=this;N.clearRect(j,j,S,T),N.fillText(d,j,j+v);const ae=N.getImageData(j,j,S,T);re.fill(Xe,0,R),ie.fill(0,0,R);for(let ne=0;ne<T;ne++)for(let ge=0;ge<S;ge++){const he=ae.data[4*(ne*S+ge)+3]/255;if(he===0)continue;const de=(ne+j)*A+ge+j;if(he===1)re[de]=0,ie[de]=Xe;else{const Se=.5-he;re[de]=Se>0?Se*Se:0,ie[de]=Se<0?Se*Se:0}}xt(re,0,0,A,k,A,this.f,this.v,this.z),xt(ie,j,j,S,T,A,this.f,this.v,this.z);for(let ne=0;ne<R;ne++){const ge=Math.sqrt(re[ne])-Math.sqrt(ie[ne]);$[ne]=Math.round(255-255*(ge/this.radius+this.cutoff))}return q}};const Bi=new l.Properties({anchor:new l.DataConstantProperty(l.spec.light.anchor),position:new class{constructor(){this.specification=l.spec.light.position}possiblyEvaluate(d,t){return l.sphericalToCartesian(d.expression.evaluate(t))}interpolate(d,t,o){return{x:l.number(d.x,t.x,o),y:l.number(d.y,t.y,o),z:l.number(d.z,t.z,o)}}},color:new l.DataConstantProperty(l.spec.light.color),intensity:new l.DataConstantProperty(l.spec.light.intensity)}),Oi="-transition";class Wt extends l.Evented{constructor(t){super(),this._transitionable=new l.Transitionable(Bi),this.setLight(t),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,o={}){if(!this._validate(l.validateLight,t,o))for(const h in t){const p=t[h];h.endsWith(Oi)?this._transitionable.setTransition(h.slice(0,-Oi.length),p):this._transitionable.setValue(h,p)}}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,o,h){return(!h||h.validate!==!1)&&l.emitValidationErrors(this,t.call(l.validateStyle,l.extend({value:o,style:{glyphs:!0,sprite:!0},styleSpec:l.spec})))}}class Bt{constructor(t,o){this.width=t,this.height=o,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(t,o){const h=t.join(",")+String(o);return this.dashEntry[h]||(this.dashEntry[h]=this.addDash(t,o)),this.dashEntry[h]}getDashRanges(t,o,h){const p=[];let y=t.length%2==1?-t[t.length-1]*h:0,v=t[0]*h,S=!0;p.push({left:y,right:v,isDash:S,zeroLength:t[0]===0});let T=t[0];for(let A=1;A<t.length;A++){S=!S;const k=t[A];y=T*h,T+=k,v=T*h,p.push({left:y,right:v,isDash:S,zeroLength:k===0})}return p}addRoundDash(t,o,h){const p=o/2;for(let y=-h;y<=h;y++){const v=this.width*(this.nextRow+h+y);let S=0,T=t[S];for(let A=0;A<this.width;A++){A/T.right>1&&(T=t[++S]);const k=Math.abs(A-T.left),R=Math.abs(A-T.right),$=Math.min(k,R);let q;const N=y/h*(p+1);if(T.isDash){const j=p-Math.abs(N);q=Math.sqrt($*$+j*j)}else q=p-Math.sqrt($*$+N*N);this.data[v+A]=Math.max(0,Math.min(255,q+128))}}}addRegularDash(t){for(let S=t.length-1;S>=0;--S){const T=t[S],A=t[S+1];T.zeroLength?t.splice(S,1):A&&A.isDash===T.isDash&&(A.left=T.left,t.splice(S,1))}const o=t[0],h=t[t.length-1];o.isDash===h.isDash&&(o.left=h.left-this.width,h.right=o.right+this.width);const p=this.width*this.nextRow;let y=0,v=t[y];for(let S=0;S<this.width;S++){S/v.right>1&&(v=t[++y]);const T=Math.abs(S-v.left),A=Math.abs(S-v.right),k=Math.min(T,A);this.data[p+S]=Math.max(0,Math.min(255,(v.isDash?k:-k)+128))}}addDash(t,o){const h=o?7:0,p=2*h+1;if(this.nextRow+p>this.height)return l.warnOnce("LineAtlas out of space"),null;let y=0;for(let S=0;S<t.length;S++)y+=t[S];if(y!==0){const S=this.width/y,T=this.getDashRanges(t,this.width,S);o?this.addRoundDash(T,S,h):this.addRegularDash(T)}const v={y:(this.nextRow+h+.5)/this.height,height:2*h/this.height,width:y};return this.nextRow+=p,this.dirty=!0,v}bind(t){const o=t.gl;this.texture?(o.bindTexture(o.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,o.texSubImage2D(o.TEXTURE_2D,0,0,0,this.width,this.height,o.ALPHA,o.UNSIGNED_BYTE,this.data))):(this.texture=o.createTexture(),o.bindTexture(o.TEXTURE_2D,this.texture),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.REPEAT),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.REPEAT),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,o.LINEAR),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,o.LINEAR),o.texImage2D(o.TEXTURE_2D,0,o.ALPHA,this.width,this.height,0,o.ALPHA,o.UNSIGNED_BYTE,this.data))}}class Ht{constructor(t,o){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=l.uniqueId();const h=this.workerPool.acquire(this.id);for(let p=0;p<h.length;p++){const y=new Ht.Actor(h[p],o,this.id);y.name=`Worker ${p}`,this.actors.push(y)}}broadcast(t,o,h){l.asyncAll(this.actors,(p,y)=>{p.send(t,o,y)},h=h||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 Ui(d,t,o){const h=function(p,y){if(p)return o(p);if(y){const v=l.pick(l.extend(y,d),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);y.vector_layers&&(v.vectorLayers=y.vector_layers,v.vectorLayerIds=v.vectorLayers.map(S=>S.id)),o(null,v)}};return d.url?l.getJSON(t.transformRequest(d.url,l.ResourceType.Source),h):l.exported.frame(()=>h(null,d))}Ht.Actor=l.Actor;class Ye{constructor(t,o,h){this.bounds=l.LngLatBounds.convert(this.validateBounds(t)),this.minzoom=o||0,this.maxzoom=h||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 o=Math.pow(2,t.z),h=Math.floor(l.mercatorXfromLng(this.bounds.getWest())*o),p=Math.floor(l.mercatorYfromLat(this.bounds.getNorth())*o),y=Math.ceil(l.mercatorXfromLng(this.bounds.getEast())*o),v=Math.ceil(l.mercatorYfromLat(this.bounds.getSouth())*o);return t.x>=h&&t.x<y&&t.y>=p&&t.y<v}}class pr extends l.Evented{constructor(t,o,h,p){if(super(),this.id=t,this.dispatcher=h,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,l.extend(this,l.pick(o,["url","scheme","tileSize","promoteId"])),this._options=l.extend({type:"vector"},o),this._collectResourceTiming=o.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(p)}load(){this._loaded=!1,this.fire(new l.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=Ui(this._options,this.map._requestManager,(t,o)=>{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),t?this.fire(new l.ErrorEvent(t)):o&&(l.extend(this,o),o.bounds&&(this.tileBounds=new Ye(o.bounds,this.minzoom,this.maxzoom)),this.fire(new l.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new l.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 l.extend({},this._options)}loadTile(t,o){const h=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),p={request:this.map._requestManager.transformRequest(h,l.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 y(v,S){return delete t.request,t.aborted?o(null):v&&v.status!==404?o(v):(S&&S.resourceTiming&&(t.resourceTiming=S.resourceTiming),this.map._refreshExpiredTiles&&S&&t.setExpiryData(S),t.loadVectorData(S,this.map.painter),l.cacheEntryPossiblyAdded(this.dispatcher),o(null),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}p.request.collectResourceTiming=this._collectResourceTiming,t.actor&&t.state!=="expired"?t.state==="loading"?t.reloadCallback=o:t.request=t.actor.send("reloadTile",p,y.bind(this)):(t.actor=this.dispatcher.getActor(),t.request=t.actor.send("loadTile",p,y.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 qi extends l.Evented{constructor(t,o,h,p){super(),this.id=t,this.dispatcher=h,this.setEventedParent(p),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=l.extend({type:"raster"},o),l.extend(this,l.pick(o,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new l.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=Ui(this._options,this.map._requestManager,(t,o)=>{this._tileJSONRequest=null,this._loaded=!0,t?this.fire(new l.ErrorEvent(t)):o&&(l.extend(this,o),o.bounds&&(this.tileBounds=new Ye(o.bounds,this.minzoom,this.maxzoom)),this.fire(new l.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new l.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 l.extend({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t,o){const h=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.request=l.getImage(this.map._requestManager.transformRequest(h,l.ResourceType.Tile),(p,y,v)=>{if(delete t.request,t.aborted)t.state="unloaded",o(null);else if(p)t.state="errored",o(p);else if(y){this.map._refreshExpiredTiles&&t.setExpiryData(v);const S=this.map.painter.context,T=S.gl;t.texture=this.map.painter.getTileTexture(y.width),t.texture?t.texture.update(y,{useMipmap:!0}):(t.texture=new Ge(S,y,T.RGBA,{useMipmap:!0}),t.texture.bind(T.LINEAR,T.CLAMP_TO_EDGE,T.LINEAR_MIPMAP_NEAREST),S.extTextureFilterAnisotropic&&T.texParameterf(T.TEXTURE_2D,S.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,S.extTextureFilterAnisotropicMax)),t.state="loaded",l.cacheEntryPossiblyAdded(this.dispatcher),o(null)}})}abortTile(t,o){t.request&&(t.request.cancel(),delete t.request),o()}unloadTile(t,o){t.texture&&this.map.painter.saveTileTexture(t.texture),o()}hasTransition(){return!1}}let rr;class mr extends qi{constructor(t,o,h,p){super(t,o,h,p),this.type="raster-dem",this.maxzoom=22,this._options=l.extend({type:"raster-dem"},o),this.encoding=o.encoding||"mapbox"}serialize(){return{type:"raster-dem",url:this.url,tileSize:this.tileSize,tiles:this.tiles,bounds:this.bounds,encoding:this.encoding}}loadTile(t,o){const h=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);function p(y,v){y&&(t.state="errored",o(y)),v&&(t.dem=v,t.needsHillshadePrepare=!0,t.state="loaded",o(null))}t.request=l.getImage(this.map._requestManager.transformRequest(h,l.ResourceType.Tile),function(y,v){if(delete t.request,t.aborted)t.state="unloaded",o(null);else if(y)t.state="errored",o(y);else if(v){this.map._refreshExpiredTiles&&t.setExpiryData(v),delete v.cacheControl,delete v.expires;const S=l.isImageBitmap(v)&&(rr==null&&(rr=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),rr)?v:l.exported.getImageData(v,1),T={uid:t.uid,coord:t.tileID,source:this.id,rawImageData:S,encoding:this.encoding};t.actor&&t.state!=="expired"||(t.actor=this.dispatcher.getActor(),t.actor.send("loadDEMTile",T,p.bind(this)))}}.bind(this)),t.neighboringTiles=this._getNeighboringTiles(t.tileID)}_getNeighboringTiles(t){const o=t.canonical,h=Math.pow(2,o.z),p=(o.x-1+h)%h,y=o.x===0?t.wrap-1:t.wrap,v=(o.x+1+h)%h,S=o.x+1===h?t.wrap+1:t.wrap,T={};return T[new l.OverscaledTileID(t.overscaledZ,y,o.z,p,o.y).key]={backfilled:!1},T[new l.OverscaledTileID(t.overscaledZ,S,o.z,v,o.y).key]={backfilled:!1},o.y>0&&(T[new l.OverscaledTileID(t.overscaledZ,y,o.z,p,o.y-1).key]={backfilled:!1},T[new l.OverscaledTileID(t.overscaledZ,t.wrap,o.z,o.x,o.y-1).key]={backfilled:!1},T[new l.OverscaledTileID(t.overscaledZ,S,o.z,v,o.y-1).key]={backfilled:!1}),o.y+1<h&&(T[new l.OverscaledTileID(t.overscaledZ,y,o.z,p,o.y+1).key]={backfilled:!1},T[new l.OverscaledTileID(t.overscaledZ,t.wrap,o.z,o.x,o.y+1).key]={backfilled:!1},T[new l.OverscaledTileID(t.overscaledZ,S,o.z,v,o.y+1).key]={backfilled:!1}),T}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 hn extends l.Evented{constructor(t,o,h,p){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=h.getActor(),this.setEventedParent(p),this._data=o.data,this._options=l.extend({},o),this._collectResourceTiming=o.collectResourceTiming,o.maxzoom!==void 0&&(this.maxzoom=o.maxzoom),o.type&&(this.type=o.type),o.attribution&&(this.attribution=o.attribution),this.promoteId=o.promoteId;const y=l.EXTENT/this.tileSize;this.workerOptions=l.extend({source:this.id,cluster:o.cluster||!1,geojsonVtOptions:{buffer:(o.buffer!==void 0?o.buffer:128)*y,tolerance:(o.tolerance!==void 0?o.tolerance:.375)*y,extent:l.EXTENT,maxZoom:this.maxzoom,lineMetrics:o.lineMetrics||!1,generateId:o.generateId||!1},superclusterOptions:{maxZoom:o.clusterMaxZoom!==void 0?o.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,o.clusterMinPoints||2),extent:l.EXTENT,radius:(o.clusterRadius||50)*y,log:!1,generateId:o.generateId||!1},clusterProperties:o.clusterProperties,filter:o.filter},o.workerOptions)}load(){this._updateWorkerData("metadata")}onAdd(t){this.map=t,this.load()}setData(t){return this._data=t,this._updateWorkerData("content"),this}getClusterExpansionZoom(t,o){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:t,source:this.id},o),this}getClusterChildren(t,o){return this.actor.send("geojson.getClusterChildren",{clusterId:t,source:this.id},o),this}getClusterLeaves(t,o,h,p){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:t,limit:o,offset:h},p),this}_updateWorkerData(t){const o=l.extend({},this.workerOptions),h=this._data;typeof h=="string"?(o.request=this.map._requestManager.transformRequest(l.exported.resolveURL(h),l.ResourceType.Source),o.request.collectResourceTiming=this._collectResourceTiming):o.data=JSON.stringify(h),this._pendingLoads++,this.fire(new l.Event("dataloading",{dataType:"source"})),this.actor.send(`${this.type}.loadData`,o,(p,y)=>{if(this._pendingLoads--,this._removed||y&&y.abandoned)return;let v=null;if(y&&y.resourceTiming&&y.resourceTiming[this.id]&&(v=y.resourceTiming[this.id].slice(0)),this.actor.send(`${this.type}.coalesce`,{source:o.source},null),p)return void this.fire(new l.ErrorEvent(p));const S={dataType:"source",sourceDataType:t};this._collectResourceTiming&&v&&v.length>0&&l.extend(S,{resourceTiming:v}),this.fire(new l.Event("data",S))})}loaded(){return this._pendingLoads===0}loadTile(t,o){const h=t.actor?"reloadTile":"loadTile";t.actor=this.actor;const p={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(h,p,(y,v)=>(delete t.request,t.unloadVectorData(),t.aborted?o(null):y?o(y):(t.loadVectorData(v,this.map.painter,h==="reloadTile"),o(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 l.extend({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var un=l.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class $r extends l.Evented{constructor(t,o,h,p){super(),this.id=t,this.dispatcher=h,this.coordinates=o.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(p),this.options=o}load(t,o){this._loaded=!1,this.fire(new l.Event("dataloading",{dataType:"source"})),this.url=this.options.url,l.getImage(this.map._requestManager.transformRequest(this.url,l.ResourceType.Image),(h,p)=>{this._loaded=!0,h?this.fire(new l.ErrorEvent(h)):p&&(this.image=p,t&&(this.coordinates=t),o&&o(),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 l.Event("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}setCoordinates(t){this.coordinates=t;const o=t.map(l.MercatorCoordinate.fromLngLat);this.tileID=function(p){let y=1/0,v=1/0,S=-1/0,T=-1/0;for(const $ of p)y=Math.min(y,$.x),v=Math.min(v,$.y),S=Math.max(S,$.x),T=Math.max(T,$.y);const A=Math.max(S-y,T-v),k=Math.max(0,Math.floor(-Math.log(A)/Math.LN2)),R=Math.pow(2,k);return new l.CanonicalTileID(k,Math.floor((y+S)/2*R),Math.floor((v+T)/2*R))}(o),this.minzoom=this.maxzoom=this.tileID.z;const h=o.map(p=>this.tileID.getTilePoint(p)._round());return this._boundsArray=new l.RasterBoundsArray,this._boundsArray.emplaceBack(h[0].x,h[0].y,0,0),this._boundsArray.emplaceBack(h[1].x,h[1].y,l.EXTENT,0),this._boundsArray.emplaceBack(h[3].x,h[3].y,0,l.EXTENT),this._boundsArray.emplaceBack(h[2].x,h[2].y,l.EXTENT,l.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new l.Event("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const t=this.map.painter.context,o=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,un.members)),this.boundsSegments||(this.boundsSegments=l.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new Ge(t,this.image,o.RGBA),this.texture.bind(o.LINEAR,o.CLAMP_TO_EDGE));for(const h in this.tiles){const p=this.tiles[h];p.state!=="loaded"&&(p.state="loaded",p.texture=this.texture)}}loadTile(t,o){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={},o(null)):(t.state="errored",o(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class en extends $r{constructor(t,o,h,p){super(t,o,h,p),this.roundZoom=!0,this.type="video",this.options=o}load(){this._loaded=!1;const t=this.options;this.urls=[];for(const o of t.urls)this.urls.push(this.map._requestManager.transformRequest(o,l.ResourceType.Source).url);l.getVideo(this.urls,(o,h)=>{this._loaded=!0,o?this.fire(new l.ErrorEvent(o)):h&&(this.video=h,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 o=this.video.seekable;t<o.start(0)||t>o.end(0)?this.fire(new l.ErrorEvent(new l.ValidationError(`sources.${this.id}`,null,`Playback for this video can be set only between the ${o.start(0)} and ${o.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,o=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,un.members)),this.boundsSegments||(this.boundsSegments=l.SegmentVector.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(o.LINEAR,o.CLAMP_TO_EDGE),o.texSubImage2D(o.TEXTURE_2D,0,0,0,o.RGBA,o.UNSIGNED_BYTE,this.video)):(this.texture=new Ge(t,this.video,o.RGBA),this.texture.bind(o.LINEAR,o.CLAMP_TO_EDGE));for(const h in this.tiles){const p=this.tiles[h];p.state!=="loaded"&&(p.state="loaded",p.texture=this.texture)}}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class dn extends $r{constructor(t,o,h,p){super(t,o,h,p),o.coordinates?Array.isArray(o.coordinates)&&o.coordinates.length===4&&!o.coordinates.some(y=>!Array.isArray(y)||y.length!==2||y.some(v=>typeof v!="number"))||this.fire(new l.ErrorEvent(new l.ValidationError(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new l.ErrorEvent(new l.ValidationError(`sources.${t}`,null,'missing required property "coordinates"'))),o.animate&&typeof o.animate!="boolean"&&this.fire(new l.ErrorEvent(new l.ValidationError(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),o.canvas?typeof o.canvas=="string"||o.canvas instanceof HTMLCanvasElement||this.fire(new l.ErrorEvent(new l.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 l.ErrorEvent(new l.ValidationError(`sources.${t}`,null,'missing required property "canvas"'))),this.options=o,this.animate=o.animate===void 0||o.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 l.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 o=this.map.painter.context,h=o.gl;this.boundsBuffer||(this.boundsBuffer=o.createVertexBuffer(this._boundsArray,un.members)),this.boundsSegments||(this.boundsSegments=l.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new Ge(o,this.canvas,h.RGBA,{premultiply:!0});for(const p in this.tiles){const y=this.tiles[p];y.state!=="loaded"&&(y.state="loaded",y.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 fr={vector:pr,raster:qi,"raster-dem":mr,geojson:hn,video:en,image:$r,canvas:dn};function Nr(d,t){const o=l.create();return l.translate(o,o,[1,1,0]),l.scale(o,o,[.5*d.width,.5*d.height,1]),l.multiply(o,o,d.calculatePosMatrix(t.toUnwrapped()))}function Vr(d,t,o,h,p,y){const v=function(R,$,q){if(R)for(const N of R){const j=$[N];if(j&&j.source===q&&j.type==="fill-extrusion")return!0}else for(const N in $){const j=$[N];if(j.source===q&&j.type==="fill-extrusion")return!0}return!1}(p&&p.layers,t,d.id),S=y.maxPitchScaleFactor(),T=d.tilesIn(h,S,v);T.sort(Nn);const A=[];for(const R of T)A.push({wrappedTileID:R.tileID.wrapped().key,queryResults:R.tile.queryRenderedFeatures(t,o,d._state,R.queryGeometry,R.cameraQueryGeometry,R.scale,p,y,S,Nr(d.transform,R.tileID))});const k=function(R){const $={},q={};for(const N of R){const j=N.queryResults,ie=N.wrappedTileID,re=q[ie]=q[ie]||{};for(const ae in j){const ne=j[ae],ge=re[ae]=re[ae]||{},he=$[ae]=$[ae]||[];for(const de of ne)ge[de.featureIndex]||(ge[de.featureIndex]=!0,he.push(de))}}return $}(A);for(const R in k)k[R].forEach($=>{const q=$.feature,N=d.getFeatureState(q.layer["source-layer"],q.id);q.source=q.layer.source,q.layer["source-layer"]&&(q.sourceLayer=q.layer["source-layer"]),q.state=N});return k}function Nn(d,t){const o=d.tileID,h=t.tileID;return o.overscaledZ-h.overscaledZ||o.canonical.y-h.canonical.y||o.wrap-h.wrap||o.canonical.x-h.canonical.x}class jo{constructor(t,o){this.tileID=t,this.uid=l.uniqueId(),this.uses=0,this.tileSize=o,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 o=t+this.timeAdded;o<l.exported.now()||this.fadeEndTime&&o<this.fadeEndTime||(this.fadeEndTime=o)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}loadVectorData(t,o,h){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(p,y){const v={};if(!y)return v;for(const S of p){const T=S.layerIds.map(A=>y.getLayer(A)).filter(Boolean);if(T.length!==0){S.layers=T,S.stateDependentLayerIds&&(S.stateDependentLayers=S.stateDependentLayerIds.map(A=>T.filter(k=>k.id===A)[0]));for(const A of T)v[A.id]=S}}return v}(t.buckets,o.style),this.hasSymbolBuckets=!1;for(const p in this.buckets){const y=this.buckets[p];if(y instanceof l.SymbolBucket){if(this.hasSymbolBuckets=!0,!h)break;y.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const p in this.buckets){const y=this.buckets[p];if(y instanceof l.SymbolBucket&&y.hasRTLText){this.hasRTLText=!0,l.lazyLoadRTLTextPlugin();break}}this.queryPadding=0;for(const p in this.buckets){const y=this.buckets[p];this.queryPadding=Math.max(this.queryPadding,o.style.getLayer(p).queryRadius(y))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage)}else this.collisionBoxArray=new l.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 h in this.buckets){const p=this.buckets[h];p.uploadPending()&&p.upload(t)}const o=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Ge(t,this.imageAtlas.image,o.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Ge(t,this.glyphAtlasImage,o.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,o,h,p,y,v,S,T,A,k){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:p,cameraQueryGeometry:y,scale:v,tileSize:this.tileSize,pixelPosMatrix:k,transform:T,params:S,queryPadding:this.queryPadding*A},t,o,h):{}}querySourceFeatures(t,o){const h=this.latestFeatureIndex;if(!h||!h.rawTileData)return;const p=h.loadVTLayers(),y=o?o.sourceLayer:"",v=p._geojsonTileLayer||p[y];if(!v)return;const S=l.createFilter(o&&o.filter),{z:T,x:A,y:k}=this.tileID.canonical,R={z:T,x:A,y:k};for(let $=0;$<v.length;$++){const q=v.feature($);if(S.needGeometry){const ie=l.toEvaluationFeature(q,!0);if(!S.filter(new l.EvaluationParameters(this.tileID.overscaledZ),ie,this.tileID.canonical))continue}else if(!S.filter(new l.EvaluationParameters(this.tileID.overscaledZ),q))continue;const N=h.getId(q,y),j=new l.GeoJSONFeature(q,T,A,k,N);j.tile=R,t.push(j)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(t){const o=this.expirationTime;if(t.cacheControl){const h=l.parseCacheControl(t.cacheControl);h["max-age"]&&(this.expirationTime=Date.now()+1e3*h["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){const h=Date.now();let p=!1;if(this.expirationTime>h)p=!1;else if(o)if(this.expirationTime<o)p=!0;else{const y=this.expirationTime-o;y?this.expirationTime=h+Math.max(y,3e4):p=!0}else p=!0;p?(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,o){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(t).length===0)return;const h=this.latestFeatureIndex.loadVTLayers();for(const p in this.buckets){if(!o.style.hasLayer(p))continue;const y=this.buckets[p],v=y.layers[0].sourceLayer||"_geojsonTileLayer",S=h[v],T=t[v];if(!S||!T||Object.keys(T).length===0)continue;y.update(T,S,this.imageAtlas&&this.imageAtlas.patternPositions||{});const A=o&&o.style&&o.style.getLayer(p);A&&(this.queryPadding=Math.max(this.queryPadding,A.queryRadius(y)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<l.exported.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(t){this.symbolFadeHoldUntil=l.exported.now()+t}setDependencies(t,o){const h={};for(const p of o)h[p]=!0;this.dependencies[t]=h}hasDependency(t,o){for(const h of t){const p=this.dependencies[h];if(p){for(const y of o)if(p[y])return!0}}return!1}}class uo{constructor(t,o){this.max=t,this.onRemove=o,this.reset()}reset(){for(const t in this.data)for(const o of this.data[t])o.timeout&&clearTimeout(o.timeout),this.onRemove(o.value);return this.data={},this.order=[],this}add(t,o,h){const p=t.wrapped().key;this.data[p]===void 0&&(this.data[p]=[]);const y={value:o,timeout:void 0};if(h!==void 0&&(y.timeout=setTimeout(()=>{this.remove(t,y)},h)),this.data[p].push(y),this.order.push(p),this.order.length>this.max){const v=this._getAndRemoveByKey(this.order[0]);v&&this.onRemove(v)}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 o=this.data[t].shift();return o.timeout&&clearTimeout(o.timeout),this.data[t].length===0&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),o.value}getByKey(t){const o=this.data[t];return o?o[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,o){if(!this.has(t))return this;const h=t.wrapped().key,p=o===void 0?0:this.data[h].indexOf(o),y=this.data[h][p];return this.data[h].splice(p,1),y.timeout&&clearTimeout(y.timeout),this.data[h].length===0&&delete this.data[h],this.onRemove(y.value),this.order.splice(this.order.indexOf(h),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const o=this._getAndRemoveByKey(this.order[0]);o&&this.onRemove(o)}return this}filter(t){const o=[];for(const h in this.data)for(const p of this.data[h])t(p.value)||o.push(p);for(const h of o)this.remove(h.value.tileID,h)}}class qo{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,o,h){const p=String(o);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][p]=this.stateChanges[t][p]||{},l.extend(this.stateChanges[t][p],h),this.deletedStates[t]===null){this.deletedStates[t]={};for(const y in this.state[t])y!==p&&(this.deletedStates[t][y]=null)}else if(this.deletedStates[t]&&this.deletedStates[t][p]===null){this.deletedStates[t][p]={};for(const y in this.state[t][p])h[y]||(this.deletedStates[t][p][y]=null)}else for(const y in h)this.deletedStates[t]&&this.deletedStates[t][p]&&this.deletedStates[t][p][y]===null&&delete this.deletedStates[t][p][y]}removeFeatureState(t,o,h){if(this.deletedStates[t]===null)return;const p=String(o);if(this.deletedStates[t]=this.deletedStates[t]||{},h&&o!==void 0)this.deletedStates[t][p]!==null&&(this.deletedStates[t][p]=this.deletedStates[t][p]||{},this.deletedStates[t][p][h]=null);else if(o!==void 0)if(this.stateChanges[t]&&this.stateChanges[t][p])for(h in this.deletedStates[t][p]={},this.stateChanges[t][p])this.deletedStates[t][p][h]=null;else this.deletedStates[t][p]=null;else this.deletedStates[t]=null}getState(t,o){const h=String(o),p=l.extend({},(this.state[t]||{})[h],(this.stateChanges[t]||{})[h]);if(this.deletedStates[t]===null)return{};if(this.deletedStates[t]){const y=this.deletedStates[t][o];if(y===null)return{};for(const v in y)delete p[v]}return p}initializeTileState(t,o){t.setFeatureState(this.state,o)}coalesceChanges(t,o){const h={};for(const p in this.stateChanges){this.state[p]=this.state[p]||{};const y={};for(const v in this.stateChanges[p])this.state[p][v]||(this.state[p][v]={}),l.extend(this.state[p][v],this.stateChanges[p][v]),y[v]=this.state[p][v];h[p]=y}for(const p in this.deletedStates){this.state[p]=this.state[p]||{};const y={};if(this.deletedStates[p]===null)for(const v in this.state[p])y[v]={},this.state[p][v]={};else for(const v in this.deletedStates[p]){if(this.deletedStates[p][v]===null)this.state[p][v]={};else for(const S of Object.keys(this.deletedStates[p][v]))delete this.state[p][v][S];y[v]=this.state[p][v]}h[p]=h[p]||{},l.extend(h[p],y)}if(this.stateChanges={},this.deletedStates={},Object.keys(h).length!==0)for(const p in t)t[p].setFeatureState(h,o)}}class mi extends l.Evented{constructor(t,o,h){super(),this.id=t,this.dispatcher=h,this.on("data",p=>{p.dataType==="source"&&p.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&p.dataType==="source"&&p.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(p,y,v,S){const T=new fr[y.type](p,y,v,S);if(T.id!==p)throw new Error(`Expected Source id to be ${p} instead of ${T.id}`);return l.bindAll(["load","abort","unload","serialize","prepare"],T),T}(t,o,h,this),this._tiles={},this._cache=new uo(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new qo}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 o=this._tiles[t];if(o.state!=="loaded"&&o.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,o){return this._source.loadTile(t,o)}_unloadTile(t){if(this._source.unloadTile)return this._source.unloadTile(t,()=>{})}_abortTile(t){this._source.abortTile&&this._source.abortTile(t,()=>{}),this._source.fire(new l.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 o in this._tiles){const h=this._tiles[o];h.upload(t),h.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(t=>t.tileID).sort(tn).map(t=>t.key)}getRenderableIds(t){const o=[];for(const h in this._tiles)this._isIdRenderable(h,t)&&o.push(this._tiles[h]);return t?o.sort((h,p)=>{const y=h.tileID,v=p.tileID,S=new l.pointGeometry(y.canonical.x,y.canonical.y)._rotate(this.transform.angle),T=new l.pointGeometry(v.canonical.x,v.canonical.y)._rotate(this.transform.angle);return y.overscaledZ-v.overscaledZ||T.y-S.y||T.x-S.x}).map(h=>h.tileID.key):o.map(h=>h.tileID).sort(tn).map(h=>h.key)}hasRenderableParent(t){const o=this.findLoadedParent(t,0);return!!o&&this._isIdRenderable(o.tileID.key)}_isIdRenderable(t,o){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(o||!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,o){const h=this._tiles[t];h&&(h.state!=="loading"&&(h.state=o),this._loadTile(h,this._tileLoaded.bind(this,h,t,o)))}_tileLoaded(t,o,h,p){if(p)return t.state="errored",void(p.status!==404?this._source.fire(new l.ErrorEvent(p,{tile:t})):this.update(this.transform));t.timeAdded=l.exported.now(),h==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(o,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 l.Event("data",{dataType:"source",tile:t,coord:t.tileID}))}_backfillDEM(t){const o=this.getRenderableIds();for(let p=0;p<o.length;p++){const y=o[p];if(t.neighboringTiles&&t.neighboringTiles[y]){const v=this.getTileByID(y);h(t,v),h(v,t)}}function h(p,y){p.needsHillshadePrepare=!0;let v=y.tileID.canonical.x-p.tileID.canonical.x;const S=y.tileID.canonical.y-p.tileID.canonical.y,T=Math.pow(2,p.tileID.canonical.z),A=y.tileID.key;v===0&&S===0||Math.abs(S)>1||(Math.abs(v)>1&&(Math.abs(v+T)===1?v+=T:Math.abs(v-T)===1&&(v-=T)),y.dem&&p.dem&&(p.dem.backfillBorder(y.dem,v,S),p.neighboringTiles&&p.neighboringTiles[A]&&(p.neighboringTiles[A].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,o,h,p){for(const y in this._tiles){let v=this._tiles[y];if(p[y]||!v.hasData()||v.tileID.overscaledZ<=o||v.tileID.overscaledZ>h)continue;let S=v.tileID;for(;v&&v.tileID.overscaledZ>o+1;){const A=v.tileID.scaledTo(v.tileID.overscaledZ-1);v=this._tiles[A.key],v&&v.hasData()&&(S=A)}let T=S;for(;T.overscaledZ>o;)if(T=T.scaledTo(T.overscaledZ-1),t[T.key]){p[S.key]=S;break}}}findLoadedParent(t,o){if(t.key in this._loadedParentTiles){const h=this._loadedParentTiles[t.key];return h&&h.tileID.overscaledZ>=o?h:null}for(let h=t.overscaledZ-1;h>=o;h--){const p=t.scaledTo(h),y=this._getLoadedTile(p);if(y)return y}}_getLoadedTile(t){const o=this._tiles[t.key];return o&&o.hasData()?o:this._cache.getByKey(t.wrapped().key)}updateCacheSize(t){const o=Math.ceil(t.width/this._source.tileSize)+1,h=Math.ceil(t.height/this._source.tileSize)+1,p=Math.floor(o*h*5),y=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,p):p;this._cache.setMaxSize(y)}handleWrapJump(t){const o=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);if(this._prevLng=t,o){const h={};for(const p in this._tiles){const y=this._tiles[p];y.tileID=y.tileID.unwrapTo(y.tileID.wrap+o),h[y.tileID.key]=y}this._tiles=h;for(const p in this._timers)clearTimeout(this._timers[p]),delete this._timers[p];for(const p in this._tiles)this._setTileReloadTimer(p,this._tiles[p])}}update(t){if(this.transform=t,!this._sourceLoaded||this._paused)return;let o;this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used?this._source.tileID?o=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(T=>new l.OverscaledTileID(T.canonical.z,T.wrap,T.canonical.z,T.canonical.x,T.canonical.y)):(o=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&&(o=o.filter(T=>this._source.hasTile(T)))):o=[];const h=t.coveringZoomLevel(this._source),p=Math.max(h-mi.maxOverzooming,this._source.minzoom),y=Math.max(h+mi.maxUnderzooming,this._source.minzoom),v=this._updateRetainedTiles(o,h);if(po(this._source.type)){const T={},A={},k=Object.keys(v);for(const R of k){const $=v[R],q=this._tiles[R];if(!q||q.fadeEndTime&&q.fadeEndTime<=l.exported.now())continue;const N=this.findLoadedParent($,p);N&&(this._addTile(N.tileID),T[N.tileID.key]=N.tileID),A[R]=$}this._retainLoadedChildren(A,h,y,v);for(const R in T)v[R]||(this._coveredTiles[R]=!0,v[R]=T[R])}for(const T in v)this._tiles[T].clearFadeHold();const S=l.keysDifference(this._tiles,v);for(const T of S){const A=this._tiles[T];A.hasSymbolBuckets&&!A.holdingForFade()?A.setHoldDuration(this.map._fadeDuration):A.hasSymbolBuckets&&!A.symbolFadeFinished()||this._removeTile(T)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)}_updateRetainedTiles(t,o){const h={},p={},y=Math.max(o-mi.maxOverzooming,this._source.minzoom),v=Math.max(o+mi.maxUnderzooming,this._source.minzoom),S={};for(const T of t){const A=this._addTile(T);h[T.key]=T,A.hasData()||o<this._source.maxzoom&&(S[T.key]=T)}this._retainLoadedChildren(S,o,v,h);for(const T of t){let A=this._tiles[T.key];if(A.hasData())continue;if(o+1>this._source.maxzoom){const R=T.children(this._source.maxzoom)[0],$=this.getTile(R);if($&&$.hasData()){h[R.key]=R;continue}}else{const R=T.children(this._source.maxzoom);if(h[R[0].key]&&h[R[1].key]&&h[R[2].key]&&h[R[3].key])continue}let k=A.wasRequested();for(let R=T.overscaledZ-1;R>=y;--R){const $=T.scaledTo(R);if(p[$.key]||(p[$.key]=!0,A=this.getTile($),!A&&k&&(A=this._addTile($)),A&&(h[$.key]=$,k=A.wasRequested(),A.hasData())))break}}return h}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const o=[];let h,p=this._tiles[t].tileID;for(;p.overscaledZ>0;){if(p.key in this._loadedParentTiles){h=this._loadedParentTiles[p.key];break}o.push(p.key);const y=p.scaledTo(p.overscaledZ-1);if(h=this._getLoadedTile(y),h)break;p=y}for(const y of o)this._loadedParentTiles[y]=h}}_addTile(t){let o=this._tiles[t.key];if(o)return o;o=this._cache.getAndRemove(t),o&&(this._setTileReloadTimer(t.key,o),o.tileID=t,this._state.initializeTileState(o,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,o)));const h=o;return o||(o=new jo(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(o,this._tileLoaded.bind(this,o,t.key,o.state))),o.uses++,this._tiles[t.key]=o,h||this._source.fire(new l.Event("dataloading",{tile:o,coord:o.tileID,dataType:"source"})),o}_setTileReloadTimer(t,o){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const h=o.getExpiryTimeout();h&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},h))}_removeTile(t){const o=this._tiles[t];o&&(o.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),o.uses>0||(o.hasData()&&o.state!=="reloading"?this._cache.add(o.tileID,o,o.getExpiryTimeout()):(o.aborted=!0,this._abortTile(o),this._unloadTile(o))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(t);this._cache.reset()}tilesIn(t,o,h){const p=[],y=this.transform;if(!y)return p;const v=h?y.getCameraQueryGeometry(t):t,S=t.map(N=>y.pointCoordinate(N)),T=v.map(N=>y.pointCoordinate(N)),A=this.getIds();let k=1/0,R=1/0,$=-1/0,q=-1/0;for(const N of T)k=Math.min(k,N.x),R=Math.min(R,N.y),$=Math.max($,N.x),q=Math.max(q,N.y);for(let N=0;N<A.length;N++){const j=this._tiles[A[N]];if(j.holdingForFade())continue;const ie=j.tileID,re=Math.pow(2,y.zoom-j.tileID.overscaledZ),ae=o*j.queryPadding*l.EXTENT/j.tileSize/re,ne=[ie.getTilePoint(new l.MercatorCoordinate(k,R)),ie.getTilePoint(new l.MercatorCoordinate($,q))];if(ne[0].x-ae<l.EXTENT&&ne[0].y-ae<l.EXTENT&&ne[1].x+ae>=0&&ne[1].y+ae>=0){const ge=S.map(de=>ie.getTilePoint(de)),he=T.map(de=>ie.getTilePoint(de));p.push({tile:j,tileID:ie,queryGeometry:ge,cameraQueryGeometry:he,scale:re})}}return p}getVisibleCoordinates(t){const o=this.getRenderableIds(t).map(h=>this._tiles[h].tileID);for(const h of o)h.posMatrix=this.transform.calculatePosMatrix(h.toUnwrapped());return o}hasTransition(){if(this._source.hasTransition())return!0;if(po(this._source.type))for(const t in this._tiles){const o=this._tiles[t];if(o.fadeEndTime!==void 0&&o.fadeEndTime>=l.exported.now())return!0}return!1}setFeatureState(t,o,h){this._state.updateState(t=t||"_geojsonTileLayer",o,h)}removeFeatureState(t,o,h){this._state.removeFeatureState(t=t||"_geojsonTileLayer",o,h)}getFeatureState(t,o){return this._state.getState(t=t||"_geojsonTileLayer",o)}setDependencies(t,o,h){const p=this._tiles[t];p&&p.setDependencies(o,h)}reloadTilesForDependencies(t,o){for(const h in this._tiles)this._tiles[h].hasDependency(t,o)&&this._reloadTile(h,"reloading");this._cache.filter(h=>!h.hasDependency(t,o))}}function tn(d,t){const o=Math.abs(2*d.wrap)-+(d.wrap<0),h=Math.abs(2*t.wrap)-+(t.wrap<0);return d.overscaledZ-t.overscaledZ||h-o||t.canonical.y-d.canonical.y||t.canonical.x-d.canonical.x}function po(d){return d==="raster"||d==="image"||d==="video"}mi.maxOverzooming=10,mi.maxUnderzooming=3;const pn="mapboxgl_preloaded_worker_pool";class Ir{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<Ir.workerCount;)this.workers.push(new Worker(Do.workerUrl));return this.active[t]=!0,this.workers.slice()}release(t){delete this.active[t],this.numActive()===0&&(this.workers.forEach(o=>{o.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[pn]}numActive(){return Object.keys(this.active).length}}const Wo=Math.floor(l.exported.hardwareConcurrency/2);let Gr;function Er(){return Gr||(Gr=new Ir),Gr}function Ar(d,t){const o={};for(const h in d)h!=="ref"&&(o[h]=d[h]);return l.refProperties.forEach(h=>{h in t&&(o[h]=t[h])}),o}function mo(d){d=d.slice();const t=Object.create(null);for(let o=0;o<d.length;o++)t[d[o].id]=d[o];for(let o=0;o<d.length;o++)"ref"in d[o]&&(d[o]=Ar(d[o],t[d[o].ref]));return d}Ir.workerCount=Math.max(Math.min(Wo,6),1);const yt={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 mn(d,t,o){o.push({command:yt.addSource,args:[d,t[d]]})}function rn(d,t,o){t.push({command:yt.removeSource,args:[d]}),o[d]=!0}function fn(d,t,o,h){rn(d,o,h),mn(d,t,o)}function fo(d,t,o){let h;for(h in d[o])if(Object.prototype.hasOwnProperty.call(d[o],h)&&h!=="data"&&!K(d[o][h],t[o][h]))return!1;for(h in t[o])if(Object.prototype.hasOwnProperty.call(t[o],h)&&h!=="data"&&!K(d[o][h],t[o][h]))return!1;return!0}function pe(d,t,o,h,p,y){let v;for(v in t=t||{},d=d||{})Object.prototype.hasOwnProperty.call(d,v)&&(K(d[v],t[v])||o.push({command:y,args:[h,v,t[v],p]}));for(v in t)Object.prototype.hasOwnProperty.call(t,v)&&!Object.prototype.hasOwnProperty.call(d,v)&&(K(d[v],t[v])||o.push({command:y,args:[h,v,t[v],p]}))}function Me(d){return d.id}function gn(d,t){return d[t.id]=t,d}class Zr{constructor(t,o){this.reset(t,o)}reset(t,o){this.points=t||[],this._distances=[0];for(let h=1;h<this.points.length;h++)this._distances[h]=this._distances[h-1]+this.points[h].dist(this.points[h-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(o||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(t){if(this.points.length===1)return this.points[0];t=l.clamp(t,0,1);let o=1,h=this._distances[o];const p=t*this.paddedLength+this.padding;for(;h<p&&o<this._distances.length;)h=this._distances[++o];const y=o-1,v=this._distances[y],S=h-v,T=S>0?(p-v)/S:0;return this.points[y].mult(1-T).add(this.points[o].mult(T))}}function zt(d,t){let o=!0;return d==="always"||d!=="never"&&t!=="never"||(o=!1),o}class nr{constructor(t,o,h){const p=this.boxCells=[],y=this.circleCells=[];this.xCellCount=Math.ceil(t/h),this.yCellCount=Math.ceil(o/h);for(let v=0;v<this.xCellCount*this.yCellCount;v++)p.push([]),y.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=o,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/o,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(t,o,h,p,y){this._forEachCell(o,h,p,y,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(o),this.bboxes.push(h),this.bboxes.push(p),this.bboxes.push(y)}insertCircle(t,o,h,p){this._forEachCell(o-p,h-p,o+p,h+p,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(o),this.circles.push(h),this.circles.push(p)}_insertBoxCell(t,o,h,p,y,v){this.boxCells[y].push(v)}_insertCircleCell(t,o,h,p,y,v){this.circleCells[y].push(v)}_query(t,o,h,p,y,v,S){if(h<0||t>this.width||p<0||o>this.height)return[];const T=[];if(t<=0&&o<=0&&this.width<=h&&this.height<=p){if(y)return[{key:null,x1:t,y1:o,x2:h,y2:p}];for(let A=0;A<this.boxKeys.length;A++)T.push({key:this.boxKeys[A],x1:this.bboxes[4*A],y1:this.bboxes[4*A+1],x2:this.bboxes[4*A+2],y2:this.bboxes[4*A+3]});for(let A=0;A<this.circleKeys.length;A++){const k=this.circles[3*A],R=this.circles[3*A+1],$=this.circles[3*A+2];T.push({key:this.circleKeys[A],x1:k-$,y1:R-$,x2:k+$,y2:R+$})}}else this._forEachCell(t,o,h,p,this._queryCell,T,{hitTest:y,overlapMode:v,seenUids:{box:{},circle:{}}},S);return T}query(t,o,h,p){return this._query(t,o,h,p,!1,null)}hitTest(t,o,h,p,y,v){return this._query(t,o,h,p,!0,y,v).length>0}hitTestCircle(t,o,h,p,y){const v=t-h,S=t+h,T=o-h,A=o+h;if(S<0||v>this.width||A<0||T>this.height)return!1;const k=[];return this._forEachCell(v,T,S,A,this._queryCellCircle,k,{hitTest:!0,overlapMode:p,circle:{x:t,y:o,radius:h},seenUids:{box:{},circle:{}}},y),k.length>0}_queryCell(t,o,h,p,y,v,S,T){const{seenUids:A,hitTest:k,overlapMode:R}=S,$=this.boxCells[y];if($!==null){const N=this.bboxes;for(const j of $)if(!A.box[j]){A.box[j]=!0;const ie=4*j,re=this.boxKeys[j];if(t<=N[ie+2]&&o<=N[ie+3]&&h>=N[ie+0]&&p>=N[ie+1]&&(!T||T(re))&&(!k||!zt(R,re.overlapMode))&&(v.push({key:re,x1:N[ie],y1:N[ie+1],x2:N[ie+2],y2:N[ie+3]}),k))return!0}}const q=this.circleCells[y];if(q!==null){const N=this.circles;for(const j of q)if(!A.circle[j]){A.circle[j]=!0;const ie=3*j,re=this.circleKeys[j];if(this._circleAndRectCollide(N[ie],N[ie+1],N[ie+2],t,o,h,p)&&(!T||T(re))&&(!k||!zt(R,re.overlapMode))){const ae=N[ie],ne=N[ie+1],ge=N[ie+2];if(v.push({key:re,x1:ae-ge,y1:ne-ge,x2:ae+ge,y2:ne+ge}),k)return!0}}}return!1}_queryCellCircle(t,o,h,p,y,v,S,T){const{circle:A,seenUids:k,overlapMode:R}=S,$=this.boxCells[y];if($!==null){const N=this.bboxes;for(const j of $)if(!k.box[j]){k.box[j]=!0;const ie=4*j,re=this.boxKeys[j];if(this._circleAndRectCollide(A.x,A.y,A.radius,N[ie+0],N[ie+1],N[ie+2],N[ie+3])&&(!T||T(re))&&!zt(R,re.overlapMode))return v.push(!0),!0}}const q=this.circleCells[y];if(q!==null){const N=this.circles;for(const j of q)if(!k.circle[j]){k.circle[j]=!0;const ie=3*j,re=this.circleKeys[j];if(this._circlesCollide(N[ie],N[ie+1],N[ie+2],A.x,A.y,A.radius)&&(!T||T(re))&&!zt(R,re.overlapMode))return v.push(!0),!0}}}_forEachCell(t,o,h,p,y,v,S,T){const A=this._convertToXCellCoord(t),k=this._convertToYCellCoord(o),R=this._convertToXCellCoord(h),$=this._convertToYCellCoord(p);for(let q=A;q<=R;q++)for(let N=k;N<=$;N++)if(y.call(this,t,o,h,p,this.xCellCount*N+q,v,S,T))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,o,h,p,y,v){const S=p-t,T=y-o,A=h+v;return A*A>S*S+T*T}_circleAndRectCollide(t,o,h,p,y,v,S){const T=(v-p)/2,A=Math.abs(t-(p+T));if(A>T+h)return!1;const k=(S-y)/2,R=Math.abs(o-(y+k));if(R>k+h)return!1;if(A<=T||R<=k)return!0;const $=A-T,q=R-k;return $*$+q*q<=h*h}}function Pi(d,t,o,h,p){const y=l.create();return t?(l.scale(y,y,[1/p,1/p,1]),o||l.rotateZ(y,y,h.angle)):l.multiply(y,h.labelPlaneMatrix,d),y}function yn(d,t,o,h,p){if(t){const y=l.clone(d);return l.scale(y,y,[p,p,1]),o||l.rotateZ(y,y,-h.angle),y}return h.glCoordMatrix}function Rt(d,t){const o=[d.x,d.y,0,1];kt(o,o,t);const h=o[3];return{point:new l.pointGeometry(o[0]/h,o[1]/h),signedDistanceFromCamera:h}}function Ee(d,t){return .5+d/t*.5}function ct(d,t){const o=d[0]/d[3],h=d[1]/d[3];return o>=-t[0]&&o<=t[0]&&h>=-t[1]&&h<=t[1]}function ot(d,t,o,h,p,y,v,S,T){const A=h?d.textSizeData:d.iconSizeData,k=l.evaluateSizeForZoom(A,o.transform.zoom),R=[256/o.width*2+1,256/o.height*2+1],$=h?d.text.dynamicLayoutVertexArray:d.icon.dynamicLayoutVertexArray;$.clear();const q=d.lineVertexArray,N=h?d.text.placedSymbolArray:d.icon.placedSymbolArray,j=o.transform.width/o.transform.height;let ie=!1;for(let re=0;re<N.length;re++){const ae=N.get(re);if(ae.hidden||ae.writingMode===l.WritingMode.vertical&&!ie){ii(ae.numGlyphs,$);continue}ie=!1;const ne=[ae.anchorX,ae.anchorY,0,1];if(l.transformMat4(ne,ne,t),!ct(ne,R)){ii(ae.numGlyphs,$);continue}const ge=Ee(o.transform.cameraToCenterDistance,ne[3]),he=l.evaluateSizeForFeature(A,k,ae),de=v?he/ge:he*ge,Se=new l.pointGeometry(ae.anchorX,ae.anchorY),Ce=Rt(Se,p).point,fe={},Ne=at(ae,de,!1,S,t,p,y,d.glyphOffsetArray,q,$,Ce,Se,fe,j,T);ie=Ne.useVertical,(Ne.notEnoughRoom||ie||Ne.needsFlipping&&at(ae,de,!0,S,t,p,y,d.glyphOffsetArray,q,$,Ce,Se,fe,j,T).notEnoughRoom)&&ii(ae.numGlyphs,$)}h?d.text.dynamicLayoutVertexBuffer.updateData($):d.icon.dynamicLayoutVertexBuffer.updateData($)}function Mi(d,t,o,h,p,y,v,S,T,A,k,R){const $=S.glyphStartIndex+S.numGlyphs,q=S.lineStartIndex,N=S.lineStartIndex+S.lineLength,j=t.getoffsetX(S.glyphStartIndex),ie=t.getoffsetX($-1),re=yr(d*j,o,h,p,y,v,S.segment,q,N,T,A,k,R);if(!re)return null;const ae=yr(d*ie,o,h,p,y,v,S.segment,q,N,T,A,k,R);return ae?{first:re,last:ae}:null}function gr(d,t,o,h){return d===l.WritingMode.horizontal&&Math.abs(o.y-t.y)>Math.abs(o.x-t.x)*h?{useVertical:!0}:(d===l.WritingMode.vertical?t.y<o.y:t.x>o.x)?{needsFlipping:!0}:null}function at(d,t,o,h,p,y,v,S,T,A,k,R,$,q,N){const j=t/24,ie=d.lineOffsetX*j,re=d.lineOffsetY*j;let ae;if(d.numGlyphs>1){const ne=d.glyphStartIndex+d.numGlyphs,ge=d.lineStartIndex,he=d.lineStartIndex+d.lineLength,de=Mi(j,S,ie,re,o,k,R,d,T,y,$,N);if(!de)return{notEnoughRoom:!0};const Se=Rt(de.first.point,v).point,Ce=Rt(de.last.point,v).point;if(h&&!o){const fe=gr(d.writingMode,Se,Ce,q);if(fe)return fe}ae=[de.first];for(let fe=d.glyphStartIndex+1;fe<ne-1;fe++)ae.push(yr(j*S.getoffsetX(fe),ie,re,o,k,R,d.segment,ge,he,T,y,$,N));ae.push(de.last)}else{if(h&&!o){const ge=Rt(R,p).point,he=d.lineStartIndex+d.segment+1,de=new l.pointGeometry(T.getx(he),T.gety(he)),Se=Rt(de,p),Ce=Se.signedDistanceFromCamera>0?Se.point:_n(R,de,ge,1,p),fe=gr(d.writingMode,ge,Ce,q);if(fe)return fe}const ne=yr(j*S.getoffsetX(d.glyphStartIndex),ie,re,o,k,R,d.segment,d.lineStartIndex,d.lineStartIndex+d.lineLength,T,y,$,N);if(!ne)return{notEnoughRoom:!0};ae=[ne]}for(const ne of ae)l.addDynamicAttributes(A,ne.point,ne.angle);return{}}function _n(d,t,o,h,p){const y=Rt(d.add(d.sub(t)._unit()),p).point,v=o.sub(y);return o.add(v._mult(h/v.mag()))}function yr(d,t,o,h,p,y,v,S,T,A,k,R,$){const q=h?d-t:d+t;let N=q>0?1:-1,j=0;h&&(N*=-1,j=Math.PI),N<0&&(j+=Math.PI);let ie=N>0?S+v:S+v+1,re=p,ae=p,ne=0,ge=0;const he=Math.abs(q),de=[];for(;ne+ge<=he;){if(ie+=N,ie<S||ie>=T)return null;if(ae=re,de.push(re),re=R[ie],re===void 0){const ze=new l.pointGeometry(A.getx(ie),A.gety(ie)),et=Rt(ze,k);if(et.signedDistanceFromCamera>0)re=R[ie]=et.point;else{const _t=ie-N;re=_n(ne===0?y:new l.pointGeometry(A.getx(_t),A.gety(_t)),ze,ae,he-ne+1,k)}}ne+=ge,ge=ae.dist(re)}const Se=(he-ne)/ge,Ce=re.sub(ae),fe=Ce.mult(Se)._add(ae);fe._add(Ce._unit()._perp()._mult(o*N));const Ne=j+Math.atan2(re.y-ae.y,re.x-ae.x);return de.push(fe),{point:fe,angle:$?Ne:0,path:de}}const Hr=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function ii(d,t){for(let o=0;o<d;o++){const h=t.length;t.resize(h+4),t.float32.set(Hr,3*h)}}function kt(d,t,o){const h=t[0],p=t[1];return d[0]=o[0]*h+o[4]*p+o[12],d[1]=o[1]*h+o[5]*p+o[13],d[3]=o[3]*h+o[7]*p+o[15],d}const or=100;class xn{constructor(t,o=new nr(t.width+200,t.height+200,25),h=new nr(t.width+200,t.height+200,25)){this.transform=t,this.grid=o,this.ignoredGrid=h,this.pitchfactor=Math.cos(t._pitch)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+or,this.screenBottomBoundary=t.height+or,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200}placeCollisionBox(t,o,h,p,y){const v=this.projectAndGetPerspectiveRatio(p,t.anchorPointX,t.anchorPointY),S=h*v.perspectiveRatio,T=t.x1*S+v.point.x,A=t.y1*S+v.point.y,k=t.x2*S+v.point.x,R=t.y2*S+v.point.y;return!this.isInsideGrid(T,A,k,R)||o!=="always"&&this.grid.hitTest(T,A,k,R,o,y)?{box:[],offscreen:!1}:{box:[T,A,k,R],offscreen:this.isOffscreen(T,A,k,R)}}placeCollisionCircles(t,o,h,p,y,v,S,T,A,k,R,$,q){const N=[],j=new l.pointGeometry(o.anchorX,o.anchorY),ie=Rt(j,v),re=Ee(this.transform.cameraToCenterDistance,ie.signedDistanceFromCamera),ae=(k?y/re:y*re)/l.ONE_EM,ne=Rt(j,S).point,ge=Mi(ae,p,o.lineOffsetX*ae,o.lineOffsetY*ae,!1,ne,j,o,h,S,{},!1);let he=!1,de=!1,Se=!0;if(ge){const Ce=.5*$*re+q,fe=new l.pointGeometry(-100,-100),Ne=new l.pointGeometry(this.screenRightBoundary,this.screenBottomBoundary),ze=new Zr,et=ge.first,_t=ge.last;let dt=[];for(let tt=et.path.length-1;tt>=1;tt--)dt.push(et.path[tt]);for(let tt=1;tt<_t.path.length;tt++)dt.push(_t.path[tt]);const ft=2.5*Ce;if(T){const tt=dt.map(bt=>Rt(bt,T));dt=tt.some(bt=>bt.signedDistanceFromCamera<=0)?[]:tt.map(bt=>bt.point)}let jt=[];if(dt.length>0){const tt=dt[0].clone(),bt=dt[0].clone();for(let Pt=1;Pt<dt.length;Pt++)tt.x=Math.min(tt.x,dt[Pt].x),tt.y=Math.min(tt.y,dt[Pt].y),bt.x=Math.max(bt.x,dt[Pt].x),bt.y=Math.max(bt.y,dt[Pt].y);jt=tt.x>=fe.x&&bt.x<=Ne.x&&tt.y>=fe.y&&bt.y<=Ne.y?[dt]:bt.x<fe.x||tt.x>Ne.x||bt.y<fe.y||tt.y>Ne.y?[]:l.clipLine([dt],fe.x,fe.y,Ne.x,Ne.y)}for(const tt of jt){ze.reset(tt,.25*Ce);let bt=0;bt=ze.length<=.5*Ce?1:Math.ceil(ze.paddedLength/ft)+1;for(let Pt=0;Pt<bt;Pt++){const xi=Pt/Math.max(bt-1,1),Yi=ze.lerp(xi),sr=Yi.x+or,lr=Yi.y+or;N.push(sr,lr,Ce,0);const on=sr-Ce,Gi=lr-Ce,Mr=sr+Ce,An=lr+Ce;if(Se=Se&&this.isOffscreen(on,Gi,Mr,An),de=de||this.isInsideGrid(on,Gi,Mr,An),t!=="always"&&this.grid.hitTestCircle(sr,lr,Ce,t,R)&&(he=!0,!A))return{circles:[],offscreen:!1,collisionDetected:he}}}}return{circles:!A&&he||!de?[]:N,offscreen:Se,collisionDetected:he}}queryRenderedSymbols(t){if(t.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const o=[];let h=1/0,p=1/0,y=-1/0,v=-1/0;for(const k of t){const R=new l.pointGeometry(k.x+or,k.y+or);h=Math.min(h,R.x),p=Math.min(p,R.y),y=Math.max(y,R.x),v=Math.max(v,R.y),o.push(R)}const S=this.grid.query(h,p,y,v).concat(this.ignoredGrid.query(h,p,y,v)),T={},A={};for(const k of S){const R=k.key;if(T[R.bucketInstanceId]===void 0&&(T[R.bucketInstanceId]={}),T[R.bucketInstanceId][R.featureIndex])continue;const $=[new l.pointGeometry(k.x1,k.y1),new l.pointGeometry(k.x2,k.y1),new l.pointGeometry(k.x2,k.y2),new l.pointGeometry(k.x1,k.y2)];l.polygonIntersectsPolygon(o,$)&&(T[R.bucketInstanceId][R.featureIndex]=!0,A[R.bucketInstanceId]===void 0&&(A[R.bucketInstanceId]=[]),A[R.bucketInstanceId].push(R.featureIndex))}return A}insertCollisionBox(t,o,h,p,y,v){(h?this.ignoredGrid:this.grid).insert({bucketInstanceId:p,featureIndex:y,collisionGroupID:v,overlapMode:o},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,o,h,p,y,v){const S=h?this.ignoredGrid:this.grid,T={bucketInstanceId:p,featureIndex:y,collisionGroupID:v,overlapMode:o};for(let A=0;A<t.length;A+=4)S.insertCircle(T,t[A],t[A+1],t[A+2])}projectAndGetPerspectiveRatio(t,o,h){const p=[o,h,0,1];return kt(p,p,t),{point:new l.pointGeometry((p[0]/p[3]+1)/2*this.transform.width+or,(-p[1]/p[3]+1)/2*this.transform.height+or),perspectiveRatio:.5+this.transform.cameraToCenterDistance/p[3]*.5}}isOffscreen(t,o,h,p){return h<or||t>=this.screenRightBoundary||p<or||o>this.screenBottomBoundary}isInsideGrid(t,o,h,p){return h>=0&&t<this.gridRightBoundary&&p>=0&&o<this.gridBottomBoundary}getViewportMatrix(){const t=l.identity([]);return l.translate(t,t,[-100,-100,0]),t}}function li(d,t,o){return t*(l.EXTENT/(d.tileSize*Math.pow(2,o-d.tileID.overscaledZ)))}class _r{constructor(t,o,h,p){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?o:-o))):p&&h?1:0,this.placed=h}isHidden(){return this.opacity===0&&!this.placed}}class xr{constructor(t,o,h,p,y){this.text=new _r(t?t.text:null,o,h,y),this.icon=new _r(t?t.icon:null,o,p,y)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class go{constructor(t,o,h){this.text=t,this.icon=o,this.skipFade=h}}class Vn{constructor(){this.invProjMatrix=l.create(),this.viewportMatrix=l.create(),this.circles=[]}}class Gn{constructor(t,o,h,p,y){this.bucketInstanceId=t,this.featureIndex=o,this.sourceLayerIndex=h,this.bucketIndex=p,this.tileID=y}}class V{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 o=++this.maxGroupID;this.collisionGroups[t]={ID:o,predicate:h=>h.collisionGroupID===o}}return this.collisionGroups[t]}}function E(d,t,o,h,p){const{horizontalAlign:y,verticalAlign:v}=l.getAnchorAlignment(d),S=-(y-.5)*t,T=-(v-.5)*o,A=l.evaluateVariableOffset(d,h);return new l.pointGeometry(S+A[0]*p,T+A[1]*p)}function M(d,t,o,h,p,y){const{x1:v,x2:S,y1:T,y2:A,anchorPointX:k,anchorPointY:R}=d,$=new l.pointGeometry(t,o);return h&&$._rotate(p?y:-y),{x1:v+$.x,y1:T+$.y,x2:S+$.x,y2:A+$.y,anchorPointX:k,anchorPointY:R}}class U{constructor(t,o,h,p){this.transform=t.clone(),this.collisionIndex=new xn(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=o,this.retainedQueryData={},this.collisionGroups=new V(h),this.collisionCircleArrays={},this.prevPlacement=p,p&&(p.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(t,o,h,p){const y=h.getBucket(o),v=h.latestFeatureIndex;if(!y||!v||o.id!==y.layerIds[0])return;const S=h.collisionBoxArray,T=y.layers[0].layout,A=Math.pow(2,this.transform.zoom-h.tileID.overscaledZ),k=h.tileSize/l.EXTENT,R=this.transform.calculatePosMatrix(h.tileID.toUnwrapped()),$=T.get("text-pitch-alignment")==="map",q=T.get("text-rotation-alignment")==="map",N=li(h,1,this.transform.zoom),j=Pi(R,$,q,this.transform,N);let ie=null;if($){const ae=yn(R,$,q,this.transform,N);ie=l.multiply([],this.transform.labelPlaneMatrix,ae)}this.retainedQueryData[y.bucketInstanceId]=new Gn(y.bucketInstanceId,v,y.sourceLayerIndex,y.index,h.tileID);const re={bucket:y,layout:T,posMatrix:R,textLabelPlaneMatrix:j,labelToScreenMatrix:ie,scale:A,textPixelRatio:k,holdingForFade:h.holdingForFade(),collisionBoxArray:S,partiallyEvaluatedTextSize:l.evaluateSizeForZoom(y.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(y.sourceID)};if(p)for(const ae of y.sortKeyRanges){const{sortKey:ne,symbolInstanceStart:ge,symbolInstanceEnd:he}=ae;t.push({sortKey:ne,symbolInstanceStart:ge,symbolInstanceEnd:he,parameters:re})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:y.symbolInstances.length,parameters:re})}attemptAnchorPlacement(t,o,h,p,y,v,S,T,A,k,R,$,q,N,j){const ie=[$.textOffset0,$.textOffset1],re=E(t,h,p,ie,y),ae=this.collisionIndex.placeCollisionBox(M(o,re.x,re.y,v,S,this.transform.angle),R,T,A,k.predicate);if((!j||this.collisionIndex.placeCollisionBox(M(j,re.x,re.y,v,S,this.transform.angle),R,T,A,k.predicate).box.length!==0)&&ae.box.length>0){let ne;return this.prevPlacement&&this.prevPlacement.variableOffsets[$.crossTileID]&&this.prevPlacement.placements[$.crossTileID]&&this.prevPlacement.placements[$.crossTileID].text&&(ne=this.prevPlacement.variableOffsets[$.crossTileID].anchor),this.variableOffsets[$.crossTileID]={textOffset:ie,width:h,height:p,anchor:t,textBoxScale:y,prevAnchor:ne},this.markUsedJustification(q,t,$,N),q.allowVerticalPlacement&&(this.markUsedOrientation(q,N,$),this.placedOrientations[$.crossTileID]=N),{shift:re,placedGlyphBoxes:ae}}}placeLayerBucketPart(t,o,h){const{bucket:p,layout:y,posMatrix:v,textLabelPlaneMatrix:S,labelToScreenMatrix:T,textPixelRatio:A,holdingForFade:k,collisionBoxArray:R,partiallyEvaluatedTextSize:$,collisionGroup:q}=t.parameters,N=y.get("text-optional"),j=y.get("icon-optional"),ie=l.getOverlapMode(y,"text-overlap","text-allow-overlap"),re=ie==="always",ae=l.getOverlapMode(y,"icon-overlap","icon-allow-overlap"),ne=ae==="always",ge=y.get("text-rotation-alignment")==="map",he=y.get("text-pitch-alignment")==="map",de=y.get("icon-text-fit")!=="none",Se=y.get("symbol-z-order")==="viewport-y",Ce=re&&(ne||!p.hasIconData()||j),fe=ne&&(re||!p.hasTextData()||N);!p.collisionArrays&&R&&p.deserializeCollisionBoxes(R);const Ne=(ze,et)=>{if(o[ze.crossTileID])return;if(k)return void(this.placements[ze.crossTileID]=new go(!1,!1,!1));let _t=!1,dt=!1,ft=!0,jt=null,tt={box:null,offscreen:null},bt={box:null,offscreen:null},Pt=null,xi=null,Yi=null,sr=0,lr=0,on=0;et.textFeatureIndex?sr=et.textFeatureIndex:ze.useRuntimeCollisionCircles&&(sr=ze.featureIndex),et.verticalTextFeatureIndex&&(lr=et.verticalTextFeatureIndex);const Gi=et.textBox;if(Gi){const Ki=Tt=>{let ni=l.WritingMode.horizontal;if(p.allowVerticalPlacement&&!Tt&&this.prevPlacement){const zi=this.prevPlacement.placedOrientations[ze.crossTileID];zi&&(this.placedOrientations[ze.crossTileID]=zi,ni=zi,this.markUsedOrientation(p,ni,ze))}return ni},wt=(Tt,ni)=>{if(p.allowVerticalPlacement&&ze.numVerticalGlyphVertices>0&&et.verticalTextBox){for(const zi of p.writingModes)if(zi===l.WritingMode.vertical?(tt=ni(),bt=tt):tt=Tt(),tt&&tt.box&&tt.box.length)break}else tt=Tt()};if(y.get("text-variable-anchor")){let Tt=y.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[ze.crossTileID]){const $t=this.prevPlacement.variableOffsets[ze.crossTileID];Tt.indexOf($t.anchor)>0&&(Tt=Tt.filter(Pn=>Pn!==$t.anchor),Tt.unshift($t.anchor))}const ni=($t,Pn,zr)=>{const wa=$t.x2-$t.x1,Ms=$t.y2-$t.y1,Sa=ze.textBoxScale,jl=de&&ae==="never"?Pn:null;let Mn={box:[],offscreen:!1};const Ta=ie!=="never"?2*Tt.length:Tt.length;for(let kr=0;kr<Ta;++kr){const io=this.attemptAnchorPlacement(Tt[kr%Tt.length],$t,wa,Ms,Sa,ge,he,A,v,q,kr>=Tt.length?ie:"never",ze,p,zr,jl);if(io&&(Mn=io.placedGlyphBoxes,Mn&&Mn.box&&Mn.box.length)){_t=!0,jt=io.shift;break}}return Mn};wt(()=>ni(Gi,et.iconBox,l.WritingMode.horizontal),()=>{const $t=et.verticalTextBox;return p.allowVerticalPlacement&&!(tt&&tt.box&&tt.box.length)&&ze.numVerticalGlyphVertices>0&&$t?ni($t,et.verticalIconBox,l.WritingMode.vertical):{box:null,offscreen:null}}),tt&&(_t=tt.box,ft=tt.offscreen);const zi=Ki(tt&&tt.box);if(!_t&&this.prevPlacement){const $t=this.prevPlacement.variableOffsets[ze.crossTileID];$t&&(this.variableOffsets[ze.crossTileID]=$t,this.markUsedJustification(p,$t.anchor,ze,zi))}}else{const Tt=(ni,zi)=>{const $t=this.collisionIndex.placeCollisionBox(ni,ie,A,v,q.predicate);return $t&&$t.box&&$t.box.length&&(this.markUsedOrientation(p,zi,ze),this.placedOrientations[ze.crossTileID]=zi),$t};wt(()=>Tt(Gi,l.WritingMode.horizontal),()=>{const ni=et.verticalTextBox;return p.allowVerticalPlacement&&ze.numVerticalGlyphVertices>0&&ni?Tt(ni,l.WritingMode.vertical):{box:null,offscreen:null}}),Ki(tt&&tt.box&&tt.box.length)}}if(Pt=tt,_t=Pt&&Pt.box&&Pt.box.length>0,ft=Pt&&Pt.offscreen,ze.useRuntimeCollisionCircles){const Ki=p.text.placedSymbolArray.get(ze.centerJustifiedTextSymbolIndex),wt=l.evaluateSizeForFeature(p.textSizeData,$,Ki),Tt=y.get("text-padding");xi=this.collisionIndex.placeCollisionCircles(ie,Ki,p.lineVertexArray,p.glyphOffsetArray,wt,v,S,T,h,he,q.predicate,ze.collisionCircleDiameter,Tt),_t=re||xi.circles.length>0&&!xi.collisionDetected,ft=ft&&xi.offscreen}if(et.iconFeatureIndex&&(on=et.iconFeatureIndex),et.iconBox){const Ki=wt=>{const Tt=de&&jt?M(wt,jt.x,jt.y,ge,he,this.transform.angle):wt;return this.collisionIndex.placeCollisionBox(Tt,ae,A,v,q.predicate)};bt&&bt.box&&bt.box.length&&et.verticalIconBox?(Yi=Ki(et.verticalIconBox),dt=Yi.box.length>0):(Yi=Ki(et.iconBox),dt=Yi.box.length>0),ft=ft&&Yi.offscreen}const Mr=N||ze.numHorizontalGlyphVertices===0&&ze.numVerticalGlyphVertices===0,An=j||ze.numIconVertices===0;if(Mr||An?An?Mr||(dt=dt&&_t):_t=dt&&_t:dt=_t=dt&&_t,_t&&Pt&&Pt.box&&this.collisionIndex.insertCollisionBox(Pt.box,ie,y.get("text-ignore-placement"),p.bucketInstanceId,bt&&bt.box&&lr?lr:sr,q.ID),dt&&Yi&&this.collisionIndex.insertCollisionBox(Yi.box,ae,y.get("icon-ignore-placement"),p.bucketInstanceId,on,q.ID),xi&&(_t&&this.collisionIndex.insertCollisionCircles(xi.circles,ie,y.get("text-ignore-placement"),p.bucketInstanceId,sr,q.ID),h)){const Ki=p.bucketInstanceId;let wt=this.collisionCircleArrays[Ki];wt===void 0&&(wt=this.collisionCircleArrays[Ki]=new Vn);for(let Tt=0;Tt<xi.circles.length;Tt+=4)wt.circles.push(xi.circles[Tt+0]),wt.circles.push(xi.circles[Tt+1]),wt.circles.push(xi.circles[Tt+2]),wt.circles.push(xi.collisionDetected?1:0)}this.placements[ze.crossTileID]=new go(_t||Ce,dt||fe,ft||p.justReloaded),o[ze.crossTileID]=!0};if(Se){const ze=p.getSortedSymbolIndexes(this.transform.angle);for(let et=ze.length-1;et>=0;--et){const _t=ze[et];Ne(p.symbolInstances.get(_t),p.collisionArrays[_t])}}else for(let ze=t.symbolInstanceStart;ze<t.symbolInstanceEnd;ze++)Ne(p.symbolInstances.get(ze),p.collisionArrays[ze]);if(h&&p.bucketInstanceId in this.collisionCircleArrays){const ze=this.collisionCircleArrays[p.bucketInstanceId];l.invert(ze.invProjMatrix,v),ze.viewportMatrix=this.collisionIndex.getViewportMatrix()}p.justReloaded=!1}markUsedJustification(t,o,h,p){let y;y=p===l.WritingMode.vertical?h.verticalPlacedTextSymbolIndex:{left:h.leftJustifiedTextSymbolIndex,center:h.centerJustifiedTextSymbolIndex,right:h.rightJustifiedTextSymbolIndex}[l.getAnchorJustification(o)];const v=[h.leftJustifiedTextSymbolIndex,h.centerJustifiedTextSymbolIndex,h.rightJustifiedTextSymbolIndex,h.verticalPlacedTextSymbolIndex];for(const S of v)S>=0&&(t.text.placedSymbolArray.get(S).crossTileID=y>=0&&S!==y?0:h.crossTileID)}markUsedOrientation(t,o,h){const p=o===l.WritingMode.horizontal||o===l.WritingMode.horizontalOnly?o:0,y=o===l.WritingMode.vertical?o:0,v=[h.leftJustifiedTextSymbolIndex,h.centerJustifiedTextSymbolIndex,h.rightJustifiedTextSymbolIndex];for(const S of v)t.text.placedSymbolArray.get(S).placedOrientation=p;h.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(h.verticalPlacedTextSymbolIndex).placedOrientation=y)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const o=this.prevPlacement;let h=!1;this.prevZoomAdjustment=o?o.zoomAdjustment(this.transform.zoom):0;const p=o?o.symbolFadeChange(t):1,y=o?o.opacities:{},v=o?o.variableOffsets:{},S=o?o.placedOrientations:{};for(const T in this.placements){const A=this.placements[T],k=y[T];k?(this.opacities[T]=new xr(k,p,A.text,A.icon),h=h||A.text!==k.text.placed||A.icon!==k.icon.placed):(this.opacities[T]=new xr(null,p,A.text,A.icon,A.skipFade),h=h||A.text||A.icon)}for(const T in y){const A=y[T];if(!this.opacities[T]){const k=new xr(A,p,!1,!1);k.isHidden()||(this.opacities[T]=k,h=h||A.text.placed||A.icon.placed)}}for(const T in v)this.variableOffsets[T]||!this.opacities[T]||this.opacities[T].isHidden()||(this.variableOffsets[T]=v[T]);for(const T in S)this.placedOrientations[T]||!this.opacities[T]||this.opacities[T].isHidden()||(this.placedOrientations[T]=S[T]);h?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=o?o.lastPlacementChangeTime:t)}updateLayerOpacities(t,o){const h={};for(const p of o){const y=p.getBucket(t);y&&p.latestFeatureIndex&&t.id===y.layerIds[0]&&this.updateBucketOpacities(y,h,p.collisionBoxArray)}}updateBucketOpacities(t,o,h){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 p=t.layers[0].layout,y=new xr(null,0,!1,!1,!0),v=p.get("text-allow-overlap"),S=p.get("icon-allow-overlap"),T=p.get("text-variable-anchor"),A=p.get("text-rotation-alignment")==="map",k=p.get("text-pitch-alignment")==="map",R=p.get("icon-text-fit")!=="none",$=new xr(null,0,v&&(S||!t.hasIconData()||p.get("icon-optional")),S&&(v||!t.hasTextData()||p.get("text-optional")),!0);!t.collisionArrays&&h&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(h);const q=(N,j,ie)=>{for(let re=0;re<j/4;re++)N.opacityVertexArray.emplaceBack(ie)};for(let N=0;N<t.symbolInstances.length;N++){const j=t.symbolInstances.get(N),{numHorizontalGlyphVertices:ie,numVerticalGlyphVertices:re,crossTileID:ae}=j;let ne=this.opacities[ae];o[ae]?ne=y:ne||(ne=$,this.opacities[ae]=ne),o[ae]=!0;const ge=j.numIconVertices>0,he=this.placedOrientations[j.crossTileID],de=he===l.WritingMode.vertical,Se=he===l.WritingMode.horizontal||he===l.WritingMode.horizontalOnly;if(ie>0||re>0){const Ce=ce(ne.text);q(t.text,ie,de?Ze:Ce),q(t.text,re,Se?Ze:Ce);const fe=ne.text.isHidden();[j.rightJustifiedTextSymbolIndex,j.centerJustifiedTextSymbolIndex,j.leftJustifiedTextSymbolIndex].forEach(et=>{et>=0&&(t.text.placedSymbolArray.get(et).hidden=fe||de?1:0)}),j.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(j.verticalPlacedTextSymbolIndex).hidden=fe||Se?1:0);const Ne=this.variableOffsets[j.crossTileID];Ne&&this.markUsedJustification(t,Ne.anchor,j,he);const ze=this.placedOrientations[j.crossTileID];ze&&(this.markUsedJustification(t,"left",j,ze),this.markUsedOrientation(t,ze,j))}if(ge){const Ce=ce(ne.icon),fe=!(R&&j.verticalPlacedIconSymbolIndex&&de);j.placedIconSymbolIndex>=0&&(q(t.icon,j.numIconVertices,fe?Ce:Ze),t.icon.placedSymbolArray.get(j.placedIconSymbolIndex).hidden=ne.icon.isHidden()),j.verticalPlacedIconSymbolIndex>=0&&(q(t.icon,j.numVerticalIconVertices,fe?Ze:Ce),t.icon.placedSymbolArray.get(j.verticalPlacedIconSymbolIndex).hidden=ne.icon.isHidden())}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const Ce=t.collisionArrays[N];if(Ce){let fe=new l.pointGeometry(0,0);if(Ce.textBox||Ce.verticalTextBox){let ze=!0;if(T){const et=this.variableOffsets[ae];et?(fe=E(et.anchor,et.width,et.height,et.textOffset,et.textBoxScale),A&&fe._rotate(k?this.transform.angle:-this.transform.angle)):ze=!1}Ce.textBox&&G(t.textCollisionBox.collisionVertexArray,ne.text.placed,!ze||de,fe.x,fe.y),Ce.verticalTextBox&&G(t.textCollisionBox.collisionVertexArray,ne.text.placed,!ze||Se,fe.x,fe.y)}const Ne=Boolean(!Se&&Ce.verticalIconBox);Ce.iconBox&&G(t.iconCollisionBox.collisionVertexArray,ne.icon.placed,Ne,R?fe.x:0,R?fe.y:0),Ce.verticalIconBox&&G(t.iconCollisionBox.collisionVertexArray,ne.icon.placed,!Ne,R?fe.x:0,R?fe.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 N=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=N.invProjMatrix,t.placementViewportMatrix=N.viewportMatrix,t.collisionCircleArray=N.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,o){const h=this.zoomAtLastRecencyCheck===o?1-this.zoomAdjustment(o):1;return this.zoomAtLastRecencyCheck=o,this.commitTime+this.fadeDuration*h>t}setStale(){this.stale=!0}}function G(d,t,o,h,p){d.emplaceBack(t?1:0,o?1:0,h||0,p||0),d.emplaceBack(t?1:0,o?1:0,h||0,p||0),d.emplaceBack(t?1:0,o?1:0,h||0,p||0),d.emplaceBack(t?1:0,o?1:0,h||0,p||0)}const H=Math.pow(2,25),ee=Math.pow(2,24),Y=Math.pow(2,17),Q=Math.pow(2,16),te=Math.pow(2,9),ue=Math.pow(2,8),_e=Math.pow(2,1);function ce(d){if(d.opacity===0&&!d.placed)return 0;if(d.opacity===1&&d.placed)return 4294967295;const t=d.placed?1:0,o=Math.floor(127*d.opacity);return o*H+t*ee+o*Y+t*Q+o*te+t*ue+o*_e+t}const Ze=0;class Re{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,o,h,p,y){const v=this._bucketParts;for(;this._currentTileIndex<t.length;)if(o.getBucketParts(v,p,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,y())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,v.sort((S,T)=>S.sortKey-T.sortKey));this._currentPartIndex<v.length;)if(o.placeLayerBucketPart(v[this._currentPartIndex],this._seenCrossTileIDs,h),this._currentPartIndex++,y())return!0;return!1}}class je{constructor(t,o,h,p,y,v,S){this.placement=new U(t,y,v,S),this._currentPlacementIndex=o.length-1,this._forceFullPlacement=h,this._showCollisionBoxes=p,this._done=!1}isDone(){return this._done}continuePlacement(t,o,h){const p=l.exported.now(),y=()=>{const v=l.exported.now()-p;return!this._forceFullPlacement&&v>2};for(;this._currentPlacementIndex>=0;){const v=o[t[this._currentPlacementIndex]],S=this.placement.collisionIndex.transform.zoom;if(v.type==="symbol"&&(!v.minzoom||v.minzoom<=S)&&(!v.maxzoom||v.maxzoom>S)){if(this._inProgressLayer||(this._inProgressLayer=new Re(v)),this._inProgressLayer.continuePlacement(h[v.source],this.placement,this._showCollisionBoxes,v,y))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const Ke=512/l.EXTENT/2;class vt{constructor(t,o,h){this.tileID=t,this.indexedSymbolInstances={},this.bucketInstanceId=h;for(let p=0;p<o.length;p++){const y=o.get(p),v=y.key;this.indexedSymbolInstances[v]||(this.indexedSymbolInstances[v]=[]),this.indexedSymbolInstances[v].push({crossTileID:y.crossTileID,coord:this.getScaledCoordinates(y,t)})}}getScaledCoordinates(t,o){const h=Ke/Math.pow(2,o.canonical.z-this.tileID.canonical.z);return{x:Math.floor((o.canonical.x*l.EXTENT+t.anchorX)*h),y:Math.floor((o.canonical.y*l.EXTENT+t.anchorY)*h)}}findMatches(t,o,h){const p=this.tileID.canonical.z<o.canonical.z?1:Math.pow(2,this.tileID.canonical.z-o.canonical.z);for(let y=0;y<t.length;y++){const v=t.get(y);if(v.crossTileID)continue;const S=this.indexedSymbolInstances[v.key];if(!S)continue;const T=this.getScaledCoordinates(v,o);for(const A of S)if(Math.abs(A.coord.x-T.x)<=p&&Math.abs(A.coord.y-T.y)<=p&&!h[A.crossTileID]){h[A.crossTileID]=!0,v.crossTileID=A.crossTileID;break}}}}class mt{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class ut{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const o=Math.round((t-this.lng)/360);if(o!==0)for(const h in this.indexes){const p=this.indexes[h],y={};for(const v in p){const S=p[v];S.tileID=S.tileID.unwrapTo(S.tileID.wrap+o),y[S.tileID.key]=S}this.indexes[h]=y}this.lng=t}addBucket(t,o,h){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===o.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let y=0;y<o.symbolInstances.length;y++)o.symbolInstances.get(y).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]={});const p=this.usedCrossTileIDs[t.overscaledZ];for(const y in this.indexes){const v=this.indexes[y];if(Number(y)>t.overscaledZ)for(const S in v){const T=v[S];T.tileID.isChildOf(t)&&T.findMatches(o.symbolInstances,t,p)}else{const S=v[t.scaledTo(Number(y)).key];S&&S.findMatches(o.symbolInstances,t,p)}}for(let y=0;y<o.symbolInstances.length;y++){const v=o.symbolInstances.get(y);v.crossTileID||(v.crossTileID=h.generate(),p[v.crossTileID]=!0)}return this.indexes[t.overscaledZ]===void 0&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new vt(t,o.symbolInstances,o.bucketInstanceId),!0}removeBucketCrossTileIDs(t,o){for(const h in o.indexedSymbolInstances)for(const p of o.indexedSymbolInstances[h])delete this.usedCrossTileIDs[t][p.crossTileID]}removeStaleBuckets(t){let o=!1;for(const h in this.indexes){const p=this.indexes[h];for(const y in p)t[p[y].bucketInstanceId]||(this.removeBucketCrossTileIDs(h,p[y]),delete p[y],o=!0)}return o}}class st{constructor(){this.layerIndexes={},this.crossTileIDs=new mt,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,o,h){let p=this.layerIndexes[t.id];p===void 0&&(p=this.layerIndexes[t.id]=new ut);let y=!1;const v={};p.handleWrapJump(h);for(const S of o){const T=S.getBucket(t);T&&t.id===T.layerIds[0]&&(T.bucketInstanceId||(T.bucketInstanceId=++this.maxBucketInstanceId),p.addBucket(S.tileID,T,this.crossTileIDs)&&(y=!0),v[T.bucketInstanceId]=!0)}return p.removeStaleBuckets(v)&&(y=!0),y}pruneUnusedLayers(t){const o={};t.forEach(h=>{o[h]=!0});for(const h in this.layerIndexes)o[h]||delete this.layerIndexes[h]}}const nt=(d,t)=>l.emitValidationErrors(d,t&&t.filter(o=>o.identifier!=="source.canvas")),Jt=l.pick(yt,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData"]),Xt=l.pick(yt,["setCenter","setZoom","setBearing","setPitch"]),fi=function(){const d={},t=l.spec.$version;for(const o in l.spec.$root){const h=l.spec.$root[o];if(h.required){let p=null;p=o==="version"?t:h.type==="array"?[]:{},p!=null&&(d[o]=p)}}return d}();class _i extends l.Evented{constructor(t,o={}){super(),this.map=t,this.dispatcher=new Ht(Er(),this),this.imageManager=new rt,this.imageManager.setEventedParent(this),this.glyphManager=new pi(t._requestManager,o.localIdeographFontFamily),this.lineAtlas=new Bt(256,512),this.crossTileSymbolIndex=new st,this._layers={},this._serializedLayers={},this._order=[],this.sourceCaches={},this.zoomHistory=new l.ZoomHistory,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",l.getReferrer());const h=this;this._rtlTextPluginCallback=_i.registerForPluginStateChange(p=>{h.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:p.pluginStatus,pluginURL:p.pluginURL},(y,v)=>{if(l.triggerPluginCompletionEvent(y),v&&v.every(S=>S))for(const S in h.sourceCaches)h.sourceCaches[S].reload()})}),this.on("data",p=>{if(p.dataType!=="source"||p.sourceDataType!=="metadata")return;const y=this.sourceCaches[p.sourceId];if(!y)return;const v=y.getSource();if(v&&v.vectorLayerIds)for(const S in this._layers){const T=this._layers[S];T.source===v.id&&this._validateLayer(T)}})}loadURL(t,o={}){this.fire(new l.Event("dataloading",{dataType:"style"}));const h=typeof o.validate!="boolean"||o.validate,p=this.map._requestManager.transformRequest(t,l.ResourceType.Style);this._request=l.getJSON(p,(y,v)=>{this._request=null,y?this.fire(new l.ErrorEvent(y)):v&&this._load(v,h)})}loadJSON(t,o={}){this.fire(new l.Event("dataloading",{dataType:"style"})),this._request=l.exported.frame(()=>{this._request=null,this._load(t,o.validate!==!1)})}loadEmpty(){this.fire(new l.Event("dataloading",{dataType:"style"})),this._load(fi,!1)}_load(t,o){if(o&&nt(this,l.validateStyle(t)))return;this._loaded=!0,this.stylesheet=t;for(const p in t.sources)this.addSource(p,t.sources[p],{validate:!1});t.sprite?this._loadSprite(t.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(t.glyphs);const h=mo(this.stylesheet.layers);this._order=h.map(p=>p.id),this._layers={},this._serializedLayers={};for(let p of h)p=l.createStyleLayer(p),p.setEventedParent(this,{layer:{id:p.id}}),this._layers[p.id]=p,this._serializedLayers[p.id]=p.serialize();this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new Wt(this.stylesheet.light),this.fire(new l.Event("data",{dataType:"style"})),this.fire(new l.Event("style.load"))}_loadSprite(t){this._spriteRequest=function(o,h,p,y){let v,S,T;const A=p>1?"@2x":"";let k=l.getJSON(h.transformRequest(h.normalizeSpriteURL(o,A,".json"),l.ResourceType.SpriteJSON),(q,N)=>{k=null,T||(T=q,v=N,$())}),R=l.getImage(h.transformRequest(h.normalizeSpriteURL(o,A,".png"),l.ResourceType.SpriteImage),(q,N)=>{R=null,T||(T=q,S=N,$())});function $(){if(T)y(T);else if(v&&S){const q=l.exported.getImageData(S),N={};for(const j in v){const{width:ie,height:re,x:ae,y:ne,sdf:ge,pixelRatio:he,stretchX:de,stretchY:Se,content:Ce}=v[j],fe=new l.RGBAImage({width:ie,height:re});l.RGBAImage.copy(q,fe,{x:ae,y:ne},{x:0,y:0},{width:ie,height:re}),N[j]={data:fe,pixelRatio:he,sdf:ge,stretchX:de,stretchY:Se,content:Ce}}y(null,N)}}return{cancel(){k&&(k.cancel(),k=null),R&&(R.cancel(),R=null)}}}(t,this.map._requestManager,this.map.getPixelRatio(),(o,h)=>{if(this._spriteRequest=null,o)this.fire(new l.ErrorEvent(o));else if(h)for(const p in h)this.imageManager.addImage(p,h[p]);this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new l.Event("data",{dataType:"style"}))})}_validateLayer(t){const o=this.sourceCaches[t.source];if(!o)return;const h=t.sourceLayer;if(!h)return;const p=o.getSource();(p.type==="geojson"||p.vectorLayerIds&&p.vectorLayerIds.indexOf(h)===-1)&&this.fire(new l.ErrorEvent(new Error(`Source layer "${h}" does not exist on source "${p.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 o=[];for(const h of t){const p=this._layers[h];p.type!=="custom"&&o.push(p.serialize())}return o}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 o=this._changed;if(this._changed){const p=Object.keys(this._updatedLayers),y=Object.keys(this._removedLayers);(p.length||y.length)&&this._updateWorkerLayers(p,y);for(const v in this._updatedSources){const S=this._updatedSources[v];S==="reload"?this._reloadSource(v):S==="clear"&&this._clearSource(v)}this._updateTilesForChangedImages();for(const v in this._updatedPaintProps)this._layers[v].updateTransitions(t);this.light.updateTransitions(t),this._resetUpdates()}const h={};for(const p in this.sourceCaches){const y=this.sourceCaches[p];h[p]=y.used,y.used=!1}for(const p of this._order){const y=this._layers[p];y.recalculate(t,this._availableImages),!y.isHidden(t.zoom)&&y.source&&(this.sourceCaches[y.source].used=!0)}for(const p in h){const y=this.sourceCaches[p];h[p]!==y.used&&y.fire(new l.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:p}))}this.light.recalculate(t),this.z=t.zoom,o&&this.fire(new l.Event("data",{dataType:"style"}))}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const o in this.sourceCaches)this.sourceCaches[o].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateWorkerLayers(t,o){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(t),removedIds:o})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={}}setState(t){if(this._checkLoaded(),nt(this,l.validateStyle(t)))return!1;(t=l.clone$1(t)).layers=mo(t.layers);const o=function(p,y){if(!p)return[{command:yt.setStyle,args:[y]}];let v=[];try{if(!K(p.version,y.version))return[{command:yt.setStyle,args:[y]}];K(p.center,y.center)||v.push({command:yt.setCenter,args:[y.center]}),K(p.zoom,y.zoom)||v.push({command:yt.setZoom,args:[y.zoom]}),K(p.bearing,y.bearing)||v.push({command:yt.setBearing,args:[y.bearing]}),K(p.pitch,y.pitch)||v.push({command:yt.setPitch,args:[y.pitch]}),K(p.sprite,y.sprite)||v.push({command:yt.setSprite,args:[y.sprite]}),K(p.glyphs,y.glyphs)||v.push({command:yt.setGlyphs,args:[y.glyphs]}),K(p.transition,y.transition)||v.push({command:yt.setTransition,args:[y.transition]}),K(p.light,y.light)||v.push({command:yt.setLight,args:[y.light]});const S={},T=[];(function(k,R,$,q){let N;for(N in R=R||{},k=k||{})Object.prototype.hasOwnProperty.call(k,N)&&(Object.prototype.hasOwnProperty.call(R,N)||rn(N,$,q));for(N in R)Object.prototype.hasOwnProperty.call(R,N)&&(Object.prototype.hasOwnProperty.call(k,N)?K(k[N],R[N])||(k[N].type==="geojson"&&R[N].type==="geojson"&&fo(k,R,N)?$.push({command:yt.setGeoJSONSourceData,args:[N,R[N].data]}):fn(N,R,$,q)):mn(N,R,$))})(p.sources,y.sources,T,S);const A=[];p.layers&&p.layers.forEach(k=>{S[k.source]?v.push({command:yt.removeLayer,args:[k.id]}):A.push(k)}),v=v.concat(T),function(k,R,$){R=R||[];const q=(k=k||[]).map(Me),N=R.map(Me),j=k.reduce(gn,{}),ie=R.reduce(gn,{}),re=q.slice(),ae=Object.create(null);let ne,ge,he,de,Se,Ce,fe;for(ne=0,ge=0;ne<q.length;ne++)he=q[ne],Object.prototype.hasOwnProperty.call(ie,he)?ge++:($.push({command:yt.removeLayer,args:[he]}),re.splice(re.indexOf(he,ge),1));for(ne=0,ge=0;ne<N.length;ne++)he=N[N.length-1-ne],re[re.length-1-ne]!==he&&(Object.prototype.hasOwnProperty.call(j,he)?($.push({command:yt.removeLayer,args:[he]}),re.splice(re.lastIndexOf(he,re.length-ge),1)):ge++,Ce=re[re.length-ne],$.push({command:yt.addLayer,args:[ie[he],Ce]}),re.splice(re.length-ne,0,he),ae[he]=!0);for(ne=0;ne<N.length;ne++)if(he=N[ne],de=j[he],Se=ie[he],!ae[he]&&!K(de,Se))if(K(de.source,Se.source)&&K(de["source-layer"],Se["source-layer"])&&K(de.type,Se.type)){for(fe in pe(de.layout,Se.layout,$,he,null,yt.setLayoutProperty),pe(de.paint,Se.paint,$,he,null,yt.setPaintProperty),K(de.filter,Se.filter)||$.push({command:yt.setFilter,args:[he,Se.filter]}),K(de.minzoom,Se.minzoom)&&K(de.maxzoom,Se.maxzoom)||$.push({command:yt.setLayerZoomRange,args:[he,Se.minzoom,Se.maxzoom]}),de)Object.prototype.hasOwnProperty.call(de,fe)&&fe!=="layout"&&fe!=="paint"&&fe!=="filter"&&fe!=="metadata"&&fe!=="minzoom"&&fe!=="maxzoom"&&(fe.indexOf("paint.")===0?pe(de[fe],Se[fe],$,he,fe.slice(6),yt.setPaintProperty):K(de[fe],Se[fe])||$.push({command:yt.setLayerProperty,args:[he,fe,Se[fe]]}));for(fe in Se)Object.prototype.hasOwnProperty.call(Se,fe)&&!Object.prototype.hasOwnProperty.call(de,fe)&&fe!=="layout"&&fe!=="paint"&&fe!=="filter"&&fe!=="metadata"&&fe!=="minzoom"&&fe!=="maxzoom"&&(fe.indexOf("paint.")===0?pe(de[fe],Se[fe],$,he,fe.slice(6),yt.setPaintProperty):K(de[fe],Se[fe])||$.push({command:yt.setLayerProperty,args:[he,fe,Se[fe]]}))}else $.push({command:yt.removeLayer,args:[he]}),Ce=re[re.lastIndexOf(he)+1],$.push({command:yt.addLayer,args:[Se,Ce]})}(A,y.layers,v)}catch(S){console.warn("Unable to compute style diff:",S),v=[{command:yt.setStyle,args:[y]}]}return v}(this.serialize(),t).filter(p=>!(p.command in Xt));if(o.length===0)return!1;const h=o.filter(p=>!(p.command in Jt));if(h.length>0)throw new Error(`Unimplemented: ${h.map(p=>p.command).join(", ")}.`);return o.forEach(p=>{p.command!=="setTransition"&&this[p.command].apply(this,p.args)}),this.stylesheet=t,!0}addImage(t,o){if(this.getImage(t))return this.fire(new l.ErrorEvent(new Error(`An image named "${t}" already exists.`)));this.imageManager.addImage(t,o),this._afterImageUpdated(t)}updateImage(t,o){this.imageManager.updateImage(t,o)}getImage(t){return this.imageManager.getImage(t)}removeImage(t){if(!this.getImage(t))return this.fire(new l.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 l.Event("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,o,h={}){if(this._checkLoaded(),this.sourceCaches[t]!==void 0)throw new Error(`Source "${t}" already exists.`);if(!o.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(o).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(o.type)>=0&&this._validate(l.validateStyle.source,`sources.${t}`,o,null,h))return;this.map&&this.map._collectResourceTiming&&(o.collectResourceTiming=!0);const p=this.sourceCaches[t]=new mi(t,o,this.dispatcher);p.style=this,p.setEventedParent(this,()=>({isSourceLoaded:this.loaded(),source:p.serialize(),sourceId:t})),p.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 h in this._layers)if(this._layers[h].source===t)return this.fire(new l.ErrorEvent(new Error(`Source "${t}" cannot be removed while layer "${h}" is using it.`)));const o=this.sourceCaches[t];delete this.sourceCaches[t],delete this._updatedSources[t],o.fire(new l.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:t})),o.setEventedParent(null),o.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,o){this._checkLoaded(),this.sourceCaches[t].getSource().setData(o),this._changed=!0}getSource(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()}addLayer(t,o,h={}){this._checkLoaded();const p=t.id;if(this.getLayer(p))return void this.fire(new l.ErrorEvent(new Error(`Layer "${p}" already exists on this map.`)));let y;if(t.type==="custom"){if(nt(this,l.validateCustomStyleLayer(t)))return;y=l.createStyleLayer(t)}else{if(typeof t.source=="object"&&(this.addSource(p,t.source),t=l.clone$1(t),t=l.extend(t,{source:p})),this._validate(l.validateStyle.layer,`layers.${p}`,t,{arrayIndex:-1},h))return;y=l.createStyleLayer(t),this._validateLayer(y),y.setEventedParent(this,{layer:{id:p}}),this._serializedLayers[y.id]=y.serialize()}const v=o?this._order.indexOf(o):this._order.length;if(o&&v===-1)this.fire(new l.ErrorEvent(new Error(`Cannot add layer "${p}" before non-existing layer "${o}".`)));else{if(this._order.splice(v,0,p),this._layerOrderChanged=!0,this._layers[p]=y,this._removedLayers[p]&&y.source&&y.type!=="custom"){const S=this._removedLayers[p];delete this._removedLayers[p],S.type!==y.type?this._updatedSources[y.source]="clear":(this._updatedSources[y.source]="reload",this.sourceCaches[y.source].pause())}this._updateLayer(y),y.onAdd&&y.onAdd(this.map)}}moveLayer(t,o){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new l.ErrorEvent(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===o)return;const h=this._order.indexOf(t);this._order.splice(h,1);const p=o?this._order.indexOf(o):this._order.length;o&&p===-1?this.fire(new l.ErrorEvent(new Error(`Cannot move layer "${t}" before non-existing layer "${o}".`))):(this._order.splice(p,0,t),this._layerOrderChanged=!0)}removeLayer(t){this._checkLoaded();const o=this._layers[t];if(!o)return void this.fire(new l.ErrorEvent(new Error(`Cannot remove non-existing layer "${t}".`)));o.setEventedParent(null);const h=this._order.indexOf(t);this._order.splice(h,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=o,delete this._layers[t],delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],o.onRemove&&o.onRemove(this.map)}getLayer(t){return this._layers[t]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,o,h){this._checkLoaded();const p=this.getLayer(t);p?p.minzoom===o&&p.maxzoom===h||(o!=null&&(p.minzoom=o),h!=null&&(p.maxzoom=h),this._updateLayer(p)):this.fire(new l.ErrorEvent(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,o,h={}){this._checkLoaded();const p=this.getLayer(t);if(p){if(!K(p.filter,o))return o==null?(p.filter=void 0,void this._updateLayer(p)):void(this._validate(l.validateStyle.filter,`layers.${p.id}.filter`,o,null,h)||(p.filter=l.clone$1(o),this._updateLayer(p)))}else this.fire(new l.ErrorEvent(new Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return l.clone$1(this.getLayer(t).filter)}setLayoutProperty(t,o,h,p={}){this._checkLoaded();const y=this.getLayer(t);y?K(y.getLayoutProperty(o),h)||(y.setLayoutProperty(o,h,p),this._updateLayer(y)):this.fire(new l.ErrorEvent(new Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,o){const h=this.getLayer(t);if(h)return h.getLayoutProperty(o);this.fire(new l.ErrorEvent(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,o,h,p={}){this._checkLoaded();const y=this.getLayer(t);y?K(y.getPaintProperty(o),h)||(y.setPaintProperty(o,h,p)&&this._updateLayer(y),this._changed=!0,this._updatedPaintProps[t]=!0):this.fire(new l.ErrorEvent(new Error(`Cannot style non-existing layer "${t}".`)))}getPaintProperty(t,o){return this.getLayer(t).getPaintProperty(o)}setFeatureState(t,o){this._checkLoaded();const h=t.source,p=t.sourceLayer,y=this.sourceCaches[h];if(y===void 0)return void this.fire(new l.ErrorEvent(new Error(`The source '${h}' does not exist in the map's style.`)));const v=y.getSource().type;v==="geojson"&&p?this.fire(new l.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):v!=="vector"||p?(t.id===void 0&&this.fire(new l.ErrorEvent(new Error("The feature id parameter must be provided."))),y.setFeatureState(p,t.id,o)):this.fire(new l.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(t,o){this._checkLoaded();const h=t.source,p=this.sourceCaches[h];if(p===void 0)return void this.fire(new l.ErrorEvent(new Error(`The source '${h}' does not exist in the map's style.`)));const y=p.getSource().type,v=y==="vector"?t.sourceLayer:void 0;y!=="vector"||v?o&&typeof t.id!="string"&&typeof t.id!="number"?this.fire(new l.ErrorEvent(new Error("A feature id is required to remove its specific state property."))):p.removeFeatureState(v,t.id,o):this.fire(new l.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();const o=t.source,h=t.sourceLayer,p=this.sourceCaches[o];if(p!==void 0)return p.getSource().type!=="vector"||h?(t.id===void 0&&this.fire(new l.ErrorEvent(new Error("The feature id parameter must be provided."))),p.getFeatureState(h,t.id)):void this.fire(new l.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new l.ErrorEvent(new Error(`The source '${o}' does not exist in the map's style.`)))}getTransition(){return l.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){return l.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:l.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 o=v=>this._layers[v].type==="fill-extrusion",h={},p=[];for(let v=this._order.length-1;v>=0;v--){const S=this._order[v];if(o(S)){h[S]=v;for(const T of t){const A=T[S];if(A)for(const k of A)p.push(k)}}}p.sort((v,S)=>S.intersectionZ-v.intersectionZ);const y=[];for(let v=this._order.length-1;v>=0;v--){const S=this._order[v];if(o(S))for(let T=p.length-1;T>=0;T--){const A=p[T].feature;if(h[A.layer.id]<v)break;y.push(A),p.pop()}else for(const T of t){const A=T[S];if(A)for(const k of A)y.push(k.feature)}}return y}queryRenderedFeatures(t,o,h){o&&o.filter&&this._validate(l.validateStyle.filter,"queryRenderedFeatures.filter",o.filter,null,o);const p={};if(o&&o.layers){if(!Array.isArray(o.layers))return this.fire(new l.ErrorEvent(new Error("parameters.layers must be an Array."))),[];for(const v of o.layers){const S=this._layers[v];if(!S)return this.fire(new l.ErrorEvent(new Error(`The layer '${v}' does not exist in the map's style and cannot be queried for features.`))),[];p[S.source]=!0}}const y=[];o.availableImages=this._availableImages;for(const v in this.sourceCaches)o.layers&&!p[v]||y.push(Vr(this.sourceCaches[v],this._layers,this._serializedLayers,t,o,h));return this.placement&&y.push(function(v,S,T,A,k,R,$){const q={},N=R.queryRenderedSymbols(A),j=[];for(const ie of Object.keys(N).map(Number))j.push($[ie]);j.sort(Nn);for(const ie of j){const re=ie.featureIndex.lookupSymbolFeatures(N[ie.bucketInstanceId],S,ie.bucketIndex,ie.sourceLayerIndex,k.filter,k.layers,k.availableImages,v);for(const ae in re){const ne=q[ae]=q[ae]||[],ge=re[ae];ge.sort((he,de)=>{const Se=ie.featureSortOrder;if(Se){const Ce=Se.indexOf(he.featureIndex);return Se.indexOf(de.featureIndex)-Ce}return de.featureIndex-he.featureIndex});for(const he of ge)ne.push(he)}}for(const ie in q)q[ie].forEach(re=>{const ae=re.feature,ne=T[v[ie].source].getFeatureState(ae.layer["source-layer"],ae.id);ae.source=ae.layer.source,ae.layer["source-layer"]&&(ae.sourceLayer=ae.layer["source-layer"]),ae.state=ne});return q}(this._layers,this._serializedLayers,this.sourceCaches,t,o,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(y)}querySourceFeatures(t,o){o&&o.filter&&this._validate(l.validateStyle.filter,"querySourceFeatures.filter",o.filter,null,o);const h=this.sourceCaches[t];return h?function(p,y){const v=p.getRenderableIds().map(A=>p.getTileByID(A)),S=[],T={};for(let A=0;A<v.length;A++){const k=v[A],R=k.tileID.canonical.key;T[R]||(T[R]=!0,k.querySourceFeatures(S,y))}return S}(h,o):[]}addSourceType(t,o,h){return _i.getSourceType(t)?h(new Error(`A source type called "${t}" already exists.`)):(_i.setSourceType(t,o),o.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:t,url:o.workerSourceURL},h):h(null,null))}getLight(){return this.light.getLight()}setLight(t,o={}){this._checkLoaded();const h=this.light.getLight();let p=!1;for(const v in t)if(!K(t[v],h[v])){p=!0;break}if(!p)return;const y={now:l.exported.now(),transition:l.extend({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(t,o),this.light.updateTransitions(y)}_validate(t,o,h,p,y={}){return(!y||y.validate!==!1)&&nt(this,t.call(l.validateStyle,l.extend({key:o,style:this.serialize(),value:h,styleSpec:l.spec},p)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),l.evented.off("pluginStateChange",this._rtlTextPluginCallback);for(const t in this._layers)this._layers[t].setEventedParent(null);for(const t in this.sourceCaches){const o=this.sourceCaches[t];o.setEventedParent(null),o.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 o in this.sourceCaches)this.sourceCaches[o].update(t)}_generateCollisionBoxes(){for(const t in this.sourceCaches)this._reloadSource(t)}_updatePlacement(t,o,h,p,y=!1){let v=!1,S=!1;const T={};for(const A of this._order){const k=this._layers[A];if(k.type!=="symbol")continue;if(!T[k.source]){const $=this.sourceCaches[k.source];T[k.source]=$.getRenderableIds(!0).map(q=>$.getTileByID(q)).sort((q,N)=>N.tileID.overscaledZ-q.tileID.overscaledZ||(q.tileID.isLessThan(N.tileID)?-1:1))}const R=this.crossTileSymbolIndex.addLayer(k,T[k.source],t.center.lng);v=v||R}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((y=y||this._layerOrderChanged||h===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(l.exported.now(),t.zoom))&&(this.pauseablePlacement=new je(t,this._order,y,o,h,p,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,T),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(l.exported.now()),S=!0),v&&this.pauseablePlacement.placement.setStale()),S||v)for(const A of this._order){const k=this._layers[A];k.type==="symbol"&&this.placement.updateLayerOpacities(k,T[k.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(l.exported.now())}_releaseSymbolFadeTiles(){for(const t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()}getImages(t,o,h){this.imageManager.getImages(o.icons,h),this._updateTilesForChangedImages();const p=this.sourceCaches[o.source];p&&p.setDependencies(o.tileID.key,o.type,o.icons)}getGlyphs(t,o,h){this.glyphManager.getGlyphs(o.stacks,h)}getResource(t,o,h){return l.makeRequest(o,h)}}_i.getSourceType=function(d){return fr[d]},_i.setSourceType=function(d,t){fr[d]=t},_i.registerForPluginStateChange=l.registerForPluginStateChange;var qa=l.createLayout([{name:"a_pos",type:"Int16",components:2}]),Wa={prelude:Lt(`#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:Lt(`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:Lt(`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:Lt(`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:Lt("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:Lt(`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:Lt(`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:Lt("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:Lt("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:Lt("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:Lt(`#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:Lt(`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:Lt(`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:Lt(`#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:Lt(`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:Lt(`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:Lt(`#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:Lt(`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:Lt(`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:Lt(`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:Lt(`#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:Lt(`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:Lt(`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:Lt(`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:Lt(`#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:Lt(`#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 Lt(d,t){const o=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,h=t.match(/attribute ([\w]+) ([\w]+)/g),p=d.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),y=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),v=y?y.concat(p):p,S={};return{fragmentSource:d=d.replace(o,(T,A,k,R,$)=>(S[$]=!0,A==="define"?`
#ifndef HAS_UNIFORM_u_${$}
varying ${k} ${R} ${$};
#else
uniform ${k} ${R} u_${$};
#endif
`:`
#ifdef HAS_UNIFORM_u_${$}
    ${k} ${R} ${$} = u_${$};
#endif
`)),vertexSource:t=t.replace(o,(T,A,k,R,$)=>{const q=R==="float"?"vec2":"vec4",N=$.match(/color/)?"color":q;return S[$]?A==="define"?`
#ifndef HAS_UNIFORM_u_${$}
uniform lowp float u_${$}_t;
attribute ${k} ${q} a_${$};
varying ${k} ${R} ${$};
#else
uniform ${k} ${R} u_${$};
#endif
`:N==="vec4"?`
#ifndef HAS_UNIFORM_u_${$}
    ${$} = a_${$};
#else
    ${k} ${R} ${$} = u_${$};
#endif
`:`
#ifndef HAS_UNIFORM_u_${$}
    ${$} = unpack_mix_${N}(a_${$}, u_${$}_t);
#else
    ${k} ${R} ${$} = u_${$};
#endif
`:A==="define"?`
#ifndef HAS_UNIFORM_u_${$}
uniform lowp float u_${$}_t;
attribute ${k} ${q} a_${$};
#else
uniform ${k} ${R} u_${$};
#endif
`:N==="vec4"?`
#ifndef HAS_UNIFORM_u_${$}
    ${k} ${R} ${$} = a_${$};
#else
    ${k} ${R} ${$} = u_${$};
#endif
`:`
#ifndef HAS_UNIFORM_u_${$}
    ${k} ${R} ${$} = unpack_mix_${N}(a_${$}, u_${$}_t);
#else
    ${k} ${R} ${$} = u_${$};
#endif
`}),staticAttributes:h,staticUniforms:v}}class Qc{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,o,h,p,y,v,S,T){this.context=t;let A=this.boundPaintVertexBuffers.length!==p.length;for(let k=0;!A&&k<p.length;k++)this.boundPaintVertexBuffers[k]!==p[k]&&(A=!0);t.extVertexArrayObject&&this.vao&&this.boundProgram===o&&this.boundLayoutVertexBuffer===h&&!A&&this.boundIndexBuffer===y&&this.boundVertexOffset===v&&this.boundDynamicVertexBuffer===S&&this.boundDynamicVertexBuffer2===T?(t.bindVertexArrayOES.set(this.vao),S&&S.bind(),y&&y.dynamicDraw&&y.bind(),T&&T.bind()):this.freshBind(o,h,p,y,v,S,T)}freshBind(t,o,h,p,y,v,S){let T;const A=t.numAttributes,k=this.context,R=k.gl;if(k.extVertexArrayObject)this.vao&&this.destroy(),this.vao=k.extVertexArrayObject.createVertexArrayOES(),k.bindVertexArrayOES.set(this.vao),T=0,this.boundProgram=t,this.boundLayoutVertexBuffer=o,this.boundPaintVertexBuffers=h,this.boundIndexBuffer=p,this.boundVertexOffset=y,this.boundDynamicVertexBuffer=v,this.boundDynamicVertexBuffer2=S;else{T=k.currentNumAttributes||0;for(let $=A;$<T;$++)R.disableVertexAttribArray($)}o.enableAttributes(R,t);for(const $ of h)$.enableAttributes(R,t);v&&v.enableAttributes(R,t),S&&S.enableAttributes(R,t),o.bind(),o.setVertexAttribPointers(R,t,y);for(const $ of h)$.bind(),$.setVertexAttribPointers(R,t,y);v&&(v.bind(),v.setVertexAttribPointers(R,t,y)),p&&p.bind(),S&&(S.bind(),S.setVertexAttribPointers(R,t,y)),k.currentNumAttributes=A}destroy(){this.vao&&(this.context.extVertexArrayObject.deleteVertexArrayOES(this.vao),this.vao=null)}}function Xa(d){const t=[];for(let o=0;o<d.length;o++){if(d[o]===null)continue;const h=d[o].split(" ");t.push(h.pop())}return t}class eh{constructor(t,o,h,p,y,v){const S=t.gl;this.program=S.createProgram();const T=Xa(h.staticAttributes),A=p?p.getBinderAttributes():[],k=T.concat(A),R=h.staticUniforms?Xa(h.staticUniforms):[],$=p?p.getBinderUniforms():[],q=R.concat($),N=[];for(const he of q)N.indexOf(he)<0&&N.push(he);const j=p?p.defines():[];v&&j.push("#define OVERDRAW_INSPECTOR;");const ie=j.concat(Wa.prelude.fragmentSource,h.fragmentSource).join(`
`),re=j.concat(Wa.prelude.vertexSource,h.vertexSource).join(`
`),ae=S.createShader(S.FRAGMENT_SHADER);if(S.isContextLost())return void(this.failedToCreate=!0);S.shaderSource(ae,ie),S.compileShader(ae),S.attachShader(this.program,ae);const ne=S.createShader(S.VERTEX_SHADER);if(S.isContextLost())return void(this.failedToCreate=!0);S.shaderSource(ne,re),S.compileShader(ne),S.attachShader(this.program,ne),this.attributes={};const ge={};this.numAttributes=k.length;for(let he=0;he<this.numAttributes;he++)k[he]&&(S.bindAttribLocation(this.program,he,k[he]),this.attributes[k[he]]=he);S.linkProgram(this.program),S.deleteShader(ne),S.deleteShader(ae);for(let he=0;he<N.length;he++){const de=N[he];if(de&&!ge[de]){const Se=S.getUniformLocation(this.program,de);Se&&(ge[de]=Se)}}this.fixedUniforms=y(t,ge),this.binderUniforms=p?p.getUniforms(t,ge):[]}draw(t,o,h,p,y,v,S,T,A,k,R,$,q,N,j,ie){const re=t.gl;if(this.failedToCreate)return;t.program.set(this.program),t.setDepthMode(h),t.setStencilMode(p),t.setColorMode(y),t.setCullFace(v);for(const ne in this.fixedUniforms)this.fixedUniforms[ne].set(S[ne]);N&&N.setUniforms(t,this.binderUniforms,$,{zoom:q});const ae={[re.LINES]:2,[re.TRIANGLES]:3,[re.LINE_STRIP]:1}[o];for(const ne of R.get()){const ge=ne.vaos||(ne.vaos={});(ge[T]||(ge[T]=new Qc)).bind(t,this,A,N?N.getPaintVertexBuffers():[],k,ne.vertexOffset,j,ie),re.drawElements(o,ne.primitiveLength*ae,re.UNSIGNED_SHORT,ne.primitiveOffset*ae*2)}}}function Ya(d,t,o){const h=1/li(o,1,t.transform.tileZoom),p=Math.pow(2,o.tileID.overscaledZ),y=o.tileSize*Math.pow(2,t.transform.tileZoom)/p,v=y*(o.tileID.canonical.x+o.tileID.wrap*p),S=y*o.tileID.canonical.y;return{u_image:0,u_texsize:o.imageAtlasTexture.size,u_scale:[h,d.fromScale,d.toScale],u_fade:d.t,u_pixel_coord_upper:[v>>16,S>>16],u_pixel_coord_lower:[65535&v,65535&S]}}const ml=(d,t,o,h)=>{const p=t.style.light,y=p.properties.get("position"),v=[y.x,y.y,y.z],S=function(){var A=new l.ARRAY_TYPE(9);return l.ARRAY_TYPE!=Float32Array&&(A[1]=0,A[2]=0,A[3]=0,A[5]=0,A[6]=0,A[7]=0),A[0]=1,A[4]=1,A[8]=1,A}();p.properties.get("anchor")==="viewport"&&function(A,k){var R=Math.sin(k),$=Math.cos(k);A[0]=$,A[1]=R,A[2]=0,A[3]=-R,A[4]=$,A[5]=0,A[6]=0,A[7]=0,A[8]=1}(S,-t.transform.angle),function(A,k,R){var $=k[0],q=k[1],N=k[2];A[0]=$*R[0]+q*R[3]+N*R[6],A[1]=$*R[1]+q*R[4]+N*R[7],A[2]=$*R[2]+q*R[5]+N*R[8]}(v,v,S);const T=p.properties.get("color");return{u_matrix:d,u_lightpos:v,u_lightintensity:p.properties.get("intensity"),u_lightcolor:[T.r,T.g,T.b],u_vertical_gradient:+o,u_opacity:h}},Ka=(d,t,o,h,p,y,v)=>l.extend(ml(d,t,o,h),Ya(y,t,v),{u_height_factor:-Math.pow(2,p.overscaledZ)/v.tileSize/8}),Ja=d=>({u_matrix:d}),Qa=(d,t,o,h)=>l.extend(Ja(d),Ya(o,t,h)),fl=(d,t)=>({u_matrix:d,u_world:t}),gl=(d,t,o,h,p)=>l.extend(Qa(d,t,o,h),{u_world:p}),vn=(d,t,o,h)=>{const p=d.transform;let y,v;if(h.paint.get("circle-pitch-alignment")==="map"){const S=li(o,1,p.zoom);y=!0,v=[S,S]}else y=!1,v=p.pixelsToGLUnits;return{u_camera_to_center_distance:p.cameraToCenterDistance,u_scale_with_map:+(h.paint.get("circle-pitch-scale")==="map"),u_matrix:d.translatePosMatrix(t.posMatrix,o,h.paint.get("circle-translate"),h.paint.get("circle-translate-anchor")),u_pitch_with_map:+y,u_device_pixel_ratio:d.pixelRatio,u_extrude_scale:v}},Xo=(d,t,o)=>{const h=li(o,1,t.zoom),p=Math.pow(2,t.zoom-o.tileID.overscaledZ),y=o.tileID.overscaleFactor();return{u_matrix:d,u_camera_to_center_distance:t.cameraToCenterDistance,u_pixels_to_tile_units:h,u_extrude_scale:[t.pixelsToGLUnits[0]/(h*p),t.pixelsToGLUnits[1]/(h*p)],u_overscale_factor:y}},Zn=(d,t,o=1)=>({u_matrix:d,u_color:t,u_overlay:0,u_overlay_scale:o}),yo=d=>({u_matrix:d}),Yo=(d,t,o,h)=>({u_matrix:d,u_extrude_scale:li(t,1,o),u_intensity:h});function Ko(d,t){const o=Math.pow(2,t.canonical.z),h=t.canonical.y;return[new l.MercatorCoordinate(0,h/o).toLngLat().lat,new l.MercatorCoordinate(0,(h+1)/o).toLngLat().lat]}const _o=(d,t,o)=>{const h=d.transform;return{u_matrix:es(d,t,o),u_ratio:1/li(t,1,h.zoom),u_device_pixel_ratio:d.pixelRatio,u_units_to_pixels:[1/h.pixelsToGLUnits[0],1/h.pixelsToGLUnits[1]]}},Jo=(d,t,o,h)=>l.extend(_o(d,t,o),{u_image:0,u_image_height:h}),xo=(d,t,o,h)=>{const p=d.transform,y=vo(t,p);return{u_matrix:es(d,t,o),u_texsize:t.imageAtlasTexture.size,u_ratio:1/li(t,1,p.zoom),u_device_pixel_ratio:d.pixelRatio,u_image:0,u_scale:[y,h.fromScale,h.toScale],u_fade:h.t,u_units_to_pixels:[1/p.pixelsToGLUnits[0],1/p.pixelsToGLUnits[1]]}},ri=(d,t,o,h,p)=>{const y=d.lineAtlas,v=vo(t,d.transform),S=o.layout.get("line-cap")==="round",T=y.getDash(h.from,S),A=y.getDash(h.to,S),k=T.width*p.fromScale,R=A.width*p.toScale;return l.extend(_o(d,t,o),{u_patternscale_a:[v/k,-T.height/2],u_patternscale_b:[v/R,-A.height/2],u_sdfgamma:y.width/(256*Math.min(k,R)*d.pixelRatio)/2,u_image:0,u_tex_y_a:T.y,u_tex_y_b:A.y,u_mix:p.t})};function vo(d,t){return 1/li(d,1,t.tileZoom)}function es(d,t,o){return d.translatePosMatrix(t.tileID.posMatrix,t,o.paint.get("line-translate"),o.paint.get("line-translate-anchor"))}const yl=(d,t,o,h,p)=>{return{u_matrix:d,u_tl_parent:t,u_scale_parent:o,u_buffer_scale:1,u_fade_t:h.mix,u_opacity:h.opacity*p.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:p.paint.get("raster-brightness-min"),u_brightness_high:p.paint.get("raster-brightness-max"),u_saturation_factor:(v=p.paint.get("raster-saturation"),v>0?1-1/(1.001-v):-v),u_contrast_factor:(y=p.paint.get("raster-contrast"),y>0?1/(1-y):1+y),u_spin_weights:_l(p.paint.get("raster-hue-rotate"))};var y,v};function _l(d){d*=Math.PI/180;const t=Math.sin(d),o=Math.cos(d);return[(2*o+1)/3,(-Math.sqrt(3)*t-o+1)/3,(Math.sqrt(3)*t-o+1)/3]}const Qo=(d,t,o,h,p,y,v,S,T,A)=>{const k=p.transform;return{u_is_size_zoom_constant:+(d==="constant"||d==="source"),u_is_size_feature_constant:+(d==="constant"||d==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:k.cameraToCenterDistance,u_pitch:k.pitch/360*2*Math.PI,u_rotate_symbol:+o,u_aspect_ratio:k.width/k.height,u_fade_change:p.options.fadeDuration?p.symbolFadeChange:1,u_matrix:y,u_label_plane_matrix:v,u_coord_matrix:S,u_is_text:+T,u_pitch_with_map:+h,u_texsize:A,u_texture:0}},ts=(d,t,o,h,p,y,v,S,T,A,k)=>{const R=p.transform;return l.extend(Qo(d,t,o,h,p,y,v,S,T,A),{u_gamma_scale:h?Math.cos(R._pitch)*R.cameraToCenterDistance:1,u_device_pixel_ratio:p.pixelRatio,u_is_halo:+k})},th=(d,t,o,h,p,y,v,S,T,A)=>l.extend(ts(d,t,o,h,p,y,v,S,!0,T,!0),{u_texsize_icon:A,u_texture_icon:1}),ih=(d,t,o)=>({u_matrix:d,u_opacity:t,u_color:o}),is=(d,t,o,h,p,y)=>l.extend(function(v,S,T,A){const k=T.imageManager.getPattern(v.from.toString()),R=T.imageManager.getPattern(v.to.toString()),{width:$,height:q}=T.imageManager.getPixelSize(),N=Math.pow(2,A.tileID.overscaledZ),j=A.tileSize*Math.pow(2,T.transform.tileZoom)/N,ie=j*(A.tileID.canonical.x+A.tileID.wrap*N),re=j*A.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:k.tl,u_pattern_br_a:k.br,u_pattern_tl_b:R.tl,u_pattern_br_b:R.br,u_texsize:[$,q],u_mix:S.t,u_pattern_size_a:k.displaySize,u_pattern_size_b:R.displaySize,u_scale_a:S.fromScale,u_scale_b:S.toScale,u_tile_units_to_pixels:1/li(A,1,T.transform.tileZoom),u_pixel_coord_upper:[ie>>16,re>>16],u_pixel_coord_lower:[65535&ie,65535&re]}}(h,y,o,p),{u_matrix:d,u_opacity:t}),rs={fillExtrusion:(d,t)=>({u_matrix:new l.UniformMatrix4f(d,t.u_matrix),u_lightpos:new l.Uniform3f(d,t.u_lightpos),u_lightintensity:new l.Uniform1f(d,t.u_lightintensity),u_lightcolor:new l.Uniform3f(d,t.u_lightcolor),u_vertical_gradient:new l.Uniform1f(d,t.u_vertical_gradient),u_opacity:new l.Uniform1f(d,t.u_opacity)}),fillExtrusionPattern:(d,t)=>({u_matrix:new l.UniformMatrix4f(d,t.u_matrix),u_lightpos:new l.Uniform3f(d,t.u_lightpos),u_lightintensity:new l.Uniform1f(d,t.u_lightintensity),u_lightcolor:new l.Uniform3f(d,t.u_lightcolor),u_vertical_gradient:new l.Uniform1f(d,t.u_vertical_gradient),u_height_factor:new l.Uniform1f(d,t.u_height_factor),u_image:new l.Uniform1i(d,t.u_image),u_texsize:new l.Uniform2f(d,t.u_texsize),u_pixel_coord_upper:new l.Uniform2f(d,t.u_pixel_coord_upper),u_pixel_coord_lower:new l.Uniform2f(d,t.u_pixel_coord_lower),u_scale:new l.Uniform3f(d,t.u_scale),u_fade:new l.Uniform1f(d,t.u_fade),u_opacity:new l.Uniform1f(d,t.u_opacity)}),fill:(d,t)=>({u_matrix:new l.UniformMatrix4f(d,t.u_matrix)}),fillPattern:(d,t)=>({u_matrix:new l.UniformMatrix4f(d,t.u_matrix),u_image:new l.Uniform1i(d,t.u_image),u_texsize:new l.Uniform2f(d,t.u_texsize),u_pixel_coord_upper:new l.Uniform2f(d,t.u_pixel_coord_upper),u_pixel_coord_lower:new l.Uniform2f(d,t.u_pixel_coord_lower),u_scale:new l.Uniform3f(d,t.u_scale),u_fade:new l.Uniform1f(d,t.u_fade)}),fillOutline:(d,t)=>({u_matrix:new l.UniformMatrix4f(d,t.u_matrix),u_world:new l.Uniform2f(d,t.u_world)}),fillOutlinePattern:(d,t)=>({u_matrix:new l.UniformMatrix4f(d,t.u_matrix),u_world:new l.Uniform2f(d,t.u_world),u_image:new l.Uniform1i(d,t.u_image),u_texsize:new l.Uniform2f(d,t.u_texsize),u_pixel_coord_upper:new l.Uniform2f(d,t.u_pixel_coord_upper),u_pixel_coord_lower:new l.Uniform2f(d,t.u_pixel_coord_lower),u_scale:new l.Uniform3f(d,t.u_scale),u_fade:new l.Uniform1f(d,t.u_fade)}),circle:(d,t)=>({u_camera_to_center_distance:new l.Uniform1f(d,t.u_camera_to_center_distance),u_scale_with_map:new l.Uniform1i(d,t.u_scale_with_map),u_pitch_with_map:new l.Uniform1i(d,t.u_pitch_with_map),u_extrude_scale:new l.Uniform2f(d,t.u_extrude_scale),u_device_pixel_ratio:new l.Uniform1f(d,t.u_device_pixel_ratio),u_matrix:new l.UniformMatrix4f(d,t.u_matrix)}),collisionBox:(d,t)=>({u_matrix:new l.UniformMatrix4f(d,t.u_matrix),u_camera_to_center_distance:new l.Uniform1f(d,t.u_camera_to_center_distance),u_pixels_to_tile_units:new l.Uniform1f(d,t.u_pixels_to_tile_units),u_extrude_scale:new l.Uniform2f(d,t.u_extrude_scale),u_overscale_factor:new l.Uniform1f(d,t.u_overscale_factor)}),collisionCircle:(d,t)=>({u_matrix:new l.UniformMatrix4f(d,t.u_matrix),u_inv_matrix:new l.UniformMatrix4f(d,t.u_inv_matrix),u_camera_to_center_distance:new l.Uniform1f(d,t.u_camera_to_center_distance),u_viewport_size:new l.Uniform2f(d,t.u_viewport_size)}),debug:(d,t)=>({u_color:new l.UniformColor(d,t.u_color),u_matrix:new l.UniformMatrix4f(d,t.u_matrix),u_overlay:new l.Uniform1i(d,t.u_overlay),u_overlay_scale:new l.Uniform1f(d,t.u_overlay_scale)}),clippingMask:(d,t)=>({u_matrix:new l.UniformMatrix4f(d,t.u_matrix)}),heatmap:(d,t)=>({u_extrude_scale:new l.Uniform1f(d,t.u_extrude_scale),u_intensity:new l.Uniform1f(d,t.u_intensity),u_matrix:new l.UniformMatrix4f(d,t.u_matrix)}),heatmapTexture:(d,t)=>({u_matrix:new l.UniformMatrix4f(d,t.u_matrix),u_world:new l.Uniform2f(d,t.u_world),u_image:new l.Uniform1i(d,t.u_image),u_color_ramp:new l.Uniform1i(d,t.u_color_ramp),u_opacity:new l.Uniform1f(d,t.u_opacity)}),hillshade:(d,t)=>({u_matrix:new l.UniformMatrix4f(d,t.u_matrix),u_image:new l.Uniform1i(d,t.u_image),u_latrange:new l.Uniform2f(d,t.u_latrange),u_light:new l.Uniform2f(d,t.u_light),u_shadow:new l.UniformColor(d,t.u_shadow),u_highlight:new l.UniformColor(d,t.u_highlight),u_accent:new l.UniformColor(d,t.u_accent)}),hillshadePrepare:(d,t)=>({u_matrix:new l.UniformMatrix4f(d,t.u_matrix),u_image:new l.Uniform1i(d,t.u_image),u_dimension:new l.Uniform2f(d,t.u_dimension),u_zoom:new l.Uniform1f(d,t.u_zoom),u_unpack:new l.Uniform4f(d,t.u_unpack)}),line:(d,t)=>({u_matrix:new l.UniformMatrix4f(d,t.u_matrix),u_ratio:new l.Uniform1f(d,t.u_ratio),u_device_pixel_ratio:new l.Uniform1f(d,t.u_device_pixel_ratio),u_units_to_pixels:new l.Uniform2f(d,t.u_units_to_pixels)}),lineGradient:(d,t)=>({u_matrix:new l.UniformMatrix4f(d,t.u_matrix),u_ratio:new l.Uniform1f(d,t.u_ratio),u_device_pixel_ratio:new l.Uniform1f(d,t.u_device_pixel_ratio),u_units_to_pixels:new l.Uniform2f(d,t.u_units_to_pixels),u_image:new l.Uniform1i(d,t.u_image),u_image_height:new l.Uniform1f(d,t.u_image_height)}),linePattern:(d,t)=>({u_matrix:new l.UniformMatrix4f(d,t.u_matrix),u_texsize:new l.Uniform2f(d,t.u_texsize),u_ratio:new l.Uniform1f(d,t.u_ratio),u_device_pixel_ratio:new l.Uniform1f(d,t.u_device_pixel_ratio),u_image:new l.Uniform1i(d,t.u_image),u_units_to_pixels:new l.Uniform2f(d,t.u_units_to_pixels),u_scale:new l.Uniform3f(d,t.u_scale),u_fade:new l.Uniform1f(d,t.u_fade)}),lineSDF:(d,t)=>({u_matrix:new l.UniformMatrix4f(d,t.u_matrix),u_ratio:new l.Uniform1f(d,t.u_ratio),u_device_pixel_ratio:new l.Uniform1f(d,t.u_device_pixel_ratio),u_units_to_pixels:new l.Uniform2f(d,t.u_units_to_pixels),u_patternscale_a:new l.Uniform2f(d,t.u_patternscale_a),u_patternscale_b:new l.Uniform2f(d,t.u_patternscale_b),u_sdfgamma:new l.Uniform1f(d,t.u_sdfgamma),u_image:new l.Uniform1i(d,t.u_image),u_tex_y_a:new l.Uniform1f(d,t.u_tex_y_a),u_tex_y_b:new l.Uniform1f(d,t.u_tex_y_b),u_mix:new l.Uniform1f(d,t.u_mix)}),raster:(d,t)=>({u_matrix:new l.UniformMatrix4f(d,t.u_matrix),u_tl_parent:new l.Uniform2f(d,t.u_tl_parent),u_scale_parent:new l.Uniform1f(d,t.u_scale_parent),u_buffer_scale:new l.Uniform1f(d,t.u_buffer_scale),u_fade_t:new l.Uniform1f(d,t.u_fade_t),u_opacity:new l.Uniform1f(d,t.u_opacity),u_image0:new l.Uniform1i(d,t.u_image0),u_image1:new l.Uniform1i(d,t.u_image1),u_brightness_low:new l.Uniform1f(d,t.u_brightness_low),u_brightness_high:new l.Uniform1f(d,t.u_brightness_high),u_saturation_factor:new l.Uniform1f(d,t.u_saturation_factor),u_contrast_factor:new l.Uniform1f(d,t.u_contrast_factor),u_spin_weights:new l.Uniform3f(d,t.u_spin_weights)}),symbolIcon:(d,t)=>({u_is_size_zoom_constant:new l.Uniform1i(d,t.u_is_size_zoom_constant),u_is_size_feature_constant:new l.Uniform1i(d,t.u_is_size_feature_constant),u_size_t:new l.Uniform1f(d,t.u_size_t),u_size:new l.Uniform1f(d,t.u_size),u_camera_to_center_distance:new l.Uniform1f(d,t.u_camera_to_center_distance),u_pitch:new l.Uniform1f(d,t.u_pitch),u_rotate_symbol:new l.Uniform1i(d,t.u_rotate_symbol),u_aspect_ratio:new l.Uniform1f(d,t.u_aspect_ratio),u_fade_change:new l.Uniform1f(d,t.u_fade_change),u_matrix:new l.UniformMatrix4f(d,t.u_matrix),u_label_plane_matrix:new l.UniformMatrix4f(d,t.u_label_plane_matrix),u_coord_matrix:new l.UniformMatrix4f(d,t.u_coord_matrix),u_is_text:new l.Uniform1i(d,t.u_is_text),u_pitch_with_map:new l.Uniform1i(d,t.u_pitch_with_map),u_texsize:new l.Uniform2f(d,t.u_texsize),u_texture:new l.Uniform1i(d,t.u_texture)}),symbolSDF:(d,t)=>({u_is_size_zoom_constant:new l.Uniform1i(d,t.u_is_size_zoom_constant),u_is_size_feature_constant:new l.Uniform1i(d,t.u_is_size_feature_constant),u_size_t:new l.Uniform1f(d,t.u_size_t),u_size:new l.Uniform1f(d,t.u_size),u_camera_to_center_distance:new l.Uniform1f(d,t.u_camera_to_center_distance),u_pitch:new l.Uniform1f(d,t.u_pitch),u_rotate_symbol:new l.Uniform1i(d,t.u_rotate_symbol),u_aspect_ratio:new l.Uniform1f(d,t.u_aspect_ratio),u_fade_change:new l.Uniform1f(d,t.u_fade_change),u_matrix:new l.UniformMatrix4f(d,t.u_matrix),u_label_plane_matrix:new l.UniformMatrix4f(d,t.u_label_plane_matrix),u_coord_matrix:new l.UniformMatrix4f(d,t.u_coord_matrix),u_is_text:new l.Uniform1i(d,t.u_is_text),u_pitch_with_map:new l.Uniform1i(d,t.u_pitch_with_map),u_texsize:new l.Uniform2f(d,t.u_texsize),u_texture:new l.Uniform1i(d,t.u_texture),u_gamma_scale:new l.Uniform1f(d,t.u_gamma_scale),u_device_pixel_ratio:new l.Uniform1f(d,t.u_device_pixel_ratio),u_is_halo:new l.Uniform1i(d,t.u_is_halo)}),symbolTextAndIcon:(d,t)=>({u_is_size_zoom_constant:new l.Uniform1i(d,t.u_is_size_zoom_constant),u_is_size_feature_constant:new l.Uniform1i(d,t.u_is_size_feature_constant),u_size_t:new l.Uniform1f(d,t.u_size_t),u_size:new l.Uniform1f(d,t.u_size),u_camera_to_center_distance:new l.Uniform1f(d,t.u_camera_to_center_distance),u_pitch:new l.Uniform1f(d,t.u_pitch),u_rotate_symbol:new l.Uniform1i(d,t.u_rotate_symbol),u_aspect_ratio:new l.Uniform1f(d,t.u_aspect_ratio),u_fade_change:new l.Uniform1f(d,t.u_fade_change),u_matrix:new l.UniformMatrix4f(d,t.u_matrix),u_label_plane_matrix:new l.UniformMatrix4f(d,t.u_label_plane_matrix),u_coord_matrix:new l.UniformMatrix4f(d,t.u_coord_matrix),u_is_text:new l.Uniform1i(d,t.u_is_text),u_pitch_with_map:new l.Uniform1i(d,t.u_pitch_with_map),u_texsize:new l.Uniform2f(d,t.u_texsize),u_texsize_icon:new l.Uniform2f(d,t.u_texsize_icon),u_texture:new l.Uniform1i(d,t.u_texture),u_texture_icon:new l.Uniform1i(d,t.u_texture_icon),u_gamma_scale:new l.Uniform1f(d,t.u_gamma_scale),u_device_pixel_ratio:new l.Uniform1f(d,t.u_device_pixel_ratio),u_is_halo:new l.Uniform1i(d,t.u_is_halo)}),background:(d,t)=>({u_matrix:new l.UniformMatrix4f(d,t.u_matrix),u_opacity:new l.Uniform1f(d,t.u_opacity),u_color:new l.UniformColor(d,t.u_color)}),backgroundPattern:(d,t)=>({u_matrix:new l.UniformMatrix4f(d,t.u_matrix),u_opacity:new l.Uniform1f(d,t.u_opacity),u_image:new l.Uniform1i(d,t.u_image),u_pattern_tl_a:new l.Uniform2f(d,t.u_pattern_tl_a),u_pattern_br_a:new l.Uniform2f(d,t.u_pattern_br_a),u_pattern_tl_b:new l.Uniform2f(d,t.u_pattern_tl_b),u_pattern_br_b:new l.Uniform2f(d,t.u_pattern_br_b),u_texsize:new l.Uniform2f(d,t.u_texsize),u_mix:new l.Uniform1f(d,t.u_mix),u_pattern_size_a:new l.Uniform2f(d,t.u_pattern_size_a),u_pattern_size_b:new l.Uniform2f(d,t.u_pattern_size_b),u_scale_a:new l.Uniform1f(d,t.u_scale_a),u_scale_b:new l.Uniform1f(d,t.u_scale_b),u_pixel_coord_upper:new l.Uniform2f(d,t.u_pixel_coord_upper),u_pixel_coord_lower:new l.Uniform2f(d,t.u_pixel_coord_lower),u_tile_units_to_pixels:new l.Uniform1f(d,t.u_tile_units_to_pixels)})};class ns{constructor(t,o,h){this.context=t;const p=t.gl;this.buffer=p.createBuffer(),this.dynamicDraw=Boolean(h),this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),p.bufferData(p.ELEMENT_ARRAY_BUFFER,o.arrayBuffer,this.dynamicDraw?p.DYNAMIC_DRAW:p.STATIC_DRAW),this.dynamicDraw||delete o.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){const o=this.context.gl;this.context.unbindVAO(),this.bind(),o.bufferSubData(o.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const os={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class xl{constructor(t,o,h,p){this.length=o.length,this.attributes=h,this.itemSize=o.bytesPerElement,this.dynamicDraw=p,this.context=t;const y=t.gl;this.buffer=y.createBuffer(),t.bindVertexBuffer.set(this.buffer),y.bufferData(y.ARRAY_BUFFER,o.arrayBuffer,this.dynamicDraw?y.DYNAMIC_DRAW:y.STATIC_DRAW),this.dynamicDraw||delete o.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){const o=this.context.gl;this.bind(),o.bufferSubData(o.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,o){for(let h=0;h<this.attributes.length;h++){const p=o.attributes[this.attributes[h].name];p!==void 0&&t.enableVertexAttribArray(p)}}setVertexAttribPointers(t,o,h){for(let p=0;p<this.attributes.length;p++){const y=this.attributes[p],v=o.attributes[y.name];v!==void 0&&t.vertexAttribPointer(v,y.components,t[os[y.type]],!1,this.itemSize,y.offset+this.itemSize*(h||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class St{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 rh extends St{getDefault(){return l.Color.transparent}set(t){const o=this.current;(t.r!==o.r||t.g!==o.g||t.b!==o.b||t.a!==o.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class bo extends St{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class wo extends St{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class vl extends St{getDefault(){return[!0,!0,!0,!0]}set(t){const o=this.current;(t[0]!==o[0]||t[1]!==o[1]||t[2]!==o[2]||t[3]!==o[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class Wi extends St{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class as extends St{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class ea extends St{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){const o=this.current;(t.func!==o.func||t.ref!==o.ref||t.mask!==o.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}}class ta extends St{getDefault(){const t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){const o=this.current;(t[0]!==o[0]||t[1]!==o[1]||t[2]!==o[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}}class ss extends St{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;t?o.enable(o.STENCIL_TEST):o.disable(o.STENCIL_TEST),this.current=t,this.dirty=!1}}class ls extends St{getDefault(){return[0,1]}set(t){const o=this.current;(t[0]!==o[0]||t[1]!==o[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}}class ia extends St{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;t?o.enable(o.DEPTH_TEST):o.disable(o.DEPTH_TEST),this.current=t,this.dirty=!1}}class cs extends St{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class hs extends St{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;t?o.enable(o.BLEND):o.disable(o.BLEND),this.current=t,this.dirty=!1}}class ra extends St{getDefault(){const t=this.gl;return[t.ONE,t.ZERO]}set(t){const o=this.current;(t[0]!==o[0]||t[1]!==o[1]||this.dirty)&&(this.gl.blendFunc(t[0],t[1]),this.current=t,this.dirty=!1)}}class bl extends St{getDefault(){return l.Color.transparent}set(t){const o=this.current;(t.r!==o.r||t.g!==o.g||t.b!==o.b||t.a!==o.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class wl extends St{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}}class Hn extends St{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;t?o.enable(o.CULL_FACE):o.disable(o.CULL_FACE),this.current=t,this.dirty=!1}}class nh extends St{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class oh extends St{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}class ah extends St{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}}class sh extends St{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class lh extends St{getDefault(){const t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){const o=this.current;(t[0]!==o[0]||t[1]!==o[1]||t[2]!==o[2]||t[3]!==o[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class ch extends St{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;o.bindFramebuffer(o.FRAMEBUFFER,t),this.current=t,this.dirty=!1}}class us extends St{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;o.bindRenderbuffer(o.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class ds extends St{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;o.bindTexture(o.TEXTURE_2D,t),this.current=t,this.dirty=!1}}class jn extends St{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;o.bindBuffer(o.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Sl extends St{getDefault(){return null}set(t){const o=this.gl;o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Tl extends St{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 ps extends St{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;o.pixelStorei(o.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}}class bn extends St{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}}class Cl extends St{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}}class wn extends St{constructor(t,o){super(t),this.context=t,this.parent=o}getDefault(){return null}}class qn extends wn{setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const o=this.gl;o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class Il extends wn{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const o=this.gl;o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_ATTACHMENT,o.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class ms{constructor(t,o,h,p){this.context=t,this.width=o,this.height=h;const y=this.framebuffer=t.gl.createFramebuffer();this.colorAttachment=new qn(t,y),p&&(this.depthAttachment=new Il(t,y))}destroy(){const t=this.context.gl,o=this.colorAttachment.get();if(o&&t.deleteTexture(o),this.depthAttachment){const h=this.depthAttachment.get();h&&t.deleteRenderbuffer(h)}t.deleteFramebuffer(this.framebuffer)}}class it{constructor(t,o,h){this.blendFunction=t,this.blendColor=o,this.mask=h}}it.Replace=[1,0],it.disabled=new it(it.Replace,l.Color.transparent,[!1,!1,!1,!1]),it.unblended=new it(it.Replace,l.Color.transparent,[!0,!0,!0,!0]),it.alphaBlended=new it([1,771],l.Color.transparent,[!0,!0,!0,!0]);class na{constructor(t){this.gl=t,this.extVertexArrayObject=this.gl.getExtension("OES_vertex_array_object"),this.clearColor=new rh(this),this.clearDepth=new bo(this),this.clearStencil=new wo(this),this.colorMask=new vl(this),this.depthMask=new Wi(this),this.stencilMask=new as(this),this.stencilFunc=new ea(this),this.stencilOp=new ta(this),this.stencilTest=new ss(this),this.depthRange=new ls(this),this.depthTest=new ia(this),this.depthFunc=new cs(this),this.blend=new hs(this),this.blendFunc=new ra(this),this.blendColor=new bl(this),this.blendEquation=new wl(this),this.cullFace=new Hn(this),this.cullFaceSide=new nh(this),this.frontFace=new oh(this),this.program=new ah(this),this.activeTexture=new sh(this),this.viewport=new lh(this),this.bindFramebuffer=new ch(this),this.bindRenderbuffer=new us(this),this.bindTexture=new ds(this),this.bindVertexBuffer=new jn(this),this.bindElementBuffer=new Sl(this),this.bindVertexArrayOES=this.extVertexArrayObject&&new Tl(this),this.pixelStoreUnpack=new ps(this),this.pixelStoreUnpackPremultiplyAlpha=new bn(this),this.pixelStoreUnpackFlipY=new Cl(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,o){return new ns(this,t,o)}createVertexBuffer(t,o,h){return new xl(this,t,o,h)}createRenderbuffer(t,o,h){const p=this.gl,y=p.createRenderbuffer();return this.bindRenderbuffer.set(y),p.renderbufferStorage(p.RENDERBUFFER,t,o,h),this.bindRenderbuffer.set(null),y}createFramebuffer(t,o,h){return new ms(this,t,o,h)}clear({color:t,depth:o}){const h=this.gl;let p=0;t&&(p|=h.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),o!==void 0&&(p|=h.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(o),this.depthMask.set(!0)),h.clear(p)}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){K(t.blendFunction,it.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 Et{constructor(t,o,h){this.func=t,this.mask=o,this.range=h}}Et.ReadOnly=!1,Et.ReadWrite=!0,Et.disabled=new Et(519,Et.ReadOnly,[0,1]);const oa=7680;class Ot{constructor(t,o,h,p,y,v){this.test=t,this.ref=o,this.mask=h,this.fail=p,this.depthFail=y,this.pass=v}}Ot.disabled=new Ot({func:519,mask:0},0,0,oa,oa,oa);class Yt{constructor(t,o,h){this.enable=t,this.mode=o,this.frontFace=h}}let aa;function fs(d,t,o,h,p,y,v){const S=d.context,T=S.gl,A=d.useProgram("collisionBox"),k=[];let R=0,$=0;for(let ne=0;ne<h.length;ne++){const ge=h[ne],he=t.getTile(ge),de=he.getBucket(o);if(!de)continue;let Se=ge.posMatrix;p[0]===0&&p[1]===0||(Se=d.translatePosMatrix(ge.posMatrix,he,p,y));const Ce=v?de.textCollisionBox:de.iconCollisionBox,fe=de.collisionCircleArray;if(fe.length>0){const Ne=l.create(),ze=Se;l.mul(Ne,de.placementInvProjMatrix,d.transform.glCoordMatrix),l.mul(Ne,Ne,de.placementViewportMatrix),k.push({circleArray:fe,circleOffset:$,transform:ze,invTransform:Ne}),R+=fe.length/4,$=R}Ce&&A.draw(S,T.LINES,Et.disabled,Ot.disabled,d.colorModeForRenderPass(),Yt.disabled,Xo(Se,d.transform,he),o.id,Ce.layoutVertexBuffer,Ce.indexBuffer,Ce.segments,null,d.transform.zoom,null,null,Ce.collisionVertexBuffer)}if(!v||!k.length)return;const q=d.useProgram("collisionCircle"),N=new l.CollisionCircleLayoutArray;N.resize(4*R),N._trim();let j=0;for(const ne of k)for(let ge=0;ge<ne.circleArray.length/4;ge++){const he=4*ge,de=ne.circleArray[he+0],Se=ne.circleArray[he+1],Ce=ne.circleArray[he+2],fe=ne.circleArray[he+3];N.emplace(j++,de,Se,Ce,fe,0),N.emplace(j++,de,Se,Ce,fe,1),N.emplace(j++,de,Se,Ce,fe,2),N.emplace(j++,de,Se,Ce,fe,3)}(!aa||aa.length<2*R)&&(aa=function(ne){const ge=2*ne,he=new l.QuadTriangleArray;he.resize(ge),he._trim();for(let de=0;de<ge;de++){const Se=6*de;he.uint16[Se+0]=4*de+0,he.uint16[Se+1]=4*de+1,he.uint16[Se+2]=4*de+2,he.uint16[Se+3]=4*de+2,he.uint16[Se+4]=4*de+3,he.uint16[Se+5]=4*de+0}return he}(R));const ie=S.createIndexBuffer(aa,!0),re=S.createVertexBuffer(N,l.collisionCircleLayout.members,!0);for(const ne of k){const ge={u_matrix:ne.transform,u_inv_matrix:ne.invTransform,u_camera_to_center_distance:(ae=d.transform).cameraToCenterDistance,u_viewport_size:[ae.width,ae.height]};q.draw(S,T.TRIANGLES,Et.disabled,Ot.disabled,d.colorModeForRenderPass(),Yt.disabled,ge,o.id,re,ie,l.SegmentVector.simpleSegment(0,2*ne.circleOffset,ne.circleArray.length,ne.circleArray.length/2),null,d.transform.zoom,null,null,null)}var ae;re.destroy(),ie.destroy()}Yt.disabled=new Yt(!1,1029,2305),Yt.backCCW=new Yt(!0,1029,2305);const hh=l.identity(new Float32Array(16));function gs(d,t,o,h,p,y){const{horizontalAlign:v,verticalAlign:S}=l.getAnchorAlignment(d),T=-(v-.5)*t,A=-(S-.5)*o,k=l.evaluateVariableOffset(d,h);return new l.pointGeometry((T/p+k[0])*y,(A/p+k[1])*y)}function sa(d,t,o,h,p,y,v,S,T,A){const k=d.text.placedSymbolArray,R=d.text.dynamicLayoutVertexArray,$=d.icon.dynamicLayoutVertexArray,q={};R.clear();for(let N=0;N<k.length;N++){const j=k.get(N),ie=d.allowVerticalPlacement&&!j.placedOrientation,re=j.hidden||!j.crossTileID||ie?null:h[j.crossTileID];if(re){const ae=new l.pointGeometry(j.anchorX,j.anchorY),ne=Rt(ae,o?v:y),ge=Ee(p.cameraToCenterDistance,ne.signedDistanceFromCamera);let he=l.evaluateSizeForFeature(d.textSizeData,T,j)*ge/l.ONE_EM;o&&(he*=d.tilePixelRatio/S);const{width:de,height:Se,anchor:Ce,textOffset:fe,textBoxScale:Ne}=re,ze=gs(Ce,de,Se,fe,Ne,he),et=o?Rt(ae.add(ze),y).point:ne.point.add(t?ze.rotate(-p.angle):ze),_t=d.allowVerticalPlacement&&j.placedOrientation===l.WritingMode.vertical?Math.PI/2:0;for(let dt=0;dt<j.numGlyphs;dt++)l.addDynamicAttributes(R,et,_t);A&&j.associatedIconIndex>=0&&(q[j.associatedIconIndex]={shiftedAnchor:et,angle:_t})}else ii(j.numGlyphs,R)}if(A){$.clear();const N=d.icon.placedSymbolArray;for(let j=0;j<N.length;j++){const ie=N.get(j);if(ie.hidden)ii(ie.numGlyphs,$);else{const re=q[j];if(re)for(let ae=0;ae<ie.numGlyphs;ae++)l.addDynamicAttributes($,re.shiftedAnchor,re.angle);else ii(ie.numGlyphs,$)}}d.icon.dynamicLayoutVertexBuffer.updateData($)}d.text.dynamicLayoutVertexBuffer.updateData(R)}function la(d,t,o){return o.iconsInText&&t?"symbolTextAndIcon":d?"symbolSDF":"symbolIcon"}function ca(d,t,o,h,p,y,v,S,T,A,k,R){const $=d.context,q=$.gl,N=d.transform,j=S==="map",ie=T==="map",re=S!=="viewport"&&o.layout.get("symbol-placement")!=="point",ae=j&&!ie&&!re,ne=!o.layout.get("symbol-sort-key").isConstant();let ge=!1;const he=d.depthModeForSublayer(0,Et.ReadOnly),de=o.layout.get("text-variable-anchor"),Se=[];for(const Ce of h){const fe=t.getTile(Ce),Ne=fe.getBucket(o);if(!Ne)continue;const ze=p?Ne.text:Ne.icon;if(!ze||!ze.segments.get().length)continue;const et=ze.programConfigurations.get(o.id),_t=p||Ne.sdfIcons,dt=p?Ne.textSizeData:Ne.iconSizeData,ft=ie||N.pitch!==0,jt=d.useProgram(la(_t,p,Ne),et),tt=l.evaluateSizeForZoom(dt,N.zoom);let bt,Pt,xi,Yi,sr=[0,0],lr=null;if(p){if(Pt=fe.glyphAtlasTexture,xi=q.LINEAR,bt=fe.glyphAtlasTexture.size,Ne.iconsInText){sr=fe.imageAtlasTexture.size,lr=fe.imageAtlasTexture;const zr=dt.kind==="composite"||dt.kind==="camera";Yi=ft||d.options.rotating||d.options.zooming||zr?q.LINEAR:q.NEAREST}}else{const zr=o.layout.get("icon-size").constantOr(0)!==1||Ne.iconsNeedLinear;Pt=fe.imageAtlasTexture,xi=_t||d.options.rotating||d.options.zooming||zr||ft?q.LINEAR:q.NEAREST,bt=fe.imageAtlasTexture.size}const on=li(fe,1,d.transform.zoom),Gi=Pi(Ce.posMatrix,ie,j,d.transform,on),Mr=yn(Ce.posMatrix,ie,j,d.transform,on),An=de&&Ne.hasTextData(),Ki=o.layout.get("icon-text-fit")!=="none"&&An&&Ne.hasIconData();if(re){const zr=o.layout.get("text-rotation-alignment")==="map";ot(Ne,Ce.posMatrix,d,p,Gi,Mr,ie,A,zr)}const wt=d.translatePosMatrix(Ce.posMatrix,fe,y,v),Tt=re||p&&de||Ki?hh:Gi,ni=d.translatePosMatrix(Mr,fe,y,v,!0),zi=_t&&o.paint.get(p?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let $t;$t=_t?Ne.iconsInText?th(dt.kind,tt,ae,ie,d,wt,Tt,ni,bt,sr):ts(dt.kind,tt,ae,ie,d,wt,Tt,ni,p,bt,!0):Qo(dt.kind,tt,ae,ie,d,wt,Tt,ni,p,bt);const Pn={program:jt,buffers:ze,uniformValues:$t,atlasTexture:Pt,atlasTextureIcon:lr,atlasInterpolation:xi,atlasInterpolationIcon:Yi,isSDF:_t,hasHalo:zi};if(ne&&Ne.canOverlap){ge=!0;const zr=ze.segments.get();for(const wa of zr)Se.push({segments:new l.SegmentVector([wa]),sortKey:wa.sortKey,state:Pn})}else Se.push({segments:ze.segments,sortKey:0,state:Pn})}ge&&Se.sort((Ce,fe)=>Ce.sortKey-fe.sortKey);for(const Ce of Se){const fe=Ce.state;if($.activeTexture.set(q.TEXTURE0),fe.atlasTexture.bind(fe.atlasInterpolation,q.CLAMP_TO_EDGE),fe.atlasTextureIcon&&($.activeTexture.set(q.TEXTURE1),fe.atlasTextureIcon&&fe.atlasTextureIcon.bind(fe.atlasInterpolationIcon,q.CLAMP_TO_EDGE)),fe.isSDF){const Ne=fe.uniformValues;fe.hasHalo&&(Ne.u_is_halo=1,ha(fe.buffers,Ce.segments,o,d,fe.program,he,k,R,Ne)),Ne.u_is_halo=0}ha(fe.buffers,Ce.segments,o,d,fe.program,he,k,R,fe.uniformValues)}}function ha(d,t,o,h,p,y,v,S,T){const A=h.context;p.draw(A,A.gl.TRIANGLES,y,v,S,Yt.disabled,T,o.id,d.layoutVertexBuffer,d.indexBuffer,t,o.paint,h.transform.zoom,d.programConfigurations.get(o.id),d.dynamicLayoutVertexBuffer,d.opacityVertexBuffer)}function ys(d,t,o,h,p,y,v){const S=d.context.gl,T=o.paint.get("fill-pattern"),A=T&&T.constantOr(1),k=o.getCrossfadeParameters();let R,$,q,N,j;v?($=A&&!o.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",R=S.LINES):($=A?"fillPattern":"fill",R=S.TRIANGLES);for(const ie of h){const re=t.getTile(ie);if(A&&!re.patternsLoaded())continue;const ae=re.getBucket(o);if(!ae)continue;const ne=ae.programConfigurations.get(o.id),ge=d.useProgram($,ne);A&&(d.context.activeTexture.set(S.TEXTURE0),re.imageAtlasTexture.bind(S.LINEAR,S.CLAMP_TO_EDGE),ne.updatePaintBuffers(k));const he=T.constantOr(null);if(he&&re.imageAtlas){const Se=re.imageAtlas,Ce=Se.patternPositions[he.to.toString()],fe=Se.patternPositions[he.from.toString()];Ce&&fe&&ne.setConstantPatternPositions(Ce,fe)}const de=d.translatePosMatrix(ie.posMatrix,re,o.paint.get("fill-translate"),o.paint.get("fill-translate-anchor"));if(v){N=ae.indexBuffer2,j=ae.segments2;const Se=[S.drawingBufferWidth,S.drawingBufferHeight];q=$==="fillOutlinePattern"&&A?gl(de,d,k,re,Se):fl(de,Se)}else N=ae.indexBuffer,j=ae.segments,q=A?Qa(de,d,k,re):Ja(de);ge.draw(d.context,R,p,d.stencilModeForClipping(ie),y,Yt.disabled,q,o.id,ae.layoutVertexBuffer,N,j,o.paint,d.transform.zoom,ne)}}function Wn(d,t,o,h,p,y,v){const S=d.context,T=S.gl,A=o.paint.get("fill-extrusion-pattern"),k=A.constantOr(1),R=o.getCrossfadeParameters(),$=o.paint.get("fill-extrusion-opacity");for(const q of h){const N=t.getTile(q),j=N.getBucket(o);if(!j)continue;const ie=j.programConfigurations.get(o.id),re=d.useProgram(k?"fillExtrusionPattern":"fillExtrusion",ie);k&&(d.context.activeTexture.set(T.TEXTURE0),N.imageAtlasTexture.bind(T.LINEAR,T.CLAMP_TO_EDGE),ie.updatePaintBuffers(R));const ae=A.constantOr(null);if(ae&&N.imageAtlas){const de=N.imageAtlas,Se=de.patternPositions[ae.to.toString()],Ce=de.patternPositions[ae.from.toString()];Se&&Ce&&ie.setConstantPatternPositions(Se,Ce)}const ne=d.translatePosMatrix(q.posMatrix,N,o.paint.get("fill-extrusion-translate"),o.paint.get("fill-extrusion-translate-anchor")),ge=o.paint.get("fill-extrusion-vertical-gradient"),he=k?Ka(ne,d,ge,$,q,R,N):ml(ne,d,ge,$);re.draw(S,S.gl.TRIANGLES,p,y,v,Yt.backCCW,he,o.id,j.layoutVertexBuffer,j.indexBuffer,j.segments,o.paint,d.transform.zoom,ie)}}function ua(d,t,o,h,p,y){const v=d.context,S=v.gl,T=t.fbo;if(!T)return;const A=d.useProgram("hillshade");v.activeTexture.set(S.TEXTURE0),S.bindTexture(S.TEXTURE_2D,T.colorAttachment.get());const k=((R,$,q)=>{const N=q.paint.get("hillshade-shadow-color"),j=q.paint.get("hillshade-highlight-color"),ie=q.paint.get("hillshade-accent-color");let re=q.paint.get("hillshade-illumination-direction")*(Math.PI/180);q.paint.get("hillshade-illumination-anchor")==="viewport"&&(re-=R.transform.angle);const ae=!R.options.moving;return{u_matrix:R.transform.calculatePosMatrix($.tileID.toUnwrapped(),ae),u_image:0,u_latrange:Ko(0,$.tileID),u_light:[q.paint.get("hillshade-exaggeration"),re],u_shadow:N,u_highlight:j,u_accent:ie}})(d,t,o);A.draw(v,S.TRIANGLES,h,p,y,Yt.disabled,k,o.id,d.rasterBoundsBuffer,d.quadTriangleIndexBuffer,d.rasterBoundsSegments)}function vr(d,t,o,h,p,y){const v=d.context,S=v.gl,T=t.dem;if(T&&T.data){const A=T.dim,k=T.stride,R=T.getPixels();if(v.activeTexture.set(S.TEXTURE1),v.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||d.getTileTexture(k),t.demTexture){const q=t.demTexture;q.update(R,{premultiply:!1}),q.bind(S.NEAREST,S.CLAMP_TO_EDGE)}else t.demTexture=new Ge(v,R,S.RGBA,{premultiply:!1}),t.demTexture.bind(S.NEAREST,S.CLAMP_TO_EDGE);v.activeTexture.set(S.TEXTURE0);let $=t.fbo;if(!$){const q=new Ge(v,{width:A,height:A,data:null},S.RGBA);q.bind(S.LINEAR,S.CLAMP_TO_EDGE),$=t.fbo=v.createFramebuffer(A,A,!0),$.colorAttachment.set(q.texture)}v.bindFramebuffer.set($.framebuffer),v.viewport.set([0,0,A,A]),d.useProgram("hillshadePrepare").draw(v,S.TRIANGLES,h,p,y,Yt.disabled,((q,N)=>{const j=N.stride,ie=l.create();return l.ortho(ie,0,l.EXTENT,-l.EXTENT,0,0,1),l.translate(ie,ie,[0,-l.EXTENT,0]),{u_matrix:ie,u_image:1,u_dimension:[j,j],u_zoom:q.overscaledZ,u_unpack:N.getUnpackVector()}})(t.tileID,T),o.id,d.rasterBoundsBuffer,d.quadTriangleIndexBuffer,d.rasterBoundsSegments),t.needsHillshadePrepare=!1}}function El(d,t,o,h,p){const y=h.paint.get("raster-fade-duration");if(y>0){const v=l.exported.now(),S=(v-d.timeAdded)/y,T=t?(v-t.timeAdded)/y:-1,A=o.getSource(),k=p.coveringZoomLevel({tileSize:A.tileSize,roundZoom:A.roundZoom}),R=!t||Math.abs(t.tileID.overscaledZ-k)>Math.abs(d.tileID.overscaledZ-k),$=R&&d.refreshedUponExpiration?1:l.clamp(R?S:1-T,0,1);return d.refreshedUponExpiration&&S>=1&&(d.refreshedUponExpiration=!1),t?{opacity:1,mix:1-$}:{opacity:$,mix:0}}return{opacity:1,mix:0}}const Al=new l.Color(1,0,0,1),Pl=new l.Color(0,1,0,1),Xn=new l.Color(0,0,1,1),da=new l.Color(1,0,1,1),_s=new l.Color(0,1,1,1);function Ml(d,t,o,h){ma(d,0,t+o/2,d.transform.width,o,h)}function pa(d,t,o,h){ma(d,t-o/2,0,o,d.transform.height,h)}function ma(d,t,o,h,p,y){const v=d.context,S=v.gl;S.enable(S.SCISSOR_TEST),S.scissor(t*d.pixelRatio,o*d.pixelRatio,h*d.pixelRatio,p*d.pixelRatio),v.clear({color:y}),S.disable(S.SCISSOR_TEST)}function zl(d,t,o){const h=d.context,p=h.gl,y=o.posMatrix,v=d.useProgram("debug"),S=Et.disabled,T=Ot.disabled,A=d.colorModeForRenderPass(),k="$debug";h.activeTexture.set(p.TEXTURE0),d.emptyTexture.bind(p.LINEAR,p.CLAMP_TO_EDGE),v.draw(h,p.LINE_STRIP,S,T,A,Yt.disabled,Zn(y,l.Color.red),k,d.debugBuffer,d.tileBorderIndexBuffer,d.debugSegments);const R=t.getTileByID(o.key).latestRawTileData,$=Math.floor((R&&R.byteLength||0)/1024),q=t.getTile(o).tileSize,N=512/Math.min(q,512)*(o.overscaledZ/d.transform.zoom)*.5;let j=o.canonical.toString();o.overscaledZ!==o.canonical.z&&(j+=` => ${o.overscaledZ}`),function(ie,re){ie.initDebugOverlayCanvas();const ae=ie.debugOverlayCanvas,ne=ie.context.gl,ge=ie.debugOverlayCanvas.getContext("2d");ge.clearRect(0,0,ae.width,ae.height),ge.shadowColor="white",ge.shadowBlur=2,ge.lineWidth=1.5,ge.strokeStyle="white",ge.textBaseline="top",ge.font="bold 36px Open Sans, sans-serif",ge.fillText(re,5,5),ge.strokeText(re,5,5),ie.debugOverlayTexture.update(ae),ie.debugOverlayTexture.bind(ne.LINEAR,ne.CLAMP_TO_EDGE)}(d,`${j} ${$}kb`),v.draw(h,p.TRIANGLES,S,T,it.alphaBlended,Yt.disabled,Zn(y,l.Color.transparent,N),k,d.debugBuffer,d.quadTriangleIndexBuffer,d.debugSegments)}const So={symbol:function(d,t,o,h,p){if(d.renderPass!=="translucent")return;const y=Ot.disabled,v=d.colorModeForRenderPass();o.layout.get("text-variable-anchor")&&function(S,T,A,k,R,$,q){const N=T.transform,j=R==="map",ie=$==="map";for(const re of S){const ae=k.getTile(re),ne=ae.getBucket(A);if(!ne||!ne.text||!ne.text.segments.get().length)continue;const ge=l.evaluateSizeForZoom(ne.textSizeData,N.zoom),he=li(ae,1,T.transform.zoom),de=Pi(re.posMatrix,ie,j,T.transform,he),Se=A.layout.get("icon-text-fit")!=="none"&&ne.hasIconData();if(ge){const Ce=Math.pow(2,N.zoom-ae.tileID.overscaledZ);sa(ne,j,ie,q,N,de,re.posMatrix,Ce,ge,Se)}}}(h,d,o,t,o.layout.get("text-rotation-alignment"),o.layout.get("text-pitch-alignment"),p),o.paint.get("icon-opacity").constantOr(1)!==0&&ca(d,t,o,h,!1,o.paint.get("icon-translate"),o.paint.get("icon-translate-anchor"),o.layout.get("icon-rotation-alignment"),o.layout.get("icon-pitch-alignment"),o.layout.get("icon-keep-upright"),y,v),o.paint.get("text-opacity").constantOr(1)!==0&&ca(d,t,o,h,!0,o.paint.get("text-translate"),o.paint.get("text-translate-anchor"),o.layout.get("text-rotation-alignment"),o.layout.get("text-pitch-alignment"),o.layout.get("text-keep-upright"),y,v),t.map.showCollisionBoxes&&(fs(d,t,o,h,o.paint.get("text-translate"),o.paint.get("text-translate-anchor"),!0),fs(d,t,o,h,o.paint.get("icon-translate"),o.paint.get("icon-translate-anchor"),!1))},circle:function(d,t,o,h){if(d.renderPass!=="translucent")return;const p=o.paint.get("circle-opacity"),y=o.paint.get("circle-stroke-width"),v=o.paint.get("circle-stroke-opacity"),S=!o.layout.get("circle-sort-key").isConstant();if(p.constantOr(1)===0&&(y.constantOr(1)===0||v.constantOr(1)===0))return;const T=d.context,A=T.gl,k=d.depthModeForSublayer(0,Et.ReadOnly),R=Ot.disabled,$=d.colorModeForRenderPass(),q=[];for(let N=0;N<h.length;N++){const j=h[N],ie=t.getTile(j),re=ie.getBucket(o);if(!re)continue;const ae=re.programConfigurations.get(o.id),ne={programConfiguration:ae,program:d.useProgram("circle",ae),layoutVertexBuffer:re.layoutVertexBuffer,indexBuffer:re.indexBuffer,uniformValues:vn(d,j,ie,o)};if(S){const ge=re.segments.get();for(const he of ge)q.push({segments:new l.SegmentVector([he]),sortKey:he.sortKey,state:ne})}else q.push({segments:re.segments,sortKey:0,state:ne})}S&&q.sort((N,j)=>N.sortKey-j.sortKey);for(const N of q){const{programConfiguration:j,program:ie,layoutVertexBuffer:re,indexBuffer:ae,uniformValues:ne}=N.state;ie.draw(T,A.TRIANGLES,k,R,$,Yt.disabled,ne,o.id,re,ae,N.segments,o.paint,d.transform.zoom,j)}},heatmap:function(d,t,o,h){if(o.paint.get("heatmap-opacity")!==0)if(d.renderPass==="offscreen"){const p=d.context,y=p.gl,v=Ot.disabled,S=new it([y.ONE,y.ONE],l.Color.transparent,[!0,!0,!0,!0]);(function(T,A,k){const R=T.gl;T.activeTexture.set(R.TEXTURE1),T.viewport.set([0,0,A.width/4,A.height/4]);let $=k.heatmapFbo;if($)R.bindTexture(R.TEXTURE_2D,$.colorAttachment.get()),T.bindFramebuffer.set($.framebuffer);else{const q=R.createTexture();R.bindTexture(R.TEXTURE_2D,q),R.texParameteri(R.TEXTURE_2D,R.TEXTURE_WRAP_S,R.CLAMP_TO_EDGE),R.texParameteri(R.TEXTURE_2D,R.TEXTURE_WRAP_T,R.CLAMP_TO_EDGE),R.texParameteri(R.TEXTURE_2D,R.TEXTURE_MIN_FILTER,R.LINEAR),R.texParameteri(R.TEXTURE_2D,R.TEXTURE_MAG_FILTER,R.LINEAR),$=k.heatmapFbo=T.createFramebuffer(A.width/4,A.height/4,!1),function(N,j,ie,re){const ae=N.gl;ae.texImage2D(ae.TEXTURE_2D,0,ae.RGBA,j.width/4,j.height/4,0,ae.RGBA,N.extRenderToTextureHalfFloat?N.extTextureHalfFloat.HALF_FLOAT_OES:ae.UNSIGNED_BYTE,null),re.colorAttachment.set(ie)}(T,A,q,$)}})(p,d,o),p.clear({color:l.Color.transparent});for(let T=0;T<h.length;T++){const A=h[T];if(t.hasRenderableParent(A))continue;const k=t.getTile(A),R=k.getBucket(o);if(!R)continue;const $=R.programConfigurations.get(o.id),q=d.useProgram("heatmap",$),{zoom:N}=d.transform;q.draw(p,y.TRIANGLES,Et.disabled,v,S,Yt.disabled,Yo(A.posMatrix,k,N,o.paint.get("heatmap-intensity")),o.id,R.layoutVertexBuffer,R.indexBuffer,R.segments,o.paint,d.transform.zoom,$)}p.viewport.set([0,0,d.width,d.height])}else d.renderPass==="translucent"&&(d.context.setColorMode(d.colorModeForRenderPass()),function(p,y){const v=p.context,S=v.gl,T=y.heatmapFbo;if(!T)return;v.activeTexture.set(S.TEXTURE0),S.bindTexture(S.TEXTURE_2D,T.colorAttachment.get()),v.activeTexture.set(S.TEXTURE1);let A=y.colorRampTexture;A||(A=y.colorRampTexture=new Ge(v,y.colorRamp,S.RGBA)),A.bind(S.LINEAR,S.CLAMP_TO_EDGE),p.useProgram("heatmapTexture").draw(v,S.TRIANGLES,Et.disabled,Ot.disabled,p.colorModeForRenderPass(),Yt.disabled,((k,R,$,q)=>{const N=l.create();l.ortho(N,0,k.width,k.height,0,0,1);const j=k.context.gl;return{u_matrix:N,u_world:[j.drawingBufferWidth,j.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:R.paint.get("heatmap-opacity")}})(p,y),y.id,p.viewportBuffer,p.quadTriangleIndexBuffer,p.viewportSegments,y.paint,p.transform.zoom)}(d,o))},line:function(d,t,o,h){if(d.renderPass!=="translucent")return;const p=o.paint.get("line-opacity"),y=o.paint.get("line-width");if(p.constantOr(1)===0||y.constantOr(1)===0)return;const v=d.depthModeForSublayer(0,Et.ReadOnly),S=d.colorModeForRenderPass(),T=o.paint.get("line-dasharray"),A=o.paint.get("line-pattern"),k=A.constantOr(1),R=o.paint.get("line-gradient"),$=o.getCrossfadeParameters(),q=k?"linePattern":T?"lineSDF":R?"lineGradient":"line",N=d.context,j=N.gl;let ie=!0;for(const re of h){const ae=t.getTile(re);if(k&&!ae.patternsLoaded())continue;const ne=ae.getBucket(o);if(!ne)continue;const ge=ne.programConfigurations.get(o.id),he=d.context.program.get(),de=d.useProgram(q,ge),Se=ie||de.program!==he,Ce=A.constantOr(null);if(Ce&&ae.imageAtlas){const Ne=ae.imageAtlas,ze=Ne.patternPositions[Ce.to.toString()],et=Ne.patternPositions[Ce.from.toString()];ze&&et&&ge.setConstantPatternPositions(ze,et)}const fe=k?xo(d,ae,o,$):T?ri(d,ae,o,T,$):R?Jo(d,ae,o,ne.lineClipsArray.length):_o(d,ae,o);if(k)N.activeTexture.set(j.TEXTURE0),ae.imageAtlasTexture.bind(j.LINEAR,j.CLAMP_TO_EDGE),ge.updatePaintBuffers($);else if(T&&(Se||d.lineAtlas.dirty))N.activeTexture.set(j.TEXTURE0),d.lineAtlas.bind(N);else if(R){const Ne=ne.gradients[o.id];let ze=Ne.texture;if(o.gradientVersion!==Ne.version){let et=256;if(o.stepInterpolant){const _t=t.getSource().maxzoom,dt=re.canonical.z===_t?Math.ceil(1<<d.transform.maxZoom-re.canonical.z):1;et=l.clamp(l.nextPowerOfTwo(ne.maxLineLength/l.EXTENT*1024*dt),256,N.maxTextureSize)}Ne.gradient=l.renderColorRamp({expression:o.gradientExpression(),evaluationKey:"lineProgress",resolution:et,image:Ne.gradient||void 0,clips:ne.lineClipsArray}),Ne.texture?Ne.texture.update(Ne.gradient):Ne.texture=new Ge(N,Ne.gradient,j.RGBA),Ne.version=o.gradientVersion,ze=Ne.texture}N.activeTexture.set(j.TEXTURE0),ze.bind(o.stepInterpolant?j.NEAREST:j.LINEAR,j.CLAMP_TO_EDGE)}de.draw(N,j.TRIANGLES,v,d.stencilModeForClipping(re),S,Yt.disabled,fe,o.id,ne.layoutVertexBuffer,ne.indexBuffer,ne.segments,o.paint,d.transform.zoom,ge,ne.layoutVertexBuffer2),ie=!1}},fill:function(d,t,o,h){const p=o.paint.get("fill-color"),y=o.paint.get("fill-opacity");if(y.constantOr(1)===0)return;const v=d.colorModeForRenderPass(),S=o.paint.get("fill-pattern"),T=d.opaquePassEnabledForLayer()&&!S.constantOr(1)&&p.constantOr(l.Color.transparent).a===1&&y.constantOr(0)===1?"opaque":"translucent";if(d.renderPass===T){const A=d.depthModeForSublayer(1,d.renderPass==="opaque"?Et.ReadWrite:Et.ReadOnly);ys(d,t,o,h,A,v,!1)}if(d.renderPass==="translucent"&&o.paint.get("fill-antialias")){const A=d.depthModeForSublayer(o.getPaintProperty("fill-outline-color")?2:0,Et.ReadOnly);ys(d,t,o,h,A,v,!0)}},"fill-extrusion":function(d,t,o,h){const p=o.paint.get("fill-extrusion-opacity");if(p!==0&&d.renderPass==="translucent"){const y=new Et(d.context.gl.LEQUAL,Et.ReadWrite,d.depthRangeFor3D);if(p!==1||o.paint.get("fill-extrusion-pattern").constantOr(1))Wn(d,t,o,h,y,Ot.disabled,it.disabled),Wn(d,t,o,h,y,d.stencilModeFor3D(),d.colorModeForRenderPass());else{const v=d.colorModeForRenderPass();Wn(d,t,o,h,y,Ot.disabled,v)}}},hillshade:function(d,t,o,h){if(d.renderPass!=="offscreen"&&d.renderPass!=="translucent")return;const p=d.context,y=d.depthModeForSublayer(0,Et.ReadOnly),v=d.colorModeForRenderPass(),[S,T]=d.renderPass==="translucent"?d.stencilConfigForOverlap(h):[{},h];for(const A of T){const k=t.getTile(A);k.needsHillshadePrepare&&d.renderPass==="offscreen"?vr(d,k,o,y,Ot.disabled,v):d.renderPass==="translucent"&&ua(d,k,o,y,S[A.overscaledZ],v)}p.viewport.set([0,0,d.width,d.height])},raster:function(d,t,o,h){if(d.renderPass!=="translucent"||o.paint.get("raster-opacity")===0||!h.length)return;const p=d.context,y=p.gl,v=t.getSource(),S=d.useProgram("raster"),T=d.colorModeForRenderPass(),[A,k]=v instanceof $r?[{},h]:d.stencilConfigForOverlap(h),R=k[k.length-1].overscaledZ,$=!d.options.moving;for(const q of k){const N=d.depthModeForSublayer(q.overscaledZ-R,o.paint.get("raster-opacity")===1?Et.ReadWrite:Et.ReadOnly,y.LESS),j=t.getTile(q),ie=d.transform.calculatePosMatrix(q.toUnwrapped(),$);j.registerFadeDuration(o.paint.get("raster-fade-duration"));const re=t.findLoadedParent(q,0),ae=El(j,re,t,o,d.transform);let ne,ge;const he=o.paint.get("raster-resampling")==="nearest"?y.NEAREST:y.LINEAR;p.activeTexture.set(y.TEXTURE0),j.texture.bind(he,y.CLAMP_TO_EDGE,y.LINEAR_MIPMAP_NEAREST),p.activeTexture.set(y.TEXTURE1),re?(re.texture.bind(he,y.CLAMP_TO_EDGE,y.LINEAR_MIPMAP_NEAREST),ne=Math.pow(2,re.tileID.overscaledZ-j.tileID.overscaledZ),ge=[j.tileID.canonical.x*ne%1,j.tileID.canonical.y*ne%1]):j.texture.bind(he,y.CLAMP_TO_EDGE,y.LINEAR_MIPMAP_NEAREST);const de=yl(ie,ge||[0,0],ne||1,ae,o);v instanceof $r?S.draw(p,y.TRIANGLES,N,Ot.disabled,T,Yt.disabled,de,o.id,v.boundsBuffer,d.quadTriangleIndexBuffer,v.boundsSegments):S.draw(p,y.TRIANGLES,N,A[q.overscaledZ],T,Yt.disabled,de,o.id,d.rasterBoundsBuffer,d.quadTriangleIndexBuffer,d.rasterBoundsSegments)}},background:function(d,t,o){const h=o.paint.get("background-color"),p=o.paint.get("background-opacity");if(p===0)return;const y=d.context,v=y.gl,S=d.transform,T=S.tileSize,A=o.paint.get("background-pattern");if(d.isPatternMissing(A))return;const k=!A&&h.a===1&&p===1&&d.opaquePassEnabledForLayer()?"opaque":"translucent";if(d.renderPass!==k)return;const R=Ot.disabled,$=d.depthModeForSublayer(0,k==="opaque"?Et.ReadWrite:Et.ReadOnly),q=d.colorModeForRenderPass(),N=d.useProgram(A?"backgroundPattern":"background"),j=S.coveringTiles({tileSize:T});A&&(y.activeTexture.set(v.TEXTURE0),d.imageManager.bind(d.context));const ie=o.getCrossfadeParameters();for(const re of j){const ae=d.transform.calculatePosMatrix(re.toUnwrapped()),ne=A?is(ae,p,d,A,{tileID:re,tileSize:T},ie):ih(ae,p,h);N.draw(y,v.TRIANGLES,$,R,q,Yt.disabled,ne,o.id,d.tileExtentBuffer,d.quadTriangleIndexBuffer,d.tileExtentSegments)}},debug:function(d,t,o){for(let h=0;h<o.length;h++)zl(d,t,o[h])},custom:function(d,t,o){const h=d.context,p=o.implementation;if(d.renderPass==="offscreen"){const y=p.prerender;y&&(d.setCustomLayerDefaults(),h.setColorMode(d.colorModeForRenderPass()),y.call(p,h.gl,d.transform.customLayerMatrix()),h.setDirty(),d.setBaseState())}else if(d.renderPass==="translucent"){d.setCustomLayerDefaults(),h.setColorMode(d.colorModeForRenderPass()),h.setStencilMode(Ot.disabled);const y=p.renderingMode==="3d"?new Et(d.context.gl.LEQUAL,Et.ReadWrite,d.depthRangeFor3D):d.depthModeForSublayer(0,Et.ReadOnly);h.setDepthMode(y),p.render(h.gl,d.transform.customLayerMatrix()),h.setDirty(),d.setBaseState(),h.bindFramebuffer.set(null)}}};class xs{constructor(t,o){this.context=new na(t),this.transform=o,this._tileTextures={},this.setup(),this.numSublayers=mi.maxUnderzooming+mi.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new st,this.gpuTimers={}}resize(t,o,h){if(this.width=t*h,this.height=o*h,this.pixelRatio=h,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const p of this.style._order)this.style._layers[p].resize()}setup(){const t=this.context,o=new l.PosArray;o.emplaceBack(0,0),o.emplaceBack(l.EXTENT,0),o.emplaceBack(0,l.EXTENT),o.emplaceBack(l.EXTENT,l.EXTENT),this.tileExtentBuffer=t.createVertexBuffer(o,qa.members),this.tileExtentSegments=l.SegmentVector.simpleSegment(0,0,4,2);const h=new l.PosArray;h.emplaceBack(0,0),h.emplaceBack(l.EXTENT,0),h.emplaceBack(0,l.EXTENT),h.emplaceBack(l.EXTENT,l.EXTENT),this.debugBuffer=t.createVertexBuffer(h,qa.members),this.debugSegments=l.SegmentVector.simpleSegment(0,0,4,5);const p=new l.RasterBoundsArray;p.emplaceBack(0,0,0,0),p.emplaceBack(l.EXTENT,0,l.EXTENT,0),p.emplaceBack(0,l.EXTENT,0,l.EXTENT),p.emplaceBack(l.EXTENT,l.EXTENT,l.EXTENT,l.EXTENT),this.rasterBoundsBuffer=t.createVertexBuffer(p,un.members),this.rasterBoundsSegments=l.SegmentVector.simpleSegment(0,0,4,2);const y=new l.PosArray;y.emplaceBack(0,0),y.emplaceBack(1,0),y.emplaceBack(0,1),y.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(y,qa.members),this.viewportSegments=l.SegmentVector.simpleSegment(0,0,4,2);const v=new l.LineStripIndexArray;v.emplaceBack(0),v.emplaceBack(1),v.emplaceBack(3),v.emplaceBack(2),v.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(v);const S=new l.TriangleIndexArray;S.emplaceBack(0,1,2),S.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(S),this.emptyTexture=new Ge(t,{width:1,height:1,data:new Uint8Array([0,0,0,0])},t.gl.RGBA);const T=this.context.gl;this.stencilClearMode=new Ot({func:T.ALWAYS,mask:0},0,255,T.ZERO,T.ZERO,T.ZERO)}clearStencil(){const t=this.context,o=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const h=l.create();l.ortho(h,0,this.width,this.height,0,0,1),l.scale(h,h,[o.drawingBufferWidth,o.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(t,o.TRIANGLES,Et.disabled,this.stencilClearMode,it.disabled,Yt.disabled,yo(h),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,o){if(this.currentStencilSource===t.source||!t.isTileClipped()||!o||!o.length)return;this.currentStencilSource=t.source;const h=this.context,p=h.gl;this.nextStencilID+o.length>256&&this.clearStencil(),h.setColorMode(it.disabled),h.setDepthMode(Et.disabled);const y=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const v of o){const S=this._tileClippingMaskIDs[v.key]=this.nextStencilID++;y.draw(h,p.TRIANGLES,Et.disabled,new Ot({func:p.ALWAYS,mask:0},S,255,p.KEEP,p.KEEP,p.REPLACE),it.disabled,Yt.disabled,yo(v.posMatrix),"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,o=this.context.gl;return new Ot({func:o.NOTEQUAL,mask:255},t,255,o.KEEP,o.KEEP,o.REPLACE)}stencilModeForClipping(t){const o=this.context.gl;return new Ot({func:o.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,o.KEEP,o.KEEP,o.REPLACE)}stencilConfigForOverlap(t){const o=this.context.gl,h=t.sort((v,S)=>S.overscaledZ-v.overscaledZ),p=h[h.length-1].overscaledZ,y=h[0].overscaledZ-p+1;if(y>1){this.currentStencilSource=void 0,this.nextStencilID+y>256&&this.clearStencil();const v={};for(let S=0;S<y;S++)v[S+p]=new Ot({func:o.GEQUAL,mask:255},S+this.nextStencilID,255,o.KEEP,o.KEEP,o.REPLACE);return this.nextStencilID+=y,[v,h]}return[{[p]:Ot.disabled},h]}colorModeForRenderPass(){const t=this.context.gl;return this._showOverdrawInspector?new it([t.CONSTANT_COLOR,t.ONE],new l.Color(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?it.unblended:it.alphaBlended}depthModeForSublayer(t,o,h){if(!this.opaquePassEnabledForLayer())return Et.disabled;const p=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new Et(h||this.context.gl.LEQUAL,o,[p,p])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(t,o){this.style=t,this.options=o,this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(l.exported.now()),this.imageManager.beginFrame();const h=this.style._order,p=this.style.sourceCaches;for(const T in p){const A=p[T];A.used&&A.prepare(this.context)}const y={},v={},S={};for(const T in p){const A=p[T];y[T]=A.getVisibleCoordinates(),v[T]=y[T].slice().reverse(),S[T]=A.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let T=0;T<h.length;T++)if(this.style._layers[h[T]].is3D()){this.opaquePassCutoff=T;break}this.renderPass="offscreen";for(const T of h){const A=this.style._layers[T];if(!A.hasOffscreenPass()||A.isHidden(this.transform.zoom))continue;const k=v[A.source];(A.type==="custom"||k.length)&&this.renderLayer(this,p[A.source],A,k)}for(this.context.bindFramebuffer.set(null),this.context.clear({color:o.showOverdrawInspector?l.Color.black:l.Color.transparent,depth:1}),this.clearStencil(),this._showOverdrawInspector=o.showOverdrawInspector,this.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],this.renderPass="opaque",this.currentLayer=h.length-1;this.currentLayer>=0;this.currentLayer--){const T=this.style._layers[h[this.currentLayer]],A=p[T.source],k=y[T.source];this._renderTileClippingMasks(T,k),this.renderLayer(this,A,T,k)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<h.length;this.currentLayer++){const T=this.style._layers[h[this.currentLayer]],A=p[T.source],k=(T.type==="symbol"?S:v)[T.source];this._renderTileClippingMasks(T,y[T.source]),this.renderLayer(this,A,T,k)}if(this.options.showTileBoundaries){let T,A;Object.values(this.style._layers).forEach(k=>{k.source&&!k.isHidden(this.transform.zoom)&&(k.source!==(A&&A.id)&&(A=this.style.sourceCaches[k.source]),(!T||T.getSource().maxzoom<A.getSource().maxzoom)&&(T=A))}),T&&So.debug(this,T,T.getVisibleCoordinates())}this.options.showPadding&&function(T){const A=T.transform.padding;Ml(T,T.transform.height-(A.top||0),3,Al),Ml(T,A.bottom||0,3,Pl),pa(T,A.left||0,3,Xn),pa(T,T.transform.width-(A.right||0),3,da);const k=T.transform.centerPoint;(function(R,$,q,N){ma(R,$-1,q-10,2,20,N),ma(R,$-10,q-1,20,2,N)})(T,k.x,T.transform.height-k.y,_s)}(this),this.context.setDefault()}renderLayer(t,o,h,p){h.isHidden(this.transform.zoom)||(h.type==="background"||h.type==="custom"||p.length)&&(this.id=h.id,this.gpuTimingStart(h),So[h.type](t,o,h,p,this.style.placement.variableOffsets),this.gpuTimingEnd())}gpuTimingStart(t){if(!this.options.gpuTiming)return;const o=this.context.extTimerQuery;let h=this.gpuTimers[t.id];h||(h=this.gpuTimers[t.id]={calls:0,cpuTime:0,query:o.createQueryEXT()}),h.calls++,o.beginQueryEXT(o.TIME_ELAPSED_EXT,h.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 o={};for(const h in t){const p=t[h],y=this.context.extTimerQuery,v=y.getQueryObjectEXT(p.query,y.QUERY_RESULT_EXT)/1e6;y.deleteQueryEXT(p.query),o[h]=v}return o}translatePosMatrix(t,o,h,p,y){if(!h[0]&&!h[1])return t;const v=y?p==="map"?this.transform.angle:0:p==="viewport"?-this.transform.angle:0;if(v){const A=Math.sin(v),k=Math.cos(v);h=[h[0]*k-h[1]*A,h[0]*A+h[1]*k]}const S=[y?h[0]:li(o,h[0],this.transform.zoom),y?h[1]:li(o,h[1],this.transform.zoom),0],T=new Float32Array(16);return l.translate(T,t,S),T}saveTileTexture(t){const o=this._tileTextures[t.size[0]];o?o.push(t):this._tileTextures[t.size[0]]=[t]}getTileTexture(t){const o=this._tileTextures[t];return o&&o.length>0?o.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;const o=this.imageManager.getPattern(t.from.toString()),h=this.imageManager.getPattern(t.to.toString());return!o||!h}useProgram(t,o){this.cache=this.cache||{};const h=`${t}${o?o.cacheKey:""}${this._showOverdrawInspector?"/overdraw":""}`;return this.cache[h]||(this.cache[h]=new eh(this.context,t,Wa[t],o,rs[t],this._showOverdrawInspector)),this.cache[h]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){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 Ge(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}}class fa{constructor(t,o){this.points=t,this.planes=o}static fromInvProjectionMatrix(t,o,h){const p=Math.pow(2,h),y=[[-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(S=>l.transformMat4([],S,t)).map(S=>l.scale$1([],S,1/S[3]/o*p)),v=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(S=>{const T=function($,q){var N=q[0],j=q[1],ie=q[2],re=N*N+j*j+ie*ie;return re>0&&(re=1/Math.sqrt(re)),$[0]=q[0]*re,$[1]=q[1]*re,$[2]=q[2]*re,$}([],function($,q,N){var j=q[0],ie=q[1],re=q[2],ae=N[0],ne=N[1],ge=N[2];return $[0]=ie*ge-re*ne,$[1]=re*ae-j*ge,$[2]=j*ne-ie*ae,$}([],$e([],y[S[0]],y[S[1]]),$e([],y[S[2]],y[S[1]]))),A=-((k=T)[0]*(R=y[S[1]])[0]+k[1]*R[1]+k[2]*R[2]);var k,R;return T.concat(A)});return new fa(y,v)}}class ga{constructor(t,o){this.min=t,this.max=o,this.center=function(h,p,y){return h[0]=.5*p[0],h[1]=.5*p[1],h[2]=.5*p[2],h}([],function(h,p,y){return h[0]=p[0]+y[0],h[1]=p[1]+y[1],h[2]=p[2]+y[2],h}([],this.min,this.max))}quadrant(t){const o=[t%2==0,t<2],h=Ae(this.min),p=Ae(this.max);for(let y=0;y<o.length;y++)h[y]=o[y]?this.min[y]:this.center[y],p[y]=o[y]?this.center[y]:this.max[y];return p[2]=this.max[2],new ga(h,p)}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 o=[[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 h=!0;for(let p=0;p<t.planes.length;p++){const y=t.planes[p];let v=0;for(let S=0;S<o.length;S++)l.dot(y,o[S])>=0&&v++;if(v===0)return 0;v!==o.length&&(h=!1)}if(h)return 2;for(let p=0;p<3;p++){let y=Number.MAX_VALUE,v=-Number.MAX_VALUE;for(let S=0;S<t.points.length;S++){const T=t.points[S][p]-this.min[p];y=Math.min(y,T),v=Math.max(v,T)}if(v<0||y>this.max[p]-this.min[p])return 0}return 1}}class Yn{constructor(t=0,o=0,h=0,p=0){if(isNaN(t)||t<0||isNaN(o)||o<0||isNaN(h)||h<0||isNaN(p)||p<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=o,this.left=h,this.right=p}interpolate(t,o,h){return o.top!=null&&t.top!=null&&(this.top=l.number(t.top,o.top,h)),o.bottom!=null&&t.bottom!=null&&(this.bottom=l.number(t.bottom,o.bottom,h)),o.left!=null&&t.left!=null&&(this.left=l.number(t.left,o.left,h)),o.right!=null&&t.right!=null&&(this.right=l.number(t.right,o.right,h)),this}getCenter(t,o){const h=l.clamp((this.left+t-this.right)/2,0,t),p=l.clamp((this.top+o-this.bottom)/2,0,o);return new l.pointGeometry(h,p)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new Yn(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class To{constructor(t,o,h,p,y){this.tileSize=512,this.maxValidLatitude=85.051129,this._renderWorldCopies=y===void 0||!!y,this._minZoom=t||0,this._maxZoom=o||22,this._minPitch=h??0,this._maxPitch=p??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new l.LngLat(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new Yn,this._posMatrixCache={},this._alignedPosMatrixCache={}}clone(){const t=new To(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 l.pointGeometry(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(t){const o=-l.wrap(t,-180,180)*Math.PI/180;this.angle!==o&&(this._unmodified=!1,this.angle=o,this._calcMatrices(),this.rotationMatrix=function(){var h=new l.ARRAY_TYPE(4);return l.ARRAY_TYPE!=Float32Array&&(h[1]=0,h[2]=0),h[0]=1,h[3]=1,h}(),function(h,p,y){var v=p[0],S=p[1],T=p[2],A=p[3],k=Math.sin(y),R=Math.cos(y);h[0]=v*R+T*k,h[1]=S*R+A*k,h[2]=v*-k+T*R,h[3]=S*-k+A*R}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const o=l.clamp(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==o&&(this._unmodified=!1,this._pitch=o,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 o=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==o&&(this._unmodified=!1,this._zoom=o,this.scale=this.zoomScale(o),this.tileZoom=Math.floor(o),this.zoomFraction=o-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,o,h){this._unmodified=!1,this._edgeInsets.interpolate(t,o,h),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const o=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,o)}getVisibleUnwrappedCoordinates(t){const o=[new l.UnwrappedTileID(0,t)];if(this._renderWorldCopies){const h=this.pointCoordinate(new l.pointGeometry(0,0)),p=this.pointCoordinate(new l.pointGeometry(this.width,0)),y=this.pointCoordinate(new l.pointGeometry(this.width,this.height)),v=this.pointCoordinate(new l.pointGeometry(0,this.height)),S=Math.floor(Math.min(h.x,p.x,y.x,v.x)),T=Math.floor(Math.max(h.x,p.x,y.x,v.x)),A=1;for(let k=S-A;k<=T+A;k++)k!==0&&o.push(new l.UnwrappedTileID(k,t))}return o}coveringTiles(t){let o=this.coveringZoomLevel(t);const h=o;if(t.minzoom!==void 0&&o<t.minzoom)return[];t.maxzoom!==void 0&&o>t.maxzoom&&(o=t.maxzoom);const p=l.MercatorCoordinate.fromLngLat(this.center),y=Math.pow(2,o),v=[y*p.x,y*p.y,0],S=fa.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,o);let T=t.minzoom||0;this.pitch<=60&&this._edgeInsets.top<.1&&(T=o);const A=N=>({aabb:new ga([N*y,0,0],[(N+1)*y,y,0]),zoom:0,x:0,y:0,wrap:N,fullyVisible:!1}),k=[],R=[],$=o,q=t.reparseOverscaled?h:o;if(this._renderWorldCopies)for(let N=1;N<=3;N++)k.push(A(-N)),k.push(A(N));for(k.push(A(0));k.length>0;){const N=k.pop(),j=N.x,ie=N.y;let re=N.fullyVisible;if(!re){const de=N.aabb.intersects(S);if(de===0)continue;re=de===2}const ae=N.aabb.distanceX(v),ne=N.aabb.distanceY(v),ge=Math.max(Math.abs(ae),Math.abs(ne)),he=3+(1<<$-N.zoom)-2;if(N.zoom===$||ge>he&&N.zoom>=T)R.push({tileID:new l.OverscaledTileID(N.zoom===$?q:N.zoom,N.wrap,N.zoom,j,ie),distanceSq:Ve([v[0]-.5-j,v[1]-.5-ie])});else for(let de=0;de<4;de++){const Se=(j<<1)+de%2,Ce=(ie<<1)+(de>>1);k.push({aabb:N.aabb.quadrant(de),zoom:N.zoom+1,x:Se,y:Ce,wrap:N.wrap,fullyVisible:re})}}return R.sort((N,j)=>N.distanceSq-j.distanceSq).map(N=>N.tileID)}resize(t,o){this.width=t,this.height=o,this.pixelsToGLUnits=[2/t,-2/o],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 o=l.clamp(t.lat,-this.maxValidLatitude,this.maxValidLatitude);return new l.pointGeometry(l.mercatorXfromLng(t.lng)*this.worldSize,l.mercatorYfromLat(o)*this.worldSize)}unproject(t){return new l.MercatorCoordinate(t.x/this.worldSize,t.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}setLocationAtPoint(t,o){const h=this.pointCoordinate(o),p=this.pointCoordinate(this.centerPoint),y=this.locationCoordinate(t),v=new l.MercatorCoordinate(y.x-(h.x-p.x),y.y-(h.y-p.y));this.center=this.coordinateLocation(v),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 l.MercatorCoordinate.fromLngLat(t)}coordinateLocation(t){return t.toLngLat()}pointCoordinate(t){const o=[t.x,t.y,0,1],h=[t.x,t.y,1,1];l.transformMat4(o,o,this.pixelMatrixInverse),l.transformMat4(h,h,this.pixelMatrixInverse);const p=o[3],y=h[3],v=o[1]/p,S=h[1]/y,T=o[2]/p,A=h[2]/y,k=T===A?0:(0-T)/(A-T);return new l.MercatorCoordinate(l.number(o[0]/p,h[0]/y,k)/this.worldSize,l.number(v,S,k)/this.worldSize)}coordinatePoint(t){const o=[t.x*this.worldSize,t.y*this.worldSize,0,1];return l.transformMat4(o,o,this.pixelMatrix),new l.pointGeometry(o[0]/o[3],o[1]/o[3])}getBounds(){return new l.LngLatBounds().extend(this.pointLocation(new l.pointGeometry(0,0))).extend(this.pointLocation(new l.pointGeometry(this.width,0))).extend(this.pointLocation(new l.pointGeometry(this.width,this.height))).extend(this.pointLocation(new l.pointGeometry(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new l.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,o=!1){const h=t.key,p=o?this._alignedPosMatrixCache:this._posMatrixCache;if(p[h])return p[h];const y=t.canonical,v=this.worldSize/this.zoomScale(y.z),S=y.x+Math.pow(2,y.z)*t.wrap,T=l.identity(new Float64Array(16));return l.translate(T,T,[S*v,y.y*v,0]),l.scale(T,T,[v/l.EXTENT,v/l.EXTENT,1]),l.multiply(T,o?this.alignedProjMatrix:this.projMatrix,T),p[h]=new Float32Array(T),p[h]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let t,o,h,p,y=-90,v=90,S=-180,T=180;const A=this.size,k=this._unmodified;if(this.latRange){const q=this.latRange;y=l.mercatorYfromLat(q[1])*this.worldSize,v=l.mercatorYfromLat(q[0])*this.worldSize,t=v-y<A.y?A.y/(v-y):0}if(this.lngRange){const q=this.lngRange;S=l.mercatorXfromLng(q[0])*this.worldSize,T=l.mercatorXfromLng(q[1])*this.worldSize,o=T-S<A.x?A.x/(T-S):0}const R=this.point,$=Math.max(o||0,t||0);if($)return this.center=this.unproject(new l.pointGeometry(o?(T+S)/2:R.x,t?(v+y)/2:R.y)),this.zoom+=this.scaleZoom($),this._unmodified=k,void(this._constraining=!1);if(this.latRange){const q=R.y,N=A.y/2;q-N<y&&(p=y+N),q+N>v&&(p=v-N)}if(this.lngRange){const q=R.x,N=A.x/2;q-N<S&&(h=S+N),q+N>T&&(h=T-N)}h===void 0&&p===void 0||(this.center=this.unproject(new l.pointGeometry(h!==void 0?h:R.x,p!==void 0?p:R.y))),this._unmodified=k,this._constraining=!1}_calcMatrices(){if(!this.height)return;const t=this.centerOffset;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height;const o=Math.PI/2+this._pitch,h=this._fov*(.5+t.y/this.height),p=Math.sin(h)*this.cameraToCenterDistance/Math.sin(l.clamp(Math.PI-o-h,.01,Math.PI-.01)),y=this.point,v=y.x,S=y.y,T=1.01*(Math.cos(Math.PI/2-this._pitch)*p+this.cameraToCenterDistance),A=this.height/50;let k=new Float64Array(16);l.perspective(k,this._fov,this.width/this.height,A,T),k[8]=2*-t.x/this.width,k[9]=2*t.y/this.height,l.scale(k,k,[1,-1,1]),l.translate(k,k,[0,0,-this.cameraToCenterDistance]),l.rotateX(k,k,this._pitch),l.rotateZ(k,k,this.angle),l.translate(k,k,[-v,-S,0]),this.mercatorMatrix=l.scale([],k,[this.worldSize,this.worldSize,this.worldSize]),l.scale(k,k,[1,1,l.mercatorZfromAltitude(1,this.center.lat)*this.worldSize]),this.projMatrix=k,this.invProjMatrix=l.invert([],this.projMatrix);const R=this.width%2/2,$=this.height%2/2,q=Math.cos(this.angle),N=Math.sin(this.angle),j=v-Math.round(v)+q*R+N*$,ie=S-Math.round(S)+q*$+N*R,re=new Float64Array(k);if(l.translate(re,re,[j>.5?j-1:j,ie>.5?ie-1:ie,0]),this.alignedProjMatrix=re,k=l.create(),l.scale(k,k,[this.width/2,-this.height/2,1]),l.translate(k,k,[1,-1,0]),this.labelPlaneMatrix=k,k=l.create(),l.scale(k,k,[1,-1,1]),l.translate(k,k,[-1,-1,0]),l.scale(k,k,[2/this.width,2/this.height,1]),this.glCoordMatrix=k,this.pixelMatrix=l.multiply(new Float64Array(16),this.labelPlaneMatrix,this.projMatrix),k=l.invert(new Float64Array(16),this.pixelMatrix),!k)throw new Error("failed to invert matrix");this.pixelMatrixInverse=k,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const t=this.pointCoordinate(new l.pointGeometry(0,0)),o=[t.x*this.worldSize,t.y*this.worldSize,0,1];return l.transformMat4(o,o,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new l.pointGeometry(0,t))}getCameraQueryGeometry(t){const o=this.getCameraPoint();if(t.length===1)return[t[0],o];{let h=o.x,p=o.y,y=o.x,v=o.y;for(const S of t)h=Math.min(h,S.x),p=Math.min(p,S.y),y=Math.max(y,S.x),v=Math.max(v,S.y);return[new l.pointGeometry(h,p),new l.pointGeometry(y,p),new l.pointGeometry(y,v),new l.pointGeometry(h,v),new l.pointGeometry(h,p)]}}}class kl{constructor(t){this._hashName=t&&encodeURIComponent(t),l.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=function(o,h){let p=!1,y=null;const v=()=>{y=null,p&&(o(),y=setTimeout(v,300),p=!1)};return()=>(p=!0,y||v(),y)}(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 o=this._map.getCenter(),h=Math.round(100*this._map.getZoom())/100,p=Math.ceil((h*Math.LN2+Math.log(512/360/.5))/Math.LN10),y=Math.pow(10,p),v=Math.round(o.lng*y)/y,S=Math.round(o.lat*y)/y,T=this._map.getBearing(),A=this._map.getPitch();let k="";if(k+=t?`/${v}/${S}/${h}`:`${h}/${S}/${v}`,(T||A)&&(k+="/"+Math.round(10*T)/10),A&&(k+=`/${Math.round(A)}`),this._hashName){const R=this._hashName;let $=!1;const q=window.location.hash.slice(1).split("&").map(N=>{const j=N.split("=")[0];return j===R?($=!0,`${j}=${k}`):N}).filter(N=>N);return $||q.push(`${R}=${k}`),`#${q.join("&")}`}return`#${k}`}_getCurrentHash(){const t=window.location.hash.replace("#","");if(this._hashName){let o;return t.split("&").map(h=>h.split("=")).forEach(h=>{h[0]===this._hashName&&(o=h)}),(o&&o[1]||"").split("/")}return t.split("/")}_onHashChange(){const t=this._getCurrentHash();if(t.length>=3&&!t.some(o=>isNaN(o))){const o=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:o,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 Co={linearity:.3,easing:l.bezier(0,0,.3,1)},Ll=l.extend({deceleration:2500,maxSpeed:1400},Co),Dl=l.extend({deceleration:20,maxSpeed:1400},Co),Rl=l.extend({deceleration:1e3,maxSpeed:360},Co),Kn=l.extend({deceleration:1e3,maxSpeed:90},Co);class Fl{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:l.exported.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,o=l.exported.now();for(;t.length>0&&o-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const o={zoom:0,bearing:0,pitch:0,pan:new l.pointGeometry(0,0),pinchAround:void 0,around:void 0};for(const{settings:y}of this._inertiaBuffer)o.zoom+=y.zoomDelta||0,o.bearing+=y.bearingDelta||0,o.pitch+=y.pitchDelta||0,y.panDelta&&o.pan._add(y.panDelta),y.around&&(o.around=y.around),y.pinchAround&&(o.pinchAround=y.pinchAround);const h=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,p={};if(o.pan.mag()){const y=Eo(o.pan.mag(),h,l.extend({},Ll,t||{}));p.offset=o.pan.mult(y.amount/o.pan.mag()),p.center=this._map.transform.center,Io(p,y)}if(o.zoom){const y=Eo(o.zoom,h,Dl);p.zoom=this._map.transform.zoom+y.amount,Io(p,y)}if(o.bearing){const y=Eo(o.bearing,h,Rl);p.bearing=this._map.transform.bearing+l.clamp(y.amount,-179,179),Io(p,y)}if(o.pitch){const y=Eo(o.pitch,h,Kn);p.pitch=this._map.transform.pitch+y.amount,Io(p,y)}if(p.zoom||p.bearing){const y=o.pinchAround===void 0?o.around:o.pinchAround;p.around=y?this._map.unproject(y):this._map.getCenter()}return this.clear(),l.extend(p,{noMoveStart:!0})}}function Io(d,t){(!d.duration||d.duration<t.duration)&&(d.duration=t.duration,d.easing=t.easing)}function Eo(d,t,o){const{maxSpeed:h,linearity:p,deceleration:y}=o,v=l.clamp(d*p/(t/1e3),-h,h),S=Math.abs(v)/(y*p);return{easing:o.easing,duration:1e3*S,amount:v*(S/2)}}class Xi extends l.Event{constructor(t,o,h,p={}){const y=Z.mousePos(o.getCanvasContainer(),h),v=o.unproject(y);super(t,l.extend({point:y,lngLat:v,originalEvent:h},p)),this._defaultPrevented=!1,this.target=o}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class $i extends l.Event{constructor(t,o,h){const p=t==="touchend"?h.changedTouches:h.touches,y=Z.touchPos(o.getCanvasContainer(),p),v=y.map(T=>o.unproject(T)),S=y.reduce((T,A,k,R)=>T.add(A.div(R.length)),new l.pointGeometry(0,0));super(t,{points:y,point:S,lngLats:v,lngLat:o.unproject(S),originalEvent:h}),this._defaultPrevented=!1}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class uh extends l.Event{constructor(t,o,h){super(t,{originalEvent:h}),this._defaultPrevented=!1}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class Sn{constructor(t,o){this._map=t,this._clickTolerance=o.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new uh(t.type,this._map,t))}mousedown(t,o){return this._mousedownPos=o,this._firePreventable(new Xi(t.type,this._map,t))}mouseup(t){this._map.fire(new Xi(t.type,this._map,t))}click(t,o){this._mousedownPos&&this._mousedownPos.dist(o)>=this._clickTolerance||this._map.fire(new Xi(t.type,this._map,t))}dblclick(t){return this._firePreventable(new Xi(t.type,this._map,t))}mouseover(t){this._map.fire(new Xi(t.type,this._map,t))}mouseout(t){this._map.fire(new Xi(t.type,this._map,t))}touchstart(t){return this._firePreventable(new $i(t.type,this._map,t))}touchmove(t){this._map.fire(new $i(t.type,this._map,t))}touchend(t){this._map.fire(new $i(t.type,this._map,t))}touchcancel(t){this._map.fire(new $i(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Bl{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,delete this._contextMenuEvent}mousemove(t){this._map.fire(new Xi(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Xi("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._map.fire(new Xi(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Jn{constructor(t,o){this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=o.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,o){this.isEnabled()&&t.shiftKey&&t.button===0&&(Z.disableDrag(),this._startPos=this._lastPos=o,this._active=!0)}mousemoveWindow(t,o){if(!this._active)return;const h=o;if(this._lastPos.equals(h)||!this._box&&h.dist(this._startPos)<this._clickTolerance)return;const p=this._startPos;this._lastPos=h,this._box||(this._box=Z.create("div","maplibregl-boxzoom mapboxgl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair","mapboxgl-crosshair"),this._fireEvent("boxzoomstart",t));const y=Math.min(p.x,h.x),v=Math.max(p.x,h.x),S=Math.min(p.y,h.y),T=Math.max(p.y,h.y);Z.setTransform(this._box,`translate(${y}px,${S}px)`),this._box.style.width=v-y+"px",this._box.style.height=T-S+"px"}mouseupWindow(t,o){if(!this._active||t.button!==0)return;const h=this._startPos,p=o;if(this.reset(),Z.suppressClick(),h.x!==p.x||h.y!==p.y)return this._map.fire(new l.Event("boxzoomend",{originalEvent:t})),{cameraAnimation:y=>y.fitScreenCoordinates(h,p,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&&(Z.remove(this._box),this._box=null),Z.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,o){return this._map.fire(new l.Event(t,{originalEvent:o}))}}function Tn(d,t){const o={};for(let h=0;h<d.length;h++)o[d[h].identifier]=t[h];return o}class dh{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(t,o,h){(this.centroid||h.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=t.timeStamp),h.length===this.numTouches&&(this.centroid=function(p){const y=new l.pointGeometry(0,0);for(const v of p)y._add(v);return y.div(p.length)}(o),this.touches=Tn(h,o)))}touchmove(t,o,h){if(this.aborted||!this.centroid)return;const p=Tn(h,o);for(const y in this.touches){const v=this.touches[y],S=p[y];(!S||S.dist(v)>30)&&(this.aborted=!0)}}touchend(t,o,h){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),h.length===0){const p=!this.aborted&&this.centroid;if(this.reset(),p)return p}}}class vs{constructor(t){this.singleTap=new dh(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,o,h){this.singleTap.touchstart(t,o,h)}touchmove(t,o,h){this.singleTap.touchmove(t,o,h)}touchend(t,o,h){const p=this.singleTap.touchend(t,o,h);if(p){const y=t.timeStamp-this.lastTime<500,v=!this.lastTap||this.lastTap.dist(p)<30;if(y&&v||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=p,this.count===this.numTaps)return this.reset(),p}}}class ph{constructor(){this._zoomIn=new vs({numTouches:1,numTaps:2}),this._zoomOut=new vs({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,o,h){this._zoomIn.touchstart(t,o,h),this._zoomOut.touchstart(t,o,h)}touchmove(t,o,h){this._zoomIn.touchmove(t,o,h),this._zoomOut.touchmove(t,o,h)}touchend(t,o,h){const p=this._zoomIn.touchend(t,o,h),y=this._zoomOut.touchend(t,o,h);return p?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:v=>v.easeTo({duration:300,zoom:v.getZoom()+1,around:v.unproject(p)},{originalEvent:t})}):y?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:v=>v.easeTo({duration:300,zoom:v.getZoom()-1,around:v.unproject(y)},{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 Ol={0:1,2:2};class Cn{constructor(t){this.reset(),this._clickTolerance=t.clickTolerance||1}reset(){this._active=!1,this._moved=!1,delete this._lastPoint,delete this._eventButton}_correctButton(t,o){return!1}_move(t,o){return{}}mousedown(t,o){if(this._lastPoint)return;const h=Z.mouseButton(t);this._correctButton(t,h)&&(this._lastPoint=o,this._eventButton=h)}mousemoveWindow(t,o){const h=this._lastPoint;if(h){if(t.preventDefault(),function(p,y){const v=Ol[y];return p.buttons===void 0||(p.buttons&v)!==v}(t,this._eventButton))this.reset();else if(this._moved||!(o.dist(h)<this._clickTolerance))return this._moved=!0,this._lastPoint=o,this._move(h,o)}}mouseupWindow(t){this._lastPoint&&Z.mouseButton(t)===this._eventButton&&(this._moved&&Z.suppressClick(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Qn extends Cn{mousedown(t,o){super.mousedown(t,o),this._lastPoint&&(this._active=!0)}_correctButton(t,o){return o===0&&!t.ctrlKey}_move(t,o){return{around:o,panDelta:o.sub(t)}}}class Oe extends Cn{_correctButton(t,o){return o===0&&t.ctrlKey||o===2}_move(t,o){const h=.8*(o.x-t.x);if(h)return this._active=!0,{bearingDelta:h}}contextmenu(t){t.preventDefault()}}class bs extends Cn{_correctButton(t,o){return o===0&&t.ctrlKey||o===2}_move(t,o){const h=-.5*(o.y-t.y);if(h)return this._active=!0,{pitchDelta:h}}contextmenu(t){t.preventDefault()}}class Ao{constructor(t){this._minTouches=1,this._clickTolerance=t.clickTolerance||1,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new l.pointGeometry(0,0)}touchstart(t,o,h){return this._calculateTransform(t,o,h)}touchmove(t,o,h){if(this._active&&!(h.length<this._minTouches))return t.preventDefault(),this._calculateTransform(t,o,h)}touchend(t,o,h){this._calculateTransform(t,o,h),this._active&&h.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,o,h){h.length>0&&(this._active=!0);const p=Tn(h,o),y=new l.pointGeometry(0,0),v=new l.pointGeometry(0,0);let S=0;for(const A in p){const k=p[A],R=this._touches[A];R&&(y._add(k),v._add(k.sub(R)),S++,p[A]=k)}if(this._touches=p,S<this._minTouches||!v.mag())return;const T=v.div(S);return this._sum._add(T),this._sum.mag()<this._clickTolerance?void 0:{around:y.div(S),panDelta:T}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class In{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}_start(t){}_move(t,o,h){return{}}touchstart(t,o,h){this._firstTwoTouches||h.length<2||(this._firstTwoTouches=[h[0].identifier,h[1].identifier],this._start([o[0],o[1]]))}touchmove(t,o,h){if(!this._firstTwoTouches)return;t.preventDefault();const[p,y]=this._firstTwoTouches,v=Po(h,o,p),S=Po(h,o,y);if(!v||!S)return;const T=this._aroundCenter?null:v.add(S).div(2);return this._move([v,S],T,t)}touchend(t,o,h){if(!this._firstTwoTouches)return;const[p,y]=this._firstTwoTouches,v=Po(h,o,p),S=Po(h,o,y);v&&S||(this._active&&Z.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 Po(d,t,o){for(let h=0;h<d.length;h++)if(d[h].identifier===o)return t[h]}function Pe(d,t){return Math.log(d/t)/Math.LN2}class ws extends In{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,o){const h=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(Pe(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Pe(this._distance,h),pinchAround:o}}}function Ul(d,t){return 180*d.angleWith(t)/Math.PI}class mh extends In{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,o){const h=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:Ul(this._vector,h),pinchAround:o}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const o=25/(Math.PI*this._minDiameter)*360,h=Ul(t,this._startVector);return Math.abs(h)<o}}function Mo(d){return Math.abs(d.y)>Math.abs(d.x)}class $l extends In{reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}_start(t){this._lastPoints=t,Mo(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,o,h){const p=t[0].sub(this._lastPoints[0]),y=t[1].sub(this._lastPoints[1]);if(this._valid=this.gestureBeginsVertically(p,y,h.timeStamp),this._valid)return this._lastPoints=t,this._active=!0,{pitchDelta:(p.y+y.y)/2*-.5}}gestureBeginsVertically(t,o,h){if(this._valid!==void 0)return this._valid;const p=t.mag()>=2,y=o.mag()>=2;if(!p&&!y)return;if(!p||!y)return this._firstMove===void 0&&(this._firstMove=h),h-this._firstMove<100&&void 0;const v=t.y>0==o.y>0;return Mo(t)&&Mo(o)&&v}}const Nl={panStep:100,bearingStep:15,pitchStep:10};class fh{constructor(){const t=Nl;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 o=0,h=0,p=0,y=0,v=0;switch(t.keyCode){case 61:case 107:case 171:case 187:o=1;break;case 189:case 109:case 173:o=-1;break;case 37:t.shiftKey?h=-1:(t.preventDefault(),y=-1);break;case 39:t.shiftKey?h=1:(t.preventDefault(),y=1);break;case 38:t.shiftKey?p=1:(t.preventDefault(),v=-1);break;case 40:t.shiftKey?p=-1:(t.preventDefault(),v=1);break;default:return}return this._rotationDisabled&&(h=0,p=0),{cameraAnimation:S=>{const T=S.getZoom();S.easeTo({duration:300,easeId:"keyboardHandler",easing:gh,zoom:o?Math.round(T)+o*(t.shiftKey?2:1):T,bearing:S.getBearing()+h*this._bearingStep,pitch:S.getPitch()+p*this._pitchStep,offset:[-y*this._panStep,-v*this._panStep],center:S.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 gh(d){return d*(2-d)}const ya=4.000244140625;class Ss{constructor(t,o){this._map=t,this._el=t.getCanvasContainer(),this._handler=o,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,l.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 o=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const h=l.exported.now(),p=h-(this._lastWheelEventTime||0);this._lastWheelEventTime=h,o!==0&&o%ya==0?this._type="wheel":o!==0&&Math.abs(o)<4?this._type="trackpad":p>400?(this._type=null,this._lastValue=o,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(p*o)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,o+=this._lastValue)),t.shiftKey&&o&&(o/=4),this._type&&(this._lastWheelEvent=t,this._delta-=o,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 o=Z.mousePos(this._el,t);this._around=l.LngLat.convert(this._aroundCenter?this._map.getCenter():this._map.unproject(o)),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 S=this._type==="wheel"&&Math.abs(this._delta)>ya?this._wheelZoomRate:this._defaultZoomRate;let T=2/(1+Math.exp(-Math.abs(this._delta*S)));this._delta<0&&T!==0&&(T=1/T);const A=typeof this._targetZoom=="number"?t.zoomScale(this._targetZoom):t.scale;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(A*T))),this._type==="wheel"&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const o=typeof this._targetZoom=="number"?this._targetZoom:t.zoom,h=this._startZoom,p=this._easing;let y,v=!1;if(this._type==="wheel"&&h&&p){const S=Math.min((l.exported.now()-this._lastWheelEventTime)/200,1),T=p(S);y=l.number(h,o,T),S<1?this._frameId||(this._frameId=!0):v=!0}else y=o,v=!0;return this._active=!0,v&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!v,zoomDelta:y-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let o=l.ease;if(this._prevEase){const h=this._prevEase,p=(l.exported.now()-h.start)/h.duration,y=h.easing(p+.01)-h.easing(p),v=.27/Math.sqrt(y*y+1e-4)*.01,S=Math.sqrt(.0729-v*v);o=l.bezier(v,S,.25,1)}return this._prevEase={start:l.exported.now(),duration:t,easing:o},o}reset(){this._active=!1}}class Ts{constructor(t,o){this._clickZoom=t,this._tapZoom=o}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 Cs{constructor(){this.reset()}reset(){this._active=!1}dblclick(t,o){return t.preventDefault(),{cameraAnimation:h=>{h.easeTo({duration:300,zoom:h.getZoom()+(t.shiftKey?-1:1),around:h.unproject(o)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ni{constructor(){this._tap=new vs({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()}touchstart(t,o,h){this._swipePoint||(this._tapTime&&t.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?h.length>0&&(this._swipePoint=o[0],this._swipeTouch=h[0].identifier):this._tap.touchstart(t,o,h))}touchmove(t,o,h){if(this._tapTime){if(this._swipePoint){if(h[0].identifier!==this._swipeTouch)return;const p=o[0],y=p.y-this._swipePoint.y;return this._swipePoint=p,t.preventDefault(),this._active=!0,{zoomDelta:y/128}}}else this._tap.touchmove(t,o,h)}touchend(t,o,h){this._tapTime?this._swipePoint&&h.length===0&&this.reset():this._tap.touchend(t,o,h)&&(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 nn{constructor(t,o,h){this._el=t,this._mousePan=o,this._touchPan=h}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 Vl{constructor(t,o,h){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=o,this._mousePitch=h}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 Is{constructor(t,o,h,p){this._el=t,this._touchZoom=o,this._touchRotate=h,this._tapDragZoom=p,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 eo=d=>d.zoom||d.drag||d.pitch||d.rotate;class Es extends l.Event{}function _a(d){return d.panDelta&&d.panDelta.mag()||d.zoomDelta||d.bearingDelta||d.pitchDelta}class ar{constructor(t,o){this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Fl(t),this._bearingSnap=o.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(o),l.bindAll(["handleEvent","handleWindowEvent"],this);const h=this._el;this._listeners=[[h,"touchstart",{passive:!0}],[h,"touchmove",{passive:!1}],[h,"touchend",void 0],[h,"touchcancel",void 0],[h,"mousedown",void 0],[h,"mousemove",void 0],[h,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[h,"mouseover",void 0],[h,"mouseout",void 0],[h,"dblclick",void 0],[h,"click",void 0],[h,"keydown",{capture:!1}],[h,"keyup",void 0],[h,"wheel",{passive:!1}],[h,"contextmenu",void 0],[window,"blur",void 0]];for(const[p,y,v]of this._listeners)Z.addEventListener(p,y,p===document?this.handleWindowEvent:this.handleEvent,v)}destroy(){for(const[t,o,h]of this._listeners)Z.removeEventListener(t,o,t===document?this.handleWindowEvent:this.handleEvent,h)}_addDefaultHandlers(t){const o=this._map,h=o.getCanvasContainer();this._add("mapEvent",new Sn(o,t));const p=o.boxZoom=new Jn(o,t);this._add("boxZoom",p);const y=new ph,v=new Cs;o.doubleClickZoom=new Ts(v,y),this._add("tapZoom",y),this._add("clickZoom",v);const S=new Ni;this._add("tapDragZoom",S);const T=o.touchPitch=new $l;this._add("touchPitch",T);const A=new Oe(t),k=new bs(t);o.dragRotate=new Vl(t,A,k),this._add("mouseRotate",A,["mousePitch"]),this._add("mousePitch",k,["mouseRotate"]);const R=new Qn(t),$=new Ao(t);o.dragPan=new nn(h,R,$),this._add("mousePan",R),this._add("touchPan",$,["touchZoom","touchRotate"]);const q=new mh,N=new ws;o.touchZoomRotate=new Is(h,N,q,S),this._add("touchRotate",q,["touchPan","touchZoom"]),this._add("touchZoom",N,["touchPan","touchRotate"]);const j=o.scrollZoom=new Ss(o,this);this._add("scrollZoom",j,["mousePan"]);const ie=o.keyboard=new fh;this._add("keyboard",ie),this._add("blockableMapEvent",new Bl(o));for(const re of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])t.interactive&&t[re]&&o[re].enable(t[re])}_add(t,o,h){this._handlers.push({handlerName:t,handler:o,allowed:h}),this._handlersById[t]=o}stop(t){if(!this._updatingCamera){for(const{handler:o}of this._handlers)o.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(eo(this._eventsInProgress))||this.isZooming()}_blockedByActive(t,o,h){for(const p in t)if(p!==h&&(!o||o.indexOf(p)<0))return!0;return!1}handleWindowEvent(t){this.handleEvent(t,`${t.type}Window`)}_getMapTouches(t){const o=[];for(const h of t)this._el.contains(h.target)&&o.push(h);return o}handleEvent(t,o){if(t.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const h=t.type==="renderFrame"?void 0:t,p={needsRenderFrame:!1},y={},v={},S=t.touches,T=S?this._getMapTouches(S):void 0,A=T?Z.touchPos(this._el,T):Z.mousePos(this._el,t);for(const{handlerName:$,handler:q,allowed:N}of this._handlers){if(!q.isEnabled())continue;let j;this._blockedByActive(v,N,$)?q.reset():q[o||t.type]&&(j=q[o||t.type](t,A,T),this.mergeHandlerResult(p,y,j,$,h),j&&j.needsRenderFrame&&this._triggerRenderFrame()),(j||q.isActive())&&(v[$]=q)}const k={};for(const $ in this._previousActiveHandlers)v[$]||(k[$]=h);this._previousActiveHandlers=v,(Object.keys(k).length||_a(p))&&(this._changes.push([p,y,k]),this._triggerRenderFrame()),(Object.keys(v).length||_a(p))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:R}=p;R&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],R(this._map))}mergeHandlerResult(t,o,h,p,y){if(!h)return;l.extend(t,h);const v={handlerName:p,originalEvent:h.originalEvent||y};h.zoomDelta!==void 0&&(o.zoom=v),h.panDelta!==void 0&&(o.drag=v),h.pitchDelta!==void 0&&(o.pitch=v),h.bearingDelta!==void 0&&(o.rotate=v)}_applyChanges(){const t={},o={},h={};for(const[p,y,v]of this._changes)p.panDelta&&(t.panDelta=(t.panDelta||new l.pointGeometry(0,0))._add(p.panDelta)),p.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+p.zoomDelta),p.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+p.bearingDelta),p.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+p.pitchDelta),p.around!==void 0&&(t.around=p.around),p.pinchAround!==void 0&&(t.pinchAround=p.pinchAround),p.noInertia&&(t.noInertia=p.noInertia),l.extend(o,y),l.extend(h,v);this._updateMapTransform(t,o,h),this._changes=[]}_updateMapTransform(t,o,h){const p=this._map,y=p.transform;if(!_a(t))return this._fireEvents(o,h,!0);let{panDelta:v,zoomDelta:S,bearingDelta:T,pitchDelta:A,around:k,pinchAround:R}=t;R!==void 0&&(k=R),p._stop(!0),k=k||p.transform.centerPoint;const $=y.pointLocation(v?k.sub(v):k);T&&(y.bearing+=T),A&&(y.pitch+=A),S&&(y.zoom+=S),y.setLocationAtPoint($,k),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(o,h,!0)}_fireEvents(t,o,h){const p=eo(this._eventsInProgress),y=eo(t),v={};for(const k in t){const{originalEvent:R}=t[k];this._eventsInProgress[k]||(v[`${k}start`]=R),this._eventsInProgress[k]=t[k]}!p&&y&&this._fireEvent("movestart",y.originalEvent);for(const k in v)this._fireEvent(k,v[k]);y&&this._fireEvent("move",y.originalEvent);for(const k in t){const{originalEvent:R}=t[k];this._fireEvent(k,R)}const S={};let T;for(const k in this._eventsInProgress){const{handlerName:R,originalEvent:$}=this._eventsInProgress[k];this._handlersById[R].isActive()||(delete this._eventsInProgress[k],T=o[R]||$,S[`${k}end`]=T)}for(const k in S)this._fireEvent(k,S[k]);const A=eo(this._eventsInProgress);if(h&&(p||y)&&!A){this._updatingCamera=!0;const k=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),R=$=>$!==0&&-this._bearingSnap<$&&$<this._bearingSnap;k?(R(k.bearing||this._map.getBearing())&&(k.bearing=0),this._map.easeTo(k,{originalEvent:T})):(this._map.fire(new l.Event("moveend",{originalEvent:T})),R(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(t,o){this._map.fire(new l.Event(t,o?{originalEvent:o}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(t=>{delete this._frameId,this.handleEvent(new Es("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const Ut={extend:(d,...t)=>l.extend(d,...t),run(d){d()},logToElement(d,t=!1,o="log"){const h=window.document.getElementById(o);h&&(t&&(h.innerHTML=""),h.innerHTML+=`<br>${d}`)}};class xa extends l.Evented{constructor(t,o){super(),this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=o.bearingSnap,l.bindAll(["_renderFrameCallback"],this)}getCenter(){return new l.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(t,o){return this.jumpTo({center:t},o)}panBy(t,o,h){return t=l.pointGeometry.convert(t).mult(-1),this.panTo(this.transform.center,l.extend({offset:t},o),h)}panTo(t,o,h){return this.easeTo(l.extend({center:t},o),h)}getZoom(){return this.transform.zoom}setZoom(t,o){return this.jumpTo({zoom:t},o),this}zoomTo(t,o,h){return this.easeTo(l.extend({zoom:t},o),h)}zoomIn(t,o){return this.zoomTo(this.getZoom()+1,t,o),this}zoomOut(t,o){return this.zoomTo(this.getZoom()-1,t,o),this}getBearing(){return this.transform.bearing}setBearing(t,o){return this.jumpTo({bearing:t},o),this}getPadding(){return this.transform.padding}setPadding(t,o){return this.jumpTo({padding:t},o),this}rotateTo(t,o,h){return this.easeTo(l.extend({bearing:t},o),h)}resetNorth(t,o){return this.rotateTo(0,l.extend({duration:1e3},t),o),this}resetNorthPitch(t,o){return this.easeTo(l.extend({bearing:0,pitch:0,duration:1e3},t),o),this}snapToNorth(t,o){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,o):this}getPitch(){return this.transform.pitch}setPitch(t,o){return this.jumpTo({pitch:t},o),this}cameraForBounds(t,o){t=l.LngLatBounds.convert(t);const h=o&&o.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),h,o)}_cameraForBoxAndBearing(t,o,h,p){const y={top:0,bottom:0,right:0,left:0};if(typeof(p=l.extend({padding:y,offset:[0,0],maxZoom:this.transform.maxZoom},p)).padding=="number"){const he=p.padding;p.padding={top:he,bottom:he,right:he,left:he}}p.padding=l.extend(y,p.padding);const v=this.transform,S=v.padding,T=v.project(l.LngLat.convert(t)),A=v.project(l.LngLat.convert(o)),k=T.rotate(-h*Math.PI/180),R=A.rotate(-h*Math.PI/180),$=new l.pointGeometry(Math.max(k.x,R.x),Math.max(k.y,R.y)),q=new l.pointGeometry(Math.min(k.x,R.x),Math.min(k.y,R.y)),N=$.sub(q),j=(v.width-(S.left+S.right+p.padding.left+p.padding.right))/N.x,ie=(v.height-(S.top+S.bottom+p.padding.top+p.padding.bottom))/N.y;if(ie<0||j<0)return void l.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const re=Math.min(v.scaleZoom(v.scale*Math.min(j,ie)),p.maxZoom),ae=l.pointGeometry.convert(p.offset),ne=new l.pointGeometry((p.padding.left-p.padding.right)/2,(p.padding.top-p.padding.bottom)/2).rotate(h*Math.PI/180),ge=ae.add(ne).mult(v.scale/v.zoomScale(re));return{center:v.unproject(T.add(A).div(2).sub(ge)),zoom:re,bearing:h}}fitBounds(t,o,h){return this._fitInternal(this.cameraForBounds(t,o),o,h)}fitScreenCoordinates(t,o,h,p,y){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(l.pointGeometry.convert(t)),this.transform.pointLocation(l.pointGeometry.convert(o)),h,p),p,y)}_fitInternal(t,o,h){return t?(delete(o=l.extend(t,o)).padding,o.linear?this.easeTo(o,h):this.flyTo(o,h)):this}jumpTo(t,o){this.stop();const h=this.transform;let p=!1,y=!1,v=!1;return"zoom"in t&&h.zoom!==+t.zoom&&(p=!0,h.zoom=+t.zoom),t.center!==void 0&&(h.center=l.LngLat.convert(t.center)),"bearing"in t&&h.bearing!==+t.bearing&&(y=!0,h.bearing=+t.bearing),"pitch"in t&&h.pitch!==+t.pitch&&(v=!0,h.pitch=+t.pitch),t.padding==null||h.isPaddingEqual(t.padding)||(h.padding=t.padding),this.fire(new l.Event("movestart",o)).fire(new l.Event("move",o)),p&&this.fire(new l.Event("zoomstart",o)).fire(new l.Event("zoom",o)).fire(new l.Event("zoomend",o)),y&&this.fire(new l.Event("rotatestart",o)).fire(new l.Event("rotate",o)).fire(new l.Event("rotateend",o)),v&&this.fire(new l.Event("pitchstart",o)).fire(new l.Event("pitch",o)).fire(new l.Event("pitchend",o)),this.fire(new l.Event("moveend",o))}easeTo(t,o){this._stop(!1,t.easeId),((t=l.extend({offset:[0,0],duration:500,easing:l.ease},t)).animate===!1||!t.essential&&l.exported.prefersReducedMotion)&&(t.duration=0);const h=this.transform,p=this.getZoom(),y=this.getBearing(),v=this.getPitch(),S=this.getPadding(),T="zoom"in t?+t.zoom:p,A="bearing"in t?this._normalizeBearing(t.bearing,y):y,k="pitch"in t?+t.pitch:v,R="padding"in t?t.padding:h.padding,$=l.pointGeometry.convert(t.offset);let q=h.centerPoint.add($);const N=h.pointLocation(q),j=l.LngLat.convert(t.center||N);this._normalizeCenter(j);const ie=h.project(N),re=h.project(j).sub(ie),ae=h.zoomScale(T-p);let ne,ge;t.around&&(ne=l.LngLat.convert(t.around),ge=h.locationPoint(ne));const he={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||T!==p,this._rotating=this._rotating||y!==A,this._pitching=this._pitching||k!==v,this._padding=!h.isPaddingEqual(R),this._easeId=t.easeId,this._prepareEase(o,t.noMoveStart,he),this._ease(de=>{if(this._zooming&&(h.zoom=l.number(p,T,de)),this._rotating&&(h.bearing=l.number(y,A,de)),this._pitching&&(h.pitch=l.number(v,k,de)),this._padding&&(h.interpolatePadding(S,R,de),q=h.centerPoint.add($)),ne)h.setLocationAtPoint(ne,ge);else{const Se=h.zoomScale(h.zoom-p),Ce=T>p?Math.min(2,ae):Math.max(.5,ae),fe=Math.pow(Ce,1-de),Ne=h.unproject(ie.add(re.mult(de*fe)).mult(Se));h.setLocationAtPoint(h.renderWorldCopies?Ne.wrap():Ne,q)}this._fireMoveEvents(o)},de=>{this._afterEase(o,de)},t),this}_prepareEase(t,o,h={}){this._moving=!0,o||h.moving||this.fire(new l.Event("movestart",t)),this._zooming&&!h.zooming&&this.fire(new l.Event("zoomstart",t)),this._rotating&&!h.rotating&&this.fire(new l.Event("rotatestart",t)),this._pitching&&!h.pitching&&this.fire(new l.Event("pitchstart",t))}_fireMoveEvents(t){this.fire(new l.Event("move",t)),this._zooming&&this.fire(new l.Event("zoom",t)),this._rotating&&this.fire(new l.Event("rotate",t)),this._pitching&&this.fire(new l.Event("pitch",t))}_afterEase(t,o){if(this._easeId&&o&&this._easeId===o)return;delete this._easeId;const h=this._zooming,p=this._rotating,y=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,h&&this.fire(new l.Event("zoomend",t)),p&&this.fire(new l.Event("rotateend",t)),y&&this.fire(new l.Event("pitchend",t)),this.fire(new l.Event("moveend",t))}flyTo(t,o){if(!t.essential&&l.exported.prefersReducedMotion){const ft=l.pick(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(ft,o)}this.stop(),t=l.extend({offset:[0,0],speed:1.2,curve:1.42,easing:l.ease},t);const h=this.transform,p=this.getZoom(),y=this.getBearing(),v=this.getPitch(),S=this.getPadding(),T="zoom"in t?l.clamp(+t.zoom,h.minZoom,h.maxZoom):p,A="bearing"in t?this._normalizeBearing(t.bearing,y):y,k="pitch"in t?+t.pitch:v,R="padding"in t?t.padding:h.padding,$=h.zoomScale(T-p),q=l.pointGeometry.convert(t.offset);let N=h.centerPoint.add(q);const j=h.pointLocation(N),ie=l.LngLat.convert(t.center||j);this._normalizeCenter(ie);const re=h.project(j),ae=h.project(ie).sub(re);let ne=t.curve;const ge=Math.max(h.width,h.height),he=ge/$,de=ae.mag();if("minZoom"in t){const ft=l.clamp(Math.min(t.minZoom,p,T),h.minZoom,h.maxZoom),jt=ge/h.zoomScale(ft-p);ne=Math.sqrt(jt/de*2)}const Se=ne*ne;function Ce(ft){const jt=(he*he-ge*ge+(ft?-1:1)*Se*Se*de*de)/(2*(ft?he:ge)*Se*de);return Math.log(Math.sqrt(jt*jt+1)-jt)}function fe(ft){return(Math.exp(ft)-Math.exp(-ft))/2}function Ne(ft){return(Math.exp(ft)+Math.exp(-ft))/2}const ze=Ce(0);let et=function(ft){return Ne(ze)/Ne(ze+ne*ft)},_t=function(ft){return ge*((Ne(ze)*(fe(jt=ze+ne*ft)/Ne(jt))-fe(ze))/Se)/de;var jt},dt=(Ce(1)-ze)/ne;if(Math.abs(de)<1e-6||!isFinite(dt)){if(Math.abs(ge-he)<1e-6)return this.easeTo(t,o);const ft=he<ge?-1:1;dt=Math.abs(Math.log(he/ge))/ne,_t=function(){return 0},et=function(jt){return Math.exp(ft*ne*jt)}}return t.duration="duration"in t?+t.duration:1e3*dt/("screenSpeed"in t?+t.screenSpeed/ne:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=y!==A,this._pitching=k!==v,this._padding=!h.isPaddingEqual(R),this._prepareEase(o,!1),this._ease(ft=>{const jt=ft*dt,tt=1/et(jt);h.zoom=ft===1?T:p+h.scaleZoom(tt),this._rotating&&(h.bearing=l.number(y,A,ft)),this._pitching&&(h.pitch=l.number(v,k,ft)),this._padding&&(h.interpolatePadding(S,R,ft),N=h.centerPoint.add(q));const bt=ft===1?ie:h.unproject(re.add(ae.mult(_t(jt))).mult(tt));h.setLocationAtPoint(h.renderWorldCopies?bt.wrap():bt,N),this._fireMoveEvents(o)},()=>this._afterEase(o),t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,o){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const h=this._onEaseEnd;delete this._onEaseEnd,h.call(this,o)}if(!t){const h=this.handlers;h&&h.stop(!1)}return this}_ease(t,o,h){h.animate===!1||h.duration===0?(t(1),o()):(this._easeStart=l.exported.now(),this._easeOptions=h,this._onEaseFrame=t,this._onEaseEnd=o,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const t=Math.min((l.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,o){t=l.wrap(t,-180,180);const h=Math.abs(t-o);return Math.abs(t-360-o)<h&&(t-=360),Math.abs(t+360-o)<h&&(t+=360),t}_normalizeCenter(t){const o=this.transform;if(!o.renderWorldCopies||o.lngRange)return;const h=t.lng-o.center.lng;t.lng+=h>180?-360:h<-180?360:0}}class va{constructor(t={}){this.options=t,l.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=Z.create("details","maplibregl-ctrl maplibregl-ctrl-attrib mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=Z.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=Z.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(){Z.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,o){const h=this._map._getUIString(`AttributionControl.${o}`);t.title=h,t.setAttribute("aria-label",h)}_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(p=>typeof p!="string"?"":p)):typeof this.options.customAttribution=="string"&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const p=this._map.style.stylesheet;this.styleOwner=p.owner,this.styleId=p.id}const o=this._map.style.sourceCaches;for(const p in o){const y=o[p];if(y.used){const v=y.getSource();v.attribution&&t.indexOf(v.attribution)<0&&t.push(v.attribution)}}t=t.filter(p=>String(p).trim()),t.sort((p,y)=>p.length-y.length),t=t.filter((p,y)=>{for(let v=y+1;v<t.length;v++)if(t[v].indexOf(p)>=0)return!1;return!0});const h=t.join(" | ");h!==this._attribHTML&&(this._attribHTML=h,t.length?(this._innerContainer.innerHTML=h,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 As{constructor(t={}){this.options=t,l.bindAll(["_updateCompact"],this)}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=Z.create("div","maplibregl-ctrl mapboxgl-ctrl");const o=Z.create("a","maplibregl-ctrl-logo mapboxgl-ctrl-logo");return o.target="_blank",o.rel="noopener nofollow",o.href="https://maplibre.org/",o.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),o.setAttribute("rel","noopener nofollow"),this._container.appendChild(o),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){Z.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 o=t[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&o.classList.add("maplibregl-compact","mapboxgl-compact"):o.classList.remove("maplibregl-compact","mapboxgl-compact")}}}class Gl{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const o=++this._id;return this._queue.push({callback:t,id:o,cancelled:!1}),o}remove(t){const o=this._currentlyRunning,h=o?this._queue.concat(o):this._queue;for(const p of h)if(p.id===t)return void(p.cancelled=!0)}run(t=0){const o=this._currentlyRunning=this._queue;this._queue=[];for(const h of o)if(!h.cancelled&&(h.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}const Zl={"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"},yh={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},Pr={showCompass:!0,showZoom:!0,visualizePitch:!1};class ba{constructor(t,o,h=!1){this._clickTolerance=10,this.element=o,this.mouseRotate=new Oe({clickTolerance:t.dragRotate._mouseRotate._clickTolerance}),this.map=t,h&&(this.mousePitch=new bs({clickTolerance:t.dragRotate._mousePitch._clickTolerance})),l.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),Z.addEventListener(o,"mousedown",this.mousedown),Z.addEventListener(o,"touchstart",this.touchstart,{passive:!1}),Z.addEventListener(o,"touchmove",this.touchmove),Z.addEventListener(o,"touchend",this.touchend),Z.addEventListener(o,"touchcancel",this.reset)}down(t,o){this.mouseRotate.mousedown(t,o),this.mousePitch&&this.mousePitch.mousedown(t,o),Z.disableDrag()}move(t,o){const h=this.map,p=this.mouseRotate.mousemoveWindow(t,o);if(p&&p.bearingDelta&&h.setBearing(h.getBearing()+p.bearingDelta),this.mousePitch){const y=this.mousePitch.mousemoveWindow(t,o);y&&y.pitchDelta&&h.setPitch(h.getPitch()+y.pitchDelta)}}off(){const t=this.element;Z.removeEventListener(t,"mousedown",this.mousedown),Z.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),Z.removeEventListener(t,"touchmove",this.touchmove),Z.removeEventListener(t,"touchend",this.touchend),Z.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){Z.enableDrag(),Z.removeEventListener(window,"mousemove",this.mousemove),Z.removeEventListener(window,"mouseup",this.mouseup)}mousedown(t){this.down(l.extend({},t,{ctrlKey:!0,preventDefault:()=>t.preventDefault()}),Z.mousePos(this.element,t)),Z.addEventListener(window,"mousemove",this.mousemove),Z.addEventListener(window,"mouseup",this.mouseup)}mousemove(t){this.move(t,Z.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=Z.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=Z.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 He(d,t,o){if(d=new l.LngLat(d.lng,d.lat),t){const h=new l.LngLat(d.lng-360,d.lat),p=new l.LngLat(d.lng+360,d.lat),y=o.locationPoint(d).distSqr(t);o.locationPoint(h).distSqr(t)<y?d=h:o.locationPoint(p).distSqr(t)<y&&(d=p)}for(;Math.abs(d.lng-o.center.lng)>180;){const h=o.locationPoint(d);if(h.x>=0&&h.y>=0&&h.x<=o.width&&h.y<=o.height)break;d.lng>o.center.lng?d.lng-=360:d.lng+=360}return d}const Je={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 zo(d,t,o){const h=d.classList;for(const p in Je)h.remove(`maplibregl-${o}-anchor-${p}`,`mapboxgl-${o}-anchor-${p}`);h.add(`maplibregl-${o}-anchor-${t}`,`mapboxgl-${o}-anchor-${t}`)}class ko extends l.Evented{constructor(t,o){if(super(),(t instanceof HTMLElement||o)&&(t=l.extend({element:t},o)),l.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=l.pointGeometry.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=Z.create("div"),this._element.setAttribute("aria-label","Map marker");const h=Z.createNS("http://www.w3.org/2000/svg","svg"),p=41,y=27;h.setAttributeNS(null,"display","block"),h.setAttributeNS(null,"height",`${p}px`),h.setAttributeNS(null,"width",`${y}px`),h.setAttributeNS(null,"viewBox",`0 0 ${y} ${p}`);const v=Z.createNS("http://www.w3.org/2000/svg","g");v.setAttributeNS(null,"stroke","none"),v.setAttributeNS(null,"stroke-width","1"),v.setAttributeNS(null,"fill","none"),v.setAttributeNS(null,"fill-rule","evenodd");const S=Z.createNS("http://www.w3.org/2000/svg","g");S.setAttributeNS(null,"fill-rule","nonzero");const T=Z.createNS("http://www.w3.org/2000/svg","g");T.setAttributeNS(null,"transform","translate(3.0, 29.0)"),T.setAttributeNS(null,"fill","#000000");const A=[{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 ae of A){const ne=Z.createNS("http://www.w3.org/2000/svg","ellipse");ne.setAttributeNS(null,"opacity","0.04"),ne.setAttributeNS(null,"cx","10.5"),ne.setAttributeNS(null,"cy","5.80029008"),ne.setAttributeNS(null,"rx",ae.rx),ne.setAttributeNS(null,"ry",ae.ry),T.appendChild(ne)}const k=Z.createNS("http://www.w3.org/2000/svg","g");k.setAttributeNS(null,"fill",this._color);const R=Z.createNS("http://www.w3.org/2000/svg","path");R.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"),k.appendChild(R);const $=Z.createNS("http://www.w3.org/2000/svg","g");$.setAttributeNS(null,"opacity","0.25"),$.setAttributeNS(null,"fill","#000000");const q=Z.createNS("http://www.w3.org/2000/svg","path");q.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"),$.appendChild(q);const N=Z.createNS("http://www.w3.org/2000/svg","g");N.setAttributeNS(null,"transform","translate(6.0, 7.0)"),N.setAttributeNS(null,"fill","#FFFFFF");const j=Z.createNS("http://www.w3.org/2000/svg","g");j.setAttributeNS(null,"transform","translate(8.0, 8.0)");const ie=Z.createNS("http://www.w3.org/2000/svg","circle");ie.setAttributeNS(null,"fill","#000000"),ie.setAttributeNS(null,"opacity","0.25"),ie.setAttributeNS(null,"cx","5.5"),ie.setAttributeNS(null,"cy","5.5"),ie.setAttributeNS(null,"r","5.4999962");const re=Z.createNS("http://www.w3.org/2000/svg","circle");re.setAttributeNS(null,"fill","#FFFFFF"),re.setAttributeNS(null,"cx","5.5"),re.setAttributeNS(null,"cy","5.5"),re.setAttributeNS(null,"r","5.4999962"),j.appendChild(ie),j.appendChild(re),S.appendChild(T),S.appendChild(k),S.appendChild($),S.appendChild(N),S.appendChild(j),h.appendChild(S),h.setAttributeNS(null,"height",p*this._scale+"px"),h.setAttributeNS(null,"width",y*this._scale+"px"),this._element.appendChild(h),this._offset=l.pointGeometry.convert(t&&t.offset||[0,-14])}this._element.classList.add("maplibregl-marker","mapboxgl-marker"),this._element.addEventListener("dragstart",h=>{h.preventDefault()}),this._element.addEventListener("mousedown",h=>{h.preventDefault()}),zo(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),Z.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=l.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 p=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":[p,-1*(38.1-13.5+p)],"bottom-right":[-p,-1*(38.1-13.5+p)],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 o=t.code,h=t.charCode||t.keyCode;o!=="Space"&&o!=="Enter"&&h!==32&&h!==13||this.togglePopup()}_onMapClick(t){const o=t.originalEvent.target,h=this._element;this._popup&&(o===h||h.contains(o))&&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=He(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);let o="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?o=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(o=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let h="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?h="rotateX(0deg)":this._pitchAlignment==="map"&&(h=`rotateX(${this._map.getPitch()}deg)`),t&&t.type!=="moveend"||(this._pos=this._pos.round()),Z.setTransform(this._element,`${Je[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${h} ${o}`)}getOffset(){return this._offset}setOffset(t){return this._offset=l.pointGeometry.convert(t),this._update(),this}_onMove(t){if(!this._isDragging){const o=this._clickTolerance||this._map._clickTolerance;this._isDragging=t.point.dist(this._pointerdownPos)>=o}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 l.Event("dragstart"))),this.fire(new l.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 l.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 Ps={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let ci,En=0,Vi=!1;const _h={maxWidth:100,unit:"metric"};function Lo(d,t,o){const h=o&&o.maxWidth||100,p=d._container.clientHeight/2,y=d.unproject([0,p]),v=d.unproject([h,p]),S=y.distanceTo(v);if(o&&o.unit==="imperial"){const T=3.2808*S;T>5280?Ft(t,h,T/5280,d._getUIString("ScaleControl.Miles")):Ft(t,h,T,d._getUIString("ScaleControl.Feet"))}else o&&o.unit==="nautical"?Ft(t,h,S/1852,d._getUIString("ScaleControl.NauticalMiles")):S>=1e3?Ft(t,h,S/1e3,d._getUIString("ScaleControl.Kilometers")):Ft(t,h,S,d._getUIString("ScaleControl.Meters"))}function Ft(d,t,o,h){const p=function(y){const v=Math.pow(10,`${Math.floor(y)}`.length-1);let S=y/v;return S=S>=10?10:S>=5?5:S>=3?3:S>=2?2:S>=1?1:function(T){const A=Math.pow(10,Math.ceil(-Math.log(T)/Math.LN10));return Math.round(T*A)/A}(S),v*S}(o);d.style.width=t*(p/o)+"px",d.innerHTML=`${p}&nbsp;${h}`}const hi={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},Hl=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function to(d){if(d){if(typeof d=="number"){const t=Math.round(Math.sqrt(.5*Math.pow(d,2)));return{center:new l.pointGeometry(0,0),top:new l.pointGeometry(0,d),"top-left":new l.pointGeometry(t,t),"top-right":new l.pointGeometry(-t,t),bottom:new l.pointGeometry(0,-d),"bottom-left":new l.pointGeometry(t,-t),"bottom-right":new l.pointGeometry(-t,-t),left:new l.pointGeometry(d,0),right:new l.pointGeometry(-d,0)}}if(d instanceof l.pointGeometry||Array.isArray(d)){const t=l.pointGeometry.convert(d);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:l.pointGeometry.convert(d.center||[0,0]),top:l.pointGeometry.convert(d.top||[0,0]),"top-left":l.pointGeometry.convert(d["top-left"]||[0,0]),"top-right":l.pointGeometry.convert(d["top-right"]||[0,0]),bottom:l.pointGeometry.convert(d.bottom||[0,0]),"bottom-left":l.pointGeometry.convert(d["bottom-left"]||[0,0]),"bottom-right":l.pointGeometry.convert(d["bottom-right"]||[0,0]),left:l.pointGeometry.convert(d.left||[0,0]),right:l.pointGeometry.convert(d.right||[0,0])}}return to(new l.pointGeometry(0,0))}const Do={supported:D,setRTLTextPlugin:l.setRTLTextPlugin,getRTLTextPluginStatus:l.getRTLTextPluginStatus,Map:class extends xa{constructor(d){var t;if(l.PerformanceUtils.mark(l.PerformanceMarkers.create),(d=l.extend({},yh,d)).minZoom!=null&&d.maxZoom!=null&&d.minZoom>d.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(d.minPitch!=null&&d.maxPitch!=null&&d.minPitch>d.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(d.minPitch!=null&&d.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(d.maxPitch!=null&&d.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new To(d.minZoom,d.maxZoom,d.minPitch,d.maxPitch,d.renderWorldCopies),{bearingSnap:d.bearingSnap}),this._interactive=d.interactive,this._maxTileCacheSize=d.maxTileCacheSize,this._failIfMajorPerformanceCaveat=d.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=d.preserveDrawingBuffer,this._antialias=d.antialias,this._trackResize=d.trackResize,this._bearingSnap=d.bearingSnap,this._refreshExpiredTiles=d.refreshExpiredTiles,this._fadeDuration=d.fadeDuration,this._crossSourceCollisions=d.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=d.collectResourceTiming,this._renderTaskQueue=new Gl,this._controls=[],this._mapId=l.uniqueId(),this._locale=l.extend({},Zl,d.locale),this._clickTolerance=d.clickTolerance,this._pixelRatio=(t=d.pixelRatio)!==null&&t!==void 0?t:devicePixelRatio,this._requestManager=new we(d.transformRequest),typeof d.container=="string"){if(this._container=document.getElementById(d.container),!this._container)throw new Error(`Container '${d.container}' not found.`)}else{if(!(d.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=d.container}if(d.maxBounds&&this.setMaxBounds(d.maxBounds),l.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 ar(this,d),this._hash=d.hash&&new kl(typeof d.hash=="string"&&d.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:d.center,zoom:d.zoom,bearing:d.bearing,pitch:d.pitch}),d.bounds&&(this.resize(),this.fitBounds(d.bounds,l.extend({},d.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=d.localIdeographFontFamily,d.style&&this.setStyle(d.style,{localIdeographFontFamily:d.localIdeographFontFamily}),d.attributionControl&&this.addControl(new va({customAttribution:d.customAttribution})),d.maplibreLogo&&this.addControl(new As,d.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",o=>{this._update(o.dataType==="style"),this.fire(new l.Event(`${o.dataType}data`,o))}),this.on("dataloading",o=>{this.fire(new l.Event(`${o.dataType}dataloading`,o))}),this.on("dataabort",o=>{this.fire(new l.Event("sourcedataabort",o))})}_getMapId(){return this._mapId}addControl(d,t){if(t===void 0&&(t=d.getDefaultPosition?d.getDefaultPosition():"top-right"),!d||!d.onAdd)return this.fire(new l.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const o=d.onAdd(this);this._controls.push(d);const h=this._controlPositions[t];return t.indexOf("bottom")!==-1?h.insertBefore(o,h.firstChild):h.appendChild(o),this}removeControl(d){if(!d||!d.onRemove)return this.fire(new l.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(d);return t>-1&&this._controls.splice(t,1),d.onRemove(this),this}hasControl(d){return this._controls.indexOf(d)>-1}resize(d){const t=this._containerDimensions(),o=t[0],h=t[1];this._resizeCanvas(o,h,this.getPixelRatio()),this.transform.resize(o,h),this.painter.resize(o,h,this.getPixelRatio());const p=!this._moving;return p&&(this.stop(),this.fire(new l.Event("movestart",d)).fire(new l.Event("move",d))),this.fire(new l.Event("resize",d)),p&&this.fire(new l.Event("moveend",d)),this}getPixelRatio(){return this._pixelRatio}setPixelRatio(d){const[t,o]=this._containerDimensions();this._pixelRatio=d,this._resizeCanvas(t,o,d),this.painter.resize(t,o,d)}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(d){return this.transform.setMaxBounds(l.LngLatBounds.convert(d)),this._update()}setMinZoom(d){if((d=d??-2)>=-2&&d<=this.transform.maxZoom)return this.transform.minZoom=d,this._update(),this.getZoom()<d&&this.setZoom(d),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(d){if((d=d??22)>=this.transform.minZoom)return this.transform.maxZoom=d,this._update(),this.getZoom()>d&&this.setZoom(d),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(d){if((d=d??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(d>=0&&d<=this.transform.maxPitch)return this.transform.minPitch=d,this._update(),this.getPitch()<d&&this.setPitch(d),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(d){if((d=d??60)>85)throw new Error("maxPitch must be less than or equal to 85");if(d>=this.transform.minPitch)return this.transform.maxPitch=d,this._update(),this.getPitch()>d&&this.setPitch(d),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(d){return this.transform.renderWorldCopies=d,this._update()}project(d){return this.transform.locationPoint(l.LngLat.convert(d))}unproject(d){return this.transform.pointLocation(l.pointGeometry.convert(d))}isMoving(){return this._moving||this.handlers.isMoving()}isZooming(){return this._zooming||this.handlers.isZooming()}isRotating(){return this._rotating||this.handlers.isRotating()}_createDelegatedListener(d,t,o){if(d==="mouseenter"||d==="mouseover"){let h=!1;return{layer:t,listener:o,delegates:{mousemove:y=>{const v=this.getLayer(t)?this.queryRenderedFeatures(y.point,{layers:[t]}):[];v.length?h||(h=!0,o.call(this,new Xi(d,this,y.originalEvent,{features:v}))):h=!1},mouseout:()=>{h=!1}}}}if(d==="mouseleave"||d==="mouseout"){let h=!1;return{layer:t,listener:o,delegates:{mousemove:v=>{(this.getLayer(t)?this.queryRenderedFeatures(v.point,{layers:[t]}):[]).length?h=!0:h&&(h=!1,o.call(this,new Xi(d,this,v.originalEvent)))},mouseout:v=>{h&&(h=!1,o.call(this,new Xi(d,this,v.originalEvent)))}}}}{const h=p=>{const y=this.getLayer(t)?this.queryRenderedFeatures(p.point,{layers:[t]}):[];y.length&&(p.features=y,o.call(this,p),delete p.features)};return{layer:t,listener:o,delegates:{[d]:h}}}}on(d,t,o){if(o===void 0)return super.on(d,t);const h=this._createDelegatedListener(d,t,o);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[d]=this._delegatedListeners[d]||[],this._delegatedListeners[d].push(h);for(const p in h.delegates)this.on(p,h.delegates[p]);return this}once(d,t,o){if(o===void 0)return super.once(d,t);const h=this._createDelegatedListener(d,t,o);for(const p in h.delegates)this.once(p,h.delegates[p]);return this}off(d,t,o){return o===void 0?super.off(d,t):(this._delegatedListeners&&this._delegatedListeners[d]&&(h=>{const p=this._delegatedListeners[d];for(let y=0;y<p.length;y++){const v=p[y];if(v.layer===t&&v.listener===o){for(const S in v.delegates)this.off(S,v.delegates[S]);return p.splice(y,1),this}}})(),this)}queryRenderedFeatures(d,t){if(!this.style)return[];let o;if(t!==void 0||d===void 0||d instanceof l.pointGeometry||Array.isArray(d)||(t=d,d=void 0),t=t||{},(d=d||[[0,0],[this.transform.width,this.transform.height]])instanceof l.pointGeometry||typeof d[0]=="number")o=[l.pointGeometry.convert(d)];else{const h=l.pointGeometry.convert(d[0]),p=l.pointGeometry.convert(d[1]);o=[h,new l.pointGeometry(p.x,h.y),p,new l.pointGeometry(h.x,p.y),h]}return this.style.queryRenderedFeatures(o,t,this.transform)}querySourceFeatures(d,t){return this.style.querySourceFeatures(d,t)}setStyle(d,t){return(t=l.extend({},{localIdeographFontFamily:this._localIdeographFontFamily},t)).diff!==!1&&t.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&d?(this._diffStyle(d,t),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._updateStyle(d,t))}setTransformRequest(d){return this._requestManager.setTransformRequest(d),this}_getUIString(d){const t=this._locale[d];if(t==null)throw new Error(`Missing UI string '${d}'`);return t}_updateStyle(d,t){return this.style&&(this.style.setEventedParent(null),this.style._remove()),d?(this.style=new _i(this,t||{}),this.style.setEventedParent(this,{style:this.style}),typeof d=="string"?this.style.loadURL(d):this.style.loadJSON(d),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new _i(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(d,t){if(typeof d=="string"){const o=this._requestManager.transformRequest(d,l.ResourceType.Style);l.getJSON(o,(h,p)=>{h?this.fire(new l.ErrorEvent(h)):p&&this._updateDiff(p,t)})}else typeof d=="object"&&this._updateDiff(d,t)}_updateDiff(d,t){try{this.style.setState(d)&&this._update(!0)}catch(o){l.warnOnce(`Unable to perform style diff: ${o.message||o.error||o}.  Rebuilding the style from scratch.`),this._updateStyle(d,t)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():l.warnOnce("There is no style added to the map.")}addSource(d,t){return this._lazyInitEmptyStyle(),this.style.addSource(d,t),this._update(!0)}isSourceLoaded(d){const t=this.style&&this.style.sourceCaches[d];if(t!==void 0)return t.loaded();this.fire(new l.ErrorEvent(new Error(`There is no source with ID '${d}'`)))}areTilesLoaded(){const d=this.style&&this.style.sourceCaches;for(const t in d){const o=d[t]._tiles;for(const h in o){const p=o[h];if(p.state!=="loaded"&&p.state!=="errored")return!1}}return!0}addSourceType(d,t,o){return this._lazyInitEmptyStyle(),this.style.addSourceType(d,t,o)}removeSource(d){return this.style.removeSource(d),this._update(!0)}getSource(d){return this.style.getSource(d)}addImage(d,t,{pixelRatio:o=1,sdf:h=!1,stretchX:p,stretchY:y,content:v}={}){if(this._lazyInitEmptyStyle(),t instanceof HTMLImageElement||l.isImageBitmap(t)){const{width:S,height:T,data:A}=l.exported.getImageData(t);this.style.addImage(d,{data:new l.RGBAImage({width:S,height:T},A),pixelRatio:o,stretchX:p,stretchY:y,content:v,sdf:h,version:0})}else{if(t.width===void 0||t.height===void 0)return this.fire(new l.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:S,height:T,data:A}=t,k=t;this.style.addImage(d,{data:new l.RGBAImage({width:S,height:T},new Uint8Array(A)),pixelRatio:o,stretchX:p,stretchY:y,content:v,sdf:h,version:0,userImage:k}),k.onAdd&&k.onAdd(this,d)}}}updateImage(d,t){const o=this.style.getImage(d);if(!o)return this.fire(new l.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const h=t instanceof HTMLImageElement||l.isImageBitmap(t)?l.exported.getImageData(t):t,{width:p,height:y,data:v}=h;if(p===void 0||y===void 0)return this.fire(new l.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(p!==o.data.width||y!==o.data.height)return this.fire(new l.ErrorEvent(new Error("The width and height of the updated image must be that same as the previous version of the image")));const S=!(t instanceof HTMLImageElement||l.isImageBitmap(t));o.data.replace(v,S),this.style.updateImage(d,o)}hasImage(d){return d?!!this.style.getImage(d):(this.fire(new l.ErrorEvent(new Error("Missing required image id"))),!1)}removeImage(d){this.style.removeImage(d)}loadImage(d,t){l.getImage(this._requestManager.transformRequest(d,l.ResourceType.Image),t)}listImages(){return this.style.listImages()}addLayer(d,t){return this._lazyInitEmptyStyle(),this.style.addLayer(d,t),this._update(!0)}moveLayer(d,t){return this.style.moveLayer(d,t),this._update(!0)}removeLayer(d){return this.style.removeLayer(d),this._update(!0)}getLayer(d){return this.style.getLayer(d)}setLayerZoomRange(d,t,o){return this.style.setLayerZoomRange(d,t,o),this._update(!0)}setFilter(d,t,o={}){return this.style.setFilter(d,t,o),this._update(!0)}getFilter(d){return this.style.getFilter(d)}setPaintProperty(d,t,o,h={}){return this.style.setPaintProperty(d,t,o,h),this._update(!0)}getPaintProperty(d,t){return this.style.getPaintProperty(d,t)}setLayoutProperty(d,t,o,h={}){return this.style.setLayoutProperty(d,t,o,h),this._update(!0)}getLayoutProperty(d,t){return this.style.getLayoutProperty(d,t)}setLight(d,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(d,t),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(d,t){return this.style.setFeatureState(d,t),this._update()}removeFeatureState(d,t){return this.style.removeFeatureState(d,t),this._update()}getFeatureState(d){return this.style.getFeatureState(d)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let d=0,t=0;return this._container&&(d=this._container.clientWidth||400,t=this._container.clientHeight||300),[d,t]}_setupContainer(){const d=this._container;d.classList.add("maplibregl-map","mapboxgl-map");const t=this._canvasContainer=Z.create("div","maplibregl-canvas-container mapboxgl-canvas-container",d);this._interactive&&t.classList.add("maplibregl-interactive","mapboxgl-interactive"),this._canvas=Z.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 o=this._containerDimensions();this._resizeCanvas(o[0],o[1],this.getPixelRatio());const h=this._controlContainer=Z.create("div","maplibregl-control-container mapboxgl-control-container",d),p=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(y=>{p[y]=Z.create("div",`maplibregl-ctrl-${y} mapboxgl-ctrl-${y}`,h)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(d,t,o){this._canvas.width=o*d,this._canvas.height=o*t,this._canvas.style.width=`${d}px`,this._canvas.style.height=`${t}px`}_setupPainter(){const d=l.extend({},D.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),t=this._canvas.getContext("webgl",d)||this._canvas.getContext("experimental-webgl",d);t?(this.painter=new xs(t,this.transform),l.exported$1.testSupport(t)):this.fire(new l.ErrorEvent(new Error("Failed to initialize WebGL")))}_contextLost(d){d.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new l.Event("webglcontextlost",{originalEvent:d}))}_contextRestored(d){this._setupPainter(),this.resize(),this._update(),this.fire(new l.Event("webglcontextrestored",{originalEvent:d}))}_onMapScroll(d){if(d.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(d){return this.style?(this._styleDirty=this._styleDirty||d,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(d){return this._update(),this._renderTaskQueue.add(d)}_cancelRenderFrame(d){this._renderTaskQueue.remove(d)}_render(d){let t,o=0;const h=this.painter.context.extTimerQuery;if(this.listens("gpu-timing-frame")&&(t=h.createQueryEXT(),h.beginQueryEXT(h.TIME_ELAPSED_EXT,t),o=l.exported.now()),this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(d),this._removed)return;let p=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const v=this.transform.zoom,S=l.exported.now();this.style.zoomHistory.update(v,S);const T=new l.EvaluationParameters(v,{now:S,fadeDuration:this._fadeDuration,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),A=T.crossFadingFactor();A===1&&A===this._crossFadingFactor||(p=!0,this._crossFadingFactor=A),this.style.update(T)}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 l.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,l.PerformanceUtils.mark(l.PerformanceMarkers.load),this.fire(new l.Event("load"))),this.style&&(this.style.hasTransitions()||p)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),this.listens("gpu-timing-frame")){const v=l.exported.now()-o;h.endQueryEXT(h.TIME_ELAPSED_EXT,t),setTimeout(()=>{const S=h.getQueryObjectEXT(t,h.QUERY_RESULT_EXT)/1e6;h.deleteQueryEXT(t),this.fire(new l.Event("gpu-timing-frame",{cpuTime:v,gpuTime:S}))},50)}if(this.listens("gpu-timing-layer")){const v=this.painter.collectGpuTimers();setTimeout(()=>{const S=this.painter.queryGpuTimers(v);this.fire(new l.Event("gpu-timing-layer",{layerTimes:S}))},50)}const y=this._sourcesDirty||this._styleDirty||this._placementDirty;return y||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new l.Event("idle")),!this._loaded||this._fullyLoaded||y||(this._fullyLoaded=!0,l.PerformanceUtils.mark(l.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 d=this.painter.context.gl.getExtension("WEBGL_lose_context");d&&d.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),Z.remove(this._canvasContainer),Z.remove(this._controlContainer),this._container.classList.remove("maplibregl-map","mapboxgl-map"),l.PerformanceUtils.clearMetrics(),this._removed=!0,this.fire(new l.Event("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=l.exported.frame(d=>{l.PerformanceUtils.frame(d),this._frame=null,this._render(d)}))}_onWindowOnline(){this._update()}_onWindowResize(d){this._trackResize&&this.resize({originalEvent:d})._update()}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(d){this._showTileBoundaries!==d&&(this._showTileBoundaries=d,this._update())}get showPadding(){return!!this._showPadding}set showPadding(d){this._showPadding!==d&&(this._showPadding=d,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(d){this._showCollisionBoxes!==d&&(this._showCollisionBoxes=d,d?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(d){this._showOverdrawInspector!==d&&(this._showOverdrawInspector=d,this._update())}get repaint(){return!!this._repaint}set repaint(d){this._repaint!==d&&(this._repaint=d,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(d){this._vertices=d,this._update()}_setCacheLimits(d,t){l.setCacheLimits(d,t)}},NavigationControl:class{constructor(d){this.options=l.extend({},Pr,d),this._container=Z.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(l.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in mapboxgl-ctrl-zoom-in",t=>this._map.zoomIn({},{originalEvent:t})),Z.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})),Z.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(l.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=Z.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const d=this._map.getZoom(),t=d===this._map.getMaxZoom(),o=d===this._map.getMinZoom();this._zoomInButton.disabled=t,this._zoomOutButton.disabled=o,this._zoomInButton.setAttribute("aria-disabled",t.toString()),this._zoomOutButton.setAttribute("aria-disabled",o.toString())}_rotateCompassArrow(){const d=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=d}onAdd(d){return this._map=d,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 ba(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){Z.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(d,t){const o=Z.create("button",d,this._container);return o.type="button",o.addEventListener("click",t),o}_setButtonTitle(d,t){const o=this._map._getUIString(`NavigationControl.${t}`);d.title=o,d.setAttribute("aria-label",o)}},GeolocateControl:class extends l.Evented{constructor(d){super(),this.options=l.extend({},Ps,d),l.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker"],this)}onAdd(d){var t;return this._map=d,this._container=Z.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),t=this._setupUI,ci!==void 0?t(ci):window.navigator.permissions!==void 0?window.navigator.permissions.query({name:"geolocation"}).then(o=>{ci=o.state!=="denied",t(ci)}):(ci=!!window.navigator.geolocation,t(ci)),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(),Z.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,En=0,Vi=!1}_isOutOfMapMaxBounds(d){const t=this._map.getMaxBounds(),o=d.coords;return t&&(o.longitude<t.getWest()||o.longitude>t.getEast()||o.latitude<t.getSouth()||o.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(d){if(this._map){if(this._isOutOfMapMaxBounds(d))return this._setErrorState(),this.fire(new l.Event("outofmaxbounds",d)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=d,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(d),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(d),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new l.Event("geolocate",d)),this._finish()}}_updateCamera(d){const t=new l.LngLat(d.coords.longitude,d.coords.latitude),o=d.coords.accuracy,h=this._map.getBearing(),p=l.extend({bearing:h},this.options.fitBoundsOptions);this._map.fitBounds(t.toBounds(o),p,{geolocateSource:!0})}_updateMarker(d){if(d){const t=new l.LngLat(d.coords.longitude,d.coords.latitude);this._accuracyCircleMarker.setLngLat(t).addTo(this._map),this._userLocationDotMarker.setLngLat(t).addTo(this._map),this._accuracy=d.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const d=this._map._container.clientHeight/2,t=this._map.unproject([0,d]),o=this._map.unproject([1,d]),h=t.distanceTo(o),p=Math.ceil(2*this._accuracy/h);this._circleElement.style.width=`${p}px`,this._circleElement.style.height=`${p}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_onError(d){if(this._map){if(this.options.trackUserLocation)if(d.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(d.code===3&&Vi)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 l.Event("error",d)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(d){if(this._container.addEventListener("contextmenu",t=>t.preventDefault()),this._geolocateButton=Z.create("button","maplibregl-ctrl-geolocate mapboxgl-ctrl-geolocate",this._container),Z.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",d===!1){l.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=Z.create("div","maplibregl-user-location-dot mapboxgl-user-location-dot"),this._userLocationDotMarker=new ko(this._dotElement),this._circleElement=Z.create("div","maplibregl-user-location-accuracy-circle mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new ko({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 l.Event("trackuserlocationend")))})}trigger(){if(!this._setup)return l.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 l.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":En--,Vi=!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 l.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 l.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 d;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),En++,En>1?(d={maximumAge:6e5,timeout:0},Vi=!0):(d=this.options.positionOptions,Vi=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,d)}}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:va,LogoControl:As,ScaleControl:class{constructor(d){this.options=l.extend({},_h,d),l.bindAll(["_onMove","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_onMove(){Lo(this._map,this._container,this.options)}onAdd(d){return this._map=d,this._container=Z.create("div","maplibregl-ctrl maplibregl-ctrl-scale mapboxgl-ctrl mapboxgl-ctrl-scale",d.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){Z.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}setUnit(d){this.options.unit=d,Lo(this._map,this._container,this.options)}},FullscreenControl:class{constructor(d){this._fullscreen=!1,d&&d.container&&(d.container instanceof HTMLElement?this._container=d.container:l.warnOnce("Full screen control 'container' must be a DOM element.")),l.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(d){return this._map=d,this._container||(this._container=this._map.getContainer()),this._controlContainer=Z.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",l.warnOnce("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){Z.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 d=this._fullscreenButton=Z.create("button","maplibregl-ctrl-fullscreen mapboxgl-ctrl-fullscreen",this._controlContainer);Z.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",d).setAttribute("aria-hidden","true"),d.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const d=this._getTitle();this._fullscreenButton.setAttribute("aria-label",d),this._fullscreenButton.title=d}_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 l.Evented{constructor(d){super(),this.options=l.extend(Object.create(hi),d),l.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this)}addTo(d){return this._map&&this.remove(),this._map=d,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 l.Event("open")),this}isOpen(){return!!this._map}remove(){return this._content&&Z.remove(this._content),this._container&&(Z.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 l.Event("close")),this}getLngLat(){return this._lngLat}setLngLat(d){return this._lngLat=l.LngLat.convert(d),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(d){return this.setDOMContent(document.createTextNode(d))}setHTML(d){const t=document.createDocumentFragment(),o=document.createElement("body");let h;for(o.innerHTML=d;h=o.firstChild,h;)t.appendChild(h);return this.setDOMContent(t)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(d){return this.options.maxWidth=d,this._update(),this}setDOMContent(d){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=Z.create("div","maplibregl-popup-content mapboxgl-popup-content",this._container);return this._content.appendChild(d),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(d){this._container&&this._container.classList.add(d)}removeClassName(d){this._container&&this._container.classList.remove(d)}setOffset(d){return this.options.offset=d,this._update(),this}toggleClassName(d){if(this._container)return this._container.classList.toggle(d)}_createCloseButton(){this.options.closeButton&&(this._closeButton=Z.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(d){this._update(d.point)}_onMouseMove(d){this._update(d.point)}_onDrag(d){this._update(d.point)}_update(d){if(!this._map||!this._lngLat&&!this._trackPointer||!this._content||(this._container||(this._container=Z.create("div","maplibregl-popup mapboxgl-popup",this._map.getContainer()),this._tip=Z.create("div","maplibregl-popup-tip mapboxgl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach(y=>this._container.classList.add(y)),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=He(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!d))return;const t=this._pos=this._trackPointer&&d?d:this._map.project(this._lngLat);let o=this.options.anchor;const h=to(this.options.offset);if(!o){const y=this._container.offsetWidth,v=this._container.offsetHeight;let S;S=t.y+h.bottom.y<v?["top"]:t.y>this._map.transform.height-v?["bottom"]:[],t.x<y/2?S.push("left"):t.x>this._map.transform.width-y/2&&S.push("right"),o=S.length===0?"bottom":S.join("-")}const p=t.add(h[o]).round();Z.setTransform(this._container,`${Je[o]} translate(${p.x}px,${p.y}px)`),zo(this._container,o,"popup")}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const d=this._container.querySelector(Hl);d&&d.focus()}_onClose(){this.remove()}},Marker:ko,Style:_i,LngLat:l.LngLat,LngLatBounds:l.LngLatBounds,Point:l.pointGeometry,MercatorCoordinate:l.MercatorCoordinate,Evented:l.Evented,AJAXError:l.AJAXError,config:l.config,CanvasSource:dn,GeoJSONSource:hn,ImageSource:$r,RasterDEMTileSource:mr,RasterTileSource:qi,VectorTileSource:pr,VideoSource:en,prewarm:function(){Er().acquire(pn)},clearPrewarmedResources:function(){const d=Gr;d&&(d.isPreloaded()&&d.numActive()===1?(d.release(pn),Gr=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 Ir.workerCount},set workerCount(d){Ir.workerCount=d},get maxParallelImageRequests(){return l.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(d){l.config.MAX_PARALLEL_IMAGE_REQUESTS=d},clearStorage(d){l.clearTileCache(d)},workerUrl:"",addProtocol(d,t){l.config.REGISTERED_PROTOCOLS[d]=t},removeProtocol(d){delete l.config.REGISTERED_PROTOCOLS[d]}};return Ut.extend(Do,{isSafari:l.isSafari,getPerformanceMetrics:l.PerformanceUtils.getPerformanceMetrics}),Do});var I=_;return I})})(Ur);var s0=Ur.exports;const mf="wind-heatmap",l0="wind-particles",Rp=150,Zc=[-1,-1,-1,1,1,1,-1,-1,1,1,1,-1];function c0(){if(!("matchMedia"in window))return!1;const a=window.matchMedia("(prefers-reduced-motion: reduce)");return a!=null&&a.matches}function Fp({position:a,className:n,pin:c,shadow:f}){const _=document.createElement("div"),w=document.createElement("div");w.className=n,_.appendChild(w);const I=document.createElement("img");if(I.className=c.className,I.src=c.url,w.appendChild(I),c.hoverUrl!=null){const D=document.createElement("img");D.className=`${c.className}--hover`,D.src=c.hoverUrl,w.appendChild(D)}if(f!=null){const D=document.createElement("img");D.className=f.className,D.src=f.url,w.appendChild(D)}const l=new Ur.exports.Marker({element:_,anchor:"bottom"});return a!=null&&l.setLngLat(a),l}function h0(a){return{lat:a.lat,lon:a.lng}}function Bp(a){const n=a.wrap();return{lat:n.lat,lon:n.lng}}function Op({position:a,type:n="default"}){return n==="locationId"?`${a.lat.toFixed(3)},${a.lon.toFixed(3)}`:n==="name"?`${a.lat.toFixed(3)}, ${a.lon.toFixed(3)}`:`${a.lat}, ${a.lon}`}class u0{constructor({center:n,bounds:c,mapElement:f,supportsWebp:_,showDefaultAttribution:w,theme:I,units:l,assets:D,classNames:B,localeCode:J}){this.eventListeners=[],this.styles={},this.layers={},this.isZoomingAfterShowingLayer=!1,this.handleWebGlContextLost=()=>{this.dispatchEvent({type:"map:webgl-context-lost"})},this.handleZoom=K=>{if(this.clickTimeoutId!=null&&(clearTimeout(this.clickTimeoutId),this.clickTimeoutId=void 0),this.abortController!=null&&this.abortController.signal.aborted===!1&&this.abortController.abort(),this.dispatchEvent({type:"map:zoom",currentZoom:this.maplibregl.getZoom(),minZoom:this.maplibregl.getMinZoom(),maxZoom:this.maplibregl.getMaxZoom()}),this.isZoomingAfterShowingLayer===!0){const Z=this.activeLayerId!=null?this.getLayer(this.activeLayerId):void 0;if(Z==null)return;K.targetZoom!=null&&this.maplibregl.getZoom()!==K.targetZoom||(this.setMinMaxZoom({min:Z.zoomLevels.min,max:Z.zoomLevels.max}),this.isZoomingAfterShowingLayer=!1)}},this.setMinMaxZoom=({min:K,max:Z})=>{this.maplibregl.setMinZoom(K),this.maplibregl.setMaxZoom(Z)},this.handleLoad=()=>{this.dispatchEvent(Object.assign({type:"map:scale"},Dp({map:this.maplibregl,maxWidth:Rp,type:this.units.distance})))},this.checkIsStyleLoaded=()=>{this.activeLayerId!=null&&(this.maplibregl.isStyleLoaded()!==!1?this.showLayer(this.activeLayerId):setTimeout(this.checkIsStyleLoaded))},this.handleClick=K=>{const Z=this.activeLayerId!=null?this.layers[this.activeLayerId]:void 0;if(Z==null)return;this.aborted=!1,this.abortController!=null&&this.abortController.signal.aborted===!1&&this.abortController.abort(),this.abortController=new AbortController,this.clickTimeoutId!=null&&(clearTimeout(this.clickTimeoutId),this.clickTimeoutId=void 0);const we=this.isWithinPin(Z.pin,K.point);let be,Ae,Fe=K.lngLat,$e=!1;if(Z.layer.id==="weather"){const Ge=Z.layer.getFeatureFromPoint(K.point),lt=Z.layer.getLocationId();Ge&&(Fe=Ge.lngLat,be=Ge.locationId,$e=!0,Ae=lt===be)}we&&(Fe=this.primaryPin.getLngLat(),$e=!0);const Ve=this.fetchSearchByPosition({position:Bp(Fe),signal:this.abortController.signal}).catch(Ge=>{Ge.name!=="AbortError"?this.dispatchEvent({type:"map:fetch-error",message:"Failed to fetch"}):this.aborted=!0});this.clickTimeoutId=setTimeout(()=>{this.handleSingleClick({pin:Z.pin,clickedPoint:K.point,lngLat:Fe,locations:Ve,isWithinPinOrFeature:$e,hasClickedCurrentLocationInWeatherLayer:Ae,featureLocationId:be})},500)},this.handleMove=()=>{this.dispatchEvent(Object.assign({type:"map:scale"},Dp({map:this.maplibregl,maxWidth:Rp,type:this.units.distance})))},this.center=n,this.supportsWebp=_,this.theme=I,this.units=l,this.assets=D,this.prefersReducedMotion=c0(),this.localeCode=J,this.maplibregl=new s0.Map({container:f,style:{version:8,sources:{},layers:[]},zoom:0,minZoom:0,maxZoom:0,center:this.center,bounds:c!=null?[c.west,c.south,c.east,c.north]:void 0,attributionControl:w}),this.primaryPin=Fp({position:this.center,className:B.pin.parent,pin:{className:B.pin.pin,url:D.pin.iconUrl,hoverUrl:D.pin.hoverUrl},shadow:B.pin.shadow!=null?{className:B.pin.shadow,url:D.pin.shadowUrl}:void 0}),this.secondaryPin=Fp({className:B.secondaryPin.parent,pin:{className:B.secondaryPin.pin,url:D.secondaryPin.iconUrl}}),this.maplibregl.dragRotate.disable(),this.maplibregl.touchZoomRotate.disableRotation(),this.maplibregl.touchPitch.disable(),this.maplibregl.on("zoom",this.handleZoom),this.maplibregl.on("load",this.handleLoad),this.maplibregl.on("move",this.handleMove),this.maplibregl.on("click",this.handleClick),this.maplibregl.on("webglcontextlost",this.handleWebGlContextLost)}zoomIn(){this.maplibregl.zoomIn()}zoomOut(){this.maplibregl.zoomOut()}handleSingleClick({pin:n,clickedPoint:c,lngLat:f,locations:_,isWithinPinOrFeature:w,hasClickedCurrentLocationInWeatherLayer:I,featureLocationId:l}){return di(this,void 0,void 0,function*(){const D=h0(f),B=Bp(f),J=this.abortController;if(w){this.showSecondaryPin(D),this.hideSecondaryPin(),this.dispatchEvent({type:"map:start-click",pin:l!=null?"secondary":"primary",hasClickedCurrentLocationInWeatherLayer:I,point:c});const{currentLocation:we,locationsNearby:be}=yield this.createLocationDataFromPromise({positionWrapped:B,locations:_,featureLocationId:l});return J?.signal.aborted===!0?void 0:void this.dispatchEvent({type:"map:click",position:D,positionWrapped:B,point:c,pin:l!=null?"secondary":"primary",location:we,locationsNearby:be})}n==="dynamic-primary"?this.showPrimaryPin(D):n!=="dynamic-secondary-with-static-primary"&&n!=="dynamic-secondary-without-primary"||this.showSecondaryPin(D),this.dispatchEvent({type:"map:start-click",pin:n==="dynamic-secondary-with-static-primary"||n==="dynamic-secondary-without-primary"?"secondary":"primary",hasClickedCurrentLocationInWeatherLayer:!1,point:c});const{currentLocation:K,locationsNearby:Z}=yield this.createLocationDataFromPromise({positionWrapped:B,locations:_,featureLocationId:l});J?.signal.aborted!==!0&&this.dispatchEvent({type:"map:click",position:D,positionWrapped:B,point:c,pin:n==="dynamic-secondary-with-static-primary"||n==="dynamic-secondary-without-primary"?"secondary":"primary",location:K,locationsNearby:Z})})}addEventListener(n){this.eventListeners.push(n)}removeEventListener(n){this.eventListeners=this.eventListeners.filter(c=>c!==n)}dispatchEvent(n){for(const c of this.eventListeners)c(n)}addStyle({id:n,style:c}){if(n in this.styles)throw new Error(`Style "${n}" already exists`);this.styles[n]=c}addLayer(n){if(n.layer.id in this.layers)throw new Error(`Layer "${n.layer.id}" already exists`);if(!(n.styleId in this.styles))throw new Error(`Style "${n.styleId}" does not exist`);this.layers[n.layer.id]=n}getLayer(n){return this.layers[n]}showLayer(n){var c;const f=this.layers[n];if(f==null)throw new Error(`Layer "${n}" does not exist`);(c=this.abortController)===null||c===void 0||c.abort();const _=this.activeLayerId==null;if(this.activeLayerId=n,this.maplibregl.getLayer(n)!=null)return;for(const I of Object.keys(this.layers))this.hideLayer(I);let w;this.maplibregl.getZoom()<f.zoomLevels.min?w=f.zoomLevels.min:this.maplibregl.getZoom()>f.zoomLevels.max&&(w=f.zoomLevels.max),w!=null?(this.isZoomingAfterShowingLayer=!0,this.maplibregl.zoomTo(w,{duration:500},{targetZoom:w})):this.setMinMaxZoom({min:f.zoomLevels.min,max:f.zoomLevels.max}),(_===!0||f.resetWhenShown)&&(f.bounds?this.maplibregl.fitBounds([f.bounds.west,f.bounds.south,f.bounds.east,f.bounds.north]):(this.maplibregl.setZoom(f.zoomLevels.initial),this.center&&this.maplibregl.setCenter(this.center))),f.pin!=="none"&&f.pin!=="dynamic-secondary-without-primary"&&this.center!=null?this.showPrimaryPin(this.center):this.hidePrimaryPin(),this.hideSecondaryPin(),this.activeStyleId===f.styleId?this.maplibregl.addLayer(f.layer,f.renderBeforeId):this.setStyle(f.styleId)}hideLayer(n){if(this.layers[n]==null)throw new Error(`Layer "${n}" does not exist`);this.maplibregl.getLayer(n)!=null&&this.maplibregl.removeLayer(n)}setStyle(n){const c=this.styles[n];if(c==null)throw new Error(`Style "${n}" does not exist`);this.activeStyleId=n,this.maplibregl.setStyle(c),this.checkIsStyleLoaded()}isWithinPin(n,c){if(n!=="dynamic-secondary-with-static-primary")return!1;const f=this.maplibregl.getCanvas().getBoundingClientRect(),_=f.x+c.x,w=f.y+c.y,I=this.primaryPin.getElement().getBoundingClientRect();return _>=I.left&&_<=I.right&&w>=I.top&&w<=I.bottom}fetchSearchByPosition({position:n,signal:c}){var f;return di(this,void 0,void 0,function*(){const _=`/api/v0/locations/search?language=${this.localeCode}&lat=${n.lat}&lon=${n.lon}&accuracy=1000`,w=yield fetch(_,{signal:c});if(w.ok===!1)throw new Error("Unable to fetch locations by position");const I=yield w.json(),l=(f=I._embedded)===null||f===void 0?void 0:f.location;return l??[]})}fetchLocation({locationId:n,signal:c}){return di(this,void 0,void 0,function*(){const f=`/api/v0/locations/${n}?language=${this.localeCode}`,_=yield fetch(f,{signal:c});if(_.ok===!1)throw new Error("Unable to fetch locations by position");return yield _.json()})}createLocationDataFromPromise({positionWrapped:n,locations:c,featureLocationId:f}){return di(this,void 0,void 0,function*(){const _=yield c;if(this.abortController=this.abortController!=null?this.abortController:new AbortController,_==null||_.length===0){if(this.aborted===!1){const D=yield this.fetchLocation({locationId:Op({position:n,type:"locationId"}),signal:this.abortController.signal}).catch(B=>{B.name!=="AbortError"&&this.dispatchEvent({type:"map:fetch-error",message:"Failed to fetch"})});return D==null?{currentLocation:void 0,locationsNearby:[]}:{currentLocation:D,locationsNearby:[]}}return{currentLocation:void 0,locationsNearby:[]}}let w,I=_.map(D=>Object.assign(Object.assign({},D),{distanceInMeters:df(D.position,n)}));I.sort((D,B)=>D.distanceInMeters-B.distanceInMeters);const l=I.findIndex(D=>D.id===f);return l>-1&&(w=I[l]),w!=null&&w.distanceInMeters<=500?(I.splice(l,1),I=I.splice(0,3),{currentLocation:w,locationsNearby:I}):(I[0].distanceInMeters<=500?(w=I[0],I=I.slice(1,4)):(w=yield this.fetchLocation({locationId:Op({position:n,type:"locationId"}),signal:this.abortController.signal}).catch(D=>{D.name!=="AbortError"&&this.dispatchEvent({type:"map:fetch-error",message:"Failed to fetch"})}),I=I.slice(0,3)),w==null?{currentLocation:void 0,locationsNearby:I}:{currentLocation:w,locationsNearby:I})})}setUnits(n){this.units=n,this.dispatchEvent({type:"map:units",units:n}),this.maplibregl.triggerRepaint()}showPrimaryPin(n){this.primaryPin.setLngLat(n),this.primaryPin.addTo(this.maplibregl)}hidePrimaryPin(){this.primaryPin.remove()}getPrimaryPin(){return this.primaryPin}showSecondaryPin(n){this.secondaryPin.setLngLat(n),this.secondaryPin.getElement().style.visibility="visible",this.secondaryPin.addTo(this.maplibregl)}hideSecondaryPin(){this.secondaryPin.getElement().style.visibility="hidden"}getSecondaryPin(){return this.secondaryPin}}var d0="Basic preview",p0={"openmaptiles:version":"3.x","maputnik:renderer":"mbgljs"},m0={hillshade:{type:"vector",url:"https://tiles.yr.no/data/hillshade_world_v1_z01-12.json"},worldmap:{type:"vector",url:"https://tiles.yr.no/data/planet_v1_yr.json"},name_overrides:{type:"vector",url:"https://tiles.yr.no/data/country_label_overrides.json"},natural_earth_boundaries:{type:"vector",url:"https://tiles.yr.no/data/natural_earth_boundary_lines.json"},custom_borders:{type:"vector",url:"https://tiles.yr.no/data/custom_borders.json"},sme_names:{type:"vector",url:"https://tiles.yr.no/data/sme_names.json"}},f0="https://tiles.yr.no/styles/basic/sprite",g0="https://tiles.yr.no/fonts/{fontstack}/{range}.pbf",y0=[{id:"background",type:"background",filter:["all",["!=","class","ocean"]],layout:{visibility:"visible"},paint:{"background-color":"#FFFCF6"}},{id:"landuse",type:"fill",source:"worldmap","source-layer":"landuse",minzoom:0,paint:{"fill-color":"#F7D9CA","fill-opacity":.25}},{id:"landcover",type:"fill",source:"worldmap","source-layer":"landcover",paint:{"fill-color":"#D6EAD6","fill-opacity":.2}},{id:"landcover wetland",type:"fill",source:"worldmap","source-layer":"landcover",filter:["all",["==","class","wetland"]],layout:{visibility:"none"},paint:{"fill-color":"rgba(125, 125, 125, 1)","fill-opacity":.5,"fill-translate":[0,0]}},{id:"landcover ice",type:"fill",source:"worldmap","source-layer":"landcover",filter:["all",["==","class","ice"]],paint:{"fill-color":"rgba(255, 255, 255, 1)","fill-opacity":1}},{id:"hillshade_50",type:"fill",source:"hillshade","source-layer":"layer_50",layout:{visibility:"visible"},paint:{"fill-color":"#000","fill-opacity":.04}},{id:"hillshade_100",type:"fill",source:"hillshade","source-layer":"layer_100",layout:{visibility:"none"},paint:{"fill-color":"#000","fill-opacity":.04}},{id:"hillshade_150",type:"fill",source:"hillshade","source-layer":"layer_150",paint:{"fill-color":"#000","fill-opacity":.04}},{id:"waterway",type:"line",source:"worldmap","source-layer":"waterway",layout:{visibility:"visible"},paint:{"line-color":"rgba(216, 219, 230, 1)"}},{id:"water",type:"fill",source:"worldmap","source-layer":"water",layout:{visibility:"visible"},paint:{"fill-color":"#D8DBE6","fill-antialias":!1}},{id:"water contour",type:"line",source:"worldmap","source-layer":"water",filter:["all",["==","class","ocean"]],layout:{visibility:"visible","line-cap":"square","line-join":"bevel","line-miter-limit":0},paint:{"line-color":{stops:[[6,"rgba(136, 169, 188, 1)"],[10,"rgba(101, 122, 133, 1)"]]},"line-translate-anchor":"viewport","line-opacity":1,"line-width":{stops:[[6,1],[10,1.2]]}}},{id:"transport-name",type:"symbol",source:"worldmap","source-layer":"transportation_name",minzoom:11,layout:{"text-font":["NRK Sans Medium"],visibility:"none","text-field":"{name:latin}","text-ignore-placement":!1,"text-pitch-alignment":"auto","text-rotation-alignment":"auto","text-transform":"none","text-keep-upright":!1,"text-allow-overlap":!1,"symbol-placement":"line-center","icon-rotation-alignment":"auto","symbol-z-order":"auto","text-size":9,"text-anchor":"center"},paint:{"text-color":"#56616C"}},{id:"transport motorway",type:"line",source:"worldmap","source-layer":"transportation",minzoom:7,filter:["any",["==","class","motorway"],["==","class","motorway_construction"],["==","class","trunk"]],layout:{visibility:"visible"},paint:{"line-color":"rgba(209, 209, 194, 1)","line-width":{stops:[[6,2],[20,3]]},"line-opacity":.5}},{id:"transport motorway-copy",type:"line",source:"worldmap","source-layer":"transportation",minzoom:7,filter:["any",["==","class","primary"],["==","class","secondary"]],layout:{visibility:"visible"},paint:{"line-color":"#D1D1C2","line-width":{stops:[[6,1],[20,2]]},"line-opacity":.5}},{id:"lake-fill",type:"fill",source:"worldmap","source-layer":"water",filter:["all",["==","class","lake"]],paint:{"fill-color":"rgba(255, 255, 255, 1)","fill-opacity":.1}},{id:"admin_border",type:"line",source:"worldmap","source-layer":"boundary",minzoom:5,filter:["all",["<",["get","maritime"],1],["==",["get","admin_level"],2],["!=",["get","disputed_name"],"\u0627\u0644\u062C\u062F\u0627\u0631\u0627\u0644\u0623\u0645\u0646\u064A\u0627\u0644\u0645\u063A\u0631\u0628\u064A"],["<",["+",["match",["get","adm0_r"],"MAR",1,0],["match",["get","disputed"],1,1,0]],2]],paint:{"line-color":{stops:[[6,"rgba(211, 211, 211, 1)"],[10,"rgba(138, 138, 138, 1)"]]},"line-width":{stops:[[2,.2],[10,5]]}}},{id:"admin_border-dotted",type:"line",source:"worldmap","source-layer":"boundary",filter:["all",["<",["get","maritime"],1],["==",["get","admin_level"],2]],layout:{visibility:"visible"},paint:{"line-color":"rgba(255, 255, 255, 1)","line-width":{stops:[[3,0],[10,1]]},"line-dasharray":[2,3]}},{id:"natural_earth_boundaries",type:"line",source:"natural_earth_boundaries","source-layer":"natural_earth_boundary_lines",maxzoom:5,layout:{visibility:"visible"},paint:{"line-color":{stops:[[6,"rgba(211, 211, 211, 1)"],[10,"rgba(138, 138, 138, 1)"]]},"line-width":{stops:[[2,.2],[10,5]]}}},{id:"custom_borders",type:"line",source:"custom_borders","source-layer":"custom_borders",paint:{"line-color":{stops:[[6,"rgba(211, 211, 211, 1)"],[10,"rgba(138, 138, 138, 1)"]]},"line-width":{stops:[[2,.2],[10,5]]}}}],_0="basic-preview",x0={version:8,name:d0,metadata:p0,sources:m0,sprite:f0,glyphs:g0,layers:y0,id:_0},v0="Basic preview",b0={"openmaptiles:version":"3.x","maputnik:renderer":"mbgljs"},w0={hillshade:{type:"vector",url:"https://tiles.yr.no/data/hillshade_world_v1_z01-12.json"},worldmap:{type:"vector",url:"https://tiles.yr.no/data/planet_v1_yr.json"},name_overrides:{type:"vector",url:"https://tiles.yr.no/data/country_label_overrides.json"},natural_earth_boundaries:{type:"vector",url:"https://tiles.yr.no/data/natural_earth_boundary_lines.json"},custom_borders:{type:"vector",url:"https://tiles.yr.no/data/custom_borders.json"},sme_names:{type:"vector",url:"https://tiles.yr.no/data/sme_names.json"}},S0="https://tiles.yr.no/styles/basic/sprite",T0="https://tiles.yr.no/fonts/{fontstack}/{range}.pbf",C0=[{id:"background",type:"background",filter:["all",["!=","class","ocean"]],layout:{visibility:"visible"},paint:{"background-color":"#FFFCF6"}},{id:"landuse",type:"fill",source:"worldmap","source-layer":"landuse",minzoom:0,paint:{"fill-color":"#F7D9CA","fill-opacity":.25}},{id:"landcover",type:"fill",source:"worldmap","source-layer":"landcover",paint:{"fill-color":"#D6EAD6","fill-opacity":.2}},{id:"landcover wetland",type:"fill",source:"worldmap","source-layer":"landcover",filter:["all",["==","class","wetland"]],layout:{visibility:"none"},paint:{"fill-color":"rgba(125, 125, 125, 1)","fill-opacity":.5,"fill-translate":[0,0]}},{id:"landcover ice",type:"fill",source:"worldmap","source-layer":"landcover",filter:["all",["==","class","ice"]],paint:{"fill-color":"rgba(255, 255, 255, 1)","fill-opacity":1}},{id:"hillshade_50",type:"fill",source:"hillshade","source-layer":"layer_50",layout:{visibility:"visible"},paint:{"fill-color":"#000","fill-opacity":.04}},{id:"hillshade_100",type:"fill",source:"hillshade","source-layer":"layer_100",layout:{visibility:"none"},paint:{"fill-color":"#000","fill-opacity":.04}},{id:"hillshade_150",type:"fill",source:"hillshade","source-layer":"layer_150",paint:{"fill-color":"#000","fill-opacity":.04}},{id:"waterway",type:"line",source:"worldmap","source-layer":"waterway",layout:{visibility:"visible"},paint:{"line-color":"rgba(216, 219, 230, 1)"}},{id:"water",type:"fill",source:"worldmap","source-layer":"water",layout:{visibility:"visible"},paint:{"fill-color":"#D8DBE6","fill-antialias":!1}},{id:"water contour",type:"line",source:"worldmap","source-layer":"water",filter:["all",["==","class","ocean"]],layout:{visibility:"visible","line-cap":"square","line-join":"bevel","line-miter-limit":0},paint:{"line-color":{stops:[[6,"rgba(136, 169, 188, 1)"],[10,"rgba(101, 122, 133, 1)"]]},"line-translate-anchor":"viewport","line-opacity":1,"line-width":{stops:[[6,1],[10,1.2]]}}},{id:"transport-name",type:"symbol",source:"worldmap","source-layer":"transportation_name",minzoom:11,layout:{"text-font":["NRK Sans Medium"],visibility:"none","text-field":"{name:latin}","text-ignore-placement":!1,"text-pitch-alignment":"auto","text-rotation-alignment":"auto","text-transform":"none","text-keep-upright":!1,"text-allow-overlap":!1,"symbol-placement":"line-center","icon-rotation-alignment":"auto","symbol-z-order":"auto","text-size":9,"text-anchor":"center"},paint:{"text-color":"#56616C"}},{id:"transport motorway",type:"line",source:"worldmap","source-layer":"transportation",minzoom:7,filter:["any",["==","class","motorway"],["==","class","motorway_construction"],["==","class","trunk"]],layout:{visibility:"visible"},paint:{"line-color":"rgba(209, 209, 194, 1)","line-width":{stops:[[6,2],[20,3]]},"line-opacity":.5}},{id:"transport motorway-copy",type:"line",source:"worldmap","source-layer":"transportation",minzoom:7,filter:["any",["==","class","primary"],["==","class","secondary"]],layout:{visibility:"visible"},paint:{"line-color":"#D1D1C2","line-width":{stops:[[6,1],[20,2]]},"line-opacity":.5}},{id:"lake-fill",type:"fill",source:"worldmap","source-layer":"water",filter:["all",["==","class","lake"]],paint:{"fill-color":"rgba(255, 255, 255, 1)","fill-opacity":.1}},{id:"admin_border",type:"line",source:"worldmap","source-layer":"boundary",minzoom:5,filter:["all",["<",["get","maritime"],1],["==",["get","admin_level"],2],["!=",["get","disputed_name"],"\u0627\u0644\u062C\u062F\u0627\u0631\u0627\u0644\u0623\u0645\u0646\u064A\u0627\u0644\u0645\u063A\u0631\u0628\u064A"],["<",["+",["match",["get","adm0_r"],"MAR",1,0],["match",["get","disputed"],1,1,0]],2]],paint:{"line-color":{stops:[[6,"rgba(211, 211, 211, 1)"],[10,"rgba(138, 138, 138, 1)"]]},"line-width":{stops:[[2,.2],[10,5]]}}},{id:"admin_border-dotted",type:"line",source:"worldmap","source-layer":"boundary",filter:["all",["<",["get","maritime"],1],["==",["get","admin_level"],2]],layout:{visibility:"visible"},paint:{"line-color":"rgba(255, 255, 255, 1)","line-width":{stops:[[3,0],[10,1]]},"line-dasharray":[2,3]}},{id:"natural_earth_boundaries",type:"line",source:"natural_earth_boundaries","source-layer":"natural_earth_boundary_lines",maxzoom:5,layout:{visibility:"visible"},paint:{"line-color":{stops:[[6,"rgba(211, 211, 211, 1)"],[10,"rgba(138, 138, 138, 1)"]]},"line-width":{stops:[[2,.2],[10,5]]}}},{id:"custom_borders",type:"line",source:"custom_borders","source-layer":"custom_borders",paint:{"line-color":{stops:[[6,"rgba(211, 211, 211, 1)"],[10,"rgba(138, 138, 138, 1)"]]},"line-width":{stops:[[2,.2],[10,5]]}}},{id:"label_city",type:"symbol",source:"worldmap","source-layer":"place",minzoom:4,filter:["any",["==","class","city"],["==","class","town"]],layout:{"text-field":"{name:latin}",visibility:"visible","text-font":["NRK Sans Medium"],"icon-anchor":"bottom","icon-size":.3,"symbol-z-order":"auto","text-anchor":"top","text-justify":"auto","text-size":14,"text-letter-spacing":.04,"icon-image":"icon-circle-map"},paint:{"text-color":"#21292B","icon-translate":[0,0],"icon-color":"#56616C","icon-halo-width":1.5,"text-halo-color":"rgba(255, 255, 255, 0.8)","text-halo-width":1.5,"text-halo-blur":0,"text-translate-anchor":"map","text-opacity":1,"icon-halo-color":"rgba(255, 255, 255, 0.8)"}},{id:"label_city_sme",type:"symbol",source:"sme_names","source-layer":"cities_sme",minzoom:4,filter:["any",["==","class","city"],["==","class","town"]],layout:{"text-field":"{name:sme}",visibility:"visible","text-font":["NRK Sans Medium"],"icon-image":"circle_11","icon-anchor":"bottom","icon-size":.5,"symbol-z-order":"auto","text-anchor":"top","text-justify":"auto","text-size":14,"text-letter-spacing":.04},paint:{"text-color":"#21292B","icon-translate":[0,0],"icon-color":"rgba(167, 165, 165, 1)","icon-halo-width":1.5,"icon-opacity":.8,"text-opacity":1,"text-halo-width":1.5,"text-halo-color":"rgba(255, 255, 255, 0.8)"}},{id:"label_country",type:"symbol",source:"worldmap","source-layer":"place",minzoom:3,maxzoom:6,filter:["any",["==","class","country"]],layout:{"text-field":"{name:no}","text-font":["NRK Sans Medium"],"text-size":{stops:[[3,12],[5,18]]},"text-letter-spacing":.05,visibility:"visible"},paint:{"text-color":"#21292B","icon-opacity":.8,"icon-halo-width":50,"icon-halo-color":"#fff","icon-color":"#21292B","text-opacity":1,"text-halo-width":1.5,"text-halo-color":"rgba(255, 255, 255, 0.8)"}},{id:"label_country_override",type:"symbol",source:"name_overrides","source-layer":"country_label_overrides",minzoom:3,maxzoom:6,filter:["any",["==","class","country"]],layout:{"text-field":"{name:no_override}","text-font":["NRK Sans Medium"],"text-size":{stops:[[3,12],[5,18]]},"text-letter-spacing":.05,visibility:"visible"},paint:{"text-color":"#21292B","icon-opacity":.8,"icon-halo-width":50,"icon-halo-color":"#fff","icon-color":"#21292B","text-opacity":1,"text-halo-width":1.5,"text-halo-color":"rgba(255, 255, 255, 0.8)"}},{id:"label_country_sme",type:"symbol",source:"sme_names","source-layer":"countries_sme",minzoom:3,maxzoom:6,filter:["any",["==","class","country"]],layout:{"text-field":"{name:sme}","text-font":["NRK Sans Medium"],"text-size":{stops:[[3,12],[5,18]]},"text-letter-spacing":.05,visibility:"visible"},paint:{"text-color":"#21292B","icon-opacity":.8,"icon-halo-width":50,"icon-halo-color":"#fff","icon-color":"#21292B","text-opacity":1,"text-halo-width":1.5,"text-halo-color":"rgba(255, 255, 255, 0.8)","text-halo-blur":1}},{id:"poi",type:"symbol",source:"worldmap","source-layer":"mountain_peak",minzoom:8,filter:["all",[">","ele",1700],["has","name"]],layout:{"text-field":"{name:latin}","text-size":11,"text-font":["NRK Sans Medium Italic"],"icon-anchor":"bottom","text-anchor":"top","symbol-z-order":"auto","symbol-placement":"point","text-letter-spacing":.03,visibility:"visible","icon-image":"icon-mountain-map","icon-size":.8},paint:{"text-color":"#21292B","text-halo-color":"rgba(255, 255, 255, 0.8)","text-halo-width":1,"icon-color":"#56616C","icon-halo-color":"rgba(255, 255, 255, 0.8)","text-opacity":1,"icon-halo-width":1.5}},{id:"label_mountain_sme",type:"symbol",source:"sme_names","source-layer":"mountains_sme",minzoom:8,filter:["all",[">","elevation",1700]],layout:{"text-field":"{name:sme}","text-size":11,"text-font":["NRK Sans Medium Italic"],"icon-anchor":"bottom","text-anchor":"top","symbol-z-order":"auto","symbol-placement":"point","text-letter-spacing":.03,visibility:"visible","icon-image":"icon-mountain-map","icon-size":.8},paint:{"text-color":"#21292B","text-halo-color":"rgba(255, 255, 255, 0.8)","text-halo-width":1,"icon-color":"#56616C","icon-halo-color":"rgba(255, 255, 255, 0.8)","text-opacity":1,"icon-halo-width":1.5}},{id:"label_village",type:"symbol",source:"worldmap","source-layer":"place",minzoom:7,filter:["any",["==","class","village"],["==","class","hamlet"],["==","class","suburb"]],layout:{"text-field":"{name:latin}",visibility:"visible","text-font":["NRK Sans Bold"],"text-transform":"uppercase","text-letter-spacing":.2,"symbol-placement":"point","symbol-z-order":"auto","icon-offset":[0,-2],"icon-size":.3,"icon-anchor":"bottom","icon-allow-overlap":!1,"icon-ignore-placement":!1,"text-anchor":"top","text-size":9,"text-line-height":1.2,"text-allow-overlap":!1,"text-ignore-placement":!1,"text-pitch-alignment":"auto","text-padding":2,"icon-image":"icon-circle-map"},paint:{"text-color":"#21292B","text-translate-anchor":"map","icon-color":"#56616C","icon-translate-anchor":"map","icon-halo-width":1.5,"text-halo-color":"rgba(255, 255, 255, 0.8)","text-opacity":1,"text-halo-blur":0,"text-halo-width":1.5,"icon-halo-color":"rgba(255, 255, 255, 0.8)"}},{id:"label_village_sme",type:"symbol",source:"sme_names","source-layer":"villages_sme",minzoom:7,filter:["any",["==","class","village"],["==","class","hamlet"],["==","class","suburb"]],layout:{"text-field":"{name:sme}",visibility:"visible","text-font":["NRK Sans Bold"],"text-transform":"uppercase","text-letter-spacing":.2,"symbol-placement":"point","symbol-z-order":"auto","icon-offset":[0,-2],"icon-image":"circle_11","icon-size":.4,"icon-anchor":"bottom","icon-allow-overlap":!1,"icon-ignore-placement":!1,"text-anchor":"top","text-size":9},paint:{"text-color":"#21292B","text-translate-anchor":"map","icon-color":"#56616C","icon-translate-anchor":"map","icon-halo-width":2,"text-halo-color":"rgba(255, 255, 255, 0.8)","text-opacity":1,"text-halo-width":1.5}},{id:"water-name",type:"symbol",source:"worldmap","source-layer":"water_name",minzoom:3,layout:{"text-field":"{name:latin}","text-font":["NRK Sans Medium Italic"],"text-size":{stops:[[3,10],[5,12]]},"text-letter-spacing":.05,"text-pitch-alignment":"auto","text-rotation-alignment":"auto","text-keep-upright":!0,"symbol-avoid-edges":!1,"symbol-z-order":"auto","text-optional":!1,"text-writing-mode":[],"text-anchor":"center","text-ignore-placement":!1,"symbol-placement":"line-center","text-variable-anchor":[],visibility:"visible"},paint:{"text-color":"rgba(64, 104, 220, 1)","text-halo-color":"rgba(255, 253, 253, 1)","text-halo-width":0,"text-opacity":.8}}],I0="basic-preview",E0={version:8,name:v0,metadata:b0,sources:w0,sprite:S0,glyphs:T0,layers:C0,id:I0},A0="Basic preview",P0={"openmaptiles:version":"3.x","maputnik:renderer":"mbgljs"},M0={hillshade:{type:"vector",url:"https://tiles.yr.no/data/hillshade_world_v1_z01-12.json"},worldmap:{type:"vector",url:"https://tiles.yr.no/data/planet_v1_yr.json"},name_overrides:{type:"vector",url:"https://tiles.yr.no/data/country_label_overrides.json"},natural_earth_boundaries:{type:"vector",url:"https://tiles.yr.no/data/natural_earth_boundary_lines.json"},custom_borders:{type:"vector",url:"https://tiles.yr.no/data/custom_borders.json"},sme_names:{type:"vector",url:"https://tiles.yr.no/data/sme_names.json"}},z0="https://tiles.yr.no/styles/basic/sprite",k0="https://tiles.yr.no/fonts/{fontstack}/{range}.pbf",L0=[{id:"background",type:"background",filter:["all",["!=","class","ocean"]],layout:{visibility:"visible"},paint:{"background-color":"#FFFCF6"}},{id:"landuse",type:"fill",source:"worldmap","source-layer":"landuse",minzoom:0,layout:{visibility:"none"},paint:{"fill-color":"#F7D9CA","fill-opacity":.25}},{id:"landcover",type:"fill",source:"worldmap","source-layer":"landcover",layout:{visibility:"none"},paint:{"fill-color":"#D6EAD6","fill-opacity":.2}},{id:"landcover wetland",type:"fill",source:"worldmap","source-layer":"landcover",filter:["all",["==","class","wetland"]],layout:{visibility:"none"},paint:{"fill-color":"rgba(125, 125, 125, 1)","fill-opacity":.5,"fill-translate":[0,0]}},{id:"landcover ice",type:"fill",source:"worldmap","source-layer":"landcover",filter:["all",["==","class","ice"]],layout:{visibility:"none"},paint:{"fill-color":"rgba(255, 255, 255, 1)","fill-opacity":1}},{id:"hillshade_50",type:"fill",source:"hillshade","source-layer":"layer_50",paint:{"fill-opacity":.04,"fill-color":"#000"}},{id:"hillshade_150",type:"fill",source:"hillshade","source-layer":"layer_150",paint:{"fill-opacity":.04,"fill-color":"#000"}},{id:"hillshade_100",type:"fill",source:"hillshade","source-layer":"layer_100",paint:{"fill-color":"#000","fill-opacity":.04}},{id:"water",type:"fill",source:"worldmap","source-layer":"water",filter:["all"],layout:{visibility:"visible"},paint:{"fill-color":"rgba(242, 242, 242, 1)","fill-outline-color":"rgba(179, 200, 229, 1)","fill-antialias":!1}},{id:"waterway",type:"line",source:"worldmap","source-layer":"waterway",layout:{visibility:"visible"},paint:{"line-color":"rgba(216, 219, 230, 1)"}},{id:"transport motorway-copy",type:"line",source:"worldmap","source-layer":"transportation",minzoom:7,filter:["any",["==","class","primary"],["==","class","secondary"]],layout:{visibility:"visible"},paint:{"line-color":"#D1D1C2","line-width":{stops:[[6,1],[20,2]]},"line-opacity":.5}},{id:"transport motorway",type:"line",source:"worldmap","source-layer":"transportation",minzoom:7,filter:["any",["==","class","motorway"],["==","class","motorway_construction"],["==","class","trunk"]],layout:{visibility:"visible"},paint:{"line-color":"rgba(209, 209, 194, 1)","line-width":{stops:[[6,2],[20,3]]},"line-opacity":.5}},{id:"transport-name",type:"symbol",source:"worldmap","source-layer":"transportation_name",minzoom:11,layout:{"text-font":["NRK Sans Medium"],visibility:"visible","text-field":"{name:latin}","text-ignore-placement":!1,"text-pitch-alignment":"auto","text-rotation-alignment":"auto","text-transform":"none","text-keep-upright":!1,"text-allow-overlap":!1,"symbol-placement":"line-center","icon-rotation-alignment":"auto","symbol-z-order":"auto","text-size":9,"text-anchor":"center"},paint:{"text-color":"#56616C"}},{id:"admin_border",type:"line",source:"worldmap","source-layer":"boundary",minzoom:5,filter:["all",["==",["get","admin_level"],2],["==",["get","maritime"],0],["!=",["get","disputed_name"],"\u0627\u0644\u062C\u062F\u0627\u0631\u0627\u0644\u0623\u0645\u0646\u064A\u0627\u0644\u0645\u063A\u0631\u0628\u064A"],["<",["+",["match",["get","adm0_r"],"MAR",1,0],["match",["get","disputed"],1,1,0]],2]],layout:{visibility:"visible"},paint:{"line-color":{stops:[[6,"rgba(211, 211, 211, 1)"],[10,"rgba(138, 138, 138, 1)"]]},"line-width":{stops:[[2,.4],[10,5]]}}},{id:"admin_border-dotted",type:"line",source:"worldmap","source-layer":"boundary",filter:["all",["<",["get","maritime"],1],["==",["get","admin_level"],2]],layout:{visibility:"visible"},paint:{"line-color":"rgba(255, 255, 255, 1)","line-width":{stops:[[3,0],[10,1]]},"line-dasharray":[2,3]}},{id:"natural_earth_boundaries",type:"line",source:"natural_earth_boundaries","source-layer":"natural_earth_boundary_lines",maxzoom:5,layout:{visibility:"visible"},paint:{"line-color":{stops:[[6,"rgba(211, 211, 211, 1)"],[10,"rgba(138, 138, 138, 1)"]]},"line-width":{stops:[[2,.4],[10,5]]}}},{id:"custom_borders",type:"line",source:"custom_borders","source-layer":"custom_borders",paint:{"line-color":{stops:[[6,"rgba(211, 211, 211, 1)"],[10,"rgba(138, 138, 138, 1)"]]},"line-width":{stops:[[2,.2],[10,5]]}}},{id:"water contour ocean",type:"line",source:"worldmap","source-layer":"water",filter:["all",["==","class","ocean"]],paint:{"line-color":"rgba(164, 164, 168, 1)","line-translate-anchor":"viewport","line-opacity":1,"line-width":1}},{id:"water contour",type:"line",source:"worldmap","source-layer":"water",filter:["all",["!=","class","ocean"],["==","class","lake"]],paint:{"line-color":"rgba(204, 204, 204, 1)","line-translate-anchor":"viewport","line-opacity":1,"line-width":1}},{id:"label_city",type:"symbol",source:"worldmap","source-layer":"place",minzoom:4,filter:["any",["==","class","city"],["==","class","town"]],layout:{"text-field":"{name:latin}",visibility:"visible","text-font":["NRK Sans Medium"],"icon-anchor":"bottom","icon-size":.3,"symbol-z-order":"auto","text-anchor":"top","text-justify":"auto","text-size":14,"text-letter-spacing":.04,"icon-image":"icon-circle-map"},paint:{"text-color":"#21292B","icon-translate":[0,0],"icon-color":"#56616C","icon-halo-width":1.5,"text-halo-color":"rgba(255, 255, 255, 0.8)","text-halo-width":1.5,"text-halo-blur":0,"text-translate-anchor":"map","text-opacity":1,"icon-halo-color":"rgba(255, 255, 255, 0.8)"}},{id:"label_city_sme",type:"symbol",source:"sme_names","source-layer":"cities_sme",minzoom:4,filter:["any",["==","class","city"],["==","class","town"]],layout:{"text-field":"{name:sme}",visibility:"visible","text-font":["NRK Sans Medium"],"icon-image":"circle_11","icon-anchor":"bottom","icon-size":.5,"symbol-z-order":"auto","text-anchor":"top","text-justify":"auto","text-size":14,"text-letter-spacing":.04},paint:{"text-color":"#21292B","icon-translate":[0,0],"icon-color":"rgba(167, 165, 165, 1)","icon-halo-width":1.5,"icon-opacity":.8,"text-opacity":1,"text-halo-width":1.5,"text-halo-color":"rgba(255, 255, 255, 0.8)"}},{id:"label_country",type:"symbol",source:"worldmap","source-layer":"place",minzoom:3,maxzoom:6,filter:["any",["==","class","country"]],layout:{"text-field":"{name:no}","text-font":["NRK Sans Medium"],"text-size":{stops:[[3,12],[5,18]]},"text-letter-spacing":.05,visibility:"visible"},paint:{"text-color":"#21292B","icon-opacity":.8,"icon-halo-width":50,"icon-halo-color":"#fff","icon-color":"#21292B","text-opacity":1,"text-halo-width":1.5,"text-halo-color":"rgba(255, 255, 255, 0.8)"}},{id:"label_country_override",type:"symbol",source:"name_overrides","source-layer":"country_label_overrides",minzoom:3,maxzoom:6,filter:["any",["==","class","country"]],layout:{"text-field":"{name:no_override}","text-font":["NRK Sans Medium"],"text-size":{stops:[[3,12],[5,18]]},"text-letter-spacing":.05,visibility:"visible"},paint:{"text-color":"#21292B","icon-opacity":.8,"icon-halo-width":50,"icon-halo-color":"#fff","icon-color":"#21292B","text-opacity":1,"text-halo-width":1.5,"text-halo-color":"rgba(255, 255, 255, 0.8)"}},{id:"label_country_sme",type:"symbol",source:"sme_names","source-layer":"countries_sme",minzoom:3,maxzoom:6,filter:["any",["==","class","country"]],layout:{"text-field":"{name:sme}","text-font":["NRK Sans Medium"],"text-size":{stops:[[3,12],[5,18]]},"text-letter-spacing":.05,visibility:"visible"},paint:{"text-color":"#21292B","icon-opacity":.8,"icon-halo-width":50,"icon-halo-color":"#fff","icon-color":"#21292B","text-opacity":1,"text-halo-width":1.5,"text-halo-color":"rgba(255, 255, 255, 0.8)","text-halo-blur":1}},{id:"poi",type:"symbol",source:"worldmap","source-layer":"mountain_peak",minzoom:8,filter:["all",[">","ele",1700],["has","name"]],layout:{"text-field":"{name:latin}","text-size":11,"text-font":["NRK Sans Medium Italic"],"icon-anchor":"bottom","text-anchor":"top","symbol-z-order":"auto","symbol-placement":"point","text-letter-spacing":.03,visibility:"visible","icon-size":.8,"icon-image":"icon-mountain-map"},paint:{"text-color":"#21292B","text-halo-color":"rgba(255, 255, 255, 0.8)","text-halo-width":1,"icon-color":"#56616C","icon-halo-color":"rgba(255, 255, 255, 0.8)","text-opacity":1,"icon-halo-width":1.5}},{id:"label_mountain_sme",type:"symbol",source:"sme_names","source-layer":"mountains_sme",minzoom:8,filter:["all",[">","elevation",1700]],layout:{"text-field":"{name:sme}","text-size":11,"text-font":["NRK Sans Medium Italic"],"icon-anchor":"bottom","text-anchor":"top","symbol-z-order":"auto","symbol-placement":"point","text-letter-spacing":.03,visibility:"visible","icon-image":"icon-mountain-map","icon-size":.8},paint:{"text-color":"#21292B","text-halo-color":"rgba(255, 255, 255, 0.8)","text-halo-width":1,"icon-color":"#56616C","icon-halo-color":"rgba(255, 255, 255, 0.8)","text-opacity":1,"icon-halo-width":1.5}},{id:"label_village",type:"symbol",source:"worldmap","source-layer":"place",minzoom:7,filter:["any",["==","class","village"],["==","class","hamlet"],["==","class","suburb"]],layout:{"text-field":"{name:latin}",visibility:"visible","text-font":["NRK Sans Bold"],"text-transform":"uppercase","text-letter-spacing":.2,"symbol-placement":"point","symbol-z-order":"auto","icon-offset":[0,-2],"icon-size":.3,"icon-anchor":"bottom","icon-allow-overlap":!1,"icon-ignore-placement":!1,"text-anchor":"top","text-size":9,"text-line-height":1.2,"text-allow-overlap":!1,"text-ignore-placement":!1,"text-pitch-alignment":"auto","text-padding":2,"icon-image":"icon-circle-map"},paint:{"text-color":"#21292B","text-translate-anchor":"map","icon-color":"#56616C","icon-translate-anchor":"map","icon-halo-width":1.5,"text-halo-color":"rgba(255, 255, 255, 0.8)","text-opacity":1,"text-halo-blur":0,"text-halo-width":1.5,"icon-halo-color":"rgba(255, 255, 255, 0.8)"}},{id:"label_village_sme",type:"symbol",source:"sme_names","source-layer":"villages_sme",minzoom:7,filter:["any",["==","class","village"],["==","class","hamlet"],["==","class","suburb"]],layout:{"text-field":"{name:sme}",visibility:"visible","text-font":["NRK Sans Bold"],"text-transform":"uppercase","text-letter-spacing":.2,"symbol-placement":"point","symbol-z-order":"auto","icon-offset":[0,-2],"icon-image":"circle_11","icon-size":.4,"icon-anchor":"bottom","icon-allow-overlap":!1,"icon-ignore-placement":!1,"text-anchor":"top","text-size":9},paint:{"text-color":"#21292B","text-translate-anchor":"map","icon-color":"#56616C","icon-translate-anchor":"map","icon-halo-width":2,"text-halo-color":"rgba(255, 255, 255, 0.8)","text-opacity":1,"text-halo-width":1.5}},{id:"water-name",type:"symbol",source:"worldmap","source-layer":"water_name",minzoom:3,layout:{"text-field":"{name:latin}","text-font":["NRK Sans Medium Italic"],"text-size":{stops:[[3,10],[5,12]]},"text-letter-spacing":.05,"text-pitch-alignment":"auto","text-rotation-alignment":"auto","text-keep-upright":!0,"symbol-avoid-edges":!1,"symbol-z-order":"auto","text-optional":!1,"text-writing-mode":[],"text-anchor":"center","text-ignore-placement":!1,"symbol-placement":"line-center","text-variable-anchor":[],visibility:"visible"},paint:{"text-color":"rgba(64, 104, 220, 1)","text-halo-color":"rgba(255, 253, 253, 1)","text-halo-width":0,"text-opacity":.8}}],D0="basic-preview",R0={version:8,name:A0,metadata:P0,sources:M0,sprite:z0,glyphs:k0,layers:L0,id:D0};function F0(a,n="light"){return{id:`default-${n}`,renderBeforeId:"admin_border",style:Gu({style:x0,languagePriority:a})}}function B0(a,n="light"){return{id:`default-with-name-${n}`,renderBeforeId:"water contour",style:Gu({style:E0,languagePriority:a})}}function O0(a){return{id:"heatmap-style",renderBeforeId:"label_city",style:Gu({style:R0,languagePriority:a})}}function Gu({style:a,languagePriority:n}){const c=["coalesce"];n.forEach(_=>c.push(["get","name:"+_]));let f=a.layers;return n.includes("sme")===!1&&(f=a.layers.filter(_=>_.id.includes("sme")===!1)),f.forEach(_=>{_.type==="symbol"&&_.layout!=null&&"text-field"in _.layout&&(_.layout["text-field"]=c)}),a.layers=[...f],a}function ho({width:a,height:n,pixelRatio:c}){const f=document.createElement("canvas");return On({canvas:f,width:a,height:n,pixelRatio:c}),f}function On({canvas:a,width:n,height:c,pixelRatio:f}){const _=f??1;a.width=n*_,a.height=c*_}function Un({canvas:a,pixelRatio:n,willReadFrequently:c}){const f=a.getContext("2d",{willReadFrequently:c});if(f==null)throw new Error("Unable to get context");return f.restore(),f.save(),n!=null&&f.scale(n,n),f}function fc({family:a,weight:n,size:c}){return`${n} ${c} ${a}`}function ou({context:a,text:n,font:c}){return a.font=c,a.measureText(n).width}function ff({canvas:a,backgroundColor:n="white",scale:c={min:.5,max:1}}){a.style.display="none",a.style.backgroundColor=n,a.style.transform=`translate(-50%, -50%) scale(${c.min})`,a.style.position="fixed",a.style.top="50%",a.style.left="50%";let f,_=!0,w=!1;function I(B){w=!0,f={x:a.offsetLeft,y:a.offsetTop,clientX:B.clientX,clientY:B.clientY}}function l(){f=void 0,w===!0&&(w=!1,_=!_,a.style.transform=_?`translate(-50%, -50%) scale(${c.min})`:`translate(-50%, -50%) scale(${c.max})`)}function D(B){if(w=!1,f!=null){const J=B.clientX-f.clientX,K=B.clientY-f.clientY;a.style.top=`${f.y+K}px`,a.style.left=`${f.x+J}px`}}return a.addEventListener("mousedown",I),document.body.addEventListener("mouseup",l),document.body.addEventListener("mousemove",D),document.body.appendChild(a),()=>{a.removeEventListener("mousedown",I),document.body.removeEventListener("mouseup",l),document.body.removeEventListener("mousemove",D),document.body.removeChild(a)}}function U0({north:a,south:n,east:c,west:f}){const _=Ur.exports.MercatorCoordinate.fromLngLat({lat:a,lon:f}),w=Ur.exports.MercatorCoordinate.fromLngLat({lat:n,lon:c});return{minX:_.x,maxX:w.x,minY:_.y,maxY:w.y}}function Zu({top:a,right:n,bottom:c,left:f}){return new Float32Array([f,c,f,a,n,a,f,c,n,a,n,c])}function Hu({map:a,padding:n}){const c=a.getBounds(),f=a.project(c.getNorthEast()),_=a.project(c.getSouthWest());return c.setNorthEast(a.unproject([f.x-n,f.y+n])),c.setSouthWest(a.unproject([_.x+n,_.y-n])),c}function Up({map:a,padding:n=0}){const c=Hu({map:a,padding:n}),f=Ur.exports.MercatorCoordinate.fromLngLat(c.getNorthWest()),_=Ur.exports.MercatorCoordinate.fromLngLat(c.getSouthEast());return{top:f.y,right:_.x,bottom:_.y,left:f.x}}function Sr({map:a,padding:n=0,withPixelRatio:c=!0}){const f=a.getPixelRatio(),_=n*f,w=a.getCanvas(),I=w.width-2*_,l=w.height-2*_;return c?{width:I,height:l}:{width:Math.round(I/f),height:Math.round(l/f)}}var $0=Math.PI/180,N0=180/Math.PI;function gf(a){var n=$p(a[0]+1,a[2]),c=$p(a[0],a[2]),f=Np(a[1]+1,a[2]),_=Np(a[1],a[2]);return[c,f,n,_]}function V0(a){var n=gf(a),c={type:"Polygon",coordinates:[[[n[0],n[3]],[n[0],n[1]],[n[2],n[1]],[n[2],n[3]],[n[0],n[3]]]]};return c}function $p(a,n){return a/Math.pow(2,n)*360-180}function Np(a,n){var c=Math.PI-2*Math.PI*a/Math.pow(2,n);return N0*Math.atan(.5*(Math.exp(c)-Math.exp(-c)))}function Au(a,n,c){var f=wf(a,n,c);return f[0]=Math.floor(f[0]),f[1]=Math.floor(f[1]),f}function yf(a){return[[a[0]*2,a[1]*2,a[2]+1],[a[0]*2+1,a[1]*2,a[2]+1],[a[0]*2+1,a[1]*2+1,a[2]+1],[a[0]*2,a[1]*2+1,a[2]+1]]}function _f(a){return[a[0]>>1,a[1]>>1,a[2]-1]}function xf(a){return yf(_f(a))}function G0(a,n){for(var c=xf(a),f=0;f<c.length;f++)if(!vf(n,c[f]))return!1;return!0}function vf(a,n){for(var c=0;c<a.length;c++)if(bf(a[c],n))return!0;return!1}function bf(a,n){return a[0]===n[0]&&a[1]===n[1]&&a[2]===n[2]}function Z0(a){for(var n="",c=a[2];c>0;c--){var f=0,_=1<<c-1;(a[0]&_)!==0&&f++,(a[1]&_)!==0&&(f+=2),n+=f.toString()}return n}function H0(a){for(var n=0,c=0,f=a.length,_=f;_>0;_--){var w=1<<_-1,I=+a[f-_];I===1&&(n|=w),I===2&&(c|=w),I===3&&(n|=w,c|=w)}return[n,c,f]}function j0(a){var n=Au(a[0],a[1],32),c=Au(a[2],a[3],32),f=[n[0],n[1],c[0],c[1]],_=q0(f);if(_===0)return[0,0,0];var w=f[0]>>>32-_,I=f[1]>>>32-_;return[w,I,_]}function q0(a){for(var n=28,c=0;c<n;c++){var f=1<<32-(c+1);if((a[0]&f)!==(a[2]&f)||(a[1]&f)!==(a[3]&f))return c}return n}function wf(a,n,c){var f=Math.sin(n*$0),_=Math.pow(2,c),w=_*(a/360+.5),I=_*(.5-.25*Math.log((1+f)/(1-f))/Math.PI);return w=w%_,w<0&&(w=w+_),[w,I,c]}var Sf={tileToGeoJSON:V0,tileToBBOX:gf,getChildren:yf,getParent:_f,getSiblings:xf,hasTile:vf,hasSiblings:G0,tilesEqual:bf,tileToQuadkey:Z0,quadkeyToTile:H0,pointToTile:Au,bboxToTile:j0,pointToTileFraction:wf};function W0(a,n,c){return a===a&&(c!==void 0&&(a=a<=c?a:c),n!==void 0&&(a=a>=n?a:n)),a}var X0=W0,Y0=/\s/;function K0(a){for(var n=a.length;n--&&Y0.test(a.charAt(n)););return n}var J0=K0,Q0=J0,ex=/^\s+/;function tx(a){return a&&a.slice(0,Q0(a)+1).replace(ex,"")}var ix=tx;function rx(a){var n=typeof a;return a!=null&&(n=="object"||n=="function")}var ol=rx,nx=typeof Qs=="object"&&Qs&&Qs.Object===Object&&Qs,Tf=nx,ox=Tf,ax=typeof self=="object"&&self&&self.Object===Object&&self,sx=ox||ax||Function("return this")(),ln=sx,lx=ln,cx=lx.Symbol,ju=cx,Vp=ju,Cf=Object.prototype,hx=Cf.hasOwnProperty,ux=Cf.toString,Xs=Vp?Vp.toStringTag:void 0;function dx(a){var n=hx.call(a,Xs),c=a[Xs];try{a[Xs]=void 0;var f=!0}catch{}var _=ux.call(a);return f&&(n?a[Xs]=c:delete a[Xs]),_}var px=dx,mx=Object.prototype,fx=mx.toString;function gx(a){return fx.call(a)}var yx=gx,Gp=ju,_x=px,xx=yx,vx="[object Null]",bx="[object Undefined]",Zp=Gp?Gp.toStringTag:void 0;function wx(a){return a==null?a===void 0?bx:vx:Zp&&Zp in Object(a)?_x(a):xx(a)}var al=wx;function Sx(a){return a!=null&&typeof a=="object"}var sl=Sx,Tx=al,Cx=sl,Ix="[object Symbol]";function Ex(a){return typeof a=="symbol"||Cx(a)&&Tx(a)==Ix}var Ax=Ex,Px=ix,Hp=ol,Mx=Ax,jp=0/0,zx=/^[-+]0x[0-9a-f]+$/i,kx=/^0b[01]+$/i,Lx=/^0o[0-7]+$/i,Dx=parseInt;function Rx(a){if(typeof a=="number")return a;if(Mx(a))return jp;if(Hp(a)){var n=typeof a.valueOf=="function"?a.valueOf():a;a=Hp(n)?n+"":n}if(typeof a!="string")return a===0?a:+a;a=Px(a);var c=kx.test(a);return c||Lx.test(a)?Dx(a.slice(2),c?2:8):zx.test(a)?jp:+a}var If=Rx,Fx=X0,au=If;function Bx(a,n,c){return c===void 0&&(c=n,n=void 0),c!==void 0&&(c=au(c),c=c===c?c:0),n!==void 0&&(n=au(n),n=n===n?n:0),Fx(au(a),n,c)}var Ox=Bx,Ux=Ox;function Pu({map:a,tileZ:n,bounds:c,mapWidth:f,shouldFetchData:_=!0}){n==null&&(n=Ef({map:a}));const w=Math.pow(2,n),I=c.getNorthWest(),l=c.getSouthEast(),D=qp({position:su(I),tileZ:n}),B=qp({position:su(l),tileZ:n}),J=qu({position:su(I),tileZ:n}),K=a.project({lat:0,lon:-180}),Z=a.project({lat:0,lon:180}),we=a.project({lat:c.getNorthWest().lat,lon:c.getNorthWest().lng}),be=a.project({lat:c.getSouthEast().lat,lon:c.getSouthEast().lng}),Ae=f??be.x-we.x,Fe=Math.ceil(Z.x-K.x)/w,$e=Ae-Fe*(1-(J.x-D.x)),Ve=Math.ceil($e/Fe)+1;let Ge=D.x,lt=B.x;const rt=D.y,Xe=B.y,xt=[],At=[];for(let Oi=rt;Oi<=Xe;Oi++)for(let Wt=0;Wt<Ve;Wt++){const Bt=$x(D.x+Wt,n);Bt<Ge&&(Ge=Bt),Bt>lt&&(lt=Bt);const Ht=Bt,Ui=n,Ye=`${Ht}/${Oi}/${Ui}`;xt.includes(Ye)===!1&&(At.push({x:Ht,y:Oi,z:Ui,shouldFetchData:_}),xt.push(Ye))}const pi=Xe-rt+1,Bi=At.length/pi;return{tiles:At,minX:Ge,maxX:lt,minY:rt,maxY:Xe,horizontalTileCount:Bi,size:{width:lt-Ge+1,height:Xe-rt+1},mercatorBounds:Af({minX:At[0].x,maxX:At[0].x+Bi,minY:rt,maxY:Xe+1,tileZ:n}),tileBounds:{topLeft:At[0],bottomRight:At[At.length-1]}}}function Ef({map:a}){return Math.floor(a.getZoom())}function qp({position:a,tileZ:n}){const[c,f,_]=Sf.pointToTile(a.lon,Pf(a.lat),n);return{x:c,y:f,z:_}}function qu({position:a,tileZ:n}){const[c,f,_]=Sf.pointToTileFraction(a.lon,Pf(a.lat),n);return{x:c,y:f,z:_}}function $x(a,n){const c=Math.pow(2,n);return(a%=c)<0&&(a+=c),a}function Wp(a){return Af({minX:a.x,maxX:a.x+1,minY:a.y,maxY:a.y+1,tileZ:a.z})}function Af({minX:a,maxX:n,minY:c,maxY:f,tileZ:_}){const w=Math.pow(2,_);return{top:c/w,bottom:f/w,left:a/w,right:n/w}}function ll(a){const n=a.getBounds(),c=n.getWest(),f=n.getEast(),_=c<-180?Math.abs(c)-180:0,w=f>180?f-180:0,I=Math.ceil(_/180),l=Math.ceil(w/180),D=[];for(let B=0-I;B<=l;B++)D.push(B);return D}function Xp(a,n){return a.x===n.x&&a.y===n.y&&a.z===n.z}function Nx(a,n){return Xp(a.topLeft,n.topLeft)&&Xp(a.bottomRight,n.bottomRight)}function Pf(a){return Ux(a,-85.0511,85.0511)}function su(a){return{lon:a.lng,lat:a.lat}}function Vx(a,n,c){const f=a.createProgram();if(f==null)throw new Error("Could not create program");const _=Yp(a,a.VERTEX_SHADER,n),w=Yp(a,a.FRAGMENT_SHADER,c);if(a.getShaderParameter(_,a.COMPILE_STATUS)||console.log(a.getShaderInfoLog(_)),a.getShaderParameter(w,a.COMPILE_STATUS)||console.log(a.getShaderInfoLog(w)),a.attachShader(f,_),a.attachShader(f,w),a.linkProgram(f),a.validateProgram(f),!a.getProgramParameter(f,a.LINK_STATUS))throw`Could not compile WebGL program. 

${a.getProgramInfoLog(f)}`;return f}function Yp(a,n,c){const f=a.createShader(n);if(f==null)throw new Error("Could not create shader");return a.shaderSource(f,c),a.compileShader(f),f}function Wu({gl:a,size:n,flipY:c=!1,premultiplyAlpha:f=!1,wrapS:_="CLAMP_TO_EDGE",wrapT:w="CLAMP_TO_EDGE",filter:I="NEAREST"}){a.pixelStorei(a.UNPACK_FLIP_Y_WEBGL,c),a.pixelStorei(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,f);const l=a.createTexture();if(l==null)throw new Error("Could not create texture");return a.bindTexture(a.TEXTURE_2D,l),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a[_]),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a[w]),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a[I]),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a[I]),n!=null&&a.texImage2D(a.TEXTURE_2D,0,a.RGBA,n.width,n.height,0,a.RGBA,a.UNSIGNED_BYTE,null),l}function Mf({gl:a,texture:n,size:c}){a.bindTexture(a.TEXTURE_2D,n),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,c.width,c.height,0,a.RGBA,a.UNSIGNED_BYTE,null)}function zf({gl:a,source:n,flipY:c=!1,premultiplyAlpha:f=!1,wrapS:_="CLAMP_TO_EDGE",wrapT:w="CLAMP_TO_EDGE",filter:I="NEAREST"}){const l=Wu({gl:a,flipY:c,premultiplyAlpha:f,wrapS:_,wrapT:w,filter:I});return a.texImage2D(a.TEXTURE_2D,0,a.RGBA,a.RGBA,a.UNSIGNED_BYTE,n),l}function kf({gl:a,texture:n,source:c,flipY:f=!1,premultiplyAlpha:_=!1}){a.pixelStorei(a.UNPACK_FLIP_Y_WEBGL,f),a.pixelStorei(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,_),a.bindTexture(a.TEXTURE_2D,n),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,a.RGBA,a.UNSIGNED_BYTE,c)}function Gx({gl:a,texture:n,size:c,data:f,flipY:_=!1,premultiplyAlpha:w=!1}){const{width:I,height:l}=c;a.pixelStorei(a.UNPACK_FLIP_Y_WEBGL,_),a.pixelStorei(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,w),a.bindTexture(a.TEXTURE_2D,n),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,I,l,0,a.RGBA,a.UNSIGNED_BYTE,f)}function Zx(a,n){const c={},f=a.getProgramParameter(n,a.ACTIVE_ATTRIBUTES);for(let _=0;_<f;_++){const w=a.getActiveAttrib(n,_);if(w==null)continue;const I=a.getAttribLocation(n,w.name);c[w.name]=I}return c}function Hx(a,n){const c={},f=a.getProgramParameter(n,a.ACTIVE_UNIFORMS);for(let _=0;_<f;_++){const w=a.getActiveUniform(n,_);if(w==null)continue;const I=a.getUniformLocation(n,w.name);I!=null&&(c[w.name]=I)}return c}function bc(a){const n=a.createBuffer();if(n==null)throw new Error("Unable to create buffer");return n}function zc(a){const n=a.createFramebuffer();if(n==null)throw new Error("Could not create framebuffer");return n}function Lf({width:a,height:n,offsetX:c=0,offsetY:f=0,viewport:_}){const w=a/_.width*2,I=n/_.height*2,l=c/_.width*2,D=-f/_.height*2;return{topLeft:{x:-w/2+l,y:I/2+D},topRight:{x:w/2+l,y:I/2+D},bottomRight:{x:w/2+l,y:-I/2+D},bottomLeft:{x:-w/2+l,y:-I/2+D}}}function cn(a){a.useProgram(null),a.enable(a.BLEND),a.blendEquation(a.FUNC_ADD),a.blendFunc(a.ONE,a.ONE_MINUS_SRC_ALPHA),a.blendEquation(a.FUNC_ADD)}class Ho{constructor(n){const{gl:c,textureIndex:f,flipY:_,premultiplyAlpha:w,wrapS:I,wrapT:l,filter:D}=n;if(this.gl=c,this.size="size"in n?n.size:{width:n.source.width,height:n.source.height},this.index=f,this.unit=c.TEXTURE0+f,"size"in n){const{size:B}=n;this.texture=Wu({gl:c,size:B,flipY:_,premultiplyAlpha:w,wrapS:I,wrapT:l,filter:D})}else{const{source:B}=n;this.texture=zf({gl:this.gl,source:B,flipY:_,premultiplyAlpha:w,wrapS:I,wrapT:l,filter:D})}}setSize(n){this.size.width===n.width&&this.size.height===n.height||(this.size=n,Mf({gl:this.gl,texture:this.texture,size:n}))}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:n,flipY:c=!1,premultiplyAlpha:f=!1}){this.size={width:n.width,height:n.height},kf({gl:this.gl,texture:this.texture,source:n,flipY:c,premultiplyAlpha:f})}}var jx=ln,qx=function(){return jx.Date.now()},Wx=qx,Xx=ol,lu=Wx,Kp=If,Yx="Expected a function",Kx=Math.max,Jx=Math.min;function Qx(a,n,c){var f,_,w,I,l,D,B=0,J=!1,K=!1,Z=!0;if(typeof a!="function")throw new TypeError(Yx);n=Kp(n)||0,Xx(c)&&(J=!!c.leading,K="maxWait"in c,w=K?Kx(Kp(c.maxWait)||0,n):w,Z="trailing"in c?!!c.trailing:Z);function we(Xe){var xt=f,At=_;return f=_=void 0,B=Xe,I=a.apply(At,xt),I}function be(Xe){return B=Xe,l=setTimeout($e,n),J?we(Xe):I}function Ae(Xe){var xt=Xe-D,At=Xe-B,pi=n-xt;return K?Jx(pi,w-At):pi}function Fe(Xe){var xt=Xe-D,At=Xe-B;return D===void 0||xt>=n||xt<0||K&&At>=w}function $e(){var Xe=lu();if(Fe(Xe))return Ve(Xe);l=setTimeout($e,Ae(Xe))}function Ve(Xe){return l=void 0,Z&&f?we(Xe):(f=_=void 0,I)}function Ge(){l!==void 0&&clearTimeout(l),B=0,f=D=_=l=void 0}function lt(){return l===void 0?I:Ve(lu())}function rt(){var Xe=lu(),xt=Fe(Xe);if(f=arguments,_=this,D=Xe,xt){if(l===void 0)return be(D);if(K)return clearTimeout(l),l=setTimeout($e,n),we(D)}return l===void 0&&(l=setTimeout($e,n)),I}return rt.cancel=Ge,rt.flush=lt,rt}var ev=Qx,tv=ev,iv=ol,rv="Expected a function";function nv(a,n,c){var f=!0,_=!0;if(typeof a!="function")throw new TypeError(rv);return iv(c)&&(f="leading"in c?!!c.leading:f,_="trailing"in c?!!c.trailing:_),tv(a,n,{leading:f,maxWait:n,trailing:_})}var Df=nv;function Xu(a){return di(this,void 0,void 0,function*(){return new Promise((n,c)=>{const f=new Image;f.crossOrigin="anonymous",f.onload=()=>{n(f)},f.onerror=c,f.src=a})})}class Rf{constructor({timeoutDuration:n=500,onLoad:c}={}){this.cachedImages={},this.timeoutDuration=n,c!=null&&(this.onLoadThrottled=Df(c,300,{leading:!1,trailing:!0}))}getImage(n){return this.loadImage(n),this.cachedImages[n]}loadImage(n){return di(this,void 0,void 0,function*(){if(this.cachedImages[n]!=null)return;const c={src:n,state:"loading"};this.cachedImages[n]=c;const f=setTimeout(()=>{c.state==="loading"&&(c.state="timeout")},this.timeoutDuration);try{const _=yield Xu(n);c.image=_,c.state="success"}catch{c.state="error"}clearTimeout(f),this.onLoadThrottled!=null&&this.onLoadThrottled()})}}class Hc{constructor({map:n,padding:c=0,textureIndex:f,tileZ:_,sources:w,filter:I="NEAREST",sourceIndex:l,bounds:D}){this.currentTiles=[],this.nextTiles=[],this.nextFrameReady=!1,this.updateTiles=({force:K,bounds:Z}={force:!1})=>{const we=Hu({map:this.map,padding:this.padding}),{width:be}=Sr({map:this.map,padding:this.padding,withPixelRatio:!1}),Ae=[],{tiles:Fe,size:$e,minY:Ve,mercatorBounds:Ge,tileBounds:lt,horizontalTileCount:rt}=Pu({map:this.map,mapWidth:be,tileZ:this.tileZ,bounds:we,shouldFetchData:Z==null});let Xe=$e,xt=Ve,At=Ge,pi=lt,Bi=rt;if(Z!=null){const{tiles:Wt,size:Bt,minY:Ht,mercatorBounds:Ui,tileBounds:Ye,horizontalTileCount:pr}=Pu({map:this.map,tileZ:this.tileZ,bounds:Z,shouldFetchData:!1});Xe=Bt,xt=Ht,At=Ui,pi=Ye,Bi=pr,Wt.forEach(qi=>{Fe.forEach(rr=>{rr.x===qi.x&&rr.y===qi.y&&rr.z===qi.z&&(qi.shouldFetchData=!0)})}),Ae.push(...Wt)}else Ae.push(...Fe);if(K===!1&&this.tileBounds!=null&&Nx(this.tileBounds,pi))return;this.nextMercatorBounds=At,this.nextTileBounds=pi,this.resetCanvas({width:256*Bi,height:256*Xe.height}),this.currentTiles=[];const Oi=this.sources[this.currentSourceIndex];for(let Wt=0;Wt<Ae.length;Wt++){const Bt=Ae[Wt],Ht=Bt.shouldFetchData===!1?"NODATA":Oi.urlTemplate.replace("{z}",String(Bt.z)).replace("{x}",String(Bt.x)).replace("{y}",String(Bt.y));this.currentTiles.push({url:Ht,x:Wt%Bi*256,y:256*(Bt.y-xt),drawn:!1,xyz:Bt})}if(this.nextSourceIndex!=null){this.nextTiles=[];const Wt=this.sources[this.nextSourceIndex];for(let Bt=0;Bt<Ae.length;Bt++){const Ht=Ae[Bt],Ui=Ht.shouldFetchData===!1?"NODATA":Wt.urlTemplate.replace("{z}",String(Ht.z)).replace("{x}",String(Ht.x)).replace("{y}",String(Ht.y));this.nextTiles.push({url:Ui,x:Bt%Bi*256,y:256*(Ht.y-xt),drawn:!1,xyz:Ht})}}},this.map=n,this.padding=c,this.textureIndex=f,this.currentSourceIndex=l;const{width:B,height:J}=n.getCanvas().getBoundingClientRect();this.canvas=ho({width:B,height:J}),this.context=Un({canvas:this.canvas}),this.imageCache=new Rf,this.tileZ=_,this.sources=w,this.filter=I,this.bounds=D,this.updateTiles({bounds:this.bounds}),this.cleanupCanvasDebugView=ff({canvas:this.canvas})}onRemove(){this.cleanupCanvasDebugView()}toggleCanvasDebugView(n){this.canvas.style.display=n?"":"none"}setTileZ(n){this.tileZ=n,this.updateTiles({force:!0,bounds:this.bounds})}setSourceIndex(n){this.currentSourceIndex=n,this.nextSourceIndex=this.currentSourceIndex+1,this.nextSourceIndex>=this.sources.length&&(this.nextSourceIndex=0),this.updateTiles({force:!0,bounds:this.bounds})}resetCanvas(n){On({canvas:this.canvas,width:n.width,height:n.height}),this.context.fillStyle="rgba(0, 0, 0, 0)",this.context.fillRect(0,0,this.canvas.width,this.canvas.height)}prerender(n){let c=!1;for(const _ of this.currentTiles)if(_.url!=="NODATA"){const{state:w}=this.imageCache.getImage(_.url);w==="loading"&&(c=!0)}if(c)return;this.nextFrameReady=this.nextTiles.every(_=>{if(_.url!=="NODATA"){const{state:w}=this.imageCache.getImage(_.url);return w==="success"||w==="error"||w==="timeout"}return!0});let f=!1;for(const _ of this.currentTiles){if(_.xyz,_.url!=="NODATA"){const{image:w}=this.imageCache.getImage(_.url);if(_.drawn||w==null)continue;this.context.drawImage(w,_.x,_.y)}_.drawn=!0,f=!0}f!==!1&&(this.texture==null?this.texture=new Ho({gl:n,textureIndex:this.textureIndex,source:this.canvas,flipY:!0,premultiplyAlpha:!0,filter:this.filter}):this.texture.updateFromSource({source:this.canvas,flipY:!0,premultiplyAlpha:!0}),this.mercatorBounds=this.nextMercatorBounds,this.tileBounds=this.nextTileBounds)}}class cl{constructor(){this.eventListeners=[]}addEventListener(n){this.eventListeners.push(n)}removeEventListener(n){this.eventListeners=this.eventListeners.filter(c=>c!==n)}dispatchEvent(n){for(const c of this.eventListeners)c(n)}}const ov=[{value:0,color:"#FFFFFF"},{value:.1,color:"#5ED7FF"},{value:.2,color:"#00AAFF"},{value:1,color:"#0080FF"},{value:4,color:"#0055FF"},{value:15,color:"#7A0087"}],av={showColorGradient:!1,isPlaying:!1,sourceIndex:0,smoothColorGradient:!1,showRadarTexture:!1,tileZ:4,blendFunc:"not-premultiplied"};class Ai{constructor({gl:n,data:c}){this.hasNewData=!1,this.gl=n,this.data=c,this.hasNewData=c!=null,this.buffer=bc(n)}setData(n){this.data=n,this.hasNewData=!0}addData(n){this.data=this.data!=null?new Float32Array([...this.data,...n]):n}getLength(){if(this.data==null)throw new Error("No buffer data");return this.data.length}bind(){if(this.data==null)throw new Error("No buffer data");this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.buffer),this.hasNewData===!0&&this.gl.bufferData(this.gl.ARRAY_BUFFER,this.data,this.gl.STATIC_DRAW)}}class Qr{constructor(n,c,f){this.attributeLocations={},this.uniformLocations={},this.program=Vx(n,c,f),n.useProgram(this.program),this.attributeLocations=Zx(n,this.program),this.uniformLocations=Hx(n,this.program),n.useProgram(null)}getAttribute(n){if(!(n in this.attributeLocations))throw new Error(`Attribute "${n}" not found`);return this.attributeLocations[n]}getUniform(n){if(!(n in this.uniformLocations))throw new Error(`Uniform "${n}" not found`);return this.uniformLocations[n]}}var sv=`#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif
varying vec2 vTexCoords;float maxMercator=1.0;float minMercator=0.0;uniform float uTextureMaxX;uniform float uTextureMinX;uniform float uTextureMaxY;uniform float uTextureMinY;uniform sampler2D uTexture;uniform bool uMode;float rescale(float fromX,float fromMax,float fromMin,float toMax,float toMin){return(fromX-fromMin)*(toMax-toMin)/(fromMax-fromMin)+toMin;}void main(){vec4 outOfCoverageColor=vec4(0.0,0.0,0.0,0.1);if(uMode){outOfCoverageColor=vec4(1.0,1.0,1.0,0.1);}if(vTexCoords.x<=uTextureMaxX&&vTexCoords.x>=uTextureMinX&&vTexCoords.y<=uTextureMaxY&&vTexCoords.y>=uTextureMinY){float rescaledX=rescale(vTexCoords.x,uTextureMaxX,uTextureMinX,maxMercator,minMercator);float rescaledY=1.0-rescale(vTexCoords.y,uTextureMaxY,uTextureMinY,maxMercator,minMercator);vec4 currentColor=texture2D(uTexture,vec2(rescaledX,rescaledY));gl_FragColor=currentColor;if(currentColor.r==1.0&&currentColor.g==1.0&&currentColor.b==1.0&&currentColor.a==1.0){gl_FragColor=outOfCoverageColor;}if(currentColor.r==0.0&&currentColor.g==0.0&&currentColor.b==0.0&&currentColor.a==1.0){gl_FragColor=vec4(0.0,0.0,0.0,0.0);}}else{gl_FragColor=outOfCoverageColor;}}`,lv="uniform mat4 uMatrix;uniform vec2 uWorldOffset;attribute vec2 aPosition;varying vec2 vTexCoords;void main(){gl_Position=uMatrix*vec4(aPosition+uWorldOffset,0.0,1.0);vTexCoords=aPosition;}";class cv extends Qr{constructor({map:n,gl:c,mode:f}){super(c,lv,sv),this.map=n,this.mode=f,this.vertexBuffer=new Ai({gl:c,data:new Float32Array([0,0,0,1,1,1,0,0,1,1,1,0])})}prerender({mercatorBounds:n}){this.mercatorBounds=n}render({gl:n,matrix:c,viewportSize:f,texture:_,blendFunc:w="premultiplied"}){if(this.mercatorBounds==null)return;n.useProgram(this.program),n.viewport(0,0,f.width,f.height),n.enable(n.BLEND),w==="premultiplied"?n.blendFunc(n.ONE,n.ONE_MINUS_SRC_ALPHA):w==="not-premultiplied"?n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA):w==="multiply"&&n.blendFunc(n.DST_COLOR,n.ONE_MINUS_SRC_ALPHA),_.bind(),n.uniform1i(this.getUniform("uTexture"),_.index),n.uniformMatrix4fv(n.getUniformLocation(this.program,"uMatrix"),!1,c),n.uniform1f(this.getUniform("uTextureMinX"),this.mercatorBounds.minX),n.uniform1f(this.getUniform("uTextureMaxX"),this.mercatorBounds.maxX),n.uniform1f(this.getUniform("uTextureMinY"),this.mercatorBounds.minY),n.uniform1f(this.getUniform("uTextureMaxY"),this.mercatorBounds.maxY),n.uniform1i(this.getUniform("uMode"),this.mode==="dark"?1:0),this.vertexBuffer.bind(),n.vertexAttribPointer(this.getAttribute("aPosition"),2,n.FLOAT,!1,0,0),n.enableVertexAttribArray(this.getAttribute("aPosition"));const I=ll(this.map.maplibregl);for(const l of I)n.uniform2fv(this.getUniform("uWorldOffset"),[l,0]),n.drawArrays(n.TRIANGLES,0,6);cn(n)}}class hv extends cl{constructor({id:n,map:c,radarData:f,mode:_="light"}){super(),this.enabled=!0,this.isPlaying=!1,this.options=av,this.initialRadarColors=ov,this.getCorrectZoomLevel=I=>I<4.5?4:I>=4.5&&I<=5.5?5:6,this.handleRequestAnimationFrame=I=>{this.currentFrameStartTime==null&&(this.currentFrameStartTime=I);const l=I-this.currentFrameStartTime;this.isPlaying===!0&&l>500&&this.isNextFrameReady()&&(this.setSourceIndex(this.sourceIndex+1),this.currentFrameStartTime=I),this.map.maplibregl.triggerRepaint(),this.requestAnimationFrameId=window.requestAnimationFrame(this.handleRequestAnimationFrame)},this.handleWebGLContextLost=()=>{this.setEnabled(!1)},this.handleMove=()=>{this.radarTileCache!=null&&this.radarTileCache.updateTiles({bounds:this.bounds})},this.handleMapEvent=I=>di(this,void 0,void 0,function*(){I.type==="map:click"&&(this.activeClickData=I,this.handleClickOrUpdate()),I.type==="map:start-click"&&this.dispatchEvent({type:"radar-layer:start-click",pin:I.pin,point:I.point})}),this.handleClickOrUpdate=({type:I}={type:"click"})=>di(this,void 0,void 0,function*(){if(this.activeClickData==null)return;const{positionWrapped:l,point:D,pin:B,location:J,locationsNearby:K}=this.activeClickData;this.dispatchEvent({type:I==="click"?"radar-layer:click":"radar-layer:update",location:J,locationsNearby:K,position:l,point:D,pin:B,currentFrame:{index:this.sourceIndex,time:this.getFrames()[this.sourceIndex]}})}),this.id=n,this.type="custom",this.map=c,this.sourceIndex=f.initialIndex,this.tileZ=this.options.tileZ,this.radarData=f;const w={west:this.radarData.apiData.bounds[0],east:this.radarData.apiData.bounds[2],south:this.radarData.apiData.bounds[1],north:this.radarData.apiData.bounds[3]};this.mode=_,this.map.maplibregl.on("zoom",()=>{this.handleZoom()}),this.mercatorBounds=U0(w),this.bounds=new Ur.exports.LngLatBounds({lon:w.west,lat:w.south},{lon:w.east,lat:w.north}),this.sources=f.apiData.times.map(I=>({time:I.time,urlTemplate:c.supportsWebp?I.tiles.webp:I.tiles.png})),this.colorCanvas=ho({width:1,height:256}),this.setColors(),this.colorCanvas.style.position="absolute",this.colorCanvas.style.top="5vh",this.colorCanvas.style.left="5vh",this.colorCanvas.style.outline="2px solid white",this.colorCanvas.style.width="10px",this.colorCanvas.style.height="90vh",this.colorCanvas.style.imageRendering="pixelated",this.colorCanvas.style.pointerEvents="none",document.body.appendChild(this.colorCanvas),this.colorCanvas.style.display=this.options.showColorGradient===!0?"block":"none"}handleZoom(){const n=this.getCorrectZoomLevel(this.map.maplibregl.getZoom());this.setTileZ(n)}onAdd(n,c){this.DrawRadarProgram=new cv({map:this.map,gl:c,mercatorBounds:this.mercatorBounds,mode:this.mode}),this.map.maplibregl.on("webglcontextlost",this.handleWebGLContextLost),this.map.maplibregl.on("move",this.handleMove),this.requestAnimationFrameId=window.requestAnimationFrame(this.handleRequestAnimationFrame),this.map.addEventListener(this.handleMapEvent),this.radarTileCache=new Hc({map:this.map.maplibregl,textureIndex:13,tileZ:this.tileZ,sourceIndex:this.radarData.initialIndex,sources:this.sources,filter:"NEAREST",bounds:this.bounds});const f=this.getCorrectZoomLevel(this.map.maplibregl.getZoom());this.setTileZ(f),this.dispatchEvent({type:"radar-layer:frames",initialFrameIndex:this.getInitialIndex(),times:this.getFrames()}),this.map.prefersReducedMotion===!1&&this.play()}onRemove(){this.radarTileCache!=null&&(this.radarTileCache.onRemove(),this.map.removeEventListener(this.handleMapEvent),this.map.maplibregl.off("webglcontextlost",this.handleWebGLContextLost),this.map.maplibregl.off("move",this.handleMove),this.requestAnimationFrameId!=null&&window.cancelAnimationFrame(this.requestAnimationFrameId))}setOptions({options:n,key:c}){this.options=n,c==="smoothColorGradient"&&this.setColors(),c==="showColorGradient"&&(this.colorCanvas.style.display=this.options.showColorGradient===!0?"block":"none"),c==="blendFunc"&&this.map.maplibregl.triggerRepaint()}setEnabled(n){if(this.enabled=n,this.enabled===!1){if(this.radarTileCache==null)return;this.radarTileCache.toggleCanvasDebugView(!1)}}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.sourceIndex}getInitialIndex(){return this.radarData.initialIndex}getFrames(){return this.sources.map(n=>n.time)}setTileZ(n){this.radarTileCache!=null&&this.radarTileCache.setTileZ(n)}toggleTextureDebugView(n){this.radarTileCache!=null&&this.radarTileCache.toggleCanvasDebugView(n)}setColors(){const n=Un({canvas:this.colorCanvas});if(this.options.smoothColorGradient){On({canvas:this.colorCanvas,width:1,height:256});const c=n.createLinearGradient(0,0,0,255);this.initialRadarColors.forEach(f=>{const{color:_,value:w}=f;c.addColorStop(1-w/25.6,_)}),n.fillStyle=c,n.fillRect(0,0,1,256)}else On({canvas:this.colorCanvas,width:1,height:256}),this.initialRadarColors.forEach(c=>{const{color:f,value:_}=c,w=10*_;n.fillStyle=f,n.fillRect(0,256-w,1,w-256)})}setSourceIndex(n){this.radarTileCache!=null&&(this.sourceIndex=n,n>=this.sources.length&&this.isPlaying?(this.radarTileCache.setSourceIndex(0),this.sourceIndex=0):this.radarTileCache.setSourceIndex(n),this.dispatchEvent({type:"radar-layer:current-frame",index:this.sourceIndex,time:this.sources[this.sourceIndex].time}),this.handleClickOrUpdate({type:"update"}))}isNextFrameReady(){if(this.radarTileCache!=null)return this.radarTileCache.nextFrameReady}prerender(n,c){var f;if(this.enabled!==!1&&this.radarTileCache!=null&&(this.colorTexture==null?this.colorTexture=new Ho({gl:n,textureIndex:15,source:this.colorCanvas,flipY:!0,premultiplyAlpha:!0}):this.colorTexture.updateFromSource({source:this.colorCanvas,flipY:!0,premultiplyAlpha:!0}),this.radarTileCache.prerender(n),this.radarTileCache.tileBounds)){const _=Wp(this.radarTileCache.tileBounds.topLeft),w=Wp(this.radarTileCache.tileBounds.bottomRight);this.mercatorBounds={maxX:w.right,minX:_.left,maxY:w.bottom,minY:_.top},(f=this.DrawRadarProgram)===null||f===void 0||f.prerender({mercatorBounds:this.mercatorBounds})}}render(n,c){if(this.enabled===!1||this.DrawRadarProgram==null||this.radarTileCache==null||this.radarTileCache.texture==null||this.colorTexture==null)return;const f=Sr({map:this.map.maplibregl,withPixelRatio:!0});this.radarTileCache.texture.bind(),this.colorTexture.bind(),this.DrawRadarProgram.render({gl:n,matrix:c,viewportSize:f,texture:this.radarTileCache.texture}),this.radarTileCache.texture.unbind(),this.colorTexture.unbind()}cancelClick(){this.activeClickData=void 0,this.map.hideSecondaryPin()}}const cu=100,hu=100,Ff=-15,kc=140,Lc=110,Bf=-15,uv=a=>a*Math.PI/180,dv=a=>180*a/Math.PI;function Of(a){return(a%=360)<0&&(a=360-Math.abs(a)),a}function pv(a){return Of(-1*a+90)}var uu,Dc=(function(a,n){n.TWO_PI=2*Math.PI,n.HALF_PI=.5*Math.PI,n.degreesToRadians=function(w){return w*Math.PI/180},n.radiansToDegrees=function(w){return 180*w/Math.PI};var c=n.normalize=function(w,I,l){return I===l?1:(w-I)/(l-I)},f=n.interpolate=function(w,I,l){return I+(l-I)*w},_=n.map=function(w,I,l,D,B){return f(c(w,I,l),D,B)};n.limit=function(w,I,l){return Math.min(Math.max(I,w),l)},n.rangedRandom=function(w,I){return _(Math.random(),0,1,w,I)},n.round=function(w,I){if(w%1==0)return w;var l=w<0;if(w=Math.abs(w),!I)return Math.round(w)*(l?-1:1);var D=w.toString().split("."),B=D[0]+D[1].substr(0,I),J=D[1].slice(I),K=Math.round(J/Math.pow(10,J.length)),Z=Math.pow(10,I||0);return D[1].length>I&&(w=(+B+K)/Z),w*(l?-1:1)}}(uu={exports:{}},uu.exports),uu.exports);function Yu({value:a,decimal:n=!0,unit:c}){return c==="fahrenheit"&&(a=fv({value:a})),n===!0?Dc.round(a,1):Dc.round(a)}function mv({value:a,decimal:n=!0,unit:c}){const f=Yu({value:a,decimal:n,unit:c});return c==="fahrenheit"?f>32:f>0}function fv({value:a}){return 1.8*a+32}function gv({value:a}){if(a<0)throw"Value can not be negative";return 1.94384*a}function yv({value:a}){if(a<0)throw"Value can not be negative";return 3.6*a}function _v({value:a}){if(a<0)throw"Value can not be negative";return 2.236936*a}function xv({value:a}){if(a<0)throw"Value can not be negative";const n=[.3,1.6,3.4,5.5,8,10.8,13.9,17.2,20.8,24.5,28.5,32.7];for(let c=0;c<=11;c++)if(a<n[c])return c;return 12}const du=[{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 Uf({value:a,decimal:n=!0,unit:c}){if(a<0)throw"Value can not be negative";return c==="kmh"?a=yv({value:a}):c==="mph"?a=_v({value:a}):c==="knots"?a=gv({value:a}):c==="beaufort"&&(a=xv({value:a})),n===!0?Dc.round(a,1):Dc.round(a)}function vv(a){for(let n=0,c=du.length;n<c;n++)if(a<=du[n].value)return du[n].type}const Ys=[{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 Jp(a){a=Of(a);const n=Ys.length,c=360/n/2;for(let f=1;f<n;f++)if(a>Ys[f].value-c&&a<=Ys[f].value+c)return Ys[f].text;return Ys[0].text}function bv(a){return a!=null}var wv=function(a){a("EPSG:4326","+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees"),a("EPSG:4269","+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees"),a("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"),a.WGS84=a["EPSG:4326"],a["EPSG:3785"]=a["EPSG:3857"],a.GOOGLE=a["EPSG:3857"],a["EPSG:900913"]=a["EPSG:3857"],a["EPSG:102113"]=a["EPSG:3857"]},dr={};dr.greenwich=0;dr.lisbon=-9.131906111111;dr.paris=2.337229166667;dr.bogota=-74.080916666667;dr.madrid=-3.687938888889;dr.rome=12.452333333333;dr.bern=7.439583333333;dr.jakarta=106.807719444444;dr.ferro=-17.666666666667;dr.brussels=4.367975;dr.stockholm=18.058277777778;dr.athens=23.7163375;dr.oslo=10.722916666667;var $f={};(function(a){a.ft={to_meter:.3048},a["us-ft"]={to_meter:1200/3937}})($f);var Yr=.017453292519943295,Qp=dr,em=$f,Nf=function(a){var n={},c={};a.split("+").map(function(l){return l.trim()}).filter(function(l){return l}).forEach(function(l){var D=l.split("=");D.push(!0),c[D[0].toLowerCase()]=D[1]});var f,_,w,I={proj:"projName",datum:"datumCode",rf:function(l){n.rf=parseFloat(l)},lat_0:function(l){n.lat0=l*Yr},lat_1:function(l){n.lat1=l*Yr},lat_2:function(l){n.lat2=l*Yr},lat_ts:function(l){n.lat_ts=l*Yr},lon_0:function(l){n.long0=l*Yr},lon_1:function(l){n.long1=l*Yr},lon_2:function(l){n.long2=l*Yr},alpha:function(l){n.alpha=parseFloat(l)*Yr},lonc:function(l){n.longc=l*Yr},x_0:function(l){n.x0=parseFloat(l)},y_0:function(l){n.y0=parseFloat(l)},k_0:function(l){n.k0=parseFloat(l)},k:function(l){n.k0=parseFloat(l)},a:function(l){n.a=parseFloat(l)},b:function(l){n.b=parseFloat(l)},r_a:function(){n.R_A=!0},zone:function(l){n.zone=parseInt(l,10)},south:function(){n.utmSouth=!0},towgs84:function(l){n.datum_params=l.split(",").map(function(D){return parseFloat(D)})},to_meter:function(l){n.to_meter=parseFloat(l)},units:function(l){n.units=l,em[l]&&(n.to_meter=em[l].to_meter)},from_greenwich:function(l){n.from_greenwich=l*Yr},pm:function(l){n.from_greenwich=(Qp[l]?Qp[l]:parseFloat(l))*Yr},nadgrids:function(l){l==="@null"?n.datumCode="none":n.nadgrids=l},axis:function(l){var D="ewnsud";l.length===3&&D.indexOf(l.substr(0,1))!==-1&&D.indexOf(l.substr(1,1))!==-1&&D.indexOf(l.substr(2,1))!==-1&&(n.axis=l)}};for(f in c)_=c[f],f in I?(w=I[f],typeof w=="function"?w(_):n[w]=_):n[f]=_;return typeof n.datumCode=="string"&&n.datumCode!=="WGS84"&&(n.datumCode=n.datumCode.toLowerCase()),n},Ku=function(a,n){a=a||{};var c,f;if(!n)return a;for(f in n)c=n[f],c!==void 0&&(a[f]=c);return a},Sv=.017453292519943295,Vf=Ku;function tm(a,n,c){a[n]=c.map(function(f){var _={};return Rc(f,_),_}).reduce(function(f,_){return Vf(f,_)},{})}function Rc(a,n){var c;if(Array.isArray(a))c=a.shift(),c==="PARAMETER"&&(c=a.shift()),a.length===1?Array.isArray(a[0])?(n[c]={},Rc(a[0],n[c])):n[c]=a[0]:a.length?c==="TOWGS84"?n[c]=a:(n[c]={},["UNIT","PRIMEM","VERT_DATUM"].indexOf(c)>-1?(n[c]={name:a[0].toLowerCase(),convert:a[1]},a.length===3&&(n[c].auth=a[2])):c==="SPHEROID"?(n[c]={name:a[0],a:a[1],rf:a[2]},a.length===4&&(n[c].auth=a[3])):["GEOGCS","GEOCCS","DATUM","VERT_CS","COMPD_CS","LOCAL_CS","FITTED_CS","LOCAL_DATUM"].indexOf(c)>-1?(a[0]=["name",a[0]],tm(n,c,a)):a.every(function(f){return Array.isArray(f)})?tm(n,c,a):Rc(a,n[c])):n[c]=!0;else{n[a]=!0;return}}function Tv(a,n){var c=n[0],f=n[1];!(c in a)&&f in a&&(a[c]=a[f],n.length===3&&(a[c]=n[2](a[c])))}function Bn(a){return a*Sv}function Cv(a){a.type==="GEOGCS"?a.projName="longlat":a.type==="LOCAL_CS"?(a.projName="identity",a.local=!0):typeof a.PROJECTION=="object"?a.projName=Object.keys(a.PROJECTION)[0]:a.projName=a.PROJECTION,a.UNIT&&(a.units=a.UNIT.name.toLowerCase(),a.units==="metre"&&(a.units="meter"),a.UNIT.convert&&(a.type==="GEOGCS"?a.DATUM&&a.DATUM.SPHEROID&&(a.to_meter=parseFloat(a.UNIT.convert,10)*a.DATUM.SPHEROID.a):a.to_meter=parseFloat(a.UNIT.convert,10))),a.GEOGCS&&(a.GEOGCS.DATUM?a.datumCode=a.GEOGCS.DATUM.name.toLowerCase():a.datumCode=a.GEOGCS.name.toLowerCase(),a.datumCode.slice(0,2)==="d_"&&(a.datumCode=a.datumCode.slice(2)),(a.datumCode==="new_zealand_geodetic_datum_1949"||a.datumCode==="new_zealand_1949")&&(a.datumCode="nzgd49"),a.datumCode==="wgs_1984"&&(a.PROJECTION==="Mercator_Auxiliary_Sphere"&&(a.sphere=!0),a.datumCode="wgs84"),a.datumCode.slice(-6)==="_ferro"&&(a.datumCode=a.datumCode.slice(0,-6)),a.datumCode.slice(-8)==="_jakarta"&&(a.datumCode=a.datumCode.slice(0,-8)),~a.datumCode.indexOf("belge")&&(a.datumCode="rnb72"),a.GEOGCS.DATUM&&a.GEOGCS.DATUM.SPHEROID&&(a.ellps=a.GEOGCS.DATUM.SPHEROID.name.replace("_19","").replace(/[Cc]larke\_18/,"clrk"),a.ellps.toLowerCase().slice(0,13)==="international"&&(a.ellps="intl"),a.a=a.GEOGCS.DATUM.SPHEROID.a,a.rf=parseFloat(a.GEOGCS.DATUM.SPHEROID.rf,10)),~a.datumCode.indexOf("osgb_1936")&&(a.datumCode="osgb36")),a.b&&!isFinite(a.b)&&(a.b=a.a);function n(_){var w=a.to_meter||1;return parseFloat(_,10)*w}var c=function(_){return Tv(a,_)},f=[["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",Bn],["longitude_of_center","Longitude_Of_Center"],["longc","longitude_of_center",Bn],["x0","false_easting",n],["y0","false_northing",n],["long0","central_meridian",Bn],["lat0","latitude_of_origin",Bn],["lat0","standard_parallel_1",Bn],["lat1","standard_parallel_1",Bn],["lat2","standard_parallel_2",Bn],["alpha","azimuth",Bn],["srsCode","name"]];f.forEach(c),!a.long0&&a.longc&&(a.projName==="Albers_Conic_Equal_Area"||a.projName==="Lambert_Azimuthal_Equal_Area")&&(a.long0=a.longc),!a.lat_ts&&a.lat1&&(a.projName==="Stereographic_South_Pole"||a.projName==="Polar Stereographic (variant B)")&&(a.lat0=Bn(a.lat1>0?90:-90),a.lat_ts=a.lat1)}var Gf=function(a,n){var c=JSON.parse((","+a).replace(/\s*\,\s*([A-Z_0-9]+?)(\[)/g,',["$1",').slice(1).replace(/\s*\,\s*([A-Z_0-9]+?)\]/g,',"$1"]').replace(/,\["VERTCS".+/,"")),f=c.shift(),_=c.shift();c.unshift(["name",_]),c.unshift(["type",f]),c.unshift("output");var w={};return Rc(c,w),Cv(w.output),Vf(n,w.output)},Iv=wv,Ev=Nf,Av=Gf;function Fr(a){var n=this;if(arguments.length===2){var c=arguments[1];typeof c=="string"?c.charAt(0)==="+"?Fr[a]=Ev(arguments[1]):Fr[a]=Av(arguments[1]):Fr[a]=c}else if(arguments.length===1){if(Array.isArray(a))return a.map(function(f){Array.isArray(f)?Fr.apply(n,f):Fr(f)});if(typeof a=="string"){if(a in Fr)return Fr[a]}else"EPSG"in a?Fr["EPSG:"+a.EPSG]=a:"ESRI"in a?Fr["ESRI:"+a.ESRI]=a:"IAU2000"in a?Fr["IAU2000:"+a.IAU2000]=a:console.log(a);return}}Iv(Fr);var Zf=Fr,Hf=Zf,Pv=Gf,Mv=Nf;function zv(a){return typeof a=="string"}function kv(a){return a in Hf}function Lv(a){var n=["GEOGCS","GEOCCS","PROJCS","LOCAL_CS"];return n.reduce(function(c,f){return c+1+a.indexOf(f)},0)}function Dv(a){return a[0]==="+"}function Rv(a){if(zv(a)){if(kv(a))return Hf[a];if(Lv(a))return Pv(a);if(Dv(a))return Mv(a)}else return a}var Fv=Rv,jc={},$a={},Bv=function(a,n,c){var f=a*n;return c/Math.sqrt(1-f*f)},Ov=function(a){return a<0?-1:1},Uv=Math.PI*2,$v=3.14159265359,Nv=Ov,jf=function(a){return Math.abs(a)<=$v?a:a-Nv(a)*Uv},Vv=Math.PI/2,Gv=function(a,n,c){var f=a*c,_=.5*a;return f=Math.pow((1-f)/(1+f),_),Math.tan(.5*(Vv-n))/f},im=Math.PI/2,Zv=function(a,n){for(var c=.5*a,f,_,w=im-2*Math.atan(n),I=0;I<=15;I++)if(f=a*Math.sin(w),_=im-2*Math.atan(n*Math.pow((1-f)/(1+f),c))-w,w+=_,Math.abs(_)<=1e-10)return w;return-9999},Hv=Bv,qf=Math.PI/2,jv=1e-10,gc=57.29577951308232,Mu=jf,qv=Math.PI/4,Wv=Gv,Xv=Zv;$a.init=function(){var a=this.b/this.a;this.es=1-a*a,"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=Hv(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||(this.k?this.k0=this.k:this.k0=1)};$a.forward=function(a){var n=a.x,c=a.y;if(c*gc>90&&c*gc<-90&&n*gc>180&&n*gc<-180)return null;var f,_;if(Math.abs(Math.abs(c)-qf)<=jv)return null;if(this.sphere)f=this.x0+this.a*this.k0*Mu(n-this.long0),_=this.y0+this.a*this.k0*Math.log(Math.tan(qv+.5*c));else{var w=Math.sin(c),I=Wv(this.e,c,w);f=this.x0+this.a*this.k0*Mu(n-this.long0),_=this.y0-this.a*this.k0*Math.log(I)}return a.x=f,a.y=_,a};$a.inverse=function(a){var n=a.x-this.x0,c=a.y-this.y0,f,_;if(this.sphere)_=qf-2*Math.atan(Math.exp(-c/(this.a*this.k0)));else{var w=Math.exp(-c/(this.a*this.k0));if(_=Xv(this.e,w),_===-9999)return null}return f=Mu(this.long0+n/(this.a*this.k0)),a.x=f,a.y=_,a};$a.names=["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","merc"];var hl={};hl.init=function(){};function Wf(a){return a}hl.forward=Wf;hl.inverse=Wf;hl.names=["longlat","identity"];var Yv=[$a,hl],wc={},Fc=[];function Xf(a,n){var c=Fc.length;return a.names?(Fc[c]=a,a.names.forEach(function(f){wc[f.toLowerCase()]=c}),this):(console.log(n),!0)}jc.add=Xf;jc.get=function(a){if(!a)return!1;var n=a.toLowerCase();if(typeof wc[n]<"u"&&Fc[wc[n]])return Fc[wc[n]]};jc.start=function(){Yv.forEach(Xf)};var Ri={};Ri.wgs84={towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"};Ri.ch1903={towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"};Ri.ggrs87={towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"};Ri.nad83={towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"};Ri.nad27={nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"};Ri.potsdam={towgs84:"606.0,23.0,413.0",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"};Ri.carthage={towgs84:"-263.0,6.0,431.0",ellipse:"clark80",datumName:"Carthage 1934 Tunisia"};Ri.hermannskogel={towgs84:"653.0,-212.0,449.0",ellipse:"bessel",datumName:"Hermannskogel"};Ri.ire65={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"};Ri.rassadiran={towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"};Ri.nzgd49={towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"};Ri.osgb36={towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Airy 1830"};Ri.s_jtsk={towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"};Ri.beduaram={towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"};Ri.gunung_segara={towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"};Ri.rnb72={towgs84:"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",ellipse:"intl",datumName:"Reseau National Belge 1972"};var ht={};ht.MERIT={a:6378137,rf:298.257,ellipseName:"MERIT 1983"};ht.SGS85={a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"};ht.GRS80={a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"};ht.IAU76={a:6378140,rf:298.257,ellipseName:"IAU 1976"};ht.airy={a:6377563396e-3,b:635625691e-2,ellipseName:"Airy 1830"};ht.APL4={a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"};ht.NWL9D={a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"};ht.mod_airy={a:6377340189e-3,b:6356034446e-3,ellipseName:"Modified Airy"};ht.andrae={a:637710443e-2,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"};ht.aust_SA={a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"};ht.GRS67={a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"};ht.bessel={a:6377397155e-3,rf:299.1528128,ellipseName:"Bessel 1841"};ht.bess_nam={a:6377483865e-3,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"};ht.clrk66={a:63782064e-1,b:63565838e-1,ellipseName:"Clarke 1866"};ht.clrk80={a:6378249145e-3,rf:293.4663,ellipseName:"Clarke 1880 mod."};ht.clrk58={a:6378293645208759e-9,rf:294.2606763692654,ellipseName:"Clarke 1858"};ht.CPM={a:63757387e-1,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"};ht.delmbr={a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"};ht.engelis={a:637813605e-2,rf:298.2566,ellipseName:"Engelis 1985"};ht.evrst30={a:6377276345e-3,rf:300.8017,ellipseName:"Everest 1830"};ht.evrst48={a:6377304063e-3,rf:300.8017,ellipseName:"Everest 1948"};ht.evrst56={a:6377301243e-3,rf:300.8017,ellipseName:"Everest 1956"};ht.evrst69={a:6377295664e-3,rf:300.8017,ellipseName:"Everest 1969"};ht.evrstSS={a:6377298556e-3,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"};ht.fschr60={a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"};ht.fschr60m={a:6378155,rf:298.3,ellipseName:"Fischer 1960"};ht.fschr68={a:6378150,rf:298.3,ellipseName:"Fischer 1968"};ht.helmert={a:6378200,rf:298.3,ellipseName:"Helmert 1906"};ht.hough={a:6378270,rf:297,ellipseName:"Hough"};ht.intl={a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"};ht.kaula={a:6378163,rf:298.24,ellipseName:"Kaula 1961"};ht.lerch={a:6378139,rf:298.257,ellipseName:"Lerch 1979"};ht.mprts={a:6397300,rf:191,ellipseName:"Maupertius 1738"};ht.new_intl={a:63781575e-1,b:63567722e-1,ellipseName:"New International 1967"};ht.plessis={a:6376523,rf:6355863,ellipseName:"Plessis 1817 (France)"};ht.krass={a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"};ht.SEasia={a:6378155,b:63567733205e-4,ellipseName:"Southeast Asia"};ht.walbeck={a:6376896,b:63558348467e-4,ellipseName:"Walbeck"};ht.WGS60={a:6378165,rf:298.3,ellipseName:"WGS 60"};ht.WGS66={a:6378145,rf:298.25,ellipseName:"WGS 66"};ht.WGS7={a:6378135,rf:298.26,ellipseName:"WGS 72"};ht.WGS84={a:6378137,rf:298.257223563,ellipseName:"WGS 84"};ht.sphere={a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"};var hr=Math.PI/2,Sc=1,Tc=2,Bc=3,Kv=4,Jv=5,pu=484813681109536e-20,Qv=1.0026,rm=.3826834323650898,Oc=function(a){if(!(this instanceof Oc))return new Oc(a);this.datum_type=Kv,a&&(a.datumCode&&a.datumCode==="none"&&(this.datum_type=Jv),a.datum_params&&(this.datum_params=a.datum_params.map(parseFloat),(this.datum_params[0]!==0||this.datum_params[1]!==0||this.datum_params[2]!==0)&&(this.datum_type=Sc),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=Tc,this.datum_params[3]*=pu,this.datum_params[4]*=pu,this.datum_params[5]*=pu,this.datum_params[6]=this.datum_params[6]/1e6+1)),this.datum_type=a.grids?Bc:this.datum_type,this.a=a.a,this.b=a.b,this.es=a.es,this.ep2=a.ep2,this.datum_type===Bc&&(this.grids=a.grids))};Oc.prototype={compare_datums:function(a){return this.datum_type!==a.datum_type||this.a!==a.a||Math.abs(this.es-a.es)>5e-11?!1:this.datum_type===Sc?this.datum_params[0]===a.datum_params[0]&&this.datum_params[1]===a.datum_params[1]&&this.datum_params[2]===a.datum_params[2]:this.datum_type===Tc?this.datum_params[0]===a.datum_params[0]&&this.datum_params[1]===a.datum_params[1]&&this.datum_params[2]===a.datum_params[2]&&this.datum_params[3]===a.datum_params[3]&&this.datum_params[4]===a.datum_params[4]&&this.datum_params[5]===a.datum_params[5]&&this.datum_params[6]===a.datum_params[6]:this.datum_type===Bc||a.datum_type===Bc?this.nadgrids===a.nadgrids:!0},geodetic_to_geocentric:function(a){var n=a.x,c=a.y,f=a.z?a.z:0,_,w,I,l=0,D,B,J,K;if(c<-hr&&c>-1.001*hr)c=-hr;else if(c>hr&&c<1.001*hr)c=hr;else if(c<-hr||c>hr)return null;return n>Math.PI&&(n-=2*Math.PI),B=Math.sin(c),K=Math.cos(c),J=B*B,D=this.a/Math.sqrt(1-this.es*J),_=(D+f)*K*Math.cos(n),w=(D+f)*K*Math.sin(n),I=(D*(1-this.es)+f)*B,a.x=_,a.y=w,a.z=I,l},geocentric_to_geodetic:function(a){var n=1e-12,c=n*n,f=30,_,w,I,l,D,B,J,K,Z,we,be,Ae,Fe,$e=a.x,Ve=a.y,Ge=a.z?a.z:0,lt,rt,Xe;if(_=Math.sqrt($e*$e+Ve*Ve),w=Math.sqrt($e*$e+Ve*Ve+Ge*Ge),_/this.a<n){if(lt=0,w/this.a<n){rt=hr,Xe=-this.b;return}}else lt=Math.atan2(Ve,$e);I=Ge/w,l=_/w,D=1/Math.sqrt(1-this.es*(2-this.es)*l*l),K=l*(1-this.es)*D,Z=I*D,Fe=0;do Fe++,J=this.a/Math.sqrt(1-this.es*Z*Z),Xe=_*K+Ge*Z-J*(1-this.es*Z*Z),B=this.es*J/(J+Xe),D=1/Math.sqrt(1-B*(2-B)*l*l),we=l*(1-B)*D,be=I*D,Ae=be*K-we*Z,K=we,Z=be;while(Ae*Ae>c&&Fe<f);return rt=Math.atan(be/Math.abs(we)),a.x=lt,a.y=rt,a.z=Xe,a},geocentric_to_geodetic_noniter:function(a){var n=a.x,c=a.y,f=a.z?a.z:0,_,w,I,l,D,B,J,K,Z,we,be,Ae,Fe,$e,Ve,Ge,lt;if(n=parseFloat(n),c=parseFloat(c),f=parseFloat(f),lt=!1,n!==0)_=Math.atan2(c,n);else if(c>0)_=hr;else if(c<0)_=-hr;else if(lt=!0,_=0,f>0)w=hr;else if(f<0)w=-hr;else{w=hr,I=-this.b;return}return D=n*n+c*c,l=Math.sqrt(D),B=f*Qv,K=Math.sqrt(B*B+D),we=B/K,Ae=l/K,be=we*we*we,J=f+this.b*this.ep2*be,Ge=l-this.a*this.es*Ae*Ae*Ae,Z=Math.sqrt(J*J+Ge*Ge),Fe=J/Z,$e=Ge/Z,Ve=this.a/Math.sqrt(1-this.es*Fe*Fe),$e>=rm?I=l/$e-Ve:$e<=-rm?I=l/-$e-Ve:I=f/Fe+Ve*(this.es-1),lt===!1&&(w=Math.atan(Fe/$e)),a.x=_,a.y=w,a.z=I,a},geocentric_to_wgs84:function(a){if(this.datum_type===Sc)a.x+=this.datum_params[0],a.y+=this.datum_params[1],a.z+=this.datum_params[2];else if(this.datum_type===Tc){var n=this.datum_params[0],c=this.datum_params[1],f=this.datum_params[2],_=this.datum_params[3],w=this.datum_params[4],I=this.datum_params[5],l=this.datum_params[6],D=l*(a.x-I*a.y+w*a.z)+n,B=l*(I*a.x+a.y-_*a.z)+c,J=l*(-w*a.x+_*a.y+a.z)+f;a.x=D,a.y=B,a.z=J}},geocentric_from_wgs84:function(a){if(this.datum_type===Sc)a.x-=this.datum_params[0],a.y-=this.datum_params[1],a.z-=this.datum_params[2];else if(this.datum_type===Tc){var n=this.datum_params[0],c=this.datum_params[1],f=this.datum_params[2],_=this.datum_params[3],w=this.datum_params[4],I=this.datum_params[5],l=this.datum_params[6],D=(a.x-n)/l,B=(a.y-c)/l,J=(a.z-f)/l;a.x=D+I*B-w*J,a.y=-I*D+B+_*J,a.z=w*D-_*B+J}}};var e1=Oc,t1=Ri,mu=ht,i1=Ku,r1=e1,n1=1e-10,o1=.16666666666666666,a1=.04722222222222222,s1=.022156084656084655,l1=function(a){if(a.datumCode&&a.datumCode!=="none"){var n=t1[a.datumCode];n&&(a.datum_params=n.towgs84?n.towgs84.split(","):null,a.ellps=n.ellipse,a.datumName=n.datumName?n.datumName:a.datumCode)}if(!a.a){var c=mu[a.ellps]?mu[a.ellps]:mu.WGS84;i1(a,c)}return a.rf&&!a.b&&(a.b=(1-1/a.rf)*a.a),(a.rf===0||Math.abs(a.a-a.b)<n1)&&(a.sphere=!0,a.b=a.a),a.a2=a.a*a.a,a.b2=a.b*a.b,a.es=(a.a2-a.b2)/a.a2,a.e=Math.sqrt(a.es),a.R_A&&(a.a*=1-a.es*(o1+a.es*(a1+a.es*s1)),a.a2=a.a*a.a,a.b2=a.b*a.b,a.es=0),a.ep2=(a.a2-a.b2)/a.b2,a.k0||(a.k0=1),a.axis||(a.axis="enu"),a.datum||(a.datum=r1(a)),a},c1=Fv,nm=Ku,h1=jc,u1=l1;function Fa(a,n){if(!(this instanceof Fa))return new Fa(a);n=n||function(w){if(w)throw w};var c=c1(a);if(typeof c!="object"){n(a);return}var f=u1(c),_=Fa.projections.get(f.projName);_?(nm(this,f),nm(this,_),this.init(),n(null,this)):n(a)}Fa.projections=h1;Fa.projections.start();var Ju=Fa,om=1,am=2,fu=3,sm=5,lm=6378137,cm=.006694379990141316,d1=function(a,n,c){var f,_,w;function I(Z){return Z===om||Z===am}if(a.compare_datums(n)||a.datum_type===sm||n.datum_type===sm)return c;var l=a.a,D=a.es,B=n.a,J=n.es,K=a.datum_type;if(K===fu)if(this.apply_gridshift(a,0,c)===0)a.a=lm,a.es=cm;else{if(!a.datum_params)return a.a=l,a.es=a.es,c;for(f=1,_=0,w=a.datum_params.length;_<w;_++)f*=a.datum_params[_];if(f===0)return a.a=l,a.es=a.es,c;a.datum_params.length>3?K=am:K=om}return n.datum_type===fu&&(n.a=lm,n.es=cm),(a.es!==n.es||a.a!==n.a||I(K)||I(n.datum_type))&&(a.geodetic_to_geocentric(c),I(a.datum_type)&&a.geocentric_to_wgs84(c),I(n.datum_type)&&n.geocentric_from_wgs84(c),n.geocentric_to_geodetic(c)),n.datum_type===fu&&this.apply_gridshift(n,1,c),a.a=l,a.es=D,n.a=B,n.es=J,c},p1=function(a,n,c){var f=c.x,_=c.y,w=c.z||0,I,l,D;for(D=0;D<3;D++)if(!(n&&D===2&&c.z===void 0))switch(D===0?(I=f,l="x"):D===1?(I=_,l="y"):(I=w,l="z"),a.axis[D]){case"e":c[l]=I;break;case"w":c[l]=-I;break;case"n":c[l]=I;break;case"s":c[l]=-I;break;case"u":c[l]!==void 0&&(c.z=I);break;case"d":c[l]!==void 0&&(c.z=-I);break;default:return null}return c},Yf=function(a){var n={x:a[0],y:a[1]};return a.length>2&&(n.z=a[2]),a.length>3&&(n.m=a[3]),n},hm=.017453292519943295,um=57.29577951308232,m1=1,f1=2,g1=d1,dm=p1,y1=Ju,_1=Yf,Kf=function a(n,c,f){var _;Array.isArray(f)&&(f=_1(f));function w(I,l){return(I.datum.datum_type===m1||I.datum.datum_type===f1)&&l.datumCode!=="WGS84"}return n.datum&&c.datum&&(w(n,c)||w(c,n))&&(_=new y1("WGS84"),a(n,_,f),n=_),n.axis!=="enu"&&dm(n,!1,f),n.projName==="longlat"?(f.x*=hm,f.y*=hm):(n.to_meter&&(f.x*=n.to_meter,f.y*=n.to_meter),n.inverse(f)),n.from_greenwich&&(f.x+=n.from_greenwich),f=g1(n.datum,c.datum,f),c.from_greenwich&&(f.x-=c.from_greenwich),c.projName==="longlat"?(f.x*=um,f.y*=um):(c.forward(f),c.to_meter&&(f.x/=c.to_meter,f.y/=c.to_meter)),c.axis!=="enu"&&dm(c,!0,f),f},zu=Ju,pm=Kf,mm=zu("WGS84");function gu(a,n,c){var f;return Array.isArray(c)?(f=pm(a,n,c),c.length===3?[f.x,f.y,f.z]:[f.x,f.y]):pm(a,n,c)}function fm(a){return a instanceof zu?a:a.oProj?a.oProj:zu(a)}function x1(a,n,c){a=fm(a);var f=!1,_;return typeof n>"u"?(n=a,a=mm,f=!0):(typeof n.x<"u"||Array.isArray(n))&&(c=n,n=a,a=mm,f=!0),n=fm(n),c?gu(a,n,c):(_={forward:function(w){return gu(a,n,w)},inverse:function(w){return gu(n,a,w)}},f&&(_.oProj=n),_)}var v1=x1,ul={},gm=6,Jf="AJSAJS",Qf="AFAFAF",Ra=65,ur=73,Br=79,el=86,tl=90;ul.forward=function(a,n){return n=n||5,S1(b1({lat:a[1],lon:a[0]}),n)};ul.inverse=function(a){var n=Qu(tg(a.toUpperCase()));return n.lat&&n.lon?[n.lon,n.lat,n.lon,n.lat]:[n.left,n.bottom,n.right,n.top]};ul.toPoint=function(a){var n=Qu(tg(a.toUpperCase()));return n.lat&&n.lon?[n.lon,n.lat]:[(n.left+n.right)/2,(n.top+n.bottom)/2]};function yu(a){return a*(Math.PI/180)}function ym(a){return 180*(a/Math.PI)}function b1(a){var n=a.lat,c=a.lon,f=6378137,_=.00669438,w=.9996,I,l,D,B,J,K,Z,we=yu(n),be=yu(c),Ae,Fe;Fe=Math.floor((c+180)/6)+1,c===180&&(Fe=60),n>=56&&n<64&&c>=3&&c<12&&(Fe=32),n>=72&&n<84&&(c>=0&&c<9?Fe=31:c>=9&&c<21?Fe=33:c>=21&&c<33?Fe=35:c>=33&&c<42&&(Fe=37)),I=(Fe-1)*6-180+3,Ae=yu(I),l=_/(1-_),D=f/Math.sqrt(1-_*Math.sin(we)*Math.sin(we)),B=Math.tan(we)*Math.tan(we),J=l*Math.cos(we)*Math.cos(we),K=Math.cos(we)*(be-Ae),Z=f*((1-_/4-3*_*_/64-5*_*_*_/256)*we-(3*_/8+3*_*_/32+45*_*_*_/1024)*Math.sin(2*we)+(15*_*_/256+45*_*_*_/1024)*Math.sin(4*we)-35*_*_*_/3072*Math.sin(6*we));var $e=w*D*(K+(1-B+J)*K*K*K/6+(5-18*B+B*B+72*J-58*l)*K*K*K*K*K/120)+5e5,Ve=w*(Z+D*Math.tan(we)*(K*K/2+(5-B+9*J+4*J*J)*K*K*K*K/24+(61-58*B+B*B+600*J-330*l)*K*K*K*K*K*K/720));return n<0&&(Ve+=1e7),{northing:Math.round(Ve),easting:Math.round($e),zoneNumber:Fe,zoneLetter:w1(n)}}function Qu(a){var n=a.northing,c=a.easting,f=a.zoneLetter,_=a.zoneNumber;if(_<0||_>60)return null;var w=.9996,I=6378137,l=.00669438,D,B=(1-Math.sqrt(1-l))/(1+Math.sqrt(1-l)),J,K,Z,we,be,Ae,Fe,$e,Ve,Ge=c-5e5,lt=n;f<"N"&&(lt-=1e7),Fe=(_-1)*6-180+3,D=l/(1-l),Ae=lt/w,$e=Ae/(I*(1-l/4-3*l*l/64-5*l*l*l/256)),Ve=$e+(3*B/2-27*B*B*B/32)*Math.sin(2*$e)+(21*B*B/16-55*B*B*B*B/32)*Math.sin(4*$e)+151*B*B*B/96*Math.sin(6*$e),J=I/Math.sqrt(1-l*Math.sin(Ve)*Math.sin(Ve)),K=Math.tan(Ve)*Math.tan(Ve),Z=D*Math.cos(Ve)*Math.cos(Ve),we=I*(1-l)/Math.pow(1-l*Math.sin(Ve)*Math.sin(Ve),1.5),be=Ge/(J*w);var rt=Ve-J*Math.tan(Ve)/we*(be*be/2-(5+3*K+10*Z-4*Z*Z-9*D)*be*be*be*be/24+(61+90*K+298*Z+45*K*K-252*D-3*Z*Z)*be*be*be*be*be*be/720);rt=ym(rt);var Xe=(be-(1+2*K+Z)*be*be*be/6+(5-2*Z+28*K-3*Z*Z+8*D+24*K*K)*be*be*be*be*be/120)/Math.cos(Ve);Xe=Fe+ym(Xe);var xt;if(a.accuracy){var At=Qu({northing:a.northing+a.accuracy,easting:a.easting+a.accuracy,zoneLetter:a.zoneLetter,zoneNumber:a.zoneNumber});xt={top:At.lat,right:At.lon,bottom:rt,left:Xe}}else xt={lat:rt,lon:Xe};return xt}function w1(a){var n="Z";return 84>=a&&a>=72?n="X":72>a&&a>=64?n="W":64>a&&a>=56?n="V":56>a&&a>=48?n="U":48>a&&a>=40?n="T":40>a&&a>=32?n="S":32>a&&a>=24?n="R":24>a&&a>=16?n="Q":16>a&&a>=8?n="P":8>a&&a>=0?n="N":0>a&&a>=-8?n="M":-8>a&&a>=-16?n="L":-16>a&&a>=-24?n="K":-24>a&&a>=-32?n="J":-32>a&&a>=-40?n="H":-40>a&&a>=-48?n="G":-48>a&&a>=-56?n="F":-56>a&&a>=-64?n="E":-64>a&&a>=-72?n="D":-72>a&&a>=-80&&(n="C"),n}function S1(a,n){var c="00000"+a.easting,f="00000"+a.northing;return a.zoneNumber+a.zoneLetter+T1(a.easting,a.northing,a.zoneNumber)+c.substr(c.length-5,n)+f.substr(f.length-5,n)}function T1(a,n,c){var f=eg(c),_=Math.floor(a/1e5),w=Math.floor(n/1e5)%20;return C1(_,w,f)}function eg(a){var n=a%gm;return n===0&&(n=gm),n}function C1(a,n,c){var f=c-1,_=Jf.charCodeAt(f),w=Qf.charCodeAt(f),I=_+a-1,l=w+n,D=!1;I>tl&&(I=I-tl+Ra-1,D=!0),(I===ur||_<ur&&I>ur||(I>ur||_<ur)&&D)&&I++,(I===Br||_<Br&&I>Br||(I>Br||_<Br)&&D)&&(I++,I===ur&&I++),I>tl&&(I=I-tl+Ra-1),l>el?(l=l-el+Ra-1,D=!0):D=!1,(l===ur||w<ur&&l>ur||(l>ur||w<ur)&&D)&&l++,(l===Br||w<Br&&l>Br||(l>Br||w<Br)&&D)&&(l++,l===ur&&l++),l>el&&(l=l-el+Ra-1);var B=String.fromCharCode(I)+String.fromCharCode(l);return B}function tg(a){if(a&&a.length===0)throw"MGRSPoint coverting from nothing";for(var n=a.length,c=null,f="",_,w=0;!/[A-Z]/.test(_=a.charAt(w));){if(w>=2)throw"MGRSPoint bad conversion from: "+a;f+=_,w++}var I=parseInt(f,10);if(w===0||w+3>n)throw"MGRSPoint bad conversion from: "+a;var l=a.charAt(w++);if(l<="A"||l==="B"||l==="Y"||l>="Z"||l==="I"||l==="O")throw"MGRSPoint zone letter "+l+" not handled: "+a;c=a.substring(w,w+=2);for(var D=eg(I),B=I1(c.charAt(0),D),J=E1(c.charAt(1),D);J<A1(l);)J+=2e6;var K=n-w;if(K%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`+a;var Z=K/2,we=0,be=0,Ae,Fe,$e,Ve,Ge;return Z>0&&(Ae=1e5/Math.pow(10,Z),Fe=a.substring(w,w+Z),we=parseFloat(Fe)*Ae,$e=a.substring(w+Z),be=parseFloat($e)*Ae),Ve=we+B,Ge=be+J,{easting:Ve,northing:Ge,zoneLetter:l,zoneNumber:I,accuracy:Ae}}function I1(a,n){for(var c=Jf.charCodeAt(n-1),f=1e5,_=!1;c!==a.charCodeAt(0);){if(c++,c===ur&&c++,c===Br&&c++,c>tl){if(_)throw"Bad character: "+a;c=Ra,_=!0}f+=1e5}return f}function E1(a,n){if(a>"V")throw"MGRSPoint given invalid Northing "+a;for(var c=Qf.charCodeAt(n-1),f=0,_=!1;c!==a.charCodeAt(0);){if(c++,c===ur&&c++,c===Br&&c++,c>el){if(_)throw"Bad character: "+a;c=Ra,_=!0}f+=1e5}return f}function A1(a){var n;switch(a){case"C":n=11e5;break;case"D":n=2e6;break;case"E":n=28e5;break;case"F":n=37e5;break;case"G":n=46e5;break;case"H":n=55e5;break;case"J":n=64e5;break;case"K":n=73e5;break;case"L":n=82e5;break;case"M":n=91e5;break;case"N":n=0;break;case"P":n=8e5;break;case"Q":n=17e5;break;case"R":n=26e5;break;case"S":n=35e5;break;case"T":n=44e5;break;case"U":n=53e5;break;case"V":n=62e5;break;case"W":n=7e6;break;case"X":n=79e5;break;default:n=-1}if(n>=0)return n;throw"Invalid zone letter: "+a}var ig=ul;function Ba(a,n,c){if(!(this instanceof Ba))return new Ba(a,n,c);if(Array.isArray(a))this.x=a[0],this.y=a[1],this.z=a[2]||0;else if(typeof a=="object")this.x=a.x,this.y=a.y,this.z=a.z||0;else if(typeof a=="string"&&typeof n>"u"){var f=a.split(",");this.x=parseFloat(f[0],10),this.y=parseFloat(f[1],10),this.z=parseFloat(f[2],10)||0}else this.x=a,this.y=n,this.z=c||0;console.warn("proj4.Point will be removed in version 3, use proj4.toPoint")}Ba.fromMGRS=function(a){return new Ba(ig.toPoint(a))};Ba.prototype.toMGRS=function(a){return ig.forward([this.x,this.y],a)};var P1=Ba,Fi={},M1=function(a,n){var c;return a>1e-7?(c=a*n,(1-a*a)*(n/(1-c*c)-.5/a*Math.log((1-c)/(1+c)))):2*n},il=Math.PI/2,z1=Math.PI/4,co=1e-10,ku=M1,rg=jf;Fi.S_POLE=1;Fi.N_POLE=2;Fi.EQUIT=3;Fi.OBLIQ=4;Fi.init=function(){var a=Math.abs(this.lat0);if(Math.abs(a-il)<co?this.mode=this.lat0<0?this.S_POLE:this.N_POLE:Math.abs(a)<co?this.mode=this.EQUIT:this.mode=this.OBLIQ,this.es>0){var n;switch(this.qp=ku(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),n=Math.sin(this.lat0),this.sinb1=ku(this.e,n)/this.qp,this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1),this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*n*n)*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))};Fi.forward=function(a){var n,c,f,_,w,I,l,D,B,J,K=a.x,Z=a.y;if(K=rg(K-this.long0),this.sphere){if(w=Math.sin(Z),J=Math.cos(Z),f=Math.cos(K),this.mode===this.OBLIQ||this.mode===this.EQUIT){if(c=this.mode===this.EQUIT?1+J*f:1+this.sinph0*w+this.cosph0*J*f,c<=co)return null;c=Math.sqrt(2/c),n=c*J*Math.sin(K),c*=this.mode===this.EQUIT?w:this.cosph0*w-this.sinph0*J*f}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(f=-f),Math.abs(Z+this.phi0)<co)return null;c=z1-Z*.5,c=2*(this.mode===this.S_POLE?Math.cos(c):Math.sin(c)),n=c*Math.sin(K),c*=f}}else{switch(l=0,D=0,B=0,f=Math.cos(K),_=Math.sin(K),w=Math.sin(Z),I=ku(this.e,w),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(l=I/this.qp,D=Math.sqrt(1-l*l)),this.mode){case this.OBLIQ:B=1+this.sinb1*l+this.cosb1*D*f;break;case this.EQUIT:B=1+D*f;break;case this.N_POLE:B=il+Z,I=this.qp-I;break;case this.S_POLE:B=Z-il,I=this.qp+I;break}if(Math.abs(B)<co)return null;switch(this.mode){case this.OBLIQ:case this.EQUIT:B=Math.sqrt(2/B),this.mode===this.OBLIQ?c=this.ymf*B*(this.cosb1*l-this.sinb1*D*f):c=(B=Math.sqrt(2/(1+D*f)))*l*this.ymf,n=this.xmf*B*D*_;break;case this.N_POLE:case this.S_POLE:I>=0?(n=(B=Math.sqrt(I))*_,c=f*(this.mode===this.S_POLE?B:-B)):n=c=0;break}}return a.x=this.a*n+this.x0,a.y=this.a*c+this.y0,a};Fi.inverse=function(a){a.x-=this.x0,a.y-=this.y0;var n=a.x/this.a,c=a.y/this.a,f,_,w,I,l,D,B;if(this.sphere){var J=0,K,Z=0;if(K=Math.sqrt(n*n+c*c),_=K*.5,_>1)return null;switch(_=2*Math.asin(_),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(Z=Math.sin(_),J=Math.cos(_)),this.mode){case this.EQUIT:_=Math.abs(K)<=co?0:Math.asin(c*Z/K),n*=Z,c=J*K;break;case this.OBLIQ:_=Math.abs(K)<=co?this.phi0:Math.asin(J*this.sinph0+c*Z*this.cosph0/K),n*=Z*this.cosph0,c=(J-Math.sin(_)*this.sinph0)*K;break;case this.N_POLE:c=-c,_=il-_;break;case this.S_POLE:_-=il;break}f=c===0&&(this.mode===this.EQUIT||this.mode===this.OBLIQ)?0:Math.atan2(n,c)}else{if(B=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(n/=this.dd,c*=this.dd,D=Math.sqrt(n*n+c*c),D<co)return a.x=0,a.y=this.phi0,a;I=2*Math.asin(.5*D/this.rq),w=Math.cos(I),n*=I=Math.sin(I),this.mode===this.OBLIQ?(B=w*this.sinb1+c*I*this.cosb1/D,l=this.qp*B,c=D*this.cosb1*w-c*this.sinb1*I):(B=c*I/D,l=this.qp*B,c=D*w)}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(c=-c),l=n*n+c*c,!l)return a.x=0,a.y=this.phi0,a;B=1-l/this.qp,this.mode===this.S_POLE&&(B=-B)}f=Math.atan2(n,c),_=this.authlat(Math.asin(B),this.apa)}return a.x=rg(this.long0+f),a.y=_,a};Fi.P00=.3333333333333333;Fi.P01=.17222222222222222;Fi.P02=.10257936507936508;Fi.P10=.06388888888888888;Fi.P11=.0664021164021164;Fi.P20=.016415012942191543;Fi.authset=function(a){var n,c=[];return c[0]=a*this.P00,n=a*a,c[0]+=n*this.P01,c[1]=n*this.P10,n*=a,c[0]+=n*this.P02,c[1]+=n*this.P11,c[2]=n*this.P20,c};Fi.authlat=function(a,n){var c=a+a;return a+n[0]*Math.sin(c)+n[1]*Math.sin(c+c)+n[2]*Math.sin(c+c+c)};Fi.names=["Lambert Azimuthal Equal Area","Lambert_Azimuthal_Equal_Area","laea"];var Cr=v1;Cr.defaultDatum="WGS84";Cr.Proj=Ju;Cr.WGS84=new Cr.Proj("WGS84");Cr.Point=P1;Cr.toPoint=Yf;Cr.defs=Zf;Cr.transform=Kf;Cr.mgrs=ul;Cr.version="2.3.12";Cr.Proj.projections.add(Fi);Cr.Proj.projections.add($a);var k1=Cr,_m=k1,ed={};(function(a){Object.defineProperty(a,"__esModule",{value:!0}),a.getWeatherSymbolId=a.convertSymbolKeyToId=a.weatherSymbolKeys=void 0,a.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 n(f){var _;return(_=a.weatherSymbolKeys[f])!==null&&_!==void 0?_:void 0}a.convertSymbolKeyToId=n;function c(f){if(!(f==null||f.n==null)){var _=String(f.n).padStart(2,"0");switch(f.var){case"Sun":_+="d";break;case"PolarNight":_+="m";break;case"Moon":_+="n";break}return _}}a.getWeatherSymbolId=c})(ed);const xm=[-2002637639e-2,-200489661e-1,2002637639e-2,200489661e-1];function L1({currentLocation:a,locations:n,activeIntervalIndex:c,units:f}){const _=xm[0],w=xm[2],I=Math.abs(_)+Math.abs(w),l=_m("EPSG:4326","EPSG:3857",{x:a.position.lon,y:a.position.lat});return Object.keys(n).map(D=>{var B;const J=n[D],K=J.intervals[c];if(J.isCurrentLocation===!0||K.wind==null||K.symbol==null||K.temperature==null)return null;const Z=J.name,we=df(a.position,J.position,{unit:f.distance==="metric"?"km":"mi"}),be=_m("EPSG:4326","EPSG:3857",{x:J.position.lon,y:J.position.lat}),Ae=D1(l,be,I);return{name:Z,distance:we,direction:Jp(Ae),temperature:Yu({value:(B=K.temperature)===null||B===void 0?void 0:B.value,unit:f.temperature,decimal:!1}),symbol:ed.getWeatherSymbolId(K.symbol),wind:{speed:Uf({value:K.wind.speed,unit:f.wind,decimal:!1}),direction:Jp(K.wind.direction),type:vv(K.wind.speed)},weight:J.weight}}).filter(bv).sort((D,B)=>B.weight-D.weight).slice(0,3)}function D1(a,n,c){let f=n.x-a.x;f=Math.abs(f)<c/2?f:f-Math.sign(f)*c;const _=Math.atan2(n.y-a.y,f),w=dv(_);return pv(w)}function R1(){this.__data__=[],this.size=0}var F1=R1;function B1(a,n){return a===n||a!==a&&n!==n}var ng=B1,O1=ng;function U1(a,n){for(var c=a.length;c--;)if(O1(a[c][0],n))return c;return-1}var qc=U1,$1=qc,N1=Array.prototype,V1=N1.splice;function G1(a){var n=this.__data__,c=$1(n,a);if(c<0)return!1;var f=n.length-1;return c==f?n.pop():V1.call(n,c,1),--this.size,!0}var Z1=G1,H1=qc;function j1(a){var n=this.__data__,c=H1(n,a);return c<0?void 0:n[c][1]}var q1=j1,W1=qc;function X1(a){return W1(this.__data__,a)>-1}var Y1=X1,K1=qc;function J1(a,n){var c=this.__data__,f=K1(c,a);return f<0?(++this.size,c.push([a,n])):c[f][1]=n,this}var Q1=J1,eb=F1,tb=Z1,ib=q1,rb=Y1,nb=Q1;function Na(a){var n=-1,c=a==null?0:a.length;for(this.clear();++n<c;){var f=a[n];this.set(f[0],f[1])}}Na.prototype.clear=eb;Na.prototype.delete=tb;Na.prototype.get=ib;Na.prototype.has=rb;Na.prototype.set=nb;var Wc=Na,ob=Wc;function ab(){this.__data__=new ob,this.size=0}var sb=ab;function lb(a){var n=this.__data__,c=n.delete(a);return this.size=n.size,c}var cb=lb;function hb(a){return this.__data__.get(a)}var ub=hb;function db(a){return this.__data__.has(a)}var pb=db,mb=al,fb=ol,gb="[object AsyncFunction]",yb="[object Function]",_b="[object GeneratorFunction]",xb="[object Proxy]";function vb(a){if(!fb(a))return!1;var n=mb(a);return n==yb||n==_b||n==gb||n==xb}var og=vb,bb=ln,wb=bb["__core-js_shared__"],Sb=wb,_u=Sb,vm=function(){var a=/[^.]+$/.exec(_u&&_u.keys&&_u.keys.IE_PROTO||"");return a?"Symbol(src)_1."+a:""}();function Tb(a){return!!vm&&vm in a}var Cb=Tb,Ib=Function.prototype,Eb=Ib.toString;function Ab(a){if(a!=null){try{return Eb.call(a)}catch{}try{return a+""}catch{}}return""}var ag=Ab,Pb=og,Mb=Cb,zb=ol,kb=ag,Lb=/[\\^$.*+?()[\]{}|]/g,Db=/^\[object .+?Constructor\]$/,Rb=Function.prototype,Fb=Object.prototype,Bb=Rb.toString,Ob=Fb.hasOwnProperty,Ub=RegExp("^"+Bb.call(Ob).replace(Lb,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function $b(a){if(!zb(a)||Mb(a))return!1;var n=Pb(a)?Ub:Db;return n.test(kb(a))}var Nb=$b;function Vb(a,n){return a?.[n]}var Gb=Vb,Zb=Nb,Hb=Gb;function jb(a,n){var c=Hb(a,n);return Zb(c)?c:void 0}var Va=jb,qb=Va,Wb=ln,Xb=qb(Wb,"Map"),td=Xb,Yb=Va,Kb=Yb(Object,"create"),Xc=Kb,bm=Xc;function Jb(){this.__data__=bm?bm(null):{},this.size=0}var Qb=Jb;function ew(a){var n=this.has(a)&&delete this.__data__[a];return this.size-=n?1:0,n}var tw=ew,iw=Xc,rw="__lodash_hash_undefined__",nw=Object.prototype,ow=nw.hasOwnProperty;function aw(a){var n=this.__data__;if(iw){var c=n[a];return c===rw?void 0:c}return ow.call(n,a)?n[a]:void 0}var sw=aw,lw=Xc,cw=Object.prototype,hw=cw.hasOwnProperty;function uw(a){var n=this.__data__;return lw?n[a]!==void 0:hw.call(n,a)}var dw=uw,pw=Xc,mw="__lodash_hash_undefined__";function fw(a,n){var c=this.__data__;return this.size+=this.has(a)?0:1,c[a]=pw&&n===void 0?mw:n,this}var gw=fw,yw=Qb,_w=tw,xw=sw,vw=dw,bw=gw;function Ga(a){var n=-1,c=a==null?0:a.length;for(this.clear();++n<c;){var f=a[n];this.set(f[0],f[1])}}Ga.prototype.clear=yw;Ga.prototype.delete=_w;Ga.prototype.get=xw;Ga.prototype.has=vw;Ga.prototype.set=bw;var ww=Ga,wm=ww,Sw=Wc,Tw=td;function Cw(){this.size=0,this.__data__={hash:new wm,map:new(Tw||Sw),string:new wm}}var Iw=Cw;function Ew(a){var n=typeof a;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?a!=="__proto__":a===null}var Aw=Ew,Pw=Aw;function Mw(a,n){var c=a.__data__;return Pw(n)?c[typeof n=="string"?"string":"hash"]:c.map}var Yc=Mw,zw=Yc;function kw(a){var n=zw(this,a).delete(a);return this.size-=n?1:0,n}var Lw=kw,Dw=Yc;function Rw(a){return Dw(this,a).get(a)}var Fw=Rw,Bw=Yc;function Ow(a){return Bw(this,a).has(a)}var Uw=Ow,$w=Yc;function Nw(a,n){var c=$w(this,a),f=c.size;return c.set(a,n),this.size+=c.size==f?0:1,this}var Vw=Nw,Gw=Iw,Zw=Lw,Hw=Fw,jw=Uw,qw=Vw;function Za(a){var n=-1,c=a==null?0:a.length;for(this.clear();++n<c;){var f=a[n];this.set(f[0],f[1])}}Za.prototype.clear=Gw;Za.prototype.delete=Zw;Za.prototype.get=Hw;Za.prototype.has=jw;Za.prototype.set=qw;var sg=Za,Ww=Wc,Xw=td,Yw=sg,Kw=200;function Jw(a,n){var c=this.__data__;if(c instanceof Ww){var f=c.__data__;if(!Xw||f.length<Kw-1)return f.push([a,n]),this.size=++c.size,this;c=this.__data__=new Yw(f)}return c.set(a,n),this.size=c.size,this}var Qw=Jw,e2=Wc,t2=sb,i2=cb,r2=ub,n2=pb,o2=Qw;function Ha(a){var n=this.__data__=new e2(a);this.size=n.size}Ha.prototype.clear=t2;Ha.prototype.delete=i2;Ha.prototype.get=r2;Ha.prototype.has=n2;Ha.prototype.set=o2;var a2=Ha,s2="__lodash_hash_undefined__";function l2(a){return this.__data__.set(a,s2),this}var c2=l2;function h2(a){return this.__data__.has(a)}var u2=h2,d2=sg,p2=c2,m2=u2;function Uc(a){var n=-1,c=a==null?0:a.length;for(this.__data__=new d2;++n<c;)this.add(a[n])}Uc.prototype.add=Uc.prototype.push=p2;Uc.prototype.has=m2;var f2=Uc;function g2(a,n){for(var c=-1,f=a==null?0:a.length;++c<f;)if(n(a[c],c,a))return!0;return!1}var y2=g2;function _2(a,n){return a.has(n)}var x2=_2,v2=f2,b2=y2,w2=x2,S2=1,T2=2;function C2(a,n,c,f,_,w){var I=c&S2,l=a.length,D=n.length;if(l!=D&&!(I&&D>l))return!1;var B=w.get(a),J=w.get(n);if(B&&J)return B==n&&J==a;var K=-1,Z=!0,we=c&T2?new v2:void 0;for(w.set(a,n),w.set(n,a);++K<l;){var be=a[K],Ae=n[K];if(f)var Fe=I?f(Ae,be,K,n,a,w):f(be,Ae,K,a,n,w);if(Fe!==void 0){if(Fe)continue;Z=!1;break}if(we){if(!b2(n,function($e,Ve){if(!w2(we,Ve)&&(be===$e||_(be,$e,c,f,w)))return we.push(Ve)})){Z=!1;break}}else if(!(be===Ae||_(be,Ae,c,f,w))){Z=!1;break}}return w.delete(a),w.delete(n),Z}var lg=C2,I2=ln,E2=I2.Uint8Array,A2=E2;function P2(a){var n=-1,c=Array(a.size);return a.forEach(function(f,_){c[++n]=[_,f]}),c}var M2=P2;function z2(a){var n=-1,c=Array(a.size);return a.forEach(function(f){c[++n]=f}),c}var k2=z2,Sm=ju,Tm=A2,L2=ng,D2=lg,R2=M2,F2=k2,B2=1,O2=2,U2="[object Boolean]",$2="[object Date]",N2="[object Error]",V2="[object Map]",G2="[object Number]",Z2="[object RegExp]",H2="[object Set]",j2="[object String]",q2="[object Symbol]",W2="[object ArrayBuffer]",X2="[object DataView]",Cm=Sm?Sm.prototype:void 0,xu=Cm?Cm.valueOf:void 0;function Y2(a,n,c,f,_,w,I){switch(c){case X2:if(a.byteLength!=n.byteLength||a.byteOffset!=n.byteOffset)return!1;a=a.buffer,n=n.buffer;case W2:return!(a.byteLength!=n.byteLength||!w(new Tm(a),new Tm(n)));case U2:case $2:case G2:return L2(+a,+n);case N2:return a.name==n.name&&a.message==n.message;case Z2:case j2:return a==n+"";case V2:var l=R2;case H2:var D=f&B2;if(l||(l=F2),a.size!=n.size&&!D)return!1;var B=I.get(a);if(B)return B==n;f|=O2,I.set(a,n);var J=D2(l(a),l(n),f,_,w,I);return I.delete(a),J;case q2:if(xu)return xu.call(a)==xu.call(n)}return!1}var K2=Y2;function J2(a,n){for(var c=-1,f=n.length,_=a.length;++c<f;)a[_+c]=n[c];return a}var Q2=J2,eS=Array.isArray,id=eS,tS=Q2,iS=id;function rS(a,n,c){var f=n(a);return iS(a)?f:tS(f,c(a))}var nS=rS;function oS(a,n){for(var c=-1,f=a==null?0:a.length,_=0,w=[];++c<f;){var I=a[c];n(I,c,a)&&(w[_++]=I)}return w}var aS=oS;function sS(){return[]}var lS=sS,cS=aS,hS=lS,uS=Object.prototype,dS=uS.propertyIsEnumerable,Im=Object.getOwnPropertySymbols,pS=Im?function(a){return a==null?[]:(a=Object(a),cS(Im(a),function(n){return dS.call(a,n)}))}:hS,mS=pS;function fS(a,n){for(var c=-1,f=Array(a);++c<a;)f[c]=n(c);return f}var gS=fS,yS=al,_S=sl,xS="[object Arguments]";function vS(a){return _S(a)&&yS(a)==xS}var bS=vS,Em=bS,wS=sl,cg=Object.prototype,SS=cg.hasOwnProperty,TS=cg.propertyIsEnumerable,CS=Em(function(){return arguments}())?Em:function(a){return wS(a)&&SS.call(a,"callee")&&!TS.call(a,"callee")},IS=CS,$c={exports:{}};function ES(){return!1}var AS=ES;(function(a,n){var c=ln,f=AS,_=n&&!n.nodeType&&n,w=_&&!0&&a&&!a.nodeType&&a,I=w&&w.exports===_,l=I?c.Buffer:void 0,D=l?l.isBuffer:void 0,B=D||f;a.exports=B})($c,$c.exports);var PS=9007199254740991,MS=/^(?:0|[1-9]\d*)$/;function zS(a,n){var c=typeof a;return n=n??PS,!!n&&(c=="number"||c!="symbol"&&MS.test(a))&&a>-1&&a%1==0&&a<n}var kS=zS,LS=9007199254740991;function DS(a){return typeof a=="number"&&a>-1&&a%1==0&&a<=LS}var hg=DS,RS=al,FS=hg,BS=sl,OS="[object Arguments]",US="[object Array]",$S="[object Boolean]",NS="[object Date]",VS="[object Error]",GS="[object Function]",ZS="[object Map]",HS="[object Number]",jS="[object Object]",qS="[object RegExp]",WS="[object Set]",XS="[object String]",YS="[object WeakMap]",KS="[object ArrayBuffer]",JS="[object DataView]",QS="[object Float32Array]",eT="[object Float64Array]",tT="[object Int8Array]",iT="[object Int16Array]",rT="[object Int32Array]",nT="[object Uint8Array]",oT="[object Uint8ClampedArray]",aT="[object Uint16Array]",sT="[object Uint32Array]",qt={};qt[QS]=qt[eT]=qt[tT]=qt[iT]=qt[rT]=qt[nT]=qt[oT]=qt[aT]=qt[sT]=!0;qt[OS]=qt[US]=qt[KS]=qt[$S]=qt[JS]=qt[NS]=qt[VS]=qt[GS]=qt[ZS]=qt[HS]=qt[jS]=qt[qS]=qt[WS]=qt[XS]=qt[YS]=!1;function lT(a){return BS(a)&&FS(a.length)&&!!qt[RS(a)]}var cT=lT;function hT(a){return function(n){return a(n)}}var uT=hT,Lu={exports:{}};(function(a,n){var c=Tf,f=n&&!n.nodeType&&n,_=f&&!0&&a&&!a.nodeType&&a,w=_&&_.exports===f,I=w&&c.process,l=function(){try{var D=_&&_.require&&_.require("util").types;return D||I&&I.binding&&I.binding("util")}catch{}}();a.exports=l})(Lu,Lu.exports);var dT=cT,pT=uT,Am=Lu.exports,Pm=Am&&Am.isTypedArray,mT=Pm?pT(Pm):dT,ug=mT,fT=gS,gT=IS,yT=id,_T=$c.exports,xT=kS,vT=ug,bT=Object.prototype,wT=bT.hasOwnProperty;function ST(a,n){var c=yT(a),f=!c&&gT(a),_=!c&&!f&&_T(a),w=!c&&!f&&!_&&vT(a),I=c||f||_||w,l=I?fT(a.length,String):[],D=l.length;for(var B in a)(n||wT.call(a,B))&&!(I&&(B=="length"||_&&(B=="offset"||B=="parent")||w&&(B=="buffer"||B=="byteLength"||B=="byteOffset")||xT(B,D)))&&l.push(B);return l}var TT=ST,CT=Object.prototype;function IT(a){var n=a&&a.constructor,c=typeof n=="function"&&n.prototype||CT;return a===c}var ET=IT;function AT(a,n){return function(c){return a(n(c))}}var PT=AT,MT=PT,zT=MT(Object.keys,Object),kT=zT,LT=ET,DT=kT,RT=Object.prototype,FT=RT.hasOwnProperty;function BT(a){if(!LT(a))return DT(a);var n=[];for(var c in Object(a))FT.call(a,c)&&c!="constructor"&&n.push(c);return n}var OT=BT,UT=og,$T=hg;function NT(a){return a!=null&&$T(a.length)&&!UT(a)}var VT=NT,GT=TT,ZT=OT,HT=VT;function jT(a){return HT(a)?GT(a):ZT(a)}var qT=jT,WT=nS,XT=mS,YT=qT;function KT(a){return WT(a,YT,XT)}var JT=KT,Mm=JT,QT=1,eC=Object.prototype,tC=eC.hasOwnProperty;function iC(a,n,c,f,_,w){var I=c&QT,l=Mm(a),D=l.length,B=Mm(n),J=B.length;if(D!=J&&!I)return!1;for(var K=D;K--;){var Z=l[K];if(!(I?Z in n:tC.call(n,Z)))return!1}var we=w.get(a),be=w.get(n);if(we&&be)return we==n&&be==a;var Ae=!0;w.set(a,n),w.set(n,a);for(var Fe=I;++K<D;){Z=l[K];var $e=a[Z],Ve=n[Z];if(f)var Ge=I?f(Ve,$e,Z,n,a,w):f($e,Ve,Z,a,n,w);if(!(Ge===void 0?$e===Ve||_($e,Ve,c,f,w):Ge)){Ae=!1;break}Fe||(Fe=Z=="constructor")}if(Ae&&!Fe){var lt=a.constructor,rt=n.constructor;lt!=rt&&"constructor"in a&&"constructor"in n&&!(typeof lt=="function"&&lt instanceof lt&&typeof rt=="function"&&rt instanceof rt)&&(Ae=!1)}return w.delete(a),w.delete(n),Ae}var rC=iC,nC=Va,oC=ln,aC=nC(oC,"DataView"),sC=aC,lC=Va,cC=ln,hC=lC(cC,"Promise"),uC=hC,dC=Va,pC=ln,mC=dC(pC,"Set"),fC=mC,gC=Va,yC=ln,_C=gC(yC,"WeakMap"),xC=_C,Du=sC,Ru=td,Fu=uC,Bu=fC,Ou=xC,dg=al,ja=ag,zm="[object Map]",vC="[object Object]",km="[object Promise]",Lm="[object Set]",Dm="[object WeakMap]",Rm="[object DataView]",bC=ja(Du),wC=ja(Ru),SC=ja(Fu),TC=ja(Bu),CC=ja(Ou),Vo=dg;(Du&&Vo(new Du(new ArrayBuffer(1)))!=Rm||Ru&&Vo(new Ru)!=zm||Fu&&Vo(Fu.resolve())!=km||Bu&&Vo(new Bu)!=Lm||Ou&&Vo(new Ou)!=Dm)&&(Vo=function(a){var n=dg(a),c=n==vC?a.constructor:void 0,f=c?ja(c):"";if(f)switch(f){case bC:return Rm;case wC:return zm;case SC:return km;case TC:return Lm;case CC:return Dm}return n});var IC=Vo,vu=a2,EC=lg,AC=K2,PC=rC,Fm=IC,Bm=id,Om=$c.exports,MC=ug,zC=1,Um="[object Arguments]",$m="[object Array]",yc="[object Object]",kC=Object.prototype,Nm=kC.hasOwnProperty;function LC(a,n,c,f,_,w){var I=Bm(a),l=Bm(n),D=I?$m:Fm(a),B=l?$m:Fm(n);D=D==Um?yc:D,B=B==Um?yc:B;var J=D==yc,K=B==yc,Z=D==B;if(Z&&Om(a)){if(!Om(n))return!1;I=!0,J=!1}if(Z&&!J)return w||(w=new vu),I||MC(a)?EC(a,n,c,f,_,w):AC(a,n,D,c,f,_,w);if(!(c&zC)){var we=J&&Nm.call(a,"__wrapped__"),be=K&&Nm.call(n,"__wrapped__");if(we||be){var Ae=we?a.value():a,Fe=be?n.value():n;return w||(w=new vu),_(Ae,Fe,c,f,w)}}return Z?(w||(w=new vu),PC(a,n,c,f,_,w)):!1}var DC=LC,RC=DC,Vm=sl;function pg(a,n,c,f,_){return a===n?!0:a==null||n==null||!Vm(a)&&!Vm(n)?a!==a&&n!==n:RC(a,n,c,f,pg,_)}var FC=pg,BC=FC;function OC(a,n){return BC(a,n)}var UC=OC;function $C({name:a,maxLength:n=15}){if((a=a.trim()).length<=n)return[a];const c=a.split(" "),f=[];for(const w of c)if(f.push(w),f.join(" ").length>n){f.pop();break}const _=c.slice(f.length);if(f.length===0){const w=_.shift();if(w==null)throw new Error("Wrapping word not found");const I=w.slice(0,n),l=w.slice(n);f.push(I),_.unshift(l)}return[f.join(" "),GC({line:_.join(" "),maxLength:n})]}function NC(a){const n=Math.ceil(Math.sqrt(a)),c=Math.ceil(a/n);return{width:n*kc,height:c*Lc,columns:n,rows:c}}function VC({sprite:a,spriteSheet:n}){const c=a.x/n.width,f=(a.x+a.width)/n.width,_=a.y/n.height,w=(a.y+a.height)/n.height;return{topLeft:{x:c,y:_},topRight:{x:f,y:_},bottomRight:{x:f,y:w},bottomLeft:{x:c,y:w}}}function GC({line:a,maxLength:n}){return a.length<=n?a:`${a.slice(0,n-1)}\u2026`}const Dt={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}}},ZC={mps:"m/s",kmh:"km/h",mph:"mph",knots:"kn",beaufort:"B"};class HC{constructor({pixelRatio:n,theme:c,units:f,weatherSymbolsPath:_,onChange:w,activeIntervalIndex:I}){this.uvCoordinates=[],this.showWeight=!1,this.showSpriteOutline=!1,this.locations=[],this.pixelRatio=n,this.theme=c,this.units=f,this.weatherSymbolsPath=_,this.activeIntervalIndex=I,this.onChange=w,this.canvas=ho({width:0,height:0}),this.context=Un({canvas:this.canvas,pixelRatio:this.pixelRatio}),this.imageCache=new Rf({onLoad:()=>{this.draw()}}),ff({canvas:this.canvas})}toggleCanvasDebugView(n){this.canvas.style.display=n?"":"none"}setUnits(n){this.units=n,this.draw()}setShowWeight(n){this.showWeight=n,this.draw()}setShowSpriteOutline(n){this.showSpriteOutline=n,this.draw()}setLocations(n){this.locations=Object.values(n),this.draw()}setActiveIntervalIndex(n){n!==this.activeIntervalIndex&&(this.activeIntervalIndex=n,this.draw())}draw(){const{width:n,height:c,columns:f,rows:_}=NC(this.locations.length);On({canvas:this.canvas,width:n,height:c,pixelRatio:this.pixelRatio}),this.context=Un({canvas:this.canvas,pixelRatio:this.pixelRatio}),this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.uvCoordinates=[];for(let w=0;w<_;w++)for(let I=0;I<f;I++){const l=w*f+I,D=this.locations[l];if(D==null)continue;const B={x:I*kc,y:w*Lc,width:kc,height:Lc};if(this.context.save(),this.context.beginPath(),this.context.rect(B.x,B.y,B.width,B.height),this.context.clip(),this.showSpriteOutline&&(this.context.beginPath(),this.context.strokeStyle="hotpink",this.context.lineWidth=2,this.context.rect(B.x,B.y,B.width,B.height),this.context.stroke()),this.activeIntervalIndex!=null){const J=D.intervals[this.activeIntervalIndex];this.drawSprite({sprite:B,location:D,interval:J})}this.uvCoordinates.push(VC({sprite:B,spriteSheet:{width:n,height:c}})),this.context.restore()}this.onChange()}drawSprite({sprite:n,location:c,interval:f}){const _={x:n.x+n.width/2,y:n.y+n.height/2-Bf};c.category!=="mountain"&&c.category!=="mountain_peak"||(c.name=c.name.toUpperCase());const{maxWidth:w}=this.getLocationNameFont({category:c.category,isCurrentLocation:c.isCurrentLocation}),I=$C({name:c.name,maxLength:w});this.drawLocationName({center:_,locationNameLines:I,category:c.category,isCurrentLocation:c.isCurrentLocation}),this.drawTemperature({center:_,interval:f,linesOffset:I.length-1}),this.drawWind({center:_,interval:f,linesOffset:I.length-1}),this.drawWeatherSymbol({center:_,interval:f}),this.showWeight===!0&&this.drawWeight({center:_,weight:c.weight})}drawLocationName({center:n,locationNameLines:c,category:f,isCurrentLocation:_}){const{fontSize:w,lineHeight:I}=this.getLocationNameFont({category:f,isCurrentLocation:_}),l=fc({family:this.theme.font.family,weight:this.theme.font.weight,size:w});for(let D=0;D<c.length;D++){const B=c[D],J=n.x-ou({context:this.context,text:B,font:l})/2,K=n.y+Dt.locationName.offsetY+I*D;this.context.font=l,this.context.textAlign="left",this.context.textBaseline="middle",this.context.lineWidth=Dt.font.outline.width,this.context.strokeStyle=Dt.font.outline.strokeStyle,this.context.fillStyle="black",this.context.lineJoin="round",this.context.strokeText(B,J,K),this.context.fillText(B,J,K)}}getLocationNameFont({category:n,isCurrentLocation:c}){return c?Dt.font.currentLocation:n==="capital"||n==="regional_capital"||n==="city"||n==="medium_city"||n==="large_city"||n==="administration_centre"?Dt.font.city:n==="mountain"||n==="mountain_peak"?Dt.font.mountain:Dt.font.default}drawTemperature({interval:n,center:c,linesOffset:f}){if(n.temperature==null)return;const _=`${Yu({value:n.temperature.value,decimal:!1,unit:this.units.temperature})}\xB0`,w=c.x+Dt.temperature.offsetX,I=c.y+Dt.temperature.offsetY[f];this.context.font=fc({family:this.theme.font.family,weight:this.theme.font.weight,size:Dt.font.details.fontSize}),this.context.textAlign="right",this.context.textBaseline="middle",this.context.lineWidth=Dt.font.outline.width,this.context.strokeStyle=Dt.font.outline.strokeStyle,this.context.fillStyle=mv({value:n.temperature.value,unit:this.units.temperature})?this.theme.colors.temperatureWarm:this.theme.colors.temperatureCold,this.context.strokeText(_,w,I),this.context.fillText(_,w,I)}drawWind({interval:n,center:c,linesOffset:f}){if(n.wind==null)return;const _=Uf({value:n.wind.speed,decimal:!1,unit:this.units.wind}),w=fc({family:this.theme.font.family,weight:this.theme.font.weight,size:Dt.font.details.fontSize}),I=`${_.toString()} ${ZC[this.units.wind]}`,l=ou({context:this.context,text:I,font:w});this.drawWindLabel({label:I,center:c,linesOffset:f,font:w}),_>0&&this.drawWindArrow({center:c,labelWidth:l,direction:n.wind.direction,linesOffset:f,font:w})}drawWindLabel({label:n,center:c,linesOffset:f,font:_}){const w=c.x+Dt.wind.speed.offsetX,I=c.y+Dt.wind.speed.offsetY[f];this.context.font=_,this.context.textAlign="left",this.context.textBaseline="middle",this.context.lineWidth=Dt.font.outline.width,this.context.strokeStyle=Dt.font.outline.strokeStyle,this.context.fillStyle=this.theme.colors.wind,this.context.strokeText(n,w,I),this.context.fillText(n,w,I)}drawWindArrow({center:n,labelWidth:c,direction:f,linesOffset:_}){const{image:w}=this.imageCache.getImage("/assets/images/icons/png/4x/icon-arrow-outline.png");if(w==null)return;const I=n.x+Dt.wind.direction.offsetX+c-Dt.wind.direction.size/2,l=n.y+Dt.wind.direction.offsetY[_]-Dt.wind.direction.size/2,D=I+Dt.wind.direction.size/2,B=l+Dt.wind.direction.size/2;this.context.save(),this.context.translate(D,B),this.context.rotate(uv(f)),this.context.translate(-D,-B),this.context.drawImage(w,I,l,Dt.wind.direction.size,Dt.wind.direction.size),this.context.restore()}drawWeatherSymbol({center:n,interval:c}){if(c.symbol==null)return;const f=ed.getWeatherSymbolId(c.symbol),{image:_}=this.imageCache.getImage(`${this.weatherSymbolsPath}/${f}.svg`);if(_==null)return;const{size:w,offsetY:I}=Dt.weatherSymbol,l=n.x-w/2,D=n.y+I-w/2;this.context.drawImage(_,l,D,w,w)}drawWeight({center:n,weight:c}){const f=fc({family:this.theme.font.family,weight:this.theme.font.weight,size:Dt.font.details.fontSize}),_=n.x+ou({context:this.context,text:`${c}`,font:f})/2,w=n.y+-38;this.context.font=f,this.context.textAlign="right",this.context.textBaseline="middle",this.context.lineWidth=Dt.font.outline.width,this.context.strokeStyle=Dt.font.outline.strokeStyle,this.context.fillStyle="deeppink",this.context.strokeText(`${c}`,_,w),this.context.fillText(`${c}`,_,w)}}var jC=`#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);}`,qC="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 WC extends Qr{constructor({map:n,gl:c,mapSize:f,activeIntervalIndex:_}){super(c,qC,jC),this.locations={},this.spriteSheetTextureIndex=0,this.spriteSheetTextureCoordinates=new Float32Array,this.spriteVertices=new Float32Array,this.mercatorCoordinates=new Float32Array,this.update=()=>{const w=Object.values(this.locations),I=this.map.maplibregl.getPixelRatio(),l=Lf({width:kc*I,height:Lc*I,offsetY:Bf*I,viewport:this.mapSize});this.spriteVertices=new Float32Array(6*w.length*2),this.mercatorCoordinates=new Float32Array(6*w.length*2),this.spriteSheetTextureCoordinates=new Float32Array(6*w.length*2);for(let D=0;D<w.length;D++){const B=6*D*2,J=Ur.exports.MercatorCoordinate.fromLngLat(w[D].position);this.spriteVertices[B+0]=l.topLeft.x,this.spriteVertices[B+1]=l.topLeft.y,this.spriteVertices[B+2]=l.bottomLeft.x,this.spriteVertices[B+3]=l.bottomLeft.y,this.spriteVertices[B+4]=l.topRight.x,this.spriteVertices[B+5]=l.topRight.y,this.spriteVertices[B+6]=l.topRight.x,this.spriteVertices[B+7]=l.topRight.y,this.spriteVertices[B+8]=l.bottomLeft.x,this.spriteVertices[B+9]=l.bottomLeft.y,this.spriteVertices[B+10]=l.bottomRight.x,this.spriteVertices[B+11]=l.bottomRight.y,this.mercatorCoordinates[B+0]=J.x,this.mercatorCoordinates[B+1]=J.y,this.mercatorCoordinates[B+2]=J.x,this.mercatorCoordinates[B+3]=J.y,this.mercatorCoordinates[B+4]=J.x,this.mercatorCoordinates[B+5]=J.y,this.mercatorCoordinates[B+6]=J.x,this.mercatorCoordinates[B+7]=J.y,this.mercatorCoordinates[B+8]=J.x,this.mercatorCoordinates[B+9]=J.y,this.mercatorCoordinates[B+10]=J.x,this.mercatorCoordinates[B+11]=J.y,this.spriteSheetTextureCoordinates[B+0]=this.spriteSheet.uvCoordinates[D].topLeft.x,this.spriteSheetTextureCoordinates[B+1]=this.spriteSheet.uvCoordinates[D].topLeft.y,this.spriteSheetTextureCoordinates[B+2]=this.spriteSheet.uvCoordinates[D].bottomLeft.x,this.spriteSheetTextureCoordinates[B+3]=this.spriteSheet.uvCoordinates[D].bottomLeft.y,this.spriteSheetTextureCoordinates[B+4]=this.spriteSheet.uvCoordinates[D].topRight.x,this.spriteSheetTextureCoordinates[B+5]=this.spriteSheet.uvCoordinates[D].topRight.y,this.spriteSheetTextureCoordinates[B+6]=this.spriteSheet.uvCoordinates[D].topRight.x,this.spriteSheetTextureCoordinates[B+7]=this.spriteSheet.uvCoordinates[D].topRight.y,this.spriteSheetTextureCoordinates[B+8]=this.spriteSheet.uvCoordinates[D].bottomLeft.x,this.spriteSheetTextureCoordinates[B+9]=this.spriteSheet.uvCoordinates[D].bottomLeft.y,this.spriteSheetTextureCoordinates[B+10]=this.spriteSheet.uvCoordinates[D].bottomRight.x,this.spriteSheetTextureCoordinates[B+11]=this.spriteSheet.uvCoordinates[D].bottomRight.y}this.map.maplibregl.triggerRepaint()},this.map=n,this.mapSize=f,this.spriteSheet=new HC({pixelRatio:this.map.maplibregl.getPixelRatio(),theme:this.map.theme,units:this.map.units,weatherSymbolsPath:this.map.assets.weatherSymbolsPath,onChange:this.update,activeIntervalIndex:_}),this.spriteVerticesBuffer=bc(c),this.mercatorCoordinatesBuffer=bc(c),this.spriteSheetTextureCoordinateBuffer=bc(c)}setSize(n){this.mapSize=n,this.update()}setUnits(n){this.spriteSheet.setUnits(n)}setShowSpriteSheetCanvas(n){this.spriteSheet.toggleCanvasDebugView(n)}setShowWeight(n){this.spriteSheet.setShowWeight(n)}setShowSpriteOutline(n){this.spriteSheet.setShowSpriteOutline(n)}setLocations({locations:n}){UC(Object.keys(this.locations),Object.keys(n))||(this.locations=n,this.spriteSheet.setLocations(n))}setActiveIntervalIndex(n){this.spriteSheet.setActiveIntervalIndex(n)}prerender({gl:n}){this.spriteVertices.length!==0&&(this.spriteSheetTexture==null?this.spriteSheetTexture=zf({gl:n,source:this.spriteSheet.canvas,premultiplyAlpha:!0}):kf({gl:n,texture:this.spriteSheetTexture,source:this.spriteSheet.canvas,premultiplyAlpha:!0}))}render({gl:n,matrix:c}){if(this.spriteVertices.length===0||this.spriteSheetTexture==null)return;n.activeTexture(n.TEXTURE0+this.spriteSheetTextureIndex),n.bindTexture(n.TEXTURE_2D,this.spriteSheetTexture),n.enable(n.BLEND),n.useProgram(this.program),n.viewport(0,0,this.mapSize.width,this.mapSize.height),n.uniformMatrix4fv(n.getUniformLocation(this.program,"uMatrix"),!1,c),n.uniform2fv(n.getUniformLocation(this.program,"uViewport"),[this.mapSize.width,this.mapSize.height]),n.uniform1i(this.getUniform("uSpriteSheetTexture"),this.spriteSheetTextureIndex),n.bindBuffer(n.ARRAY_BUFFER,this.spriteVerticesBuffer),n.bufferData(n.ARRAY_BUFFER,this.spriteVertices,n.STATIC_DRAW),n.vertexAttribPointer(this.getAttribute("aSpriteVertex"),2,n.FLOAT,!1,0,0),n.enableVertexAttribArray(this.getAttribute("aSpriteVertex")),n.bindBuffer(n.ARRAY_BUFFER,this.mercatorCoordinatesBuffer),n.bufferData(n.ARRAY_BUFFER,this.mercatorCoordinates,n.STATIC_DRAW),n.vertexAttribPointer(this.getAttribute("aMercatorCoordinate"),2,n.FLOAT,!1,0,0),n.enableVertexAttribArray(this.getAttribute("aMercatorCoordinate")),n.bindBuffer(n.ARRAY_BUFFER,this.spriteSheetTextureCoordinateBuffer),n.bufferData(n.ARRAY_BUFFER,this.spriteSheetTextureCoordinates,n.STATIC_DRAW),n.vertexAttribPointer(this.getAttribute("aSpriteSheetCoordinate"),2,n.FLOAT,!1,0,0),n.enableVertexAttribArray(this.getAttribute("aSpriteSheetCoordinate"));const f=ll(this.map.maplibregl);for(const _ of f)n.uniform2fv(this.getUniform("uWorldOffset"),[_,0]),n.drawArrays(n.TRIANGLES,0,this.spriteVertices.length/2);n.disable(n.BLEND)}}function Gm({fetchId:a,feature:n,isCurrentLocation:c,localeCode:f}){return{type:"Feature",geometry:n.geometry,properties:{fetchId:a,isCurrentLocation:c,locationId:n.properties.id,name:XC({names:n.properties.names,localeCode:f}),category:n.properties.category,position:{lat:n.geometry.coordinates[1],lon:n.geometry.coordinates[0]},priority:c?0:Number.MAX_SAFE_INTEGER-n.properties.weight,weight:n.properties.weight,intervals:JSON.stringify(n.properties.forecast)}}}function XC({names:a,localeCode:n}){if(typeof a[n]=="string")return a[n];const c=["nb","nn","en","iv","sm"];for(const f of c)if(typeof a[f]=="string")return a[f];return""}function YC(){let a=ho({width:cu,height:hu});const n=Un({canvas:a,willReadFrequently:!0}),c=n.getImageData(0,0,a.width,a.height);n.lineWidth=2,n.strokeRect(0,0,cu,hu);const f=cu/2,_=hu/2-Ff;n.beginPath(),n.moveTo(f-6,_-6),n.lineTo(f+6,_+6),n.moveTo(f-6,_+6),n.lineTo(f+6,_-6),n.lineWidth=1.5,n.strokeStyle="red",n.stroke();const w=n.getImageData(0,0,a.width,a.height);return a.width=0,a.height=0,a=null,{emptyImage:c,debugImage:w}}class KC extends cl{constructor({id:n,map:c,locationId:f,localeCode:_}){super(),this.type="custom",this.isFetching=!1,this.currentFetchId=-1,this.isMoving=!1,this.currentLocationIntervalIndex=0,this.handleMapEvent=l=>{var D;l.type==="map:units"&&((D=this.program)===null||D===void 0||D.setUnits(l.units))},this.dispatchWeatherLayerDescriptionValues=l=>{this.dispatchEvent({type:"weather-layer:description-values",descriptionValues:l})},this.handleClick=l=>di(this,void 0,void 0,function*(){l.type==="map:click"&&(this.activeClickData=l,this.handleClickOrUpdate()),l.type==="map:start-click"&&this.dispatchEvent({type:"weather-layer:start-click",pin:l.pin,hasClickedCurrentLocation:l.hasClickedCurrentLocationInWeatherLayer,point:l.point})}),this.handleClickOrUpdate=({type:l}={type:"click"})=>di(this,void 0,void 0,function*(){if(this.activeClickData==null)return;const{positionWrapped:D,point:B,pin:J,location:K,locationsNearby:Z}=this.activeClickData;this.dispatchEvent({type:l==="click"?"weather-layer:click":"weather-layer:update",location:K,locationsNearby:Z,position:D,point:B,pin:J})}),this.handleResize=()=>{if(this.program==null)return;const{width:l,height:D}=this.map.maplibregl.getCanvas();this.program.setSize({width:l,height:D})},this.handleMoveStart=()=>{this.isMoving=!0},this.handleMoveEnd=()=>{this.isMoving=!1,this.fetchSourceData()},this.id=n,this.map=c,this.locationId=f,this.localeCode=_,this.isStandaloneMap=this.locationId==null;const{emptyImage:w,debugImage:I}=YC();this.emptyImage=w,this.debugImage=I,this.dispatchWeatherLayerDescriptionValuesThrottled=Df(this.dispatchWeatherLayerDescriptionValues,1e3)}getCurrentIndex(){return this.currentLocationIntervalIndex}getIntervals(){if(this.currentFeature==null)return;const{forecast:n}=this.currentFeature.properties;return n.map(c=>{const{start:f,end:_}=c;return{start:f,end:_}})}getLocationId(){return this.locationId}setShowBoundingBox(n){this.map.maplibregl.setLayoutProperty("weather-feature-layer-id","icon-image",n?"weather-feature-layer-debug-image":"weather-feature-layer-empty-image")}setShowWeight(n){var c;(c=this.program)===null||c===void 0||c.setShowWeight(n),this.map.maplibregl.triggerRepaint()}setShowSpriteSheet(n){var c;(c=this.program)===null||c===void 0||c.setShowSpriteSheetCanvas(n)}setShowSpriteOutline(n){var c;(c=this.program)===null||c===void 0||c.setShowSpriteOutline(n),this.map.maplibregl.triggerRepaint()}setShowOverlap(n){this.map.maplibregl.setLayoutProperty("weather-feature-layer-id","icon-allow-overlap",n)}setActiveIntervalIndex(n){this.setCurrentLocationIntervalIndex(n)}getLocations(){var n;if(this.map.maplibregl.getLayer("weather-feature-layer-id")==null)return{};const c=this.map.maplibregl.queryRenderedFeatures(void 0,{layers:["weather-feature-layer-id"]});if(c.length===0)return{};if(((n=c[0].properties)===null||n===void 0?void 0:n.fetchId)!==this.currentFetchId)return;const f={};for(const _ of c){if(_.properties==null)continue;const w=_.properties,I=_.geometry;I.type==="Point"&&f[w.locationId]==null&&(f[w.locationId]={isCurrentLocation:w.isCurrentLocation,name:w.name,category:w.category,position:{lat:I.coordinates[1],lon:I.coordinates[0]},weight:w.weight,intervals:JSON.parse(w.intervals)})}return f}setCurrentLocationIntervalIndex(n){n!==this.currentLocationIntervalIndex&&(this.currentLocationIntervalIndex=n,this.program!=null&&this.program.setActiveIntervalIndex(this.currentLocationIntervalIndex),this.dispatchEvent({type:"weather-layer:active-interval-index",index:this.currentLocationIntervalIndex}),this.handleClickOrUpdate({type:"update"}))}fetchCurrentMapFeature({signal:n}){return di(this,void 0,void 0,function*(){const c=`/api/v0/locations/${this.isStandaloneMap?"2-2643743":this.locationId}/mapfeature`,f=yield window.fetch(c,{signal:n});if(f.ok===!1)throw new Error("Unable to fetch current map feature");return yield f.json()})}fetchWeatherMapFeatureCollection({tile:n,signal:c}){return di(this,void 0,void 0,function*(){const f=`/api/v0/areamap/mercator/${n.z}/${n.x}/${n.y}`;try{const _=yield window.fetch(f,{signal:c});return _.ok===!1?void 0:yield _.json()}catch{return}})}fetchSourceData(){return di(this,void 0,void 0,function*(){try{this.abortController!=null&&this.abortController.abort(),this.isFetching=!0;const n=this.currentFetchId+1,c=new AbortController;this.abortController=c;const f=Hu({map:this.map.maplibregl,padding:0}),{width:_}=Sr({map:this.map.maplibregl,padding:0,withPixelRatio:!1}),w=Ef({map:this.map.maplibregl})+1,{tiles:I}=Pu({map:this.map.maplibregl,bounds:f,mapWidth:_,tileZ:w}),l=I.map(J=>this.fetchWeatherMapFeatureCollection({tile:J,signal:c.signal}));this.currentFeature=yield this.fetchCurrentMapFeature({signal:c.signal}),this.dispatchCurrentFeatureIntervals();const D=yield Promise.all(l);if(c.signal.aborted)return;const B=[Gm({fetchId:n,feature:this.currentFeature,isCurrentLocation:!this.isStandaloneMap,localeCode:this.localeCode})];this.currentLocation=this.isStandaloneMap===!1?{isCurrentLocation:B[0].properties.isCurrentLocation,name:B[0].properties.name,category:B[0].properties.category,position:{lat:B[0].geometry.coordinates[1],lon:B[0].geometry.coordinates[0]},weight:B[0].properties.weight,intervals:JSON.parse(B[0].properties.intervals)}:void 0;for(const J of D)if(J!=null)for(const K of J.features)B.push(Gm({fetchId:n,feature:K,isCurrentLocation:!1,localeCode:this.localeCode}));this.map.maplibregl.getSource("weather-feature-layer-source-id").setData({type:"FeatureCollection",features:B}),this.isFetching=!1,this.currentFetchId=n}catch{this.isFetching=!1}})}dispatchCurrentFeatureIntervals(){if(this.currentFeature==null)return;const{forecast:n}=this.currentFeature.properties;if(this.dispatchedIntervalStart!==n[0].start){const c=this.getIntervals();if(c==null)return;this.dispatchEvent({type:"weather-layer:intervals",intervals:c}),this.dispatchedIntervalStart=n[0].start}}onAdd(n,c){const{width:f,height:_}=n.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,Ff]}}),this.program==null&&(this.program=new WC({map:this.map,gl:c,mapSize:{width:f,height:_},activeIntervalIndex:this.currentLocationIntervalIndex})),this.fetchSourceData(),this.map.addEventListener(this.handleMapEvent),this.map.addEventListener(this.handleClick),this.map.maplibregl.on("resize",this.handleResize),this.map.maplibregl.on("movestart",this.handleMoveStart),this.map.maplibregl.on("moveend",this.handleMoveEnd)}onRemove(){var n;(n=this.program)===null||n===void 0||n.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.removeEventListener(this.handleClick),this.map.maplibregl.off("resize",this.handleResize),this.map.maplibregl.off("movestart",this.handleMoveStart),this.map.maplibregl.off("moveend",this.handleMoveEnd)}prerender(n,c){if(this.program!=null){if(this.isMoving===!1&&this.isFetching===!1){const f=this.getLocations();if(f!=null){const _=this.currentLocation!=null?L1({currentLocation:this.currentLocation,locations:f,activeIntervalIndex:this.currentLocationIntervalIndex,units:this.map.units}):[];this.dispatchWeatherLayerDescriptionValuesThrottled(_),this.program.setLocations({locations:f})}}this.program.prerender({gl:n})}}render(n,c){this.program!=null&&this.program.render({gl:n,matrix:c})}cancelClick(){this.activeClickData=void 0,this.map.hideSecondaryPin()}getFeatureFromPoint(n){const c=this.map.maplibregl.queryRenderedFeatures([n.x,n.y],{layers:["weather-feature-layer-id"]});if(c.length>0&&c[0].geometry.type==="Point"){const f=JSON.parse(c[0].properties.position);return{lngLat:new Ur.exports.LngLat(f.lon,f.lat),locationId:c[0].properties.locationId}}}}function JC({position:a,urlTemplate:n,tileZ:c}){return di(this,void 0,void 0,function*(){const f=qu({position:a,tileZ:c}),_={x:Math.floor(f.x),y:Math.floor(f.y),z:f.z},w=f.x-_.x,I=f.y-_.y,l=n.replace("{z}",String(_.z)).replace("{x}",String(_.x)).replace("{y}",String(_.y)),D=yield Xu(l),B={x:Math.floor(D.naturalWidth*w),y:Math.floor(D.naturalHeight*I)},J=ho({width:D.width,height:D.height}),K=Un({canvas:J});K.drawImage(D,0,0);const Z=K.getImageData(B.x,B.y,1,1),we={x:(Z.data[0]-128)/2,y:(Z.data[1]-128)/2},be=Math.sqrt(Math.pow(we.x,2)+Math.pow(we.y,2)),Ae=function(Fe){let $e=function(Ve){const Ge=Math.atan2(Ve.y,Ve.x),lt=180/Math.PI*Ge;return(360+Math.round(lt))%360}(Fe);return $e+=90,$e%=360,(0-$e+360)%360}(we);return{speed:Math.round(be),direction:Ae,debug:{speed:be,vector:we,color:{r:Z.data[0],g:Z.data[1],b:Z.data[2]}}}})}var QC=`
#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif
uniform float uIsEnabled;uniform vec2 uTextureSize;uniform sampler2D uTexture;varying vec2 vTexCoords;float cX0=-1.0;float cX1=0.0;float cX2=1.0;float cX3=2.0;vec4 CubicLagrange(vec4 A,vec4 B,vec4 C,vec4 D,float t){return(A*((t-cX1)/(cX0-cX1)*(t-cX2)/(cX0-cX2)*(t-cX3)/(cX0-cX3)))+(B*((t-cX0)/(cX1-cX0)*(t-cX2)/(cX1-cX2)*(t-cX3)/(cX1-cX3)))+(C*((t-cX0)/(cX2-cX0)*(t-cX1)/(cX2-cX1)*(t-cX3)/(cX2-cX3)))+(D*((t-cX0)/(cX3-cX0)*(t-cX1)/(cX3-cX1)*(t-cX2)/(cX3-cX2)));}vec4 BicubicLagrangeTextureSample(vec2 P){vec2 onePixel=vec2(1.0,1.0)/uTextureSize;vec2 twoPixels=vec2(2.0,2.0)/uTextureSize;vec2 pixel=P*uTextureSize+0.5;vec2 frac=fract(pixel);pixel=floor(pixel)/uTextureSize-vec2(onePixel/2.0);vec4 C00=texture2D(uTexture,pixel+vec2(-onePixel.x,-onePixel.y)).rgba;vec4 C10=texture2D(uTexture,pixel+vec2(0.0,-onePixel.y)).rgba;vec4 C20=texture2D(uTexture,pixel+vec2(onePixel.x,-onePixel.y)).rgba;vec4 C30=texture2D(uTexture,pixel+vec2(twoPixels.x,-onePixel.y)).rgba;vec4 C01=texture2D(uTexture,pixel+vec2(-onePixel.x,0.0)).rgba;vec4 C11=texture2D(uTexture,pixel+vec2(0.0,0.0)).rgba;vec4 C21=texture2D(uTexture,pixel+vec2(onePixel.x,0.0)).rgba;vec4 C31=texture2D(uTexture,pixel+vec2(twoPixels.x,0.0)).rgba;vec4 C02=texture2D(uTexture,pixel+vec2(-onePixel.x,onePixel.y)).rgba;vec4 C12=texture2D(uTexture,pixel+vec2(0.0,onePixel.y)).rgba;vec4 C22=texture2D(uTexture,pixel+vec2(onePixel.x,onePixel.y)).rgba;vec4 C32=texture2D(uTexture,pixel+vec2(twoPixels.x,onePixel.y)).rgba;vec4 C03=texture2D(uTexture,pixel+vec2(-onePixel.x,twoPixels.y)).rgba;vec4 C13=texture2D(uTexture,pixel+vec2(0.0,twoPixels.y)).rgba;vec4 C23=texture2D(uTexture,pixel+vec2(onePixel.x,twoPixels.y)).rgba;vec4 C33=texture2D(uTexture,pixel+vec2(twoPixels.x,twoPixels.y)).rgba;vec4 CP0X=CubicLagrange(C00,C10,C20,C30,frac.x);vec4 CP1X=CubicLagrange(C01,C11,C21,C31,frac.x);vec4 CP2X=CubicLagrange(C02,C12,C22,C32,frac.x);vec4 CP3X=CubicLagrange(C03,C13,C23,C33,frac.x);return CubicLagrange(CP0X,CP1X,CP2X,CP3X,frac.y);}vec4 BilinearTextureSample(vec2 P){vec2 onePixel=vec2(1.0,1.0)/uTextureSize;vec2 pixel=P*uTextureSize+0.5;vec2 frac=fract(pixel);pixel=(floor(pixel)/uTextureSize)-vec2(onePixel/2.0);vec4 C11=texture2D(uTexture,pixel+vec2(0.0,0.0)).rgba;vec4 C21=texture2D(uTexture,pixel+vec2(onePixel.x,0.0)).rgba;vec4 C12=texture2D(uTexture,pixel+vec2(0.0,onePixel.y)).rgba;vec4 C22=texture2D(uTexture,pixel+vec2(onePixel.x,onePixel.y)).rgba;vec4 x1=mix(C11,C21,frac.x);vec4 x2=mix(C12,C22,frac.x);return mix(x1,x2,frac.y);}vec4 NearestTextureSample(vec2 P){vec2 onePixel=vec2(1.0,1.0)/uTextureSize;vec2 pixel=P*uTextureSize;vec2 frac=fract(pixel);pixel=(floor(pixel)/uTextureSize);return texture2D(uTexture,pixel+vec2(onePixel/2.0)).rgba;}void main(){if(uIsEnabled>0.5){gl_FragColor=BicubicLagrangeTextureSample(vTexCoords);}else{gl_FragColor=texture2D(uTexture,vTexCoords);}}`,eI="uniform mat4 uMatrix;uniform vec2 uWorldOffset;attribute vec2 aPosition;attribute vec2 aTexCoords;varying vec2 vTexCoords;void main(){gl_Position=uMatrix*vec4(aPosition+uWorldOffset,0.0,1.0);vTexCoords=aTexCoords;}";class mg extends Qr{constructor({gl:n}){super(n,eI,QC),this.vertexBuffer=new Ai({gl:n}),this.textureCoordinateBuffer=new Ai({gl:n,data:new Float32Array([0,0,0,1,1,1,0,0,1,1,1,0])})}prerender({mercatorVertices:n}){this.vertexBuffer.setData(n)}render({map:n,gl:c,matrix:f,viewportSize:_,texture:w,blendFunc:I="premultiplied",isEnabled:l}){c.useProgram(this.program),c.viewport(0,0,_.width,_.height),c.enable(c.BLEND),I==="premultiplied"?c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA):I==="not-premultiplied"?c.blendFuncSeparate(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA,c.ONE,c.ONE_MINUS_SRC_ALPHA):I==="multiply"&&c.blendFunc(c.DST_COLOR,c.ONE_MINUS_SRC_ALPHA),w.bind(),c.uniform1f(this.getUniform("uIsEnabled"),l?1:0),c.uniform1i(this.getUniform("uTexture"),w.index),c.uniformMatrix4fv(c.getUniformLocation(this.program,"uMatrix"),!1,f),c.uniform2fv(this.getUniform("uTextureSize"),[w.size.width,w.size.height]),this.vertexBuffer.bind(),c.vertexAttribPointer(this.getAttribute("aPosition"),2,c.FLOAT,!1,0,0),c.enableVertexAttribArray(this.getAttribute("aPosition")),this.textureCoordinateBuffer.bind(),c.vertexAttribPointer(this.getAttribute("aTexCoords"),2,c.FLOAT,!1,0,0),c.enableVertexAttribArray(this.getAttribute("aTexCoords"));const D=ll(n);for(const B of D)c.uniform2fv(this.getUniform("uWorldOffset"),[B,0]),c.drawArrays(c.TRIANGLES,0,6);cn(c)}}var tI=`#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));}`,iI="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 fg extends Qr{constructor({gl:n}){super(n,iI,tI),this.vertexBuffer=new Ai({gl:n}),this.textureCoordinateBuffer=new Ai({gl:n,data:new Float32Array([0,0,0,1,1,1,0,0,1,1,1,0])})}prerender({mercatorVertices:n}){this.vertexBuffer.setData(n)}render({gl:n,matrix:c,viewportSize:f,texture:_,blendFunc:w="premultiplied"}){n.useProgram(this.program),n.viewport(0,0,f.width,f.height),n.enable(n.BLEND),w==="premultiplied"?n.blendFunc(n.ONE,n.ONE_MINUS_SRC_ALPHA):w==="not-premultiplied"?n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA):w==="multiply"&&n.blendFunc(n.DST_COLOR,n.ONE_MINUS_SRC_ALPHA),_.bind(),n.uniform1i(this.getUniform("uTexture"),_.index),n.uniformMatrix4fv(n.getUniformLocation(this.program,"uMatrix"),!1,c),this.vertexBuffer.bind(),n.vertexAttribPointer(this.getAttribute("aPosition"),2,n.FLOAT,!1,0,0),n.enableVertexAttribArray(this.getAttribute("aPosition")),this.textureCoordinateBuffer.bind(),n.vertexAttribPointer(this.getAttribute("aTexCoords"),2,n.FLOAT,!1,0,0),n.enableVertexAttribArray(this.getAttribute("aTexCoords")),n.drawArrays(n.TRIANGLES,0,6),cn(n)}}const Nc={smoothColorGradient:!0,showColorGradient:!1,particleTailDuration:450,particlesPer10cm2ZoomedIn:100,particlesPer10cm2ZoomedOut:300,pixelsPerMeterPerSecond:6,particleLifespan:{min:750,max:5250},tileZ:3,showHeatmap:!0,showParticlesLayerWindTexture:!1,showHeatmapLayerWindTexture:!1,resetParticlesEachFrame:!0,isPlaying:!1,sourceIndex:0,frameDuration:1e3,particleSize:2.5,particleBlurRadiusStart:.3,particleAlphaZoomedIn:.8,particleAlphaZoomedOut:.5,multiplyHeatmap:!0,blurHeatmap:!0},rI=[{speed:0,color:"#A7CEA1"},{speed:5.5,color:"#79ccac"},{speed:8,color:"#3cbebe"},{speed:10.8,color:"#13a8d6"},{speed:13.9,color:"#4b87ea"},{speed:17.2,color:"#7b57ed"},{speed:20.8,color:"#7043A8"},{speed:24.5,color:"#5B278D"},{speed:28.5,color:"#4D0A6C"},{speed:32.6,color:"#310047"}];var nI=`#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif
uniform sampler2D uWindTexture;uniform float uMaxSpeed;uniform sampler2D uColorTexture;varying vec2 vTextureCoordinate;float round(float value){return floor(value+0.5);}vec2 round(vec2 values){return floor(values+0.5);}vec4 round(vec4 values){return floor(values+0.5);}float modulo(float value,float divider){float m=value-floor((value+0.5)/divider)*divider;return floor(m+0.5);}vec2 encode(float value){float byteTwo=modulo(value,pow(2.0,8.0));float byteOne=(value-byteTwo)*(1.0/pow(2.0,8.0));return vec2(byteOne,byteTwo);}vec4 encode(vec2 values){return vec4(encode(values[0]),encode(values[1]));}float decode(vec2 bytes){return bytes[0]*pow(2.0,8.0)+bytes[1];}vec2 decode(vec4 bytes){return vec2(decode(bytes.rg),decode(bytes.ba));}float random(vec2 uSeed){return fract(sin(dot(uSeed.xy,vec2(12.9898,78.233)))*43758.5453123);}vec2 getDirectionFromWindData(vec4 windData){return vec2((windData.r*255.0-128.0)/2.0,(windData.g*255.0-128.0)/2.0);}void main(){vec4 windData=texture2D(uWindTexture,vTextureCoordinate);vec2 direction=getDirectionFromWindData(windData);bool hasWindData=windData.a!=0.0;float speed=sqrt((direction.x*direction.x)+(direction.y*direction.y));gl_FragColor=texture2D(uColorTexture,vec2(0.0,speed/uMaxSpeed));if(hasWindData==false){gl_FragColor=vec4(0.0,0.0,0.0,0.0);}}`,oI="attribute vec2 aPosition;attribute vec2 aTextureCoordinate;varying vec2 vTextureCoordinate;void main(){vTextureCoordinate=aTextureCoordinate;gl_Position=vec4(aPosition,0.0,1.0);}";class aI extends Qr{constructor({gl:n}){super(n,oI,nI),this.vertexBuffer=new Ai({gl:n,data:new Float32Array(Zc)}),this.textureCoordinatesBuffer=new Ai({gl:n,data:new Float32Array([0,0,0,1,1,1,0,0,1,1,1,0])})}prerender({gl:n,targetTexture:c}){this.framebuffer==null&&(this.framebuffer=zc(n),n.bindFramebuffer(n.FRAMEBUFFER,this.framebuffer),n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,c.texture,0))}render({gl:n,windTexture:c,colorTexture:f,targetTexture:_}){this.framebuffer!=null&&(n.useProgram(this.program),n.bindFramebuffer(n.FRAMEBUFFER,this.framebuffer),n.viewport(0,0,_.size.width,_.size.height),n.uniform1f(this.getUniform("uMaxSpeed"),63.5),n.uniform1i(this.getUniform("uWindTexture"),c.index),n.uniform1i(this.getUniform("uColorTexture"),f.index),this.vertexBuffer.bind(),n.vertexAttribPointer(this.getAttribute("aPosition"),2,n.FLOAT,!1,0,0),n.enableVertexAttribArray(this.getAttribute("aPosition")),this.textureCoordinatesBuffer.bind(),n.vertexAttribPointer(this.getAttribute("aTextureCoordinate"),2,n.FLOAT,!1,0,0),n.enableVertexAttribArray(this.getAttribute("aTextureCoordinate")),n.drawArrays(n.TRIANGLES,0,6),n.bindFramebuffer(n.FRAMEBUFFER,null),cn(n))}}const $o=Math.ceil(635);class sI{constructor({id:n,map:c,tileZ:f,sources:_,sourceIndex:w,initialColors:I,onFrameBegin:l,onFrameEnd:D}){this.enabled=!0,this.options=Nc,this.handleWebGLContextLost=()=>{this.setEnabled(!1)},this.handleMove=()=>{this.windTileCache.updateTiles()},this.id=n,this.type="custom",this.map=c,this.currentColors=I,this.onFrameBegin=l,this.onFrameEnd=D,this.windTileCache=new Hc({map:this.map.maplibregl,textureIndex:9,tileZ:f,sourceIndex:w,sources:_,filter:"LINEAR"}),this.colorCanvas=ho({width:1,height:$o}),this.setColors(),this.colorCanvas.style.position="absolute",this.colorCanvas.style.top="5vh",this.colorCanvas.style.left="5vh",this.colorCanvas.style.outline="2px solid white",this.colorCanvas.style.width="10px",this.colorCanvas.style.height="90vh",this.colorCanvas.style.imageRendering="pixelated",this.colorCanvas.style.pointerEvents="none",document.body.appendChild(this.colorCanvas),this.colorCanvas.style.display=this.options.showColorGradient===!0?"block":"none"}onAdd(n,c){this.windHeatmapProgram=new aI({map:this.map,gl:c}),this.canvasProgram=new fg({gl:c}),this.blurProgram=new mg({gl:c}),this.map.maplibregl.on("webglcontextlost",this.handleWebGLContextLost),this.map.maplibregl.on("move",this.handleMove)}onRemove(){this.windTileCache.onRemove(),this.map.maplibregl.off("webglcontextlost",this.handleWebGLContextLost),this.map.maplibregl.off("move",this.handleMove)}setOptions({options:n,key:c}){this.options=n,c==="smoothColorGradient"&&this.setColors(),c==="showColorGradient"&&(this.colorCanvas.style.display=this.options.showColorGradient===!0?"block":"none")}setEnabled(n){this.enabled=n,this.enabled===!1&&this.windTileCache.toggleCanvasDebugView(!1)}setTileZ(n){this.windTileCache.setTileZ(n)}setHeatmapColors(n){this.currentColors=n,this.setColors()}toggleTextureDebugView(n){this.windTileCache.toggleCanvasDebugView(n)}setColors(){const n=Un({canvas:this.colorCanvas});if(this.options.smoothColorGradient){On({canvas:this.colorCanvas,width:1,height:$o});const c=n.createLinearGradient(0,0,0,$o-1);this.currentColors.forEach(f=>{const{color:_,speed:w}=f;c.addColorStop(1-w/63.5,_)}),n.fillStyle=c,n.fillRect(0,0,1,$o)}else On({canvas:this.colorCanvas,width:1,height:$o}),this.currentColors.forEach(c=>{const{color:f,speed:_}=c,w=10*_;n.fillStyle=f,n.fillRect(0,$o-w,1,w-$o)})}setSourceIndex(n){this.windTileCache.setSourceIndex(n)}isNextFrameReady(){var n;return(n=this.windTileCache.nextFrameReady)!==null&&n!==void 0&&n}prerender(n,c){var f;if(this.enabled!==!1&&this.windHeatmapProgram!=null&&this.canvasProgram!=null&&this.blurProgram!=null&&(this.windTileCache.texture!=null&&(this.coloredWindTexture==null&&(this.coloredWindTexture=new Ho({gl:n,textureIndex:11,size:this.windTileCache.texture.size})),this.coloredWindTexture.setSize((f=this.windTileCache.texture)===null||f===void 0?void 0:f.size)),this.colorTexture==null?this.colorTexture=new Ho({gl:n,textureIndex:10,source:this.colorCanvas,flipY:!0,premultiplyAlpha:!0}):this.colorTexture.updateFromSource({source:this.colorCanvas,flipY:!0,premultiplyAlpha:!0}),this.windTileCache.prerender(n),this.coloredWindTexture!=null&&this.windHeatmapProgram.prerender({gl:n,targetTexture:this.coloredWindTexture}),this.windTileCache.mercatorBounds!=null)){const _=Zu(this.windTileCache.mercatorBounds);this.canvasProgram.prerender({mercatorVertices:_}),this.blurProgram.prerender({mercatorVertices:_})}}render(n,c){if(this.enabled===!1||this.windHeatmapProgram==null||this.canvasProgram==null||this.blurProgram==null||this.windTileCache==null||this.windTileCache.texture==null||this.colorTexture==null||this.coloredWindTexture==null)return;this.onFrameBegin();const f=Sr({map:this.map.maplibregl,withPixelRatio:!0});this.windTileCache.texture.bind(),this.colorTexture.bind(),this.windHeatmapProgram.render({gl:n,windTexture:this.windTileCache.texture,colorTexture:this.colorTexture,targetTexture:this.coloredWindTexture}),this.blurProgram.render({map:this.map.maplibregl,gl:n,matrix:c,viewportSize:f,texture:this.coloredWindTexture,blendFunc:this.options.multiplyHeatmap?"multiply":void 0,isEnabled:this.options.blurHeatmap}),this.colorTexture.unbind(),this.windTileCache.texture.unbind(),this.onFrameEnd()}}function Uu({fromX:a,from:n,to:c}){return(a-n.min)*(c.max-c.min)/(n.max-n.min)+c.min}var bu;const wu=typeof window<"u"&&((bu=window.performance)===null||bu===void 0?void 0:bu.now)!=null?window.performance.now.bind(window.performance):Date.now.bind(Date);var Zm=typeof Float32Array<"u"?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var a=0,n=arguments.length;n--;)a+=arguments[n]*arguments[n];return Math.sqrt(a)});function lI(){var a=new Zm(16);return Zm!=Float32Array&&(a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[11]=0,a[12]=0,a[13]=0,a[14]=0),a[0]=1,a[5]=1,a[10]=1,a[15]=1,a}var cI=`#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif
uniform sampler2D uTexture;uniform bool uDrawToCanvas;uniform float uZoom;vec2 mapZoomMinMaxLevels=vec2(2.0,10.0);uniform vec2 uParticleAlpha;uniform float uParticleTailDuration;uniform float uUpdateDuration;uniform float uNumberOfUpdates;varying vec2 vTexCoords;float round(float value){return floor(value+0.5);}vec2 round(vec2 values){return floor(values+0.5);}float modulo(float value,float divider){float m=value-floor((value+0.5)/divider)*divider;return floor(m+0.5);}float decode(vec2 bytes){return bytes[0]*pow(2.0,8.0)+bytes[1];}vec2 encode(float value){float byteTwo=modulo(value,pow(2.0,8.0));float byteOne=(value-byteTwo)*(1.0/pow(2.0,8.0));return vec2(byteOne,byteTwo);}float rescaleZoomToParticleAlpha(float toMin,float toMax){return(uZoom-mapZoomMinMaxLevels.x)*(toMax-toMin)/(mapZoomMinMaxLevels.y-mapZoomMinMaxLevels.x)+toMin;}float getAlphaDiffPerUpdate(float particleAlpha,float particleTailDuration,float updateDuration){return-(particleAlpha/particleTailDuration*updateDuration);}void main(){float maxValue=pow(2.0,16.0)-1.0;vec4 encodedAlpha=texture2D(uTexture,vTexCoords);float alpha=decode(round(encodedAlpha.rg*255.0))/maxValue;float alphaDiffPerUpdate=getAlphaDiffPerUpdate(rescaleZoomToParticleAlpha(uParticleAlpha.x,uParticleAlpha.y),uParticleTailDuration,uUpdateDuration);float alphaDiff=alphaDiffPerUpdate*uNumberOfUpdates;alpha+=alphaDiff;alpha=clamp(alpha,0.0,1.0);if(uDrawToCanvas){gl_FragColor=vec4(1.0,1.0,1.0,alpha);}else{gl_FragColor=vec4(encode(round(alpha*maxValue))/255.0,0.0,0.0);}}`,hI="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 uI extends Qr{constructor({map:n,gl:c,screenTexture:f}){super(c,hI,cI),this.map=n,this.texture=f,this.screenVertexBuffer=new Ai({gl:c,data:new Float32Array(Zc)}),this.boundsVertexBuffer=new Ai({gl:c}),this.textureCoordinateBuffer=new Ai({gl:c,data:new Float32Array([0,0,0,1,1,1,0,0,1,1,1,0])}),c.useProgram(this.program),c.uniform1i(this.getUniform("uTexture"),this.texture.index),c.useProgram(null)}prerender({bounds:n}){this.boundsVertexBuffer.setData(Zu(n))}render({gl:n,viewportSize:c,target:f,matrix:_=lI(),alphaVariables:{particleAlpha:w,particleTailDuration:I,updateDuration:l,numberOfUpdates:D}}){n.useProgram(this.program),this.texture.bind(),n.uniformMatrix4fv(n.getUniformLocation(this.program,"uMatrix"),!1,_),n.uniform1f(this.getUniform("uZoom"),parseFloat(this.map.maplibregl.getZoom().toFixed(2))),n.uniform2f(this.getUniform("uParticleAlpha"),w.zoomedOut,w.zoomedIn),n.uniform1f(this.getUniform("uParticleTailDuration"),I),n.uniform1f(this.getUniform("uUpdateDuration"),l),n.uniform1f(this.getUniform("uNumberOfUpdates"),D),f==="background-texture"?this.screenVertexBuffer.bind():this.boundsVertexBuffer.bind(),n.vertexAttribPointer(this.getAttribute("aPosition"),2,n.FLOAT,!1,0,0),n.enableVertexAttribArray(this.getAttribute("aPosition")),this.textureCoordinateBuffer.bind(),n.vertexAttribPointer(this.getAttribute("aTexCoords"),2,n.FLOAT,!1,0,0),n.enableVertexAttribArray(this.getAttribute("aTexCoords")),f==="background-texture"?this.texture.drawToBackground(()=>{n.uniform1i(this.getUniform("uDrawToCanvas"),0),n.disable(n.BLEND),n.drawArrays(n.TRIANGLES,0,6)}):(n.uniform1i(this.getUniform("uDrawToCanvas"),1),n.viewport(0,0,c.width,c.height),n.enable(n.BLEND),n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA),n.drawArrays(n.TRIANGLES,0,6)),cn(n)}clear({gl:n}){this.texture.drawToBackground(()=>{n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT)})}}var dI=`#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif
uniform float uParticleBlurRadiusStart;uniform float uZoom;vec2 mapZoomMinMaxLevels=vec2(2.0,10.0);uniform vec2 uParticleAlpha;uniform float uParticleTailDuration;uniform float uUpdateDuration;uniform float uIndex;varying float vParticleVisibility;float round(float value){return floor(value+0.5);}float modulo(float value,float divider){float m=value-floor((value+0.5)/divider)*divider;return floor(m+0.5);}vec2 encode(float value){float byteTwo=modulo(value,pow(2.0,8.0));float byteOne=(value-byteTwo)*(1.0/pow(2.0,8.0));return vec2(byteOne,byteTwo);}float rescaleZoomToParticleAlpha(float toMin,float toMax){return(uZoom-mapZoomMinMaxLevels.x)*(toMax-toMin)/(mapZoomMinMaxLevels.y-mapZoomMinMaxLevels.x)+toMin;}float alphaDiffPerUpdate(float particleAlpha,float particleTailDuration,float updateDuration){return-(particleAlpha/particleTailDuration*updateDuration);}void main(){if(vParticleVisibility==0.0){discard;}float rescaledParticleAlpha=rescaleZoomToParticleAlpha(uParticleAlpha.x,uParticleAlpha.y);float alphaDiffPerUpdate=alphaDiffPerUpdate(rescaledParticleAlpha,uParticleTailDuration,uUpdateDuration);float particleAlpha=rescaledParticleAlpha-alphaDiffPerUpdate*uIndex;float maxValue=pow(2.0,16.0)-1.0;vec2 center=2.0*gl_PointCoord-1.0;float radius=sqrt(center.x*center.x+center.y*center.y);float alphaScale=1.0-smoothstep(uParticleBlurRadiusStart,1.0,radius);float alpha=particleAlpha*alphaScale;gl_FragColor=vec4(encode(round(alpha*maxValue))/255.0,0.0,0.0);}`,pI="attribute vec2 aParticleTextureCoordinate;uniform sampler2D uParticlePositionTexture;uniform sampler2D uParticleMetaTexture;uniform vec2 uParticleTextureSize;uniform float uParticleSize;varying float vParticleVisibility;vec4 round(vec4 values){return floor(values+0.5);}float decode(vec2 bytes){return bytes[0]*pow(2.0,8.0)+bytes[1];}vec2 decode(vec4 bytes){return vec2(decode(bytes.rg),decode(bytes.ba));}void main(){float maxValue=pow(2.0,16.0)-1.0;vec2 particleTextureCoordinateNormalized=aParticleTextureCoordinate/uParticleTextureSize;vec4 particlePositionEncoded=texture2D(uParticlePositionTexture,particleTextureCoordinateNormalized);vec2 particlePositionNormalized=decode(round(particlePositionEncoded*255.0))/maxValue;vec2 particlePositionInClipSpace=particlePositionNormalized*2.0-1.0;vec4 metaDataRaw=texture2D(uParticleMetaTexture,particleTextureCoordinateNormalized);vParticleVisibility=metaDataRaw.a;gl_Position=vec4(particlePositionInClipSpace,0.0,1.0);gl_PointSize=uParticleSize;}";class mI extends Qr{constructor({map:n,gl:c,screenTexture:f,particlePositionTexture:_,particleMetaTexture:w,particleCount:I}){super(c,pI,dI),this.map=n,this.screenTexture=f,this.particlePositionTexture=_,this.particleMetaTexture=w,this.particleCount=I,this.blendEquationMinMax=c.getExtension("EXT_blend_minmax");const l=Hm(this.particlePositionTexture.size);this.particleTextureCoordinatesBuffer=new Ai({gl:c,data:l})}prerender({particleCount:n}){if(this.particleCount!==n){this.particleCount=n;const c=Hm(this.particlePositionTexture.size);this.particleTextureCoordinatesBuffer.setData(c)}}render({gl:n,particleCount:c,particleSize:f,particleBlurRadiusStart:_,alphaVariables:{particleAlpha:w,particleTailDuration:I,updateDuration:l,index:D}}){n.useProgram(this.program),this.blendEquationMinMax!=null&&n.blendEquation(this.blendEquationMinMax.MAX_EXT),this.particlePositionTexture.bind(),this.particleMetaTexture.bind(),n.uniform1i(this.getUniform("uParticlePositionTexture"),this.particlePositionTexture.index),n.uniform1i(this.getUniform("uParticleMetaTexture"),this.particleMetaTexture.index),n.uniform2fv(this.getUniform("uParticleTextureSize"),[this.particlePositionTexture.size.width,this.particlePositionTexture.size.height]),this.particleTextureCoordinatesBuffer.bind(),n.enableVertexAttribArray(this.getAttribute("aParticleTextureCoordinate")),n.vertexAttribPointer(this.getAttribute("aParticleTextureCoordinate"),2,n.FLOAT,!1,0,0),n.uniform1f(this.getUniform("uParticleSize"),this.blendEquationMinMax!=null?f:f/2),n.uniform1f(this.getUniform("uParticleBlurRadiusStart"),_),n.uniform2f(this.getUniform("uParticleAlpha"),this.blendEquationMinMax!=null?w.zoomedOut:1,this.blendEquationMinMax!=null?w.zoomedIn:1),n.uniform1f(this.getUniform("uZoom"),parseFloat(this.map.maplibregl.getZoom().toFixed(2))),n.uniform1f(this.getUniform("uParticleTailDuration"),I),n.uniform1f(this.getUniform("uUpdateDuration"),l),n.uniform1f(this.getUniform("uIndex"),D),this.screenTexture.drawToBackground(()=>{n.drawArrays(n.POINTS,0,c)}),cn(n)}}function Hm(a){const n=new Float32Array(a.width*a.height*2);for(let c=0;c<a.height;c++)for(let f=0;f<a.width;f++){const _=c*a.width*2+2*f;n.set([f,c],_)}return n}var fI=`#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif
uniform float uDeltaTime;uniform vec3 uSeed;uniform float uPpmps;uniform float uMinParticleLifespan;uniform float uMaxParticleLifespan;uniform bool uUpdatePosition;uniform vec2 uSize;uniform vec2 uMercatorSize;uniform vec2 uMercatorTopLeft;uniform sampler2D uWindTexture;uniform vec2 uWindTextureMercatorSize;uniform vec2 uWindTextureMercatorTopLeft;uniform sampler2D uParticlePositionTexture;uniform sampler2D uParticleMetaTexture;uniform vec2 uParticleTextureSize;vec2 round(vec2 values){return floor(values+0.5);}vec4 round(vec4 values){return floor(values+0.5);}float modulo(float value,float divider){float m=value-floor((value+0.5)/divider)*divider;return floor(m+0.5);}vec2 encode(float value){float byteTwo=modulo(value,pow(2.0,8.0));float byteOne=(value-byteTwo)*(1.0/pow(2.0,8.0));return vec2(byteOne,byteTwo);}vec4 encode(vec2 values){return vec4(encode(values[0]),encode(values[1]));}float decode(vec2 bytes){return bytes[0]*pow(2.0,8.0)+bytes[1];}vec2 decode(vec4 bytes){return vec2(decode(bytes.rg),decode(bytes.ba));}float random(vec2 uSeed){return fract(sin(dot(uSeed.xy,vec2(12.9898,78.233)))*43758.5453123);}vec2 getDirectionFromWindData(vec4 windData){return vec2((windData.r*255.0-128.0)/2.0,(windData.g*255.0-128.0)/2.0);}void main(){float maxValue=pow(2.0,16.0)-1.0;vec4 particlePositionEncoded=texture2D(uParticlePositionTexture,(gl_FragCoord.xy-0.5)/(uParticleTextureSize-1.0));vec2 particlePositionNormalized=decode(round(particlePositionEncoded*255.0))/maxValue;vec2 particleMercatorCoordinate=vec2(uMercatorTopLeft.x+uMercatorSize.x*particlePositionNormalized.x,uMercatorTopLeft.y+uMercatorSize.y*(1.0-particlePositionNormalized.y));vec4 metaDataEncoded=texture2D(uParticleMetaTexture,(gl_FragCoord.xy-0.5)/(uParticleTextureSize-1.0));vec2 metaData=decode(round(metaDataEncoded*255.0));float remainingLifespan=metaData.x;vec2 windTextureCoordinateNormalized=vec2((particleMercatorCoordinate.x-uWindTextureMercatorTopLeft.x)/uWindTextureMercatorSize.x,1.0-(particleMercatorCoordinate.y-uWindTextureMercatorTopLeft.y)/uWindTextureMercatorSize.y);if(windTextureCoordinateNormalized.x<0.0||windTextureCoordinateNormalized.x>1.0){windTextureCoordinateNormalized.x=windTextureCoordinateNormalized.x-floor(windTextureCoordinateNormalized.x);}vec4 windData=texture2D(uWindTexture,windTextureCoordinateNormalized);bool hasWindData=windData.a!=0.0;if(hasWindData){vec2 direction=getDirectionFromWindData(windData);float pixelsPerSecond=uPpmps*(uDeltaTime/1000.0);vec2 pixelsPerSecondNormalized=pixelsPerSecond/uSize;particlePositionNormalized+=direction*pixelsPerSecondNormalized;}remainingLifespan-=uDeltaTime;bool shouldDie=remainingLifespan<=0.0;if(particlePositionNormalized.x<=0.0||particlePositionNormalized.x>=1.0||particlePositionNormalized.y<=0.0||particlePositionNormalized.y>=1.0||shouldDie){particlePositionNormalized.x=random(gl_FragCoord.xy*uSeed.x);particlePositionNormalized.y=random(gl_FragCoord.xy*uSeed.y);remainingLifespan=uMinParticleLifespan+random(gl_FragCoord.xy*uSeed.z)*(uMaxParticleLifespan-uMinParticleLifespan);}if(uUpdatePosition){gl_FragColor=encode(round(particlePositionNormalized*maxValue))/255.0;}else{if(remainingLifespan<0.0){remainingLifespan=0.0;}gl_FragColor.rg=encode(remainingLifespan)/255.0;gl_FragColor.a=hasWindData ? 1.0 : 0.0;}}`,gI="attribute vec2 aPosition;void main(){gl_Position=vec4(aPosition,0.0,1.0);}";class yI extends Qr{constructor({gl:n,particlePositionTexture:c,particleMetaTexture:f}){super(n,gI,fI),this.particlePositionTexture=c,this.particleMetaTexture=f,this.vertexBuffer=new Ai({gl:n,data:new Float32Array(Zc)})}render({gl:n,size:c,deltaTime:f,ppmps:_,particleLifespan:w,mercatorBounds:I,windTexture:l,windTextureMercatorBounds:D}){n.useProgram(this.program),n.disable(n.BLEND),l.bind(),n.uniform1f(this.getUniform("uDeltaTime"),f),n.uniform3fv(this.getUniform("uSeed"),[Math.random(),Math.random(),Math.random()]),n.uniform1f(this.getUniform("uPpmps"),_),n.uniform1f(this.getUniform("uMinParticleLifespan"),w.min),n.uniform1f(this.getUniform("uMaxParticleLifespan"),w.max),n.uniform2fv(this.getUniform("uSize"),[c.width,c.height]),n.uniform2fv(this.getUniform("uMercatorSize"),[I.right-I.left,I.bottom-I.top]),n.uniform2fv(this.getUniform("uMercatorTopLeft"),[I.left,I.top]),n.uniform1i(this.getUniform("uWindTexture"),l.index),n.uniform2fv(this.getUniform("uWindTextureMercatorSize"),[D.right-D.left,D.bottom-D.top]),n.uniform2fv(this.getUniform("uWindTextureMercatorTopLeft"),[D.left,D.top]),n.uniform1i(this.getUniform("uParticlePositionTexture"),this.particlePositionTexture.index),n.uniform1i(this.getUniform("uParticleMetaTexture"),this.particleMetaTexture.index),n.uniform2fv(this.getUniform("uParticleTextureSize"),[this.particlePositionTexture.size.width,this.particlePositionTexture.size.height]),this.vertexBuffer.bind(),n.vertexAttribPointer(this.getAttribute("aPosition"),2,n.FLOAT,!1,0,0),n.enableVertexAttribArray(this.getAttribute("aPosition")),this.particlePositionTexture.drawToBackground(()=>{n.clear(n.COLOR_BUFFER_BIT),n.uniform1i(this.getUniform("uUpdatePosition"),1),n.drawArrays(n.TRIANGLES,0,6)}),this.particlePositionTexture.swap(),this.particleMetaTexture.drawToBackground(()=>{n.clear(n.COLOR_BUFFER_BIT),n.uniform1i(this.getUniform("uUpdatePosition"),0),n.drawArrays(n.TRIANGLES,0,6)}),this.particleMetaTexture.swap(),cn(n)}}class gg extends Ho{constructor({gl:n,textureIndex:c,size:f}){super({gl:n,textureIndex:c,size:f}),this.framebuffer=zc(n),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,this.framebuffer),this.gl.framebufferTexture2D(this.gl.FRAMEBUFFER,this.gl.COLOR_ATTACHMENT0,this.gl.TEXTURE_2D,this.texture,0),this.backgroundTexture=Wu({gl:n,size:f}),this.backgroundFramebuffer=zc(n),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,this.backgroundFramebuffer),this.gl.framebufferTexture2D(this.gl.FRAMEBUFFER,this.gl.COLOR_ATTACHMENT0,this.gl.TEXTURE_2D,this.backgroundTexture,0)}setSize(n){this.size.width===n.width&&this.size.height===n.height||(super.setSize(n),Mf({gl:this.gl,texture:this.backgroundTexture,size:n}))}swap(){const n=this.texture;this.texture=this.backgroundTexture,this.backgroundTexture=n;const c=this.framebuffer;this.framebuffer=this.backgroundFramebuffer,this.backgroundFramebuffer=c}drawToBackground(n){this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,this.backgroundFramebuffer),this.gl.viewport(0,0,this.size.width,this.size.height),n(),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,null)}}function Su(a){return[a>>8,a&Math.pow(2,8)-1]}const _I=0,xI=1,vI=3,bI=6,Vc=256;class jm extends gg{constructor({gl:n,type:c,textureIndex:f,particleCount:_}){super({gl:n,textureIndex:f,size:qm({particleCount:_})}),this.type=c,this.reset({particleCount:_})}reset({particleCount:n}){this.setSize(qm({particleCount:n})),Gx({gl:this.gl,texture:this.texture,size:this.size,data:this.type==="position"?this.createEmptyPositionData():this.createEmptyMedaData()})}createEmptyPositionData(){const n=Su(0),c=Su(0),f=new Uint8Array(this.size.width*this.size.height*4);for(let _=0;_<f.length;_+=4)f[_+0]=n[0],f[_+1]=n[1],f[_+2]=c[0],f[_+3]=c[1];return f}createEmptyMedaData(){const n=Su(0),c=new Uint8Array(this.size.width*this.size.height*4);for(let f=0;f<c.length;f+=4)c[f+0]=n[0],c[f+1]=n[1],c[f+2]=0,c[f+3]=0;return c}}function qm({particleCount:a}){const n=Vc,c=Math.ceil(a/n);return{width:n,height:Math.min(Vc,c)}}class wI{constructor({id:n,map:c,tileZ:f,sources:_,sourceIndex:w,onFrameBegin:I,onFrameEnd:l}){this.options=Nc,this.isZooming=!1,this.shouldReset=!1,this.handleRequestAnimationFrame=()=>{this.map.maplibregl.triggerRepaint(),this.requestAnimationFrameId=window.requestAnimationFrame(this.handleRequestAnimationFrame)},this.handleWebGLContextLost=()=>{},this.handleZoomStart=()=>{this.isZooming=!0},this.handleMoveEnd=()=>{this.isZooming=!1,this.shouldReset=!0,this.windTileCache.updateTiles()},this.handleVisibilityChange=()=>{document.hidden===!0&&(this.previousRenderTime=void 0)},this.id=n,this.type="custom",this.map=c,this.particleCount=Wm({map:c.maplibregl,particlesPer10cm2ZoomedIn:this.options.particlesPer10cm2ZoomedIn,particlesPer10cm2ZoomedOut:this.options.particlesPer10cm2ZoomedOut}),this.sourceIndex=w,this.shouldShowParticles=!this.map.prefersReducedMotion,this.onFrameBegin=I,this.onFrameEnd=l,this.measure=void 0,this.windTileCache=new Hc({map:this.map.maplibregl,padding:-100,textureIndex:bI,tileZ:f,sourceIndex:w,sources:_,filter:"LINEAR"}),this.windMercatorBounds=Up({map:this.map.maplibregl,padding:-100})}setOptions({options:n,key:c}){this.options=n,c!=="particlesPer10cm2ZoomedIn"&&c!=="particlesPer10cm2ZoomedOut"||(this.shouldReset=!0)}setTileZ(n){this.windTileCache.setTileZ(n)}toggleTextureDebugView(n){this.windTileCache.toggleCanvasDebugView(n)}setSourceIndex(n){this.sourceIndex=n,this.windTileCache.setSourceIndex(this.sourceIndex),this.options.resetParticlesEachFrame&&(this.shouldReset=!0)}toggleShouldShowParticles(){this.previousRenderTime=void 0,this.shouldShowParticles=!this.shouldShowParticles}isNextFrameReady(){return this.shouldShowParticles===!1||this.windTileCache.nextFrameReady}onAdd(n,c){var f;const _=Sr({map:this.map.maplibregl,padding:-100,withPixelRatio:!1});this.particlePositionTexture=new jm({gl:c,type:"position",textureIndex:xI,particleCount:this.particleCount}),this.particleMetaTexture=new jm({gl:c,type:"meta",textureIndex:_I,particleCount:this.particleCount}),this.screenTexture=new gg({gl:c,textureIndex:vI,size:_}),this.drawWindParticlesProgram=new mI({map:this.map,gl:c,screenTexture:this.screenTexture,particlePositionTexture:this.particlePositionTexture,particleMetaTexture:this.particleMetaTexture,particleCount:this.particleCount}),this.drawScreenProgram=new uI({map:this.map,gl:c,screenTexture:this.screenTexture}),this.moveWindParticlesProgram=new yI({gl:c,particlePositionTexture:this.particlePositionTexture,particleMetaTexture:this.particleMetaTexture}),(f=this.measure)===null||f===void 0||f.show(),this.map.maplibregl.on("webglcontextlost",this.handleWebGLContextLost),this.map.maplibregl.on("zoomstart",this.handleZoomStart),this.map.maplibregl.on("moveend",this.handleMoveEnd),document.addEventListener("visibilitychange",this.handleVisibilityChange),this.requestAnimationFrameId=window.requestAnimationFrame(this.handleRequestAnimationFrame)}onRemove(){var n;this.windTileCache.onRemove(),(n=this.measure)===null||n===void 0||n.hide(),this.map.maplibregl.off("webglcontextlost",this.handleWebGLContextLost),this.map.maplibregl.off("zoomstart",this.handleZoomStart),this.map.maplibregl.off("moveend",this.handleMoveEnd),document.removeEventListener("visibilitychange",this.handleVisibilityChange),this.requestAnimationFrameId!=null&&(window.cancelAnimationFrame(this.requestAnimationFrameId),this.requestAnimationFrameId=void 0)}prerender(n,c){var f,_,w,I,l,D,B,J,K;if(document.hidden===!0||this.shouldShowParticles===!1||this.drawWindParticlesProgram==null||this.drawScreenProgram==null)return;const Z=Sr({map:this.map.maplibregl,padding:-100,withPixelRatio:!1});(f=this.screenTexture)===null||f===void 0||f.setSize(Z),this.windTileCache.prerender(n),this.shouldReset===!0&&(this.particleCount=Wm({map:this.map.maplibregl,particlesPer10cm2ZoomedIn:this.options.particlesPer10cm2ZoomedIn,particlesPer10cm2ZoomedOut:this.options.particlesPer10cm2ZoomedOut}),(_=this.particlePositionTexture)===null||_===void 0||_.reset({particleCount:this.particleCount}),(w=this.particleMetaTexture)===null||w===void 0||w.reset({particleCount:this.particleCount}),(I=this.drawScreenProgram)===null||I===void 0||I.clear({gl:n}),(l=this.screenTexture)===null||l===void 0||l.swap(),this.windMercatorBounds=Up({map:this.map.maplibregl,padding:-100}),this.shouldReset=!1,this.previousRenderTime=wu()),(D=this.measure)===null||D===void 0||D.start("DrawWindParticlesProgram.prerender()"),this.drawWindParticlesProgram.prerender({particleCount:this.particleCount}),(B=this.measure)===null||B===void 0||B.end("DrawWindParticlesProgram.prerender()"),(J=this.measure)===null||J===void 0||J.start("DrawScreenProgram.prerender()"),this.drawScreenProgram.prerender({bounds:this.windMercatorBounds}),(K=this.measure)===null||K===void 0||K.end("DrawScreenProgram.prerender()")}render(n,c){var f,_,w,I,l,D,B,J,K,Z,we,be,Ae,Fe;if(document.hidden===!0||this.shouldShowParticles===!1||this.isZooming===!0||this.particleCount===0||this.drawWindParticlesProgram==null||this.drawScreenProgram==null||this.moveWindParticlesProgram==null||this.particleMetaTexture==null||this.particlePositionTexture==null||this.screenTexture==null||this.windTileCache.mercatorBounds==null||this.windTileCache.texture==null)return;const $e=Sr({map:this.map.maplibregl,withPixelRatio:!1}),Ve=Sr({map:this.map.maplibregl,withPixelRatio:!0}),Ge=Sr({map:this.map.maplibregl,padding:-100,withPixelRatio:!1});this.onFrameBegin();const lt=wu();this.previousRenderTime==null&&(this.previousRenderTime=lt),lt-this.previousRenderTime>1e3&&(this.previousRenderTime=lt);let rt=lt-this.previousRenderTime;rt=rt>150?150:rt,(f=this.measure)===null||f===void 0||f.start("Render");const Xe=Math.floor(rt/6.666666666666667);if(Xe>0){(_=this.measure)===null||_===void 0||_.start("DrawScreenProgram.render(background-texture)"),this.drawScreenProgram.render({gl:n,viewportSize:$e,target:"background-texture",alphaVariables:{particleAlpha:{zoomedOut:this.options.particleAlphaZoomedOut,zoomedIn:this.options.particleAlphaZoomedIn},particleTailDuration:this.options.particleTailDuration,updateDuration:6.666666666666667,numberOfUpdates:Xe}}),(w=this.measure)===null||w===void 0||w.end("DrawScreenProgram.render(background-texture)");for(let xt=Xe-1;xt>=0;xt--)(I=this.measure)===null||I===void 0||I.start("Update"),(l=this.measure)===null||l===void 0||l.start("DrawWindParticlesProgram.render()"),this.drawWindParticlesProgram.render({gl:n,particleCount:this.particleCount,particleSize:this.options.particleSize,particleBlurRadiusStart:this.options.particleBlurRadiusStart,alphaVariables:{particleAlpha:{zoomedOut:this.options.particleAlphaZoomedOut,zoomedIn:this.options.particleAlphaZoomedIn},particleTailDuration:this.options.particleTailDuration,updateDuration:6.666666666666667,index:xt}}),(D=this.measure)===null||D===void 0||D.end("DrawWindParticlesProgram.render()"),(B=this.measure)===null||B===void 0||B.start("ScreenTexture.swap()"),this.screenTexture.swap(),(J=this.measure)===null||J===void 0||J.end("ScreenTexture.swap()"),(K=this.measure)===null||K===void 0||K.start("MoveWindParticlesProgram.render()"),this.moveWindParticlesProgram.render({gl:n,size:Ge,deltaTime:6.666666666666667,ppmps:this.options.pixelsPerMeterPerSecond,particleLifespan:this.options.particleLifespan,mercatorBounds:this.windMercatorBounds,windTexture:this.windTileCache.texture,windTextureMercatorBounds:this.windTileCache.mercatorBounds}),(Z=this.measure)===null||Z===void 0||Z.end("MoveWindParticlesProgram.render()"),this.previousRenderTime+=6.666666666666667,(we=this.measure)===null||we===void 0||we.end("Update")}if((be=this.measure)===null||be===void 0||be.start("DrawScreenProgram.render()"),this.drawScreenProgram.render({gl:n,viewportSize:Ve,target:"canvas",matrix:c,alphaVariables:{particleAlpha:{zoomedOut:this.options.particleAlphaZoomedOut,zoomedIn:this.options.particleAlphaZoomedIn},particleTailDuration:this.options.particleTailDuration,updateDuration:6.666666666666667,numberOfUpdates:Xe}}),(Ae=this.measure)===null||Ae===void 0||Ae.end("DrawScreenProgram.render()"),(Fe=this.measure)===null||Fe===void 0||Fe.end("Render"),this.measure!=null){const xt=wu();this.previousMeasureTime==null&&(this.previousMeasureTime=xt),xt-this.previousMeasureTime>=1e3&&(this.measure.update(["Render","Update","ScreenTexture.swap()","MoveWindParticlesProgram.render()","DrawWindParticlesProgram.prerender()","DrawWindParticlesProgram.render()","DrawScreenProgram.prerender()","DrawScreenProgram.render(background-texture)","DrawScreenProgram.render()"]),this.measure.clear(),this.previousMeasureTime=xt)}this.onFrameEnd()}}function Wm({map:a,particlesPer10cm2ZoomedIn:n,particlesPer10cm2ZoomedOut:c}){const f=Vc*Vc,_=a.getZoom(),w=a.getMinZoom(),I=a.getMaxZoom(),l=Uu({fromX:Math.pow(_,1/4),from:{min:Math.pow(w,1/4),max:Math.pow(I,1/4)},to:{min:c,max:n}})/10/10,{width:D,height:B}=Sr({map:a,padding:-100,withPixelRatio:!1}),J=D*(2.54/96)*(B*(2.54/96)),K=Math.round(J*l);return Math.min(f,K)}class SI extends cl{constructor({id:n,renderBeforeId:c,map:f,apiData:_}){super(),this.type="custom",this.options=Nc,this.isPlaying=Nc.isPlaying,this.initialHeatMapColors=rI,this.handleRequestAnimationFrame=w=>{var I,l;this.currentFrameStartTime==null&&(this.currentFrameStartTime=w);const D=w-this.currentFrameStartTime;this.isPlaying===!0&&D>this.options.frameDuration&&((I=this.heatmapLayer)===null||I===void 0?void 0:I.isNextFrameReady())&&((l=this.particlesLayer)===null||l===void 0?void 0:l.isNextFrameReady())&&(this.setSourceIndex(this.sourceIndex+1),this.currentFrameStartTime=w),this.requestAnimationFrameId=window.requestAnimationFrame(this.handleRequestAnimationFrame)},this.handleHeatmapFrameBegin=()=>{this.dispatchEvent({type:"wind-layer:heatmap-frame-begin"})},this.handleHeatmapFrameEnd=()=>{this.dispatchEvent({type:"wind-layer:heatmap-frame-end"})},this.handleParticleFrameBegin=()=>{this.dispatchEvent({type:"wind-layer:particle-frame-begin"})},this.handleParticleFrameEnd=()=>{this.dispatchEvent({type:"wind-layer:particle-frame-end"})},this.handleZoom=()=>{const w=Xm({map:this.map});this.tileZ!==w&&(this.setTileZ(w),this.handleClickOrUpdate({type:"update"}))},this.handleMapEvent=w=>di(this,void 0,void 0,function*(){w.type==="map:click"&&(this.activeClickData=w,this.handleClickOrUpdate()),w.type==="map:start-click"&&this.dispatchEvent({type:"wind-layer:start-click",pin:w.pin,point:w.point})}),this.handleClickOrUpdate=({type:w}={type:"click"})=>di(this,void 0,void 0,function*(){var I;if(this.activeClickData==null)return;const{position:l,positionWrapped:D,point:B,pin:J,location:K,locationsNearby:Z}=this.activeClickData;(I=this.clickHandlerAbortController)===null||I===void 0||I.abort(),this.clickHandlerAbortController=new AbortController;const we=this.clickHandlerAbortController,be=this.sources[this.sourceIndex].urlTemplate,Ae=yield JC({position:l,urlTemplate:be,tileZ:this.tileZ});we.signal.aborted||this.dispatchEvent({type:w==="click"?"wind-layer:click":"wind-layer:update",location:K,locationsNearby:Z,position:D,point:B,pin:J,currentFrame:{index:this.sourceIndex,time:this.getFrames()[this.sourceIndex]},wind:Ae})}),this.id=n,this.renderBeforeId=c,this.map=f,this.tileZ=Xm({map:f}),this.sources=_.times.map(w=>({time:w.time,urlTemplate:f.supportsWebp?w.tiles.webp:w.tiles.jpeg})),this.sourceIndex=this.options.sourceIndex}setOptions({options:n,key:c}){var f,_;this.options=n,(f=this.heatmapLayer)===null||f===void 0||f.setOptions({options:n,key:c}),(_=this.particlesLayer)===null||_===void 0||_.setOptions({options:n,key:c})}setTileZ(n){var c,f;this.tileZ=n,(c=this.heatmapLayer)===null||c===void 0||c.setTileZ(n),(f=this.particlesLayer)===null||f===void 0||f.setTileZ(n),this.dispatchEvent({type:"wind-layer:current-tile-z",tileZ:n})}toggleHeatmap(n){var c;(c=this.heatmapLayer)===null||c===void 0||c.setEnabled(n)}toggleHeatmapLayerTextureDebugView(n){var c;(c=this.heatmapLayer)===null||c===void 0||c.toggleTextureDebugView(n)}toggleParticleLayerTextureDebugView(n){var c;(c=this.particlesLayer)===null||c===void 0||c.toggleTextureDebugView(n)}setSourceIndex(n){var c,f;this.sourceIndex=n,this.sourceIndex>=this.sources.length&&(this.sourceIndex=0),(c=this.heatmapLayer)===null||c===void 0||c.setSourceIndex(this.sourceIndex),(f=this.particlesLayer)===null||f===void 0||f.setSourceIndex(this.sourceIndex),this.dispatchEvent({type:"wind-layer:current-frame",index:this.sourceIndex}),this.handleClickOrUpdate({type:"update"})}setHeatmapColors(n){var c;(c=this.heatmapLayer)===null||c===void 0||c.setHeatmapColors(n)}getHeatMapColors(){return this.initialHeatMapColors}play(){this.isPlaying!==!0&&(this.isPlaying=!0,this.currentFrameStartTime=void 0,this.dispatchEvent({type:"wind-layer:is-playing",value:this.isPlaying}))}pause(){this.isPlaying!==!1&&(this.isPlaying=!1,this.dispatchEvent({type:"wind-layer:is-playing",value:this.isPlaying}))}getIsPlaying(){return this.isPlaying}getCurrentFrameIndex(){return this.sourceIndex}getFrames(){return this.sources.map(n=>n.time)}onAdd(){this.heatmapLayer=new sI({id:mf,map:this.map,tileZ:this.tileZ,sources:this.sources,sourceIndex:this.sourceIndex,initialColors:this.initialHeatMapColors,onFrameBegin:this.handleHeatmapFrameBegin,onFrameEnd:this.handleHeatmapFrameEnd}),this.particlesLayer=new wI({id:l0,map:this.map,tileZ:this.tileZ,sources:this.sources,sourceIndex:this.sourceIndex,onFrameBegin:this.handleParticleFrameBegin,onFrameEnd:this.handleParticleFrameEnd}),this.map.maplibregl.addLayer(this.heatmapLayer,this.renderBeforeId),this.map.maplibregl.addLayer(this.particlesLayer,this.renderBeforeId),this.dispatchEvent({type:"wind-layer:frames",initialFrameIndex:this.options.sourceIndex,frames:this.getFrames()}),this.dispatchEvent({type:"wind-layer:current-frame",index:this.sourceIndex}),this.dispatchEvent({type:"wind-layer:show-particles",value:this.particlesLayer.shouldShowParticles}),this.map.maplibregl.on("zoom",this.handleZoom),this.map.addEventListener(this.handleMapEvent),this.requestAnimationFrameId=window.requestAnimationFrame(this.handleRequestAnimationFrame)}onRemove(){this.heatmapLayer!=null&&this.map.maplibregl.getLayer(this.heatmapLayer.id)!=null&&(this.map.maplibregl.removeLayer(this.heatmapLayer.id),this.heatmapLayer=void 0),this.particlesLayer!=null&&this.map.maplibregl.getLayer(this.particlesLayer.id)!=null&&(this.map.maplibregl.removeLayer(this.particlesLayer.id),this.heatmapLayer=void 0),this.map.maplibregl.off("zoom",this.handleZoom),this.map.removeEventListener(this.handleMapEvent),this.requestAnimationFrameId!=null&&window.cancelAnimationFrame(this.requestAnimationFrameId)}cancelClick(){var n;(n=this.clickHandlerAbortController)===null||n===void 0||n.abort(),this.activeClickData=void 0,this.map.hideSecondaryPin()}render(){}}function Xm({map:a}){return a.maplibregl.getZoom()<=5?3:6}class Oa extends Error{constructor(n,c){const f=new.target.prototype;super(`${n}: Status code '${c}'`),this.statusCode=c,this.__proto__=f}}class rd extends Error{constructor(n="A timeout occurred."){const c=new.target.prototype;super(n),this.__proto__=c}}class Kr extends Error{constructor(n="An abort occurred."){const c=new.target.prototype;super(n),this.__proto__=c}}class TI extends Error{constructor(n,c){const f=new.target.prototype;super(n),this.transport=c,this.errorType="UnsupportedTransportError",this.__proto__=f}}class CI extends Error{constructor(n,c){const f=new.target.prototype;super(n),this.transport=c,this.errorType="DisabledTransportError",this.__proto__=f}}class II extends Error{constructor(n,c){const f=new.target.prototype;super(n),this.transport=c,this.errorType="FailedToStartTransportError",this.__proto__=f}}class EI extends Error{constructor(n){const c=new.target.prototype;super(n),this.errorType="FailedToNegotiateWithServerError",this.__proto__=c}}class AI extends Error{constructor(n,c){const f=new.target.prototype;super(n),this.innerErrors=c,this.__proto__=f}}class yg{constructor(n,c,f){this.statusCode=n,this.statusText=c,this.content=f}}class Kc{get(n,c){return this.send({...c,method:"GET",url:n})}post(n,c){return this.send({...c,method:"POST",url:n})}delete(n,c){return this.send({...c,method:"DELETE",url:n})}getCookieString(n){return""}}var ve;(function(a){a[a.Trace=0]="Trace",a[a.Debug=1]="Debug",a[a.Information=2]="Information",a[a.Warning=3]="Warning",a[a.Error=4]="Error",a[a.Critical=5]="Critical",a[a.None=6]="None"})(ve||(ve={}));class rl{constructor(){}log(n,c){}}rl.instance=new rl;const PI="7.0.7";class Ei{static isRequired(n,c){if(n==null)throw new Error(`The '${c}' argument is required.`)}static isNotEmpty(n,c){if(!n||n.match(/^\s*$/))throw new Error(`The '${c}' argument should not be empty.`)}static isIn(n,c,f){if(!(n in c))throw new Error(`Unknown ${f} value: ${n}.`)}}class Ii{static get isBrowser(){return typeof window=="object"&&typeof window.document=="object"}static get isWebWorker(){return typeof self=="object"&&"importScripts"in self}static get isReactNative(){return typeof window=="object"&&typeof window.document>"u"}static get isNode(){return!this.isBrowser&&!this.isWebWorker&&!this.isReactNative}}function nl(a,n){let c="";return dl(a)?(c=`Binary data of length ${a.byteLength}`,n&&(c+=`. Content: '${MI(a)}'`)):typeof a=="string"&&(c=`String data of length ${a.length}`,n&&(c+=`. Content: '${a}'`)),c}function MI(a){const n=new Uint8Array(a);let c="";return n.forEach(f=>{c+=`0x${f<16?"0":""}${f.toString(16)} `}),c.substr(0,c.length-1)}function dl(a){return a&&typeof ArrayBuffer<"u"&&(a instanceof ArrayBuffer||a.constructor&&a.constructor.name==="ArrayBuffer")}async function _g(a,n,c,f,_,w){const I={},[l,D]=Ua();I[l]=D,a.log(ve.Trace,`(${n} transport) sending data. ${nl(_,w.logMessageContent)}.`);const B=dl(_)?"arraybuffer":"text",J=await c.post(f,{content:_,headers:{...I,...w.headers},responseType:B,timeout:w.timeout,withCredentials:w.withCredentials});a.log(ve.Trace,`(${n} transport) request complete. Response status: ${J.statusCode}.`)}function zI(a){return a===void 0?new Gc(ve.Information):a===null?rl.instance:a.log!==void 0?a:new Gc(a)}class kI{constructor(n,c){this._subject=n,this._observer=c}dispose(){const n=this._subject.observers.indexOf(this._observer);n>-1&&this._subject.observers.splice(n,1),this._subject.observers.length===0&&this._subject.cancelCallback&&this._subject.cancelCallback().catch(c=>{})}}class Gc{constructor(n){this._minLevel=n,this.out=console}log(n,c){if(n>=this._minLevel){const f=`[${new Date().toISOString()}] ${ve[n]}: ${c}`;switch(n){case ve.Critical:case ve.Error:this.out.error(f);break;case ve.Warning:this.out.warn(f);break;case ve.Information:this.out.info(f);break;default:this.out.log(f);break}}}}function Ua(){let a="X-SignalR-User-Agent";return Ii.isNode&&(a="User-Agent"),[a,LI(PI,DI(),FI(),RI())]}function LI(a,n,c,f){let _="Microsoft SignalR/";const w=a.split(".");return _+=`${w[0]}.${w[1]}`,_+=` (${a}; `,n&&n!==""?_+=`${n}; `:_+="Unknown OS; ",_+=`${c}`,f?_+=`; ${f}`:_+="; Unknown Runtime Version",_+=")",_}function DI(){if(Ii.isNode)switch(process.platform){case"win32":return"Windows NT";case"darwin":return"macOS";case"linux":return"Linux";default:return process.platform}else return""}function RI(){if(Ii.isNode)return process.versions.node}function FI(){return Ii.isNode?"NodeJS":"Browser"}function Ym(a){return a.stack?a.stack:a.message?a.message:`${a}`}function BI(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("could not find global")}class OI extends Kc{constructor(n){if(super(),this._logger=n,typeof fetch>"u"){const c=typeof __webpack_require__=="function"?__non_webpack_require__:require;this._jar=new(c("tough-cookie")).CookieJar,this._fetchType=c("node-fetch"),this._fetchType=c("fetch-cookie")(this._fetchType,this._jar)}else this._fetchType=fetch.bind(BI());if(typeof AbortController>"u"){const c=typeof __webpack_require__=="function"?__non_webpack_require__:require;this._abortControllerType=c("abort-controller")}else this._abortControllerType=AbortController}async send(n){if(n.abortSignal&&n.abortSignal.aborted)throw new Kr;if(!n.method)throw new Error("No method defined.");if(!n.url)throw new Error("No url defined.");const c=new this._abortControllerType;let f;n.abortSignal&&(n.abortSignal.onabort=()=>{c.abort(),f=new Kr});let _=null;if(n.timeout){const D=n.timeout;_=setTimeout(()=>{c.abort(),this._logger.log(ve.Warning,"Timeout from HTTP request."),f=new rd},D)}n.content===""&&(n.content=void 0),n.content&&(n.headers=n.headers||{},dl(n.content)?n.headers["Content-Type"]="application/octet-stream":n.headers["Content-Type"]="text/plain;charset=UTF-8");let w;try{w=await this._fetchType(n.url,{body:n.content,cache:"no-cache",credentials:n.withCredentials===!0?"include":"same-origin",headers:{"X-Requested-With":"XMLHttpRequest",...n.headers},method:n.method,mode:"cors",redirect:"follow",signal:c.signal})}catch(D){throw f||(this._logger.log(ve.Warning,`Error from HTTP request. ${D}.`),D)}finally{_&&clearTimeout(_),n.abortSignal&&(n.abortSignal.onabort=null)}if(!w.ok){const D=await Km(w,"text");throw new Oa(D||w.statusText,w.status)}const l=await Km(w,n.responseType);return new yg(w.status,w.statusText,l)}getCookieString(n){let c="";return Ii.isNode&&this._jar&&this._jar.getCookies(n,(f,_)=>c=_.join("; ")),c}}function Km(a,n){let c;switch(n){case"arraybuffer":c=a.arrayBuffer();break;case"text":c=a.text();break;case"blob":case"document":case"json":throw new Error(`${n} is not supported.`);default:c=a.text();break}return c}class UI extends Kc{constructor(n){super(),this._logger=n}send(n){return n.abortSignal&&n.abortSignal.aborted?Promise.reject(new Kr):n.method?n.url?new Promise((c,f)=>{const _=new XMLHttpRequest;_.open(n.method,n.url,!0),_.withCredentials=n.withCredentials===void 0?!0:n.withCredentials,_.setRequestHeader("X-Requested-With","XMLHttpRequest"),n.content===""&&(n.content=void 0),n.content&&(dl(n.content)?_.setRequestHeader("Content-Type","application/octet-stream"):_.setRequestHeader("Content-Type","text/plain;charset=UTF-8"));const w=n.headers;w&&Object.keys(w).forEach(I=>{_.setRequestHeader(I,w[I])}),n.responseType&&(_.responseType=n.responseType),n.abortSignal&&(n.abortSignal.onabort=()=>{_.abort(),f(new Kr)}),n.timeout&&(_.timeout=n.timeout),_.onload=()=>{n.abortSignal&&(n.abortSignal.onabort=null),_.status>=200&&_.status<300?c(new yg(_.status,_.statusText,_.response||_.responseText)):f(new Oa(_.response||_.responseText||_.statusText,_.status))},_.onerror=()=>{this._logger.log(ve.Warning,`Error from HTTP request. ${_.status}: ${_.statusText}.`),f(new Oa(_.statusText,_.status))},_.ontimeout=()=>{this._logger.log(ve.Warning,"Timeout from HTTP request."),f(new rd)},_.send(n.content)}):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}}class $I extends Kc{constructor(n){if(super(),typeof fetch<"u"||Ii.isNode)this._httpClient=new OI(n);else if(typeof XMLHttpRequest<"u")this._httpClient=new UI(n);else throw new Error("No usable HttpClient found.")}send(n){return n.abortSignal&&n.abortSignal.aborted?Promise.reject(new Kr):n.method?n.url?this._httpClient.send(n):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}getCookieString(n){return this._httpClient.getCookieString(n)}}class Tr{static write(n){return`${n}${Tr.RecordSeparator}`}static parse(n){if(n[n.length-1]!==Tr.RecordSeparator)throw new Error("Message is incomplete.");const c=n.split(Tr.RecordSeparator);return c.pop(),c}}Tr.RecordSeparatorCode=30;Tr.RecordSeparator=String.fromCharCode(Tr.RecordSeparatorCode);class NI{writeHandshakeRequest(n){return Tr.write(JSON.stringify(n))}parseHandshakeResponse(n){let c,f;if(dl(n)){const l=new Uint8Array(n),D=l.indexOf(Tr.RecordSeparatorCode);if(D===-1)throw new Error("Message is incomplete.");const B=D+1;c=String.fromCharCode.apply(null,Array.prototype.slice.call(l.slice(0,B))),f=l.byteLength>B?l.slice(B).buffer:null}else{const l=n,D=l.indexOf(Tr.RecordSeparator);if(D===-1)throw new Error("Message is incomplete.");const B=D+1;c=l.substring(0,B),f=l.length>B?l.substring(B):null}const _=Tr.parse(c),w=JSON.parse(_[0]);if(w.type)throw new Error("Expected a handshake response from the server.");return[f,w]}}var Zt;(function(a){a[a.Invocation=1]="Invocation",a[a.StreamItem=2]="StreamItem",a[a.Completion=3]="Completion",a[a.StreamInvocation=4]="StreamInvocation",a[a.CancelInvocation=5]="CancelInvocation",a[a.Ping=6]="Ping",a[a.Close=7]="Close"})(Zt||(Zt={}));class VI{constructor(){this.observers=[]}next(n){for(const c of this.observers)c.next(n)}error(n){for(const c of this.observers)c.error&&c.error(n)}complete(){for(const n of this.observers)n.complete&&n.complete()}subscribe(n){return this.observers.push(n),new kI(this,n)}}const GI=30*1e3,ZI=15*1e3;var ei;(function(a){a.Disconnected="Disconnected",a.Connecting="Connecting",a.Connected="Connected",a.Disconnecting="Disconnecting",a.Reconnecting="Reconnecting"})(ei||(ei={}));class nd{constructor(n,c,f,_){this._nextKeepAlive=0,this._freezeEventListener=()=>{this._logger.log(ve.Warning,"The page is being frozen, this will likely lead to the connection being closed and messages being lost. For more information see the docs at https://docs.microsoft.com/aspnet/core/signalr/javascript-client#bsleep")},Ei.isRequired(n,"connection"),Ei.isRequired(c,"logger"),Ei.isRequired(f,"protocol"),this.serverTimeoutInMilliseconds=GI,this.keepAliveIntervalInMilliseconds=ZI,this._logger=c,this._protocol=f,this.connection=n,this._reconnectPolicy=_,this._handshakeProtocol=new NI,this.connection.onreceive=w=>this._processIncomingData(w),this.connection.onclose=w=>this._connectionClosed(w),this._callbacks={},this._methods={},this._closedCallbacks=[],this._reconnectingCallbacks=[],this._reconnectedCallbacks=[],this._invocationId=0,this._receivedHandshakeResponse=!1,this._connectionState=ei.Disconnected,this._connectionStarted=!1,this._cachedPingMessage=this._protocol.writeMessage({type:Zt.Ping})}static create(n,c,f,_){return new nd(n,c,f,_)}get state(){return this._connectionState}get connectionId(){return this.connection&&this.connection.connectionId||null}get baseUrl(){return this.connection.baseUrl||""}set baseUrl(n){if(this._connectionState!==ei.Disconnected&&this._connectionState!==ei.Reconnecting)throw new Error("The HubConnection must be in the Disconnected or Reconnecting state to change the url.");if(!n)throw new Error("The HubConnection url must be a valid url.");this.connection.baseUrl=n}start(){return this._startPromise=this._startWithStateTransitions(),this._startPromise}async _startWithStateTransitions(){if(this._connectionState!==ei.Disconnected)return Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));this._connectionState=ei.Connecting,this._logger.log(ve.Debug,"Starting HubConnection.");try{await this._startInternal(),Ii.isBrowser&&window.document.addEventListener("freeze",this._freezeEventListener),this._connectionState=ei.Connected,this._connectionStarted=!0,this._logger.log(ve.Debug,"HubConnection connected successfully.")}catch(n){return this._connectionState=ei.Disconnected,this._logger.log(ve.Debug,`HubConnection failed to start successfully because of error '${n}'.`),Promise.reject(n)}}async _startInternal(){this._stopDuringStartError=void 0,this._receivedHandshakeResponse=!1;const n=new Promise((c,f)=>{this._handshakeResolver=c,this._handshakeRejecter=f});await this.connection.start(this._protocol.transferFormat);try{const c={protocol:this._protocol.name,version:this._protocol.version};if(this._logger.log(ve.Debug,"Sending handshake request."),await this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(c)),this._logger.log(ve.Information,`Using HubProtocol '${this._protocol.name}'.`),this._cleanupTimeout(),this._resetTimeoutPeriod(),this._resetKeepAliveInterval(),await n,this._stopDuringStartError)throw this._stopDuringStartError;this.connection.features.inherentKeepAlive||await this._sendMessage(this._cachedPingMessage)}catch(c){throw this._logger.log(ve.Debug,`Hub handshake failed with error '${c}' during start(). Stopping HubConnection.`),this._cleanupTimeout(),this._cleanupPingTimer(),await this.connection.stop(c),c}}async stop(){const n=this._startPromise;this._stopPromise=this._stopInternal(),await this._stopPromise;try{await n}catch{}}_stopInternal(n){return this._connectionState===ei.Disconnected?(this._logger.log(ve.Debug,`Call to HubConnection.stop(${n}) ignored because it is already in the disconnected state.`),Promise.resolve()):this._connectionState===ei.Disconnecting?(this._logger.log(ve.Debug,`Call to HttpConnection.stop(${n}) ignored because the connection is already in the disconnecting state.`),this._stopPromise):(this._connectionState=ei.Disconnecting,this._logger.log(ve.Debug,"Stopping HubConnection."),this._reconnectDelayHandle?(this._logger.log(ve.Debug,"Connection stopped during reconnect delay. Done reconnecting."),clearTimeout(this._reconnectDelayHandle),this._reconnectDelayHandle=void 0,this._completeClose(),Promise.resolve()):(this._cleanupTimeout(),this._cleanupPingTimer(),this._stopDuringStartError=n||new Kr("The connection was stopped before the hub handshake could complete."),this.connection.stop(n)))}stream(n,...c){const[f,_]=this._replaceStreamingParams(c),w=this._createStreamInvocation(n,c,_);let I;const l=new VI;return l.cancelCallback=()=>{const D=this._createCancelInvocation(w.invocationId);return delete this._callbacks[w.invocationId],I.then(()=>this._sendWithProtocol(D))},this._callbacks[w.invocationId]=(D,B)=>{if(B){l.error(B);return}else D&&(D.type===Zt.Completion?D.error?l.error(new Error(D.error)):l.complete():l.next(D.item))},I=this._sendWithProtocol(w).catch(D=>{l.error(D),delete this._callbacks[w.invocationId]}),this._launchStreams(f,I),l}_sendMessage(n){return this._resetKeepAliveInterval(),this.connection.send(n)}_sendWithProtocol(n){return this._sendMessage(this._protocol.writeMessage(n))}send(n,...c){const[f,_]=this._replaceStreamingParams(c),w=this._sendWithProtocol(this._createInvocation(n,c,!0,_));return this._launchStreams(f,w),w}invoke(n,...c){const[f,_]=this._replaceStreamingParams(c),w=this._createInvocation(n,c,!1,_);return new Promise((l,D)=>{this._callbacks[w.invocationId]=(J,K)=>{if(K){D(K);return}else J&&(J.type===Zt.Completion?J.error?D(new Error(J.error)):l(J.result):D(new Error(`Unexpected message type: ${J.type}`)))};const B=this._sendWithProtocol(w).catch(J=>{D(J),delete this._callbacks[w.invocationId]});this._launchStreams(f,B)})}on(n,c){!n||!c||(n=n.toLowerCase(),this._methods[n]||(this._methods[n]=[]),this._methods[n].indexOf(c)===-1&&this._methods[n].push(c))}off(n,c){if(!n)return;n=n.toLowerCase();const f=this._methods[n];if(!!f)if(c){const _=f.indexOf(c);_!==-1&&(f.splice(_,1),f.length===0&&delete this._methods[n])}else delete this._methods[n]}onclose(n){n&&this._closedCallbacks.push(n)}onreconnecting(n){n&&this._reconnectingCallbacks.push(n)}onreconnected(n){n&&this._reconnectedCallbacks.push(n)}_processIncomingData(n){if(this._cleanupTimeout(),this._receivedHandshakeResponse||(n=this._processHandshakeResponse(n),this._receivedHandshakeResponse=!0),n){const c=this._protocol.parseMessages(n,this._logger);for(const f of c)switch(f.type){case Zt.Invocation:this._invokeClientMethod(f);break;case Zt.StreamItem:case Zt.Completion:{const _=this._callbacks[f.invocationId];if(_){f.type===Zt.Completion&&delete this._callbacks[f.invocationId];try{_(f)}catch(w){this._logger.log(ve.Error,`Stream callback threw error: ${Ym(w)}`)}}break}case Zt.Ping:break;case Zt.Close:{this._logger.log(ve.Information,"Close message received from server.");const _=f.error?new Error("Server returned an error on close: "+f.error):void 0;f.allowReconnect===!0?this.connection.stop(_):this._stopPromise=this._stopInternal(_);break}default:this._logger.log(ve.Warning,`Invalid message type: ${f.type}.`);break}}this._resetTimeoutPeriod()}_processHandshakeResponse(n){let c,f;try{[f,c]=this._handshakeProtocol.parseHandshakeResponse(n)}catch(_){const w="Error parsing handshake response: "+_;this._logger.log(ve.Error,w);const I=new Error(w);throw this._handshakeRejecter(I),I}if(c.error){const _="Server returned handshake error: "+c.error;this._logger.log(ve.Error,_);const w=new Error(_);throw this._handshakeRejecter(w),w}else this._logger.log(ve.Debug,"Server handshake complete.");return this._handshakeResolver(),f}_resetKeepAliveInterval(){this.connection.features.inherentKeepAlive||(this._nextKeepAlive=new Date().getTime()+this.keepAliveIntervalInMilliseconds,this._cleanupPingTimer())}_resetTimeoutPeriod(){if((!this.connection.features||!this.connection.features.inherentKeepAlive)&&(this._timeoutHandle=setTimeout(()=>this.serverTimeout(),this.serverTimeoutInMilliseconds),this._pingServerHandle===void 0)){let n=this._nextKeepAlive-new Date().getTime();n<0&&(n=0),this._pingServerHandle=setTimeout(async()=>{if(this._connectionState===ei.Connected)try{await this._sendMessage(this._cachedPingMessage)}catch{this._cleanupPingTimer()}},n)}}serverTimeout(){this.connection.stop(new Error("Server timeout elapsed without receiving a message from the server."))}async _invokeClientMethod(n){const c=n.target.toLowerCase(),f=this._methods[c];if(!f){this._logger.log(ve.Warning,`No client method with the name '${c}' found.`),n.invocationId&&(this._logger.log(ve.Warning,`No result given for '${c}' method and invocation ID '${n.invocationId}'.`),await this._sendWithProtocol(this._createCompletionMessage(n.invocationId,"Client didn't provide a result.",null)));return}const _=f.slice(),w=!!n.invocationId;let I,l,D;for(const B of _)try{const J=I;I=await B.apply(this,n.arguments),w&&I&&J&&(this._logger.log(ve.Error,`Multiple results provided for '${c}'. Sending error to server.`),D=this._createCompletionMessage(n.invocationId,"Client provided multiple results.",null)),l=void 0}catch(J){l=J,this._logger.log(ve.Error,`A callback for the method '${c}' threw error '${J}'.`)}D?await this._sendWithProtocol(D):w?(l?D=this._createCompletionMessage(n.invocationId,`${l}`,null):I!==void 0?D=this._createCompletionMessage(n.invocationId,null,I):(this._logger.log(ve.Warning,`No result given for '${c}' method and invocation ID '${n.invocationId}'.`),D=this._createCompletionMessage(n.invocationId,"Client didn't provide a result.",null)),await this._sendWithProtocol(D)):I&&this._logger.log(ve.Error,`Result given for '${c}' method but server is not expecting a result.`)}_connectionClosed(n){this._logger.log(ve.Debug,`HubConnection.connectionClosed(${n}) called while in state ${this._connectionState}.`),this._stopDuringStartError=this._stopDuringStartError||n||new Kr("The underlying connection was closed before the hub handshake could complete."),this._handshakeResolver&&this._handshakeResolver(),this._cancelCallbacksWithError(n||new Error("Invocation canceled due to the underlying connection being closed.")),this._cleanupTimeout(),this._cleanupPingTimer(),this._connectionState===ei.Disconnecting?this._completeClose(n):this._connectionState===ei.Connected&&this._reconnectPolicy?this._reconnect(n):this._connectionState===ei.Connected&&this._completeClose(n)}_completeClose(n){if(this._connectionStarted){this._connectionState=ei.Disconnected,this._connectionStarted=!1,Ii.isBrowser&&window.document.removeEventListener("freeze",this._freezeEventListener);try{this._closedCallbacks.forEach(c=>c.apply(this,[n]))}catch(c){this._logger.log(ve.Error,`An onclose callback called with error '${n}' threw error '${c}'.`)}}}async _reconnect(n){const c=Date.now();let f=0,_=n!==void 0?n:new Error("Attempting to reconnect due to a unknown error."),w=this._getNextRetryDelay(f++,0,_);if(w===null){this._logger.log(ve.Debug,"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt."),this._completeClose(n);return}if(this._connectionState=ei.Reconnecting,n?this._logger.log(ve.Information,`Connection reconnecting because of error '${n}'.`):this._logger.log(ve.Information,"Connection reconnecting."),this._reconnectingCallbacks.length!==0){try{this._reconnectingCallbacks.forEach(I=>I.apply(this,[n]))}catch(I){this._logger.log(ve.Error,`An onreconnecting callback called with error '${n}' threw error '${I}'.`)}if(this._connectionState!==ei.Reconnecting){this._logger.log(ve.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.");return}}for(;w!==null;){if(this._logger.log(ve.Information,`Reconnect attempt number ${f} will start in ${w} ms.`),await new Promise(I=>{this._reconnectDelayHandle=setTimeout(I,w)}),this._reconnectDelayHandle=void 0,this._connectionState!==ei.Reconnecting){this._logger.log(ve.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");return}try{if(await this._startInternal(),this._connectionState=ei.Connected,this._logger.log(ve.Information,"HubConnection reconnected successfully."),this._reconnectedCallbacks.length!==0)try{this._reconnectedCallbacks.forEach(I=>I.apply(this,[this.connection.connectionId]))}catch(I){this._logger.log(ve.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${I}'.`)}return}catch(I){if(this._logger.log(ve.Information,`Reconnect attempt failed because of error '${I}'.`),this._connectionState!==ei.Reconnecting){this._logger.log(ve.Debug,`Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`),this._connectionState===ei.Disconnecting&&this._completeClose();return}_=I instanceof Error?I:new Error(I.toString()),w=this._getNextRetryDelay(f++,Date.now()-c,_)}}this._logger.log(ve.Information,`Reconnect retries have been exhausted after ${Date.now()-c} ms and ${f} failed attempts. Connection disconnecting.`),this._completeClose()}_getNextRetryDelay(n,c,f){try{return this._reconnectPolicy.nextRetryDelayInMilliseconds({elapsedMilliseconds:c,previousRetryCount:n,retryReason:f})}catch(_){return this._logger.log(ve.Error,`IRetryPolicy.nextRetryDelayInMilliseconds(${n}, ${c}) threw error '${_}'.`),null}}_cancelCallbacksWithError(n){const c=this._callbacks;this._callbacks={},Object.keys(c).forEach(f=>{const _=c[f];try{_(null,n)}catch(w){this._logger.log(ve.Error,`Stream 'error' callback called with '${n}' threw error: ${Ym(w)}`)}})}_cleanupPingTimer(){this._pingServerHandle&&(clearTimeout(this._pingServerHandle),this._pingServerHandle=void 0)}_cleanupTimeout(){this._timeoutHandle&&clearTimeout(this._timeoutHandle)}_createInvocation(n,c,f,_){if(f)return _.length!==0?{arguments:c,streamIds:_,target:n,type:Zt.Invocation}:{arguments:c,target:n,type:Zt.Invocation};{const w=this._invocationId;return this._invocationId++,_.length!==0?{arguments:c,invocationId:w.toString(),streamIds:_,target:n,type:Zt.Invocation}:{arguments:c,invocationId:w.toString(),target:n,type:Zt.Invocation}}}_launchStreams(n,c){if(n.length!==0){c||(c=Promise.resolve());for(const f in n)n[f].subscribe({complete:()=>{c=c.then(()=>this._sendWithProtocol(this._createCompletionMessage(f)))},error:_=>{let w;_ instanceof Error?w=_.message:_&&_.toString?w=_.toString():w="Unknown error",c=c.then(()=>this._sendWithProtocol(this._createCompletionMessage(f,w)))},next:_=>{c=c.then(()=>this._sendWithProtocol(this._createStreamItemMessage(f,_)))}})}}_replaceStreamingParams(n){const c=[],f=[];for(let _=0;_<n.length;_++){const w=n[_];if(this._isObservable(w)){const I=this._invocationId;this._invocationId++,c[I]=w,f.push(I.toString()),n.splice(_,1)}}return[c,f]}_isObservable(n){return n&&n.subscribe&&typeof n.subscribe=="function"}_createStreamInvocation(n,c,f){const _=this._invocationId;return this._invocationId++,f.length!==0?{arguments:c,invocationId:_.toString(),streamIds:f,target:n,type:Zt.StreamInvocation}:{arguments:c,invocationId:_.toString(),target:n,type:Zt.StreamInvocation}}_createCancelInvocation(n){return{invocationId:n,type:Zt.CancelInvocation}}_createStreamItemMessage(n,c){return{invocationId:n,item:c,type:Zt.StreamItem}}_createCompletionMessage(n,c,f){return c?{error:c,invocationId:n,type:Zt.Completion}:{invocationId:n,result:f,type:Zt.Completion}}}const HI=[0,2e3,1e4,3e4,null];class Jm{constructor(n){this._retryDelays=n!==void 0?[...n,null]:HI}nextRetryDelayInMilliseconds(n){return this._retryDelays[n.previousRetryCount]}}class Zo{}Zo.Authorization="Authorization";Zo.Cookie="Cookie";class jI extends Kc{constructor(n,c){super(),this._innerClient=n,this._accessTokenFactory=c}async send(n){let c=!0;this._accessTokenFactory&&(!this._accessToken||n.url&&n.url.indexOf("/negotiate?")>0)&&(c=!1,this._accessToken=await this._accessTokenFactory()),this._setAuthorizationHeader(n);const f=await this._innerClient.send(n);return c&&f.statusCode===401&&this._accessTokenFactory?(this._accessToken=await this._accessTokenFactory(),this._setAuthorizationHeader(n),await this._innerClient.send(n)):f}_setAuthorizationHeader(n){n.headers||(n.headers={}),this._accessToken?n.headers[Zo.Authorization]=`Bearer ${this._accessToken}`:this._accessTokenFactory&&n.headers[Zo.Authorization]&&delete n.headers[Zo.Authorization]}getCookieString(n){return this._innerClient.getCookieString(n)}}var bi;(function(a){a[a.None=0]="None",a[a.WebSockets=1]="WebSockets",a[a.ServerSentEvents=2]="ServerSentEvents",a[a.LongPolling=4]="LongPolling"})(bi||(bi={}));var Hi;(function(a){a[a.Text=1]="Text",a[a.Binary=2]="Binary"})(Hi||(Hi={}));class qI{constructor(){this._isAborted=!1,this.onabort=null}abort(){this._isAborted||(this._isAborted=!0,this.onabort&&this.onabort())}get signal(){return this}get aborted(){return this._isAborted}}class Qm{constructor(n,c,f){this._httpClient=n,this._logger=c,this._pollAbort=new qI,this._options=f,this._running=!1,this.onreceive=null,this.onclose=null}get pollAborted(){return this._pollAbort.aborted}async connect(n,c){if(Ei.isRequired(n,"url"),Ei.isRequired(c,"transferFormat"),Ei.isIn(c,Hi,"transferFormat"),this._url=n,this._logger.log(ve.Trace,"(LongPolling transport) Connecting."),c===Hi.Binary&&typeof XMLHttpRequest<"u"&&typeof new XMLHttpRequest().responseType!="string")throw new Error("Binary protocols over XmlHttpRequest not implementing advanced features are not supported.");const[f,_]=Ua(),w={[f]:_,...this._options.headers},I={abortSignal:this._pollAbort.signal,headers:w,timeout:1e5,withCredentials:this._options.withCredentials};c===Hi.Binary&&(I.responseType="arraybuffer");const l=`${n}&_=${Date.now()}`;this._logger.log(ve.Trace,`(LongPolling transport) polling: ${l}.`);const D=await this._httpClient.get(l,I);D.statusCode!==200?(this._logger.log(ve.Error,`(LongPolling transport) Unexpected response code: ${D.statusCode}.`),this._closeError=new Oa(D.statusText||"",D.statusCode),this._running=!1):this._running=!0,this._receiving=this._poll(this._url,I)}async _poll(n,c){try{for(;this._running;)try{const f=`${n}&_=${Date.now()}`;this._logger.log(ve.Trace,`(LongPolling transport) polling: ${f}.`);const _=await this._httpClient.get(f,c);_.statusCode===204?(this._logger.log(ve.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):_.statusCode!==200?(this._logger.log(ve.Error,`(LongPolling transport) Unexpected response code: ${_.statusCode}.`),this._closeError=new Oa(_.statusText||"",_.statusCode),this._running=!1):_.content?(this._logger.log(ve.Trace,`(LongPolling transport) data received. ${nl(_.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(_.content)):this._logger.log(ve.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(f){this._running?f instanceof rd?this._logger.log(ve.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=f,this._running=!1):this._logger.log(ve.Trace,`(LongPolling transport) Poll errored after shutdown: ${f.message}`)}}finally{this._logger.log(ve.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}}async send(n){return this._running?_g(this._logger,"LongPolling",this._httpClient,this._url,n,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}async stop(){this._logger.log(ve.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{await this._receiving,this._logger.log(ve.Trace,`(LongPolling transport) sending DELETE request to ${this._url}.`);const n={},[c,f]=Ua();n[c]=f;const _={headers:{...n,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials};await this._httpClient.delete(this._url,_),this._logger.log(ve.Trace,"(LongPolling transport) DELETE request sent.")}finally{this._logger.log(ve.Trace,"(LongPolling transport) Stop finished."),this._raiseOnClose()}}_raiseOnClose(){if(this.onclose){let n="(LongPolling transport) Firing onclose event.";this._closeError&&(n+=" Error: "+this._closeError),this._logger.log(ve.Trace,n),this.onclose(this._closeError)}}}class WI{constructor(n,c,f,_){this._httpClient=n,this._accessToken=c,this._logger=f,this._options=_,this.onreceive=null,this.onclose=null}async connect(n,c){return Ei.isRequired(n,"url"),Ei.isRequired(c,"transferFormat"),Ei.isIn(c,Hi,"transferFormat"),this._logger.log(ve.Trace,"(SSE transport) Connecting."),this._url=n,this._accessToken&&(n+=(n.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(this._accessToken)}`),new Promise((f,_)=>{let w=!1;if(c!==Hi.Text){_(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"));return}let I;if(Ii.isBrowser||Ii.isWebWorker)I=new this._options.EventSource(n,{withCredentials:this._options.withCredentials});else{const l=this._httpClient.getCookieString(n),D={};D.Cookie=l;const[B,J]=Ua();D[B]=J,I=new this._options.EventSource(n,{withCredentials:this._options.withCredentials,headers:{...D,...this._options.headers}})}try{I.onmessage=l=>{if(this.onreceive)try{this._logger.log(ve.Trace,`(SSE transport) data received. ${nl(l.data,this._options.logMessageContent)}.`),this.onreceive(l.data)}catch(D){this._close(D);return}},I.onerror=l=>{w?this._close():_(new Error("EventSource failed to connect. The connection could not be found on the server, either the connection ID is not present on the server, or a proxy is refusing/buffering the connection. If you have multiple servers check that sticky sessions are enabled."))},I.onopen=()=>{this._logger.log(ve.Information,`SSE connected to ${this._url}`),this._eventSource=I,w=!0,f()}}catch(l){_(l);return}})}async send(n){return this._eventSource?_g(this._logger,"SSE",this._httpClient,this._url,n,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}stop(){return this._close(),Promise.resolve()}_close(n){this._eventSource&&(this._eventSource.close(),this._eventSource=void 0,this.onclose&&this.onclose(n))}}class XI{constructor(n,c,f,_,w,I){this._logger=f,this._accessTokenFactory=c,this._logMessageContent=_,this._webSocketConstructor=w,this._httpClient=n,this.onreceive=null,this.onclose=null,this._headers=I}async connect(n,c){Ei.isRequired(n,"url"),Ei.isRequired(c,"transferFormat"),Ei.isIn(c,Hi,"transferFormat"),this._logger.log(ve.Trace,"(WebSockets transport) Connecting.");let f;return this._accessTokenFactory&&(f=await this._accessTokenFactory()),new Promise((_,w)=>{n=n.replace(/^http/,"ws");let I;const l=this._httpClient.getCookieString(n);let D=!1;if(Ii.isNode||Ii.isReactNative){const B={},[J,K]=Ua();B[J]=K,f&&(B[Zo.Authorization]=`Bearer ${f}`),l&&(B[Zo.Cookie]=l),I=new this._webSocketConstructor(n,void 0,{headers:{...B,...this._headers}})}else f&&(n+=(n.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(f)}`);I||(I=new this._webSocketConstructor(n)),c===Hi.Binary&&(I.binaryType="arraybuffer"),I.onopen=B=>{this._logger.log(ve.Information,`WebSocket connected to ${n}.`),this._webSocket=I,D=!0,_()},I.onerror=B=>{let J=null;typeof ErrorEvent<"u"&&B instanceof ErrorEvent?J=B.error:J="There was an error with the transport",this._logger.log(ve.Information,`(WebSockets transport) ${J}.`)},I.onmessage=B=>{if(this._logger.log(ve.Trace,`(WebSockets transport) data received. ${nl(B.data,this._logMessageContent)}.`),this.onreceive)try{this.onreceive(B.data)}catch(J){this._close(J);return}},I.onclose=B=>{if(D)this._close(B);else{let J=null;typeof ErrorEvent<"u"&&B instanceof ErrorEvent?J=B.error:J="WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled.",w(new Error(J))}}})}send(n){return this._webSocket&&this._webSocket.readyState===this._webSocketConstructor.OPEN?(this._logger.log(ve.Trace,`(WebSockets transport) sending data. ${nl(n,this._logMessageContent)}.`),this._webSocket.send(n),Promise.resolve()):Promise.reject("WebSocket is not in the OPEN state")}stop(){return this._webSocket&&this._close(void 0),Promise.resolve()}_close(n){this._webSocket&&(this._webSocket.onclose=()=>{},this._webSocket.onmessage=()=>{},this._webSocket.onerror=()=>{},this._webSocket.close(),this._webSocket=void 0),this._logger.log(ve.Trace,"(WebSockets transport) socket closed."),this.onclose&&(this._isCloseEvent(n)&&(n.wasClean===!1||n.code!==1e3)?this.onclose(new Error(`WebSocket closed with status code: ${n.code} (${n.reason||"no reason given"}).`)):n instanceof Error?this.onclose(n):this.onclose())}_isCloseEvent(n){return n&&typeof n.wasClean=="boolean"&&typeof n.code=="number"}}const ef=100;class YI{constructor(n,c={}){if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,Ei.isRequired(n,"url"),this._logger=zI(c.logger),this.baseUrl=this._resolveUrl(n),c=c||{},c.logMessageContent=c.logMessageContent===void 0?!1:c.logMessageContent,typeof c.withCredentials=="boolean"||c.withCredentials===void 0)c.withCredentials=c.withCredentials===void 0?!0:c.withCredentials;else throw new Error("withCredentials option was not a 'boolean' or 'undefined' value");c.timeout=c.timeout===void 0?100*1e3:c.timeout;let f=null,_=null;if(Ii.isNode&&typeof require<"u"){const w=typeof __webpack_require__=="function"?__non_webpack_require__:require;f=w("ws"),_=w("eventsource")}!Ii.isNode&&typeof WebSocket<"u"&&!c.WebSocket?c.WebSocket=WebSocket:Ii.isNode&&!c.WebSocket&&f&&(c.WebSocket=f),!Ii.isNode&&typeof EventSource<"u"&&!c.EventSource?c.EventSource=EventSource:Ii.isNode&&!c.EventSource&&typeof _<"u"&&(c.EventSource=_),this._httpClient=new jI(c.httpClient||new $I(this._logger),c.accessTokenFactory),this._connectionState="Disconnected",this._connectionStarted=!1,this._options=c,this.onreceive=null,this.onclose=null}async start(n){if(n=n||Hi.Binary,Ei.isIn(n,Hi,"transferFormat"),this._logger.log(ve.Debug,`Starting connection with transfer format '${Hi[n]}'.`),this._connectionState!=="Disconnected")return Promise.reject(new Error("Cannot start an HttpConnection that is not in the 'Disconnected' state."));if(this._connectionState="Connecting",this._startInternalPromise=this._startInternal(n),await this._startInternalPromise,this._connectionState==="Disconnecting"){const c="Failed to start the HttpConnection before stop() was called.";return this._logger.log(ve.Error,c),await this._stopPromise,Promise.reject(new Kr(c))}else if(this._connectionState!=="Connected"){const c="HttpConnection.startInternal completed gracefully but didn't enter the connection into the connected state!";return this._logger.log(ve.Error,c),Promise.reject(new Kr(c))}this._connectionStarted=!0}send(n){return this._connectionState!=="Connected"?Promise.reject(new Error("Cannot send data if the connection is not in the 'Connected' State.")):(this._sendQueue||(this._sendQueue=new od(this.transport)),this._sendQueue.send(n))}async stop(n){if(this._connectionState==="Disconnected")return this._logger.log(ve.Debug,`Call to HttpConnection.stop(${n}) ignored because the connection is already in the disconnected state.`),Promise.resolve();if(this._connectionState==="Disconnecting")return this._logger.log(ve.Debug,`Call to HttpConnection.stop(${n}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;this._connectionState="Disconnecting",this._stopPromise=new Promise(c=>{this._stopPromiseResolver=c}),await this._stopInternal(n),await this._stopPromise}async _stopInternal(n){this._stopError=n;try{await this._startInternalPromise}catch{}if(this.transport){try{await this.transport.stop()}catch(c){this._logger.log(ve.Error,`HttpConnection.transport.stop() threw error '${c}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(ve.Debug,"HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.")}async _startInternal(n){let c=this.baseUrl;this._accessTokenFactory=this._options.accessTokenFactory,this._httpClient._accessTokenFactory=this._accessTokenFactory;try{if(this._options.skipNegotiation)if(this._options.transport===bi.WebSockets)this.transport=this._constructTransport(bi.WebSockets),await this._startTransport(c,n);else throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");else{let f=null,_=0;do{if(f=await this._getNegotiationResponse(c),this._connectionState==="Disconnecting"||this._connectionState==="Disconnected")throw new Kr("The connection was stopped during negotiation.");if(f.error)throw new Error(f.error);if(f.ProtocolVersion)throw new Error("Detected a connection attempt to an ASP.NET SignalR Server. This client only supports connecting to an ASP.NET Core SignalR Server. See https://aka.ms/signalr-core-differences for details.");if(f.url&&(c=f.url),f.accessToken){const w=f.accessToken;this._accessTokenFactory=()=>w,this._httpClient._accessToken=w,this._httpClient._accessTokenFactory=void 0}_++}while(f.url&&_<ef);if(_===ef&&f.url)throw new Error("Negotiate redirection limit exceeded.");await this._createTransport(c,this._options.transport,f,n)}this.transport instanceof Qm&&(this.features.inherentKeepAlive=!0),this._connectionState==="Connecting"&&(this._logger.log(ve.Debug,"The HttpConnection connected successfully."),this._connectionState="Connected")}catch(f){return this._logger.log(ve.Error,"Failed to start the connection: "+f),this._connectionState="Disconnected",this.transport=void 0,this._stopPromiseResolver(),Promise.reject(f)}}async _getNegotiationResponse(n){const c={},[f,_]=Ua();c[f]=_;const w=this._resolveNegotiateUrl(n);this._logger.log(ve.Debug,`Sending negotiation request: ${w}.`);try{const I=await this._httpClient.post(w,{content:"",headers:{...c,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials});if(I.statusCode!==200)return Promise.reject(new Error(`Unexpected status code returned from negotiate '${I.statusCode}'`));const l=JSON.parse(I.content);return(!l.negotiateVersion||l.negotiateVersion<1)&&(l.connectionToken=l.connectionId),l}catch(I){let l="Failed to complete negotiation with the server: "+I;return I instanceof Oa&&I.statusCode===404&&(l=l+" Either this is not a SignalR endpoint or there is a proxy blocking the connection."),this._logger.log(ve.Error,l),Promise.reject(new EI(l))}}_createConnectUrl(n,c){return c?n+(n.indexOf("?")===-1?"?":"&")+`id=${c}`:n}async _createTransport(n,c,f,_){let w=this._createConnectUrl(n,f.connectionToken);if(this._isITransport(c)){this._logger.log(ve.Debug,"Connection was provided an instance of ITransport, using that directly."),this.transport=c,await this._startTransport(w,_),this.connectionId=f.connectionId;return}const I=[],l=f.availableTransports||[];let D=f;for(const B of l){const J=this._resolveTransportOrError(B,c,_);if(J instanceof Error)I.push(`${B.transport} failed:`),I.push(J);else if(this._isITransport(J)){if(this.transport=J,!D){try{D=await this._getNegotiationResponse(n)}catch(K){return Promise.reject(K)}w=this._createConnectUrl(n,D.connectionToken)}try{await this._startTransport(w,_),this.connectionId=D.connectionId;return}catch(K){if(this._logger.log(ve.Error,`Failed to start the transport '${B.transport}': ${K}`),D=void 0,I.push(new II(`${B.transport} failed: ${K}`,bi[B.transport])),this._connectionState!=="Connecting"){const Z="Failed to select transport before stop() was called.";return this._logger.log(ve.Debug,Z),Promise.reject(new Kr(Z))}}}}return I.length>0?Promise.reject(new AI(`Unable to connect to the server with any of the available transports. ${I.join(" ")}`,I)):Promise.reject(new Error("None of the transports supported by the client are supported by the server."))}_constructTransport(n){switch(n){case bi.WebSockets:if(!this._options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new XI(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case bi.ServerSentEvents:if(!this._options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new WI(this._httpClient,this._httpClient._accessToken,this._logger,this._options);case bi.LongPolling:return new Qm(this._httpClient,this._logger,this._options);default:throw new Error(`Unknown transport: ${n}.`)}}_startTransport(n,c){return this.transport.onreceive=this.onreceive,this.transport.onclose=f=>this._stopConnection(f),this.transport.connect(n,c)}_resolveTransportOrError(n,c,f){const _=bi[n.transport];if(_==null)return this._logger.log(ve.Debug,`Skipping transport '${n.transport}' because it is not supported by this client.`),new Error(`Skipping transport '${n.transport}' because it is not supported by this client.`);if(KI(c,_))if(n.transferFormats.map(I=>Hi[I]).indexOf(f)>=0){if(_===bi.WebSockets&&!this._options.WebSocket||_===bi.ServerSentEvents&&!this._options.EventSource)return this._logger.log(ve.Debug,`Skipping transport '${bi[_]}' because it is not supported in your environment.'`),new TI(`'${bi[_]}' is not supported in your environment.`,_);this._logger.log(ve.Debug,`Selecting transport '${bi[_]}'.`);try{return this._constructTransport(_)}catch(I){return I}}else return this._logger.log(ve.Debug,`Skipping transport '${bi[_]}' because it does not support the requested transfer format '${Hi[f]}'.`),new Error(`'${bi[_]}' does not support ${Hi[f]}.`);else return this._logger.log(ve.Debug,`Skipping transport '${bi[_]}' because it was disabled by the client.`),new CI(`'${bi[_]}' is disabled by the client.`,_)}_isITransport(n){return n&&typeof n=="object"&&"connect"in n}_stopConnection(n){if(this._logger.log(ve.Debug,`HttpConnection.stopConnection(${n}) called while in state ${this._connectionState}.`),this.transport=void 0,n=this._stopError||n,this._stopError=void 0,this._connectionState==="Disconnected"){this._logger.log(ve.Debug,`Call to HttpConnection.stopConnection(${n}) was ignored because the connection is already in the disconnected state.`);return}if(this._connectionState==="Connecting")throw this._logger.log(ve.Warning,`Call to HttpConnection.stopConnection(${n}) was ignored because the connection is still in the connecting state.`),new Error(`HttpConnection.stopConnection(${n}) was called while the connection is still in the connecting state.`);if(this._connectionState==="Disconnecting"&&this._stopPromiseResolver(),n?this._logger.log(ve.Error,`Connection disconnected with error '${n}'.`):this._logger.log(ve.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch(c=>{this._logger.log(ve.Error,`TransportSendQueue.stop() threw error '${c}'.`)}),this._sendQueue=void 0),this.connectionId=void 0,this._connectionState="Disconnected",this._connectionStarted){this._connectionStarted=!1;try{this.onclose&&this.onclose(n)}catch(c){this._logger.log(ve.Error,`HttpConnection.onclose(${n}) threw error '${c}'.`)}}}_resolveUrl(n){if(n.lastIndexOf("https://",0)===0||n.lastIndexOf("http://",0)===0)return n;if(!Ii.isBrowser)throw new Error(`Cannot resolve '${n}'.`);const c=window.document.createElement("a");return c.href=n,this._logger.log(ve.Information,`Normalizing '${n}' to '${c.href}'.`),c.href}_resolveNegotiateUrl(n){const c=n.indexOf("?");let f=n.substring(0,c===-1?n.length:c);return f[f.length-1]!=="/"&&(f+="/"),f+="negotiate",f+=c===-1?"":n.substring(c),f.indexOf("negotiateVersion")===-1&&(f+=c===-1?"?":"&",f+="negotiateVersion="+this._negotiateVersion),f}}function KI(a,n){return!a||(n&a)!==0}class od{constructor(n){this._transport=n,this._buffer=[],this._executing=!0,this._sendBufferedData=new _c,this._transportResult=new _c,this._sendLoopPromise=this._sendLoop()}send(n){return this._bufferData(n),this._transportResult||(this._transportResult=new _c),this._transportResult.promise}stop(){return this._executing=!1,this._sendBufferedData.resolve(),this._sendLoopPromise}_bufferData(n){if(this._buffer.length&&typeof this._buffer[0]!=typeof n)throw new Error(`Expected data to be of type ${typeof this._buffer} but was of type ${typeof n}`);this._buffer.push(n),this._sendBufferedData.resolve()}async _sendLoop(){for(;;){if(await this._sendBufferedData.promise,!this._executing){this._transportResult&&this._transportResult.reject("Connection stopped.");break}this._sendBufferedData=new _c;const n=this._transportResult;this._transportResult=void 0;const c=typeof this._buffer[0]=="string"?this._buffer.join(""):od._concatBuffers(this._buffer);this._buffer.length=0;try{await this._transport.send(c),n.resolve()}catch(f){n.reject(f)}}}static _concatBuffers(n){const c=n.map(w=>w.byteLength).reduce((w,I)=>w+I),f=new Uint8Array(c);let _=0;for(const w of n)f.set(new Uint8Array(w),_),_+=w.byteLength;return f.buffer}}class _c{constructor(){this.promise=new Promise((n,c)=>[this._resolver,this._rejecter]=[n,c])}resolve(){this._resolver()}reject(n){this._rejecter(n)}}const JI="json";class QI{constructor(){this.name=JI,this.version=1,this.transferFormat=Hi.Text}parseMessages(n,c){if(typeof n!="string")throw new Error("Invalid input for JSON hub protocol. Expected a string.");if(!n)return[];c===null&&(c=rl.instance);const f=Tr.parse(n),_=[];for(const w of f){const I=JSON.parse(w);if(typeof I.type!="number")throw new Error("Invalid payload.");switch(I.type){case Zt.Invocation:this._isInvocationMessage(I);break;case Zt.StreamItem:this._isStreamItemMessage(I);break;case Zt.Completion:this._isCompletionMessage(I);break;case Zt.Ping:break;case Zt.Close:break;default:c.log(ve.Information,"Unknown message type '"+I.type+"' ignored.");continue}_.push(I)}return _}writeMessage(n){return Tr.write(JSON.stringify(n))}_isInvocationMessage(n){this._assertNotEmptyString(n.target,"Invalid payload for Invocation message."),n.invocationId!==void 0&&this._assertNotEmptyString(n.invocationId,"Invalid payload for Invocation message.")}_isStreamItemMessage(n){if(this._assertNotEmptyString(n.invocationId,"Invalid payload for StreamItem message."),n.item===void 0)throw new Error("Invalid payload for StreamItem message.")}_isCompletionMessage(n){if(n.result&&n.error)throw new Error("Invalid payload for Completion message.");!n.result&&n.error&&this._assertNotEmptyString(n.error,"Invalid payload for Completion message."),this._assertNotEmptyString(n.invocationId,"Invalid payload for Completion message.")}_assertNotEmptyString(n,c){if(typeof n!="string"||n==="")throw new Error(c)}}const eE={trace:ve.Trace,debug:ve.Debug,info:ve.Information,information:ve.Information,warn:ve.Warning,warning:ve.Warning,error:ve.Error,critical:ve.Critical,none:ve.None};function tE(a){const n=eE[a.toLowerCase()];if(typeof n<"u")return n;throw new Error(`Unknown log level: ${a}`)}class iE{configureLogging(n){if(Ei.isRequired(n,"logging"),rE(n))this.logger=n;else if(typeof n=="string"){const c=tE(n);this.logger=new Gc(c)}else this.logger=new Gc(n);return this}withUrl(n,c){return Ei.isRequired(n,"url"),Ei.isNotEmpty(n,"url"),this.url=n,typeof c=="object"?this.httpConnectionOptions={...this.httpConnectionOptions,...c}:this.httpConnectionOptions={...this.httpConnectionOptions,transport:c},this}withHubProtocol(n){return Ei.isRequired(n,"protocol"),this.protocol=n,this}withAutomaticReconnect(n){if(this.reconnectPolicy)throw new Error("A reconnectPolicy has already been set.");return n?Array.isArray(n)?this.reconnectPolicy=new Jm(n):this.reconnectPolicy=n:this.reconnectPolicy=new Jm,this}build(){const n=this.httpConnectionOptions||{};if(n.logger===void 0&&(n.logger=this.logger),!this.url)throw new Error("The 'HubConnectionBuilder.withUrl' method must be called before building the connection.");const c=new YI(this.url,n);return nd.create(c,this.logger||rl.instance,this.protocol||new QI,this.reconnectPolicy)}}function rE(a){return a.log!==void 0}const ad={activeHourIndex:0,animationRadiusZoomedIn:40,animationRadiusZoomedOut:40,animationTime:2,animationColorHex:"#FF5C00",initialColorHex:"#FF7300",initialSizeZoomedIn:10,initialSizeZoomedOut:6,initialOpacity:1,sixtySecondsColorHex:"#8C19E5",sixtySecondsSizeZoomedIn:8,sixtySecondsSizeZoomedOut:6,sixtySecondsOpacity:.7,tenMinutesColorHex:"#A24EE4",tenMinutesSizeZoomedIn:6,tenMinutesSizeZoomedOut:4,tenMinutesOpacity:.6,oneHourColorHex:"#8F77A2",oneHourSizeZoomedIn:6,oneHourSizeZoomedOut:4,oneHourOpacity:.5,twelveHoursColorHex:"#ABA3B1",twelveHoursSizeZoomedIn:6,twelveHoursSizeZoomedOut:4,twelveHoursOpacity:.4};var nE=`#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif
varying float vDiffInSeconds;varying float vAnimationTime;varying vec2 vTexCoord;uniform float uPixelRatio;uniform vec2 uAnimationRadius;uniform float uZoom;vec2 mapZoomMinMaxLevels=vec2(2.0,10.0);uniform vec3 uAnimationColor;float cubicBezier(vec4 params,float t){float u=1.0-t;float tt=t*t;float uu=u*u;float uuu=uu*u;float ttt=tt*t;float p=params.x*uuu;p+=params.y*3.0*uu*t;p+=params.z*3.0*u*tt;p+=params.w*ttt;return p;}float rescaleZoomToLightningSize(float toMin,float toMax){return(uZoom-mapZoomMinMaxLevels.x)*(toMax-toMin)/(mapZoomMinMaxLevels.y-mapZoomMinMaxLevels.x)+toMin;}void main(){if(vDiffInSeconds>vAnimationTime){return;}float minRadius=0.0;float maxRadius=rescaleZoomToLightningSize(uAnimationRadius.x,uAnimationRadius.y)*uPixelRatio;float startAlphaInner=0.1;float endAlphaInner=0.0;float startAlphaOuter=1.0;float endAlphaOuter=0.0;float distanceFromLightningCoordinate=distance(gl_FragCoord.xy,vTexCoord.xy);float growthFactorInner=cubicBezier(vec4(0.0,0.5,0.8,1.0),vDiffInSeconds/vAnimationTime);float growthFactorOuter=cubicBezier(vec4(0.0,1.0,0.5,1.0),vDiffInSeconds/vAnimationTime);float currentRadiusInner=mix(minRadius,maxRadius,growthFactorInner);float currentRadiusOuter=mix(minRadius,maxRadius,growthFactorOuter);if(distanceFromLightningCoordinate>=currentRadiusInner&&distanceFromLightningCoordinate>=currentRadiusOuter){discard;}float alphaFactorInner=mix(startAlphaInner,endAlphaInner,growthFactorInner);float alphaFactorOuter=mix(startAlphaOuter,endAlphaOuter,growthFactorOuter);vec4 innerCircleColor=vec4(uAnimationColor.xyz,alphaFactorInner);vec4 outerCircleColor=vec4(uAnimationColor.xyz,alphaFactorOuter);if(distanceFromLightningCoordinate<=currentRadiusOuter){gl_FragColor=outerCircleColor;}if(distanceFromLightningCoordinate<=currentRadiusInner){gl_FragColor=mix(innerCircleColor,outerCircleColor,0.7);}}`,oE="uniform mat4 uMatrix;uniform vec2 uWorldOffset;uniform vec2 uViewport;attribute vec2 aLightningVertex;attribute vec2 aMercatorCoordinate;attribute vec2 aTime;uniform float uCurrentTime;uniform float uAnimationTime;varying float vDiffInSeconds;varying float vAnimationTime;varying vec2 vTexCoord;varying vec2 vViewport;vec2 round(vec2 values){return floor(values+0.5);}void main(){vAnimationTime=uAnimationTime;vDiffInSeconds=(uCurrentTime-aTime.x)/1000.0;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);vTexCoord=positionInPixels;position=vec4(positionInPixels/uViewport*2.0-1.0,0.0,1.0);gl_Position=position+vec4(aLightningVertex,0.0,0.0);}";function Or(a){a=a.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,function(c,f,_,w){return f+f+_+_+w+w});const n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a);return n?{r:parseInt(n[1],16)/255,g:parseInt(n[2],16)/255,b:parseInt(n[3],16)/255}:{r:0,g:0,b:0}}class aE extends Qr{constructor({map:n,gl:c}){super(c,oE,nE),this.map=n,this.initialTimestamp=Date.now(),this.options=ad,this.animationColor=Or(this.options.initialColorHex),this.animationSize={min:this.options.animationRadiusZoomedOut,max:this.options.animationRadiusZoomedIn},this.animationVertices=new Ai({gl:c,data:new Float32Array([])}),this.mercatorCoordinates=new Ai({gl:c,data:new Float32Array([])}),this.timeFloat32=new Ai({gl:c,data:new Float32Array([])})}addLightningData(n){const c=Sr({map:this.map.maplibregl}),f=this.map.maplibregl.getPixelRatio(),_=Lf({width:400*f,height:400*f,viewport:c}),w=new Float32Array(12),I=new Float32Array(12),l=new Float32Array(12);w[0]=_.topLeft.x,w[1]=_.topLeft.y,w[2]=_.bottomLeft.x,w[3]=_.bottomLeft.y,w[4]=_.topRight.x,w[5]=_.topRight.y,w[6]=_.topRight.x,w[7]=_.topRight.y,w[8]=_.bottomLeft.x,w[9]=_.bottomLeft.y,w[10]=_.bottomRight.x,w[11]=_.bottomRight.y,I[0]=n[0],I[1]=n[1],I[2]=n[0],I[3]=n[1],I[4]=n[0],I[5]=n[1],I[6]=n[0],I[7]=n[1],I[8]=n[0],I[9]=n[1],I[10]=n[0],I[11]=n[1],l[0]=n[2],l[1]=n[2],l[2]=n[2],l[3]=n[2],l[4]=n[2],l[5]=n[2],l[6]=n[2],l[7]=n[2],l[8]=n[2],l[9]=n[2],l[10]=n[2],l[11]=n[2],this.animationVertices.addData(w),this.mercatorCoordinates.addData(I),this.timeFloat32.addData(l)}setOptions({options:n,key:c}){this.options=n,c==="initialColorHex"&&(this.animationColor=Or(this.options.animationColorHex)),c!=="animationRadiusZoomedIn"&&c!=="animationRadiusZoomedOut"||(this.animationSize={min:this.options.animationRadiusZoomedOut,max:this.options.animationRadiusZoomedIn})}render({gl:n,matrix:c,mapSize:f}){const _=Date.now()-this.initialTimestamp;n.useProgram(this.program),n.viewport(0,0,f.width,f.height),n.enable(n.BLEND),n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA),n.uniformMatrix4fv(n.getUniformLocation(this.program,"uMatrix"),!1,c),n.uniform2fv(n.getUniformLocation(this.program,"uViewport"),[f.width,f.height]),this.animationVertices.bind(),n.vertexAttribPointer(this.getAttribute("aLightningVertex"),2,n.FLOAT,!1,0,0),n.enableVertexAttribArray(this.getAttribute("aLightningVertex")),this.mercatorCoordinates.bind(),n.vertexAttribPointer(this.getAttribute("aMercatorCoordinate"),2,n.FLOAT,!1,0,0),n.enableVertexAttribArray(this.getAttribute("aMercatorCoordinate")),this.timeFloat32.bind(),n.vertexAttribPointer(this.getAttribute("aTime"),2,n.FLOAT,!1,0,0),n.enableVertexAttribArray(this.getAttribute("aTime")),n.uniform1f(this.getUniform("uCurrentTime"),_),n.uniform1f(this.getUniform("uPixelRatio"),this.map.maplibregl.getPixelRatio()),n.uniform2f(this.getUniform("uAnimationRadius"),this.animationSize.min,this.animationSize.max),n.uniform1f(this.getUniform("uAnimationTime"),this.options.animationTime),n.uniform3f(this.getUniform("uAnimationColor"),this.animationColor.r,this.animationColor.g,this.animationColor.b);const w=ll(this.map.maplibregl);for(const I of w)n.uniform2fv(this.getUniform("uWorldOffset"),[I,0]),n.drawArrays(n.TRIANGLES,0,this.animationVertices.getLength()/2),n.readPixels(0,0,1,1,n.RGBA,n.UNSIGNED_BYTE,new Uint8Array(4));cn(n)}}var sE=`#ifdef GL_OES_standard_derivatives
#extension GL_OES_standard_derivatives : enable
#endif
#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif
varying float vDiffInSeconds;uniform float uAnimationTime;uniform float uLightningHour;uniform vec4 uInitialColor;uniform vec4 uSixtySecondsColor;uniform vec4 uTenMinutesColor;uniform vec4 uOneHourColorColor;uniform vec4 uTwelveHoursColorColor;void main(){vec2 center=2.0*gl_PointCoord-1.0;float radiusFadingCircle=dot(center,center);if(radiusFadingCircle>1.0){discard;}gl_FragColor=vec4(uInitialColor.xyz,vDiffInSeconds/uAnimationTime);if(vDiffInSeconds>=uAnimationTime){gl_FragColor=vec4(uInitialColor.xyz,uInitialColor.w);}if(vDiffInSeconds>60.0){gl_FragColor=vec4(uSixtySecondsColor.xyz,uSixtySecondsColor.w);}if(vDiffInSeconds>600.0){gl_FragColor=vec4(uTenMinutesColor.xyz,uTenMinutesColor.w);}if(vDiffInSeconds>3600.0){if(uLightningHour==1.0){gl_FragColor=vec4(1.0,1.0,1.0,0.0);}else{gl_FragColor=vec4(uOneHourColorColor.xyz,uOneHourColorColor.w);}}if(vDiffInSeconds>43200.0){if(uLightningHour==1.0||uLightningHour==12.0){gl_FragColor=vec4(1.0,1.0,1.0,0.0);}else{gl_FragColor=vec4(uTwelveHoursColorColor.xyz,uTwelveHoursColorColor.w);}}if(vDiffInSeconds>86400.0){gl_FragColor=vec4(1.0,1.0,1.0,0.0);}}`,lE="uniform mat4 uMatrix;uniform vec2 uWorldOffset;attribute vec3 aPosition;uniform float uCurrentTime;uniform float uPixelRatio;uniform vec2 uInitialSize;uniform vec2 uSixtySecondsSize;uniform vec2 uTenMinutesSize;uniform vec2 uOneHourSize;uniform vec2 uTwelveHoursSize;uniform float uZoom;vec2 mapZoomMinMaxLevels=vec2(2.0,10.0);varying float vDiffInSeconds;float rescaleZoomToLightningSize(float toMin,float toMax){return(uZoom-mapZoomMinMaxLevels.x)*(toMax-toMin)/(mapZoomMinMaxLevels.y-mapZoomMinMaxLevels.x)+toMin;}void main(){vDiffInSeconds=(uCurrentTime-aPosition.z)/1000.0;gl_PointSize=rescaleZoomToLightningSize(uInitialSize.x,uInitialSize.y)*uPixelRatio;if(vDiffInSeconds>60.0){gl_PointSize=rescaleZoomToLightningSize(uSixtySecondsSize.x,uSixtySecondsSize.y)*uPixelRatio;}if(vDiffInSeconds>600.0){gl_PointSize=rescaleZoomToLightningSize(uTenMinutesSize.x,uTenMinutesSize.y)*uPixelRatio;}if(vDiffInSeconds>3600.0){gl_PointSize=rescaleZoomToLightningSize(uOneHourSize.x,uOneHourSize.y)*uPixelRatio;}if(vDiffInSeconds>43200.0){gl_PointSize=rescaleZoomToLightningSize(uTwelveHoursSize.x,uTwelveHoursSize.y)*uPixelRatio;}gl_Position=uMatrix*vec4(aPosition.xy+uWorldOffset.xy,0.0,1.0);}";class cE extends Qr{constructor({map:n,gl:c,lightningHour:f}){super(c,lE,sE),this.map=n,this.initializedTimestamp=Date.now(),this.options=ad,this.colors={initial:Or(this.options.initialColorHex),sixtySeconds:Or(this.options.sixtySecondsColorHex),tenMinutes:Or(this.options.tenMinutesColorHex),oneHour:Or(this.options.oneHourColorHex),twelveHours:Or(this.options.twelveHoursColorHex)},this.sizes={initial:{min:this.options.initialSizeZoomedOut,max:this.options.initialSizeZoomedIn},sixtySeconds:{min:this.options.sixtySecondsSizeZoomedOut,max:this.options.sixtySecondsSizeZoomedIn},tenMinutes:{min:this.options.tenMinutesSizeZoomedOut,max:this.options.tenMinutesSizeZoomedIn},oneHour:{min:this.options.oneHourSizeZoomedOut,max:this.options.oneHourSizeZoomedOut},twelveHours:{min:this.options.twelveHoursSizeZoomedOut,max:this.options.twelveHoursSizeZoomedIn}},this.lightningHour=f,this.vertexBuffer=new Ai({gl:c,data:new Float32Array([])})}addLightningData(n){this.vertexBuffer.addData(n)}setLightningData(n){this.vertexBuffer.setData(n)}setMaxLightningAgeInHours(n){this.lightningHour=n}setOptions({options:n,key:c}){this.options=n,c==="initialColorHex"&&(this.colors.initial=Or(this.options.initialColorHex)),c==="sixtySecondsColorHex"&&(this.colors.sixtySeconds=Or(this.options.sixtySecondsColorHex)),c==="tenMinutesColorHex"&&(this.colors.tenMinutes=Or(this.options.tenMinutesColorHex)),c==="oneHourColorHex"&&(this.colors.oneHour=Or(this.options.oneHourColorHex)),c==="twelveHoursColorHex"&&(this.colors.twelveHours=Or(this.options.twelveHoursColorHex)),c!=="initialSizeZoomedIn"&&c!=="initialSizeZoomedOut"||(this.sizes.initial={min:this.options.initialSizeZoomedOut,max:this.options.initialSizeZoomedIn}),c!=="sixtySecondsSizeZoomedIn"&&c!=="sixtySecondsSizeZoomedOut"||(this.sizes.sixtySeconds={min:this.options.sixtySecondsSizeZoomedOut,max:this.options.sixtySecondsSizeZoomedIn}),c!=="tenMinutesSizeZoomedIn"&&c!=="tenMinutesSizeZoomedOut"||(this.sizes.tenMinutes={min:this.options.tenMinutesSizeZoomedOut,max:this.options.tenMinutesSizeZoomedIn}),c!=="oneHourSizeZoomedIn"&&c!=="oneHourSizeZoomedOut"||(this.sizes.oneHour={min:this.options.oneHourSizeZoomedOut,max:this.options.oneHourSizeZoomedIn}),c!=="twelveHoursSizeZoomedIn"&&c!=="twelveHoursSizeZoomedOut"||(this.sizes.twelveHours={min:this.options.twelveHoursSizeZoomedOut,max:this.options.twelveHoursSizeZoomedIn})}render({gl:n,matrix:c,mapSize:f}){const _=Date.now()-this.initializedTimestamp;n.useProgram(this.program),n.viewport(0,0,f.width,f.height),n.enable(n.BLEND),n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA),n.uniformMatrix4fv(n.getUniformLocation(this.program,"uMatrix"),!1,c),this.vertexBuffer.bind(),n.vertexAttribPointer(this.getAttribute("aPosition"),3,n.FLOAT,!1,0,0),n.enableVertexAttribArray(this.getAttribute("aPosition")),n.uniform1f(this.getUniform("uLightningHour"),this.lightningHour),n.uniform1f(this.getUniform("uCurrentTime"),_),n.uniform1f(this.getUniform("uZoom"),parseFloat(this.map.maplibregl.getZoom().toFixed(2))),n.uniform2f(this.getUniform("uInitialSize"),this.sizes.initial.min,this.sizes.initial.max),n.uniform2f(this.getUniform("uSixtySecondsSize"),this.sizes.sixtySeconds.min,this.sizes.sixtySeconds.max),n.uniform2f(this.getUniform("uTenMinutesSize"),this.sizes.tenMinutes.min,this.sizes.tenMinutes.max),n.uniform2f(this.getUniform("uOneHourSize"),this.sizes.oneHour.min,this.sizes.oneHour.max),n.uniform2f(this.getUniform("uTwelveHoursSize"),this.sizes.twelveHours.min,this.sizes.twelveHours.max),n.uniform1f(this.getUniform("uAnimationTime"),this.options.animationTime),n.uniform1f(this.getUniform("uPixelRatio"),this.map.maplibregl.getPixelRatio()),n.uniform4f(this.getUniform("uInitialColor"),this.colors.initial.r,this.colors.initial.g,this.colors.initial.b,this.options.initialOpacity),n.uniform4f(this.getUniform("uSixtySecondsColor"),this.colors.sixtySeconds.r,this.colors.sixtySeconds.g,this.colors.sixtySeconds.b,this.options.sixtySecondsOpacity),n.uniform4f(this.getUniform("uTenMinutesColor"),this.colors.tenMinutes.r,this.colors.tenMinutes.g,this.colors.tenMinutes.b,this.options.tenMinutesOpacity),n.uniform4f(this.getUniform("uOneHourColorColor"),this.colors.oneHour.r,this.colors.oneHour.g,this.colors.oneHour.b,this.options.oneHourOpacity),n.uniform4f(this.getUniform("uTwelveHoursColorColor"),this.colors.twelveHours.r,this.colors.twelveHours.g,this.colors.twelveHours.b,this.options.twelveHoursOpacity);const w=ll(this.map.maplibregl);for(const I of w)n.uniform2fv(this.getUniform("uWorldOffset"),[I,0]),n.drawArrays(n.POINTS,0,this.vertexBuffer.getLength()/3),n.readPixels(0,0,1,1,n.RGBA,n.UNSIGNED_BYTE,new Uint8Array(4));cn(n)}}var hE="FeatureCollection",uE="lightning_area_simple",dE={type:"name",properties:{name:"urn:ogc:def:crs:OGC:1.3:CRS84"}},pE=[{type:"Feature",properties:{id:"outer"},geometry:{type:"Polygon",coordinates:[[[180,-89.9],[-180,-89.9],[-180,89.9],[180,89.9],[180,-89.9]],[[18.900000351000074,55.88126697900003],[20.415333333000035,57.91151666700006],[20.481466667000063,58.8445],[21.776133333000075,59.31148333300007],[24.95276666700005,59.86821666600008],[25.967783333000057,59.861566666000044],[26.543333333000078,60.10666666600008],[27.46388888900003,60.228333332000034],[31.258191130499966,62.50825411992042],[31.519582290499017,62.98263614572511],[29.99895417596801,63.735336082124775],[30.59527327966265,64.04693601575147],[30.577354111728,64.22373600283922],[30.061527095004294,64.40534502306832],[29.976454130297128,64.5789451347909],[30.20687331978607,64.66331804294288],[30.142773217986985,64.7720732369481],[29.640827135874787,64.92096316276431],[29.621182301709553,65.05235402163419],[29.86944505436628,65.11999111894514],[29.602045075602035,65.24443606227217],[29.818882229147533,65.65331804080549],[30.13492708604059,65.70888218002494],[29.90374514336054,66.13388222313353],[29.076109148344358,66.8774911473237],[30.028609181847543,67.6947181596714],[29.356945150298344,68.0824911531887],[28.695000270784362,68.19540913559862],[28.459854023167367,68.53485408692805],[28.81735409690134,68.84700018536716],[28.435554047603546,68.902636073678],[29.129718124823654,69.04804499509572],[29.31388228442387,69.31618224606535],[30.097773294283257,69.50332717808115],[30.109582222423995,69.66384515056708],[30.91236335988461,69.5502001218737],[30.78800215715328,69.7905732069027],[32.0730555560001,70.27470833300009],[34.21357222199998,71.92778613900009],[36.47622092,73.38441785999999],[31.63075833300013,74.25918247200013],[24.910372500000108,74.49722544400004],[19.661400806000074,74.15848669400003],[12.421010250000108,72.90131075],[8.085270559000094,71.43495534000016],[5.15321855600007,69.91525183800019],[3.50232305500009,68.6671178370002],[3.184720651000077,68.099311097],[3.124992554000073,67.46398033600013],[3.395741672000156,66.82827435600007],[3.276950554000109,66.43907983500003],[-.486727777999931,64.43319999900012],[-.48876388899987,63.88748055500014],[.858188889000076,62.66610833300007],[1.79,61.356666666000024],[2.076666667000097,59.8966666660001],[1.711666667000031,59.28999999900009],[1.483333333000132,58.42999999900013],[1.965,57.904999999000154],[2.613333333000128,56.59499999900015],[3.35,55.91927778],[4.25,55.77272222],[5.15,55.25],[5.40333333,55.25],[5.75,55.51119444],[8.42924251,55.08040206],[9.29290003762106,54.80159996054966],[9.60397985,54.88985784],[10.72099957,54.52640596],[11.17540309,54.6210182],[11.67075,54.36483333],[12.11208333,54.41108333],[13.147980620254675,55.0083051309826],[13.992835995319668,54.962442219037555],[14.41416667,54.8125],[14.63672222,54.53622222],[15.46288808,54.61890693],[16.507372086712433,55.35536816684544],[18.36333335100005,55.921549980000066],[18.900000351000074,55.88126697900003]]]}}],mE={type:hE,name:uE,crs:dE,features:pE};const xc=[24,12,1];class fE extends cl{constructor({id:n,map:c,apiData:f}){super(),this.type="custom",this.options=ad,this.handleRequestAnimationFrame=()=>{this.map.maplibregl.triggerRepaint(),window.requestAnimationFrame(this.handleRequestAnimationFrame)},this.handleMapEvent=_=>di(this,void 0,void 0,function*(){_.type==="map:click"&&(this.activeClickData=_,this.handleClickOrUpdate()),_.type==="map:start-click"&&this.dispatchEvent({type:"lightning-layer:start-click",pin:_.pin,point:_.point})}),this.handleClickOrUpdate=({type:_}={type:"click"})=>di(this,void 0,void 0,function*(){var w;if(this.activeClickData==null)return;const{positionWrapped:I,point:l,pin:D,location:B,locationsNearby:J}=this.activeClickData;(w=this.clickHandlerAbortController)===null||w===void 0||w.abort(),this.clickHandlerAbortController=new AbortController,this.clickHandlerAbortController.signal.aborted||this.dispatchEvent({type:_==="click"?"lightning-layer:click":"lightning-layer:update",location:B,locationsNearby:J,position:I,point:l,pin:D})}),this.id=n,this.type="custom",this.map=c,this.apiData=f,this.activeIndex=this.options.activeHourIndex,this.maxLightningAgeInHours=xc[this.activeIndex]}setOptions({options:n,key:c}){var f,_;this.options=n,(f=this.lightningProgram)===null||f===void 0||f.setOptions({options:n,key:c}),(_=this.lightningAnimationProgram)===null||_===void 0||_.setOptions({options:n,key:c})}setActiveHourIndex(n){this.lightningProgram!=null&&(this.activeIndex=n,this.maxLightningAgeInHours=xc[this.activeIndex],this.lightningProgram.setMaxLightningAgeInHours(this.maxLightningAgeInHours),this.dispatchEvent({type:"lightning-layer:active-hour-index",index:this.activeIndex}))}updateHistoricalLightningData(){if(this.apiData==null||this.lightningProgram==null)return;const n=[];let c=new Float32Array;this.apiData.forEach(f=>{if(this.lightningProgram==null)return;const _=Ur.exports.MercatorCoordinate.fromLngLat({lat:f[2],lon:f[1]});n.push(_.x,_.y,1e3*f[0]-this.lightningProgram.initializedTimestamp)}),c=new Float32Array(n),this.lightningProgram.setLightningData(c)}setHistoricalLightningData(n){this.apiData=n,this.updateHistoricalLightningData()}getActiveHourIndex(){return this.activeIndex}getHours(){return xc}addLiveLightning(n){if(this.lightningProgram==null||this.lightningAnimationProgram==null)return;const c=[],f=Date.now();c.push(n.x,n.y,f-this.lightningProgram.initializedTimestamp);const _=new Float32Array(c);this.lightningProgram.addLightningData(_),this.lightningAnimationProgram.addLightningData(_)}onAdd(n,c){this.map.maplibregl.getSource("lightning-bounds-source-id")==null&&this.map.maplibregl.addSource("lightning-bounds-source-id",{type:"geojson",data:mE}),this.map.maplibregl.getLayer("lightning-bounds-layer-id")==null&&this.map.maplibregl.addLayer({id:"lightning-bounds-layer-id",type:"fill",source:"lightning-bounds-source-id",paint:{"fill-color":"#888888","fill-opacity":.4}}),this.lightningProgram=new cE({map:this.map,gl:c,lightningHour:this.maxLightningAgeInHours}),this.lightningAnimationProgram=new aE({map:this.map,gl:c}),this.connection==null&&(this.connection=new iE().withUrl("https://hubs.yr.no/hubs/lightning-live",{skipNegotiation:!0,transport:bi.WebSockets}).build(),this.connection.on("getEvent",f=>{this.addLiveLightning(Ur.exports.MercatorCoordinate.fromLngLat({lat:f.position.lat,lon:f.position.lon}))})),this.connection.start(),this.updateHistoricalLightningData(),this.dispatchEvent({type:"lightning-layer:hours",hours:xc}),this.dispatchEvent({type:"lightning-layer:active-hour-index",index:this.activeIndex}),this.map.addEventListener(this.handleMapEvent),this.requestAnimationFrameId=requestAnimationFrame(this.handleRequestAnimationFrame)}onRemove(){this.connection!=null&&this.connection.stop(),this.map.maplibregl.getLayer("lightning-bounds-layer-id")!=null&&this.map.maplibregl.removeLayer("lightning-bounds-layer-id"),this.map.maplibregl.getSource("lightning-bounds-source-id")!=null&&this.map.maplibregl.removeSource("lightning-bounds-source-id"),this.map.removeEventListener(this.handleMapEvent),this.requestAnimationFrameId!=null&&window.cancelAnimationFrame(this.requestAnimationFrameId)}onHide(){this.connection!=null&&this.connection.stop()}prerender(n,c){this.lightningProgram}render(n,c){if(this.lightningProgram==null||this.lightningAnimationProgram==null)return;const f=Sr({map:this.map.maplibregl});this.lightningProgram.render({gl:n,matrix:c,mapSize:f}),this.lightningAnimationProgram.render({gl:n,matrix:c,mapSize:f})}cancelClick(){var n;(n=this.clickHandlerAbortController)===null||n===void 0||n.abort(),this.activeClickData=void 0,this.map.hideSecondaryPin()}}function gE({position:a,urlTemplate:n,tileZ:c}){return di(this,void 0,void 0,function*(){const f=qu({position:a,tileZ:c}),_={x:Math.floor(f.x),y:Math.floor(f.y),z:f.z},w=f.x-_.x,I=f.y-_.y,l=n.replace("{z}",String(_.z)).replace("{x}",String(_.x)).replace("{y}",String(_.y)),D=yield Xu(l),B={x:Math.floor(D.naturalWidth*w),y:Math.floor(D.naturalHeight*I)},J=ho({width:D.width,height:D.height}),K=Un({canvas:J});K.drawImage(D,0,0);const Z=K.getImageData(B.x,B.y,1,1),we=Z.data[0]-128;return{temperature:we,debug:{temperature:we,color:{r:Z.data[0],g:Z.data[1],b:Z.data[2]}}}})}const $u={smoothColorGradient:!0,showColorGradient:!1,tileZ:4,showHeatmap:!0,showHeatmapLayerTemperatureTexture:!1,isPlaying:!1,sourceIndex:0,frameDuration:1e3,multiplyHeatmap:!0,blurHeatmap:!0},yE=[{temperature:-50,color:"#481581"},{temperature:-40,color:"#114F9D"},{temperature:-30,color:"#649BE2"},{temperature:-20,color:"#6AC6EE"},{temperature:-10,color:"#85E4ED"},{temperature:0,color:"#D0F5D9"},{temperature:10,color:"#FFF36E"},{temperature:20,color:"#FFB37A"},{temperature:30,color:"#FF5D46"},{temperature:40,color:"#B21002"},{temperature:50,color:"#78003D"}];var _E=`#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif
uniform sampler2D uTemperatureTexture;uniform sampler2D uColorTexture;varying vec2 vTextureCoordinate;float round(float value){return floor(value+0.5);}vec2 round(vec2 values){return floor(values+0.5);}vec4 round(vec4 values){return floor(values+0.5);}float modulo(float value,float divider){float m=value-floor((value+0.5)/divider)*divider;return floor(m+0.5);}vec2 encode(float value){float byteTwo=modulo(value,pow(2.0,8.0));float byteOne=(value-byteTwo)*(1.0/pow(2.0,8.0));return vec2(byteOne,byteTwo);}vec4 encode(vec2 values){return vec4(encode(values[0]),encode(values[1]));}float decode(vec2 bytes){return bytes[0]*pow(2.0,8.0)+bytes[1];}vec2 decode(vec4 bytes){return vec2(decode(bytes.rg),decode(bytes.ba));}float random(vec2 uSeed){return fract(sin(dot(uSeed.xy,vec2(12.9898,78.233)))*43758.5453123);}void main(){vec4 temperatureData=texture2D(uTemperatureTexture,vTextureCoordinate);bool hasTemperatureData=temperatureData.r!=0.0;float temperature=temperatureData.r*255.0;gl_FragColor=texture2D(uColorTexture,vec2(0.0,temperature/255.0));}`,xE="attribute vec2 aPosition;attribute vec2 aTextureCoordinate;varying vec2 vTextureCoordinate;void main(){vTextureCoordinate=aTextureCoordinate;gl_Position=vec4(aPosition,0.0,1.0);}";class vE extends Qr{constructor({gl:n}){super(n,xE,_E),this.vertexBuffer=new Ai({gl:n,data:new Float32Array(Zc)}),this.textureCoordinatesBuffer=new Ai({gl:n,data:new Float32Array([0,0,0,1,1,1,0,0,1,1,1,0])})}prerender({gl:n,targetTexture:c}){this.framebuffer==null&&(this.framebuffer=zc(n),n.bindFramebuffer(n.FRAMEBUFFER,this.framebuffer),n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,c.texture,0))}render({gl:n,temperatureTexture:c,colorTexture:f,targetTexture:_}){this.framebuffer!=null&&(n.useProgram(this.program),n.bindFramebuffer(n.FRAMEBUFFER,this.framebuffer),n.viewport(0,0,_.size.width,_.size.height),n.uniform1i(this.getUniform("uTemperatureTexture"),c.index),n.uniform1i(this.getUniform("uColorTexture"),f.index),this.vertexBuffer.bind(),n.vertexAttribPointer(this.getAttribute("aPosition"),2,n.FLOAT,!1,0,0),n.enableVertexAttribArray(this.getAttribute("aPosition")),this.textureCoordinatesBuffer.bind(),n.vertexAttribPointer(this.getAttribute("aTextureCoordinate"),2,n.FLOAT,!1,0,0),n.enableVertexAttribArray(this.getAttribute("aTextureCoordinate")),n.drawArrays(n.TRIANGLES,0,6),n.bindFramebuffer(n.FRAMEBUFFER,null),cn(n))}}class bE{constructor({id:n,map:c,tileZ:f,sources:_,sourceIndex:w,initialColors:I,onFrameBegin:l,onFrameEnd:D}){this.enabled=!0,this.options=$u,this.handleWebGLContextLost=()=>{this.setEnabled(!1)},this.handleMove=()=>{this.temperatureTileCache.updateTiles()},this.id=n,this.type="custom",this.map=c,this.currentColors=I,this.onFrameBegin=l,this.onFrameEnd=D,this.temperatureTileCache=new Hc({map:this.map.maplibregl,textureIndex:9,tileZ:f,sourceIndex:w,sources:_,filter:"LINEAR"}),this.colorCanvas=ho({width:1,height:255}),this.setColors(),this.colorCanvas.style.position="absolute",this.colorCanvas.style.top="5vh",this.colorCanvas.style.left="5vh",this.colorCanvas.style.outline="2px solid white",this.colorCanvas.style.width="10px",this.colorCanvas.style.height="90vh",this.colorCanvas.style.imageRendering="pixelated",this.colorCanvas.style.pointerEvents="none",document.body.appendChild(this.colorCanvas),this.colorCanvas.style.display=this.options.showColorGradient===!0?"block":"none"}onAdd(n,c){this.temperatureHeatmapProgram=new vE({map:this.map,gl:c}),this.canvasProgram=new fg({gl:c}),this.blurProgram=new mg({gl:c}),this.map.maplibregl.on("webglcontextlost",this.handleWebGLContextLost),this.map.maplibregl.on("move",this.handleMove)}onRemove(){this.temperatureTileCache.onRemove(),this.map.maplibregl.off("webglcontextlost",this.handleWebGLContextLost),this.map.maplibregl.off("move",this.handleMove)}setOptions({options:n,key:c}){this.options=n,c==="smoothColorGradient"&&this.setColors(),c==="showColorGradient"&&(this.colorCanvas.style.display=this.options.showColorGradient===!0?"block":"none")}setEnabled(n){this.enabled=n,this.enabled===!1&&this.temperatureTileCache.toggleCanvasDebugView(!1)}setTileZ(n){this.temperatureTileCache.setTileZ(n)}setHeatmapColors(n){this.currentColors=n,this.setColors()}toggleTextureDebugView(n){this.temperatureTileCache.toggleCanvasDebugView(n)}setColors(){const n=Un({canvas:this.colorCanvas});if(this.options.smoothColorGradient){On({canvas:this.colorCanvas,width:1,height:255});const c=n.createLinearGradient(0,0,0,254);this.currentColors.forEach(f=>{const{color:_,temperature:w}=f,I=Uu({fromX:w,from:{min:-128,max:128},to:{min:0,max:255}});c.addColorStop(1-I/255,_)}),n.fillStyle=c,n.fillRect(0,0,1,255)}else On({canvas:this.colorCanvas,width:1,height:255}),this.currentColors.forEach(c=>{const{color:f,temperature:_}=c,w=Uu({fromX:_,from:{min:-128,max:128},to:{min:0,max:255}});n.fillStyle=f,n.fillRect(0,255-w,1,w-255)})}setSourceIndex(n){this.temperatureTileCache.setSourceIndex(n)}isNextFrameReady(){var n;return(n=this.temperatureTileCache.nextFrameReady)!==null&&n!==void 0&&n}prerender(n,c){var f;if(this.enabled!==!1&&this.temperatureHeatmapProgram!=null&&this.canvasProgram!=null&&this.blurProgram!=null&&(this.temperatureTileCache.texture!=null&&(this.coloredTemperatureTexture==null&&(this.coloredTemperatureTexture=new Ho({gl:n,textureIndex:11,size:this.temperatureTileCache.texture.size})),this.coloredTemperatureTexture.setSize((f=this.temperatureTileCache.texture)===null||f===void 0?void 0:f.size)),this.colorTexture==null?this.colorTexture=new Ho({gl:n,textureIndex:10,source:this.colorCanvas,flipY:!0,premultiplyAlpha:!0}):this.colorTexture.updateFromSource({source:this.colorCanvas,flipY:!0,premultiplyAlpha:!0}),this.temperatureTileCache.prerender(n),this.coloredTemperatureTexture!=null&&this.temperatureHeatmapProgram.prerender({gl:n,targetTexture:this.coloredTemperatureTexture}),this.temperatureTileCache.mercatorBounds!=null)){const _=Zu(this.temperatureTileCache.mercatorBounds);this.canvasProgram.prerender({mercatorVertices:_}),this.blurProgram.prerender({mercatorVertices:_})}}render(n,c){if(this.enabled===!1||this.temperatureHeatmapProgram==null||this.canvasProgram==null||this.blurProgram==null||this.temperatureTileCache==null||this.temperatureTileCache.texture==null||this.colorTexture==null||this.coloredTemperatureTexture==null)return;this.onFrameBegin();const f=Sr({map:this.map.maplibregl,withPixelRatio:!0});this.temperatureTileCache.texture.bind(),this.colorTexture.bind(),this.temperatureHeatmapProgram.render({gl:n,temperatureTexture:this.temperatureTileCache.texture,colorTexture:this.colorTexture,targetTexture:this.coloredTemperatureTexture}),this.blurProgram.render({map:this.map.maplibregl,gl:n,matrix:c,viewportSize:f,texture:this.coloredTemperatureTexture,blendFunc:this.options.multiplyHeatmap?"multiply":void 0,isEnabled:this.options.blurHeatmap}),this.colorTexture.unbind(),this.temperatureTileCache.texture.unbind(),this.onFrameEnd()}}class wE extends cl{constructor({id:n,renderBeforeId:c,map:f,apiData:_}){super(),this.type="custom",this.options=$u,this.isPlaying=$u.isPlaying,this.initialHeatMapColors=yE,this.handleRequestAnimationFrame=w=>{var I;this.currentFrameStartTime==null&&(this.currentFrameStartTime=w);const l=w-this.currentFrameStartTime;this.isPlaying===!0&&l>this.options.frameDuration&&((I=this.heatmapLayer)===null||I===void 0?void 0:I.isNextFrameReady())&&(this.setSourceIndex(this.sourceIndex+1),this.currentFrameStartTime=w),this.map.maplibregl.triggerRepaint(),this.requestAnimationFrameId=window.requestAnimationFrame(this.handleRequestAnimationFrame)},this.handleHeatmapFrameBegin=()=>{this.dispatchEvent({type:"temperature-layer:heatmap-frame-begin"})},this.handleHeatmapFrameEnd=()=>{this.dispatchEvent({type:"temperature-layer:heatmap-frame-end"})},this.handleZoom=()=>{const w=tf({map:this.map});this.tileZ!==w&&(this.setTileZ(w),this.handleClickOrUpdate({type:"update"}))},this.handleMapEvent=w=>di(this,void 0,void 0,function*(){w.type==="map:click"&&(this.activeClickData=w,this.handleClickOrUpdate()),w.type==="map:start-click"&&this.dispatchEvent({type:"temperature-layer:start-click",pin:w.pin,point:w.point})}),this.handleClickOrUpdate=({type:w}={type:"click"})=>di(this,void 0,void 0,function*(){var I;if(this.activeClickData==null)return;const{position:l,positionWrapped:D,point:B,pin:J,location:K,locationsNearby:Z}=this.activeClickData;(I=this.clickHandlerAbortController)===null||I===void 0||I.abort(),this.clickHandlerAbortController=new AbortController;const we=this.clickHandlerAbortController,be=this.sources[this.sourceIndex].urlTemplate,Ae=yield gE({position:l,urlTemplate:be,tileZ:this.tileZ});we.signal.aborted||this.dispatchEvent({type:w==="click"?"temperature-layer:click":"temperature-layer:update",location:K,locationsNearby:Z,position:D,point:B,pin:J,currentFrame:{index:this.sourceIndex,time:this.getFrames()[this.sourceIndex]},temperature:Ae})}),this.id=n,this.renderBeforeId=c,this.map=f,this.tileZ=tf({map:f}),this.sources=_.times.map(w=>({time:w.time,urlTemplate:f.supportsWebp?w.tiles.webp:w.tiles.jpeg})),this.sourceIndex=this.options.sourceIndex}setOptions({options:n,key:c}){var f;this.options=n,(f=this.heatmapLayer)===null||f===void 0||f.setOptions({options:n,key:c})}setTileZ(n){var c;this.tileZ=n,(c=this.heatmapLayer)===null||c===void 0||c.setTileZ(n),this.dispatchEvent({type:"temperature-layer:current-tile-z",tileZ:n})}toggleHeatmap(n){var c;(c=this.heatmapLayer)===null||c===void 0||c.setEnabled(n)}toggleHeatmapLayerTextureDebugView(n){var c;(c=this.heatmapLayer)===null||c===void 0||c.toggleTextureDebugView(n)}setSourceIndex(n){var c;this.sourceIndex=n,this.sourceIndex>=this.sources.length&&(this.sourceIndex=0),(c=this.heatmapLayer)===null||c===void 0||c.setSourceIndex(this.sourceIndex),this.dispatchEvent({type:"temperature-layer:current-frame",index:this.sourceIndex}),this.handleClickOrUpdate({type:"update"})}setHeatmapColors(n){var c;(c=this.heatmapLayer)===null||c===void 0||c.setHeatmapColors(n)}getHeatMapColors(){return this.initialHeatMapColors}play(){this.isPlaying!==!0&&(this.isPlaying=!0,this.currentFrameStartTime=void 0,this.dispatchEvent({type:"temperature-layer:is-playing",value:this.isPlaying}))}pause(){this.isPlaying!==!1&&(this.isPlaying=!1,this.dispatchEvent({type:"temperature-layer:is-playing",value:this.isPlaying}))}getIsPlaying(){return this.isPlaying}getCurrentFrameIndex(){return this.sourceIndex}getFrames(){return this.sources.map(n=>n.time)}onAdd(){this.heatmapLayer=new bE({id:mf,map:this.map,tileZ:this.tileZ,sources:this.sources,sourceIndex:this.sourceIndex,initialColors:this.initialHeatMapColors,onFrameBegin:this.handleHeatmapFrameBegin,onFrameEnd:this.handleHeatmapFrameEnd}),this.map.maplibregl.addLayer(this.heatmapLayer,this.renderBeforeId),this.dispatchEvent({type:"temperature-layer:frames",initialFrameIndex:this.options.sourceIndex,frames:this.getFrames()}),this.dispatchEvent({type:"temperature-layer:current-frame",index:this.sourceIndex}),this.map.maplibregl.on("zoom",this.handleZoom),this.map.addEventListener(this.handleMapEvent),this.requestAnimationFrameId=window.requestAnimationFrame(this.handleRequestAnimationFrame)}onRemove(){this.heatmapLayer!=null&&this.map.maplibregl.getLayer(this.heatmapLayer.id)!=null&&(this.map.maplibregl.removeLayer(this.heatmapLayer.id),this.heatmapLayer=void 0),this.map.maplibregl.off("zoom",this.handleZoom),this.map.removeEventListener(this.handleMapEvent),this.requestAnimationFrameId!=null&&window.cancelAnimationFrame(this.requestAnimationFrameId)}cancelClick(){var n;(n=this.clickHandlerAbortController)===null||n===void 0||n.abort(),this.activeClickData=void 0,this.map.hideSecondaryPin()}render(){}}function tf({map:a}){return a.maplibregl.getZoom()<=5?3:5}var ti={Y:1,M:2,D:4,H:8,m:16,s:32,S:64},SE={Y:ti.S|ti.s|ti.m|ti.H|ti.D|ti.M,M:ti.S|ti.s|ti.m|ti.H|ti.D,D:ti.S|ti.s|ti.m|ti.H,H:ti.S|ti.s|ti.m,m:ti.S|ti.s,s:ti.S},TE=/^(\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})))?$/,CE=/(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,IE=/(\[[^\]]+\])/g,EE=/(\$\d\d?)/g,Cc=0,xg=18,Ks={isTime:rf,init:function(a){a===void 0&&(a={}),Cc=a.dayStartsAt||0,xg=a.nightStartsAt||18},create:function(a){return a&&typeof a!="string"&&rf(a)?a:new It(a)},now:function(){return this.create().utc()}},It=function(a){if(a&&typeof a!="string")return a;if(this._date="Invalid Date",this._locale=null,this._offset=0,this._offsetString="+00:00",this.isValid=!1,this.timeString="Invalid Date",a==null&&(a=function(){var J=new Date,K=-1*J.getTimezoneOffset();return J.setUTCMinutes(J.getUTCMinutes()+K),J.toISOString().replace("Z",bg(K))}()),!(a.length>30)){var n=a.match(TE);if(n){var c=parseInt(n[1],10),f=n[2]==null?1:parseInt(n[2],10),_=n[3]==null?1:parseInt(n[3],10),w=n[4]==null?0:parseInt(n[4],10),I=n[5]==null?0:parseInt(n[5],10),l=n[6]==null?0:parseInt(n[6],10),D=n[7]==null?0:parseInt(n[7],10),B=n[8]==null?"":n[8];B&&B!="+00:00"&&(this._offset=(n[9]=="+"?1:-1)*(60*+n[10]+ +n[11]),this._offsetString=B),this._date=new Date(Date.UTC(c,f-1,_,w,I,l,D)),this.isValid=vg(this._date),this.timeString=this.toString()}}};function Js(a){return a.isValid=vg(a._date),a.timeString=a.toString(),a}function No(a){switch(a){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 a}function vg(a){return Object.prototype.toString.call(a)=="[object Date]"&&!isNaN(a.getTime())}function rf(a){return a!=null&&a._manipulate!=null&&a._date!=null}function Go(a,n){for(a=String(a),n=n||2;a.length<n;)a="0"+a;return a}function bg(a){var n=String(Math.abs(a/60)).split(".");return(a<0?"-":"+")+Go(n[0])+":"+Go(n[1]?.6*parseInt(n[1],10):0)}It.prototype.offset=function(a){if(a==null)return this._offset;if(a==this._offset)return this;var n=this.utc()._manipulate(a,"minutes");return n._offset=a,n._offsetString=bg(a),Js(n),n},It.prototype.add=function(a,n){return this._manipulate(a,n)},It.prototype.subtract=function(a,n){return this._manipulate(-1*a,n)},It.prototype.diff=function(a,n,c){if(!this.isValid)return NaN;if(!a.isValid)return NaN;var f,_=0,w=this,I=a;if((n=No(n))=="Y"||n=="M")_=w._monthDiff(I),n=="Y"&&(_/=12);else{n!="D"||c||(w=w.startOf("D"),I=I.startOf("D"));var l=w-I;switch(n){case"D":_=(l+6e4*(w._offset-I._offset))/864e5;break;case"H":_=l/36e5;break;case"m":_=l/6e4;break;case"s":_=l/1e3;break;default:_=l}}return c?_:(f=_)<0?Math.ceil(f):Math.floor(f)},It.prototype.startOf=function(a){if(this.isValid){a=No(a);var n=SE[a],c=this.clone(),f=c._date;for(var _ in ti)if(n&ti[_])switch(_){case"M":f.setUTCMonth(0);break;case"D":f.setUTCDate(1);break;case"H":a=="D"&&Cc>f.getUTCHours()&&f.setUTCDate(f.getUTCDate()-1),f.setUTCHours(Cc);break;case"m":f.setUTCMinutes(0);break;case"s":f.setUTCSeconds(0);break;case"S":f.setUTCMilliseconds(0)}return Js(c)}return this},It.prototype.endOf=function(a){return(a=No(a===void 0?"S":a))==="S"?this.clone():this.startOf(a).add(1,a).subtract(1,"S")},It.prototype.year=function(a){return a!=null?this._set(a,"setUTCFullYear"):this._date.getUTCFullYear()},It.prototype.month=function(a){return a!=null?this._set(a,"setUTCMonth"):this._date.getUTCMonth()},It.prototype.date=function(a){return a!=null?this._set(a,"setUTCDate"):this._date.getUTCDate()},It.prototype.day=function(a){var n=this._date.getUTCDay();return a!=null?this._set(this.date()+a-n,"setUTCDate"):n},It.prototype.hour=function(a){return a!=null?this._set(a,"setUTCHours"):this._date.getUTCHours()},It.prototype.minute=function(a){return a!=null?this._set(a,"setUTCMinutes"):this._date.getUTCMinutes()},It.prototype.second=function(a){return a!=null?this._set(a,"setUTCSeconds"):this._date.getUTCSeconds()},It.prototype.millisecond=function(a){return a!=null?this._set(a,"setUTCMilliseconds"):this._date.getUTCMilliseconds()},It.prototype.isSame=function(a,n){if(!this.isValid||!a.isValid)return!1;if(!(n=No(n))||n=="S")return+this._date==+a._date;var c=this,f=a;switch(n=="D"&&(c=c.startOf(n),f=f.startOf(n)),n){case"Y":return c.year()==f.year();case"M":return c.year()==f.year()&&c.month()==f.month();case"D":return c.year()==f.year()&&c.month()==f.month()&&c.date()==f.date();case"H":return c.year()==f.year()&&c.month()==f.month()&&c.date()==f.date()&&c.hour()==f.hour();case"m":return c.year()==f.year()&&c.month()==f.month()&&c.date()==f.date()&&c.hour()==f.hour()&&c.minute()==f.minute();case"s":return c.year()==f.year()&&c.month()==f.month()&&c.date()==f.date()&&c.hour()==f.hour()&&c.minute()==f.minute()&&c.second()==f.second()}},It.prototype.isBefore=function(a,n){return!(!this.isValid||!a.isValid)&&((n=No(n))=="S"?this:this.endOf(n)).valueOf()<a.valueOf()},It.prototype.isAfter=function(a,n){if(!this.isValid||!a.isValid)return!1;var c=(n=No(n))=="S"?a:a.endOf(n);return this.valueOf()>c.valueOf()},It.prototype.locale=function(a){var n=this.clone();return n._locale=a,n},It.prototype.format=function(a,n){var c=this;if(!a)return this.timeString;if(a.length>100)return"";var f=n!=null?this._getRelativeDay(n):"",_=[],w=0;return a=(a=a.replace(IE,function(I){return _.push(I.slice(1,-1)),"$"+w++})).replace(CE,function(I){switch(I){case"YY":return String(c.year()).slice(-2);case"YYYY":return c.year();case"M":return c.month()+1;case"MM":return Go(c.month()+1);case"MMM":return c._localeHasProperty("monthsShort")?c._locale.monthsShort[c.month()]:"[missing locale]";case"MMMM":return c._localeHasProperty("months")?c._locale.months[c.month()]:"[missing locale]";case"LLL":return c._localeHasProperty("monthsShortStandalone")?c._locale.monthsShortStandalone[c.month()]:c._localeHasProperty("monthsShort")?c._locale.monthsShort[c.month()]:"[missing locale]";case"LLLL":return c._localeHasProperty("monthsStandalone")?c._locale.monthsStandalone[c.month()]:c._localeHasProperty("months")?c._locale.months[c.month()]:"[missing locale]";case"D":return c.date();case"DD":return Go(c.date());case"ddr":return f?c._localeHasProperty(f)?c._locale[f]:"[missing locale]":c._localeHasProperty("daysShort")?c._locale.daysShort[c.day()]:"[missing locale]";case"dddr":return f?c._localeHasProperty(f)?c._locale[f]:"[missing locale]":c._localeHasProperty("days")?c._locale.days[c.day()]:"[missing locale]";case"d":return c.day();case"ddd":return c._localeHasProperty("daysShort")?c._locale.daysShort[c.day()]:"[missing locale]";case"dddd":return c._localeHasProperty("days")?c._locale.days[c.day()]:"[missing locale]";case"ccc":return c._localeHasProperty("daysShortStandalone")?c._locale.daysShortStandalone[c.day()]:c._localeHasProperty("daysShort")?c._locale.daysShort[c.day()]:"[missing locale]";case"cccc":return c._localeHasProperty("daysStandalone")?c._locale.daysStandalone[c.day()]:c._localeHasProperty("days")?c._locale.days[c.day()]:"[missing locale]";case"Hr":var l=c._getTimeOfDay();return c._localeHasProperty("daySlots")?c._locale.daySlots[l]:"[missing locale]";case"H":return c.hour();case"HH":return Go(c.hour());case"m":return c.minute();case"mm":return Go(c.minute());case"s":return c.second();case"ss":return Go(c.second());case"S":return Math.floor(c.millisecond()/100);case"SS":return Math.floor(c.millisecond()/10);case"SSS":return c.millisecond();case"ZZ":return c._offsetString;default:return""}}),_.length&&(a=a.replace(EE,function(I){return _[I.slice(1)]})),a},It.prototype.now=function(){var a=new It().offset(this._offset);return a._locale=this._locale,a},It.prototype.utc=function(){if(!this._offset)return this.clone();var a=this.subtract(this._offset,"minutes");return a._offset=0,a._offsetString="+00:00",Js(a)},It.prototype.clone=function(){var a=new It(this.timeString);return a._locale=this._locale,a},It.prototype._set=function(a,n){var c=this.clone();return c._date[n](a),Js(c)},It.prototype._getRelativeDay=function(a){if(a!=null&&a<2){var n=this.hour();return a==1?"tomorrow":n>=xg||n<Cc?"tonight":"today"}return""},It.prototype._getTimeOfDay=function(){var a=this.hour();return a>=0&&a<6?"night":a>=6&&a<12?"morning":a>=12&&a<18?"afternoon":"evening"},It.prototype._localeHasProperty=function(a,n){return n?this._locale&&this._locale[a]&&this._locale[a][n]:this._locale&&this._locale[a]},It.prototype._manipulate=function(a,n){if(this.isValid){var c=this.clone(),f=c._date;switch(No(n)){case"Y":f.setUTCFullYear(f.getUTCFullYear()+a);break;case"M":f.setUTCMonth(f.getUTCMonth()+a);break;case"D":case"d":f.setUTCDate(f.getUTCDate()+a);break;case"H":f.setUTCHours(f.getUTCHours()+a);break;case"m":f.setUTCMinutes(f.getUTCMinutes()+a);break;case"s":f.setUTCSeconds(f.getUTCSeconds()+a);break;case"S":f.setUTCMilliseconds(f.getUTCMilliseconds()+a)}return Js(c)}return this},It.prototype._monthDiff=function(a){var n,c=12*(a._date.getUTCFullYear()-this._date.getUTCFullYear())+(a._date.getUTCMonth()-this._date.getUTCMonth()),f=this._manipulate(c,"M");if(a._date-f._date<0){var _=this._manipulate(c-1,"M");n=(a._date-f._date)/(f._date-_._date)}else{var w=this._manipulate(c+1,"M");n=(a._date-f._date)/(w._date-f._date)}return-(c+n)},It.prototype.toString=function(){return this.isValid?this._date.toISOString().replace("Z",this._offsetString):"Invalid Date"},It.prototype.toJSON=function(){return this.timeString},It.prototype.valueOf=function(){return this.isValid?+this._date-6e4*(this._offset||0):NaN};function AE({observations:a,forecast:n}){const c=[...a.times],f=[];a.times.forEach(Z=>{n.times.forEach(we=>{we.time===Z.time&&f.push(we.time)})}),n.times.forEach(Z=>{f.includes(Z.time)===!1&&c.push(Z)});const _=Ks.create().now(),w=_.offset();let I=!0,l=c.find(Z=>{const we=Ks.create(Z.time).offset(w);return _.diff(we,"minutes")<5});l==null&&(l=c[Math.round(c.length/2)],I=!1);const D=Ks.create(l?.time).add(91,"minutes"),B=Ks.create(l?.time).subtract(91,"minutes"),J=c.filter(Z=>{const we=Ks.create(Z.time);return we.isAfter(B,"minute")&&we.isBefore(D,"minute")}),K=J.findIndex(Z=>Z.time===l?.time);return{apiData:Object.assign(Object.assign({},n),{times:J}),initialIndex:K,initialIndexIsNow:I}}function $n(a){window.webkit!=null&&window.webkit?.messageHandlers?.appInterface?.postMessage(a),window.apiInterface!=null&&window.apiInterface?.postMessage(JSON.stringify(a))}const PE="radar";function ME({map:a,radarData:n,style:c}){const f=new hv({id:PE,map:a,radarData:n});return f.addEventListener(_=>{$n(_)}),a.addLayer({layer:f,renderBeforeId:c.renderBeforeId,zoomLevels:{initial:5,min:3,max:12},pin:"dynamic-secondary-with-static-primary",styleId:c.id}),f}function zE({descriptionValues:a,units:n,translate:c}){const f={distance:c(`units/distance/${n.distance}`),temperature:c(`units/temperature/${n.temperature}`),wind:c(`units/wind/${n.wind}`)};return`${a.map(w=>{const{name:I,distance:l,direction:D,temperature:B,symbol:J,wind:K}=w,Z=[];Z.push(c("description/locationLabel",{name:I,unit:f.distance,distance:l,direction:c(`direction/${D}`)})),Z.push(c("description/temperatureLabel",{temperature:B,unit:f.temperature})),J!=null&&Z.push(c(`symbols/s${J.slice(0,2)}`));const we=c(`wind/type/${K.type}`);return Z.push(c("description/windLabel",{speed:K.speed,unit:f.wind,type:we,direction:c(`direction/${K.direction}`)})),Z.join(", ")}).join(". ")}.`}const kE="weather";function LE({map:a,style:n,localeCode:c,translate:f,locationId:_,units:w}){const I=new KC({id:kE,map:a,locationId:_,localeCode:c});return I.addEventListener(l=>{if(l.type==="weather-layer:description-values"){const D=zE({descriptionValues:l.descriptionValues,units:w,translate:f});$n({type:"weather-layer:description",description:D});return}$n(l)}),a.addLayer({layer:I,zoomLevels:{initial:5,min:3,max:12},pin:"none",styleId:n.id}),I}const DE="wind",RE=["wind-layer:heatmap-frame-begin","wind-layer:heatmap-frame-end","wind-layer:particle-frame-begin","wind-layer:particle-frame-end"];function FE({map:a,apiData:n,style:c}){const f=new SI({id:DE,map:a,apiData:n});return f.addEventListener(_=>{if(!RE.includes(_.type)){if(_.type==="wind-layer:click"){const w={lat:+_.position.lat.toFixed(3),lon:+_.position.lon.toFixed(3)};$n({type:"wind-layer:click",position:w,wind:_.wind});return}$n(_)}}),a.addLayer({layer:f,zoomLevels:{initial:5,min:3,max:12},pin:"dynamic-secondary-with-static-primary",styleId:c.id,renderBeforeId:c.renderBeforeId}),f}const BE=150;class OE{constructor({localeCode:n}){this.localeCode=n;const c=document.createElement("div");c.className="scale-line",c.style.display="none";const f=document.createElement("div");f.className="scale-line__values",c.appendChild(f);const _=document.createElement("div");_.className="scale-line__min-value",_.textContent="0",f.appendChild(_);const w=document.createElement("div");w.className="scale-line__max-value",f.appendChild(w);const I=document.createElement("div");I.className="scale-line__line",c.appendChild(I),document.body.appendChild(c),this.rootElement=c,this.maxElement=w,this.lineElement=I}setScale({ratio:n,distance:c,unit:f,translate:_}){const w=_(`scaleLine/${f}`);this.maxElement.textContent=`${c} ${w}`,this.lineElement.style.width=`${n*BE}px`,this.rootElement.style.display=""}}const UE={parent:"primary-marker",pin:"primary-marker-pin",shadow:"primary-marker-shadow"},$E={parent:"secondary-marker",pin:"secondary-marker-pin"};function NE({element:a,localeCode:n,translate:c,position:f,units:_,mode:w}){let I;n==="en"?I=["en","latin"]:n==="sme"?I=["sme","no_override","no","latin"]:I=["no_override","no","latin"];const l=O0(I),D=B0(I,w),B=F0(I,w),J=new u0({localeCode:n,center:f,mapElement:a,supportsWebp:!0,showDefaultAttribution:!1,theme:{font:{family:"-apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif",weight:"500"},colors:{temperatureCold:"#006edb",temperatureWarm:"#c60000",wind:"#21292b"}},classNames:{pin:UE,secondaryPin:$E},units:{distance:_.distance,wind:_.wind,temperature:_.temperature},assets:{weatherSymbolsPath:"../assets/images/map/weather-symbols",pin:{iconUrl:"../assets/images/map/marker-primary.png",shadowUrl:"../assets/images/map/marker-primary-shadow.png"},secondaryPin:{iconUrl:"../assets/images/map/marker-secondary.png"}}});J.addStyle(B),J.addStyle(l),J.addStyle(D);const K=new OE({localeCode:n});return J.addEventListener(Z=>{Z.type==="map:webgl-context-lost"&&(a.innerHTML=""),Z.type==="map:scale"&&K.setScale({...Z,translate:c}),$n(Z)}),J.maplibregl.on("load",()=>{J.maplibregl.resize()}),{map:J,styles:{heatmap:l,defaultWithName:D,default:B}}}const VE={"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/imperial":"mi","units/distance/metric":"km","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"},GE={"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/imperial":"mi","units/distance/metric":"km","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"},ZE={"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/imperial":"mi","units/distance/metric":"km","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"};function HE({map:a,apiData:n,style:c}){const f=new fE({id:"lightning",map:a,apiData:n});return f.addEventListener(_=>{$n(_)}),a.addLayer({layer:f,renderBeforeId:c.renderBeforeId,zoomLevels:{initial:5,min:3,max:12},pin:"static-primary",styleId:c.id}),f}const jE="temperature",qE=["temperature-layer:heatmap-frame-begin","temperature-layer:heatmap-frame-end","temperature-layer:particle-frame-begin","temperature-layer:particle-frame-end"];function WE({map:a,apiData:n,style:c}){const f=new wE({id:jE,map:a,apiData:n});return f.addEventListener(_=>{if(!qE.includes(_.type)){if(_.type==="temperature-layer:click"){const w={lat:+_.position.lat.toFixed(3),lon:+_.position.lon.toFixed(3)};$n({type:"temperature-layer:click",position:w,temperature:_.temperature});return}$n(_)}}),a.addLayer({layer:f,zoomLevels:{initial:5,min:3,max:12},pin:"dynamic-secondary-with-static-primary",styleId:c.id,renderBeforeId:c.renderBeforeId}),f}const sd=document.querySelector("#app");if(sd==null)throw new Error("#app not found");const{locationId:wg,localeCode:Jc,visibleMapType:vc,units:Sg,backgroundColor:nf,mode:XE}=k_();nf!=null&&(sd.style.backgroundColor=`#${nf}`);Vu("nb",GE);Vu("nn",ZE);Vu("en",VE);const Tg=i0(Jc),YE=await y_(),KE=await x_(),JE=await __(),QE=JSON.parse(JE.historicalData),eA=AE({observations:YE,forecast:KE}),tA=await v_(),iA=await b_(),rA=await w_({localeCode:Jc,locationId:wg}),{map:ji,styles:pl}=NE({element:sd,localeCode:Jc,translate:Tg,position:rA.position,units:Sg,mode:XE}),Cg=HE({map:ji,apiData:QE,style:pl.defaultWithName}),Ic=ME({map:ji,radarData:eA,style:pl.defaultWithName}),Ec=FE({map:ji,apiData:tA,style:pl.heatmap}),Ig=LE({map:ji,style:pl.default,localeCode:Jc,translate:Tg,locationId:wg,units:Sg}),Ac=WE({map:ji,apiData:iA,style:pl.heatmap});vc==="wind"?ji.showLayer(Ec.id):vc==="temperature"?ji.showLayer(Ac.id):vc==="radar"?ji.showLayer(Ic.id):vc==="lightning"?ji.showLayer(Cg.id):ji.showLayer(Ig.id);window.sendWebViewEvent=function(a){if(ji==null)throw new Error("Map does not exist");switch(a.type){case"map:set-map-type":{ji.showLayer(a.mapType);break}case"map:set-units":{ji.setUnits(a.units);break}case"map:zoom-in":{ji.zoomIn();break}case"map:zoom-out":{ji.zoomOut();break}case"map:hide-secondary-pin":{ji.hideSecondaryPin();break}case"radar-layer:play":{Ic.play();break}case"radar-layer:pause":{Ic.pause();break}case"radar-layer:set-current-frame":{Ic.setSourceIndex(a.frameIndex);break}case"weather-layer:set-active-interval-index":{Ig.setActiveIntervalIndex(a.index);break}case"wind-layer:play":{Ec.play();break}case"wind-layer:pause":{Ec.pause();break}case"wind-layer:set-current-frame":{Ec.setSourceIndex(a.frameIndex);break}case"temperature-layer:play":{Ac.play();break}case"temperature-layer:pause":{Ac.pause();break}case"temperature-layer:set-current-frame":{Ac.setSourceIndex(a.frameIndex);break}case"lightning-layer:set-active-hour-index":Cg.setActiveHourIndex(a.index)}};
