From 79898aa3d35ea21019b2e60a0f4f5bd7d8fa48f4 Mon Sep 17 00:00:00 2001 From: Emilio Mariscal Date: Sun, 12 Jan 2025 17:09:25 -0300 Subject: [PATCH] Updates --- CNAME | 1 - assets/index-4DaTWCpy.js | 868 ---------------------------------- assets/index-4DaTWCpy.js.map | 1 - assets/index-JmX5rURu.js | 878 +++++++++++++++++++++++++++++++++++ assets/index-JmX5rURu.js.map | 1 + index.html | 2 +- 6 files changed, 880 insertions(+), 871 deletions(-) delete mode 100644 CNAME delete mode 100644 assets/index-4DaTWCpy.js delete mode 100644 assets/index-4DaTWCpy.js.map create mode 100644 assets/index-JmX5rURu.js create mode 100644 assets/index-JmX5rURu.js.map diff --git a/CNAME b/CNAME deleted file mode 100644 index 49165e4..0000000 --- a/CNAME +++ /dev/null @@ -1 +0,0 @@ -chatmap.hotosm.org \ No newline at end of file diff --git a/assets/index-4DaTWCpy.js b/assets/index-4DaTWCpy.js deleted file mode 100644 index 6c26c7d..0000000 --- a/assets/index-4DaTWCpy.js +++ /dev/null @@ -1,868 +0,0 @@ -(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const d of document.querySelectorAll('link[rel="modulepreload"]'))u(d);new MutationObserver(d=>{for(const g of d)if(g.type==="childList")for(const y of g.addedNodes)y.tagName==="LINK"&&y.rel==="modulepreload"&&u(y)}).observe(document,{childList:!0,subtree:!0});function i(d){const g={};return d.integrity&&(g.integrity=d.integrity),d.referrerPolicy&&(g.referrerPolicy=d.referrerPolicy),d.crossOrigin==="use-credentials"?g.credentials="include":d.crossOrigin==="anonymous"?g.credentials="omit":g.credentials="same-origin",g}function u(d){if(d.ep)return;d.ep=!0;const g=i(d);fetch(d.href,g)}})();var cd=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ip(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function oA(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var i=function u(){return this instanceof u?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};i.prototype=t.prototype}else i={};return Object.defineProperty(i,"__esModule",{value:!0}),Object.keys(e).forEach(function(u){var d=Object.getOwnPropertyDescriptor(e,u);Object.defineProperty(i,u,d.get?d:{enumerable:!0,get:function(){return e[u]}})}),i}var MS={exports:{}},ug={},zS={exports:{}},dr={};/** - * @license React - * react.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var op=Symbol.for("react.element"),sA=Symbol.for("react.portal"),aA=Symbol.for("react.fragment"),lA=Symbol.for("react.strict_mode"),uA=Symbol.for("react.profiler"),cA=Symbol.for("react.provider"),hA=Symbol.for("react.context"),dA=Symbol.for("react.forward_ref"),pA=Symbol.for("react.suspense"),fA=Symbol.for("react.memo"),mA=Symbol.for("react.lazy"),Nw=Symbol.iterator;function gA(e){return e===null||typeof e!="object"?null:(e=Nw&&e[Nw]||e["@@iterator"],typeof e=="function"?e:null)}var DS={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},RS=Object.assign,LS={};function $c(e,t,i){this.props=e,this.context=t,this.refs=LS,this.updater=i||DS}$c.prototype.isReactComponent={};$c.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};$c.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function FS(){}FS.prototype=$c.prototype;function Av(e,t,i){this.props=e,this.context=t,this.refs=LS,this.updater=i||DS}var Mv=Av.prototype=new FS;Mv.constructor=Av;RS(Mv,$c.prototype);Mv.isPureReactComponent=!0;var $w=Array.isArray,OS=Object.prototype.hasOwnProperty,zv={current:null},BS={key:!0,ref:!0,__self:!0,__source:!0};function NS(e,t,i){var u,d={},g=null,y=null;if(t!=null)for(u in t.ref!==void 0&&(y=t.ref),t.key!==void 0&&(g=""+t.key),t)OS.call(t,u)&&!BS.hasOwnProperty(u)&&(d[u]=t[u]);var c=arguments.length-2;if(c===1)d.children=i;else if(1>>1,Te=Be[xe];if(0>>1;xed(rt,Ye))qtd(Kt,rt)?(Be[xe]=Kt,Be[qt]=Ye,xe=qt):(Be[xe]=rt,Be[nt]=Ye,xe=nt);else if(qtd(Kt,Ye))Be[xe]=Kt,Be[qt]=Ye,xe=qt;else break e}}return Le}function d(Be,Le){var Ye=Be.sortIndex-Le.sortIndex;return Ye!==0?Ye:Be.id-Le.id}if(typeof performance=="object"&&typeof performance.now=="function"){var g=performance;e.unstable_now=function(){return g.now()}}else{var y=Date,c=y.now();e.unstable_now=function(){return y.now()-c}}var T=[],P=[],R=1,D=null,A=3,N=!1,X=!1,U=!1,te=typeof setTimeout=="function"?setTimeout:null,F=typeof clearTimeout=="function"?clearTimeout:null,$=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function q(Be){for(var Le=i(P);Le!==null;){if(Le.callback===null)u(P);else if(Le.startTime<=Be)u(P),Le.sortIndex=Le.expirationTime,t(T,Le);else break;Le=i(P)}}function ne(Be){if(U=!1,q(Be),!X)if(i(T)!==null)X=!0,_t(se);else{var Le=i(P);Le!==null&&ye(ne,Le.startTime-Be)}}function se(Be,Le){X=!1,U&&(U=!1,F(Oe),Oe=-1),N=!0;var Ye=A;try{for(q(Le),D=i(T);D!==null&&(!(D.expirationTime>Le)||Be&&!it());){var xe=D.callback;if(typeof xe=="function"){D.callback=null,A=D.priorityLevel;var Te=xe(D.expirationTime<=Le);Le=e.unstable_now(),typeof Te=="function"?D.callback=Te:D===i(T)&&u(T),q(Le)}else u(T);D=i(T)}if(D!==null)var ft=!0;else{var nt=i(P);nt!==null&&ye(ne,nt.startTime-Le),ft=!1}return ft}finally{D=null,A=Ye,N=!1}}var Ee=!1,ge=null,Oe=-1,Fe=5,Ge=-1;function it(){return!(e.unstable_now()-GeBe||125xe?(Be.sortIndex=Ye,t(P,Be),i(T)===null&&Be===i(P)&&(U?(F(Oe),Oe=-1):U=!0,ye(ne,Ye-xe))):(Be.sortIndex=Te,t(T,Be),X||N||(X=!0,_t(se))),Be},e.unstable_shouldYield=it,e.unstable_wrapCallback=function(Be){var Le=A;return function(){var Ye=A;A=Le;try{return Be.apply(this,arguments)}finally{A=Ye}}}})(HS);VS.exports=HS;var CA=VS.exports;/** - * @license React - * react-dom.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var IA=jt,wo=CA;function lt(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,i=1;i"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),i0=Object.prototype.hasOwnProperty,PA=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Uw={},Vw={};function AA(e){return i0.call(Vw,e)?!0:i0.call(Uw,e)?!1:PA.test(e)?Vw[e]=!0:(Uw[e]=!0,!1)}function MA(e,t,i,u){if(i!==null&&i.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return u?!1:i!==null?!i.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function zA(e,t,i,u){if(t===null||typeof t>"u"||MA(e,t,i,u))return!0;if(u)return!1;if(i!==null)switch(i.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Ai(e,t,i,u,d,g,y){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=u,this.attributeNamespace=d,this.mustUseProperty=i,this.propertyName=e,this.type=t,this.sanitizeURL=g,this.removeEmptyString=y}var Kn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Kn[e]=new Ai(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Kn[t]=new Ai(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Kn[e]=new Ai(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Kn[e]=new Ai(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){Kn[e]=new Ai(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Kn[e]=new Ai(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Kn[e]=new Ai(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Kn[e]=new Ai(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Kn[e]=new Ai(e,5,!1,e.toLowerCase(),null,!1,!1)});var Rv=/[\-:]([a-z])/g;function Lv(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Rv,Lv);Kn[t]=new Ai(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Rv,Lv);Kn[t]=new Ai(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Rv,Lv);Kn[t]=new Ai(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Kn[e]=new Ai(e,1,!1,e.toLowerCase(),null,!1,!1)});Kn.xlinkHref=new Ai("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Kn[e]=new Ai(e,1,!1,e.toLowerCase(),null,!0,!0)});function Fv(e,t,i,u){var d=Kn.hasOwnProperty(t)?Kn[t]:null;(d!==null?d.type!==0:u||!(2c||d[y]!==g[c]){var T=` -`+d[y].replace(" at new "," at ");return e.displayName&&T.includes("")&&(T=T.replace("",e.displayName)),T}while(1<=y&&0<=c);break}}}finally{p_=!1,Error.prepareStackTrace=i}return(e=e?e.displayName||e.name:"")?hd(e):""}function DA(e){switch(e.tag){case 5:return hd(e.type);case 16:return hd("Lazy");case 13:return hd("Suspense");case 19:return hd("SuspenseList");case 0:case 2:case 15:return e=f_(e.type,!1),e;case 11:return e=f_(e.type.render,!1),e;case 1:return e=f_(e.type,!0),e;default:return""}}function l0(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case oc:return"Fragment";case ic:return"Portal";case o0:return"Profiler";case Ov:return"StrictMode";case s0:return"Suspense";case a0:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case WS:return(e.displayName||"Context")+".Consumer";case ZS:return(e._context.displayName||"Context")+".Provider";case Bv:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Nv:return t=e.displayName||null,t!==null?t:l0(e.type)||"Memo";case Oa:t=e._payload,e=e._init;try{return l0(e(t))}catch{}}return null}function RA(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return l0(t);case 8:return t===Ov?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function el(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function XS(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function LA(e){var t=XS(e)?"checked":"value",i=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),u=""+e[t];if(!e.hasOwnProperty(t)&&typeof i<"u"&&typeof i.get=="function"&&typeof i.set=="function"){var d=i.get,g=i.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return d.call(this)},set:function(y){u=""+y,g.call(this,y)}}),Object.defineProperty(e,t,{enumerable:i.enumerable}),{getValue:function(){return u},setValue:function(y){u=""+y},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Sf(e){e._valueTracker||(e._valueTracker=LA(e))}function KS(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var i=t.getValue(),u="";return e&&(u=XS(e)?e.checked?"true":"false":e.value),e=u,e!==i?(t.setValue(e),!0):!1}function bm(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function u0(e,t){var i=t.checked;return hn({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:i??e._wrapperState.initialChecked})}function Gw(e,t){var i=t.defaultValue==null?"":t.defaultValue,u=t.checked!=null?t.checked:t.defaultChecked;i=el(t.value!=null?t.value:i),e._wrapperState={initialChecked:u,initialValue:i,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function YS(e,t){t=t.checked,t!=null&&Fv(e,"checked",t,!1)}function c0(e,t){YS(e,t);var i=el(t.value),u=t.type;if(i!=null)u==="number"?(i===0&&e.value===""||e.value!=i)&&(e.value=""+i):e.value!==""+i&&(e.value=""+i);else if(u==="submit"||u==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?h0(e,t.type,i):t.hasOwnProperty("defaultValue")&&h0(e,t.type,el(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Zw(e,t,i){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var u=t.type;if(!(u!=="submit"&&u!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,i||t===e.value||(e.value=t),e.defaultValue=t}i=e.name,i!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,i!==""&&(e.name=i)}function h0(e,t,i){(t!=="number"||bm(e.ownerDocument)!==e)&&(i==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+i&&(e.defaultValue=""+i))}var dd=Array.isArray;function _c(e,t,i,u){if(e=e.options,t){t={};for(var d=0;d"+t.valueOf().toString()+"",t=Ef.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Ld(e,t){if(t){var i=e.firstChild;if(i&&i===e.lastChild&&i.nodeType===3){i.nodeValue=t;return}}e.textContent=t}var xd={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},FA=["Webkit","ms","Moz","O"];Object.keys(xd).forEach(function(e){FA.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),xd[t]=xd[e]})});function tE(e,t,i){return t==null||typeof t=="boolean"||t===""?"":i||typeof t!="number"||t===0||xd.hasOwnProperty(e)&&xd[e]?(""+t).trim():t+"px"}function rE(e,t){e=e.style;for(var i in t)if(t.hasOwnProperty(i)){var u=i.indexOf("--")===0,d=tE(i,t[i],u);i==="float"&&(i="cssFloat"),u?e.setProperty(i,d):e[i]=d}}var OA=hn({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function f0(e,t){if(t){if(OA[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(lt(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(lt(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(lt(61))}if(t.style!=null&&typeof t.style!="object")throw Error(lt(62))}}function m0(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var g0=null;function $v(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var y0=null,vc=null,xc=null;function Xw(e){if(e=lp(e)){if(typeof y0!="function")throw Error(lt(280));var t=e.stateNode;t&&(t=fg(t),y0(e.stateNode,e.type,t))}}function nE(e){vc?xc?xc.push(e):xc=[e]:vc=e}function iE(){if(vc){var e=vc,t=xc;if(xc=vc=null,Xw(e),t)for(e=0;e>>=0,e===0?32:31-(qA(e)/XA|0)|0}var kf=64,Tf=4194304;function pd(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Tm(e,t){var i=e.pendingLanes;if(i===0)return 0;var u=0,d=e.suspendedLanes,g=e.pingedLanes,y=i&268435455;if(y!==0){var c=y&~d;c!==0?u=pd(c):(g&=y,g!==0&&(u=pd(g)))}else y=i&~d,y!==0?u=pd(y):g!==0&&(u=pd(g));if(u===0)return 0;if(t!==0&&t!==u&&!(t&d)&&(d=u&-u,g=t&-t,d>=g||d===16&&(g&4194240)!==0))return t;if(u&4&&(u|=i&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=u;0i;i++)t.push(e);return t}function sp(e,t,i){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Yo(t),e[t]=i}function QA(e,t){var i=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var u=e.eventTimes;for(e=e.expirationTimes;0=bd),ib=" ",ob=!1;function EE(e,t){switch(e){case"keyup":return CM.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function kE(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var sc=!1;function PM(e,t){switch(e){case"compositionend":return kE(t);case"keypress":return t.which!==32?null:(ob=!0,ib);case"textInput":return e=t.data,e===ib&&ob?null:e;default:return null}}function AM(e,t){if(sc)return e==="compositionend"||!qv&&EE(e,t)?(e=bE(),Yf=Gv=ja=null,sc=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:i,offset:t-e};e=u}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=ub(i)}}function PE(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?PE(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function AE(){for(var e=window,t=bm();t instanceof e.HTMLIFrameElement;){try{var i=typeof t.contentWindow.location.href=="string"}catch{i=!1}if(i)e=t.contentWindow;else break;t=bm(e.document)}return t}function Xv(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function NM(e){var t=AE(),i=e.focusedElem,u=e.selectionRange;if(t!==i&&i&&i.ownerDocument&&PE(i.ownerDocument.documentElement,i)){if(u!==null&&Xv(i)){if(t=u.start,e=u.end,e===void 0&&(e=t),"selectionStart"in i)i.selectionStart=t,i.selectionEnd=Math.min(e,i.value.length);else if(e=(t=i.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var d=i.textContent.length,g=Math.min(u.start,d);u=u.end===void 0?g:Math.min(u.end,d),!e.extend&&g>u&&(d=u,u=g,g=d),d=cb(i,g);var y=cb(i,u);d&&y&&(e.rangeCount!==1||e.anchorNode!==d.node||e.anchorOffset!==d.offset||e.focusNode!==y.node||e.focusOffset!==y.offset)&&(t=t.createRange(),t.setStart(d.node,d.offset),e.removeAllRanges(),g>u?(e.addRange(t),e.extend(y.node,y.offset)):(t.setEnd(y.node,y.offset),e.addRange(t)))}}for(t=[],e=i;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof i.focus=="function"&&i.focus(),i=0;i=document.documentMode,ac=null,S0=null,Ed=null,E0=!1;function hb(e,t,i){var u=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;E0||ac==null||ac!==bm(u)||(u=ac,"selectionStart"in u&&Xv(u)?u={start:u.selectionStart,end:u.selectionEnd}:(u=(u.ownerDocument&&u.ownerDocument.defaultView||window).getSelection(),u={anchorNode:u.anchorNode,anchorOffset:u.anchorOffset,focusNode:u.focusNode,focusOffset:u.focusOffset}),Ed&&jd(Ed,u)||(Ed=u,u=Pm(S0,"onSelect"),0cc||(e.current=A0[cc],A0[cc]=null,cc--)}function Hr(e,t){cc++,A0[cc]=e.current,e.current=t}var tl={},pi=nl(tl),Wi=nl(!1),Yl=tl;function Tc(e,t){var i=e.type.contextTypes;if(!i)return tl;var u=e.stateNode;if(u&&u.__reactInternalMemoizedUnmaskedChildContext===t)return u.__reactInternalMemoizedMaskedChildContext;var d={},g;for(g in i)d[g]=t[g];return u&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=d),d}function qi(e){return e=e.childContextTypes,e!=null}function Mm(){Qr(Wi),Qr(pi)}function _b(e,t,i){if(pi.current!==tl)throw Error(lt(168));Hr(pi,t),Hr(Wi,i)}function NE(e,t,i){var u=e.stateNode;if(t=t.childContextTypes,typeof u.getChildContext!="function")return i;u=u.getChildContext();for(var d in u)if(!(d in t))throw Error(lt(108,RA(e)||"Unknown",d));return hn({},i,u)}function zm(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||tl,Yl=pi.current,Hr(pi,e),Hr(Wi,Wi.current),!0}function vb(e,t,i){var u=e.stateNode;if(!u)throw Error(lt(169));i?(e=NE(e,t,Yl),u.__reactInternalMemoizedMergedChildContext=e,Qr(Wi),Qr(pi),Hr(pi,e)):Qr(Wi),Hr(Wi,i)}var Us=null,mg=!1,I_=!1;function $E(e){Us===null?Us=[e]:Us.push(e)}function YM(e){mg=!0,$E(e)}function il(){if(!I_&&Us!==null){I_=!0;var e=0,t=zr;try{var i=Us;for(zr=1;e>=y,d-=y,Vs=1<<32-Yo(t)+d|i<Oe?(Fe=ge,ge=null):Fe=ge.sibling;var Ge=A(F,ge,q[Oe],ne);if(Ge===null){ge===null&&(ge=Fe);break}e&&ge&&Ge.alternate===null&&t(F,ge),$=g(Ge,$,Oe),Ee===null?se=Ge:Ee.sibling=Ge,Ee=Ge,ge=Fe}if(Oe===q.length)return i(F,ge),nn&&Dl(F,Oe),se;if(ge===null){for(;OeOe?(Fe=ge,ge=null):Fe=ge.sibling;var it=A(F,ge,Ge.value,ne);if(it===null){ge===null&&(ge=Fe);break}e&&ge&&it.alternate===null&&t(F,ge),$=g(it,$,Oe),Ee===null?se=it:Ee.sibling=it,Ee=it,ge=Fe}if(Ge.done)return i(F,ge),nn&&Dl(F,Oe),se;if(ge===null){for(;!Ge.done;Oe++,Ge=q.next())Ge=D(F,Ge.value,ne),Ge!==null&&($=g(Ge,$,Oe),Ee===null?se=Ge:Ee.sibling=Ge,Ee=Ge);return nn&&Dl(F,Oe),se}for(ge=u(F,ge);!Ge.done;Oe++,Ge=q.next())Ge=N(ge,F,Oe,Ge.value,ne),Ge!==null&&(e&&Ge.alternate!==null&&ge.delete(Ge.key===null?Oe:Ge.key),$=g(Ge,$,Oe),Ee===null?se=Ge:Ee.sibling=Ge,Ee=Ge);return e&&ge.forEach(function(ve){return t(F,ve)}),nn&&Dl(F,Oe),se}function te(F,$,q,ne){if(typeof q=="object"&&q!==null&&q.type===oc&&q.key===null&&(q=q.props.children),typeof q=="object"&&q!==null){switch(q.$$typeof){case bf:e:{for(var se=q.key,Ee=$;Ee!==null;){if(Ee.key===se){if(se=q.type,se===oc){if(Ee.tag===7){i(F,Ee.sibling),$=d(Ee,q.props.children),$.return=F,F=$;break e}}else if(Ee.elementType===se||typeof se=="object"&&se!==null&&se.$$typeof===Oa&&bb(se)===Ee.type){i(F,Ee.sibling),$=d(Ee,q.props),$.ref=ad(F,Ee,q),$.return=F,F=$;break e}i(F,Ee);break}else t(F,Ee);Ee=Ee.sibling}q.type===oc?($=Zl(q.props.children,F.mode,ne,q.key),$.return=F,F=$):(ne=om(q.type,q.key,q.props,null,F.mode,ne),ne.ref=ad(F,$,q),ne.return=F,F=ne)}return y(F);case ic:e:{for(Ee=q.key;$!==null;){if($.key===Ee)if($.tag===4&&$.stateNode.containerInfo===q.containerInfo&&$.stateNode.implementation===q.implementation){i(F,$.sibling),$=d($,q.children||[]),$.return=F,F=$;break e}else{i(F,$);break}else t(F,$);$=$.sibling}$=F_(q,F.mode,ne),$.return=F,F=$}return y(F);case Oa:return Ee=q._init,te(F,$,Ee(q._payload),ne)}if(dd(q))return X(F,$,q,ne);if(rd(q))return U(F,$,q,ne);Df(F,q)}return typeof q=="string"&&q!==""||typeof q=="number"?(q=""+q,$!==null&&$.tag===6?(i(F,$.sibling),$=d($,q),$.return=F,F=$):(i(F,$),$=L_(q,F.mode,ne),$.return=F,F=$),y(F)):i(F,$)}return te}var Ic=HE(!0),GE=HE(!1),Lm=nl(null),Fm=null,pc=null,Qv=null;function e1(){Qv=pc=Fm=null}function t1(e){var t=Lm.current;Qr(Lm),e._currentValue=t}function D0(e,t,i){for(;e!==null;){var u=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,u!==null&&(u.childLanes|=t)):u!==null&&(u.childLanes&t)!==t&&(u.childLanes|=t),e===i)break;e=e.return}}function bc(e,t){Fm=e,Qv=pc=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Gi=!0),e.firstContext=null)}function Fo(e){var t=e._currentValue;if(Qv!==e)if(e={context:e,memoizedValue:t,next:null},pc===null){if(Fm===null)throw Error(lt(308));pc=e,Fm.dependencies={lanes:0,firstContext:e}}else pc=pc.next=e;return t}var $l=null;function r1(e){$l===null?$l=[e]:$l.push(e)}function ZE(e,t,i,u){var d=t.interleaved;return d===null?(i.next=i,r1(t)):(i.next=d.next,d.next=i),t.interleaved=i,qs(e,u)}function qs(e,t){e.lanes|=t;var i=e.alternate;for(i!==null&&(i.lanes|=t),i=e,e=e.return;e!==null;)e.childLanes|=t,i=e.alternate,i!==null&&(i.childLanes|=t),i=e,e=e.return;return i.tag===3?i.stateNode:null}var Ba=!1;function n1(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function WE(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Gs(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Ka(e,t,i){var u=e.updateQueue;if(u===null)return null;if(u=u.shared,br&2){var d=u.pending;return d===null?t.next=t:(t.next=d.next,d.next=t),u.pending=t,qs(e,i)}return d=u.interleaved,d===null?(t.next=t,r1(u)):(t.next=d.next,d.next=t),u.interleaved=t,qs(e,i)}function Qf(e,t,i){if(t=t.updateQueue,t!==null&&(t=t.shared,(i&4194240)!==0)){var u=t.lanes;u&=e.pendingLanes,i|=u,t.lanes=i,Uv(e,i)}}function Sb(e,t){var i=e.updateQueue,u=e.alternate;if(u!==null&&(u=u.updateQueue,i===u)){var d=null,g=null;if(i=i.firstBaseUpdate,i!==null){do{var y={eventTime:i.eventTime,lane:i.lane,tag:i.tag,payload:i.payload,callback:i.callback,next:null};g===null?d=g=y:g=g.next=y,i=i.next}while(i!==null);g===null?d=g=t:g=g.next=t}else d=g=t;i={baseState:u.baseState,firstBaseUpdate:d,lastBaseUpdate:g,shared:u.shared,effects:u.effects},e.updateQueue=i;return}e=i.lastBaseUpdate,e===null?i.firstBaseUpdate=t:e.next=t,i.lastBaseUpdate=t}function Om(e,t,i,u){var d=e.updateQueue;Ba=!1;var g=d.firstBaseUpdate,y=d.lastBaseUpdate,c=d.shared.pending;if(c!==null){d.shared.pending=null;var T=c,P=T.next;T.next=null,y===null?g=P:y.next=P,y=T;var R=e.alternate;R!==null&&(R=R.updateQueue,c=R.lastBaseUpdate,c!==y&&(c===null?R.firstBaseUpdate=P:c.next=P,R.lastBaseUpdate=T))}if(g!==null){var D=d.baseState;y=0,R=P=T=null,c=g;do{var A=c.lane,N=c.eventTime;if((u&A)===A){R!==null&&(R=R.next={eventTime:N,lane:0,tag:c.tag,payload:c.payload,callback:c.callback,next:null});e:{var X=e,U=c;switch(A=t,N=i,U.tag){case 1:if(X=U.payload,typeof X=="function"){D=X.call(N,D,A);break e}D=X;break e;case 3:X.flags=X.flags&-65537|128;case 0:if(X=U.payload,A=typeof X=="function"?X.call(N,D,A):X,A==null)break e;D=hn({},D,A);break e;case 2:Ba=!0}}c.callback!==null&&c.lane!==0&&(e.flags|=64,A=d.effects,A===null?d.effects=[c]:A.push(c))}else N={eventTime:N,lane:A,tag:c.tag,payload:c.payload,callback:c.callback,next:null},R===null?(P=R=N,T=D):R=R.next=N,y|=A;if(c=c.next,c===null){if(c=d.shared.pending,c===null)break;A=c,c=A.next,A.next=null,d.lastBaseUpdate=A,d.shared.pending=null}}while(!0);if(R===null&&(T=D),d.baseState=T,d.firstBaseUpdate=P,d.lastBaseUpdate=R,t=d.shared.interleaved,t!==null){d=t;do y|=d.lane,d=d.next;while(d!==t)}else g===null&&(d.shared.lanes=0);eu|=y,e.lanes=y,e.memoizedState=D}}function Eb(e,t,i){if(e=t.effects,t.effects=null,e!==null)for(t=0;ti?i:4,e(!0);var u=A_.transition;A_.transition={};try{e(!1),t()}finally{zr=i,A_.transition=u}}function ck(){return Oo().memoizedState}function t3(e,t,i){var u=Ja(e);if(i={lane:u,action:i,hasEagerState:!1,eagerState:null,next:null},hk(e))dk(t,i);else if(i=ZE(e,t,i,u),i!==null){var d=Ii();Jo(i,e,u,d),pk(i,t,u)}}function r3(e,t,i){var u=Ja(e),d={lane:u,action:i,hasEagerState:!1,eagerState:null,next:null};if(hk(e))dk(t,d);else{var g=e.alternate;if(e.lanes===0&&(g===null||g.lanes===0)&&(g=t.lastRenderedReducer,g!==null))try{var y=t.lastRenderedState,c=g(y,i);if(d.hasEagerState=!0,d.eagerState=c,ts(c,y)){var T=t.interleaved;T===null?(d.next=d,r1(t)):(d.next=T.next,T.next=d),t.interleaved=d;return}}catch{}finally{}i=ZE(e,t,d,u),i!==null&&(d=Ii(),Jo(i,e,u,d),pk(i,t,u))}}function hk(e){var t=e.alternate;return e===cn||t!==null&&t===cn}function dk(e,t){kd=Nm=!0;var i=e.pending;i===null?t.next=t:(t.next=i.next,i.next=t),e.pending=t}function pk(e,t,i){if(i&4194240){var u=t.lanes;u&=e.pendingLanes,i|=u,t.lanes=i,Uv(e,i)}}var $m={readContext:Fo,useCallback:ui,useContext:ui,useEffect:ui,useImperativeHandle:ui,useInsertionEffect:ui,useLayoutEffect:ui,useMemo:ui,useReducer:ui,useRef:ui,useState:ui,useDebugValue:ui,useDeferredValue:ui,useTransition:ui,useMutableSource:ui,useSyncExternalStore:ui,useId:ui,unstable_isNewReconciler:!1},n3={readContext:Fo,useCallback:function(e,t){return gs().memoizedState=[e,t===void 0?null:t],e},useContext:Fo,useEffect:Tb,useImperativeHandle:function(e,t,i){return i=i!=null?i.concat([e]):null,tm(4194308,4,ok.bind(null,t,e),i)},useLayoutEffect:function(e,t){return tm(4194308,4,e,t)},useInsertionEffect:function(e,t){return tm(4,2,e,t)},useMemo:function(e,t){var i=gs();return t=t===void 0?null:t,e=e(),i.memoizedState=[e,t],e},useReducer:function(e,t,i){var u=gs();return t=i!==void 0?i(t):t,u.memoizedState=u.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},u.queue=e,e=e.dispatch=t3.bind(null,cn,e),[u.memoizedState,e]},useRef:function(e){var t=gs();return e={current:e},t.memoizedState=e},useState:kb,useDebugValue:h1,useDeferredValue:function(e){return gs().memoizedState=e},useTransition:function(){var e=kb(!1),t=e[0];return e=e3.bind(null,e[1]),gs().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,i){var u=cn,d=gs();if(nn){if(i===void 0)throw Error(lt(407));i=i()}else{if(i=t(),$n===null)throw Error(lt(349));Ql&30||YE(u,t,i)}d.memoizedState=i;var g={value:i,getSnapshot:t};return d.queue=g,Tb(QE.bind(null,u,g,e),[e]),u.flags|=2048,Xd(9,JE.bind(null,u,g,i,t),void 0,null),i},useId:function(){var e=gs(),t=$n.identifierPrefix;if(nn){var i=Hs,u=Vs;i=(u&~(1<<32-Yo(u)-1)).toString(32)+i,t=":"+t+"R"+i,i=Wd++,0<\/script>",e=e.removeChild(e.firstChild)):typeof u.is=="string"?e=y.createElement(i,{is:u.is}):(e=y.createElement(i),i==="select"&&(y=e,u.multiple?y.multiple=!0:u.size&&(y.size=u.size))):e=y.createElementNS(e,i),e[_s]=t,e[Hd]=u,Sk(e,t,!1,!1),t.stateNode=e;e:{switch(y=m0(i,u),i){case"dialog":qr("cancel",e),qr("close",e),d=u;break;case"iframe":case"object":case"embed":qr("load",e),d=u;break;case"video":case"audio":for(d=0;dMc&&(t.flags|=128,u=!0,ld(g,!1),t.lanes=4194304)}else{if(!u)if(e=Bm(y),e!==null){if(t.flags|=128,u=!0,i=e.updateQueue,i!==null&&(t.updateQueue=i,t.flags|=4),ld(g,!0),g.tail===null&&g.tailMode==="hidden"&&!y.alternate&&!nn)return ci(t),null}else 2*yn()-g.renderingStartTime>Mc&&i!==1073741824&&(t.flags|=128,u=!0,ld(g,!1),t.lanes=4194304);g.isBackwards?(y.sibling=t.child,t.child=y):(i=g.last,i!==null?i.sibling=y:t.child=y,g.last=y)}return g.tail!==null?(t=g.tail,g.rendering=t,g.tail=t.sibling,g.renderingStartTime=yn(),t.sibling=null,i=un.current,Hr(un,u?i&1|2:i&1),t):(ci(t),null);case 22:case 23:return y1(),u=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==u&&(t.flags|=8192),u&&t.mode&1?fo&1073741824&&(ci(t),t.subtreeFlags&6&&(t.flags|=8192)):ci(t),null;case 24:return null;case 25:return null}throw Error(lt(156,t.tag))}function h3(e,t){switch(Yv(t),t.tag){case 1:return qi(t.type)&&Mm(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Pc(),Qr(Wi),Qr(pi),s1(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return o1(t),null;case 13:if(Qr(un),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(lt(340));Cc()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Qr(un),null;case 4:return Pc(),null;case 10:return t1(t.type._context),null;case 22:case 23:return y1(),null;case 24:return null;default:return null}}var Lf=!1,di=!1,d3=typeof WeakSet=="function"?WeakSet:Set,zt=null;function fc(e,t){var i=e.ref;if(i!==null)if(typeof i=="function")try{i(null)}catch(u){mn(e,t,u)}else i.current=null}function U0(e,t,i){try{i()}catch(u){mn(e,t,u)}}var Ob=!1;function p3(e,t){if(k0=Cm,e=AE(),Xv(e)){if("selectionStart"in e)var i={start:e.selectionStart,end:e.selectionEnd};else e:{i=(i=e.ownerDocument)&&i.defaultView||window;var u=i.getSelection&&i.getSelection();if(u&&u.rangeCount!==0){i=u.anchorNode;var d=u.anchorOffset,g=u.focusNode;u=u.focusOffset;try{i.nodeType,g.nodeType}catch{i=null;break e}var y=0,c=-1,T=-1,P=0,R=0,D=e,A=null;t:for(;;){for(var N;D!==i||d!==0&&D.nodeType!==3||(c=y+d),D!==g||u!==0&&D.nodeType!==3||(T=y+u),D.nodeType===3&&(y+=D.nodeValue.length),(N=D.firstChild)!==null;)A=D,D=N;for(;;){if(D===e)break t;if(A===i&&++P===d&&(c=y),A===g&&++R===u&&(T=y),(N=D.nextSibling)!==null)break;D=A,A=D.parentNode}D=N}i=c===-1||T===-1?null:{start:c,end:T}}else i=null}i=i||{start:0,end:0}}else i=null;for(T0={focusedElem:e,selectionRange:i},Cm=!1,zt=t;zt!==null;)if(t=zt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,zt=e;else for(;zt!==null;){t=zt;try{var X=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(X!==null){var U=X.memoizedProps,te=X.memoizedState,F=t.stateNode,$=F.getSnapshotBeforeUpdate(t.elementType===t.type?U:Wo(t.type,U),te);F.__reactInternalSnapshotBeforeUpdate=$}break;case 3:var q=t.stateNode.containerInfo;q.nodeType===1?q.textContent="":q.nodeType===9&&q.documentElement&&q.removeChild(q.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(lt(163))}}catch(ne){mn(t,t.return,ne)}if(e=t.sibling,e!==null){e.return=t.return,zt=e;break}zt=t.return}return X=Ob,Ob=!1,X}function Td(e,t,i){var u=t.updateQueue;if(u=u!==null?u.lastEffect:null,u!==null){var d=u=u.next;do{if((d.tag&e)===e){var g=d.destroy;d.destroy=void 0,g!==void 0&&U0(t,i,g)}d=d.next}while(d!==u)}}function _g(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var i=t=t.next;do{if((i.tag&e)===e){var u=i.create;i.destroy=u()}i=i.next}while(i!==t)}}function V0(e){var t=e.ref;if(t!==null){var i=e.stateNode;switch(e.tag){case 5:e=i;break;default:e=i}typeof t=="function"?t(e):t.current=e}}function Tk(e){var t=e.alternate;t!==null&&(e.alternate=null,Tk(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[_s],delete t[Hd],delete t[P0],delete t[XM],delete t[KM])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Ck(e){return e.tag===5||e.tag===3||e.tag===4}function Bb(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Ck(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function H0(e,t,i){var u=e.tag;if(u===5||u===6)e=e.stateNode,t?i.nodeType===8?i.parentNode.insertBefore(e,t):i.insertBefore(e,t):(i.nodeType===8?(t=i.parentNode,t.insertBefore(e,i)):(t=i,t.appendChild(e)),i=i._reactRootContainer,i!=null||t.onclick!==null||(t.onclick=Am));else if(u!==4&&(e=e.child,e!==null))for(H0(e,t,i),e=e.sibling;e!==null;)H0(e,t,i),e=e.sibling}function G0(e,t,i){var u=e.tag;if(u===5||u===6)e=e.stateNode,t?i.insertBefore(e,t):i.appendChild(e);else if(u!==4&&(e=e.child,e!==null))for(G0(e,t,i),e=e.sibling;e!==null;)G0(e,t,i),e=e.sibling}var Wn=null,Xo=!1;function Da(e,t,i){for(i=i.child;i!==null;)Ik(e,t,i),i=i.sibling}function Ik(e,t,i){if(vs&&typeof vs.onCommitFiberUnmount=="function")try{vs.onCommitFiberUnmount(cg,i)}catch{}switch(i.tag){case 5:di||fc(i,t);case 6:var u=Wn,d=Xo;Wn=null,Da(e,t,i),Wn=u,Xo=d,Wn!==null&&(Xo?(e=Wn,i=i.stateNode,e.nodeType===8?e.parentNode.removeChild(i):e.removeChild(i)):Wn.removeChild(i.stateNode));break;case 18:Wn!==null&&(Xo?(e=Wn,i=i.stateNode,e.nodeType===8?C_(e.parentNode,i):e.nodeType===1&&C_(e,i),Nd(e)):C_(Wn,i.stateNode));break;case 4:u=Wn,d=Xo,Wn=i.stateNode.containerInfo,Xo=!0,Da(e,t,i),Wn=u,Xo=d;break;case 0:case 11:case 14:case 15:if(!di&&(u=i.updateQueue,u!==null&&(u=u.lastEffect,u!==null))){d=u=u.next;do{var g=d,y=g.destroy;g=g.tag,y!==void 0&&(g&2||g&4)&&U0(i,t,y),d=d.next}while(d!==u)}Da(e,t,i);break;case 1:if(!di&&(fc(i,t),u=i.stateNode,typeof u.componentWillUnmount=="function"))try{u.props=i.memoizedProps,u.state=i.memoizedState,u.componentWillUnmount()}catch(c){mn(i,t,c)}Da(e,t,i);break;case 21:Da(e,t,i);break;case 22:i.mode&1?(di=(u=di)||i.memoizedState!==null,Da(e,t,i),di=u):Da(e,t,i);break;default:Da(e,t,i)}}function Nb(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var i=e.stateNode;i===null&&(i=e.stateNode=new d3),t.forEach(function(u){var d=b3.bind(null,e,u);i.has(u)||(i.add(u),u.then(d,d))})}}function Zo(e,t){var i=t.deletions;if(i!==null)for(var u=0;ud&&(d=y),u&=~g}if(u=d,u=yn()-u,u=(120>u?120:480>u?480:1080>u?1080:1920>u?1920:3e3>u?3e3:4320>u?4320:1960*m3(u/1960))-u,10e?16:e,Ua===null)var u=!1;else{if(e=Ua,Ua=null,Vm=0,br&6)throw Error(lt(331));var d=br;for(br|=4,zt=e.current;zt!==null;){var g=zt,y=g.child;if(zt.flags&16){var c=g.deletions;if(c!==null){for(var T=0;Tyn()-m1?Gl(e,0):f1|=i),Xi(e,t)}function Fk(e,t){t===0&&(e.mode&1?(t=Tf,Tf<<=1,!(Tf&130023424)&&(Tf=4194304)):t=1);var i=Ii();e=qs(e,t),e!==null&&(sp(e,t,i),Xi(e,i))}function w3(e){var t=e.memoizedState,i=0;t!==null&&(i=t.retryLane),Fk(e,i)}function b3(e,t){var i=0;switch(e.tag){case 13:var u=e.stateNode,d=e.memoizedState;d!==null&&(i=d.retryLane);break;case 19:u=e.stateNode;break;default:throw Error(lt(314))}u!==null&&u.delete(t),Fk(e,i)}var Ok;Ok=function(e,t,i){if(e!==null)if(e.memoizedProps!==t.pendingProps||Wi.current)Gi=!0;else{if(!(e.lanes&i)&&!(t.flags&128))return Gi=!1,u3(e,t,i);Gi=!!(e.flags&131072)}else Gi=!1,nn&&t.flags&1048576&&jE(t,Rm,t.index);switch(t.lanes=0,t.tag){case 2:var u=t.type;rm(e,t),e=t.pendingProps;var d=Tc(t,pi.current);bc(t,i),d=l1(null,t,u,e,d,i);var g=u1();return t.flags|=1,typeof d=="object"&&d!==null&&typeof d.render=="function"&&d.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,qi(u)?(g=!0,zm(t)):g=!1,t.memoizedState=d.state!==null&&d.state!==void 0?d.state:null,n1(t),d.updater=yg,t.stateNode=d,d._reactInternals=t,L0(t,u,e,i),t=B0(null,t,u,!0,g,i)):(t.tag=0,nn&&g&&Kv(t),Si(null,t,d,i),t=t.child),t;case 16:u=t.elementType;e:{switch(rm(e,t),e=t.pendingProps,d=u._init,u=d(u._payload),t.type=u,d=t.tag=E3(u),e=Wo(u,e),d){case 0:t=O0(null,t,u,e,i);break e;case 1:t=Rb(null,t,u,e,i);break e;case 11:t=zb(null,t,u,e,i);break e;case 14:t=Db(null,t,u,Wo(u.type,e),i);break e}throw Error(lt(306,u,""))}return t;case 0:return u=t.type,d=t.pendingProps,d=t.elementType===u?d:Wo(u,d),O0(e,t,u,d,i);case 1:return u=t.type,d=t.pendingProps,d=t.elementType===u?d:Wo(u,d),Rb(e,t,u,d,i);case 3:e:{if(xk(t),e===null)throw Error(lt(387));u=t.pendingProps,g=t.memoizedState,d=g.element,WE(e,t),Om(t,u,null,i);var y=t.memoizedState;if(u=y.element,g.isDehydrated)if(g={element:u,isDehydrated:!1,cache:y.cache,pendingSuspenseBoundaries:y.pendingSuspenseBoundaries,transitions:y.transitions},t.updateQueue.baseState=g,t.memoizedState=g,t.flags&256){d=Ac(Error(lt(423)),t),t=Lb(e,t,u,i,d);break e}else if(u!==d){d=Ac(Error(lt(424)),t),t=Lb(e,t,u,i,d);break e}else for(vo=Xa(t.stateNode.containerInfo.firstChild),xo=t,nn=!0,Ko=null,i=GE(t,null,u,i),t.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling;else{if(Cc(),u===d){t=Xs(e,t,i);break e}Si(e,t,u,i)}t=t.child}return t;case 5:return qE(t),e===null&&z0(t),u=t.type,d=t.pendingProps,g=e!==null?e.memoizedProps:null,y=d.children,C0(u,d)?y=null:g!==null&&C0(u,g)&&(t.flags|=32),vk(e,t),Si(e,t,y,i),t.child;case 6:return e===null&&z0(t),null;case 13:return wk(e,t,i);case 4:return i1(t,t.stateNode.containerInfo),u=t.pendingProps,e===null?t.child=Ic(t,null,u,i):Si(e,t,u,i),t.child;case 11:return u=t.type,d=t.pendingProps,d=t.elementType===u?d:Wo(u,d),zb(e,t,u,d,i);case 7:return Si(e,t,t.pendingProps,i),t.child;case 8:return Si(e,t,t.pendingProps.children,i),t.child;case 12:return Si(e,t,t.pendingProps.children,i),t.child;case 10:e:{if(u=t.type._context,d=t.pendingProps,g=t.memoizedProps,y=d.value,Hr(Lm,u._currentValue),u._currentValue=y,g!==null)if(ts(g.value,y)){if(g.children===d.children&&!Wi.current){t=Xs(e,t,i);break e}}else for(g=t.child,g!==null&&(g.return=t);g!==null;){var c=g.dependencies;if(c!==null){y=g.child;for(var T=c.firstContext;T!==null;){if(T.context===u){if(g.tag===1){T=Gs(-1,i&-i),T.tag=2;var P=g.updateQueue;if(P!==null){P=P.shared;var R=P.pending;R===null?T.next=T:(T.next=R.next,R.next=T),P.pending=T}}g.lanes|=i,T=g.alternate,T!==null&&(T.lanes|=i),D0(g.return,i,t),c.lanes|=i;break}T=T.next}}else if(g.tag===10)y=g.type===t.type?null:g.child;else if(g.tag===18){if(y=g.return,y===null)throw Error(lt(341));y.lanes|=i,c=y.alternate,c!==null&&(c.lanes|=i),D0(y,i,t),y=g.sibling}else y=g.child;if(y!==null)y.return=g;else for(y=g;y!==null;){if(y===t){y=null;break}if(g=y.sibling,g!==null){g.return=y.return,y=g;break}y=y.return}g=y}Si(e,t,d.children,i),t=t.child}return t;case 9:return d=t.type,u=t.pendingProps.children,bc(t,i),d=Fo(d),u=u(d),t.flags|=1,Si(e,t,u,i),t.child;case 14:return u=t.type,d=Wo(u,t.pendingProps),d=Wo(u.type,d),Db(e,t,u,d,i);case 15:return yk(e,t,t.type,t.pendingProps,i);case 17:return u=t.type,d=t.pendingProps,d=t.elementType===u?d:Wo(u,d),rm(e,t),t.tag=1,qi(u)?(e=!0,zm(t)):e=!1,bc(t,i),fk(t,u,d),L0(t,u,d,i),B0(null,t,u,!0,e,i);case 19:return bk(e,t,i);case 22:return _k(e,t,i)}throw Error(lt(156,t.tag))};function Bk(e,t){return hE(e,t)}function S3(e,t,i,u){this.tag=e,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=u,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ro(e,t,i,u){return new S3(e,t,i,u)}function v1(e){return e=e.prototype,!(!e||!e.isReactComponent)}function E3(e){if(typeof e=="function")return v1(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Bv)return 11;if(e===Nv)return 14}return 2}function Qa(e,t){var i=e.alternate;return i===null?(i=Ro(e.tag,t,e.key,e.mode),i.elementType=e.elementType,i.type=e.type,i.stateNode=e.stateNode,i.alternate=e,e.alternate=i):(i.pendingProps=t,i.type=e.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=e.flags&14680064,i.childLanes=e.childLanes,i.lanes=e.lanes,i.child=e.child,i.memoizedProps=e.memoizedProps,i.memoizedState=e.memoizedState,i.updateQueue=e.updateQueue,t=e.dependencies,i.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},i.sibling=e.sibling,i.index=e.index,i.ref=e.ref,i}function om(e,t,i,u,d,g){var y=2;if(u=e,typeof e=="function")v1(e)&&(y=1);else if(typeof e=="string")y=5;else e:switch(e){case oc:return Zl(i.children,d,g,t);case Ov:y=8,d|=8;break;case o0:return e=Ro(12,i,t,d|2),e.elementType=o0,e.lanes=g,e;case s0:return e=Ro(13,i,t,d),e.elementType=s0,e.lanes=g,e;case a0:return e=Ro(19,i,t,d),e.elementType=a0,e.lanes=g,e;case qS:return xg(i,d,g,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case ZS:y=10;break e;case WS:y=9;break e;case Bv:y=11;break e;case Nv:y=14;break e;case Oa:y=16,u=null;break e}throw Error(lt(130,e==null?e:typeof e,""))}return t=Ro(y,i,t,d),t.elementType=e,t.type=u,t.lanes=g,t}function Zl(e,t,i,u){return e=Ro(7,e,u,t),e.lanes=i,e}function xg(e,t,i,u){return e=Ro(22,e,u,t),e.elementType=qS,e.lanes=i,e.stateNode={isHidden:!1},e}function L_(e,t,i){return e=Ro(6,e,null,t),e.lanes=i,e}function F_(e,t,i){return t=Ro(4,e.children!==null?e.children:[],e.key,t),t.lanes=i,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function k3(e,t,i,u,d){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=g_(0),this.expirationTimes=g_(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=g_(0),this.identifierPrefix=u,this.onRecoverableError=d,this.mutableSourceEagerHydrationData=null}function x1(e,t,i,u,d,g,y,c,T){return e=new k3(e,t,i,c,T),t===1?(t=1,g===!0&&(t|=8)):t=0,g=Ro(3,null,null,t),e.current=g,g.stateNode=e,g.memoizedState={element:u,isDehydrated:i,cache:null,transitions:null,pendingSuspenseBoundaries:null},n1(g),e}function T3(e,t,i){var u=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Uk)}catch(e){console.error(e)}}Uk(),US.exports=bo;var Vk=US.exports,Wb=Vk;n0.createRoot=Wb.createRoot,n0.hydrateRoot=Wb.hydrateRoot;const M3="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='80'%20height='48'%20viewBox='0%200%2080%2048'%3e%3cg%20fill='%23D73F3F'%20fill-rule='evenodd'%3e%3cpath%20d='M37.02656,20.77496%20C37.02656,20.29096%2037.12976,19.85896%2037.33616,19.48616%20C37.54096,19.11176%2037.81296,18.80696%2038.15056,18.56376%20C38.48656,18.32136%2038.86496,18.13736%2039.28576,18.01336%20C39.70496,17.89016%2040.12736,17.82776%2040.55376,17.82776%20C40.97856,17.82776%2041.40256,17.89016%2041.82336,18.01336%20C42.24176,18.13736%2042.62016,18.32136%2042.95616,18.56376%20C43.29456,18.80696%2043.56576,19.11176%2043.77216,19.48616%20C43.97856,19.85896%2044.08096,20.29096%2044.08096,20.77496%20L44.08096,27.14696%20C44.08096,27.64136%2043.97856,28.07496%2043.77216,28.44216%20C43.56576,28.81096%2043.29456,29.11416%2042.95616,29.35736%20C42.62016,29.60136%2042.24176,29.78616%2041.82336,29.90856%20C41.40256,30.03176%2040.97856,30.09336%2040.55376,30.09336%20C40.12736,30.09336%2039.70496,30.03176%2039.28576,29.90856%20C38.86496,29.78616%2038.48656,29.60136%2038.15056,29.35736%20C37.81296,29.11416%2037.54096,28.81096%2037.33616,28.44216%20C37.12976,28.07496%2037.02656,27.64136%2037.02656,27.14696%20L37.02656,20.77496%20Z%20M39.05136,27.15016%20C39.05136,27.56536%2039.28256,27.87496%2039.56576,28.07176%20C39.84736,28.27016%2040.18096,28.37496%2040.56576,28.37496%20C40.94896,28.37496%2041.28416,28.27016%2041.56656,28.07176%20C41.84736,27.87496%2042.00816,27.56536%2042.00816,27.15016%20L42.00816,20.77816%20C42.00816,20.36136%2041.84736,20.05256%2041.56656,19.85576%20C41.28416,19.65816%2040.94896,19.52536%2040.56576,19.52536%20C40.18096,19.52536%2039.84736,19.65816%2039.56576,19.85576%20C39.28256,20.05256%2039.05136,20.36136%2039.05136,20.77816%20L39.05136,27.15016%20Z'/%3e%3cpolygon%20points='33.379%2017.815%2033.379%2022.99%2030.152%2022.99%2030.152%2017.815%2028.387%2017.815%2028.387%2030.1%2030.152%2030.1%2030.152%2024.923%2033.379%2024.923%2033.379%2030.1%2035.278%2030.1%2035.278%2017.815'/%3e%3cpolygon%20points='52.431%2017.815%2045.426%2017.815%2045.426%2019.622%2048.015%2019.622%2047.985%2030.1%2049.847%2030.1%2049.847%2019.622%2052.431%2019.622'/%3e%3cpath%20d='M65.42344,28.7668%20L79.67944,28.7668%20L71.15544,19.1684%20L62.66904,9.57%20L54.18104,0.000400000001%20L11.53944,0.000400000001%20L20.02584,9.57%20L5.73784,9.57%20L14.22584,19.1684%20L14.29144,19.2332%20L0.000239999999,19.2332%20L8.52184,28.8316%20L17.01304,38.43%20L25.50024,48.0004%20L68.14184,48.0004%20L59.65064,38.43%20L59.58824,38.3364%20L73.87864,38.3364%20L65.42344,28.7668%20Z%20M39.83944,39.9492%20C30.31864,39.9492%2022.60104,32.8084%2022.60104,24.0012%20C22.60104,15.1908%2030.31864,8.05%2039.83944,8.05%20C49.36104,8.05%2057.07944,15.1908%2057.07944,24.0012%20C57.07944,32.8084%2049.36104,39.9492%2039.83944,39.9492%20Z'/%3e%3c/g%3e%3c/svg%3e";var Zi=function(){return Zi=Object.assign||function(t){for(var i,u=1,d=arguments.length;u0?Nn(Vc,--Bo):0,Dc--,bn===10&&(Dc=1,Tg--),bn}function Qo(){return bn=Bo2||Y0(bn)>3?"":" "}function j3(e,t){for(;--t&&Qo()&&!(bn<48||bn>102||bn>57&&bn<65||bn>70&&bn<97););return Ig(e,am()+(t<6&&Wl()==32&&Qo()==32))}function J0(e){for(;Qo();)switch(bn){case e:return Bo;case 34:case 39:e!==34&&e!==39&&J0(bn);break;case 40:e===41&&J0(e);break;case 92:Qo();break}return Bo}function U3(e,t){for(;Qo()&&e+bn!==57;)if(e+bn===84&&Wl()===47)break;return"/*"+Ig(t,Bo-1)+"*"+k1(e===47?e:Qo())}function V3(e){for(;!Y0(Wl());)Qo();return Ig(e,Bo)}function H3(e){return N3(lm("",null,null,null,[""],e=B3(e),0,[0],e))}function lm(e,t,i,u,d,g,y,c,T){for(var P=0,R=0,D=y,A=0,N=0,X=0,U=1,te=1,F=1,$=0,q="",ne=d,se=g,Ee=u,ge=q;te;)switch(X=$,$=Qo()){case 40:if(X!=108&&Nn(ge,D-1)==58){sm(ge+=sr(O_($),"&","&\f"),"&\f",Zk(P?c[P-1]:0))!=-1&&(F=-1);break}case 34:case 39:case 91:ge+=O_($);break;case 9:case 10:case 13:case 32:ge+=$3(X);break;case 92:ge+=j3(am()-1,7);continue;case 47:switch(Wl()){case 42:case 47:md(G3(U3(Qo(),am()),t,i,T),T);break;default:ge+="/"}break;case 123*U:c[P++]=ys(ge)*F;case 125*U:case 59:case 0:switch($){case 0:case 125:te=0;case 59+R:F==-1&&(ge=sr(ge,/\f/g,"")),N>0&&ys(ge)-D&&md(N>32?Kb(ge+";",u,i,D-1,T):Kb(sr(ge," ","")+";",u,i,D-2,T),T);break;case 59:ge+=";";default:if(md(Ee=Xb(ge,t,i,P,R,d,c,q,ne=[],se=[],D,g),g),$===123)if(R===0)lm(ge,t,Ee,Ee,ne,g,D,c,se);else switch(A===99&&Nn(ge,3)===110?100:A){case 100:case 108:case 109:case 115:lm(e,Ee,Ee,u&&md(Xb(e,Ee,Ee,0,0,d,c,q,d,ne=[],D,se),se),d,se,D,c,u?ne:se);break;default:lm(ge,Ee,Ee,Ee,[""],se,0,c,se)}}P=R=N=0,U=F=1,q=ge="",D=y;break;case 58:D=1+ys(ge),N=X;default:if(U<1){if($==123)--U;else if($==125&&U++==0&&O3()==125)continue}switch(ge+=k1($),$*U){case 38:F=R>0?1:(ge+="\f",-1);break;case 44:c[P++]=(ys(ge)-1)*F,F=1;break;case 64:Wl()===45&&(ge+=O_(Qo())),A=Wl(),R=D=ys(q=ge+=V3(am())),$++;break;case 45:X===45&&ys(ge)==2&&(U=0)}}return g}function Xb(e,t,i,u,d,g,y,c,T,P,R,D){for(var A=d-1,N=d===0?g:[""],X=qk(N),U=0,te=0,F=0;U0?N[$]+" "+q:sr(q,/&\f/g,N[$])))&&(T[F++]=ne);return Cg(e,t,i,d===0?kg:c,T,P,R,D)}function G3(e,t,i,u){return Cg(e,t,i,Hk,k1(F3()),zc(e,2,-2),0,u)}function Kb(e,t,i,u,d){return Cg(e,t,i,E1,zc(e,0,u),zc(e,u+1,-1),u,d)}function Kk(e,t,i){switch(R3(e,t)){case 5103:return Pr+"print-"+e+e;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return Pr+e+e;case 4789:return Pd+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return Pr+e+Pd+e+Xr+e+e;case 5936:switch(Nn(e,t+11)){case 114:return Pr+e+Xr+sr(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return Pr+e+Xr+sr(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return Pr+e+Xr+sr(e,/[svh]\w+-[tblr]{2}/,"lr")+e}case 6828:case 4268:case 2903:return Pr+e+Xr+e+e;case 6165:return Pr+e+Xr+"flex-"+e+e;case 5187:return Pr+e+sr(e,/(\w+).+(:[^]+)/,Pr+"box-$1$2"+Xr+"flex-$1$2")+e;case 5443:return Pr+e+Xr+"flex-item-"+sr(e,/flex-|-self/g,"")+(js(e,/flex-|baseline/)?"":Xr+"grid-row-"+sr(e,/flex-|-self/g,""))+e;case 4675:return Pr+e+Xr+"flex-line-pack"+sr(e,/align-content|flex-|-self/g,"")+e;case 5548:return Pr+e+Xr+sr(e,"shrink","negative")+e;case 5292:return Pr+e+Xr+sr(e,"basis","preferred-size")+e;case 6060:return Pr+"box-"+sr(e,"-grow","")+Pr+e+Xr+sr(e,"grow","positive")+e;case 4554:return Pr+sr(e,/([^-])(transform)/g,"$1"+Pr+"$2")+e;case 6187:return sr(sr(sr(e,/(zoom-|grab)/,Pr+"$1"),/(image-set)/,Pr+"$1"),e,"")+e;case 5495:case 3959:return sr(e,/(image-set\([^]*)/,Pr+"$1$`$1");case 4968:return sr(sr(e,/(.+:)(flex-)?(.*)/,Pr+"box-pack:$3"+Xr+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+Pr+e+e;case 4200:if(!js(e,/flex-|baseline/))return Xr+"grid-column-align"+zc(e,t)+e;break;case 2592:case 3360:return Xr+sr(e,"template-","")+e;case 4384:case 3616:return i&&i.some(function(u,d){return t=d,js(u.props,/grid-\w+-end/)})?~sm(e+(i=i[t].value),"span",0)?e:Xr+sr(e,"-start","")+e+Xr+"grid-row-span:"+(~sm(i,"span",0)?js(i,/\d+/):+js(i,/\d+/)-+js(e,/\d+/))+";":Xr+sr(e,"-start","")+e;case 4896:case 4128:return i&&i.some(function(u){return js(u.props,/grid-\w+-start/)})?e:Xr+sr(sr(e,"-end","-span"),"span ","")+e;case 4095:case 3583:case 4068:case 2532:return sr(e,/(.+)-inline(.+)/,Pr+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(ys(e)-1-t>6)switch(Nn(e,t+1)){case 109:if(Nn(e,t+4)!==45)break;case 102:return sr(e,/(.+:)(.+)-([^]+)/,"$1"+Pr+"$2-$3$1"+Pd+(Nn(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~sm(e,"stretch",0)?Kk(sr(e,"stretch","fill-available"),t,i)+e:e}break;case 5152:case 5920:return sr(e,/(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/,function(u,d,g,y,c,T,P){return Xr+d+":"+g+P+(y?Xr+d+"-span:"+(c?T:+T-+g)+P:"")+e});case 4949:if(Nn(e,t+6)===121)return sr(e,":",":"+Pr)+e;break;case 6444:switch(Nn(e,Nn(e,14)===45?18:11)){case 120:return sr(e,/(.+:)([^;\s!]+)(;|(\s+)?!.+)?/,"$1"+Pr+(Nn(e,14)===45?"inline-":"")+"box$3$1"+Pr+"$2$3$1"+Xr+"$2box$3")+e;case 100:return sr(e,":",":"+Xr)+e}break;case 5719:case 2647:case 2135:case 3927:case 2391:return sr(e,"scroll-","scroll-snap-")+e}return e}function Wm(e,t){for(var i="",u=0;u-1&&!e.return)switch(e.type){case E1:e.return=Kk(e.value,e.length,i);return;case Gk:return Wm([Ra(e,{value:sr(e.value,"@","@"+Pr)})],u);case kg:if(e.length)return L3(i=e.props,function(d){switch(js(d,u=/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":rc(Ra(e,{props:[sr(d,/:(read-\w+)/,":"+Pd+"$1")]})),rc(Ra(e,{props:[d]})),K0(e,{props:qb(i,u)});break;case"::placeholder":rc(Ra(e,{props:[sr(d,/:(plac\w+)/,":"+Pr+"input-$1")]})),rc(Ra(e,{props:[sr(d,/:(plac\w+)/,":"+Pd+"$1")]})),rc(Ra(e,{props:[sr(d,/:(plac\w+)/,Xr+"input-$1")]})),rc(Ra(e,{props:[d]})),K0(e,{props:qb(i,u)});break}return""})}}var K3={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},po={},Rc=typeof process<"u"&&po!==void 0&&(po.REACT_APP_SC_ATTR||po.SC_ATTR)||"data-styled",Yk="active",Jk="data-styled-version",Pg="6.1.13",T1=`/*!sc*/ -`,qm=typeof window<"u"&&"HTMLElement"in window,Y3=!!(typeof SC_DISABLE_SPEEDY=="boolean"?SC_DISABLE_SPEEDY:typeof process<"u"&&po!==void 0&&po.REACT_APP_SC_DISABLE_SPEEDY!==void 0&&po.REACT_APP_SC_DISABLE_SPEEDY!==""?po.REACT_APP_SC_DISABLE_SPEEDY!=="false"&&po.REACT_APP_SC_DISABLE_SPEEDY:typeof process<"u"&&po!==void 0&&po.SC_DISABLE_SPEEDY!==void 0&&po.SC_DISABLE_SPEEDY!==""&&po.SC_DISABLE_SPEEDY!=="false"&&po.SC_DISABLE_SPEEDY),Ag=Object.freeze([]),Lc=Object.freeze({});function J3(e,t,i){return i===void 0&&(i=Lc),e.theme!==i.theme&&e.theme||t||i.theme}var Qk=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","track","u","ul","use","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"]),Q3=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,ez=/(^-|-$)/g;function Yb(e){return e.replace(Q3,"-").replace(ez,"")}var tz=/(a)(d)/gi,Bf=52,Jb=function(e){return String.fromCharCode(e+(e>25?39:97))};function Q0(e){var t,i="";for(t=Math.abs(e);t>Bf;t=t/Bf|0)i=Jb(t%Bf)+i;return(Jb(t%Bf)+i).replace(tz,"$1-$2")}var B_,eT=5381,gc=function(e,t){for(var i=t.length;i;)e=33*e^t.charCodeAt(--i);return e},tT=function(e){return gc(eT,e)};function rz(e){return Q0(tT(e)>>>0)}function nz(e){return e.displayName||e.name||"Component"}function N_(e){return typeof e=="string"&&!0}var rT=typeof Symbol=="function"&&Symbol.for,nT=rT?Symbol.for("react.memo"):60115,iz=rT?Symbol.for("react.forward_ref"):60112,oz={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},sz={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},iT={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},az=((B_={})[iz]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},B_[nT]=iT,B_);function Qb(e){return("type"in(t=e)&&t.type.$$typeof)===nT?iT:"$$typeof"in e?az[e.$$typeof]:oz;var t}var lz=Object.defineProperty,uz=Object.getOwnPropertyNames,e2=Object.getOwnPropertySymbols,cz=Object.getOwnPropertyDescriptor,hz=Object.getPrototypeOf,t2=Object.prototype;function oT(e,t,i){if(typeof t!="string"){if(t2){var u=hz(t);u&&u!==t2&&oT(e,u,i)}var d=uz(t);e2&&(d=d.concat(e2(t)));for(var g=Qb(e),y=Qb(t),c=0;c0?" Args: ".concat(t.join(", ")):""))}var dz=function(){function e(t){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=t}return e.prototype.indexOfGroup=function(t){for(var i=0,u=0;u=this.groupSizes.length){for(var u=this.groupSizes,d=u.length,g=d;t>=g;)if((g<<=1)<0)throw cp(16,"".concat(t));this.groupSizes=new Uint32Array(g),this.groupSizes.set(u),this.length=g;for(var y=d;y=this.length||this.groupSizes[t]===0)return i;for(var u=this.groupSizes[t],d=this.indexOfGroup(t),g=d+u,y=d;y=0){var u=document.createTextNode(i);return this.element.insertBefore(u,this.nodes[t]||null),this.length++,!0}return!1},e.prototype.deleteRule=function(t){this.element.removeChild(this.nodes[t]),this.length--},e.prototype.getRule=function(t){return t0&&(te+="".concat(F,","))}),T+="".concat(X).concat(U,'{content:"').concat(te,'"}').concat(T1)},R=0;R0?".".concat(t):A},R=T.slice();R.push(function(A){A.type===kg&&A.value.includes("&")&&(A.props[0]=A.props[0].replace(Sz,i).replace(u,P))}),y.prefix&&R.push(X3),R.push(Z3);var D=function(A,N,X,U){N===void 0&&(N=""),X===void 0&&(X=""),U===void 0&&(U="&"),t=U,i=N,u=new RegExp("\\".concat(i,"\\b"),"g");var te=A.replace(Ez,""),F=H3(X||N?"".concat(X," ").concat(N," { ").concat(te," }"):te);y.namespace&&(F=lT(F,y.namespace));var $=[];return Wm(F,W3(R.concat(q3(function(q){return $.push(q)})))),$};return D.hash=T.length?T.reduce(function(A,N){return N.name||cp(15),gc(A,N.name)},eT).toString():"",D}var Tz=new aT,tv=kz(),uT=Ec.createContext({shouldForwardProp:void 0,styleSheet:Tz,stylis:tv});uT.Consumer;Ec.createContext(void 0);function o2(){return jt.useContext(uT)}var Cz=function(){function e(t,i){var u=this;this.inject=function(d,g){g===void 0&&(g=tv);var y=u.name+g.hash;d.hasNameForId(u.id,y)||d.insertRules(u.id,y,g(u.rules,y,"@keyframes"))},this.name=t,this.id="sc-keyframes-".concat(t),this.rules=i,I1(this,function(){throw cp(12,String(u.name))})}return e.prototype.getName=function(t){return t===void 0&&(t=tv),this.name+t.hash},e}(),Iz=function(e){return e>="A"&&e<="Z"};function s2(e){for(var t="",i=0;i>>0);if(!i.hasNameForId(this.componentId,y)){var c=u(g,".".concat(y),void 0,this.componentId);i.insertRules(this.componentId,y,c)}d=Ul(d,y),this.staticRulesId=y}else{for(var T=gc(this.baseHash,u.hash),P="",R=0;R>>0);i.hasNameForId(this.componentId,N)||i.insertRules(this.componentId,N,u(P,".".concat(N),void 0,this.componentId)),d=Ul(d,N)}}return d},e}(),dT=Ec.createContext(void 0);dT.Consumer;var $_={};function zz(e,t,i){var u=C1(e),d=e,g=!N_(e),y=t.attrs,c=y===void 0?Ag:y,T=t.componentId,P=T===void 0?function(ne,se){var Ee=typeof ne!="string"?"sc":Yb(ne);$_[Ee]=($_[Ee]||0)+1;var ge="".concat(Ee,"-").concat(rz(Pg+Ee+$_[Ee]));return se?"".concat(se,"-").concat(ge):ge}(t.displayName,t.parentComponentId):T,R=t.displayName,D=R===void 0?function(ne){return N_(ne)?"styled.".concat(ne):"Styled(".concat(nz(ne),")")}(e):R,A=t.displayName&&t.componentId?"".concat(Yb(t.displayName),"-").concat(t.componentId):t.componentId||P,N=u&&d.attrs?d.attrs.concat(c).filter(Boolean):c,X=t.shouldForwardProp;if(u&&d.shouldForwardProp){var U=d.shouldForwardProp;if(t.shouldForwardProp){var te=t.shouldForwardProp;X=function(ne,se){return U(ne,se)&&te(ne,se)}}else X=U}var F=new Mz(i,A,u?d.componentStyle:void 0);function $(ne,se){return function(Ee,ge,Oe){var Fe=Ee.attrs,Ge=Ee.componentStyle,it=Ee.defaultProps,ve=Ee.foldedComponentIds,je=Ee.styledComponentId,H=Ee.target,Re=Ec.useContext(dT),_t=o2(),ye=Ee.shouldForwardProp||_t.shouldForwardProp,Be=J3(ge,Re,it)||Lc,Le=function(rt,qt,Kt){for(var $t,Gt=Zi(Zi({},qt),{className:void 0,theme:Kt}),pr=0;pr input { - display: block; - opacity: 0; - position: absolute; - pointer-events: none; - } -`],[` - position: relative; - `,`; - &:focus-within { - outline: 2px solid black; - } - & > input { - display: block; - opacity: 0; - position: absolute; - pointer-events: none; - } -`])),function(e){return e.overRide?"":Dz}),Lz=hp.div(h2||(h2=dp([` - border: dashed 2px `,`; - border-radius: 5px; - background-color: `,`; - opacity: 0.9; - position: absolute; - top: 0; - right: 0; - left: 0; - bottom: 0; - z-index: 999; - & > span { - position: absolute; - top: 50%; - left: 50%; - transform: translateX(-50%) translateY(-50%); - } -`],[` - border: dashed 2px `,`; - border-radius: 5px; - background-color: `,`; - opacity: 0.9; - position: absolute; - top: 0; - right: 0; - left: 0; - bottom: 0; - z-index: 999; - & > span { - position: absolute; - top: 50%; - left: 50%; - transform: translateX(-50%) translateY(-50%); - } -`])),"#666","#999"),Fz=hp.div(d2||(d2=dp([` - display: flex; - justify-content: space-between; - flex-grow: 1; - & > span { - font-size: 12px; - color: `,`; - } - .file-types { - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; - max-width: 100px; - } -`],[` - display: flex; - justify-content: space-between; - flex-grow: 1; - & > span { - font-size: 12px; - color: `,`; - } - .file-types { - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; - max-width: 100px; - } -`])),function(e){return e.error?"red":"#666"}),Oz=hp.span(p2||(p2=dp([` - font-size: 14px; - color: `,`; - span { - text-decoration: underline; - } -`],[` - font-size: 14px; - color: `,`; - span { - text-decoration: underline; - } -`])),"#666"),f2=function(e){return e/1024/1024},Bz=function(e){return e===void 0?"":e.map(function(t){return".".concat(t.toLowerCase())}).join(",")};function Nz(e){var t=e.types,i=e.minSize,u=e.maxSize;if(t){var d=t.toString(),g="";return u&&(g+="size >= ".concat(u,", ")),i&&(g+="size <= ".concat(i,", ")),Ke.jsx("span",Xl({title:"".concat(g,"types: ").concat(d),className:"file-types"},{children:d}),void 0)}return null}function $z(){return Ke.jsxs("svg",Xl({width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[Ke.jsx("path",{d:"M5.33317 6.66667H22.6665V16H25.3332V6.66667C25.3332 5.196 24.1372 4 22.6665 4H5.33317C3.8625 4 2.6665 5.196 2.6665 6.66667V22.6667C2.6665 24.1373 3.8625 25.3333 5.33317 25.3333H15.9998V22.6667H5.33317V6.66667Z",fill:"#0658C2"},void 0),Ke.jsx("path",{d:"M10.6665 14.6667L6.6665 20H21.3332L15.9998 12L11.9998 17.3333L10.6665 14.6667Z",fill:"#0658C2"},void 0),Ke.jsx("path",{d:"M25.3332 18.6667H22.6665V22.6667H18.6665V25.3333H22.6665V29.3333H25.3332V25.3333H29.3332V22.6667H25.3332V18.6667Z",fill:"#0658C2"},void 0)]}),void 0)}var j_=0,jz=function(e,t,i,u,d,g){return i?Ke.jsx("span",{children:"File type/size error, Hovered on types!"},void 0):Ke.jsx(Oz,{children:u?Ke.jsx("span",{children:"Upload disabled"},void 0):Ke.jsx(Ke.Fragment,e||t?{children:g?Ke.jsx(Ke.Fragment,{children:Ke.jsx("span",{children:g},void 0)},void 0):Ke.jsxs(Ke.Fragment,{children:[Ke.jsx("span",{children:"Uploaded Successfully!"},void 0)," Upload another?"]},void 0)}:{children:Ke.jsxs(Ke.Fragment,d?{children:[Ke.jsx("span",{children:d.split(" ")[0]},void 0)," ",d.substr(d.indexOf(" ")+1)]}:{children:[Ke.jsx("span",{children:"Upload"},void 0)," or drop a file right here"]},void 0)},void 0)},void 0)},Uz=function(e){var t=e.name,i=e.hoverTitle,u=e.types,d=e.handleChange,g=e.classes,y=e.children,c=e.maxSize,T=e.minSize,P=e.fileOrFiles,R=e.onSizeError,D=e.onTypeError,A=e.onSelect,N=e.onDrop,X=e.disabled,U=e.label,te=e.uploadedLabel,F=e.multiple,$=e.required,q=e.onDraggingStateChange,ne=e.dropMessageStyle,se=e.ariaLabel,Ee=e.ariaDescribedby,ge=jt.useRef(null),Oe=jt.useRef(null),Fe=jt.useState(!1),Ge=Fe[0],it=Fe[1],ve=jt.useState(null),je=ve[0],H=ve[1],Re=jt.useState(!1),_t=Re[0],ye=Re[1],Be=function(xe){return u&&!function(Te,ft){var nt=Te.name.split(".").pop();return ft.map(function(rt){return rt.toLowerCase()}).includes(nt.toLowerCase())}(xe,u)?(ye(!0),D&&D("File type is not supported"),!1):c&&f2(xe.size)>c?(ye(!0),R&&R("File size is too big"),!1):!(T&&f2(xe.size)0||Gt(!1)},[]),$r=jt.useCallback(function(Ue){Ue.preventDefault(),Ue.stopPropagation()},[]),V=jt.useCallback(function(Ue){Ue.preventDefault(),Ue.stopPropagation(),Gt(!1),j_=0;var ie=Ue.dataTransfer.files;if(ie&&ie.length>0){var de=nt?ie:ie[0],oe=rt(de);qt&&oe&&qt(de)}},[rt]);return jt.useEffect(function(){var Ue=Te.current;return Ue.addEventListener("click",pr),Ue.addEventListener("dragenter",lr),Ue.addEventListener("dragleave",gr),Ue.addEventListener("dragover",$r),Ue.addEventListener("drop",V),function(){Ue.removeEventListener("click",pr),Ue.removeEventListener("dragenter",lr),Ue.removeEventListener("dragleave",gr),Ue.removeEventListener("dragover",$r),Ue.removeEventListener("drop",V)}},[pr,lr,gr,$r,V,Te]),$t}({labelRef:ge,inputRef:Oe,multiple:F,handleChanges:Le,onDrop:N});return jt.useEffect(function(){q==null||q(Ye)},[Ye]),jt.useEffect(function(){P?(it(!0),H(P)):(Oe.current&&(Oe.current.value=""),it(!1),H(null))},[P]),Ke.jsxs(Rz,Xl({overRide:y,className:"".concat(g||""," ").concat(X?"is-disabled":""),ref:ge,htmlFor:t,onClick:function(xe){xe.preventDefault(),xe.stopPropagation()},"aria-describedby":Ee,role:"button","aria-label":se},{children:[Ke.jsx("input",{onClick:function(xe){xe.stopPropagation(),Oe&&Oe.current&&(Oe.current.value="",Oe.current.click())},onChange:function(xe){var Te=xe.target.files,ft=F?Te:Te[0],nt=Le(ft);A&&nt&&A(ft)},accept:Bz(u),ref:Oe,type:"file",id:t,name:t,disabled:X,multiple:F,required:$},void 0),Ye&&Ke.jsx(Lz,Xl({style:ne},{children:Ke.jsx("span",{children:i||"Drop Here"},void 0)}),void 0),!y&&Ke.jsxs(Ke.Fragment,{children:[Ke.jsx($z,{},void 0),Ke.jsxs(Fz,Xl({error:_t},{children:[jz(je,Ge,_t,X,U,te),Ke.jsx(Nz,{types:u,minSize:T,maxSize:c},void 0)]}),void 0)]},void 0),y]}),void 0)};function $f(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var mT={exports:{}};/*! - -JSZip v3.10.1 - A JavaScript class for generating and reading zip files - - -(c) 2009-2016 Stuart Knightley -Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown. - -JSZip uses the library pako released under the MIT license : -https://github.com/nodeca/pako/blob/main/LICENSE -*/(function(e,t){(function(i){e.exports=i()})(function(){return function i(u,d,g){function y(P,R){if(!d[P]){if(!u[P]){var D=typeof $f=="function"&&$f;if(!R&&D)return D(P,!0);if(c)return c(P,!0);var A=new Error("Cannot find module '"+P+"'");throw A.code="MODULE_NOT_FOUND",A}var N=d[P]={exports:{}};u[P][0].call(N.exports,function(X){var U=u[P][1][X];return y(U||X)},N,N.exports,i,u,d,g)}return d[P].exports}for(var c=typeof $f=="function"&&$f,T=0;T>2,N=(3&P)<<4|R>>4,X=1>6:64,U=2>4,R=(15&A)<<4|(N=c.indexOf(T.charAt(U++)))>>2,D=(3&N)<<6|(X=c.indexOf(T.charAt(U++))),$[te++]=P,N!==64&&($[te++]=R),X!==64&&($[te++]=D);return $}},{"./support":30,"./utils":32}],2:[function(i,u,d){var g=i("./external"),y=i("./stream/DataWorker"),c=i("./stream/Crc32Probe"),T=i("./stream/DataLengthProbe");function P(R,D,A,N,X){this.compressedSize=R,this.uncompressedSize=D,this.crc32=A,this.compression=N,this.compressedContent=X}P.prototype={getContentWorker:function(){var R=new y(g.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new T("data_length")),D=this;return R.on("end",function(){if(this.streamInfo.data_length!==D.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),R},getCompressedWorker:function(){return new y(g.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},P.createWorkerFrom=function(R,D,A){return R.pipe(new c).pipe(new T("uncompressedSize")).pipe(D.compressWorker(A)).pipe(new T("compressedSize")).withStreamInfo("compression",D)},u.exports=P},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(i,u,d){var g=i("./stream/GenericWorker");d.STORE={magic:"\0\0",compressWorker:function(){return new g("STORE compression")},uncompressWorker:function(){return new g("STORE decompression")}},d.DEFLATE=i("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(i,u,d){var g=i("./utils"),y=function(){for(var c,T=[],P=0;P<256;P++){c=P;for(var R=0;R<8;R++)c=1&c?3988292384^c>>>1:c>>>1;T[P]=c}return T}();u.exports=function(c,T){return c!==void 0&&c.length?g.getTypeOf(c)!=="string"?function(P,R,D,A){var N=y,X=A+D;P^=-1;for(var U=A;U>>8^N[255&(P^R[U])];return-1^P}(0|T,c,c.length,0):function(P,R,D,A){var N=y,X=A+D;P^=-1;for(var U=A;U>>8^N[255&(P^R.charCodeAt(U))];return-1^P}(0|T,c,c.length,0):0}},{"./utils":32}],5:[function(i,u,d){d.base64=!1,d.binary=!1,d.dir=!1,d.createFolders=!0,d.date=null,d.compression=null,d.compressionOptions=null,d.comment=null,d.unixPermissions=null,d.dosPermissions=null},{}],6:[function(i,u,d){var g=null;g=typeof Promise<"u"?Promise:i("lie"),u.exports={Promise:g}},{lie:37}],7:[function(i,u,d){var g=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",y=i("pako"),c=i("./utils"),T=i("./stream/GenericWorker"),P=g?"uint8array":"array";function R(D,A){T.call(this,"FlateWorker/"+D),this._pako=null,this._pakoAction=D,this._pakoOptions=A,this.meta={}}d.magic="\b\0",c.inherits(R,T),R.prototype.processChunk=function(D){this.meta=D.meta,this._pako===null&&this._createPako(),this._pako.push(c.transformTo(P,D.data),!1)},R.prototype.flush=function(){T.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},R.prototype.cleanUp=function(){T.prototype.cleanUp.call(this),this._pako=null},R.prototype._createPako=function(){this._pako=new y[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var D=this;this._pako.onData=function(A){D.push({data:A,meta:D.meta})}},d.compressWorker=function(D){return new R("Deflate",D)},d.uncompressWorker=function(){return new R("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(i,u,d){function g(N,X){var U,te="";for(U=0;U>>=8;return te}function y(N,X,U,te,F,$){var q,ne,se=N.file,Ee=N.compression,ge=$!==P.utf8encode,Oe=c.transformTo("string",$(se.name)),Fe=c.transformTo("string",P.utf8encode(se.name)),Ge=se.comment,it=c.transformTo("string",$(Ge)),ve=c.transformTo("string",P.utf8encode(Ge)),je=Fe.length!==se.name.length,H=ve.length!==Ge.length,Re="",_t="",ye="",Be=se.dir,Le=se.date,Ye={crc32:0,compressedSize:0,uncompressedSize:0};X&&!U||(Ye.crc32=N.crc32,Ye.compressedSize=N.compressedSize,Ye.uncompressedSize=N.uncompressedSize);var xe=0;X&&(xe|=8),ge||!je&&!H||(xe|=2048);var Te=0,ft=0;Be&&(Te|=16),F==="UNIX"?(ft=798,Te|=function(rt,qt){var Kt=rt;return rt||(Kt=qt?16893:33204),(65535&Kt)<<16}(se.unixPermissions,Be)):(ft=20,Te|=function(rt){return 63&(rt||0)}(se.dosPermissions)),q=Le.getUTCHours(),q<<=6,q|=Le.getUTCMinutes(),q<<=5,q|=Le.getUTCSeconds()/2,ne=Le.getUTCFullYear()-1980,ne<<=4,ne|=Le.getUTCMonth()+1,ne<<=5,ne|=Le.getUTCDate(),je&&(_t=g(1,1)+g(R(Oe),4)+Fe,Re+="up"+g(_t.length,2)+_t),H&&(ye=g(1,1)+g(R(it),4)+ve,Re+="uc"+g(ye.length,2)+ye);var nt="";return nt+=` -\0`,nt+=g(xe,2),nt+=Ee.magic,nt+=g(q,2),nt+=g(ne,2),nt+=g(Ye.crc32,4),nt+=g(Ye.compressedSize,4),nt+=g(Ye.uncompressedSize,4),nt+=g(Oe.length,2),nt+=g(Re.length,2),{fileRecord:D.LOCAL_FILE_HEADER+nt+Oe+Re,dirRecord:D.CENTRAL_FILE_HEADER+g(ft,2)+nt+g(it.length,2)+"\0\0\0\0"+g(Te,4)+g(te,4)+Oe+Re+it}}var c=i("../utils"),T=i("../stream/GenericWorker"),P=i("../utf8"),R=i("../crc32"),D=i("../signature");function A(N,X,U,te){T.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=X,this.zipPlatform=U,this.encodeFileName=te,this.streamFiles=N,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}c.inherits(A,T),A.prototype.push=function(N){var X=N.meta.percent||0,U=this.entriesCount,te=this._sources.length;this.accumulate?this.contentBuffer.push(N):(this.bytesWritten+=N.data.length,T.prototype.push.call(this,{data:N.data,meta:{currentFile:this.currentFile,percent:U?(X+100*(U-te-1))/U:100}}))},A.prototype.openedSource=function(N){this.currentSourceOffset=this.bytesWritten,this.currentFile=N.file.name;var X=this.streamFiles&&!N.file.dir;if(X){var U=y(N,X,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:U.fileRecord,meta:{percent:0}})}else this.accumulate=!0},A.prototype.closedSource=function(N){this.accumulate=!1;var X=this.streamFiles&&!N.file.dir,U=y(N,X,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(U.dirRecord),X)this.push({data:function(te){return D.DATA_DESCRIPTOR+g(te.crc32,4)+g(te.compressedSize,4)+g(te.uncompressedSize,4)}(N),meta:{percent:100}});else for(this.push({data:U.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},A.prototype.flush=function(){for(var N=this.bytesWritten,X=0;X=this.index;T--)P=(P<<8)+this.byteAt(T);return this.index+=c,P},readString:function(c){return g.transformTo("string",this.readData(c))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var c=this.readInt(4);return new Date(Date.UTC(1980+(c>>25&127),(c>>21&15)-1,c>>16&31,c>>11&31,c>>5&63,(31&c)<<1))}},u.exports=y},{"../utils":32}],19:[function(i,u,d){var g=i("./Uint8ArrayReader");function y(c){g.call(this,c)}i("../utils").inherits(y,g),y.prototype.readData=function(c){this.checkOffset(c);var T=this.data.slice(this.zero+this.index,this.zero+this.index+c);return this.index+=c,T},u.exports=y},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(i,u,d){var g=i("./DataReader");function y(c){g.call(this,c)}i("../utils").inherits(y,g),y.prototype.byteAt=function(c){return this.data.charCodeAt(this.zero+c)},y.prototype.lastIndexOfSignature=function(c){return this.data.lastIndexOf(c)-this.zero},y.prototype.readAndCheckSignature=function(c){return c===this.readData(4)},y.prototype.readData=function(c){this.checkOffset(c);var T=this.data.slice(this.zero+this.index,this.zero+this.index+c);return this.index+=c,T},u.exports=y},{"../utils":32,"./DataReader":18}],21:[function(i,u,d){var g=i("./ArrayReader");function y(c){g.call(this,c)}i("../utils").inherits(y,g),y.prototype.readData=function(c){if(this.checkOffset(c),c===0)return new Uint8Array(0);var T=this.data.subarray(this.zero+this.index,this.zero+this.index+c);return this.index+=c,T},u.exports=y},{"../utils":32,"./ArrayReader":17}],22:[function(i,u,d){var g=i("../utils"),y=i("../support"),c=i("./ArrayReader"),T=i("./StringReader"),P=i("./NodeBufferReader"),R=i("./Uint8ArrayReader");u.exports=function(D){var A=g.getTypeOf(D);return g.checkSupport(A),A!=="string"||y.uint8array?A==="nodebuffer"?new P(D):y.uint8array?new R(g.transformTo("uint8array",D)):new c(g.transformTo("array",D)):new T(D)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(i,u,d){d.LOCAL_FILE_HEADER="PK",d.CENTRAL_FILE_HEADER="PK",d.CENTRAL_DIRECTORY_END="PK",d.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",d.ZIP64_CENTRAL_DIRECTORY_END="PK",d.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(i,u,d){var g=i("./GenericWorker"),y=i("../utils");function c(T){g.call(this,"ConvertWorker to "+T),this.destType=T}y.inherits(c,g),c.prototype.processChunk=function(T){this.push({data:y.transformTo(this.destType,T.data),meta:T.meta})},u.exports=c},{"../utils":32,"./GenericWorker":28}],25:[function(i,u,d){var g=i("./GenericWorker"),y=i("../crc32");function c(){g.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}i("../utils").inherits(c,g),c.prototype.processChunk=function(T){this.streamInfo.crc32=y(T.data,this.streamInfo.crc32||0),this.push(T)},u.exports=c},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(i,u,d){var g=i("../utils"),y=i("./GenericWorker");function c(T){y.call(this,"DataLengthProbe for "+T),this.propName=T,this.withStreamInfo(T,0)}g.inherits(c,y),c.prototype.processChunk=function(T){if(T){var P=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=P+T.data.length}y.prototype.processChunk.call(this,T)},u.exports=c},{"../utils":32,"./GenericWorker":28}],27:[function(i,u,d){var g=i("../utils"),y=i("./GenericWorker");function c(T){y.call(this,"DataWorker");var P=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,T.then(function(R){P.dataIsReady=!0,P.data=R,P.max=R&&R.length||0,P.type=g.getTypeOf(R),P.isPaused||P._tickAndRepeat()},function(R){P.error(R)})}g.inherits(c,y),c.prototype.cleanUp=function(){y.prototype.cleanUp.call(this),this.data=null},c.prototype.resume=function(){return!!y.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,g.delay(this._tickAndRepeat,[],this)),!0)},c.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(g.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},c.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var T=null,P=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":T=this.data.substring(this.index,P);break;case"uint8array":T=this.data.subarray(this.index,P);break;case"array":case"nodebuffer":T=this.data.slice(this.index,P)}return this.index=P,this.push({data:T,meta:{percent:this.max?this.index/this.max*100:0}})},u.exports=c},{"../utils":32,"./GenericWorker":28}],28:[function(i,u,d){function g(y){this.name=y||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}g.prototype={push:function(y){this.emit("data",y)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(y){this.emit("error",y)}return!0},error:function(y){return!this.isFinished&&(this.isPaused?this.generatedError=y:(this.isFinished=!0,this.emit("error",y),this.previous&&this.previous.error(y),this.cleanUp()),!0)},on:function(y,c){return this._listeners[y].push(c),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(y,c){if(this._listeners[y])for(var T=0;T "+y:y}},u.exports=g},{}],29:[function(i,u,d){var g=i("../utils"),y=i("./ConvertWorker"),c=i("./GenericWorker"),T=i("../base64"),P=i("../support"),R=i("../external"),D=null;if(P.nodestream)try{D=i("../nodejs/NodejsStreamOutputAdapter")}catch{}function A(X,U){return new R.Promise(function(te,F){var $=[],q=X._internalType,ne=X._outputType,se=X._mimeType;X.on("data",function(Ee,ge){$.push(Ee),U&&U(ge)}).on("error",function(Ee){$=[],F(Ee)}).on("end",function(){try{var Ee=function(ge,Oe,Fe){switch(ge){case"blob":return g.newBlob(g.transformTo("arraybuffer",Oe),Fe);case"base64":return T.encode(Oe);default:return g.transformTo(ge,Oe)}}(ne,function(ge,Oe){var Fe,Ge=0,it=null,ve=0;for(Fe=0;Fe"u")d.blob=!1;else{var g=new ArrayBuffer(0);try{d.blob=new Blob([g],{type:"application/zip"}).size===0}catch{try{var y=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);y.append(g),d.blob=y.getBlob("application/zip").size===0}catch{d.blob=!1}}}try{d.nodestream=!!i("readable-stream").Readable}catch{d.nodestream=!1}},{"readable-stream":16}],31:[function(i,u,d){for(var g=i("./utils"),y=i("./support"),c=i("./nodejsUtils"),T=i("./stream/GenericWorker"),P=new Array(256),R=0;R<256;R++)P[R]=252<=R?6:248<=R?5:240<=R?4:224<=R?3:192<=R?2:1;P[254]=P[254]=1;function D(){T.call(this,"utf-8 decode"),this.leftOver=null}function A(){T.call(this,"utf-8 encode")}d.utf8encode=function(N){return y.nodebuffer?c.newBufferFrom(N,"utf-8"):function(X){var U,te,F,$,q,ne=X.length,se=0;for($=0;$>>6:(te<65536?U[q++]=224|te>>>12:(U[q++]=240|te>>>18,U[q++]=128|te>>>12&63),U[q++]=128|te>>>6&63),U[q++]=128|63&te);return U}(N)},d.utf8decode=function(N){return y.nodebuffer?g.transformTo("nodebuffer",N).toString("utf-8"):function(X){var U,te,F,$,q=X.length,ne=new Array(2*q);for(U=te=0;U>10&1023,ne[te++]=56320|1023&F)}return ne.length!==te&&(ne.subarray?ne=ne.subarray(0,te):ne.length=te),g.applyFromCharCode(ne)}(N=g.transformTo(y.uint8array?"uint8array":"array",N))},g.inherits(D,T),D.prototype.processChunk=function(N){var X=g.transformTo(y.uint8array?"uint8array":"array",N.data);if(this.leftOver&&this.leftOver.length){if(y.uint8array){var U=X;(X=new Uint8Array(U.length+this.leftOver.length)).set(this.leftOver,0),X.set(U,this.leftOver.length)}else X=this.leftOver.concat(X);this.leftOver=null}var te=function($,q){var ne;for((q=q||$.length)>$.length&&(q=$.length),ne=q-1;0<=ne&&(192&$[ne])==128;)ne--;return ne<0||ne===0?q:ne+P[$[ne]]>q?ne:q}(X),F=X;te!==X.length&&(y.uint8array?(F=X.subarray(0,te),this.leftOver=X.subarray(te,X.length)):(F=X.slice(0,te),this.leftOver=X.slice(te,X.length))),this.push({data:d.utf8decode(F),meta:N.meta})},D.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:d.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},d.Utf8DecodeWorker=D,g.inherits(A,T),A.prototype.processChunk=function(N){this.push({data:d.utf8encode(N.data),meta:N.meta})},d.Utf8EncodeWorker=A},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(i,u,d){var g=i("./support"),y=i("./base64"),c=i("./nodejsUtils"),T=i("./external");function P(U){return U}function R(U,te){for(var F=0;F>8;this.dir=!!(16&this.externalFileAttributes),N==0&&(this.dosPermissions=63&this.externalFileAttributes),N==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var N=g(this.extraFields[1].value);this.uncompressedSize===y.MAX_VALUE_32BITS&&(this.uncompressedSize=N.readInt(8)),this.compressedSize===y.MAX_VALUE_32BITS&&(this.compressedSize=N.readInt(8)),this.localHeaderOffset===y.MAX_VALUE_32BITS&&(this.localHeaderOffset=N.readInt(8)),this.diskNumberStart===y.MAX_VALUE_32BITS&&(this.diskNumberStart=N.readInt(4))}},readExtraFields:function(N){var X,U,te,F=N.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});N.index+4>>6:(N<65536?A[te++]=224|N>>>12:(A[te++]=240|N>>>18,A[te++]=128|N>>>12&63),A[te++]=128|N>>>6&63),A[te++]=128|63&N);return A},d.buf2binstring=function(D){return R(D,D.length)},d.binstring2buf=function(D){for(var A=new g.Buf8(D.length),N=0,X=A.length;N>10&1023,$[X++]=56320|1023&U)}return R($,X)},d.utf8border=function(D,A){var N;for((A=A||D.length)>D.length&&(A=D.length),N=A-1;0<=N&&(192&D[N])==128;)N--;return N<0||N===0?A:N+T[D[N]]>A?N:A}},{"./common":41}],43:[function(i,u,d){u.exports=function(g,y,c,T){for(var P=65535&g|0,R=g>>>16&65535|0,D=0;c!==0;){for(c-=D=2e3>>1:y>>>1;c[T]=y}return c}();u.exports=function(y,c,T,P){var R=g,D=P+T;y^=-1;for(var A=P;A>>8^R[255&(y^c[A])];return-1^y}},{}],46:[function(i,u,d){var g,y=i("../utils/common"),c=i("./trees"),T=i("./adler32"),P=i("./crc32"),R=i("./messages"),D=0,A=4,N=0,X=-2,U=-1,te=4,F=2,$=8,q=9,ne=286,se=30,Ee=19,ge=2*ne+1,Oe=15,Fe=3,Ge=258,it=Ge+Fe+1,ve=42,je=113,H=1,Re=2,_t=3,ye=4;function Be(V,Ue){return V.msg=R[Ue],Ue}function Le(V){return(V<<1)-(4V.avail_out&&(ie=V.avail_out),ie!==0&&(y.arraySet(V.output,Ue.pending_buf,Ue.pending_out,ie,V.next_out),V.next_out+=ie,Ue.pending_out+=ie,V.total_out+=ie,V.avail_out-=ie,Ue.pending-=ie,Ue.pending===0&&(Ue.pending_out=0))}function Te(V,Ue){c._tr_flush_block(V,0<=V.block_start?V.block_start:-1,V.strstart-V.block_start,Ue),V.block_start=V.strstart,xe(V.strm)}function ft(V,Ue){V.pending_buf[V.pending++]=Ue}function nt(V,Ue){V.pending_buf[V.pending++]=Ue>>>8&255,V.pending_buf[V.pending++]=255&Ue}function rt(V,Ue){var ie,de,oe=V.max_chain_length,ke=V.strstart,Ze=V.prev_length,tt=V.nice_match,Ne=V.strstart>V.w_size-it?V.strstart-(V.w_size-it):0,st=V.window,St=V.w_mask,at=V.prev,Lt=V.strstart+Ge,vr=st[ke+Ze-1],We=st[ke+Ze];V.prev_length>=V.good_match&&(oe>>=2),tt>V.lookahead&&(tt=V.lookahead);do if(st[(ie=Ue)+Ze]===We&&st[ie+Ze-1]===vr&&st[ie]===st[ke]&&st[++ie]===st[ke+1]){ke+=2,ie++;do;while(st[++ke]===st[++ie]&&st[++ke]===st[++ie]&&st[++ke]===st[++ie]&&st[++ke]===st[++ie]&&st[++ke]===st[++ie]&&st[++ke]===st[++ie]&&st[++ke]===st[++ie]&&st[++ke]===st[++ie]&&keNe&&--oe!=0);return Ze<=V.lookahead?Ze:V.lookahead}function qt(V){var Ue,ie,de,oe,ke,Ze,tt,Ne,st,St,at=V.w_size;do{if(oe=V.window_size-V.lookahead-V.strstart,V.strstart>=at+(at-it)){for(y.arraySet(V.window,V.window,at,at,0),V.match_start-=at,V.strstart-=at,V.block_start-=at,Ue=ie=V.hash_size;de=V.head[--Ue],V.head[Ue]=at<=de?de-at:0,--ie;);for(Ue=ie=at;de=V.prev[--Ue],V.prev[Ue]=at<=de?de-at:0,--ie;);oe+=at}if(V.strm.avail_in===0)break;if(Ze=V.strm,tt=V.window,Ne=V.strstart+V.lookahead,st=oe,St=void 0,St=Ze.avail_in,st=Fe)for(ke=V.strstart-V.insert,V.ins_h=V.window[ke],V.ins_h=(V.ins_h<=Fe&&(V.ins_h=(V.ins_h<=Fe)if(de=c._tr_tally(V,V.strstart-V.match_start,V.match_length-Fe),V.lookahead-=V.match_length,V.match_length<=V.max_lazy_match&&V.lookahead>=Fe){for(V.match_length--;V.strstart++,V.ins_h=(V.ins_h<=Fe&&(V.ins_h=(V.ins_h<=Fe&&V.match_length<=V.prev_length){for(oe=V.strstart+V.lookahead-Fe,de=c._tr_tally(V,V.strstart-1-V.prev_match,V.prev_length-Fe),V.lookahead-=V.prev_length-1,V.prev_length-=2;++V.strstart<=oe&&(V.ins_h=(V.ins_h<V.pending_buf_size-5&&(ie=V.pending_buf_size-5);;){if(V.lookahead<=1){if(qt(V),V.lookahead===0&&Ue===D)return H;if(V.lookahead===0)break}V.strstart+=V.lookahead,V.lookahead=0;var de=V.block_start+ie;if((V.strstart===0||V.strstart>=de)&&(V.lookahead=V.strstart-de,V.strstart=de,Te(V,!1),V.strm.avail_out===0)||V.strstart-V.block_start>=V.w_size-it&&(Te(V,!1),V.strm.avail_out===0))return H}return V.insert=0,Ue===A?(Te(V,!0),V.strm.avail_out===0?_t:ye):(V.strstart>V.block_start&&(Te(V,!1),V.strm.avail_out),H)}),new Gt(4,4,8,4,Kt),new Gt(4,5,16,8,Kt),new Gt(4,6,32,32,Kt),new Gt(4,4,16,16,$t),new Gt(8,16,32,32,$t),new Gt(8,16,128,128,$t),new Gt(8,32,128,256,$t),new Gt(32,128,258,1024,$t),new Gt(32,258,258,4096,$t)],d.deflateInit=function(V,Ue){return $r(V,Ue,$,15,8,0)},d.deflateInit2=$r,d.deflateReset=gr,d.deflateResetKeep=lr,d.deflateSetHeader=function(V,Ue){return V&&V.state?V.state.wrap!==2?X:(V.state.gzhead=Ue,N):X},d.deflate=function(V,Ue){var ie,de,oe,ke;if(!V||!V.state||5>8&255),ft(de,de.gzhead.time>>16&255),ft(de,de.gzhead.time>>24&255),ft(de,de.level===9?2:2<=de.strategy||de.level<2?4:0),ft(de,255&de.gzhead.os),de.gzhead.extra&&de.gzhead.extra.length&&(ft(de,255&de.gzhead.extra.length),ft(de,de.gzhead.extra.length>>8&255)),de.gzhead.hcrc&&(V.adler=P(V.adler,de.pending_buf,de.pending,0)),de.gzindex=0,de.status=69):(ft(de,0),ft(de,0),ft(de,0),ft(de,0),ft(de,0),ft(de,de.level===9?2:2<=de.strategy||de.level<2?4:0),ft(de,3),de.status=je);else{var Ze=$+(de.w_bits-8<<4)<<8;Ze|=(2<=de.strategy||de.level<2?0:de.level<6?1:de.level===6?2:3)<<6,de.strstart!==0&&(Ze|=32),Ze+=31-Ze%31,de.status=je,nt(de,Ze),de.strstart!==0&&(nt(de,V.adler>>>16),nt(de,65535&V.adler)),V.adler=1}if(de.status===69)if(de.gzhead.extra){for(oe=de.pending;de.gzindex<(65535&de.gzhead.extra.length)&&(de.pending!==de.pending_buf_size||(de.gzhead.hcrc&&de.pending>oe&&(V.adler=P(V.adler,de.pending_buf,de.pending-oe,oe)),xe(V),oe=de.pending,de.pending!==de.pending_buf_size));)ft(de,255&de.gzhead.extra[de.gzindex]),de.gzindex++;de.gzhead.hcrc&&de.pending>oe&&(V.adler=P(V.adler,de.pending_buf,de.pending-oe,oe)),de.gzindex===de.gzhead.extra.length&&(de.gzindex=0,de.status=73)}else de.status=73;if(de.status===73)if(de.gzhead.name){oe=de.pending;do{if(de.pending===de.pending_buf_size&&(de.gzhead.hcrc&&de.pending>oe&&(V.adler=P(V.adler,de.pending_buf,de.pending-oe,oe)),xe(V),oe=de.pending,de.pending===de.pending_buf_size)){ke=1;break}ke=de.gzindexoe&&(V.adler=P(V.adler,de.pending_buf,de.pending-oe,oe)),ke===0&&(de.gzindex=0,de.status=91)}else de.status=91;if(de.status===91)if(de.gzhead.comment){oe=de.pending;do{if(de.pending===de.pending_buf_size&&(de.gzhead.hcrc&&de.pending>oe&&(V.adler=P(V.adler,de.pending_buf,de.pending-oe,oe)),xe(V),oe=de.pending,de.pending===de.pending_buf_size)){ke=1;break}ke=de.gzindexoe&&(V.adler=P(V.adler,de.pending_buf,de.pending-oe,oe)),ke===0&&(de.status=103)}else de.status=103;if(de.status===103&&(de.gzhead.hcrc?(de.pending+2>de.pending_buf_size&&xe(V),de.pending+2<=de.pending_buf_size&&(ft(de,255&V.adler),ft(de,V.adler>>8&255),V.adler=0,de.status=je)):de.status=je),de.pending!==0){if(xe(V),V.avail_out===0)return de.last_flush=-1,N}else if(V.avail_in===0&&Le(Ue)<=Le(ie)&&Ue!==A)return Be(V,-5);if(de.status===666&&V.avail_in!==0)return Be(V,-5);if(V.avail_in!==0||de.lookahead!==0||Ue!==D&&de.status!==666){var tt=de.strategy===2?function(Ne,st){for(var St;;){if(Ne.lookahead===0&&(qt(Ne),Ne.lookahead===0)){if(st===D)return H;break}if(Ne.match_length=0,St=c._tr_tally(Ne,0,Ne.window[Ne.strstart]),Ne.lookahead--,Ne.strstart++,St&&(Te(Ne,!1),Ne.strm.avail_out===0))return H}return Ne.insert=0,st===A?(Te(Ne,!0),Ne.strm.avail_out===0?_t:ye):Ne.last_lit&&(Te(Ne,!1),Ne.strm.avail_out===0)?H:Re}(de,Ue):de.strategy===3?function(Ne,st){for(var St,at,Lt,vr,We=Ne.window;;){if(Ne.lookahead<=Ge){if(qt(Ne),Ne.lookahead<=Ge&&st===D)return H;if(Ne.lookahead===0)break}if(Ne.match_length=0,Ne.lookahead>=Fe&&0Ne.lookahead&&(Ne.match_length=Ne.lookahead)}if(Ne.match_length>=Fe?(St=c._tr_tally(Ne,1,Ne.match_length-Fe),Ne.lookahead-=Ne.match_length,Ne.strstart+=Ne.match_length,Ne.match_length=0):(St=c._tr_tally(Ne,0,Ne.window[Ne.strstart]),Ne.lookahead--,Ne.strstart++),St&&(Te(Ne,!1),Ne.strm.avail_out===0))return H}return Ne.insert=0,st===A?(Te(Ne,!0),Ne.strm.avail_out===0?_t:ye):Ne.last_lit&&(Te(Ne,!1),Ne.strm.avail_out===0)?H:Re}(de,Ue):g[de.level].func(de,Ue);if(tt!==_t&&tt!==ye||(de.status=666),tt===H||tt===_t)return V.avail_out===0&&(de.last_flush=-1),N;if(tt===Re&&(Ue===1?c._tr_align(de):Ue!==5&&(c._tr_stored_block(de,0,0,!1),Ue===3&&(Ye(de.head),de.lookahead===0&&(de.strstart=0,de.block_start=0,de.insert=0))),xe(V),V.avail_out===0))return de.last_flush=-1,N}return Ue!==A?N:de.wrap<=0?1:(de.wrap===2?(ft(de,255&V.adler),ft(de,V.adler>>8&255),ft(de,V.adler>>16&255),ft(de,V.adler>>24&255),ft(de,255&V.total_in),ft(de,V.total_in>>8&255),ft(de,V.total_in>>16&255),ft(de,V.total_in>>24&255)):(nt(de,V.adler>>>16),nt(de,65535&V.adler)),xe(V),0=ie.w_size&&(ke===0&&(Ye(ie.head),ie.strstart=0,ie.block_start=0,ie.insert=0),st=new y.Buf8(ie.w_size),y.arraySet(st,Ue,St-ie.w_size,ie.w_size,0),Ue=st,St=ie.w_size),Ze=V.avail_in,tt=V.next_in,Ne=V.input,V.avail_in=St,V.next_in=0,V.input=Ue,qt(ie);ie.lookahead>=Fe;){for(de=ie.strstart,oe=ie.lookahead-(Fe-1);ie.ins_h=(ie.ins_h<>>=Fe=Oe>>>24,q-=Fe,(Fe=Oe>>>16&255)===0)Re[R++]=65535&Oe;else{if(!(16&Fe)){if(!(64&Fe)){Oe=ne[(65535&Oe)+($&(1<>>=Fe,q-=Fe),q<15&&($+=H[T++]<>>=Fe=Oe>>>24,q-=Fe,!(16&(Fe=Oe>>>16&255))){if(!(64&Fe)){Oe=se[(65535&Oe)+($&(1<>>=Fe,q-=Fe,(Fe=R-D)>3,$&=(1<<(q-=Ge<<3))-1,g.next_in=T,g.next_out=R,g.avail_in=T>>24&255)+(ve>>>8&65280)+((65280&ve)<<8)+((255&ve)<<24)}function $(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new g.Buf16(320),this.work=new g.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function q(ve){var je;return ve&&ve.state?(je=ve.state,ve.total_in=ve.total_out=je.total=0,ve.msg="",je.wrap&&(ve.adler=1&je.wrap),je.mode=X,je.last=0,je.havedict=0,je.dmax=32768,je.head=null,je.hold=0,je.bits=0,je.lencode=je.lendyn=new g.Buf32(U),je.distcode=je.distdyn=new g.Buf32(te),je.sane=1,je.back=-1,A):N}function ne(ve){var je;return ve&&ve.state?((je=ve.state).wsize=0,je.whave=0,je.wnext=0,q(ve)):N}function se(ve,je){var H,Re;return ve&&ve.state?(Re=ve.state,je<0?(H=0,je=-je):(H=1+(je>>4),je<48&&(je&=15)),je&&(je<8||15=ye.wsize?(g.arraySet(ye.window,je,H-ye.wsize,ye.wsize,0),ye.wnext=0,ye.whave=ye.wsize):(Re<(_t=ye.wsize-ye.wnext)&&(_t=Re),g.arraySet(ye.window,je,H-Re,_t,ye.wnext),(Re-=_t)?(g.arraySet(ye.window,je,H-Re,Re,0),ye.wnext=Re,ye.whave=ye.wsize):(ye.wnext+=_t,ye.wnext===ye.wsize&&(ye.wnext=0),ye.whave>>8&255,H.check=c(H.check,ke,2,0),Te=xe=0,H.mode=2;break}if(H.flags=0,H.head&&(H.head.done=!1),!(1&H.wrap)||(((255&xe)<<8)+(xe>>8))%31){ve.msg="incorrect header check",H.mode=30;break}if((15&xe)!=8){ve.msg="unknown compression method",H.mode=30;break}if(Te-=4,V=8+(15&(xe>>>=4)),H.wbits===0)H.wbits=V;else if(V>H.wbits){ve.msg="invalid window size",H.mode=30;break}H.dmax=1<>8&1),512&H.flags&&(ke[0]=255&xe,ke[1]=xe>>>8&255,H.check=c(H.check,ke,2,0)),Te=xe=0,H.mode=3;case 3:for(;Te<32;){if(Le===0)break e;Le--,xe+=Re[ye++]<>>8&255,ke[2]=xe>>>16&255,ke[3]=xe>>>24&255,H.check=c(H.check,ke,4,0)),Te=xe=0,H.mode=4;case 4:for(;Te<16;){if(Le===0)break e;Le--,xe+=Re[ye++]<>8),512&H.flags&&(ke[0]=255&xe,ke[1]=xe>>>8&255,H.check=c(H.check,ke,2,0)),Te=xe=0,H.mode=5;case 5:if(1024&H.flags){for(;Te<16;){if(Le===0)break e;Le--,xe+=Re[ye++]<>>8&255,H.check=c(H.check,ke,2,0)),Te=xe=0}else H.head&&(H.head.extra=null);H.mode=6;case 6:if(1024&H.flags&&(Le<(rt=H.length)&&(rt=Le),rt&&(H.head&&(V=H.head.extra_len-H.length,H.head.extra||(H.head.extra=new Array(H.head.extra_len)),g.arraySet(H.head.extra,Re,ye,rt,V)),512&H.flags&&(H.check=c(H.check,Re,rt,ye)),Le-=rt,ye+=rt,H.length-=rt),H.length))break e;H.length=0,H.mode=7;case 7:if(2048&H.flags){if(Le===0)break e;for(rt=0;V=Re[ye+rt++],H.head&&V&&H.length<65536&&(H.head.name+=String.fromCharCode(V)),V&&rt>9&1,H.head.done=!0),ve.adler=H.check=0,H.mode=12;break;case 10:for(;Te<32;){if(Le===0)break e;Le--,xe+=Re[ye++]<>>=7&Te,Te-=7&Te,H.mode=27;break}for(;Te<3;){if(Le===0)break e;Le--,xe+=Re[ye++]<>>=1)){case 0:H.mode=14;break;case 1:if(Ge(H),H.mode=20,je!==6)break;xe>>>=2,Te-=2;break e;case 2:H.mode=17;break;case 3:ve.msg="invalid block type",H.mode=30}xe>>>=2,Te-=2;break;case 14:for(xe>>>=7&Te,Te-=7&Te;Te<32;){if(Le===0)break e;Le--,xe+=Re[ye++]<>>16^65535)){ve.msg="invalid stored block lengths",H.mode=30;break}if(H.length=65535&xe,Te=xe=0,H.mode=15,je===6)break e;case 15:H.mode=16;case 16:if(rt=H.length){if(Le>>=5,Te-=5,H.ndist=1+(31&xe),xe>>>=5,Te-=5,H.ncode=4+(15&xe),xe>>>=4,Te-=4,286>>=3,Te-=3}for(;H.have<19;)H.lens[Ze[H.have++]]=0;if(H.lencode=H.lendyn,H.lenbits=7,ie={bits:H.lenbits},Ue=P(0,H.lens,0,19,H.lencode,0,H.work,ie),H.lenbits=ie.bits,Ue){ve.msg="invalid code lengths set",H.mode=30;break}H.have=0,H.mode=19;case 19:for(;H.have>>16&255,pr=65535&oe,!(($t=oe>>>24)<=Te);){if(Le===0)break e;Le--,xe+=Re[ye++]<>>=$t,Te-=$t,H.lens[H.have++]=pr;else{if(pr===16){for(de=$t+2;Te>>=$t,Te-=$t,H.have===0){ve.msg="invalid bit length repeat",H.mode=30;break}V=H.lens[H.have-1],rt=3+(3&xe),xe>>>=2,Te-=2}else if(pr===17){for(de=$t+3;Te>>=$t)),xe>>>=3,Te-=3}else{for(de=$t+7;Te>>=$t)),xe>>>=7,Te-=7}if(H.have+rt>H.nlen+H.ndist){ve.msg="invalid bit length repeat",H.mode=30;break}for(;rt--;)H.lens[H.have++]=V}}if(H.mode===30)break;if(H.lens[256]===0){ve.msg="invalid code -- missing end-of-block",H.mode=30;break}if(H.lenbits=9,ie={bits:H.lenbits},Ue=P(R,H.lens,0,H.nlen,H.lencode,0,H.work,ie),H.lenbits=ie.bits,Ue){ve.msg="invalid literal/lengths set",H.mode=30;break}if(H.distbits=6,H.distcode=H.distdyn,ie={bits:H.distbits},Ue=P(D,H.lens,H.nlen,H.ndist,H.distcode,0,H.work,ie),H.distbits=ie.bits,Ue){ve.msg="invalid distances set",H.mode=30;break}if(H.mode=20,je===6)break e;case 20:H.mode=21;case 21:if(6<=Le&&258<=Ye){ve.next_out=Be,ve.avail_out=Ye,ve.next_in=ye,ve.avail_in=Le,H.hold=xe,H.bits=Te,T(ve,nt),Be=ve.next_out,_t=ve.output,Ye=ve.avail_out,ye=ve.next_in,Re=ve.input,Le=ve.avail_in,xe=H.hold,Te=H.bits,H.mode===12&&(H.back=-1);break}for(H.back=0;Gt=(oe=H.lencode[xe&(1<>>16&255,pr=65535&oe,!(($t=oe>>>24)<=Te);){if(Le===0)break e;Le--,xe+=Re[ye++]<>lr)])>>>16&255,pr=65535&oe,!(lr+($t=oe>>>24)<=Te);){if(Le===0)break e;Le--,xe+=Re[ye++]<>>=lr,Te-=lr,H.back+=lr}if(xe>>>=$t,Te-=$t,H.back+=$t,H.length=pr,Gt===0){H.mode=26;break}if(32&Gt){H.back=-1,H.mode=12;break}if(64&Gt){ve.msg="invalid literal/length code",H.mode=30;break}H.extra=15&Gt,H.mode=22;case 22:if(H.extra){for(de=H.extra;Te>>=H.extra,Te-=H.extra,H.back+=H.extra}H.was=H.length,H.mode=23;case 23:for(;Gt=(oe=H.distcode[xe&(1<>>16&255,pr=65535&oe,!(($t=oe>>>24)<=Te);){if(Le===0)break e;Le--,xe+=Re[ye++]<>lr)])>>>16&255,pr=65535&oe,!(lr+($t=oe>>>24)<=Te);){if(Le===0)break e;Le--,xe+=Re[ye++]<>>=lr,Te-=lr,H.back+=lr}if(xe>>>=$t,Te-=$t,H.back+=$t,64&Gt){ve.msg="invalid distance code",H.mode=30;break}H.offset=pr,H.extra=15&Gt,H.mode=24;case 24:if(H.extra){for(de=H.extra;Te>>=H.extra,Te-=H.extra,H.back+=H.extra}if(H.offset>H.dmax){ve.msg="invalid distance too far back",H.mode=30;break}H.mode=25;case 25:if(Ye===0)break e;if(rt=nt-Ye,H.offset>rt){if((rt=H.offset-rt)>H.whave&&H.sane){ve.msg="invalid distance too far back",H.mode=30;break}qt=rt>H.wnext?(rt-=H.wnext,H.wsize-rt):H.wnext-rt,rt>H.length&&(rt=H.length),Kt=H.window}else Kt=_t,qt=Be-H.offset,rt=H.length;for(Yege?(Fe=qt[Kt+te[je]],Te[ft+te[je]]):(Fe=96,0),$=1<>Be)+(q-=$)]=Oe<<24|Fe<<16|Ge|0,q!==0;);for($=1<>=1;if($!==0?(xe&=$-1,xe+=$):xe=0,je++,--nt[ve]==0){if(ve===Re)break;ve=D[A+te[je]]}if(_t>>7)]}function ft(oe,ke){oe.pending_buf[oe.pending++]=255&ke,oe.pending_buf[oe.pending++]=ke>>>8&255}function nt(oe,ke,Ze){oe.bi_valid>F-Ze?(oe.bi_buf|=ke<>F-oe.bi_valid,oe.bi_valid+=Ze-F):(oe.bi_buf|=ke<>>=1,Ze<<=1,0<--ke;);return Ze>>>1}function Kt(oe,ke,Ze){var tt,Ne,st=new Array(te+1),St=0;for(tt=1;tt<=te;tt++)st[tt]=St=St+Ze[tt-1]<<1;for(Ne=0;Ne<=ke;Ne++){var at=oe[2*Ne+1];at!==0&&(oe[2*Ne]=qt(st[at]++,at))}}function $t(oe){var ke;for(ke=0;ke>1;1<=Ze;Ze--)lr(oe,st,Ze);for(Ne=Lt;Ze=oe.heap[1],oe.heap[1]=oe.heap[oe.heap_len--],lr(oe,st,1),tt=oe.heap[1],oe.heap[--oe.heap_max]=Ze,oe.heap[--oe.heap_max]=tt,st[2*Ne]=st[2*Ze]+st[2*tt],oe.depth[Ne]=(oe.depth[Ze]>=oe.depth[tt]?oe.depth[Ze]:oe.depth[tt])+1,st[2*Ze+1]=st[2*tt+1]=Ne,oe.heap[1]=Ne++,lr(oe,st,1),2<=oe.heap_len;);oe.heap[--oe.heap_max]=oe.heap[1],function(We,Gr){var on,sn,Qn,Qe,Wt,Bt,jr=Gr.dyn_tree,ei=Gr.max_code,Zt=Gr.stat_desc.static_tree,Di=Gr.stat_desc.has_stree,Ki=Gr.stat_desc.extra_bits,Yi=Gr.stat_desc.extra_base,Pn=Gr.stat_desc.max_length,he=0;for(Qe=0;Qe<=te;Qe++)We.bl_count[Qe]=0;for(jr[2*We.heap[We.heap_max]+1]=0,on=We.heap_max+1;on>=7;Ne>>=1)if(1&vr&&at.dyn_ltree[2*Lt]!==0)return y;if(at.dyn_ltree[18]!==0||at.dyn_ltree[20]!==0||at.dyn_ltree[26]!==0)return c;for(Lt=32;Lt>>3,(st=oe.static_len+3+7>>>3)<=Ne&&(Ne=st)):Ne=st=Ze+5,Ze+4<=Ne&&ke!==-1?de(oe,ke,Ze,tt):oe.strategy===4||st===Ne?(nt(oe,2+(tt?1:0),3),gr(oe,it,ve)):(nt(oe,4+(tt?1:0),3),function(at,Lt,vr,We){var Gr;for(nt(at,Lt-257,5),nt(at,vr-1,5),nt(at,We-4,4),Gr=0;Gr>>8&255,oe.pending_buf[oe.d_buf+2*oe.last_lit+1]=255&ke,oe.pending_buf[oe.l_buf+oe.last_lit]=255&Ze,oe.last_lit++,ke===0?oe.dyn_ltree[2*Ze]++:(oe.matches++,ke--,oe.dyn_ltree[2*(H[Ze]+D+1)]++,oe.dyn_dtree[2*Te(ke)]++),oe.last_lit===oe.lit_bufsize-1},d._tr_align=function(oe){nt(oe,2,3),rt(oe,q,it),function(ke){ke.bi_valid===16?(ft(ke,ke.bi_buf),ke.bi_buf=0,ke.bi_valid=0):8<=ke.bi_valid&&(ke.pending_buf[ke.pending++]=255&ke.bi_buf,ke.bi_buf>>=8,ke.bi_valid-=8)}(oe)}},{"../utils/common":41}],53:[function(i,u,d){u.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(i,u,d){(function(g){(function(y,c){if(!y.setImmediate){var T,P,R,D,A=1,N={},X=!1,U=y.document,te=Object.getPrototypeOf&&Object.getPrototypeOf(y);te=te&&te.setTimeout?te:y,T={}.toString.call(y.process)==="[object process]"?function(ne){process.nextTick(function(){$(ne)})}:function(){if(y.postMessage&&!y.importScripts){var ne=!0,se=y.onmessage;return y.onmessage=function(){ne=!1},y.postMessage("","*"),y.onmessage=se,ne}}()?(D="setImmediate$"+Math.random()+"$",y.addEventListener?y.addEventListener("message",q,!1):y.attachEvent("onmessage",q),function(ne){y.postMessage(D+ne,"*")}):y.MessageChannel?((R=new MessageChannel).port1.onmessage=function(ne){$(ne.data)},function(ne){R.port2.postMessage(ne)}):U&&"onreadystatechange"in U.createElement("script")?(P=U.documentElement,function(ne){var se=U.createElement("script");se.onreadystatechange=function(){$(ne),se.onreadystatechange=null,P.removeChild(se),se=null},P.appendChild(se)}):function(ne){setTimeout($,0,ne)},te.setImmediate=function(ne){typeof ne!="function"&&(ne=new Function(""+ne));for(var se=new Array(arguments.length-1),Ee=0;Ee"u"?g===void 0?this:g:self)}).call(this,typeof cd<"u"?cd:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(mT);var Vz=mT.exports;const Hz=ip(Vz);var nv=function(e,t){return nv=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,u){i.__proto__=u}||function(i,u){for(var d in u)Object.prototype.hasOwnProperty.call(u,d)&&(i[d]=u[d])},nv(e,t)};function No(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");nv(e,t);function i(){this.constructor=e}e.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}var Rt=function(){return Rt=Object.assign||function(t){for(var i,u=1,d=arguments.length;u"u"&&(g=e.call(this,u),t.set(d,g)),g}function yT(e,t,i){var u=Array.prototype.slice.call(arguments,3),d=i(u),g=t.get(d);return typeof g>"u"&&(g=e.apply(this,u),t.set(d,g)),g}function P1(e,t,i,u,d){return i.bind(t,e,u,d)}function Zz(e,t){var i=e.length===1?gT:yT;return P1(e,this,i,t.cache.create(),t.serializer)}function Wz(e,t){return P1(e,this,yT,t.cache.create(),t.serializer)}function qz(e,t){return P1(e,this,gT,t.cache.create(),t.serializer)}var Xz=function(){return JSON.stringify(arguments)};function A1(){this.cache=Object.create(null)}A1.prototype.get=function(e){return this.cache[e]};A1.prototype.set=function(e,t){this.cache[e]=t};var Kz={create:function(){return new A1}},ki={variadic:Wz,monadic:qz};function _T(e,t,i){if(i===void 0&&(i=Error),!e)throw new i(t)}Ei(function(){for(var e,t=[],i=0;i0}),i=[],u=0,d=t;u1)throw new RangeError("integer-width stems only accept a single optional option");d.options[0].replace(iD,function(T,P,R,D,A,N){if(P)t.minimumIntegerDigits=R.length;else{if(D&&A)throw new Error("We currently do not support maximum integer digits");if(N)throw new Error("We currently do not support exact integer digits")}return""});continue}if(IT.test(d.stem)){t.minimumIntegerDigits=d.stem.length;continue}if(g2.test(d.stem)){if(d.options.length>1)throw new RangeError("Fraction-precision stems only accept a single optional option");d.stem.replace(g2,function(T,P,R,D,A,N){return R==="*"?t.minimumFractionDigits=P.length:D&&D[0]==="#"?t.maximumFractionDigits=D.length:A&&N?(t.minimumFractionDigits=A.length,t.maximumFractionDigits=A.length+N.length):(t.minimumFractionDigits=P.length,t.maximumFractionDigits=P.length),""});var g=d.options[0];g==="w"?t=Rt(Rt({},t),{trailingZeroDisplay:"stripIfInteger"}):g&&(t=Rt(Rt({},t),y2(g)));continue}if(CT.test(d.stem)){t=Rt(Rt({},t),y2(d.stem));continue}var y=PT(d.stem);y&&(t=Rt(Rt({},t),y));var c=oD(d.stem);c&&(t=Rt(Rt({},t),c))}return t}var jf={"001":["H","h"],419:["h","H","hB","hb"],AC:["H","h","hb","hB"],AD:["H","hB"],AE:["h","hB","hb","H"],AF:["H","hb","hB","h"],AG:["h","hb","H","hB"],AI:["H","h","hb","hB"],AL:["h","H","hB"],AM:["H","hB"],AO:["H","hB"],AR:["h","H","hB","hb"],AS:["h","H"],AT:["H","hB"],AU:["h","hb","H","hB"],AW:["H","hB"],AX:["H"],AZ:["H","hB","h"],BA:["H","hB","h"],BB:["h","hb","H","hB"],BD:["h","hB","H"],BE:["H","hB"],BF:["H","hB"],BG:["H","hB","h"],BH:["h","hB","hb","H"],BI:["H","h"],BJ:["H","hB"],BL:["H","hB"],BM:["h","hb","H","hB"],BN:["hb","hB","h","H"],BO:["h","H","hB","hb"],BQ:["H"],BR:["H","hB"],BS:["h","hb","H","hB"],BT:["h","H"],BW:["H","h","hb","hB"],BY:["H","h"],BZ:["H","h","hb","hB"],CA:["h","hb","H","hB"],CC:["H","h","hb","hB"],CD:["hB","H"],CF:["H","h","hB"],CG:["H","hB"],CH:["H","hB","h"],CI:["H","hB"],CK:["H","h","hb","hB"],CL:["h","H","hB","hb"],CM:["H","h","hB"],CN:["H","hB","hb","h"],CO:["h","H","hB","hb"],CP:["H"],CR:["h","H","hB","hb"],CU:["h","H","hB","hb"],CV:["H","hB"],CW:["H","hB"],CX:["H","h","hb","hB"],CY:["h","H","hb","hB"],CZ:["H"],DE:["H","hB"],DG:["H","h","hb","hB"],DJ:["h","H"],DK:["H"],DM:["h","hb","H","hB"],DO:["h","H","hB","hb"],DZ:["h","hB","hb","H"],EA:["H","h","hB","hb"],EC:["h","H","hB","hb"],EE:["H","hB"],EG:["h","hB","hb","H"],EH:["h","hB","hb","H"],ER:["h","H"],ES:["H","hB","h","hb"],ET:["hB","hb","h","H"],FI:["H"],FJ:["h","hb","H","hB"],FK:["H","h","hb","hB"],FM:["h","hb","H","hB"],FO:["H","h"],FR:["H","hB"],GA:["H","hB"],GB:["H","h","hb","hB"],GD:["h","hb","H","hB"],GE:["H","hB","h"],GF:["H","hB"],GG:["H","h","hb","hB"],GH:["h","H"],GI:["H","h","hb","hB"],GL:["H","h"],GM:["h","hb","H","hB"],GN:["H","hB"],GP:["H","hB"],GQ:["H","hB","h","hb"],GR:["h","H","hb","hB"],GT:["h","H","hB","hb"],GU:["h","hb","H","hB"],GW:["H","hB"],GY:["h","hb","H","hB"],HK:["h","hB","hb","H"],HN:["h","H","hB","hb"],HR:["H","hB"],HU:["H","h"],IC:["H","h","hB","hb"],ID:["H"],IE:["H","h","hb","hB"],IL:["H","hB"],IM:["H","h","hb","hB"],IN:["h","H"],IO:["H","h","hb","hB"],IQ:["h","hB","hb","H"],IR:["hB","H"],IS:["H"],IT:["H","hB"],JE:["H","h","hb","hB"],JM:["h","hb","H","hB"],JO:["h","hB","hb","H"],JP:["H","K","h"],KE:["hB","hb","H","h"],KG:["H","h","hB","hb"],KH:["hB","h","H","hb"],KI:["h","hb","H","hB"],KM:["H","h","hB","hb"],KN:["h","hb","H","hB"],KP:["h","H","hB","hb"],KR:["h","H","hB","hb"],KW:["h","hB","hb","H"],KY:["h","hb","H","hB"],KZ:["H","hB"],LA:["H","hb","hB","h"],LB:["h","hB","hb","H"],LC:["h","hb","H","hB"],LI:["H","hB","h"],LK:["H","h","hB","hb"],LR:["h","hb","H","hB"],LS:["h","H"],LT:["H","h","hb","hB"],LU:["H","h","hB"],LV:["H","hB","hb","h"],LY:["h","hB","hb","H"],MA:["H","h","hB","hb"],MC:["H","hB"],MD:["H","hB"],ME:["H","hB","h"],MF:["H","hB"],MG:["H","h"],MH:["h","hb","H","hB"],MK:["H","h","hb","hB"],ML:["H"],MM:["hB","hb","H","h"],MN:["H","h","hb","hB"],MO:["h","hB","hb","H"],MP:["h","hb","H","hB"],MQ:["H","hB"],MR:["h","hB","hb","H"],MS:["H","h","hb","hB"],MT:["H","h"],MU:["H","h"],MV:["H","h"],MW:["h","hb","H","hB"],MX:["h","H","hB","hb"],MY:["hb","hB","h","H"],MZ:["H","hB"],NA:["h","H","hB","hb"],NC:["H","hB"],NE:["H"],NF:["H","h","hb","hB"],NG:["H","h","hb","hB"],NI:["h","H","hB","hb"],NL:["H","hB"],NO:["H","h"],NP:["H","h","hB"],NR:["H","h","hb","hB"],NU:["H","h","hb","hB"],NZ:["h","hb","H","hB"],OM:["h","hB","hb","H"],PA:["h","H","hB","hb"],PE:["h","H","hB","hb"],PF:["H","h","hB"],PG:["h","H"],PH:["h","hB","hb","H"],PK:["h","hB","H"],PL:["H","h"],PM:["H","hB"],PN:["H","h","hb","hB"],PR:["h","H","hB","hb"],PS:["h","hB","hb","H"],PT:["H","hB"],PW:["h","H"],PY:["h","H","hB","hb"],QA:["h","hB","hb","H"],RE:["H","hB"],RO:["H","hB"],RS:["H","hB","h"],RU:["H"],RW:["H","h"],SA:["h","hB","hb","H"],SB:["h","hb","H","hB"],SC:["H","h","hB"],SD:["h","hB","hb","H"],SE:["H"],SG:["h","hb","H","hB"],SH:["H","h","hb","hB"],SI:["H","hB"],SJ:["H"],SK:["H"],SL:["h","hb","H","hB"],SM:["H","h","hB"],SN:["H","h","hB"],SO:["h","H"],SR:["H","hB"],SS:["h","hb","H","hB"],ST:["H","hB"],SV:["h","H","hB","hb"],SX:["H","h","hb","hB"],SY:["h","hB","hb","H"],SZ:["h","hb","H","hB"],TA:["H","h","hb","hB"],TC:["h","hb","H","hB"],TD:["h","H","hB"],TF:["H","h","hB"],TG:["H","hB"],TH:["H","h"],TJ:["H","h"],TL:["H","hB","hb","h"],TM:["H","h"],TN:["h","hB","hb","H"],TO:["h","H"],TR:["H","hB"],TT:["h","hb","H","hB"],TW:["hB","hb","h","H"],TZ:["hB","hb","H","h"],UA:["H","hB","h"],UG:["hB","hb","H","h"],UM:["h","hb","H","hB"],US:["h","hb","H","hB"],UY:["h","H","hB","hb"],UZ:["H","hB","h"],VA:["H","h","hB"],VC:["h","hb","H","hB"],VE:["h","H","hB","hb"],VG:["h","hb","H","hB"],VI:["h","hb","H","hB"],VN:["H","h"],VU:["h","H"],WF:["H","hB"],WS:["h","H"],XK:["H","hB","h"],YE:["h","hB","hb","H"],YT:["H","hB"],ZA:["H","h","hb","hB"],ZM:["h","hb","H","hB"],ZW:["H","h"],"af-ZA":["H","h","hB","hb"],"ar-001":["h","hB","hb","H"],"ca-ES":["H","h","hB"],"en-001":["h","hb","H","hB"],"en-HK":["h","hb","H","hB"],"en-IL":["H","h","hb","hB"],"en-MY":["h","hb","H","hB"],"es-BR":["H","h","hB","hb"],"es-ES":["H","h","hB","hb"],"es-GQ":["H","h","hB","hb"],"fr-CA":["H","h","hB"],"gl-ES":["H","h","hB"],"gu-IN":["hB","hb","h","H"],"hi-IN":["hB","h","H"],"it-CH":["H","h","hB"],"it-IT":["H","h","hB"],"kn-IN":["hB","h","H"],"ml-IN":["hB","h","H"],"mr-IN":["hB","hb","h","H"],"pa-IN":["hB","hb","h","H"],"ta-IN":["hB","h","hb","H"],"te-IN":["hB","h","H"],"zu-ZA":["H","hB","hb","h"]};function aD(e,t){for(var i="",u=0;u>1),T="a",P=lD(t);for((P=="H"||P=="k")&&(c=0);c-- >0;)i+=T;for(;y-- >0;)i=P+i}else d==="J"?i+="H":i+=d}return i}function lD(e){var t=e.hourCycle;if(t===void 0&&e.hourCycles&&e.hourCycles.length&&(t=e.hourCycles[0]),t)switch(t){case"h24":return"k";case"h23":return"H";case"h12":return"h";case"h11":return"K";default:throw new Error("Invalid hourCycle")}var i=e.language,u;i!=="root"&&(u=e.maximize().region);var d=jf[u||""]||jf[i||""]||jf["".concat(i,"-001")]||jf["001"];return d[0]}var U_,uD=new RegExp("^".concat(TT.source,"*")),cD=new RegExp("".concat(TT.source,"*$"));function wr(e,t){return{start:e,end:t}}var hD=!!String.prototype.startsWith&&"_a".startsWith("a",1),dD=!!String.fromCodePoint,pD=!!Object.fromEntries,fD=!!String.prototype.codePointAt,mD=!!String.prototype.trimStart,gD=!!String.prototype.trimEnd,yD=!!Number.isSafeInteger,_D=yD?Number.isSafeInteger:function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e&&Math.abs(e)<=9007199254740991},ov=!0;try{var vD=MT("([^\\p{White_Space}\\p{Pattern_Syntax}]*)","yu");ov=((U_=vD.exec("a"))===null||U_===void 0?void 0:U_[0])==="a"}catch{ov=!1}var v2=hD?function(t,i,u){return t.startsWith(i,u)}:function(t,i,u){return t.slice(u,u+i.length)===i},sv=dD?String.fromCodePoint:function(){for(var t=[],i=0;ig;){if(y=t[g++],y>1114111)throw RangeError(y+" is not a valid code point");u+=y<65536?String.fromCharCode(y):String.fromCharCode(((y-=65536)>>10)+55296,y%1024+56320)}return u},x2=pD?Object.fromEntries:function(t){for(var i={},u=0,d=t;u=u)){var d=t.charCodeAt(i),g;return d<55296||d>56319||i+1===u||(g=t.charCodeAt(i+1))<56320||g>57343?d:(d-55296<<10)+(g-56320)+65536}},xD=mD?function(t){return t.trimStart()}:function(t){return t.replace(uD,"")},wD=gD?function(t){return t.trimEnd()}:function(t){return t.replace(cD,"")};function MT(e,t){return new RegExp(e,t)}var av;if(ov){var w2=MT("([^\\p{White_Space}\\p{Pattern_Syntax}]*)","yu");av=function(t,i){var u;w2.lastIndex=i;var d=w2.exec(t);return(u=d[1])!==null&&u!==void 0?u:""}}else av=function(t,i){for(var u=[];;){var d=AT(t,i);if(d===void 0||zT(d)||kD(d))break;u.push(d),i+=d>=65536?2:1}return sv.apply(void 0,u)};var bD=function(){function e(t,i){i===void 0&&(i={}),this.message=t,this.position={offset:0,line:1,column:1},this.ignoreTag=!!i.ignoreTag,this.locale=i.locale,this.requiresOtherClause=!!i.requiresOtherClause,this.shouldParseSkeletons=!!i.shouldParseSkeletons}return e.prototype.parse=function(){if(this.offset()!==0)throw Error("parser can only be used once");return this.parseMessage(0,"",!1)},e.prototype.parseMessage=function(t,i,u){for(var d=[];!this.isEOF();){var g=this.char();if(g===123){var y=this.parseArgument(t,u);if(y.err)return y;d.push(y.val)}else{if(g===125&&t>0)break;if(g===35&&(i==="plural"||i==="selectordinal")){var c=this.clonePosition();this.bump(),d.push({type:Kr.pound,location:wr(c,this.clonePosition())})}else if(g===60&&!this.ignoreTag&&this.peek()===47){if(u)break;return this.error(_r.UNMATCHED_CLOSING_TAG,wr(this.clonePosition(),this.clonePosition()))}else if(g===60&&!this.ignoreTag&&lv(this.peek()||0)){var y=this.parseTag(t,i);if(y.err)return y;d.push(y.val)}else{var y=this.parseLiteral(t,i);if(y.err)return y;d.push(y.val)}}}return{val:d,err:null}},e.prototype.parseTag=function(t,i){var u=this.clonePosition();this.bump();var d=this.parseTagName();if(this.bumpSpace(),this.bumpIf("/>"))return{val:{type:Kr.literal,value:"<".concat(d,"/>"),location:wr(u,this.clonePosition())},err:null};if(this.bumpIf(">")){var g=this.parseMessage(t+1,i,!0);if(g.err)return g;var y=g.val,c=this.clonePosition();if(this.bumpIf("")?{val:{type:Kr.tag,value:d,children:y,location:wr(u,this.clonePosition())},err:null}:this.error(_r.INVALID_TAG,wr(c,this.clonePosition())))}else return this.error(_r.UNCLOSED_TAG,wr(u,this.clonePosition()))}else return this.error(_r.INVALID_TAG,wr(u,this.clonePosition()))},e.prototype.parseTagName=function(){var t=this.offset();for(this.bump();!this.isEOF()&&ED(this.char());)this.bump();return this.message.slice(t,this.offset())},e.prototype.parseLiteral=function(t,i){for(var u=this.clonePosition(),d="";;){var g=this.tryParseQuote(i);if(g){d+=g;continue}var y=this.tryParseUnquoted(t,i);if(y){d+=y;continue}var c=this.tryParseLeftAngleBracket();if(c){d+=c;continue}break}var T=wr(u,this.clonePosition());return{val:{type:Kr.literal,value:d,location:T},err:null}},e.prototype.tryParseLeftAngleBracket=function(){return!this.isEOF()&&this.char()===60&&(this.ignoreTag||!SD(this.peek()||0))?(this.bump(),"<"):null},e.prototype.tryParseQuote=function(t){if(this.isEOF()||this.char()!==39)return null;switch(this.peek()){case 39:return this.bump(),this.bump(),"'";case 123:case 60:case 62:case 125:break;case 35:if(t==="plural"||t==="selectordinal")break;return null;default:return null}this.bump();var i=[this.char()];for(this.bump();!this.isEOF();){var u=this.char();if(u===39)if(this.peek()===39)i.push(39),this.bump();else{this.bump();break}else i.push(u);this.bump()}return sv.apply(void 0,i)},e.prototype.tryParseUnquoted=function(t,i){if(this.isEOF())return null;var u=this.char();return u===60||u===123||u===35&&(i==="plural"||i==="selectordinal")||u===125&&t>0?null:(this.bump(),sv(u))},e.prototype.parseArgument=function(t,i){var u=this.clonePosition();if(this.bump(),this.bumpSpace(),this.isEOF())return this.error(_r.EXPECT_ARGUMENT_CLOSING_BRACE,wr(u,this.clonePosition()));if(this.char()===125)return this.bump(),this.error(_r.EMPTY_ARGUMENT,wr(u,this.clonePosition()));var d=this.parseIdentifierIfPossible().value;if(!d)return this.error(_r.MALFORMED_ARGUMENT,wr(u,this.clonePosition()));if(this.bumpSpace(),this.isEOF())return this.error(_r.EXPECT_ARGUMENT_CLOSING_BRACE,wr(u,this.clonePosition()));switch(this.char()){case 125:return this.bump(),{val:{type:Kr.argument,value:d,location:wr(u,this.clonePosition())},err:null};case 44:return this.bump(),this.bumpSpace(),this.isEOF()?this.error(_r.EXPECT_ARGUMENT_CLOSING_BRACE,wr(u,this.clonePosition())):this.parseArgumentOptions(t,i,d,u);default:return this.error(_r.MALFORMED_ARGUMENT,wr(u,this.clonePosition()))}},e.prototype.parseIdentifierIfPossible=function(){var t=this.clonePosition(),i=this.offset(),u=av(this.message,i),d=i+u.length;this.bumpTo(d);var g=this.clonePosition(),y=wr(t,g);return{value:u,location:y}},e.prototype.parseArgumentOptions=function(t,i,u,d){var g,y=this.clonePosition(),c=this.parseIdentifierIfPossible().value,T=this.clonePosition();switch(c){case"":return this.error(_r.EXPECT_ARGUMENT_TYPE,wr(y,T));case"number":case"date":case"time":{this.bumpSpace();var P=null;if(this.bumpIf(",")){this.bumpSpace();var R=this.clonePosition(),D=this.parseSimpleArgStyleIfPossible();if(D.err)return D;var A=wD(D.val);if(A.length===0)return this.error(_r.EXPECT_ARGUMENT_STYLE,wr(this.clonePosition(),this.clonePosition()));var N=wr(R,this.clonePosition());P={style:A,styleLocation:N}}var X=this.tryParseArgumentClose(d);if(X.err)return X;var U=wr(d,this.clonePosition());if(P&&v2(P==null?void 0:P.style,"::",0)){var te=xD(P.style.slice(2));if(c==="number"){var D=this.parseNumberSkeletonFromString(te,P.styleLocation);return D.err?D:{val:{type:Kr.number,value:u,location:U,style:D.val},err:null}}else{if(te.length===0)return this.error(_r.EXPECT_DATE_TIME_SKELETON,U);var F=te;this.locale&&(F=aD(te,this.locale));var A={type:Bc.dateTime,pattern:F,location:P.styleLocation,parsedOptions:this.shouldParseSkeletons?eD(F):{}},$=c==="date"?Kr.date:Kr.time;return{val:{type:$,value:u,location:U,style:A},err:null}}}return{val:{type:c==="number"?Kr.number:c==="date"?Kr.date:Kr.time,value:u,location:U,style:(g=P==null?void 0:P.style)!==null&&g!==void 0?g:null},err:null}}case"plural":case"selectordinal":case"select":{var q=this.clonePosition();if(this.bumpSpace(),!this.bumpIf(","))return this.error(_r.EXPECT_SELECT_ARGUMENT_OPTIONS,wr(q,Rt({},q)));this.bumpSpace();var ne=this.parseIdentifierIfPossible(),se=0;if(c!=="select"&&ne.value==="offset"){if(!this.bumpIf(":"))return this.error(_r.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE,wr(this.clonePosition(),this.clonePosition()));this.bumpSpace();var D=this.tryParseDecimalInteger(_r.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE,_r.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE);if(D.err)return D;this.bumpSpace(),ne=this.parseIdentifierIfPossible(),se=D.val}var Ee=this.tryParsePluralOrSelectOptions(t,c,i,ne);if(Ee.err)return Ee;var X=this.tryParseArgumentClose(d);if(X.err)return X;var ge=wr(d,this.clonePosition());return c==="select"?{val:{type:Kr.select,value:u,options:x2(Ee.val),location:ge},err:null}:{val:{type:Kr.plural,value:u,options:x2(Ee.val),offset:se,pluralType:c==="plural"?"cardinal":"ordinal",location:ge},err:null}}default:return this.error(_r.INVALID_ARGUMENT_TYPE,wr(y,T))}},e.prototype.tryParseArgumentClose=function(t){return this.isEOF()||this.char()!==125?this.error(_r.EXPECT_ARGUMENT_CLOSING_BRACE,wr(t,this.clonePosition())):(this.bump(),{val:!0,err:null})},e.prototype.parseSimpleArgStyleIfPossible=function(){for(var t=0,i=this.clonePosition();!this.isEOF();){var u=this.char();switch(u){case 39:{this.bump();var d=this.clonePosition();if(!this.bumpUntil("'"))return this.error(_r.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE,wr(d,this.clonePosition()));this.bump();break}case 123:{t+=1,this.bump();break}case 125:{if(t>0)t-=1;else return{val:this.message.slice(i.offset,this.offset()),err:null};break}default:this.bump();break}}return{val:this.message.slice(i.offset,this.offset()),err:null}},e.prototype.parseNumberSkeletonFromString=function(t,i){var u=[];try{u=rD(t)}catch{return this.error(_r.INVALID_NUMBER_SKELETON,i)}return{val:{type:Bc.number,tokens:u,location:i,parsedOptions:this.shouldParseSkeletons?sD(u):{}},err:null}},e.prototype.tryParsePluralOrSelectOptions=function(t,i,u,d){for(var g,y=!1,c=[],T=new Set,P=d.value,R=d.location;;){if(P.length===0){var D=this.clonePosition();if(i!=="select"&&this.bumpIf("=")){var A=this.tryParseDecimalInteger(_r.EXPECT_PLURAL_ARGUMENT_SELECTOR,_r.INVALID_PLURAL_ARGUMENT_SELECTOR);if(A.err)return A;R=wr(D,this.clonePosition()),P=this.message.slice(D.offset,this.offset())}else break}if(T.has(P))return this.error(i==="select"?_r.DUPLICATE_SELECT_ARGUMENT_SELECTOR:_r.DUPLICATE_PLURAL_ARGUMENT_SELECTOR,R);P==="other"&&(y=!0),this.bumpSpace();var N=this.clonePosition();if(!this.bumpIf("{"))return this.error(i==="select"?_r.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT:_r.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT,wr(this.clonePosition(),this.clonePosition()));var X=this.parseMessage(t+1,i,u);if(X.err)return X;var U=this.tryParseArgumentClose(N);if(U.err)return U;c.push([P,{value:X.val,location:wr(N,this.clonePosition())}]),T.add(P),this.bumpSpace(),g=this.parseIdentifierIfPossible(),P=g.value,R=g.location}return c.length===0?this.error(i==="select"?_r.EXPECT_SELECT_ARGUMENT_SELECTOR:_r.EXPECT_PLURAL_ARGUMENT_SELECTOR,wr(this.clonePosition(),this.clonePosition())):this.requiresOtherClause&&!y?this.error(_r.MISSING_OTHER_CLAUSE,wr(this.clonePosition(),this.clonePosition())):{val:c,err:null}},e.prototype.tryParseDecimalInteger=function(t,i){var u=1,d=this.clonePosition();this.bumpIf("+")||this.bumpIf("-")&&(u=-1);for(var g=!1,y=0;!this.isEOF();){var c=this.char();if(c>=48&&c<=57)g=!0,y=y*10+(c-48),this.bump();else break}var T=wr(d,this.clonePosition());return g?(y*=u,_D(y)?{val:y,err:null}:this.error(i,T)):this.error(t,T)},e.prototype.offset=function(){return this.position.offset},e.prototype.isEOF=function(){return this.offset()===this.message.length},e.prototype.clonePosition=function(){return{offset:this.position.offset,line:this.position.line,column:this.position.column}},e.prototype.char=function(){var t=this.position.offset;if(t>=this.message.length)throw Error("out of bound");var i=AT(this.message,t);if(i===void 0)throw Error("Offset ".concat(t," is at invalid UTF-16 code unit boundary"));return i},e.prototype.error=function(t,i){return{val:null,err:{kind:t,message:this.message,location:i}}},e.prototype.bump=function(){if(!this.isEOF()){var t=this.char();t===10?(this.position.line+=1,this.position.column=1,this.position.offset+=1):(this.position.column+=1,this.position.offset+=t<65536?1:2)}},e.prototype.bumpIf=function(t){if(v2(this.message,t,this.offset())){for(var i=0;i=0?(this.bumpTo(u),!0):(this.bumpTo(this.message.length),!1)},e.prototype.bumpTo=function(t){if(this.offset()>t)throw Error("targetOffset ".concat(t," must be greater than or equal to the current offset ").concat(this.offset()));for(t=Math.min(t,this.message.length);;){var i=this.offset();if(i===t)break;if(i>t)throw Error("targetOffset ".concat(t," is at invalid UTF-16 code unit boundary"));if(this.bump(),this.isEOF())break}},e.prototype.bumpSpace=function(){for(;!this.isEOF()&&zT(this.char());)this.bump()},e.prototype.peek=function(){if(this.isEOF())return null;var t=this.char(),i=this.offset(),u=this.message.charCodeAt(i+(t>=65536?2:1));return u??null},e}();function lv(e){return e>=97&&e<=122||e>=65&&e<=90}function SD(e){return lv(e)||e===47}function ED(e){return e===45||e===46||e>=48&&e<=57||e===95||e>=97&&e<=122||e>=65&&e<=90||e==183||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=893||e>=895&&e<=8191||e>=8204&&e<=8205||e>=8255&&e<=8256||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}function zT(e){return e>=9&&e<=13||e===32||e===133||e>=8206&&e<=8207||e===8232||e===8233}function kD(e){return e>=33&&e<=35||e===36||e>=37&&e<=39||e===40||e===41||e===42||e===43||e===44||e===45||e>=46&&e<=47||e>=58&&e<=59||e>=60&&e<=62||e>=63&&e<=64||e===91||e===92||e===93||e===94||e===96||e===123||e===124||e===125||e===126||e===161||e>=162&&e<=165||e===166||e===167||e===169||e===171||e===172||e===174||e===176||e===177||e===182||e===187||e===191||e===215||e===247||e>=8208&&e<=8213||e>=8214&&e<=8215||e===8216||e===8217||e===8218||e>=8219&&e<=8220||e===8221||e===8222||e===8223||e>=8224&&e<=8231||e>=8240&&e<=8248||e===8249||e===8250||e>=8251&&e<=8254||e>=8257&&e<=8259||e===8260||e===8261||e===8262||e>=8263&&e<=8273||e===8274||e===8275||e>=8277&&e<=8286||e>=8592&&e<=8596||e>=8597&&e<=8601||e>=8602&&e<=8603||e>=8604&&e<=8607||e===8608||e>=8609&&e<=8610||e===8611||e>=8612&&e<=8613||e===8614||e>=8615&&e<=8621||e===8622||e>=8623&&e<=8653||e>=8654&&e<=8655||e>=8656&&e<=8657||e===8658||e===8659||e===8660||e>=8661&&e<=8691||e>=8692&&e<=8959||e>=8960&&e<=8967||e===8968||e===8969||e===8970||e===8971||e>=8972&&e<=8991||e>=8992&&e<=8993||e>=8994&&e<=9e3||e===9001||e===9002||e>=9003&&e<=9083||e===9084||e>=9085&&e<=9114||e>=9115&&e<=9139||e>=9140&&e<=9179||e>=9180&&e<=9185||e>=9186&&e<=9254||e>=9255&&e<=9279||e>=9280&&e<=9290||e>=9291&&e<=9311||e>=9472&&e<=9654||e===9655||e>=9656&&e<=9664||e===9665||e>=9666&&e<=9719||e>=9720&&e<=9727||e>=9728&&e<=9838||e===9839||e>=9840&&e<=10087||e===10088||e===10089||e===10090||e===10091||e===10092||e===10093||e===10094||e===10095||e===10096||e===10097||e===10098||e===10099||e===10100||e===10101||e>=10132&&e<=10175||e>=10176&&e<=10180||e===10181||e===10182||e>=10183&&e<=10213||e===10214||e===10215||e===10216||e===10217||e===10218||e===10219||e===10220||e===10221||e===10222||e===10223||e>=10224&&e<=10239||e>=10240&&e<=10495||e>=10496&&e<=10626||e===10627||e===10628||e===10629||e===10630||e===10631||e===10632||e===10633||e===10634||e===10635||e===10636||e===10637||e===10638||e===10639||e===10640||e===10641||e===10642||e===10643||e===10644||e===10645||e===10646||e===10647||e===10648||e>=10649&&e<=10711||e===10712||e===10713||e===10714||e===10715||e>=10716&&e<=10747||e===10748||e===10749||e>=10750&&e<=11007||e>=11008&&e<=11055||e>=11056&&e<=11076||e>=11077&&e<=11078||e>=11079&&e<=11084||e>=11085&&e<=11123||e>=11124&&e<=11125||e>=11126&&e<=11157||e===11158||e>=11159&&e<=11263||e>=11776&&e<=11777||e===11778||e===11779||e===11780||e===11781||e>=11782&&e<=11784||e===11785||e===11786||e===11787||e===11788||e===11789||e>=11790&&e<=11798||e===11799||e>=11800&&e<=11801||e===11802||e===11803||e===11804||e===11805||e>=11806&&e<=11807||e===11808||e===11809||e===11810||e===11811||e===11812||e===11813||e===11814||e===11815||e===11816||e===11817||e>=11818&&e<=11822||e===11823||e>=11824&&e<=11833||e>=11834&&e<=11835||e>=11836&&e<=11839||e===11840||e===11841||e===11842||e>=11843&&e<=11855||e>=11856&&e<=11857||e===11858||e>=11859&&e<=11903||e>=12289&&e<=12291||e===12296||e===12297||e===12298||e===12299||e===12300||e===12301||e===12302||e===12303||e===12304||e===12305||e>=12306&&e<=12307||e===12308||e===12309||e===12310||e===12311||e===12312||e===12313||e===12314||e===12315||e===12316||e===12317||e>=12318&&e<=12319||e===12320||e===12336||e===64830||e===64831||e>=65093&&e<=65094}function uv(e){e.forEach(function(t){if(delete t.location,bT(t)||ST(t))for(var i in t.options)delete t.options[i].location,uv(t.options[i].value);else vT(t)&&kT(t.style)||(xT(t)||wT(t))&&iv(t.style)?delete t.style.location:ET(t)&&uv(t.children)})}function TD(e,t){t===void 0&&(t={}),t=Rt({shouldParseSkeletons:!0,requiresOtherClause:!0},t);var i=new bD(e,t).parse();if(i.err){var u=SyntaxError(_r[i.err.kind]);throw u.location=i.err.location,u.originalMessage=i.err.message,u}return t!=null&&t.captureLocation||uv(i.val),i.val}var ws;(function(e){e.MISSING_VALUE="MISSING_VALUE",e.INVALID_VALUE="INVALID_VALUE",e.MISSING_INTL_API="MISSING_INTL_API"})(ws||(ws={}));var ol=function(e){No(t,e);function t(i,u,d){var g=e.call(this,i)||this;return g.code=u,g.originalMessage=d,g}return t.prototype.toString=function(){return"[formatjs Error: ".concat(this.code,"] ").concat(this.message)},t}(Error),b2=function(e){No(t,e);function t(i,u,d,g){return e.call(this,'Invalid values for "'.concat(i,'": "').concat(u,'". Options are "').concat(Object.keys(d).join('", "'),'"'),ws.INVALID_VALUE,g)||this}return t}(ol),CD=function(e){No(t,e);function t(i,u,d){return e.call(this,'Value for "'.concat(i,'" must be of type ').concat(u),ws.INVALID_VALUE,d)||this}return t}(ol),ID=function(e){No(t,e);function t(i,u){return e.call(this,'The intl string context variable "'.concat(i,'" was not provided to the string "').concat(u,'"'),ws.MISSING_VALUE,u)||this}return t}(ol),bi;(function(e){e[e.literal=0]="literal",e[e.object=1]="object"})(bi||(bi={}));function PD(e){return e.length<2?e:e.reduce(function(t,i){var u=t[t.length-1];return!u||u.type!==bi.literal||i.type!==bi.literal?t.push(i):u.value+=i.value,t},[])}function DT(e){return typeof e=="function"}function hm(e,t,i,u,d,g,y){if(e.length===1&&m2(e[0]))return[{type:bi.literal,value:e[0].value}];for(var c=[],T=0,P=e;T"u")){var i=Intl.NumberFormat.supportedLocalesOf(t);return i.length>0?new Intl.Locale(i[0]):new Intl.Locale(typeof t=="string"?t:t[0])}},e.__parse=TD,e.formats={number:{integer:{maximumFractionDigits:0},currency:{style:"currency"},percent:{style:"percent"}},date:{short:{month:"numeric",day:"numeric",year:"2-digit"},medium:{month:"short",day:"numeric",year:"numeric"},long:{month:"long",day:"numeric",year:"numeric"},full:{weekday:"long",month:"long",day:"numeric",year:"numeric"}},time:{short:{hour:"numeric",minute:"numeric"},medium:{hour:"numeric",minute:"numeric",second:"numeric"},long:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"},full:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"}}},e}(),ru;(function(e){e.FORMAT_ERROR="FORMAT_ERROR",e.UNSUPPORTED_FORMATTER="UNSUPPORTED_FORMATTER",e.INVALID_CONFIG="INVALID_CONFIG",e.MISSING_DATA="MISSING_DATA",e.MISSING_TRANSLATION="MISSING_TRANSLATION"})(ru||(ru={}));var pp=function(e){No(t,e);function t(i,u,d){var g=this,y=d?d instanceof Error?d:new Error(String(d)):void 0;return g=e.call(this,"[@formatjs/intl Error ".concat(i,"] ").concat(u,` -`).concat(y?` -`.concat(y.message,` -`).concat(y.stack):""))||this,g.code=i,typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(g,t),g}return t}(Error),DD=function(e){No(t,e);function t(i,u){return e.call(this,ru.UNSUPPORTED_FORMATTER,i,u)||this}return t}(pp),RD=function(e){No(t,e);function t(i,u){return e.call(this,ru.INVALID_CONFIG,i,u)||this}return t}(pp),S2=function(e){No(t,e);function t(i,u){return e.call(this,ru.MISSING_DATA,i,u)||this}return t}(pp),$o=function(e){No(t,e);function t(i,u,d){var g=e.call(this,ru.FORMAT_ERROR,"".concat(i,` -Locale: `).concat(u,` -`),d)||this;return g.locale=u,g}return t}(pp),H_=function(e){No(t,e);function t(i,u,d,g){var y=e.call(this,"".concat(i,` -MessageID: `).concat(d==null?void 0:d.id,` -Default Message: `).concat(d==null?void 0:d.defaultMessage,` -Description: `).concat(d==null?void 0:d.description,` -`),u,g)||this;return y.descriptor=d,y.locale=u,y}return t}($o),LD=function(e){No(t,e);function t(i,u){var d=e.call(this,ru.MISSING_TRANSLATION,'Missing message: "'.concat(i.id,'" for locale "').concat(u,'", using ').concat(i.defaultMessage?"default message (".concat(typeof i.defaultMessage=="string"?i.defaultMessage:i.defaultMessage.map(function(g){var y;return(y=g.value)!==null&&y!==void 0?y:JSON.stringify(g)}).join(),")"):"id"," as fallback."))||this;return d.descriptor=i,d}return t}(pp);function su(e,t,i){return i===void 0&&(i={}),t.reduce(function(u,d){return d in e?u[d]=e[d]:d in i&&(u[d]=i[d]),u},{})}var FD=function(e){},OD=function(e){},LT={formats:{},messages:{},timeZone:void 0,defaultLocale:"en",defaultFormats:{},fallbackOnEmptyString:!0,onError:FD,onWarn:OD};function FT(){return{dateTime:{},number:{},message:{},relativeTime:{},pluralRules:{},list:{},displayNames:{}}}function zl(e){return{create:function(){return{get:function(t){return e[t]},set:function(t,i){e[t]=i}}}}}function BD(e){e===void 0&&(e=FT());var t=Intl.RelativeTimeFormat,i=Intl.ListFormat,u=Intl.DisplayNames,d=Ei(function(){for(var c,T=[],P=0;P needs to exist in the component ancestry.")}var jT=Rt(Rt({},LT),{textComponent:jt.Fragment});function s5(e){return function(t){return e(jt.Children.toArray(t))}}function hv(e,t){if(e===t)return!0;if(!e||!t)return!1;var i=Object.keys(e),u=Object.keys(t),d=i.length;if(u.length!==d)return!1;for(var g=0;g{if(e.substring(0,8)==="__MACOSX")return;const t=e.toLowerCase();if(t.endsWith(".txt")||t.endsWith(".json"))return"chat";if(t.endsWith(".zip"))return"zip";if(t.endsWith(".jpg")||t.endsWith(".mp4"))return"media"},w5=({onFilesLoad:e,onDataFileLoad:t,onError:i})=>{const[u,d]=jt.useState(),[g,y]=jt.useState(),c=Ug(),T=R=>{y(R.length);for(let A=0;A({...te,[N.name]:U.target.result}))},D.onerror=function(U){i(N.name)}}else X==="zip"&&new Hz().loadAsync(N).then(function(U){Object.keys(U.files).forEach(te=>{const F=P2(te);F==="chat"?U.files[te].async("string").then(function($){d(q=>({...q,[N.name]:$}))}):F==="media"&&U.files[te].async("arraybuffer").then(function($){const q=new Uint8Array($),ne=new Blob([q.buffer]);t(te,ne)})})})}};jt.useEffect(()=>{u&&Object.keys(u).length===g&&e(u)},[u,e]);const P=u&&Object.keys(u).length!==g;return Ke.jsxs(Ke.Fragment,{children:[P?Ke.jsxs("p",{style:{textAlign:"center"},children:[c.formatMessage({id:"app.loading",defaultMessage:"Loading"})," ..."]}):"",Ke.jsx("div",{style:P?{display:"none"}:null,children:Ke.jsx(Uz,{classes:"fileUploadDropArea",handleChange:T,multiple:!0,name:"file",types:x5,label:c.formatMessage({id:"app.uploadLabel",defaultMessage:"Upload or drag a file right here"})})})]})};var XT={exports:{}};/** - * MapLibre GL JS - * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v4.7.1/LICENSE.txt - */(function(e,t){(function(i,u){e.exports=u()})(cd,function(){var i={},u={};function d(y,c,T){if(u[y]=T,y==="index"){var P="var sharedModule = {}; ("+u.shared+")(sharedModule); ("+u.worker+")(sharedModule);",R={};return u.shared(R),u.index(i,R),typeof window<"u"&&i.setWorkerUrl(window.URL.createObjectURL(new Blob([P],{type:"text/javascript"}))),i}}d("shared",["exports"],function(y){function c(o,n,s,h){return new(s||(s=Promise))(function(m,x){function w(I){try{E(h.next(I))}catch(M){x(M)}}function b(I){try{E(h.throw(I))}catch(M){x(M)}}function E(I){var M;I.done?m(I.value):(M=I.value,M instanceof s?M:new s(function(L){L(M)})).then(w,b)}E((h=h.apply(o,n||[])).next())})}function T(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}typeof SuppressedError=="function"&&SuppressedError;var P=R;function R(o,n){this.x=o,this.y=n}R.prototype={clone:function(){return new R(this.x,this.y)},add:function(o){return this.clone()._add(o)},sub:function(o){return this.clone()._sub(o)},multByPoint:function(o){return this.clone()._multByPoint(o)},divByPoint:function(o){return this.clone()._divByPoint(o)},mult:function(o){return this.clone()._mult(o)},div:function(o){return this.clone()._div(o)},rotate:function(o){return this.clone()._rotate(o)},rotateAround:function(o,n){return this.clone()._rotateAround(o,n)},matMult:function(o){return this.clone()._matMult(o)},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(o){return this.x===o.x&&this.y===o.y},dist:function(o){return Math.sqrt(this.distSqr(o))},distSqr:function(o){var n=o.x-this.x,s=o.y-this.y;return n*n+s*s},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(o){return Math.atan2(this.y-o.y,this.x-o.x)},angleWith:function(o){return this.angleWithSep(o.x,o.y)},angleWithSep:function(o,n){return Math.atan2(this.x*n-this.y*o,this.x*o+this.y*n)},_matMult:function(o){var n=o[2]*this.x+o[3]*this.y;return this.x=o[0]*this.x+o[1]*this.y,this.y=n,this},_add:function(o){return this.x+=o.x,this.y+=o.y,this},_sub:function(o){return this.x-=o.x,this.y-=o.y,this},_mult:function(o){return this.x*=o,this.y*=o,this},_div:function(o){return this.x/=o,this.y/=o,this},_multByPoint:function(o){return this.x*=o.x,this.y*=o.y,this},_divByPoint:function(o){return this.x/=o.x,this.y/=o.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var o=this.y;return this.y=this.x,this.x=-o,this},_rotate:function(o){var n=Math.cos(o),s=Math.sin(o),h=s*this.x+n*this.y;return this.x=n*this.x-s*this.y,this.y=h,this},_rotateAround:function(o,n){var s=Math.cos(o),h=Math.sin(o),m=n.y+h*(this.x-n.x)+s*(this.y-n.y);return this.x=n.x+s*(this.x-n.x)-h*(this.y-n.y),this.y=m,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},R.convert=function(o){return o instanceof R?o:Array.isArray(o)?new R(o[0],o[1]):o};var D=T(P),A=N;function N(o,n,s,h){this.cx=3*o,this.bx=3*(s-o)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*n,this.by=3*(h-n)-this.cy,this.ay=1-this.cy-this.by,this.p1x=o,this.p1y=n,this.p2x=s,this.p2y=h}N.prototype={sampleCurveX:function(o){return((this.ax*o+this.bx)*o+this.cx)*o},sampleCurveY:function(o){return((this.ay*o+this.by)*o+this.cy)*o},sampleCurveDerivativeX:function(o){return(3*this.ax*o+2*this.bx)*o+this.cx},solveCurveX:function(o,n){if(n===void 0&&(n=1e-6),o<0)return 0;if(o>1)return 1;for(var s=o,h=0;h<8;h++){var m=this.sampleCurveX(s)-o;if(Math.abs(m)m?w=s:b=s,s=.5*(b-w)+w;return s},solve:function(o,n){return this.sampleCurveY(this.solveCurveX(o,n))}};var X=T(A);let U,te;function F(){return U==null&&(U=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),U}function $(){if(te==null&&(te=!1,F())){const n=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(n){for(let h=0;h<5*5;h++){const m=4*h;n.fillStyle=`rgb(${m},${m+1},${m+2})`,n.fillRect(h%5,Math.floor(h/5),1,1)}const s=n.getImageData(0,0,5,5).data;for(let h=0;h<5*5*4;h++)if(h%4!=3&&s[h]!==h){te=!0;break}}}return te||!1}function q(o,n,s,h){const m=new X(o,n,s,h);return x=>m.solve(x)}const ne=q(.25,.1,.25,1);function se(o,n,s){return Math.min(s,Math.max(n,o))}function Ee(o,n,s){const h=s-n,m=((o-n)%h+h)%h+n;return m===n?s:m}function ge(o,...n){for(const s of n)for(const h in s)o[h]=s[h];return o}let Oe=1;function Fe(o,n,s){const h={};for(const m in o)h[m]=n.call(this,o[m],m,o);return h}function Ge(o,n,s){const h={};for(const m in o)n.call(this,o[m],m,o)&&(h[m]=o[m]);return h}function it(o){return Array.isArray(o)?o.map(it):typeof o=="object"&&o?Fe(o,it):o}const ve={};function je(o){ve[o]||(typeof console<"u"&&console.warn(o),ve[o]=!0)}function H(o,n,s){return(s.y-o.y)*(n.x-o.x)>(n.y-o.y)*(s.x-o.x)}function Re(o){return typeof WorkerGlobalScope<"u"&&o!==void 0&&o instanceof WorkerGlobalScope}let _t=null;function ye(o){return typeof ImageBitmap<"u"&&o instanceof ImageBitmap}const Be="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function Le(o,n,s,h,m){return c(this,void 0,void 0,function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");const x=new VideoFrame(o,{timestamp:0});try{const w=x==null?void 0:x.format;if(!w||!w.startsWith("BGR")&&!w.startsWith("RGB"))throw new Error(`Unrecognized format ${w}`);const b=w.startsWith("BGR"),E=new Uint8ClampedArray(h*m*4);if(yield x.copyTo(E,function(I,M,L,j,W){const Y=4*Math.max(-M,0),J=(Math.max(0,L)-L)*j*4+Y,le=4*j,pe=Math.max(0,M),ze=Math.max(0,L);return{rect:{x:pe,y:ze,width:Math.min(I.width,M+j)-pe,height:Math.min(I.height,L+W)-ze},layout:[{offset:J,stride:le}]}}(o,n,s,h,m)),b)for(let I=0;IRe(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,Gt=function(o,n){if(/:\/\//.test(o.url)&&!/^https?:|^file:/.test(o.url)){const h=rt(o.url);if(h)return h(o,n);if(Re(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:o,targetMapId:qt},n)}if(!(/^file:/.test(s=o.url)||/^file:/.test($t())&&!/^\w+:/.test(s))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(h,m){return c(this,void 0,void 0,function*(){const x=new Request(h.url,{method:h.method||"GET",body:h.body,credentials:h.credentials,headers:h.headers,cache:h.cache,referrer:$t(),signal:m.signal});h.type!=="json"||x.headers.has("Accept")||x.headers.set("Accept","application/json");const w=yield fetch(x);if(!w.ok){const I=yield w.blob();throw new Kt(w.status,w.statusText,h.url,I)}let b;b=h.type==="arrayBuffer"||h.type==="image"?w.arrayBuffer():h.type==="json"?w.json():w.text();const E=yield b;if(m.signal.aborted)throw ft();return{data:E,cacheControl:w.headers.get("Cache-Control"),expires:w.headers.get("Expires")}})}(o,n);if(Re(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:o,mustQueue:!0,targetMapId:qt},n)}var s;return function(h,m){return new Promise((x,w)=>{var b;const E=new XMLHttpRequest;E.open(h.method||"GET",h.url,!0),h.type!=="arrayBuffer"&&h.type!=="image"||(E.responseType="arraybuffer");for(const I in h.headers)E.setRequestHeader(I,h.headers[I]);h.type==="json"&&(E.responseType="text",!((b=h.headers)===null||b===void 0)&&b.Accept||E.setRequestHeader("Accept","application/json")),E.withCredentials=h.credentials==="include",E.onerror=()=>{w(new Error(E.statusText))},E.onload=()=>{if(!m.signal.aborted)if((E.status>=200&&E.status<300||E.status===0)&&E.response!==null){let I=E.response;if(h.type==="json")try{I=JSON.parse(E.response)}catch(M){return void w(M)}x({data:I,cacheControl:E.getResponseHeader("Cache-Control"),expires:E.getResponseHeader("Expires")})}else{const I=new Blob([E.response],{type:E.getResponseHeader("Content-Type")});w(new Kt(E.status,E.statusText,h.url,I))}},m.signal.addEventListener("abort",()=>{E.abort(),w(ft())}),E.send(h.body)})}(o,n)};function pr(o){if(!o||o.indexOf("://")<=0||o.indexOf("data:image/")===0||o.indexOf("blob:")===0)return!0;const n=new URL(o),s=window.location;return n.protocol===s.protocol&&n.host===s.host}function lr(o,n,s){s[o]&&s[o].indexOf(n)!==-1||(s[o]=s[o]||[],s[o].push(n))}function gr(o,n,s){if(s&&s[o]){const h=s[o].indexOf(n);h!==-1&&s[o].splice(h,1)}}class $r{constructor(n,s={}){ge(this,s),this.type=n}}class V extends $r{constructor(n,s={}){super("error",ge({error:n},s))}}class Ue{on(n,s){return this._listeners=this._listeners||{},lr(n,s,this._listeners),this}off(n,s){return gr(n,s,this._listeners),gr(n,s,this._oneTimeListeners),this}once(n,s){return s?(this._oneTimeListeners=this._oneTimeListeners||{},lr(n,s,this._oneTimeListeners),this):new Promise(h=>this.once(n,h))}fire(n,s){typeof n=="string"&&(n=new $r(n,s||{}));const h=n.type;if(this.listens(h)){n.target=this;const m=this._listeners&&this._listeners[h]?this._listeners[h].slice():[];for(const b of m)b.call(this,n);const x=this._oneTimeListeners&&this._oneTimeListeners[h]?this._oneTimeListeners[h].slice():[];for(const b of x)gr(h,b,this._oneTimeListeners),b.call(this,n);const w=this._eventedParent;w&&(ge(n,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),w.fire(n))}else n instanceof V&&console.error(n.error);return this}listens(n){return this._listeners&&this._listeners[n]&&this._listeners[n].length>0||this._oneTimeListeners&&this._oneTimeListeners[n]&&this._oneTimeListeners[n].length>0||this._eventedParent&&this._eventedParent.listens(n)}setEventedParent(n,s){return this._eventedParent=n,this._eventedParentData=s,this}}var ie={$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"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},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:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},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:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","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":{}}},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}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"enum",default:"mercator",values:{mercator:{},globe:{}}}},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"}}};const de=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function oe(o,n){const s={};for(const h in o)h!=="ref"&&(s[h]=o[h]);return de.forEach(h=>{h in n&&(s[h]=n[h])}),s}function ke(o,n){if(Array.isArray(o)){if(!Array.isArray(n)||o.length!==n.length)return!1;for(let s=0;s`:o.itemType.kind==="value"?"array":`array<${n}>`}return o.kind}const ee=[Qn,Qe,Wt,Bt,jr,Ki,ei,Z(Zt),Yi,Pn,he];function ue(o,n){if(n.kind==="error")return null;if(o.kind==="array"){if(n.kind==="array"&&(n.N===0&&n.itemType.kind==="value"||!ue(o.itemType,n.itemType))&&(typeof o.N!="number"||o.N===n.N))return null}else{if(o.kind===n.kind)return null;if(o.kind==="value"){for(const s of ee)if(!ue(s,n))return null}}return`Expected ${G(o)} but found ${G(n)} instead.`}function Se(o,n){return n.some(s=>s.kind===o.kind)}function Ie(o,n){return n.some(s=>s==="null"?o===null:s==="array"?Array.isArray(o):s==="object"?o&&!Array.isArray(o)&&typeof o=="object":s===typeof o)}function Me(o,n){return o.kind==="array"&&n.kind==="array"?o.itemType.kind===n.itemType.kind&&typeof o.N=="number":o.kind===n.kind}const _e=.96422,He=.82521,Je=4/29,$e=6/29,ut=3*$e*$e,Mt=$e*$e*$e,Dt=Math.PI/180,cr=180/Math.PI;function Xt(o){return(o%=360)<0&&(o+=360),o}function hr([o,n,s,h]){let m,x;const w=dn((.2225045*(o=rr(o))+.7168786*(n=rr(n))+.0606169*(s=rr(s)))/1);o===n&&n===s?m=x=w:(m=dn((.4360747*o+.3850649*n+.1430804*s)/_e),x=dn((.0139322*o+.0971045*n+.7141733*s)/He));const b=116*w-16;return[b<0?0:b,500*(m-w),200*(w-x),h]}function rr(o){return o<=.04045?o/12.92:Math.pow((o+.055)/1.055,2.4)}function dn(o){return o>Mt?Math.pow(o,1/3):o/ut+Je}function Zr([o,n,s,h]){let m=(o+16)/116,x=isNaN(n)?m:m+n/500,w=isNaN(s)?m:m-s/200;return m=1*Sr(m),x=_e*Sr(x),w=He*Sr(w),[Jt(3.1338561*x-1.6168667*m-.4906146*w),Jt(-.9787684*x+1.9161415*m+.033454*w),Jt(.0719453*x-.2289914*m+1.4052427*w),h]}function Jt(o){return(o=o<=.00304?12.92*o:1.055*Math.pow(o,1/2.4)-.055)<0?0:o>1?1:o}function Sr(o){return o>$e?o*o*o:ut*(o-Je)}function Nr(o){return parseInt(o.padEnd(2,o),16)/255}function _n(o,n){return En(n?o/100:o,0,1)}function En(o,n,s){return Math.min(Math.max(n,o),s)}function Un(o){return!o.some(Number.isNaN)}const Qs={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};class Er{constructor(n,s,h,m=1,x=!0){this.r=n,this.g=s,this.b=h,this.a=m,x||(this.r*=m,this.g*=m,this.b*=m,m||this.overwriteGetter("rgb",[n,s,h,m]))}static parse(n){if(n instanceof Er)return n;if(typeof n!="string")return;const s=function(h){if((h=h.toLowerCase().trim())==="transparent")return[0,0,0,0];const m=Qs[h];if(m){const[w,b,E]=m;return[w/255,b/255,E/255,1]}if(h.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(h)){const w=h.length<6?1:2;let b=1;return[Nr(h.slice(b,b+=w)),Nr(h.slice(b,b+=w)),Nr(h.slice(b,b+=w)),Nr(h.slice(b,b+w)||"ff")]}if(h.startsWith("rgb")){const w=h.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(w){const[b,E,I,M,L,j,W,Y,J,le,pe,ze]=w,be=[M||" ",W||" ",le].join("");if(be===" "||be===" /"||be===",,"||be===",,,"){const Ae=[I,j,J].join(""),Ve=Ae==="%%%"?100:Ae===""?255:0;if(Ve){const et=[En(+E/Ve,0,1),En(+L/Ve,0,1),En(+Y/Ve,0,1),pe?_n(+pe,ze):1];if(Un(et))return et}}return}}const x=h.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(x){const[w,b,E,I,M,L,j,W,Y]=x,J=[E||" ",M||" ",j].join("");if(J===" "||J===" /"||J===",,"||J===",,,"){const le=[+b,En(+I,0,100),En(+L,0,100),W?_n(+W,Y):1];if(Un(le))return function([pe,ze,be,Ae]){function Ve(et){const vt=(et+pe/30)%12,Ft=ze*Math.min(be,1-be);return be-Ft*Math.max(-1,Math.min(vt-3,9-vt,1))}return pe=Xt(pe),ze/=100,be/=100,[Ve(0),Ve(8),Ve(4),Ae]}(le)}}}(n);return s?new Er(...s,!1):void 0}get rgb(){const{r:n,g:s,b:h,a:m}=this,x=m||1/0;return this.overwriteGetter("rgb",[n/x,s/x,h/x,m])}get hcl(){return this.overwriteGetter("hcl",function(n){const[s,h,m,x]=hr(n),w=Math.sqrt(h*h+m*m);return[Math.round(1e4*w)?Xt(Math.atan2(m,h)*cr):NaN,w,s,x]}(this.rgb))}get lab(){return this.overwriteGetter("lab",hr(this.rgb))}overwriteGetter(n,s){return Object.defineProperty(this,n,{value:s}),s}toString(){const[n,s,h,m]=this.rgb;return`rgba(${[n,s,h].map(x=>Math.round(255*x)).join(",")},${m})`}}Er.black=new Er(0,0,0,1),Er.white=new Er(1,1,1,1),Er.transparent=new Er(0,0,0,0),Er.red=new Er(1,0,0,1);class qc{constructor(n,s,h){this.sensitivity=n?s?"variant":"case":s?"accent":"base",this.locale=h,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(n,s){return this.collator.compare(n,s)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Xc{constructor(n,s,h,m,x){this.text=n,this.image=s,this.scale=h,this.fontStack=m,this.textColor=x}}class fi{constructor(n){this.sections=n}static fromString(n){return new fi([new Xc(n,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(n=>n.text.length!==0||n.image&&n.image.name.length!==0)}static factory(n){return n instanceof fi?n:fi.fromString(n)}toString(){return this.sections.length===0?"":this.sections.map(n=>n.text).join("")}}class mi{constructor(n){this.values=n.slice()}static parse(n){if(n instanceof mi)return n;if(typeof n=="number")return new mi([n,n,n,n]);if(Array.isArray(n)&&!(n.length<1||n.length>4)){for(const s of n)if(typeof s!="number")return;switch(n.length){case 1:n=[n[0],n[0],n[0],n[0]];break;case 2:n=[n[0],n[1],n[0],n[1]];break;case 3:n=[n[0],n[1],n[2],n[1]]}return new mi(n)}}toString(){return JSON.stringify(this.values)}}const Kg=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Ri{constructor(n){this.values=n.slice()}static parse(n){if(n instanceof Ri)return n;if(Array.isArray(n)&&!(n.length<1)&&n.length%2==0){for(let s=0;s=0&&o<=255&&typeof n=="number"&&n>=0&&n<=255&&typeof s=="number"&&s>=0&&s<=255?h===void 0||typeof h=="number"&&h>=0&&h<=1?null:`Invalid rgba value [${[o,n,s,h].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof h=="number"?[o,n,s,h]:[o,n,s]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function bs(o){if(o===null||typeof o=="string"||typeof o=="boolean"||typeof o=="number"||o instanceof Er||o instanceof qc||o instanceof fi||o instanceof mi||o instanceof Ri||o instanceof gi)return!0;if(Array.isArray(o)){for(const n of o)if(!bs(n))return!1;return!0}if(typeof o=="object"){for(const n in o)if(!bs(o[n]))return!1;return!0}return!1}function pn(o){if(o===null)return Qn;if(typeof o=="string")return Wt;if(typeof o=="boolean")return Bt;if(typeof o=="number")return Qe;if(o instanceof Er)return jr;if(o instanceof qc)return Di;if(o instanceof fi)return Ki;if(o instanceof mi)return Yi;if(o instanceof Ri)return he;if(o instanceof gi)return Pn;if(Array.isArray(o)){const n=o.length;let s;for(const h of o){const m=pn(h);if(s){if(s===m)continue;s=Zt;break}s=m}return Z(s||Zt,n)}return ei}function sl(o){const n=typeof o;return o===null?"":n==="string"||n==="number"||n==="boolean"?String(o):o instanceof Er||o instanceof fi||o instanceof mi||o instanceof Ri||o instanceof gi?o.toString():JSON.stringify(o)}class Ji{constructor(n,s){this.type=n,this.value=s}static parse(n,s){if(n.length!==2)return s.error(`'literal' expression requires exactly one argument, but found ${n.length-1} instead.`);if(!bs(n[1]))return s.error("invalid value");const h=n[1];let m=pn(h);const x=s.expectedType;return m.kind!=="array"||m.N!==0||!x||x.kind!=="array"||typeof x.N=="number"&&x.N!==0||(m=x),new Ji(m,h)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class an{constructor(n){this.name="ExpressionEvaluationError",this.message=n}toJSON(){return this.message}}const au={string:Wt,number:Qe,boolean:Bt,object:ei};class Qi{constructor(n,s){this.type=n,this.args=s}static parse(n,s){if(n.length<2)return s.error("Expected at least one argument.");let h,m=1;const x=n[0];if(x==="array"){let b,E;if(n.length>2){const I=n[1];if(typeof I!="string"||!(I in au)||I==="object")return s.error('The item type argument of "array" must be one of string, number, boolean',1);b=au[I],m++}else b=Zt;if(n.length>3){if(n[2]!==null&&(typeof n[2]!="number"||n[2]<0||n[2]!==Math.floor(n[2])))return s.error('The length argument to "array" must be a positive integer literal',2);E=n[2],m++}h=Z(b,E)}else{if(!au[x])throw new Error(`Types doesn't contain name = ${x}`);h=au[x]}const w=[];for(;mn.outputDefined())}}const Kc={"to-boolean":Bt,"to-color":jr,"to-number":Qe,"to-string":Wt};class eo{constructor(n,s){this.type=n,this.args=s}static parse(n,s){if(n.length<2)return s.error("Expected at least one argument.");const h=n[0];if(!Kc[h])throw new Error(`Can't parse ${h} as it is not part of the known types`);if((h==="to-boolean"||h==="to-string")&&n.length!==2)return s.error("Expected one argument.");const m=Kc[h],x=[];for(let w=1;w4?`Invalid rbga value ${JSON.stringify(s)}: expected an array containing either three or four numeric values.`:ea(s[0],s[1],s[2],s[3]),!h))return new Er(s[0]/255,s[1]/255,s[2]/255,s[3])}throw new an(h||`Could not parse color from value '${typeof s=="string"?s:JSON.stringify(s)}'`)}case"padding":{let s;for(const h of this.args){s=h.evaluate(n);const m=mi.parse(s);if(m)return m}throw new an(`Could not parse padding from value '${typeof s=="string"?s:JSON.stringify(s)}'`)}case"variableAnchorOffsetCollection":{let s;for(const h of this.args){s=h.evaluate(n);const m=Ri.parse(s);if(m)return m}throw new an(`Could not parse variableAnchorOffsetCollection from value '${typeof s=="string"?s:JSON.stringify(s)}'`)}case"number":{let s=null;for(const h of this.args){if(s=h.evaluate(n),s===null)return 0;const m=Number(s);if(!isNaN(m))return m}throw new an(`Could not convert ${JSON.stringify(s)} to number.`)}case"formatted":return fi.fromString(sl(this.args[0].evaluate(n)));case"resolvedImage":return gi.fromString(sl(this.args[0].evaluate(n)));default:return sl(this.args[0].evaluate(n))}}eachChild(n){this.args.forEach(n)}outputDefined(){return this.args.every(n=>n.outputDefined())}}const Yg=["Unknown","Point","LineString","Polygon"];class lu{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"?Yg[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(n){let s=this._parseColorCache[n];return s||(s=this._parseColorCache[n]=Er.parse(n)),s}}class Ss{constructor(n,s,h=[],m,x=new sn,w=[]){this.registry=n,this.path=h,this.key=h.map(b=>`[${b}]`).join(""),this.scope=x,this.errors=w,this.expectedType=m,this._isConstant=s}parse(n,s,h,m,x={}){return s?this.concat(s,h,m)._parse(n,x):this._parse(n,x)}_parse(n,s){function h(m,x,w){return w==="assert"?new Qi(x,[m]):w==="coerce"?new eo(x,[m]):m}if(n!==null&&typeof n!="string"&&typeof n!="boolean"&&typeof n!="number"||(n=["literal",n]),Array.isArray(n)){if(n.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const m=n[0];if(typeof m!="string")return this.error(`Expression name must be a string, but found ${typeof m} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const x=this.registry[m];if(x){let w=x.parse(n,this);if(!w)return null;if(this.expectedType){const b=this.expectedType,E=w.type;if(b.kind!=="string"&&b.kind!=="number"&&b.kind!=="boolean"&&b.kind!=="object"&&b.kind!=="array"||E.kind!=="value")if(b.kind!=="color"&&b.kind!=="formatted"&&b.kind!=="resolvedImage"||E.kind!=="value"&&E.kind!=="string")if(b.kind!=="padding"||E.kind!=="value"&&E.kind!=="number"&&E.kind!=="array")if(b.kind!=="variableAnchorOffsetCollection"||E.kind!=="value"&&E.kind!=="array"){if(this.checkSubtype(b,E))return null}else w=h(w,b,s.typeAnnotation||"coerce");else w=h(w,b,s.typeAnnotation||"coerce");else w=h(w,b,s.typeAnnotation||"coerce");else w=h(w,b,s.typeAnnotation||"assert")}if(!(w instanceof Ji)&&w.type.kind!=="resolvedImage"&&this._isConstant(w)){const b=new lu;try{w=new Ji(w.type,w.evaluate(b))}catch(E){return this.error(E.message),null}}return w}return this.error(`Unknown expression "${m}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(n===void 0?"'undefined' value invalid. Use null instead.":typeof n=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof n} instead.`)}concat(n,s,h){const m=typeof n=="number"?this.path.concat(n):this.path,x=h?this.scope.concat(h):this.scope;return new Ss(this.registry,this._isConstant,m,s||null,x,this.errors)}error(n,...s){const h=`${this.key}${s.map(m=>`[${m}]`).join("")}`;this.errors.push(new on(h,n))}checkSubtype(n,s){const h=ue(n,s);return h&&this.error(h),h}}class is{constructor(n,s){this.type=s.type,this.bindings=[].concat(n),this.result=s}evaluate(n){return this.result.evaluate(n)}eachChild(n){for(const s of this.bindings)n(s[1]);n(this.result)}static parse(n,s){if(n.length<4)return s.error(`Expected at least 3 arguments, but found ${n.length-1} instead.`);const h=[];for(let x=1;x=h.length)throw new an(`Array index out of bounds: ${s} > ${h.length-1}.`);if(s!==Math.floor(s))throw new an(`Array index must be an integer, but found ${s} instead.`);return h[s]}eachChild(n){n(this.index),n(this.input)}outputDefined(){return!1}}class Jc{constructor(n,s){this.type=Bt,this.needle=n,this.haystack=s}static parse(n,s){if(n.length!==3)return s.error(`Expected 2 arguments, but found ${n.length-1} instead.`);const h=s.parse(n[1],1,Zt),m=s.parse(n[2],2,Zt);return h&&m?Se(h.type,[Bt,Wt,Qe,Qn,Zt])?new Jc(h,m):s.error(`Expected first argument to be of type boolean, string, number or null, but found ${G(h.type)} instead`):null}evaluate(n){const s=this.needle.evaluate(n),h=this.haystack.evaluate(n);if(!h)return!1;if(!Ie(s,["boolean","string","number","null"]))throw new an(`Expected first argument to be of type boolean, string, number or null, but found ${G(pn(s))} instead.`);if(!Ie(h,["string","array"]))throw new an(`Expected second argument to be of type array or string, but found ${G(pn(h))} instead.`);return h.indexOf(s)>=0}eachChild(n){n(this.needle),n(this.haystack)}outputDefined(){return!0}}class ta{constructor(n,s,h){this.type=Qe,this.needle=n,this.haystack=s,this.fromIndex=h}static parse(n,s){if(n.length<=2||n.length>=5)return s.error(`Expected 3 or 4 arguments, but found ${n.length-1} instead.`);const h=s.parse(n[1],1,Zt),m=s.parse(n[2],2,Zt);if(!h||!m)return null;if(!Se(h.type,[Bt,Wt,Qe,Qn,Zt]))return s.error(`Expected first argument to be of type boolean, string, number or null, but found ${G(h.type)} instead`);if(n.length===4){const x=s.parse(n[3],3,Qe);return x?new ta(h,m,x):null}return new ta(h,m)}evaluate(n){const s=this.needle.evaluate(n),h=this.haystack.evaluate(n);if(!Ie(s,["boolean","string","number","null"]))throw new an(`Expected first argument to be of type boolean, string, number or null, but found ${G(pn(s))} instead.`);let m;if(this.fromIndex&&(m=this.fromIndex.evaluate(n)),Ie(h,["string"])){const x=h.indexOf(s,m);return x===-1?-1:[...h.slice(0,x)].length}if(Ie(h,["array"]))return h.indexOf(s,m);throw new an(`Expected second argument to be of type array or string, but found ${G(pn(h))} instead.`)}eachChild(n){n(this.needle),n(this.haystack),this.fromIndex&&n(this.fromIndex)}outputDefined(){return!1}}class Qc{constructor(n,s,h,m,x,w){this.inputType=n,this.type=s,this.input=h,this.cases=m,this.outputs=x,this.otherwise=w}static parse(n,s){if(n.length<5)return s.error(`Expected at least 4 arguments, but found only ${n.length-1}.`);if(n.length%2!=1)return s.error("Expected an even number of arguments.");let h,m;s.expectedType&&s.expectedType.kind!=="value"&&(m=s.expectedType);const x={},w=[];for(let I=2;INumber.MAX_SAFE_INTEGER)return j.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof Y=="number"&&Math.floor(Y)!==Y)return j.error("Numeric branch labels must be integer values.");if(h){if(j.checkSubtype(h,pn(Y)))return null}else h=pn(Y);if(x[String(Y)]!==void 0)return j.error("Branch labels must be unique.");x[String(Y)]=w.length}const W=s.parse(L,I,m);if(!W)return null;m=m||W.type,w.push(W)}const b=s.parse(n[1],1,Zt);if(!b)return null;const E=s.parse(n[n.length-1],n.length-1,m);return E?b.type.kind!=="value"&&s.concat(1).checkSubtype(h,b.type)?null:new Qc(h,m,b,x,w,E):null}evaluate(n){const s=this.input.evaluate(n);return(pn(s)===this.inputType&&this.outputs[this.cases[s]]||this.otherwise).evaluate(n)}eachChild(n){n(this.input),this.outputs.forEach(n),n(this.otherwise)}outputDefined(){return this.outputs.every(n=>n.outputDefined())&&this.otherwise.outputDefined()}}class uu{constructor(n,s,h){this.type=n,this.branches=s,this.otherwise=h}static parse(n,s){if(n.length<4)return s.error(`Expected at least 3 arguments, but found only ${n.length-1}.`);if(n.length%2!=0)return s.error("Expected an odd number of arguments.");let h;s.expectedType&&s.expectedType.kind!=="value"&&(h=s.expectedType);const m=[];for(let w=1;ws.outputDefined())&&this.otherwise.outputDefined()}}class al{constructor(n,s,h,m){this.type=n,this.input=s,this.beginIndex=h,this.endIndex=m}static parse(n,s){if(n.length<=2||n.length>=5)return s.error(`Expected 3 or 4 arguments, but found ${n.length-1} instead.`);const h=s.parse(n[1],1,Zt),m=s.parse(n[2],2,Qe);if(!h||!m)return null;if(!Se(h.type,[Z(Zt),Wt,Zt]))return s.error(`Expected first argument to be of type array or string, but found ${G(h.type)} instead`);if(n.length===4){const x=s.parse(n[3],3,Qe);return x?new al(h.type,h,m,x):null}return new al(h.type,h,m)}evaluate(n){const s=this.input.evaluate(n),h=this.beginIndex.evaluate(n);let m;if(this.endIndex&&(m=this.endIndex.evaluate(n)),Ie(s,["string"]))return[...s].slice(h,m).join("");if(Ie(s,["array"]))return s.slice(h,m);throw new an(`Expected first argument to be of type array or string, but found ${G(pn(s))} instead.`)}eachChild(n){n(this.input),n(this.beginIndex),this.endIndex&&n(this.endIndex)}outputDefined(){return!1}}function cu(o,n){const s=o.length-1;let h,m,x=0,w=s,b=0;for(;x<=w;)if(b=Math.floor((x+w)/2),h=o[b],m=o[b+1],h<=n){if(b===s||nn))throw new an("Input is not a number.");w=b-1}return 0}class ra{constructor(n,s,h){this.type=n,this.input=s,this.labels=[],this.outputs=[];for(const[m,x]of h)this.labels.push(m),this.outputs.push(x)}static parse(n,s){if(n.length-1<4)return s.error(`Expected at least 4 arguments, but found only ${n.length-1}.`);if((n.length-1)%2!=0)return s.error("Expected an even number of arguments.");const h=s.parse(n[1],1,Qe);if(!h)return null;const m=[];let x=null;s.expectedType&&s.expectedType.kind!=="value"&&(x=s.expectedType);for(let w=1;w=b)return s.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',I);const L=s.parse(E,M,x);if(!L)return null;x=x||L.type,m.push([b,L])}return new ra(x,h,m)}evaluate(n){const s=this.labels,h=this.outputs;if(s.length===1)return h[0].evaluate(n);const m=this.input.evaluate(n);if(m<=s[0])return h[0].evaluate(n);const x=s.length;return m>=s[x-1]?h[x-1].evaluate(n):h[cu(s,m)].evaluate(n)}eachChild(n){n(this.input);for(const s of this.outputs)n(s)}outputDefined(){return this.outputs.every(n=>n.outputDefined())}}function _p(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var Jg=vp;function vp(o,n,s,h){this.cx=3*o,this.bx=3*(s-o)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*n,this.by=3*(h-n)-this.cy,this.ay=1-this.cy-this.by,this.p1x=o,this.p1y=n,this.p2x=s,this.p2y=h}vp.prototype={sampleCurveX:function(o){return((this.ax*o+this.bx)*o+this.cx)*o},sampleCurveY:function(o){return((this.ay*o+this.by)*o+this.cy)*o},sampleCurveDerivativeX:function(o){return(3*this.ax*o+2*this.bx)*o+this.cx},solveCurveX:function(o,n){if(n===void 0&&(n=1e-6),o<0)return 0;if(o>1)return 1;for(var s=o,h=0;h<8;h++){var m=this.sampleCurveX(s)-o;if(Math.abs(m)m?w=s:b=s,s=.5*(b-w)+w;return s},solve:function(o,n){return this.sampleCurveY(this.solveCurveX(o,n))}};var Qg=_p(Jg);function Es(o,n,s){return o+s*(n-o)}function ll(o,n,s){return o.map((h,m)=>Es(h,n[m],s))}const ti={number:Es,color:function(o,n,s,h="rgb"){switch(h){case"rgb":{const[m,x,w,b]=ll(o.rgb,n.rgb,s);return new Er(m,x,w,b,!1)}case"hcl":{const[m,x,w,b]=o.hcl,[E,I,M,L]=n.hcl;let j,W;if(isNaN(m)||isNaN(E))isNaN(m)?isNaN(E)?j=NaN:(j=E,w!==1&&w!==0||(W=I)):(j=m,M!==1&&M!==0||(W=x));else{let ze=E-m;E>m&&ze>180?ze-=360:E180&&(ze+=360),j=m+s*ze}const[Y,J,le,pe]=function([ze,be,Ae,Ve]){return ze=isNaN(ze)?0:ze*Dt,Zr([Ae,Math.cos(ze)*be,Math.sin(ze)*be,Ve])}([j,W??Es(x,I,s),Es(w,M,s),Es(b,L,s)]);return new Er(Y,J,le,pe,!1)}case"lab":{const[m,x,w,b]=Zr(ll(o.lab,n.lab,s));return new Er(m,x,w,b,!1)}}},array:ll,padding:function(o,n,s){return new mi(ll(o.values,n.values,s))},variableAnchorOffsetCollection:function(o,n,s){const h=o.values,m=n.values;if(h.length!==m.length)throw new an(`Cannot interpolate values of different length. from: ${o.toString()}, to: ${n.toString()}`);const x=[];for(let w=0;wtypeof M!="number"||M<0||M>1))return s.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);m={name:"cubic-bezier",controlPoints:I}}}if(n.length-1<4)return s.error(`Expected at least 4 arguments, but found only ${n.length-1}.`);if((n.length-1)%2!=0)return s.error("Expected an even number of arguments.");if(x=s.parse(x,2,Qe),!x)return null;const b=[];let E=null;h==="interpolate-hcl"||h==="interpolate-lab"?E=jr:s.expectedType&&s.expectedType.kind!=="value"&&(E=s.expectedType);for(let I=0;I=M)return s.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',j);const Y=s.parse(L,W,E);if(!Y)return null;E=E||Y.type,b.push([M,Y])}return Me(E,Qe)||Me(E,jr)||Me(E,Yi)||Me(E,he)||Me(E,Z(Qe))?new ri(E,h,m,x,b):s.error(`Type ${G(E)} is not interpolatable.`)}evaluate(n){const s=this.labels,h=this.outputs;if(s.length===1)return h[0].evaluate(n);const m=this.input.evaluate(n);if(m<=s[0])return h[0].evaluate(n);const x=s.length;if(m>=s[x-1])return h[x-1].evaluate(n);const w=cu(s,m),b=ri.interpolationFactor(this.interpolation,m,s[w],s[w+1]),E=h[w].evaluate(n),I=h[w+1].evaluate(n);switch(this.operator){case"interpolate":return ti[this.type.kind](E,I,b);case"interpolate-hcl":return ti.color(E,I,b,"hcl");case"interpolate-lab":return ti.color(E,I,b,"lab")}}eachChild(n){n(this.input);for(const s of this.outputs)n(s)}outputDefined(){return this.outputs.every(n=>n.outputDefined())}}function hu(o,n,s,h){const m=h-s,x=o-s;return m===0?0:n===1?x/m:(Math.pow(n,x)-1)/(Math.pow(n,m)-1)}class du{constructor(n,s){this.type=n,this.args=s}static parse(n,s){if(n.length<2)return s.error("Expectected at least one argument.");let h=null;const m=s.expectedType;m&&m.kind!=="value"&&(h=m);const x=[];for(const b of n.slice(1)){const E=s.parse(b,1+x.length,h,void 0,{typeAnnotation:"omit"});if(!E)return null;h=h||E.type,x.push(E)}if(!h)throw new Error("No output type");const w=m&&x.some(b=>ue(m,b.type));return new du(w?Zt:h,x)}evaluate(n){let s,h=null,m=0;for(const x of this.args)if(m++,h=x.evaluate(n),h&&h instanceof gi&&!h.available&&(s||(s=h.name),h=null,m===this.args.length&&(h=s)),h!==null)break;return h}eachChild(n){this.args.forEach(n)}outputDefined(){return this.args.every(n=>n.outputDefined())}}function pu(o,n){return o==="=="||o==="!="?n.kind==="boolean"||n.kind==="string"||n.kind==="number"||n.kind==="null"||n.kind==="value":n.kind==="string"||n.kind==="number"||n.kind==="value"}function xp(o,n,s,h){return h.compare(n,s)===0}function na(o,n,s){const h=o!=="=="&&o!=="!=";return class KT{constructor(x,w,b){this.type=Bt,this.lhs=x,this.rhs=w,this.collator=b,this.hasUntypedArgument=x.type.kind==="value"||w.type.kind==="value"}static parse(x,w){if(x.length!==3&&x.length!==4)return w.error("Expected two or three arguments.");const b=x[0];let E=w.parse(x[1],1,Zt);if(!E)return null;if(!pu(b,E.type))return w.concat(1).error(`"${b}" comparisons are not supported for type '${G(E.type)}'.`);let I=w.parse(x[2],2,Zt);if(!I)return null;if(!pu(b,I.type))return w.concat(2).error(`"${b}" comparisons are not supported for type '${G(I.type)}'.`);if(E.type.kind!==I.type.kind&&E.type.kind!=="value"&&I.type.kind!=="value")return w.error(`Cannot compare types '${G(E.type)}' and '${G(I.type)}'.`);h&&(E.type.kind==="value"&&I.type.kind!=="value"?E=new Qi(I.type,[E]):E.type.kind!=="value"&&I.type.kind==="value"&&(I=new Qi(E.type,[I])));let M=null;if(x.length===4){if(E.type.kind!=="string"&&I.type.kind!=="string"&&E.type.kind!=="value"&&I.type.kind!=="value")return w.error("Cannot use collator to compare non-string types.");if(M=w.parse(x[3],3,Di),!M)return null}return new KT(E,I,M)}evaluate(x){const w=this.lhs.evaluate(x),b=this.rhs.evaluate(x);if(h&&this.hasUntypedArgument){const E=pn(w),I=pn(b);if(E.kind!==I.kind||E.kind!=="string"&&E.kind!=="number")throw new an(`Expected arguments for "${o}" to be (string, string) or (number, number), but found (${E.kind}, ${I.kind}) instead.`)}if(this.collator&&!h&&this.hasUntypedArgument){const E=pn(w),I=pn(b);if(E.kind!=="string"||I.kind!=="string")return n(x,w,b)}return this.collator?s(x,w,b,this.collator.evaluate(x)):n(x,w,b)}eachChild(x){x(this.lhs),x(this.rhs),this.collator&&x(this.collator)}outputDefined(){return!0}}}const ey=na("==",function(o,n,s){return n===s},xp),wp=na("!=",function(o,n,s){return n!==s},function(o,n,s,h){return!xp(0,n,s,h)}),bp=na("<",function(o,n,s){return n",function(o,n,s){return n>s},function(o,n,s,h){return h.compare(n,s)>0}),ry=na("<=",function(o,n,s){return n<=s},function(o,n,s,h){return h.compare(n,s)<=0}),Sp=na(">=",function(o,n,s){return n>=s},function(o,n,s,h){return h.compare(n,s)>=0});class ul{constructor(n,s,h){this.type=Di,this.locale=h,this.caseSensitive=n,this.diacriticSensitive=s}static parse(n,s){if(n.length!==2)return s.error("Expected one argument.");const h=n[1];if(typeof h!="object"||Array.isArray(h))return s.error("Collator options argument must be an object.");const m=s.parse(h["case-sensitive"]!==void 0&&h["case-sensitive"],1,Bt);if(!m)return null;const x=s.parse(h["diacritic-sensitive"]!==void 0&&h["diacritic-sensitive"],1,Bt);if(!x)return null;let w=null;return h.locale&&(w=s.parse(h.locale,1,Wt),!w)?null:new ul(m,x,w)}evaluate(n){return new qc(this.caseSensitive.evaluate(n),this.diacriticSensitive.evaluate(n),this.locale?this.locale.evaluate(n):null)}eachChild(n){n(this.caseSensitive),n(this.diacriticSensitive),this.locale&&n(this.locale)}outputDefined(){return!1}}class eh{constructor(n,s,h,m,x){this.type=Wt,this.number=n,this.locale=s,this.currency=h,this.minFractionDigits=m,this.maxFractionDigits=x}static parse(n,s){if(n.length!==3)return s.error("Expected two arguments.");const h=s.parse(n[1],1,Qe);if(!h)return null;const m=n[2];if(typeof m!="object"||Array.isArray(m))return s.error("NumberFormat options argument must be an object.");let x=null;if(m.locale&&(x=s.parse(m.locale,1,Wt),!x))return null;let w=null;if(m.currency&&(w=s.parse(m.currency,1,Wt),!w))return null;let b=null;if(m["min-fraction-digits"]&&(b=s.parse(m["min-fraction-digits"],1,Qe),!b))return null;let E=null;return m["max-fraction-digits"]&&(E=s.parse(m["max-fraction-digits"],1,Qe),!E)?null:new eh(h,x,w,b,E)}evaluate(n){return new Intl.NumberFormat(this.locale?this.locale.evaluate(n):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(n):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(n):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(n):void 0}).format(this.number.evaluate(n))}eachChild(n){n(this.number),this.locale&&n(this.locale),this.currency&&n(this.currency),this.minFractionDigits&&n(this.minFractionDigits),this.maxFractionDigits&&n(this.maxFractionDigits)}outputDefined(){return!1}}class fu{constructor(n){this.type=Ki,this.sections=n}static parse(n,s){if(n.length<2)return s.error("Expected at least one argument.");const h=n[1];if(!Array.isArray(h)&&typeof h=="object")return s.error("First argument must be an image or text section.");const m=[];let x=!1;for(let w=1;w<=n.length-1;++w){const b=n[w];if(x&&typeof b=="object"&&!Array.isArray(b)){x=!1;let E=null;if(b["font-scale"]&&(E=s.parse(b["font-scale"],1,Qe),!E))return null;let I=null;if(b["text-font"]&&(I=s.parse(b["text-font"],1,Z(Wt)),!I))return null;let M=null;if(b["text-color"]&&(M=s.parse(b["text-color"],1,jr),!M))return null;const L=m[m.length-1];L.scale=E,L.font=I,L.textColor=M}else{const E=s.parse(n[w],1,Zt);if(!E)return null;const I=E.type.kind;if(I!=="string"&&I!=="value"&&I!=="null"&&I!=="resolvedImage")return s.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");x=!0,m.push({content:E,scale:null,font:null,textColor:null})}}return new fu(m)}evaluate(n){return new fi(this.sections.map(s=>{const h=s.content.evaluate(n);return pn(h)===Pn?new Xc("",h,null,null,null):new Xc(sl(h),null,s.scale?s.scale.evaluate(n):null,s.font?s.font.evaluate(n).join(","):null,s.textColor?s.textColor.evaluate(n):null)}))}eachChild(n){for(const s of this.sections)n(s.content),s.scale&&n(s.scale),s.font&&n(s.font),s.textColor&&n(s.textColor)}outputDefined(){return!1}}class th{constructor(n){this.type=Pn,this.input=n}static parse(n,s){if(n.length!==2)return s.error("Expected two arguments.");const h=s.parse(n[1],1,Wt);return h?new th(h):s.error("No image name provided.")}evaluate(n){const s=this.input.evaluate(n),h=gi.fromString(s);return h&&n.availableImages&&(h.available=n.availableImages.indexOf(s)>-1),h}eachChild(n){n(this.input)}outputDefined(){return!1}}class rh{constructor(n){this.type=Qe,this.input=n}static parse(n,s){if(n.length!==2)return s.error(`Expected 1 argument, but found ${n.length-1} instead.`);const h=s.parse(n[1],1);return h?h.type.kind!=="array"&&h.type.kind!=="string"&&h.type.kind!=="value"?s.error(`Expected argument of type string or array, but found ${G(h.type)} instead.`):new rh(h):null}evaluate(n){const s=this.input.evaluate(n);if(typeof s=="string")return[...s].length;if(Array.isArray(s))return s.length;throw new an(`Expected value to be of type string or array, but found ${G(pn(s))} instead.`)}eachChild(n){n(this.input)}outputDefined(){return!1}}const ko=8192;function ny(o,n){const s=(180+o[0])/360,h=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+o[1]*Math.PI/360)))/360,m=Math.pow(2,n.z);return[Math.round(s*m*ko),Math.round(h*m*ko)]}function nh(o,n){const s=Math.pow(2,n.z);return[(m=(o[0]/ko+n.x)/s,360*m-180),(h=(o[1]/ko+n.y)/s,360/Math.PI*Math.atan(Math.exp((180-360*h)*Math.PI/180))-90)];var h,m}function ks(o,n){o[0]=Math.min(o[0],n[0]),o[1]=Math.min(o[1],n[1]),o[2]=Math.max(o[2],n[0]),o[3]=Math.max(o[3],n[1])}function os(o,n){return!(o[0]<=n[0]||o[2]>=n[2]||o[1]<=n[1]||o[3]>=n[3])}function xr(o,n,s){const h=o[0]-n[0],m=o[1]-n[1],x=o[0]-s[0],w=o[1]-s[1];return h*w-x*m==0&&h*x<=0&&m*w<=0}function mu(o,n,s,h){return(m=[h[0]-s[0],h[1]-s[1]])[0]*(x=[n[0]-o[0],n[1]-o[1]])[1]-m[1]*x[0]!=0&&!(!kp(o,n,s,h)||!kp(s,h,o,n));var m,x}function iy(o,n,s){for(const h of s)for(let m=0;m(m=o)[1]!=(w=b[E+1])[1]>m[1]&&m[0]<(w[0]-x[0])*(m[1]-x[1])/(w[1]-x[1])+x[0]&&(h=!h)}var m,x,w;return h}function oy(o,n){for(const s of n)if(ia(o,s))return!0;return!1}function Ep(o,n){for(const s of o)if(!ia(s,n))return!1;for(let s=0;s0&&b<0||w<0&&b>0}function ih(o,n,s){const h=[];for(let m=0;ms[2]){const m=.5*h;let x=o[0]-s[0]>m?-h:s[0]-o[0]>m?h:0;x===0&&(x=o[0]-s[2]>m?-h:s[2]-o[0]>m?h:0),o[0]+=x}ks(n,o)}function Ip(o,n,s,h){const m=Math.pow(2,h.z)*ko,x=[h.x*ko,h.y*ko],w=[];for(const b of o)for(const E of b){const I=[E.x+x[0],E.y+x[1]];Cp(I,n,s,m),w.push(I)}return w}function Pp(o,n,s,h){const m=Math.pow(2,h.z)*ko,x=[h.x*ko,h.y*ko],w=[];for(const E of o){const I=[];for(const M of E){const L=[M.x+x[0],M.y+x[1]];ks(n,L),I.push(L)}w.push(I)}if(n[2]-n[0]<=m/2){(b=n)[0]=b[1]=1/0,b[2]=b[3]=-1/0;for(const E of w)for(const I of E)Cp(I,n,s,m)}var b;return w}class Ts{constructor(n,s){this.type=Bt,this.geojson=n,this.geometries=s}static parse(n,s){if(n.length!==2)return s.error(`'within' expression requires exactly one argument, but found ${n.length-1} instead.`);if(bs(n[1])){const h=n[1];if(h.type==="FeatureCollection"){const m=[];for(const x of h.features){const{type:w,coordinates:b}=x.geometry;w==="Polygon"&&m.push(b),w==="MultiPolygon"&&m.push(...b)}if(m.length)return new Ts(h,{type:"MultiPolygon",coordinates:m})}else if(h.type==="Feature"){const m=h.geometry.type;if(m==="Polygon"||m==="MultiPolygon")return new Ts(h,h.geometry)}else if(h.type==="Polygon"||h.type==="MultiPolygon")return new Ts(h,h)}return s.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(n){if(n.geometry()!=null&&n.canonicalID()!=null){if(n.geometryType()==="Point")return function(s,h){const m=[1/0,1/0,-1/0,-1/0],x=[1/0,1/0,-1/0,-1/0],w=s.canonicalID();if(h.type==="Polygon"){const b=ih(h.coordinates,x,w),E=Ip(s.geometry(),m,x,w);if(!os(m,x))return!1;for(const I of E)if(!ia(I,b))return!1}if(h.type==="MultiPolygon"){const b=Tp(h.coordinates,x,w),E=Ip(s.geometry(),m,x,w);if(!os(m,x))return!1;for(const I of E)if(!oy(I,b))return!1}return!0}(n,this.geometries);if(n.geometryType()==="LineString")return function(s,h){const m=[1/0,1/0,-1/0,-1/0],x=[1/0,1/0,-1/0,-1/0],w=s.canonicalID();if(h.type==="Polygon"){const b=ih(h.coordinates,x,w),E=Pp(s.geometry(),m,x,w);if(!os(m,x))return!1;for(const I of E)if(!Ep(I,b))return!1}if(h.type==="MultiPolygon"){const b=Tp(h.coordinates,x,w),E=Pp(s.geometry(),m,x,w);if(!os(m,x))return!1;for(const I of E)if(!sy(I,b))return!1}return!0}(n,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let Ap=class{constructor(o=[],n=(s,h)=>sh?1:0){if(this.data=o,this.length=this.data.length,this.compare=n,this.length>0)for(let s=(this.length>>1)-1;s>=0;s--)this._down(s)}push(o){this.data.push(o),this._up(this.length++)}pop(){if(this.length===0)return;const o=this.data[0],n=this.data.pop();return--this.length>0&&(this.data[0]=n,this._down(0)),o}peek(){return this.data[0]}_up(o){const{data:n,compare:s}=this,h=n[o];for(;o>0;){const m=o-1>>1,x=n[m];if(s(h,x)>=0)break;n[o]=x,o=m}n[o]=h}_down(o){const{data:n,compare:s}=this,h=this.length>>1,m=n[o];for(;o=0)break;n[o]=n[x],o=x}n[o]=m}};function ay(o,n,s,h,m){Mp(o,n,s,h||o.length-1,m||ly)}function Mp(o,n,s,h,m){for(;h>s;){if(h-s>600){var x=h-s+1,w=n-s+1,b=Math.log(x),E=.5*Math.exp(2*b/3),I=.5*Math.sqrt(b*E*(x-E)/x)*(w-x/2<0?-1:1);Mp(o,n,Math.max(s,Math.floor(n-w*E/x+I)),Math.min(h,Math.floor(n+(x-w)*E/x+I)),m)}var M=o[n],L=s,j=h;for(cl(o,s,n),m(o[h],M)>0&&cl(o,s,h);L0;)j--}m(o[s],M)===0?cl(o,s,j):cl(o,++j,h),j<=n&&(s=j+1),n<=j&&(h=j-1)}}function cl(o,n,s){var h=o[n];o[n]=o[s],o[s]=h}function ly(o,n){return on?1:0}function gu(o,n){if(o.length<=1)return[o];const s=[];let h,m;for(const x of o){const w=cy(x);w!==0&&(x.area=Math.abs(w),m===void 0&&(m=w<0),m===w<0?(h&&s.push(h),h=[x]):h.push(x))}if(h&&s.push(h),n>1)for(let x=0;x1?(I=n[E+1][0],M=n[E+1][1]):W>0&&(I+=L/this.kx*W,M+=j/this.ky*W)),L=this.wrap(s[0]-I)*this.kx,j=(s[1]-M)*this.ky;const Y=L*L+j*j;Y180;)n-=360;return n}}function Lp(o,n){return n[0]-o[0]}function yu(o){return o[1]-o[0]+1}function jo(o,n){return o[1]>=o[0]&&o[1]o[1])return[null,null];const s=yu(o);if(n){if(s===2)return[o,null];const m=Math.floor(s/2);return[[o[0],o[0]+m],[o[0]+m,o[1]]]}if(s===1)return[o,null];const h=Math.floor(s/2)-1;return[[o[0],o[0]+h],[o[0]+h+1,o[1]]]}function ah(o,n){if(!jo(n,o.length))return[1/0,1/0,-1/0,-1/0];const s=[1/0,1/0,-1/0,-1/0];for(let h=n[0];h<=n[1];++h)ks(s,o[h]);return s}function lh(o){const n=[1/0,1/0,-1/0,-1/0];for(const s of o)for(const h of s)ks(n,h);return n}function _u(o){return o[0]!==-1/0&&o[1]!==-1/0&&o[2]!==1/0&&o[3]!==1/0}function uh(o,n,s){if(!_u(o)||!_u(n))return NaN;let h=0,m=0;return o[2]n[2]&&(h=o[0]-n[2]),o[1]>n[3]&&(m=o[1]-n[3]),o[3]=h)return h;if(os(m,x)){if(vu(o,n))return 0}else if(vu(n,o))return 0;let w=1/0;for(const b of o)for(let E=0,I=b.length,M=I-1;E0;){const E=w.pop();if(E[0]>=x)continue;const I=E[1],M=n?50:100;if(yu(I)<=M){if(!jo(I,o.length))return NaN;if(n){const L=er(o,I,s,h);if(isNaN(L)||L===0)return L;x=Math.min(x,L)}else for(let L=I[0];L<=I[1];++L){const j=dy(o[L],s,h);if(x=Math.min(x,j),x===0)return 0}}else{const L=sh(I,n);kr(w,x,h,o,b,L[0]),kr(w,x,h,o,b,L[1])}}return x}function dl(o,n,s,h,m,x=1/0){let w=Math.min(x,m.distance(o[0],s[0]));if(w===0)return w;const b=new Ap([[0,[0,o.length-1],[0,s.length-1]]],Lp);for(;b.length>0;){const E=b.pop();if(E[0]>=w)continue;const I=E[1],M=E[2],L=n?50:100,j=h?50:100;if(yu(I)<=L&&yu(M)<=j){if(!jo(I,o.length)&&jo(M,s.length))return NaN;let W;if(n&&h)W=hy(o,I,s,M,m),w=Math.min(w,W);else if(n&&!h){const Y=o.slice(I[0],I[1]+1);for(let J=M[0];J<=M[1];++J)if(W=Cs(s[J],Y,m),w=Math.min(w,W),w===0)return w}else if(!n&&h){const Y=s.slice(M[0],M[1]+1);for(let J=I[0];J<=I[1];++J)if(W=Cs(o[J],Y,m),w=Math.min(w,W),w===0)return w}else W=en(o,I,s,M,m),w=Math.min(w,W)}else{const W=sh(I,n),Y=sh(M,h);Is(b,w,m,o,s,W[0],Y[0]),Is(b,w,m,o,s,W[0],Y[1]),Is(b,w,m,o,s,W[1],Y[0]),Is(b,w,m,o,s,W[1],Y[1])}}return w}function hh(o){return o.type==="MultiPolygon"?o.coordinates.map(n=>({type:"Polygon",coordinates:n})):o.type==="MultiLineString"?o.coordinates.map(n=>({type:"LineString",coordinates:n})):o.type==="MultiPoint"?o.coordinates.map(n=>({type:"Point",coordinates:n})):[o]}class Ps{constructor(n,s){this.type=Qe,this.geojson=n,this.geometries=s}static parse(n,s){if(n.length!==2)return s.error(`'distance' expression requires exactly one argument, but found ${n.length-1} instead.`);if(bs(n[1])){const h=n[1];if(h.type==="FeatureCollection")return new Ps(h,h.features.map(m=>hh(m.geometry)).flat());if(h.type==="Feature")return new Ps(h,hh(h.geometry));if("type"in h&&"coordinates"in h)return new Ps(h,hh(h))}return s.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(n){if(n.geometry()!=null&&n.canonicalID()!=null){if(n.geometryType()==="Point")return function(s,h){const m=s.geometry(),x=m.flat().map(E=>nh([E.x,E.y],s.canonical));if(m.length===0)return NaN;const w=new oh(x[0][1]);let b=1/0;for(const E of h){switch(E.type){case"Point":b=Math.min(b,dl(x,!1,[E.coordinates],!1,w,b));break;case"LineString":b=Math.min(b,dl(x,!1,E.coordinates,!0,w,b));break;case"Polygon":b=Math.min(b,hl(x,!1,E.coordinates,w,b))}if(b===0)return b}return b}(n,this.geometries);if(n.geometryType()==="LineString")return function(s,h){const m=s.geometry(),x=m.flat().map(E=>nh([E.x,E.y],s.canonical));if(m.length===0)return NaN;const w=new oh(x[0][1]);let b=1/0;for(const E of h){switch(E.type){case"Point":b=Math.min(b,dl(x,!0,[E.coordinates],!1,w,b));break;case"LineString":b=Math.min(b,dl(x,!0,E.coordinates,!0,w,b));break;case"Polygon":b=Math.min(b,hl(x,!0,E.coordinates,w,b))}if(b===0)return b}return b}(n,this.geometries);if(n.geometryType()==="Polygon")return function(s,h){const m=s.geometry();if(m.length===0||m[0].length===0)return NaN;const x=gu(m,0).map(E=>E.map(I=>I.map(M=>nh([M.x,M.y],s.canonical)))),w=new oh(x[0][0][0][1]);let b=1/0;for(const E of h)for(const I of x){switch(E.type){case"Point":b=Math.min(b,hl([E.coordinates],!1,I,w,b));break;case"LineString":b=Math.min(b,hl(E.coordinates,!0,I,w,b));break;case"Polygon":b=Math.min(b,Ar(I,E.coordinates,w,b))}if(b===0)return b}return b}(n,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}const oa={"==":ey,"!=":wp,">":ty,"<":bp,">=":Sp,"<=":ry,array:Qi,at:Yc,boolean:Qi,case:uu,coalesce:du,collator:ul,format:fu,image:th,in:Jc,"index-of":ta,interpolate:ri,"interpolate-hcl":ri,"interpolate-lab":ri,length:rh,let:is,literal:Ji,match:Qc,number:Qi,"number-format":eh,object:Qi,slice:al,step:ra,string:Qi,"to-boolean":eo,"to-color":eo,"to-number":eo,"to-string":eo,var:yr,within:Ts,distance:Ps};class Li{constructor(n,s,h,m){this.name=n,this.type=s,this._evaluate=h,this.args=m}evaluate(n){return this._evaluate(n,this.args)}eachChild(n){this.args.forEach(n)}outputDefined(){return!1}static parse(n,s){const h=n[0],m=Li.definitions[h];if(!m)return s.error(`Unknown expression "${h}". If you wanted a literal array, use ["literal", [...]].`,0);const x=Array.isArray(m)?m[0]:m.type,w=Array.isArray(m)?[[m[1],m[2]]]:m.overloads,b=w.filter(([I])=>!Array.isArray(I)||I.length===n.length-1);let E=null;for(const[I,M]of b){E=new Ss(s.registry,pl,s.path,null,s.scope);const L=[];let j=!1;for(let W=1;W{return j=L,Array.isArray(j)?`(${j.map(G).join(", ")})`:`(${G(j.type)}...)`;var j}).join(" | "),M=[];for(let L=1;L{s=n?s&&pl(h):s&&h instanceof Ji}),!!s&&fl(o)&&ml(o,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function fl(o){if(o instanceof Li&&(o.name==="get"&&o.args.length===1||o.name==="feature-state"||o.name==="has"&&o.args.length===1||o.name==="properties"||o.name==="geometry-type"||o.name==="id"||/^filter-/.test(o.name))||o instanceof Ts||o instanceof Ps)return!1;let n=!0;return o.eachChild(s=>{n&&!fl(s)&&(n=!1)}),n}function sa(o){if(o instanceof Li&&o.name==="feature-state")return!1;let n=!0;return o.eachChild(s=>{n&&!sa(s)&&(n=!1)}),n}function ml(o,n){if(o instanceof Li&&n.indexOf(o.name)>=0)return!1;let s=!0;return o.eachChild(h=>{s&&!ml(h,n)&&(s=!1)}),s}function xu(o){return{result:"success",value:o}}function aa(o){return{result:"error",value:o}}function la(o){return o["property-type"]==="data-driven"||o["property-type"]==="cross-faded-data-driven"}function Fp(o){return!!o.expression&&o.expression.parameters.indexOf("zoom")>-1}function mh(o){return!!o.expression&&o.expression.interpolated}function fr(o){return o instanceof Number?"number":o instanceof String?"string":o instanceof Boolean?"boolean":Array.isArray(o)?"array":o===null?"null":typeof o}function wu(o){return typeof o=="object"&&o!==null&&!Array.isArray(o)}function py(o){return o}function Op(o,n){const s=n.type==="color",h=o.stops&&typeof o.stops[0][0]=="object",m=h||!(h||o.property!==void 0),x=o.type||(mh(n)?"exponential":"interval");if(s||n.type==="padding"){const M=s?Er.parse:mi.parse;(o=Gr({},o)).stops&&(o.stops=o.stops.map(L=>[L[0],M(L[1])])),o.default=M(o.default?o.default:n.default)}if(o.colorSpace&&(w=o.colorSpace)!=="rgb"&&w!=="hcl"&&w!=="lab")throw new Error(`Unknown color space: "${o.colorSpace}"`);var w;let b,E,I;if(x==="exponential")b=Np;else if(x==="interval")b=bu;else if(x==="categorical"){b=Bp,E=Object.create(null);for(const M of o.stops)E[M[0]]=M[1];I=typeof o.stops[0][0]}else{if(x!=="identity")throw new Error(`Unknown function type "${x}"`);b=$p}if(h){const M={},L=[];for(let Y=0;YY[0]),evaluate:({zoom:Y},J)=>Np({stops:j,base:o.base},n,Y).evaluate(Y,J)}}if(m){const M=x==="exponential"?{name:"exponential",base:o.base!==void 0?o.base:1}:null;return{kind:"camera",interpolationType:M,interpolationFactor:ri.interpolationFactor.bind(void 0,M),zoomStops:o.stops.map(L=>L[0]),evaluate:({zoom:L})=>b(o,n,L,E,I)}}return{kind:"source",evaluate(M,L){const j=L&&L.properties?L.properties[o.property]:void 0;return j===void 0?ua(o.default,n.default):b(o,n,j,E,I)}}}function ua(o,n,s){return o!==void 0?o:n!==void 0?n:s!==void 0?s:void 0}function Bp(o,n,s,h,m){return ua(typeof s===m?h[s]:void 0,o.default,n.default)}function bu(o,n,s){if(fr(s)!=="number")return ua(o.default,n.default);const h=o.stops.length;if(h===1||s<=o.stops[0][0])return o.stops[0][1];if(s>=o.stops[h-1][0])return o.stops[h-1][1];const m=cu(o.stops.map(x=>x[0]),s);return o.stops[m][1]}function Np(o,n,s){const h=o.base!==void 0?o.base:1;if(fr(s)!=="number")return ua(o.default,n.default);const m=o.stops.length;if(m===1||s<=o.stops[0][0])return o.stops[0][1];if(s>=o.stops[m-1][0])return o.stops[m-1][1];const x=cu(o.stops.map(M=>M[0]),s),w=function(M,L,j,W){const Y=W-j,J=M-j;return Y===0?0:L===1?J/Y:(Math.pow(L,J)-1)/(Math.pow(L,Y)-1)}(s,h,o.stops[x][0],o.stops[x+1][0]),b=o.stops[x][1],E=o.stops[x+1][1],I=ti[n.type]||py;return typeof b.evaluate=="function"?{evaluate(...M){const L=b.evaluate.apply(void 0,M),j=E.evaluate.apply(void 0,M);if(L!==void 0&&j!==void 0)return I(L,j,w,o.colorSpace)}}:I(b,E,w,o.colorSpace)}function $p(o,n,s){switch(n.type){case"color":s=Er.parse(s);break;case"formatted":s=fi.fromString(s.toString());break;case"resolvedImage":s=gi.fromString(s.toString());break;case"padding":s=mi.parse(s);break;default:fr(s)===n.type||n.type==="enum"&&n.values[s]||(s=void 0)}return ua(s,o.default,n.default)}Li.register(oa,{error:[{kind:"error"},[Wt],(o,[n])=>{throw new an(n.evaluate(o))}],typeof:[Wt,[Zt],(o,[n])=>G(pn(n.evaluate(o)))],"to-rgba":[Z(Qe,4),[jr],(o,[n])=>{const[s,h,m,x]=n.evaluate(o).rgb;return[255*s,255*h,255*m,x]}],rgb:[jr,[Qe,Qe,Qe],dh],rgba:[jr,[Qe,Qe,Qe,Qe],dh],has:{type:Bt,overloads:[[[Wt],(o,[n])=>ph(n.evaluate(o),o.properties())],[[Wt,ei],(o,[n,s])=>ph(n.evaluate(o),s.evaluate(o))]]},get:{type:Zt,overloads:[[[Wt],(o,[n])=>fh(n.evaluate(o),o.properties())],[[Wt,ei],(o,[n,s])=>fh(n.evaluate(o),s.evaluate(o))]]},"feature-state":[Zt,[Wt],(o,[n])=>fh(n.evaluate(o),o.featureState||{})],properties:[ei,[],o=>o.properties()],"geometry-type":[Wt,[],o=>o.geometryType()],id:[Zt,[],o=>o.id()],zoom:[Qe,[],o=>o.globals.zoom],"heatmap-density":[Qe,[],o=>o.globals.heatmapDensity||0],"line-progress":[Qe,[],o=>o.globals.lineProgress||0],accumulated:[Zt,[],o=>o.globals.accumulated===void 0?null:o.globals.accumulated],"+":[Qe,As(Qe),(o,n)=>{let s=0;for(const h of n)s+=h.evaluate(o);return s}],"*":[Qe,As(Qe),(o,n)=>{let s=1;for(const h of n)s*=h.evaluate(o);return s}],"-":{type:Qe,overloads:[[[Qe,Qe],(o,[n,s])=>n.evaluate(o)-s.evaluate(o)],[[Qe],(o,[n])=>-n.evaluate(o)]]},"/":[Qe,[Qe,Qe],(o,[n,s])=>n.evaluate(o)/s.evaluate(o)],"%":[Qe,[Qe,Qe],(o,[n,s])=>n.evaluate(o)%s.evaluate(o)],ln2:[Qe,[],()=>Math.LN2],pi:[Qe,[],()=>Math.PI],e:[Qe,[],()=>Math.E],"^":[Qe,[Qe,Qe],(o,[n,s])=>Math.pow(n.evaluate(o),s.evaluate(o))],sqrt:[Qe,[Qe],(o,[n])=>Math.sqrt(n.evaluate(o))],log10:[Qe,[Qe],(o,[n])=>Math.log(n.evaluate(o))/Math.LN10],ln:[Qe,[Qe],(o,[n])=>Math.log(n.evaluate(o))],log2:[Qe,[Qe],(o,[n])=>Math.log(n.evaluate(o))/Math.LN2],sin:[Qe,[Qe],(o,[n])=>Math.sin(n.evaluate(o))],cos:[Qe,[Qe],(o,[n])=>Math.cos(n.evaluate(o))],tan:[Qe,[Qe],(o,[n])=>Math.tan(n.evaluate(o))],asin:[Qe,[Qe],(o,[n])=>Math.asin(n.evaluate(o))],acos:[Qe,[Qe],(o,[n])=>Math.acos(n.evaluate(o))],atan:[Qe,[Qe],(o,[n])=>Math.atan(n.evaluate(o))],min:[Qe,As(Qe),(o,n)=>Math.min(...n.map(s=>s.evaluate(o)))],max:[Qe,As(Qe),(o,n)=>Math.max(...n.map(s=>s.evaluate(o)))],abs:[Qe,[Qe],(o,[n])=>Math.abs(n.evaluate(o))],round:[Qe,[Qe],(o,[n])=>{const s=n.evaluate(o);return s<0?-Math.round(-s):Math.round(s)}],floor:[Qe,[Qe],(o,[n])=>Math.floor(n.evaluate(o))],ceil:[Qe,[Qe],(o,[n])=>Math.ceil(n.evaluate(o))],"filter-==":[Bt,[Wt,Zt],(o,[n,s])=>o.properties()[n.value]===s.value],"filter-id-==":[Bt,[Zt],(o,[n])=>o.id()===n.value],"filter-type-==":[Bt,[Wt],(o,[n])=>o.geometryType()===n.value],"filter-<":[Bt,[Wt,Zt],(o,[n,s])=>{const h=o.properties()[n.value],m=s.value;return typeof h==typeof m&&h{const s=o.id(),h=n.value;return typeof s==typeof h&&s":[Bt,[Wt,Zt],(o,[n,s])=>{const h=o.properties()[n.value],m=s.value;return typeof h==typeof m&&h>m}],"filter-id->":[Bt,[Zt],(o,[n])=>{const s=o.id(),h=n.value;return typeof s==typeof h&&s>h}],"filter-<=":[Bt,[Wt,Zt],(o,[n,s])=>{const h=o.properties()[n.value],m=s.value;return typeof h==typeof m&&h<=m}],"filter-id-<=":[Bt,[Zt],(o,[n])=>{const s=o.id(),h=n.value;return typeof s==typeof h&&s<=h}],"filter->=":[Bt,[Wt,Zt],(o,[n,s])=>{const h=o.properties()[n.value],m=s.value;return typeof h==typeof m&&h>=m}],"filter-id->=":[Bt,[Zt],(o,[n])=>{const s=o.id(),h=n.value;return typeof s==typeof h&&s>=h}],"filter-has":[Bt,[Zt],(o,[n])=>n.value in o.properties()],"filter-has-id":[Bt,[],o=>o.id()!==null&&o.id()!==void 0],"filter-type-in":[Bt,[Z(Wt)],(o,[n])=>n.value.indexOf(o.geometryType())>=0],"filter-id-in":[Bt,[Z(Zt)],(o,[n])=>n.value.indexOf(o.id())>=0],"filter-in-small":[Bt,[Wt,Z(Zt)],(o,[n,s])=>s.value.indexOf(o.properties()[n.value])>=0],"filter-in-large":[Bt,[Wt,Z(Zt)],(o,[n,s])=>function(h,m,x,w){for(;x<=w;){const b=x+w>>1;if(m[b]===h)return!0;m[b]>h?w=b-1:x=b+1}return!1}(o.properties()[n.value],s.value,0,s.value.length-1)],all:{type:Bt,overloads:[[[Bt,Bt],(o,[n,s])=>n.evaluate(o)&&s.evaluate(o)],[As(Bt),(o,n)=>{for(const s of n)if(!s.evaluate(o))return!1;return!0}]]},any:{type:Bt,overloads:[[[Bt,Bt],(o,[n,s])=>n.evaluate(o)||s.evaluate(o)],[As(Bt),(o,n)=>{for(const s of n)if(s.evaluate(o))return!0;return!1}]]},"!":[Bt,[Bt],(o,[n])=>!n.evaluate(o)],"is-supported-script":[Bt,[Wt],(o,[n])=>{const s=o.globals&&o.globals.isSupportedScript;return!s||s(n.evaluate(o))}],upcase:[Wt,[Wt],(o,[n])=>n.evaluate(o).toUpperCase()],downcase:[Wt,[Wt],(o,[n])=>n.evaluate(o).toLowerCase()],concat:[Wt,As(Zt),(o,n)=>n.map(s=>sl(s.evaluate(o))).join("")],"resolved-locale":[Wt,[Di],(o,[n])=>n.evaluate(o).resolvedLocale()]});class Su{constructor(n,s){var h;this.expression=n,this._warningHistory={},this._evaluator=new lu,this._defaultValue=s?(h=s).type==="color"&&wu(h.default)?new Er(0,0,0,0):h.type==="color"?Er.parse(h.default)||null:h.type==="padding"?mi.parse(h.default)||null:h.type==="variableAnchorOffsetCollection"?Ri.parse(h.default)||null:h.default===void 0?null:h.default:null,this._enumValues=s&&s.type==="enum"?s.values:null}evaluateWithoutErrorHandling(n,s,h,m,x,w){return this._evaluator.globals=n,this._evaluator.feature=s,this._evaluator.featureState=h,this._evaluator.canonical=m,this._evaluator.availableImages=x||null,this._evaluator.formattedSection=w,this.expression.evaluate(this._evaluator)}evaluate(n,s,h,m,x,w){this._evaluator.globals=n,this._evaluator.feature=s||null,this._evaluator.featureState=h||null,this._evaluator.canonical=m,this._evaluator.availableImages=x||null,this._evaluator.formattedSection=w||null;try{const b=this.expression.evaluate(this._evaluator);if(b==null||typeof b=="number"&&b!=b)return this._defaultValue;if(this._enumValues&&!(b in this._enumValues))throw new an(`Expected value to be one of ${Object.keys(this._enumValues).map(E=>JSON.stringify(E)).join(", ")}, but found ${JSON.stringify(b)} instead.`);return b}catch(b){return this._warningHistory[b.message]||(this._warningHistory[b.message]=!0,typeof console<"u"&&console.warn(b.message)),this._defaultValue}}}function Eu(o){return Array.isArray(o)&&o.length>0&&typeof o[0]=="string"&&o[0]in oa}function ca(o,n){const s=new Ss(oa,pl,[],n?function(m){const x={color:jr,string:Wt,number:Qe,enum:Wt,boolean:Bt,formatted:Ki,padding:Yi,resolvedImage:Pn,variableAnchorOffsetCollection:he};return m.type==="array"?Z(x[m.value]||Zt,m.length):x[m.type]}(n):void 0),h=s.parse(o,void 0,void 0,void 0,n&&n.type==="string"?{typeAnnotation:"coerce"}:void 0);return h?xu(new Su(h,n)):aa(s.errors)}class ha{constructor(n,s){this.kind=n,this._styleExpression=s,this.isStateDependent=n!=="constant"&&!sa(s.expression)}evaluateWithoutErrorHandling(n,s,h,m,x,w){return this._styleExpression.evaluateWithoutErrorHandling(n,s,h,m,x,w)}evaluate(n,s,h,m,x,w){return this._styleExpression.evaluate(n,s,h,m,x,w)}}class da{constructor(n,s,h,m){this.kind=n,this.zoomStops=h,this._styleExpression=s,this.isStateDependent=n!=="camera"&&!sa(s.expression),this.interpolationType=m}evaluateWithoutErrorHandling(n,s,h,m,x,w){return this._styleExpression.evaluateWithoutErrorHandling(n,s,h,m,x,w)}evaluate(n,s,h,m,x,w){return this._styleExpression.evaluate(n,s,h,m,x,w)}interpolationFactor(n,s,h){return this.interpolationType?ri.interpolationFactor(this.interpolationType,n,s,h):0}}function gh(o,n){const s=ca(o,n);if(s.result==="error")return s;const h=s.value.expression,m=fl(h);if(!m&&!la(n))return aa([new on("","data expressions not supported")]);const x=ml(h,["zoom"]);if(!x&&!Fp(n))return aa([new on("","zoom expressions not supported")]);const w=gl(h);return w||x?w instanceof on?aa([w]):w instanceof ri&&!mh(n)?aa([new on("",'"interpolate" expressions cannot be used with this property')]):xu(w?new da(m?"camera":"composite",s.value,w.labels,w instanceof ri?w.interpolation:void 0):new ha(m?"constant":"source",s.value)):aa([new on("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class pa{constructor(n,s){this._parameters=n,this._specification=s,Gr(this,Op(this._parameters,this._specification))}static deserialize(n){return new pa(n._parameters,n._specification)}static serialize(n){return{_parameters:n._parameters,_specification:n._specification}}}function gl(o){let n=null;if(o instanceof is)n=gl(o.result);else if(o instanceof du){for(const s of o.args)if(n=gl(s),n)break}else(o instanceof ra||o instanceof ri)&&o.input instanceof Li&&o.input.name==="zoom"&&(n=o);return n instanceof on||o.eachChild(s=>{const h=gl(s);h instanceof on?n=h:!n&&h?n=new on("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):n&&h&&n!==h&&(n=new on("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),n}function ku(o){if(o===!0||o===!1)return!0;if(!Array.isArray(o)||o.length===0)return!1;switch(o[0]){case"has":return o.length>=2&&o[1]!=="$id"&&o[1]!=="$type";case"in":return o.length>=3&&(typeof o[1]!="string"||Array.isArray(o[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return o.length!==3||Array.isArray(o[1])||Array.isArray(o[2]);case"any":case"all":for(const n of o.slice(1))if(!ku(n)&&typeof n!="boolean")return!1;return!0;default:return!0}}const Tu={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function yh(o){if(o==null)return{filter:()=>!0,needGeometry:!1};ku(o)||(o=Cu(o));const n=ca(o,Tu);if(n.result==="error")throw new Error(n.value.map(s=>`${s.key}: ${s.message}`).join(", "));return{filter:(s,h,m)=>n.value.evaluate(s,h,{},m),needGeometry:jp(o)}}function fy(o,n){return on?1:0}function jp(o){if(!Array.isArray(o))return!1;if(o[0]==="within"||o[0]==="distance")return!0;for(let n=1;n"||n==="<="||n===">="?_h(o[1],o[2],n):n==="any"?(s=o.slice(1),["any"].concat(s.map(Cu))):n==="all"?["all"].concat(o.slice(1).map(Cu)):n==="none"?["all"].concat(o.slice(1).map(Cu).map(An)):n==="in"?yl(o[1],o.slice(2)):n==="!in"?An(yl(o[1],o.slice(2))):n==="has"?_l(o[1]):n!=="!has"||An(_l(o[1]));var s}function _h(o,n,s){switch(o){case"$type":return[`filter-type-${s}`,n];case"$id":return[`filter-id-${s}`,n];default:return[`filter-${s}`,o,n]}}function yl(o,n){if(n.length===0)return!1;switch(o){case"$type":return["filter-type-in",["literal",n]];case"$id":return["filter-id-in",["literal",n]];default:return n.length>200&&!n.some(s=>typeof s!=typeof n[0])?["filter-in-large",o,["literal",n.sort(fy)]]:["filter-in-small",o,["literal",n]]}}function _l(o){switch(o){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",o]}}function An(o){return["!",o]}function Ms(o){const n=typeof o;if(n==="number"||n==="boolean"||n==="string"||o==null)return JSON.stringify(o);if(Array.isArray(o)){let m="[";for(const x of o)m+=`${Ms(x)},`;return`${m}]`}const s=Object.keys(o).sort();let h="{";for(let m=0;mh.maximum?[new We(n,s,`${s} is greater than the maximum value ${h.maximum}`)]:[]}function Iu(o){const n=o.valueSpec,s=tn(o.value.type);let h,m,x,w={};const b=s!=="categorical"&&o.value.property===void 0,E=!b,I=fr(o.value.stops)==="array"&&fr(o.value.stops[0])==="array"&&fr(o.value.stops[0][0])==="object",M=yi({key:o.key,value:o.value,valueSpec:o.styleSpec.function,validateSpec:o.validateSpec,style:o.style,styleSpec:o.styleSpec,objectElementValidators:{stops:function(W){if(s==="identity")return[new We(W.key,W.value,'identity function may not have a "stops" property')];let Y=[];const J=W.value;return Y=Y.concat(vl({key:W.key,value:J,valueSpec:W.valueSpec,validateSpec:W.validateSpec,style:W.style,styleSpec:W.styleSpec,arrayElementValidator:L})),fr(J)==="array"&&J.length===0&&Y.push(new We(W.key,J,"array must have at least one stop")),Y},default:function(W){return W.validateSpec({key:W.key,value:W.value,valueSpec:n,validateSpec:W.validateSpec,style:W.style,styleSpec:W.styleSpec})}}});return s==="identity"&&b&&M.push(new We(o.key,o.value,'missing required property "property"')),s==="identity"||o.value.stops||M.push(new We(o.key,o.value,'missing required property "stops"')),s==="exponential"&&o.valueSpec.expression&&!mh(o.valueSpec)&&M.push(new We(o.key,o.value,"exponential functions not supported")),o.styleSpec.$version>=8&&(E&&!la(o.valueSpec)?M.push(new We(o.key,o.value,"property functions not supported")):b&&!Fp(o.valueSpec)&&M.push(new We(o.key,o.value,"zoom functions not supported"))),s!=="categorical"&&!I||o.value.property!==void 0||M.push(new We(o.key,o.value,'"property" property is required')),M;function L(W){let Y=[];const J=W.value,le=W.key;if(fr(J)!=="array")return[new We(le,J,`array expected, ${fr(J)} found`)];if(J.length!==2)return[new We(le,J,`array length 2 expected, length ${J.length} found`)];if(I){if(fr(J[0])!=="object")return[new We(le,J,`object expected, ${fr(J[0])} found`)];if(J[0].zoom===void 0)return[new We(le,J,"object stop key must have zoom")];if(J[0].value===void 0)return[new We(le,J,"object stop key must have value")];if(x&&x>tn(J[0].zoom))return[new We(le,J[0].zoom,"stop zoom values must appear in ascending order")];tn(J[0].zoom)!==x&&(x=tn(J[0].zoom),m=void 0,w={}),Y=Y.concat(yi({key:`${le}[0]`,value:J[0],valueSpec:{zoom:{}},validateSpec:W.validateSpec,style:W.style,styleSpec:W.styleSpec,objectElementValidators:{zoom:vh,value:j}}))}else Y=Y.concat(j({key:`${le}[0]`,value:J[0],valueSpec:{},validateSpec:W.validateSpec,style:W.style,styleSpec:W.styleSpec},J));return Eu(to(J[1]))?Y.concat([new We(`${le}[1]`,J[1],"expressions are not allowed in function stops.")]):Y.concat(W.validateSpec({key:`${le}[1]`,value:J[1],valueSpec:n,validateSpec:W.validateSpec,style:W.style,styleSpec:W.styleSpec}))}function j(W,Y){const J=fr(W.value),le=tn(W.value),pe=W.value!==null?W.value:Y;if(h){if(J!==h)return[new We(W.key,pe,`${J} stop domain type must match previous stop domain type ${h}`)]}else h=J;if(J!=="number"&&J!=="string"&&J!=="boolean")return[new We(W.key,pe,"stop domain value must be a number, string, or boolean")];if(J!=="number"&&s!=="categorical"){let ze=`number expected, ${J} found`;return la(n)&&s===void 0&&(ze+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new We(W.key,pe,ze)]}return s!=="categorical"||J!=="number"||isFinite(le)&&Math.floor(le)===le?s!=="categorical"&&J==="number"&&m!==void 0&&lenew We(`${o.key}${h.key}`,o.value,h.message));const s=n.value.expression||n.value._styleExpression.expression;if(o.expressionContext==="property"&&o.propertyKey==="text-font"&&!s.outputDefined())return[new We(o.key,o.value,`Invalid data expression for "${o.propertyKey}". Output values must be contained as literals within the expression.`)];if(o.expressionContext==="property"&&o.propertyType==="layout"&&!sa(s))return[new We(o.key,o.value,'"feature-state" data expressions are not supported with layout properties.')];if(o.expressionContext==="filter"&&!sa(s))return[new We(o.key,o.value,'"feature-state" data expressions are not supported with filters.')];if(o.expressionContext&&o.expressionContext.indexOf("cluster")===0){if(!ml(s,["zoom","feature-state"]))return[new We(o.key,o.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(o.expressionContext==="cluster-initial"&&!fl(s))return[new We(o.key,o.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Uo(o){const n=o.key,s=o.value,h=o.valueSpec,m=[];return Array.isArray(h.values)?h.values.indexOf(tn(s))===-1&&m.push(new We(n,s,`expected one of [${h.values.join(", ")}], ${JSON.stringify(s)} found`)):Object.keys(h.values).indexOf(tn(s))===-1&&m.push(new We(n,s,`expected one of [${Object.keys(h.values).join(", ")}], ${JSON.stringify(s)} found`)),m}function xh(o){return ku(to(o.value))?fa(Gr({},o,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Pu(o)}function Pu(o){const n=o.value,s=o.key;if(fr(n)!=="array")return[new We(s,n,`array expected, ${fr(n)} found`)];const h=o.styleSpec;let m,x=[];if(n.length<1)return[new We(s,n,"filter array must have at least 1 element")];switch(x=x.concat(Uo({key:`${s}[0]`,value:n[0],valueSpec:h.filter_operator,style:o.style,styleSpec:o.styleSpec})),tn(n[0])){case"<":case"<=":case">":case">=":n.length>=2&&tn(n[1])==="$type"&&x.push(new We(s,n,`"$type" cannot be use with operator "${n[0]}"`));case"==":case"!=":n.length!==3&&x.push(new We(s,n,`filter array for operator "${n[0]}" must have 3 elements`));case"in":case"!in":n.length>=2&&(m=fr(n[1]),m!=="string"&&x.push(new We(`${s}[1]`,n[1],`string expected, ${m} found`)));for(let w=2;w{I in s&&n.push(new We(h,s[I],`"${I}" is prohibited for ref layers`))}),m.layers.forEach(I=>{tn(I.id)===b&&(E=I)}),E?E.ref?n.push(new We(h,s.ref,"ref cannot reference another ref layer")):w=tn(E.type):n.push(new We(h,s.ref,`ref layer "${b}" not found`))}else if(w!=="background")if(s.source){const E=m.sources&&m.sources[s.source],I=E&&tn(E.type);E?I==="vector"&&w==="raster"?n.push(new We(h,s.source,`layer "${s.id}" requires a raster source`)):I!=="raster-dem"&&w==="hillshade"?n.push(new We(h,s.source,`layer "${s.id}" requires a raster-dem source`)):I==="raster"&&w!=="raster"?n.push(new We(h,s.source,`layer "${s.id}" requires a vector source`)):I!=="vector"||s["source-layer"]?I==="raster-dem"&&w!=="hillshade"?n.push(new We(h,s.source,"raster-dem source can only be used with layer type 'hillshade'.")):w!=="line"||!s.paint||!s.paint["line-gradient"]||I==="geojson"&&E.lineMetrics||n.push(new We(h,s,`layer "${s.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):n.push(new We(h,s,`layer "${s.id}" must specify a "source-layer"`)):n.push(new We(h,s.source,`source "${s.source}" not found`))}else n.push(new We(h,s,'missing required property "source"'));return n=n.concat(yi({key:h,value:s,valueSpec:x.layer,style:o.style,styleSpec:o.styleSpec,validateSpec:o.validateSpec,objectElementValidators:{"*":()=>[],type:()=>o.validateSpec({key:`${h}.type`,value:s.type,valueSpec:x.layer.type,style:o.style,styleSpec:o.styleSpec,validateSpec:o.validateSpec,object:s,objectKey:"type"}),filter:xh,layout:E=>yi({layer:s,key:E.key,value:E.value,style:E.style,styleSpec:E.styleSpec,validateSpec:E.validateSpec,objectElementValidators:{"*":I=>bh(Gr({layerType:w},I))}}),paint:E=>yi({layer:s,key:E.key,value:E.value,style:E.style,styleSpec:E.styleSpec,validateSpec:E.validateSpec,objectElementValidators:{"*":I=>Au(Gr({layerType:w},I))}})}})),n}function zs(o){const n=o.value,s=o.key,h=fr(n);return h!=="string"?[new We(s,n,`string expected, ${h} found`)]:[]}const Mu={promoteId:function({key:o,value:n}){if(fr(n)==="string")return zs({key:o,value:n});{const s=[];for(const h in n)s.push(...zs({key:`${o}.${h}`,value:n[h]}));return s}}};function xl(o){const n=o.value,s=o.key,h=o.styleSpec,m=o.style,x=o.validateSpec;if(!n.type)return[new We(s,n,'"type" is required')];const w=tn(n.type);let b;switch(w){case"vector":case"raster":return b=yi({key:s,value:n,valueSpec:h[`source_${w.replace("-","_")}`],style:o.style,styleSpec:h,objectElementValidators:Mu,validateSpec:x}),b;case"raster-dem":return b=function(E){var I;const M=(I=E.sourceName)!==null&&I!==void 0?I:"",L=E.value,j=E.styleSpec,W=j.source_raster_dem,Y=E.style;let J=[];const le=fr(L);if(L===void 0)return J;if(le!=="object")return J.push(new We("source_raster_dem",L,`object expected, ${le} found`)),J;const pe=tn(L.encoding)==="custom",ze=["redFactor","greenFactor","blueFactor","baseShift"],be=E.value.encoding?`"${E.value.encoding}"`:"Default";for(const Ae in L)!pe&&ze.includes(Ae)?J.push(new We(Ae,L[Ae],`In "${M}": "${Ae}" is only valid when "encoding" is set to "custom". ${be} encoding found`)):W[Ae]?J=J.concat(E.validateSpec({key:Ae,value:L[Ae],valueSpec:W[Ae],validateSpec:E.validateSpec,style:Y,styleSpec:j})):J.push(new We(Ae,L[Ae],`unknown property "${Ae}"`));return J}({sourceName:s,value:n,style:o.style,styleSpec:h,validateSpec:x}),b;case"geojson":if(b=yi({key:s,value:n,valueSpec:h.source_geojson,style:m,styleSpec:h,validateSpec:x,objectElementValidators:Mu}),n.cluster)for(const E in n.clusterProperties){const[I,M]=n.clusterProperties[E],L=typeof I=="string"?[I,["accumulated"],["get",E]]:I;b.push(...fa({key:`${s}.${E}.map`,value:M,validateSpec:x,expressionContext:"cluster-map"})),b.push(...fa({key:`${s}.${E}.reduce`,value:L,validateSpec:x,expressionContext:"cluster-reduce"}))}return b;case"video":return yi({key:s,value:n,valueSpec:h.source_video,style:m,validateSpec:x,styleSpec:h});case"image":return yi({key:s,value:n,valueSpec:h.source_image,style:m,validateSpec:x,styleSpec:h});case"canvas":return[new We(s,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Uo({key:`${s}.type`,value:n.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:m,validateSpec:x,styleSpec:h})}}function Eh(o){const n=o.value,s=o.styleSpec,h=s.light,m=o.style;let x=[];const w=fr(n);if(n===void 0)return x;if(w!=="object")return x=x.concat([new We("light",n,`object expected, ${w} found`)]),x;for(const b in n){const E=b.match(/^(.*)-transition$/);x=x.concat(E&&h[E[1]]&&h[E[1]].transition?o.validateSpec({key:b,value:n[b],valueSpec:s.transition,validateSpec:o.validateSpec,style:m,styleSpec:s}):h[b]?o.validateSpec({key:b,value:n[b],valueSpec:h[b],validateSpec:o.validateSpec,style:m,styleSpec:s}):[new We(b,n[b],`unknown property "${b}"`)])}return x}function kh(o){const n=o.value,s=o.styleSpec,h=s.sky,m=o.style,x=fr(n);if(n===void 0)return[];if(x!=="object")return[new We("sky",n,`object expected, ${x} found`)];let w=[];for(const b in n)w=w.concat(h[b]?o.validateSpec({key:b,value:n[b],valueSpec:h[b],style:m,styleSpec:s}):[new We(b,n[b],`unknown property "${b}"`)]);return w}function Th(o){const n=o.value,s=o.styleSpec,h=s.terrain,m=o.style;let x=[];const w=fr(n);if(n===void 0)return x;if(w!=="object")return x=x.concat([new We("terrain",n,`object expected, ${w} found`)]),x;for(const b in n)x=x.concat(h[b]?o.validateSpec({key:b,value:n[b],valueSpec:h[b],validateSpec:o.validateSpec,style:m,styleSpec:s}):[new We(b,n[b],`unknown property "${b}"`)]);return x}function Ch(o){let n=[];const s=o.value,h=o.key;if(Array.isArray(s)){const m=[],x=[];for(const w in s)s[w].id&&m.includes(s[w].id)&&n.push(new We(h,s,`all the sprites' ids must be unique, but ${s[w].id} is duplicated`)),m.push(s[w].id),s[w].url&&x.includes(s[w].url)&&n.push(new We(h,s,`all the sprites' URLs must be unique, but ${s[w].url} is duplicated`)),x.push(s[w].url),n=n.concat(yi({key:`${h}[${w}]`,value:s[w],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:o.validateSpec}));return n}return zs({key:h,value:s})}const zu={"*":()=>[],array:vl,boolean:function(o){const n=o.value,s=o.key,h=fr(n);return h!=="boolean"?[new We(s,n,`boolean expected, ${h} found`)]:[]},number:vh,color:function(o){const n=o.key,s=o.value,h=fr(s);return h!=="string"?[new We(n,s,`color expected, ${h} found`)]:Er.parse(String(s))?[]:[new We(n,s,`color expected, "${s}" found`)]},constants:Vp,enum:Uo,filter:xh,function:Iu,layer:Sh,object:yi,source:xl,light:Eh,sky:kh,terrain:Th,projection:function(o){const n=o.value,s=o.styleSpec,h=s.projection,m=o.style,x=fr(n);if(n===void 0)return[];if(x!=="object")return[new We("projection",n,`object expected, ${x} found`)];let w=[];for(const b in n)w=w.concat(h[b]?o.validateSpec({key:b,value:n[b],valueSpec:h[b],style:m,styleSpec:s}):[new We(b,n[b],`unknown property "${b}"`)]);return w},string:zs,formatted:function(o){return zs(o).length===0?[]:fa(o)},resolvedImage:function(o){return zs(o).length===0?[]:fa(o)},padding:function(o){const n=o.key,s=o.value;if(fr(s)==="array"){if(s.length<1||s.length>4)return[new We(n,s,`padding requires 1 to 4 values; ${s.length} values found`)];const h={type:"number"};let m=[];for(let x=0;x[]}})),o.constants&&(s=s.concat(Vp({key:"constants",value:o.constants,style:o,styleSpec:n,validateSpec:ma}))),Ih(s)}function To(o){return function(n){return o({...n,validateSpec:ma})}}function Ih(o){return[].concat(o).sort((n,s)=>n.line-s.line)}function ro(o){return function(...n){return Ih(o.apply(this,n))}}Fi.source=ro(To(xl)),Fi.sprite=ro(To(Ch)),Fi.glyphs=ro(To(Hp)),Fi.light=ro(To(Eh)),Fi.sky=ro(To(kh)),Fi.terrain=ro(To(Th)),Fi.layer=ro(To(Sh)),Fi.filter=ro(To(xh)),Fi.paintProperty=ro(To(Au)),Fi.layoutProperty=ro(To(bh));const Ds=Fi,my=Ds.light,gy=Ds.sky,Gp=Ds.paintProperty,Zp=Ds.layoutProperty;function Ph(o,n){let s=!1;if(n&&n.length)for(const h of n)o.fire(new V(new Error(h.message))),s=!0;return s}class ga{constructor(n,s,h){const m=this.cells=[];if(n instanceof ArrayBuffer){this.arrayBuffer=n;const w=new Int32Array(this.arrayBuffer);n=w[0],this.d=(s=w[1])+2*(h=w[2]);for(let E=0;E=L[Y+0]&&m>=L[Y+1])?(b[W]=!0,w.push(M[W])):b[W]=!1}}}}_forEachCell(n,s,h,m,x,w,b,E){const I=this._convertToCellCoord(n),M=this._convertToCellCoord(s),L=this._convertToCellCoord(h),j=this._convertToCellCoord(m);for(let W=I;W<=L;W++)for(let Y=M;Y<=j;Y++){const J=this.d*Y+W;if((!E||E(this._convertFromCellCoord(W),this._convertFromCellCoord(Y),this._convertFromCellCoord(W+1),this._convertFromCellCoord(Y+1)))&&x.call(this,n,s,h,m,J,w,b,E))return}}_convertFromCellCoord(n){return(n-this.padding)/this.scale}_convertToCellCoord(n){return Math.max(0,Math.min(this.d-1,Math.floor(n*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const n=this.cells,s=3+this.cells.length+1+1;let h=0;for(let w=0;w=0)continue;const w=o[x];m[x]=Oi[s].shallow.indexOf(x)>=0?w:ya(w,n)}o instanceof Error&&(m.message=o.message)}if(m.$name)throw new Error("$name property is reserved for worker serialization logic.");return s!=="Object"&&(m.$name=s),m}function _a(o){if(Wp(o))return o;if(Array.isArray(o))return o.map(_a);if(typeof o!="object")throw new Error("can't deserialize object of type "+typeof o);const n=Ah(o)||"Object";if(!Oi[n])throw new Error(`can't deserialize unregistered class ${n}`);const{klass:s}=Oi[n];if(!s)throw new Error(`can't deserialize unregistered class ${n}`);if(s.deserialize)return s.deserialize(o);const h=Object.create(s.prototype);for(const m of Object.keys(o)){if(m==="$name")continue;const x=o[m];h[m]=Oi[n].shallow.indexOf(m)>=0?x:_a(x)}return h}class Mh{constructor(){this.first=!0}update(n,s){const h=Math.floor(n);return this.first?(this.first=!1,this.lastIntegerZoom=h,this.lastIntegerZoomTime=0,this.lastZoom=n,this.lastFloorZoom=h,!0):(this.lastFloorZoom>h?(this.lastIntegerZoom=h+1,this.lastIntegerZoomTime=s):this.lastFloorZoomo>=128&&o<=255,"Hangul Jamo":o=>o>=4352&&o<=4607,Khmer:o=>o>=6016&&o<=6143,"General Punctuation":o=>o>=8192&&o<=8303,"Letterlike Symbols":o=>o>=8448&&o<=8527,"Number Forms":o=>o>=8528&&o<=8591,"Miscellaneous Technical":o=>o>=8960&&o<=9215,"Control Pictures":o=>o>=9216&&o<=9279,"Optical Character Recognition":o=>o>=9280&&o<=9311,"Enclosed Alphanumerics":o=>o>=9312&&o<=9471,"Geometric Shapes":o=>o>=9632&&o<=9727,"Miscellaneous Symbols":o=>o>=9728&&o<=9983,"Miscellaneous Symbols and Arrows":o=>o>=11008&&o<=11263,"Ideographic Description Characters":o=>o>=12272&&o<=12287,"CJK Symbols and Punctuation":o=>o>=12288&&o<=12351,Katakana:o=>o>=12448&&o<=12543,Kanbun:o=>o>=12688&&o<=12703,"CJK Strokes":o=>o>=12736&&o<=12783,"Enclosed CJK Letters and Months":o=>o>=12800&&o<=13055,"CJK Compatibility":o=>o>=13056&&o<=13311,"Yijing Hexagram Symbols":o=>o>=19904&&o<=19967,"Private Use Area":o=>o>=57344&&o<=63743,"Vertical Forms":o=>o>=65040&&o<=65055,"CJK Compatibility Forms":o=>o>=65072&&o<=65103,"Small Form Variants":o=>o>=65104&&o<=65135,"Halfwidth and Fullwidth Forms":o=>o>=65280&&o<=65519};function zh(o){for(const n of o)if(Rh(n.charCodeAt(0)))return!0;return!1}function yy(o){for(const n of o)if(!va(n.charCodeAt(0)))return!1;return!0}function Dh(o){const n=o.map(s=>{try{return new RegExp(`\\p{sc=${s}}`,"u").source}catch{return null}}).filter(s=>s);return new RegExp(n.join("|"),"u")}const _y=Dh(["Arab","Dupl","Mong","Ougr","Syrc"]);function va(o){return!_y.test(String.fromCodePoint(o))}const qp=Dh(["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"]);function Rh(o){return!(o!==746&&o!==747&&(o<4352||!(ir["CJK Compatibility Forms"](o)&&!(o>=65097&&o<=65103)||ir["CJK Compatibility"](o)||ir["CJK Strokes"](o)||!(!ir["CJK Symbols and Punctuation"](o)||o>=12296&&o<=12305||o>=12308&&o<=12319||o===12336)||ir["Enclosed CJK Letters and Months"](o)||ir["Ideographic Description Characters"](o)||ir.Kanbun(o)||ir.Katakana(o)&&o!==12540||!(!ir["Halfwidth and Fullwidth Forms"](o)||o===65288||o===65289||o===65293||o>=65306&&o<=65310||o===65339||o===65341||o===65343||o>=65371&&o<=65503||o===65507||o>=65512&&o<=65519)||!(!ir["Small Form Variants"](o)||o>=65112&&o<=65118||o>=65123&&o<=65126)||ir["Vertical Forms"](o)||ir["Yijing Hexagram Symbols"](o)||new RegExp("\\p{sc=Cans}","u").test(String.fromCodePoint(o))||new RegExp("\\p{sc=Hang}","u").test(String.fromCodePoint(o))||qp.test(String.fromCodePoint(o)))))}function Xp(o){return!(Rh(o)||function(n){return!!(ir["Latin-1 Supplement"](n)&&(n===167||n===169||n===174||n===177||n===188||n===189||n===190||n===215||n===247)||ir["General Punctuation"](n)&&(n===8214||n===8224||n===8225||n===8240||n===8241||n===8251||n===8252||n===8258||n===8263||n===8264||n===8265||n===8273)||ir["Letterlike Symbols"](n)||ir["Number Forms"](n)||ir["Miscellaneous Technical"](n)&&(n>=8960&&n<=8967||n>=8972&&n<=8991||n>=8996&&n<=9e3||n===9003||n>=9085&&n<=9114||n>=9150&&n<=9165||n===9167||n>=9169&&n<=9179||n>=9186&&n<=9215)||ir["Control Pictures"](n)&&n!==9251||ir["Optical Character Recognition"](n)||ir["Enclosed Alphanumerics"](n)||ir["Geometric Shapes"](n)||ir["Miscellaneous Symbols"](n)&&!(n>=9754&&n<=9759)||ir["Miscellaneous Symbols and Arrows"](n)&&(n>=11026&&n<=11055||n>=11088&&n<=11097||n>=11192&&n<=11243)||ir["CJK Symbols and Punctuation"](n)||ir.Katakana(n)||ir["Private Use Area"](n)||ir["CJK Compatibility Forms"](n)||ir["Small Form Variants"](n)||ir["Halfwidth and Fullwidth Forms"](n)||n===8734||n===8756||n===8757||n>=9984&&n<=10087||n>=10102&&n<=10131||n===65532||n===65533)}(o))}const vy=Dh(["Adlm","Arab","Armi","Avst","Chrs","Cprt","Egyp","Elym","Gara","Hatr","Hebr","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogo","Syrc","Thaa","Todr","Yezi"]);function Lh(o){return vy.test(String.fromCodePoint(o))}function xy(o,n){return!(!n&&Lh(o)||o>=2304&&o<=3583||o>=3840&&o<=4255||ir.Khmer(o))}function wy(o){for(const n of o)if(Lh(n.charCodeAt(0)))return!0;return!1}const _i=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null}setState(o){this.pluginStatus=o.pluginStatus,this.pluginURL=o.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(o){this.applyArabicShaping=o.applyArabicShaping,this.processBidirectionalText=o.processBidirectionalText,this.processStyledBidirectionalText=o.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class Rr{constructor(n,s){this.zoom=n,s?(this.now=s.now,this.fadeDuration=s.fadeDuration,this.zoomHistory=s.zoomHistory,this.transition=s.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Mh,this.transition={})}isSupportedScript(n){return function(s,h){for(const m of s)if(!xy(m.charCodeAt(0),h))return!1;return!0}(n,_i.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const n=this.zoom,s=n-Math.floor(n),h=this.crossFadingFactor();return n>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:s+(1-s)*h}:{fromScale:.5,toScale:1,t:1-(1-h)*s}}}class xa{constructor(n,s){this.property=n,this.value=s,this.expression=function(h,m){if(wu(h))return new pa(h,m);if(Eu(h)){const x=gh(h,m);if(x.result==="error")throw new Error(x.value.map(w=>`${w.key}: ${w.message}`).join(", "));return x.value}{let x=h;return m.type==="color"&&typeof h=="string"?x=Er.parse(h):m.type!=="padding"||typeof h!="number"&&!Array.isArray(h)?m.type==="variableAnchorOffsetCollection"&&Array.isArray(h)&&(x=Ri.parse(h)):x=mi.parse(h),{kind:"constant",evaluate:()=>x}}}(s===void 0?n.specification.default:s,n.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(n,s,h){return this.property.possiblyEvaluate(this,n,s,h)}}class Ru{constructor(n){this.property=n,this.value=new xa(n,void 0)}transitioned(n,s){return new Kp(this.property,this.value,s,ge({},n.transition,this.transition),n.now)}untransitioned(){return new Kp(this.property,this.value,null,{},0)}}class Lu{constructor(n){this._properties=n,this._values=Object.create(n.defaultTransitionablePropertyValues)}getValue(n){return it(this._values[n].value.value)}setValue(n,s){Object.prototype.hasOwnProperty.call(this._values,n)||(this._values[n]=new Ru(this._values[n].property)),this._values[n].value=new xa(this._values[n].property,s===null?void 0:it(s))}getTransition(n){return it(this._values[n].transition)}setTransition(n,s){Object.prototype.hasOwnProperty.call(this._values,n)||(this._values[n]=new Ru(this._values[n].property)),this._values[n].transition=it(s)||void 0}serialize(){const n={};for(const s of Object.keys(this._values)){const h=this.getValue(s);h!==void 0&&(n[s]=h);const m=this.getTransition(s);m!==void 0&&(n[`${s}-transition`]=m)}return n}transitioned(n,s){const h=new wl(this._properties);for(const m of Object.keys(this._values))h._values[m]=this._values[m].transitioned(n,s._values[m]);return h}untransitioned(){const n=new wl(this._properties);for(const s of Object.keys(this._values))n._values[s]=this._values[s].untransitioned();return n}}class Kp{constructor(n,s,h,m,x){this.property=n,this.value=s,this.begin=x+m.delay||0,this.end=this.begin+m.duration||0,n.specification.transition&&(m.delay||m.duration)&&(this.prior=h)}possiblyEvaluate(n,s,h){const m=n.now||0,x=this.value.possiblyEvaluate(n,s,h),w=this.prior;if(w){if(m>this.end)return this.prior=null,x;if(this.value.isDataDriven())return this.prior=null,x;if(m=1)return 1;const I=E*E,M=I*E;return 4*(E<.5?M:3*(E-I)+M-.75)}(b))}}return x}}class wl{constructor(n){this._properties=n,this._values=Object.create(n.defaultTransitioningPropertyValues)}possiblyEvaluate(n,s,h){const m=new Sl(this._properties);for(const x of Object.keys(this._values))m._values[x]=this._values[x].possiblyEvaluate(n,s,h);return m}hasTransition(){for(const n of Object.keys(this._values))if(this._values[n].prior)return!0;return!1}}class bl{constructor(n){this._properties=n,this._values=Object.create(n.defaultPropertyValues)}hasValue(n){return this._values[n].value!==void 0}getValue(n){return it(this._values[n].value)}setValue(n,s){this._values[n]=new xa(this._values[n].property,s===null?void 0:it(s))}serialize(){const n={};for(const s of Object.keys(this._values)){const h=this.getValue(s);h!==void 0&&(n[s]=h)}return n}possiblyEvaluate(n,s,h){const m=new Sl(this._properties);for(const x of Object.keys(this._values))m._values[x]=this._values[x].possiblyEvaluate(n,s,h);return m}}class Co{constructor(n,s,h){this.property=n,this.value=s,this.parameters=h}isConstant(){return this.value.kind==="constant"}constantOr(n){return this.value.kind==="constant"?this.value.value:n}evaluate(n,s,h,m){return this.property.evaluate(this.value,this.parameters,n,s,h,m)}}class Sl{constructor(n){this._properties=n,this._values=Object.create(n.defaultPossiblyEvaluatedValues)}get(n){return this._values[n]}}class Tt{constructor(n){this.specification=n}possiblyEvaluate(n,s){if(n.isDataDriven())throw new Error("Value should not be data driven");return n.expression.evaluate(s)}interpolate(n,s,h){const m=ti[this.specification.type];return m?m(n,s,h):n}}class Nt{constructor(n,s){this.specification=n,this.overrides=s}possiblyEvaluate(n,s,h,m){return new Co(this,n.expression.kind==="constant"||n.expression.kind==="camera"?{kind:"constant",value:n.expression.evaluate(s,null,{},h,m)}:n.expression,s)}interpolate(n,s,h){if(n.value.kind!=="constant"||s.value.kind!=="constant")return n;if(n.value.value===void 0||s.value.value===void 0)return new Co(this,{kind:"constant",value:void 0},n.parameters);const m=ti[this.specification.type];if(m){const x=m(n.value.value,s.value.value,h);return new Co(this,{kind:"constant",value:x},n.parameters)}return n}evaluate(n,s,h,m,x,w){return n.kind==="constant"?n.value:n.evaluate(s,h,m,x,w)}}class Fu extends Nt{possiblyEvaluate(n,s,h,m){if(n.value===void 0)return new Co(this,{kind:"constant",value:void 0},s);if(n.expression.kind==="constant"){const x=n.expression.evaluate(s,null,{},h,m),w=n.property.specification.type==="resolvedImage"&&typeof x!="string"?x.name:x,b=this._calculate(w,w,w,s);return new Co(this,{kind:"constant",value:b},s)}if(n.expression.kind==="camera"){const x=this._calculate(n.expression.evaluate({zoom:s.zoom-1}),n.expression.evaluate({zoom:s.zoom}),n.expression.evaluate({zoom:s.zoom+1}),s);return new Co(this,{kind:"constant",value:x},s)}return new Co(this,n.expression,s)}evaluate(n,s,h,m,x,w){if(n.kind==="source"){const b=n.evaluate(s,h,m,x,w);return this._calculate(b,b,b,s)}return n.kind==="composite"?this._calculate(n.evaluate({zoom:Math.floor(s.zoom)-1},h,m),n.evaluate({zoom:Math.floor(s.zoom)},h,m),n.evaluate({zoom:Math.floor(s.zoom)+1},h,m),s):n.value}_calculate(n,s,h,m){return m.zoom>m.zoomHistory.lastIntegerZoom?{from:n,to:s}:{from:h,to:s}}interpolate(n){return n}}class Ou{constructor(n){this.specification=n}possiblyEvaluate(n,s,h,m){if(n.value!==void 0){if(n.expression.kind==="constant"){const x=n.expression.evaluate(s,null,{},h,m);return this._calculate(x,x,x,s)}return this._calculate(n.expression.evaluate(new Rr(Math.floor(s.zoom-1),s)),n.expression.evaluate(new Rr(Math.floor(s.zoom),s)),n.expression.evaluate(new Rr(Math.floor(s.zoom+1),s)),s)}}_calculate(n,s,h,m){return m.zoom>m.zoomHistory.lastIntegerZoom?{from:n,to:s}:{from:h,to:s}}interpolate(n){return n}}class Fh{constructor(n){this.specification=n}possiblyEvaluate(n,s,h,m){return!!n.expression.evaluate(s,null,{},h,m)}interpolate(){return!1}}class v{constructor(n){this.properties=n,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const s in n){const h=n[s];h.specification.overridable&&this.overridableProperties.push(s);const m=this.defaultPropertyValues[s]=new xa(h,void 0),x=this.defaultTransitionablePropertyValues[s]=new Ru(h);this.defaultTransitioningPropertyValues[s]=x.untransitioned(),this.defaultPossiblyEvaluatedValues[s]=m.possiblyEvaluate({})}}}bt("DataDrivenProperty",Nt),bt("DataConstantProperty",Tt),bt("CrossFadedDataDrivenProperty",Fu),bt("CrossFadedProperty",Ou),bt("ColorRampProperty",Fh);const r="-transition";class a extends Ue{constructor(n,s){if(super(),this.id=n.id,this.type=n.type,this._featureFilter={filter:()=>!0,needGeometry:!1},n.type!=="custom"&&(this.metadata=n.metadata,this.minzoom=n.minzoom,this.maxzoom=n.maxzoom,n.type!=="background"&&(this.source=n.source,this.sourceLayer=n["source-layer"],this.filter=n.filter),s.layout&&(this._unevaluatedLayout=new bl(s.layout)),s.paint)){this._transitionablePaint=new Lu(s.paint);for(const h in n.paint)this.setPaintProperty(h,n.paint[h],{validate:!1});for(const h in n.layout)this.setLayoutProperty(h,n.layout[h],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Sl(s.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(n){return n==="visibility"?this.visibility:this._unevaluatedLayout.getValue(n)}setLayoutProperty(n,s,h={}){s!=null&&this._validate(Zp,`layers.${this.id}.layout.${n}`,n,s,h)||(n!=="visibility"?this._unevaluatedLayout.setValue(n,s):this.visibility=s)}getPaintProperty(n){return n.endsWith(r)?this._transitionablePaint.getTransition(n.slice(0,-11)):this._transitionablePaint.getValue(n)}setPaintProperty(n,s,h={}){if(s!=null&&this._validate(Gp,`layers.${this.id}.paint.${n}`,n,s,h))return!1;if(n.endsWith(r))return this._transitionablePaint.setTransition(n.slice(0,-11),s||void 0),!1;{const m=this._transitionablePaint._values[n],x=m.property.specification["property-type"]==="cross-faded-data-driven",w=m.value.isDataDriven(),b=m.value;this._transitionablePaint.setValue(n,s),this._handleSpecialPaintPropertyUpdate(n);const E=this._transitionablePaint._values[n].value;return E.isDataDriven()||w||x||this._handleOverridablePaintPropertyUpdate(n,b,E)}}_handleSpecialPaintPropertyUpdate(n){}_handleOverridablePaintPropertyUpdate(n,s,h){return!1}isHidden(n){return!!(this.minzoom&&n=this.maxzoom)||this.visibility==="none"}updateTransitions(n){this._transitioningPaint=this._transitionablePaint.transitioned(n,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(n,s){n.getCrossfadeParameters&&(this._crossfadeParameters=n.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(n,void 0,s)),this.paint=this._transitioningPaint.possiblyEvaluate(n,void 0,s)}serialize(){const n={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&&(n.layout=n.layout||{},n.layout.visibility=this.visibility),Ge(n,(s,h)=>!(s===void 0||h==="layout"&&!Object.keys(s).length||h==="paint"&&!Object.keys(s).length))}_validate(n,s,h,m,x={}){return(!x||x.validate!==!1)&&Ph(this,n.call(Ds,{key:s,layerType:this.type,objectKey:h,value:m,styleSpec:ie,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const n in this.paint._values){const s=this.paint.get(n);if(s instanceof Co&&la(s.property.specification)&&(s.value.kind==="source"||s.value.kind==="composite")&&s.value.isStateDependent)return!0}return!1}}const p={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class f{constructor(n,s){this._structArray=n,this._pos1=s*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class _{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(n,s){return n._trim(),s&&(n.isTransferred=!0,s.push(n.arrayBuffer)),{length:n.length,arrayBuffer:n.arrayBuffer}}static deserialize(n){const s=Object.create(this.prototype);return s.arrayBuffer=n.arrayBuffer,s.length=n.length,s.capacity=n.arrayBuffer.byteLength/s.bytesPerElement,s._refreshViews(),s}_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(n){this.reserve(n),this.length=n}reserve(n){if(n>this.capacity){this.capacity=Math.max(n,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const s=this.uint8;this._refreshViews(),s&&this.uint8.set(s)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function S(o,n=1){let s=0,h=0;return{members:o.map(m=>{const x=p[m.type].BYTES_PER_ELEMENT,w=s=k(s,Math.max(n,x)),b=m.components||1;return h=Math.max(h,x),s+=x*b,{name:m.name,type:m.type,components:b,offset:w}}),size:k(s,Math.max(h,n)),alignment:n}}function k(o,n){return Math.ceil(o/n)*n}class C extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,s){const h=this.length;return this.resize(h+1),this.emplace(h,n,s)}emplace(n,s,h){const m=2*n;return this.int16[m+0]=s,this.int16[m+1]=h,n}}C.prototype.bytesPerElement=4,bt("StructArrayLayout2i4",C);class z extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,s,h){const m=this.length;return this.resize(m+1),this.emplace(m,n,s,h)}emplace(n,s,h,m){const x=3*n;return this.int16[x+0]=s,this.int16[x+1]=h,this.int16[x+2]=m,n}}z.prototype.bytesPerElement=6,bt("StructArrayLayout3i6",z);class O extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,s,h,m){const x=this.length;return this.resize(x+1),this.emplace(x,n,s,h,m)}emplace(n,s,h,m,x){const w=4*n;return this.int16[w+0]=s,this.int16[w+1]=h,this.int16[w+2]=m,this.int16[w+3]=x,n}}O.prototype.bytesPerElement=8,bt("StructArrayLayout4i8",O);class B extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,s,h,m,x,w){const b=this.length;return this.resize(b+1),this.emplace(b,n,s,h,m,x,w)}emplace(n,s,h,m,x,w,b){const E=6*n;return this.int16[E+0]=s,this.int16[E+1]=h,this.int16[E+2]=m,this.int16[E+3]=x,this.int16[E+4]=w,this.int16[E+5]=b,n}}B.prototype.bytesPerElement=12,bt("StructArrayLayout2i4i12",B);class K extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,s,h,m,x,w){const b=this.length;return this.resize(b+1),this.emplace(b,n,s,h,m,x,w)}emplace(n,s,h,m,x,w,b){const E=4*n,I=8*n;return this.int16[E+0]=s,this.int16[E+1]=h,this.uint8[I+4]=m,this.uint8[I+5]=x,this.uint8[I+6]=w,this.uint8[I+7]=b,n}}K.prototype.bytesPerElement=8,bt("StructArrayLayout2i4ub8",K);class Q extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(n,s){const h=this.length;return this.resize(h+1),this.emplace(h,n,s)}emplace(n,s,h){const m=2*n;return this.float32[m+0]=s,this.float32[m+1]=h,n}}Q.prototype.bytesPerElement=8,bt("StructArrayLayout2f8",Q);class re extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(n,s,h,m,x,w,b,E,I,M){const L=this.length;return this.resize(L+1),this.emplace(L,n,s,h,m,x,w,b,E,I,M)}emplace(n,s,h,m,x,w,b,E,I,M,L){const j=10*n;return this.uint16[j+0]=s,this.uint16[j+1]=h,this.uint16[j+2]=m,this.uint16[j+3]=x,this.uint16[j+4]=w,this.uint16[j+5]=b,this.uint16[j+6]=E,this.uint16[j+7]=I,this.uint16[j+8]=M,this.uint16[j+9]=L,n}}re.prototype.bytesPerElement=20,bt("StructArrayLayout10ui20",re);class ce extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(n,s,h,m,x,w,b,E,I,M,L,j){const W=this.length;return this.resize(W+1),this.emplace(W,n,s,h,m,x,w,b,E,I,M,L,j)}emplace(n,s,h,m,x,w,b,E,I,M,L,j,W){const Y=12*n;return this.int16[Y+0]=s,this.int16[Y+1]=h,this.int16[Y+2]=m,this.int16[Y+3]=x,this.uint16[Y+4]=w,this.uint16[Y+5]=b,this.uint16[Y+6]=E,this.uint16[Y+7]=I,this.int16[Y+8]=M,this.int16[Y+9]=L,this.int16[Y+10]=j,this.int16[Y+11]=W,n}}ce.prototype.bytesPerElement=24,bt("StructArrayLayout4i4ui4i24",ce);class fe extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(n,s,h){const m=this.length;return this.resize(m+1),this.emplace(m,n,s,h)}emplace(n,s,h,m){const x=3*n;return this.float32[x+0]=s,this.float32[x+1]=h,this.float32[x+2]=m,n}}fe.prototype.bytesPerElement=12,bt("StructArrayLayout3f12",fe);class me extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(n){const s=this.length;return this.resize(s+1),this.emplace(s,n)}emplace(n,s){return this.uint32[1*n+0]=s,n}}me.prototype.bytesPerElement=4,bt("StructArrayLayout1ul4",me);class we extends _{_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(n,s,h,m,x,w,b,E,I){const M=this.length;return this.resize(M+1),this.emplace(M,n,s,h,m,x,w,b,E,I)}emplace(n,s,h,m,x,w,b,E,I,M){const L=10*n,j=5*n;return this.int16[L+0]=s,this.int16[L+1]=h,this.int16[L+2]=m,this.int16[L+3]=x,this.int16[L+4]=w,this.int16[L+5]=b,this.uint32[j+3]=E,this.uint16[L+8]=I,this.uint16[L+9]=M,n}}we.prototype.bytesPerElement=20,bt("StructArrayLayout6i1ul2ui20",we);class ae extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,s,h,m,x,w){const b=this.length;return this.resize(b+1),this.emplace(b,n,s,h,m,x,w)}emplace(n,s,h,m,x,w,b){const E=6*n;return this.int16[E+0]=s,this.int16[E+1]=h,this.int16[E+2]=m,this.int16[E+3]=x,this.int16[E+4]=w,this.int16[E+5]=b,n}}ae.prototype.bytesPerElement=12,bt("StructArrayLayout2i2i2i12",ae);class Ce extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,s,h,m,x){const w=this.length;return this.resize(w+1),this.emplace(w,n,s,h,m,x)}emplace(n,s,h,m,x,w){const b=4*n,E=8*n;return this.float32[b+0]=s,this.float32[b+1]=h,this.float32[b+2]=m,this.int16[E+6]=x,this.int16[E+7]=w,n}}Ce.prototype.bytesPerElement=16,bt("StructArrayLayout2f1f2i16",Ce);class Pe extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,s,h,m,x,w){const b=this.length;return this.resize(b+1),this.emplace(b,n,s,h,m,x,w)}emplace(n,s,h,m,x,w,b){const E=16*n,I=4*n,M=8*n;return this.uint8[E+0]=s,this.uint8[E+1]=h,this.float32[I+1]=m,this.float32[I+2]=x,this.int16[M+6]=w,this.int16[M+7]=b,n}}Pe.prototype.bytesPerElement=16,bt("StructArrayLayout2ub2f2i16",Pe);class De extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(n,s,h){const m=this.length;return this.resize(m+1),this.emplace(m,n,s,h)}emplace(n,s,h,m){const x=3*n;return this.uint16[x+0]=s,this.uint16[x+1]=h,this.uint16[x+2]=m,n}}De.prototype.bytesPerElement=6,bt("StructArrayLayout3ui6",De);class Xe extends _{_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(n,s,h,m,x,w,b,E,I,M,L,j,W,Y,J,le,pe){const ze=this.length;return this.resize(ze+1),this.emplace(ze,n,s,h,m,x,w,b,E,I,M,L,j,W,Y,J,le,pe)}emplace(n,s,h,m,x,w,b,E,I,M,L,j,W,Y,J,le,pe,ze){const be=24*n,Ae=12*n,Ve=48*n;return this.int16[be+0]=s,this.int16[be+1]=h,this.uint16[be+2]=m,this.uint16[be+3]=x,this.uint32[Ae+2]=w,this.uint32[Ae+3]=b,this.uint32[Ae+4]=E,this.uint16[be+10]=I,this.uint16[be+11]=M,this.uint16[be+12]=L,this.float32[Ae+7]=j,this.float32[Ae+8]=W,this.uint8[Ve+36]=Y,this.uint8[Ve+37]=J,this.uint8[Ve+38]=le,this.uint32[Ae+10]=pe,this.int16[be+22]=ze,n}}Xe.prototype.bytesPerElement=48,bt("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Xe);class ot extends _{_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(n,s,h,m,x,w,b,E,I,M,L,j,W,Y,J,le,pe,ze,be,Ae,Ve,et,vt,Ft,gt,pt,Pt,Et){const wt=this.length;return this.resize(wt+1),this.emplace(wt,n,s,h,m,x,w,b,E,I,M,L,j,W,Y,J,le,pe,ze,be,Ae,Ve,et,vt,Ft,gt,pt,Pt,Et)}emplace(n,s,h,m,x,w,b,E,I,M,L,j,W,Y,J,le,pe,ze,be,Ae,Ve,et,vt,Ft,gt,pt,Pt,Et,wt){const qe=32*n,At=16*n;return this.int16[qe+0]=s,this.int16[qe+1]=h,this.int16[qe+2]=m,this.int16[qe+3]=x,this.int16[qe+4]=w,this.int16[qe+5]=b,this.int16[qe+6]=E,this.int16[qe+7]=I,this.uint16[qe+8]=M,this.uint16[qe+9]=L,this.uint16[qe+10]=j,this.uint16[qe+11]=W,this.uint16[qe+12]=Y,this.uint16[qe+13]=J,this.uint16[qe+14]=le,this.uint16[qe+15]=pe,this.uint16[qe+16]=ze,this.uint16[qe+17]=be,this.uint16[qe+18]=Ae,this.uint16[qe+19]=Ve,this.uint16[qe+20]=et,this.uint16[qe+21]=vt,this.uint16[qe+22]=Ft,this.uint32[At+12]=gt,this.float32[At+13]=pt,this.float32[At+14]=Pt,this.uint16[qe+30]=Et,this.uint16[qe+31]=wt,n}}ot.prototype.bytesPerElement=64,bt("StructArrayLayout8i15ui1ul2f2ui64",ot);class mt extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(n){const s=this.length;return this.resize(s+1),this.emplace(s,n)}emplace(n,s){return this.float32[1*n+0]=s,n}}mt.prototype.bytesPerElement=4,bt("StructArrayLayout1f4",mt);class xt extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(n,s,h){const m=this.length;return this.resize(m+1),this.emplace(m,n,s,h)}emplace(n,s,h,m){const x=3*n;return this.uint16[6*n+0]=s,this.float32[x+1]=h,this.float32[x+2]=m,n}}xt.prototype.bytesPerElement=12,bt("StructArrayLayout1ui2f12",xt);class ht extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(n,s,h){const m=this.length;return this.resize(m+1),this.emplace(m,n,s,h)}emplace(n,s,h,m){const x=4*n;return this.uint32[2*n+0]=s,this.uint16[x+2]=h,this.uint16[x+3]=m,n}}ht.prototype.bytesPerElement=8,bt("StructArrayLayout1ul2ui8",ht);class ct extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(n,s){const h=this.length;return this.resize(h+1),this.emplace(h,n,s)}emplace(n,s,h){const m=2*n;return this.uint16[m+0]=s,this.uint16[m+1]=h,n}}ct.prototype.bytesPerElement=4,bt("StructArrayLayout2ui4",ct);class Ct extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(n){const s=this.length;return this.resize(s+1),this.emplace(s,n)}emplace(n,s){return this.uint16[1*n+0]=s,n}}Ct.prototype.bytesPerElement=2,bt("StructArrayLayout1ui2",Ct);class Ht extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(n,s,h,m){const x=this.length;return this.resize(x+1),this.emplace(x,n,s,h,m)}emplace(n,s,h,m,x){const w=4*n;return this.float32[w+0]=s,this.float32[w+1]=h,this.float32[w+2]=m,this.float32[w+3]=x,n}}Ht.prototype.bytesPerElement=16,bt("StructArrayLayout4f16",Ht);class dt extends f{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 D(this.anchorPointX,this.anchorPointY)}}dt.prototype.size=20;class yt extends we{get(n){return new dt(this,n)}}bt("CollisionBoxArray",yt);class Ut extends f{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(n){this._structArray.uint8[this._pos1+37]=n}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(n){this._structArray.uint8[this._pos1+38]=n}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(n){this._structArray.uint32[this._pos4+10]=n}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}Ut.prototype.size=48;class Lr extends Xe{get(n){return new Ut(this,n)}}bt("PlacedSymbolArray",Lr);class Yt extends f{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(n){this._structArray.uint32[this._pos4+12]=n}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}Yt.prototype.size=64;class nr extends ot{get(n){return new Yt(this,n)}}bt("SymbolInstanceArray",nr);class Fr extends mt{getoffsetX(n){return this.float32[1*n+0]}}bt("GlyphOffsetArray",Fr);class Mn extends z{getx(n){return this.int16[3*n+0]}gety(n){return this.int16[3*n+1]}gettileUnitDistanceFromAnchor(n){return this.int16[3*n+2]}}bt("SymbolLineVertexArray",Mn);class no extends f{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}}no.prototype.size=12;class Or extends xt{get(n){return new no(this,n)}}bt("TextAnchorOffsetArray",Or);class ni extends f{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]}}ni.prototype.size=8;class Vn extends ht{get(n){return new ni(this,n)}}bt("FeatureIndexArray",Vn);class zn extends C{}class Hn extends C{}class Io extends C{}class wa extends B{}class Bu extends K{}class ba extends Q{}class Bi extends re{}class Nu extends ce{}class Oh extends fe{}class Ni extends me{}class $i extends ae{}class ss extends Pe{}class io extends De{}class kn extends ct{}const Dn=S([{name:"a_pos",components:2,type:"Int16"}],4),{members:vi}=Dn;class or{constructor(n=[]){this.segments=n}prepareSegment(n,s,h,m){let x=this.segments[this.segments.length-1];return n>or.MAX_VERTEX_ARRAY_LENGTH&&je(`Max vertices per segment is ${or.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${n}`),(!x||x.vertexLength+n>or.MAX_VERTEX_ARRAY_LENGTH||x.sortKey!==m)&&(x={vertexOffset:s.length,primitiveOffset:h.length,vertexLength:0,primitiveLength:0},m!==void 0&&(x.sortKey=m),this.segments.push(x)),x}get(){return this.segments}destroy(){for(const n of this.segments)for(const s in n.vaos)n.vaos[s].destroy()}static simpleSegment(n,s,h,m){return new or([{vertexOffset:n,primitiveOffset:s,vertexLength:h,primitiveLength:m,vaos:{},sortKey:0}])}}function Rs(o,n){return 256*(o=se(Math.floor(o),0,255))+se(Math.floor(n),0,255)}or.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,bt("SegmentVector",or);const Sa=S([{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 Ea={exports:{}},Yp={exports:{}};Yp.exports=function(o,n){var s,h,m,x,w,b,E,I;for(h=o.length-(s=3&o.length),m=n,w=3432918353,b=461845907,I=0;I>>16)*w&65535)<<16)&4294967295)<<15|E>>>17))*b+(((E>>>16)*b&65535)<<16)&4294967295)<<13|m>>>19))+((5*(m>>>16)&65535)<<16)&4294967295))+((58964+(x>>>16)&65535)<<16);switch(E=0,s){case 3:E^=(255&o.charCodeAt(I+2))<<16;case 2:E^=(255&o.charCodeAt(I+1))<<8;case 1:m^=E=(65535&(E=(E=(65535&(E^=255&o.charCodeAt(I)))*w+(((E>>>16)*w&65535)<<16)&4294967295)<<15|E>>>17))*b+(((E>>>16)*b&65535)<<16)&4294967295}return m^=o.length,m=2246822507*(65535&(m^=m>>>16))+((2246822507*(m>>>16)&65535)<<16)&4294967295,m=3266489909*(65535&(m^=m>>>13))+((3266489909*(m>>>16)&65535)<<16)&4294967295,(m^=m>>>16)>>>0};var by=Yp.exports,Jp={exports:{}};Jp.exports=function(o,n){for(var s,h=o.length,m=n^h,x=0;h>=4;)s=1540483477*(65535&(s=255&o.charCodeAt(x)|(255&o.charCodeAt(++x))<<8|(255&o.charCodeAt(++x))<<16|(255&o.charCodeAt(++x))<<24))+((1540483477*(s>>>16)&65535)<<16),m=1540483477*(65535&m)+((1540483477*(m>>>16)&65535)<<16)^(s=1540483477*(65535&(s^=s>>>24))+((1540483477*(s>>>16)&65535)<<16)),h-=4,++x;switch(h){case 3:m^=(255&o.charCodeAt(x+2))<<16;case 2:m^=(255&o.charCodeAt(x+1))<<8;case 1:m=1540483477*(65535&(m^=255&o.charCodeAt(x)))+((1540483477*(m>>>16)&65535)<<16)}return m=1540483477*(65535&(m^=m>>>13))+((1540483477*(m>>>16)&65535)<<16),(m^=m>>>15)>>>0};var as=by,Qp=Jp.exports;Ea.exports=as,Ea.exports.murmur3=as,Ea.exports.murmur2=Qp;var $u=T(Ea.exports);class El{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(n,s,h,m){this.ids.push(ju(n)),this.positions.push(s,h,m)}getPositions(n){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const s=ju(n);let h=0,m=this.ids.length-1;for(;h>1;this.ids[w]>=s?m=w:h=w+1}const x=[];for(;this.ids[h]===s;)x.push({index:this.positions[3*h],start:this.positions[3*h+1],end:this.positions[3*h+2]}),h++;return x}static serialize(n,s){const h=new Float64Array(n.ids),m=new Uint32Array(n.positions);return Uu(h,m,0,h.length-1),s&&s.push(h.buffer,m.buffer),{ids:h,positions:m}}static deserialize(n){const s=new El;return s.ids=n.ids,s.positions=n.positions,s.indexed=!0,s}}function ju(o){const n=+o;return!isNaN(n)&&n<=Number.MAX_SAFE_INTEGER?n:$u(String(o))}function Uu(o,n,s,h){for(;s>1];let x=s-1,w=h+1;for(;;){do x++;while(o[x]m);if(x>=w)break;ka(o,x,w),ka(n,3*x,3*w),ka(n,3*x+1,3*w+1),ka(n,3*x+2,3*w+2)}w-s`u_${m}`),this.type=h}setUniform(n,s,h){n.set(h.constantOr(this.value))}getBinding(n,s,h){return this.type==="color"?new nx(n,s):new ef(n,s)}}class Vu{constructor(n,s){this.uniformNames=s.map(h=>`u_${h}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(n,s){this.pixelRatioFrom=s.pixelRatio,this.pixelRatioTo=n.pixelRatio,this.patternFrom=s.tlbr,this.patternTo=n.tlbr}setUniform(n,s,h,m){const x=m==="u_pattern_to"?this.patternTo:m==="u_pattern_from"?this.patternFrom:m==="u_pixel_ratio_to"?this.pixelRatioTo:m==="u_pixel_ratio_from"?this.pixelRatioFrom:null;x&&n.set(x)}getBinding(n,s,h){return h.substr(0,9)==="u_pattern"?new rx(n,s):new ef(n,s)}}class Ls{constructor(n,s,h,m){this.expression=n,this.type=h,this.maxValue=0,this.paintVertexAttributes=s.map(x=>({name:`a_${x}`,type:"Float32",components:h==="color"?2:1,offset:0})),this.paintVertexArray=new m}populatePaintArray(n,s,h,m,x){const w=this.paintVertexArray.length,b=this.expression.evaluate(new Rr(0),s,{},m,[],x);this.paintVertexArray.resize(n),this._setPaintValue(w,n,b)}updatePaintArray(n,s,h,m){const x=this.expression.evaluate({zoom:0},h,m);this._setPaintValue(n,s,x)}_setPaintValue(n,s,h){if(this.type==="color"){const m=Sy(h);for(let x=n;x`u_${b}_t`),this.type=h,this.useIntegerZoom=m,this.zoom=x,this.maxValue=0,this.paintVertexAttributes=s.map(b=>({name:`a_${b}`,type:"Float32",components:h==="color"?4:2,offset:0})),this.paintVertexArray=new w}populatePaintArray(n,s,h,m,x){const w=this.expression.evaluate(new Rr(this.zoom),s,{},m,[],x),b=this.expression.evaluate(new Rr(this.zoom+1),s,{},m,[],x),E=this.paintVertexArray.length;this.paintVertexArray.resize(n),this._setPaintValue(E,n,w,b)}updatePaintArray(n,s,h,m){const x=this.expression.evaluate({zoom:this.zoom},h,m),w=this.expression.evaluate({zoom:this.zoom+1},h,m);this._setPaintValue(n,s,x,w)}_setPaintValue(n,s,h,m){if(this.type==="color"){const x=Sy(h),w=Sy(m);for(let b=n;b`#define HAS_UNIFORM_${m}`))}return n}getBinderAttributes(){const n=[];for(const s in this.binders){const h=this.binders[s];if(h instanceof Ls||h instanceof Vo)for(let m=0;m!0){this.programConfigurations={};for(const m of n)this.programConfigurations[m.id]=new ix(m,s,h);this.needsUpload=!1,this._featureMap=new El,this._bufferOffset=0}populatePaintArrays(n,s,h,m,x,w){for(const b in this.programConfigurations)this.programConfigurations[b].populatePaintArrays(n,s,m,x,w);s.id!==void 0&&this._featureMap.add(s.id,h,this._bufferOffset,n),this._bufferOffset=n,this.needsUpload=!0}updatePaintArrays(n,s,h,m){for(const x of h)this.needsUpload=this.programConfigurations[x.id].updatePaintArrays(n,this._featureMap,s,x,m)||this.needsUpload}get(n){return this.programConfigurations[n]}upload(n){if(this.needsUpload){for(const s in this.programConfigurations)this.programConfigurations[s].upload(n);this.needsUpload=!1}}destroy(){for(const n in this.programConfigurations)this.programConfigurations[n].destroy()}}function fI(o,n){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"]}[o]||[o.replace(`${n}-`,"").replace(/-/g,"_")]}function ox(o,n,s){const h={color:{source:Q,composite:Ht},number:{source:mt,composite:Q}},m=function(x){return{"line-pattern":{source:Bi,composite:Bi},"fill-pattern":{source:Bi,composite:Bi},"fill-extrusion-pattern":{source:Bi,composite:Bi}}[x]}(o);return m&&m[s]||h[n][s]}bt("ConstantBinder",Bh),bt("CrossFadedConstantBinder",Vu),bt("SourceExpressionBinder",Ls),bt("CrossFadedCompositeBinder",Ta),bt("CompositeExpressionBinder",Vo),bt("ProgramConfiguration",ix,{omit:["_buffers"]}),bt("ProgramConfigurationSet",Tl);const fn=8192,Ey=Math.pow(2,14)-1,sx=-Ey-1;function Cl(o){const n=fn/o.extent,s=o.loadGeometry();for(let h=0;hw.x+1||Ew.y+1)&&je("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return s}function Il(o,n){return{type:o.type,id:o.id,properties:o.properties,geometry:n?Cl(o):[]}}function tf(o,n,s,h,m){o.emplaceBack(2*n+(h+1)/2,2*s+(m+1)/2)}class ky{constructor(n){this.zoom=n.zoom,this.overscaling=n.overscaling,this.layers=n.layers,this.layerIds=this.layers.map(s=>s.id),this.index=n.index,this.hasPattern=!1,this.layoutVertexArray=new Hn,this.indexArray=new io,this.segments=new or,this.programConfigurations=new Tl(n.layers,n.zoom),this.stateDependentLayerIds=this.layers.filter(s=>s.isStateDependent()).map(s=>s.id)}populate(n,s,h){const m=this.layers[0],x=[];let w=null,b=!1;m.type==="circle"&&(w=m.layout.get("circle-sort-key"),b=!w.isConstant());for(const{feature:E,id:I,index:M,sourceLayerIndex:L}of n){const j=this.layers[0]._featureFilter.needGeometry,W=Il(E,j);if(!this.layers[0]._featureFilter.filter(new Rr(this.zoom),W,h))continue;const Y=b?w.evaluate(W,{},h):void 0,J={id:I,properties:E.properties,type:E.type,sourceLayerIndex:L,index:M,geometry:j?W.geometry:Cl(E),patterns:{},sortKey:Y};x.push(J)}b&&x.sort((E,I)=>E.sortKey-I.sortKey);for(const E of x){const{geometry:I,index:M,sourceLayerIndex:L}=E,j=n[M].feature;this.addFeature(E,I,M,h),s.featureIndex.insert(j,I,M,L,this.index)}}update(n,s,h){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(n,s,this.stateDependentLayers,h)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(n){this.uploaded||(this.layoutVertexBuffer=n.createVertexBuffer(this.layoutVertexArray,vi),this.indexBuffer=n.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(n),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(n,s,h,m){for(const x of s)for(const w of x){const b=w.x,E=w.y;if(b<0||b>=fn||E<0||E>=fn)continue;const I=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,n.sortKey),M=I.vertexLength;tf(this.layoutVertexArray,b,E,-1,-1),tf(this.layoutVertexArray,b,E,1,-1),tf(this.layoutVertexArray,b,E,1,1),tf(this.layoutVertexArray,b,E,-1,1),this.indexArray.emplaceBack(M,M+1,M+2),this.indexArray.emplaceBack(M,M+3,M+2),I.vertexLength+=4,I.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,n,h,{},m)}}function ax(o,n){for(let s=0;s1){if(Ty(o,n))return!0;for(let h=0;h1?s:s.sub(n)._mult(m)._add(n))}function cx(o,n){let s,h,m,x=!1;for(let w=0;wn.y!=m.y>n.y&&n.x<(m.x-h.x)*(n.y-h.y)/(m.y-h.y)+h.x&&(x=!x)}return x}function Hu(o,n){let s=!1;for(let h=0,m=o.length-1;hn.y!=w.y>n.y&&n.x<(w.x-x.x)*(n.y-x.y)/(w.y-x.y)+x.x&&(s=!s)}return s}function _I(o,n,s){const h=s[0],m=s[2];if(o.xm.x&&n.x>m.x||o.ym.y&&n.y>m.y)return!1;const x=H(o,n,s[0]);return x!==H(o,n,s[1])||x!==H(o,n,s[2])||x!==H(o,n,s[3])}function Nh(o,n,s){const h=n.paint.get(o).value;return h.kind==="constant"?h.value:s.programConfigurations.get(n.id).getMaxValue(o)}function rf(o){return Math.sqrt(o[0]*o[0]+o[1]*o[1])}function nf(o,n,s,h,m){if(!n[0]&&!n[1])return o;const x=D.convert(n)._mult(m);s==="viewport"&&x._rotate(-h);const w=[];for(let b=0;bfx(le,J))}(I,E),W=L?M*b:M;for(const Y of m)for(const J of Y){const le=L?J:fx(J,E);let pe=W;const ze=of([],[J.x,J.y,0,1],E);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?pe*=ze[3]/w.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(pe*=w.cameraToCenterDistance/ze[3]),mI(j,le,pe))return!0}return!1}}function fx(o,n){const s=of([],[o.x,o.y,0,1],n);return new D(s[0]/s[3],s[1]/s[3])}class mx extends ky{}let gx;bt("HeatmapBucket",mx,{omit:["layers"]});var bI={get paint(){return gx=gx||new v({"heatmap-radius":new Nt(ie.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Nt(ie.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Tt(ie.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Fh(ie.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Tt(ie.paint_heatmap["heatmap-opacity"])})}};function Py(o,{width:n,height:s},h,m){if(m){if(m instanceof Uint8ClampedArray)m=new Uint8Array(m.buffer);else if(m.length!==n*s*h)throw new RangeError(`mismatched image size. expected: ${m.length} but got: ${n*s*h}`)}else m=new Uint8Array(n*s*h);return o.width=n,o.height=s,o.data=m,o}function yx(o,{width:n,height:s},h){if(n===o.width&&s===o.height)return;const m=Py({},{width:n,height:s},h);Ay(o,m,{x:0,y:0},{x:0,y:0},{width:Math.min(o.width,n),height:Math.min(o.height,s)},h),o.width=n,o.height=s,o.data=m.data}function Ay(o,n,s,h,m,x){if(m.width===0||m.height===0)return n;if(m.width>o.width||m.height>o.height||s.x>o.width-m.width||s.y>o.height-m.height)throw new RangeError("out of range source coordinates for image copy");if(m.width>n.width||m.height>n.height||h.x>n.width-m.width||h.y>n.height-m.height)throw new RangeError("out of range destination coordinates for image copy");const w=o.data,b=n.data;if(w===b)throw new Error("srcData equals dstData, so image is already copied");for(let E=0;E{n[o.evaluationKey]=E;const I=o.expression.evaluate(n);m.data[w+b+0]=Math.floor(255*I.r/I.a),m.data[w+b+1]=Math.floor(255*I.g/I.a),m.data[w+b+2]=Math.floor(255*I.b/I.a),m.data[w+b+3]=Math.floor(255*I.a)};if(o.clips)for(let w=0,b=0;w80*s){b=1/0,E=1/0;let M=-1/0,L=-1/0;for(let j=s;jM&&(M=W),Y>L&&(L=Y)}I=Math.max(M-b,L-E),I=I!==0?32767/I:0}return Uh(x,w,s,b,E,I,0),w}function wx(o,n,s,h,m){let x;if(m===function(w,b,E,I){let M=0;for(let L=b,j=E-I;L0)for(let w=n;w=n;w-=h)x=Ex(w/h|0,o[w],o[w+1],x);return x&&sf(x,x.next)&&(Hh(x),x=x.next),x}function Pl(o,n){if(!o)return o;n||(n=o);let s,h=o;do if(s=!1,h.steiner||!sf(h,h.next)&&ln(h.prev,h,h.next)!==0)h=h.next;else{if(Hh(h),h=n=h.prev,h===h.next)break;s=!0}while(s||h!==n);return n}function Uh(o,n,s,h,m,x,w){if(!o)return;!w&&x&&function(E,I,M,L){let j=E;do j.z===0&&(j.z=zy(j.x,j.y,I,M,L)),j.prevZ=j.prev,j.nextZ=j.next,j=j.next;while(j!==E);j.prevZ.nextZ=null,j.prevZ=null,function(W){let Y,J=1;do{let le,pe=W;W=null;let ze=null;for(Y=0;pe;){Y++;let be=pe,Ae=0;for(let et=0;et0||Ve>0&&be;)Ae!==0&&(Ve===0||!be||pe.z<=be.z)?(le=pe,pe=pe.nextZ,Ae--):(le=be,be=be.nextZ,Ve--),ze?ze.nextZ=le:W=le,le.prevZ=ze,ze=le;pe=be}ze.nextZ=null,J*=2}while(Y>1)}(j)}(o,h,m,x);let b=o;for(;o.prev!==o.next;){const E=o.prev,I=o.next;if(x?PI(o,h,m,x):II(o))n.push(E.i,o.i,I.i),Hh(o),o=I.next,b=I.next;else if((o=I)===b){w?w===1?Uh(o=AI(Pl(o),n),n,s,h,m,x,2):w===2&&MI(o,n,s,h,m,x):Uh(Pl(o),n,s,h,m,x,1);break}}}function II(o){const n=o.prev,s=o,h=o.next;if(ln(n,s,h)>=0)return!1;const m=n.x,x=s.x,w=h.x,b=n.y,E=s.y,I=h.y,M=mx?m>w?m:w:x>w?x:w,W=b>E?b>I?b:I:E>I?E:I;let Y=h.next;for(;Y!==n;){if(Y.x>=M&&Y.x<=j&&Y.y>=L&&Y.y<=W&&Zu(m,b,x,E,w,I,Y.x,Y.y)&&ln(Y.prev,Y,Y.next)>=0)return!1;Y=Y.next}return!0}function PI(o,n,s,h){const m=o.prev,x=o,w=o.next;if(ln(m,x,w)>=0)return!1;const b=m.x,E=x.x,I=w.x,M=m.y,L=x.y,j=w.y,W=bE?b>I?b:I:E>I?E:I,le=M>L?M>j?M:j:L>j?L:j,pe=zy(W,Y,n,s,h),ze=zy(J,le,n,s,h);let be=o.prevZ,Ae=o.nextZ;for(;be&&be.z>=pe&&Ae&&Ae.z<=ze;){if(be.x>=W&&be.x<=J&&be.y>=Y&&be.y<=le&&be!==m&&be!==w&&Zu(b,M,E,L,I,j,be.x,be.y)&&ln(be.prev,be,be.next)>=0||(be=be.prevZ,Ae.x>=W&&Ae.x<=J&&Ae.y>=Y&&Ae.y<=le&&Ae!==m&&Ae!==w&&Zu(b,M,E,L,I,j,Ae.x,Ae.y)&&ln(Ae.prev,Ae,Ae.next)>=0))return!1;Ae=Ae.nextZ}for(;be&&be.z>=pe;){if(be.x>=W&&be.x<=J&&be.y>=Y&&be.y<=le&&be!==m&&be!==w&&Zu(b,M,E,L,I,j,be.x,be.y)&&ln(be.prev,be,be.next)>=0)return!1;be=be.prevZ}for(;Ae&&Ae.z<=ze;){if(Ae.x>=W&&Ae.x<=J&&Ae.y>=Y&&Ae.y<=le&&Ae!==m&&Ae!==w&&Zu(b,M,E,L,I,j,Ae.x,Ae.y)&&ln(Ae.prev,Ae,Ae.next)>=0)return!1;Ae=Ae.nextZ}return!0}function AI(o,n){let s=o;do{const h=s.prev,m=s.next.next;!sf(h,m)&&bx(h,s,s.next,m)&&Vh(h,m)&&Vh(m,h)&&(n.push(h.i,s.i,m.i),Hh(s),Hh(s.next),s=o=m),s=s.next}while(s!==o);return Pl(s)}function MI(o,n,s,h,m,x){let w=o;do{let b=w.next.next;for(;b!==w.prev;){if(w.i!==b.i&&FI(w,b)){let E=Sx(w,b);return w=Pl(w,w.next),E=Pl(E,E.next),Uh(w,n,s,h,m,x,0),void Uh(E,n,s,h,m,x,0)}b=b.next}w=w.next}while(w!==o)}function zI(o,n){return o.x-n.x}function DI(o,n){const s=function(m,x){let w=x;const b=m.x,E=m.y;let I,M=-1/0;do{if(E<=w.y&&E>=w.next.y&&w.next.y!==w.y){const J=w.x+(E-w.y)*(w.next.x-w.x)/(w.next.y-w.y);if(J<=b&&J>M&&(M=J,I=w.x=w.x&&w.x>=j&&b!==w.x&&Zu(EI.x||w.x===I.x&&RI(I,w)))&&(I=w,Y=J)}w=w.next}while(w!==L);return I}(o,n);if(!s)return n;const h=Sx(s,o);return Pl(h,h.next),Pl(s,s.next)}function RI(o,n){return ln(o.prev,o,n.prev)<0&&ln(n.next,o,o.next)<0}function zy(o,n,s,h,m){return(o=1431655765&((o=858993459&((o=252645135&((o=16711935&((o=(o-s)*m|0)|o<<8))|o<<4))|o<<2))|o<<1))|(n=1431655765&((n=858993459&((n=252645135&((n=16711935&((n=(n-h)*m|0)|n<<8))|n<<4))|n<<2))|n<<1))<<1}function LI(o){let n=o,s=o;do(n.x=(o-w)*(x-b)&&(o-w)*(h-b)>=(s-w)*(n-b)&&(s-w)*(x-b)>=(m-w)*(h-b)}function FI(o,n){return o.next.i!==n.i&&o.prev.i!==n.i&&!function(s,h){let m=s;do{if(m.i!==s.i&&m.next.i!==s.i&&m.i!==h.i&&m.next.i!==h.i&&bx(m,m.next,s,h))return!0;m=m.next}while(m!==s);return!1}(o,n)&&(Vh(o,n)&&Vh(n,o)&&function(s,h){let m=s,x=!1;const w=(s.x+h.x)/2,b=(s.y+h.y)/2;do m.y>b!=m.next.y>b&&m.next.y!==m.y&&w<(m.next.x-m.x)*(b-m.y)/(m.next.y-m.y)+m.x&&(x=!x),m=m.next;while(m!==s);return x}(o,n)&&(ln(o.prev,o,n.prev)||ln(o,n.prev,n))||sf(o,n)&&ln(o.prev,o,o.next)>0&&ln(n.prev,n,n.next)>0)}function ln(o,n,s){return(n.y-o.y)*(s.x-n.x)-(n.x-o.x)*(s.y-n.y)}function sf(o,n){return o.x===n.x&&o.y===n.y}function bx(o,n,s,h){const m=lf(ln(o,n,s)),x=lf(ln(o,n,h)),w=lf(ln(s,h,o)),b=lf(ln(s,h,n));return m!==x&&w!==b||!(m!==0||!af(o,s,n))||!(x!==0||!af(o,h,n))||!(w!==0||!af(s,o,h))||!(b!==0||!af(s,n,h))}function af(o,n,s){return n.x<=Math.max(o.x,s.x)&&n.x>=Math.min(o.x,s.x)&&n.y<=Math.max(o.y,s.y)&&n.y>=Math.min(o.y,s.y)}function lf(o){return o>0?1:o<0?-1:0}function Vh(o,n){return ln(o.prev,o,o.next)<0?ln(o,n,o.next)>=0&&ln(o,o.prev,n)>=0:ln(o,n,o.prev)<0||ln(o,o.next,n)<0}function Sx(o,n){const s=Dy(o.i,o.x,o.y),h=Dy(n.i,n.x,n.y),m=o.next,x=n.prev;return o.next=n,n.prev=o,s.next=m,m.prev=s,h.next=s,s.prev=h,x.next=h,h.prev=x,h}function Ex(o,n,s,h){const m=Dy(o,n,s);return h?(m.next=h.next,m.prev=h,h.next.prev=m,h.next=m):(m.prev=m,m.next=m),m}function Hh(o){o.next.prev=o.prev,o.prev.next=o.next,o.prevZ&&(o.prevZ.nextZ=o.nextZ),o.nextZ&&(o.nextZ.prevZ=o.prevZ)}function Dy(o,n,s){return{i:o,x:n,y:s,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Ry(o,n,s){const h=s.patternDependencies;let m=!1;for(const x of n){const w=x.paint.get(`${o}-pattern`);w.isConstant()||(m=!0);const b=w.constantOr(null);b&&(m=!0,h[b.to]=!0,h[b.from]=!0)}return m}function Ly(o,n,s,h,m){const x=m.patternDependencies;for(const w of n){const b=w.paint.get(`${o}-pattern`).value;if(b.kind!=="constant"){let E=b.evaluate({zoom:h-1},s,{},m.availableImages),I=b.evaluate({zoom:h},s,{},m.availableImages),M=b.evaluate({zoom:h+1},s,{},m.availableImages);E=E&&E.name?E.name:E,I=I&&I.name?I.name:I,M=M&&M.name?M.name:M,x[E]=!0,x[I]=!0,x[M]=!0,s.patterns[w.id]={min:E,mid:I,max:M}}}return s}class Fy{constructor(n){this.zoom=n.zoom,this.overscaling=n.overscaling,this.layers=n.layers,this.layerIds=this.layers.map(s=>s.id),this.index=n.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Io,this.indexArray=new io,this.indexArray2=new kn,this.programConfigurations=new Tl(n.layers,n.zoom),this.segments=new or,this.segments2=new or,this.stateDependentLayerIds=this.layers.filter(s=>s.isStateDependent()).map(s=>s.id)}populate(n,s,h){this.hasPattern=Ry("fill",this.layers,s);const m=this.layers[0].layout.get("fill-sort-key"),x=!m.isConstant(),w=[];for(const{feature:b,id:E,index:I,sourceLayerIndex:M}of n){const L=this.layers[0]._featureFilter.needGeometry,j=Il(b,L);if(!this.layers[0]._featureFilter.filter(new Rr(this.zoom),j,h))continue;const W=x?m.evaluate(j,{},h,s.availableImages):void 0,Y={id:E,properties:b.properties,type:b.type,sourceLayerIndex:M,index:I,geometry:L?j.geometry:Cl(b),patterns:{},sortKey:W};w.push(Y)}x&&w.sort((b,E)=>b.sortKey-E.sortKey);for(const b of w){const{geometry:E,index:I,sourceLayerIndex:M}=b;if(this.hasPattern){const L=Ly("fill",this.layers,b,this.zoom,s);this.patternFeatures.push(L)}else this.addFeature(b,E,I,h,{});s.featureIndex.insert(n[I].feature,E,I,M,this.index)}}update(n,s,h){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(n,s,this.stateDependentLayers,h)}addFeatures(n,s,h){for(const m of this.patternFeatures)this.addFeature(m,m.geometry,m.index,s,h)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(n){this.uploaded||(this.layoutVertexBuffer=n.createVertexBuffer(this.layoutVertexArray,CI),this.indexBuffer=n.createIndexBuffer(this.indexArray),this.indexBuffer2=n.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(n),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(n,s,h,m,x){for(const w of gu(s,500)){let b=0;for(const W of w)b+=W.length;const E=this.segments.prepareSegment(b,this.layoutVertexArray,this.indexArray),I=E.vertexLength,M=[],L=[];for(const W of w){if(W.length===0)continue;W!==w[0]&&L.push(M.length/2);const Y=this.segments2.prepareSegment(W.length,this.layoutVertexArray,this.indexArray2),J=Y.vertexLength;this.layoutVertexArray.emplaceBack(W[0].x,W[0].y),this.indexArray2.emplaceBack(J+W.length-1,J),M.push(W[0].x),M.push(W[0].y);for(let le=1;le>3}if(m--,h===1||h===2)x+=o.readSVarint(),w+=o.readSVarint(),h===1&&(n&&b.push(n),n=[]),n.push(new UI(x,w));else{if(h!==7)throw new Error("unknown command "+h);n&&n.push(n[0].clone())}}return n&&b.push(n),b},Wu.prototype.bbox=function(){var o=this._pbf;o.pos=this._geometry;for(var n=o.readVarint()+o.pos,s=1,h=0,m=0,x=0,w=1/0,b=-1/0,E=1/0,I=-1/0;o.pos>3}if(h--,s===1||s===2)(m+=o.readSVarint())b&&(b=m),(x+=o.readSVarint())I&&(I=x);else if(s!==7)throw new Error("unknown command "+s)}return[w,E,b,I]},Wu.prototype.toGeoJSON=function(o,n,s){var h,m,x=this.extent*Math.pow(2,s),w=this.extent*o,b=this.extent*n,E=this.loadGeometry(),I=Wu.types[this.type];function M(W){for(var Y=0;Y>3;m=w===1?h.readString():w===2?h.readFloat():w===3?h.readDouble():w===4?h.readVarint64():w===5?h.readVarint():w===6?h.readSVarint():w===7?h.readBoolean():null}return m}(s))}Px.prototype.feature=function(o){if(o<0||o>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[o];var n=this._pbf.readVarint()+this._pbf.pos;return new GI(this._pbf,n,this.extent,this._keys,this._values)};var WI=Ix;function qI(o,n,s){if(o===3){var h=new WI(s,s.readVarint()+s.pos);h.length&&(n[h.name]=h)}}Ca.VectorTile=function(o,n){this.layers=o.readFields(qI,{},n)},Ca.VectorTileFeature=Cx,Ca.VectorTileLayer=Ix;const XI=Ca.VectorTileFeature.types,Oy=Math.pow(2,13);function Gh(o,n,s,h,m,x,w,b){o.emplaceBack(n,s,2*Math.floor(h*Oy)+w,m*Oy*2,x*Oy*2,Math.round(b))}class By{constructor(n){this.zoom=n.zoom,this.overscaling=n.overscaling,this.layers=n.layers,this.layerIds=this.layers.map(s=>s.id),this.index=n.index,this.hasPattern=!1,this.layoutVertexArray=new wa,this.centroidVertexArray=new zn,this.indexArray=new io,this.programConfigurations=new Tl(n.layers,n.zoom),this.segments=new or,this.stateDependentLayerIds=this.layers.filter(s=>s.isStateDependent()).map(s=>s.id)}populate(n,s,h){this.features=[],this.hasPattern=Ry("fill-extrusion",this.layers,s);for(const{feature:m,id:x,index:w,sourceLayerIndex:b}of n){const E=this.layers[0]._featureFilter.needGeometry,I=Il(m,E);if(!this.layers[0]._featureFilter.filter(new Rr(this.zoom),I,h))continue;const M={id:x,sourceLayerIndex:b,index:w,geometry:E?I.geometry:Cl(m),properties:m.properties,type:m.type,patterns:{}};this.hasPattern?this.features.push(Ly("fill-extrusion",this.layers,M,this.zoom,s)):this.addFeature(M,M.geometry,w,h,{}),s.featureIndex.insert(m,M.geometry,w,b,this.index,!0)}}addFeatures(n,s,h){for(const m of this.features){const{geometry:x}=m;this.addFeature(m,x,m.index,s,h)}}update(n,s,h){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(n,s,this.stateDependentLayers,h)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(n){this.uploaded||(this.layoutVertexBuffer=n.createVertexBuffer(this.layoutVertexArray,jI),this.centroidVertexBuffer=n.createVertexBuffer(this.centroidVertexArray,$I.members,!0),this.indexBuffer=n.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(n),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(n,s,h,m,x){for(const w of gu(s,500)){const b={x:0,y:0,vertexCount:0};let E=0;for(const Y of w)E+=Y.length;let I=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const Y of w){if(Y.length===0||YI(Y))continue;let J=0;for(let le=0;le=1){const ze=Y[le-1];if(!KI(pe,ze)){I.vertexLength+4>or.MAX_VERTEX_ARRAY_LENGTH&&(I=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const be=pe.sub(ze)._perp()._unit(),Ae=ze.dist(pe);J+Ae>32768&&(J=0),Gh(this.layoutVertexArray,pe.x,pe.y,be.x,be.y,0,0,J),Gh(this.layoutVertexArray,pe.x,pe.y,be.x,be.y,0,1,J),b.x+=2*pe.x,b.y+=2*pe.y,b.vertexCount+=2,J+=Ae,Gh(this.layoutVertexArray,ze.x,ze.y,be.x,be.y,0,0,J),Gh(this.layoutVertexArray,ze.x,ze.y,be.x,be.y,0,1,J),b.x+=2*ze.x,b.y+=2*ze.y,b.vertexCount+=2;const Ve=I.vertexLength;this.indexArray.emplaceBack(Ve,Ve+2,Ve+1),this.indexArray.emplaceBack(Ve+1,Ve+2,Ve+3),I.vertexLength+=4,I.primitiveLength+=2}}}}if(I.vertexLength+E>or.MAX_VERTEX_ARRAY_LENGTH&&(I=this.segments.prepareSegment(E,this.layoutVertexArray,this.indexArray)),XI[n.type]!=="Polygon")continue;const M=[],L=[],j=I.vertexLength;for(const Y of w)if(Y.length!==0){Y!==w[0]&&L.push(M.length/2);for(let J=0;Jfn)||o.y===n.y&&(o.y<0||o.y>fn)}function YI(o){return o.every(n=>n.x<0)||o.every(n=>n.x>fn)||o.every(n=>n.y<0)||o.every(n=>n.y>fn)}let Ax;bt("FillExtrusionBucket",By,{omit:["layers","features"]});var JI={get paint(){return Ax=Ax||new v({"fill-extrusion-opacity":new Tt(ie["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Nt(ie["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Tt(ie["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Tt(ie["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Fu(ie["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Nt(ie["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Nt(ie["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Tt(ie["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class QI extends a{constructor(n){super(n,JI)}createBucket(n){return new By(n)}queryRadius(){return rf(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(n,s,h,m,x,w,b,E){const I=nf(n,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),w.angle,b),M=this.paint.get("fill-extrusion-height").evaluate(s,h),L=this.paint.get("fill-extrusion-base").evaluate(s,h),j=function(Y,J,le,pe){const ze=[];for(const be of Y){const Ae=[be.x,be.y,0,1];of(Ae,Ae,J),ze.push(new D(Ae[0]/Ae[3],Ae[1]/Ae[3]))}return ze}(I,E),W=function(Y,J,le,pe){const ze=[],be=[],Ae=pe[8]*J,Ve=pe[9]*J,et=pe[10]*J,vt=pe[11]*J,Ft=pe[8]*le,gt=pe[9]*le,pt=pe[10]*le,Pt=pe[11]*le;for(const Et of Y){const wt=[],qe=[];for(const At of Et){const It=At.x,Vt=At.y,Ir=pe[0]*It+pe[4]*Vt+pe[12],Cr=pe[1]*It+pe[5]*Vt+pe[13],vn=pe[2]*It+pe[6]*Vt+pe[14],Po=pe[3]*It+pe[7]*Vt+pe[15],Ln=vn+et,xn=Po+vt,oi=Ir+Ft,si=Cr+gt,ai=vn+pt,rn=Po+Pt,wn=new D((Ir+Ae)/xn,(Cr+Ve)/xn);wn.z=Ln/xn,wt.push(wn);const Gn=new D(oi/rn,si/rn);Gn.z=ai/rn,qe.push(Gn)}ze.push(wt),be.push(qe)}return[ze,be]}(m,L,M,E);return function(Y,J,le){let pe=1/0;lx(le,J)&&(pe=Mx(le,J[0]));for(let ze=0;zes.id),this.index=n.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(s=>{this.gradients[s.id]={}}),this.layoutVertexArray=new Bu,this.layoutVertexArray2=new ba,this.indexArray=new io,this.programConfigurations=new Tl(n.layers,n.zoom),this.segments=new or,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(s=>s.isStateDependent()).map(s=>s.id)}populate(n,s,h){this.hasPattern=Ry("line",this.layers,s);const m=this.layers[0].layout.get("line-sort-key"),x=!m.isConstant(),w=[];for(const{feature:b,id:E,index:I,sourceLayerIndex:M}of n){const L=this.layers[0]._featureFilter.needGeometry,j=Il(b,L);if(!this.layers[0]._featureFilter.filter(new Rr(this.zoom),j,h))continue;const W=x?m.evaluate(j,{},h):void 0,Y={id:E,properties:b.properties,type:b.type,sourceLayerIndex:M,index:I,geometry:L?j.geometry:Cl(b),patterns:{},sortKey:W};w.push(Y)}x&&w.sort((b,E)=>b.sortKey-E.sortKey);for(const b of w){const{geometry:E,index:I,sourceLayerIndex:M}=b;if(this.hasPattern){const L=Ly("line",this.layers,b,this.zoom,s);this.patternFeatures.push(L)}else this.addFeature(b,E,I,h,{});s.featureIndex.insert(n[I].feature,E,I,M,this.index)}}update(n,s,h){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(n,s,this.stateDependentLayers,h)}addFeatures(n,s,h){for(const m of this.patternFeatures)this.addFeature(m,m.geometry,m.index,s,h)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(n){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=n.createVertexBuffer(this.layoutVertexArray2,nP)),this.layoutVertexBuffer=n.createVertexBuffer(this.layoutVertexArray,tP),this.indexBuffer=n.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(n),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(n){if(n.properties&&Object.prototype.hasOwnProperty.call(n.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(n.properties,"mapbox_clip_end"))return{start:+n.properties.mapbox_clip_start,end:+n.properties.mapbox_clip_end}}addFeature(n,s,h,m,x){const w=this.layers[0].layout,b=w.get("line-join").evaluate(n,{}),E=w.get("line-cap"),I=w.get("line-miter-limit"),M=w.get("line-round-limit");this.lineClips=this.lineFeatureClips(n);for(const L of s)this.addLine(L,n,b,E,I,M);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,n,h,x,m)}addLine(n,s,h,m,x,w){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let pe=0;pe=2&&n[E-1].equals(n[E-2]);)E--;let I=0;for(;I0;if(vt&&pe>I){const Pt=j.dist(W);if(Pt>2*M){const Et=j.sub(j.sub(W)._mult(M/Pt)._round());this.updateDistance(W,Et),this.addCurrentVertex(Et,J,0,0,L),W=Et}}const gt=W&&Y;let pt=gt?h:b?"butt":m;if(gt&&pt==="round"&&(Vex&&(pt="bevel"),pt==="bevel"&&(Ve>2&&(pt="flipbevel"),Ve100)ze=le.mult(-1);else{const Pt=Ve*J.add(le).mag()/J.sub(le).mag();ze._perp()._mult(Pt*(Ft?-1:1))}this.addCurrentVertex(j,ze,0,0,L),this.addCurrentVertex(j,ze.mult(-1),0,0,L)}else if(pt==="bevel"||pt==="fakeround"){const Pt=-Math.sqrt(Ve*Ve-1),Et=Ft?Pt:0,wt=Ft?0:Pt;if(W&&this.addCurrentVertex(j,J,Et,wt,L),pt==="fakeround"){const qe=Math.round(180*et/Math.PI/20);for(let At=1;At2*M){const Et=j.add(Y.sub(j)._mult(M/Pt)._round());this.updateDistance(j,Et),this.addCurrentVertex(Et,le,0,0,L),j=Et}}}}addCurrentVertex(n,s,h,m,x,w=!1){const b=s.y*m-s.x,E=-s.y-s.x*m;this.addHalfVertex(n,s.x+s.y*h,s.y-s.x*h,w,!1,h,x),this.addHalfVertex(n,b,E,w,!0,-m,x),this.distance>zx/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(n,s,h,m,x,w))}addHalfVertex({x:n,y:s},h,m,x,w,b,E){const I=.5*(this.lineClips?this.scaledDistance*(zx-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((n<<1)+(x?1:0),(s<<1)+(w?1:0),Math.round(63*h)+128,Math.round(63*m)+128,1+(b===0?0:b<0?-1:1)|(63&I)<<2,I>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const M=E.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,M),E.primitiveLength++),w?this.e2=M:this.e1=M}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(n,s){this.distance+=n.dist(s),this.updateScaledDistance()}}let Dx,Rx;bt("LineBucket",Ny,{omit:["layers","patternFeatures"]});var Lx={get paint(){return Rx=Rx||new v({"line-opacity":new Nt(ie.paint_line["line-opacity"]),"line-color":new Nt(ie.paint_line["line-color"]),"line-translate":new Tt(ie.paint_line["line-translate"]),"line-translate-anchor":new Tt(ie.paint_line["line-translate-anchor"]),"line-width":new Nt(ie.paint_line["line-width"]),"line-gap-width":new Nt(ie.paint_line["line-gap-width"]),"line-offset":new Nt(ie.paint_line["line-offset"]),"line-blur":new Nt(ie.paint_line["line-blur"]),"line-dasharray":new Ou(ie.paint_line["line-dasharray"]),"line-pattern":new Fu(ie.paint_line["line-pattern"]),"line-gradient":new Fh(ie.paint_line["line-gradient"])})},get layout(){return Dx=Dx||new v({"line-cap":new Tt(ie.layout_line["line-cap"]),"line-join":new Nt(ie.layout_line["line-join"]),"line-miter-limit":new Tt(ie.layout_line["line-miter-limit"]),"line-round-limit":new Tt(ie.layout_line["line-round-limit"]),"line-sort-key":new Nt(ie.layout_line["line-sort-key"])})}};class sP extends Nt{possiblyEvaluate(n,s){return s=new Rr(Math.floor(s.zoom),{now:s.now,fadeDuration:s.fadeDuration,zoomHistory:s.zoomHistory,transition:s.transition}),super.possiblyEvaluate(n,s)}evaluate(n,s,h,m){return s=ge({},s,{zoom:Math.floor(s.zoom)}),super.evaluate(n,s,h,m)}}let uf;class aP extends a{constructor(n){super(n,Lx),this.gradientVersion=0,uf||(uf=new sP(Lx.paint.properties["line-width"].specification),uf.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(n){if(n==="line-gradient"){const s=this.gradientExpression();this.stepInterpolant=!!function(h){return h._styleExpression!==void 0}(s)&&s._styleExpression.expression instanceof ra,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(n,s){super.recalculate(n,s),this.paint._values["line-floorwidth"]=uf.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,n)}createBucket(n){return new Ny(n)}queryRadius(n){const s=n,h=Fx(Nh("line-width",this,s),Nh("line-gap-width",this,s)),m=Nh("line-offset",this,s);return h/2+Math.abs(m)+rf(this.paint.get("line-translate"))}queryIntersectsFeature(n,s,h,m,x,w,b){const E=nf(n,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),w.angle,b),I=b/2*Fx(this.paint.get("line-width").evaluate(s,h),this.paint.get("line-gap-width").evaluate(s,h)),M=this.paint.get("line-offset").evaluate(s,h);return M&&(m=function(L,j){const W=[];for(let Y=0;Y=3){for(let le=0;le0?n+2*o:o}const lP=S([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),uP=S([{name:"a_projected_pos",components:3,type:"Float32"}],4);S([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const cP=S([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);S([{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 Ox=S([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),hP=S([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function dP(o,n,s){return o.sections.forEach(h=>{h.text=function(m,x,w){const b=x.layout.get("text-transform").evaluate(w,{});return b==="uppercase"?m=m.toLocaleUpperCase():b==="lowercase"&&(m=m.toLocaleLowerCase()),_i.applyArabicShaping&&(m=_i.applyArabicShaping(m)),m}(h.text,n,s)}),o}S([{name:"triangle",components:3,type:"Uint16"}]),S([{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"}]),S([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),S([{type:"Float32",name:"offsetX"}]),S([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),S([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const Wh={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var gn=24,Bx=Tr,Nx=function(o,n,s,h,m){var x,w,b=8*m-h-1,E=(1<>1,M=-7,L=m-1,j=-1,W=o[n+L];for(L+=j,x=W&(1<<-M)-1,W>>=-M,M+=b;M>0;x=256*x+o[n+L],L+=j,M-=8);for(w=x&(1<<-M)-1,x>>=-M,M+=h;M>0;w=256*w+o[n+L],L+=j,M-=8);if(x===0)x=1-I;else{if(x===E)return w?NaN:1/0*(W?-1:1);w+=Math.pow(2,h),x-=I}return(W?-1:1)*w*Math.pow(2,x-h)},$x=function(o,n,s,h,m,x){var w,b,E,I=8*x-m-1,M=(1<>1,j=m===23?Math.pow(2,-24)-Math.pow(2,-77):0,W=0,Y=1,J=n<0||n===0&&1/n<0?1:0;for(n=Math.abs(n),isNaN(n)||n===1/0?(b=isNaN(n)?1:0,w=M):(w=Math.floor(Math.log(n)/Math.LN2),n*(E=Math.pow(2,-w))<1&&(w--,E*=2),(n+=w+L>=1?j/E:j*Math.pow(2,1-L))*E>=2&&(w++,E/=2),w+L>=M?(b=0,w=M):w+L>=1?(b=(n*E-1)*Math.pow(2,m),w+=L):(b=n*Math.pow(2,L-1)*Math.pow(2,m),w=0));m>=8;o[s+W]=255&b,W+=Y,b/=256,m-=8);for(w=w<0;o[s+W]=255&w,W+=Y,w/=256,I-=8);o[s+W-Y]|=128*J};function Tr(o){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(o)?o:new Uint8Array(o||0),this.pos=0,this.type=0,this.length=this.buf.length}Tr.Varint=0,Tr.Fixed64=1,Tr.Bytes=2,Tr.Fixed32=5;var $y=4294967296,jx=1/$y,Ux=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function Fs(o){return o.type===Tr.Bytes?o.readVarint()+o.pos:o.pos+1}function qu(o,n,s){return s?4294967296*n+(o>>>0):4294967296*(n>>>0)+(o>>>0)}function Vx(o,n,s){var h=n<=16383?1:n<=2097151?2:n<=268435455?3:Math.floor(Math.log(n)/(7*Math.LN2));s.realloc(h);for(var m=s.pos-1;m>=o;m--)s.buf[m+h]=s.buf[m]}function pP(o,n){for(var s=0;s>>8,o[s+2]=n>>>16,o[s+3]=n>>>24}function Hx(o,n){return(o[n]|o[n+1]<<8|o[n+2]<<16)+(o[n+3]<<24)}Tr.prototype={destroy:function(){this.buf=null},readFields:function(o,n,s){for(s=s||this.length;this.pos>3,x=this.pos;this.type=7&h,o(m,n,this),this.pos===x&&this.skip(h)}return n},readMessage:function(o,n){return this.readFields(o,n,this.readVarint()+this.pos)},readFixed32:function(){var o=cf(this.buf,this.pos);return this.pos+=4,o},readSFixed32:function(){var o=Hx(this.buf,this.pos);return this.pos+=4,o},readFixed64:function(){var o=cf(this.buf,this.pos)+cf(this.buf,this.pos+4)*$y;return this.pos+=8,o},readSFixed64:function(){var o=cf(this.buf,this.pos)+Hx(this.buf,this.pos+4)*$y;return this.pos+=8,o},readFloat:function(){var o=Nx(this.buf,this.pos,!0,23,4);return this.pos+=4,o},readDouble:function(){var o=Nx(this.buf,this.pos,!0,52,8);return this.pos+=8,o},readVarint:function(o){var n,s,h=this.buf;return n=127&(s=h[this.pos++]),s<128?n:(n|=(127&(s=h[this.pos++]))<<7,s<128?n:(n|=(127&(s=h[this.pos++]))<<14,s<128?n:(n|=(127&(s=h[this.pos++]))<<21,s<128?n:function(m,x,w){var b,E,I=w.buf;if(b=(112&(E=I[w.pos++]))>>4,E<128||(b|=(127&(E=I[w.pos++]))<<3,E<128)||(b|=(127&(E=I[w.pos++]))<<10,E<128)||(b|=(127&(E=I[w.pos++]))<<17,E<128)||(b|=(127&(E=I[w.pos++]))<<24,E<128)||(b|=(1&(E=I[w.pos++]))<<31,E<128))return qu(m,b,x);throw new Error("Expected varint not more than 10 bytes")}(n|=(15&(s=h[this.pos]))<<28,o,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var o=this.readVarint();return o%2==1?(o+1)/-2:o/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var o=this.readVarint()+this.pos,n=this.pos;return this.pos=o,o-n>=12&&Ux?function(s,h,m){return Ux.decode(s.subarray(h,m))}(this.buf,n,o):function(s,h,m){for(var x="",w=h;w239?4:M>223?3:M>191?2:1;if(w+j>m)break;j===1?M<128&&(L=M):j===2?(192&(b=s[w+1]))==128&&(L=(31&M)<<6|63&b)<=127&&(L=null):j===3?(E=s[w+2],(192&(b=s[w+1]))==128&&(192&E)==128&&((L=(15&M)<<12|(63&b)<<6|63&E)<=2047||L>=55296&&L<=57343)&&(L=null)):j===4&&(E=s[w+2],I=s[w+3],(192&(b=s[w+1]))==128&&(192&E)==128&&(192&I)==128&&((L=(15&M)<<18|(63&b)<<12|(63&E)<<6|63&I)<=65535||L>=1114112)&&(L=null)),L===null?(L=65533,j=1):L>65535&&(L-=65536,x+=String.fromCharCode(L>>>10&1023|55296),L=56320|1023&L),x+=String.fromCharCode(L),w+=j}return x}(this.buf,n,o)},readBytes:function(){var o=this.readVarint()+this.pos,n=this.buf.subarray(this.pos,o);return this.pos=o,n},readPackedVarint:function(o,n){if(this.type!==Tr.Bytes)return o.push(this.readVarint(n));var s=Fs(this);for(o=o||[];this.pos127;);else if(n===Tr.Bytes)this.pos=this.readVarint()+this.pos;else if(n===Tr.Fixed32)this.pos+=4;else{if(n!==Tr.Fixed64)throw new Error("Unimplemented type: "+n);this.pos+=8}},writeTag:function(o,n){this.writeVarint(o<<3|n)},realloc:function(o){for(var n=this.length||16;n268435455||o<0?function(n,s){var h,m;if(n>=0?(h=n%4294967296|0,m=n/4294967296|0):(m=~(-n/4294967296),4294967295^(h=~(-n%4294967296))?h=h+1|0:(h=0,m=m+1|0)),n>=18446744073709552e3||n<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");s.realloc(10),function(x,w,b){b.buf[b.pos++]=127&x|128,x>>>=7,b.buf[b.pos++]=127&x|128,x>>>=7,b.buf[b.pos++]=127&x|128,x>>>=7,b.buf[b.pos++]=127&x|128,b.buf[b.pos]=127&(x>>>=7)}(h,0,s),function(x,w){var b=(7&x)<<4;w.buf[w.pos++]|=b|((x>>>=3)?128:0),x&&(w.buf[w.pos++]=127&x|((x>>>=7)?128:0),x&&(w.buf[w.pos++]=127&x|((x>>>=7)?128:0),x&&(w.buf[w.pos++]=127&x|((x>>>=7)?128:0),x&&(w.buf[w.pos++]=127&x|((x>>>=7)?128:0),x&&(w.buf[w.pos++]=127&x)))))}(m,s)}(o,this):(this.realloc(4),this.buf[this.pos++]=127&o|(o>127?128:0),o<=127||(this.buf[this.pos++]=127&(o>>>=7)|(o>127?128:0),o<=127||(this.buf[this.pos++]=127&(o>>>=7)|(o>127?128:0),o<=127||(this.buf[this.pos++]=o>>>7&127))))},writeSVarint:function(o){this.writeVarint(o<0?2*-o-1:2*o)},writeBoolean:function(o){this.writeVarint(!!o)},writeString:function(o){o=String(o),this.realloc(4*o.length),this.pos++;var n=this.pos;this.pos=function(h,m,x){for(var w,b,E=0;E55295&&w<57344){if(!b){w>56319||E+1===m.length?(h[x++]=239,h[x++]=191,h[x++]=189):b=w;continue}if(w<56320){h[x++]=239,h[x++]=191,h[x++]=189,b=w;continue}w=b-55296<<10|w-56320|65536,b=null}else b&&(h[x++]=239,h[x++]=191,h[x++]=189,b=null);w<128?h[x++]=w:(w<2048?h[x++]=w>>6|192:(w<65536?h[x++]=w>>12|224:(h[x++]=w>>18|240,h[x++]=w>>12&63|128),h[x++]=w>>6&63|128),h[x++]=63&w|128)}return x}(this.buf,o,this.pos);var s=this.pos-n;s>=128&&Vx(n,s,this),this.pos=n-1,this.writeVarint(s),this.pos+=s},writeFloat:function(o){this.realloc(4),$x(this.buf,o,this.pos,!0,23,4),this.pos+=4},writeDouble:function(o){this.realloc(8),$x(this.buf,o,this.pos,!0,52,8),this.pos+=8},writeBytes:function(o){var n=o.length;this.writeVarint(n),this.realloc(n);for(var s=0;s=128&&Vx(s,h,this),this.pos=s-1,this.writeVarint(h),this.pos+=h},writeMessage:function(o,n,s){this.writeTag(o,Tr.Bytes),this.writeRawMessage(n,s)},writePackedVarint:function(o,n){n.length&&this.writeMessage(o,pP,n)},writePackedSVarint:function(o,n){n.length&&this.writeMessage(o,fP,n)},writePackedBoolean:function(o,n){n.length&&this.writeMessage(o,yP,n)},writePackedFloat:function(o,n){n.length&&this.writeMessage(o,mP,n)},writePackedDouble:function(o,n){n.length&&this.writeMessage(o,gP,n)},writePackedFixed32:function(o,n){n.length&&this.writeMessage(o,_P,n)},writePackedSFixed32:function(o,n){n.length&&this.writeMessage(o,vP,n)},writePackedFixed64:function(o,n){n.length&&this.writeMessage(o,xP,n)},writePackedSFixed64:function(o,n){n.length&&this.writeMessage(o,wP,n)},writeBytesField:function(o,n){this.writeTag(o,Tr.Bytes),this.writeBytes(n)},writeFixed32Field:function(o,n){this.writeTag(o,Tr.Fixed32),this.writeFixed32(n)},writeSFixed32Field:function(o,n){this.writeTag(o,Tr.Fixed32),this.writeSFixed32(n)},writeFixed64Field:function(o,n){this.writeTag(o,Tr.Fixed64),this.writeFixed64(n)},writeSFixed64Field:function(o,n){this.writeTag(o,Tr.Fixed64),this.writeSFixed64(n)},writeVarintField:function(o,n){this.writeTag(o,Tr.Varint),this.writeVarint(n)},writeSVarintField:function(o,n){this.writeTag(o,Tr.Varint),this.writeSVarint(n)},writeStringField:function(o,n){this.writeTag(o,Tr.Bytes),this.writeString(n)},writeFloatField:function(o,n){this.writeTag(o,Tr.Fixed32),this.writeFloat(n)},writeDoubleField:function(o,n){this.writeTag(o,Tr.Fixed64),this.writeDouble(n)},writeBooleanField:function(o,n){this.writeVarintField(o,!!n)}};var jy=T(Bx);const Uy=3;function bP(o,n,s){o===1&&s.readMessage(SP,n)}function SP(o,n,s){if(o===3){const{id:h,bitmap:m,width:x,height:w,left:b,top:E,advance:I}=s.readMessage(EP,{});n.push({id:h,bitmap:new jh({width:x+2*Uy,height:w+2*Uy},m),metrics:{width:x,height:w,left:b,top:E,advance:I}})}}function EP(o,n,s){o===1?n.id=s.readVarint():o===2?n.bitmap=s.readBytes():o===3?n.width=s.readVarint():o===4?n.height=s.readVarint():o===5?n.left=s.readSVarint():o===6?n.top=s.readSVarint():o===7&&(n.advance=s.readVarint())}const Gx=Uy;function Zx(o){let n=0,s=0;for(const w of o)n+=w.w*w.h,s=Math.max(s,w.w);o.sort((w,b)=>b.h-w.h);const h=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(n/.95)),s),h:1/0}];let m=0,x=0;for(const w of o)for(let b=h.length-1;b>=0;b--){const E=h[b];if(!(w.w>E.w||w.h>E.h)){if(w.x=E.x,w.y=E.y,x=Math.max(x,w.y+w.h),m=Math.max(m,w.x+w.w),w.w===E.w&&w.h===E.h){const I=h.pop();b=0&&h>=n&&df[this.text.charCodeAt(h)];h--)s--;this.text=this.text.substring(n,s),this.sectionIndex=this.sectionIndex.slice(n,s)}substring(n,s){const h=new Ku;return h.text=this.text.substring(n,s),h.sectionIndex=this.sectionIndex.slice(n,s),h.sections=this.sections,h}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((n,s)=>Math.max(n,this.sections[s].scale),0)}addTextSection(n,s){this.text+=n.text,this.sections.push(Xh.forText(n.scale,n.fontStack||s));const h=this.sections.length-1;for(let m=0;m=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function hf(o,n,s,h,m,x,w,b,E,I,M,L,j,W,Y){const J=Ku.fromFeature(o,m);let le;L===y.ah.vertical&&J.verticalizePunctuation();const{processBidirectionalText:pe,processStyledBidirectionalText:ze}=_i;if(pe&&J.sections.length===1){le=[];const Ve=pe(J.toString(),Hy(J,I,x,n,h,W));for(const et of Ve){const vt=new Ku;vt.text=et,vt.sections=J.sections;for(let Ft=0;Ft0&&Os>On&&(On=Os)}else{const lo=vt[mr.fontStack],Tn=lo&&lo[Br];if(Tn&&Tn.rect)ec=Tn.rect,Wr=Tn.metrics;else{const Os=et[mr.fontStack],td=Os&&Os[Br];if(!td)continue;Wr=td.metrics}ji=(wn-mr.scale)*gn}Ao?(Ve.verticalizable=!0,li.push({glyph:Br,imageName:us,x:Vt,y:Ir+ji,vertical:Ao,scale:mr.scale,fontStack:mr.fontStack,sectionIndex:Mr,metrics:Wr,rect:ec}),Vt+=cs*mr.scale+qe):(li.push({glyph:Br,imageName:us,x:Vt,y:Ir+ji,vertical:Ao,scale:mr.scale,fontStack:mr.fontStack,sectionIndex:Mr,metrics:Wr,rect:ec}),Vt+=Wr.advance*mr.scale+qe)}li.length!==0&&(Cr=Math.max(Vt-qe,Cr),IP(li,0,li.length-1,Po,On)),Vt=0;const ao=pt*wn+On;Fn.lineOffset=Math.max(On,Gn),Ir+=ao,vn=Math.max(ao,vn),++Ln}var xn;const oi=Ir-qh,{horizontalAlign:si,verticalAlign:ai}=Gy(Pt);(function(rn,wn,Gn,Fn,li,On,ao,wi,mr){const Mr=(wn-Gn)*li;let Br=0;Br=On!==ao?-wi*Fn-qh:(-Fn*mr+.5)*ao;for(const ji of rn)for(const Wr of ji.positionedGlyphs)Wr.x+=Mr,Wr.y+=Br})(Ve.positionedLines,Po,si,ai,Cr,vn,pt,oi,gt.length),Ve.top+=-ai*oi,Ve.bottom=Ve.top+oi,Ve.left+=-si*Cr,Ve.right=Ve.left+Cr}(Ae,n,s,h,le,w,b,E,L,I,j,Y),!function(Ve){for(const et of Ve)if(et.positionedGlyphs.length!==0)return!1;return!0}(be)&&Ae}const df={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},kP={10:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},TP={40:!0};function qx(o,n,s,h,m,x){if(n.imageName){const w=h[n.imageName];return w?w.displaySize[0]*n.scale*gn/x+m:0}{const w=s[n.fontStack],b=w&&w[o];return b?b.metrics.advance*n.scale+m:0}}function Xx(o,n,s,h){const m=Math.pow(o-n,2);return h?o=0;let I=0;for(let L=0;LI){const M=Math.ceil(x/I);m*=M/w,w=M}return{x1:h,y1:m,x2:h+x,y2:m+w}}function Qx(o,n,s,h,m,x){const w=o.image;let b;if(w.content){const le=w.content,pe=w.pixelRatio||1;b=[le[0]/pe,le[1]/pe,w.displaySize[0]-le[2]/pe,w.displaySize[1]-le[3]/pe]}const E=n.left*x,I=n.right*x;let M,L,j,W;s==="width"||s==="both"?(W=m[0]+E-h[3],L=m[0]+I+h[1]):(W=m[0]+(E+I-w.displaySize[0])/2,L=W+w.displaySize[0]);const Y=n.top*x,J=n.bottom*x;return s==="height"||s==="both"?(M=m[1]+Y-h[0],j=m[1]+J+h[2]):(M=m[1]+(Y+J-w.displaySize[1])/2,j=M+w.displaySize[1]),{image:w,top:M,right:L,bottom:j,left:W,collisionPadding:b}}const Kh=255,ls=128,Pa=Kh*ls;function ew(o,n){const{expression:s}=n;if(s.kind==="constant")return{kind:"constant",layoutSize:s.evaluate(new Rr(o+1))};if(s.kind==="source")return{kind:"source"};{const{zoomStops:h,interpolationType:m}=s;let x=0;for(;xw.id),this.index=n.index,this.pixelRatio=n.pixelRatio,this.sourceLayerIndex=n.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=Iy([]),this.placementViewportMatrix=Iy([]);const s=this.layers[0]._unevaluatedLayout._values;this.textSizeData=ew(this.zoom,s["text-size"]),this.iconSizeData=ew(this.zoom,s["icon-size"]);const h=this.layers[0].layout,m=h.get("symbol-sort-key"),x=h.get("symbol-z-order");this.canOverlap=Zy(h,"text-overlap","text-allow-overlap")!=="never"||Zy(h,"icon-overlap","icon-allow-overlap")!=="never"||h.get("text-ignore-placement")||h.get("icon-ignore-placement"),this.sortFeaturesByKey=x!=="viewport-y"&&!m.isConstant(),this.sortFeaturesByY=(x==="viewport-y"||x==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,h.get("symbol-placement")==="point"&&(this.writingModes=h.get("text-writing-mode").map(w=>y.ah[w])),this.stateDependentLayerIds=this.layers.filter(w=>w.isStateDependent()).map(w=>w.id),this.sourceID=n.sourceID}createArrays(){this.text=new qy(new Tl(this.layers,this.zoom,n=>/^text/.test(n))),this.icon=new qy(new Tl(this.layers,this.zoom,n=>/^icon/.test(n))),this.glyphOffsetArray=new Fr,this.lineVertexArray=new Mn,this.symbolInstances=new nr,this.textAnchorOffsets=new Or}calculateGlyphDependencies(n,s,h,m,x){for(let w=0;w0)&&(w.value.kind!=="constant"||w.value.value.length>0),M=E.value.kind!=="constant"||!!E.value.value||Object.keys(E.parameters).length>0,L=x.get("symbol-sort-key");if(this.features=[],!I&&!M)return;const j=s.iconDependencies,W=s.glyphDependencies,Y=s.availableImages,J=new Rr(this.zoom);for(const{feature:le,id:pe,index:ze,sourceLayerIndex:be}of n){const Ae=m._featureFilter.needGeometry,Ve=Il(le,Ae);if(!m._featureFilter.filter(J,Ve,h))continue;let et,vt;if(Ae||(Ve.geometry=Cl(le)),I){const gt=m.getValueAndResolveTokens("text-field",Ve,h,Y),pt=fi.factory(gt),Pt=this.hasRTLText=this.hasRTLText||zP(pt);(!Pt||_i.getRTLTextPluginStatus()==="unavailable"||Pt&&_i.isParsed())&&(et=dP(pt,m,Ve))}if(M){const gt=m.getValueAndResolveTokens("icon-image",Ve,h,Y);vt=gt instanceof gi?gt:gi.fromString(gt)}if(!et&&!vt)continue;const Ft=this.sortFeaturesByKey?L.evaluate(Ve,{},h):void 0;if(this.features.push({id:pe,text:et,icon:vt,index:ze,sourceLayerIndex:be,geometry:Ve.geometry,properties:le.properties,type:AP[le.type],sortKey:Ft}),vt&&(j[vt.name]=!0),et){const gt=w.evaluate(Ve,{},h).join(","),pt=x.get("text-rotation-alignment")!=="viewport"&&x.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(y.ah.vertical)>=0;for(const Pt of et.sections)if(Pt.image)j[Pt.image.name]=!0;else{const Et=zh(et.toString()),wt=Pt.fontStack||gt,qe=W[wt]=W[wt]||{};this.calculateGlyphDependencies(Pt.text,qe,pt,this.allowVerticalPlacement,Et)}}}x.get("symbol-placement")==="line"&&(this.features=function(le){const pe={},ze={},be=[];let Ae=0;function Ve(gt){be.push(le[gt]),Ae++}function et(gt,pt,Pt){const Et=ze[gt];return delete ze[gt],ze[pt]=Et,be[Et].geometry[0].pop(),be[Et].geometry[0]=be[Et].geometry[0].concat(Pt[0]),Et}function vt(gt,pt,Pt){const Et=pe[pt];return delete pe[pt],pe[gt]=Et,be[Et].geometry[0].shift(),be[Et].geometry[0]=Pt[0].concat(be[Et].geometry[0]),Et}function Ft(gt,pt,Pt){const Et=Pt?pt[0][pt[0].length-1]:pt[0][0];return`${gt}:${Et.x}:${Et.y}`}for(let gt=0;gtgt.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((le,pe)=>le.sortKey-pe.sortKey)}update(n,s,h){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(n,s,this.layers,h),this.icon.programConfigurations.updatePaintArrays(n,s,this.layers,h))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(n){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(n),this.iconCollisionBox.upload(n)),this.text.upload(n,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(n,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(n,s){const h=this.lineVertexArray.length;if(n.segment!==void 0){let m=n.dist(s[n.segment+1]),x=n.dist(s[n.segment]);const w={};for(let b=n.segment+1;b=0;b--)w[b]={x:s[b].x,y:s[b].y,tileUnitDistanceFromAnchor:x},b>0&&(x+=s[b-1].dist(s[b]));for(let b=0;b0}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(n,s){const h=n.placedSymbolArray.get(s),m=h.vertexStartIndex+4*h.numGlyphs;for(let x=h.vertexStartIndex;xm[b]-m[E]||x[E]-x[b]),w}addToSortKeyRanges(n,s){const h=this.sortKeyRanges[this.sortKeyRanges.length-1];h&&h.sortKey===s?h.symbolInstanceEnd=n+1:this.sortKeyRanges.push({sortKey:s,symbolInstanceStart:n,symbolInstanceEnd:n+1})}sortFeatures(n){if(this.sortFeaturesByY&&this.sortedAngle!==n&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(n),this.sortedAngle=n,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const s of this.symbolInstanceIndexes){const h=this.symbolInstances.get(s);this.featureSortOrder.push(h.featureIndex),[h.rightJustifiedTextSymbolIndex,h.centerJustifiedTextSymbolIndex,h.leftJustifiedTextSymbolIndex].forEach((m,x,w)=>{m>=0&&w.indexOf(m)===x&&this.addIndicesForPlacedSymbol(this.text,m)}),h.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,h.verticalPlacedTextSymbolIndex),h.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,h.placedIconSymbolIndex),h.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,h.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let tw,rw;bt("SymbolBucket",Yu,{omit:["layers","collisionBoxArray","features","compareText"]}),Yu.MAX_GLYPHS=65535,Yu.addDynamicAttributes=Wy;var Ky={get paint(){return rw=rw||new v({"icon-opacity":new Nt(ie.paint_symbol["icon-opacity"]),"icon-color":new Nt(ie.paint_symbol["icon-color"]),"icon-halo-color":new Nt(ie.paint_symbol["icon-halo-color"]),"icon-halo-width":new Nt(ie.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Nt(ie.paint_symbol["icon-halo-blur"]),"icon-translate":new Tt(ie.paint_symbol["icon-translate"]),"icon-translate-anchor":new Tt(ie.paint_symbol["icon-translate-anchor"]),"text-opacity":new Nt(ie.paint_symbol["text-opacity"]),"text-color":new Nt(ie.paint_symbol["text-color"],{runtimeType:jr,getOverride:o=>o.textColor,hasOverride:o=>!!o.textColor}),"text-halo-color":new Nt(ie.paint_symbol["text-halo-color"]),"text-halo-width":new Nt(ie.paint_symbol["text-halo-width"]),"text-halo-blur":new Nt(ie.paint_symbol["text-halo-blur"]),"text-translate":new Tt(ie.paint_symbol["text-translate"]),"text-translate-anchor":new Tt(ie.paint_symbol["text-translate-anchor"])})},get layout(){return tw=tw||new v({"symbol-placement":new Tt(ie.layout_symbol["symbol-placement"]),"symbol-spacing":new Tt(ie.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Tt(ie.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Nt(ie.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Tt(ie.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Tt(ie.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Tt(ie.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Tt(ie.layout_symbol["icon-ignore-placement"]),"icon-optional":new Tt(ie.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Tt(ie.layout_symbol["icon-rotation-alignment"]),"icon-size":new Nt(ie.layout_symbol["icon-size"]),"icon-text-fit":new Tt(ie.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Tt(ie.layout_symbol["icon-text-fit-padding"]),"icon-image":new Nt(ie.layout_symbol["icon-image"]),"icon-rotate":new Nt(ie.layout_symbol["icon-rotate"]),"icon-padding":new Nt(ie.layout_symbol["icon-padding"]),"icon-keep-upright":new Tt(ie.layout_symbol["icon-keep-upright"]),"icon-offset":new Nt(ie.layout_symbol["icon-offset"]),"icon-anchor":new Nt(ie.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Tt(ie.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Tt(ie.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Tt(ie.layout_symbol["text-rotation-alignment"]),"text-field":new Nt(ie.layout_symbol["text-field"]),"text-font":new Nt(ie.layout_symbol["text-font"]),"text-size":new Nt(ie.layout_symbol["text-size"]),"text-max-width":new Nt(ie.layout_symbol["text-max-width"]),"text-line-height":new Tt(ie.layout_symbol["text-line-height"]),"text-letter-spacing":new Nt(ie.layout_symbol["text-letter-spacing"]),"text-justify":new Nt(ie.layout_symbol["text-justify"]),"text-radial-offset":new Nt(ie.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Tt(ie.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Nt(ie.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Nt(ie.layout_symbol["text-anchor"]),"text-max-angle":new Tt(ie.layout_symbol["text-max-angle"]),"text-writing-mode":new Tt(ie.layout_symbol["text-writing-mode"]),"text-rotate":new Nt(ie.layout_symbol["text-rotate"]),"text-padding":new Tt(ie.layout_symbol["text-padding"]),"text-keep-upright":new Tt(ie.layout_symbol["text-keep-upright"]),"text-transform":new Nt(ie.layout_symbol["text-transform"]),"text-offset":new Nt(ie.layout_symbol["text-offset"]),"text-allow-overlap":new Tt(ie.layout_symbol["text-allow-overlap"]),"text-overlap":new Tt(ie.layout_symbol["text-overlap"]),"text-ignore-placement":new Tt(ie.layout_symbol["text-ignore-placement"]),"text-optional":new Tt(ie.layout_symbol["text-optional"])})}};class nw{constructor(n){if(n.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=n.property.overrides?n.property.overrides.runtimeType:Qn,this.defaultValue=n}evaluate(n){if(n.formattedSection){const s=this.defaultValue.property.overrides;if(s&&s.hasOverride(n.formattedSection))return s.getOverride(n.formattedSection)}return n.feature&&n.featureState?this.defaultValue.evaluate(n.feature,n.featureState):this.defaultValue.property.specification.default}eachChild(n){this.defaultValue.isConstant()||n(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}bt("FormatSectionOverride",nw,{omit:["defaultValue"]});class ff extends a{constructor(n){super(n,Ky)}recalculate(n,s){if(super.recalculate(n,s),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 h=this.layout.get("text-writing-mode");if(h){const m=[];for(const x of h)m.indexOf(x)<0&&m.push(x);this.layout._values["text-writing-mode"]=m}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(n,s,h,m){const x=this.layout.get(n).evaluate(s,{},h,m),w=this._unevaluatedLayout._values[n];return w.isDataDriven()||Eu(w.value)||!x?x:function(b,E){return E.replace(/{([^{}]+)}/g,(I,M)=>b&&M in b?String(b[M]):"")}(s.properties,x)}createBucket(n){return new Yu(n)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const n of Ky.paint.overridableProperties){if(!ff.hasPaintOverride(this.layout,n))continue;const s=this.paint.get(n),h=new nw(s),m=new Su(h,s.property.specification);let x=null;x=s.value.kind==="constant"||s.value.kind==="source"?new ha("source",m):new da("composite",m,s.value.zoomStops),this.paint._values[n]=new Co(s.property,x,s.parameters)}}_handleOverridablePaintPropertyUpdate(n,s,h){return!(!this.layout||s.isDataDriven()||h.isDataDriven())&&ff.hasPaintOverride(this.layout,n)}static hasPaintOverride(n,s){const h=n.get("text-field"),m=Ky.paint.properties[s];let x=!1;const w=b=>{for(const E of b)if(m.overrides&&m.overrides.hasOverride(E))return void(x=!0)};if(h.value.kind==="constant"&&h.value.value instanceof fi)w(h.value.value.sections);else if(h.value.kind==="source"){const b=I=>{x||(I instanceof Ji&&pn(I.value)===Ki?w(I.value.sections):I instanceof fu?w(I.sections):I.eachChild(b))},E=h.value;E._styleExpression&&b(E._styleExpression.expression)}return x}}let iw;var DP={get paint(){return iw=iw||new v({"background-color":new Tt(ie.paint_background["background-color"]),"background-pattern":new Ou(ie.paint_background["background-pattern"]),"background-opacity":new Tt(ie.paint_background["background-opacity"])})}};class RP extends a{constructor(n){super(n,DP)}}let ow;var LP={get paint(){return ow=ow||new v({"raster-opacity":new Tt(ie.paint_raster["raster-opacity"]),"raster-hue-rotate":new Tt(ie.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Tt(ie.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Tt(ie.paint_raster["raster-brightness-max"]),"raster-saturation":new Tt(ie.paint_raster["raster-saturation"]),"raster-contrast":new Tt(ie.paint_raster["raster-contrast"]),"raster-resampling":new Tt(ie.paint_raster["raster-resampling"]),"raster-fade-duration":new Tt(ie.paint_raster["raster-fade-duration"])})}};class FP extends a{constructor(n){super(n,LP)}}class OP extends a{constructor(n){super(n,{}),this.onAdd=s=>{this.implementation.onAdd&&this.implementation.onAdd(s,s.painter.context.gl)},this.onRemove=s=>{this.implementation.onRemove&&this.implementation.onRemove(s,s.painter.context.gl)},this.implementation=n}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class BP{constructor(n){this._methodToThrottle=n,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}const Yy=63710088e-1;class Aa{constructor(n,s){if(isNaN(n)||isNaN(s))throw new Error(`Invalid LngLat object: (${n}, ${s})`);if(this.lng=+n,this.lat=+s,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Aa(Ee(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(n){const s=Math.PI/180,h=this.lat*s,m=n.lat*s,x=Math.sin(h)*Math.sin(m)+Math.cos(h)*Math.cos(m)*Math.cos((n.lng-this.lng)*s);return Yy*Math.acos(Math.min(x,1))}static convert(n){if(n instanceof Aa)return n;if(Array.isArray(n)&&(n.length===2||n.length===3))return new Aa(Number(n[0]),Number(n[1]));if(!Array.isArray(n)&&typeof n=="object"&&n!==null)return new Aa(Number("lng"in n?n.lng:n.lon),Number(n.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}const sw=2*Math.PI*Yy;function aw(o){return sw*Math.cos(o*Math.PI/180)}function lw(o){return(180+o)/360}function uw(o){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+o*Math.PI/360)))/360}function cw(o,n){return o/aw(n)}function Jy(o){return 360/Math.PI*Math.atan(Math.exp((180-360*o)*Math.PI/180))-90}class Yh{constructor(n,s,h=0){this.x=+n,this.y=+s,this.z=+h}static fromLngLat(n,s=0){const h=Aa.convert(n);return new Yh(lw(h.lng),uw(h.lat),cw(s,h.lat))}toLngLat(){return new Aa(360*this.x-180,Jy(this.y))}toAltitude(){return this.z*aw(Jy(this.y))}meterInMercatorCoordinateUnits(){return 1/sw*(n=Jy(this.y),1/Math.cos(n*Math.PI/180));var n}}function hw(o,n,s){var h=2*Math.PI*6378137/256/Math.pow(2,s);return[o*h-2*Math.PI*6378137/2,n*h-2*Math.PI*6378137/2]}class Qy{constructor(n,s,h){if(!function(m,x,w){return!(m<0||m>25||w<0||w>=Math.pow(2,m)||x<0||x>=Math.pow(2,m))}(n,s,h))throw new Error(`x=${s}, y=${h}, z=${n} outside of bounds. 0<=x<${Math.pow(2,n)}, 0<=y<${Math.pow(2,n)} 0<=z<=25 `);this.z=n,this.x=s,this.y=h,this.key=Jh(0,n,n,s,h)}equals(n){return this.z===n.z&&this.x===n.x&&this.y===n.y}url(n,s,h){const m=(w=this.y,b=this.z,E=hw(256*(x=this.x),256*(w=Math.pow(2,b)-w-1),b),I=hw(256*(x+1),256*(w+1),b),E[0]+","+E[1]+","+I[0]+","+I[1]);var x,w,b,E,I;const M=function(L,j,W){let Y,J="";for(let le=L;le>0;le--)Y=1<1?"@2x":"").replace(/{quadkey}/g,M).replace(/{bbox-epsg-3857}/g,m)}isChildOf(n){const s=this.z-n.z;return s>0&&n.x===this.x>>s&&n.y===this.y>>s}getTilePoint(n){const s=Math.pow(2,this.z);return new D((n.x*s-this.x)*fn,(n.y*s-this.y)*fn)}toString(){return`${this.z}/${this.x}/${this.y}`}}class dw{constructor(n,s){this.wrap=n,this.canonical=s,this.key=Jh(n,s.z,s.z,s.x,s.y)}}class so{constructor(n,s,h,m,x){if(n= z; overscaledZ = ${n}; z = ${h}`);this.overscaledZ=n,this.wrap=s,this.canonical=new Qy(h,+m,+x),this.key=Jh(s,n,h,m,x)}clone(){return new so(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(n){return this.overscaledZ===n.overscaledZ&&this.wrap===n.wrap&&this.canonical.equals(n.canonical)}scaledTo(n){if(n>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${n}; overscaledZ = ${this.overscaledZ}`);const s=this.canonical.z-n;return n>this.canonical.z?new so(n,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new so(n,this.wrap,n,this.canonical.x>>s,this.canonical.y>>s)}calculateScaledKey(n,s){if(n>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${n}; overscaledZ = ${this.overscaledZ}`);const h=this.canonical.z-n;return n>this.canonical.z?Jh(this.wrap*+s,n,this.canonical.z,this.canonical.x,this.canonical.y):Jh(this.wrap*+s,n,n,this.canonical.x>>h,this.canonical.y>>h)}isChildOf(n){if(n.wrap!==this.wrap)return!1;const s=this.canonical.z-n.canonical.z;return n.overscaledZ===0||n.overscaledZ>s&&n.canonical.y===this.canonical.y>>s}children(n){if(this.overscaledZ>=n)return[new so(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const s=this.canonical.z+1,h=2*this.canonical.x,m=2*this.canonical.y;return[new so(s,this.wrap,s,h,m),new so(s,this.wrap,s,h+1,m),new so(s,this.wrap,s,h,m+1),new so(s,this.wrap,s,h+1,m+1)]}isLessThan(n){return this.wrapn.wrap)&&(this.overscaledZn.overscaledZ)&&(this.canonical.xn.canonical.x)&&this.canonical.ythis.max&&(this.max=L),L=this.dim+1||s<-1||s>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(s+1)*this.stride+(n+1)}unpack(n,s,h){return n*this.redFactor+s*this.greenFactor+h*this.blueFactor-this.baseShift}getPixels(){return new oo({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(n,s,h){if(this.dim!==n.dim)throw new Error("dem dimension mismatch");let m=s*this.dim,x=s*this.dim+this.dim,w=h*this.dim,b=h*this.dim+this.dim;switch(s){case-1:m=x-1;break;case 1:x=m+1}switch(h){case-1:w=b-1;break;case 1:b=w+1}const E=-s*this.dim,I=-h*this.dim;for(let M=w;M=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${n} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[n]}}class mw{constructor(n,s,h,m,x){this.type="Feature",this._vectorTileFeature=n,n._z=s,n._x=h,n._y=m,this.properties=n.properties,this.id=x}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(n){this._geometry=n}toJSON(){const n={geometry:this.geometry};for(const s in this)s!=="_geometry"&&s!=="_vectorTileFeature"&&(n[s]=this[s]);return n}}class gw{constructor(n,s){this.tileID=n,this.x=n.canonical.x,this.y=n.canonical.y,this.z=n.canonical.z,this.grid=new ga(fn,16,0),this.grid3D=new ga(fn,16,0),this.featureIndexArray=new Vn,this.promoteId=s}insert(n,s,h,m,x,w){const b=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(h,m,x);const E=w?this.grid3D:this.grid;for(let I=0;I=0&&L[3]>=0&&E.insert(b,L[0],L[1],L[2],L[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Ca.VectorTile(new jy(this.rawTileData)).layers,this.sourceLayerCoder=new fw(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(n,s,h,m){this.loadVTLayers();const x=n.params||{},w=fn/n.tileSize/n.scale,b=yh(x.filter),E=n.queryGeometry,I=n.queryPadding*w,M=_w(E),L=this.grid.query(M.minX-I,M.minY-I,M.maxX+I,M.maxY+I),j=_w(n.cameraQueryGeometry),W=this.grid3D.query(j.minX-I,j.minY-I,j.maxX+I,j.maxY+I,(le,pe,ze,be)=>function(Ae,Ve,et,vt,Ft){for(const pt of Ae)if(Ve<=pt.x&&et<=pt.y&&vt>=pt.x&&Ft>=pt.y)return!0;const gt=[new D(Ve,et),new D(Ve,Ft),new D(vt,Ft),new D(vt,et)];if(Ae.length>2){for(const pt of gt)if(Hu(Ae,pt))return!0}for(let pt=0;pt(be||(be=Cl(Ae)),Ve.queryIntersectsFeature(E,Ae,et,be,this.z,n.transform,w,n.pixelPosMatrix)))}return Y}loadMatchingFeature(n,s,h,m,x,w,b,E,I,M,L){const j=this.bucketLayerIDs[s];if(w&&!function(le,pe){for(let ze=0;ze=0)return!0;return!1}(w,j))return;const W=this.sourceLayerCoder.decode(h),Y=this.vtLayers[W].feature(m);if(x.needGeometry){const le=Il(Y,!0);if(!x.filter(new Rr(this.tileID.overscaledZ),le,this.tileID.canonical))return}else if(!x.filter(new Rr(this.tileID.overscaledZ),Y))return;const J=this.getId(Y,W);for(let le=0;le{const b=n instanceof Sl?n.get(w):null;return b&&b.evaluate?b.evaluate(s,h,m):b})}function _w(o){let n=1/0,s=1/0,h=-1/0,m=-1/0;for(const x of o)n=Math.min(n,x.x),s=Math.min(s,x.y),h=Math.max(h,x.x),m=Math.max(m,x.y);return{minX:n,minY:s,maxX:h,maxY:m}}function NP(o,n){return n-o}function vw(o,n,s,h,m){const x=[];for(let w=0;w=h&&L.x>=h||(M.x>=h?M=new D(h,M.y+(h-M.x)/(L.x-M.x)*(L.y-M.y))._round():L.x>=h&&(L=new D(h,M.y+(h-M.x)/(L.x-M.x)*(L.y-M.y))._round()),M.y>=m&&L.y>=m||(M.y>=m?M=new D(M.x+(m-M.y)/(L.y-M.y)*(L.x-M.x),m)._round():L.y>=m&&(L=new D(M.x+(m-M.y)/(L.y-M.y)*(L.x-M.x),m)._round()),E&&M.equals(E[E.length-1])||(E=[M],x.push(E)),E.push(L)))))}}return x}bt("FeatureIndex",gw,{omit:["rawTileData","sourceLayerCoder"]});class Ma extends D{constructor(n,s,h,m){super(n,s),this.angle=h,m!==void 0&&(this.segment=m)}clone(){return new Ma(this.x,this.y,this.angle,this.segment)}}function xw(o,n,s,h,m){if(n.segment===void 0||s===0)return!0;let x=n,w=n.segment+1,b=0;for(;b>-s/2;){if(w--,w<0)return!1;b-=o[w].dist(x),x=o[w]}b+=o[w].dist(o[w+1]),w++;const E=[];let I=0;for(;bh;)I-=E.shift().angleDelta;if(I>m)return!1;w++,b+=M.dist(L)}return!0}function ww(o){let n=0;for(let s=0;sI){const Y=(I-E)/W,J=ti.number(L.x,j.x,Y),le=ti.number(L.y,j.y,Y),pe=new Ma(J,le,j.angleTo(L),M);return pe._round(),!w||xw(o,pe,b,w,n)?pe:void 0}E+=W}}function jP(o,n,s,h,m,x,w,b,E){const I=bw(h,x,w),M=Sw(h,m),L=M*w,j=o[0].x===0||o[0].x===E||o[0].y===0||o[0].y===E;return n-L=0&&Ae=0&&Ve=0&&j+I<=M){const et=new Ma(Ae,Ve,ze,Y);et._round(),h&&!xw(o,et,x,h,m)||W.push(et)}}L+=pe}return b||W.length||w||(W=Ew(o,L/2,s,h,m,x,w,!0,E)),W}bt("Anchor",Ma);const Ju=xi;function kw(o,n,s,h){const m=[],x=o.image,w=x.pixelRatio,b=x.paddedRect.w-2*Ju,E=x.paddedRect.h-2*Ju;let I={x1:o.left,y1:o.top,x2:o.right,y2:o.bottom};const M=x.stretchX||[[0,b]],L=x.stretchY||[[0,E]],j=(qe,At)=>qe+At[1]-At[0],W=M.reduce(j,0),Y=L.reduce(j,0),J=b-W,le=E-Y;let pe=0,ze=W,be=0,Ae=Y,Ve=0,et=J,vt=0,Ft=le;if(x.content&&h){const qe=x.content,At=qe[2]-qe[0],It=qe[3]-qe[1];(x.textFitWidth||x.textFitHeight)&&(I=Jx(o)),pe=mf(M,0,qe[0]),be=mf(L,0,qe[1]),ze=mf(M,qe[0],qe[2]),Ae=mf(L,qe[1],qe[3]),Ve=qe[0]-pe,vt=qe[1]-be,et=At-ze,Ft=It-Ae}const gt=I.x1,pt=I.y1,Pt=I.x2-gt,Et=I.y2-pt,wt=(qe,At,It,Vt)=>{const Ir=gf(qe.stretch-pe,ze,Pt,gt),Cr=yf(qe.fixed-Ve,et,qe.stretch,W),vn=gf(At.stretch-be,Ae,Et,pt),Po=yf(At.fixed-vt,Ft,At.stretch,Y),Ln=gf(It.stretch-pe,ze,Pt,gt),xn=yf(It.fixed-Ve,et,It.stretch,W),oi=gf(Vt.stretch-be,Ae,Et,pt),si=yf(Vt.fixed-vt,Ft,Vt.stretch,Y),ai=new D(Ir,vn),rn=new D(Ln,vn),wn=new D(Ln,oi),Gn=new D(Ir,oi),Fn=new D(Cr/w,Po/w),li=new D(xn/w,si/w),On=n*Math.PI/180;if(On){const mr=Math.sin(On),Mr=Math.cos(On),Br=[Mr,-mr,mr,Mr];ai._matMult(Br),rn._matMult(Br),Gn._matMult(Br),wn._matMult(Br)}const ao=qe.stretch+qe.fixed,wi=At.stretch+At.fixed;return{tl:ai,tr:rn,bl:Gn,br:wn,tex:{x:x.paddedRect.x+Ju+ao,y:x.paddedRect.y+Ju+wi,w:It.stretch+It.fixed-ao,h:Vt.stretch+Vt.fixed-wi},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Fn,pixelOffsetBR:li,minFontScaleX:et/w/Pt,minFontScaleY:Ft/w/Et,isSDF:s}};if(h&&(x.stretchX||x.stretchY)){const qe=Tw(M,J,W),At=Tw(L,le,Y);for(let It=0;It0&&(J=Math.max(10,J),this.circleDiameter=J)}else{const j=!((L=w.image)===null||L===void 0)&&L.content&&(w.image.textFitWidth||w.image.textFitHeight)?Jx(w):{x1:w.left,y1:w.top,x2:w.right,y2:w.bottom};j.y1=j.y1*b-E[0],j.y2=j.y2*b+E[2],j.x1=j.x1*b-E[3],j.x2=j.x2*b+E[1];const W=w.collisionPadding;if(W&&(j.x1-=W[0]*b,j.y1-=W[1]*b,j.x2+=W[2]*b,j.y2+=W[3]*b),M){const Y=new D(j.x1,j.y1),J=new D(j.x2,j.y1),le=new D(j.x1,j.y2),pe=new D(j.x2,j.y2),ze=M*Math.PI/180;Y._rotate(ze),J._rotate(ze),le._rotate(ze),pe._rotate(ze),j.x1=Math.min(Y.x,J.x,le.x,pe.x),j.x2=Math.max(Y.x,J.x,le.x,pe.x),j.y1=Math.min(Y.y,J.y,le.y,pe.y),j.y2=Math.max(Y.y,J.y,le.y,pe.y)}n.emplaceBack(s.x,s.y,j.x1,j.y1,j.x2,j.y2,h,m,x)}this.boxEndIndex=n.length}}class UP{constructor(n=[],s=(h,m)=>hm?1:0){if(this.data=n,this.length=this.data.length,this.compare=s,this.length>0)for(let h=(this.length>>1)-1;h>=0;h--)this._down(h)}push(n){this.data.push(n),this._up(this.length++)}pop(){if(this.length===0)return;const n=this.data[0],s=this.data.pop();return--this.length>0&&(this.data[0]=s,this._down(0)),n}peek(){return this.data[0]}_up(n){const{data:s,compare:h}=this,m=s[n];for(;n>0;){const x=n-1>>1,w=s[x];if(h(m,w)>=0)break;s[n]=w,n=x}s[n]=m}_down(n){const{data:s,compare:h}=this,m=this.length>>1,x=s[n];for(;n=0)break;s[n]=s[w],n=w}s[n]=x}}function VP(o,n=1,s=!1){let h=1/0,m=1/0,x=-1/0,w=-1/0;const b=o[0];for(let W=0;Wx)&&(x=Y.x),(!W||Y.y>w)&&(w=Y.y)}const E=Math.min(x-h,w-m);let I=E/2;const M=new UP([],HP);if(E===0)return new D(h,m);for(let W=h;WL.d||!L.d)&&(L=W,s&&console.log("found best %d after %d probes",Math.round(1e4*W.d)/1e4,j)),W.max-L.d<=n||(I=W.h/2,M.push(new Qu(W.p.x-I,W.p.y-I,I,o)),M.push(new Qu(W.p.x+I,W.p.y-I,I,o)),M.push(new Qu(W.p.x-I,W.p.y+I,I,o)),M.push(new Qu(W.p.x+I,W.p.y+I,I,o)),j+=4)}return s&&(console.log(`num probes: ${j}`),console.log(`best distance: ${L.d}`)),L.p}function HP(o,n){return n.max-o.max}function Qu(o,n,s,h){this.p=new D(o,n),this.h=s,this.d=function(m,x){let w=!1,b=1/0;for(let E=0;Em.y!=Y.y>m.y&&m.x<(Y.x-W.x)*(m.y-W.y)/(Y.y-W.y)+W.x&&(w=!w),b=Math.min(b,ux(m,W,Y))}}return(w?1:-1)*Math.sqrt(b)}(this.p,h),this.max=this.d+this.h*Math.SQRT2}var Rn;y.aq=void 0,(Rn=y.aq||(y.aq={}))[Rn.center=1]="center",Rn[Rn.left=2]="left",Rn[Rn.right=3]="right",Rn[Rn.top=4]="top",Rn[Rn.bottom=5]="bottom",Rn[Rn["top-left"]=6]="top-left",Rn[Rn["top-right"]=7]="top-right",Rn[Rn["bottom-left"]=8]="bottom-left",Rn[Rn["bottom-right"]=9]="bottom-right";const za=7,e_=Number.POSITIVE_INFINITY;function Cw(o,n){return n[1]!==e_?function(s,h,m){let x=0,w=0;switch(h=Math.abs(h),m=Math.abs(m),s){case"top-right":case"top-left":case"top":w=m-za;break;case"bottom-right":case"bottom-left":case"bottom":w=-m+za}switch(s){case"top-right":case"bottom-right":case"right":x=-h;break;case"top-left":case"bottom-left":case"left":x=h}return[x,w]}(o,n[0],n[1]):function(s,h){let m=0,x=0;h<0&&(h=0);const w=h/Math.SQRT2;switch(s){case"top-right":case"top-left":x=w-za;break;case"bottom-right":case"bottom-left":x=-w+za;break;case"bottom":x=-h+za;break;case"top":x=h-za}switch(s){case"top-right":case"bottom-right":m=-w;break;case"top-left":case"bottom-left":m=w;break;case"left":m=h;break;case"right":m=-h}return[m,x]}(o,n[0])}function Iw(o,n,s){var h;const m=o.layout,x=(h=m.get("text-variable-anchor-offset"))===null||h===void 0?void 0:h.evaluate(n,{},s);if(x){const b=x.values,E=[];for(let I=0;Ij*gn);M.startsWith("top")?L[1]-=za:M.startsWith("bottom")&&(L[1]+=za),E[I+1]=L}return new Ri(E)}const w=m.get("text-variable-anchor");if(w){let b;b=o._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[m.get("text-radial-offset").evaluate(n,{},s)*gn,e_]:m.get("text-offset").evaluate(n,{},s).map(I=>I*gn);const E=[];for(const I of w)E.push(I,Cw(I,b));return new Ri(E)}return null}function t_(o){switch(o){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function GP(o,n,s,h,m,x,w,b,E,I,M){let L=x.textMaxSize.evaluate(n,{});L===void 0&&(L=w);const j=o.layers[0].layout,W=j.get("icon-offset").evaluate(n,{},M),Y=Aw(s.horizontal),J=w/24,le=o.tilePixelRatio*J,pe=o.tilePixelRatio*L/24,ze=o.tilePixelRatio*b,be=o.tilePixelRatio*j.get("symbol-spacing"),Ae=j.get("text-padding")*o.tilePixelRatio,Ve=function(qe,At,It,Vt=1){const Ir=qe.get("icon-padding").evaluate(At,{},It),Cr=Ir&&Ir.values;return[Cr[0]*Vt,Cr[1]*Vt,Cr[2]*Vt,Cr[3]*Vt]}(j,n,M,o.tilePixelRatio),et=j.get("text-max-angle")/180*Math.PI,vt=j.get("text-rotation-alignment")!=="viewport"&&j.get("symbol-placement")!=="point",Ft=j.get("icon-rotation-alignment")==="map"&&j.get("symbol-placement")!=="point",gt=j.get("symbol-placement"),pt=be/2,Pt=j.get("icon-text-fit");let Et;h&&Pt!=="none"&&(o.allowVerticalPlacement&&s.vertical&&(Et=Qx(h,s.vertical,Pt,j.get("icon-text-fit-padding"),W,J)),Y&&(h=Qx(h,Y,Pt,j.get("icon-text-fit-padding"),W,J)));const wt=(qe,At)=>{At.x<0||At.x>=fn||At.y<0||At.y>=fn||function(It,Vt,Ir,Cr,vn,Po,Ln,xn,oi,si,ai,rn,wn,Gn,Fn,li,On,ao,wi,mr,Mr,Br,ji,Wr,ec){const us=It.addToLineVertexArray(Vt,Ir);let cs,Ao,lo,Tn,Os=0,td=0,Rw=0,Lw=0,u_=-1,c_=-1;const Bs={};let Fw=$u("");if(It.allowVerticalPlacement&&Cr.vertical){const Zn=xn.layout.get("text-rotate").evaluate(Mr,{},Wr)+90;lo=new _f(oi,Vt,si,ai,rn,Cr.vertical,wn,Gn,Fn,Zn),Ln&&(Tn=new _f(oi,Vt,si,ai,rn,Ln,On,ao,Fn,Zn))}if(vn){const Zn=xn.layout.get("icon-rotate").evaluate(Mr,{}),uo=xn.layout.get("icon-text-fit")!=="none",Al=kw(vn,Zn,ji,uo),Go=Ln?kw(Ln,Zn,ji,uo):void 0;Ao=new _f(oi,Vt,si,ai,rn,vn,On,ao,!1,Zn),Os=4*Al.length;const Ml=It.iconSizeData;let hs=null;Ml.kind==="source"?(hs=[ls*xn.layout.get("icon-size").evaluate(Mr,{})],hs[0]>Pa&&je(`${It.layerIds[0]}: Value for "icon-size" is >= ${Kh}. Reduce your "icon-size".`)):Ml.kind==="composite"&&(hs=[ls*Br.compositeIconSizes[0].evaluate(Mr,{},Wr),ls*Br.compositeIconSizes[1].evaluate(Mr,{},Wr)],(hs[0]>Pa||hs[1]>Pa)&&je(`${It.layerIds[0]}: Value for "icon-size" is >= ${Kh}. Reduce your "icon-size".`)),It.addSymbols(It.icon,Al,hs,mr,wi,Mr,y.ah.none,Vt,us.lineStartIndex,us.lineLength,-1,Wr),u_=It.icon.placedSymbolArray.length-1,Go&&(td=4*Go.length,It.addSymbols(It.icon,Go,hs,mr,wi,Mr,y.ah.vertical,Vt,us.lineStartIndex,us.lineLength,-1,Wr),c_=It.icon.placedSymbolArray.length-1)}const Ow=Object.keys(Cr.horizontal);for(const Zn of Ow){const uo=Cr.horizontal[Zn];if(!cs){Fw=$u(uo.text);const Go=xn.layout.get("text-rotate").evaluate(Mr,{},Wr);cs=new _f(oi,Vt,si,ai,rn,uo,wn,Gn,Fn,Go)}const Al=uo.positionedLines.length===1;if(Rw+=Pw(It,Vt,uo,Po,xn,Fn,Mr,li,us,Cr.vertical?y.ah.horizontal:y.ah.horizontalOnly,Al?Ow:[Zn],Bs,u_,Br,Wr),Al)break}Cr.vertical&&(Lw+=Pw(It,Vt,Cr.vertical,Po,xn,Fn,Mr,li,us,y.ah.vertical,["vertical"],Bs,c_,Br,Wr));const qP=cs?cs.boxStartIndex:It.collisionBoxArray.length,XP=cs?cs.boxEndIndex:It.collisionBoxArray.length,KP=lo?lo.boxStartIndex:It.collisionBoxArray.length,YP=lo?lo.boxEndIndex:It.collisionBoxArray.length,JP=Ao?Ao.boxStartIndex:It.collisionBoxArray.length,QP=Ao?Ao.boxEndIndex:It.collisionBoxArray.length,eA=Tn?Tn.boxStartIndex:It.collisionBoxArray.length,tA=Tn?Tn.boxEndIndex:It.collisionBoxArray.length;let Ho=-1;const xf=(Zn,uo)=>Zn&&Zn.circleDiameter?Math.max(Zn.circleDiameter,uo):uo;Ho=xf(cs,Ho),Ho=xf(lo,Ho),Ho=xf(Ao,Ho),Ho=xf(Tn,Ho);const Bw=Ho>-1?1:0;Bw&&(Ho*=ec/gn),It.glyphOffsetArray.length>=Yu.MAX_GLYPHS&&je("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Mr.sortKey!==void 0&&It.addToSortKeyRanges(It.symbolInstances.length,Mr.sortKey);const rA=Iw(xn,Mr,Wr),[nA,iA]=function(Zn,uo){const Al=Zn.length,Go=uo==null?void 0:uo.values;if((Go==null?void 0:Go.length)>0)for(let Ml=0;Ml=0?Bs.right:-1,Bs.center>=0?Bs.center:-1,Bs.left>=0?Bs.left:-1,Bs.vertical||-1,u_,c_,Fw,qP,XP,KP,YP,JP,QP,eA,tA,si,Rw,Lw,Os,td,Bw,0,wn,Ho,nA,iA)}(o,At,qe,s,h,m,Et,o.layers[0],o.collisionBoxArray,n.index,n.sourceLayerIndex,o.index,le,[Ae,Ae,Ae,Ae],vt,E,ze,Ve,Ft,W,n,x,I,M,w)};if(gt==="line")for(const qe of vw(n.geometry,0,0,fn,fn)){const At=jP(qe,be,et,s.vertical||Y,h,24,pe,o.overscaling,fn);for(const It of At)Y&&ZP(o,Y.text,pt,It)||wt(qe,It)}else if(gt==="line-center"){for(const qe of n.geometry)if(qe.length>1){const At=$P(qe,et,s.vertical||Y,h,24,pe);At&&wt(qe,At)}}else if(n.type==="Polygon")for(const qe of gu(n.geometry,0)){const At=VP(qe,16);wt(qe[0],new Ma(At.x,At.y,0))}else if(n.type==="LineString")for(const qe of n.geometry)wt(qe,new Ma(qe[0].x,qe[0].y,0));else if(n.type==="Point")for(const qe of n.geometry)for(const At of qe)wt([At],new Ma(At.x,At.y,0))}function Pw(o,n,s,h,m,x,w,b,E,I,M,L,j,W,Y){const J=function(ze,be,Ae,Ve,et,vt,Ft,gt){const pt=Ve.layout.get("text-rotate").evaluate(vt,{})*Math.PI/180,Pt=[];for(const Et of be.positionedLines)for(const wt of Et.positionedGlyphs){if(!wt.rect)continue;const qe=wt.rect||{};let At=Gx+1,It=!0,Vt=1,Ir=0;const Cr=(et||gt)&&wt.vertical,vn=wt.metrics.advance*wt.scale/2;if(gt&&be.verticalizable&&(Ir=Et.lineOffset/2-(wt.imageName?-(gn-wt.metrics.width*wt.scale)/2:(wt.scale-1)*gn)),wt.imageName){const mr=Ft[wt.imageName];It=mr.sdf,Vt=mr.pixelRatio,At=xi/Vt}const Po=et?[wt.x+vn,wt.y]:[0,0];let Ln=et?[0,0]:[wt.x+vn+Ae[0],wt.y+Ae[1]-Ir],xn=[0,0];Cr&&(xn=Ln,Ln=[0,0]);const oi=wt.metrics.isDoubleResolution?2:1,si=(wt.metrics.left-At)*wt.scale-vn+Ln[0],ai=(-wt.metrics.top-At)*wt.scale+Ln[1],rn=si+qe.w/oi*wt.scale/Vt,wn=ai+qe.h/oi*wt.scale/Vt,Gn=new D(si,ai),Fn=new D(rn,ai),li=new D(si,wn),On=new D(rn,wn);if(Cr){const mr=new D(-vn,vn-qh),Mr=-Math.PI/2,Br=gn/2-vn,ji=new D(5-qh-Br,-(wt.imageName?Br:0)),Wr=new D(...xn);Gn._rotateAround(Mr,mr)._add(ji)._add(Wr),Fn._rotateAround(Mr,mr)._add(ji)._add(Wr),li._rotateAround(Mr,mr)._add(ji)._add(Wr),On._rotateAround(Mr,mr)._add(ji)._add(Wr)}if(pt){const mr=Math.sin(pt),Mr=Math.cos(pt),Br=[Mr,-mr,mr,Mr];Gn._matMult(Br),Fn._matMult(Br),li._matMult(Br),On._matMult(Br)}const ao=new D(0,0),wi=new D(0,0);Pt.push({tl:Gn,tr:Fn,bl:li,br:On,tex:qe,writingMode:be.writingMode,glyphOffset:Po,sectionIndex:wt.sectionIndex,isSDF:It,pixelOffsetTL:ao,pixelOffsetBR:wi,minFontScaleX:0,minFontScaleY:0})}return Pt}(0,s,b,m,x,w,h,o.allowVerticalPlacement),le=o.textSizeData;let pe=null;le.kind==="source"?(pe=[ls*m.layout.get("text-size").evaluate(w,{})],pe[0]>Pa&&je(`${o.layerIds[0]}: Value for "text-size" is >= ${Kh}. Reduce your "text-size".`)):le.kind==="composite"&&(pe=[ls*W.compositeTextSizes[0].evaluate(w,{},Y),ls*W.compositeTextSizes[1].evaluate(w,{},Y)],(pe[0]>Pa||pe[1]>Pa)&&je(`${o.layerIds[0]}: Value for "text-size" is >= ${Kh}. Reduce your "text-size".`)),o.addSymbols(o.text,J,pe,b,x,w,I,n,E.lineStartIndex,E.lineLength,j,Y);for(const ze of M)L[ze]=o.text.placedSymbolArray.length-1;return 4*J.length}function Aw(o){for(const n in o)return o[n];return null}function ZP(o,n,s,h){const m=o.compareText;if(n in m){const x=m[n];for(let w=x.length-1;w>=0;w--)if(h.dist(x[w])>4;if(m!==1)throw new Error(`Got v${m} data when expected v1.`);const x=Mw[15&h];if(!x)throw new Error("Unrecognized array type.");const[w]=new Uint16Array(n,2,1),[b]=new Uint32Array(n,4,1);return new r_(b,w,x,n)}constructor(n,s=64,h=Float64Array,m){if(isNaN(n)||n<0)throw new Error(`Unpexpected numItems value: ${n}.`);this.numItems=+n,this.nodeSize=Math.min(Math.max(+s,2),65535),this.ArrayType=h,this.IndexArrayType=n<65536?Uint16Array:Uint32Array;const x=Mw.indexOf(this.ArrayType),w=2*n*this.ArrayType.BYTES_PER_ELEMENT,b=n*this.IndexArrayType.BYTES_PER_ELEMENT,E=(8-b%8)%8;if(x<0)throw new Error(`Unexpected typed array class: ${h}.`);m&&m instanceof ArrayBuffer?(this.data=m,this.ids=new this.IndexArrayType(this.data,8,n),this.coords=new this.ArrayType(this.data,8+b+E,2*n),this._pos=2*n,this._finished=!0):(this.data=new ArrayBuffer(8+w+b+E),this.ids=new this.IndexArrayType(this.data,8,n),this.coords=new this.ArrayType(this.data,8+b+E,2*n),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+x]),new Uint16Array(this.data,2,1)[0]=s,new Uint32Array(this.data,4,1)[0]=n)}add(n,s){const h=this._pos>>1;return this.ids[h]=h,this.coords[this._pos++]=n,this.coords[this._pos++]=s,h}finish(){const n=this._pos>>1;if(n!==this.numItems)throw new Error(`Added ${n} items when expected ${this.numItems}.`);return n_(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(n,s,h,m){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:x,coords:w,nodeSize:b}=this,E=[0,x.length-1,0],I=[];for(;E.length;){const M=E.pop()||0,L=E.pop()||0,j=E.pop()||0;if(L-j<=b){for(let le=j;le<=L;le++){const pe=w[2*le],ze=w[2*le+1];pe>=n&&pe<=h&&ze>=s&&ze<=m&&I.push(x[le])}continue}const W=j+L>>1,Y=w[2*W],J=w[2*W+1];Y>=n&&Y<=h&&J>=s&&J<=m&&I.push(x[W]),(M===0?n<=Y:s<=J)&&(E.push(j),E.push(W-1),E.push(1-M)),(M===0?h>=Y:m>=J)&&(E.push(W+1),E.push(L),E.push(1-M))}return I}within(n,s,h){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:m,coords:x,nodeSize:w}=this,b=[0,m.length-1,0],E=[],I=h*h;for(;b.length;){const M=b.pop()||0,L=b.pop()||0,j=b.pop()||0;if(L-j<=w){for(let le=j;le<=L;le++)Dw(x[2*le],x[2*le+1],n,s)<=I&&E.push(m[le]);continue}const W=j+L>>1,Y=x[2*W],J=x[2*W+1];Dw(Y,J,n,s)<=I&&E.push(m[W]),(M===0?n-h<=Y:s-h<=J)&&(b.push(j),b.push(W-1),b.push(1-M)),(M===0?n+h>=Y:s+h>=J)&&(b.push(W+1),b.push(L),b.push(1-M))}return E}}function n_(o,n,s,h,m,x){if(m-h<=s)return;const w=h+m>>1;zw(o,n,w,h,m,x),n_(o,n,s,h,w-1,1-x),n_(o,n,s,w+1,m,1-x)}function zw(o,n,s,h,m,x){for(;m>h;){if(m-h>600){const I=m-h+1,M=s-h+1,L=Math.log(I),j=.5*Math.exp(2*L/3),W=.5*Math.sqrt(L*j*(I-j)/I)*(M-I/2<0?-1:1);zw(o,n,s,Math.max(h,Math.floor(s-M*j/I+W)),Math.min(m,Math.floor(s+(I-M)*j/I+W)),x)}const w=n[2*s+x];let b=h,E=m;for(Qh(o,n,h,s),n[2*m+x]>w&&Qh(o,n,h,m);bw;)E--}n[2*h+x]===w?Qh(o,n,h,E):(E++,Qh(o,n,E,m)),E<=s&&(h=E+1),s<=E&&(m=E-1)}}function Qh(o,n,s,h){i_(o,s,h),i_(n,2*s,2*h),i_(n,2*s+1,2*h+1)}function i_(o,n,s){const h=o[n];o[n]=o[s],o[s]=h}function Dw(o,n,s,h){const m=o-s,x=n-h;return m*m+x*x}var o_;y.bg=void 0,(o_=y.bg||(y.bg={})).create="create",o_.load="load",o_.fullLoad="fullLoad";let vf=null,ed=[];const s_=1e3/60,a_="loadTime",l_="fullLoadTime",WP={mark(o){performance.mark(o)},frame(o){const n=o;vf!=null&&ed.push(n-vf),vf=n},clearMetrics(){vf=null,ed=[],performance.clearMeasures(a_),performance.clearMeasures(l_);for(const o in y.bg)performance.clearMarks(y.bg[o])},getPerformanceMetrics(){performance.measure(a_,y.bg.create,y.bg.load),performance.measure(l_,y.bg.create,y.bg.fullLoad);const o=performance.getEntriesByName(a_)[0].duration,n=performance.getEntriesByName(l_)[0].duration,s=ed.length,h=1/(ed.reduce((x,w)=>x+w,0)/s/1e3),m=ed.filter(x=>x>s_).reduce((x,w)=>x+(w-s_)/s_,0);return{loadTime:o,fullLoadTime:n,fps:h,percentDroppedFrames:m/(s+m)*100,totalFrames:s}}};y.$=class extends O{},y.A=Gu,y.B=gy,y.C=function(o){if(_t==null){const n=o.navigator?o.navigator.userAgent:null;_t=!!o.safari||!(!n||!(/\b(iPad|iPhone|iPod)\b/.test(n)||n.match("Safari")&&!n.match("Chrome")))}return _t},y.D=Tt,y.E=Ue,y.F=class{constructor(o,n){this.target=o,this.mapId=n,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new BP(()=>this.process()),this.subscription=function(s,h,m,x){return s.addEventListener(h,m,!1),{unsubscribe:()=>{s.removeEventListener(h,m,!1)}}}(this.target,"message",s=>this.receive(s)),this.globalScope=Re(self)?o:window}registerMessageHandler(o,n){this.messageHandlers[o]=n}sendAsync(o,n){return new Promise((s,h)=>{const m=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[m]={resolve:s,reject:h},n&&n.signal.addEventListener("abort",()=>{delete this.resolveRejects[m];const b={id:m,type:"",origin:location.origin,targetMapId:o.targetMapId,sourceMapId:this.mapId};this.target.postMessage(b)},{once:!0});const x=[],w=Object.assign(Object.assign({},o),{id:m,sourceMapId:this.mapId,origin:location.origin,data:ya(o.data,x)});this.target.postMessage(w,{transfer:x})})}receive(o){const n=o.data,s=n.id;if(!(n.origin!=="file://"&&location.origin!=="file://"&&n.origin!=="resource://android"&&location.origin!=="resource://android"&&n.origin!==location.origin||n.targetMapId&&this.mapId!==n.targetMapId)){if(n.type===""){delete this.tasks[s];const h=this.abortControllers[s];return delete this.abortControllers[s],void(h&&h.abort())}if(Re(self)||n.mustQueue)return this.tasks[s]=n,this.taskQueue.push(s),void this.invoker.trigger();this.processTask(s,n)}}process(){if(this.taskQueue.length===0)return;const o=this.taskQueue.shift(),n=this.tasks[o];delete this.tasks[o],this.taskQueue.length>0&&this.invoker.trigger(),n&&this.processTask(o,n)}processTask(o,n){return c(this,void 0,void 0,function*(){if(n.type===""){const m=this.resolveRejects[o];return delete this.resolveRejects[o],m?void(n.error?m.reject(_a(n.error)):m.resolve(_a(n.data))):void 0}if(!this.messageHandlers[n.type])return void this.completeTask(o,new Error(`Could not find a registered handler for ${n.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const s=_a(n.data),h=new AbortController;this.abortControllers[o]=h;try{const m=yield this.messageHandlers[n.type](n.sourceMapId,s,h);this.completeTask(o,null,m)}catch(m){this.completeTask(o,m)}})}completeTask(o,n,s){const h=[];delete this.abortControllers[o];const m={id:o,type:"",sourceMapId:this.mapId,origin:location.origin,error:n?ya(n):null,data:ya(s,h)};this.target.postMessage(m,{transfer:h})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},y.G=qt,y.H=function(){var o=new Gu(16);return Gu!=Float32Array&&(o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[11]=0,o[12]=0,o[13]=0,o[14]=0),o[0]=1,o[5]=1,o[10]=1,o[15]=1,o},y.I=Vy,y.J=function(o,n,s){var h,m,x,w,b,E,I,M,L,j,W,Y,J=s[0],le=s[1],pe=s[2];return n===o?(o[12]=n[0]*J+n[4]*le+n[8]*pe+n[12],o[13]=n[1]*J+n[5]*le+n[9]*pe+n[13],o[14]=n[2]*J+n[6]*le+n[10]*pe+n[14],o[15]=n[3]*J+n[7]*le+n[11]*pe+n[15]):(m=n[1],x=n[2],w=n[3],b=n[4],E=n[5],I=n[6],M=n[7],L=n[8],j=n[9],W=n[10],Y=n[11],o[0]=h=n[0],o[1]=m,o[2]=x,o[3]=w,o[4]=b,o[5]=E,o[6]=I,o[7]=M,o[8]=L,o[9]=j,o[10]=W,o[11]=Y,o[12]=h*J+b*le+L*pe+n[12],o[13]=m*J+E*le+j*pe+n[13],o[14]=x*J+I*le+W*pe+n[14],o[15]=w*J+M*le+Y*pe+n[15]),o},y.K=function(o,n,s){var h=s[0],m=s[1],x=s[2];return o[0]=n[0]*h,o[1]=n[1]*h,o[2]=n[2]*h,o[3]=n[3]*h,o[4]=n[4]*m,o[5]=n[5]*m,o[6]=n[6]*m,o[7]=n[7]*m,o[8]=n[8]*x,o[9]=n[9]*x,o[10]=n[10]*x,o[11]=n[11]*x,o[12]=n[12],o[13]=n[13],o[14]=n[14],o[15]=n[15],o},y.L=px,y.M=function(o,n){const s={};for(let h=0;h{const n=window.document.createElement("video");return n.muted=!0,new Promise(s=>{n.onloadstart=()=>{s(n)};for(const h of o){const m=window.document.createElement("source");pr(h)||(n.crossOrigin="Anonymous"),m.src=h,n.appendChild(m)}})},y.a4=function(){return Oe++},y.a5=yt,y.a6=Yu,y.a7=yh,y.a8=Il,y.a9=mw,y.aA=function(o){if(o.type==="custom")return new OP(o);switch(o.type){case"background":return new RP(o);case"circle":return new wI(o);case"fill":return new BI(o);case"fill-extrusion":return new QI(o);case"heatmap":return new SI(o);case"hillshade":return new kI(o);case"line":return new aP(o);case"raster":return new FP(o);case"symbol":return new ff(o)}},y.aB=it,y.aC=function(o,n){if(!o)return[{command:"setStyle",args:[n]}];let s=[];try{if(!ke(o.version,n.version))return[{command:"setStyle",args:[n]}];ke(o.center,n.center)||s.push({command:"setCenter",args:[n.center]}),ke(o.zoom,n.zoom)||s.push({command:"setZoom",args:[n.zoom]}),ke(o.bearing,n.bearing)||s.push({command:"setBearing",args:[n.bearing]}),ke(o.pitch,n.pitch)||s.push({command:"setPitch",args:[n.pitch]}),ke(o.sprite,n.sprite)||s.push({command:"setSprite",args:[n.sprite]}),ke(o.glyphs,n.glyphs)||s.push({command:"setGlyphs",args:[n.glyphs]}),ke(o.transition,n.transition)||s.push({command:"setTransition",args:[n.transition]}),ke(o.light,n.light)||s.push({command:"setLight",args:[n.light]}),ke(o.terrain,n.terrain)||s.push({command:"setTerrain",args:[n.terrain]}),ke(o.sky,n.sky)||s.push({command:"setSky",args:[n.sky]}),ke(o.projection,n.projection)||s.push({command:"setProjection",args:[n.projection]});const h={},m=[];(function(w,b,E,I){let M;for(M in b=b||{},w=w||{})Object.prototype.hasOwnProperty.call(w,M)&&(Object.prototype.hasOwnProperty.call(b,M)||Ne(M,E,I));for(M in b)Object.prototype.hasOwnProperty.call(b,M)&&(Object.prototype.hasOwnProperty.call(w,M)?ke(w[M],b[M])||(w[M].type==="geojson"&&b[M].type==="geojson"&&St(w,b,M)?Ze(E,{command:"setGeoJSONSourceData",args:[M,b[M].data]}):st(M,b,E,I)):tt(M,b,E))})(o.sources,n.sources,m,h);const x=[];o.layers&&o.layers.forEach(w=>{"source"in w&&h[w.source]?s.push({command:"removeLayer",args:[w.id]}):x.push(w)}),s=s.concat(m),function(w,b,E){b=b||[];const I=(w=w||[]).map(Lt),M=b.map(Lt),L=w.reduce(vr,{}),j=b.reduce(vr,{}),W=I.slice(),Y=Object.create(null);let J,le,pe,ze,be;for(let Ae=0,Ve=0;Ae@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(s,h,m,x)=>{const w=m||x;return n[h]=!w||w.toLowerCase(),""}),n["max-age"]){const s=parseInt(n["max-age"],10);isNaN(s)?delete n["max-age"]:n["max-age"]=s}return n},y.ab=function(o,n){const s=[];for(const h in o)h in n||s.push(h);return s},y.ac=se,y.ad=function(o,n,s){var h=Math.sin(s),m=Math.cos(s),x=n[0],w=n[1],b=n[2],E=n[3],I=n[4],M=n[5],L=n[6],j=n[7];return n!==o&&(o[8]=n[8],o[9]=n[9],o[10]=n[10],o[11]=n[11],o[12]=n[12],o[13]=n[13],o[14]=n[14],o[15]=n[15]),o[0]=x*m+I*h,o[1]=w*m+M*h,o[2]=b*m+L*h,o[3]=E*m+j*h,o[4]=I*m-x*h,o[5]=M*m-w*h,o[6]=L*m-b*h,o[7]=j*m-E*h,o},y.ae=function(o){var n=new Gu(16);return n[0]=o[0],n[1]=o[1],n[2]=o[2],n[3]=o[3],n[4]=o[4],n[5]=o[5],n[6]=o[6],n[7]=o[7],n[8]=o[8],n[9]=o[9],n[10]=o[10],n[11]=o[11],n[12]=o[12],n[13]=o[13],n[14]=o[14],n[15]=o[15],n},y.af=of,y.ag=function(o,n){let s=0,h=0;if(o.kind==="constant")h=o.layoutSize;else if(o.kind!=="source"){const{interpolationType:m,minZoom:x,maxZoom:w}=o,b=m?se(ri.interpolationFactor(m,n,x,w),0,1):0;o.kind==="camera"?h=ti.number(o.minSize,o.maxSize,b):s=b}return{uSizeT:s,uSize:h}},y.ai=function(o,{uSize:n,uSizeT:s},{lowerSize:h,upperSize:m}){return o.kind==="source"?h/ls:o.kind==="composite"?ti.number(h/ls,m/ls,s):n},y.aj=Wy,y.ak=function(o,n,s,h){const m=n.y-o.y,x=n.x-o.x,w=h.y-s.y,b=h.x-s.x,E=w*x-b*m;if(E===0)return null;const I=(b*(o.y-s.y)-w*(o.x-s.x))/E;return new D(o.x+I*x,o.y+I*m)},y.al=vw,y.am=ax,y.an=Iy,y.ao=function(o){let n=1/0,s=1/0,h=-1/0,m=-1/0;for(const x of o)n=Math.min(n,x.x),s=Math.min(s,x.y),h=Math.max(h,x.x),m=Math.max(m,x.y);return[n,s,h,m]},y.ap=gn,y.ar=Zy,y.as=function(o,n){var s=n[0],h=n[1],m=n[2],x=n[3],w=n[4],b=n[5],E=n[6],I=n[7],M=n[8],L=n[9],j=n[10],W=n[11],Y=n[12],J=n[13],le=n[14],pe=n[15],ze=s*b-h*w,be=s*E-m*w,Ae=s*I-x*w,Ve=h*E-m*b,et=h*I-x*b,vt=m*I-x*E,Ft=M*J-L*Y,gt=M*le-j*Y,pt=M*pe-W*Y,Pt=L*le-j*J,Et=L*pe-W*J,wt=j*pe-W*le,qe=ze*wt-be*Et+Ae*Pt+Ve*pt-et*gt+vt*Ft;return qe?(o[0]=(b*wt-E*Et+I*Pt)*(qe=1/qe),o[1]=(m*Et-h*wt-x*Pt)*qe,o[2]=(J*vt-le*et+pe*Ve)*qe,o[3]=(j*et-L*vt-W*Ve)*qe,o[4]=(E*pt-w*wt-I*gt)*qe,o[5]=(s*wt-m*pt+x*gt)*qe,o[6]=(le*Ae-Y*vt-pe*be)*qe,o[7]=(M*vt-j*Ae+W*be)*qe,o[8]=(w*Et-b*pt+I*Ft)*qe,o[9]=(h*pt-s*Et-x*Ft)*qe,o[10]=(Y*et-J*Ae+pe*ze)*qe,o[11]=(L*Ae-M*et-W*ze)*qe,o[12]=(b*gt-w*Pt-E*Ft)*qe,o[13]=(s*Pt-h*gt+m*Ft)*qe,o[14]=(J*be-Y*Ve-le*ze)*qe,o[15]=(M*Ve-L*be+j*ze)*qe,o):null},y.at=t_,y.au=Gy,y.av=r_,y.aw=function(){const o={},n=ie.$version;for(const s in ie.$root){const h=ie.$root[s];if(h.required){let m=null;m=s==="version"?n:h.type==="array"?[]:{},m!=null&&(o[s]=m)}}return o},y.ax=Mh,y.ay=$t,y.az=function(o){o=o.slice();const n=Object.create(null);for(let s=0;s25||h<0||h>=1||s<0||s>=1)},y.bc=function(o,n){return o[0]=n[0],o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=n[1],o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=n[2],o[11]=0,o[12]=0,o[13]=0,o[14]=0,o[15]=1,o},y.bd=class extends z{},y.be=Yy,y.bf=WP,y.bh=Kt,y.bi=function(o,n){nt.REGISTERED_PROTOCOLS[o]=n},y.bj=function(o){delete nt.REGISTERED_PROTOCOLS[o]},y.bk=function(o,n){const s={};for(let m=0;mwt*gn)}let gt=w?"center":s.get("text-justify").evaluate(I,{},o.canonical);const pt=s.get("symbol-placement")==="point"?s.get("text-max-width").evaluate(I,{},o.canonical)*gn:1/0,Pt=()=>{o.bucket.allowVerticalPlacement&&zh(Ae)&&(Y.vertical=hf(J,o.glyphMap,o.glyphPositions,o.imagePositions,M,pt,x,vt,"left",et,pe,y.ah.vertical,!0,j,L))};if(!w&&Ft){const Et=new Set;if(gt==="auto")for(let qe=0;qec(void 0,void 0,void 0,function*(){if(o.byteLength===0)return createImageBitmap(new ImageData(1,1));const n=new Blob([new Uint8Array(o)],{type:"image/png"});try{return createImageBitmap(n)}catch(s){throw new Error(`Could not load image because of ${s.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),y.e=ge,y.f=o=>new Promise((n,s)=>{const h=new Image;h.onload=()=>{n(h),URL.revokeObjectURL(h.src),h.onload=null,window.requestAnimationFrame(()=>{h.src=Be})},h.onerror=()=>s(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 m=new Blob([new Uint8Array(o)],{type:"image/png"});h.src=o.byteLength?URL.createObjectURL(m):Be}),y.g=rt,y.h=(o,n)=>Gt(ge(o,{type:"json"}),n),y.i=Re,y.j=V,y.k=$r,y.l=(o,n)=>Gt(ge(o,{type:"arrayBuffer"}),n),y.m=Gt,y.n=function(o){return new jy(o).readFields(bP,[])},y.o=jh,y.p=Zx,y.q=v,y.r=my,y.s=pr,y.t=Ph,y.u=Ds,y.v=ie,y.w=je,y.x=function([o,n,s]){return n+=90,n*=Math.PI/180,s*=Math.PI/180,{x:o*Math.cos(n)*Math.sin(s),y:o*Math.sin(n)*Math.sin(s),z:o*Math.cos(s)}},y.y=ti,y.z=Rr}),d("worker",["./shared"],function(y){class c{constructor(Z){this.keyCache={},Z&&this.replace(Z)}replace(Z){this._layerConfigs={},this._layers={},this.update(Z,[])}update(Z,G){for(const ue of Z){this._layerConfigs[ue.id]=ue;const Se=this._layers[ue.id]=y.aA(ue);Se._featureFilter=y.a7(Se.filter),this.keyCache[ue.id]&&delete this.keyCache[ue.id]}for(const ue of G)delete this.keyCache[ue],delete this._layerConfigs[ue],delete this._layers[ue];this.familiesBySource={};const ee=y.bk(Object.values(this._layerConfigs),this.keyCache);for(const ue of ee){const Se=ue.map($e=>this._layers[$e.id]),Ie=Se[0];if(Ie.visibility==="none")continue;const Me=Ie.source||"";let _e=this.familiesBySource[Me];_e||(_e=this.familiesBySource[Me]={});const He=Ie.sourceLayer||"_geojsonTileLayer";let Je=_e[He];Je||(Je=_e[He]=[]),Je.push(Se)}}}class T{constructor(Z){const G={},ee=[];for(const Me in Z){const _e=Z[Me],He=G[Me]={};for(const Je in _e){const $e=_e[+Je];if(!$e||$e.bitmap.width===0||$e.bitmap.height===0)continue;const ut={x:0,y:0,w:$e.bitmap.width+2,h:$e.bitmap.height+2};ee.push(ut),He[Je]={rect:ut,metrics:$e.metrics}}}const{w:ue,h:Se}=y.p(ee),Ie=new y.o({width:ue||1,height:Se||1});for(const Me in Z){const _e=Z[Me];for(const He in _e){const Je=_e[+He];if(!Je||Je.bitmap.width===0||Je.bitmap.height===0)continue;const $e=G[Me][He].rect;y.o.copy(Je.bitmap,Ie,{x:0,y:0},{x:$e.x+1,y:$e.y+1},Je.bitmap)}}this.image=Ie,this.positions=G}}y.bl("GlyphAtlas",T);class P{constructor(Z){this.tileID=new y.S(Z.tileID.overscaledZ,Z.tileID.wrap,Z.tileID.canonical.z,Z.tileID.canonical.x,Z.tileID.canonical.y),this.uid=Z.uid,this.zoom=Z.zoom,this.pixelRatio=Z.pixelRatio,this.tileSize=Z.tileSize,this.source=Z.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=Z.showCollisionBoxes,this.collectResourceTiming=!!Z.collectResourceTiming,this.returnDependencies=!!Z.returnDependencies,this.promoteId=Z.promoteId,this.inFlightDependencies=[]}parse(Z,G,ee,ue){return y._(this,void 0,void 0,function*(){this.status="parsing",this.data=Z,this.collisionBoxArray=new y.a5;const Se=new y.bm(Object.keys(Z.layers).sort()),Ie=new y.bn(this.tileID,this.promoteId);Ie.bucketLayerIDs=[];const Me={},_e={featureIndex:Ie,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:ee},He=G.familiesBySource[this.source];for(const Jt in He){const Sr=Z.layers[Jt];if(!Sr)continue;Sr.version===1&&y.w(`Vector tile source "${this.source}" layer "${Jt}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const Nr=Se.encode(Jt),_n=[];for(let En=0;En=Un.maxzoom||Un.visibility!=="none"&&(R(En,this.zoom,ee),(Me[Un.id]=Un.createBucket({index:Ie.bucketLayerIDs.length,layers:En,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Nr,sourceID:this.source})).populate(_n,_e,this.tileID.canonical),Ie.bucketLayerIDs.push(En.map(Qs=>Qs.id)))}}const Je=y.aF(_e.glyphDependencies,Jt=>Object.keys(Jt).map(Number));this.inFlightDependencies.forEach(Jt=>Jt==null?void 0:Jt.abort()),this.inFlightDependencies=[];let $e=Promise.resolve({});if(Object.keys(Je).length){const Jt=new AbortController;this.inFlightDependencies.push(Jt),$e=ue.sendAsync({type:"GG",data:{stacks:Je,source:this.source,tileID:this.tileID,type:"glyphs"}},Jt)}const ut=Object.keys(_e.iconDependencies);let Mt=Promise.resolve({});if(ut.length){const Jt=new AbortController;this.inFlightDependencies.push(Jt),Mt=ue.sendAsync({type:"GI",data:{icons:ut,source:this.source,tileID:this.tileID,type:"icons"}},Jt)}const Dt=Object.keys(_e.patternDependencies);let cr=Promise.resolve({});if(Dt.length){const Jt=new AbortController;this.inFlightDependencies.push(Jt),cr=ue.sendAsync({type:"GI",data:{icons:Dt,source:this.source,tileID:this.tileID,type:"patterns"}},Jt)}const[Xt,hr,rr]=yield Promise.all([$e,Mt,cr]),dn=new T(Xt),Zr=new y.bo(hr,rr);for(const Jt in Me){const Sr=Me[Jt];Sr instanceof y.a6?(R(Sr.layers,this.zoom,ee),y.bp({bucket:Sr,glyphMap:Xt,glyphPositions:dn.positions,imageMap:hr,imagePositions:Zr.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):Sr.hasPattern&&(Sr instanceof y.bq||Sr instanceof y.br||Sr instanceof y.bs)&&(R(Sr.layers,this.zoom,ee),Sr.addFeatures(_e,this.tileID.canonical,Zr.patternPositions))}return this.status="done",{buckets:Object.values(Me).filter(Jt=>!Jt.isEmpty()),featureIndex:Ie,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:dn.image,imageAtlas:Zr,glyphMap:this.returnDependencies?Xt:null,iconMap:this.returnDependencies?hr:null,glyphPositions:this.returnDependencies?dn.positions:null}})}}function R(he,Z,G){const ee=new y.z(Z);for(const ue of he)ue.recalculate(ee,G)}class D{constructor(Z,G,ee){this.actor=Z,this.layerIndex=G,this.availableImages=ee,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(Z,G){return y._(this,void 0,void 0,function*(){const ee=yield y.l(Z.request,G);try{return{vectorTile:new y.bt.VectorTile(new y.bu(ee.data)),rawData:ee.data,cacheControl:ee.cacheControl,expires:ee.expires}}catch(ue){const Se=new Uint8Array(ee.data);let Ie=`Unable to parse the tile at ${Z.request.url}, `;throw Ie+=Se[0]===31&&Se[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${ue.message}`,new Error(Ie)}})}loadTile(Z){return y._(this,void 0,void 0,function*(){const G=Z.uid,ee=!!(Z&&Z.request&&Z.request.collectResourceTiming)&&new y.bv(Z.request),ue=new P(Z);this.loading[G]=ue;const Se=new AbortController;ue.abort=Se;try{const Ie=yield this.loadVectorTile(Z,Se);if(delete this.loading[G],!Ie)return null;const Me=Ie.rawData,_e={};Ie.expires&&(_e.expires=Ie.expires),Ie.cacheControl&&(_e.cacheControl=Ie.cacheControl);const He={};if(ee){const $e=ee.finish();$e&&(He.resourceTiming=JSON.parse(JSON.stringify($e)))}ue.vectorTile=Ie.vectorTile;const Je=ue.parse(Ie.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[G]=ue,this.fetching[G]={rawTileData:Me,cacheControl:_e,resourceTiming:He};try{const $e=yield Je;return y.e({rawTileData:Me.slice(0)},$e,_e,He)}finally{delete this.fetching[G]}}catch(Ie){throw delete this.loading[G],ue.status="done",this.loaded[G]=ue,Ie}})}reloadTile(Z){return y._(this,void 0,void 0,function*(){const G=Z.uid;if(!this.loaded||!this.loaded[G])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const ee=this.loaded[G];if(ee.showCollisionBoxes=Z.showCollisionBoxes,ee.status==="parsing"){const ue=yield ee.parse(ee.vectorTile,this.layerIndex,this.availableImages,this.actor);let Se;if(this.fetching[G]){const{rawTileData:Ie,cacheControl:Me,resourceTiming:_e}=this.fetching[G];delete this.fetching[G],Se=y.e({rawTileData:Ie.slice(0)},ue,Me,_e)}else Se=ue;return Se}if(ee.status==="done"&&ee.vectorTile)return ee.parse(ee.vectorTile,this.layerIndex,this.availableImages,this.actor)})}abortTile(Z){return y._(this,void 0,void 0,function*(){const G=this.loading,ee=Z.uid;G&&G[ee]&&G[ee].abort&&(G[ee].abort.abort(),delete G[ee])})}removeTile(Z){return y._(this,void 0,void 0,function*(){this.loaded&&this.loaded[Z.uid]&&delete this.loaded[Z.uid]})}}class A{constructor(){this.loaded={}}loadTile(Z){return y._(this,void 0,void 0,function*(){const{uid:G,encoding:ee,rawImageData:ue,redFactor:Se,greenFactor:Ie,blueFactor:Me,baseShift:_e}=Z,He=ue.width+2,Je=ue.height+2,$e=y.b(ue)?new y.R({width:He,height:Je},yield y.bw(ue,-1,-1,He,Je)):ue,ut=new y.bx(G,$e,ee,Se,Ie,Me,_e);return this.loaded=this.loaded||{},this.loaded[G]=ut,ut})}removeTile(Z){const G=this.loaded,ee=Z.uid;G&&G[ee]&&delete G[ee]}}function N(he,Z){if(he.length!==0){X(he[0],Z);for(var G=1;G=Math.abs(Me)?G-_e+Me:Me-_e+G,G=_e}G+ee>=0!=!!Z&&he.reverse()}var U=y.by(function he(Z,G){var ee,ue=Z&&Z.type;if(ue==="FeatureCollection")for(ee=0;ee>31}function Re(he,Z){for(var G=he.loadGeometry(),ee=he.type,ue=0,Se=0,Ie=G.length,Me=0;Mehe},Le=Math.fround||(Ye=new Float32Array(1),he=>(Ye[0]=+he,Ye[0]));var Ye;const xe=3,Te=5,ft=6;class nt{constructor(Z){this.options=Object.assign(Object.create(Be),Z),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(Z){const{log:G,minZoom:ee,maxZoom:ue}=this.options;G&&console.time("total time");const Se=`prepare ${Z.length} points`;G&&console.time(Se),this.points=Z;const Ie=[];for(let _e=0;_e=ee;_e--){const He=+Date.now();Me=this.trees[_e]=this._createTree(this._cluster(Me,_e)),G&&console.log("z%d: %d clusters in %dms",_e,Me.numItems,+Date.now()-He)}return G&&console.timeEnd("total time"),this}getClusters(Z,G){let ee=((Z[0]+180)%360+360)%360-180;const ue=Math.max(-90,Math.min(90,Z[1]));let Se=Z[2]===180?180:((Z[2]+180)%360+360)%360-180;const Ie=Math.max(-90,Math.min(90,Z[3]));if(Z[2]-Z[0]>=360)ee=-180,Se=180;else if(ee>Se){const $e=this.getClusters([ee,ue,180,Ie],G),ut=this.getClusters([-180,ue,Se,Ie],G);return $e.concat(ut)}const Me=this.trees[this._limitZoom(G)],_e=Me.range(Kt(ee),$t(Ie),Kt(Se),$t(ue)),He=Me.data,Je=[];for(const $e of _e){const ut=this.stride*$e;Je.push(He[ut+Te]>1?rt(He,ut,this.clusterProps):this.points[He[ut+xe]])}return Je}getChildren(Z){const G=this._getOriginId(Z),ee=this._getOriginZoom(Z),ue="No cluster with the specified id.",Se=this.trees[ee];if(!Se)throw new Error(ue);const Ie=Se.data;if(G*this.stride>=Ie.length)throw new Error(ue);const Me=this.options.radius/(this.options.extent*Math.pow(2,ee-1)),_e=Se.within(Ie[G*this.stride],Ie[G*this.stride+1],Me),He=[];for(const Je of _e){const $e=Je*this.stride;Ie[$e+4]===Z&&He.push(Ie[$e+Te]>1?rt(Ie,$e,this.clusterProps):this.points[Ie[$e+xe]])}if(He.length===0)throw new Error(ue);return He}getLeaves(Z,G,ee){const ue=[];return this._appendLeaves(ue,Z,G=G||10,ee=ee||0,0),ue}getTile(Z,G,ee){const ue=this.trees[this._limitZoom(Z)],Se=Math.pow(2,Z),{extent:Ie,radius:Me}=this.options,_e=Me/Ie,He=(ee-_e)/Se,Je=(ee+1+_e)/Se,$e={features:[]};return this._addTileFeatures(ue.range((G-_e)/Se,He,(G+1+_e)/Se,Je),ue.data,G,ee,Se,$e),G===0&&this._addTileFeatures(ue.range(1-_e/Se,He,1,Je),ue.data,Se,ee,Se,$e),G===Se-1&&this._addTileFeatures(ue.range(0,He,_e/Se,Je),ue.data,-1,ee,Se,$e),$e.features.length?$e:null}getClusterExpansionZoom(Z){let G=this._getOriginZoom(Z)-1;for(;G<=this.options.maxZoom;){const ee=this.getChildren(Z);if(G++,ee.length!==1)break;Z=ee[0].properties.cluster_id}return G}_appendLeaves(Z,G,ee,ue,Se){const Ie=this.getChildren(G);for(const Me of Ie){const _e=Me.properties;if(_e&&_e.cluster?Se+_e.point_count<=ue?Se+=_e.point_count:Se=this._appendLeaves(Z,_e.cluster_id,ee,ue,Se):Se1;let Je,$e,ut;if(He)Je=qt(G,_e,this.clusterProps),$e=G[_e],ut=G[_e+1];else{const cr=this.points[G[_e+xe]];Je=cr.properties;const[Xt,hr]=cr.geometry.coordinates;$e=Kt(Xt),ut=$t(hr)}const Mt={type:1,geometry:[[Math.round(this.options.extent*($e*Se-ee)),Math.round(this.options.extent*(ut*Se-ue))]],tags:Je};let Dt;Dt=He||this.options.generateId?G[_e+xe]:this.points[G[_e+xe]].id,Dt!==void 0&&(Mt.id=Dt),Ie.features.push(Mt)}}_limitZoom(Z){return Math.max(this.options.minZoom,Math.min(Math.floor(+Z),this.options.maxZoom+1))}_cluster(Z,G){const{radius:ee,extent:ue,reduce:Se,minPoints:Ie}=this.options,Me=ee/(ue*Math.pow(2,G)),_e=Z.data,He=[],Je=this.stride;for(let $e=0;$e<_e.length;$e+=Je){if(_e[$e+2]<=G)continue;_e[$e+2]=G;const ut=_e[$e],Mt=_e[$e+1],Dt=Z.within(_e[$e],_e[$e+1],Me),cr=_e[$e+Te];let Xt=cr;for(const hr of Dt){const rr=hr*Je;_e[rr+2]>G&&(Xt+=_e[rr+Te])}if(Xt>cr&&Xt>=Ie){let hr,rr=ut*cr,dn=Mt*cr,Zr=-1;const Jt=(($e/Je|0)<<5)+(G+1)+this.points.length;for(const Sr of Dt){const Nr=Sr*Je;if(_e[Nr+2]<=G)continue;_e[Nr+2]=G;const _n=_e[Nr+Te];rr+=_e[Nr]*_n,dn+=_e[Nr+1]*_n,_e[Nr+4]=Jt,Se&&(hr||(hr=this._map(_e,$e,!0),Zr=this.clusterProps.length,this.clusterProps.push(hr)),Se(hr,this._map(_e,Nr)))}_e[$e+4]=Jt,He.push(rr/Xt,dn/Xt,1/0,Jt,-1,Xt),Se&&He.push(Zr)}else{for(let hr=0;hr1)for(const hr of Dt){const rr=hr*Je;if(!(_e[rr+2]<=G)){_e[rr+2]=G;for(let dn=0;dn>5}_getOriginZoom(Z){return(Z-this.points.length)%32}_map(Z,G,ee){if(Z[G+Te]>1){const Ie=this.clusterProps[Z[G+ft]];return ee?Object.assign({},Ie):Ie}const ue=this.points[Z[G+xe]].properties,Se=this.options.map(ue);return ee&&Se===ue?Object.assign({},Se):Se}}function rt(he,Z,G){return{type:"Feature",id:he[Z+xe],properties:qt(he,Z,G),geometry:{type:"Point",coordinates:[(ee=he[Z],360*(ee-.5)),Gt(he[Z+1])]}};var ee}function qt(he,Z,G){const ee=he[Z+Te],ue=ee>=1e4?`${Math.round(ee/1e3)}k`:ee>=1e3?Math.round(ee/100)/10+"k":ee,Se=he[Z+ft],Ie=Se===-1?{}:Object.assign({},G[Se]);return Object.assign(Ie,{cluster:!0,cluster_id:he[Z+xe],point_count:ee,point_count_abbreviated:ue})}function Kt(he){return he/360+.5}function $t(he){const Z=Math.sin(he*Math.PI/180),G=.5-.25*Math.log((1+Z)/(1-Z))/Math.PI;return G<0?0:G>1?1:G}function Gt(he){const Z=(180-360*he)*Math.PI/180;return 360*Math.atan(Math.exp(Z))/Math.PI-90}function pr(he,Z,G,ee){let ue=ee;const Se=Z+(G-Z>>1);let Ie,Me=G-Z;const _e=he[Z],He=he[Z+1],Je=he[G],$e=he[G+1];for(let ut=Z+3;utue)Ie=ut,ue=Mt;else if(Mt===ue){const Dt=Math.abs(ut-Se);Dtee&&(Ie-Z>3&&pr(he,Z,Ie,ee),he[Ie+2]=ue,G-Ie>3&&pr(he,Ie,G,ee))}function lr(he,Z,G,ee,ue,Se){let Ie=ue-G,Me=Se-ee;if(Ie!==0||Me!==0){const _e=((he-G)*Ie+(Z-ee)*Me)/(Ie*Ie+Me*Me);_e>1?(G=ue,ee=Se):_e>0&&(G+=Ie*_e,ee+=Me*_e)}return Ie=he-G,Me=Z-ee,Ie*Ie+Me*Me}function gr(he,Z,G,ee){const ue={id:he??null,type:Z,geometry:G,tags:ee,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(Z==="Point"||Z==="MultiPoint"||Z==="LineString")$r(ue,G);else if(Z==="Polygon")$r(ue,G[0]);else if(Z==="MultiLineString")for(const Se of G)$r(ue,Se);else if(Z==="MultiPolygon")for(const Se of G)$r(ue,Se[0]);return ue}function $r(he,Z){for(let G=0;G0&&(Ie+=ee?(ue*Je-He*Se)/2:Math.sqrt(Math.pow(He-ue,2)+Math.pow(Je-Se,2))),ue=He,Se=Je}const Me=Z.length-3;Z[2]=1,pr(Z,0,Me,G),Z[Me+2]=1,Z.size=Math.abs(Ie),Z.start=0,Z.end=Z.size}function de(he,Z,G,ee){for(let ue=0;ue1?1:G}function Ze(he,Z,G,ee,ue,Se,Ie,Me){if(ee/=Z,Se>=(G/=Z)&&Ie=ee)return null;const _e=[];for(const He of he){const Je=He.geometry;let $e=He.type;const ut=ue===0?He.minX:He.minY,Mt=ue===0?He.maxX:He.maxY;if(ut>=G&&Mt=ee)continue;let Dt=[];if($e==="Point"||$e==="MultiPoint")tt(Je,Dt,G,ee,ue);else if($e==="LineString")Ne(Je,Dt,G,ee,ue,!1,Me.lineMetrics);else if($e==="MultiLineString")St(Je,Dt,G,ee,ue,!1);else if($e==="Polygon")St(Je,Dt,G,ee,ue,!0);else if($e==="MultiPolygon")for(const cr of Je){const Xt=[];St(cr,Xt,G,ee,ue,!0),Xt.length&&Dt.push(Xt)}if(Dt.length){if(Me.lineMetrics&&$e==="LineString"){for(const cr of Dt)_e.push(gr(He.id,$e,cr,He.tags));continue}$e!=="LineString"&&$e!=="MultiLineString"||(Dt.length===1?($e="LineString",Dt=Dt[0]):$e="MultiLineString"),$e!=="Point"&&$e!=="MultiPoint"||($e=Dt.length===3?"Point":"MultiPoint"),_e.push(gr(He.id,$e,Dt,He.tags))}}return _e.length?_e:null}function tt(he,Z,G,ee,ue){for(let Se=0;Se=G&&Ie<=ee&&at(Z,he[Se],he[Se+1],he[Se+2])}}function Ne(he,Z,G,ee,ue,Se,Ie){let Me=st(he);const _e=ue===0?Lt:vr;let He,Je,$e=he.start;for(let Xt=0;XtG&&(Je=_e(Me,hr,rr,Zr,Jt,G),Ie&&(Me.start=$e+He*Je)):Sr>ee?Nr=G&&(Je=_e(Me,hr,rr,Zr,Jt,G),_n=!0),Nr>ee&&Sr<=ee&&(Je=_e(Me,hr,rr,Zr,Jt,ee),_n=!0),!Se&&_n&&(Ie&&(Me.end=$e+He*Je),Z.push(Me),Me=st(he)),Ie&&($e+=He)}let ut=he.length-3;const Mt=he[ut],Dt=he[ut+1],cr=ue===0?Mt:Dt;cr>=G&&cr<=ee&&at(Me,Mt,Dt,he[ut+2]),ut=Me.length-3,Se&&ut>=3&&(Me[ut]!==Me[0]||Me[ut+1]!==Me[1])&&at(Me,Me[0],Me[1],Me[2]),Me.length&&Z.push(Me)}function st(he){const Z=[];return Z.size=he.size,Z.start=he.start,Z.end=he.end,Z}function St(he,Z,G,ee,ue,Se){for(const Ie of he)Ne(Ie,Z,G,ee,ue,Se,!1)}function at(he,Z,G,ee){he.push(Z,G,ee)}function Lt(he,Z,G,ee,ue,Se){const Ie=(Se-Z)/(ee-Z);return at(he,Se,G+(ue-G)*Ie,1),Ie}function vr(he,Z,G,ee,ue,Se){const Ie=(Se-G)/(ue-G);return at(he,Z+(ee-Z)*Ie,Se,1),Ie}function We(he,Z){const G=[];for(let ee=0;ee0&&Z.size<(ue?Ie:ee))return void(G.numPoints+=Z.length/3);const Me=[];for(let _e=0;_eIe)&&(G.numSimplified++,Me.push(Z[_e],Z[_e+1])),G.numPoints++;ue&&function(_e,He){let Je=0;for(let $e=0,ut=_e.length,Mt=ut-2;$e0===He)for(let $e=0,ut=_e.length;$e24)throw new Error("maxZoom should be in the 0-24 range");if(G.promoteId&&G.generateId)throw new Error("promoteId and generateId cannot be used together.");let ue=function(Se,Ie){const Me=[];if(Se.type==="FeatureCollection")for(let _e=0;_e1&&console.time("creation"),Mt=this.tiles[ut]=Qn(Z,G,ee,ue,He),this.tileCoords.push({z:G,x:ee,y:ue}),Je)){Je>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",G,ee,ue,Mt.numFeatures,Mt.numPoints,Mt.numSimplified),console.timeEnd("creation"));const _n=`z${G}`;this.stats[_n]=(this.stats[_n]||0)+1,this.total++}if(Mt.source=Z,Se==null){if(G===He.indexMaxZoom||Mt.numPoints<=He.indexMaxPoints)continue}else{if(G===He.maxZoom||G===Se)continue;if(Se!=null){const _n=Se-G;if(ee!==Ie>>_n||ue!==Me>>_n)continue}}if(Mt.source=null,Z.length===0)continue;Je>1&&console.time("clipping");const Dt=.5*He.buffer/He.extent,cr=.5-Dt,Xt=.5+Dt,hr=1+Dt;let rr=null,dn=null,Zr=null,Jt=null,Sr=Ze(Z,$e,ee-Dt,ee+Xt,0,Mt.minX,Mt.maxX,He),Nr=Ze(Z,$e,ee+cr,ee+hr,0,Mt.minX,Mt.maxX,He);Z=null,Sr&&(rr=Ze(Sr,$e,ue-Dt,ue+Xt,1,Mt.minY,Mt.maxY,He),dn=Ze(Sr,$e,ue+cr,ue+hr,1,Mt.minY,Mt.maxY,He),Sr=null),Nr&&(Zr=Ze(Nr,$e,ue-Dt,ue+Xt,1,Mt.minY,Mt.maxY,He),Jt=Ze(Nr,$e,ue+cr,ue+hr,1,Mt.minY,Mt.maxY,He),Nr=null),Je>1&&console.timeEnd("clipping"),_e.push(rr||[],G+1,2*ee,2*ue),_e.push(dn||[],G+1,2*ee,2*ue+1),_e.push(Zr||[],G+1,2*ee+1,2*ue),_e.push(Jt||[],G+1,2*ee+1,2*ue+1)}}getTile(Z,G,ee){Z=+Z,G=+G,ee=+ee;const ue=this.options,{extent:Se,debug:Ie}=ue;if(Z<0||Z>24)return null;const Me=1<1&&console.log("drilling down to z%d-%d-%d",Z,G,ee);let He,Je=Z,$e=G,ut=ee;for(;!He&&Je>0;)Je--,$e>>=1,ut>>=1,He=this.tiles[ei(Je,$e,ut)];return He&&He.source?(Ie>1&&(console.log("found parent tile z%d-%d-%d",Je,$e,ut),console.time("drilling down")),this.splitTile(He.source,Je,$e,ut,Z,G,ee),Ie>1&&console.timeEnd("drilling down"),this.tiles[_e]?on(this.tiles[_e],Se):null):null}}function ei(he,Z,G){return 32*((1<{$e.properties=Mt;const Dt={};for(const cr of ut)Dt[cr]=_e[cr].evaluate(Je,$e);return Dt},Ie.reduce=(Mt,Dt)=>{$e.properties=Dt;for(const cr of ut)Je.accumulated=Mt[cr],Mt[cr]=He[cr].evaluate(Je,$e)},Ie}(Z)).load((yield this._pendingData).features):(ue=yield this._pendingData,new jr(ue,Z.geojsonVtOptions)),this.loaded={};const Se={};if(ee){const Ie=ee.finish();Ie&&(Se.resourceTiming={},Se.resourceTiming[Z.source]=JSON.parse(JSON.stringify(Ie)))}return Se}catch(Se){if(delete this._pendingRequest,y.bB(Se))return{abandoned:!0};throw Se}var ue})}getData(){return y._(this,void 0,void 0,function*(){return this._pendingData})}reloadTile(Z){const G=this.loaded;return G&&G[Z.uid]?super.reloadTile(Z):this.loadTile(Z)}loadAndProcessGeoJSON(Z,G){return y._(this,void 0,void 0,function*(){let ee=yield this.loadGeoJSON(Z,G);if(delete this._pendingRequest,typeof ee!="object")throw new Error(`Input data given to '${Z.source}' is not a valid GeoJSON object.`);if(U(ee,!0),Z.filter){const ue=y.bC(Z.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(ue.result==="error")throw new Error(ue.value.map(Ie=>`${Ie.key}: ${Ie.message}`).join(", "));ee={type:"FeatureCollection",features:ee.features.filter(Ie=>ue.value.evaluate({zoom:0},Ie))}}return ee})}loadGeoJSON(Z,G){return y._(this,void 0,void 0,function*(){const{promoteId:ee}=Z;if(Z.request){const ue=yield y.h(Z.request,G);return this._dataUpdateable=Di(ue.data,ee)?Ki(ue.data,ee):void 0,ue.data}if(typeof Z.data=="string")try{const ue=JSON.parse(Z.data);return this._dataUpdateable=Di(ue,ee)?Ki(ue,ee):void 0,ue}catch{throw new Error(`Input data given to '${Z.source}' is not a valid GeoJSON object.`)}if(!Z.dataDiff)throw new Error(`Input data given to '${Z.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${Z.source}`);return function(ue,Se,Ie){var Me,_e,He,Je;if(Se.removeAll&&ue.clear(),Se.remove)for(const $e of Se.remove)ue.delete($e);if(Se.add)for(const $e of Se.add){const ut=Zt($e,Ie);ut!=null&&ue.set(ut,$e)}if(Se.update)for(const $e of Se.update){let ut=ue.get($e.id);if(ut==null)continue;const Mt=!$e.removeAllProperties&&(((Me=$e.removeProperties)===null||Me===void 0?void 0:Me.length)>0||((_e=$e.addOrUpdateProperties)===null||_e===void 0?void 0:_e.length)>0);if(($e.newGeometry||$e.removeAllProperties||Mt)&&(ut=Object.assign({},ut),ue.set($e.id,ut),Mt&&(ut.properties=Object.assign({},ut.properties))),$e.newGeometry&&(ut.geometry=$e.newGeometry),$e.removeAllProperties)ut.properties={};else if(((He=$e.removeProperties)===null||He===void 0?void 0:He.length)>0)for(const Dt of $e.removeProperties)Object.prototype.hasOwnProperty.call(ut.properties,Dt)&&delete ut.properties[Dt];if(((Je=$e.addOrUpdateProperties)===null||Je===void 0?void 0:Je.length)>0)for(const{key:Dt,value:cr}of $e.addOrUpdateProperties)ut.properties[Dt]=cr}}(this._dataUpdateable,Z.dataDiff,ee),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(Z){return y._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(Z){return this._geoJSONIndex.getClusterExpansionZoom(Z.clusterId)}getClusterChildren(Z){return this._geoJSONIndex.getChildren(Z.clusterId)}getClusterLeaves(Z){return this._geoJSONIndex.getLeaves(Z.clusterId,Z.limit,Z.offset)}}class Pn{constructor(Z){this.self=Z,this.actor=new y.F(Z),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(G,ee)=>{if(this.externalWorkerSourceTypes[G])throw new Error(`Worker source with name "${G}" already registered.`);this.externalWorkerSourceTypes[G]=ee},this.self.addProtocol=y.bi,this.self.removeProtocol=y.bj,this.self.registerRTLTextPlugin=G=>{if(y.bD.isParsed())throw new Error("RTL text plugin already registered.");y.bD.setMethods(G)},this.actor.registerMessageHandler("LDT",(G,ee)=>this._getDEMWorkerSource(G,ee.source).loadTile(ee)),this.actor.registerMessageHandler("RDT",(G,ee)=>y._(this,void 0,void 0,function*(){this._getDEMWorkerSource(G,ee.source).removeTile(ee)})),this.actor.registerMessageHandler("GCEZ",(G,ee)=>y._(this,void 0,void 0,function*(){return this._getWorkerSource(G,ee.type,ee.source).getClusterExpansionZoom(ee)})),this.actor.registerMessageHandler("GCC",(G,ee)=>y._(this,void 0,void 0,function*(){return this._getWorkerSource(G,ee.type,ee.source).getClusterChildren(ee)})),this.actor.registerMessageHandler("GCL",(G,ee)=>y._(this,void 0,void 0,function*(){return this._getWorkerSource(G,ee.type,ee.source).getClusterLeaves(ee)})),this.actor.registerMessageHandler("LD",(G,ee)=>this._getWorkerSource(G,ee.type,ee.source).loadData(ee)),this.actor.registerMessageHandler("GD",(G,ee)=>this._getWorkerSource(G,ee.type,ee.source).getData()),this.actor.registerMessageHandler("LT",(G,ee)=>this._getWorkerSource(G,ee.type,ee.source).loadTile(ee)),this.actor.registerMessageHandler("RT",(G,ee)=>this._getWorkerSource(G,ee.type,ee.source).reloadTile(ee)),this.actor.registerMessageHandler("AT",(G,ee)=>this._getWorkerSource(G,ee.type,ee.source).abortTile(ee)),this.actor.registerMessageHandler("RMT",(G,ee)=>this._getWorkerSource(G,ee.type,ee.source).removeTile(ee)),this.actor.registerMessageHandler("RS",(G,ee)=>y._(this,void 0,void 0,function*(){if(!this.workerSources[G]||!this.workerSources[G][ee.type]||!this.workerSources[G][ee.type][ee.source])return;const ue=this.workerSources[G][ee.type][ee.source];delete this.workerSources[G][ee.type][ee.source],ue.removeSource!==void 0&&ue.removeSource(ee)})),this.actor.registerMessageHandler("RM",G=>y._(this,void 0,void 0,function*(){delete this.layerIndexes[G],delete this.availableImages[G],delete this.workerSources[G],delete this.demWorkerSources[G]})),this.actor.registerMessageHandler("SR",(G,ee)=>y._(this,void 0,void 0,function*(){this.referrer=ee})),this.actor.registerMessageHandler("SRPS",(G,ee)=>this._syncRTLPluginState(G,ee)),this.actor.registerMessageHandler("IS",(G,ee)=>y._(this,void 0,void 0,function*(){this.self.importScripts(ee)})),this.actor.registerMessageHandler("SI",(G,ee)=>this._setImages(G,ee)),this.actor.registerMessageHandler("UL",(G,ee)=>y._(this,void 0,void 0,function*(){this._getLayerIndex(G).update(ee.layers,ee.removedIds)})),this.actor.registerMessageHandler("SL",(G,ee)=>y._(this,void 0,void 0,function*(){this._getLayerIndex(G).replace(ee)}))}_setImages(Z,G){return y._(this,void 0,void 0,function*(){this.availableImages[Z]=G;for(const ee in this.workerSources[Z]){const ue=this.workerSources[Z][ee];for(const Se in ue)ue[Se].availableImages=G}})}_syncRTLPluginState(Z,G){return y._(this,void 0,void 0,function*(){if(y.bD.isParsed())return y.bD.getState();if(G.pluginStatus!=="loading")return y.bD.setState(G),G;const ee=G.pluginURL;if(this.self.importScripts(ee),y.bD.isParsed()){const ue={pluginStatus:"loaded",pluginURL:ee};return y.bD.setState(ue),ue}throw y.bD.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${ee}`)})}_getAvailableImages(Z){let G=this.availableImages[Z];return G||(G=[]),G}_getLayerIndex(Z){let G=this.layerIndexes[Z];return G||(G=this.layerIndexes[Z]=new c),G}_getWorkerSource(Z,G,ee){if(this.workerSources[Z]||(this.workerSources[Z]={}),this.workerSources[Z][G]||(this.workerSources[Z][G]={}),!this.workerSources[Z][G][ee]){const ue={sendAsync:(Se,Ie)=>(Se.targetMapId=Z,this.actor.sendAsync(Se,Ie))};switch(G){case"vector":this.workerSources[Z][G][ee]=new D(ue,this._getLayerIndex(Z),this._getAvailableImages(Z));break;case"geojson":this.workerSources[Z][G][ee]=new Yi(ue,this._getLayerIndex(Z),this._getAvailableImages(Z));break;default:this.workerSources[Z][G][ee]=new this.externalWorkerSourceTypes[G](ue,this._getLayerIndex(Z),this._getAvailableImages(Z))}}return this.workerSources[Z][G][ee]}_getDEMWorkerSource(Z,G){return this.demWorkerSources[Z]||(this.demWorkerSources[Z]={}),this.demWorkerSources[Z][G]||(this.demWorkerSources[Z][G]=new A),this.demWorkerSources[Z][G]}}return y.i(self)&&(self.worker=new Pn(self)),Pn}),d("index",["exports","./shared"],function(y,c){var T="4.7.1";let P,R;const D={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:v=>new Promise((r,a)=>{const p=requestAnimationFrame(r);v.signal.addEventListener("abort",()=>{cancelAnimationFrame(p),a(c.c())})}),getImageData(v,r=0){return this.getImageCanvasContext(v).getImageData(-r,-r,v.width+2*r,v.height+2*r)},getImageCanvasContext(v){const r=window.document.createElement("canvas"),a=r.getContext("2d",{willReadFrequently:!0});if(!a)throw new Error("failed to create canvas 2d context");return r.width=v.width,r.height=v.height,a.drawImage(v,0,0,v.width,v.height),a},resolveURL:v=>(P||(P=document.createElement("a")),P.href=v,P.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(R==null&&(R=matchMedia("(prefers-reduced-motion: reduce)")),R.matches)}};class A{static testProp(r){if(!A.docStyle)return r[0];for(let a=0;a{window.removeEventListener("click",A.suppressClickInternal,!0)},0)}static getScale(r){const a=r.getBoundingClientRect();return{x:a.width/r.offsetWidth||1,y:a.height/r.offsetHeight||1,boundingClientRect:a}}static getPoint(r,a,p){const f=a.boundingClientRect;return new c.P((p.clientX-f.left)/a.x-r.clientLeft,(p.clientY-f.top)/a.y-r.clientTop)}static mousePos(r,a){const p=A.getScale(r);return A.getPoint(r,p,a)}static touchPos(r,a){const p=[],f=A.getScale(r);for(let _=0;_{X&&$(X),X=null,F=!0},U.onerror=()=>{te=!0,X=null},U.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(v){let r,a,p,f;v.resetRequestQueue=()=>{r=[],a=0,p=0,f={}},v.addThrottleControl=C=>{const z=p++;return f[z]=C,z},v.removeThrottleControl=C=>{delete f[C],S()},v.getImage=(C,z,O=!0)=>new Promise((B,K)=>{N.supported&&(C.headers||(C.headers={}),C.headers.accept="image/webp,*/*"),c.e(C,{type:"image"}),r.push({abortController:z,requestParameters:C,supportImageRefresh:O,state:"queued",onError:Q=>{K(Q)},onSuccess:Q=>{B(Q)}}),S()});const _=C=>c._(this,void 0,void 0,function*(){C.state="running";const{requestParameters:z,supportImageRefresh:O,onError:B,onSuccess:K,abortController:Q}=C,re=O===!1&&!c.i(self)&&!c.g(z.url)&&(!z.headers||Object.keys(z.headers).reduce((me,we)=>me&&we==="accept",!0));a++;const ce=re?k(z,Q):c.m(z,Q);try{const me=yield ce;delete C.abortController,C.state="completed",me.data instanceof HTMLImageElement||c.b(me.data)?K(me):me.data&&K({data:yield(fe=me.data,typeof createImageBitmap=="function"?c.d(fe):c.f(fe)),cacheControl:me.cacheControl,expires:me.expires})}catch(me){delete C.abortController,B(me)}finally{a--,S()}var fe}),S=()=>{const C=(()=>{for(const z of Object.keys(f))if(f[z]())return!0;return!1})()?c.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:c.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let z=a;z0;z++){const O=r.shift();O.abortController.signal.aborted?z--:_(O)}},k=(C,z)=>new Promise((O,B)=>{const K=new Image,Q=C.url,re=C.credentials;re&&re==="include"?K.crossOrigin="use-credentials":(re&&re==="same-origin"||!c.s(Q))&&(K.crossOrigin="anonymous"),z.signal.addEventListener("abort",()=>{K.src="",B(c.c())}),K.fetchPriority="high",K.onload=()=>{K.onerror=K.onload=null,O({data:K})},K.onerror=()=>{K.onerror=K.onload=null,z.signal.aborted||B(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."))},K.src=Q})}(q||(q={})),q.resetRequestQueue();class ne{constructor(r){this._transformRequestFn=r}transformRequest(r,a){return this._transformRequestFn&&this._transformRequestFn(r,a)||{url:r}}setTransformRequest(r){this._transformRequestFn=r}}function se(v){var r=new c.A(3);return r[0]=v[0],r[1]=v[1],r[2]=v[2],r}var Ee,ge=function(v,r,a){return v[0]=r[0]-a[0],v[1]=r[1]-a[1],v[2]=r[2]-a[2],v};Ee=new c.A(3),c.A!=Float32Array&&(Ee[0]=0,Ee[1]=0,Ee[2]=0);var Oe=function(v){var r=v[0],a=v[1];return r*r+a*a};function Fe(v){const r=[];if(typeof v=="string")r.push({id:"default",url:v});else if(v&&v.length>0){const a=[];for(const{id:p,url:f}of v){const _=`${p}${f}`;a.indexOf(_)===-1&&(a.push(_),r.push({id:p,url:f}))}}return r}function Ge(v,r,a){const p=v.split("?");return p[0]+=`${r}${a}`,p.join("?")}(function(){var v=new c.A(2);c.A!=Float32Array&&(v[0]=0,v[1]=0)})();class it{constructor(r,a,p,f){this.context=r,this.format=p,this.texture=r.gl.createTexture(),this.update(a,f)}update(r,a,p){const{width:f,height:_}=r,S=!(this.size&&this.size[0]===f&&this.size[1]===_||p),{context:k}=this,{gl:C}=k;if(this.useMipmap=!!(a&&a.useMipmap),C.bindTexture(C.TEXTURE_2D,this.texture),k.pixelStoreUnpackFlipY.set(!1),k.pixelStoreUnpack.set(1),k.pixelStoreUnpackPremultiplyAlpha.set(this.format===C.RGBA&&(!a||a.premultiply!==!1)),S)this.size=[f,_],r instanceof HTMLImageElement||r instanceof HTMLCanvasElement||r instanceof HTMLVideoElement||r instanceof ImageData||c.b(r)?C.texImage2D(C.TEXTURE_2D,0,this.format,this.format,C.UNSIGNED_BYTE,r):C.texImage2D(C.TEXTURE_2D,0,this.format,f,_,0,this.format,C.UNSIGNED_BYTE,r.data);else{const{x:z,y:O}=p||{x:0,y:0};r instanceof HTMLImageElement||r instanceof HTMLCanvasElement||r instanceof HTMLVideoElement||r instanceof ImageData||c.b(r)?C.texSubImage2D(C.TEXTURE_2D,0,z,O,C.RGBA,C.UNSIGNED_BYTE,r):C.texSubImage2D(C.TEXTURE_2D,0,z,O,f,_,C.RGBA,C.UNSIGNED_BYTE,r.data)}this.useMipmap&&this.isSizePowerOfTwo()&&C.generateMipmap(C.TEXTURE_2D)}bind(r,a,p){const{context:f}=this,{gl:_}=f;_.bindTexture(_.TEXTURE_2D,this.texture),p!==_.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(p=_.LINEAR),r!==this.filter&&(_.texParameteri(_.TEXTURE_2D,_.TEXTURE_MAG_FILTER,r),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_MIN_FILTER,p||r),this.filter=r),a!==this.wrap&&(_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_S,a),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_T,a),this.wrap=a)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:r}=this.context;r.deleteTexture(this.texture),this.texture=null}}function ve(v){const{userImage:r}=v;return!!(r&&r.render&&r.render())&&(v.data.replace(new Uint8Array(r.data.buffer)),!0)}class je extends c.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new c.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(r){if(this.loaded!==r&&(this.loaded=r,r)){for(const{ids:a,promiseResolve:p}of this.requestors)p(this._getImagesForIds(a));this.requestors=[]}}getImage(r){const a=this.images[r];if(a&&!a.data&&a.spriteData){const p=a.spriteData;a.data=new c.R({width:p.width,height:p.height},p.context.getImageData(p.x,p.y,p.width,p.height).data),a.spriteData=null}return a}addImage(r,a){if(this.images[r])throw new Error(`Image id ${r} already exist, use updateImage instead`);this._validate(r,a)&&(this.images[r]=a)}_validate(r,a){let p=!0;const f=a.data||a.spriteData;return this._validateStretch(a.stretchX,f&&f.width)||(this.fire(new c.j(new Error(`Image "${r}" has invalid "stretchX" value`))),p=!1),this._validateStretch(a.stretchY,f&&f.height)||(this.fire(new c.j(new Error(`Image "${r}" has invalid "stretchY" value`))),p=!1),this._validateContent(a.content,a)||(this.fire(new c.j(new Error(`Image "${r}" has invalid "content" value`))),p=!1),p}_validateStretch(r,a){if(!r)return!0;let p=0;for(const f of r){if(f[0]{let f=!0;if(!this.isLoaded())for(const _ of r)this.images[_]||(f=!1);this.isLoaded()||f?a(this._getImagesForIds(r)):this.requestors.push({ids:r,promiseResolve:a})})}_getImagesForIds(r){const a={};for(const p of r){let f=this.getImage(p);f||(this.fire(new c.k("styleimagemissing",{id:p})),f=this.getImage(p)),f?a[p]={data:f.data.clone(),pixelRatio:f.pixelRatio,sdf:f.sdf,version:f.version,stretchX:f.stretchX,stretchY:f.stretchY,content:f.content,textFitWidth:f.textFitWidth,textFitHeight:f.textFitHeight,hasRenderCallback:!!(f.userImage&&f.userImage.render)}:c.w(`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.`)}return a}getPixelSize(){const{width:r,height:a}=this.atlasImage;return{width:r,height:a}}getPattern(r){const a=this.patterns[r],p=this.getImage(r);if(!p)return null;if(a&&a.position.version===p.version)return a.position;if(a)a.position.version=p.version;else{const f={w:p.data.width+2,h:p.data.height+2,x:0,y:0},_=new c.I(f,p);this.patterns[r]={bin:f,position:_}}return this._updatePatternAtlas(),this.patterns[r].position}bind(r){const a=r.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new it(r,this.atlasImage,a.RGBA),this.atlasTexture.bind(a.LINEAR,a.CLAMP_TO_EDGE)}_updatePatternAtlas(){const r=[];for(const _ in this.patterns)r.push(this.patterns[_].bin);const{w:a,h:p}=c.p(r),f=this.atlasImage;f.resize({width:a||1,height:p||1});for(const _ in this.patterns){const{bin:S}=this.patterns[_],k=S.x+1,C=S.y+1,z=this.getImage(_).data,O=z.width,B=z.height;c.R.copy(z,f,{x:0,y:0},{x:k,y:C},{width:O,height:B}),c.R.copy(z,f,{x:0,y:B-1},{x:k,y:C-1},{width:O,height:1}),c.R.copy(z,f,{x:0,y:0},{x:k,y:C+B},{width:O,height:1}),c.R.copy(z,f,{x:O-1,y:0},{x:k-1,y:C},{width:1,height:B}),c.R.copy(z,f,{x:0,y:0},{x:k+O,y:C},{width:1,height:B})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(r){for(const a of r){if(this.callbackDispatchedThisFrame[a])continue;this.callbackDispatchedThisFrame[a]=!0;const p=this.getImage(a);p||c.w(`Image with ID: "${a}" was not found`),ve(p)&&this.updateImage(a,p)}}}const H=1e20;function Re(v,r,a,p,f,_,S,k,C){for(let z=r;z-1);C++,_[C]=k,S[C]=z,S[C+1]=H}for(let k=0,C=0;k65535)throw new Error("glyphs > 65535 not supported");if(p.ranges[_])return{stack:r,id:a,glyph:f};if(!this.url)throw new Error("glyphsUrl is not set");if(!p.requests[_]){const k=ye.loadGlyphRange(r,_,this.url,this.requestManager);p.requests[_]=k}const S=yield p.requests[_];for(const k in S)this._doesCharSupportLocalGlyph(+k)||(p.glyphs[+k]=S[+k]);return p.ranges[_]=!0,{stack:r,id:a,glyph:S[a]||null}})}_doesCharSupportLocalGlyph(r){return!!this.localIdeographFontFamily&&new RegExp("\\p{Ideo}|\\p{sc=Hang}|\\p{sc=Hira}|\\p{sc=Kana}","u").test(String.fromCodePoint(r))}_tinySDF(r,a,p){const f=this.localIdeographFontFamily;if(!f||!this._doesCharSupportLocalGlyph(p))return;let _=r.tinySDF;if(!_){let k="400";/bold/i.test(a)?k="900":/medium/i.test(a)?k="500":/light/i.test(a)&&(k="200"),_=r.tinySDF=new ye.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:f,fontWeight:k})}const S=_.draw(String.fromCharCode(p));return{id:p,bitmap:new c.o({width:S.width||60,height:S.height||60},S.data),metrics:{width:S.glyphWidth/2||24,height:S.glyphHeight/2||24,left:S.glyphLeft/2+.5||0,top:S.glyphTop/2-27.5||-8,advance:S.glyphAdvance/2||24,isDoubleResolution:!0}}}}ye.loadGlyphRange=function(v,r,a,p){return c._(this,void 0,void 0,function*(){const f=256*r,_=f+255,S=p.transformRequest(a.replace("{fontstack}",v).replace("{range}",`${f}-${_}`),"Glyphs"),k=yield c.l(S,new AbortController);if(!k||!k.data)throw new Error(`Could not load glyph range. range: ${r}, ${f}-${_}`);const C={};for(const z of c.n(k.data))C[z.id]=z;return C})},ye.TinySDF=class{constructor({fontSize:v=24,buffer:r=3,radius:a=8,cutoff:p=.25,fontFamily:f="sans-serif",fontWeight:_="normal",fontStyle:S="normal"}={}){this.buffer=r,this.cutoff=p,this.radius=a;const k=this.size=v+4*r,C=this._createCanvas(k),z=this.ctx=C.getContext("2d",{willReadFrequently:!0});z.font=`${S} ${_} ${v}px ${f}`,z.textBaseline="alphabetic",z.textAlign="left",z.fillStyle="black",this.gridOuter=new Float64Array(k*k),this.gridInner=new Float64Array(k*k),this.f=new Float64Array(k),this.z=new Float64Array(k+1),this.v=new Uint16Array(k)}_createCanvas(v){const r=document.createElement("canvas");return r.width=r.height=v,r}draw(v){const{width:r,actualBoundingBoxAscent:a,actualBoundingBoxDescent:p,actualBoundingBoxLeft:f,actualBoundingBoxRight:_}=this.ctx.measureText(v),S=Math.ceil(a),k=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(_-f))),C=Math.min(this.size-this.buffer,S+Math.ceil(p)),z=k+2*this.buffer,O=C+2*this.buffer,B=Math.max(z*O,0),K=new Uint8ClampedArray(B),Q={data:K,width:z,height:O,glyphWidth:k,glyphHeight:C,glyphTop:S,glyphLeft:0,glyphAdvance:r};if(k===0||C===0)return Q;const{ctx:re,buffer:ce,gridInner:fe,gridOuter:me}=this;re.clearRect(ce,ce,k,C),re.fillText(v,ce,ce+S);const we=re.getImageData(ce,ce,k,C);me.fill(H,0,B),fe.fill(0,0,B);for(let ae=0;ae0?Xe*Xe:0,fe[De]=Xe<0?Xe*Xe:0}}Re(me,0,0,z,O,z,this.f,this.v,this.z),Re(fe,ce,ce,k,C,z,this.f,this.v,this.z);for(let ae=0;ae1&&(C=r[++k]);const O=Math.abs(z-C.left),B=Math.abs(z-C.right),K=Math.min(O,B);let Q;const re=_/p*(f+1);if(C.isDash){const ce=f-Math.abs(re);Q=Math.sqrt(K*K+ce*ce)}else Q=f-Math.sqrt(K*K+re*re);this.data[S+z]=Math.max(0,Math.min(255,Q+128))}}}addRegularDash(r){for(let k=r.length-1;k>=0;--k){const C=r[k],z=r[k+1];C.zeroLength?r.splice(k,1):z&&z.isDash===C.isDash&&(z.left=C.left,r.splice(k,1))}const a=r[0],p=r[r.length-1];a.isDash===p.isDash&&(a.left=p.left-this.width,p.right=a.right+this.width);const f=this.width*this.nextRow;let _=0,S=r[_];for(let k=0;k1&&(S=r[++_]);const C=Math.abs(k-S.left),z=Math.abs(k-S.right),O=Math.min(C,z);this.data[f+k]=Math.max(0,Math.min(255,(S.isDash?O:-O)+128))}}addDash(r,a){const p=a?7:0,f=2*p+1;if(this.nextRow+f>this.height)return c.w("LineAtlas out of space"),null;let _=0;for(let k=0;k{a.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[nt]}numActive(){return Object.keys(this.active).length}}const qt=Math.floor(D.hardwareConcurrency/2);let Kt,$t;function Gt(){return Kt||(Kt=new rt),Kt}rt.workerCount=c.C(globalThis)?Math.max(Math.min(qt,3),1):1;class pr{constructor(r,a){this.workerPool=r,this.actors=[],this.currentActor=0,this.id=a;const p=this.workerPool.acquire(a);for(let f=0;f{a.remove()}),this.actors=[],r&&this.workerPool.release(this.id)}registerMessageHandler(r,a){for(const p of this.actors)p.registerMessageHandler(r,a)}}function lr(){return $t||($t=new pr(Gt(),c.G),$t.registerMessageHandler("GR",(v,r,a)=>c.m(r,a))),$t}function gr(v,r){const a=c.H();return c.J(a,a,[1,1,0]),c.K(a,a,[.5*v.width,.5*v.height,1]),c.L(a,a,v.calculatePosMatrix(r.toUnwrapped()))}function $r(v,r,a,p,f,_){const S=function(B,K,Q){if(B)for(const re of B){const ce=K[re];if(ce&&ce.source===Q&&ce.type==="fill-extrusion")return!0}else for(const re in K){const ce=K[re];if(ce.source===Q&&ce.type==="fill-extrusion")return!0}return!1}(f&&f.layers,r,v.id),k=_.maxPitchScaleFactor(),C=v.tilesIn(p,k,S);C.sort(V);const z=[];for(const B of C)z.push({wrappedTileID:B.tileID.wrapped().key,queryResults:B.tile.queryRenderedFeatures(r,a,v._state,B.queryGeometry,B.cameraQueryGeometry,B.scale,f,_,k,gr(v.transform,B.tileID))});const O=function(B){const K={},Q={};for(const re of B){const ce=re.queryResults,fe=re.wrappedTileID,me=Q[fe]=Q[fe]||{};for(const we in ce){const ae=ce[we],Ce=me[we]=me[we]||{},Pe=K[we]=K[we]||[];for(const De of ae)Ce[De.featureIndex]||(Ce[De.featureIndex]=!0,Pe.push(De))}}return K}(z);for(const B in O)O[B].forEach(K=>{const Q=K.feature,re=v.getFeatureState(Q.layer["source-layer"],Q.id);Q.source=Q.layer.source,Q.layer["source-layer"]&&(Q.sourceLayer=Q.layer["source-layer"]),Q.state=re});return O}function V(v,r){const a=v.tileID,p=r.tileID;return a.overscaledZ-p.overscaledZ||a.canonical.y-p.canonical.y||a.wrap-p.wrap||a.canonical.x-p.canonical.x}function Ue(v,r,a){return c._(this,void 0,void 0,function*(){let p=v;if(v.url?p=(yield c.h(r.transformRequest(v.url,"Source"),a)).data:yield D.frameAsync(a),!p)return null;const f=c.M(c.e(p,v),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in p&&p.vector_layers&&(f.vectorLayerIds=p.vector_layers.map(_=>_.id)),f})}class ie{constructor(r,a){r&&(a?this.setSouthWest(r).setNorthEast(a):Array.isArray(r)&&(r.length===4?this.setSouthWest([r[0],r[1]]).setNorthEast([r[2],r[3]]):this.setSouthWest(r[0]).setNorthEast(r[1])))}setNorthEast(r){return this._ne=r instanceof c.N?new c.N(r.lng,r.lat):c.N.convert(r),this}setSouthWest(r){return this._sw=r instanceof c.N?new c.N(r.lng,r.lat):c.N.convert(r),this}extend(r){const a=this._sw,p=this._ne;let f,_;if(r instanceof c.N)f=r,_=r;else{if(!(r instanceof ie))return Array.isArray(r)?r.length===4||r.every(Array.isArray)?this.extend(ie.convert(r)):this.extend(c.N.convert(r)):r&&("lng"in r||"lon"in r)&&"lat"in r?this.extend(c.N.convert(r)):this;if(f=r._sw,_=r._ne,!f||!_)return this}return a||p?(a.lng=Math.min(f.lng,a.lng),a.lat=Math.min(f.lat,a.lat),p.lng=Math.max(_.lng,p.lng),p.lat=Math.max(_.lat,p.lat)):(this._sw=new c.N(f.lng,f.lat),this._ne=new c.N(_.lng,_.lat)),this}getCenter(){return new c.N((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 c.N(this.getWest(),this.getNorth())}getSouthEast(){return new c.N(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(r){const{lng:a,lat:p}=c.N.convert(r);let f=this._sw.lng<=a&&a<=this._ne.lng;return this._sw.lng>this._ne.lng&&(f=this._sw.lng>=a&&a>=this._ne.lng),this._sw.lat<=p&&p<=this._ne.lat&&f}static convert(r){return r instanceof ie?r:r&&new ie(r)}static fromLngLat(r,a=0){const p=360*a/40075017,f=p/Math.cos(Math.PI/180*r.lat);return new ie(new c.N(r.lng-f,r.lat-p),new c.N(r.lng+f,r.lat+p))}adjustAntiMeridian(){const r=new c.N(this._sw.lng,this._sw.lat),a=new c.N(this._ne.lng,this._ne.lat);return new ie(r,r.lng>a.lng?new c.N(a.lng+360,a.lat):a)}}class de{constructor(r,a,p){this.bounds=ie.convert(this.validateBounds(r)),this.minzoom=a||0,this.maxzoom=p||24}validateBounds(r){return Array.isArray(r)&&r.length===4?[Math.max(-180,r[0]),Math.max(-90,r[1]),Math.min(180,r[2]),Math.min(90,r[3])]:[-180,-90,180,90]}contains(r){const a=Math.pow(2,r.z),p=Math.floor(c.O(this.bounds.getWest())*a),f=Math.floor(c.Q(this.bounds.getNorth())*a),_=Math.ceil(c.O(this.bounds.getEast())*a),S=Math.ceil(c.Q(this.bounds.getSouth())*a);return r.x>=p&&r.x<_&&r.y>=f&&r.y{this._options.tiles=r}),this}setUrl(r){return this.setSourceProperty(()=>{this.url=r,this._options.url=r}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return c.e({},this._options)}loadTile(r){return c._(this,void 0,void 0,function*(){const a=r.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),p={request:this.map._requestManager.transformRequest(a,"Tile"),uid:r.uid,tileID:r.tileID,zoom:r.tileID.overscaledZ,tileSize:this.tileSize*r.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};p.request.collectResourceTiming=this._collectResourceTiming;let f="RT";if(r.actor&&r.state!=="expired"){if(r.state==="loading")return new Promise((_,S)=>{r.reloadPromise={resolve:_,reject:S}})}else r.actor=this.dispatcher.getActor(),f="LT";r.abortController=new AbortController;try{const _=yield r.actor.sendAsync({type:f,data:p},r.abortController);if(delete r.abortController,r.aborted)return;this._afterTileLoadWorkerResponse(r,_)}catch(_){if(delete r.abortController,r.aborted)return;if(_&&_.status!==404)throw _;this._afterTileLoadWorkerResponse(r,null)}})}_afterTileLoadWorkerResponse(r,a){if(a&&a.resourceTiming&&(r.resourceTiming=a.resourceTiming),a&&this.map._refreshExpiredTiles&&r.setExpiryData(a),r.loadVectorData(a,this.map.painter),r.reloadPromise){const p=r.reloadPromise;r.reloadPromise=null,this.loadTile(r).then(p.resolve).catch(p.reject)}}abortTile(r){return c._(this,void 0,void 0,function*(){r.abortController&&(r.abortController.abort(),delete r.abortController),r.actor&&(yield r.actor.sendAsync({type:"AT",data:{uid:r.uid,type:this.type,source:this.id}}))})}unloadTile(r){return c._(this,void 0,void 0,function*(){r.unloadVectorData(),r.actor&&(yield r.actor.sendAsync({type:"RMT",data:{uid:r.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class ke extends c.E{constructor(r,a,p,f){super(),this.id=r,this.dispatcher=p,this.setEventedParent(f),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=c.e({type:"raster"},a),c.e(this,c.M(a,["url","scheme","tileSize"]))}load(){return c._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new c.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const r=yield Ue(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,r&&(c.e(this,r),r.bounds&&(this.tileBounds=new de(r.bounds,this.minzoom,this.maxzoom)),this.fire(new c.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new c.k("data",{dataType:"source",sourceDataType:"content"})))}catch(r){this._tileJSONRequest=null,this.fire(new c.j(r))}})}loaded(){return this._loaded}onAdd(r){this.map=r,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(r){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),r(),this.load()}setTiles(r){return this.setSourceProperty(()=>{this._options.tiles=r}),this}setUrl(r){return this.setSourceProperty(()=>{this.url=r,this._options.url=r}),this}serialize(){return c.e({},this._options)}hasTile(r){return!this.tileBounds||this.tileBounds.contains(r.canonical)}loadTile(r){return c._(this,void 0,void 0,function*(){const a=r.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);r.abortController=new AbortController;try{const p=yield q.getImage(this.map._requestManager.transformRequest(a,"Tile"),r.abortController,this.map._refreshExpiredTiles);if(delete r.abortController,r.aborted)return void(r.state="unloaded");if(p&&p.data){this.map._refreshExpiredTiles&&p.cacheControl&&p.expires&&r.setExpiryData({cacheControl:p.cacheControl,expires:p.expires});const f=this.map.painter.context,_=f.gl,S=p.data;r.texture=this.map.painter.getTileTexture(S.width),r.texture?r.texture.update(S,{useMipmap:!0}):(r.texture=new it(f,S,_.RGBA,{useMipmap:!0}),r.texture.bind(_.LINEAR,_.CLAMP_TO_EDGE,_.LINEAR_MIPMAP_NEAREST)),r.state="loaded"}}catch(p){if(delete r.abortController,r.aborted)r.state="unloaded";else if(p)throw r.state="errored",p}})}abortTile(r){return c._(this,void 0,void 0,function*(){r.abortController&&(r.abortController.abort(),delete r.abortController)})}unloadTile(r){return c._(this,void 0,void 0,function*(){r.texture&&this.map.painter.saveTileTexture(r.texture)})}hasTransition(){return!1}}class Ze extends ke{constructor(r,a,p,f){super(r,a,p,f),this.type="raster-dem",this.maxzoom=22,this._options=c.e({type:"raster-dem"},a),this.encoding=a.encoding||"mapbox",this.redFactor=a.redFactor,this.greenFactor=a.greenFactor,this.blueFactor=a.blueFactor,this.baseShift=a.baseShift}loadTile(r){return c._(this,void 0,void 0,function*(){const a=r.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),p=this.map._requestManager.transformRequest(a,"Tile");r.neighboringTiles=this._getNeighboringTiles(r.tileID),r.abortController=new AbortController;try{const f=yield q.getImage(p,r.abortController,this.map._refreshExpiredTiles);if(delete r.abortController,r.aborted)return void(r.state="unloaded");if(f&&f.data){const _=f.data;this.map._refreshExpiredTiles&&f.cacheControl&&f.expires&&r.setExpiryData({cacheControl:f.cacheControl,expires:f.expires});const S=c.b(_)&&c.U()?_:yield this.readImageNow(_),k={type:this.type,uid:r.uid,source:this.id,rawImageData:S,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!r.actor||r.state==="expired"){r.actor=this.dispatcher.getActor();const C=yield r.actor.sendAsync({type:"LDT",data:k});r.dem=C,r.needsHillshadePrepare=!0,r.needsTerrainPrepare=!0,r.state="loaded"}}}catch(f){if(delete r.abortController,r.aborted)r.state="unloaded";else if(f)throw r.state="errored",f}})}readImageNow(r){return c._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&c.V()){const a=r.width+2,p=r.height+2;try{return new c.R({width:a,height:p},yield c.W(r,-1,-1,a,p))}catch{}}return D.getImageData(r,1)})}_getNeighboringTiles(r){const a=r.canonical,p=Math.pow(2,a.z),f=(a.x-1+p)%p,_=a.x===0?r.wrap-1:r.wrap,S=(a.x+1+p)%p,k=a.x+1===p?r.wrap+1:r.wrap,C={};return C[new c.S(r.overscaledZ,_,a.z,f,a.y).key]={backfilled:!1},C[new c.S(r.overscaledZ,k,a.z,S,a.y).key]={backfilled:!1},a.y>0&&(C[new c.S(r.overscaledZ,_,a.z,f,a.y-1).key]={backfilled:!1},C[new c.S(r.overscaledZ,r.wrap,a.z,a.x,a.y-1).key]={backfilled:!1},C[new c.S(r.overscaledZ,k,a.z,S,a.y-1).key]={backfilled:!1}),a.y+10&&c.e(_,{resourceTiming:f}),this.fire(new c.k("data",Object.assign(Object.assign({},_),{sourceDataType:"metadata"}))),this.fire(new c.k("data",Object.assign(Object.assign({},_),{sourceDataType:"content"})))}catch(p){if(this._pendingLoads--,this._removed)return void this.fire(new c.k("dataabort",{dataType:"source"}));this.fire(new c.j(p))}})}loaded(){return this._pendingLoads===0}loadTile(r){return c._(this,void 0,void 0,function*(){const a=r.actor?"RT":"LT";r.actor=this.actor;const p={type:this.type,uid:r.uid,tileID:r.tileID,zoom:r.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};r.abortController=new AbortController;const f=yield this.actor.sendAsync({type:a,data:p},r.abortController);delete r.abortController,r.unloadVectorData(),r.aborted||r.loadVectorData(f,this.map.painter,a==="RT")})}abortTile(r){return c._(this,void 0,void 0,function*(){r.abortController&&(r.abortController.abort(),delete r.abortController),r.aborted=!0})}unloadTile(r){return c._(this,void 0,void 0,function*(){r.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:r.uid,type:this.type,source:this.id}})})}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return c.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var Ne=c.Y([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class st extends c.E{constructor(r,a,p,f){super(),this.id=r,this.dispatcher=p,this.coordinates=a.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(f),this.options=a}load(r){return c._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new c.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const a=yield q.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,a&&a.data&&(this.image=a.data,r&&(this.coordinates=r),this._finishLoading())}catch(a){this._request=null,this._loaded=!0,this.fire(new c.j(a))}})}loaded(){return this._loaded}updateImage(r){return r.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=r.url,this.load(r.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new c.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(r){this.map=r,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(r){this.coordinates=r;const a=r.map(c.Z.fromLngLat);this.tileID=function(f){let _=1/0,S=1/0,k=-1/0,C=-1/0;for(const K of f)_=Math.min(_,K.x),S=Math.min(S,K.y),k=Math.max(k,K.x),C=Math.max(C,K.y);const z=Math.max(k-_,C-S),O=Math.max(0,Math.floor(-Math.log(z)/Math.LN2)),B=Math.pow(2,O);return new c.a1(O,Math.floor((_+k)/2*B),Math.floor((S+C)/2*B))}(a),this.minzoom=this.maxzoom=this.tileID.z;const p=a.map(f=>this.tileID.getTilePoint(f)._round());return this._boundsArray=new c.$,this._boundsArray.emplaceBack(p[0].x,p[0].y,0,0),this._boundsArray.emplaceBack(p[1].x,p[1].y,c.X,0),this._boundsArray.emplaceBack(p[3].x,p[3].y,0,c.X),this._boundsArray.emplaceBack(p[2].x,p[2].y,c.X,c.X),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new c.k("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const r=this.map.painter.context,a=r.gl;this.boundsBuffer||(this.boundsBuffer=r.createVertexBuffer(this._boundsArray,Ne.members)),this.boundsSegments||(this.boundsSegments=c.a0.simpleSegment(0,0,4,2)),this.texture||(this.texture=new it(r,this.image,a.RGBA),this.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE));let p=!1;for(const f in this.tiles){const _=this.tiles[f];_.state!=="loaded"&&(_.state="loaded",_.texture=this.texture,p=!0)}p&&this.fire(new c.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(r){return c._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(r.tileID.canonical)?(this.tiles[String(r.tileID.wrap)]=r,r.buckets={}):r.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class St extends st{constructor(r,a,p,f){super(r,a,p,f),this.roundZoom=!0,this.type="video",this.options=a}load(){return c._(this,void 0,void 0,function*(){this._loaded=!1;const r=this.options;this.urls=[];for(const a of r.urls)this.urls.push(this.map._requestManager.transformRequest(a,"Source").url);try{const a=yield c.a3(this.urls);if(this._loaded=!0,!a)return;this.video=a,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(a){this.fire(new c.j(a))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(r){if(this.video){const a=this.video.seekable;ra.end(0)?this.fire(new c.j(new c.a2(`sources.${this.id}`,null,`Playback for this video can be set only between the ${a.start(0)} and ${a.end(0)}-second mark.`))):this.video.currentTime=r}}getVideo(){return this.video}onAdd(r){this.map||(this.map=r,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 r=this.map.painter.context,a=r.gl;this.boundsBuffer||(this.boundsBuffer=r.createVertexBuffer(this._boundsArray,Ne.members)),this.boundsSegments||(this.boundsSegments=c.a0.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE),a.texSubImage2D(a.TEXTURE_2D,0,0,0,a.RGBA,a.UNSIGNED_BYTE,this.video)):(this.texture=new it(r,this.video,a.RGBA),this.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE));let p=!1;for(const f in this.tiles){const _=this.tiles[f];_.state!=="loaded"&&(_.state="loaded",_.texture=this.texture,p=!0)}p&&this.fire(new c.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class at extends st{constructor(r,a,p,f){super(r,a,p,f),a.coordinates?Array.isArray(a.coordinates)&&a.coordinates.length===4&&!a.coordinates.some(_=>!Array.isArray(_)||_.length!==2||_.some(S=>typeof S!="number"))||this.fire(new c.j(new c.a2(`sources.${r}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new c.j(new c.a2(`sources.${r}`,null,'missing required property "coordinates"'))),a.animate&&typeof a.animate!="boolean"&&this.fire(new c.j(new c.a2(`sources.${r}`,null,'optional "animate" property must be a boolean value'))),a.canvas?typeof a.canvas=="string"||a.canvas instanceof HTMLCanvasElement||this.fire(new c.j(new c.a2(`sources.${r}`,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 c.j(new c.a2(`sources.${r}`,null,'missing required property "canvas"'))),this.options=a,this.animate=a.animate===void 0||a.animate}load(){return c._(this,void 0,void 0,function*(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new c.j(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(r){this.map=r,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let r=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,r=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,r=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const a=this.map.painter.context,p=a.gl;this.boundsBuffer||(this.boundsBuffer=a.createVertexBuffer(this._boundsArray,Ne.members)),this.boundsSegments||(this.boundsSegments=c.a0.simpleSegment(0,0,4,2)),this.texture?(r||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new it(a,this.canvas,p.RGBA,{premultiply:!0});let f=!1;for(const _ in this.tiles){const S=this.tiles[_];S.state!=="loaded"&&(S.state="loaded",S.texture=this.texture,f=!0)}f&&this.fire(new c.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const r of[this.canvas.width,this.canvas.height])if(isNaN(r)||r<=0)return!0;return!1}}const Lt={},vr=v=>{switch(v){case"geojson":return tt;case"image":return st;case"raster":return ke;case"raster-dem":return Ze;case"vector":return oe;case"video":return St;case"canvas":return at}return Lt[v]},We="RTLPluginLoaded";class Gr extends c.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=lr()}_syncState(r){return this.status=r,this.dispatcher.broadcast("SRPS",{pluginStatus:r,pluginURL:this.url}).catch(a=>{throw this.status="error",a})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(r){return c._(this,arguments,void 0,function*(a,p=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=D.resolveURL(a),!this.url)throw new Error(`requested url ${a} is invalid`);if(this.status==="unavailable"){if(!p)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return c._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new c.k(We))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let on=null;function sn(){return on||(on=new Gr),on}class Qn{constructor(r,a){this.timeAdded=0,this.fadeEndTime=0,this.tileID=r,this.uid=c.a4(),this.uses=0,this.tileSize=a,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(r){const a=r+this.timeAdded;a_.getLayer(z)).filter(Boolean);if(C.length!==0){k.layers=C,k.stateDependentLayerIds&&(k.stateDependentLayers=k.stateDependentLayerIds.map(z=>C.filter(O=>O.id===z)[0]));for(const z of C)S[z.id]=k}}return S}(r.buckets,a.style),this.hasSymbolBuckets=!1;for(const f in this.buckets){const _=this.buckets[f];if(_ instanceof c.a6){if(this.hasSymbolBuckets=!0,!p)break;_.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const f in this.buckets){const _=this.buckets[f];if(_ instanceof c.a6&&_.hasRTLText){this.hasRTLText=!0,sn().lazyLoad();break}}this.queryPadding=0;for(const f in this.buckets){const _=this.buckets[f];this.queryPadding=Math.max(this.queryPadding,a.style.getLayer(f).queryRadius(_))}r.imageAtlas&&(this.imageAtlas=r.imageAtlas),r.glyphAtlasImage&&(this.glyphAtlasImage=r.glyphAtlasImage)}else this.collisionBoxArray=new c.a5}unloadVectorData(){for(const r in this.buckets)this.buckets[r].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(r){return this.buckets[r.id]}upload(r){for(const p in this.buckets){const f=this.buckets[p];f.uploadPending()&&f.upload(r)}const a=r.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new it(r,this.imageAtlas.image,a.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new it(r,this.glyphAtlasImage,a.ALPHA),this.glyphAtlasImage=null)}prepare(r){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(r,this.imageAtlasTexture)}queryRenderedFeatures(r,a,p,f,_,S,k,C,z,O){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:f,cameraQueryGeometry:_,scale:S,tileSize:this.tileSize,pixelPosMatrix:O,transform:C,params:k,queryPadding:this.queryPadding*z},r,a,p):{}}querySourceFeatures(r,a){const p=this.latestFeatureIndex;if(!p||!p.rawTileData)return;const f=p.loadVTLayers(),_=a&&a.sourceLayer?a.sourceLayer:"",S=f._geojsonTileLayer||f[_];if(!S)return;const k=c.a7(a&&a.filter),{z:C,x:z,y:O}=this.tileID.canonical,B={z:C,x:z,y:O};for(let K=0;Kp)f=!1;else if(a)if(this.expirationTime{this.remove(r,_)},p)),this.data[f].push(_),this.order.push(f),this.order.length>this.max){const S=this._getAndRemoveByKey(this.order[0]);S&&this.onRemove(S)}return this}has(r){return r.wrapped().key in this.data}getAndRemove(r){return this.has(r)?this._getAndRemoveByKey(r.wrapped().key):null}_getAndRemoveByKey(r){const a=this.data[r].shift();return a.timeout&&clearTimeout(a.timeout),this.data[r].length===0&&delete this.data[r],this.order.splice(this.order.indexOf(r),1),a.value}getByKey(r){const a=this.data[r];return a?a[0].value:null}get(r){return this.has(r)?this.data[r.wrapped().key][0].value:null}remove(r,a){if(!this.has(r))return this;const p=r.wrapped().key,f=a===void 0?0:this.data[p].indexOf(a),_=this.data[p][f];return this.data[p].splice(f,1),_.timeout&&clearTimeout(_.timeout),this.data[p].length===0&&delete this.data[p],this.onRemove(_.value),this.order.splice(this.order.indexOf(p),1),this}setMaxSize(r){for(this.max=r;this.order.length>this.max;){const a=this._getAndRemoveByKey(this.order[0]);a&&this.onRemove(a)}return this}filter(r){const a=[];for(const p in this.data)for(const f of this.data[p])r(f.value)||a.push(f);for(const p of a)this.remove(p.value.tileID,p)}}class Wt{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(r,a,p){const f=String(a);if(this.stateChanges[r]=this.stateChanges[r]||{},this.stateChanges[r][f]=this.stateChanges[r][f]||{},c.e(this.stateChanges[r][f],p),this.deletedStates[r]===null){this.deletedStates[r]={};for(const _ in this.state[r])_!==f&&(this.deletedStates[r][_]=null)}else if(this.deletedStates[r]&&this.deletedStates[r][f]===null){this.deletedStates[r][f]={};for(const _ in this.state[r][f])p[_]||(this.deletedStates[r][f][_]=null)}else for(const _ in p)this.deletedStates[r]&&this.deletedStates[r][f]&&this.deletedStates[r][f][_]===null&&delete this.deletedStates[r][f][_]}removeFeatureState(r,a,p){if(this.deletedStates[r]===null)return;const f=String(a);if(this.deletedStates[r]=this.deletedStates[r]||{},p&&a!==void 0)this.deletedStates[r][f]!==null&&(this.deletedStates[r][f]=this.deletedStates[r][f]||{},this.deletedStates[r][f][p]=null);else if(a!==void 0)if(this.stateChanges[r]&&this.stateChanges[r][f])for(p in this.deletedStates[r][f]={},this.stateChanges[r][f])this.deletedStates[r][f][p]=null;else this.deletedStates[r][f]=null;else this.deletedStates[r]=null}getState(r,a){const p=String(a),f=c.e({},(this.state[r]||{})[p],(this.stateChanges[r]||{})[p]);if(this.deletedStates[r]===null)return{};if(this.deletedStates[r]){const _=this.deletedStates[r][a];if(_===null)return{};for(const S in _)delete f[S]}return f}initializeTileState(r,a){r.setFeatureState(this.state,a)}coalesceChanges(r,a){const p={};for(const f in this.stateChanges){this.state[f]=this.state[f]||{};const _={};for(const S in this.stateChanges[f])this.state[f][S]||(this.state[f][S]={}),c.e(this.state[f][S],this.stateChanges[f][S]),_[S]=this.state[f][S];p[f]=_}for(const f in this.deletedStates){this.state[f]=this.state[f]||{};const _={};if(this.deletedStates[f]===null)for(const S in this.state[f])_[S]={},this.state[f][S]={};else for(const S in this.deletedStates[f]){if(this.deletedStates[f][S]===null)this.state[f][S]={};else for(const k of Object.keys(this.deletedStates[f][S]))delete this.state[f][S][k];_[S]=this.state[f][S]}p[f]=p[f]||{},c.e(p[f],_)}if(this.stateChanges={},this.deletedStates={},Object.keys(p).length!==0)for(const f in r)r[f].setFeatureState(p,a)}}class Bt extends c.E{constructor(r,a,p){super(),this.id=r,this.dispatcher=p,this.on("data",f=>this._dataHandler(f)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((f,_,S,k)=>{const C=new(vr(_.type))(f,_,S,k);if(C.id!==f)throw new Error(`Expected Source id to be ${f} instead of ${C.id}`);return C})(r,a,p,this),this._tiles={},this._cache=new Qe(0,f=>this._unloadTile(f)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Wt,this._didEmitContent=!1,this._updated=!1}onAdd(r){this.map=r,this._maxTileCacheSize=r?r._maxTileCacheSize:null,this._maxTileCacheZoomLevels=r?r._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(r)}onRemove(r){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(r)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(this.used===void 0&&this.usedForTerrain===void 0||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(const r in this._tiles){const a=this._tiles[r];if(a.state!=="loaded"&&a.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const r=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,r&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(r,a,p){return c._(this,void 0,void 0,function*(){try{yield this._source.loadTile(r),this._tileLoaded(r,a,p)}catch(f){r.state="errored",f.status!==404?this._source.fire(new c.j(f,{tile:r})):this.update(this.transform,this.terrain)}})}_unloadTile(r){this._source.unloadTile&&this._source.unloadTile(r)}_abortTile(r){this._source.abortTile&&this._source.abortTile(r),this._source.fire(new c.k("dataabort",{tile:r,coord:r.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(r){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const a in this._tiles){const p=this._tiles[a];p.upload(r),p.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(r=>r.tileID).sort(jr).map(r=>r.key)}getRenderableIds(r){const a=[];for(const p in this._tiles)this._isIdRenderable(p,r)&&a.push(this._tiles[p]);return r?a.sort((p,f)=>{const _=p.tileID,S=f.tileID,k=new c.P(_.canonical.x,_.canonical.y)._rotate(this.transform.angle),C=new c.P(S.canonical.x,S.canonical.y)._rotate(this.transform.angle);return _.overscaledZ-S.overscaledZ||C.y-k.y||C.x-k.x}).map(p=>p.tileID.key):a.map(p=>p.tileID).sort(jr).map(p=>p.key)}hasRenderableParent(r){const a=this.findLoadedParent(r,0);return!!a&&this._isIdRenderable(a.tileID.key)}_isIdRenderable(r,a){return this._tiles[r]&&this._tiles[r].hasData()&&!this._coveredTiles[r]&&(a||!this._tiles[r].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const r in this._tiles)this._tiles[r].state!=="errored"&&this._reloadTile(r,"reloading")}}_reloadTile(r,a){return c._(this,void 0,void 0,function*(){const p=this._tiles[r];p&&(p.state!=="loading"&&(p.state=a),yield this._loadTile(p,r,a))})}_tileLoaded(r,a,p){r.timeAdded=D.now(),p==="expired"&&(r.refreshedUponExpiration=!0),this._setTileReloadTimer(a,r),this.getSource().type==="raster-dem"&&r.dem&&this._backfillDEM(r),this._state.initializeTileState(r,this.map?this.map.painter:null),r.aborted||this._source.fire(new c.k("data",{dataType:"source",tile:r,coord:r.tileID}))}_backfillDEM(r){const a=this.getRenderableIds();for(let f=0;f1||(Math.abs(S)>1&&(Math.abs(S+C)===1?S+=C:Math.abs(S-C)===1&&(S-=C)),_.dem&&f.dem&&(f.dem.backfillBorder(_.dem,S,k),f.neighboringTiles&&f.neighboringTiles[z]&&(f.neighboringTiles[z].backfilled=!0)))}}getTile(r){return this.getTileByID(r.key)}getTileByID(r){return this._tiles[r]}_retainLoadedChildren(r,a,p,f){for(const _ in this._tiles){let S=this._tiles[_];if(f[_]||!S.hasData()||S.tileID.overscaledZ<=a||S.tileID.overscaledZ>p)continue;let k=S.tileID;for(;S&&S.tileID.overscaledZ>a+1;){const z=S.tileID.scaledTo(S.tileID.overscaledZ-1);S=this._tiles[z.key],S&&S.hasData()&&(k=z)}let C=k;for(;C.overscaledZ>a;)if(C=C.scaledTo(C.overscaledZ-1),r[C.key]){f[k.key]=k;break}}}findLoadedParent(r,a){if(r.key in this._loadedParentTiles){const p=this._loadedParentTiles[r.key];return p&&p.tileID.overscaledZ>=a?p:null}for(let p=r.overscaledZ-1;p>=a;p--){const f=r.scaledTo(p),_=this._getLoadedTile(f);if(_)return _}}findLoadedSibling(r){return this._getLoadedTile(r)}_getLoadedTile(r){const a=this._tiles[r.key];return a&&a.hasData()?a:this._cache.getByKey(r.wrapped().key)}updateCacheSize(r){const a=Math.ceil(r.width/this._source.tileSize)+1,p=Math.ceil(r.height/this._source.tileSize)+1,f=Math.floor(a*p*(this._maxTileCacheZoomLevels===null?c.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),_=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,f):f;this._cache.setMaxSize(_)}handleWrapJump(r){const a=Math.round((r-(this._prevLng===void 0?r:this._prevLng))/360);if(this._prevLng=r,a){const p={};for(const f in this._tiles){const _=this._tiles[f];_.tileID=_.tileID.unwrapTo(_.tileID.wrap+a),p[_.tileID.key]=_}this._tiles=p;for(const f in this._timers)clearTimeout(this._timers[f]),delete this._timers[f];for(const f in this._tiles)this._setTileReloadTimer(f,this._tiles[f])}}_updateCoveredAndRetainedTiles(r,a,p,f,_,S){const k={},C={},z=Object.keys(r),O=D.now();for(const B of z){const K=r[B],Q=this._tiles[B];if(!Q||Q.fadeEndTime!==0&&Q.fadeEndTime<=O)continue;const re=this.findLoadedParent(K,a),ce=this.findLoadedSibling(K),fe=re||ce||null;fe&&(this._addTile(fe.tileID),k[fe.tileID.key]=fe.tileID),C[B]=K}this._retainLoadedChildren(C,f,p,r);for(const B in k)r[B]||(this._coveredTiles[B]=!0,r[B]=k[B]);if(S){const B={},K={};for(const Q of _)this._tiles[Q.key].hasData()?B[Q.key]=Q:K[Q.key]=Q;for(const Q in K){const re=K[Q].children(this._source.maxzoom);this._tiles[re[0].key]&&this._tiles[re[1].key]&&this._tiles[re[2].key]&&this._tiles[re[3].key]&&(B[re[0].key]=r[re[0].key]=re[0],B[re[1].key]=r[re[1].key]=re[1],B[re[2].key]=r[re[2].key]=re[2],B[re[3].key]=r[re[3].key]=re[3],delete K[Q])}for(const Q in K){const re=K[Q],ce=this.findLoadedParent(re,this._source.minzoom),fe=this.findLoadedSibling(re),me=ce||fe||null;if(me){B[me.tileID.key]=r[me.tileID.key]=me.tileID;for(const we in B)B[we].isChildOf(me.tileID)&&delete B[we]}}for(const Q in this._tiles)B[Q]||(this._coveredTiles[Q]=!0)}}update(r,a){if(!this._sourceLoaded||this._paused)return;let p;this.transform=r,this.terrain=a,this.updateCacheSize(r),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?p=r.getVisibleUnwrappedCoordinates(this._source.tileID).map(O=>new c.S(O.canonical.z,O.wrap,O.canonical.z,O.canonical.x,O.canonical.y)):(p=r.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:a}),this._source.hasTile&&(p=p.filter(O=>this._source.hasTile(O)))):p=[];const f=r.coveringZoomLevel(this._source),_=Math.max(f-Bt.maxOverzooming,this._source.minzoom),S=Math.max(f+Bt.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const O={};for(const B of p)if(B.canonical.z>this._source.minzoom){const K=B.scaledTo(B.canonical.z-1);O[K.key]=K;const Q=B.scaledTo(Math.max(this._source.minzoom,Math.min(B.canonical.z,5)));O[Q.key]=Q}p=p.concat(Object.values(O))}const k=p.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,k&&this.fire(new c.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const C=this._updateRetainedTiles(p,f);ei(this._source.type)&&this._updateCoveredAndRetainedTiles(C,_,S,f,p,a);for(const O in C)this._tiles[O].clearFadeHold();const z=c.ab(this._tiles,C);for(const O of z){const B=this._tiles[O];B.hasSymbolBuckets&&!B.holdingForFade()?B.setHoldDuration(this.map._fadeDuration):B.hasSymbolBuckets&&!B.symbolFadeFinished()||this._removeTile(O)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(const r in this._tiles)this._tiles[r].holdingForFade()&&this._removeTile(r)}_updateRetainedTiles(r,a){var p;const f={},_={},S=Math.max(a-Bt.maxOverzooming,this._source.minzoom),k=Math.max(a+Bt.maxUnderzooming,this._source.minzoom),C={};for(const z of r){const O=this._addTile(z);f[z.key]=z,O.hasData()||athis._source.maxzoom){const K=z.children(this._source.maxzoom)[0],Q=this.getTile(K);if(Q&&Q.hasData()){f[K.key]=K;continue}}else{const K=z.children(this._source.maxzoom);if(f[K[0].key]&&f[K[1].key]&&f[K[2].key]&&f[K[3].key])continue}let B=O.wasRequested();for(let K=z.overscaledZ-1;K>=S;--K){const Q=z.scaledTo(K);if(_[Q.key])break;if(_[Q.key]=!0,O=this.getTile(Q),!O&&B&&(O=this._addTile(Q)),O){const re=O.hasData();if((re||!(!((p=this.map)===null||p===void 0)&&p.cancelPendingTileRequestsWhileZooming)||B)&&(f[Q.key]=Q),B=O.wasRequested(),re)break}}}return f}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const r in this._tiles){const a=[];let p,f=this._tiles[r].tileID;for(;f.overscaledZ>0;){if(f.key in this._loadedParentTiles){p=this._loadedParentTiles[f.key];break}a.push(f.key);const _=f.scaledTo(f.overscaledZ-1);if(p=this._getLoadedTile(_),p)break;f=_}for(const _ of a)this._loadedParentTiles[_]=p}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(const r in this._tiles){const a=this._tiles[r].tileID,p=this._getLoadedTile(a);this._loadedSiblingTiles[a.key]=p}}_addTile(r){let a=this._tiles[r.key];if(a)return a;a=this._cache.getAndRemove(r),a&&(this._setTileReloadTimer(r.key,a),a.tileID=r,this._state.initializeTileState(a,this.map?this.map.painter:null),this._cacheTimers[r.key]&&(clearTimeout(this._cacheTimers[r.key]),delete this._cacheTimers[r.key],this._setTileReloadTimer(r.key,a)));const p=a;return a||(a=new Qn(r,this._source.tileSize*r.overscaleFactor()),this._loadTile(a,r.key,a.state)),a.uses++,this._tiles[r.key]=a,p||this._source.fire(new c.k("dataloading",{tile:a,coord:a.tileID,dataType:"source"})),a}_setTileReloadTimer(r,a){r in this._timers&&(clearTimeout(this._timers[r]),delete this._timers[r]);const p=a.getExpiryTimeout();p&&(this._timers[r]=setTimeout(()=>{this._reloadTile(r,"expired"),delete this._timers[r]},p))}_removeTile(r){const a=this._tiles[r];a&&(a.uses--,delete this._tiles[r],this._timers[r]&&(clearTimeout(this._timers[r]),delete this._timers[r]),a.uses>0||(a.hasData()&&a.state!=="reloading"?this._cache.add(a.tileID,a,a.getExpiryTimeout()):(a.aborted=!0,this._abortTile(a),this._unloadTile(a))))}_dataHandler(r){const a=r.sourceDataType;r.dataType==="source"&&a==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&r.dataType==="source"&&a==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const r in this._tiles)this._removeTile(r);this._cache.reset()}tilesIn(r,a,p){const f=[],_=this.transform;if(!_)return f;const S=p?_.getCameraQueryGeometry(r):r,k=r.map(re=>_.pointCoordinate(re,this.terrain)),C=S.map(re=>_.pointCoordinate(re,this.terrain)),z=this.getIds();let O=1/0,B=1/0,K=-1/0,Q=-1/0;for(const re of C)O=Math.min(O,re.x),B=Math.min(B,re.y),K=Math.max(K,re.x),Q=Math.max(Q,re.y);for(let re=0;re=0&&ae[1].y+we>=0){const Ce=k.map(De=>fe.getTilePoint(De)),Pe=C.map(De=>fe.getTilePoint(De));f.push({tile:ce,tileID:fe,queryGeometry:Ce,cameraQueryGeometry:Pe,scale:me})}}return f}getVisibleCoordinates(r){const a=this.getRenderableIds(r).map(p=>this._tiles[p].tileID);for(const p of a)p.posMatrix=this.transform.calculatePosMatrix(p.toUnwrapped());return a}hasTransition(){if(this._source.hasTransition())return!0;if(ei(this._source.type)){const r=D.now();for(const a in this._tiles)if(this._tiles[a].fadeEndTime>=r)return!0}return!1}setFeatureState(r,a,p){this._state.updateState(r=r||"_geojsonTileLayer",a,p)}removeFeatureState(r,a,p){this._state.removeFeatureState(r=r||"_geojsonTileLayer",a,p)}getFeatureState(r,a){return this._state.getState(r=r||"_geojsonTileLayer",a)}setDependencies(r,a,p){const f=this._tiles[r];f&&f.setDependencies(a,p)}reloadTilesForDependencies(r,a){for(const p in this._tiles)this._tiles[p].hasDependency(r,a)&&this._reloadTile(p,"reloading");this._cache.filter(p=>!p.hasDependency(r,a))}}function jr(v,r){const a=Math.abs(2*v.wrap)-+(v.wrap<0),p=Math.abs(2*r.wrap)-+(r.wrap<0);return v.overscaledZ-r.overscaledZ||p-a||r.canonical.y-v.canonical.y||r.canonical.x-v.canonical.x}function ei(v){return v==="raster"||v==="image"||v==="video"}Bt.maxOverzooming=10,Bt.maxUnderzooming=3;class Zt{constructor(r,a){this.reset(r,a)}reset(r,a){this.points=r||[],this._distances=[0];for(let p=1;p0?(f-S)/k:0;return this.points[_].mult(1-C).add(this.points[a].mult(C))}}function Di(v,r){let a=!0;return v==="always"||v!=="never"&&r!=="never"||(a=!1),a}class Ki{constructor(r,a,p){const f=this.boxCells=[],_=this.circleCells=[];this.xCellCount=Math.ceil(r/p),this.yCellCount=Math.ceil(a/p);for(let S=0;Sthis.width||f<0||a>this.height)return[];const C=[];if(r<=0&&a<=0&&this.width<=p&&this.height<=f){if(_)return[{key:null,x1:r,y1:a,x2:p,y2:f}];for(let z=0;z0}hitTestCircle(r,a,p,f,_){const S=r-p,k=r+p,C=a-p,z=a+p;if(k<0||S>this.width||z<0||C>this.height)return!1;const O=[];return this._forEachCell(S,C,k,z,this._queryCellCircle,O,{hitTest:!0,overlapMode:f,circle:{x:r,y:a,radius:p},seenUids:{box:{},circle:{}}},_),O.length>0}_queryCell(r,a,p,f,_,S,k,C){const{seenUids:z,hitTest:O,overlapMode:B}=k,K=this.boxCells[_];if(K!==null){const re=this.bboxes;for(const ce of K)if(!z.box[ce]){z.box[ce]=!0;const fe=4*ce,me=this.boxKeys[ce];if(r<=re[fe+2]&&a<=re[fe+3]&&p>=re[fe+0]&&f>=re[fe+1]&&(!C||C(me))&&(!O||!Di(B,me.overlapMode))&&(S.push({key:me,x1:re[fe],y1:re[fe+1],x2:re[fe+2],y2:re[fe+3]}),O))return!0}}const Q=this.circleCells[_];if(Q!==null){const re=this.circles;for(const ce of Q)if(!z.circle[ce]){z.circle[ce]=!0;const fe=3*ce,me=this.circleKeys[ce];if(this._circleAndRectCollide(re[fe],re[fe+1],re[fe+2],r,a,p,f)&&(!C||C(me))&&(!O||!Di(B,me.overlapMode))){const we=re[fe],ae=re[fe+1],Ce=re[fe+2];if(S.push({key:me,x1:we-Ce,y1:ae-Ce,x2:we+Ce,y2:ae+Ce}),O)return!0}}}return!1}_queryCellCircle(r,a,p,f,_,S,k,C){const{circle:z,seenUids:O,overlapMode:B}=k,K=this.boxCells[_];if(K!==null){const re=this.bboxes;for(const ce of K)if(!O.box[ce]){O.box[ce]=!0;const fe=4*ce,me=this.boxKeys[ce];if(this._circleAndRectCollide(z.x,z.y,z.radius,re[fe+0],re[fe+1],re[fe+2],re[fe+3])&&(!C||C(me))&&!Di(B,me.overlapMode))return S.push(!0),!0}}const Q=this.circleCells[_];if(Q!==null){const re=this.circles;for(const ce of Q)if(!O.circle[ce]){O.circle[ce]=!0;const fe=3*ce,me=this.circleKeys[ce];if(this._circlesCollide(re[fe],re[fe+1],re[fe+2],z.x,z.y,z.radius)&&(!C||C(me))&&!Di(B,me.overlapMode))return S.push(!0),!0}}}_forEachCell(r,a,p,f,_,S,k,C){const z=this._convertToXCellCoord(r),O=this._convertToYCellCoord(a),B=this._convertToXCellCoord(p),K=this._convertToYCellCoord(f);for(let Q=z;Q<=B;Q++)for(let re=O;re<=K;re++)if(_.call(this,r,a,p,f,this.xCellCount*re+Q,S,k,C))return}_convertToXCellCoord(r){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(r*this.xScale)))}_convertToYCellCoord(r){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(r*this.yScale)))}_circlesCollide(r,a,p,f,_,S){const k=f-r,C=_-a,z=p+S;return z*z>k*k+C*C}_circleAndRectCollide(r,a,p,f,_,S,k){const C=(S-f)/2,z=Math.abs(r-(f+C));if(z>C+p)return!1;const O=(k-_)/2,B=Math.abs(a-(_+O));if(B>O+p)return!1;if(z<=C||B<=O)return!0;const K=z-C,Q=B-O;return K*K+Q*Q<=p*p}}function Yi(v,r,a,p,f){const _=c.H();return r?(c.K(_,_,[1/f,1/f,1]),a||c.ad(_,_,p.angle)):c.L(_,p.labelPlaneMatrix,v),_}function Pn(v,r,a,p,f){if(r){const _=c.ae(v);return c.K(_,_,[f,f,1]),a||c.ad(_,_,-p.angle),_}return p.glCoordMatrix}function he(v,r,a,p){let f;p?(f=[v,r,p(v,r),1],c.af(f,f,a)):(f=[v,r,0,1],cr(f,f,a));const _=f[3];return{point:new c.P(f[0]/_,f[1]/_),signedDistanceFromCamera:_,isOccluded:!1}}function Z(v,r){return .5+v/r*.5}function G(v,r){return v.x>=-r[0]&&v.x<=r[0]&&v.y>=-r[1]&&v.y<=r[1]}function ee(v,r,a,p,f,_,S,k,C,z,O,B,K,Q,re){const ce=p?v.textSizeData:v.iconSizeData,fe=c.ag(ce,a.transform.zoom),me=[256/a.width*2+1,256/a.height*2+1],we=p?v.text.dynamicLayoutVertexArray:v.icon.dynamicLayoutVertexArray;we.clear();const ae=v.lineVertexArray,Ce=p?v.text.placedSymbolArray:v.icon.placedSymbolArray,Pe=a.transform.width/a.transform.height;let De=!1;for(let Xe=0;XeMath.abs(a.x-r.x)*p?{useVertical:!0}:(v===c.ah.vertical?r.ya.x)?{needsFlipping:!0}:null}function Ie(v,r,a,p,f,_,S,k,C,z,O){const B=a/24,K=r.lineOffsetX*B,Q=r.lineOffsetY*B;let re;if(r.numGlyphs>1){const ce=r.glyphStartIndex+r.numGlyphs,fe=r.lineStartIndex,me=r.lineStartIndex+r.lineLength,we=ue(B,k,K,Q,p,r,O,v);if(!we)return{notEnoughRoom:!0};const ae=he(we.first.point.x,we.first.point.y,S,v.getElevation).point,Ce=he(we.last.point.x,we.last.point.y,S,v.getElevation).point;if(f&&!p){const Pe=Se(r.writingMode,ae,Ce,z);if(Pe)return Pe}re=[we.first];for(let Pe=r.glyphStartIndex+1;Pe0?ae.point:function(De,Xe,ot,mt,xt,ht){return Me(De,Xe,ot,1,xt,ht)}(v.tileAnchorPoint,we,fe,0,_,v),Pe=Se(r.writingMode,fe,Ce,z);if(Pe)return Pe}const ce=ut(B*k.getoffsetX(r.glyphStartIndex),K,Q,p,r.segment,r.lineStartIndex,r.lineStartIndex+r.lineLength,v,O);if(!ce||v.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};re=[ce]}for(const ce of re)c.aj(C,ce.point,ce.angle);return{}}function Me(v,r,a,p,f,_){const S=v.add(v.sub(r)._unit()),k=f!==void 0?he(S.x,S.y,f,_.getElevation).point:He(S.x,S.y,_).point,C=a.sub(k);return a.add(C._mult(p/C.mag()))}function _e(v,r,a){const p=r.projectionCache;if(p.projections[v])return p.projections[v];const f=new c.P(r.lineVertexArray.getx(v),r.lineVertexArray.gety(v)),_=He(f.x,f.y,r);if(_.signedDistanceFromCamera>0)return p.projections[v]=_.point,p.anyProjectionOccluded=p.anyProjectionOccluded||_.isOccluded,_.point;const S=v-a.direction;return function(k,C,z,O,B){return Me(k,C,z,O,void 0,B)}(a.distanceFromAnchor===0?r.tileAnchorPoint:new c.P(r.lineVertexArray.getx(S),r.lineVertexArray.gety(S)),f,a.previousVertex,a.absOffsetX-a.distanceFromAnchor+1,r)}function He(v,r,a){const p=v+a.translation[0],f=r+a.translation[1];let _;return!a.pitchWithMap&&a.projection.useSpecialProjectionForSymbols?(_=a.projection.projectTileCoordinates(p,f,a.unwrappedTileID,a.getElevation),_.point.x=(.5*_.point.x+.5)*a.width,_.point.y=(.5*-_.point.y+.5)*a.height):(_=he(p,f,a.labelPlaneMatrix,a.getElevation),_.isOccluded=!1),_}function Je(v,r,a){return v._unit()._perp()._mult(r*a)}function $e(v,r,a,p,f,_,S,k,C){if(k.projectionCache.offsets[v])return k.projectionCache.offsets[v];const z=a.add(r);if(v+C.direction=f)return k.projectionCache.offsets[v]=z,z;const O=_e(v+C.direction,k,C),B=Je(O.sub(a),S,C.direction),K=a.add(B),Q=O.add(B);return k.projectionCache.offsets[v]=c.ak(_,z,K,Q)||z,k.projectionCache.offsets[v]}function ut(v,r,a,p,f,_,S,k,C){const z=p?v-r:v+r;let O=z>0?1:-1,B=0;p&&(O*=-1,B=Math.PI),O<0&&(B+=Math.PI);let K,Q=O>0?_+f:_+f+1;k.projectionCache.cachedAnchorPoint?K=k.projectionCache.cachedAnchorPoint:(K=He(k.tileAnchorPoint.x,k.tileAnchorPoint.y,k).point,k.projectionCache.cachedAnchorPoint=K);let re,ce,fe=K,me=K,we=0,ae=0;const Ce=Math.abs(z),Pe=[];let De;for(;we+ae<=Ce;){if(Q+=O,Q<_||Q>=S)return null;we+=ae,me=fe,ce=re;const mt={absOffsetX:Ce,direction:O,distanceFromAnchor:we,previousVertex:me};if(fe=_e(Q,k,mt),a===0)Pe.push(me),De=fe.sub(me);else{let xt;const ht=fe.sub(me);xt=ht.mag()===0?Je(_e(Q+O,k,mt).sub(fe),a,O):Je(ht,a,O),ce||(ce=me.add(xt)),re=$e(Q,xt,fe,_,S,ce,a,k,mt),Pe.push(ce),De=re.sub(ce)}ae=De.mag()}const Xe=De._mult((Ce-we)/ae)._add(ce||me),ot=B+Math.atan2(fe.y-me.y,fe.x-me.x);return Pe.push(Xe),{point:Xe,angle:C?ot:0,path:Pe}}const Mt=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Dt(v,r){for(let a=0;a=1;Yt--)yt.push(Ht.path[Yt]);for(let Yt=1;Ytnr.signedDistanceFromCamera<=0)?[]:Yt.map(nr=>nr.point)}let Lr=[];if(yt.length>0){const Yt=yt[0].clone(),nr=yt[0].clone();for(let Fr=1;Fr=ht.x&&nr.x<=ct.x&&Yt.y>=ht.y&&nr.y<=ct.y?[yt]:nr.xct.x||nr.yct.y?[]:c.al([yt],ht.x,ht.y,ct.x,ct.y)}for(const Yt of Lr){Ct.reset(Yt,.25*xt);let nr=0;nr=Ct.length<=.5*xt?1:Math.ceil(Ct.paddedLength/Ut)+1;for(let Fr=0;Frhe(f.x,f.y,p,a.getElevation))}queryRenderedSymbols(r){if(r.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const a=[];let p=1/0,f=1/0,_=-1/0,S=-1/0;for(const O of r){const B=new c.P(O.x+Xt,O.y+Xt);p=Math.min(p,B.x),f=Math.min(f,B.y),_=Math.max(_,B.x),S=Math.max(S,B.y),a.push(B)}const k=this.grid.query(p,f,_,S).concat(this.ignoredGrid.query(p,f,_,S)),C={},z={};for(const O of k){const B=O.key;if(C[B.bucketInstanceId]===void 0&&(C[B.bucketInstanceId]={}),C[B.bucketInstanceId][B.featureIndex])continue;const K=[new c.P(O.x1,O.y1),new c.P(O.x2,O.y1),new c.P(O.x2,O.y2),new c.P(O.x1,O.y2)];c.am(a,K)&&(C[B.bucketInstanceId][B.featureIndex]=!0,z[B.bucketInstanceId]===void 0&&(z[B.bucketInstanceId]=[]),z[B.bucketInstanceId].push(B.featureIndex))}return z}insertCollisionBox(r,a,p,f,_,S){(p?this.ignoredGrid:this.grid).insert({bucketInstanceId:f,featureIndex:_,collisionGroupID:S,overlapMode:a},r[0],r[1],r[2],r[3])}insertCollisionCircles(r,a,p,f,_,S){const k=p?this.ignoredGrid:this.grid,C={bucketInstanceId:f,featureIndex:_,collisionGroupID:S,overlapMode:a};for(let z=0;z=this.screenRightBoundary||fthis.screenBottomBoundary}isInsideGrid(r,a,p,f){return p>=0&&r=0&&athis.projectAndGetPerspectiveRatio(p,xt.x,xt.y,f,z));ot=mt.some(xt=>!xt.isOccluded),Xe=mt.map(xt=>xt.point)}else ot=!0;return{box:c.ao(Xe),allPointsOccluded:!ot}}}function rr(v,r,a){return r*(c.X/(v.tileSize*Math.pow(2,a-v.tileID.overscaledZ)))}class dn{constructor(r,a,p,f){this.opacity=r?Math.max(0,Math.min(1,r.opacity+(r.placed?a:-a))):f&&p?1:0,this.placed=p}isHidden(){return this.opacity===0&&!this.placed}}class Zr{constructor(r,a,p,f,_){this.text=new dn(r?r.text:null,a,p,_),this.icon=new dn(r?r.icon:null,a,f,_)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Jt{constructor(r,a,p){this.text=r,this.icon=a,this.skipFade=p}}class Sr{constructor(){this.invProjMatrix=c.H(),this.viewportMatrix=c.H(),this.circles=[]}}class Nr{constructor(r,a,p,f,_){this.bucketInstanceId=r,this.featureIndex=a,this.sourceLayerIndex=p,this.bucketIndex=f,this.tileID=_}}class _n{constructor(r){this.crossSourceCollisions=r,this.maxGroupID=0,this.collisionGroups={}}get(r){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[r]){const a=++this.maxGroupID;this.collisionGroups[r]={ID:a,predicate:p=>p.collisionGroupID===a}}return this.collisionGroups[r]}}function En(v,r,a,p,f){const{horizontalAlign:_,verticalAlign:S}=c.au(v);return new c.P(-(_-.5)*r+p[0]*f,-(S-.5)*a+p[1]*f)}class Un{constructor(r,a,p,f,_,S){this.transform=r.clone(),this.terrain=p,this.collisionIndex=new hr(this.transform,a),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=f,this.retainedQueryData={},this.collisionGroups=new _n(_),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=S,S&&(S.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(r){const a=this.terrain;return a?(p,f)=>a.getElevation(r,p,f):null}getBucketParts(r,a,p,f){const _=p.getBucket(a),S=p.latestFeatureIndex;if(!_||!S||a.id!==_.layerIds[0])return;const k=p.collisionBoxArray,C=_.layers[0].layout,z=_.layers[0].paint,O=Math.pow(2,this.transform.zoom-p.tileID.overscaledZ),B=p.tileSize/c.X,K=p.tileID.toUnwrapped(),Q=this.transform.calculatePosMatrix(K),re=C.get("text-pitch-alignment")==="map",ce=C.get("text-rotation-alignment")==="map",fe=rr(p,1,this.transform.zoom),me=this.collisionIndex.mapProjection.translatePosition(this.transform,p,z.get("text-translate"),z.get("text-translate-anchor")),we=this.collisionIndex.mapProjection.translatePosition(this.transform,p,z.get("icon-translate"),z.get("icon-translate-anchor")),ae=Yi(Q,re,ce,this.transform,fe);let Ce=null;if(re){const De=Pn(Q,re,ce,this.transform,fe);Ce=c.L([],this.transform.labelPlaneMatrix,De)}this.retainedQueryData[_.bucketInstanceId]=new Nr(_.bucketInstanceId,S,_.sourceLayerIndex,_.index,p.tileID);const Pe={bucket:_,layout:C,translationText:me,translationIcon:we,posMatrix:Q,unwrappedTileID:K,textLabelPlaneMatrix:ae,labelToScreenMatrix:Ce,scale:O,textPixelRatio:B,holdingForFade:p.holdingForFade(),collisionBoxArray:k,partiallyEvaluatedTextSize:c.ag(_.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(_.sourceID)};if(f)for(const De of _.sortKeyRanges){const{sortKey:Xe,symbolInstanceStart:ot,symbolInstanceEnd:mt}=De;r.push({sortKey:Xe,symbolInstanceStart:ot,symbolInstanceEnd:mt,parameters:Pe})}else r.push({symbolInstanceStart:0,symbolInstanceEnd:_.symbolInstances.length,parameters:Pe})}attemptAnchorPlacement(r,a,p,f,_,S,k,C,z,O,B,K,Q,re,ce,fe,me,we,ae){const Ce=c.aq[r.textAnchor],Pe=[r.textOffset0,r.textOffset1],De=En(Ce,p,f,Pe,_),Xe=this.collisionIndex.placeCollisionBox(a,K,C,z,O,k,S,fe,B.predicate,ae,De);if((!we||this.collisionIndex.placeCollisionBox(we,K,C,z,O,k,S,me,B.predicate,ae,De).placeable)&&Xe.placeable){let ot;if(this.prevPlacement&&this.prevPlacement.variableOffsets[Q.crossTileID]&&this.prevPlacement.placements[Q.crossTileID]&&this.prevPlacement.placements[Q.crossTileID].text&&(ot=this.prevPlacement.variableOffsets[Q.crossTileID].anchor),Q.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[Q.crossTileID]={textOffset:Pe,width:p,height:f,anchor:Ce,textBoxScale:_,prevAnchor:ot},this.markUsedJustification(re,Ce,Q,ce),re.allowVerticalPlacement&&(this.markUsedOrientation(re,ce,Q),this.placedOrientations[Q.crossTileID]=ce),{shift:De,placedGlyphBoxes:Xe}}}placeLayerBucketPart(r,a,p){const{bucket:f,layout:_,translationText:S,translationIcon:k,posMatrix:C,unwrappedTileID:z,textLabelPlaneMatrix:O,labelToScreenMatrix:B,textPixelRatio:K,holdingForFade:Q,collisionBoxArray:re,partiallyEvaluatedTextSize:ce,collisionGroup:fe}=r.parameters,me=_.get("text-optional"),we=_.get("icon-optional"),ae=c.ar(_,"text-overlap","text-allow-overlap"),Ce=ae==="always",Pe=c.ar(_,"icon-overlap","icon-allow-overlap"),De=Pe==="always",Xe=_.get("text-rotation-alignment")==="map",ot=_.get("text-pitch-alignment")==="map",mt=_.get("icon-text-fit")!=="none",xt=_.get("symbol-z-order")==="viewport-y",ht=Ce&&(De||!f.hasIconData()||we),ct=De&&(Ce||!f.hasTextData()||me);!f.collisionArrays&&re&&f.deserializeCollisionBoxes(re);const Ct=this._getTerrainElevationFunc(this.retainedQueryData[f.bucketInstanceId].tileID),Ht=(dt,yt,Ut)=>{var Lr,Yt;if(a[dt.crossTileID])return;if(Q)return void(this.placements[dt.crossTileID]=new Jt(!1,!1,!1));let nr=!1,Fr=!1,Mn=!0,no=null,Or={box:null,placeable:!1,offscreen:null},ni={box:null,placeable:!1,offscreen:null},Vn=null,zn=null,Hn=null,Io=0,wa=0,Bu=0;yt.textFeatureIndex?Io=yt.textFeatureIndex:dt.useRuntimeCollisionCircles&&(Io=dt.featureIndex),yt.verticalTextFeatureIndex&&(wa=yt.verticalTextFeatureIndex);const ba=yt.textBox;if(ba){const Ni=kn=>{let Dn=c.ah.horizontal;if(f.allowVerticalPlacement&&!kn&&this.prevPlacement){const vi=this.prevPlacement.placedOrientations[dt.crossTileID];vi&&(this.placedOrientations[dt.crossTileID]=vi,Dn=vi,this.markUsedOrientation(f,Dn,dt))}return Dn},$i=(kn,Dn)=>{if(f.allowVerticalPlacement&&dt.numVerticalGlyphVertices>0&&yt.verticalTextBox){for(const vi of f.writingModes)if(vi===c.ah.vertical?(Or=Dn(),ni=Or):Or=kn(),Or&&Or.placeable)break}else Or=kn()},ss=dt.textAnchorOffsetStartIndex,io=dt.textAnchorOffsetEndIndex;if(io===ss){const kn=(Dn,vi)=>{const or=this.collisionIndex.placeCollisionBox(Dn,ae,K,C,z,ot,Xe,S,fe.predicate,Ct);return or&&or.placeable&&(this.markUsedOrientation(f,vi,dt),this.placedOrientations[dt.crossTileID]=vi),or};$i(()=>kn(ba,c.ah.horizontal),()=>{const Dn=yt.verticalTextBox;return f.allowVerticalPlacement&&dt.numVerticalGlyphVertices>0&&Dn?kn(Dn,c.ah.vertical):{box:null,offscreen:null}}),Ni(Or&&Or.placeable)}else{let kn=c.aq[(Yt=(Lr=this.prevPlacement)===null||Lr===void 0?void 0:Lr.variableOffsets[dt.crossTileID])===null||Yt===void 0?void 0:Yt.anchor];const Dn=(or,Rs,Sa)=>{const Ea=or.x2-or.x1,Yp=or.y2-or.y1,by=dt.textBoxScale,Jp=mt&&Pe==="never"?Rs:null;let as=null,Qp=ae==="never"?1:2,$u="never";kn&&Qp++;for(let El=0;ElDn(ba,yt.iconBox,c.ah.horizontal),()=>{const or=yt.verticalTextBox;return f.allowVerticalPlacement&&(!Or||!Or.placeable)&&dt.numVerticalGlyphVertices>0&&or?Dn(or,yt.verticalIconBox,c.ah.vertical):{box:null,occluded:!0,offscreen:null}}),Or&&(nr=Or.placeable,Mn=Or.offscreen);const vi=Ni(Or&&Or.placeable);if(!nr&&this.prevPlacement){const or=this.prevPlacement.variableOffsets[dt.crossTileID];or&&(this.variableOffsets[dt.crossTileID]=or,this.markUsedJustification(f,or.anchor,dt,vi))}}}if(Vn=Or,nr=Vn&&Vn.placeable,Mn=Vn&&Vn.offscreen,dt.useRuntimeCollisionCircles){const Ni=f.text.placedSymbolArray.get(dt.centerJustifiedTextSymbolIndex),$i=c.ai(f.textSizeData,ce,Ni),ss=_.get("text-padding");zn=this.collisionIndex.placeCollisionCircles(ae,Ni,f.lineVertexArray,f.glyphOffsetArray,$i,C,z,O,B,p,ot,fe.predicate,dt.collisionCircleDiameter,ss,S,Ct),zn.circles.length&&zn.collisionDetected&&!p&&c.w("Collisions detected, but collision boxes are not shown"),nr=Ce||zn.circles.length>0&&!zn.collisionDetected,Mn=Mn&&zn.offscreen}if(yt.iconFeatureIndex&&(Bu=yt.iconFeatureIndex),yt.iconBox){const Ni=$i=>this.collisionIndex.placeCollisionBox($i,Pe,K,C,z,ot,Xe,k,fe.predicate,Ct,mt&&no?no:void 0);ni&&ni.placeable&&yt.verticalIconBox?(Hn=Ni(yt.verticalIconBox),Fr=Hn.placeable):(Hn=Ni(yt.iconBox),Fr=Hn.placeable),Mn=Mn&&Hn.offscreen}const Bi=me||dt.numHorizontalGlyphVertices===0&&dt.numVerticalGlyphVertices===0,Nu=we||dt.numIconVertices===0;Bi||Nu?Nu?Bi||(Fr=Fr&&nr):nr=Fr&&nr:Fr=nr=Fr&&nr;const Oh=Fr&&Hn.placeable;if(nr&&Vn.placeable&&this.collisionIndex.insertCollisionBox(Vn.box,ae,_.get("text-ignore-placement"),f.bucketInstanceId,ni&&ni.placeable&&wa?wa:Io,fe.ID),Oh&&this.collisionIndex.insertCollisionBox(Hn.box,Pe,_.get("icon-ignore-placement"),f.bucketInstanceId,Bu,fe.ID),zn&&nr&&this.collisionIndex.insertCollisionCircles(zn.circles,ae,_.get("text-ignore-placement"),f.bucketInstanceId,Io,fe.ID),p&&this.storeCollisionData(f.bucketInstanceId,Ut,yt,Vn,Hn,zn),dt.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(f.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[dt.crossTileID]=new Jt(nr||ht,Fr||ct,Mn||f.justReloaded),a[dt.crossTileID]=!0};if(xt){if(r.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const dt=f.getSortedSymbolIndexes(this.transform.angle);for(let yt=dt.length-1;yt>=0;--yt){const Ut=dt[yt];Ht(f.symbolInstances.get(Ut),f.collisionArrays[Ut],Ut)}}else for(let dt=r.symbolInstanceStart;dt=0&&(r.text.placedSymbolArray.get(k).crossTileID=_>=0&&k!==_?0:p.crossTileID)}markUsedOrientation(r,a,p){const f=a===c.ah.horizontal||a===c.ah.horizontalOnly?a:0,_=a===c.ah.vertical?a:0,S=[p.leftJustifiedTextSymbolIndex,p.centerJustifiedTextSymbolIndex,p.rightJustifiedTextSymbolIndex];for(const k of S)r.text.placedSymbolArray.get(k).placedOrientation=f;p.verticalPlacedTextSymbolIndex&&(r.text.placedSymbolArray.get(p.verticalPlacedTextSymbolIndex).placedOrientation=_)}commit(r){this.commitTime=r,this.zoomAtLastRecencyCheck=this.transform.zoom;const a=this.prevPlacement;let p=!1;this.prevZoomAdjustment=a?a.zoomAdjustment(this.transform.zoom):0;const f=a?a.symbolFadeChange(r):1,_=a?a.opacities:{},S=a?a.variableOffsets:{},k=a?a.placedOrientations:{};for(const C in this.placements){const z=this.placements[C],O=_[C];O?(this.opacities[C]=new Zr(O,f,z.text,z.icon),p=p||z.text!==O.text.placed||z.icon!==O.icon.placed):(this.opacities[C]=new Zr(null,f,z.text,z.icon,z.skipFade),p=p||z.text||z.icon)}for(const C in _){const z=_[C];if(!this.opacities[C]){const O=new Zr(z,f,!1,!1);O.isHidden()||(this.opacities[C]=O,p=p||z.text.placed||z.icon.placed)}}for(const C in S)this.variableOffsets[C]||!this.opacities[C]||this.opacities[C].isHidden()||(this.variableOffsets[C]=S[C]);for(const C in k)this.placedOrientations[C]||!this.opacities[C]||this.opacities[C].isHidden()||(this.placedOrientations[C]=k[C]);if(a&&a.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");p?this.lastPlacementChangeTime=r:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=a?a.lastPlacementChangeTime:r)}updateLayerOpacities(r,a){const p={};for(const f of a){const _=f.getBucket(r);_&&f.latestFeatureIndex&&r.id===_.layerIds[0]&&this.updateBucketOpacities(_,f.tileID,p,f.collisionBoxArray)}}updateBucketOpacities(r,a,p,f){r.hasTextData()&&(r.text.opacityVertexArray.clear(),r.text.hasVisibleVertices=!1),r.hasIconData()&&(r.icon.opacityVertexArray.clear(),r.icon.hasVisibleVertices=!1),r.hasIconCollisionBoxData()&&r.iconCollisionBox.collisionVertexArray.clear(),r.hasTextCollisionBoxData()&&r.textCollisionBox.collisionVertexArray.clear();const _=r.layers[0],S=_.layout,k=new Zr(null,0,!1,!1,!0),C=S.get("text-allow-overlap"),z=S.get("icon-allow-overlap"),O=_._unevaluatedLayout.hasValue("text-variable-anchor")||_._unevaluatedLayout.hasValue("text-variable-anchor-offset"),B=S.get("text-rotation-alignment")==="map",K=S.get("text-pitch-alignment")==="map",Q=S.get("icon-text-fit")!=="none",re=new Zr(null,0,C&&(z||!r.hasIconData()||S.get("icon-optional")),z&&(C||!r.hasTextData()||S.get("text-optional")),!0);!r.collisionArrays&&f&&(r.hasIconCollisionBoxData()||r.hasTextCollisionBoxData())&&r.deserializeCollisionBoxes(f);const ce=(me,we,ae)=>{for(let Ce=0;Ce0,ot=this.placedOrientations[we.crossTileID],mt=ot===c.ah.vertical,xt=ot===c.ah.horizontal||ot===c.ah.horizontalOnly;if(ae>0||Ce>0){const ct=gi(De.text);ce(r.text,ae,mt?ea:ct),ce(r.text,Ce,xt?ea:ct);const Ct=De.text.isHidden();[we.rightJustifiedTextSymbolIndex,we.centerJustifiedTextSymbolIndex,we.leftJustifiedTextSymbolIndex].forEach(yt=>{yt>=0&&(r.text.placedSymbolArray.get(yt).hidden=Ct||mt?1:0)}),we.verticalPlacedTextSymbolIndex>=0&&(r.text.placedSymbolArray.get(we.verticalPlacedTextSymbolIndex).hidden=Ct||xt?1:0);const Ht=this.variableOffsets[we.crossTileID];Ht&&this.markUsedJustification(r,Ht.anchor,we,ot);const dt=this.placedOrientations[we.crossTileID];dt&&(this.markUsedJustification(r,"left",we,dt),this.markUsedOrientation(r,dt,we))}if(Xe){const ct=gi(De.icon),Ct=!(Q&&we.verticalPlacedIconSymbolIndex&&mt);we.placedIconSymbolIndex>=0&&(ce(r.icon,we.numIconVertices,Ct?ct:ea),r.icon.placedSymbolArray.get(we.placedIconSymbolIndex).hidden=De.icon.isHidden()),we.verticalPlacedIconSymbolIndex>=0&&(ce(r.icon,we.numVerticalIconVertices,Ct?ea:ct),r.icon.placedSymbolArray.get(we.verticalPlacedIconSymbolIndex).hidden=De.icon.isHidden())}const ht=fe&&fe.has(me)?fe.get(me):{text:null,icon:null};if(r.hasIconCollisionBoxData()||r.hasTextCollisionBoxData()){const ct=r.collisionArrays[me];if(ct){let Ct=new c.P(0,0);if(ct.textBox||ct.verticalTextBox){let Ht=!0;if(O){const dt=this.variableOffsets[Pe];dt?(Ct=En(dt.anchor,dt.width,dt.height,dt.textOffset,dt.textBoxScale),B&&Ct._rotate(K?this.transform.angle:-this.transform.angle)):Ht=!1}if(ct.textBox||ct.verticalTextBox){let dt;ct.textBox&&(dt=mt),ct.verticalTextBox&&(dt=xt),Qs(r.textCollisionBox.collisionVertexArray,De.text.placed,!Ht||dt,ht.text,Ct.x,Ct.y)}}if(ct.iconBox||ct.verticalIconBox){const Ht=!!(!xt&&ct.verticalIconBox);let dt;ct.iconBox&&(dt=Ht),ct.verticalIconBox&&(dt=!Ht),Qs(r.iconCollisionBox.collisionVertexArray,De.icon.placed,dt,ht.icon,Q?Ct.x:0,Q?Ct.y:0)}}}}if(r.sortFeatures(this.transform.angle),this.retainedQueryData[r.bucketInstanceId]&&(this.retainedQueryData[r.bucketInstanceId].featureSortOrder=r.featureSortOrder),r.hasTextData()&&r.text.opacityVertexBuffer&&r.text.opacityVertexBuffer.updateData(r.text.opacityVertexArray),r.hasIconData()&&r.icon.opacityVertexBuffer&&r.icon.opacityVertexBuffer.updateData(r.icon.opacityVertexArray),r.hasIconCollisionBoxData()&&r.iconCollisionBox.collisionVertexBuffer&&r.iconCollisionBox.collisionVertexBuffer.updateData(r.iconCollisionBox.collisionVertexArray),r.hasTextCollisionBoxData()&&r.textCollisionBox.collisionVertexBuffer&&r.textCollisionBox.collisionVertexBuffer.updateData(r.textCollisionBox.collisionVertexArray),r.text.opacityVertexArray.length!==r.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${r.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${r.text.layoutVertexArray.length}) / 4`);if(r.icon.opacityVertexArray.length!==r.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${r.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${r.icon.layoutVertexArray.length}) / 4`);if(r.bucketInstanceId in this.collisionCircleArrays){const me=this.collisionCircleArrays[r.bucketInstanceId];r.placementInvProjMatrix=me.invProjMatrix,r.placementViewportMatrix=me.viewportMatrix,r.collisionCircleArray=me.circles,delete this.collisionCircleArrays[r.bucketInstanceId]}}symbolFadeChange(r){return this.fadeDuration===0?1:(r-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(r){return Math.max(0,(this.transform.zoom-r)/1.5)}hasTransitions(r){return this.stale||r-this.lastPlacementChangeTimer}setStale(){this.stale=!0}}function Qs(v,r,a,p,f,_){p&&p.length!==0||(p=[0,0,0,0]);const S=p[0]-Xt,k=p[1]-Xt,C=p[2]-Xt,z=p[3]-Xt;v.emplaceBack(r?1:0,a?1:0,f||0,_||0,S,k),v.emplaceBack(r?1:0,a?1:0,f||0,_||0,C,k),v.emplaceBack(r?1:0,a?1:0,f||0,_||0,C,z),v.emplaceBack(r?1:0,a?1:0,f||0,_||0,S,z)}const Er=Math.pow(2,25),qc=Math.pow(2,24),Xc=Math.pow(2,17),fi=Math.pow(2,16),mi=Math.pow(2,9),Kg=Math.pow(2,8),Ri=Math.pow(2,1);function gi(v){if(v.opacity===0&&!v.placed)return 0;if(v.opacity===1&&v.placed)return 4294967295;const r=v.placed?1:0,a=Math.floor(127*v.opacity);return a*Er+r*qc+a*Xc+r*fi+a*mi+r*Kg+a*Ri+r}const ea=0;function bs(){return{isOccluded:(v,r,a)=>!1,getPitchedTextCorrection:(v,r,a)=>1,get useSpecialProjectionForSymbols(){return!1},projectTileCoordinates(v,r,a,p){throw new Error("Not implemented.")},translatePosition:(v,r,a,p)=>function(f,_,S,k,C=!1){if(!S[0]&&!S[1])return[0,0];const z=C?k==="map"?f.angle:0:k==="viewport"?-f.angle:0;if(z){const O=Math.sin(z),B=Math.cos(z);S=[S[0]*B-S[1]*O,S[0]*O+S[1]*B]}return[C?S[0]:rr(_,S[0],f.zoom),C?S[1]:rr(_,S[1],f.zoom)]}(v,r,a,p),getCircleRadiusCorrection:v=>1}}class pn{constructor(r){this._sortAcrossTiles=r.layout.get("symbol-z-order")!=="viewport-y"&&!r.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(r,a,p,f,_){const S=this._bucketParts;for(;this._currentTileIndexk.sortKey-C.sortKey));this._currentPartIndex!this._forceFullPlacement&&D.now()-f>2;for(;this._currentPlacementIndex>=0;){const S=a[r[this._currentPlacementIndex]],k=this.placement.collisionIndex.transform.zoom;if(S.type==="symbol"&&(!S.minzoom||S.minzoom<=k)&&(!S.maxzoom||S.maxzoom>k)){if(this._inProgressLayer||(this._inProgressLayer=new pn(S)),this._inProgressLayer.continuePlacement(p[S.source],this.placement,this._showCollisionBoxes,S,_))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(r){return this.placement.commit(r),this.placement}}const Ji=512/c.X/2;class an{constructor(r,a,p){this.tileID=r,this.bucketInstanceId=p,this._symbolsByKey={};const f=new Map;for(let _=0;_({x:Math.floor(C.anchorX*Ji),y:Math.floor(C.anchorY*Ji)})),crossTileIDs:S.map(C=>C.crossTileID)};if(k.positions.length>128){const C=new c.av(k.positions.length,16,Uint16Array);for(const{x:z,y:O}of k.positions)C.add(z,O);C.finish(),delete k.positions,k.index=C}this._symbolsByKey[_]=k}}getScaledCoordinates(r,a){const{x:p,y:f,z:_}=this.tileID.canonical,{x:S,y:k,z:C}=a.canonical,z=Ji/Math.pow(2,C-_),O=(k*c.X+r.anchorY)*z,B=f*c.X*Ji;return{x:Math.floor((S*c.X+r.anchorX)*z-p*c.X*Ji),y:Math.floor(O-B)}}findMatches(r,a,p){const f=this.tileID.canonical.zr)}}class au{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Qi{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(r){const a=Math.round((r-this.lng)/360);if(a!==0)for(const p in this.indexes){const f=this.indexes[p],_={};for(const S in f){const k=f[S];k.tileID=k.tileID.unwrapTo(k.tileID.wrap+a),_[k.tileID.key]=k}this.indexes[p]=_}this.lng=r}addBucket(r,a,p){if(this.indexes[r.overscaledZ]&&this.indexes[r.overscaledZ][r.key]){if(this.indexes[r.overscaledZ][r.key].bucketInstanceId===a.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(r.overscaledZ,this.indexes[r.overscaledZ][r.key])}for(let _=0;_r.overscaledZ)for(const k in S){const C=S[k];C.tileID.isChildOf(r)&&C.findMatches(a.symbolInstances,r,f)}else{const k=S[r.scaledTo(Number(_)).key];k&&k.findMatches(a.symbolInstances,r,f)}}for(let _=0;_{a[p]=!0});for(const p in this.layerIndexes)a[p]||delete this.layerIndexes[p]}}const eo=(v,r)=>c.t(v,r&&r.filter(a=>a.identifier!=="source.canvas")),Yg=c.aw();class lu extends c.E{constructor(r,a={}){super(),this._rtlPluginLoaded=()=>{for(const p in this.sourceCaches){const f=this.sourceCaches[p].getSource().type;f!=="vector"&&f!=="geojson"||this.sourceCaches[p].reload()}},this.map=r,this.dispatcher=new pr(Gt(),r._getMapId()),this.dispatcher.registerMessageHandler("GG",(p,f)=>this.getGlyphs(p,f)),this.dispatcher.registerMessageHandler("GI",(p,f)=>this.getImages(p,f)),this.imageManager=new je,this.imageManager.setEventedParent(this),this.glyphManager=new ye(r._requestManager,a.localIdeographFontFamily),this.lineAtlas=new ft(256,512),this.crossTileSymbolIndex=new Kc,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new c.ax,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",c.ay()),sn().on(We,this._rtlPluginLoaded),this.on("data",p=>{if(p.dataType!=="source"||p.sourceDataType!=="metadata")return;const f=this.sourceCaches[p.sourceId];if(!f)return;const _=f.getSource();if(_&&_.vectorLayerIds)for(const S in this._layers){const k=this._layers[S];k.source===_.id&&this._validateLayer(k)}})}loadURL(r,a={},p){this.fire(new c.k("dataloading",{dataType:"style"})),a.validate=typeof a.validate!="boolean"||a.validate;const f=this.map._requestManager.transformRequest(r,"Style");this._loadStyleRequest=new AbortController;const _=this._loadStyleRequest;c.h(f,this._loadStyleRequest).then(S=>{this._loadStyleRequest=null,this._load(S.data,a,p)}).catch(S=>{this._loadStyleRequest=null,S&&!_.signal.aborted&&this.fire(new c.j(S))})}loadJSON(r,a={},p){this.fire(new c.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,D.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,a.validate=a.validate!==!1,this._load(r,a,p)}).catch(()=>{})}loadEmpty(){this.fire(new c.k("dataloading",{dataType:"style"})),this._load(Yg,{validate:!1})}_load(r,a,p){var f;const _=a.transformStyle?a.transformStyle(p,r):r;if(!a.validate||!eo(this,c.u(_))){this._loaded=!0,this.stylesheet=_;for(const S in _.sources)this.addSource(S,_.sources[S],{validate:!1});_.sprite?this._loadSprite(_.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(_.glyphs),this._createLayers(),this.light=new Ye(this.stylesheet.light),this.sky=new Te(this.stylesheet.sky),this.map.setTerrain((f=this.stylesheet.terrain)!==null&&f!==void 0?f:null),this.fire(new c.k("data",{dataType:"style"})),this.fire(new c.k("style.load"))}}_createLayers(){const r=c.az(this.stylesheet.layers);this.dispatcher.broadcast("SL",r),this._order=r.map(a=>a.id),this._layers={},this._serializedLayers=null;for(const a of r){const p=c.aA(a);p.setEventedParent(this,{layer:{id:a.id}}),this._layers[a.id]=p}}_loadSprite(r,a=!1,p=void 0){let f;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(_,S,k,C){return c._(this,void 0,void 0,function*(){const z=Fe(_),O=k>1?"@2x":"",B={},K={};for(const{id:Q,url:re}of z){const ce=S.transformRequest(Ge(re,O,".json"),"SpriteJSON");B[Q]=c.h(ce,C);const fe=S.transformRequest(Ge(re,O,".png"),"SpriteImage");K[Q]=q.getImage(fe,C)}return yield Promise.all([...Object.values(B),...Object.values(K)]),function(Q,re){return c._(this,void 0,void 0,function*(){const ce={};for(const fe in Q){ce[fe]={};const me=D.getImageCanvasContext((yield re[fe]).data),we=(yield Q[fe]).data;for(const ae in we){const{width:Ce,height:Pe,x:De,y:Xe,sdf:ot,pixelRatio:mt,stretchX:xt,stretchY:ht,content:ct,textFitWidth:Ct,textFitHeight:Ht}=we[ae];ce[fe][ae]={data:null,pixelRatio:mt,sdf:ot,stretchX:xt,stretchY:ht,content:ct,textFitWidth:Ct,textFitHeight:Ht,spriteData:{width:Ce,height:Pe,x:De,y:Xe,context:me}}}}return ce})}(B,K)})}(r,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(_=>{if(this._spriteRequest=null,_)for(const S in _){this._spritesImagesIds[S]=[];const k=this._spritesImagesIds[S]?this._spritesImagesIds[S].filter(C=>!(C in _)):[];for(const C of k)this.imageManager.removeImage(C),this._changedImages[C]=!0;for(const C in _[S]){const z=S==="default"?C:`${S}:${C}`;this._spritesImagesIds[S].push(z),z in this.imageManager.images?this.imageManager.updateImage(z,_[S][C],!1):this.imageManager.addImage(z,_[S][C]),a&&(this._changedImages[z]=!0)}}}).catch(_=>{this._spriteRequest=null,f=_,this.fire(new c.j(f))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),a&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new c.k("data",{dataType:"style"})),p&&p(f)})}_unloadSprite(){for(const r of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(r),this._changedImages[r]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new c.k("data",{dataType:"style"}))}_validateLayer(r){const a=this.sourceCaches[r.source];if(!a)return;const p=r.sourceLayer;if(!p)return;const f=a.getSource();(f.type==="geojson"||f.vectorLayerIds&&f.vectorLayerIds.indexOf(p)===-1)&&this.fire(new c.j(new Error(`Source layer "${p}" does not exist on source "${f.id}" as specified by style layer "${r.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const r in this.sourceCaches)if(!this.sourceCaches[r].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(r,a=!1){const p=this._serializedAllLayers();if(!r||r.length===0)return Object.values(a?c.aB(p):p);const f=[];for(const _ of r)if(p[_]){const S=a?c.aB(p[_]):p[_];f.push(S)}return f}_serializedAllLayers(){let r=this._serializedLayers;if(r)return r;r=this._serializedLayers={};const a=Object.keys(this._layers);for(const p of a){const f=this._layers[p];f.type!=="custom"&&(r[p]=f.serialize())}return r}hasTransitions(){if(this.light&&this.light.hasTransition()||this.sky&&this.sky.hasTransition())return!0;for(const r in this.sourceCaches)if(this.sourceCaches[r].hasTransition())return!0;for(const r in this._layers)if(this._layers[r].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(r){if(!this._loaded)return;const a=this._changed;if(a){const f=Object.keys(this._updatedLayers),_=Object.keys(this._removedLayers);(f.length||_.length)&&this._updateWorkerLayers(f,_);for(const S in this._updatedSources){const k=this._updatedSources[S];if(k==="reload")this._reloadSource(S);else{if(k!=="clear")throw new Error(`Invalid action ${k}`);this._clearSource(S)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const S in this._updatedPaintProps)this._layers[S].updateTransitions(r);this.light.updateTransitions(r),this.sky.updateTransitions(r),this._resetUpdates()}const p={};for(const f in this.sourceCaches){const _=this.sourceCaches[f];p[f]=_.used,_.used=!1}for(const f of this._order){const _=this._layers[f];_.recalculate(r,this._availableImages),!_.isHidden(r.zoom)&&_.source&&(this.sourceCaches[_.source].used=!0)}for(const f in p){const _=this.sourceCaches[f];!!p[f]!=!!_.used&&_.fire(new c.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:f}))}this.light.recalculate(r),this.sky.recalculate(r),this.z=r.zoom,a&&this.fire(new c.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){const r=Object.keys(this._changedImages);if(r.length){for(const a in this.sourceCaches)this.sourceCaches[a].reloadTilesForDependencies(["icons","patterns"],r);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const r in this.sourceCaches)this.sourceCaches[r].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(r,a){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(r,!1),removedIds:a})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(r,a={}){var p;this._checkLoaded();const f=this.serialize();if(r=a.transformStyle?a.transformStyle(f,r):r,((p=a.validate)===null||p===void 0||p)&&eo(this,c.u(r)))return!1;(r=c.aB(r)).layers=c.az(r.layers);const _=c.aC(f,r),S=this._getOperationsToPerform(_);if(S.unimplemented.length>0)throw new Error(`Unimplemented: ${S.unimplemented.join(", ")}.`);if(S.operations.length===0)return!1;for(const k of S.operations)k();return this.stylesheet=r,this._serializedLayers=null,!0}_getOperationsToPerform(r){const a=[],p=[];for(const f of r)switch(f.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":a.push(()=>this.addLayer.apply(this,f.args));break;case"removeLayer":a.push(()=>this.removeLayer.apply(this,f.args));break;case"setPaintProperty":a.push(()=>this.setPaintProperty.apply(this,f.args));break;case"setLayoutProperty":a.push(()=>this.setLayoutProperty.apply(this,f.args));break;case"setFilter":a.push(()=>this.setFilter.apply(this,f.args));break;case"addSource":a.push(()=>this.addSource.apply(this,f.args));break;case"removeSource":a.push(()=>this.removeSource.apply(this,f.args));break;case"setLayerZoomRange":a.push(()=>this.setLayerZoomRange.apply(this,f.args));break;case"setLight":a.push(()=>this.setLight.apply(this,f.args));break;case"setGeoJSONSourceData":a.push(()=>this.setGeoJSONSourceData.apply(this,f.args));break;case"setGlyphs":a.push(()=>this.setGlyphs.apply(this,f.args));break;case"setSprite":a.push(()=>this.setSprite.apply(this,f.args));break;case"setSky":a.push(()=>this.setSky.apply(this,f.args));break;case"setTerrain":a.push(()=>this.map.setTerrain.apply(this,f.args));break;case"setTransition":a.push(()=>{});break;default:p.push(f.command)}return{operations:a,unimplemented:p}}addImage(r,a){if(this.getImage(r))return this.fire(new c.j(new Error(`An image named "${r}" already exists.`)));this.imageManager.addImage(r,a),this._afterImageUpdated(r)}updateImage(r,a){this.imageManager.updateImage(r,a)}getImage(r){return this.imageManager.getImage(r)}removeImage(r){if(!this.getImage(r))return this.fire(new c.j(new Error(`An image named "${r}" does not exist.`)));this.imageManager.removeImage(r),this._afterImageUpdated(r)}_afterImageUpdated(r){this._availableImages=this.imageManager.listImages(),this._changedImages[r]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new c.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(r,a,p={}){if(this._checkLoaded(),this.sourceCaches[r]!==void 0)throw new Error(`Source "${r}" already exists.`);if(!a.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(a).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(a.type)>=0&&this._validate(c.u.source,`sources.${r}`,a,null,p))return;this.map&&this.map._collectResourceTiming&&(a.collectResourceTiming=!0);const f=this.sourceCaches[r]=new Bt(r,a,this.dispatcher);f.style=this,f.setEventedParent(this,()=>({isSourceLoaded:f.loaded(),source:f.serialize(),sourceId:r})),f.onAdd(this.map),this._changed=!0}removeSource(r){if(this._checkLoaded(),this.sourceCaches[r]===void 0)throw new Error("There is no source with this ID");for(const p in this._layers)if(this._layers[p].source===r)return this.fire(new c.j(new Error(`Source "${r}" cannot be removed while layer "${p}" is using it.`)));const a=this.sourceCaches[r];delete this.sourceCaches[r],delete this._updatedSources[r],a.fire(new c.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:r})),a.setEventedParent(null),a.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(r,a){if(this._checkLoaded(),this.sourceCaches[r]===void 0)throw new Error(`There is no source with this ID=${r}`);const p=this.sourceCaches[r].getSource();if(p.type!=="geojson")throw new Error(`geojsonSource.type is ${p.type}, which is !== 'geojson`);p.setData(a),this._changed=!0}getSource(r){return this.sourceCaches[r]&&this.sourceCaches[r].getSource()}addLayer(r,a,p={}){this._checkLoaded();const f=r.id;if(this.getLayer(f))return void this.fire(new c.j(new Error(`Layer "${f}" already exists on this map.`)));let _;if(r.type==="custom"){if(eo(this,c.aD(r)))return;_=c.aA(r)}else{if("source"in r&&typeof r.source=="object"&&(this.addSource(f,r.source),r=c.aB(r),r=c.e(r,{source:f})),this._validate(c.u.layer,`layers.${f}`,r,{arrayIndex:-1},p))return;_=c.aA(r),this._validateLayer(_),_.setEventedParent(this,{layer:{id:f}})}const S=a?this._order.indexOf(a):this._order.length;if(a&&S===-1)this.fire(new c.j(new Error(`Cannot add layer "${f}" before non-existing layer "${a}".`)));else{if(this._order.splice(S,0,f),this._layerOrderChanged=!0,this._layers[f]=_,this._removedLayers[f]&&_.source&&_.type!=="custom"){const k=this._removedLayers[f];delete this._removedLayers[f],k.type!==_.type?this._updatedSources[_.source]="clear":(this._updatedSources[_.source]="reload",this.sourceCaches[_.source].pause())}this._updateLayer(_),_.onAdd&&_.onAdd(this.map)}}moveLayer(r,a){if(this._checkLoaded(),this._changed=!0,!this._layers[r])return void this.fire(new c.j(new Error(`The layer '${r}' does not exist in the map's style and cannot be moved.`)));if(r===a)return;const p=this._order.indexOf(r);this._order.splice(p,1);const f=a?this._order.indexOf(a):this._order.length;a&&f===-1?this.fire(new c.j(new Error(`Cannot move layer "${r}" before non-existing layer "${a}".`))):(this._order.splice(f,0,r),this._layerOrderChanged=!0)}removeLayer(r){this._checkLoaded();const a=this._layers[r];if(!a)return void this.fire(new c.j(new Error(`Cannot remove non-existing layer "${r}".`)));a.setEventedParent(null);const p=this._order.indexOf(r);this._order.splice(p,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[r]=a,delete this._layers[r],this._serializedLayers&&delete this._serializedLayers[r],delete this._updatedLayers[r],delete this._updatedPaintProps[r],a.onRemove&&a.onRemove(this.map)}getLayer(r){return this._layers[r]}getLayersOrder(){return[...this._order]}hasLayer(r){return r in this._layers}setLayerZoomRange(r,a,p){this._checkLoaded();const f=this.getLayer(r);f?f.minzoom===a&&f.maxzoom===p||(a!=null&&(f.minzoom=a),p!=null&&(f.maxzoom=p),this._updateLayer(f)):this.fire(new c.j(new Error(`Cannot set the zoom range of non-existing layer "${r}".`)))}setFilter(r,a,p={}){this._checkLoaded();const f=this.getLayer(r);if(f){if(!c.aE(f.filter,a))return a==null?(f.filter=void 0,void this._updateLayer(f)):void(this._validate(c.u.filter,`layers.${f.id}.filter`,a,null,p)||(f.filter=c.aB(a),this._updateLayer(f)))}else this.fire(new c.j(new Error(`Cannot filter non-existing layer "${r}".`)))}getFilter(r){return c.aB(this.getLayer(r).filter)}setLayoutProperty(r,a,p,f={}){this._checkLoaded();const _=this.getLayer(r);_?c.aE(_.getLayoutProperty(a),p)||(_.setLayoutProperty(a,p,f),this._updateLayer(_)):this.fire(new c.j(new Error(`Cannot style non-existing layer "${r}".`)))}getLayoutProperty(r,a){const p=this.getLayer(r);if(p)return p.getLayoutProperty(a);this.fire(new c.j(new Error(`Cannot get style of non-existing layer "${r}".`)))}setPaintProperty(r,a,p,f={}){this._checkLoaded();const _=this.getLayer(r);_?c.aE(_.getPaintProperty(a),p)||(_.setPaintProperty(a,p,f)&&this._updateLayer(_),this._changed=!0,this._updatedPaintProps[r]=!0,this._serializedLayers=null):this.fire(new c.j(new Error(`Cannot style non-existing layer "${r}".`)))}getPaintProperty(r,a){return this.getLayer(r).getPaintProperty(a)}setFeatureState(r,a){this._checkLoaded();const p=r.source,f=r.sourceLayer,_=this.sourceCaches[p];if(_===void 0)return void this.fire(new c.j(new Error(`The source '${p}' does not exist in the map's style.`)));const S=_.getSource().type;S==="geojson"&&f?this.fire(new c.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):S!=="vector"||f?(r.id===void 0&&this.fire(new c.j(new Error("The feature id parameter must be provided."))),_.setFeatureState(f,r.id,a)):this.fire(new c.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(r,a){this._checkLoaded();const p=r.source,f=this.sourceCaches[p];if(f===void 0)return void this.fire(new c.j(new Error(`The source '${p}' does not exist in the map's style.`)));const _=f.getSource().type,S=_==="vector"?r.sourceLayer:void 0;_!=="vector"||S?a&&typeof r.id!="string"&&typeof r.id!="number"?this.fire(new c.j(new Error("A feature id is required to remove its specific state property."))):f.removeFeatureState(S,r.id,a):this.fire(new c.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(r){this._checkLoaded();const a=r.source,p=r.sourceLayer,f=this.sourceCaches[a];if(f!==void 0)return f.getSource().type!=="vector"||p?(r.id===void 0&&this.fire(new c.j(new Error("The feature id parameter must be provided."))),f.getFeatureState(p,r.id)):void this.fire(new c.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new c.j(new Error(`The source '${a}' does not exist in the map's style.`)))}getTransition(){return c.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const r=c.aF(this.sourceCaches,_=>_.serialize()),a=this._serializeByIds(this._order,!0),p=this.map.getTerrain()||void 0,f=this.stylesheet;return c.aG({version:f.version,name:f.name,metadata:f.metadata,light:f.light,sky:f.sky,center:f.center,zoom:f.zoom,bearing:f.bearing,pitch:f.pitch,sprite:f.sprite,glyphs:f.glyphs,transition:f.transition,sources:r,layers:a,terrain:p},_=>_!==void 0)}_updateLayer(r){this._updatedLayers[r.id]=!0,r.source&&!this._updatedSources[r.source]&&this.sourceCaches[r.source].getSource().type!=="raster"&&(this._updatedSources[r.source]="reload",this.sourceCaches[r.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(r){const a=S=>this._layers[S].type==="fill-extrusion",p={},f=[];for(let S=this._order.length-1;S>=0;S--){const k=this._order[S];if(a(k)){p[k]=S;for(const C of r){const z=C[k];if(z)for(const O of z)f.push(O)}}}f.sort((S,k)=>k.intersectionZ-S.intersectionZ);const _=[];for(let S=this._order.length-1;S>=0;S--){const k=this._order[S];if(a(k))for(let C=f.length-1;C>=0;C--){const z=f[C].feature;if(p[z.layer.id]{const ot=me.featureSortOrder;if(ot){const mt=ot.indexOf(De.featureIndex);return ot.indexOf(Xe.featureIndex)-mt}return Xe.featureIndex-De.featureIndex});for(const De of Pe)Ce.push(De)}}for(const me in re)re[me].forEach(we=>{const ae=we.feature,Ce=z[k[me].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=Ce});return re}(this._layers,S,this.sourceCaches,r,a,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(_)}querySourceFeatures(r,a){a&&a.filter&&this._validate(c.u.filter,"querySourceFeatures.filter",a.filter,null,a);const p=this.sourceCaches[r];return p?function(f,_){const S=f.getRenderableIds().map(z=>f.getTileByID(z)),k=[],C={};for(let z=0;zK.getTileByID(Q)).sort((Q,re)=>re.tileID.overscaledZ-Q.tileID.overscaledZ||(Q.tileID.isLessThan(re.tileID)?-1:1))}const B=this.crossTileSymbolIndex.addLayer(O,C[O.source],r.center.lng);S=S||B}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((_=_||this._layerOrderChanged||p===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(D.now(),r.zoom))&&(this.pauseablePlacement=new sl(r,this.map.terrain,this._order,_,a,p,f,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,C),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(D.now()),k=!0),S&&this.pauseablePlacement.placement.setStale()),k||S)for(const z of this._order){const O=this._layers[z];O.type==="symbol"&&this.placement.updateLayerOpacities(O,C[O.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(D.now())}_releaseSymbolFadeTiles(){for(const r in this.sourceCaches)this.sourceCaches[r].releaseSymbolFadeTiles()}getImages(r,a){return c._(this,void 0,void 0,function*(){const p=yield this.imageManager.getImages(a.icons);this._updateTilesForChangedImages();const f=this.sourceCaches[a.source];return f&&f.setDependencies(a.tileID.key,a.type,a.icons),p})}getGlyphs(r,a){return c._(this,void 0,void 0,function*(){const p=yield this.glyphManager.getGlyphs(a.stacks),f=this.sourceCaches[a.source];return f&&f.setDependencies(a.tileID.key,a.type,[""]),p})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(r,a={}){this._checkLoaded(),r&&this._validate(c.u.glyphs,"glyphs",r,null,a)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=r,this.glyphManager.entries={},this.glyphManager.setURL(r))}addSprite(r,a,p={},f){this._checkLoaded();const _=[{id:r,url:a}],S=[...Fe(this.stylesheet.sprite),..._];this._validate(c.u.sprite,"sprite",S,null,p)||(this.stylesheet.sprite=S,this._loadSprite(_,!0,f))}removeSprite(r){this._checkLoaded();const a=Fe(this.stylesheet.sprite);if(a.find(p=>p.id===r)){if(this._spritesImagesIds[r])for(const p of this._spritesImagesIds[r])this.imageManager.removeImage(p),this._changedImages[p]=!0;a.splice(a.findIndex(p=>p.id===r),1),this.stylesheet.sprite=a.length>0?a:void 0,delete this._spritesImagesIds[r],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new c.k("data",{dataType:"style"}))}else this.fire(new c.j(new Error(`Sprite "${r}" doesn't exists on this map.`)))}getSprite(){return Fe(this.stylesheet.sprite)}setSprite(r,a={},p){this._checkLoaded(),r&&this._validate(c.u.sprite,"sprite",r,null,a)||(this.stylesheet.sprite=r,r?this._loadSprite(r,!0,p):(this._unloadSprite(),p&&p(null)))}}var Ss=c.Y([{name:"a_pos",type:"Int16",components:2}]);const is={prelude:yr(`#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;} -#ifdef TERRAIN3D -uniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth; -#endif -const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) { -#ifdef TERRAIN3D -highp float d=unpack(texture2D(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0)); -#else -return 1.0; -#endif -}float calculate_visibility(vec4 pos) { -#ifdef TERRAIN3D -vec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0; -#else -return 1.0; -#endif -}float ele(vec2 pos) { -#ifdef TERRAIN3D -vec4 rgb=(texture2D(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a; -#else -return 0.0; -#endif -}float get_elevation(vec2 pos) { -#ifdef TERRAIN3D -vec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration; -#else -return 0.0; -#endif -}`),background:yr(`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:yr(`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:yr(`varying vec3 v_data;varying float v_visibility; -#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);float antialiased_blur=v_data.z;float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=v_visibility*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;varying float v_visibility; -#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);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));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,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,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;}}float antialiasblur=-max(1.0/u_device_pixel_ratio/(radius+stroke_width),blur);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`),clippingMask:yr("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:yr(`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,get_elevation(floor(a_pos*0.5)),1);gl_Position=u_matrix*pos;}`),heatmapTexture:yr(`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:yr("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_anchor_pos;attribute vec2 a_placed;attribute vec2 a_box_real;uniform mat4 u_matrix;uniform vec2 u_pixel_extrude_scale;varying float v_placed;varying float v_notUsed;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:yr("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:yr("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,get_elevation(a_pos),1);}"),fill:yr(`#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:yr(`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:yr(`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:yr(`#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:yr(`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; -#ifdef TERRAIN3D -attribute vec2 a_centroid; -#endif -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; -#ifdef TERRAIN3D -float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0); -#else -float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0; -#endif -base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;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:yr(`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; -#ifdef TERRAIN3D -attribute vec2 a_centroid; -#endif -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; -#ifdef TERRAIN3D -float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0); -#else -float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0; -#endif -base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;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:yr(`#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:yr(`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:yr(`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; -#ifdef TERRAIN3D -v_gamma_scale=1.0; -#else -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; -#endif -v_width2=vec2(outset,inset);}`),lineGradient:yr(`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; -#ifdef TERRAIN3D -v_gamma_scale=1.0; -#else -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; -#endif -v_width2=vec2(outset,inset);}`),linePattern:yr(`#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; -#ifdef TERRAIN3D -v_gamma_scale=1.0; -#else -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; -#endif -v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:yr(`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; -#ifdef TERRAIN3D -v_gamma_scale=1.0; -#else -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; -#endif -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:yr(`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:yr(`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 -}`,`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;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;varying vec2 v_tex;varying float v_fade_opacity;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);} -#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;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);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=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}`),symbolSDF:yr(`#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 inner_edge=(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);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);if (u_is_halo) {lowp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha=min(smoothstep(halo_edge-gamma_scaled,halo_edge+gamma_scaled,dist),1.0-alpha);}gl_FragColor=color*(alpha*opacity*fade_opacity); -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,`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 bool u_is_along_line;uniform bool u_is_variable_anchor;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_translation;uniform float u_pitched_scale;varying vec2 v_data0;varying vec3 v_data1;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);} -#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;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);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=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}`),symbolTextAndIcon:yr(`#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 -}`,`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;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;varying vec4 v_data0;varying vec4 v_data1;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);} -#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;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);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=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));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);}`),terrain:yr("uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;varying vec2 v_texture_pos;varying float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture2D(u_texture,v_texture_pos);if (v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);gl_FragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {gl_FragColor=surface_color;}}","attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform mat4 u_fog_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}"),terrainDepth:yr("varying float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {gl_FragColor=pack(v_depth);}","attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}"),terrainCoords:yr("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}","attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);}"),sky:yr("uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform float u_horizon;uniform float u_sky_horizon_blend;void main() {float y=gl_FragCoord.y;if (y > u_horizon) {float blend=y-u_horizon;if (blend < u_sky_horizon_blend) {gl_FragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {gl_FragColor=u_sky_color;}}}","attribute vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}")};function yr(v,r){const a=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,p=r.match(/attribute ([\w]+) ([\w]+)/g),f=v.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),_=r.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),S=_?_.concat(f):f,k={};return{fragmentSource:v=v.replace(a,(C,z,O,B,K)=>(k[K]=!0,z==="define"?` -#ifndef HAS_UNIFORM_u_${K} -varying ${O} ${B} ${K}; -#else -uniform ${O} ${B} u_${K}; -#endif -`:` -#ifdef HAS_UNIFORM_u_${K} - ${O} ${B} ${K} = u_${K}; -#endif -`)),vertexSource:r=r.replace(a,(C,z,O,B,K)=>{const Q=B==="float"?"vec2":"vec4",re=K.match(/color/)?"color":Q;return k[K]?z==="define"?` -#ifndef HAS_UNIFORM_u_${K} -uniform lowp float u_${K}_t; -attribute ${O} ${Q} a_${K}; -varying ${O} ${B} ${K}; -#else -uniform ${O} ${B} u_${K}; -#endif -`:re==="vec4"?` -#ifndef HAS_UNIFORM_u_${K} - ${K} = a_${K}; -#else - ${O} ${B} ${K} = u_${K}; -#endif -`:` -#ifndef HAS_UNIFORM_u_${K} - ${K} = unpack_mix_${re}(a_${K}, u_${K}_t); -#else - ${O} ${B} ${K} = u_${K}; -#endif -`:z==="define"?` -#ifndef HAS_UNIFORM_u_${K} -uniform lowp float u_${K}_t; -attribute ${O} ${Q} a_${K}; -#else -uniform ${O} ${B} u_${K}; -#endif -`:re==="vec4"?` -#ifndef HAS_UNIFORM_u_${K} - ${O} ${B} ${K} = a_${K}; -#else - ${O} ${B} ${K} = u_${K}; -#endif -`:` -#ifndef HAS_UNIFORM_u_${K} - ${O} ${B} ${K} = unpack_mix_${re}(a_${K}, u_${K}_t); -#else - ${O} ${B} ${K} = u_${K}; -#endif -`}),staticAttributes:p,staticUniforms:S}}class Yc{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(r,a,p,f,_,S,k,C,z){this.context=r;let O=this.boundPaintVertexBuffers.length!==f.length;for(let B=0;!O&&B({u_matrix:v,u_texture:0,u_ele_delta:r,u_fog_matrix:a,u_fog_color:p?p.properties.get("fog-color"):c.aM.white,u_fog_ground_blend:p?p.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:p?p.calculateFogBlendOpacity(f):0,u_horizon_color:p?p.properties.get("horizon-color"):c.aM.white,u_horizon_fog_blend:p?p.properties.get("horizon-fog-blend"):1});function ta(v){const r=[];for(let a=0;a({u_depth:new c.aH(De,Xe.u_depth),u_terrain:new c.aH(De,Xe.u_terrain),u_terrain_dim:new c.aI(De,Xe.u_terrain_dim),u_terrain_matrix:new c.aJ(De,Xe.u_terrain_matrix),u_terrain_unpack:new c.aK(De,Xe.u_terrain_unpack),u_terrain_exaggeration:new c.aI(De,Xe.u_terrain_exaggeration)}))(r,Pe),this.binderUniforms=p?p.getUniforms(r,Pe):[]}draw(r,a,p,f,_,S,k,C,z,O,B,K,Q,re,ce,fe,me,we){const ae=r.gl;if(this.failedToCreate)return;if(r.program.set(this.program),r.setDepthMode(p),r.setStencilMode(f),r.setColorMode(_),r.setCullFace(S),C){r.activeTexture.set(ae.TEXTURE2),ae.bindTexture(ae.TEXTURE_2D,C.depthTexture),r.activeTexture.set(ae.TEXTURE3),ae.bindTexture(ae.TEXTURE_2D,C.texture);for(const Pe in this.terrainUniforms)this.terrainUniforms[Pe].set(C[Pe])}for(const Pe in this.fixedUniforms)this.fixedUniforms[Pe].set(k[Pe]);ce&&ce.setUniforms(r,this.binderUniforms,Q,{zoom:re});let Ce=0;switch(a){case ae.LINES:Ce=2;break;case ae.TRIANGLES:Ce=3;break;case ae.LINE_STRIP:Ce=1}for(const Pe of K.get()){const De=Pe.vaos||(Pe.vaos={});(De[z]||(De[z]=new Yc)).bind(r,this,O,ce?ce.getPaintVertexBuffers():[],B,Pe.vertexOffset,fe,me,we),ae.drawElements(a,Pe.primitiveLength*Ce,ae.UNSIGNED_SHORT,Pe.primitiveOffset*Ce*2)}}}function uu(v,r,a){const p=1/rr(a,1,r.transform.tileZoom),f=Math.pow(2,a.tileID.overscaledZ),_=a.tileSize*Math.pow(2,r.transform.tileZoom)/f,S=_*(a.tileID.canonical.x+a.tileID.wrap*f),k=_*a.tileID.canonical.y;return{u_image:0,u_texsize:a.imageAtlasTexture.size,u_scale:[p,v.fromScale,v.toScale],u_fade:v.t,u_pixel_coord_upper:[S>>16,k>>16],u_pixel_coord_lower:[65535&S,65535&k]}}const al=(v,r,a,p)=>{const f=r.style.light,_=f.properties.get("position"),S=[_.x,_.y,_.z],k=function(){var z=new c.A(9);return c.A!=Float32Array&&(z[1]=0,z[2]=0,z[3]=0,z[5]=0,z[6]=0,z[7]=0),z[0]=1,z[4]=1,z[8]=1,z}();f.properties.get("anchor")==="viewport"&&function(z,O){var B=Math.sin(O),K=Math.cos(O);z[0]=K,z[1]=B,z[2]=0,z[3]=-B,z[4]=K,z[5]=0,z[6]=0,z[7]=0,z[8]=1}(k,-r.transform.angle),function(z,O,B){var K=O[0],Q=O[1],re=O[2];z[0]=K*B[0]+Q*B[3]+re*B[6],z[1]=K*B[1]+Q*B[4]+re*B[7],z[2]=K*B[2]+Q*B[5]+re*B[8]}(S,S,k);const C=f.properties.get("color");return{u_matrix:v,u_lightpos:S,u_lightintensity:f.properties.get("intensity"),u_lightcolor:[C.r,C.g,C.b],u_vertical_gradient:+a,u_opacity:p}},cu=(v,r,a,p,f,_,S)=>c.e(al(v,r,a,p),uu(_,r,S),{u_height_factor:-Math.pow(2,f.overscaledZ)/S.tileSize/8}),ra=v=>({u_matrix:v}),_p=(v,r,a,p)=>c.e(ra(v),uu(a,r,p)),Jg=(v,r)=>({u_matrix:v,u_world:r}),vp=(v,r,a,p,f)=>c.e(_p(v,r,a,p),{u_world:f}),Qg=(v,r,a,p)=>{const f=v.transform;let _,S;if(p.paint.get("circle-pitch-alignment")==="map"){const k=rr(a,1,f.zoom);_=!0,S=[k,k]}else _=!1,S=f.pixelsToGLUnits;return{u_camera_to_center_distance:f.cameraToCenterDistance,u_scale_with_map:+(p.paint.get("circle-pitch-scale")==="map"),u_matrix:v.translatePosMatrix(r.posMatrix,a,p.paint.get("circle-translate"),p.paint.get("circle-translate-anchor")),u_pitch_with_map:+_,u_device_pixel_ratio:v.pixelRatio,u_extrude_scale:S}},Es=(v,r,a)=>({u_matrix:v,u_inv_matrix:r,u_camera_to_center_distance:a.cameraToCenterDistance,u_viewport_size:[a.width,a.height]}),ll=(v,r,a=1)=>({u_matrix:v,u_color:r,u_overlay:0,u_overlay_scale:a}),ti=v=>({u_matrix:v}),ri=(v,r,a,p)=>({u_matrix:v,u_extrude_scale:rr(r,1,a),u_intensity:p}),hu=(v,r,a,p)=>{const f=c.H();c.aP(f,0,v.width,v.height,0,0,1);const _=v.context.gl;return{u_matrix:f,u_world:[_.drawingBufferWidth,_.drawingBufferHeight],u_image:a,u_color_ramp:p,u_opacity:r.paint.get("heatmap-opacity")}};function du(v,r){const a=Math.pow(2,r.canonical.z),p=r.canonical.y;return[new c.Z(0,p/a).toLngLat().lat,new c.Z(0,(p+1)/a).toLngLat().lat]}const pu=(v,r,a,p)=>{const f=v.transform;return{u_matrix:bp(v,r,a,p),u_ratio:1/rr(r,1,f.zoom),u_device_pixel_ratio:v.pixelRatio,u_units_to_pixels:[1/f.pixelsToGLUnits[0],1/f.pixelsToGLUnits[1]]}},xp=(v,r,a,p,f)=>c.e(pu(v,r,a,f),{u_image:0,u_image_height:p}),na=(v,r,a,p,f)=>{const _=v.transform,S=wp(r,_);return{u_matrix:bp(v,r,a,f),u_texsize:r.imageAtlasTexture.size,u_ratio:1/rr(r,1,_.zoom),u_device_pixel_ratio:v.pixelRatio,u_image:0,u_scale:[S,p.fromScale,p.toScale],u_fade:p.t,u_units_to_pixels:[1/_.pixelsToGLUnits[0],1/_.pixelsToGLUnits[1]]}},ey=(v,r,a,p,f,_)=>{const S=v.lineAtlas,k=wp(r,v.transform),C=a.layout.get("line-cap")==="round",z=S.getDash(p.from,C),O=S.getDash(p.to,C),B=z.width*f.fromScale,K=O.width*f.toScale;return c.e(pu(v,r,a,_),{u_patternscale_a:[k/B,-z.height/2],u_patternscale_b:[k/K,-O.height/2],u_sdfgamma:S.width/(256*Math.min(B,K)*v.pixelRatio)/2,u_image:0,u_tex_y_a:z.y,u_tex_y_b:O.y,u_mix:f.t})};function wp(v,r){return 1/rr(v,1,r.tileZoom)}function bp(v,r,a,p){return v.translatePosMatrix(p?p.posMatrix:r.tileID.posMatrix,r,a.paint.get("line-translate"),a.paint.get("line-translate-anchor"))}const ty=(v,r,a,p,f)=>{return{u_matrix:v,u_tl_parent:r,u_scale_parent:a,u_buffer_scale:1,u_fade_t:p.mix,u_opacity:p.opacity*f.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:f.paint.get("raster-brightness-min"),u_brightness_high:f.paint.get("raster-brightness-max"),u_saturation_factor:(S=f.paint.get("raster-saturation"),S>0?1-1/(1.001-S):-S),u_contrast_factor:(_=f.paint.get("raster-contrast"),_>0?1/(1-_):1+_),u_spin_weights:ry(f.paint.get("raster-hue-rotate"))};var _,S};function ry(v){v*=Math.PI/180;const r=Math.sin(v),a=Math.cos(v);return[(2*a+1)/3,(-Math.sqrt(3)*r-a+1)/3,(Math.sqrt(3)*r-a+1)/3]}const Sp=(v,r,a,p,f,_,S,k,C,z,O,B,K,Q)=>{const re=S.transform;return{u_is_size_zoom_constant:+(v==="constant"||v==="source"),u_is_size_feature_constant:+(v==="constant"||v==="camera"),u_size_t:r?r.uSizeT:0,u_size:r?r.uSize:0,u_camera_to_center_distance:re.cameraToCenterDistance,u_pitch:re.pitch/360*2*Math.PI,u_rotate_symbol:+a,u_aspect_ratio:re.width/re.height,u_fade_change:S.options.fadeDuration?S.symbolFadeChange:1,u_matrix:k,u_label_plane_matrix:C,u_coord_matrix:z,u_is_text:+B,u_pitch_with_map:+p,u_is_along_line:f,u_is_variable_anchor:_,u_texsize:K,u_texture:0,u_translation:O,u_pitched_scale:Q}},ul=(v,r,a,p,f,_,S,k,C,z,O,B,K,Q,re)=>{const ce=S.transform;return c.e(Sp(v,r,a,p,f,_,S,k,C,z,O,B,K,re),{u_gamma_scale:p?Math.cos(ce._pitch)*ce.cameraToCenterDistance:1,u_device_pixel_ratio:S.pixelRatio,u_is_halo:+Q})},eh=(v,r,a,p,f,_,S,k,C,z,O,B,K,Q)=>c.e(ul(v,r,a,p,f,_,S,k,C,z,O,!0,B,!0,Q),{u_texsize_icon:K,u_texture_icon:1}),fu=(v,r,a)=>({u_matrix:v,u_opacity:r,u_color:a}),th=(v,r,a,p,f,_)=>c.e(function(S,k,C,z){const O=C.imageManager.getPattern(S.from.toString()),B=C.imageManager.getPattern(S.to.toString()),{width:K,height:Q}=C.imageManager.getPixelSize(),re=Math.pow(2,z.tileID.overscaledZ),ce=z.tileSize*Math.pow(2,C.transform.tileZoom)/re,fe=ce*(z.tileID.canonical.x+z.tileID.wrap*re),me=ce*z.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:O.tl,u_pattern_br_a:O.br,u_pattern_tl_b:B.tl,u_pattern_br_b:B.br,u_texsize:[K,Q],u_mix:k.t,u_pattern_size_a:O.displaySize,u_pattern_size_b:B.displaySize,u_scale_a:k.fromScale,u_scale_b:k.toScale,u_tile_units_to_pixels:1/rr(z,1,C.transform.tileZoom),u_pixel_coord_upper:[fe>>16,me>>16],u_pixel_coord_lower:[65535&fe,65535&me]}}(p,_,a,f),{u_matrix:v,u_opacity:r}),rh={fillExtrusion:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix),u_lightpos:new c.aN(v,r.u_lightpos),u_lightintensity:new c.aI(v,r.u_lightintensity),u_lightcolor:new c.aN(v,r.u_lightcolor),u_vertical_gradient:new c.aI(v,r.u_vertical_gradient),u_opacity:new c.aI(v,r.u_opacity)}),fillExtrusionPattern:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix),u_lightpos:new c.aN(v,r.u_lightpos),u_lightintensity:new c.aI(v,r.u_lightintensity),u_lightcolor:new c.aN(v,r.u_lightcolor),u_vertical_gradient:new c.aI(v,r.u_vertical_gradient),u_height_factor:new c.aI(v,r.u_height_factor),u_image:new c.aH(v,r.u_image),u_texsize:new c.aO(v,r.u_texsize),u_pixel_coord_upper:new c.aO(v,r.u_pixel_coord_upper),u_pixel_coord_lower:new c.aO(v,r.u_pixel_coord_lower),u_scale:new c.aN(v,r.u_scale),u_fade:new c.aI(v,r.u_fade),u_opacity:new c.aI(v,r.u_opacity)}),fill:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix)}),fillPattern:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix),u_image:new c.aH(v,r.u_image),u_texsize:new c.aO(v,r.u_texsize),u_pixel_coord_upper:new c.aO(v,r.u_pixel_coord_upper),u_pixel_coord_lower:new c.aO(v,r.u_pixel_coord_lower),u_scale:new c.aN(v,r.u_scale),u_fade:new c.aI(v,r.u_fade)}),fillOutline:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix),u_world:new c.aO(v,r.u_world)}),fillOutlinePattern:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix),u_world:new c.aO(v,r.u_world),u_image:new c.aH(v,r.u_image),u_texsize:new c.aO(v,r.u_texsize),u_pixel_coord_upper:new c.aO(v,r.u_pixel_coord_upper),u_pixel_coord_lower:new c.aO(v,r.u_pixel_coord_lower),u_scale:new c.aN(v,r.u_scale),u_fade:new c.aI(v,r.u_fade)}),circle:(v,r)=>({u_camera_to_center_distance:new c.aI(v,r.u_camera_to_center_distance),u_scale_with_map:new c.aH(v,r.u_scale_with_map),u_pitch_with_map:new c.aH(v,r.u_pitch_with_map),u_extrude_scale:new c.aO(v,r.u_extrude_scale),u_device_pixel_ratio:new c.aI(v,r.u_device_pixel_ratio),u_matrix:new c.aJ(v,r.u_matrix)}),collisionBox:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix),u_pixel_extrude_scale:new c.aO(v,r.u_pixel_extrude_scale)}),collisionCircle:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix),u_inv_matrix:new c.aJ(v,r.u_inv_matrix),u_camera_to_center_distance:new c.aI(v,r.u_camera_to_center_distance),u_viewport_size:new c.aO(v,r.u_viewport_size)}),debug:(v,r)=>({u_color:new c.aL(v,r.u_color),u_matrix:new c.aJ(v,r.u_matrix),u_overlay:new c.aH(v,r.u_overlay),u_overlay_scale:new c.aI(v,r.u_overlay_scale)}),clippingMask:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix)}),heatmap:(v,r)=>({u_extrude_scale:new c.aI(v,r.u_extrude_scale),u_intensity:new c.aI(v,r.u_intensity),u_matrix:new c.aJ(v,r.u_matrix)}),heatmapTexture:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix),u_world:new c.aO(v,r.u_world),u_image:new c.aH(v,r.u_image),u_color_ramp:new c.aH(v,r.u_color_ramp),u_opacity:new c.aI(v,r.u_opacity)}),hillshade:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix),u_image:new c.aH(v,r.u_image),u_latrange:new c.aO(v,r.u_latrange),u_light:new c.aO(v,r.u_light),u_shadow:new c.aL(v,r.u_shadow),u_highlight:new c.aL(v,r.u_highlight),u_accent:new c.aL(v,r.u_accent)}),hillshadePrepare:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix),u_image:new c.aH(v,r.u_image),u_dimension:new c.aO(v,r.u_dimension),u_zoom:new c.aI(v,r.u_zoom),u_unpack:new c.aK(v,r.u_unpack)}),line:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix),u_ratio:new c.aI(v,r.u_ratio),u_device_pixel_ratio:new c.aI(v,r.u_device_pixel_ratio),u_units_to_pixels:new c.aO(v,r.u_units_to_pixels)}),lineGradient:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix),u_ratio:new c.aI(v,r.u_ratio),u_device_pixel_ratio:new c.aI(v,r.u_device_pixel_ratio),u_units_to_pixels:new c.aO(v,r.u_units_to_pixels),u_image:new c.aH(v,r.u_image),u_image_height:new c.aI(v,r.u_image_height)}),linePattern:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix),u_texsize:new c.aO(v,r.u_texsize),u_ratio:new c.aI(v,r.u_ratio),u_device_pixel_ratio:new c.aI(v,r.u_device_pixel_ratio),u_image:new c.aH(v,r.u_image),u_units_to_pixels:new c.aO(v,r.u_units_to_pixels),u_scale:new c.aN(v,r.u_scale),u_fade:new c.aI(v,r.u_fade)}),lineSDF:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix),u_ratio:new c.aI(v,r.u_ratio),u_device_pixel_ratio:new c.aI(v,r.u_device_pixel_ratio),u_units_to_pixels:new c.aO(v,r.u_units_to_pixels),u_patternscale_a:new c.aO(v,r.u_patternscale_a),u_patternscale_b:new c.aO(v,r.u_patternscale_b),u_sdfgamma:new c.aI(v,r.u_sdfgamma),u_image:new c.aH(v,r.u_image),u_tex_y_a:new c.aI(v,r.u_tex_y_a),u_tex_y_b:new c.aI(v,r.u_tex_y_b),u_mix:new c.aI(v,r.u_mix)}),raster:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix),u_tl_parent:new c.aO(v,r.u_tl_parent),u_scale_parent:new c.aI(v,r.u_scale_parent),u_buffer_scale:new c.aI(v,r.u_buffer_scale),u_fade_t:new c.aI(v,r.u_fade_t),u_opacity:new c.aI(v,r.u_opacity),u_image0:new c.aH(v,r.u_image0),u_image1:new c.aH(v,r.u_image1),u_brightness_low:new c.aI(v,r.u_brightness_low),u_brightness_high:new c.aI(v,r.u_brightness_high),u_saturation_factor:new c.aI(v,r.u_saturation_factor),u_contrast_factor:new c.aI(v,r.u_contrast_factor),u_spin_weights:new c.aN(v,r.u_spin_weights)}),symbolIcon:(v,r)=>({u_is_size_zoom_constant:new c.aH(v,r.u_is_size_zoom_constant),u_is_size_feature_constant:new c.aH(v,r.u_is_size_feature_constant),u_size_t:new c.aI(v,r.u_size_t),u_size:new c.aI(v,r.u_size),u_camera_to_center_distance:new c.aI(v,r.u_camera_to_center_distance),u_pitch:new c.aI(v,r.u_pitch),u_rotate_symbol:new c.aH(v,r.u_rotate_symbol),u_aspect_ratio:new c.aI(v,r.u_aspect_ratio),u_fade_change:new c.aI(v,r.u_fade_change),u_matrix:new c.aJ(v,r.u_matrix),u_label_plane_matrix:new c.aJ(v,r.u_label_plane_matrix),u_coord_matrix:new c.aJ(v,r.u_coord_matrix),u_is_text:new c.aH(v,r.u_is_text),u_pitch_with_map:new c.aH(v,r.u_pitch_with_map),u_is_along_line:new c.aH(v,r.u_is_along_line),u_is_variable_anchor:new c.aH(v,r.u_is_variable_anchor),u_texsize:new c.aO(v,r.u_texsize),u_texture:new c.aH(v,r.u_texture),u_translation:new c.aO(v,r.u_translation),u_pitched_scale:new c.aI(v,r.u_pitched_scale)}),symbolSDF:(v,r)=>({u_is_size_zoom_constant:new c.aH(v,r.u_is_size_zoom_constant),u_is_size_feature_constant:new c.aH(v,r.u_is_size_feature_constant),u_size_t:new c.aI(v,r.u_size_t),u_size:new c.aI(v,r.u_size),u_camera_to_center_distance:new c.aI(v,r.u_camera_to_center_distance),u_pitch:new c.aI(v,r.u_pitch),u_rotate_symbol:new c.aH(v,r.u_rotate_symbol),u_aspect_ratio:new c.aI(v,r.u_aspect_ratio),u_fade_change:new c.aI(v,r.u_fade_change),u_matrix:new c.aJ(v,r.u_matrix),u_label_plane_matrix:new c.aJ(v,r.u_label_plane_matrix),u_coord_matrix:new c.aJ(v,r.u_coord_matrix),u_is_text:new c.aH(v,r.u_is_text),u_pitch_with_map:new c.aH(v,r.u_pitch_with_map),u_is_along_line:new c.aH(v,r.u_is_along_line),u_is_variable_anchor:new c.aH(v,r.u_is_variable_anchor),u_texsize:new c.aO(v,r.u_texsize),u_texture:new c.aH(v,r.u_texture),u_gamma_scale:new c.aI(v,r.u_gamma_scale),u_device_pixel_ratio:new c.aI(v,r.u_device_pixel_ratio),u_is_halo:new c.aH(v,r.u_is_halo),u_translation:new c.aO(v,r.u_translation),u_pitched_scale:new c.aI(v,r.u_pitched_scale)}),symbolTextAndIcon:(v,r)=>({u_is_size_zoom_constant:new c.aH(v,r.u_is_size_zoom_constant),u_is_size_feature_constant:new c.aH(v,r.u_is_size_feature_constant),u_size_t:new c.aI(v,r.u_size_t),u_size:new c.aI(v,r.u_size),u_camera_to_center_distance:new c.aI(v,r.u_camera_to_center_distance),u_pitch:new c.aI(v,r.u_pitch),u_rotate_symbol:new c.aH(v,r.u_rotate_symbol),u_aspect_ratio:new c.aI(v,r.u_aspect_ratio),u_fade_change:new c.aI(v,r.u_fade_change),u_matrix:new c.aJ(v,r.u_matrix),u_label_plane_matrix:new c.aJ(v,r.u_label_plane_matrix),u_coord_matrix:new c.aJ(v,r.u_coord_matrix),u_is_text:new c.aH(v,r.u_is_text),u_pitch_with_map:new c.aH(v,r.u_pitch_with_map),u_is_along_line:new c.aH(v,r.u_is_along_line),u_is_variable_anchor:new c.aH(v,r.u_is_variable_anchor),u_texsize:new c.aO(v,r.u_texsize),u_texsize_icon:new c.aO(v,r.u_texsize_icon),u_texture:new c.aH(v,r.u_texture),u_texture_icon:new c.aH(v,r.u_texture_icon),u_gamma_scale:new c.aI(v,r.u_gamma_scale),u_device_pixel_ratio:new c.aI(v,r.u_device_pixel_ratio),u_is_halo:new c.aH(v,r.u_is_halo),u_translation:new c.aO(v,r.u_translation),u_pitched_scale:new c.aI(v,r.u_pitched_scale)}),background:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix),u_opacity:new c.aI(v,r.u_opacity),u_color:new c.aL(v,r.u_color)}),backgroundPattern:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix),u_opacity:new c.aI(v,r.u_opacity),u_image:new c.aH(v,r.u_image),u_pattern_tl_a:new c.aO(v,r.u_pattern_tl_a),u_pattern_br_a:new c.aO(v,r.u_pattern_br_a),u_pattern_tl_b:new c.aO(v,r.u_pattern_tl_b),u_pattern_br_b:new c.aO(v,r.u_pattern_br_b),u_texsize:new c.aO(v,r.u_texsize),u_mix:new c.aI(v,r.u_mix),u_pattern_size_a:new c.aO(v,r.u_pattern_size_a),u_pattern_size_b:new c.aO(v,r.u_pattern_size_b),u_scale_a:new c.aI(v,r.u_scale_a),u_scale_b:new c.aI(v,r.u_scale_b),u_pixel_coord_upper:new c.aO(v,r.u_pixel_coord_upper),u_pixel_coord_lower:new c.aO(v,r.u_pixel_coord_lower),u_tile_units_to_pixels:new c.aI(v,r.u_tile_units_to_pixels)}),terrain:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix),u_texture:new c.aH(v,r.u_texture),u_ele_delta:new c.aI(v,r.u_ele_delta),u_fog_matrix:new c.aJ(v,r.u_fog_matrix),u_fog_color:new c.aL(v,r.u_fog_color),u_fog_ground_blend:new c.aI(v,r.u_fog_ground_blend),u_fog_ground_blend_opacity:new c.aI(v,r.u_fog_ground_blend_opacity),u_horizon_color:new c.aL(v,r.u_horizon_color),u_horizon_fog_blend:new c.aI(v,r.u_horizon_fog_blend)}),terrainDepth:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix),u_ele_delta:new c.aI(v,r.u_ele_delta)}),terrainCoords:(v,r)=>({u_matrix:new c.aJ(v,r.u_matrix),u_texture:new c.aH(v,r.u_texture),u_terrain_coords_id:new c.aI(v,r.u_terrain_coords_id),u_ele_delta:new c.aI(v,r.u_ele_delta)}),sky:(v,r)=>({u_sky_color:new c.aL(v,r.u_sky_color),u_horizon_color:new c.aL(v,r.u_horizon_color),u_horizon:new c.aI(v,r.u_horizon),u_sky_horizon_blend:new c.aI(v,r.u_sky_horizon_blend)})};class ko{constructor(r,a,p){this.context=r;const f=r.gl;this.buffer=f.createBuffer(),this.dynamicDraw=!!p,this.context.unbindVAO(),r.bindElementBuffer.set(this.buffer),f.bufferData(f.ELEMENT_ARRAY_BUFFER,a.arrayBuffer,this.dynamicDraw?f.DYNAMIC_DRAW:f.STATIC_DRAW),this.dynamicDraw||delete a.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(r){const a=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),a.bufferSubData(a.ELEMENT_ARRAY_BUFFER,0,r.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const ny={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class nh{constructor(r,a,p,f){this.length=a.length,this.attributes=p,this.itemSize=a.bytesPerElement,this.dynamicDraw=f,this.context=r;const _=r.gl;this.buffer=_.createBuffer(),r.bindVertexBuffer.set(this.buffer),_.bufferData(_.ARRAY_BUFFER,a.arrayBuffer,this.dynamicDraw?_.DYNAMIC_DRAW:_.STATIC_DRAW),this.dynamicDraw||delete a.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(r){if(r.length!==this.length)throw new Error(`Length of new data is ${r.length}, which doesn't match current length of ${this.length}`);const a=this.context.gl;this.bind(),a.bufferSubData(a.ARRAY_BUFFER,0,r.arrayBuffer)}enableAttributes(r,a){for(let p=0;p0){const De=c.H();c.aQ(De,ae.placementInvProjMatrix,v.transform.glCoordMatrix),c.aQ(De,De,ae.placementViewportMatrix),C.push({circleArray:Pe,circleOffset:O,transform:we.posMatrix,invTransform:De,coord:we}),z+=Pe.length/4,O=z}Ce&&k.draw(_,S.LINES,er.disabled,Ar.disabled,v.colorModeForRenderPass(),kr.disabled,{u_matrix:we.posMatrix,u_pixel_extrude_scale:[1/(B=v.transform).width,1/B.height]},v.style.map.terrain&&v.style.map.terrain.getTerrainData(we),a.id,Ce.layoutVertexBuffer,Ce.indexBuffer,Ce.segments,null,v.transform.zoom,null,null,Ce.collisionVertexBuffer)}var B;if(!f||!C.length)return;const K=v.useProgram("collisionCircle"),Q=new c.aR;Q.resize(4*z),Q._trim();let re=0;for(const me of C)for(let we=0;we=0&&(me[ae.associatedIconIndex]={shiftedAnchor:Ut,angle:Lr})}else Dt(ae.numGlyphs,ce)}if(z){fe.clear();const we=v.icon.placedSymbolArray;for(let ae=0;aev.style.map.terrain.getElevation(ht,Sa,Ea):null,Rs=a.layout.get("text-rotation-alignment")==="map";ee(Ct,ht.posMatrix,v,f,wa,ba,me,z,Rs,ce,ht.toUnwrapped(),re.width,re.height,Bi,or)}const Ni=ht.posMatrix,$i=f&&ot||Oh,ss=we||$i?dl:wa,io=Bu,kn=yt&&a.paint.get(f?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let Dn;Dn=yt?Ct.iconsInText?eh(Ut.kind,nr,ae,me,we,$i,v,Ni,ss,io,Bi,Mn,Vn,xt):ul(Ut.kind,nr,ae,me,we,$i,v,Ni,ss,io,Bi,f,Mn,!0,xt):Sp(Ut.kind,nr,ae,me,we,$i,v,Ni,ss,io,Bi,f,Mn,xt);const vi={program:Yt,buffers:Ht,uniformValues:Dn,atlasTexture:no,atlasTextureIcon:zn,atlasInterpolation:Or,atlasInterpolationIcon:ni,isSDF:yt,hasHalo:kn};if(Pe&&Ct.canOverlap){De=!0;const or=Ht.segments.get();for(const Rs of or)mt.push({segments:new c.a0([Rs]),sortKey:Rs.sortKey,state:vi,terrainData:Fr})}else mt.push({segments:Ht.segments,sortKey:0,state:vi,terrainData:Fr})}De&&mt.sort((ht,ct)=>ht.sortKey-ct.sortKey);for(const ht of mt){const ct=ht.state;if(K.activeTexture.set(Q.TEXTURE0),ct.atlasTexture.bind(ct.atlasInterpolation,Q.CLAMP_TO_EDGE),ct.atlasTextureIcon&&(K.activeTexture.set(Q.TEXTURE1),ct.atlasTextureIcon&&ct.atlasTextureIcon.bind(ct.atlasInterpolationIcon,Q.CLAMP_TO_EDGE)),ct.isSDF){const Ct=ct.uniformValues;ct.hasHalo&&(Ct.u_is_halo=1,ph(ct.buffers,ht.segments,a,v,ct.program,Xe,O,B,Ct,ht.terrainData)),Ct.u_is_halo=0}ph(ct.buffers,ht.segments,a,v,ct.program,Xe,O,B,ct.uniformValues,ht.terrainData)}}function ph(v,r,a,p,f,_,S,k,C,z){const O=p.context;f.draw(O,O.gl.TRIANGLES,_,S,k,kr.disabled,C,z,a.id,v.layoutVertexBuffer,v.indexBuffer,r,a.paint,p.transform.zoom,v.programConfigurations.get(a.id),v.dynamicLayoutVertexBuffer,v.opacityVertexBuffer)}function fh(v,r,a,p){const f=v.context,_=f.gl,S=Ar.disabled,k=new en([_.ONE,_.ONE],c.aM.transparent,[!0,!0,!0,!0]),C=r.getBucket(a);if(!C)return;const z=p.key;let O=a.heatmapFbos.get(z);O||(O=pl(f,r.tileSize,r.tileSize),a.heatmapFbos.set(z,O)),f.bindFramebuffer.set(O.framebuffer),f.viewport.set([0,0,r.tileSize,r.tileSize]),f.clear({color:c.aM.transparent});const B=C.programConfigurations.get(a.id),K=v.useProgram("heatmap",B),Q=v.style.map.terrain.getTerrainData(p);K.draw(f,_.TRIANGLES,er.disabled,S,k,kr.disabled,ri(p.posMatrix,r,v.transform.zoom,a.paint.get("heatmap-intensity")),Q,a.id,C.layoutVertexBuffer,C.indexBuffer,C.segments,a.paint,v.transform.zoom,B)}function As(v,r,a){const p=v.context,f=p.gl;p.setColorMode(v.colorModeForRenderPass());const _=fl(p,r),S=a.key,k=r.heatmapFbos.get(S);k&&(p.activeTexture.set(f.TEXTURE0),f.bindTexture(f.TEXTURE_2D,k.colorAttachment.get()),p.activeTexture.set(f.TEXTURE1),_.bind(f.LINEAR,f.CLAMP_TO_EDGE),v.useProgram("heatmapTexture").draw(p,f.TRIANGLES,er.disabled,Ar.disabled,v.colorModeForRenderPass(),kr.disabled,hu(v,r,0,1),null,r.id,v.rasterBoundsBuffer,v.quadTriangleIndexBuffer,v.rasterBoundsSegments,r.paint,v.transform.zoom),k.destroy(),r.heatmapFbos.delete(S))}function pl(v,r,a){var p,f;const _=v.gl,S=_.createTexture();_.bindTexture(_.TEXTURE_2D,S),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_S,_.CLAMP_TO_EDGE),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_T,_.CLAMP_TO_EDGE),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_MIN_FILTER,_.LINEAR),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_MAG_FILTER,_.LINEAR);const k=(p=v.HALF_FLOAT)!==null&&p!==void 0?p:_.UNSIGNED_BYTE,C=(f=v.RGBA16F)!==null&&f!==void 0?f:_.RGBA;_.texImage2D(_.TEXTURE_2D,0,C,r,a,0,_.RGBA,k,null);const z=v.createFramebuffer(r,a,!1,!1);return z.colorAttachment.set(S),z}function fl(v,r){return r.colorRampTexture||(r.colorRampTexture=new it(v,r.colorRamp,v.gl.RGBA)),r.colorRampTexture}function sa(v,r,a,p,f){if(!a||!p||!p.imageAtlas)return;const _=p.imageAtlas.patternPositions;let S=_[a.to.toString()],k=_[a.from.toString()];if(!S&&k&&(S=k),!k&&S&&(k=S),!S||!k){const C=f.getPaintProperty(r);S=_[C],k=_[C]}S&&k&&v.setConstantPatternPositions(S,k)}function ml(v,r,a,p,f,_,S){const k=v.context.gl,C="fill-pattern",z=a.paint.get(C),O=z&&z.constantOr(1),B=a.getCrossfadeParameters();let K,Q,re,ce,fe;S?(Q=O&&!a.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",K=k.LINES):(Q=O?"fillPattern":"fill",K=k.TRIANGLES);const me=z.constantOr(null);for(const we of p){const ae=r.getTile(we);if(O&&!ae.patternsLoaded())continue;const Ce=ae.getBucket(a);if(!Ce)continue;const Pe=Ce.programConfigurations.get(a.id),De=v.useProgram(Q,Pe),Xe=v.style.map.terrain&&v.style.map.terrain.getTerrainData(we);O&&(v.context.activeTexture.set(k.TEXTURE0),ae.imageAtlasTexture.bind(k.LINEAR,k.CLAMP_TO_EDGE),Pe.updatePaintBuffers(B)),sa(Pe,C,me,ae,a);const ot=Xe?we:null,mt=v.translatePosMatrix(ot?ot.posMatrix:we.posMatrix,ae,a.paint.get("fill-translate"),a.paint.get("fill-translate-anchor"));if(S){ce=Ce.indexBuffer2,fe=Ce.segments2;const xt=[k.drawingBufferWidth,k.drawingBufferHeight];re=Q==="fillOutlinePattern"&&O?vp(mt,v,B,ae,xt):Jg(mt,xt)}else ce=Ce.indexBuffer,fe=Ce.segments,re=O?_p(mt,v,B,ae):ra(mt);De.draw(v.context,K,f,v.stencilModeForClipping(we),_,kr.disabled,re,Xe,a.id,Ce.layoutVertexBuffer,ce,fe,a.paint,v.transform.zoom,Pe)}}function xu(v,r,a,p,f,_,S){const k=v.context,C=k.gl,z="fill-extrusion-pattern",O=a.paint.get(z),B=O.constantOr(1),K=a.getCrossfadeParameters(),Q=a.paint.get("fill-extrusion-opacity"),re=O.constantOr(null);for(const ce of p){const fe=r.getTile(ce),me=fe.getBucket(a);if(!me)continue;const we=v.style.map.terrain&&v.style.map.terrain.getTerrainData(ce),ae=me.programConfigurations.get(a.id),Ce=v.useProgram(B?"fillExtrusionPattern":"fillExtrusion",ae);B&&(v.context.activeTexture.set(C.TEXTURE0),fe.imageAtlasTexture.bind(C.LINEAR,C.CLAMP_TO_EDGE),ae.updatePaintBuffers(K)),sa(ae,z,re,fe,a);const Pe=v.translatePosMatrix(ce.posMatrix,fe,a.paint.get("fill-extrusion-translate"),a.paint.get("fill-extrusion-translate-anchor")),De=a.paint.get("fill-extrusion-vertical-gradient"),Xe=B?cu(Pe,v,De,Q,ce,K,fe):al(Pe,v,De,Q);Ce.draw(k,k.gl.TRIANGLES,f,_,S,kr.backCCW,Xe,we,a.id,me.layoutVertexBuffer,me.indexBuffer,me.segments,a.paint,v.transform.zoom,ae,v.style.map.terrain&&me.centroidVertexBuffer)}}function aa(v,r,a,p,f,_,S){const k=v.context,C=k.gl,z=a.fbo;if(!z)return;const O=v.useProgram("hillshade"),B=v.style.map.terrain&&v.style.map.terrain.getTerrainData(r);k.activeTexture.set(C.TEXTURE0),C.bindTexture(C.TEXTURE_2D,z.colorAttachment.get()),O.draw(k,C.TRIANGLES,f,_,S,kr.disabled,((K,Q,re,ce)=>{const fe=re.paint.get("hillshade-shadow-color"),me=re.paint.get("hillshade-highlight-color"),we=re.paint.get("hillshade-accent-color");let ae=re.paint.get("hillshade-illumination-direction")*(Math.PI/180);re.paint.get("hillshade-illumination-anchor")==="viewport"&&(ae-=K.transform.angle);const Ce=!K.options.moving;return{u_matrix:ce?ce.posMatrix:K.transform.calculatePosMatrix(Q.tileID.toUnwrapped(),Ce),u_image:0,u_latrange:du(0,Q.tileID),u_light:[re.paint.get("hillshade-exaggeration"),ae],u_shadow:fe,u_highlight:me,u_accent:we}})(v,a,p,B?r:null),B,p.id,v.rasterBoundsBuffer,v.quadTriangleIndexBuffer,v.rasterBoundsSegments)}function la(v,r,a,p,f,_){const S=v.context,k=S.gl,C=r.dem;if(C&&C.data){const z=C.dim,O=C.stride,B=C.getPixels();if(S.activeTexture.set(k.TEXTURE1),S.pixelStoreUnpackPremultiplyAlpha.set(!1),r.demTexture=r.demTexture||v.getTileTexture(O),r.demTexture){const Q=r.demTexture;Q.update(B,{premultiply:!1}),Q.bind(k.NEAREST,k.CLAMP_TO_EDGE)}else r.demTexture=new it(S,B,k.RGBA,{premultiply:!1}),r.demTexture.bind(k.NEAREST,k.CLAMP_TO_EDGE);S.activeTexture.set(k.TEXTURE0);let K=r.fbo;if(!K){const Q=new it(S,{width:z,height:z,data:null},k.RGBA);Q.bind(k.LINEAR,k.CLAMP_TO_EDGE),K=r.fbo=S.createFramebuffer(z,z,!0,!1),K.colorAttachment.set(Q.texture)}S.bindFramebuffer.set(K.framebuffer),S.viewport.set([0,0,z,z]),v.useProgram("hillshadePrepare").draw(S,k.TRIANGLES,p,f,_,kr.disabled,((Q,re)=>{const ce=re.stride,fe=c.H();return c.aP(fe,0,c.X,-c.X,0,0,1),c.J(fe,fe,[0,-c.X,0]),{u_matrix:fe,u_image:1,u_dimension:[ce,ce],u_zoom:Q.overscaledZ,u_unpack:re.getUnpackVector()}})(r.tileID,C),null,a.id,v.rasterBoundsBuffer,v.quadTriangleIndexBuffer,v.rasterBoundsSegments),r.needsHillshadePrepare=!1}}function Fp(v,r,a,p,f,_){const S=p.paint.get("raster-fade-duration");if(!_&&S>0){const k=D.now(),C=(k-v.timeAdded)/S,z=r?(k-r.timeAdded)/S:-1,O=a.getSource(),B=f.coveringZoomLevel({tileSize:O.tileSize,roundZoom:O.roundZoom}),K=!r||Math.abs(r.tileID.overscaledZ-B)>Math.abs(v.tileID.overscaledZ-B),Q=K&&v.refreshedUponExpiration?1:c.ac(K?C:1-z,0,1);return v.refreshedUponExpiration&&C>=1&&(v.refreshedUponExpiration=!1),r?{opacity:1,mix:1-Q}:{opacity:Q,mix:0}}return{opacity:1,mix:0}}const mh=new c.aM(1,0,0,1),fr=new c.aM(0,1,0,1),wu=new c.aM(0,0,1,1),py=new c.aM(1,0,1,1),Op=new c.aM(0,1,1,1);function ua(v,r,a,p){bu(v,0,r+a/2,v.transform.width,a,p)}function Bp(v,r,a,p){bu(v,r-a/2,0,a,v.transform.height,p)}function bu(v,r,a,p,f,_){const S=v.context,k=S.gl;k.enable(k.SCISSOR_TEST),k.scissor(r*v.pixelRatio,a*v.pixelRatio,p*v.pixelRatio,f*v.pixelRatio),S.clear({color:_}),k.disable(k.SCISSOR_TEST)}function Np(v,r,a){const p=v.context,f=p.gl,_=a.posMatrix,S=v.useProgram("debug"),k=er.disabled,C=Ar.disabled,z=v.colorModeForRenderPass(),O="$debug",B=v.style.map.terrain&&v.style.map.terrain.getTerrainData(a);p.activeTexture.set(f.TEXTURE0);const K=r.getTileByID(a.key).latestRawTileData,Q=Math.floor((K&&K.byteLength||0)/1024),re=r.getTile(a).tileSize,ce=512/Math.min(re,512)*(a.overscaledZ/v.transform.zoom)*.5;let fe=a.canonical.toString();a.overscaledZ!==a.canonical.z&&(fe+=` => ${a.overscaledZ}`),function(me,we){me.initDebugOverlayCanvas();const ae=me.debugOverlayCanvas,Ce=me.context.gl,Pe=me.debugOverlayCanvas.getContext("2d");Pe.clearRect(0,0,ae.width,ae.height),Pe.shadowColor="white",Pe.shadowBlur=2,Pe.lineWidth=1.5,Pe.strokeStyle="white",Pe.textBaseline="top",Pe.font="bold 36px Open Sans, sans-serif",Pe.fillText(we,5,5),Pe.strokeText(we,5,5),me.debugOverlayTexture.update(ae),me.debugOverlayTexture.bind(Ce.LINEAR,Ce.CLAMP_TO_EDGE)}(v,`${fe} ${Q}kB`),S.draw(p,f.TRIANGLES,k,C,en.alphaBlended,kr.disabled,ll(_,c.aM.transparent,ce),null,O,v.debugBuffer,v.quadTriangleIndexBuffer,v.debugSegments),S.draw(p,f.LINE_STRIP,k,C,z,kr.disabled,ll(_,c.aM.red),B,O,v.debugBuffer,v.tileBorderIndexBuffer,v.debugSegments)}function $p(v,r,a){const p=v.context,f=p.gl,_=v.colorModeForRenderPass(),S=new er(f.LEQUAL,er.ReadWrite,v.depthRangeFor3D),k=v.useProgram("terrain"),C=r.getTerrainMesh();p.bindFramebuffer.set(null),p.viewport.set([0,0,v.width,v.height]);for(const z of a){const O=v.renderToTexture.getTexture(z),B=r.getTerrainData(z.tileID);p.activeTexture.set(f.TEXTURE0),f.bindTexture(f.TEXTURE_2D,O.texture);const K=v.transform.calculatePosMatrix(z.tileID.toUnwrapped()),Q=r.getMeshFrameDelta(v.transform.zoom),re=v.transform.calculateFogMatrix(z.tileID.toUnwrapped()),ce=Jc(K,Q,re,v.style.sky,v.transform.pitch);k.draw(p,f.TRIANGLES,S,Ar.disabled,_,kr.backCCW,ce,B,"terrain",C.vertexBuffer,C.indexBuffer,C.segments)}}class Su{constructor(r,a,p){this.vertexBuffer=r,this.indexBuffer=a,this.segments=p}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}class Eu{constructor(r,a){this.context=new dy(r),this.transform=a,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:c.an(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Bt.maxUnderzooming+Bt.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Kc}resize(r,a,p){if(this.width=Math.floor(r*p),this.height=Math.floor(a*p),this.pixelRatio=p,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const f of this.style._order)this.style._layers[f].resize()}setup(){const r=this.context,a=new c.aX;a.emplaceBack(0,0),a.emplaceBack(c.X,0),a.emplaceBack(0,c.X),a.emplaceBack(c.X,c.X),this.tileExtentBuffer=r.createVertexBuffer(a,Ss.members),this.tileExtentSegments=c.a0.simpleSegment(0,0,4,2);const p=new c.aX;p.emplaceBack(0,0),p.emplaceBack(c.X,0),p.emplaceBack(0,c.X),p.emplaceBack(c.X,c.X),this.debugBuffer=r.createVertexBuffer(p,Ss.members),this.debugSegments=c.a0.simpleSegment(0,0,4,5);const f=new c.$;f.emplaceBack(0,0,0,0),f.emplaceBack(c.X,0,c.X,0),f.emplaceBack(0,c.X,0,c.X),f.emplaceBack(c.X,c.X,c.X,c.X),this.rasterBoundsBuffer=r.createVertexBuffer(f,Ne.members),this.rasterBoundsSegments=c.a0.simpleSegment(0,0,4,2);const _=new c.aX;_.emplaceBack(0,0),_.emplaceBack(1,0),_.emplaceBack(0,1),_.emplaceBack(1,1),this.viewportBuffer=r.createVertexBuffer(_,Ss.members),this.viewportSegments=c.a0.simpleSegment(0,0,4,2);const S=new c.aZ;S.emplaceBack(0),S.emplaceBack(1),S.emplaceBack(3),S.emplaceBack(2),S.emplaceBack(0),this.tileBorderIndexBuffer=r.createIndexBuffer(S);const k=new c.aY;k.emplaceBack(0,1,2),k.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=r.createIndexBuffer(k);const C=this.context.gl;this.stencilClearMode=new Ar({func:C.ALWAYS,mask:0},0,255,C.ZERO,C.ZERO,C.ZERO)}clearStencil(){const r=this.context,a=r.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const p=c.H();c.aP(p,0,this.width,this.height,0,0,1),c.K(p,p,[a.drawingBufferWidth,a.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(r,a.TRIANGLES,er.disabled,this.stencilClearMode,en.disabled,kr.disabled,ti(p),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(r,a){if(this.currentStencilSource===r.source||!r.isTileClipped()||!a||!a.length)return;this.currentStencilSource=r.source;const p=this.context,f=p.gl;this.nextStencilID+a.length>256&&this.clearStencil(),p.setColorMode(en.disabled),p.setDepthMode(er.disabled);const _=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const S of a){const k=this._tileClippingMaskIDs[S.key]=this.nextStencilID++,C=this.style.map.terrain&&this.style.map.terrain.getTerrainData(S);_.draw(p,f.TRIANGLES,er.disabled,new Ar({func:f.ALWAYS,mask:0},k,255,f.KEEP,f.KEEP,f.REPLACE),en.disabled,kr.disabled,ti(S.posMatrix),C,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const r=this.nextStencilID++,a=this.context.gl;return new Ar({func:a.NOTEQUAL,mask:255},r,255,a.KEEP,a.KEEP,a.REPLACE)}stencilModeForClipping(r){const a=this.context.gl;return new Ar({func:a.EQUAL,mask:255},this._tileClippingMaskIDs[r.key],0,a.KEEP,a.KEEP,a.REPLACE)}stencilConfigForOverlap(r){const a=this.context.gl,p=r.sort((S,k)=>k.overscaledZ-S.overscaledZ),f=p[p.length-1].overscaledZ,_=p[0].overscaledZ-f+1;if(_>1){this.currentStencilSource=void 0,this.nextStencilID+_>256&&this.clearStencil();const S={};for(let k=0;k<_;k++)S[k+f]=new Ar({func:a.GEQUAL,mask:255},k+this.nextStencilID,255,a.KEEP,a.KEEP,a.REPLACE);return this.nextStencilID+=_,[S,p]}return[{[f]:Ar.disabled},p]}colorModeForRenderPass(){const r=this.context.gl;return this._showOverdrawInspector?new en([r.CONSTANT_COLOR,r.ONE],new c.aM(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?en.unblended:en.alphaBlended}depthModeForSublayer(r,a,p){if(!this.opaquePassEnabledForLayer())return er.disabled;const f=1-((1+this.currentLayer)*this.numSublayers+r)*this.depthEpsilon;return new er(p||this.context.gl.LEQUAL,a,[f,f])}opaquePassEnabledForLayer(){return this.currentLayer({u_sky_color:me.properties.get("sky-color"),u_horizon_color:me.properties.get("horizon-color"),u_horizon:(we.height/2+we.getHorizon())*ae,u_sky_horizon_blend:me.properties.get("sky-horizon-blend")*we.height/2*ae}))(z,C.style.map.transform,C.pixelRatio),Q=new er(B.LEQUAL,er.ReadWrite,[0,1]),re=Ar.disabled,ce=C.colorModeForRenderPass(),fe=C.useProgram("sky");if(!z.mesh){const me=new c.aX;me.emplaceBack(-1,-1),me.emplaceBack(1,-1),me.emplaceBack(1,1),me.emplaceBack(-1,1);const we=new c.aY;we.emplaceBack(0,1,2),we.emplaceBack(0,2,3),z.mesh=new Su(O.createVertexBuffer(me,Ss.members),O.createIndexBuffer(we),c.a0.simpleSegment(0,0,me.length,we.length))}fe.draw(O,B.TRIANGLES,Q,re,ce,kr.disabled,K,void 0,"sky",z.mesh.vertexBuffer,z.mesh.indexBuffer,z.mesh.segments)}(this,this.style.sky),this._showOverdrawInspector=a.showOverdrawInspector,this.depthRangeFor3D=[0,1-(r._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=p.length-1;this.currentLayer>=0;this.currentLayer--){const C=this.style._layers[p[this.currentLayer]],z=f[C.source],O=_[C.source];this._renderTileClippingMasks(C,O),this.renderLayer(this,z,C,O)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayerfe.source&&!fe.isHidden(O)?[z.sourceCaches[fe.source]]:[]),Q=K.filter(fe=>fe.getSource().type==="vector"),re=K.filter(fe=>fe.getSource().type!=="vector"),ce=fe=>{(!B||B.getSource().maxzoomce(fe)),B||re.forEach(fe=>ce(fe)),B}(this.style,this.transform.zoom);C&&function(z,O,B){for(let K=0;K0),f&&(c.b0(a,p),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(_,S){const k=_.context,C=k.gl,z=en.unblended,O=new er(C.LEQUAL,er.ReadWrite,[0,1]),B=S.getTerrainMesh(),K=S.sourceCache.getRenderableTiles(),Q=_.useProgram("terrainDepth");k.bindFramebuffer.set(S.getFramebuffer("depth").framebuffer),k.viewport.set([0,0,_.width/devicePixelRatio,_.height/devicePixelRatio]),k.clear({color:c.aM.transparent,depth:1});for(const re of K){const ce=S.getTerrainData(re.tileID),fe={u_matrix:_.transform.calculatePosMatrix(re.tileID.toUnwrapped()),u_ele_delta:S.getMeshFrameDelta(_.transform.zoom)};Q.draw(k,C.TRIANGLES,O,Ar.disabled,z,kr.backCCW,fe,ce,"terrain",B.vertexBuffer,B.indexBuffer,B.segments)}k.bindFramebuffer.set(null),k.viewport.set([0,0,_.width,_.height])}(this,this.style.map.terrain),function(_,S){const k=_.context,C=k.gl,z=en.unblended,O=new er(C.LEQUAL,er.ReadWrite,[0,1]),B=S.getTerrainMesh(),K=S.getCoordsTexture(),Q=S.sourceCache.getRenderableTiles(),re=_.useProgram("terrainCoords");k.bindFramebuffer.set(S.getFramebuffer("coords").framebuffer),k.viewport.set([0,0,_.width/devicePixelRatio,_.height/devicePixelRatio]),k.clear({color:c.aM.transparent,depth:1}),S.coordsIndex=[];for(const ce of Q){const fe=S.getTerrainData(ce.tileID);k.activeTexture.set(C.TEXTURE0),C.bindTexture(C.TEXTURE_2D,K.texture);const me={u_matrix:_.transform.calculatePosMatrix(ce.tileID.toUnwrapped()),u_terrain_coords_id:(255-S.coordsIndex.length)/255,u_texture:0,u_ele_delta:S.getMeshFrameDelta(_.transform.zoom)};re.draw(k,C.TRIANGLES,O,Ar.disabled,z,kr.backCCW,me,fe,"terrain",B.vertexBuffer,B.indexBuffer,B.segments),S.coordsIndex.push(ce.tileID.key)}k.bindFramebuffer.set(null),k.viewport.set([0,0,_.width,_.height])}(this,this.style.map.terrain))}renderLayer(r,a,p,f){if(!p.isHidden(this.transform.zoom)&&(p.type==="background"||p.type==="custom"||(f||[]).length))switch(this.id=p.id,p.type){case"symbol":(function(_,S,k,C,z){if(_.renderPass!=="translucent")return;const O=Ar.disabled,B=_.colorModeForRenderPass();(k._unevaluatedLayout.hasValue("text-variable-anchor")||k._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(K,Q,re,ce,fe,me,we,ae,Ce){const Pe=Q.transform,De=bs(),Xe=fe==="map",ot=me==="map";for(const mt of K){const xt=ce.getTile(mt),ht=xt.getBucket(re);if(!ht||!ht.text||!ht.text.segments.get().length)continue;const ct=c.ag(ht.textSizeData,Pe.zoom),Ct=rr(xt,1,Q.transform.zoom),Ht=Yi(mt.posMatrix,ot,Xe,Q.transform,Ct),dt=re.layout.get("icon-text-fit")!=="none"&&ht.hasIconData();if(ct){const yt=Math.pow(2,Pe.zoom-xt.tileID.overscaledZ),Ut=Q.style.map.terrain?(Yt,nr)=>Q.style.map.terrain.getElevation(mt,Yt,nr):null,Lr=De.translatePosition(Pe,xt,we,ae);oa(ht,Xe,ot,Ce,Pe,Ht,mt.posMatrix,yt,ct,dt,De,Lr,mt.toUnwrapped(),Ut)}}}(C,_,k,S,k.layout.get("text-rotation-alignment"),k.layout.get("text-pitch-alignment"),k.paint.get("text-translate"),k.paint.get("text-translate-anchor"),z),k.paint.get("icon-opacity").constantOr(1)!==0&&dh(_,S,k,C,!1,k.paint.get("icon-translate"),k.paint.get("icon-translate-anchor"),k.layout.get("icon-rotation-alignment"),k.layout.get("icon-pitch-alignment"),k.layout.get("icon-keep-upright"),O,B),k.paint.get("text-opacity").constantOr(1)!==0&&dh(_,S,k,C,!0,k.paint.get("text-translate"),k.paint.get("text-translate-anchor"),k.layout.get("text-rotation-alignment"),k.layout.get("text-pitch-alignment"),k.layout.get("text-keep-upright"),O,B),S.map.showCollisionBoxes&&(hl(_,S,k,C,!0),hl(_,S,k,C,!1))})(r,a,p,f,this.style.placement.variableOffsets);break;case"circle":(function(_,S,k,C){if(_.renderPass!=="translucent")return;const z=k.paint.get("circle-opacity"),O=k.paint.get("circle-stroke-width"),B=k.paint.get("circle-stroke-opacity"),K=!k.layout.get("circle-sort-key").isConstant();if(z.constantOr(1)===0&&(O.constantOr(1)===0||B.constantOr(1)===0))return;const Q=_.context,re=Q.gl,ce=_.depthModeForSublayer(0,er.ReadOnly),fe=Ar.disabled,me=_.colorModeForRenderPass(),we=[];for(let ae=0;aeae.sortKey-Ce.sortKey);for(const ae of we){const{programConfiguration:Ce,program:Pe,layoutVertexBuffer:De,indexBuffer:Xe,uniformValues:ot,terrainData:mt}=ae.state;Pe.draw(Q,re.TRIANGLES,ce,fe,me,kr.disabled,ot,mt,k.id,De,Xe,ae.segments,k.paint,_.transform.zoom,Ce)}})(r,a,p,f);break;case"heatmap":(function(_,S,k,C){if(k.paint.get("heatmap-opacity")===0)return;const z=_.context;if(_.style.map.terrain){for(const O of C){const B=S.getTile(O);S.hasRenderableParent(O)||(_.renderPass==="offscreen"?fh(_,B,k,O):_.renderPass==="translucent"&&As(_,k,O))}z.viewport.set([0,0,_.width,_.height])}else _.renderPass==="offscreen"?function(O,B,K,Q){const re=O.context,ce=re.gl,fe=Ar.disabled,me=new en([ce.ONE,ce.ONE],c.aM.transparent,[!0,!0,!0,!0]);(function(we,ae,Ce){const Pe=we.gl;we.activeTexture.set(Pe.TEXTURE1),we.viewport.set([0,0,ae.width/4,ae.height/4]);let De=Ce.heatmapFbos.get(c.aU);De?(Pe.bindTexture(Pe.TEXTURE_2D,De.colorAttachment.get()),we.bindFramebuffer.set(De.framebuffer)):(De=pl(we,ae.width/4,ae.height/4),Ce.heatmapFbos.set(c.aU,De))})(re,O,K),re.clear({color:c.aM.transparent});for(let we=0;we20&&O.texParameterf(O.TEXTURE_2D,z.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,z.extTextureFilterAnisotropicMax);const ht=_.style.map.terrain&&_.style.map.terrain.getTerrainData(we),ct=ht?we:null,Ct=ct?ct.posMatrix:_.transform.calculatePosMatrix(we.toUnwrapped(),me),Ht=ty(Ct,mt||[0,0],ot||1,Xe,k);B instanceof st?K.draw(z,O.TRIANGLES,ae,Ar.disabled,Q,kr.disabled,Ht,ht,k.id,B.boundsBuffer,_.quadTriangleIndexBuffer,B.boundsSegments):K.draw(z,O.TRIANGLES,ae,re[we.overscaledZ],Q,kr.disabled,Ht,ht,k.id,_.rasterBoundsBuffer,_.quadTriangleIndexBuffer,_.rasterBoundsSegments)}})(r,a,p,f);break;case"background":(function(_,S,k,C){const z=k.paint.get("background-color"),O=k.paint.get("background-opacity");if(O===0)return;const B=_.context,K=B.gl,Q=_.transform,re=Q.tileSize,ce=k.paint.get("background-pattern");if(_.isPatternMissing(ce))return;const fe=!ce&&z.a===1&&O===1&&_.opaquePassEnabledForLayer()?"opaque":"translucent";if(_.renderPass!==fe)return;const me=Ar.disabled,we=_.depthModeForSublayer(0,fe==="opaque"?er.ReadWrite:er.ReadOnly),ae=_.colorModeForRenderPass(),Ce=_.useProgram(ce?"backgroundPattern":"background"),Pe=C||Q.coveringTiles({tileSize:re,terrain:_.style.map.terrain});ce&&(B.activeTexture.set(K.TEXTURE0),_.imageManager.bind(_.context));const De=k.getCrossfadeParameters();for(const Xe of Pe){const ot=C?Xe.posMatrix:_.transform.calculatePosMatrix(Xe.toUnwrapped()),mt=ce?th(ot,O,_,ce,{tileID:Xe,tileSize:re},De):fu(ot,O,z),xt=_.style.map.terrain&&_.style.map.terrain.getTerrainData(Xe);Ce.draw(B,K.TRIANGLES,we,me,ae,kr.disabled,mt,xt,k.id,_.tileExtentBuffer,_.quadTriangleIndexBuffer,_.tileExtentSegments)}})(r,0,p,f);break;case"custom":(function(_,S,k){const C=_.context,z=k.implementation;if(_.renderPass==="offscreen"){const O=z.prerender;O&&(_.setCustomLayerDefaults(),C.setColorMode(_.colorModeForRenderPass()),O.call(z,C.gl,_.transform.customLayerMatrix()),C.setDirty(),_.setBaseState())}else if(_.renderPass==="translucent"){_.setCustomLayerDefaults(),C.setColorMode(_.colorModeForRenderPass()),C.setStencilMode(Ar.disabled);const O=z.renderingMode==="3d"?new er(_.context.gl.LEQUAL,er.ReadWrite,_.depthRangeFor3D):_.depthModeForSublayer(0,er.ReadOnly);C.setDepthMode(O),z.render(C.gl,_.transform.customLayerMatrix(),{farZ:_.transform.farZ,nearZ:_.transform.nearZ,fov:_.transform._fov,modelViewProjectionMatrix:_.transform.modelViewProjectionMatrix,projectionMatrix:_.transform.projectionMatrix}),C.setDirty(),_.setBaseState(),C.bindFramebuffer.set(null)}})(r,0,p)}}translatePosMatrix(r,a,p,f,_){if(!p[0]&&!p[1])return r;const S=_?f==="map"?this.transform.angle:0:f==="viewport"?-this.transform.angle:0;if(S){const z=Math.sin(S),O=Math.cos(S);p=[p[0]*O-p[1]*z,p[0]*z+p[1]*O]}const k=[_?p[0]:rr(a,p[0],this.transform.zoom),_?p[1]:rr(a,p[1],this.transform.zoom),0],C=new Float32Array(16);return c.J(C,r,k),C}saveTileTexture(r){const a=this._tileTextures[r.size[0]];a?a.push(r):this._tileTextures[r.size[0]]=[r]}getTileTexture(r){const a=this._tileTextures[r];return a&&a.length>0?a.pop():null}isPatternMissing(r){if(!r)return!1;if(!r.from||!r.to)return!0;const a=this.imageManager.getPattern(r.from.toString()),p=this.imageManager.getPattern(r.to.toString());return!a||!p}useProgram(r,a){this.cache=this.cache||{};const p=r+(a?a.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[p]||(this.cache[p]=new Qc(this.context,is[r],a,rh[r],this._showOverdrawInspector,this.style.map.terrain)),this.cache[p]}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 r=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(r.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new it(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:r,drawingBufferHeight:a}=this.context.gl;return this.width!==r||this.height!==a}}class ca{constructor(r,a){this.points=r,this.planes=a}static fromInvProjectionMatrix(r,a,p){const f=Math.pow(2,p),_=[[-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(k=>{const C=1/(k=c.af([],k,r))[3]/a*f;return c.b1(k,k,[C,C,1/k[3],C])}),S=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(k=>{const C=function(K,Q){var re=Q[0],ce=Q[1],fe=Q[2],me=re*re+ce*ce+fe*fe;return me>0&&(me=1/Math.sqrt(me)),K[0]=Q[0]*me,K[1]=Q[1]*me,K[2]=Q[2]*me,K}([],function(K,Q,re){var ce=Q[0],fe=Q[1],me=Q[2],we=re[0],ae=re[1],Ce=re[2];return K[0]=fe*Ce-me*ae,K[1]=me*we-ce*Ce,K[2]=ce*ae-fe*we,K}([],ge([],_[k[0]],_[k[1]]),ge([],_[k[2]],_[k[1]]))),z=-((O=C)[0]*(B=_[k[1]])[0]+O[1]*B[1]+O[2]*B[2]);var O,B;return C.concat(z)});return new ca(_,S)}}class ha{constructor(r,a){this.min=r,this.max=a,this.center=function(p,f,_){return p[0]=.5*f[0],p[1]=.5*f[1],p[2]=.5*f[2],p}([],function(p,f,_){return p[0]=f[0]+_[0],p[1]=f[1]+_[1],p[2]=f[2]+_[2],p}([],this.min,this.max))}quadrant(r){const a=[r%2==0,r<2],p=se(this.min),f=se(this.max);for(let _=0;_=0&&S++;if(S===0)return 0;S!==a.length&&(p=!1)}if(p)return 2;for(let f=0;f<3;f++){let _=Number.MAX_VALUE,S=-Number.MAX_VALUE;for(let k=0;kthis.max[f]-this.min[f])return 0}return 1}}class da{constructor(r=0,a=0,p=0,f=0){if(isNaN(r)||r<0||isNaN(a)||a<0||isNaN(p)||p<0||isNaN(f)||f<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=r,this.bottom=a,this.left=p,this.right=f}interpolate(r,a,p){return a.top!=null&&r.top!=null&&(this.top=c.y.number(r.top,a.top,p)),a.bottom!=null&&r.bottom!=null&&(this.bottom=c.y.number(r.bottom,a.bottom,p)),a.left!=null&&r.left!=null&&(this.left=c.y.number(r.left,a.left,p)),a.right!=null&&r.right!=null&&(this.right=c.y.number(r.right,a.right,p)),this}getCenter(r,a){const p=c.ac((this.left+r-this.right)/2,0,r),f=c.ac((this.top+a-this.bottom)/2,0,a);return new c.P(p,f)}equals(r){return this.top===r.top&&this.bottom===r.bottom&&this.left===r.left&&this.right===r.right}clone(){return new da(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const gh=85.051129;class pa{constructor(r,a,p,f,_){this.tileSize=512,this._renderWorldCopies=_===void 0||!!_,this._minZoom=r||0,this._maxZoom=a||22,this._minPitch=p??0,this._maxPitch=f??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new c.N(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new da,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={},this.minElevationForCurrentTile=0}clone(){const r=new pa(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return r.apply(this),r}apply(r){this.tileSize=r.tileSize,this.latRange=r.latRange,this.lngRange=r.lngRange,this.width=r.width,this.height=r.height,this._center=r._center,this._elevation=r._elevation,this.minElevationForCurrentTile=r.minElevationForCurrentTile,this.zoom=r.zoom,this.angle=r.angle,this._fov=r._fov,this._pitch=r._pitch,this._unmodified=r._unmodified,this._edgeInsets=r._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(r){this._minZoom!==r&&(this._minZoom=r,this.zoom=Math.max(this.zoom,r))}get maxZoom(){return this._maxZoom}set maxZoom(r){this._maxZoom!==r&&(this._maxZoom=r,this.zoom=Math.min(this.zoom,r))}get minPitch(){return this._minPitch}set minPitch(r){this._minPitch!==r&&(this._minPitch=r,this.pitch=Math.max(this.pitch,r))}get maxPitch(){return this._maxPitch}set maxPitch(r){this._maxPitch!==r&&(this._maxPitch=r,this.pitch=Math.min(this.pitch,r))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(r){r===void 0?r=!0:r===null&&(r=!1),this._renderWorldCopies=r}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new c.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(r){const a=-c.b3(r,-180,180)*Math.PI/180;this.angle!==a&&(this._unmodified=!1,this.angle=a,this._calcMatrices(),this.rotationMatrix=function(){var p=new c.A(4);return c.A!=Float32Array&&(p[1]=0,p[2]=0),p[0]=1,p[3]=1,p}(),function(p,f,_){var S=f[0],k=f[1],C=f[2],z=f[3],O=Math.sin(_),B=Math.cos(_);p[0]=S*B+C*O,p[1]=k*B+z*O,p[2]=S*-O+C*B,p[3]=k*-O+z*B}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(r){const a=c.ac(r,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==a&&(this._unmodified=!1,this._pitch=a,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(r){r=Math.max(.01,Math.min(60,r)),this._fov!==r&&(this._unmodified=!1,this._fov=r/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(r){const a=Math.min(Math.max(r,this.minZoom),this.maxZoom);this._zoom!==a&&(this._unmodified=!1,this._zoom=a,this.tileZoom=Math.max(0,Math.floor(a)),this.scale=this.zoomScale(a),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(r){r.lat===this._center.lat&&r.lng===this._center.lng||(this._unmodified=!1,this._center=r,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(r){r!==this._elevation&&(this._elevation=r,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(r){this._edgeInsets.equals(r)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,r,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(r){return this._edgeInsets.equals(r)}interpolatePadding(r,a,p){this._unmodified=!1,this._edgeInsets.interpolate(r,a,p),this._constrain(),this._calcMatrices()}coveringZoomLevel(r){const a=(r.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/r.tileSize));return Math.max(0,a)}getVisibleUnwrappedCoordinates(r){const a=[new c.b4(0,r)];if(this._renderWorldCopies){const p=this.pointCoordinate(new c.P(0,0)),f=this.pointCoordinate(new c.P(this.width,0)),_=this.pointCoordinate(new c.P(this.width,this.height)),S=this.pointCoordinate(new c.P(0,this.height)),k=Math.floor(Math.min(p.x,f.x,_.x,S.x)),C=Math.floor(Math.max(p.x,f.x,_.x,S.x)),z=1;for(let O=k-z;O<=C+z;O++)O!==0&&a.push(new c.b4(O,r))}return a}coveringTiles(r){var a,p;let f=this.coveringZoomLevel(r);const _=f;if(r.minzoom!==void 0&&fr.maxzoom&&(f=r.maxzoom);const S=this.pointCoordinate(this.getCameraPoint()),k=c.Z.fromLngLat(this.center),C=Math.pow(2,f),z=[C*S.x,C*S.y,0],O=[C*k.x,C*k.y,0],B=ca.fromInvProjectionMatrix(this.invModelViewProjectionMatrix,this.worldSize,f);let K=r.minzoom||0;!r.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(K=f);const Q=r.terrain?2/Math.min(this.tileSize,r.tileSize)*this.tileSize:3,re=ae=>({aabb:new ha([ae*C,0,0],[(ae+1)*C,C,0]),zoom:0,x:0,y:0,wrap:ae,fullyVisible:!1}),ce=[],fe=[],me=f,we=r.reparseOverscaled?_:f;if(this._renderWorldCopies)for(let ae=1;ae<=3;ae++)ce.push(re(-ae)),ce.push(re(ae));for(ce.push(re(0));ce.length>0;){const ae=ce.pop(),Ce=ae.x,Pe=ae.y;let De=ae.fullyVisible;if(!De){const ht=ae.aabb.intersects(B);if(ht===0)continue;De=ht===2}const Xe=r.terrain?z:O,ot=ae.aabb.distanceX(Xe),mt=ae.aabb.distanceY(Xe),xt=Math.max(Math.abs(ot),Math.abs(mt));if(ae.zoom===me||xt>Q+(1<=K){const ht=me-ae.zoom,ct=z[0]-.5-(Ce<>1),Ht=ae.zoom+1;let dt=ae.aabb.quadrant(ht);if(r.terrain){const yt=new c.S(Ht,ae.wrap,Ht,ct,Ct),Ut=r.terrain.getMinMaxElevation(yt),Lr=(a=Ut.minElevation)!==null&&a!==void 0?a:this.elevation,Yt=(p=Ut.maxElevation)!==null&&p!==void 0?p:this.elevation;dt=new ha([dt.min[0],dt.min[1],Lr],[dt.max[0],dt.max[1],Yt])}ce.push({aabb:dt,zoom:Ht,x:ct,y:Ct,wrap:ae.wrap,fullyVisible:De})}}return fe.sort((ae,Ce)=>ae.distanceSq-Ce.distanceSq).map(ae=>ae.tileID)}resize(r,a){this.width=r,this.height=a,this.pixelsToGLUnits=[2/r,-2/a],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(r){return Math.pow(2,r)}scaleZoom(r){return Math.log(r)/Math.LN2}project(r){const a=c.ac(r.lat,-85.051129,gh);return new c.P(c.O(r.lng)*this.worldSize,c.Q(a)*this.worldSize)}unproject(r){return new c.Z(r.x/this.worldSize,r.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(r){const a=this.elevation,p=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,f=this.pointLocation(this.centerPoint,r),_=r.getElevationForLngLatZoom(f,this.tileZoom);if(!(this.elevation-_))return;const S=p+a-_,k=Math.cos(this._pitch)*this.cameraToCenterDistance/S/c.b5(1,f.lat),C=this.scaleZoom(k/this.tileSize);this._elevation=_,this._center=f,this.zoom=C}setLocationAtPoint(r,a){const p=this.pointCoordinate(a),f=this.pointCoordinate(this.centerPoint),_=this.locationCoordinate(r),S=new c.Z(_.x-(p.x-f.x),_.y-(p.y-f.y));this.center=this.coordinateLocation(S),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(r,a){return a?this.coordinatePoint(this.locationCoordinate(r),a.getElevationForLngLatZoom(r,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(r))}pointLocation(r,a){return this.coordinateLocation(this.pointCoordinate(r,a))}locationCoordinate(r){return c.Z.fromLngLat(r)}coordinateLocation(r){return r&&r.toLngLat()}pointCoordinate(r,a){if(a){const K=a.pointCoordinate(r);if(K!=null)return K}const p=[r.x,r.y,0,1],f=[r.x,r.y,1,1];c.af(p,p,this.pixelMatrixInverse),c.af(f,f,this.pixelMatrixInverse);const _=p[3],S=f[3],k=p[1]/_,C=f[1]/S,z=p[2]/_,O=f[2]/S,B=z===O?0:(0-z)/(O-z);return new c.Z(c.y.number(p[0]/_,f[0]/S,B)/this.worldSize,c.y.number(k,C,B)/this.worldSize)}coordinatePoint(r,a=0,p=this.pixelMatrix){const f=[r.x*this.worldSize,r.y*this.worldSize,a,1];return c.af(f,f,p),new c.P(f[0]/f[3],f[1]/f[3])}getBounds(){const r=Math.max(0,this.height/2-this.getHorizon());return new ie().extend(this.pointLocation(new c.P(0,r))).extend(this.pointLocation(new c.P(this.width,r))).extend(this.pointLocation(new c.P(this.width,this.height))).extend(this.pointLocation(new c.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new ie([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(r){r?(this.lngRange=[r.getWest(),r.getEast()],this.latRange=[r.getSouth(),r.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,gh])}calculateTileMatrix(r){const a=r.canonical,p=this.worldSize/this.zoomScale(a.z),f=a.x+Math.pow(2,a.z)*r.wrap,_=c.an(new Float64Array(16));return c.J(_,_,[f*p,a.y*p,0]),c.K(_,_,[p/c.X,p/c.X,1]),_}calculatePosMatrix(r,a=!1){const p=r.key,f=a?this._alignedPosMatrixCache:this._posMatrixCache;if(f[p])return f[p];const _=this.calculateTileMatrix(r);return c.L(_,a?this.alignedModelViewProjectionMatrix:this.modelViewProjectionMatrix,_),f[p]=new Float32Array(_),f[p]}calculateFogMatrix(r){const a=r.key,p=this._fogMatrixCache;if(p[a])return p[a];const f=this.calculateTileMatrix(r);return c.L(f,this.fogMatrix,f),p[a]=new Float32Array(f),p[a]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(r,a){a=c.ac(+a,this.minZoom,this.maxZoom);const p={center:new c.N(r.lng,r.lat),zoom:a};let f=this.lngRange;if(!this._renderWorldCopies&&f===null){const ae=179.9999999999;f=[-ae,ae]}const _=this.tileSize*this.zoomScale(p.zoom);let S=0,k=_,C=0,z=_,O=0,B=0;const{x:K,y:Q}=this.size;if(this.latRange){const ae=this.latRange;S=c.Q(ae[1])*_,k=c.Q(ae[0])*_,k-Sk&&(me=k-ae)}if(f){const ae=(C+z)/2;let Ce=re;this._renderWorldCopies&&(Ce=c.b3(re,ae-_/2,ae+_/2));const Pe=K/2;Ce-Pez&&(fe=z-Pe)}if(fe!==void 0||me!==void 0){const ae=new c.P(fe??re,me??ce);p.center=this.unproject.call({worldSize:_},ae).wrap()}return p}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const r=this._unmodified,{center:a,zoom:p}=this.getConstrained(this.center,this.zoom);this.center=a,this.zoom=p,this._unmodified=r,this._constraining=!1}_calcMatrices(){if(!this.height)return;const r=this.centerOffset,a=this.point.x,p=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=c.b5(1,this.center.lat)*this.worldSize;let f=c.an(new Float64Array(16));c.K(f,f,[this.width/2,-this.height/2,1]),c.J(f,f,[1,-1,0]),this.labelPlaneMatrix=f,f=c.an(new Float64Array(16)),c.K(f,f,[1,-1,1]),c.J(f,f,[-1,-1,0]),c.K(f,f,[2/this.width,2/this.height,1]),this.glCoordMatrix=f;const _=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),S=Math.min(this.elevation,this.minElevationForCurrentTile),k=_-S*this._pixelPerMeter/Math.cos(this._pitch),C=S<0?k:_,z=Math.PI/2+this._pitch,O=this._fov*(.5+r.y/this.height),B=Math.sin(O)*C/Math.sin(c.ac(Math.PI-z-O,.01,Math.PI-.01)),K=this.getHorizon(),Q=2*Math.atan(K/this.cameraToCenterDistance)*(.5+r.y/(2*K)),re=Math.sin(Q)*C/Math.sin(c.ac(Math.PI-z-Q,.01,Math.PI-.01)),ce=Math.min(B,re);this.farZ=1.01*(Math.cos(Math.PI/2-this._pitch)*ce+C),this.nearZ=this.height/50,f=new Float64Array(16),c.b6(f,this._fov,this.width/this.height,this.nearZ,this.farZ),f[8]=2*-r.x/this.width,f[9]=2*r.y/this.height,this.projectionMatrix=c.ae(f),c.K(f,f,[1,-1,1]),c.J(f,f,[0,0,-this.cameraToCenterDistance]),c.b7(f,f,this._pitch),c.ad(f,f,this.angle),c.J(f,f,[-a,-p,0]),this.mercatorMatrix=c.K([],f,[this.worldSize,this.worldSize,this.worldSize]),c.K(f,f,[1,1,this._pixelPerMeter]),this.pixelMatrix=c.L(new Float64Array(16),this.labelPlaneMatrix,f),c.J(f,f,[0,0,-this.elevation]),this.modelViewProjectionMatrix=f,this.invModelViewProjectionMatrix=c.as([],f),this.fogMatrix=new Float64Array(16),c.b6(this.fogMatrix,this._fov,this.width/this.height,_,this.farZ),this.fogMatrix[8]=2*-r.x/this.width,this.fogMatrix[9]=2*r.y/this.height,c.K(this.fogMatrix,this.fogMatrix,[1,-1,1]),c.J(this.fogMatrix,this.fogMatrix,[0,0,-this.cameraToCenterDistance]),c.b7(this.fogMatrix,this.fogMatrix,this._pitch),c.ad(this.fogMatrix,this.fogMatrix,this.angle),c.J(this.fogMatrix,this.fogMatrix,[-a,-p,0]),c.K(this.fogMatrix,this.fogMatrix,[1,1,this._pixelPerMeter]),c.J(this.fogMatrix,this.fogMatrix,[0,0,-this.elevation]),this.pixelMatrix3D=c.L(new Float64Array(16),this.labelPlaneMatrix,f);const fe=this.width%2/2,me=this.height%2/2,we=Math.cos(this.angle),ae=Math.sin(this.angle),Ce=a-Math.round(a)+we*fe+ae*me,Pe=p-Math.round(p)+we*me+ae*fe,De=new Float64Array(f);if(c.J(De,De,[Ce>.5?Ce-1:Ce,Pe>.5?Pe-1:Pe,0]),this.alignedModelViewProjectionMatrix=De,f=c.as(new Float64Array(16),this.pixelMatrix),!f)throw new Error("failed to invert matrix");this.pixelMatrixInverse=f,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const r=this.pointCoordinate(new c.P(0,0)),a=[r.x*this.worldSize,r.y*this.worldSize,0,1];return c.af(a,a,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const r=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new c.P(0,r))}getCameraQueryGeometry(r){const a=this.getCameraPoint();if(r.length===1)return[r[0],a];{let p=a.x,f=a.y,_=a.x,S=a.y;for(const k of r)p=Math.min(p,k.x),f=Math.min(f,k.y),_=Math.max(_,k.x),S=Math.max(S,k.y);return[new c.P(p,f),new c.P(_,f),new c.P(_,S),new c.P(p,S),new c.P(p,f)]}}lngLatToCameraDepth(r,a){const p=this.locationCoordinate(r),f=[p.x*this.worldSize,p.y*this.worldSize,a,1];return c.af(f,f,this.modelViewProjectionMatrix),f[2]/f[3]}}function gl(v,r){let a,p=!1,f=null,_=null;const S=()=>{f=null,p&&(v.apply(_,a),f=setTimeout(S,r),p=!1)};return(...k)=>(p=!0,_=this,a=k,f||S(),f)}class ku{constructor(r){this._getCurrentHash=()=>{const a=window.location.hash.replace("#","");if(this._hashName){let p;return a.split("&").map(f=>f.split("=")).forEach(f=>{f[0]===this._hashName&&(p=f)}),(p&&p[1]||"").split("/")}return a.split("/")},this._onHashChange=()=>{const a=this._getCurrentHash();if(a.length>=3&&!a.some(p=>isNaN(p))){const p=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(a[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+a[2],+a[1]],zoom:+a[0],bearing:p,pitch:+(a[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const a=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,a)},this._removeHash=()=>{const a=this._getCurrentHash();if(a.length===0)return;const p=a.join("/");let f=p;f.split("&").length>0&&(f=f.split("&")[0]),this._hashName&&(f=`${this._hashName}=${p}`);let _=window.location.hash.replace(f,"");_.startsWith("#&")?_=_.slice(0,1)+_.slice(2):_==="#"&&(_="");let S=window.location.href.replace(/(#.+)?$/,_);S=S.replace("&&","&"),window.history.replaceState(window.history.state,null,S)},this._updateHash=gl(this._updateHashUnthrottled,300),this._hashName=r&&encodeURIComponent(r)}addTo(r){return this._map=r,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(r){const a=this._map.getCenter(),p=Math.round(100*this._map.getZoom())/100,f=Math.ceil((p*Math.LN2+Math.log(512/360/.5))/Math.LN10),_=Math.pow(10,f),S=Math.round(a.lng*_)/_,k=Math.round(a.lat*_)/_,C=this._map.getBearing(),z=this._map.getPitch();let O="";if(O+=r?`/${S}/${k}/${p}`:`${p}/${k}/${S}`,(C||z)&&(O+="/"+Math.round(10*C)/10),z&&(O+=`/${Math.round(z)}`),this._hashName){const B=this._hashName;let K=!1;const Q=window.location.hash.slice(1).split("&").map(re=>{const ce=re.split("=")[0];return ce===B?(K=!0,`${ce}=${O}`):re}).filter(re=>re);return K||Q.push(`${B}=${O}`),`#${Q.join("&")}`}return`#${O}`}}const Tu={linearity:.3,easing:c.b8(0,0,.3,1)},yh=c.e({deceleration:2500,maxSpeed:1400},Tu),fy=c.e({deceleration:20,maxSpeed:1400},Tu),jp=c.e({deceleration:1e3,maxSpeed:360},Tu),Cu=c.e({deceleration:1e3,maxSpeed:90},Tu);class _h{constructor(r){this._map=r,this.clear()}clear(){this._inertiaBuffer=[]}record(r){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:D.now(),settings:r})}_drainInertiaBuffer(){const r=this._inertiaBuffer,a=D.now();for(;r.length>0&&a-r[0].time>160;)r.shift()}_onMoveEnd(r){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const a={zoom:0,bearing:0,pitch:0,pan:new c.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:_}of this._inertiaBuffer)a.zoom+=_.zoomDelta||0,a.bearing+=_.bearingDelta||0,a.pitch+=_.pitchDelta||0,_.panDelta&&a.pan._add(_.panDelta),_.around&&(a.around=_.around),_.pinchAround&&(a.pinchAround=_.pinchAround);const p=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,f={};if(a.pan.mag()){const _=_l(a.pan.mag(),p,c.e({},yh,r||{}));f.offset=a.pan.mult(_.amount/a.pan.mag()),f.center=this._map.transform.center,yl(f,_)}if(a.zoom){const _=_l(a.zoom,p,fy);f.zoom=this._map.transform.zoom+_.amount,yl(f,_)}if(a.bearing){const _=_l(a.bearing,p,jp);f.bearing=this._map.transform.bearing+c.ac(_.amount,-179,179),yl(f,_)}if(a.pitch){const _=_l(a.pitch,p,Cu);f.pitch=this._map.transform.pitch+_.amount,yl(f,_)}if(f.zoom||f.bearing){const _=a.pinchAround===void 0?a.around:a.pinchAround;f.around=_?this._map.unproject(_):this._map.getCenter()}return this.clear(),c.e(f,{noMoveStart:!0})}}function yl(v,r){(!v.duration||v.durationa.unproject(C)),k=_.reduce((C,z,O,B)=>C.add(z.div(B.length)),new c.P(0,0));super(r,{points:_,point:k,lngLats:S,lngLat:a.unproject(k),originalEvent:p}),this._defaultPrevented=!1}}class Up extends c.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(r,a,p){super(r,{originalEvent:p}),this._defaultPrevented=!1}}class Vp{constructor(r,a){this._map=r,this._clickTolerance=a.clickTolerance}reset(){delete this._mousedownPos}wheel(r){return this._firePreventable(new Up(r.type,this._map,r))}mousedown(r,a){return this._mousedownPos=a,this._firePreventable(new An(r.type,this._map,r))}mouseup(r){this._map.fire(new An(r.type,this._map,r))}click(r,a){this._mousedownPos&&this._mousedownPos.dist(a)>=this._clickTolerance||this._map.fire(new An(r.type,this._map,r))}dblclick(r){return this._firePreventable(new An(r.type,this._map,r))}mouseover(r){this._map.fire(new An(r.type,this._map,r))}mouseout(r){this._map.fire(new An(r.type,this._map,r))}touchstart(r){return this._firePreventable(new Ms(r.type,this._map,r))}touchmove(r){this._map.fire(new Ms(r.type,this._map,r))}touchend(r){this._map.fire(new Ms(r.type,this._map,r))}touchcancel(r){this._map.fire(new Ms(r.type,this._map,r))}_firePreventable(r){if(this._map.fire(r),r.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class tn{constructor(r){this._map=r}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(r){this._map.fire(new An(r.type,this._map,r))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new An("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(r){this._delayContextMenu?this._contextMenuEvent=r:this._ignoreContextMenu||this._map.fire(new An(r.type,this._map,r)),this._map.listens("contextmenu")&&r.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class to{constructor(r){this._map=r}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(r){return this.transform.pointLocation(c.P.convert(r),this._map.terrain)}}class yi{constructor(r,a){this._map=r,this._tr=new to(r),this._el=r.getCanvasContainer(),this._container=r.getContainer(),this._clickTolerance=a.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(r,a){this.isEnabled()&&r.shiftKey&&r.button===0&&(A.disableDrag(),this._startPos=this._lastPos=a,this._active=!0)}mousemoveWindow(r,a){if(!this._active)return;const p=a;if(this._lastPos.equals(p)||!this._box&&p.dist(this._startPos)_.fitScreenCoordinates(p,f,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",r)}keydown(r){this._active&&r.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",r))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(A.remove(this._box),this._box=null),A.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(r,a){return this._map.fire(new c.k(r,{originalEvent:a}))}}function vl(v,r){if(v.length!==r.length)throw new Error(`The number of touches and points are not equal - touches ${v.length}, points ${r.length}`);const a={};for(let p=0;pthis.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=r.timeStamp),p.length===this.numTouches&&(this.centroid=function(f){const _=new c.P(0,0);for(const S of f)_._add(S);return _.div(f.length)}(a),this.touches=vl(p,a)))}touchmove(r,a,p){if(this.aborted||!this.centroid)return;const f=vl(p,a);for(const _ in this.touches){const S=f[_];(!S||S.dist(this.touches[_])>30)&&(this.aborted=!0)}}touchend(r,a,p){if((!this.centroid||r.timeStamp-this.startTime>500)&&(this.aborted=!0),p.length===0){const f=!this.aborted&&this.centroid;if(this.reset(),f)return f}}}class Iu{constructor(r){this.singleTap=new vh(r),this.numTaps=r.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(r,a,p){this.singleTap.touchstart(r,a,p)}touchmove(r,a,p){this.singleTap.touchmove(r,a,p)}touchend(r,a,p){const f=this.singleTap.touchend(r,a,p);if(f){const _=r.timeStamp-this.lastTime<500,S=!this.lastTap||this.lastTap.dist(f)<30;if(_&&S||this.reset(),this.count++,this.lastTime=r.timeStamp,this.lastTap=f,this.count===this.numTaps)return this.reset(),f}}}class fa{constructor(r){this._tr=new to(r),this._zoomIn=new Iu({numTouches:1,numTaps:2}),this._zoomOut=new Iu({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(r,a,p){this._zoomIn.touchstart(r,a,p),this._zoomOut.touchstart(r,a,p)}touchmove(r,a,p){this._zoomIn.touchmove(r,a,p),this._zoomOut.touchmove(r,a,p)}touchend(r,a,p){const f=this._zoomIn.touchend(r,a,p),_=this._zoomOut.touchend(r,a,p),S=this._tr;return f?(this._active=!0,r.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:k=>k.easeTo({duration:300,zoom:S.zoom+1,around:S.unproject(f)},{originalEvent:r})}):_?(this._active=!0,r.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:k=>k.easeTo({duration:300,zoom:S.zoom-1,around:S.unproject(_)},{originalEvent:r})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Uo{constructor(r){this._enabled=!!r.enable,this._moveStateManager=r.moveStateManager,this._clickTolerance=r.clickTolerance||1,this._moveFunction=r.move,this._activateOnStart=!!r.activateOnStart,r.assignEvents(this),this.reset()}reset(r){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(r)}_move(...r){const a=this._moveFunction(...r);if(a.bearingDelta||a.pitchDelta||a.around||a.panDelta)return this._active=!0,a}dragStart(r,a){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(r)&&(this._moveStateManager.startMove(r),this._lastPoint=a.length?a[0]:a,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(r,a){if(!this.isEnabled())return;const p=this._lastPoint;if(!p)return;if(r.preventDefault(),!this._moveStateManager.isValidMoveEvent(r))return void this.reset(r);const f=a.length?a[0]:a;return!this._moved&&f.dist(p){v.mousedown=v.dragStart,v.mousemoveWindow=v.dragMove,v.mouseup=v.dragEnd,v.contextmenu=r=>{r.preventDefault()}},bh=({enable:v,clickTolerance:r,bearingDegreesPerPixelMoved:a=.8})=>{const p=new Pu({checkCorrectEvent:f=>A.mouseButton(f)===0&&f.ctrlKey||A.mouseButton(f)===2});return new Uo({clickTolerance:r,move:(f,_)=>({bearingDelta:(_.x-f.x)*a}),moveStateManager:p,enable:v,assignEvents:Au})},Sh=({enable:v,clickTolerance:r,pitchDegreesPerPixelMoved:a=-.5})=>{const p=new Pu({checkCorrectEvent:f=>A.mouseButton(f)===0&&f.ctrlKey||A.mouseButton(f)===2});return new Uo({clickTolerance:r,move:(f,_)=>({pitchDelta:(_.y-f.y)*a}),moveStateManager:p,enable:v,assignEvents:Au})};class zs{constructor(r,a){this._clickTolerance=r.clickTolerance||1,this._map=a,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new c.P(0,0)}_shouldBePrevented(r){return r<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(r,a,p){return this._calculateTransform(r,a,p)}touchmove(r,a,p){if(this._active){if(!this._shouldBePrevented(p.length))return r.preventDefault(),this._calculateTransform(r,a,p);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",r)}}touchend(r,a,p){this._calculateTransform(r,a,p),this._active&&this._shouldBePrevented(p.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(r,a,p){p.length>0&&(this._active=!0);const f=vl(p,a),_=new c.P(0,0),S=new c.P(0,0);let k=0;for(const z in f){const O=f[z],B=this._touches[z];B&&(_._add(O),S._add(O.sub(B)),k++,f[z]=O)}if(this._touches=f,this._shouldBePrevented(k)||!S.mag())return;const C=S.div(k);return this._sum._add(C),this._sum.mag()Math.abs(v.x)}class ma extends Mu{constructor(r){super(),this._currentTouchCount=0,this._map=r}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(r,a,p){super.touchstart(r,a,p),this._currentTouchCount=p.length}_start(r){this._lastPoints=r,zu(r[0].sub(r[1]))&&(this._valid=!1)}_move(r,a,p){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const f=r[0].sub(this._lastPoints[0]),_=r[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(f,_,p.timeStamp),this._valid?(this._lastPoints=r,this._active=!0,{pitchDelta:(f.y+_.y)/2*-.5}):void 0}gestureBeginsVertically(r,a,p){if(this._valid!==void 0)return this._valid;const f=r.mag()>=2,_=a.mag()>=2;if(!f&&!_)return;if(!f||!_)return this._firstMove===void 0&&(this._firstMove=p),p-this._firstMove<100&&void 0;const S=r.y>0==a.y>0;return zu(r)&&zu(a)&&S}}const Hp={panStep:100,bearingStep:15,pitchStep:10};class Fi{constructor(r){this._tr=new to(r);const a=Hp;this._panStep=a.panStep,this._bearingStep=a.bearingStep,this._pitchStep=a.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(r){if(r.altKey||r.ctrlKey||r.metaKey)return;let a=0,p=0,f=0,_=0,S=0;switch(r.keyCode){case 61:case 107:case 171:case 187:a=1;break;case 189:case 109:case 173:a=-1;break;case 37:r.shiftKey?p=-1:(r.preventDefault(),_=-1);break;case 39:r.shiftKey?p=1:(r.preventDefault(),_=1);break;case 38:r.shiftKey?f=1:(r.preventDefault(),S=-1);break;case 40:r.shiftKey?f=-1:(r.preventDefault(),S=1);break;default:return}return this._rotationDisabled&&(p=0,f=0),{cameraAnimation:k=>{const C=this._tr;k.easeTo({duration:300,easeId:"keyboardHandler",easing:To,zoom:a?Math.round(C.zoom)+a*(r.shiftKey?2:1):C.zoom,bearing:C.bearing+p*this._bearingStep,pitch:C.pitch+f*this._pitchStep,offset:[-_*this._panStep,-S*this._panStep],center:C.center},{originalEvent:r})}}}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 To(v){return v*(2-v)}const Ih=4.000244140625;class ro{constructor(r,a){this._onTimeout=p=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(p)},this._map=r,this._tr=new to(r),this._triggerRenderFrame=a,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(r){this._defaultZoomRate=r}setWheelZoomRate(r){this._wheelZoomRate=r}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(r){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!r&&r.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(r){return!!this._map.cooperativeGestures.isEnabled()&&!(r.ctrlKey||this._map.cooperativeGestures.isBypassed(r))}wheel(r){if(!this.isEnabled())return;if(this._shouldBePrevented(r))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",r);let a=r.deltaMode===WheelEvent.DOM_DELTA_LINE?40*r.deltaY:r.deltaY;const p=D.now(),f=p-(this._lastWheelEventTime||0);this._lastWheelEventTime=p,a!==0&&a%Ih==0?this._type="wheel":a!==0&&Math.abs(a)<4?this._type="trackpad":f>400?(this._type=null,this._lastValue=a,this._timeout=setTimeout(this._onTimeout,40,r)):this._type||(this._type=Math.abs(f*a)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,a+=this._lastValue)),r.shiftKey&&a&&(a/=4),this._type&&(this._lastWheelEvent=r,this._delta-=a,this._active||this._start(r)),r.preventDefault()}_start(r){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 a=A.mousePos(this._map.getCanvas(),r),p=this._tr;this._around=a.y>p.transform.height/2-p.transform.getHorizon()?c.N.convert(this._aroundCenter?p.center:p.unproject(a)):c.N.convert(p.center),this._aroundPoint=p.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const r=this._tr.transform;if(this._delta!==0){const C=this._type==="wheel"&&Math.abs(this._delta)>Ih?this._wheelZoomRate:this._defaultZoomRate;let z=2/(1+Math.exp(-Math.abs(this._delta*C)));this._delta<0&&z!==0&&(z=1/z);const O=typeof this._targetZoom=="number"?r.zoomScale(this._targetZoom):r.scale;this._targetZoom=Math.min(r.maxZoom,Math.max(r.minZoom,r.scaleZoom(O*z))),this._type==="wheel"&&(this._startZoom=r.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const a=typeof this._targetZoom=="number"?this._targetZoom:r.zoom,p=this._startZoom,f=this._easing;let _,S=!1;const k=D.now()-this._lastWheelEventTime;if(this._type==="wheel"&&p&&f&&k){const C=Math.min(k/200,1),z=f(C);_=c.y.number(p,a,z),C<1?this._frameId||(this._frameId=!0):S=!0}else _=a,S=!0;return this._active=!0,S&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!S,zoomDelta:_-r.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(r){let a=c.b9;if(this._prevEase){const p=this._prevEase,f=(D.now()-p.start)/p.duration,_=p.easing(f+.01)-p.easing(f),S=.27/Math.sqrt(_*_+1e-4)*.01,k=Math.sqrt(.0729-S*S);a=c.b8(S,k,.25,1)}return this._prevEase={start:D.now(),duration:r,easing:a},a}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class Ds{constructor(r,a){this._clickZoom=r,this._tapZoom=a}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 my{constructor(r){this._tr=new to(r),this.reset()}reset(){this._active=!1}dblclick(r,a){return r.preventDefault(),{cameraAnimation:p=>{p.easeTo({duration:300,zoom:this._tr.zoom+(r.shiftKey?-1:1),around:this._tr.unproject(a)},{originalEvent:r})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class gy{constructor(){this._tap=new Iu({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(r,a,p){if(!this._swipePoint)if(this._tapTime){const f=a[0],_=r.timeStamp-this._tapTime<500,S=this._tapPoint.dist(f)<30;_&&S?p.length>0&&(this._swipePoint=f,this._swipeTouch=p[0].identifier):this.reset()}else this._tap.touchstart(r,a,p)}touchmove(r,a,p){if(this._tapTime){if(this._swipePoint){if(p[0].identifier!==this._swipeTouch)return;const f=a[0],_=f.y-this._swipePoint.y;return this._swipePoint=f,r.preventDefault(),this._active=!0,{zoomDelta:_/128}}}else this._tap.touchmove(r,a,p)}touchend(r,a,p){if(this._tapTime)this._swipePoint&&p.length===0&&this.reset();else{const f=this._tap.touchend(r,a,p);f&&(this._tapTime=r.timeStamp,this._tapPoint=f)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Gp{constructor(r,a,p){this._el=r,this._mousePan=a,this._touchPan=p}enable(r){this._inertiaOptions=r||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class Zp{constructor(r,a,p){this._pitchWithRotate=r.pitchWithRotate,this._mouseRotate=a,this._mousePitch=p}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 Ph{constructor(r,a,p,f){this._el=r,this._touchZoom=a,this._touchRotate=p,this._tapDragZoom=f,this._rotationDisabled=!1,this._enabled=!0}enable(r){this._touchZoom.enable(r),this._rotationDisabled||this._touchRotate.enable(r),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class ga{constructor(r,a){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=r,this._options=a,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const r=this._map.getCanvasContainer();r.classList.add("maplibregl-cooperative-gestures"),this._container=A.create("div","maplibregl-cooperative-gesture-screen",r);let a=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(a=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const p=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),f=document.createElement("div");f.className="maplibregl-desktop-message",f.textContent=a,this._container.appendChild(f);const _=document.createElement("div");_.className="maplibregl-mobile-message",_.textContent=p,this._container.appendChild(_),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(A.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(r){return r[this._bypassKey]}notifyGestureBlocked(r,a){this._enabled&&(this._map.fire(new c.k("cooperativegestureprevented",{gestureType:r,originalEvent:a})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const Oi=v=>v.zoom||v.drag||v.pitch||v.rotate;class bt extends c.k{}function Du(v){return v.panDelta&&v.panDelta.mag()||v.zoomDelta||v.bearingDelta||v.pitchDelta}class Ah{constructor(r,a){this.handleWindowEvent=f=>{this.handleEvent(f,`${f.type}Window`)},this.handleEvent=(f,_)=>{if(f.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const S=f.type==="renderFrame"?void 0:f,k={needsRenderFrame:!1},C={},z={},O=f.touches,B=O?this._getMapTouches(O):void 0,K=B?A.touchPos(this._map.getCanvas(),B):A.mousePos(this._map.getCanvas(),f);for(const{handlerName:ce,handler:fe,allowed:me}of this._handlers){if(!fe.isEnabled())continue;let we;this._blockedByActive(z,me,ce)?fe.reset():fe[_||f.type]&&(we=fe[_||f.type](f,K,B),this.mergeHandlerResult(k,C,we,ce,S),we&&we.needsRenderFrame&&this._triggerRenderFrame()),(we||fe.isActive())&&(z[ce]=fe)}const Q={};for(const ce in this._previousActiveHandlers)z[ce]||(Q[ce]=S);this._previousActiveHandlers=z,(Object.keys(Q).length||Du(k))&&(this._changes.push([k,C,Q]),this._triggerRenderFrame()),(Object.keys(z).length||Du(k))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:re}=k;re&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],re(this._map))},this._map=r,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new _h(r),this._bearingSnap=a.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(a);const p=this._el;this._listeners=[[p,"touchstart",{passive:!0}],[p,"touchmove",{passive:!1}],[p,"touchend",void 0],[p,"touchcancel",void 0],[p,"mousedown",void 0],[p,"mousemove",void 0],[p,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[p,"mouseover",void 0],[p,"mouseout",void 0],[p,"dblclick",void 0],[p,"click",void 0],[p,"keydown",{capture:!1}],[p,"keyup",void 0],[p,"wheel",{passive:!1}],[p,"contextmenu",void 0],[window,"blur",void 0]];for(const[f,_,S]of this._listeners)A.addEventListener(f,_,f===document?this.handleWindowEvent:this.handleEvent,S)}destroy(){for(const[r,a,p]of this._listeners)A.removeEventListener(r,a,r===document?this.handleWindowEvent:this.handleEvent,p)}_addDefaultHandlers(r){const a=this._map,p=a.getCanvasContainer();this._add("mapEvent",new Vp(a,r));const f=a.boxZoom=new yi(a,r);this._add("boxZoom",f),r.interactive&&r.boxZoom&&f.enable();const _=a.cooperativeGestures=new ga(a,r.cooperativeGestures);this._add("cooperativeGestures",_),r.cooperativeGestures&&_.enable();const S=new fa(a),k=new my(a);a.doubleClickZoom=new Ds(k,S),this._add("tapZoom",S),this._add("clickZoom",k),r.interactive&&r.doubleClickZoom&&a.doubleClickZoom.enable();const C=new gy;this._add("tapDragZoom",C);const z=a.touchPitch=new ma(a);this._add("touchPitch",z),r.interactive&&r.touchPitch&&a.touchPitch.enable(r.touchPitch);const O=bh(r),B=Sh(r);a.dragRotate=new Zp(r,O,B),this._add("mouseRotate",O,["mousePitch"]),this._add("mousePitch",B,["mouseRotate"]),r.interactive&&r.dragRotate&&a.dragRotate.enable();const K=(({enable:we,clickTolerance:ae})=>{const Ce=new Pu({checkCorrectEvent:Pe=>A.mouseButton(Pe)===0&&!Pe.ctrlKey});return new Uo({clickTolerance:ae,move:(Pe,De)=>({around:De,panDelta:De.sub(Pe)}),activateOnStart:!0,moveStateManager:Ce,enable:we,assignEvents:Au})})(r),Q=new zs(r,a);a.dragPan=new Gp(p,K,Q),this._add("mousePan",K),this._add("touchPan",Q,["touchZoom","touchRotate"]),r.interactive&&r.dragPan&&a.dragPan.enable(r.dragPan);const re=new Ch,ce=new kh;a.touchZoomRotate=new Ph(p,ce,re,C),this._add("touchRotate",re,["touchPan","touchZoom"]),this._add("touchZoom",ce,["touchPan","touchRotate"]),r.interactive&&r.touchZoomRotate&&a.touchZoomRotate.enable(r.touchZoomRotate);const fe=a.scrollZoom=new ro(a,()=>this._triggerRenderFrame());this._add("scrollZoom",fe,["mousePan"]),r.interactive&&r.scrollZoom&&a.scrollZoom.enable(r.scrollZoom);const me=a.keyboard=new Fi(a);this._add("keyboard",me),r.interactive&&r.keyboard&&a.keyboard.enable(),this._add("blockableMapEvent",new tn(a))}_add(r,a,p){this._handlers.push({handlerName:r,handler:a,allowed:p}),this._handlersById[r]=a}stop(r){if(!this._updatingCamera){for(const{handler:a}of this._handlers)a.reset();this._inertia.clear(),this._fireEvents({},{},r),this._changes=[]}}isActive(){for(const{handler:r}of this._handlers)if(r.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Oi(this._eventsInProgress)||this.isZooming()}_blockedByActive(r,a,p){for(const f in r)if(f!==p&&(!a||a.indexOf(f)<0))return!0;return!1}_getMapTouches(r){const a=[];for(const p of r)this._el.contains(p.target)&&a.push(p);return a}mergeHandlerResult(r,a,p,f,_){if(!p)return;c.e(r,p);const S={handlerName:f,originalEvent:p.originalEvent||_};p.zoomDelta!==void 0&&(a.zoom=S),p.panDelta!==void 0&&(a.drag=S),p.pitchDelta!==void 0&&(a.pitch=S),p.bearingDelta!==void 0&&(a.rotate=S)}_applyChanges(){const r={},a={},p={};for(const[f,_,S]of this._changes)f.panDelta&&(r.panDelta=(r.panDelta||new c.P(0,0))._add(f.panDelta)),f.zoomDelta&&(r.zoomDelta=(r.zoomDelta||0)+f.zoomDelta),f.bearingDelta&&(r.bearingDelta=(r.bearingDelta||0)+f.bearingDelta),f.pitchDelta&&(r.pitchDelta=(r.pitchDelta||0)+f.pitchDelta),f.around!==void 0&&(r.around=f.around),f.pinchAround!==void 0&&(r.pinchAround=f.pinchAround),f.noInertia&&(r.noInertia=f.noInertia),c.e(a,_),c.e(p,S);this._updateMapTransform(r,a,p),this._changes=[]}_updateMapTransform(r,a,p){const f=this._map,_=f._getTransformForUpdate(),S=f.terrain;if(!(Du(r)||S&&this._terrainMovement))return this._fireEvents(a,p,!0);let{panDelta:k,zoomDelta:C,bearingDelta:z,pitchDelta:O,around:B,pinchAround:K}=r;K!==void 0&&(B=K),f._stop(!0),B=B||f.transform.centerPoint;const Q=_.pointLocation(k?B.sub(k):B);z&&(_.bearing+=z),O&&(_.pitch+=O),C&&(_.zoom+=C),S?this._terrainMovement||!a.drag&&!a.zoom?a.drag&&this._terrainMovement?_.center=_.pointLocation(_.centerPoint.sub(k)):_.setLocationAtPoint(Q,B):(this._terrainMovement=!0,this._map._elevationFreeze=!0,_.setLocationAtPoint(Q,B)):_.setLocationAtPoint(Q,B),f._applyUpdatedTransform(_),this._map._update(),r.noInertia||this._inertia.record(r),this._fireEvents(a,p,!0)}_fireEvents(r,a,p){const f=Oi(this._eventsInProgress),_=Oi(r),S={};for(const B in r){const{originalEvent:K}=r[B];this._eventsInProgress[B]||(S[`${B}start`]=K),this._eventsInProgress[B]=r[B]}!f&&_&&this._fireEvent("movestart",_.originalEvent);for(const B in S)this._fireEvent(B,S[B]);_&&this._fireEvent("move",_.originalEvent);for(const B in r){const{originalEvent:K}=r[B];this._fireEvent(B,K)}const k={};let C;for(const B in this._eventsInProgress){const{handlerName:K,originalEvent:Q}=this._eventsInProgress[B];this._handlersById[K].isActive()||(delete this._eventsInProgress[B],C=a[K]||Q,k[`${B}end`]=C)}for(const B in k)this._fireEvent(B,k[B]);const z=Oi(this._eventsInProgress),O=(f||_)&&!z;if(O&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const B=this._map._getTransformForUpdate();B.recalculateZoom(this._map.terrain),this._map._applyUpdatedTransform(B)}if(p&&O){this._updatingCamera=!0;const B=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),K=Q=>Q!==0&&-this._bearingSnap{delete this._frameId,this.handleEvent(new bt("renderFrame",{timeStamp:r})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Wp extends c.E{constructor(r,a){super(),this._renderFrameCallback=()=>{const p=Math.min((D.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(p)),p<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=r,this._bearingSnap=a.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new c.N(this.transform.center.lng,this.transform.center.lat)}setCenter(r,a){return this.jumpTo({center:r},a)}panBy(r,a,p){return r=c.P.convert(r).mult(-1),this.panTo(this.transform.center,c.e({offset:r},a),p)}panTo(r,a,p){return this.easeTo(c.e({center:r},a),p)}getZoom(){return this.transform.zoom}setZoom(r,a){return this.jumpTo({zoom:r},a),this}zoomTo(r,a,p){return this.easeTo(c.e({zoom:r},a),p)}zoomIn(r,a){return this.zoomTo(this.getZoom()+1,r,a),this}zoomOut(r,a){return this.zoomTo(this.getZoom()-1,r,a),this}getBearing(){return this.transform.bearing}setBearing(r,a){return this.jumpTo({bearing:r},a),this}getPadding(){return this.transform.padding}setPadding(r,a){return this.jumpTo({padding:r},a),this}rotateTo(r,a,p){return this.easeTo(c.e({bearing:r},a),p)}resetNorth(r,a){return this.rotateTo(0,c.e({duration:1e3},r),a),this}resetNorthPitch(r,a){return this.easeTo(c.e({bearing:0,pitch:0,duration:1e3},r),a),this}snapToNorth(r,a){return Math.abs(this.getBearing()){if(this._zooming&&(f.zoom=c.y.number(_,fe,Xe)),this._rotating&&(f.bearing=c.y.number(S,z,Xe)),this._pitching&&(f.pitch=c.y.number(k,O,Xe)),this._padding&&(f.interpolatePadding(C,B,Xe),Q=f.centerPoint.add(K)),this.terrain&&!r.freezeElevation&&this._updateElevation(Xe),Ce)f.setLocationAtPoint(Ce,Pe);else{const ot=f.zoomScale(f.zoom-_),mt=fe>_?Math.min(2,ae):Math.max(.5,ae),xt=Math.pow(mt,1-Xe),ht=f.unproject(me.add(we.mult(Xe*xt)).mult(ot));f.setLocationAtPoint(f.renderWorldCopies?ht.wrap():ht,Q)}this._applyUpdatedTransform(f),this._fireMoveEvents(a)},Xe=>{this.terrain&&r.freezeElevation&&this._finalizeElevation(),this._afterEase(a,Xe)},r),this}_prepareEase(r,a,p={}){this._moving=!0,a||p.moving||this.fire(new c.k("movestart",r)),this._zooming&&!p.zooming&&this.fire(new c.k("zoomstart",r)),this._rotating&&!p.rotating&&this.fire(new c.k("rotatestart",r)),this._pitching&&!p.pitching&&this.fire(new c.k("pitchstart",r))}_prepareElevation(r){this._elevationCenter=r,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(r,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(r){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const a=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(r<1&&a!==this._elevationTarget){const p=this._elevationTarget-this._elevationStart;this._elevationStart+=r*(p-(a-(p*r+this._elevationStart))/(1-r)),this._elevationTarget=a}this.transform.elevation=c.y.number(this._elevationStart,this._elevationTarget,r)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(r){const a=r.getCameraPosition(),p=this.terrain.getElevationForLngLatZoom(a.lngLat,r.zoom);if(a.altitudethis._elevateCameraIfInsideTerrain(f)),this.transformCameraUpdate&&a.push(f=>this.transformCameraUpdate(f)),!a.length)return;const p=r.clone();for(const f of a){const _=p.clone(),{center:S,zoom:k,pitch:C,bearing:z,elevation:O}=f(_);S&&(_.center=S),k!==void 0&&(_.zoom=k),C!==void 0&&(_.pitch=C),z!==void 0&&(_.bearing=z),O!==void 0&&(_.elevation=O),p.apply(_)}this.transform.apply(p)}_fireMoveEvents(r){this.fire(new c.k("move",r)),this._zooming&&this.fire(new c.k("zoom",r)),this._rotating&&this.fire(new c.k("rotate",r)),this._pitching&&this.fire(new c.k("pitch",r))}_afterEase(r,a){if(this._easeId&&a&&this._easeId===a)return;delete this._easeId;const p=this._zooming,f=this._rotating,_=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,p&&this.fire(new c.k("zoomend",r)),f&&this.fire(new c.k("rotateend",r)),_&&this.fire(new c.k("pitchend",r)),this.fire(new c.k("moveend",r))}flyTo(r,a){var p;if(!r.essential&&D.prefersReducedMotion){const yt=c.M(r,["center","zoom","bearing","pitch","around"]);return this.jumpTo(yt,a)}this.stop(),r=c.e({offset:[0,0],speed:1.2,curve:1.42,easing:c.b9},r);const f=this._getTransformForUpdate(),_=f.zoom,S=f.bearing,k=f.pitch,C=f.padding,z="bearing"in r?this._normalizeBearing(r.bearing,S):S,O="pitch"in r?+r.pitch:k,B="padding"in r?r.padding:f.padding,K=c.P.convert(r.offset);let Q=f.centerPoint.add(K);const re=f.pointLocation(Q),{center:ce,zoom:fe}=f.getConstrained(c.N.convert(r.center||re),(p=r.zoom)!==null&&p!==void 0?p:_);this._normalizeCenter(ce,f);const me=f.zoomScale(fe-_),we=f.project(re),ae=f.project(ce).sub(we);let Ce=r.curve;const Pe=Math.max(f.width,f.height),De=Pe/me,Xe=ae.mag();if("minZoom"in r){const yt=c.ac(Math.min(r.minZoom,_,fe),f.minZoom,f.maxZoom),Ut=Pe/f.zoomScale(yt-_);Ce=Math.sqrt(Ut/Xe*2)}const ot=Ce*Ce;function mt(yt){const Ut=(De*De-Pe*Pe+(yt?-1:1)*ot*ot*Xe*Xe)/(2*(yt?De:Pe)*ot*Xe);return Math.log(Math.sqrt(Ut*Ut+1)-Ut)}function xt(yt){return(Math.exp(yt)-Math.exp(-yt))/2}function ht(yt){return(Math.exp(yt)+Math.exp(-yt))/2}const ct=mt(!1);let Ct=function(yt){return ht(ct)/ht(ct+Ce*yt)},Ht=function(yt){return Pe*((ht(ct)*(xt(Ut=ct+Ce*yt)/ht(Ut))-xt(ct))/ot)/Xe;var Ut},dt=(mt(!0)-ct)/Ce;if(Math.abs(Xe)<1e-6||!isFinite(dt)){if(Math.abs(Pe-De)<1e-6)return this.easeTo(r,a);const yt=De0,Ct=Ut=>Math.exp(yt*Ce*Ut)}return r.duration="duration"in r?+r.duration:1e3*dt/("screenSpeed"in r?+r.screenSpeed/Ce:+r.speed),r.maxDuration&&r.duration>r.maxDuration&&(r.duration=0),this._zooming=!0,this._rotating=S!==z,this._pitching=O!==k,this._padding=!f.isPaddingEqual(B),this._prepareEase(a,!1),this.terrain&&this._prepareElevation(ce),this._ease(yt=>{const Ut=yt*dt,Lr=1/Ct(Ut);f.zoom=yt===1?fe:_+f.scaleZoom(Lr),this._rotating&&(f.bearing=c.y.number(S,z,yt)),this._pitching&&(f.pitch=c.y.number(k,O,yt)),this._padding&&(f.interpolatePadding(C,B,yt),Q=f.centerPoint.add(K)),this.terrain&&!r.freezeElevation&&this._updateElevation(yt);const Yt=yt===1?ce:f.unproject(we.add(ae.mult(Ht(Ut))).mult(Lr));f.setLocationAtPoint(f.renderWorldCopies?Yt.wrap():Yt,Q),this._applyUpdatedTransform(f),this._fireMoveEvents(a)},()=>{this.terrain&&r.freezeElevation&&this._finalizeElevation(),this._afterEase(a)},r),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(r,a){var p;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const f=this._onEaseEnd;delete this._onEaseEnd,f.call(this,a)}return r||(p=this.handlers)===null||p===void 0||p.stop(!1),this}_ease(r,a,p){p.animate===!1||p.duration===0?(r(1),a()):(this._easeStart=D.now(),this._easeOptions=p,this._onEaseFrame=r,this._onEaseEnd=a,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(r,a){r=c.b3(r,-180,180);const p=Math.abs(r-a);return Math.abs(r-360-a)180?-360:p<-180?360:0}queryTerrainElevation(r){return this.terrain?this.terrain.getElevationForLngLatZoom(c.N.convert(r),this.transform.tileZoom)-this.transform.elevation:null}}const ya={compact:!0,customAttribution:'MapLibre'};class _a{constructor(r=ya){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=a=>{!a||a.sourceDataType!=="metadata"&&a.sourceDataType!=="visibility"&&a.dataType!=="style"&&a.type!=="terrain"||this._updateAttributions()},this._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","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=r}getDefaultPosition(){return"bottom-right"}onAdd(r){return this._map=r,this._compact=this.options.compact,this._container=A.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=A.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=A.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){A.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(r,a){const p=this._map._getUIString(`AttributionControl.${a}`);r.title=p,r.setAttribute("aria-label",p)}_updateAttributions(){if(!this._map.style)return;let r=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?r=r.concat(this.options.customAttribution.map(f=>typeof f!="string"?"":f)):typeof this.options.customAttribution=="string"&&r.push(this.options.customAttribution)),this._map.style.stylesheet){const f=this._map.style.stylesheet;this.styleOwner=f.owner,this.styleId=f.id}const a=this._map.style.sourceCaches;for(const f in a){const _=a[f];if(_.used||_.usedForTerrain){const S=_.getSource();S.attribution&&r.indexOf(S.attribution)<0&&r.push(S.attribution)}}r=r.filter(f=>String(f).trim()),r.sort((f,_)=>f.length-_.length),r=r.filter((f,_)=>{for(let S=_+1;S=0)return!1;return!0});const p=r.join(" | ");p!==this._attribHTML&&(this._attribHTML=p,r.length?(this._innerContainer.innerHTML=p,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Mh{constructor(r={}){this._updateCompact=()=>{const a=this._container.children;if(a.length){const p=a[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&p.classList.add("maplibregl-compact"):p.classList.remove("maplibregl-compact")}},this.options=r}getDefaultPosition(){return"bottom-left"}onAdd(r){this._map=r,this._compact=this.options&&this.options.compact,this._container=A.create("div","maplibregl-ctrl");const a=A.create("a","maplibregl-ctrl-logo");return a.target="_blank",a.rel="noopener nofollow",a.href="https://maplibre.org/",a.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),a.setAttribute("rel","noopener nofollow"),this._container.appendChild(a),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){A.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class ir{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(r){const a=++this._id;return this._queue.push({callback:r,id:a,cancelled:!1}),a}remove(r){const a=this._currentlyRunning,p=a?this._queue.concat(a):this._queue;for(const f of p)if(f.id===r)return void(f.cancelled=!0)}run(r=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const a=this._currentlyRunning=this._queue;this._queue=[];for(const p of a)if(!p.cancelled&&(p.callback(r),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var zh=c.Y([{name:"a_pos3d",type:"Int16",components:3}]);class yy extends c.E{constructor(r){super(),this.sourceCache=r,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,r.usedForTerrain=!0,r.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(r,a){this.sourceCache.update(r,a),this._renderableTilesKeys=[];const p={};for(const f of r.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:a}))p[f.key]=!0,this._renderableTilesKeys.push(f.key),this._tiles[f.key]||(f.posMatrix=new Float64Array(16),c.aP(f.posMatrix,0,c.X,0,c.X,0,1),this._tiles[f.key]=new Qn(f,this.tileSize));for(const f in this._tiles)p[f]||delete this._tiles[f]}freeRtt(r){for(const a in this._tiles){const p=this._tiles[a];(!r||p.tileID.equals(r)||p.tileID.isChildOf(r)||r.isChildOf(p.tileID))&&(p.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(r=>this.getTileByID(r))}getTileByID(r){return this._tiles[r]}getTerrainCoords(r){const a={};for(const p of this._renderableTilesKeys){const f=this._tiles[p].tileID;if(f.canonical.equals(r.canonical)){const _=r.clone();_.posMatrix=new Float64Array(16),c.aP(_.posMatrix,0,c.X,0,c.X,0,1),a[p]=_}else if(f.canonical.isChildOf(r.canonical)){const _=r.clone();_.posMatrix=new Float64Array(16);const S=f.canonical.z-r.canonical.z,k=f.canonical.x-(f.canonical.x>>S<>S<>S;c.aP(_.posMatrix,0,z,0,z,0,1),c.J(_.posMatrix,_.posMatrix,[-k*z,-C*z,0]),a[p]=_}else if(r.canonical.isChildOf(f.canonical)){const _=r.clone();_.posMatrix=new Float64Array(16);const S=r.canonical.z-f.canonical.z,k=r.canonical.x-(r.canonical.x>>S<>S<>S;c.aP(_.posMatrix,0,c.X,0,c.X,0,1),c.J(_.posMatrix,_.posMatrix,[k*z,C*z,0]),c.K(_.posMatrix,_.posMatrix,[1/2**S,1/2**S,0]),a[p]=_}}return a}getSourceTile(r,a){const p=this.sourceCache._source;let f=r.overscaledZ-this.deltaZoom;if(f>p.maxzoom&&(f=p.maxzoom),f=p.minzoom&&(!_||!_.dem);)_=this.sourceCache.getTileByID(r.scaledTo(f--).key);return _}tilesAfterTime(r=Date.now()){return Object.values(this._tiles).filter(a=>a.timeAdded>=r)}}class Dh{constructor(r,a,p){this.painter=r,this.sourceCache=new yy(a),this.options=p,this.exaggeration=typeof p.exaggeration=="number"?p.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(r,a,p,f=c.X){var _;if(!(a>=0&&a=0&&pr.canonical.z&&(r.canonical.z>=f?_=r.canonical.z-f:c.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const S=r.canonical.x-(r.canonical.x>>_<<_),k=r.canonical.y-(r.canonical.y>>_<<_),C=c.bc(new Float64Array(16),[1/(c.X<<_),1/(c.X<<_),0]);c.J(C,C,[S*c.X,k*c.X,0]),this._demMatrixCache[r.key]={matrix:C,coord:r}}return{u_depth:2,u_terrain:3,u_terrain_dim:a&&a.dem&&a.dem.dim||1,u_terrain_matrix:p?this._demMatrixCache[r.key].matrix:this._emptyDemMatrix,u_terrain_unpack:a&&a.dem&&a.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(a&&a.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:a}}getFramebuffer(r){const a=this.painter,p=a.width/devicePixelRatio,f=a.height/devicePixelRatio;return!this._fbo||this._fbo.width===p&&this._fbo.height===f||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new it(a.context,{width:p,height:f,data:null},a.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(a.context.gl.NEAREST,a.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new it(a.context,{width:p,height:f,data:null},a.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(a.context.gl.NEAREST,a.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=a.context.createFramebuffer(p,f,!0,!1),this._fbo.depthAttachment.set(a.context.createRenderbuffer(a.context.gl.DEPTH_COMPONENT16,p,f))),this._fbo.colorAttachment.set(r==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const r=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const a=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let _=0,S=0;_>8<<4|_>>8,a[S+3]=0;const p=new c.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(a.buffer)),f=new it(r,p,r.gl.RGBA,{premultiply:!1});return f.bind(r.gl.NEAREST,r.gl.CLAMP_TO_EDGE),this._coordsTexture=f,f}pointCoordinate(r){this.painter.maybeDrawDepthAndCoords(!0);const a=new Uint8Array(4),p=this.painter.context,f=p.gl,_=Math.round(r.x*this.painter.pixelRatio/devicePixelRatio),S=Math.round(r.y*this.painter.pixelRatio/devicePixelRatio),k=Math.round(this.painter.height/devicePixelRatio);p.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),f.readPixels(_,k-S-1,1,1,f.RGBA,f.UNSIGNED_BYTE,a),p.bindFramebuffer.set(null);const C=a[0]+(a[2]>>4<<8),z=a[1]+((15&a[2])<<8),O=this.coordsIndex[255-a[3]],B=O&&this.sourceCache.getTileByID(O);if(!B)return null;const K=this._coordsTextureSize,Q=(1<r.id!==a),this._recentlyUsed.push(r.id)}stampObject(r){r.stamp=++this._stamp}getOrCreateFreeObject(){for(const a of this._recentlyUsed)if(!this._objects[a].inUse)return this._objects[a];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const r=this._createObject(this._objects.length);return this._objects.push(r),r}freeObject(r){r.inUse=!1}freeAllObjects(){for(const r of this._objects)this.freeObject(r)}isFull(){return!(this._objects.length!r.inUse)===!1}}const va={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class qp{constructor(r,a){this.painter=r,this.terrain=a,this.pool=new _y(r.context,30,a.sourceCache.tileSize*a.qualityFactor)}destruct(){this.pool.destruct()}getTexture(r){return this.pool.getObjectForId(r.rtt[this._stacks.length-1].id).texture}prepareForRender(r,a){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=r._order.filter(p=>!r._layers[p].isHidden(a)),this._coordsDescendingInv={};for(const p in r.sourceCaches){this._coordsDescendingInv[p]={};const f=r.sourceCaches[p].getVisibleCoordinates();for(const _ of f){const S=this.terrain.sourceCache.getTerrainCoords(_);for(const k in S)this._coordsDescendingInv[p][k]||(this._coordsDescendingInv[p][k]=[]),this._coordsDescendingInv[p][k].push(S[k])}}this._coordsDescendingInvStr={};for(const p of r._order){const f=r._layers[p],_=f.source;if(va[f.type]&&!this._coordsDescendingInvStr[_]){this._coordsDescendingInvStr[_]={};for(const S in this._coordsDescendingInv[_])this._coordsDescendingInvStr[_][S]=this._coordsDescendingInv[_][S].map(k=>k.key).sort().join()}}for(const p of this._renderableTiles)for(const f in this._coordsDescendingInvStr){const _=this._coordsDescendingInvStr[f][p.tileID.key];_&&_!==p.rttCoords[f]&&(p.rtt=[])}}renderLayer(r){if(r.isHidden(this.painter.transform.zoom))return!1;const a=r.type,p=this.painter,f=this._renderableLayerIds[this._renderableLayerIds.length-1]===r.id;if(va[a]&&(this._prevType&&va[this._prevType]||this._stacks.push([]),this._prevType=a,this._stacks[this._stacks.length-1].push(r.id),!f))return!0;if(va[this._prevType]||va[a]&&f){this._prevType=a;const _=this._stacks.length-1,S=this._stacks[_]||[];for(const k of this._renderableTiles){if(this.pool.isFull()&&($p(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(k),k.rtt[_]){const z=this.pool.getObjectForId(k.rtt[_].id);if(z.stamp===k.rtt[_].stamp){this.pool.useObject(z);continue}}const C=this.pool.getOrCreateFreeObject();this.pool.useObject(C),this.pool.stampObject(C),k.rtt[_]={id:C.id,stamp:C.stamp},p.context.bindFramebuffer.set(C.fbo.framebuffer),p.context.clear({color:c.aM.transparent,stencil:0}),p.currentStencilSource=void 0;for(let z=0;z{v.touchstart=v.dragStart,v.touchmoveWindow=v.dragMove,v.touchend=v.dragEnd},xy={showCompass:!0,showZoom:!0,visualizePitch:!1};class wy{constructor(r,a,p=!1){this.mousedown=S=>{this.startMouse(c.e({},S,{ctrlKey:!0,preventDefault:()=>S.preventDefault()}),A.mousePos(this.element,S)),A.addEventListener(window,"mousemove",this.mousemove),A.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=S=>{this.moveMouse(S,A.mousePos(this.element,S))},this.mouseup=S=>{this.mouseRotate.dragEnd(S),this.mousePitch&&this.mousePitch.dragEnd(S),this.offTemp()},this.touchstart=S=>{S.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=A.touchPos(this.element,S.targetTouches)[0],this.startTouch(S,this._startPos),A.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),A.addEventListener(window,"touchend",this.touchend))},this.touchmove=S=>{S.targetTouches.length!==1?this.reset():(this._lastPos=A.touchPos(this.element,S.targetTouches)[0],this.moveTouch(S,this._lastPos))},this.touchend=S=>{S.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;const f=r.dragRotate._mouseRotate.getClickTolerance(),_=r.dragRotate._mousePitch.getClickTolerance();this.element=a,this.mouseRotate=bh({clickTolerance:f,enable:!0}),this.touchRotate=(({enable:S,clickTolerance:k,bearingDegreesPerPixelMoved:C=.8})=>{const z=new wh;return new Uo({clickTolerance:k,move:(O,B)=>({bearingDelta:(B.x-O.x)*C}),moveStateManager:z,enable:S,assignEvents:Lh})})({clickTolerance:f,enable:!0}),this.map=r,p&&(this.mousePitch=Sh({clickTolerance:_,enable:!0}),this.touchPitch=(({enable:S,clickTolerance:k,pitchDegreesPerPixelMoved:C=-.5})=>{const z=new wh;return new Uo({clickTolerance:k,move:(O,B)=>({pitchDelta:(B.y-O.y)*C}),moveStateManager:z,enable:S,assignEvents:Lh})})({clickTolerance:_,enable:!0})),A.addEventListener(a,"mousedown",this.mousedown),A.addEventListener(a,"touchstart",this.touchstart,{passive:!1}),A.addEventListener(a,"touchcancel",this.reset)}startMouse(r,a){this.mouseRotate.dragStart(r,a),this.mousePitch&&this.mousePitch.dragStart(r,a),A.disableDrag()}startTouch(r,a){this.touchRotate.dragStart(r,a),this.touchPitch&&this.touchPitch.dragStart(r,a),A.disableDrag()}moveMouse(r,a){const p=this.map,{bearingDelta:f}=this.mouseRotate.dragMove(r,a)||{};if(f&&p.setBearing(p.getBearing()+f),this.mousePitch){const{pitchDelta:_}=this.mousePitch.dragMove(r,a)||{};_&&p.setPitch(p.getPitch()+_)}}moveTouch(r,a){const p=this.map,{bearingDelta:f}=this.touchRotate.dragMove(r,a)||{};if(f&&p.setBearing(p.getBearing()+f),this.touchPitch){const{pitchDelta:_}=this.touchPitch.dragMove(r,a)||{};_&&p.setPitch(p.getPitch()+_)}}off(){const r=this.element;A.removeEventListener(r,"mousedown",this.mousedown),A.removeEventListener(r,"touchstart",this.touchstart,{passive:!1}),A.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),A.removeEventListener(window,"touchend",this.touchend),A.removeEventListener(r,"touchcancel",this.reset),this.offTemp()}offTemp(){A.enableDrag(),A.removeEventListener(window,"mousemove",this.mousemove),A.removeEventListener(window,"mouseup",this.mouseup),A.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),A.removeEventListener(window,"touchend",this.touchend)}}let _i;function Rr(v,r,a){const p=new c.N(v.lng,v.lat);if(v=new c.N(v.lng,v.lat),r){const f=new c.N(v.lng-360,v.lat),_=new c.N(v.lng+360,v.lat),S=a.locationPoint(v).distSqr(r);a.locationPoint(f).distSqr(r)180;){const f=a.locationPoint(v);if(f.x>=0&&f.y>=0&&f.x<=a.width&&f.y<=a.height)break;v.lng>a.center.lng?v.lng-=360:v.lng+=360}return v.lng!==p.lng&&a.locationPoint(v).y>a.height/2-a.getHorizon()?v:p}const xa={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 Ru(v,r,a){const p=v.classList;for(const f in xa)p.remove(`maplibregl-${a}-anchor-${f}`);p.add(`maplibregl-${a}-anchor-${r}`)}class Lu extends c.E{constructor(r){if(super(),this._onKeyPress=a=>{const p=a.code,f=a.charCode||a.keyCode;p!=="Space"&&p!=="Enter"&&f!==32&&f!==13||this.togglePopup()},this._onMapClick=a=>{const p=a.originalEvent.target,f=this._element;this._popup&&(p===f||f.contains(p))&&this.togglePopup()},this._update=a=>{var p;if(!this._map)return;const f=this._map.loaded()&&!this._map.isMoving();((a==null?void 0:a.type)==="terrain"||(a==null?void 0:a.type)==="render"&&!f)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?Rr(this._lngLat,this._flatPos,this._map.transform):(p=this._lngLat)===null||p===void 0?void 0:p.wrap(),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationPoint(this._lngLat)._add(this._offset));let _="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?_=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(_=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let S="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?S="rotateX(0deg)":this._pitchAlignment==="map"&&(S=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||a&&a.type!=="moveend"||(this._pos=this._pos.round()),A.setTransform(this._element,`${xa[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${S} ${_}`),D.frameAsync(new AbortController).then(()=>{this._updateOpacity(a&&a.type==="moveend")}).catch(()=>{})},this._onMove=a=>{if(!this._isDragging){const p=this._clickTolerance||this._map._clickTolerance;this._isDragging=a.point.dist(this._pointerdownPos)>=p}this._isDragging&&(this._pos=a.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 c.k("dragstart"))),this.fire(new c.k("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new c.k("dragend")),this._state="inactive"},this._addDragHandler=a=>{this._element.contains(a.originalEvent.target)&&(a.preventDefault(),this._positionDelta=a.point.sub(this._pos).add(this._offset),this._pointerdownPos=a.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=r&&r.anchor||"center",this._color=r&&r.color||"#3FB1CE",this._scale=r&&r.scale||1,this._draggable=r&&r.draggable||!1,this._clickTolerance=r&&r.clickTolerance||0,this._subpixelPositioning=r&&r.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=r&&r.rotation||0,this._rotationAlignment=r&&r.rotationAlignment||"auto",this._pitchAlignment=r&&r.pitchAlignment&&r.pitchAlignment!=="auto"?r.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(r==null?void 0:r.opacity,r==null?void 0:r.opacityWhenCovered),r&&r.element)this._element=r.element,this._offset=c.P.convert(r&&r.offset||[0,0]);else{this._defaultMarker=!0,this._element=A.create("div");const a=A.createNS("http://www.w3.org/2000/svg","svg"),p=41,f=27;a.setAttributeNS(null,"display","block"),a.setAttributeNS(null,"height",`${p}px`),a.setAttributeNS(null,"width",`${f}px`),a.setAttributeNS(null,"viewBox",`0 0 ${f} ${p}`);const _=A.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"stroke","none"),_.setAttributeNS(null,"stroke-width","1"),_.setAttributeNS(null,"fill","none"),_.setAttributeNS(null,"fill-rule","evenodd");const S=A.createNS("http://www.w3.org/2000/svg","g");S.setAttributeNS(null,"fill-rule","nonzero");const k=A.createNS("http://www.w3.org/2000/svg","g");k.setAttributeNS(null,"transform","translate(3.0, 29.0)"),k.setAttributeNS(null,"fill","#000000");const C=[{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 me of C){const we=A.createNS("http://www.w3.org/2000/svg","ellipse");we.setAttributeNS(null,"opacity","0.04"),we.setAttributeNS(null,"cx","10.5"),we.setAttributeNS(null,"cy","5.80029008"),we.setAttributeNS(null,"rx",me.rx),we.setAttributeNS(null,"ry",me.ry),k.appendChild(we)}const z=A.createNS("http://www.w3.org/2000/svg","g");z.setAttributeNS(null,"fill",this._color);const O=A.createNS("http://www.w3.org/2000/svg","path");O.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),z.appendChild(O);const B=A.createNS("http://www.w3.org/2000/svg","g");B.setAttributeNS(null,"opacity","0.25"),B.setAttributeNS(null,"fill","#000000");const K=A.createNS("http://www.w3.org/2000/svg","path");K.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"),B.appendChild(K);const Q=A.createNS("http://www.w3.org/2000/svg","g");Q.setAttributeNS(null,"transform","translate(6.0, 7.0)"),Q.setAttributeNS(null,"fill","#FFFFFF");const re=A.createNS("http://www.w3.org/2000/svg","g");re.setAttributeNS(null,"transform","translate(8.0, 8.0)");const ce=A.createNS("http://www.w3.org/2000/svg","circle");ce.setAttributeNS(null,"fill","#000000"),ce.setAttributeNS(null,"opacity","0.25"),ce.setAttributeNS(null,"cx","5.5"),ce.setAttributeNS(null,"cy","5.5"),ce.setAttributeNS(null,"r","5.4999962");const fe=A.createNS("http://www.w3.org/2000/svg","circle");fe.setAttributeNS(null,"fill","#FFFFFF"),fe.setAttributeNS(null,"cx","5.5"),fe.setAttributeNS(null,"cy","5.5"),fe.setAttributeNS(null,"r","5.4999962"),re.appendChild(ce),re.appendChild(fe),S.appendChild(k),S.appendChild(z),S.appendChild(B),S.appendChild(Q),S.appendChild(re),a.appendChild(S),a.setAttributeNS(null,"height",p*this._scale+"px"),a.setAttributeNS(null,"width",f*this._scale+"px"),this._element.appendChild(a),this._offset=c.P.convert(r&&r.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",a=>{a.preventDefault()}),this._element.addEventListener("mousedown",a=>{a.preventDefault()}),Ru(this._element,this._anchor,"marker"),r&&r.className)for(const a of r.className.split(" "))this._element.classList.add(a);this._popup=null}addTo(r){return this.remove(),this._map=r,this._element.setAttribute("aria-label",r._getUIString("Marker.Title")),r.getCanvasContainer().appendChild(this._element),r.on("move",this._update),r.on("moveend",this._update),r.on("terrain",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("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),A.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(r){return this._lngLat=c.N.convert(r),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(r){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),r){if(!("offset"in r.options)){const f=Math.abs(13.5)/Math.SQRT2;r.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[f,-1*(38.1-13.5+f)],"bottom-right":[-f,-1*(38.1-13.5+f)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=r,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(r){return this._subpixelPositioning=r,this}getPopup(){return this._popup}togglePopup(){const r=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:r?(r.isOpen()?r.remove():(r.setLngLat(this._lngLat),r.addTo(this._map)),this):this}_updateOpacity(r=!1){var a,p;if(!(!((a=this._map)===null||a===void 0)&&a.terrain))return void(this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity));if(r)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const f=this._map,_=f.terrain.depthAtPoint(this._pos),S=f.terrain.getElevationForLngLatZoom(this._lngLat,f.transform.tileZoom);if(f.transform.lngLatToCameraDepth(this._lngLat,S)-_<.006)return void(this._element.style.opacity=this._opacity);const k=-this._offset.y/f.transform._pixelPerMeter,C=Math.sin(f.getPitch()*Math.PI/180)*k,z=f.terrain.depthAtPoint(new c.P(this._pos.x,this._pos.y-this._offset.y)),O=f.transform.lngLatToCameraDepth(this._lngLat,S+C)-z>.006;!((p=this._popup)===null||p===void 0)&&p.isOpen()&&O&&this._popup.remove(),this._element.style.opacity=O?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(r){return this._offset=c.P.convert(r),this._update(),this}addClassName(r){this._element.classList.add(r)}removeClassName(r){this._element.classList.remove(r)}toggleClassName(r){return this._element.classList.toggle(r)}setDraggable(r){return this._draggable=!!r,this._map&&(r?(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(r){return this._rotation=r||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(r){return this._rotationAlignment=r||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(r){return this._pitchAlignment=r&&r!=="auto"?r:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(r,a){return r===void 0&&a===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),r!==void 0&&(this._opacity=r),a!==void 0&&(this._opacityWhenCovered=a),this._map&&this._updateOpacity(!0),this}}const Kp={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let wl=0,bl=!1;const Co={maxWidth:100,unit:"metric"};function Sl(v,r,a){const p=a&&a.maxWidth||100,f=v._container.clientHeight/2,_=v.unproject([0,f]),S=v.unproject([p,f]),k=_.distanceTo(S);if(a&&a.unit==="imperial"){const C=3.2808*k;C>5280?Tt(r,p,C/5280,v._getUIString("ScaleControl.Miles")):Tt(r,p,C,v._getUIString("ScaleControl.Feet"))}else a&&a.unit==="nautical"?Tt(r,p,k/1852,v._getUIString("ScaleControl.NauticalMiles")):k>=1e3?Tt(r,p,k/1e3,v._getUIString("ScaleControl.Kilometers")):Tt(r,p,k,v._getUIString("ScaleControl.Meters"))}function Tt(v,r,a,p){const f=function(_){const S=Math.pow(10,`${Math.floor(_)}`.length-1);let k=_/S;return k=k>=10?10:k>=5?5:k>=3?3:k>=2?2:k>=1?1:function(C){const z=Math.pow(10,Math.ceil(-Math.log(C)/Math.LN10));return Math.round(C*z)/z}(k),S*k}(a);v.style.width=r*(f/a)+"px",v.innerHTML=`${f} ${p}`}const Nt={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},Fu=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Ou(v){if(v){if(typeof v=="number"){const r=Math.round(Math.abs(v)/Math.SQRT2);return{center:new c.P(0,0),top:new c.P(0,v),"top-left":new c.P(r,r),"top-right":new c.P(-r,r),bottom:new c.P(0,-v),"bottom-left":new c.P(r,-r),"bottom-right":new c.P(-r,-r),left:new c.P(v,0),right:new c.P(-v,0)}}if(v instanceof c.P||Array.isArray(v)){const r=c.P.convert(v);return{center:r,top:r,"top-left":r,"top-right":r,bottom:r,"bottom-left":r,"bottom-right":r,left:r,right:r}}return{center:c.P.convert(v.center||[0,0]),top:c.P.convert(v.top||[0,0]),"top-left":c.P.convert(v["top-left"]||[0,0]),"top-right":c.P.convert(v["top-right"]||[0,0]),bottom:c.P.convert(v.bottom||[0,0]),"bottom-left":c.P.convert(v["bottom-left"]||[0,0]),"bottom-right":c.P.convert(v["bottom-right"]||[0,0]),left:c.P.convert(v.left||[0,0]),right:c.P.convert(v.right||[0,0])}}return Ou(new c.P(0,0))}const Fh=T;y.AJAXError=c.bh,y.Evented=c.E,y.LngLat=c.N,y.MercatorCoordinate=c.Z,y.Point=c.P,y.addProtocol=c.bi,y.config=c.a,y.removeProtocol=c.bj,y.AttributionControl=_a,y.BoxZoomHandler=yi,y.CanvasSource=at,y.CooperativeGesturesHandler=ga,y.DoubleClickZoomHandler=Ds,y.DragPanHandler=Gp,y.DragRotateHandler=Zp,y.EdgeInsets=da,y.FullscreenControl=class extends c.E{constructor(v={}){super(),this._onFullscreenChange=()=>{var r;let a=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((r=a==null?void 0:a.shadowRoot)===null||r===void 0)&&r.fullscreenElement;)a=a.shadowRoot.fullscreenElement;a===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,v&&v.container&&(v.container instanceof HTMLElement?this._container=v.container:c.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(v){return this._map=v,this._container||(this._container=this._map.getContainer()),this._controlContainer=A.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){A.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const v=this._fullscreenButton=A.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);A.create("span","maplibregl-ctrl-icon",v).setAttribute("aria-hidden","true"),v.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const v=this._getTitle();this._fullscreenButton.setAttribute("aria-label",v),this._fullscreenButton.title=v}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new c.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new c.k("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){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._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},y.GeoJSONSource=tt,y.GeolocateControl=class extends c.E{constructor(v){super(),this._onSuccess=r=>{if(this._map){if(this._isOutOfMapMaxBounds(r))return this._setErrorState(),this.fire(new c.k("outofmaxbounds",r)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=r,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(r),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(r),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new c.k("geolocate",r)),this._finish()}},this._updateCamera=r=>{const a=new c.N(r.coords.longitude,r.coords.latitude),p=r.coords.accuracy,f=this._map.getBearing(),_=c.e({bearing:f},this.options.fitBoundsOptions),S=ie.fromLngLat(a,p);this._map.fitBounds(S,_,{geolocateSource:!0})},this._updateMarker=r=>{if(r){const a=new c.N(r.coords.longitude,r.coords.latitude);this._accuracyCircleMarker.setLngLat(a).addTo(this._map),this._userLocationDotMarker.setLngLat(a).addTo(this._map),this._accuracy=r.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=r=>{if(this._map){if(this.options.trackUserLocation)if(r.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const a=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=a,this._geolocateButton.setAttribute("aria-label",a),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(r.code===3&&bl)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new c.k("error",r)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",r=>r.preventDefault()),this._geolocateButton=A.create("button","maplibregl-ctrl-geolocate",this._container),A.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=r=>{if(this._map){if(r===!1){c.w("Geolocation support is not available so the GeolocateControl will be disabled.");const a=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=a,this._geolocateButton.setAttribute("aria-label",a)}else{const a=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=a,this._geolocateButton.setAttribute("aria-label",a)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=A.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Lu({element:this._dotElement}),this._circleElement=A.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Lu({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",a=>{a.geolocateSource||this._watchState!=="ACTIVE_LOCK"||a.originalEvent&&a.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new c.k("trackuserlocationend")),this.fire(new c.k("userlocationlostfocus")))})}},this.options=c.e({},Kp,v)}onAdd(v){return this._map=v,this._container=A.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return c._(this,arguments,void 0,function*(r=!1){if(_i!==void 0&&!r)return _i;if(window.navigator.permissions===void 0)return _i=!!window.navigator.geolocation,_i;try{_i=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{_i=!!window.navigator.geolocation}return _i})}().then(r=>this._finishSetupUI(r)),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(),A.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,wl=0,bl=!1}_isOutOfMapMaxBounds(v){const r=this._map.getMaxBounds(),a=v.coords;return r&&(a.longituder.getEast()||a.latituder.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const v=this._map.getBounds(),r=v.getSouthEast(),a=v.getNorthEast(),p=r.distanceTo(a),f=Math.ceil(this._accuracy/(p/this._map._container.clientHeight)*2);this._circleElement.style.width=`${f}px`,this._circleElement.style.height=`${f}px`}trigger(){if(!this._setup)return c.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new c.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":wl--,bl=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new c.k("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new c.k("trackuserlocationstart")),this.fire(new c.k("userlocationfocus"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let v;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),wl++,wl>1?(v={maximumAge:6e5,timeout:0},bl=!0):(v=this.options.positionOptions,bl=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,v)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},y.Hash=ku,y.ImageSource=st,y.KeyboardHandler=Fi,y.LngLatBounds=ie,y.LogoControl=Mh,y.Map=class extends Wp{constructor(v){c.bf.mark(c.bg.create);const r=Object.assign(Object.assign({},vy),v);if(r.minZoom!=null&&r.maxZoom!=null&&r.minZoom>r.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(r.minPitch!=null&&r.maxPitch!=null&&r.minPitch>r.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(r.minPitch!=null&&r.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(r.maxPitch!=null&&r.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new pa(r.minZoom,r.maxZoom,r.minPitch,r.maxPitch,r.renderWorldCopies),{bearingSnap:r.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new ir,this._controls=[],this._mapId=c.a4(),this._contextLost=a=>{a.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new c.k("webglcontextlost",{originalEvent:a}))},this._contextRestored=a=>{this._setupPainter(),this.resize(),this._update(),this.fire(new c.k("webglcontextrestored",{originalEvent:a}))},this._onMapScroll=a=>{if(a.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=r.interactive,this._maxTileCacheSize=r.maxTileCacheSize,this._maxTileCacheZoomLevels=r.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=r.failIfMajorPerformanceCaveat===!0,this._preserveDrawingBuffer=r.preserveDrawingBuffer===!0,this._antialias=r.antialias===!0,this._trackResize=r.trackResize===!0,this._bearingSnap=r.bearingSnap,this._refreshExpiredTiles=r.refreshExpiredTiles===!0,this._fadeDuration=r.fadeDuration,this._crossSourceCollisions=r.crossSourceCollisions===!0,this._collectResourceTiming=r.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},Rh),r.locale),this._clickTolerance=r.clickTolerance,this._overridePixelRatio=r.pixelRatio,this._maxCanvasSize=r.maxCanvasSize,this.transformCameraUpdate=r.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=r.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=q.addThrottleControl(()=>this.isMoving()),this._requestManager=new ne(r.transformRequest),typeof r.container=="string"){if(this._container=document.getElementById(r.container),!this._container)throw new Error(`Container '${r.container}' not found.`)}else{if(!(r.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=r.container}if(r.maxBounds&&this.setMaxBounds(r.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)).on("moveend",()=>this._update(!1)).on("zoom",()=>this._update(!0)).on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}).once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let a=!1;const p=gl(f=>{this._trackResize&&!this._removed&&(this.resize(f),this.redraw())},50);this._resizeObserver=new ResizeObserver(f=>{a?p(f):a=!0}),this._resizeObserver.observe(this._container)}this.handlers=new Ah(this,r),this._hash=r.hash&&new ku(typeof r.hash=="string"&&r.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:r.center,zoom:r.zoom,bearing:r.bearing,pitch:r.pitch}),r.bounds&&(this.resize(),this.fitBounds(r.bounds,c.e({},r.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=r.localIdeographFontFamily,this._validateStyle=r.validateStyle,r.style&&this.setStyle(r.style,{localIdeographFontFamily:r.localIdeographFontFamily}),r.attributionControl&&this.addControl(new _a(typeof r.attributionControl=="boolean"?void 0:r.attributionControl)),r.maplibreLogo&&this.addControl(new Mh,r.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",a=>{this._update(a.dataType==="style"),this.fire(new c.k(`${a.dataType}data`,a))}),this.on("dataloading",a=>{this.fire(new c.k(`${a.dataType}dataloading`,a))}),this.on("dataabort",a=>{this.fire(new c.k("sourcedataabort",a))})}_getMapId(){return this._mapId}addControl(v,r){if(r===void 0&&(r=v.getDefaultPosition?v.getDefaultPosition():"top-right"),!v||!v.onAdd)return this.fire(new c.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const a=v.onAdd(this);this._controls.push(v);const p=this._controlPositions[r];return r.indexOf("bottom")!==-1?p.insertBefore(a,p.firstChild):p.appendChild(a),this}removeControl(v){if(!v||!v.onRemove)return this.fire(new c.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const r=this._controls.indexOf(v);return r>-1&&this._controls.splice(r,1),v.onRemove(this),this}hasControl(v){return this._controls.indexOf(v)>-1}calculateCameraOptionsFromTo(v,r,a,p){return p==null&&this.terrain&&(p=this.terrain.getElevationForLngLatZoom(a,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(v,r,a,p)}resize(v){var r;const a=this._containerDimensions(),p=a[0],f=a[1],_=this._getClampedPixelRatio(p,f);if(this._resizeCanvas(p,f,_),this.painter.resize(p,f,_),this.painter.overLimit()){const k=this.painter.context.gl;this._maxCanvasSize=[k.drawingBufferWidth,k.drawingBufferHeight];const C=this._getClampedPixelRatio(p,f);this._resizeCanvas(p,f,C),this.painter.resize(p,f,C)}this.transform.resize(p,f),(r=this._requestedCameraState)===null||r===void 0||r.resize(p,f);const S=!this._moving;return S&&(this.stop(),this.fire(new c.k("movestart",v)).fire(new c.k("move",v))),this.fire(new c.k("resize",v)),S&&this.fire(new c.k("moveend",v)),this}_getClampedPixelRatio(v,r){const{0:a,1:p}=this._maxCanvasSize,f=this.getPixelRatio(),_=v*f,S=r*f;return Math.min(_>a?a/_:1,S>p?p/S:1)*f}getPixelRatio(){var v;return(v=this._overridePixelRatio)!==null&&v!==void 0?v:devicePixelRatio}setPixelRatio(v){this._overridePixelRatio=v,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(v){return this.transform.setMaxBounds(ie.convert(v)),this._update()}setMinZoom(v){if((v=v??-2)>=-2&&v<=this.transform.maxZoom)return this.transform.minZoom=v,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=v,this._update(),this.getZoom()>v&&this.setZoom(v),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(v){if((v=v??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(v>=0&&v<=this.transform.maxPitch)return this.transform.minPitch=v,this._update(),this.getPitch()85)throw new Error("maxPitch must be less than or equal to 85");if(v>=this.transform.minPitch)return this.transform.maxPitch=v,this._update(),this.getPitch()>v&&this.setPitch(v),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(v){return this.transform.renderWorldCopies=v,this._update()}project(v){return this.transform.locationPoint(c.N.convert(v),this.style&&this.terrain)}unproject(v){return this.transform.pointLocation(c.P.convert(v),this.terrain)}isMoving(){var v;return this._moving||((v=this.handlers)===null||v===void 0?void 0:v.isMoving())}isZooming(){var v;return this._zooming||((v=this.handlers)===null||v===void 0?void 0:v.isZooming())}isRotating(){var v;return this._rotating||((v=this.handlers)===null||v===void 0?void 0:v.isRotating())}_createDelegatedListener(v,r,a){if(v==="mouseenter"||v==="mouseover"){let p=!1;return{layers:r,listener:a,delegates:{mousemove:_=>{const S=r.filter(C=>this.getLayer(C)),k=S.length!==0?this.queryRenderedFeatures(_.point,{layers:S}):[];k.length?p||(p=!0,a.call(this,new An(v,this,_.originalEvent,{features:k}))):p=!1},mouseout:()=>{p=!1}}}}if(v==="mouseleave"||v==="mouseout"){let p=!1;return{layers:r,listener:a,delegates:{mousemove:S=>{const k=r.filter(C=>this.getLayer(C));(k.length!==0?this.queryRenderedFeatures(S.point,{layers:k}):[]).length?p=!0:p&&(p=!1,a.call(this,new An(v,this,S.originalEvent)))},mouseout:S=>{p&&(p=!1,a.call(this,new An(v,this,S.originalEvent)))}}}}{const p=f=>{const _=r.filter(k=>this.getLayer(k)),S=_.length!==0?this.queryRenderedFeatures(f.point,{layers:_}):[];S.length&&(f.features=S,a.call(this,f),delete f.features)};return{layers:r,listener:a,delegates:{[v]:p}}}}_saveDelegatedListener(v,r){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[v]=this._delegatedListeners[v]||[],this._delegatedListeners[v].push(r)}_removeDelegatedListener(v,r,a){if(!this._delegatedListeners||!this._delegatedListeners[v])return;const p=this._delegatedListeners[v];for(let f=0;fr.includes(S))){for(const S in _.delegates)this.off(S,_.delegates[S]);return void p.splice(f,1)}}}on(v,r,a){if(a===void 0)return super.on(v,r);const p=this._createDelegatedListener(v,typeof r=="string"?[r]:r,a);this._saveDelegatedListener(v,p);for(const f in p.delegates)this.on(f,p.delegates[f]);return this}once(v,r,a){if(a===void 0)return super.once(v,r);const p=typeof r=="string"?[r]:r,f=this._createDelegatedListener(v,p,a);for(const _ in f.delegates){const S=f.delegates[_];f.delegates[_]=(...k)=>{this._removeDelegatedListener(v,p,a),S(...k)}}this._saveDelegatedListener(v,f);for(const _ in f.delegates)this.once(_,f.delegates[_]);return this}off(v,r,a){return a===void 0?super.off(v,r):(this._removeDelegatedListener(v,typeof r=="string"?[r]:r,a),this)}queryRenderedFeatures(v,r){if(!this.style)return[];let a;const p=v instanceof c.P||Array.isArray(v),f=p?v:[[0,0],[this.transform.width,this.transform.height]];if(r=r||(p?{}:v)||{},f instanceof c.P||typeof f[0]=="number")a=[c.P.convert(f)];else{const _=c.P.convert(f[0]),S=c.P.convert(f[1]);a=[_,new c.P(S.x,_.y),S,new c.P(_.x,S.y),_]}return this.style.queryRenderedFeatures(a,r,this.transform)}querySourceFeatures(v,r){return this.style.querySourceFeatures(v,r)}setStyle(v,r){return(r=c.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},r)).diff!==!1&&r.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&v?(this._diffStyle(v,r),this):(this._localIdeographFontFamily=r.localIdeographFontFamily,this._updateStyle(v,r))}setTransformRequest(v){return this._requestManager.setTransformRequest(v),this}_getUIString(v){const r=this._locale[v];if(r==null)throw new Error(`Missing UI string '${v}'`);return r}_updateStyle(v,r){if(r.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(v,r));const a=this.style&&r.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!v)),v?(this.style=new lu(this,r||{}),this.style.setEventedParent(this,{style:this.style}),typeof v=="string"?this.style.loadURL(v,r,a):this.style.loadJSON(v,r,a),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new lu(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(v,r){if(typeof v=="string"){const a=this._requestManager.transformRequest(v,"Style");c.h(a,new AbortController).then(p=>{this._updateDiff(p.data,r)}).catch(p=>{p&&this.fire(new c.j(p))})}else typeof v=="object"&&this._updateDiff(v,r)}_updateDiff(v,r){try{this.style.setState(v,r)&&this._update(!0)}catch(a){c.w(`Unable to perform style diff: ${a.message||a.error||a}. Rebuilding the style from scratch.`),this._updateStyle(v,r)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():c.w("There is no style added to the map.")}addSource(v,r){return this._lazyInitEmptyStyle(),this.style.addSource(v,r),this._update(!0)}isSourceLoaded(v){const r=this.style&&this.style.sourceCaches[v];if(r!==void 0)return r.loaded();this.fire(new c.j(new Error(`There is no source with ID '${v}'`)))}setTerrain(v){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),v){const r=this.style.sourceCaches[v.source];if(!r)throw new Error(`cannot load terrain, because there exists no source with ID: ${v.source}`);this.terrain===null&&r.reload();for(const a in this.style._layers){const p=this.style._layers[a];p.type==="hillshade"&&p.source===v.source&&c.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new Dh(this.painter,r,v),this.painter.renderToTexture=new qp(this.painter,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=a=>{a.dataType==="style"?this.terrain.sourceCache.freeRtt():a.dataType==="source"&&a.tile&&(a.sourceId!==v.source||this._elevationFreeze||(this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(a.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.minElevationForCurrentTile=0,this.transform.elevation=0;return this.fire(new c.k("terrain",{terrain:v})),this}getTerrain(){var v,r;return(r=(v=this.terrain)===null||v===void 0?void 0:v.options)!==null&&r!==void 0?r:null}areTilesLoaded(){const v=this.style&&this.style.sourceCaches;for(const r in v){const a=v[r]._tiles;for(const p in a){const f=a[p];if(f.state!=="loaded"&&f.state!=="errored")return!1}}return!0}removeSource(v){return this.style.removeSource(v),this._update(!0)}getSource(v){return this.style.getSource(v)}addImage(v,r,a={}){const{pixelRatio:p=1,sdf:f=!1,stretchX:_,stretchY:S,content:k,textFitWidth:C,textFitHeight:z}=a;if(this._lazyInitEmptyStyle(),!(r instanceof HTMLImageElement||c.b(r))){if(r.width===void 0||r.height===void 0)return this.fire(new c.j(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:O,height:B,data:K}=r,Q=r;return this.style.addImage(v,{data:new c.R({width:O,height:B},new Uint8Array(K)),pixelRatio:p,stretchX:_,stretchY:S,content:k,textFitWidth:C,textFitHeight:z,sdf:f,version:0,userImage:Q}),Q.onAdd&&Q.onAdd(this,v),this}}{const{width:O,height:B,data:K}=D.getImageData(r);this.style.addImage(v,{data:new c.R({width:O,height:B},K),pixelRatio:p,stretchX:_,stretchY:S,content:k,textFitWidth:C,textFitHeight:z,sdf:f,version:0})}}updateImage(v,r){const a=this.style.getImage(v);if(!a)return this.fire(new c.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const p=r instanceof HTMLImageElement||c.b(r)?D.getImageData(r):r,{width:f,height:_,data:S}=p;if(f===void 0||_===void 0)return this.fire(new c.j(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(f!==a.data.width||_!==a.data.height)return this.fire(new c.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const k=!(r instanceof HTMLImageElement||c.b(r));return a.data.replace(S,k),this.style.updateImage(v,a),this}getImage(v){return this.style.getImage(v)}hasImage(v){return v?!!this.style.getImage(v):(this.fire(new c.j(new Error("Missing required image id"))),!1)}removeImage(v){this.style.removeImage(v)}loadImage(v){return q.getImage(this._requestManager.transformRequest(v,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(v,r){return this._lazyInitEmptyStyle(),this.style.addLayer(v,r),this._update(!0)}moveLayer(v,r){return this.style.moveLayer(v,r),this._update(!0)}removeLayer(v){return this.style.removeLayer(v),this._update(!0)}getLayer(v){return this.style.getLayer(v)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(v,r,a){return this.style.setLayerZoomRange(v,r,a),this._update(!0)}setFilter(v,r,a={}){return this.style.setFilter(v,r,a),this._update(!0)}getFilter(v){return this.style.getFilter(v)}setPaintProperty(v,r,a,p={}){return this.style.setPaintProperty(v,r,a,p),this._update(!0)}getPaintProperty(v,r){return this.style.getPaintProperty(v,r)}setLayoutProperty(v,r,a,p={}){return this.style.setLayoutProperty(v,r,a,p),this._update(!0)}getLayoutProperty(v,r){return this.style.getLayoutProperty(v,r)}setGlyphs(v,r={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(v,r),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(v,r,a={}){return this._lazyInitEmptyStyle(),this.style.addSprite(v,r,a,p=>{p||this._update(!0)}),this}removeSprite(v){return this._lazyInitEmptyStyle(),this.style.removeSprite(v),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(v,r={}){return this._lazyInitEmptyStyle(),this.style.setSprite(v,r,a=>{a||this._update(!0)}),this}setLight(v,r={}){return this._lazyInitEmptyStyle(),this.style.setLight(v,r),this._update(!0)}getLight(){return this.style.getLight()}setSky(v){return this._lazyInitEmptyStyle(),this.style.setSky(v),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(v,r){return this.style.setFeatureState(v,r),this._update()}removeFeatureState(v,r){return this.style.removeFeatureState(v,r),this._update()}getFeatureState(v){return this.style.getFeatureState(v)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let v=0,r=0;return this._container&&(v=this._container.clientWidth||400,r=this._container.clientHeight||300),[v,r]}_setupContainer(){const v=this._container;v.classList.add("maplibregl-map");const r=this._canvasContainer=A.create("div","maplibregl-canvas-container",v);this._interactive&&r.classList.add("maplibregl-interactive"),this._canvas=A.create("canvas","maplibregl-canvas",r),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");const a=this._containerDimensions(),p=this._getClampedPixelRatio(a[0],a[1]);this._resizeCanvas(a[0],a[1],p);const f=this._controlContainer=A.create("div","maplibregl-control-container",v),_=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(S=>{_[S]=A.create("div",`maplibregl-ctrl-${S} `,f)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(v,r,a){this._canvas.width=Math.floor(a*v),this._canvas.height=Math.floor(a*r),this._canvas.style.width=`${v}px`,this._canvas.style.height=`${r}px`}_setupPainter(){const v={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let r=null;this._canvas.addEventListener("webglcontextcreationerror",p=>{r={requestedAttributes:v},p&&(r.statusMessage=p.statusMessage,r.type=p.type)},{once:!0});const a=this._canvas.getContext("webgl2",v)||this._canvas.getContext("webgl",v);if(!a){const p="Failed to initialize WebGL";throw r?(r.message=p,new Error(JSON.stringify(r))):new Error(p)}this.painter=new Eu(a,this.transform),N.testSupport(a)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(v){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||v,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(v){return this._update(),this._renderTaskQueue.add(v)}_cancelRenderFrame(v){this._renderTaskQueue.remove(v)}_render(v){const r=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(v),this._removed)return;let a=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const f=this.transform.zoom,_=D.now();this.style.zoomHistory.update(f,_);const S=new c.z(f,{now:_,fadeDuration:r,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),k=S.crossFadingFactor();k===1&&k===this._crossFadingFactor||(a=!0,this._crossFadingFactor=k),this.style.update(S)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.minElevationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,r,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:r,showPadding:this.showPadding}),this.fire(new c.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,c.bf.mark(c.bg.load),this.fire(new c.k("load"))),this.style&&(this.style.hasTransitions()||a)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const p=this._sourcesDirty||this._styleDirty||this._placementDirty;return p||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new c.k("idle")),!this._loaded||this._fullyLoaded||p||(this._fullyLoaded=!0,c.bf.mark(c.bg.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var v;this._hash&&this._hash.remove();for(const a of this._controls)a.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),q.removeThrottleControl(this._imageQueueHandle),(v=this._resizeObserver)===null||v===void 0||v.disconnect();const r=this.painter.context.gl.getExtension("WEBGL_lose_context");r!=null&&r.loseContext&&r.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),A.remove(this._canvasContainer),A.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),c.bf.clearMetrics(),this._removed=!0,this.fire(new c.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,D.frameAsync(this._frameRequest).then(v=>{c.bf.frame(v),this._frameRequest=null,this._render(v)}).catch(()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(v){this._showTileBoundaries!==v&&(this._showTileBoundaries=v,this._update())}get showPadding(){return!!this._showPadding}set showPadding(v){this._showPadding!==v&&(this._showPadding=v,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(v){this._showCollisionBoxes!==v&&(this._showCollisionBoxes=v,v?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(v){this._showOverdrawInspector!==v&&(this._showOverdrawInspector=v,this._update())}get repaint(){return!!this._repaint}set repaint(v){this._repaint!==v&&(this._repaint=v,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(v){this._vertices=v,this._update()}get version(){return Xp}getCameraTargetElevation(){return this.transform.elevation}},y.MapMouseEvent=An,y.MapTouchEvent=Ms,y.MapWheelEvent=Up,y.Marker=Lu,y.NavigationControl=class{constructor(v){this._updateZoomButtons=()=>{const r=this._map.getZoom(),a=r===this._map.getMaxZoom(),p=r===this._map.getMinZoom();this._zoomInButton.disabled=a,this._zoomOutButton.disabled=p,this._zoomInButton.setAttribute("aria-disabled",a.toString()),this._zoomOutButton.setAttribute("aria-disabled",p.toString())},this._rotateCompassArrow=()=>{const r=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=r},this._setButtonTitle=(r,a)=>{const p=this._map._getUIString(`NavigationControl.${a}`);r.title=p,r.setAttribute("aria-label",p)},this.options=c.e({},xy,v),this._container=A.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",r=>r.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",r=>this._map.zoomIn({},{originalEvent:r})),A.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",r=>this._map.zoomOut({},{originalEvent:r})),A.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",r=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:r}):this._map.resetNorth({},{originalEvent:r})}),this._compassIcon=A.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(v){return this._map=v,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 wy(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){A.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(v,r){const a=A.create("button",v,this._container);return a.type="button",a.addEventListener("click",r),a}},y.Popup=class extends c.E{constructor(v){super(),this.remove=()=>(this._content&&A.remove(this._content),this._container&&(A.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),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new c.k("close"))),this),this._onMouseUp=r=>{this._update(r.point)},this._onMouseMove=r=>{this._update(r.point)},this._onDrag=r=>{this._update(r.point)},this._update=r=>{var a;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=A.create("div","maplibregl-popup",this._map.getContainer()),this._tip=A.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const k of this.options.className.split(" "))this._container.classList.add(k);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=this._map.transform.renderWorldCopies&&!this._trackPointer?Rr(this._lngLat,this._flatPos,this._map.transform):(a=this._lngLat)===null||a===void 0?void 0:a.wrap(),this._trackPointer&&!r)return;const p=this._flatPos=this._pos=this._trackPointer&&r?r:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&r?r:this._map.transform.locationPoint(this._lngLat));let f=this.options.anchor;const _=Ou(this.options.offset);if(!f){const k=this._container.offsetWidth,C=this._container.offsetHeight;let z;z=p.y+_.bottom.ythis._map.transform.height-C?["bottom"]:[],p.xthis._map.transform.width-k/2&&z.push("right"),f=z.length===0?"bottom":z.join("-")}let S=p.add(_[f]);this.options.subpixelPositioning||(S=S.round()),A.setTransform(this._container,`${xa[f]} translate(${S.x}px,${S.y}px)`),Ru(this._container,f,"popup")},this._onClose=()=>{this.remove()},this.options=c.e(Object.create(Nt),v)}addTo(v){return this._map&&this.remove(),this._map=v,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"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new c.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(v){return this._lngLat=c.N.convert(v),this._pos=null,this._flatPos=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"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(v){return this.setDOMContent(document.createTextNode(v))}setHTML(v){const r=document.createDocumentFragment(),a=document.createElement("body");let p;for(a.innerHTML=v;p=a.firstChild,p;)r.appendChild(p);return this.setDOMContent(r)}getMaxWidth(){var v;return(v=this._container)===null||v===void 0?void 0:v.style.maxWidth}setMaxWidth(v){return this.options.maxWidth=v,this._update(),this}setDOMContent(v){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=A.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(v),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(v){return this._container&&this._container.classList.add(v),this}removeClassName(v){return this._container&&this._container.classList.remove(v),this}setOffset(v){return this.options.offset=v,this._update(),this}toggleClassName(v){if(this._container)return this._container.classList.toggle(v)}setSubpixelPositioning(v){this.options.subpixelPositioning=v}_createCloseButton(){this.options.closeButton&&(this._closeButton=A.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const v=this._container.querySelector(Fu);v&&v.focus()}},y.RasterDEMTileSource=Ze,y.RasterTileSource=ke,y.ScaleControl=class{constructor(v){this._onMove=()=>{Sl(this._map,this._container,this.options)},this.setUnit=r=>{this.options.unit=r,Sl(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Co),v)}getDefaultPosition(){return"bottom-left"}onAdd(v){return this._map=v,this._container=A.create("div","maplibregl-ctrl maplibregl-ctrl-scale",v.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){A.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},y.ScrollZoomHandler=ro,y.Style=lu,y.TerrainControl=class{constructor(v){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=v}onAdd(v){return this._map=v,this._container=A.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=A.create("button","maplibregl-ctrl-terrain",this._container),A.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){A.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},y.TwoFingersTouchPitchHandler=ma,y.TwoFingersTouchRotateHandler=Ch,y.TwoFingersTouchZoomHandler=kh,y.TwoFingersTouchZoomRotateHandler=Ph,y.VectorTileSource=oe,y.VideoSource=St,y.addSourceType=(v,r)=>c._(void 0,void 0,void 0,function*(){if(vr(v))throw new Error(`A source type called "${v}" already exists.`);((a,p)=>{Lt[a]=p})(v,r)}),y.clearPrewarmedResources=function(){const v=Kt;v&&(v.isPreloaded()&&v.numActive()===1?(v.release(nt),Kt=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()"))},y.getMaxParallelImageRequests=function(){return c.a.MAX_PARALLEL_IMAGE_REQUESTS},y.getRTLTextPluginStatus=function(){return sn().getRTLTextPluginStatus()},y.getVersion=function(){return Fh},y.getWorkerCount=function(){return rt.workerCount},y.getWorkerUrl=function(){return c.a.WORKER_URL},y.importScriptInWorkers=function(v){return lr().broadcast("IS",v)},y.prewarm=function(){Gt().acquire(nt)},y.setMaxParallelImageRequests=function(v){c.a.MAX_PARALLEL_IMAGE_REQUESTS=v},y.setRTLTextPlugin=function(v,r){return sn().setRTLTextPlugin(v,r)},y.setWorkerCount=function(v){rt.workerCount=v},y.setWorkerUrl=function(v){c.a.WORKER_URL=v}});var g=i;return g})})(XT);var b5=XT.exports;const YT=ip(b5),S5={version:8,sources:{osm:{type:"raster",tiles:["https://a.tile.openstreetmap.org/{z}/{x}/{y}.png"],tileSize:256,attribution:"© OpenStreetMap Contributors",maxzoom:19}},layers:[{id:"osm",type:"raster",source:"osm"}]};var Hc={};/** - * @license React - * react-dom-server-legacy.browser.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var JT=jt;function tr(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,i=1;i