From a2dcd4cd167cb7a8bf9f28f8c207f72c0c02e881 Mon Sep 17 00:00:00 2001 From: Emilio Mariscal Date: Thu, 27 Feb 2025 20:20:34 -0300 Subject: [PATCH] Updates --- CNAME | 1 - assets/index-CNgqsxAA.js | 880 +++++++++++++++++++++++++++++++++++ assets/index-CNgqsxAA.js.map | 1 + assets/index-DDixQcNA.css | 1 + assets/index-f39ppyoz.css | 1 - assets/index-yu5xyEtM.js | 880 ----------------------------------- assets/index-yu5xyEtM.js.map | 1 - index.html | 4 +- 8 files changed, 884 insertions(+), 885 deletions(-) delete mode 100644 CNAME create mode 100644 assets/index-CNgqsxAA.js create mode 100644 assets/index-CNgqsxAA.js.map create mode 100644 assets/index-DDixQcNA.css delete mode 100644 assets/index-f39ppyoz.css delete mode 100644 assets/index-yu5xyEtM.js delete mode 100644 assets/index-yu5xyEtM.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-CNgqsxAA.js b/assets/index-CNgqsxAA.js new file mode 100644 index 0000000..50307d3 --- /dev/null +++ b/assets/index-CNgqsxAA.js @@ -0,0 +1,880 @@ +var yD=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Hj=yD((Gj,Bg)=>{(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const h of document.querySelectorAll('link[rel="modulepreload"]'))o(h);new MutationObserver(h=>{for(const f of h)if(f.type==="childList")for(const g of f.addedNodes)g.tagName==="LINK"&&g.rel==="modulepreload"&&o(g)}).observe(document,{childList:!0,subtree:!0});function n(h){const f={};return h.integrity&&(f.integrity=h.integrity),h.referrerPolicy&&(f.referrerPolicy=h.referrerPolicy),h.crossOrigin==="use-credentials"?f.credentials="include":h.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function o(h){if(h.ep)return;h.ep=!0;const f=n(h);fetch(h.href,f)}})();var Vo=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function dp(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function _D(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function o(){return this instanceof o?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(o){var h=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(n,o,h.get?h:{enumerable:!0,get:function(){return e[o]}})}),n}var JT={exports:{}},Ay={},QT={exports:{}},yr={};/** + * @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 fp=Symbol.for("react.element"),vD=Symbol.for("react.portal"),xD=Symbol.for("react.fragment"),wD=Symbol.for("react.strict_mode"),bD=Symbol.for("react.profiler"),SD=Symbol.for("react.provider"),kD=Symbol.for("react.context"),TD=Symbol.for("react.forward_ref"),ED=Symbol.for("react.suspense"),CD=Symbol.for("react.memo"),ID=Symbol.for("react.lazy"),eS=Symbol.iterator;function PD(e){return e===null||typeof e!="object"?null:(e=eS&&e[eS]||e["@@iterator"],typeof e=="function"?e:null)}var eE={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},tE=Object.assign,rE={};function Bh(e,t,n){this.props=e,this.context=t,this.refs=rE,this.updater=n||eE}Bh.prototype.isReactComponent={};Bh.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")};Bh.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function nE(){}nE.prototype=Bh.prototype;function xx(e,t,n){this.props=e,this.context=t,this.refs=rE,this.updater=n||eE}var wx=xx.prototype=new nE;wx.constructor=xx;tE(wx,Bh.prototype);wx.isPureReactComponent=!0;var tS=Array.isArray,iE=Object.prototype.hasOwnProperty,bx={current:null},sE={key:!0,ref:!0,__self:!0,__source:!0};function oE(e,t,n){var o,h={},f=null,g=null;if(t!=null)for(o in t.ref!==void 0&&(g=t.ref),t.key!==void 0&&(f=""+t.key),t)iE.call(t,o)&&!sE.hasOwnProperty(o)&&(h[o]=t[o]);var c=arguments.length-2;if(c===1)h.children=n;else if(1>>1,Ee=Be[xe];if(0>>1;xeh(rt,Ke))Jth(er,rt)?(Be[xe]=er,Be[Jt]=Ke,xe=Jt):(Be[xe]=rt,Be[nt]=Ke,xe=nt);else if(Jth(er,Ke))Be[xe]=er,Be[Jt]=Ke,xe=Jt;else break e}}return Le}function h(Be,Le){var Ke=Be.sortIndex-Le.sortIndex;return Ke!==0?Ke:Be.id-Le.id}if(typeof performance=="object"&&typeof performance.now=="function"){var f=performance;e.unstable_now=function(){return f.now()}}else{var g=Date,c=g.now();e.unstable_now=function(){return g.now()-c}}var T=[],I=[],z=1,A=null,M=3,F=!1,Y=!1,U=!1,J=typeof setTimeout=="function"?setTimeout:null,O=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 Z(Be){for(var Le=n(I);Le!==null;){if(Le.callback===null)o(I);else if(Le.startTime<=Be)o(I),Le.sortIndex=Le.expirationTime,t(T,Le);else break;Le=n(I)}}function ne(Be){if(U=!1,Z(Be),!Y)if(n(T)!==null)Y=!0,vt(oe);else{var Le=n(I);Le!==null&&ye(ne,Le.startTime-Be)}}function oe(Be,Le){Y=!1,U&&(U=!1,O(Fe),Fe=-1),F=!0;var Ke=M;try{for(Z(Le),A=n(T);A!==null&&(!(A.expirationTime>Le)||Be&&!it());){var xe=A.callback;if(typeof xe=="function"){A.callback=null,M=A.priorityLevel;var Ee=xe(A.expirationTime<=Le);Le=e.unstable_now(),typeof Ee=="function"?A.callback=Ee:A===n(T)&&o(T),Z(Le)}else o(T);A=n(T)}if(A!==null)var mt=!0;else{var nt=n(I);nt!==null&&ye(ne,nt.startTime-Le),mt=!1}return mt}finally{A=null,M=Ke,F=!1}}var ke=!1,ge=null,Fe=-1,Oe=5,Ge=-1;function it(){return!(e.unstable_now()-GeBe||125xe?(Be.sortIndex=Ke,t(I,Be),n(T)===null&&Be===n(I)&&(U?(O(Fe),Fe=-1):U=!0,ye(ne,Ke-xe))):(Be.sortIndex=Ee,t(T,Be),Y||F||(Y=!0,vt(oe))),Be},e.unstable_shouldYield=it,e.unstable_wrapCallback=function(Be){var Le=M;return function(){var Ke=M;M=Le;try{return Be.apply(this,arguments)}finally{M=Ke}}}})(hE);cE.exports=hE;var $D=cE.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 jD=Ht,Fs=$D;function lt(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),jv=Object.prototype.hasOwnProperty,UD=/^[: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]*$/,nS={},iS={};function VD(e){return jv.call(iS,e)?!0:jv.call(nS,e)?!1:UD.test(e)?iS[e]=!0:(nS[e]=!0,!1)}function HD(e,t,n,o){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return o?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function WD(e,t,n,o){if(t===null||typeof t>"u"||HD(e,t,n,o))return!0;if(o)return!1;if(n!==null)switch(n.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 Gi(e,t,n,o,h,f,g){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=o,this.attributeNamespace=h,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=f,this.removeEmptyString=g}var hi={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){hi[e]=new Gi(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];hi[t]=new Gi(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){hi[e]=new Gi(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){hi[e]=new Gi(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){hi[e]=new Gi(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){hi[e]=new Gi(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){hi[e]=new Gi(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){hi[e]=new Gi(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){hi[e]=new Gi(e,5,!1,e.toLowerCase(),null,!1,!1)});var kx=/[\-:]([a-z])/g;function Tx(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(kx,Tx);hi[t]=new Gi(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(kx,Tx);hi[t]=new Gi(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(kx,Tx);hi[t]=new Gi(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){hi[e]=new Gi(e,1,!1,e.toLowerCase(),null,!1,!1)});hi.xlinkHref=new Gi("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){hi[e]=new Gi(e,1,!1,e.toLowerCase(),null,!0,!0)});function Ex(e,t,n,o){var h=hi.hasOwnProperty(t)?hi[t]:null;(h!==null?h.type!==0:o||!(2c||h[g]!==f[c]){var T=` +`+h[g].replace(" at new "," at ");return e.displayName&&T.includes("")&&(T=T.replace("",e.displayName)),T}while(1<=g&&0<=c);break}}}finally{G0=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?pf(e):""}function GD(e){switch(e.tag){case 5:return pf(e.type);case 16:return pf("Lazy");case 13:return pf("Suspense");case 19:return pf("SuspenseList");case 0:case 2:case 15:return e=Z0(e.type,!1),e;case 11:return e=Z0(e.type.render,!1),e;case 1:return e=Z0(e.type,!0),e;default:return""}}function Wv(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 eh:return"Fragment";case Qc:return"Portal";case Uv:return"Profiler";case Cx:return"StrictMode";case Vv:return"Suspense";case Hv:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case pE:return(e.displayName||"Context")+".Consumer";case fE:return(e._context.displayName||"Context")+".Provider";case Ix:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Px:return t=e.displayName||null,t!==null?t:Wv(e.type)||"Memo";case bl:t=e._payload,e=e._init;try{return Wv(e(t))}catch{}}return null}function ZD(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 Wv(t);case 8:return t===Cx?"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 Ul(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function gE(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function qD(e){var t=gE(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),o=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var h=n.get,f=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return h.call(this)},set:function(g){o=""+g,f.call(this,g)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return o},setValue:function(g){o=""+g},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Rm(e){e._valueTracker||(e._valueTracker=qD(e))}function yE(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),o="";return e&&(o=gE(e)?e.checked?"true":"false":e.value),e=o,e!==n?(t.setValue(e),!0):!1}function Ng(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 Gv(e,t){var n=t.checked;return kn({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function oS(e,t){var n=t.defaultValue==null?"":t.defaultValue,o=t.checked!=null?t.checked:t.defaultChecked;n=Ul(t.value!=null?t.value:n),e._wrapperState={initialChecked:o,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function _E(e,t){t=t.checked,t!=null&&Ex(e,"checked",t,!1)}function Zv(e,t){_E(e,t);var n=Ul(t.value),o=t.type;if(n!=null)o==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(o==="submit"||o==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?qv(e,t.type,n):t.hasOwnProperty("defaultValue")&&qv(e,t.type,Ul(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function aS(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var o=t.type;if(!(o!=="submit"&&o!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function qv(e,t,n){(t!=="number"||Ng(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var mf=Array.isArray;function ph(e,t,n,o){if(e=e.options,t){t={};for(var h=0;h"+t.valueOf().toString()+"",t=Lm.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Nf(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Sf={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},YD=["Webkit","ms","Moz","O"];Object.keys(Sf).forEach(function(e){YD.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Sf[t]=Sf[e]})});function bE(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Sf.hasOwnProperty(e)&&Sf[e]?(""+t).trim():t+"px"}function SE(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var o=n.indexOf("--")===0,h=bE(n,t[n],o);n==="float"&&(n="cssFloat"),o?e.setProperty(n,h):e[n]=h}}var XD=kn({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 Kv(e,t){if(t){if(XD[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 Jv(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 Qv=null;function Mx(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var e1=null,mh=null,gh=null;function cS(e){if(e=gp(e)){if(typeof e1!="function")throw Error(lt(280));var t=e.stateNode;t&&(t=Oy(t),e1(e.stateNode,e.type,t))}}function kE(e){mh?gh?gh.push(e):gh=[e]:mh=e}function TE(){if(mh){var e=mh,t=gh;if(gh=mh=null,cS(e),t)for(e=0;e>>=0,e===0?32:31-(az(e)/lz|0)|0}var Om=64,Fm=4194304;function gf(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 Vg(e,t){var n=e.pendingLanes;if(n===0)return 0;var o=0,h=e.suspendedLanes,f=e.pingedLanes,g=n&268435455;if(g!==0){var c=g&~h;c!==0?o=gf(c):(f&=g,f!==0&&(o=gf(f)))}else g=n&~h,g!==0?o=gf(g):f!==0&&(o=gf(f));if(o===0)return 0;if(t!==0&&t!==o&&!(t&h)&&(h=o&-o,f=t&-t,h>=f||h===16&&(f&4194240)!==0))return t;if(o&4&&(o|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=o;0n;n++)t.push(e);return t}function pp(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-vo(t),e[t]=n}function dz(e,t){var n=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 o=e.eventTimes;for(e=e.expirationTimes;0=Tf),vS=" ",xS=!1;function WE(e,t){switch(e){case"keyup":return $z.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function GE(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var th=!1;function Uz(e,t){switch(e){case"compositionend":return GE(t);case"keypress":return t.which!==32?null:(xS=!0,vS);case"textInput":return e=t.data,e===vS&&xS?null:e;default:return null}}function Vz(e,t){if(th)return e==="compositionend"||!Bx&&WE(e,t)?(e=VE(),cg=Lx=El=null,th=!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:n,offset:t-e};e=o}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=kS(n)}}function XE(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?XE(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function KE(){for(var e=window,t=Ng();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Ng(e.document)}return t}function Nx(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 Jz(e){var t=KE(),n=e.focusedElem,o=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&XE(n.ownerDocument.documentElement,n)){if(o!==null&&Nx(n)){if(t=o.start,e=o.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var h=n.textContent.length,f=Math.min(o.start,h);o=o.end===void 0?f:Math.min(o.end,h),!e.extend&&f>o&&(h=o,o=f,f=h),h=TS(n,f);var g=TS(n,o);h&&g&&(e.rangeCount!==1||e.anchorNode!==h.node||e.anchorOffset!==h.offset||e.focusNode!==g.node||e.focusOffset!==g.offset)&&(t=t.createRange(),t.setStart(h.node,h.offset),e.removeAllRanges(),f>o?(e.addRange(t),e.extend(g.node,g.offset)):(t.setEnd(g.node,g.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,rh=null,o1=null,Cf=null,a1=!1;function ES(e,t,n){var o=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;a1||rh==null||rh!==Ng(o)||(o=rh,"selectionStart"in o&&Nx(o)?o={start:o.selectionStart,end:o.selectionEnd}:(o=(o.ownerDocument&&o.ownerDocument.defaultView||window).getSelection(),o={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}),Cf&&Wf(Cf,o)||(Cf=o,o=Gg(o1,"onSelect"),0sh||(e.current=f1[sh],f1[sh]=null,sh--)}function en(e,t){sh++,f1[sh]=e.current,e.current=t}var Vl={},Pi=Wl(Vl),cs=Wl(!1),Vu=Vl;function kh(e,t){var n=e.type.contextTypes;if(!n)return Vl;var o=e.stateNode;if(o&&o.__reactInternalMemoizedUnmaskedChildContext===t)return o.__reactInternalMemoizedMaskedChildContext;var h={},f;for(f in n)h[f]=t[f];return o&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=h),h}function hs(e){return e=e.childContextTypes,e!=null}function qg(){cn(cs),cn(Pi)}function zS(e,t,n){if(Pi.current!==Vl)throw Error(lt(168));en(Pi,t),en(cs,n)}function oC(e,t,n){var o=e.stateNode;if(t=t.childContextTypes,typeof o.getChildContext!="function")return n;o=o.getChildContext();for(var h in o)if(!(h in t))throw Error(lt(108,ZD(e)||"Unknown",h));return kn({},n,o)}function Yg(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Vl,Vu=Pi.current,en(Pi,e),en(cs,cs.current),!0}function RS(e,t,n){var o=e.stateNode;if(!o)throw Error(lt(169));n?(e=oC(e,t,Vu),o.__reactInternalMemoizedMergedChildContext=e,cn(cs),cn(Pi),en(Pi,e)):cn(cs),en(cs,n)}var xa=null,Fy=!1,av=!1;function aC(e){xa===null?xa=[e]:xa.push(e)}function cR(e){Fy=!0,aC(e)}function Gl(){if(!av&&xa!==null){av=!0;var e=0,t=jr;try{var n=xa;for(jr=1;e>=g,h-=g,wa=1<<32-vo(t)+h|n<Fe?(Oe=ge,ge=null):Oe=ge.sibling;var Ge=M(O,ge,Z[Fe],ne);if(Ge===null){ge===null&&(ge=Oe);break}e&&ge&&Ge.alternate===null&&t(O,ge),$=f(Ge,$,Fe),ke===null?oe=Ge:ke.sibling=Ge,ke=Ge,ge=Oe}if(Fe===Z.length)return n(O,ge),yn&&bu(O,Fe),oe;if(ge===null){for(;FeFe?(Oe=ge,ge=null):Oe=ge.sibling;var it=M(O,ge,Ge.value,ne);if(it===null){ge===null&&(ge=Oe);break}e&&ge&&it.alternate===null&&t(O,ge),$=f(it,$,Fe),ke===null?oe=it:ke.sibling=it,ke=it,ge=Oe}if(Ge.done)return n(O,ge),yn&&bu(O,Fe),oe;if(ge===null){for(;!Ge.done;Fe++,Ge=Z.next())Ge=A(O,Ge.value,ne),Ge!==null&&($=f(Ge,$,Fe),ke===null?oe=Ge:ke.sibling=Ge,ke=Ge);return yn&&bu(O,Fe),oe}for(ge=o(O,ge);!Ge.done;Fe++,Ge=Z.next())Ge=F(ge,O,Fe,Ge.value,ne),Ge!==null&&(e&&Ge.alternate!==null&&ge.delete(Ge.key===null?Fe:Ge.key),$=f(Ge,$,Fe),ke===null?oe=Ge:ke.sibling=Ge,ke=Ge);return e&&ge.forEach(function(ve){return t(O,ve)}),yn&&bu(O,Fe),oe}function J(O,$,Z,ne){if(typeof Z=="object"&&Z!==null&&Z.type===eh&&Z.key===null&&(Z=Z.props.children),typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case zm:e:{for(var oe=Z.key,ke=$;ke!==null;){if(ke.key===oe){if(oe=Z.type,oe===eh){if(ke.tag===7){n(O,ke.sibling),$=h(ke,Z.props.children),$.return=O,O=$;break e}}else if(ke.elementType===oe||typeof oe=="object"&&oe!==null&&oe.$$typeof===bl&&FS(oe)===ke.type){n(O,ke.sibling),$=h(ke,Z.props),$.ref=uf(O,ke,Z),$.return=O,O=$;break e}n(O,ke);break}else t(O,ke);ke=ke.sibling}Z.type===eh?($=Ou(Z.props.children,O.mode,ne,Z.key),$.return=O,O=$):(ne=_g(Z.type,Z.key,Z.props,null,O.mode,ne),ne.ref=uf(O,$,Z),ne.return=O,O=ne)}return g(O);case Qc:e:{for(ke=Z.key;$!==null;){if($.key===ke)if($.tag===4&&$.stateNode.containerInfo===Z.containerInfo&&$.stateNode.implementation===Z.implementation){n(O,$.sibling),$=h($,Z.children||[]),$.return=O,O=$;break e}else{n(O,$);break}else t(O,$);$=$.sibling}$=mv(Z,O.mode,ne),$.return=O,O=$}return g(O);case bl:return ke=Z._init,J(O,$,ke(Z._payload),ne)}if(mf(Z))return Y(O,$,Z,ne);if(nf(Z))return U(O,$,Z,ne);Hm(O,Z)}return typeof Z=="string"&&Z!==""||typeof Z=="number"?(Z=""+Z,$!==null&&$.tag===6?(n(O,$.sibling),$=h($,Z),$.return=O,O=$):(n(O,$),$=pv(Z,O.mode,ne),$.return=O,O=$),g(O)):n(O,$)}return J}var Eh=hC(!0),dC=hC(!1),Jg=Wl(null),Qg=null,lh=null,Vx=null;function Hx(){Vx=lh=Qg=null}function Wx(e){var t=Jg.current;cn(Jg),e._currentValue=t}function g1(e,t,n){for(;e!==null;){var o=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,o!==null&&(o.childLanes|=t)):o!==null&&(o.childLanes&t)!==t&&(o.childLanes|=t),e===n)break;e=e.return}}function _h(e,t){Qg=e,Vx=lh=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(ls=!0),e.firstContext=null)}function eo(e){var t=e._currentValue;if(Vx!==e)if(e={context:e,memoizedValue:t,next:null},lh===null){if(Qg===null)throw Error(lt(308));lh=e,Qg.dependencies={lanes:0,firstContext:e}}else lh=lh.next=e;return t}var Pu=null;function Gx(e){Pu===null?Pu=[e]:Pu.push(e)}function fC(e,t,n,o){var h=t.interleaved;return h===null?(n.next=n,Gx(t)):(n.next=h.next,h.next=n),t.interleaved=n,Ma(e,o)}function Ma(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Sl=!1;function Zx(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function pC(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 Ta(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Fl(e,t,n){var o=e.updateQueue;if(o===null)return null;if(o=o.shared,Pr&2){var h=o.pending;return h===null?t.next=t:(t.next=h.next,h.next=t),o.pending=t,Ma(e,n)}return h=o.interleaved,h===null?(t.next=t,Gx(o)):(t.next=h.next,h.next=t),o.interleaved=t,Ma(e,n)}function dg(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var o=t.lanes;o&=e.pendingLanes,n|=o,t.lanes=n,Dx(e,n)}}function BS(e,t){var n=e.updateQueue,o=e.alternate;if(o!==null&&(o=o.updateQueue,n===o)){var h=null,f=null;if(n=n.firstBaseUpdate,n!==null){do{var g={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};f===null?h=f=g:f=f.next=g,n=n.next}while(n!==null);f===null?h=f=t:f=f.next=t}else h=f=t;n={baseState:o.baseState,firstBaseUpdate:h,lastBaseUpdate:f,shared:o.shared,effects:o.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function ey(e,t,n,o){var h=e.updateQueue;Sl=!1;var f=h.firstBaseUpdate,g=h.lastBaseUpdate,c=h.shared.pending;if(c!==null){h.shared.pending=null;var T=c,I=T.next;T.next=null,g===null?f=I:g.next=I,g=T;var z=e.alternate;z!==null&&(z=z.updateQueue,c=z.lastBaseUpdate,c!==g&&(c===null?z.firstBaseUpdate=I:c.next=I,z.lastBaseUpdate=T))}if(f!==null){var A=h.baseState;g=0,z=I=T=null,c=f;do{var M=c.lane,F=c.eventTime;if((o&M)===M){z!==null&&(z=z.next={eventTime:F,lane:0,tag:c.tag,payload:c.payload,callback:c.callback,next:null});e:{var Y=e,U=c;switch(M=t,F=n,U.tag){case 1:if(Y=U.payload,typeof Y=="function"){A=Y.call(F,A,M);break e}A=Y;break e;case 3:Y.flags=Y.flags&-65537|128;case 0:if(Y=U.payload,M=typeof Y=="function"?Y.call(F,A,M):Y,M==null)break e;A=kn({},A,M);break e;case 2:Sl=!0}}c.callback!==null&&c.lane!==0&&(e.flags|=64,M=h.effects,M===null?h.effects=[c]:M.push(c))}else F={eventTime:F,lane:M,tag:c.tag,payload:c.payload,callback:c.callback,next:null},z===null?(I=z=F,T=A):z=z.next=F,g|=M;if(c=c.next,c===null){if(c=h.shared.pending,c===null)break;M=c,c=M.next,M.next=null,h.lastBaseUpdate=M,h.shared.pending=null}}while(!0);if(z===null&&(T=A),h.baseState=T,h.firstBaseUpdate=I,h.lastBaseUpdate=z,t=h.shared.interleaved,t!==null){h=t;do g|=h.lane,h=h.next;while(h!==t)}else f===null&&(h.shared.lanes=0);Gu|=g,e.lanes=g,e.memoizedState=A}}function NS(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var o=uv.transition;uv.transition={};try{e(!1),t()}finally{jr=n,uv.transition=o}}function AC(){return to().memoizedState}function pR(e,t,n){var o=Nl(e);if(n={lane:o,action:n,hasEagerState:!1,eagerState:null,next:null},DC(e))zC(t,n);else if(n=fC(e,t,n,o),n!==null){var h=Hi();xo(n,e,o,h),RC(n,t,o)}}function mR(e,t,n){var o=Nl(e),h={lane:o,action:n,hasEagerState:!1,eagerState:null,next:null};if(DC(e))zC(t,h);else{var f=e.alternate;if(e.lanes===0&&(f===null||f.lanes===0)&&(f=t.lastRenderedReducer,f!==null))try{var g=t.lastRenderedState,c=f(g,n);if(h.hasEagerState=!0,h.eagerState=c,So(c,g)){var T=t.interleaved;T===null?(h.next=h,Gx(t)):(h.next=T.next,T.next=h),t.interleaved=h;return}}catch{}finally{}n=fC(e,t,h,o),n!==null&&(h=Hi(),xo(n,e,o,h),RC(n,t,o))}}function DC(e){var t=e.alternate;return e===Sn||t!==null&&t===Sn}function zC(e,t){If=ry=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function RC(e,t,n){if(n&4194240){var o=t.lanes;o&=e.pendingLanes,n|=o,t.lanes=n,Dx(e,n)}}var ny={readContext:eo,useCallback:ki,useContext:ki,useEffect:ki,useImperativeHandle:ki,useInsertionEffect:ki,useLayoutEffect:ki,useMemo:ki,useReducer:ki,useRef:ki,useState:ki,useDebugValue:ki,useDeferredValue:ki,useTransition:ki,useMutableSource:ki,useSyncExternalStore:ki,useId:ki,unstable_isNewReconciler:!1},gR={readContext:eo,useCallback:function(e,t){return jo().memoizedState=[e,t===void 0?null:t],e},useContext:eo,useEffect:jS,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,pg(4194308,4,EC.bind(null,t,e),n)},useLayoutEffect:function(e,t){return pg(4194308,4,e,t)},useInsertionEffect:function(e,t){return pg(4,2,e,t)},useMemo:function(e,t){var n=jo();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var o=jo();return t=n!==void 0?n(t):t,o.memoizedState=o.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},o.queue=e,e=e.dispatch=pR.bind(null,Sn,e),[o.memoizedState,e]},useRef:function(e){var t=jo();return e={current:e},t.memoizedState=e},useState:$S,useDebugValue:tw,useDeferredValue:function(e){return jo().memoizedState=e},useTransition:function(){var e=$S(!1),t=e[0];return e=fR.bind(null,e[1]),jo().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var o=Sn,h=jo();if(yn){if(n===void 0)throw Error(lt(407));n=n()}else{if(n=t(),ti===null)throw Error(lt(349));Wu&30||_C(o,t,n)}h.memoizedState=n;var f={value:n,getSnapshot:t};return h.queue=f,jS(xC.bind(null,o,f,e),[e]),o.flags|=2048,Qf(9,vC.bind(null,o,f,n,t),void 0,null),n},useId:function(){var e=jo(),t=ti.identifierPrefix;if(yn){var n=ba,o=wa;n=(o&~(1<<32-vo(o)-1)).toString(32)+n,t=":"+t+"R"+n,n=Kf++,0<\/script>",e=e.removeChild(e.firstChild)):typeof o.is=="string"?e=g.createElement(n,{is:o.is}):(e=g.createElement(n),n==="select"&&(g=e,o.multiple?g.multiple=!0:o.size&&(g.size=o.size))):e=g.createElementNS(e,n),e[Ho]=t,e[qf]=o,HC(e,t,!1,!1),t.stateNode=e;e:{switch(g=Jv(n,o),n){case"dialog":sn("cancel",e),sn("close",e),h=o;break;case"iframe":case"object":case"embed":sn("load",e),h=o;break;case"video":case"audio":for(h=0;hPh&&(t.flags|=128,o=!0,cf(f,!1),t.lanes=4194304)}else{if(!o)if(e=ty(g),e!==null){if(t.flags|=128,o=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),cf(f,!0),f.tail===null&&f.tailMode==="hidden"&&!g.alternate&&!yn)return Ti(t),null}else 2*An()-f.renderingStartTime>Ph&&n!==1073741824&&(t.flags|=128,o=!0,cf(f,!1),t.lanes=4194304);f.isBackwards?(g.sibling=t.child,t.child=g):(n=f.last,n!==null?n.sibling=g:t.child=g,f.last=g)}return f.tail!==null?(t=f.tail,f.rendering=t,f.tail=t.sibling,f.renderingStartTime=An(),t.sibling=null,n=bn.current,en(bn,o?n&1|2:n&1),t):(Ti(t),null);case 22:case 23:return aw(),o=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==o&&(t.flags|=8192),o&&t.mode&1?Ms&1073741824&&(Ti(t),t.subtreeFlags&6&&(t.flags|=8192)):Ti(t),null;case 24:return null;case 25:return null}throw Error(lt(156,t.tag))}function kR(e,t){switch(jx(t),t.tag){case 1:return hs(t.type)&&qg(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ch(),cn(cs),cn(Pi),Xx(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Yx(t),null;case 13:if(cn(bn),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(lt(340));Th()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return cn(bn),null;case 4:return Ch(),null;case 10:return Wx(t.type._context),null;case 22:case 23:return aw(),null;case 24:return null;default:return null}}var Gm=!1,Ci=!1,TR=typeof WeakSet=="function"?WeakSet:Set,Lt=null;function uh(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(o){In(e,t,o)}else n.current=null}function T1(e,t,n){try{n()}catch(o){In(e,t,o)}}var JS=!1;function ER(e,t){if(l1=Hg,e=KE(),Nx(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var o=n.getSelection&&n.getSelection();if(o&&o.rangeCount!==0){n=o.anchorNode;var h=o.anchorOffset,f=o.focusNode;o=o.focusOffset;try{n.nodeType,f.nodeType}catch{n=null;break e}var g=0,c=-1,T=-1,I=0,z=0,A=e,M=null;t:for(;;){for(var F;A!==n||h!==0&&A.nodeType!==3||(c=g+h),A!==f||o!==0&&A.nodeType!==3||(T=g+o),A.nodeType===3&&(g+=A.nodeValue.length),(F=A.firstChild)!==null;)M=A,A=F;for(;;){if(A===e)break t;if(M===n&&++I===h&&(c=g),M===f&&++z===o&&(T=g),(F=A.nextSibling)!==null)break;A=M,M=A.parentNode}A=F}n=c===-1||T===-1?null:{start:c,end:T}}else n=null}n=n||{start:0,end:0}}else n=null;for(u1={focusedElem:e,selectionRange:n},Hg=!1,Lt=t;Lt!==null;)if(t=Lt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Lt=e;else for(;Lt!==null;){t=Lt;try{var Y=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(Y!==null){var U=Y.memoizedProps,J=Y.memoizedState,O=t.stateNode,$=O.getSnapshotBeforeUpdate(t.elementType===t.type?U:po(t.type,U),J);O.__reactInternalSnapshotBeforeUpdate=$}break;case 3:var Z=t.stateNode.containerInfo;Z.nodeType===1?Z.textContent="":Z.nodeType===9&&Z.documentElement&&Z.removeChild(Z.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(lt(163))}}catch(ne){In(t,t.return,ne)}if(e=t.sibling,e!==null){e.return=t.return,Lt=e;break}Lt=t.return}return Y=JS,JS=!1,Y}function Pf(e,t,n){var o=t.updateQueue;if(o=o!==null?o.lastEffect:null,o!==null){var h=o=o.next;do{if((h.tag&e)===e){var f=h.destroy;h.destroy=void 0,f!==void 0&&T1(t,n,f)}h=h.next}while(h!==o)}}function $y(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var o=n.create;n.destroy=o()}n=n.next}while(n!==t)}}function E1(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function ZC(e){var t=e.alternate;t!==null&&(e.alternate=null,ZC(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Ho],delete t[qf],delete t[d1],delete t[lR],delete t[uR])),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 qC(e){return e.tag===5||e.tag===3||e.tag===4}function QS(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||qC(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 C1(e,t,n){var o=e.tag;if(o===5||o===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Zg));else if(o!==4&&(e=e.child,e!==null))for(C1(e,t,n),e=e.sibling;e!==null;)C1(e,t,n),e=e.sibling}function I1(e,t,n){var o=e.tag;if(o===5||o===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(o!==4&&(e=e.child,e!==null))for(I1(e,t,n),e=e.sibling;e!==null;)I1(e,t,n),e=e.sibling}var li=null,go=!1;function _l(e,t,n){for(n=n.child;n!==null;)YC(e,t,n),n=n.sibling}function YC(e,t,n){if(Go&&typeof Go.onCommitFiberUnmount=="function")try{Go.onCommitFiberUnmount(Dy,n)}catch{}switch(n.tag){case 5:Ci||uh(n,t);case 6:var o=li,h=go;li=null,_l(e,t,n),li=o,go=h,li!==null&&(go?(e=li,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):li.removeChild(n.stateNode));break;case 18:li!==null&&(go?(e=li,n=n.stateNode,e.nodeType===8?ov(e.parentNode,n):e.nodeType===1&&ov(e,n),Vf(e)):ov(li,n.stateNode));break;case 4:o=li,h=go,li=n.stateNode.containerInfo,go=!0,_l(e,t,n),li=o,go=h;break;case 0:case 11:case 14:case 15:if(!Ci&&(o=n.updateQueue,o!==null&&(o=o.lastEffect,o!==null))){h=o=o.next;do{var f=h,g=f.destroy;f=f.tag,g!==void 0&&(f&2||f&4)&&T1(n,t,g),h=h.next}while(h!==o)}_l(e,t,n);break;case 1:if(!Ci&&(uh(n,t),o=n.stateNode,typeof o.componentWillUnmount=="function"))try{o.props=n.memoizedProps,o.state=n.memoizedState,o.componentWillUnmount()}catch(c){In(n,t,c)}_l(e,t,n);break;case 21:_l(e,t,n);break;case 22:n.mode&1?(Ci=(o=Ci)||n.memoizedState!==null,_l(e,t,n),Ci=o):_l(e,t,n);break;default:_l(e,t,n)}}function ek(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new TR),t.forEach(function(o){var h=LR.bind(null,e,o);n.has(o)||(n.add(o),o.then(h,h))})}}function fo(e,t){var n=t.deletions;if(n!==null)for(var o=0;oh&&(h=g),o&=~f}if(o=h,o=An()-o,o=(120>o?120:480>o?480:1080>o?1080:1920>o?1920:3e3>o?3e3:4320>o?4320:1960*IR(o/1960))-o,10e?16:e,Cl===null)var o=!1;else{if(e=Cl,Cl=null,oy=0,Pr&6)throw Error(lt(331));var h=Pr;for(Pr|=4,Lt=e.current;Lt!==null;){var f=Lt,g=f.child;if(Lt.flags&16){var c=f.deletions;if(c!==null){for(var T=0;TAn()-sw?Lu(e,0):iw|=n),ds(e,t)}function nI(e,t){t===0&&(e.mode&1?(t=Fm,Fm<<=1,!(Fm&130023424)&&(Fm=4194304)):t=1);var n=Hi();e=Ma(e,t),e!==null&&(pp(e,t,n),ds(e,n))}function RR(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),nI(e,n)}function LR(e,t){var n=0;switch(e.tag){case 13:var o=e.stateNode,h=e.memoizedState;h!==null&&(n=h.retryLane);break;case 19:o=e.stateNode;break;default:throw Error(lt(314))}o!==null&&o.delete(t),nI(e,n)}var iI;iI=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||cs.current)ls=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return ls=!1,bR(e,t,n);ls=!!(e.flags&131072)}else ls=!1,yn&&t.flags&1048576&&lC(t,Kg,t.index);switch(t.lanes=0,t.tag){case 2:var o=t.type;mg(e,t),e=t.pendingProps;var h=kh(t,Pi.current);_h(t,n),h=Jx(null,t,o,e,h,n);var f=Qx();return t.flags|=1,typeof h=="object"&&h!==null&&typeof h.render=="function"&&h.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,hs(o)?(f=!0,Yg(t)):f=!1,t.memoizedState=h.state!==null&&h.state!==void 0?h.state:null,Zx(t),h.updater=Ny,t.stateNode=h,h._reactInternals=t,_1(t,o,e,n),t=w1(null,t,o,!0,f,n)):(t.tag=0,yn&&f&&$x(t),Ni(null,t,h,n),t=t.child),t;case 16:o=t.elementType;e:{switch(mg(e,t),e=t.pendingProps,h=o._init,o=h(o._payload),t.type=o,h=t.tag=FR(o),e=po(o,e),h){case 0:t=x1(null,t,o,e,n);break e;case 1:t=YS(null,t,o,e,n);break e;case 11:t=ZS(null,t,o,e,n);break e;case 14:t=qS(null,t,o,po(o.type,e),n);break e}throw Error(lt(306,o,""))}return t;case 0:return o=t.type,h=t.pendingProps,h=t.elementType===o?h:po(o,h),x1(e,t,o,h,n);case 1:return o=t.type,h=t.pendingProps,h=t.elementType===o?h:po(o,h),YS(e,t,o,h,n);case 3:e:{if(jC(t),e===null)throw Error(lt(387));o=t.pendingProps,f=t.memoizedState,h=f.element,pC(e,t),ey(t,o,null,n);var g=t.memoizedState;if(o=g.element,f.isDehydrated)if(f={element:o,isDehydrated:!1,cache:g.cache,pendingSuspenseBoundaries:g.pendingSuspenseBoundaries,transitions:g.transitions},t.updateQueue.baseState=f,t.memoizedState=f,t.flags&256){h=Ih(Error(lt(423)),t),t=XS(e,t,o,n,h);break e}else if(o!==h){h=Ih(Error(lt(424)),t),t=XS(e,t,o,n,h);break e}else for(Ls=Ol(t.stateNode.containerInfo.firstChild),Os=t,yn=!0,yo=null,n=dC(t,null,o,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Th(),o===h){t=Aa(e,t,n);break e}Ni(e,t,o,n)}t=t.child}return t;case 5:return mC(t),e===null&&m1(t),o=t.type,h=t.pendingProps,f=e!==null?e.memoizedProps:null,g=h.children,c1(o,h)?g=null:f!==null&&c1(o,f)&&(t.flags|=32),$C(e,t),Ni(e,t,g,n),t.child;case 6:return e===null&&m1(t),null;case 13:return UC(e,t,n);case 4:return qx(t,t.stateNode.containerInfo),o=t.pendingProps,e===null?t.child=Eh(t,null,o,n):Ni(e,t,o,n),t.child;case 11:return o=t.type,h=t.pendingProps,h=t.elementType===o?h:po(o,h),ZS(e,t,o,h,n);case 7:return Ni(e,t,t.pendingProps,n),t.child;case 8:return Ni(e,t,t.pendingProps.children,n),t.child;case 12:return Ni(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(o=t.type._context,h=t.pendingProps,f=t.memoizedProps,g=h.value,en(Jg,o._currentValue),o._currentValue=g,f!==null)if(So(f.value,g)){if(f.children===h.children&&!cs.current){t=Aa(e,t,n);break e}}else for(f=t.child,f!==null&&(f.return=t);f!==null;){var c=f.dependencies;if(c!==null){g=f.child;for(var T=c.firstContext;T!==null;){if(T.context===o){if(f.tag===1){T=Ta(-1,n&-n),T.tag=2;var I=f.updateQueue;if(I!==null){I=I.shared;var z=I.pending;z===null?T.next=T:(T.next=z.next,z.next=T),I.pending=T}}f.lanes|=n,T=f.alternate,T!==null&&(T.lanes|=n),g1(f.return,n,t),c.lanes|=n;break}T=T.next}}else if(f.tag===10)g=f.type===t.type?null:f.child;else if(f.tag===18){if(g=f.return,g===null)throw Error(lt(341));g.lanes|=n,c=g.alternate,c!==null&&(c.lanes|=n),g1(g,n,t),g=f.sibling}else g=f.child;if(g!==null)g.return=f;else for(g=f;g!==null;){if(g===t){g=null;break}if(f=g.sibling,f!==null){f.return=g.return,g=f;break}g=g.return}f=g}Ni(e,t,h.children,n),t=t.child}return t;case 9:return h=t.type,o=t.pendingProps.children,_h(t,n),h=eo(h),o=o(h),t.flags|=1,Ni(e,t,o,n),t.child;case 14:return o=t.type,h=po(o,t.pendingProps),h=po(o.type,h),qS(e,t,o,h,n);case 15:return BC(e,t,t.type,t.pendingProps,n);case 17:return o=t.type,h=t.pendingProps,h=t.elementType===o?h:po(o,h),mg(e,t),t.tag=1,hs(o)?(e=!0,Yg(t)):e=!1,_h(t,n),LC(t,o,h),_1(t,o,h,n),w1(null,t,o,!0,e,n);case 19:return VC(e,t,n);case 22:return NC(e,t,n)}throw Error(lt(156,t.tag))};function sI(e,t){return DE(e,t)}function OR(e,t,n,o){this.tag=e,this.key=n,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=o,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Js(e,t,n,o){return new OR(e,t,n,o)}function uw(e){return e=e.prototype,!(!e||!e.isReactComponent)}function FR(e){if(typeof e=="function")return uw(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Ix)return 11;if(e===Px)return 14}return 2}function $l(e,t){var n=e.alternate;return n===null?(n=Js(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function _g(e,t,n,o,h,f){var g=2;if(o=e,typeof e=="function")uw(e)&&(g=1);else if(typeof e=="string")g=5;else e:switch(e){case eh:return Ou(n.children,h,f,t);case Cx:g=8,h|=8;break;case Uv:return e=Js(12,n,t,h|2),e.elementType=Uv,e.lanes=f,e;case Vv:return e=Js(13,n,t,h),e.elementType=Vv,e.lanes=f,e;case Hv:return e=Js(19,n,t,h),e.elementType=Hv,e.lanes=f,e;case mE:return Uy(n,h,f,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case fE:g=10;break e;case pE:g=9;break e;case Ix:g=11;break e;case Px:g=14;break e;case bl:g=16,o=null;break e}throw Error(lt(130,e==null?e:typeof e,""))}return t=Js(g,n,t,h),t.elementType=e,t.type=o,t.lanes=f,t}function Ou(e,t,n,o){return e=Js(7,e,o,t),e.lanes=n,e}function Uy(e,t,n,o){return e=Js(22,e,o,t),e.elementType=mE,e.lanes=n,e.stateNode={isHidden:!1},e}function pv(e,t,n){return e=Js(6,e,null,t),e.lanes=n,e}function mv(e,t,n){return t=Js(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function BR(e,t,n,o,h){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=Y0(0),this.expirationTimes=Y0(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Y0(0),this.identifierPrefix=o,this.onRecoverableError=h,this.mutableSourceEagerHydrationData=null}function cw(e,t,n,o,h,f,g,c,T){return e=new BR(e,t,n,c,T),t===1?(t=1,f===!0&&(t|=8)):t=0,f=Js(3,null,null,t),e.current=f,f.stateNode=e,f.memoizedState={element:o,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Zx(f),e}function NR(e,t,n){var o=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(uI)}catch(e){console.error(e)}}uI(),uE.exports=Bs;var cI=uE.exports,lk=cI;$v.createRoot=lk.createRoot,$v.hydrateRoot=lk.hydrateRoot;const hI="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 us=function(){return us=Object.assign||function(t){for(var n,o=1,h=arguments.length;o0?ei(jh,--ro):0,Ah--,On===10&&(Ah=1,qy--),On}function wo(){return On=ro2||R1(On)>3?"":" "}function QR(e,t){for(;--t&&wo()&&!(On<48||On>102||On>57&&On<65||On>70&&On<97););return Xy(e,xg()+(t<6&&Fu()==32&&wo()==32))}function L1(e){for(;wo();)switch(On){case e:return ro;case 34:case 39:e!==34&&e!==39&&L1(On);break;case 40:e===41&&L1(e);break;case 92:wo();break}return ro}function e5(e,t){for(;wo()&&e+On!==57;)if(e+On===84&&Fu()===47)break;return"/*"+Xy(t,ro-1)+"*"+mw(e===47?e:wo())}function t5(e){for(;!R1(Fu());)wo();return Xy(e,ro)}function r5(e){return KR(wg("",null,null,null,[""],e=XR(e),0,[0],e))}function wg(e,t,n,o,h,f,g,c,T){for(var I=0,z=0,A=g,M=0,F=0,Y=0,U=1,J=1,O=1,$=0,Z="",ne=h,oe=f,ke=o,ge=Z;J;)switch(Y=$,$=wo()){case 40:if(Y!=108&&ei(ge,A-1)==58){vg(ge+=hr(gv($),"&","&\f"),"&\f",pI(I?c[I-1]:0))!=-1&&(O=-1);break}case 34:case 39:case 91:ge+=gv($);break;case 9:case 10:case 13:case 32:ge+=JR(Y);break;case 92:ge+=QR(xg()-1,7);continue;case 47:switch(Fu()){case 42:case 47:_f(n5(e5(wo(),xg()),t,n,T),T);break;default:ge+="/"}break;case 123*U:c[I++]=Uo(ge)*O;case 125*U:case 59:case 0:switch($){case 0:case 125:J=0;case 59+z:O==-1&&(ge=hr(ge,/\f/g,"")),F>0&&Uo(ge)-A&&_f(F>32?hk(ge+";",o,n,A-1,T):hk(hr(ge," ","")+";",o,n,A-2,T),T);break;case 59:ge+=";";default:if(_f(ke=ck(ge,t,n,I,z,h,c,Z,ne=[],oe=[],A,f),f),$===123)if(z===0)wg(ge,t,ke,ke,ne,f,A,c,oe);else switch(M===99&&ei(ge,3)===110?100:M){case 100:case 108:case 109:case 115:wg(e,ke,ke,o&&_f(ck(e,ke,ke,0,0,h,c,Z,h,ne=[],A,oe),oe),h,oe,A,c,o?ne:oe);break;default:wg(ge,ke,ke,ke,[""],oe,0,c,oe)}}I=z=F=0,U=O=1,Z=ge="",A=g;break;case 58:A=1+Uo(ge),F=Y;default:if(U<1){if($==123)--U;else if($==125&&U++==0&&YR()==125)continue}switch(ge+=mw($),$*U){case 38:O=z>0?1:(ge+="\f",-1);break;case 44:c[I++]=(Uo(ge)-1)*O,O=1;break;case 64:Fu()===45&&(ge+=gv(wo())),M=Fu(),z=A=Uo(Z=ge+=t5(xg())),$++;break;case 45:Y===45&&Uo(ge)==2&&(U=0)}}return f}function ck(e,t,n,o,h,f,g,c,T,I,z,A){for(var M=h-1,F=h===0?f:[""],Y=gI(F),U=0,J=0,O=0;U0?F[$]+" "+Z:hr(Z,/&\f/g,F[$])))&&(T[O++]=ne);return Yy(e,t,n,h===0?Zy:c,T,I,z,A)}function n5(e,t,n,o){return Yy(e,t,n,dI,mw(qR()),Mh(e,2,-2),0,o)}function hk(e,t,n,o,h){return Yy(e,t,n,pw,Mh(e,0,o),Mh(e,o+1,-1),o,h)}function _I(e,t,n){switch(GR(e,t)){case 5103:return Br+"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 Br+e+e;case 4789:return Df+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return Br+e+Df+e+on+e+e;case 5936:switch(ei(e,t+11)){case 114:return Br+e+on+hr(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return Br+e+on+hr(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return Br+e+on+hr(e,/[svh]\w+-[tblr]{2}/,"lr")+e}case 6828:case 4268:case 2903:return Br+e+on+e+e;case 6165:return Br+e+on+"flex-"+e+e;case 5187:return Br+e+hr(e,/(\w+).+(:[^]+)/,Br+"box-$1$2"+on+"flex-$1$2")+e;case 5443:return Br+e+on+"flex-item-"+hr(e,/flex-|-self/g,"")+(_a(e,/flex-|baseline/)?"":on+"grid-row-"+hr(e,/flex-|-self/g,""))+e;case 4675:return Br+e+on+"flex-line-pack"+hr(e,/align-content|flex-|-self/g,"")+e;case 5548:return Br+e+on+hr(e,"shrink","negative")+e;case 5292:return Br+e+on+hr(e,"basis","preferred-size")+e;case 6060:return Br+"box-"+hr(e,"-grow","")+Br+e+on+hr(e,"grow","positive")+e;case 4554:return Br+hr(e,/([^-])(transform)/g,"$1"+Br+"$2")+e;case 6187:return hr(hr(hr(e,/(zoom-|grab)/,Br+"$1"),/(image-set)/,Br+"$1"),e,"")+e;case 5495:case 3959:return hr(e,/(image-set\([^]*)/,Br+"$1$`$1");case 4968:return hr(hr(e,/(.+:)(flex-)?(.*)/,Br+"box-pack:$3"+on+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+Br+e+e;case 4200:if(!_a(e,/flex-|baseline/))return on+"grid-column-align"+Mh(e,t)+e;break;case 2592:case 3360:return on+hr(e,"template-","")+e;case 4384:case 3616:return n&&n.some(function(o,h){return t=h,_a(o.props,/grid-\w+-end/)})?~vg(e+(n=n[t].value),"span",0)?e:on+hr(e,"-start","")+e+on+"grid-row-span:"+(~vg(n,"span",0)?_a(n,/\d+/):+_a(n,/\d+/)-+_a(e,/\d+/))+";":on+hr(e,"-start","")+e;case 4896:case 4128:return n&&n.some(function(o){return _a(o.props,/grid-\w+-start/)})?e:on+hr(hr(e,"-end","-span"),"span ","")+e;case 4095:case 3583:case 4068:case 2532:return hr(e,/(.+)-inline(.+)/,Br+"$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(Uo(e)-1-t>6)switch(ei(e,t+1)){case 109:if(ei(e,t+4)!==45)break;case 102:return hr(e,/(.+:)(.+)-([^]+)/,"$1"+Br+"$2-$3$1"+Df+(ei(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~vg(e,"stretch",0)?_I(hr(e,"stretch","fill-available"),t,n)+e:e}break;case 5152:case 5920:return hr(e,/(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/,function(o,h,f,g,c,T,I){return on+h+":"+f+I+(g?on+h+"-span:"+(c?T:+T-+f)+I:"")+e});case 4949:if(ei(e,t+6)===121)return hr(e,":",":"+Br)+e;break;case 6444:switch(ei(e,ei(e,14)===45?18:11)){case 120:return hr(e,/(.+:)([^;\s!]+)(;|(\s+)?!.+)?/,"$1"+Br+(ei(e,14)===45?"inline-":"")+"box$3$1"+Br+"$2$3$1"+on+"$2box$3")+e;case 100:return hr(e,":",":"+on)+e}break;case 5719:case 2647:case 2135:case 3927:case 2391:return hr(e,"scroll-","scroll-snap-")+e}return e}function cy(e,t){for(var n="",o=0;o-1&&!e.return)switch(e.type){case pw:e.return=_I(e.value,e.length,n);return;case fI:return cy([vl(e,{value:hr(e.value,"@","@"+Br)})],o);case Zy:if(e.length)return ZR(n=e.props,function(h){switch(_a(h,o=/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":Yc(vl(e,{props:[hr(h,/:(read-\w+)/,":"+Df+"$1")]})),Yc(vl(e,{props:[h]})),z1(e,{props:uk(n,o)});break;case"::placeholder":Yc(vl(e,{props:[hr(h,/:(plac\w+)/,":"+Br+"input-$1")]})),Yc(vl(e,{props:[hr(h,/:(plac\w+)/,":"+Df+"$1")]})),Yc(vl(e,{props:[hr(h,/:(plac\w+)/,on+"input-$1")]})),Yc(vl(e,{props:[h]})),z1(e,{props:uk(n,o)});break}return""})}}var l5={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},Ps={},Dh=typeof process<"u"&&Ps!==void 0&&(Ps.REACT_APP_SC_ATTR||Ps.SC_ATTR)||"data-styled",vI="active",xI="data-styled-version",Ky="6.1.13",gw=`/*!sc*/ +`,hy=typeof window<"u"&&"HTMLElement"in window,u5=!!(typeof SC_DISABLE_SPEEDY=="boolean"?SC_DISABLE_SPEEDY:typeof process<"u"&&Ps!==void 0&&Ps.REACT_APP_SC_DISABLE_SPEEDY!==void 0&&Ps.REACT_APP_SC_DISABLE_SPEEDY!==""?Ps.REACT_APP_SC_DISABLE_SPEEDY!=="false"&&Ps.REACT_APP_SC_DISABLE_SPEEDY:typeof process<"u"&&Ps!==void 0&&Ps.SC_DISABLE_SPEEDY!==void 0&&Ps.SC_DISABLE_SPEEDY!==""&&Ps.SC_DISABLE_SPEEDY!=="false"&&Ps.SC_DISABLE_SPEEDY),Jy=Object.freeze([]),zh=Object.freeze({});function c5(e,t,n){return n===void 0&&(n=zh),e.theme!==n.theme&&e.theme||t||n.theme}var wI=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"]),h5=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,d5=/(^-|-$)/g;function dk(e){return e.replace(h5,"-").replace(d5,"")}var f5=/(a)(d)/gi,Ym=52,fk=function(e){return String.fromCharCode(e+(e>25?39:97))};function O1(e){var t,n="";for(t=Math.abs(e);t>Ym;t=t/Ym|0)n=fk(t%Ym)+n;return(fk(t%Ym)+n).replace(f5,"$1-$2")}var yv,bI=5381,hh=function(e,t){for(var n=t.length;n;)e=33*e^t.charCodeAt(--n);return e},SI=function(e){return hh(bI,e)};function p5(e){return O1(SI(e)>>>0)}function m5(e){return e.displayName||e.name||"Component"}function _v(e){return typeof e=="string"&&!0}var kI=typeof Symbol=="function"&&Symbol.for,TI=kI?Symbol.for("react.memo"):60115,g5=kI?Symbol.for("react.forward_ref"):60112,y5={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},_5={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},EI={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},v5=((yv={})[g5]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},yv[TI]=EI,yv);function pk(e){return("type"in(t=e)&&t.type.$$typeof)===TI?EI:"$$typeof"in e?v5[e.$$typeof]:y5;var t}var x5=Object.defineProperty,w5=Object.getOwnPropertyNames,mk=Object.getOwnPropertySymbols,b5=Object.getOwnPropertyDescriptor,S5=Object.getPrototypeOf,gk=Object.prototype;function CI(e,t,n){if(typeof t!="string"){if(gk){var o=S5(t);o&&o!==gk&&CI(e,o,n)}var h=w5(t);mk&&(h=h.concat(mk(t)));for(var f=pk(e),g=pk(t),c=0;c0?" Args: ".concat(t.join(", ")):""))}var k5=function(){function e(t){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=t}return e.prototype.indexOfGroup=function(t){for(var n=0,o=0;o=this.groupSizes.length){for(var o=this.groupSizes,h=o.length,f=h;t>=f;)if((f<<=1)<0)throw _p(16,"".concat(t));this.groupSizes=new Uint32Array(f),this.groupSizes.set(o),this.length=f;for(var g=h;g=this.length||this.groupSizes[t]===0)return n;for(var o=this.groupSizes[t],h=this.indexOfGroup(t),f=h+o,g=h;g=0){var o=document.createTextNode(n);return this.element.insertBefore(o,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&&(J+="".concat(O,","))}),T+="".concat(Y).concat(U,'{content:"').concat(J,'"}').concat(gw)},z=0;z0?".".concat(t):M},z=T.slice();z.push(function(M){M.type===Zy&&M.value.includes("&")&&(M.props[0]=M.props[0].replace(L5,n).replace(o,I))}),g.prefix&&z.push(a5),z.push(i5);var A=function(M,F,Y,U){F===void 0&&(F=""),Y===void 0&&(Y=""),U===void 0&&(U="&"),t=U,n=F,o=new RegExp("\\".concat(n,"\\b"),"g");var J=M.replace(O5,""),O=r5(Y||F?"".concat(Y," ").concat(F," { ").concat(J," }"):J);g.namespace&&(O=MI(O,g.namespace));var $=[];return cy(O,s5(z.concat(o5(function(Z){return $.push(Z)})))),$};return A.hash=T.length?T.reduce(function(M,F){return F.name||_p(15),hh(M,F.name)},bI).toString():"",A}var B5=new PI,B1=F5(),AI=Uu.createContext({shouldForwardProp:void 0,styleSheet:B5,stylis:B1});AI.Consumer;Uu.createContext(void 0);function xk(){return Ht.useContext(AI)}var N5=function(){function e(t,n){var o=this;this.inject=function(h,f){f===void 0&&(f=B1);var g=o.name+f.hash;h.hasNameForId(o.id,g)||h.insertRules(o.id,g,f(o.rules,g,"@keyframes"))},this.name=t,this.id="sc-keyframes-".concat(t),this.rules=n,_w(this,function(){throw _p(12,String(o.name))})}return e.prototype.getName=function(t){return t===void 0&&(t=B1),this.name+t.hash},e}(),$5=function(e){return e>="A"&&e<="Z"};function wk(e){for(var t="",n=0;n>>0);if(!n.hasNameForId(this.componentId,g)){var c=o(f,".".concat(g),void 0,this.componentId);n.insertRules(this.componentId,g,c)}h=Au(h,g),this.staticRulesId=g}else{for(var T=hh(this.baseHash,o.hash),I="",z=0;z>>0);n.hasNameForId(this.componentId,F)||n.insertRules(this.componentId,F,o(I,".".concat(F),void 0,this.componentId)),h=Au(h,F)}}return h},e}(),RI=Uu.createContext(void 0);RI.Consumer;var vv={};function H5(e,t,n){var o=yw(e),h=e,f=!_v(e),g=t.attrs,c=g===void 0?Jy:g,T=t.componentId,I=T===void 0?function(ne,oe){var ke=typeof ne!="string"?"sc":dk(ne);vv[ke]=(vv[ke]||0)+1;var ge="".concat(ke,"-").concat(p5(Ky+ke+vv[ke]));return oe?"".concat(oe,"-").concat(ge):ge}(t.displayName,t.parentComponentId):T,z=t.displayName,A=z===void 0?function(ne){return _v(ne)?"styled.".concat(ne):"Styled(".concat(m5(ne),")")}(e):z,M=t.displayName&&t.componentId?"".concat(dk(t.displayName),"-").concat(t.componentId):t.componentId||I,F=o&&h.attrs?h.attrs.concat(c).filter(Boolean):c,Y=t.shouldForwardProp;if(o&&h.shouldForwardProp){var U=h.shouldForwardProp;if(t.shouldForwardProp){var J=t.shouldForwardProp;Y=function(ne,oe){return U(ne,oe)&&J(ne,oe)}}else Y=U}var O=new V5(n,M,o?h.componentStyle:void 0);function $(ne,oe){return function(ke,ge,Fe){var Oe=ke.attrs,Ge=ke.componentStyle,it=ke.defaultProps,ve=ke.foldedComponentIds,je=ke.styledComponentId,H=ke.target,Re=Uu.useContext(RI),vt=xk(),ye=ke.shouldForwardProp||vt.shouldForwardProp,Be=c5(ge,Re,it)||zh,Le=function(rt,Jt,er){for(var Vt,Yt=us(us({},Jt),{className:void 0,theme:er}),_r=0;_r 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?"":W5}),Z5=vp.div(Ek||(Ek=xp([` + 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"),q5=vp.div(Ck||(Ck=xp([` + 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"}),Y5=vp.span(Ik||(Ik=xp([` + font-size: 14px; + color: `,`; + span { + text-decoration: underline; + } +`],[` + font-size: 14px; + color: `,`; + span { + text-decoration: underline; + } +`])),"#666"),Pk=function(e){return e/1024/1024},X5=function(e){return e===void 0?"":e.map(function(t){return".".concat(t.toLowerCase())}).join(",")};function K5(e){var t=e.types,n=e.minSize,o=e.maxSize;if(t){var h=t.toString(),f="";return o&&(f+="size >= ".concat(o,", ")),n&&(f+="size <= ".concat(n,", ")),We.jsx("span",Nu({title:"".concat(f,"types: ").concat(h),className:"file-types"},{children:h}),void 0)}return null}function J5(){return We.jsxs("svg",Nu({width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[We.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),We.jsx("path",{d:"M10.6665 14.6667L6.6665 20H21.3332L15.9998 12L11.9998 17.3333L10.6665 14.6667Z",fill:"#0658C2"},void 0),We.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 xv=0,Q5=function(e,t,n,o,h,f){return n?We.jsx("span",{children:"File type/size error, Hovered on types!"},void 0):We.jsx(Y5,{children:o?We.jsx("span",{children:"Upload disabled"},void 0):We.jsx(We.Fragment,e||t?{children:f?We.jsx(We.Fragment,{children:We.jsx("span",{children:f},void 0)},void 0):We.jsxs(We.Fragment,{children:[We.jsx("span",{children:"Uploaded Successfully!"},void 0)," Upload another?"]},void 0)}:{children:We.jsxs(We.Fragment,h?{children:[We.jsx("span",{children:h.split(" ")[0]},void 0)," ",h.substr(h.indexOf(" ")+1)]}:{children:[We.jsx("span",{children:"Upload"},void 0)," or drop a file right here"]},void 0)},void 0)},void 0)},eL=function(e){var t=e.name,n=e.hoverTitle,o=e.types,h=e.handleChange,f=e.classes,g=e.children,c=e.maxSize,T=e.minSize,I=e.fileOrFiles,z=e.onSizeError,A=e.onTypeError,M=e.onSelect,F=e.onDrop,Y=e.disabled,U=e.label,J=e.uploadedLabel,O=e.multiple,$=e.required,Z=e.onDraggingStateChange,ne=e.dropMessageStyle,oe=e.ariaLabel,ke=e.ariaDescribedby,ge=Ht.useRef(null),Fe=Ht.useRef(null),Oe=Ht.useState(!1),Ge=Oe[0],it=Oe[1],ve=Ht.useState(null),je=ve[0],H=ve[1],Re=Ht.useState(!1),vt=Re[0],ye=Re[1],Be=function(xe){return o&&!function(Ee,mt){var nt=Ee.name.split(".").pop();return mt.map(function(rt){return rt.toLowerCase()}).includes(nt.toLowerCase())}(xe,o)?(ye(!0),A&&A("File type is not supported"),!1):c&&Pk(xe.size)>c?(ye(!0),z&&z("File size is too big"),!1):!(T&&Pk(xe.size)0||Yt(!1)},[]),Xr=Ht.useCallback(function(Ue){Ue.preventDefault(),Ue.stopPropagation()},[]),V=Ht.useCallback(function(Ue){Ue.preventDefault(),Ue.stopPropagation(),Yt(!1),xv=0;var ie=Ue.dataTransfer.files;if(ie&&ie.length>0){var de=nt?ie:ie[0],se=rt(de);Jt&&se&&Jt(de)}},[rt]);return Ht.useEffect(function(){var Ue=Ee.current;return Ue.addEventListener("click",_r),Ue.addEventListener("dragenter",fr),Ue.addEventListener("dragleave",br),Ue.addEventListener("dragover",Xr),Ue.addEventListener("drop",V),function(){Ue.removeEventListener("click",_r),Ue.removeEventListener("dragenter",fr),Ue.removeEventListener("dragleave",br),Ue.removeEventListener("dragover",Xr),Ue.removeEventListener("drop",V)}},[_r,fr,br,Xr,V,Ee]),Vt}({labelRef:ge,inputRef:Fe,multiple:O,handleChanges:Le,onDrop:F});return Ht.useEffect(function(){Z==null||Z(Ke)},[Ke]),Ht.useEffect(function(){I?(it(!0),H(I)):(Fe.current&&(Fe.current.value=""),it(!1),H(null))},[I]),We.jsxs(G5,Nu({overRide:g,className:"".concat(f||""," ").concat(Y?"is-disabled":""),ref:ge,htmlFor:t,onClick:function(xe){xe.preventDefault(),xe.stopPropagation()},"aria-describedby":ke,role:"button","aria-label":oe},{children:[We.jsx("input",{onClick:function(xe){xe.stopPropagation(),Fe&&Fe.current&&(Fe.current.value="",Fe.current.click())},onChange:function(xe){var Ee=xe.target.files,mt=O?Ee:Ee[0],nt=Le(mt);M&&nt&&M(mt)},accept:X5(o),ref:Fe,type:"file",id:t,name:t,disabled:Y,multiple:O,required:$},void 0),Ke&&We.jsx(Z5,Nu({style:ne},{children:We.jsx("span",{children:n||"Drop Here"},void 0)}),void 0),!g&&We.jsxs(We.Fragment,{children:[We.jsx(J5,{},void 0),We.jsxs(q5,Nu({error:vt},{children:[Q5(je,Ge,vt,Y,U,J),We.jsx(K5,{types:o,minSize:T,maxSize:c},void 0)]}),void 0)]},void 0),g]}),void 0)};function Km(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 FI={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(n){e.exports=n()})(function(){return function n(o,h,f){function g(I,z){if(!h[I]){if(!o[I]){var A=typeof Km=="function"&&Km;if(!z&&A)return A(I,!0);if(c)return c(I,!0);var M=new Error("Cannot find module '"+I+"'");throw M.code="MODULE_NOT_FOUND",M}var F=h[I]={exports:{}};o[I][0].call(F.exports,function(Y){var U=o[I][1][Y];return g(U||Y)},F,F.exports,n,o,h,f)}return h[I].exports}for(var c=typeof Km=="function"&&Km,T=0;T>2,F=(3&I)<<4|z>>4,Y=1>6:64,U=2>4,z=(15&M)<<4|(F=c.indexOf(T.charAt(U++)))>>2,A=(3&F)<<6|(Y=c.indexOf(T.charAt(U++))),$[J++]=I,F!==64&&($[J++]=z),Y!==64&&($[J++]=A);return $}},{"./support":30,"./utils":32}],2:[function(n,o,h){var f=n("./external"),g=n("./stream/DataWorker"),c=n("./stream/Crc32Probe"),T=n("./stream/DataLengthProbe");function I(z,A,M,F,Y){this.compressedSize=z,this.uncompressedSize=A,this.crc32=M,this.compression=F,this.compressedContent=Y}I.prototype={getContentWorker:function(){var z=new g(f.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new T("data_length")),A=this;return z.on("end",function(){if(this.streamInfo.data_length!==A.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),z},getCompressedWorker:function(){return new g(f.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},I.createWorkerFrom=function(z,A,M){return z.pipe(new c).pipe(new T("uncompressedSize")).pipe(A.compressWorker(M)).pipe(new T("compressedSize")).withStreamInfo("compression",A)},o.exports=I},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(n,o,h){var f=n("./stream/GenericWorker");h.STORE={magic:"\0\0",compressWorker:function(){return new f("STORE compression")},uncompressWorker:function(){return new f("STORE decompression")}},h.DEFLATE=n("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(n,o,h){var f=n("./utils"),g=function(){for(var c,T=[],I=0;I<256;I++){c=I;for(var z=0;z<8;z++)c=1&c?3988292384^c>>>1:c>>>1;T[I]=c}return T}();o.exports=function(c,T){return c!==void 0&&c.length?f.getTypeOf(c)!=="string"?function(I,z,A,M){var F=g,Y=M+A;I^=-1;for(var U=M;U>>8^F[255&(I^z[U])];return-1^I}(0|T,c,c.length,0):function(I,z,A,M){var F=g,Y=M+A;I^=-1;for(var U=M;U>>8^F[255&(I^z.charCodeAt(U))];return-1^I}(0|T,c,c.length,0):0}},{"./utils":32}],5:[function(n,o,h){h.base64=!1,h.binary=!1,h.dir=!1,h.createFolders=!0,h.date=null,h.compression=null,h.compressionOptions=null,h.comment=null,h.unixPermissions=null,h.dosPermissions=null},{}],6:[function(n,o,h){var f=null;f=typeof Promise<"u"?Promise:n("lie"),o.exports={Promise:f}},{lie:37}],7:[function(n,o,h){var f=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",g=n("pako"),c=n("./utils"),T=n("./stream/GenericWorker"),I=f?"uint8array":"array";function z(A,M){T.call(this,"FlateWorker/"+A),this._pako=null,this._pakoAction=A,this._pakoOptions=M,this.meta={}}h.magic="\b\0",c.inherits(z,T),z.prototype.processChunk=function(A){this.meta=A.meta,this._pako===null&&this._createPako(),this._pako.push(c.transformTo(I,A.data),!1)},z.prototype.flush=function(){T.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},z.prototype.cleanUp=function(){T.prototype.cleanUp.call(this),this._pako=null},z.prototype._createPako=function(){this._pako=new g[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var A=this;this._pako.onData=function(M){A.push({data:M,meta:A.meta})}},h.compressWorker=function(A){return new z("Deflate",A)},h.uncompressWorker=function(){return new z("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,o,h){function f(F,Y){var U,J="";for(U=0;U>>=8;return J}function g(F,Y,U,J,O,$){var Z,ne,oe=F.file,ke=F.compression,ge=$!==I.utf8encode,Fe=c.transformTo("string",$(oe.name)),Oe=c.transformTo("string",I.utf8encode(oe.name)),Ge=oe.comment,it=c.transformTo("string",$(Ge)),ve=c.transformTo("string",I.utf8encode(Ge)),je=Oe.length!==oe.name.length,H=ve.length!==Ge.length,Re="",vt="",ye="",Be=oe.dir,Le=oe.date,Ke={crc32:0,compressedSize:0,uncompressedSize:0};Y&&!U||(Ke.crc32=F.crc32,Ke.compressedSize=F.compressedSize,Ke.uncompressedSize=F.uncompressedSize);var xe=0;Y&&(xe|=8),ge||!je&&!H||(xe|=2048);var Ee=0,mt=0;Be&&(Ee|=16),O==="UNIX"?(mt=798,Ee|=function(rt,Jt){var er=rt;return rt||(er=Jt?16893:33204),(65535&er)<<16}(oe.unixPermissions,Be)):(mt=20,Ee|=function(rt){return 63&(rt||0)}(oe.dosPermissions)),Z=Le.getUTCHours(),Z<<=6,Z|=Le.getUTCMinutes(),Z<<=5,Z|=Le.getUTCSeconds()/2,ne=Le.getUTCFullYear()-1980,ne<<=4,ne|=Le.getUTCMonth()+1,ne<<=5,ne|=Le.getUTCDate(),je&&(vt=f(1,1)+f(z(Fe),4)+Oe,Re+="up"+f(vt.length,2)+vt),H&&(ye=f(1,1)+f(z(it),4)+ve,Re+="uc"+f(ye.length,2)+ye);var nt="";return nt+=` +\0`,nt+=f(xe,2),nt+=ke.magic,nt+=f(Z,2),nt+=f(ne,2),nt+=f(Ke.crc32,4),nt+=f(Ke.compressedSize,4),nt+=f(Ke.uncompressedSize,4),nt+=f(Fe.length,2),nt+=f(Re.length,2),{fileRecord:A.LOCAL_FILE_HEADER+nt+Fe+Re,dirRecord:A.CENTRAL_FILE_HEADER+f(mt,2)+nt+f(it.length,2)+"\0\0\0\0"+f(Ee,4)+f(J,4)+Fe+Re+it}}var c=n("../utils"),T=n("../stream/GenericWorker"),I=n("../utf8"),z=n("../crc32"),A=n("../signature");function M(F,Y,U,J){T.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=Y,this.zipPlatform=U,this.encodeFileName=J,this.streamFiles=F,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}c.inherits(M,T),M.prototype.push=function(F){var Y=F.meta.percent||0,U=this.entriesCount,J=this._sources.length;this.accumulate?this.contentBuffer.push(F):(this.bytesWritten+=F.data.length,T.prototype.push.call(this,{data:F.data,meta:{currentFile:this.currentFile,percent:U?(Y+100*(U-J-1))/U:100}}))},M.prototype.openedSource=function(F){this.currentSourceOffset=this.bytesWritten,this.currentFile=F.file.name;var Y=this.streamFiles&&!F.file.dir;if(Y){var U=g(F,Y,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:U.fileRecord,meta:{percent:0}})}else this.accumulate=!0},M.prototype.closedSource=function(F){this.accumulate=!1;var Y=this.streamFiles&&!F.file.dir,U=g(F,Y,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(U.dirRecord),Y)this.push({data:function(J){return A.DATA_DESCRIPTOR+f(J.crc32,4)+f(J.compressedSize,4)+f(J.uncompressedSize,4)}(F),meta:{percent:100}});else for(this.push({data:U.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},M.prototype.flush=function(){for(var F=this.bytesWritten,Y=0;Y=this.index;T--)I=(I<<8)+this.byteAt(T);return this.index+=c,I},readString:function(c){return f.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))}},o.exports=g},{"../utils":32}],19:[function(n,o,h){var f=n("./Uint8ArrayReader");function g(c){f.call(this,c)}n("../utils").inherits(g,f),g.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},o.exports=g},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,o,h){var f=n("./DataReader");function g(c){f.call(this,c)}n("../utils").inherits(g,f),g.prototype.byteAt=function(c){return this.data.charCodeAt(this.zero+c)},g.prototype.lastIndexOfSignature=function(c){return this.data.lastIndexOf(c)-this.zero},g.prototype.readAndCheckSignature=function(c){return c===this.readData(4)},g.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},o.exports=g},{"../utils":32,"./DataReader":18}],21:[function(n,o,h){var f=n("./ArrayReader");function g(c){f.call(this,c)}n("../utils").inherits(g,f),g.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},o.exports=g},{"../utils":32,"./ArrayReader":17}],22:[function(n,o,h){var f=n("../utils"),g=n("../support"),c=n("./ArrayReader"),T=n("./StringReader"),I=n("./NodeBufferReader"),z=n("./Uint8ArrayReader");o.exports=function(A){var M=f.getTypeOf(A);return f.checkSupport(M),M!=="string"||g.uint8array?M==="nodebuffer"?new I(A):g.uint8array?new z(f.transformTo("uint8array",A)):new c(f.transformTo("array",A)):new T(A)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(n,o,h){h.LOCAL_FILE_HEADER="PK",h.CENTRAL_FILE_HEADER="PK",h.CENTRAL_DIRECTORY_END="PK",h.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",h.ZIP64_CENTRAL_DIRECTORY_END="PK",h.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(n,o,h){var f=n("./GenericWorker"),g=n("../utils");function c(T){f.call(this,"ConvertWorker to "+T),this.destType=T}g.inherits(c,f),c.prototype.processChunk=function(T){this.push({data:g.transformTo(this.destType,T.data),meta:T.meta})},o.exports=c},{"../utils":32,"./GenericWorker":28}],25:[function(n,o,h){var f=n("./GenericWorker"),g=n("../crc32");function c(){f.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(c,f),c.prototype.processChunk=function(T){this.streamInfo.crc32=g(T.data,this.streamInfo.crc32||0),this.push(T)},o.exports=c},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,o,h){var f=n("../utils"),g=n("./GenericWorker");function c(T){g.call(this,"DataLengthProbe for "+T),this.propName=T,this.withStreamInfo(T,0)}f.inherits(c,g),c.prototype.processChunk=function(T){if(T){var I=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=I+T.data.length}g.prototype.processChunk.call(this,T)},o.exports=c},{"../utils":32,"./GenericWorker":28}],27:[function(n,o,h){var f=n("../utils"),g=n("./GenericWorker");function c(T){g.call(this,"DataWorker");var I=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,T.then(function(z){I.dataIsReady=!0,I.data=z,I.max=z&&z.length||0,I.type=f.getTypeOf(z),I.isPaused||I._tickAndRepeat()},function(z){I.error(z)})}f.inherits(c,g),c.prototype.cleanUp=function(){g.prototype.cleanUp.call(this),this.data=null},c.prototype.resume=function(){return!!g.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,f.delay(this._tickAndRepeat,[],this)),!0)},c.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(f.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},c.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var T=null,I=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,I);break;case"uint8array":T=this.data.subarray(this.index,I);break;case"array":case"nodebuffer":T=this.data.slice(this.index,I)}return this.index=I,this.push({data:T,meta:{percent:this.max?this.index/this.max*100:0}})},o.exports=c},{"../utils":32,"./GenericWorker":28}],28:[function(n,o,h){function f(g){this.name=g||"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}f.prototype={push:function(g){this.emit("data",g)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(g){this.emit("error",g)}return!0},error:function(g){return!this.isFinished&&(this.isPaused?this.generatedError=g:(this.isFinished=!0,this.emit("error",g),this.previous&&this.previous.error(g),this.cleanUp()),!0)},on:function(g,c){return this._listeners[g].push(c),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(g,c){if(this._listeners[g])for(var T=0;T "+g:g}},o.exports=f},{}],29:[function(n,o,h){var f=n("../utils"),g=n("./ConvertWorker"),c=n("./GenericWorker"),T=n("../base64"),I=n("../support"),z=n("../external"),A=null;if(I.nodestream)try{A=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function M(Y,U){return new z.Promise(function(J,O){var $=[],Z=Y._internalType,ne=Y._outputType,oe=Y._mimeType;Y.on("data",function(ke,ge){$.push(ke),U&&U(ge)}).on("error",function(ke){$=[],O(ke)}).on("end",function(){try{var ke=function(ge,Fe,Oe){switch(ge){case"blob":return f.newBlob(f.transformTo("arraybuffer",Fe),Oe);case"base64":return T.encode(Fe);default:return f.transformTo(ge,Fe)}}(ne,function(ge,Fe){var Oe,Ge=0,it=null,ve=0;for(Oe=0;Oe"u")h.blob=!1;else{var f=new ArrayBuffer(0);try{h.blob=new Blob([f],{type:"application/zip"}).size===0}catch{try{var g=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);g.append(f),h.blob=g.getBlob("application/zip").size===0}catch{h.blob=!1}}}try{h.nodestream=!!n("readable-stream").Readable}catch{h.nodestream=!1}},{"readable-stream":16}],31:[function(n,o,h){for(var f=n("./utils"),g=n("./support"),c=n("./nodejsUtils"),T=n("./stream/GenericWorker"),I=new Array(256),z=0;z<256;z++)I[z]=252<=z?6:248<=z?5:240<=z?4:224<=z?3:192<=z?2:1;I[254]=I[254]=1;function A(){T.call(this,"utf-8 decode"),this.leftOver=null}function M(){T.call(this,"utf-8 encode")}h.utf8encode=function(F){return g.nodebuffer?c.newBufferFrom(F,"utf-8"):function(Y){var U,J,O,$,Z,ne=Y.length,oe=0;for($=0;$>>6:(J<65536?U[Z++]=224|J>>>12:(U[Z++]=240|J>>>18,U[Z++]=128|J>>>12&63),U[Z++]=128|J>>>6&63),U[Z++]=128|63&J);return U}(F)},h.utf8decode=function(F){return g.nodebuffer?f.transformTo("nodebuffer",F).toString("utf-8"):function(Y){var U,J,O,$,Z=Y.length,ne=new Array(2*Z);for(U=J=0;U>10&1023,ne[J++]=56320|1023&O)}return ne.length!==J&&(ne.subarray?ne=ne.subarray(0,J):ne.length=J),f.applyFromCharCode(ne)}(F=f.transformTo(g.uint8array?"uint8array":"array",F))},f.inherits(A,T),A.prototype.processChunk=function(F){var Y=f.transformTo(g.uint8array?"uint8array":"array",F.data);if(this.leftOver&&this.leftOver.length){if(g.uint8array){var U=Y;(Y=new Uint8Array(U.length+this.leftOver.length)).set(this.leftOver,0),Y.set(U,this.leftOver.length)}else Y=this.leftOver.concat(Y);this.leftOver=null}var J=function($,Z){var ne;for((Z=Z||$.length)>$.length&&(Z=$.length),ne=Z-1;0<=ne&&(192&$[ne])==128;)ne--;return ne<0||ne===0?Z:ne+I[$[ne]]>Z?ne:Z}(Y),O=Y;J!==Y.length&&(g.uint8array?(O=Y.subarray(0,J),this.leftOver=Y.subarray(J,Y.length)):(O=Y.slice(0,J),this.leftOver=Y.slice(J,Y.length))),this.push({data:h.utf8decode(O),meta:F.meta})},A.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:h.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},h.Utf8DecodeWorker=A,f.inherits(M,T),M.prototype.processChunk=function(F){this.push({data:h.utf8encode(F.data),meta:F.meta})},h.Utf8EncodeWorker=M},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,o,h){var f=n("./support"),g=n("./base64"),c=n("./nodejsUtils"),T=n("./external");function I(U){return U}function z(U,J){for(var O=0;O>8;this.dir=!!(16&this.externalFileAttributes),F==0&&(this.dosPermissions=63&this.externalFileAttributes),F==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var F=f(this.extraFields[1].value);this.uncompressedSize===g.MAX_VALUE_32BITS&&(this.uncompressedSize=F.readInt(8)),this.compressedSize===g.MAX_VALUE_32BITS&&(this.compressedSize=F.readInt(8)),this.localHeaderOffset===g.MAX_VALUE_32BITS&&(this.localHeaderOffset=F.readInt(8)),this.diskNumberStart===g.MAX_VALUE_32BITS&&(this.diskNumberStart=F.readInt(4))}},readExtraFields:function(F){var Y,U,J,O=F.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});F.index+4>>6:(F<65536?M[J++]=224|F>>>12:(M[J++]=240|F>>>18,M[J++]=128|F>>>12&63),M[J++]=128|F>>>6&63),M[J++]=128|63&F);return M},h.buf2binstring=function(A){return z(A,A.length)},h.binstring2buf=function(A){for(var M=new f.Buf8(A.length),F=0,Y=M.length;F>10&1023,$[Y++]=56320|1023&U)}return z($,Y)},h.utf8border=function(A,M){var F;for((M=M||A.length)>A.length&&(M=A.length),F=M-1;0<=F&&(192&A[F])==128;)F--;return F<0||F===0?M:F+T[A[F]]>M?F:M}},{"./common":41}],43:[function(n,o,h){o.exports=function(f,g,c,T){for(var I=65535&f|0,z=f>>>16&65535|0,A=0;c!==0;){for(c-=A=2e3>>1:g>>>1;c[T]=g}return c}();o.exports=function(g,c,T,I){var z=f,A=I+T;g^=-1;for(var M=I;M>>8^z[255&(g^c[M])];return-1^g}},{}],46:[function(n,o,h){var f,g=n("../utils/common"),c=n("./trees"),T=n("./adler32"),I=n("./crc32"),z=n("./messages"),A=0,M=4,F=0,Y=-2,U=-1,J=4,O=2,$=8,Z=9,ne=286,oe=30,ke=19,ge=2*ne+1,Fe=15,Oe=3,Ge=258,it=Ge+Oe+1,ve=42,je=113,H=1,Re=2,vt=3,ye=4;function Be(V,Ue){return V.msg=z[Ue],Ue}function Le(V){return(V<<1)-(4V.avail_out&&(ie=V.avail_out),ie!==0&&(g.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 Ee(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 mt(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,se=V.max_chain_length,Te=V.strstart,Ze=V.prev_length,tt=V.nice_match,Ne=V.strstart>V.w_size-it?V.strstart-(V.w_size-it):0,ot=V.window,kt=V.w_mask,at=V.prev,Bt=V.strstart+Ge,Tr=ot[Te+Ze-1],qe=ot[Te+Ze];V.prev_length>=V.good_match&&(se>>=2),tt>V.lookahead&&(tt=V.lookahead);do if(ot[(ie=Ue)+Ze]===qe&&ot[ie+Ze-1]===Tr&&ot[ie]===ot[Te]&&ot[++ie]===ot[Te+1]){Te+=2,ie++;do;while(ot[++Te]===ot[++ie]&&ot[++Te]===ot[++ie]&&ot[++Te]===ot[++ie]&&ot[++Te]===ot[++ie]&&ot[++Te]===ot[++ie]&&ot[++Te]===ot[++ie]&&ot[++Te]===ot[++ie]&&ot[++Te]===ot[++ie]&&TeNe&&--se!=0);return Ze<=V.lookahead?Ze:V.lookahead}function Jt(V){var Ue,ie,de,se,Te,Ze,tt,Ne,ot,kt,at=V.w_size;do{if(se=V.window_size-V.lookahead-V.strstart,V.strstart>=at+(at-it)){for(g.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;);se+=at}if(V.strm.avail_in===0)break;if(Ze=V.strm,tt=V.window,Ne=V.strstart+V.lookahead,ot=se,kt=void 0,kt=Ze.avail_in,ot=Oe)for(Te=V.strstart-V.insert,V.ins_h=V.window[Te],V.ins_h=(V.ins_h<=Oe&&(V.ins_h=(V.ins_h<=Oe)if(de=c._tr_tally(V,V.strstart-V.match_start,V.match_length-Oe),V.lookahead-=V.match_length,V.match_length<=V.max_lazy_match&&V.lookahead>=Oe){for(V.match_length--;V.strstart++,V.ins_h=(V.ins_h<=Oe&&(V.ins_h=(V.ins_h<=Oe&&V.match_length<=V.prev_length){for(se=V.strstart+V.lookahead-Oe,de=c._tr_tally(V,V.strstart-1-V.prev_match,V.prev_length-Oe),V.lookahead-=V.prev_length-1,V.prev_length-=2;++V.strstart<=se&&(V.ins_h=(V.ins_h<V.pending_buf_size-5&&(ie=V.pending_buf_size-5);;){if(V.lookahead<=1){if(Jt(V),V.lookahead===0&&Ue===A)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,Ee(V,!1),V.strm.avail_out===0)||V.strstart-V.block_start>=V.w_size-it&&(Ee(V,!1),V.strm.avail_out===0))return H}return V.insert=0,Ue===M?(Ee(V,!0),V.strm.avail_out===0?vt:ye):(V.strstart>V.block_start&&(Ee(V,!1),V.strm.avail_out),H)}),new Yt(4,4,8,4,er),new Yt(4,5,16,8,er),new Yt(4,6,32,32,er),new Yt(4,4,16,16,Vt),new Yt(8,16,32,32,Vt),new Yt(8,16,128,128,Vt),new Yt(8,32,128,256,Vt),new Yt(32,128,258,1024,Vt),new Yt(32,258,258,4096,Vt)],h.deflateInit=function(V,Ue){return Xr(V,Ue,$,15,8,0)},h.deflateInit2=Xr,h.deflateReset=br,h.deflateResetKeep=fr,h.deflateSetHeader=function(V,Ue){return V&&V.state?V.state.wrap!==2?Y:(V.state.gzhead=Ue,F):Y},h.deflate=function(V,Ue){var ie,de,se,Te;if(!V||!V.state||5>8&255),mt(de,de.gzhead.time>>16&255),mt(de,de.gzhead.time>>24&255),mt(de,de.level===9?2:2<=de.strategy||de.level<2?4:0),mt(de,255&de.gzhead.os),de.gzhead.extra&&de.gzhead.extra.length&&(mt(de,255&de.gzhead.extra.length),mt(de,de.gzhead.extra.length>>8&255)),de.gzhead.hcrc&&(V.adler=I(V.adler,de.pending_buf,de.pending,0)),de.gzindex=0,de.status=69):(mt(de,0),mt(de,0),mt(de,0),mt(de,0),mt(de,0),mt(de,de.level===9?2:2<=de.strategy||de.level<2?4:0),mt(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(se=de.pending;de.gzindex<(65535&de.gzhead.extra.length)&&(de.pending!==de.pending_buf_size||(de.gzhead.hcrc&&de.pending>se&&(V.adler=I(V.adler,de.pending_buf,de.pending-se,se)),xe(V),se=de.pending,de.pending!==de.pending_buf_size));)mt(de,255&de.gzhead.extra[de.gzindex]),de.gzindex++;de.gzhead.hcrc&&de.pending>se&&(V.adler=I(V.adler,de.pending_buf,de.pending-se,se)),de.gzindex===de.gzhead.extra.length&&(de.gzindex=0,de.status=73)}else de.status=73;if(de.status===73)if(de.gzhead.name){se=de.pending;do{if(de.pending===de.pending_buf_size&&(de.gzhead.hcrc&&de.pending>se&&(V.adler=I(V.adler,de.pending_buf,de.pending-se,se)),xe(V),se=de.pending,de.pending===de.pending_buf_size)){Te=1;break}Te=de.gzindexse&&(V.adler=I(V.adler,de.pending_buf,de.pending-se,se)),Te===0&&(de.gzindex=0,de.status=91)}else de.status=91;if(de.status===91)if(de.gzhead.comment){se=de.pending;do{if(de.pending===de.pending_buf_size&&(de.gzhead.hcrc&&de.pending>se&&(V.adler=I(V.adler,de.pending_buf,de.pending-se,se)),xe(V),se=de.pending,de.pending===de.pending_buf_size)){Te=1;break}Te=de.gzindexse&&(V.adler=I(V.adler,de.pending_buf,de.pending-se,se)),Te===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&&(mt(de,255&V.adler),mt(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,F}else if(V.avail_in===0&&Le(Ue)<=Le(ie)&&Ue!==M)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!==A&&de.status!==666){var tt=de.strategy===2?function(Ne,ot){for(var kt;;){if(Ne.lookahead===0&&(Jt(Ne),Ne.lookahead===0)){if(ot===A)return H;break}if(Ne.match_length=0,kt=c._tr_tally(Ne,0,Ne.window[Ne.strstart]),Ne.lookahead--,Ne.strstart++,kt&&(Ee(Ne,!1),Ne.strm.avail_out===0))return H}return Ne.insert=0,ot===M?(Ee(Ne,!0),Ne.strm.avail_out===0?vt:ye):Ne.last_lit&&(Ee(Ne,!1),Ne.strm.avail_out===0)?H:Re}(de,Ue):de.strategy===3?function(Ne,ot){for(var kt,at,Bt,Tr,qe=Ne.window;;){if(Ne.lookahead<=Ge){if(Jt(Ne),Ne.lookahead<=Ge&&ot===A)return H;if(Ne.lookahead===0)break}if(Ne.match_length=0,Ne.lookahead>=Oe&&0Ne.lookahead&&(Ne.match_length=Ne.lookahead)}if(Ne.match_length>=Oe?(kt=c._tr_tally(Ne,1,Ne.match_length-Oe),Ne.lookahead-=Ne.match_length,Ne.strstart+=Ne.match_length,Ne.match_length=0):(kt=c._tr_tally(Ne,0,Ne.window[Ne.strstart]),Ne.lookahead--,Ne.strstart++),kt&&(Ee(Ne,!1),Ne.strm.avail_out===0))return H}return Ne.insert=0,ot===M?(Ee(Ne,!0),Ne.strm.avail_out===0?vt:ye):Ne.last_lit&&(Ee(Ne,!1),Ne.strm.avail_out===0)?H:Re}(de,Ue):f[de.level].func(de,Ue);if(tt!==vt&&tt!==ye||(de.status=666),tt===H||tt===vt)return V.avail_out===0&&(de.last_flush=-1),F;if(tt===Re&&(Ue===1?c._tr_align(de):Ue!==5&&(c._tr_stored_block(de,0,0,!1),Ue===3&&(Ke(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,F}return Ue!==M?F:de.wrap<=0?1:(de.wrap===2?(mt(de,255&V.adler),mt(de,V.adler>>8&255),mt(de,V.adler>>16&255),mt(de,V.adler>>24&255),mt(de,255&V.total_in),mt(de,V.total_in>>8&255),mt(de,V.total_in>>16&255),mt(de,V.total_in>>24&255)):(nt(de,V.adler>>>16),nt(de,65535&V.adler)),xe(V),0=ie.w_size&&(Te===0&&(Ke(ie.head),ie.strstart=0,ie.block_start=0,ie.insert=0),ot=new g.Buf8(ie.w_size),g.arraySet(ot,Ue,kt-ie.w_size,ie.w_size,0),Ue=ot,kt=ie.w_size),Ze=V.avail_in,tt=V.next_in,Ne=V.input,V.avail_in=kt,V.next_in=0,V.input=Ue,Jt(ie);ie.lookahead>=Oe;){for(de=ie.strstart,se=ie.lookahead-(Oe-1);ie.ins_h=(ie.ins_h<>>=Oe=Fe>>>24,Z-=Oe,(Oe=Fe>>>16&255)===0)Re[z++]=65535&Fe;else{if(!(16&Oe)){if(!(64&Oe)){Fe=ne[(65535&Fe)+($&(1<>>=Oe,Z-=Oe),Z<15&&($+=H[T++]<>>=Oe=Fe>>>24,Z-=Oe,!(16&(Oe=Fe>>>16&255))){if(!(64&Oe)){Fe=oe[(65535&Fe)+($&(1<>>=Oe,Z-=Oe,(Oe=z-A)>3,$&=(1<<(Z-=Ge<<3))-1,f.next_in=T,f.next_out=z,f.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 f.Buf16(320),this.work=new f.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function Z(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=Y,je.last=0,je.havedict=0,je.dmax=32768,je.head=null,je.hold=0,je.bits=0,je.lencode=je.lendyn=new f.Buf32(U),je.distcode=je.distdyn=new f.Buf32(J),je.sane=1,je.back=-1,M):F}function ne(ve){var je;return ve&&ve.state?((je=ve.state).wsize=0,je.whave=0,je.wnext=0,Z(ve)):F}function oe(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?(f.arraySet(ye.window,je,H-ye.wsize,ye.wsize,0),ye.wnext=0,ye.whave=ye.wsize):(Re<(vt=ye.wsize-ye.wnext)&&(vt=Re),f.arraySet(ye.window,je,H-Re,vt,ye.wnext),(Re-=vt)?(f.arraySet(ye.window,je,H-Re,Re,0),ye.wnext=Re,ye.whave=ye.wsize):(ye.wnext+=vt,ye.wnext===ye.wsize&&(ye.wnext=0),ye.whave>>8&255,H.check=c(H.check,Te,2,0),Ee=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(Ee-=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&&(Te[0]=255&xe,Te[1]=xe>>>8&255,H.check=c(H.check,Te,2,0)),Ee=xe=0,H.mode=3;case 3:for(;Ee<32;){if(Le===0)break e;Le--,xe+=Re[ye++]<>>8&255,Te[2]=xe>>>16&255,Te[3]=xe>>>24&255,H.check=c(H.check,Te,4,0)),Ee=xe=0,H.mode=4;case 4:for(;Ee<16;){if(Le===0)break e;Le--,xe+=Re[ye++]<>8),512&H.flags&&(Te[0]=255&xe,Te[1]=xe>>>8&255,H.check=c(H.check,Te,2,0)),Ee=xe=0,H.mode=5;case 5:if(1024&H.flags){for(;Ee<16;){if(Le===0)break e;Le--,xe+=Re[ye++]<>>8&255,H.check=c(H.check,Te,2,0)),Ee=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)),f.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(;Ee<32;){if(Le===0)break e;Le--,xe+=Re[ye++]<>>=7&Ee,Ee-=7&Ee,H.mode=27;break}for(;Ee<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,Ee-=2;break e;case 2:H.mode=17;break;case 3:ve.msg="invalid block type",H.mode=30}xe>>>=2,Ee-=2;break;case 14:for(xe>>>=7&Ee,Ee-=7&Ee;Ee<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,Ee=xe=0,H.mode=15,je===6)break e;case 15:H.mode=16;case 16:if(rt=H.length){if(Le>>=5,Ee-=5,H.ndist=1+(31&xe),xe>>>=5,Ee-=5,H.ncode=4+(15&xe),xe>>>=4,Ee-=4,286>>=3,Ee-=3}for(;H.have<19;)H.lens[Ze[H.have++]]=0;if(H.lencode=H.lendyn,H.lenbits=7,ie={bits:H.lenbits},Ue=I(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,_r=65535&se,!((Vt=se>>>24)<=Ee);){if(Le===0)break e;Le--,xe+=Re[ye++]<>>=Vt,Ee-=Vt,H.lens[H.have++]=_r;else{if(_r===16){for(de=Vt+2;Ee>>=Vt,Ee-=Vt,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,Ee-=2}else if(_r===17){for(de=Vt+3;Ee>>=Vt)),xe>>>=3,Ee-=3}else{for(de=Vt+7;Ee>>=Vt)),xe>>>=7,Ee-=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=I(z,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=I(A,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<=Ke){ve.next_out=Be,ve.avail_out=Ke,ve.next_in=ye,ve.avail_in=Le,H.hold=xe,H.bits=Ee,T(ve,nt),Be=ve.next_out,vt=ve.output,Ke=ve.avail_out,ye=ve.next_in,Re=ve.input,Le=ve.avail_in,xe=H.hold,Ee=H.bits,H.mode===12&&(H.back=-1);break}for(H.back=0;Yt=(se=H.lencode[xe&(1<>>16&255,_r=65535&se,!((Vt=se>>>24)<=Ee);){if(Le===0)break e;Le--,xe+=Re[ye++]<>fr)])>>>16&255,_r=65535&se,!(fr+(Vt=se>>>24)<=Ee);){if(Le===0)break e;Le--,xe+=Re[ye++]<>>=fr,Ee-=fr,H.back+=fr}if(xe>>>=Vt,Ee-=Vt,H.back+=Vt,H.length=_r,Yt===0){H.mode=26;break}if(32&Yt){H.back=-1,H.mode=12;break}if(64&Yt){ve.msg="invalid literal/length code",H.mode=30;break}H.extra=15&Yt,H.mode=22;case 22:if(H.extra){for(de=H.extra;Ee>>=H.extra,Ee-=H.extra,H.back+=H.extra}H.was=H.length,H.mode=23;case 23:for(;Yt=(se=H.distcode[xe&(1<>>16&255,_r=65535&se,!((Vt=se>>>24)<=Ee);){if(Le===0)break e;Le--,xe+=Re[ye++]<>fr)])>>>16&255,_r=65535&se,!(fr+(Vt=se>>>24)<=Ee);){if(Le===0)break e;Le--,xe+=Re[ye++]<>>=fr,Ee-=fr,H.back+=fr}if(xe>>>=Vt,Ee-=Vt,H.back+=Vt,64&Yt){ve.msg="invalid distance code",H.mode=30;break}H.offset=_r,H.extra=15&Yt,H.mode=24;case 24:if(H.extra){for(de=H.extra;Ee>>=H.extra,Ee-=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(Ke===0)break e;if(rt=nt-Ke,H.offset>rt){if((rt=H.offset-rt)>H.whave&&H.sane){ve.msg="invalid distance too far back",H.mode=30;break}Jt=rt>H.wnext?(rt-=H.wnext,H.wsize-rt):H.wnext-rt,rt>H.length&&(rt=H.length),er=H.window}else er=vt,Jt=Be-H.offset,rt=H.length;for(Kege?(Oe=Jt[er+J[je]],Ee[mt+J[je]]):(Oe=96,0),$=1<>Be)+(Z-=$)]=Fe<<24|Oe<<16|Ge|0,Z!==0;);for($=1<>=1;if($!==0?(xe&=$-1,xe+=$):xe=0,je++,--nt[ve]==0){if(ve===Re)break;ve=A[M+J[je]]}if(vt>>7)]}function mt(se,Te){se.pending_buf[se.pending++]=255&Te,se.pending_buf[se.pending++]=Te>>>8&255}function nt(se,Te,Ze){se.bi_valid>O-Ze?(se.bi_buf|=Te<>O-se.bi_valid,se.bi_valid+=Ze-O):(se.bi_buf|=Te<>>=1,Ze<<=1,0<--Te;);return Ze>>>1}function er(se,Te,Ze){var tt,Ne,ot=new Array(J+1),kt=0;for(tt=1;tt<=J;tt++)ot[tt]=kt=kt+Ze[tt-1]<<1;for(Ne=0;Ne<=Te;Ne++){var at=se[2*Ne+1];at!==0&&(se[2*Ne]=Jt(ot[at]++,at))}}function Vt(se){var Te;for(Te=0;Te>1;1<=Ze;Ze--)fr(se,ot,Ze);for(Ne=Bt;Ze=se.heap[1],se.heap[1]=se.heap[se.heap_len--],fr(se,ot,1),tt=se.heap[1],se.heap[--se.heap_max]=Ze,se.heap[--se.heap_max]=tt,ot[2*Ne]=ot[2*Ze]+ot[2*tt],se.depth[Ne]=(se.depth[Ze]>=se.depth[tt]?se.depth[Ze]:se.depth[tt])+1,ot[2*Ze+1]=ot[2*tt+1]=Ne,se.heap[1]=Ne++,fr(se,ot,1),2<=se.heap_len;);se.heap[--se.heap_max]=se.heap[1],function(qe,tn){var _n,vn,pi,Qe,Kt,jt,Kr=tn.dyn_tree,mi=tn.max_code,Xt=tn.stat_desc.static_tree,Yi=tn.stat_desc.has_stree,fs=tn.stat_desc.extra_bits,ps=tn.stat_desc.extra_base,Hn=tn.stat_desc.max_length,he=0;for(Qe=0;Qe<=J;Qe++)qe.bl_count[Qe]=0;for(Kr[2*qe.heap[qe.heap_max]+1]=0,_n=qe.heap_max+1;_n>=7;Ne>>=1)if(1&Tr&&at.dyn_ltree[2*Bt]!==0)return g;if(at.dyn_ltree[18]!==0||at.dyn_ltree[20]!==0||at.dyn_ltree[26]!==0)return c;for(Bt=32;Bt>>3,(ot=se.static_len+3+7>>>3)<=Ne&&(Ne=ot)):Ne=ot=Ze+5,Ze+4<=Ne&&Te!==-1?de(se,Te,Ze,tt):se.strategy===4||ot===Ne?(nt(se,2+(tt?1:0),3),br(se,it,ve)):(nt(se,4+(tt?1:0),3),function(at,Bt,Tr,qe){var tn;for(nt(at,Bt-257,5),nt(at,Tr-1,5),nt(at,qe-4,4),tn=0;tn>>8&255,se.pending_buf[se.d_buf+2*se.last_lit+1]=255&Te,se.pending_buf[se.l_buf+se.last_lit]=255&Ze,se.last_lit++,Te===0?se.dyn_ltree[2*Ze]++:(se.matches++,Te--,se.dyn_ltree[2*(H[Ze]+A+1)]++,se.dyn_dtree[2*Ee(Te)]++),se.last_lit===se.lit_bufsize-1},h._tr_align=function(se){nt(se,2,3),rt(se,Z,it),function(Te){Te.bi_valid===16?(mt(Te,Te.bi_buf),Te.bi_buf=0,Te.bi_valid=0):8<=Te.bi_valid&&(Te.pending_buf[Te.pending++]=255&Te.bi_buf,Te.bi_buf>>=8,Te.bi_valid-=8)}(se)}},{"../utils/common":41}],53:[function(n,o,h){o.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(n,o,h){(function(f){(function(g,c){if(!g.setImmediate){var T,I,z,A,M=1,F={},Y=!1,U=g.document,J=Object.getPrototypeOf&&Object.getPrototypeOf(g);J=J&&J.setTimeout?J:g,T={}.toString.call(g.process)==="[object process]"?function(ne){process.nextTick(function(){$(ne)})}:function(){if(g.postMessage&&!g.importScripts){var ne=!0,oe=g.onmessage;return g.onmessage=function(){ne=!1},g.postMessage("","*"),g.onmessage=oe,ne}}()?(A="setImmediate$"+Math.random()+"$",g.addEventListener?g.addEventListener("message",Z,!1):g.attachEvent("onmessage",Z),function(ne){g.postMessage(A+ne,"*")}):g.MessageChannel?((z=new MessageChannel).port1.onmessage=function(ne){$(ne.data)},function(ne){z.port2.postMessage(ne)}):U&&"onreadystatechange"in U.createElement("script")?(I=U.documentElement,function(ne){var oe=U.createElement("script");oe.onreadystatechange=function(){$(ne),oe.onreadystatechange=null,I.removeChild(oe),oe=null},I.appendChild(oe)}):function(ne){setTimeout($,0,ne)},J.setImmediate=function(ne){typeof ne!="function"&&(ne=new Function(""+ne));for(var oe=new Array(arguments.length-1),ke=0;ke"u"?f===void 0?this:f:self)}).call(this,typeof Vo<"u"?Vo:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(FI);var tL=FI.exports;const BI=dp(tL);var $1=function(e,t){return $1=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var h in o)Object.prototype.hasOwnProperty.call(o,h)&&(n[h]=o[h])},$1(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");$1(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var Ft=function(){return Ft=Object.assign||function(t){for(var n,o=1,h=arguments.length;o"u"&&(f=e.call(this,o),t.set(h,f)),f}function $I(e,t,n){var o=Array.prototype.slice.call(arguments,3),h=n(o),f=t.get(h);return typeof f>"u"&&(f=e.apply(this,o),t.set(h,f)),f}function vw(e,t,n,o,h){return n.bind(t,e,o,h)}function nL(e,t){var n=e.length===1?NI:$I;return vw(e,this,n,t.cache.create(),t.serializer)}function iL(e,t){return vw(e,this,$I,t.cache.create(),t.serializer)}function sL(e,t){return vw(e,this,NI,t.cache.create(),t.serializer)}var oL=function(){return JSON.stringify(arguments)};function xw(){this.cache=Object.create(null)}xw.prototype.get=function(e){return this.cache[e]};xw.prototype.set=function(e,t){this.cache[e]=t};var aL={create:function(){return new xw}},ji={variadic:iL,monadic:sL};function jI(e,t,n){if(n===void 0&&(n=Error),!e)throw new n(t)}$i(function(){for(var e,t=[],n=0;n0}),n=[],o=0,h=t;o1)throw new RangeError("integer-width stems only accept a single optional option");h.options[0].replace(mL,function(T,I,z,A,M,F){if(I)t.minimumIntegerDigits=z.length;else{if(A&&M)throw new Error("We currently do not support maximum integer digits");if(F)throw new Error("We currently do not support exact integer digits")}return""});continue}if(KI.test(h.stem)){t.minimumIntegerDigits=h.stem.length;continue}if(Ak.test(h.stem)){if(h.options.length>1)throw new RangeError("Fraction-precision stems only accept a single optional option");h.stem.replace(Ak,function(T,I,z,A,M,F){return z==="*"?t.minimumFractionDigits=I.length:A&&A[0]==="#"?t.maximumFractionDigits=A.length:M&&F?(t.minimumFractionDigits=M.length,t.maximumFractionDigits=M.length+F.length):(t.minimumFractionDigits=I.length,t.maximumFractionDigits=I.length),""});var f=h.options[0];f==="w"?t=Ft(Ft({},t),{trailingZeroDisplay:"stripIfInteger"}):f&&(t=Ft(Ft({},t),Dk(f)));continue}if(XI.test(h.stem)){t=Ft(Ft({},t),Dk(h.stem));continue}var g=JI(h.stem);g&&(t=Ft(Ft({},t),g));var c=gL(h.stem);c&&(t=Ft(Ft({},t),c))}return t}var Jm={"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 _L(e,t){for(var n="",o=0;o>1),T="a",I=vL(t);for((I=="H"||I=="k")&&(c=0);c-- >0;)n+=T;for(;g-- >0;)n=I+n}else h==="J"?n+="H":n+=h}return n}function vL(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 n=e.language,o;n!=="root"&&(o=e.maximize().region);var h=Jm[o||""]||Jm[n||""]||Jm["".concat(n,"-001")]||Jm["001"];return h[0]}var wv,xL=new RegExp("^".concat(YI.source,"*")),wL=new RegExp("".concat(YI.source,"*$"));function Cr(e,t){return{start:e,end:t}}var bL=!!String.prototype.startsWith&&"_a".startsWith("a",1),SL=!!String.fromCodePoint,kL=!!Object.fromEntries,TL=!!String.prototype.codePointAt,EL=!!String.prototype.trimStart,CL=!!String.prototype.trimEnd,IL=!!Number.isSafeInteger,PL=IL?Number.isSafeInteger:function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e&&Math.abs(e)<=9007199254740991},U1=!0;try{var ML=eP("([^\\p{White_Space}\\p{Pattern_Syntax}]*)","yu");U1=((wv=ML.exec("a"))===null||wv===void 0?void 0:wv[0])==="a"}catch{U1=!1}var Rk=bL?function(t,n,o){return t.startsWith(n,o)}:function(t,n,o){return t.slice(o,o+n.length)===n},V1=SL?String.fromCodePoint:function(){for(var t=[],n=0;nf;){if(g=t[f++],g>1114111)throw RangeError(g+" is not a valid code point");o+=g<65536?String.fromCharCode(g):String.fromCharCode(((g-=65536)>>10)+55296,g%1024+56320)}return o},Lk=kL?Object.fromEntries:function(t){for(var n={},o=0,h=t;o=o)){var h=t.charCodeAt(n),f;return h<55296||h>56319||n+1===o||(f=t.charCodeAt(n+1))<56320||f>57343?h:(h-55296<<10)+(f-56320)+65536}},AL=EL?function(t){return t.trimStart()}:function(t){return t.replace(xL,"")},DL=CL?function(t){return t.trimEnd()}:function(t){return t.replace(wL,"")};function eP(e,t){return new RegExp(e,t)}var H1;if(U1){var Ok=eP("([^\\p{White_Space}\\p{Pattern_Syntax}]*)","yu");H1=function(t,n){var o;Ok.lastIndex=n;var h=Ok.exec(t);return(o=h[1])!==null&&o!==void 0?o:""}}else H1=function(t,n){for(var o=[];;){var h=QI(t,n);if(h===void 0||tP(h)||OL(h))break;o.push(h),n+=h>=65536?2:1}return V1.apply(void 0,o)};var zL=function(){function e(t,n){n===void 0&&(n={}),this.message=t,this.position={offset:0,line:1,column:1},this.ignoreTag=!!n.ignoreTag,this.locale=n.locale,this.requiresOtherClause=!!n.requiresOtherClause,this.shouldParseSkeletons=!!n.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,n,o){for(var h=[];!this.isEOF();){var f=this.char();if(f===123){var g=this.parseArgument(t,o);if(g.err)return g;h.push(g.val)}else{if(f===125&&t>0)break;if(f===35&&(n==="plural"||n==="selectordinal")){var c=this.clonePosition();this.bump(),h.push({type:an.pound,location:Cr(c,this.clonePosition())})}else if(f===60&&!this.ignoreTag&&this.peek()===47){if(o)break;return this.error(kr.UNMATCHED_CLOSING_TAG,Cr(this.clonePosition(),this.clonePosition()))}else if(f===60&&!this.ignoreTag&&W1(this.peek()||0)){var g=this.parseTag(t,n);if(g.err)return g;h.push(g.val)}else{var g=this.parseLiteral(t,n);if(g.err)return g;h.push(g.val)}}}return{val:h,err:null}},e.prototype.parseTag=function(t,n){var o=this.clonePosition();this.bump();var h=this.parseTagName();if(this.bumpSpace(),this.bumpIf("/>"))return{val:{type:an.literal,value:"<".concat(h,"/>"),location:Cr(o,this.clonePosition())},err:null};if(this.bumpIf(">")){var f=this.parseMessage(t+1,n,!0);if(f.err)return f;var g=f.val,c=this.clonePosition();if(this.bumpIf("")?{val:{type:an.tag,value:h,children:g,location:Cr(o,this.clonePosition())},err:null}:this.error(kr.INVALID_TAG,Cr(c,this.clonePosition())))}else return this.error(kr.UNCLOSED_TAG,Cr(o,this.clonePosition()))}else return this.error(kr.INVALID_TAG,Cr(o,this.clonePosition()))},e.prototype.parseTagName=function(){var t=this.offset();for(this.bump();!this.isEOF()&&LL(this.char());)this.bump();return this.message.slice(t,this.offset())},e.prototype.parseLiteral=function(t,n){for(var o=this.clonePosition(),h="";;){var f=this.tryParseQuote(n);if(f){h+=f;continue}var g=this.tryParseUnquoted(t,n);if(g){h+=g;continue}var c=this.tryParseLeftAngleBracket();if(c){h+=c;continue}break}var T=Cr(o,this.clonePosition());return{val:{type:an.literal,value:h,location:T},err:null}},e.prototype.tryParseLeftAngleBracket=function(){return!this.isEOF()&&this.char()===60&&(this.ignoreTag||!RL(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 n=[this.char()];for(this.bump();!this.isEOF();){var o=this.char();if(o===39)if(this.peek()===39)n.push(39),this.bump();else{this.bump();break}else n.push(o);this.bump()}return V1.apply(void 0,n)},e.prototype.tryParseUnquoted=function(t,n){if(this.isEOF())return null;var o=this.char();return o===60||o===123||o===35&&(n==="plural"||n==="selectordinal")||o===125&&t>0?null:(this.bump(),V1(o))},e.prototype.parseArgument=function(t,n){var o=this.clonePosition();if(this.bump(),this.bumpSpace(),this.isEOF())return this.error(kr.EXPECT_ARGUMENT_CLOSING_BRACE,Cr(o,this.clonePosition()));if(this.char()===125)return this.bump(),this.error(kr.EMPTY_ARGUMENT,Cr(o,this.clonePosition()));var h=this.parseIdentifierIfPossible().value;if(!h)return this.error(kr.MALFORMED_ARGUMENT,Cr(o,this.clonePosition()));if(this.bumpSpace(),this.isEOF())return this.error(kr.EXPECT_ARGUMENT_CLOSING_BRACE,Cr(o,this.clonePosition()));switch(this.char()){case 125:return this.bump(),{val:{type:an.argument,value:h,location:Cr(o,this.clonePosition())},err:null};case 44:return this.bump(),this.bumpSpace(),this.isEOF()?this.error(kr.EXPECT_ARGUMENT_CLOSING_BRACE,Cr(o,this.clonePosition())):this.parseArgumentOptions(t,n,h,o);default:return this.error(kr.MALFORMED_ARGUMENT,Cr(o,this.clonePosition()))}},e.prototype.parseIdentifierIfPossible=function(){var t=this.clonePosition(),n=this.offset(),o=H1(this.message,n),h=n+o.length;this.bumpTo(h);var f=this.clonePosition(),g=Cr(t,f);return{value:o,location:g}},e.prototype.parseArgumentOptions=function(t,n,o,h){var f,g=this.clonePosition(),c=this.parseIdentifierIfPossible().value,T=this.clonePosition();switch(c){case"":return this.error(kr.EXPECT_ARGUMENT_TYPE,Cr(g,T));case"number":case"date":case"time":{this.bumpSpace();var I=null;if(this.bumpIf(",")){this.bumpSpace();var z=this.clonePosition(),A=this.parseSimpleArgStyleIfPossible();if(A.err)return A;var M=DL(A.val);if(M.length===0)return this.error(kr.EXPECT_ARGUMENT_STYLE,Cr(this.clonePosition(),this.clonePosition()));var F=Cr(z,this.clonePosition());I={style:M,styleLocation:F}}var Y=this.tryParseArgumentClose(h);if(Y.err)return Y;var U=Cr(h,this.clonePosition());if(I&&Rk(I==null?void 0:I.style,"::",0)){var J=AL(I.style.slice(2));if(c==="number"){var A=this.parseNumberSkeletonFromString(J,I.styleLocation);return A.err?A:{val:{type:an.number,value:o,location:U,style:A.val},err:null}}else{if(J.length===0)return this.error(kr.EXPECT_DATE_TIME_SKELETON,U);var O=J;this.locale&&(O=_L(J,this.locale));var M={type:Oh.dateTime,pattern:O,location:I.styleLocation,parsedOptions:this.shouldParseSkeletons?hL(O):{}},$=c==="date"?an.date:an.time;return{val:{type:$,value:o,location:U,style:M},err:null}}}return{val:{type:c==="number"?an.number:c==="date"?an.date:an.time,value:o,location:U,style:(f=I==null?void 0:I.style)!==null&&f!==void 0?f:null},err:null}}case"plural":case"selectordinal":case"select":{var Z=this.clonePosition();if(this.bumpSpace(),!this.bumpIf(","))return this.error(kr.EXPECT_SELECT_ARGUMENT_OPTIONS,Cr(Z,Ft({},Z)));this.bumpSpace();var ne=this.parseIdentifierIfPossible(),oe=0;if(c!=="select"&&ne.value==="offset"){if(!this.bumpIf(":"))return this.error(kr.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE,Cr(this.clonePosition(),this.clonePosition()));this.bumpSpace();var A=this.tryParseDecimalInteger(kr.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE,kr.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE);if(A.err)return A;this.bumpSpace(),ne=this.parseIdentifierIfPossible(),oe=A.val}var ke=this.tryParsePluralOrSelectOptions(t,c,n,ne);if(ke.err)return ke;var Y=this.tryParseArgumentClose(h);if(Y.err)return Y;var ge=Cr(h,this.clonePosition());return c==="select"?{val:{type:an.select,value:o,options:Lk(ke.val),location:ge},err:null}:{val:{type:an.plural,value:o,options:Lk(ke.val),offset:oe,pluralType:c==="plural"?"cardinal":"ordinal",location:ge},err:null}}default:return this.error(kr.INVALID_ARGUMENT_TYPE,Cr(g,T))}},e.prototype.tryParseArgumentClose=function(t){return this.isEOF()||this.char()!==125?this.error(kr.EXPECT_ARGUMENT_CLOSING_BRACE,Cr(t,this.clonePosition())):(this.bump(),{val:!0,err:null})},e.prototype.parseSimpleArgStyleIfPossible=function(){for(var t=0,n=this.clonePosition();!this.isEOF();){var o=this.char();switch(o){case 39:{this.bump();var h=this.clonePosition();if(!this.bumpUntil("'"))return this.error(kr.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE,Cr(h,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(n.offset,this.offset()),err:null};break}default:this.bump();break}}return{val:this.message.slice(n.offset,this.offset()),err:null}},e.prototype.parseNumberSkeletonFromString=function(t,n){var o=[];try{o=fL(t)}catch{return this.error(kr.INVALID_NUMBER_SKELETON,n)}return{val:{type:Oh.number,tokens:o,location:n,parsedOptions:this.shouldParseSkeletons?yL(o):{}},err:null}},e.prototype.tryParsePluralOrSelectOptions=function(t,n,o,h){for(var f,g=!1,c=[],T=new Set,I=h.value,z=h.location;;){if(I.length===0){var A=this.clonePosition();if(n!=="select"&&this.bumpIf("=")){var M=this.tryParseDecimalInteger(kr.EXPECT_PLURAL_ARGUMENT_SELECTOR,kr.INVALID_PLURAL_ARGUMENT_SELECTOR);if(M.err)return M;z=Cr(A,this.clonePosition()),I=this.message.slice(A.offset,this.offset())}else break}if(T.has(I))return this.error(n==="select"?kr.DUPLICATE_SELECT_ARGUMENT_SELECTOR:kr.DUPLICATE_PLURAL_ARGUMENT_SELECTOR,z);I==="other"&&(g=!0),this.bumpSpace();var F=this.clonePosition();if(!this.bumpIf("{"))return this.error(n==="select"?kr.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT:kr.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT,Cr(this.clonePosition(),this.clonePosition()));var Y=this.parseMessage(t+1,n,o);if(Y.err)return Y;var U=this.tryParseArgumentClose(F);if(U.err)return U;c.push([I,{value:Y.val,location:Cr(F,this.clonePosition())}]),T.add(I),this.bumpSpace(),f=this.parseIdentifierIfPossible(),I=f.value,z=f.location}return c.length===0?this.error(n==="select"?kr.EXPECT_SELECT_ARGUMENT_SELECTOR:kr.EXPECT_PLURAL_ARGUMENT_SELECTOR,Cr(this.clonePosition(),this.clonePosition())):this.requiresOtherClause&&!g?this.error(kr.MISSING_OTHER_CLAUSE,Cr(this.clonePosition(),this.clonePosition())):{val:c,err:null}},e.prototype.tryParseDecimalInteger=function(t,n){var o=1,h=this.clonePosition();this.bumpIf("+")||this.bumpIf("-")&&(o=-1);for(var f=!1,g=0;!this.isEOF();){var c=this.char();if(c>=48&&c<=57)f=!0,g=g*10+(c-48),this.bump();else break}var T=Cr(h,this.clonePosition());return f?(g*=o,PL(g)?{val:g,err:null}:this.error(n,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 n=QI(this.message,t);if(n===void 0)throw Error("Offset ".concat(t," is at invalid UTF-16 code unit boundary"));return n},e.prototype.error=function(t,n){return{val:null,err:{kind:t,message:this.message,location:n}}},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(Rk(this.message,t,this.offset())){for(var n=0;n=0?(this.bumpTo(o),!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 n=this.offset();if(n===t)break;if(n>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()&&tP(this.char());)this.bump()},e.prototype.peek=function(){if(this.isEOF())return null;var t=this.char(),n=this.offset(),o=this.message.charCodeAt(n+(t>=65536?2:1));return o??null},e}();function W1(e){return e>=97&&e<=122||e>=65&&e<=90}function RL(e){return W1(e)||e===47}function LL(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 tP(e){return e>=9&&e<=13||e===32||e===133||e>=8206&&e<=8207||e===8232||e===8233}function OL(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 G1(e){e.forEach(function(t){if(delete t.location,WI(t)||GI(t))for(var n in t.options)delete t.options[n].location,G1(t.options[n].value);else UI(t)&&qI(t.style)||(VI(t)||HI(t))&&j1(t.style)?delete t.style.location:ZI(t)&&G1(t.children)})}function FL(e,t){t===void 0&&(t={}),t=Ft({shouldParseSkeletons:!0,requiresOtherClause:!0},t);var n=new zL(e,t).parse();if(n.err){var o=SyntaxError(kr[n.err.kind]);throw o.location=n.err.location,o.originalMessage=n.err.message,o}return t!=null&&t.captureLocation||G1(n.val),n.val}var qo;(function(e){e.MISSING_VALUE="MISSING_VALUE",e.INVALID_VALUE="INVALID_VALUE",e.MISSING_INTL_API="MISSING_INTL_API"})(qo||(qo={}));var Zl=function(e){no(t,e);function t(n,o,h){var f=e.call(this,n)||this;return f.code=o,f.originalMessage=h,f}return t.prototype.toString=function(){return"[formatjs Error: ".concat(this.code,"] ").concat(this.message)},t}(Error),Fk=function(e){no(t,e);function t(n,o,h,f){return e.call(this,'Invalid values for "'.concat(n,'": "').concat(o,'". Options are "').concat(Object.keys(h).join('", "'),'"'),qo.INVALID_VALUE,f)||this}return t}(Zl),BL=function(e){no(t,e);function t(n,o,h){return e.call(this,'Value for "'.concat(n,'" must be of type ').concat(o),qo.INVALID_VALUE,h)||this}return t}(Zl),NL=function(e){no(t,e);function t(n,o){return e.call(this,'The intl string context variable "'.concat(n,'" was not provided to the string "').concat(o,'"'),qo.MISSING_VALUE,o)||this}return t}(Zl),Bi;(function(e){e[e.literal=0]="literal",e[e.object=1]="object"})(Bi||(Bi={}));function $L(e){return e.length<2?e:e.reduce(function(t,n){var o=t[t.length-1];return!o||o.type!==Bi.literal||n.type!==Bi.literal?t.push(n):o.value+=n.value,t},[])}function rP(e){return typeof e=="function"}function kg(e,t,n,o,h,f,g){if(e.length===1&&Mk(e[0]))return[{type:Bi.literal,value:e[0].value}];for(var c=[],T=0,I=e;T"u")){var n=Intl.NumberFormat.supportedLocalesOf(t);return n.length>0?new Intl.Locale(n[0]):new Intl.Locale(typeof t=="string"?t:t[0])}},e.__parse=FL,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}(),qu;(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"})(qu||(qu={}));var wp=function(e){no(t,e);function t(n,o,h){var f=this,g=h?h instanceof Error?h:new Error(String(h)):void 0;return f=e.call(this,"[@formatjs/intl Error ".concat(n,"] ").concat(o,` +`).concat(g?` +`.concat(g.message,` +`).concat(g.stack):""))||this,f.code=n,typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(f,t),f}return t}(Error),HL=function(e){no(t,e);function t(n,o){return e.call(this,qu.UNSUPPORTED_FORMATTER,n,o)||this}return t}(wp),WL=function(e){no(t,e);function t(n,o){return e.call(this,qu.INVALID_CONFIG,n,o)||this}return t}(wp),Bk=function(e){no(t,e);function t(n,o){return e.call(this,qu.MISSING_DATA,n,o)||this}return t}(wp),io=function(e){no(t,e);function t(n,o,h){var f=e.call(this,qu.FORMAT_ERROR,"".concat(n,` +Locale: `).concat(o,` +`),h)||this;return f.locale=o,f}return t}(wp),Sv=function(e){no(t,e);function t(n,o,h,f){var g=e.call(this,"".concat(n,` +MessageID: `).concat(h==null?void 0:h.id,` +Default Message: `).concat(h==null?void 0:h.defaultMessage,` +Description: `).concat(h==null?void 0:h.description,` +`),o,f)||this;return g.descriptor=h,g.locale=o,g}return t}(io),GL=function(e){no(t,e);function t(n,o){var h=e.call(this,qu.MISSING_TRANSLATION,'Missing message: "'.concat(n.id,'" for locale "').concat(o,'", using ').concat(n.defaultMessage?"default message (".concat(typeof n.defaultMessage=="string"?n.defaultMessage:n.defaultMessage.map(function(f){var g;return(g=f.value)!==null&&g!==void 0?g:JSON.stringify(f)}).join(),")"):"id"," as fallback."))||this;return h.descriptor=n,h}return t}(wp);function Ju(e,t,n){return n===void 0&&(n={}),t.reduce(function(o,h){return h in e?o[h]=e[h]:h in n&&(o[h]=n[h]),o},{})}var ZL=function(e){},qL=function(e){},iP={formats:{},messages:{},timeZone:void 0,defaultLocale:"en",defaultFormats:{},fallbackOnEmptyString:!0,onError:ZL,onWarn:qL};function sP(){return{dateTime:{},number:{},message:{},relativeTime:{},pluralRules:{},list:{},displayNames:{}}}function xu(e){return{create:function(){return{get:function(t){return e[t]},set:function(t,n){e[t]=n}}}}}function YL(e){e===void 0&&(e=sP());var t=Intl.RelativeTimeFormat,n=Intl.ListFormat,o=Intl.DisplayNames,h=$i(function(){for(var c,T=[],I=0;I needs to exist in the component ancestry.")}var cP=Ft(Ft({},iP),{textComponent:Ht.Fragment});function yO(e){return function(t){return e(Ht.Children.toArray(t))}}function q1(e,t){if(e===t)return!0;if(!e||!t)return!1;var n=Object.keys(e),o=Object.keys(t),h=n.length;if(o.length!==h)return!1;for(var f=0;f{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(".jpeg")||t.endsWith(".mp4"))return"media"},DO=({onFilesLoad:e,onDataFileLoad:t,onError:n})=>{const[o,h]=Ht.useState(),[f,g]=Ht.useState(),c=c_(),T=z=>{g(z.length);for(let M=0;M({...J,[F.name]:U.target.result}))},A.onerror=function(U){n(F.name)}}else Y==="zip"&&new BI().loadAsync(F).then(function(U){Object.keys(U.files).forEach(J=>{const O=Hk(J);O==="chat"?U.files[J].async("string").then(function($){h(Z=>({...Z,[F.name]:$}))}):O==="media"&&U.files[J].async("arraybuffer").then(function($){const Z=new Uint8Array($),ne=new Blob([Z.buffer]);t(J,ne)})})})}};Ht.useEffect(()=>{o&&Object.keys(o).length===f&&e(o)},[o,e]);const I=o&&Object.keys(o).length!==f;return We.jsxs(We.Fragment,{children:[I?We.jsxs("p",{style:{textAlign:"center"},children:[c.formatMessage({id:"app.loading",defaultMessage:"Loading"})," ..."]}):"",We.jsx("div",{style:I?{display:"none"}:null,children:We.jsx(eL,{classes:"fileUploadDropArea",handleChange:T,multiple:!0,name:"file",types:AO,label:c.formatMessage({id:"app.uploadLabel",defaultMessage:"Upload or drag a file right here"})})})]})};var _P={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(n,o){e.exports=o()})(Vo,function(){var n={},o={};function h(g,c,T){if(o[g]=T,g==="index"){var I="var sharedModule = {}; ("+o.shared+")(sharedModule); ("+o.worker+")(sharedModule);",z={};return o.shared(z),o.index(n,z),typeof window<"u"&&n.setWorkerUrl(window.URL.createObjectURL(new Blob([I],{type:"text/javascript"}))),n}}h("shared",["exports"],function(g){function c(s,i,a,d){return new(a||(a=Promise))(function(y,x){function w(P){try{k(d.next(P))}catch(D){x(D)}}function b(P){try{k(d.throw(P))}catch(D){x(D)}}function k(P){var D;P.done?y(P.value):(D=P.value,D instanceof a?D:new a(function(L){L(D)})).then(w,b)}k((d=d.apply(s,i||[])).next())})}function T(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}typeof SuppressedError=="function"&&SuppressedError;var I=z;function z(s,i){this.x=s,this.y=i}z.prototype={clone:function(){return new z(this.x,this.y)},add:function(s){return this.clone()._add(s)},sub:function(s){return this.clone()._sub(s)},multByPoint:function(s){return this.clone()._multByPoint(s)},divByPoint:function(s){return this.clone()._divByPoint(s)},mult:function(s){return this.clone()._mult(s)},div:function(s){return this.clone()._div(s)},rotate:function(s){return this.clone()._rotate(s)},rotateAround:function(s,i){return this.clone()._rotateAround(s,i)},matMult:function(s){return this.clone()._matMult(s)},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(s){return this.x===s.x&&this.y===s.y},dist:function(s){return Math.sqrt(this.distSqr(s))},distSqr:function(s){var i=s.x-this.x,a=s.y-this.y;return i*i+a*a},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(s){return Math.atan2(this.y-s.y,this.x-s.x)},angleWith:function(s){return this.angleWithSep(s.x,s.y)},angleWithSep:function(s,i){return Math.atan2(this.x*i-this.y*s,this.x*s+this.y*i)},_matMult:function(s){var i=s[2]*this.x+s[3]*this.y;return this.x=s[0]*this.x+s[1]*this.y,this.y=i,this},_add:function(s){return this.x+=s.x,this.y+=s.y,this},_sub:function(s){return this.x-=s.x,this.y-=s.y,this},_mult:function(s){return this.x*=s,this.y*=s,this},_div:function(s){return this.x/=s,this.y/=s,this},_multByPoint:function(s){return this.x*=s.x,this.y*=s.y,this},_divByPoint:function(s){return this.x/=s.x,this.y/=s.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var s=this.y;return this.y=this.x,this.x=-s,this},_rotate:function(s){var i=Math.cos(s),a=Math.sin(s),d=a*this.x+i*this.y;return this.x=i*this.x-a*this.y,this.y=d,this},_rotateAround:function(s,i){var a=Math.cos(s),d=Math.sin(s),y=i.y+d*(this.x-i.x)+a*(this.y-i.y);return this.x=i.x+a*(this.x-i.x)-d*(this.y-i.y),this.y=y,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},z.convert=function(s){return s instanceof z?s:Array.isArray(s)?new z(s[0],s[1]):s};var A=T(I),M=F;function F(s,i,a,d){this.cx=3*s,this.bx=3*(a-s)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*i,this.by=3*(d-i)-this.cy,this.ay=1-this.cy-this.by,this.p1x=s,this.p1y=i,this.p2x=a,this.p2y=d}F.prototype={sampleCurveX:function(s){return((this.ax*s+this.bx)*s+this.cx)*s},sampleCurveY:function(s){return((this.ay*s+this.by)*s+this.cy)*s},sampleCurveDerivativeX:function(s){return(3*this.ax*s+2*this.bx)*s+this.cx},solveCurveX:function(s,i){if(i===void 0&&(i=1e-6),s<0)return 0;if(s>1)return 1;for(var a=s,d=0;d<8;d++){var y=this.sampleCurveX(a)-s;if(Math.abs(y)y?w=a:b=a,a=.5*(b-w)+w;return a},solve:function(s,i){return this.sampleCurveY(this.solveCurveX(s,i))}};var Y=T(M);let U,J;function O(){return U==null&&(U=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),U}function $(){if(J==null&&(J=!1,O())){const i=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(i){for(let d=0;d<5*5;d++){const y=4*d;i.fillStyle=`rgb(${y},${y+1},${y+2})`,i.fillRect(d%5,Math.floor(d/5),1,1)}const a=i.getImageData(0,0,5,5).data;for(let d=0;d<5*5*4;d++)if(d%4!=3&&a[d]!==d){J=!0;break}}}return J||!1}function Z(s,i,a,d){const y=new Y(s,i,a,d);return x=>y.solve(x)}const ne=Z(.25,.1,.25,1);function oe(s,i,a){return Math.min(a,Math.max(i,s))}function ke(s,i,a){const d=a-i,y=((s-i)%d+d)%d+i;return y===i?a:y}function ge(s,...i){for(const a of i)for(const d in a)s[d]=a[d];return s}let Fe=1;function Oe(s,i,a){const d={};for(const y in s)d[y]=i.call(this,s[y],y,s);return d}function Ge(s,i,a){const d={};for(const y in s)i.call(this,s[y],y,s)&&(d[y]=s[y]);return d}function it(s){return Array.isArray(s)?s.map(it):typeof s=="object"&&s?Oe(s,it):s}const ve={};function je(s){ve[s]||(typeof console<"u"&&console.warn(s),ve[s]=!0)}function H(s,i,a){return(a.y-s.y)*(i.x-s.x)>(i.y-s.y)*(a.x-s.x)}function Re(s){return typeof WorkerGlobalScope<"u"&&s!==void 0&&s instanceof WorkerGlobalScope}let vt=null;function ye(s){return typeof ImageBitmap<"u"&&s instanceof ImageBitmap}const Be="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function Le(s,i,a,d,y){return c(this,void 0,void 0,function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");const x=new VideoFrame(s,{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"),k=new Uint8ClampedArray(d*y*4);if(yield x.copyTo(k,function(P,D,L,j,q){const K=4*Math.max(-D,0),Q=(Math.max(0,L)-L)*j*4+K,le=4*j,fe=Math.max(0,D),De=Math.max(0,L);return{rect:{x:fe,y:De,width:Math.min(P.width,D+j)-fe,height:Math.min(P.height,L+q)-De},layout:[{offset:Q,stride:le}]}}(s,i,a,d,y)),b)for(let P=0;PRe(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,Yt=function(s,i){if(/:\/\//.test(s.url)&&!/^https?:|^file:/.test(s.url)){const d=rt(s.url);if(d)return d(s,i);if(Re(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:s,targetMapId:Jt},i)}if(!(/^file:/.test(a=s.url)||/^file:/.test(Vt())&&!/^\w+:/.test(a))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(d,y){return c(this,void 0,void 0,function*(){const x=new Request(d.url,{method:d.method||"GET",body:d.body,credentials:d.credentials,headers:d.headers,cache:d.cache,referrer:Vt(),signal:y.signal});d.type!=="json"||x.headers.has("Accept")||x.headers.set("Accept","application/json");const w=yield fetch(x);if(!w.ok){const P=yield w.blob();throw new er(w.status,w.statusText,d.url,P)}let b;b=d.type==="arrayBuffer"||d.type==="image"?w.arrayBuffer():d.type==="json"?w.json():w.text();const k=yield b;if(y.signal.aborted)throw mt();return{data:k,cacheControl:w.headers.get("Cache-Control"),expires:w.headers.get("Expires")}})}(s,i);if(Re(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:s,mustQueue:!0,targetMapId:Jt},i)}var a;return function(d,y){return new Promise((x,w)=>{var b;const k=new XMLHttpRequest;k.open(d.method||"GET",d.url,!0),d.type!=="arrayBuffer"&&d.type!=="image"||(k.responseType="arraybuffer");for(const P in d.headers)k.setRequestHeader(P,d.headers[P]);d.type==="json"&&(k.responseType="text",!((b=d.headers)===null||b===void 0)&&b.Accept||k.setRequestHeader("Accept","application/json")),k.withCredentials=d.credentials==="include",k.onerror=()=>{w(new Error(k.statusText))},k.onload=()=>{if(!y.signal.aborted)if((k.status>=200&&k.status<300||k.status===0)&&k.response!==null){let P=k.response;if(d.type==="json")try{P=JSON.parse(k.response)}catch(D){return void w(D)}x({data:P,cacheControl:k.getResponseHeader("Cache-Control"),expires:k.getResponseHeader("Expires")})}else{const P=new Blob([k.response],{type:k.getResponseHeader("Content-Type")});w(new er(k.status,k.statusText,d.url,P))}},y.signal.addEventListener("abort",()=>{k.abort(),w(mt())}),k.send(d.body)})}(s,i)};function _r(s){if(!s||s.indexOf("://")<=0||s.indexOf("data:image/")===0||s.indexOf("blob:")===0)return!0;const i=new URL(s),a=window.location;return i.protocol===a.protocol&&i.host===a.host}function fr(s,i,a){a[s]&&a[s].indexOf(i)!==-1||(a[s]=a[s]||[],a[s].push(i))}function br(s,i,a){if(a&&a[s]){const d=a[s].indexOf(i);d!==-1&&a[s].splice(d,1)}}class Xr{constructor(i,a={}){ge(this,a),this.type=i}}class V extends Xr{constructor(i,a={}){super("error",ge({error:i},a))}}class Ue{on(i,a){return this._listeners=this._listeners||{},fr(i,a,this._listeners),this}off(i,a){return br(i,a,this._listeners),br(i,a,this._oneTimeListeners),this}once(i,a){return a?(this._oneTimeListeners=this._oneTimeListeners||{},fr(i,a,this._oneTimeListeners),this):new Promise(d=>this.once(i,d))}fire(i,a){typeof i=="string"&&(i=new Xr(i,a||{}));const d=i.type;if(this.listens(d)){i.target=this;const y=this._listeners&&this._listeners[d]?this._listeners[d].slice():[];for(const b of y)b.call(this,i);const x=this._oneTimeListeners&&this._oneTimeListeners[d]?this._oneTimeListeners[d].slice():[];for(const b of x)br(d,b,this._oneTimeListeners),b.call(this,i);const w=this._eventedParent;w&&(ge(i,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),w.fire(i))}else i instanceof V&&console.error(i.error);return this}listens(i){return this._listeners&&this._listeners[i]&&this._listeners[i].length>0||this._oneTimeListeners&&this._oneTimeListeners[i]&&this._oneTimeListeners[i].length>0||this._eventedParent&&this._eventedParent.listens(i)}setEventedParent(i,a){return this._eventedParent=i,this._eventedParentData=a,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 se(s,i){const a={};for(const d in s)d!=="ref"&&(a[d]=s[d]);return de.forEach(d=>{d in i&&(a[d]=i[d])}),a}function Te(s,i){if(Array.isArray(s)){if(!Array.isArray(i)||s.length!==i.length)return!1;for(let a=0;a`:s.itemType.kind==="value"?"array":`array<${i}>`}return s.kind}const te=[pi,Qe,Kt,jt,Kr,fs,mi,G(Xt),ps,Hn,he];function ue(s,i){if(i.kind==="error")return null;if(s.kind==="array"){if(i.kind==="array"&&(i.N===0&&i.itemType.kind==="value"||!ue(s.itemType,i.itemType))&&(typeof s.N!="number"||s.N===i.N))return null}else{if(s.kind===i.kind)return null;if(s.kind==="value"){for(const a of te)if(!ue(a,i))return null}}return`Expected ${W(s)} but found ${W(i)} instead.`}function Se(s,i){return i.some(a=>a.kind===s.kind)}function Ie(s,i){return i.some(a=>a==="null"?s===null:a==="array"?Array.isArray(s):a==="object"?s&&!Array.isArray(s)&&typeof s=="object":a===typeof s)}function Ae(s,i){return s.kind==="array"&&i.kind==="array"?s.itemType.kind===i.itemType.kind&&typeof s.N=="number":s.kind===i.kind}const _e=.96422,He=.82521,Je=4/29,$e=6/29,ut=3*$e*$e,Rt=$e*$e*$e,Ot=Math.PI/180,mr=180/Math.PI;function Qt(s){return(s%=360)<0&&(s+=360),s}function gr([s,i,a,d]){let y,x;const w=Tn((.2225045*(s=or(s))+.7168786*(i=or(i))+.0606169*(a=or(a)))/1);s===i&&i===a?y=x=w:(y=Tn((.4360747*s+.3850649*i+.1430804*a)/_e),x=Tn((.0139322*s+.0971045*i+.7141733*a)/He));const b=116*w-16;return[b<0?0:b,500*(y-w),200*(w-x),d]}function or(s){return s<=.04045?s/12.92:Math.pow((s+.055)/1.055,2.4)}function Tn(s){return s>Rt?Math.pow(s,1/3):s/ut+Je}function rn([s,i,a,d]){let y=(s+16)/116,x=isNaN(i)?y:y+i/500,w=isNaN(a)?y:y-a/200;return y=1*Mr(y),x=_e*Mr(x),w=He*Mr(w),[rr(3.1338561*x-1.6168667*y-.4906146*w),rr(-.9787684*x+1.9161415*y+.033454*w),rr(.0719453*x-.2289914*y+1.4052427*w),d]}function rr(s){return(s=s<=.00304?12.92*s:1.055*Math.pow(s,1/2.4)-.055)<0?0:s>1?1:s}function Mr(s){return s>$e?s*s*s:ut*(s-Je)}function Yr(s){return parseInt(s.padEnd(2,s),16)/255}function Dn(s,i){return Bn(i?s/100:s,0,1)}function Bn(s,i,a){return Math.min(Math.max(i,s),a)}function ni(s){return!s.some(Number.isNaN)}const Ba={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 Ar{constructor(i,a,d,y=1,x=!0){this.r=i,this.g=a,this.b=d,this.a=y,x||(this.r*=y,this.g*=y,this.b*=y,y||this.overwriteGetter("rgb",[i,a,d,y]))}static parse(i){if(i instanceof Ar)return i;if(typeof i!="string")return;const a=function(d){if((d=d.toLowerCase().trim())==="transparent")return[0,0,0,0];const y=Ba[d];if(y){const[w,b,k]=y;return[w/255,b/255,k/255,1]}if(d.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(d)){const w=d.length<6?1:2;let b=1;return[Yr(d.slice(b,b+=w)),Yr(d.slice(b,b+=w)),Yr(d.slice(b,b+=w)),Yr(d.slice(b,b+w)||"ff")]}if(d.startsWith("rgb")){const w=d.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(w){const[b,k,P,D,L,j,q,K,Q,le,fe,De]=w,be=[D||" ",q||" ",le].join("");if(be===" "||be===" /"||be===",,"||be===",,,"){const Me=[P,j,Q].join(""),Ve=Me==="%%%"?100:Me===""?255:0;if(Ve){const et=[Bn(+k/Ve,0,1),Bn(+L/Ve,0,1),Bn(+K/Ve,0,1),fe?Dn(+fe,De):1];if(ni(et))return et}}return}}const x=d.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(x){const[w,b,k,P,D,L,j,q,K]=x,Q=[k||" ",D||" ",j].join("");if(Q===" "||Q===" /"||Q===",,"||Q===",,,"){const le=[+b,Bn(+P,0,100),Bn(+L,0,100),q?Dn(+q,K):1];if(ni(le))return function([fe,De,be,Me]){function Ve(et){const xt=(et+fe/30)%12,Nt=De*Math.min(be,1-be);return be-Nt*Math.max(-1,Math.min(xt-3,9-xt,1))}return fe=Qt(fe),De/=100,be/=100,[Ve(0),Ve(8),Ve(4),Me]}(le)}}}(i);return a?new Ar(...a,!1):void 0}get rgb(){const{r:i,g:a,b:d,a:y}=this,x=y||1/0;return this.overwriteGetter("rgb",[i/x,a/x,d/x,y])}get hcl(){return this.overwriteGetter("hcl",function(i){const[a,d,y,x]=gr(i),w=Math.sqrt(d*d+y*y);return[Math.round(1e4*w)?Qt(Math.atan2(y,d)*mr):NaN,w,a,x]}(this.rgb))}get lab(){return this.overwriteGetter("lab",gr(this.rgb))}overwriteGetter(i,a){return Object.defineProperty(this,i,{value:a}),a}toString(){const[i,a,d,y]=this.rgb;return`rgba(${[i,a,d].map(x=>Math.round(255*x)).join(",")},${y})`}}Ar.black=new Ar(0,0,0,1),Ar.white=new Ar(1,1,1,1),Ar.transparent=new Ar(0,0,0,0),Ar.red=new Ar(1,0,0,1);class Yh{constructor(i,a,d){this.sensitivity=i?a?"variant":"case":a?"accent":"base",this.locale=d,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(i,a){return this.collator.compare(i,a)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Xh{constructor(i,a,d,y,x){this.text=i,this.image=a,this.scale=d,this.fontStack=y,this.textColor=x}}class Mi{constructor(i){this.sections=i}static fromString(i){return new Mi([new Xh(i,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(i=>i.text.length!==0||i.image&&i.image.name.length!==0)}static factory(i){return i instanceof Mi?i:Mi.fromString(i)}toString(){return this.sections.length===0?"":this.sections.map(i=>i.text).join("")}}class Ai{constructor(i){this.values=i.slice()}static parse(i){if(i instanceof Ai)return i;if(typeof i=="number")return new Ai([i,i,i,i]);if(Array.isArray(i)&&!(i.length<1||i.length>4)){for(const a of i)if(typeof a!="number")return;switch(i.length){case 1:i=[i[0],i[0],i[0],i[0]];break;case 2:i=[i[0],i[1],i[0],i[1]];break;case 3:i=[i[0],i[1],i[2],i[1]]}return new Ai(i)}}toString(){return JSON.stringify(this.values)}}const P_=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Xi{constructor(i){this.values=i.slice()}static parse(i){if(i instanceof Xi)return i;if(Array.isArray(i)&&!(i.length<1)&&i.length%2==0){for(let a=0;a=0&&s<=255&&typeof i=="number"&&i>=0&&i<=255&&typeof a=="number"&&a>=0&&a<=255?d===void 0||typeof d=="number"&&d>=0&&d<=1?null:`Invalid rgba value [${[s,i,a,d].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof d=="number"?[s,i,a,d]:[s,i,a]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Jo(s){if(s===null||typeof s=="string"||typeof s=="boolean"||typeof s=="number"||s instanceof Ar||s instanceof Yh||s instanceof Mi||s instanceof Ai||s instanceof Xi||s instanceof Di)return!0;if(Array.isArray(s)){for(const i of s)if(!Jo(i))return!1;return!0}if(typeof s=="object"){for(const i in s)if(!Jo(s[i]))return!1;return!0}return!1}function En(s){if(s===null)return pi;if(typeof s=="string")return Kt;if(typeof s=="boolean")return jt;if(typeof s=="number")return Qe;if(s instanceof Ar)return Kr;if(s instanceof Yh)return Yi;if(s instanceof Mi)return fs;if(s instanceof Ai)return ps;if(s instanceof Xi)return he;if(s instanceof Di)return Hn;if(Array.isArray(s)){const i=s.length;let a;for(const d of s){const y=En(d);if(a){if(a===y)continue;a=Xt;break}a=y}return G(a||Xt,i)}return mi}function ql(s){const i=typeof s;return s===null?"":i==="string"||i==="number"||i==="boolean"?String(s):s instanceof Ar||s instanceof Mi||s instanceof Ai||s instanceof Xi||s instanceof Di?s.toString():JSON.stringify(s)}class ms{constructor(i,a){this.type=i,this.value=a}static parse(i,a){if(i.length!==2)return a.error(`'literal' expression requires exactly one argument, but found ${i.length-1} instead.`);if(!Jo(i[1]))return a.error("invalid value");const d=i[1];let y=En(d);const x=a.expectedType;return y.kind!=="array"||y.N!==0||!x||x.kind!=="array"||typeof x.N=="number"&&x.N!==0||(y=x),new ms(y,d)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class xn{constructor(i){this.name="ExpressionEvaluationError",this.message=i}toJSON(){return this.message}}const ec={string:Kt,number:Qe,boolean:jt,object:mi};class gs{constructor(i,a){this.type=i,this.args=a}static parse(i,a){if(i.length<2)return a.error("Expected at least one argument.");let d,y=1;const x=i[0];if(x==="array"){let b,k;if(i.length>2){const P=i[1];if(typeof P!="string"||!(P in ec)||P==="object")return a.error('The item type argument of "array" must be one of string, number, boolean',1);b=ec[P],y++}else b=Xt;if(i.length>3){if(i[2]!==null&&(typeof i[2]!="number"||i[2]<0||i[2]!==Math.floor(i[2])))return a.error('The length argument to "array" must be a positive integer literal',2);k=i[2],y++}d=G(b,k)}else{if(!ec[x])throw new Error(`Types doesn't contain name = ${x}`);d=ec[x]}const w=[];for(;yi.outputDefined())}}const Kh={"to-boolean":jt,"to-color":Kr,"to-number":Qe,"to-string":Kt};class ys{constructor(i,a){this.type=i,this.args=a}static parse(i,a){if(i.length<2)return a.error("Expected at least one argument.");const d=i[0];if(!Kh[d])throw new Error(`Can't parse ${d} as it is not part of the known types`);if((d==="to-boolean"||d==="to-string")&&i.length!==2)return a.error("Expected one argument.");const y=Kh[d],x=[];for(let w=1;w4?`Invalid rbga value ${JSON.stringify(a)}: expected an array containing either three or four numeric values.`:Na(a[0],a[1],a[2],a[3]),!d))return new Ar(a[0]/255,a[1]/255,a[2]/255,a[3])}throw new xn(d||`Could not parse color from value '${typeof a=="string"?a:JSON.stringify(a)}'`)}case"padding":{let a;for(const d of this.args){a=d.evaluate(i);const y=Ai.parse(a);if(y)return y}throw new xn(`Could not parse padding from value '${typeof a=="string"?a:JSON.stringify(a)}'`)}case"variableAnchorOffsetCollection":{let a;for(const d of this.args){a=d.evaluate(i);const y=Xi.parse(a);if(y)return y}throw new xn(`Could not parse variableAnchorOffsetCollection from value '${typeof a=="string"?a:JSON.stringify(a)}'`)}case"number":{let a=null;for(const d of this.args){if(a=d.evaluate(i),a===null)return 0;const y=Number(a);if(!isNaN(y))return y}throw new xn(`Could not convert ${JSON.stringify(a)} to number.`)}case"formatted":return Mi.fromString(ql(this.args[0].evaluate(i)));case"resolvedImage":return Di.fromString(ql(this.args[0].evaluate(i)));default:return ql(this.args[0].evaluate(i))}}eachChild(i){this.args.forEach(i)}outputDefined(){return this.args.every(i=>i.outputDefined())}}const M_=["Unknown","Point","LineString","Polygon"];class tc{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"?M_[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(i){let a=this._parseColorCache[i];return a||(a=this._parseColorCache[i]=Ar.parse(i)),a}}class Qo{constructor(i,a,d=[],y,x=new vn,w=[]){this.registry=i,this.path=d,this.key=d.map(b=>`[${b}]`).join(""),this.scope=x,this.errors=w,this.expectedType=y,this._isConstant=a}parse(i,a,d,y,x={}){return a?this.concat(a,d,y)._parse(i,x):this._parse(i,x)}_parse(i,a){function d(y,x,w){return w==="assert"?new gs(x,[y]):w==="coerce"?new ys(x,[y]):y}if(i!==null&&typeof i!="string"&&typeof i!="boolean"&&typeof i!="number"||(i=["literal",i]),Array.isArray(i)){if(i.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const y=i[0];if(typeof y!="string")return this.error(`Expression name must be a string, but found ${typeof y} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const x=this.registry[y];if(x){let w=x.parse(i,this);if(!w)return null;if(this.expectedType){const b=this.expectedType,k=w.type;if(b.kind!=="string"&&b.kind!=="number"&&b.kind!=="boolean"&&b.kind!=="object"&&b.kind!=="array"||k.kind!=="value")if(b.kind!=="color"&&b.kind!=="formatted"&&b.kind!=="resolvedImage"||k.kind!=="value"&&k.kind!=="string")if(b.kind!=="padding"||k.kind!=="value"&&k.kind!=="number"&&k.kind!=="array")if(b.kind!=="variableAnchorOffsetCollection"||k.kind!=="value"&&k.kind!=="array"){if(this.checkSubtype(b,k))return null}else w=d(w,b,a.typeAnnotation||"coerce");else w=d(w,b,a.typeAnnotation||"coerce");else w=d(w,b,a.typeAnnotation||"coerce");else w=d(w,b,a.typeAnnotation||"assert")}if(!(w instanceof ms)&&w.type.kind!=="resolvedImage"&&this._isConstant(w)){const b=new tc;try{w=new ms(w.type,w.evaluate(b))}catch(k){return this.error(k.message),null}}return w}return this.error(`Unknown expression "${y}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(i===void 0?"'undefined' value invalid. Use null instead.":typeof i=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof i} instead.`)}concat(i,a,d){const y=typeof i=="number"?this.path.concat(i):this.path,x=d?this.scope.concat(d):this.scope;return new Qo(this.registry,this._isConstant,y,a||null,x,this.errors)}error(i,...a){const d=`${this.key}${a.map(y=>`[${y}]`).join("")}`;this.errors.push(new _n(d,i))}checkSubtype(i,a){const d=ue(i,a);return d&&this.error(d),d}}class Po{constructor(i,a){this.type=a.type,this.bindings=[].concat(i),this.result=a}evaluate(i){return this.result.evaluate(i)}eachChild(i){for(const a of this.bindings)i(a[1]);i(this.result)}static parse(i,a){if(i.length<4)return a.error(`Expected at least 3 arguments, but found ${i.length-1} instead.`);const d=[];for(let x=1;x=d.length)throw new xn(`Array index out of bounds: ${a} > ${d.length-1}.`);if(a!==Math.floor(a))throw new xn(`Array index must be an integer, but found ${a} instead.`);return d[a]}eachChild(i){i(this.index),i(this.input)}outputDefined(){return!1}}class Qh{constructor(i,a){this.type=jt,this.needle=i,this.haystack=a}static parse(i,a){if(i.length!==3)return a.error(`Expected 2 arguments, but found ${i.length-1} instead.`);const d=a.parse(i[1],1,Xt),y=a.parse(i[2],2,Xt);return d&&y?Se(d.type,[jt,Kt,Qe,pi,Xt])?new Qh(d,y):a.error(`Expected first argument to be of type boolean, string, number or null, but found ${W(d.type)} instead`):null}evaluate(i){const a=this.needle.evaluate(i),d=this.haystack.evaluate(i);if(!d)return!1;if(!Ie(a,["boolean","string","number","null"]))throw new xn(`Expected first argument to be of type boolean, string, number or null, but found ${W(En(a))} instead.`);if(!Ie(d,["string","array"]))throw new xn(`Expected second argument to be of type array or string, but found ${W(En(d))} instead.`);return d.indexOf(a)>=0}eachChild(i){i(this.needle),i(this.haystack)}outputDefined(){return!0}}class $a{constructor(i,a,d){this.type=Qe,this.needle=i,this.haystack=a,this.fromIndex=d}static parse(i,a){if(i.length<=2||i.length>=5)return a.error(`Expected 3 or 4 arguments, but found ${i.length-1} instead.`);const d=a.parse(i[1],1,Xt),y=a.parse(i[2],2,Xt);if(!d||!y)return null;if(!Se(d.type,[jt,Kt,Qe,pi,Xt]))return a.error(`Expected first argument to be of type boolean, string, number or null, but found ${W(d.type)} instead`);if(i.length===4){const x=a.parse(i[3],3,Qe);return x?new $a(d,y,x):null}return new $a(d,y)}evaluate(i){const a=this.needle.evaluate(i),d=this.haystack.evaluate(i);if(!Ie(a,["boolean","string","number","null"]))throw new xn(`Expected first argument to be of type boolean, string, number or null, but found ${W(En(a))} instead.`);let y;if(this.fromIndex&&(y=this.fromIndex.evaluate(i)),Ie(d,["string"])){const x=d.indexOf(a,y);return x===-1?-1:[...d.slice(0,x)].length}if(Ie(d,["array"]))return d.indexOf(a,y);throw new xn(`Expected second argument to be of type array or string, but found ${W(En(d))} instead.`)}eachChild(i){i(this.needle),i(this.haystack),this.fromIndex&&i(this.fromIndex)}outputDefined(){return!1}}class ed{constructor(i,a,d,y,x,w){this.inputType=i,this.type=a,this.input=d,this.cases=y,this.outputs=x,this.otherwise=w}static parse(i,a){if(i.length<5)return a.error(`Expected at least 4 arguments, but found only ${i.length-1}.`);if(i.length%2!=1)return a.error("Expected an even number of arguments.");let d,y;a.expectedType&&a.expectedType.kind!=="value"&&(y=a.expectedType);const x={},w=[];for(let P=2;PNumber.MAX_SAFE_INTEGER)return j.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof K=="number"&&Math.floor(K)!==K)return j.error("Numeric branch labels must be integer values.");if(d){if(j.checkSubtype(d,En(K)))return null}else d=En(K);if(x[String(K)]!==void 0)return j.error("Branch labels must be unique.");x[String(K)]=w.length}const q=a.parse(L,P,y);if(!q)return null;y=y||q.type,w.push(q)}const b=a.parse(i[1],1,Xt);if(!b)return null;const k=a.parse(i[i.length-1],i.length-1,y);return k?b.type.kind!=="value"&&a.concat(1).checkSubtype(d,b.type)?null:new ed(d,y,b,x,w,k):null}evaluate(i){const a=this.input.evaluate(i);return(En(a)===this.inputType&&this.outputs[this.cases[a]]||this.otherwise).evaluate(i)}eachChild(i){i(this.input),this.outputs.forEach(i),i(this.otherwise)}outputDefined(){return this.outputs.every(i=>i.outputDefined())&&this.otherwise.outputDefined()}}class rc{constructor(i,a,d){this.type=i,this.branches=a,this.otherwise=d}static parse(i,a){if(i.length<4)return a.error(`Expected at least 3 arguments, but found only ${i.length-1}.`);if(i.length%2!=0)return a.error("Expected an odd number of arguments.");let d;a.expectedType&&a.expectedType.kind!=="value"&&(d=a.expectedType);const y=[];for(let w=1;wa.outputDefined())&&this.otherwise.outputDefined()}}class Yl{constructor(i,a,d,y){this.type=i,this.input=a,this.beginIndex=d,this.endIndex=y}static parse(i,a){if(i.length<=2||i.length>=5)return a.error(`Expected 3 or 4 arguments, but found ${i.length-1} instead.`);const d=a.parse(i[1],1,Xt),y=a.parse(i[2],2,Qe);if(!d||!y)return null;if(!Se(d.type,[G(Xt),Kt,Xt]))return a.error(`Expected first argument to be of type array or string, but found ${W(d.type)} instead`);if(i.length===4){const x=a.parse(i[3],3,Qe);return x?new Yl(d.type,d,y,x):null}return new Yl(d.type,d,y)}evaluate(i){const a=this.input.evaluate(i),d=this.beginIndex.evaluate(i);let y;if(this.endIndex&&(y=this.endIndex.evaluate(i)),Ie(a,["string"]))return[...a].slice(d,y).join("");if(Ie(a,["array"]))return a.slice(d,y);throw new xn(`Expected first argument to be of type array or string, but found ${W(En(a))} instead.`)}eachChild(i){i(this.input),i(this.beginIndex),this.endIndex&&i(this.endIndex)}outputDefined(){return!1}}function nc(s,i){const a=s.length-1;let d,y,x=0,w=a,b=0;for(;x<=w;)if(b=Math.floor((x+w)/2),d=s[b],y=s[b+1],d<=i){if(b===a||ii))throw new xn("Input is not a number.");w=b-1}return 0}class ja{constructor(i,a,d){this.type=i,this.input=a,this.labels=[],this.outputs=[];for(const[y,x]of d)this.labels.push(y),this.outputs.push(x)}static parse(i,a){if(i.length-1<4)return a.error(`Expected at least 4 arguments, but found only ${i.length-1}.`);if((i.length-1)%2!=0)return a.error("Expected an even number of arguments.");const d=a.parse(i[1],1,Qe);if(!d)return null;const y=[];let x=null;a.expectedType&&a.expectedType.kind!=="value"&&(x=a.expectedType);for(let w=1;w=b)return a.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',P);const L=a.parse(k,D,x);if(!L)return null;x=x||L.type,y.push([b,L])}return new ja(x,d,y)}evaluate(i){const a=this.labels,d=this.outputs;if(a.length===1)return d[0].evaluate(i);const y=this.input.evaluate(i);if(y<=a[0])return d[0].evaluate(i);const x=a.length;return y>=a[x-1]?d[x-1].evaluate(i):d[nc(a,y)].evaluate(i)}eachChild(i){i(this.input);for(const a of this.outputs)i(a)}outputDefined(){return this.outputs.every(i=>i.outputDefined())}}function Mp(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var A_=Ap;function Ap(s,i,a,d){this.cx=3*s,this.bx=3*(a-s)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*i,this.by=3*(d-i)-this.cy,this.ay=1-this.cy-this.by,this.p1x=s,this.p1y=i,this.p2x=a,this.p2y=d}Ap.prototype={sampleCurveX:function(s){return((this.ax*s+this.bx)*s+this.cx)*s},sampleCurveY:function(s){return((this.ay*s+this.by)*s+this.cy)*s},sampleCurveDerivativeX:function(s){return(3*this.ax*s+2*this.bx)*s+this.cx},solveCurveX:function(s,i){if(i===void 0&&(i=1e-6),s<0)return 0;if(s>1)return 1;for(var a=s,d=0;d<8;d++){var y=this.sampleCurveX(a)-s;if(Math.abs(y)y?w=a:b=a,a=.5*(b-w)+w;return a},solve:function(s,i){return this.sampleCurveY(this.solveCurveX(s,i))}};var D_=Mp(A_);function ea(s,i,a){return s+a*(i-s)}function Xl(s,i,a){return s.map((d,y)=>ea(d,i[y],a))}const gi={number:ea,color:function(s,i,a,d="rgb"){switch(d){case"rgb":{const[y,x,w,b]=Xl(s.rgb,i.rgb,a);return new Ar(y,x,w,b,!1)}case"hcl":{const[y,x,w,b]=s.hcl,[k,P,D,L]=i.hcl;let j,q;if(isNaN(y)||isNaN(k))isNaN(y)?isNaN(k)?j=NaN:(j=k,w!==1&&w!==0||(q=P)):(j=y,D!==1&&D!==0||(q=x));else{let De=k-y;k>y&&De>180?De-=360:k180&&(De+=360),j=y+a*De}const[K,Q,le,fe]=function([De,be,Me,Ve]){return De=isNaN(De)?0:De*Ot,rn([Me,Math.cos(De)*be,Math.sin(De)*be,Ve])}([j,q??ea(x,P,a),ea(w,D,a),ea(b,L,a)]);return new Ar(K,Q,le,fe,!1)}case"lab":{const[y,x,w,b]=rn(Xl(s.lab,i.lab,a));return new Ar(y,x,w,b,!1)}}},array:Xl,padding:function(s,i,a){return new Ai(Xl(s.values,i.values,a))},variableAnchorOffsetCollection:function(s,i,a){const d=s.values,y=i.values;if(d.length!==y.length)throw new xn(`Cannot interpolate values of different length. from: ${s.toString()}, to: ${i.toString()}`);const x=[];for(let w=0;wtypeof D!="number"||D<0||D>1))return a.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);y={name:"cubic-bezier",controlPoints:P}}}if(i.length-1<4)return a.error(`Expected at least 4 arguments, but found only ${i.length-1}.`);if((i.length-1)%2!=0)return a.error("Expected an even number of arguments.");if(x=a.parse(x,2,Qe),!x)return null;const b=[];let k=null;d==="interpolate-hcl"||d==="interpolate-lab"?k=Kr:a.expectedType&&a.expectedType.kind!=="value"&&(k=a.expectedType);for(let P=0;P=D)return a.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',j);const K=a.parse(L,q,k);if(!K)return null;k=k||K.type,b.push([D,K])}return Ae(k,Qe)||Ae(k,Kr)||Ae(k,ps)||Ae(k,he)||Ae(k,G(Qe))?new yi(k,d,y,x,b):a.error(`Type ${W(k)} is not interpolatable.`)}evaluate(i){const a=this.labels,d=this.outputs;if(a.length===1)return d[0].evaluate(i);const y=this.input.evaluate(i);if(y<=a[0])return d[0].evaluate(i);const x=a.length;if(y>=a[x-1])return d[x-1].evaluate(i);const w=nc(a,y),b=yi.interpolationFactor(this.interpolation,y,a[w],a[w+1]),k=d[w].evaluate(i),P=d[w+1].evaluate(i);switch(this.operator){case"interpolate":return gi[this.type.kind](k,P,b);case"interpolate-hcl":return gi.color(k,P,b,"hcl");case"interpolate-lab":return gi.color(k,P,b,"lab")}}eachChild(i){i(this.input);for(const a of this.outputs)i(a)}outputDefined(){return this.outputs.every(i=>i.outputDefined())}}function ic(s,i,a,d){const y=d-a,x=s-a;return y===0?0:i===1?x/y:(Math.pow(i,x)-1)/(Math.pow(i,y)-1)}class sc{constructor(i,a){this.type=i,this.args=a}static parse(i,a){if(i.length<2)return a.error("Expectected at least one argument.");let d=null;const y=a.expectedType;y&&y.kind!=="value"&&(d=y);const x=[];for(const b of i.slice(1)){const k=a.parse(b,1+x.length,d,void 0,{typeAnnotation:"omit"});if(!k)return null;d=d||k.type,x.push(k)}if(!d)throw new Error("No output type");const w=y&&x.some(b=>ue(y,b.type));return new sc(w?Xt:d,x)}evaluate(i){let a,d=null,y=0;for(const x of this.args)if(y++,d=x.evaluate(i),d&&d instanceof Di&&!d.available&&(a||(a=d.name),d=null,y===this.args.length&&(d=a)),d!==null)break;return d}eachChild(i){this.args.forEach(i)}outputDefined(){return this.args.every(i=>i.outputDefined())}}function oc(s,i){return s==="=="||s==="!="?i.kind==="boolean"||i.kind==="string"||i.kind==="number"||i.kind==="null"||i.kind==="value":i.kind==="string"||i.kind==="number"||i.kind==="value"}function Dp(s,i,a,d){return d.compare(i,a)===0}function Ua(s,i,a){const d=s!=="=="&&s!=="!=";return class vP{constructor(x,w,b){this.type=jt,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 k=w.parse(x[1],1,Xt);if(!k)return null;if(!oc(b,k.type))return w.concat(1).error(`"${b}" comparisons are not supported for type '${W(k.type)}'.`);let P=w.parse(x[2],2,Xt);if(!P)return null;if(!oc(b,P.type))return w.concat(2).error(`"${b}" comparisons are not supported for type '${W(P.type)}'.`);if(k.type.kind!==P.type.kind&&k.type.kind!=="value"&&P.type.kind!=="value")return w.error(`Cannot compare types '${W(k.type)}' and '${W(P.type)}'.`);d&&(k.type.kind==="value"&&P.type.kind!=="value"?k=new gs(P.type,[k]):k.type.kind!=="value"&&P.type.kind==="value"&&(P=new gs(k.type,[P])));let D=null;if(x.length===4){if(k.type.kind!=="string"&&P.type.kind!=="string"&&k.type.kind!=="value"&&P.type.kind!=="value")return w.error("Cannot use collator to compare non-string types.");if(D=w.parse(x[3],3,Yi),!D)return null}return new vP(k,P,D)}evaluate(x){const w=this.lhs.evaluate(x),b=this.rhs.evaluate(x);if(d&&this.hasUntypedArgument){const k=En(w),P=En(b);if(k.kind!==P.kind||k.kind!=="string"&&k.kind!=="number")throw new xn(`Expected arguments for "${s}" to be (string, string) or (number, number), but found (${k.kind}, ${P.kind}) instead.`)}if(this.collator&&!d&&this.hasUntypedArgument){const k=En(w),P=En(b);if(k.kind!=="string"||P.kind!=="string")return i(x,w,b)}return this.collator?a(x,w,b,this.collator.evaluate(x)):i(x,w,b)}eachChild(x){x(this.lhs),x(this.rhs),this.collator&&x(this.collator)}outputDefined(){return!0}}}const z_=Ua("==",function(s,i,a){return i===a},Dp),zp=Ua("!=",function(s,i,a){return i!==a},function(s,i,a,d){return!Dp(0,i,a,d)}),Rp=Ua("<",function(s,i,a){return i",function(s,i,a){return i>a},function(s,i,a,d){return d.compare(i,a)>0}),L_=Ua("<=",function(s,i,a){return i<=a},function(s,i,a,d){return d.compare(i,a)<=0}),Lp=Ua(">=",function(s,i,a){return i>=a},function(s,i,a,d){return d.compare(i,a)>=0});class Kl{constructor(i,a,d){this.type=Yi,this.locale=d,this.caseSensitive=i,this.diacriticSensitive=a}static parse(i,a){if(i.length!==2)return a.error("Expected one argument.");const d=i[1];if(typeof d!="object"||Array.isArray(d))return a.error("Collator options argument must be an object.");const y=a.parse(d["case-sensitive"]!==void 0&&d["case-sensitive"],1,jt);if(!y)return null;const x=a.parse(d["diacritic-sensitive"]!==void 0&&d["diacritic-sensitive"],1,jt);if(!x)return null;let w=null;return d.locale&&(w=a.parse(d.locale,1,Kt),!w)?null:new Kl(y,x,w)}evaluate(i){return new Yh(this.caseSensitive.evaluate(i),this.diacriticSensitive.evaluate(i),this.locale?this.locale.evaluate(i):null)}eachChild(i){i(this.caseSensitive),i(this.diacriticSensitive),this.locale&&i(this.locale)}outputDefined(){return!1}}class td{constructor(i,a,d,y,x){this.type=Kt,this.number=i,this.locale=a,this.currency=d,this.minFractionDigits=y,this.maxFractionDigits=x}static parse(i,a){if(i.length!==3)return a.error("Expected two arguments.");const d=a.parse(i[1],1,Qe);if(!d)return null;const y=i[2];if(typeof y!="object"||Array.isArray(y))return a.error("NumberFormat options argument must be an object.");let x=null;if(y.locale&&(x=a.parse(y.locale,1,Kt),!x))return null;let w=null;if(y.currency&&(w=a.parse(y.currency,1,Kt),!w))return null;let b=null;if(y["min-fraction-digits"]&&(b=a.parse(y["min-fraction-digits"],1,Qe),!b))return null;let k=null;return y["max-fraction-digits"]&&(k=a.parse(y["max-fraction-digits"],1,Qe),!k)?null:new td(d,x,w,b,k)}evaluate(i){return new Intl.NumberFormat(this.locale?this.locale.evaluate(i):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(i):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(i):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(i):void 0}).format(this.number.evaluate(i))}eachChild(i){i(this.number),this.locale&&i(this.locale),this.currency&&i(this.currency),this.minFractionDigits&&i(this.minFractionDigits),this.maxFractionDigits&&i(this.maxFractionDigits)}outputDefined(){return!1}}class ac{constructor(i){this.type=fs,this.sections=i}static parse(i,a){if(i.length<2)return a.error("Expected at least one argument.");const d=i[1];if(!Array.isArray(d)&&typeof d=="object")return a.error("First argument must be an image or text section.");const y=[];let x=!1;for(let w=1;w<=i.length-1;++w){const b=i[w];if(x&&typeof b=="object"&&!Array.isArray(b)){x=!1;let k=null;if(b["font-scale"]&&(k=a.parse(b["font-scale"],1,Qe),!k))return null;let P=null;if(b["text-font"]&&(P=a.parse(b["text-font"],1,G(Kt)),!P))return null;let D=null;if(b["text-color"]&&(D=a.parse(b["text-color"],1,Kr),!D))return null;const L=y[y.length-1];L.scale=k,L.font=P,L.textColor=D}else{const k=a.parse(i[w],1,Xt);if(!k)return null;const P=k.type.kind;if(P!=="string"&&P!=="value"&&P!=="null"&&P!=="resolvedImage")return a.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");x=!0,y.push({content:k,scale:null,font:null,textColor:null})}}return new ac(y)}evaluate(i){return new Mi(this.sections.map(a=>{const d=a.content.evaluate(i);return En(d)===Hn?new Xh("",d,null,null,null):new Xh(ql(d),null,a.scale?a.scale.evaluate(i):null,a.font?a.font.evaluate(i).join(","):null,a.textColor?a.textColor.evaluate(i):null)}))}eachChild(i){for(const a of this.sections)i(a.content),a.scale&&i(a.scale),a.font&&i(a.font),a.textColor&&i(a.textColor)}outputDefined(){return!1}}class rd{constructor(i){this.type=Hn,this.input=i}static parse(i,a){if(i.length!==2)return a.error("Expected two arguments.");const d=a.parse(i[1],1,Kt);return d?new rd(d):a.error("No image name provided.")}evaluate(i){const a=this.input.evaluate(i),d=Di.fromString(a);return d&&i.availableImages&&(d.available=i.availableImages.indexOf(a)>-1),d}eachChild(i){i(this.input)}outputDefined(){return!1}}class nd{constructor(i){this.type=Qe,this.input=i}static parse(i,a){if(i.length!==2)return a.error(`Expected 1 argument, but found ${i.length-1} instead.`);const d=a.parse(i[1],1);return d?d.type.kind!=="array"&&d.type.kind!=="string"&&d.type.kind!=="value"?a.error(`Expected argument of type string or array, but found ${W(d.type)} instead.`):new nd(d):null}evaluate(i){const a=this.input.evaluate(i);if(typeof a=="string")return[...a].length;if(Array.isArray(a))return a.length;throw new xn(`Expected value to be of type string or array, but found ${W(En(a))} instead.`)}eachChild(i){i(this.input)}outputDefined(){return!1}}const Us=8192;function O_(s,i){const a=(180+s[0])/360,d=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+s[1]*Math.PI/360)))/360,y=Math.pow(2,i.z);return[Math.round(a*y*Us),Math.round(d*y*Us)]}function id(s,i){const a=Math.pow(2,i.z);return[(y=(s[0]/Us+i.x)/a,360*y-180),(d=(s[1]/Us+i.y)/a,360/Math.PI*Math.atan(Math.exp((180-360*d)*Math.PI/180))-90)];var d,y}function ta(s,i){s[0]=Math.min(s[0],i[0]),s[1]=Math.min(s[1],i[1]),s[2]=Math.max(s[2],i[0]),s[3]=Math.max(s[3],i[1])}function Mo(s,i){return!(s[0]<=i[0]||s[2]>=i[2]||s[1]<=i[1]||s[3]>=i[3])}function Er(s,i,a){const d=s[0]-i[0],y=s[1]-i[1],x=s[0]-a[0],w=s[1]-a[1];return d*w-x*y==0&&d*x<=0&&y*w<=0}function lc(s,i,a,d){return(y=[d[0]-a[0],d[1]-a[1]])[0]*(x=[i[0]-s[0],i[1]-s[1]])[1]-y[1]*x[0]!=0&&!(!Fp(s,i,a,d)||!Fp(a,d,s,i));var y,x}function F_(s,i,a){for(const d of a)for(let y=0;y(y=s)[1]!=(w=b[k+1])[1]>y[1]&&y[0]<(w[0]-x[0])*(y[1]-x[1])/(w[1]-x[1])+x[0]&&(d=!d)}var y,x,w;return d}function B_(s,i){for(const a of i)if(Va(s,a))return!0;return!1}function Op(s,i){for(const a of s)if(!Va(a,i))return!1;for(let a=0;a0&&b<0||w<0&&b>0}function sd(s,i,a){const d=[];for(let y=0;ya[2]){const y=.5*d;let x=s[0]-a[0]>y?-d:a[0]-s[0]>y?d:0;x===0&&(x=s[0]-a[2]>y?-d:a[2]-s[0]>y?d:0),s[0]+=x}ta(i,s)}function $p(s,i,a,d){const y=Math.pow(2,d.z)*Us,x=[d.x*Us,d.y*Us],w=[];for(const b of s)for(const k of b){const P=[k.x+x[0],k.y+x[1]];Np(P,i,a,y),w.push(P)}return w}function jp(s,i,a,d){const y=Math.pow(2,d.z)*Us,x=[d.x*Us,d.y*Us],w=[];for(const k of s){const P=[];for(const D of k){const L=[D.x+x[0],D.y+x[1]];ta(i,L),P.push(L)}w.push(P)}if(i[2]-i[0]<=y/2){(b=i)[0]=b[1]=1/0,b[2]=b[3]=-1/0;for(const k of w)for(const P of k)Np(P,i,a,y)}var b;return w}class ra{constructor(i,a){this.type=jt,this.geojson=i,this.geometries=a}static parse(i,a){if(i.length!==2)return a.error(`'within' expression requires exactly one argument, but found ${i.length-1} instead.`);if(Jo(i[1])){const d=i[1];if(d.type==="FeatureCollection"){const y=[];for(const x of d.features){const{type:w,coordinates:b}=x.geometry;w==="Polygon"&&y.push(b),w==="MultiPolygon"&&y.push(...b)}if(y.length)return new ra(d,{type:"MultiPolygon",coordinates:y})}else if(d.type==="Feature"){const y=d.geometry.type;if(y==="Polygon"||y==="MultiPolygon")return new ra(d,d.geometry)}else if(d.type==="Polygon"||d.type==="MultiPolygon")return new ra(d,d)}return a.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(i){if(i.geometry()!=null&&i.canonicalID()!=null){if(i.geometryType()==="Point")return function(a,d){const y=[1/0,1/0,-1/0,-1/0],x=[1/0,1/0,-1/0,-1/0],w=a.canonicalID();if(d.type==="Polygon"){const b=sd(d.coordinates,x,w),k=$p(a.geometry(),y,x,w);if(!Mo(y,x))return!1;for(const P of k)if(!Va(P,b))return!1}if(d.type==="MultiPolygon"){const b=Bp(d.coordinates,x,w),k=$p(a.geometry(),y,x,w);if(!Mo(y,x))return!1;for(const P of k)if(!B_(P,b))return!1}return!0}(i,this.geometries);if(i.geometryType()==="LineString")return function(a,d){const y=[1/0,1/0,-1/0,-1/0],x=[1/0,1/0,-1/0,-1/0],w=a.canonicalID();if(d.type==="Polygon"){const b=sd(d.coordinates,x,w),k=jp(a.geometry(),y,x,w);if(!Mo(y,x))return!1;for(const P of k)if(!Op(P,b))return!1}if(d.type==="MultiPolygon"){const b=Bp(d.coordinates,x,w),k=jp(a.geometry(),y,x,w);if(!Mo(y,x))return!1;for(const P of k)if(!N_(P,b))return!1}return!0}(i,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let Up=class{constructor(s=[],i=(a,d)=>ad?1:0){if(this.data=s,this.length=this.data.length,this.compare=i,this.length>0)for(let a=(this.length>>1)-1;a>=0;a--)this._down(a)}push(s){this.data.push(s),this._up(this.length++)}pop(){if(this.length===0)return;const s=this.data[0],i=this.data.pop();return--this.length>0&&(this.data[0]=i,this._down(0)),s}peek(){return this.data[0]}_up(s){const{data:i,compare:a}=this,d=i[s];for(;s>0;){const y=s-1>>1,x=i[y];if(a(d,x)>=0)break;i[s]=x,s=y}i[s]=d}_down(s){const{data:i,compare:a}=this,d=this.length>>1,y=i[s];for(;s=0)break;i[s]=i[x],s=x}i[s]=y}};function $_(s,i,a,d,y){Vp(s,i,a,d||s.length-1,y||j_)}function Vp(s,i,a,d,y){for(;d>a;){if(d-a>600){var x=d-a+1,w=i-a+1,b=Math.log(x),k=.5*Math.exp(2*b/3),P=.5*Math.sqrt(b*k*(x-k)/x)*(w-x/2<0?-1:1);Vp(s,i,Math.max(a,Math.floor(i-w*k/x+P)),Math.min(d,Math.floor(i+(x-w)*k/x+P)),y)}var D=s[i],L=a,j=d;for(Jl(s,a,i),y(s[d],D)>0&&Jl(s,a,d);L0;)j--}y(s[a],D)===0?Jl(s,a,j):Jl(s,++j,d),j<=i&&(a=j+1),i<=j&&(d=j-1)}}function Jl(s,i,a){var d=s[i];s[i]=s[a],s[a]=d}function j_(s,i){return si?1:0}function uc(s,i){if(s.length<=1)return[s];const a=[];let d,y;for(const x of s){const w=V_(x);w!==0&&(x.area=Math.abs(w),y===void 0&&(y=w<0),y===w<0?(d&&a.push(d),d=[x]):d.push(x))}if(d&&a.push(d),i>1)for(let x=0;x1?(P=i[k+1][0],D=i[k+1][1]):q>0&&(P+=L/this.kx*q,D+=j/this.ky*q)),L=this.wrap(a[0]-P)*this.kx,j=(a[1]-D)*this.ky;const K=L*L+j*j;K180;)i-=360;return i}}function Zp(s,i){return i[0]-s[0]}function cc(s){return s[1]-s[0]+1}function ao(s,i){return s[1]>=s[0]&&s[1]s[1])return[null,null];const a=cc(s);if(i){if(a===2)return[s,null];const y=Math.floor(a/2);return[[s[0],s[0]+y],[s[0]+y,s[1]]]}if(a===1)return[s,null];const d=Math.floor(a/2)-1;return[[s[0],s[0]+d],[s[0]+d+1,s[1]]]}function ld(s,i){if(!ao(i,s.length))return[1/0,1/0,-1/0,-1/0];const a=[1/0,1/0,-1/0,-1/0];for(let d=i[0];d<=i[1];++d)ta(a,s[d]);return a}function ud(s){const i=[1/0,1/0,-1/0,-1/0];for(const a of s)for(const d of a)ta(i,d);return i}function hc(s){return s[0]!==-1/0&&s[1]!==-1/0&&s[2]!==1/0&&s[3]!==1/0}function cd(s,i,a){if(!hc(s)||!hc(i))return NaN;let d=0,y=0;return s[2]i[2]&&(d=s[0]-i[2]),s[1]>i[3]&&(y=s[1]-i[3]),s[3]=d)return d;if(Mo(y,x)){if(dc(s,i))return 0}else if(dc(i,s))return 0;let w=1/0;for(const b of s)for(let k=0,P=b.length,D=P-1;k0;){const k=w.pop();if(k[0]>=x)continue;const P=k[1],D=i?50:100;if(cc(P)<=D){if(!ao(P,s.length))return NaN;if(i){const L=ir(s,P,a,d);if(isNaN(L)||L===0)return L;x=Math.min(x,L)}else for(let L=P[0];L<=P[1];++L){const j=W_(s[L],a,d);if(x=Math.min(x,j),x===0)return 0}}else{const L=ad(P,i);Rr(w,x,d,s,b,L[0]),Rr(w,x,d,s,b,L[1])}}return x}function eu(s,i,a,d,y,x=1/0){let w=Math.min(x,y.distance(s[0],a[0]));if(w===0)return w;const b=new Up([[0,[0,s.length-1],[0,a.length-1]]],Zp);for(;b.length>0;){const k=b.pop();if(k[0]>=w)continue;const P=k[1],D=k[2],L=i?50:100,j=d?50:100;if(cc(P)<=L&&cc(D)<=j){if(!ao(P,s.length)&&ao(D,a.length))return NaN;let q;if(i&&d)q=H_(s,P,a,D,y),w=Math.min(w,q);else if(i&&!d){const K=s.slice(P[0],P[1]+1);for(let Q=D[0];Q<=D[1];++Q)if(q=na(a[Q],K,y),w=Math.min(w,q),w===0)return w}else if(!i&&d){const K=a.slice(D[0],D[1]+1);for(let Q=P[0];Q<=P[1];++Q)if(q=na(s[Q],K,y),w=Math.min(w,q),w===0)return w}else q=fn(s,P,a,D,y),w=Math.min(w,q)}else{const q=ad(P,i),K=ad(D,d);ia(b,w,y,s,a,q[0],K[0]),ia(b,w,y,s,a,q[0],K[1]),ia(b,w,y,s,a,q[1],K[0]),ia(b,w,y,s,a,q[1],K[1])}}return w}function dd(s){return s.type==="MultiPolygon"?s.coordinates.map(i=>({type:"Polygon",coordinates:i})):s.type==="MultiLineString"?s.coordinates.map(i=>({type:"LineString",coordinates:i})):s.type==="MultiPoint"?s.coordinates.map(i=>({type:"Point",coordinates:i})):[s]}class sa{constructor(i,a){this.type=Qe,this.geojson=i,this.geometries=a}static parse(i,a){if(i.length!==2)return a.error(`'distance' expression requires exactly one argument, but found ${i.length-1} instead.`);if(Jo(i[1])){const d=i[1];if(d.type==="FeatureCollection")return new sa(d,d.features.map(y=>dd(y.geometry)).flat());if(d.type==="Feature")return new sa(d,dd(d.geometry));if("type"in d&&"coordinates"in d)return new sa(d,dd(d))}return a.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(i){if(i.geometry()!=null&&i.canonicalID()!=null){if(i.geometryType()==="Point")return function(a,d){const y=a.geometry(),x=y.flat().map(k=>id([k.x,k.y],a.canonical));if(y.length===0)return NaN;const w=new od(x[0][1]);let b=1/0;for(const k of d){switch(k.type){case"Point":b=Math.min(b,eu(x,!1,[k.coordinates],!1,w,b));break;case"LineString":b=Math.min(b,eu(x,!1,k.coordinates,!0,w,b));break;case"Polygon":b=Math.min(b,Ql(x,!1,k.coordinates,w,b))}if(b===0)return b}return b}(i,this.geometries);if(i.geometryType()==="LineString")return function(a,d){const y=a.geometry(),x=y.flat().map(k=>id([k.x,k.y],a.canonical));if(y.length===0)return NaN;const w=new od(x[0][1]);let b=1/0;for(const k of d){switch(k.type){case"Point":b=Math.min(b,eu(x,!0,[k.coordinates],!1,w,b));break;case"LineString":b=Math.min(b,eu(x,!0,k.coordinates,!0,w,b));break;case"Polygon":b=Math.min(b,Ql(x,!0,k.coordinates,w,b))}if(b===0)return b}return b}(i,this.geometries);if(i.geometryType()==="Polygon")return function(a,d){const y=a.geometry();if(y.length===0||y[0].length===0)return NaN;const x=uc(y,0).map(k=>k.map(P=>P.map(D=>id([D.x,D.y],a.canonical)))),w=new od(x[0][0][0][1]);let b=1/0;for(const k of d)for(const P of x){switch(k.type){case"Point":b=Math.min(b,Ql([k.coordinates],!1,P,w,b));break;case"LineString":b=Math.min(b,Ql(k.coordinates,!0,P,w,b));break;case"Polygon":b=Math.min(b,Nr(P,k.coordinates,w,b))}if(b===0)return b}return b}(i,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}const Ha={"==":z_,"!=":zp,">":R_,"<":Rp,">=":Lp,"<=":L_,array:gs,at:Jh,boolean:gs,case:rc,coalesce:sc,collator:Kl,format:ac,image:rd,in:Qh,"index-of":$a,interpolate:yi,"interpolate-hcl":yi,"interpolate-lab":yi,length:nd,let:Po,literal:ms,match:ed,number:gs,"number-format":td,object:gs,slice:Yl,step:ja,string:gs,"to-boolean":ys,"to-color":ys,"to-number":ys,"to-string":ys,var:Sr,within:ra,distance:sa};class Ki{constructor(i,a,d,y){this.name=i,this.type=a,this._evaluate=d,this.args=y}evaluate(i){return this._evaluate(i,this.args)}eachChild(i){this.args.forEach(i)}outputDefined(){return!1}static parse(i,a){const d=i[0],y=Ki.definitions[d];if(!y)return a.error(`Unknown expression "${d}". If you wanted a literal array, use ["literal", [...]].`,0);const x=Array.isArray(y)?y[0]:y.type,w=Array.isArray(y)?[[y[1],y[2]]]:y.overloads,b=w.filter(([P])=>!Array.isArray(P)||P.length===i.length-1);let k=null;for(const[P,D]of b){k=new Qo(a.registry,tu,a.path,null,a.scope);const L=[];let j=!1;for(let q=1;q{return j=L,Array.isArray(j)?`(${j.map(W).join(", ")})`:`(${W(j.type)}...)`;var j}).join(" | "),D=[];for(let L=1;L{a=i?a&&tu(d):a&&d instanceof ms}),!!a&&ru(s)&&nu(s,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function ru(s){if(s instanceof Ki&&(s.name==="get"&&s.args.length===1||s.name==="feature-state"||s.name==="has"&&s.args.length===1||s.name==="properties"||s.name==="geometry-type"||s.name==="id"||/^filter-/.test(s.name))||s instanceof ra||s instanceof sa)return!1;let i=!0;return s.eachChild(a=>{i&&!ru(a)&&(i=!1)}),i}function Wa(s){if(s instanceof Ki&&s.name==="feature-state")return!1;let i=!0;return s.eachChild(a=>{i&&!Wa(a)&&(i=!1)}),i}function nu(s,i){if(s instanceof Ki&&i.indexOf(s.name)>=0)return!1;let a=!0;return s.eachChild(d=>{a&&!nu(d,i)&&(a=!1)}),a}function fc(s){return{result:"success",value:s}}function Ga(s){return{result:"error",value:s}}function Za(s){return s["property-type"]==="data-driven"||s["property-type"]==="cross-faded-data-driven"}function qp(s){return!!s.expression&&s.expression.parameters.indexOf("zoom")>-1}function gd(s){return!!s.expression&&s.expression.interpolated}function vr(s){return s instanceof Number?"number":s instanceof String?"string":s instanceof Boolean?"boolean":Array.isArray(s)?"array":s===null?"null":typeof s}function pc(s){return typeof s=="object"&&s!==null&&!Array.isArray(s)}function G_(s){return s}function Yp(s,i){const a=i.type==="color",d=s.stops&&typeof s.stops[0][0]=="object",y=d||!(d||s.property!==void 0),x=s.type||(gd(i)?"exponential":"interval");if(a||i.type==="padding"){const D=a?Ar.parse:Ai.parse;(s=tn({},s)).stops&&(s.stops=s.stops.map(L=>[L[0],D(L[1])])),s.default=D(s.default?s.default:i.default)}if(s.colorSpace&&(w=s.colorSpace)!=="rgb"&&w!=="hcl"&&w!=="lab")throw new Error(`Unknown color space: "${s.colorSpace}"`);var w;let b,k,P;if(x==="exponential")b=Kp;else if(x==="interval")b=mc;else if(x==="categorical"){b=Xp,k=Object.create(null);for(const D of s.stops)k[D[0]]=D[1];P=typeof s.stops[0][0]}else{if(x!=="identity")throw new Error(`Unknown function type "${x}"`);b=Jp}if(d){const D={},L=[];for(let K=0;KK[0]),evaluate:({zoom:K},Q)=>Kp({stops:j,base:s.base},i,K).evaluate(K,Q)}}if(y){const D=x==="exponential"?{name:"exponential",base:s.base!==void 0?s.base:1}:null;return{kind:"camera",interpolationType:D,interpolationFactor:yi.interpolationFactor.bind(void 0,D),zoomStops:s.stops.map(L=>L[0]),evaluate:({zoom:L})=>b(s,i,L,k,P)}}return{kind:"source",evaluate(D,L){const j=L&&L.properties?L.properties[s.property]:void 0;return j===void 0?qa(s.default,i.default):b(s,i,j,k,P)}}}function qa(s,i,a){return s!==void 0?s:i!==void 0?i:a!==void 0?a:void 0}function Xp(s,i,a,d,y){return qa(typeof a===y?d[a]:void 0,s.default,i.default)}function mc(s,i,a){if(vr(a)!=="number")return qa(s.default,i.default);const d=s.stops.length;if(d===1||a<=s.stops[0][0])return s.stops[0][1];if(a>=s.stops[d-1][0])return s.stops[d-1][1];const y=nc(s.stops.map(x=>x[0]),a);return s.stops[y][1]}function Kp(s,i,a){const d=s.base!==void 0?s.base:1;if(vr(a)!=="number")return qa(s.default,i.default);const y=s.stops.length;if(y===1||a<=s.stops[0][0])return s.stops[0][1];if(a>=s.stops[y-1][0])return s.stops[y-1][1];const x=nc(s.stops.map(D=>D[0]),a),w=function(D,L,j,q){const K=q-j,Q=D-j;return K===0?0:L===1?Q/K:(Math.pow(L,Q)-1)/(Math.pow(L,K)-1)}(a,d,s.stops[x][0],s.stops[x+1][0]),b=s.stops[x][1],k=s.stops[x+1][1],P=gi[i.type]||G_;return typeof b.evaluate=="function"?{evaluate(...D){const L=b.evaluate.apply(void 0,D),j=k.evaluate.apply(void 0,D);if(L!==void 0&&j!==void 0)return P(L,j,w,s.colorSpace)}}:P(b,k,w,s.colorSpace)}function Jp(s,i,a){switch(i.type){case"color":a=Ar.parse(a);break;case"formatted":a=Mi.fromString(a.toString());break;case"resolvedImage":a=Di.fromString(a.toString());break;case"padding":a=Ai.parse(a);break;default:vr(a)===i.type||i.type==="enum"&&i.values[a]||(a=void 0)}return qa(a,s.default,i.default)}Ki.register(Ha,{error:[{kind:"error"},[Kt],(s,[i])=>{throw new xn(i.evaluate(s))}],typeof:[Kt,[Xt],(s,[i])=>W(En(i.evaluate(s)))],"to-rgba":[G(Qe,4),[Kr],(s,[i])=>{const[a,d,y,x]=i.evaluate(s).rgb;return[255*a,255*d,255*y,x]}],rgb:[Kr,[Qe,Qe,Qe],fd],rgba:[Kr,[Qe,Qe,Qe,Qe],fd],has:{type:jt,overloads:[[[Kt],(s,[i])=>pd(i.evaluate(s),s.properties())],[[Kt,mi],(s,[i,a])=>pd(i.evaluate(s),a.evaluate(s))]]},get:{type:Xt,overloads:[[[Kt],(s,[i])=>md(i.evaluate(s),s.properties())],[[Kt,mi],(s,[i,a])=>md(i.evaluate(s),a.evaluate(s))]]},"feature-state":[Xt,[Kt],(s,[i])=>md(i.evaluate(s),s.featureState||{})],properties:[mi,[],s=>s.properties()],"geometry-type":[Kt,[],s=>s.geometryType()],id:[Xt,[],s=>s.id()],zoom:[Qe,[],s=>s.globals.zoom],"heatmap-density":[Qe,[],s=>s.globals.heatmapDensity||0],"line-progress":[Qe,[],s=>s.globals.lineProgress||0],accumulated:[Xt,[],s=>s.globals.accumulated===void 0?null:s.globals.accumulated],"+":[Qe,oa(Qe),(s,i)=>{let a=0;for(const d of i)a+=d.evaluate(s);return a}],"*":[Qe,oa(Qe),(s,i)=>{let a=1;for(const d of i)a*=d.evaluate(s);return a}],"-":{type:Qe,overloads:[[[Qe,Qe],(s,[i,a])=>i.evaluate(s)-a.evaluate(s)],[[Qe],(s,[i])=>-i.evaluate(s)]]},"/":[Qe,[Qe,Qe],(s,[i,a])=>i.evaluate(s)/a.evaluate(s)],"%":[Qe,[Qe,Qe],(s,[i,a])=>i.evaluate(s)%a.evaluate(s)],ln2:[Qe,[],()=>Math.LN2],pi:[Qe,[],()=>Math.PI],e:[Qe,[],()=>Math.E],"^":[Qe,[Qe,Qe],(s,[i,a])=>Math.pow(i.evaluate(s),a.evaluate(s))],sqrt:[Qe,[Qe],(s,[i])=>Math.sqrt(i.evaluate(s))],log10:[Qe,[Qe],(s,[i])=>Math.log(i.evaluate(s))/Math.LN10],ln:[Qe,[Qe],(s,[i])=>Math.log(i.evaluate(s))],log2:[Qe,[Qe],(s,[i])=>Math.log(i.evaluate(s))/Math.LN2],sin:[Qe,[Qe],(s,[i])=>Math.sin(i.evaluate(s))],cos:[Qe,[Qe],(s,[i])=>Math.cos(i.evaluate(s))],tan:[Qe,[Qe],(s,[i])=>Math.tan(i.evaluate(s))],asin:[Qe,[Qe],(s,[i])=>Math.asin(i.evaluate(s))],acos:[Qe,[Qe],(s,[i])=>Math.acos(i.evaluate(s))],atan:[Qe,[Qe],(s,[i])=>Math.atan(i.evaluate(s))],min:[Qe,oa(Qe),(s,i)=>Math.min(...i.map(a=>a.evaluate(s)))],max:[Qe,oa(Qe),(s,i)=>Math.max(...i.map(a=>a.evaluate(s)))],abs:[Qe,[Qe],(s,[i])=>Math.abs(i.evaluate(s))],round:[Qe,[Qe],(s,[i])=>{const a=i.evaluate(s);return a<0?-Math.round(-a):Math.round(a)}],floor:[Qe,[Qe],(s,[i])=>Math.floor(i.evaluate(s))],ceil:[Qe,[Qe],(s,[i])=>Math.ceil(i.evaluate(s))],"filter-==":[jt,[Kt,Xt],(s,[i,a])=>s.properties()[i.value]===a.value],"filter-id-==":[jt,[Xt],(s,[i])=>s.id()===i.value],"filter-type-==":[jt,[Kt],(s,[i])=>s.geometryType()===i.value],"filter-<":[jt,[Kt,Xt],(s,[i,a])=>{const d=s.properties()[i.value],y=a.value;return typeof d==typeof y&&d{const a=s.id(),d=i.value;return typeof a==typeof d&&a":[jt,[Kt,Xt],(s,[i,a])=>{const d=s.properties()[i.value],y=a.value;return typeof d==typeof y&&d>y}],"filter-id->":[jt,[Xt],(s,[i])=>{const a=s.id(),d=i.value;return typeof a==typeof d&&a>d}],"filter-<=":[jt,[Kt,Xt],(s,[i,a])=>{const d=s.properties()[i.value],y=a.value;return typeof d==typeof y&&d<=y}],"filter-id-<=":[jt,[Xt],(s,[i])=>{const a=s.id(),d=i.value;return typeof a==typeof d&&a<=d}],"filter->=":[jt,[Kt,Xt],(s,[i,a])=>{const d=s.properties()[i.value],y=a.value;return typeof d==typeof y&&d>=y}],"filter-id->=":[jt,[Xt],(s,[i])=>{const a=s.id(),d=i.value;return typeof a==typeof d&&a>=d}],"filter-has":[jt,[Xt],(s,[i])=>i.value in s.properties()],"filter-has-id":[jt,[],s=>s.id()!==null&&s.id()!==void 0],"filter-type-in":[jt,[G(Kt)],(s,[i])=>i.value.indexOf(s.geometryType())>=0],"filter-id-in":[jt,[G(Xt)],(s,[i])=>i.value.indexOf(s.id())>=0],"filter-in-small":[jt,[Kt,G(Xt)],(s,[i,a])=>a.value.indexOf(s.properties()[i.value])>=0],"filter-in-large":[jt,[Kt,G(Xt)],(s,[i,a])=>function(d,y,x,w){for(;x<=w;){const b=x+w>>1;if(y[b]===d)return!0;y[b]>d?w=b-1:x=b+1}return!1}(s.properties()[i.value],a.value,0,a.value.length-1)],all:{type:jt,overloads:[[[jt,jt],(s,[i,a])=>i.evaluate(s)&&a.evaluate(s)],[oa(jt),(s,i)=>{for(const a of i)if(!a.evaluate(s))return!1;return!0}]]},any:{type:jt,overloads:[[[jt,jt],(s,[i,a])=>i.evaluate(s)||a.evaluate(s)],[oa(jt),(s,i)=>{for(const a of i)if(a.evaluate(s))return!0;return!1}]]},"!":[jt,[jt],(s,[i])=>!i.evaluate(s)],"is-supported-script":[jt,[Kt],(s,[i])=>{const a=s.globals&&s.globals.isSupportedScript;return!a||a(i.evaluate(s))}],upcase:[Kt,[Kt],(s,[i])=>i.evaluate(s).toUpperCase()],downcase:[Kt,[Kt],(s,[i])=>i.evaluate(s).toLowerCase()],concat:[Kt,oa(Xt),(s,i)=>i.map(a=>ql(a.evaluate(s))).join("")],"resolved-locale":[Kt,[Yi],(s,[i])=>i.evaluate(s).resolvedLocale()]});class gc{constructor(i,a){var d;this.expression=i,this._warningHistory={},this._evaluator=new tc,this._defaultValue=a?(d=a).type==="color"&&pc(d.default)?new Ar(0,0,0,0):d.type==="color"?Ar.parse(d.default)||null:d.type==="padding"?Ai.parse(d.default)||null:d.type==="variableAnchorOffsetCollection"?Xi.parse(d.default)||null:d.default===void 0?null:d.default:null,this._enumValues=a&&a.type==="enum"?a.values:null}evaluateWithoutErrorHandling(i,a,d,y,x,w){return this._evaluator.globals=i,this._evaluator.feature=a,this._evaluator.featureState=d,this._evaluator.canonical=y,this._evaluator.availableImages=x||null,this._evaluator.formattedSection=w,this.expression.evaluate(this._evaluator)}evaluate(i,a,d,y,x,w){this._evaluator.globals=i,this._evaluator.feature=a||null,this._evaluator.featureState=d||null,this._evaluator.canonical=y,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 xn(`Expected value to be one of ${Object.keys(this._enumValues).map(k=>JSON.stringify(k)).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 yc(s){return Array.isArray(s)&&s.length>0&&typeof s[0]=="string"&&s[0]in Ha}function Ya(s,i){const a=new Qo(Ha,tu,[],i?function(y){const x={color:Kr,string:Kt,number:Qe,enum:Kt,boolean:jt,formatted:fs,padding:ps,resolvedImage:Hn,variableAnchorOffsetCollection:he};return y.type==="array"?G(x[y.value]||Xt,y.length):x[y.type]}(i):void 0),d=a.parse(s,void 0,void 0,void 0,i&&i.type==="string"?{typeAnnotation:"coerce"}:void 0);return d?fc(new gc(d,i)):Ga(a.errors)}class Xa{constructor(i,a){this.kind=i,this._styleExpression=a,this.isStateDependent=i!=="constant"&&!Wa(a.expression)}evaluateWithoutErrorHandling(i,a,d,y,x,w){return this._styleExpression.evaluateWithoutErrorHandling(i,a,d,y,x,w)}evaluate(i,a,d,y,x,w){return this._styleExpression.evaluate(i,a,d,y,x,w)}}class Ka{constructor(i,a,d,y){this.kind=i,this.zoomStops=d,this._styleExpression=a,this.isStateDependent=i!=="camera"&&!Wa(a.expression),this.interpolationType=y}evaluateWithoutErrorHandling(i,a,d,y,x,w){return this._styleExpression.evaluateWithoutErrorHandling(i,a,d,y,x,w)}evaluate(i,a,d,y,x,w){return this._styleExpression.evaluate(i,a,d,y,x,w)}interpolationFactor(i,a,d){return this.interpolationType?yi.interpolationFactor(this.interpolationType,i,a,d):0}}function yd(s,i){const a=Ya(s,i);if(a.result==="error")return a;const d=a.value.expression,y=ru(d);if(!y&&!Za(i))return Ga([new _n("","data expressions not supported")]);const x=nu(d,["zoom"]);if(!x&&!qp(i))return Ga([new _n("","zoom expressions not supported")]);const w=iu(d);return w||x?w instanceof _n?Ga([w]):w instanceof yi&&!gd(i)?Ga([new _n("",'"interpolate" expressions cannot be used with this property')]):fc(w?new Ka(y?"camera":"composite",a.value,w.labels,w instanceof yi?w.interpolation:void 0):new Xa(y?"constant":"source",a.value)):Ga([new _n("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Ja{constructor(i,a){this._parameters=i,this._specification=a,tn(this,Yp(this._parameters,this._specification))}static deserialize(i){return new Ja(i._parameters,i._specification)}static serialize(i){return{_parameters:i._parameters,_specification:i._specification}}}function iu(s){let i=null;if(s instanceof Po)i=iu(s.result);else if(s instanceof sc){for(const a of s.args)if(i=iu(a),i)break}else(s instanceof ja||s instanceof yi)&&s.input instanceof Ki&&s.input.name==="zoom"&&(i=s);return i instanceof _n||s.eachChild(a=>{const d=iu(a);d instanceof _n?i=d:!i&&d?i=new _n("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):i&&d&&i!==d&&(i=new _n("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),i}function _c(s){if(s===!0||s===!1)return!0;if(!Array.isArray(s)||s.length===0)return!1;switch(s[0]){case"has":return s.length>=2&&s[1]!=="$id"&&s[1]!=="$type";case"in":return s.length>=3&&(typeof s[1]!="string"||Array.isArray(s[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return s.length!==3||Array.isArray(s[1])||Array.isArray(s[2]);case"any":case"all":for(const i of s.slice(1))if(!_c(i)&&typeof i!="boolean")return!1;return!0;default:return!0}}const vc={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function _d(s){if(s==null)return{filter:()=>!0,needGeometry:!1};_c(s)||(s=xc(s));const i=Ya(s,vc);if(i.result==="error")throw new Error(i.value.map(a=>`${a.key}: ${a.message}`).join(", "));return{filter:(a,d,y)=>i.value.evaluate(a,d,{},y),needGeometry:Qp(s)}}function Z_(s,i){return si?1:0}function Qp(s){if(!Array.isArray(s))return!1;if(s[0]==="within"||s[0]==="distance")return!0;for(let i=1;i"||i==="<="||i===">="?vd(s[1],s[2],i):i==="any"?(a=s.slice(1),["any"].concat(a.map(xc))):i==="all"?["all"].concat(s.slice(1).map(xc)):i==="none"?["all"].concat(s.slice(1).map(xc).map(Wn)):i==="in"?su(s[1],s.slice(2)):i==="!in"?Wn(su(s[1],s.slice(2))):i==="has"?ou(s[1]):i!=="!has"||Wn(ou(s[1]));var a}function vd(s,i,a){switch(s){case"$type":return[`filter-type-${a}`,i];case"$id":return[`filter-id-${a}`,i];default:return[`filter-${a}`,s,i]}}function su(s,i){if(i.length===0)return!1;switch(s){case"$type":return["filter-type-in",["literal",i]];case"$id":return["filter-id-in",["literal",i]];default:return i.length>200&&!i.some(a=>typeof a!=typeof i[0])?["filter-in-large",s,["literal",i.sort(Z_)]]:["filter-in-small",s,["literal",i]]}}function ou(s){switch(s){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",s]}}function Wn(s){return["!",s]}function aa(s){const i=typeof s;if(i==="number"||i==="boolean"||i==="string"||s==null)return JSON.stringify(s);if(Array.isArray(s)){let y="[";for(const x of s)y+=`${aa(x)},`;return`${y}]`}const a=Object.keys(s).sort();let d="{";for(let y=0;yd.maximum?[new qe(i,a,`${a} is greater than the maximum value ${d.maximum}`)]:[]}function wc(s){const i=s.valueSpec,a=pn(s.value.type);let d,y,x,w={};const b=a!=="categorical"&&s.value.property===void 0,k=!b,P=vr(s.value.stops)==="array"&&vr(s.value.stops[0])==="array"&&vr(s.value.stops[0][0])==="object",D=zi({key:s.key,value:s.value,valueSpec:s.styleSpec.function,validateSpec:s.validateSpec,style:s.style,styleSpec:s.styleSpec,objectElementValidators:{stops:function(q){if(a==="identity")return[new qe(q.key,q.value,'identity function may not have a "stops" property')];let K=[];const Q=q.value;return K=K.concat(au({key:q.key,value:Q,valueSpec:q.valueSpec,validateSpec:q.validateSpec,style:q.style,styleSpec:q.styleSpec,arrayElementValidator:L})),vr(Q)==="array"&&Q.length===0&&K.push(new qe(q.key,Q,"array must have at least one stop")),K},default:function(q){return q.validateSpec({key:q.key,value:q.value,valueSpec:i,validateSpec:q.validateSpec,style:q.style,styleSpec:q.styleSpec})}}});return a==="identity"&&b&&D.push(new qe(s.key,s.value,'missing required property "property"')),a==="identity"||s.value.stops||D.push(new qe(s.key,s.value,'missing required property "stops"')),a==="exponential"&&s.valueSpec.expression&&!gd(s.valueSpec)&&D.push(new qe(s.key,s.value,"exponential functions not supported")),s.styleSpec.$version>=8&&(k&&!Za(s.valueSpec)?D.push(new qe(s.key,s.value,"property functions not supported")):b&&!qp(s.valueSpec)&&D.push(new qe(s.key,s.value,"zoom functions not supported"))),a!=="categorical"&&!P||s.value.property!==void 0||D.push(new qe(s.key,s.value,'"property" property is required')),D;function L(q){let K=[];const Q=q.value,le=q.key;if(vr(Q)!=="array")return[new qe(le,Q,`array expected, ${vr(Q)} found`)];if(Q.length!==2)return[new qe(le,Q,`array length 2 expected, length ${Q.length} found`)];if(P){if(vr(Q[0])!=="object")return[new qe(le,Q,`object expected, ${vr(Q[0])} found`)];if(Q[0].zoom===void 0)return[new qe(le,Q,"object stop key must have zoom")];if(Q[0].value===void 0)return[new qe(le,Q,"object stop key must have value")];if(x&&x>pn(Q[0].zoom))return[new qe(le,Q[0].zoom,"stop zoom values must appear in ascending order")];pn(Q[0].zoom)!==x&&(x=pn(Q[0].zoom),y=void 0,w={}),K=K.concat(zi({key:`${le}[0]`,value:Q[0],valueSpec:{zoom:{}},validateSpec:q.validateSpec,style:q.style,styleSpec:q.styleSpec,objectElementValidators:{zoom:xd,value:j}}))}else K=K.concat(j({key:`${le}[0]`,value:Q[0],valueSpec:{},validateSpec:q.validateSpec,style:q.style,styleSpec:q.styleSpec},Q));return yc(_s(Q[1]))?K.concat([new qe(`${le}[1]`,Q[1],"expressions are not allowed in function stops.")]):K.concat(q.validateSpec({key:`${le}[1]`,value:Q[1],valueSpec:i,validateSpec:q.validateSpec,style:q.style,styleSpec:q.styleSpec}))}function j(q,K){const Q=vr(q.value),le=pn(q.value),fe=q.value!==null?q.value:K;if(d){if(Q!==d)return[new qe(q.key,fe,`${Q} stop domain type must match previous stop domain type ${d}`)]}else d=Q;if(Q!=="number"&&Q!=="string"&&Q!=="boolean")return[new qe(q.key,fe,"stop domain value must be a number, string, or boolean")];if(Q!=="number"&&a!=="categorical"){let De=`number expected, ${Q} found`;return Za(i)&&a===void 0&&(De+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new qe(q.key,fe,De)]}return a!=="categorical"||Q!=="number"||isFinite(le)&&Math.floor(le)===le?a!=="categorical"&&Q==="number"&&y!==void 0&&lenew qe(`${s.key}${d.key}`,s.value,d.message));const a=i.value.expression||i.value._styleExpression.expression;if(s.expressionContext==="property"&&s.propertyKey==="text-font"&&!a.outputDefined())return[new qe(s.key,s.value,`Invalid data expression for "${s.propertyKey}". Output values must be contained as literals within the expression.`)];if(s.expressionContext==="property"&&s.propertyType==="layout"&&!Wa(a))return[new qe(s.key,s.value,'"feature-state" data expressions are not supported with layout properties.')];if(s.expressionContext==="filter"&&!Wa(a))return[new qe(s.key,s.value,'"feature-state" data expressions are not supported with filters.')];if(s.expressionContext&&s.expressionContext.indexOf("cluster")===0){if(!nu(a,["zoom","feature-state"]))return[new qe(s.key,s.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(s.expressionContext==="cluster-initial"&&!ru(a))return[new qe(s.key,s.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function lo(s){const i=s.key,a=s.value,d=s.valueSpec,y=[];return Array.isArray(d.values)?d.values.indexOf(pn(a))===-1&&y.push(new qe(i,a,`expected one of [${d.values.join(", ")}], ${JSON.stringify(a)} found`)):Object.keys(d.values).indexOf(pn(a))===-1&&y.push(new qe(i,a,`expected one of [${Object.keys(d.values).join(", ")}], ${JSON.stringify(a)} found`)),y}function wd(s){return _c(_s(s.value))?Qa(tn({},s,{expressionContext:"filter",valueSpec:{value:"boolean"}})):bc(s)}function bc(s){const i=s.value,a=s.key;if(vr(i)!=="array")return[new qe(a,i,`array expected, ${vr(i)} found`)];const d=s.styleSpec;let y,x=[];if(i.length<1)return[new qe(a,i,"filter array must have at least 1 element")];switch(x=x.concat(lo({key:`${a}[0]`,value:i[0],valueSpec:d.filter_operator,style:s.style,styleSpec:s.styleSpec})),pn(i[0])){case"<":case"<=":case">":case">=":i.length>=2&&pn(i[1])==="$type"&&x.push(new qe(a,i,`"$type" cannot be use with operator "${i[0]}"`));case"==":case"!=":i.length!==3&&x.push(new qe(a,i,`filter array for operator "${i[0]}" must have 3 elements`));case"in":case"!in":i.length>=2&&(y=vr(i[1]),y!=="string"&&x.push(new qe(`${a}[1]`,i[1],`string expected, ${y} found`)));for(let w=2;w{P in a&&i.push(new qe(d,a[P],`"${P}" is prohibited for ref layers`))}),y.layers.forEach(P=>{pn(P.id)===b&&(k=P)}),k?k.ref?i.push(new qe(d,a.ref,"ref cannot reference another ref layer")):w=pn(k.type):i.push(new qe(d,a.ref,`ref layer "${b}" not found`))}else if(w!=="background")if(a.source){const k=y.sources&&y.sources[a.source],P=k&&pn(k.type);k?P==="vector"&&w==="raster"?i.push(new qe(d,a.source,`layer "${a.id}" requires a raster source`)):P!=="raster-dem"&&w==="hillshade"?i.push(new qe(d,a.source,`layer "${a.id}" requires a raster-dem source`)):P==="raster"&&w!=="raster"?i.push(new qe(d,a.source,`layer "${a.id}" requires a vector source`)):P!=="vector"||a["source-layer"]?P==="raster-dem"&&w!=="hillshade"?i.push(new qe(d,a.source,"raster-dem source can only be used with layer type 'hillshade'.")):w!=="line"||!a.paint||!a.paint["line-gradient"]||P==="geojson"&&k.lineMetrics||i.push(new qe(d,a,`layer "${a.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):i.push(new qe(d,a,`layer "${a.id}" must specify a "source-layer"`)):i.push(new qe(d,a.source,`source "${a.source}" not found`))}else i.push(new qe(d,a,'missing required property "source"'));return i=i.concat(zi({key:d,value:a,valueSpec:x.layer,style:s.style,styleSpec:s.styleSpec,validateSpec:s.validateSpec,objectElementValidators:{"*":()=>[],type:()=>s.validateSpec({key:`${d}.type`,value:a.type,valueSpec:x.layer.type,style:s.style,styleSpec:s.styleSpec,validateSpec:s.validateSpec,object:a,objectKey:"type"}),filter:wd,layout:k=>zi({layer:a,key:k.key,value:k.value,style:k.style,styleSpec:k.styleSpec,validateSpec:k.validateSpec,objectElementValidators:{"*":P=>Sd(tn({layerType:w},P))}}),paint:k=>zi({layer:a,key:k.key,value:k.value,style:k.style,styleSpec:k.styleSpec,validateSpec:k.validateSpec,objectElementValidators:{"*":P=>Sc(tn({layerType:w},P))}})}})),i}function la(s){const i=s.value,a=s.key,d=vr(i);return d!=="string"?[new qe(a,i,`string expected, ${d} found`)]:[]}const kc={promoteId:function({key:s,value:i}){if(vr(i)==="string")return la({key:s,value:i});{const a=[];for(const d in i)a.push(...la({key:`${s}.${d}`,value:i[d]}));return a}}};function lu(s){const i=s.value,a=s.key,d=s.styleSpec,y=s.style,x=s.validateSpec;if(!i.type)return[new qe(a,i,'"type" is required')];const w=pn(i.type);let b;switch(w){case"vector":case"raster":return b=zi({key:a,value:i,valueSpec:d[`source_${w.replace("-","_")}`],style:s.style,styleSpec:d,objectElementValidators:kc,validateSpec:x}),b;case"raster-dem":return b=function(k){var P;const D=(P=k.sourceName)!==null&&P!==void 0?P:"",L=k.value,j=k.styleSpec,q=j.source_raster_dem,K=k.style;let Q=[];const le=vr(L);if(L===void 0)return Q;if(le!=="object")return Q.push(new qe("source_raster_dem",L,`object expected, ${le} found`)),Q;const fe=pn(L.encoding)==="custom",De=["redFactor","greenFactor","blueFactor","baseShift"],be=k.value.encoding?`"${k.value.encoding}"`:"Default";for(const Me in L)!fe&&De.includes(Me)?Q.push(new qe(Me,L[Me],`In "${D}": "${Me}" is only valid when "encoding" is set to "custom". ${be} encoding found`)):q[Me]?Q=Q.concat(k.validateSpec({key:Me,value:L[Me],valueSpec:q[Me],validateSpec:k.validateSpec,style:K,styleSpec:j})):Q.push(new qe(Me,L[Me],`unknown property "${Me}"`));return Q}({sourceName:a,value:i,style:s.style,styleSpec:d,validateSpec:x}),b;case"geojson":if(b=zi({key:a,value:i,valueSpec:d.source_geojson,style:y,styleSpec:d,validateSpec:x,objectElementValidators:kc}),i.cluster)for(const k in i.clusterProperties){const[P,D]=i.clusterProperties[k],L=typeof P=="string"?[P,["accumulated"],["get",k]]:P;b.push(...Qa({key:`${a}.${k}.map`,value:D,validateSpec:x,expressionContext:"cluster-map"})),b.push(...Qa({key:`${a}.${k}.reduce`,value:L,validateSpec:x,expressionContext:"cluster-reduce"}))}return b;case"video":return zi({key:a,value:i,valueSpec:d.source_video,style:y,validateSpec:x,styleSpec:d});case"image":return zi({key:a,value:i,valueSpec:d.source_image,style:y,validateSpec:x,styleSpec:d});case"canvas":return[new qe(a,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return lo({key:`${a}.type`,value:i.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:y,validateSpec:x,styleSpec:d})}}function Td(s){const i=s.value,a=s.styleSpec,d=a.light,y=s.style;let x=[];const w=vr(i);if(i===void 0)return x;if(w!=="object")return x=x.concat([new qe("light",i,`object expected, ${w} found`)]),x;for(const b in i){const k=b.match(/^(.*)-transition$/);x=x.concat(k&&d[k[1]]&&d[k[1]].transition?s.validateSpec({key:b,value:i[b],valueSpec:a.transition,validateSpec:s.validateSpec,style:y,styleSpec:a}):d[b]?s.validateSpec({key:b,value:i[b],valueSpec:d[b],validateSpec:s.validateSpec,style:y,styleSpec:a}):[new qe(b,i[b],`unknown property "${b}"`)])}return x}function Ed(s){const i=s.value,a=s.styleSpec,d=a.sky,y=s.style,x=vr(i);if(i===void 0)return[];if(x!=="object")return[new qe("sky",i,`object expected, ${x} found`)];let w=[];for(const b in i)w=w.concat(d[b]?s.validateSpec({key:b,value:i[b],valueSpec:d[b],style:y,styleSpec:a}):[new qe(b,i[b],`unknown property "${b}"`)]);return w}function Cd(s){const i=s.value,a=s.styleSpec,d=a.terrain,y=s.style;let x=[];const w=vr(i);if(i===void 0)return x;if(w!=="object")return x=x.concat([new qe("terrain",i,`object expected, ${w} found`)]),x;for(const b in i)x=x.concat(d[b]?s.validateSpec({key:b,value:i[b],valueSpec:d[b],validateSpec:s.validateSpec,style:y,styleSpec:a}):[new qe(b,i[b],`unknown property "${b}"`)]);return x}function Id(s){let i=[];const a=s.value,d=s.key;if(Array.isArray(a)){const y=[],x=[];for(const w in a)a[w].id&&y.includes(a[w].id)&&i.push(new qe(d,a,`all the sprites' ids must be unique, but ${a[w].id} is duplicated`)),y.push(a[w].id),a[w].url&&x.includes(a[w].url)&&i.push(new qe(d,a,`all the sprites' URLs must be unique, but ${a[w].url} is duplicated`)),x.push(a[w].url),i=i.concat(zi({key:`${d}[${w}]`,value:a[w],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:s.validateSpec}));return i}return la({key:d,value:a})}const Tc={"*":()=>[],array:au,boolean:function(s){const i=s.value,a=s.key,d=vr(i);return d!=="boolean"?[new qe(a,i,`boolean expected, ${d} found`)]:[]},number:xd,color:function(s){const i=s.key,a=s.value,d=vr(a);return d!=="string"?[new qe(i,a,`color expected, ${d} found`)]:Ar.parse(String(a))?[]:[new qe(i,a,`color expected, "${a}" found`)]},constants:tm,enum:lo,filter:wd,function:wc,layer:kd,object:zi,source:lu,light:Td,sky:Ed,terrain:Cd,projection:function(s){const i=s.value,a=s.styleSpec,d=a.projection,y=s.style,x=vr(i);if(i===void 0)return[];if(x!=="object")return[new qe("projection",i,`object expected, ${x} found`)];let w=[];for(const b in i)w=w.concat(d[b]?s.validateSpec({key:b,value:i[b],valueSpec:d[b],style:y,styleSpec:a}):[new qe(b,i[b],`unknown property "${b}"`)]);return w},string:la,formatted:function(s){return la(s).length===0?[]:Qa(s)},resolvedImage:function(s){return la(s).length===0?[]:Qa(s)},padding:function(s){const i=s.key,a=s.value;if(vr(a)==="array"){if(a.length<1||a.length>4)return[new qe(i,a,`padding requires 1 to 4 values; ${a.length} values found`)];const d={type:"number"};let y=[];for(let x=0;x[]}})),s.constants&&(a=a.concat(tm({key:"constants",value:s.constants,style:s,styleSpec:i,validateSpec:el}))),Pd(a)}function Vs(s){return function(i){return s({...i,validateSpec:el})}}function Pd(s){return[].concat(s).sort((i,a)=>i.line-a.line)}function vs(s){return function(...i){return Pd(s.apply(this,i))}}Ji.source=vs(Vs(lu)),Ji.sprite=vs(Vs(Id)),Ji.glyphs=vs(Vs(rm)),Ji.light=vs(Vs(Td)),Ji.sky=vs(Vs(Ed)),Ji.terrain=vs(Vs(Cd)),Ji.layer=vs(Vs(kd)),Ji.filter=vs(Vs(wd)),Ji.paintProperty=vs(Vs(Sc)),Ji.layoutProperty=vs(Vs(Sd));const ua=Ji,q_=ua.light,Y_=ua.sky,nm=ua.paintProperty,im=ua.layoutProperty;function Md(s,i){let a=!1;if(i&&i.length)for(const d of i)s.fire(new V(new Error(d.message))),a=!0;return a}class tl{constructor(i,a,d){const y=this.cells=[];if(i instanceof ArrayBuffer){this.arrayBuffer=i;const w=new Int32Array(this.arrayBuffer);i=w[0],this.d=(a=w[1])+2*(d=w[2]);for(let k=0;k=L[K+0]&&y>=L[K+1])?(b[q]=!0,w.push(D[q])):b[q]=!1}}}}_forEachCell(i,a,d,y,x,w,b,k){const P=this._convertToCellCoord(i),D=this._convertToCellCoord(a),L=this._convertToCellCoord(d),j=this._convertToCellCoord(y);for(let q=P;q<=L;q++)for(let K=D;K<=j;K++){const Q=this.d*K+q;if((!k||k(this._convertFromCellCoord(q),this._convertFromCellCoord(K),this._convertFromCellCoord(q+1),this._convertFromCellCoord(K+1)))&&x.call(this,i,a,d,y,Q,w,b,k))return}}_convertFromCellCoord(i){return(i-this.padding)/this.scale}_convertToCellCoord(i){return Math.max(0,Math.min(this.d-1,Math.floor(i*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const i=this.cells,a=3+this.cells.length+1+1;let d=0;for(let w=0;w=0)continue;const w=s[x];y[x]=Qi[a].shallow.indexOf(x)>=0?w:rl(w,i)}s instanceof Error&&(y.message=s.message)}if(y.$name)throw new Error("$name property is reserved for worker serialization logic.");return a!=="Object"&&(y.$name=a),y}function nl(s){if(sm(s))return s;if(Array.isArray(s))return s.map(nl);if(typeof s!="object")throw new Error("can't deserialize object of type "+typeof s);const i=Ad(s)||"Object";if(!Qi[i])throw new Error(`can't deserialize unregistered class ${i}`);const{klass:a}=Qi[i];if(!a)throw new Error(`can't deserialize unregistered class ${i}`);if(a.deserialize)return a.deserialize(s);const d=Object.create(a.prototype);for(const y of Object.keys(s)){if(y==="$name")continue;const x=s[y];d[y]=Qi[i].shallow.indexOf(y)>=0?x:nl(x)}return d}class Dd{constructor(){this.first=!0}update(i,a){const d=Math.floor(i);return this.first?(this.first=!1,this.lastIntegerZoom=d,this.lastIntegerZoomTime=0,this.lastZoom=i,this.lastFloorZoom=d,!0):(this.lastFloorZoom>d?(this.lastIntegerZoom=d+1,this.lastIntegerZoomTime=a):this.lastFloorZooms>=128&&s<=255,"Hangul Jamo":s=>s>=4352&&s<=4607,Khmer:s=>s>=6016&&s<=6143,"General Punctuation":s=>s>=8192&&s<=8303,"Letterlike Symbols":s=>s>=8448&&s<=8527,"Number Forms":s=>s>=8528&&s<=8591,"Miscellaneous Technical":s=>s>=8960&&s<=9215,"Control Pictures":s=>s>=9216&&s<=9279,"Optical Character Recognition":s=>s>=9280&&s<=9311,"Enclosed Alphanumerics":s=>s>=9312&&s<=9471,"Geometric Shapes":s=>s>=9632&&s<=9727,"Miscellaneous Symbols":s=>s>=9728&&s<=9983,"Miscellaneous Symbols and Arrows":s=>s>=11008&&s<=11263,"Ideographic Description Characters":s=>s>=12272&&s<=12287,"CJK Symbols and Punctuation":s=>s>=12288&&s<=12351,Katakana:s=>s>=12448&&s<=12543,Kanbun:s=>s>=12688&&s<=12703,"CJK Strokes":s=>s>=12736&&s<=12783,"Enclosed CJK Letters and Months":s=>s>=12800&&s<=13055,"CJK Compatibility":s=>s>=13056&&s<=13311,"Yijing Hexagram Symbols":s=>s>=19904&&s<=19967,"Private Use Area":s=>s>=57344&&s<=63743,"Vertical Forms":s=>s>=65040&&s<=65055,"CJK Compatibility Forms":s=>s>=65072&&s<=65103,"Small Form Variants":s=>s>=65104&&s<=65135,"Halfwidth and Fullwidth Forms":s=>s>=65280&&s<=65519};function zd(s){for(const i of s)if(Ld(i.charCodeAt(0)))return!0;return!1}function X_(s){for(const i of s)if(!il(i.charCodeAt(0)))return!1;return!0}function Rd(s){const i=s.map(a=>{try{return new RegExp(`\\p{sc=${a}}`,"u").source}catch{return null}}).filter(a=>a);return new RegExp(i.join("|"),"u")}const K_=Rd(["Arab","Dupl","Mong","Ougr","Syrc"]);function il(s){return!K_.test(String.fromCodePoint(s))}const om=Rd(["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"]);function Ld(s){return!(s!==746&&s!==747&&(s<4352||!(ur["CJK Compatibility Forms"](s)&&!(s>=65097&&s<=65103)||ur["CJK Compatibility"](s)||ur["CJK Strokes"](s)||!(!ur["CJK Symbols and Punctuation"](s)||s>=12296&&s<=12305||s>=12308&&s<=12319||s===12336)||ur["Enclosed CJK Letters and Months"](s)||ur["Ideographic Description Characters"](s)||ur.Kanbun(s)||ur.Katakana(s)&&s!==12540||!(!ur["Halfwidth and Fullwidth Forms"](s)||s===65288||s===65289||s===65293||s>=65306&&s<=65310||s===65339||s===65341||s===65343||s>=65371&&s<=65503||s===65507||s>=65512&&s<=65519)||!(!ur["Small Form Variants"](s)||s>=65112&&s<=65118||s>=65123&&s<=65126)||ur["Vertical Forms"](s)||ur["Yijing Hexagram Symbols"](s)||new RegExp("\\p{sc=Cans}","u").test(String.fromCodePoint(s))||new RegExp("\\p{sc=Hang}","u").test(String.fromCodePoint(s))||om.test(String.fromCodePoint(s)))))}function am(s){return!(Ld(s)||function(i){return!!(ur["Latin-1 Supplement"](i)&&(i===167||i===169||i===174||i===177||i===188||i===189||i===190||i===215||i===247)||ur["General Punctuation"](i)&&(i===8214||i===8224||i===8225||i===8240||i===8241||i===8251||i===8252||i===8258||i===8263||i===8264||i===8265||i===8273)||ur["Letterlike Symbols"](i)||ur["Number Forms"](i)||ur["Miscellaneous Technical"](i)&&(i>=8960&&i<=8967||i>=8972&&i<=8991||i>=8996&&i<=9e3||i===9003||i>=9085&&i<=9114||i>=9150&&i<=9165||i===9167||i>=9169&&i<=9179||i>=9186&&i<=9215)||ur["Control Pictures"](i)&&i!==9251||ur["Optical Character Recognition"](i)||ur["Enclosed Alphanumerics"](i)||ur["Geometric Shapes"](i)||ur["Miscellaneous Symbols"](i)&&!(i>=9754&&i<=9759)||ur["Miscellaneous Symbols and Arrows"](i)&&(i>=11026&&i<=11055||i>=11088&&i<=11097||i>=11192&&i<=11243)||ur["CJK Symbols and Punctuation"](i)||ur.Katakana(i)||ur["Private Use Area"](i)||ur["CJK Compatibility Forms"](i)||ur["Small Form Variants"](i)||ur["Halfwidth and Fullwidth Forms"](i)||i===8734||i===8756||i===8757||i>=9984&&i<=10087||i>=10102&&i<=10131||i===65532||i===65533)}(s))}const J_=Rd(["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 Od(s){return J_.test(String.fromCodePoint(s))}function Q_(s,i){return!(!i&&Od(s)||s>=2304&&s<=3583||s>=3840&&s<=4255||ur.Khmer(s))}function e0(s){for(const i of s)if(Od(i.charCodeAt(0)))return!0;return!1}const Ri=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null}setState(s){this.pluginStatus=s.pluginStatus,this.pluginURL=s.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(s){this.applyArabicShaping=s.applyArabicShaping,this.processBidirectionalText=s.processBidirectionalText,this.processStyledBidirectionalText=s.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class Vr{constructor(i,a){this.zoom=i,a?(this.now=a.now,this.fadeDuration=a.fadeDuration,this.zoomHistory=a.zoomHistory,this.transition=a.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Dd,this.transition={})}isSupportedScript(i){return function(a,d){for(const y of a)if(!Q_(y.charCodeAt(0),d))return!1;return!0}(i,Ri.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const i=this.zoom,a=i-Math.floor(i),d=this.crossFadingFactor();return i>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:a+(1-a)*d}:{fromScale:.5,toScale:1,t:1-(1-d)*a}}}class sl{constructor(i,a){this.property=i,this.value=a,this.expression=function(d,y){if(pc(d))return new Ja(d,y);if(yc(d)){const x=yd(d,y);if(x.result==="error")throw new Error(x.value.map(w=>`${w.key}: ${w.message}`).join(", "));return x.value}{let x=d;return y.type==="color"&&typeof d=="string"?x=Ar.parse(d):y.type!=="padding"||typeof d!="number"&&!Array.isArray(d)?y.type==="variableAnchorOffsetCollection"&&Array.isArray(d)&&(x=Xi.parse(d)):x=Ai.parse(d),{kind:"constant",evaluate:()=>x}}}(a===void 0?i.specification.default:a,i.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(i,a,d){return this.property.possiblyEvaluate(this,i,a,d)}}class Cc{constructor(i){this.property=i,this.value=new sl(i,void 0)}transitioned(i,a){return new lm(this.property,this.value,a,ge({},i.transition,this.transition),i.now)}untransitioned(){return new lm(this.property,this.value,null,{},0)}}class Ic{constructor(i){this._properties=i,this._values=Object.create(i.defaultTransitionablePropertyValues)}getValue(i){return it(this._values[i].value.value)}setValue(i,a){Object.prototype.hasOwnProperty.call(this._values,i)||(this._values[i]=new Cc(this._values[i].property)),this._values[i].value=new sl(this._values[i].property,a===null?void 0:it(a))}getTransition(i){return it(this._values[i].transition)}setTransition(i,a){Object.prototype.hasOwnProperty.call(this._values,i)||(this._values[i]=new Cc(this._values[i].property)),this._values[i].transition=it(a)||void 0}serialize(){const i={};for(const a of Object.keys(this._values)){const d=this.getValue(a);d!==void 0&&(i[a]=d);const y=this.getTransition(a);y!==void 0&&(i[`${a}-transition`]=y)}return i}transitioned(i,a){const d=new uu(this._properties);for(const y of Object.keys(this._values))d._values[y]=this._values[y].transitioned(i,a._values[y]);return d}untransitioned(){const i=new uu(this._properties);for(const a of Object.keys(this._values))i._values[a]=this._values[a].untransitioned();return i}}class lm{constructor(i,a,d,y,x){this.property=i,this.value=a,this.begin=x+y.delay||0,this.end=this.begin+y.duration||0,i.specification.transition&&(y.delay||y.duration)&&(this.prior=d)}possiblyEvaluate(i,a,d){const y=i.now||0,x=this.value.possiblyEvaluate(i,a,d),w=this.prior;if(w){if(y>this.end)return this.prior=null,x;if(this.value.isDataDriven())return this.prior=null,x;if(y=1)return 1;const P=k*k,D=P*k;return 4*(k<.5?D:3*(k-P)+D-.75)}(b))}}return x}}class uu{constructor(i){this._properties=i,this._values=Object.create(i.defaultTransitioningPropertyValues)}possiblyEvaluate(i,a,d){const y=new hu(this._properties);for(const x of Object.keys(this._values))y._values[x]=this._values[x].possiblyEvaluate(i,a,d);return y}hasTransition(){for(const i of Object.keys(this._values))if(this._values[i].prior)return!0;return!1}}class cu{constructor(i){this._properties=i,this._values=Object.create(i.defaultPropertyValues)}hasValue(i){return this._values[i].value!==void 0}getValue(i){return it(this._values[i].value)}setValue(i,a){this._values[i]=new sl(this._values[i].property,a===null?void 0:it(a))}serialize(){const i={};for(const a of Object.keys(this._values)){const d=this.getValue(a);d!==void 0&&(i[a]=d)}return i}possiblyEvaluate(i,a,d){const y=new hu(this._properties);for(const x of Object.keys(this._values))y._values[x]=this._values[x].possiblyEvaluate(i,a,d);return y}}class Hs{constructor(i,a,d){this.property=i,this.value=a,this.parameters=d}isConstant(){return this.value.kind==="constant"}constantOr(i){return this.value.kind==="constant"?this.value.value:i}evaluate(i,a,d,y){return this.property.evaluate(this.value,this.parameters,i,a,d,y)}}class hu{constructor(i){this._properties=i,this._values=Object.create(i.defaultPossiblyEvaluatedValues)}get(i){return this._values[i]}}class It{constructor(i){this.specification=i}possiblyEvaluate(i,a){if(i.isDataDriven())throw new Error("Value should not be data driven");return i.expression.evaluate(a)}interpolate(i,a,d){const y=gi[this.specification.type];return y?y(i,a,d):i}}class Ut{constructor(i,a){this.specification=i,this.overrides=a}possiblyEvaluate(i,a,d,y){return new Hs(this,i.expression.kind==="constant"||i.expression.kind==="camera"?{kind:"constant",value:i.expression.evaluate(a,null,{},d,y)}:i.expression,a)}interpolate(i,a,d){if(i.value.kind!=="constant"||a.value.kind!=="constant")return i;if(i.value.value===void 0||a.value.value===void 0)return new Hs(this,{kind:"constant",value:void 0},i.parameters);const y=gi[this.specification.type];if(y){const x=y(i.value.value,a.value.value,d);return new Hs(this,{kind:"constant",value:x},i.parameters)}return i}evaluate(i,a,d,y,x,w){return i.kind==="constant"?i.value:i.evaluate(a,d,y,x,w)}}class Pc extends Ut{possiblyEvaluate(i,a,d,y){if(i.value===void 0)return new Hs(this,{kind:"constant",value:void 0},a);if(i.expression.kind==="constant"){const x=i.expression.evaluate(a,null,{},d,y),w=i.property.specification.type==="resolvedImage"&&typeof x!="string"?x.name:x,b=this._calculate(w,w,w,a);return new Hs(this,{kind:"constant",value:b},a)}if(i.expression.kind==="camera"){const x=this._calculate(i.expression.evaluate({zoom:a.zoom-1}),i.expression.evaluate({zoom:a.zoom}),i.expression.evaluate({zoom:a.zoom+1}),a);return new Hs(this,{kind:"constant",value:x},a)}return new Hs(this,i.expression,a)}evaluate(i,a,d,y,x,w){if(i.kind==="source"){const b=i.evaluate(a,d,y,x,w);return this._calculate(b,b,b,a)}return i.kind==="composite"?this._calculate(i.evaluate({zoom:Math.floor(a.zoom)-1},d,y),i.evaluate({zoom:Math.floor(a.zoom)},d,y),i.evaluate({zoom:Math.floor(a.zoom)+1},d,y),a):i.value}_calculate(i,a,d,y){return y.zoom>y.zoomHistory.lastIntegerZoom?{from:i,to:a}:{from:d,to:a}}interpolate(i){return i}}class Mc{constructor(i){this.specification=i}possiblyEvaluate(i,a,d,y){if(i.value!==void 0){if(i.expression.kind==="constant"){const x=i.expression.evaluate(a,null,{},d,y);return this._calculate(x,x,x,a)}return this._calculate(i.expression.evaluate(new Vr(Math.floor(a.zoom-1),a)),i.expression.evaluate(new Vr(Math.floor(a.zoom),a)),i.expression.evaluate(new Vr(Math.floor(a.zoom+1),a)),a)}}_calculate(i,a,d,y){return y.zoom>y.zoomHistory.lastIntegerZoom?{from:i,to:a}:{from:d,to:a}}interpolate(i){return i}}class Fd{constructor(i){this.specification=i}possiblyEvaluate(i,a,d,y){return!!i.expression.evaluate(a,null,{},d,y)}interpolate(){return!1}}class v{constructor(i){this.properties=i,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const a in i){const d=i[a];d.specification.overridable&&this.overridableProperties.push(a);const y=this.defaultPropertyValues[a]=new sl(d,void 0),x=this.defaultTransitionablePropertyValues[a]=new Cc(d);this.defaultTransitioningPropertyValues[a]=x.untransitioned(),this.defaultPossiblyEvaluatedValues[a]=y.possiblyEvaluate({})}}}St("DataDrivenProperty",Ut),St("DataConstantProperty",It),St("CrossFadedDataDrivenProperty",Pc),St("CrossFadedProperty",Mc),St("ColorRampProperty",Fd);const r="-transition";class u extends Ue{constructor(i,a){if(super(),this.id=i.id,this.type=i.type,this._featureFilter={filter:()=>!0,needGeometry:!1},i.type!=="custom"&&(this.metadata=i.metadata,this.minzoom=i.minzoom,this.maxzoom=i.maxzoom,i.type!=="background"&&(this.source=i.source,this.sourceLayer=i["source-layer"],this.filter=i.filter),a.layout&&(this._unevaluatedLayout=new cu(a.layout)),a.paint)){this._transitionablePaint=new Ic(a.paint);for(const d in i.paint)this.setPaintProperty(d,i.paint[d],{validate:!1});for(const d in i.layout)this.setLayoutProperty(d,i.layout[d],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new hu(a.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(i){return i==="visibility"?this.visibility:this._unevaluatedLayout.getValue(i)}setLayoutProperty(i,a,d={}){a!=null&&this._validate(im,`layers.${this.id}.layout.${i}`,i,a,d)||(i!=="visibility"?this._unevaluatedLayout.setValue(i,a):this.visibility=a)}getPaintProperty(i){return i.endsWith(r)?this._transitionablePaint.getTransition(i.slice(0,-11)):this._transitionablePaint.getValue(i)}setPaintProperty(i,a,d={}){if(a!=null&&this._validate(nm,`layers.${this.id}.paint.${i}`,i,a,d))return!1;if(i.endsWith(r))return this._transitionablePaint.setTransition(i.slice(0,-11),a||void 0),!1;{const y=this._transitionablePaint._values[i],x=y.property.specification["property-type"]==="cross-faded-data-driven",w=y.value.isDataDriven(),b=y.value;this._transitionablePaint.setValue(i,a),this._handleSpecialPaintPropertyUpdate(i);const k=this._transitionablePaint._values[i].value;return k.isDataDriven()||w||x||this._handleOverridablePaintPropertyUpdate(i,b,k)}}_handleSpecialPaintPropertyUpdate(i){}_handleOverridablePaintPropertyUpdate(i,a,d){return!1}isHidden(i){return!!(this.minzoom&&i=this.maxzoom)||this.visibility==="none"}updateTransitions(i){this._transitioningPaint=this._transitionablePaint.transitioned(i,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(i,a){i.getCrossfadeParameters&&(this._crossfadeParameters=i.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(i,void 0,a)),this.paint=this._transitioningPaint.possiblyEvaluate(i,void 0,a)}serialize(){const i={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&&(i.layout=i.layout||{},i.layout.visibility=this.visibility),Ge(i,(a,d)=>!(a===void 0||d==="layout"&&!Object.keys(a).length||d==="paint"&&!Object.keys(a).length))}_validate(i,a,d,y,x={}){return(!x||x.validate!==!1)&&Md(this,i.call(ua,{key:a,layerType:this.type,objectKey:d,value:y,styleSpec:ie,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const i in this.paint._values){const a=this.paint.get(i);if(a instanceof Hs&&Za(a.property.specification)&&(a.value.kind==="source"||a.value.kind==="composite")&&a.value.isStateDependent)return!0}return!1}}const p={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class m{constructor(i,a){this._structArray=i,this._pos1=a*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(i,a){return i._trim(),a&&(i.isTransferred=!0,a.push(i.arrayBuffer)),{length:i.length,arrayBuffer:i.arrayBuffer}}static deserialize(i){const a=Object.create(this.prototype);return a.arrayBuffer=i.arrayBuffer,a.length=i.length,a.capacity=i.arrayBuffer.byteLength/a.bytesPerElement,a._refreshViews(),a}_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(i){this.reserve(i),this.length=i}reserve(i){if(i>this.capacity){this.capacity=Math.max(i,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const a=this.uint8;this._refreshViews(),a&&this.uint8.set(a)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function S(s,i=1){let a=0,d=0;return{members:s.map(y=>{const x=p[y.type].BYTES_PER_ELEMENT,w=a=E(a,Math.max(i,x)),b=y.components||1;return d=Math.max(d,x),a+=x*b,{name:y.name,type:y.type,components:b,offset:w}}),size:E(a,Math.max(d,i)),alignment:i}}function E(s,i){return Math.ceil(s/i)*i}class C extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,a){const d=this.length;return this.resize(d+1),this.emplace(d,i,a)}emplace(i,a,d){const y=2*i;return this.int16[y+0]=a,this.int16[y+1]=d,i}}C.prototype.bytesPerElement=4,St("StructArrayLayout2i4",C);class R extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,a,d){const y=this.length;return this.resize(y+1),this.emplace(y,i,a,d)}emplace(i,a,d,y){const x=3*i;return this.int16[x+0]=a,this.int16[x+1]=d,this.int16[x+2]=y,i}}R.prototype.bytesPerElement=6,St("StructArrayLayout3i6",R);class B extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,a,d,y){const x=this.length;return this.resize(x+1),this.emplace(x,i,a,d,y)}emplace(i,a,d,y,x){const w=4*i;return this.int16[w+0]=a,this.int16[w+1]=d,this.int16[w+2]=y,this.int16[w+3]=x,i}}B.prototype.bytesPerElement=8,St("StructArrayLayout4i8",B);class N extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,a,d,y,x,w){const b=this.length;return this.resize(b+1),this.emplace(b,i,a,d,y,x,w)}emplace(i,a,d,y,x,w,b){const k=6*i;return this.int16[k+0]=a,this.int16[k+1]=d,this.int16[k+2]=y,this.int16[k+3]=x,this.int16[k+4]=w,this.int16[k+5]=b,i}}N.prototype.bytesPerElement=12,St("StructArrayLayout2i4i12",N);class X extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,a,d,y,x,w){const b=this.length;return this.resize(b+1),this.emplace(b,i,a,d,y,x,w)}emplace(i,a,d,y,x,w,b){const k=4*i,P=8*i;return this.int16[k+0]=a,this.int16[k+1]=d,this.uint8[P+4]=y,this.uint8[P+5]=x,this.uint8[P+6]=w,this.uint8[P+7]=b,i}}X.prototype.bytesPerElement=8,St("StructArrayLayout2i4ub8",X);class ee extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,a){const d=this.length;return this.resize(d+1),this.emplace(d,i,a)}emplace(i,a,d){const y=2*i;return this.float32[y+0]=a,this.float32[y+1]=d,i}}ee.prototype.bytesPerElement=8,St("StructArrayLayout2f8",ee);class re extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,a,d,y,x,w,b,k,P,D){const L=this.length;return this.resize(L+1),this.emplace(L,i,a,d,y,x,w,b,k,P,D)}emplace(i,a,d,y,x,w,b,k,P,D,L){const j=10*i;return this.uint16[j+0]=a,this.uint16[j+1]=d,this.uint16[j+2]=y,this.uint16[j+3]=x,this.uint16[j+4]=w,this.uint16[j+5]=b,this.uint16[j+6]=k,this.uint16[j+7]=P,this.uint16[j+8]=D,this.uint16[j+9]=L,i}}re.prototype.bytesPerElement=20,St("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(i,a,d,y,x,w,b,k,P,D,L,j){const q=this.length;return this.resize(q+1),this.emplace(q,i,a,d,y,x,w,b,k,P,D,L,j)}emplace(i,a,d,y,x,w,b,k,P,D,L,j,q){const K=12*i;return this.int16[K+0]=a,this.int16[K+1]=d,this.int16[K+2]=y,this.int16[K+3]=x,this.uint16[K+4]=w,this.uint16[K+5]=b,this.uint16[K+6]=k,this.uint16[K+7]=P,this.int16[K+8]=D,this.int16[K+9]=L,this.int16[K+10]=j,this.int16[K+11]=q,i}}ce.prototype.bytesPerElement=24,St("StructArrayLayout4i4ui4i24",ce);class pe extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,a,d){const y=this.length;return this.resize(y+1),this.emplace(y,i,a,d)}emplace(i,a,d,y){const x=3*i;return this.float32[x+0]=a,this.float32[x+1]=d,this.float32[x+2]=y,i}}pe.prototype.bytesPerElement=12,St("StructArrayLayout3f12",pe);class me extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(i){const a=this.length;return this.resize(a+1),this.emplace(a,i)}emplace(i,a){return this.uint32[1*i+0]=a,i}}me.prototype.bytesPerElement=4,St("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(i,a,d,y,x,w,b,k,P){const D=this.length;return this.resize(D+1),this.emplace(D,i,a,d,y,x,w,b,k,P)}emplace(i,a,d,y,x,w,b,k,P,D){const L=10*i,j=5*i;return this.int16[L+0]=a,this.int16[L+1]=d,this.int16[L+2]=y,this.int16[L+3]=x,this.int16[L+4]=w,this.int16[L+5]=b,this.uint32[j+3]=k,this.uint16[L+8]=P,this.uint16[L+9]=D,i}}we.prototype.bytesPerElement=20,St("StructArrayLayout6i1ul2ui20",we);class ae extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,a,d,y,x,w){const b=this.length;return this.resize(b+1),this.emplace(b,i,a,d,y,x,w)}emplace(i,a,d,y,x,w,b){const k=6*i;return this.int16[k+0]=a,this.int16[k+1]=d,this.int16[k+2]=y,this.int16[k+3]=x,this.int16[k+4]=w,this.int16[k+5]=b,i}}ae.prototype.bytesPerElement=12,St("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(i,a,d,y,x){const w=this.length;return this.resize(w+1),this.emplace(w,i,a,d,y,x)}emplace(i,a,d,y,x,w){const b=4*i,k=8*i;return this.float32[b+0]=a,this.float32[b+1]=d,this.float32[b+2]=y,this.int16[k+6]=x,this.int16[k+7]=w,i}}Ce.prototype.bytesPerElement=16,St("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(i,a,d,y,x,w){const b=this.length;return this.resize(b+1),this.emplace(b,i,a,d,y,x,w)}emplace(i,a,d,y,x,w,b){const k=16*i,P=4*i,D=8*i;return this.uint8[k+0]=a,this.uint8[k+1]=d,this.float32[P+1]=y,this.float32[P+2]=x,this.int16[D+6]=w,this.int16[D+7]=b,i}}Pe.prototype.bytesPerElement=16,St("StructArrayLayout2ub2f2i16",Pe);class ze extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,a,d){const y=this.length;return this.resize(y+1),this.emplace(y,i,a,d)}emplace(i,a,d,y){const x=3*i;return this.uint16[x+0]=a,this.uint16[x+1]=d,this.uint16[x+2]=y,i}}ze.prototype.bytesPerElement=6,St("StructArrayLayout3ui6",ze);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(i,a,d,y,x,w,b,k,P,D,L,j,q,K,Q,le,fe){const De=this.length;return this.resize(De+1),this.emplace(De,i,a,d,y,x,w,b,k,P,D,L,j,q,K,Q,le,fe)}emplace(i,a,d,y,x,w,b,k,P,D,L,j,q,K,Q,le,fe,De){const be=24*i,Me=12*i,Ve=48*i;return this.int16[be+0]=a,this.int16[be+1]=d,this.uint16[be+2]=y,this.uint16[be+3]=x,this.uint32[Me+2]=w,this.uint32[Me+3]=b,this.uint32[Me+4]=k,this.uint16[be+10]=P,this.uint16[be+11]=D,this.uint16[be+12]=L,this.float32[Me+7]=j,this.float32[Me+8]=q,this.uint8[Ve+36]=K,this.uint8[Ve+37]=Q,this.uint8[Ve+38]=le,this.uint32[Me+10]=fe,this.int16[be+22]=De,i}}Xe.prototype.bytesPerElement=48,St("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Xe);class st 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(i,a,d,y,x,w,b,k,P,D,L,j,q,K,Q,le,fe,De,be,Me,Ve,et,xt,Nt,yt,pt,At,Tt){const bt=this.length;return this.resize(bt+1),this.emplace(bt,i,a,d,y,x,w,b,k,P,D,L,j,q,K,Q,le,fe,De,be,Me,Ve,et,xt,Nt,yt,pt,At,Tt)}emplace(i,a,d,y,x,w,b,k,P,D,L,j,q,K,Q,le,fe,De,be,Me,Ve,et,xt,Nt,yt,pt,At,Tt,bt){const Ye=32*i,Dt=16*i;return this.int16[Ye+0]=a,this.int16[Ye+1]=d,this.int16[Ye+2]=y,this.int16[Ye+3]=x,this.int16[Ye+4]=w,this.int16[Ye+5]=b,this.int16[Ye+6]=k,this.int16[Ye+7]=P,this.uint16[Ye+8]=D,this.uint16[Ye+9]=L,this.uint16[Ye+10]=j,this.uint16[Ye+11]=q,this.uint16[Ye+12]=K,this.uint16[Ye+13]=Q,this.uint16[Ye+14]=le,this.uint16[Ye+15]=fe,this.uint16[Ye+16]=De,this.uint16[Ye+17]=be,this.uint16[Ye+18]=Me,this.uint16[Ye+19]=Ve,this.uint16[Ye+20]=et,this.uint16[Ye+21]=xt,this.uint16[Ye+22]=Nt,this.uint32[Dt+12]=yt,this.float32[Dt+13]=pt,this.float32[Dt+14]=At,this.uint16[Ye+30]=Tt,this.uint16[Ye+31]=bt,i}}st.prototype.bytesPerElement=64,St("StructArrayLayout8i15ui1ul2f2ui64",st);class gt extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i){const a=this.length;return this.resize(a+1),this.emplace(a,i)}emplace(i,a){return this.float32[1*i+0]=a,i}}gt.prototype.bytesPerElement=4,St("StructArrayLayout1f4",gt);class wt extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,a,d){const y=this.length;return this.resize(y+1),this.emplace(y,i,a,d)}emplace(i,a,d,y){const x=3*i;return this.uint16[6*i+0]=a,this.float32[x+1]=d,this.float32[x+2]=y,i}}wt.prototype.bytesPerElement=12,St("StructArrayLayout1ui2f12",wt);class dt extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,a,d){const y=this.length;return this.resize(y+1),this.emplace(y,i,a,d)}emplace(i,a,d,y){const x=4*i;return this.uint32[2*i+0]=a,this.uint16[x+2]=d,this.uint16[x+3]=y,i}}dt.prototype.bytesPerElement=8,St("StructArrayLayout1ul2ui8",dt);class ct extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,a){const d=this.length;return this.resize(d+1),this.emplace(d,i,a)}emplace(i,a,d){const y=2*i;return this.uint16[y+0]=a,this.uint16[y+1]=d,i}}ct.prototype.bytesPerElement=4,St("StructArrayLayout2ui4",ct);class Pt extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i){const a=this.length;return this.resize(a+1),this.emplace(a,i)}emplace(i,a){return this.uint16[1*i+0]=a,i}}Pt.prototype.bytesPerElement=2,St("StructArrayLayout1ui2",Pt);class qt extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,a,d,y){const x=this.length;return this.resize(x+1),this.emplace(x,i,a,d,y)}emplace(i,a,d,y,x){const w=4*i;return this.float32[w+0]=a,this.float32[w+1]=d,this.float32[w+2]=y,this.float32[w+3]=x,i}}qt.prototype.bytesPerElement=16,St("StructArrayLayout4f16",qt);class ft extends m{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 A(this.anchorPointX,this.anchorPointY)}}ft.prototype.size=20;class _t extends we{get(i){return new ft(this,i)}}St("CollisionBoxArray",_t);class Gt extends m{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(i){this._structArray.uint8[this._pos1+37]=i}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(i){this._structArray.uint8[this._pos1+38]=i}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(i){this._structArray.uint32[this._pos4+10]=i}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}Gt.prototype.size=48;class Hr extends Xe{get(i){return new Gt(this,i)}}St("PlacedSymbolArray",Hr);class tr extends m{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(i){this._structArray.uint32[this._pos4+12]=i}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]}}tr.prototype.size=64;class ar extends st{get(i){return new tr(this,i)}}St("SymbolInstanceArray",ar);class Wr extends gt{getoffsetX(i){return this.float32[1*i+0]}}St("GlyphOffsetArray",Wr);class Gn extends R{getx(i){return this.int16[3*i+0]}gety(i){return this.int16[3*i+1]}gettileUnitDistanceFromAnchor(i){return this.int16[3*i+2]}}St("SymbolLineVertexArray",Gn);class xs extends m{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]}}xs.prototype.size=12;class Gr extends wt{get(i){return new xs(this,i)}}St("TextAnchorOffsetArray",Gr);class _i extends m{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]}}_i.prototype.size=8;class ii extends dt{get(i){return new _i(this,i)}}St("FeatureIndexArray",ii);class Zn extends C{}class si extends C{}class Ws extends C{}class ol extends N{}class Ac extends X{}class al extends ee{}class es extends re{}class Dc extends ce{}class Bd extends pe{}class ts extends me{}class rs extends ae{}class Ao extends Pe{}class ws extends ze{}class Nn extends ct{}const qn=S([{name:"a_pos",components:2,type:"Int16"}],4),{members:Li}=qn;class cr{constructor(i=[]){this.segments=i}prepareSegment(i,a,d,y){let x=this.segments[this.segments.length-1];return i>cr.MAX_VERTEX_ARRAY_LENGTH&&je(`Max vertices per segment is ${cr.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${i}`),(!x||x.vertexLength+i>cr.MAX_VERTEX_ARRAY_LENGTH||x.sortKey!==y)&&(x={vertexOffset:a.length,primitiveOffset:d.length,vertexLength:0,primitiveLength:0},y!==void 0&&(x.sortKey=y),this.segments.push(x)),x}get(){return this.segments}destroy(){for(const i of this.segments)for(const a in i.vaos)i.vaos[a].destroy()}static simpleSegment(i,a,d,y){return new cr([{vertexOffset:i,primitiveOffset:a,vertexLength:d,primitiveLength:y,vaos:{},sortKey:0}])}}function ca(s,i){return 256*(s=oe(Math.floor(s),0,255))+oe(Math.floor(i),0,255)}cr.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,St("SegmentVector",cr);const ll=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 ul={exports:{}},um={exports:{}};um.exports=function(s,i){var a,d,y,x,w,b,k,P;for(d=s.length-(a=3&s.length),y=i,w=3432918353,b=461845907,P=0;P>>16)*w&65535)<<16)&4294967295)<<15|k>>>17))*b+(((k>>>16)*b&65535)<<16)&4294967295)<<13|y>>>19))+((5*(y>>>16)&65535)<<16)&4294967295))+((58964+(x>>>16)&65535)<<16);switch(k=0,a){case 3:k^=(255&s.charCodeAt(P+2))<<16;case 2:k^=(255&s.charCodeAt(P+1))<<8;case 1:y^=k=(65535&(k=(k=(65535&(k^=255&s.charCodeAt(P)))*w+(((k>>>16)*w&65535)<<16)&4294967295)<<15|k>>>17))*b+(((k>>>16)*b&65535)<<16)&4294967295}return y^=s.length,y=2246822507*(65535&(y^=y>>>16))+((2246822507*(y>>>16)&65535)<<16)&4294967295,y=3266489909*(65535&(y^=y>>>13))+((3266489909*(y>>>16)&65535)<<16)&4294967295,(y^=y>>>16)>>>0};var t0=um.exports,cm={exports:{}};cm.exports=function(s,i){for(var a,d=s.length,y=i^d,x=0;d>=4;)a=1540483477*(65535&(a=255&s.charCodeAt(x)|(255&s.charCodeAt(++x))<<8|(255&s.charCodeAt(++x))<<16|(255&s.charCodeAt(++x))<<24))+((1540483477*(a>>>16)&65535)<<16),y=1540483477*(65535&y)+((1540483477*(y>>>16)&65535)<<16)^(a=1540483477*(65535&(a^=a>>>24))+((1540483477*(a>>>16)&65535)<<16)),d-=4,++x;switch(d){case 3:y^=(255&s.charCodeAt(x+2))<<16;case 2:y^=(255&s.charCodeAt(x+1))<<8;case 1:y=1540483477*(65535&(y^=255&s.charCodeAt(x)))+((1540483477*(y>>>16)&65535)<<16)}return y=1540483477*(65535&(y^=y>>>13))+((1540483477*(y>>>16)&65535)<<16),(y^=y>>>15)>>>0};var Do=t0,hm=cm.exports;ul.exports=Do,ul.exports.murmur3=Do,ul.exports.murmur2=hm;var zc=T(ul.exports);class du{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(i,a,d,y){this.ids.push(Rc(i)),this.positions.push(a,d,y)}getPositions(i){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const a=Rc(i);let d=0,y=this.ids.length-1;for(;d>1;this.ids[w]>=a?y=w:d=w+1}const x=[];for(;this.ids[d]===a;)x.push({index:this.positions[3*d],start:this.positions[3*d+1],end:this.positions[3*d+2]}),d++;return x}static serialize(i,a){const d=new Float64Array(i.ids),y=new Uint32Array(i.positions);return Lc(d,y,0,d.length-1),a&&a.push(d.buffer,y.buffer),{ids:d,positions:y}}static deserialize(i){const a=new du;return a.ids=i.ids,a.positions=i.positions,a.indexed=!0,a}}function Rc(s){const i=+s;return!isNaN(i)&&i<=Number.MAX_SAFE_INTEGER?i:zc(String(s))}function Lc(s,i,a,d){for(;a>1];let x=a-1,w=d+1;for(;;){do x++;while(s[x]y);if(x>=w)break;cl(s,x,w),cl(i,3*x,3*w),cl(i,3*x+1,3*w+1),cl(i,3*x+2,3*w+2)}w-a`u_${y}`),this.type=d}setUniform(i,a,d){i.set(d.constantOr(this.value))}getBinding(i,a,d){return this.type==="color"?new _b(i,a):new dm(i,a)}}class Oc{constructor(i,a){this.uniformNames=a.map(d=>`u_${d}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(i,a){this.pixelRatioFrom=a.pixelRatio,this.pixelRatioTo=i.pixelRatio,this.patternFrom=a.tlbr,this.patternTo=i.tlbr}setUniform(i,a,d,y){const x=y==="u_pattern_to"?this.patternTo:y==="u_pattern_from"?this.patternFrom:y==="u_pixel_ratio_to"?this.pixelRatioTo:y==="u_pixel_ratio_from"?this.pixelRatioFrom:null;x&&i.set(x)}getBinding(i,a,d){return d.substr(0,9)==="u_pattern"?new yb(i,a):new dm(i,a)}}class ha{constructor(i,a,d,y){this.expression=i,this.type=d,this.maxValue=0,this.paintVertexAttributes=a.map(x=>({name:`a_${x}`,type:"Float32",components:d==="color"?2:1,offset:0})),this.paintVertexArray=new y}populatePaintArray(i,a,d,y,x){const w=this.paintVertexArray.length,b=this.expression.evaluate(new Vr(0),a,{},y,[],x);this.paintVertexArray.resize(i),this._setPaintValue(w,i,b)}updatePaintArray(i,a,d,y){const x=this.expression.evaluate({zoom:0},d,y);this._setPaintValue(i,a,x)}_setPaintValue(i,a,d){if(this.type==="color"){const y=r0(d);for(let x=i;x`u_${b}_t`),this.type=d,this.useIntegerZoom=y,this.zoom=x,this.maxValue=0,this.paintVertexAttributes=a.map(b=>({name:`a_${b}`,type:"Float32",components:d==="color"?4:2,offset:0})),this.paintVertexArray=new w}populatePaintArray(i,a,d,y,x){const w=this.expression.evaluate(new Vr(this.zoom),a,{},y,[],x),b=this.expression.evaluate(new Vr(this.zoom+1),a,{},y,[],x),k=this.paintVertexArray.length;this.paintVertexArray.resize(i),this._setPaintValue(k,i,w,b)}updatePaintArray(i,a,d,y){const x=this.expression.evaluate({zoom:this.zoom},d,y),w=this.expression.evaluate({zoom:this.zoom+1},d,y);this._setPaintValue(i,a,x,w)}_setPaintValue(i,a,d,y){if(this.type==="color"){const x=r0(d),w=r0(y);for(let b=i;b`#define HAS_UNIFORM_${y}`))}return i}getBinderAttributes(){const i=[];for(const a in this.binders){const d=this.binders[a];if(d instanceof ha||d instanceof uo)for(let y=0;y!0){this.programConfigurations={};for(const y of i)this.programConfigurations[y.id]=new vb(y,a,d);this.needsUpload=!1,this._featureMap=new du,this._bufferOffset=0}populatePaintArrays(i,a,d,y,x,w){for(const b in this.programConfigurations)this.programConfigurations[b].populatePaintArrays(i,a,y,x,w);a.id!==void 0&&this._featureMap.add(a.id,d,this._bufferOffset,i),this._bufferOffset=i,this.needsUpload=!0}updatePaintArrays(i,a,d,y){for(const x of d)this.needsUpload=this.programConfigurations[x.id].updatePaintArrays(i,this._featureMap,a,x,y)||this.needsUpload}get(i){return this.programConfigurations[i]}upload(i){if(this.needsUpload){for(const a in this.programConfigurations)this.programConfigurations[a].upload(i);this.needsUpload=!1}}destroy(){for(const i in this.programConfigurations)this.programConfigurations[i].destroy()}}function EA(s,i){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"]}[s]||[s.replace(`${i}-`,"").replace(/-/g,"_")]}function xb(s,i,a){const d={color:{source:ee,composite:qt},number:{source:gt,composite:ee}},y=function(x){return{"line-pattern":{source:es,composite:es},"fill-pattern":{source:es,composite:es},"fill-extrusion-pattern":{source:es,composite:es}}[x]}(s);return y&&y[a]||d[i][a]}St("ConstantBinder",Nd),St("CrossFadedConstantBinder",Oc),St("SourceExpressionBinder",ha),St("CrossFadedCompositeBinder",hl),St("CompositeExpressionBinder",uo),St("ProgramConfiguration",vb,{omit:["_buffers"]}),St("ProgramConfigurationSet",pu);const Cn=8192,n0=Math.pow(2,14)-1,wb=-n0-1;function mu(s){const i=Cn/s.extent,a=s.loadGeometry();for(let d=0;dw.x+1||kw.y+1)&&je("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return a}function gu(s,i){return{type:s.type,id:s.id,properties:s.properties,geometry:i?mu(s):[]}}function fm(s,i,a,d,y){s.emplaceBack(2*i+(d+1)/2,2*a+(y+1)/2)}class i0{constructor(i){this.zoom=i.zoom,this.overscaling=i.overscaling,this.layers=i.layers,this.layerIds=this.layers.map(a=>a.id),this.index=i.index,this.hasPattern=!1,this.layoutVertexArray=new si,this.indexArray=new ws,this.segments=new cr,this.programConfigurations=new pu(i.layers,i.zoom),this.stateDependentLayerIds=this.layers.filter(a=>a.isStateDependent()).map(a=>a.id)}populate(i,a,d){const y=this.layers[0],x=[];let w=null,b=!1;y.type==="circle"&&(w=y.layout.get("circle-sort-key"),b=!w.isConstant());for(const{feature:k,id:P,index:D,sourceLayerIndex:L}of i){const j=this.layers[0]._featureFilter.needGeometry,q=gu(k,j);if(!this.layers[0]._featureFilter.filter(new Vr(this.zoom),q,d))continue;const K=b?w.evaluate(q,{},d):void 0,Q={id:P,properties:k.properties,type:k.type,sourceLayerIndex:L,index:D,geometry:j?q.geometry:mu(k),patterns:{},sortKey:K};x.push(Q)}b&&x.sort((k,P)=>k.sortKey-P.sortKey);for(const k of x){const{geometry:P,index:D,sourceLayerIndex:L}=k,j=i[D].feature;this.addFeature(k,P,D,d),a.featureIndex.insert(j,P,D,L,this.index)}}update(i,a,d){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(i,a,this.stateDependentLayers,d)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(i){this.uploaded||(this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,Li),this.indexBuffer=i.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(i),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(i,a,d,y){for(const x of a)for(const w of x){const b=w.x,k=w.y;if(b<0||b>=Cn||k<0||k>=Cn)continue;const P=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,i.sortKey),D=P.vertexLength;fm(this.layoutVertexArray,b,k,-1,-1),fm(this.layoutVertexArray,b,k,1,-1),fm(this.layoutVertexArray,b,k,1,1),fm(this.layoutVertexArray,b,k,-1,1),this.indexArray.emplaceBack(D,D+1,D+2),this.indexArray.emplaceBack(D,D+3,D+2),P.vertexLength+=4,P.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,i,d,{},y)}}function bb(s,i){for(let a=0;a1){if(s0(s,i))return!0;for(let d=0;d1?a:a.sub(i)._mult(y)._add(i))}function Tb(s,i){let a,d,y,x=!1;for(let w=0;wi.y!=y.y>i.y&&i.x<(y.x-d.x)*(i.y-d.y)/(y.y-d.y)+d.x&&(x=!x)}return x}function Fc(s,i){let a=!1;for(let d=0,y=s.length-1;di.y!=w.y>i.y&&i.x<(w.x-x.x)*(i.y-x.y)/(w.y-x.y)+x.x&&(a=!a)}return a}function MA(s,i,a){const d=a[0],y=a[2];if(s.xy.x&&i.x>y.x||s.yy.y&&i.y>y.y)return!1;const x=H(s,i,a[0]);return x!==H(s,i,a[1])||x!==H(s,i,a[2])||x!==H(s,i,a[3])}function $d(s,i,a){const d=i.paint.get(s).value;return d.kind==="constant"?d.value:a.programConfigurations.get(i.id).getMaxValue(s)}function pm(s){return Math.sqrt(s[0]*s[0]+s[1]*s[1])}function mm(s,i,a,d,y){if(!i[0]&&!i[1])return s;const x=A.convert(i)._mult(y);a==="viewport"&&x._rotate(-d);const w=[];for(let b=0;bPb(le,Q))}(P,k),q=L?D*b:D;for(const K of y)for(const Q of K){const le=L?Q:Pb(Q,k);let fe=q;const De=gm([],[Q.x,Q.y,0,1],k);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?fe*=De[3]/w.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(fe*=w.cameraToCenterDistance/De[3]),CA(j,le,fe))return!0}return!1}}function Pb(s,i){const a=gm([],[s.x,s.y,0,1],i);return new A(a[0]/a[3],a[1]/a[3])}class Mb extends i0{}let Ab;St("HeatmapBucket",Mb,{omit:["layers"]});var RA={get paint(){return Ab=Ab||new v({"heatmap-radius":new Ut(ie.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Ut(ie.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new It(ie.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Fd(ie.paint_heatmap["heatmap-color"]),"heatmap-opacity":new It(ie.paint_heatmap["heatmap-opacity"])})}};function l0(s,{width:i,height:a},d,y){if(y){if(y instanceof Uint8ClampedArray)y=new Uint8Array(y.buffer);else if(y.length!==i*a*d)throw new RangeError(`mismatched image size. expected: ${y.length} but got: ${i*a*d}`)}else y=new Uint8Array(i*a*d);return s.width=i,s.height=a,s.data=y,s}function Db(s,{width:i,height:a},d){if(i===s.width&&a===s.height)return;const y=l0({},{width:i,height:a},d);u0(s,y,{x:0,y:0},{x:0,y:0},{width:Math.min(s.width,i),height:Math.min(s.height,a)},d),s.width=i,s.height=a,s.data=y.data}function u0(s,i,a,d,y,x){if(y.width===0||y.height===0)return i;if(y.width>s.width||y.height>s.height||a.x>s.width-y.width||a.y>s.height-y.height)throw new RangeError("out of range source coordinates for image copy");if(y.width>i.width||y.height>i.height||d.x>i.width-y.width||d.y>i.height-y.height)throw new RangeError("out of range destination coordinates for image copy");const w=s.data,b=i.data;if(w===b)throw new Error("srcData equals dstData, so image is already copied");for(let k=0;k{i[s.evaluationKey]=k;const P=s.expression.evaluate(i);y.data[w+b+0]=Math.floor(255*P.r/P.a),y.data[w+b+1]=Math.floor(255*P.g/P.a),y.data[w+b+2]=Math.floor(255*P.b/P.a),y.data[w+b+3]=Math.floor(255*P.a)};if(s.clips)for(let w=0,b=0;w80*a){b=1/0,k=1/0;let D=-1/0,L=-1/0;for(let j=a;jD&&(D=q),K>L&&(L=K)}P=Math.max(D-b,L-k),P=P!==0?32767/P:0}return Vd(x,w,a,b,k,P,0),w}function Ob(s,i,a,d,y){let x;if(y===function(w,b,k,P){let D=0;for(let L=b,j=k-P;L0)for(let w=i;w=i;w-=d)x=Nb(w/d|0,s[w],s[w+1],x);return x&&ym(x,x.next)&&(Wd(x),x=x.next),x}function yu(s,i){if(!s)return s;i||(i=s);let a,d=s;do if(a=!1,d.steiner||!ym(d,d.next)&&wn(d.prev,d,d.next)!==0)d=d.next;else{if(Wd(d),d=i=d.prev,d===d.next)break;a=!0}while(a||d!==i);return i}function Vd(s,i,a,d,y,x,w){if(!s)return;!w&&x&&function(k,P,D,L){let j=k;do j.z===0&&(j.z=h0(j.x,j.y,P,D,L)),j.prevZ=j.prev,j.nextZ=j.next,j=j.next;while(j!==k);j.prevZ.nextZ=null,j.prevZ=null,function(q){let K,Q=1;do{let le,fe=q;q=null;let De=null;for(K=0;fe;){K++;let be=fe,Me=0;for(let et=0;et0||Ve>0&&be;)Me!==0&&(Ve===0||!be||fe.z<=be.z)?(le=fe,fe=fe.nextZ,Me--):(le=be,be=be.nextZ,Ve--),De?De.nextZ=le:q=le,le.prevZ=De,De=le;fe=be}De.nextZ=null,Q*=2}while(K>1)}(j)}(s,d,y,x);let b=s;for(;s.prev!==s.next;){const k=s.prev,P=s.next;if(x?jA(s,d,y,x):$A(s))i.push(k.i,s.i,P.i),Wd(s),s=P.next,b=P.next;else if((s=P)===b){w?w===1?Vd(s=UA(yu(s),i),i,a,d,y,x,2):w===2&&VA(s,i,a,d,y,x):Vd(yu(s),i,a,d,y,x,1);break}}}function $A(s){const i=s.prev,a=s,d=s.next;if(wn(i,a,d)>=0)return!1;const y=i.x,x=a.x,w=d.x,b=i.y,k=a.y,P=d.y,D=yx?y>w?y:w:x>w?x:w,q=b>k?b>P?b:P:k>P?k:P;let K=d.next;for(;K!==i;){if(K.x>=D&&K.x<=j&&K.y>=L&&K.y<=q&&Nc(y,b,x,k,w,P,K.x,K.y)&&wn(K.prev,K,K.next)>=0)return!1;K=K.next}return!0}function jA(s,i,a,d){const y=s.prev,x=s,w=s.next;if(wn(y,x,w)>=0)return!1;const b=y.x,k=x.x,P=w.x,D=y.y,L=x.y,j=w.y,q=bk?b>P?b:P:k>P?k:P,le=D>L?D>j?D:j:L>j?L:j,fe=h0(q,K,i,a,d),De=h0(Q,le,i,a,d);let be=s.prevZ,Me=s.nextZ;for(;be&&be.z>=fe&&Me&&Me.z<=De;){if(be.x>=q&&be.x<=Q&&be.y>=K&&be.y<=le&&be!==y&&be!==w&&Nc(b,D,k,L,P,j,be.x,be.y)&&wn(be.prev,be,be.next)>=0||(be=be.prevZ,Me.x>=q&&Me.x<=Q&&Me.y>=K&&Me.y<=le&&Me!==y&&Me!==w&&Nc(b,D,k,L,P,j,Me.x,Me.y)&&wn(Me.prev,Me,Me.next)>=0))return!1;Me=Me.nextZ}for(;be&&be.z>=fe;){if(be.x>=q&&be.x<=Q&&be.y>=K&&be.y<=le&&be!==y&&be!==w&&Nc(b,D,k,L,P,j,be.x,be.y)&&wn(be.prev,be,be.next)>=0)return!1;be=be.prevZ}for(;Me&&Me.z<=De;){if(Me.x>=q&&Me.x<=Q&&Me.y>=K&&Me.y<=le&&Me!==y&&Me!==w&&Nc(b,D,k,L,P,j,Me.x,Me.y)&&wn(Me.prev,Me,Me.next)>=0)return!1;Me=Me.nextZ}return!0}function UA(s,i){let a=s;do{const d=a.prev,y=a.next.next;!ym(d,y)&&Fb(d,a,a.next,y)&&Hd(d,y)&&Hd(y,d)&&(i.push(d.i,a.i,y.i),Wd(a),Wd(a.next),a=s=y),a=a.next}while(a!==s);return yu(a)}function VA(s,i,a,d,y,x){let w=s;do{let b=w.next.next;for(;b!==w.prev;){if(w.i!==b.i&&qA(w,b)){let k=Bb(w,b);return w=yu(w,w.next),k=yu(k,k.next),Vd(w,i,a,d,y,x,0),void Vd(k,i,a,d,y,x,0)}b=b.next}w=w.next}while(w!==s)}function HA(s,i){return s.x-i.x}function WA(s,i){const a=function(y,x){let w=x;const b=y.x,k=y.y;let P,D=-1/0;do{if(k<=w.y&&k>=w.next.y&&w.next.y!==w.y){const Q=w.x+(k-w.y)*(w.next.x-w.x)/(w.next.y-w.y);if(Q<=b&&Q>D&&(D=Q,P=w.x=w.x&&w.x>=j&&b!==w.x&&Nc(kP.x||w.x===P.x&&GA(P,w)))&&(P=w,K=Q)}w=w.next}while(w!==L);return P}(s,i);if(!a)return i;const d=Bb(a,s);return yu(d,d.next),yu(a,a.next)}function GA(s,i){return wn(s.prev,s,i.prev)<0&&wn(i.next,s,s.next)<0}function h0(s,i,a,d,y){return(s=1431655765&((s=858993459&((s=252645135&((s=16711935&((s=(s-a)*y|0)|s<<8))|s<<4))|s<<2))|s<<1))|(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=(i-d)*y|0)|i<<8))|i<<4))|i<<2))|i<<1))<<1}function ZA(s){let i=s,a=s;do(i.x=(s-w)*(x-b)&&(s-w)*(d-b)>=(a-w)*(i-b)&&(a-w)*(x-b)>=(y-w)*(d-b)}function qA(s,i){return s.next.i!==i.i&&s.prev.i!==i.i&&!function(a,d){let y=a;do{if(y.i!==a.i&&y.next.i!==a.i&&y.i!==d.i&&y.next.i!==d.i&&Fb(y,y.next,a,d))return!0;y=y.next}while(y!==a);return!1}(s,i)&&(Hd(s,i)&&Hd(i,s)&&function(a,d){let y=a,x=!1;const w=(a.x+d.x)/2,b=(a.y+d.y)/2;do y.y>b!=y.next.y>b&&y.next.y!==y.y&&w<(y.next.x-y.x)*(b-y.y)/(y.next.y-y.y)+y.x&&(x=!x),y=y.next;while(y!==a);return x}(s,i)&&(wn(s.prev,s,i.prev)||wn(s,i.prev,i))||ym(s,i)&&wn(s.prev,s,s.next)>0&&wn(i.prev,i,i.next)>0)}function wn(s,i,a){return(i.y-s.y)*(a.x-i.x)-(i.x-s.x)*(a.y-i.y)}function ym(s,i){return s.x===i.x&&s.y===i.y}function Fb(s,i,a,d){const y=vm(wn(s,i,a)),x=vm(wn(s,i,d)),w=vm(wn(a,d,s)),b=vm(wn(a,d,i));return y!==x&&w!==b||!(y!==0||!_m(s,a,i))||!(x!==0||!_m(s,d,i))||!(w!==0||!_m(a,s,d))||!(b!==0||!_m(a,i,d))}function _m(s,i,a){return i.x<=Math.max(s.x,a.x)&&i.x>=Math.min(s.x,a.x)&&i.y<=Math.max(s.y,a.y)&&i.y>=Math.min(s.y,a.y)}function vm(s){return s>0?1:s<0?-1:0}function Hd(s,i){return wn(s.prev,s,s.next)<0?wn(s,i,s.next)>=0&&wn(s,s.prev,i)>=0:wn(s,i,s.prev)<0||wn(s,s.next,i)<0}function Bb(s,i){const a=d0(s.i,s.x,s.y),d=d0(i.i,i.x,i.y),y=s.next,x=i.prev;return s.next=i,i.prev=s,a.next=y,y.prev=a,d.next=a,a.prev=d,x.next=d,d.prev=x,d}function Nb(s,i,a,d){const y=d0(s,i,a);return d?(y.next=d.next,y.prev=d,d.next.prev=y,d.next=y):(y.prev=y,y.next=y),y}function Wd(s){s.next.prev=s.prev,s.prev.next=s.next,s.prevZ&&(s.prevZ.nextZ=s.nextZ),s.nextZ&&(s.nextZ.prevZ=s.prevZ)}function d0(s,i,a){return{i:s,x:i,y:a,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function f0(s,i,a){const d=a.patternDependencies;let y=!1;for(const x of i){const w=x.paint.get(`${s}-pattern`);w.isConstant()||(y=!0);const b=w.constantOr(null);b&&(y=!0,d[b.to]=!0,d[b.from]=!0)}return y}function p0(s,i,a,d,y){const x=y.patternDependencies;for(const w of i){const b=w.paint.get(`${s}-pattern`).value;if(b.kind!=="constant"){let k=b.evaluate({zoom:d-1},a,{},y.availableImages),P=b.evaluate({zoom:d},a,{},y.availableImages),D=b.evaluate({zoom:d+1},a,{},y.availableImages);k=k&&k.name?k.name:k,P=P&&P.name?P.name:P,D=D&&D.name?D.name:D,x[k]=!0,x[P]=!0,x[D]=!0,a.patterns[w.id]={min:k,mid:P,max:D}}}return a}class m0{constructor(i){this.zoom=i.zoom,this.overscaling=i.overscaling,this.layers=i.layers,this.layerIds=this.layers.map(a=>a.id),this.index=i.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Ws,this.indexArray=new ws,this.indexArray2=new Nn,this.programConfigurations=new pu(i.layers,i.zoom),this.segments=new cr,this.segments2=new cr,this.stateDependentLayerIds=this.layers.filter(a=>a.isStateDependent()).map(a=>a.id)}populate(i,a,d){this.hasPattern=f0("fill",this.layers,a);const y=this.layers[0].layout.get("fill-sort-key"),x=!y.isConstant(),w=[];for(const{feature:b,id:k,index:P,sourceLayerIndex:D}of i){const L=this.layers[0]._featureFilter.needGeometry,j=gu(b,L);if(!this.layers[0]._featureFilter.filter(new Vr(this.zoom),j,d))continue;const q=x?y.evaluate(j,{},d,a.availableImages):void 0,K={id:k,properties:b.properties,type:b.type,sourceLayerIndex:D,index:P,geometry:L?j.geometry:mu(b),patterns:{},sortKey:q};w.push(K)}x&&w.sort((b,k)=>b.sortKey-k.sortKey);for(const b of w){const{geometry:k,index:P,sourceLayerIndex:D}=b;if(this.hasPattern){const L=p0("fill",this.layers,b,this.zoom,a);this.patternFeatures.push(L)}else this.addFeature(b,k,P,d,{});a.featureIndex.insert(i[P].feature,k,P,D,this.index)}}update(i,a,d){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(i,a,this.stateDependentLayers,d)}addFeatures(i,a,d){for(const y of this.patternFeatures)this.addFeature(y,y.geometry,y.index,a,d)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(i){this.uploaded||(this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,NA),this.indexBuffer=i.createIndexBuffer(this.indexArray),this.indexBuffer2=i.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(i),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(i,a,d,y,x){for(const w of uc(a,500)){let b=0;for(const q of w)b+=q.length;const k=this.segments.prepareSegment(b,this.layoutVertexArray,this.indexArray),P=k.vertexLength,D=[],L=[];for(const q of w){if(q.length===0)continue;q!==w[0]&&L.push(D.length/2);const K=this.segments2.prepareSegment(q.length,this.layoutVertexArray,this.indexArray2),Q=K.vertexLength;this.layoutVertexArray.emplaceBack(q[0].x,q[0].y),this.indexArray2.emplaceBack(Q+q.length-1,Q),D.push(q[0].x),D.push(q[0].y);for(let le=1;le>3}if(y--,d===1||d===2)x+=s.readSVarint(),w+=s.readSVarint(),d===1&&(i&&b.push(i),i=[]),i.push(new e3(x,w));else{if(d!==7)throw new Error("unknown command "+d);i&&i.push(i[0].clone())}}return i&&b.push(i),b},$c.prototype.bbox=function(){var s=this._pbf;s.pos=this._geometry;for(var i=s.readVarint()+s.pos,a=1,d=0,y=0,x=0,w=1/0,b=-1/0,k=1/0,P=-1/0;s.pos>3}if(d--,a===1||a===2)(y+=s.readSVarint())b&&(b=y),(x+=s.readSVarint())P&&(P=x);else if(a!==7)throw new Error("unknown command "+a)}return[w,k,b,P]},$c.prototype.toGeoJSON=function(s,i,a){var d,y,x=this.extent*Math.pow(2,a),w=this.extent*s,b=this.extent*i,k=this.loadGeometry(),P=$c.types[this.type];function D(q){for(var K=0;K>3;y=w===1?d.readString():w===2?d.readFloat():w===3?d.readDouble():w===4?d.readVarint64():w===5?d.readVarint():w===6?d.readSVarint():w===7?d.readBoolean():null}return y}(a))}Hb.prototype.feature=function(s){if(s<0||s>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[s];var i=this._pbf.readVarint()+this._pbf.pos;return new n3(this._pbf,i,this.extent,this._keys,this._values)};var s3=Vb;function o3(s,i,a){if(s===3){var d=new s3(a,a.readVarint()+a.pos);d.length&&(i[d.name]=d)}}dl.VectorTile=function(s,i){this.layers=s.readFields(o3,{},i)},dl.VectorTileFeature=Ub,dl.VectorTileLayer=Vb;const a3=dl.VectorTileFeature.types,g0=Math.pow(2,13);function Gd(s,i,a,d,y,x,w,b){s.emplaceBack(i,a,2*Math.floor(d*g0)+w,y*g0*2,x*g0*2,Math.round(b))}class y0{constructor(i){this.zoom=i.zoom,this.overscaling=i.overscaling,this.layers=i.layers,this.layerIds=this.layers.map(a=>a.id),this.index=i.index,this.hasPattern=!1,this.layoutVertexArray=new ol,this.centroidVertexArray=new Zn,this.indexArray=new ws,this.programConfigurations=new pu(i.layers,i.zoom),this.segments=new cr,this.stateDependentLayerIds=this.layers.filter(a=>a.isStateDependent()).map(a=>a.id)}populate(i,a,d){this.features=[],this.hasPattern=f0("fill-extrusion",this.layers,a);for(const{feature:y,id:x,index:w,sourceLayerIndex:b}of i){const k=this.layers[0]._featureFilter.needGeometry,P=gu(y,k);if(!this.layers[0]._featureFilter.filter(new Vr(this.zoom),P,d))continue;const D={id:x,sourceLayerIndex:b,index:w,geometry:k?P.geometry:mu(y),properties:y.properties,type:y.type,patterns:{}};this.hasPattern?this.features.push(p0("fill-extrusion",this.layers,D,this.zoom,a)):this.addFeature(D,D.geometry,w,d,{}),a.featureIndex.insert(y,D.geometry,w,b,this.index,!0)}}addFeatures(i,a,d){for(const y of this.features){const{geometry:x}=y;this.addFeature(y,x,y.index,a,d)}}update(i,a,d){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(i,a,this.stateDependentLayers,d)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(i){this.uploaded||(this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,QA),this.centroidVertexBuffer=i.createVertexBuffer(this.centroidVertexArray,JA.members,!0),this.indexBuffer=i.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(i),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(i,a,d,y,x){for(const w of uc(a,500)){const b={x:0,y:0,vertexCount:0};let k=0;for(const K of w)k+=K.length;let P=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const K of w){if(K.length===0||u3(K))continue;let Q=0;for(let le=0;le=1){const De=K[le-1];if(!l3(fe,De)){P.vertexLength+4>cr.MAX_VERTEX_ARRAY_LENGTH&&(P=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const be=fe.sub(De)._perp()._unit(),Me=De.dist(fe);Q+Me>32768&&(Q=0),Gd(this.layoutVertexArray,fe.x,fe.y,be.x,be.y,0,0,Q),Gd(this.layoutVertexArray,fe.x,fe.y,be.x,be.y,0,1,Q),b.x+=2*fe.x,b.y+=2*fe.y,b.vertexCount+=2,Q+=Me,Gd(this.layoutVertexArray,De.x,De.y,be.x,be.y,0,0,Q),Gd(this.layoutVertexArray,De.x,De.y,be.x,be.y,0,1,Q),b.x+=2*De.x,b.y+=2*De.y,b.vertexCount+=2;const Ve=P.vertexLength;this.indexArray.emplaceBack(Ve,Ve+2,Ve+1),this.indexArray.emplaceBack(Ve+1,Ve+2,Ve+3),P.vertexLength+=4,P.primitiveLength+=2}}}}if(P.vertexLength+k>cr.MAX_VERTEX_ARRAY_LENGTH&&(P=this.segments.prepareSegment(k,this.layoutVertexArray,this.indexArray)),a3[i.type]!=="Polygon")continue;const D=[],L=[],j=P.vertexLength;for(const K of w)if(K.length!==0){K!==w[0]&&L.push(D.length/2);for(let Q=0;QCn)||s.y===i.y&&(s.y<0||s.y>Cn)}function u3(s){return s.every(i=>i.x<0)||s.every(i=>i.x>Cn)||s.every(i=>i.y<0)||s.every(i=>i.y>Cn)}let Wb;St("FillExtrusionBucket",y0,{omit:["layers","features"]});var c3={get paint(){return Wb=Wb||new v({"fill-extrusion-opacity":new It(ie["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Ut(ie["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new It(ie["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new It(ie["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Pc(ie["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Ut(ie["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Ut(ie["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new It(ie["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class h3 extends u{constructor(i){super(i,c3)}createBucket(i){return new y0(i)}queryRadius(){return pm(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(i,a,d,y,x,w,b,k){const P=mm(i,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),w.angle,b),D=this.paint.get("fill-extrusion-height").evaluate(a,d),L=this.paint.get("fill-extrusion-base").evaluate(a,d),j=function(K,Q,le,fe){const De=[];for(const be of K){const Me=[be.x,be.y,0,1];gm(Me,Me,Q),De.push(new A(Me[0]/Me[3],Me[1]/Me[3]))}return De}(P,k),q=function(K,Q,le,fe){const De=[],be=[],Me=fe[8]*Q,Ve=fe[9]*Q,et=fe[10]*Q,xt=fe[11]*Q,Nt=fe[8]*le,yt=fe[9]*le,pt=fe[10]*le,At=fe[11]*le;for(const Tt of K){const bt=[],Ye=[];for(const Dt of Tt){const Mt=Dt.x,Zt=Dt.y,Fr=fe[0]*Mt+fe[4]*Zt+fe[12],Or=fe[1]*Mt+fe[5]*Zt+fe[13],zn=fe[2]*Mt+fe[6]*Zt+fe[14],Gs=fe[3]*Mt+fe[7]*Zt+fe[15],Xn=zn+et,Rn=Gs+xt,xi=Fr+Nt,wi=Or+yt,bi=zn+pt,mn=Gs+At,Ln=new A((Fr+Me)/Rn,(Or+Ve)/Rn);Ln.z=Xn/Rn,bt.push(Ln);const oi=new A(xi/mn,wi/mn);oi.z=bi/mn,Ye.push(oi)}De.push(bt),be.push(Ye)}return[De,be]}(y,L,D,k);return function(K,Q,le){let fe=1/0;Sb(le,Q)&&(fe=Gb(le,Q[0]));for(let De=0;Dea.id),this.index=i.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(a=>{this.gradients[a.id]={}}),this.layoutVertexArray=new Ac,this.layoutVertexArray2=new al,this.indexArray=new ws,this.programConfigurations=new pu(i.layers,i.zoom),this.segments=new cr,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(a=>a.isStateDependent()).map(a=>a.id)}populate(i,a,d){this.hasPattern=f0("line",this.layers,a);const y=this.layers[0].layout.get("line-sort-key"),x=!y.isConstant(),w=[];for(const{feature:b,id:k,index:P,sourceLayerIndex:D}of i){const L=this.layers[0]._featureFilter.needGeometry,j=gu(b,L);if(!this.layers[0]._featureFilter.filter(new Vr(this.zoom),j,d))continue;const q=x?y.evaluate(j,{},d):void 0,K={id:k,properties:b.properties,type:b.type,sourceLayerIndex:D,index:P,geometry:L?j.geometry:mu(b),patterns:{},sortKey:q};w.push(K)}x&&w.sort((b,k)=>b.sortKey-k.sortKey);for(const b of w){const{geometry:k,index:P,sourceLayerIndex:D}=b;if(this.hasPattern){const L=p0("line",this.layers,b,this.zoom,a);this.patternFeatures.push(L)}else this.addFeature(b,k,P,d,{});a.featureIndex.insert(i[P].feature,k,P,D,this.index)}}update(i,a,d){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(i,a,this.stateDependentLayers,d)}addFeatures(i,a,d){for(const y of this.patternFeatures)this.addFeature(y,y.geometry,y.index,a,d)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(i){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=i.createVertexBuffer(this.layoutVertexArray2,m3)),this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,f3),this.indexBuffer=i.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(i),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(i){if(i.properties&&Object.prototype.hasOwnProperty.call(i.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(i.properties,"mapbox_clip_end"))return{start:+i.properties.mapbox_clip_start,end:+i.properties.mapbox_clip_end}}addFeature(i,a,d,y,x){const w=this.layers[0].layout,b=w.get("line-join").evaluate(i,{}),k=w.get("line-cap"),P=w.get("line-miter-limit"),D=w.get("line-round-limit");this.lineClips=this.lineFeatureClips(i);for(const L of a)this.addLine(L,i,b,k,P,D);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,i,d,x,y)}addLine(i,a,d,y,x,w){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let fe=0;fe=2&&i[k-1].equals(i[k-2]);)k--;let P=0;for(;P0;if(xt&&fe>P){const At=j.dist(q);if(At>2*D){const Tt=j.sub(j.sub(q)._mult(D/At)._round());this.updateDistance(q,Tt),this.addCurrentVertex(Tt,Q,0,0,L),q=Tt}}const yt=q&&K;let pt=yt?d:b?"butt":y;if(yt&&pt==="round"&&(Vex&&(pt="bevel"),pt==="bevel"&&(Ve>2&&(pt="flipbevel"),Ve100)De=le.mult(-1);else{const At=Ve*Q.add(le).mag()/Q.sub(le).mag();De._perp()._mult(At*(Nt?-1:1))}this.addCurrentVertex(j,De,0,0,L),this.addCurrentVertex(j,De.mult(-1),0,0,L)}else if(pt==="bevel"||pt==="fakeround"){const At=-Math.sqrt(Ve*Ve-1),Tt=Nt?At:0,bt=Nt?0:At;if(q&&this.addCurrentVertex(j,Q,Tt,bt,L),pt==="fakeround"){const Ye=Math.round(180*et/Math.PI/20);for(let Dt=1;Dt2*D){const Tt=j.add(K.sub(j)._mult(D/At)._round());this.updateDistance(j,Tt),this.addCurrentVertex(Tt,le,0,0,L),j=Tt}}}}addCurrentVertex(i,a,d,y,x,w=!1){const b=a.y*y-a.x,k=-a.y-a.x*y;this.addHalfVertex(i,a.x+a.y*d,a.y-a.x*d,w,!1,d,x),this.addHalfVertex(i,b,k,w,!0,-y,x),this.distance>Zb/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(i,a,d,y,x,w))}addHalfVertex({x:i,y:a},d,y,x,w,b,k){const P=.5*(this.lineClips?this.scaledDistance*(Zb-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((i<<1)+(x?1:0),(a<<1)+(w?1:0),Math.round(63*d)+128,Math.round(63*y)+128,1+(b===0?0:b<0?-1:1)|(63&P)<<2,P>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const D=k.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,D),k.primitiveLength++),w?this.e2=D:this.e1=D}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(i,a){this.distance+=i.dist(a),this.updateScaledDistance()}}let qb,Yb;St("LineBucket",_0,{omit:["layers","patternFeatures"]});var Xb={get paint(){return Yb=Yb||new v({"line-opacity":new Ut(ie.paint_line["line-opacity"]),"line-color":new Ut(ie.paint_line["line-color"]),"line-translate":new It(ie.paint_line["line-translate"]),"line-translate-anchor":new It(ie.paint_line["line-translate-anchor"]),"line-width":new Ut(ie.paint_line["line-width"]),"line-gap-width":new Ut(ie.paint_line["line-gap-width"]),"line-offset":new Ut(ie.paint_line["line-offset"]),"line-blur":new Ut(ie.paint_line["line-blur"]),"line-dasharray":new Mc(ie.paint_line["line-dasharray"]),"line-pattern":new Pc(ie.paint_line["line-pattern"]),"line-gradient":new Fd(ie.paint_line["line-gradient"])})},get layout(){return qb=qb||new v({"line-cap":new It(ie.layout_line["line-cap"]),"line-join":new Ut(ie.layout_line["line-join"]),"line-miter-limit":new It(ie.layout_line["line-miter-limit"]),"line-round-limit":new It(ie.layout_line["line-round-limit"]),"line-sort-key":new Ut(ie.layout_line["line-sort-key"])})}};class _3 extends Ut{possiblyEvaluate(i,a){return a=new Vr(Math.floor(a.zoom),{now:a.now,fadeDuration:a.fadeDuration,zoomHistory:a.zoomHistory,transition:a.transition}),super.possiblyEvaluate(i,a)}evaluate(i,a,d,y){return a=ge({},a,{zoom:Math.floor(a.zoom)}),super.evaluate(i,a,d,y)}}let xm;class v3 extends u{constructor(i){super(i,Xb),this.gradientVersion=0,xm||(xm=new _3(Xb.paint.properties["line-width"].specification),xm.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(i){if(i==="line-gradient"){const a=this.gradientExpression();this.stepInterpolant=!!function(d){return d._styleExpression!==void 0}(a)&&a._styleExpression.expression instanceof ja,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(i,a){super.recalculate(i,a),this.paint._values["line-floorwidth"]=xm.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,i)}createBucket(i){return new _0(i)}queryRadius(i){const a=i,d=Kb($d("line-width",this,a),$d("line-gap-width",this,a)),y=$d("line-offset",this,a);return d/2+Math.abs(y)+pm(this.paint.get("line-translate"))}queryIntersectsFeature(i,a,d,y,x,w,b){const k=mm(i,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),w.angle,b),P=b/2*Kb(this.paint.get("line-width").evaluate(a,d),this.paint.get("line-gap-width").evaluate(a,d)),D=this.paint.get("line-offset").evaluate(a,d);return D&&(y=function(L,j){const q=[];for(let K=0;K=3){for(let le=0;le0?i+2*s:s}const x3=S([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),w3=S([{name:"a_projected_pos",components:3,type:"Float32"}],4);S([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const b3=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 Jb=S([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),S3=S([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function k3(s,i,a){return s.sections.forEach(d=>{d.text=function(y,x,w){const b=x.layout.get("text-transform").evaluate(w,{});return b==="uppercase"?y=y.toLocaleUpperCase():b==="lowercase"&&(y=y.toLocaleLowerCase()),Ri.applyArabicShaping&&(y=Ri.applyArabicShaping(y)),y}(d.text,i,a)}),s}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 qd={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var Pn=24,Qb=Lr,e2=function(s,i,a,d,y){var x,w,b=8*y-d-1,k=(1<>1,D=-7,L=y-1,j=-1,q=s[i+L];for(L+=j,x=q&(1<<-D)-1,q>>=-D,D+=b;D>0;x=256*x+s[i+L],L+=j,D-=8);for(w=x&(1<<-D)-1,x>>=-D,D+=d;D>0;w=256*w+s[i+L],L+=j,D-=8);if(x===0)x=1-P;else{if(x===k)return w?NaN:1/0*(q?-1:1);w+=Math.pow(2,d),x-=P}return(q?-1:1)*w*Math.pow(2,x-d)},t2=function(s,i,a,d,y,x){var w,b,k,P=8*x-y-1,D=(1<>1,j=y===23?Math.pow(2,-24)-Math.pow(2,-77):0,q=0,K=1,Q=i<0||i===0&&1/i<0?1:0;for(i=Math.abs(i),isNaN(i)||i===1/0?(b=isNaN(i)?1:0,w=D):(w=Math.floor(Math.log(i)/Math.LN2),i*(k=Math.pow(2,-w))<1&&(w--,k*=2),(i+=w+L>=1?j/k:j*Math.pow(2,1-L))*k>=2&&(w++,k/=2),w+L>=D?(b=0,w=D):w+L>=1?(b=(i*k-1)*Math.pow(2,y),w+=L):(b=i*Math.pow(2,L-1)*Math.pow(2,y),w=0));y>=8;s[a+q]=255&b,q+=K,b/=256,y-=8);for(w=w<0;s[a+q]=255&w,q+=K,w/=256,P-=8);s[a+q-K]|=128*Q};function Lr(s){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(s)?s:new Uint8Array(s||0),this.pos=0,this.type=0,this.length=this.buf.length}Lr.Varint=0,Lr.Fixed64=1,Lr.Bytes=2,Lr.Fixed32=5;var v0=4294967296,r2=1/v0,n2=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function da(s){return s.type===Lr.Bytes?s.readVarint()+s.pos:s.pos+1}function jc(s,i,a){return a?4294967296*i+(s>>>0):4294967296*(i>>>0)+(s>>>0)}function i2(s,i,a){var d=i<=16383?1:i<=2097151?2:i<=268435455?3:Math.floor(Math.log(i)/(7*Math.LN2));a.realloc(d);for(var y=a.pos-1;y>=s;y--)a.buf[y+d]=a.buf[y]}function T3(s,i){for(var a=0;a>>8,s[a+2]=i>>>16,s[a+3]=i>>>24}function s2(s,i){return(s[i]|s[i+1]<<8|s[i+2]<<16)+(s[i+3]<<24)}Lr.prototype={destroy:function(){this.buf=null},readFields:function(s,i,a){for(a=a||this.length;this.pos>3,x=this.pos;this.type=7&d,s(y,i,this),this.pos===x&&this.skip(d)}return i},readMessage:function(s,i){return this.readFields(s,i,this.readVarint()+this.pos)},readFixed32:function(){var s=wm(this.buf,this.pos);return this.pos+=4,s},readSFixed32:function(){var s=s2(this.buf,this.pos);return this.pos+=4,s},readFixed64:function(){var s=wm(this.buf,this.pos)+wm(this.buf,this.pos+4)*v0;return this.pos+=8,s},readSFixed64:function(){var s=wm(this.buf,this.pos)+s2(this.buf,this.pos+4)*v0;return this.pos+=8,s},readFloat:function(){var s=e2(this.buf,this.pos,!0,23,4);return this.pos+=4,s},readDouble:function(){var s=e2(this.buf,this.pos,!0,52,8);return this.pos+=8,s},readVarint:function(s){var i,a,d=this.buf;return i=127&(a=d[this.pos++]),a<128?i:(i|=(127&(a=d[this.pos++]))<<7,a<128?i:(i|=(127&(a=d[this.pos++]))<<14,a<128?i:(i|=(127&(a=d[this.pos++]))<<21,a<128?i:function(y,x,w){var b,k,P=w.buf;if(b=(112&(k=P[w.pos++]))>>4,k<128||(b|=(127&(k=P[w.pos++]))<<3,k<128)||(b|=(127&(k=P[w.pos++]))<<10,k<128)||(b|=(127&(k=P[w.pos++]))<<17,k<128)||(b|=(127&(k=P[w.pos++]))<<24,k<128)||(b|=(1&(k=P[w.pos++]))<<31,k<128))return jc(y,b,x);throw new Error("Expected varint not more than 10 bytes")}(i|=(15&(a=d[this.pos]))<<28,s,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var s=this.readVarint();return s%2==1?(s+1)/-2:s/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var s=this.readVarint()+this.pos,i=this.pos;return this.pos=s,s-i>=12&&n2?function(a,d,y){return n2.decode(a.subarray(d,y))}(this.buf,i,s):function(a,d,y){for(var x="",w=d;w239?4:D>223?3:D>191?2:1;if(w+j>y)break;j===1?D<128&&(L=D):j===2?(192&(b=a[w+1]))==128&&(L=(31&D)<<6|63&b)<=127&&(L=null):j===3?(k=a[w+2],(192&(b=a[w+1]))==128&&(192&k)==128&&((L=(15&D)<<12|(63&b)<<6|63&k)<=2047||L>=55296&&L<=57343)&&(L=null)):j===4&&(k=a[w+2],P=a[w+3],(192&(b=a[w+1]))==128&&(192&k)==128&&(192&P)==128&&((L=(15&D)<<18|(63&b)<<12|(63&k)<<6|63&P)<=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,i,s)},readBytes:function(){var s=this.readVarint()+this.pos,i=this.buf.subarray(this.pos,s);return this.pos=s,i},readPackedVarint:function(s,i){if(this.type!==Lr.Bytes)return s.push(this.readVarint(i));var a=da(this);for(s=s||[];this.pos127;);else if(i===Lr.Bytes)this.pos=this.readVarint()+this.pos;else if(i===Lr.Fixed32)this.pos+=4;else{if(i!==Lr.Fixed64)throw new Error("Unimplemented type: "+i);this.pos+=8}},writeTag:function(s,i){this.writeVarint(s<<3|i)},realloc:function(s){for(var i=this.length||16;i268435455||s<0?function(i,a){var d,y;if(i>=0?(d=i%4294967296|0,y=i/4294967296|0):(y=~(-i/4294967296),4294967295^(d=~(-i%4294967296))?d=d+1|0:(d=0,y=y+1|0)),i>=18446744073709552e3||i<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");a.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)}(d,0,a),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)))))}(y,a)}(s,this):(this.realloc(4),this.buf[this.pos++]=127&s|(s>127?128:0),s<=127||(this.buf[this.pos++]=127&(s>>>=7)|(s>127?128:0),s<=127||(this.buf[this.pos++]=127&(s>>>=7)|(s>127?128:0),s<=127||(this.buf[this.pos++]=s>>>7&127))))},writeSVarint:function(s){this.writeVarint(s<0?2*-s-1:2*s)},writeBoolean:function(s){this.writeVarint(!!s)},writeString:function(s){s=String(s),this.realloc(4*s.length),this.pos++;var i=this.pos;this.pos=function(d,y,x){for(var w,b,k=0;k55295&&w<57344){if(!b){w>56319||k+1===y.length?(d[x++]=239,d[x++]=191,d[x++]=189):b=w;continue}if(w<56320){d[x++]=239,d[x++]=191,d[x++]=189,b=w;continue}w=b-55296<<10|w-56320|65536,b=null}else b&&(d[x++]=239,d[x++]=191,d[x++]=189,b=null);w<128?d[x++]=w:(w<2048?d[x++]=w>>6|192:(w<65536?d[x++]=w>>12|224:(d[x++]=w>>18|240,d[x++]=w>>12&63|128),d[x++]=w>>6&63|128),d[x++]=63&w|128)}return x}(this.buf,s,this.pos);var a=this.pos-i;a>=128&&i2(i,a,this),this.pos=i-1,this.writeVarint(a),this.pos+=a},writeFloat:function(s){this.realloc(4),t2(this.buf,s,this.pos,!0,23,4),this.pos+=4},writeDouble:function(s){this.realloc(8),t2(this.buf,s,this.pos,!0,52,8),this.pos+=8},writeBytes:function(s){var i=s.length;this.writeVarint(i),this.realloc(i);for(var a=0;a=128&&i2(a,d,this),this.pos=a-1,this.writeVarint(d),this.pos+=d},writeMessage:function(s,i,a){this.writeTag(s,Lr.Bytes),this.writeRawMessage(i,a)},writePackedVarint:function(s,i){i.length&&this.writeMessage(s,T3,i)},writePackedSVarint:function(s,i){i.length&&this.writeMessage(s,E3,i)},writePackedBoolean:function(s,i){i.length&&this.writeMessage(s,P3,i)},writePackedFloat:function(s,i){i.length&&this.writeMessage(s,C3,i)},writePackedDouble:function(s,i){i.length&&this.writeMessage(s,I3,i)},writePackedFixed32:function(s,i){i.length&&this.writeMessage(s,M3,i)},writePackedSFixed32:function(s,i){i.length&&this.writeMessage(s,A3,i)},writePackedFixed64:function(s,i){i.length&&this.writeMessage(s,D3,i)},writePackedSFixed64:function(s,i){i.length&&this.writeMessage(s,z3,i)},writeBytesField:function(s,i){this.writeTag(s,Lr.Bytes),this.writeBytes(i)},writeFixed32Field:function(s,i){this.writeTag(s,Lr.Fixed32),this.writeFixed32(i)},writeSFixed32Field:function(s,i){this.writeTag(s,Lr.Fixed32),this.writeSFixed32(i)},writeFixed64Field:function(s,i){this.writeTag(s,Lr.Fixed64),this.writeFixed64(i)},writeSFixed64Field:function(s,i){this.writeTag(s,Lr.Fixed64),this.writeSFixed64(i)},writeVarintField:function(s,i){this.writeTag(s,Lr.Varint),this.writeVarint(i)},writeSVarintField:function(s,i){this.writeTag(s,Lr.Varint),this.writeSVarint(i)},writeStringField:function(s,i){this.writeTag(s,Lr.Bytes),this.writeString(i)},writeFloatField:function(s,i){this.writeTag(s,Lr.Fixed32),this.writeFloat(i)},writeDoubleField:function(s,i){this.writeTag(s,Lr.Fixed64),this.writeDouble(i)},writeBooleanField:function(s,i){this.writeVarintField(s,!!i)}};var x0=T(Qb);const w0=3;function R3(s,i,a){s===1&&a.readMessage(L3,i)}function L3(s,i,a){if(s===3){const{id:d,bitmap:y,width:x,height:w,left:b,top:k,advance:P}=a.readMessage(O3,{});i.push({id:d,bitmap:new Ud({width:x+2*w0,height:w+2*w0},y),metrics:{width:x,height:w,left:b,top:k,advance:P}})}}function O3(s,i,a){s===1?i.id=a.readVarint():s===2?i.bitmap=a.readBytes():s===3?i.width=a.readVarint():s===4?i.height=a.readVarint():s===5?i.left=a.readSVarint():s===6?i.top=a.readSVarint():s===7&&(i.advance=a.readVarint())}const o2=w0;function a2(s){let i=0,a=0;for(const w of s)i+=w.w*w.h,a=Math.max(a,w.w);s.sort((w,b)=>b.h-w.h);const d=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(i/.95)),a),h:1/0}];let y=0,x=0;for(const w of s)for(let b=d.length-1;b>=0;b--){const k=d[b];if(!(w.w>k.w||w.h>k.h)){if(w.x=k.x,w.y=k.y,x=Math.max(x,w.y+w.h),y=Math.max(y,w.x+w.w),w.w===k.w&&w.h===k.h){const P=d.pop();b=0&&d>=i&&Sm[this.text.charCodeAt(d)];d--)a--;this.text=this.text.substring(i,a),this.sectionIndex=this.sectionIndex.slice(i,a)}substring(i,a){const d=new Vc;return d.text=this.text.substring(i,a),d.sectionIndex=this.sectionIndex.slice(i,a),d.sections=this.sections,d}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((i,a)=>Math.max(i,this.sections[a].scale),0)}addTextSection(i,a){this.text+=i.text,this.sections.push(Xd.forText(i.scale,i.fontStack||a));const d=this.sections.length-1;for(let y=0;y=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function bm(s,i,a,d,y,x,w,b,k,P,D,L,j,q,K){const Q=Vc.fromFeature(s,y);let le;L===g.ah.vertical&&Q.verticalizePunctuation();const{processBidirectionalText:fe,processStyledBidirectionalText:De}=Ri;if(fe&&Q.sections.length===1){le=[];const Ve=fe(Q.toString(),S0(Q,P,x,i,d,q));for(const et of Ve){const xt=new Vc;xt.text=et,xt.sections=Q.sections;for(let Nt=0;Nt0&&fa>Jn&&(Jn=fa)}else{const Ts=xt[xr.fontStack],$n=Ts&&Ts[Zr];if($n&&$n.rect)Zc=$n.rect,nn=$n.metrics;else{const fa=et[xr.fontStack],rf=fa&&fa[Zr];if(!rf)continue;nn=rf.metrics}ns=(Ln-xr.scale)*Pn}Zs?(Ve.verticalizable=!0,Si.push({glyph:Zr,imageName:Ro,x:Zt,y:Fr+ns,vertical:Zs,scale:xr.scale,fontStack:xr.fontStack,sectionIndex:$r,metrics:nn,rect:Zc}),Zt+=Lo*xr.scale+Ye):(Si.push({glyph:Zr,imageName:Ro,x:Zt,y:Fr+ns,vertical:Zs,scale:xr.scale,fontStack:xr.fontStack,sectionIndex:$r,metrics:nn,rect:Zc}),Zt+=nn.advance*xr.scale+Ye)}Si.length!==0&&(Or=Math.max(Zt-Ye,Or),$3(Si,0,Si.length-1,Gs,Jn)),Zt=0;const ks=pt*Ln+Jn;Kn.lineOffset=Math.max(Jn,oi),Fr+=ks,zn=Math.max(ks,zn),++Xn}var Rn;const xi=Fr-Yd,{horizontalAlign:wi,verticalAlign:bi}=k0(At);(function(mn,Ln,oi,Kn,Si,Jn,ks,Fi,xr){const $r=(Ln-oi)*Si;let Zr=0;Zr=Jn!==ks?-Fi*Kn-Yd:(-Kn*xr+.5)*ks;for(const ns of mn)for(const nn of ns.positionedGlyphs)nn.x+=$r,nn.y+=Zr})(Ve.positionedLines,Gs,wi,bi,Or,zn,pt,xi,yt.length),Ve.top+=-bi*xi,Ve.bottom=Ve.top+xi,Ve.left+=-wi*Or,Ve.right=Ve.left+Or}(Me,i,a,d,le,w,b,k,L,P,j,K),!function(Ve){for(const et of Ve)if(et.positionedGlyphs.length!==0)return!1;return!0}(be)&&Me}const Sm={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},F3={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},B3={40:!0};function u2(s,i,a,d,y,x){if(i.imageName){const w=d[i.imageName];return w?w.displaySize[0]*i.scale*Pn/x+y:0}{const w=a[i.fontStack],b=w&&w[s];return b?b.metrics.advance*i.scale+y:0}}function c2(s,i,a,d){const y=Math.pow(s-i,2);return d?s=0;let P=0;for(let L=0;LP){const D=Math.ceil(x/P);y*=D/w,w=D}return{x1:d,y1:y,x2:d+x,y2:y+w}}function p2(s,i,a,d,y,x){const w=s.image;let b;if(w.content){const le=w.content,fe=w.pixelRatio||1;b=[le[0]/fe,le[1]/fe,w.displaySize[0]-le[2]/fe,w.displaySize[1]-le[3]/fe]}const k=i.left*x,P=i.right*x;let D,L,j,q;a==="width"||a==="both"?(q=y[0]+k-d[3],L=y[0]+P+d[1]):(q=y[0]+(k+P-w.displaySize[0])/2,L=q+w.displaySize[0]);const K=i.top*x,Q=i.bottom*x;return a==="height"||a==="both"?(D=y[1]+K-d[0],j=y[1]+Q+d[2]):(D=y[1]+(K+Q-w.displaySize[1])/2,j=D+w.displaySize[1]),{image:w,top:D,right:L,bottom:j,left:q,collisionPadding:b}}const Kd=255,zo=128,pl=Kd*zo;function m2(s,i){const{expression:a}=i;if(a.kind==="constant")return{kind:"constant",layoutSize:a.evaluate(new Vr(s+1))};if(a.kind==="source")return{kind:"source"};{const{zoomStops:d,interpolationType:y}=a;let x=0;for(;xw.id),this.index=i.index,this.pixelRatio=i.pixelRatio,this.sourceLayerIndex=i.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=a0([]),this.placementViewportMatrix=a0([]);const a=this.layers[0]._unevaluatedLayout._values;this.textSizeData=m2(this.zoom,a["text-size"]),this.iconSizeData=m2(this.zoom,a["icon-size"]);const d=this.layers[0].layout,y=d.get("symbol-sort-key"),x=d.get("symbol-z-order");this.canOverlap=T0(d,"text-overlap","text-allow-overlap")!=="never"||T0(d,"icon-overlap","icon-allow-overlap")!=="never"||d.get("text-ignore-placement")||d.get("icon-ignore-placement"),this.sortFeaturesByKey=x!=="viewport-y"&&!y.isConstant(),this.sortFeaturesByY=(x==="viewport-y"||x==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,d.get("symbol-placement")==="point"&&(this.writingModes=d.get("text-writing-mode").map(w=>g.ah[w])),this.stateDependentLayerIds=this.layers.filter(w=>w.isStateDependent()).map(w=>w.id),this.sourceID=i.sourceID}createArrays(){this.text=new C0(new pu(this.layers,this.zoom,i=>/^text/.test(i))),this.icon=new C0(new pu(this.layers,this.zoom,i=>/^icon/.test(i))),this.glyphOffsetArray=new Wr,this.lineVertexArray=new Gn,this.symbolInstances=new ar,this.textAnchorOffsets=new Gr}calculateGlyphDependencies(i,a,d,y,x){for(let w=0;w0)&&(w.value.kind!=="constant"||w.value.value.length>0),D=k.value.kind!=="constant"||!!k.value.value||Object.keys(k.parameters).length>0,L=x.get("symbol-sort-key");if(this.features=[],!P&&!D)return;const j=a.iconDependencies,q=a.glyphDependencies,K=a.availableImages,Q=new Vr(this.zoom);for(const{feature:le,id:fe,index:De,sourceLayerIndex:be}of i){const Me=y._featureFilter.needGeometry,Ve=gu(le,Me);if(!y._featureFilter.filter(Q,Ve,d))continue;let et,xt;if(Me||(Ve.geometry=mu(le)),P){const yt=y.getValueAndResolveTokens("text-field",Ve,d,K),pt=Mi.factory(yt),At=this.hasRTLText=this.hasRTLText||H3(pt);(!At||Ri.getRTLTextPluginStatus()==="unavailable"||At&&Ri.isParsed())&&(et=k3(pt,y,Ve))}if(D){const yt=y.getValueAndResolveTokens("icon-image",Ve,d,K);xt=yt instanceof Di?yt:Di.fromString(yt)}if(!et&&!xt)continue;const Nt=this.sortFeaturesByKey?L.evaluate(Ve,{},d):void 0;if(this.features.push({id:fe,text:et,icon:xt,index:De,sourceLayerIndex:be,geometry:Ve.geometry,properties:le.properties,type:U3[le.type],sortKey:Nt}),xt&&(j[xt.name]=!0),et){const yt=w.evaluate(Ve,{},d).join(","),pt=x.get("text-rotation-alignment")!=="viewport"&&x.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(g.ah.vertical)>=0;for(const At of et.sections)if(At.image)j[At.image.name]=!0;else{const Tt=zd(et.toString()),bt=At.fontStack||yt,Ye=q[bt]=q[bt]||{};this.calculateGlyphDependencies(At.text,Ye,pt,this.allowVerticalPlacement,Tt)}}}x.get("symbol-placement")==="line"&&(this.features=function(le){const fe={},De={},be=[];let Me=0;function Ve(yt){be.push(le[yt]),Me++}function et(yt,pt,At){const Tt=De[yt];return delete De[yt],De[pt]=Tt,be[Tt].geometry[0].pop(),be[Tt].geometry[0]=be[Tt].geometry[0].concat(At[0]),Tt}function xt(yt,pt,At){const Tt=fe[pt];return delete fe[pt],fe[yt]=Tt,be[Tt].geometry[0].shift(),be[Tt].geometry[0]=At[0].concat(be[Tt].geometry[0]),Tt}function Nt(yt,pt,At){const Tt=At?pt[0][pt[0].length-1]:pt[0][0];return`${yt}:${Tt.x}:${Tt.y}`}for(let yt=0;ytyt.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((le,fe)=>le.sortKey-fe.sortKey)}update(i,a,d){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(i,a,this.layers,d),this.icon.programConfigurations.updatePaintArrays(i,a,this.layers,d))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(i){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(i),this.iconCollisionBox.upload(i)),this.text.upload(i,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(i,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(i,a){const d=this.lineVertexArray.length;if(i.segment!==void 0){let y=i.dist(a[i.segment+1]),x=i.dist(a[i.segment]);const w={};for(let b=i.segment+1;b=0;b--)w[b]={x:a[b].x,y:a[b].y,tileUnitDistanceFromAnchor:x},b>0&&(x+=a[b-1].dist(a[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(i,a){const d=i.placedSymbolArray.get(a),y=d.vertexStartIndex+4*d.numGlyphs;for(let x=d.vertexStartIndex;xy[b]-y[k]||x[k]-x[b]),w}addToSortKeyRanges(i,a){const d=this.sortKeyRanges[this.sortKeyRanges.length-1];d&&d.sortKey===a?d.symbolInstanceEnd=i+1:this.sortKeyRanges.push({sortKey:a,symbolInstanceStart:i,symbolInstanceEnd:i+1})}sortFeatures(i){if(this.sortFeaturesByY&&this.sortedAngle!==i&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(i),this.sortedAngle=i,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const a of this.symbolInstanceIndexes){const d=this.symbolInstances.get(a);this.featureSortOrder.push(d.featureIndex),[d.rightJustifiedTextSymbolIndex,d.centerJustifiedTextSymbolIndex,d.leftJustifiedTextSymbolIndex].forEach((y,x,w)=>{y>=0&&w.indexOf(y)===x&&this.addIndicesForPlacedSymbol(this.text,y)}),d.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,d.verticalPlacedTextSymbolIndex),d.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,d.placedIconSymbolIndex),d.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,d.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let g2,y2;St("SymbolBucket",Hc,{omit:["layers","collisionBoxArray","features","compareText"]}),Hc.MAX_GLYPHS=65535,Hc.addDynamicAttributes=E0;var P0={get paint(){return y2=y2||new v({"icon-opacity":new Ut(ie.paint_symbol["icon-opacity"]),"icon-color":new Ut(ie.paint_symbol["icon-color"]),"icon-halo-color":new Ut(ie.paint_symbol["icon-halo-color"]),"icon-halo-width":new Ut(ie.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Ut(ie.paint_symbol["icon-halo-blur"]),"icon-translate":new It(ie.paint_symbol["icon-translate"]),"icon-translate-anchor":new It(ie.paint_symbol["icon-translate-anchor"]),"text-opacity":new Ut(ie.paint_symbol["text-opacity"]),"text-color":new Ut(ie.paint_symbol["text-color"],{runtimeType:Kr,getOverride:s=>s.textColor,hasOverride:s=>!!s.textColor}),"text-halo-color":new Ut(ie.paint_symbol["text-halo-color"]),"text-halo-width":new Ut(ie.paint_symbol["text-halo-width"]),"text-halo-blur":new Ut(ie.paint_symbol["text-halo-blur"]),"text-translate":new It(ie.paint_symbol["text-translate"]),"text-translate-anchor":new It(ie.paint_symbol["text-translate-anchor"])})},get layout(){return g2=g2||new v({"symbol-placement":new It(ie.layout_symbol["symbol-placement"]),"symbol-spacing":new It(ie.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new It(ie.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Ut(ie.layout_symbol["symbol-sort-key"]),"symbol-z-order":new It(ie.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new It(ie.layout_symbol["icon-allow-overlap"]),"icon-overlap":new It(ie.layout_symbol["icon-overlap"]),"icon-ignore-placement":new It(ie.layout_symbol["icon-ignore-placement"]),"icon-optional":new It(ie.layout_symbol["icon-optional"]),"icon-rotation-alignment":new It(ie.layout_symbol["icon-rotation-alignment"]),"icon-size":new Ut(ie.layout_symbol["icon-size"]),"icon-text-fit":new It(ie.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new It(ie.layout_symbol["icon-text-fit-padding"]),"icon-image":new Ut(ie.layout_symbol["icon-image"]),"icon-rotate":new Ut(ie.layout_symbol["icon-rotate"]),"icon-padding":new Ut(ie.layout_symbol["icon-padding"]),"icon-keep-upright":new It(ie.layout_symbol["icon-keep-upright"]),"icon-offset":new Ut(ie.layout_symbol["icon-offset"]),"icon-anchor":new Ut(ie.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new It(ie.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new It(ie.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new It(ie.layout_symbol["text-rotation-alignment"]),"text-field":new Ut(ie.layout_symbol["text-field"]),"text-font":new Ut(ie.layout_symbol["text-font"]),"text-size":new Ut(ie.layout_symbol["text-size"]),"text-max-width":new Ut(ie.layout_symbol["text-max-width"]),"text-line-height":new It(ie.layout_symbol["text-line-height"]),"text-letter-spacing":new Ut(ie.layout_symbol["text-letter-spacing"]),"text-justify":new Ut(ie.layout_symbol["text-justify"]),"text-radial-offset":new Ut(ie.layout_symbol["text-radial-offset"]),"text-variable-anchor":new It(ie.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Ut(ie.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Ut(ie.layout_symbol["text-anchor"]),"text-max-angle":new It(ie.layout_symbol["text-max-angle"]),"text-writing-mode":new It(ie.layout_symbol["text-writing-mode"]),"text-rotate":new Ut(ie.layout_symbol["text-rotate"]),"text-padding":new It(ie.layout_symbol["text-padding"]),"text-keep-upright":new It(ie.layout_symbol["text-keep-upright"]),"text-transform":new Ut(ie.layout_symbol["text-transform"]),"text-offset":new Ut(ie.layout_symbol["text-offset"]),"text-allow-overlap":new It(ie.layout_symbol["text-allow-overlap"]),"text-overlap":new It(ie.layout_symbol["text-overlap"]),"text-ignore-placement":new It(ie.layout_symbol["text-ignore-placement"]),"text-optional":new It(ie.layout_symbol["text-optional"])})}};class _2{constructor(i){if(i.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=i.property.overrides?i.property.overrides.runtimeType:pi,this.defaultValue=i}evaluate(i){if(i.formattedSection){const a=this.defaultValue.property.overrides;if(a&&a.hasOverride(i.formattedSection))return a.getOverride(i.formattedSection)}return i.feature&&i.featureState?this.defaultValue.evaluate(i.feature,i.featureState):this.defaultValue.property.specification.default}eachChild(i){this.defaultValue.isConstant()||i(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}St("FormatSectionOverride",_2,{omit:["defaultValue"]});class Tm extends u{constructor(i){super(i,P0)}recalculate(i,a){if(super.recalculate(i,a),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 d=this.layout.get("text-writing-mode");if(d){const y=[];for(const x of d)y.indexOf(x)<0&&y.push(x);this.layout._values["text-writing-mode"]=y}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(i,a,d,y){const x=this.layout.get(i).evaluate(a,{},d,y),w=this._unevaluatedLayout._values[i];return w.isDataDriven()||yc(w.value)||!x?x:function(b,k){return k.replace(/{([^{}]+)}/g,(P,D)=>b&&D in b?String(b[D]):"")}(a.properties,x)}createBucket(i){return new Hc(i)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const i of P0.paint.overridableProperties){if(!Tm.hasPaintOverride(this.layout,i))continue;const a=this.paint.get(i),d=new _2(a),y=new gc(d,a.property.specification);let x=null;x=a.value.kind==="constant"||a.value.kind==="source"?new Xa("source",y):new Ka("composite",y,a.value.zoomStops),this.paint._values[i]=new Hs(a.property,x,a.parameters)}}_handleOverridablePaintPropertyUpdate(i,a,d){return!(!this.layout||a.isDataDriven()||d.isDataDriven())&&Tm.hasPaintOverride(this.layout,i)}static hasPaintOverride(i,a){const d=i.get("text-field"),y=P0.paint.properties[a];let x=!1;const w=b=>{for(const k of b)if(y.overrides&&y.overrides.hasOverride(k))return void(x=!0)};if(d.value.kind==="constant"&&d.value.value instanceof Mi)w(d.value.value.sections);else if(d.value.kind==="source"){const b=P=>{x||(P instanceof ms&&En(P.value)===fs?w(P.value.sections):P instanceof ac?w(P.sections):P.eachChild(b))},k=d.value;k._styleExpression&&b(k._styleExpression.expression)}return x}}let v2;var W3={get paint(){return v2=v2||new v({"background-color":new It(ie.paint_background["background-color"]),"background-pattern":new Mc(ie.paint_background["background-pattern"]),"background-opacity":new It(ie.paint_background["background-opacity"])})}};class G3 extends u{constructor(i){super(i,W3)}}let x2;var Z3={get paint(){return x2=x2||new v({"raster-opacity":new It(ie.paint_raster["raster-opacity"]),"raster-hue-rotate":new It(ie.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new It(ie.paint_raster["raster-brightness-min"]),"raster-brightness-max":new It(ie.paint_raster["raster-brightness-max"]),"raster-saturation":new It(ie.paint_raster["raster-saturation"]),"raster-contrast":new It(ie.paint_raster["raster-contrast"]),"raster-resampling":new It(ie.paint_raster["raster-resampling"]),"raster-fade-duration":new It(ie.paint_raster["raster-fade-duration"])})}};class q3 extends u{constructor(i){super(i,Z3)}}class Y3 extends u{constructor(i){super(i,{}),this.onAdd=a=>{this.implementation.onAdd&&this.implementation.onAdd(a,a.painter.context.gl)},this.onRemove=a=>{this.implementation.onRemove&&this.implementation.onRemove(a,a.painter.context.gl)},this.implementation=i}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 X3{constructor(i){this._methodToThrottle=i,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 M0=63710088e-1;class ml{constructor(i,a){if(isNaN(i)||isNaN(a))throw new Error(`Invalid LngLat object: (${i}, ${a})`);if(this.lng=+i,this.lat=+a,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new ml(ke(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(i){const a=Math.PI/180,d=this.lat*a,y=i.lat*a,x=Math.sin(d)*Math.sin(y)+Math.cos(d)*Math.cos(y)*Math.cos((i.lng-this.lng)*a);return M0*Math.acos(Math.min(x,1))}static convert(i){if(i instanceof ml)return i;if(Array.isArray(i)&&(i.length===2||i.length===3))return new ml(Number(i[0]),Number(i[1]));if(!Array.isArray(i)&&typeof i=="object"&&i!==null)return new ml(Number("lng"in i?i.lng:i.lon),Number(i.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 w2=2*Math.PI*M0;function b2(s){return w2*Math.cos(s*Math.PI/180)}function S2(s){return(180+s)/360}function k2(s){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+s*Math.PI/360)))/360}function T2(s,i){return s/b2(i)}function A0(s){return 360/Math.PI*Math.atan(Math.exp((180-360*s)*Math.PI/180))-90}class Jd{constructor(i,a,d=0){this.x=+i,this.y=+a,this.z=+d}static fromLngLat(i,a=0){const d=ml.convert(i);return new Jd(S2(d.lng),k2(d.lat),T2(a,d.lat))}toLngLat(){return new ml(360*this.x-180,A0(this.y))}toAltitude(){return this.z*b2(A0(this.y))}meterInMercatorCoordinateUnits(){return 1/w2*(i=A0(this.y),1/Math.cos(i*Math.PI/180));var i}}function E2(s,i,a){var d=2*Math.PI*6378137/256/Math.pow(2,a);return[s*d-2*Math.PI*6378137/2,i*d-2*Math.PI*6378137/2]}class D0{constructor(i,a,d){if(!function(y,x,w){return!(y<0||y>25||w<0||w>=Math.pow(2,y)||x<0||x>=Math.pow(2,y))}(i,a,d))throw new Error(`x=${a}, y=${d}, z=${i} outside of bounds. 0<=x<${Math.pow(2,i)}, 0<=y<${Math.pow(2,i)} 0<=z<=25 `);this.z=i,this.x=a,this.y=d,this.key=Qd(0,i,i,a,d)}equals(i){return this.z===i.z&&this.x===i.x&&this.y===i.y}url(i,a,d){const y=(w=this.y,b=this.z,k=E2(256*(x=this.x),256*(w=Math.pow(2,b)-w-1),b),P=E2(256*(x+1),256*(w+1),b),k[0]+","+k[1]+","+P[0]+","+P[1]);var x,w,b,k,P;const D=function(L,j,q){let K,Q="";for(let le=L;le>0;le--)K=1<1?"@2x":"").replace(/{quadkey}/g,D).replace(/{bbox-epsg-3857}/g,y)}isChildOf(i){const a=this.z-i.z;return a>0&&i.x===this.x>>a&&i.y===this.y>>a}getTilePoint(i){const a=Math.pow(2,this.z);return new A((i.x*a-this.x)*Cn,(i.y*a-this.y)*Cn)}toString(){return`${this.z}/${this.x}/${this.y}`}}class C2{constructor(i,a){this.wrap=i,this.canonical=a,this.key=Qd(i,a.z,a.z,a.x,a.y)}}class Ss{constructor(i,a,d,y,x){if(i= z; overscaledZ = ${i}; z = ${d}`);this.overscaledZ=i,this.wrap=a,this.canonical=new D0(d,+y,+x),this.key=Qd(a,i,d,y,x)}clone(){return new Ss(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(i){return this.overscaledZ===i.overscaledZ&&this.wrap===i.wrap&&this.canonical.equals(i.canonical)}scaledTo(i){if(i>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${i}; overscaledZ = ${this.overscaledZ}`);const a=this.canonical.z-i;return i>this.canonical.z?new Ss(i,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Ss(i,this.wrap,i,this.canonical.x>>a,this.canonical.y>>a)}calculateScaledKey(i,a){if(i>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${i}; overscaledZ = ${this.overscaledZ}`);const d=this.canonical.z-i;return i>this.canonical.z?Qd(this.wrap*+a,i,this.canonical.z,this.canonical.x,this.canonical.y):Qd(this.wrap*+a,i,i,this.canonical.x>>d,this.canonical.y>>d)}isChildOf(i){if(i.wrap!==this.wrap)return!1;const a=this.canonical.z-i.canonical.z;return i.overscaledZ===0||i.overscaledZ>a&&i.canonical.y===this.canonical.y>>a}children(i){if(this.overscaledZ>=i)return[new Ss(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const a=this.canonical.z+1,d=2*this.canonical.x,y=2*this.canonical.y;return[new Ss(a,this.wrap,a,d,y),new Ss(a,this.wrap,a,d+1,y),new Ss(a,this.wrap,a,d,y+1),new Ss(a,this.wrap,a,d+1,y+1)]}isLessThan(i){return this.wrapi.wrap)&&(this.overscaledZi.overscaledZ)&&(this.canonical.xi.canonical.x)&&this.canonical.ythis.max&&(this.max=L),L=this.dim+1||a<-1||a>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(a+1)*this.stride+(i+1)}unpack(i,a,d){return i*this.redFactor+a*this.greenFactor+d*this.blueFactor-this.baseShift}getPixels(){return new bs({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(i,a,d){if(this.dim!==i.dim)throw new Error("dem dimension mismatch");let y=a*this.dim,x=a*this.dim+this.dim,w=d*this.dim,b=d*this.dim+this.dim;switch(a){case-1:y=x-1;break;case 1:x=y+1}switch(d){case-1:w=b-1;break;case 1:b=w+1}const k=-a*this.dim,P=-d*this.dim;for(let D=w;D=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${i} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[i]}}class M2{constructor(i,a,d,y,x){this.type="Feature",this._vectorTileFeature=i,i._z=a,i._x=d,i._y=y,this.properties=i.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(i){this._geometry=i}toJSON(){const i={geometry:this.geometry};for(const a in this)a!=="_geometry"&&a!=="_vectorTileFeature"&&(i[a]=this[a]);return i}}class A2{constructor(i,a){this.tileID=i,this.x=i.canonical.x,this.y=i.canonical.y,this.z=i.canonical.z,this.grid=new tl(Cn,16,0),this.grid3D=new tl(Cn,16,0),this.featureIndexArray=new ii,this.promoteId=a}insert(i,a,d,y,x,w){const b=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(d,y,x);const k=w?this.grid3D:this.grid;for(let P=0;P=0&&L[3]>=0&&k.insert(b,L[0],L[1],L[2],L[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new dl.VectorTile(new x0(this.rawTileData)).layers,this.sourceLayerCoder=new P2(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(i,a,d,y){this.loadVTLayers();const x=i.params||{},w=Cn/i.tileSize/i.scale,b=_d(x.filter),k=i.queryGeometry,P=i.queryPadding*w,D=z2(k),L=this.grid.query(D.minX-P,D.minY-P,D.maxX+P,D.maxY+P),j=z2(i.cameraQueryGeometry),q=this.grid3D.query(j.minX-P,j.minY-P,j.maxX+P,j.maxY+P,(le,fe,De,be)=>function(Me,Ve,et,xt,Nt){for(const pt of Me)if(Ve<=pt.x&&et<=pt.y&&xt>=pt.x&&Nt>=pt.y)return!0;const yt=[new A(Ve,et),new A(Ve,Nt),new A(xt,Nt),new A(xt,et)];if(Me.length>2){for(const pt of yt)if(Fc(Me,pt))return!0}for(let pt=0;pt(be||(be=mu(Me)),Ve.queryIntersectsFeature(k,Me,et,be,this.z,i.transform,w,i.pixelPosMatrix)))}return K}loadMatchingFeature(i,a,d,y,x,w,b,k,P,D,L){const j=this.bucketLayerIDs[a];if(w&&!function(le,fe){for(let De=0;De=0)return!0;return!1}(w,j))return;const q=this.sourceLayerCoder.decode(d),K=this.vtLayers[q].feature(y);if(x.needGeometry){const le=gu(K,!0);if(!x.filter(new Vr(this.tileID.overscaledZ),le,this.tileID.canonical))return}else if(!x.filter(new Vr(this.tileID.overscaledZ),K))return;const Q=this.getId(K,q);for(let le=0;le{const b=i instanceof hu?i.get(w):null;return b&&b.evaluate?b.evaluate(a,d,y):b})}function z2(s){let i=1/0,a=1/0,d=-1/0,y=-1/0;for(const x of s)i=Math.min(i,x.x),a=Math.min(a,x.y),d=Math.max(d,x.x),y=Math.max(y,x.y);return{minX:i,minY:a,maxX:d,maxY:y}}function K3(s,i){return i-s}function R2(s,i,a,d,y){const x=[];for(let w=0;w=d&&L.x>=d||(D.x>=d?D=new A(d,D.y+(d-D.x)/(L.x-D.x)*(L.y-D.y))._round():L.x>=d&&(L=new A(d,D.y+(d-D.x)/(L.x-D.x)*(L.y-D.y))._round()),D.y>=y&&L.y>=y||(D.y>=y?D=new A(D.x+(y-D.y)/(L.y-D.y)*(L.x-D.x),y)._round():L.y>=y&&(L=new A(D.x+(y-D.y)/(L.y-D.y)*(L.x-D.x),y)._round()),k&&D.equals(k[k.length-1])||(k=[D],x.push(k)),k.push(L)))))}}return x}St("FeatureIndex",A2,{omit:["rawTileData","sourceLayerCoder"]});class gl extends A{constructor(i,a,d,y){super(i,a),this.angle=d,y!==void 0&&(this.segment=y)}clone(){return new gl(this.x,this.y,this.angle,this.segment)}}function L2(s,i,a,d,y){if(i.segment===void 0||a===0)return!0;let x=i,w=i.segment+1,b=0;for(;b>-a/2;){if(w--,w<0)return!1;b-=s[w].dist(x),x=s[w]}b+=s[w].dist(s[w+1]),w++;const k=[];let P=0;for(;bd;)P-=k.shift().angleDelta;if(P>y)return!1;w++,b+=D.dist(L)}return!0}function O2(s){let i=0;for(let a=0;aP){const K=(P-k)/q,Q=gi.number(L.x,j.x,K),le=gi.number(L.y,j.y,K),fe=new gl(Q,le,j.angleTo(L),D);return fe._round(),!w||L2(s,fe,b,w,i)?fe:void 0}k+=q}}function Q3(s,i,a,d,y,x,w,b,k){const P=F2(d,x,w),D=B2(d,y),L=D*w,j=s[0].x===0||s[0].x===k||s[0].y===0||s[0].y===k;return i-L=0&&Me=0&&Ve=0&&j+P<=D){const et=new gl(Me,Ve,De,K);et._round(),d&&!L2(s,et,x,d,y)||q.push(et)}}L+=fe}return b||q.length||w||(q=N2(s,L/2,a,d,y,x,w,!0,k)),q}St("Anchor",gl);const Wc=Oi;function $2(s,i,a,d){const y=[],x=s.image,w=x.pixelRatio,b=x.paddedRect.w-2*Wc,k=x.paddedRect.h-2*Wc;let P={x1:s.left,y1:s.top,x2:s.right,y2:s.bottom};const D=x.stretchX||[[0,b]],L=x.stretchY||[[0,k]],j=(Ye,Dt)=>Ye+Dt[1]-Dt[0],q=D.reduce(j,0),K=L.reduce(j,0),Q=b-q,le=k-K;let fe=0,De=q,be=0,Me=K,Ve=0,et=Q,xt=0,Nt=le;if(x.content&&d){const Ye=x.content,Dt=Ye[2]-Ye[0],Mt=Ye[3]-Ye[1];(x.textFitWidth||x.textFitHeight)&&(P=f2(s)),fe=Em(D,0,Ye[0]),be=Em(L,0,Ye[1]),De=Em(D,Ye[0],Ye[2]),Me=Em(L,Ye[1],Ye[3]),Ve=Ye[0]-fe,xt=Ye[1]-be,et=Dt-De,Nt=Mt-Me}const yt=P.x1,pt=P.y1,At=P.x2-yt,Tt=P.y2-pt,bt=(Ye,Dt,Mt,Zt)=>{const Fr=Cm(Ye.stretch-fe,De,At,yt),Or=Im(Ye.fixed-Ve,et,Ye.stretch,q),zn=Cm(Dt.stretch-be,Me,Tt,pt),Gs=Im(Dt.fixed-xt,Nt,Dt.stretch,K),Xn=Cm(Mt.stretch-fe,De,At,yt),Rn=Im(Mt.fixed-Ve,et,Mt.stretch,q),xi=Cm(Zt.stretch-be,Me,Tt,pt),wi=Im(Zt.fixed-xt,Nt,Zt.stretch,K),bi=new A(Fr,zn),mn=new A(Xn,zn),Ln=new A(Xn,xi),oi=new A(Fr,xi),Kn=new A(Or/w,Gs/w),Si=new A(Rn/w,wi/w),Jn=i*Math.PI/180;if(Jn){const xr=Math.sin(Jn),$r=Math.cos(Jn),Zr=[$r,-xr,xr,$r];bi._matMult(Zr),mn._matMult(Zr),oi._matMult(Zr),Ln._matMult(Zr)}const ks=Ye.stretch+Ye.fixed,Fi=Dt.stretch+Dt.fixed;return{tl:bi,tr:mn,bl:oi,br:Ln,tex:{x:x.paddedRect.x+Wc+ks,y:x.paddedRect.y+Wc+Fi,w:Mt.stretch+Mt.fixed-ks,h:Zt.stretch+Zt.fixed-Fi},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Kn,pixelOffsetBR:Si,minFontScaleX:et/w/At,minFontScaleY:Nt/w/Tt,isSDF:a}};if(d&&(x.stretchX||x.stretchY)){const Ye=j2(D,Q,q),Dt=j2(L,le,K);for(let Mt=0;Mt0&&(Q=Math.max(10,Q),this.circleDiameter=Q)}else{const j=!((L=w.image)===null||L===void 0)&&L.content&&(w.image.textFitWidth||w.image.textFitHeight)?f2(w):{x1:w.left,y1:w.top,x2:w.right,y2:w.bottom};j.y1=j.y1*b-k[0],j.y2=j.y2*b+k[2],j.x1=j.x1*b-k[3],j.x2=j.x2*b+k[1];const q=w.collisionPadding;if(q&&(j.x1-=q[0]*b,j.y1-=q[1]*b,j.x2+=q[2]*b,j.y2+=q[3]*b),D){const K=new A(j.x1,j.y1),Q=new A(j.x2,j.y1),le=new A(j.x1,j.y2),fe=new A(j.x2,j.y2),De=D*Math.PI/180;K._rotate(De),Q._rotate(De),le._rotate(De),fe._rotate(De),j.x1=Math.min(K.x,Q.x,le.x,fe.x),j.x2=Math.max(K.x,Q.x,le.x,fe.x),j.y1=Math.min(K.y,Q.y,le.y,fe.y),j.y2=Math.max(K.y,Q.y,le.y,fe.y)}i.emplaceBack(a.x,a.y,j.x1,j.y1,j.x2,j.y2,d,y,x)}this.boxEndIndex=i.length}}class eD{constructor(i=[],a=(d,y)=>dy?1:0){if(this.data=i,this.length=this.data.length,this.compare=a,this.length>0)for(let d=(this.length>>1)-1;d>=0;d--)this._down(d)}push(i){this.data.push(i),this._up(this.length++)}pop(){if(this.length===0)return;const i=this.data[0],a=this.data.pop();return--this.length>0&&(this.data[0]=a,this._down(0)),i}peek(){return this.data[0]}_up(i){const{data:a,compare:d}=this,y=a[i];for(;i>0;){const x=i-1>>1,w=a[x];if(d(y,w)>=0)break;a[i]=w,i=x}a[i]=y}_down(i){const{data:a,compare:d}=this,y=this.length>>1,x=a[i];for(;i=0)break;a[i]=a[w],i=w}a[i]=x}}function tD(s,i=1,a=!1){let d=1/0,y=1/0,x=-1/0,w=-1/0;const b=s[0];for(let q=0;qx)&&(x=K.x),(!q||K.y>w)&&(w=K.y)}const k=Math.min(x-d,w-y);let P=k/2;const D=new eD([],rD);if(k===0)return new A(d,y);for(let q=d;qL.d||!L.d)&&(L=q,a&&console.log("found best %d after %d probes",Math.round(1e4*q.d)/1e4,j)),q.max-L.d<=i||(P=q.h/2,D.push(new Gc(q.p.x-P,q.p.y-P,P,s)),D.push(new Gc(q.p.x+P,q.p.y-P,P,s)),D.push(new Gc(q.p.x-P,q.p.y+P,P,s)),D.push(new Gc(q.p.x+P,q.p.y+P,P,s)),j+=4)}return a&&(console.log(`num probes: ${j}`),console.log(`best distance: ${L.d}`)),L.p}function rD(s,i){return i.max-s.max}function Gc(s,i,a,d){this.p=new A(s,i),this.h=a,this.d=function(y,x){let w=!1,b=1/0;for(let k=0;ky.y!=K.y>y.y&&y.x<(K.x-q.x)*(y.y-q.y)/(K.y-q.y)+q.x&&(w=!w),b=Math.min(b,kb(y,q,K))}}return(w?1:-1)*Math.sqrt(b)}(this.p,d),this.max=this.d+this.h*Math.SQRT2}var Yn;g.aq=void 0,(Yn=g.aq||(g.aq={}))[Yn.center=1]="center",Yn[Yn.left=2]="left",Yn[Yn.right=3]="right",Yn[Yn.top=4]="top",Yn[Yn.bottom=5]="bottom",Yn[Yn["top-left"]=6]="top-left",Yn[Yn["top-right"]=7]="top-right",Yn[Yn["bottom-left"]=8]="bottom-left",Yn[Yn["bottom-right"]=9]="bottom-right";const yl=7,z0=Number.POSITIVE_INFINITY;function U2(s,i){return i[1]!==z0?function(a,d,y){let x=0,w=0;switch(d=Math.abs(d),y=Math.abs(y),a){case"top-right":case"top-left":case"top":w=y-yl;break;case"bottom-right":case"bottom-left":case"bottom":w=-y+yl}switch(a){case"top-right":case"bottom-right":case"right":x=-d;break;case"top-left":case"bottom-left":case"left":x=d}return[x,w]}(s,i[0],i[1]):function(a,d){let y=0,x=0;d<0&&(d=0);const w=d/Math.SQRT2;switch(a){case"top-right":case"top-left":x=w-yl;break;case"bottom-right":case"bottom-left":x=-w+yl;break;case"bottom":x=-d+yl;break;case"top":x=d-yl}switch(a){case"top-right":case"bottom-right":y=-w;break;case"top-left":case"bottom-left":y=w;break;case"left":y=d;break;case"right":y=-d}return[y,x]}(s,i[0])}function V2(s,i,a){var d;const y=s.layout,x=(d=y.get("text-variable-anchor-offset"))===null||d===void 0?void 0:d.evaluate(i,{},a);if(x){const b=x.values,k=[];for(let P=0;Pj*Pn);D.startsWith("top")?L[1]-=yl:D.startsWith("bottom")&&(L[1]+=yl),k[P+1]=L}return new Xi(k)}const w=y.get("text-variable-anchor");if(w){let b;b=s._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[y.get("text-radial-offset").evaluate(i,{},a)*Pn,z0]:y.get("text-offset").evaluate(i,{},a).map(P=>P*Pn);const k=[];for(const P of w)k.push(P,U2(P,b));return new Xi(k)}return null}function R0(s){switch(s){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function nD(s,i,a,d,y,x,w,b,k,P,D){let L=x.textMaxSize.evaluate(i,{});L===void 0&&(L=w);const j=s.layers[0].layout,q=j.get("icon-offset").evaluate(i,{},D),K=W2(a.horizontal),Q=w/24,le=s.tilePixelRatio*Q,fe=s.tilePixelRatio*L/24,De=s.tilePixelRatio*b,be=s.tilePixelRatio*j.get("symbol-spacing"),Me=j.get("text-padding")*s.tilePixelRatio,Ve=function(Ye,Dt,Mt,Zt=1){const Fr=Ye.get("icon-padding").evaluate(Dt,{},Mt),Or=Fr&&Fr.values;return[Or[0]*Zt,Or[1]*Zt,Or[2]*Zt,Or[3]*Zt]}(j,i,D,s.tilePixelRatio),et=j.get("text-max-angle")/180*Math.PI,xt=j.get("text-rotation-alignment")!=="viewport"&&j.get("symbol-placement")!=="point",Nt=j.get("icon-rotation-alignment")==="map"&&j.get("symbol-placement")!=="point",yt=j.get("symbol-placement"),pt=be/2,At=j.get("icon-text-fit");let Tt;d&&At!=="none"&&(s.allowVerticalPlacement&&a.vertical&&(Tt=p2(d,a.vertical,At,j.get("icon-text-fit-padding"),q,Q)),K&&(d=p2(d,K,At,j.get("icon-text-fit-padding"),q,Q)));const bt=(Ye,Dt)=>{Dt.x<0||Dt.x>=Cn||Dt.y<0||Dt.y>=Cn||function(Mt,Zt,Fr,Or,zn,Gs,Xn,Rn,xi,wi,bi,mn,Ln,oi,Kn,Si,Jn,ks,Fi,xr,$r,Zr,ns,nn,Zc){const Ro=Mt.addToLineVertexArray(Zt,Fr);let Lo,Zs,Ts,$n,fa=0,rf=0,Y2=0,X2=0,U0=-1,V0=-1;const pa={};let K2=zc("");if(Mt.allowVerticalPlacement&&Or.vertical){const ai=Rn.layout.get("text-rotate").evaluate($r,{},nn)+90;Ts=new Pm(xi,Zt,wi,bi,mn,Or.vertical,Ln,oi,Kn,ai),Xn&&($n=new Pm(xi,Zt,wi,bi,mn,Xn,Jn,ks,Kn,ai))}if(zn){const ai=Rn.layout.get("icon-rotate").evaluate($r,{}),Es=Rn.layout.get("icon-text-fit")!=="none",_u=$2(zn,ai,ns,Es),ho=Xn?$2(Xn,ai,ns,Es):void 0;Zs=new Pm(xi,Zt,wi,bi,mn,zn,Jn,ks,!1,ai),fa=4*_u.length;const vu=Mt.iconSizeData;let Oo=null;vu.kind==="source"?(Oo=[zo*Rn.layout.get("icon-size").evaluate($r,{})],Oo[0]>pl&&je(`${Mt.layerIds[0]}: Value for "icon-size" is >= ${Kd}. Reduce your "icon-size".`)):vu.kind==="composite"&&(Oo=[zo*Zr.compositeIconSizes[0].evaluate($r,{},nn),zo*Zr.compositeIconSizes[1].evaluate($r,{},nn)],(Oo[0]>pl||Oo[1]>pl)&&je(`${Mt.layerIds[0]}: Value for "icon-size" is >= ${Kd}. Reduce your "icon-size".`)),Mt.addSymbols(Mt.icon,_u,Oo,xr,Fi,$r,g.ah.none,Zt,Ro.lineStartIndex,Ro.lineLength,-1,nn),U0=Mt.icon.placedSymbolArray.length-1,ho&&(rf=4*ho.length,Mt.addSymbols(Mt.icon,ho,Oo,xr,Fi,$r,g.ah.vertical,Zt,Ro.lineStartIndex,Ro.lineLength,-1,nn),V0=Mt.icon.placedSymbolArray.length-1)}const J2=Object.keys(Or.horizontal);for(const ai of J2){const Es=Or.horizontal[ai];if(!Lo){K2=zc(Es.text);const ho=Rn.layout.get("text-rotate").evaluate($r,{},nn);Lo=new Pm(xi,Zt,wi,bi,mn,Es,Ln,oi,Kn,ho)}const _u=Es.positionedLines.length===1;if(Y2+=H2(Mt,Zt,Es,Gs,Rn,Kn,$r,Si,Ro,Or.vertical?g.ah.horizontal:g.ah.horizontalOnly,_u?J2:[ai],pa,U0,Zr,nn),_u)break}Or.vertical&&(X2+=H2(Mt,Zt,Or.vertical,Gs,Rn,Kn,$r,Si,Ro,g.ah.vertical,["vertical"],pa,V0,Zr,nn));const oD=Lo?Lo.boxStartIndex:Mt.collisionBoxArray.length,aD=Lo?Lo.boxEndIndex:Mt.collisionBoxArray.length,lD=Ts?Ts.boxStartIndex:Mt.collisionBoxArray.length,uD=Ts?Ts.boxEndIndex:Mt.collisionBoxArray.length,cD=Zs?Zs.boxStartIndex:Mt.collisionBoxArray.length,hD=Zs?Zs.boxEndIndex:Mt.collisionBoxArray.length,dD=$n?$n.boxStartIndex:Mt.collisionBoxArray.length,fD=$n?$n.boxEndIndex:Mt.collisionBoxArray.length;let co=-1;const Am=(ai,Es)=>ai&&ai.circleDiameter?Math.max(ai.circleDiameter,Es):Es;co=Am(Lo,co),co=Am(Ts,co),co=Am(Zs,co),co=Am($n,co);const Q2=co>-1?1:0;Q2&&(co*=Zc/Pn),Mt.glyphOffsetArray.length>=Hc.MAX_GLYPHS&&je("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),$r.sortKey!==void 0&&Mt.addToSortKeyRanges(Mt.symbolInstances.length,$r.sortKey);const pD=V2(Rn,$r,nn),[mD,gD]=function(ai,Es){const _u=ai.length,ho=Es==null?void 0:Es.values;if((ho==null?void 0:ho.length)>0)for(let vu=0;vu=0?pa.right:-1,pa.center>=0?pa.center:-1,pa.left>=0?pa.left:-1,pa.vertical||-1,U0,V0,K2,oD,aD,lD,uD,cD,hD,dD,fD,wi,Y2,X2,fa,rf,Q2,0,Ln,co,mD,gD)}(s,Dt,Ye,a,d,y,Tt,s.layers[0],s.collisionBoxArray,i.index,i.sourceLayerIndex,s.index,le,[Me,Me,Me,Me],xt,k,De,Ve,Nt,q,i,x,P,D,w)};if(yt==="line")for(const Ye of R2(i.geometry,0,0,Cn,Cn)){const Dt=Q3(Ye,be,et,a.vertical||K,d,24,fe,s.overscaling,Cn);for(const Mt of Dt)K&&iD(s,K.text,pt,Mt)||bt(Ye,Mt)}else if(yt==="line-center"){for(const Ye of i.geometry)if(Ye.length>1){const Dt=J3(Ye,et,a.vertical||K,d,24,fe);Dt&&bt(Ye,Dt)}}else if(i.type==="Polygon")for(const Ye of uc(i.geometry,0)){const Dt=tD(Ye,16);bt(Ye[0],new gl(Dt.x,Dt.y,0))}else if(i.type==="LineString")for(const Ye of i.geometry)bt(Ye,new gl(Ye[0].x,Ye[0].y,0));else if(i.type==="Point")for(const Ye of i.geometry)for(const Dt of Ye)bt([Dt],new gl(Dt.x,Dt.y,0))}function H2(s,i,a,d,y,x,w,b,k,P,D,L,j,q,K){const Q=function(De,be,Me,Ve,et,xt,Nt,yt){const pt=Ve.layout.get("text-rotate").evaluate(xt,{})*Math.PI/180,At=[];for(const Tt of be.positionedLines)for(const bt of Tt.positionedGlyphs){if(!bt.rect)continue;const Ye=bt.rect||{};let Dt=o2+1,Mt=!0,Zt=1,Fr=0;const Or=(et||yt)&&bt.vertical,zn=bt.metrics.advance*bt.scale/2;if(yt&&be.verticalizable&&(Fr=Tt.lineOffset/2-(bt.imageName?-(Pn-bt.metrics.width*bt.scale)/2:(bt.scale-1)*Pn)),bt.imageName){const xr=Nt[bt.imageName];Mt=xr.sdf,Zt=xr.pixelRatio,Dt=Oi/Zt}const Gs=et?[bt.x+zn,bt.y]:[0,0];let Xn=et?[0,0]:[bt.x+zn+Me[0],bt.y+Me[1]-Fr],Rn=[0,0];Or&&(Rn=Xn,Xn=[0,0]);const xi=bt.metrics.isDoubleResolution?2:1,wi=(bt.metrics.left-Dt)*bt.scale-zn+Xn[0],bi=(-bt.metrics.top-Dt)*bt.scale+Xn[1],mn=wi+Ye.w/xi*bt.scale/Zt,Ln=bi+Ye.h/xi*bt.scale/Zt,oi=new A(wi,bi),Kn=new A(mn,bi),Si=new A(wi,Ln),Jn=new A(mn,Ln);if(Or){const xr=new A(-zn,zn-Yd),$r=-Math.PI/2,Zr=Pn/2-zn,ns=new A(5-Yd-Zr,-(bt.imageName?Zr:0)),nn=new A(...Rn);oi._rotateAround($r,xr)._add(ns)._add(nn),Kn._rotateAround($r,xr)._add(ns)._add(nn),Si._rotateAround($r,xr)._add(ns)._add(nn),Jn._rotateAround($r,xr)._add(ns)._add(nn)}if(pt){const xr=Math.sin(pt),$r=Math.cos(pt),Zr=[$r,-xr,xr,$r];oi._matMult(Zr),Kn._matMult(Zr),Si._matMult(Zr),Jn._matMult(Zr)}const ks=new A(0,0),Fi=new A(0,0);At.push({tl:oi,tr:Kn,bl:Si,br:Jn,tex:Ye,writingMode:be.writingMode,glyphOffset:Gs,sectionIndex:bt.sectionIndex,isSDF:Mt,pixelOffsetTL:ks,pixelOffsetBR:Fi,minFontScaleX:0,minFontScaleY:0})}return At}(0,a,b,y,x,w,d,s.allowVerticalPlacement),le=s.textSizeData;let fe=null;le.kind==="source"?(fe=[zo*y.layout.get("text-size").evaluate(w,{})],fe[0]>pl&&je(`${s.layerIds[0]}: Value for "text-size" is >= ${Kd}. Reduce your "text-size".`)):le.kind==="composite"&&(fe=[zo*q.compositeTextSizes[0].evaluate(w,{},K),zo*q.compositeTextSizes[1].evaluate(w,{},K)],(fe[0]>pl||fe[1]>pl)&&je(`${s.layerIds[0]}: Value for "text-size" is >= ${Kd}. Reduce your "text-size".`)),s.addSymbols(s.text,Q,fe,b,x,w,P,i,k.lineStartIndex,k.lineLength,j,K);for(const De of D)L[De]=s.text.placedSymbolArray.length-1;return 4*Q.length}function W2(s){for(const i in s)return s[i];return null}function iD(s,i,a,d){const y=s.compareText;if(i in y){const x=y[i];for(let w=x.length-1;w>=0;w--)if(d.dist(x[w])>4;if(y!==1)throw new Error(`Got v${y} data when expected v1.`);const x=G2[15&d];if(!x)throw new Error("Unrecognized array type.");const[w]=new Uint16Array(i,2,1),[b]=new Uint32Array(i,4,1);return new L0(b,w,x,i)}constructor(i,a=64,d=Float64Array,y){if(isNaN(i)||i<0)throw new Error(`Unpexpected numItems value: ${i}.`);this.numItems=+i,this.nodeSize=Math.min(Math.max(+a,2),65535),this.ArrayType=d,this.IndexArrayType=i<65536?Uint16Array:Uint32Array;const x=G2.indexOf(this.ArrayType),w=2*i*this.ArrayType.BYTES_PER_ELEMENT,b=i*this.IndexArrayType.BYTES_PER_ELEMENT,k=(8-b%8)%8;if(x<0)throw new Error(`Unexpected typed array class: ${d}.`);y&&y instanceof ArrayBuffer?(this.data=y,this.ids=new this.IndexArrayType(this.data,8,i),this.coords=new this.ArrayType(this.data,8+b+k,2*i),this._pos=2*i,this._finished=!0):(this.data=new ArrayBuffer(8+w+b+k),this.ids=new this.IndexArrayType(this.data,8,i),this.coords=new this.ArrayType(this.data,8+b+k,2*i),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+x]),new Uint16Array(this.data,2,1)[0]=a,new Uint32Array(this.data,4,1)[0]=i)}add(i,a){const d=this._pos>>1;return this.ids[d]=d,this.coords[this._pos++]=i,this.coords[this._pos++]=a,d}finish(){const i=this._pos>>1;if(i!==this.numItems)throw new Error(`Added ${i} items when expected ${this.numItems}.`);return O0(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(i,a,d,y){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:x,coords:w,nodeSize:b}=this,k=[0,x.length-1,0],P=[];for(;k.length;){const D=k.pop()||0,L=k.pop()||0,j=k.pop()||0;if(L-j<=b){for(let le=j;le<=L;le++){const fe=w[2*le],De=w[2*le+1];fe>=i&&fe<=d&&De>=a&&De<=y&&P.push(x[le])}continue}const q=j+L>>1,K=w[2*q],Q=w[2*q+1];K>=i&&K<=d&&Q>=a&&Q<=y&&P.push(x[q]),(D===0?i<=K:a<=Q)&&(k.push(j),k.push(q-1),k.push(1-D)),(D===0?d>=K:y>=Q)&&(k.push(q+1),k.push(L),k.push(1-D))}return P}within(i,a,d){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:y,coords:x,nodeSize:w}=this,b=[0,y.length-1,0],k=[],P=d*d;for(;b.length;){const D=b.pop()||0,L=b.pop()||0,j=b.pop()||0;if(L-j<=w){for(let le=j;le<=L;le++)q2(x[2*le],x[2*le+1],i,a)<=P&&k.push(y[le]);continue}const q=j+L>>1,K=x[2*q],Q=x[2*q+1];q2(K,Q,i,a)<=P&&k.push(y[q]),(D===0?i-d<=K:a-d<=Q)&&(b.push(j),b.push(q-1),b.push(1-D)),(D===0?i+d>=K:a+d>=Q)&&(b.push(q+1),b.push(L),b.push(1-D))}return k}}function O0(s,i,a,d,y,x){if(y-d<=a)return;const w=d+y>>1;Z2(s,i,w,d,y,x),O0(s,i,a,d,w-1,1-x),O0(s,i,a,w+1,y,1-x)}function Z2(s,i,a,d,y,x){for(;y>d;){if(y-d>600){const P=y-d+1,D=a-d+1,L=Math.log(P),j=.5*Math.exp(2*L/3),q=.5*Math.sqrt(L*j*(P-j)/P)*(D-P/2<0?-1:1);Z2(s,i,a,Math.max(d,Math.floor(a-D*j/P+q)),Math.min(y,Math.floor(a+(P-D)*j/P+q)),x)}const w=i[2*a+x];let b=d,k=y;for(ef(s,i,d,a),i[2*y+x]>w&&ef(s,i,d,y);bw;)k--}i[2*d+x]===w?ef(s,i,d,k):(k++,ef(s,i,k,y)),k<=a&&(d=k+1),a<=k&&(y=k-1)}}function ef(s,i,a,d){F0(s,a,d),F0(i,2*a,2*d),F0(i,2*a+1,2*d+1)}function F0(s,i,a){const d=s[i];s[i]=s[a],s[a]=d}function q2(s,i,a,d){const y=s-a,x=i-d;return y*y+x*x}var B0;g.bg=void 0,(B0=g.bg||(g.bg={})).create="create",B0.load="load",B0.fullLoad="fullLoad";let Mm=null,tf=[];const N0=1e3/60,$0="loadTime",j0="fullLoadTime",sD={mark(s){performance.mark(s)},frame(s){const i=s;Mm!=null&&tf.push(i-Mm),Mm=i},clearMetrics(){Mm=null,tf=[],performance.clearMeasures($0),performance.clearMeasures(j0);for(const s in g.bg)performance.clearMarks(g.bg[s])},getPerformanceMetrics(){performance.measure($0,g.bg.create,g.bg.load),performance.measure(j0,g.bg.create,g.bg.fullLoad);const s=performance.getEntriesByName($0)[0].duration,i=performance.getEntriesByName(j0)[0].duration,a=tf.length,d=1/(tf.reduce((x,w)=>x+w,0)/a/1e3),y=tf.filter(x=>x>N0).reduce((x,w)=>x+(w-N0)/N0,0);return{loadTime:s,fullLoadTime:i,fps:d,percentDroppedFrames:y/(a+y)*100,totalFrames:a}}};g.$=class extends B{},g.A=Bc,g.B=Y_,g.C=function(s){if(vt==null){const i=s.navigator?s.navigator.userAgent:null;vt=!!s.safari||!(!i||!(/\b(iPad|iPhone|iPod)\b/.test(i)||i.match("Safari")&&!i.match("Chrome")))}return vt},g.D=It,g.E=Ue,g.F=class{constructor(s,i){this.target=s,this.mapId=i,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new X3(()=>this.process()),this.subscription=function(a,d,y,x){return a.addEventListener(d,y,!1),{unsubscribe:()=>{a.removeEventListener(d,y,!1)}}}(this.target,"message",a=>this.receive(a)),this.globalScope=Re(self)?s:window}registerMessageHandler(s,i){this.messageHandlers[s]=i}sendAsync(s,i){return new Promise((a,d)=>{const y=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[y]={resolve:a,reject:d},i&&i.signal.addEventListener("abort",()=>{delete this.resolveRejects[y];const b={id:y,type:"",origin:location.origin,targetMapId:s.targetMapId,sourceMapId:this.mapId};this.target.postMessage(b)},{once:!0});const x=[],w=Object.assign(Object.assign({},s),{id:y,sourceMapId:this.mapId,origin:location.origin,data:rl(s.data,x)});this.target.postMessage(w,{transfer:x})})}receive(s){const i=s.data,a=i.id;if(!(i.origin!=="file://"&&location.origin!=="file://"&&i.origin!=="resource://android"&&location.origin!=="resource://android"&&i.origin!==location.origin||i.targetMapId&&this.mapId!==i.targetMapId)){if(i.type===""){delete this.tasks[a];const d=this.abortControllers[a];return delete this.abortControllers[a],void(d&&d.abort())}if(Re(self)||i.mustQueue)return this.tasks[a]=i,this.taskQueue.push(a),void this.invoker.trigger();this.processTask(a,i)}}process(){if(this.taskQueue.length===0)return;const s=this.taskQueue.shift(),i=this.tasks[s];delete this.tasks[s],this.taskQueue.length>0&&this.invoker.trigger(),i&&this.processTask(s,i)}processTask(s,i){return c(this,void 0,void 0,function*(){if(i.type===""){const y=this.resolveRejects[s];return delete this.resolveRejects[s],y?void(i.error?y.reject(nl(i.error)):y.resolve(nl(i.data))):void 0}if(!this.messageHandlers[i.type])return void this.completeTask(s,new Error(`Could not find a registered handler for ${i.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const a=nl(i.data),d=new AbortController;this.abortControllers[s]=d;try{const y=yield this.messageHandlers[i.type](i.sourceMapId,a,d);this.completeTask(s,null,y)}catch(y){this.completeTask(s,y)}})}completeTask(s,i,a){const d=[];delete this.abortControllers[s];const y={id:s,type:"",sourceMapId:this.mapId,origin:location.origin,error:i?rl(i):null,data:rl(a,d)};this.target.postMessage(y,{transfer:d})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},g.G=Jt,g.H=function(){var s=new Bc(16);return Bc!=Float32Array&&(s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[11]=0,s[12]=0,s[13]=0,s[14]=0),s[0]=1,s[5]=1,s[10]=1,s[15]=1,s},g.I=b0,g.J=function(s,i,a){var d,y,x,w,b,k,P,D,L,j,q,K,Q=a[0],le=a[1],fe=a[2];return i===s?(s[12]=i[0]*Q+i[4]*le+i[8]*fe+i[12],s[13]=i[1]*Q+i[5]*le+i[9]*fe+i[13],s[14]=i[2]*Q+i[6]*le+i[10]*fe+i[14],s[15]=i[3]*Q+i[7]*le+i[11]*fe+i[15]):(y=i[1],x=i[2],w=i[3],b=i[4],k=i[5],P=i[6],D=i[7],L=i[8],j=i[9],q=i[10],K=i[11],s[0]=d=i[0],s[1]=y,s[2]=x,s[3]=w,s[4]=b,s[5]=k,s[6]=P,s[7]=D,s[8]=L,s[9]=j,s[10]=q,s[11]=K,s[12]=d*Q+b*le+L*fe+i[12],s[13]=y*Q+k*le+j*fe+i[13],s[14]=x*Q+P*le+q*fe+i[14],s[15]=w*Q+D*le+K*fe+i[15]),s},g.K=function(s,i,a){var d=a[0],y=a[1],x=a[2];return s[0]=i[0]*d,s[1]=i[1]*d,s[2]=i[2]*d,s[3]=i[3]*d,s[4]=i[4]*y,s[5]=i[5]*y,s[6]=i[6]*y,s[7]=i[7]*y,s[8]=i[8]*x,s[9]=i[9]*x,s[10]=i[10]*x,s[11]=i[11]*x,s[12]=i[12],s[13]=i[13],s[14]=i[14],s[15]=i[15],s},g.L=Ib,g.M=function(s,i){const a={};for(let d=0;d{const i=window.document.createElement("video");return i.muted=!0,new Promise(a=>{i.onloadstart=()=>{a(i)};for(const d of s){const y=window.document.createElement("source");_r(d)||(i.crossOrigin="Anonymous"),y.src=d,i.appendChild(y)}})},g.a4=function(){return Fe++},g.a5=_t,g.a6=Hc,g.a7=_d,g.a8=gu,g.a9=M2,g.aA=function(s){if(s.type==="custom")return new Y3(s);switch(s.type){case"background":return new G3(s);case"circle":return new zA(s);case"fill":return new XA(s);case"fill-extrusion":return new h3(s);case"heatmap":return new LA(s);case"hillshade":return new FA(s);case"line":return new v3(s);case"raster":return new q3(s);case"symbol":return new Tm(s)}},g.aB=it,g.aC=function(s,i){if(!s)return[{command:"setStyle",args:[i]}];let a=[];try{if(!Te(s.version,i.version))return[{command:"setStyle",args:[i]}];Te(s.center,i.center)||a.push({command:"setCenter",args:[i.center]}),Te(s.zoom,i.zoom)||a.push({command:"setZoom",args:[i.zoom]}),Te(s.bearing,i.bearing)||a.push({command:"setBearing",args:[i.bearing]}),Te(s.pitch,i.pitch)||a.push({command:"setPitch",args:[i.pitch]}),Te(s.sprite,i.sprite)||a.push({command:"setSprite",args:[i.sprite]}),Te(s.glyphs,i.glyphs)||a.push({command:"setGlyphs",args:[i.glyphs]}),Te(s.transition,i.transition)||a.push({command:"setTransition",args:[i.transition]}),Te(s.light,i.light)||a.push({command:"setLight",args:[i.light]}),Te(s.terrain,i.terrain)||a.push({command:"setTerrain",args:[i.terrain]}),Te(s.sky,i.sky)||a.push({command:"setSky",args:[i.sky]}),Te(s.projection,i.projection)||a.push({command:"setProjection",args:[i.projection]});const d={},y=[];(function(w,b,k,P){let D;for(D in b=b||{},w=w||{})Object.prototype.hasOwnProperty.call(w,D)&&(Object.prototype.hasOwnProperty.call(b,D)||Ne(D,k,P));for(D in b)Object.prototype.hasOwnProperty.call(b,D)&&(Object.prototype.hasOwnProperty.call(w,D)?Te(w[D],b[D])||(w[D].type==="geojson"&&b[D].type==="geojson"&&kt(w,b,D)?Ze(k,{command:"setGeoJSONSourceData",args:[D,b[D].data]}):ot(D,b,k,P)):tt(D,b,k))})(s.sources,i.sources,y,d);const x=[];s.layers&&s.layers.forEach(w=>{"source"in w&&d[w.source]?a.push({command:"removeLayer",args:[w.id]}):x.push(w)}),a=a.concat(y),function(w,b,k){b=b||[];const P=(w=w||[]).map(Bt),D=b.map(Bt),L=w.reduce(Tr,{}),j=b.reduce(Tr,{}),q=P.slice(),K=Object.create(null);let Q,le,fe,De,be;for(let Me=0,Ve=0;Me@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(a,d,y,x)=>{const w=y||x;return i[d]=!w||w.toLowerCase(),""}),i["max-age"]){const a=parseInt(i["max-age"],10);isNaN(a)?delete i["max-age"]:i["max-age"]=a}return i},g.ab=function(s,i){const a=[];for(const d in s)d in i||a.push(d);return a},g.ac=oe,g.ad=function(s,i,a){var d=Math.sin(a),y=Math.cos(a),x=i[0],w=i[1],b=i[2],k=i[3],P=i[4],D=i[5],L=i[6],j=i[7];return i!==s&&(s[8]=i[8],s[9]=i[9],s[10]=i[10],s[11]=i[11],s[12]=i[12],s[13]=i[13],s[14]=i[14],s[15]=i[15]),s[0]=x*y+P*d,s[1]=w*y+D*d,s[2]=b*y+L*d,s[3]=k*y+j*d,s[4]=P*y-x*d,s[5]=D*y-w*d,s[6]=L*y-b*d,s[7]=j*y-k*d,s},g.ae=function(s){var i=new Bc(16);return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i[4]=s[4],i[5]=s[5],i[6]=s[6],i[7]=s[7],i[8]=s[8],i[9]=s[9],i[10]=s[10],i[11]=s[11],i[12]=s[12],i[13]=s[13],i[14]=s[14],i[15]=s[15],i},g.af=gm,g.ag=function(s,i){let a=0,d=0;if(s.kind==="constant")d=s.layoutSize;else if(s.kind!=="source"){const{interpolationType:y,minZoom:x,maxZoom:w}=s,b=y?oe(yi.interpolationFactor(y,i,x,w),0,1):0;s.kind==="camera"?d=gi.number(s.minSize,s.maxSize,b):a=b}return{uSizeT:a,uSize:d}},g.ai=function(s,{uSize:i,uSizeT:a},{lowerSize:d,upperSize:y}){return s.kind==="source"?d/zo:s.kind==="composite"?gi.number(d/zo,y/zo,a):i},g.aj=E0,g.ak=function(s,i,a,d){const y=i.y-s.y,x=i.x-s.x,w=d.y-a.y,b=d.x-a.x,k=w*x-b*y;if(k===0)return null;const P=(b*(s.y-a.y)-w*(s.x-a.x))/k;return new A(s.x+P*x,s.y+P*y)},g.al=R2,g.am=bb,g.an=a0,g.ao=function(s){let i=1/0,a=1/0,d=-1/0,y=-1/0;for(const x of s)i=Math.min(i,x.x),a=Math.min(a,x.y),d=Math.max(d,x.x),y=Math.max(y,x.y);return[i,a,d,y]},g.ap=Pn,g.ar=T0,g.as=function(s,i){var a=i[0],d=i[1],y=i[2],x=i[3],w=i[4],b=i[5],k=i[6],P=i[7],D=i[8],L=i[9],j=i[10],q=i[11],K=i[12],Q=i[13],le=i[14],fe=i[15],De=a*b-d*w,be=a*k-y*w,Me=a*P-x*w,Ve=d*k-y*b,et=d*P-x*b,xt=y*P-x*k,Nt=D*Q-L*K,yt=D*le-j*K,pt=D*fe-q*K,At=L*le-j*Q,Tt=L*fe-q*Q,bt=j*fe-q*le,Ye=De*bt-be*Tt+Me*At+Ve*pt-et*yt+xt*Nt;return Ye?(s[0]=(b*bt-k*Tt+P*At)*(Ye=1/Ye),s[1]=(y*Tt-d*bt-x*At)*Ye,s[2]=(Q*xt-le*et+fe*Ve)*Ye,s[3]=(j*et-L*xt-q*Ve)*Ye,s[4]=(k*pt-w*bt-P*yt)*Ye,s[5]=(a*bt-y*pt+x*yt)*Ye,s[6]=(le*Me-K*xt-fe*be)*Ye,s[7]=(D*xt-j*Me+q*be)*Ye,s[8]=(w*Tt-b*pt+P*Nt)*Ye,s[9]=(d*pt-a*Tt-x*Nt)*Ye,s[10]=(K*et-Q*Me+fe*De)*Ye,s[11]=(L*Me-D*et-q*De)*Ye,s[12]=(b*yt-w*At-k*Nt)*Ye,s[13]=(a*At-d*yt+y*Nt)*Ye,s[14]=(Q*be-K*Ve-le*De)*Ye,s[15]=(D*Ve-L*be+j*De)*Ye,s):null},g.at=R0,g.au=k0,g.av=L0,g.aw=function(){const s={},i=ie.$version;for(const a in ie.$root){const d=ie.$root[a];if(d.required){let y=null;y=a==="version"?i:d.type==="array"?[]:{},y!=null&&(s[a]=y)}}return s},g.ax=Dd,g.ay=Vt,g.az=function(s){s=s.slice();const i=Object.create(null);for(let a=0;a25||d<0||d>=1||a<0||a>=1)},g.bc=function(s,i){return s[0]=i[0],s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=i[1],s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=i[2],s[11]=0,s[12]=0,s[13]=0,s[14]=0,s[15]=1,s},g.bd=class extends R{},g.be=M0,g.bf=sD,g.bh=er,g.bi=function(s,i){nt.REGISTERED_PROTOCOLS[s]=i},g.bj=function(s){delete nt.REGISTERED_PROTOCOLS[s]},g.bk=function(s,i){const a={};for(let y=0;ybt*Pn)}let yt=w?"center":a.get("text-justify").evaluate(P,{},s.canonical);const pt=a.get("symbol-placement")==="point"?a.get("text-max-width").evaluate(P,{},s.canonical)*Pn:1/0,At=()=>{s.bucket.allowVerticalPlacement&&zd(Me)&&(K.vertical=bm(Q,s.glyphMap,s.glyphPositions,s.imagePositions,D,pt,x,xt,"left",et,fe,g.ah.vertical,!0,j,L))};if(!w&&Nt){const Tt=new Set;if(yt==="auto")for(let Ye=0;Yec(void 0,void 0,void 0,function*(){if(s.byteLength===0)return createImageBitmap(new ImageData(1,1));const i=new Blob([new Uint8Array(s)],{type:"image/png"});try{return createImageBitmap(i)}catch(a){throw new Error(`Could not load image because of ${a.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),g.e=ge,g.f=s=>new Promise((i,a)=>{const d=new Image;d.onload=()=>{i(d),URL.revokeObjectURL(d.src),d.onload=null,window.requestAnimationFrame(()=>{d.src=Be})},d.onerror=()=>a(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 y=new Blob([new Uint8Array(s)],{type:"image/png"});d.src=s.byteLength?URL.createObjectURL(y):Be}),g.g=rt,g.h=(s,i)=>Yt(ge(s,{type:"json"}),i),g.i=Re,g.j=V,g.k=Xr,g.l=(s,i)=>Yt(ge(s,{type:"arrayBuffer"}),i),g.m=Yt,g.n=function(s){return new x0(s).readFields(R3,[])},g.o=Ud,g.p=a2,g.q=v,g.r=q_,g.s=_r,g.t=Md,g.u=ua,g.v=ie,g.w=je,g.x=function([s,i,a]){return i+=90,i*=Math.PI/180,a*=Math.PI/180,{x:s*Math.cos(i)*Math.sin(a),y:s*Math.sin(i)*Math.sin(a),z:s*Math.cos(a)}},g.y=gi,g.z=Vr}),h("worker",["./shared"],function(g){class c{constructor(G){this.keyCache={},G&&this.replace(G)}replace(G){this._layerConfigs={},this._layers={},this.update(G,[])}update(G,W){for(const ue of G){this._layerConfigs[ue.id]=ue;const Se=this._layers[ue.id]=g.aA(ue);Se._featureFilter=g.a7(Se.filter),this.keyCache[ue.id]&&delete this.keyCache[ue.id]}for(const ue of W)delete this.keyCache[ue],delete this._layerConfigs[ue],delete this._layers[ue];this.familiesBySource={};const te=g.bk(Object.values(this._layerConfigs),this.keyCache);for(const ue of te){const Se=ue.map($e=>this._layers[$e.id]),Ie=Se[0];if(Ie.visibility==="none")continue;const Ae=Ie.source||"";let _e=this.familiesBySource[Ae];_e||(_e=this.familiesBySource[Ae]={});const He=Ie.sourceLayer||"_geojsonTileLayer";let Je=_e[He];Je||(Je=_e[He]=[]),Je.push(Se)}}}class T{constructor(G){const W={},te=[];for(const Ae in G){const _e=G[Ae],He=W[Ae]={};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};te.push(ut),He[Je]={rect:ut,metrics:$e.metrics}}}const{w:ue,h:Se}=g.p(te),Ie=new g.o({width:ue||1,height:Se||1});for(const Ae in G){const _e=G[Ae];for(const He in _e){const Je=_e[+He];if(!Je||Je.bitmap.width===0||Je.bitmap.height===0)continue;const $e=W[Ae][He].rect;g.o.copy(Je.bitmap,Ie,{x:0,y:0},{x:$e.x+1,y:$e.y+1},Je.bitmap)}}this.image=Ie,this.positions=W}}g.bl("GlyphAtlas",T);class I{constructor(G){this.tileID=new g.S(G.tileID.overscaledZ,G.tileID.wrap,G.tileID.canonical.z,G.tileID.canonical.x,G.tileID.canonical.y),this.uid=G.uid,this.zoom=G.zoom,this.pixelRatio=G.pixelRatio,this.tileSize=G.tileSize,this.source=G.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=G.showCollisionBoxes,this.collectResourceTiming=!!G.collectResourceTiming,this.returnDependencies=!!G.returnDependencies,this.promoteId=G.promoteId,this.inFlightDependencies=[]}parse(G,W,te,ue){return g._(this,void 0,void 0,function*(){this.status="parsing",this.data=G,this.collisionBoxArray=new g.a5;const Se=new g.bm(Object.keys(G.layers).sort()),Ie=new g.bn(this.tileID,this.promoteId);Ie.bucketLayerIDs=[];const Ae={},_e={featureIndex:Ie,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:te},He=W.familiesBySource[this.source];for(const rr in He){const Mr=G.layers[rr];if(!Mr)continue;Mr.version===1&&g.w(`Vector tile source "${this.source}" layer "${rr}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const Yr=Se.encode(rr),Dn=[];for(let Bn=0;Bn=ni.maxzoom||ni.visibility!=="none"&&(z(Bn,this.zoom,te),(Ae[ni.id]=ni.createBucket({index:Ie.bucketLayerIDs.length,layers:Bn,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Yr,sourceID:this.source})).populate(Dn,_e,this.tileID.canonical),Ie.bucketLayerIDs.push(Bn.map(Ba=>Ba.id)))}}const Je=g.aF(_e.glyphDependencies,rr=>Object.keys(rr).map(Number));this.inFlightDependencies.forEach(rr=>rr==null?void 0:rr.abort()),this.inFlightDependencies=[];let $e=Promise.resolve({});if(Object.keys(Je).length){const rr=new AbortController;this.inFlightDependencies.push(rr),$e=ue.sendAsync({type:"GG",data:{stacks:Je,source:this.source,tileID:this.tileID,type:"glyphs"}},rr)}const ut=Object.keys(_e.iconDependencies);let Rt=Promise.resolve({});if(ut.length){const rr=new AbortController;this.inFlightDependencies.push(rr),Rt=ue.sendAsync({type:"GI",data:{icons:ut,source:this.source,tileID:this.tileID,type:"icons"}},rr)}const Ot=Object.keys(_e.patternDependencies);let mr=Promise.resolve({});if(Ot.length){const rr=new AbortController;this.inFlightDependencies.push(rr),mr=ue.sendAsync({type:"GI",data:{icons:Ot,source:this.source,tileID:this.tileID,type:"patterns"}},rr)}const[Qt,gr,or]=yield Promise.all([$e,Rt,mr]),Tn=new T(Qt),rn=new g.bo(gr,or);for(const rr in Ae){const Mr=Ae[rr];Mr instanceof g.a6?(z(Mr.layers,this.zoom,te),g.bp({bucket:Mr,glyphMap:Qt,glyphPositions:Tn.positions,imageMap:gr,imagePositions:rn.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):Mr.hasPattern&&(Mr instanceof g.bq||Mr instanceof g.br||Mr instanceof g.bs)&&(z(Mr.layers,this.zoom,te),Mr.addFeatures(_e,this.tileID.canonical,rn.patternPositions))}return this.status="done",{buckets:Object.values(Ae).filter(rr=>!rr.isEmpty()),featureIndex:Ie,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Tn.image,imageAtlas:rn,glyphMap:this.returnDependencies?Qt:null,iconMap:this.returnDependencies?gr:null,glyphPositions:this.returnDependencies?Tn.positions:null}})}}function z(he,G,W){const te=new g.z(G);for(const ue of he)ue.recalculate(te,W)}class A{constructor(G,W,te){this.actor=G,this.layerIndex=W,this.availableImages=te,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(G,W){return g._(this,void 0,void 0,function*(){const te=yield g.l(G.request,W);try{return{vectorTile:new g.bt.VectorTile(new g.bu(te.data)),rawData:te.data,cacheControl:te.cacheControl,expires:te.expires}}catch(ue){const Se=new Uint8Array(te.data);let Ie=`Unable to parse the tile at ${G.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(G){return g._(this,void 0,void 0,function*(){const W=G.uid,te=!!(G&&G.request&&G.request.collectResourceTiming)&&new g.bv(G.request),ue=new I(G);this.loading[W]=ue;const Se=new AbortController;ue.abort=Se;try{const Ie=yield this.loadVectorTile(G,Se);if(delete this.loading[W],!Ie)return null;const Ae=Ie.rawData,_e={};Ie.expires&&(_e.expires=Ie.expires),Ie.cacheControl&&(_e.cacheControl=Ie.cacheControl);const He={};if(te){const $e=te.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[W]=ue,this.fetching[W]={rawTileData:Ae,cacheControl:_e,resourceTiming:He};try{const $e=yield Je;return g.e({rawTileData:Ae.slice(0)},$e,_e,He)}finally{delete this.fetching[W]}}catch(Ie){throw delete this.loading[W],ue.status="done",this.loaded[W]=ue,Ie}})}reloadTile(G){return g._(this,void 0,void 0,function*(){const W=G.uid;if(!this.loaded||!this.loaded[W])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const te=this.loaded[W];if(te.showCollisionBoxes=G.showCollisionBoxes,te.status==="parsing"){const ue=yield te.parse(te.vectorTile,this.layerIndex,this.availableImages,this.actor);let Se;if(this.fetching[W]){const{rawTileData:Ie,cacheControl:Ae,resourceTiming:_e}=this.fetching[W];delete this.fetching[W],Se=g.e({rawTileData:Ie.slice(0)},ue,Ae,_e)}else Se=ue;return Se}if(te.status==="done"&&te.vectorTile)return te.parse(te.vectorTile,this.layerIndex,this.availableImages,this.actor)})}abortTile(G){return g._(this,void 0,void 0,function*(){const W=this.loading,te=G.uid;W&&W[te]&&W[te].abort&&(W[te].abort.abort(),delete W[te])})}removeTile(G){return g._(this,void 0,void 0,function*(){this.loaded&&this.loaded[G.uid]&&delete this.loaded[G.uid]})}}class M{constructor(){this.loaded={}}loadTile(G){return g._(this,void 0,void 0,function*(){const{uid:W,encoding:te,rawImageData:ue,redFactor:Se,greenFactor:Ie,blueFactor:Ae,baseShift:_e}=G,He=ue.width+2,Je=ue.height+2,$e=g.b(ue)?new g.R({width:He,height:Je},yield g.bw(ue,-1,-1,He,Je)):ue,ut=new g.bx(W,$e,te,Se,Ie,Ae,_e);return this.loaded=this.loaded||{},this.loaded[W]=ut,ut})}removeTile(G){const W=this.loaded,te=G.uid;W&&W[te]&&delete W[te]}}function F(he,G){if(he.length!==0){Y(he[0],G);for(var W=1;W=Math.abs(Ae)?W-_e+Ae:Ae-_e+W,W=_e}W+te>=0!=!!G&&he.reverse()}var U=g.by(function he(G,W){var te,ue=G&&G.type;if(ue==="FeatureCollection")for(te=0;te>31}function Re(he,G){for(var W=he.loadGeometry(),te=he.type,ue=0,Se=0,Ie=W.length,Ae=0;Aehe},Le=Math.fround||(Ke=new Float32Array(1),he=>(Ke[0]=+he,Ke[0]));var Ke;const xe=3,Ee=5,mt=6;class nt{constructor(G){this.options=Object.assign(Object.create(Be),G),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(G){const{log:W,minZoom:te,maxZoom:ue}=this.options;W&&console.time("total time");const Se=`prepare ${G.length} points`;W&&console.time(Se),this.points=G;const Ie=[];for(let _e=0;_e=te;_e--){const He=+Date.now();Ae=this.trees[_e]=this._createTree(this._cluster(Ae,_e)),W&&console.log("z%d: %d clusters in %dms",_e,Ae.numItems,+Date.now()-He)}return W&&console.timeEnd("total time"),this}getClusters(G,W){let te=((G[0]+180)%360+360)%360-180;const ue=Math.max(-90,Math.min(90,G[1]));let Se=G[2]===180?180:((G[2]+180)%360+360)%360-180;const Ie=Math.max(-90,Math.min(90,G[3]));if(G[2]-G[0]>=360)te=-180,Se=180;else if(te>Se){const $e=this.getClusters([te,ue,180,Ie],W),ut=this.getClusters([-180,ue,Se,Ie],W);return $e.concat(ut)}const Ae=this.trees[this._limitZoom(W)],_e=Ae.range(er(te),Vt(Ie),er(Se),Vt(ue)),He=Ae.data,Je=[];for(const $e of _e){const ut=this.stride*$e;Je.push(He[ut+Ee]>1?rt(He,ut,this.clusterProps):this.points[He[ut+xe]])}return Je}getChildren(G){const W=this._getOriginId(G),te=this._getOriginZoom(G),ue="No cluster with the specified id.",Se=this.trees[te];if(!Se)throw new Error(ue);const Ie=Se.data;if(W*this.stride>=Ie.length)throw new Error(ue);const Ae=this.options.radius/(this.options.extent*Math.pow(2,te-1)),_e=Se.within(Ie[W*this.stride],Ie[W*this.stride+1],Ae),He=[];for(const Je of _e){const $e=Je*this.stride;Ie[$e+4]===G&&He.push(Ie[$e+Ee]>1?rt(Ie,$e,this.clusterProps):this.points[Ie[$e+xe]])}if(He.length===0)throw new Error(ue);return He}getLeaves(G,W,te){const ue=[];return this._appendLeaves(ue,G,W=W||10,te=te||0,0),ue}getTile(G,W,te){const ue=this.trees[this._limitZoom(G)],Se=Math.pow(2,G),{extent:Ie,radius:Ae}=this.options,_e=Ae/Ie,He=(te-_e)/Se,Je=(te+1+_e)/Se,$e={features:[]};return this._addTileFeatures(ue.range((W-_e)/Se,He,(W+1+_e)/Se,Je),ue.data,W,te,Se,$e),W===0&&this._addTileFeatures(ue.range(1-_e/Se,He,1,Je),ue.data,Se,te,Se,$e),W===Se-1&&this._addTileFeatures(ue.range(0,He,_e/Se,Je),ue.data,-1,te,Se,$e),$e.features.length?$e:null}getClusterExpansionZoom(G){let W=this._getOriginZoom(G)-1;for(;W<=this.options.maxZoom;){const te=this.getChildren(G);if(W++,te.length!==1)break;G=te[0].properties.cluster_id}return W}_appendLeaves(G,W,te,ue,Se){const Ie=this.getChildren(W);for(const Ae of Ie){const _e=Ae.properties;if(_e&&_e.cluster?Se+_e.point_count<=ue?Se+=_e.point_count:Se=this._appendLeaves(G,_e.cluster_id,te,ue,Se):Se1;let Je,$e,ut;if(He)Je=Jt(W,_e,this.clusterProps),$e=W[_e],ut=W[_e+1];else{const mr=this.points[W[_e+xe]];Je=mr.properties;const[Qt,gr]=mr.geometry.coordinates;$e=er(Qt),ut=Vt(gr)}const Rt={type:1,geometry:[[Math.round(this.options.extent*($e*Se-te)),Math.round(this.options.extent*(ut*Se-ue))]],tags:Je};let Ot;Ot=He||this.options.generateId?W[_e+xe]:this.points[W[_e+xe]].id,Ot!==void 0&&(Rt.id=Ot),Ie.features.push(Rt)}}_limitZoom(G){return Math.max(this.options.minZoom,Math.min(Math.floor(+G),this.options.maxZoom+1))}_cluster(G,W){const{radius:te,extent:ue,reduce:Se,minPoints:Ie}=this.options,Ae=te/(ue*Math.pow(2,W)),_e=G.data,He=[],Je=this.stride;for(let $e=0;$e<_e.length;$e+=Je){if(_e[$e+2]<=W)continue;_e[$e+2]=W;const ut=_e[$e],Rt=_e[$e+1],Ot=G.within(_e[$e],_e[$e+1],Ae),mr=_e[$e+Ee];let Qt=mr;for(const gr of Ot){const or=gr*Je;_e[or+2]>W&&(Qt+=_e[or+Ee])}if(Qt>mr&&Qt>=Ie){let gr,or=ut*mr,Tn=Rt*mr,rn=-1;const rr=(($e/Je|0)<<5)+(W+1)+this.points.length;for(const Mr of Ot){const Yr=Mr*Je;if(_e[Yr+2]<=W)continue;_e[Yr+2]=W;const Dn=_e[Yr+Ee];or+=_e[Yr]*Dn,Tn+=_e[Yr+1]*Dn,_e[Yr+4]=rr,Se&&(gr||(gr=this._map(_e,$e,!0),rn=this.clusterProps.length,this.clusterProps.push(gr)),Se(gr,this._map(_e,Yr)))}_e[$e+4]=rr,He.push(or/Qt,Tn/Qt,1/0,rr,-1,Qt),Se&&He.push(rn)}else{for(let gr=0;gr1)for(const gr of Ot){const or=gr*Je;if(!(_e[or+2]<=W)){_e[or+2]=W;for(let Tn=0;Tn>5}_getOriginZoom(G){return(G-this.points.length)%32}_map(G,W,te){if(G[W+Ee]>1){const Ie=this.clusterProps[G[W+mt]];return te?Object.assign({},Ie):Ie}const ue=this.points[G[W+xe]].properties,Se=this.options.map(ue);return te&&Se===ue?Object.assign({},Se):Se}}function rt(he,G,W){return{type:"Feature",id:he[G+xe],properties:Jt(he,G,W),geometry:{type:"Point",coordinates:[(te=he[G],360*(te-.5)),Yt(he[G+1])]}};var te}function Jt(he,G,W){const te=he[G+Ee],ue=te>=1e4?`${Math.round(te/1e3)}k`:te>=1e3?Math.round(te/100)/10+"k":te,Se=he[G+mt],Ie=Se===-1?{}:Object.assign({},W[Se]);return Object.assign(Ie,{cluster:!0,cluster_id:he[G+xe],point_count:te,point_count_abbreviated:ue})}function er(he){return he/360+.5}function Vt(he){const G=Math.sin(he*Math.PI/180),W=.5-.25*Math.log((1+G)/(1-G))/Math.PI;return W<0?0:W>1?1:W}function Yt(he){const G=(180-360*he)*Math.PI/180;return 360*Math.atan(Math.exp(G))/Math.PI-90}function _r(he,G,W,te){let ue=te;const Se=G+(W-G>>1);let Ie,Ae=W-G;const _e=he[G],He=he[G+1],Je=he[W],$e=he[W+1];for(let ut=G+3;utue)Ie=ut,ue=Rt;else if(Rt===ue){const Ot=Math.abs(ut-Se);Otte&&(Ie-G>3&&_r(he,G,Ie,te),he[Ie+2]=ue,W-Ie>3&&_r(he,Ie,W,te))}function fr(he,G,W,te,ue,Se){let Ie=ue-W,Ae=Se-te;if(Ie!==0||Ae!==0){const _e=((he-W)*Ie+(G-te)*Ae)/(Ie*Ie+Ae*Ae);_e>1?(W=ue,te=Se):_e>0&&(W+=Ie*_e,te+=Ae*_e)}return Ie=he-W,Ae=G-te,Ie*Ie+Ae*Ae}function br(he,G,W,te){const ue={id:he??null,type:G,geometry:W,tags:te,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(G==="Point"||G==="MultiPoint"||G==="LineString")Xr(ue,W);else if(G==="Polygon")Xr(ue,W[0]);else if(G==="MultiLineString")for(const Se of W)Xr(ue,Se);else if(G==="MultiPolygon")for(const Se of W)Xr(ue,Se[0]);return ue}function Xr(he,G){for(let W=0;W0&&(Ie+=te?(ue*Je-He*Se)/2:Math.sqrt(Math.pow(He-ue,2)+Math.pow(Je-Se,2))),ue=He,Se=Je}const Ae=G.length-3;G[2]=1,_r(G,0,Ae,W),G[Ae+2]=1,G.size=Math.abs(Ie),G.start=0,G.end=G.size}function de(he,G,W,te){for(let ue=0;ue1?1:W}function Ze(he,G,W,te,ue,Se,Ie,Ae){if(te/=G,Se>=(W/=G)&&Ie=te)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,Rt=ue===0?He.maxX:He.maxY;if(ut>=W&&Rt=te)continue;let Ot=[];if($e==="Point"||$e==="MultiPoint")tt(Je,Ot,W,te,ue);else if($e==="LineString")Ne(Je,Ot,W,te,ue,!1,Ae.lineMetrics);else if($e==="MultiLineString")kt(Je,Ot,W,te,ue,!1);else if($e==="Polygon")kt(Je,Ot,W,te,ue,!0);else if($e==="MultiPolygon")for(const mr of Je){const Qt=[];kt(mr,Qt,W,te,ue,!0),Qt.length&&Ot.push(Qt)}if(Ot.length){if(Ae.lineMetrics&&$e==="LineString"){for(const mr of Ot)_e.push(br(He.id,$e,mr,He.tags));continue}$e!=="LineString"&&$e!=="MultiLineString"||(Ot.length===1?($e="LineString",Ot=Ot[0]):$e="MultiLineString"),$e!=="Point"&&$e!=="MultiPoint"||($e=Ot.length===3?"Point":"MultiPoint"),_e.push(br(He.id,$e,Ot,He.tags))}}return _e.length?_e:null}function tt(he,G,W,te,ue){for(let Se=0;Se=W&&Ie<=te&&at(G,he[Se],he[Se+1],he[Se+2])}}function Ne(he,G,W,te,ue,Se,Ie){let Ae=ot(he);const _e=ue===0?Bt:Tr;let He,Je,$e=he.start;for(let Qt=0;QtW&&(Je=_e(Ae,gr,or,rn,rr,W),Ie&&(Ae.start=$e+He*Je)):Mr>te?Yr=W&&(Je=_e(Ae,gr,or,rn,rr,W),Dn=!0),Yr>te&&Mr<=te&&(Je=_e(Ae,gr,or,rn,rr,te),Dn=!0),!Se&&Dn&&(Ie&&(Ae.end=$e+He*Je),G.push(Ae),Ae=ot(he)),Ie&&($e+=He)}let ut=he.length-3;const Rt=he[ut],Ot=he[ut+1],mr=ue===0?Rt:Ot;mr>=W&&mr<=te&&at(Ae,Rt,Ot,he[ut+2]),ut=Ae.length-3,Se&&ut>=3&&(Ae[ut]!==Ae[0]||Ae[ut+1]!==Ae[1])&&at(Ae,Ae[0],Ae[1],Ae[2]),Ae.length&&G.push(Ae)}function ot(he){const G=[];return G.size=he.size,G.start=he.start,G.end=he.end,G}function kt(he,G,W,te,ue,Se){for(const Ie of he)Ne(Ie,G,W,te,ue,Se,!1)}function at(he,G,W,te){he.push(G,W,te)}function Bt(he,G,W,te,ue,Se){const Ie=(Se-G)/(te-G);return at(he,Se,W+(ue-W)*Ie,1),Ie}function Tr(he,G,W,te,ue,Se){const Ie=(Se-W)/(ue-W);return at(he,G+(te-G)*Ie,Se,1),Ie}function qe(he,G){const W=[];for(let te=0;te0&&G.size<(ue?Ie:te))return void(W.numPoints+=G.length/3);const Ae=[];for(let _e=0;_eIe)&&(W.numSimplified++,Ae.push(G[_e],G[_e+1])),W.numPoints++;ue&&function(_e,He){let Je=0;for(let $e=0,ut=_e.length,Rt=ut-2;$e0===He)for(let $e=0,ut=_e.length;$e24)throw new Error("maxZoom should be in the 0-24 range");if(W.promoteId&&W.generateId)throw new Error("promoteId and generateId cannot be used together.");let ue=function(Se,Ie){const Ae=[];if(Se.type==="FeatureCollection")for(let _e=0;_e1&&console.time("creation"),Rt=this.tiles[ut]=pi(G,W,te,ue,He),this.tileCoords.push({z:W,x:te,y:ue}),Je)){Je>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",W,te,ue,Rt.numFeatures,Rt.numPoints,Rt.numSimplified),console.timeEnd("creation"));const Dn=`z${W}`;this.stats[Dn]=(this.stats[Dn]||0)+1,this.total++}if(Rt.source=G,Se==null){if(W===He.indexMaxZoom||Rt.numPoints<=He.indexMaxPoints)continue}else{if(W===He.maxZoom||W===Se)continue;if(Se!=null){const Dn=Se-W;if(te!==Ie>>Dn||ue!==Ae>>Dn)continue}}if(Rt.source=null,G.length===0)continue;Je>1&&console.time("clipping");const Ot=.5*He.buffer/He.extent,mr=.5-Ot,Qt=.5+Ot,gr=1+Ot;let or=null,Tn=null,rn=null,rr=null,Mr=Ze(G,$e,te-Ot,te+Qt,0,Rt.minX,Rt.maxX,He),Yr=Ze(G,$e,te+mr,te+gr,0,Rt.minX,Rt.maxX,He);G=null,Mr&&(or=Ze(Mr,$e,ue-Ot,ue+Qt,1,Rt.minY,Rt.maxY,He),Tn=Ze(Mr,$e,ue+mr,ue+gr,1,Rt.minY,Rt.maxY,He),Mr=null),Yr&&(rn=Ze(Yr,$e,ue-Ot,ue+Qt,1,Rt.minY,Rt.maxY,He),rr=Ze(Yr,$e,ue+mr,ue+gr,1,Rt.minY,Rt.maxY,He),Yr=null),Je>1&&console.timeEnd("clipping"),_e.push(or||[],W+1,2*te,2*ue),_e.push(Tn||[],W+1,2*te,2*ue+1),_e.push(rn||[],W+1,2*te+1,2*ue),_e.push(rr||[],W+1,2*te+1,2*ue+1)}}getTile(G,W,te){G=+G,W=+W,te=+te;const ue=this.options,{extent:Se,debug:Ie}=ue;if(G<0||G>24)return null;const Ae=1<1&&console.log("drilling down to z%d-%d-%d",G,W,te);let He,Je=G,$e=W,ut=te;for(;!He&&Je>0;)Je--,$e>>=1,ut>>=1,He=this.tiles[mi(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,G,W,te),Ie>1&&console.timeEnd("drilling down"),this.tiles[_e]?_n(this.tiles[_e],Se):null):null}}function mi(he,G,W){return 32*((1<{$e.properties=Rt;const Ot={};for(const mr of ut)Ot[mr]=_e[mr].evaluate(Je,$e);return Ot},Ie.reduce=(Rt,Ot)=>{$e.properties=Ot;for(const mr of ut)Je.accumulated=Rt[mr],Rt[mr]=He[mr].evaluate(Je,$e)},Ie}(G)).load((yield this._pendingData).features):(ue=yield this._pendingData,new Kr(ue,G.geojsonVtOptions)),this.loaded={};const Se={};if(te){const Ie=te.finish();Ie&&(Se.resourceTiming={},Se.resourceTiming[G.source]=JSON.parse(JSON.stringify(Ie)))}return Se}catch(Se){if(delete this._pendingRequest,g.bB(Se))return{abandoned:!0};throw Se}var ue})}getData(){return g._(this,void 0,void 0,function*(){return this._pendingData})}reloadTile(G){const W=this.loaded;return W&&W[G.uid]?super.reloadTile(G):this.loadTile(G)}loadAndProcessGeoJSON(G,W){return g._(this,void 0,void 0,function*(){let te=yield this.loadGeoJSON(G,W);if(delete this._pendingRequest,typeof te!="object")throw new Error(`Input data given to '${G.source}' is not a valid GeoJSON object.`);if(U(te,!0),G.filter){const ue=g.bC(G.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(", "));te={type:"FeatureCollection",features:te.features.filter(Ie=>ue.value.evaluate({zoom:0},Ie))}}return te})}loadGeoJSON(G,W){return g._(this,void 0,void 0,function*(){const{promoteId:te}=G;if(G.request){const ue=yield g.h(G.request,W);return this._dataUpdateable=Yi(ue.data,te)?fs(ue.data,te):void 0,ue.data}if(typeof G.data=="string")try{const ue=JSON.parse(G.data);return this._dataUpdateable=Yi(ue,te)?fs(ue,te):void 0,ue}catch{throw new Error(`Input data given to '${G.source}' is not a valid GeoJSON object.`)}if(!G.dataDiff)throw new Error(`Input data given to '${G.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${G.source}`);return function(ue,Se,Ie){var Ae,_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=Xt($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 Rt=!$e.removeAllProperties&&(((Ae=$e.removeProperties)===null||Ae===void 0?void 0:Ae.length)>0||((_e=$e.addOrUpdateProperties)===null||_e===void 0?void 0:_e.length)>0);if(($e.newGeometry||$e.removeAllProperties||Rt)&&(ut=Object.assign({},ut),ue.set($e.id,ut),Rt&&(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 Ot of $e.removeProperties)Object.prototype.hasOwnProperty.call(ut.properties,Ot)&&delete ut.properties[Ot];if(((Je=$e.addOrUpdateProperties)===null||Je===void 0?void 0:Je.length)>0)for(const{key:Ot,value:mr}of $e.addOrUpdateProperties)ut.properties[Ot]=mr}}(this._dataUpdateable,G.dataDiff,te),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(G){return g._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(G){return this._geoJSONIndex.getClusterExpansionZoom(G.clusterId)}getClusterChildren(G){return this._geoJSONIndex.getChildren(G.clusterId)}getClusterLeaves(G){return this._geoJSONIndex.getLeaves(G.clusterId,G.limit,G.offset)}}class Hn{constructor(G){this.self=G,this.actor=new g.F(G),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(W,te)=>{if(this.externalWorkerSourceTypes[W])throw new Error(`Worker source with name "${W}" already registered.`);this.externalWorkerSourceTypes[W]=te},this.self.addProtocol=g.bi,this.self.removeProtocol=g.bj,this.self.registerRTLTextPlugin=W=>{if(g.bD.isParsed())throw new Error("RTL text plugin already registered.");g.bD.setMethods(W)},this.actor.registerMessageHandler("LDT",(W,te)=>this._getDEMWorkerSource(W,te.source).loadTile(te)),this.actor.registerMessageHandler("RDT",(W,te)=>g._(this,void 0,void 0,function*(){this._getDEMWorkerSource(W,te.source).removeTile(te)})),this.actor.registerMessageHandler("GCEZ",(W,te)=>g._(this,void 0,void 0,function*(){return this._getWorkerSource(W,te.type,te.source).getClusterExpansionZoom(te)})),this.actor.registerMessageHandler("GCC",(W,te)=>g._(this,void 0,void 0,function*(){return this._getWorkerSource(W,te.type,te.source).getClusterChildren(te)})),this.actor.registerMessageHandler("GCL",(W,te)=>g._(this,void 0,void 0,function*(){return this._getWorkerSource(W,te.type,te.source).getClusterLeaves(te)})),this.actor.registerMessageHandler("LD",(W,te)=>this._getWorkerSource(W,te.type,te.source).loadData(te)),this.actor.registerMessageHandler("GD",(W,te)=>this._getWorkerSource(W,te.type,te.source).getData()),this.actor.registerMessageHandler("LT",(W,te)=>this._getWorkerSource(W,te.type,te.source).loadTile(te)),this.actor.registerMessageHandler("RT",(W,te)=>this._getWorkerSource(W,te.type,te.source).reloadTile(te)),this.actor.registerMessageHandler("AT",(W,te)=>this._getWorkerSource(W,te.type,te.source).abortTile(te)),this.actor.registerMessageHandler("RMT",(W,te)=>this._getWorkerSource(W,te.type,te.source).removeTile(te)),this.actor.registerMessageHandler("RS",(W,te)=>g._(this,void 0,void 0,function*(){if(!this.workerSources[W]||!this.workerSources[W][te.type]||!this.workerSources[W][te.type][te.source])return;const ue=this.workerSources[W][te.type][te.source];delete this.workerSources[W][te.type][te.source],ue.removeSource!==void 0&&ue.removeSource(te)})),this.actor.registerMessageHandler("RM",W=>g._(this,void 0,void 0,function*(){delete this.layerIndexes[W],delete this.availableImages[W],delete this.workerSources[W],delete this.demWorkerSources[W]})),this.actor.registerMessageHandler("SR",(W,te)=>g._(this,void 0,void 0,function*(){this.referrer=te})),this.actor.registerMessageHandler("SRPS",(W,te)=>this._syncRTLPluginState(W,te)),this.actor.registerMessageHandler("IS",(W,te)=>g._(this,void 0,void 0,function*(){this.self.importScripts(te)})),this.actor.registerMessageHandler("SI",(W,te)=>this._setImages(W,te)),this.actor.registerMessageHandler("UL",(W,te)=>g._(this,void 0,void 0,function*(){this._getLayerIndex(W).update(te.layers,te.removedIds)})),this.actor.registerMessageHandler("SL",(W,te)=>g._(this,void 0,void 0,function*(){this._getLayerIndex(W).replace(te)}))}_setImages(G,W){return g._(this,void 0,void 0,function*(){this.availableImages[G]=W;for(const te in this.workerSources[G]){const ue=this.workerSources[G][te];for(const Se in ue)ue[Se].availableImages=W}})}_syncRTLPluginState(G,W){return g._(this,void 0,void 0,function*(){if(g.bD.isParsed())return g.bD.getState();if(W.pluginStatus!=="loading")return g.bD.setState(W),W;const te=W.pluginURL;if(this.self.importScripts(te),g.bD.isParsed()){const ue={pluginStatus:"loaded",pluginURL:te};return g.bD.setState(ue),ue}throw g.bD.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${te}`)})}_getAvailableImages(G){let W=this.availableImages[G];return W||(W=[]),W}_getLayerIndex(G){let W=this.layerIndexes[G];return W||(W=this.layerIndexes[G]=new c),W}_getWorkerSource(G,W,te){if(this.workerSources[G]||(this.workerSources[G]={}),this.workerSources[G][W]||(this.workerSources[G][W]={}),!this.workerSources[G][W][te]){const ue={sendAsync:(Se,Ie)=>(Se.targetMapId=G,this.actor.sendAsync(Se,Ie))};switch(W){case"vector":this.workerSources[G][W][te]=new A(ue,this._getLayerIndex(G),this._getAvailableImages(G));break;case"geojson":this.workerSources[G][W][te]=new ps(ue,this._getLayerIndex(G),this._getAvailableImages(G));break;default:this.workerSources[G][W][te]=new this.externalWorkerSourceTypes[W](ue,this._getLayerIndex(G),this._getAvailableImages(G))}}return this.workerSources[G][W][te]}_getDEMWorkerSource(G,W){return this.demWorkerSources[G]||(this.demWorkerSources[G]={}),this.demWorkerSources[G][W]||(this.demWorkerSources[G][W]=new M),this.demWorkerSources[G][W]}}return g.i(self)&&(self.worker=new Hn(self)),Hn}),h("index",["exports","./shared"],function(g,c){var T="4.7.1";let I,z;const A={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:v=>new Promise((r,u)=>{const p=requestAnimationFrame(r);v.signal.addEventListener("abort",()=>{cancelAnimationFrame(p),u(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"),u=r.getContext("2d",{willReadFrequently:!0});if(!u)throw new Error("failed to create canvas 2d context");return r.width=v.width,r.height=v.height,u.drawImage(v,0,0,v.width,v.height),u},resolveURL:v=>(I||(I=document.createElement("a")),I.href=v,I.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(z==null&&(z=matchMedia("(prefers-reduced-motion: reduce)")),z.matches)}};class M{static testProp(r){if(!M.docStyle)return r[0];for(let u=0;u{window.removeEventListener("click",M.suppressClickInternal,!0)},0)}static getScale(r){const u=r.getBoundingClientRect();return{x:u.width/r.offsetWidth||1,y:u.height/r.offsetHeight||1,boundingClientRect:u}}static getPoint(r,u,p){const m=u.boundingClientRect;return new c.P((p.clientX-m.left)/u.x-r.clientLeft,(p.clientY-m.top)/u.y-r.clientTop)}static mousePos(r,u){const p=M.getScale(r);return M.getPoint(r,p,u)}static touchPos(r,u){const p=[],m=M.getScale(r);for(let _=0;_{Y&&$(Y),Y=null,O=!0},U.onerror=()=>{J=!0,Y=null},U.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(v){let r,u,p,m;v.resetRequestQueue=()=>{r=[],u=0,p=0,m={}},v.addThrottleControl=C=>{const R=p++;return m[R]=C,R},v.removeThrottleControl=C=>{delete m[C],S()},v.getImage=(C,R,B=!0)=>new Promise((N,X)=>{F.supported&&(C.headers||(C.headers={}),C.headers.accept="image/webp,*/*"),c.e(C,{type:"image"}),r.push({abortController:R,requestParameters:C,supportImageRefresh:B,state:"queued",onError:ee=>{X(ee)},onSuccess:ee=>{N(ee)}}),S()});const _=C=>c._(this,void 0,void 0,function*(){C.state="running";const{requestParameters:R,supportImageRefresh:B,onError:N,onSuccess:X,abortController:ee}=C,re=B===!1&&!c.i(self)&&!c.g(R.url)&&(!R.headers||Object.keys(R.headers).reduce((me,we)=>me&&we==="accept",!0));u++;const ce=re?E(R,ee):c.m(R,ee);try{const me=yield ce;delete C.abortController,C.state="completed",me.data instanceof HTMLImageElement||c.b(me.data)?X(me):me.data&&X({data:yield(pe=me.data,typeof createImageBitmap=="function"?c.d(pe):c.f(pe)),cacheControl:me.cacheControl,expires:me.expires})}catch(me){delete C.abortController,N(me)}finally{u--,S()}var pe}),S=()=>{const C=(()=>{for(const R of Object.keys(m))if(m[R]())return!0;return!1})()?c.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:c.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let R=u;R0;R++){const B=r.shift();B.abortController.signal.aborted?R--:_(B)}},E=(C,R)=>new Promise((B,N)=>{const X=new Image,ee=C.url,re=C.credentials;re&&re==="include"?X.crossOrigin="use-credentials":(re&&re==="same-origin"||!c.s(ee))&&(X.crossOrigin="anonymous"),R.signal.addEventListener("abort",()=>{X.src="",N(c.c())}),X.fetchPriority="high",X.onload=()=>{X.onerror=X.onload=null,B({data:X})},X.onerror=()=>{X.onerror=X.onload=null,R.signal.aborted||N(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."))},X.src=ee})}(Z||(Z={})),Z.resetRequestQueue();class ne{constructor(r){this._transformRequestFn=r}transformRequest(r,u){return this._transformRequestFn&&this._transformRequestFn(r,u)||{url:r}}setTransformRequest(r){this._transformRequestFn=r}}function oe(v){var r=new c.A(3);return r[0]=v[0],r[1]=v[1],r[2]=v[2],r}var ke,ge=function(v,r,u){return v[0]=r[0]-u[0],v[1]=r[1]-u[1],v[2]=r[2]-u[2],v};ke=new c.A(3),c.A!=Float32Array&&(ke[0]=0,ke[1]=0,ke[2]=0);var Fe=function(v){var r=v[0],u=v[1];return r*r+u*u};function Oe(v){const r=[];if(typeof v=="string")r.push({id:"default",url:v});else if(v&&v.length>0){const u=[];for(const{id:p,url:m}of v){const _=`${p}${m}`;u.indexOf(_)===-1&&(u.push(_),r.push({id:p,url:m}))}}return r}function Ge(v,r,u){const p=v.split("?");return p[0]+=`${r}${u}`,p.join("?")}(function(){var v=new c.A(2);c.A!=Float32Array&&(v[0]=0,v[1]=0)})();class it{constructor(r,u,p,m){this.context=r,this.format=p,this.texture=r.gl.createTexture(),this.update(u,m)}update(r,u,p){const{width:m,height:_}=r,S=!(this.size&&this.size[0]===m&&this.size[1]===_||p),{context:E}=this,{gl:C}=E;if(this.useMipmap=!!(u&&u.useMipmap),C.bindTexture(C.TEXTURE_2D,this.texture),E.pixelStoreUnpackFlipY.set(!1),E.pixelStoreUnpack.set(1),E.pixelStoreUnpackPremultiplyAlpha.set(this.format===C.RGBA&&(!u||u.premultiply!==!1)),S)this.size=[m,_],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,m,_,0,this.format,C.UNSIGNED_BYTE,r.data);else{const{x:R,y:B}=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,R,B,C.RGBA,C.UNSIGNED_BYTE,r):C.texSubImage2D(C.TEXTURE_2D,0,R,B,m,_,C.RGBA,C.UNSIGNED_BYTE,r.data)}this.useMipmap&&this.isSizePowerOfTwo()&&C.generateMipmap(C.TEXTURE_2D)}bind(r,u,p){const{context:m}=this,{gl:_}=m;_.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),u!==this.wrap&&(_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_S,u),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_T,u),this.wrap=u)}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:u,promiseResolve:p}of this.requestors)p(this._getImagesForIds(u));this.requestors=[]}}getImage(r){const u=this.images[r];if(u&&!u.data&&u.spriteData){const p=u.spriteData;u.data=new c.R({width:p.width,height:p.height},p.context.getImageData(p.x,p.y,p.width,p.height).data),u.spriteData=null}return u}addImage(r,u){if(this.images[r])throw new Error(`Image id ${r} already exist, use updateImage instead`);this._validate(r,u)&&(this.images[r]=u)}_validate(r,u){let p=!0;const m=u.data||u.spriteData;return this._validateStretch(u.stretchX,m&&m.width)||(this.fire(new c.j(new Error(`Image "${r}" has invalid "stretchX" value`))),p=!1),this._validateStretch(u.stretchY,m&&m.height)||(this.fire(new c.j(new Error(`Image "${r}" has invalid "stretchY" value`))),p=!1),this._validateContent(u.content,u)||(this.fire(new c.j(new Error(`Image "${r}" has invalid "content" value`))),p=!1),p}_validateStretch(r,u){if(!r)return!0;let p=0;for(const m of r){if(m[0]{let m=!0;if(!this.isLoaded())for(const _ of r)this.images[_]||(m=!1);this.isLoaded()||m?u(this._getImagesForIds(r)):this.requestors.push({ids:r,promiseResolve:u})})}_getImagesForIds(r){const u={};for(const p of r){let m=this.getImage(p);m||(this.fire(new c.k("styleimagemissing",{id:p})),m=this.getImage(p)),m?u[p]={data:m.data.clone(),pixelRatio:m.pixelRatio,sdf:m.sdf,version:m.version,stretchX:m.stretchX,stretchY:m.stretchY,content:m.content,textFitWidth:m.textFitWidth,textFitHeight:m.textFitHeight,hasRenderCallback:!!(m.userImage&&m.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 u}getPixelSize(){const{width:r,height:u}=this.atlasImage;return{width:r,height:u}}getPattern(r){const u=this.patterns[r],p=this.getImage(r);if(!p)return null;if(u&&u.position.version===p.version)return u.position;if(u)u.position.version=p.version;else{const m={w:p.data.width+2,h:p.data.height+2,x:0,y:0},_=new c.I(m,p);this.patterns[r]={bin:m,position:_}}return this._updatePatternAtlas(),this.patterns[r].position}bind(r){const u=r.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new it(r,this.atlasImage,u.RGBA),this.atlasTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE)}_updatePatternAtlas(){const r=[];for(const _ in this.patterns)r.push(this.patterns[_].bin);const{w:u,h:p}=c.p(r),m=this.atlasImage;m.resize({width:u||1,height:p||1});for(const _ in this.patterns){const{bin:S}=this.patterns[_],E=S.x+1,C=S.y+1,R=this.getImage(_).data,B=R.width,N=R.height;c.R.copy(R,m,{x:0,y:0},{x:E,y:C},{width:B,height:N}),c.R.copy(R,m,{x:0,y:N-1},{x:E,y:C-1},{width:B,height:1}),c.R.copy(R,m,{x:0,y:0},{x:E,y:C+N},{width:B,height:1}),c.R.copy(R,m,{x:B-1,y:0},{x:E-1,y:C},{width:1,height:N}),c.R.copy(R,m,{x:0,y:0},{x:E+B,y:C},{width:1,height:N})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(r){for(const u of r){if(this.callbackDispatchedThisFrame[u])continue;this.callbackDispatchedThisFrame[u]=!0;const p=this.getImage(u);p||c.w(`Image with ID: "${u}" was not found`),ve(p)&&this.updateImage(u,p)}}}const H=1e20;function Re(v,r,u,p,m,_,S,E,C){for(let R=r;R-1);C++,_[C]=E,S[C]=R,S[C+1]=H}for(let E=0,C=0;E65535)throw new Error("glyphs > 65535 not supported");if(p.ranges[_])return{stack:r,id:u,glyph:m};if(!this.url)throw new Error("glyphsUrl is not set");if(!p.requests[_]){const E=ye.loadGlyphRange(r,_,this.url,this.requestManager);p.requests[_]=E}const S=yield p.requests[_];for(const E in S)this._doesCharSupportLocalGlyph(+E)||(p.glyphs[+E]=S[+E]);return p.ranges[_]=!0,{stack:r,id:u,glyph:S[u]||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,u,p){const m=this.localIdeographFontFamily;if(!m||!this._doesCharSupportLocalGlyph(p))return;let _=r.tinySDF;if(!_){let E="400";/bold/i.test(u)?E="900":/medium/i.test(u)?E="500":/light/i.test(u)&&(E="200"),_=r.tinySDF=new ye.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:m,fontWeight:E})}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,u,p){return c._(this,void 0,void 0,function*(){const m=256*r,_=m+255,S=p.transformRequest(u.replace("{fontstack}",v).replace("{range}",`${m}-${_}`),"Glyphs"),E=yield c.l(S,new AbortController);if(!E||!E.data)throw new Error(`Could not load glyph range. range: ${r}, ${m}-${_}`);const C={};for(const R of c.n(E.data))C[R.id]=R;return C})},ye.TinySDF=class{constructor({fontSize:v=24,buffer:r=3,radius:u=8,cutoff:p=.25,fontFamily:m="sans-serif",fontWeight:_="normal",fontStyle:S="normal"}={}){this.buffer=r,this.cutoff=p,this.radius=u;const E=this.size=v+4*r,C=this._createCanvas(E),R=this.ctx=C.getContext("2d",{willReadFrequently:!0});R.font=`${S} ${_} ${v}px ${m}`,R.textBaseline="alphabetic",R.textAlign="left",R.fillStyle="black",this.gridOuter=new Float64Array(E*E),this.gridInner=new Float64Array(E*E),this.f=new Float64Array(E),this.z=new Float64Array(E+1),this.v=new Uint16Array(E)}_createCanvas(v){const r=document.createElement("canvas");return r.width=r.height=v,r}draw(v){const{width:r,actualBoundingBoxAscent:u,actualBoundingBoxDescent:p,actualBoundingBoxLeft:m,actualBoundingBoxRight:_}=this.ctx.measureText(v),S=Math.ceil(u),E=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(_-m))),C=Math.min(this.size-this.buffer,S+Math.ceil(p)),R=E+2*this.buffer,B=C+2*this.buffer,N=Math.max(R*B,0),X=new Uint8ClampedArray(N),ee={data:X,width:R,height:B,glyphWidth:E,glyphHeight:C,glyphTop:S,glyphLeft:0,glyphAdvance:r};if(E===0||C===0)return ee;const{ctx:re,buffer:ce,gridInner:pe,gridOuter:me}=this;re.clearRect(ce,ce,E,C),re.fillText(v,ce,ce+S);const we=re.getImageData(ce,ce,E,C);me.fill(H,0,N),pe.fill(0,0,N);for(let ae=0;ae0?Xe*Xe:0,pe[ze]=Xe<0?Xe*Xe:0}}Re(me,0,0,R,B,R,this.f,this.v,this.z),Re(pe,ce,ce,E,C,R,this.f,this.v,this.z);for(let ae=0;ae1&&(C=r[++E]);const B=Math.abs(R-C.left),N=Math.abs(R-C.right),X=Math.min(B,N);let ee;const re=_/p*(m+1);if(C.isDash){const ce=m-Math.abs(re);ee=Math.sqrt(X*X+ce*ce)}else ee=m-Math.sqrt(X*X+re*re);this.data[S+R]=Math.max(0,Math.min(255,ee+128))}}}addRegularDash(r){for(let E=r.length-1;E>=0;--E){const C=r[E],R=r[E+1];C.zeroLength?r.splice(E,1):R&&R.isDash===C.isDash&&(R.left=C.left,r.splice(E,1))}const u=r[0],p=r[r.length-1];u.isDash===p.isDash&&(u.left=p.left-this.width,p.right=u.right+this.width);const m=this.width*this.nextRow;let _=0,S=r[_];for(let E=0;E1&&(S=r[++_]);const C=Math.abs(E-S.left),R=Math.abs(E-S.right),B=Math.min(C,R);this.data[m+E]=Math.max(0,Math.min(255,(S.isDash?B:-B)+128))}}addDash(r,u){const p=u?7:0,m=2*p+1;if(this.nextRow+m>this.height)return c.w("LineAtlas out of space"),null;let _=0;for(let E=0;E{u.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[nt]}numActive(){return Object.keys(this.active).length}}const Jt=Math.floor(A.hardwareConcurrency/2);let er,Vt;function Yt(){return er||(er=new rt),er}rt.workerCount=c.C(globalThis)?Math.max(Math.min(Jt,3),1):1;class _r{constructor(r,u){this.workerPool=r,this.actors=[],this.currentActor=0,this.id=u;const p=this.workerPool.acquire(u);for(let m=0;m{u.remove()}),this.actors=[],r&&this.workerPool.release(this.id)}registerMessageHandler(r,u){for(const p of this.actors)p.registerMessageHandler(r,u)}}function fr(){return Vt||(Vt=new _r(Yt(),c.G),Vt.registerMessageHandler("GR",(v,r,u)=>c.m(r,u))),Vt}function br(v,r){const u=c.H();return c.J(u,u,[1,1,0]),c.K(u,u,[.5*v.width,.5*v.height,1]),c.L(u,u,v.calculatePosMatrix(r.toUnwrapped()))}function Xr(v,r,u,p,m,_){const S=function(N,X,ee){if(N)for(const re of N){const ce=X[re];if(ce&&ce.source===ee&&ce.type==="fill-extrusion")return!0}else for(const re in X){const ce=X[re];if(ce.source===ee&&ce.type==="fill-extrusion")return!0}return!1}(m&&m.layers,r,v.id),E=_.maxPitchScaleFactor(),C=v.tilesIn(p,E,S);C.sort(V);const R=[];for(const N of C)R.push({wrappedTileID:N.tileID.wrapped().key,queryResults:N.tile.queryRenderedFeatures(r,u,v._state,N.queryGeometry,N.cameraQueryGeometry,N.scale,m,_,E,br(v.transform,N.tileID))});const B=function(N){const X={},ee={};for(const re of N){const ce=re.queryResults,pe=re.wrappedTileID,me=ee[pe]=ee[pe]||{};for(const we in ce){const ae=ce[we],Ce=me[we]=me[we]||{},Pe=X[we]=X[we]||[];for(const ze of ae)Ce[ze.featureIndex]||(Ce[ze.featureIndex]=!0,Pe.push(ze))}}return X}(R);for(const N in B)B[N].forEach(X=>{const ee=X.feature,re=v.getFeatureState(ee.layer["source-layer"],ee.id);ee.source=ee.layer.source,ee.layer["source-layer"]&&(ee.sourceLayer=ee.layer["source-layer"]),ee.state=re});return B}function V(v,r){const u=v.tileID,p=r.tileID;return u.overscaledZ-p.overscaledZ||u.canonical.y-p.canonical.y||u.wrap-p.wrap||u.canonical.x-p.canonical.x}function Ue(v,r,u){return c._(this,void 0,void 0,function*(){let p=v;if(v.url?p=(yield c.h(r.transformRequest(v.url,"Source"),u)).data:yield A.frameAsync(u),!p)return null;const m=c.M(c.e(p,v),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in p&&p.vector_layers&&(m.vectorLayerIds=p.vector_layers.map(_=>_.id)),m})}class ie{constructor(r,u){r&&(u?this.setSouthWest(r).setNorthEast(u):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 u=this._sw,p=this._ne;let m,_;if(r instanceof c.N)m=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(m=r._sw,_=r._ne,!m||!_)return this}return u||p?(u.lng=Math.min(m.lng,u.lng),u.lat=Math.min(m.lat,u.lat),p.lng=Math.max(_.lng,p.lng),p.lat=Math.max(_.lat,p.lat)):(this._sw=new c.N(m.lng,m.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:u,lat:p}=c.N.convert(r);let m=this._sw.lng<=u&&u<=this._ne.lng;return this._sw.lng>this._ne.lng&&(m=this._sw.lng>=u&&u>=this._ne.lng),this._sw.lat<=p&&p<=this._ne.lat&&m}static convert(r){return r instanceof ie?r:r&&new ie(r)}static fromLngLat(r,u=0){const p=360*u/40075017,m=p/Math.cos(Math.PI/180*r.lat);return new ie(new c.N(r.lng-m,r.lat-p),new c.N(r.lng+m,r.lat+p))}adjustAntiMeridian(){const r=new c.N(this._sw.lng,this._sw.lat),u=new c.N(this._ne.lng,this._ne.lat);return new ie(r,r.lng>u.lng?new c.N(u.lng+360,u.lat):u)}}class de{constructor(r,u,p){this.bounds=ie.convert(this.validateBounds(r)),this.minzoom=u||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 u=Math.pow(2,r.z),p=Math.floor(c.O(this.bounds.getWest())*u),m=Math.floor(c.Q(this.bounds.getNorth())*u),_=Math.ceil(c.O(this.bounds.getEast())*u),S=Math.ceil(c.Q(this.bounds.getSouth())*u);return r.x>=p&&r.x<_&&r.y>=m&&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 u=r.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),p={request:this.map._requestManager.transformRequest(u,"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 m="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(),m="LT";r.abortController=new AbortController;try{const _=yield r.actor.sendAsync({type:m,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,u){if(u&&u.resourceTiming&&(r.resourceTiming=u.resourceTiming),u&&this.map._refreshExpiredTiles&&r.setExpiryData(u),r.loadVectorData(u,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 Te extends c.E{constructor(r,u,p,m){super(),this.id=r,this.dispatcher=p,this.setEventedParent(m),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"},u),c.e(this,c.M(u,["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 u=r.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);r.abortController=new AbortController;try{const p=yield Z.getImage(this.map._requestManager.transformRequest(u,"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 m=this.map.painter.context,_=m.gl,S=p.data;r.texture=this.map.painter.getTileTexture(S.width),r.texture?r.texture.update(S,{useMipmap:!0}):(r.texture=new it(m,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 Te{constructor(r,u,p,m){super(r,u,p,m),this.type="raster-dem",this.maxzoom=22,this._options=c.e({type:"raster-dem"},u),this.encoding=u.encoding||"mapbox",this.redFactor=u.redFactor,this.greenFactor=u.greenFactor,this.blueFactor=u.blueFactor,this.baseShift=u.baseShift}loadTile(r){return c._(this,void 0,void 0,function*(){const u=r.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),p=this.map._requestManager.transformRequest(u,"Tile");r.neighboringTiles=this._getNeighboringTiles(r.tileID),r.abortController=new AbortController;try{const m=yield Z.getImage(p,r.abortController,this.map._refreshExpiredTiles);if(delete r.abortController,r.aborted)return void(r.state="unloaded");if(m&&m.data){const _=m.data;this.map._refreshExpiredTiles&&m.cacheControl&&m.expires&&r.setExpiryData({cacheControl:m.cacheControl,expires:m.expires});const S=c.b(_)&&c.U()?_:yield this.readImageNow(_),E={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:E});r.dem=C,r.needsHillshadePrepare=!0,r.needsTerrainPrepare=!0,r.state="loaded"}}}catch(m){if(delete r.abortController,r.aborted)r.state="unloaded";else if(m)throw r.state="errored",m}})}readImageNow(r){return c._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&c.V()){const u=r.width+2,p=r.height+2;try{return new c.R({width:u,height:p},yield c.W(r,-1,-1,u,p))}catch{}}return A.getImageData(r,1)})}_getNeighboringTiles(r){const u=r.canonical,p=Math.pow(2,u.z),m=(u.x-1+p)%p,_=u.x===0?r.wrap-1:r.wrap,S=(u.x+1+p)%p,E=u.x+1===p?r.wrap+1:r.wrap,C={};return C[new c.S(r.overscaledZ,_,u.z,m,u.y).key]={backfilled:!1},C[new c.S(r.overscaledZ,E,u.z,S,u.y).key]={backfilled:!1},u.y>0&&(C[new c.S(r.overscaledZ,_,u.z,m,u.y-1).key]={backfilled:!1},C[new c.S(r.overscaledZ,r.wrap,u.z,u.x,u.y-1).key]={backfilled:!1},C[new c.S(r.overscaledZ,E,u.z,S,u.y-1).key]={backfilled:!1}),u.y+10&&c.e(_,{resourceTiming:m}),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 u=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 m=yield this.actor.sendAsync({type:u,data:p},r.abortController);delete r.abortController,r.unloadVectorData(),r.aborted||r.loadVectorData(m,this.map.painter,u==="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 ot extends c.E{constructor(r,u,p,m){super(),this.id=r,this.dispatcher=p,this.coordinates=u.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(m),this.options=u}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 u=yield Z.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,u&&u.data&&(this.image=u.data,r&&(this.coordinates=r),this._finishLoading())}catch(u){this._request=null,this._loaded=!0,this.fire(new c.j(u))}})}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 u=r.map(c.Z.fromLngLat);this.tileID=function(m){let _=1/0,S=1/0,E=-1/0,C=-1/0;for(const X of m)_=Math.min(_,X.x),S=Math.min(S,X.y),E=Math.max(E,X.x),C=Math.max(C,X.y);const R=Math.max(E-_,C-S),B=Math.max(0,Math.floor(-Math.log(R)/Math.LN2)),N=Math.pow(2,B);return new c.a1(B,Math.floor((_+E)/2*N),Math.floor((S+C)/2*N))}(u),this.minzoom=this.maxzoom=this.tileID.z;const p=u.map(m=>this.tileID.getTilePoint(m)._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,u=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,u.RGBA),this.texture.bind(u.LINEAR,u.CLAMP_TO_EDGE));let p=!1;for(const m in this.tiles){const _=this.tiles[m];_.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 kt extends ot{constructor(r,u,p,m){super(r,u,p,m),this.roundZoom=!0,this.type="video",this.options=u}load(){return c._(this,void 0,void 0,function*(){this._loaded=!1;const r=this.options;this.urls=[];for(const u of r.urls)this.urls.push(this.map._requestManager.transformRequest(u,"Source").url);try{const u=yield c.a3(this.urls);if(this._loaded=!0,!u)return;this.video=u,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(u){this.fire(new c.j(u))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(r){if(this.video){const u=this.video.seekable;ru.end(0)?this.fire(new c.j(new c.a2(`sources.${this.id}`,null,`Playback for this video can be set only between the ${u.start(0)} and ${u.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,u=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(u.LINEAR,u.CLAMP_TO_EDGE),u.texSubImage2D(u.TEXTURE_2D,0,0,0,u.RGBA,u.UNSIGNED_BYTE,this.video)):(this.texture=new it(r,this.video,u.RGBA),this.texture.bind(u.LINEAR,u.CLAMP_TO_EDGE));let p=!1;for(const m in this.tiles){const _=this.tiles[m];_.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 ot{constructor(r,u,p,m){super(r,u,p,m),u.coordinates?Array.isArray(u.coordinates)&&u.coordinates.length===4&&!u.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"'))),u.animate&&typeof u.animate!="boolean"&&this.fire(new c.j(new c.a2(`sources.${r}`,null,'optional "animate" property must be a boolean value'))),u.canvas?typeof u.canvas=="string"||u.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=u,this.animate=u.animate===void 0||u.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 u=this.map.painter.context,p=u.gl;this.boundsBuffer||(this.boundsBuffer=u.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(u,this.canvas,p.RGBA,{premultiply:!0});let m=!1;for(const _ in this.tiles){const S=this.tiles[_];S.state!=="loaded"&&(S.state="loaded",S.texture=this.texture,m=!0)}m&&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 Bt={},Tr=v=>{switch(v){case"geojson":return tt;case"image":return ot;case"raster":return Te;case"raster-dem":return Ze;case"vector":return se;case"video":return kt;case"canvas":return at}return Bt[v]},qe="RTLPluginLoaded";class tn extends c.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=fr()}_syncState(r){return this.status=r,this.dispatcher.broadcast("SRPS",{pluginStatus:r,pluginURL:this.url}).catch(u=>{throw this.status="error",u})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(r){return c._(this,arguments,void 0,function*(u,p=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=A.resolveURL(u),!this.url)throw new Error(`requested url ${u} 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(qe))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let _n=null;function vn(){return _n||(_n=new tn),_n}class pi{constructor(r,u){this.timeAdded=0,this.fadeEndTime=0,this.tileID=r,this.uid=c.a4(),this.uses=0,this.tileSize=u,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 u=r+this.timeAdded;u_.getLayer(R)).filter(Boolean);if(C.length!==0){E.layers=C,E.stateDependentLayerIds&&(E.stateDependentLayers=E.stateDependentLayerIds.map(R=>C.filter(B=>B.id===R)[0]));for(const R of C)S[R.id]=E}}return S}(r.buckets,u.style),this.hasSymbolBuckets=!1;for(const m in this.buckets){const _=this.buckets[m];if(_ instanceof c.a6){if(this.hasSymbolBuckets=!0,!p)break;_.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const m in this.buckets){const _=this.buckets[m];if(_ instanceof c.a6&&_.hasRTLText){this.hasRTLText=!0,vn().lazyLoad();break}}this.queryPadding=0;for(const m in this.buckets){const _=this.buckets[m];this.queryPadding=Math.max(this.queryPadding,u.style.getLayer(m).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 m=this.buckets[p];m.uploadPending()&&m.upload(r)}const u=r.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new it(r,this.imageAtlas.image,u.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new it(r,this.glyphAtlasImage,u.ALPHA),this.glyphAtlasImage=null)}prepare(r){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(r,this.imageAtlasTexture)}queryRenderedFeatures(r,u,p,m,_,S,E,C,R,B){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:m,cameraQueryGeometry:_,scale:S,tileSize:this.tileSize,pixelPosMatrix:B,transform:C,params:E,queryPadding:this.queryPadding*R},r,u,p):{}}querySourceFeatures(r,u){const p=this.latestFeatureIndex;if(!p||!p.rawTileData)return;const m=p.loadVTLayers(),_=u&&u.sourceLayer?u.sourceLayer:"",S=m._geojsonTileLayer||m[_];if(!S)return;const E=c.a7(u&&u.filter),{z:C,x:R,y:B}=this.tileID.canonical,N={z:C,x:R,y:B};for(let X=0;Xp)m=!1;else if(u)if(this.expirationTime{this.remove(r,_)},p)),this.data[m].push(_),this.order.push(m),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 u=this.data[r].shift();return u.timeout&&clearTimeout(u.timeout),this.data[r].length===0&&delete this.data[r],this.order.splice(this.order.indexOf(r),1),u.value}getByKey(r){const u=this.data[r];return u?u[0].value:null}get(r){return this.has(r)?this.data[r.wrapped().key][0].value:null}remove(r,u){if(!this.has(r))return this;const p=r.wrapped().key,m=u===void 0?0:this.data[p].indexOf(u),_=this.data[p][m];return this.data[p].splice(m,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 u=this._getAndRemoveByKey(this.order[0]);u&&this.onRemove(u)}return this}filter(r){const u=[];for(const p in this.data)for(const m of this.data[p])r(m.value)||u.push(m);for(const p of u)this.remove(p.value.tileID,p)}}class Kt{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(r,u,p){const m=String(u);if(this.stateChanges[r]=this.stateChanges[r]||{},this.stateChanges[r][m]=this.stateChanges[r][m]||{},c.e(this.stateChanges[r][m],p),this.deletedStates[r]===null){this.deletedStates[r]={};for(const _ in this.state[r])_!==m&&(this.deletedStates[r][_]=null)}else if(this.deletedStates[r]&&this.deletedStates[r][m]===null){this.deletedStates[r][m]={};for(const _ in this.state[r][m])p[_]||(this.deletedStates[r][m][_]=null)}else for(const _ in p)this.deletedStates[r]&&this.deletedStates[r][m]&&this.deletedStates[r][m][_]===null&&delete this.deletedStates[r][m][_]}removeFeatureState(r,u,p){if(this.deletedStates[r]===null)return;const m=String(u);if(this.deletedStates[r]=this.deletedStates[r]||{},p&&u!==void 0)this.deletedStates[r][m]!==null&&(this.deletedStates[r][m]=this.deletedStates[r][m]||{},this.deletedStates[r][m][p]=null);else if(u!==void 0)if(this.stateChanges[r]&&this.stateChanges[r][m])for(p in this.deletedStates[r][m]={},this.stateChanges[r][m])this.deletedStates[r][m][p]=null;else this.deletedStates[r][m]=null;else this.deletedStates[r]=null}getState(r,u){const p=String(u),m=c.e({},(this.state[r]||{})[p],(this.stateChanges[r]||{})[p]);if(this.deletedStates[r]===null)return{};if(this.deletedStates[r]){const _=this.deletedStates[r][u];if(_===null)return{};for(const S in _)delete m[S]}return m}initializeTileState(r,u){r.setFeatureState(this.state,u)}coalesceChanges(r,u){const p={};for(const m in this.stateChanges){this.state[m]=this.state[m]||{};const _={};for(const S in this.stateChanges[m])this.state[m][S]||(this.state[m][S]={}),c.e(this.state[m][S],this.stateChanges[m][S]),_[S]=this.state[m][S];p[m]=_}for(const m in this.deletedStates){this.state[m]=this.state[m]||{};const _={};if(this.deletedStates[m]===null)for(const S in this.state[m])_[S]={},this.state[m][S]={};else for(const S in this.deletedStates[m]){if(this.deletedStates[m][S]===null)this.state[m][S]={};else for(const E of Object.keys(this.deletedStates[m][S]))delete this.state[m][S][E];_[S]=this.state[m][S]}p[m]=p[m]||{},c.e(p[m],_)}if(this.stateChanges={},this.deletedStates={},Object.keys(p).length!==0)for(const m in r)r[m].setFeatureState(p,u)}}class jt extends c.E{constructor(r,u,p){super(),this.id=r,this.dispatcher=p,this.on("data",m=>this._dataHandler(m)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((m,_,S,E)=>{const C=new(Tr(_.type))(m,_,S,E);if(C.id!==m)throw new Error(`Expected Source id to be ${m} instead of ${C.id}`);return C})(r,u,p,this),this._tiles={},this._cache=new Qe(0,m=>this._unloadTile(m)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Kt,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 u=this._tiles[r];if(u.state!=="loaded"&&u.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,u,p){return c._(this,void 0,void 0,function*(){try{yield this._source.loadTile(r),this._tileLoaded(r,u,p)}catch(m){r.state="errored",m.status!==404?this._source.fire(new c.j(m,{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 u in this._tiles){const p=this._tiles[u];p.upload(r),p.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(r=>r.tileID).sort(Kr).map(r=>r.key)}getRenderableIds(r){const u=[];for(const p in this._tiles)this._isIdRenderable(p,r)&&u.push(this._tiles[p]);return r?u.sort((p,m)=>{const _=p.tileID,S=m.tileID,E=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-E.y||C.x-E.x}).map(p=>p.tileID.key):u.map(p=>p.tileID).sort(Kr).map(p=>p.key)}hasRenderableParent(r){const u=this.findLoadedParent(r,0);return!!u&&this._isIdRenderable(u.tileID.key)}_isIdRenderable(r,u){return this._tiles[r]&&this._tiles[r].hasData()&&!this._coveredTiles[r]&&(u||!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,u){return c._(this,void 0,void 0,function*(){const p=this._tiles[r];p&&(p.state!=="loading"&&(p.state=u),yield this._loadTile(p,r,u))})}_tileLoaded(r,u,p){r.timeAdded=A.now(),p==="expired"&&(r.refreshedUponExpiration=!0),this._setTileReloadTimer(u,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 u=this.getRenderableIds();for(let m=0;m1||(Math.abs(S)>1&&(Math.abs(S+C)===1?S+=C:Math.abs(S-C)===1&&(S-=C)),_.dem&&m.dem&&(m.dem.backfillBorder(_.dem,S,E),m.neighboringTiles&&m.neighboringTiles[R]&&(m.neighboringTiles[R].backfilled=!0)))}}getTile(r){return this.getTileByID(r.key)}getTileByID(r){return this._tiles[r]}_retainLoadedChildren(r,u,p,m){for(const _ in this._tiles){let S=this._tiles[_];if(m[_]||!S.hasData()||S.tileID.overscaledZ<=u||S.tileID.overscaledZ>p)continue;let E=S.tileID;for(;S&&S.tileID.overscaledZ>u+1;){const R=S.tileID.scaledTo(S.tileID.overscaledZ-1);S=this._tiles[R.key],S&&S.hasData()&&(E=R)}let C=E;for(;C.overscaledZ>u;)if(C=C.scaledTo(C.overscaledZ-1),r[C.key]){m[E.key]=E;break}}}findLoadedParent(r,u){if(r.key in this._loadedParentTiles){const p=this._loadedParentTiles[r.key];return p&&p.tileID.overscaledZ>=u?p:null}for(let p=r.overscaledZ-1;p>=u;p--){const m=r.scaledTo(p),_=this._getLoadedTile(m);if(_)return _}}findLoadedSibling(r){return this._getLoadedTile(r)}_getLoadedTile(r){const u=this._tiles[r.key];return u&&u.hasData()?u:this._cache.getByKey(r.wrapped().key)}updateCacheSize(r){const u=Math.ceil(r.width/this._source.tileSize)+1,p=Math.ceil(r.height/this._source.tileSize)+1,m=Math.floor(u*p*(this._maxTileCacheZoomLevels===null?c.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),_=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,m):m;this._cache.setMaxSize(_)}handleWrapJump(r){const u=Math.round((r-(this._prevLng===void 0?r:this._prevLng))/360);if(this._prevLng=r,u){const p={};for(const m in this._tiles){const _=this._tiles[m];_.tileID=_.tileID.unwrapTo(_.tileID.wrap+u),p[_.tileID.key]=_}this._tiles=p;for(const m in this._timers)clearTimeout(this._timers[m]),delete this._timers[m];for(const m in this._tiles)this._setTileReloadTimer(m,this._tiles[m])}}_updateCoveredAndRetainedTiles(r,u,p,m,_,S){const E={},C={},R=Object.keys(r),B=A.now();for(const N of R){const X=r[N],ee=this._tiles[N];if(!ee||ee.fadeEndTime!==0&&ee.fadeEndTime<=B)continue;const re=this.findLoadedParent(X,u),ce=this.findLoadedSibling(X),pe=re||ce||null;pe&&(this._addTile(pe.tileID),E[pe.tileID.key]=pe.tileID),C[N]=X}this._retainLoadedChildren(C,m,p,r);for(const N in E)r[N]||(this._coveredTiles[N]=!0,r[N]=E[N]);if(S){const N={},X={};for(const ee of _)this._tiles[ee.key].hasData()?N[ee.key]=ee:X[ee.key]=ee;for(const ee in X){const re=X[ee].children(this._source.maxzoom);this._tiles[re[0].key]&&this._tiles[re[1].key]&&this._tiles[re[2].key]&&this._tiles[re[3].key]&&(N[re[0].key]=r[re[0].key]=re[0],N[re[1].key]=r[re[1].key]=re[1],N[re[2].key]=r[re[2].key]=re[2],N[re[3].key]=r[re[3].key]=re[3],delete X[ee])}for(const ee in X){const re=X[ee],ce=this.findLoadedParent(re,this._source.minzoom),pe=this.findLoadedSibling(re),me=ce||pe||null;if(me){N[me.tileID.key]=r[me.tileID.key]=me.tileID;for(const we in N)N[we].isChildOf(me.tileID)&&delete N[we]}}for(const ee in this._tiles)N[ee]||(this._coveredTiles[ee]=!0)}}update(r,u){if(!this._sourceLoaded||this._paused)return;let p;this.transform=r,this.terrain=u,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(B=>new c.S(B.canonical.z,B.wrap,B.canonical.z,B.canonical.x,B.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:u}),this._source.hasTile&&(p=p.filter(B=>this._source.hasTile(B)))):p=[];const m=r.coveringZoomLevel(this._source),_=Math.max(m-jt.maxOverzooming,this._source.minzoom),S=Math.max(m+jt.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const B={};for(const N of p)if(N.canonical.z>this._source.minzoom){const X=N.scaledTo(N.canonical.z-1);B[X.key]=X;const ee=N.scaledTo(Math.max(this._source.minzoom,Math.min(N.canonical.z,5)));B[ee.key]=ee}p=p.concat(Object.values(B))}const E=p.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,E&&this.fire(new c.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const C=this._updateRetainedTiles(p,m);mi(this._source.type)&&this._updateCoveredAndRetainedTiles(C,_,S,m,p,u);for(const B in C)this._tiles[B].clearFadeHold();const R=c.ab(this._tiles,C);for(const B of R){const N=this._tiles[B];N.hasSymbolBuckets&&!N.holdingForFade()?N.setHoldDuration(this.map._fadeDuration):N.hasSymbolBuckets&&!N.symbolFadeFinished()||this._removeTile(B)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(const r in this._tiles)this._tiles[r].holdingForFade()&&this._removeTile(r)}_updateRetainedTiles(r,u){var p;const m={},_={},S=Math.max(u-jt.maxOverzooming,this._source.minzoom),E=Math.max(u+jt.maxUnderzooming,this._source.minzoom),C={};for(const R of r){const B=this._addTile(R);m[R.key]=R,B.hasData()||uthis._source.maxzoom){const X=R.children(this._source.maxzoom)[0],ee=this.getTile(X);if(ee&&ee.hasData()){m[X.key]=X;continue}}else{const X=R.children(this._source.maxzoom);if(m[X[0].key]&&m[X[1].key]&&m[X[2].key]&&m[X[3].key])continue}let N=B.wasRequested();for(let X=R.overscaledZ-1;X>=S;--X){const ee=R.scaledTo(X);if(_[ee.key])break;if(_[ee.key]=!0,B=this.getTile(ee),!B&&N&&(B=this._addTile(ee)),B){const re=B.hasData();if((re||!(!((p=this.map)===null||p===void 0)&&p.cancelPendingTileRequestsWhileZooming)||N)&&(m[ee.key]=ee),N=B.wasRequested(),re)break}}}return m}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const r in this._tiles){const u=[];let p,m=this._tiles[r].tileID;for(;m.overscaledZ>0;){if(m.key in this._loadedParentTiles){p=this._loadedParentTiles[m.key];break}u.push(m.key);const _=m.scaledTo(m.overscaledZ-1);if(p=this._getLoadedTile(_),p)break;m=_}for(const _ of u)this._loadedParentTiles[_]=p}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(const r in this._tiles){const u=this._tiles[r].tileID,p=this._getLoadedTile(u);this._loadedSiblingTiles[u.key]=p}}_addTile(r){let u=this._tiles[r.key];if(u)return u;u=this._cache.getAndRemove(r),u&&(this._setTileReloadTimer(r.key,u),u.tileID=r,this._state.initializeTileState(u,this.map?this.map.painter:null),this._cacheTimers[r.key]&&(clearTimeout(this._cacheTimers[r.key]),delete this._cacheTimers[r.key],this._setTileReloadTimer(r.key,u)));const p=u;return u||(u=new pi(r,this._source.tileSize*r.overscaleFactor()),this._loadTile(u,r.key,u.state)),u.uses++,this._tiles[r.key]=u,p||this._source.fire(new c.k("dataloading",{tile:u,coord:u.tileID,dataType:"source"})),u}_setTileReloadTimer(r,u){r in this._timers&&(clearTimeout(this._timers[r]),delete this._timers[r]);const p=u.getExpiryTimeout();p&&(this._timers[r]=setTimeout(()=>{this._reloadTile(r,"expired"),delete this._timers[r]},p))}_removeTile(r){const u=this._tiles[r];u&&(u.uses--,delete this._tiles[r],this._timers[r]&&(clearTimeout(this._timers[r]),delete this._timers[r]),u.uses>0||(u.hasData()&&u.state!=="reloading"?this._cache.add(u.tileID,u,u.getExpiryTimeout()):(u.aborted=!0,this._abortTile(u),this._unloadTile(u))))}_dataHandler(r){const u=r.sourceDataType;r.dataType==="source"&&u==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&r.dataType==="source"&&u==="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,u,p){const m=[],_=this.transform;if(!_)return m;const S=p?_.getCameraQueryGeometry(r):r,E=r.map(re=>_.pointCoordinate(re,this.terrain)),C=S.map(re=>_.pointCoordinate(re,this.terrain)),R=this.getIds();let B=1/0,N=1/0,X=-1/0,ee=-1/0;for(const re of C)B=Math.min(B,re.x),N=Math.min(N,re.y),X=Math.max(X,re.x),ee=Math.max(ee,re.y);for(let re=0;re=0&&ae[1].y+we>=0){const Ce=E.map(ze=>pe.getTilePoint(ze)),Pe=C.map(ze=>pe.getTilePoint(ze));m.push({tile:ce,tileID:pe,queryGeometry:Ce,cameraQueryGeometry:Pe,scale:me})}}return m}getVisibleCoordinates(r){const u=this.getRenderableIds(r).map(p=>this._tiles[p].tileID);for(const p of u)p.posMatrix=this.transform.calculatePosMatrix(p.toUnwrapped());return u}hasTransition(){if(this._source.hasTransition())return!0;if(mi(this._source.type)){const r=A.now();for(const u in this._tiles)if(this._tiles[u].fadeEndTime>=r)return!0}return!1}setFeatureState(r,u,p){this._state.updateState(r=r||"_geojsonTileLayer",u,p)}removeFeatureState(r,u,p){this._state.removeFeatureState(r=r||"_geojsonTileLayer",u,p)}getFeatureState(r,u){return this._state.getState(r=r||"_geojsonTileLayer",u)}setDependencies(r,u,p){const m=this._tiles[r];m&&m.setDependencies(u,p)}reloadTilesForDependencies(r,u){for(const p in this._tiles)this._tiles[p].hasDependency(r,u)&&this._reloadTile(p,"reloading");this._cache.filter(p=>!p.hasDependency(r,u))}}function Kr(v,r){const u=Math.abs(2*v.wrap)-+(v.wrap<0),p=Math.abs(2*r.wrap)-+(r.wrap<0);return v.overscaledZ-r.overscaledZ||p-u||r.canonical.y-v.canonical.y||r.canonical.x-v.canonical.x}function mi(v){return v==="raster"||v==="image"||v==="video"}jt.maxOverzooming=10,jt.maxUnderzooming=3;class Xt{constructor(r,u){this.reset(r,u)}reset(r,u){this.points=r||[],this._distances=[0];for(let p=1;p0?(m-S)/E:0;return this.points[_].mult(1-C).add(this.points[u].mult(C))}}function Yi(v,r){let u=!0;return v==="always"||v!=="never"&&r!=="never"||(u=!1),u}class fs{constructor(r,u,p){const m=this.boxCells=[],_=this.circleCells=[];this.xCellCount=Math.ceil(r/p),this.yCellCount=Math.ceil(u/p);for(let S=0;Sthis.width||m<0||u>this.height)return[];const C=[];if(r<=0&&u<=0&&this.width<=p&&this.height<=m){if(_)return[{key:null,x1:r,y1:u,x2:p,y2:m}];for(let R=0;R0}hitTestCircle(r,u,p,m,_){const S=r-p,E=r+p,C=u-p,R=u+p;if(E<0||S>this.width||R<0||C>this.height)return!1;const B=[];return this._forEachCell(S,C,E,R,this._queryCellCircle,B,{hitTest:!0,overlapMode:m,circle:{x:r,y:u,radius:p},seenUids:{box:{},circle:{}}},_),B.length>0}_queryCell(r,u,p,m,_,S,E,C){const{seenUids:R,hitTest:B,overlapMode:N}=E,X=this.boxCells[_];if(X!==null){const re=this.bboxes;for(const ce of X)if(!R.box[ce]){R.box[ce]=!0;const pe=4*ce,me=this.boxKeys[ce];if(r<=re[pe+2]&&u<=re[pe+3]&&p>=re[pe+0]&&m>=re[pe+1]&&(!C||C(me))&&(!B||!Yi(N,me.overlapMode))&&(S.push({key:me,x1:re[pe],y1:re[pe+1],x2:re[pe+2],y2:re[pe+3]}),B))return!0}}const ee=this.circleCells[_];if(ee!==null){const re=this.circles;for(const ce of ee)if(!R.circle[ce]){R.circle[ce]=!0;const pe=3*ce,me=this.circleKeys[ce];if(this._circleAndRectCollide(re[pe],re[pe+1],re[pe+2],r,u,p,m)&&(!C||C(me))&&(!B||!Yi(N,me.overlapMode))){const we=re[pe],ae=re[pe+1],Ce=re[pe+2];if(S.push({key:me,x1:we-Ce,y1:ae-Ce,x2:we+Ce,y2:ae+Ce}),B)return!0}}}return!1}_queryCellCircle(r,u,p,m,_,S,E,C){const{circle:R,seenUids:B,overlapMode:N}=E,X=this.boxCells[_];if(X!==null){const re=this.bboxes;for(const ce of X)if(!B.box[ce]){B.box[ce]=!0;const pe=4*ce,me=this.boxKeys[ce];if(this._circleAndRectCollide(R.x,R.y,R.radius,re[pe+0],re[pe+1],re[pe+2],re[pe+3])&&(!C||C(me))&&!Yi(N,me.overlapMode))return S.push(!0),!0}}const ee=this.circleCells[_];if(ee!==null){const re=this.circles;for(const ce of ee)if(!B.circle[ce]){B.circle[ce]=!0;const pe=3*ce,me=this.circleKeys[ce];if(this._circlesCollide(re[pe],re[pe+1],re[pe+2],R.x,R.y,R.radius)&&(!C||C(me))&&!Yi(N,me.overlapMode))return S.push(!0),!0}}}_forEachCell(r,u,p,m,_,S,E,C){const R=this._convertToXCellCoord(r),B=this._convertToYCellCoord(u),N=this._convertToXCellCoord(p),X=this._convertToYCellCoord(m);for(let ee=R;ee<=N;ee++)for(let re=B;re<=X;re++)if(_.call(this,r,u,p,m,this.xCellCount*re+ee,S,E,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,u,p,m,_,S){const E=m-r,C=_-u,R=p+S;return R*R>E*E+C*C}_circleAndRectCollide(r,u,p,m,_,S,E){const C=(S-m)/2,R=Math.abs(r-(m+C));if(R>C+p)return!1;const B=(E-_)/2,N=Math.abs(u-(_+B));if(N>B+p)return!1;if(R<=C||N<=B)return!0;const X=R-C,ee=N-B;return X*X+ee*ee<=p*p}}function ps(v,r,u,p,m){const _=c.H();return r?(c.K(_,_,[1/m,1/m,1]),u||c.ad(_,_,p.angle)):c.L(_,p.labelPlaneMatrix,v),_}function Hn(v,r,u,p,m){if(r){const _=c.ae(v);return c.K(_,_,[m,m,1]),u||c.ad(_,_,-p.angle),_}return p.glCoordMatrix}function he(v,r,u,p){let m;p?(m=[v,r,p(v,r),1],c.af(m,m,u)):(m=[v,r,0,1],mr(m,m,u));const _=m[3];return{point:new c.P(m[0]/_,m[1]/_),signedDistanceFromCamera:_,isOccluded:!1}}function G(v,r){return .5+v/r*.5}function W(v,r){return v.x>=-r[0]&&v.x<=r[0]&&v.y>=-r[1]&&v.y<=r[1]}function te(v,r,u,p,m,_,S,E,C,R,B,N,X,ee,re){const ce=p?v.textSizeData:v.iconSizeData,pe=c.ag(ce,u.transform.zoom),me=[256/u.width*2+1,256/u.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=u.transform.width/u.transform.height;let ze=!1;for(let Xe=0;XeMath.abs(u.x-r.x)*p?{useVertical:!0}:(v===c.ah.vertical?r.yu.x)?{needsFlipping:!0}:null}function Ie(v,r,u,p,m,_,S,E,C,R,B){const N=u/24,X=r.lineOffsetX*N,ee=r.lineOffsetY*N;let re;if(r.numGlyphs>1){const ce=r.glyphStartIndex+r.numGlyphs,pe=r.lineStartIndex,me=r.lineStartIndex+r.lineLength,we=ue(N,E,X,ee,p,r,B,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(m&&!p){const Pe=Se(r.writingMode,ae,Ce,R);if(Pe)return Pe}re=[we.first];for(let Pe=r.glyphStartIndex+1;Pe0?ae.point:function(ze,Xe,st,gt,wt,dt){return Ae(ze,Xe,st,1,wt,dt)}(v.tileAnchorPoint,we,pe,0,_,v),Pe=Se(r.writingMode,pe,Ce,R);if(Pe)return Pe}const ce=ut(N*E.getoffsetX(r.glyphStartIndex),X,ee,p,r.segment,r.lineStartIndex,r.lineStartIndex+r.lineLength,v,B);if(!ce||v.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};re=[ce]}for(const ce of re)c.aj(C,ce.point,ce.angle);return{}}function Ae(v,r,u,p,m,_){const S=v.add(v.sub(r)._unit()),E=m!==void 0?he(S.x,S.y,m,_.getElevation).point:He(S.x,S.y,_).point,C=u.sub(E);return u.add(C._mult(p/C.mag()))}function _e(v,r,u){const p=r.projectionCache;if(p.projections[v])return p.projections[v];const m=new c.P(r.lineVertexArray.getx(v),r.lineVertexArray.gety(v)),_=He(m.x,m.y,r);if(_.signedDistanceFromCamera>0)return p.projections[v]=_.point,p.anyProjectionOccluded=p.anyProjectionOccluded||_.isOccluded,_.point;const S=v-u.direction;return function(E,C,R,B,N){return Ae(E,C,R,B,void 0,N)}(u.distanceFromAnchor===0?r.tileAnchorPoint:new c.P(r.lineVertexArray.getx(S),r.lineVertexArray.gety(S)),m,u.previousVertex,u.absOffsetX-u.distanceFromAnchor+1,r)}function He(v,r,u){const p=v+u.translation[0],m=r+u.translation[1];let _;return!u.pitchWithMap&&u.projection.useSpecialProjectionForSymbols?(_=u.projection.projectTileCoordinates(p,m,u.unwrappedTileID,u.getElevation),_.point.x=(.5*_.point.x+.5)*u.width,_.point.y=(.5*-_.point.y+.5)*u.height):(_=he(p,m,u.labelPlaneMatrix,u.getElevation),_.isOccluded=!1),_}function Je(v,r,u){return v._unit()._perp()._mult(r*u)}function $e(v,r,u,p,m,_,S,E,C){if(E.projectionCache.offsets[v])return E.projectionCache.offsets[v];const R=u.add(r);if(v+C.direction=m)return E.projectionCache.offsets[v]=R,R;const B=_e(v+C.direction,E,C),N=Je(B.sub(u),S,C.direction),X=u.add(N),ee=B.add(N);return E.projectionCache.offsets[v]=c.ak(_,R,X,ee)||R,E.projectionCache.offsets[v]}function ut(v,r,u,p,m,_,S,E,C){const R=p?v-r:v+r;let B=R>0?1:-1,N=0;p&&(B*=-1,N=Math.PI),B<0&&(N+=Math.PI);let X,ee=B>0?_+m:_+m+1;E.projectionCache.cachedAnchorPoint?X=E.projectionCache.cachedAnchorPoint:(X=He(E.tileAnchorPoint.x,E.tileAnchorPoint.y,E).point,E.projectionCache.cachedAnchorPoint=X);let re,ce,pe=X,me=X,we=0,ae=0;const Ce=Math.abs(R),Pe=[];let ze;for(;we+ae<=Ce;){if(ee+=B,ee<_||ee>=S)return null;we+=ae,me=pe,ce=re;const gt={absOffsetX:Ce,direction:B,distanceFromAnchor:we,previousVertex:me};if(pe=_e(ee,E,gt),u===0)Pe.push(me),ze=pe.sub(me);else{let wt;const dt=pe.sub(me);wt=dt.mag()===0?Je(_e(ee+B,E,gt).sub(pe),u,B):Je(dt,u,B),ce||(ce=me.add(wt)),re=$e(ee,wt,pe,_,S,ce,u,E,gt),Pe.push(ce),ze=re.sub(ce)}ae=ze.mag()}const Xe=ze._mult((Ce-we)/ae)._add(ce||me),st=N+Math.atan2(pe.y-me.y,pe.x-me.x);return Pe.push(Xe),{point:Xe,angle:C?st:0,path:Pe}}const Rt=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Ot(v,r){for(let u=0;u=1;tr--)_t.push(qt.path[tr]);for(let tr=1;trar.signedDistanceFromCamera<=0)?[]:tr.map(ar=>ar.point)}let Hr=[];if(_t.length>0){const tr=_t[0].clone(),ar=_t[0].clone();for(let Wr=1;Wr<_t.length;Wr++)tr.x=Math.min(tr.x,_t[Wr].x),tr.y=Math.min(tr.y,_t[Wr].y),ar.x=Math.max(ar.x,_t[Wr].x),ar.y=Math.max(ar.y,_t[Wr].y);Hr=tr.x>=dt.x&&ar.x<=ct.x&&tr.y>=dt.y&&ar.y<=ct.y?[_t]:ar.xct.x||ar.yct.y?[]:c.al([_t],dt.x,dt.y,ct.x,ct.y)}for(const tr of Hr){Pt.reset(tr,.25*wt);let ar=0;ar=Pt.length<=.5*wt?1:Math.ceil(Pt.paddedLength/Gt)+1;for(let Wr=0;Wrhe(m.x,m.y,p,u.getElevation))}queryRenderedSymbols(r){if(r.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const u=[];let p=1/0,m=1/0,_=-1/0,S=-1/0;for(const B of r){const N=new c.P(B.x+Qt,B.y+Qt);p=Math.min(p,N.x),m=Math.min(m,N.y),_=Math.max(_,N.x),S=Math.max(S,N.y),u.push(N)}const E=this.grid.query(p,m,_,S).concat(this.ignoredGrid.query(p,m,_,S)),C={},R={};for(const B of E){const N=B.key;if(C[N.bucketInstanceId]===void 0&&(C[N.bucketInstanceId]={}),C[N.bucketInstanceId][N.featureIndex])continue;const X=[new c.P(B.x1,B.y1),new c.P(B.x2,B.y1),new c.P(B.x2,B.y2),new c.P(B.x1,B.y2)];c.am(u,X)&&(C[N.bucketInstanceId][N.featureIndex]=!0,R[N.bucketInstanceId]===void 0&&(R[N.bucketInstanceId]=[]),R[N.bucketInstanceId].push(N.featureIndex))}return R}insertCollisionBox(r,u,p,m,_,S){(p?this.ignoredGrid:this.grid).insert({bucketInstanceId:m,featureIndex:_,collisionGroupID:S,overlapMode:u},r[0],r[1],r[2],r[3])}insertCollisionCircles(r,u,p,m,_,S){const E=p?this.ignoredGrid:this.grid,C={bucketInstanceId:m,featureIndex:_,collisionGroupID:S,overlapMode:u};for(let R=0;R=this.screenRightBoundary||mthis.screenBottomBoundary}isInsideGrid(r,u,p,m){return p>=0&&r=0&&uthis.projectAndGetPerspectiveRatio(p,wt.x,wt.y,m,R));st=gt.some(wt=>!wt.isOccluded),Xe=gt.map(wt=>wt.point)}else st=!0;return{box:c.ao(Xe),allPointsOccluded:!st}}}function or(v,r,u){return r*(c.X/(v.tileSize*Math.pow(2,u-v.tileID.overscaledZ)))}class Tn{constructor(r,u,p,m){this.opacity=r?Math.max(0,Math.min(1,r.opacity+(r.placed?u:-u))):m&&p?1:0,this.placed=p}isHidden(){return this.opacity===0&&!this.placed}}class rn{constructor(r,u,p,m,_){this.text=new Tn(r?r.text:null,u,p,_),this.icon=new Tn(r?r.icon:null,u,m,_)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class rr{constructor(r,u,p){this.text=r,this.icon=u,this.skipFade=p}}class Mr{constructor(){this.invProjMatrix=c.H(),this.viewportMatrix=c.H(),this.circles=[]}}class Yr{constructor(r,u,p,m,_){this.bucketInstanceId=r,this.featureIndex=u,this.sourceLayerIndex=p,this.bucketIndex=m,this.tileID=_}}class Dn{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 u=++this.maxGroupID;this.collisionGroups[r]={ID:u,predicate:p=>p.collisionGroupID===u}}return this.collisionGroups[r]}}function Bn(v,r,u,p,m){const{horizontalAlign:_,verticalAlign:S}=c.au(v);return new c.P(-(_-.5)*r+p[0]*m,-(S-.5)*u+p[1]*m)}class ni{constructor(r,u,p,m,_,S){this.transform=r.clone(),this.terrain=p,this.collisionIndex=new gr(this.transform,u),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=m,this.retainedQueryData={},this.collisionGroups=new Dn(_),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=S,S&&(S.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(r){const u=this.terrain;return u?(p,m)=>u.getElevation(r,p,m):null}getBucketParts(r,u,p,m){const _=p.getBucket(u),S=p.latestFeatureIndex;if(!_||!S||u.id!==_.layerIds[0])return;const E=p.collisionBoxArray,C=_.layers[0].layout,R=_.layers[0].paint,B=Math.pow(2,this.transform.zoom-p.tileID.overscaledZ),N=p.tileSize/c.X,X=p.tileID.toUnwrapped(),ee=this.transform.calculatePosMatrix(X),re=C.get("text-pitch-alignment")==="map",ce=C.get("text-rotation-alignment")==="map",pe=or(p,1,this.transform.zoom),me=this.collisionIndex.mapProjection.translatePosition(this.transform,p,R.get("text-translate"),R.get("text-translate-anchor")),we=this.collisionIndex.mapProjection.translatePosition(this.transform,p,R.get("icon-translate"),R.get("icon-translate-anchor")),ae=ps(ee,re,ce,this.transform,pe);let Ce=null;if(re){const ze=Hn(ee,re,ce,this.transform,pe);Ce=c.L([],this.transform.labelPlaneMatrix,ze)}this.retainedQueryData[_.bucketInstanceId]=new Yr(_.bucketInstanceId,S,_.sourceLayerIndex,_.index,p.tileID);const Pe={bucket:_,layout:C,translationText:me,translationIcon:we,posMatrix:ee,unwrappedTileID:X,textLabelPlaneMatrix:ae,labelToScreenMatrix:Ce,scale:B,textPixelRatio:N,holdingForFade:p.holdingForFade(),collisionBoxArray:E,partiallyEvaluatedTextSize:c.ag(_.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(_.sourceID)};if(m)for(const ze of _.sortKeyRanges){const{sortKey:Xe,symbolInstanceStart:st,symbolInstanceEnd:gt}=ze;r.push({sortKey:Xe,symbolInstanceStart:st,symbolInstanceEnd:gt,parameters:Pe})}else r.push({symbolInstanceStart:0,symbolInstanceEnd:_.symbolInstances.length,parameters:Pe})}attemptAnchorPlacement(r,u,p,m,_,S,E,C,R,B,N,X,ee,re,ce,pe,me,we,ae){const Ce=c.aq[r.textAnchor],Pe=[r.textOffset0,r.textOffset1],ze=Bn(Ce,p,m,Pe,_),Xe=this.collisionIndex.placeCollisionBox(u,X,C,R,B,E,S,pe,N.predicate,ae,ze);if((!we||this.collisionIndex.placeCollisionBox(we,X,C,R,B,E,S,me,N.predicate,ae,ze).placeable)&&Xe.placeable){let st;if(this.prevPlacement&&this.prevPlacement.variableOffsets[ee.crossTileID]&&this.prevPlacement.placements[ee.crossTileID]&&this.prevPlacement.placements[ee.crossTileID].text&&(st=this.prevPlacement.variableOffsets[ee.crossTileID].anchor),ee.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[ee.crossTileID]={textOffset:Pe,width:p,height:m,anchor:Ce,textBoxScale:_,prevAnchor:st},this.markUsedJustification(re,Ce,ee,ce),re.allowVerticalPlacement&&(this.markUsedOrientation(re,ce,ee),this.placedOrientations[ee.crossTileID]=ce),{shift:ze,placedGlyphBoxes:Xe}}}placeLayerBucketPart(r,u,p){const{bucket:m,layout:_,translationText:S,translationIcon:E,posMatrix:C,unwrappedTileID:R,textLabelPlaneMatrix:B,labelToScreenMatrix:N,textPixelRatio:X,holdingForFade:ee,collisionBoxArray:re,partiallyEvaluatedTextSize:ce,collisionGroup:pe}=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"),ze=Pe==="always",Xe=_.get("text-rotation-alignment")==="map",st=_.get("text-pitch-alignment")==="map",gt=_.get("icon-text-fit")!=="none",wt=_.get("symbol-z-order")==="viewport-y",dt=Ce&&(ze||!m.hasIconData()||we),ct=ze&&(Ce||!m.hasTextData()||me);!m.collisionArrays&&re&&m.deserializeCollisionBoxes(re);const Pt=this._getTerrainElevationFunc(this.retainedQueryData[m.bucketInstanceId].tileID),qt=(ft,_t,Gt)=>{var Hr,tr;if(u[ft.crossTileID])return;if(ee)return void(this.placements[ft.crossTileID]=new rr(!1,!1,!1));let ar=!1,Wr=!1,Gn=!0,xs=null,Gr={box:null,placeable:!1,offscreen:null},_i={box:null,placeable:!1,offscreen:null},ii=null,Zn=null,si=null,Ws=0,ol=0,Ac=0;_t.textFeatureIndex?Ws=_t.textFeatureIndex:ft.useRuntimeCollisionCircles&&(Ws=ft.featureIndex),_t.verticalTextFeatureIndex&&(ol=_t.verticalTextFeatureIndex);const al=_t.textBox;if(al){const ts=Nn=>{let qn=c.ah.horizontal;if(m.allowVerticalPlacement&&!Nn&&this.prevPlacement){const Li=this.prevPlacement.placedOrientations[ft.crossTileID];Li&&(this.placedOrientations[ft.crossTileID]=Li,qn=Li,this.markUsedOrientation(m,qn,ft))}return qn},rs=(Nn,qn)=>{if(m.allowVerticalPlacement&&ft.numVerticalGlyphVertices>0&&_t.verticalTextBox){for(const Li of m.writingModes)if(Li===c.ah.vertical?(Gr=qn(),_i=Gr):Gr=Nn(),Gr&&Gr.placeable)break}else Gr=Nn()},Ao=ft.textAnchorOffsetStartIndex,ws=ft.textAnchorOffsetEndIndex;if(ws===Ao){const Nn=(qn,Li)=>{const cr=this.collisionIndex.placeCollisionBox(qn,ae,X,C,R,st,Xe,S,pe.predicate,Pt);return cr&&cr.placeable&&(this.markUsedOrientation(m,Li,ft),this.placedOrientations[ft.crossTileID]=Li),cr};rs(()=>Nn(al,c.ah.horizontal),()=>{const qn=_t.verticalTextBox;return m.allowVerticalPlacement&&ft.numVerticalGlyphVertices>0&&qn?Nn(qn,c.ah.vertical):{box:null,offscreen:null}}),ts(Gr&&Gr.placeable)}else{let Nn=c.aq[(tr=(Hr=this.prevPlacement)===null||Hr===void 0?void 0:Hr.variableOffsets[ft.crossTileID])===null||tr===void 0?void 0:tr.anchor];const qn=(cr,ca,ll)=>{const ul=cr.x2-cr.x1,um=cr.y2-cr.y1,t0=ft.textBoxScale,cm=gt&&Pe==="never"?ca:null;let Do=null,hm=ae==="never"?1:2,zc="never";Nn&&hm++;for(let du=0;duqn(al,_t.iconBox,c.ah.horizontal),()=>{const cr=_t.verticalTextBox;return m.allowVerticalPlacement&&(!Gr||!Gr.placeable)&&ft.numVerticalGlyphVertices>0&&cr?qn(cr,_t.verticalIconBox,c.ah.vertical):{box:null,occluded:!0,offscreen:null}}),Gr&&(ar=Gr.placeable,Gn=Gr.offscreen);const Li=ts(Gr&&Gr.placeable);if(!ar&&this.prevPlacement){const cr=this.prevPlacement.variableOffsets[ft.crossTileID];cr&&(this.variableOffsets[ft.crossTileID]=cr,this.markUsedJustification(m,cr.anchor,ft,Li))}}}if(ii=Gr,ar=ii&&ii.placeable,Gn=ii&&ii.offscreen,ft.useRuntimeCollisionCircles){const ts=m.text.placedSymbolArray.get(ft.centerJustifiedTextSymbolIndex),rs=c.ai(m.textSizeData,ce,ts),Ao=_.get("text-padding");Zn=this.collisionIndex.placeCollisionCircles(ae,ts,m.lineVertexArray,m.glyphOffsetArray,rs,C,R,B,N,p,st,pe.predicate,ft.collisionCircleDiameter,Ao,S,Pt),Zn.circles.length&&Zn.collisionDetected&&!p&&c.w("Collisions detected, but collision boxes are not shown"),ar=Ce||Zn.circles.length>0&&!Zn.collisionDetected,Gn=Gn&&Zn.offscreen}if(_t.iconFeatureIndex&&(Ac=_t.iconFeatureIndex),_t.iconBox){const ts=rs=>this.collisionIndex.placeCollisionBox(rs,Pe,X,C,R,st,Xe,E,pe.predicate,Pt,gt&&xs?xs:void 0);_i&&_i.placeable&&_t.verticalIconBox?(si=ts(_t.verticalIconBox),Wr=si.placeable):(si=ts(_t.iconBox),Wr=si.placeable),Gn=Gn&&si.offscreen}const es=me||ft.numHorizontalGlyphVertices===0&&ft.numVerticalGlyphVertices===0,Dc=we||ft.numIconVertices===0;es||Dc?Dc?es||(Wr=Wr&&ar):ar=Wr&&ar:Wr=ar=Wr&&ar;const Bd=Wr&&si.placeable;if(ar&&ii.placeable&&this.collisionIndex.insertCollisionBox(ii.box,ae,_.get("text-ignore-placement"),m.bucketInstanceId,_i&&_i.placeable&&ol?ol:Ws,pe.ID),Bd&&this.collisionIndex.insertCollisionBox(si.box,Pe,_.get("icon-ignore-placement"),m.bucketInstanceId,Ac,pe.ID),Zn&&ar&&this.collisionIndex.insertCollisionCircles(Zn.circles,ae,_.get("text-ignore-placement"),m.bucketInstanceId,Ws,pe.ID),p&&this.storeCollisionData(m.bucketInstanceId,Gt,_t,ii,si,Zn),ft.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(m.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[ft.crossTileID]=new rr(ar||dt,Wr||ct,Gn||m.justReloaded),u[ft.crossTileID]=!0};if(wt){if(r.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const ft=m.getSortedSymbolIndexes(this.transform.angle);for(let _t=ft.length-1;_t>=0;--_t){const Gt=ft[_t];qt(m.symbolInstances.get(Gt),m.collisionArrays[Gt],Gt)}}else for(let ft=r.symbolInstanceStart;ft=0&&(r.text.placedSymbolArray.get(E).crossTileID=_>=0&&E!==_?0:p.crossTileID)}markUsedOrientation(r,u,p){const m=u===c.ah.horizontal||u===c.ah.horizontalOnly?u:0,_=u===c.ah.vertical?u:0,S=[p.leftJustifiedTextSymbolIndex,p.centerJustifiedTextSymbolIndex,p.rightJustifiedTextSymbolIndex];for(const E of S)r.text.placedSymbolArray.get(E).placedOrientation=m;p.verticalPlacedTextSymbolIndex&&(r.text.placedSymbolArray.get(p.verticalPlacedTextSymbolIndex).placedOrientation=_)}commit(r){this.commitTime=r,this.zoomAtLastRecencyCheck=this.transform.zoom;const u=this.prevPlacement;let p=!1;this.prevZoomAdjustment=u?u.zoomAdjustment(this.transform.zoom):0;const m=u?u.symbolFadeChange(r):1,_=u?u.opacities:{},S=u?u.variableOffsets:{},E=u?u.placedOrientations:{};for(const C in this.placements){const R=this.placements[C],B=_[C];B?(this.opacities[C]=new rn(B,m,R.text,R.icon),p=p||R.text!==B.text.placed||R.icon!==B.icon.placed):(this.opacities[C]=new rn(null,m,R.text,R.icon,R.skipFade),p=p||R.text||R.icon)}for(const C in _){const R=_[C];if(!this.opacities[C]){const B=new rn(R,m,!1,!1);B.isHidden()||(this.opacities[C]=B,p=p||R.text.placed||R.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 E)this.placedOrientations[C]||!this.opacities[C]||this.opacities[C].isHidden()||(this.placedOrientations[C]=E[C]);if(u&&u.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=u?u.lastPlacementChangeTime:r)}updateLayerOpacities(r,u){const p={};for(const m of u){const _=m.getBucket(r);_&&m.latestFeatureIndex&&r.id===_.layerIds[0]&&this.updateBucketOpacities(_,m.tileID,p,m.collisionBoxArray)}}updateBucketOpacities(r,u,p,m){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,E=new rn(null,0,!1,!1,!0),C=S.get("text-allow-overlap"),R=S.get("icon-allow-overlap"),B=_._unevaluatedLayout.hasValue("text-variable-anchor")||_._unevaluatedLayout.hasValue("text-variable-anchor-offset"),N=S.get("text-rotation-alignment")==="map",X=S.get("text-pitch-alignment")==="map",ee=S.get("icon-text-fit")!=="none",re=new rn(null,0,C&&(R||!r.hasIconData()||S.get("icon-optional")),R&&(C||!r.hasTextData()||S.get("text-optional")),!0);!r.collisionArrays&&m&&(r.hasIconCollisionBoxData()||r.hasTextCollisionBoxData())&&r.deserializeCollisionBoxes(m);const ce=(me,we,ae)=>{for(let Ce=0;Ce0,st=this.placedOrientations[we.crossTileID],gt=st===c.ah.vertical,wt=st===c.ah.horizontal||st===c.ah.horizontalOnly;if(ae>0||Ce>0){const ct=Di(ze.text);ce(r.text,ae,gt?Na:ct),ce(r.text,Ce,wt?Na:ct);const Pt=ze.text.isHidden();[we.rightJustifiedTextSymbolIndex,we.centerJustifiedTextSymbolIndex,we.leftJustifiedTextSymbolIndex].forEach(_t=>{_t>=0&&(r.text.placedSymbolArray.get(_t).hidden=Pt||gt?1:0)}),we.verticalPlacedTextSymbolIndex>=0&&(r.text.placedSymbolArray.get(we.verticalPlacedTextSymbolIndex).hidden=Pt||wt?1:0);const qt=this.variableOffsets[we.crossTileID];qt&&this.markUsedJustification(r,qt.anchor,we,st);const ft=this.placedOrientations[we.crossTileID];ft&&(this.markUsedJustification(r,"left",we,ft),this.markUsedOrientation(r,ft,we))}if(Xe){const ct=Di(ze.icon),Pt=!(ee&&we.verticalPlacedIconSymbolIndex&>);we.placedIconSymbolIndex>=0&&(ce(r.icon,we.numIconVertices,Pt?ct:Na),r.icon.placedSymbolArray.get(we.placedIconSymbolIndex).hidden=ze.icon.isHidden()),we.verticalPlacedIconSymbolIndex>=0&&(ce(r.icon,we.numVerticalIconVertices,Pt?Na:ct),r.icon.placedSymbolArray.get(we.verticalPlacedIconSymbolIndex).hidden=ze.icon.isHidden())}const dt=pe&&pe.has(me)?pe.get(me):{text:null,icon:null};if(r.hasIconCollisionBoxData()||r.hasTextCollisionBoxData()){const ct=r.collisionArrays[me];if(ct){let Pt=new c.P(0,0);if(ct.textBox||ct.verticalTextBox){let qt=!0;if(B){const ft=this.variableOffsets[Pe];ft?(Pt=Bn(ft.anchor,ft.width,ft.height,ft.textOffset,ft.textBoxScale),N&&Pt._rotate(X?this.transform.angle:-this.transform.angle)):qt=!1}if(ct.textBox||ct.verticalTextBox){let ft;ct.textBox&&(ft=gt),ct.verticalTextBox&&(ft=wt),Ba(r.textCollisionBox.collisionVertexArray,ze.text.placed,!qt||ft,dt.text,Pt.x,Pt.y)}}if(ct.iconBox||ct.verticalIconBox){const qt=!!(!wt&&ct.verticalIconBox);let ft;ct.iconBox&&(ft=qt),ct.verticalIconBox&&(ft=!qt),Ba(r.iconCollisionBox.collisionVertexArray,ze.icon.placed,ft,dt.icon,ee?Pt.x:0,ee?Pt.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 Ba(v,r,u,p,m,_){p&&p.length!==0||(p=[0,0,0,0]);const S=p[0]-Qt,E=p[1]-Qt,C=p[2]-Qt,R=p[3]-Qt;v.emplaceBack(r?1:0,u?1:0,m||0,_||0,S,E),v.emplaceBack(r?1:0,u?1:0,m||0,_||0,C,E),v.emplaceBack(r?1:0,u?1:0,m||0,_||0,C,R),v.emplaceBack(r?1:0,u?1:0,m||0,_||0,S,R)}const Ar=Math.pow(2,25),Yh=Math.pow(2,24),Xh=Math.pow(2,17),Mi=Math.pow(2,16),Ai=Math.pow(2,9),P_=Math.pow(2,8),Xi=Math.pow(2,1);function Di(v){if(v.opacity===0&&!v.placed)return 0;if(v.opacity===1&&v.placed)return 4294967295;const r=v.placed?1:0,u=Math.floor(127*v.opacity);return u*Ar+r*Yh+u*Xh+r*Mi+u*Ai+r*P_+u*Xi+r}const Na=0;function Jo(){return{isOccluded:(v,r,u)=>!1,getPitchedTextCorrection:(v,r,u)=>1,get useSpecialProjectionForSymbols(){return!1},projectTileCoordinates(v,r,u,p){throw new Error("Not implemented.")},translatePosition:(v,r,u,p)=>function(m,_,S,E,C=!1){if(!S[0]&&!S[1])return[0,0];const R=C?E==="map"?m.angle:0:E==="viewport"?-m.angle:0;if(R){const B=Math.sin(R),N=Math.cos(R);S=[S[0]*N-S[1]*B,S[0]*B+S[1]*N]}return[C?S[0]:or(_,S[0],m.zoom),C?S[1]:or(_,S[1],m.zoom)]}(v,r,u,p),getCircleRadiusCorrection:v=>1}}class En{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,u,p,m,_){const S=this._bucketParts;for(;this._currentTileIndexE.sortKey-C.sortKey));this._currentPartIndex!this._forceFullPlacement&&A.now()-m>2;for(;this._currentPlacementIndex>=0;){const S=u[r[this._currentPlacementIndex]],E=this.placement.collisionIndex.transform.zoom;if(S.type==="symbol"&&(!S.minzoom||S.minzoom<=E)&&(!S.maxzoom||S.maxzoom>E)){if(this._inProgressLayer||(this._inProgressLayer=new En(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 ms=512/c.X/2;class xn{constructor(r,u,p){this.tileID=r,this.bucketInstanceId=p,this._symbolsByKey={};const m=new Map;for(let _=0;_({x:Math.floor(C.anchorX*ms),y:Math.floor(C.anchorY*ms)})),crossTileIDs:S.map(C=>C.crossTileID)};if(E.positions.length>128){const C=new c.av(E.positions.length,16,Uint16Array);for(const{x:R,y:B}of E.positions)C.add(R,B);C.finish(),delete E.positions,E.index=C}this._symbolsByKey[_]=E}}getScaledCoordinates(r,u){const{x:p,y:m,z:_}=this.tileID.canonical,{x:S,y:E,z:C}=u.canonical,R=ms/Math.pow(2,C-_),B=(E*c.X+r.anchorY)*R,N=m*c.X*ms;return{x:Math.floor((S*c.X+r.anchorX)*R-p*c.X*ms),y:Math.floor(B-N)}}findMatches(r,u,p){const m=this.tileID.canonical.zr)}}class ec{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class gs{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(r){const u=Math.round((r-this.lng)/360);if(u!==0)for(const p in this.indexes){const m=this.indexes[p],_={};for(const S in m){const E=m[S];E.tileID=E.tileID.unwrapTo(E.tileID.wrap+u),_[E.tileID.key]=E}this.indexes[p]=_}this.lng=r}addBucket(r,u,p){if(this.indexes[r.overscaledZ]&&this.indexes[r.overscaledZ][r.key]){if(this.indexes[r.overscaledZ][r.key].bucketInstanceId===u.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(r.overscaledZ,this.indexes[r.overscaledZ][r.key])}for(let _=0;_r.overscaledZ)for(const E in S){const C=S[E];C.tileID.isChildOf(r)&&C.findMatches(u.symbolInstances,r,m)}else{const E=S[r.scaledTo(Number(_)).key];E&&E.findMatches(u.symbolInstances,r,m)}}for(let _=0;_{u[p]=!0});for(const p in this.layerIndexes)u[p]||delete this.layerIndexes[p]}}const ys=(v,r)=>c.t(v,r&&r.filter(u=>u.identifier!=="source.canvas")),M_=c.aw();class tc extends c.E{constructor(r,u={}){super(),this._rtlPluginLoaded=()=>{for(const p in this.sourceCaches){const m=this.sourceCaches[p].getSource().type;m!=="vector"&&m!=="geojson"||this.sourceCaches[p].reload()}},this.map=r,this.dispatcher=new _r(Yt(),r._getMapId()),this.dispatcher.registerMessageHandler("GG",(p,m)=>this.getGlyphs(p,m)),this.dispatcher.registerMessageHandler("GI",(p,m)=>this.getImages(p,m)),this.imageManager=new je,this.imageManager.setEventedParent(this),this.glyphManager=new ye(r._requestManager,u.localIdeographFontFamily),this.lineAtlas=new mt(256,512),this.crossTileSymbolIndex=new Kh,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()),vn().on(qe,this._rtlPluginLoaded),this.on("data",p=>{if(p.dataType!=="source"||p.sourceDataType!=="metadata")return;const m=this.sourceCaches[p.sourceId];if(!m)return;const _=m.getSource();if(_&&_.vectorLayerIds)for(const S in this._layers){const E=this._layers[S];E.source===_.id&&this._validateLayer(E)}})}loadURL(r,u={},p){this.fire(new c.k("dataloading",{dataType:"style"})),u.validate=typeof u.validate!="boolean"||u.validate;const m=this.map._requestManager.transformRequest(r,"Style");this._loadStyleRequest=new AbortController;const _=this._loadStyleRequest;c.h(m,this._loadStyleRequest).then(S=>{this._loadStyleRequest=null,this._load(S.data,u,p)}).catch(S=>{this._loadStyleRequest=null,S&&!_.signal.aborted&&this.fire(new c.j(S))})}loadJSON(r,u={},p){this.fire(new c.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,A.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,u.validate=u.validate!==!1,this._load(r,u,p)}).catch(()=>{})}loadEmpty(){this.fire(new c.k("dataloading",{dataType:"style"})),this._load(M_,{validate:!1})}_load(r,u,p){var m;const _=u.transformStyle?u.transformStyle(p,r):r;if(!u.validate||!ys(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 Ke(this.stylesheet.light),this.sky=new Ee(this.stylesheet.sky),this.map.setTerrain((m=this.stylesheet.terrain)!==null&&m!==void 0?m: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(u=>u.id),this._layers={},this._serializedLayers=null;for(const u of r){const p=c.aA(u);p.setEventedParent(this,{layer:{id:u.id}}),this._layers[u.id]=p}}_loadSprite(r,u=!1,p=void 0){let m;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(_,S,E,C){return c._(this,void 0,void 0,function*(){const R=Oe(_),B=E>1?"@2x":"",N={},X={};for(const{id:ee,url:re}of R){const ce=S.transformRequest(Ge(re,B,".json"),"SpriteJSON");N[ee]=c.h(ce,C);const pe=S.transformRequest(Ge(re,B,".png"),"SpriteImage");X[ee]=Z.getImage(pe,C)}return yield Promise.all([...Object.values(N),...Object.values(X)]),function(ee,re){return c._(this,void 0,void 0,function*(){const ce={};for(const pe in ee){ce[pe]={};const me=A.getImageCanvasContext((yield re[pe]).data),we=(yield ee[pe]).data;for(const ae in we){const{width:Ce,height:Pe,x:ze,y:Xe,sdf:st,pixelRatio:gt,stretchX:wt,stretchY:dt,content:ct,textFitWidth:Pt,textFitHeight:qt}=we[ae];ce[pe][ae]={data:null,pixelRatio:gt,sdf:st,stretchX:wt,stretchY:dt,content:ct,textFitWidth:Pt,textFitHeight:qt,spriteData:{width:Ce,height:Pe,x:ze,y:Xe,context:me}}}}return ce})}(N,X)})}(r,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(_=>{if(this._spriteRequest=null,_)for(const S in _){this._spritesImagesIds[S]=[];const E=this._spritesImagesIds[S]?this._spritesImagesIds[S].filter(C=>!(C in _)):[];for(const C of E)this.imageManager.removeImage(C),this._changedImages[C]=!0;for(const C in _[S]){const R=S==="default"?C:`${S}:${C}`;this._spritesImagesIds[S].push(R),R in this.imageManager.images?this.imageManager.updateImage(R,_[S][C],!1):this.imageManager.addImage(R,_[S][C]),u&&(this._changedImages[R]=!0)}}}).catch(_=>{this._spriteRequest=null,m=_,this.fire(new c.j(m))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),u&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new c.k("data",{dataType:"style"})),p&&p(m)})}_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 u=this.sourceCaches[r.source];if(!u)return;const p=r.sourceLayer;if(!p)return;const m=u.getSource();(m.type==="geojson"||m.vectorLayerIds&&m.vectorLayerIds.indexOf(p)===-1)&&this.fire(new c.j(new Error(`Source layer "${p}" does not exist on source "${m.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,u=!1){const p=this._serializedAllLayers();if(!r||r.length===0)return Object.values(u?c.aB(p):p);const m=[];for(const _ of r)if(p[_]){const S=u?c.aB(p[_]):p[_];m.push(S)}return m}_serializedAllLayers(){let r=this._serializedLayers;if(r)return r;r=this._serializedLayers={};const u=Object.keys(this._layers);for(const p of u){const m=this._layers[p];m.type!=="custom"&&(r[p]=m.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 u=this._changed;if(u){const m=Object.keys(this._updatedLayers),_=Object.keys(this._removedLayers);(m.length||_.length)&&this._updateWorkerLayers(m,_);for(const S in this._updatedSources){const E=this._updatedSources[S];if(E==="reload")this._reloadSource(S);else{if(E!=="clear")throw new Error(`Invalid action ${E}`);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 m in this.sourceCaches){const _=this.sourceCaches[m];p[m]=_.used,_.used=!1}for(const m of this._order){const _=this._layers[m];_.recalculate(r,this._availableImages),!_.isHidden(r.zoom)&&_.source&&(this.sourceCaches[_.source].used=!0)}for(const m in p){const _=this.sourceCaches[m];!!p[m]!=!!_.used&&_.fire(new c.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:m}))}this.light.recalculate(r),this.sky.recalculate(r),this.z=r.zoom,u&&this.fire(new c.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){const r=Object.keys(this._changedImages);if(r.length){for(const u in this.sourceCaches)this.sourceCaches[u].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,u){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(r,!1),removedIds:u})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(r,u={}){var p;this._checkLoaded();const m=this.serialize();if(r=u.transformStyle?u.transformStyle(m,r):r,((p=u.validate)===null||p===void 0||p)&&ys(this,c.u(r)))return!1;(r=c.aB(r)).layers=c.az(r.layers);const _=c.aC(m,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 E of S.operations)E();return this.stylesheet=r,this._serializedLayers=null,!0}_getOperationsToPerform(r){const u=[],p=[];for(const m of r)switch(m.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":u.push(()=>this.addLayer.apply(this,m.args));break;case"removeLayer":u.push(()=>this.removeLayer.apply(this,m.args));break;case"setPaintProperty":u.push(()=>this.setPaintProperty.apply(this,m.args));break;case"setLayoutProperty":u.push(()=>this.setLayoutProperty.apply(this,m.args));break;case"setFilter":u.push(()=>this.setFilter.apply(this,m.args));break;case"addSource":u.push(()=>this.addSource.apply(this,m.args));break;case"removeSource":u.push(()=>this.removeSource.apply(this,m.args));break;case"setLayerZoomRange":u.push(()=>this.setLayerZoomRange.apply(this,m.args));break;case"setLight":u.push(()=>this.setLight.apply(this,m.args));break;case"setGeoJSONSourceData":u.push(()=>this.setGeoJSONSourceData.apply(this,m.args));break;case"setGlyphs":u.push(()=>this.setGlyphs.apply(this,m.args));break;case"setSprite":u.push(()=>this.setSprite.apply(this,m.args));break;case"setSky":u.push(()=>this.setSky.apply(this,m.args));break;case"setTerrain":u.push(()=>this.map.setTerrain.apply(this,m.args));break;case"setTransition":u.push(()=>{});break;default:p.push(m.command)}return{operations:u,unimplemented:p}}addImage(r,u){if(this.getImage(r))return this.fire(new c.j(new Error(`An image named "${r}" already exists.`)));this.imageManager.addImage(r,u),this._afterImageUpdated(r)}updateImage(r,u){this.imageManager.updateImage(r,u)}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,u,p={}){if(this._checkLoaded(),this.sourceCaches[r]!==void 0)throw new Error(`Source "${r}" already exists.`);if(!u.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(u).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(u.type)>=0&&this._validate(c.u.source,`sources.${r}`,u,null,p))return;this.map&&this.map._collectResourceTiming&&(u.collectResourceTiming=!0);const m=this.sourceCaches[r]=new jt(r,u,this.dispatcher);m.style=this,m.setEventedParent(this,()=>({isSourceLoaded:m.loaded(),source:m.serialize(),sourceId:r})),m.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 u=this.sourceCaches[r];delete this.sourceCaches[r],delete this._updatedSources[r],u.fire(new c.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:r})),u.setEventedParent(null),u.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(r,u){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(u),this._changed=!0}getSource(r){return this.sourceCaches[r]&&this.sourceCaches[r].getSource()}addLayer(r,u,p={}){this._checkLoaded();const m=r.id;if(this.getLayer(m))return void this.fire(new c.j(new Error(`Layer "${m}" already exists on this map.`)));let _;if(r.type==="custom"){if(ys(this,c.aD(r)))return;_=c.aA(r)}else{if("source"in r&&typeof r.source=="object"&&(this.addSource(m,r.source),r=c.aB(r),r=c.e(r,{source:m})),this._validate(c.u.layer,`layers.${m}`,r,{arrayIndex:-1},p))return;_=c.aA(r),this._validateLayer(_),_.setEventedParent(this,{layer:{id:m}})}const S=u?this._order.indexOf(u):this._order.length;if(u&&S===-1)this.fire(new c.j(new Error(`Cannot add layer "${m}" before non-existing layer "${u}".`)));else{if(this._order.splice(S,0,m),this._layerOrderChanged=!0,this._layers[m]=_,this._removedLayers[m]&&_.source&&_.type!=="custom"){const E=this._removedLayers[m];delete this._removedLayers[m],E.type!==_.type?this._updatedSources[_.source]="clear":(this._updatedSources[_.source]="reload",this.sourceCaches[_.source].pause())}this._updateLayer(_),_.onAdd&&_.onAdd(this.map)}}moveLayer(r,u){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===u)return;const p=this._order.indexOf(r);this._order.splice(p,1);const m=u?this._order.indexOf(u):this._order.length;u&&m===-1?this.fire(new c.j(new Error(`Cannot move layer "${r}" before non-existing layer "${u}".`))):(this._order.splice(m,0,r),this._layerOrderChanged=!0)}removeLayer(r){this._checkLoaded();const u=this._layers[r];if(!u)return void this.fire(new c.j(new Error(`Cannot remove non-existing layer "${r}".`)));u.setEventedParent(null);const p=this._order.indexOf(r);this._order.splice(p,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[r]=u,delete this._layers[r],this._serializedLayers&&delete this._serializedLayers[r],delete this._updatedLayers[r],delete this._updatedPaintProps[r],u.onRemove&&u.onRemove(this.map)}getLayer(r){return this._layers[r]}getLayersOrder(){return[...this._order]}hasLayer(r){return r in this._layers}setLayerZoomRange(r,u,p){this._checkLoaded();const m=this.getLayer(r);m?m.minzoom===u&&m.maxzoom===p||(u!=null&&(m.minzoom=u),p!=null&&(m.maxzoom=p),this._updateLayer(m)):this.fire(new c.j(new Error(`Cannot set the zoom range of non-existing layer "${r}".`)))}setFilter(r,u,p={}){this._checkLoaded();const m=this.getLayer(r);if(m){if(!c.aE(m.filter,u))return u==null?(m.filter=void 0,void this._updateLayer(m)):void(this._validate(c.u.filter,`layers.${m.id}.filter`,u,null,p)||(m.filter=c.aB(u),this._updateLayer(m)))}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,u,p,m={}){this._checkLoaded();const _=this.getLayer(r);_?c.aE(_.getLayoutProperty(u),p)||(_.setLayoutProperty(u,p,m),this._updateLayer(_)):this.fire(new c.j(new Error(`Cannot style non-existing layer "${r}".`)))}getLayoutProperty(r,u){const p=this.getLayer(r);if(p)return p.getLayoutProperty(u);this.fire(new c.j(new Error(`Cannot get style of non-existing layer "${r}".`)))}setPaintProperty(r,u,p,m={}){this._checkLoaded();const _=this.getLayer(r);_?c.aE(_.getPaintProperty(u),p)||(_.setPaintProperty(u,p,m)&&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,u){return this.getLayer(r).getPaintProperty(u)}setFeatureState(r,u){this._checkLoaded();const p=r.source,m=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"&&m?this.fire(new c.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):S!=="vector"||m?(r.id===void 0&&this.fire(new c.j(new Error("The feature id parameter must be provided."))),_.setFeatureState(m,r.id,u)):this.fire(new c.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(r,u){this._checkLoaded();const p=r.source,m=this.sourceCaches[p];if(m===void 0)return void this.fire(new c.j(new Error(`The source '${p}' does not exist in the map's style.`)));const _=m.getSource().type,S=_==="vector"?r.sourceLayer:void 0;_!=="vector"||S?u&&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."))):m.removeFeatureState(S,r.id,u):this.fire(new c.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(r){this._checkLoaded();const u=r.source,p=r.sourceLayer,m=this.sourceCaches[u];if(m!==void 0)return m.getSource().type!=="vector"||p?(r.id===void 0&&this.fire(new c.j(new Error("The feature id parameter must be provided."))),m.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 '${u}' 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()),u=this._serializeByIds(this._order,!0),p=this.map.getTerrain()||void 0,m=this.stylesheet;return c.aG({version:m.version,name:m.name,metadata:m.metadata,light:m.light,sky:m.sky,center:m.center,zoom:m.zoom,bearing:m.bearing,pitch:m.pitch,sprite:m.sprite,glyphs:m.glyphs,transition:m.transition,sources:r,layers:u,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 u=S=>this._layers[S].type==="fill-extrusion",p={},m=[];for(let S=this._order.length-1;S>=0;S--){const E=this._order[S];if(u(E)){p[E]=S;for(const C of r){const R=C[E];if(R)for(const B of R)m.push(B)}}}m.sort((S,E)=>E.intersectionZ-S.intersectionZ);const _=[];for(let S=this._order.length-1;S>=0;S--){const E=this._order[S];if(u(E))for(let C=m.length-1;C>=0;C--){const R=m[C].feature;if(p[R.layer.id]{const st=me.featureSortOrder;if(st){const gt=st.indexOf(ze.featureIndex);return st.indexOf(Xe.featureIndex)-gt}return Xe.featureIndex-ze.featureIndex});for(const ze of Pe)Ce.push(ze)}}for(const me in re)re[me].forEach(we=>{const ae=we.feature,Ce=R[E[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,u,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(_)}querySourceFeatures(r,u){u&&u.filter&&this._validate(c.u.filter,"querySourceFeatures.filter",u.filter,null,u);const p=this.sourceCaches[r];return p?function(m,_){const S=m.getRenderableIds().map(R=>m.getTileByID(R)),E=[],C={};for(let R=0;RX.getTileByID(ee)).sort((ee,re)=>re.tileID.overscaledZ-ee.tileID.overscaledZ||(ee.tileID.isLessThan(re.tileID)?-1:1))}const N=this.crossTileSymbolIndex.addLayer(B,C[B.source],r.center.lng);S=S||N}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((_=_||this._layerOrderChanged||p===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(A.now(),r.zoom))&&(this.pauseablePlacement=new ql(r,this.map.terrain,this._order,_,u,p,m,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(A.now()),E=!0),S&&this.pauseablePlacement.placement.setStale()),E||S)for(const R of this._order){const B=this._layers[R];B.type==="symbol"&&this.placement.updateLayerOpacities(B,C[B.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(A.now())}_releaseSymbolFadeTiles(){for(const r in this.sourceCaches)this.sourceCaches[r].releaseSymbolFadeTiles()}getImages(r,u){return c._(this,void 0,void 0,function*(){const p=yield this.imageManager.getImages(u.icons);this._updateTilesForChangedImages();const m=this.sourceCaches[u.source];return m&&m.setDependencies(u.tileID.key,u.type,u.icons),p})}getGlyphs(r,u){return c._(this,void 0,void 0,function*(){const p=yield this.glyphManager.getGlyphs(u.stacks),m=this.sourceCaches[u.source];return m&&m.setDependencies(u.tileID.key,u.type,[""]),p})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(r,u={}){this._checkLoaded(),r&&this._validate(c.u.glyphs,"glyphs",r,null,u)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=r,this.glyphManager.entries={},this.glyphManager.setURL(r))}addSprite(r,u,p={},m){this._checkLoaded();const _=[{id:r,url:u}],S=[...Oe(this.stylesheet.sprite),..._];this._validate(c.u.sprite,"sprite",S,null,p)||(this.stylesheet.sprite=S,this._loadSprite(_,!0,m))}removeSprite(r){this._checkLoaded();const u=Oe(this.stylesheet.sprite);if(u.find(p=>p.id===r)){if(this._spritesImagesIds[r])for(const p of this._spritesImagesIds[r])this.imageManager.removeImage(p),this._changedImages[p]=!0;u.splice(u.findIndex(p=>p.id===r),1),this.stylesheet.sprite=u.length>0?u: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 Oe(this.stylesheet.sprite)}setSprite(r,u={},p){this._checkLoaded(),r&&this._validate(c.u.sprite,"sprite",r,null,u)||(this.stylesheet.sprite=r,r?this._loadSprite(r,!0,p):(this._unloadSprite(),p&&p(null)))}}var Qo=c.Y([{name:"a_pos",type:"Int16",components:2}]);const Po={prelude:Sr(`#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:Sr(`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:Sr(`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:Sr(`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:Sr("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:Sr(`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:Sr(`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:Sr("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:Sr("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:Sr("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:Sr(`#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:Sr(`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:Sr(`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:Sr(`#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:Sr(`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:Sr(`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:Sr(`#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:Sr(`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:Sr(`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:Sr(`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:Sr(`#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:Sr(`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:Sr(`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:Sr(`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:Sr(`#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:Sr(`#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:Sr("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:Sr("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:Sr("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:Sr("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 Sr(v,r){const u=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,p=r.match(/attribute ([\w]+) ([\w]+)/g),m=v.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),_=r.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),S=_?_.concat(m):m,E={};return{fragmentSource:v=v.replace(u,(C,R,B,N,X)=>(E[X]=!0,R==="define"?` +#ifndef HAS_UNIFORM_u_${X} +varying ${B} ${N} ${X}; +#else +uniform ${B} ${N} u_${X}; +#endif +`:` +#ifdef HAS_UNIFORM_u_${X} + ${B} ${N} ${X} = u_${X}; +#endif +`)),vertexSource:r=r.replace(u,(C,R,B,N,X)=>{const ee=N==="float"?"vec2":"vec4",re=X.match(/color/)?"color":ee;return E[X]?R==="define"?` +#ifndef HAS_UNIFORM_u_${X} +uniform lowp float u_${X}_t; +attribute ${B} ${ee} a_${X}; +varying ${B} ${N} ${X}; +#else +uniform ${B} ${N} u_${X}; +#endif +`:re==="vec4"?` +#ifndef HAS_UNIFORM_u_${X} + ${X} = a_${X}; +#else + ${B} ${N} ${X} = u_${X}; +#endif +`:` +#ifndef HAS_UNIFORM_u_${X} + ${X} = unpack_mix_${re}(a_${X}, u_${X}_t); +#else + ${B} ${N} ${X} = u_${X}; +#endif +`:R==="define"?` +#ifndef HAS_UNIFORM_u_${X} +uniform lowp float u_${X}_t; +attribute ${B} ${ee} a_${X}; +#else +uniform ${B} ${N} u_${X}; +#endif +`:re==="vec4"?` +#ifndef HAS_UNIFORM_u_${X} + ${B} ${N} ${X} = a_${X}; +#else + ${B} ${N} ${X} = u_${X}; +#endif +`:` +#ifndef HAS_UNIFORM_u_${X} + ${B} ${N} ${X} = unpack_mix_${re}(a_${X}, u_${X}_t); +#else + ${B} ${N} ${X} = u_${X}; +#endif +`}),staticAttributes:p,staticUniforms:S}}class Jh{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(r,u,p,m,_,S,E,C,R){this.context=r;let B=this.boundPaintVertexBuffers.length!==m.length;for(let N=0;!B&&N({u_matrix:v,u_texture:0,u_ele_delta:r,u_fog_matrix:u,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(m):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 $a(v){const r=[];for(let u=0;u({u_depth:new c.aH(ze,Xe.u_depth),u_terrain:new c.aH(ze,Xe.u_terrain),u_terrain_dim:new c.aI(ze,Xe.u_terrain_dim),u_terrain_matrix:new c.aJ(ze,Xe.u_terrain_matrix),u_terrain_unpack:new c.aK(ze,Xe.u_terrain_unpack),u_terrain_exaggeration:new c.aI(ze,Xe.u_terrain_exaggeration)}))(r,Pe),this.binderUniforms=p?p.getUniforms(r,Pe):[]}draw(r,u,p,m,_,S,E,C,R,B,N,X,ee,re,ce,pe,me,we){const ae=r.gl;if(this.failedToCreate)return;if(r.program.set(this.program),r.setDepthMode(p),r.setStencilMode(m),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(E[Pe]);ce&&ce.setUniforms(r,this.binderUniforms,ee,{zoom:re});let Ce=0;switch(u){case ae.LINES:Ce=2;break;case ae.TRIANGLES:Ce=3;break;case ae.LINE_STRIP:Ce=1}for(const Pe of X.get()){const ze=Pe.vaos||(Pe.vaos={});(ze[R]||(ze[R]=new Jh)).bind(r,this,B,ce?ce.getPaintVertexBuffers():[],N,Pe.vertexOffset,pe,me,we),ae.drawElements(u,Pe.primitiveLength*Ce,ae.UNSIGNED_SHORT,Pe.primitiveOffset*Ce*2)}}}function rc(v,r,u){const p=1/or(u,1,r.transform.tileZoom),m=Math.pow(2,u.tileID.overscaledZ),_=u.tileSize*Math.pow(2,r.transform.tileZoom)/m,S=_*(u.tileID.canonical.x+u.tileID.wrap*m),E=_*u.tileID.canonical.y;return{u_image:0,u_texsize:u.imageAtlasTexture.size,u_scale:[p,v.fromScale,v.toScale],u_fade:v.t,u_pixel_coord_upper:[S>>16,E>>16],u_pixel_coord_lower:[65535&S,65535&E]}}const Yl=(v,r,u,p)=>{const m=r.style.light,_=m.properties.get("position"),S=[_.x,_.y,_.z],E=function(){var R=new c.A(9);return c.A!=Float32Array&&(R[1]=0,R[2]=0,R[3]=0,R[5]=0,R[6]=0,R[7]=0),R[0]=1,R[4]=1,R[8]=1,R}();m.properties.get("anchor")==="viewport"&&function(R,B){var N=Math.sin(B),X=Math.cos(B);R[0]=X,R[1]=N,R[2]=0,R[3]=-N,R[4]=X,R[5]=0,R[6]=0,R[7]=0,R[8]=1}(E,-r.transform.angle),function(R,B,N){var X=B[0],ee=B[1],re=B[2];R[0]=X*N[0]+ee*N[3]+re*N[6],R[1]=X*N[1]+ee*N[4]+re*N[7],R[2]=X*N[2]+ee*N[5]+re*N[8]}(S,S,E);const C=m.properties.get("color");return{u_matrix:v,u_lightpos:S,u_lightintensity:m.properties.get("intensity"),u_lightcolor:[C.r,C.g,C.b],u_vertical_gradient:+u,u_opacity:p}},nc=(v,r,u,p,m,_,S)=>c.e(Yl(v,r,u,p),rc(_,r,S),{u_height_factor:-Math.pow(2,m.overscaledZ)/S.tileSize/8}),ja=v=>({u_matrix:v}),Mp=(v,r,u,p)=>c.e(ja(v),rc(u,r,p)),A_=(v,r)=>({u_matrix:v,u_world:r}),Ap=(v,r,u,p,m)=>c.e(Mp(v,r,u,p),{u_world:m}),D_=(v,r,u,p)=>{const m=v.transform;let _,S;if(p.paint.get("circle-pitch-alignment")==="map"){const E=or(u,1,m.zoom);_=!0,S=[E,E]}else _=!1,S=m.pixelsToGLUnits;return{u_camera_to_center_distance:m.cameraToCenterDistance,u_scale_with_map:+(p.paint.get("circle-pitch-scale")==="map"),u_matrix:v.translatePosMatrix(r.posMatrix,u,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}},ea=(v,r,u)=>({u_matrix:v,u_inv_matrix:r,u_camera_to_center_distance:u.cameraToCenterDistance,u_viewport_size:[u.width,u.height]}),Xl=(v,r,u=1)=>({u_matrix:v,u_color:r,u_overlay:0,u_overlay_scale:u}),gi=v=>({u_matrix:v}),yi=(v,r,u,p)=>({u_matrix:v,u_extrude_scale:or(r,1,u),u_intensity:p}),ic=(v,r,u,p)=>{const m=c.H();c.aP(m,0,v.width,v.height,0,0,1);const _=v.context.gl;return{u_matrix:m,u_world:[_.drawingBufferWidth,_.drawingBufferHeight],u_image:u,u_color_ramp:p,u_opacity:r.paint.get("heatmap-opacity")}};function sc(v,r){const u=Math.pow(2,r.canonical.z),p=r.canonical.y;return[new c.Z(0,p/u).toLngLat().lat,new c.Z(0,(p+1)/u).toLngLat().lat]}const oc=(v,r,u,p)=>{const m=v.transform;return{u_matrix:Rp(v,r,u,p),u_ratio:1/or(r,1,m.zoom),u_device_pixel_ratio:v.pixelRatio,u_units_to_pixels:[1/m.pixelsToGLUnits[0],1/m.pixelsToGLUnits[1]]}},Dp=(v,r,u,p,m)=>c.e(oc(v,r,u,m),{u_image:0,u_image_height:p}),Ua=(v,r,u,p,m)=>{const _=v.transform,S=zp(r,_);return{u_matrix:Rp(v,r,u,m),u_texsize:r.imageAtlasTexture.size,u_ratio:1/or(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]]}},z_=(v,r,u,p,m,_)=>{const S=v.lineAtlas,E=zp(r,v.transform),C=u.layout.get("line-cap")==="round",R=S.getDash(p.from,C),B=S.getDash(p.to,C),N=R.width*m.fromScale,X=B.width*m.toScale;return c.e(oc(v,r,u,_),{u_patternscale_a:[E/N,-R.height/2],u_patternscale_b:[E/X,-B.height/2],u_sdfgamma:S.width/(256*Math.min(N,X)*v.pixelRatio)/2,u_image:0,u_tex_y_a:R.y,u_tex_y_b:B.y,u_mix:m.t})};function zp(v,r){return 1/or(v,1,r.tileZoom)}function Rp(v,r,u,p){return v.translatePosMatrix(p?p.posMatrix:r.tileID.posMatrix,r,u.paint.get("line-translate"),u.paint.get("line-translate-anchor"))}const R_=(v,r,u,p,m)=>{return{u_matrix:v,u_tl_parent:r,u_scale_parent:u,u_buffer_scale:1,u_fade_t:p.mix,u_opacity:p.opacity*m.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:m.paint.get("raster-brightness-min"),u_brightness_high:m.paint.get("raster-brightness-max"),u_saturation_factor:(S=m.paint.get("raster-saturation"),S>0?1-1/(1.001-S):-S),u_contrast_factor:(_=m.paint.get("raster-contrast"),_>0?1/(1-_):1+_),u_spin_weights:L_(m.paint.get("raster-hue-rotate"))};var _,S};function L_(v){v*=Math.PI/180;const r=Math.sin(v),u=Math.cos(v);return[(2*u+1)/3,(-Math.sqrt(3)*r-u+1)/3,(Math.sqrt(3)*r-u+1)/3]}const Lp=(v,r,u,p,m,_,S,E,C,R,B,N,X,ee)=>{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:+u,u_aspect_ratio:re.width/re.height,u_fade_change:S.options.fadeDuration?S.symbolFadeChange:1,u_matrix:E,u_label_plane_matrix:C,u_coord_matrix:R,u_is_text:+N,u_pitch_with_map:+p,u_is_along_line:m,u_is_variable_anchor:_,u_texsize:X,u_texture:0,u_translation:B,u_pitched_scale:ee}},Kl=(v,r,u,p,m,_,S,E,C,R,B,N,X,ee,re)=>{const ce=S.transform;return c.e(Lp(v,r,u,p,m,_,S,E,C,R,B,N,X,re),{u_gamma_scale:p?Math.cos(ce._pitch)*ce.cameraToCenterDistance:1,u_device_pixel_ratio:S.pixelRatio,u_is_halo:+ee})},td=(v,r,u,p,m,_,S,E,C,R,B,N,X,ee)=>c.e(Kl(v,r,u,p,m,_,S,E,C,R,B,!0,N,!0,ee),{u_texsize_icon:X,u_texture_icon:1}),ac=(v,r,u)=>({u_matrix:v,u_opacity:r,u_color:u}),rd=(v,r,u,p,m,_)=>c.e(function(S,E,C,R){const B=C.imageManager.getPattern(S.from.toString()),N=C.imageManager.getPattern(S.to.toString()),{width:X,height:ee}=C.imageManager.getPixelSize(),re=Math.pow(2,R.tileID.overscaledZ),ce=R.tileSize*Math.pow(2,C.transform.tileZoom)/re,pe=ce*(R.tileID.canonical.x+R.tileID.wrap*re),me=ce*R.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:B.tl,u_pattern_br_a:B.br,u_pattern_tl_b:N.tl,u_pattern_br_b:N.br,u_texsize:[X,ee],u_mix:E.t,u_pattern_size_a:B.displaySize,u_pattern_size_b:N.displaySize,u_scale_a:E.fromScale,u_scale_b:E.toScale,u_tile_units_to_pixels:1/or(R,1,C.transform.tileZoom),u_pixel_coord_upper:[pe>>16,me>>16],u_pixel_coord_lower:[65535&pe,65535&me]}}(p,_,u,m),{u_matrix:v,u_opacity:r}),nd={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 Us{constructor(r,u,p){this.context=r;const m=r.gl;this.buffer=m.createBuffer(),this.dynamicDraw=!!p,this.context.unbindVAO(),r.bindElementBuffer.set(this.buffer),m.bufferData(m.ELEMENT_ARRAY_BUFFER,u.arrayBuffer,this.dynamicDraw?m.DYNAMIC_DRAW:m.STATIC_DRAW),this.dynamicDraw||delete u.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(r){const u=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),u.bufferSubData(u.ELEMENT_ARRAY_BUFFER,0,r.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const O_={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class id{constructor(r,u,p,m){this.length=u.length,this.attributes=p,this.itemSize=u.bytesPerElement,this.dynamicDraw=m,this.context=r;const _=r.gl;this.buffer=_.createBuffer(),r.bindVertexBuffer.set(this.buffer),_.bufferData(_.ARRAY_BUFFER,u.arrayBuffer,this.dynamicDraw?_.DYNAMIC_DRAW:_.STATIC_DRAW),this.dynamicDraw||delete u.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 u=this.context.gl;this.bind(),u.bufferSubData(u.ARRAY_BUFFER,0,r.arrayBuffer)}enableAttributes(r,u){for(let p=0;p0){const ze=c.H();c.aQ(ze,ae.placementInvProjMatrix,v.transform.glCoordMatrix),c.aQ(ze,ze,ae.placementViewportMatrix),C.push({circleArray:Pe,circleOffset:B,transform:we.posMatrix,invTransform:ze,coord:we}),R+=Pe.length/4,B=R}Ce&&E.draw(_,S.LINES,ir.disabled,Nr.disabled,v.colorModeForRenderPass(),Rr.disabled,{u_matrix:we.posMatrix,u_pixel_extrude_scale:[1/(N=v.transform).width,1/N.height]},v.style.map.terrain&&v.style.map.terrain.getTerrainData(we),u.id,Ce.layoutVertexBuffer,Ce.indexBuffer,Ce.segments,null,v.transform.zoom,null,null,Ce.collisionVertexBuffer)}var N;if(!m||!C.length)return;const X=v.useProgram("collisionCircle"),ee=new c.aR;ee.resize(4*R),ee._trim();let re=0;for(const me of C)for(let we=0;we=0&&(me[ae.associatedIconIndex]={shiftedAnchor:Gt,angle:Hr})}else Ot(ae.numGlyphs,ce)}if(R){pe.clear();const we=v.icon.placedSymbolArray;for(let ae=0;aev.style.map.terrain.getElevation(dt,ll,ul):null,ca=u.layout.get("text-rotation-alignment")==="map";te(Pt,dt.posMatrix,v,m,ol,al,me,R,ca,ce,dt.toUnwrapped(),re.width,re.height,es,cr)}const ts=dt.posMatrix,rs=m&&st||Bd,Ao=we||rs?eu:ol,ws=Ac,Nn=_t&&u.paint.get(m?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let qn;qn=_t?Pt.iconsInText?td(Gt.kind,ar,ae,me,we,rs,v,ts,Ao,ws,es,Gn,ii,wt):Kl(Gt.kind,ar,ae,me,we,rs,v,ts,Ao,ws,es,m,Gn,!0,wt):Lp(Gt.kind,ar,ae,me,we,rs,v,ts,Ao,ws,es,m,Gn,wt);const Li={program:tr,buffers:qt,uniformValues:qn,atlasTexture:xs,atlasTextureIcon:Zn,atlasInterpolation:Gr,atlasInterpolationIcon:_i,isSDF:_t,hasHalo:Nn};if(Pe&&Pt.canOverlap){ze=!0;const cr=qt.segments.get();for(const ca of cr)gt.push({segments:new c.a0([ca]),sortKey:ca.sortKey,state:Li,terrainData:Wr})}else gt.push({segments:qt.segments,sortKey:0,state:Li,terrainData:Wr})}ze&>.sort((dt,ct)=>dt.sortKey-ct.sortKey);for(const dt of gt){const ct=dt.state;if(X.activeTexture.set(ee.TEXTURE0),ct.atlasTexture.bind(ct.atlasInterpolation,ee.CLAMP_TO_EDGE),ct.atlasTextureIcon&&(X.activeTexture.set(ee.TEXTURE1),ct.atlasTextureIcon&&ct.atlasTextureIcon.bind(ct.atlasInterpolationIcon,ee.CLAMP_TO_EDGE)),ct.isSDF){const Pt=ct.uniformValues;ct.hasHalo&&(Pt.u_is_halo=1,pd(ct.buffers,dt.segments,u,v,ct.program,Xe,B,N,Pt,dt.terrainData)),Pt.u_is_halo=0}pd(ct.buffers,dt.segments,u,v,ct.program,Xe,B,N,ct.uniformValues,dt.terrainData)}}function pd(v,r,u,p,m,_,S,E,C,R){const B=p.context;m.draw(B,B.gl.TRIANGLES,_,S,E,Rr.disabled,C,R,u.id,v.layoutVertexBuffer,v.indexBuffer,r,u.paint,p.transform.zoom,v.programConfigurations.get(u.id),v.dynamicLayoutVertexBuffer,v.opacityVertexBuffer)}function md(v,r,u,p){const m=v.context,_=m.gl,S=Nr.disabled,E=new fn([_.ONE,_.ONE],c.aM.transparent,[!0,!0,!0,!0]),C=r.getBucket(u);if(!C)return;const R=p.key;let B=u.heatmapFbos.get(R);B||(B=tu(m,r.tileSize,r.tileSize),u.heatmapFbos.set(R,B)),m.bindFramebuffer.set(B.framebuffer),m.viewport.set([0,0,r.tileSize,r.tileSize]),m.clear({color:c.aM.transparent});const N=C.programConfigurations.get(u.id),X=v.useProgram("heatmap",N),ee=v.style.map.terrain.getTerrainData(p);X.draw(m,_.TRIANGLES,ir.disabled,S,E,Rr.disabled,yi(p.posMatrix,r,v.transform.zoom,u.paint.get("heatmap-intensity")),ee,u.id,C.layoutVertexBuffer,C.indexBuffer,C.segments,u.paint,v.transform.zoom,N)}function oa(v,r,u){const p=v.context,m=p.gl;p.setColorMode(v.colorModeForRenderPass());const _=ru(p,r),S=u.key,E=r.heatmapFbos.get(S);E&&(p.activeTexture.set(m.TEXTURE0),m.bindTexture(m.TEXTURE_2D,E.colorAttachment.get()),p.activeTexture.set(m.TEXTURE1),_.bind(m.LINEAR,m.CLAMP_TO_EDGE),v.useProgram("heatmapTexture").draw(p,m.TRIANGLES,ir.disabled,Nr.disabled,v.colorModeForRenderPass(),Rr.disabled,ic(v,r,0,1),null,r.id,v.rasterBoundsBuffer,v.quadTriangleIndexBuffer,v.rasterBoundsSegments,r.paint,v.transform.zoom),E.destroy(),r.heatmapFbos.delete(S))}function tu(v,r,u){var p,m;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 E=(p=v.HALF_FLOAT)!==null&&p!==void 0?p:_.UNSIGNED_BYTE,C=(m=v.RGBA16F)!==null&&m!==void 0?m:_.RGBA;_.texImage2D(_.TEXTURE_2D,0,C,r,u,0,_.RGBA,E,null);const R=v.createFramebuffer(r,u,!1,!1);return R.colorAttachment.set(S),R}function ru(v,r){return r.colorRampTexture||(r.colorRampTexture=new it(v,r.colorRamp,v.gl.RGBA)),r.colorRampTexture}function Wa(v,r,u,p,m){if(!u||!p||!p.imageAtlas)return;const _=p.imageAtlas.patternPositions;let S=_[u.to.toString()],E=_[u.from.toString()];if(!S&&E&&(S=E),!E&&S&&(E=S),!S||!E){const C=m.getPaintProperty(r);S=_[C],E=_[C]}S&&E&&v.setConstantPatternPositions(S,E)}function nu(v,r,u,p,m,_,S){const E=v.context.gl,C="fill-pattern",R=u.paint.get(C),B=R&&R.constantOr(1),N=u.getCrossfadeParameters();let X,ee,re,ce,pe;S?(ee=B&&!u.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",X=E.LINES):(ee=B?"fillPattern":"fill",X=E.TRIANGLES);const me=R.constantOr(null);for(const we of p){const ae=r.getTile(we);if(B&&!ae.patternsLoaded())continue;const Ce=ae.getBucket(u);if(!Ce)continue;const Pe=Ce.programConfigurations.get(u.id),ze=v.useProgram(ee,Pe),Xe=v.style.map.terrain&&v.style.map.terrain.getTerrainData(we);B&&(v.context.activeTexture.set(E.TEXTURE0),ae.imageAtlasTexture.bind(E.LINEAR,E.CLAMP_TO_EDGE),Pe.updatePaintBuffers(N)),Wa(Pe,C,me,ae,u);const st=Xe?we:null,gt=v.translatePosMatrix(st?st.posMatrix:we.posMatrix,ae,u.paint.get("fill-translate"),u.paint.get("fill-translate-anchor"));if(S){ce=Ce.indexBuffer2,pe=Ce.segments2;const wt=[E.drawingBufferWidth,E.drawingBufferHeight];re=ee==="fillOutlinePattern"&&B?Ap(gt,v,N,ae,wt):A_(gt,wt)}else ce=Ce.indexBuffer,pe=Ce.segments,re=B?Mp(gt,v,N,ae):ja(gt);ze.draw(v.context,X,m,v.stencilModeForClipping(we),_,Rr.disabled,re,Xe,u.id,Ce.layoutVertexBuffer,ce,pe,u.paint,v.transform.zoom,Pe)}}function fc(v,r,u,p,m,_,S){const E=v.context,C=E.gl,R="fill-extrusion-pattern",B=u.paint.get(R),N=B.constantOr(1),X=u.getCrossfadeParameters(),ee=u.paint.get("fill-extrusion-opacity"),re=B.constantOr(null);for(const ce of p){const pe=r.getTile(ce),me=pe.getBucket(u);if(!me)continue;const we=v.style.map.terrain&&v.style.map.terrain.getTerrainData(ce),ae=me.programConfigurations.get(u.id),Ce=v.useProgram(N?"fillExtrusionPattern":"fillExtrusion",ae);N&&(v.context.activeTexture.set(C.TEXTURE0),pe.imageAtlasTexture.bind(C.LINEAR,C.CLAMP_TO_EDGE),ae.updatePaintBuffers(X)),Wa(ae,R,re,pe,u);const Pe=v.translatePosMatrix(ce.posMatrix,pe,u.paint.get("fill-extrusion-translate"),u.paint.get("fill-extrusion-translate-anchor")),ze=u.paint.get("fill-extrusion-vertical-gradient"),Xe=N?nc(Pe,v,ze,ee,ce,X,pe):Yl(Pe,v,ze,ee);Ce.draw(E,E.gl.TRIANGLES,m,_,S,Rr.backCCW,Xe,we,u.id,me.layoutVertexBuffer,me.indexBuffer,me.segments,u.paint,v.transform.zoom,ae,v.style.map.terrain&&me.centroidVertexBuffer)}}function Ga(v,r,u,p,m,_,S){const E=v.context,C=E.gl,R=u.fbo;if(!R)return;const B=v.useProgram("hillshade"),N=v.style.map.terrain&&v.style.map.terrain.getTerrainData(r);E.activeTexture.set(C.TEXTURE0),C.bindTexture(C.TEXTURE_2D,R.colorAttachment.get()),B.draw(E,C.TRIANGLES,m,_,S,Rr.disabled,((X,ee,re,ce)=>{const pe=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-=X.transform.angle);const Ce=!X.options.moving;return{u_matrix:ce?ce.posMatrix:X.transform.calculatePosMatrix(ee.tileID.toUnwrapped(),Ce),u_image:0,u_latrange:sc(0,ee.tileID),u_light:[re.paint.get("hillshade-exaggeration"),ae],u_shadow:pe,u_highlight:me,u_accent:we}})(v,u,p,N?r:null),N,p.id,v.rasterBoundsBuffer,v.quadTriangleIndexBuffer,v.rasterBoundsSegments)}function Za(v,r,u,p,m,_){const S=v.context,E=S.gl,C=r.dem;if(C&&C.data){const R=C.dim,B=C.stride,N=C.getPixels();if(S.activeTexture.set(E.TEXTURE1),S.pixelStoreUnpackPremultiplyAlpha.set(!1),r.demTexture=r.demTexture||v.getTileTexture(B),r.demTexture){const ee=r.demTexture;ee.update(N,{premultiply:!1}),ee.bind(E.NEAREST,E.CLAMP_TO_EDGE)}else r.demTexture=new it(S,N,E.RGBA,{premultiply:!1}),r.demTexture.bind(E.NEAREST,E.CLAMP_TO_EDGE);S.activeTexture.set(E.TEXTURE0);let X=r.fbo;if(!X){const ee=new it(S,{width:R,height:R,data:null},E.RGBA);ee.bind(E.LINEAR,E.CLAMP_TO_EDGE),X=r.fbo=S.createFramebuffer(R,R,!0,!1),X.colorAttachment.set(ee.texture)}S.bindFramebuffer.set(X.framebuffer),S.viewport.set([0,0,R,R]),v.useProgram("hillshadePrepare").draw(S,E.TRIANGLES,p,m,_,Rr.disabled,((ee,re)=>{const ce=re.stride,pe=c.H();return c.aP(pe,0,c.X,-c.X,0,0,1),c.J(pe,pe,[0,-c.X,0]),{u_matrix:pe,u_image:1,u_dimension:[ce,ce],u_zoom:ee.overscaledZ,u_unpack:re.getUnpackVector()}})(r.tileID,C),null,u.id,v.rasterBoundsBuffer,v.quadTriangleIndexBuffer,v.rasterBoundsSegments),r.needsHillshadePrepare=!1}}function qp(v,r,u,p,m,_){const S=p.paint.get("raster-fade-duration");if(!_&&S>0){const E=A.now(),C=(E-v.timeAdded)/S,R=r?(E-r.timeAdded)/S:-1,B=u.getSource(),N=m.coveringZoomLevel({tileSize:B.tileSize,roundZoom:B.roundZoom}),X=!r||Math.abs(r.tileID.overscaledZ-N)>Math.abs(v.tileID.overscaledZ-N),ee=X&&v.refreshedUponExpiration?1:c.ac(X?C:1-R,0,1);return v.refreshedUponExpiration&&C>=1&&(v.refreshedUponExpiration=!1),r?{opacity:1,mix:1-ee}:{opacity:ee,mix:0}}return{opacity:1,mix:0}}const gd=new c.aM(1,0,0,1),vr=new c.aM(0,1,0,1),pc=new c.aM(0,0,1,1),G_=new c.aM(1,0,1,1),Yp=new c.aM(0,1,1,1);function qa(v,r,u,p){mc(v,0,r+u/2,v.transform.width,u,p)}function Xp(v,r,u,p){mc(v,r-u/2,0,u,v.transform.height,p)}function mc(v,r,u,p,m,_){const S=v.context,E=S.gl;E.enable(E.SCISSOR_TEST),E.scissor(r*v.pixelRatio,u*v.pixelRatio,p*v.pixelRatio,m*v.pixelRatio),S.clear({color:_}),E.disable(E.SCISSOR_TEST)}function Kp(v,r,u){const p=v.context,m=p.gl,_=u.posMatrix,S=v.useProgram("debug"),E=ir.disabled,C=Nr.disabled,R=v.colorModeForRenderPass(),B="$debug",N=v.style.map.terrain&&v.style.map.terrain.getTerrainData(u);p.activeTexture.set(m.TEXTURE0);const X=r.getTileByID(u.key).latestRawTileData,ee=Math.floor((X&&X.byteLength||0)/1024),re=r.getTile(u).tileSize,ce=512/Math.min(re,512)*(u.overscaledZ/v.transform.zoom)*.5;let pe=u.canonical.toString();u.overscaledZ!==u.canonical.z&&(pe+=` => ${u.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,`${pe} ${ee}kB`),S.draw(p,m.TRIANGLES,E,C,fn.alphaBlended,Rr.disabled,Xl(_,c.aM.transparent,ce),null,B,v.debugBuffer,v.quadTriangleIndexBuffer,v.debugSegments),S.draw(p,m.LINE_STRIP,E,C,R,Rr.disabled,Xl(_,c.aM.red),N,B,v.debugBuffer,v.tileBorderIndexBuffer,v.debugSegments)}function Jp(v,r,u){const p=v.context,m=p.gl,_=v.colorModeForRenderPass(),S=new ir(m.LEQUAL,ir.ReadWrite,v.depthRangeFor3D),E=v.useProgram("terrain"),C=r.getTerrainMesh();p.bindFramebuffer.set(null),p.viewport.set([0,0,v.width,v.height]);for(const R of u){const B=v.renderToTexture.getTexture(R),N=r.getTerrainData(R.tileID);p.activeTexture.set(m.TEXTURE0),m.bindTexture(m.TEXTURE_2D,B.texture);const X=v.transform.calculatePosMatrix(R.tileID.toUnwrapped()),ee=r.getMeshFrameDelta(v.transform.zoom),re=v.transform.calculateFogMatrix(R.tileID.toUnwrapped()),ce=Qh(X,ee,re,v.style.sky,v.transform.pitch);E.draw(p,m.TRIANGLES,S,Nr.disabled,_,Rr.backCCW,ce,N,"terrain",C.vertexBuffer,C.indexBuffer,C.segments)}}class gc{constructor(r,u,p){this.vertexBuffer=r,this.indexBuffer=u,this.segments=p}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}class yc{constructor(r,u){this.context=new W_(r),this.transform=u,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:c.an(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=jt.maxUnderzooming+jt.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Kh}resize(r,u,p){if(this.width=Math.floor(r*p),this.height=Math.floor(u*p),this.pixelRatio=p,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const m of this.style._order)this.style._layers[m].resize()}setup(){const r=this.context,u=new c.aX;u.emplaceBack(0,0),u.emplaceBack(c.X,0),u.emplaceBack(0,c.X),u.emplaceBack(c.X,c.X),this.tileExtentBuffer=r.createVertexBuffer(u,Qo.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,Qo.members),this.debugSegments=c.a0.simpleSegment(0,0,4,5);const m=new c.$;m.emplaceBack(0,0,0,0),m.emplaceBack(c.X,0,c.X,0),m.emplaceBack(0,c.X,0,c.X),m.emplaceBack(c.X,c.X,c.X,c.X),this.rasterBoundsBuffer=r.createVertexBuffer(m,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(_,Qo.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 E=new c.aY;E.emplaceBack(0,1,2),E.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=r.createIndexBuffer(E);const C=this.context.gl;this.stencilClearMode=new Nr({func:C.ALWAYS,mask:0},0,255,C.ZERO,C.ZERO,C.ZERO)}clearStencil(){const r=this.context,u=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,[u.drawingBufferWidth,u.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(r,u.TRIANGLES,ir.disabled,this.stencilClearMode,fn.disabled,Rr.disabled,gi(p),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(r,u){if(this.currentStencilSource===r.source||!r.isTileClipped()||!u||!u.length)return;this.currentStencilSource=r.source;const p=this.context,m=p.gl;this.nextStencilID+u.length>256&&this.clearStencil(),p.setColorMode(fn.disabled),p.setDepthMode(ir.disabled);const _=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const S of u){const E=this._tileClippingMaskIDs[S.key]=this.nextStencilID++,C=this.style.map.terrain&&this.style.map.terrain.getTerrainData(S);_.draw(p,m.TRIANGLES,ir.disabled,new Nr({func:m.ALWAYS,mask:0},E,255,m.KEEP,m.KEEP,m.REPLACE),fn.disabled,Rr.disabled,gi(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++,u=this.context.gl;return new Nr({func:u.NOTEQUAL,mask:255},r,255,u.KEEP,u.KEEP,u.REPLACE)}stencilModeForClipping(r){const u=this.context.gl;return new Nr({func:u.EQUAL,mask:255},this._tileClippingMaskIDs[r.key],0,u.KEEP,u.KEEP,u.REPLACE)}stencilConfigForOverlap(r){const u=this.context.gl,p=r.sort((S,E)=>E.overscaledZ-S.overscaledZ),m=p[p.length-1].overscaledZ,_=p[0].overscaledZ-m+1;if(_>1){this.currentStencilSource=void 0,this.nextStencilID+_>256&&this.clearStencil();const S={};for(let E=0;E<_;E++)S[E+m]=new Nr({func:u.GEQUAL,mask:255},E+this.nextStencilID,255,u.KEEP,u.KEEP,u.REPLACE);return this.nextStencilID+=_,[S,p]}return[{[m]:Nr.disabled},p]}colorModeForRenderPass(){const r=this.context.gl;return this._showOverdrawInspector?new fn([r.CONSTANT_COLOR,r.ONE],new c.aM(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?fn.unblended:fn.alphaBlended}depthModeForSublayer(r,u,p){if(!this.opaquePassEnabledForLayer())return ir.disabled;const m=1-((1+this.currentLayer)*this.numSublayers+r)*this.depthEpsilon;return new ir(p||this.context.gl.LEQUAL,u,[m,m])}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}))(R,C.style.map.transform,C.pixelRatio),ee=new ir(N.LEQUAL,ir.ReadWrite,[0,1]),re=Nr.disabled,ce=C.colorModeForRenderPass(),pe=C.useProgram("sky");if(!R.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),R.mesh=new gc(B.createVertexBuffer(me,Qo.members),B.createIndexBuffer(we),c.a0.simpleSegment(0,0,me.length,we.length))}pe.draw(B,N.TRIANGLES,ee,re,ce,Rr.disabled,X,void 0,"sky",R.mesh.vertexBuffer,R.mesh.indexBuffer,R.mesh.segments)}(this,this.style.sky),this._showOverdrawInspector=u.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]],R=m[C.source],B=_[C.source];this._renderTileClippingMasks(C,B),this.renderLayer(this,R,C,B)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayerpe.source&&!pe.isHidden(B)?[R.sourceCaches[pe.source]]:[]),ee=X.filter(pe=>pe.getSource().type==="vector"),re=X.filter(pe=>pe.getSource().type!=="vector"),ce=pe=>{(!N||N.getSource().maxzoomce(pe)),N||re.forEach(pe=>ce(pe)),N}(this.style,this.transform.zoom);C&&function(R,B,N){for(let X=0;X0),m&&(c.b0(u,p),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(_,S){const E=_.context,C=E.gl,R=fn.unblended,B=new ir(C.LEQUAL,ir.ReadWrite,[0,1]),N=S.getTerrainMesh(),X=S.sourceCache.getRenderableTiles(),ee=_.useProgram("terrainDepth");E.bindFramebuffer.set(S.getFramebuffer("depth").framebuffer),E.viewport.set([0,0,_.width/devicePixelRatio,_.height/devicePixelRatio]),E.clear({color:c.aM.transparent,depth:1});for(const re of X){const ce=S.getTerrainData(re.tileID),pe={u_matrix:_.transform.calculatePosMatrix(re.tileID.toUnwrapped()),u_ele_delta:S.getMeshFrameDelta(_.transform.zoom)};ee.draw(E,C.TRIANGLES,B,Nr.disabled,R,Rr.backCCW,pe,ce,"terrain",N.vertexBuffer,N.indexBuffer,N.segments)}E.bindFramebuffer.set(null),E.viewport.set([0,0,_.width,_.height])}(this,this.style.map.terrain),function(_,S){const E=_.context,C=E.gl,R=fn.unblended,B=new ir(C.LEQUAL,ir.ReadWrite,[0,1]),N=S.getTerrainMesh(),X=S.getCoordsTexture(),ee=S.sourceCache.getRenderableTiles(),re=_.useProgram("terrainCoords");E.bindFramebuffer.set(S.getFramebuffer("coords").framebuffer),E.viewport.set([0,0,_.width/devicePixelRatio,_.height/devicePixelRatio]),E.clear({color:c.aM.transparent,depth:1}),S.coordsIndex=[];for(const ce of ee){const pe=S.getTerrainData(ce.tileID);E.activeTexture.set(C.TEXTURE0),C.bindTexture(C.TEXTURE_2D,X.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(E,C.TRIANGLES,B,Nr.disabled,R,Rr.backCCW,me,pe,"terrain",N.vertexBuffer,N.indexBuffer,N.segments),S.coordsIndex.push(ce.tileID.key)}E.bindFramebuffer.set(null),E.viewport.set([0,0,_.width,_.height])}(this,this.style.map.terrain))}renderLayer(r,u,p,m){if(!p.isHidden(this.transform.zoom)&&(p.type==="background"||p.type==="custom"||(m||[]).length))switch(this.id=p.id,p.type){case"symbol":(function(_,S,E,C,R){if(_.renderPass!=="translucent")return;const B=Nr.disabled,N=_.colorModeForRenderPass();(E._unevaluatedLayout.hasValue("text-variable-anchor")||E._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(X,ee,re,ce,pe,me,we,ae,Ce){const Pe=ee.transform,ze=Jo(),Xe=pe==="map",st=me==="map";for(const gt of X){const wt=ce.getTile(gt),dt=wt.getBucket(re);if(!dt||!dt.text||!dt.text.segments.get().length)continue;const ct=c.ag(dt.textSizeData,Pe.zoom),Pt=or(wt,1,ee.transform.zoom),qt=ps(gt.posMatrix,st,Xe,ee.transform,Pt),ft=re.layout.get("icon-text-fit")!=="none"&&dt.hasIconData();if(ct){const _t=Math.pow(2,Pe.zoom-wt.tileID.overscaledZ),Gt=ee.style.map.terrain?(tr,ar)=>ee.style.map.terrain.getElevation(gt,tr,ar):null,Hr=ze.translatePosition(Pe,wt,we,ae);Ha(dt,Xe,st,Ce,Pe,qt,gt.posMatrix,_t,ct,ft,ze,Hr,gt.toUnwrapped(),Gt)}}}(C,_,E,S,E.layout.get("text-rotation-alignment"),E.layout.get("text-pitch-alignment"),E.paint.get("text-translate"),E.paint.get("text-translate-anchor"),R),E.paint.get("icon-opacity").constantOr(1)!==0&&fd(_,S,E,C,!1,E.paint.get("icon-translate"),E.paint.get("icon-translate-anchor"),E.layout.get("icon-rotation-alignment"),E.layout.get("icon-pitch-alignment"),E.layout.get("icon-keep-upright"),B,N),E.paint.get("text-opacity").constantOr(1)!==0&&fd(_,S,E,C,!0,E.paint.get("text-translate"),E.paint.get("text-translate-anchor"),E.layout.get("text-rotation-alignment"),E.layout.get("text-pitch-alignment"),E.layout.get("text-keep-upright"),B,N),S.map.showCollisionBoxes&&(Ql(_,S,E,C,!0),Ql(_,S,E,C,!1))})(r,u,p,m,this.style.placement.variableOffsets);break;case"circle":(function(_,S,E,C){if(_.renderPass!=="translucent")return;const R=E.paint.get("circle-opacity"),B=E.paint.get("circle-stroke-width"),N=E.paint.get("circle-stroke-opacity"),X=!E.layout.get("circle-sort-key").isConstant();if(R.constantOr(1)===0&&(B.constantOr(1)===0||N.constantOr(1)===0))return;const ee=_.context,re=ee.gl,ce=_.depthModeForSublayer(0,ir.ReadOnly),pe=Nr.disabled,me=_.colorModeForRenderPass(),we=[];for(let ae=0;aeae.sortKey-Ce.sortKey);for(const ae of we){const{programConfiguration:Ce,program:Pe,layoutVertexBuffer:ze,indexBuffer:Xe,uniformValues:st,terrainData:gt}=ae.state;Pe.draw(ee,re.TRIANGLES,ce,pe,me,Rr.disabled,st,gt,E.id,ze,Xe,ae.segments,E.paint,_.transform.zoom,Ce)}})(r,u,p,m);break;case"heatmap":(function(_,S,E,C){if(E.paint.get("heatmap-opacity")===0)return;const R=_.context;if(_.style.map.terrain){for(const B of C){const N=S.getTile(B);S.hasRenderableParent(B)||(_.renderPass==="offscreen"?md(_,N,E,B):_.renderPass==="translucent"&&oa(_,E,B))}R.viewport.set([0,0,_.width,_.height])}else _.renderPass==="offscreen"?function(B,N,X,ee){const re=B.context,ce=re.gl,pe=Nr.disabled,me=new fn([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 ze=Ce.heatmapFbos.get(c.aU);ze?(Pe.bindTexture(Pe.TEXTURE_2D,ze.colorAttachment.get()),we.bindFramebuffer.set(ze.framebuffer)):(ze=tu(we,ae.width/4,ae.height/4),Ce.heatmapFbos.set(c.aU,ze))})(re,B,X),re.clear({color:c.aM.transparent});for(let we=0;we20&&B.texParameterf(B.TEXTURE_2D,R.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,R.extTextureFilterAnisotropicMax);const dt=_.style.map.terrain&&_.style.map.terrain.getTerrainData(we),ct=dt?we:null,Pt=ct?ct.posMatrix:_.transform.calculatePosMatrix(we.toUnwrapped(),me),qt=R_(Pt,gt||[0,0],st||1,Xe,E);N instanceof ot?X.draw(R,B.TRIANGLES,ae,Nr.disabled,ee,Rr.disabled,qt,dt,E.id,N.boundsBuffer,_.quadTriangleIndexBuffer,N.boundsSegments):X.draw(R,B.TRIANGLES,ae,re[we.overscaledZ],ee,Rr.disabled,qt,dt,E.id,_.rasterBoundsBuffer,_.quadTriangleIndexBuffer,_.rasterBoundsSegments)}})(r,u,p,m);break;case"background":(function(_,S,E,C){const R=E.paint.get("background-color"),B=E.paint.get("background-opacity");if(B===0)return;const N=_.context,X=N.gl,ee=_.transform,re=ee.tileSize,ce=E.paint.get("background-pattern");if(_.isPatternMissing(ce))return;const pe=!ce&&R.a===1&&B===1&&_.opaquePassEnabledForLayer()?"opaque":"translucent";if(_.renderPass!==pe)return;const me=Nr.disabled,we=_.depthModeForSublayer(0,pe==="opaque"?ir.ReadWrite:ir.ReadOnly),ae=_.colorModeForRenderPass(),Ce=_.useProgram(ce?"backgroundPattern":"background"),Pe=C||ee.coveringTiles({tileSize:re,terrain:_.style.map.terrain});ce&&(N.activeTexture.set(X.TEXTURE0),_.imageManager.bind(_.context));const ze=E.getCrossfadeParameters();for(const Xe of Pe){const st=C?Xe.posMatrix:_.transform.calculatePosMatrix(Xe.toUnwrapped()),gt=ce?rd(st,B,_,ce,{tileID:Xe,tileSize:re},ze):ac(st,B,R),wt=_.style.map.terrain&&_.style.map.terrain.getTerrainData(Xe);Ce.draw(N,X.TRIANGLES,we,me,ae,Rr.disabled,gt,wt,E.id,_.tileExtentBuffer,_.quadTriangleIndexBuffer,_.tileExtentSegments)}})(r,0,p,m);break;case"custom":(function(_,S,E){const C=_.context,R=E.implementation;if(_.renderPass==="offscreen"){const B=R.prerender;B&&(_.setCustomLayerDefaults(),C.setColorMode(_.colorModeForRenderPass()),B.call(R,C.gl,_.transform.customLayerMatrix()),C.setDirty(),_.setBaseState())}else if(_.renderPass==="translucent"){_.setCustomLayerDefaults(),C.setColorMode(_.colorModeForRenderPass()),C.setStencilMode(Nr.disabled);const B=R.renderingMode==="3d"?new ir(_.context.gl.LEQUAL,ir.ReadWrite,_.depthRangeFor3D):_.depthModeForSublayer(0,ir.ReadOnly);C.setDepthMode(B),R.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,u,p,m,_){if(!p[0]&&!p[1])return r;const S=_?m==="map"?this.transform.angle:0:m==="viewport"?-this.transform.angle:0;if(S){const R=Math.sin(S),B=Math.cos(S);p=[p[0]*B-p[1]*R,p[0]*R+p[1]*B]}const E=[_?p[0]:or(u,p[0],this.transform.zoom),_?p[1]:or(u,p[1],this.transform.zoom),0],C=new Float32Array(16);return c.J(C,r,E),C}saveTileTexture(r){const u=this._tileTextures[r.size[0]];u?u.push(r):this._tileTextures[r.size[0]]=[r]}getTileTexture(r){const u=this._tileTextures[r];return u&&u.length>0?u.pop():null}isPatternMissing(r){if(!r)return!1;if(!r.from||!r.to)return!0;const u=this.imageManager.getPattern(r.from.toString()),p=this.imageManager.getPattern(r.to.toString());return!u||!p}useProgram(r,u){this.cache=this.cache||{};const p=r+(u?u.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[p]||(this.cache[p]=new ed(this.context,Po[r],u,nd[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:u}=this.context.gl;return this.width!==r||this.height!==u}}class Ya{constructor(r,u){this.points=r,this.planes=u}static fromInvProjectionMatrix(r,u,p){const m=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(E=>{const C=1/(E=c.af([],E,r))[3]/u*m;return c.b1(E,E,[C,C,1/E[3],C])}),S=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(E=>{const C=function(X,ee){var re=ee[0],ce=ee[1],pe=ee[2],me=re*re+ce*ce+pe*pe;return me>0&&(me=1/Math.sqrt(me)),X[0]=ee[0]*me,X[1]=ee[1]*me,X[2]=ee[2]*me,X}([],function(X,ee,re){var ce=ee[0],pe=ee[1],me=ee[2],we=re[0],ae=re[1],Ce=re[2];return X[0]=pe*Ce-me*ae,X[1]=me*we-ce*Ce,X[2]=ce*ae-pe*we,X}([],ge([],_[E[0]],_[E[1]]),ge([],_[E[2]],_[E[1]]))),R=-((B=C)[0]*(N=_[E[1]])[0]+B[1]*N[1]+B[2]*N[2]);var B,N;return C.concat(R)});return new Ya(_,S)}}class Xa{constructor(r,u){this.min=r,this.max=u,this.center=function(p,m,_){return p[0]=.5*m[0],p[1]=.5*m[1],p[2]=.5*m[2],p}([],function(p,m,_){return p[0]=m[0]+_[0],p[1]=m[1]+_[1],p[2]=m[2]+_[2],p}([],this.min,this.max))}quadrant(r){const u=[r%2==0,r<2],p=oe(this.min),m=oe(this.max);for(let _=0;_=0&&S++;if(S===0)return 0;S!==u.length&&(p=!1)}if(p)return 2;for(let m=0;m<3;m++){let _=Number.MAX_VALUE,S=-Number.MAX_VALUE;for(let E=0;Ethis.max[m]-this.min[m])return 0}return 1}}class Ka{constructor(r=0,u=0,p=0,m=0){if(isNaN(r)||r<0||isNaN(u)||u<0||isNaN(p)||p<0||isNaN(m)||m<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=r,this.bottom=u,this.left=p,this.right=m}interpolate(r,u,p){return u.top!=null&&r.top!=null&&(this.top=c.y.number(r.top,u.top,p)),u.bottom!=null&&r.bottom!=null&&(this.bottom=c.y.number(r.bottom,u.bottom,p)),u.left!=null&&r.left!=null&&(this.left=c.y.number(r.left,u.left,p)),u.right!=null&&r.right!=null&&(this.right=c.y.number(r.right,u.right,p)),this}getCenter(r,u){const p=c.ac((this.left+r-this.right)/2,0,r),m=c.ac((this.top+u-this.bottom)/2,0,u);return new c.P(p,m)}equals(r){return this.top===r.top&&this.bottom===r.bottom&&this.left===r.left&&this.right===r.right}clone(){return new Ka(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const yd=85.051129;class Ja{constructor(r,u,p,m,_){this.tileSize=512,this._renderWorldCopies=_===void 0||!!_,this._minZoom=r||0,this._maxZoom=u||22,this._minPitch=p??0,this._maxPitch=m??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 Ka,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={},this.minElevationForCurrentTile=0}clone(){const r=new Ja(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 u=-c.b3(r,-180,180)*Math.PI/180;this.angle!==u&&(this._unmodified=!1,this.angle=u,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,m,_){var S=m[0],E=m[1],C=m[2],R=m[3],B=Math.sin(_),N=Math.cos(_);p[0]=S*N+C*B,p[1]=E*N+R*B,p[2]=S*-B+C*N,p[3]=E*-B+R*N}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(r){const u=c.ac(r,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==u&&(this._unmodified=!1,this._pitch=u,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 u=Math.min(Math.max(r,this.minZoom),this.maxZoom);this._zoom!==u&&(this._unmodified=!1,this._zoom=u,this.tileZoom=Math.max(0,Math.floor(u)),this.scale=this.zoomScale(u),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,u,p){this._unmodified=!1,this._edgeInsets.interpolate(r,u,p),this._constrain(),this._calcMatrices()}coveringZoomLevel(r){const u=(r.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/r.tileSize));return Math.max(0,u)}getVisibleUnwrappedCoordinates(r){const u=[new c.b4(0,r)];if(this._renderWorldCopies){const p=this.pointCoordinate(new c.P(0,0)),m=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)),E=Math.floor(Math.min(p.x,m.x,_.x,S.x)),C=Math.floor(Math.max(p.x,m.x,_.x,S.x)),R=1;for(let B=E-R;B<=C+R;B++)B!==0&&u.push(new c.b4(B,r))}return u}coveringTiles(r){var u,p;let m=this.coveringZoomLevel(r);const _=m;if(r.minzoom!==void 0&&mr.maxzoom&&(m=r.maxzoom);const S=this.pointCoordinate(this.getCameraPoint()),E=c.Z.fromLngLat(this.center),C=Math.pow(2,m),R=[C*S.x,C*S.y,0],B=[C*E.x,C*E.y,0],N=Ya.fromInvProjectionMatrix(this.invModelViewProjectionMatrix,this.worldSize,m);let X=r.minzoom||0;!r.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(X=m);const ee=r.terrain?2/Math.min(this.tileSize,r.tileSize)*this.tileSize:3,re=ae=>({aabb:new Xa([ae*C,0,0],[(ae+1)*C,C,0]),zoom:0,x:0,y:0,wrap:ae,fullyVisible:!1}),ce=[],pe=[],me=m,we=r.reparseOverscaled?_:m;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 ze=ae.fullyVisible;if(!ze){const dt=ae.aabb.intersects(N);if(dt===0)continue;ze=dt===2}const Xe=r.terrain?R:B,st=ae.aabb.distanceX(Xe),gt=ae.aabb.distanceY(Xe),wt=Math.max(Math.abs(st),Math.abs(gt));if(ae.zoom===me||wt>ee+(1<=X){const dt=me-ae.zoom,ct=R[0]-.5-(Ce<>1),qt=ae.zoom+1;let ft=ae.aabb.quadrant(dt);if(r.terrain){const _t=new c.S(qt,ae.wrap,qt,ct,Pt),Gt=r.terrain.getMinMaxElevation(_t),Hr=(u=Gt.minElevation)!==null&&u!==void 0?u:this.elevation,tr=(p=Gt.maxElevation)!==null&&p!==void 0?p:this.elevation;ft=new Xa([ft.min[0],ft.min[1],Hr],[ft.max[0],ft.max[1],tr])}ce.push({aabb:ft,zoom:qt,x:ct,y:Pt,wrap:ae.wrap,fullyVisible:ze})}}return pe.sort((ae,Ce)=>ae.distanceSq-Ce.distanceSq).map(ae=>ae.tileID)}resize(r,u){this.width=r,this.height=u,this.pixelsToGLUnits=[2/r,-2/u],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 u=c.ac(r.lat,-85.051129,yd);return new c.P(c.O(r.lng)*this.worldSize,c.Q(u)*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 u=this.elevation,p=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,m=this.pointLocation(this.centerPoint,r),_=r.getElevationForLngLatZoom(m,this.tileZoom);if(!(this.elevation-_))return;const S=p+u-_,E=Math.cos(this._pitch)*this.cameraToCenterDistance/S/c.b5(1,m.lat),C=this.scaleZoom(E/this.tileSize);this._elevation=_,this._center=m,this.zoom=C}setLocationAtPoint(r,u){const p=this.pointCoordinate(u),m=this.pointCoordinate(this.centerPoint),_=this.locationCoordinate(r),S=new c.Z(_.x-(p.x-m.x),_.y-(p.y-m.y));this.center=this.coordinateLocation(S),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(r,u){return u?this.coordinatePoint(this.locationCoordinate(r),u.getElevationForLngLatZoom(r,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(r))}pointLocation(r,u){return this.coordinateLocation(this.pointCoordinate(r,u))}locationCoordinate(r){return c.Z.fromLngLat(r)}coordinateLocation(r){return r&&r.toLngLat()}pointCoordinate(r,u){if(u){const X=u.pointCoordinate(r);if(X!=null)return X}const p=[r.x,r.y,0,1],m=[r.x,r.y,1,1];c.af(p,p,this.pixelMatrixInverse),c.af(m,m,this.pixelMatrixInverse);const _=p[3],S=m[3],E=p[1]/_,C=m[1]/S,R=p[2]/_,B=m[2]/S,N=R===B?0:(0-R)/(B-R);return new c.Z(c.y.number(p[0]/_,m[0]/S,N)/this.worldSize,c.y.number(E,C,N)/this.worldSize)}coordinatePoint(r,u=0,p=this.pixelMatrix){const m=[r.x*this.worldSize,r.y*this.worldSize,u,1];return c.af(m,m,p),new c.P(m[0]/m[3],m[1]/m[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,yd])}calculateTileMatrix(r){const u=r.canonical,p=this.worldSize/this.zoomScale(u.z),m=u.x+Math.pow(2,u.z)*r.wrap,_=c.an(new Float64Array(16));return c.J(_,_,[m*p,u.y*p,0]),c.K(_,_,[p/c.X,p/c.X,1]),_}calculatePosMatrix(r,u=!1){const p=r.key,m=u?this._alignedPosMatrixCache:this._posMatrixCache;if(m[p])return m[p];const _=this.calculateTileMatrix(r);return c.L(_,u?this.alignedModelViewProjectionMatrix:this.modelViewProjectionMatrix,_),m[p]=new Float32Array(_),m[p]}calculateFogMatrix(r){const u=r.key,p=this._fogMatrixCache;if(p[u])return p[u];const m=this.calculateTileMatrix(r);return c.L(m,this.fogMatrix,m),p[u]=new Float32Array(m),p[u]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(r,u){u=c.ac(+u,this.minZoom,this.maxZoom);const p={center:new c.N(r.lng,r.lat),zoom:u};let m=this.lngRange;if(!this._renderWorldCopies&&m===null){const ae=179.9999999999;m=[-ae,ae]}const _=this.tileSize*this.zoomScale(p.zoom);let S=0,E=_,C=0,R=_,B=0,N=0;const{x:X,y:ee}=this.size;if(this.latRange){const ae=this.latRange;S=c.Q(ae[1])*_,E=c.Q(ae[0])*_,E-SE&&(me=E-ae)}if(m){const ae=(C+R)/2;let Ce=re;this._renderWorldCopies&&(Ce=c.b3(re,ae-_/2,ae+_/2));const Pe=X/2;Ce-PeR&&(pe=R-Pe)}if(pe!==void 0||me!==void 0){const ae=new c.P(pe??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:u,zoom:p}=this.getConstrained(this.center,this.zoom);this.center=u,this.zoom=p,this._unmodified=r,this._constraining=!1}_calcMatrices(){if(!this.height)return;const r=this.centerOffset,u=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 m=c.an(new Float64Array(16));c.K(m,m,[this.width/2,-this.height/2,1]),c.J(m,m,[1,-1,0]),this.labelPlaneMatrix=m,m=c.an(new Float64Array(16)),c.K(m,m,[1,-1,1]),c.J(m,m,[-1,-1,0]),c.K(m,m,[2/this.width,2/this.height,1]),this.glCoordMatrix=m;const _=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),S=Math.min(this.elevation,this.minElevationForCurrentTile),E=_-S*this._pixelPerMeter/Math.cos(this._pitch),C=S<0?E:_,R=Math.PI/2+this._pitch,B=this._fov*(.5+r.y/this.height),N=Math.sin(B)*C/Math.sin(c.ac(Math.PI-R-B,.01,Math.PI-.01)),X=this.getHorizon(),ee=2*Math.atan(X/this.cameraToCenterDistance)*(.5+r.y/(2*X)),re=Math.sin(ee)*C/Math.sin(c.ac(Math.PI-R-ee,.01,Math.PI-.01)),ce=Math.min(N,re);this.farZ=1.01*(Math.cos(Math.PI/2-this._pitch)*ce+C),this.nearZ=this.height/50,m=new Float64Array(16),c.b6(m,this._fov,this.width/this.height,this.nearZ,this.farZ),m[8]=2*-r.x/this.width,m[9]=2*r.y/this.height,this.projectionMatrix=c.ae(m),c.K(m,m,[1,-1,1]),c.J(m,m,[0,0,-this.cameraToCenterDistance]),c.b7(m,m,this._pitch),c.ad(m,m,this.angle),c.J(m,m,[-u,-p,0]),this.mercatorMatrix=c.K([],m,[this.worldSize,this.worldSize,this.worldSize]),c.K(m,m,[1,1,this._pixelPerMeter]),this.pixelMatrix=c.L(new Float64Array(16),this.labelPlaneMatrix,m),c.J(m,m,[0,0,-this.elevation]),this.modelViewProjectionMatrix=m,this.invModelViewProjectionMatrix=c.as([],m),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,[-u,-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,m);const pe=this.width%2/2,me=this.height%2/2,we=Math.cos(this.angle),ae=Math.sin(this.angle),Ce=u-Math.round(u)+we*pe+ae*me,Pe=p-Math.round(p)+we*me+ae*pe,ze=new Float64Array(m);if(c.J(ze,ze,[Ce>.5?Ce-1:Ce,Pe>.5?Pe-1:Pe,0]),this.alignedModelViewProjectionMatrix=ze,m=c.as(new Float64Array(16),this.pixelMatrix),!m)throw new Error("failed to invert matrix");this.pixelMatrixInverse=m,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const r=this.pointCoordinate(new c.P(0,0)),u=[r.x*this.worldSize,r.y*this.worldSize,0,1];return c.af(u,u,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 u=this.getCameraPoint();if(r.length===1)return[r[0],u];{let p=u.x,m=u.y,_=u.x,S=u.y;for(const E of r)p=Math.min(p,E.x),m=Math.min(m,E.y),_=Math.max(_,E.x),S=Math.max(S,E.y);return[new c.P(p,m),new c.P(_,m),new c.P(_,S),new c.P(p,S),new c.P(p,m)]}}lngLatToCameraDepth(r,u){const p=this.locationCoordinate(r),m=[p.x*this.worldSize,p.y*this.worldSize,u,1];return c.af(m,m,this.modelViewProjectionMatrix),m[2]/m[3]}}function iu(v,r){let u,p=!1,m=null,_=null;const S=()=>{m=null,p&&(v.apply(_,u),m=setTimeout(S,r),p=!1)};return(...E)=>(p=!0,_=this,u=E,m||S(),m)}class _c{constructor(r){this._getCurrentHash=()=>{const u=window.location.hash.replace("#","");if(this._hashName){let p;return u.split("&").map(m=>m.split("=")).forEach(m=>{m[0]===this._hashName&&(p=m)}),(p&&p[1]||"").split("/")}return u.split("/")},this._onHashChange=()=>{const u=this._getCurrentHash();if(u.length>=3&&!u.some(p=>isNaN(p))){const p=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(u[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+u[2],+u[1]],zoom:+u[0],bearing:p,pitch:+(u[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const u=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,u)},this._removeHash=()=>{const u=this._getCurrentHash();if(u.length===0)return;const p=u.join("/");let m=p;m.split("&").length>0&&(m=m.split("&")[0]),this._hashName&&(m=`${this._hashName}=${p}`);let _=window.location.hash.replace(m,"");_.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=iu(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 u=this._map.getCenter(),p=Math.round(100*this._map.getZoom())/100,m=Math.ceil((p*Math.LN2+Math.log(512/360/.5))/Math.LN10),_=Math.pow(10,m),S=Math.round(u.lng*_)/_,E=Math.round(u.lat*_)/_,C=this._map.getBearing(),R=this._map.getPitch();let B="";if(B+=r?`/${S}/${E}/${p}`:`${p}/${E}/${S}`,(C||R)&&(B+="/"+Math.round(10*C)/10),R&&(B+=`/${Math.round(R)}`),this._hashName){const N=this._hashName;let X=!1;const ee=window.location.hash.slice(1).split("&").map(re=>{const ce=re.split("=")[0];return ce===N?(X=!0,`${ce}=${B}`):re}).filter(re=>re);return X||ee.push(`${N}=${B}`),`#${ee.join("&")}`}return`#${B}`}}const vc={linearity:.3,easing:c.b8(0,0,.3,1)},_d=c.e({deceleration:2500,maxSpeed:1400},vc),Z_=c.e({deceleration:20,maxSpeed:1400},vc),Qp=c.e({deceleration:1e3,maxSpeed:360},vc),xc=c.e({deceleration:1e3,maxSpeed:90},vc);class vd{constructor(r){this._map=r,this.clear()}clear(){this._inertiaBuffer=[]}record(r){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:A.now(),settings:r})}_drainInertiaBuffer(){const r=this._inertiaBuffer,u=A.now();for(;r.length>0&&u-r[0].time>160;)r.shift()}_onMoveEnd(r){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const u={zoom:0,bearing:0,pitch:0,pan:new c.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:_}of this._inertiaBuffer)u.zoom+=_.zoomDelta||0,u.bearing+=_.bearingDelta||0,u.pitch+=_.pitchDelta||0,_.panDelta&&u.pan._add(_.panDelta),_.around&&(u.around=_.around),_.pinchAround&&(u.pinchAround=_.pinchAround);const p=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,m={};if(u.pan.mag()){const _=ou(u.pan.mag(),p,c.e({},_d,r||{}));m.offset=u.pan.mult(_.amount/u.pan.mag()),m.center=this._map.transform.center,su(m,_)}if(u.zoom){const _=ou(u.zoom,p,Z_);m.zoom=this._map.transform.zoom+_.amount,su(m,_)}if(u.bearing){const _=ou(u.bearing,p,Qp);m.bearing=this._map.transform.bearing+c.ac(_.amount,-179,179),su(m,_)}if(u.pitch){const _=ou(u.pitch,p,xc);m.pitch=this._map.transform.pitch+_.amount,su(m,_)}if(m.zoom||m.bearing){const _=u.pinchAround===void 0?u.around:u.pinchAround;m.around=_?this._map.unproject(_):this._map.getCenter()}return this.clear(),c.e(m,{noMoveStart:!0})}}function su(v,r){(!v.duration||v.durationu.unproject(C)),E=_.reduce((C,R,B,N)=>C.add(R.div(N.length)),new c.P(0,0));super(r,{points:_,point:E,lngLats:S,lngLat:u.unproject(E),originalEvent:p}),this._defaultPrevented=!1}}class em extends c.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(r,u,p){super(r,{originalEvent:p}),this._defaultPrevented=!1}}class tm{constructor(r,u){this._map=r,this._clickTolerance=u.clickTolerance}reset(){delete this._mousedownPos}wheel(r){return this._firePreventable(new em(r.type,this._map,r))}mousedown(r,u){return this._mousedownPos=u,this._firePreventable(new Wn(r.type,this._map,r))}mouseup(r){this._map.fire(new Wn(r.type,this._map,r))}click(r,u){this._mousedownPos&&this._mousedownPos.dist(u)>=this._clickTolerance||this._map.fire(new Wn(r.type,this._map,r))}dblclick(r){return this._firePreventable(new Wn(r.type,this._map,r))}mouseover(r){this._map.fire(new Wn(r.type,this._map,r))}mouseout(r){this._map.fire(new Wn(r.type,this._map,r))}touchstart(r){return this._firePreventable(new aa(r.type,this._map,r))}touchmove(r){this._map.fire(new aa(r.type,this._map,r))}touchend(r){this._map.fire(new aa(r.type,this._map,r))}touchcancel(r){this._map.fire(new aa(r.type,this._map,r))}_firePreventable(r){if(this._map.fire(r),r.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class pn{constructor(r){this._map=r}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(r){this._map.fire(new Wn(r.type,this._map,r))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Wn("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(r){this._delayContextMenu?this._contextMenuEvent=r:this._ignoreContextMenu||this._map.fire(new Wn(r.type,this._map,r)),this._map.listens("contextmenu")&&r.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class _s{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 zi{constructor(r,u){this._map=r,this._tr=new _s(r),this._el=r.getCanvasContainer(),this._container=r.getContainer(),this._clickTolerance=u.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(r,u){this.isEnabled()&&r.shiftKey&&r.button===0&&(M.disableDrag(),this._startPos=this._lastPos=u,this._active=!0)}mousemoveWindow(r,u){if(!this._active)return;const p=u;if(this._lastPos.equals(p)||!this._box&&p.dist(this._startPos)_.fitScreenCoordinates(p,m,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&&(M.remove(this._box),this._box=null),M.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(r,u){return this._map.fire(new c.k(r,{originalEvent:u}))}}function au(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 u={};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(m){const _=new c.P(0,0);for(const S of m)_._add(S);return _.div(m.length)}(u),this.touches=au(p,u)))}touchmove(r,u,p){if(this.aborted||!this.centroid)return;const m=au(p,u);for(const _ in this.touches){const S=m[_];(!S||S.dist(this.touches[_])>30)&&(this.aborted=!0)}}touchend(r,u,p){if((!this.centroid||r.timeStamp-this.startTime>500)&&(this.aborted=!0),p.length===0){const m=!this.aborted&&this.centroid;if(this.reset(),m)return m}}}class wc{constructor(r){this.singleTap=new xd(r),this.numTaps=r.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(r,u,p){this.singleTap.touchstart(r,u,p)}touchmove(r,u,p){this.singleTap.touchmove(r,u,p)}touchend(r,u,p){const m=this.singleTap.touchend(r,u,p);if(m){const _=r.timeStamp-this.lastTime<500,S=!this.lastTap||this.lastTap.dist(m)<30;if(_&&S||this.reset(),this.count++,this.lastTime=r.timeStamp,this.lastTap=m,this.count===this.numTaps)return this.reset(),m}}}class Qa{constructor(r){this._tr=new _s(r),this._zoomIn=new wc({numTouches:1,numTaps:2}),this._zoomOut=new wc({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(r,u,p){this._zoomIn.touchstart(r,u,p),this._zoomOut.touchstart(r,u,p)}touchmove(r,u,p){this._zoomIn.touchmove(r,u,p),this._zoomOut.touchmove(r,u,p)}touchend(r,u,p){const m=this._zoomIn.touchend(r,u,p),_=this._zoomOut.touchend(r,u,p),S=this._tr;return m?(this._active=!0,r.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:E=>E.easeTo({duration:300,zoom:S.zoom+1,around:S.unproject(m)},{originalEvent:r})}):_?(this._active=!0,r.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:E=>E.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 lo{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 u=this._moveFunction(...r);if(u.bearingDelta||u.pitchDelta||u.around||u.panDelta)return this._active=!0,u}dragStart(r,u){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(r)&&(this._moveStateManager.startMove(r),this._lastPoint=u.length?u[0]:u,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(r,u){if(!this.isEnabled())return;const p=this._lastPoint;if(!p)return;if(r.preventDefault(),!this._moveStateManager.isValidMoveEvent(r))return void this.reset(r);const m=u.length?u[0]:u;return!this._moved&&m.dist(p){v.mousedown=v.dragStart,v.mousemoveWindow=v.dragMove,v.mouseup=v.dragEnd,v.contextmenu=r=>{r.preventDefault()}},Sd=({enable:v,clickTolerance:r,bearingDegreesPerPixelMoved:u=.8})=>{const p=new bc({checkCorrectEvent:m=>M.mouseButton(m)===0&&m.ctrlKey||M.mouseButton(m)===2});return new lo({clickTolerance:r,move:(m,_)=>({bearingDelta:(_.x-m.x)*u}),moveStateManager:p,enable:v,assignEvents:Sc})},kd=({enable:v,clickTolerance:r,pitchDegreesPerPixelMoved:u=-.5})=>{const p=new bc({checkCorrectEvent:m=>M.mouseButton(m)===0&&m.ctrlKey||M.mouseButton(m)===2});return new lo({clickTolerance:r,move:(m,_)=>({pitchDelta:(_.y-m.y)*u}),moveStateManager:p,enable:v,assignEvents:Sc})};class la{constructor(r,u){this._clickTolerance=r.clickTolerance||1,this._map=u,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,u,p){return this._calculateTransform(r,u,p)}touchmove(r,u,p){if(this._active){if(!this._shouldBePrevented(p.length))return r.preventDefault(),this._calculateTransform(r,u,p);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",r)}}touchend(r,u,p){this._calculateTransform(r,u,p),this._active&&this._shouldBePrevented(p.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(r,u,p){p.length>0&&(this._active=!0);const m=au(p,u),_=new c.P(0,0),S=new c.P(0,0);let E=0;for(const R in m){const B=m[R],N=this._touches[R];N&&(_._add(B),S._add(B.sub(N)),E++,m[R]=B)}if(this._touches=m,this._shouldBePrevented(E)||!S.mag())return;const C=S.div(E);return this._sum._add(C),this._sum.mag()Math.abs(v.x)}class el extends kc{constructor(r){super(),this._currentTouchCount=0,this._map=r}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(r,u,p){super.touchstart(r,u,p),this._currentTouchCount=p.length}_start(r){this._lastPoints=r,Tc(r[0].sub(r[1]))&&(this._valid=!1)}_move(r,u,p){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const m=r[0].sub(this._lastPoints[0]),_=r[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(m,_,p.timeStamp),this._valid?(this._lastPoints=r,this._active=!0,{pitchDelta:(m.y+_.y)/2*-.5}):void 0}gestureBeginsVertically(r,u,p){if(this._valid!==void 0)return this._valid;const m=r.mag()>=2,_=u.mag()>=2;if(!m&&!_)return;if(!m||!_)return this._firstMove===void 0&&(this._firstMove=p),p-this._firstMove<100&&void 0;const S=r.y>0==u.y>0;return Tc(r)&&Tc(u)&&S}}const rm={panStep:100,bearingStep:15,pitchStep:10};class Ji{constructor(r){this._tr=new _s(r);const u=rm;this._panStep=u.panStep,this._bearingStep=u.bearingStep,this._pitchStep=u.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(r){if(r.altKey||r.ctrlKey||r.metaKey)return;let u=0,p=0,m=0,_=0,S=0;switch(r.keyCode){case 61:case 107:case 171:case 187:u=1;break;case 189:case 109:case 173:u=-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?m=1:(r.preventDefault(),S=-1);break;case 40:r.shiftKey?m=-1:(r.preventDefault(),S=1);break;default:return}return this._rotationDisabled&&(p=0,m=0),{cameraAnimation:E=>{const C=this._tr;E.easeTo({duration:300,easeId:"keyboardHandler",easing:Vs,zoom:u?Math.round(C.zoom)+u*(r.shiftKey?2:1):C.zoom,bearing:C.bearing+p*this._bearingStep,pitch:C.pitch+m*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 Vs(v){return v*(2-v)}const Pd=4.000244140625;class vs{constructor(r,u){this._onTimeout=p=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(p)},this._map=r,this._tr=new _s(r),this._triggerRenderFrame=u,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 u=r.deltaMode===WheelEvent.DOM_DELTA_LINE?40*r.deltaY:r.deltaY;const p=A.now(),m=p-(this._lastWheelEventTime||0);this._lastWheelEventTime=p,u!==0&&u%Pd==0?this._type="wheel":u!==0&&Math.abs(u)<4?this._type="trackpad":m>400?(this._type=null,this._lastValue=u,this._timeout=setTimeout(this._onTimeout,40,r)):this._type||(this._type=Math.abs(m*u)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,u+=this._lastValue)),r.shiftKey&&u&&(u/=4),this._type&&(this._lastWheelEvent=r,this._delta-=u,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 u=M.mousePos(this._map.getCanvas(),r),p=this._tr;this._around=u.y>p.transform.height/2-p.transform.getHorizon()?c.N.convert(this._aroundCenter?p.center:p.unproject(u)):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)>Pd?this._wheelZoomRate:this._defaultZoomRate;let R=2/(1+Math.exp(-Math.abs(this._delta*C)));this._delta<0&&R!==0&&(R=1/R);const B=typeof this._targetZoom=="number"?r.zoomScale(this._targetZoom):r.scale;this._targetZoom=Math.min(r.maxZoom,Math.max(r.minZoom,r.scaleZoom(B*R))),this._type==="wheel"&&(this._startZoom=r.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const u=typeof this._targetZoom=="number"?this._targetZoom:r.zoom,p=this._startZoom,m=this._easing;let _,S=!1;const E=A.now()-this._lastWheelEventTime;if(this._type==="wheel"&&p&&m&&E){const C=Math.min(E/200,1),R=m(C);_=c.y.number(p,u,R),C<1?this._frameId||(this._frameId=!0):S=!0}else _=u,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 u=c.b9;if(this._prevEase){const p=this._prevEase,m=(A.now()-p.start)/p.duration,_=p.easing(m+.01)-p.easing(m),S=.27/Math.sqrt(_*_+1e-4)*.01,E=Math.sqrt(.0729-S*S);u=c.b8(S,E,.25,1)}return this._prevEase={start:A.now(),duration:r,easing:u},u}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class ua{constructor(r,u){this._clickZoom=r,this._tapZoom=u}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 q_{constructor(r){this._tr=new _s(r),this.reset()}reset(){this._active=!1}dblclick(r,u){return r.preventDefault(),{cameraAnimation:p=>{p.easeTo({duration:300,zoom:this._tr.zoom+(r.shiftKey?-1:1),around:this._tr.unproject(u)},{originalEvent:r})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Y_{constructor(){this._tap=new wc({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,u,p){if(!this._swipePoint)if(this._tapTime){const m=u[0],_=r.timeStamp-this._tapTime<500,S=this._tapPoint.dist(m)<30;_&&S?p.length>0&&(this._swipePoint=m,this._swipeTouch=p[0].identifier):this.reset()}else this._tap.touchstart(r,u,p)}touchmove(r,u,p){if(this._tapTime){if(this._swipePoint){if(p[0].identifier!==this._swipeTouch)return;const m=u[0],_=m.y-this._swipePoint.y;return this._swipePoint=m,r.preventDefault(),this._active=!0,{zoomDelta:_/128}}}else this._tap.touchmove(r,u,p)}touchend(r,u,p){if(this._tapTime)this._swipePoint&&p.length===0&&this.reset();else{const m=this._tap.touchend(r,u,p);m&&(this._tapTime=r.timeStamp,this._tapPoint=m)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class nm{constructor(r,u,p){this._el=r,this._mousePan=u,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 im{constructor(r,u,p){this._pitchWithRotate=r.pitchWithRotate,this._mouseRotate=u,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 Md{constructor(r,u,p,m){this._el=r,this._touchZoom=u,this._touchRotate=p,this._tapDragZoom=m,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 tl{constructor(r,u){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=r,this._options=u,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=M.create("div","maplibregl-cooperative-gesture-screen",r);let u=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(u=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const p=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),m=document.createElement("div");m.className="maplibregl-desktop-message",m.textContent=u,this._container.appendChild(m);const _=document.createElement("div");_.className="maplibregl-mobile-message",_.textContent=p,this._container.appendChild(_),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(M.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,u){this._enabled&&(this._map.fire(new c.k("cooperativegestureprevented",{gestureType:r,originalEvent:u})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const Qi=v=>v.zoom||v.drag||v.pitch||v.rotate;class St extends c.k{}function Ec(v){return v.panDelta&&v.panDelta.mag()||v.zoomDelta||v.bearingDelta||v.pitchDelta}class Ad{constructor(r,u){this.handleWindowEvent=m=>{this.handleEvent(m,`${m.type}Window`)},this.handleEvent=(m,_)=>{if(m.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const S=m.type==="renderFrame"?void 0:m,E={needsRenderFrame:!1},C={},R={},B=m.touches,N=B?this._getMapTouches(B):void 0,X=N?M.touchPos(this._map.getCanvas(),N):M.mousePos(this._map.getCanvas(),m);for(const{handlerName:ce,handler:pe,allowed:me}of this._handlers){if(!pe.isEnabled())continue;let we;this._blockedByActive(R,me,ce)?pe.reset():pe[_||m.type]&&(we=pe[_||m.type](m,X,N),this.mergeHandlerResult(E,C,we,ce,S),we&&we.needsRenderFrame&&this._triggerRenderFrame()),(we||pe.isActive())&&(R[ce]=pe)}const ee={};for(const ce in this._previousActiveHandlers)R[ce]||(ee[ce]=S);this._previousActiveHandlers=R,(Object.keys(ee).length||Ec(E))&&(this._changes.push([E,C,ee]),this._triggerRenderFrame()),(Object.keys(R).length||Ec(E))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:re}=E;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 vd(r),this._bearingSnap=u.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(u);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[m,_,S]of this._listeners)M.addEventListener(m,_,m===document?this.handleWindowEvent:this.handleEvent,S)}destroy(){for(const[r,u,p]of this._listeners)M.removeEventListener(r,u,r===document?this.handleWindowEvent:this.handleEvent,p)}_addDefaultHandlers(r){const u=this._map,p=u.getCanvasContainer();this._add("mapEvent",new tm(u,r));const m=u.boxZoom=new zi(u,r);this._add("boxZoom",m),r.interactive&&r.boxZoom&&m.enable();const _=u.cooperativeGestures=new tl(u,r.cooperativeGestures);this._add("cooperativeGestures",_),r.cooperativeGestures&&_.enable();const S=new Qa(u),E=new q_(u);u.doubleClickZoom=new ua(E,S),this._add("tapZoom",S),this._add("clickZoom",E),r.interactive&&r.doubleClickZoom&&u.doubleClickZoom.enable();const C=new Y_;this._add("tapDragZoom",C);const R=u.touchPitch=new el(u);this._add("touchPitch",R),r.interactive&&r.touchPitch&&u.touchPitch.enable(r.touchPitch);const B=Sd(r),N=kd(r);u.dragRotate=new im(r,B,N),this._add("mouseRotate",B,["mousePitch"]),this._add("mousePitch",N,["mouseRotate"]),r.interactive&&r.dragRotate&&u.dragRotate.enable();const X=(({enable:we,clickTolerance:ae})=>{const Ce=new bc({checkCorrectEvent:Pe=>M.mouseButton(Pe)===0&&!Pe.ctrlKey});return new lo({clickTolerance:ae,move:(Pe,ze)=>({around:ze,panDelta:ze.sub(Pe)}),activateOnStart:!0,moveStateManager:Ce,enable:we,assignEvents:Sc})})(r),ee=new la(r,u);u.dragPan=new nm(p,X,ee),this._add("mousePan",X),this._add("touchPan",ee,["touchZoom","touchRotate"]),r.interactive&&r.dragPan&&u.dragPan.enable(r.dragPan);const re=new Id,ce=new Ed;u.touchZoomRotate=new Md(p,ce,re,C),this._add("touchRotate",re,["touchPan","touchZoom"]),this._add("touchZoom",ce,["touchPan","touchRotate"]),r.interactive&&r.touchZoomRotate&&u.touchZoomRotate.enable(r.touchZoomRotate);const pe=u.scrollZoom=new vs(u,()=>this._triggerRenderFrame());this._add("scrollZoom",pe,["mousePan"]),r.interactive&&r.scrollZoom&&u.scrollZoom.enable(r.scrollZoom);const me=u.keyboard=new Ji(u);this._add("keyboard",me),r.interactive&&r.keyboard&&u.keyboard.enable(),this._add("blockableMapEvent",new pn(u))}_add(r,u,p){this._handlers.push({handlerName:r,handler:u,allowed:p}),this._handlersById[r]=u}stop(r){if(!this._updatingCamera){for(const{handler:u}of this._handlers)u.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!!Qi(this._eventsInProgress)||this.isZooming()}_blockedByActive(r,u,p){for(const m in r)if(m!==p&&(!u||u.indexOf(m)<0))return!0;return!1}_getMapTouches(r){const u=[];for(const p of r)this._el.contains(p.target)&&u.push(p);return u}mergeHandlerResult(r,u,p,m,_){if(!p)return;c.e(r,p);const S={handlerName:m,originalEvent:p.originalEvent||_};p.zoomDelta!==void 0&&(u.zoom=S),p.panDelta!==void 0&&(u.drag=S),p.pitchDelta!==void 0&&(u.pitch=S),p.bearingDelta!==void 0&&(u.rotate=S)}_applyChanges(){const r={},u={},p={};for(const[m,_,S]of this._changes)m.panDelta&&(r.panDelta=(r.panDelta||new c.P(0,0))._add(m.panDelta)),m.zoomDelta&&(r.zoomDelta=(r.zoomDelta||0)+m.zoomDelta),m.bearingDelta&&(r.bearingDelta=(r.bearingDelta||0)+m.bearingDelta),m.pitchDelta&&(r.pitchDelta=(r.pitchDelta||0)+m.pitchDelta),m.around!==void 0&&(r.around=m.around),m.pinchAround!==void 0&&(r.pinchAround=m.pinchAround),m.noInertia&&(r.noInertia=m.noInertia),c.e(u,_),c.e(p,S);this._updateMapTransform(r,u,p),this._changes=[]}_updateMapTransform(r,u,p){const m=this._map,_=m._getTransformForUpdate(),S=m.terrain;if(!(Ec(r)||S&&this._terrainMovement))return this._fireEvents(u,p,!0);let{panDelta:E,zoomDelta:C,bearingDelta:R,pitchDelta:B,around:N,pinchAround:X}=r;X!==void 0&&(N=X),m._stop(!0),N=N||m.transform.centerPoint;const ee=_.pointLocation(E?N.sub(E):N);R&&(_.bearing+=R),B&&(_.pitch+=B),C&&(_.zoom+=C),S?this._terrainMovement||!u.drag&&!u.zoom?u.drag&&this._terrainMovement?_.center=_.pointLocation(_.centerPoint.sub(E)):_.setLocationAtPoint(ee,N):(this._terrainMovement=!0,this._map._elevationFreeze=!0,_.setLocationAtPoint(ee,N)):_.setLocationAtPoint(ee,N),m._applyUpdatedTransform(_),this._map._update(),r.noInertia||this._inertia.record(r),this._fireEvents(u,p,!0)}_fireEvents(r,u,p){const m=Qi(this._eventsInProgress),_=Qi(r),S={};for(const N in r){const{originalEvent:X}=r[N];this._eventsInProgress[N]||(S[`${N}start`]=X),this._eventsInProgress[N]=r[N]}!m&&_&&this._fireEvent("movestart",_.originalEvent);for(const N in S)this._fireEvent(N,S[N]);_&&this._fireEvent("move",_.originalEvent);for(const N in r){const{originalEvent:X}=r[N];this._fireEvent(N,X)}const E={};let C;for(const N in this._eventsInProgress){const{handlerName:X,originalEvent:ee}=this._eventsInProgress[N];this._handlersById[X].isActive()||(delete this._eventsInProgress[N],C=u[X]||ee,E[`${N}end`]=C)}for(const N in E)this._fireEvent(N,E[N]);const R=Qi(this._eventsInProgress),B=(m||_)&&!R;if(B&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const N=this._map._getTransformForUpdate();N.recalculateZoom(this._map.terrain),this._map._applyUpdatedTransform(N)}if(p&&B){this._updatingCamera=!0;const N=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),X=ee=>ee!==0&&-this._bearingSnap{delete this._frameId,this.handleEvent(new St("renderFrame",{timeStamp:r})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class sm extends c.E{constructor(r,u){super(),this._renderFrameCallback=()=>{const p=Math.min((A.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=u.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new c.N(this.transform.center.lng,this.transform.center.lat)}setCenter(r,u){return this.jumpTo({center:r},u)}panBy(r,u,p){return r=c.P.convert(r).mult(-1),this.panTo(this.transform.center,c.e({offset:r},u),p)}panTo(r,u,p){return this.easeTo(c.e({center:r},u),p)}getZoom(){return this.transform.zoom}setZoom(r,u){return this.jumpTo({zoom:r},u),this}zoomTo(r,u,p){return this.easeTo(c.e({zoom:r},u),p)}zoomIn(r,u){return this.zoomTo(this.getZoom()+1,r,u),this}zoomOut(r,u){return this.zoomTo(this.getZoom()-1,r,u),this}getBearing(){return this.transform.bearing}setBearing(r,u){return this.jumpTo({bearing:r},u),this}getPadding(){return this.transform.padding}setPadding(r,u){return this.jumpTo({padding:r},u),this}rotateTo(r,u,p){return this.easeTo(c.e({bearing:r},u),p)}resetNorth(r,u){return this.rotateTo(0,c.e({duration:1e3},r),u),this}resetNorthPitch(r,u){return this.easeTo(c.e({bearing:0,pitch:0,duration:1e3},r),u),this}snapToNorth(r,u){return Math.abs(this.getBearing()){if(this._zooming&&(m.zoom=c.y.number(_,pe,Xe)),this._rotating&&(m.bearing=c.y.number(S,R,Xe)),this._pitching&&(m.pitch=c.y.number(E,B,Xe)),this._padding&&(m.interpolatePadding(C,N,Xe),ee=m.centerPoint.add(X)),this.terrain&&!r.freezeElevation&&this._updateElevation(Xe),Ce)m.setLocationAtPoint(Ce,Pe);else{const st=m.zoomScale(m.zoom-_),gt=pe>_?Math.min(2,ae):Math.max(.5,ae),wt=Math.pow(gt,1-Xe),dt=m.unproject(me.add(we.mult(Xe*wt)).mult(st));m.setLocationAtPoint(m.renderWorldCopies?dt.wrap():dt,ee)}this._applyUpdatedTransform(m),this._fireMoveEvents(u)},Xe=>{this.terrain&&r.freezeElevation&&this._finalizeElevation(),this._afterEase(u,Xe)},r),this}_prepareEase(r,u,p={}){this._moving=!0,u||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 u=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(r<1&&u!==this._elevationTarget){const p=this._elevationTarget-this._elevationStart;this._elevationStart+=r*(p-(u-(p*r+this._elevationStart))/(1-r)),this._elevationTarget=u}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 u=r.getCameraPosition(),p=this.terrain.getElevationForLngLatZoom(u.lngLat,r.zoom);if(u.altitudethis._elevateCameraIfInsideTerrain(m)),this.transformCameraUpdate&&u.push(m=>this.transformCameraUpdate(m)),!u.length)return;const p=r.clone();for(const m of u){const _=p.clone(),{center:S,zoom:E,pitch:C,bearing:R,elevation:B}=m(_);S&&(_.center=S),E!==void 0&&(_.zoom=E),C!==void 0&&(_.pitch=C),R!==void 0&&(_.bearing=R),B!==void 0&&(_.elevation=B),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,u){if(this._easeId&&u&&this._easeId===u)return;delete this._easeId;const p=this._zooming,m=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)),m&&this.fire(new c.k("rotateend",r)),_&&this.fire(new c.k("pitchend",r)),this.fire(new c.k("moveend",r))}flyTo(r,u){var p;if(!r.essential&&A.prefersReducedMotion){const _t=c.M(r,["center","zoom","bearing","pitch","around"]);return this.jumpTo(_t,u)}this.stop(),r=c.e({offset:[0,0],speed:1.2,curve:1.42,easing:c.b9},r);const m=this._getTransformForUpdate(),_=m.zoom,S=m.bearing,E=m.pitch,C=m.padding,R="bearing"in r?this._normalizeBearing(r.bearing,S):S,B="pitch"in r?+r.pitch:E,N="padding"in r?r.padding:m.padding,X=c.P.convert(r.offset);let ee=m.centerPoint.add(X);const re=m.pointLocation(ee),{center:ce,zoom:pe}=m.getConstrained(c.N.convert(r.center||re),(p=r.zoom)!==null&&p!==void 0?p:_);this._normalizeCenter(ce,m);const me=m.zoomScale(pe-_),we=m.project(re),ae=m.project(ce).sub(we);let Ce=r.curve;const Pe=Math.max(m.width,m.height),ze=Pe/me,Xe=ae.mag();if("minZoom"in r){const _t=c.ac(Math.min(r.minZoom,_,pe),m.minZoom,m.maxZoom),Gt=Pe/m.zoomScale(_t-_);Ce=Math.sqrt(Gt/Xe*2)}const st=Ce*Ce;function gt(_t){const Gt=(ze*ze-Pe*Pe+(_t?-1:1)*st*st*Xe*Xe)/(2*(_t?ze:Pe)*st*Xe);return Math.log(Math.sqrt(Gt*Gt+1)-Gt)}function wt(_t){return(Math.exp(_t)-Math.exp(-_t))/2}function dt(_t){return(Math.exp(_t)+Math.exp(-_t))/2}const ct=gt(!1);let Pt=function(_t){return dt(ct)/dt(ct+Ce*_t)},qt=function(_t){return Pe*((dt(ct)*(wt(Gt=ct+Ce*_t)/dt(Gt))-wt(ct))/st)/Xe;var Gt},ft=(gt(!0)-ct)/Ce;if(Math.abs(Xe)<1e-6||!isFinite(ft)){if(Math.abs(Pe-ze)<1e-6)return this.easeTo(r,u);const _t=ze0,Pt=Gt=>Math.exp(_t*Ce*Gt)}return r.duration="duration"in r?+r.duration:1e3*ft/("screenSpeed"in r?+r.screenSpeed/Ce:+r.speed),r.maxDuration&&r.duration>r.maxDuration&&(r.duration=0),this._zooming=!0,this._rotating=S!==R,this._pitching=B!==E,this._padding=!m.isPaddingEqual(N),this._prepareEase(u,!1),this.terrain&&this._prepareElevation(ce),this._ease(_t=>{const Gt=_t*ft,Hr=1/Pt(Gt);m.zoom=_t===1?pe:_+m.scaleZoom(Hr),this._rotating&&(m.bearing=c.y.number(S,R,_t)),this._pitching&&(m.pitch=c.y.number(E,B,_t)),this._padding&&(m.interpolatePadding(C,N,_t),ee=m.centerPoint.add(X)),this.terrain&&!r.freezeElevation&&this._updateElevation(_t);const tr=_t===1?ce:m.unproject(we.add(ae.mult(qt(Gt))).mult(Hr));m.setLocationAtPoint(m.renderWorldCopies?tr.wrap():tr,ee),this._applyUpdatedTransform(m),this._fireMoveEvents(u)},()=>{this.terrain&&r.freezeElevation&&this._finalizeElevation(),this._afterEase(u)},r),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(r,u){var p;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const m=this._onEaseEnd;delete this._onEaseEnd,m.call(this,u)}return r||(p=this.handlers)===null||p===void 0||p.stop(!1),this}_ease(r,u,p){p.animate===!1||p.duration===0?(r(1),u()):(this._easeStart=A.now(),this._easeOptions=p,this._onEaseFrame=r,this._onEaseEnd=u,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(r,u){r=c.b3(r,-180,180);const p=Math.abs(r-u);return Math.abs(r-360-u)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 rl={compact:!0,customAttribution:'MapLibre'};class nl{constructor(r=rl){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=u=>{!u||u.sourceDataType!=="metadata"&&u.sourceDataType!=="visibility"&&u.dataType!=="style"&&u.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=M.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=M.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=M.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(){M.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,u){const p=this._map._getUIString(`AttributionControl.${u}`);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(m=>typeof m!="string"?"":m)):typeof this.options.customAttribution=="string"&&r.push(this.options.customAttribution)),this._map.style.stylesheet){const m=this._map.style.stylesheet;this.styleOwner=m.owner,this.styleId=m.id}const u=this._map.style.sourceCaches;for(const m in u){const _=u[m];if(_.used||_.usedForTerrain){const S=_.getSource();S.attribution&&r.indexOf(S.attribution)<0&&r.push(S.attribution)}}r=r.filter(m=>String(m).trim()),r.sort((m,_)=>m.length-_.length),r=r.filter((m,_)=>{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 Dd{constructor(r={}){this._updateCompact=()=>{const u=this._container.children;if(u.length){const p=u[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=M.create("div","maplibregl-ctrl");const u=M.create("a","maplibregl-ctrl-logo");return u.target="_blank",u.rel="noopener nofollow",u.href="https://maplibre.org/",u.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),u.setAttribute("rel","noopener nofollow"),this._container.appendChild(u),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){M.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class ur{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(r){const u=++this._id;return this._queue.push({callback:r,id:u,cancelled:!1}),u}remove(r){const u=this._currentlyRunning,p=u?this._queue.concat(u):this._queue;for(const m of p)if(m.id===r)return void(m.cancelled=!0)}run(r=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const u=this._currentlyRunning=this._queue;this._queue=[];for(const p of u)if(!p.cancelled&&(p.callback(r),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var zd=c.Y([{name:"a_pos3d",type:"Int16",components:3}]);class X_ 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,u){this.sourceCache.update(r,u),this._renderableTilesKeys=[];const p={};for(const m of r.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:u}))p[m.key]=!0,this._renderableTilesKeys.push(m.key),this._tiles[m.key]||(m.posMatrix=new Float64Array(16),c.aP(m.posMatrix,0,c.X,0,c.X,0,1),this._tiles[m.key]=new pi(m,this.tileSize));for(const m in this._tiles)p[m]||delete this._tiles[m]}freeRtt(r){for(const u in this._tiles){const p=this._tiles[u];(!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 u={};for(const p of this._renderableTilesKeys){const m=this._tiles[p].tileID;if(m.canonical.equals(r.canonical)){const _=r.clone();_.posMatrix=new Float64Array(16),c.aP(_.posMatrix,0,c.X,0,c.X,0,1),u[p]=_}else if(m.canonical.isChildOf(r.canonical)){const _=r.clone();_.posMatrix=new Float64Array(16);const S=m.canonical.z-r.canonical.z,E=m.canonical.x-(m.canonical.x>>S<>S<>S;c.aP(_.posMatrix,0,R,0,R,0,1),c.J(_.posMatrix,_.posMatrix,[-E*R,-C*R,0]),u[p]=_}else if(r.canonical.isChildOf(m.canonical)){const _=r.clone();_.posMatrix=new Float64Array(16);const S=r.canonical.z-m.canonical.z,E=r.canonical.x-(r.canonical.x>>S<>S<>S;c.aP(_.posMatrix,0,c.X,0,c.X,0,1),c.J(_.posMatrix,_.posMatrix,[E*R,C*R,0]),c.K(_.posMatrix,_.posMatrix,[1/2**S,1/2**S,0]),u[p]=_}}return u}getSourceTile(r,u){const p=this.sourceCache._source;let m=r.overscaledZ-this.deltaZoom;if(m>p.maxzoom&&(m=p.maxzoom),m=p.minzoom&&(!_||!_.dem);)_=this.sourceCache.getTileByID(r.scaledTo(m--).key);return _}tilesAfterTime(r=Date.now()){return Object.values(this._tiles).filter(u=>u.timeAdded>=r)}}class Rd{constructor(r,u,p){this.painter=r,this.sourceCache=new X_(u),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,u,p,m=c.X){var _;if(!(u>=0&&u=0&&pr.canonical.z&&(r.canonical.z>=m?_=r.canonical.z-m:c.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const S=r.canonical.x-(r.canonical.x>>_<<_),E=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,E*c.X,0]),this._demMatrixCache[r.key]={matrix:C,coord:r}}return{u_depth:2,u_terrain:3,u_terrain_dim:u&&u.dem&&u.dem.dim||1,u_terrain_matrix:p?this._demMatrixCache[r.key].matrix:this._emptyDemMatrix,u_terrain_unpack:u&&u.dem&&u.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(u&&u.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:u}}getFramebuffer(r){const u=this.painter,p=u.width/devicePixelRatio,m=u.height/devicePixelRatio;return!this._fbo||this._fbo.width===p&&this._fbo.height===m||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new it(u.context,{width:p,height:m,data:null},u.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(u.context.gl.NEAREST,u.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new it(u.context,{width:p,height:m,data:null},u.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(u.context.gl.NEAREST,u.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=u.context.createFramebuffer(p,m,!0,!1),this._fbo.depthAttachment.set(u.context.createRenderbuffer(u.context.gl.DEPTH_COMPONENT16,p,m))),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 u=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let _=0,S=0;_>8<<4|_>>8,u[S+3]=0;const p=new c.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(u.buffer)),m=new it(r,p,r.gl.RGBA,{premultiply:!1});return m.bind(r.gl.NEAREST,r.gl.CLAMP_TO_EDGE),this._coordsTexture=m,m}pointCoordinate(r){this.painter.maybeDrawDepthAndCoords(!0);const u=new Uint8Array(4),p=this.painter.context,m=p.gl,_=Math.round(r.x*this.painter.pixelRatio/devicePixelRatio),S=Math.round(r.y*this.painter.pixelRatio/devicePixelRatio),E=Math.round(this.painter.height/devicePixelRatio);p.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),m.readPixels(_,E-S-1,1,1,m.RGBA,m.UNSIGNED_BYTE,u),p.bindFramebuffer.set(null);const C=u[0]+(u[2]>>4<<8),R=u[1]+((15&u[2])<<8),B=this.coordsIndex[255-u[3]],N=B&&this.sourceCache.getTileByID(B);if(!N)return null;const X=this._coordsTextureSize,ee=(1<r.id!==u),this._recentlyUsed.push(r.id)}stampObject(r){r.stamp=++this._stamp}getOrCreateFreeObject(){for(const u of this._recentlyUsed)if(!this._objects[u].inUse)return this._objects[u];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 il={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class om{constructor(r,u){this.painter=r,this.terrain=u,this.pool=new K_(r.context,30,u.sourceCache.tileSize*u.qualityFactor)}destruct(){this.pool.destruct()}getTexture(r){return this.pool.getObjectForId(r.rtt[this._stacks.length-1].id).texture}prepareForRender(r,u){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=r._order.filter(p=>!r._layers[p].isHidden(u)),this._coordsDescendingInv={};for(const p in r.sourceCaches){this._coordsDescendingInv[p]={};const m=r.sourceCaches[p].getVisibleCoordinates();for(const _ of m){const S=this.terrain.sourceCache.getTerrainCoords(_);for(const E in S)this._coordsDescendingInv[p][E]||(this._coordsDescendingInv[p][E]=[]),this._coordsDescendingInv[p][E].push(S[E])}}this._coordsDescendingInvStr={};for(const p of r._order){const m=r._layers[p],_=m.source;if(il[m.type]&&!this._coordsDescendingInvStr[_]){this._coordsDescendingInvStr[_]={};for(const S in this._coordsDescendingInv[_])this._coordsDescendingInvStr[_][S]=this._coordsDescendingInv[_][S].map(E=>E.key).sort().join()}}for(const p of this._renderableTiles)for(const m in this._coordsDescendingInvStr){const _=this._coordsDescendingInvStr[m][p.tileID.key];_&&_!==p.rttCoords[m]&&(p.rtt=[])}}renderLayer(r){if(r.isHidden(this.painter.transform.zoom))return!1;const u=r.type,p=this.painter,m=this._renderableLayerIds[this._renderableLayerIds.length-1]===r.id;if(il[u]&&(this._prevType&&il[this._prevType]||this._stacks.push([]),this._prevType=u,this._stacks[this._stacks.length-1].push(r.id),!m))return!0;if(il[this._prevType]||il[u]&&m){this._prevType=u;const _=this._stacks.length-1,S=this._stacks[_]||[];for(const E of this._renderableTiles){if(this.pool.isFull()&&(Jp(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(E),E.rtt[_]){const R=this.pool.getObjectForId(E.rtt[_].id);if(R.stamp===E.rtt[_].stamp){this.pool.useObject(R);continue}}const C=this.pool.getOrCreateFreeObject();this.pool.useObject(C),this.pool.stampObject(C),E.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 R=0;R{v.touchstart=v.dragStart,v.touchmoveWindow=v.dragMove,v.touchend=v.dragEnd},Q_={showCompass:!0,showZoom:!0,visualizePitch:!1};class e0{constructor(r,u,p=!1){this.mousedown=S=>{this.startMouse(c.e({},S,{ctrlKey:!0,preventDefault:()=>S.preventDefault()}),M.mousePos(this.element,S)),M.addEventListener(window,"mousemove",this.mousemove),M.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=S=>{this.moveMouse(S,M.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=M.touchPos(this.element,S.targetTouches)[0],this.startTouch(S,this._startPos),M.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),M.addEventListener(window,"touchend",this.touchend))},this.touchmove=S=>{S.targetTouches.length!==1?this.reset():(this._lastPos=M.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 m=r.dragRotate._mouseRotate.getClickTolerance(),_=r.dragRotate._mousePitch.getClickTolerance();this.element=u,this.mouseRotate=Sd({clickTolerance:m,enable:!0}),this.touchRotate=(({enable:S,clickTolerance:E,bearingDegreesPerPixelMoved:C=.8})=>{const R=new bd;return new lo({clickTolerance:E,move:(B,N)=>({bearingDelta:(N.x-B.x)*C}),moveStateManager:R,enable:S,assignEvents:Od})})({clickTolerance:m,enable:!0}),this.map=r,p&&(this.mousePitch=kd({clickTolerance:_,enable:!0}),this.touchPitch=(({enable:S,clickTolerance:E,pitchDegreesPerPixelMoved:C=-.5})=>{const R=new bd;return new lo({clickTolerance:E,move:(B,N)=>({pitchDelta:(N.y-B.y)*C}),moveStateManager:R,enable:S,assignEvents:Od})})({clickTolerance:_,enable:!0})),M.addEventListener(u,"mousedown",this.mousedown),M.addEventListener(u,"touchstart",this.touchstart,{passive:!1}),M.addEventListener(u,"touchcancel",this.reset)}startMouse(r,u){this.mouseRotate.dragStart(r,u),this.mousePitch&&this.mousePitch.dragStart(r,u),M.disableDrag()}startTouch(r,u){this.touchRotate.dragStart(r,u),this.touchPitch&&this.touchPitch.dragStart(r,u),M.disableDrag()}moveMouse(r,u){const p=this.map,{bearingDelta:m}=this.mouseRotate.dragMove(r,u)||{};if(m&&p.setBearing(p.getBearing()+m),this.mousePitch){const{pitchDelta:_}=this.mousePitch.dragMove(r,u)||{};_&&p.setPitch(p.getPitch()+_)}}moveTouch(r,u){const p=this.map,{bearingDelta:m}=this.touchRotate.dragMove(r,u)||{};if(m&&p.setBearing(p.getBearing()+m),this.touchPitch){const{pitchDelta:_}=this.touchPitch.dragMove(r,u)||{};_&&p.setPitch(p.getPitch()+_)}}off(){const r=this.element;M.removeEventListener(r,"mousedown",this.mousedown),M.removeEventListener(r,"touchstart",this.touchstart,{passive:!1}),M.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),M.removeEventListener(window,"touchend",this.touchend),M.removeEventListener(r,"touchcancel",this.reset),this.offTemp()}offTemp(){M.enableDrag(),M.removeEventListener(window,"mousemove",this.mousemove),M.removeEventListener(window,"mouseup",this.mouseup),M.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),M.removeEventListener(window,"touchend",this.touchend)}}let Ri;function Vr(v,r,u){const p=new c.N(v.lng,v.lat);if(v=new c.N(v.lng,v.lat),r){const m=new c.N(v.lng-360,v.lat),_=new c.N(v.lng+360,v.lat),S=u.locationPoint(v).distSqr(r);u.locationPoint(m).distSqr(r)180;){const m=u.locationPoint(v);if(m.x>=0&&m.y>=0&&m.x<=u.width&&m.y<=u.height)break;v.lng>u.center.lng?v.lng-=360:v.lng+=360}return v.lng!==p.lng&&u.locationPoint(v).y>u.height/2-u.getHorizon()?v:p}const sl={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 Cc(v,r,u){const p=v.classList;for(const m in sl)p.remove(`maplibregl-${u}-anchor-${m}`);p.add(`maplibregl-${u}-anchor-${r}`)}class Ic extends c.E{constructor(r){if(super(),this._onKeyPress=u=>{const p=u.code,m=u.charCode||u.keyCode;p!=="Space"&&p!=="Enter"&&m!==32&&m!==13||this.togglePopup()},this._onMapClick=u=>{const p=u.originalEvent.target,m=this._element;this._popup&&(p===m||m.contains(p))&&this.togglePopup()},this._update=u=>{var p;if(!this._map)return;const m=this._map.loaded()&&!this._map.isMoving();((u==null?void 0:u.type)==="terrain"||(u==null?void 0:u.type)==="render"&&!m)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?Vr(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||u&&u.type!=="moveend"||(this._pos=this._pos.round()),M.setTransform(this._element,`${sl[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${S} ${_}`),A.frameAsync(new AbortController).then(()=>{this._updateOpacity(u&&u.type==="moveend")}).catch(()=>{})},this._onMove=u=>{if(!this._isDragging){const p=this._clickTolerance||this._map._clickTolerance;this._isDragging=u.point.dist(this._pointerdownPos)>=p}this._isDragging&&(this._pos=u.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=u=>{this._element.contains(u.originalEvent.target)&&(u.preventDefault(),this._positionDelta=u.point.sub(this._pos).add(this._offset),this._pointerdownPos=u.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=M.create("div");const u=M.createNS("http://www.w3.org/2000/svg","svg"),p=41,m=27;u.setAttributeNS(null,"display","block"),u.setAttributeNS(null,"height",`${p}px`),u.setAttributeNS(null,"width",`${m}px`),u.setAttributeNS(null,"viewBox",`0 0 ${m} ${p}`);const _=M.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=M.createNS("http://www.w3.org/2000/svg","g");S.setAttributeNS(null,"fill-rule","nonzero");const E=M.createNS("http://www.w3.org/2000/svg","g");E.setAttributeNS(null,"transform","translate(3.0, 29.0)"),E.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=M.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),E.appendChild(we)}const R=M.createNS("http://www.w3.org/2000/svg","g");R.setAttributeNS(null,"fill",this._color);const B=M.createNS("http://www.w3.org/2000/svg","path");B.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"),R.appendChild(B);const N=M.createNS("http://www.w3.org/2000/svg","g");N.setAttributeNS(null,"opacity","0.25"),N.setAttributeNS(null,"fill","#000000");const X=M.createNS("http://www.w3.org/2000/svg","path");X.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"),N.appendChild(X);const ee=M.createNS("http://www.w3.org/2000/svg","g");ee.setAttributeNS(null,"transform","translate(6.0, 7.0)"),ee.setAttributeNS(null,"fill","#FFFFFF");const re=M.createNS("http://www.w3.org/2000/svg","g");re.setAttributeNS(null,"transform","translate(8.0, 8.0)");const ce=M.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 pe=M.createNS("http://www.w3.org/2000/svg","circle");pe.setAttributeNS(null,"fill","#FFFFFF"),pe.setAttributeNS(null,"cx","5.5"),pe.setAttributeNS(null,"cy","5.5"),pe.setAttributeNS(null,"r","5.4999962"),re.appendChild(ce),re.appendChild(pe),S.appendChild(E),S.appendChild(R),S.appendChild(N),S.appendChild(ee),S.appendChild(re),u.appendChild(S),u.setAttributeNS(null,"height",p*this._scale+"px"),u.setAttributeNS(null,"width",m*this._scale+"px"),this._element.appendChild(u),this._offset=c.P.convert(r&&r.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",u=>{u.preventDefault()}),this._element.addEventListener("mousedown",u=>{u.preventDefault()}),Cc(this._element,this._anchor,"marker"),r&&r.className)for(const u of r.className.split(" "))this._element.classList.add(u);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),M.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 m=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":[m,-1*(38.1-13.5+m)],"bottom-right":[-m,-1*(38.1-13.5+m)],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 u,p;if(!(!((u=this._map)===null||u===void 0)&&u.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 m=this._map,_=m.terrain.depthAtPoint(this._pos),S=m.terrain.getElevationForLngLatZoom(this._lngLat,m.transform.tileZoom);if(m.transform.lngLatToCameraDepth(this._lngLat,S)-_<.006)return void(this._element.style.opacity=this._opacity);const E=-this._offset.y/m.transform._pixelPerMeter,C=Math.sin(m.getPitch()*Math.PI/180)*E,R=m.terrain.depthAtPoint(new c.P(this._pos.x,this._pos.y-this._offset.y)),B=m.transform.lngLatToCameraDepth(this._lngLat,S+C)-R>.006;!((p=this._popup)===null||p===void 0)&&p.isOpen()&&B&&this._popup.remove(),this._element.style.opacity=B?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,u){return r===void 0&&u===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),r!==void 0&&(this._opacity=r),u!==void 0&&(this._opacityWhenCovered=u),this._map&&this._updateOpacity(!0),this}}const lm={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let uu=0,cu=!1;const Hs={maxWidth:100,unit:"metric"};function hu(v,r,u){const p=u&&u.maxWidth||100,m=v._container.clientHeight/2,_=v.unproject([0,m]),S=v.unproject([p,m]),E=_.distanceTo(S);if(u&&u.unit==="imperial"){const C=3.2808*E;C>5280?It(r,p,C/5280,v._getUIString("ScaleControl.Miles")):It(r,p,C,v._getUIString("ScaleControl.Feet"))}else u&&u.unit==="nautical"?It(r,p,E/1852,v._getUIString("ScaleControl.NauticalMiles")):E>=1e3?It(r,p,E/1e3,v._getUIString("ScaleControl.Kilometers")):It(r,p,E,v._getUIString("ScaleControl.Meters"))}function It(v,r,u,p){const m=function(_){const S=Math.pow(10,`${Math.floor(_)}`.length-1);let E=_/S;return E=E>=10?10:E>=5?5:E>=3?3:E>=2?2:E>=1?1:function(C){const R=Math.pow(10,Math.ceil(-Math.log(C)/Math.LN10));return Math.round(C*R)/R}(E),S*E}(u);v.style.width=r*(m/u)+"px",v.innerHTML=`${m} ${p}`}const Ut={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},Pc=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Mc(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 Mc(new c.P(0,0))}const Fd=T;g.AJAXError=c.bh,g.Evented=c.E,g.LngLat=c.N,g.MercatorCoordinate=c.Z,g.Point=c.P,g.addProtocol=c.bi,g.config=c.a,g.removeProtocol=c.bj,g.AttributionControl=nl,g.BoxZoomHandler=zi,g.CanvasSource=at,g.CooperativeGesturesHandler=tl,g.DoubleClickZoomHandler=ua,g.DragPanHandler=nm,g.DragRotateHandler=im,g.EdgeInsets=Ka,g.FullscreenControl=class extends c.E{constructor(v={}){super(),this._onFullscreenChange=()=>{var r;let u=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((r=u==null?void 0:u.shadowRoot)===null||r===void 0)&&r.fullscreenElement;)u=u.shadowRoot.fullscreenElement;u===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=M.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){M.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const v=this._fullscreenButton=M.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);M.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()}},g.GeoJSONSource=tt,g.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 u=new c.N(r.coords.longitude,r.coords.latitude),p=r.coords.accuracy,m=this._map.getBearing(),_=c.e({bearing:m},this.options.fitBoundsOptions),S=ie.fromLngLat(u,p);this._map.fitBounds(S,_,{geolocateSource:!0})},this._updateMarker=r=>{if(r){const u=new c.N(r.coords.longitude,r.coords.latitude);this._accuracyCircleMarker.setLngLat(u).addTo(this._map),this._userLocationDotMarker.setLngLat(u).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 u=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=u,this._geolocateButton.setAttribute("aria-label",u),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(r.code===3&&cu)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=M.create("button","maplibregl-ctrl-geolocate",this._container),M.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 u=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=u,this._geolocateButton.setAttribute("aria-label",u)}else{const u=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=u,this._geolocateButton.setAttribute("aria-label",u)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=M.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Ic({element:this._dotElement}),this._circleElement=M.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Ic({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",u=>{u.geolocateSource||this._watchState!=="ACTIVE_LOCK"||u.originalEvent&&u.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({},lm,v)}onAdd(v){return this._map=v,this._container=M.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return c._(this,arguments,void 0,function*(r=!1){if(Ri!==void 0&&!r)return Ri;if(window.navigator.permissions===void 0)return Ri=!!window.navigator.geolocation,Ri;try{Ri=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{Ri=!!window.navigator.geolocation}return Ri})}().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(),M.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,uu=0,cu=!1}_isOutOfMapMaxBounds(v){const r=this._map.getMaxBounds(),u=v.coords;return r&&(u.longituder.getEast()||u.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(),u=v.getNorthEast(),p=r.distanceTo(u),m=Math.ceil(this._accuracy/(p/this._map._container.clientHeight)*2);this._circleElement.style.width=`${m}px`,this._circleElement.style.height=`${m}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":uu--,cu=!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"),uu++,uu>1?(v={maximumAge:6e5,timeout:0},cu=!0):(v=this.options.positionOptions,cu=!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)}},g.Hash=_c,g.ImageSource=ot,g.KeyboardHandler=Ji,g.LngLatBounds=ie,g.LogoControl=Dd,g.Map=class extends sm{constructor(v){c.bf.mark(c.bg.create);const r=Object.assign(Object.assign({},J_),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 Ja(r.minZoom,r.maxZoom,r.minPitch,r.maxPitch,r.renderWorldCopies),{bearingSnap:r.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new ur,this._controls=[],this._mapId=c.a4(),this._contextLost=u=>{u.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new c.k("webglcontextlost",{originalEvent:u}))},this._contextRestored=u=>{this._setupPainter(),this.resize(),this._update(),this.fire(new c.k("webglcontextrestored",{originalEvent:u}))},this._onMapScroll=u=>{if(u.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({},Ld),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=Z.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 u=!1;const p=iu(m=>{this._trackResize&&!this._removed&&(this.resize(m),this.redraw())},50);this._resizeObserver=new ResizeObserver(m=>{u?p(m):u=!0}),this._resizeObserver.observe(this._container)}this.handlers=new Ad(this,r),this._hash=r.hash&&new _c(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 nl(typeof r.attributionControl=="boolean"?void 0:r.attributionControl)),r.maplibreLogo&&this.addControl(new Dd,r.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",u=>{this._update(u.dataType==="style"),this.fire(new c.k(`${u.dataType}data`,u))}),this.on("dataloading",u=>{this.fire(new c.k(`${u.dataType}dataloading`,u))}),this.on("dataabort",u=>{this.fire(new c.k("sourcedataabort",u))})}_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 u=v.onAdd(this);this._controls.push(v);const p=this._controlPositions[r];return r.indexOf("bottom")!==-1?p.insertBefore(u,p.firstChild):p.appendChild(u),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,u,p){return p==null&&this.terrain&&(p=this.terrain.getElevationForLngLatZoom(u,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(v,r,u,p)}resize(v){var r;const u=this._containerDimensions(),p=u[0],m=u[1],_=this._getClampedPixelRatio(p,m);if(this._resizeCanvas(p,m,_),this.painter.resize(p,m,_),this.painter.overLimit()){const E=this.painter.context.gl;this._maxCanvasSize=[E.drawingBufferWidth,E.drawingBufferHeight];const C=this._getClampedPixelRatio(p,m);this._resizeCanvas(p,m,C),this.painter.resize(p,m,C)}this.transform.resize(p,m),(r=this._requestedCameraState)===null||r===void 0||r.resize(p,m);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:u,1:p}=this._maxCanvasSize,m=this.getPixelRatio(),_=v*m,S=r*m;return Math.min(_>u?u/_:1,S>p?p/S:1)*m}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,u){if(v==="mouseenter"||v==="mouseover"){let p=!1;return{layers:r,listener:u,delegates:{mousemove:_=>{const S=r.filter(C=>this.getLayer(C)),E=S.length!==0?this.queryRenderedFeatures(_.point,{layers:S}):[];E.length?p||(p=!0,u.call(this,new Wn(v,this,_.originalEvent,{features:E}))):p=!1},mouseout:()=>{p=!1}}}}if(v==="mouseleave"||v==="mouseout"){let p=!1;return{layers:r,listener:u,delegates:{mousemove:S=>{const E=r.filter(C=>this.getLayer(C));(E.length!==0?this.queryRenderedFeatures(S.point,{layers:E}):[]).length?p=!0:p&&(p=!1,u.call(this,new Wn(v,this,S.originalEvent)))},mouseout:S=>{p&&(p=!1,u.call(this,new Wn(v,this,S.originalEvent)))}}}}{const p=m=>{const _=r.filter(E=>this.getLayer(E)),S=_.length!==0?this.queryRenderedFeatures(m.point,{layers:_}):[];S.length&&(m.features=S,u.call(this,m),delete m.features)};return{layers:r,listener:u,delegates:{[v]:p}}}}_saveDelegatedListener(v,r){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[v]=this._delegatedListeners[v]||[],this._delegatedListeners[v].push(r)}_removeDelegatedListener(v,r,u){if(!this._delegatedListeners||!this._delegatedListeners[v])return;const p=this._delegatedListeners[v];for(let m=0;mr.includes(S))){for(const S in _.delegates)this.off(S,_.delegates[S]);return void p.splice(m,1)}}}on(v,r,u){if(u===void 0)return super.on(v,r);const p=this._createDelegatedListener(v,typeof r=="string"?[r]:r,u);this._saveDelegatedListener(v,p);for(const m in p.delegates)this.on(m,p.delegates[m]);return this}once(v,r,u){if(u===void 0)return super.once(v,r);const p=typeof r=="string"?[r]:r,m=this._createDelegatedListener(v,p,u);for(const _ in m.delegates){const S=m.delegates[_];m.delegates[_]=(...E)=>{this._removeDelegatedListener(v,p,u),S(...E)}}this._saveDelegatedListener(v,m);for(const _ in m.delegates)this.once(_,m.delegates[_]);return this}off(v,r,u){return u===void 0?super.off(v,r):(this._removeDelegatedListener(v,typeof r=="string"?[r]:r,u),this)}queryRenderedFeatures(v,r){if(!this.style)return[];let u;const p=v instanceof c.P||Array.isArray(v),m=p?v:[[0,0],[this.transform.width,this.transform.height]];if(r=r||(p?{}:v)||{},m instanceof c.P||typeof m[0]=="number")u=[c.P.convert(m)];else{const _=c.P.convert(m[0]),S=c.P.convert(m[1]);u=[_,new c.P(S.x,_.y),S,new c.P(_.x,S.y),_]}return this.style.queryRenderedFeatures(u,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 u=this.style&&r.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!v)),v?(this.style=new tc(this,r||{}),this.style.setEventedParent(this,{style:this.style}),typeof v=="string"?this.style.loadURL(v,r,u):this.style.loadJSON(v,r,u),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new tc(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(v,r){if(typeof v=="string"){const u=this._requestManager.transformRequest(v,"Style");c.h(u,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(u){c.w(`Unable to perform style diff: ${u.message||u.error||u}. 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 u in this.style._layers){const p=this.style._layers[u];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 Rd(this.painter,r,v),this.painter.renderToTexture=new om(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=u=>{u.dataType==="style"?this.terrain.sourceCache.freeRtt():u.dataType==="source"&&u.tile&&(u.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(u.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 u=v[r]._tiles;for(const p in u){const m=u[p];if(m.state!=="loaded"&&m.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,u={}){const{pixelRatio:p=1,sdf:m=!1,stretchX:_,stretchY:S,content:E,textFitWidth:C,textFitHeight:R}=u;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:B,height:N,data:X}=r,ee=r;return this.style.addImage(v,{data:new c.R({width:B,height:N},new Uint8Array(X)),pixelRatio:p,stretchX:_,stretchY:S,content:E,textFitWidth:C,textFitHeight:R,sdf:m,version:0,userImage:ee}),ee.onAdd&&ee.onAdd(this,v),this}}{const{width:B,height:N,data:X}=A.getImageData(r);this.style.addImage(v,{data:new c.R({width:B,height:N},X),pixelRatio:p,stretchX:_,stretchY:S,content:E,textFitWidth:C,textFitHeight:R,sdf:m,version:0})}}updateImage(v,r){const u=this.style.getImage(v);if(!u)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)?A.getImageData(r):r,{width:m,height:_,data:S}=p;if(m===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(m!==u.data.width||_!==u.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 E=!(r instanceof HTMLImageElement||c.b(r));return u.data.replace(S,E),this.style.updateImage(v,u),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 Z.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,u){return this.style.setLayerZoomRange(v,r,u),this._update(!0)}setFilter(v,r,u={}){return this.style.setFilter(v,r,u),this._update(!0)}getFilter(v){return this.style.getFilter(v)}setPaintProperty(v,r,u,p={}){return this.style.setPaintProperty(v,r,u,p),this._update(!0)}getPaintProperty(v,r){return this.style.getPaintProperty(v,r)}setLayoutProperty(v,r,u,p={}){return this.style.setLayoutProperty(v,r,u,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,u={}){return this._lazyInitEmptyStyle(),this.style.addSprite(v,r,u,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,u=>{u||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=M.create("div","maplibregl-canvas-container",v);this._interactive&&r.classList.add("maplibregl-interactive"),this._canvas=M.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 u=this._containerDimensions(),p=this._getClampedPixelRatio(u[0],u[1]);this._resizeCanvas(u[0],u[1],p);const m=this._controlContainer=M.create("div","maplibregl-control-container",v),_=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(S=>{_[S]=M.create("div",`maplibregl-ctrl-${S} `,m)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(v,r,u){this._canvas.width=Math.floor(u*v),this._canvas.height=Math.floor(u*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 u=this._canvas.getContext("webgl2",v)||this._canvas.getContext("webgl",v);if(!u){const p="Failed to initialize WebGL";throw r?(r.message=p,new Error(JSON.stringify(r))):new Error(p)}this.painter=new yc(u,this.transform),F.testSupport(u)}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 u=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const m=this.transform.zoom,_=A.now();this.style.zoomHistory.update(m,_);const S=new c.z(m,{now:_,fadeDuration:r,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),E=S.crossFadingFactor();E===1&&E===this._crossFadingFactor||(u=!0,this._crossFadingFactor=E),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()||u)&&(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 u of this._controls)u.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),Z.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),M.remove(this._canvasContainer),M.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,A.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 am}getCameraTargetElevation(){return this.transform.elevation}},g.MapMouseEvent=Wn,g.MapTouchEvent=aa,g.MapWheelEvent=em,g.Marker=Ic,g.NavigationControl=class{constructor(v){this._updateZoomButtons=()=>{const r=this._map.getZoom(),u=r===this._map.getMaxZoom(),p=r===this._map.getMinZoom();this._zoomInButton.disabled=u,this._zoomOutButton.disabled=p,this._zoomInButton.setAttribute("aria-disabled",u.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,u)=>{const p=this._map._getUIString(`NavigationControl.${u}`);r.title=p,r.setAttribute("aria-label",p)},this.options=c.e({},Q_,v),this._container=M.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})),M.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})),M.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=M.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 e0(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){M.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 u=M.create("button",v,this._container);return u.type="button",u.addEventListener("click",r),u}},g.Popup=class extends c.E{constructor(v){super(),this.remove=()=>(this._content&&M.remove(this._content),this._container&&(M.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 u;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=M.create("div","maplibregl-popup",this._map.getContainer()),this._tip=M.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const E of this.options.className.split(" "))this._container.classList.add(E);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?Vr(this._lngLat,this._flatPos,this._map.transform):(u=this._lngLat)===null||u===void 0?void 0:u.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 m=this.options.anchor;const _=Mc(this.options.offset);if(!m){const E=this._container.offsetWidth,C=this._container.offsetHeight;let R;R=p.y+_.bottom.ythis._map.transform.height-C?["bottom"]:[],p.xthis._map.transform.width-E/2&&R.push("right"),m=R.length===0?"bottom":R.join("-")}let S=p.add(_[m]);this.options.subpixelPositioning||(S=S.round()),M.setTransform(this._container,`${sl[m]} translate(${S.x}px,${S.y}px)`),Cc(this._container,m,"popup")},this._onClose=()=>{this.remove()},this.options=c.e(Object.create(Ut),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(),u=document.createElement("body");let p;for(u.innerHTML=v;p=u.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=M.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=M.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(Pc);v&&v.focus()}},g.RasterDEMTileSource=Ze,g.RasterTileSource=Te,g.ScaleControl=class{constructor(v){this._onMove=()=>{hu(this._map,this._container,this.options)},this.setUnit=r=>{this.options.unit=r,hu(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Hs),v)}getDefaultPosition(){return"bottom-left"}onAdd(v){return this._map=v,this._container=M.create("div","maplibregl-ctrl maplibregl-ctrl-scale",v.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){M.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},g.ScrollZoomHandler=vs,g.Style=tc,g.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=M.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=M.create("button","maplibregl-ctrl-terrain",this._container),M.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(){M.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},g.TwoFingersTouchPitchHandler=el,g.TwoFingersTouchRotateHandler=Id,g.TwoFingersTouchZoomHandler=Ed,g.TwoFingersTouchZoomRotateHandler=Md,g.VectorTileSource=se,g.VideoSource=kt,g.addSourceType=(v,r)=>c._(void 0,void 0,void 0,function*(){if(Tr(v))throw new Error(`A source type called "${v}" already exists.`);((u,p)=>{Bt[u]=p})(v,r)}),g.clearPrewarmedResources=function(){const v=er;v&&(v.isPreloaded()&&v.numActive()===1?(v.release(nt),er=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()"))},g.getMaxParallelImageRequests=function(){return c.a.MAX_PARALLEL_IMAGE_REQUESTS},g.getRTLTextPluginStatus=function(){return vn().getRTLTextPluginStatus()},g.getVersion=function(){return Fd},g.getWorkerCount=function(){return rt.workerCount},g.getWorkerUrl=function(){return c.a.WORKER_URL},g.importScriptInWorkers=function(v){return fr().broadcast("IS",v)},g.prewarm=function(){Yt().acquire(nt)},g.setMaxParallelImageRequests=function(v){c.a.MAX_PARALLEL_IMAGE_REQUESTS=v},g.setRTLTextPlugin=function(v,r){return vn().setRTLTextPlugin(v,r)},g.setWorkerCount=function(v){rt.workerCount=v},g.setWorkerUrl=function(v){c.a.WORKER_URL=v}});var f=n;return f})})(_P);var zO=_P.exports;const xP=dp(zO),RO={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 Uh={};/** + * @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 wP=Ht;function sr(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n